source: trunk/dll/collect.c@ 793

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

Move #pragma alloc_text to end for OpenWatcom compat

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