source: trunk/dll/dircnrs.c@ 793

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

Move #pragma alloc_text to end for OpenWatcom compat

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 90.0 KB
Line 
1
2/***********************************************************************
3
4 $Id: dircnrs.c 793 2007-08-21 02:53:38Z gyoung $
5
6 Directory containers
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2001, 2007 Steven H. Levine
10
11 16 Oct 02 SHL Handle large partitions
12 01 Aug 04 SHL Rework lstrip/rstrip usage
13 23 May 05 SHL Use QWL_USER
14 24 May 05 SHL Rework Win_Error usage
15 25 May 05 SHL Use ULONGLONG and CommaFmtULL
16 26 May 05 SHL More large file formatting updates
17 05 Jun 05 SHL Use QWL_USER
18 10 Nov 05 SHL Comments
19 13 Jul 06 SHL Use Runtime_Error
20 26 Jul 06 SHL Use chop_at_crnl
21 15 Aug 06 SHL Rework warning message text
22 07 Jan 07 GKY Move error strings etc. to string file
23 30 Mar 07 GKY Remove GetPString for window class names
24 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
25 06 Apr 07 GKY Add some error checking in drag/drop
26 19 Apr 07 SHL Use FreeDragInfoData. Add more drag/drop error checking.
27 12 May 07 SHL Use dcd->ulItemsToUnHilite; sync with UnHilite arg mods
28 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
29 02 Aug 07 SHL Sync with CNRITEM mods
30 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
31 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
32
33
34***********************************************************************/
35
36#define INCL_DOS
37#define INCL_WIN
38#define INCL_GPI
39#define INCL_DOSERRORS
40#define INCL_LONGLONG
41
42#include <os2.h>
43#include <stdarg.h>
44#include <stdio.h>
45#include <stdlib.h>
46#include <string.h>
47#include <ctype.h>
48#include <limits.h>
49#include "fm3dll.h"
50#include "fm3dlg.h"
51#include "fm3str.h"
52#include "mle.h"
53#include <process.h> // _beginthread
54
55#pragma data_seg(DATA1)
56
57static PSZ pszSrcFile = __FILE__;
58
59MRESULT EXPENTRY DirFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
60{
61 return CommonFrameWndProc(DIR_CNR, hwnd, msg, mp1, mp2);
62}
63
64MRESULT EXPENTRY DirTextProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
65{
66 static BOOL emphasized = FALSE;
67 static HWND hwndButtonPopup = (HWND) 0;
68 static USHORT lastid = 0;
69 static ULONG timestamp = ULONG_MAX;
70
71 switch (msg) {
72 case WM_CREATE:
73 return CommonTextProc(hwnd, msg, mp1, mp2);
74
75 case WM_COMMAND:
76 {
77 DIRCNRDATA *dcd;
78 MRESULT mr;
79
80 mr = WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,
81 QW_PARENT),
82 DIR_CNR), msg, mp1, mp2);
83 if (hwndButtonPopup &&
84 SHORT1FROMMP(mp1) > IDM_DETAILSTITLES &&
85 SHORT1FROMMP(mp1) < IDM_DETAILSSETUP) {
86 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
87 QW_PARENT),
88 DIR_CNR), QWL_USER);
89 if (dcd)
90 SetDetailsSwitches(hwndButtonPopup, dcd);
91 }
92 return mr;
93 }
94
95 case UM_CONTEXTMENU:
96 case WM_CONTEXTMENU:
97 {
98 USHORT id;
99
100 id = WinQueryWindowUShort(hwnd, QWS_ID);
101 switch (id) {
102 case DIR_FOLDERICON:
103 if (fNoFoldMenu) {
104 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
105 DIR_CNR),
106 WM_COMMAND, MPFROM2SHORT(IDM_PREVIOUS, 0), mp2);
107 break;
108 }
109 /* else intentional fallthru */
110 case DIR_SELECTED:
111 case DIR_VIEW:
112 case DIR_SORT:
113 {
114 POINTL ptl = { 0, 0 };
115 SWP swp;
116 DIRCNRDATA *dcd;
117
118 if (hwndButtonPopup)
119 WinDestroyWindow(hwndButtonPopup);
120 if (id == DIR_SELECTED && msg == WM_CONTEXTMENU)
121 id = DIR_MAX;
122 if (id == lastid) {
123
124 ULONG check;
125
126 DosQuerySysInfo(QSV_MS_COUNT,
127 QSV_MS_COUNT, &check, sizeof(check));
128 if (check < timestamp + 500) {
129 lastid = 0;
130 goto MenuAbort;
131 }
132 }
133 hwndButtonPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
134 if (hwndButtonPopup) {
135 WinSetWindowUShort(hwndButtonPopup, QWS_ID, id);
136 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
137 QW_PARENT),
138 DIR_CNR), QWL_USER);
139 if (id == DIR_SORT) { /* don't have sort pathname in dirs */
140 WinSendMsg(hwndButtonPopup,
141 MM_DELETEITEM,
142 MPFROM2SHORT(IDM_SORTNAME, FALSE), MPVOID);
143 WinSendMsg(hwndButtonPopup,
144 MM_DELETEITEM,
145 MPFROM2SHORT(IDM_SORTNONE, FALSE), MPVOID);
146 if (dcd)
147 SetSortChecks(hwndButtonPopup, dcd->sortFlags);
148 }
149 else if (id == DIR_VIEW) {
150 if (dcd) {
151 SetViewMenu(hwndButtonPopup, dcd->flWindowAttr);
152 SetDetailsSwitches(hwndButtonPopup, dcd);
153 }
154 }
155 else if (id == DIR_MAX) {
156
157 int x;
158 BOOL enable;
159 USHORT ids[] = { IDM_SELECTBOTH,
160 IDM_SELECTMORE,
161 IDM_SELECTONE,
162 IDM_SELECTNEWER,
163 IDM_SELECTOLDER,
164 IDM_SELECTBIGGER,
165 IDM_SELECTSMALLER,
166 IDM_DESELECTBOTH,
167 IDM_DESELECTMORE,
168 IDM_DESELECTONE,
169 IDM_DESELECTNEWER,
170 IDM_DESELECTOLDER,
171 IDM_DESELECTBIGGER,
172 IDM_DESELECTSMALLER,
173 0
174 };
175
176 enable = (CountDirCnrs(dcd->hwndParent) > 1);
177 for (x = 0; ids[x]; x++)
178 WinEnableMenuItem(hwndButtonPopup, ids[x], enable);
179 }
180 else if (id == DIR_SELECTED) {
181 if (dcd)
182 WinEnableMenuItem(hwndButtonPopup,
183 IDM_RESELECT, (dcd->lastselection != NULL));
184 }
185 ptl.x = 0;
186 if (WinPopupMenu(HWND_OBJECT,
187 HWND_OBJECT,
188 hwndButtonPopup, -32767, -32767, 0, 0)) {
189 WinQueryWindowPos(hwndButtonPopup, &swp);
190 ptl.y = -(swp.cy + 2);
191 }
192 else {
193 WinQueryWindowPos(hwnd, &swp);
194 ptl.y = swp.cy + 2;
195 }
196 if (WinPopupMenu(hwnd,
197 hwnd,
198 hwndButtonPopup,
199 ptl.x,
200 ptl.y,
201 0,
202 PU_HCONSTRAIN | PU_VCONSTRAIN |
203 PU_KEYBOARD | PU_MOUSEBUTTON1)) {
204 CenterOverWindow(hwndButtonPopup);
205 PaintRecessedWindow(hwnd, (HPS) 0, FALSE, FALSE);
206 }
207 }
208 }
209 break;
210 default:
211 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), DIR_CNR),
212 WM_CONTROL, MPFROM2SHORT(DIR_CNR, CN_CONTEXTMENU), MPVOID);
213 break;
214 }
215 } // case WM_CONTENT_MENU
216
217 MenuAbort:
218
219 if (msg == UM_CONTEXTMENU)
220 return 0;
221 break;
222
223 case WM_MENUEND:
224 if (hwndButtonPopup == (HWND) mp2) {
225 lastid = WinQueryWindowUShort((HWND) mp2, QWS_ID);
226 WinDestroyWindow(hwndButtonPopup);
227 hwndButtonPopup = (HWND) 0;
228 DosQuerySysInfo(QSV_MS_COUNT,
229 QSV_MS_COUNT, &timestamp, sizeof(timestamp));
230 switch (lastid) {
231 case DIR_VIEW:
232 case DIR_SORT:
233 case DIR_FOLDERICON:
234 case DIR_SELECTED:
235 case DIR_MAX:
236 PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
237 break;
238 }
239 }
240 break;
241
242 case WM_BUTTON3DOWN:
243 case WM_BUTTON1DOWN:
244 case WM_BUTTON3UP:
245 case WM_BUTTON1UP:
246 {
247 USHORT id;
248
249 id = WinQueryWindowUShort(hwnd, QWS_ID);
250 switch (id) {
251 case DIR_FILTER:
252 case DIR_VIEW:
253 case DIR_SORT:
254 case DIR_SELECTED:
255 case DIR_FOLDERICON:
256 case DIR_MAX:
257 return CommonTextButton(hwnd, msg, mp1, mp2);
258 }
259 }
260 break;
261
262 case WM_BUTTON1DBLCLK:
263 {
264 NOTIFYRECORDENTER nr;
265
266 memset(&nr, 0, sizeof(NOTIFYRECORDENTER));
267 nr.hwndCnr = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), DIR_CNR);
268 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
269 WM_CONTROL, MPFROM2SHORT(DIR_CNR, CN_ENTER), MPFROMP(&nr));
270 }
271 break;
272
273 case WM_MOUSEMOVE:
274 {
275 USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
276 char *s = NULL;
277
278 if (fOtherHelp) {
279 if ((!hwndBubble ||
280 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
281 !WinQueryCapture(HWND_DESKTOP)) {
282 switch (id) {
283 case DIR_TOTALS:
284 s = GetPString(IDS_DIRCNRTOTALHELP);
285 break;
286 case DIR_SELECTED:
287 s = GetPString(IDS_DIRCNRSELECTEDHELP);
288 break;
289 case DIR_VIEW:
290 s = GetPString(IDS_DIRCNRVIEWHELP);
291 break;
292 case DIR_SORT:
293 s = GetPString(IDS_DIRCNRSORTHELP);
294 break;
295 case DIR_FILTER:
296 s = GetPString(IDS_DIRCNRFILTERHELP);
297 break;
298 case DIR_MAX:
299 s = GetPString(IDS_DIRCNRMAXHELP);
300 break;
301 case DIR_FOLDERICON:
302 s = GetPString(IDS_DIRCNRFOLDERHELP);
303 break;
304 default:
305 break;
306 }
307 if (s)
308 MakeBubble(hwnd, TRUE, s);
309 else if (hwndBubble)
310 WinDestroyWindow(hwndBubble);
311 }
312 }
313 switch (id) {
314 case DIR_MAX:
315 case DIR_FOLDERICON:
316 case DIR_FILTER:
317 case DIR_SORT:
318 case DIR_VIEW:
319 case DIR_SELECTED:
320 return CommonTextButton(hwnd, msg, mp1, mp2);
321 }
322 }
323 break;
324
325 case WM_CHORD:
326 case WM_BUTTON3CLICK:
327 case WM_BUTTON1CLICK:
328 case UM_CLICKED:
329 case UM_CLICKED3:
330 {
331 USHORT id, cmd = 0;
332
333 id = WinQueryWindowUShort(hwnd, QWS_ID);
334 if (msg == UM_CLICKED || msg == UM_CLICKED3) {
335 switch (id) {
336 case DIR_MAX:
337 cmd = IDM_MAXIMIZE;
338 break;
339 case DIR_VIEW:
340 case DIR_SELECTED:
341 case DIR_SORT:
342 PostMsg(hwnd, UM_CONTEXTMENU, MPVOID, MPVOID);
343 break;
344 case DIR_FILTER:
345 cmd = IDM_FILTER;
346 break;
347 default:
348 break;
349 }
350 }
351 else if (id == DIR_FOLDERICON) {
352 if ((msg == WM_BUTTON1CLICK && (SHORT2FROMMP(mp2) & KC_CTRL)))
353 cmd = IDM_PREVIOUS;
354 else if (msg == WM_BUTTON3CLICK || msg == WM_CHORD)
355 cmd = IDM_RESCAN;
356 else if (msg == WM_BUTTON1CLICK && (SHORT2FROMMP(mp2) & KC_SHIFT))
357 cmd = IDM_WALKDIR;
358 else if (msg == WM_BUTTON1CLICK && (SHORT2FROMMP(mp2) & KC_ALT))
359 cmd = IDM_WINDOWDLG;
360 else
361 cmd = IDM_PARENT;
362 }
363 if (cmd)
364 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
365 DIR_CNR),
366 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
367 }
368 if (msg == UM_CLICKED || msg == UM_CLICKED3)
369 return 0;
370 break;
371
372 case DM_DROP:
373 case DM_DRAGOVER:
374 case DM_DRAGLEAVE:
375 case DM_DROPHELP:
376 case WM_BEGINDRAG:
377 if (msg == DM_DRAGOVER) {
378 if (!emphasized) {
379 emphasized = TRUE;
380 DrawTargetEmphasis(hwnd, emphasized);
381 }
382 }
383 else if (msg != WM_BEGINDRAG) {
384 if (emphasized) {
385 emphasized = FALSE;
386 DrawTargetEmphasis(hwnd, emphasized);
387 }
388 }
389 switch (WinQueryWindowUShort(hwnd, QWS_ID)) {
390 case DIR_FOLDERICON:
391 switch (msg) {
392 case DM_DRAGOVER:
393 if (AcceptOneDrop(hwnd, mp1, mp2))
394 return MRFROM2SHORT(DOR_DROP, DO_MOVE);
395 return (MRFROM2SHORT(DOR_NODROP, 0)); /* Drop not valid */
396 case DM_DROPHELP:
397 DropHelp(mp1, mp2, hwnd, GetPString(IDS_DIRCNRFOLDERDROPHELP));
398 return 0;
399 case DM_DROP:
400 {
401 char szFrom[CCHMAXPATH + 2];
402
403 if (emphasized) {
404 emphasized = FALSE;
405 DrawTargetEmphasis(hwnd, emphasized);
406 }
407 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom)))
408 WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
409 DIR_CNR),
410 WM_COMMAND, MPFROM2SHORT(IDM_SWITCH, 0),
411 MPFROMP(szFrom));
412 }
413 return 0;
414 default:
415 return PFNWPStatic(hwnd, msg, mp1, mp2);
416 }
417 case DIR_MAX:
418 if (msg == WM_BEGINDRAG)
419 return PFNWPStatic(hwnd, msg, mp1, mp2);
420 default:
421 {
422 CNRDRAGINFO cnd;
423 USHORT dcmd;
424
425 switch (msg) {
426 case DM_DROP:
427 dcmd = CN_DROP;
428 break;
429 case DM_DRAGOVER:
430 dcmd = CN_DRAGOVER;
431 break;
432 case DM_DRAGLEAVE:
433 dcmd = CN_DRAGLEAVE;
434 break;
435 case DM_DROPHELP:
436 dcmd = CN_DROPHELP;
437 break;
438 case WM_BEGINDRAG:
439 dcmd = CN_INITDRAG;
440 break;
441 }
442 memset(&cnd, 0, sizeof(cnd));
443 cnd.pDragInfo = (PDRAGINFO) mp1;
444 cnd.pRecord = NULL;
445 return WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
446 WM_CONTROL,
447 MPFROM2SHORT(DIR_CNR, dcmd), MPFROMP(&cnd));
448 }
449 }
450 }
451 return PFNWPStatic(hwnd, msg, mp1, mp2);
452}
453
454MRESULT EXPENTRY DirClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
455 MPARAM mp2)
456{
457 switch (msg) {
458 case UM_CONTAINERDIR:
459 if (mp1) {
460
461 DIRCNRDATA *dcd;
462
463 *(CHAR *) mp1 = 0;
464 dcd = WinQueryWindowPtr(WinWindowFromID(hwnd, DIR_CNR), QWL_USER);
465 if (dcd)
466 strcpy((CHAR *) mp1, dcd->directory);
467 return MRFROMLONG(TRUE);
468 }
469 return 0;
470
471 case UM_CONTAINERHWND:
472 return MRFROMLONG(WinWindowFromID(hwnd, DIR_CNR));
473
474 case UM_VIEWSMENU:
475 return MRFROMLONG(CheckMenu(&DirCnrMenu, DIRCNR_POPUP));
476
477 case UM_DRIVECMD:
478 case WM_INITMENU:
479 case UM_FILTER:
480 case UM_INITMENU:
481 case MM_PORTHOLEINIT:
482 case UM_COMMAND:
483 case UM_FILESMENU:
484 case UM_UPDATERECORD:
485 case UM_UPDATERECORDLIST:
486 return WinSendMsg(WinWindowFromID(hwnd, DIR_CNR), msg, mp1, mp2);
487
488 case WM_PSETFOCUS:
489 case WM_SETFOCUS:
490 if (mp2)
491 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
492 break;
493
494 case UM_FOCUSME:
495 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, DIR_CNR));
496 break;
497
498 case WM_PAINT:
499 {
500 HPS hps;
501 RECTL rcl;
502
503 hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
504 if (hps) {
505 WinQueryWindowRect(hwnd, &rcl);
506 WinFillRect(hps, &rcl, CLR_PALEGRAY);
507 CommonTextPaint(hwnd, hps);
508 WinEndPaint(hps);
509 }
510 }
511 break;
512
513 case UM_SIZE:
514 case WM_SIZE:
515 if (msg == UM_SIZE) {
516
517 SWP swp;
518
519 WinQueryWindowPos(hwnd, &swp);
520 mp1 = MPFROM2SHORT(swp.cx, swp.cy);
521 mp2 = MPFROM2SHORT(swp.cx, swp.cy);
522 }
523 {
524 USHORT cx, cy, bx;
525
526 cx = SHORT1FROMMP(mp2);
527 cy = SHORT2FROMMP(mp2);
528 WinSetWindowPos(WinWindowFromID(hwnd, DIR_CNR), HWND_TOP,
529 0, 0, cx, cy - 24, SWP_SHOW | SWP_MOVE | SWP_SIZE);
530 if (WinWindowFromID(hwnd, DIR_MAX) != (HWND) 0) {
531 WinSetWindowPos(WinWindowFromID(hwnd, DIR_MAX), HWND_TOP,
532 cx - 22,
533 cy - 22, 20, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
534 cx -= 24;
535 }
536 WinSetWindowPos(WinWindowFromID(hwnd, DIR_FOLDERICON), HWND_TOP,
537 2, cy - 22, 24, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
538 WinSetWindowPos(WinWindowFromID(hwnd, DIR_TOTALS), HWND_TOP,
539 29,
540 cy - 22,
541 (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
542 WinSetWindowPos(WinWindowFromID(hwnd, DIR_SELECTED), HWND_TOP,
543 29 + (cx / 3) + 2,
544 cy - 22,
545 (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
546 bx = (cx - (29 + (((cx / 3) + 2) * 2))) / 3;
547 WinSetWindowPos(WinWindowFromID(hwnd, DIR_VIEW), HWND_TOP,
548 29 + (((cx / 3) + 2) * 2),
549 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
550 WinSetWindowPos(WinWindowFromID(hwnd, DIR_SORT), HWND_TOP,
551 29 + (((cx / 3) + 2) * 2) + bx,
552 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
553 WinSetWindowPos(WinWindowFromID(hwnd, DIR_FILTER), HWND_TOP,
554 29 + (((cx / 3) + 2) * 2) + (bx * 2),
555 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
556 }
557 CommonTextPaint(hwnd, (HPS) 0);
558 if (msg == UM_SIZE) {
559 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
560 SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE);
561 return 0;
562 }
563 break;
564
565 case WM_COMMAND:
566 case WM_CONTROL:
567 case WM_CLOSE:
568 return WinSendMsg(WinWindowFromID(hwnd, DIR_CNR), msg, mp1, mp2);
569 }
570 return WinDefWindowProc(hwnd, msg, mp1, mp2);
571}
572
573MRESULT EXPENTRY DirObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
574{
575 DIRCNRDATA *dcd;
576
577 switch (msg) {
578 case WM_CREATE:
579 break;
580
581 case DM_PRINTOBJECT:
582 return MRFROMLONG(DRR_TARGET);
583
584 case DM_DISCARDOBJECT:
585 dcd = INSTDATA(hwnd);
586 if (fFM2Deletes && dcd) {
587
588 LISTINFO *li;
589 CNRDRAGINFO cni;
590
591 cni.pRecord = NULL;
592 cni.pDragInfo = (PDRAGINFO) mp1;
593 // DbgMsg(pszSrcFile, __LINE__, "calling DoFileDrop");
594 li =
595 DoFileDrop(dcd->hwndCnr, dcd->directory, FALSE, MPVOID,
596 MPFROMP(&cni));
597 CheckPmDrgLimit(cni.pDragInfo);
598 if (li) {
599 li->type = (fDefaultDeletePerm) ? IDM_PERMDELETE : IDM_DELETE;
600 if (!PostMsg(hwnd, UM_MASSACTION, MPFROMP(li), MPVOID))
601 FreeListInfo(li);
602 else
603 return MRFROMLONG(DRR_SOURCE);
604 }
605 }
606 return MRFROMLONG(DRR_TARGET);
607
608 case UM_UPDATERECORDLIST:
609 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
610 if (dcd && mp1) {
611
612 INT numentries = 0;
613 CHAR **list = (CHAR **) mp1;
614
615 while (list[numentries])
616 numentries++;
617 if (numentries)
618 UpdateCnrList(dcd->hwndCnr, list, numentries, TRUE, dcd);
619 }
620 return 0;
621
622 case UM_SETUP:
623 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
624 if (dcd) {
625 /* set unique id */
626 WinSetWindowUShort(hwnd, QWS_ID, DIROBJ_FRAME + (DIR_FRAME - dcd->id));
627 dcd->hwndObject = hwnd;
628 if (ParentIsDesktop(hwnd, dcd->hwndParent))
629 DosSleep(100); //05 Aug 07 GKY 250
630 }
631 else
632 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
633 return 0;
634
635 case UM_RESCAN2:
636 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
637 if (dcd && dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
638
639 FSALLOCATE fsa;
640 CHAR s[CCHMAXPATH * 2];
641 CHAR tf[64];
642 CHAR tb[64];
643 CHAR szFree[64];
644
645 DosError(FERR_DISABLEHARDERR);
646 if (!DosQueryFSInfo(toupper(*dcd->directory) - '@',
647 FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {
648 CommaFmtULL(tb, sizeof(tb),
649 (ULONGLONG) fsa.cUnitAvail * (fsa.cSectorUnit *
650 fsa.cbSector), 'K');
651 sprintf(szFree, " {%s %s}", tb, GetPString(IDS_FREETEXT));
652 }
653 else
654 *szFree = 0;
655 commafmt(tf, sizeof(tf), dcd->totalfiles);
656 CommaFmtULL(tb, sizeof(tb), dcd->ullTotalBytes, ' ');
657 if (!fMoreButtons) {
658 sprintf(s, " [%s / %s]%s%s%s%s %s",
659 tf, tb, szFree,
660 (*dcd->mask.szMask || dcd->mask.antiattr ||
661 dcd->mask.attrFile != ALLATTRS) ? " (" : NullStr,
662 (*dcd->mask.szMask) ? dcd->mask.szMask :
663 (dcd->mask.antiattr ||
664 dcd->mask.attrFile != ALLATTRS) ?
665 GetPString(IDS_ALLTEXT) : NullStr,
666 (*dcd->mask.szMask || dcd->mask.antiattr ||
667 dcd->mask.attrFile != ALLATTRS) ? ")" : NullStr,
668 dcd->directory);
669 }
670 else {
671 sprintf(s, " [%s / %s]%s %s", tf, tb, szFree, dcd->directory);
672 }
673 if (dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent))
674 WinSetWindowText(hwndStatus, s);
675 }
676 return 0;
677
678 case UM_FLESH:
679 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
680 if (dcd) {
681
682 PCNRITEM pci, pciC;
683
684 pci = WinSendMsg(dcd->hwndCnr,
685 CM_QUERYRECORD,
686 MPVOID, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
687 while (pci && (INT) pci != -1) {
688 if (pci->attrFile & FILE_DIRECTORY) {
689 pciC = WinSendMsg(dcd->hwndCnr,
690 CM_QUERYRECORD,
691 MPFROMP(pci),
692 MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
693 if (!pciC) {
694 Stubby(dcd->hwndCnr, pci);
695 DosSleep(1);
696 }
697 }
698 pci = WinSendMsg(dcd->hwndCnr,
699 CM_QUERYRECORD,
700 MPFROMP(pci), MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
701 }
702 dcd->firsttree = TRUE;
703 }
704 return 0;
705
706 case UM_RESCAN:
707 /*
708 * populate container
709 */
710 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
711 if (dcd) {
712 DosEnterCritSec();
713 if (dcd->stopflag)
714 dcd->stopflag--;
715 if (dcd->stopflag) {
716 DosExitCritSec();
717 return 0;
718 }
719 DosExitCritSec();
720 if (mp1) {
721 strcpy(dcd->previous, dcd->directory);
722 strcpy(dcd->directory, (CHAR *) mp1);
723 }
724 MakeValidDir(dcd->directory);
725 {
726 CHAR s[CCHMAXPATH + 8];
727
728 sprintf(s,
729 "%s%s%s",
730 (ParentIsDesktop(dcd->hwndFrame, (HWND) 0)) ?
731 "VDir" :
732 NullStr,
733 (ParentIsDesktop(dcd->hwndFrame, (HWND) 0)) ?
734 (!dcd->dontclose) ?
735 " Master: " : ": " : NullStr, dcd->directory);
736 WinSetWindowText(dcd->hwndFrame, s);
737 WinSetWindowText(WinWindowFromID(dcd->hwndFrame, FID_TITLEBAR), s);
738 }
739 RemoveCnrItems(dcd->hwndCnr, NULL, 0, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
740 AdjustCnrColsForFSType(dcd->hwndCnr, dcd->directory, dcd);
741 dcd->ullTotalBytes = dcd->totalfiles =
742 dcd->selectedfiles = dcd->selectedbytes = 0;
743 WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, "0 / 0k");
744 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, "0 / 0k");
745 if (hwndStatus &&
746 dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
747 WinSetWindowText(hwndStatus, GetPString(IDS_SCANNINGTEXT));
748 if (hwndMain)
749 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
750 }
751 if (fSwitchTree && hwndTree) {
752 if (hwndMain) {
753 if (TopWindow(hwndMain, (HWND) 0) == dcd->hwndFrame)
754 WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(dcd->directory), MPVOID);
755 }
756 else
757 WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(dcd->directory), MPVOID);
758 }
759 dcd->firsttree = FALSE;
760 // fixme to check errors
761 FillDirCnr(dcd->hwndCnr, dcd->directory, dcd, &dcd->ullTotalBytes);
762 PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
763 if (mp2 && !fLeaveTree && (dcd->flWindowAttr & CV_TREE)) {
764
765 ULONG flWindowAttr = dcd->flWindowAttr;
766 CNRINFO cnri;
767
768 flWindowAttr &=
769 (~(CV_NAME | CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
770 if (dcd->lastattr) {
771 if (dcd->lastattr & CV_TEXT)
772 flWindowAttr |= CV_TEXT;
773 else if (dcd->lastattr & CV_DETAIL)
774 flWindowAttr |= CV_DETAIL;
775 else if (dcd->lastattr & CV_ICON)
776 flWindowAttr |= CV_ICON;
777 else
778 flWindowAttr |= CV_NAME;
779 }
780 else
781 flWindowAttr |= CV_NAME;
782 flWindowAttr |= CV_FLOW;
783 memset(&cnri, 0, sizeof(CNRINFO));
784 cnri.cb = sizeof(CNRINFO);
785 if (WinSendMsg(dcd->hwndCnr, CM_QUERYCNRINFO, MPFROMP(&cnri),
786 MPFROMLONG(sizeof(CNRINFO)))) {
787 dcd->flWindowAttr = cnri.flWindowAttr = flWindowAttr;
788 WinSendMsg(dcd->hwndCnr, CM_SETCNRINFO,
789 MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));
790 SayView(WinWindowFromID(dcd->hwndClient,
791 DIR_VIEW), dcd->flWindowAttr);
792 }
793 }
794 if (dcd->flWindowAttr & CV_TREE)
795 PostMsg(dcd->hwndObject, UM_FLESH, MPVOID, MPVOID);
796 if (*dcd->previous) {
797 if (strlen(dcd->previous) > strlen(dcd->directory) &&
798 !strnicmp(dcd->directory, dcd->previous,
799 strlen(dcd->directory)))
800 {
801 PCNRITEM pci = FindCnrRecord(dcd->hwndCnr,
802 dcd->previous,
803 NULL, TRUE, FALSE, TRUE);
804 if (pci && (INT) pci != -1) {
805 // make found item current (cursored) item
806 WinSendMsg(dcd->hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci),
807 MPFROM2SHORT(TRUE, CRA_CURSORED));
808 /* make sure that record shows in viewport */
809 ShowCnrRecord(dcd->hwndCnr, (PMINIRECORDCORE) pci);
810 }
811 }
812 }
813 }
814 return 0;
815
816 case UM_COMMAND:
817 if (mp1) {
818
819 LISTINFO *li = (LISTINFO *) mp1;
820
821 switch (li->type) {
822 case IDM_DOITYOURSELF:
823 case IDM_APPENDTOCLIP:
824 case IDM_SAVETOCLIP:
825 case IDM_ARCHIVE:
826 case IDM_ARCHIVEM:
827 case IDM_VIEWTEXT:
828 case IDM_VIEWBINARY:
829 case IDM_VIEWARCHIVE:
830 case IDM_VIEW:
831 case IDM_EDITTEXT:
832 case IDM_EDITBINARY:
833 case IDM_EDIT:
834 case IDM_OBJECT:
835 case IDM_SHADOW:
836 case IDM_SHADOW2:
837 case IDM_PRINT:
838 case IDM_ATTRS:
839 case IDM_DELETE:
840 case IDM_PERMDELETE:
841 case IDM_MCIPLAY:
842 case IDM_UPDATE:
843 if (PostMsg(hwnd, UM_MASSACTION, mp1, mp2))
844 return (MRESULT) TRUE;
845 break;
846 default:
847 if (PostMsg(hwnd, UM_ACTION, mp1, mp2))
848 return (MRESULT) TRUE;
849 }
850 }
851 return 0;
852
853 case UM_SELECT:
854 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
855 if (dcd) {
856 switch (SHORT1FROMMP(mp1)) {
857 case IDM_SELECTBOTH:
858 case IDM_SELECTONE:
859 case IDM_SELECTMORE:
860 case IDM_SELECTNEWER:
861 case IDM_SELECTOLDER:
862 case IDM_SELECTBIGGER:
863 case IDM_SELECTSMALLER:
864 case IDM_DESELECTBOTH:
865 case IDM_DESELECTONE:
866 case IDM_DESELECTMORE:
867 case IDM_DESELECTNEWER:
868 case IDM_DESELECTOLDER:
869 case IDM_DESELECTBIGGER:
870 case IDM_DESELECTSMALLER:
871 SpecialSelect2(dcd->hwndParent, SHORT1FROMMP(mp1));
872 break;
873 case IDM_SELECTLIST:
874 {
875 CHAR filename[CCHMAXPATH], *p, *pp;
876 ULONG size;
877
878 strcpy(filename, "*.LST");
879 size = CCHMAXPATH;
880 PrfQueryProfileData(fmprof, appname, "SaveToListName",
881 filename, &size);
882 pp = strrchr(filename, '\\');
883 if (!pp)
884 pp = filename;
885 p = strrchr(pp, '.');
886 if (p && *(p + 1) && p > pp + 1) {
887 if (pp > filename)
888 pp++;
889 *pp = '*';
890 pp++;
891 if (p > pp)
892 memmove(pp, p, strlen(p) + 1);
893 }
894 if (insert_filename(hwnd, filename, FALSE, FALSE))
895 SelectList(dcd->hwndCnr, TRUE, FALSE, FALSE, NULL, filename,
896 NULL);
897 }
898 break;
899 case IDM_SELECTALL:
900 SelectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
901 break;
902 case IDM_DESELECTALL:
903 DeselectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
904 break;
905 case IDM_SELECTALLFILES:
906 SelectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
907 break;
908 case IDM_DESELECTALLFILES:
909 DeselectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
910 break;
911 case IDM_SELECTALLDIRS:
912 SelectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
913 break;
914 case IDM_DESELECTALLDIRS:
915 DeselectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
916 break;
917 case IDM_DESELECTMASK:
918 case IDM_SELECTMASK:
919 {
920 MASK mask;
921 PCNRITEM pci = (PCNRITEM) mp2;
922
923 memset(&mask, 0, sizeof(MASK));
924 mask.fNoAttribs = TRUE;
925 mask.fNoDirs = TRUE;
926 mask.fText = TRUE;
927 strcpy(mask.prompt,
928 GetPString((SHORT1FROMMP(mp1) == IDM_SELECTMASK) ?
929 IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT));
930 if (pci && (INT) pci != -1)
931 strcpy(mask.szMask, pci->pszFileName);
932 if (WinDlgBox(HWND_DESKTOP,
933 dcd->hwndCnr,
934 PickMaskDlgProc,
935 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
936 if (SHORT1FROMMP(mp1) == IDM_SELECTMASK)
937 SelectAll(dcd->hwndCnr,
938 TRUE, TRUE, mask.szMask, mask.szText, FALSE);
939 else
940 DeselectAll(dcd->hwndCnr,
941 TRUE, TRUE, mask.szMask, mask.szText, FALSE);
942 }
943 }
944 break;
945
946 case IDM_DESELECTCLIP:
947 case IDM_SELECTCLIP:
948 {
949 CHAR **list;
950
951 list = ListFromClipboard(hwnd);
952 if (list) {
953 SelectList(dcd->hwndCnr, TRUE, FALSE,
954 (SHORT1FROMMP(mp1) == IDM_DESELECTCLIP),
955 NULL, NULL, list);
956 FreeList(list);
957 }
958 }
959 break;
960
961 case IDM_INVERT:
962 InvertAll(dcd->hwndCnr);
963 break;
964 }
965 }
966 return 0;
967
968 case UM_MASSACTION:
969 if (mp1) {
970
971 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
972 if (dcd) {
973
974 WORKER *wk;
975
976 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
977 if (!wk)
978 FreeListInfo((LISTINFO *) mp1);
979 else {
980 wk->size = sizeof(WORKER);
981 wk->hwndCnr = dcd->hwndCnr;
982 wk->hwndParent = dcd->hwndParent;
983 wk->hwndFrame = dcd->hwndFrame;
984 wk->hwndClient = dcd->hwndClient;
985 wk->li = (LISTINFO *) mp1;
986 strcpy(wk->directory, dcd->directory);
987 if (_beginthread(MassAction, NULL, 122880, (PVOID) wk) == -1) {
988 Runtime_Error(pszSrcFile, __LINE__,
989 GetPString(IDS_COULDNTSTARTTHREADTEXT));
990 free(wk);
991 FreeListInfo((LISTINFO *) mp1);
992 }
993 }
994 }
995 }
996 return 0;
997
998 case UM_ACTION:
999 if (mp1) {
1000
1001 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
1002 if (dcd) {
1003
1004 WORKER *wk;
1005
1006 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
1007 if (!wk)
1008 FreeListInfo((LISTINFO *) mp1);
1009 else {
1010 wk->size = sizeof(WORKER);
1011 wk->hwndCnr = dcd->hwndCnr;
1012 wk->hwndParent = dcd->hwndParent;
1013 wk->hwndFrame = dcd->hwndFrame;
1014 wk->hwndClient = dcd->hwndClient;
1015 wk->li = (LISTINFO *) mp1;
1016 strcpy(wk->directory, dcd->directory);
1017 if (_beginthread(Action, NULL, 122880, (PVOID) wk) == -1) {
1018 Runtime_Error(pszSrcFile, __LINE__,
1019 GetPString(IDS_COULDNTSTARTTHREADTEXT));
1020 free(wk);
1021 FreeListInfo((LISTINFO *) mp1);
1022 }
1023 }
1024 }
1025 }
1026 return 0;
1027
1028 case WM_CLOSE:
1029 WinDestroyWindow(hwnd);
1030 break;
1031
1032 case WM_DESTROY:
1033 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
1034 if (dcd) {
1035 if (dcd->hwndRestore)
1036 WinSetWindowPos(dcd->hwndRestore,
1037 HWND_TOP,
1038 0,
1039 0,
1040 0,
1041 0,
1042 SWP_RESTORE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);
1043 FreeList(dcd->lastselection);
1044 free(dcd);
1045 DosPostEventSem(CompactSem);
1046 }
1047 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
1048 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
1049 break;
1050 }
1051 return WinDefWindowProc(hwnd, msg, mp1, mp2);
1052}
1053
1054MRESULT EXPENTRY DirCnrWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
1055{
1056 DIRCNRDATA *dcd = INSTDATA(hwnd);
1057
1058 switch (msg) {
1059 case DM_PRINTOBJECT:
1060 return MRFROMLONG(DRR_TARGET);
1061
1062 case DM_DISCARDOBJECT:
1063 if (dcd)
1064 return WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
1065 else
1066 return MRFROMLONG(DRR_TARGET);
1067
1068 case WM_CHAR:
1069 shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
1070 if (SHORT1FROMMP(mp1) & KC_KEYUP)
1071 return (MRESULT) TRUE;
1072 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
1073 switch (SHORT2FROMMP(mp2)) {
1074 case VK_INSERT:
1075 if ((shiftstate & KC_CTRL) == KC_CTRL)
1076 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_MKDIR, 0), MPVOID);
1077 else if ((shiftstate & KC_ALT) == KC_ALT)
1078 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_CREATE, 0), MPVOID);
1079 break;
1080 case VK_PAGEUP:
1081 if ((shiftstate & KC_CTRL) == KC_CTRL)
1082 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PARENT, 0), MPVOID);
1083 break;
1084 case VK_PAGEDOWN:
1085 if ((shiftstate & KC_CTRL) == KC_CTRL)
1086 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PREVIOUS, 0), MPVOID);
1087 break;
1088 case VK_HOME:
1089 if ((shiftstate & KC_CTRL) == KC_CTRL && dcd) {
1090
1091 CHAR s[CCHMAXPATH], *p;
1092
1093 strcpy(s, dcd->directory);
1094 p = strchr(s, '\\');
1095 if (p) {
1096 p++;
1097 *p = 0;
1098 WinSendMsg(hwnd, UM_SETDIR, MPFROMP(s), MPVOID);
1099 }
1100 }
1101 break;
1102 case VK_DELETE:
1103 if ((shiftstate & KC_CTRL) == KC_CTRL)
1104 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PERMDELETE, 0), MPVOID);
1105 else if ((shiftstate & KC_SHIFT) == KC_SHIFT)
1106 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SAVETOCLIP, 0), MPVOID);
1107 else
1108 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID);
1109 break;
1110 }
1111 }
1112 if (shiftstate || fNoSearch)
1113 break;
1114 if (SHORT1FROMMP(mp1) & KC_CHAR) {
1115
1116 ULONG thistime, len;
1117 SEARCHSTRING srch;
1118 PCNRITEM pci;
1119
1120 if (!dcd)
1121 break;
1122 switch (SHORT1FROMMP(mp2)) {
1123 case '\x1b':
1124 case '\r':
1125 case '\n':
1126 dcd->lasttime = 0;
1127 *dcd->szCommonName = 0;
1128 break;
1129 default:
1130 thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd));
1131 if (thistime > dcd->lasttime + 1250)
1132 *dcd->szCommonName = 0;
1133 dcd->lasttime = thistime;
1134 if (SHORT1FROMMP(mp2) == ' ' && !dcd->szCommonName)
1135 break;
1136 KbdRetry:
1137 len = strlen(dcd->szCommonName);
1138 if (len >= CCHMAXPATH - 1) {
1139 *dcd->szCommonName = 0;
1140 len = 0;
1141 }
1142 dcd->szCommonName[len] = toupper(SHORT1FROMMP(mp2));
1143 dcd->szCommonName[len + 1] = 0;
1144 memset(&srch, 0, sizeof(SEARCHSTRING));
1145 srch.cb = (ULONG) sizeof(SEARCHSTRING);
1146 srch.pszSearch = (PSZ) dcd->szCommonName;
1147 srch.fsPrefix = TRUE;
1148 srch.fsCaseSensitive = FALSE;
1149 srch.usView = CV_ICON;
1150 pci = WinSendMsg(hwnd, CM_SEARCHSTRING, MPFROMP(&srch),
1151 MPFROMLONG(CMA_FIRST));
1152 if (pci && (INT) pci != -1) {
1153
1154 USHORT attrib = CRA_CURSORED;
1155
1156 /* make found item current item */
1157 if (!stricmp(pci->pszFileName, dcd->szCommonName))
1158 attrib |= CRA_SELECTED;
1159 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
1160 MPFROM2SHORT(TRUE, attrib));
1161 /* make sure that record shows in viewport */
1162 ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
1163 return (MRESULT) TRUE;
1164 }
1165 else {
1166 if (SHORT1FROMMP(mp2) == ' ') {
1167 dcd->szCommonName[len] = 0;
1168 break;
1169 }
1170 *dcd->szCommonName = 0;
1171 dcd->lasttime = 0;
1172 if (len) // retry as first letter if no match
1173 goto KbdRetry;
1174 }
1175 break;
1176 }
1177 }
1178 break;
1179
1180 case WM_MOUSEMOVE:
1181 case WM_BUTTON1UP:
1182 case WM_BUTTON2UP:
1183 case WM_BUTTON3UP:
1184 case WM_CHORD:
1185 shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
1186 break;
1187
1188 case WM_BUTTON1MOTIONEND:
1189 {
1190 CNRINFO cnri;
1191
1192 memset(&cnri, 0, sizeof(CNRINFO));
1193 cnri.cb = sizeof(CNRINFO);
1194 if (WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
1195 MPFROMLONG(sizeof(CNRINFO)))) {
1196 if (cnri.flWindowAttr & CV_DETAIL)
1197 PrfWriteProfileData(fmprof, appname, "CnrSplitBar",
1198 (PVOID) & cnri.xVertSplitbar, sizeof(LONG));
1199 }
1200 }
1201 break;
1202
1203 case UM_COMPARE:
1204 if (dcd && mp1 && mp2) {
1205
1206 COMPARE *cmp;
1207 CHAR *leftdir = (CHAR *) mp1, *rightdir = (CHAR *) mp2;
1208
1209 if (!IsFile(leftdir) && !IsFile(rightdir)) {
1210 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
1211 if (cmp) {
1212 cmp->size = sizeof(COMPARE);
1213 strcpy(cmp->leftdir, leftdir);
1214 strcpy(cmp->rightdir, rightdir);
1215 cmp->hwndParent = dcd->hwndParent;
1216 cmp->dcd.hwndParent = dcd->hwndParent;
1217 WinDlgBox(HWND_DESKTOP,
1218 HWND_DESKTOP,
1219 CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
1220 }
1221 }
1222 }
1223 return 0;
1224
1225 case WM_PRESPARAMCHANGED:
1226 PresParamChanged(hwnd, "DirCnr", mp1, mp2);
1227 break;
1228
1229 case UM_UPDATERECORDLIST:
1230 if (dcd && mp1)
1231 WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
1232 return 0;
1233
1234 case UM_UPDATERECORD:
1235 if (dcd && mp1) {
1236
1237 CHAR *filename;
1238
1239 filename = mp1;
1240 if (filename)
1241 UpdateCnrRecord(hwnd, filename, TRUE, dcd);
1242 }
1243 return 0;
1244
1245 case WM_SETFOCUS:
1246 /*
1247 * put name of our window (directory name) on status line
1248 */
1249 if (dcd && hwndStatus && mp2) {
1250
1251 PCNRITEM pci = NULL;
1252
1253 if (fAutoView && hwndMain) {
1254 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
1255 MPFROMSHORT(CRA_CURSORED));
1256 if (pci && (INT) pci != -1 &&
1257 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
1258 WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
1259 else
1260 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1261 }
1262 if (*dcd->directory) {
1263 if (hwndMain)
1264 WinSendMsg(hwndMain,
1265 UM_SETUSERLISTNAME, MPFROMP(dcd->directory), MPVOID);
1266 else
1267 add_udir(FALSE, dcd->directory);
1268 }
1269 if (hwndMain)
1270 PostMsg(hwndMain, UM_ADVISEFOCUS, MPFROMLONG(dcd->hwndFrame), MPVOID);
1271 }
1272 if (mp2) {
1273 LastDir = hwnd;
1274 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1275 if (fSwitchTreeOnFocus && hwndTree && dcd && *dcd->directory)
1276 WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(dcd->directory), MPVOID);
1277 }
1278 break;
1279
1280 case UM_SETDIR:
1281 if (dcd && mp1) {
1282
1283 CHAR fullname[CCHMAXPATH];
1284
1285 DosError(FERR_DISABLEHARDERR);
1286 if (!DosQueryPathInfo((CHAR *) mp1,
1287 FIL_QUERYFULLNAME, fullname, sizeof(fullname))) {
1288 if (stricmp(dcd->directory, fullname)) {
1289 strcpy(dcd->previous, dcd->directory);
1290 strcpy(dcd->directory, fullname);
1291 DosEnterCritSec();
1292 dcd->stopflag++;
1293 DosExitCritSec();
1294 if (!PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPFROMLONG(1L))) {
1295 strcpy(dcd->directory, dcd->previous);
1296 DosEnterCritSec();
1297 dcd->stopflag--;
1298 DosExitCritSec();
1299 }
1300 else if (*dcd->directory) {
1301 if (hwndMain)
1302 WinSendMsg(hwndMain,
1303 UM_SETUSERLISTNAME, MPFROMP(dcd->directory), MPVOID);
1304 else
1305 add_udir(FALSE, dcd->directory);
1306 }
1307 }
1308 }
1309 }
1310 break;
1311
1312 case UM_RESCAN:
1313 if (dcd) {
1314
1315 CNRINFO cnri;
1316 CHAR s[CCHMAXPATH * 2], tf[81], tb[81];
1317 PCNRITEM pci;
1318
1319 memset(&cnri, 0, sizeof(CNRINFO));
1320 cnri.cb = sizeof(CNRINFO);
1321 WinSendMsg(hwnd,
1322 CM_QUERYCNRINFO,
1323 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
1324 cnri.pszCnrTitle = dcd->directory;
1325 WinSendMsg(hwnd,
1326 CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_CNRTITLE));
1327 dcd->totalfiles = cnri.cRecords;
1328 commafmt(tb, sizeof(tb), dcd->totalfiles);
1329 CommaFmtULL(tf, sizeof(tf), dcd->ullTotalBytes, 'K');
1330 sprintf(s, "%s / %s", tb, tf);
1331 WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, s);
1332 commafmt(tb, sizeof(tb), dcd->selectedfiles);
1333 CommaFmtULL(tf, sizeof(tf), dcd->selectedbytes, 'K');
1334 sprintf(s, "%s / %s", tb, tf);
1335 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
1336 if (hwndStatus &&
1337 dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
1338 PostMsg(dcd->hwndObject, UM_RESCAN2, MPVOID, MPVOID);
1339 if ((fSplitStatus && hwndStatus2) || fMoreButtons) {
1340 pci = WinSendMsg(hwnd,
1341 CM_QUERYRECORDEMPHASIS,
1342 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
1343 if (pci && (INT) pci != -1) {
1344 if (fSplitStatus && hwndStatus2) {
1345 CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
1346 if (!fMoreButtons)
1347 sprintf(s,
1348 " %s %04u/%02u/%02u %02u:%02u:%02u [%s] %s",
1349 tb,
1350 pci->date.year,
1351 pci->date.month,
1352 pci->date.day,
1353 pci->time.hours,
1354 pci->time.minutes,
1355 pci->time.seconds,
1356 pci->pszDispAttr, pci->pszFileName);
1357 else {
1358 *tf = 0;
1359 if (pci->cbFile + pci->easize > 1024) {
1360 CommaFmtULL(tf, sizeof(tf), pci->cbFile + pci->easize, 'K');
1361 }
1362 sprintf(s,
1363 GetPString(IDS_STATUSSIZETEXT),
1364 tb, *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
1365 }
1366 WinSetWindowText(hwndStatus2, s);
1367 }
1368 else
1369 WinSetWindowText(hwndStatus2, NullStr);
1370 if (fMoreButtons) {
1371 WinSetWindowText(hwndName, pci->pszFileName);
1372 sprintf(s,
1373 "%04u/%02u/%02u %02u:%02u:%02u",
1374 pci->date.year,
1375 pci->date.month,
1376 pci->date.day,
1377 pci->time.hours, pci->time.minutes, pci->time.seconds);
1378 WinSetWindowText(hwndDate, s);
1379 WinSetWindowText(hwndAttr, pci->pszDispAttr);
1380 }
1381 }
1382 else {
1383 WinSetWindowText(hwndStatus2, NullStr);
1384 WinSetWindowText(hwndName, NullStr);
1385 WinSetWindowText(hwndDate, NullStr);
1386 WinSetWindowText(hwndAttr, NullStr);
1387 }
1388 }
1389 }
1390 }
1391 return 0;
1392
1393 case UM_SORTRECORD:
1394 if (dcd) {
1395
1396 CNRINFO cnri;
1397
1398 memset(&cnri, 0, sizeof(CNRINFO));
1399 cnri.cb = sizeof(CNRINFO);
1400 WinSendMsg(hwnd,
1401 CM_QUERYCNRINFO,
1402 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
1403 cnri.pSortRecord = (PVOID) SortDirCnr;
1404 WinSendMsg(hwnd,
1405 CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_PSORTRECORD));
1406 WinSendMsg(hwnd,
1407 CM_SORTRECORD,
1408 MPFROMP(SortDirCnr), MPFROMLONG(dcd->sortFlags));
1409 }
1410 return 0;
1411
1412 case UM_SETUP:
1413 if (dcd) {
1414 if (!dcd->hwndObject) {
1415 /*
1416 * first time through -- set things up
1417 */
1418
1419 CNRINFO cnri;
1420
1421 RestorePresParams(hwnd, "DirCnr");
1422 LoadDetailsSwitches("DirCnr", dcd);
1423 memset(&cnri, 0, sizeof(CNRINFO));
1424 cnri.cb = sizeof(CNRINFO);
1425 WinSendMsg(hwnd,
1426 CM_QUERYCNRINFO,
1427 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
1428 cnri.cyLineSpacing = 0;
1429 cnri.cxTreeIndent = 12L;
1430
1431 cnri.flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
1432 cnri.flWindowAttr |= (CV_NAME | CA_DETAILSVIEWTITLES | CV_MINI |
1433 CV_FLOW);
1434 cnri.pSortRecord = (PVOID) SortDirCnr;
1435
1436 {
1437 ULONG size = sizeof(ULONG);
1438
1439 PrfQueryProfileData(fmprof,
1440 appname,
1441 "DirflWindowAttr",
1442 (PVOID) & cnri.flWindowAttr, &size);
1443 size = sizeof(MASK);
1444 if (!*dcd->mask.szMask &&
1445 !dcd->mask.attrFile && !dcd->mask.antiattr) {
1446 if (PrfQueryProfileSize(fmprof,
1447 appname, "DirFilter", &size) && size) {
1448 PrfQueryProfileData(fmprof,
1449 appname, "DirFilter", &dcd->mask, &size);
1450 SetMask(dcd->mask.szMask, &dcd->mask);
1451 }
1452 else
1453 dcd->mask.attrFile = (FILE_READONLY | FILE_NORMAL |
1454 FILE_ARCHIVED | FILE_DIRECTORY |
1455 FILE_HIDDEN | FILE_SYSTEM);
1456 }
1457 *(dcd->mask.prompt) = 0;
1458 }
1459 if (dcd->flWindowAttr)
1460 cnri.flWindowAttr = dcd->flWindowAttr;
1461 else
1462 dcd->flWindowAttr = cnri.flWindowAttr;
1463 cnri.flWindowAttr &= (~(CA_MIXEDTARGETEMPH | CA_ORDEREDTARGETEMPH |
1464 CA_TITLEREADONLY | CA_TITLESEPARATOR));
1465 cnri.flWindowAttr |= CV_FLOW;
1466 dcd->flWindowAttr |= CV_FLOW;
1467 if (WinWindowFromID(dcd->hwndFrame, FID_TITLEBAR))
1468 cnri.flWindowAttr &= (~CA_CONTAINERTITLE);
1469 else
1470 cnri.flWindowAttr |= CA_CONTAINERTITLE;
1471 if (!dcd->sortFlags)
1472 dcd->sortFlags = sortFlags;
1473 WinSendMsg(hwnd,
1474 CM_SETCNRINFO,
1475 MPFROMP(&cnri),
1476 MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING |
1477 CMA_CXTREEINDENT | CMA_PSORTRECORD));
1478 SetCnrCols(hwnd, FALSE);
1479 AdjustCnrColsForPref(hwnd, NULL, dcd, FALSE);
1480 if (_beginthread(MakeObjWin, NULL, 245760, (PVOID) dcd) == -1) {
1481 Runtime_Error(pszSrcFile, __LINE__,
1482 GetPString(IDS_COULDNTSTARTTHREADTEXT));
1483 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
1484 return 0;
1485 }
1486 else
1487 DosSleep(32); //05 Aug 07 GKY 64
1488 WinEnableMenuItem(DirCnrMenu, IDM_FINDINTREE, (hwndTree != (HWND) 0));
1489 }
1490 SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1491 DIR_FILTER), &dcd->mask, FALSE);
1492 SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1493 DIR_SORT), dcd->sortFlags, FALSE);
1494 SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1495 DIR_VIEW), dcd->flWindowAttr);
1496 }
1497 else {
1498 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
1499 return 0;
1500 }
1501 return 0;
1502
1503 case WM_MENUEND:
1504 if (dcd) {
1505
1506 HWND hwndMenu = (HWND) mp2;
1507
1508 if (hwndMenu == DirCnrMenu ||
1509 hwndMenu == FileMenu || hwndMenu == DirMenu) {
1510 MarkAll(hwnd, TRUE, FALSE, TRUE);
1511 if (dcd->cnremphasized) {
1512 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
1513 MPFROM2SHORT(FALSE, CRA_SOURCE));
1514 dcd->cnremphasized = FALSE;
1515 }
1516 }
1517 }
1518 break;
1519
1520 case UM_OPENWINDOWFORME:
1521 if (dcd) {
1522 if (mp1 && !IsFile((CHAR *) mp1)) {
1523 OpenDirCnr(hwnd, dcd->hwndParent, dcd->hwndFrame, FALSE, (char *)mp1);
1524 }
1525 else if (mp1 && IsFile(mp1) == 1) {
1526 StartArcCnr(HWND_DESKTOP,
1527 dcd->hwndFrame, (CHAR *) mp1, 4, (ARC_TYPE *) mp2);
1528 }
1529 }
1530 return 0;
1531
1532 case MM_PORTHOLEINIT:
1533 if (dcd) {
1534 switch (SHORT1FROMMP(mp1)) {
1535 case 0:
1536 case 1:
1537 {
1538 ULONG wmsg;
1539
1540 wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
1541 PortholeInit((HWND) WinSendMsg(dcd->hwndClient,
1542 wmsg, MPVOID, MPVOID), mp1, mp2);
1543 }
1544 break;
1545 }
1546 }
1547 break;
1548
1549 case UM_INITMENU:
1550 case WM_INITMENU:
1551 if (dcd) {
1552 switch (SHORT1FROMMP(mp1)) {
1553 case IDM_FILESMENU:
1554 if (isalpha(*dcd->directory)) {
1555 if (driveflags[toupper(*dcd->directory) - 'A'] & DRIVE_NOTWRITEABLE) {
1556 WinEnableMenuItem((HWND) mp2, IDM_MOVEMENU, FALSE);
1557 WinEnableMenuItem((HWND) mp2, IDM_RENAME, FALSE);
1558 WinEnableMenuItem((HWND) mp2, IDM_MKDIR, FALSE);
1559 WinEnableMenuItem((HWND) mp2, IDM_UNDELETE, FALSE);
1560 WinEnableMenuItem((HWND) mp2, IDM_DELETESUBMENU, FALSE);
1561 WinEnableMenuItem((HWND) mp2, IDM_DELETE, FALSE);
1562 WinEnableMenuItem((HWND) mp2, IDM_EDIT, FALSE);
1563 WinEnableMenuItem((HWND) mp2, IDM_EDITTEXT, FALSE);
1564 WinEnableMenuItem((HWND) mp2, IDM_EDITBINARY, FALSE);
1565 WinEnableMenuItem((HWND) mp2, IDM_ATTRS, FALSE);
1566 }
1567 else {
1568 WinEnableMenuItem((HWND) mp2, IDM_MOVEMENU, TRUE);
1569 WinEnableMenuItem((HWND) mp2, IDM_RENAME, TRUE);
1570 WinEnableMenuItem((HWND) mp2, IDM_MKDIR, TRUE);
1571 WinEnableMenuItem((HWND) mp2, IDM_UNDELETE, TRUE);
1572 WinEnableMenuItem((HWND) mp2, IDM_DELETESUBMENU, TRUE);
1573 WinEnableMenuItem((HWND) mp2, IDM_DELETE, TRUE);
1574 WinEnableMenuItem((HWND) mp2, IDM_EDIT, TRUE);
1575 WinEnableMenuItem((HWND) mp2, IDM_EDITTEXT, TRUE);
1576 WinEnableMenuItem((HWND) mp2, IDM_EDITBINARY, TRUE);
1577 WinEnableMenuItem((HWND) mp2, IDM_ATTRS, TRUE);
1578 }
1579 }
1580 break;
1581
1582 case IDM_VIEWSMENU:
1583 SetViewMenu((HWND) mp2, dcd->flWindowAttr);
1584 WinEnableMenuItem((HWND) mp2, IDM_RESELECT,
1585 (dcd->lastselection != NULL));
1586 if (isalpha(*dcd->directory)) {
1587 if (driveflags[toupper(*dcd->directory) - 'A'] & DRIVE_NOTWRITEABLE)
1588 WinEnableMenuItem((HWND) mp2, IDM_MKDIR, FALSE);
1589 else
1590 WinEnableMenuItem((HWND) mp2, IDM_MKDIR, TRUE);
1591 }
1592 WinEnableMenuItem((HWND) mp2,
1593 IDM_SELECTCOMPAREMENU,
1594 (CountDirCnrs(dcd->hwndParent) > 1));
1595 break;
1596
1597 case IDM_DETAILSSETUP:
1598 SetDetailsSwitches((HWND) mp2, dcd);
1599 break;
1600
1601 case IDM_COMMANDSMENU:
1602 SetupCommandMenu((HWND) mp2, hwnd);
1603 break;
1604
1605 case IDM_SORTSUBMENU:
1606 SetSortChecks((HWND) mp2, dcd->sortFlags);
1607 break;
1608
1609 case IDM_WINDOWSMENU:
1610 SetupWinList((HWND) mp2,
1611 (hwndMain) ? hwndMain : (HWND) 0, dcd->hwndFrame);
1612 break;
1613 }
1614 dcd->hwndLastMenu = (HWND) mp2;
1615 }
1616 if (msg == WM_INITMENU)
1617 break;
1618 return 0;
1619
1620 case UM_FILTER:
1621 if (dcd) {
1622
1623 PCNRITEM pci;
1624
1625 if (mp1) {
1626 DosEnterCritSec();
1627 SetMask((CHAR *) mp1, &dcd->mask);
1628 DosExitCritSec();
1629 }
1630 dcd->suspendview = 1;
1631 WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));
1632 dcd->suspendview = 0;
1633 if (fAutoView && hwndMain) {
1634 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1635 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
1636 if (pci && (INT) pci != -1 &&
1637 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
1638 WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
1639 else
1640 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1641 }
1642 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1643 }
1644 return 0;
1645
1646 case UM_COMMAND:
1647 if (mp1) {
1648 if (dcd) {
1649 if (!PostMsg(dcd->hwndObject, UM_COMMAND, mp1, mp2)) {
1650 Runtime_Error(pszSrcFile, __LINE__, "PostMsg");
1651 FreeListInfo((LISTINFO *) mp1);
1652 }
1653 else
1654 return (MRESULT) TRUE;
1655 }
1656 else
1657 FreeListInfo((LISTINFO *) mp1);
1658 }
1659 return 0;
1660
1661 case UM_NOTIFY:
1662 if (mp2)
1663 Notify((CHAR *) mp2);
1664 return 0;
1665
1666 case UM_DRIVECMD:
1667 if (mp1)
1668 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SWITCH, 0), mp1);
1669 return 0;
1670
1671 case WM_COMMAND:
1672 DosError(FERR_DISABLEHARDERR);
1673 if (dcd) {
1674 switch (SHORT1FROMMP(mp1)) {
1675 case IDM_SETTARGET:
1676 SetTargetDir(hwnd, FALSE);
1677 break;
1678
1679 case IDM_CREATE:
1680 {
1681 STRINGINPARMS sip;
1682 CHAR filename[CCHMAXPATHCOMP];
1683
1684 memset(&sip, 0, sizeof(sip));
1685 sip.help = GetPString(IDS_CREATETEXT);
1686 sip.prompt = GetPString(IDS_CREATEPROMPTTEXT);
1687 sip.inputlen = CCHMAXPATHCOMP - (strlen(dcd->directory) - 1);
1688 strcpy(filename, "NEWFILE.TXT");
1689 sip.ret = filename;
1690 sip.title = GetPString(IDS_CREATETITLETEXT);
1691 if (WinDlgBox(HWND_DESKTOP, hwnd, InputDlgProc, FM3ModHandle,
1692 STR_FRAME, &sip)) {
1693 bstrip(sip.ret);
1694 if (*sip.ret) {
1695 CHAR newfile[CCHMAXPATH];
1696 FILE *fp;
1697 INT test;
1698 PCNRITEM pci;
1699
1700 strcpy(newfile, dcd->directory);
1701 if (newfile[strlen(newfile) - 1] != '\\')
1702 strcat(newfile, "\\");
1703 strcat(newfile, sip.ret);
1704 test = IsFile(newfile);
1705 if (test != 1)
1706 fp = fopen(newfile, "w");
1707 if (test != 1 && !fp) {
1708 saymsg(MB_ENTER,
1709 hwnd,
1710 GetPString(IDS_ERRORTEXT),
1711 GetPString(IDS_CREATEERRORTEXT), newfile);
1712 }
1713 else {
1714 if (fp) {
1715 WinSendMsg(hwnd, UM_UPDATERECORD, MPFROMP(newfile), MPVOID);
1716 fclose(fp);
1717 }
1718 if (*editor) {
1719
1720 CHAR *dummy[2];
1721
1722 dummy[0] = newfile;
1723 dummy[1] = NULL;
1724 ExecOnList(hwnd,
1725 editor, WINDOWED | SEPARATE, NULL, dummy, NULL);
1726 }
1727 else
1728 StartMLEEditor(dcd->hwndParent, 4, newfile, dcd->hwndFrame);
1729 pci = FindCnrRecord(hwnd, newfile, NULL, TRUE, FALSE, TRUE);
1730 if (pci && (INT) pci != -1)
1731 /* make sure that record shows in viewport */
1732 ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
1733 }
1734 }
1735 }
1736 }
1737 break;
1738
1739 case IDM_CONTEXTMENU:
1740 {
1741 PCNRITEM pci;
1742
1743 pci = (PCNRITEM) CurrentRecord(hwnd);
1744 PostMsg(hwnd, WM_CONTROL, MPFROM2SHORT(DIR_CNR, CN_CONTEXTMENU),
1745 MPFROMP(pci));
1746 }
1747 break;
1748
1749 case IDM_MAXIMIZE:
1750 PostMsg(hwndMain, UM_MAXIMIZE, MPFROMLONG(dcd->hwndFrame), MPVOID);
1751 break;
1752
1753 case IDM_SHOWALLFILESCNR:
1754 StartSeeAll(HWND_DESKTOP, FALSE, dcd->directory);
1755 break;
1756
1757 case IDM_SHOWALLFILES:
1758 {
1759 PCNRITEM pci;
1760
1761 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1762 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
1763 if (pci && (INT) pci != -1) {
1764
1765 static CHAR dirname[CCHMAXPATH];
1766
1767 strcpy(dirname, pci->pszFileName);
1768 MakeValidDir(dirname);
1769 StartSeeAll(HWND_DESKTOP, FALSE, dirname);
1770 }
1771 }
1772 break;
1773
1774 case IDM_FINDINTREE:
1775 if (hwndTree)
1776 WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(dcd->directory),
1777 MPFROMLONG(1L));
1778 break;
1779
1780 case IDM_BEGINEDIT:
1781 OpenEdit(hwnd);
1782 break;
1783
1784 case IDM_ENDEDIT:
1785 WinSendMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
1786 break;
1787
1788 case IDM_SHOWSELECT:
1789 QuickPopup(hwnd,
1790 dcd,
1791 CheckMenu(&DirCnrMenu, DIRCNR_POPUP), IDM_SELECTSUBMENU);
1792 break;
1793
1794 case IDM_SHOWSORT:
1795 QuickPopup(hwnd, dcd, CheckMenu(&DirCnrMenu, DIRCNR_POPUP),
1796 IDM_SORTSUBMENU);
1797 break;
1798
1799 case IDM_VIEWORARC:
1800 {
1801 SWP swp;
1802 PCNRITEM pci;
1803
1804 pci = (PCNRITEM) WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1805 MPFROMLONG(CMA_FIRST),
1806 MPFROMSHORT(CRA_CURSORED));
1807 if (pci && (INT) pci != -1) {
1808 WinQueryWindowPos(dcd->hwndFrame, &swp);
1809 DefaultViewKeys(hwnd,
1810 dcd->hwndFrame,
1811 dcd->hwndParent, &swp, pci->pszFileName);
1812 }
1813 }
1814 break;
1815
1816 case IDM_NOTEBOOK:
1817 if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
1818 PostMsg(dcd->hwndParent, msg, mp1, mp2);
1819 else
1820 WinDlgBox(HWND_DESKTOP, hwnd, CfgDlgProc, FM3ModHandle,
1821 CFG_FRAME, (PVOID) "Directory");
1822 break;
1823
1824 case IDM_QTREE:
1825 case IDM_TREE:
1826 {
1827 CHAR newpath[CCHMAXPATH];
1828 APIRET rc;
1829 PCNRITEM pci;
1830
1831 if (SHORT1FROMMP(mp1) == IDM_TREE) {
1832 pci = (PCNRITEM) CurrentRecord(hwnd);
1833 if (pci && (INT) pci != -1)
1834 strcpy(newpath, pci->pszFileName);
1835 else
1836 strcpy(newpath, dcd->directory);
1837 }
1838 else
1839 strcpy(newpath, dcd->directory);
1840 MakeValidDir(newpath);
1841 rc = WinDlgBox(HWND_DESKTOP, dcd->hwndClient, ObjCnrDlgProc,
1842 FM3ModHandle, QTREE_FRAME, MPFROMP(newpath));
1843 if (rc)
1844 WinSendMsg(hwnd, UM_SETDIR, MPFROMP(newpath), MPVOID);
1845 }
1846 break;
1847
1848 case IDM_RESELECT:
1849 SelectList(hwnd, TRUE, FALSE, FALSE, NULL, NULL, dcd->lastselection);
1850 break;
1851
1852 case IDM_HELP:
1853 if (hwndHelp) {
1854 if (!ParentIsDesktop(dcd->hwndFrame, dcd->hwndParent))
1855 PostMsg(dcd->hwndParent, UM_COMMAND, mp1, mp2);
1856 else
1857 WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
1858 }
1859 break;
1860
1861 case IDM_WINDOWDLG:
1862 if (!ParentIsDesktop(dcd->hwndFrame, dcd->hwndParent))
1863 PostMsg(dcd->hwndParent, UM_COMMAND,
1864 MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
1865 break;
1866
1867 case IDM_SORTSMARTNAME:
1868 case IDM_SORTNAME:
1869 case IDM_SORTFILENAME:
1870 case IDM_SORTSIZE:
1871 case IDM_SORTEASIZE:
1872 case IDM_SORTFIRST:
1873 case IDM_SORTLAST:
1874 case IDM_SORTLWDATE:
1875 case IDM_SORTLADATE:
1876 case IDM_SORTCRDATE:
1877 case IDM_SORTSUBJECT:
1878 dcd->sortFlags &= (SORT_REVERSE | SORT_DIRSFIRST | SORT_DIRSLAST);
1879 case IDM_SORTDIRSFIRST:
1880 case IDM_SORTDIRSLAST:
1881 case IDM_SORTREVERSE:
1882 switch (SHORT1FROMMP(mp1)) {
1883 case IDM_SORTSUBJECT:
1884 dcd->sortFlags |= SORT_SUBJECT;
1885 break;
1886 case IDM_SORTSMARTNAME:
1887 case IDM_SORTFILENAME:
1888 dcd->sortFlags |= SORT_FILENAME;
1889 break;
1890 case IDM_SORTSIZE:
1891 dcd->sortFlags |= SORT_SIZE;
1892 break;
1893 case IDM_SORTEASIZE:
1894 dcd->sortFlags |= SORT_EASIZE;
1895 break;
1896 case IDM_SORTFIRST:
1897 dcd->sortFlags |= SORT_FIRSTEXTENSION;
1898 break;
1899 case IDM_SORTLAST:
1900 dcd->sortFlags |= SORT_LASTEXTENSION;
1901 break;
1902 case IDM_SORTLWDATE:
1903 dcd->sortFlags |= SORT_LWDATE;
1904 break;
1905 case IDM_SORTLADATE:
1906 dcd->sortFlags |= SORT_LADATE;
1907 break;
1908 case IDM_SORTCRDATE:
1909 dcd->sortFlags |= SORT_CRDATE;
1910 break;
1911 case IDM_SORTDIRSFIRST:
1912 if (dcd->sortFlags & SORT_DIRSFIRST)
1913 dcd->sortFlags &= (~SORT_DIRSFIRST);
1914 else {
1915 dcd->sortFlags |= SORT_DIRSFIRST;
1916 dcd->sortFlags &= (~SORT_DIRSLAST);
1917 }
1918 break;
1919 case IDM_SORTDIRSLAST:
1920 if (dcd->sortFlags & SORT_DIRSLAST)
1921 dcd->sortFlags &= (~SORT_DIRSLAST);
1922 else {
1923 dcd->sortFlags |= SORT_DIRSLAST;
1924 dcd->sortFlags &= (~SORT_DIRSFIRST);
1925 }
1926 break;
1927 case IDM_SORTREVERSE:
1928 if (dcd->sortFlags & SORT_REVERSE)
1929 dcd->sortFlags &= (~SORT_REVERSE);
1930 else
1931 dcd->sortFlags |= SORT_REVERSE;
1932 break;
1933 }
1934 WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortDirCnr),
1935 MPFROMLONG(dcd->sortFlags));
1936 SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1937 DIR_SORT), dcd->sortFlags, FALSE);
1938 break;
1939
1940 case IDM_COLLECT:
1941 if (!Collector) {
1942
1943 HWND hwndC;
1944 SWP swp;
1945
1946 if (!ParentIsDesktop(hwnd, dcd->hwndParent) && !fAutoTile &&
1947 (!fExternalCollector && !strcmp(realappname, FM3Str)))
1948 GetNextWindowPos(dcd->hwndParent, &swp, NULL, NULL);
1949 hwndC = StartCollector((fExternalCollector ||
1950 strcmp(realappname, FM3Str)) ?
1951 HWND_DESKTOP : dcd->hwndParent, 4);
1952 if (hwndC) {
1953 if (!ParentIsDesktop(hwnd, dcd->hwndParent) && !fAutoTile &&
1954 (!fExternalCollector && !strcmp(realappname, FM3Str)))
1955 WinSetWindowPos(hwndC, HWND_TOP, swp.x, swp.y,
1956 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE |
1957 SWP_SHOW | SWP_ZORDER);
1958 else if (!ParentIsDesktop(hwnd, dcd->hwndParent) && fAutoTile &&
1959 !strcmp(realappname, FM3Str))
1960 TileChildren(dcd->hwndParent, TRUE);
1961 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
1962 DosSleep(100); //05 Aug 07 GKY 250
1963 }
1964 }
1965 else
1966 StartCollector(dcd->hwndParent, 4);
1967 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_COLLECTOR, 0), MPVOID);
1968 break;
1969
1970 case IDM_COLLECTOR:
1971 DosSleep(32); //05 Aug 07 GKY 64
1972 {
1973 CHAR **list;
1974
1975 list = BuildList(hwnd);
1976 if (list) {
1977 if (Collector) {
1978 if (!PostMsg(Collector,
1979 WM_COMMAND,
1980 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(list)))
1981 FreeList(list);
1982 else if (fUnHilite)
1983 UnHilite(hwnd, TRUE, &dcd->lastselection, 0);
1984 }
1985 else
1986 FreeList(list);
1987 }
1988 }
1989 break;
1990
1991 case IDM_UNDELETE:
1992 {
1993 PCNRITEM pci;
1994 CHAR path[CCHMAXPATH];
1995
1996 pci = (PCNRITEM) CurrentRecord(hwnd);
1997 if (pci && (INT) pci != -1) {
1998 strcpy(path, pci->pszFileName);
1999 MakeValidDir(path);
2000 WinDlgBox(HWND_DESKTOP, hwnd, UndeleteDlgProc, FM3ModHandle,
2001 UNDEL_FRAME, MPFROMP(path));
2002 }
2003 }
2004 break;
2005
2006 case IDM_UNDELETESPEC:
2007 WinDlgBox(HWND_DESKTOP,
2008 hwnd,
2009 UndeleteDlgProc,
2010 FM3ModHandle, UNDEL_FRAME, MPFROMP(dcd->directory));
2011 break;
2012
2013 case IDM_RESORT:
2014// WinSendMsg(hwnd,
2015// CM_SORTRECORD,
2016// MPFROMP(SortDirCnr),
2017// MPFROMLONG((fSyncUpdates) ? sortFlags : dcd->sortFlags));
2018 WinSendMsg(hwnd,
2019 CM_SORTRECORD,
2020 MPFROMP(SortDirCnr), MPFROMLONG(dcd->sortFlags));
2021 break;
2022
2023 case IDM_FILTER:
2024 {
2025 BOOL empty = FALSE;
2026 PCNRITEM pci;
2027 CHAR *p;
2028
2029 if (!*dcd->mask.szMask) {
2030 empty = TRUE;
2031 pci = (PCNRITEM) CurrentRecord(hwnd);
2032 if (pci && !(pci->attrFile & FILE_DIRECTORY)) {
2033 p = strrchr(pci->pszFileName, '\\');
2034 if (p) {
2035 p++;
2036 strcpy(dcd->mask.szMask, p);
2037 }
2038 }
2039 }
2040 *(dcd->mask.prompt) = 0;
2041
2042 if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
2043 FM3ModHandle, MSK_FRAME, MPFROMP(&dcd->mask)))
2044 WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
2045 else if (empty)
2046 *dcd->mask.szMask = 0;
2047 SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
2048 DIR_FILTER), &dcd->mask, FALSE);
2049 }
2050 break;
2051
2052 case IDM_HIDEALL:
2053 if (fAutoView && hwndMain)
2054 PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
2055 dcd->suspendview = 1;
2056 HideAll(hwnd);
2057 dcd->suspendview = 0;
2058 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2059 break;
2060
2061 case IDM_SELECTBOTH:
2062 case IDM_SELECTONE:
2063 case IDM_SELECTMORE:
2064 case IDM_SELECTNEWER:
2065 case IDM_SELECTOLDER:
2066 case IDM_SELECTBIGGER:
2067 case IDM_SELECTSMALLER:
2068 case IDM_DESELECTBOTH:
2069 case IDM_DESELECTONE:
2070 case IDM_DESELECTMORE:
2071 case IDM_DESELECTNEWER:
2072 case IDM_DESELECTOLDER:
2073 case IDM_DESELECTBIGGER:
2074 case IDM_DESELECTSMALLER:
2075 if (ParentIsDesktop(hwnd, dcd->hwndParent)) {
2076 Runtime_Error(pszSrcFile, __LINE__, "ParentIsDesktop unexpected");
2077 break;
2078 }
2079 case IDM_SELECTLIST:
2080 case IDM_SELECTALL:
2081 case IDM_DESELECTALL:
2082 case IDM_SELECTALLFILES:
2083 case IDM_DESELECTALLFILES:
2084 case IDM_SELECTALLDIRS:
2085 case IDM_DESELECTALLDIRS:
2086 case IDM_SELECTMASK:
2087 case IDM_DESELECTMASK:
2088 case IDM_INVERT:
2089 case IDM_SELECTCLIP:
2090 case IDM_DESELECTCLIP:
2091 {
2092 PCNRITEM pci;
2093
2094 pci = (PCNRITEM) CurrentRecord(hwnd);
2095 if ((INT) pci == -1)
2096 pci = NULL;
2097 if (SHORT1FROMMP(mp1) == IDM_HIDEALL) {
2098 if (pci) {
2099 if (!(pci->rc.flRecordAttr & CRA_SELECTED))
2100 pci->rc.flRecordAttr |= CRA_FILTERED;
2101 WinSendMsg(hwnd, CM_INVALIDATERECORD, MPFROMP(&pci),
2102 MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
2103 break;
2104 }
2105 }
2106 PostMsg(dcd->hwndObject, UM_SELECT, mp1, MPFROMP(pci));
2107 }
2108 break;
2109
2110 case IDM_RESCAN:
2111 DosEnterCritSec();
2112 dcd->stopflag++;
2113 DosExitCritSec();
2114 if (!PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPVOID)) {
2115 DosEnterCritSec();
2116 dcd->stopflag--;
2117 DosExitCritSec();
2118 }
2119 break;
2120
2121 case IDM_SHOWLNAMES:
2122 case IDM_SHOWSUBJECT:
2123 case IDM_SHOWEAS:
2124 case IDM_SHOWSIZE:
2125 case IDM_SHOWICON:
2126 case IDM_SHOWLWDATE:
2127 case IDM_SHOWLWTIME:
2128 case IDM_SHOWLADATE:
2129 case IDM_SHOWLATIME:
2130 case IDM_SHOWCRDATE:
2131 case IDM_SHOWCRTIME:
2132 case IDM_SHOWATTR:
2133 AdjustDetailsSwitches(hwnd,
2134 dcd->hwndLastMenu,
2135 SHORT1FROMMP(mp1),
2136 dcd->directory, "DirCnr", dcd, FALSE);
2137 break;
2138
2139 case IDM_TREEVIEW:
2140 case IDM_ICON:
2141 case IDM_TEXT:
2142 case IDM_DETAILS:
2143 case IDM_NAME:
2144 case IDM_MINIICONS:
2145 case IDM_DETAILSTITLES:
2146 {
2147 CNRINFO cnri;
2148
2149 memset(&cnri, 0, sizeof(CNRINFO));
2150 cnri.cb = sizeof(CNRINFO);
2151 WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
2152 MPFROMLONG(sizeof(CNRINFO)));
2153 switch (SHORT1FROMMP(mp1)) {
2154 case IDM_TREEVIEW:
2155 if (!(cnri.flWindowAttr & CV_TREE))
2156 dcd->lastattr = cnri.flWindowAttr;
2157 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2158 CV_DETAIL | CV_NAME | CA_TREELINE));
2159 cnri.flWindowAttr |= CA_TREELINE | CV_TREE | CV_ICON;
2160 if (!dcd->firsttree)
2161 PostMsg(dcd->hwndObject, UM_FLESH, MPVOID, MPVOID);
2162 break;
2163 case IDM_ICON:
2164 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2165 CV_DETAIL | CV_NAME | CA_TREELINE));
2166 cnri.flWindowAttr |= CV_ICON;
2167 break;
2168 case IDM_NAME:
2169 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2170 CV_DETAIL | CV_NAME | CA_TREELINE));
2171 cnri.flWindowAttr |= CV_NAME;
2172 break;
2173 case IDM_TEXT:
2174 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2175 CV_DETAIL | CV_NAME | CA_TREELINE));
2176 cnri.flWindowAttr |= CV_TEXT;
2177 break;
2178 case IDM_DETAILS:
2179 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2180 CV_DETAIL | CV_NAME | CA_TREELINE));
2181 cnri.flWindowAttr |= CV_DETAIL;
2182 break;
2183 case IDM_MINIICONS:
2184 if (cnri.flWindowAttr & CV_MINI)
2185 cnri.flWindowAttr &= (~CV_MINI);
2186 else
2187 cnri.flWindowAttr |= CV_MINI;
2188 break;
2189 case IDM_DETAILSTITLES:
2190 if (cnri.flWindowAttr & CA_DETAILSVIEWTITLES)
2191 cnri.flWindowAttr &= (~CA_DETAILSVIEWTITLES);
2192 else
2193 cnri.flWindowAttr |= CA_DETAILSVIEWTITLES;
2194 break;
2195 }
2196 cnri.flWindowAttr &= (~(CA_ORDEREDTARGETEMPH | CA_MIXEDTARGETEMPH));
2197 cnri.flWindowAttr |= CV_FLOW;
2198 dcd->flWindowAttr = cnri.flWindowAttr;
2199 WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
2200 MPFROMLONG(CMA_FLWINDOWATTR));
2201 WinSendMsg(hwnd, CM_INVALIDATERECORD, MPVOID,
2202 MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
2203 SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
2204 DIR_VIEW), dcd->flWindowAttr);
2205 }
2206 break;
2207
2208 case IDM_SAVETOLIST:
2209 WinDlgBox(HWND_DESKTOP, hwnd, SaveListDlgProc, FM3ModHandle,
2210 SAV_FRAME, MPFROMP(&hwnd));
2211 break;
2212
2213 case IDM_SIZES:
2214 {
2215 PCNRITEM pci;
2216 CHAR path[CCHMAXPATH];
2217
2218 pci = (PCNRITEM) CurrentRecord(hwnd);
2219 if (pci && (INT) pci != -1)
2220 strcpy(path, pci->pszFileName);
2221 else
2222 strcpy(path, dcd->directory);
2223 MakeValidDir(path);
2224 WinDlgBox(HWND_DESKTOP,
2225 HWND_DESKTOP, DirSizeProc, FM3ModHandle, DSZ_FRAME, path);
2226 }
2227 break;
2228
2229 case IDM_MKDIR:
2230 {
2231 PCNRITEM pci;
2232
2233 pci = (PCNRITEM) CurrentRecord(hwnd);
2234 PMMkDir(dcd->hwndParent,
2235 ((pci && (INT) pci != -1) ?
2236 pci->pszFileName : dcd->directory), FALSE);
2237 }
2238 break;
2239
2240 case IDM_SWITCH:
2241 if (mp2) {
2242 strcpy(dcd->previous, dcd->directory);
2243 strcpy(dcd->directory, (CHAR *) mp2);
2244 DosEnterCritSec();
2245 dcd->stopflag++;
2246 DosExitCritSec();
2247 if (!PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPFROMLONG(1L))) {
2248 strcpy(dcd->directory, dcd->previous);
2249 DosEnterCritSec();
2250 dcd->stopflag--;
2251 DosExitCritSec();
2252 }
2253 else if (*dcd->directory) {
2254 if (hwndMain)
2255 WinSendMsg(hwndMain,
2256 UM_SETUSERLISTNAME, MPFROMP(dcd->directory), MPVOID);
2257 else
2258 add_udir(FALSE, dcd->directory);
2259 }
2260 }
2261 break;
2262
2263 case IDM_PARENT:
2264 {
2265 CHAR tempname1[CCHMAXPATH], tempname2[CCHMAXPATH];
2266
2267 strcpy(tempname1, dcd->directory);
2268 if (tempname1[strlen(tempname1) - 1] != '\\')
2269 strcat(tempname1, "\\");
2270 strcat(tempname1, "..");
2271 DosError(FERR_DISABLEHARDERR);
2272 if (!DosQueryPathInfo(tempname1,
2273 FIL_QUERYFULLNAME,
2274 tempname2, sizeof(tempname2))) {
2275 if (stricmp(dcd->directory, tempname2)) {
2276 strcpy(dcd->previous, dcd->directory);
2277 strcpy(dcd->directory, tempname2);
2278 DosEnterCritSec();
2279 dcd->stopflag++;
2280 DosExitCritSec();
2281 if (!PostMsg(dcd->hwndObject,
2282 UM_RESCAN, MPVOID, MPFROMLONG(1L))) {
2283 strcpy(dcd->directory, dcd->previous);
2284 DosEnterCritSec();
2285 dcd->stopflag--;
2286 DosExitCritSec();
2287 }
2288 else if (*dcd->directory) {
2289 if (hwndMain)
2290 WinSendMsg(hwndMain,
2291 UM_SETUSERLISTNAME,
2292 MPFROMP(dcd->directory), MPVOID);
2293 else
2294 add_udir(FALSE, dcd->directory);
2295 }
2296 }
2297 }
2298 }
2299 break;
2300
2301 case IDM_PREVIOUS:
2302 if (*dcd->previous && stricmp(dcd->directory, dcd->previous)) {
2303
2304 CHAR tempname[CCHMAXPATH];
2305
2306 if (IsValidDir(dcd->previous)) {
2307 strcpy(tempname, dcd->directory);
2308 strcpy(dcd->directory, dcd->previous);
2309 strcpy(dcd->previous, tempname);
2310 DosEnterCritSec();
2311 dcd->stopflag++;
2312 DosExitCritSec();
2313 if (!PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPFROMLONG(1L))) {
2314 strcpy(dcd->directory, dcd->previous);
2315 DosEnterCritSec();
2316 dcd->stopflag--;
2317 DosExitCritSec();
2318 }
2319 else if (*dcd->directory) {
2320 if (hwndMain)
2321 WinSendMsg(hwndMain,
2322 UM_SETUSERLISTNAME,
2323 MPFROMP(dcd->directory), MPVOID);
2324 else
2325 add_udir(FALSE, dcd->directory);
2326 }
2327 }
2328 else
2329 *dcd->previous = 0;
2330 }
2331 break;
2332
2333 case IDM_WALKDIR:
2334 {
2335 CHAR newdir[CCHMAXPATH];
2336
2337 strcpy(newdir, dcd->directory);
2338 if (!WinDlgBox(HWND_DESKTOP,
2339 dcd->hwndParent,
2340 WalkAllDlgProc,
2341 FM3ModHandle,
2342 WALK_FRAME, MPFROMP(newdir)) || !*newdir)
2343 break;
2344 if (stricmp(newdir, dcd->directory)) {
2345 strcpy(dcd->previous, dcd->directory);
2346 strcpy(dcd->directory, newdir);
2347 DosEnterCritSec();
2348 dcd->stopflag++;
2349 DosExitCritSec();
2350 if (!PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPFROMLONG(1L))) {
2351 strcpy(dcd->directory, dcd->previous);
2352 DosEnterCritSec();
2353 dcd->stopflag--;
2354 DosExitCritSec();
2355 }
2356 else if (*dcd->directory) {
2357 if (hwndMain)
2358 WinSendMsg(hwndMain,
2359 UM_SETUSERLISTNAME,
2360 MPFROMP(dcd->directory), MPVOID);
2361 else
2362 add_udir(FALSE, dcd->directory);
2363 }
2364 }
2365 }
2366 break;
2367
2368 case IDM_OPENICONME:
2369 OpenObject(dcd->directory, "ICON", dcd->hwndFrame);
2370 break;
2371 case IDM_OPENDETAILSME:
2372 OpenObject(dcd->directory, "DETAILS", dcd->hwndFrame);
2373 break;
2374 case IDM_OPENTREEME:
2375 OpenObject(dcd->directory, "TREE", dcd->hwndFrame);
2376 break;
2377 case IDM_OPENSETTINGSME:
2378 OpenObject(dcd->directory, Settings, dcd->hwndFrame);
2379 break;
2380
2381 case IDM_DOITYOURSELF:
2382 case IDM_UPDATE:
2383 case IDM_OPENWINDOW:
2384 case IDM_OPENSETTINGS:
2385 case IDM_OPENDEFAULT:
2386 case IDM_OPENICON:
2387 case IDM_OPENDETAILS:
2388 case IDM_OPENTREE:
2389 case IDM_OBJECT:
2390 case IDM_SHADOW:
2391 case IDM_SHADOW2:
2392 case IDM_DELETE:
2393 case IDM_PERMDELETE:
2394 case IDM_PRINT:
2395 case IDM_ATTRS:
2396 case IDM_INFO:
2397 case IDM_COPY:
2398 case IDM_MOVE:
2399 case IDM_WPSMOVE:
2400 case IDM_WPSCOPY:
2401 case IDM_WILDCOPY:
2402 case IDM_WILDMOVE:
2403 case IDM_RENAME:
2404 case IDM_COMPARE:
2405 case IDM_EAS:
2406 case IDM_SUBJECT:
2407 case IDM_VIEW:
2408 case IDM_VIEWTEXT:
2409 case IDM_VIEWBINARY:
2410 case IDM_VIEWARCHIVE:
2411 case IDM_EDIT:
2412 case IDM_EDITTEXT:
2413 case IDM_EDITBINARY:
2414 case IDM_SAVETOCLIP:
2415 case IDM_APPENDTOCLIP:
2416 case IDM_ARCHIVE:
2417 case IDM_ARCHIVEM:
2418 case IDM_EXTRACT:
2419 case IDM_MCIPLAY:
2420 case IDM_COLLECTFROMFILE:
2421 case IDM_UUDECODE:
2422 case IDM_MERGE:
2423 {
2424 LISTINFO *li;
2425 ULONG action = UM_ACTION;
2426
2427 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
2428 if (li) {
2429 li->type = SHORT1FROMMP(mp1);
2430 li->hwnd = hwnd;
2431 li->list = BuildList(hwnd);
2432 switch (SHORT1FROMMP(mp1)) {
2433 case IDM_WILDMOVE:
2434 case IDM_WILDCOPY:
2435 case IDM_MOVE:
2436 case IDM_COPY:
2437 case IDM_WPSMOVE:
2438 case IDM_WPSCOPY:
2439 break;
2440 default:
2441 strcpy(li->targetpath, dcd->directory);
2442 break;
2443 }
2444 if (li->list) {
2445 if (SHORT1FROMMP(mp1) == IDM_COLLECTFROMFILE) {
2446 if (!Collector) {
2447
2448 HWND hwndC;
2449 SWP swp;
2450
2451 if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
2452 !fAutoTile &&
2453 (!fExternalCollector && !strcmp(realappname, FM3Str)))
2454 GetNextWindowPos(dcd->hwndParent, &swp, NULL, NULL);
2455 hwndC = StartCollector((fExternalCollector ||
2456 strcmp(realappname, FM3Str)) ?
2457 HWND_DESKTOP : dcd->hwndParent, 4);
2458 if (hwndC) {
2459 if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
2460 !fAutoTile && (!fExternalCollector &&
2461 !strcmp(realappname, FM3Str)))
2462 WinSetWindowPos(hwndC, HWND_TOP, swp.x, swp.y,
2463 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE |
2464 SWP_SHOW | SWP_ZORDER);
2465 else if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
2466 fAutoTile && !strcmp(realappname, FM3Str))
2467 TileChildren(dcd->hwndParent, TRUE);
2468 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0,
2469 SWP_ACTIVATE);
2470 DosSleep(100); //05 Aug 07 GKY 250
2471 }
2472 }
2473 else
2474 StartCollector(dcd->hwndParent, 4);
2475 }
2476 switch (SHORT1FROMMP(mp1)) {
2477 case IDM_APPENDTOCLIP:
2478 case IDM_SAVETOCLIP:
2479 case IDM_ARCHIVE:
2480 case IDM_ARCHIVEM:
2481 case IDM_DELETE:
2482 case IDM_PERMDELETE:
2483 case IDM_ATTRS:
2484 case IDM_PRINT:
2485 case IDM_SHADOW:
2486 case IDM_SHADOW2:
2487 case IDM_OBJECT:
2488 case IDM_VIEW:
2489 case IDM_VIEWTEXT:
2490 case IDM_VIEWBINARY:
2491 case IDM_EDIT:
2492 case IDM_EDITTEXT:
2493 case IDM_EDITBINARY:
2494 case IDM_MCIPLAY:
2495 case IDM_UPDATE:
2496 case IDM_DOITYOURSELF:
2497 case IDM_INFO:
2498 case IDM_EAS:
2499 action = UM_MASSACTION;
2500 break;
2501 }
2502 if (SHORT1FROMMP(mp1) == IDM_OBJECT ||
2503 SHORT1FROMMP(mp1) == IDM_SHADOW ||
2504 SHORT1FROMMP(mp1) == IDM_SHADOW2)
2505 *li->targetpath = 0;
2506 if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID)) {
2507 Runtime_Error(pszSrcFile, __LINE__, "PostMsg");
2508 FreeListInfo(li);
2509 }
2510 else if (fUnHilite)
2511 UnHilite(hwnd, TRUE, &dcd->lastselection, 0);
2512 }
2513 else
2514 free(li);
2515 }
2516 }
2517 break;
2518
2519 case IDM_DRIVESMENU:
2520 if (!hwndMain)
2521 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_WALKDIR, 0), MPVOID);
2522 break;
2523
2524 default:
2525 if (SwitchCommand(dcd->hwndLastMenu, SHORT1FROMMP(mp1)))
2526 return 0;
2527 else {
2528 if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
2529 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
2530
2531 register INT x;
2532
2533 if (!cmdloaded)
2534 load_commands();
2535 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
2536 if (x >= 0) {
2537 x++;
2538 RunCommand(hwnd, x);
2539 if (fUnHilite)
2540 UnHilite(hwnd, TRUE, &dcd->lastselection, 0);
2541 }
2542 }
2543 }
2544 break;
2545 }
2546 }
2547 return 0;
2548
2549 case UM_FIXCNRMLE:
2550 case UM_FIXEDITNAME:
2551 return CommonCnrProc(hwnd, msg, mp1, mp2);
2552
2553 case UM_FILESMENU:
2554 {
2555 PCNRITEM pci;
2556 HWND menuHwnd = (HWND) 0;
2557
2558 pci = (PCNRITEM) CurrentRecord(hwnd);
2559 if (pci && (INT) pci != -1) {
2560 if (pci->attrFile & FILE_DIRECTORY) {
2561 menuHwnd = CheckMenu(&DirMenu, DIR_POPUP);
2562// WinEnableMenuItem(DirMenu,IDM_TREE,TRUE);
2563 }
2564 else
2565 menuHwnd = CheckMenu(&FileMenu, FILE_POPUP);
2566 }
2567 return MRFROMLONG(menuHwnd);
2568 }
2569
2570 case WM_CONTROL:
2571 DosError(FERR_DISABLEHARDERR);
2572 if (dcd) {
2573 switch (SHORT2FROMMP(mp1)) {
2574 case CN_COLLAPSETREE:
2575 case CN_EXPANDTREE:
2576 {
2577 PCNRITEM pci = (PCNRITEM) mp2;
2578
2579 if (pci && (INT) pci != -1 && !(pci->flags & RECFLAGS_ENV)) {
2580 if (driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_REMOVABLE) {
2581 struct
2582 {
2583 ULONG serial;
2584 CHAR volumelength;
2585 CHAR volumelabel[CCHMAXPATH];
2586 }
2587 volser;
2588 APIRET rc;
2589
2590 memset(&volser, 0, sizeof(volser));
2591 DosError(FERR_DISABLEHARDERR);
2592 // fixme
2593 rc = DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
2594 FSIL_VOLSER, &volser, sizeof(volser));
2595 if (rc) {
2596 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
2597 GetPString(IDS_CANTFINDDIRTEXT),
2598 pci->pszFileName);
2599 DosBeep(250,100);
2600 driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
2601 UnFlesh(hwnd, pci);
2602 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2603 }
2604 else {
2605 if (SHORT2FROMMP(mp1) == CN_COLLAPSETREE &&
2606 !volser.serial ||
2607 driveserial[toupper(*pci->pszFileName) - 'A'] !=
2608 volser.serial)
2609 UnFlesh(hwnd, pci);
2610 if (SHORT2FROMMP(mp1) != CN_COLLAPSETREE ||
2611 (!volser.serial ||
2612 driveserial[toupper(*pci->pszFileName) - 'A'] !=
2613 volser.serial)) {
2614 if (Flesh(hwnd, pci) &&
2615 SHORT2FROMMP(mp1) == CN_EXPANDTREE &&
2616 !dcd->suspendview && fTopDir)
2617 PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
2618 }
2619 driveserial[toupper(*pci->pszFileName) - 'A'] = volser.serial;
2620 }
2621 }
2622 else if (SHORT2FROMMP(mp1) == CN_EXPANDTREE) {
2623 if (Flesh(hwnd, pci) && !dcd->suspendview && fTopDir)
2624 PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
2625 }
2626 if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && !dcd->suspendview)
2627 WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
2628 }
2629 }
2630 break;
2631
2632/*
2633 case CN_PICKUP:
2634 return PickUp(hwnd,dcd->hwndObject,mp2);
2635*/
2636
2637 case CN_CONTEXTMENU:
2638 {
2639 PCNRITEM pci = (PCNRITEM) mp2;
2640
2641 if (pci) {
2642 WinSendMsg(hwnd,
2643 CM_SETRECORDEMPHASIS,
2644 MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_CURSORED));
2645 MarkAll(hwnd, FALSE, FALSE, TRUE);
2646 if (pci->attrFile & FILE_DIRECTORY)
2647 dcd->hwndLastMenu = CheckMenu(&DirMenu, DIR_POPUP);
2648 else
2649 dcd->hwndLastMenu = CheckMenu(&FileMenu, FILE_POPUP);
2650 }
2651 else {
2652 dcd->hwndLastMenu = CheckMenu(&DirCnrMenu, DIRCNR_POPUP);
2653 if (dcd->hwndLastMenu && !dcd->cnremphasized) {
2654 WinSendMsg(hwnd,
2655 CM_SETRECORDEMPHASIS,
2656 MPVOID, MPFROM2SHORT(TRUE, CRA_SOURCE));
2657 dcd->cnremphasized = TRUE;
2658 }
2659 }
2660 if (dcd->hwndLastMenu) {
2661 if (dcd->hwndLastMenu == DirCnrMenu) {
2662 if (dcd->flWindowAttr & CV_MINI)
2663 WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE);
2664 }
2665 if (dcd->hwndLastMenu == DirMenu)
2666 WinEnableMenuItem(DirMenu, IDM_TREE, TRUE);
2667 if (!PopupMenu(hwnd, hwnd, dcd->hwndLastMenu)) {
2668 if (dcd->cnremphasized) {
2669 WinSendMsg(hwnd,
2670 CM_SETRECORDEMPHASIS,
2671 MPVOID, MPFROM2SHORT(FALSE, CRA_SOURCE));
2672 dcd->cnremphasized = TRUE;
2673 }
2674 MarkAll(hwnd, TRUE, FALSE, TRUE);
2675 }
2676 }
2677 }
2678 break;
2679
2680 case CN_DROPHELP:
2681 if (mp2) {
2682
2683 PDRAGINFO pDInfo;
2684 PCNRITEM pci;
2685 ULONG numitems;
2686 USHORT usOperation;
2687
2688 pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
2689 pDInfo = (PDRAGINFO) ((PCNRDRAGINFO) mp2)->pDragInfo;
2690 if (!DrgAccessDraginfo(pDInfo)) {
2691 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
2692 GetPString(IDS_DROPERRORTEXT));
2693 }
2694 else {
2695 numitems = DrgQueryDragitemCount(pDInfo);
2696 usOperation = pDInfo->usOperation;
2697 FreeDragInfoData(hwnd, pDInfo);
2698 saymsg(MB_ENTER | MB_ICONASTERISK,
2699 hwnd,
2700 GetPString(IDS_DROPHELPHDRTEXT),
2701 GetPString(IDS_DROPHELPTEXT),
2702 numitems,
2703 &"s"[numitems == 1L],
2704 pci ? NullStr : GetPString(IDS_NOTEXT),
2705 pci ? NullStr : " ",
2706 pci ? pci->pszFileName : NullStr,
2707 pci ? " " : NullStr,
2708 GetPString((usOperation == DO_COPY) ?
2709 IDS_COPYTEXT :
2710 (usOperation == DO_LINK) ?
2711 IDS_LINKTEXT : IDS_MOVETEXT));
2712 }
2713 }
2714 return 0;
2715
2716 case CN_DRAGLEAVE:
2717 return 0;
2718
2719 case CN_DRAGAFTER:
2720 case CN_DRAGOVER:
2721 if (mp2) {
2722
2723 PDRAGITEM pDItem; /* Pointer to DRAGITEM */
2724 PDRAGINFO pDInfo; /* Pointer to DRAGINFO */
2725 PCNRITEM pci;
2726 USHORT uso;
2727
2728 pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
2729 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
2730 if (!DrgAccessDraginfo(pDInfo)) {
2731 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
2732 "DrgAccessDraginfo");
2733 return (MRFROM2SHORT(DOR_NEVERDROP, 0));
2734 }
2735 if (*dcd->directory &&
2736 (driveflags[toupper(*dcd->directory) - 'A'] &
2737 DRIVE_NOTWRITEABLE)) {
2738 DrgFreeDraginfo(pDInfo);
2739 return MRFROM2SHORT(DOR_DROP, /* Return okay to link */
2740 DO_LINK); /* (compare) only */
2741 }
2742 if (pci) {
2743 if (pci->rc.flRecordAttr & CRA_SOURCE) {
2744 DrgFreeDraginfo(pDInfo);
2745 return (MRFROM2SHORT(DOR_NODROP, 0));
2746 }
2747 uso = pDInfo->usOperation;
2748 if (uso == DO_DEFAULT)
2749 uso = fCopyDefault ? DO_COPY : DO_MOVE;
2750 if (!(pci->attrFile & FILE_DIRECTORY)) {
2751 if (uso != DO_LINK && uso != DO_COPY && uso != DO_MOVE) {
2752 DrgFreeDraginfo(pDInfo);
2753 return MRFROM2SHORT(DOR_NODROP, 0);
2754 }
2755 if (uso != DO_LINK &&
2756 !(driveflags[toupper(*pci->pszFileName) - 'A'] &
2757 DRIVE_NOTWRITEABLE)) {
2758
2759 ARC_TYPE *info = NULL;
2760
2761 if (!fQuickArcFind &&
2762 !(driveflags[toupper(*pci->pszFileName) - 'A'] &
2763 DRIVE_SLOW))
2764 info = find_type(pci->pszFileName, NULL);
2765 else
2766 info = quick_find_type(pci->pszFileName, NULL);
2767 if (!info || ((uso == DO_MOVE && !info->move) ||
2768 (uso == DO_COPY && !info->create))) {
2769 DrgFreeDraginfo(pDInfo);
2770 return MRFROM2SHORT(DOR_NODROP, 0);
2771 }
2772 }
2773 }
2774 }
2775
2776 /* Access DRAGITEM index to DRAGITEM
2777 * Check valid rendering mechanisms and data
2778 */
2779 pDItem = DrgQueryDragitemPtr(pDInfo, 0);
2780 if (DrgVerifyRMF(pDItem, DRM_OS2FILE, NULL) ||
2781 ((!pci || (pci->attrFile & FILE_DIRECTORY)) &&
2782 DrgVerifyRMF(pDItem, DRM_FM2ARCMEMBER, DRF_FM2ARCHIVE))) {
2783 DrgFreeDraginfo(pDInfo);
2784 if (driveflags[toupper(*dcd->directory) - 'A'] &
2785 DRIVE_NOTWRITEABLE)
2786 return MRFROM2SHORT(DOR_DROP, DO_LINK);
2787 if (toupper(*dcd->directory) < 'C')
2788 return MRFROM2SHORT(DOR_DROP, DO_COPY);
2789 return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
2790 ((fCopyDefault) ? DO_COPY : DO_MOVE));
2791 }
2792 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
2793 }
2794 return MRFROM2SHORT(DOR_NODROP, 0); /* Drop not valid */
2795
2796 case CN_INITDRAG:
2797 {
2798 BOOL wasemphasized = FALSE;
2799 PCNRDRAGINIT pcd = (PCNRDRAGINIT) mp2;
2800 PCNRITEM pci;
2801
2802 if (pcd) {
2803 pci = (PCNRITEM) pcd->pRecord;
2804 if (pci) {
2805 if ((INT) pci == -1)
2806 pci = NULL;
2807 else if (pci->rc.flRecordAttr & CRA_SELECTED)
2808 wasemphasized = TRUE;
2809 }
2810 else if (!*dcd->directory) {
2811 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
2812 break;
2813 }
2814 else if (IsRoot(dcd->directory)) {
2815 saymsg(MB_ENTER, hwnd, GetPString(IDS_ERRORTEXT),
2816 GetPString(IDS_CANTDRAGROOTDIR));
2817 break;
2818 }
2819 if (hwndStatus2) {
2820 if (pci)
2821 WinSetWindowText(hwndStatus2,
2822 GetPString(IDS_DRAGFILEOBJTEXT));
2823 else
2824 WinSetWindowText(hwndStatus2, GetPString(IDS_DRAGDIRTEXT));
2825 }
2826 if (DoFileDrag(hwnd,
2827 dcd->hwndObject,
2828 mp2,
2829 NULL,
2830 pci ? NULL : dcd->directory,
2831 pci ? TRUE : FALSE)) {
2832 if ((pci && fUnHilite && wasemphasized) || dcd->ulItemsToUnHilite) {
2833 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
2834 }
2835 }
2836 if (hwndStatus2) {
2837 WinSetFocus(HWND_DESKTOP, hwnd);
2838 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2839 }
2840 }
2841 }
2842 return 0;
2843
2844 case CN_DROP:
2845 if (mp2) {
2846
2847 LISTINFO *li;
2848 ULONG action = UM_ACTION;
2849
2850 // DbgMsg(pszSrcFile, __LINE__, "calling DoFileDrop");
2851 li = DoFileDrop(hwnd, dcd->directory, TRUE, mp1, mp2);
2852 CheckPmDrgLimit(((PCNRDRAGINFO)mp2)->pDragInfo);
2853 if (li) {
2854 if (li->list && li->list[0] && IsRoot(li->list[0]))
2855 li->type = DO_LINK;
2856 else if (fDragndropDlg && (!*li->arcname || !li->info)) {
2857
2858 CHECKLIST cl;
2859
2860 memset(&cl, 0, sizeof(cl));
2861 cl.size = sizeof(cl);
2862 cl.flags = li->type;
2863 cl.list = li->list;
2864 cl.cmd = li->type;
2865 cl.prompt = li->targetpath;
2866 li->type = WinDlgBox(HWND_DESKTOP, dcd->hwndParent,
2867 DropListProc, FM3ModHandle,
2868 DND_FRAME, MPFROMP(&cl));
2869 if (li->type == DID_ERROR)
2870 Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
2871 "Drag & Drop Dialog");
2872 if (!li->type) {
2873 FreeListInfo(li);
2874 return 0;
2875 }
2876 li->list = cl.list;
2877 if (!li->list || !li->list[0]) {
2878 FreeListInfo(li);
2879 return 0;
2880 }
2881 }
2882 switch (li->type) {
2883 case DND_LAUNCH:
2884 strcat(li->targetpath, " %a");
2885 ExecOnList(dcd->hwndParent, li->targetpath,
2886 PROMPT | WINDOWED, NULL, li->list, NULL);
2887 FreeList(li->list);
2888 li->list = NULL;
2889 break;
2890 case DO_LINK:
2891 if (fLinkSetsIcon) {
2892 li->type = IDM_SETICON;
2893 action = UM_MASSACTION;
2894 }
2895 else
2896 li->type = IDM_COMPARE;
2897 break;
2898 case DND_EXTRACT:
2899 if (*li->targetpath && !IsFile(li->targetpath))
2900 li->type = IDM_EXTRACT;
2901 break;
2902 case DND_MOVE:
2903 li->type = IDM_MOVE;
2904 if (*li->targetpath && IsFile(li->targetpath) == 1) {
2905 action = UM_MASSACTION;
2906 li->type = IDM_ARCHIVEM;
2907 }
2908 break;
2909 case DND_WILDMOVE:
2910 li->type = IDM_WILDMOVE;
2911 if (*li->targetpath && IsFile(li->targetpath) == 1) {
2912 action = UM_MASSACTION;
2913 li->type = IDM_ARCHIVEM;
2914 }
2915 break;
2916 case DND_OBJECT:
2917 li->type = IDM_OBJECT;
2918 action = UM_MASSACTION;
2919 break;
2920 case DND_SHADOW:
2921 li->type = IDM_SHADOW;
2922 action = UM_MASSACTION;
2923 break;
2924 case DND_COMPARE:
2925 li->type = IDM_COMPARE;
2926 break;
2927 case DND_SETICON:
2928 action = UM_MASSACTION;
2929 li->type = IDM_SETICON;
2930 break;
2931 case DND_COPY:
2932 li->type = IDM_COPY;
2933 if (*li->targetpath && IsFile(li->targetpath) == 1) {
2934 action = UM_MASSACTION;
2935 li->type = IDM_ARCHIVE;
2936 }
2937 break;
2938 case DND_WILDCOPY:
2939 li->type = IDM_WILDCOPY;
2940 if (*li->targetpath && IsFile(li->targetpath) == 1) {
2941 action = UM_MASSACTION;
2942 li->type = IDM_ARCHIVE;
2943 }
2944 break;
2945 default:
2946 if (*li->arcname && li->info) {
2947 action = UM_MASSACTION;
2948 li->type =
2949 (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM : IDM_FAKEEXTRACT;
2950 }
2951 else if (*li->targetpath && IsFile(li->targetpath) == 1) {
2952 action = UM_MASSACTION;
2953 li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
2954 }
2955 else
2956 li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
2957 break;
2958 }
2959 if (!li->list || !li->list[0])
2960 FreeListInfo(li);
2961 else if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID))
2962 FreeListInfo(li);
2963 else {
2964
2965 USHORT usop = 0;
2966
2967 switch (li->type) {
2968 case IDM_COPY:
2969 case IDM_WILDCOPY:
2970 usop = DO_COPY;
2971 break;
2972 case IDM_MOVE:
2973 case IDM_WILDMOVE:
2974 case IDM_ARCHIVEM:
2975 usop = DO_MOVE;
2976 break;
2977 }
2978 if (usop)
2979 return MRFROM2SHORT(DOR_DROP, usop);
2980 }
2981 }
2982 }
2983 return 0;
2984
2985 case CN_ENDEDIT:
2986 case CN_BEGINEDIT:
2987 {
2988 PFIELDINFO pfi = ((PCNREDITDATA) mp2)->pFieldInfo;
2989 PCNRITEM pci = (PCNRITEM) ((PCNREDITDATA) mp2)->pRecord;
2990
2991 if (pfi || pci) {
2992
2993 MRESULT mre;
2994
2995 mre = CnrDirectEdit(hwnd, msg, mp1, mp2);
2996 if (mre != (MRESULT) - 1)
2997 return mre;
2998 }
2999 else if (!pfi && !pci)
3000 PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(CCHMAXPATH), MPVOID);
3001 }
3002 return 0;
3003
3004 case CN_REALLOCPSZ:
3005 {
3006 PFIELDINFO pfi = ((PCNREDITDATA) mp2)->pFieldInfo;
3007 PCNRITEM pci = (PCNRITEM) ((PCNREDITDATA) mp2)->pRecord;
3008 HWND hwndMLE;
3009 static CHAR szData[CCHMAXPATH];
3010 CHAR testname[CCHMAXPATH];
3011
3012 if (!pci && !pfi) {
3013 hwndMLE = WinWindowFromID(hwnd, CID_MLE);
3014 WinQueryWindowText(hwndMLE, sizeof(szData), szData);
3015 chop_at_crnl(szData);
3016 bstrip(szData);
3017 if (*szData) {
3018 if (!DosQueryPathInfo(szData,
3019 FIL_QUERYFULLNAME,
3020 testname, sizeof(testname))) {
3021 if (!SetDir(dcd->hwndParent, hwnd, testname, 1)) {
3022 PostMsg(hwnd, UM_SETDIR, MPFROMP(testname), MPVOID);
3023 }
3024 }
3025 }
3026 }
3027 else {
3028
3029 MRESULT mre;
3030
3031 mre = CnrDirectEdit(hwnd, msg, mp1, mp2);
3032 if (mre != (MRESULT) - 1)
3033 return mre;
3034 }
3035 }
3036 return 0;
3037
3038 case CN_EMPHASIS:
3039 if (!mp2)
3040 Runtime_Error(pszSrcFile, __LINE__, "mp2 NULL");
3041 else {
3042 PNOTIFYRECORDEMPHASIS pre = mp2;
3043 PCNRITEM pci;
3044 CHAR s[CCHMAXPATHCOMP + 91], tb[81], tf[81];
3045
3046 pci = (PCNRITEM) (pre ? pre->pRecord : NULL);
3047 if (!pci) {
3048 if (hwndStatus2)
3049 WinSetWindowText(hwndStatus2, NullStr);
3050 if (fMoreButtons) {
3051 WinSetWindowText(hwndName, NullStr);
3052 WinSetWindowText(hwndDate, NullStr);
3053 WinSetWindowText(hwndAttr, NullStr);
3054 }
3055 if (hwndMain)
3056 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
3057 break;
3058 }
3059 if (pre->fEmphasisMask & CRA_SELECTED) {
3060 if (pci->rc.flRecordAttr & CRA_SELECTED) {
3061 dcd->selectedbytes += (pci->cbFile + pci->easize);
3062 dcd->selectedfiles++;
3063 }
3064 else if (dcd->selectedfiles) {
3065 dcd->selectedbytes -= (pci->cbFile + pci->easize);
3066 dcd->selectedfiles--;
3067 }
3068 if (!dcd->suspendview) {
3069 commafmt(tf, sizeof(tf), dcd->selectedfiles);
3070 CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, 'K');
3071 sprintf(s, "%s / %s", tf, tb);
3072 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
3073 }
3074 }
3075 if (!dcd->suspendview && hwndMain &&
3076 (pre->fEmphasisMask & CRA_CURSORED) &&
3077 (pci->rc.flRecordAttr & CRA_CURSORED) &&
3078 WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame) {
3079 if (driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)
3080 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
3081 else
3082 WinSendMsg(hwndMain,
3083 UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
3084 }
3085 if (!dcd->suspendview &&
3086 WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame) {
3087 if (pre->fEmphasisMask & CRA_CURSORED) {
3088 if (pci->rc.flRecordAttr & CRA_CURSORED) {
3089 if (fSplitStatus && hwndStatus2) {
3090 CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
3091 if (!fMoreButtons) {
3092 sprintf(s, " %s %04u/%02u/%02u %02u:%02u:%02u [%s] %s",
3093 tb, pci->date.year,
3094 pci->date.month, pci->date.day, pci->time.hours,
3095 pci->time.minutes, pci->time.seconds,
3096 pci->pszDispAttr, pci->pszFileName);
3097 }
3098 else {
3099 *tf = 0;
3100 if (pci->cbFile + pci->easize > 1024) {
3101 CommaFmtULL(tf, sizeof(tf),
3102 pci->cbFile + pci->easize, 'K');
3103 }
3104 sprintf(s, GetPString(IDS_STATUSSIZETEXT),
3105 tb,
3106 *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
3107 }
3108 WinSetWindowText(hwndStatus2, s);
3109 }
3110 if (fMoreButtons) {
3111 WinSetWindowText(hwndName, pci->pszFileName);
3112 sprintf(s, "%04u/%02u/%02u %02u:%02u:%02u",
3113 pci->date.year, pci->date.month,
3114 pci->date.day, pci->time.hours, pci->time.minutes,
3115 pci->time.seconds);
3116 WinSetWindowText(hwndDate, s);
3117 WinSetWindowText(hwndAttr, pci->pszDispAttr);
3118 }
3119 }
3120 }
3121 }
3122 }
3123 break;
3124
3125 case CN_ENTER:
3126 if (mp2) {
3127
3128 PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
3129 FILEFINDBUF3 ffb;
3130 HDIR hDir = HDIR_CREATE;
3131 ULONG nm = 1;
3132 APIRET status = 0;
3133
3134 SetShiftState();
3135 if (pci) {
3136 if (pci->rc.flRecordAttr & CRA_INUSE)
3137 break;
3138 DosError(FERR_DISABLEHARDERR);
3139 status = DosFindFirst(pci->pszFileName,
3140 &hDir,
3141 FILE_NORMAL | FILE_DIRECTORY |
3142 FILE_ARCHIVED | FILE_READONLY |
3143 FILE_HIDDEN | FILE_SYSTEM,
3144 &ffb, sizeof(ffb), &nm, FIL_STANDARD);
3145 priority_bumped();
3146 if (!status) {
3147 DosFindClose(hDir);
3148 if (ffb.attrFile & FILE_DIRECTORY) {
3149 if ((shiftstate & (KC_CTRL | KC_ALT)) == (KC_CTRL | KC_ALT))
3150 PostMsg(hwnd,
3151 WM_COMMAND,
3152 MPFROM2SHORT(IDM_SHOWALLFILES, 0), MPVOID);
3153 else if ((shiftstate & (KC_CTRL | KC_SHIFT)) ==
3154 (KC_CTRL | KC_SHIFT))
3155 OpenObject(pci->pszFileName, Settings, dcd->hwndFrame);
3156 else if (shiftstate & KC_CTRL)
3157 OpenObject(pci->pszFileName, Default, dcd->hwndFrame);
3158 else if (shiftstate & KC_SHIFT) {
3159
3160 HWND hwndDir;
3161
3162 hwndDir = OpenDirCnr((HWND) 0,
3163 dcd->hwndParent,
3164 dcd->hwndFrame,
3165 FALSE, pci->pszFileName);
3166 if (hwndDir) {
3167 if (fMinOnOpen)
3168 WinSetWindowPos(dcd->hwndFrame,
3169 HWND_BOTTOM,
3170 0, 0, 0, 0, SWP_MINIMIZE | SWP_ZORDER);
3171 if (fAutoTile)
3172 TileChildren(dcd->hwndParent, TRUE);
3173 WinSetWindowPos(hwndDir,
3174 HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
3175 }
3176 }
3177 else {
3178 strcpy(dcd->previous, dcd->directory);
3179 strcpy(dcd->directory, pci->pszFileName);
3180 DosEnterCritSec();
3181 dcd->stopflag++;
3182 DosExitCritSec();
3183 if (!PostMsg(dcd->hwndObject,
3184 UM_RESCAN, MPVOID, MPFROMLONG(1L))) {
3185 DosEnterCritSec();
3186 dcd->stopflag--;
3187 DosExitCritSec();
3188 }
3189 else if (*dcd->directory) {
3190 if (hwndMain)
3191 WinSendMsg(hwndMain,
3192 UM_SETUSERLISTNAME,
3193 MPFROMP(dcd->directory), MPVOID);
3194 else
3195 add_udir(FALSE, dcd->directory);
3196 }
3197 }
3198 }
3199 else {
3200
3201 SWP swp;
3202
3203 WinQueryWindowPos(dcd->hwndFrame, &swp);
3204 WinSendMsg(hwnd,
3205 CM_SETRECORDEMPHASIS,
3206 MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_INUSE));
3207 DefaultViewKeys(hwnd,
3208 dcd->hwndFrame,
3209 dcd->hwndParent, &swp, pci->pszFileName);
3210 WinSendMsg(hwnd,
3211 CM_SETRECORDEMPHASIS,
3212 MPFROMP(pci),
3213 MPFROM2SHORT(FALSE,
3214 CRA_INUSE |
3215 ((fUnHilite) ? CRA_SELECTED : 0)));
3216 }
3217 }
3218 else {
3219 if (!*dcd->directory || IsValidDir(dcd->directory)) {
3220 NotifyError(pci->pszFileName, status);
3221 RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
3222 if (hwndStatus)
3223 WinSetWindowText(hwndStatus,
3224 GetPString(IDS_RESCANSUGGESTEDTEXT));
3225 }
3226 else {
3227 DosEnterCritSec();
3228 dcd->stopflag++;
3229 DosExitCritSec();
3230 if (!PostMsg(dcd->hwndObject,
3231 UM_RESCAN, MPVOID, MPFROMLONG(1L))) {
3232 DosEnterCritSec();
3233 dcd->stopflag--;
3234 DosExitCritSec();
3235 }
3236 else if (*dcd->directory) {
3237 if (hwndMain)
3238 WinSendMsg(hwndMain,
3239 UM_SETUSERLISTNAME,
3240 MPFROMP(dcd->directory), MPVOID);
3241 else
3242 add_udir(FALSE, dcd->directory);
3243 }
3244 }
3245 }
3246 }
3247 else if (*dcd->directory)
3248 OpenObject(dcd->directory, Default, hwnd);
3249 } // CN_ENTER
3250 break;
3251 } // switch mp1
3252 break;
3253 } // if dcd
3254 return 0;
3255
3256 case UM_LOADFILE:
3257 if (dcd && mp2) {
3258
3259 HWND ret = StartMLEEditor(dcd->hwndParent,
3260 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame);
3261 if (mp2)
3262 free((CHAR *)mp2);
3263 return MRFROMLONG(ret);
3264 }
3265 return 0;
3266
3267 case WM_SAVEAPPLICATION:
3268 if (dcd && ParentIsDesktop(hwnd, dcd->hwndParent)) {
3269
3270 SWP swp;
3271
3272 WinQueryWindowPos(dcd->hwndFrame, &swp);
3273 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE | SWP_MAXIMIZE)))
3274 PrfWriteProfileData(fmprof,
3275 appname, "VDirSizePos", &swp, sizeof(swp));
3276 }
3277 break;
3278
3279 case WM_CLOSE:
3280 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
3281 if (LastDir == hwnd)
3282 LastDir = (HWND) 0;
3283 if (dcd) {
3284 dcd->stopflag++;
3285 if (!dcd->dontclose && ParentIsDesktop(dcd->hwndFrame, (HWND) 0))
3286 PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
3287 if (!dcd->hwndObject ||
3288 !PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID)) {
3289 if (dcd->hwndObject)
3290 WinSetWindowPtr(dcd->hwndObject, QWL_USER, NULL);
3291 WinSetWindowPtr(hwnd, QWL_USER, NULL);
3292 if (dcd->hwndRestore)
3293 WinSetWindowPos(dcd->hwndRestore,
3294 HWND_TOP,
3295 0,
3296 0,
3297 0,
3298 0,
3299 SWP_RESTORE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);
3300 FreeList(dcd->lastselection);
3301 free(dcd);
3302 DosPostEventSem(CompactSem);
3303 }
3304 }
3305 WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
3306 QW_PARENT));
3307 return 0;
3308
3309 case WM_DESTROY:
3310 if (DirMenu)
3311 WinDestroyWindow(DirMenu);
3312 if (DirCnrMenu)
3313 WinDestroyWindow(DirCnrMenu);
3314 if (FileMenu)
3315 WinDestroyWindow(FileMenu);
3316 DirMenu = DirCnrMenu = FileMenu = (HWND) 0;
3317 EmptyCnr(hwnd);
3318 break;
3319 }
3320 if (dcd && dcd->oldproc){
3321 return dcd->oldproc(hwnd, msg, mp1, mp2);
3322 }
3323 else
3324 return PFNWPCnr(hwnd, msg, mp1, mp2);
3325}
3326
3327HWND StartDirCnr(HWND hwndParent, CHAR * directory, HWND hwndRestore,
3328 ULONG flags)
3329{
3330 /* bitmapped flags:
3331 * 0x00000001 = don't close app when window closes
3332 * 0x00000002 = no frame controls
3333 */
3334
3335 HWND hwndFrame = (HWND) 0, hwndClient;
3336 ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
3337 FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_NOBYTEALIGN | FCF_ACCELTABLE;
3338 USHORT id;
3339 static USHORT idinc = 0;
3340 DIRCNRDATA *dcd;
3341 static BOOL first = FALSE;
3342
3343 if (flags & 2)
3344 FrameFlags &= (~(FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER |
3345 FCF_MINMAX | FCF_ICON));
3346 if (!idinc)
3347 idinc = (rand() % 100);
3348 if (!hwndParent)
3349 hwndParent = HWND_DESKTOP;
3350 if (ParentIsDesktop(hwndParent, hwndParent))
3351 FrameFlags |= (FCF_TASKLIST | FCF_MENU);
3352 if (!hwndMain && !first) {
3353 if (DirCnrMenu) {
3354
3355 MENUITEM mi;
3356
3357 memset(&mi, 0, sizeof(mi));
3358 WinSendMsg(DirCnrMenu,
3359 MM_DELETEITEM, MPFROM2SHORT(IDM_DRIVESMENU, FALSE), MPVOID);
3360 mi.iPosition = MIT_END;
3361 mi.afStyle = MIS_TEXT;
3362 mi.id = IDM_DRIVESMENU;
3363 WinSendMsg(DirCnrMenu,
3364 MM_INSERTITEM,
3365 MPFROMP(&mi), MPFROMP(GetPString(IDS_DRIVESMENUTEXT)));
3366 }
3367 first = TRUE;
3368 }
3369 if (directory) {
3370 hwndFrame = WinCreateStdWindow(hwndParent,
3371 WS_VISIBLE,
3372 &FrameFlags,
3373 WC_DIRCONTAINER,
3374 NULL,
3375 WS_VISIBLE | fwsAnimate,
3376 FM3ModHandle, DIR_FRAME, &hwndClient);
3377 if (hwndFrame && hwndClient) {
3378 id = DIR_FRAME + idinc++;
3379 if (idinc > 99)
3380 idinc = 0;
3381 WinSetWindowUShort(hwndFrame, QWS_ID, id);
3382 dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__);
3383 if (!dcd) {
3384 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
3385 hwndFrame = (HWND) 0;
3386 }
3387 else {
3388 dcd->size = sizeof(DIRCNRDATA);
3389 dcd->id = id;
3390 dcd->type = DIR_FRAME;
3391 dcd->hwndParent = (hwndParent) ? hwndParent : HWND_DESKTOP;
3392 dcd->hwndFrame = hwndFrame;
3393 dcd->hwndClient = hwndClient;
3394 dcd->hwndRestore = hwndRestore;
3395 dcd->dontclose = ((flags & 1) != 0);
3396 strcpy(dcd->directory, directory);
3397 add_udir(FALSE, directory);
3398 {
3399 PFNWP oldproc;
3400
3401 oldproc = WinSubclassWindow(hwndFrame, (PFNWP) DirFrameWndProc);
3402 WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
3403 }
3404 dcd->hwndCnr = WinCreateWindow(hwndClient,
3405 WC_CONTAINER,
3406 NULL,
3407 CCS_AUTOPOSITION | CCS_MINIICONS |
3408 CCS_MINIRECORDCORE | ulCnrType |
3409 WS_VISIBLE,
3410 0,
3411 0,
3412 0,
3413 0,
3414 hwndClient,
3415 HWND_TOP, (ULONG) DIR_CNR, NULL, NULL);
3416 if (!dcd->hwndCnr) {
3417 Win_Error2(hwndClient, hwndClient, pszSrcFile, __LINE__,
3418 IDS_WINCREATEWINDOW);
3419 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
3420 free(dcd);
3421 hwndFrame = (HWND) 0;
3422 }
3423 else {
3424 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
3425 dcd->oldproc = WinSubclassWindow(dcd->hwndCnr,
3426 (PFNWP) DirCnrWndProc);
3427 {
3428 USHORT ids[] = { DIR_TOTALS, DIR_SELECTED, DIR_VIEW, DIR_SORT,
3429 DIR_FILTER, DIR_FOLDERICON, DIR_MAX, 0
3430 };
3431
3432 if (!(flags & 2))
3433 ids[6] = 0;
3434 CommonCreateTextChildren(dcd->hwndClient,
3435 WC_DIRSTATUS, ids);
3436 }
3437 if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
3438 WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
3439 if (FrameFlags & FCF_TASKLIST) {
3440
3441 SWP swp, swpD;
3442 ULONG size = sizeof(swp);
3443 LONG cxScreen, cyScreen;
3444
3445 WinQueryTaskSizePos(WinQueryAnchorBlock(hwndFrame), 0, &swp);
3446 if (PrfQueryProfileData(fmprof,
3447 appname, "VDirSizePos", &swpD, &size)) {
3448 cxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
3449 cyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
3450 if (swp.x + swpD.cx > cxScreen)
3451 swp.x = cxScreen - swpD.cx;
3452 if (swp.y + swpD.cy > cyScreen)
3453 swp.y = cyScreen - swpD.cy;
3454 swp.cx = swpD.cx;
3455 swp.cy = swpD.cy;
3456 }
3457 WinSetWindowPos(hwndFrame,
3458 HWND_TOP,
3459 swp.x,
3460 swp.y,
3461 swp.cx,
3462 swp.cy,
3463 SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER |
3464 SWP_ACTIVATE);
3465 }
3466 }
3467 }
3468 }
3469 }
3470 return hwndFrame;
3471}
3472
3473#pragma alloc_text(DIRCNRS,DirCnrWndProc,DirObjWndProc,DirClientWndProc)
3474#pragma alloc_text(DIRCNRS,DirTextProc,DirFrameWndProc)
3475#pragma alloc_text(STARTUP,StartDirCnr)
Note: See TracBrowser for help on using the repository browser.