source: trunk/dll/collect.c@ 790

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

Minor clean up add comments re recent changes

  • 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 775 2007-08-11 21:07:07Z 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)
[96]41
[775]42
[96]43***********************************************************************/
44
[2]45#define INCL_DOS
46#define INCL_WIN
47#define INCL_GPI
48#define INCL_DOSERRORS
[155]49#define INCL_LONGLONG
50#include <os2.h>
[2]51
52#include <stdarg.h>
53#include <stdio.h>
54#include <stdlib.h>
55#include <string.h>
56#include <ctype.h>
57#include <time.h>
58#include <share.h>
59#include <limits.h>
[689]60#include <process.h> // _beginthread
[155]61
[2]62#include "fm3dll.h"
63#include "fm3dlg.h"
64#include "fm3str.h"
65#include "mle.h"
66#include "grep.h"
67
68#pragma data_seg(DATA1)
[352]69
70static PSZ pszSrcFile = __FILE__;
71
[2]72#pragma alloc_text(COLLECTOR,CollectorCnrWndProc,CollectorObjWndProc)
73#pragma alloc_text(COLLECTOR,CollectorClientWndProc,CollectorTextProc)
74#pragma alloc_text(COLLECTOR,CollectorFrameWndProc)
75#pragma alloc_text(STARTUP,StartCollector)
76
[194]77MRESULT EXPENTRY CollectorFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
78 MPARAM mp2)
79{
80 return CommonFrameWndProc(COLLECTOR_CNR, hwnd, msg, mp1, mp2);
[2]81}
82
[551]83MRESULT EXPENTRY CollectorTextProc(HWND hwnd, ULONG msg, MPARAM mp1,
84 MPARAM mp2)
[96]85{
[197]86 DIRCNRDATA *dcd;
[155]87
[194]88 static BOOL emphasized = FALSE;
[551]89 static HWND hwndButtonPopup = (HWND) 0;
[194]90 static ULONG timestamp = ULONG_MAX;
91 static USHORT lastid = 0;
[2]92
[444]93 switch (msg) {
[194]94 case WM_CREATE:
95 return CommonTextProc(hwnd, msg, mp1, mp2);
[2]96
[194]97 case UM_CONTEXTMENU:
98 case WM_CONTEXTMENU:
99 {
100 USHORT id;
101
102 id = WinQueryWindowUShort(hwnd, QWS_ID);
[444]103 switch (id) {
[194]104 case DIR_SELECTED:
105 case DIR_VIEW:
106 case DIR_SORT:
107 {
[551]108 POINTL ptl = { 0, 0 };
[194]109 SWP swp;
[2]110
[194]111 if (hwndButtonPopup)
112 WinDestroyWindow(hwndButtonPopup);
[444]113 if (id == lastid) {
[194]114 ULONG check;
[2]115
[194]116 DosQuerySysInfo(QSV_MS_COUNT,
[551]117 QSV_MS_COUNT, &check, sizeof(check));
[444]118 if (check < timestamp + 500) {
[194]119 lastid = 0;
120 goto MenuAbort;
121 }
122 }
[551]123 hwndButtonPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
[444]124 if (hwndButtonPopup) {
[551]125 WinSetWindowUShort(hwndButtonPopup, QWS_ID, id);
[194]126 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
[352]127 QW_PARENT),
[551]128 COLLECTOR_CNR), QWL_USER);
[444]129 if (id == DIR_VIEW) {
130 if (dcd) {
[551]131 SetViewMenu(hwndButtonPopup, dcd->flWindowAttr);
132 SetDetailsSwitches(hwndButtonPopup, dcd);
[194]133 }
[2]134
[194]135 /* don't have tree view in collector */
136 WinSendMsg(hwndButtonPopup,
137 MM_DELETEITEM,
[551]138 MPFROM2SHORT(IDM_TREEVIEW, FALSE), MPVOID);
[2]139
[194]140 }
[444]141 else if (id == DIR_SORT) {
[194]142 if (dcd)
[551]143 SetSortChecks(hwndButtonPopup, dcd->sortFlags);
[194]144 }
145 ptl.x = 0;
146 if (WinPopupMenu(HWND_OBJECT,
147 HWND_OBJECT,
[551]148 hwndButtonPopup, -32767, -32767, 0, 0)) {
149 WinQueryWindowPos(hwndButtonPopup, &swp);
[194]150 ptl.y = -(swp.cy + 2);
151 }
[444]152 else {
[551]153 WinQueryWindowPos(hwnd, &swp);
[194]154 ptl.y = swp.cy + 2;
155 }
156 if (WinPopupMenu(hwnd,
157 hwnd,
158 hwndButtonPopup,
159 ptl.x,
160 ptl.y,
161 0,
162 PU_HCONSTRAIN | PU_VCONSTRAIN |
[551]163 PU_KEYBOARD | PU_MOUSEBUTTON1)) {
[194]164 CenterOverWindow(hwndButtonPopup);
[551]165 PaintRecessedWindow(hwnd, NULLHANDLE, FALSE, FALSE);
[194]166 }
167 }
168 }
169 break;
170 default:
171 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
172 COLLECTOR_CNR),
173 WM_CONTROL,
[551]174 MPFROM2SHORT(COLLECTOR_CNR, CN_CONTEXTMENU), MPVOID);
[194]175 break;
[2]176 }
[194]177 }
178 MenuAbort:
179 if (msg == UM_CONTEXTMENU)
180 return 0;
181 break;
[2]182
[194]183 case WM_MENUEND:
[551]184 if (hwndButtonPopup == (HWND) mp2) {
185 lastid = WinQueryWindowUShort((HWND) mp2, QWS_ID);
[194]186 WinDestroyWindow(hwndButtonPopup);
[551]187 hwndButtonPopup = (HWND) 0;
188 DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &timestamp,
189 sizeof(timestamp));
[444]190 switch (lastid) {
[194]191 case DIR_SELECTED:
192 case DIR_VIEW:
193 case DIR_SORT:
[551]194 PaintRecessedWindow(hwnd, NULLHANDLE, TRUE, FALSE);
[194]195 break;
[2]196 }
[194]197 }
198 break;
[2]199
[194]200 case WM_COMMAND:
201 {
202 DIRCNRDATA *dcd;
203 MRESULT mr;
204
205 mr = WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,
206 QW_PARENT),
[551]207 COLLECTOR_CNR), msg, mp1, mp2);
[194]208 if (hwndButtonPopup &&
209 SHORT1FROMMP(mp1) > IDM_DETAILSTITLES &&
[551]210 SHORT1FROMMP(mp1) < IDM_DETAILSSETUP) {
[194]211 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
212 QW_PARENT),
[551]213 COLLECTOR_CNR), QWL_USER);
[194]214 if (dcd)
[551]215 SetDetailsSwitches(hwndButtonPopup, dcd);
[2]216 }
[194]217 return mr;
218 }
[2]219
[194]220 case WM_MOUSEMOVE:
221 {
222 USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
223 char *s = NULL;
224
[444]225 if (fOtherHelp) {
[194]226 if ((!hwndBubble ||
227 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
[551]228 !WinQueryCapture(HWND_DESKTOP)) {
[444]229 switch (id) {
[194]230 case DIR_SELECTED:
231 s = GetPString(IDS_COLSELECTEDHELP);
232 break;
233 case DIR_TOTALS:
234 s = GetPString(IDS_COLTOTALSHELP);
235 break;
236 case DIR_VIEW:
237 s = GetPString(IDS_DIRCNRVIEWHELP);
238 break;
239 case DIR_SORT:
240 s = GetPString(IDS_DIRCNRSORTHELP);
241 break;
242 case DIR_FILTER:
243 s = GetPString(IDS_DIRCNRFILTERHELP);
244 break;
245 default:
246 break;
247 }
248 if (s)
249 MakeBubble(hwnd, TRUE, s);
250 else if (hwndBubble)
251 WinDestroyWindow(hwndBubble);
252 }
[2]253 }
[444]254 switch (id) {
[194]255 case DIR_FILTER:
256 case DIR_SORT:
257 case DIR_VIEW:
258 case DIR_SELECTED:
259 return CommonTextButton(hwnd, msg, mp1, mp2);
260 }
261 }
262 break;
[2]263
[194]264 case WM_BUTTON3UP:
265 case WM_BUTTON1UP:
266 case WM_BUTTON3DOWN:
267 case WM_BUTTON1DOWN:
268 {
269 USHORT id;
270
[280]271 id = WinQueryWindowUShort(hwnd, QWS_ID);
[444]272 switch (id) {
[194]273 case DIR_FILTER:
274 case DIR_SORT:
275 case DIR_VIEW:
276 case DIR_SELECTED:
277 return CommonTextButton(hwnd, msg, mp1, mp2);
[2]278 }
[194]279 }
280 break;
[2]281
[194]282 case UM_CLICKED:
283 case UM_CLICKED3:
284 {
285 USHORT id, cmd = 0;
286
[280]287 id = WinQueryWindowUShort(hwnd, QWS_ID);
[444]288 switch (id) {
[194]289 case DIR_VIEW:
290 case DIR_SORT:
291 case DIR_SELECTED:
[551]292 PostMsg(hwnd, UM_CONTEXTMENU, MPVOID, MPVOID);
[194]293 break;
294 case DIR_FILTER:
295 cmd = IDM_FILTER;
296 break;
297 default:
298 break;
[2]299 }
[194]300 if (cmd)
[551]301 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
[194]302 COLLECTOR_CNR),
[551]303 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
[194]304 }
305 return 0;
[2]306
[194]307 case DM_DROP:
308 case DM_DRAGOVER:
309 case DM_DRAGLEAVE:
310 case DM_DROPHELP:
[444]311 if (msg == DM_DRAGOVER) {
312 if (!emphasized) {
[194]313 emphasized = TRUE;
314 DrawTargetEmphasis(hwnd, emphasized);
[2]315 }
[194]316 }
[444]317 else {
318 if (emphasized) {
[194]319 emphasized = FALSE;
320 DrawTargetEmphasis(hwnd, emphasized);
[2]321 }
[194]322 }
323 {
324 CNRDRAGINFO cnd;
325 USHORT dcmd;
326
[444]327 switch (msg) {
[194]328 case DM_DROP:
329 dcmd = CN_DROP;
330 break;
331 case DM_DRAGOVER:
332 dcmd = CN_DRAGOVER;
333 break;
334 case DM_DRAGLEAVE:
335 dcmd = CN_DRAGLEAVE;
336 break;
337 case DM_DROPHELP:
338 dcmd = CN_DROPHELP;
339 break;
[2]340 }
[194]341 memset(&cnd, 0, sizeof(cnd));
342 cnd.pDragInfo = (PDRAGINFO) mp1;
343 cnd.pRecord = NULL;
344 return WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_CONTROL,
345 MPFROM2SHORT(COLLECTOR_CNR, dcmd), MPFROMP(&cnd));
346 }
[2]347 }
[194]348 return PFNWPStatic(hwnd, msg, mp1, mp2);
[2]349}
350
[194]351MRESULT EXPENTRY CollectorClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
352 MPARAM mp2)
353{
[444]354 switch (msg) {
[194]355 case UM_CONTAINERHWND:
356 return MRFROMLONG(WinWindowFromID(hwnd, COLLECTOR_CNR));
[2]357
[194]358 case UM_VIEWSMENU:
359 return MRFROMLONG(CheckMenu(&CollectorCnrMenu, COLLECTORCNR_POPUP));
[2]360
[194]361 case MM_PORTHOLEINIT:
362 case WM_INITMENU:
363 case UM_INITMENU:
364 case UM_CONTAINER_FILLED:
365 case UM_FILESMENU:
366 case UM_UPDATERECORD:
367 case UM_UPDATERECORDLIST:
368 return WinSendMsg(WinWindowFromID(hwnd, COLLECTOR_CNR), msg, mp1, mp2);
[2]369
[194]370 case WM_PSETFOCUS:
371 case WM_SETFOCUS:
372 if (mp2)
373 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
374 break;
[2]375
[194]376 case UM_FOCUSME:
377 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, COLLECTOR_CNR));
378 break;
[2]379
[194]380 case WM_PAINT:
381 {
382 HPS hps;
383 RECTL rcl;
[2]384
[280]385 hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
[444]386 if (hps) {
[194]387 WinQueryWindowRect(hwnd, &rcl);
388 WinFillRect(hps, &rcl, CLR_PALEGRAY);
389 CommonTextPaint(hwnd, hps);
390 WinEndPaint(hps);
[2]391 }
[194]392 }
393 break;
[2]394
[194]395 case UM_SIZE:
396 case WM_SIZE:
[444]397 if (msg == UM_SIZE) {
[194]398 SWP swp;
[2]399
[194]400 WinQueryWindowPos(hwnd, &swp);
401 mp1 = MPFROM2SHORT(swp.cx, swp.cy);
402 mp2 = MPFROM2SHORT(swp.cx, swp.cy);
403 }
404 {
405 USHORT cx, cy, bx;
[2]406
[194]407 cx = SHORT1FROMMP(mp2);
408 cy = SHORT2FROMMP(mp2);
409 WinSetWindowPos(WinWindowFromID(hwnd, COLLECTOR_CNR), HWND_TOP,
[551]410 0, 0, cx, cy - 24, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]411 WinSetWindowPos(WinWindowFromID(hwnd, DIR_TOTALS), HWND_TOP,
412 2,
413 cy - 22,
[551]414 (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]415 WinSetWindowPos(WinWindowFromID(hwnd, DIR_SELECTED), HWND_TOP,
416 2 + (cx / 3) + 2,
417 cy - 22,
[551]418 (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]419 bx = (cx - (2 + (((cx / 3) + 2) * 2))) / 3;
420 WinSetWindowPos(WinWindowFromID(hwnd, DIR_VIEW), HWND_TOP,
421 2 + (((cx / 3) + 2) * 2),
[551]422 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]423 WinSetWindowPos(WinWindowFromID(hwnd, DIR_SORT), HWND_TOP,
424 2 + (((cx / 3) + 2) * 2) + bx,
[551]425 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]426 WinSetWindowPos(WinWindowFromID(hwnd, DIR_FILTER), HWND_TOP,
427 2 + (((cx / 3) + 2) * 2) + (bx * 2),
[551]428 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]429 }
[280]430 CommonTextPaint(hwnd, NULLHANDLE);
[444]431 if (msg == UM_SIZE) {
[194]432 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
433 SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE);
434 return 0;
435 }
436 break;
[2]437
[194]438 case UM_COMMAND:
439 case WM_COMMAND:
440 case WM_CONTROL:
441 case WM_CLOSE:
442 return WinSendMsg(WinWindowFromID(hwnd, COLLECTOR_CNR), msg, mp1, mp2);
[2]443 }
[194]444 return WinDefWindowProc(hwnd, msg, mp1, mp2);
[2]445}
446
[194]447MRESULT EXPENTRY CollectorObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
448 MPARAM mp2)
449{
[197]450 ULONG size;
[2]451 DIRCNRDATA *dcd;
452
[444]453 switch (msg) {
[194]454 case WM_CREATE:
455 break;
[2]456
[194]457 case DM_PRINTOBJECT:
458 return MRFROMLONG(DRR_TARGET);
[2]459
[194]460 case DM_DISCARDOBJECT:
461 dcd = INSTDATA(hwnd);
[444]462 if (fFM2Deletes && dcd) {
[194]463 LISTINFO *li;
464 CNRDRAGINFO cni;
[2]465
[194]466 cni.pRecord = NULL;
467 cni.pDragInfo = (PDRAGINFO) mp1;
[551]468 li = DoFileDrop(dcd->hwndCnr, NULL, FALSE, MPVOID, MPFROMP(&cni));
[687]469 CheckPmDrgLimit(cni.pDragInfo);
[444]470 if (li) {
[672]471 li->type = fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE;
[194]472 if (!PostMsg(hwnd, UM_MASSACTION, MPFROMP(li), MPVOID))
473 FreeListInfo(li);
474 else
475 return MRFROMLONG(DRR_SOURCE);
[2]476 }
[194]477 }
478 return MRFROMLONG(DRR_TARGET);
[2]479
[194]480 case UM_UPDATERECORDLIST:
481 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]482 if (dcd && mp1) {
[194]483 INT numentries = 0;
484 CHAR **list = (CHAR **) mp1;
[2]485
[194]486 while (list[numentries])
487 numentries++;
488 if (numentries)
[551]489 UpdateCnrList(dcd->hwndCnr, list, numentries, FALSE, dcd);
[194]490 }
491 return 0;
[2]492
[194]493 case UM_SETUP:
494 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]495 if (dcd) {
[194]496 /* set unique id */
497 WinSetWindowUShort(hwnd,
498 QWS_ID,
[551]499 COLLECTOROBJ_FRAME + (COLLECTOR_FRAME - dcd->id));
500 dcd->hwndObject = hwnd;
501 if (ParentIsDesktop(hwnd, dcd->hwndParent))
[771]502 DosSleep(100); //05 Aug 07 GKY 250
[194]503 }
504 else
505 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
506 return 0;
[2]507
[194]508 case UM_COMMAND:
[444]509 if (mp1) {
[194]510 LISTINFO *li = (LISTINFO *) mp1;
511
[551]512 switch (li->type) {
[194]513 case IDM_DOITYOURSELF:
514 case IDM_APPENDTOCLIP:
515 case IDM_SAVETOCLIP:
516 case IDM_ARCHIVE:
517 case IDM_ARCHIVEM:
518 case IDM_VIEW:
519 case IDM_VIEWTEXT:
520 case IDM_VIEWBINARY:
521 case IDM_VIEWARCHIVE:
522 case IDM_EDIT:
523 case IDM_EDITTEXT:
524 case IDM_EDITBINARY:
525 case IDM_OBJECT:
526 case IDM_SHADOW:
527 case IDM_SHADOW2:
528 case IDM_PRINT:
529 case IDM_ATTRS:
530 case IDM_DELETE:
531 case IDM_PERMDELETE:
532 case IDM_FAKEEXTRACT:
533 case IDM_FAKEEXTRACTM:
534 case IDM_MCIPLAY:
535 case IDM_UPDATE:
536 if (PostMsg(hwnd, UM_MASSACTION, mp1, mp2))
537 return (MRESULT) TRUE;
538 break;
539 default:
540 if (PostMsg(hwnd, UM_ACTION, mp1, mp2))
541 return (MRESULT) TRUE;
[2]542 }
[194]543 }
544 return 0;
[2]545
[194]546 case UM_COLLECT:
547 DosError(FERR_DISABLEHARDERR);
548 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]549 if (dcd) {
[194]550 LISTINFO *li = (LISTINFO *) mp1;
551 INT x;
552 FILEFINDBUF4 fb4;
553 HDIR hdir;
554 ULONG nm;
555 PCNRITEM pci, pciFirst, pciT, pciP = NULL;
556 RECORDINSERT ri;
557 ULONG ulMaxFiles;
558 ULONGLONG ullTotalBytes;
559 CHAR fullname[CCHMAXPATH];
[2]560
[551]561 WinSetWindowText(WinWindowFromID(dcd->hwndClient, DIR_SELECTED),
[194]562 GetPString(IDS_COLLECTINGTEXT));
[551]563 for (ulMaxFiles = 0; li->list[ulMaxFiles]; ulMaxFiles++) ; // Count
[352]564
565 if (ulMaxFiles) {
[551]566 pci = WinSendMsg(dcd->hwndCnr, CM_ALLOCRECORD,
[194]567 MPFROMLONG(EXTRA_RECORD_BYTES),
568 MPFROMLONG(ulMaxFiles));
[403]569 if (!pci) {
[551]570 Runtime_Error(pszSrcFile, __LINE__, "CM_ALLOCRECORD %u failed",
571 ulMaxFiles);
[352]572 break;
573 }
574 else {
[194]575 pciFirst = pci;
[551]576 for (x = 0; li->list[x]; x++) {
[750]577 nm = 1;
[194]578 hdir = HDIR_CREATE;
579 DosError(FERR_DISABLEHARDERR);
[551]580 if (*li->list[x] &&
581 !DosQueryPathInfo(li->list[x], FIL_QUERYFULLNAME,
[194]582 fullname, sizeof(fullname)) &&
583 !IsRoot(fullname) &&
[551]584 !FindCnrRecord(dcd->hwndCnr,
[194]585 fullname,
586 NULL,
587 FALSE,
588 FALSE,
589 TRUE) &&
590 !DosFindFirst(fullname,
591 &hdir,
592 FILE_NORMAL | FILE_DIRECTORY |
593 FILE_ARCHIVED | FILE_SYSTEM |
594 FILE_HIDDEN | FILE_READONLY,
[551]595 &fb4, sizeof(fb4), &nm, FIL_QUERYEASIZE)) {
[194]596 DosFindClose(hdir);
597 priority_normal();
598 *fb4.achName = 0;
[551]599 ullTotalBytes = FillInRecordFromFFB(dcd->hwndCnr,
[194]600 pci,
[551]601 fullname, &fb4, FALSE, dcd);
602 dcd->ullTotalBytes += ullTotalBytes;
[194]603 pciP = pci;
[551]604 pci = (PCNRITEM) pci->rc.preccNextRecord;
[194]605 }
[444]606 else {
[194]607 pciT = pci;
[551]608 pci = (PCNRITEM) pci->rc.preccNextRecord;
[194]609 if (pciP)
[551]610 pciP->rc.preccNextRecord = (PMINIRECORDCORE) pci;
[194]611 else
612 pciFirst = pci;
[751]613 FreeCnrItem(hwnd, pciT);
[194]614 ulMaxFiles--;
615 }
[750]616 DosSleep(1);
[194]617 }
[444]618 if (ulMaxFiles) {
[194]619 memset(&ri, 0, sizeof(RECORDINSERT));
620 ri.cb = sizeof(RECORDINSERT);
621 ri.pRecordOrder = (PRECORDCORE) CMA_END;
622 ri.pRecordParent = (PRECORDCORE) 0;
623 ri.zOrder = (ULONG) CMA_TOP;
624 ri.cRecordsInsert = ulMaxFiles;
625 ri.fInvalidateRecord = TRUE;
[551]626 WinSendMsg(dcd->hwndCnr,
627 CM_INSERTRECORD, MPFROMP(pciFirst), MPFROMP(&ri));
628 PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
[194]629 }
630 }
[2]631 }
[194]632 }
[551]633 if (dcd->flWindowAttr & CV_DETAIL)
[194]634 WinSendDlgItemMsg(hwnd,
635 COLLECTOR_CNR,
636 CM_INVALIDATERECORD,
[551]637 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
[194]638 return 0;
[2]639
[194]640 case UM_COLLECTFROMFILE:
641 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[403]642 if (dcd && mp1) {
[194]643 FILESTATUS4 fs4;
644 PCNRITEM pci;
645 RECORDINSERT ri;
646 CHAR fullname[1024], *p;
647 FILE *fp;
[750]648 ULONG errs = 0;
[444]649 BOOL first = FALSE;
650 size_t c;
[2]651
[194]652 fp = _fsopen((CHAR *) mp1, "r", SH_DENYNO);
[403]653 if (fp) {
654 while (!feof(fp)) {
[444]655 // Avoid too much noise if collecting from binary file - oops
656 if (!fgets(fullname, sizeof(fullname), fp)) {
657 if (ferror(fp))
658 Runtime_Error(pszSrcFile, __LINE__, "fgets");
[194]659 break;
660 }
[444]661
662 c = strlen(fullname);
663 if (c + 1 >= sizeof(fullname))
664 errs++;
[551]665 else if (!c || (fullname[c - 1] != '\n' && fullname[c - 1] != '\r'))
[444]666 errs++;
[403]667 else {
[444]668 bstripcr(fullname);
669
670 if (*fullname == '\"') {
671 memmove(fullname, fullname + 1, strlen(fullname) + 1);
672 lstrip(fullname);
673 p = strchr(fullname, '\"');
674 if (p)
675 *p = 0;
676 rstrip(fullname);
677 }
678 else {
679 p = strchr(fullname, ' ');
680 if (p)
681 *p = 0;
682 }
683 /* fullname now contains name of file to collect */
684 DosError(FERR_DISABLEHARDERR);
685 if (IsFullName(fullname) &&
686 !IsRoot(fullname) &&
687 !DosQueryPathInfo(fullname,
688 FIL_QUERYEASIZE,
689 &fs4,
690 sizeof(fs4)) &&
[551]691 !FindCnrRecord(dcd->hwndCnr,
692 fullname, NULL, FALSE, FALSE, TRUE)) {
[444]693 /* collect it */
[551]694 pci = WinSendMsg(dcd->hwndCnr,
[444]695 CM_ALLOCRECORD,
696 MPFROMLONG(EXTRA_RECORD_BYTES),
[750]697 MPFROMLONG(1));
[444]698 if (pci) {
[551]699 dcd->ullTotalBytes += FillInRecordFromFSA(dcd->hwndCnr, pci,
700 fullname,
701 &fs4, FALSE, dcd);
[444]702 memset(&ri, 0, sizeof(RECORDINSERT));
703 ri.cb = sizeof(RECORDINSERT);
704 ri.pRecordOrder = (PRECORDCORE) CMA_END;
705 ri.pRecordParent = (PRECORDCORE) 0;
706 ri.zOrder = (ULONG) CMA_TOP;
[750]707 ri.cRecordsInsert = 1;
[444]708 ri.fInvalidateRecord = TRUE;
[551]709 WinSendMsg(dcd->hwndCnr, CM_INSERTRECORD,
[444]710 MPFROMP(pci), MPFROMP(&ri));
711 }
[194]712 }
[444]713 else
714 errs++;
[194]715 }
[444]716 if (errs > (first ? 0 : 50)) {
717 /* prevent runaway on bad file */
[551]718 APIRET ret = saymsg(MB_YESNO, dcd->hwndCnr,
[444]719 GetPString(IDS_COLLECTNOLISTHDRTEXT),
720 GetPString(IDS_COLLECTNOLISTTEXT),
[551]721 (CHAR *) mp1);
722
[444]723 if (ret == MBID_NO)
724 break;
725 if (!first)
726 errs = 0;
727 else
728 first = FALSE;
[194]729 }
[551]730 } // while not eof
[194]731 fclose(fp);
[2]732 }
[194]733 }
[403]734 xfree(mp1);
[194]735 return 0;
[2]736
[194]737 case UM_SELECT:
738 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]739 if (dcd) {
740 switch (SHORT1FROMMP(mp1)) {
[194]741 case IDM_SELECTLIST:
742 {
743 CHAR filename[CCHMAXPATH], *p, *pp;
[2]744
[194]745 strcpy(filename, "*.LST");
746 size = CCHMAXPATH;
[551]747 PrfQueryProfileData(fmprof, appname, "SaveToListName", filename,
748 &size);
[194]749 pp = strrchr(filename, '\\');
750 if (!pp)
751 pp = filename;
752 p = strrchr(pp, '.');
[444]753 if (p && *(p + 1) && p > pp + 1) {
[194]754 if (pp > filename)
755 pp++;
756 *pp = '*';
757 pp++;
758 if (p > pp)
759 memmove(pp, p, strlen(p) + 1);
760 }
761 if (insert_filename(hwnd, filename, FALSE, FALSE))
[551]762 SelectList(dcd->hwndCnr, TRUE, FALSE, FALSE, NULL, filename,
763 NULL);
[194]764 }
765 break;
766 case IDM_SELECTALL:
[551]767 SelectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
[194]768 break;
769 case IDM_DESELECTALL:
[551]770 DeselectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
[194]771 break;
772 case IDM_SELECTALLFILES:
[551]773 SelectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
[194]774 break;
775 case IDM_DESELECTALLFILES:
[551]776 DeselectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
[194]777 break;
778 case IDM_SELECTALLDIRS:
[551]779 SelectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
[194]780 break;
781 case IDM_DESELECTALLDIRS:
[551]782 DeselectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
[194]783 break;
784 case IDM_DESELECTMASK:
785 case IDM_SELECTMASK:
786 {
787 MASK mask;
788 PCNRITEM pci = (PCNRITEM) mp2;
[2]789
[194]790 memset(&mask, 0, sizeof(MASK));
791 mask.fNoAttribs = TRUE;
792 mask.fNoDirs = TRUE;
793 mask.fText = TRUE;
794 strcpy(mask.prompt,
795 GetPString((SHORT1FROMMP(mp1) == IDM_SELECTMASK) ?
[551]796 IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT));
[194]797 if (pci && (INT) pci != -1)
[730]798 strcpy(mask.szMask, pci->pszFileName);
[551]799 if (WinDlgBox(HWND_DESKTOP, dcd->hwndCnr, PickMaskDlgProc,
800 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
[194]801 if (SHORT1FROMMP(mp1) == IDM_SELECTMASK)
[551]802 SelectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, mask.szText,
[194]803 FALSE);
804 else
[551]805 DeselectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, mask.szText,
[194]806 FALSE);
807 }
808 }
[2]809
[194]810 case IDM_DESELECTCLIP:
811 case IDM_SELECTCLIP:
812 {
813 CHAR **list;
[2]814
[194]815 list = ListFromClipboard(hwnd);
[444]816 if (list) {
[551]817 SelectList(dcd->hwndCnr, TRUE, FALSE,
[194]818 (SHORT1FROMMP(mp1) == IDM_DESELECTCLIP),
819 NULL, NULL, list);
820 FreeList(list);
821 }
822 }
823 break;
[2]824
[194]825 case IDM_INVERT:
[551]826 InvertAll(dcd->hwndCnr);
[194]827 break;
[2]828 }
[194]829 }
830 return 0;
[2]831
[194]832 case UM_MASSACTION:
[444]833 if (mp1) {
[194]834 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]835 if (dcd) {
[194]836 WORKER *wk;
[2]837
[551]838 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
[444]839 if (!wk)
[352]840 FreeListInfo((LISTINFO *) mp1);
841 else {
[551]842 wk->size = sizeof(WORKER);
843 wk->hwndCnr = dcd->hwndCnr;
844 wk->hwndParent = dcd->hwndParent;
845 wk->hwndFrame = dcd->hwndFrame;
846 wk->hwndClient = dcd->hwndClient;
847 wk->li = (LISTINFO *) mp1;
848 strcpy(wk->directory, dcd->directory);
[444]849 if (_beginthread(MassAction, NULL, 122880, (PVOID) wk) == -1) {
[551]850 Runtime_Error(pszSrcFile, __LINE__,
851 GetPString(IDS_COULDNTSTARTTHREADTEXT));
[194]852 free(wk);
853 FreeListInfo((LISTINFO *) mp1);
854 }
855 }
[2]856 }
[194]857 }
858 return 0;
[2]859
[194]860 case UM_ACTION:
[444]861 if (mp1) {
[194]862 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]863 if (dcd) {
[194]864 WORKER *wk;
[2]865
[551]866 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
[352]867 if (!wk)
868 FreeListInfo((LISTINFO *) mp1);
869 else {
[551]870 wk->size = sizeof(WORKER);
871 wk->hwndCnr = dcd->hwndCnr;
872 wk->hwndParent = dcd->hwndParent;
873 wk->hwndFrame = dcd->hwndFrame;
874 wk->hwndClient = dcd->hwndClient;
875 wk->li = (LISTINFO *) mp1;
876 strcpy(wk->directory, dcd->directory);
[444]877 if (_beginthread(Action, NULL, 122880, (PVOID) wk) == -1) {
[551]878 Runtime_Error(pszSrcFile, __LINE__,
879 GetPString(IDS_COULDNTSTARTTHREADTEXT));
[194]880 free(wk);
881 FreeListInfo((LISTINFO *) mp1);
882 }
883 }
[2]884 }
[194]885 }
886 return 0;
[2]887
[194]888 case WM_CLOSE:
889 WinDestroyWindow(hwnd);
890 break;
[2]891
[194]892 case WM_DESTROY:
893 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]894 if (dcd) {
895 INT x;
[551]896
897 dcd->stopflag = 1;
[280]898 // Allow rescan logic to quiesce
[551]899 for (x = 0; x < 10 && dcd->amextracted; x++)
[771]900 DosSleep(100); //05 Aug 07 GKY 250
[551]901 WinSendMsg(dcd->hwndCnr, UM_CLOSE, MPVOID, MPVOID);
902 FreeList(dcd->lastselection);
[194]903 free(dcd);
904 }
905 DosPostEventSem(CompactSem);
[551]906 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
907 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
[194]908 break;
[2]909 }
[194]910 return WinDefWindowProc(hwnd, msg, mp1, mp2);
[2]911}
912
[551]913MRESULT EXPENTRY CollectorCnrWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
914 MPARAM mp2)
[155]915{
[672]916 DIRCNRDATA *dcd = INSTDATA(hwnd);
[197]917 ULONG size;
[2]918
[197]919 static INT savedSortFlags;
920
[444]921 switch (msg) {
[194]922 case DM_PRINTOBJECT:
923 return MRFROMLONG(DRR_TARGET);
924
925 case DM_DISCARDOBJECT:
926 if (dcd)
[551]927 return WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
[194]928 else
[2]929 return MRFROMLONG(DRR_TARGET);
930
[194]931 case WM_CHAR:
932 shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
933 if (SHORT1FROMMP(mp1) & KC_KEYUP)
934 return (MRESULT) TRUE;
[444]935 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
936 switch (SHORT2FROMMP(mp2)) {
[194]937 case VK_DELETE:
938 if ((shiftstate & KC_CTRL) == KC_CTRL)
939 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PERMDELETE, 0), MPVOID);
940 else if ((shiftstate & KC_SHIFT) == KC_SHIFT)
941 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SAVETOCLIP, 0), MPVOID);
942 else
943 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID);
944 break;
[2]945 }
[194]946 }
947 if (shiftstate || fNoSearch)
948 break;
[444]949 if (SHORT1FROMMP(mp1) & KC_CHAR) {
[194]950 ULONG thistime, len;
951 SEARCHSTRING srch;
952 PCNRITEM pci;
[2]953
[194]954 if (!dcd)
955 break;
[444]956 switch (SHORT1FROMMP(mp2)) {
[194]957 case '\x1b':
958 case '\r':
959 case '\n':
[551]960 dcd->lasttime = 0;
961 *dcd->szCommonName = 0;
[194]962 break;
963 default:
964 thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd));
[551]965 if (thistime > dcd->lasttime + 1250)
966 *dcd->szCommonName = 0;
967 dcd->lasttime = thistime;
968 if (SHORT1FROMMP(mp2) == ' ' && !dcd->szCommonName)
[194]969 break;
970 KbdRetry:
[551]971 len = strlen(dcd->szCommonName);
[444]972 if (len >= CCHMAXPATH - 1) {
[551]973 *dcd->szCommonName = 0;
[194]974 len = 0;
975 }
[551]976 dcd->szCommonName[len] = toupper(SHORT1FROMMP(mp2));
977 dcd->szCommonName[len + 1] = 0;
[194]978 memset(&srch, 0, sizeof(SEARCHSTRING));
[197]979 srch.cb = sizeof(SEARCHSTRING);
[551]980 srch.pszSearch = dcd->szCommonName;
[194]981 srch.fsPrefix = TRUE;
982 srch.fsCaseSensitive = FALSE;
983 srch.usView = CV_ICON;
984 pci = WinSendMsg(hwnd, CM_SEARCHSTRING, MPFROMP(&srch),
985 MPFROMLONG(CMA_FIRST));
[444]986 if (pci && (INT) pci != -1) {
[194]987 USHORT attrib = CRA_CURSORED;
[2]988
[194]989 /* make found item current item */
[551]990 if (!stricmp(pci->pszFileName, dcd->szCommonName))
[194]991 attrib |= CRA_SELECTED;
992 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
993 MPFROM2SHORT(TRUE, attrib));
994 /* make sure that record shows in viewport */
995 ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
996 return (MRESULT) TRUE;
997 }
[444]998 else {
999 if (SHORT1FROMMP(mp2) == ' ') {
[551]1000 dcd->szCommonName[len] = 0;
[194]1001 break;
1002 }
[551]1003 *dcd->szCommonName = 0;
1004 dcd->lasttime = 0;
[194]1005 if (len) // retry as first letter if no match
[2]1006
[194]1007 goto KbdRetry;
1008 }
1009 break;
[2]1010 }
[194]1011 }
1012 break;
[2]1013
[194]1014 case WM_MOUSEMOVE:
1015 case WM_BUTTON1UP:
1016 case WM_BUTTON2UP:
1017 case WM_BUTTON3UP:
1018 case WM_CHORD:
1019 shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
1020 break;
[2]1021
[194]1022 case WM_BUTTON1MOTIONEND:
1023 {
1024 CNRINFO cnri;
1025
1026 memset(&cnri, 0, sizeof(CNRINFO));
1027 cnri.cb = sizeof(CNRINFO);
1028 if (WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
[551]1029 MPFROMLONG(sizeof(CNRINFO)))) {
[194]1030 if (cnri.flWindowAttr & CV_DETAIL)
1031 PrfWriteProfileData(fmprof, appname, "CollectorCnrSplitBar",
1032 (PVOID) & cnri.xVertSplitbar, sizeof(LONG));
[2]1033 }
[194]1034 }
1035 break;
[2]1036
[194]1037 case WM_PRESPARAMCHANGED:
1038 PresParamChanged(hwnd, "Collector", mp1, mp2);
1039 break;
[2]1040
[194]1041 case UM_COMPARE:
[444]1042 if (dcd && mp1 && mp2) {
[194]1043 COMPARE *cmp;
1044 CHAR *leftdir = (CHAR *) mp1, *rightdir = (CHAR *) mp2;
[2]1045
[444]1046 if (!IsFile(leftdir) && !IsFile(rightdir)) {
[551]1047 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
[444]1048 if (cmp) {
[551]1049 cmp->size = sizeof(COMPARE);
1050 strcpy(cmp->leftdir, leftdir);
1051 strcpy(cmp->rightdir, rightdir);
1052 cmp->hwndParent = dcd->hwndParent;
1053 cmp->dcd.hwndParent = dcd->hwndParent;
[194]1054 WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, CompareDlgProc,
1055 FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
1056 }
[2]1057 }
[194]1058 }
1059 return 0;
[2]1060
[194]1061 case UM_UPDATERECORDLIST:
1062 if (dcd && mp1)
[551]1063 WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
[194]1064 return 0;
[2]1065
[194]1066 case UM_UPDATERECORD:
[444]1067 if (dcd && mp1) {
[194]1068 CHAR *filename;
[2]1069
[194]1070 filename = mp1;
1071 if (filename)
1072 UpdateCnrRecord(hwnd, filename, TRUE, dcd);
1073 }
1074 return 0;
[2]1075
[194]1076 case WM_SETFOCUS:
1077 /*
1078 * put name of our window on status line
1079 */
[444]1080 if (dcd && hwndStatus && mp2) {
[194]1081 PCNRITEM pci = NULL;
[2]1082
[444]1083 if (fAutoView && hwndMain) {
[194]1084 pci = WinSendMsg(hwnd,
1085 CM_QUERYRECORDEMPHASIS,
[551]1086 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
[194]1087 if (pci && (INT) pci != -1 &&
[730]1088 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
1089 WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
[194]1090 else
[551]1091 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
[2]1092 }
[551]1093 if (dcd->amextracted)
1094 WinSetWindowText(hwndStatus2, GetPString(IDS_INSEEKSCANTEXT)); // Say working
1095 WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
[194]1096 }
1097 break;
[2]1098
[194]1099 case UM_RESCAN:
[444]1100 if (dcd) {
[194]1101 CNRINFO cnri;
1102 CHAR s[CCHMAXPATH + 69], tb[81], tf[81], *p;
1103 PCNRITEM pci = NULL;
[2]1104
[194]1105 memset(&cnri, 0, sizeof(CNRINFO));
1106 cnri.cb = sizeof(CNRINFO);
1107 WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
1108 MPFROMLONG(sizeof(CNRINFO)));
[551]1109 dcd->totalfiles = cnri.cRecords;
1110 commafmt(tf, sizeof(tf), dcd->totalfiles);
1111 CommaFmtULL(tb, sizeof(tb), dcd->ullTotalBytes, ' ');
[194]1112 sprintf(s, "%s / %s", tf, tb);
[551]1113 WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, s);
[2]1114
[551]1115 commafmt(tf, sizeof(tf), dcd->selectedfiles);
1116 CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, ' ');
[194]1117 sprintf(s, "%s / %s", tf, tb);
[551]1118 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
[155]1119
[194]1120 if (hwndStatus &&
[551]1121 dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
[444]1122 if (hwndMain) {
[194]1123 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
[551]1124 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
[194]1125 if (pci && (INT) pci != -1)
[730]1126 PostMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
[194]1127 else
1128 PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1129 }
1130 if (!fMoreButtons)
1131 sprintf(s, " %s%s%s%s", GetPString(IDS_COLLECTORTEXT),
[551]1132 (*dcd->mask.szMask || dcd->mask.antiattr ||
1133 dcd->mask.attrFile != ALLATTRS) ? " (" : NullStr,
1134 (*dcd->mask.szMask) ? dcd->mask.szMask :
1135 (dcd->mask.antiattr ||
1136 dcd->mask.attrFile != ALLATTRS) ?
[194]1137 GetPString(IDS_ATTRTEXT) : NullStr,
[551]1138 (*dcd->mask.szMask || dcd->mask.antiattr ||
1139 dcd->mask.attrFile != ALLATTRS) ? ")" : NullStr);
[194]1140 else
1141 strcpy(s, GetPString(IDS_COLLECTORTEXT));
1142 WinSetWindowText(hwndStatus, s);
1143 if (!pci)
1144 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
[551]1145 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
[444]1146 if (pci && (INT) pci != -1) {
[280]1147 BOOL fStatus2Used = FALSE;
[551]1148
[444]1149 if (fSplitStatus && hwndStatus2) {
[551]1150 if (pci->attrFile & FILE_DIRECTORY)
1151 p = pci->pszFileName;
[444]1152 else {
[730]1153 p = strrchr(pci->pszFileName, '\\');
[444]1154 if (p) {
[194]1155 if (*(p + 1))
1156 p++;
1157 else
[551]1158 p = pci->pszFileName;
[155]1159 }
[194]1160 else
[551]1161 p = pci->pszFileName;
[194]1162 }
[551]1163 CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
[444]1164 if (!fMoreButtons) {
[194]1165 sprintf(s, " %s %04u/%02u/%02u %02u:%02u:%02u [%s] %s",
[551]1166 tb, pci->date.year, pci->date.month,
1167 pci->date.day, pci->time.hours, pci->time.minutes,
1168 pci->time.seconds, pci->pszDispAttr, p);
[194]1169 }
[444]1170 else {
[551]1171 if (pci->cbFile + pci->easize > 1024)
1172 CommaFmtULL(tf, sizeof(tf), pci->cbFile + pci->easize, 'K');
[194]1173 else
1174 *tf = 0;
1175 sprintf(s, GetPString(IDS_STATUSSIZETEXT),
[551]1176 tb, *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
[194]1177 }
1178 WinSetWindowText(hwndStatus2, s);
[280]1179 fStatus2Used = TRUE;
[194]1180 }
[444]1181 if (fMoreButtons) {
[551]1182 WinSetWindowText(hwndName, pci->pszFileName);
[194]1183 sprintf(s, "%04u/%02u/%02u %02u:%02u:%02u",
[551]1184 pci->date.year, pci->date.month,
1185 pci->date.day, pci->time.hours, pci->time.minutes,
1186 pci->time.seconds);
[194]1187 WinSetWindowText(hwndDate, s);
[551]1188 WinSetWindowText(hwndAttr, pci->pszDispAttr);
[194]1189 }
[551]1190 if (dcd->amextracted && hwndStatus2 && !fStatus2Used)
[280]1191 WinSetWindowText(hwndStatus2, GetPString(IDS_INSEEKSCANTEXT)); // Say working
[194]1192 }
[444]1193 else {
[194]1194 if (hwndStatus2)
1195 WinSetWindowText(hwndStatus2, NullStr);
[444]1196 if (fMoreButtons) {
[194]1197 WinSetWindowText(hwndName, NullStr);
1198 WinSetWindowText(hwndDate, NullStr);
1199 WinSetWindowText(hwndAttr, NullStr);
1200 }
1201 }
[2]1202 }
[194]1203 }
1204 return 0;
[2]1205
[194]1206 case UM_CONTAINER_FILLED:
[551]1207 DosBeep(1000, 50); // Wake up user?
[194]1208 WinSendMsg(hwnd,
1209 CM_INVALIDATERECORD,
[551]1210 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
[471]1211 disable_menuitem(WinWindowFromID(WinQueryWindow(hwndMain, QW_PARENT),
[551]1212 FID_MENU), IDM_GREP, FALSE);
1213 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
[444]1214 if (dcd) {
[551]1215 dcd->stopflag = 0;
1216 dcd->amextracted = FALSE; // Say not busy
1217 if (dcd->namecanchange) {
1218 if (!PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID))
1219 WinSendMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
[2]1220 }
[194]1221 else
1222 WinSetWindowPos(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
1223 QW_PARENT),
1224 HWND_TOP,
[551]1225 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | SWP_ZORDER);
[194]1226 }
1227 return 0;
[2]1228
[194]1229 case UM_SETUP:
[444]1230 if (dcd) {
[551]1231 if (!dcd->hwndObject) {
[471]1232 /* first time through -- set things up */
[2]1233
[194]1234 CNRINFO cnri;
[2]1235
[194]1236 RestorePresParams(hwnd, "Collector");
1237 LoadDetailsSwitches("Collector", dcd);
[471]1238
[551]1239 dcd->amextracted = FALSE; // Say not busy
1240 dcd->stopflag = 0;
[194]1241 memset(&cnri, 0, sizeof(CNRINFO));
1242 cnri.cb = sizeof(CNRINFO);
1243 WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
1244 MPFROMLONG(sizeof(CNRINFO)));
1245 cnri.cyLineSpacing = 0;
[750]1246 cnri.cxTreeIndent = 12;
[2]1247
[551]1248 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT | CV_DETAIL));
[194]1249 cnri.flWindowAttr |= (CV_NAME | CA_DETAILSVIEWTITLES |
1250 CV_MINI | CV_FLOW);
1251 cnri.pSortRecord = (PVOID) SortCollectorCnr;
[2]1252
[444]1253 size = sizeof(ULONG);
1254 PrfQueryProfileData(fmprof, appname, "CollectorflWindowAttr",
1255 (PVOID) & cnri.flWindowAttr, &size);
1256 size = sizeof(MASK);
1257 if (PrfQueryProfileSize(fmprof, appname, "CollectorFilter", &size) &&
[551]1258 size) {
1259 PrfQueryProfileData(fmprof, appname, "CollectorFilter", &dcd->mask,
[444]1260 &size);
[551]1261 SetMask(NULL, &dcd->mask);
[194]1262 }
[444]1263 else {
[551]1264 dcd->mask.attrFile = (FILE_NORMAL | FILE_READONLY |
1265 FILE_DIRECTORY | FILE_HIDDEN |
1266 FILE_SYSTEM | FILE_ARCHIVED);
1267 dcd->mask.antiattr = 0;
[444]1268 }
1269
[551]1270 *(dcd->mask.prompt) = 0;
[444]1271
[194]1272 cnri.flWindowAttr |= CV_FLOW;
1273 cnri.flWindowAttr &= (~(CA_MIXEDTARGETEMPH | CA_ORDEREDTARGETEMPH));
[551]1274 dcd->flWindowAttr = cnri.flWindowAttr;
[194]1275 WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
1276 MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING |
1277 CMA_CXTREEINDENT | CMA_PSORTRECORD));
1278 SetCnrCols(hwnd, FALSE);
1279 AdjustCnrColsForPref(hwnd, NULL, dcd, FALSE);
[2]1280
[197]1281 /* fix splitbar for collector container */
1282 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
1283 size = sizeof(LONG);
1284 PrfQueryProfileData(fmprof, appname, "CollectorCnrSplitBar",
1285 &cnri.xVertSplitbar, &size);
1286 if (cnri.xVertSplitbar <= 0)
[194]1287 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
[197]1288 WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
1289 MPFROMLONG(CMA_XVERTSPLITBAR));
1290
[444]1291 if (_beginthread(MakeObjWin, NULL, 245760, (PVOID) dcd) == -1) {
[551]1292 Runtime_Error(pszSrcFile, __LINE__,
1293 GetPString(IDS_COULDNTSTARTTHREADTEXT));
[194]1294 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
1295 return 0;
1296 }
1297 else
[771]1298 DosSleep(32); //05 Aug 07 GKY 64
[2]1299 }
[194]1300 SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
[551]1301 DIR_FILTER), &dcd->mask, FALSE);
[194]1302 SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1303 DIR_SORT), CollectorsortFlags, FALSE);
1304 SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
[551]1305 DIR_VIEW), dcd->flWindowAttr);
[194]1306 }
[444]1307 else {
[194]1308 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
[2]1309 return 0;
[194]1310 }
1311 return 0;
[2]1312
[194]1313 case WM_MENUEND:
[444]1314 if (dcd) {
[551]1315 HWND hwndMenu = (HWND) mp2;
[2]1316
[194]1317 if (hwndMenu == CollectorCnrMenu || hwndMenu == CollectorFileMenu ||
[551]1318 hwndMenu == CollectorDirMenu) {
[194]1319 MarkAll(hwnd, TRUE, FALSE, TRUE);
[551]1320 if (dcd->cnremphasized) {
[194]1321 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
1322 MPFROM2SHORT(FALSE, CRA_SOURCE));
[551]1323 dcd->cnremphasized = FALSE;
[194]1324 }
[2]1325 }
[194]1326 }
1327 break;
[2]1328
[194]1329 case UM_OPENWINDOWFORME:
[444]1330 if (dcd) {
[551]1331 if (mp1 && !IsFile((CHAR *) mp1))
1332 OpenDirCnr(HWND_DESKTOP, hwndMain, dcd->hwndFrame, FALSE, (PSZ) mp1);
[471]1333 else if (mp1 && IsFile(mp1) == 1)
[194]1334 StartArcCnr(HWND_DESKTOP,
[551]1335 dcd->hwndFrame, (CHAR *) mp1, 4, (ARC_TYPE *) mp2);
[194]1336 }
1337 return 0;
[2]1338
[194]1339 case MM_PORTHOLEINIT:
[444]1340 if (dcd) {
1341 switch (SHORT1FROMMP(mp1)) {
[194]1342 case 0:
1343 case 1:
1344 {
1345 ULONG wmsg;
[2]1346
[194]1347 wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
[551]1348 PortholeInit((HWND) WinSendMsg(dcd->hwndClient, wmsg, MPVOID,
[194]1349 MPVOID), mp1, mp2);
1350 }
1351 break;
[2]1352 }
[194]1353 }
1354 break;
[2]1355
[194]1356 case UM_INITMENU:
1357 case WM_INITMENU:
[444]1358 if (dcd) {
1359 switch (SHORT1FROMMP(mp1)) {
[194]1360 case IDM_VIEWSMENU:
[551]1361 SetViewMenu((HWND) mp2, dcd->flWindowAttr);
1362 WinEnableMenuItem((HWND) mp2, IDM_RESELECT,
1363 (dcd->lastselection != NULL));
[194]1364 break;
[2]1365
[194]1366 case IDM_DETAILSSETUP:
[551]1367 SetDetailsSwitches((HWND) mp2, dcd);
[194]1368 break;
[2]1369
[194]1370 case IDM_COMMANDSMENU:
[551]1371 SetupCommandMenu((HWND) mp2, hwnd);
[194]1372 break;
[2]1373
[194]1374 case IDM_SORTSUBMENU:
[551]1375 SetSortChecks((HWND) mp2, CollectorsortFlags);
[194]1376 break;
[2]1377 }
[551]1378 dcd->hwndLastMenu = (HWND) mp2;
[194]1379 }
1380 if (msg == WM_INITMENU)
1381 break;
1382 return 0;
[2]1383
[194]1384 case UM_COLLECTFROMFILE:
[444]1385 if (mp1) {
1386 if (!dcd) {
1387 free(mp1);
1388 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
1389 }
1390 else {
[551]1391 if (!PostMsg(dcd->hwndObject, UM_COLLECTFROMFILE, mp1, mp2)) {
[444]1392 Runtime_Error(pszSrcFile, __LINE__, "PostMsg");
[194]1393 free(mp1);
1394 }
[2]1395 }
[194]1396 }
1397 return 0;
[2]1398
[194]1399 case UM_COMMAND:
[444]1400 if (mp1) {
1401 if (dcd) {
[551]1402 if (!PostMsg(dcd->hwndObject, UM_COMMAND, mp1, mp2)) {
[444]1403 Runtime_Error(pszSrcFile, __LINE__, "PostMsg");
[194]1404 FreeListInfo((LISTINFO *) mp1);
1405 }
1406 else
1407 return (MRESULT) TRUE;
[2]1408 }
[194]1409 else
1410 FreeListInfo((LISTINFO *) mp1);
1411 }
1412 return 0;
[2]1413
[194]1414 case UM_NOTIFY:
1415 if (mp2)
1416 AddNote((CHAR *) mp2);
1417 return 0;
[2]1418
[194]1419 case WM_COMMAND:
1420 DosError(FERR_DISABLEHARDERR);
[444]1421 if (dcd) {
1422 switch (SHORT1FROMMP(mp1)) {
[194]1423 case IDM_SETTARGET:
1424 SetTargetDir(hwnd, FALSE);
1425 break;
[2]1426
[194]1427 case IDM_CONTEXTMENU:
1428 {
1429 PCNRITEM pci;
[2]1430
[194]1431 pci = (PCNRITEM) CurrentRecord(hwnd);
1432 PostMsg(hwnd, WM_CONTROL, MPFROM2SHORT(COLLECTOR_CNR,
[551]1433 CN_CONTEXTMENU),
1434 MPFROMP(pci));
[194]1435 }
1436 break;
[2]1437
[194]1438 case IDM_SHOWALLFILES:
1439 {
1440 PCNRITEM pci;
[2]1441
[471]1442 pci = WinSendMsg(hwnd,
1443 CM_QUERYRECORDEMPHASIS,
[551]1444 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
[444]1445 if (pci && (INT) pci != -1) {
[194]1446 static CHAR dirname[CCHMAXPATH];
[2]1447
[730]1448 strcpy(dirname, pci->pszFileName);
[194]1449 MakeValidDir(dirname);
1450 StartSeeAll(HWND_DESKTOP, FALSE, dirname);
1451 }
1452 }
1453 break;
[2]1454
[194]1455 case IDM_BEGINEDIT:
1456 OpenEdit(hwnd);
1457 break;
[2]1458
[194]1459 case IDM_ENDEDIT:
1460 WinSendMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
1461 break;
[2]1462
[194]1463 case IDM_SHOWSELECT:
[551]1464 QuickPopup(hwnd, dcd,
1465 CheckMenu(&CollectorCnrMenu, COLLECTORCNR_POPUP),
[194]1466 IDM_SELECTSUBMENU);
1467 break;
[2]1468
[194]1469 case IDM_SHOWSORT:
[551]1470 QuickPopup(hwnd, dcd,
1471 CheckMenu(&CollectorCnrMenu, COLLECTORCNR_POPUP),
[194]1472 IDM_SORTSUBMENU);
1473 break;
[2]1474
[194]1475 case IDM_VIEWORARC:
1476 {
1477 SWP swp;
1478 PCNRITEM pci;
[2]1479
[194]1480 pci = (PCNRITEM) WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1481 MPFROMLONG(CMA_FIRST),
1482 MPFROMSHORT(CRA_CURSORED));
[444]1483 if (pci && (INT) pci != -1) {
[551]1484 WinQueryWindowPos(dcd->hwndFrame, &swp);
1485 DefaultViewKeys(hwnd, dcd->hwndFrame, dcd->hwndParent, &swp,
[730]1486 pci->pszFileName);
[194]1487 }
1488 }
1489 break;
[2]1490
[194]1491 case IDM_SEEALL:
[551]1492 StartSeeAll(HWND_DESKTOP, FALSE, NULL);
[194]1493 break;
[2]1494
[194]1495 case IDM_COLLECTSELECT:
1496 {
1497 CHAR filename[CCHMAXPATH], *p, *pp;
[2]1498
[194]1499 strcpy(filename, "*.LST");
1500 size = CCHMAXPATH;
1501 PrfQueryProfileData(fmprof, appname, "SaveToListName",
1502 filename, &size);
1503 pp = strrchr(filename, '\\');
1504 if (!pp)
1505 pp = filename;
1506 p = strrchr(pp, '.');
[444]1507 if (p && *(p + 1) && p > pp + 1) {
[194]1508 if (pp > filename)
1509 pp++;
1510 *pp = '*';
1511 pp++;
1512 if (p > pp)
1513 memmove(pp, p, strlen(p) + 1);
1514 }
[444]1515 if (insert_filename(hwnd, filename, FALSE, FALSE)) {
[551]1516 p = xstrdup(filename, pszSrcFile, __LINE__);
[444]1517 if (p) {
[194]1518 if (!PostMsg(hwnd, UM_COLLECTFROMFILE, MPFROMP(p), MPVOID))
1519 free(p);
1520 }
1521 }
1522 }
1523 break;
[2]1524
[194]1525 case IDM_NOTEBOOK:
[551]1526 if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
1527 PostMsg(dcd->hwndParent, msg, mp1, mp2);
[194]1528 else
1529 WinDlgBox(HWND_DESKTOP, hwnd, CfgDlgProc, FM3ModHandle,
1530 CFG_FRAME, (PVOID) "Collector");
1531 break;
[2]1532
[194]1533 case IDM_RESELECT:
[551]1534 SelectList(hwnd, FALSE, FALSE, FALSE, NULL, NULL, dcd->lastselection);
[194]1535 break;
[2]1536
[194]1537 case IDM_HELP:
1538 if (hwndHelp)
1539 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
1540 MPFROM2SHORT(HELP_COLLECT, 0),
1541 MPFROMSHORT(HM_RESOURCEID));
1542 break;
[2]1543
[194]1544 case IDM_SORTNONE:
1545 case IDM_SORTSMARTNAME:
1546 case IDM_SORTNAME:
1547 case IDM_SORTFILENAME:
1548 case IDM_SORTSIZE:
1549 case IDM_SORTEASIZE:
1550 case IDM_SORTFIRST:
1551 case IDM_SORTLAST:
1552 case IDM_SORTLWDATE:
1553 case IDM_SORTLADATE:
1554 case IDM_SORTCRDATE:
1555 case IDM_SORTSUBJECT:
[197]1556 savedSortFlags = CollectorsortFlags;
[194]1557 CollectorsortFlags &= (SORT_REVERSE | SORT_DIRSFIRST | SORT_DIRSLAST);
1558 case IDM_SORTDIRSFIRST:
1559 case IDM_SORTDIRSLAST:
1560 case IDM_SORTREVERSE:
[444]1561 switch (SHORT1FROMMP(mp1)) {
[194]1562 case IDM_SORTSUBJECT:
1563 CollectorsortFlags |= SORT_SUBJECT;
1564 break;
1565 case IDM_SORTNONE:
1566 CollectorsortFlags |= SORT_NOSORT;
1567 break;
1568 case IDM_SORTSMARTNAME:
[197]1569 if (~savedSortFlags & SORT_FILENAME)
[194]1570 CollectorsortFlags |= SORT_FILENAME;
1571 break;
1572 case IDM_SORTFILENAME:
1573 CollectorsortFlags |= SORT_FILENAME;
1574 break;
1575 case IDM_SORTSIZE:
1576 CollectorsortFlags |= SORT_SIZE;
1577 break;
1578 case IDM_SORTEASIZE:
1579 CollectorsortFlags |= SORT_EASIZE;
1580 break;
1581 case IDM_SORTFIRST:
1582 CollectorsortFlags |= SORT_FIRSTEXTENSION;
1583 break;
1584 case IDM_SORTLAST:
1585 CollectorsortFlags |= SORT_LASTEXTENSION;
1586 break;
1587 case IDM_SORTLWDATE:
1588 CollectorsortFlags |= SORT_LWDATE;
1589 break;
1590 case IDM_SORTLADATE:
1591 CollectorsortFlags |= SORT_LADATE;
1592 break;
1593 case IDM_SORTCRDATE:
1594 CollectorsortFlags |= SORT_CRDATE;
1595 break;
1596 case IDM_SORTDIRSFIRST:
1597 if (CollectorsortFlags & SORT_DIRSFIRST)
1598 CollectorsortFlags &= (~SORT_DIRSFIRST);
[444]1599 else {
[194]1600 CollectorsortFlags |= SORT_DIRSFIRST;
1601 CollectorsortFlags &= (~SORT_DIRSLAST);
1602 }
1603 break;
1604 case IDM_SORTDIRSLAST:
1605 if (CollectorsortFlags & SORT_DIRSLAST)
1606 CollectorsortFlags &= (~SORT_DIRSLAST);
[444]1607 else {
[194]1608 CollectorsortFlags |= SORT_DIRSLAST;
1609 CollectorsortFlags &= (~SORT_DIRSFIRST);
1610 }
1611 break;
1612 case IDM_SORTREVERSE:
1613 if (CollectorsortFlags & SORT_REVERSE)
1614 CollectorsortFlags &= (~SORT_REVERSE);
1615 else
1616 CollectorsortFlags |= SORT_REVERSE;
1617 break;
1618 }
1619 PrfWriteProfileData(fmprof, appname, "CollectorSort",
1620 &CollectorsortFlags, sizeof(INT));
1621 WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortCollectorCnr), MPVOID);
1622 SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1623 DIR_SORT), CollectorsortFlags, FALSE);
1624 break;
[2]1625
[194]1626 case IDM_COLLECTFROMCLIP:
1627 {
1628 LISTINFO *li;
[2]1629
[551]1630 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
[444]1631 if (li) {
[551]1632 li->list = ListFromClipboard(hwnd);
1633 if (!li->list || !li->list[0])
[194]1634 FreeListInfo(li);
[444]1635 else {
[551]1636 li->type = IDM_COLLECT;
1637 if (!PostMsg(dcd->hwndObject, UM_COLLECT, MPFROMP(li), MPVOID))
[194]1638 FreeListInfo(li);
1639 }
1640 }
1641 }
1642 break;
[2]1643
[194]1644 case IDM_REMOVE:
[551]1645 if (fAutoView && hwndMain)
1646 PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1647 dcd->suspendview = 1;
1648 RemoveAll(hwnd, &dcd->ullTotalBytes, &dcd->totalfiles);
1649 dcd->suspendview = 0;
1650 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
[194]1651 break;
[2]1652
[194]1653 case IDM_CLEARCNR:
1654 {
1655 PCNRITEM pci;
[2]1656
[194]1657 pci = (PCNRITEM) WinSendMsg(hwnd,
1658 CM_QUERYRECORD,
1659 MPVOID,
[551]1660 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
[444]1661 if (pci && (INT) pci != -1) {
[751]1662 RemoveCnrItems(hwnd, NULL, 0, CMA_FREE | CMA_INVALIDATE);
[551]1663 dcd->ullTotalBytes = dcd->selectedbytes = dcd->selectedfiles =
[750]1664 dcd->totalfiles = 0;
[551]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) {
[730]1702 strcpy(path, pci->pszFileName);
[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)) {
[730]1743 p = strrchr(pci->pszFileName, '\\');
[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 &&
[730]1765 (!(driveflags[toupper(*pci->pszFileName) - 'A'] &
[551]1766 DRIVE_SLOW)))
[730]1767 WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName),
[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,
[730]1915 DSZ_FRAME, pci->pszFileName);
[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) ?
[730]1925 pci->pszFileName : 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,
[750]2136 &"s"[numitems == 1],
[194]2137 (pci) ? NullStr : GetPString(IDS_NOTEXT),
2138 (pci) ? NullStr : " ",
[730]2139 (pci) ? pci->pszFileName : 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 &&
[730]2190 !(driveflags[toupper(*pci->pszFileName) - 'A'] &
[551]2191 DRIVE_NOTWRITEABLE)) {
[194]2192 ARC_TYPE *info = NULL;
[2]2193
[194]2194 if (!fQuickArcFind &&
[730]2195 !(driveflags[toupper(*pci->pszFileName) - 'A'] &
[194]2196 DRIVE_SLOW))
[730]2197 info = find_type(pci->pszFileName, NULL);
[194]2198 else
[730]2199 info = quick_find_type(pci->pszFileName, NULL);
[551]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) {
[730]2215 if (driveflags[toupper(*pci->pszFileName) - 'A'] &
[194]2216 DRIVE_NOTWRITEABLE)
2217 return MRFROM2SHORT(DOR_DROP, DO_LINK);
[730]2218 if (toupper(*pci->pszFileName) < '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;
[730]2242 if (IsRoot(pci->pszFileName))
[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 {
[730]2458 p = strrchr(pci->pszFileName, '\\');
[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) ==
[730]2506 0) ? pci->pszFileName : 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;
[750]2515 ULONG nm = 1;
[194]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);
[730]2523 status = DosFindFirst(pci->pszFileName, &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))
[730]2537 OpenObject(pci->pszFileName, Settings, dcd->hwndFrame);
[194]2538 else if (shiftstate & KC_CTRL)
[730]2539 OpenObject(pci->pszFileName, Default, dcd->hwndFrame);
[194]2540 else
[280]2541 OpenDirCnr(HWND_DESKTOP,
[194]2542 hwndMain,
[730]2543 dcd->hwndFrame, FALSE, pci->pszFileName);
[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,
[730]2554 dcd->hwndParent, &swp, pci->pszFileName);
[194]2555 WinSendMsg(hwnd,
2556 CM_SETRECORDEMPHASIS,
2557 MPFROMP(pci),
2558 MPFROM2SHORT(FALSE, CRA_INUSE |
2559 ((fUnHilite) ? CRA_SELECTED : 0)));
2560 }
2561 }
2562 else
[751]2563 RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
[194]2564 }
2565 }
2566 break;
[2]2567 }
[194]2568 }
2569 return 0;
[2]2570
[194]2571 case UM_LOADFILE:
[444]2572 if (dcd && mp2) {
[194]2573 HWND ret;
[2]2574
[551]2575 ret = StartMLEEditor(dcd->hwndParent,
2576 (INT) mp1, (CHAR *) mp2, dcd->hwndFrame);
[194]2577 if (mp2)
2578 free((CHAR *) mp2);
2579 return MRFROMLONG(ret);
2580 }
2581 return 0;
[2]2582
[194]2583 case UM_CLOSE:
2584 WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
2585 QW_PARENT));
2586 return 0;
[2]2587
[194]2588 case UM_FOLDUP:
[551]2589 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
[194]2590 DosExit(EXIT_PROCESS, 1);
2591 return 0;
[2]2592
[194]2593 case WM_CLOSE:
[444]2594 if (dcd) {
[551]2595 dcd->namecanchange = TRUE;
2596 dcd->stopflag = 1;
2597 if (dcd->amextracted)
2598 return 0; // Can not close yet
[194]2599 }
2600 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
[444]2601 if (dcd) {
[551]2602 if (!dcd->dontclose && ParentIsDesktop(hwnd, dcd->hwndParent))
[194]2603 PostMsg(hwnd, UM_FOLDUP, MPVOID, MPVOID);
[551]2604 if (dcd->hwndObject) {
[771]2605 DosSleep(32); //05 Aug 07 GKY 64
[551]2606 if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
2607 WinSendMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID);
[2]2608 }
[194]2609 }
2610 else
2611 WinSendMsg(hwnd, UM_CLOSE, MPVOID, MPVOID);
2612 return 0;
[2]2613
[194]2614 case WM_DESTROY:
2615 if (CollectorDirMenu)
2616 WinDestroyWindow(CollectorDirMenu);
2617 if (CollectorFileMenu)
2618 WinDestroyWindow(CollectorFileMenu);
2619 if (CollectorCnrMenu)
2620 WinDestroyWindow(CollectorCnrMenu);
[551]2621 CollectorCnrMenu = CollectorFileMenu = CollectorDirMenu = (HWND) 0;
2622 Collector = (HWND) 0;
[194]2623 EmptyCnr(hwnd);
2624 break;
[2]2625 }
[705]2626 if (dcd && dcd->oldproc){
2627 return dcd->oldproc(hwnd, msg, mp1, mp2);
2628 }
2629 else
2630 return PFNWPCnr(hwnd, msg, mp1, mp2);
[2]2631}
2632
[194]2633HWND StartCollector(HWND hwndParent, INT flags)
[155]2634{
[551]2635 HWND hwndFrame = (HWND) 0;
[197]2636 HWND hwndClient;
[194]2637 ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
[551]2638 FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_NOBYTEALIGN | FCF_ACCELTABLE;
[194]2639 USHORT id;
2640 DIRCNRDATA *dcd;
[2]2641
[197]2642 static USHORT idinc = 0;
2643
[194]2644 if (ParentIsDesktop(hwndParent, hwndParent))
[2]2645 FrameFlags |= (FCF_TASKLIST | FCF_SHELLPOSITION | FCF_MENU);
[444]2646 if (Collector) {
[2]2647 WinSetWindowPos(WinQueryWindow(WinQueryWindow(Collector,
[194]2648 QW_PARENT),
2649 QW_PARENT),
[551]2650 HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE);
2651 return WinQueryWindow(WinQueryWindow(Collector, QW_PARENT), QW_PARENT);
[2]2652 }
2653 hwndFrame = WinCreateStdWindow(hwndParent,
[194]2654 WS_VISIBLE,
2655 &FrameFlags,
[593]2656 WC_COLLECTOR,
[194]2657 NULL,
2658 WS_VISIBLE | fwsAnimate,
[551]2659 FM3ModHandle, COLLECTOR_FRAME, &hwndClient);
[444]2660 if (hwndFrame && hwndClient) {
[2]2661 id = COLLECTOR_FRAME + idinc++;
[194]2662 WinSetWindowUShort(hwndFrame, QWS_ID, id);
[551]2663 dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__);
[377]2664 if (!dcd) {
2665 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
[551]2666 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
2667 hwndFrame = (HWND) 0;
[377]2668 }
2669 else {
[551]2670 dcd->size = sizeof(DIRCNRDATA);
2671 dcd->id = id;
2672 dcd->type = COLLECTOR_FRAME;
2673 dcd->hwndParent = (hwndParent) ? hwndParent : HWND_DESKTOP;
2674 dcd->hwndFrame = hwndFrame;
2675 dcd->hwndClient = hwndClient;
[194]2676 if (flags & 4)
[551]2677 dcd->dontclose = TRUE;
[2]2678 {
[194]2679 PFNWP oldproc;
[2]2680
[551]2681 oldproc = WinSubclassWindow(hwndFrame, (PFNWP) CollectorFrameWndProc);
2682 WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
[2]2683 }
[551]2684 dcd->hwndCnr = WinCreateWindow(hwndClient,
2685 WC_CONTAINER,
2686 NULL,
2687 CCS_AUTOPOSITION | CCS_MINIICONS |
2688 CCS_MINIRECORDCORE | ulCnrType |
2689 WS_VISIBLE,
2690 0,
2691 0,
2692 0,
2693 0,
2694 hwndClient,
2695 HWND_TOP,
2696 (ULONG) COLLECTOR_CNR, NULL, NULL);
2697 if (!dcd->hwndCnr) {
2698 Win_Error2(hwndClient, hwndClient, pszSrcFile, __LINE__,
2699 IDS_WINCREATEWINDOW);
2700 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
[377]2701 free(dcd);
[551]2702 hwndFrame = (HWND) 0;
[377]2703 }
2704 else {
[551]2705 Collector = dcd->hwndCnr;
2706 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
2707 WinSetWindowText(hwndFrame, GetPString(IDS_COLLECTORTITLETEXT));
[444]2708 if (FrameFlags & FCF_MENU) {
2709 if (!fToolbar) {
[194]2710 HWND hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
[2]2711
[444]2712 if (hwndMenu) {
[194]2713 WinSendMsg(hwndMenu,
2714 MM_DELETEITEM,
[551]2715 MPFROM2SHORT(IDM_SEEALL, FALSE), MPVOID);
[194]2716 WinSendMsg(hwndMenu,
2717 MM_DELETEITEM,
[551]2718 MPFROM2SHORT(IDM_GREP, FALSE), MPVOID);
[194]2719 WinSendMsg(hwndMenu,
2720 MM_DELETEITEM,
[551]2721 MPFROM2SHORT(IDM_CLEARCNR, FALSE), MPVOID);
[194]2722 WinSendMsg(hwndMenu,
2723 MM_DELETEITEM,
[551]2724 MPFROM2SHORT(IDM_REMOVE, FALSE), MPVOID);
[194]2725 }
2726 }
2727 }
[551]2728 dcd->oldproc = WinSubclassWindow(dcd->hwndCnr,
2729 (PFNWP) CollectorCnrWndProc);
[194]2730 {
[551]2731 USHORT ids[] = { DIR_TOTALS, DIR_SELECTED, DIR_VIEW, DIR_SORT,
2732 DIR_FILTER, 0
2733 };
[2]2734
[551]2735 CommonCreateTextChildren(dcd->hwndClient,
[593]2736 WC_COLSTATUS, ids);
[194]2737 }
2738 if (FrameFlags & FCF_SHELLPOSITION)
[551]2739 PostMsg(hwndClient, UM_SIZE, MPVOID, MPVOID);
2740 if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
2741 WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
[2]2742 }
2743 }
2744 }
2745 return hwndFrame;
2746}
Note: See TracBrowser for help on using the repository browser.