source: trunk/dll/collect.c@ 689

Last change on this file since 689 was 689, checked in by Steven Levine, 18 years ago

Commit OpenWatcom compatibility updates

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