source: trunk/dll/dircnrs.c@ 775

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

Minor clean up add comments re recent changes

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