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