source: trunk/dll/collect.c@ 888

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

runemf2 now quotes executable strings if needed (Ticket 180); it also reports where it was called from on errors

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