source: trunk/dll/collect.c@ 1611

Last change on this file since 1611 was 1611, checked in by Steven Levine, 14 years ago

Allow SVN/CVS file ignore in Seek and scan

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