source: trunk/dll/collect.c@ 1065

Last change on this file since 1065 was 1065, checked in by John Small, 17 years ago

Ticket 230: Simplified code and eliminated some local variables by incorporating
all the details view settings (both the global variables and those in the
DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.

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