source: trunk/dll/collect.c@ 705

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

Minor code cleanup fix ramdisk on states list & WORPLACE_PROCESS logic

  • 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 705 2007-06-24 19:17:37Z 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>
[689]56#include <process.h> // _beginthread
[155]57
[2]58#include "fm3dll.h"
59#include "fm3dlg.h"
60#include "fm3str.h"
61#include "mle.h"
62#include "grep.h"
63
64#pragma data_seg(DATA1)
[352]65
66static PSZ pszSrcFile = __FILE__;
67
[2]68#pragma alloc_text(COLLECTOR,CollectorCnrWndProc,CollectorObjWndProc)
69#pragma alloc_text(COLLECTOR,CollectorClientWndProc,CollectorTextProc)
70#pragma alloc_text(COLLECTOR,CollectorFrameWndProc)
71#pragma alloc_text(STARTUP,StartCollector)
72
[194]73MRESULT EXPENTRY CollectorFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
74 MPARAM mp2)
75{
76 return CommonFrameWndProc(COLLECTOR_CNR, hwnd, msg, mp1, mp2);
[2]77}
78
[551]79MRESULT EXPENTRY CollectorTextProc(HWND hwnd, ULONG msg, MPARAM mp1,
80 MPARAM mp2)
[96]81{
[197]82 DIRCNRDATA *dcd;
[155]83
[194]84 static BOOL emphasized = FALSE;
[551]85 static HWND hwndButtonPopup = (HWND) 0;
[194]86 static ULONG timestamp = ULONG_MAX;
87 static USHORT lastid = 0;
[2]88
[444]89 switch (msg) {
[194]90 case WM_CREATE:
91 return CommonTextProc(hwnd, msg, mp1, mp2);
[2]92
[194]93 case UM_CONTEXTMENU:
94 case WM_CONTEXTMENU:
95 {
96 USHORT id;
97
98 id = WinQueryWindowUShort(hwnd, QWS_ID);
[444]99 switch (id) {
[194]100 case DIR_SELECTED:
101 case DIR_VIEW:
102 case DIR_SORT:
103 {
[551]104 POINTL ptl = { 0, 0 };
[194]105 SWP swp;
[2]106
[194]107 if (hwndButtonPopup)
108 WinDestroyWindow(hwndButtonPopup);
[444]109 if (id == lastid) {
[194]110 ULONG check;
[2]111
[194]112 DosQuerySysInfo(QSV_MS_COUNT,
[551]113 QSV_MS_COUNT, &check, sizeof(check));
[444]114 if (check < timestamp + 500) {
[194]115 lastid = 0;
116 goto MenuAbort;
117 }
118 }
[551]119 hwndButtonPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
[444]120 if (hwndButtonPopup) {
[551]121 WinSetWindowUShort(hwndButtonPopup, QWS_ID, id);
[194]122 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
[352]123 QW_PARENT),
[551]124 COLLECTOR_CNR), QWL_USER);
[444]125 if (id == DIR_VIEW) {
126 if (dcd) {
[551]127 SetViewMenu(hwndButtonPopup, dcd->flWindowAttr);
128 SetDetailsSwitches(hwndButtonPopup, dcd);
[194]129 }
[2]130
[194]131 /* don't have tree view in collector */
132 WinSendMsg(hwndButtonPopup,
133 MM_DELETEITEM,
[551]134 MPFROM2SHORT(IDM_TREEVIEW, FALSE), MPVOID);
[2]135
[194]136 }
[444]137 else if (id == DIR_SORT) {
[194]138 if (dcd)
[551]139 SetSortChecks(hwndButtonPopup, dcd->sortFlags);
[194]140 }
141 ptl.x = 0;
142 if (WinPopupMenu(HWND_OBJECT,
143 HWND_OBJECT,
[551]144 hwndButtonPopup, -32767, -32767, 0, 0)) {
145 WinQueryWindowPos(hwndButtonPopup, &swp);
[194]146 ptl.y = -(swp.cy + 2);
147 }
[444]148 else {
[551]149 WinQueryWindowPos(hwnd, &swp);
[194]150 ptl.y = swp.cy + 2;
151 }
152 if (WinPopupMenu(hwnd,
153 hwnd,
154 hwndButtonPopup,
155 ptl.x,
156 ptl.y,
157 0,
158 PU_HCONSTRAIN | PU_VCONSTRAIN |
[551]159 PU_KEYBOARD | PU_MOUSEBUTTON1)) {
[194]160 CenterOverWindow(hwndButtonPopup);
[551]161 PaintRecessedWindow(hwnd, NULLHANDLE, FALSE, FALSE);
[194]162 }
163 }
164 }
165 break;
166 default:
167 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
168 COLLECTOR_CNR),
169 WM_CONTROL,
[551]170 MPFROM2SHORT(COLLECTOR_CNR, CN_CONTEXTMENU), MPVOID);
[194]171 break;
[2]172 }
[194]173 }
174 MenuAbort:
175 if (msg == UM_CONTEXTMENU)
176 return 0;
177 break;
[2]178
[194]179 case WM_MENUEND:
[551]180 if (hwndButtonPopup == (HWND) mp2) {
181 lastid = WinQueryWindowUShort((HWND) mp2, QWS_ID);
[194]182 WinDestroyWindow(hwndButtonPopup);
[551]183 hwndButtonPopup = (HWND) 0;
184 DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &timestamp,
185 sizeof(timestamp));
[444]186 switch (lastid) {
[194]187 case DIR_SELECTED:
188 case DIR_VIEW:
189 case DIR_SORT:
[551]190 PaintRecessedWindow(hwnd, NULLHANDLE, TRUE, FALSE);
[194]191 break;
[2]192 }
[194]193 }
194 break;
[2]195
[194]196 case WM_COMMAND:
197 {
198 DIRCNRDATA *dcd;
199 MRESULT mr;
200
201 mr = WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,
202 QW_PARENT),
[551]203 COLLECTOR_CNR), msg, mp1, mp2);
[194]204 if (hwndButtonPopup &&
205 SHORT1FROMMP(mp1) > IDM_DETAILSTITLES &&
[551]206 SHORT1FROMMP(mp1) < IDM_DETAILSSETUP) {
[194]207 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
208 QW_PARENT),
[551]209 COLLECTOR_CNR), QWL_USER);
[194]210 if (dcd)
[551]211 SetDetailsSwitches(hwndButtonPopup, dcd);
[2]212 }
[194]213 return mr;
214 }
[2]215
[194]216 case WM_MOUSEMOVE:
217 {
218 USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
219 char *s = NULL;
220
[444]221 if (fOtherHelp) {
[194]222 if ((!hwndBubble ||
223 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
[551]224 !WinQueryCapture(HWND_DESKTOP)) {
[444]225 switch (id) {
[194]226 case DIR_SELECTED:
227 s = GetPString(IDS_COLSELECTEDHELP);
228 break;
229 case DIR_TOTALS:
230 s = GetPString(IDS_COLTOTALSHELP);
231 break;
232 case DIR_VIEW:
233 s = GetPString(IDS_DIRCNRVIEWHELP);
234 break;
235 case DIR_SORT:
236 s = GetPString(IDS_DIRCNRSORTHELP);
237 break;
238 case DIR_FILTER:
239 s = GetPString(IDS_DIRCNRFILTERHELP);
240 break;
241 default:
242 break;
243 }
244 if (s)
245 MakeBubble(hwnd, TRUE, s);
246 else if (hwndBubble)
247 WinDestroyWindow(hwndBubble);
248 }
[2]249 }
[444]250 switch (id) {
[194]251 case DIR_FILTER:
252 case DIR_SORT:
253 case DIR_VIEW:
254 case DIR_SELECTED:
255 return CommonTextButton(hwnd, msg, mp1, mp2);
256 }
257 }
258 break;
[2]259
[194]260 case WM_BUTTON3UP:
261 case WM_BUTTON1UP:
262 case WM_BUTTON3DOWN:
263 case WM_BUTTON1DOWN:
264 {
265 USHORT id;
266
[280]267 id = WinQueryWindowUShort(hwnd, QWS_ID);
[444]268 switch (id) {
[194]269 case DIR_FILTER:
270 case DIR_SORT:
271 case DIR_VIEW:
272 case DIR_SELECTED:
273 return CommonTextButton(hwnd, msg, mp1, mp2);
[2]274 }
[194]275 }
276 break;
[2]277
[194]278 case UM_CLICKED:
279 case UM_CLICKED3:
280 {
281 USHORT id, cmd = 0;
282
[280]283 id = WinQueryWindowUShort(hwnd, QWS_ID);
[444]284 switch (id) {
[194]285 case DIR_VIEW:
286 case DIR_SORT:
287 case DIR_SELECTED:
[551]288 PostMsg(hwnd, UM_CONTEXTMENU, MPVOID, MPVOID);
[194]289 break;
290 case DIR_FILTER:
291 cmd = IDM_FILTER;
292 break;
293 default:
294 break;
[2]295 }
[194]296 if (cmd)
[551]297 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
[194]298 COLLECTOR_CNR),
[551]299 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
[194]300 }
301 return 0;
[2]302
[194]303 case DM_DROP:
304 case DM_DRAGOVER:
305 case DM_DRAGLEAVE:
306 case DM_DROPHELP:
[444]307 if (msg == DM_DRAGOVER) {
308 if (!emphasized) {
[194]309 emphasized = TRUE;
310 DrawTargetEmphasis(hwnd, emphasized);
[2]311 }
[194]312 }
[444]313 else {
314 if (emphasized) {
[194]315 emphasized = FALSE;
316 DrawTargetEmphasis(hwnd, emphasized);
[2]317 }
[194]318 }
319 {
320 CNRDRAGINFO cnd;
321 USHORT dcmd;
322
[444]323 switch (msg) {
[194]324 case DM_DROP:
325 dcmd = CN_DROP;
326 break;
327 case DM_DRAGOVER:
328 dcmd = CN_DRAGOVER;
329 break;
330 case DM_DRAGLEAVE:
331 dcmd = CN_DRAGLEAVE;
332 break;
333 case DM_DROPHELP:
334 dcmd = CN_DROPHELP;
335 break;
[2]336 }
[194]337 memset(&cnd, 0, sizeof(cnd));
338 cnd.pDragInfo = (PDRAGINFO) mp1;
339 cnd.pRecord = NULL;
340 return WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_CONTROL,
341 MPFROM2SHORT(COLLECTOR_CNR, dcmd), MPFROMP(&cnd));
342 }
[2]343 }
[194]344 return PFNWPStatic(hwnd, msg, mp1, mp2);
[2]345}
346
[194]347MRESULT EXPENTRY CollectorClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
348 MPARAM mp2)
349{
[444]350 switch (msg) {
[194]351 case UM_CONTAINERHWND:
352 return MRFROMLONG(WinWindowFromID(hwnd, COLLECTOR_CNR));
[2]353
[194]354 case UM_VIEWSMENU:
355 return MRFROMLONG(CheckMenu(&CollectorCnrMenu, COLLECTORCNR_POPUP));
[2]356
[194]357 case MM_PORTHOLEINIT:
358 case WM_INITMENU:
359 case UM_INITMENU:
360 case UM_CONTAINER_FILLED:
361 case UM_FILESMENU:
362 case UM_UPDATERECORD:
363 case UM_UPDATERECORDLIST:
364 return WinSendMsg(WinWindowFromID(hwnd, COLLECTOR_CNR), msg, mp1, mp2);
[2]365
[194]366 case WM_PSETFOCUS:
367 case WM_SETFOCUS:
368 if (mp2)
369 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
370 break;
[2]371
[194]372 case UM_FOCUSME:
373 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, COLLECTOR_CNR));
374 break;
[2]375
[194]376 case WM_PAINT:
377 {
378 HPS hps;
379 RECTL rcl;
[2]380
[280]381 hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
[444]382 if (hps) {
[194]383 WinQueryWindowRect(hwnd, &rcl);
384 WinFillRect(hps, &rcl, CLR_PALEGRAY);
385 CommonTextPaint(hwnd, hps);
386 WinEndPaint(hps);
[2]387 }
[194]388 }
389 break;
[2]390
[194]391 case UM_SIZE:
392 case WM_SIZE:
[444]393 if (msg == UM_SIZE) {
[194]394 SWP swp;
[2]395
[194]396 WinQueryWindowPos(hwnd, &swp);
397 mp1 = MPFROM2SHORT(swp.cx, swp.cy);
398 mp2 = MPFROM2SHORT(swp.cx, swp.cy);
399 }
400 {
401 USHORT cx, cy, bx;
[2]402
[194]403 cx = SHORT1FROMMP(mp2);
404 cy = SHORT2FROMMP(mp2);
405 WinSetWindowPos(WinWindowFromID(hwnd, COLLECTOR_CNR), HWND_TOP,
[551]406 0, 0, cx, cy - 24, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]407 WinSetWindowPos(WinWindowFromID(hwnd, DIR_TOTALS), HWND_TOP,
408 2,
409 cy - 22,
[551]410 (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]411 WinSetWindowPos(WinWindowFromID(hwnd, DIR_SELECTED), HWND_TOP,
412 2 + (cx / 3) + 2,
413 cy - 22,
[551]414 (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]415 bx = (cx - (2 + (((cx / 3) + 2) * 2))) / 3;
416 WinSetWindowPos(WinWindowFromID(hwnd, DIR_VIEW), HWND_TOP,
417 2 + (((cx / 3) + 2) * 2),
[551]418 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]419 WinSetWindowPos(WinWindowFromID(hwnd, DIR_SORT), HWND_TOP,
420 2 + (((cx / 3) + 2) * 2) + bx,
[551]421 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]422 WinSetWindowPos(WinWindowFromID(hwnd, DIR_FILTER), HWND_TOP,
423 2 + (((cx / 3) + 2) * 2) + (bx * 2),
[551]424 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]425 }
[280]426 CommonTextPaint(hwnd, NULLHANDLE);
[444]427 if (msg == UM_SIZE) {
[194]428 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
429 SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE);
430 return 0;
431 }
432 break;
[2]433
[194]434 case UM_COMMAND:
435 case WM_COMMAND:
436 case WM_CONTROL:
437 case WM_CLOSE:
438 return WinSendMsg(WinWindowFromID(hwnd, COLLECTOR_CNR), msg, mp1, mp2);
[2]439 }
[194]440 return WinDefWindowProc(hwnd, msg, mp1, mp2);
[2]441}
442
[194]443MRESULT EXPENTRY CollectorObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
444 MPARAM mp2)
445{
[197]446 ULONG size;
[2]447 DIRCNRDATA *dcd;
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);
[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)
[672]2012 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
[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)
[672]2032 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
[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;
[2]2115
[551]2116 pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
2117 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
[444]2118 if (!DrgAccessDraginfo(pDInfo)) {
[352]2119 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
[618]2120 "DrgAccessDraginfo");
2121 return 0;
[194]2122 }
2123 numitems = DrgQueryDragitemCount(pDInfo);
[551]2124 usOperation = pDInfo->usOperation;
[618]2125 FreeDragInfoData(hwnd, pDInfo);
[194]2126 saymsg(MB_ENTER | MB_ICONASTERISK,
2127 hwnd,
2128 GetPString(IDS_DROPHELPHDRTEXT),
2129 GetPString(IDS_DROPHELPTEXT),
2130 numitems,
2131 &"s"[numitems == 1L],
2132 (pci) ? NullStr : GetPString(IDS_NOTEXT),
2133 (pci) ? NullStr : " ",
[551]2134 (pci) ? pci->szFileName : NullStr,
[194]2135 (pci) ? " " : NullStr,
2136 GetPString((usOperation == DO_COPY) ?
2137 IDS_COPYTEXT :
2138 (usOperation == DO_LINK) ?
2139 IDS_LINKTEXT : IDS_MOVETEXT));
2140 }
2141 return 0;
[2]2142
[194]2143 case CN_DRAGLEAVE:
[444]2144 if (mp2) {
[194]2145 PDRAGINFO pDInfo;
[2]2146
[618]2147 // fixme to know why needed
[551]2148 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
[618]2149 DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
2150 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
[194]2151 }
2152 return 0;
[2]2153
[194]2154 case CN_DRAGAFTER:
2155 case CN_DRAGOVER:
[444]2156 if (mp2) {
[618]2157 PDRAGITEM pDItem; /* Pointer to DRAGITEM */
2158 PDRAGINFO pDInfo; /* Pointer to DRAGINFO */
[194]2159 PCNRITEM pci;
2160 USHORT uso;
[2]2161
[551]2162 pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
[618]2163 // if(SHORT1FROMMP(mp1) == CN_DRAGAFTER)
2164 // pci = NULL;
[551]2165 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
[618]2166 if (!DrgAccessDraginfo(pDInfo)) {
2167 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
2168 "DrgAccessDraginfo");
2169 return (MRFROM2SHORT(DOR_NODROP, 0)); /* Drop not valid */
2170 }
[444]2171 if (pci) {
[551]2172 if (pci->rc.flRecordAttr & CRA_SOURCE) {
[194]2173 DrgFreeDraginfo(pDInfo);
2174 return (MRFROM2SHORT(DOR_NODROP, 0));
2175 }
[551]2176 uso = pDInfo->usOperation;
[194]2177 if (uso == DO_DEFAULT)
2178 uso = (fCopyDefault) ? DO_COPY : DO_MOVE;
[551]2179 if (!(pci->attrFile & FILE_DIRECTORY)) {
2180 if (uso != DO_LINK && uso != DO_MOVE && uso != DO_COPY) {
[194]2181 DrgFreeDraginfo(pDInfo);
2182 return MRFROM2SHORT(DOR_NODROP, 0);
2183 }
2184 if (uso != DO_LINK &&
[551]2185 !(driveflags[toupper(*pci->szFileName) - 'A'] &
2186 DRIVE_NOTWRITEABLE)) {
[194]2187 ARC_TYPE *info = NULL;
[2]2188
[194]2189 if (!fQuickArcFind &&
[551]2190 !(driveflags[toupper(*pci->szFileName) - 'A'] &
[194]2191 DRIVE_SLOW))
[551]2192 info = find_type(pci->szFileName, NULL);
[194]2193 else
[551]2194 info = quick_find_type(pci->szFileName, NULL);
2195 if (!info || ((uso == DO_MOVE && !info->move) ||
2196 (uso == DO_COPY && !info->create))) {
[194]2197 DrgFreeDraginfo(pDInfo);
2198 return MRFROM2SHORT(DOR_NODROP, 0);
2199 }
2200 }
2201 }
2202 }
[618]2203 pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
2204 0); /* Index to DRAGITEM */
[194]2205 if (DrgVerifyRMF(pDItem, /* Check valid rendering */
[618]2206 DRM_OS2FILE, /* mechanisms and data */
[551]2207 NULL)) {
[618]2208 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
[444]2209 if (pci) {
[551]2210 if (driveflags[toupper(*pci->szFileName) - 'A'] &
[194]2211 DRIVE_NOTWRITEABLE)
2212 return MRFROM2SHORT(DOR_DROP, DO_LINK);
[551]2213 if (toupper(*pci->szFileName) < 'C')
[194]2214 return MRFROM2SHORT(DOR_DROP, DO_COPY);
[618]2215 return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
[551]2216 ((fCopyDefault) ? DO_COPY : DO_MOVE));
[194]2217 }
2218 else
[618]2219 return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
[194]2220 DO_COPY);
2221 }
[618]2222 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
[194]2223 }
[618]2224 return (MRFROM2SHORT(DOR_NODROP, 0)); /* Drop not valid */
[2]2225
[194]2226 case CN_INITDRAG:
[444]2227 if (mp2) {
[194]2228 BOOL wasemphasized = FALSE;
2229 PCNRDRAGINIT pcd = (PCNRDRAGINIT) mp2;
2230 PCNRITEM pci;
[2]2231
[444]2232 if (pcd) {
[551]2233 pci = (PCNRITEM) pcd->pRecord;
[444]2234 if (pci) {
[551]2235 if (pci->rc.flRecordAttr & CRA_SELECTED)
[194]2236 wasemphasized = TRUE;
[551]2237 if (IsRoot(pci->szFileName))
[194]2238 break;
2239 if (hwndStatus2)
[551]2240 WinSetWindowText(hwndStatus2,
2241 GetPString(IDS_DRAGFILEOBJTEXT));
2242 if (DoFileDrag(hwnd, dcd->hwndObject, mp2, NULL, NULL, TRUE)) {
[672]2243 if ((fUnHilite && wasemphasized) || dcd->ulItemsToUnHilite)
2244 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
[194]2245 }
2246 if (hwndStatus2)
2247 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2248 }
2249 }
2250 }
2251 return 0;
[2]2252
[194]2253 case CN_DROP:
[444]2254 if (mp2) {
[194]2255 LISTINFO *li;
2256 ULONG action = UM_ACTION;
[2]2257
[687]2258 li = DoFileDrop(hwnd, NULL, TRUE, mp1, mp2);
2259 CheckPmDrgLimit(((PCNRDRAGINFO)mp2)->pDragInfo);
[444]2260 if (li) {
[551]2261 if (!*li->targetpath) {
2262 li->type = IDM_COLLECT;
[194]2263 action = UM_COLLECT;
2264 }
[444]2265 else {
[551]2266 if (li->list && li->list[0] && IsRoot(li->list[0]))
2267 li->type = DO_LINK;
2268 else if (fDragndropDlg && (!*li->arcname || !li->info)) {
[194]2269 CHECKLIST cl;
[2]2270
[194]2271 memset(&cl, 0, sizeof(cl));
2272 cl.size = sizeof(cl);
[551]2273 cl.flags = li->type;
2274 cl.list = li->list;
2275 cl.cmd = li->type;
2276 cl.prompt = li->targetpath;
2277 li->type = WinDlgBox(HWND_DESKTOP, dcd->hwndParent,
2278 DropListProc, FM3ModHandle,
[618]2279 DND_FRAME, MPFROMP(&cl));
2280 if (li->type == DID_ERROR)
2281 Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
2282 "Drag & Drop Dialog");
2283 if (!li->type) {
[194]2284 FreeListInfo(li);
2285 return 0;
2286 }
[551]2287 li->list = cl.list;
[618]2288 if (!li->list || !li->list[0]) {
[194]2289 FreeListInfo(li);
2290 return 0;
2291 }
2292 }
[551]2293 switch (li->type) {
[194]2294 case DND_LAUNCH:
[551]2295 strcat(li->targetpath, " %a");
2296 ExecOnList(dcd->hwndParent, li->targetpath,
2297 PROMPT | WINDOWED, NULL, li->list, NULL);
2298 FreeList(li->list);
2299 li->list = NULL;
[194]2300 break;
2301 case DO_LINK:
[444]2302 if (fLinkSetsIcon) {
[551]2303 li->type = IDM_SETICON;
[194]2304 action = UM_MASSACTION;
2305 }
2306 else
[551]2307 li->type = IDM_COMPARE;
[194]2308 break;
2309 case DND_EXTRACT:
[551]2310 if (*li->targetpath && !IsFile(li->targetpath))
2311 li->type = IDM_EXTRACT;
[194]2312 break;
2313 case DND_MOVE:
[551]2314 li->type = IDM_MOVE;
2315 if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2316 action = UM_MASSACTION;
[551]2317 li->type = IDM_ARCHIVEM;
[194]2318 }
2319 break;
2320 case DND_WILDMOVE:
[551]2321 li->type = IDM_WILDMOVE;
2322 if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2323 action = UM_MASSACTION;
[551]2324 li->type = IDM_ARCHIVEM;
[194]2325 }
2326 break;
2327 case DND_OBJECT:
[551]2328 li->type = IDM_OBJECT;
[194]2329 action = UM_MASSACTION;
2330 break;
2331 case DND_SHADOW:
[551]2332 li->type = IDM_SHADOW;
[194]2333 action = UM_MASSACTION;
2334 break;
2335 case DND_COMPARE:
[551]2336 li->type = IDM_COMPARE;
[194]2337 break;
2338 case DND_SETICON:
2339 action = UM_MASSACTION;
[551]2340 li->type = IDM_SETICON;
[194]2341 break;
2342 case DND_WILDCOPY:
[551]2343 li->type = IDM_WILDCOPY;
2344 if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2345 action = UM_MASSACTION;
[551]2346 li->type = IDM_ARCHIVE;
[194]2347 }
2348 break;
2349 case DND_COPY:
[551]2350 li->type = IDM_COPY;
2351 if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2352 action = UM_MASSACTION;
[551]2353 li->type = IDM_ARCHIVE;
[194]2354 }
2355 break;
2356 default:
[551]2357 if (*li->arcname && li->info) {
[194]2358 action = UM_MASSACTION;
[551]2359 li->type =
2360 (li->type ==
2361 DO_MOVE) ? IDM_FAKEEXTRACTM : IDM_FAKEEXTRACT;
[194]2362 }
[551]2363 else if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2364 action = UM_MASSACTION;
[551]2365 li->type =
2366 (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
[194]2367 }
2368 else
[551]2369 li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
[194]2370 break;
2371 }
2372 }
[551]2373 if (!li->list || !li->list[0])
[194]2374 FreeListInfo(li);
[551]2375 else if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID))
[194]2376 FreeListInfo(li);
[444]2377 else {
[194]2378 USHORT usop = 0;
[2]2379
[551]2380 switch (li->type) {
[194]2381 case IDM_COPY:
2382 case IDM_WILDCOPY:
2383 usop = DO_COPY;
2384 break;
2385 case IDM_MOVE:
2386 case IDM_WILDMOVE:
2387 case IDM_ARCHIVEM:
2388 usop = DO_MOVE;
2389 break;
2390 }
2391 if (usop)
2392 return MRFROM2SHORT(DOR_DROP, usop);
2393 }
2394 }
2395 }
2396 return 0;
[2]2397
[194]2398 case CN_BEGINEDIT:
2399 case CN_REALLOCPSZ:
2400 case CN_ENDEDIT:
2401 {
2402 MRESULT mre;
[2]2403
[194]2404 mre = CnrDirectEdit(hwnd, msg, mp1, mp2);
2405 if (mre != (MRESULT) - 1)
2406 return mre;
2407 }
2408 break;
[2]2409
[194]2410 case CN_EMPHASIS:
[444]2411 if (mp2) {
[194]2412 PNOTIFYRECORDEMPHASIS pre = mp2;
2413 PCNRITEM pci;
2414 CHAR s[CCHMAXPATH + 91], tb[81], tf[81], *p;
[2]2415
[551]2416 pci = (PCNRITEM) ((pre) ? pre->pRecord : NULL);
[444]2417 if (!pci) {
[194]2418 if (hwndStatus2)
2419 WinSetWindowText(hwndStatus2, NullStr);
[444]2420 if (fMoreButtons) {
[194]2421 WinSetWindowText(hwndName, NullStr);
2422 WinSetWindowText(hwndDate, NullStr);
2423 WinSetWindowText(hwndAttr, NullStr);
2424 }
2425 if (hwndMain)
2426 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
2427 break;
2428 }
[551]2429 if (pre->fEmphasisMask & CRA_SELECTED) {
2430 if (pci->rc.flRecordAttr & CRA_SELECTED) {
2431 dcd->selectedbytes += (pci->cbFile + pci->easize);
2432 dcd->selectedfiles++;
[194]2433 }
[551]2434 else if (dcd->selectedfiles) {
2435 dcd->selectedbytes -= (pci->cbFile + pci->easize);
2436 dcd->selectedfiles--;
[194]2437 }
[551]2438 if (!dcd->suspendview) {
2439 commafmt(tf, sizeof(tf), dcd->selectedfiles);
2440 CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, ' ');
[194]2441 sprintf(s, "%s / %s", tf, tb);
[551]2442 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
[194]2443 }
2444 }
[551]2445 if (!dcd->suspendview &&
2446 WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame) {
2447 if (pre->fEmphasisMask & CRA_CURSORED) {
2448 if (pci->rc.flRecordAttr & CRA_CURSORED) {
[444]2449 if (fSplitStatus && hwndStatus2) {
[551]2450 if (pci->attrFile & FILE_DIRECTORY)
2451 p = pci->pszFileName;
[444]2452 else {
[551]2453 p = strrchr(pci->szFileName, '\\');
[444]2454 if (p) {
[194]2455 if (*(p + 1))
2456 p++;
2457 else
[551]2458 p = pci->pszFileName;
[194]2459 }
2460 else
[551]2461 p = pci->pszFileName;
[194]2462 }
[551]2463 CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
[194]2464 if (!fMoreButtons)
2465 sprintf(s, " %s %04u/%02u/%02u %02u:%02u:%02u [%s] %s",
[551]2466 tb, pci->date.year,
2467 pci->date.month, pci->date.day, pci->time.hours,
2468 pci->time.minutes, pci->time.seconds,
2469 pci->pszDispAttr, p);
[444]2470 else {
[551]2471 if (pci->cbFile + pci->easize > 1024)
2472 CommaFmtULL(tf, sizeof(tf), pci->cbFile + pci->easize,
2473 ' ');
[194]2474 else
2475 *tf = 0;
2476 sprintf(s, GetPString(IDS_STATUSSIZETEXT),
2477 tb,
[551]2478 *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
[194]2479 }
2480 WinSetWindowText(hwndStatus2, s);
2481 }
[444]2482 if (fMoreButtons) {
[551]2483 WinSetWindowText(hwndName, pci->pszFileName);
[194]2484 sprintf(s, "%04u/%02u/%02u %02u:%02u:%02u",
[551]2485 pci->date.year, pci->date.month,
2486 pci->date.day, pci->time.hours, pci->time.minutes,
2487 pci->time.seconds);
[194]2488 WinSetWindowText(hwndDate, s);
[551]2489 WinSetWindowText(hwndAttr, pci->pszDispAttr);
[194]2490 }
2491 }
2492 }
2493 }
[551]2494 if (!dcd->suspendview && hwndMain &&
2495 (pre->fEmphasisMask & CRA_CURSORED) &&
2496 (pci->rc.flRecordAttr & CRA_CURSORED) &&
2497 WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame)
[194]2498 WinSendMsg(hwndMain, UM_LOADFILE,
[551]2499 MPFROMP(((fComments
2500 || (pci->attrFile & FILE_DIRECTORY) ==
2501 0) ? pci->szFileName : NULL)), MPVOID);
[194]2502 }
2503 break;
[2]2504
[194]2505 case CN_ENTER:
[444]2506 if (mp2) {
[551]2507 PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
[194]2508 FILEFINDBUF3 ffb;
2509 HDIR hDir = HDIR_CREATE;
2510 ULONG nm = 1L;
2511 APIRET status = 0;
[2]2512
[194]2513 SetShiftState();
[444]2514 if (pci) {
[551]2515 if (pci->rc.flRecordAttr & CRA_INUSE)
[194]2516 break;
2517 DosError(FERR_DISABLEHARDERR);
[551]2518 status = DosFindFirst(pci->szFileName, &hDir,
[194]2519 FILE_NORMAL | FILE_DIRECTORY |
2520 FILE_ARCHIVED | FILE_READONLY |
2521 FILE_HIDDEN | FILE_SYSTEM,
[551]2522 &ffb, sizeof(ffb), &nm, FIL_STANDARD);
[194]2523 priority_bumped();
[444]2524 if (!status) {
[194]2525 DosFindClose(hDir);
[444]2526 if (ffb.attrFile & FILE_DIRECTORY) {
[551]2527 if ((shiftstate & (KC_CTRL | KC_ALT)) == (KC_CTRL | KC_ALT))
[194]2528 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SHOWALLFILES, 0),
2529 MPVOID);
2530 else if ((shiftstate & (KC_CTRL | KC_SHIFT)) ==
2531 (KC_CTRL | KC_SHIFT))
[551]2532 OpenObject(pci->szFileName, Settings, dcd->hwndFrame);
[194]2533 else if (shiftstate & KC_CTRL)
[551]2534 OpenObject(pci->szFileName, Default, dcd->hwndFrame);
[194]2535 else
[280]2536 OpenDirCnr(HWND_DESKTOP,
[194]2537 hwndMain,
[551]2538 dcd->hwndFrame, FALSE, pci->szFileName);
[194]2539 }
[444]2540 else {
[194]2541 SWP swp;
[2]2542
[194]2543 WinSendMsg(hwnd,
2544 CM_SETRECORDEMPHASIS,
[551]2545 MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_INUSE));
2546 WinQueryWindowPos(dcd->hwndFrame, &swp);
[194]2547 DefaultViewKeys(hwnd,
[551]2548 dcd->hwndFrame,
2549 dcd->hwndParent, &swp, pci->szFileName);
[194]2550 WinSendMsg(hwnd,
2551 CM_SETRECORDEMPHASIS,
2552 MPFROMP(pci),
2553 MPFROM2SHORT(FALSE, CRA_INUSE |
2554 ((fUnHilite) ? CRA_SELECTED : 0)));
2555 }
2556 }
2557 else
2558 WinSendMsg(hwnd,
2559 CM_REMOVERECORD,
2560 MPFROMP(&pci),
2561 MPFROM2SHORT(1,
[471]2562 CMA_FREE | CMA_INVALIDATE | CMA_ERASE));
[194]2563 }
2564 }
2565 break;
[2]2566 }
[194]2567 }
2568 return 0;
[2]2569
[194]2570 case UM_LOADFILE:
[444]2571 if (dcd && mp2) {
[194]2572 HWND ret;
[2]2573
[551]2574 ret = StartMLEEditor(dcd->hwndParent,
2575 (INT) mp1, (CHAR *) mp2, dcd->hwndFrame);
[194]2576 if (mp2)
2577 free((CHAR *) mp2);
2578 return MRFROMLONG(ret);
2579 }
2580 return 0;
[2]2581
[194]2582 case UM_CLOSE:
2583 WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
2584 QW_PARENT));
2585 return 0;
[2]2586
[194]2587 case UM_FOLDUP:
[551]2588 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
[194]2589 DosExit(EXIT_PROCESS, 1);
2590 return 0;
[2]2591
[194]2592 case WM_CLOSE:
[444]2593 if (dcd) {
[551]2594 dcd->namecanchange = TRUE;
2595 dcd->stopflag = 1;
2596 if (dcd->amextracted)
2597 return 0; // Can not close yet
[194]2598 }
2599 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
[444]2600 if (dcd) {
[551]2601 if (!dcd->dontclose && ParentIsDesktop(hwnd, dcd->hwndParent))
[194]2602 PostMsg(hwnd, UM_FOLDUP, MPVOID, MPVOID);
[551]2603 if (dcd->hwndObject) {
[194]2604 DosSleep(64L);
[551]2605 if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
2606 WinSendMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID);
[2]2607 }
[194]2608 }
2609 else
2610 WinSendMsg(hwnd, UM_CLOSE, MPVOID, MPVOID);
2611 return 0;
[2]2612
[194]2613 case WM_DESTROY:
2614 if (CollectorDirMenu)
2615 WinDestroyWindow(CollectorDirMenu);
2616 if (CollectorFileMenu)
2617 WinDestroyWindow(CollectorFileMenu);
2618 if (CollectorCnrMenu)
2619 WinDestroyWindow(CollectorCnrMenu);
[551]2620 CollectorCnrMenu = CollectorFileMenu = CollectorDirMenu = (HWND) 0;
2621 Collector = (HWND) 0;
[194]2622 EmptyCnr(hwnd);
2623 break;
[2]2624 }
[705]2625 if (dcd && dcd->oldproc){
2626 return dcd->oldproc(hwnd, msg, mp1, mp2);
2627 }
2628 else
2629 return PFNWPCnr(hwnd, msg, mp1, mp2);
[2]2630}
2631
[194]2632HWND StartCollector(HWND hwndParent, INT flags)
[155]2633{
[551]2634 HWND hwndFrame = (HWND) 0;
[197]2635 HWND hwndClient;
[194]2636 ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
[551]2637 FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_NOBYTEALIGN | FCF_ACCELTABLE;
[194]2638 USHORT id;
2639 DIRCNRDATA *dcd;
[2]2640
[197]2641 static USHORT idinc = 0;
2642
[194]2643 if (ParentIsDesktop(hwndParent, hwndParent))
[2]2644 FrameFlags |= (FCF_TASKLIST | FCF_SHELLPOSITION | FCF_MENU);
[444]2645 if (Collector) {
[2]2646 WinSetWindowPos(WinQueryWindow(WinQueryWindow(Collector,
[194]2647 QW_PARENT),
2648 QW_PARENT),
[551]2649 HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE);
2650 return WinQueryWindow(WinQueryWindow(Collector, QW_PARENT), QW_PARENT);
[2]2651 }
2652 hwndFrame = WinCreateStdWindow(hwndParent,
[194]2653 WS_VISIBLE,
2654 &FrameFlags,
[593]2655 WC_COLLECTOR,
[194]2656 NULL,
2657 WS_VISIBLE | fwsAnimate,
[551]2658 FM3ModHandle, COLLECTOR_FRAME, &hwndClient);
[444]2659 if (hwndFrame && hwndClient) {
[2]2660 id = COLLECTOR_FRAME + idinc++;
[194]2661 WinSetWindowUShort(hwndFrame, QWS_ID, id);
[551]2662 dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__);
[377]2663 if (!dcd) {
2664 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
[551]2665 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
2666 hwndFrame = (HWND) 0;
[377]2667 }
2668 else {
[551]2669 dcd->size = sizeof(DIRCNRDATA);
2670 dcd->id = id;
2671 dcd->type = COLLECTOR_FRAME;
2672 dcd->hwndParent = (hwndParent) ? hwndParent : HWND_DESKTOP;
2673 dcd->hwndFrame = hwndFrame;
2674 dcd->hwndClient = hwndClient;
[194]2675 if (flags & 4)
[551]2676 dcd->dontclose = TRUE;
[2]2677 {
[194]2678 PFNWP oldproc;
[2]2679
[551]2680 oldproc = WinSubclassWindow(hwndFrame, (PFNWP) CollectorFrameWndProc);
2681 WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
[2]2682 }
[551]2683 dcd->hwndCnr = WinCreateWindow(hwndClient,
2684 WC_CONTAINER,
2685 NULL,
2686 CCS_AUTOPOSITION | CCS_MINIICONS |
2687 CCS_MINIRECORDCORE | ulCnrType |
2688 WS_VISIBLE,
2689 0,
2690 0,
2691 0,
2692 0,
2693 hwndClient,
2694 HWND_TOP,
2695 (ULONG) COLLECTOR_CNR, NULL, NULL);
2696 if (!dcd->hwndCnr) {
2697 Win_Error2(hwndClient, hwndClient, pszSrcFile, __LINE__,
2698 IDS_WINCREATEWINDOW);
2699 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
[377]2700 free(dcd);
[551]2701 hwndFrame = (HWND) 0;
[377]2702 }
2703 else {
[551]2704 Collector = dcd->hwndCnr;
2705 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
2706 WinSetWindowText(hwndFrame, GetPString(IDS_COLLECTORTITLETEXT));
[444]2707 if (FrameFlags & FCF_MENU) {
2708 if (!fToolbar) {
[194]2709 HWND hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
[2]2710
[444]2711 if (hwndMenu) {
[194]2712 WinSendMsg(hwndMenu,
2713 MM_DELETEITEM,
[551]2714 MPFROM2SHORT(IDM_SEEALL, FALSE), MPVOID);
[194]2715 WinSendMsg(hwndMenu,
2716 MM_DELETEITEM,
[551]2717 MPFROM2SHORT(IDM_GREP, FALSE), MPVOID);
[194]2718 WinSendMsg(hwndMenu,
2719 MM_DELETEITEM,
[551]2720 MPFROM2SHORT(IDM_CLEARCNR, FALSE), MPVOID);
[194]2721 WinSendMsg(hwndMenu,
2722 MM_DELETEITEM,
[551]2723 MPFROM2SHORT(IDM_REMOVE, FALSE), MPVOID);
[194]2724 }
2725 }
2726 }
[551]2727 dcd->oldproc = WinSubclassWindow(dcd->hwndCnr,
2728 (PFNWP) CollectorCnrWndProc);
[194]2729 {
[551]2730 USHORT ids[] = { DIR_TOTALS, DIR_SELECTED, DIR_VIEW, DIR_SORT,
2731 DIR_FILTER, 0
2732 };
[2]2733
[551]2734 CommonCreateTextChildren(dcd->hwndClient,
[593]2735 WC_COLSTATUS, ids);
[194]2736 }
2737 if (FrameFlags & FCF_SHELLPOSITION)
[551]2738 PostMsg(hwndClient, UM_SIZE, MPVOID, MPVOID);
2739 if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
2740 WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
[2]2741 }
2742 }
2743 }
2744 return hwndFrame;
2745}
Note: See TracBrowser for help on using the repository browser.