source: trunk/dll/collect.c@ 917

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

Correct/enhance settings notebook navigation, ticket #188 (Steven)
Reopen settings notebook to last selected page unless overridden, ticket #188 (Steven)
More Compare Directory overflow tweaks (Steven)

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