source: trunk/dll/collect.c@ 688

Last change on this file since 688 was 688, checked in by Gregg Young, 18 years ago

Update History and file headers for CheckPmDrgLimit etc changes

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