source: trunk/dll/collect.c@ 675

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

Change drag limit message box to MB_OK | MB_INFORMATION

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