source: trunk/dll/dircnrs.c@ 787

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

Rework UM_FILLSETUPLIST IDM_SAVEDIRCNRSTATE and ..._setups() logic for ticket# 109 and #31
Add GetMSecTimer()
Use GetMSecTimer in DbgMsg
Tweak notebook.ipf scanning page
Move more #pragma alloc_text statements to end of files for OpenWatcom
Delete obsoletes
Revert ExpandAll() ShowTreeRec() DosSleeps to 0 - DosSleep(1) was slowing down inner loops
Drop afFilesToGet - use FilesToGet directly
Optimze ShowTreeRec() collapse logic - was really slow

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