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