source: trunk/dll/collect.c@ 617

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

Drag drop work around for number of files limitation in PM

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