source: trunk/dll/collect.c@ 1018

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

Additional fortify scopes mostly for "lists"

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 76.6 KB
Line 
1
2/***********************************************************************
3
4 $Id: collect.c 1018 2008-05-26 19:34:56Z 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 return 0;
788
789 case UM_SELECT:
790 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
791 if (dcd) {
792 switch (SHORT1FROMMP(mp1)) {
793 case IDM_SELECTLIST:
794 {
795 CHAR filename[CCHMAXPATH], *p, *pp;
796
797 strcpy(filename, "*.LST");
798 size = CCHMAXPATH;
799 PrfQueryProfileData(fmprof, appname, "SaveToListName", filename,
800 &size);
801 pp = strrchr(filename, '\\');
802 if (!pp)
803 pp = filename;
804 p = strrchr(pp, '.');
805 if (p && *(p + 1) && p > pp + 1) {
806 if (pp > filename)
807 pp++;
808 *pp = '*';
809 pp++;
810 if (p > pp)
811 memmove(pp, p, strlen(p) + 1);
812 }
813 if (insert_filename(hwnd, filename, FALSE, FALSE))
814 SelectList(dcd->hwndCnr, TRUE, FALSE, FALSE, NULL, filename,
815 NULL);
816 }
817 break;
818 case IDM_SELECTALL:
819 SelectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
820 break;
821 case IDM_DESELECTALL:
822 DeselectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
823 break;
824 case IDM_SELECTALLFILES:
825 SelectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
826 break;
827 case IDM_DESELECTALLFILES:
828 DeselectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
829 break;
830 case IDM_SELECTALLDIRS:
831 SelectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
832 break;
833 case IDM_DESELECTALLDIRS:
834 DeselectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
835 break;
836 case IDM_DESELECTMASK:
837 case IDM_SELECTMASK:
838 {
839 MASK mask;
840 PCNRITEM pci = (PCNRITEM) mp2;
841
842 memset(&mask, 0, sizeof(MASK));
843 mask.fNoAttribs = TRUE;
844 mask.fNoDirs = TRUE;
845 mask.fText = TRUE;
846 strcpy(mask.prompt,
847 GetPString((SHORT1FROMMP(mp1) == IDM_SELECTMASK) ?
848 IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT));
849 if (pci && (INT) pci != -1)
850 strcpy(mask.szMask, pci->pszFileName);
851 if (WinDlgBox(HWND_DESKTOP, dcd->hwndCnr, PickMaskDlgProc,
852 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
853 if (SHORT1FROMMP(mp1) == IDM_SELECTMASK)
854 SelectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, mask.szText,
855 FALSE);
856 else
857 DeselectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, mask.szText,
858 FALSE);
859 }
860 }
861
862 case IDM_DESELECTCLIP:
863 case IDM_SELECTCLIP:
864 {
865 CHAR **list;
866
867 list = ListFromClipboard(hwnd);
868 if (list) {
869 SelectList(dcd->hwndCnr, TRUE, FALSE,
870 (SHORT1FROMMP(mp1) == IDM_DESELECTCLIP),
871 NULL, NULL, list);
872 FreeList(list);
873 }
874 }
875 break;
876
877 case IDM_INVERT:
878 InvertAll(dcd->hwndCnr);
879 break;
880 }
881 }
882 return 0;
883
884 case UM_MASSACTION:
885 if (mp1) {
886 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
887 if (dcd) {
888 WORKER *wk;
889# ifdef FORTIFY
890 Fortify_EnterScope();
891# endif
892 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
893 if (!wk)
894 FreeListInfo((LISTINFO *) mp1);
895 else {
896 wk->size = sizeof(WORKER);
897 wk->hwndCnr = dcd->hwndCnr;
898 wk->hwndParent = dcd->hwndParent;
899 wk->hwndFrame = dcd->hwndFrame;
900 wk->hwndClient = dcd->hwndClient;
901 wk->li = (LISTINFO *) mp1;
902 strcpy(wk->directory, dcd->directory);
903 if (_beginthread(MassAction, NULL, 122880, (PVOID) wk) == -1) {
904 Runtime_Error(pszSrcFile, __LINE__,
905 GetPString(IDS_COULDNTSTARTTHREADTEXT));
906 xfree(wk, pszSrcFile, __LINE__);
907# ifdef FORTIFY
908 Fortify_LeaveScope();
909# endif
910 FreeListInfo((LISTINFO *) mp1);
911 }
912 }
913 }
914 }
915 return 0;
916
917 case UM_ACTION:
918 if (mp1) {
919 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
920 if (dcd) {
921 WORKER *wk;
922# ifdef FORTIFY
923 Fortify_EnterScope();
924# endif
925 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
926 if (!wk)
927 FreeListInfo((LISTINFO *) mp1);
928 else {
929 wk->size = sizeof(WORKER);
930 wk->hwndCnr = dcd->hwndCnr;
931 wk->hwndParent = dcd->hwndParent;
932 wk->hwndFrame = dcd->hwndFrame;
933 wk->hwndClient = dcd->hwndClient;
934 wk->li = (LISTINFO *) mp1;
935 strcpy(wk->directory, dcd->directory);
936 if (_beginthread(Action, NULL, 122880, (PVOID) wk) == -1) {
937 Runtime_Error(pszSrcFile, __LINE__,
938 GetPString(IDS_COULDNTSTARTTHREADTEXT));
939 xfree(wk, pszSrcFile, __LINE__);
940# ifdef FORTIFY
941 Fortify_LeaveScope();
942# endif
943 FreeListInfo((LISTINFO *) mp1);
944 }
945 }
946 }
947 }
948 return 0;
949
950 case WM_CLOSE:
951 WinDestroyWindow(hwnd);
952 break;
953
954 case WM_DESTROY:
955 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
956 if (dcd) {
957 INT x;
958
959 dcd->stopflag = 1;
960 // Allow other threads to honor stop request
961 for (x = 0; x < 100 && dcd->amextracted; x++)
962 DosSleep(10);
963 if (dcd->amextracted)
964 Runtime_Error(pszSrcFile, __LINE__, "still busy");
965 WinSendMsg(dcd->hwndCnr, UM_CLOSE, MPVOID, MPVOID);
966 FreeList(dcd->lastselection);
967 xfree(dcd, pszSrcFile, __LINE__);
968# ifdef FORTIFY
969 Fortify_LeaveScope();
970# endif
971 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL);
972 }
973 DosPostEventSem(CompactSem);
974 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
975 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
976 break;
977 }
978 return WinDefWindowProc(hwnd, msg, mp1, mp2);
979}
980
981MRESULT EXPENTRY CollectorCnrWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
982 MPARAM mp2)
983{
984 DIRCNRDATA *dcd = INSTDATA(hwnd);
985 ULONG size;
986
987 static INT savedSortFlags;
988
989 switch (msg) {
990 case DM_PRINTOBJECT:
991 return MRFROMLONG(DRR_TARGET);
992
993 case DM_DISCARDOBJECT:
994 if (dcd)
995 return WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
996 else
997 return MRFROMLONG(DRR_TARGET);
998
999 case WM_CHAR:
1000 shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
1001 if (SHORT1FROMMP(mp1) & KC_KEYUP)
1002 return (MRESULT) TRUE;
1003 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
1004 switch (SHORT2FROMMP(mp2)) {
1005 case VK_DELETE:
1006 if ((shiftstate & KC_CTRL) == KC_CTRL)
1007 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PERMDELETE, 0), MPVOID);
1008 else if ((shiftstate & KC_SHIFT) == KC_SHIFT)
1009 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SAVETOCLIP, 0), MPVOID);
1010 else
1011 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID);
1012 break;
1013 }
1014 }
1015 if (shiftstate || fNoSearch)
1016 break;
1017 if (SHORT1FROMMP(mp1) & KC_CHAR) {
1018 ULONG thistime, len;
1019 SEARCHSTRING srch;
1020 PCNRITEM pci;
1021
1022 if (!dcd)
1023 break;
1024 switch (SHORT1FROMMP(mp2)) {
1025 case '\x1b':
1026 case '\r':
1027 case '\n':
1028 dcd->lasttime = 0;
1029 *dcd->szCommonName = 0;
1030 break;
1031 default:
1032 thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd));
1033 if (thistime > dcd->lasttime + 1250)
1034 *dcd->szCommonName = 0;
1035 dcd->lasttime = thistime;
1036 if (SHORT1FROMMP(mp2) == ' ' && !dcd->szCommonName)
1037 break;
1038 KbdRetry:
1039 len = strlen(dcd->szCommonName);
1040 if (len >= CCHMAXPATH - 1) {
1041 *dcd->szCommonName = 0;
1042 len = 0;
1043 }
1044 dcd->szCommonName[len] = toupper(SHORT1FROMMP(mp2));
1045 dcd->szCommonName[len + 1] = 0;
1046 memset(&srch, 0, sizeof(SEARCHSTRING));
1047 srch.cb = sizeof(SEARCHSTRING);
1048 srch.pszSearch = dcd->szCommonName;
1049 srch.fsPrefix = TRUE;
1050 srch.fsCaseSensitive = FALSE;
1051 srch.usView = CV_ICON;
1052 pci = WinSendMsg(hwnd, CM_SEARCHSTRING, MPFROMP(&srch),
1053 MPFROMLONG(CMA_FIRST));
1054 if (pci && (INT) pci != -1) {
1055 USHORT attrib = CRA_CURSORED;
1056
1057 /* make found item current item */
1058 if (!stricmp(pci->pszFileName, dcd->szCommonName))
1059 attrib |= CRA_SELECTED;
1060 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
1061 MPFROM2SHORT(TRUE, attrib));
1062 /* make sure that record shows in viewport */
1063 ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
1064 return (MRESULT) TRUE;
1065 }
1066 else {
1067 if (SHORT1FROMMP(mp2) == ' ') {
1068 dcd->szCommonName[len] = 0;
1069 break;
1070 }
1071 *dcd->szCommonName = 0;
1072 dcd->lasttime = 0;
1073 if (len) // retry as first letter if no match
1074
1075 goto KbdRetry;
1076 }
1077 break;
1078 }
1079 }
1080 break;
1081
1082 case WM_MOUSEMOVE:
1083 case WM_BUTTON1UP:
1084 case WM_BUTTON2UP:
1085 case WM_BUTTON3UP:
1086 case WM_CHORD:
1087 shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
1088 break;
1089
1090 case WM_BUTTON1MOTIONEND:
1091 {
1092 CNRINFO cnri;
1093
1094 memset(&cnri, 0, sizeof(CNRINFO));
1095 cnri.cb = sizeof(CNRINFO);
1096 if (WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
1097 MPFROMLONG(sizeof(CNRINFO)))) {
1098 if (cnri.flWindowAttr & CV_DETAIL)
1099 PrfWriteProfileData(fmprof, appname, "CollectorCnrSplitBar",
1100 (PVOID) & cnri.xVertSplitbar, sizeof(LONG));
1101 }
1102 }
1103 break;
1104
1105 case WM_PRESPARAMCHANGED:
1106 PresParamChanged(hwnd, "Collector", mp1, mp2);
1107 break;
1108
1109 case UM_COMPARE:
1110 if (dcd && mp1 && mp2) {
1111 COMPARE *cmp;
1112 CHAR *leftdir = (CHAR *)mp1, *rightdir = (CHAR *)mp2;
1113
1114 if (!IsFile(leftdir) && !IsFile(rightdir)) {
1115 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
1116 if (cmp) {
1117 cmp->size = sizeof(COMPARE);
1118 strcpy(cmp->leftdir, leftdir);
1119 strcpy(cmp->rightdir, rightdir);
1120 cmp->hwndParent = dcd->hwndParent;
1121 cmp->dcd.hwndParent = dcd->hwndParent;
1122 WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, CompareDlgProc,
1123 FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
1124 }
1125 }
1126 }
1127 return 0;
1128
1129 case UM_UPDATERECORDLIST:
1130 if (dcd && mp1)
1131 WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
1132 return 0;
1133
1134 case UM_UPDATERECORD:
1135 if (dcd && mp1) {
1136 CHAR *filename;
1137
1138 filename = mp1;
1139 if (filename)
1140 UpdateCnrRecord(hwnd, filename, TRUE, dcd);
1141 }
1142 return 0;
1143
1144 case WM_SETFOCUS:
1145 /*
1146 * put name of our window on status line
1147 */
1148 if (dcd && hwndStatus && mp2) {
1149 PCNRITEM pci = NULL;
1150
1151 if (fAutoView && hwndMain) {
1152 pci = WinSendMsg(hwnd,
1153 CM_QUERYRECORDEMPHASIS,
1154 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
1155 if (pci && (INT) pci != -1 &&
1156 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
1157 WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
1158 else
1159 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1160 }
1161 if (dcd->amextracted)
1162 WinSetWindowText(hwndStatus2, GetPString(IDS_INSEEKSCANTEXT)); // Say working
1163 WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1164 }
1165 break;
1166
1167 case UM_RESCAN:
1168 if (dcd) {
1169 CNRINFO cnri;
1170 CHAR s[CCHMAXPATH + 69], tb[81], tf[81], *p;
1171 PCNRITEM pci = NULL;
1172
1173 memset(&cnri, 0, sizeof(CNRINFO));
1174 cnri.cb = sizeof(CNRINFO);
1175 WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
1176 MPFROMLONG(sizeof(CNRINFO)));
1177 dcd->totalfiles = cnri.cRecords;
1178 commafmt(tf, sizeof(tf), dcd->totalfiles);
1179 CommaFmtULL(tb, sizeof(tb), dcd->ullTotalBytes, ' ');
1180 sprintf(s, "%s / %s", tf, tb);
1181 WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, s);
1182
1183 commafmt(tf, sizeof(tf), dcd->selectedfiles);
1184 CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, ' ');
1185 sprintf(s, "%s / %s", tf, tb);
1186 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
1187
1188 if (hwndStatus &&
1189 dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
1190 if (hwndMain) {
1191 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1192 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
1193 if (pci && (INT) pci != -1)
1194 PostMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
1195 else
1196 PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1197 }
1198 if (!dcd->amextracted) {
1199 if (!fMoreButtons) {
1200 sprintf(s, " %s%s%s%s",
1201 GetPString(IDS_COLLECTORTEXT),
1202 *dcd->mask.szMask || dcd->mask.antiattr ||
1203 dcd->mask.attrFile != ALLATTRS ? " (" : NullStr,
1204 *dcd->mask.szMask ?
1205 dcd->mask.szMask :
1206 dcd->mask.antiattr ||
1207 dcd->mask.attrFile != ALLATTRS ?
1208 GetPString(IDS_ATTRTEXT) : NullStr,
1209 *dcd->mask.szMask || dcd->mask.antiattr ||
1210 dcd->mask.attrFile != ALLATTRS ?
1211 ")" : NullStr);
1212 }
1213 else
1214 strcpy(s, GetPString(IDS_COLLECTORTEXT));
1215 WinSetWindowText(hwndStatus, s);
1216 }
1217 if (!pci)
1218 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1219 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
1220 if (pci && (INT) pci != -1) {
1221 BOOL fStatus2Used = FALSE;
1222
1223 if (fSplitStatus && hwndStatus2) {
1224 if (pci->attrFile & FILE_DIRECTORY)
1225 p = pci->pszFileName;
1226 else {
1227 p = strrchr(pci->pszFileName, '\\');
1228 if (p) {
1229 if (*(p + 1))
1230 p++;
1231 else
1232 p = pci->pszFileName;
1233 }
1234 else
1235 p = pci->pszFileName;
1236 }
1237 CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
1238 if (!fMoreButtons) {
1239 sprintf(s, " %s %04u/%02u/%02u %02u:%02u:%02u [%s] %s",
1240 tb, pci->date.year, pci->date.month,
1241 pci->date.day, pci->time.hours, pci->time.minutes,
1242 pci->time.seconds, pci->pszDispAttr, p);
1243 }
1244 else {
1245 if (pci->cbFile + pci->easize > 1024)
1246 CommaFmtULL(tf, sizeof(tf), pci->cbFile + pci->easize, 'K');
1247 else
1248 *tf = 0;
1249 sprintf(s, GetPString(IDS_STATUSSIZETEXT),
1250 tb, *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
1251 }
1252 WinSetWindowText(hwndStatus2, s);
1253 fStatus2Used = TRUE;
1254 }
1255 if (fMoreButtons) {
1256 WinSetWindowText(hwndName, pci->pszFileName);
1257 sprintf(s, "%04u/%02u/%02u %02u:%02u:%02u",
1258 pci->date.year, pci->date.month,
1259 pci->date.day, pci->time.hours, pci->time.minutes,
1260 pci->time.seconds);
1261 WinSetWindowText(hwndDate, s);
1262 WinSetWindowText(hwndAttr, pci->pszDispAttr);
1263 }
1264 if (dcd->amextracted && hwndStatus2 && !fStatus2Used)
1265 WinSetWindowText(hwndStatus2, GetPString(IDS_INSEEKSCANTEXT)); // Say working
1266 }
1267 else {
1268 if (hwndStatus2) {
1269 if (dcd->amextracted)
1270 WinSetWindowText(hwndStatus2, GetPString(IDS_INSEEKSCANTEXT)); // Say working
1271 else
1272 WinSetWindowText(hwndStatus2, NullStr);
1273 }
1274 if (fMoreButtons) {
1275 WinSetWindowText(hwndName, NullStr);
1276 WinSetWindowText(hwndDate, NullStr);
1277 WinSetWindowText(hwndAttr, NullStr);
1278 }
1279 }
1280 }
1281 }
1282 return 0;
1283
1284 case UM_CONTAINER_FILLED:
1285 DosBeep(1000, 50); // Wake up user?
1286 WinSendMsg(hwnd,
1287 CM_INVALIDATERECORD,
1288 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
1289 disable_menuitem(WinWindowFromID(WinQueryWindow(hwndMain, QW_PARENT),
1290 FID_MENU), IDM_GREP, FALSE);
1291 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1292 if (dcd) {
1293 dcd->stopflag = 0;
1294 dcd->amextracted = FALSE; // Say not busy
1295 if (dcd->namecanchange) {
1296 if (!PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID))
1297 WinSendMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
1298 }
1299 else
1300 WinSetWindowPos(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
1301 QW_PARENT),
1302 HWND_TOP,
1303 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | SWP_ZORDER);
1304 }
1305 return 0;
1306
1307 case UM_SETUP:
1308 if (dcd) {
1309 if (!dcd->hwndObject) {
1310 /* first time through -- set things up */
1311
1312 CNRINFO cnri;
1313
1314 RestorePresParams(hwnd, "Collector");
1315 LoadDetailsSwitches("Collector", dcd);
1316
1317 dcd->amextracted = FALSE; // Say not busy
1318 dcd->stopflag = 0;
1319 memset(&cnri, 0, sizeof(CNRINFO));
1320 cnri.cb = sizeof(CNRINFO);
1321 WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
1322 MPFROMLONG(sizeof(CNRINFO)));
1323 cnri.cyLineSpacing = 0;
1324 cnri.cxTreeIndent = 12;
1325
1326 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT | CV_DETAIL));
1327 cnri.flWindowAttr |= (CV_NAME | CA_DETAILSVIEWTITLES |
1328 CV_MINI | CV_FLOW);
1329 cnri.pSortRecord = (PVOID) SortCollectorCnr;
1330
1331 size = sizeof(ULONG);
1332 PrfQueryProfileData(fmprof, appname, "CollectorflWindowAttr",
1333 (PVOID) & cnri.flWindowAttr, &size);
1334 size = sizeof(MASK);
1335 if (PrfQueryProfileSize(fmprof, appname, "CollectorFilter", &size) &&
1336 size) {
1337 PrfQueryProfileData(fmprof, appname, "CollectorFilter", &dcd->mask,
1338 &size);
1339 SetMask(NULL, &dcd->mask);
1340 }
1341 else {
1342 dcd->mask.attrFile = (FILE_NORMAL | FILE_READONLY |
1343 FILE_DIRECTORY | FILE_HIDDEN |
1344 FILE_SYSTEM | FILE_ARCHIVED);
1345 dcd->mask.antiattr = 0;
1346 }
1347
1348 *(dcd->mask.prompt) = 0;
1349
1350 cnri.flWindowAttr |= CV_FLOW;
1351 cnri.flWindowAttr &= (~(CA_MIXEDTARGETEMPH | CA_ORDEREDTARGETEMPH));
1352 dcd->flWindowAttr = cnri.flWindowAttr;
1353 WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
1354 MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING |
1355 CMA_CXTREEINDENT | CMA_PSORTRECORD));
1356 SetCnrCols(hwnd, FALSE);
1357 AdjustCnrColsForPref(hwnd, NULL, dcd, FALSE);
1358
1359 /* fix splitbar for collector container */
1360 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
1361 size = sizeof(LONG);
1362 PrfQueryProfileData(fmprof, appname, "CollectorCnrSplitBar",
1363 &cnri.xVertSplitbar, &size);
1364 if (cnri.xVertSplitbar <= 0)
1365 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
1366 WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
1367 MPFROMLONG(CMA_XVERTSPLITBAR));
1368
1369 if (_beginthread(MakeObjWin, NULL, 245760, (PVOID)dcd) == -1) {
1370 Runtime_Error(pszSrcFile, __LINE__,
1371 GetPString(IDS_COULDNTSTARTTHREADTEXT));
1372 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
1373 return 0;
1374 }
1375 else
1376 DosSleep(32); // Let object window get started
1377 }
1378 SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1379 DIR_FILTER), &dcd->mask, FALSE);
1380 SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1381 DIR_SORT), CollectorsortFlags, FALSE);
1382 SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1383 DIR_VIEW), dcd->flWindowAttr);
1384 }
1385 else {
1386 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
1387 return 0;
1388 }
1389 return 0;
1390
1391 case WM_MENUEND:
1392 if (dcd) {
1393 HWND hwndMenu = (HWND) mp2;
1394
1395 if (hwndMenu == CollectorCnrMenu || hwndMenu == CollectorFileMenu ||
1396 hwndMenu == CollectorDirMenu) {
1397 MarkAll(hwnd, TRUE, FALSE, TRUE);
1398 if (dcd->cnremphasized) {
1399 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
1400 MPFROM2SHORT(FALSE, CRA_SOURCE));
1401 dcd->cnremphasized = FALSE;
1402 }
1403 }
1404 }
1405 break;
1406
1407 case UM_OPENWINDOWFORME:
1408 if (dcd) {
1409 if (mp1 && !IsFile((CHAR *)mp1))
1410 OpenDirCnr(HWND_DESKTOP, hwndMain, dcd->hwndFrame, FALSE, (PSZ) mp1);
1411 else if (mp1 && IsFile(mp1) == 1)
1412 StartArcCnr(HWND_DESKTOP,
1413 dcd->hwndFrame, (CHAR *)mp1, 4, (ARC_TYPE *) mp2);
1414 }
1415 return 0;
1416
1417 case MM_PORTHOLEINIT:
1418 if (dcd) {
1419 switch (SHORT1FROMMP(mp1)) {
1420 case 0:
1421 case 1:
1422 {
1423 ULONG wmsg;
1424
1425 wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
1426 PortholeInit((HWND) WinSendMsg(dcd->hwndClient, wmsg, MPVOID,
1427 MPVOID), mp1, mp2);
1428 }
1429 break;
1430 }
1431 }
1432 break;
1433
1434 case UM_INITMENU:
1435 case WM_INITMENU:
1436 if (dcd) {
1437 switch (SHORT1FROMMP(mp1)) {
1438 case IDM_VIEWSMENU:
1439 SetViewMenu((HWND) mp2, dcd->flWindowAttr);
1440 WinEnableMenuItem((HWND) mp2, IDM_RESELECT,
1441 (dcd->lastselection != NULL));
1442 CopyPresParams((HWND) mp2, hwnd);
1443 break;
1444
1445 case IDM_DETAILSSETUP:
1446 SetDetailsSwitches((HWND) mp2, dcd);
1447 break;
1448
1449 case IDM_COMMANDSMENU:
1450 SetupCommandMenu((HWND) mp2, hwnd);
1451 break;
1452
1453 case IDM_SORTSUBMENU:
1454 SetSortChecks((HWND) mp2, CollectorsortFlags);
1455 break;
1456 }
1457 dcd->hwndLastMenu = (HWND) mp2;
1458 }
1459 if (msg == WM_INITMENU)
1460 break;
1461 return 0;
1462
1463 case UM_COLLECTFROMFILE:
1464 if (mp1) {
1465 if (!dcd) {
1466 xfree(mp1, pszSrcFile, __LINE__);
1467 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
1468 }
1469 else {
1470 if (!PostMsg(dcd->hwndObject, UM_COLLECTFROMFILE, mp1, mp2)) {
1471 Runtime_Error(pszSrcFile, __LINE__, "PostMsg");
1472 xfree(mp1, pszSrcFile, __LINE__);
1473 }
1474 }
1475 }
1476 return 0;
1477
1478 case UM_COMMAND:
1479 if (mp1) {
1480 if (dcd) {
1481 if (!PostMsg(dcd->hwndObject, UM_COMMAND, mp1, mp2)) {
1482 Runtime_Error(pszSrcFile, __LINE__, "PostMsg");
1483 FreeListInfo((LISTINFO *) mp1);
1484 }
1485 else
1486 return (MRESULT) TRUE;
1487 }
1488 else
1489 FreeListInfo((LISTINFO *) mp1);
1490 }
1491 return 0;
1492
1493 case UM_NOTIFY:
1494 if (mp2)
1495 AddNote((CHAR *)mp2);
1496 return 0;
1497
1498 case WM_COMMAND:
1499 DosError(FERR_DISABLEHARDERR);
1500 if (dcd) {
1501 switch (SHORT1FROMMP(mp1)) {
1502 case IDM_SETTARGET:
1503 SetTargetDir(hwnd, FALSE);
1504 break;
1505
1506 case IDM_CONTEXTMENU:
1507 {
1508 PCNRITEM pci;
1509
1510 pci = (PCNRITEM) CurrentRecord(hwnd);
1511 PostMsg(hwnd, WM_CONTROL, MPFROM2SHORT(COLLECTOR_CNR,
1512 CN_CONTEXTMENU),
1513 MPFROMP(pci));
1514 }
1515 break;
1516
1517 case IDM_SHOWALLFILES:
1518 {
1519 PCNRITEM pci;
1520
1521 pci = WinSendMsg(hwnd,
1522 CM_QUERYRECORDEMPHASIS,
1523 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
1524 if (pci && (INT) pci != -1) {
1525 static CHAR dirname[CCHMAXPATH];
1526
1527 strcpy(dirname, pci->pszFileName);
1528 MakeValidDir(dirname);
1529 StartSeeAll(HWND_DESKTOP, FALSE, dirname);
1530 }
1531 }
1532 break;
1533
1534 case IDM_BEGINEDIT:
1535 OpenEdit(hwnd);
1536 break;
1537
1538 case IDM_ENDEDIT:
1539 WinSendMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
1540 break;
1541
1542 case IDM_SHOWSELECT:
1543 QuickPopup(hwnd, dcd,
1544 CheckMenu(hwnd, &CollectorCnrMenu, COLLECTORCNR_POPUP),
1545 IDM_SELECTSUBMENU);
1546 break;
1547
1548 case IDM_SHOWSORT:
1549 QuickPopup(hwnd, dcd,
1550 CheckMenu(hwnd, &CollectorCnrMenu, COLLECTORCNR_POPUP),
1551 IDM_SORTSUBMENU);
1552 break;
1553
1554 case IDM_VIEWORARC:
1555 {
1556 SWP swp;
1557 PCNRITEM pci;
1558
1559 pci = (PCNRITEM) WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1560 MPFROMLONG(CMA_FIRST),
1561 MPFROMSHORT(CRA_CURSORED));
1562 if (pci && (INT) pci != -1) {
1563 WinQueryWindowPos(dcd->hwndFrame, &swp);
1564 DefaultViewKeys(hwnd, dcd->hwndFrame, dcd->hwndParent, &swp,
1565 pci->pszFileName);
1566 }
1567 }
1568 break;
1569
1570 case IDM_SEEALL:
1571 StartSeeAll(HWND_DESKTOP, FALSE, NULL);
1572 break;
1573
1574 case IDM_COLLECTSELECT:
1575 {
1576 CHAR filename[CCHMAXPATH], *p, *pp;
1577
1578 strcpy(filename, "*.LST");
1579 size = CCHMAXPATH;
1580 PrfQueryProfileData(fmprof, appname, "SaveToListName",
1581 filename, &size);
1582 pp = strrchr(filename, '\\');
1583 if (!pp)
1584 pp = filename;
1585 p = strrchr(pp, '.');
1586 if (p && *(p + 1) && p > pp + 1) {
1587 if (pp > filename)
1588 pp++;
1589 *pp = '*';
1590 pp++;
1591 if (p > pp)
1592 memmove(pp, p, strlen(p) + 1);
1593 }
1594 if (insert_filename(hwnd, filename, FALSE, FALSE)) {
1595 p = xstrdup(filename, pszSrcFile, __LINE__);
1596 if (p) {
1597 if (!PostMsg(hwnd, UM_COLLECTFROMFILE, MPFROMP(p), MPVOID))
1598 xfree(p, pszSrcFile, __LINE__);
1599 }
1600 }
1601 }
1602 break;
1603
1604 case IDM_COLLECTORVIEWSETTINGS:
1605 if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
1606 PostMsg(dcd->hwndParent, msg, MPFROMLONG(IDM_COLLECTORVIEWSETTINGS), mp2);
1607 else {
1608 WinDlgBox(HWND_DESKTOP,
1609 hwnd,
1610 CfgDlgProc,
1611 FM3ModHandle,
1612 CFG_FRAME,
1613 MPFROMLONG(IDM_COLLECTORVIEWSETTINGS));
1614 }
1615 break;
1616
1617 case IDM_RESELECT:
1618 SelectList(hwnd, FALSE, FALSE, FALSE, NULL, NULL, dcd->lastselection);
1619 break;
1620
1621 case IDM_HELP:
1622 if (hwndHelp)
1623 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
1624 MPFROM2SHORT(HELP_COLLECT, 0),
1625 MPFROMSHORT(HM_RESOURCEID));
1626 break;
1627
1628 case IDM_SORTNONE:
1629 case IDM_SORTSMARTNAME:
1630 case IDM_SORTNAME:
1631 case IDM_SORTFILENAME:
1632 case IDM_SORTSIZE:
1633 case IDM_SORTEASIZE:
1634 case IDM_SORTFIRST:
1635 case IDM_SORTLAST:
1636 case IDM_SORTLWDATE:
1637 case IDM_SORTLADATE:
1638 case IDM_SORTCRDATE:
1639 case IDM_SORTSUBJECT:
1640 savedSortFlags = CollectorsortFlags;
1641 CollectorsortFlags &= (SORT_REVERSE | SORT_DIRSFIRST | SORT_DIRSLAST);
1642 case IDM_SORTDIRSFIRST:
1643 case IDM_SORTDIRSLAST:
1644 case IDM_SORTREVERSE:
1645 switch (SHORT1FROMMP(mp1)) {
1646 case IDM_SORTSUBJECT:
1647 CollectorsortFlags |= SORT_SUBJECT;
1648 break;
1649 case IDM_SORTNONE:
1650 CollectorsortFlags |= SORT_NOSORT;
1651 break;
1652 case IDM_SORTSMARTNAME:
1653 if (~savedSortFlags & SORT_FILENAME)
1654 CollectorsortFlags |= SORT_FILENAME;
1655 break;
1656 case IDM_SORTFILENAME:
1657 CollectorsortFlags |= SORT_FILENAME;
1658 break;
1659 case IDM_SORTSIZE:
1660 CollectorsortFlags |= SORT_SIZE;
1661 break;
1662 case IDM_SORTEASIZE:
1663 CollectorsortFlags |= SORT_EASIZE;
1664 break;
1665 case IDM_SORTFIRST:
1666 CollectorsortFlags |= SORT_FIRSTEXTENSION;
1667 break;
1668 case IDM_SORTLAST:
1669 CollectorsortFlags |= SORT_LASTEXTENSION;
1670 break;
1671 case IDM_SORTLWDATE:
1672 CollectorsortFlags |= SORT_LWDATE;
1673 break;
1674 case IDM_SORTLADATE:
1675 CollectorsortFlags |= SORT_LADATE;
1676 break;
1677 case IDM_SORTCRDATE:
1678 CollectorsortFlags |= SORT_CRDATE;
1679 break;
1680 case IDM_SORTDIRSFIRST:
1681 if (CollectorsortFlags & SORT_DIRSFIRST)
1682 CollectorsortFlags &= (~SORT_DIRSFIRST);
1683 else {
1684 CollectorsortFlags |= SORT_DIRSFIRST;
1685 CollectorsortFlags &= (~SORT_DIRSLAST);
1686 }
1687 break;
1688 case IDM_SORTDIRSLAST:
1689 if (CollectorsortFlags & SORT_DIRSLAST)
1690 CollectorsortFlags &= (~SORT_DIRSLAST);
1691 else {
1692 CollectorsortFlags |= SORT_DIRSLAST;
1693 CollectorsortFlags &= (~SORT_DIRSFIRST);
1694 }
1695 break;
1696 case IDM_SORTREVERSE:
1697 if (CollectorsortFlags & SORT_REVERSE)
1698 CollectorsortFlags &= (~SORT_REVERSE);
1699 else
1700 CollectorsortFlags |= SORT_REVERSE;
1701 break;
1702 }
1703 PrfWriteProfileData(fmprof, appname, "CollectorSort",
1704 &CollectorsortFlags, sizeof(INT));
1705 WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortCollectorCnr), MPVOID);
1706 SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1707 DIR_SORT), CollectorsortFlags, FALSE);
1708 break;
1709
1710 case IDM_COLLECTFROMCLIP:
1711 {
1712 LISTINFO *li;
1713# ifdef FORTIFY
1714 Fortify_EnterScope();
1715# endif
1716 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
1717 if (li) {
1718 li->list = ListFromClipboard(hwnd);
1719 if (!li->list || !li->list[0])
1720 FreeListInfo(li);
1721 else {
1722 li->type = IDM_COLLECT;
1723 if (!PostMsg(dcd->hwndObject, UM_COLLECT, MPFROMP(li), MPVOID))
1724 FreeListInfo(li);
1725 }
1726 }
1727 }
1728 break;
1729
1730 case IDM_REMOVE:
1731 if (fAutoView && hwndMain)
1732 PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1733 dcd->suspendview = 1;
1734 RemoveAll(hwnd, &dcd->ullTotalBytes, &dcd->totalfiles);
1735 dcd->suspendview = 0;
1736 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1737 break;
1738
1739 case IDM_CLEARCNR:
1740 {
1741 PCNRITEM pci;
1742
1743 pci = (PCNRITEM) WinSendMsg(hwnd,
1744 CM_QUERYRECORD,
1745 MPVOID,
1746 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
1747 if (pci && (INT) pci != -1) {
1748 RemoveCnrItems(hwnd, NULL, 0, CMA_FREE | CMA_INVALIDATE);
1749 dcd->ullTotalBytes = dcd->selectedbytes = dcd->selectedfiles =
1750 dcd->totalfiles = 0;
1751 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1752 }
1753 }
1754 break;
1755
1756 case DID_CANCEL:
1757 if (dcd->amextracted)
1758 dcd->stopflag = 1; // Request cancel
1759 break;
1760
1761 case IDM_COLLECTOR:
1762 if (mp2) {
1763 LISTINFO *li;
1764# ifdef FORTIFY
1765 Fortify_EnterScope();
1766# endif
1767 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
1768 if (li) {
1769 li->list = mp2;
1770 if (!li->list || !li->list[0])
1771 FreeListInfo(li);
1772 else {
1773 li->type = IDM_COLLECT;
1774 if (!PostMsg(dcd->hwndObject, UM_COLLECT, MPFROMP(li), MPVOID))
1775 FreeListInfo(li);
1776 }
1777 }
1778 else
1779 FreeList(mp2);
1780 }
1781 break;
1782
1783 case IDM_UNDELETE:
1784 {
1785 PCNRITEM pci;
1786 CHAR path[CCHMAXPATH];
1787
1788 pci = (PCNRITEM) CurrentRecord(hwnd);
1789 if (pci) {
1790 strcpy(path, pci->pszFileName);
1791 MakeValidDir(path);
1792 WinDlgBox(HWND_DESKTOP, hwnd, UndeleteDlgProc, FM3ModHandle,
1793 UNDEL_FRAME, MPFROMP(path));
1794 }
1795 }
1796 break;
1797
1798 case IDM_GREP:
1799 if (dcd->amextracted) {
1800 saymsg(MB_OK | MB_ICONASTERISK,
1801 hwnd,
1802 GetPString(IDS_WARNINGTEXT),
1803 "Collector busy - please try again later");
1804 }
1805 else {
1806 if (WinDlgBox(HWND_DESKTOP, hwnd, GrepDlgProc,
1807 FM3ModHandle, GREP_FRAME, (PVOID) & hwnd)) {
1808 dcd->amextracted = TRUE; // Say busy scanning
1809 disable_menuitem(WinWindowFromID
1810 (WinQueryWindow(hwndMain, QW_PARENT), FID_MENU),
1811 IDM_GREP, TRUE);
1812 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1813 }
1814 }
1815 break;
1816
1817 case IDM_RESORT:
1818 WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortCollectorCnr), MPVOID);
1819 break;
1820
1821 case IDM_FILTER:
1822 {
1823 BOOL empty = FALSE;
1824 PCNRITEM pci;
1825 CHAR *p;
1826
1827 if (!*dcd->mask.szMask) {
1828 empty = TRUE;
1829 pci = (PCNRITEM) CurrentRecord(hwnd);
1830 if (pci && !(pci->attrFile & FILE_DIRECTORY)) {
1831 p = strrchr(pci->pszFileName, '\\');
1832 if (p) {
1833 p++;
1834 strcpy(dcd->mask.szMask, p);
1835 }
1836 }
1837 }
1838 *(dcd->mask.prompt) = 0;
1839
1840 if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
1841 FM3ModHandle, MSK_FRAME, MPFROMP(&dcd->mask))) {
1842 size = sizeof(MASK);
1843 PrfWriteProfileData(fmprof, appname, "CollectorFilter",
1844 &dcd->mask, size);
1845 dcd->suspendview = 1;
1846 WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));
1847 dcd->suspendview = 0;
1848 if (fAutoView && hwndMain) {
1849 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1850 MPFROMLONG(CMA_FIRST),
1851 MPFROMSHORT(CRA_CURSORED));
1852 if (pci && (INT) pci != -1 &&
1853 (!(driveflags[toupper(*pci->pszFileName) - 'A'] &
1854 DRIVE_SLOW)))
1855 WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName),
1856 MPVOID);
1857 else
1858 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1859 }
1860 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1861 }
1862 else if (empty)
1863 *dcd->mask.szMask = 0;
1864 SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1865 DIR_FILTER), &dcd->mask, FALSE);
1866 }
1867 break;
1868
1869 case IDM_UNHIDEALL:
1870 WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));
1871 break;
1872
1873 case IDM_HIDEALL:
1874 if (fAutoView && hwndMain)
1875 PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1876 dcd->suspendview = 1;
1877 HideAll(hwnd);
1878 dcd->suspendview = 0;
1879 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1880 break;
1881
1882 case IDM_SELECTLIST:
1883 case IDM_SELECTALL:
1884 case IDM_DESELECTALL:
1885 case IDM_SELECTALLFILES:
1886 case IDM_DESELECTALLFILES:
1887 case IDM_SELECTALLDIRS:
1888 case IDM_DESELECTALLDIRS:
1889 case IDM_SELECTMASK:
1890 case IDM_DESELECTMASK:
1891 case IDM_INVERT:
1892 case IDM_SELECTCLIP:
1893 case IDM_DESELECTCLIP:
1894 {
1895 PCNRITEM pci;
1896
1897 pci = (PCNRITEM) CurrentRecord(hwnd);
1898 if ((INT) pci == -1)
1899 pci = NULL;
1900 if (SHORT1FROMMP(mp1) == IDM_HIDEALL) {
1901 if (pci) {
1902 if (!(pci->rc.flRecordAttr & CRA_SELECTED))
1903 pci->rc.flRecordAttr |= CRA_FILTERED;
1904 WinSendMsg(hwnd, CM_INVALIDATERECORD, MPFROMP(&pci),
1905 MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
1906 break;
1907 }
1908 }
1909 PostMsg(dcd->hwndObject, UM_SELECT, mp1, MPFROMP(pci));
1910 }
1911 break;
1912
1913 case IDM_RESCAN:
1914 PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPVOID);
1915 break;
1916
1917 case IDM_SHOWLNAMES:
1918 case IDM_SHOWSUBJECT:
1919 case IDM_SHOWEAS:
1920 case IDM_SHOWSIZE:
1921 case IDM_SHOWICON:
1922 case IDM_SHOWLWDATE:
1923 case IDM_SHOWLWTIME:
1924 case IDM_SHOWLADATE:
1925 case IDM_SHOWLATIME:
1926 case IDM_SHOWCRDATE:
1927 case IDM_SHOWCRTIME:
1928 case IDM_SHOWATTR:
1929 AdjustDetailsSwitches(hwnd, dcd->hwndLastMenu,
1930 SHORT1FROMMP(mp1), NULL,
1931 "Collector", dcd, FALSE);
1932 break;
1933
1934 case IDM_ICON:
1935 case IDM_TEXT:
1936 case IDM_DETAILS:
1937 case IDM_NAME:
1938 case IDM_MINIICONS:
1939 case IDM_DETAILSTITLES:
1940 {
1941 CNRINFO cnri;
1942
1943 memset(&cnri, 0, sizeof(CNRINFO));
1944 cnri.cb = sizeof(CNRINFO);
1945 WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
1946 MPFROMLONG(sizeof(CNRINFO)));
1947 switch (SHORT1FROMMP(mp1)) {
1948 case IDM_ICON:
1949 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
1950 CV_DETAIL | CV_NAME));
1951 cnri.flWindowAttr |= CV_ICON;
1952 break;
1953 case IDM_NAME:
1954 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
1955 CV_DETAIL | CV_NAME));
1956 cnri.flWindowAttr |= CV_NAME;
1957 break;
1958 case IDM_TEXT:
1959 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
1960 CV_DETAIL | CV_NAME));
1961 cnri.flWindowAttr |= CV_TEXT;
1962 break;
1963 case IDM_DETAILS:
1964 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
1965 CV_DETAIL | CV_NAME));
1966 cnri.flWindowAttr |= CV_DETAIL;
1967 break;
1968 case IDM_MINIICONS:
1969 if (cnri.flWindowAttr & CV_MINI)
1970 cnri.flWindowAttr &= (~CV_MINI);
1971 else
1972 cnri.flWindowAttr |= CV_MINI;
1973 break;
1974 case IDM_DETAILSTITLES:
1975 if (cnri.flWindowAttr & CA_DETAILSVIEWTITLES)
1976 cnri.flWindowAttr &= (~CA_DETAILSVIEWTITLES);
1977 else
1978 cnri.flWindowAttr |= CA_DETAILSVIEWTITLES;
1979 break;
1980 }
1981 cnri.flWindowAttr &= (~(CA_ORDEREDTARGETEMPH | CA_MIXEDTARGETEMPH));
1982 cnri.flWindowAttr |= CV_FLOW;
1983 dcd->flWindowAttr = cnri.flWindowAttr;
1984 PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
1985 &cnri.flWindowAttr, sizeof(ULONG));
1986 WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
1987 MPFROMLONG(CMA_FLWINDOWATTR));
1988 WinSendMsg(hwnd, CM_INVALIDATERECORD, MPVOID,
1989 MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
1990 SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1991 DIR_VIEW), dcd->flWindowAttr);
1992 }
1993 break;
1994
1995 case IDM_SAVETOLIST:
1996 WinDlgBox(HWND_DESKTOP, hwnd, SaveListDlgProc, FM3ModHandle,
1997 SAV_FRAME, MPFROMP(&hwnd));
1998 break;
1999
2000 case IDM_SIZES:
2001 {
2002 PCNRITEM pci;
2003
2004 pci = (PCNRITEM) CurrentRecord(hwnd);
2005 if (pci && (INT) pci != -1)
2006 WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, DirSizeProc, FM3ModHandle,
2007 DSZ_FRAME, pci->pszFileName);
2008 }
2009 break;
2010
2011 case IDM_MKDIR:
2012 {
2013 PCNRITEM pci;
2014
2015 pci = (PCNRITEM) CurrentRecord(hwnd);
2016 PMMkDir(dcd->hwndParent, (pci && (INT) pci != -1) ?
2017 pci->pszFileName : NULL, FALSE);
2018 }
2019 break;
2020
2021 case IDM_DOITYOURSELF:
2022 case IDM_UPDATE:
2023 case IDM_COLLECTFROMFILE:
2024 case IDM_OPENWINDOW:
2025 case IDM_OPENSETTINGS:
2026 case IDM_OPENDEFAULT:
2027 case IDM_OPENICON:
2028 case IDM_OPENDETAILS:
2029 case IDM_OPENTREE:
2030 case IDM_OBJECT:
2031 case IDM_SHADOW:
2032 case IDM_SHADOW2:
2033 case IDM_DELETE:
2034 case IDM_PERMDELETE:
2035 case IDM_PRINT:
2036 case IDM_ATTRS:
2037 case IDM_INFO:
2038 case IDM_COPY:
2039 case IDM_MOVE:
2040 case IDM_WPSCOPY:
2041 case IDM_WPSMOVE:
2042 case IDM_COPYPRESERVE:
2043 case IDM_MOVEPRESERVE:
2044 case IDM_WILDCOPY:
2045 case IDM_WILDMOVE:
2046 case IDM_RENAME:
2047 case IDM_COMPARE:
2048 case IDM_EAS:
2049 case IDM_SUBJECT:
2050 case IDM_VIEW:
2051 case IDM_VIEWTEXT:
2052 case IDM_VIEWBINARY:
2053 case IDM_VIEWARCHIVE:
2054 case IDM_EDIT:
2055 case IDM_EDITTEXT:
2056 case IDM_EDITBINARY:
2057 case IDM_SAVETOCLIP:
2058 case IDM_APPENDTOCLIP:
2059 case IDM_ARCHIVE:
2060 case IDM_ARCHIVEM:
2061 case IDM_EXTRACT:
2062 case IDM_MCIPLAY:
2063 case IDM_UUDECODE:
2064 case IDM_MERGE:
2065 {
2066 LISTINFO *li;
2067 ULONG action = UM_ACTION;
2068# ifdef FORTIFY
2069 Fortify_EnterScope();
2070# endif
2071 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
2072 if (li) {
2073 li->type = SHORT1FROMMP(mp1);
2074 li->hwnd = hwnd;
2075 li->list = BuildList(hwnd);
2076 if (li->list) {
2077 switch (SHORT1FROMMP(mp1)) {
2078 case IDM_DOITYOURSELF:
2079 case IDM_APPENDTOCLIP:
2080 case IDM_SAVETOCLIP:
2081 case IDM_ARCHIVE:
2082 case IDM_ARCHIVEM:
2083 case IDM_DELETE:
2084 case IDM_PERMDELETE:
2085 case IDM_ATTRS:
2086 case IDM_PRINT:
2087 case IDM_SHADOW:
2088 case IDM_SHADOW2:
2089 case IDM_OBJECT:
2090 case IDM_VIEW:
2091 case IDM_VIEWTEXT:
2092 case IDM_VIEWBINARY:
2093 case IDM_EDIT:
2094 case IDM_EDITTEXT:
2095 case IDM_EDITBINARY:
2096 case IDM_MCIPLAY:
2097 case IDM_UPDATE:
2098 case IDM_INFO:
2099 case IDM_EAS:
2100 action = UM_MASSACTION;
2101 break;
2102 }
2103 if (li->type == IDM_SHADOW || li->type == IDM_OBJECT ||
2104 li->type == IDM_SHADOW2)
2105 *li->targetpath = 0;
2106 if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID)) {
2107 Runtime_Error(pszSrcFile, __LINE__, "PostMsg");
2108 FreeListInfo(li);
2109 }
2110 else if (fUnHilite)
2111 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
2112 }
2113 else
2114 xfree(li, pszSrcFile, __LINE__);
2115# ifdef FORTIFY
2116 Fortify_LeaveScope();
2117# endif
2118 }
2119 }
2120 break;
2121
2122 default:
2123 if (!cmdloaded)
2124 load_commands();
2125 if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
2126 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
2127 INT x;
2128
2129 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
2130 if (x >= 0) {
2131 x++;
2132 RunCommand(hwnd, x);
2133 if (fUnHilite)
2134 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
2135 }
2136 }
2137 break;
2138 }
2139 }
2140 return 0;
2141
2142 case UM_FIXCNRMLE:
2143 case UM_FIXEDITNAME:
2144 return CommonCnrProc(hwnd, msg, mp1, mp2);
2145
2146 case UM_FILESMENU:
2147 {
2148 PCNRITEM pci;
2149 HWND menuHwnd = (HWND) 0;
2150
2151 pci = (PCNRITEM) CurrentRecord(hwnd);
2152 if (pci && (INT) pci != -1) {
2153 if (pci->attrFile & FILE_DIRECTORY)
2154 menuHwnd = CheckMenu(hwnd, &CollectorDirMenu, COLLECTORDIR_POPUP);
2155 else
2156 menuHwnd = CheckMenu(hwnd, &CollectorFileMenu, COLLECTORFILE_POPUP);
2157 }
2158 return MRFROMLONG(menuHwnd);
2159 }
2160
2161 case WM_CONTROL:
2162 DosError(FERR_DISABLEHARDERR);
2163 if (dcd) {
2164 switch (SHORT2FROMMP(mp1)) {
2165 case CN_CONTEXTMENU:
2166 {
2167 PCNRITEM pci = (PCNRITEM) mp2;
2168
2169 if (pci) {
2170 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
2171 MPFROM2SHORT(TRUE, CRA_CURSORED));
2172 MarkAll(hwnd, FALSE, FALSE, TRUE);
2173 if (pci->attrFile & FILE_DIRECTORY)
2174 dcd->hwndLastMenu = CheckMenu(hwnd, &CollectorDirMenu,
2175 COLLECTORDIR_POPUP);
2176 else
2177 dcd->hwndLastMenu = CheckMenu(hwnd, &CollectorFileMenu,
2178 COLLECTORFILE_POPUP);
2179 }
2180 else {
2181 dcd->hwndLastMenu = CheckMenu(hwnd, &CollectorCnrMenu,
2182 COLLECTORCNR_POPUP);
2183 if (dcd->hwndLastMenu && !dcd->cnremphasized) {
2184 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
2185 MPFROM2SHORT(TRUE, CRA_SOURCE));
2186 dcd->cnremphasized = TRUE;
2187 }
2188 }
2189 if (dcd->hwndLastMenu) {
2190 if (dcd->hwndLastMenu == CollectorCnrMenu) {
2191 SetViewMenu(dcd->hwndLastMenu, dcd->flWindowAttr);
2192 SetDetailsSwitches(dcd->hwndLastMenu, dcd);
2193 CopyPresParams(dcd->hwndLastMenu, hwnd);
2194 if (dcd->flWindowAttr & CV_MINI)
2195 WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE);
2196 disable_menuitem(dcd->hwndLastMenu, DID_CANCEL,
2197 !dcd->amextracted);
2198 disable_menuitem(dcd->hwndLastMenu, IDM_GREP, dcd->amextracted);
2199 }
2200 if (!PopupMenu(hwnd, hwnd, dcd->hwndLastMenu)) {
2201 if (dcd->cnremphasized) {
2202 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
2203 MPFROM2SHORT(FALSE, CRA_SOURCE));
2204 dcd->cnremphasized = TRUE;
2205 }
2206 MarkAll(hwnd, TRUE, FALSE, TRUE);
2207 }
2208 }
2209 }
2210 break;
2211
2212 case CN_DROPHELP:
2213 if (mp2) {
2214 PDRAGINFO pDInfo;
2215 PCNRITEM pci;
2216 ULONG numitems;
2217 USHORT usOperation;
2218
2219 pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
2220 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
2221 if (!DrgAccessDraginfo(pDInfo)) {
2222 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
2223 "DrgAccessDraginfo");
2224 return 0;
2225 }
2226 numitems = DrgQueryDragitemCount(pDInfo);
2227 usOperation = pDInfo->usOperation;
2228 FreeDragInfoData(hwnd, pDInfo);
2229 saymsg(MB_ENTER | MB_ICONASTERISK,
2230 hwnd,
2231 GetPString(IDS_DROPHELPHDRTEXT),
2232 GetPString(IDS_DROPHELPTEXT),
2233 numitems,
2234 &"s"[numitems == 1],
2235 (pci) ? NullStr : GetPString(IDS_NOTEXT),
2236 (pci) ? NullStr : " ",
2237 (pci) ? pci->pszFileName : NullStr,
2238 (pci) ? " " : NullStr,
2239 GetPString((usOperation == DO_COPY) ?
2240 IDS_COPYTEXT :
2241 (usOperation == DO_LINK) ?
2242 IDS_LINKTEXT : IDS_MOVETEXT));
2243 }
2244 return 0;
2245
2246 case CN_DRAGLEAVE:
2247 if (mp2) {
2248 PDRAGINFO pDInfo;
2249
2250 // fixme to know why needed
2251 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
2252 DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
2253 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
2254 }
2255 return 0;
2256
2257 case CN_DRAGAFTER:
2258 case CN_DRAGOVER:
2259 if (mp2) {
2260 PDRAGITEM pDItem; /* Pointer to DRAGITEM */
2261 PDRAGINFO pDInfo; /* Pointer to DRAGINFO */
2262 PCNRITEM pci;
2263 USHORT uso;
2264
2265 pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
2266 // if(SHORT1FROMMP(mp1) == CN_DRAGAFTER)
2267 // pci = NULL;
2268 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
2269 if (!DrgAccessDraginfo(pDInfo)) {
2270 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
2271 "DrgAccessDraginfo");
2272 return (MRFROM2SHORT(DOR_NODROP, 0)); /* Drop not valid */
2273 }
2274 if (pci) {
2275 if (pci->rc.flRecordAttr & CRA_SOURCE) {
2276 DrgFreeDraginfo(pDInfo);
2277 return (MRFROM2SHORT(DOR_NODROP, 0));
2278 }
2279 uso = pDInfo->usOperation;
2280 if (uso == DO_DEFAULT)
2281 uso = (fCopyDefault) ? DO_COPY : DO_MOVE;
2282 if (!(pci->attrFile & FILE_DIRECTORY)) {
2283 if (uso != DO_LINK && uso != DO_MOVE && uso != DO_COPY) {
2284 DrgFreeDraginfo(pDInfo);
2285 return MRFROM2SHORT(DOR_NODROP, 0);
2286 }
2287 if (uso != DO_LINK &&
2288 !(driveflags[toupper(*pci->pszFileName) - 'A'] &
2289 DRIVE_NOTWRITEABLE)) {
2290 ARC_TYPE *info = NULL;
2291
2292 if (!fQuickArcFind &&
2293 !(driveflags[toupper(*pci->pszFileName) - 'A'] &
2294 DRIVE_SLOW))
2295 info = find_type(pci->pszFileName, NULL);
2296 else
2297 info = quick_find_type(pci->pszFileName, NULL);
2298 if (!info || ((uso == DO_MOVE && !info->move) ||
2299 (uso == DO_COPY && !info->create))) {
2300 DrgFreeDraginfo(pDInfo);
2301 return MRFROM2SHORT(DOR_NODROP, 0);
2302 }
2303 }
2304 }
2305 }
2306 pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
2307 0); /* Index to DRAGITEM */
2308 if (DrgVerifyRMF(pDItem, /* Check valid rendering */
2309 DRM_OS2FILE, /* mechanisms and data */
2310 NULL)) {
2311 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
2312 if (pci) {
2313 if (driveflags[toupper(*pci->pszFileName) - 'A'] &
2314 DRIVE_NOTWRITEABLE)
2315 return MRFROM2SHORT(DOR_DROP, DO_LINK);
2316 if (toupper(*pci->pszFileName) < 'C')
2317 return MRFROM2SHORT(DOR_DROP, DO_COPY);
2318 return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
2319 ((fCopyDefault) ? DO_COPY : DO_MOVE));
2320 }
2321 else
2322 return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
2323 DO_COPY);
2324 }
2325 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
2326 }
2327 return (MRFROM2SHORT(DOR_NODROP, 0)); /* Drop not valid */
2328
2329 case CN_INITDRAG:
2330 if (mp2) {
2331 BOOL wasemphasized = FALSE;
2332 PCNRDRAGINIT pcd = (PCNRDRAGINIT) mp2;
2333 PCNRITEM pci;
2334
2335 if (pcd) {
2336 pci = (PCNRITEM) pcd->pRecord;
2337 if (pci) {
2338 if (pci->rc.flRecordAttr & CRA_SELECTED)
2339 wasemphasized = TRUE;
2340 if (IsRoot(pci->pszFileName))
2341 break;
2342 if (hwndStatus2)
2343 WinSetWindowText(hwndStatus2,
2344 GetPString(IDS_DRAGFILEOBJTEXT));
2345 if (DoFileDrag(hwnd, dcd->hwndObject, mp2, NULL, NULL, TRUE)) {
2346 if ((fUnHilite && wasemphasized) || dcd->ulItemsToUnHilite)
2347 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
2348 }
2349 if (hwndStatus2)
2350 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2351 }
2352 }
2353 }
2354 return 0;
2355
2356 case CN_DROP:
2357 if (mp2) {
2358 LISTINFO *li;
2359 ULONG action = UM_ACTION;
2360
2361 li = DoFileDrop(hwnd, NULL, TRUE, mp1, mp2);
2362 CheckPmDrgLimit(((PCNRDRAGINFO)mp2)->pDragInfo);
2363 if (li) {
2364 if (!*li->targetpath) {
2365 li->type = IDM_COLLECT;
2366 action = UM_COLLECT;
2367 }
2368 else {
2369 if (li->list && li->list[0] && IsRoot(li->list[0]))
2370 li->type = DO_LINK;
2371 else if (fDragndropDlg && (!*li->arcname || !li->info)) {
2372 CHECKLIST cl;
2373
2374 memset(&cl, 0, sizeof(cl));
2375 cl.size = sizeof(cl);
2376 cl.flags = li->type;
2377 cl.list = li->list;
2378 cl.cmd = li->type;
2379 cl.prompt = li->targetpath;
2380 li->type = WinDlgBox(HWND_DESKTOP, dcd->hwndParent,
2381 DropListProc, FM3ModHandle,
2382 DND_FRAME, MPFROMP(&cl));
2383 if (li->type == DID_ERROR)
2384 Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
2385 "Drag & Drop Dialog");
2386 if (!li->type) {
2387 FreeListInfo(li);
2388 return 0;
2389 }
2390 li->list = cl.list;
2391 if (!li->list || !li->list[0]) {
2392 FreeListInfo(li);
2393 return 0;
2394 }
2395 }
2396 switch (li->type) {
2397 case DND_LAUNCH:
2398 strcat(li->targetpath, " %a");
2399 ExecOnList(dcd->hwndParent, li->targetpath,
2400 PROMPT | WINDOWED, NULL, li->list, NULL,
2401 pszSrcFile, __LINE__);
2402 FreeList(li->list);
2403 li->list = NULL;
2404 break;
2405 case DO_LINK:
2406 if (fLinkSetsIcon) {
2407 li->type = IDM_SETICON;
2408 action = UM_MASSACTION;
2409 }
2410 else
2411 li->type = IDM_COMPARE;
2412 break;
2413 case DND_EXTRACT:
2414 if (*li->targetpath && !IsFile(li->targetpath))
2415 li->type = IDM_EXTRACT;
2416 break;
2417 case DND_MOVE:
2418 li->type = IDM_MOVE;
2419 if (*li->targetpath && IsFile(li->targetpath) == 1) {
2420 action = UM_MASSACTION;
2421 li->type = IDM_ARCHIVEM;
2422 }
2423 break;
2424 case DND_WILDMOVE:
2425 li->type = IDM_WILDMOVE;
2426 if (*li->targetpath && IsFile(li->targetpath) == 1) {
2427 action = UM_MASSACTION;
2428 li->type = IDM_ARCHIVEM;
2429 }
2430 break;
2431 case DND_OBJECT:
2432 li->type = IDM_OBJECT;
2433 action = UM_MASSACTION;
2434 break;
2435 case DND_SHADOW:
2436 li->type = IDM_SHADOW;
2437 action = UM_MASSACTION;
2438 break;
2439 case DND_COMPARE:
2440 li->type = IDM_COMPARE;
2441 break;
2442 case DND_SETICON:
2443 action = UM_MASSACTION;
2444 li->type = IDM_SETICON;
2445 break;
2446 case DND_WILDCOPY:
2447 li->type = IDM_WILDCOPY;
2448 if (*li->targetpath && IsFile(li->targetpath) == 1) {
2449 action = UM_MASSACTION;
2450 li->type = IDM_ARCHIVE;
2451 }
2452 break;
2453 case DND_COPY:
2454 li->type = IDM_COPY;
2455 if (*li->targetpath && IsFile(li->targetpath) == 1) {
2456 action = UM_MASSACTION;
2457 li->type = IDM_ARCHIVE;
2458 }
2459 break;
2460 default:
2461 if (*li->arcname && li->info) {
2462 action = UM_MASSACTION;
2463 li->type =
2464 (li->type ==
2465 DO_MOVE) ? IDM_FAKEEXTRACTM : IDM_FAKEEXTRACT;
2466 }
2467 else if (*li->targetpath && IsFile(li->targetpath) == 1) {
2468 action = UM_MASSACTION;
2469 li->type =
2470 (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
2471 }
2472 else
2473 li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
2474 break;
2475 }
2476 }
2477 if (!li->list || !li->list[0])
2478 FreeListInfo(li);
2479 else if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID))
2480 FreeListInfo(li);
2481 else {
2482 USHORT usop = 0;
2483
2484 switch (li->type) {
2485 case IDM_COPY:
2486 case IDM_WILDCOPY:
2487 usop = DO_COPY;
2488 break;
2489 case IDM_MOVE:
2490 case IDM_WILDMOVE:
2491 case IDM_ARCHIVEM:
2492 usop = DO_MOVE;
2493 break;
2494 }
2495 if (usop)
2496 return MRFROM2SHORT(DOR_DROP, usop);
2497 }
2498 }
2499 }
2500 return 0;
2501
2502 case CN_BEGINEDIT:
2503 case CN_REALLOCPSZ:
2504 case CN_ENDEDIT:
2505 {
2506 MRESULT mre;
2507
2508 mre = CnrDirectEdit(hwnd, msg, mp1, mp2);
2509 if (mre != (MRESULT) - 1)
2510 return mre;
2511 }
2512 break;
2513
2514 case CN_EMPHASIS:
2515 if (mp2) {
2516 PNOTIFYRECORDEMPHASIS pre = mp2;
2517 PCNRITEM pci;
2518 CHAR s[CCHMAXPATH + 91], tb[81], tf[81], *p;
2519
2520 pci = (PCNRITEM) ((pre) ? pre->pRecord : NULL);
2521 if (!pci) {
2522 if (hwndStatus2)
2523 WinSetWindowText(hwndStatus2, NullStr);
2524 if (fMoreButtons) {
2525 WinSetWindowText(hwndName, NullStr);
2526 WinSetWindowText(hwndDate, NullStr);
2527 WinSetWindowText(hwndAttr, NullStr);
2528 }
2529 if (hwndMain)
2530 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
2531 break;
2532 }
2533 if (pre->fEmphasisMask & CRA_SELECTED) {
2534 if (pci->rc.flRecordAttr & CRA_SELECTED) {
2535 dcd->selectedbytes += (pci->cbFile + pci->easize);
2536 dcd->selectedfiles++;
2537 }
2538 else if (dcd->selectedfiles) {
2539 dcd->selectedbytes -= (pci->cbFile + pci->easize);
2540 dcd->selectedfiles--;
2541 }
2542 if (!dcd->suspendview) {
2543 commafmt(tf, sizeof(tf), dcd->selectedfiles);
2544 CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, ' ');
2545 sprintf(s, "%s / %s", tf, tb);
2546 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
2547 }
2548 }
2549 if (!dcd->suspendview &&
2550 WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame) {
2551 if (pre->fEmphasisMask & CRA_CURSORED) {
2552 if (pci->rc.flRecordAttr & CRA_CURSORED) {
2553 if (fSplitStatus && hwndStatus2) {
2554 if (pci->attrFile & FILE_DIRECTORY)
2555 p = pci->pszFileName;
2556 else {
2557 p = strrchr(pci->pszFileName, '\\');
2558 if (p) {
2559 if (*(p + 1))
2560 p++;
2561 else
2562 p = pci->pszFileName;
2563 }
2564 else
2565 p = pci->pszFileName;
2566 }
2567 CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
2568 if (!fMoreButtons)
2569 sprintf(s, " %s %04u/%02u/%02u %02u:%02u:%02u [%s] %s",
2570 tb, pci->date.year,
2571 pci->date.month, pci->date.day, pci->time.hours,
2572 pci->time.minutes, pci->time.seconds,
2573 pci->pszDispAttr, p);
2574 else {
2575 if (pci->cbFile + pci->easize > 1024)
2576 CommaFmtULL(tf, sizeof(tf), pci->cbFile + pci->easize,
2577 ' ');
2578 else
2579 *tf = 0;
2580 sprintf(s, GetPString(IDS_STATUSSIZETEXT),
2581 tb,
2582 *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
2583 }
2584 WinSetWindowText(hwndStatus2, s);
2585 }
2586 if (fMoreButtons) {
2587 WinSetWindowText(hwndName, pci->pszFileName);
2588 sprintf(s, "%04u/%02u/%02u %02u:%02u:%02u",
2589 pci->date.year, pci->date.month,
2590 pci->date.day, pci->time.hours, pci->time.minutes,
2591 pci->time.seconds);
2592 WinSetWindowText(hwndDate, s);
2593 WinSetWindowText(hwndAttr, pci->pszDispAttr);
2594 }
2595 }
2596 }
2597 }
2598 if (!dcd->suspendview && hwndMain &&
2599 (pre->fEmphasisMask & CRA_CURSORED) &&
2600 (pci->rc.flRecordAttr & CRA_CURSORED) &&
2601 WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame)
2602 WinSendMsg(hwndMain, UM_LOADFILE,
2603 MPFROMP(((fComments
2604 || (pci->attrFile & FILE_DIRECTORY) ==
2605 0) ? pci->pszFileName : NULL)), MPVOID);
2606 }
2607 break;
2608
2609 case CN_ENTER:
2610 if (mp2) {
2611 PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
2612 FILEFINDBUF3 ffb;
2613 HDIR hDir = HDIR_CREATE;
2614 ULONG nm = 1;
2615 APIRET status = 0;
2616
2617 SetShiftState();
2618 if (pci) {
2619 if (pci->rc.flRecordAttr & CRA_INUSE)
2620 break;
2621 DosError(FERR_DISABLEHARDERR);
2622 status = DosFindFirst(pci->pszFileName, &hDir,
2623 FILE_NORMAL | FILE_DIRECTORY |
2624 FILE_ARCHIVED | FILE_READONLY |
2625 FILE_HIDDEN | FILE_SYSTEM,
2626 &ffb, sizeof(ffb), &nm, FIL_STANDARD);
2627 priority_bumped();
2628 if (!status) {
2629 DosFindClose(hDir);
2630 if (ffb.attrFile & FILE_DIRECTORY) {
2631 if ((shiftstate & (KC_CTRL | KC_ALT)) == (KC_CTRL | KC_ALT))
2632 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SHOWALLFILES, 0),
2633 MPVOID);
2634 else if ((shiftstate & (KC_CTRL | KC_SHIFT)) ==
2635 (KC_CTRL | KC_SHIFT))
2636 OpenObject(pci->pszFileName, Settings, dcd->hwndFrame);
2637 else if (shiftstate & KC_CTRL)
2638 OpenObject(pci->pszFileName, Default, dcd->hwndFrame);
2639 else
2640 OpenDirCnr(HWND_DESKTOP,
2641 hwndMain,
2642 dcd->hwndFrame, FALSE, pci->pszFileName);
2643 }
2644 else {
2645 SWP swp;
2646
2647 WinSendMsg(hwnd,
2648 CM_SETRECORDEMPHASIS,
2649 MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_INUSE));
2650 WinQueryWindowPos(dcd->hwndFrame, &swp);
2651 DefaultViewKeys(hwnd,
2652 dcd->hwndFrame,
2653 dcd->hwndParent, &swp, pci->pszFileName);
2654 WinSendMsg(hwnd,
2655 CM_SETRECORDEMPHASIS,
2656 MPFROMP(pci),
2657 MPFROM2SHORT(FALSE, CRA_INUSE |
2658 ((fUnHilite) ? CRA_SELECTED : 0)));
2659 }
2660 }
2661 else
2662 RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
2663 }
2664 }
2665 break;
2666 }
2667 }
2668 return 0;
2669
2670 case UM_LOADFILE:
2671 if (dcd && mp2) {
2672 HWND ret;
2673
2674 ret = StartMLEEditor(dcd->hwndParent,
2675 (INT) mp1, (CHAR *)mp2, dcd->hwndFrame);
2676 xfree((CHAR *)mp2, pszSrcFile, __LINE__);
2677 return MRFROMLONG(ret);
2678 }
2679 return 0;
2680
2681 case UM_CLOSE:
2682 WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
2683 QW_PARENT));
2684 return 0;
2685
2686 case UM_FOLDUP:
2687 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
2688 DosExit(EXIT_PROCESS, 1);
2689 return 0;
2690
2691 case WM_CLOSE:
2692 if (dcd) {
2693 dcd->namecanchange = TRUE;
2694 dcd->stopflag = 1;
2695 if (dcd->amextracted)
2696 return 0; // Can not close yet
2697 }
2698 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
2699 if (dcd) {
2700 if (!dcd->dontclose && ParentIsDesktop(hwnd, dcd->hwndParent))
2701 PostMsg(hwnd, UM_FOLDUP, MPVOID, MPVOID);
2702 if (dcd->hwndObject) {
2703 DosSleep(32); // Allow UM_FOLDUP to process
2704 if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
2705 WinSendMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID);
2706 }
2707 }
2708 else
2709 WinSendMsg(hwnd, UM_CLOSE, MPVOID, MPVOID);
2710 return 0;
2711
2712 case WM_DESTROY:
2713 if (CollectorDirMenu)
2714 WinDestroyWindow(CollectorDirMenu);
2715 if (CollectorFileMenu)
2716 WinDestroyWindow(CollectorFileMenu);
2717 if (CollectorCnrMenu)
2718 WinDestroyWindow(CollectorCnrMenu);
2719 CollectorCnrMenu = CollectorFileMenu = CollectorDirMenu = (HWND) 0;
2720 Collector = (HWND) 0;
2721 EmptyCnr(hwnd);
2722 break;
2723 }
2724 if (dcd && dcd->oldproc){
2725 return dcd->oldproc(hwnd, msg, mp1, mp2);
2726 }
2727 else
2728 return PFNWPCnr(hwnd, msg, mp1, mp2);
2729}
2730
2731MRESULT EXPENTRY CollectorMenuProc(HWND hwnd, ULONG msg, MPARAM mp1,
2732 MPARAM mp2)
2733{
2734 PFNWP oldMenuProc = WinQueryWindowPtr(hwnd, QWL_USER);
2735 static short sLastMenuitem;
2736
2737 switch (msg) {
2738 case WM_MOUSEMOVE: {
2739 if (fOtherHelp) {
2740 RECTL rectl;
2741 SHORT i, sCurrentMenuitem;
2742 SHORT MenuItems = 5;
2743 SHORT asMenuIDs[5] = {IDM_GREP,
2744 IDM_SEEALL,
2745 IDM_CLEARCNR,
2746 IDM_REMOVE,
2747 0};
2748 char *szHelpString = NULL;
2749
2750
2751 for (i=0; i<MenuItems; i++) {
2752 sCurrentMenuitem = asMenuIDs[i];
2753 oldMenuProc(hwnd,MM_QUERYITEMRECT,
2754 MPFROM2SHORT(asMenuIDs[i], FALSE),
2755 &rectl);
2756
2757 if (MOUSEMSG(&msg)->x > rectl.xLeft &&
2758 MOUSEMSG(&msg)->x < rectl.xRight &&
2759 MOUSEMSG(&msg)->y > rectl.yBottom &&
2760 MOUSEMSG(&msg)->y < rectl.yTop)
2761 break;
2762 } // for
2763
2764
2765 switch (sCurrentMenuitem) {
2766 case 0:
2767 break;
2768 case IDM_GREP:
2769 szHelpString = GetPString(IDS_COLMENUSEEKSCANHELP);
2770 break;
2771 case IDM_SEEALL:
2772 szHelpString = GetPString(IDS_COLMENUSEEALLHELP);
2773 break;
2774 case IDM_CLEARCNR:
2775 szHelpString = GetPString(IDS_COLMENUCLEARCNRHELP);
2776 break;
2777 case IDM_REMOVE:
2778 szHelpString = GetPString(IDS_COLMENUREMOVECNRHELP);
2779 break;
2780 default:
2781 break;
2782 }
2783
2784 if (sLastMenuitem != sCurrentMenuitem && szHelpString) {
2785 sLastMenuitem = sCurrentMenuitem;
2786 MakeBubble(hwnd, TRUE, szHelpString);
2787 }
2788 else if (hwndBubble && !sCurrentMenuitem){
2789 sLastMenuitem = sCurrentMenuitem;
2790 WinDestroyWindow(hwndBubble);
2791 }
2792 }
2793 }
2794 }
2795 return oldMenuProc(hwnd, msg, mp1, mp2);
2796}
2797
2798HWND StartCollector(HWND hwndParent, INT flags)
2799{
2800 HWND hwndFrame = (HWND) 0;
2801 HWND hwndClient;
2802 ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
2803 FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_NOBYTEALIGN | FCF_ACCELTABLE;
2804 USHORT id;
2805 DIRCNRDATA *dcd;
2806
2807 static USHORT idinc = 0;
2808
2809 if (ParentIsDesktop(hwndParent, hwndParent))
2810 FrameFlags |= (FCF_TASKLIST | FCF_SHELLPOSITION | FCF_MENU);
2811 if (Collector) {
2812 WinSetWindowPos(WinQueryWindow(WinQueryWindow(Collector,
2813 QW_PARENT),
2814 QW_PARENT),
2815 HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE);
2816 return WinQueryWindow(WinQueryWindow(Collector, QW_PARENT), QW_PARENT);
2817 }
2818 hwndFrame = WinCreateStdWindow(hwndParent,
2819 WS_VISIBLE,
2820 &FrameFlags,
2821 WC_COLLECTOR,
2822 NULL,
2823 WS_VISIBLE | fwsAnimate,
2824 FM3ModHandle, COLLECTOR_FRAME, &hwndClient);
2825 if (hwndFrame && hwndClient) {
2826 id = COLLECTOR_FRAME + idinc++;
2827 WinSetWindowUShort(hwndFrame, QWS_ID, id);
2828# ifdef FORTIFY
2829 Fortify_EnterScope();
2830# endif
2831 dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__);
2832 if (!dcd) {
2833 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
2834 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
2835 hwndFrame = (HWND) 0;
2836 }
2837 else {
2838 dcd->size = sizeof(DIRCNRDATA);
2839 dcd->id = id;
2840 dcd->type = COLLECTOR_FRAME;
2841 dcd->hwndParent = (hwndParent) ? hwndParent : HWND_DESKTOP;
2842 dcd->hwndFrame = hwndFrame;
2843 dcd->hwndClient = hwndClient;
2844 if (flags & 4)
2845 dcd->dontclose = TRUE;
2846 {
2847 PFNWP oldproc;
2848
2849 oldproc = WinSubclassWindow(hwndFrame, (PFNWP) CollectorFrameWndProc);
2850 WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
2851 }
2852 dcd->hwndCnr = WinCreateWindow(hwndClient,
2853 WC_CONTAINER,
2854 NULL,
2855 CCS_AUTOPOSITION | CCS_MINIICONS |
2856 CCS_MINIRECORDCORE | ulCnrType |
2857 WS_VISIBLE,
2858 0,
2859 0,
2860 0,
2861 0,
2862 hwndClient,
2863 HWND_TOP,
2864 (ULONG) COLLECTOR_CNR, NULL, NULL);
2865 if (!dcd->hwndCnr) {
2866 Win_Error2(hwndClient, hwndClient, pszSrcFile, __LINE__,
2867 IDS_WINCREATEWINDOW);
2868 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
2869 xfree(dcd, pszSrcFile, __LINE__);
2870# ifdef FORTIFY
2871 Fortify_LeaveScope();
2872# endif
2873 hwndFrame = (HWND) 0;
2874 }
2875 else {
2876 Collector = dcd->hwndCnr;
2877 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
2878 WinSetWindowText(hwndFrame, GetPString(IDS_COLLECTORTITLETEXT));
2879 if (FrameFlags & FCF_MENU) {
2880 PFNWP oldmenuproc;
2881 HWND hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
2882
2883 oldmenuproc = WinSubclassWindow(hwndMenu, (PFNWP) CollectorMenuProc);
2884 WinSetWindowPtr(hwndMenu, QWL_USER, (PVOID) oldmenuproc);
2885 if (!fToolbar) {
2886 if (hwndMenu) {
2887
2888 WinSendMsg(hwndMenu,
2889 MM_DELETEITEM,
2890 MPFROM2SHORT(IDM_SEEALL, FALSE), MPVOID);
2891 WinSendMsg(hwndMenu,
2892 MM_DELETEITEM,
2893 MPFROM2SHORT(IDM_GREP, FALSE), MPVOID);
2894 WinSendMsg(hwndMenu,
2895 MM_DELETEITEM,
2896 MPFROM2SHORT(IDM_CLEARCNR, FALSE), MPVOID);
2897 WinSendMsg(hwndMenu,
2898 MM_DELETEITEM,
2899 MPFROM2SHORT(IDM_REMOVE, FALSE), MPVOID);
2900 }
2901 }
2902 }
2903 dcd->oldproc = WinSubclassWindow(dcd->hwndCnr,
2904 (PFNWP) CollectorCnrWndProc);
2905 {
2906 USHORT ids[] = { DIR_TOTALS,
2907 DIR_SELECTED,
2908 DIR_VIEW,
2909 DIR_SORT,
2910 DIR_FILTER,
2911 0
2912 };
2913
2914 CommonCreateTextChildren(dcd->hwndClient,
2915 WC_COLSTATUS, ids);
2916 }
2917 if (FrameFlags & FCF_SHELLPOSITION)
2918 PostMsg(hwndClient, UM_SIZE, MPVOID, MPVOID);
2919 if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
2920 WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
2921 }
2922 }
2923 }
2924 return hwndFrame;
2925}
2926
2927#pragma alloc_text(COLLECTOR,CollectorCnrWndProc,CollectorObjWndProc)
2928#pragma alloc_text(COLLECTOR,CollectorClientWndProc,CollectorTextProc)
2929#pragma alloc_text(COLLECTOR,CollectorFrameWndProc)
2930#pragma alloc_text(STARTUP,StartCollector)
Note: See TracBrowser for help on using the repository browser.