1 |
|
---|
2 | /***********************************************************************
|
---|
3 |
|
---|
4 | $Id: treecnr.c 1375 2009-01-04 17:08:06Z gyoung $
|
---|
5 |
|
---|
6 | Tree containers
|
---|
7 |
|
---|
8 | Copyright (c) 1993-98 M. Kimes
|
---|
9 | Copyright (c) 2001, 2008 Steven H. Levine
|
---|
10 |
|
---|
11 | 16 Oct 02 SHL Handle large partitions
|
---|
12 | 11 Jun 03 SHL Add JFS and FAT32 support
|
---|
13 | 25 May 05 SHL Rename comnam to szCommonName and fix typo
|
---|
14 | 25 May 05 SHL Use ULONGLONG and CommaFmtULL
|
---|
15 | 26 May 05 SHL More large file formatting updates
|
---|
16 | 05 Jun 05 SHL Use QWL_USER
|
---|
17 | 06 Aug 05 SHL Renames
|
---|
18 | 08 Dec 05 SHL TreeCnrWndProc: disable menu items if drive not ready
|
---|
19 | 17 Jul 06 SHL Use Runtime_Error
|
---|
20 | 15 Aug 06 SHL Rework SetMask args
|
---|
21 | 31 Aug 06 JS Add more partitioning menu items
|
---|
22 | 22 Oct 06 GKY Add NDFS32 support
|
---|
23 | 29 Dec 06 GKY Fixed menu gray out for remote drives (added variable "remote")
|
---|
24 | 29 Dec 06 GKY Enabled edit of drive flags on "not ready" drives
|
---|
25 | 18 Feb 07 GKY More drive type and icon support
|
---|
26 | 08 Mar 07 SHL Ensure drive icon updates after drive flags change
|
---|
27 | 09 Mar 07 GKY Use SelectDriveIcon
|
---|
28 | 30 Mar 07 GKY Remove GetPString for window class names
|
---|
29 | 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
|
---|
30 | 06 Apr 07 GKY Add some error checking in drag/drop
|
---|
31 | 19 Apr 07 SHL Sync with AcceptOneDrop GetOneDrop mods
|
---|
32 | 19 Apr 07 SHL Add more drag/drop error checking
|
---|
33 | 12 May 07 SHL Use dcd->ulItemsToUnHilite; sync with UnHilite arg mods
|
---|
34 | 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
|
---|
35 | 10 Jun 07 GKY Mouse button 3 white space click to fail silently
|
---|
36 | 05 Jul 07 SHL Disable leftover debug code
|
---|
37 | 02 Aug 07 SHL Sync with CNRITEM mods
|
---|
38 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
|
---|
39 | 14 Aug 07 SHL Revert ShowTreeRec DosSleep to 0
|
---|
40 | 14 Aug 07 SHL Optimze ShowTreeRec collapse - was really slow
|
---|
41 | 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
|
---|
42 | 22 Aug 07 SHL Disable DbgMsgs shipped with 3.0.8beta1
|
---|
43 | 26 Aug 07 SHL Revert to DosSleep(0)
|
---|
44 | 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
|
---|
45 | 10 Jan 08 SHL Sync with CfgDlgProc mods
|
---|
46 | 15 Feb 08 SHL Sync with settings menu rework
|
---|
47 | 15 Feb 08 SHL Avoid death if tree container 0 width
|
---|
48 | 19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory
|
---|
49 | 02 Aug 08 GKY Always pass temp variable point to UM_SHOWME to avoid freeing pci->pszFileName early
|
---|
50 | 19 Oct 08 GKY Fixed logic for greying menu items (Format etc) on remote and virtual drives (it was reversed)
|
---|
51 | 19 Oct 08 GKY Fixed context menu to be "drives" menu on unformatted drives
|
---|
52 | 28 Nov 08 GKY Remove unneeded DosEnterCriSec calls
|
---|
53 | 10 Dec 08 SHL Integrate exception handler support
|
---|
54 | 25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis
|
---|
55 | 26 Dec 08 GKY Implemented DROPHELP for the tree container
|
---|
56 | 27 Dec 08 GKY Add refresh removable media to tree container menus
|
---|
57 | 28 Dec 08 GKY Rework partition submenu to gray out unavailable items (check for existence of files)
|
---|
58 | and have no default choice.
|
---|
59 | 01 Jan 09 GKY Add Seek and Scan to drives & directory context menus pass drive/dir as search root
|
---|
60 |
|
---|
61 | ***********************************************************************/
|
---|
62 |
|
---|
63 | #include <stdlib.h>
|
---|
64 | #include <string.h>
|
---|
65 | #include <ctype.h>
|
---|
66 | // #include <process.h> // _beginthread
|
---|
67 |
|
---|
68 | #define INCL_DOS
|
---|
69 | #define INCL_WIN
|
---|
70 | #define INCL_LONGLONG
|
---|
71 | #define INCL_DOSERRORS
|
---|
72 |
|
---|
73 | #include "fm3dll.h"
|
---|
74 | #include "fm3dll2.h" // #define's for UM_*, control id's, etc.
|
---|
75 | #include "treecnr.h"
|
---|
76 | #include "mainwnd2.h" // Data declaration(s)
|
---|
77 | #include "grep.h" // Data declaration(s)
|
---|
78 | #include "dircnrs.h" // Data declaration(s)
|
---|
79 | #include "info.h" // Data declaration(s)
|
---|
80 | #include "fm3dlg.h"
|
---|
81 | #include "fm3str.h"
|
---|
82 | #include "mle.h"
|
---|
83 | #include "comp.h" // COMPARE
|
---|
84 | #include "filldir.h" // RemoveCnrItems...
|
---|
85 | #include "errutil.h" // Dos_Error...
|
---|
86 | #include "strutil.h" // GetPString
|
---|
87 | #include "notebook.h" // CfgDlgProc
|
---|
88 | #include "command.h" // RunCommand
|
---|
89 | #include "worker.h" // Action, MassAction
|
---|
90 | #include "mainwnd.h" // BubbleHelp, FindDirCnrByName, GetNextWindowPos
|
---|
91 | #include "misc.h" // CnrDirectEdit, EmphasizeButton, FindDirCnr
|
---|
92 | // FindDirCnr, FixSwitchList, OpenEdit, QuickPopup
|
---|
93 | // SetSortChecks, SwitchCommand, CheckMenu
|
---|
94 | // CurrentRecord, IsFm2Window
|
---|
95 | #include "common.h" // CommonCnrProc, CommonDriveCmd, CommonFrameWndProc
|
---|
96 | // CommonTextProc
|
---|
97 | #include "valid.h" // CheckDrive, DriveFlagsOne, IsValidDrive
|
---|
98 | #include "chklist.h" // DropListProc
|
---|
99 | #include "select.h" // ExpandAll
|
---|
100 | #include "findrec.h" // FindCnrRecord, FindParentRecord, ShowCnrRecord
|
---|
101 | #include "flesh.h" // Flesh, UnFlesh
|
---|
102 | #include "notify.h" // HideNote
|
---|
103 | #include "objwin.h" // MakeObjWin
|
---|
104 | #include "notify.h" // NotifyError
|
---|
105 | #include "remap.h" // RemapDlgProc
|
---|
106 | #include "saveclip.h" // SaveListDlgProc
|
---|
107 | #include "update.h" // SelectDriveIcon, UpdateCnrList, UpdateCnrRecord
|
---|
108 | #include "sortcnr.h" // SortTreeCnr
|
---|
109 | #include "droplist.h" // AcceptOneDrop, CheckPmDrgLimit, DropHelp, GetOneDrop
|
---|
110 | #include "presparm.h" // CopyPresParams
|
---|
111 | #include "defview.h" // DefaultViewKeys
|
---|
112 | #include "draglist.h" // DoFileDrag
|
---|
113 | #include "filter.h" // Filter
|
---|
114 | #include "shadow.h" // OpenObject
|
---|
115 | #include "mkdir.h" // PMMkDir
|
---|
116 | #include "collect.h" // StartCollector
|
---|
117 | #include "viewer.h" // StartMLEEditor
|
---|
118 | #include "newview.h" // StartViewer
|
---|
119 | #include "walkem.h" // WalkAllDlgProc
|
---|
120 | #include "commafmt.h" // CommaFmtULL
|
---|
121 | #include "wrappers.h" // xDosFindFirst
|
---|
122 | #include "systemf.h" // runemf2
|
---|
123 | #include "dirs.h" // save_dir2
|
---|
124 | #include "fortify.h"
|
---|
125 | #include "init.h" // GetTidForWindow
|
---|
126 | #include "excputil.h" // xbeginthread
|
---|
127 |
|
---|
128 | // Data definitions
|
---|
129 |
|
---|
130 | #pragma data_seg(GLOBAL1)
|
---|
131 | HWND LastDir;
|
---|
132 | HWND TreeCnrMenu;
|
---|
133 | INT driveserial[26];
|
---|
134 | BOOL fDCOpens;
|
---|
135 | BOOL fDummy;
|
---|
136 | BOOL fFollowTree;
|
---|
137 | BOOL fTopDir;
|
---|
138 | BOOL fLVMGui;
|
---|
139 | BOOL fDFSee;
|
---|
140 | BOOL fFDisk;
|
---|
141 | BOOL fMiniLVM;
|
---|
142 | BOOL fLVM;
|
---|
143 | HPOINTER hptrDunno;
|
---|
144 | HWND hwndMainMenu;
|
---|
145 |
|
---|
146 | #pragma data_seg(GLOBAL2)
|
---|
147 | ULONG FM3UL;
|
---|
148 | INT TreesortFlags;
|
---|
149 |
|
---|
150 | #pragma data_seg(DATA1)
|
---|
151 |
|
---|
152 | static PSZ pszSrcFile = __FILE__;
|
---|
153 | static BOOL fOkayMinimize;
|
---|
154 |
|
---|
155 | APIRET16 APIENTRY16 Dos16MemAvail(PULONG pulAvailMem);
|
---|
156 |
|
---|
157 | typedef struct APPNOTIFY
|
---|
158 | {
|
---|
159 | HAPP happ;
|
---|
160 | CHAR device;
|
---|
161 | struct APPNOTIFY *next;
|
---|
162 | struct APPNOTIFY *prev;
|
---|
163 | }
|
---|
164 | APPNOTIFY;
|
---|
165 |
|
---|
166 | MRESULT EXPENTRY OpenButtonProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
167 | {
|
---|
168 | static BOOL emphasized = FALSE;
|
---|
169 |
|
---|
170 | switch (msg) {
|
---|
171 | case WM_CREATE:
|
---|
172 | {
|
---|
173 | MRESULT rc;
|
---|
174 |
|
---|
175 | rc = PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
176 | WinSetPresParam(hwnd, PP_FONTNAMESIZE,
|
---|
177 | strlen(GetPString(IDS_8TIMESNEWROMANTEXT)) + 1,
|
---|
178 | (PVOID) GetPString(IDS_8TIMESNEWROMANTEXT));
|
---|
179 | return rc;
|
---|
180 | }
|
---|
181 |
|
---|
182 | case WM_MOUSEMOVE:
|
---|
183 | BubbleHelp(hwnd, TRUE, FALSE, TRUE, GetPString(IDS_OPENBUTTONHELP));
|
---|
184 | break;
|
---|
185 |
|
---|
186 | case WM_CONTEXTMENU:
|
---|
187 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
188 | WM_COMMAND, MPFROM2SHORT(IDM_OPENWALK, 0), MPVOID);
|
---|
189 | return 0;
|
---|
190 |
|
---|
191 | case DM_DRAGOVER:
|
---|
192 | if (!emphasized) {
|
---|
193 | emphasized = TRUE;
|
---|
194 | EmphasizeButton(hwnd, emphasized);
|
---|
195 | }
|
---|
196 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
---|
197 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
---|
198 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
---|
199 |
|
---|
200 | case DM_DRAGLEAVE:
|
---|
201 | if (emphasized) {
|
---|
202 | emphasized = FALSE;
|
---|
203 | EmphasizeButton(hwnd, emphasized);
|
---|
204 | }
|
---|
205 | break;
|
---|
206 |
|
---|
207 | case DM_DROPHELP:
|
---|
208 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_OPENDROPHELP));
|
---|
209 | return 0;
|
---|
210 |
|
---|
211 | case DM_DROP:
|
---|
212 | {
|
---|
213 | char szFrom[CCHMAXPATH + 2];
|
---|
214 |
|
---|
215 | if (emphasized) {
|
---|
216 | emphasized = FALSE;
|
---|
217 | EmphasizeButton(hwnd, emphasized);
|
---|
218 | }
|
---|
219 | if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
|
---|
220 | MakeValidDir(szFrom);
|
---|
221 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
222 | UM_OPENWINDOWFORME, MPFROMP(szFrom), MPVOID);
|
---|
223 | }
|
---|
224 | }
|
---|
225 | return 0;
|
---|
226 |
|
---|
227 | }
|
---|
228 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
229 | }
|
---|
230 |
|
---|
231 | VOID ShowTreeRec(HWND hwndCnr,
|
---|
232 | CHAR *dirname,
|
---|
233 | BOOL collapsefirst,
|
---|
234 | BOOL maketop)
|
---|
235 | {
|
---|
236 | /* Find a record in tree view, move it so it shows in container and
|
---|
237 | make it the current record */
|
---|
238 |
|
---|
239 | PCNRITEM pci, pciToSelect, pciP;
|
---|
240 | BOOL quickbail = FALSE;
|
---|
241 | CHAR szDir[CCHMAXPATH], *p;
|
---|
242 |
|
---|
243 | // already positioned to requested record?
|
---|
244 | pci = WinSendMsg(hwndCnr,
|
---|
245 | CM_QUERYRECORDEMPHASIS,
|
---|
246 | MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
|
---|
247 | if (pci && (INT) pci != -1 && !stricmp(pci->pszFileName, dirname)) {
|
---|
248 | // DbgMsg(pszSrcFile, __LINE__, "already at %s collapse %u maketop %u", dirname, collapsefirst, maketop); // 14 Aug 07 SHL fixme
|
---|
249 | quickbail = TRUE; // Bypass repositioning
|
---|
250 | goto MakeTop;
|
---|
251 | }
|
---|
252 | WinEnableWindowUpdate(hwndCnr, FALSE);
|
---|
253 | // DbgMsg(pszSrcFile, __LINE__, "finding %s collapse %u maketop %u", dirname, collapsefirst, maketop); // 14 Aug 07 SHL fixme
|
---|
254 | pci = FindCnrRecord(hwndCnr, dirname, NULL, TRUE, FALSE, TRUE);
|
---|
255 | if (!pci || (INT) pci == -1) {
|
---|
256 | *szDir = *dirname;
|
---|
257 | szDir[1] = ':';
|
---|
258 | szDir[2] = '\\';
|
---|
259 | szDir[3] = 0;
|
---|
260 | p = szDir + 3; // Point after root backslash
|
---|
261 | for (;;) {
|
---|
262 | pciP = FindCnrRecord(hwndCnr, szDir, NULL, TRUE, FALSE, TRUE);
|
---|
263 | if (pciP && (INT) pciP != -1) {
|
---|
264 | if (!stricmp(dirname, pciP->pszFileName))
|
---|
265 | break; // Found it
|
---|
266 | if (~pciP->rc.flRecordAttr & CRA_EXPANDED)
|
---|
267 | WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
|
---|
268 | strcpy(szDir, dirname);
|
---|
269 | if (p - szDir >= strlen(szDir))
|
---|
270 | break; // Not root dir
|
---|
271 | p = strchr(p, '\\');
|
---|
272 | if (p) {
|
---|
273 | *p = 0; // fixme?
|
---|
274 | p++;
|
---|
275 | }
|
---|
276 | else
|
---|
277 | break;
|
---|
278 | }
|
---|
279 | else
|
---|
280 | break;
|
---|
281 | DosSleep(0);
|
---|
282 | } // for
|
---|
283 | pci = FindCnrRecord(hwndCnr, dirname, NULL, TRUE, FALSE, TRUE);
|
---|
284 | }
|
---|
285 | // DbgMsg(pszSrcFile, __LINE__, "found"); // 14 Aug 07 SHL fixme
|
---|
286 | if (pci && (INT) pci != -1) {
|
---|
287 | if (~pci->rc.flRecordAttr & CRA_CURSORED) {
|
---|
288 | if (collapsefirst) {
|
---|
289 | // DbgMsg(pszSrcFile, __LINE__, "collapsing"); // 14 Aug 07 SHL fixme
|
---|
290 | pciP = WinSendMsg(hwndCnr,
|
---|
291 | CM_QUERYRECORD,
|
---|
292 | MPVOID, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
293 | while (pciP && (INT) pciP != -1) {
|
---|
294 | #if 1 // // 05 Jan 08 SHL fixme to be sure this is correct code
|
---|
295 | if (pciP->rc.flRecordAttr & CRA_EXPANDED) {
|
---|
296 | // collapse top level of all branches
|
---|
297 | WinSendMsg(hwndCnr, CM_COLLAPSETREE, MPFROMP(pciP), MPVOID);
|
---|
298 | }
|
---|
299 | #else // fixme to be gone
|
---|
300 | if (toupper(*pciP->pszFileName) == toupper(*dirname)) {
|
---|
301 | // collapse all levels if branch is our drive
|
---|
302 | if (pciP->rc.flRecordAttr & CRA_EXPANDED)
|
---|
303 | ExpandAll(hwndCnr, FALSE, pciP);
|
---|
304 | }
|
---|
305 | else if (pciP->rc.flRecordAttr & CRA_EXPANDED) {
|
---|
306 | // collapse top level of all branches
|
---|
307 | WinSendMsg(hwndCnr, CM_COLLAPSETREE, MPFROMP(pciP), MPVOID);
|
---|
308 | }
|
---|
309 | #endif
|
---|
310 | pciP = WinSendMsg(hwndCnr,
|
---|
311 | CM_QUERYRECORD,
|
---|
312 | MPFROMP(pciP),
|
---|
313 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
314 | } // while
|
---|
315 | }
|
---|
316 | /* expand all parent branches */
|
---|
317 | // DbgMsg(pszSrcFile, __LINE__, "expanding parents"); // 14 Aug 07 SHL fixme
|
---|
318 | pciToSelect = pci;
|
---|
319 | for (;;) {
|
---|
320 | pciP = WinSendMsg(hwndCnr,
|
---|
321 | CM_QUERYRECORD,
|
---|
322 | MPFROMP(pciToSelect),
|
---|
323 | MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER));
|
---|
324 | if (pciP && (INT) pciP != -1) {
|
---|
325 | if (!(pciP->rc.flRecordAttr & CRA_EXPANDED))
|
---|
326 | WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
|
---|
327 | pciToSelect = pciP;
|
---|
328 | }
|
---|
329 | else
|
---|
330 | break;
|
---|
331 | DosSleep(0); // Let GUI update
|
---|
332 | } // for
|
---|
333 | }
|
---|
334 | /* make record visible */
|
---|
335 | MakeTop:
|
---|
336 | // DbgMsg(pszSrcFile, __LINE__, "moving into view"); // 14 Aug 07 SHL fixme
|
---|
337 | pciToSelect = pci;
|
---|
338 | if (pciToSelect && (INT) pciToSelect != -1) {
|
---|
339 | if (fTopDir || maketop) {
|
---|
340 | ShowCnrRecord(hwndCnr, (PMINIRECORDCORE) pciToSelect);
|
---|
341 | }
|
---|
342 | if (fSwitchTreeExpand && ~pciToSelect->rc.flRecordAttr & CRA_EXPANDED) {
|
---|
343 | // DbgMsg(pszSrcFile, __LINE__, "expanding current"); // 14 Aug 07 SHL fixme
|
---|
344 | WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciToSelect), MPVOID);
|
---|
345 | // DbgMsg(pszSrcFile, __LINE__, "expanded"); // 14 Aug 07 SHL fixme
|
---|
346 | }
|
---|
347 | if (!quickbail) {
|
---|
348 | WinSendMsg(hwndCnr,
|
---|
349 | CM_SETRECORDEMPHASIS,
|
---|
350 | MPFROMP(pciToSelect),
|
---|
351 | MPFROM2SHORT(TRUE, CRA_SELECTED | CRA_CURSORED));
|
---|
352 | }
|
---|
353 | }
|
---|
354 | }
|
---|
355 | // DbgMsg(pszSrcFile, __LINE__, "done"); // 14 Aug 07 SHL fixme
|
---|
356 | WinEnableWindowUpdate(hwndCnr, TRUE);
|
---|
357 | // DosSleep(1); // Let GUI update
|
---|
358 | }
|
---|
359 |
|
---|
360 | MRESULT EXPENTRY TreeTitleWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
361 | MPARAM mp2)
|
---|
362 | {
|
---|
363 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
364 |
|
---|
365 | switch (msg) {
|
---|
366 | case WM_CONTEXTMENU:
|
---|
367 | return WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
368 | UM_CONTEXTMENU, mp1, mp2);
|
---|
369 | }
|
---|
370 | return oldproc(hwnd, msg, mp1, mp2);
|
---|
371 | }
|
---|
372 |
|
---|
373 | MRESULT EXPENTRY TreeStatProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
374 | {
|
---|
375 | switch (msg) {
|
---|
376 | case WM_CREATE:
|
---|
377 | return CommonTextProc(hwnd, msg, mp1, mp2);
|
---|
378 |
|
---|
379 | case WM_CONTEXTMENU:
|
---|
380 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), msg, mp1, mp2);
|
---|
381 | return 0;
|
---|
382 |
|
---|
383 | case WM_PAINT:
|
---|
384 | {
|
---|
385 | MRESULT mr = PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
386 |
|
---|
387 | PaintRecessedWindow(hwnd, (HPS) 0, FALSE, FALSE);
|
---|
388 | return mr;
|
---|
389 | }
|
---|
390 |
|
---|
391 | case WM_SETFOCUS:
|
---|
392 | if (mp2)
|
---|
393 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
394 | break;
|
---|
395 |
|
---|
396 | case UM_FOCUSME:
|
---|
397 | WinSetFocus(HWND_DESKTOP, WinQueryWindow(hwnd, QW_PARENT));
|
---|
398 | return 0;
|
---|
399 | }
|
---|
400 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
401 | }
|
---|
402 |
|
---|
403 | MRESULT EXPENTRY TreeFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
404 | MPARAM mp2)
|
---|
405 | {
|
---|
406 | switch (msg) {
|
---|
407 | case UM_RESCAN:
|
---|
408 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), msg, mp1, mp2);
|
---|
409 | return 0;
|
---|
410 |
|
---|
411 | case WM_ADJUSTWINDOWPOS:
|
---|
412 | {
|
---|
413 | SWP *pswp;
|
---|
414 |
|
---|
415 | pswp = (SWP *) mp1;
|
---|
416 | if (ParentIsDesktop(hwnd, (HWND) 0)) {
|
---|
417 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
418 | HideNote();
|
---|
419 | }
|
---|
420 | }
|
---|
421 | break;
|
---|
422 |
|
---|
423 | case WM_TRACKFRAME:
|
---|
424 | if (!fFreeTree && !ParentIsDesktop(hwnd, (HWND) 0)) {
|
---|
425 | switch (SHORT1FROMMP(mp1) & TF_MOVE) {
|
---|
426 | case TF_MOVE:
|
---|
427 | case TF_LEFT:
|
---|
428 | case TF_TOP:
|
---|
429 | case (TF_LEFT | TF_BOTTOM):
|
---|
430 | case (TF_LEFT | TF_TOP):
|
---|
431 | {
|
---|
432 | SWP swp;
|
---|
433 |
|
---|
434 | WinQueryWindowPos(hwnd, &swp);
|
---|
435 | if (!(swp.fl & SWP_ACTIVATE))
|
---|
436 | WinSetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0,
|
---|
437 | SWP_ZORDER | SWP_ACTIVATE);
|
---|
438 | }
|
---|
439 | return 0;
|
---|
440 | }
|
---|
441 | }
|
---|
442 | break;
|
---|
443 |
|
---|
444 | case WM_CALCFRAMERECT:
|
---|
445 | if (*(ULONG *) realappname != FM3UL) {
|
---|
446 |
|
---|
447 | MRESULT mr;
|
---|
448 | PRECTL prectl;
|
---|
449 |
|
---|
450 | mr = CommonFrameWndProc(TREE_CNR, hwnd, msg, mp1, mp2);
|
---|
451 |
|
---|
452 | /*
|
---|
453 | * Calculate the position of the client rectangle.
|
---|
454 | * Otherwise, we'll see a lot of redraw when we move the
|
---|
455 | * client during WM_FORMATFRAME.
|
---|
456 | */
|
---|
457 |
|
---|
458 | if (mr && mp2) {
|
---|
459 | prectl = (PRECTL) mp1;
|
---|
460 | prectl->yTop -= 22;
|
---|
461 | }
|
---|
462 | return mr;
|
---|
463 | }
|
---|
464 | break;
|
---|
465 |
|
---|
466 | case WM_FORMATFRAME:
|
---|
467 | {
|
---|
468 | SHORT sCount;
|
---|
469 | PSWP pswp, pswpClient, pswpNew;
|
---|
470 |
|
---|
471 | sCount = (SHORT) CommonFrameWndProc(TREE_CNR, hwnd, msg, mp1, mp2);
|
---|
472 |
|
---|
473 | /*
|
---|
474 | * Reformat the frame to "squeeze" the client
|
---|
475 | */
|
---|
476 |
|
---|
477 | pswp = (PSWP) mp1;
|
---|
478 | {
|
---|
479 | SHORT x;
|
---|
480 |
|
---|
481 | for (x = 0; x < sCount; x++) {
|
---|
482 | if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {
|
---|
483 | pswpClient = pswp;
|
---|
484 | break;
|
---|
485 | }
|
---|
486 | pswp++;
|
---|
487 | }
|
---|
488 | }
|
---|
489 | pswpNew = (PSWP) mp1 + sCount;
|
---|
490 | *pswpNew = *pswpClient;
|
---|
491 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_STATUS);
|
---|
492 | if (*(ULONG *) realappname == FM3UL) {
|
---|
493 |
|
---|
494 | PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0;
|
---|
495 | SHORT x;
|
---|
496 |
|
---|
497 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_OPENWINDOW);
|
---|
498 | pswp = (PSWP) mp1;
|
---|
499 | for (x = 0; x < sCount; x++) {
|
---|
500 | if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR)
|
---|
501 | pswpTitlebar = pswp;
|
---|
502 | else if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX)
|
---|
503 | pswpMinbutton = pswp;
|
---|
504 | if (pswpTitlebar && pswpMinbutton)
|
---|
505 | break;
|
---|
506 | pswp++;
|
---|
507 | }
|
---|
508 | pswpNew->cy = pswpMinbutton->cy + 3;
|
---|
509 | pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3);
|
---|
510 | pswpTitlebar->cx -= (pswpNew->cx + 1);
|
---|
511 | pswpNew->x = pswpTitlebar->x + pswpTitlebar->cx;
|
---|
512 | pswpNew->y = pswpMinbutton->y - 1;
|
---|
513 | }
|
---|
514 | else {
|
---|
515 | pswpNew->x = pswpClient->x + 3;
|
---|
516 | pswpNew->y = (pswpClient->y + pswpClient->cy) - 20;
|
---|
517 | pswpNew->cx = pswpClient->cx - 6;
|
---|
518 | pswpNew->cy = 18;
|
---|
519 | pswpClient->cy -= 22;
|
---|
520 | }
|
---|
521 | sCount++;
|
---|
522 | return MRFROMSHORT(sCount);
|
---|
523 | }
|
---|
524 |
|
---|
525 | case WM_QUERYFRAMECTLCOUNT:
|
---|
526 | {
|
---|
527 | SHORT sCount;
|
---|
528 |
|
---|
529 | sCount = (SHORT) CommonFrameWndProc(TREE_CNR, hwnd, msg, mp1, mp2);
|
---|
530 | sCount++;
|
---|
531 | return MRFROMSHORT(sCount);
|
---|
532 | }
|
---|
533 | }
|
---|
534 | return CommonFrameWndProc(TREE_CNR, hwnd, msg, mp1, mp2);
|
---|
535 | }
|
---|
536 |
|
---|
537 | MRESULT EXPENTRY TreeClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
538 | MPARAM mp2)
|
---|
539 | {
|
---|
540 |
|
---|
541 | switch (msg) {
|
---|
542 | case UM_CONTAINERHWND:
|
---|
543 | return MRFROMLONG(WinWindowFromID(hwnd, TREE_CNR));
|
---|
544 |
|
---|
545 | case UM_VIEWSMENU:
|
---|
546 | return MRFROMLONG(CheckMenu(hwndMainMenu, &TreeCnrMenu, TREECNR_POPUP));
|
---|
547 |
|
---|
548 | case UM_TIMER:
|
---|
549 | case UM_ACTION:
|
---|
550 | case UM_SHOWME:
|
---|
551 | case UM_OPENWINDOWFORME:
|
---|
552 | case UM_MINIMIZE:
|
---|
553 | case UM_MAXIMIZE:
|
---|
554 | case WM_INITMENU:
|
---|
555 | case UM_INITMENU:
|
---|
556 | case UM_FILTER:
|
---|
557 | case UM_FILESMENU:
|
---|
558 | case UM_UPDATERECORD:
|
---|
559 | case UM_UPDATERECORDLIST:
|
---|
560 | case MM_PORTHOLEINIT:
|
---|
561 | case UM_DRIVECMD:
|
---|
562 | case WM_CLOSE:
|
---|
563 | case WM_CONTROL:
|
---|
564 | case UM_COMMAND:
|
---|
565 | case WM_COMMAND:
|
---|
566 | return WinSendMsg(WinWindowFromID(hwnd, TREE_CNR), msg, mp1, mp2);
|
---|
567 |
|
---|
568 | case WM_PSETFOCUS:
|
---|
569 | case WM_SETFOCUS:
|
---|
570 | if (mp2)
|
---|
571 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
572 | break;
|
---|
573 |
|
---|
574 | case UM_FOCUSME:
|
---|
575 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, TREE_CNR));
|
---|
576 | break;
|
---|
577 |
|
---|
578 | case WM_ERASEBACKGROUND:
|
---|
579 | WinFillRect((HPS) mp1, (PRECTL) mp2, 0x00d0d0d0);
|
---|
580 | return 0;
|
---|
581 |
|
---|
582 | case WM_PAINT:
|
---|
583 | {
|
---|
584 | HPS hps;
|
---|
585 | RECTL rcl;
|
---|
586 |
|
---|
587 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
---|
588 | if (hps) {
|
---|
589 | WinQueryWindowRect(hwnd, &rcl);
|
---|
590 | WinFillRect(hps, &rcl, CLR_PALEGRAY);
|
---|
591 | PaintRecessedWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
592 | MAIN_STATUS), hps, FALSE, FALSE);
|
---|
593 | WinEndPaint(hps);
|
---|
594 | }
|
---|
595 | }
|
---|
596 | break;
|
---|
597 |
|
---|
598 | case WM_SIZE:
|
---|
599 | WinSetWindowPos(WinWindowFromID(hwnd, TREE_CNR),
|
---|
600 | HWND_TOP,
|
---|
601 | 0,
|
---|
602 | 0,
|
---|
603 | SHORT1FROMMP(mp2),
|
---|
604 | SHORT2FROMMP(mp2), SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
605 | if (hwndMain)
|
---|
606 | PostMsg(hwndMain, UM_SIZE, MPVOID, MPVOID);
|
---|
607 | break;
|
---|
608 |
|
---|
609 | case WM_CONTEXTMENU:
|
---|
610 | case UM_CONTEXTMENU:
|
---|
611 | PostMsg(WinWindowFromID(hwnd, TREE_CNR),
|
---|
612 | WM_CONTROL, MPFROM2SHORT(TREE_CNR, CN_CONTEXTMENU), MPVOID);
|
---|
613 | return 0;
|
---|
614 | }
|
---|
615 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
616 | }
|
---|
617 |
|
---|
618 | MRESULT EXPENTRY TreeObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
619 | {
|
---|
620 | DIRCNRDATA *dcd;
|
---|
621 |
|
---|
622 | switch (msg) {
|
---|
623 | case WM_CREATE:
|
---|
624 | DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2); // 18 Jul 08 SHL fixme
|
---|
625 | break;
|
---|
626 |
|
---|
627 | case UM_SHOWME:
|
---|
628 | // DbgMsg(pszSrcFile, __LINE__, "UM_SHOWME mp1 %p mp2 %p", mp1, mp2); // 14 Aug 07 SHL fixme
|
---|
629 | if (mp1) {
|
---|
630 | # ifdef FORTIFY
|
---|
631 | Fortify_BecomeOwner(mp1);
|
---|
632 | # endif
|
---|
633 | dcd = INSTDATA(hwnd);
|
---|
634 | // DbgMsg(pszSrcFile, __LINE__, "UM_SHOWME dcd %p", dcd); // 14 Aug 07 SHL fixme
|
---|
635 | if (dcd) {
|
---|
636 | BOOL tempsusp, tempfollow, temptop;
|
---|
637 |
|
---|
638 | tempsusp = dcd->suspendview;
|
---|
639 | dcd->suspendview = TRUE;
|
---|
640 | tempfollow = fFollowTree;
|
---|
641 | fFollowTree = FALSE;
|
---|
642 | if (mp2) {
|
---|
643 | temptop = fTopDir;
|
---|
644 | fTopDir = TRUE;
|
---|
645 | }
|
---|
646 | ShowTreeRec(dcd->hwndCnr, (CHAR *)mp1, fCollapseFirst, TRUE);
|
---|
647 | dcd->suspendview = tempsusp;
|
---|
648 | fFollowTree = tempfollow;
|
---|
649 | if (mp2)
|
---|
650 | fTopDir = temptop;
|
---|
651 | }
|
---|
652 | free((CHAR *)mp1);
|
---|
653 | }
|
---|
654 | return 0;
|
---|
655 |
|
---|
656 | case DM_PRINTOBJECT:
|
---|
657 | return MRFROMLONG(DRR_TARGET);
|
---|
658 |
|
---|
659 | case DM_DISCARDOBJECT:
|
---|
660 | dcd = INSTDATA(hwnd);
|
---|
661 | if (fFM2Deletes && dcd) {
|
---|
662 |
|
---|
663 | LISTINFO *li;
|
---|
664 | CNRDRAGINFO cni;
|
---|
665 |
|
---|
666 | cni.pRecord = NULL;
|
---|
667 | cni.pDragInfo = (PDRAGINFO) mp1;
|
---|
668 | li = DoFileDrop(dcd->hwndCnr,
|
---|
669 | dcd->directory, FALSE, MPVOID, MPFROMP(&cni));
|
---|
670 | CheckPmDrgLimit(cni.pDragInfo);
|
---|
671 | if (li) {
|
---|
672 | li->type = ((fDefaultDeletePerm) ? IDM_PERMDELETE : IDM_DELETE);
|
---|
673 | if (!PostMsg(hwnd, UM_MASSACTION, MPFROMP(li), MPVOID))
|
---|
674 | FreeListInfo(li);
|
---|
675 | else
|
---|
676 | return MRFROMLONG(DRR_SOURCE);
|
---|
677 | }
|
---|
678 | }
|
---|
679 | return MRFROMLONG(DRR_TARGET);
|
---|
680 |
|
---|
681 | case UM_EXPAND:
|
---|
682 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
683 | if (!dcd)
|
---|
684 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
685 | else {
|
---|
686 | BOOL tempsusp = dcd->suspendview;
|
---|
687 |
|
---|
688 | dcd->suspendview = TRUE;
|
---|
689 | ExpandAll(dcd->hwndCnr,
|
---|
690 | (SHORT1FROMMP(mp1) == IDM_EXPAND), (PCNRITEM) mp2);
|
---|
691 | dcd->suspendview = tempsusp;
|
---|
692 | PostMsg(dcd->hwndCnr, UM_FILTER, MPVOID, MPVOID);
|
---|
693 | }
|
---|
694 | return 0;
|
---|
695 |
|
---|
696 | case UM_UPDATERECORDLIST:
|
---|
697 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
698 | if (!dcd || !mp1)
|
---|
699 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
700 | else {
|
---|
701 | INT numentries = 0;
|
---|
702 | CHAR **list = (CHAR **) mp1;
|
---|
703 |
|
---|
704 | while (list[numentries])
|
---|
705 | numentries++;
|
---|
706 | if (numentries) {
|
---|
707 | //DbgMsg(pszSrcFile, __LINE__, "UM_UPDATERECORD %s", *list);
|
---|
708 | UpdateCnrList(dcd->hwndCnr, list, numentries, TRUE, dcd);
|
---|
709 | }
|
---|
710 | }
|
---|
711 | return 0;
|
---|
712 |
|
---|
713 | case UM_SETUP:
|
---|
714 | # ifdef FORTIFY
|
---|
715 | Fortify_EnterScope();
|
---|
716 | # endif
|
---|
717 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
718 | if (!dcd)
|
---|
719 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
720 | else {
|
---|
721 | # ifdef FORTIFY
|
---|
722 | Fortify_BecomeOwner(dcd);
|
---|
723 | # endif
|
---|
724 | dcd->hwndObject = hwnd;
|
---|
725 | if (ParentIsDesktop(hwnd, dcd->hwndParent))
|
---|
726 | DosSleep(100); //05 Aug 07 GKY 250
|
---|
727 | }
|
---|
728 | return 0;
|
---|
729 |
|
---|
730 | case UM_RESCAN2:
|
---|
731 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
732 | if (!dcd)
|
---|
733 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
734 | // Bypass if not running integrated (i.e if vtree)
|
---|
735 | else if (hwndStatus &&
|
---|
736 | dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
|
---|
737 | CHAR s[CCHMAXPATH * 2];
|
---|
738 | PCNRITEM pci = (PCNRITEM) mp1;
|
---|
739 | FSALLOCATE fsa;
|
---|
740 | struct
|
---|
741 | {
|
---|
742 | ULONG serial;
|
---|
743 | CHAR volumelength;
|
---|
744 | CHAR volumelabel[CCHMAXPATH];
|
---|
745 | }
|
---|
746 | volser;
|
---|
747 | CHAR tb[64];
|
---|
748 | CHAR szFree[64];
|
---|
749 | CNRINFO cnri;
|
---|
750 |
|
---|
751 | strcpy(s, GetPString(IDS_TREETEXT));
|
---|
752 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
753 | cnri.cb = sizeof(CNRINFO);
|
---|
754 | WinSendMsg(dcd->hwndCnr,
|
---|
755 | CM_QUERYCNRINFO,
|
---|
756 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
|
---|
757 | if (cnri.cRecords) {
|
---|
758 | sprintf(s, GetPString(IDS_NUMDRIVESTEXT), cnri.cRecords);
|
---|
759 | if (pci && pci->pszFileName) {
|
---|
760 | if (!(driveflags[toupper(*pci->pszFileName) - 'A'] &
|
---|
761 | DRIVE_REMOVABLE) ||
|
---|
762 | driveserial[toupper(*pci->pszFileName) - 'A'] != -1) {
|
---|
763 | memset(&volser, 0, sizeof(volser));
|
---|
764 | DosError(FERR_DISABLEHARDERR);
|
---|
765 | if (!DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
|
---|
766 | FSIL_VOLSER,
|
---|
767 | &volser,
|
---|
768 | (ULONG) sizeof(volser)) &&
|
---|
769 | dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
|
---|
770 | DosError(FERR_DISABLEHARDERR);
|
---|
771 | if (!DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
|
---|
772 | FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {
|
---|
773 | CommaFmtULL(tb, sizeof(tb),
|
---|
774 | (ULONGLONG) fsa.cUnitAvail * (fsa.cSectorUnit *
|
---|
775 | fsa.cbSector), 'M');
|
---|
776 | sprintf(szFree, " %s %s", tb, GetPString(IDS_FREETEXT));
|
---|
777 | }
|
---|
778 | else
|
---|
779 | *szFree = 0;
|
---|
780 | driveserial[toupper(*pci->pszFileName) - 'A'] = volser.serial;
|
---|
781 | sprintf(&s[strlen(s)],
|
---|
782 | GetPString(IDS_TREESTATUSSTARTTEXT),
|
---|
783 | toupper(*pci->pszFileName),
|
---|
784 | volser.volumelabel, volser.serial, szFree);
|
---|
785 | if (!fMoreButtons) {
|
---|
786 | if (*dcd->mask.szMask ||
|
---|
787 | (dcd->mask.attrFile != ALLATTRS ||
|
---|
788 | ((fFilesInTree ||
|
---|
789 | (driveflags[toupper(*pci->pszFileName)] &
|
---|
790 | DRIVE_INCLUDEFILES)) ?
|
---|
791 | dcd->mask.antiattr :
|
---|
792 | (dcd->mask.antiattr &&
|
---|
793 | dcd->mask.antiattr != FILE_DIRECTORY)))) {
|
---|
794 | sprintf(&s[strlen(s)],
|
---|
795 | " (%s)",
|
---|
796 | (*dcd->mask.szMask) ?
|
---|
797 | dcd->mask.szMask : GetPString(IDS_ATTRTEXT));
|
---|
798 | }
|
---|
799 | }
|
---|
800 | }
|
---|
801 | }
|
---|
802 | else {
|
---|
803 | /* find root record and strip it */
|
---|
804 | pci = FindParentRecord(dcd->hwndCnr, pci);
|
---|
805 | driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
|
---|
806 | UnFlesh(dcd->hwndCnr, pci);
|
---|
807 | }
|
---|
808 | }
|
---|
809 | }
|
---|
810 | if (dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent))
|
---|
811 | WinSetWindowText(hwndStatus, s);
|
---|
812 | }
|
---|
813 | return 0;
|
---|
814 |
|
---|
815 | case UM_RESCAN:
|
---|
816 | /*
|
---|
817 | * populate container
|
---|
818 | */
|
---|
819 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
820 | if (!dcd)
|
---|
821 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
822 | else {
|
---|
823 | RemoveCnrItems(dcd->hwndCnr, NULL, 0, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
|
---|
824 | WinSendMsg(dcd->hwndCnr,
|
---|
825 | CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(-1));
|
---|
826 | WinSendMsg(dcd->hwndCnr,
|
---|
827 | CM_SCROLLWINDOW,
|
---|
828 | MPFROMSHORT(CMA_HORIZONTAL), MPFROMLONG(-1));
|
---|
829 | while (StubbyScanCount != 0)
|
---|
830 | DosSleep(50);
|
---|
831 | FillTreeCnr(dcd->hwndCnr, dcd->hwndParent);
|
---|
832 | if (fOkayMinimize) {
|
---|
833 | PostMsg(dcd->hwndCnr, UM_MINIMIZE, MPVOID, MPVOID);
|
---|
834 | fOkayMinimize = FALSE;
|
---|
835 | }
|
---|
836 | WinSendMsg(dcd->hwndCnr,
|
---|
837 | CM_INVALIDATERECORD,
|
---|
838 | MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
|
---|
839 | PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
|
---|
840 | }
|
---|
841 | return 0;
|
---|
842 |
|
---|
843 | case UM_COMMAND:
|
---|
844 | if (mp1) {
|
---|
845 |
|
---|
846 | LISTINFO *li = (LISTINFO *) mp1;
|
---|
847 |
|
---|
848 | switch (li->type) {
|
---|
849 | case IDM_DOITYOURSELF:
|
---|
850 | case IDM_APPENDTOCLIP:
|
---|
851 | case IDM_SAVETOCLIP:
|
---|
852 | case IDM_ARCHIVE:
|
---|
853 | case IDM_VIEW:
|
---|
854 | case IDM_EDIT:
|
---|
855 | case IDM_OBJECT:
|
---|
856 | case IDM_SHADOW:
|
---|
857 | case IDM_SHADOW2:
|
---|
858 | case IDM_PRINT:
|
---|
859 | case IDM_ATTRS:
|
---|
860 | case IDM_DELETE:
|
---|
861 | case IDM_PERMDELETE:
|
---|
862 | if (PostMsg(hwnd, UM_MASSACTION, mp1, mp2))
|
---|
863 | return (MRESULT) TRUE;
|
---|
864 | default:
|
---|
865 | if (PostMsg(hwnd, UM_ACTION, mp1, mp2))
|
---|
866 | return (MRESULT) TRUE;
|
---|
867 | }
|
---|
868 | }
|
---|
869 | return 0;
|
---|
870 |
|
---|
871 | case UM_MASSACTION:
|
---|
872 | if (mp1) {
|
---|
873 |
|
---|
874 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
875 | if (!dcd)
|
---|
876 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
877 | else {
|
---|
878 | WORKER *wk;
|
---|
879 | # ifdef FORTIFY
|
---|
880 | Fortify_EnterScope();
|
---|
881 | # endif
|
---|
882 | wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
|
---|
883 | if (!wk)
|
---|
884 | FreeListInfo((LISTINFO *) mp1);
|
---|
885 | else {
|
---|
886 | wk->size = sizeof(WORKER);
|
---|
887 | wk->hwndCnr = dcd->hwndCnr;
|
---|
888 | wk->hwndParent = dcd->hwndParent;
|
---|
889 | wk->hwndFrame = dcd->hwndFrame;
|
---|
890 | wk->hwndClient = dcd->hwndClient;
|
---|
891 | wk->li = (LISTINFO *) mp1;
|
---|
892 | strcpy(wk->directory, dcd->directory);
|
---|
893 | if (xbeginthread(MassAction,
|
---|
894 | 122880,
|
---|
895 | wk,
|
---|
896 | pszSrcFile,
|
---|
897 | __LINE__) == -1)
|
---|
898 | {
|
---|
899 | free(wk);
|
---|
900 | FreeListInfo((LISTINFO *) mp1);
|
---|
901 | }
|
---|
902 | }
|
---|
903 | # ifdef FORTIFY
|
---|
904 | Fortify_LeaveScope();
|
---|
905 | # endif
|
---|
906 | }
|
---|
907 | }
|
---|
908 | return 0;
|
---|
909 |
|
---|
910 | case UM_ACTION:
|
---|
911 | # ifdef FORTIFY
|
---|
912 | Fortify_EnterScope();
|
---|
913 | # endif
|
---|
914 | if (mp1) {
|
---|
915 | # ifdef FORTIFY
|
---|
916 | Fortify_BecomeOwner(mp1);
|
---|
917 | # endif
|
---|
918 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
919 | if (!dcd)
|
---|
920 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
921 | else {
|
---|
922 | WORKER *wk;
|
---|
923 | wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
|
---|
924 | if (!wk)
|
---|
925 | FreeListInfo((LISTINFO *) mp1);
|
---|
926 | else {
|
---|
927 | wk->size = sizeof(WORKER);
|
---|
928 | wk->hwndCnr = dcd->hwndCnr;
|
---|
929 | wk->hwndParent = dcd->hwndParent;
|
---|
930 | wk->hwndFrame = dcd->hwndFrame;
|
---|
931 | wk->hwndClient = dcd->hwndClient;
|
---|
932 | wk->li = (LISTINFO *) mp1;
|
---|
933 | strcpy(wk->directory, dcd->directory);
|
---|
934 | if (xbeginthread(Action,
|
---|
935 | 122880,
|
---|
936 | wk,
|
---|
937 | pszSrcFile,
|
---|
938 | __LINE__) == -1)
|
---|
939 | {
|
---|
940 | free(wk);
|
---|
941 | FreeListInfo((LISTINFO *) mp1);
|
---|
942 | }
|
---|
943 | }
|
---|
944 | }
|
---|
945 | }
|
---|
946 | # ifdef FORTIFY
|
---|
947 | Fortify_LeaveScope();
|
---|
948 | # endif
|
---|
949 | return 0;
|
---|
950 |
|
---|
951 | case WM_CLOSE:
|
---|
952 | WinDestroyWindow(hwnd);
|
---|
953 | break;
|
---|
954 |
|
---|
955 | case WM_DESTROY:
|
---|
956 | hwndTree = (HWND) 0;
|
---|
957 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
958 | if (dcd) {
|
---|
959 | WinSendMsg(dcd->hwndCnr,
|
---|
960 | UM_CLOSE, MPFROMLONG(dcd->dontclose != FALSE), MPVOID);
|
---|
961 | free(dcd);
|
---|
962 | # ifdef FORTIFY
|
---|
963 | Fortify_LeaveScope();
|
---|
964 | # endif
|
---|
965 | WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL);
|
---|
966 | }
|
---|
967 | DosPostEventSem(CompactSem);
|
---|
968 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
969 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
---|
970 | break;
|
---|
971 | }
|
---|
972 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
973 | }
|
---|
974 |
|
---|
975 | MRESULT EXPENTRY TreeCnrWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
976 | {
|
---|
977 | static APPNOTIFY *apphead = NULL, *apptail = NULL;
|
---|
978 | DIRCNRDATA *dcd = INSTDATA(hwnd);
|
---|
979 |
|
---|
980 | switch (msg) {
|
---|
981 | case WM_CREATE:
|
---|
982 | DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2); // 18 Jul 08 SHL fixme
|
---|
983 | break;
|
---|
984 |
|
---|
985 | case DM_PRINTOBJECT:
|
---|
986 | return MRFROMLONG(DRR_TARGET);
|
---|
987 |
|
---|
988 | case DM_DISCARDOBJECT:
|
---|
989 | if (dcd)
|
---|
990 | return WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
|
---|
991 | else
|
---|
992 | return MRFROMLONG(DRR_TARGET);
|
---|
993 |
|
---|
994 | case WM_CHAR:
|
---|
995 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
996 | if (SHORT1FROMMP(mp1) & KC_KEYUP)
|
---|
997 | return (MRESULT) TRUE;
|
---|
998 | if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
|
---|
999 | switch (SHORT2FROMMP(mp2)) {
|
---|
1000 | case VK_INSERT:
|
---|
1001 | if ((shiftstate & KC_CTRL) == KC_CTRL)
|
---|
1002 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_MKDIR, 0), MPVOID);
|
---|
1003 | break;
|
---|
1004 | case VK_DELETE:
|
---|
1005 | if ((shiftstate & KC_CTRL) == KC_CTRL)
|
---|
1006 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PERMDELETE, 0), MPVOID);
|
---|
1007 | else if ((shiftstate & KC_SHIFT) == KC_SHIFT)
|
---|
1008 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SAVETOCLIP, 0), MPVOID);
|
---|
1009 | else
|
---|
1010 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID);
|
---|
1011 | break;
|
---|
1012 | }
|
---|
1013 | }
|
---|
1014 | if (shiftstate || fNoSearch)
|
---|
1015 | break;
|
---|
1016 | if (SHORT1FROMMP(mp1) & KC_CHAR) {
|
---|
1017 |
|
---|
1018 | ULONG thistime, len;
|
---|
1019 | SEARCHSTRING srch;
|
---|
1020 | PCNRITEM pci;
|
---|
1021 |
|
---|
1022 | if (!dcd)
|
---|
1023 | break;
|
---|
1024 | switch (SHORT1FROMMP(mp2)) {
|
---|
1025 | case '\x1b':
|
---|
1026 | case '\r':
|
---|
1027 | case '\n':
|
---|
1028 | dcd->lasttime = 0;
|
---|
1029 | *dcd->szCommonName = 0;
|
---|
1030 | break;
|
---|
1031 | default:
|
---|
1032 | thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd));
|
---|
1033 | if (thistime > dcd->lasttime + 1250)
|
---|
1034 | *dcd->szCommonName = 0;
|
---|
1035 | dcd->lasttime = thistime;
|
---|
1036 | if (SHORT1FROMMP(mp2) == ' ' && !*dcd->szCommonName)
|
---|
1037 | break;
|
---|
1038 | KbdRetry:
|
---|
1039 | len = strlen(dcd->szCommonName);
|
---|
1040 | if (len >= CCHMAXPATH - 1) {
|
---|
1041 | *dcd->szCommonName = 0;
|
---|
1042 | len = 0;
|
---|
1043 | }
|
---|
1044 | dcd->szCommonName[len] = toupper(SHORT1FROMMP(mp2));
|
---|
1045 | dcd->szCommonName[len + 1] = 0;
|
---|
1046 | memset(&srch, 0, sizeof(SEARCHSTRING));
|
---|
1047 | srch.cb = (ULONG) sizeof(SEARCHSTRING);
|
---|
1048 | srch.pszSearch = (PSZ) dcd->szCommonName;
|
---|
1049 | srch.fsPrefix = TRUE;
|
---|
1050 | srch.fsCaseSensitive = FALSE;
|
---|
1051 | srch.usView = CV_ICON;
|
---|
1052 | pci = WinSendMsg(hwnd,
|
---|
1053 | CM_SEARCHSTRING,
|
---|
1054 | MPFROMP(&srch), MPFROMLONG(CMA_FIRST));
|
---|
1055 | if (pci && (INT) pci != -1) {
|
---|
1056 | /* make found item current item */
|
---|
1057 | WinSendMsg(hwnd,
|
---|
1058 | CM_SETRECORDEMPHASIS,
|
---|
1059 | MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_CURSORED));
|
---|
1060 | /* make sure that record shows in viewport */
|
---|
1061 | ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
|
---|
1062 | return (MRESULT) TRUE;
|
---|
1063 | }
|
---|
1064 | else {
|
---|
1065 | if (SHORT1FROMMP(mp2) == ' ') {
|
---|
1066 | dcd->szCommonName[len] = 0;
|
---|
1067 | break;
|
---|
1068 | }
|
---|
1069 | *dcd->szCommonName = 0;
|
---|
1070 | dcd->lasttime = 0;
|
---|
1071 | if (len) // retry as first letter if no match
|
---|
1072 | goto KbdRetry;
|
---|
1073 | }
|
---|
1074 | break;
|
---|
1075 | }
|
---|
1076 | }
|
---|
1077 | break;
|
---|
1078 |
|
---|
1079 | case WM_MOUSEMOVE:
|
---|
1080 | case WM_BUTTON1UP:
|
---|
1081 | case WM_BUTTON2UP:
|
---|
1082 | case WM_BUTTON3UP:
|
---|
1083 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
1084 | break;
|
---|
1085 |
|
---|
1086 | case UM_TIMER:
|
---|
1087 | if (dcd && dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent) &&
|
---|
1088 | hwndStatus2) {
|
---|
1089 | FILEFINDBUF3L ffb;
|
---|
1090 | ULONG nm = 1;
|
---|
1091 | HDIR hdir = HDIR_CREATE;
|
---|
1092 |
|
---|
1093 | if (*SwapperDat) {
|
---|
1094 | if (!xDosFindFirst(SwapperDat,
|
---|
1095 | &hdir,
|
---|
1096 | FILE_NORMAL | FILE_HIDDEN |
|
---|
1097 | FILE_SYSTEM | FILE_ARCHIVED | FILE_READONLY,
|
---|
1098 | &ffb, sizeof(ffb), &nm, FIL_STANDARDL)) {
|
---|
1099 | CHAR tb[39], tm[39], tpm[39], s[163];
|
---|
1100 | ULONG amem;
|
---|
1101 |
|
---|
1102 | priority_bumped();
|
---|
1103 | DosFindClose(hdir);
|
---|
1104 | if (!DosQuerySysInfo(QSV_TOTAVAILMEM,
|
---|
1105 | QSV_TOTAVAILMEM,
|
---|
1106 | (PVOID) & amem, sizeof(amem))) {
|
---|
1107 | CommaFmtULL(tpm, sizeof(tpm), amem, 'M');
|
---|
1108 | }
|
---|
1109 | else
|
---|
1110 | *tpm = 0;
|
---|
1111 | if (!Dos16MemAvail(&amem))
|
---|
1112 | CommaFmtULL(tm, sizeof(tm), amem, 'M');
|
---|
1113 | else
|
---|
1114 | *tm = 0;
|
---|
1115 | CommaFmtULL(tb, sizeof(tb), ffb.cbFile, 'M');
|
---|
1116 | sprintf(s, " %s %s%s%s%s%s",
|
---|
1117 | GetPString(IDS_SWAPFILETEXT),
|
---|
1118 | tb,
|
---|
1119 | *tm ? GetPString(IDS_TREEMEMTEXT) : NullStr,
|
---|
1120 | tm, *tpm ? "/" : NullStr, tpm);
|
---|
1121 | WinSetWindowText(hwndStatus2, s);
|
---|
1122 | }
|
---|
1123 | else
|
---|
1124 | WinSetWindowText(hwndStatus2, NullStr);
|
---|
1125 | }
|
---|
1126 | else
|
---|
1127 | WinSetWindowText(hwndStatus2, NullStr);
|
---|
1128 | }
|
---|
1129 | if (msg == UM_TIMER)
|
---|
1130 | return 0;
|
---|
1131 | break;
|
---|
1132 |
|
---|
1133 | case WM_PRESPARAMCHANGED:
|
---|
1134 | PresParamChanged(hwnd, "TreeCnr", mp1, mp2);
|
---|
1135 | break;
|
---|
1136 |
|
---|
1137 | case UM_FILESMENU:
|
---|
1138 | {
|
---|
1139 | PCNRITEM pci;
|
---|
1140 | HWND menuHwnd = (HWND) 0;
|
---|
1141 | FSALLOCATE fsa;
|
---|
1142 |
|
---|
1143 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
1144 | if (pci && (INT) pci != -1) {
|
---|
1145 | if (IsRoot(pci->pszFileName) || !DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
|
---|
1146 | FSIL_ALLOC, &fsa,
|
---|
1147 | sizeof(FSALLOCATE)))
|
---|
1148 | menuHwnd = CheckMenu(hwndMainMenu, &TreeMenu, TREE_POPUP);
|
---|
1149 | else {
|
---|
1150 | menuHwnd = CheckMenu(hwndMainMenu, &DirMenu, DIR_POPUP);
|
---|
1151 | // WinEnableMenuItem(DirMenu,
|
---|
1152 | // IDM_TREE,
|
---|
1153 | // FALSE);
|
---|
1154 | }
|
---|
1155 | if (!(pci->attrFile & FILE_DIRECTORY))
|
---|
1156 | menuHwnd = CheckMenu(hwndMainMenu, &FileMenu, FILE_POPUP);
|
---|
1157 | }
|
---|
1158 | return MRFROMLONG(menuHwnd);
|
---|
1159 | }
|
---|
1160 |
|
---|
1161 | case UM_COMPARE:
|
---|
1162 | if (dcd && mp1 && mp2) {
|
---|
1163 |
|
---|
1164 | COMPARE *cmp;
|
---|
1165 | CHAR *leftdir = (CHAR *)mp1, *rightdir = (CHAR *)mp2;
|
---|
1166 |
|
---|
1167 | if (!IsFile(leftdir) && !IsFile(rightdir)) {
|
---|
1168 | cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
|
---|
1169 | if (cmp) {
|
---|
1170 | cmp->size = sizeof(COMPARE);
|
---|
1171 | strcpy(cmp->leftdir, leftdir);
|
---|
1172 | strcpy(cmp->rightdir, rightdir);
|
---|
1173 | cmp->hwndParent = dcd->hwndParent;
|
---|
1174 | cmp->dcd.hwndParent = dcd->hwndParent;
|
---|
1175 | WinDlgBox(HWND_DESKTOP,
|
---|
1176 | HWND_DESKTOP,
|
---|
1177 | CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
|
---|
1178 | }
|
---|
1179 | }
|
---|
1180 | }
|
---|
1181 | return 0;
|
---|
1182 |
|
---|
1183 | case UM_UPDATERECORDLIST:
|
---|
1184 | if (dcd && mp1)
|
---|
1185 | WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
|
---|
1186 | return 0;
|
---|
1187 |
|
---|
1188 | case UM_UPDATERECORD:
|
---|
1189 | if (dcd && mp1) {
|
---|
1190 |
|
---|
1191 | CHAR *filename;
|
---|
1192 |
|
---|
1193 | filename = mp1;
|
---|
1194 | if (filename) {
|
---|
1195 | //DbgMsg(pszSrcFile, __LINE__, "UM_UPDATERECORD %s", filename);
|
---|
1196 | UpdateCnrRecord(hwnd, filename, TRUE, dcd);
|
---|
1197 | }
|
---|
1198 | }
|
---|
1199 | return 0;
|
---|
1200 |
|
---|
1201 | case WM_SETFOCUS:
|
---|
1202 | if (dcd && hwndStatus && mp2) {
|
---|
1203 | WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
1204 | if (hwndMain)
|
---|
1205 | PostMsg(hwndMain, UM_ADVISEFOCUS, MPFROMLONG(dcd->hwndFrame), MPVOID);
|
---|
1206 | }
|
---|
1207 | break;
|
---|
1208 |
|
---|
1209 | case UM_RESCAN:
|
---|
1210 | if (dcd && dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
|
---|
1211 | /*
|
---|
1212 | * put name of our window on status line
|
---|
1213 | */
|
---|
1214 |
|
---|
1215 | PCNRITEM pci = NULL;
|
---|
1216 | CHAR str[CCHMAXPATH + 6];
|
---|
1217 |
|
---|
1218 | if (fAutoView && hwndMain) {
|
---|
1219 | pci = WinSendMsg(hwnd,
|
---|
1220 | CM_QUERYRECORDEMPHASIS,
|
---|
1221 | MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
|
---|
1222 | if (pci && (INT) pci != -1 && fComments &&
|
---|
1223 | !(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW))
|
---|
1224 | WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
|
---|
1225 | else
|
---|
1226 | WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
|
---|
1227 | }
|
---|
1228 | if (!fAutoView || !hwndMain)
|
---|
1229 | pci = (PCNRITEM) WinSendMsg(hwnd,
|
---|
1230 | CM_QUERYRECORDEMPHASIS,
|
---|
1231 | MPFROMLONG(CMA_FIRST),
|
---|
1232 | MPFROMSHORT(CRA_CURSORED));
|
---|
1233 | if ((INT) pci == -1)
|
---|
1234 | pci = NULL;
|
---|
1235 | if (pci) {
|
---|
1236 | if (*(ULONG *) realappname == FM3UL) {
|
---|
1237 | sprintf(str, "%s %s", GetPString(IDS_DTTEXT), pci->pszFileName);
|
---|
1238 | WinSetWindowText(dcd->hwndFrame, str);
|
---|
1239 | WinSetWindowText(WinWindowFromID(dcd->hwndFrame, FID_TITLEBAR),
|
---|
1240 | str);
|
---|
1241 | }
|
---|
1242 | else
|
---|
1243 | WinSetWindowText(WinWindowFromID(dcd->hwndFrame,
|
---|
1244 | MAIN_STATUS), pci->pszFileName);
|
---|
1245 | if (fMoreButtons && hwndName) {
|
---|
1246 | WinSetWindowText(hwndName, pci->pszFileName);
|
---|
1247 | sprintf(str,
|
---|
1248 | "%04u/%02u/%02u %02u:%02u:%02u",
|
---|
1249 | pci->date.year,
|
---|
1250 | pci->date.month,
|
---|
1251 | pci->date.day,
|
---|
1252 | pci->time.hours, pci->time.minutes, pci->time.seconds);
|
---|
1253 | WinSetWindowText(hwndDate, str);
|
---|
1254 | WinSetWindowText(hwndAttr, pci->pszDispAttr);
|
---|
1255 | }
|
---|
1256 | }
|
---|
1257 | PostMsg(dcd->hwndObject, UM_RESCAN2, MPFROMP(pci), MPVOID);
|
---|
1258 | if (hwndStatus2)
|
---|
1259 | PostMsg(hwnd, UM_TIMER, MPVOID, MPVOID);
|
---|
1260 | }
|
---|
1261 | return 0;
|
---|
1262 |
|
---|
1263 | case UM_SETUP2:
|
---|
1264 | {
|
---|
1265 | PCNRITEM pci = (PCNRITEM) mp1;
|
---|
1266 |
|
---|
1267 | if (pci)
|
---|
1268 | NotifyError(pci->pszFileName, (ULONG) mp2);
|
---|
1269 | }
|
---|
1270 | return 0;
|
---|
1271 |
|
---|
1272 | case UM_SETUP:
|
---|
1273 | # ifdef FORTIFY
|
---|
1274 | // Balance WM_DESTROY
|
---|
1275 | Fortify_EnterScope();
|
---|
1276 | # endif
|
---|
1277 |
|
---|
1278 | if (!dcd) {
|
---|
1279 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
1280 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
1281 | return 0;
|
---|
1282 | }
|
---|
1283 | else {
|
---|
1284 | if (!dcd->hwndObject) {
|
---|
1285 | /*
|
---|
1286 | * first time through -- set things up
|
---|
1287 | */
|
---|
1288 | CNRINFO cnri;
|
---|
1289 |
|
---|
1290 | # ifdef FORTIFY
|
---|
1291 | Fortify_EnterScope();
|
---|
1292 | # endif
|
---|
1293 |
|
---|
1294 | RestorePresParams(hwnd, "TreeCnr");
|
---|
1295 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
1296 | cnri.cb = sizeof(CNRINFO);
|
---|
1297 | WinSendMsg(hwnd,
|
---|
1298 | CM_QUERYCNRINFO,
|
---|
1299 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
|
---|
1300 | cnri.cyLineSpacing = 0;
|
---|
1301 | cnri.cxTreeIndent = 12;
|
---|
1302 | cnri.pSortRecord = (PVOID) SortTreeCnr;
|
---|
1303 | cnri.flWindowAttr &= (~(CV_NAME | CV_DETAIL | CV_TEXT));
|
---|
1304 | cnri.flWindowAttr |= (CV_TREE | CA_TREELINE | CV_ICON | CV_MINI);
|
---|
1305 | {
|
---|
1306 | ULONG size = sizeof(ULONG);
|
---|
1307 |
|
---|
1308 | PrfQueryProfileData(fmprof,
|
---|
1309 | appname,
|
---|
1310 | "TreeflWindowAttr",
|
---|
1311 | (PVOID) & cnri.flWindowAttr, &size);
|
---|
1312 | size = sizeof(MASK);
|
---|
1313 | *dcd->mask.prompt = 0;
|
---|
1314 | if (!*dcd->mask.szMask && !dcd->mask.attrFile) {
|
---|
1315 | if (PrfQueryProfileSize(fmprof,
|
---|
1316 | appname, "TreeFilter", &size) && size) {
|
---|
1317 | PrfQueryProfileData(fmprof,
|
---|
1318 | appname, "TreeFilter", &dcd->mask, &size);
|
---|
1319 | SetMask(NULL, &dcd->mask);
|
---|
1320 | }
|
---|
1321 | else
|
---|
1322 | dcd->mask.attrFile = (FILE_READONLY | FILE_NORMAL |
|
---|
1323 | FILE_ARCHIVED | FILE_DIRECTORY |
|
---|
1324 | FILE_HIDDEN | FILE_SYSTEM);
|
---|
1325 | }
|
---|
1326 | dcd->mask.attrFile |= FILE_DIRECTORY;
|
---|
1327 | }
|
---|
1328 | cnri.flWindowAttr &= (~(CA_MIXEDTARGETEMPH | CA_ORDEREDTARGETEMPH));
|
---|
1329 | cnri.flWindowAttr |= CV_FLOW;
|
---|
1330 | dcd->flWindowAttr = cnri.flWindowAttr;
|
---|
1331 | WinSendMsg(hwnd,
|
---|
1332 | CM_SETCNRINFO,
|
---|
1333 | MPFROMP(&cnri),
|
---|
1334 | MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING |
|
---|
1335 | CMA_CXTREEINDENT | CMA_PSORTRECORD));
|
---|
1336 | if (xbeginthread(MakeObjWin,
|
---|
1337 | 327680,
|
---|
1338 | dcd,
|
---|
1339 | pszSrcFile,
|
---|
1340 | __LINE__) == -1)
|
---|
1341 | {
|
---|
1342 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
1343 | }
|
---|
1344 | else
|
---|
1345 | DosSleep(1);
|
---|
1346 | # ifdef FORTIFY
|
---|
1347 | Fortify_LeaveScope();
|
---|
1348 | # endif
|
---|
1349 | }
|
---|
1350 | }
|
---|
1351 | return 0;
|
---|
1352 |
|
---|
1353 | case WM_BUTTON3CLICK:
|
---|
1354 | case WM_CHORD:
|
---|
1355 | {
|
---|
1356 | PCNRITEM pci = NULL;
|
---|
1357 | QUERYRECFROMRECT pqr;
|
---|
1358 | NOTIFYRECORDENTER nr;
|
---|
1359 | BOOL tbool = fDCOpens;
|
---|
1360 | RECTL rectl;
|
---|
1361 | POINTL ptl;
|
---|
1362 |
|
---|
1363 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
1364 | if (msg == WM_CHORD) {
|
---|
1365 | if (!WinQueryPointerPos(HWND_DESKTOP, &ptl))
|
---|
1366 | break;
|
---|
1367 | WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);
|
---|
1368 | }
|
---|
1369 | else {
|
---|
1370 | ptl.x = SHORT1FROMMP(mp1);
|
---|
1371 | ptl.y = SHORT2FROMMP(mp1);
|
---|
1372 | }
|
---|
1373 | memset(&rectl, 0, sizeof(rectl));
|
---|
1374 | memset(&pqr, 0, sizeof(pqr));
|
---|
1375 | pqr.cb = sizeof(pqr);
|
---|
1376 | pqr.rect.xLeft = ptl.x - 1;
|
---|
1377 | pqr.rect.xRight = ptl.x + 1;
|
---|
1378 | pqr.rect.yTop = ptl.y + 1;
|
---|
1379 | pqr.rect.yBottom = ptl.y - 1;
|
---|
1380 | pqr.fsSearch = CMA_PARTIAL;
|
---|
1381 | pci = (PCNRITEM) WinSendMsg(hwnd,
|
---|
1382 | CM_QUERYRECORDFROMRECT,
|
---|
1383 | MPFROMLONG(CMA_FIRST), MPFROMP(&pqr));
|
---|
1384 | if (!pci || (INT) pci == -1)
|
---|
1385 | break; //Probable B3 click on white space Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
1386 | else {
|
---|
1387 | memset(&nr, 0, sizeof(nr));
|
---|
1388 | nr.hwndCnr = hwnd;
|
---|
1389 | nr.pRecord = (PRECORDCORE) pci;
|
---|
1390 | fDCOpens = TRUE;
|
---|
1391 | WinSendMsg(hwnd,
|
---|
1392 | WM_CONTROL,
|
---|
1393 | MPFROM2SHORT(WinQueryWindowUShort(hwnd,
|
---|
1394 | QWS_ID),
|
---|
1395 | CN_ENTER), MPFROMP(&nr));
|
---|
1396 | PostMsg(hwnd, UM_RESTOREDC, MPFROMLONG(tbool), MPVOID);
|
---|
1397 | }
|
---|
1398 | }
|
---|
1399 | break;
|
---|
1400 |
|
---|
1401 | case UM_RESTOREDC:
|
---|
1402 | fDCOpens = (BOOL) mp1;
|
---|
1403 | return 0;
|
---|
1404 |
|
---|
1405 | case WM_CONTROL:
|
---|
1406 | DosError(FERR_DISABLEHARDERR);
|
---|
1407 | if (dcd) {
|
---|
1408 | switch (SHORT2FROMMP(mp1)) {
|
---|
1409 | case CN_BEGINEDIT:
|
---|
1410 | case CN_REALLOCPSZ:
|
---|
1411 | case CN_ENDEDIT:
|
---|
1412 | {
|
---|
1413 | MRESULT mre;
|
---|
1414 |
|
---|
1415 | mre = CnrDirectEdit(hwnd, msg, mp1, mp2);
|
---|
1416 | if (mre != (MRESULT) - 1)
|
---|
1417 | return mre;
|
---|
1418 | }
|
---|
1419 | break;
|
---|
1420 |
|
---|
1421 | case CN_DRAGLEAVE:
|
---|
1422 | if (mp2) {
|
---|
1423 |
|
---|
1424 | PDRAGINFO pDInfo;
|
---|
1425 |
|
---|
1426 | // fixme to know why - seems superfluous
|
---|
1427 | pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
|
---|
1428 | DrgAccessDraginfo(pDInfo);
|
---|
1429 | DrgFreeDraginfo(pDInfo);
|
---|
1430 | }
|
---|
1431 | return 0;
|
---|
1432 |
|
---|
1433 | case CN_DROPHELP:
|
---|
1434 | if (mp2) {
|
---|
1435 |
|
---|
1436 | PDRAGINFO pDInfo;
|
---|
1437 | PCNRITEM pci;
|
---|
1438 | ULONG numitems;
|
---|
1439 | USHORT usOperation;
|
---|
1440 |
|
---|
1441 | pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
|
---|
1442 | pDInfo = (PDRAGINFO) ((PCNRDRAGINFO) mp2)->pDragInfo;
|
---|
1443 | if (!DrgAccessDraginfo(pDInfo)) {
|
---|
1444 | Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
|
---|
1445 | GetPString(IDS_DROPERRORTEXT));
|
---|
1446 | }
|
---|
1447 | else {
|
---|
1448 | numitems = DrgQueryDragitemCount(pDInfo);
|
---|
1449 | usOperation = pDInfo->usOperation;
|
---|
1450 | if (usOperation == DO_DEFAULT)
|
---|
1451 | usOperation = fCopyDefault ? DO_COPY : DO_MOVE;
|
---|
1452 | FreeDragInfoData(hwnd, pDInfo);
|
---|
1453 | saymsg(MB_ENTER | MB_ICONASTERISK,
|
---|
1454 | hwnd,
|
---|
1455 | GetPString(IDS_DROPHELPHDRTEXT),
|
---|
1456 | GetPString(IDS_DROPHELPTEXT),
|
---|
1457 | numitems,
|
---|
1458 | &"s"[numitems == 1L],
|
---|
1459 | pci ? NullStr : GetPString(IDS_NOTEXT),
|
---|
1460 | pci ? NullStr : " ",
|
---|
1461 | pci ? pci->pszFileName : NullStr,
|
---|
1462 | pci ? " " : NullStr,
|
---|
1463 | GetPString((usOperation == DO_MOVE) ?
|
---|
1464 | IDS_MOVETEXT :
|
---|
1465 | (usOperation == DO_LINK) ?
|
---|
1466 | IDS_LINKTEXT : IDS_COPYTEXT));
|
---|
1467 | }
|
---|
1468 | }
|
---|
1469 | return 0;
|
---|
1470 |
|
---|
1471 | case CN_DRAGAFTER:
|
---|
1472 | case CN_DRAGOVER:
|
---|
1473 | if (mp2) {
|
---|
1474 |
|
---|
1475 | PDRAGITEM pDItem;
|
---|
1476 | PDRAGINFO pDInfo;
|
---|
1477 | PCNRITEM pci;
|
---|
1478 | USHORT uso;
|
---|
1479 |
|
---|
1480 | pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
|
---|
1481 | if (!DrgAccessDraginfo(pDInfo)) {
|
---|
1482 | Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
|
---|
1483 | "DrgAccessDraginfo");
|
---|
1484 | return (MRFROM2SHORT(DOR_NODROP, 0)); /* Drop not valid */
|
---|
1485 | }
|
---|
1486 | pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
|
---|
1487 | if ((INT) pci == -1)
|
---|
1488 | pci = NULL;
|
---|
1489 | if (pci && (pci->flags & (RECFLAGS_ENV | RECFLAGS_NODROP))) {
|
---|
1490 | DrgFreeDraginfo(pDInfo);
|
---|
1491 | return MRFROM2SHORT(DOR_NODROP, 0);
|
---|
1492 | }
|
---|
1493 | if (!WinIsWindowEnabled(dcd->hwndFrame)) {
|
---|
1494 | DrgFreeDraginfo(pDInfo);
|
---|
1495 | return MRFROM2SHORT(DOR_NODROP, 0);
|
---|
1496 | }
|
---|
1497 | if (pci) {
|
---|
1498 | uso = pDInfo->usOperation;
|
---|
1499 | if (uso == DO_DEFAULT)
|
---|
1500 | uso = (fCopyDefault) ? DO_COPY : DO_MOVE;
|
---|
1501 | if (!(pci->attrFile & FILE_DIRECTORY)) {
|
---|
1502 | if (uso != DO_LINK && uso != DO_COPY && uso != DO_MOVE) {
|
---|
1503 | DrgFreeDraginfo(pDInfo);
|
---|
1504 | return (MRFROM2SHORT(DOR_NODROP, 0));
|
---|
1505 | }
|
---|
1506 | if (uso != DO_LINK &&
|
---|
1507 | !(driveflags[toupper(*pci->pszFileName) - 'A'] &
|
---|
1508 | DRIVE_NOTWRITEABLE)) {
|
---|
1509 |
|
---|
1510 | ARC_TYPE *info;
|
---|
1511 |
|
---|
1512 | if (!fQuickArcFind &&
|
---|
1513 | !(driveflags[toupper(*pci->pszFileName) - 'A'] &
|
---|
1514 | DRIVE_SLOW))
|
---|
1515 | info = find_type(pci->pszFileName, NULL);
|
---|
1516 | else
|
---|
1517 | info = quick_find_type(pci->pszFileName, NULL);
|
---|
1518 | if (!info || ((uso == DO_MOVE && !info->move) ||
|
---|
1519 | (uso == DO_COPY && !info->create))) {
|
---|
1520 | DrgFreeDraginfo(pDInfo);
|
---|
1521 | return (MRFROM2SHORT(DOR_NODROP, 0));
|
---|
1522 | }
|
---|
1523 | }
|
---|
1524 | }
|
---|
1525 | }
|
---|
1526 | pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
|
---|
1527 | 0); /* Index to DRAGITEM */
|
---|
1528 | if (DrgVerifyRMF(pDItem, /* Check valid rendering */
|
---|
1529 | DRM_OS2FILE, /* mechanisms and data */
|
---|
1530 | NULL) || DrgVerifyRMF(pDItem, DRM_FM2ARCMEMBER, DRF_FM2ARCHIVE)) { /* formats */
|
---|
1531 | DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
|
---|
1532 | if (!pci || (INT) pci == -1)
|
---|
1533 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
---|
1534 | if (driveflags[toupper(*pci->pszFileName) - 'A'] &
|
---|
1535 | DRIVE_NOTWRITEABLE)
|
---|
1536 | return MRFROM2SHORT(DOR_DROP, DO_LINK);
|
---|
1537 | if (toupper(*pci->pszFileName) < 'C')
|
---|
1538 | return MRFROM2SHORT(DOR_DROP, DO_COPY);
|
---|
1539 | return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
|
---|
1540 | ((fCopyDefault) ? DO_COPY : DO_MOVE));
|
---|
1541 | }
|
---|
1542 | DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
|
---|
1543 | }
|
---|
1544 | return MRFROM2SHORT(DOR_NODROP, 0); /* Drop not valid */
|
---|
1545 |
|
---|
1546 | case CN_INITDRAG:
|
---|
1547 | {
|
---|
1548 | PCNRDRAGINIT pcd = (PCNRDRAGINIT) mp2;
|
---|
1549 | PCNRITEM pci;
|
---|
1550 |
|
---|
1551 | if (!pcd) {
|
---|
1552 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
1553 | break;
|
---|
1554 | }
|
---|
1555 | else {
|
---|
1556 | pci = (PCNRITEM) pcd->pRecord;
|
---|
1557 | if (!pci || (INT) pci == -1) {
|
---|
1558 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
1559 | break;
|
---|
1560 | }
|
---|
1561 | if (pci->flags & (RECFLAGS_ENV | RECFLAGS_NODRAG)) {
|
---|
1562 | Runtime_Error(pszSrcFile, __LINE__, "drag not allowed");
|
---|
1563 | break;
|
---|
1564 | }
|
---|
1565 | if (hwndStatus2) {
|
---|
1566 | WinSetWindowText(hwndStatus2, (IsRoot(pci->pszFileName)) ?
|
---|
1567 | GetPString(IDS_DRAGROOTTEXT) :
|
---|
1568 | (pci->attrFile & FILE_DIRECTORY) ?
|
---|
1569 | GetPString(IDS_DRAGDIRTEXT) :
|
---|
1570 | GetPString(IDS_DRAGFILETEXT));
|
---|
1571 | }
|
---|
1572 | DoFileDrag(hwnd, dcd->hwndObject, mp2, NULL, NULL, TRUE);
|
---|
1573 | if (hwndStatus2) {
|
---|
1574 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
1575 | }
|
---|
1576 | }
|
---|
1577 | }
|
---|
1578 | return 0;
|
---|
1579 |
|
---|
1580 | case CN_DROP:
|
---|
1581 | {
|
---|
1582 | LISTINFO *li;
|
---|
1583 | ULONG action = UM_ACTION;
|
---|
1584 |
|
---|
1585 | li = DoFileDrop(hwnd, NULL, TRUE, mp1, mp2);
|
---|
1586 | CheckPmDrgLimit(((PCNRDRAGINFO)mp2)->pDragInfo);
|
---|
1587 | if (li) {
|
---|
1588 | if (!*li->targetpath) {
|
---|
1589 | if (li->list[0])
|
---|
1590 | PMMkDir(dcd->hwndParent, li->list[0], FALSE);
|
---|
1591 | FreeListInfo(li);
|
---|
1592 | return 0;
|
---|
1593 | }
|
---|
1594 | if (li->list && li->list[0] && IsRoot(li->list[0]))
|
---|
1595 | li->type = DO_LINK;
|
---|
1596 | else if (fDragndropDlg && (!*li->arcname || !li->info)) {
|
---|
1597 |
|
---|
1598 | CHECKLIST cl;
|
---|
1599 |
|
---|
1600 | memset(&cl, 0, sizeof(cl));
|
---|
1601 | cl.size = sizeof(cl);
|
---|
1602 | cl.flags = li->type;
|
---|
1603 | cl.list = li->list;
|
---|
1604 | cl.cmd = li->type;
|
---|
1605 | cl.prompt = li->targetpath;
|
---|
1606 | li->type = WinDlgBox(HWND_DESKTOP,
|
---|
1607 | dcd->hwndParent,
|
---|
1608 | DropListProc,
|
---|
1609 | FM3ModHandle, DND_FRAME, MPFROMP(&cl));
|
---|
1610 | if (li->type == DID_ERROR)
|
---|
1611 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
1612 | "Drag & Drop Dialog");
|
---|
1613 | if (!li->type) {
|
---|
1614 | FreeListInfo(li);
|
---|
1615 | return 0;
|
---|
1616 | }
|
---|
1617 | li->list = cl.list;
|
---|
1618 | if (!li->list || !li->list[0]) {
|
---|
1619 | FreeListInfo(li);
|
---|
1620 | return 0;
|
---|
1621 | }
|
---|
1622 | }
|
---|
1623 | switch (li->type) {
|
---|
1624 | case DO_LINK:
|
---|
1625 | if (fLinkSetsIcon) {
|
---|
1626 | li->type = IDM_SETICON;
|
---|
1627 | action = UM_MASSACTION;
|
---|
1628 | }
|
---|
1629 | else
|
---|
1630 | li->type = IDM_COMPARE;
|
---|
1631 | break;
|
---|
1632 | case DND_EXTRACT:
|
---|
1633 | if (*li->targetpath && !IsFile(li->targetpath))
|
---|
1634 | li->type = IDM_EXTRACT;
|
---|
1635 | break;
|
---|
1636 | case DND_MOVE:
|
---|
1637 | li->type = IDM_MOVE;
|
---|
1638 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
1639 | action = UM_MASSACTION;
|
---|
1640 | li->type = IDM_ARCHIVEM;
|
---|
1641 | }
|
---|
1642 | break;
|
---|
1643 | case DND_WILDMOVE:
|
---|
1644 | li->type = IDM_WILDMOVE;
|
---|
1645 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
1646 | action = UM_MASSACTION;
|
---|
1647 | li->type = IDM_ARCHIVEM;
|
---|
1648 | }
|
---|
1649 | break;
|
---|
1650 | case DND_OBJECT:
|
---|
1651 | li->type = IDM_OBJECT;
|
---|
1652 | action = UM_MASSACTION;
|
---|
1653 | break;
|
---|
1654 | case DND_SHADOW:
|
---|
1655 | li->type = IDM_SHADOW;
|
---|
1656 | action = UM_MASSACTION;
|
---|
1657 | break;
|
---|
1658 | case DND_COMPARE:
|
---|
1659 | li->type = IDM_COMPARE;
|
---|
1660 | break;
|
---|
1661 | case DND_SETICON:
|
---|
1662 | action = UM_MASSACTION;
|
---|
1663 | li->type = IDM_SETICON;
|
---|
1664 | break;
|
---|
1665 | case DND_COPY:
|
---|
1666 | li->type = IDM_COPY;
|
---|
1667 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
1668 | action = UM_MASSACTION;
|
---|
1669 | li->type = IDM_ARCHIVE;
|
---|
1670 | }
|
---|
1671 | break;
|
---|
1672 | case DND_WILDCOPY:
|
---|
1673 | li->type = IDM_WILDCOPY;
|
---|
1674 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
1675 | action = UM_MASSACTION;
|
---|
1676 | li->type = IDM_ARCHIVE;
|
---|
1677 | }
|
---|
1678 | break;
|
---|
1679 | default:
|
---|
1680 | if (*li->arcname && li->info) {
|
---|
1681 | action = UM_MASSACTION;
|
---|
1682 | li->type = (li->type == DO_MOVE) ?
|
---|
1683 | IDM_FAKEEXTRACTM : IDM_FAKEEXTRACT;
|
---|
1684 | }
|
---|
1685 | else if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
1686 | action = UM_MASSACTION;
|
---|
1687 | li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
|
---|
1688 | }
|
---|
1689 | else
|
---|
1690 | li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
|
---|
1691 | break;
|
---|
1692 | }
|
---|
1693 | if (!li->list || !li->list[0])
|
---|
1694 | FreeListInfo(li);
|
---|
1695 | else if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID))
|
---|
1696 | FreeListInfo(li);
|
---|
1697 | else {
|
---|
1698 |
|
---|
1699 | USHORT usop = 0;
|
---|
1700 |
|
---|
1701 | switch (li->type) {
|
---|
1702 | case IDM_COPY:
|
---|
1703 | case IDM_WILDCOPY:
|
---|
1704 | usop = DO_COPY;
|
---|
1705 | break;
|
---|
1706 | case IDM_MOVE:
|
---|
1707 | case IDM_WILDMOVE:
|
---|
1708 | case IDM_ARCHIVEM:
|
---|
1709 | usop = DO_MOVE;
|
---|
1710 | break;
|
---|
1711 | }
|
---|
1712 | if (usop)
|
---|
1713 | return MRFROM2SHORT(DOR_DROP, usop);
|
---|
1714 | }
|
---|
1715 | }
|
---|
1716 | }
|
---|
1717 | return 0;
|
---|
1718 |
|
---|
1719 | case CN_EMPHASIS:
|
---|
1720 | if (!fDummy) {
|
---|
1721 |
|
---|
1722 | PNOTIFYRECORDEMPHASIS pre = mp2;
|
---|
1723 |
|
---|
1724 | if (pre->fEmphasisMask & CRA_SELECTED) {
|
---|
1725 | if (pre->pRecord->flRecordAttr & CRA_SELECTED) {
|
---|
1726 | if (((PCNRITEM) (pre->pRecord))->attrFile & FILE_DIRECTORY) {
|
---|
1727 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
1728 | if (fFollowTree &&
|
---|
1729 | !(driveflags
|
---|
1730 | [toupper(*((PCNRITEM) pre->pRecord)->pszFileName) -
|
---|
1731 | 'A'] & DRIVE_INVALID)) {
|
---|
1732 | if (!LastDir && !ParentIsDesktop(hwnd, dcd->hwndParent))
|
---|
1733 | LastDir = FindDirCnr(dcd->hwndParent);
|
---|
1734 | if (LastDir) {
|
---|
1735 |
|
---|
1736 | NOTIFYRECORDENTER pri;
|
---|
1737 | BOOL tbool = fDCOpens;
|
---|
1738 |
|
---|
1739 | fDCOpens = FALSE;
|
---|
1740 | memset(&pri, 0, sizeof(pri));
|
---|
1741 | pri.hwndCnr = hwnd;
|
---|
1742 | pri.fKey = FALSE;
|
---|
1743 | pri.pRecord = pre->pRecord;
|
---|
1744 | WinSendMsg(hwnd,
|
---|
1745 | WM_CONTROL,
|
---|
1746 | MPFROM2SHORT(SHORT1FROMMP(mp1),
|
---|
1747 | CN_ENTER), MPFROMP(&pri));
|
---|
1748 | fDCOpens = tbool;
|
---|
1749 | }
|
---|
1750 | }
|
---|
1751 | if (*(ULONG *) realappname != FM3UL)
|
---|
1752 | WinSetWindowText(WinWindowFromID(dcd->hwndFrame,
|
---|
1753 | MAIN_STATUS),
|
---|
1754 | ((PCNRITEM) (pre->pRecord))->pszFileName);
|
---|
1755 | }
|
---|
1756 | }
|
---|
1757 | }
|
---|
1758 | }
|
---|
1759 | break;
|
---|
1760 |
|
---|
1761 | case CN_CONTEXTMENU:
|
---|
1762 | {
|
---|
1763 | PCNRITEM pci = (PCNRITEM) mp2;
|
---|
1764 | BOOL wasFollowing;
|
---|
1765 |
|
---|
1766 | //DosEnterCritSec(); //GKY 11-28-08
|
---|
1767 | wasFollowing = fFollowTree;
|
---|
1768 | fFollowTree = FALSE;
|
---|
1769 | //DosExitCritSec();
|
---|
1770 | if (pci && (INT) pci != -1 && !(pci->flags & RECFLAGS_ENV)) {
|
---|
1771 | WinSendMsg(hwnd,
|
---|
1772 | CM_SETRECORDEMPHASIS,
|
---|
1773 | MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_CURSORED));
|
---|
1774 | MarkAll(hwnd, FALSE, FALSE, TRUE);
|
---|
1775 | if (!(pci->attrFile & FILE_DIRECTORY))
|
---|
1776 | dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &FileMenu, FILE_POPUP);
|
---|
1777 | else if (!IsRoot(pci->pszFileName))
|
---|
1778 | dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &DirMenu, DIR_POPUP);
|
---|
1779 | else
|
---|
1780 | dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &TreeMenu, TREE_POPUP);
|
---|
1781 | }
|
---|
1782 | else {
|
---|
1783 | dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &TreeCnrMenu, TREECNR_POPUP);
|
---|
1784 | if (dcd->hwndLastMenu && !dcd->cnremphasized) {
|
---|
1785 | WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
|
---|
1786 | MPFROM2SHORT(TRUE, CRA_SOURCE));
|
---|
1787 | dcd->cnremphasized = TRUE;
|
---|
1788 | }
|
---|
1789 | }
|
---|
1790 | if (dcd->hwndLastMenu) {
|
---|
1791 | if (dcd->hwndLastMenu == DirMenu)
|
---|
1792 | WinEnableMenuItem(DirMenu, IDM_TREE, FALSE);
|
---|
1793 | if (dcd->hwndLastMenu == TreeCnrMenu) {
|
---|
1794 | if (dcd->flWindowAttr & CV_MINI)
|
---|
1795 | WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE);
|
---|
1796 | }
|
---|
1797 | if (!PopupMenu(hwnd, hwnd, dcd->hwndLastMenu)) {
|
---|
1798 | if (dcd->cnremphasized) {
|
---|
1799 | WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
|
---|
1800 | MPFROM2SHORT(FALSE, CRA_SOURCE));
|
---|
1801 | dcd->cnremphasized = FALSE;
|
---|
1802 | }
|
---|
1803 | if (dcd->hwndLastMenu != TreeCnrMenu)
|
---|
1804 | MarkAll(hwnd, TRUE, FALSE, TRUE);
|
---|
1805 | }
|
---|
1806 | }
|
---|
1807 | //DosEnterCritSec(); //GKY 11-28-08
|
---|
1808 | fFollowTree = wasFollowing;
|
---|
1809 | //DosExitCritSec();
|
---|
1810 | }
|
---|
1811 | break;
|
---|
1812 |
|
---|
1813 | case CN_ENTER:
|
---|
1814 | if (mp2) {
|
---|
1815 | PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
|
---|
1816 |
|
---|
1817 | PostMsg(hwnd, UM_ENTER, MPFROMP(pci), MPVOID);
|
---|
1818 | }
|
---|
1819 | break;
|
---|
1820 |
|
---|
1821 | case CN_COLLAPSETREE:
|
---|
1822 | case CN_EXPANDTREE:
|
---|
1823 | {
|
---|
1824 | PCNRITEM pci = (PCNRITEM) mp2;
|
---|
1825 |
|
---|
1826 | if (pci && (INT) pci != -1 && !(pci->flags & RECFLAGS_ENV)) {
|
---|
1827 | if (driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_REMOVABLE) {
|
---|
1828 |
|
---|
1829 | struct
|
---|
1830 | {
|
---|
1831 | ULONG serial;
|
---|
1832 | CHAR volumelength;
|
---|
1833 | CHAR volumelabel[CCHMAXPATH];
|
---|
1834 | }
|
---|
1835 | volser;
|
---|
1836 |
|
---|
1837 | memset(&volser, 0, sizeof(volser));
|
---|
1838 | DosError(FERR_DISABLEHARDERR);
|
---|
1839 | if (!DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
|
---|
1840 | FSIL_VOLSER, &volser,
|
---|
1841 | (ULONG) sizeof(volser))) {
|
---|
1842 | if (SHORT2FROMMP(mp1) == CN_COLLAPSETREE &&
|
---|
1843 | !volser.serial ||
|
---|
1844 | driveserial[toupper(*pci->pszFileName) - 'A'] !=
|
---|
1845 | volser.serial)
|
---|
1846 | UnFlesh(hwnd, pci);
|
---|
1847 | if (SHORT2FROMMP(mp1) != CN_COLLAPSETREE ||
|
---|
1848 | (!volser.serial ||
|
---|
1849 | driveserial[toupper(*pci->pszFileName) - 'A'] !=
|
---|
1850 | volser.serial)) {
|
---|
1851 | if (Flesh(hwnd, pci) &&
|
---|
1852 | SHORT2FROMMP(mp1) == CN_EXPANDTREE &&
|
---|
1853 | !dcd->suspendview && fTopDir)
|
---|
1854 | PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
|
---|
1855 | }
|
---|
1856 | driveserial[toupper(*pci->pszFileName) - 'A'] = volser.serial;
|
---|
1857 | }
|
---|
1858 | else {
|
---|
1859 | driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
|
---|
1860 | UnFlesh(hwnd, pci);
|
---|
1861 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
1862 | DosBeep(250, 100);
|
---|
1863 | }
|
---|
1864 | }
|
---|
1865 | else if (SHORT2FROMMP(mp1) == CN_EXPANDTREE) {
|
---|
1866 | if (Flesh(hwnd, pci) && !dcd->suspendview && fTopDir)
|
---|
1867 | PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
|
---|
1868 | }
|
---|
1869 | if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && !dcd->suspendview)
|
---|
1870 | WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
|
---|
1871 | }
|
---|
1872 | }
|
---|
1873 | break;
|
---|
1874 | } // switch WM_CONTROL
|
---|
1875 | }
|
---|
1876 | return 0;
|
---|
1877 |
|
---|
1878 | case UM_ACTION:
|
---|
1879 | if (mp1) {
|
---|
1880 |
|
---|
1881 | LISTINFO *li = mp1;
|
---|
1882 | ULONG action = (ULONG) mp2;
|
---|
1883 |
|
---|
1884 | if (!li->list || !li->list[0] ||
|
---|
1885 | !PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID))
|
---|
1886 | FreeListInfo(li);
|
---|
1887 | }
|
---|
1888 | return 0;
|
---|
1889 |
|
---|
1890 | case UM_SHOWME:
|
---|
1891 | if (mp1 && dcd) {
|
---|
1892 | CHAR *dir = xstrdup((CHAR *)mp1, pszSrcFile, __LINE__);
|
---|
1893 |
|
---|
1894 | if (dir) {
|
---|
1895 | if (!PostMsg(dcd->hwndObject, UM_SHOWME, MPFROMP(dir), MPVOID))
|
---|
1896 | free(dir);
|
---|
1897 | }
|
---|
1898 | }
|
---|
1899 | return 0;
|
---|
1900 |
|
---|
1901 | case UM_TOPDIR:
|
---|
1902 | if (mp1) {
|
---|
1903 |
|
---|
1904 | PCNRITEM pci = (PCNRITEM) mp1;
|
---|
1905 |
|
---|
1906 | ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
|
---|
1907 | }
|
---|
1908 | return 0;
|
---|
1909 |
|
---|
1910 | case UM_ENTER:
|
---|
1911 | {
|
---|
1912 | FILEFINDBUF3 ffb;
|
---|
1913 | HDIR hDir = HDIR_CREATE;
|
---|
1914 | ULONG nm = 1;
|
---|
1915 | APIRET status;
|
---|
1916 | BOOL IsOk = FALSE;
|
---|
1917 | ULONG ulDriveNum, ulDriveMap;
|
---|
1918 | PCNRITEM pciP, pciL, pci;
|
---|
1919 | ULONG fl = SWP_ACTIVATE;
|
---|
1920 |
|
---|
1921 | if (fFollowTree)
|
---|
1922 | fl = 0;
|
---|
1923 | SetShiftState();
|
---|
1924 | pci = (PCNRITEM) mp1;
|
---|
1925 | if (pci &&
|
---|
1926 | (INT) pci != -1 &&
|
---|
1927 | !(pci->rc.flRecordAttr & CRA_INUSE) &&
|
---|
1928 | !(pci->flags & RECFLAGS_ENV) && IsFullName(pci->pszFileName)) {
|
---|
1929 | if (driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_INVALID) {
|
---|
1930 | DosBeep(50, 100);
|
---|
1931 | if (hwndStatus)
|
---|
1932 | WinSetWindowText(hwndStatus, GetPString(IDS_RESCANSUGTEXT));
|
---|
1933 | return 0;
|
---|
1934 | }
|
---|
1935 | DosError(FERR_DISABLEHARDERR);
|
---|
1936 | if (!DosQCurDisk(&ulDriveNum, &ulDriveMap)) {
|
---|
1937 | if (!(ulDriveMap & 1 << (toupper(*pci->pszFileName) - 'A'))) {
|
---|
1938 | pciL = pciP = pci;
|
---|
1939 | for (;;) {
|
---|
1940 | pciP = WinSendMsg(hwnd,
|
---|
1941 | CM_QUERYRECORD,
|
---|
1942 | MPFROMP(pciL),
|
---|
1943 | MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER));
|
---|
1944 | if (pciP && (INT) pciP != -1)
|
---|
1945 | pciL = pciP;
|
---|
1946 | else {
|
---|
1947 | pciP = pciL;
|
---|
1948 | break;
|
---|
1949 | }
|
---|
1950 | } // for
|
---|
1951 | RemoveCnrItems(hwnd, pciP, 1, CMA_FREE | CMA_INVALIDATE);
|
---|
1952 | return 0;
|
---|
1953 | }
|
---|
1954 | }
|
---|
1955 | if (driveflags[toupper(*pci->pszFileName) - 'A'] &
|
---|
1956 | (DRIVE_REMOVABLE | DRIVE_NOPRESCAN)) {
|
---|
1957 |
|
---|
1958 | struct
|
---|
1959 | {
|
---|
1960 | ULONG serial;
|
---|
1961 | CHAR volumelength;
|
---|
1962 | CHAR volumelabel[CCHMAXPATH];
|
---|
1963 | }
|
---|
1964 | volser;
|
---|
1965 |
|
---|
1966 | pciL = pciP = pci;
|
---|
1967 | for (;;) {
|
---|
1968 | pciP = WinSendMsg(hwnd,
|
---|
1969 | CM_QUERYRECORD,
|
---|
1970 | MPFROMP(pciL),
|
---|
1971 | MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER));
|
---|
1972 | if (pciP && (INT) pciP != -1)
|
---|
1973 | pciL = pciP;
|
---|
1974 | else {
|
---|
1975 | pciP = pciL;
|
---|
1976 | break;
|
---|
1977 | }
|
---|
1978 | }
|
---|
1979 | if ((driveflags[toupper(*pci->pszFileName) - 'A'] &
|
---|
1980 | DRIVE_NOPRESCAN) ||
|
---|
1981 | (toupper(*pci->pszFileName) > 'B' &&
|
---|
1982 | !(driveflags[toupper(*pci->pszFileName) - 'A'] &
|
---|
1983 | DRIVE_CDROM))) {
|
---|
1984 |
|
---|
1985 | INT removable, x = (INT) (toupper(*pci->pszFileName) - 'A');
|
---|
1986 | ULONG drvtype;
|
---|
1987 | CHAR FileSystem[CCHMAXPATH];
|
---|
1988 |
|
---|
1989 | DosError(FERR_DISABLEHARDERR);
|
---|
1990 | removable = CheckDrive(toupper(*pciP->pszFileName),
|
---|
1991 | FileSystem, &drvtype);
|
---|
1992 | if (removable != -1) {
|
---|
1993 | driveflags[x] &= (DRIVE_IGNORE | DRIVE_NOPRESCAN |
|
---|
1994 | DRIVE_NOLOADICONS | DRIVE_NOLOADSUBJS |
|
---|
1995 | DRIVE_NOLOADLONGS | DRIVE_INCLUDEFILES |
|
---|
1996 | DRIVE_SLOW | DRIVE_NOSTATS |
|
---|
1997 | DRIVE_WRITEVERIFYOFF);
|
---|
1998 |
|
---|
1999 | if (removable == 1)
|
---|
2000 | driveflags[x] |= DRIVE_REMOVABLE;
|
---|
2001 | if (drvtype & DRIVE_REMOTE)
|
---|
2002 | driveflags[x] |= DRIVE_REMOTE;
|
---|
2003 | if (!strcmp(FileSystem, CBSIFS)) {
|
---|
2004 | driveflags[x] |= DRIVE_ZIPSTREAM;
|
---|
2005 | driveflags[x] &= (~DRIVE_REMOTE);
|
---|
2006 | }
|
---|
2007 | if(!strcmp(FileSystem,NDFS32)) {
|
---|
2008 | driveflags[x] |= DRIVE_VIRTUAL;
|
---|
2009 | driveflags[x] &= (~DRIVE_REMOTE);
|
---|
2010 | }
|
---|
2011 | if(!strcmp(FileSystem,RAMFS)) {
|
---|
2012 | driveflags[x] |= DRIVE_RAMDISK;
|
---|
2013 | driveflags[x] &= (~DRIVE_REMOTE);
|
---|
2014 | }
|
---|
2015 | if (!strcmp(FileSystem, CDFS) || !strcmp(FileSystem, ISOFS))
|
---|
2016 | driveflags[x] |= (DRIVE_REMOVABLE | DRIVE_NOTWRITEABLE | DRIVE_CDROM);
|
---|
2017 | if(!strcmp(FileSystem,NTFS))
|
---|
2018 | driveflags[x] |= DRIVE_NOTWRITEABLE;
|
---|
2019 | if (strcmp(FileSystem, HPFS) &&
|
---|
2020 | strcmp(FileSystem, JFS) &&
|
---|
2021 | strcmp(FileSystem, CDFS) &&
|
---|
2022 | strcmp(FileSystem, ISOFS) &&
|
---|
2023 | strcmp(FileSystem, RAMFS) &&
|
---|
2024 | strcmp(FileSystem, FAT32) &&
|
---|
2025 | strcmp(FileSystem, NDFS32) &&
|
---|
2026 | strcmp(FileSystem, NTFS) &&
|
---|
2027 | strcmp(FileSystem, HPFS386)) {
|
---|
2028 | driveflags[x] |= DRIVE_NOLONGNAMES;
|
---|
2029 | }
|
---|
2030 | SelectDriveIcon(pciP);
|
---|
2031 | WinSendMsg(hwnd,
|
---|
2032 | CM_INVALIDATERECORD,
|
---|
2033 | MPFROMP(&pciP),
|
---|
2034 | MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
|
---|
2035 | if (hwndMain)
|
---|
2036 | PostMsg(hwndMain, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
|
---|
2037 | }
|
---|
2038 | }
|
---|
2039 | memset(&volser, 0, sizeof(volser));
|
---|
2040 | DosError(FERR_DISABLEHARDERR);
|
---|
2041 | status = DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
|
---|
2042 | FSIL_VOLSER, &volser,
|
---|
2043 | (ULONG) sizeof(volser));
|
---|
2044 | if (!status) {
|
---|
2045 | if (!volser.serial ||
|
---|
2046 | driveserial[toupper(*pci->pszFileName) - 'A'] !=
|
---|
2047 | volser.serial) {
|
---|
2048 | UnFlesh(hwnd, pciP);
|
---|
2049 | Flesh(hwnd, pciP);
|
---|
2050 | driveserial[toupper(*pci->pszFileName) - 'A'] = volser.serial;
|
---|
2051 | }
|
---|
2052 | pciL = WinSendMsg(hwnd,
|
---|
2053 | CM_QUERYRECORD,
|
---|
2054 | MPFROMP(pciP),
|
---|
2055 | MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
|
---|
2056 | if (!pciL)
|
---|
2057 | Flesh(hwnd, pciP);
|
---|
2058 | }
|
---|
2059 | else {
|
---|
2060 | driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
|
---|
2061 | UnFlesh(hwnd, pci);
|
---|
2062 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
2063 | PostMsg(hwnd, UM_SETUP2, MPFROMP(pci), MPFROMLONG(status));
|
---|
2064 | return 0;
|
---|
2065 | }
|
---|
2066 | }
|
---|
2067 | status = 0;
|
---|
2068 | IsOk = (IsRoot(pci->pszFileName) &&
|
---|
2069 | IsValidDrive(toupper(*pci->pszFileName)));
|
---|
2070 | if (!IsOk) {
|
---|
2071 | DosError(FERR_DISABLEHARDERR);
|
---|
2072 | status = DosFindFirst(pci->pszFileName, &hDir,
|
---|
2073 | FILE_NORMAL | FILE_DIRECTORY |
|
---|
2074 | FILE_ARCHIVED | FILE_READONLY |
|
---|
2075 | FILE_HIDDEN | FILE_SYSTEM,
|
---|
2076 | &ffb, sizeof(ffb), &nm, FIL_STANDARD);
|
---|
2077 | priority_bumped();
|
---|
2078 | }
|
---|
2079 | if (!status) {
|
---|
2080 | if (!IsOk)
|
---|
2081 | DosFindClose(hDir);
|
---|
2082 | if (IsOk || (ffb.attrFile & FILE_DIRECTORY)) {
|
---|
2083 | if ((shiftstate & (KC_CTRL | KC_ALT)) == (KC_CTRL | KC_ALT)) {
|
---|
2084 | PostMsg(hwnd,
|
---|
2085 | WM_COMMAND, MPFROM2SHORT(IDM_SHOWALLFILES, 0), MPVOID);
|
---|
2086 | return 0;
|
---|
2087 | }
|
---|
2088 | if ((shiftstate & (KC_CTRL | KC_SHIFT)) == (KC_CTRL | KC_SHIFT)) {
|
---|
2089 | OpenObject(pci->pszFileName, Settings, dcd->hwndFrame);
|
---|
2090 | return 0;
|
---|
2091 | }
|
---|
2092 | if (!(shiftstate & (KC_CTRL | KC_SHIFT))) {
|
---|
2093 | if (!ParentIsDesktop(hwnd, dcd->hwndParent)) {
|
---|
2094 | if (FindDirCnrByName(pci->pszFileName, TRUE))
|
---|
2095 | return 0;
|
---|
2096 | }
|
---|
2097 | }
|
---|
2098 | if ((shiftstate & KC_CTRL) ||
|
---|
2099 | (!(shiftstate & KC_SHIFT) &&
|
---|
2100 | ParentIsDesktop(hwnd, dcd->hwndParent) && fVTreeOpensWPS)) {
|
---|
2101 |
|
---|
2102 | ULONG size = sizeof(ULONG), flWindowAttr = CV_ICON;
|
---|
2103 | CHAR s[33];
|
---|
2104 |
|
---|
2105 | strcpy(s, "ICON");
|
---|
2106 | PrfQueryProfileData(fmprof,
|
---|
2107 | appname,
|
---|
2108 | "DirflWindowAttr",
|
---|
2109 | (PVOID) & flWindowAttr, &size);
|
---|
2110 | if (flWindowAttr & CV_DETAIL) {
|
---|
2111 | if (IsRoot(pci->pszFileName))
|
---|
2112 | strcpy(s, "TREE");
|
---|
2113 | else
|
---|
2114 | strcpy(s, "DETAILS");
|
---|
2115 | }
|
---|
2116 | OpenObject(pci->pszFileName, s, dcd->hwndFrame);
|
---|
2117 | return 0;
|
---|
2118 | }
|
---|
2119 | if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
|
---|
2120 | !fDCOpens && !LastDir && !(shiftstate & KC_SHIFT))
|
---|
2121 | LastDir = FindDirCnr(dcd->hwndParent);
|
---|
2122 | if (LastDir && !fDCOpens && !(shiftstate & KC_SHIFT)) {
|
---|
2123 | WinSendMsg(LastDir,
|
---|
2124 | UM_SETDIR, MPFROMP(pci->pszFileName), MPVOID);
|
---|
2125 | WinSetWindowPos(WinQueryWindow(WinQueryWindow(LastDir,
|
---|
2126 | QW_PARENT),
|
---|
2127 | QW_PARENT),
|
---|
2128 | HWND_TOP, 0, 0, 0, 0, SWP_ZORDER | fl);
|
---|
2129 | }
|
---|
2130 | else
|
---|
2131 | OpenDirCnr(hwnd,
|
---|
2132 | dcd->hwndParent,
|
---|
2133 | dcd->hwndFrame, FALSE, pci->pszFileName);
|
---|
2134 | }
|
---|
2135 | else {
|
---|
2136 | if (!(driveflags[toupper(*pci->pszFileName) - 'A'] &
|
---|
2137 | DRIVE_INCLUDEFILES))
|
---|
2138 | RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE);
|
---|
2139 | else {
|
---|
2140 |
|
---|
2141 | SWP swp;
|
---|
2142 |
|
---|
2143 | WinQueryWindowPos(dcd->hwndFrame, &swp);
|
---|
2144 | DefaultViewKeys(hwnd,
|
---|
2145 | dcd->hwndFrame,
|
---|
2146 | dcd->hwndParent, &swp, pci->pszFileName);
|
---|
2147 | }
|
---|
2148 | }
|
---|
2149 | }
|
---|
2150 | else {
|
---|
2151 | if (!IsRoot(pci->pszFileName)) {
|
---|
2152 | NotifyError(pci->pszFileName, status);
|
---|
2153 | RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE);
|
---|
2154 | }
|
---|
2155 | }
|
---|
2156 | }
|
---|
2157 | else if (!pci)
|
---|
2158 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_MKDIR, 0), MPVOID);
|
---|
2159 | if (fFollowTree)
|
---|
2160 | WinSetFocus(HWND_DESKTOP, hwnd);
|
---|
2161 | }
|
---|
2162 | return 0;
|
---|
2163 |
|
---|
2164 | case WM_MENUEND:
|
---|
2165 | if (dcd) {
|
---|
2166 |
|
---|
2167 | HWND hwndMenu = (HWND) mp2;
|
---|
2168 |
|
---|
2169 | if (hwndMenu == TreeCnrMenu || hwndMenu == TreeMenu ||
|
---|
2170 | hwndMenu == DirMenu) {
|
---|
2171 | MarkAll(hwnd, TRUE, FALSE, TRUE);
|
---|
2172 | if (dcd->cnremphasized) {
|
---|
2173 | WinSendMsg(hwnd,
|
---|
2174 | CM_SETRECORDEMPHASIS,
|
---|
2175 | MPVOID, MPFROM2SHORT(FALSE, CRA_SOURCE));
|
---|
2176 | dcd->cnremphasized = FALSE;
|
---|
2177 | }
|
---|
2178 | }
|
---|
2179 | }
|
---|
2180 | break;
|
---|
2181 |
|
---|
2182 | case UM_OPENWINDOWFORME:
|
---|
2183 | if (dcd) {
|
---|
2184 | if (mp1 && !IsFile((CHAR *)mp1))
|
---|
2185 | OpenDirCnr(hwnd, dcd->hwndParent, dcd->hwndFrame, FALSE, (char *)mp1);
|
---|
2186 | }
|
---|
2187 | return 0;
|
---|
2188 |
|
---|
2189 | case MM_PORTHOLEINIT:
|
---|
2190 | if (dcd) {
|
---|
2191 | switch (SHORT1FROMMP(mp1)) {
|
---|
2192 | case 0:
|
---|
2193 | case 1:
|
---|
2194 | {
|
---|
2195 | ULONG wmsg;
|
---|
2196 |
|
---|
2197 | wmsg = ((SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU);
|
---|
2198 | PortholeInit((HWND) WinSendMsg(dcd->hwndClient,
|
---|
2199 | wmsg, MPVOID, MPVOID), mp1, mp2);
|
---|
2200 | }
|
---|
2201 | break;
|
---|
2202 | }
|
---|
2203 | }
|
---|
2204 | break;
|
---|
2205 |
|
---|
2206 | case UM_INITMENU:
|
---|
2207 | case WM_INITMENU:
|
---|
2208 | if (dcd) {
|
---|
2209 |
|
---|
2210 | switch (SHORT1FROMMP(mp1)) {
|
---|
2211 | case IDM_FILESMENU:
|
---|
2212 | {
|
---|
2213 | PCNRITEM pci;
|
---|
2214 |
|
---|
2215 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
2216 | if (pci && (INT) pci != -1) {
|
---|
2217 | BOOL rdy;
|
---|
2218 | BOOL writeable;
|
---|
2219 | BOOL removable;
|
---|
2220 | BOOL local;
|
---|
2221 | BOOL underenv;
|
---|
2222 | CHAR chDrvU;
|
---|
2223 | CHAR szDrv[CCHMAXPATH];
|
---|
2224 |
|
---|
2225 | strcpy(szDrv, pci->pszFileName);
|
---|
2226 | chDrvU = *pci->pszFileName;
|
---|
2227 | chDrvU = toupper(chDrvU);
|
---|
2228 | MakeValidDir(szDrv);
|
---|
2229 | rdy = *szDrv == chDrvU; // Drive not ready if MakeValidDir changes drive letter
|
---|
2230 | removable = rdy
|
---|
2231 | && (driveflags[chDrvU - 'A'] & DRIVE_REMOVABLE) != 0;
|
---|
2232 | writeable = rdy
|
---|
2233 | && !(driveflags[chDrvU - 'A'] & DRIVE_NOTWRITEABLE);
|
---|
2234 | local = rdy && (!(driveflags[chDrvU - 'A'] & (DRIVE_REMOTE | DRIVE_VIRTUAL)));
|
---|
2235 | underenv = (pci->flags & RECFLAGS_UNDERENV) != 0;
|
---|
2236 |
|
---|
2237 | CopyPresParams((HWND) mp2, hwndMainMenu);
|
---|
2238 | WinEnableMenuItem((HWND) mp2, IDM_INFO, rdy);
|
---|
2239 |
|
---|
2240 | WinEnableMenuItem((HWND) mp2, IDM_ATTRS, writeable);
|
---|
2241 | WinEnableMenuItem((HWND) mp2, IDM_EAS, writeable);
|
---|
2242 | WinEnableMenuItem((HWND) mp2, IDM_SUBJECT, writeable);
|
---|
2243 | WinEnableMenuItem((HWND) mp2, IDM_DRVFLAGS, 1); // fixme to allow if not ready
|
---|
2244 |
|
---|
2245 | WinEnableMenuItem((HWND) mp2, IDM_ARCHIVE, rdy);
|
---|
2246 |
|
---|
2247 | WinEnableMenuItem((HWND) mp2, IDM_UPDATE, !underenv);
|
---|
2248 | WinEnableMenuItem((HWND) mp2, IDM_EXPANDSUBMENU, !underenv);
|
---|
2249 | WinEnableMenuItem((HWND) mp2, IDM_EXPAND, !underenv);
|
---|
2250 | WinEnableMenuItem((HWND) mp2, IDM_COLLAPSE, !underenv);
|
---|
2251 |
|
---|
2252 | WinEnableMenuItem((HWND) mp2, IDM_SIZES, rdy);
|
---|
2253 | WinEnableMenuItem((HWND) mp2, IDM_MKDIR, writeable);
|
---|
2254 | WinEnableMenuItem((HWND) mp2, IDM_SHOWALLFILES, rdy);
|
---|
2255 | WinEnableMenuItem((HWND) mp2, IDM_UNDELETE, writeable);
|
---|
2256 |
|
---|
2257 | WinEnableMenuItem((HWND) mp2, IDM_CHKDSK, writeable && local);
|
---|
2258 | WinEnableMenuItem((HWND) mp2, IDM_FORMAT, writeable && local);
|
---|
2259 | WinEnableMenuItem((HWND) mp2, IDM_OPTIMIZE, writeable && local);
|
---|
2260 | WinEnableMenuItem((HWND) mp2, IDM_PARTITIONSMENU, local);
|
---|
2261 | WinEnableMenuItem((HWND) mp2, IDM_PARTITION, fMiniLVM);
|
---|
2262 | WinEnableMenuItem((HWND) mp2, IDM_PARTITIONDF, fDFSee);
|
---|
2263 | WinEnableMenuItem((HWND) mp2, IDM_PARTITIONLVMG, fLVMGui);
|
---|
2264 | WinEnableMenuItem((HWND) mp2, IDM_PARTITIONFD, fFDisk);
|
---|
2265 |
|
---|
2266 | WinEnableMenuItem((HWND) mp2, IDM_DETACH, !local);
|
---|
2267 |
|
---|
2268 | WinEnableMenuItem((HWND) mp2, IDM_EJECT, removable);
|
---|
2269 |
|
---|
2270 | WinEnableMenuItem((HWND) mp2, IDM_LOCK, removable);
|
---|
2271 | WinEnableMenuItem((HWND) mp2, IDM_UNLOCK, removable);
|
---|
2272 |
|
---|
2273 | WinEnableMenuItem((HWND) mp2, IDM_DELETE, !underenv && writeable);
|
---|
2274 | WinEnableMenuItem((HWND) mp2, IDM_PERMDELETE, !underenv
|
---|
2275 | && writeable);
|
---|
2276 | WinEnableMenuItem((HWND) mp2, IDM_DELETESUBMENU, !underenv
|
---|
2277 | && writeable);
|
---|
2278 | WinEnableMenuItem((HWND) mp2, IDM_MOVEMENU, !underenv
|
---|
2279 | && writeable);
|
---|
2280 | WinEnableMenuItem((HWND) mp2, IDM_RENAME, !underenv && writeable);
|
---|
2281 |
|
---|
2282 | }
|
---|
2283 | }
|
---|
2284 | break;
|
---|
2285 |
|
---|
2286 | case IDM_VIEWSMENU:
|
---|
2287 | WinCheckMenuItem((HWND) mp2,
|
---|
2288 | IDM_MINIICONS, ((dcd->flWindowAttr & CV_MINI) != 0));
|
---|
2289 | CopyPresParams((HWND) mp2, hwndMainMenu);
|
---|
2290 | WinEnableMenuItem((HWND) mp2, IDM_RESELECT, FALSE);
|
---|
2291 | WinEnableMenuItem((HWND) mp2, IDM_PARTITION, fMiniLVM);
|
---|
2292 | WinEnableMenuItem((HWND) mp2, IDM_PARTITIONDF, fDFSee);
|
---|
2293 | WinEnableMenuItem((HWND) mp2, IDM_PARTITIONLVMG, fLVMGui);
|
---|
2294 | WinEnableMenuItem((HWND) mp2, IDM_PARTITIONFD, fFDisk);
|
---|
2295 | break;
|
---|
2296 |
|
---|
2297 | case IDM_COMMANDSMENU:
|
---|
2298 | SetupCommandMenu((HWND) mp2, hwnd);
|
---|
2299 | CopyPresParams((HWND) mp2, hwndMainMenu);
|
---|
2300 | break;
|
---|
2301 |
|
---|
2302 | case IDM_SORTSUBMENU:
|
---|
2303 | SetSortChecks((HWND) mp2, TreesortFlags);
|
---|
2304 | CopyPresParams((HWND) mp2, hwndMainMenu);
|
---|
2305 | break;
|
---|
2306 |
|
---|
2307 | case IDM_WINDOWSMENU:
|
---|
2308 | SetupWinList((HWND) mp2,
|
---|
2309 | (hwndMain) ? hwndMain : (HWND) 0, dcd->hwndFrame);
|
---|
2310 | CopyPresParams((HWND) mp2, hwndMainMenu);
|
---|
2311 | break;
|
---|
2312 | }
|
---|
2313 | dcd->hwndLastMenu = (HWND) mp2;
|
---|
2314 | }
|
---|
2315 | if (msg == WM_INITMENU)
|
---|
2316 | break;
|
---|
2317 | return 0;
|
---|
2318 |
|
---|
2319 | case UM_COMMAND:
|
---|
2320 | if (!mp1)
|
---|
2321 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
2322 | else {
|
---|
2323 | if (!dcd) {
|
---|
2324 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
2325 | FreeListInfo((LISTINFO *) mp1);
|
---|
2326 | }
|
---|
2327 | else {
|
---|
2328 | if (!PostMsg(dcd->hwndObject, UM_COMMAND, mp1, mp2)) {
|
---|
2329 | Runtime_Error(pszSrcFile, __LINE__, "PostMsg");
|
---|
2330 | FreeListInfo((LISTINFO *) mp1);
|
---|
2331 | }
|
---|
2332 | else
|
---|
2333 | return (MRESULT) TRUE;
|
---|
2334 | }
|
---|
2335 | }
|
---|
2336 | return 0;
|
---|
2337 |
|
---|
2338 | case UM_LOADFILE:
|
---|
2339 | if (dcd && mp2) {
|
---|
2340 |
|
---|
2341 | HWND hwnd;
|
---|
2342 |
|
---|
2343 | if ((INT)mp1 == 5 || (INT)mp1 == 13 || (INT)mp1 == 21)
|
---|
2344 | hwnd = StartViewer(HWND_DESKTOP, (INT)mp1,
|
---|
2345 | (CHAR *)mp2, dcd->hwndFrame);
|
---|
2346 | else
|
---|
2347 | hwnd = StartMLEEditor(dcd->hwndParent,
|
---|
2348 | (INT)mp1, (CHAR *)mp2, dcd->hwndFrame);
|
---|
2349 | free((CHAR *)mp2);
|
---|
2350 | return MRFROMLONG(hwnd);
|
---|
2351 | }
|
---|
2352 | return 0;
|
---|
2353 |
|
---|
2354 | case UM_FIXCNRMLE:
|
---|
2355 | case UM_FIXEDITNAME:
|
---|
2356 | return CommonCnrProc(hwnd, msg, mp1, mp2);
|
---|
2357 |
|
---|
2358 | case UM_NOTIFY:
|
---|
2359 | if (mp2)
|
---|
2360 | Notify((CHAR *)mp2);
|
---|
2361 | return 0;
|
---|
2362 |
|
---|
2363 | case UM_FILTER:
|
---|
2364 | if (dcd) {
|
---|
2365 |
|
---|
2366 | BOOL tempsusp = dcd->suspendview;
|
---|
2367 |
|
---|
2368 | if (mp1) {
|
---|
2369 | //DosEnterCritSec(); // GKY 11-30-08 moved to SetMask
|
---|
2370 | SetMask((CHAR *)mp1, &dcd->mask);
|
---|
2371 | //DosExitCritSec();
|
---|
2372 | }
|
---|
2373 | dcd->suspendview = TRUE;
|
---|
2374 | dcd->mask.attrFile |= FILE_DIRECTORY;
|
---|
2375 | WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));
|
---|
2376 | dcd->suspendview = tempsusp;
|
---|
2377 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
2378 | }
|
---|
2379 | return 0;
|
---|
2380 |
|
---|
2381 | case UM_DRIVECMD:
|
---|
2382 | if (mp1)
|
---|
2383 | ShowTreeRec(hwnd, (CHAR *)mp1, FALSE, TRUE);
|
---|
2384 | return 0;
|
---|
2385 |
|
---|
2386 | case WM_APPTERMINATENOTIFY:
|
---|
2387 | {
|
---|
2388 | APPNOTIFY *info;
|
---|
2389 | PCNRITEM pci;
|
---|
2390 | CHAR s[] = " :\\";
|
---|
2391 |
|
---|
2392 | if (!mp2) {
|
---|
2393 | if (hwndMain)
|
---|
2394 | PostMsg(hwndMain, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
|
---|
2395 | }
|
---|
2396 | info = apphead;
|
---|
2397 | while (info) {
|
---|
2398 | if (info->happ == (HAPP) mp1) {
|
---|
2399 | *s = info->device;
|
---|
2400 | pci = FindCnrRecord(hwnd, s, NULL, FALSE, FALSE, TRUE);
|
---|
2401 | if (pci && (INT) pci != -1) {
|
---|
2402 | driveserial[info->device - 'A'] = -1;
|
---|
2403 | DriveFlagsOne(info->device - 'A');
|
---|
2404 | if (driveflags[info->device - 'A'] &
|
---|
2405 | (DRIVE_INVALID | DRIVE_IGNORE))
|
---|
2406 | RemoveCnrItems(hwnd, pci, 1, CMA_FREE);
|
---|
2407 | else
|
---|
2408 | Flesh(hwnd, pci);
|
---|
2409 | }
|
---|
2410 | if (info->prev)
|
---|
2411 | info->prev->next = info->next;
|
---|
2412 | if (info->next)
|
---|
2413 | info->next->prev = info->prev;
|
---|
2414 | if (apphead == info)
|
---|
2415 | apphead = info->next;
|
---|
2416 | if (apptail == info)
|
---|
2417 | apptail = info->prev;
|
---|
2418 | free(info);
|
---|
2419 | break;
|
---|
2420 | }
|
---|
2421 | info = info->next;
|
---|
2422 | }
|
---|
2423 | }
|
---|
2424 | break;
|
---|
2425 |
|
---|
2426 | case WM_COMMAND:
|
---|
2427 | DosError(FERR_DISABLEHARDERR);
|
---|
2428 | if (dcd) {
|
---|
2429 | if (SwitchCommand(dcd->hwndLastMenu, SHORT1FROMMP(mp1)))
|
---|
2430 | return 0;
|
---|
2431 | switch (SHORT1FROMMP(mp1)) {
|
---|
2432 | case IDM_SETTARGET:
|
---|
2433 | SetTargetDir(hwnd, FALSE);
|
---|
2434 | break;
|
---|
2435 |
|
---|
2436 | case IDM_DETACH:
|
---|
2437 | {
|
---|
2438 | CHAR d[3] = " :";
|
---|
2439 | PCNRITEM pci;
|
---|
2440 | PROGDETAILS pgd;
|
---|
2441 | CHAR params[368], *p;
|
---|
2442 | HAPP happ;
|
---|
2443 |
|
---|
2444 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
2445 | if (pci && (INT) pci != -1 && isalpha(*pci->pszFileName)) {
|
---|
2446 | *d = toupper(*pci->pszFileName);
|
---|
2447 | p = GetCmdSpec(FALSE);
|
---|
2448 | memset(&pgd, 0, sizeof(pgd));
|
---|
2449 | pgd.Length = sizeof(pgd);
|
---|
2450 | pgd.progt.progc = PROG_WINDOWABLEVIO;
|
---|
2451 | pgd.progt.fbVisible = SHE_VISIBLE;
|
---|
2452 | pgd.pszTitle = GetPString(IDS_DETACHREQUESTTEXT);
|
---|
2453 | pgd.pszExecutable = p;
|
---|
2454 | pgd.pszParameters = params;
|
---|
2455 | pgd.pszStartupDir = NULL;
|
---|
2456 | pgd.pszIcon = NULL;
|
---|
2457 | pgd.pszEnvironment = NULL;
|
---|
2458 | pgd.swpInitial.hwndInsertBehind = HWND_TOP;
|
---|
2459 | pgd.swpInitial.hwnd = hwnd;
|
---|
2460 | pgd.swpInitial.fl = SWP_SHOW | SWP_ACTIVATE;
|
---|
2461 | sprintf(params, "/C NET USE %s /D", d);
|
---|
2462 | happ = WinStartApp(hwnd, &pgd, pgd.pszParameters,
|
---|
2463 | NULL, SAF_MAXIMIZED);
|
---|
2464 | if (!happ) {
|
---|
2465 | saymsg(MB_CANCEL | MB_ICONEXCLAMATION, hwnd,
|
---|
2466 | GetPString(IDS_ERRORTEXT),
|
---|
2467 | GetPString(IDS_CANTSTARTTEXT), p, params);
|
---|
2468 | }
|
---|
2469 | else {
|
---|
2470 | APPNOTIFY *info;
|
---|
2471 |
|
---|
2472 | info = xmallocz(sizeof(APPNOTIFY), pszSrcFile, __LINE__);
|
---|
2473 | if (info) {
|
---|
2474 | info->happ = happ;
|
---|
2475 | info->device = *d;
|
---|
2476 | if (!apphead)
|
---|
2477 | apphead = info;
|
---|
2478 | else {
|
---|
2479 | apptail->next = info;
|
---|
2480 | info->prev = apptail;
|
---|
2481 | }
|
---|
2482 | apptail = info;
|
---|
2483 | }
|
---|
2484 | }
|
---|
2485 | }
|
---|
2486 | }
|
---|
2487 | break;
|
---|
2488 |
|
---|
2489 | case IDM_REMAP:
|
---|
2490 | WinDlgBox(HWND_DESKTOP, hwnd, RemapDlgProc,
|
---|
2491 | FM3ModHandle, MAP_FRAME, NULL);
|
---|
2492 | break;
|
---|
2493 |
|
---|
2494 | case IDM_CONTEXTMENU:
|
---|
2495 | {
|
---|
2496 | PCNRITEM pci;
|
---|
2497 |
|
---|
2498 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
2499 | PostMsg(hwnd, WM_CONTROL, MPFROM2SHORT(DIR_CNR, CN_CONTEXTMENU),
|
---|
2500 | MPFROMP(pci));
|
---|
2501 | }
|
---|
2502 | break;
|
---|
2503 |
|
---|
2504 | case IDM_FINDINTREE:
|
---|
2505 | {
|
---|
2506 | PSZ pszTempDir;
|
---|
2507 | PCNRITEM pci;
|
---|
2508 |
|
---|
2509 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
2510 | if (pci && (INT) pci != -1) {
|
---|
2511 | pszTempDir = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
|
---|
2512 | if (pszTempDir)
|
---|
2513 | MakeValidDir(pszTempDir);
|
---|
2514 | }
|
---|
2515 | else
|
---|
2516 | pszTempDir = xstrdup(pFM2SaveDirectory, pszSrcFile, __LINE__);
|
---|
2517 | if (pszTempDir) {
|
---|
2518 | if (WinDlgBox(HWND_DESKTOP, dcd->hwndParent,
|
---|
2519 | WalkAllDlgProc,
|
---|
2520 | FM3ModHandle, WALK_FRAME, MPFROMP(pszTempDir))) {
|
---|
2521 | if (!WinSendMsg(hwnd, UM_SHOWME, MPFROMP(pszTempDir), MPFROMLONG(1)))
|
---|
2522 | free(pszTempDir);
|
---|
2523 | }
|
---|
2524 | else
|
---|
2525 | free(pszTempDir);
|
---|
2526 | }
|
---|
2527 | }
|
---|
2528 | break;
|
---|
2529 |
|
---|
2530 | case IDM_BEGINEDIT:
|
---|
2531 | OpenEdit(hwnd);
|
---|
2532 | break;
|
---|
2533 |
|
---|
2534 | case IDM_ENDEDIT:
|
---|
2535 | WinSendMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
|
---|
2536 | break;
|
---|
2537 |
|
---|
2538 | case IDM_FILTER:
|
---|
2539 | {
|
---|
2540 | BOOL empty = FALSE;
|
---|
2541 | PCNRITEM pci;
|
---|
2542 |
|
---|
2543 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
2544 | if (!*dcd->mask.szMask)
|
---|
2545 | empty = TRUE;
|
---|
2546 | dcd->mask.fIsTree = TRUE;
|
---|
2547 | *dcd->mask.prompt = 0;
|
---|
2548 | if (pci && (INT) pci != -1)
|
---|
2549 | dcd->mask.fFilesIncluded =
|
---|
2550 | ((driveflags[toupper(*pci->pszFileName) - 'A'] &
|
---|
2551 | DRIVE_INCLUDEFILES) != 0);
|
---|
2552 | else
|
---|
2553 | dcd->mask.fFilesIncluded = FALSE;
|
---|
2554 | if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
|
---|
2555 | FM3ModHandle, MSK_FRAME, MPFROMP(&dcd->mask)))
|
---|
2556 | WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
|
---|
2557 | else if (empty)
|
---|
2558 | *dcd->mask.szMask = 0;
|
---|
2559 | PrfWriteProfileData(fmprof, appname, "TreeFilter", &dcd->mask,
|
---|
2560 | sizeof(MASK));
|
---|
2561 | }
|
---|
2562 | break;
|
---|
2563 |
|
---|
2564 | case IDM_SHOWSORT:
|
---|
2565 | QuickPopup(hwnd, dcd, CheckMenu(hwndMainMenu, &TreeCnrMenu, TREECNR_POPUP),
|
---|
2566 | IDM_SORTSUBMENU);
|
---|
2567 | break;
|
---|
2568 |
|
---|
2569 | case IDM_SHOWSELECT:
|
---|
2570 | QuickPopup(hwnd, dcd, CheckMenu(hwndMainMenu, &TreeCnrMenu, TREECNR_POPUP),
|
---|
2571 | IDM_SELECTSUBMENU);
|
---|
2572 | break;
|
---|
2573 |
|
---|
2574 | case IDM_TREECNRVIEWSETTINGS:
|
---|
2575 | if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
|
---|
2576 | PostMsg(dcd->hwndParent, msg, MPFROMLONG(IDM_TREECNRVIEWSETTINGS), mp2);
|
---|
2577 | else {
|
---|
2578 | WinDlgBox(HWND_DESKTOP,
|
---|
2579 | hwnd,
|
---|
2580 | CfgDlgProc,
|
---|
2581 | FM3ModHandle,
|
---|
2582 | CFG_FRAME,
|
---|
2583 | MPFROMLONG(IDM_TREECNRVIEWSETTINGS));
|
---|
2584 | }
|
---|
2585 | break;
|
---|
2586 |
|
---|
2587 | case IDM_WALKDIR:
|
---|
2588 | case IDM_OPENWALK:
|
---|
2589 | {
|
---|
2590 | CHAR newpath[CCHMAXPATH];
|
---|
2591 | PCNRITEM pci;
|
---|
2592 |
|
---|
2593 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
2594 | if (pci && (INT) pci != -1) {
|
---|
2595 | strcpy(newpath, pci->pszFileName);
|
---|
2596 | MakeValidDir(newpath);
|
---|
2597 | }
|
---|
2598 | else
|
---|
2599 | strcpy(newpath, pFM2SaveDirectory);
|
---|
2600 | if (!WinDlgBox(HWND_DESKTOP, dcd->hwndParent, WalkAllDlgProc,
|
---|
2601 | FM3ModHandle, WALK_FRAME,
|
---|
2602 | MPFROMP(newpath)) || !*newpath)
|
---|
2603 | break;
|
---|
2604 | WinSendMsg(hwnd, UM_OPENWINDOWFORME, MPFROMP(newpath), MPVOID);
|
---|
2605 | }
|
---|
2606 | break;
|
---|
2607 |
|
---|
2608 | case IDM_HELP:
|
---|
2609 | if (hwndHelp) {
|
---|
2610 | if (!ParentIsDesktop(dcd->hwndFrame, dcd->hwndParent))
|
---|
2611 | PostMsg(dcd->hwndParent, UM_COMMAND, mp1, mp2);
|
---|
2612 | else
|
---|
2613 | WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
|
---|
2614 | }
|
---|
2615 | break;
|
---|
2616 |
|
---|
2617 | case IDM_PARTITION:
|
---|
2618 | runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
2619 | NULL, NULL,
|
---|
2620 | "%s", "MINILVM.EXE");
|
---|
2621 | break;
|
---|
2622 |
|
---|
2623 | case IDM_PARTITIONDF:
|
---|
2624 | runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
2625 | NULL, NULL,
|
---|
2626 | "%s", "DFSOS2.EXE");
|
---|
2627 | break;
|
---|
2628 |
|
---|
2629 | case IDM_PARTITIONLVMG:
|
---|
2630 | runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
2631 | NULL, NULL,
|
---|
2632 | "%s", "LVMGUI.CMD");
|
---|
2633 | break;
|
---|
2634 |
|
---|
2635 | case IDM_PARTITIONFD:
|
---|
2636 | runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
2637 | NULL, NULL,
|
---|
2638 | "%s", "FDISKPM.EXE");
|
---|
2639 | break;
|
---|
2640 |
|
---|
2641 | case IDM_REFRESHREMOVABLES:
|
---|
2642 | runemf2(SEPARATE | WINDOWED | BACKGROUND | MINIMIZED | WAIT,
|
---|
2643 | HWND_DESKTOP, pszSrcFile, __LINE__, NULL, NULL,
|
---|
2644 | "%s", "LVM.EXE /RediscoverPRM");
|
---|
2645 | PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
|
---|
2646 | break;
|
---|
2647 |
|
---|
2648 | case IDM_SORTNAME:
|
---|
2649 | case IDM_SORTFILENAME:
|
---|
2650 | case IDM_SORTSIZE:
|
---|
2651 | case IDM_SORTEASIZE:
|
---|
2652 | case IDM_SORTFIRST:
|
---|
2653 | case IDM_SORTLAST:
|
---|
2654 | case IDM_SORTLWDATE:
|
---|
2655 | case IDM_SORTLADATE:
|
---|
2656 | case IDM_SORTCRDATE:
|
---|
2657 | TreesortFlags &= (SORT_REVERSE | SORT_DIRSFIRST | SORT_DIRSLAST);
|
---|
2658 | case IDM_SORTDIRSFIRST:
|
---|
2659 | case IDM_SORTDIRSLAST:
|
---|
2660 | case IDM_SORTREVERSE:
|
---|
2661 | switch (SHORT1FROMMP(mp1)) {
|
---|
2662 | case IDM_SORTFILENAME:
|
---|
2663 | TreesortFlags |= SORT_FILENAME;
|
---|
2664 | break;
|
---|
2665 | case IDM_SORTSIZE:
|
---|
2666 | TreesortFlags |= SORT_SIZE;
|
---|
2667 | break;
|
---|
2668 | case IDM_SORTEASIZE:
|
---|
2669 | TreesortFlags |= SORT_EASIZE;
|
---|
2670 | break;
|
---|
2671 | case IDM_SORTFIRST:
|
---|
2672 | TreesortFlags |= SORT_FIRSTEXTENSION;
|
---|
2673 | break;
|
---|
2674 | case IDM_SORTLAST:
|
---|
2675 | TreesortFlags |= SORT_LASTEXTENSION;
|
---|
2676 | break;
|
---|
2677 | case IDM_SORTLWDATE:
|
---|
2678 | TreesortFlags |= SORT_LWDATE;
|
---|
2679 | break;
|
---|
2680 | case IDM_SORTLADATE:
|
---|
2681 | TreesortFlags |= SORT_LADATE;
|
---|
2682 | break;
|
---|
2683 | case IDM_SORTCRDATE:
|
---|
2684 | TreesortFlags |= SORT_CRDATE;
|
---|
2685 | break;
|
---|
2686 | case IDM_SORTDIRSFIRST:
|
---|
2687 | if (TreesortFlags & SORT_DIRSFIRST)
|
---|
2688 | TreesortFlags &= (~SORT_DIRSFIRST);
|
---|
2689 | else {
|
---|
2690 | TreesortFlags |= SORT_DIRSFIRST;
|
---|
2691 | TreesortFlags &= (~SORT_DIRSLAST);
|
---|
2692 | }
|
---|
2693 | break;
|
---|
2694 | case IDM_SORTDIRSLAST:
|
---|
2695 | if (TreesortFlags & SORT_DIRSLAST)
|
---|
2696 | TreesortFlags &= (~SORT_DIRSLAST);
|
---|
2697 | else {
|
---|
2698 | TreesortFlags |= SORT_DIRSLAST;
|
---|
2699 | TreesortFlags &= (~SORT_DIRSFIRST);
|
---|
2700 | }
|
---|
2701 | break;
|
---|
2702 | case IDM_SORTREVERSE:
|
---|
2703 | if (TreesortFlags & SORT_REVERSE)
|
---|
2704 | TreesortFlags &= (~SORT_REVERSE);
|
---|
2705 | else
|
---|
2706 | TreesortFlags |= SORT_REVERSE;
|
---|
2707 | break;
|
---|
2708 | }
|
---|
2709 | PrfWriteProfileData(fmprof, appname, "TreeSort", &TreesortFlags,
|
---|
2710 | sizeof(INT));
|
---|
2711 | WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortTreeCnr), MPVOID);
|
---|
2712 | break;
|
---|
2713 |
|
---|
2714 | case IDM_COLLECT:
|
---|
2715 | case IDM_GREP:
|
---|
2716 | if (!Collector) {
|
---|
2717 |
|
---|
2718 | HWND hwndC;
|
---|
2719 | SWP swp;
|
---|
2720 |
|
---|
2721 | if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
|
---|
2722 | !fAutoTile &&
|
---|
2723 | (!fExternalCollector && *(ULONG *) realappname == FM3UL))
|
---|
2724 | GetNextWindowPos(dcd->hwndParent, &swp, NULL, NULL);
|
---|
2725 | hwndC = StartCollector((fExternalCollector ||
|
---|
2726 | *(ULONG *) realappname != FM3UL) ?
|
---|
2727 | HWND_DESKTOP : dcd->hwndParent, 4);
|
---|
2728 | if (hwndC) {
|
---|
2729 | if (!ParentIsDesktop(hwnd,
|
---|
2730 | dcd->hwndParent) &&
|
---|
2731 | !fAutoTile &&
|
---|
2732 | (!fExternalCollector && *(ULONG *) realappname == FM3UL))
|
---|
2733 | WinSetWindowPos(hwndC,
|
---|
2734 | HWND_TOP,
|
---|
2735 | swp.x,
|
---|
2736 | swp.y,
|
---|
2737 | swp.cx,
|
---|
2738 | swp.cy,
|
---|
2739 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
---|
2740 | else if (!ParentIsDesktop(hwnd,
|
---|
2741 | dcd->hwndParent) &&
|
---|
2742 | fAutoTile && *(ULONG *) realappname == FM3UL)
|
---|
2743 | TileChildren(dcd->hwndParent, TRUE);
|
---|
2744 | }
|
---|
2745 | WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
|
---|
2746 | DosSleep(100);//05 Aug 07 GKY 250
|
---|
2747 | }
|
---|
2748 | else
|
---|
2749 | StartCollector(dcd->hwndParent, 4);
|
---|
2750 | if (SHORT1FROMMP(mp1) == IDM_GREP) {
|
---|
2751 | PCNRITEM pci = NULL;
|
---|
2752 |
|
---|
2753 | pci = WinSendMsg(hwnd,
|
---|
2754 | CM_QUERYRECORDEMPHASIS,
|
---|
2755 | MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
|
---|
2756 | if (pci && (INT) pci != -1)
|
---|
2757 | PostMsg(Collector, WM_COMMAND,
|
---|
2758 | MPFROM2SHORT(IDM_GREP, 0), MPFROMP(pci->pszFileName));
|
---|
2759 | else
|
---|
2760 | PostMsg(Collector, WM_COMMAND,
|
---|
2761 | MPFROM2SHORT(IDM_GREP, 0), MPVOID);
|
---|
2762 | }
|
---|
2763 | else
|
---|
2764 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_COLLECTOR, 0), MPVOID);
|
---|
2765 | break;
|
---|
2766 |
|
---|
2767 | case IDM_COLLECTOR:
|
---|
2768 | DosSleep(32);//05 Aug 07 GKY 64
|
---|
2769 | {
|
---|
2770 | CHAR **list;
|
---|
2771 |
|
---|
2772 | list = BuildList(hwnd);
|
---|
2773 | if (list) {
|
---|
2774 | if (Collector) {
|
---|
2775 | if (!PostMsg(Collector, WM_COMMAND,
|
---|
2776 | MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(list)))
|
---|
2777 | FreeList(list);
|
---|
2778 | }
|
---|
2779 | else
|
---|
2780 | FreeList(list);
|
---|
2781 | }
|
---|
2782 | }
|
---|
2783 | break;
|
---|
2784 |
|
---|
2785 | case IDM_COLLAPSEALL:
|
---|
2786 | WinSendMsg(hwnd, CM_COLLAPSETREE, MPVOID, MPVOID);
|
---|
2787 | break;
|
---|
2788 |
|
---|
2789 | case IDM_COLLAPSE:
|
---|
2790 | case IDM_EXPAND:
|
---|
2791 | {
|
---|
2792 | PCNRITEM pci = NULL;
|
---|
2793 |
|
---|
2794 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
2795 | if (pci && (INT) pci != -1) {
|
---|
2796 | if (pci->flags & RECFLAGS_UNDERENV)
|
---|
2797 | break;
|
---|
2798 | PostMsg(dcd->hwndObject, UM_EXPAND, mp1, MPFROMP(pci));
|
---|
2799 | }
|
---|
2800 | }
|
---|
2801 | break;
|
---|
2802 |
|
---|
2803 | case IDM_UPDATE:
|
---|
2804 | {
|
---|
2805 | PCNRITEM pci = (PCNRITEM)CurrentRecord(hwnd);
|
---|
2806 | if (pci && (INT)pci != -1) {
|
---|
2807 | UINT driveflag = driveflags[toupper(*pci->pszFileName) - 'A'];
|
---|
2808 | if (pci->attrFile & FILE_DIRECTORY) {
|
---|
2809 | if (pci->flags & RECFLAGS_UNDERENV)
|
---|
2810 | break;
|
---|
2811 | UnFlesh(hwnd, pci);
|
---|
2812 | // Check if drive type might need update
|
---|
2813 | if ((driveflag & (DRIVE_INVALID | DRIVE_NOPRESCAN)) ||
|
---|
2814 | (~driveflag & DRIVE_NOPRESCAN && pci->rc.hptrIcon == hptrDunno))
|
---|
2815 | {
|
---|
2816 | driveflags[toupper(*pci->pszFileName) - 'A'] &=
|
---|
2817 | (DRIVE_IGNORE | DRIVE_NOPRESCAN | DRIVE_NOLOADICONS |
|
---|
2818 | DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS | DRIVE_NOSTATS |
|
---|
2819 | DRIVE_WRITEVERIFYOFF);
|
---|
2820 | DriveFlagsOne(toupper(*pci->pszFileName) - 'A');
|
---|
2821 | driveflag = driveflags[toupper(*pci->pszFileName) - 'A'];
|
---|
2822 | if (driveflag & DRIVE_INVALID)
|
---|
2823 | pci->rc.hptrIcon = hptrDunno;
|
---|
2824 | else {
|
---|
2825 | SelectDriveIcon(pci);
|
---|
2826 | }
|
---|
2827 | WinSendMsg(hwnd,
|
---|
2828 | CM_INVALIDATERECORD,
|
---|
2829 | MPFROMP(&pci),
|
---|
2830 | MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
|
---|
2831 | if (hwndMain)
|
---|
2832 | PostMsg(hwndMain, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
|
---|
2833 | }
|
---|
2834 | if (~driveflag & DRIVE_INVALID)
|
---|
2835 | Flesh(hwnd, pci);
|
---|
2836 | }
|
---|
2837 | }
|
---|
2838 | }
|
---|
2839 | break;
|
---|
2840 |
|
---|
2841 | case IDM_RESCAN:
|
---|
2842 | PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPVOID);
|
---|
2843 | break;
|
---|
2844 |
|
---|
2845 | case IDM_RESORT:
|
---|
2846 | WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortTreeCnr), MPVOID);
|
---|
2847 | break;
|
---|
2848 |
|
---|
2849 | case IDM_TEXT:
|
---|
2850 | case IDM_MINIICONS:
|
---|
2851 | {
|
---|
2852 | CNRINFO cnri;
|
---|
2853 |
|
---|
2854 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
2855 | cnri.cb = sizeof(CNRINFO);
|
---|
2856 | WinSendMsg(hwnd,
|
---|
2857 | CM_QUERYCNRINFO,
|
---|
2858 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
|
---|
2859 | if (SHORT1FROMMP(mp1) == IDM_MINIICONS) {
|
---|
2860 | if (cnri.flWindowAttr & CV_MINI)
|
---|
2861 | cnri.flWindowAttr &= (~CV_MINI);
|
---|
2862 | else
|
---|
2863 | cnri.flWindowAttr |= CV_MINI;
|
---|
2864 | }
|
---|
2865 | else {
|
---|
2866 | if (cnri.flWindowAttr & CV_TEXT) {
|
---|
2867 | cnri.flWindowAttr &= (~CV_TEXT);
|
---|
2868 | cnri.flWindowAttr |= CV_ICON;
|
---|
2869 | }
|
---|
2870 | else {
|
---|
2871 | cnri.flWindowAttr &= (~CV_ICON);
|
---|
2872 | cnri.flWindowAttr |= CV_TEXT;
|
---|
2873 | }
|
---|
2874 | }
|
---|
2875 | dcd->flWindowAttr = cnri.flWindowAttr;
|
---|
2876 | PrfWriteProfileData(fmprof,
|
---|
2877 | appname,
|
---|
2878 | "TreeflWindowAttr",
|
---|
2879 | &cnri.flWindowAttr, sizeof(ULONG));
|
---|
2880 | WinSendMsg(hwnd,
|
---|
2881 | CM_SETCNRINFO,
|
---|
2882 | MPFROMP(&cnri),
|
---|
2883 | MPFROMLONG(CMA_FLWINDOWATTR | CMA_TREEICON |
|
---|
2884 | CMA_SLTREEBITMAPORICON));
|
---|
2885 | }
|
---|
2886 | break;
|
---|
2887 |
|
---|
2888 | case IDM_SIZES:
|
---|
2889 | case IDM_DRVFLAGS:
|
---|
2890 | case IDM_SHOWALLFILES:
|
---|
2891 | case IDM_UNDELETE:
|
---|
2892 | case IDM_OPTIMIZE:
|
---|
2893 | case IDM_CHKDSK:
|
---|
2894 | case IDM_FORMAT:
|
---|
2895 | case IDM_MKDIR:
|
---|
2896 | case IDM_LOCK:
|
---|
2897 | case IDM_UNLOCK:
|
---|
2898 | case IDM_EJECT:
|
---|
2899 | case IDM_CLOSETRAY:
|
---|
2900 | {
|
---|
2901 | PCNRITEM pci;
|
---|
2902 |
|
---|
2903 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
2904 | if (pci && (INT) pci != -1)
|
---|
2905 | CommonDriveCmd(hwnd, pci->pszFileName, SHORT1FROMMP(mp1));
|
---|
2906 | }
|
---|
2907 | break;
|
---|
2908 |
|
---|
2909 | case IDM_SAVETOLIST:
|
---|
2910 | WinDlgBox(HWND_DESKTOP,
|
---|
2911 | hwnd,
|
---|
2912 | SaveListDlgProc, FM3ModHandle, SAV_FRAME, MPFROMP(&hwnd));
|
---|
2913 | break;
|
---|
2914 |
|
---|
2915 | case IDM_DELETE:
|
---|
2916 | case IDM_PERMDELETE:
|
---|
2917 | case IDM_MOVE:
|
---|
2918 | case IDM_WPSMOVE:
|
---|
2919 | case IDM_WILDMOVE:
|
---|
2920 | case IDM_RENAME:
|
---|
2921 | {
|
---|
2922 | PCNRITEM pci;
|
---|
2923 |
|
---|
2924 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
2925 | if (pci && (INT) pci != -1) {
|
---|
2926 | if (pci->flags & RECFLAGS_UNDERENV)
|
---|
2927 | break;
|
---|
2928 | }
|
---|
2929 | }
|
---|
2930 | /* else intentional fallthru */
|
---|
2931 | case IDM_ATTRS:
|
---|
2932 | case IDM_INFO:
|
---|
2933 | case IDM_COPY:
|
---|
2934 | case IDM_WPSCOPY:
|
---|
2935 | case IDM_WILDCOPY:
|
---|
2936 | case IDM_DOITYOURSELF:
|
---|
2937 | case IDM_OPENWINDOW:
|
---|
2938 | case IDM_OPENSETTINGS:
|
---|
2939 | case IDM_OPENDEFAULT:
|
---|
2940 | case IDM_OPENICON:
|
---|
2941 | case IDM_OPENDETAILS:
|
---|
2942 | case IDM_OPENTREE:
|
---|
2943 | case IDM_SHADOW:
|
---|
2944 | case IDM_SHADOW2:
|
---|
2945 | case IDM_COMPARE:
|
---|
2946 | case IDM_VIEW:
|
---|
2947 | case IDM_VIEWTEXT:
|
---|
2948 | case IDM_VIEWBINARY:
|
---|
2949 | case IDM_EDIT:
|
---|
2950 | case IDM_EDITTEXT:
|
---|
2951 | case IDM_EDITBINARY:
|
---|
2952 | case IDM_EAS:
|
---|
2953 | case IDM_SUBJECT:
|
---|
2954 | case IDM_APPENDTOCLIP:
|
---|
2955 | case IDM_SAVETOCLIP:
|
---|
2956 | case IDM_ARCHIVE:
|
---|
2957 | case IDM_MCIPLAY:
|
---|
2958 | case IDM_UUDECODE:
|
---|
2959 | {
|
---|
2960 | LISTINFO *li;
|
---|
2961 | ULONG action = UM_ACTION;
|
---|
2962 | # ifdef FORTIFY
|
---|
2963 | Fortify_EnterScope();
|
---|
2964 | # endif
|
---|
2965 | li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
|
---|
2966 | if (li) {
|
---|
2967 | li->type = SHORT1FROMMP(mp1);
|
---|
2968 | li->hwnd = hwnd;
|
---|
2969 | li->list = BuildList(hwnd);
|
---|
2970 | if (!li->list || !li->list[0]) {
|
---|
2971 | free(li);
|
---|
2972 | break;
|
---|
2973 | }
|
---|
2974 | if (IsRoot(li->list[0])) {
|
---|
2975 | switch (SHORT1FROMMP(mp1)) {
|
---|
2976 | case IDM_MOVE:
|
---|
2977 | case IDM_COPY:
|
---|
2978 | case IDM_WILDCOPY:
|
---|
2979 | case IDM_WILDMOVE:
|
---|
2980 | case IDM_WPSMOVE:
|
---|
2981 | case IDM_WPSCOPY:
|
---|
2982 | case IDM_RENAME:
|
---|
2983 | case IDM_DELETE:
|
---|
2984 | case IDM_PERMDELETE:
|
---|
2985 | mp1 = MPFROM2SHORT(IDM_INFO, SHORT2FROMMP(mp1));
|
---|
2986 | li->type = IDM_INFO;
|
---|
2987 | }
|
---|
2988 | }
|
---|
2989 | switch (SHORT1FROMMP(mp1)) {
|
---|
2990 | case IDM_APPENDTOCLIP:
|
---|
2991 | case IDM_SAVETOCLIP:
|
---|
2992 | case IDM_ARCHIVE:
|
---|
2993 | case IDM_DELETE:
|
---|
2994 | case IDM_PERMDELETE:
|
---|
2995 | case IDM_ATTRS:
|
---|
2996 | case IDM_SHADOW:
|
---|
2997 | case IDM_SHADOW2:
|
---|
2998 | case IDM_DOITYOURSELF:
|
---|
2999 | case IDM_EAS:
|
---|
3000 | case IDM_VIEW:
|
---|
3001 | case IDM_VIEWTEXT:
|
---|
3002 | case IDM_VIEWBINARY:
|
---|
3003 | case IDM_EDIT:
|
---|
3004 | case IDM_EDITTEXT:
|
---|
3005 | case IDM_EDITBINARY:
|
---|
3006 | case IDM_MCIPLAY:
|
---|
3007 | action = UM_MASSACTION;
|
---|
3008 | }
|
---|
3009 | if (SHORT1FROMMP(mp1) == IDM_SHADOW ||
|
---|
3010 | SHORT1FROMMP(mp1) == IDM_SHADOW2)
|
---|
3011 | *li->targetpath = 0;
|
---|
3012 | if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID)) {
|
---|
3013 | Runtime_Error(pszSrcFile, __LINE__, "PostMsg");
|
---|
3014 | FreeListInfo(li);
|
---|
3015 | }
|
---|
3016 | }
|
---|
3017 | # ifdef FORTIFY
|
---|
3018 | Fortify_LeaveScope();
|
---|
3019 | # endif
|
---|
3020 | }
|
---|
3021 | break;
|
---|
3022 |
|
---|
3023 | default:
|
---|
3024 | if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
|
---|
3025 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
|
---|
3026 |
|
---|
3027 | INT x;
|
---|
3028 |
|
---|
3029 | if (!cmdloaded)
|
---|
3030 | load_commands();
|
---|
3031 | x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
|
---|
3032 | if (x >= 0) {
|
---|
3033 | x++;
|
---|
3034 | RunCommand(hwnd, x);
|
---|
3035 | if (fUnHilite)
|
---|
3036 | UnHilite(hwnd, TRUE, &dcd->lastselection, 0);
|
---|
3037 | }
|
---|
3038 | }
|
---|
3039 | break;
|
---|
3040 | }
|
---|
3041 | }
|
---|
3042 | return 0;
|
---|
3043 |
|
---|
3044 | case WM_SAVEAPPLICATION:
|
---|
3045 | if (dcd && !ParentIsDesktop(hwnd, dcd->hwndParent)) {
|
---|
3046 |
|
---|
3047 | SWP swp, swpP;
|
---|
3048 | INT ratio;
|
---|
3049 |
|
---|
3050 | WinQueryWindowPos(dcd->hwndFrame, &swp);
|
---|
3051 | if (!(swp.fl & (SWP_MINIMIZE | SWP_MAXIMIZE | SWP_HIDE))) {
|
---|
3052 | WinQueryWindowPos(dcd->hwndParent, &swpP);
|
---|
3053 | if (swp.cx) {
|
---|
3054 | ratio = (swpP.cx * 100) / swp.cx;
|
---|
3055 | if (ratio > 0)
|
---|
3056 | PrfWriteProfileData(fmprof, appname, "TreeWindowRatio",
|
---|
3057 | &ratio, sizeof(INT));
|
---|
3058 | }
|
---|
3059 | }
|
---|
3060 | }
|
---|
3061 | else if (dcd && ParentIsDesktop(hwnd, dcd->hwndParent)) {
|
---|
3062 |
|
---|
3063 | SWP swp;
|
---|
3064 |
|
---|
3065 | WinQueryWindowPos(dcd->hwndFrame, &swp);
|
---|
3066 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE | SWP_MAXIMIZE)))
|
---|
3067 | WinStoreWindowPos(FM2Str, "VTreeWindowPos", dcd->hwndFrame);
|
---|
3068 | }
|
---|
3069 | break;
|
---|
3070 |
|
---|
3071 | case UM_MINIMIZE:
|
---|
3072 | if (dcd && hwndMain) {
|
---|
3073 | fOkayMinimize = TRUE;
|
---|
3074 | if (dcd->hwndObject && !fDummy) {
|
---|
3075 | DosSleep(50);//05 Aug 07 GKY 100
|
---|
3076 | if (!fDummy) {
|
---|
3077 | fOkayMinimize = FALSE;
|
---|
3078 | WinSetWindowPos(((hwndMain) ? WinQueryWindow(hwndMain, QW_PARENT) :
|
---|
3079 | dcd->hwndFrame), HWND_TOP, 0, 0, 0, 0,
|
---|
3080 | SWP_MINIMIZE | SWP_DEACTIVATE);
|
---|
3081 | }
|
---|
3082 | }
|
---|
3083 | }
|
---|
3084 | return 0;
|
---|
3085 |
|
---|
3086 | case UM_MAXIMIZE:
|
---|
3087 | if (dcd || hwndMain)
|
---|
3088 | WinSetWindowPos(((hwndMain) ? WinQueryWindow(hwndMain, QW_PARENT) :
|
---|
3089 | dcd->hwndFrame), HWND_TOP, 0, 0, 0, 0, SWP_MAXIMIZE |
|
---|
3090 | SWP_SHOW);
|
---|
3091 | return 0;
|
---|
3092 |
|
---|
3093 | case UM_CLOSE:
|
---|
3094 | {
|
---|
3095 | HWND hwndParent = WinQueryWindow(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
3096 | QW_PARENT),
|
---|
3097 | QW_PARENT), QW_PARENT);
|
---|
3098 |
|
---|
3099 | if (!mp1) {
|
---|
3100 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
3101 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
---|
3102 | if (hwndParent && !ParentIsDesktop(hwnd, hwndParent))
|
---|
3103 | WinDestroyWindow(hwndParent);
|
---|
3104 | }
|
---|
3105 | else
|
---|
3106 | WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
|
---|
3107 | QW_PARENT));
|
---|
3108 | }
|
---|
3109 | return 0;
|
---|
3110 |
|
---|
3111 | case WM_CLOSE:
|
---|
3112 | WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
---|
3113 | if (dcd)
|
---|
3114 | dcd->stopflag++;
|
---|
3115 | if (dcd && dcd->hwndObject) {
|
---|
3116 | /* kill object window */
|
---|
3117 | if (WinIsWindow((HAB) 0, dcd->hwndObject)) {
|
---|
3118 | if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
|
---|
3119 | WinSendMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID);
|
---|
3120 | }
|
---|
3121 | }
|
---|
3122 | else
|
---|
3123 | WinSendMsg(hwnd, UM_CLOSE, MPFROMLONG(1), MPVOID);
|
---|
3124 | return 0;
|
---|
3125 |
|
---|
3126 | case WM_DESTROY:
|
---|
3127 | # ifdef FORTIFY
|
---|
3128 | DbgMsg(pszSrcFile, __LINE__, "WM_DESTROY hwnd %p TID %u", hwnd, GetTidForThread()); // 18 Jul 08 SHL fixme
|
---|
3129 | # endif
|
---|
3130 | if (TreeCnrMenu)
|
---|
3131 | WinDestroyWindow(TreeCnrMenu);
|
---|
3132 | if (DirMenu)
|
---|
3133 | WinDestroyWindow(DirMenu);
|
---|
3134 | if (FileMenu)
|
---|
3135 | WinDestroyWindow(FileMenu);
|
---|
3136 | TreeCnrMenu = FileMenu = DirMenu = (HWND) 0;
|
---|
3137 | EmptyCnr(hwnd);
|
---|
3138 | if (apphead) {
|
---|
3139 | APPNOTIFY *info, *next;
|
---|
3140 | info = apphead;
|
---|
3141 | while (info) {
|
---|
3142 | next = info->next;
|
---|
3143 | free(info);
|
---|
3144 | info = next;
|
---|
3145 | }
|
---|
3146 | apphead = apptail = NULL;
|
---|
3147 | }
|
---|
3148 | # ifdef FORTIFY
|
---|
3149 | Fortify_LeaveScope();
|
---|
3150 | # endif
|
---|
3151 | break; // WM_DESTROY
|
---|
3152 | } // switch
|
---|
3153 | if (dcd && dcd->oldproc){
|
---|
3154 | return dcd->oldproc(hwnd, msg, mp1, mp2);
|
---|
3155 | }
|
---|
3156 | else
|
---|
3157 | return PFNWPCnr(hwnd, msg, mp1, mp2);
|
---|
3158 | }
|
---|
3159 |
|
---|
3160 | HWND StartTreeCnr(HWND hwndParent, ULONG flags)
|
---|
3161 | {
|
---|
3162 | /* bitmapped flags:
|
---|
3163 | * 0x00000001 = don't close app when window closes
|
---|
3164 | * 0x00000002 = no frame controls
|
---|
3165 | * 0x00000004 = no close or move button
|
---|
3166 | */
|
---|
3167 |
|
---|
3168 | HWND hwndFrame = NULLHANDLE;
|
---|
3169 | HWND hwndSysMenu = NULLHANDLE;
|
---|
3170 | HWND hwndClient;
|
---|
3171 | ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
|
---|
3172 | FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_NOBYTEALIGN | FCF_ACCELTABLE;
|
---|
3173 | DIRCNRDATA *dcd;
|
---|
3174 |
|
---|
3175 | if (!hwndParent)
|
---|
3176 | hwndParent = HWND_DESKTOP;
|
---|
3177 | if (ParentIsDesktop(hwndParent, hwndParent))
|
---|
3178 | FrameFlags |= (FCF_TASKLIST | FCF_MENU);
|
---|
3179 | if (flags & 2)
|
---|
3180 | FrameFlags &= (~(FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER |
|
---|
3181 | FCF_MINMAX | FCF_ICON));
|
---|
3182 | hwndFrame = WinCreateStdWindow(hwndParent,
|
---|
3183 | WS_VISIBLE,
|
---|
3184 | &FrameFlags,
|
---|
3185 | WC_TREECONTAINER,
|
---|
3186 | NULL,
|
---|
3187 | WS_VISIBLE | fwsAnimate,
|
---|
3188 | FM3ModHandle, TREE_FRAME, &hwndClient);
|
---|
3189 | if (hwndParent != HWND_DESKTOP) {
|
---|
3190 | hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU);
|
---|
3191 | if (hwndSysMenu != NULLHANDLE)
|
---|
3192 | WinSendMsg(hwndSysMenu, MM_SETITEMATTR,
|
---|
3193 | MPFROM2SHORT(SC_CLOSE, TRUE),
|
---|
3194 | MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED));
|
---|
3195 | if (!fFreeTree)
|
---|
3196 | WinSendMsg(hwndSysMenu, MM_SETITEMATTR,
|
---|
3197 | MPFROM2SHORT(SC_MOVE, TRUE),
|
---|
3198 | MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED));
|
---|
3199 | }
|
---|
3200 | if (hwndFrame && hwndClient) {
|
---|
3201 | # ifdef FORTIFY
|
---|
3202 | Fortify_EnterScope();
|
---|
3203 | # endif
|
---|
3204 | dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__);
|
---|
3205 | if (!dcd) {
|
---|
3206 | Runtime_Error(pszSrcFile, __LINE__, GetPString(IDS_OUTOFMEMORY));
|
---|
3207 | PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
|
---|
3208 | hwndFrame = (HWND) 0;
|
---|
3209 | }
|
---|
3210 | else {
|
---|
3211 | SWP swp;
|
---|
3212 | WinQueryWindowPos(hwndFrame, &swp);
|
---|
3213 | if (*(ULONG *) realappname == FM3UL) {
|
---|
3214 | if (!WinCreateWindow(hwndFrame,
|
---|
3215 | WC_TREEOPENBUTTON,
|
---|
3216 | "#303",
|
---|
3217 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS | BS_BITMAP,
|
---|
3218 | ((swp.cx -
|
---|
3219 | WinQuerySysValue(HWND_DESKTOP,
|
---|
3220 | SV_CXMINMAXBUTTON)) -
|
---|
3221 | WinQuerySysValue(HWND_DESKTOP,
|
---|
3222 | SV_CXMINMAXBUTTON) / 2) -
|
---|
3223 | WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER),
|
---|
3224 | (swp.cy -
|
---|
3225 | WinQuerySysValue(HWND_DESKTOP,
|
---|
3226 | SV_CYMINMAXBUTTON)) -
|
---|
3227 | WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER),
|
---|
3228 | WinQuerySysValue(HWND_DESKTOP,
|
---|
3229 | SV_CXMINMAXBUTTON) / 2,
|
---|
3230 | WinQuerySysValue(HWND_DESKTOP,
|
---|
3231 | SV_CYMINMAXBUTTON), hwndFrame,
|
---|
3232 | HWND_TOP, IDM_OPENWINDOW, NULL, NULL)) {
|
---|
3233 | Win_Error2(hwndFrame, hwndParent, pszSrcFile, __LINE__,
|
---|
3234 | IDS_WINCREATEWINDOW);
|
---|
3235 | }
|
---|
3236 | }
|
---|
3237 | else {
|
---|
3238 | if (!WinCreateWindow(hwndFrame,
|
---|
3239 | WC_TREESTATUS,
|
---|
3240 | GetPString(IDS_YOUAREHERETEXT),
|
---|
3241 | WS_VISIBLE | SS_TEXT | DT_LEFT | DT_VCENTER,
|
---|
3242 | swp.x + 4 + WinQuerySysValue(HWND_DESKTOP,
|
---|
3243 | SV_CXSIZEBORDER),
|
---|
3244 | swp.cy - (22 + WinQuerySysValue(HWND_DESKTOP,
|
---|
3245 | SV_CYSIZEBORDER)),
|
---|
3246 | (swp.cx - 8) - (WinQuerySysValue(HWND_DESKTOP,
|
---|
3247 | SV_CXSIZEBORDER)
|
---|
3248 | * 2), 22, hwndFrame, HWND_TOP,
|
---|
3249 | MAIN_STATUS, NULL, NULL)) {
|
---|
3250 | Win_Error2(hwndFrame, hwndParent, pszSrcFile, __LINE__,
|
---|
3251 | IDS_WINCREATEWINDOW);
|
---|
3252 | }
|
---|
3253 | }
|
---|
3254 | memset(dcd, 0, sizeof(DIRCNRDATA));
|
---|
3255 | dcd->size = sizeof(DIRCNRDATA);
|
---|
3256 | dcd->type = TREE_FRAME;
|
---|
3257 | dcd->dontclose = ((flags & 1) != 0);
|
---|
3258 | dcd->hwndParent = (hwndParent) ? hwndParent : HWND_DESKTOP;
|
---|
3259 | dcd->hwndClient = hwndClient;
|
---|
3260 | dcd->hwndFrame = hwndFrame;
|
---|
3261 | {
|
---|
3262 | PFNWP oldproc;
|
---|
3263 |
|
---|
3264 | oldproc = WinSubclassWindow(hwndFrame, TreeFrameWndProc);
|
---|
3265 | WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
|
---|
3266 | oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, FID_TITLEBAR),
|
---|
3267 | (PFNWP) TreeTitleWndProc);
|
---|
3268 | WinSetWindowPtr(WinWindowFromID(hwndFrame, FID_TITLEBAR),
|
---|
3269 | QWL_USER, (PVOID) oldproc);
|
---|
3270 | }
|
---|
3271 | dcd->hwndCnr = WinCreateWindow(hwndClient,
|
---|
3272 | WC_CONTAINER,
|
---|
3273 | NULL,
|
---|
3274 | CCS_AUTOPOSITION | CCS_MINIICONS |
|
---|
3275 | CCS_MINIRECORDCORE, //| WS_VISIBLE,
|
---|
3276 | 0,
|
---|
3277 | 0,
|
---|
3278 | 0,
|
---|
3279 | 0,
|
---|
3280 | hwndClient,
|
---|
3281 | HWND_TOP, (ULONG) TREE_CNR, NULL, NULL);
|
---|
3282 | if (!dcd->hwndCnr) {
|
---|
3283 | Win_Error2(hwndClient, hwndClient, pszSrcFile, __LINE__,
|
---|
3284 | IDS_WINCREATEWINDOW);
|
---|
3285 | PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
|
---|
3286 | free(dcd);
|
---|
3287 | dcd = 0;
|
---|
3288 | hwndFrame = (HWND) 0;
|
---|
3289 | }
|
---|
3290 | else {
|
---|
3291 | WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
|
---|
3292 | if (ParentIsDesktop(hwndFrame, hwndParent)) {
|
---|
3293 | WinSetWindowText(WinWindowFromID(hwndFrame, FID_TITLEBAR), "VTree");
|
---|
3294 | FixSwitchList(hwndFrame, "VTree");
|
---|
3295 | }
|
---|
3296 | else {
|
---|
3297 | WinSetWindowText(hwndFrame, GetPString(IDS_TREETEXT));
|
---|
3298 | WinSetWindowText(WinWindowFromID(hwndFrame, FID_TITLEBAR),
|
---|
3299 | GetPString(IDS_TREETEXT));
|
---|
3300 | }
|
---|
3301 | dcd->oldproc = WinSubclassWindow(dcd->hwndCnr, TreeCnrWndProc);
|
---|
3302 | // DbgMsg(pszSrcFile, __LINE__, "oldproc subclass %X", dcd->oldproc); // 05 Jul 07 SHL
|
---|
3303 | // fixme to document 01 test?
|
---|
3304 | if (dcd->oldproc == 0)
|
---|
3305 | Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
3306 | "WinSubclassWindow");
|
---|
3307 | if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
|
---|
3308 | WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
|
---|
3309 | }
|
---|
3310 | }
|
---|
3311 | # ifdef FORTIFY
|
---|
3312 | if (dcd)
|
---|
3313 | Fortify_ChangeScope(dcd, -1);
|
---|
3314 | Fortify_LeaveScope();
|
---|
3315 | if (dcd)
|
---|
3316 | Fortify_ChangeScope(dcd, +1);
|
---|
3317 | # endif
|
---|
3318 | }
|
---|
3319 | return hwndFrame;
|
---|
3320 | }
|
---|
3321 |
|
---|
3322 | #pragma alloc_text(TREECNR,TreeCnrWndProc,TreeObjWndProc,TreeClientWndProc)
|
---|
3323 | #pragma alloc_text(TREECNR,TreeFrameWndProc,TreeTitleWndProc,ShowTreeRec)
|
---|
3324 | #pragma alloc_text(TREECNR,TreeStatProc,OpenButtonProc)
|
---|
3325 | #pragma alloc_text(STARTUP,StartTreeCnr)
|
---|