[1335] | 1 |
|
---|
[96] | 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: collect.c 1799 2015-03-16 22:26:04Z gyoung $
|
---|
| 5 |
|
---|
| 6 | Collector
|
---|
| 7 |
|
---|
| 8 | Copyright (c) 1993-98 M. Kimes
|
---|
[1671] | 9 | Copyright (c) 2003, 2012 Steven H. Levine
|
---|
[96] | 10 |
|
---|
[130] | 11 | 15 Oct 02 MK Baseline
|
---|
| 12 | 10 Jan 04 SHL Avoid -1L byte counts
|
---|
| 13 | 01 Aug 04 SHL Rework lstrip/rstrip usage
|
---|
| 14 | 23 May 05 SHL Use QWL_USER
|
---|
[145] | 15 | 24 May 05 SHL Rework Win_Error usage
|
---|
[155] | 16 | 25 May 05 SHL Use ULONGLONG and CommaFmtULL
|
---|
| 17 | 25 May 05 SHL Rework for FillInRecordFromFFB
|
---|
[186] | 18 | 05 Jun 05 SHL Use QWL_USER
|
---|
[194] | 19 | 06 Jun 05 SHL Indent -i2
|
---|
[197] | 20 | 06 Jun 05 SHL Make savedSortFlags static to avoid referencing garbage
|
---|
[280] | 21 | 24 Oct 05 SHL Sanitize handle references
|
---|
| 22 | 24 Oct 05 SHL CollectorCnrWndProc: avoid excess writes to Status2 window
|
---|
| 23 | 10 Nov 05 SHL CollectorCnrWndProc: correct missing button window updates
|
---|
[352] | 24 | 14 Jul 06 SHL Use Runtime_Error
|
---|
[403] | 25 | 27 Jul 06 SHL Avoid shutdown hang - pre3 typo
|
---|
| 26 | 29 Jul 06 SHL Use xfgets_bstripcr
|
---|
[444] | 27 | 15 Aug 06 SHL Don't write garbage to CollectorFilter INI entry
|
---|
| 28 | 15 Aug 06 SHL Rework SetMask args
|
---|
| 29 | 18 Aug 06 SHL CollectorCnrWndProc: avoid freeing NULL pointer
|
---|
[471] | 30 | 31 Aug 06 SHL Disable Utilities->Seek and scan menu while busy
|
---|
| 31 | 31 Aug 06 SHL Correct stop scan context menu enable/disable
|
---|
[593] | 32 | 30 Mar 07 GKY Remove GetPString for window class names
|
---|
[603] | 33 | 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
|
---|
| 34 | 06 Apr 07 GKY Add some error checking in drag/drop
|
---|
[618] | 35 | 19 Apr 07 SHL Use FreeDragInfoData. Add more drag/drop error checks.
|
---|
[672] | 36 | 12 May 07 SHL Use dcd->ulItemsToUnHilite
|
---|
[688] | 37 | 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
|
---|
[724] | 38 | 05 Jul 07 SHL CollectorCnrWndProc: just warn if busy
|
---|
[751] | 39 | 02 Aug 07 SHL Sync with CNRITEM mods
|
---|
[775] | 40 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
|
---|
[793] | 41 | 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
|
---|
[814] | 42 | 26 Aug 07 GKY DosSleep(1) in loops changed to (0)
|
---|
[872] | 43 | 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
|
---|
[917] | 44 | 10 Jan 08 SHL Sync with CfgDlgProc mods
|
---|
[946] | 45 | 10 Feb 08 GKY Implement bubble help for bitmap menu items
|
---|
[953] | 46 | 15 Feb 08 SHL Sync with settings menu rework
|
---|
[956] | 47 | 15 Feb 08 GKY Fix attempt to free container items that were never inserted
|
---|
| 48 | 15 Feb 08 GKY Fix "collect" so it updates recollected files and unhides them if needed
|
---|
[985] | 49 | 29 Feb 08 GKY Use xfree where appropriate
|
---|
[1041] | 50 | 06 Jul 08 GKY Update delete/undelete to include move to and open XWP trashcan
|
---|
[1065] | 51 | 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
|
---|
[1077] | 52 | all the details view settings (both the global variables and those in the
|
---|
| 53 | DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
|
---|
[1084] | 54 | 20 Jul 08 GKY Add save/append filename to clipboard.
|
---|
[1335] | 55 | Change menu wording to make these easier to find
|
---|
[1120] | 56 | 25 Aug 08 GKY Check TMP directory space warn if lee than 5 MiB prevent archiver from opening if
|
---|
[1335] | 57 | less than 10 KiB (It hangs and can't be closed)
|
---|
| 58 | 10 Dec 08 SHL Integrate exception handler support
|
---|
[1357] | 59 | 26 Dec 08 GKY Fixed DROPHELP to check for copy as default is action is DO_DEFAULT
|
---|
[1375] | 60 | 01 Jan 09 GKY Add Seek and Scan to drives & directory context menus pass drive/dir as search root
|
---|
[1395] | 61 | 07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error
|
---|
| 62 | 07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook.
|
---|
| 63 | 07 Feb 09 GKY Add *DateFormat functions to format dates based on locale
|
---|
| 64 | 07 Feb 09 GKY Move repeated strings to PCSZs.
|
---|
[1400] | 65 | 08 Mar 09 GKY Renamed commafmt.h i18nutil.h
|
---|
| 66 | 08 Mar 09 GKY Additional strings move to PCSZs in init.c
|
---|
[1430] | 67 | 06 Jun 09 GKY Add option to show file system type or drive label in tree
|
---|
[1439] | 68 | 12 Jul 09 GKY Add szFSType to FillInRecordFromFSA use to bypass EA scan and size formatting
|
---|
[1456] | 69 | for tree container
|
---|
[1442] | 70 | 13 Jul 09 GKY Fixed double free of memory buffer in UM_COLLECTFROMFILE
|
---|
[1456] | 71 | 15 Sep 09 SHL Use UM_GREP when passing pathname
|
---|
[1498] | 72 | 17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
|
---|
[1546] | 73 | 23 Oct 10 GKY Add menu items for opening directory cnrs based on path of selected item
|
---|
[1563] | 74 | including the option to use walk directories to select path
|
---|
[1561] | 75 | 28 May 11 GKY Fixed trap caused by passing a nonexistant pci to FillInRecordFromFFB in
|
---|
[1611] | 76 | UM_COLLECT because pci is limited to 65535 files. (nRecord is a USHORT)
|
---|
[1563] | 77 | 29 May 11 SHL Rework UM_COLLECT >65K records logic to not require double loop
|
---|
| 78 | 29 May 11 SHL Tweak UM_COLLECT to bypass FindCnrRecord when container initially empty
|
---|
[1611] | 79 | 08 Aug 11 SHL Rework UM_COLLECT to avoid spurious container items free
|
---|
[1615] | 80 | 13 Aug 11 GKY Have file count and KIBs update at the same time
|
---|
[1664] | 81 | 04 Aug 12 GKY Changes to use Unlock to unlock files if Unlock.exe is in path both from menu and as part of copy, move and
|
---|
[1702] | 82 | delete operations
|
---|
[1671] | 83 | 05 Sep 12 SHL Correct UM_COLLECTFROMFILE bad list file reporting
|
---|
[1702] | 84 | 13 Dec 13 SHL CollectorCnrWndProc IDM_FILTER: avoid exception on missing fileName
|
---|
[1741] | 85 | 22 Feb 14 GKY Fix warn readonly yes don't ask to work when recursing directories.
|
---|
[1799] | 86 | 16 Mar 15 GKY Add semaphore hmtxFiltering to prevent freeing dcd while filtering. Prevents
|
---|
| 87 | a trap when FM2 is shutdown or the container is closed while collector
|
---|
| 88 | container is still populating
|
---|
[96] | 89 |
|
---|
| 90 | ***********************************************************************/
|
---|
| 91 |
|
---|
[2] | 92 | #include <stdlib.h>
|
---|
| 93 | #include <string.h>
|
---|
| 94 | #include <ctype.h>
|
---|
| 95 | #include <share.h>
|
---|
[1563] | 96 | #include <limits.h> // USHRT_MAX
|
---|
[1335] | 97 | // #include <process.h> // _beginthread
|
---|
[155] | 98 |
|
---|
[907] | 99 | #define INCL_DOS // QSV_MS_COUNT
|
---|
| 100 | #define INCL_WIN
|
---|
| 101 | #define INCL_DOSERRORS
|
---|
| 102 | #define INCL_LONGLONG
|
---|
| 103 |
|
---|
[1181] | 104 | #include "fm3dll.h"
|
---|
[1221] | 105 | #include "fm3dll2.h" // #define's for UM_*, control id's, etc.
|
---|
[1205] | 106 | #include "dircnrs.h" // Data declaration(s)
|
---|
| 107 | #include "info.h" // Data declaration(s)
|
---|
| 108 | #include "init.h" // Data declaration(s)
|
---|
[2] | 109 | #include "fm3dlg.h"
|
---|
| 110 | #include "fm3str.h"
|
---|
| 111 | #include "mle.h"
|
---|
| 112 | #include "grep.h"
|
---|
[907] | 113 | #include "comp.h"
|
---|
| 114 | #include "arccnrs.h" // StartArcCnr
|
---|
| 115 | #include "filldir.h" // EmptyCnr...
|
---|
| 116 | #include "strutil.h" // GetPString
|
---|
| 117 | #include "errutil.h" // Runtime_Error
|
---|
[942] | 118 | #include "tmrsvcs.h" // ITIMER_DESC
|
---|
[953] | 119 | #include "notebook.h" // CfgDlgProc
|
---|
[1077] | 120 | #include "command.h" // RunCommand
|
---|
[1563] | 121 | #include "worker.h" // Action, MassAction
|
---|
| 122 | #include "notify.h" // AddNote
|
---|
[1335] | 123 | #include "misc.h" // AdjustCnrColsForPref, AdjustDetailsSwitches, CnrDirectEdit,
|
---|
[1159] | 124 | // LoadDetailsSwitches, OpenEdit, QuickPopup, SayFilter
|
---|
| 125 | // SaySort, SayView, SetCnrCols, SetDetailsSwitches
|
---|
[1181] | 126 | // SetSortChecks, SetViewMenu, disable_menuitem, CheckMenu
|
---|
| 127 | // CurrentRecord, DrawTargetEmphasis, IsFm2Window
|
---|
[1159] | 128 | #include "chklist.h" // CenterOverWindow, DropListProc
|
---|
| 129 | #include "collect.h"
|
---|
| 130 | #include "common.h" // CommonCnrProc, CommonCreateTextChildren, CommonFrameWndProc
|
---|
[1563] | 131 | // CommonTextPaint
|
---|
[1159] | 132 | #include "select.h" // DeselectAll, HideAll, RemoveAll, SelectAll, SelectList
|
---|
| 133 | #include "dirsize.h" // DirSizeProc
|
---|
| 134 | #include "grep2.h" // GrepDlgProc
|
---|
| 135 | #include "mainwnd.h" // MakeBubble
|
---|
| 136 | #include "objwin.h" // MakeObjWin
|
---|
| 137 | #include "saveclip.h" // SaveListDlgProc
|
---|
| 138 | #include "findrec.h" // ShowCnrRecord
|
---|
| 139 | #include "sortcnr.h" // SortCollectorCnr
|
---|
| 140 | #include "seeall.h" // StartSeeAll
|
---|
| 141 | #include "update.h" // UpdateCnrList, UpdateCnrRecord
|
---|
[1181] | 142 | #include "droplist.h" // CheckPmDrgLimit
|
---|
| 143 | #include "common.h" // CommonTextButton, CommonTextProc
|
---|
| 144 | #include "presparm.h" // CopyPresParams
|
---|
| 145 | #include "defview.h" // DefaultViewKeys
|
---|
| 146 | #include "draglist.h" // DoFileDrag, FreeDragInfoData
|
---|
| 147 | #include "systemf.h" // ExecOnList
|
---|
| 148 | #include "filter.h" // Filter
|
---|
| 149 | #include "findrec.h" // FindCnrRecord
|
---|
| 150 | #include "shadow.h" // OpenObject
|
---|
| 151 | #include "mkdir.h" // PMMkDir
|
---|
| 152 | #include "valid.h" // ParentIsDesktop
|
---|
| 153 | #include "viewer.h" // StartMLEEditor
|
---|
| 154 | #include "newview.h" // StartViewer
|
---|
| 155 | #include "undel.h" // UndeleteDlgProc
|
---|
[1400] | 156 | #include "i18nutil.h" // commafmt
|
---|
[1181] | 157 | #include "getnames.h" // insert_filename
|
---|
[1159] | 158 | #include "select.h" // InvertAll
|
---|
[1181] | 159 | #include "strips.h" // bstrip
|
---|
| 160 | #include "wrappers.h" // xDosFindFirst
|
---|
[1017] | 161 | #include "fortify.h"
|
---|
[1335] | 162 | #include "excputil.h" // xbeginthread
|
---|
[1563] | 163 | #include "walkem.h" // WalkAllDlgProc
|
---|
[1741] | 164 | #include "copyf.h" // ignorereadonly
|
---|
[1017] | 165 |
|
---|
[1205] | 166 | // Data definitions
|
---|
| 167 | #pragma data_seg(GLOBAL1)
|
---|
| 168 | HWND CollectorCnrMenu;
|
---|
| 169 | HWND hwndStatus2;
|
---|
| 170 |
|
---|
| 171 | #pragma data_seg(GLOBAL2)
|
---|
| 172 | INT CollectorsortFlags;
|
---|
| 173 |
|
---|
[2] | 174 | #pragma data_seg(DATA1)
|
---|
[352] | 175 | static PSZ pszSrcFile = __FILE__;
|
---|
| 176 |
|
---|
[194] | 177 | MRESULT EXPENTRY CollectorFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
| 178 | MPARAM mp2)
|
---|
| 179 | {
|
---|
| 180 | return CommonFrameWndProc(COLLECTOR_CNR, hwnd, msg, mp1, mp2);
|
---|
[2] | 181 | }
|
---|
| 182 |
|
---|
[551] | 183 | MRESULT EXPENTRY CollectorTextProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
| 184 | MPARAM mp2)
|
---|
[96] | 185 | {
|
---|
[197] | 186 | DIRCNRDATA *dcd;
|
---|
[155] | 187 |
|
---|
[194] | 188 | static BOOL emphasized = FALSE;
|
---|
[551] | 189 | static HWND hwndButtonPopup = (HWND) 0;
|
---|
[194] | 190 | static ULONG timestamp = ULONG_MAX;
|
---|
| 191 | static USHORT lastid = 0;
|
---|
[2] | 192 |
|
---|
[444] | 193 | switch (msg) {
|
---|
[194] | 194 | case WM_CREATE:
|
---|
| 195 | return CommonTextProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 196 |
|
---|
[194] | 197 | case UM_CONTEXTMENU:
|
---|
| 198 | case WM_CONTEXTMENU:
|
---|
| 199 | {
|
---|
| 200 | USHORT id;
|
---|
| 201 |
|
---|
| 202 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[444] | 203 | switch (id) {
|
---|
[194] | 204 | case DIR_SELECTED:
|
---|
| 205 | case DIR_VIEW:
|
---|
| 206 | case DIR_SORT:
|
---|
| 207 | {
|
---|
[551] | 208 | POINTL ptl = { 0, 0 };
|
---|
[194] | 209 | SWP swp;
|
---|
[2] | 210 |
|
---|
[194] | 211 | if (hwndButtonPopup)
|
---|
| 212 | WinDestroyWindow(hwndButtonPopup);
|
---|
[444] | 213 | if (id == lastid) {
|
---|
[194] | 214 | ULONG check;
|
---|
[2] | 215 |
|
---|
[194] | 216 | DosQuerySysInfo(QSV_MS_COUNT,
|
---|
[551] | 217 | QSV_MS_COUNT, &check, sizeof(check));
|
---|
[444] | 218 | if (check < timestamp + 500) {
|
---|
[194] | 219 | lastid = 0;
|
---|
| 220 | goto MenuAbort;
|
---|
| 221 | }
|
---|
| 222 | }
|
---|
[551] | 223 | hwndButtonPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
|
---|
[444] | 224 | if (hwndButtonPopup) {
|
---|
[551] | 225 | WinSetWindowUShort(hwndButtonPopup, QWS_ID, id);
|
---|
[194] | 226 | dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
|
---|
[352] | 227 | QW_PARENT),
|
---|
[551] | 228 | COLLECTOR_CNR), QWL_USER);
|
---|
[444] | 229 | if (id == DIR_VIEW) {
|
---|
| 230 | if (dcd) {
|
---|
[551] | 231 | SetViewMenu(hwndButtonPopup, dcd->flWindowAttr);
|
---|
[1065] | 232 | SetDetailsSwitches(hwndButtonPopup, &dcd->ds);
|
---|
[907] | 233 | CopyPresParams(hwndButtonPopup, hwnd);
|
---|
[194] | 234 | }
|
---|
[2] | 235 |
|
---|
[1673] | 236 | // don't have tree view in collector
|
---|
[194] | 237 | WinSendMsg(hwndButtonPopup,
|
---|
| 238 | MM_DELETEITEM,
|
---|
[551] | 239 | MPFROM2SHORT(IDM_TREEVIEW, FALSE), MPVOID);
|
---|
[2] | 240 |
|
---|
[194] | 241 | }
|
---|
[444] | 242 | else if (id == DIR_SORT) {
|
---|
[194] | 243 | if (dcd)
|
---|
[551] | 244 | SetSortChecks(hwndButtonPopup, dcd->sortFlags);
|
---|
[194] | 245 | }
|
---|
| 246 | ptl.x = 0;
|
---|
| 247 | if (WinPopupMenu(HWND_OBJECT,
|
---|
| 248 | HWND_OBJECT,
|
---|
[551] | 249 | hwndButtonPopup, -32767, -32767, 0, 0)) {
|
---|
| 250 | WinQueryWindowPos(hwndButtonPopup, &swp);
|
---|
[194] | 251 | ptl.y = -(swp.cy + 2);
|
---|
| 252 | }
|
---|
[444] | 253 | else {
|
---|
[551] | 254 | WinQueryWindowPos(hwnd, &swp);
|
---|
[194] | 255 | ptl.y = swp.cy + 2;
|
---|
| 256 | }
|
---|
| 257 | if (WinPopupMenu(hwnd,
|
---|
| 258 | hwnd,
|
---|
| 259 | hwndButtonPopup,
|
---|
| 260 | ptl.x,
|
---|
| 261 | ptl.y,
|
---|
| 262 | 0,
|
---|
| 263 | PU_HCONSTRAIN | PU_VCONSTRAIN |
|
---|
[551] | 264 | PU_KEYBOARD | PU_MOUSEBUTTON1)) {
|
---|
[194] | 265 | CenterOverWindow(hwndButtonPopup);
|
---|
[551] | 266 | PaintRecessedWindow(hwnd, NULLHANDLE, FALSE, FALSE);
|
---|
[194] | 267 | }
|
---|
| 268 | }
|
---|
| 269 | }
|
---|
| 270 | break;
|
---|
| 271 | default:
|
---|
| 272 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 273 | COLLECTOR_CNR),
|
---|
| 274 | WM_CONTROL,
|
---|
[551] | 275 | MPFROM2SHORT(COLLECTOR_CNR, CN_CONTEXTMENU), MPVOID);
|
---|
[194] | 276 | break;
|
---|
[2] | 277 | }
|
---|
[194] | 278 | }
|
---|
| 279 | MenuAbort:
|
---|
| 280 | if (msg == UM_CONTEXTMENU)
|
---|
| 281 | return 0;
|
---|
| 282 | break;
|
---|
[2] | 283 |
|
---|
[194] | 284 | case WM_MENUEND:
|
---|
[551] | 285 | if (hwndButtonPopup == (HWND) mp2) {
|
---|
| 286 | lastid = WinQueryWindowUShort((HWND) mp2, QWS_ID);
|
---|
[194] | 287 | WinDestroyWindow(hwndButtonPopup);
|
---|
[551] | 288 | hwndButtonPopup = (HWND) 0;
|
---|
| 289 | DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, ×tamp,
|
---|
| 290 | sizeof(timestamp));
|
---|
[444] | 291 | switch (lastid) {
|
---|
[194] | 292 | case DIR_SELECTED:
|
---|
| 293 | case DIR_VIEW:
|
---|
| 294 | case DIR_SORT:
|
---|
[551] | 295 | PaintRecessedWindow(hwnd, NULLHANDLE, TRUE, FALSE);
|
---|
[194] | 296 | break;
|
---|
[2] | 297 | }
|
---|
[194] | 298 | }
|
---|
| 299 | break;
|
---|
[2] | 300 |
|
---|
[194] | 301 | case WM_COMMAND:
|
---|
| 302 | {
|
---|
| 303 | DIRCNRDATA *dcd;
|
---|
| 304 | MRESULT mr;
|
---|
| 305 |
|
---|
| 306 | mr = WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,
|
---|
| 307 | QW_PARENT),
|
---|
[551] | 308 | COLLECTOR_CNR), msg, mp1, mp2);
|
---|
[194] | 309 | if (hwndButtonPopup &&
|
---|
| 310 | SHORT1FROMMP(mp1) > IDM_DETAILSTITLES &&
|
---|
[551] | 311 | SHORT1FROMMP(mp1) < IDM_DETAILSSETUP) {
|
---|
[194] | 312 | dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
|
---|
| 313 | QW_PARENT),
|
---|
[551] | 314 | COLLECTOR_CNR), QWL_USER);
|
---|
[194] | 315 | if (dcd)
|
---|
[1065] | 316 | SetDetailsSwitches(hwndButtonPopup, &dcd->ds);
|
---|
[2] | 317 | }
|
---|
[194] | 318 | return mr;
|
---|
| 319 | }
|
---|
[2] | 320 |
|
---|
[194] | 321 | case WM_MOUSEMOVE:
|
---|
| 322 | {
|
---|
| 323 | USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[1394] | 324 | PCSZ s = NULL;
|
---|
[194] | 325 |
|
---|
[444] | 326 | if (fOtherHelp) {
|
---|
[194] | 327 | if ((!hwndBubble ||
|
---|
| 328 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
---|
[551] | 329 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
[444] | 330 | switch (id) {
|
---|
[194] | 331 | case DIR_SELECTED:
|
---|
| 332 | s = GetPString(IDS_COLSELECTEDHELP);
|
---|
| 333 | break;
|
---|
| 334 | case DIR_TOTALS:
|
---|
| 335 | s = GetPString(IDS_COLTOTALSHELP);
|
---|
| 336 | break;
|
---|
| 337 | case DIR_VIEW:
|
---|
| 338 | s = GetPString(IDS_DIRCNRVIEWHELP);
|
---|
| 339 | break;
|
---|
| 340 | case DIR_SORT:
|
---|
| 341 | s = GetPString(IDS_DIRCNRSORTHELP);
|
---|
| 342 | break;
|
---|
| 343 | case DIR_FILTER:
|
---|
[948] | 344 | s = GetPString(IDS_DIRCNRFILTERHELP);
|
---|
| 345 | break;
|
---|
[194] | 346 | default:
|
---|
| 347 | break;
|
---|
| 348 | }
|
---|
| 349 | if (s)
|
---|
| 350 | MakeBubble(hwnd, TRUE, s);
|
---|
| 351 | else if (hwndBubble)
|
---|
| 352 | WinDestroyWindow(hwndBubble);
|
---|
| 353 | }
|
---|
[2] | 354 | }
|
---|
[444] | 355 | switch (id) {
|
---|
[194] | 356 | case DIR_FILTER:
|
---|
| 357 | case DIR_SORT:
|
---|
| 358 | case DIR_VIEW:
|
---|
| 359 | case DIR_SELECTED:
|
---|
| 360 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
| 361 | }
|
---|
| 362 | }
|
---|
| 363 | break;
|
---|
[2] | 364 |
|
---|
[194] | 365 | case WM_BUTTON3UP:
|
---|
| 366 | case WM_BUTTON1UP:
|
---|
| 367 | case WM_BUTTON3DOWN:
|
---|
| 368 | case WM_BUTTON1DOWN:
|
---|
| 369 | {
|
---|
| 370 | USHORT id;
|
---|
| 371 |
|
---|
[280] | 372 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[444] | 373 | switch (id) {
|
---|
[194] | 374 | case DIR_FILTER:
|
---|
| 375 | case DIR_SORT:
|
---|
| 376 | case DIR_VIEW:
|
---|
| 377 | case DIR_SELECTED:
|
---|
| 378 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
[2] | 379 | }
|
---|
[194] | 380 | }
|
---|
| 381 | break;
|
---|
[2] | 382 |
|
---|
[194] | 383 | case UM_CLICKED:
|
---|
| 384 | case UM_CLICKED3:
|
---|
| 385 | {
|
---|
| 386 | USHORT id, cmd = 0;
|
---|
| 387 |
|
---|
[280] | 388 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[444] | 389 | switch (id) {
|
---|
[194] | 390 | case DIR_VIEW:
|
---|
| 391 | case DIR_SORT:
|
---|
| 392 | case DIR_SELECTED:
|
---|
[551] | 393 | PostMsg(hwnd, UM_CONTEXTMENU, MPVOID, MPVOID);
|
---|
[194] | 394 | break;
|
---|
| 395 | case DIR_FILTER:
|
---|
| 396 | cmd = IDM_FILTER;
|
---|
| 397 | break;
|
---|
| 398 | default:
|
---|
| 399 | break;
|
---|
[2] | 400 | }
|
---|
[194] | 401 | if (cmd)
|
---|
[551] | 402 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[194] | 403 | COLLECTOR_CNR),
|
---|
[551] | 404 | WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
|
---|
[194] | 405 | }
|
---|
| 406 | return 0;
|
---|
[2] | 407 |
|
---|
[194] | 408 | case DM_DROP:
|
---|
| 409 | case DM_DRAGOVER:
|
---|
| 410 | case DM_DRAGLEAVE:
|
---|
| 411 | case DM_DROPHELP:
|
---|
[444] | 412 | if (msg == DM_DRAGOVER) {
|
---|
| 413 | if (!emphasized) {
|
---|
[194] | 414 | emphasized = TRUE;
|
---|
| 415 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[2] | 416 | }
|
---|
[194] | 417 | }
|
---|
[444] | 418 | else {
|
---|
| 419 | if (emphasized) {
|
---|
[194] | 420 | emphasized = FALSE;
|
---|
| 421 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[2] | 422 | }
|
---|
[194] | 423 | }
|
---|
| 424 | {
|
---|
| 425 | CNRDRAGINFO cnd;
|
---|
| 426 | USHORT dcmd;
|
---|
| 427 |
|
---|
[444] | 428 | switch (msg) {
|
---|
[194] | 429 | case DM_DROP:
|
---|
| 430 | dcmd = CN_DROP;
|
---|
| 431 | break;
|
---|
| 432 | case DM_DRAGOVER:
|
---|
| 433 | dcmd = CN_DRAGOVER;
|
---|
| 434 | break;
|
---|
| 435 | case DM_DRAGLEAVE:
|
---|
| 436 | dcmd = CN_DRAGLEAVE;
|
---|
| 437 | break;
|
---|
| 438 | case DM_DROPHELP:
|
---|
| 439 | dcmd = CN_DROPHELP;
|
---|
| 440 | break;
|
---|
[2] | 441 | }
|
---|
[194] | 442 | memset(&cnd, 0, sizeof(cnd));
|
---|
| 443 | cnd.pDragInfo = (PDRAGINFO) mp1;
|
---|
| 444 | cnd.pRecord = NULL;
|
---|
| 445 | return WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_CONTROL,
|
---|
| 446 | MPFROM2SHORT(COLLECTOR_CNR, dcmd), MPFROMP(&cnd));
|
---|
| 447 | }
|
---|
[2] | 448 | }
|
---|
[194] | 449 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
[2] | 450 | }
|
---|
| 451 |
|
---|
[194] | 452 | MRESULT EXPENTRY CollectorClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
| 453 | MPARAM mp2)
|
---|
| 454 | {
|
---|
[444] | 455 | switch (msg) {
|
---|
[194] | 456 | case UM_CONTAINERHWND:
|
---|
| 457 | return MRFROMLONG(WinWindowFromID(hwnd, COLLECTOR_CNR));
|
---|
[2] | 458 |
|
---|
[194] | 459 | case UM_VIEWSMENU:
|
---|
[872] | 460 | return MRFROMLONG(CheckMenu(hwnd, &CollectorCnrMenu, COLLECTORCNR_POPUP));
|
---|
[2] | 461 |
|
---|
[194] | 462 | case MM_PORTHOLEINIT:
|
---|
| 463 | case WM_INITMENU:
|
---|
| 464 | case UM_INITMENU:
|
---|
| 465 | case UM_CONTAINER_FILLED:
|
---|
| 466 | case UM_FILESMENU:
|
---|
| 467 | case UM_UPDATERECORD:
|
---|
| 468 | case UM_UPDATERECORDLIST:
|
---|
| 469 | return WinSendMsg(WinWindowFromID(hwnd, COLLECTOR_CNR), msg, mp1, mp2);
|
---|
[2] | 470 |
|
---|
[194] | 471 | case WM_PSETFOCUS:
|
---|
| 472 | case WM_SETFOCUS:
|
---|
| 473 | if (mp2)
|
---|
| 474 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
| 475 | break;
|
---|
[2] | 476 |
|
---|
[194] | 477 | case UM_FOCUSME:
|
---|
| 478 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, COLLECTOR_CNR));
|
---|
| 479 | break;
|
---|
[2] | 480 |
|
---|
[194] | 481 | case WM_PAINT:
|
---|
| 482 | {
|
---|
| 483 | HPS hps;
|
---|
| 484 | RECTL rcl;
|
---|
[2] | 485 |
|
---|
[280] | 486 | hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
|
---|
[444] | 487 | if (hps) {
|
---|
[194] | 488 | WinQueryWindowRect(hwnd, &rcl);
|
---|
| 489 | WinFillRect(hps, &rcl, CLR_PALEGRAY);
|
---|
| 490 | CommonTextPaint(hwnd, hps);
|
---|
| 491 | WinEndPaint(hps);
|
---|
[2] | 492 | }
|
---|
[194] | 493 | }
|
---|
| 494 | break;
|
---|
[2] | 495 |
|
---|
[194] | 496 | case UM_SIZE:
|
---|
| 497 | case WM_SIZE:
|
---|
[444] | 498 | if (msg == UM_SIZE) {
|
---|
[194] | 499 | SWP swp;
|
---|
[2] | 500 |
|
---|
[194] | 501 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 502 | mp1 = MPFROM2SHORT(swp.cx, swp.cy);
|
---|
| 503 | mp2 = MPFROM2SHORT(swp.cx, swp.cy);
|
---|
| 504 | }
|
---|
| 505 | {
|
---|
| 506 | USHORT cx, cy, bx;
|
---|
[2] | 507 |
|
---|
[194] | 508 | cx = SHORT1FROMMP(mp2);
|
---|
| 509 | cy = SHORT2FROMMP(mp2);
|
---|
| 510 | WinSetWindowPos(WinWindowFromID(hwnd, COLLECTOR_CNR), HWND_TOP,
|
---|
[551] | 511 | 0, 0, cx, cy - 24, SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
[194] | 512 | WinSetWindowPos(WinWindowFromID(hwnd, DIR_TOTALS), HWND_TOP,
|
---|
| 513 | 2,
|
---|
| 514 | cy - 22,
|
---|
[551] | 515 | (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
[194] | 516 | WinSetWindowPos(WinWindowFromID(hwnd, DIR_SELECTED), HWND_TOP,
|
---|
| 517 | 2 + (cx / 3) + 2,
|
---|
| 518 | cy - 22,
|
---|
[551] | 519 | (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
[194] | 520 | bx = (cx - (2 + (((cx / 3) + 2) * 2))) / 3;
|
---|
| 521 | WinSetWindowPos(WinWindowFromID(hwnd, DIR_VIEW), HWND_TOP,
|
---|
| 522 | 2 + (((cx / 3) + 2) * 2),
|
---|
[551] | 523 | cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
[194] | 524 | WinSetWindowPos(WinWindowFromID(hwnd, DIR_SORT), HWND_TOP,
|
---|
| 525 | 2 + (((cx / 3) + 2) * 2) + bx,
|
---|
[551] | 526 | cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
[194] | 527 | WinSetWindowPos(WinWindowFromID(hwnd, DIR_FILTER), HWND_TOP,
|
---|
| 528 | 2 + (((cx / 3) + 2) * 2) + (bx * 2),
|
---|
[551] | 529 | cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
[194] | 530 | }
|
---|
[280] | 531 | CommonTextPaint(hwnd, NULLHANDLE);
|
---|
[444] | 532 | if (msg == UM_SIZE) {
|
---|
[194] | 533 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
|
---|
| 534 | SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE);
|
---|
| 535 | return 0;
|
---|
| 536 | }
|
---|
| 537 | break;
|
---|
[2] | 538 |
|
---|
[194] | 539 | case UM_COMMAND:
|
---|
| 540 | case WM_COMMAND:
|
---|
| 541 | case WM_CONTROL:
|
---|
| 542 | case WM_CLOSE:
|
---|
| 543 | return WinSendMsg(WinWindowFromID(hwnd, COLLECTOR_CNR), msg, mp1, mp2);
|
---|
[2] | 544 | }
|
---|
[194] | 545 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 546 | }
|
---|
| 547 |
|
---|
[942] | 548 | MRESULT EXPENTRY CollectorObjWndProc(HWND hwnd, ULONG msg,
|
---|
| 549 | MPARAM mp1, MPARAM mp2)
|
---|
[194] | 550 | {
|
---|
[197] | 551 | ULONG size;
|
---|
[2] | 552 | DIRCNRDATA *dcd;
|
---|
| 553 |
|
---|
[444] | 554 | switch (msg) {
|
---|
[194] | 555 | case WM_CREATE:
|
---|
[1077] | 556 | // 18 Jul 08 SHL fixme to doc why messsage gets lost
|
---|
| 557 | DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2); // 18 Jul 08 SHL fixme
|
---|
[194] | 558 | break;
|
---|
[2] | 559 |
|
---|
[194] | 560 | case DM_PRINTOBJECT:
|
---|
| 561 | return MRFROMLONG(DRR_TARGET);
|
---|
[2] | 562 |
|
---|
[194] | 563 | case DM_DISCARDOBJECT:
|
---|
| 564 | dcd = INSTDATA(hwnd);
|
---|
[444] | 565 | if (fFM2Deletes && dcd) {
|
---|
[194] | 566 | LISTINFO *li;
|
---|
| 567 | CNRDRAGINFO cni;
|
---|
[2] | 568 |
|
---|
[194] | 569 | cni.pRecord = NULL;
|
---|
| 570 | cni.pDragInfo = (PDRAGINFO) mp1;
|
---|
[551] | 571 | li = DoFileDrop(dcd->hwndCnr, NULL, FALSE, MPVOID, MPFROMP(&cni));
|
---|
[687] | 572 | CheckPmDrgLimit(cni.pDragInfo);
|
---|
[444] | 573 | if (li) {
|
---|
[672] | 574 | li->type = fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE;
|
---|
[194] | 575 | if (!PostMsg(hwnd, UM_MASSACTION, MPFROMP(li), MPVOID))
|
---|
| 576 | FreeListInfo(li);
|
---|
| 577 | else
|
---|
| 578 | return MRFROMLONG(DRR_SOURCE);
|
---|
[2] | 579 | }
|
---|
[194] | 580 | }
|
---|
| 581 | return MRFROMLONG(DRR_TARGET);
|
---|
[2] | 582 |
|
---|
[194] | 583 | case UM_UPDATERECORDLIST:
|
---|
| 584 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
[444] | 585 | if (dcd && mp1) {
|
---|
[194] | 586 | INT numentries = 0;
|
---|
| 587 | CHAR **list = (CHAR **) mp1;
|
---|
[2] | 588 |
|
---|
[194] | 589 | while (list[numentries])
|
---|
| 590 | numentries++;
|
---|
| 591 | if (numentries)
|
---|
[551] | 592 | UpdateCnrList(dcd->hwndCnr, list, numentries, FALSE, dcd);
|
---|
[194] | 593 | }
|
---|
| 594 | return 0;
|
---|
[2] | 595 |
|
---|
[194] | 596 | case UM_SETUP:
|
---|
[1077] | 597 | # ifdef FORTIFY
|
---|
| 598 | Fortify_EnterScope();
|
---|
| 599 | # endif
|
---|
[194] | 600 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
[444] | 601 | if (dcd) {
|
---|
[1077] | 602 | # ifdef FORTIFY
|
---|
[1078] | 603 | Fortify_BecomeOwner(dcd);
|
---|
[1077] | 604 | # endif
|
---|
[1673] | 605 | // set unique id
|
---|
[194] | 606 | WinSetWindowUShort(hwnd,
|
---|
| 607 | QWS_ID,
|
---|
[551] | 608 | COLLECTOROBJ_FRAME + (COLLECTOR_FRAME - dcd->id));
|
---|
| 609 | dcd->hwndObject = hwnd;
|
---|
[942] | 610 | // 09 Feb 08 SHL fixme to be sure applet does not really need this
|
---|
| 611 | // if (ParentIsDesktop(hwnd, dcd->hwndParent))
|
---|
| 612 | // DosSleep(100); //05 Aug 07 GKY 250
|
---|
[194] | 613 | }
|
---|
| 614 | else
|
---|
| 615 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 616 | return 0;
|
---|
[2] | 617 |
|
---|
[194] | 618 | case UM_COMMAND:
|
---|
[444] | 619 | if (mp1) {
|
---|
[194] | 620 | LISTINFO *li = (LISTINFO *) mp1;
|
---|
| 621 |
|
---|
[551] | 622 | switch (li->type) {
|
---|
[194] | 623 | case IDM_DOITYOURSELF:
|
---|
| 624 | case IDM_APPENDTOCLIP:
|
---|
[1084] | 625 | case IDM_APPENDTOCLIPFILENAME:
|
---|
[194] | 626 | case IDM_SAVETOCLIP:
|
---|
| 627 | case IDM_ARCHIVE:
|
---|
| 628 | case IDM_ARCHIVEM:
|
---|
| 629 | case IDM_VIEW:
|
---|
| 630 | case IDM_VIEWTEXT:
|
---|
| 631 | case IDM_VIEWBINARY:
|
---|
| 632 | case IDM_VIEWARCHIVE:
|
---|
| 633 | case IDM_EDIT:
|
---|
| 634 | case IDM_EDITTEXT:
|
---|
| 635 | case IDM_EDITBINARY:
|
---|
| 636 | case IDM_OBJECT:
|
---|
| 637 | case IDM_SHADOW:
|
---|
| 638 | case IDM_SHADOW2:
|
---|
| 639 | case IDM_PRINT:
|
---|
| 640 | case IDM_ATTRS:
|
---|
| 641 | case IDM_DELETE:
|
---|
| 642 | case IDM_PERMDELETE:
|
---|
| 643 | case IDM_FAKEEXTRACT:
|
---|
| 644 | case IDM_FAKEEXTRACTM:
|
---|
| 645 | case IDM_MCIPLAY:
|
---|
| 646 | case IDM_UPDATE:
|
---|
[1741] | 647 | if (li->type == IDM_DELETE)
|
---|
| 648 | ignorereadonly = FALSE;
|
---|
[194] | 649 | if (PostMsg(hwnd, UM_MASSACTION, mp1, mp2))
|
---|
| 650 | return (MRESULT) TRUE;
|
---|
| 651 | break;
|
---|
| 652 | default:
|
---|
| 653 | if (PostMsg(hwnd, UM_ACTION, mp1, mp2))
|
---|
| 654 | return (MRESULT) TRUE;
|
---|
[2] | 655 | }
|
---|
[194] | 656 | }
|
---|
| 657 | return 0;
|
---|
[2] | 658 |
|
---|
[194] | 659 | case UM_COLLECT:
|
---|
| 660 | DosError(FERR_DISABLEHARDERR);
|
---|
| 661 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
[444] | 662 | if (dcd) {
|
---|
[194] | 663 | LISTINFO *li = (LISTINFO *) mp1;
|
---|
[1563] | 664 | INT x;
|
---|
[841] | 665 | FILEFINDBUF4L fb4;
|
---|
[194] | 666 | HDIR hdir;
|
---|
| 667 | ULONG ulMaxFiles;
|
---|
| 668 | CHAR fullname[CCHMAXPATH];
|
---|
[2] | 669 |
|
---|
[942] | 670 | if (!hwndStatus) {
|
---|
| 671 | WinSetWindowText(WinWindowFromID(dcd->hwndClient, DIR_SELECTED),
|
---|
[1498] | 672 | (CHAR *) GetPString(IDS_COLLECTINGTEXT));
|
---|
[942] | 673 | }
|
---|
| 674 | else {
|
---|
| 675 | if (WinQueryFocus(HWND_DESKTOP) == dcd->hwndCnr)
|
---|
[1498] | 676 | WinSetWindowText(hwndStatus, (CHAR *) GetPString(IDS_COLLECTINGTEXT));
|
---|
[942] | 677 | }
|
---|
| 678 |
|
---|
[1563] | 679 | for (ulMaxFiles = 0; li->list[ulMaxFiles]; ulMaxFiles++) ; // Count
|
---|
| 680 |
|
---|
| 681 | if (ulMaxFiles) {
|
---|
| 682 | PCNRITEM pci = NULL;
|
---|
| 683 | PCNRITEM pciFirst = NULL;
|
---|
[1611] | 684 | PCNRITEM pciPrev;
|
---|
[1563] | 685 | ULONG nm;
|
---|
| 686 | ULONG ulRecsAtStart;
|
---|
| 687 | ULONG ulRecsToInsert;
|
---|
[1611] | 688 | ULONG ulRecsInserted = 0;
|
---|
[1615] | 689 | ULONGLONG ullTotalBytes = 0;
|
---|
[1611] | 690 | BOOL checkToInsert = FALSE;
|
---|
[1563] | 691 | CNRINFO cnri;
|
---|
| 692 | RECORDINSERT ri;
|
---|
| 693 | ITIMER_DESC itdSleep = { 0 }; // 06 Feb 08 SHL
|
---|
| 694 |
|
---|
| 695 | InitITimer(&itdSleep, 500); // Sleep every 500 mSec
|
---|
| 696 |
|
---|
| 697 | // Query initial count
|
---|
| 698 | // 2011-05-29 SHL fixme to be utility
|
---|
| 699 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 700 | cnri.cb = sizeof(CNRINFO);
|
---|
| 701 | if (WinSendMsg(dcd->hwndCnr, CM_QUERYCNRINFO, MPFROMP(&cnri),
|
---|
| 702 | MPFROMLONG(sizeof(CNRINFO)))) {
|
---|
| 703 | ulRecsAtStart = cnri.cRecords;
|
---|
| 704 | }
|
---|
| 705 | else {
|
---|
[1673] | 706 | Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, PCSZ_QUERYCNRINFO);
|
---|
[1563] | 707 | ulRecsAtStart = 0;
|
---|
| 708 | }
|
---|
| 709 |
|
---|
| 710 | for (x = 0; li->list[x]; x++) {
|
---|
[1611] | 711 |
|
---|
| 712 | // Allocate more container items if needed
|
---|
[1563] | 713 | if (!pci) {
|
---|
[1611] | 714 | ulRecsToInsert = ulMaxFiles - ulRecsInserted; // Left to do
|
---|
[1563] | 715 | if (ulRecsToInsert > USHRT_MAX)
|
---|
[1611] | 716 | ulRecsToInsert = USHRT_MAX; // Avoid USHORT overflows
|
---|
[1563] | 717 | pci = WinSendMsg(dcd->hwndCnr, CM_ALLOCRECORD,
|
---|
| 718 | MPFROMLONG(EXTRA_RECORD_BYTES),
|
---|
| 719 | MPFROMLONG(ulRecsToInsert));
|
---|
[1611] | 720 | pciFirst = pci;
|
---|
| 721 | pciPrev = NULL;
|
---|
[1563] | 722 | if (!pci) {
|
---|
| 723 | Runtime_Error(pszSrcFile, __LINE__, PCSZ_CM_ALLOCRECORD);
|
---|
| 724 | break;
|
---|
| 725 | }
|
---|
| 726 | } // if need allocate
|
---|
[1611] | 727 |
|
---|
[1563] | 728 | nm = 1;
|
---|
| 729 | hdir = HDIR_CREATE;
|
---|
| 730 | DosError(FERR_DISABLEHARDERR);
|
---|
| 731 | // If started with records in container, check if updating existing record
|
---|
| 732 | if (ulRecsAtStart &&
|
---|
| 733 | FindCnrRecord(dcd->hwndCnr,
|
---|
| 734 | li->list[x],
|
---|
| 735 | NULL,
|
---|
| 736 | FALSE,
|
---|
| 737 | FALSE,
|
---|
[1611] | 738 | TRUE))
|
---|
| 739 | {
|
---|
| 740 | // Updating existing record
|
---|
| 741 | PCNRITEM pciUpd = UpdateCnrRecord(dcd->hwndCnr, li->list[x], FALSE, dcd);
|
---|
| 742 | if (!pciUpd) {
|
---|
| 743 | // file has disappeared
|
---|
[1563] | 744 | Runtime_Error(pszSrcFile, __LINE__, "pci NULL for list[%u]", x);
|
---|
| 745 | }
|
---|
| 746 | else {
|
---|
[1611] | 747 | // Update OK
|
---|
| 748 | if (Filter((PMINIRECORDCORE) pciUpd, (PVOID) & dcd->mask)) {
|
---|
| 749 | pciUpd->rc.flRecordAttr &= ~CRA_FILTERED; // Ensure visible
|
---|
[1563] | 750 | // 2011-05-29 SHL fixme to check fail
|
---|
| 751 | WinSendMsg(dcd->hwndCnr, CM_INVALIDATERECORD, MPVOID,
|
---|
| 752 | MPFROM2SHORT(0, CMA_REPOSITION | CMA_ERASE));
|
---|
| 753 | }
|
---|
| 754 | }
|
---|
[1611] | 755 | ulMaxFiles--; // No insert needed
|
---|
| 756 | checkToInsert = TRUE;
|
---|
[1563] | 757 | }
|
---|
[1611] | 758 | // Add new entry maybe
|
---|
[1563] | 759 | else if (*li->list[x] &&
|
---|
| 760 | !DosQueryPathInfo(li->list[x], FIL_QUERYFULLNAME,
|
---|
| 761 | fullname, sizeof(fullname)) &&
|
---|
| 762 | !IsRoot(fullname) &&
|
---|
| 763 | !xDosFindFirst(fullname,
|
---|
| 764 | &hdir,
|
---|
| 765 | FILE_NORMAL | FILE_DIRECTORY |
|
---|
| 766 | FILE_ARCHIVED | FILE_SYSTEM |
|
---|
| 767 | FILE_HIDDEN | FILE_READONLY,
|
---|
[1611] | 768 | &fb4, sizeof(fb4), &nm, FIL_QUERYEASIZEL))
|
---|
| 769 | {
|
---|
| 770 | // OK to add
|
---|
[1563] | 771 | DosFindClose(hdir);
|
---|
| 772 | priority_normal();
|
---|
| 773 | *fb4.achName = 0;
|
---|
[1615] | 774 | ullTotalBytes += FillInRecordFromFFB(dcd->hwndCnr,
|
---|
[1563] | 775 | pci,
|
---|
| 776 | fullname, &fb4, FALSE, dcd);
|
---|
| 777 | pciPrev = pci;
|
---|
| 778 | pci = (PCNRITEM) pci->rc.preccNextRecord;
|
---|
| 779 | }
|
---|
| 780 | else {
|
---|
| 781 | // DosQueryPathInfo etc. failed - try to recover
|
---|
| 782 | Runtime_Error(pszSrcFile, __LINE__, "DosQueryPathInfo failed for %s", fullname);
|
---|
[1611] | 783 | ulMaxFiles--; // Nothing to insert
|
---|
| 784 | checkToInsert = TRUE;
|
---|
| 785 | }
|
---|
| 786 |
|
---|
| 787 | if (checkToInsert) {
|
---|
| 788 | checkToInsert = FALSE;
|
---|
| 789 | // Remove extra records from chain
|
---|
| 790 | while (ulRecsInserted + ulRecsToInsert > ulMaxFiles) {
|
---|
| 791 | PCNRITEM pciNext = (PCNRITEM)pci->rc.preccNextRecord;
|
---|
| 792 | if (pciPrev)
|
---|
| 793 | pciPrev->rc.preccNextRecord = (PMINIRECORDCORE)pciNext;
|
---|
| 794 | else
|
---|
| 795 | pciFirst = pciNext;
|
---|
| 796 | pci->pszFileName = NullStr; // Avoid spurious complaints
|
---|
[1563] | 797 | FreeCnrItem(dcd->hwndCnr, pci);
|
---|
[1611] | 798 | pci = pciNext;
|
---|
| 799 | ulRecsToInsert--; // Remember gone
|
---|
| 800 | }
|
---|
[1563] | 801 | }
|
---|
[1611] | 802 |
|
---|
[1563] | 803 | // Check if time to insert
|
---|
| 804 | if (!pci) {
|
---|
[1611] | 805 | // All allocated CNRITEMs filled
|
---|
[1563] | 806 | if (ulRecsToInsert) {
|
---|
[1611] | 807 | // Have CNRITEMs to insert
|
---|
[1563] | 808 | memset(&ri, 0, sizeof(RECORDINSERT));
|
---|
| 809 | ri.cb = sizeof(RECORDINSERT);
|
---|
| 810 | ri.pRecordOrder = (PRECORDCORE) CMA_END;
|
---|
| 811 | ri.pRecordParent = (PRECORDCORE) 0;
|
---|
| 812 | ri.zOrder = (ULONG) CMA_TOP;
|
---|
| 813 | ri.cRecordsInsert = ulRecsToInsert;
|
---|
| 814 | ri.fInvalidateRecord = TRUE;
|
---|
| 815 | WinSendMsg(dcd->hwndCnr,
|
---|
| 816 | CM_INSERTRECORD, MPFROMP(pciFirst), MPFROMP(&ri));
|
---|
| 817 | // 2011-05-29 SHL fixme to complain on failure
|
---|
| 818 | PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
|
---|
[1702] | 819 | ulRecsInserted += ulRecsToInsert;
|
---|
| 820 | dcd->ullTotalBytes = ullTotalBytes;
|
---|
[1563] | 821 | pciFirst = NULL;
|
---|
| 822 | ulRecsToInsert = 0;
|
---|
| 823 | }
|
---|
| 824 | } // if need CM_INSERTRECORD
|
---|
| 825 | SleepIfNeeded(&itdSleep, 1); // 09 Feb 08 SHL
|
---|
| 826 | } // for
|
---|
| 827 |
|
---|
| 828 | // Clean up in case stopped early by error
|
---|
[1611] | 829 | if (pci)
|
---|
[1563] | 830 | Runtime_Error(pszSrcFile, __LINE__, "pci not NULL");
|
---|
[1611] | 831 |
|
---|
[1563] | 832 | if (pciFirst) {
|
---|
| 833 | Runtime_Error(pszSrcFile, __LINE__, "pciFirst not NULL");
|
---|
[1612] | 834 | // 2011-08-08 SHL fixme to initialze pszFileName to prevent spurious complaints
|
---|
[1563] | 835 | FreeCnrItemList(dcd->hwndCnr, pciFirst);
|
---|
| 836 | }
|
---|
| 837 |
|
---|
| 838 | } // if have files
|
---|
| 839 |
|
---|
| 840 | if (dcd->flWindowAttr & CV_DETAIL)
|
---|
| 841 | WinSendDlgItemMsg(hwnd,
|
---|
| 842 | COLLECTOR_CNR,
|
---|
| 843 | CM_INVALIDATERECORD,
|
---|
| 844 | MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
|
---|
| 845 | } // if dcd
|
---|
[194] | 846 | return 0;
|
---|
[2] | 847 |
|
---|
[194] | 848 | case UM_COLLECTFROMFILE:
|
---|
| 849 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
[1077] | 850 | # ifdef FORTIFY
|
---|
| 851 | Fortify_EnterScope();
|
---|
| 852 | # endif
|
---|
| 853 |
|
---|
[403] | 854 | if (dcd && mp1) {
|
---|
[1671] | 855 | // mp1 is pszFileName, mp2 is unused
|
---|
[841] | 856 | FILESTATUS4L fs4;
|
---|
[194] | 857 | PCNRITEM pci;
|
---|
| 858 | RECORDINSERT ri;
|
---|
| 859 | CHAR fullname[1024], *p;
|
---|
| 860 | FILE *fp;
|
---|
[750] | 861 | ULONG errs = 0;
|
---|
[1671] | 862 | BOOL first = TRUE; // 2012-09-05 SHL
|
---|
[444] | 863 | size_t c;
|
---|
[1544] | 864 | CHAR *moder = "r";
|
---|
[2] | 865 |
|
---|
[1077] | 866 | # ifdef FORTIFY
|
---|
[1078] | 867 | Fortify_BecomeOwner(mp1);
|
---|
[1077] | 868 | # endif
|
---|
| 869 |
|
---|
[1544] | 870 | fp = xfsopen((CHAR *)mp1, moder, SH_DENYNO, pszSrcFile, __LINE__, TRUE);
|
---|
[403] | 871 | if (fp) {
|
---|
| 872 | while (!feof(fp)) {
|
---|
[444] | 873 | // Avoid too much noise if collecting from binary file - oops
|
---|
| 874 | if (!fgets(fullname, sizeof(fullname), fp)) {
|
---|
| 875 | if (ferror(fp))
|
---|
| 876 | Runtime_Error(pszSrcFile, __LINE__, "fgets");
|
---|
[194] | 877 | break;
|
---|
| 878 | }
|
---|
[444] | 879 |
|
---|
| 880 | c = strlen(fullname);
|
---|
| 881 | if (c + 1 >= sizeof(fullname))
|
---|
[1671] | 882 | errs++; // Name too long
|
---|
[551] | 883 | else if (!c || (fullname[c - 1] != '\n' && fullname[c - 1] != '\r'))
|
---|
[1671] | 884 | errs++; // Probably reading a binary file
|
---|
[403] | 885 | else {
|
---|
[444] | 886 | bstripcr(fullname);
|
---|
| 887 |
|
---|
| 888 | if (*fullname == '\"') {
|
---|
[1671] | 889 | // Strip quotes
|
---|
[444] | 890 | memmove(fullname, fullname + 1, strlen(fullname) + 1);
|
---|
| 891 | lstrip(fullname);
|
---|
| 892 | p = strchr(fullname, '\"');
|
---|
| 893 | if (p)
|
---|
| 894 | *p = 0;
|
---|
| 895 | rstrip(fullname);
|
---|
| 896 | }
|
---|
| 897 | else {
|
---|
[1671] | 898 | // Strip trailing spaces
|
---|
[444] | 899 | p = strchr(fullname, ' ');
|
---|
| 900 | if (p)
|
---|
| 901 | *p = 0;
|
---|
| 902 | }
|
---|
[1615] | 903 | // fullname now contains name of file to collect
|
---|
[1077] | 904 | DosError(FERR_DISABLEHARDERR);
|
---|
| 905 | if (FindCnrRecord(dcd->hwndCnr,
|
---|
[956] | 906 | fullname,
|
---|
| 907 | NULL,
|
---|
| 908 | FALSE,
|
---|
| 909 | FALSE,
|
---|
[1077] | 910 | TRUE)) {
|
---|
[1671] | 911 | // Already in container
|
---|
[1077] | 912 | pci = UpdateCnrRecord(dcd->hwndCnr, fullname, FALSE, dcd);
|
---|
| 913 | if (Filter((PMINIRECORDCORE) pci, (PVOID) & dcd->mask)) {
|
---|
| 914 | pci->rc.flRecordAttr &= ~CRA_FILTERED;
|
---|
| 915 | WinSendMsg(dcd->hwndCnr, CM_INVALIDATERECORD, MPVOID,
|
---|
| 916 | MPFROM2SHORT(0, CMA_REPOSITION | CMA_ERASE));
|
---|
| 917 | }
|
---|
| 918 | }
|
---|
[956] | 919 | else if (IsFullName(fullname) &&
|
---|
[444] | 920 | !IsRoot(fullname) &&
|
---|
| 921 | !DosQueryPathInfo(fullname,
|
---|
[841] | 922 | FIL_QUERYEASIZEL,
|
---|
[444] | 923 | &fs4,
|
---|
[1077] | 924 | sizeof(fs4))) {
|
---|
[1671] | 925 | // Add to collector containter
|
---|
[551] | 926 | pci = WinSendMsg(dcd->hwndCnr,
|
---|
[444] | 927 | CM_ALLOCRECORD,
|
---|
| 928 | MPFROMLONG(EXTRA_RECORD_BYTES),
|
---|
[750] | 929 | MPFROMLONG(1));
|
---|
[444] | 930 | if (pci) {
|
---|
[551] | 931 | dcd->ullTotalBytes += FillInRecordFromFSA(dcd->hwndCnr, pci,
|
---|
| 932 | fullname,
|
---|
[1456] | 933 | &fs4, FALSE, NULL, dcd);
|
---|
[444] | 934 | memset(&ri, 0, sizeof(RECORDINSERT));
|
---|
| 935 | ri.cb = sizeof(RECORDINSERT);
|
---|
| 936 | ri.pRecordOrder = (PRECORDCORE) CMA_END;
|
---|
| 937 | ri.pRecordParent = (PRECORDCORE) 0;
|
---|
| 938 | ri.zOrder = (ULONG) CMA_TOP;
|
---|
[750] | 939 | ri.cRecordsInsert = 1;
|
---|
[444] | 940 | ri.fInvalidateRecord = TRUE;
|
---|
[551] | 941 | WinSendMsg(dcd->hwndCnr, CM_INSERTRECORD,
|
---|
[444] | 942 | MPFROMP(pci), MPFROMP(&ri));
|
---|
| 943 | }
|
---|
[194] | 944 | }
|
---|
[444] | 945 | else
|
---|
[1671] | 946 | errs++; // Something wrong with filename or file
|
---|
[194] | 947 | }
|
---|
[444] | 948 | if (errs > (first ? 0 : 50)) {
|
---|
[1673] | 949 | // prevent runaway on bad file
|
---|
[551] | 950 | APIRET ret = saymsg(MB_YESNO, dcd->hwndCnr,
|
---|
[444] | 951 | GetPString(IDS_COLLECTNOLISTHDRTEXT),
|
---|
| 952 | GetPString(IDS_COLLECTNOLISTTEXT),
|
---|
[1009] | 953 | (CHAR *)mp1);
|
---|
[551] | 954 |
|
---|
[444] | 955 | if (ret == MBID_NO)
|
---|
[1671] | 956 | break; // Give up
|
---|
[444] | 957 | if (!first)
|
---|
| 958 | errs = 0;
|
---|
| 959 | else
|
---|
| 960 | first = FALSE;
|
---|
[194] | 961 | }
|
---|
[1702] | 962 | } // while not eof
|
---|
[194] | 963 | fclose(fp);
|
---|
[1671] | 964 | } // if file opened
|
---|
[1442] | 965 | free(mp1);
|
---|
[194] | 966 | }
|
---|
[1063] | 967 | # ifdef FORTIFY
|
---|
| 968 | Fortify_LeaveScope();
|
---|
[1077] | 969 | # endif
|
---|
[194] | 970 | return 0;
|
---|
[2] | 971 |
|
---|
[194] | 972 | case UM_SELECT:
|
---|
| 973 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
[444] | 974 | if (dcd) {
|
---|
| 975 | switch (SHORT1FROMMP(mp1)) {
|
---|
[194] | 976 | case IDM_SELECTLIST:
|
---|
| 977 | {
|
---|
| 978 | CHAR filename[CCHMAXPATH], *p, *pp;
|
---|
[2] | 979 |
|
---|
[1395] | 980 | strcpy(filename, PCSZ_STARDOTLST);
|
---|
[194] | 981 | size = CCHMAXPATH;
|
---|
[551] | 982 | PrfQueryProfileData(fmprof, appname, "SaveToListName", filename,
|
---|
| 983 | &size);
|
---|
[194] | 984 | pp = strrchr(filename, '\\');
|
---|
| 985 | if (!pp)
|
---|
| 986 | pp = filename;
|
---|
| 987 | p = strrchr(pp, '.');
|
---|
[444] | 988 | if (p && *(p + 1) && p > pp + 1) {
|
---|
[194] | 989 | if (pp > filename)
|
---|
| 990 | pp++;
|
---|
| 991 | *pp = '*';
|
---|
| 992 | pp++;
|
---|
| 993 | if (p > pp)
|
---|
| 994 | memmove(pp, p, strlen(p) + 1);
|
---|
| 995 | }
|
---|
| 996 | if (insert_filename(hwnd, filename, FALSE, FALSE))
|
---|
[551] | 997 | SelectList(dcd->hwndCnr, TRUE, FALSE, FALSE, NULL, filename,
|
---|
| 998 | NULL);
|
---|
[194] | 999 | }
|
---|
| 1000 | break;
|
---|
| 1001 | case IDM_SELECTALL:
|
---|
[551] | 1002 | SelectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
|
---|
[194] | 1003 | break;
|
---|
| 1004 | case IDM_DESELECTALL:
|
---|
[551] | 1005 | DeselectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
|
---|
[194] | 1006 | break;
|
---|
| 1007 | case IDM_SELECTALLFILES:
|
---|
[551] | 1008 | SelectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
|
---|
[194] | 1009 | break;
|
---|
| 1010 | case IDM_DESELECTALLFILES:
|
---|
[551] | 1011 | DeselectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
|
---|
[194] | 1012 | break;
|
---|
| 1013 | case IDM_SELECTALLDIRS:
|
---|
[551] | 1014 | SelectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
|
---|
[194] | 1015 | break;
|
---|
| 1016 | case IDM_DESELECTALLDIRS:
|
---|
[551] | 1017 | DeselectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
|
---|
[194] | 1018 | break;
|
---|
| 1019 | case IDM_DESELECTMASK:
|
---|
| 1020 | case IDM_SELECTMASK:
|
---|
| 1021 | {
|
---|
| 1022 | MASK mask;
|
---|
| 1023 | PCNRITEM pci = (PCNRITEM) mp2;
|
---|
[2] | 1024 |
|
---|
[194] | 1025 | memset(&mask, 0, sizeof(MASK));
|
---|
| 1026 | mask.fNoAttribs = TRUE;
|
---|
| 1027 | mask.fNoDirs = TRUE;
|
---|
| 1028 | mask.fText = TRUE;
|
---|
| 1029 | strcpy(mask.prompt,
|
---|
| 1030 | GetPString((SHORT1FROMMP(mp1) == IDM_SELECTMASK) ?
|
---|
[551] | 1031 | IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT));
|
---|
[194] | 1032 | if (pci && (INT) pci != -1)
|
---|
[730] | 1033 | strcpy(mask.szMask, pci->pszFileName);
|
---|
[551] | 1034 | if (WinDlgBox(HWND_DESKTOP, dcd->hwndCnr, PickMaskDlgProc,
|
---|
| 1035 | FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
|
---|
[194] | 1036 | if (SHORT1FROMMP(mp1) == IDM_SELECTMASK)
|
---|
[551] | 1037 | SelectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, mask.szText,
|
---|
[194] | 1038 | FALSE);
|
---|
| 1039 | else
|
---|
[551] | 1040 | DeselectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, mask.szText,
|
---|
[194] | 1041 | FALSE);
|
---|
| 1042 | }
|
---|
| 1043 | }
|
---|
[2] | 1044 |
|
---|
[194] | 1045 | case IDM_DESELECTCLIP:
|
---|
| 1046 | case IDM_SELECTCLIP:
|
---|
| 1047 | {
|
---|
| 1048 | CHAR **list;
|
---|
[2] | 1049 |
|
---|
[194] | 1050 | list = ListFromClipboard(hwnd);
|
---|
[444] | 1051 | if (list) {
|
---|
[551] | 1052 | SelectList(dcd->hwndCnr, TRUE, FALSE,
|
---|
[194] | 1053 | (SHORT1FROMMP(mp1) == IDM_DESELECTCLIP),
|
---|
| 1054 | NULL, NULL, list);
|
---|
| 1055 | FreeList(list);
|
---|
| 1056 | }
|
---|
| 1057 | }
|
---|
| 1058 | break;
|
---|
[2] | 1059 |
|
---|
[194] | 1060 | case IDM_INVERT:
|
---|
[551] | 1061 | InvertAll(dcd->hwndCnr);
|
---|
[194] | 1062 | break;
|
---|
[2] | 1063 | }
|
---|
[194] | 1064 | }
|
---|
| 1065 | return 0;
|
---|
[2] | 1066 |
|
---|
[194] | 1067 | case UM_MASSACTION:
|
---|
[1077] | 1068 | # ifdef FORTIFY
|
---|
| 1069 | Fortify_EnterScope();
|
---|
| 1070 | # endif
|
---|
[444] | 1071 | if (mp1) {
|
---|
[1077] | 1072 | # ifdef FORTIFY
|
---|
[1078] | 1073 | Fortify_BecomeOwner(mp1);
|
---|
[1077] | 1074 | # endif
|
---|
[194] | 1075 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
[444] | 1076 | if (dcd) {
|
---|
[194] | 1077 | WORKER *wk;
|
---|
[551] | 1078 | wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
|
---|
[444] | 1079 | if (!wk)
|
---|
[352] | 1080 | FreeListInfo((LISTINFO *) mp1);
|
---|
| 1081 | else {
|
---|
[551] | 1082 | wk->size = sizeof(WORKER);
|
---|
| 1083 | wk->hwndCnr = dcd->hwndCnr;
|
---|
| 1084 | wk->hwndParent = dcd->hwndParent;
|
---|
| 1085 | wk->hwndFrame = dcd->hwndFrame;
|
---|
| 1086 | wk->hwndClient = dcd->hwndClient;
|
---|
| 1087 | wk->li = (LISTINFO *) mp1;
|
---|
| 1088 | strcpy(wk->directory, dcd->directory);
|
---|
[1335] | 1089 | if (xbeginthread(MassAction,
|
---|
| 1090 | 122880,
|
---|
| 1091 | wk,
|
---|
| 1092 | pszSrcFile,
|
---|
| 1093 | __LINE__) == -1)
|
---|
| 1094 | {
|
---|
[1077] | 1095 | free(wk);
|
---|
[194] | 1096 | FreeListInfo((LISTINFO *) mp1);
|
---|
| 1097 | }
|
---|
| 1098 | }
|
---|
[2] | 1099 | }
|
---|
[194] | 1100 | }
|
---|
[1077] | 1101 | # ifdef FORTIFY
|
---|
| 1102 | DosSleep(1); // Let receiver take ownership
|
---|
| 1103 | Fortify_LeaveScope();
|
---|
| 1104 | # endif
|
---|
[194] | 1105 | return 0;
|
---|
[2] | 1106 |
|
---|
[194] | 1107 | case UM_ACTION:
|
---|
[1077] | 1108 | # ifdef FORTIFY
|
---|
| 1109 | Fortify_EnterScope();
|
---|
| 1110 | # endif
|
---|
[444] | 1111 | if (mp1) {
|
---|
[1077] | 1112 | # ifdef FORTIFY
|
---|
[1078] | 1113 | Fortify_BecomeOwner(mp1);
|
---|
[1077] | 1114 | # endif
|
---|
[194] | 1115 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
[444] | 1116 | if (dcd) {
|
---|
[194] | 1117 | WORKER *wk;
|
---|
[551] | 1118 | wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
|
---|
[352] | 1119 | if (!wk)
|
---|
| 1120 | FreeListInfo((LISTINFO *) mp1);
|
---|
| 1121 | else {
|
---|
[551] | 1122 | wk->size = sizeof(WORKER);
|
---|
| 1123 | wk->hwndCnr = dcd->hwndCnr;
|
---|
| 1124 | wk->hwndParent = dcd->hwndParent;
|
---|
| 1125 | wk->hwndFrame = dcd->hwndFrame;
|
---|
| 1126 | wk->hwndClient = dcd->hwndClient;
|
---|
| 1127 | wk->li = (LISTINFO *) mp1;
|
---|
| 1128 | strcpy(wk->directory, dcd->directory);
|
---|
[1335] | 1129 | if (xbeginthread(Action,
|
---|
| 1130 | 122880,
|
---|
| 1131 | wk,
|
---|
| 1132 | pszSrcFile,
|
---|
| 1133 | __LINE__) == -1)
|
---|
| 1134 | {
|
---|
[1077] | 1135 | free(wk);
|
---|
[194] | 1136 | FreeListInfo((LISTINFO *) mp1);
|
---|
| 1137 | }
|
---|
| 1138 | }
|
---|
[2] | 1139 | }
|
---|
[194] | 1140 | }
|
---|
[1077] | 1141 | # ifdef FORTIFY
|
---|
| 1142 | DosSleep(1); // Let receiver take ownership
|
---|
| 1143 | Fortify_LeaveScope();
|
---|
| 1144 | # endif
|
---|
[194] | 1145 | return 0;
|
---|
[2] | 1146 |
|
---|
[194] | 1147 | case WM_CLOSE:
|
---|
| 1148 | WinDestroyWindow(hwnd);
|
---|
| 1149 | break;
|
---|
[2] | 1150 |
|
---|
[194] | 1151 | case WM_DESTROY:
|
---|
| 1152 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
[444] | 1153 | if (dcd) {
|
---|
| 1154 | INT x;
|
---|
[551] | 1155 |
|
---|
| 1156 | dcd->stopflag = 1;
|
---|
[942] | 1157 | // Allow other threads to honor stop request
|
---|
| 1158 | for (x = 0; x < 100 && dcd->amextracted; x++)
|
---|
| 1159 | DosSleep(10);
|
---|
| 1160 | if (dcd->amextracted)
|
---|
| 1161 | Runtime_Error(pszSrcFile, __LINE__, "still busy");
|
---|
[551] | 1162 | WinSendMsg(dcd->hwndCnr, UM_CLOSE, MPVOID, MPVOID);
|
---|
| 1163 | FreeList(dcd->lastselection);
|
---|
[1513] | 1164 | WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL); // 13 Apr 10 SHL Set NULL before freeing dcd
|
---|
[1799] | 1165 | DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
|
---|
[1039] | 1166 | free(dcd);
|
---|
[1799] | 1167 | DosReleaseMutexSem(hmtxFiltering);
|
---|
[1063] | 1168 | # ifdef FORTIFY
|
---|
| 1169 | Fortify_LeaveScope();
|
---|
[1077] | 1170 | # endif
|
---|
[194] | 1171 | }
|
---|
| 1172 | DosPostEventSem(CompactSem);
|
---|
[551] | 1173 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
| 1174 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
---|
[194] | 1175 | break;
|
---|
[2] | 1176 | }
|
---|
[194] | 1177 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 1178 | }
|
---|
| 1179 |
|
---|
[551] | 1180 | MRESULT EXPENTRY CollectorCnrWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
| 1181 | MPARAM mp2)
|
---|
[155] | 1182 | {
|
---|
[672] | 1183 | DIRCNRDATA *dcd = INSTDATA(hwnd);
|
---|
[197] | 1184 | ULONG size;
|
---|
[2] | 1185 |
|
---|
[197] | 1186 | static INT savedSortFlags;
|
---|
| 1187 |
|
---|
[444] | 1188 | switch (msg) {
|
---|
[194] | 1189 | case DM_PRINTOBJECT:
|
---|
| 1190 | return MRFROMLONG(DRR_TARGET);
|
---|
| 1191 |
|
---|
| 1192 | case DM_DISCARDOBJECT:
|
---|
| 1193 | if (dcd)
|
---|
[551] | 1194 | return WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
|
---|
[194] | 1195 | else
|
---|
[2] | 1196 | return MRFROMLONG(DRR_TARGET);
|
---|
| 1197 |
|
---|
[194] | 1198 | case WM_CHAR:
|
---|
| 1199 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 1200 | if (SHORT1FROMMP(mp1) & KC_KEYUP)
|
---|
| 1201 | return (MRESULT) TRUE;
|
---|
[444] | 1202 | if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
|
---|
| 1203 | switch (SHORT2FROMMP(mp2)) {
|
---|
[194] | 1204 | case VK_DELETE:
|
---|
| 1205 | if ((shiftstate & KC_CTRL) == KC_CTRL)
|
---|
| 1206 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PERMDELETE, 0), MPVOID);
|
---|
| 1207 | else if ((shiftstate & KC_SHIFT) == KC_SHIFT)
|
---|
| 1208 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SAVETOCLIP, 0), MPVOID);
|
---|
| 1209 | else
|
---|
| 1210 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID);
|
---|
| 1211 | break;
|
---|
[2] | 1212 | }
|
---|
[194] | 1213 | }
|
---|
| 1214 | if (shiftstate || fNoSearch)
|
---|
| 1215 | break;
|
---|
[444] | 1216 | if (SHORT1FROMMP(mp1) & KC_CHAR) {
|
---|
[194] | 1217 | ULONG thistime, len;
|
---|
| 1218 | SEARCHSTRING srch;
|
---|
| 1219 | PCNRITEM pci;
|
---|
[2] | 1220 |
|
---|
[194] | 1221 | if (!dcd)
|
---|
| 1222 | break;
|
---|
[444] | 1223 | switch (SHORT1FROMMP(mp2)) {
|
---|
[194] | 1224 | case '\x1b':
|
---|
| 1225 | case '\r':
|
---|
| 1226 | case '\n':
|
---|
[551] | 1227 | dcd->lasttime = 0;
|
---|
| 1228 | *dcd->szCommonName = 0;
|
---|
[194] | 1229 | break;
|
---|
| 1230 | default:
|
---|
| 1231 | thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd));
|
---|
[551] | 1232 | if (thistime > dcd->lasttime + 1250)
|
---|
| 1233 | *dcd->szCommonName = 0;
|
---|
| 1234 | dcd->lasttime = thistime;
|
---|
| 1235 | if (SHORT1FROMMP(mp2) == ' ' && !dcd->szCommonName)
|
---|
[194] | 1236 | break;
|
---|
| 1237 | KbdRetry:
|
---|
[551] | 1238 | len = strlen(dcd->szCommonName);
|
---|
[444] | 1239 | if (len >= CCHMAXPATH - 1) {
|
---|
[551] | 1240 | *dcd->szCommonName = 0;
|
---|
[194] | 1241 | len = 0;
|
---|
| 1242 | }
|
---|
[551] | 1243 | dcd->szCommonName[len] = toupper(SHORT1FROMMP(mp2));
|
---|
| 1244 | dcd->szCommonName[len + 1] = 0;
|
---|
[194] | 1245 | memset(&srch, 0, sizeof(SEARCHSTRING));
|
---|
[197] | 1246 | srch.cb = sizeof(SEARCHSTRING);
|
---|
[551] | 1247 | srch.pszSearch = dcd->szCommonName;
|
---|
[194] | 1248 | srch.fsPrefix = TRUE;
|
---|
| 1249 | srch.fsCaseSensitive = FALSE;
|
---|
| 1250 | srch.usView = CV_ICON;
|
---|
| 1251 | pci = WinSendMsg(hwnd, CM_SEARCHSTRING, MPFROMP(&srch),
|
---|
| 1252 | MPFROMLONG(CMA_FIRST));
|
---|
[444] | 1253 | if (pci && (INT) pci != -1) {
|
---|
[194] | 1254 | USHORT attrib = CRA_CURSORED;
|
---|
[2] | 1255 |
|
---|
[1673] | 1256 | // make found item current item
|
---|
[551] | 1257 | if (!stricmp(pci->pszFileName, dcd->szCommonName))
|
---|
[194] | 1258 | attrib |= CRA_SELECTED;
|
---|
| 1259 | WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
| 1260 | MPFROM2SHORT(TRUE, attrib));
|
---|
[1673] | 1261 | // make sure that record shows in viewport
|
---|
[194] | 1262 | ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
|
---|
| 1263 | return (MRESULT) TRUE;
|
---|
| 1264 | }
|
---|
[444] | 1265 | else {
|
---|
| 1266 | if (SHORT1FROMMP(mp2) == ' ') {
|
---|
[551] | 1267 | dcd->szCommonName[len] = 0;
|
---|
[194] | 1268 | break;
|
---|
| 1269 | }
|
---|
[551] | 1270 | *dcd->szCommonName = 0;
|
---|
| 1271 | dcd->lasttime = 0;
|
---|
[194] | 1272 | if (len) // retry as first letter if no match
|
---|
[2] | 1273 |
|
---|
[194] | 1274 | goto KbdRetry;
|
---|
| 1275 | }
|
---|
| 1276 | break;
|
---|
[2] | 1277 | }
|
---|
[194] | 1278 | }
|
---|
| 1279 | break;
|
---|
[2] | 1280 |
|
---|
[194] | 1281 | case WM_MOUSEMOVE:
|
---|
| 1282 | case WM_BUTTON1UP:
|
---|
| 1283 | case WM_BUTTON2UP:
|
---|
| 1284 | case WM_BUTTON3UP:
|
---|
| 1285 | case WM_CHORD:
|
---|
| 1286 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 1287 | break;
|
---|
[2] | 1288 |
|
---|
[194] | 1289 | case WM_BUTTON1MOTIONEND:
|
---|
| 1290 | {
|
---|
| 1291 | CNRINFO cnri;
|
---|
| 1292 |
|
---|
| 1293 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 1294 | cnri.cb = sizeof(CNRINFO);
|
---|
| 1295 | if (WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
|
---|
[551] | 1296 | MPFROMLONG(sizeof(CNRINFO)))) {
|
---|
[194] | 1297 | if (cnri.flWindowAttr & CV_DETAIL)
|
---|
| 1298 | PrfWriteProfileData(fmprof, appname, "CollectorCnrSplitBar",
|
---|
| 1299 | (PVOID) & cnri.xVertSplitbar, sizeof(LONG));
|
---|
[2] | 1300 | }
|
---|
[194] | 1301 | }
|
---|
| 1302 | break;
|
---|
[2] | 1303 |
|
---|
[194] | 1304 | case WM_PRESPARAMCHANGED:
|
---|
[1400] | 1305 | PresParamChanged(hwnd, PCSZ_COLLECTOR, mp1, mp2);
|
---|
[194] | 1306 | break;
|
---|
[2] | 1307 |
|
---|
[194] | 1308 | case UM_COMPARE:
|
---|
[444] | 1309 | if (dcd && mp1 && mp2) {
|
---|
[194] | 1310 | COMPARE *cmp;
|
---|
[1009] | 1311 | CHAR *leftdir = (CHAR *)mp1, *rightdir = (CHAR *)mp2;
|
---|
[2] | 1312 |
|
---|
[444] | 1313 | if (!IsFile(leftdir) && !IsFile(rightdir)) {
|
---|
[551] | 1314 | cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
|
---|
[444] | 1315 | if (cmp) {
|
---|
[551] | 1316 | cmp->size = sizeof(COMPARE);
|
---|
| 1317 | strcpy(cmp->leftdir, leftdir);
|
---|
| 1318 | strcpy(cmp->rightdir, rightdir);
|
---|
| 1319 | cmp->hwndParent = dcd->hwndParent;
|
---|
| 1320 | cmp->dcd.hwndParent = dcd->hwndParent;
|
---|
[194] | 1321 | WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, CompareDlgProc,
|
---|
| 1322 | FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
|
---|
| 1323 | }
|
---|
[2] | 1324 | }
|
---|
[194] | 1325 | }
|
---|
| 1326 | return 0;
|
---|
[2] | 1327 |
|
---|
[194] | 1328 | case UM_UPDATERECORDLIST:
|
---|
| 1329 | if (dcd && mp1)
|
---|
[551] | 1330 | WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
|
---|
[194] | 1331 | return 0;
|
---|
[2] | 1332 |
|
---|
[194] | 1333 | case UM_UPDATERECORD:
|
---|
[444] | 1334 | if (dcd && mp1) {
|
---|
[194] | 1335 | CHAR *filename;
|
---|
[2] | 1336 |
|
---|
[194] | 1337 | filename = mp1;
|
---|
| 1338 | if (filename)
|
---|
| 1339 | UpdateCnrRecord(hwnd, filename, TRUE, dcd);
|
---|
| 1340 | }
|
---|
| 1341 | return 0;
|
---|
[2] | 1342 |
|
---|
[194] | 1343 | case WM_SETFOCUS:
|
---|
[1673] | 1344 | // put name of our window on status line
|
---|
[444] | 1345 | if (dcd && hwndStatus && mp2) {
|
---|
[194] | 1346 | PCNRITEM pci = NULL;
|
---|
[2] | 1347 |
|
---|
[444] | 1348 | if (fAutoView && hwndMain) {
|
---|
[194] | 1349 | pci = WinSendMsg(hwnd,
|
---|
| 1350 | CM_QUERYRECORDEMPHASIS,
|
---|
[551] | 1351 | MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
|
---|
[194] | 1352 | if (pci && (INT) pci != -1 &&
|
---|
[730] | 1353 | (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
|
---|
| 1354 | WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
|
---|
[194] | 1355 | else
|
---|
[551] | 1356 | WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
|
---|
[2] | 1357 | }
|
---|
[551] | 1358 | if (dcd->amextracted)
|
---|
[1498] | 1359 | WinSetWindowText(hwndStatus2, (CHAR *) GetPString(IDS_INSEEKSCANTEXT)); // Say working
|
---|
[551] | 1360 | WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
[194] | 1361 | }
|
---|
| 1362 | break;
|
---|
[2] | 1363 |
|
---|
[194] | 1364 | case UM_RESCAN:
|
---|
[444] | 1365 | if (dcd) {
|
---|
[194] | 1366 | CNRINFO cnri;
|
---|
[1397] | 1367 | CHAR s[CCHMAXPATH + 69], tb[81], tf[81], szDate[DATE_BUF_BYTES] *p;
|
---|
[194] | 1368 | PCNRITEM pci = NULL;
|
---|
[2] | 1369 |
|
---|
[194] | 1370 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 1371 | cnri.cb = sizeof(CNRINFO);
|
---|
| 1372 | WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
|
---|
| 1373 | MPFROMLONG(sizeof(CNRINFO)));
|
---|
[551] | 1374 | dcd->totalfiles = cnri.cRecords;
|
---|
| 1375 | commafmt(tf, sizeof(tf), dcd->totalfiles);
|
---|
| 1376 | CommaFmtULL(tb, sizeof(tb), dcd->ullTotalBytes, ' ');
|
---|
[194] | 1377 | sprintf(s, "%s / %s", tf, tb);
|
---|
[551] | 1378 | WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, s);
|
---|
[2] | 1379 |
|
---|
[551] | 1380 | commafmt(tf, sizeof(tf), dcd->selectedfiles);
|
---|
| 1381 | CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, ' ');
|
---|
[194] | 1382 | sprintf(s, "%s / %s", tf, tb);
|
---|
[551] | 1383 | WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
|
---|
[155] | 1384 |
|
---|
[194] | 1385 | if (hwndStatus &&
|
---|
[551] | 1386 | dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
|
---|
[444] | 1387 | if (hwndMain) {
|
---|
[194] | 1388 | pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
|
---|
[551] | 1389 | MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
|
---|
[194] | 1390 | if (pci && (INT) pci != -1)
|
---|
[730] | 1391 | PostMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
|
---|
[194] | 1392 | else
|
---|
| 1393 | PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
|
---|
| 1394 | }
|
---|
[948] | 1395 | if (!dcd->amextracted) {
|
---|
| 1396 | if (!fMoreButtons) {
|
---|
| 1397 | sprintf(s, " %s%s%s%s",
|
---|
[942] | 1398 | GetPString(IDS_COLLECTORTEXT),
|
---|
[948] | 1399 | *dcd->mask.szMask || dcd->mask.antiattr ||
|
---|
| 1400 | dcd->mask.attrFile != ALLATTRS ? " (" : NullStr,
|
---|
| 1401 | *dcd->mask.szMask ?
|
---|
| 1402 | dcd->mask.szMask :
|
---|
| 1403 | dcd->mask.antiattr ||
|
---|
| 1404 | dcd->mask.attrFile != ALLATTRS ?
|
---|
| 1405 | GetPString(IDS_ATTRTEXT) : NullStr,
|
---|
| 1406 | *dcd->mask.szMask || dcd->mask.antiattr ||
|
---|
| 1407 | dcd->mask.attrFile != ALLATTRS ?
|
---|
| 1408 | ")" : NullStr);
|
---|
| 1409 | }
|
---|
| 1410 | else
|
---|
| 1411 | strcpy(s, GetPString(IDS_COLLECTORTEXT));
|
---|
| 1412 | WinSetWindowText(hwndStatus, s);
|
---|
[942] | 1413 | }
|
---|
[194] | 1414 | if (!pci)
|
---|
| 1415 | pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
|
---|
[551] | 1416 | MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
|
---|
[444] | 1417 | if (pci && (INT) pci != -1) {
|
---|
[280] | 1418 | BOOL fStatus2Used = FALSE;
|
---|
[551] | 1419 |
|
---|
[444] | 1420 | if (fSplitStatus && hwndStatus2) {
|
---|
[551] | 1421 | if (pci->attrFile & FILE_DIRECTORY)
|
---|
| 1422 | p = pci->pszFileName;
|
---|
[444] | 1423 | else {
|
---|
[1611] | 1424 | if (!pci->pszFileName)
|
---|
| 1425 | Runtime_Error(pszSrcFile, __LINE__, "pci->pszFileName NULL for %p", pci);
|
---|
[730] | 1426 | p = strrchr(pci->pszFileName, '\\');
|
---|
[444] | 1427 | if (p) {
|
---|
[194] | 1428 | if (*(p + 1))
|
---|
| 1429 | p++;
|
---|
| 1430 | else
|
---|
[551] | 1431 | p = pci->pszFileName;
|
---|
[155] | 1432 | }
|
---|
[194] | 1433 | else
|
---|
[551] | 1434 | p = pci->pszFileName;
|
---|
[194] | 1435 | }
|
---|
[551] | 1436 | CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
|
---|
[1456] | 1437 | if (!fMoreButtons) {
|
---|
| 1438 | DateFormat(szDate, pci->date);
|
---|
[1395] | 1439 | sprintf(s, " %s %s %02u%s%02u%s%02u [%s] %s",
|
---|
| 1440 | tb, szDate, pci->time.hours, TimeSeparator, pci->time.minutes,
|
---|
| 1441 | TimeSeparator, pci->time.seconds, pci->pszDispAttr, p);
|
---|
[194] | 1442 | }
|
---|
[444] | 1443 | else {
|
---|
[551] | 1444 | if (pci->cbFile + pci->easize > 1024)
|
---|
| 1445 | CommaFmtULL(tf, sizeof(tf), pci->cbFile + pci->easize, 'K');
|
---|
[194] | 1446 | else
|
---|
| 1447 | *tf = 0;
|
---|
| 1448 | sprintf(s, GetPString(IDS_STATUSSIZETEXT),
|
---|
[551] | 1449 | tb, *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
|
---|
[194] | 1450 | }
|
---|
| 1451 | WinSetWindowText(hwndStatus2, s);
|
---|
[280] | 1452 | fStatus2Used = TRUE;
|
---|
[194] | 1453 | }
|
---|
[444] | 1454 | if (fMoreButtons) {
|
---|
[1456] | 1455 | WinSetWindowText(hwndName, pci->pszFileName);
|
---|
| 1456 | DateFormat(szDate, pci->date);
|
---|
[1395] | 1457 | sprintf(s, "%s %02u%s%02u%s%02u",
|
---|
| 1458 | szDate, pci->time.hours, TimeSeparator, pci->time.minutes,
|
---|
| 1459 | TimeSeparator, pci->time.seconds);
|
---|
[194] | 1460 | WinSetWindowText(hwndDate, s);
|
---|
[551] | 1461 | WinSetWindowText(hwndAttr, pci->pszDispAttr);
|
---|
[194] | 1462 | }
|
---|
[551] | 1463 | if (dcd->amextracted && hwndStatus2 && !fStatus2Used)
|
---|
[1498] | 1464 | WinSetWindowText(hwndStatus2, (CHAR *) GetPString(IDS_INSEEKSCANTEXT)); // Say working
|
---|
[194] | 1465 | }
|
---|
[444] | 1466 | else {
|
---|
[948] | 1467 | if (hwndStatus2) {
|
---|
| 1468 | if (dcd->amextracted)
|
---|
[1498] | 1469 | WinSetWindowText(hwndStatus2, (CHAR *) GetPString(IDS_INSEEKSCANTEXT)); // Say working
|
---|
[948] | 1470 | else
|
---|
| 1471 | WinSetWindowText(hwndStatus2, NullStr);
|
---|
| 1472 | }
|
---|
[444] | 1473 | if (fMoreButtons) {
|
---|
[194] | 1474 | WinSetWindowText(hwndName, NullStr);
|
---|
| 1475 | WinSetWindowText(hwndDate, NullStr);
|
---|
| 1476 | WinSetWindowText(hwndAttr, NullStr);
|
---|
| 1477 | }
|
---|
| 1478 | }
|
---|
[2] | 1479 | }
|
---|
[194] | 1480 | }
|
---|
| 1481 | return 0;
|
---|
[2] | 1482 |
|
---|
[194] | 1483 | case UM_CONTAINER_FILLED:
|
---|
[1395] | 1484 | if (!fAlertBeepOff)
|
---|
[1563] | 1485 | DosBeep(1000, 50); // Wake up user?
|
---|
[194] | 1486 | WinSendMsg(hwnd,
|
---|
| 1487 | CM_INVALIDATERECORD,
|
---|
[551] | 1488 | MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
|
---|
[471] | 1489 | disable_menuitem(WinWindowFromID(WinQueryWindow(hwndMain, QW_PARENT),
|
---|
[1394] | 1490 | FID_MENU), IDM_GREP, FALSE);
|
---|
[1366] | 1491 | disable_menuitem(TreeMenu, IDM_GREP, FALSE);
|
---|
| 1492 | disable_menuitem(DirMenu, IDM_GREP, FALSE);
|
---|
[551] | 1493 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
[444] | 1494 | if (dcd) {
|
---|
[551] | 1495 | dcd->stopflag = 0;
|
---|
| 1496 | dcd->amextracted = FALSE; // Say not busy
|
---|
| 1497 | if (dcd->namecanchange) {
|
---|
| 1498 | if (!PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID))
|
---|
| 1499 | WinSendMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
[2] | 1500 | }
|
---|
[194] | 1501 | else
|
---|
| 1502 | WinSetWindowPos(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 1503 | QW_PARENT),
|
---|
| 1504 | HWND_TOP,
|
---|
[551] | 1505 | 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | SWP_ZORDER);
|
---|
[194] | 1506 | }
|
---|
| 1507 | return 0;
|
---|
[2] | 1508 |
|
---|
[194] | 1509 | case UM_SETUP:
|
---|
[444] | 1510 | if (dcd) {
|
---|
[551] | 1511 | if (!dcd->hwndObject) {
|
---|
[1673] | 1512 | // first time through -- set things up
|
---|
[2] | 1513 |
|
---|
[194] | 1514 | CNRINFO cnri;
|
---|
[2] | 1515 |
|
---|
[1400] | 1516 | RestorePresParams(hwnd, PCSZ_COLLECTOR);
|
---|
[1409] | 1517 | LoadDetailsSwitches(PCSZ_COLLECTOR, &dcd->ds, FALSE);
|
---|
[471] | 1518 |
|
---|
[551] | 1519 | dcd->amextracted = FALSE; // Say not busy
|
---|
| 1520 | dcd->stopflag = 0;
|
---|
[194] | 1521 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 1522 | cnri.cb = sizeof(CNRINFO);
|
---|
| 1523 | WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
|
---|
| 1524 | MPFROMLONG(sizeof(CNRINFO)));
|
---|
| 1525 | cnri.cyLineSpacing = 0;
|
---|
[750] | 1526 | cnri.cxTreeIndent = 12;
|
---|
[2] | 1527 |
|
---|
[551] | 1528 | cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT | CV_DETAIL));
|
---|
[194] | 1529 | cnri.flWindowAttr |= (CV_NAME | CA_DETAILSVIEWTITLES |
|
---|
| 1530 | CV_MINI | CV_FLOW);
|
---|
| 1531 | cnri.pSortRecord = (PVOID) SortCollectorCnr;
|
---|
[2] | 1532 |
|
---|
[444] | 1533 | size = sizeof(ULONG);
|
---|
| 1534 | PrfQueryProfileData(fmprof, appname, "CollectorflWindowAttr",
|
---|
| 1535 | (PVOID) & cnri.flWindowAttr, &size);
|
---|
| 1536 | size = sizeof(MASK);
|
---|
| 1537 | if (PrfQueryProfileSize(fmprof, appname, "CollectorFilter", &size) &&
|
---|
[551] | 1538 | size) {
|
---|
| 1539 | PrfQueryProfileData(fmprof, appname, "CollectorFilter", &dcd->mask,
|
---|
[444] | 1540 | &size);
|
---|
[551] | 1541 | SetMask(NULL, &dcd->mask);
|
---|
[194] | 1542 | }
|
---|
[444] | 1543 | else {
|
---|
[551] | 1544 | dcd->mask.attrFile = (FILE_NORMAL | FILE_READONLY |
|
---|
| 1545 | FILE_DIRECTORY | FILE_HIDDEN |
|
---|
| 1546 | FILE_SYSTEM | FILE_ARCHIVED);
|
---|
| 1547 | dcd->mask.antiattr = 0;
|
---|
[444] | 1548 | }
|
---|
| 1549 |
|
---|
[551] | 1550 | *(dcd->mask.prompt) = 0;
|
---|
[444] | 1551 |
|
---|
[194] | 1552 | cnri.flWindowAttr |= CV_FLOW;
|
---|
| 1553 | cnri.flWindowAttr &= (~(CA_MIXEDTARGETEMPH | CA_ORDEREDTARGETEMPH));
|
---|
[551] | 1554 | dcd->flWindowAttr = cnri.flWindowAttr;
|
---|
[194] | 1555 | WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
|
---|
| 1556 | MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING |
|
---|
| 1557 | CMA_CXTREEINDENT | CMA_PSORTRECORD));
|
---|
| 1558 | SetCnrCols(hwnd, FALSE);
|
---|
[1065] | 1559 | AdjustCnrColsForPref(hwnd, NULL, &dcd->ds, FALSE);
|
---|
[2] | 1560 |
|
---|
[1673] | 1561 | // fix splitbar for collector container
|
---|
[197] | 1562 | cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
|
---|
| 1563 | size = sizeof(LONG);
|
---|
| 1564 | PrfQueryProfileData(fmprof, appname, "CollectorCnrSplitBar",
|
---|
| 1565 | &cnri.xVertSplitbar, &size);
|
---|
| 1566 | if (cnri.xVertSplitbar <= 0)
|
---|
[194] | 1567 | cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
|
---|
[197] | 1568 | WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
|
---|
| 1569 | MPFROMLONG(CMA_XVERTSPLITBAR));
|
---|
| 1570 |
|
---|
[1335] | 1571 | if (xbeginthread(MakeObjWin,
|
---|
| 1572 | 245760,
|
---|
| 1573 | dcd,
|
---|
| 1574 | pszSrcFile,
|
---|
| 1575 | __LINE__) == -1)
|
---|
| 1576 | {
|
---|
[551] | 1577 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 1578 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
[194] | 1579 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 1580 | return 0;
|
---|
| 1581 | }
|
---|
| 1582 | else
|
---|
[1563] | 1583 | DosSleep(32); // Let object window get started
|
---|
[2] | 1584 | }
|
---|
[194] | 1585 | SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[551] | 1586 | DIR_FILTER), &dcd->mask, FALSE);
|
---|
[194] | 1587 | SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 1588 | DIR_SORT), CollectorsortFlags, FALSE);
|
---|
| 1589 | SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[551] | 1590 | DIR_VIEW), dcd->flWindowAttr);
|
---|
[194] | 1591 | }
|
---|
[444] | 1592 | else {
|
---|
[194] | 1593 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
[2] | 1594 | return 0;
|
---|
[194] | 1595 | }
|
---|
| 1596 | return 0;
|
---|
[2] | 1597 |
|
---|
[194] | 1598 | case WM_MENUEND:
|
---|
[444] | 1599 | if (dcd) {
|
---|
[551] | 1600 | HWND hwndMenu = (HWND) mp2;
|
---|
[2] | 1601 |
|
---|
[194] | 1602 | if (hwndMenu == CollectorCnrMenu || hwndMenu == CollectorFileMenu ||
|
---|
[551] | 1603 | hwndMenu == CollectorDirMenu) {
|
---|
[194] | 1604 | MarkAll(hwnd, TRUE, FALSE, TRUE);
|
---|
[551] | 1605 | if (dcd->cnremphasized) {
|
---|
[194] | 1606 | WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
|
---|
| 1607 | MPFROM2SHORT(FALSE, CRA_SOURCE));
|
---|
[551] | 1608 | dcd->cnremphasized = FALSE;
|
---|
[194] | 1609 | }
|
---|
[2] | 1610 | }
|
---|
[194] | 1611 | }
|
---|
| 1612 | break;
|
---|
[2] | 1613 |
|
---|
[194] | 1614 | case UM_OPENWINDOWFORME:
|
---|
[444] | 1615 | if (dcd) {
|
---|
[1009] | 1616 | if (mp1 && !IsFile((CHAR *)mp1))
|
---|
[551] | 1617 | OpenDirCnr(HWND_DESKTOP, hwndMain, dcd->hwndFrame, FALSE, (PSZ) mp1);
|
---|
[1120] | 1618 | else if (mp1 && IsFile(mp1) == 1 &&
|
---|
[1335] | 1619 | CheckDriveSpaceAvail(ArcTempRoot, ullDATFileSpaceNeeded, ullTmpSpaceNeeded) != 2)
|
---|
[194] | 1620 | StartArcCnr(HWND_DESKTOP,
|
---|
[1009] | 1621 | dcd->hwndFrame, (CHAR *)mp1, 4, (ARC_TYPE *) mp2);
|
---|
[194] | 1622 | }
|
---|
| 1623 | return 0;
|
---|
[2] | 1624 |
|
---|
[194] | 1625 | case MM_PORTHOLEINIT:
|
---|
[444] | 1626 | if (dcd) {
|
---|
| 1627 | switch (SHORT1FROMMP(mp1)) {
|
---|
[194] | 1628 | case 0:
|
---|
| 1629 | case 1:
|
---|
| 1630 | {
|
---|
| 1631 | ULONG wmsg;
|
---|
[2] | 1632 |
|
---|
[194] | 1633 | wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
|
---|
[551] | 1634 | PortholeInit((HWND) WinSendMsg(dcd->hwndClient, wmsg, MPVOID,
|
---|
[194] | 1635 | MPVOID), mp1, mp2);
|
---|
| 1636 | }
|
---|
| 1637 | break;
|
---|
[2] | 1638 | }
|
---|
[194] | 1639 | }
|
---|
| 1640 | break;
|
---|
[2] | 1641 |
|
---|
[194] | 1642 | case UM_INITMENU:
|
---|
| 1643 | case WM_INITMENU:
|
---|
[444] | 1644 | if (dcd) {
|
---|
| 1645 | switch (SHORT1FROMMP(mp1)) {
|
---|
[194] | 1646 | case IDM_VIEWSMENU:
|
---|
[551] | 1647 | SetViewMenu((HWND) mp2, dcd->flWindowAttr);
|
---|
| 1648 | WinEnableMenuItem((HWND) mp2, IDM_RESELECT,
|
---|
[907] | 1649 | (dcd->lastselection != NULL));
|
---|
| 1650 | CopyPresParams((HWND) mp2, hwnd);
|
---|
[194] | 1651 | break;
|
---|
[2] | 1652 |
|
---|
[194] | 1653 | case IDM_DETAILSSETUP:
|
---|
[1065] | 1654 | SetDetailsSwitches((HWND) mp2, &dcd->ds);
|
---|
[194] | 1655 | break;
|
---|
[2] | 1656 |
|
---|
[194] | 1657 | case IDM_COMMANDSMENU:
|
---|
[551] | 1658 | SetupCommandMenu((HWND) mp2, hwnd);
|
---|
[194] | 1659 | break;
|
---|
[2] | 1660 |
|
---|
[194] | 1661 | case IDM_SORTSUBMENU:
|
---|
[551] | 1662 | SetSortChecks((HWND) mp2, CollectorsortFlags);
|
---|
[194] | 1663 | break;
|
---|
[2] | 1664 | }
|
---|
[551] | 1665 | dcd->hwndLastMenu = (HWND) mp2;
|
---|
[194] | 1666 | }
|
---|
| 1667 | if (msg == WM_INITMENU)
|
---|
| 1668 | break;
|
---|
| 1669 | return 0;
|
---|
[2] | 1670 |
|
---|
[194] | 1671 | case UM_COLLECTFROMFILE:
|
---|
[444] | 1672 | if (mp1) {
|
---|
[1077] | 1673 | # ifdef FORTIFY
|
---|
| 1674 | Fortify_EnterScope();
|
---|
[1078] | 1675 | Fortify_BecomeOwner(mp1);
|
---|
[1077] | 1676 | # endif
|
---|
[1442] | 1677 | if (!dcd) {
|
---|
[1563] | 1678 | Runtime_Error(pszSrcFile, __LINE__, NULL);
|
---|
| 1679 | free(mp1);
|
---|
[1442] | 1680 | }
|
---|
[444] | 1681 | else {
|
---|
[551] | 1682 | if (!PostMsg(dcd->hwndObject, UM_COLLECTFROMFILE, mp1, mp2)) {
|
---|
[1563] | 1683 | Runtime_Error(pszSrcFile, __LINE__, PCSZ_POSTMSG);
|
---|
| 1684 | free(mp1);
|
---|
[194] | 1685 | }
|
---|
[2] | 1686 | }
|
---|
[1077] | 1687 | # ifdef FORTIFY
|
---|
| 1688 | DosSleep(1); // Let receiver take ownership
|
---|
| 1689 | Fortify_LeaveScope();
|
---|
| 1690 | # endif
|
---|
[194] | 1691 | }
|
---|
| 1692 | return 0;
|
---|
[2] | 1693 |
|
---|
[194] | 1694 | case UM_COMMAND:
|
---|
[444] | 1695 | if (mp1) {
|
---|
| 1696 | if (dcd) {
|
---|
[551] | 1697 | if (!PostMsg(dcd->hwndObject, UM_COMMAND, mp1, mp2)) {
|
---|
[1400] | 1698 | Runtime_Error(pszSrcFile, __LINE__, PCSZ_POSTMSG);
|
---|
[194] | 1699 | FreeListInfo((LISTINFO *) mp1);
|
---|
| 1700 | }
|
---|
| 1701 | else
|
---|
| 1702 | return (MRESULT) TRUE;
|
---|
[2] | 1703 | }
|
---|
[194] | 1704 | else
|
---|
| 1705 | FreeListInfo((LISTINFO *) mp1);
|
---|
| 1706 | }
|
---|
| 1707 | return 0;
|
---|
[2] | 1708 |
|
---|
[194] | 1709 | case UM_NOTIFY:
|
---|
| 1710 | if (mp2)
|
---|
[1009] | 1711 | AddNote((CHAR *)mp2);
|
---|
[194] | 1712 | return 0;
|
---|
[2] | 1713 |
|
---|
[194] | 1714 | case WM_COMMAND:
|
---|
| 1715 | DosError(FERR_DISABLEHARDERR);
|
---|
[444] | 1716 | if (dcd) {
|
---|
| 1717 | switch (SHORT1FROMMP(mp1)) {
|
---|
[194] | 1718 | case IDM_SETTARGET:
|
---|
[1702] | 1719 | SetTargetDir(hwnd, FALSE, NULL);
|
---|
[194] | 1720 | break;
|
---|
[2] | 1721 |
|
---|
[194] | 1722 | case IDM_CONTEXTMENU:
|
---|
| 1723 | {
|
---|
| 1724 | PCNRITEM pci;
|
---|
[2] | 1725 |
|
---|
[194] | 1726 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
| 1727 | PostMsg(hwnd, WM_CONTROL, MPFROM2SHORT(COLLECTOR_CNR,
|
---|
[551] | 1728 | CN_CONTEXTMENU),
|
---|
| 1729 | MPFROMP(pci));
|
---|
[194] | 1730 | }
|
---|
| 1731 | break;
|
---|
[2] | 1732 |
|
---|
[194] | 1733 | case IDM_SHOWALLFILES:
|
---|
| 1734 | {
|
---|
| 1735 | PCNRITEM pci;
|
---|
[2] | 1736 |
|
---|
[471] | 1737 | pci = WinSendMsg(hwnd,
|
---|
| 1738 | CM_QUERYRECORDEMPHASIS,
|
---|
[551] | 1739 | MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
|
---|
[444] | 1740 | if (pci && (INT) pci != -1) {
|
---|
[194] | 1741 | static CHAR dirname[CCHMAXPATH];
|
---|
[2] | 1742 |
|
---|
[730] | 1743 | strcpy(dirname, pci->pszFileName);
|
---|
[194] | 1744 | MakeValidDir(dirname);
|
---|
| 1745 | StartSeeAll(HWND_DESKTOP, FALSE, dirname);
|
---|
| 1746 | }
|
---|
| 1747 | }
|
---|
| 1748 | break;
|
---|
[2] | 1749 |
|
---|
[194] | 1750 | case IDM_BEGINEDIT:
|
---|
| 1751 | OpenEdit(hwnd);
|
---|
| 1752 | break;
|
---|
[2] | 1753 |
|
---|
[194] | 1754 | case IDM_ENDEDIT:
|
---|
| 1755 | WinSendMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
|
---|
| 1756 | break;
|
---|
[2] | 1757 |
|
---|
[194] | 1758 | case IDM_SHOWSELECT:
|
---|
[551] | 1759 | QuickPopup(hwnd, dcd,
|
---|
[872] | 1760 | CheckMenu(hwnd, &CollectorCnrMenu, COLLECTORCNR_POPUP),
|
---|
[194] | 1761 | IDM_SELECTSUBMENU);
|
---|
| 1762 | break;
|
---|
[2] | 1763 |
|
---|
[194] | 1764 | case IDM_SHOWSORT:
|
---|
[551] | 1765 | QuickPopup(hwnd, dcd,
|
---|
[872] | 1766 | CheckMenu(hwnd, &CollectorCnrMenu, COLLECTORCNR_POPUP),
|
---|
[194] | 1767 | IDM_SORTSUBMENU);
|
---|
| 1768 | break;
|
---|
[2] | 1769 |
|
---|
[194] | 1770 | case IDM_VIEWORARC:
|
---|
| 1771 | {
|
---|
| 1772 | SWP swp;
|
---|
| 1773 | PCNRITEM pci;
|
---|
[2] | 1774 |
|
---|
[194] | 1775 | pci = (PCNRITEM) WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
|
---|
| 1776 | MPFROMLONG(CMA_FIRST),
|
---|
| 1777 | MPFROMSHORT(CRA_CURSORED));
|
---|
[444] | 1778 | if (pci && (INT) pci != -1) {
|
---|
[551] | 1779 | WinQueryWindowPos(dcd->hwndFrame, &swp);
|
---|
| 1780 | DefaultViewKeys(hwnd, dcd->hwndFrame, dcd->hwndParent, &swp,
|
---|
[730] | 1781 | pci->pszFileName);
|
---|
[194] | 1782 | }
|
---|
| 1783 | }
|
---|
| 1784 | break;
|
---|
[2] | 1785 |
|
---|
[194] | 1786 | case IDM_SEEALL:
|
---|
[551] | 1787 | StartSeeAll(HWND_DESKTOP, FALSE, NULL);
|
---|
[194] | 1788 | break;
|
---|
[2] | 1789 |
|
---|
[194] | 1790 | case IDM_COLLECTSELECT:
|
---|
| 1791 | {
|
---|
| 1792 | CHAR filename[CCHMAXPATH], *p, *pp;
|
---|
[2] | 1793 |
|
---|
[1395] | 1794 | strcpy(filename, PCSZ_STARDOTLST);
|
---|
[194] | 1795 | size = CCHMAXPATH;
|
---|
| 1796 | PrfQueryProfileData(fmprof, appname, "SaveToListName",
|
---|
| 1797 | filename, &size);
|
---|
| 1798 | pp = strrchr(filename, '\\');
|
---|
| 1799 | if (!pp)
|
---|
| 1800 | pp = filename;
|
---|
| 1801 | p = strrchr(pp, '.');
|
---|
[444] | 1802 | if (p && *(p + 1) && p > pp + 1) {
|
---|
[194] | 1803 | if (pp > filename)
|
---|
| 1804 | pp++;
|
---|
| 1805 | *pp = '*';
|
---|
| 1806 | pp++;
|
---|
| 1807 | if (p > pp)
|
---|
| 1808 | memmove(pp, p, strlen(p) + 1);
|
---|
| 1809 | }
|
---|
[444] | 1810 | if (insert_filename(hwnd, filename, FALSE, FALSE)) {
|
---|
[1077] | 1811 | # ifdef FORTIFY
|
---|
| 1812 | Fortify_EnterScope();
|
---|
| 1813 | # endif
|
---|
[551] | 1814 | p = xstrdup(filename, pszSrcFile, __LINE__);
|
---|
[444] | 1815 | if (p) {
|
---|
[194] | 1816 | if (!PostMsg(hwnd, UM_COLLECTFROMFILE, MPFROMP(p), MPVOID))
|
---|
[1077] | 1817 | free(p);
|
---|
[194] | 1818 | }
|
---|
[1077] | 1819 | # ifdef FORTIFY
|
---|
| 1820 | DosSleep(1); // Let receiver take ownership
|
---|
| 1821 | Fortify_LeaveScope();
|
---|
| 1822 | # endif
|
---|
[194] | 1823 | }
|
---|
| 1824 | }
|
---|
| 1825 | break;
|
---|
[2] | 1826 |
|
---|
[953] | 1827 | case IDM_COLLECTORVIEWSETTINGS:
|
---|
[551] | 1828 | if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
|
---|
[953] | 1829 | PostMsg(dcd->hwndParent, msg, MPFROMLONG(IDM_COLLECTORVIEWSETTINGS), mp2);
|
---|
[917] | 1830 | else {
|
---|
| 1831 | WinDlgBox(HWND_DESKTOP,
|
---|
| 1832 | hwnd,
|
---|
| 1833 | CfgDlgProc,
|
---|
| 1834 | FM3ModHandle,
|
---|
| 1835 | CFG_FRAME,
|
---|
[953] | 1836 | MPFROMLONG(IDM_COLLECTORVIEWSETTINGS));
|
---|
[917] | 1837 | }
|
---|
[194] | 1838 | break;
|
---|
[2] | 1839 |
|
---|
[194] | 1840 | case IDM_RESELECT:
|
---|
[551] | 1841 | SelectList(hwnd, FALSE, FALSE, FALSE, NULL, NULL, dcd->lastselection);
|
---|
[1563] | 1842 | break;
|
---|
[1546] | 1843 |
|
---|
| 1844 | case IDM_WALKDIR:
|
---|
[1547] | 1845 | case IDM_OPENDIRWINDOW:
|
---|
| 1846 | case IDM_OPENDIRICON:
|
---|
| 1847 | case IDM_OPENDIRDETAILS:
|
---|
| 1848 | case IDM_OPENDIRTREE:
|
---|
[1546] | 1849 | {
|
---|
| 1850 | CHAR newpath[CCHMAXPATH];
|
---|
| 1851 | PCNRITEM pci;
|
---|
| 1852 |
|
---|
| 1853 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
| 1854 | if (pci && (INT) pci != -1) {
|
---|
| 1855 | strcpy(newpath, pci->pszFileName);
|
---|
| 1856 | MakeValidDir(newpath);
|
---|
| 1857 | }
|
---|
| 1858 | else
|
---|
[1563] | 1859 | strcpy(newpath, pFM2SaveDirectory);
|
---|
| 1860 | if (*newpath) {
|
---|
| 1861 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 1862 | case IDM_WALKDIR:
|
---|
| 1863 | WinDlgBox(HWND_DESKTOP, dcd->hwndParent, WalkAllDlgProc,
|
---|
| 1864 | FM3ModHandle, WALK_FRAME, MPFROMP(newpath));
|
---|
| 1865 | break;
|
---|
| 1866 | case IDM_OPENDIRWINDOW:
|
---|
| 1867 | WinSendMsg(hwnd, UM_OPENWINDOWFORME, MPFROMP(newpath), MPVOID);
|
---|
| 1868 | break;
|
---|
| 1869 | case IDM_OPENDIRICON:
|
---|
| 1870 | OpenObject(newpath, PCSZ_ICON, hwnd);
|
---|
| 1871 | break;
|
---|
| 1872 | case IDM_OPENDIRDETAILS:
|
---|
| 1873 | OpenObject(newpath, Details, hwnd);
|
---|
| 1874 | break;
|
---|
| 1875 | case IDM_OPENDIRTREE:
|
---|
| 1876 | OpenObject(newpath, PCSZ_TREE, hwnd);
|
---|
| 1877 | break;
|
---|
| 1878 | default:
|
---|
| 1879 | break;
|
---|
| 1880 | }
|
---|
| 1881 | }
|
---|
[1546] | 1882 | }
|
---|
[194] | 1883 | break;
|
---|
[2] | 1884 |
|
---|
[194] | 1885 | case IDM_HELP:
|
---|
| 1886 | if (hwndHelp)
|
---|
| 1887 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 1888 | MPFROM2SHORT(HELP_COLLECT, 0),
|
---|
| 1889 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 1890 | break;
|
---|
[2] | 1891 |
|
---|
[194] | 1892 | case IDM_SORTNONE:
|
---|
| 1893 | case IDM_SORTSMARTNAME:
|
---|
| 1894 | case IDM_SORTNAME:
|
---|
| 1895 | case IDM_SORTFILENAME:
|
---|
| 1896 | case IDM_SORTSIZE:
|
---|
| 1897 | case IDM_SORTEASIZE:
|
---|
| 1898 | case IDM_SORTFIRST:
|
---|
| 1899 | case IDM_SORTLAST:
|
---|
| 1900 | case IDM_SORTLWDATE:
|
---|
| 1901 | case IDM_SORTLADATE:
|
---|
| 1902 | case IDM_SORTCRDATE:
|
---|
| 1903 | case IDM_SORTSUBJECT:
|
---|
[197] | 1904 | savedSortFlags = CollectorsortFlags;
|
---|
[194] | 1905 | CollectorsortFlags &= (SORT_REVERSE | SORT_DIRSFIRST | SORT_DIRSLAST);
|
---|
| 1906 | case IDM_SORTDIRSFIRST:
|
---|
| 1907 | case IDM_SORTDIRSLAST:
|
---|
| 1908 | case IDM_SORTREVERSE:
|
---|
[444] | 1909 | switch (SHORT1FROMMP(mp1)) {
|
---|
[194] | 1910 | case IDM_SORTSUBJECT:
|
---|
| 1911 | CollectorsortFlags |= SORT_SUBJECT;
|
---|
| 1912 | break;
|
---|
| 1913 | case IDM_SORTNONE:
|
---|
| 1914 | CollectorsortFlags |= SORT_NOSORT;
|
---|
| 1915 | break;
|
---|
| 1916 | case IDM_SORTSMARTNAME:
|
---|
[197] | 1917 | if (~savedSortFlags & SORT_FILENAME)
|
---|
[194] | 1918 | CollectorsortFlags |= SORT_FILENAME;
|
---|
| 1919 | break;
|
---|
| 1920 | case IDM_SORTFILENAME:
|
---|
| 1921 | CollectorsortFlags |= SORT_FILENAME;
|
---|
| 1922 | break;
|
---|
| 1923 | case IDM_SORTSIZE:
|
---|
| 1924 | CollectorsortFlags |= SORT_SIZE;
|
---|
| 1925 | break;
|
---|
| 1926 | case IDM_SORTEASIZE:
|
---|
| 1927 | CollectorsortFlags |= SORT_EASIZE;
|
---|
| 1928 | break;
|
---|
| 1929 | case IDM_SORTFIRST:
|
---|
| 1930 | CollectorsortFlags |= SORT_FIRSTEXTENSION;
|
---|
| 1931 | break;
|
---|
| 1932 | case IDM_SORTLAST:
|
---|
| 1933 | CollectorsortFlags |= SORT_LASTEXTENSION;
|
---|
| 1934 | break;
|
---|
| 1935 | case IDM_SORTLWDATE:
|
---|
| 1936 | CollectorsortFlags |= SORT_LWDATE;
|
---|
| 1937 | break;
|
---|
| 1938 | case IDM_SORTLADATE:
|
---|
| 1939 | CollectorsortFlags |= SORT_LADATE;
|
---|
| 1940 | break;
|
---|
| 1941 | case IDM_SORTCRDATE:
|
---|
| 1942 | CollectorsortFlags |= SORT_CRDATE;
|
---|
| 1943 | break;
|
---|
| 1944 | case IDM_SORTDIRSFIRST:
|
---|
| 1945 | if (CollectorsortFlags & SORT_DIRSFIRST)
|
---|
| 1946 | CollectorsortFlags &= (~SORT_DIRSFIRST);
|
---|
[444] | 1947 | else {
|
---|
[194] | 1948 | CollectorsortFlags |= SORT_DIRSFIRST;
|
---|
| 1949 | CollectorsortFlags &= (~SORT_DIRSLAST);
|
---|
| 1950 | }
|
---|
| 1951 | break;
|
---|
| 1952 | case IDM_SORTDIRSLAST:
|
---|
| 1953 | if (CollectorsortFlags & SORT_DIRSLAST)
|
---|
| 1954 | CollectorsortFlags &= (~SORT_DIRSLAST);
|
---|
[444] | 1955 | else {
|
---|
[194] | 1956 | CollectorsortFlags |= SORT_DIRSLAST;
|
---|
| 1957 | CollectorsortFlags &= (~SORT_DIRSFIRST);
|
---|
| 1958 | }
|
---|
| 1959 | break;
|
---|
| 1960 | case IDM_SORTREVERSE:
|
---|
| 1961 | if (CollectorsortFlags & SORT_REVERSE)
|
---|
| 1962 | CollectorsortFlags &= (~SORT_REVERSE);
|
---|
| 1963 | else
|
---|
| 1964 | CollectorsortFlags |= SORT_REVERSE;
|
---|
| 1965 | break;
|
---|
| 1966 | }
|
---|
| 1967 | PrfWriteProfileData(fmprof, appname, "CollectorSort",
|
---|
| 1968 | &CollectorsortFlags, sizeof(INT));
|
---|
| 1969 | WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortCollectorCnr), MPVOID);
|
---|
| 1970 | SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 1971 | DIR_SORT), CollectorsortFlags, FALSE);
|
---|
| 1972 | break;
|
---|
[2] | 1973 |
|
---|
[194] | 1974 | case IDM_COLLECTFROMCLIP:
|
---|
| 1975 | {
|
---|
| 1976 | LISTINFO *li;
|
---|
[1077] | 1977 | # ifdef FORTIFY
|
---|
| 1978 | Fortify_EnterScope();
|
---|
| 1979 | # endif
|
---|
[551] | 1980 | li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
|
---|
[444] | 1981 | if (li) {
|
---|
[551] | 1982 | li->list = ListFromClipboard(hwnd);
|
---|
| 1983 | if (!li->list || !li->list[0])
|
---|
[194] | 1984 | FreeListInfo(li);
|
---|
[444] | 1985 | else {
|
---|
[551] | 1986 | li->type = IDM_COLLECT;
|
---|
| 1987 | if (!PostMsg(dcd->hwndObject, UM_COLLECT, MPFROMP(li), MPVOID))
|
---|
[194] | 1988 | FreeListInfo(li);
|
---|
| 1989 | }
|
---|
| 1990 | }
|
---|
[1077] | 1991 | # ifdef FORTIFY
|
---|
[1563] | 1992 | DosSleep(1); // Let receiver take ownership
|
---|
[1077] | 1993 | Fortify_LeaveScope();
|
---|
| 1994 | # endif
|
---|
[194] | 1995 | }
|
---|
| 1996 | break;
|
---|
[2] | 1997 |
|
---|
[194] | 1998 | case IDM_REMOVE:
|
---|
[551] | 1999 | if (fAutoView && hwndMain)
|
---|
| 2000 | PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
|
---|
| 2001 | dcd->suspendview = 1;
|
---|
| 2002 | RemoveAll(hwnd, &dcd->ullTotalBytes, &dcd->totalfiles);
|
---|
| 2003 | dcd->suspendview = 0;
|
---|
| 2004 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
[194] | 2005 | break;
|
---|
[2] | 2006 |
|
---|
[194] | 2007 | case IDM_CLEARCNR:
|
---|
| 2008 | {
|
---|
| 2009 | PCNRITEM pci;
|
---|
[2] | 2010 |
|
---|
[194] | 2011 | pci = (PCNRITEM) WinSendMsg(hwnd,
|
---|
| 2012 | CM_QUERYRECORD,
|
---|
| 2013 | MPVOID,
|
---|
[551] | 2014 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
[444] | 2015 | if (pci && (INT) pci != -1) {
|
---|
[751] | 2016 | RemoveCnrItems(hwnd, NULL, 0, CMA_FREE | CMA_INVALIDATE);
|
---|
[551] | 2017 | dcd->ullTotalBytes = dcd->selectedbytes = dcd->selectedfiles =
|
---|
[750] | 2018 | dcd->totalfiles = 0;
|
---|
[551] | 2019 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
[194] | 2020 | }
|
---|
| 2021 | }
|
---|
| 2022 | break;
|
---|
[2] | 2023 |
|
---|
[194] | 2024 | case DID_CANCEL:
|
---|
[551] | 2025 | if (dcd->amextracted)
|
---|
| 2026 | dcd->stopflag = 1; // Request cancel
|
---|
[194] | 2027 | break;
|
---|
[2] | 2028 |
|
---|
[194] | 2029 | case IDM_COLLECTOR:
|
---|
[444] | 2030 | if (mp2) {
|
---|
[194] | 2031 | LISTINFO *li;
|
---|
[1077] | 2032 | # ifdef FORTIFY
|
---|
| 2033 | Fortify_EnterScope();
|
---|
| 2034 | # endif
|
---|
[551] | 2035 | li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
|
---|
[444] | 2036 | if (li) {
|
---|
[551] | 2037 | li->list = mp2;
|
---|
| 2038 | if (!li->list || !li->list[0])
|
---|
[194] | 2039 | FreeListInfo(li);
|
---|
[444] | 2040 | else {
|
---|
[551] | 2041 | li->type = IDM_COLLECT;
|
---|
| 2042 | if (!PostMsg(dcd->hwndObject, UM_COLLECT, MPFROMP(li), MPVOID))
|
---|
[194] | 2043 | FreeListInfo(li);
|
---|
| 2044 | }
|
---|
| 2045 | }
|
---|
| 2046 | else
|
---|
| 2047 | FreeList(mp2);
|
---|
[1077] | 2048 | # ifdef FORTIFY
|
---|
| 2049 | DosSleep(1); // Let receiver take ownership
|
---|
| 2050 | Fortify_LeaveScope();
|
---|
| 2051 | # endif
|
---|
[194] | 2052 | }
|
---|
| 2053 | break;
|
---|
[2] | 2054 |
|
---|
[194] | 2055 | case IDM_UNDELETE:
|
---|
[1077] | 2056 | {
|
---|
[194] | 2057 | PCNRITEM pci;
|
---|
[1077] | 2058 | CHAR path[CCHMAXPATH];
|
---|
| 2059 | HOBJECT hObject;
|
---|
| 2060 | HWND hwndDesktop;
|
---|
[2] | 2061 |
|
---|
[1077] | 2062 | hObject = WinQueryObject("<XWP_TRASHCAN>");
|
---|
| 2063 | if (hObject != NULLHANDLE && fTrashCan) {
|
---|
| 2064 | hwndDesktop = WinQueryDesktopWindow((HAB) 0, NULLHANDLE);
|
---|
[1041] | 2065 | WinSetFocus(HWND_DESKTOP, hwndDesktop);
|
---|
[1077] | 2066 | WinOpenObject(hObject, 0, TRUE);
|
---|
[194] | 2067 | }
|
---|
[1077] | 2068 | else {
|
---|
| 2069 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
| 2070 | if (pci && (INT) pci != -1) {
|
---|
| 2071 | strcpy(path, pci->pszFileName);
|
---|
| 2072 | MakeValidDir(path);
|
---|
| 2073 | WinDlgBox(HWND_DESKTOP, hwnd, UndeleteDlgProc, FM3ModHandle,
|
---|
| 2074 | UNDEL_FRAME, MPFROMP(path));
|
---|
| 2075 | }
|
---|
| 2076 | }
|
---|
[194] | 2077 | }
|
---|
| 2078 | break;
|
---|
[2] | 2079 |
|
---|
[194] | 2080 | case IDM_GREP:
|
---|
[1456] | 2081 | case UM_GREP:
|
---|
[724] | 2082 | if (dcd->amextracted) {
|
---|
| 2083 | saymsg(MB_OK | MB_ICONASTERISK,
|
---|
| 2084 | hwnd,
|
---|
| 2085 | GetPString(IDS_WARNINGTEXT),
|
---|
| 2086 | "Collector busy - please try again later");
|
---|
| 2087 | }
|
---|
[1394] | 2088 | else {
|
---|
| 2089 | GREPINFO *GrepInfo;
|
---|
[1366] | 2090 |
|
---|
[1394] | 2091 | GrepInfo = xmallocz(sizeof(GREPINFO), pszSrcFile, __LINE__);
|
---|
| 2092 | if (GrepInfo) {
|
---|
| 2093 | GrepInfo->hwnd = &hwnd;
|
---|
[1456] | 2094 | if (msg == UM_GREP && mp2)
|
---|
[1394] | 2095 | GrepInfo->szGrepPath = mp2;
|
---|
| 2096 | if (WinDlgBox(HWND_DESKTOP, hwnd, GrepDlgProc,
|
---|
| 2097 | FM3ModHandle, GREP_FRAME, (PVOID) GrepInfo)) {
|
---|
| 2098 | free(GrepInfo);
|
---|
| 2099 | dcd->amextracted = TRUE; // Say busy scanning
|
---|
| 2100 | disable_menuitem(WinWindowFromID
|
---|
| 2101 | (WinQueryWindow(hwndMain, QW_PARENT), FID_MENU),
|
---|
| 2102 | IDM_GREP, TRUE);
|
---|
| 2103 | disable_menuitem(TreeMenu, IDM_GREP, TRUE);
|
---|
| 2104 | disable_menuitem(DirMenu, IDM_GREP, TRUE);
|
---|
| 2105 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
| 2106 | }
|
---|
| 2107 | else
|
---|
| 2108 | free(GrepInfo);
|
---|
[194] | 2109 | }
|
---|
| 2110 | }
|
---|
| 2111 | break;
|
---|
[2] | 2112 |
|
---|
[194] | 2113 | case IDM_RESORT:
|
---|
| 2114 | WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortCollectorCnr), MPVOID);
|
---|
| 2115 | break;
|
---|
[2] | 2116 |
|
---|
[194] | 2117 | case IDM_FILTER:
|
---|
| 2118 | {
|
---|
| 2119 | BOOL empty = FALSE;
|
---|
| 2120 | PCNRITEM pci;
|
---|
| 2121 | CHAR *p;
|
---|
[2] | 2122 |
|
---|
[551] | 2123 | if (!*dcd->mask.szMask) {
|
---|
[194] | 2124 | empty = TRUE;
|
---|
[1702] | 2125 | // 2013-12-13 SHL Allow nul pszFileName
|
---|
[194] | 2126 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
[1702] | 2127 | if (pci && pci->pszFileName && ~pci->attrFile & FILE_DIRECTORY) {
|
---|
[730] | 2128 | p = strrchr(pci->pszFileName, '\\');
|
---|
[444] | 2129 | if (p) {
|
---|
[194] | 2130 | p++;
|
---|
[551] | 2131 | strcpy(dcd->mask.szMask, p);
|
---|
[194] | 2132 | }
|
---|
| 2133 | }
|
---|
| 2134 | }
|
---|
[551] | 2135 | *(dcd->mask.prompt) = 0;
|
---|
[2] | 2136 |
|
---|
[194] | 2137 | if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
|
---|
[551] | 2138 | FM3ModHandle, MSK_FRAME, MPFROMP(&dcd->mask))) {
|
---|
[197] | 2139 | size = sizeof(MASK);
|
---|
| 2140 | PrfWriteProfileData(fmprof, appname, "CollectorFilter",
|
---|
[551] | 2141 | &dcd->mask, size);
|
---|
| 2142 | dcd->suspendview = 1;
|
---|
| 2143 | WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));
|
---|
| 2144 | dcd->suspendview = 0;
|
---|
[444] | 2145 | if (fAutoView && hwndMain) {
|
---|
[194] | 2146 | pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
|
---|
| 2147 | MPFROMLONG(CMA_FIRST),
|
---|
| 2148 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 2149 | if (pci && (INT) pci != -1 &&
|
---|
[730] | 2150 | (!(driveflags[toupper(*pci->pszFileName) - 'A'] &
|
---|
[551] | 2151 | DRIVE_SLOW)))
|
---|
[730] | 2152 | WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName),
|
---|
[194] | 2153 | MPVOID);
|
---|
| 2154 | else
|
---|
| 2155 | WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
|
---|
| 2156 | }
|
---|
| 2157 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
| 2158 | }
|
---|
| 2159 | else if (empty)
|
---|
[551] | 2160 | *dcd->mask.szMask = 0;
|
---|
[194] | 2161 | SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[551] | 2162 | DIR_FILTER), &dcd->mask, FALSE);
|
---|
[194] | 2163 | }
|
---|
[1077] | 2164 | break;
|
---|
[2] | 2165 |
|
---|
[958] | 2166 | case IDM_UNHIDEALL:
|
---|
[1077] | 2167 | WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));
|
---|
| 2168 | break;
|
---|
[958] | 2169 |
|
---|
[194] | 2170 | case IDM_HIDEALL:
|
---|
| 2171 | if (fAutoView && hwndMain)
|
---|
| 2172 | PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
|
---|
[551] | 2173 | dcd->suspendview = 1;
|
---|
[194] | 2174 | HideAll(hwnd);
|
---|
[551] | 2175 | dcd->suspendview = 0;
|
---|
[194] | 2176 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
| 2177 | break;
|
---|
[2] | 2178 |
|
---|
[194] | 2179 | case IDM_SELECTLIST:
|
---|
| 2180 | case IDM_SELECTALL:
|
---|
| 2181 | case IDM_DESELECTALL:
|
---|
| 2182 | case IDM_SELECTALLFILES:
|
---|
| 2183 | case IDM_DESELECTALLFILES:
|
---|
| 2184 | case IDM_SELECTALLDIRS:
|
---|
| 2185 | case IDM_DESELECTALLDIRS:
|
---|
| 2186 | case IDM_SELECTMASK:
|
---|
| 2187 | case IDM_DESELECTMASK:
|
---|
| 2188 | case IDM_INVERT:
|
---|
| 2189 | case IDM_SELECTCLIP:
|
---|
| 2190 | case IDM_DESELECTCLIP:
|
---|
| 2191 | {
|
---|
| 2192 | PCNRITEM pci;
|
---|
[2] | 2193 |
|
---|
[194] | 2194 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
| 2195 | if ((INT) pci == -1)
|
---|
| 2196 | pci = NULL;
|
---|
[444] | 2197 | if (SHORT1FROMMP(mp1) == IDM_HIDEALL) {
|
---|
| 2198 | if (pci) {
|
---|
[551] | 2199 | if (!(pci->rc.flRecordAttr & CRA_SELECTED))
|
---|
| 2200 | pci->rc.flRecordAttr |= CRA_FILTERED;
|
---|
[194] | 2201 | WinSendMsg(hwnd, CM_INVALIDATERECORD, MPFROMP(&pci),
|
---|
| 2202 | MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
|
---|
| 2203 | break;
|
---|
| 2204 | }
|
---|
| 2205 | }
|
---|
[551] | 2206 | PostMsg(dcd->hwndObject, UM_SELECT, mp1, MPFROMP(pci));
|
---|
[194] | 2207 | }
|
---|
| 2208 | break;
|
---|
[2] | 2209 |
|
---|
[194] | 2210 | case IDM_RESCAN:
|
---|
[551] | 2211 | PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPVOID);
|
---|
[194] | 2212 | break;
|
---|
[2] | 2213 |
|
---|
[194] | 2214 | case IDM_SHOWLNAMES:
|
---|
| 2215 | case IDM_SHOWSUBJECT:
|
---|
| 2216 | case IDM_SHOWEAS:
|
---|
| 2217 | case IDM_SHOWSIZE:
|
---|
| 2218 | case IDM_SHOWICON:
|
---|
| 2219 | case IDM_SHOWLWDATE:
|
---|
| 2220 | case IDM_SHOWLWTIME:
|
---|
| 2221 | case IDM_SHOWLADATE:
|
---|
| 2222 | case IDM_SHOWLATIME:
|
---|
| 2223 | case IDM_SHOWCRDATE:
|
---|
| 2224 | case IDM_SHOWCRTIME:
|
---|
| 2225 | case IDM_SHOWATTR:
|
---|
[551] | 2226 | AdjustDetailsSwitches(hwnd, dcd->hwndLastMenu,
|
---|
[194] | 2227 | SHORT1FROMMP(mp1), NULL,
|
---|
[1400] | 2228 | PCSZ_COLLECTOR, &dcd->ds, FALSE);
|
---|
[194] | 2229 | break;
|
---|
[2] | 2230 |
|
---|
[194] | 2231 | case IDM_ICON:
|
---|
| 2232 | case IDM_TEXT:
|
---|
| 2233 | case IDM_DETAILS:
|
---|
| 2234 | case IDM_NAME:
|
---|
| 2235 | case IDM_MINIICONS:
|
---|
| 2236 | case IDM_DETAILSTITLES:
|
---|
| 2237 | {
|
---|
| 2238 | CNRINFO cnri;
|
---|
[2] | 2239 |
|
---|
[194] | 2240 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 2241 | cnri.cb = sizeof(CNRINFO);
|
---|
| 2242 | WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
|
---|
| 2243 | MPFROMLONG(sizeof(CNRINFO)));
|
---|
[444] | 2244 | switch (SHORT1FROMMP(mp1)) {
|
---|
[194] | 2245 | case IDM_ICON:
|
---|
| 2246 | cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
|
---|
| 2247 | CV_DETAIL | CV_NAME));
|
---|
| 2248 | cnri.flWindowAttr |= CV_ICON;
|
---|
| 2249 | break;
|
---|
| 2250 | case IDM_NAME:
|
---|
| 2251 | cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
|
---|
| 2252 | CV_DETAIL | CV_NAME));
|
---|
| 2253 | cnri.flWindowAttr |= CV_NAME;
|
---|
| 2254 | break;
|
---|
| 2255 | case IDM_TEXT:
|
---|
| 2256 | cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
|
---|
| 2257 | CV_DETAIL | CV_NAME));
|
---|
| 2258 | cnri.flWindowAttr |= CV_TEXT;
|
---|
| 2259 | break;
|
---|
| 2260 | case IDM_DETAILS:
|
---|
| 2261 | cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
|
---|
| 2262 | CV_DETAIL | CV_NAME));
|
---|
| 2263 | cnri.flWindowAttr |= CV_DETAIL;
|
---|
| 2264 | break;
|
---|
| 2265 | case IDM_MINIICONS:
|
---|
| 2266 | if (cnri.flWindowAttr & CV_MINI)
|
---|
| 2267 | cnri.flWindowAttr &= (~CV_MINI);
|
---|
| 2268 | else
|
---|
| 2269 | cnri.flWindowAttr |= CV_MINI;
|
---|
| 2270 | break;
|
---|
| 2271 | case IDM_DETAILSTITLES:
|
---|
| 2272 | if (cnri.flWindowAttr & CA_DETAILSVIEWTITLES)
|
---|
| 2273 | cnri.flWindowAttr &= (~CA_DETAILSVIEWTITLES);
|
---|
| 2274 | else
|
---|
| 2275 | cnri.flWindowAttr |= CA_DETAILSVIEWTITLES;
|
---|
| 2276 | break;
|
---|
| 2277 | }
|
---|
[551] | 2278 | cnri.flWindowAttr &= (~(CA_ORDEREDTARGETEMPH | CA_MIXEDTARGETEMPH));
|
---|
[194] | 2279 | cnri.flWindowAttr |= CV_FLOW;
|
---|
[551] | 2280 | dcd->flWindowAttr = cnri.flWindowAttr;
|
---|
[194] | 2281 | PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
|
---|
| 2282 | &cnri.flWindowAttr, sizeof(ULONG));
|
---|
| 2283 | WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
|
---|
| 2284 | MPFROMLONG(CMA_FLWINDOWATTR));
|
---|
| 2285 | WinSendMsg(hwnd, CM_INVALIDATERECORD, MPVOID,
|
---|
| 2286 | MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
|
---|
| 2287 | SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[551] | 2288 | DIR_VIEW), dcd->flWindowAttr);
|
---|
[194] | 2289 | }
|
---|
| 2290 | break;
|
---|
[2] | 2291 |
|
---|
[194] | 2292 | case IDM_SAVETOLIST:
|
---|
| 2293 | WinDlgBox(HWND_DESKTOP, hwnd, SaveListDlgProc, FM3ModHandle,
|
---|
| 2294 | SAV_FRAME, MPFROMP(&hwnd));
|
---|
| 2295 | break;
|
---|
[2] | 2296 |
|
---|
[194] | 2297 | case IDM_SIZES:
|
---|
| 2298 | {
|
---|
| 2299 | PCNRITEM pci;
|
---|
[2] | 2300 |
|
---|
[194] | 2301 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
| 2302 | if (pci && (INT) pci != -1)
|
---|
| 2303 | WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, DirSizeProc, FM3ModHandle,
|
---|
[730] | 2304 | DSZ_FRAME, pci->pszFileName);
|
---|
[194] | 2305 | }
|
---|
| 2306 | break;
|
---|
[2] | 2307 |
|
---|
[194] | 2308 | case IDM_MKDIR:
|
---|
| 2309 | {
|
---|
| 2310 | PCNRITEM pci;
|
---|
[2] | 2311 |
|
---|
[194] | 2312 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
[551] | 2313 | PMMkDir(dcd->hwndParent, (pci && (INT) pci != -1) ?
|
---|
[730] | 2314 | pci->pszFileName : NULL, FALSE);
|
---|
[194] | 2315 | }
|
---|
| 2316 | break;
|
---|
[2] | 2317 |
|
---|
[194] | 2318 | case IDM_DOITYOURSELF:
|
---|
| 2319 | case IDM_UPDATE:
|
---|
| 2320 | case IDM_COLLECTFROMFILE:
|
---|
[1547] | 2321 | case IDM_OPENWINDOW:
|
---|
[194] | 2322 | case IDM_OPENSETTINGS:
|
---|
| 2323 | case IDM_OPENDEFAULT:
|
---|
| 2324 | case IDM_OPENICON:
|
---|
| 2325 | case IDM_OPENDETAILS:
|
---|
| 2326 | case IDM_OPENTREE:
|
---|
| 2327 | case IDM_OBJECT:
|
---|
| 2328 | case IDM_SHADOW:
|
---|
| 2329 | case IDM_SHADOW2:
|
---|
| 2330 | case IDM_DELETE:
|
---|
| 2331 | case IDM_PERMDELETE:
|
---|
| 2332 | case IDM_PRINT:
|
---|
| 2333 | case IDM_ATTRS:
|
---|
| 2334 | case IDM_INFO:
|
---|
| 2335 | case IDM_COPY:
|
---|
| 2336 | case IDM_MOVE:
|
---|
| 2337 | case IDM_WPSCOPY:
|
---|
| 2338 | case IDM_WPSMOVE:
|
---|
| 2339 | case IDM_COPYPRESERVE:
|
---|
| 2340 | case IDM_MOVEPRESERVE:
|
---|
| 2341 | case IDM_WILDCOPY:
|
---|
| 2342 | case IDM_WILDMOVE:
|
---|
| 2343 | case IDM_RENAME:
|
---|
| 2344 | case IDM_COMPARE:
|
---|
| 2345 | case IDM_EAS:
|
---|
| 2346 | case IDM_SUBJECT:
|
---|
| 2347 | case IDM_VIEW:
|
---|
| 2348 | case IDM_VIEWTEXT:
|
---|
| 2349 | case IDM_VIEWBINARY:
|
---|
| 2350 | case IDM_VIEWARCHIVE:
|
---|
| 2351 | case IDM_EDIT:
|
---|
| 2352 | case IDM_EDITTEXT:
|
---|
| 2353 | case IDM_EDITBINARY:
|
---|
| 2354 | case IDM_SAVETOCLIP:
|
---|
[1084] | 2355 | case IDM_SAVETOCLIPFILENAME:
|
---|
[194] | 2356 | case IDM_APPENDTOCLIP:
|
---|
[1084] | 2357 | case IDM_APPENDTOCLIPFILENAME:
|
---|
[194] | 2358 | case IDM_ARCHIVE:
|
---|
| 2359 | case IDM_ARCHIVEM:
|
---|
| 2360 | case IDM_EXTRACT:
|
---|
| 2361 | case IDM_MCIPLAY:
|
---|
| 2362 | case IDM_UUDECODE:
|
---|
[1664] | 2363 | case IDM_UNLOCKFILE:
|
---|
[194] | 2364 | case IDM_MERGE:
|
---|
| 2365 | {
|
---|
| 2366 | LISTINFO *li;
|
---|
| 2367 | ULONG action = UM_ACTION;
|
---|
[1077] | 2368 | # ifdef FORTIFY
|
---|
| 2369 | Fortify_EnterScope();
|
---|
| 2370 | # endif
|
---|
[551] | 2371 | li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
|
---|
[444] | 2372 | if (li) {
|
---|
[551] | 2373 | li->type = SHORT1FROMMP(mp1);
|
---|
| 2374 | li->hwnd = hwnd;
|
---|
| 2375 | li->list = BuildList(hwnd);
|
---|
| 2376 | if (li->list) {
|
---|
[444] | 2377 | switch (SHORT1FROMMP(mp1)) {
|
---|
[194] | 2378 | case IDM_DOITYOURSELF:
|
---|
[1335] | 2379 | case IDM_APPENDTOCLIP:
|
---|
| 2380 | case IDM_APPENDTOCLIPFILENAME:
|
---|
[194] | 2381 | case IDM_SAVETOCLIP:
|
---|
[1335] | 2382 | case IDM_SAVETOCLIPFILENAME:
|
---|
[194] | 2383 | case IDM_ARCHIVE:
|
---|
| 2384 | case IDM_ARCHIVEM:
|
---|
| 2385 | case IDM_DELETE:
|
---|
| 2386 | case IDM_PERMDELETE:
|
---|
| 2387 | case IDM_ATTRS:
|
---|
| 2388 | case IDM_PRINT:
|
---|
| 2389 | case IDM_SHADOW:
|
---|
| 2390 | case IDM_SHADOW2:
|
---|
| 2391 | case IDM_OBJECT:
|
---|
| 2392 | case IDM_VIEW:
|
---|
| 2393 | case IDM_VIEWTEXT:
|
---|
| 2394 | case IDM_VIEWBINARY:
|
---|
| 2395 | case IDM_EDIT:
|
---|
| 2396 | case IDM_EDITTEXT:
|
---|
| 2397 | case IDM_EDITBINARY:
|
---|
| 2398 | case IDM_MCIPLAY:
|
---|
| 2399 | case IDM_UPDATE:
|
---|
| 2400 | case IDM_INFO:
|
---|
| 2401 | case IDM_EAS:
|
---|
| 2402 | action = UM_MASSACTION;
|
---|
| 2403 | break;
|
---|
[1741] | 2404 | }
|
---|
| 2405 | if (li->type == IDM_DELETE)
|
---|
| 2406 | ignorereadonly = FALSE;
|
---|
[551] | 2407 | if (li->type == IDM_SHADOW || li->type == IDM_OBJECT ||
|
---|
| 2408 | li->type == IDM_SHADOW2)
|
---|
| 2409 | *li->targetpath = 0;
|
---|
| 2410 | if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID)) {
|
---|
[1400] | 2411 | Runtime_Error(pszSrcFile, __LINE__, PCSZ_POSTMSG);
|
---|
[194] | 2412 | FreeListInfo(li);
|
---|
| 2413 | }
|
---|
| 2414 | else if (fUnHilite)
|
---|
[672] | 2415 | UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
|
---|
[194] | 2416 | }
|
---|
[1077] | 2417 | else
|
---|
| 2418 | free(li);
|
---|
[194] | 2419 | }
|
---|
[1077] | 2420 | # ifdef FORTIFY
|
---|
| 2421 | Fortify_LeaveScope();
|
---|
| 2422 | # endif
|
---|
[194] | 2423 | }
|
---|
| 2424 | break;
|
---|
[2] | 2425 |
|
---|
[194] | 2426 | default:
|
---|
| 2427 | if (!cmdloaded)
|
---|
| 2428 | load_commands();
|
---|
| 2429 | if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
|
---|
[551] | 2430 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
|
---|
[194] | 2431 | INT x;
|
---|
[2] | 2432 |
|
---|
[1563] | 2433 | x = SHORT1FROMMP(mp1); // - IDM_COMMANDSTART;
|
---|
[444] | 2434 | if (x >= 0) {
|
---|
[1486] | 2435 | //x++;
|
---|
[194] | 2436 | RunCommand(hwnd, x);
|
---|
| 2437 | if (fUnHilite)
|
---|
[672] | 2438 | UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
|
---|
[194] | 2439 | }
|
---|
| 2440 | }
|
---|
| 2441 | break;
|
---|
| 2442 | }
|
---|
| 2443 | }
|
---|
| 2444 | return 0;
|
---|
[2] | 2445 |
|
---|
[194] | 2446 | case UM_FIXCNRMLE:
|
---|
| 2447 | case UM_FIXEDITNAME:
|
---|
| 2448 | return CommonCnrProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 2449 |
|
---|
[194] | 2450 | case UM_FILESMENU:
|
---|
| 2451 | {
|
---|
| 2452 | PCNRITEM pci;
|
---|
[551] | 2453 | HWND menuHwnd = (HWND) 0;
|
---|
[2] | 2454 |
|
---|
[194] | 2455 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
[444] | 2456 | if (pci && (INT) pci != -1) {
|
---|
[551] | 2457 | if (pci->attrFile & FILE_DIRECTORY)
|
---|
[872] | 2458 | menuHwnd = CheckMenu(hwnd, &CollectorDirMenu, COLLECTORDIR_POPUP);
|
---|
[194] | 2459 | else
|
---|
[872] | 2460 | menuHwnd = CheckMenu(hwnd, &CollectorFileMenu, COLLECTORFILE_POPUP);
|
---|
[2] | 2461 | }
|
---|
[194] | 2462 | return MRFROMLONG(menuHwnd);
|
---|
| 2463 | }
|
---|
[2] | 2464 |
|
---|
[194] | 2465 | case WM_CONTROL:
|
---|
| 2466 | DosError(FERR_DISABLEHARDERR);
|
---|
[444] | 2467 | if (dcd) {
|
---|
| 2468 | switch (SHORT2FROMMP(mp1)) {
|
---|
[194] | 2469 | case CN_CONTEXTMENU:
|
---|
| 2470 | {
|
---|
| 2471 | PCNRITEM pci = (PCNRITEM) mp2;
|
---|
[2] | 2472 |
|
---|
[444] | 2473 | if (pci) {
|
---|
[194] | 2474 | WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
| 2475 | MPFROM2SHORT(TRUE, CRA_CURSORED));
|
---|
| 2476 | MarkAll(hwnd, FALSE, FALSE, TRUE);
|
---|
[551] | 2477 | if (pci->attrFile & FILE_DIRECTORY)
|
---|
[872] | 2478 | dcd->hwndLastMenu = CheckMenu(hwnd, &CollectorDirMenu,
|
---|
[551] | 2479 | COLLECTORDIR_POPUP);
|
---|
[194] | 2480 | else
|
---|
[872] | 2481 | dcd->hwndLastMenu = CheckMenu(hwnd, &CollectorFileMenu,
|
---|
[551] | 2482 | COLLECTORFILE_POPUP);
|
---|
[194] | 2483 | }
|
---|
[444] | 2484 | else {
|
---|
[872] | 2485 | dcd->hwndLastMenu = CheckMenu(hwnd, &CollectorCnrMenu,
|
---|
[551] | 2486 | COLLECTORCNR_POPUP);
|
---|
| 2487 | if (dcd->hwndLastMenu && !dcd->cnremphasized) {
|
---|
[194] | 2488 | WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
|
---|
| 2489 | MPFROM2SHORT(TRUE, CRA_SOURCE));
|
---|
[551] | 2490 | dcd->cnremphasized = TRUE;
|
---|
[194] | 2491 | }
|
---|
| 2492 | }
|
---|
[551] | 2493 | if (dcd->hwndLastMenu) {
|
---|
| 2494 | if (dcd->hwndLastMenu == CollectorCnrMenu) {
|
---|
| 2495 | SetViewMenu(dcd->hwndLastMenu, dcd->flWindowAttr);
|
---|
[1065] | 2496 | SetDetailsSwitches(dcd->hwndLastMenu, &dcd->ds);
|
---|
[907] | 2497 | CopyPresParams(dcd->hwndLastMenu, hwnd);
|
---|
[551] | 2498 | if (dcd->flWindowAttr & CV_MINI)
|
---|
| 2499 | WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE);
|
---|
| 2500 | disable_menuitem(dcd->hwndLastMenu, DID_CANCEL,
|
---|
| 2501 | !dcd->amextracted);
|
---|
| 2502 | disable_menuitem(dcd->hwndLastMenu, IDM_GREP, dcd->amextracted);
|
---|
[194] | 2503 | }
|
---|
[551] | 2504 | if (!PopupMenu(hwnd, hwnd, dcd->hwndLastMenu)) {
|
---|
| 2505 | if (dcd->cnremphasized) {
|
---|
[194] | 2506 | WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
|
---|
| 2507 | MPFROM2SHORT(FALSE, CRA_SOURCE));
|
---|
[551] | 2508 | dcd->cnremphasized = TRUE;
|
---|
[194] | 2509 | }
|
---|
| 2510 | MarkAll(hwnd, TRUE, FALSE, TRUE);
|
---|
| 2511 | }
|
---|
| 2512 | }
|
---|
| 2513 | }
|
---|
| 2514 | break;
|
---|
[2] | 2515 |
|
---|
[194] | 2516 | case CN_DROPHELP:
|
---|
[444] | 2517 | if (mp2) {
|
---|
[194] | 2518 | PDRAGINFO pDInfo;
|
---|
| 2519 | PCNRITEM pci;
|
---|
| 2520 | ULONG numitems;
|
---|
| 2521 | USHORT usOperation;
|
---|
[2] | 2522 |
|
---|
[551] | 2523 | pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
|
---|
| 2524 | pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
|
---|
[444] | 2525 | if (!DrgAccessDraginfo(pDInfo)) {
|
---|
[352] | 2526 | Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
|
---|
[1402] | 2527 | PCSZ_DRGACCESSDRAGINFO);
|
---|
[618] | 2528 | return 0;
|
---|
[194] | 2529 | }
|
---|
| 2530 | numitems = DrgQueryDragitemCount(pDInfo);
|
---|
[551] | 2531 | usOperation = pDInfo->usOperation;
|
---|
[1394] | 2532 | if (usOperation == DO_DEFAULT)
|
---|
| 2533 | usOperation = fCopyDefault ? DO_COPY : DO_MOVE;
|
---|
[618] | 2534 | FreeDragInfoData(hwnd, pDInfo);
|
---|
[194] | 2535 | saymsg(MB_ENTER | MB_ICONASTERISK,
|
---|
| 2536 | hwnd,
|
---|
| 2537 | GetPString(IDS_DROPHELPHDRTEXT),
|
---|
| 2538 | GetPString(IDS_DROPHELPTEXT),
|
---|
| 2539 | numitems,
|
---|
[750] | 2540 | &"s"[numitems == 1],
|
---|
[194] | 2541 | (pci) ? NullStr : GetPString(IDS_NOTEXT),
|
---|
| 2542 | (pci) ? NullStr : " ",
|
---|
[730] | 2543 | (pci) ? pci->pszFileName : NullStr,
|
---|
[194] | 2544 | (pci) ? " " : NullStr,
|
---|
| 2545 | GetPString((usOperation == DO_COPY) ?
|
---|
| 2546 | IDS_COPYTEXT :
|
---|
| 2547 | (usOperation == DO_LINK) ?
|
---|
| 2548 | IDS_LINKTEXT : IDS_MOVETEXT));
|
---|
| 2549 | }
|
---|
| 2550 | return 0;
|
---|
[2] | 2551 |
|
---|
[194] | 2552 | case CN_DRAGLEAVE:
|
---|
[444] | 2553 | if (mp2) {
|
---|
[194] | 2554 | PDRAGINFO pDInfo;
|
---|
[2] | 2555 |
|
---|
[618] | 2556 | // fixme to know why needed
|
---|
[551] | 2557 | pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
|
---|
[1673] | 2558 | DrgAccessDraginfo(pDInfo); // Access DRAGINFO
|
---|
| 2559 | DrgFreeDraginfo(pDInfo); // Free DRAGINFO
|
---|
[194] | 2560 | }
|
---|
| 2561 | return 0;
|
---|
[2] | 2562 |
|
---|
[194] | 2563 | case CN_DRAGAFTER:
|
---|
| 2564 | case CN_DRAGOVER:
|
---|
[444] | 2565 | if (mp2) {
|
---|
[1673] | 2566 | PDRAGITEM pDItem; // Pointer to DRAGITEM
|
---|
| 2567 | PDRAGINFO pDInfo; // Pointer to DRAGINFO
|
---|
[194] | 2568 | PCNRITEM pci;
|
---|
| 2569 | USHORT uso;
|
---|
[2] | 2570 |
|
---|
[551] | 2571 | pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
|
---|
[618] | 2572 | // if(SHORT1FROMMP(mp1) == CN_DRAGAFTER)
|
---|
| 2573 | // pci = NULL;
|
---|
[551] | 2574 | pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
|
---|
[618] | 2575 | if (!DrgAccessDraginfo(pDInfo)) {
|
---|
| 2576 | Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
|
---|
[1402] | 2577 | PCSZ_DRGACCESSDRAGINFO);
|
---|
[1673] | 2578 | return (MRFROM2SHORT(DOR_NODROP, 0)); // Drop not valid
|
---|
[618] | 2579 | }
|
---|
[444] | 2580 | if (pci) {
|
---|
[551] | 2581 | if (pci->rc.flRecordAttr & CRA_SOURCE) {
|
---|
[194] | 2582 | DrgFreeDraginfo(pDInfo);
|
---|
| 2583 | return (MRFROM2SHORT(DOR_NODROP, 0));
|
---|
| 2584 | }
|
---|
[551] | 2585 | uso = pDInfo->usOperation;
|
---|
[194] | 2586 | if (uso == DO_DEFAULT)
|
---|
| 2587 | uso = (fCopyDefault) ? DO_COPY : DO_MOVE;
|
---|
[551] | 2588 | if (!(pci->attrFile & FILE_DIRECTORY)) {
|
---|
| 2589 | if (uso != DO_LINK && uso != DO_MOVE && uso != DO_COPY) {
|
---|
[194] | 2590 | DrgFreeDraginfo(pDInfo);
|
---|
| 2591 | return MRFROM2SHORT(DOR_NODROP, 0);
|
---|
| 2592 | }
|
---|
| 2593 | if (uso != DO_LINK &&
|
---|
[730] | 2594 | !(driveflags[toupper(*pci->pszFileName) - 'A'] &
|
---|
[551] | 2595 | DRIVE_NOTWRITEABLE)) {
|
---|
[194] | 2596 | ARC_TYPE *info = NULL;
|
---|
[2] | 2597 |
|
---|
[194] | 2598 | if (!fQuickArcFind &&
|
---|
[730] | 2599 | !(driveflags[toupper(*pci->pszFileName) - 'A'] &
|
---|
[194] | 2600 | DRIVE_SLOW))
|
---|
[730] | 2601 | info = find_type(pci->pszFileName, NULL);
|
---|
[194] | 2602 | else
|
---|
[730] | 2603 | info = quick_find_type(pci->pszFileName, NULL);
|
---|
[551] | 2604 | if (!info || ((uso == DO_MOVE && !info->move) ||
|
---|
| 2605 | (uso == DO_COPY && !info->create))) {
|
---|
[194] | 2606 | DrgFreeDraginfo(pDInfo);
|
---|
| 2607 | return MRFROM2SHORT(DOR_NODROP, 0);
|
---|
| 2608 | }
|
---|
| 2609 | }
|
---|
| 2610 | }
|
---|
| 2611 | }
|
---|
[1673] | 2612 | pDItem = DrgQueryDragitemPtr(pDInfo, // Access DRAGITEM
|
---|
| 2613 | 0); // Index to DRAGITEM
|
---|
| 2614 | if (DrgVerifyRMF(pDItem, // Check valid rendering
|
---|
| 2615 | (CHAR *) DRM_OS2FILE, // mechanisms and data
|
---|
[551] | 2616 | NULL)) {
|
---|
[1673] | 2617 | DrgFreeDraginfo(pDInfo); // Free DRAGINFO
|
---|
[444] | 2618 | if (pci) {
|
---|
[730] | 2619 | if (driveflags[toupper(*pci->pszFileName) - 'A'] &
|
---|
[194] | 2620 | DRIVE_NOTWRITEABLE)
|
---|
| 2621 | return MRFROM2SHORT(DOR_DROP, DO_LINK);
|
---|
[730] | 2622 | if (toupper(*pci->pszFileName) < 'C')
|
---|
[194] | 2623 | return MRFROM2SHORT(DOR_DROP, DO_COPY);
|
---|
[1673] | 2624 | return MRFROM2SHORT(DOR_DROP, // Return okay to drop
|
---|
[551] | 2625 | ((fCopyDefault) ? DO_COPY : DO_MOVE));
|
---|
[194] | 2626 | }
|
---|
| 2627 | else
|
---|
[1673] | 2628 | return MRFROM2SHORT(DOR_DROP, // Return okay to drop
|
---|
[194] | 2629 | DO_COPY);
|
---|
| 2630 | }
|
---|
[1673] | 2631 | DrgFreeDraginfo(pDInfo); // Free DRAGINFO
|
---|
[194] | 2632 | }
|
---|
[1673] | 2633 | return (MRFROM2SHORT(DOR_NODROP, 0)); // Drop not valid
|
---|
[2] | 2634 |
|
---|
[194] | 2635 | case CN_INITDRAG:
|
---|
[444] | 2636 | if (mp2) {
|
---|
[194] | 2637 | BOOL wasemphasized = FALSE;
|
---|
| 2638 | PCNRDRAGINIT pcd = (PCNRDRAGINIT) mp2;
|
---|
| 2639 | PCNRITEM pci;
|
---|
[2] | 2640 |
|
---|
[444] | 2641 | if (pcd) {
|
---|
[551] | 2642 | pci = (PCNRITEM) pcd->pRecord;
|
---|
[444] | 2643 | if (pci) {
|
---|
[551] | 2644 | if (pci->rc.flRecordAttr & CRA_SELECTED)
|
---|
[194] | 2645 | wasemphasized = TRUE;
|
---|
[730] | 2646 | if (IsRoot(pci->pszFileName))
|
---|
[194] | 2647 | break;
|
---|
| 2648 | if (hwndStatus2)
|
---|
[551] | 2649 | WinSetWindowText(hwndStatus2,
|
---|
[1498] | 2650 | (CHAR *) GetPString(IDS_DRAGFILEOBJTEXT));
|
---|
[551] | 2651 | if (DoFileDrag(hwnd, dcd->hwndObject, mp2, NULL, NULL, TRUE)) {
|
---|
[672] | 2652 | if ((fUnHilite && wasemphasized) || dcd->ulItemsToUnHilite)
|
---|
| 2653 | UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
|
---|
[194] | 2654 | }
|
---|
| 2655 | if (hwndStatus2)
|
---|
| 2656 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
| 2657 | }
|
---|
| 2658 | }
|
---|
| 2659 | }
|
---|
| 2660 | return 0;
|
---|
[2] | 2661 |
|
---|
[194] | 2662 | case CN_DROP:
|
---|
[444] | 2663 | if (mp2) {
|
---|
[194] | 2664 | LISTINFO *li;
|
---|
| 2665 | ULONG action = UM_ACTION;
|
---|
[2] | 2666 |
|
---|
[724] | 2667 | li = DoFileDrop(hwnd, NULL, TRUE, mp1, mp2);
|
---|
| 2668 | CheckPmDrgLimit(((PCNRDRAGINFO)mp2)->pDragInfo);
|
---|
[444] | 2669 | if (li) {
|
---|
[551] | 2670 | if (!*li->targetpath) {
|
---|
| 2671 | li->type = IDM_COLLECT;
|
---|
[194] | 2672 | action = UM_COLLECT;
|
---|
| 2673 | }
|
---|
[444] | 2674 | else {
|
---|
[551] | 2675 | if (li->list && li->list[0] && IsRoot(li->list[0]))
|
---|
| 2676 | li->type = DO_LINK;
|
---|
| 2677 | else if (fDragndropDlg && (!*li->arcname || !li->info)) {
|
---|
[194] | 2678 | CHECKLIST cl;
|
---|
[2] | 2679 |
|
---|
[194] | 2680 | memset(&cl, 0, sizeof(cl));
|
---|
| 2681 | cl.size = sizeof(cl);
|
---|
[551] | 2682 | cl.flags = li->type;
|
---|
| 2683 | cl.list = li->list;
|
---|
| 2684 | cl.cmd = li->type;
|
---|
| 2685 | cl.prompt = li->targetpath;
|
---|
| 2686 | li->type = WinDlgBox(HWND_DESKTOP, dcd->hwndParent,
|
---|
| 2687 | DropListProc, FM3ModHandle,
|
---|
[618] | 2688 | DND_FRAME, MPFROMP(&cl));
|
---|
| 2689 | if (li->type == DID_ERROR)
|
---|
| 2690 | Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
[1402] | 2691 | GetPString(IDS_DRAGDROPDIALOGTEXT));
|
---|
[618] | 2692 | if (!li->type) {
|
---|
[194] | 2693 | FreeListInfo(li);
|
---|
| 2694 | return 0;
|
---|
| 2695 | }
|
---|
[551] | 2696 | li->list = cl.list;
|
---|
[618] | 2697 | if (!li->list || !li->list[0]) {
|
---|
[194] | 2698 | FreeListInfo(li);
|
---|
| 2699 | return 0;
|
---|
| 2700 | }
|
---|
| 2701 | }
|
---|
[551] | 2702 | switch (li->type) {
|
---|
[194] | 2703 | case DND_LAUNCH:
|
---|
[551] | 2704 | strcat(li->targetpath, " %a");
|
---|
| 2705 | ExecOnList(dcd->hwndParent, li->targetpath,
|
---|
[1497] | 2706 | PROMPT | WINDOWED, NULL, NULL, li->list, NULL,
|
---|
[907] | 2707 | pszSrcFile, __LINE__);
|
---|
[551] | 2708 | FreeList(li->list);
|
---|
| 2709 | li->list = NULL;
|
---|
[194] | 2710 | break;
|
---|
| 2711 | case DO_LINK:
|
---|
[444] | 2712 | if (fLinkSetsIcon) {
|
---|
[551] | 2713 | li->type = IDM_SETICON;
|
---|
[194] | 2714 | action = UM_MASSACTION;
|
---|
| 2715 | }
|
---|
| 2716 | else
|
---|
[551] | 2717 | li->type = IDM_COMPARE;
|
---|
[194] | 2718 | break;
|
---|
| 2719 | case DND_EXTRACT:
|
---|
[551] | 2720 | if (*li->targetpath && !IsFile(li->targetpath))
|
---|
| 2721 | li->type = IDM_EXTRACT;
|
---|
[194] | 2722 | break;
|
---|
| 2723 | case DND_MOVE:
|
---|
[551] | 2724 | li->type = IDM_MOVE;
|
---|
| 2725 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
[194] | 2726 | action = UM_MASSACTION;
|
---|
[551] | 2727 | li->type = IDM_ARCHIVEM;
|
---|
[194] | 2728 | }
|
---|
| 2729 | break;
|
---|
| 2730 | case DND_WILDMOVE:
|
---|
[551] | 2731 | li->type = IDM_WILDMOVE;
|
---|
| 2732 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
[194] | 2733 | action = UM_MASSACTION;
|
---|
[551] | 2734 | li->type = IDM_ARCHIVEM;
|
---|
[194] | 2735 | }
|
---|
| 2736 | break;
|
---|
| 2737 | case DND_OBJECT:
|
---|
[551] | 2738 | li->type = IDM_OBJECT;
|
---|
[194] | 2739 | action = UM_MASSACTION;
|
---|
| 2740 | break;
|
---|
| 2741 | case DND_SHADOW:
|
---|
[551] | 2742 | li->type = IDM_SHADOW;
|
---|
[194] | 2743 | action = UM_MASSACTION;
|
---|
| 2744 | break;
|
---|
| 2745 | case DND_COMPARE:
|
---|
[551] | 2746 | li->type = IDM_COMPARE;
|
---|
[194] | 2747 | break;
|
---|
| 2748 | case DND_SETICON:
|
---|
| 2749 | action = UM_MASSACTION;
|
---|
[551] | 2750 | li->type = IDM_SETICON;
|
---|
[194] | 2751 | break;
|
---|
| 2752 | case DND_WILDCOPY:
|
---|
[551] | 2753 | li->type = IDM_WILDCOPY;
|
---|
| 2754 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
[194] | 2755 | action = UM_MASSACTION;
|
---|
[551] | 2756 | li->type = IDM_ARCHIVE;
|
---|
[194] | 2757 | }
|
---|
| 2758 | break;
|
---|
| 2759 | case DND_COPY:
|
---|
[551] | 2760 | li->type = IDM_COPY;
|
---|
| 2761 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
[194] | 2762 | action = UM_MASSACTION;
|
---|
[551] | 2763 | li->type = IDM_ARCHIVE;
|
---|
[194] | 2764 | }
|
---|
| 2765 | break;
|
---|
| 2766 | default:
|
---|
[551] | 2767 | if (*li->arcname && li->info) {
|
---|
[194] | 2768 | action = UM_MASSACTION;
|
---|
[551] | 2769 | li->type =
|
---|
| 2770 | (li->type ==
|
---|
| 2771 | DO_MOVE) ? IDM_FAKEEXTRACTM : IDM_FAKEEXTRACT;
|
---|
[194] | 2772 | }
|
---|
[551] | 2773 | else if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
[194] | 2774 | action = UM_MASSACTION;
|
---|
[551] | 2775 | li->type =
|
---|
| 2776 | (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
|
---|
[194] | 2777 | }
|
---|
| 2778 | else
|
---|
[551] | 2779 | li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
|
---|
[194] | 2780 | break;
|
---|
[1611] | 2781 | } // switch
|
---|
| 2782 | } // if !collect
|
---|
[551] | 2783 | if (!li->list || !li->list[0])
|
---|
[194] | 2784 | FreeListInfo(li);
|
---|
[551] | 2785 | else if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID))
|
---|
[194] | 2786 | FreeListInfo(li);
|
---|
[444] | 2787 | else {
|
---|
[194] | 2788 | USHORT usop = 0;
|
---|
[2] | 2789 |
|
---|
[551] | 2790 | switch (li->type) {
|
---|
[194] | 2791 | case IDM_COPY:
|
---|
| 2792 | case IDM_WILDCOPY:
|
---|
| 2793 | usop = DO_COPY;
|
---|
| 2794 | break;
|
---|
| 2795 | case IDM_MOVE:
|
---|
| 2796 | case IDM_WILDMOVE:
|
---|
| 2797 | case IDM_ARCHIVEM:
|
---|
| 2798 | usop = DO_MOVE;
|
---|
| 2799 | break;
|
---|
| 2800 | }
|
---|
| 2801 | if (usop)
|
---|
| 2802 | return MRFROM2SHORT(DOR_DROP, usop);
|
---|
| 2803 | }
|
---|
| 2804 | }
|
---|
| 2805 | }
|
---|
| 2806 | return 0;
|
---|
[2] | 2807 |
|
---|
[194] | 2808 | case CN_BEGINEDIT:
|
---|
| 2809 | case CN_REALLOCPSZ:
|
---|
| 2810 | case CN_ENDEDIT:
|
---|
| 2811 | {
|
---|
| 2812 | MRESULT mre;
|
---|
[2] | 2813 |
|
---|
[194] | 2814 | mre = CnrDirectEdit(hwnd, msg, mp1, mp2);
|
---|
| 2815 | if (mre != (MRESULT) - 1)
|
---|
| 2816 | return mre;
|
---|
| 2817 | }
|
---|
| 2818 | break;
|
---|
[2] | 2819 |
|
---|
[194] | 2820 | case CN_EMPHASIS:
|
---|
[444] | 2821 | if (mp2) {
|
---|
[194] | 2822 | PNOTIFYRECORDEMPHASIS pre = mp2;
|
---|
| 2823 | PCNRITEM pci;
|
---|
[1397] | 2824 | CHAR s[CCHMAXPATH + 91], tb[81], tf[81], szDate[DATE_BUF_BYTES], *p;
|
---|
[2] | 2825 |
|
---|
[551] | 2826 | pci = (PCNRITEM) ((pre) ? pre->pRecord : NULL);
|
---|
[444] | 2827 | if (!pci) {
|
---|
[194] | 2828 | if (hwndStatus2)
|
---|
| 2829 | WinSetWindowText(hwndStatus2, NullStr);
|
---|
[444] | 2830 | if (fMoreButtons) {
|
---|
[194] | 2831 | WinSetWindowText(hwndName, NullStr);
|
---|
| 2832 | WinSetWindowText(hwndDate, NullStr);
|
---|
| 2833 | WinSetWindowText(hwndAttr, NullStr);
|
---|
| 2834 | }
|
---|
| 2835 | if (hwndMain)
|
---|
| 2836 | WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
|
---|
| 2837 | break;
|
---|
| 2838 | }
|
---|
[551] | 2839 | if (pre->fEmphasisMask & CRA_SELECTED) {
|
---|
| 2840 | if (pci->rc.flRecordAttr & CRA_SELECTED) {
|
---|
| 2841 | dcd->selectedbytes += (pci->cbFile + pci->easize);
|
---|
| 2842 | dcd->selectedfiles++;
|
---|
[194] | 2843 | }
|
---|
[551] | 2844 | else if (dcd->selectedfiles) {
|
---|
| 2845 | dcd->selectedbytes -= (pci->cbFile + pci->easize);
|
---|
| 2846 | dcd->selectedfiles--;
|
---|
[194] | 2847 | }
|
---|
[551] | 2848 | if (!dcd->suspendview) {
|
---|
| 2849 | commafmt(tf, sizeof(tf), dcd->selectedfiles);
|
---|
| 2850 | CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, ' ');
|
---|
[194] | 2851 | sprintf(s, "%s / %s", tf, tb);
|
---|
[551] | 2852 | WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
|
---|
[194] | 2853 | }
|
---|
| 2854 | }
|
---|
[551] | 2855 | if (!dcd->suspendview &&
|
---|
| 2856 | WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame) {
|
---|
| 2857 | if (pre->fEmphasisMask & CRA_CURSORED) {
|
---|
| 2858 | if (pci->rc.flRecordAttr & CRA_CURSORED) {
|
---|
[444] | 2859 | if (fSplitStatus && hwndStatus2) {
|
---|
[551] | 2860 | if (pci->attrFile & FILE_DIRECTORY)
|
---|
| 2861 | p = pci->pszFileName;
|
---|
[444] | 2862 | else {
|
---|
[730] | 2863 | p = strrchr(pci->pszFileName, '\\');
|
---|
[444] | 2864 | if (p) {
|
---|
[194] | 2865 | if (*(p + 1))
|
---|
| 2866 | p++;
|
---|
| 2867 | else
|
---|
[551] | 2868 | p = pci->pszFileName;
|
---|
[194] | 2869 | }
|
---|
| 2870 | else
|
---|
[551] | 2871 | p = pci->pszFileName;
|
---|
[194] | 2872 | }
|
---|
[551] | 2873 | CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
|
---|
[1456] | 2874 | if (!fMoreButtons) {
|
---|
| 2875 | DateFormat(szDate, pci->date);
|
---|
[1395] | 2876 | sprintf(s, " %s %s %02u%s%02u%s%02u [%s] %s",
|
---|
| 2877 | tb, szDate, pci->time.hours, TimeSeparator,
|
---|
| 2878 | pci->time.minutes, TimeSeparator, pci->time.seconds,
|
---|
[1456] | 2879 | pci->pszDispAttr, p);
|
---|
| 2880 | }
|
---|
[444] | 2881 | else {
|
---|
[551] | 2882 | if (pci->cbFile + pci->easize > 1024)
|
---|
| 2883 | CommaFmtULL(tf, sizeof(tf), pci->cbFile + pci->easize,
|
---|
| 2884 | ' ');
|
---|
[194] | 2885 | else
|
---|
| 2886 | *tf = 0;
|
---|
| 2887 | sprintf(s, GetPString(IDS_STATUSSIZETEXT),
|
---|
| 2888 | tb,
|
---|
[551] | 2889 | *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
|
---|
[194] | 2890 | }
|
---|
| 2891 | WinSetWindowText(hwndStatus2, s);
|
---|
| 2892 | }
|
---|
[444] | 2893 | if (fMoreButtons) {
|
---|
[1456] | 2894 | WinSetWindowText(hwndName, pci->pszFileName);
|
---|
| 2895 | DateFormat(szDate, pci->date);
|
---|
[1395] | 2896 | sprintf(s, "%s %02u%s%02u%s%02u",
|
---|
| 2897 | szDate, pci->time.hours, TimeSeparator, pci->time.minutes,
|
---|
| 2898 | TimeSeparator, pci->time.seconds);
|
---|
[194] | 2899 | WinSetWindowText(hwndDate, s);
|
---|
[551] | 2900 | WinSetWindowText(hwndAttr, pci->pszDispAttr);
|
---|
[194] | 2901 | }
|
---|
| 2902 | }
|
---|
| 2903 | }
|
---|
| 2904 | }
|
---|
[551] | 2905 | if (!dcd->suspendview && hwndMain &&
|
---|
| 2906 | (pre->fEmphasisMask & CRA_CURSORED) &&
|
---|
| 2907 | (pci->rc.flRecordAttr & CRA_CURSORED) &&
|
---|
| 2908 | WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame)
|
---|
[194] | 2909 | WinSendMsg(hwndMain, UM_LOADFILE,
|
---|
[551] | 2910 | MPFROMP(((fComments
|
---|
| 2911 | || (pci->attrFile & FILE_DIRECTORY) ==
|
---|
[730] | 2912 | 0) ? pci->pszFileName : NULL)), MPVOID);
|
---|
[194] | 2913 | }
|
---|
| 2914 | break;
|
---|
[2] | 2915 |
|
---|
[194] | 2916 | case CN_ENTER:
|
---|
[444] | 2917 | if (mp2) {
|
---|
[551] | 2918 | PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
|
---|
[847] | 2919 | FILEFINDBUF3 ffb;
|
---|
[194] | 2920 | HDIR hDir = HDIR_CREATE;
|
---|
[750] | 2921 | ULONG nm = 1;
|
---|
[194] | 2922 | APIRET status = 0;
|
---|
[2] | 2923 |
|
---|
[194] | 2924 | SetShiftState();
|
---|
[444] | 2925 | if (pci) {
|
---|
[551] | 2926 | if (pci->rc.flRecordAttr & CRA_INUSE)
|
---|
[194] | 2927 | break;
|
---|
| 2928 | DosError(FERR_DISABLEHARDERR);
|
---|
[847] | 2929 | status = DosFindFirst(pci->pszFileName, &hDir,
|
---|
[907] | 2930 | FILE_NORMAL | FILE_DIRECTORY |
|
---|
[838] | 2931 | FILE_ARCHIVED | FILE_READONLY |
|
---|
| 2932 | FILE_HIDDEN | FILE_SYSTEM,
|
---|
[847] | 2933 | &ffb, sizeof(ffb), &nm, FIL_STANDARD);
|
---|
[194] | 2934 | priority_bumped();
|
---|
[444] | 2935 | if (!status) {
|
---|
[194] | 2936 | DosFindClose(hDir);
|
---|
[444] | 2937 | if (ffb.attrFile & FILE_DIRECTORY) {
|
---|
[551] | 2938 | if ((shiftstate & (KC_CTRL | KC_ALT)) == (KC_CTRL | KC_ALT))
|
---|
[194] | 2939 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SHOWALLFILES, 0),
|
---|
| 2940 | MPVOID);
|
---|
| 2941 | else if ((shiftstate & (KC_CTRL | KC_SHIFT)) ==
|
---|
| 2942 | (KC_CTRL | KC_SHIFT))
|
---|
[730] | 2943 | OpenObject(pci->pszFileName, Settings, dcd->hwndFrame);
|
---|
[194] | 2944 | else if (shiftstate & KC_CTRL)
|
---|
[730] | 2945 | OpenObject(pci->pszFileName, Default, dcd->hwndFrame);
|
---|
[194] | 2946 | else
|
---|
[280] | 2947 | OpenDirCnr(HWND_DESKTOP,
|
---|
[194] | 2948 | hwndMain,
|
---|
[730] | 2949 | dcd->hwndFrame, FALSE, pci->pszFileName);
|
---|
[194] | 2950 | }
|
---|
[444] | 2951 | else {
|
---|
[194] | 2952 | SWP swp;
|
---|
[2] | 2953 |
|
---|
[194] | 2954 | WinSendMsg(hwnd,
|
---|
| 2955 | CM_SETRECORDEMPHASIS,
|
---|
[551] | 2956 | MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_INUSE));
|
---|
| 2957 | WinQueryWindowPos(dcd->hwndFrame, &swp);
|
---|
[194] | 2958 | DefaultViewKeys(hwnd,
|
---|
[551] | 2959 | dcd->hwndFrame,
|
---|
[730] | 2960 | dcd->hwndParent, &swp, pci->pszFileName);
|
---|
[194] | 2961 | WinSendMsg(hwnd,
|
---|
| 2962 | CM_SETRECORDEMPHASIS,
|
---|
| 2963 | MPFROMP(pci),
|
---|
| 2964 | MPFROM2SHORT(FALSE, CRA_INUSE |
|
---|
| 2965 | ((fUnHilite) ? CRA_SELECTED : 0)));
|
---|
| 2966 | }
|
---|
| 2967 | }
|
---|
| 2968 | else
|
---|
[751] | 2969 | RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
|
---|
[194] | 2970 | }
|
---|
| 2971 | }
|
---|
| 2972 | break;
|
---|
[2] | 2973 | }
|
---|
[194] | 2974 | }
|
---|
| 2975 | return 0;
|
---|
[2] | 2976 |
|
---|
[194] | 2977 | case UM_LOADFILE:
|
---|
[444] | 2978 | if (dcd && mp2) {
|
---|
[2] | 2979 |
|
---|
[1037] | 2980 | HWND hwnd;
|
---|
| 2981 |
|
---|
| 2982 | if ((INT)mp1 == 5 || (INT)mp1 == 13 || (INT)mp1 == 21)
|
---|
[1077] | 2983 | hwnd = StartViewer(HWND_DESKTOP, (INT)mp1,
|
---|
| 2984 | (CHAR *)mp2, dcd->hwndFrame);
|
---|
[1037] | 2985 | else
|
---|
[1077] | 2986 | hwnd = StartMLEEditor(dcd->hwndParent,
|
---|
| 2987 | (INT)mp1, (CHAR *)mp2, dcd->hwndFrame);
|
---|
[1039] | 2988 | free((CHAR *)mp2);
|
---|
[1037] | 2989 | return MRFROMLONG(hwnd);
|
---|
[194] | 2990 | }
|
---|
| 2991 | return 0;
|
---|
[2] | 2992 |
|
---|
[194] | 2993 | case UM_CLOSE:
|
---|
| 2994 | WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 2995 | QW_PARENT));
|
---|
| 2996 | return 0;
|
---|
[2] | 2997 |
|
---|
[194] | 2998 | case UM_FOLDUP:
|
---|
[551] | 2999 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
[194] | 3000 | DosExit(EXIT_PROCESS, 1);
|
---|
| 3001 | return 0;
|
---|
[2] | 3002 |
|
---|
[194] | 3003 | case WM_CLOSE:
|
---|
[444] | 3004 | if (dcd) {
|
---|
[551] | 3005 | dcd->namecanchange = TRUE;
|
---|
| 3006 | dcd->stopflag = 1;
|
---|
| 3007 | if (dcd->amextracted)
|
---|
| 3008 | return 0; // Can not close yet
|
---|
[194] | 3009 | }
|
---|
| 3010 | WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
---|
[444] | 3011 | if (dcd) {
|
---|
[551] | 3012 | if (!dcd->dontclose && ParentIsDesktop(hwnd, dcd->hwndParent))
|
---|
[194] | 3013 | PostMsg(hwnd, UM_FOLDUP, MPVOID, MPVOID);
|
---|
[551] | 3014 | if (dcd->hwndObject) {
|
---|
[942] | 3015 | DosSleep(32); // Allow UM_FOLDUP to process
|
---|
[551] | 3016 | if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
|
---|
| 3017 | WinSendMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID);
|
---|
[2] | 3018 | }
|
---|
[194] | 3019 | }
|
---|
| 3020 | else
|
---|
| 3021 | WinSendMsg(hwnd, UM_CLOSE, MPVOID, MPVOID);
|
---|
| 3022 | return 0;
|
---|
[2] | 3023 |
|
---|
[194] | 3024 | case WM_DESTROY:
|
---|
| 3025 | if (CollectorDirMenu)
|
---|
| 3026 | WinDestroyWindow(CollectorDirMenu);
|
---|
| 3027 | if (CollectorFileMenu)
|
---|
| 3028 | WinDestroyWindow(CollectorFileMenu);
|
---|
| 3029 | if (CollectorCnrMenu)
|
---|
| 3030 | WinDestroyWindow(CollectorCnrMenu);
|
---|
[551] | 3031 | CollectorCnrMenu = CollectorFileMenu = CollectorDirMenu = (HWND) 0;
|
---|
| 3032 | Collector = (HWND) 0;
|
---|
[194] | 3033 | EmptyCnr(hwnd);
|
---|
| 3034 | break;
|
---|
[2] | 3035 | }
|
---|
[705] | 3036 | if (dcd && dcd->oldproc){
|
---|
| 3037 | return dcd->oldproc(hwnd, msg, mp1, mp2);
|
---|
| 3038 | }
|
---|
| 3039 | else
|
---|
| 3040 | return PFNWPCnr(hwnd, msg, mp1, mp2);
|
---|
[2] | 3041 | }
|
---|
| 3042 |
|
---|
[942] | 3043 | MRESULT EXPENTRY CollectorMenuProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
| 3044 | MPARAM mp2)
|
---|
| 3045 | {
|
---|
| 3046 | PFNWP oldMenuProc = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
[1077] | 3047 | static short sLastMenuitem;
|
---|
[942] | 3048 |
|
---|
| 3049 | switch (msg) {
|
---|
| 3050 | case WM_MOUSEMOVE: {
|
---|
| 3051 | if (fOtherHelp) {
|
---|
[948] | 3052 | RECTL rectl;
|
---|
| 3053 | SHORT i, sCurrentMenuitem;
|
---|
| 3054 | SHORT MenuItems = 5;
|
---|
| 3055 | SHORT asMenuIDs[5] = {IDM_GREP,
|
---|
| 3056 | IDM_SEEALL,
|
---|
| 3057 | IDM_CLEARCNR,
|
---|
| 3058 | IDM_REMOVE,
|
---|
| 3059 | 0};
|
---|
[1394] | 3060 | PCSZ szHelpString = NULL;
|
---|
[942] | 3061 |
|
---|
[948] | 3062 | for (i=0; i<MenuItems; i++) {
|
---|
| 3063 | sCurrentMenuitem = asMenuIDs[i];
|
---|
| 3064 | oldMenuProc(hwnd,MM_QUERYITEMRECT,
|
---|
| 3065 | MPFROM2SHORT(asMenuIDs[i], FALSE),
|
---|
| 3066 | &rectl);
|
---|
[942] | 3067 |
|
---|
[948] | 3068 | if (MOUSEMSG(&msg)->x > rectl.xLeft &&
|
---|
| 3069 | MOUSEMSG(&msg)->x < rectl.xRight &&
|
---|
| 3070 | MOUSEMSG(&msg)->y > rectl.yBottom &&
|
---|
| 3071 | MOUSEMSG(&msg)->y < rectl.yTop)
|
---|
| 3072 | break;
|
---|
[1077] | 3073 | } // for
|
---|
[942] | 3074 |
|
---|
[948] | 3075 | switch (sCurrentMenuitem) {
|
---|
| 3076 | case 0:
|
---|
| 3077 | break;
|
---|
| 3078 | case IDM_GREP:
|
---|
| 3079 | szHelpString = GetPString(IDS_COLMENUSEEKSCANHELP);
|
---|
| 3080 | break;
|
---|
| 3081 | case IDM_SEEALL:
|
---|
| 3082 | szHelpString = GetPString(IDS_COLMENUSEEALLHELP);
|
---|
| 3083 | break;
|
---|
| 3084 | case IDM_CLEARCNR:
|
---|
| 3085 | szHelpString = GetPString(IDS_COLMENUCLEARCNRHELP);
|
---|
| 3086 | break;
|
---|
| 3087 | case IDM_REMOVE:
|
---|
| 3088 | szHelpString = GetPString(IDS_COLMENUREMOVECNRHELP);
|
---|
| 3089 | break;
|
---|
| 3090 | default:
|
---|
| 3091 | break;
|
---|
| 3092 | }
|
---|
[942] | 3093 |
|
---|
[948] | 3094 | if (sLastMenuitem != sCurrentMenuitem && szHelpString) {
|
---|
| 3095 | sLastMenuitem = sCurrentMenuitem;
|
---|
| 3096 | MakeBubble(hwnd, TRUE, szHelpString);
|
---|
| 3097 | }
|
---|
| 3098 | else if (hwndBubble && !sCurrentMenuitem){
|
---|
| 3099 | sLastMenuitem = sCurrentMenuitem;
|
---|
| 3100 | WinDestroyWindow(hwndBubble);
|
---|
| 3101 | }
|
---|
[942] | 3102 | }
|
---|
| 3103 | }
|
---|
| 3104 | }
|
---|
| 3105 | return oldMenuProc(hwnd, msg, mp1, mp2);
|
---|
| 3106 | }
|
---|
| 3107 |
|
---|
[194] | 3108 | HWND StartCollector(HWND hwndParent, INT flags)
|
---|
[155] | 3109 | {
|
---|
[551] | 3110 | HWND hwndFrame = (HWND) 0;
|
---|
[197] | 3111 | HWND hwndClient;
|
---|
[194] | 3112 | ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
|
---|
[551] | 3113 | FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_NOBYTEALIGN | FCF_ACCELTABLE;
|
---|
[194] | 3114 | USHORT id;
|
---|
| 3115 | DIRCNRDATA *dcd;
|
---|
[2] | 3116 |
|
---|
[197] | 3117 | static USHORT idinc = 0;
|
---|
| 3118 |
|
---|
[194] | 3119 | if (ParentIsDesktop(hwndParent, hwndParent))
|
---|
[2] | 3120 | FrameFlags |= (FCF_TASKLIST | FCF_SHELLPOSITION | FCF_MENU);
|
---|
[444] | 3121 | if (Collector) {
|
---|
[2] | 3122 | WinSetWindowPos(WinQueryWindow(WinQueryWindow(Collector,
|
---|
[194] | 3123 | QW_PARENT),
|
---|
| 3124 | QW_PARENT),
|
---|
[551] | 3125 | HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE);
|
---|
| 3126 | return WinQueryWindow(WinQueryWindow(Collector, QW_PARENT), QW_PARENT);
|
---|
[2] | 3127 | }
|
---|
| 3128 | hwndFrame = WinCreateStdWindow(hwndParent,
|
---|
[194] | 3129 | WS_VISIBLE,
|
---|
| 3130 | &FrameFlags,
|
---|
[1498] | 3131 | (CHAR *) WC_COLLECTOR,
|
---|
[194] | 3132 | NULL,
|
---|
| 3133 | WS_VISIBLE | fwsAnimate,
|
---|
[551] | 3134 | FM3ModHandle, COLLECTOR_FRAME, &hwndClient);
|
---|
[444] | 3135 | if (hwndFrame && hwndClient) {
|
---|
[2] | 3136 | id = COLLECTOR_FRAME + idinc++;
|
---|
[194] | 3137 | WinSetWindowUShort(hwndFrame, QWS_ID, id);
|
---|
[1063] | 3138 | # ifdef FORTIFY
|
---|
| 3139 | Fortify_EnterScope();
|
---|
[1077] | 3140 | # endif
|
---|
[551] | 3141 | dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__);
|
---|
[377] | 3142 | if (!dcd) {
|
---|
[1398] | 3143 | Runtime_Error(pszSrcFile, __LINE__, NULL);
|
---|
[551] | 3144 | PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 3145 | hwndFrame = (HWND) 0;
|
---|
[377] | 3146 | }
|
---|
| 3147 | else {
|
---|
[551] | 3148 | dcd->size = sizeof(DIRCNRDATA);
|
---|
| 3149 | dcd->id = id;
|
---|
| 3150 | dcd->type = COLLECTOR_FRAME;
|
---|
| 3151 | dcd->hwndParent = (hwndParent) ? hwndParent : HWND_DESKTOP;
|
---|
| 3152 | dcd->hwndFrame = hwndFrame;
|
---|
| 3153 | dcd->hwndClient = hwndClient;
|
---|
[194] | 3154 | if (flags & 4)
|
---|
[551] | 3155 | dcd->dontclose = TRUE;
|
---|
[2] | 3156 | {
|
---|
[194] | 3157 | PFNWP oldproc;
|
---|
[2] | 3158 |
|
---|
[551] | 3159 | oldproc = WinSubclassWindow(hwndFrame, (PFNWP) CollectorFrameWndProc);
|
---|
| 3160 | WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
|
---|
[2] | 3161 | }
|
---|
[551] | 3162 | dcd->hwndCnr = WinCreateWindow(hwndClient,
|
---|
| 3163 | WC_CONTAINER,
|
---|
| 3164 | NULL,
|
---|
| 3165 | CCS_AUTOPOSITION | CCS_MINIICONS |
|
---|
| 3166 | CCS_MINIRECORDCORE | ulCnrType |
|
---|
| 3167 | WS_VISIBLE,
|
---|
| 3168 | 0,
|
---|
| 3169 | 0,
|
---|
| 3170 | 0,
|
---|
| 3171 | 0,
|
---|
| 3172 | hwndClient,
|
---|
| 3173 | HWND_TOP,
|
---|
| 3174 | (ULONG) COLLECTOR_CNR, NULL, NULL);
|
---|
| 3175 | if (!dcd->hwndCnr) {
|
---|
[1395] | 3176 | Win_Error(hwndClient, hwndClient, pszSrcFile, __LINE__,
|
---|
| 3177 | PCSZ_WINCREATEWINDOW);
|
---|
[551] | 3178 | PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
|
---|
[1077] | 3179 | free(dcd);
|
---|
[551] | 3180 | hwndFrame = (HWND) 0;
|
---|
[377] | 3181 | }
|
---|
| 3182 | else {
|
---|
[551] | 3183 | Collector = dcd->hwndCnr;
|
---|
| 3184 | WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
|
---|
[1498] | 3185 | WinSetWindowText(hwndFrame, (CHAR *) GetPString(IDS_COLLECTORTITLETEXT));
|
---|
[948] | 3186 | if (FrameFlags & FCF_MENU) {
|
---|
| 3187 | PFNWP oldmenuproc;
|
---|
| 3188 | HWND hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
|
---|
[942] | 3189 |
|
---|
| 3190 | oldmenuproc = WinSubclassWindow(hwndMenu, (PFNWP) CollectorMenuProc);
|
---|
| 3191 | WinSetWindowPtr(hwndMenu, QWL_USER, (PVOID) oldmenuproc);
|
---|
[444] | 3192 | if (!fToolbar) {
|
---|
[948] | 3193 | if (hwndMenu) {
|
---|
[2] | 3194 |
|
---|
[194] | 3195 | WinSendMsg(hwndMenu,
|
---|
| 3196 | MM_DELETEITEM,
|
---|
[551] | 3197 | MPFROM2SHORT(IDM_SEEALL, FALSE), MPVOID);
|
---|
[194] | 3198 | WinSendMsg(hwndMenu,
|
---|
| 3199 | MM_DELETEITEM,
|
---|
[551] | 3200 | MPFROM2SHORT(IDM_GREP, FALSE), MPVOID);
|
---|
[194] | 3201 | WinSendMsg(hwndMenu,
|
---|
| 3202 | MM_DELETEITEM,
|
---|
[551] | 3203 | MPFROM2SHORT(IDM_CLEARCNR, FALSE), MPVOID);
|
---|
[194] | 3204 | WinSendMsg(hwndMenu,
|
---|
| 3205 | MM_DELETEITEM,
|
---|
[551] | 3206 | MPFROM2SHORT(IDM_REMOVE, FALSE), MPVOID);
|
---|
[194] | 3207 | }
|
---|
| 3208 | }
|
---|
| 3209 | }
|
---|
[551] | 3210 | dcd->oldproc = WinSubclassWindow(dcd->hwndCnr,
|
---|
| 3211 | (PFNWP) CollectorCnrWndProc);
|
---|
[194] | 3212 | {
|
---|
[942] | 3213 | USHORT ids[] = { DIR_TOTALS,
|
---|
| 3214 | DIR_SELECTED,
|
---|
| 3215 | DIR_VIEW,
|
---|
| 3216 | DIR_SORT,
|
---|
| 3217 | DIR_FILTER,
|
---|
| 3218 | 0
|
---|
[551] | 3219 | };
|
---|
[2] | 3220 |
|
---|
[551] | 3221 | CommonCreateTextChildren(dcd->hwndClient,
|
---|
[593] | 3222 | WC_COLSTATUS, ids);
|
---|
[194] | 3223 | }
|
---|
| 3224 | if (FrameFlags & FCF_SHELLPOSITION)
|
---|
[551] | 3225 | PostMsg(hwndClient, UM_SIZE, MPVOID, MPVOID);
|
---|
| 3226 | if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
|
---|
| 3227 | WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
|
---|
[2] | 3228 | }
|
---|
| 3229 | }
|
---|
[1077] | 3230 | # ifdef FORTIFY
|
---|
[1563] | 3231 | DosSleep(1); // Let receiver take ownership
|
---|
[1077] | 3232 | Fortify_LeaveScope();
|
---|
| 3233 | # endif
|
---|
[2] | 3234 | }
|
---|
| 3235 | return hwndFrame;
|
---|
| 3236 | }
|
---|
[793] | 3237 |
|
---|
| 3238 | #pragma alloc_text(COLLECTOR,CollectorCnrWndProc,CollectorObjWndProc)
|
---|
| 3239 | #pragma alloc_text(COLLECTOR,CollectorClientWndProc,CollectorTextProc)
|
---|
| 3240 | #pragma alloc_text(COLLECTOR,CollectorFrameWndProc)
|
---|
| 3241 | #pragma alloc_text(STARTUP,StartCollector)
|
---|