source: trunk/dll/collect.c@ 841

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

This implements large file support; The wrappers to allow WARP3 compatibility are not done so this will not run on Warp3or Warp 4 pre fixpack 12(?)

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