source: trunk/dll/collect.c@ 1036

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

Fixed early memory free; Added free_... functions to make fortify checking easier; Added fortify scopes; Delete now moves to trash can on systems with the xworkplace trash can installed.

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