source: trunk/dll/collect.c@ 1041

Last change on this file since 1041 was 1041, checked in by Gregg Young, 17 years ago

Adds optional support for delete being move to X/Eworkplace trashcan (ticket 43)

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