source: trunk/dll/collect.c@ 724

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

CollectorCnrWndProc: just warn if busy

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