source: trunk/dll/dircnrs.c@ 872

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

Fix failure of font changes and font colors on main menus (tickets 27 & 162)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 90.4 KB
Line 
1
2/***********************************************************************
3
4 $Id: dircnrs.c 872 2007-11-22 23:11:21Z gyoung $
5
6 Directory containers
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2001, 2007 Steven H. Levine
10
11 16 Oct 02 SHL Handle large partitions
12 01 Aug 04 SHL Rework lstrip/rstrip usage
13 23 May 05 SHL Use QWL_USER
14 24 May 05 SHL Rework Win_Error usage
15 25 May 05 SHL Use ULONGLONG and CommaFmtULL
16 26 May 05 SHL More large file formatting updates
17 05 Jun 05 SHL Use QWL_USER
18 10 Nov 05 SHL Comments
19 13 Jul 06 SHL Use Runtime_Error
20 26 Jul 06 SHL Use chop_at_crnl
21 15 Aug 06 SHL Rework warning message text
22 07 Jan 07 GKY Move error strings etc. to string file
23 30 Mar 07 GKY Remove GetPString for window class names
24 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
25 06 Apr 07 GKY Add some error checking in drag/drop
26 19 Apr 07 SHL Use FreeDragInfoData. Add more drag/drop error checking.
27 12 May 07 SHL Use dcd->ulItemsToUnHilite; sync with UnHilite arg mods
28 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
29 02 Aug 07 SHL Sync with CNRITEM mods
30 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
31 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
32 26 Aug 07 GKY DosSleep(1) in loops changed to (0)
33 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
34
35***********************************************************************/
36
37#define INCL_DOS
38#define INCL_WIN
39#define INCL_GPI
40#define INCL_DOSERRORS
41#define INCL_LONGLONG
42
43#include <os2.h>
44#include <stdarg.h>
45#include <stdio.h>
46#include <stdlib.h>
47#include <string.h>
48#include <ctype.h>
49#include <limits.h>
50#include "fm3dll.h"
51#include "fm3dlg.h"
52#include "fm3str.h"
53#include "mle.h"
54#include <process.h> // _beginthread
55
56#pragma data_seg(DATA1)
57
58static PSZ pszSrcFile = __FILE__;
59
60MRESULT EXPENTRY DirFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
61{
62 return CommonFrameWndProc(DIR_CNR, hwnd, msg, mp1, mp2);
63}
64
65MRESULT EXPENTRY DirTextProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
66{
67 static BOOL emphasized = FALSE;
68 static HWND hwndButtonPopup = (HWND) 0;
69 static USHORT lastid = 0;
70 static ULONG timestamp = ULONG_MAX;
71
72 switch (msg) {
73 case WM_CREATE:
74 return CommonTextProc(hwnd, msg, mp1, mp2);
75
76 case WM_COMMAND:
77 {
78 DIRCNRDATA *dcd;
79 MRESULT mr;
80
81 mr = WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,
82 QW_PARENT),
83 DIR_CNR), msg, mp1, mp2);
84 if (hwndButtonPopup &&
85 SHORT1FROMMP(mp1) > IDM_DETAILSTITLES &&
86 SHORT1FROMMP(mp1) < IDM_DETAILSSETUP) {
87 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
88 QW_PARENT),
89 DIR_CNR), QWL_USER);
90 if (dcd)
91 SetDetailsSwitches(hwndButtonPopup, dcd);
92 }
93 return mr;
94 }
95
96 case UM_CONTEXTMENU:
97 case WM_CONTEXTMENU:
98 {
99 USHORT id;
100
101 id = WinQueryWindowUShort(hwnd, QWS_ID);
102 switch (id) {
103 case DIR_FOLDERICON:
104 if (fNoFoldMenu) {
105 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
106 DIR_CNR),
107 WM_COMMAND, MPFROM2SHORT(IDM_PREVIOUS, 0), mp2);
108 break;
109 }
110 /* else intentional fallthru */
111 case DIR_SELECTED:
112 case DIR_VIEW:
113 case DIR_SORT:
114 {
115 POINTL ptl = { 0, 0 };
116 SWP swp;
117 DIRCNRDATA *dcd;
118
119 if (hwndButtonPopup)
120 WinDestroyWindow(hwndButtonPopup);
121 if (id == DIR_SELECTED && msg == WM_CONTEXTMENU)
122 id = DIR_MAX;
123 if (id == lastid) {
124
125 ULONG check;
126
127 DosQuerySysInfo(QSV_MS_COUNT,
128 QSV_MS_COUNT, &check, sizeof(check));
129 if (check < timestamp + 500) {
130 lastid = 0;
131 goto MenuAbort;
132 }
133 }
134 hwndButtonPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
135 CopyPresParams(hwndButtonPopup, hwnd);
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(hwnd, &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(0); //26 Aug 07 GKY 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 = FindCnrRecord(dcd->hwndCnr,
804 dcd->previous,
805 NULL, TRUE, FALSE, TRUE);
806 if (pci && (INT) pci != -1) {
807 // make found item current (cursored) item
808 WinSendMsg(dcd->hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci),
809 MPFROM2SHORT(TRUE, CRA_CURSORED));
810 /* make sure that record shows in viewport */
811 ShowCnrRecord(dcd->hwndCnr, (PMINIRECORDCORE) pci);
812 }
813 }
814 }
815 }
816 return 0;
817
818 case UM_COMMAND:
819 if (mp1) {
820
821 LISTINFO *li = (LISTINFO *) mp1;
822
823 switch (li->type) {
824 case IDM_DOITYOURSELF:
825 case IDM_APPENDTOCLIP:
826 case IDM_SAVETOCLIP:
827 case IDM_ARCHIVE:
828 case IDM_ARCHIVEM:
829 case IDM_VIEWTEXT:
830 case IDM_VIEWBINARY:
831 case IDM_VIEWARCHIVE:
832 case IDM_VIEW:
833 case IDM_EDITTEXT:
834 case IDM_EDITBINARY:
835 case IDM_EDIT:
836 case IDM_OBJECT:
837 case IDM_SHADOW:
838 case IDM_SHADOW2:
839 case IDM_PRINT:
840 case IDM_ATTRS:
841 case IDM_DELETE:
842 case IDM_PERMDELETE:
843 case IDM_MCIPLAY:
844 case IDM_UPDATE:
845 if (PostMsg(hwnd, UM_MASSACTION, mp1, mp2))
846 return (MRESULT) TRUE;
847 break;
848 default:
849 if (PostMsg(hwnd, UM_ACTION, mp1, mp2))
850 return (MRESULT) TRUE;
851 }
852 }
853 return 0;
854
855 case UM_SELECT:
856 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
857 if (dcd) {
858 switch (SHORT1FROMMP(mp1)) {
859 case IDM_SELECTBOTH:
860 case IDM_SELECTONE:
861 case IDM_SELECTMORE:
862 case IDM_SELECTNEWER:
863 case IDM_SELECTOLDER:
864 case IDM_SELECTBIGGER:
865 case IDM_SELECTSMALLER:
866 case IDM_DESELECTBOTH:
867 case IDM_DESELECTONE:
868 case IDM_DESELECTMORE:
869 case IDM_DESELECTNEWER:
870 case IDM_DESELECTOLDER:
871 case IDM_DESELECTBIGGER:
872 case IDM_DESELECTSMALLER:
873 SpecialSelect2(dcd->hwndParent, SHORT1FROMMP(mp1));
874 break;
875 case IDM_SELECTLIST:
876 {
877 CHAR filename[CCHMAXPATH], *p, *pp;
878 ULONG size;
879
880 strcpy(filename, "*.LST");
881 size = CCHMAXPATH;
882 PrfQueryProfileData(fmprof, appname, "SaveToListName",
883 filename, &size);
884 pp = strrchr(filename, '\\');
885 if (!pp)
886 pp = filename;
887 p = strrchr(pp, '.');
888 if (p && *(p + 1) && p > pp + 1) {
889 if (pp > filename)
890 pp++;
891 *pp = '*';
892 pp++;
893 if (p > pp)
894 memmove(pp, p, strlen(p) + 1);
895 }
896 if (insert_filename(hwnd, filename, FALSE, FALSE))
897 SelectList(dcd->hwndCnr, TRUE, FALSE, FALSE, NULL, filename,
898 NULL);
899 }
900 break;
901 case IDM_SELECTALL:
902 SelectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
903 break;
904 case IDM_DESELECTALL:
905 DeselectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
906 break;
907 case IDM_SELECTALLFILES:
908 SelectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
909 break;
910 case IDM_DESELECTALLFILES:
911 DeselectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
912 break;
913 case IDM_SELECTALLDIRS:
914 SelectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
915 break;
916 case IDM_DESELECTALLDIRS:
917 DeselectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
918 break;
919 case IDM_DESELECTMASK:
920 case IDM_SELECTMASK:
921 {
922 MASK mask;
923 PCNRITEM pci = (PCNRITEM) mp2;
924
925 memset(&mask, 0, sizeof(MASK));
926 mask.fNoAttribs = TRUE;
927 mask.fNoDirs = TRUE;
928 mask.fText = TRUE;
929 strcpy(mask.prompt,
930 GetPString((SHORT1FROMMP(mp1) == IDM_SELECTMASK) ?
931 IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT));
932 if (pci && (INT) pci != -1)
933 strcpy(mask.szMask, pci->pszFileName);
934 if (WinDlgBox(HWND_DESKTOP,
935 dcd->hwndCnr,
936 PickMaskDlgProc,
937 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
938 if (SHORT1FROMMP(mp1) == IDM_SELECTMASK)
939 SelectAll(dcd->hwndCnr,
940 TRUE, TRUE, mask.szMask, mask.szText, FALSE);
941 else
942 DeselectAll(dcd->hwndCnr,
943 TRUE, TRUE, mask.szMask, mask.szText, FALSE);
944 }
945 }
946 break;
947
948 case IDM_DESELECTCLIP:
949 case IDM_SELECTCLIP:
950 {
951 CHAR **list;
952
953 list = ListFromClipboard(hwnd);
954 if (list) {
955 SelectList(dcd->hwndCnr, TRUE, FALSE,
956 (SHORT1FROMMP(mp1) == IDM_DESELECTCLIP),
957 NULL, NULL, list);
958 FreeList(list);
959 }
960 }
961 break;
962
963 case IDM_INVERT:
964 InvertAll(dcd->hwndCnr);
965 break;
966 }
967 }
968 return 0;
969
970 case UM_MASSACTION:
971 if (mp1) {
972
973 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
974 if (dcd) {
975
976 WORKER *wk;
977
978 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
979 if (!wk)
980 FreeListInfo((LISTINFO *) mp1);
981 else {
982 wk->size = sizeof(WORKER);
983 wk->hwndCnr = dcd->hwndCnr;
984 wk->hwndParent = dcd->hwndParent;
985 wk->hwndFrame = dcd->hwndFrame;
986 wk->hwndClient = dcd->hwndClient;
987 wk->li = (LISTINFO *) mp1;
988 strcpy(wk->directory, dcd->directory);
989 if (_beginthread(MassAction, NULL, 122880, (PVOID) wk) == -1) {
990 Runtime_Error(pszSrcFile, __LINE__,
991 GetPString(IDS_COULDNTSTARTTHREADTEXT));
992 free(wk);
993 FreeListInfo((LISTINFO *) mp1);
994 }
995 }
996 }
997 }
998 return 0;
999
1000 case UM_ACTION:
1001 if (mp1) {
1002
1003 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
1004 if (dcd) {
1005
1006 WORKER *wk;
1007
1008 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
1009 if (!wk)
1010 FreeListInfo((LISTINFO *) mp1);
1011 else {
1012 wk->size = sizeof(WORKER);
1013 wk->hwndCnr = dcd->hwndCnr;
1014 wk->hwndParent = dcd->hwndParent;
1015 wk->hwndFrame = dcd->hwndFrame;
1016 wk->hwndClient = dcd->hwndClient;
1017 wk->li = (LISTINFO *) mp1;
1018 strcpy(wk->directory, dcd->directory);
1019 if (_beginthread(Action, NULL, 122880, (PVOID) wk) == -1) {
1020 Runtime_Error(pszSrcFile, __LINE__,
1021 GetPString(IDS_COULDNTSTARTTHREADTEXT));
1022 free(wk);
1023 FreeListInfo((LISTINFO *) mp1);
1024 }
1025 }
1026 }
1027 }
1028 return 0;
1029
1030 case WM_CLOSE:
1031 WinDestroyWindow(hwnd);
1032 break;
1033
1034 case WM_DESTROY:
1035 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
1036 if (dcd) {
1037 if (dcd->hwndRestore)
1038 WinSetWindowPos(dcd->hwndRestore,
1039 HWND_TOP,
1040 0,
1041 0,
1042 0,
1043 0,
1044 SWP_RESTORE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);
1045 FreeList(dcd->lastselection);
1046 free(dcd);
1047 DosPostEventSem(CompactSem);
1048 }
1049 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
1050 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
1051 break;
1052 }
1053 return WinDefWindowProc(hwnd, msg, mp1, mp2);
1054}
1055
1056MRESULT EXPENTRY DirCnrWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
1057{
1058 DIRCNRDATA *dcd = INSTDATA(hwnd);
1059
1060 switch (msg) {
1061 case DM_PRINTOBJECT:
1062 return MRFROMLONG(DRR_TARGET);
1063
1064 case DM_DISCARDOBJECT:
1065 if (dcd)
1066 return WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
1067 else
1068 return MRFROMLONG(DRR_TARGET);
1069
1070 case WM_CHAR:
1071 shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
1072 if (SHORT1FROMMP(mp1) & KC_KEYUP)
1073 return (MRESULT) TRUE;
1074 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
1075 switch (SHORT2FROMMP(mp2)) {
1076 case VK_INSERT:
1077 if ((shiftstate & KC_CTRL) == KC_CTRL)
1078 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_MKDIR, 0), MPVOID);
1079 else if ((shiftstate & KC_ALT) == KC_ALT)
1080 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_CREATE, 0), MPVOID);
1081 break;
1082 case VK_PAGEUP:
1083 if ((shiftstate & KC_CTRL) == KC_CTRL)
1084 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PARENT, 0), MPVOID);
1085 break;
1086 case VK_PAGEDOWN:
1087 if ((shiftstate & KC_CTRL) == KC_CTRL)
1088 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PREVIOUS, 0), MPVOID);
1089 break;
1090 case VK_HOME:
1091 if ((shiftstate & KC_CTRL) == KC_CTRL && dcd) {
1092
1093 CHAR s[CCHMAXPATH], *p;
1094
1095 strcpy(s, dcd->directory);
1096 p = strchr(s, '\\');
1097 if (p) {
1098 p++;
1099 *p = 0;
1100 WinSendMsg(hwnd, UM_SETDIR, MPFROMP(s), MPVOID);
1101 }
1102 }
1103 break;
1104 case VK_DELETE:
1105 if ((shiftstate & KC_CTRL) == KC_CTRL)
1106 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PERMDELETE, 0), MPVOID);
1107 else if ((shiftstate & KC_SHIFT) == KC_SHIFT)
1108 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SAVETOCLIP, 0), MPVOID);
1109 else
1110 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID);
1111 break;
1112 }
1113 }
1114 if (shiftstate || fNoSearch)
1115 break;
1116 if (SHORT1FROMMP(mp1) & KC_CHAR) {
1117
1118 ULONG thistime, len;
1119 SEARCHSTRING srch;
1120 PCNRITEM pci;
1121
1122 if (!dcd)
1123 break;
1124 switch (SHORT1FROMMP(mp2)) {
1125 case '\x1b':
1126 case '\r':
1127 case '\n':
1128 dcd->lasttime = 0;
1129 *dcd->szCommonName = 0;
1130 break;
1131 default:
1132 thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd));
1133 if (thistime > dcd->lasttime + 1250)
1134 *dcd->szCommonName = 0;
1135 dcd->lasttime = thistime;
1136 if (SHORT1FROMMP(mp2) == ' ' && !dcd->szCommonName)
1137 break;
1138 KbdRetry:
1139 len = strlen(dcd->szCommonName);
1140 if (len >= CCHMAXPATH - 1) {
1141 *dcd->szCommonName = 0;
1142 len = 0;
1143 }
1144 dcd->szCommonName[len] = toupper(SHORT1FROMMP(mp2));
1145 dcd->szCommonName[len + 1] = 0;
1146 memset(&srch, 0, sizeof(SEARCHSTRING));
1147 srch.cb = (ULONG) sizeof(SEARCHSTRING);
1148 srch.pszSearch = (PSZ) dcd->szCommonName;
1149 srch.fsPrefix = TRUE;
1150 srch.fsCaseSensitive = FALSE;
1151 srch.usView = CV_ICON;
1152 pci = WinSendMsg(hwnd, CM_SEARCHSTRING, MPFROMP(&srch),
1153 MPFROMLONG(CMA_FIRST));
1154 if (pci && (INT) pci != -1) {
1155
1156 USHORT attrib = CRA_CURSORED;
1157
1158 /* make found item current item */
1159 if (!stricmp(pci->pszFileName, dcd->szCommonName))
1160 attrib |= CRA_SELECTED;
1161 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
1162 MPFROM2SHORT(TRUE, attrib));
1163 /* make sure that record shows in viewport */
1164 ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
1165 return (MRESULT) TRUE;
1166 }
1167 else {
1168 if (SHORT1FROMMP(mp2) == ' ') {
1169 dcd->szCommonName[len] = 0;
1170 break;
1171 }
1172 *dcd->szCommonName = 0;
1173 dcd->lasttime = 0;
1174 if (len) // retry as first letter if no match
1175 goto KbdRetry;
1176 }
1177 break;
1178 }
1179 }
1180 break;
1181
1182 case WM_MOUSEMOVE:
1183 case WM_BUTTON1UP:
1184 case WM_BUTTON2UP:
1185 case WM_BUTTON3UP:
1186 case WM_CHORD:
1187 shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
1188 break;
1189
1190 case WM_BUTTON1MOTIONEND:
1191 {
1192 CNRINFO cnri;
1193
1194 memset(&cnri, 0, sizeof(CNRINFO));
1195 cnri.cb = sizeof(CNRINFO);
1196 if (WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
1197 MPFROMLONG(sizeof(CNRINFO)))) {
1198 if (cnri.flWindowAttr & CV_DETAIL)
1199 PrfWriteProfileData(fmprof, appname, "CnrSplitBar",
1200 (PVOID) & cnri.xVertSplitbar, sizeof(LONG));
1201 }
1202 }
1203 break;
1204
1205 case UM_COMPARE:
1206 if (dcd && mp1 && mp2) {
1207
1208 COMPARE *cmp;
1209 CHAR *leftdir = (CHAR *) mp1, *rightdir = (CHAR *) mp2;
1210
1211 if (!IsFile(leftdir) && !IsFile(rightdir)) {
1212 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
1213 if (cmp) {
1214 cmp->size = sizeof(COMPARE);
1215 strcpy(cmp->leftdir, leftdir);
1216 strcpy(cmp->rightdir, rightdir);
1217 cmp->hwndParent = dcd->hwndParent;
1218 cmp->dcd.hwndParent = dcd->hwndParent;
1219 WinDlgBox(HWND_DESKTOP,
1220 HWND_DESKTOP,
1221 CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
1222 }
1223 }
1224 }
1225 return 0;
1226
1227 case WM_PRESPARAMCHANGED:
1228 PresParamChanged(hwnd, "DirCnr", mp1, mp2);
1229 break;
1230
1231 case UM_UPDATERECORDLIST:
1232 if (dcd && mp1)
1233 WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
1234 return 0;
1235
1236 case UM_UPDATERECORD:
1237 if (dcd && mp1) {
1238
1239 CHAR *filename;
1240
1241 filename = mp1;
1242 if (filename)
1243 UpdateCnrRecord(hwnd, filename, TRUE, dcd);
1244 }
1245 return 0;
1246
1247 case WM_SETFOCUS:
1248 /*
1249 * put name of our window (directory name) on status line
1250 */
1251 if (dcd && hwndStatus && mp2) {
1252
1253 PCNRITEM pci = NULL;
1254
1255 if (fAutoView && hwndMain) {
1256 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
1257 MPFROMSHORT(CRA_CURSORED));
1258 if (pci && (INT) pci != -1 &&
1259 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
1260 WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
1261 else
1262 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1263 }
1264 if (*dcd->directory) {
1265 if (hwndMain)
1266 WinSendMsg(hwndMain,
1267 UM_SETUSERLISTNAME, MPFROMP(dcd->directory), MPVOID);
1268 else
1269 add_udir(FALSE, dcd->directory);
1270 }
1271 if (hwndMain)
1272 PostMsg(hwndMain, UM_ADVISEFOCUS, MPFROMLONG(dcd->hwndFrame), MPVOID);
1273 }
1274 if (mp2) {
1275 LastDir = hwnd;
1276 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1277 if (fSwitchTreeOnFocus && hwndTree && dcd && *dcd->directory)
1278 WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(dcd->directory), MPVOID);
1279 }
1280 break;
1281
1282 case UM_SETDIR:
1283 if (dcd && mp1) {
1284
1285 CHAR fullname[CCHMAXPATH];
1286
1287 DosError(FERR_DISABLEHARDERR);
1288 if (!DosQueryPathInfo((CHAR *) mp1,
1289 FIL_QUERYFULLNAME, fullname, sizeof(fullname))) {
1290 if (stricmp(dcd->directory, fullname)) {
1291 strcpy(dcd->previous, dcd->directory);
1292 strcpy(dcd->directory, fullname);
1293 DosEnterCritSec();
1294 dcd->stopflag++;
1295 DosExitCritSec();
1296 if (!PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPFROMLONG(1L))) {
1297 strcpy(dcd->directory, dcd->previous);
1298 DosEnterCritSec();
1299 dcd->stopflag--;
1300 DosExitCritSec();
1301 }
1302 else if (*dcd->directory) {
1303 if (hwndMain)
1304 WinSendMsg(hwndMain,
1305 UM_SETUSERLISTNAME, MPFROMP(dcd->directory), MPVOID);
1306 else
1307 add_udir(FALSE, dcd->directory);
1308 }
1309 }
1310 }
1311 }
1312 break;
1313
1314 case UM_RESCAN:
1315 if (dcd) {
1316
1317 CNRINFO cnri;
1318 CHAR s[CCHMAXPATH * 2], tf[81], tb[81];
1319 PCNRITEM pci;
1320
1321 memset(&cnri, 0, sizeof(CNRINFO));
1322 cnri.cb = sizeof(CNRINFO);
1323 WinSendMsg(hwnd,
1324 CM_QUERYCNRINFO,
1325 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
1326 cnri.pszCnrTitle = dcd->directory;
1327 WinSendMsg(hwnd,
1328 CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_CNRTITLE));
1329 dcd->totalfiles = cnri.cRecords;
1330 commafmt(tb, sizeof(tb), dcd->totalfiles);
1331 CommaFmtULL(tf, sizeof(tf), dcd->ullTotalBytes, 'K');
1332 sprintf(s, "%s / %s", tb, tf);
1333 WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, s);
1334 commafmt(tb, sizeof(tb), dcd->selectedfiles);
1335 CommaFmtULL(tf, sizeof(tf), dcd->selectedbytes, 'K');
1336 sprintf(s, "%s / %s", tb, tf);
1337 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
1338 if (hwndStatus &&
1339 dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
1340 PostMsg(dcd->hwndObject, UM_RESCAN2, MPVOID, MPVOID);
1341 if ((fSplitStatus && hwndStatus2) || fMoreButtons) {
1342 pci = WinSendMsg(hwnd,
1343 CM_QUERYRECORDEMPHASIS,
1344 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
1345 if (pci && (INT) pci != -1) {
1346 if (fSplitStatus && hwndStatus2) {
1347 CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
1348 if (!fMoreButtons)
1349 sprintf(s,
1350 " %s %04u/%02u/%02u %02u:%02u:%02u [%s] %s",
1351 tb,
1352 pci->date.year,
1353 pci->date.month,
1354 pci->date.day,
1355 pci->time.hours,
1356 pci->time.minutes,
1357 pci->time.seconds,
1358 pci->pszDispAttr, pci->pszFileName);
1359 else {
1360 *tf = 0;
1361 if (pci->cbFile + pci->easize > 1024) {
1362 CommaFmtULL(tf, sizeof(tf), pci->cbFile + pci->easize, 'K');
1363 }
1364 sprintf(s,
1365 GetPString(IDS_STATUSSIZETEXT),
1366 tb, *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
1367 }
1368 WinSetWindowText(hwndStatus2, s);
1369 }
1370 else
1371 WinSetWindowText(hwndStatus2, NullStr);
1372 if (fMoreButtons) {
1373 WinSetWindowText(hwndName, pci->pszFileName);
1374 sprintf(s,
1375 "%04u/%02u/%02u %02u:%02u:%02u",
1376 pci->date.year,
1377 pci->date.month,
1378 pci->date.day,
1379 pci->time.hours, pci->time.minutes, pci->time.seconds);
1380 WinSetWindowText(hwndDate, s);
1381 WinSetWindowText(hwndAttr, pci->pszDispAttr);
1382 }
1383 }
1384 else {
1385 WinSetWindowText(hwndStatus2, NullStr);
1386 WinSetWindowText(hwndName, NullStr);
1387 WinSetWindowText(hwndDate, NullStr);
1388 WinSetWindowText(hwndAttr, NullStr);
1389 }
1390 }
1391 }
1392 }
1393 return 0;
1394
1395 case UM_SORTRECORD:
1396 if (dcd) {
1397
1398 CNRINFO cnri;
1399
1400 memset(&cnri, 0, sizeof(CNRINFO));
1401 cnri.cb = sizeof(CNRINFO);
1402 WinSendMsg(hwnd,
1403 CM_QUERYCNRINFO,
1404 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
1405 cnri.pSortRecord = (PVOID) SortDirCnr;
1406 WinSendMsg(hwnd,
1407 CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_PSORTRECORD));
1408 WinSendMsg(hwnd,
1409 CM_SORTRECORD,
1410 MPFROMP(SortDirCnr), MPFROMLONG(dcd->sortFlags));
1411 }
1412 return 0;
1413
1414 case UM_SETUP:
1415 if (dcd) {
1416 if (!dcd->hwndObject) {
1417 /*
1418 * first time through -- set things up
1419 */
1420
1421 CNRINFO cnri;
1422
1423 RestorePresParams(hwnd, "DirCnr");
1424 LoadDetailsSwitches("DirCnr", dcd);
1425 memset(&cnri, 0, sizeof(CNRINFO));
1426 cnri.cb = sizeof(CNRINFO);
1427 WinSendMsg(hwnd,
1428 CM_QUERYCNRINFO,
1429 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
1430 cnri.cyLineSpacing = 0;
1431 cnri.cxTreeIndent = 12L;
1432
1433 cnri.flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
1434 cnri.flWindowAttr |= (CV_NAME | CA_DETAILSVIEWTITLES | CV_MINI |
1435 CV_FLOW);
1436 cnri.pSortRecord = (PVOID) SortDirCnr;
1437
1438 {
1439 ULONG size = sizeof(ULONG);
1440
1441 PrfQueryProfileData(fmprof,
1442 appname,
1443 "DirflWindowAttr",
1444 (PVOID) & cnri.flWindowAttr, &size);
1445 size = sizeof(MASK);
1446 if (!*dcd->mask.szMask &&
1447 !dcd->mask.attrFile && !dcd->mask.antiattr) {
1448 if (PrfQueryProfileSize(fmprof,
1449 appname, "DirFilter", &size) && size) {
1450 PrfQueryProfileData(fmprof,
1451 appname, "DirFilter", &dcd->mask, &size);
1452 SetMask(dcd->mask.szMask, &dcd->mask);
1453 }
1454 else
1455 dcd->mask.attrFile = (FILE_READONLY | FILE_NORMAL |
1456 FILE_ARCHIVED | FILE_DIRECTORY |
1457 FILE_HIDDEN | FILE_SYSTEM);
1458 }
1459 *(dcd->mask.prompt) = 0;
1460 }
1461 if (dcd->flWindowAttr)
1462 cnri.flWindowAttr = dcd->flWindowAttr;
1463 else
1464 dcd->flWindowAttr = cnri.flWindowAttr;
1465 cnri.flWindowAttr &= (~(CA_MIXEDTARGETEMPH | CA_ORDEREDTARGETEMPH |
1466 CA_TITLEREADONLY | CA_TITLESEPARATOR));
1467 cnri.flWindowAttr |= CV_FLOW;
1468 dcd->flWindowAttr |= CV_FLOW;
1469 if (WinWindowFromID(dcd->hwndFrame, FID_TITLEBAR))
1470 cnri.flWindowAttr &= (~CA_CONTAINERTITLE);
1471 else
1472 cnri.flWindowAttr |= CA_CONTAINERTITLE;
1473 if (!dcd->sortFlags)
1474 dcd->sortFlags = sortFlags;
1475 WinSendMsg(hwnd,
1476 CM_SETCNRINFO,
1477 MPFROMP(&cnri),
1478 MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING |
1479 CMA_CXTREEINDENT | CMA_PSORTRECORD));
1480 SetCnrCols(hwnd, FALSE);
1481 AdjustCnrColsForPref(hwnd, NULL, dcd, FALSE);
1482 if (_beginthread(MakeObjWin, NULL, 245760, (PVOID) dcd) == -1) {
1483 Runtime_Error(pszSrcFile, __LINE__,
1484 GetPString(IDS_COULDNTSTARTTHREADTEXT));
1485 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
1486 return 0;
1487 }
1488 else
1489 DosSleep(32); //05 Aug 07 GKY 64
1490 WinEnableMenuItem(DirCnrMenu, IDM_FINDINTREE, (hwndTree != (HWND) 0));
1491 }
1492 SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1493 DIR_FILTER), &dcd->mask, FALSE);
1494 SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1495 DIR_SORT), dcd->sortFlags, FALSE);
1496 SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1497 DIR_VIEW), dcd->flWindowAttr);
1498 }
1499 else {
1500 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
1501 return 0;
1502 }
1503 return 0;
1504
1505 case WM_MENUEND:
1506 if (dcd) {
1507
1508 HWND hwndMenu = (HWND) mp2;
1509
1510 if (hwndMenu == DirCnrMenu ||
1511 hwndMenu == FileMenu || hwndMenu == DirMenu) {
1512 MarkAll(hwnd, TRUE, FALSE, TRUE);
1513 if (dcd->cnremphasized) {
1514 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
1515 MPFROM2SHORT(FALSE, CRA_SOURCE));
1516 dcd->cnremphasized = FALSE;
1517 }
1518 }
1519 }
1520 break;
1521
1522 case UM_OPENWINDOWFORME:
1523 if (dcd) {
1524 if (mp1 && !IsFile((CHAR *) mp1)) {
1525 OpenDirCnr(hwnd, dcd->hwndParent, dcd->hwndFrame, FALSE, (char *)mp1);
1526 }
1527 else if (mp1 && IsFile(mp1) == 1) {
1528 StartArcCnr(HWND_DESKTOP,
1529 dcd->hwndFrame, (CHAR *) mp1, 4, (ARC_TYPE *) mp2);
1530 }
1531 }
1532 return 0;
1533
1534 case MM_PORTHOLEINIT:
1535 if (dcd) {
1536 switch (SHORT1FROMMP(mp1)) {
1537 case 0:
1538 case 1:
1539 {
1540 ULONG wmsg;
1541
1542 wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
1543 PortholeInit((HWND) WinSendMsg(dcd->hwndClient,
1544 wmsg, MPVOID, MPVOID), mp1, mp2);
1545 }
1546 break;
1547 }
1548 }
1549 break;
1550
1551 case UM_INITMENU:
1552 case WM_INITMENU:
1553 if (dcd) {
1554 switch (SHORT1FROMMP(mp1)) {
1555 case IDM_FILESMENU:
1556 if (isalpha(*dcd->directory)) {
1557 if (driveflags[toupper(*dcd->directory) - 'A'] & DRIVE_NOTWRITEABLE) {
1558 WinEnableMenuItem((HWND) mp2, IDM_MOVEMENU, FALSE);
1559 WinEnableMenuItem((HWND) mp2, IDM_RENAME, FALSE);
1560 WinEnableMenuItem((HWND) mp2, IDM_MKDIR, FALSE);
1561 WinEnableMenuItem((HWND) mp2, IDM_UNDELETE, FALSE);
1562 WinEnableMenuItem((HWND) mp2, IDM_DELETESUBMENU, FALSE);
1563 WinEnableMenuItem((HWND) mp2, IDM_DELETE, FALSE);
1564 WinEnableMenuItem((HWND) mp2, IDM_EDIT, FALSE);
1565 WinEnableMenuItem((HWND) mp2, IDM_EDITTEXT, FALSE);
1566 WinEnableMenuItem((HWND) mp2, IDM_EDITBINARY, FALSE);
1567 WinEnableMenuItem((HWND) mp2, IDM_ATTRS, FALSE);
1568 }
1569 else {
1570 WinEnableMenuItem((HWND) mp2, IDM_MOVEMENU, TRUE);
1571 WinEnableMenuItem((HWND) mp2, IDM_RENAME, TRUE);
1572 WinEnableMenuItem((HWND) mp2, IDM_MKDIR, TRUE);
1573 WinEnableMenuItem((HWND) mp2, IDM_UNDELETE, TRUE);
1574 WinEnableMenuItem((HWND) mp2, IDM_DELETESUBMENU, TRUE);
1575 WinEnableMenuItem((HWND) mp2, IDM_DELETE, TRUE);
1576 WinEnableMenuItem((HWND) mp2, IDM_EDIT, TRUE);
1577 WinEnableMenuItem((HWND) mp2, IDM_EDITTEXT, TRUE);
1578 WinEnableMenuItem((HWND) mp2, IDM_EDITBINARY, TRUE);
1579 WinEnableMenuItem((HWND) mp2, IDM_ATTRS, TRUE);
1580 CopyPresParams((HWND) mp2, hwnd);
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 CopyPresParams((HWND) mp2, hwnd);
1590 if (isalpha(*dcd->directory)) {
1591 if (driveflags[toupper(*dcd->directory) - 'A'] & DRIVE_NOTWRITEABLE)
1592 WinEnableMenuItem((HWND) mp2, IDM_MKDIR, FALSE);
1593 else
1594 WinEnableMenuItem((HWND) mp2, IDM_MKDIR, TRUE);
1595 }
1596 WinEnableMenuItem((HWND) mp2,
1597 IDM_SELECTCOMPAREMENU,
1598 (CountDirCnrs(dcd->hwndParent) > 1));
1599 break;
1600
1601 case IDM_DETAILSSETUP:
1602 SetDetailsSwitches((HWND) mp2, dcd);
1603 break;
1604
1605 case IDM_COMMANDSMENU:
1606 SetupCommandMenu((HWND) mp2, hwnd);
1607 break;
1608
1609 case IDM_SORTSUBMENU:
1610 SetSortChecks((HWND) mp2, dcd->sortFlags);
1611 break;
1612
1613 case IDM_WINDOWSMENU:
1614 SetupWinList((HWND) mp2,
1615 (hwndMain) ? hwndMain : (HWND) 0, dcd->hwndFrame);
1616 break;
1617 }
1618 dcd->hwndLastMenu = (HWND) mp2;
1619 }
1620 if (msg == WM_INITMENU)
1621 break;
1622 return 0;
1623
1624 case UM_FILTER:
1625 if (dcd) {
1626
1627 PCNRITEM pci;
1628
1629 if (mp1) {
1630 DosEnterCritSec();
1631 SetMask((CHAR *) mp1, &dcd->mask);
1632 DosExitCritSec();
1633 }
1634 dcd->suspendview = 1;
1635 WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));
1636 dcd->suspendview = 0;
1637 if (fAutoView && hwndMain) {
1638 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1639 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
1640 if (pci && (INT) pci != -1 &&
1641 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
1642 WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
1643 else
1644 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1645 }
1646 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1647 }
1648 return 0;
1649
1650 case UM_COMMAND:
1651 if (mp1) {
1652 if (dcd) {
1653 if (!PostMsg(dcd->hwndObject, UM_COMMAND, mp1, mp2)) {
1654 Runtime_Error(pszSrcFile, __LINE__, "PostMsg");
1655 FreeListInfo((LISTINFO *) mp1);
1656 }
1657 else
1658 return (MRESULT) TRUE;
1659 }
1660 else
1661 FreeListInfo((LISTINFO *) mp1);
1662 }
1663 return 0;
1664
1665 case UM_NOTIFY:
1666 if (mp2)
1667 Notify((CHAR *) mp2);
1668 return 0;
1669
1670 case UM_DRIVECMD:
1671 if (mp1)
1672 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SWITCH, 0), mp1);
1673 return 0;
1674
1675 case WM_COMMAND:
1676 DosError(FERR_DISABLEHARDERR);
1677 if (dcd) {
1678 switch (SHORT1FROMMP(mp1)) {
1679 case IDM_SETTARGET:
1680 SetTargetDir(hwnd, FALSE);
1681 break;
1682
1683 case IDM_CREATE:
1684 {
1685 STRINGINPARMS sip;
1686 CHAR filename[CCHMAXPATHCOMP];
1687
1688 memset(&sip, 0, sizeof(sip));
1689 sip.help = GetPString(IDS_CREATETEXT);
1690 sip.prompt = GetPString(IDS_CREATEPROMPTTEXT);
1691 sip.inputlen = CCHMAXPATHCOMP - (strlen(dcd->directory) - 1);
1692 strcpy(filename, "NEWFILE.TXT");
1693 sip.ret = filename;
1694 sip.title = GetPString(IDS_CREATETITLETEXT);
1695 if (WinDlgBox(HWND_DESKTOP, hwnd, InputDlgProc, FM3ModHandle,
1696 STR_FRAME, &sip)) {
1697 bstrip(sip.ret);
1698 if (*sip.ret) {
1699 CHAR newfile[CCHMAXPATH];
1700 FILE *fp;
1701 INT test;
1702 PCNRITEM pci;
1703
1704 strcpy(newfile, dcd->directory);
1705 if (newfile[strlen(newfile) - 1] != '\\')
1706 strcat(newfile, "\\");
1707 strcat(newfile, sip.ret);
1708 test = IsFile(newfile);
1709 if (test != 1)
1710 fp = fopen(newfile, "w");
1711 if (test != 1 && !fp) {
1712 saymsg(MB_ENTER,
1713 hwnd,
1714 GetPString(IDS_ERRORTEXT),
1715 GetPString(IDS_CREATEERRORTEXT), newfile);
1716 }
1717 else {
1718 if (fp) {
1719 WinSendMsg(hwnd, UM_UPDATERECORD, MPFROMP(newfile), MPVOID);
1720 fclose(fp);
1721 }
1722 if (*editor) {
1723
1724 CHAR *dummy[2];
1725
1726 dummy[0] = newfile;
1727 dummy[1] = NULL;
1728 ExecOnList(hwnd,
1729 editor, WINDOWED | SEPARATE, NULL, dummy, NULL);
1730 }
1731 else
1732 StartMLEEditor(dcd->hwndParent, 4, newfile, dcd->hwndFrame);
1733 pci = FindCnrRecord(hwnd, newfile, NULL, TRUE, FALSE, TRUE);
1734 if (pci && (INT) pci != -1)
1735 /* make sure that record shows in viewport */
1736 ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
1737 }
1738 }
1739 }
1740 }
1741 break;
1742
1743 case IDM_CONTEXTMENU:
1744 {
1745 PCNRITEM pci;
1746
1747 pci = (PCNRITEM) CurrentRecord(hwnd);
1748 PostMsg(hwnd, WM_CONTROL, MPFROM2SHORT(DIR_CNR, CN_CONTEXTMENU),
1749 MPFROMP(pci));
1750 }
1751 break;
1752
1753 case IDM_MAXIMIZE:
1754 PostMsg(hwndMain, UM_MAXIMIZE, MPFROMLONG(dcd->hwndFrame), MPVOID);
1755 break;
1756
1757 case IDM_SHOWALLFILESCNR:
1758 StartSeeAll(HWND_DESKTOP, FALSE, dcd->directory);
1759 break;
1760
1761 case IDM_SHOWALLFILES:
1762 {
1763 PCNRITEM pci;
1764
1765 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1766 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
1767 if (pci && (INT) pci != -1) {
1768
1769 static CHAR dirname[CCHMAXPATH];
1770
1771 strcpy(dirname, pci->pszFileName);
1772 MakeValidDir(dirname);
1773 StartSeeAll(HWND_DESKTOP, FALSE, dirname);
1774 }
1775 }
1776 break;
1777
1778 case IDM_FINDINTREE:
1779 if (hwndTree)
1780 WinSendMsg(hwndTree, UM_SHOWME, MPFROMP(dcd->directory),
1781 MPFROMLONG(1L));
1782 break;
1783
1784 case IDM_BEGINEDIT:
1785 OpenEdit(hwnd);
1786 break;
1787
1788 case IDM_ENDEDIT:
1789 WinSendMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
1790 break;
1791
1792 case IDM_SHOWSELECT:
1793 QuickPopup(hwnd,
1794 dcd,
1795 CheckMenu(hwnd, &DirCnrMenu, DIRCNR_POPUP), IDM_SELECTSUBMENU);
1796 break;
1797
1798 case IDM_SHOWSORT:
1799 QuickPopup(hwnd, dcd, CheckMenu(hwnd, &DirCnrMenu, DIRCNR_POPUP),
1800 IDM_SORTSUBMENU);
1801 break;
1802
1803 case IDM_VIEWORARC:
1804 {
1805 SWP swp;
1806 PCNRITEM pci;
1807
1808 pci = (PCNRITEM) WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1809 MPFROMLONG(CMA_FIRST),
1810 MPFROMSHORT(CRA_CURSORED));
1811 if (pci && (INT) pci != -1) {
1812 WinQueryWindowPos(dcd->hwndFrame, &swp);
1813 DefaultViewKeys(hwnd,
1814 dcd->hwndFrame,
1815 dcd->hwndParent, &swp, pci->pszFileName);
1816 }
1817 }
1818 break;
1819
1820 case IDM_NOTEBOOK:
1821 if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
1822 PostMsg(dcd->hwndParent, msg, mp1, mp2);
1823 else
1824 WinDlgBox(HWND_DESKTOP, hwnd, CfgDlgProc, FM3ModHandle,
1825 CFG_FRAME, (PVOID) "Directory");
1826 break;
1827
1828 case IDM_QTREE:
1829 case IDM_TREE:
1830 {
1831 CHAR newpath[CCHMAXPATH];
1832 APIRET rc;
1833 PCNRITEM pci;
1834
1835 if (SHORT1FROMMP(mp1) == IDM_TREE) {
1836 pci = (PCNRITEM) CurrentRecord(hwnd);
1837 if (pci && (INT) pci != -1)
1838 strcpy(newpath, pci->pszFileName);
1839 else
1840 strcpy(newpath, dcd->directory);
1841 }
1842 else
1843 strcpy(newpath, dcd->directory);
1844 MakeValidDir(newpath);
1845 rc = WinDlgBox(HWND_DESKTOP, dcd->hwndClient, ObjCnrDlgProc,
1846 FM3ModHandle, QTREE_FRAME, MPFROMP(newpath));
1847 if (rc)
1848 WinSendMsg(hwnd, UM_SETDIR, MPFROMP(newpath), MPVOID);
1849 }
1850 break;
1851
1852 case IDM_RESELECT:
1853 SelectList(hwnd, TRUE, FALSE, FALSE, NULL, NULL, dcd->lastselection);
1854 break;
1855
1856 case IDM_HELP:
1857 if (hwndHelp) {
1858 if (!ParentIsDesktop(dcd->hwndFrame, dcd->hwndParent))
1859 PostMsg(dcd->hwndParent, UM_COMMAND, mp1, mp2);
1860 else
1861 WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
1862 }
1863 break;
1864
1865 case IDM_WINDOWDLG:
1866 if (!ParentIsDesktop(dcd->hwndFrame, dcd->hwndParent))
1867 PostMsg(dcd->hwndParent, UM_COMMAND,
1868 MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
1869 break;
1870
1871 case IDM_SORTSMARTNAME:
1872 case IDM_SORTNAME:
1873 case IDM_SORTFILENAME:
1874 case IDM_SORTSIZE:
1875 case IDM_SORTEASIZE:
1876 case IDM_SORTFIRST:
1877 case IDM_SORTLAST:
1878 case IDM_SORTLWDATE:
1879 case IDM_SORTLADATE:
1880 case IDM_SORTCRDATE:
1881 case IDM_SORTSUBJECT:
1882 dcd->sortFlags &= (SORT_REVERSE | SORT_DIRSFIRST | SORT_DIRSLAST);
1883 case IDM_SORTDIRSFIRST:
1884 case IDM_SORTDIRSLAST:
1885 case IDM_SORTREVERSE:
1886 switch (SHORT1FROMMP(mp1)) {
1887 case IDM_SORTSUBJECT:
1888 dcd->sortFlags |= SORT_SUBJECT;
1889 break;
1890 case IDM_SORTSMARTNAME:
1891 case IDM_SORTFILENAME:
1892 dcd->sortFlags |= SORT_FILENAME;
1893 break;
1894 case IDM_SORTSIZE:
1895 dcd->sortFlags |= SORT_SIZE;
1896 break;
1897 case IDM_SORTEASIZE:
1898 dcd->sortFlags |= SORT_EASIZE;
1899 break;
1900 case IDM_SORTFIRST:
1901 dcd->sortFlags |= SORT_FIRSTEXTENSION;
1902 break;
1903 case IDM_SORTLAST:
1904 dcd->sortFlags |= SORT_LASTEXTENSION;
1905 break;
1906 case IDM_SORTLWDATE:
1907 dcd->sortFlags |= SORT_LWDATE;
1908 break;
1909 case IDM_SORTLADATE:
1910 dcd->sortFlags |= SORT_LADATE;
1911 break;
1912 case IDM_SORTCRDATE:
1913 dcd->sortFlags |= SORT_CRDATE;
1914 break;
1915 case IDM_SORTDIRSFIRST:
1916 if (dcd->sortFlags & SORT_DIRSFIRST)
1917 dcd->sortFlags &= (~SORT_DIRSFIRST);
1918 else {
1919 dcd->sortFlags |= SORT_DIRSFIRST;
1920 dcd->sortFlags &= (~SORT_DIRSLAST);
1921 }
1922 break;
1923 case IDM_SORTDIRSLAST:
1924 if (dcd->sortFlags & SORT_DIRSLAST)
1925 dcd->sortFlags &= (~SORT_DIRSLAST);
1926 else {
1927 dcd->sortFlags |= SORT_DIRSLAST;
1928 dcd->sortFlags &= (~SORT_DIRSFIRST);
1929 }
1930 break;
1931 case IDM_SORTREVERSE:
1932 if (dcd->sortFlags & SORT_REVERSE)
1933 dcd->sortFlags &= (~SORT_REVERSE);
1934 else
1935 dcd->sortFlags |= SORT_REVERSE;
1936 break;
1937 }
1938 WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortDirCnr),
1939 MPFROMLONG(dcd->sortFlags));
1940 SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1941 DIR_SORT), dcd->sortFlags, FALSE);
1942 break;
1943
1944 case IDM_COLLECT:
1945 if (!Collector) {
1946
1947 HWND hwndC;
1948 SWP swp;
1949
1950 if (!ParentIsDesktop(hwnd, dcd->hwndParent) && !fAutoTile &&
1951 (!fExternalCollector && !strcmp(realappname, FM3Str)))
1952 GetNextWindowPos(dcd->hwndParent, &swp, NULL, NULL);
1953 hwndC = StartCollector((fExternalCollector ||
1954 strcmp(realappname, FM3Str)) ?
1955 HWND_DESKTOP : dcd->hwndParent, 4);
1956 if (hwndC) {
1957 if (!ParentIsDesktop(hwnd, dcd->hwndParent) && !fAutoTile &&
1958 (!fExternalCollector && !strcmp(realappname, FM3Str)))
1959 WinSetWindowPos(hwndC, HWND_TOP, swp.x, swp.y,
1960 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE |
1961 SWP_SHOW | SWP_ZORDER);
1962 else if (!ParentIsDesktop(hwnd, dcd->hwndParent) && fAutoTile &&
1963 !strcmp(realappname, FM3Str))
1964 TileChildren(dcd->hwndParent, TRUE);
1965 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
1966 DosSleep(100); //05 Aug 07 GKY 250
1967 }
1968 }
1969 else
1970 StartCollector(dcd->hwndParent, 4);
1971 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_COLLECTOR, 0), MPVOID);
1972 break;
1973
1974 case IDM_COLLECTOR:
1975 DosSleep(32); //05 Aug 07 GKY 64
1976 {
1977 CHAR **list;
1978
1979 list = BuildList(hwnd);
1980 if (list) {
1981 if (Collector) {
1982 if (!PostMsg(Collector,
1983 WM_COMMAND,
1984 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(list)))
1985 FreeList(list);
1986 else if (fUnHilite)
1987 UnHilite(hwnd, TRUE, &dcd->lastselection, 0);
1988 }
1989 else
1990 FreeList(list);
1991 }
1992 }
1993 break;
1994
1995 case IDM_UNDELETE:
1996 {
1997 PCNRITEM pci;
1998 CHAR path[CCHMAXPATH];
1999
2000 pci = (PCNRITEM) CurrentRecord(hwnd);
2001 if (pci && (INT) pci != -1) {
2002 strcpy(path, pci->pszFileName);
2003 MakeValidDir(path);
2004 WinDlgBox(HWND_DESKTOP, hwnd, UndeleteDlgProc, FM3ModHandle,
2005 UNDEL_FRAME, MPFROMP(path));
2006 }
2007 }
2008 break;
2009
2010 case IDM_UNDELETESPEC:
2011 WinDlgBox(HWND_DESKTOP,
2012 hwnd,
2013 UndeleteDlgProc,
2014 FM3ModHandle, UNDEL_FRAME, MPFROMP(dcd->directory));
2015 break;
2016
2017 case IDM_RESORT:
2018// WinSendMsg(hwnd,
2019// CM_SORTRECORD,
2020// MPFROMP(SortDirCnr),
2021// MPFROMLONG((fSyncUpdates) ? sortFlags : dcd->sortFlags));
2022 WinSendMsg(hwnd,
2023 CM_SORTRECORD,
2024 MPFROMP(SortDirCnr), MPFROMLONG(dcd->sortFlags));
2025 break;
2026
2027 case IDM_FILTER:
2028 {
2029 BOOL empty = FALSE;
2030 PCNRITEM pci;
2031 CHAR *p;
2032
2033 if (!*dcd->mask.szMask) {
2034 empty = TRUE;
2035 pci = (PCNRITEM) CurrentRecord(hwnd);
2036 if (pci && !(pci->attrFile & FILE_DIRECTORY)) {
2037 p = strrchr(pci->pszFileName, '\\');
2038 if (p) {
2039 p++;
2040 strcpy(dcd->mask.szMask, p);
2041 }
2042 }
2043 }
2044 *(dcd->mask.prompt) = 0;
2045
2046 if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
2047 FM3ModHandle, MSK_FRAME, MPFROMP(&dcd->mask)))
2048 WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
2049 else if (empty)
2050 *dcd->mask.szMask = 0;
2051 SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
2052 DIR_FILTER), &dcd->mask, FALSE);
2053 }
2054 break;
2055
2056 case IDM_HIDEALL:
2057 if (fAutoView && hwndMain)
2058 PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
2059 dcd->suspendview = 1;
2060 HideAll(hwnd);
2061 dcd->suspendview = 0;
2062 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2063 break;
2064
2065 case IDM_SELECTBOTH:
2066 case IDM_SELECTONE:
2067 case IDM_SELECTMORE:
2068 case IDM_SELECTNEWER:
2069 case IDM_SELECTOLDER:
2070 case IDM_SELECTBIGGER:
2071 case IDM_SELECTSMALLER:
2072 case IDM_DESELECTBOTH:
2073 case IDM_DESELECTONE:
2074 case IDM_DESELECTMORE:
2075 case IDM_DESELECTNEWER:
2076 case IDM_DESELECTOLDER:
2077 case IDM_DESELECTBIGGER:
2078 case IDM_DESELECTSMALLER:
2079 if (ParentIsDesktop(hwnd, dcd->hwndParent)) {
2080 Runtime_Error(pszSrcFile, __LINE__, "ParentIsDesktop unexpected");
2081 break;
2082 }
2083 case IDM_SELECTLIST:
2084 case IDM_SELECTALL:
2085 case IDM_DESELECTALL:
2086 case IDM_SELECTALLFILES:
2087 case IDM_DESELECTALLFILES:
2088 case IDM_SELECTALLDIRS:
2089 case IDM_DESELECTALLDIRS:
2090 case IDM_SELECTMASK:
2091 case IDM_DESELECTMASK:
2092 case IDM_INVERT:
2093 case IDM_SELECTCLIP:
2094 case IDM_DESELECTCLIP:
2095 {
2096 PCNRITEM pci;
2097
2098 pci = (PCNRITEM) CurrentRecord(hwnd);
2099 if ((INT) pci == -1)
2100 pci = NULL;
2101 if (SHORT1FROMMP(mp1) == IDM_HIDEALL) {
2102 if (pci) {
2103 if (!(pci->rc.flRecordAttr & CRA_SELECTED))
2104 pci->rc.flRecordAttr |= CRA_FILTERED;
2105 WinSendMsg(hwnd, CM_INVALIDATERECORD, MPFROMP(&pci),
2106 MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
2107 break;
2108 }
2109 }
2110 PostMsg(dcd->hwndObject, UM_SELECT, mp1, MPFROMP(pci));
2111 }
2112 break;
2113
2114 case IDM_RESCAN:
2115 DosEnterCritSec();
2116 dcd->stopflag++;
2117 DosExitCritSec();
2118 if (!PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPVOID)) {
2119 DosEnterCritSec();
2120 dcd->stopflag--;
2121 DosExitCritSec();
2122 }
2123 break;
2124
2125 case IDM_SHOWLNAMES:
2126 case IDM_SHOWSUBJECT:
2127 case IDM_SHOWEAS:
2128 case IDM_SHOWSIZE:
2129 case IDM_SHOWICON:
2130 case IDM_SHOWLWDATE:
2131 case IDM_SHOWLWTIME:
2132 case IDM_SHOWLADATE:
2133 case IDM_SHOWLATIME:
2134 case IDM_SHOWCRDATE:
2135 case IDM_SHOWCRTIME:
2136 case IDM_SHOWATTR:
2137 AdjustDetailsSwitches(hwnd,
2138 dcd->hwndLastMenu,
2139 SHORT1FROMMP(mp1),
2140 dcd->directory, "DirCnr", dcd, FALSE);
2141 break;
2142
2143 case IDM_TREEVIEW:
2144 case IDM_ICON:
2145 case IDM_TEXT:
2146 case IDM_DETAILS:
2147 case IDM_NAME:
2148 case IDM_MINIICONS:
2149 case IDM_DETAILSTITLES:
2150 {
2151 CNRINFO cnri;
2152
2153 memset(&cnri, 0, sizeof(CNRINFO));
2154 cnri.cb = sizeof(CNRINFO);
2155 WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
2156 MPFROMLONG(sizeof(CNRINFO)));
2157 switch (SHORT1FROMMP(mp1)) {
2158 case IDM_TREEVIEW:
2159 if (!(cnri.flWindowAttr & CV_TREE))
2160 dcd->lastattr = cnri.flWindowAttr;
2161 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2162 CV_DETAIL | CV_NAME | CA_TREELINE));
2163 cnri.flWindowAttr |= CA_TREELINE | CV_TREE | CV_ICON;
2164 if (!dcd->firsttree)
2165 PostMsg(dcd->hwndObject, UM_FLESH, MPVOID, MPVOID);
2166 break;
2167 case IDM_ICON:
2168 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2169 CV_DETAIL | CV_NAME | CA_TREELINE));
2170 cnri.flWindowAttr |= CV_ICON;
2171 break;
2172 case IDM_NAME:
2173 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2174 CV_DETAIL | CV_NAME | CA_TREELINE));
2175 cnri.flWindowAttr |= CV_NAME;
2176 break;
2177 case IDM_TEXT:
2178 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2179 CV_DETAIL | CV_NAME | CA_TREELINE));
2180 cnri.flWindowAttr |= CV_TEXT;
2181 break;
2182 case IDM_DETAILS:
2183 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2184 CV_DETAIL | CV_NAME | CA_TREELINE));
2185 cnri.flWindowAttr |= CV_DETAIL;
2186 break;
2187 case IDM_MINIICONS:
2188 if (cnri.flWindowAttr & CV_MINI)
2189 cnri.flWindowAttr &= (~CV_MINI);
2190 else
2191 cnri.flWindowAttr |= CV_MINI;
2192 break;
2193 case IDM_DETAILSTITLES:
2194 if (cnri.flWindowAttr & CA_DETAILSVIEWTITLES)
2195 cnri.flWindowAttr &= (~CA_DETAILSVIEWTITLES);
2196 else
2197 cnri.flWindowAttr |= CA_DETAILSVIEWTITLES;
2198 break;
2199 }
2200 cnri.flWindowAttr &= (~(CA_ORDEREDTARGETEMPH | CA_MIXEDTARGETEMPH));
2201 cnri.flWindowAttr |= CV_FLOW;
2202 dcd->flWindowAttr = cnri.flWindowAttr;
2203 WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
2204 MPFROMLONG(CMA_FLWINDOWATTR));
2205 WinSendMsg(hwnd, CM_INVALIDATERECORD, MPVOID,
2206 MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
2207 SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
2208 DIR_VIEW), dcd->flWindowAttr);
2209 }
2210 break;
2211
2212 case IDM_SAVETOLIST:
2213 WinDlgBox(HWND_DESKTOP, hwnd, SaveListDlgProc, FM3ModHandle,
2214 SAV_FRAME, MPFROMP(&hwnd));
2215 break;
2216
2217 case IDM_SIZES:
2218 {
2219 PCNRITEM pci;
2220 CHAR path[CCHMAXPATH];
2221
2222 pci = (PCNRITEM) CurrentRecord(hwnd);
2223 if (pci && (INT) pci != -1)
2224 strcpy(path, pci->pszFileName);
2225 else
2226 strcpy(path, dcd->directory);
2227 MakeValidDir(path);
2228 WinDlgBox(HWND_DESKTOP,
2229 HWND_DESKTOP, DirSizeProc, FM3ModHandle, DSZ_FRAME, path);
2230 }
2231 break;
2232
2233 case IDM_MKDIR:
2234 {
2235 // PCNRITEM pci;
2236
2237 // pci = (PCNRITEM) CurrentRecord(hwnd);
2238 PMMkDir(dcd->hwndParent,
2239 (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(hwnd, &DirMenu, DIR_POPUP);
2565// WinEnableMenuItem(DirMenu,IDM_TREE,TRUE);
2566 }
2567 else
2568 menuHwnd = CheckMenu(hwnd, &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(hwnd, &DirMenu, DIR_POPUP);
2651 else
2652 dcd->hwndLastMenu = CheckMenu(hwnd, &FileMenu, FILE_POPUP);
2653 }
2654 else {
2655 dcd->hwndLastMenu = CheckMenu(hwnd, &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(1))) {
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 } // CN_ENTER
3253 break;
3254 } // switch mp1
3255 break;
3256 } // if dcd
3257 return 0;
3258
3259 case UM_LOADFILE:
3260 if (dcd && mp2) {
3261
3262 HWND ret = StartMLEEditor(dcd->hwndParent,
3263 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame);
3264 if (mp2)
3265 free((CHAR *)mp2);
3266 return MRFROMLONG(ret);
3267 }
3268 return 0;
3269
3270 case WM_SAVEAPPLICATION:
3271 if (dcd && ParentIsDesktop(hwnd, dcd->hwndParent)) {
3272
3273 SWP swp;
3274
3275 WinQueryWindowPos(dcd->hwndFrame, &swp);
3276 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE | SWP_MAXIMIZE)))
3277 PrfWriteProfileData(fmprof,
3278 appname, "VDirSizePos", &swp, sizeof(swp));
3279 }
3280 break;
3281
3282 case WM_CLOSE:
3283 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
3284 if (LastDir == hwnd)
3285 LastDir = (HWND) 0;
3286 if (dcd) {
3287 dcd->stopflag++;
3288 if (!dcd->dontclose && ParentIsDesktop(dcd->hwndFrame, (HWND) 0))
3289 PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
3290 if (!dcd->hwndObject ||
3291 !PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID)) {
3292 if (dcd->hwndObject)
3293 WinSetWindowPtr(dcd->hwndObject, QWL_USER, NULL);
3294 WinSetWindowPtr(hwnd, QWL_USER, NULL);
3295 if (dcd->hwndRestore)
3296 WinSetWindowPos(dcd->hwndRestore,
3297 HWND_TOP,
3298 0,
3299 0,
3300 0,
3301 0,
3302 SWP_RESTORE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);
3303 FreeList(dcd->lastselection);
3304 free(dcd);
3305 DosPostEventSem(CompactSem);
3306 }
3307 }
3308 WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
3309 QW_PARENT));
3310 return 0;
3311
3312 case WM_DESTROY:
3313 if (DirMenu)
3314 WinDestroyWindow(DirMenu);
3315 if (DirCnrMenu)
3316 WinDestroyWindow(DirCnrMenu);
3317 if (FileMenu)
3318 WinDestroyWindow(FileMenu);
3319 DirMenu = DirCnrMenu = FileMenu = (HWND) 0;
3320 EmptyCnr(hwnd);
3321 break;
3322 }
3323 if (dcd && dcd->oldproc){
3324 return dcd->oldproc(hwnd, msg, mp1, mp2);
3325 }
3326 else
3327 return PFNWPCnr(hwnd, msg, mp1, mp2);
3328}
3329
3330HWND StartDirCnr(HWND hwndParent, CHAR * directory, HWND hwndRestore,
3331 ULONG flags)
3332{
3333 /* bitmapped flags:
3334 * 0x00000001 = don't close app when window closes
3335 * 0x00000002 = no frame controls
3336 */
3337
3338 HWND hwndFrame = (HWND) 0, hwndClient;
3339 ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
3340 FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_NOBYTEALIGN | FCF_ACCELTABLE;
3341 USHORT id;
3342 static USHORT idinc = 0;
3343 DIRCNRDATA *dcd;
3344 static BOOL first = FALSE;
3345
3346 if (flags & 2)
3347 FrameFlags &= (~(FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER |
3348 FCF_MINMAX | FCF_ICON));
3349 if (!idinc)
3350 idinc = (rand() % 100);
3351 if (!hwndParent)
3352 hwndParent = HWND_DESKTOP;
3353 if (ParentIsDesktop(hwndParent, hwndParent))
3354 FrameFlags |= (FCF_TASKLIST | FCF_MENU);
3355 if (!hwndMain && !first) {
3356 if (DirCnrMenu) {
3357
3358 MENUITEM mi;
3359
3360 memset(&mi, 0, sizeof(mi));
3361 WinSendMsg(DirCnrMenu,
3362 MM_DELETEITEM, MPFROM2SHORT(IDM_DRIVESMENU, FALSE), MPVOID);
3363 mi.iPosition = MIT_END;
3364 mi.afStyle = MIS_TEXT;
3365 mi.id = IDM_DRIVESMENU;
3366 WinSendMsg(DirCnrMenu,
3367 MM_INSERTITEM,
3368 MPFROMP(&mi), MPFROMP(GetPString(IDS_DRIVESMENUTEXT)));
3369 }
3370 first = TRUE;
3371 }
3372 if (directory) {
3373 hwndFrame = WinCreateStdWindow(hwndParent,
3374 WS_VISIBLE,
3375 &FrameFlags,
3376 WC_DIRCONTAINER,
3377 NULL,
3378 WS_VISIBLE | fwsAnimate,
3379 FM3ModHandle, DIR_FRAME, &hwndClient);
3380 if (hwndFrame && hwndClient) {
3381 id = DIR_FRAME + idinc++;
3382 if (idinc > 99)
3383 idinc = 0;
3384 WinSetWindowUShort(hwndFrame, QWS_ID, id);
3385 dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__);
3386 if (!dcd) {
3387 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
3388 hwndFrame = (HWND) 0;
3389 }
3390 else {
3391 dcd->size = sizeof(DIRCNRDATA);
3392 dcd->id = id;
3393 dcd->type = DIR_FRAME;
3394 dcd->hwndParent = (hwndParent) ? hwndParent : HWND_DESKTOP;
3395 dcd->hwndFrame = hwndFrame;
3396 dcd->hwndClient = hwndClient;
3397 dcd->hwndRestore = hwndRestore;
3398 dcd->dontclose = ((flags & 1) != 0);
3399 strcpy(dcd->directory, directory);
3400 add_udir(FALSE, directory);
3401 {
3402 PFNWP oldproc;
3403
3404 oldproc = WinSubclassWindow(hwndFrame, (PFNWP) DirFrameWndProc);
3405 WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
3406 }
3407 dcd->hwndCnr = WinCreateWindow(hwndClient,
3408 WC_CONTAINER,
3409 NULL,
3410 CCS_AUTOPOSITION | CCS_MINIICONS |
3411 CCS_MINIRECORDCORE | ulCnrType |
3412 WS_VISIBLE,
3413 0,
3414 0,
3415 0,
3416 0,
3417 hwndClient,
3418 HWND_TOP, (ULONG) DIR_CNR, NULL, NULL);
3419 if (!dcd->hwndCnr) {
3420 Win_Error2(hwndClient, hwndClient, pszSrcFile, __LINE__,
3421 IDS_WINCREATEWINDOW);
3422 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
3423 free(dcd);
3424 hwndFrame = (HWND) 0;
3425 }
3426 else {
3427 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
3428 dcd->oldproc = WinSubclassWindow(dcd->hwndCnr,
3429 (PFNWP) DirCnrWndProc);
3430 {
3431 USHORT ids[] = { DIR_TOTALS, DIR_SELECTED, DIR_VIEW, DIR_SORT,
3432 DIR_FILTER, DIR_FOLDERICON, DIR_MAX, 0
3433 };
3434
3435 if (!(flags & 2))
3436 ids[6] = 0;
3437 CommonCreateTextChildren(dcd->hwndClient,
3438 WC_DIRSTATUS, ids);
3439 }
3440 if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
3441 WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
3442 if (FrameFlags & FCF_TASKLIST) {
3443
3444 SWP swp, swpD;
3445 ULONG size = sizeof(swp);
3446 LONG cxScreen, cyScreen;
3447
3448 WinQueryTaskSizePos(WinQueryAnchorBlock(hwndFrame), 0, &swp);
3449 if (PrfQueryProfileData(fmprof,
3450 appname, "VDirSizePos", &swpD, &size)) {
3451 cxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
3452 cyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
3453 if (swp.x + swpD.cx > cxScreen)
3454 swp.x = cxScreen - swpD.cx;
3455 if (swp.y + swpD.cy > cyScreen)
3456 swp.y = cyScreen - swpD.cy;
3457 swp.cx = swpD.cx;
3458 swp.cy = swpD.cy;
3459 }
3460 WinSetWindowPos(hwndFrame,
3461 HWND_TOP,
3462 swp.x,
3463 swp.y,
3464 swp.cx,
3465 swp.cy,
3466 SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER |
3467 SWP_ACTIVATE);
3468 }
3469 }
3470 }
3471 }
3472 }
3473 return hwndFrame;
3474}
3475
3476#pragma alloc_text(DIRCNRS,DirCnrWndProc,DirObjWndProc,DirClientWndProc)
3477#pragma alloc_text(DIRCNRS,DirTextProc,DirFrameWndProc)
3478#pragma alloc_text(STARTUP,StartDirCnr)
Note: See TracBrowser for help on using the repository browser.