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