source: trunk/dll/collect.c@ 687

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

Add CheckPmDrgLimit function to fix crash when dragging to FM/2 for other apps

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 70.5 KB
RevLine 
[96]1
2/***********************************************************************
3
4 $Id: collect.c 687 2007-06-10 20:41:52Z 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
[96]37
38***********************************************************************/
39
[2]40#define INCL_DOS
41#define INCL_WIN
42#define INCL_GPI
43#define INCL_DOSERRORS
[155]44#define INCL_LONGLONG
45#include <os2.h>
[2]46
47#include <stdarg.h>
48#include <stdio.h>
49#include <stdlib.h>
50#include <string.h>
51#include <ctype.h>
52#include <time.h>
53#include <share.h>
54#include <limits.h>
[155]55
[2]56#include "fm3dll.h"
57#include "fm3dlg.h"
58#include "fm3str.h"
59#include "mle.h"
60#include "grep.h"
61
62#pragma data_seg(DATA1)
[352]63
64static PSZ pszSrcFile = __FILE__;
65
[2]66#pragma alloc_text(COLLECTOR,CollectorCnrWndProc,CollectorObjWndProc)
67#pragma alloc_text(COLLECTOR,CollectorClientWndProc,CollectorTextProc)
68#pragma alloc_text(COLLECTOR,CollectorFrameWndProc)
69#pragma alloc_text(STARTUP,StartCollector)
70
[194]71MRESULT EXPENTRY CollectorFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
72 MPARAM mp2)
73{
74 return CommonFrameWndProc(COLLECTOR_CNR, hwnd, msg, mp1, mp2);
[2]75}
76
[551]77MRESULT EXPENTRY CollectorTextProc(HWND hwnd, ULONG msg, MPARAM mp1,
78 MPARAM mp2)
[96]79{
[197]80 DIRCNRDATA *dcd;
[155]81
[194]82 static BOOL emphasized = FALSE;
[551]83 static HWND hwndButtonPopup = (HWND) 0;
[194]84 static ULONG timestamp = ULONG_MAX;
85 static USHORT lastid = 0;
[2]86
[444]87 switch (msg) {
[194]88 case WM_CREATE:
89 return CommonTextProc(hwnd, msg, mp1, mp2);
[2]90
[194]91 case UM_CONTEXTMENU:
92 case WM_CONTEXTMENU:
93 {
94 USHORT id;
95
96 id = WinQueryWindowUShort(hwnd, QWS_ID);
[444]97 switch (id) {
[194]98 case DIR_SELECTED:
99 case DIR_VIEW:
100 case DIR_SORT:
101 {
[551]102 POINTL ptl = { 0, 0 };
[194]103 SWP swp;
[2]104
[194]105 if (hwndButtonPopup)
106 WinDestroyWindow(hwndButtonPopup);
[444]107 if (id == lastid) {
[194]108 ULONG check;
[2]109
[194]110 DosQuerySysInfo(QSV_MS_COUNT,
[551]111 QSV_MS_COUNT, &check, sizeof(check));
[444]112 if (check < timestamp + 500) {
[194]113 lastid = 0;
114 goto MenuAbort;
115 }
116 }
[551]117 hwndButtonPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
[444]118 if (hwndButtonPopup) {
[551]119 WinSetWindowUShort(hwndButtonPopup, QWS_ID, id);
[194]120 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
[352]121 QW_PARENT),
[551]122 COLLECTOR_CNR), QWL_USER);
[444]123 if (id == DIR_VIEW) {
124 if (dcd) {
[551]125 SetViewMenu(hwndButtonPopup, dcd->flWindowAttr);
126 SetDetailsSwitches(hwndButtonPopup, dcd);
[194]127 }
[2]128
[194]129 /* don't have tree view in collector */
130 WinSendMsg(hwndButtonPopup,
131 MM_DELETEITEM,
[551]132 MPFROM2SHORT(IDM_TREEVIEW, FALSE), MPVOID);
[2]133
[194]134 }
[444]135 else if (id == DIR_SORT) {
[194]136 if (dcd)
[551]137 SetSortChecks(hwndButtonPopup, dcd->sortFlags);
[194]138 }
139 ptl.x = 0;
140 if (WinPopupMenu(HWND_OBJECT,
141 HWND_OBJECT,
[551]142 hwndButtonPopup, -32767, -32767, 0, 0)) {
143 WinQueryWindowPos(hwndButtonPopup, &swp);
[194]144 ptl.y = -(swp.cy + 2);
145 }
[444]146 else {
[551]147 WinQueryWindowPos(hwnd, &swp);
[194]148 ptl.y = swp.cy + 2;
149 }
150 if (WinPopupMenu(hwnd,
151 hwnd,
152 hwndButtonPopup,
153 ptl.x,
154 ptl.y,
155 0,
156 PU_HCONSTRAIN | PU_VCONSTRAIN |
[551]157 PU_KEYBOARD | PU_MOUSEBUTTON1)) {
[194]158 CenterOverWindow(hwndButtonPopup);
[551]159 PaintRecessedWindow(hwnd, NULLHANDLE, FALSE, FALSE);
[194]160 }
161 }
162 }
163 break;
164 default:
165 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
166 COLLECTOR_CNR),
167 WM_CONTROL,
[551]168 MPFROM2SHORT(COLLECTOR_CNR, CN_CONTEXTMENU), MPVOID);
[194]169 break;
[2]170 }
[194]171 }
172 MenuAbort:
173 if (msg == UM_CONTEXTMENU)
174 return 0;
175 break;
[2]176
[194]177 case WM_MENUEND:
[551]178 if (hwndButtonPopup == (HWND) mp2) {
179 lastid = WinQueryWindowUShort((HWND) mp2, QWS_ID);
[194]180 WinDestroyWindow(hwndButtonPopup);
[551]181 hwndButtonPopup = (HWND) 0;
182 DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &timestamp,
183 sizeof(timestamp));
[444]184 switch (lastid) {
[194]185 case DIR_SELECTED:
186 case DIR_VIEW:
187 case DIR_SORT:
[551]188 PaintRecessedWindow(hwnd, NULLHANDLE, TRUE, FALSE);
[194]189 break;
[2]190 }
[194]191 }
192 break;
[2]193
[194]194 case WM_COMMAND:
195 {
196 DIRCNRDATA *dcd;
197 MRESULT mr;
198
199 mr = WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,
200 QW_PARENT),
[551]201 COLLECTOR_CNR), msg, mp1, mp2);
[194]202 if (hwndButtonPopup &&
203 SHORT1FROMMP(mp1) > IDM_DETAILSTITLES &&
[551]204 SHORT1FROMMP(mp1) < IDM_DETAILSSETUP) {
[194]205 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
206 QW_PARENT),
[551]207 COLLECTOR_CNR), QWL_USER);
[194]208 if (dcd)
[551]209 SetDetailsSwitches(hwndButtonPopup, dcd);
[2]210 }
[194]211 return mr;
212 }
[2]213
[194]214 case WM_MOUSEMOVE:
215 {
216 USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
217 char *s = NULL;
218
[444]219 if (fOtherHelp) {
[194]220 if ((!hwndBubble ||
221 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
[551]222 !WinQueryCapture(HWND_DESKTOP)) {
[444]223 switch (id) {
[194]224 case DIR_SELECTED:
225 s = GetPString(IDS_COLSELECTEDHELP);
226 break;
227 case DIR_TOTALS:
228 s = GetPString(IDS_COLTOTALSHELP);
229 break;
230 case DIR_VIEW:
231 s = GetPString(IDS_DIRCNRVIEWHELP);
232 break;
233 case DIR_SORT:
234 s = GetPString(IDS_DIRCNRSORTHELP);
235 break;
236 case DIR_FILTER:
237 s = GetPString(IDS_DIRCNRFILTERHELP);
238 break;
239 default:
240 break;
241 }
242 if (s)
243 MakeBubble(hwnd, TRUE, s);
244 else if (hwndBubble)
245 WinDestroyWindow(hwndBubble);
246 }
[2]247 }
[444]248 switch (id) {
[194]249 case DIR_FILTER:
250 case DIR_SORT:
251 case DIR_VIEW:
252 case DIR_SELECTED:
253 return CommonTextButton(hwnd, msg, mp1, mp2);
254 }
255 }
256 break;
[2]257
[194]258 case WM_BUTTON3UP:
259 case WM_BUTTON1UP:
260 case WM_BUTTON3DOWN:
261 case WM_BUTTON1DOWN:
262 {
263 USHORT id;
264
[280]265 id = WinQueryWindowUShort(hwnd, QWS_ID);
[444]266 switch (id) {
[194]267 case DIR_FILTER:
268 case DIR_SORT:
269 case DIR_VIEW:
270 case DIR_SELECTED:
271 return CommonTextButton(hwnd, msg, mp1, mp2);
[2]272 }
[194]273 }
274 break;
[2]275
[194]276 case UM_CLICKED:
277 case UM_CLICKED3:
278 {
279 USHORT id, cmd = 0;
280
[280]281 id = WinQueryWindowUShort(hwnd, QWS_ID);
[444]282 switch (id) {
[194]283 case DIR_VIEW:
284 case DIR_SORT:
285 case DIR_SELECTED:
[551]286 PostMsg(hwnd, UM_CONTEXTMENU, MPVOID, MPVOID);
[194]287 break;
288 case DIR_FILTER:
289 cmd = IDM_FILTER;
290 break;
291 default:
292 break;
[2]293 }
[194]294 if (cmd)
[551]295 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
[194]296 COLLECTOR_CNR),
[551]297 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
[194]298 }
299 return 0;
[2]300
[194]301 case DM_DROP:
302 case DM_DRAGOVER:
303 case DM_DRAGLEAVE:
304 case DM_DROPHELP:
[444]305 if (msg == DM_DRAGOVER) {
306 if (!emphasized) {
[194]307 emphasized = TRUE;
308 DrawTargetEmphasis(hwnd, emphasized);
[2]309 }
[194]310 }
[444]311 else {
312 if (emphasized) {
[194]313 emphasized = FALSE;
314 DrawTargetEmphasis(hwnd, emphasized);
[2]315 }
[194]316 }
317 {
318 CNRDRAGINFO cnd;
319 USHORT dcmd;
320
[444]321 switch (msg) {
[194]322 case DM_DROP:
323 dcmd = CN_DROP;
324 break;
325 case DM_DRAGOVER:
326 dcmd = CN_DRAGOVER;
327 break;
328 case DM_DRAGLEAVE:
329 dcmd = CN_DRAGLEAVE;
330 break;
331 case DM_DROPHELP:
332 dcmd = CN_DROPHELP;
333 break;
[2]334 }
[194]335 memset(&cnd, 0, sizeof(cnd));
336 cnd.pDragInfo = (PDRAGINFO) mp1;
337 cnd.pRecord = NULL;
338 return WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_CONTROL,
339 MPFROM2SHORT(COLLECTOR_CNR, dcmd), MPFROMP(&cnd));
340 }
[2]341 }
[194]342 return PFNWPStatic(hwnd, msg, mp1, mp2);
[2]343}
344
[194]345MRESULT EXPENTRY CollectorClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
346 MPARAM mp2)
347{
[444]348 switch (msg) {
[194]349 case UM_CONTAINERHWND:
350 return MRFROMLONG(WinWindowFromID(hwnd, COLLECTOR_CNR));
[2]351
[194]352 case UM_VIEWSMENU:
353 return MRFROMLONG(CheckMenu(&CollectorCnrMenu, COLLECTORCNR_POPUP));
[2]354
[194]355 case MM_PORTHOLEINIT:
356 case WM_INITMENU:
357 case UM_INITMENU:
358 case UM_CONTAINER_FILLED:
359 case UM_FILESMENU:
360 case UM_UPDATERECORD:
361 case UM_UPDATERECORDLIST:
362 return WinSendMsg(WinWindowFromID(hwnd, COLLECTOR_CNR), msg, mp1, mp2);
[2]363
[194]364 case WM_PSETFOCUS:
365 case WM_SETFOCUS:
366 if (mp2)
367 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
368 break;
[2]369
[194]370 case UM_FOCUSME:
371 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, COLLECTOR_CNR));
372 break;
[2]373
[194]374 case WM_PAINT:
375 {
376 HPS hps;
377 RECTL rcl;
[2]378
[280]379 hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
[444]380 if (hps) {
[194]381 WinQueryWindowRect(hwnd, &rcl);
382 WinFillRect(hps, &rcl, CLR_PALEGRAY);
383 CommonTextPaint(hwnd, hps);
384 WinEndPaint(hps);
[2]385 }
[194]386 }
387 break;
[2]388
[194]389 case UM_SIZE:
390 case WM_SIZE:
[444]391 if (msg == UM_SIZE) {
[194]392 SWP swp;
[2]393
[194]394 WinQueryWindowPos(hwnd, &swp);
395 mp1 = MPFROM2SHORT(swp.cx, swp.cy);
396 mp2 = MPFROM2SHORT(swp.cx, swp.cy);
397 }
398 {
399 USHORT cx, cy, bx;
[2]400
[194]401 cx = SHORT1FROMMP(mp2);
402 cy = SHORT2FROMMP(mp2);
403 WinSetWindowPos(WinWindowFromID(hwnd, COLLECTOR_CNR), HWND_TOP,
[551]404 0, 0, cx, cy - 24, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]405 WinSetWindowPos(WinWindowFromID(hwnd, DIR_TOTALS), HWND_TOP,
406 2,
407 cy - 22,
[551]408 (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]409 WinSetWindowPos(WinWindowFromID(hwnd, DIR_SELECTED), HWND_TOP,
410 2 + (cx / 3) + 2,
411 cy - 22,
[551]412 (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]413 bx = (cx - (2 + (((cx / 3) + 2) * 2))) / 3;
414 WinSetWindowPos(WinWindowFromID(hwnd, DIR_VIEW), HWND_TOP,
415 2 + (((cx / 3) + 2) * 2),
[551]416 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]417 WinSetWindowPos(WinWindowFromID(hwnd, DIR_SORT), HWND_TOP,
418 2 + (((cx / 3) + 2) * 2) + bx,
[551]419 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]420 WinSetWindowPos(WinWindowFromID(hwnd, DIR_FILTER), HWND_TOP,
421 2 + (((cx / 3) + 2) * 2) + (bx * 2),
[551]422 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]423 }
[280]424 CommonTextPaint(hwnd, NULLHANDLE);
[444]425 if (msg == UM_SIZE) {
[194]426 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
427 SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE);
428 return 0;
429 }
430 break;
[2]431
[194]432 case UM_COMMAND:
433 case WM_COMMAND:
434 case WM_CONTROL:
435 case WM_CLOSE:
436 return WinSendMsg(WinWindowFromID(hwnd, COLLECTOR_CNR), msg, mp1, mp2);
[2]437 }
[194]438 return WinDefWindowProc(hwnd, msg, mp1, mp2);
[2]439}
440
[194]441MRESULT EXPENTRY CollectorObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
442 MPARAM mp2)
443{
[197]444 ULONG size;
[2]445 DIRCNRDATA *dcd;
[672]446 DIRCNRDATA *dcdsrc;
[2]447
[444]448 switch (msg) {
[194]449 case WM_CREATE:
450 break;
[2]451
[194]452 case DM_PRINTOBJECT:
453 return MRFROMLONG(DRR_TARGET);
[2]454
[194]455 case DM_DISCARDOBJECT:
456 dcd = INSTDATA(hwnd);
[444]457 if (fFM2Deletes && dcd) {
[194]458 LISTINFO *li;
459 CNRDRAGINFO cni;
[2]460
[194]461 cni.pRecord = NULL;
462 cni.pDragInfo = (PDRAGINFO) mp1;
[551]463 li = DoFileDrop(dcd->hwndCnr, NULL, FALSE, MPVOID, MPFROMP(&cni));
[687]464 CheckPmDrgLimit(cni.pDragInfo);
[444]465 if (li) {
[672]466 li->type = fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE;
[194]467 if (!PostMsg(hwnd, UM_MASSACTION, MPFROMP(li), MPVOID))
468 FreeListInfo(li);
469 else
470 return MRFROMLONG(DRR_SOURCE);
[2]471 }
[194]472 }
473 return MRFROMLONG(DRR_TARGET);
[2]474
[194]475 case UM_UPDATERECORDLIST:
476 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]477 if (dcd && mp1) {
[194]478 INT numentries = 0;
479 CHAR **list = (CHAR **) mp1;
[2]480
[194]481 while (list[numentries])
482 numentries++;
483 if (numentries)
[551]484 UpdateCnrList(dcd->hwndCnr, list, numentries, FALSE, dcd);
[194]485 }
486 return 0;
[2]487
[194]488 case UM_SETUP:
489 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]490 if (dcd) {
[194]491 /* set unique id */
492 WinSetWindowUShort(hwnd,
493 QWS_ID,
[551]494 COLLECTOROBJ_FRAME + (COLLECTOR_FRAME - dcd->id));
495 dcd->hwndObject = hwnd;
496 if (ParentIsDesktop(hwnd, dcd->hwndParent))
[194]497 DosSleep(250L);
498 }
499 else
500 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
501 return 0;
[2]502
[194]503 case UM_COMMAND:
[444]504 if (mp1) {
[194]505 LISTINFO *li = (LISTINFO *) mp1;
506
[551]507 switch (li->type) {
[194]508 case IDM_DOITYOURSELF:
509 case IDM_APPENDTOCLIP:
510 case IDM_SAVETOCLIP:
511 case IDM_ARCHIVE:
512 case IDM_ARCHIVEM:
513 case IDM_VIEW:
514 case IDM_VIEWTEXT:
515 case IDM_VIEWBINARY:
516 case IDM_VIEWARCHIVE:
517 case IDM_EDIT:
518 case IDM_EDITTEXT:
519 case IDM_EDITBINARY:
520 case IDM_OBJECT:
521 case IDM_SHADOW:
522 case IDM_SHADOW2:
523 case IDM_PRINT:
524 case IDM_ATTRS:
525 case IDM_DELETE:
526 case IDM_PERMDELETE:
527 case IDM_FAKEEXTRACT:
528 case IDM_FAKEEXTRACTM:
529 case IDM_MCIPLAY:
530 case IDM_UPDATE:
531 if (PostMsg(hwnd, UM_MASSACTION, mp1, mp2))
532 return (MRESULT) TRUE;
533 break;
534 default:
535 if (PostMsg(hwnd, UM_ACTION, mp1, mp2))
536 return (MRESULT) TRUE;
[2]537 }
[194]538 }
539 return 0;
[2]540
[194]541 case UM_COLLECT:
542 DosError(FERR_DISABLEHARDERR);
543 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]544 if (dcd) {
[194]545 LISTINFO *li = (LISTINFO *) mp1;
546 INT x;
547 FILEFINDBUF4 fb4;
548 HDIR hdir;
549 ULONG nm;
550 PCNRITEM pci, pciFirst, pciT, pciP = NULL;
551 RECORDINSERT ri;
552 ULONG ulMaxFiles;
553 ULONGLONG ullTotalBytes;
554 CHAR fullname[CCHMAXPATH];
[2]555
[551]556 WinSetWindowText(WinWindowFromID(dcd->hwndClient, DIR_SELECTED),
[194]557 GetPString(IDS_COLLECTINGTEXT));
[551]558 for (ulMaxFiles = 0; li->list[ulMaxFiles]; ulMaxFiles++) ; // Count
[352]559
560 if (ulMaxFiles) {
[551]561 pci = WinSendMsg(dcd->hwndCnr, CM_ALLOCRECORD,
[194]562 MPFROMLONG(EXTRA_RECORD_BYTES),
563 MPFROMLONG(ulMaxFiles));
[403]564 if (!pci) {
[551]565 Runtime_Error(pszSrcFile, __LINE__, "CM_ALLOCRECORD %u failed",
566 ulMaxFiles);
[352]567 break;
568 }
569 else {
[194]570 pciFirst = pci;
[551]571 for (x = 0; li->list[x]; x++) {
[194]572 nm = 1L;
573 hdir = HDIR_CREATE;
574 DosError(FERR_DISABLEHARDERR);
[551]575 if (*li->list[x] &&
576 !DosQueryPathInfo(li->list[x], FIL_QUERYFULLNAME,
[194]577 fullname, sizeof(fullname)) &&
578 !IsRoot(fullname) &&
[551]579 !FindCnrRecord(dcd->hwndCnr,
[194]580 fullname,
581 NULL,
582 FALSE,
583 FALSE,
584 TRUE) &&
585 !DosFindFirst(fullname,
586 &hdir,
587 FILE_NORMAL | FILE_DIRECTORY |
588 FILE_ARCHIVED | FILE_SYSTEM |
589 FILE_HIDDEN | FILE_READONLY,
[551]590 &fb4, sizeof(fb4), &nm, FIL_QUERYEASIZE)) {
[194]591 DosFindClose(hdir);
592 priority_normal();
593 *fb4.achName = 0;
[551]594 ullTotalBytes = FillInRecordFromFFB(dcd->hwndCnr,
[194]595 pci,
[551]596 fullname, &fb4, FALSE, dcd);
597 dcd->ullTotalBytes += ullTotalBytes;
[194]598 pciP = pci;
[551]599 pci = (PCNRITEM) pci->rc.preccNextRecord;
[194]600 }
[444]601 else {
[194]602 pciT = pci;
[551]603 pci = (PCNRITEM) pci->rc.preccNextRecord;
[194]604 if (pciP)
[551]605 pciP->rc.preccNextRecord = (PMINIRECORDCORE) pci;
[194]606 else
607 pciFirst = pci;
[551]608 WinSendMsg(hwnd, CM_FREERECORD, MPFROMP(&pciT),
609 MPFROM2SHORT(1, 0));
[194]610 ulMaxFiles--;
611 }
612 DosSleep(1L);
613 }
[444]614 if (ulMaxFiles) {
[194]615 memset(&ri, 0, sizeof(RECORDINSERT));
616 ri.cb = sizeof(RECORDINSERT);
617 ri.pRecordOrder = (PRECORDCORE) CMA_END;
618 ri.pRecordParent = (PRECORDCORE) 0;
619 ri.zOrder = (ULONG) CMA_TOP;
620 ri.cRecordsInsert = ulMaxFiles;
621 ri.fInvalidateRecord = TRUE;
[551]622 WinSendMsg(dcd->hwndCnr,
623 CM_INSERTRECORD, MPFROMP(pciFirst), MPFROMP(&ri));
624 PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
[194]625 }
626 }
[2]627 }
[194]628 }
[551]629 if (dcd->flWindowAttr & CV_DETAIL)
[194]630 WinSendDlgItemMsg(hwnd,
631 COLLECTOR_CNR,
632 CM_INVALIDATERECORD,
[551]633 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
[194]634 return 0;
[2]635
[194]636 case UM_COLLECTFROMFILE:
637 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[403]638 if (dcd && mp1) {
[194]639 FILESTATUS4 fs4;
640 PCNRITEM pci;
641 RECORDINSERT ri;
642 CHAR fullname[1024], *p;
643 FILE *fp;
644 ULONG errs = 0L;
[444]645 BOOL first = FALSE;
646 size_t c;
[2]647
[194]648 fp = _fsopen((CHAR *) mp1, "r", SH_DENYNO);
[403]649 if (fp) {
650 while (!feof(fp)) {
[444]651 // Avoid too much noise if collecting from binary file - oops
652 if (!fgets(fullname, sizeof(fullname), fp)) {
653 if (ferror(fp))
654 Runtime_Error(pszSrcFile, __LINE__, "fgets");
[194]655 break;
656 }
[444]657
658 c = strlen(fullname);
659 if (c + 1 >= sizeof(fullname))
660 errs++;
[551]661 else if (!c || (fullname[c - 1] != '\n' && fullname[c - 1] != '\r'))
[444]662 errs++;
[403]663 else {
[444]664 bstripcr(fullname);
665
666 if (*fullname == '\"') {
667 memmove(fullname, fullname + 1, strlen(fullname) + 1);
668 lstrip(fullname);
669 p = strchr(fullname, '\"');
670 if (p)
671 *p = 0;
672 rstrip(fullname);
673 }
674 else {
675 p = strchr(fullname, ' ');
676 if (p)
677 *p = 0;
678 }
679 /* fullname now contains name of file to collect */
680 DosError(FERR_DISABLEHARDERR);
681 if (IsFullName(fullname) &&
682 !IsRoot(fullname) &&
683 !DosQueryPathInfo(fullname,
684 FIL_QUERYEASIZE,
685 &fs4,
686 sizeof(fs4)) &&
[551]687 !FindCnrRecord(dcd->hwndCnr,
688 fullname, NULL, FALSE, FALSE, TRUE)) {
[444]689 /* collect it */
[551]690 pci = WinSendMsg(dcd->hwndCnr,
[444]691 CM_ALLOCRECORD,
692 MPFROMLONG(EXTRA_RECORD_BYTES),
693 MPFROMLONG(1L));
694 if (pci) {
[551]695 dcd->ullTotalBytes += FillInRecordFromFSA(dcd->hwndCnr, pci,
696 fullname,
697 &fs4, FALSE, dcd);
[444]698 memset(&ri, 0, sizeof(RECORDINSERT));
699 ri.cb = sizeof(RECORDINSERT);
700 ri.pRecordOrder = (PRECORDCORE) CMA_END;
701 ri.pRecordParent = (PRECORDCORE) 0;
702 ri.zOrder = (ULONG) CMA_TOP;
703 ri.cRecordsInsert = 1L;
704 ri.fInvalidateRecord = TRUE;
[551]705 WinSendMsg(dcd->hwndCnr, CM_INSERTRECORD,
[444]706 MPFROMP(pci), MPFROMP(&ri));
707 }
[194]708 }
[444]709 else
710 errs++;
[194]711 }
[444]712 if (errs > (first ? 0 : 50)) {
713 /* prevent runaway on bad file */
[551]714 APIRET ret = saymsg(MB_YESNO, dcd->hwndCnr,
[444]715 GetPString(IDS_COLLECTNOLISTHDRTEXT),
716 GetPString(IDS_COLLECTNOLISTTEXT),
[551]717 (CHAR *) mp1);
718
[444]719 if (ret == MBID_NO)
720 break;
721 if (!first)
722 errs = 0;
723 else
724 first = FALSE;
[194]725 }
[551]726 } // while not eof
[194]727 fclose(fp);
[2]728 }
[194]729 }
[403]730 xfree(mp1);
[194]731 return 0;
[2]732
[194]733 case UM_SELECT:
734 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]735 if (dcd) {
736 switch (SHORT1FROMMP(mp1)) {
[194]737 case IDM_SELECTLIST:
738 {
739 CHAR filename[CCHMAXPATH], *p, *pp;
[2]740
[194]741 strcpy(filename, "*.LST");
742 size = CCHMAXPATH;
[551]743 PrfQueryProfileData(fmprof, appname, "SaveToListName", filename,
744 &size);
[194]745 pp = strrchr(filename, '\\');
746 if (!pp)
747 pp = filename;
748 p = strrchr(pp, '.');
[444]749 if (p && *(p + 1) && p > pp + 1) {
[194]750 if (pp > filename)
751 pp++;
752 *pp = '*';
753 pp++;
754 if (p > pp)
755 memmove(pp, p, strlen(p) + 1);
756 }
757 if (insert_filename(hwnd, filename, FALSE, FALSE))
[551]758 SelectList(dcd->hwndCnr, TRUE, FALSE, FALSE, NULL, filename,
759 NULL);
[194]760 }
761 break;
762 case IDM_SELECTALL:
[551]763 SelectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
[194]764 break;
765 case IDM_DESELECTALL:
[551]766 DeselectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
[194]767 break;
768 case IDM_SELECTALLFILES:
[551]769 SelectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
[194]770 break;
771 case IDM_DESELECTALLFILES:
[551]772 DeselectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
[194]773 break;
774 case IDM_SELECTALLDIRS:
[551]775 SelectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
[194]776 break;
777 case IDM_DESELECTALLDIRS:
[551]778 DeselectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
[194]779 break;
780 case IDM_DESELECTMASK:
781 case IDM_SELECTMASK:
782 {
783 MASK mask;
784 PCNRITEM pci = (PCNRITEM) mp2;
[2]785
[194]786 memset(&mask, 0, sizeof(MASK));
787 mask.fNoAttribs = TRUE;
788 mask.fNoDirs = TRUE;
789 mask.fText = TRUE;
790 strcpy(mask.prompt,
791 GetPString((SHORT1FROMMP(mp1) == IDM_SELECTMASK) ?
[551]792 IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT));
[194]793 if (pci && (INT) pci != -1)
[551]794 strcpy(mask.szMask, pci->szFileName);
795 if (WinDlgBox(HWND_DESKTOP, dcd->hwndCnr, PickMaskDlgProc,
796 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
[194]797 if (SHORT1FROMMP(mp1) == IDM_SELECTMASK)
[551]798 SelectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, mask.szText,
[194]799 FALSE);
800 else
[551]801 DeselectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, mask.szText,
[194]802 FALSE);
803 }
804 }
[2]805
[194]806 case IDM_DESELECTCLIP:
807 case IDM_SELECTCLIP:
808 {
809 CHAR **list;
[2]810
[194]811 list = ListFromClipboard(hwnd);
[444]812 if (list) {
[551]813 SelectList(dcd->hwndCnr, TRUE, FALSE,
[194]814 (SHORT1FROMMP(mp1) == IDM_DESELECTCLIP),
815 NULL, NULL, list);
816 FreeList(list);
817 }
818 }
819 break;
[2]820
[194]821 case IDM_INVERT:
[551]822 InvertAll(dcd->hwndCnr);
[194]823 break;
[2]824 }
[194]825 }
826 return 0;
[2]827
[194]828 case UM_MASSACTION:
[444]829 if (mp1) {
[194]830 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]831 if (dcd) {
[194]832 WORKER *wk;
[2]833
[551]834 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
[444]835 if (!wk)
[352]836 FreeListInfo((LISTINFO *) mp1);
837 else {
[551]838 wk->size = sizeof(WORKER);
839 wk->hwndCnr = dcd->hwndCnr;
840 wk->hwndParent = dcd->hwndParent;
841 wk->hwndFrame = dcd->hwndFrame;
842 wk->hwndClient = dcd->hwndClient;
843 wk->li = (LISTINFO *) mp1;
844 strcpy(wk->directory, dcd->directory);
[444]845 if (_beginthread(MassAction, NULL, 122880, (PVOID) wk) == -1) {
[551]846 Runtime_Error(pszSrcFile, __LINE__,
847 GetPString(IDS_COULDNTSTARTTHREADTEXT));
[194]848 free(wk);
849 FreeListInfo((LISTINFO *) mp1);
850 }
851 }
[2]852 }
[194]853 }
854 return 0;
[2]855
[194]856 case UM_ACTION:
[444]857 if (mp1) {
[194]858 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]859 if (dcd) {
[194]860 WORKER *wk;
[2]861
[551]862 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
[352]863 if (!wk)
864 FreeListInfo((LISTINFO *) mp1);
865 else {
[551]866 wk->size = sizeof(WORKER);
867 wk->hwndCnr = dcd->hwndCnr;
868 wk->hwndParent = dcd->hwndParent;
869 wk->hwndFrame = dcd->hwndFrame;
870 wk->hwndClient = dcd->hwndClient;
871 wk->li = (LISTINFO *) mp1;
872 strcpy(wk->directory, dcd->directory);
[444]873 if (_beginthread(Action, NULL, 122880, (PVOID) wk) == -1) {
[551]874 Runtime_Error(pszSrcFile, __LINE__,
875 GetPString(IDS_COULDNTSTARTTHREADTEXT));
[194]876 free(wk);
877 FreeListInfo((LISTINFO *) mp1);
878 }
879 }
[2]880 }
[194]881 }
882 return 0;
[2]883
[194]884 case WM_CLOSE:
885 WinDestroyWindow(hwnd);
886 break;
[2]887
[194]888 case WM_DESTROY:
889 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]890 if (dcd) {
891 INT x;
[551]892
893 dcd->stopflag = 1;
[280]894 // Allow rescan logic to quiesce
[551]895 for (x = 0; x < 10 && dcd->amextracted; x++)
[194]896 DosSleep(250L);
[551]897 WinSendMsg(dcd->hwndCnr, UM_CLOSE, MPVOID, MPVOID);
898 FreeList(dcd->lastselection);
[194]899 free(dcd);
900 }
901 DosPostEventSem(CompactSem);
[551]902 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
903 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
[194]904 break;
[2]905 }
[194]906 return WinDefWindowProc(hwnd, msg, mp1, mp2);
[2]907}
908
[551]909MRESULT EXPENTRY CollectorCnrWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
910 MPARAM mp2)
[155]911{
[672]912 DIRCNRDATA *dcd = INSTDATA(hwnd);
913 DIRCNRDATA *dcdsrc;
[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;
[618]2115 APIRET rc;
[2]2116
[551]2117 pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
2118 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
[444]2119 if (!DrgAccessDraginfo(pDInfo)) {
[352]2120 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
[618]2121 "DrgAccessDraginfo");
2122 return 0;
[194]2123 }
2124 numitems = DrgQueryDragitemCount(pDInfo);
[551]2125 usOperation = pDInfo->usOperation;
[618]2126 FreeDragInfoData(hwnd, pDInfo);
[194]2127 saymsg(MB_ENTER | MB_ICONASTERISK,
2128 hwnd,
2129 GetPString(IDS_DROPHELPHDRTEXT),
2130 GetPString(IDS_DROPHELPTEXT),
2131 numitems,
2132 &"s"[numitems == 1L],
2133 (pci) ? NullStr : GetPString(IDS_NOTEXT),
2134 (pci) ? NullStr : " ",
[551]2135 (pci) ? pci->szFileName : NullStr,
[194]2136 (pci) ? " " : NullStr,
2137 GetPString((usOperation == DO_COPY) ?
2138 IDS_COPYTEXT :
2139 (usOperation == DO_LINK) ?
2140 IDS_LINKTEXT : IDS_MOVETEXT));
2141 }
2142 return 0;
[2]2143
[194]2144 case CN_DRAGLEAVE:
[444]2145 if (mp2) {
[194]2146 PDRAGINFO pDInfo;
[2]2147
[618]2148 // fixme to know why needed
[551]2149 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
[618]2150 DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
2151 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
[194]2152 }
2153 return 0;
[2]2154
[194]2155 case CN_DRAGAFTER:
2156 case CN_DRAGOVER:
[444]2157 if (mp2) {
[618]2158 PDRAGITEM pDItem; /* Pointer to DRAGITEM */
2159 PDRAGINFO pDInfo; /* Pointer to DRAGINFO */
[194]2160 PCNRITEM pci;
2161 USHORT uso;
[2]2162
[551]2163 pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
[618]2164 // if(SHORT1FROMMP(mp1) == CN_DRAGAFTER)
2165 // pci = NULL;
[551]2166 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
[618]2167 if (!DrgAccessDraginfo(pDInfo)) {
2168 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
2169 "DrgAccessDraginfo");
2170 return (MRFROM2SHORT(DOR_NODROP, 0)); /* Drop not valid */
2171 }
[444]2172 if (pci) {
[551]2173 if (pci->rc.flRecordAttr & CRA_SOURCE) {
[194]2174 DrgFreeDraginfo(pDInfo);
2175 return (MRFROM2SHORT(DOR_NODROP, 0));
2176 }
[551]2177 uso = pDInfo->usOperation;
[194]2178 if (uso == DO_DEFAULT)
2179 uso = (fCopyDefault) ? DO_COPY : DO_MOVE;
[551]2180 if (!(pci->attrFile & FILE_DIRECTORY)) {
2181 if (uso != DO_LINK && uso != DO_MOVE && uso != DO_COPY) {
[194]2182 DrgFreeDraginfo(pDInfo);
2183 return MRFROM2SHORT(DOR_NODROP, 0);
2184 }
2185 if (uso != DO_LINK &&
[551]2186 !(driveflags[toupper(*pci->szFileName) - 'A'] &
2187 DRIVE_NOTWRITEABLE)) {
[194]2188 ARC_TYPE *info = NULL;
[2]2189
[194]2190 if (!fQuickArcFind &&
[551]2191 !(driveflags[toupper(*pci->szFileName) - 'A'] &
[194]2192 DRIVE_SLOW))
[551]2193 info = find_type(pci->szFileName, NULL);
[194]2194 else
[551]2195 info = quick_find_type(pci->szFileName, NULL);
2196 if (!info || ((uso == DO_MOVE && !info->move) ||
2197 (uso == DO_COPY && !info->create))) {
[194]2198 DrgFreeDraginfo(pDInfo);
2199 return MRFROM2SHORT(DOR_NODROP, 0);
2200 }
2201 }
2202 }
2203 }
[618]2204 pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
2205 0); /* Index to DRAGITEM */
[194]2206 if (DrgVerifyRMF(pDItem, /* Check valid rendering */
[618]2207 DRM_OS2FILE, /* mechanisms and data */
[551]2208 NULL)) {
[618]2209 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
[444]2210 if (pci) {
[551]2211 if (driveflags[toupper(*pci->szFileName) - 'A'] &
[194]2212 DRIVE_NOTWRITEABLE)
2213 return MRFROM2SHORT(DOR_DROP, DO_LINK);
[551]2214 if (toupper(*pci->szFileName) < 'C')
[194]2215 return MRFROM2SHORT(DOR_DROP, DO_COPY);
[618]2216 return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
[551]2217 ((fCopyDefault) ? DO_COPY : DO_MOVE));
[194]2218 }
2219 else
[618]2220 return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
[194]2221 DO_COPY);
2222 }
[618]2223 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
[194]2224 }
[618]2225 return (MRFROM2SHORT(DOR_NODROP, 0)); /* Drop not valid */
[2]2226
[194]2227 case CN_INITDRAG:
[444]2228 if (mp2) {
[194]2229 BOOL wasemphasized = FALSE;
2230 PCNRDRAGINIT pcd = (PCNRDRAGINIT) mp2;
2231 PCNRITEM pci;
[2]2232
[444]2233 if (pcd) {
[551]2234 pci = (PCNRITEM) pcd->pRecord;
[444]2235 if (pci) {
[551]2236 if (pci->rc.flRecordAttr & CRA_SELECTED)
[194]2237 wasemphasized = TRUE;
[551]2238 if (IsRoot(pci->szFileName))
[194]2239 break;
2240 if (hwndStatus2)
[551]2241 WinSetWindowText(hwndStatus2,
2242 GetPString(IDS_DRAGFILEOBJTEXT));
2243 if (DoFileDrag(hwnd, dcd->hwndObject, mp2, NULL, NULL, TRUE)) {
[672]2244 if ((fUnHilite && wasemphasized) || dcd->ulItemsToUnHilite)
2245 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
[194]2246 }
2247 if (hwndStatus2)
2248 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2249 }
2250 }
2251 }
2252 return 0;
[2]2253
[194]2254 case CN_DROP:
[444]2255 if (mp2) {
[194]2256 LISTINFO *li;
2257 ULONG action = UM_ACTION;
[2]2258
[687]2259 li = DoFileDrop(hwnd, NULL, TRUE, mp1, mp2);
2260 CheckPmDrgLimit(((PCNRDRAGINFO)mp2)->pDragInfo);
[444]2261 if (li) {
[551]2262 if (!*li->targetpath) {
2263 li->type = IDM_COLLECT;
[194]2264 action = UM_COLLECT;
2265 }
[444]2266 else {
[551]2267 if (li->list && li->list[0] && IsRoot(li->list[0]))
2268 li->type = DO_LINK;
2269 else if (fDragndropDlg && (!*li->arcname || !li->info)) {
[194]2270 CHECKLIST cl;
[2]2271
[194]2272 memset(&cl, 0, sizeof(cl));
2273 cl.size = sizeof(cl);
[551]2274 cl.flags = li->type;
2275 cl.list = li->list;
2276 cl.cmd = li->type;
2277 cl.prompt = li->targetpath;
2278 li->type = WinDlgBox(HWND_DESKTOP, dcd->hwndParent,
2279 DropListProc, FM3ModHandle,
[618]2280 DND_FRAME, MPFROMP(&cl));
2281 if (li->type == DID_ERROR)
2282 Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
2283 "Drag & Drop Dialog");
2284 if (!li->type) {
[194]2285 FreeListInfo(li);
2286 return 0;
2287 }
[551]2288 li->list = cl.list;
[618]2289 if (!li->list || !li->list[0]) {
[194]2290 FreeListInfo(li);
2291 return 0;
2292 }
2293 }
[551]2294 switch (li->type) {
[194]2295 case DND_LAUNCH:
[551]2296 strcat(li->targetpath, " %a");
2297 ExecOnList(dcd->hwndParent, li->targetpath,
2298 PROMPT | WINDOWED, NULL, li->list, NULL);
2299 FreeList(li->list);
2300 li->list = NULL;
[194]2301 break;
2302 case DO_LINK:
[444]2303 if (fLinkSetsIcon) {
[551]2304 li->type = IDM_SETICON;
[194]2305 action = UM_MASSACTION;
2306 }
2307 else
[551]2308 li->type = IDM_COMPARE;
[194]2309 break;
2310 case DND_EXTRACT:
[551]2311 if (*li->targetpath && !IsFile(li->targetpath))
2312 li->type = IDM_EXTRACT;
[194]2313 break;
2314 case DND_MOVE:
[551]2315 li->type = IDM_MOVE;
2316 if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2317 action = UM_MASSACTION;
[551]2318 li->type = IDM_ARCHIVEM;
[194]2319 }
2320 break;
2321 case DND_WILDMOVE:
[551]2322 li->type = IDM_WILDMOVE;
2323 if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2324 action = UM_MASSACTION;
[551]2325 li->type = IDM_ARCHIVEM;
[194]2326 }
2327 break;
2328 case DND_OBJECT:
[551]2329 li->type = IDM_OBJECT;
[194]2330 action = UM_MASSACTION;
2331 break;
2332 case DND_SHADOW:
[551]2333 li->type = IDM_SHADOW;
[194]2334 action = UM_MASSACTION;
2335 break;
2336 case DND_COMPARE:
[551]2337 li->type = IDM_COMPARE;
[194]2338 break;
2339 case DND_SETICON:
2340 action = UM_MASSACTION;
[551]2341 li->type = IDM_SETICON;
[194]2342 break;
2343 case DND_WILDCOPY:
[551]2344 li->type = IDM_WILDCOPY;
2345 if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2346 action = UM_MASSACTION;
[551]2347 li->type = IDM_ARCHIVE;
[194]2348 }
2349 break;
2350 case DND_COPY:
[551]2351 li->type = IDM_COPY;
2352 if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2353 action = UM_MASSACTION;
[551]2354 li->type = IDM_ARCHIVE;
[194]2355 }
2356 break;
2357 default:
[551]2358 if (*li->arcname && li->info) {
[194]2359 action = UM_MASSACTION;
[551]2360 li->type =
2361 (li->type ==
2362 DO_MOVE) ? IDM_FAKEEXTRACTM : IDM_FAKEEXTRACT;
[194]2363 }
[551]2364 else if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2365 action = UM_MASSACTION;
[551]2366 li->type =
2367 (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
[194]2368 }
2369 else
[551]2370 li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
[194]2371 break;
2372 }
2373 }
[551]2374 if (!li->list || !li->list[0])
[194]2375 FreeListInfo(li);
[551]2376 else if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID))
[194]2377 FreeListInfo(li);
[444]2378 else {
[194]2379 USHORT usop = 0;
[2]2380
[551]2381 switch (li->type) {
[194]2382 case IDM_COPY:
2383 case IDM_WILDCOPY:
2384 usop = DO_COPY;
2385 break;
2386 case IDM_MOVE:
2387 case IDM_WILDMOVE:
2388 case IDM_ARCHIVEM:
2389 usop = DO_MOVE;
2390 break;
2391 }
2392 if (usop)
2393 return MRFROM2SHORT(DOR_DROP, usop);
2394 }
2395 }
2396 }
2397 return 0;
[2]2398
[194]2399 case CN_BEGINEDIT:
2400 case CN_REALLOCPSZ:
2401 case CN_ENDEDIT:
2402 {
2403 MRESULT mre;
[2]2404
[194]2405 mre = CnrDirectEdit(hwnd, msg, mp1, mp2);
2406 if (mre != (MRESULT) - 1)
2407 return mre;
2408 }
2409 break;
[2]2410
[194]2411 case CN_EMPHASIS:
[444]2412 if (mp2) {
[194]2413 PNOTIFYRECORDEMPHASIS pre = mp2;
2414 PCNRITEM pci;
2415 CHAR s[CCHMAXPATH + 91], tb[81], tf[81], *p;
[2]2416
[551]2417 pci = (PCNRITEM) ((pre) ? pre->pRecord : NULL);
[444]2418 if (!pci) {
[194]2419 if (hwndStatus2)
2420 WinSetWindowText(hwndStatus2, NullStr);
[444]2421 if (fMoreButtons) {
[194]2422 WinSetWindowText(hwndName, NullStr);
2423 WinSetWindowText(hwndDate, NullStr);
2424 WinSetWindowText(hwndAttr, NullStr);
2425 }
2426 if (hwndMain)
2427 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
2428 break;
2429 }
[551]2430 if (pre->fEmphasisMask & CRA_SELECTED) {
2431 if (pci->rc.flRecordAttr & CRA_SELECTED) {
2432 dcd->selectedbytes += (pci->cbFile + pci->easize);
2433 dcd->selectedfiles++;
[194]2434 }
[551]2435 else if (dcd->selectedfiles) {
2436 dcd->selectedbytes -= (pci->cbFile + pci->easize);
2437 dcd->selectedfiles--;
[194]2438 }
[551]2439 if (!dcd->suspendview) {
2440 commafmt(tf, sizeof(tf), dcd->selectedfiles);
2441 CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, ' ');
[194]2442 sprintf(s, "%s / %s", tf, tb);
[551]2443 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
[194]2444 }
2445 }
[551]2446 if (!dcd->suspendview &&
2447 WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame) {
2448 if (pre->fEmphasisMask & CRA_CURSORED) {
2449 if (pci->rc.flRecordAttr & CRA_CURSORED) {
[444]2450 if (fSplitStatus && hwndStatus2) {
[551]2451 if (pci->attrFile & FILE_DIRECTORY)
2452 p = pci->pszFileName;
[444]2453 else {
[551]2454 p = strrchr(pci->szFileName, '\\');
[444]2455 if (p) {
[194]2456 if (*(p + 1))
2457 p++;
2458 else
[551]2459 p = pci->pszFileName;
[194]2460 }
2461 else
[551]2462 p = pci->pszFileName;
[194]2463 }
[551]2464 CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
[194]2465 if (!fMoreButtons)
2466 sprintf(s, " %s %04u/%02u/%02u %02u:%02u:%02u [%s] %s",
[551]2467 tb, pci->date.year,
2468 pci->date.month, pci->date.day, pci->time.hours,
2469 pci->time.minutes, pci->time.seconds,
2470 pci->pszDispAttr, p);
[444]2471 else {
[551]2472 if (pci->cbFile + pci->easize > 1024)
2473 CommaFmtULL(tf, sizeof(tf), pci->cbFile + pci->easize,
2474 ' ');
[194]2475 else
2476 *tf = 0;
2477 sprintf(s, GetPString(IDS_STATUSSIZETEXT),
2478 tb,
[551]2479 *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
[194]2480 }
2481 WinSetWindowText(hwndStatus2, s);
2482 }
[444]2483 if (fMoreButtons) {
[551]2484 WinSetWindowText(hwndName, pci->pszFileName);
[194]2485 sprintf(s, "%04u/%02u/%02u %02u:%02u:%02u",
[551]2486 pci->date.year, pci->date.month,
2487 pci->date.day, pci->time.hours, pci->time.minutes,
2488 pci->time.seconds);
[194]2489 WinSetWindowText(hwndDate, s);
[551]2490 WinSetWindowText(hwndAttr, pci->pszDispAttr);
[194]2491 }
2492 }
2493 }
2494 }
[551]2495 if (!dcd->suspendview && hwndMain &&
2496 (pre->fEmphasisMask & CRA_CURSORED) &&
2497 (pci->rc.flRecordAttr & CRA_CURSORED) &&
2498 WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame)
[194]2499 WinSendMsg(hwndMain, UM_LOADFILE,
[551]2500 MPFROMP(((fComments
2501 || (pci->attrFile & FILE_DIRECTORY) ==
2502 0) ? pci->szFileName : NULL)), MPVOID);
[194]2503 }
2504 break;
[2]2505
[194]2506 case CN_ENTER:
[444]2507 if (mp2) {
[551]2508 PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
[194]2509 FILEFINDBUF3 ffb;
2510 HDIR hDir = HDIR_CREATE;
2511 ULONG nm = 1L;
2512 APIRET status = 0;
[2]2513
[194]2514 SetShiftState();
[444]2515 if (pci) {
[551]2516 if (pci->rc.flRecordAttr & CRA_INUSE)
[194]2517 break;
2518 DosError(FERR_DISABLEHARDERR);
[551]2519 status = DosFindFirst(pci->szFileName, &hDir,
[194]2520 FILE_NORMAL | FILE_DIRECTORY |
2521 FILE_ARCHIVED | FILE_READONLY |
2522 FILE_HIDDEN | FILE_SYSTEM,
[551]2523 &ffb, sizeof(ffb), &nm, FIL_STANDARD);
[194]2524 priority_bumped();
[444]2525 if (!status) {
[194]2526 DosFindClose(hDir);
[444]2527 if (ffb.attrFile & FILE_DIRECTORY) {
[551]2528 if ((shiftstate & (KC_CTRL | KC_ALT)) == (KC_CTRL | KC_ALT))
[194]2529 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SHOWALLFILES, 0),
2530 MPVOID);
2531 else if ((shiftstate & (KC_CTRL | KC_SHIFT)) ==
2532 (KC_CTRL | KC_SHIFT))
[551]2533 OpenObject(pci->szFileName, Settings, dcd->hwndFrame);
[194]2534 else if (shiftstate & KC_CTRL)
[551]2535 OpenObject(pci->szFileName, Default, dcd->hwndFrame);
[194]2536 else
[280]2537 OpenDirCnr(HWND_DESKTOP,
[194]2538 hwndMain,
[551]2539 dcd->hwndFrame, FALSE, pci->szFileName);
[194]2540 }
[444]2541 else {
[194]2542 SWP swp;
[2]2543
[194]2544 WinSendMsg(hwnd,
2545 CM_SETRECORDEMPHASIS,
[551]2546 MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_INUSE));
2547 WinQueryWindowPos(dcd->hwndFrame, &swp);
[194]2548 DefaultViewKeys(hwnd,
[551]2549 dcd->hwndFrame,
2550 dcd->hwndParent, &swp, pci->szFileName);
[194]2551 WinSendMsg(hwnd,
2552 CM_SETRECORDEMPHASIS,
2553 MPFROMP(pci),
2554 MPFROM2SHORT(FALSE, CRA_INUSE |
2555 ((fUnHilite) ? CRA_SELECTED : 0)));
2556 }
2557 }
2558 else
2559 WinSendMsg(hwnd,
2560 CM_REMOVERECORD,
2561 MPFROMP(&pci),
2562 MPFROM2SHORT(1,
[471]2563 CMA_FREE | CMA_INVALIDATE | CMA_ERASE));
[194]2564 }
2565 }
2566 break;
[2]2567 }
[194]2568 }
2569 return 0;
[2]2570
[194]2571 case UM_LOADFILE:
[444]2572 if (dcd && mp2) {
[194]2573 HWND ret;
[2]2574
[551]2575 ret = StartMLEEditor(dcd->hwndParent,
2576 (INT) mp1, (CHAR *) mp2, dcd->hwndFrame);
[194]2577 if (mp2)
2578 free((CHAR *) mp2);
2579 return MRFROMLONG(ret);
2580 }
2581 return 0;
[2]2582
[194]2583 case UM_CLOSE:
2584 WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
2585 QW_PARENT));
2586 return 0;
[2]2587
[194]2588 case UM_FOLDUP:
[551]2589 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
[194]2590 DosExit(EXIT_PROCESS, 1);
2591 return 0;
[2]2592
[194]2593 case WM_CLOSE:
[444]2594 if (dcd) {
[551]2595 dcd->namecanchange = TRUE;
2596 dcd->stopflag = 1;
2597 if (dcd->amextracted)
2598 return 0; // Can not close yet
[194]2599 }
2600 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
[444]2601 if (dcd) {
[551]2602 if (!dcd->dontclose && ParentIsDesktop(hwnd, dcd->hwndParent))
[194]2603 PostMsg(hwnd, UM_FOLDUP, MPVOID, MPVOID);
[551]2604 if (dcd->hwndObject) {
[194]2605 DosSleep(64L);
[551]2606 if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
2607 WinSendMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID);
[2]2608 }
[194]2609 }
2610 else
2611 WinSendMsg(hwnd, UM_CLOSE, MPVOID, MPVOID);
2612 return 0;
[2]2613
[194]2614 case WM_DESTROY:
2615 if (CollectorDirMenu)
2616 WinDestroyWindow(CollectorDirMenu);
2617 if (CollectorFileMenu)
2618 WinDestroyWindow(CollectorFileMenu);
2619 if (CollectorCnrMenu)
2620 WinDestroyWindow(CollectorCnrMenu);
[551]2621 CollectorCnrMenu = CollectorFileMenu = CollectorDirMenu = (HWND) 0;
2622 Collector = (HWND) 0;
[194]2623 EmptyCnr(hwnd);
2624 break;
[2]2625 }
[551]2626 return (dcd && dcd->oldproc) ? dcd->oldproc(hwnd, msg, mp1, mp2) :
[194]2627 PFNWPCnr(hwnd, msg, mp1, mp2);
[2]2628}
2629
[194]2630HWND StartCollector(HWND hwndParent, INT flags)
[155]2631{
[551]2632 HWND hwndFrame = (HWND) 0;
[197]2633 HWND hwndClient;
[194]2634 ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
[551]2635 FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_NOBYTEALIGN | FCF_ACCELTABLE;
[194]2636 USHORT id;
2637 DIRCNRDATA *dcd;
[2]2638
[197]2639 static USHORT idinc = 0;
2640
[194]2641 if (ParentIsDesktop(hwndParent, hwndParent))
[2]2642 FrameFlags |= (FCF_TASKLIST | FCF_SHELLPOSITION | FCF_MENU);
[444]2643 if (Collector) {
[2]2644 WinSetWindowPos(WinQueryWindow(WinQueryWindow(Collector,
[194]2645 QW_PARENT),
2646 QW_PARENT),
[551]2647 HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE);
2648 return WinQueryWindow(WinQueryWindow(Collector, QW_PARENT), QW_PARENT);
[2]2649 }
2650 hwndFrame = WinCreateStdWindow(hwndParent,
[194]2651 WS_VISIBLE,
2652 &FrameFlags,
[593]2653 WC_COLLECTOR,
[194]2654 NULL,
2655 WS_VISIBLE | fwsAnimate,
[551]2656 FM3ModHandle, COLLECTOR_FRAME, &hwndClient);
[444]2657 if (hwndFrame && hwndClient) {
[2]2658 id = COLLECTOR_FRAME + idinc++;
[194]2659 WinSetWindowUShort(hwndFrame, QWS_ID, id);
[551]2660 dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__);
[377]2661 if (!dcd) {
2662 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
[551]2663 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
2664 hwndFrame = (HWND) 0;
[377]2665 }
2666 else {
[551]2667 dcd->size = sizeof(DIRCNRDATA);
2668 dcd->id = id;
2669 dcd->type = COLLECTOR_FRAME;
2670 dcd->hwndParent = (hwndParent) ? hwndParent : HWND_DESKTOP;
2671 dcd->hwndFrame = hwndFrame;
2672 dcd->hwndClient = hwndClient;
[194]2673 if (flags & 4)
[551]2674 dcd->dontclose = TRUE;
[2]2675 {
[194]2676 PFNWP oldproc;
[2]2677
[551]2678 oldproc = WinSubclassWindow(hwndFrame, (PFNWP) CollectorFrameWndProc);
2679 WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
[2]2680 }
[551]2681 dcd->hwndCnr = WinCreateWindow(hwndClient,
2682 WC_CONTAINER,
2683 NULL,
2684 CCS_AUTOPOSITION | CCS_MINIICONS |
2685 CCS_MINIRECORDCORE | ulCnrType |
2686 WS_VISIBLE,
2687 0,
2688 0,
2689 0,
2690 0,
2691 hwndClient,
2692 HWND_TOP,
2693 (ULONG) COLLECTOR_CNR, NULL, NULL);
2694 if (!dcd->hwndCnr) {
2695 Win_Error2(hwndClient, hwndClient, pszSrcFile, __LINE__,
2696 IDS_WINCREATEWINDOW);
2697 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
[377]2698 free(dcd);
[551]2699 hwndFrame = (HWND) 0;
[377]2700 }
2701 else {
[551]2702 Collector = dcd->hwndCnr;
2703 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
2704 WinSetWindowText(hwndFrame, GetPString(IDS_COLLECTORTITLETEXT));
[444]2705 if (FrameFlags & FCF_MENU) {
2706 if (!fToolbar) {
[194]2707 HWND hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
[2]2708
[444]2709 if (hwndMenu) {
[194]2710 WinSendMsg(hwndMenu,
2711 MM_DELETEITEM,
[551]2712 MPFROM2SHORT(IDM_SEEALL, FALSE), MPVOID);
[194]2713 WinSendMsg(hwndMenu,
2714 MM_DELETEITEM,
[551]2715 MPFROM2SHORT(IDM_GREP, FALSE), MPVOID);
[194]2716 WinSendMsg(hwndMenu,
2717 MM_DELETEITEM,
[551]2718 MPFROM2SHORT(IDM_CLEARCNR, FALSE), MPVOID);
[194]2719 WinSendMsg(hwndMenu,
2720 MM_DELETEITEM,
[551]2721 MPFROM2SHORT(IDM_REMOVE, FALSE), MPVOID);
[194]2722 }
2723 }
2724 }
[551]2725 dcd->oldproc = WinSubclassWindow(dcd->hwndCnr,
2726 (PFNWP) CollectorCnrWndProc);
[194]2727 {
[551]2728 USHORT ids[] = { DIR_TOTALS, DIR_SELECTED, DIR_VIEW, DIR_SORT,
2729 DIR_FILTER, 0
2730 };
[2]2731
[551]2732 CommonCreateTextChildren(dcd->hwndClient,
[593]2733 WC_COLSTATUS, ids);
[194]2734 }
2735 if (FrameFlags & FCF_SHELLPOSITION)
[551]2736 PostMsg(hwndClient, UM_SIZE, MPVOID, MPVOID);
2737 if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
2738 WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
[2]2739 }
2740 }
2741 }
2742 return hwndFrame;
2743}
Note: See TracBrowser for help on using the repository browser.