1 |
|
---|
2 | /***********************************************************************
|
---|
3 |
|
---|
4 | $Id: mainwnd2.c 953 2008-02-16 02:15:16Z stevenhl $
|
---|
5 |
|
---|
6 | fm/4 main window
|
---|
7 |
|
---|
8 | Copyright (c) 1993-98 M. Kimes
|
---|
9 | Copyright (c) 2005, 2008 Steven H. Levine
|
---|
10 |
|
---|
11 | 23 May 05 SHL Use datamin.h
|
---|
12 | 26 May 05 SHL Comments and localize code
|
---|
13 | 06 Aug 05 SHL Renames
|
---|
14 | 02 Jan 06 SHL Use QWL_USER more
|
---|
15 | 02 Jan 06 SHL Map IDM_WINDOWDLG to match IBM_TWODIRS
|
---|
16 | 17 Jul 06 SHL Use Runtime_Error
|
---|
17 | 30 Mar 07 GKY Remove GetPString for window class names
|
---|
18 | 12 May 07 SHL Pass ulItemsToUnHilite to UnHilite
|
---|
19 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
|
---|
20 | 07 Aug 07 SHL Use BldQuotedFileName
|
---|
21 | 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
|
---|
22 | 10 Jan 08 SHL Sync with CfgDlgProc mods
|
---|
23 | 19 Jan 08 GKY Rework Utilities menu
|
---|
24 | 14 Feb 08 SHL Rework to support settings menu conditional cascade
|
---|
25 |
|
---|
26 | ***********************************************************************/
|
---|
27 |
|
---|
28 | #include <stdlib.h>
|
---|
29 | #include <string.h>
|
---|
30 | #include <share.h>
|
---|
31 | #include <process.h> // _beginthread
|
---|
32 |
|
---|
33 | #define INCL_DOS
|
---|
34 | #define INCL_WIN
|
---|
35 | #define INCL_GPI
|
---|
36 | #define INCL_LONGLONG
|
---|
37 |
|
---|
38 | #include "fm3dlg.h"
|
---|
39 | #include "fm3str.h"
|
---|
40 | #include "tools.h"
|
---|
41 | #include "datamin.h"
|
---|
42 | #include "comp.h" // COMPARE
|
---|
43 | #include "arccnrs.h" // BldQuotedFileName
|
---|
44 | #include "errutil.h" // Dos_Error...
|
---|
45 | #include "strutil.h" // GetPString
|
---|
46 | #include "notebook.h" // CfgDlgProc
|
---|
47 | #include "fm3dll.h"
|
---|
48 |
|
---|
49 | typedef struct
|
---|
50 | {
|
---|
51 | USHORT size;
|
---|
52 | USHORT dummy;
|
---|
53 | HWND hwndDir1;
|
---|
54 | HWND hwndDir2;
|
---|
55 | HWND hwndCurr;
|
---|
56 | HWND hwndLastDir;
|
---|
57 | HWND hwndMax;
|
---|
58 | }
|
---|
59 | PERSON1DATA;
|
---|
60 |
|
---|
61 | static PSZ pszSrcFile = __FILE__;
|
---|
62 |
|
---|
63 | static MRESULT EXPENTRY MainFrameWndProc2(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
64 | MPARAM mp2)
|
---|
65 | {
|
---|
66 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
67 |
|
---|
68 | switch (msg) {
|
---|
69 | case WM_ADJUSTWINDOWPOS:
|
---|
70 | {
|
---|
71 | SWP *pswp;
|
---|
72 |
|
---|
73 | pswp = (SWP *) mp1;
|
---|
74 | if (pswp->fl & (SWP_SHOW | SWP_RESTORE))
|
---|
75 | PostMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_SIZE, MPVOID, MPVOID);
|
---|
76 | if (fDataMin && !fAmClosing) {
|
---|
77 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
---|
78 |
|
---|
79 | SWP swp;
|
---|
80 |
|
---|
81 | WinQueryWindowPos(hwnd, &swp);
|
---|
82 | PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID);
|
---|
83 | HideNote();
|
---|
84 | }
|
---|
85 | else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) {
|
---|
86 | if (DataHwnd)
|
---|
87 | PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
88 | }
|
---|
89 | }
|
---|
90 | if (!fAmClosing) {
|
---|
91 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
92 | HideNote();
|
---|
93 | }
|
---|
94 | }
|
---|
95 | break;
|
---|
96 |
|
---|
97 | case UM_FOCUSME:
|
---|
98 | CreateDataBar(HWND_DESKTOP, (ULONG) mp1);
|
---|
99 | return 0;
|
---|
100 |
|
---|
101 | case WM_BUTTON1UP:
|
---|
102 | case WM_BUTTON2UP:
|
---|
103 | case WM_BUTTON3UP:
|
---|
104 | case WM_MOUSEMOVE:
|
---|
105 | case WM_CHORD:
|
---|
106 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
107 | break;
|
---|
108 |
|
---|
109 | case WM_CHAR:
|
---|
110 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
111 | break;
|
---|
112 |
|
---|
113 | case WM_CONTROL:
|
---|
114 | return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_CONTROL, mp1,
|
---|
115 | mp2);
|
---|
116 |
|
---|
117 | case WM_COMMAND:
|
---|
118 | return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
|
---|
119 |
|
---|
120 | case WM_CALCFRAMERECT:
|
---|
121 | {
|
---|
122 | MRESULT mr;
|
---|
123 | PRECTL prectl;
|
---|
124 | LONG sheight = 20, bheight = 20;
|
---|
125 |
|
---|
126 | mr = (oldproc) ? oldproc(hwnd, msg, mp1, mp2) :
|
---|
127 | PFNWPFrame(hwnd, msg, mp1, mp2);
|
---|
128 |
|
---|
129 | /*
|
---|
130 | * Calculate the position of the client rectangle.
|
---|
131 | * Otherwise, we'll see a lot of redraw when we move the
|
---|
132 | * client during WM_FORMATFRAME.
|
---|
133 | */
|
---|
134 |
|
---|
135 | if (mr && mp2) {
|
---|
136 | prectl = (PRECTL) mp1;
|
---|
137 | if (prectl->yBottom != prectl->yTop) {
|
---|
138 | {
|
---|
139 | HPS hps;
|
---|
140 | POINTL aptl[TXTBOX_COUNT];
|
---|
141 |
|
---|
142 | hps = WinGetPS(hwndStatus);
|
---|
143 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
144 | WinReleasePS(hps);
|
---|
145 | sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
146 | hps = WinGetPS(hwndName);
|
---|
147 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
148 | WinReleasePS(hps);
|
---|
149 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
150 | }
|
---|
151 | prectl->yBottom += (sheight + 4);
|
---|
152 | prectl->yTop -= (sheight + 4);
|
---|
153 | prectl->yBottom += (bheight + 4);
|
---|
154 | prectl->yTop -= (bheight + 4);
|
---|
155 | if (fToolbar) {
|
---|
156 | if (!fTextTools)
|
---|
157 | prectl->yTop -= ((fToolTitles) ? 50 : 40);
|
---|
158 | else
|
---|
159 | prectl->yTop -= 32;
|
---|
160 | }
|
---|
161 | ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES),
|
---|
162 | ((prectl->xRight -
|
---|
163 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
164 | SV_CYSIZEBORDER) * 2)) - 4));
|
---|
165 | prectl->yTop -= (16 * (DriveLines * 18));
|
---|
166 | prectl->yTop -= 2;
|
---|
167 | if (fAutoView) {
|
---|
168 | AutoviewHeight = min(AutoviewHeight,
|
---|
169 | (prectl->yTop - prectl->yBottom) - 116);
|
---|
170 | AutoviewHeight = max(AutoviewHeight, 36);
|
---|
171 | prectl->yBottom += (AutoviewHeight + 6);
|
---|
172 | }
|
---|
173 | }
|
---|
174 | }
|
---|
175 | return mr;
|
---|
176 | }
|
---|
177 |
|
---|
178 | case WM_FORMATFRAME:
|
---|
179 | {
|
---|
180 | SHORT sCount, soldCount;
|
---|
181 | PSWP pswp, pswpClient, pswpNew;
|
---|
182 | SWP swpClient;
|
---|
183 | ULONG theight = 48L, dheight = 20, bheight = 20, sheight = 20;
|
---|
184 | LONG width, lastx;
|
---|
185 |
|
---|
186 | sCount = (SHORT) ((oldproc) ? oldproc(hwnd, msg, mp1, mp2) :
|
---|
187 | PFNWPFrame(hwnd, msg, mp1, mp2));
|
---|
188 | soldCount = sCount;
|
---|
189 | /*
|
---|
190 | * Reformat the frame to "squeeze" the client
|
---|
191 | * and make room for status window sibling beneath
|
---|
192 | * and toolbar above (if toolbar's on) and userlists
|
---|
193 | * (if userlists are on).
|
---|
194 | */
|
---|
195 |
|
---|
196 | pswp = (PSWP) mp1;
|
---|
197 | {
|
---|
198 | SHORT x;
|
---|
199 |
|
---|
200 | for (x = 0; x < sCount; x++) {
|
---|
201 | if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {
|
---|
202 | pswpClient = pswp;
|
---|
203 | break;
|
---|
204 | }
|
---|
205 | pswp++;
|
---|
206 | }
|
---|
207 | }
|
---|
208 |
|
---|
209 | {
|
---|
210 | HPS hps;
|
---|
211 | POINTL aptl[TXTBOX_COUNT];
|
---|
212 |
|
---|
213 | hps = WinGetPS(hwndStatus);
|
---|
214 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
215 | WinReleasePS(hps);
|
---|
216 | bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
217 | hps = WinGetPS(hwndName);
|
---|
218 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
219 | WinReleasePS(hps);
|
---|
220 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
221 | }
|
---|
222 |
|
---|
223 | pswpNew = (PSWP) mp1 + soldCount;
|
---|
224 | *pswpNew = *pswpClient;
|
---|
225 | swpClient = *pswpClient;
|
---|
226 | pswpNew->hwnd = hwndStatus;
|
---|
227 | pswpNew->x = swpClient.x + 3;
|
---|
228 | pswpNew->y = swpClient.y + 2;
|
---|
229 | width = (swpClient.cx / 2) - 6;
|
---|
230 | width = max(width, 10);
|
---|
231 | pswpNew->cx = width - 6;
|
---|
232 | pswpNew->cy = sheight;
|
---|
233 | pswpClient->y = pswpNew->y + pswpNew->cy + 3;
|
---|
234 | pswpClient->cy = (swpClient.cy - pswpNew->cy) - 3;
|
---|
235 | sCount++;
|
---|
236 |
|
---|
237 | pswpNew = (PSWP) mp1 + (soldCount + 1);
|
---|
238 | *pswpNew = *pswpClient;
|
---|
239 | pswpNew->hwnd = hwndStatus2;
|
---|
240 | pswpNew->x = width + 8;
|
---|
241 | pswpNew->y = swpClient.y + 2;
|
---|
242 | pswpNew->cx = width - 6;
|
---|
243 | pswpNew->cy = sheight;
|
---|
244 | sCount++;
|
---|
245 |
|
---|
246 | if (fToolbar) {
|
---|
247 | if (fTextTools)
|
---|
248 | theight = 32L;
|
---|
249 | else if (!fToolTitles)
|
---|
250 | theight = 40L;
|
---|
251 | pswpNew = (PSWP) mp1 + (soldCount + 2);
|
---|
252 | *pswpNew = *pswpClient;
|
---|
253 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS);
|
---|
254 | pswpNew->x = swpClient.x + 2;
|
---|
255 | pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2);
|
---|
256 | pswpNew->cx = swpClient.cx - 4;
|
---|
257 | pswpNew->cy = theight - 4;
|
---|
258 | pswpClient->cy -= theight;
|
---|
259 | sCount++;
|
---|
260 | }
|
---|
261 | else
|
---|
262 | WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE);
|
---|
263 |
|
---|
264 | ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4);
|
---|
265 | pswpNew = (PSWP) mp1 + (soldCount + 2 + (fToolbar != FALSE));
|
---|
266 | *pswpNew = *pswpClient;
|
---|
267 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES);
|
---|
268 | pswpNew->x = swpClient.x + 2;
|
---|
269 | dheight += ((dheight - 2) * DriveLines);
|
---|
270 | pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);
|
---|
271 | if (fToolbar)
|
---|
272 | pswpNew->y -= theight;
|
---|
273 | pswpNew->cx = swpClient.cx - 4;
|
---|
274 | pswpNew->cy = dheight - 4;
|
---|
275 | pswpClient->cy -= dheight;
|
---|
276 | pswpClient->cy -= 2;
|
---|
277 | sCount++;
|
---|
278 |
|
---|
279 | if (fAutoView) {
|
---|
280 | pswpNew = (PSWP) mp1 + (soldCount + 3 + (fToolbar != FALSE));
|
---|
281 | *pswpNew = *pswpClient;
|
---|
282 | pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview;
|
---|
283 | pswpNew->x = pswpClient->x + 3;
|
---|
284 | pswpNew->y = pswpClient->y + 3;
|
---|
285 | if (fMoreButtons)
|
---|
286 | pswpNew->y += (bheight + 4);
|
---|
287 | pswpNew->cx = pswpClient->cx - 6;
|
---|
288 | AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116);
|
---|
289 | AutoviewHeight = max(AutoviewHeight, 36);
|
---|
290 | pswpNew->cy = AutoviewHeight;
|
---|
291 | pswpClient->y += (AutoviewHeight + 6);
|
---|
292 | pswpClient->cy -= (AutoviewHeight + 6);
|
---|
293 | sCount++;
|
---|
294 | WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE);
|
---|
295 | }
|
---|
296 | else {
|
---|
297 | WinShowWindow(hwndAutoview, FALSE);
|
---|
298 | WinShowWindow(hwndAutoMLE, FALSE);
|
---|
299 | }
|
---|
300 |
|
---|
301 | pswpNew = (PSWP) mp1 + (soldCount + 3 + (fToolbar != FALSE) +
|
---|
302 | (fAutoView != FALSE));
|
---|
303 | *pswpNew = *pswpClient;
|
---|
304 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LED);
|
---|
305 | pswpNew->x = (swpClient.x + swpClient.cx) - 12;
|
---|
306 | pswpNew->y = swpClient.y;
|
---|
307 | pswpNew->cx = 12;
|
---|
308 | pswpNew->cy = 12;
|
---|
309 | sCount++;
|
---|
310 |
|
---|
311 | pswpNew = (PSWP) mp1 + (soldCount + 4 + (fToolbar != FALSE) +
|
---|
312 | (fAutoView != FALSE));
|
---|
313 | *pswpNew = *pswpClient;
|
---|
314 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LEDHDR);
|
---|
315 | pswpNew->x = (swpClient.x + swpClient.cx) - 12;
|
---|
316 | pswpNew->y = swpClient.y + 12;
|
---|
317 | pswpNew->cx = 12;
|
---|
318 | pswpNew->cy = sheight - 8;
|
---|
319 | sCount++;
|
---|
320 |
|
---|
321 | pswpNew = (PSWP) mp1 + (soldCount + 5 + (fToolbar != FALSE) +
|
---|
322 | (fAutoView != FALSE));
|
---|
323 | *pswpNew = *pswpClient;
|
---|
324 | pswpNew->hwnd = hwndName;
|
---|
325 | pswpNew->x = swpClient.x + 3;
|
---|
326 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
327 | pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3;
|
---|
328 | lastx = pswpNew->x + pswpNew->cx;
|
---|
329 | pswpNew->cy = bheight;
|
---|
330 | pswpClient->y += (bheight + 4);
|
---|
331 | pswpClient->cy -= (bheight + 4);
|
---|
332 | sCount++;
|
---|
333 |
|
---|
334 | pswpNew = (PSWP) mp1 + (soldCount + 6 + (fToolbar != FALSE) +
|
---|
335 | (fAutoView != FALSE));
|
---|
336 | *pswpNew = *pswpClient;
|
---|
337 | pswpNew->hwnd = hwndDate;
|
---|
338 | pswpNew->x = lastx + 3;
|
---|
339 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
340 | pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3;
|
---|
341 | lastx = pswpNew->x + pswpNew->cx;
|
---|
342 | pswpNew->cy = bheight;
|
---|
343 | sCount++;
|
---|
344 |
|
---|
345 | pswpNew = (PSWP) mp1 + (soldCount + 7 + (fToolbar != FALSE) +
|
---|
346 | (fAutoView != FALSE));
|
---|
347 | *pswpNew = *pswpClient;
|
---|
348 | pswpNew->hwnd = hwndAttr;
|
---|
349 | pswpNew->x = lastx + 3;
|
---|
350 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
351 | pswpNew->cx = (swpClient.cx - pswpNew->x) - 1;
|
---|
352 | pswpNew->cy = bheight;
|
---|
353 | sCount++;
|
---|
354 |
|
---|
355 | return MRFROMSHORT(sCount);
|
---|
356 | }
|
---|
357 |
|
---|
358 | case WM_QUERYFRAMECTLCOUNT:
|
---|
359 | {
|
---|
360 | SHORT sCount;
|
---|
361 |
|
---|
362 | sCount = (SHORT) ((oldproc) ? oldproc(hwnd, msg, mp1, mp2) :
|
---|
363 | PFNWPFrame(hwnd, msg, mp1, mp2));
|
---|
364 | sCount += 8;
|
---|
365 | if (fToolbar)
|
---|
366 | sCount++;
|
---|
367 | if (fAutoView)
|
---|
368 | sCount++;
|
---|
369 | return MRFROMSHORT(sCount);
|
---|
370 | }
|
---|
371 |
|
---|
372 | case WM_CLOSE:
|
---|
373 | WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
|
---|
374 | return 0;
|
---|
375 | }
|
---|
376 | return (oldproc) ? oldproc(hwnd, msg, mp1, mp2) :
|
---|
377 | PFNWPFrame(hwnd, msg, mp1, mp2);
|
---|
378 | }
|
---|
379 |
|
---|
380 | static MRESULT EXPENTRY MainWMCommand2(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
381 | MPARAM mp2)
|
---|
382 | {
|
---|
383 | PERSON1DATA *pd;
|
---|
384 |
|
---|
385 | SetShiftState();
|
---|
386 | switch (SHORT1FROMMP(mp1)) {
|
---|
387 | case IDM_TOAUTOMLE:
|
---|
388 | case IDM_CLI:
|
---|
389 | case IDM_CREATETOOL:
|
---|
390 | case IDM_ABOUT:
|
---|
391 | case IDM_WINFULLSCREEN:
|
---|
392 | case IDM_DOSCOMMANDLINE:
|
---|
393 | case IDM_INIVIEWER:
|
---|
394 | case IDM_EDITASSOC:
|
---|
395 | case IDM_COMMANDLINE:
|
---|
396 | case IDM_KILLPROC:
|
---|
397 | case IDM_TOOLBAR:
|
---|
398 | case IDM_TEXTTOOLS:
|
---|
399 | case IDM_TOOLTITLES:
|
---|
400 | case IDM_TOOLLEFT:
|
---|
401 | case IDM_TOOLRIGHT:
|
---|
402 | case IDM_AUTOVIEWCOMMENTS:
|
---|
403 | case IDM_AUTOVIEWFILE:
|
---|
404 | case IDM_AUTOVIEW:
|
---|
405 | // case IDM_SYSINFO:
|
---|
406 | case IDM_HIDENOTEWND:
|
---|
407 | case IDM_SHOWNOTEWND:
|
---|
408 | case IDM_INSTANT:
|
---|
409 | case IDM_HELPCONTEXT:
|
---|
410 | case IDM_HELPHINTS:
|
---|
411 | case IDM_HELPPIX:
|
---|
412 | case IDM_KILLME:
|
---|
413 | case IDM_EXIT:
|
---|
414 | case IDM_HELPTUTOR:
|
---|
415 | case IDM_HELPCONTENTS:
|
---|
416 | case IDM_HELPGENERAL:
|
---|
417 | case IDM_HELPKEYS:
|
---|
418 | case IDM_HELPMOUSE:
|
---|
419 | case IDM_HELP:
|
---|
420 | return MainWMCommand(hwnd, msg, mp1, mp2);
|
---|
421 |
|
---|
422 | case IDM_REMAP:
|
---|
423 | WinDlgBox(HWND_DESKTOP,
|
---|
424 | hwnd, RemapDlgProc, FM3ModHandle, MAP_FRAME, NULL);
|
---|
425 | break;
|
---|
426 |
|
---|
427 | case IDM_TWODIRS: // Menu action
|
---|
428 | case IDM_WINDOWDLG: // Toolbar action
|
---|
429 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
430 | if (pd) {
|
---|
431 |
|
---|
432 | WALK2 wa;
|
---|
433 |
|
---|
434 | memset(&wa, 0, sizeof(wa));
|
---|
435 | wa.size = sizeof(wa);
|
---|
436 | *wa.szCurrentPath1 = 0;
|
---|
437 | WinSendMsg(pd->hwndDir1,
|
---|
438 | UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath1), MPVOID);
|
---|
439 | MakeValidDir(wa.szCurrentPath1);
|
---|
440 | *wa.szCurrentPath2 = 0;
|
---|
441 | WinSendMsg(pd->hwndDir2,
|
---|
442 | UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath2), MPVOID);
|
---|
443 | MakeValidDir(wa.szCurrentPath2);
|
---|
444 | if (WinDlgBox(HWND_DESKTOP,
|
---|
445 | hwnd,
|
---|
446 | WalkTwoSetDlgProc,
|
---|
447 | FM3ModHandle,
|
---|
448 | WALK2_FRAME,
|
---|
449 | MPFROMP(&wa)) &&
|
---|
450 | (IsRoot(wa.szCurrentPath1) ||
|
---|
451 | !IsFile(wa.szCurrentPath1)) &&
|
---|
452 | (IsRoot(wa.szCurrentPath2) || !IsFile(wa.szCurrentPath2))) {
|
---|
453 | WinSendMsg(WinWindowFromID(WinWindowFromID(pd->hwndDir1,
|
---|
454 | FID_CLIENT), DIR_CNR),
|
---|
455 | UM_SETDIR, MPFROMP(wa.szCurrentPath1), MPVOID);
|
---|
456 | WinSendMsg(WinWindowFromID(WinWindowFromID(pd->hwndDir2,
|
---|
457 | FID_CLIENT), DIR_CNR),
|
---|
458 | UM_SETDIR, MPFROMP(wa.szCurrentPath2), MPVOID);
|
---|
459 | }
|
---|
460 | }
|
---|
461 | break;
|
---|
462 |
|
---|
463 | case IDM_COMPARE:
|
---|
464 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
465 | if (pd) {
|
---|
466 |
|
---|
467 | WALK2 wa;
|
---|
468 |
|
---|
469 | memset(&wa, 0, sizeof(wa));
|
---|
470 | wa.size = sizeof(wa);
|
---|
471 | *wa.szCurrentPath1 = 0;
|
---|
472 | WinSendMsg(pd->hwndDir1,
|
---|
473 | UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath1), MPVOID);
|
---|
474 | MakeValidDir(wa.szCurrentPath1);
|
---|
475 | *wa.szCurrentPath2 = 0;
|
---|
476 | WinSendMsg(pd->hwndDir2,
|
---|
477 | UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath2), MPVOID);
|
---|
478 | MakeValidDir(wa.szCurrentPath2);
|
---|
479 | if (WinDlgBox(HWND_DESKTOP,
|
---|
480 | hwnd,
|
---|
481 | WalkTwoCmpDlgProc,
|
---|
482 | FM3ModHandle,
|
---|
483 | WALK2_FRAME,
|
---|
484 | MPFROMP(&wa)) &&
|
---|
485 | (IsRoot(wa.szCurrentPath1) ||
|
---|
486 | !IsFile(wa.szCurrentPath1)) &&
|
---|
487 | (IsRoot(wa.szCurrentPath2) || !IsFile(wa.szCurrentPath2))) {
|
---|
488 | if (!*dircompare) {
|
---|
489 |
|
---|
490 | COMPARE *cmp;
|
---|
491 |
|
---|
492 | cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
|
---|
493 | if (cmp) {
|
---|
494 | cmp->size = sizeof(COMPARE);
|
---|
495 | strcpy(cmp->leftdir, wa.szCurrentPath1);
|
---|
496 | strcpy(cmp->rightdir, wa.szCurrentPath2);
|
---|
497 | cmp->hwndParent = hwnd;
|
---|
498 | cmp->dcd.hwndParent = hwnd;
|
---|
499 | WinDlgBox(HWND_DESKTOP,
|
---|
500 | HWND_DESKTOP,
|
---|
501 | CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
|
---|
502 | }
|
---|
503 | }
|
---|
504 | else {
|
---|
505 | CHAR szPath1[CCHMAXPATH];
|
---|
506 | CHAR szPath2[CCHMAXPATH];
|
---|
507 | runemf2(SEPARATE,
|
---|
508 | HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
509 | NULL, NULL,
|
---|
510 | "%s %s %s",
|
---|
511 | dircompare,
|
---|
512 | BldQuotedFileName(szPath1, wa.szCurrentPath1),
|
---|
513 | BldQuotedFileName(szPath2, wa.szCurrentPath2));
|
---|
514 | }
|
---|
515 | }
|
---|
516 | }
|
---|
517 | break;
|
---|
518 |
|
---|
519 | case IDM_VTREE:
|
---|
520 | WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
|
---|
521 | if (hwndTree) {
|
---|
522 | WinShowWindow(hwndTree, FALSE);
|
---|
523 | PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID);
|
---|
524 | hwndTree = (HWND) 0;
|
---|
525 | }
|
---|
526 | else {
|
---|
527 |
|
---|
528 | ULONG size = sizeof(ULONG);
|
---|
529 |
|
---|
530 | hwndTree = StartTreeCnr(hwnd, 3);
|
---|
531 | PrfQueryProfileData(fmprof,
|
---|
532 | realappname,
|
---|
533 | "FM/4 TreeWidth", (PVOID) & TreeWidth, &size);
|
---|
534 | TreeWidth = max(TreeWidth, 80);
|
---|
535 | }
|
---|
536 | {
|
---|
537 | BOOL dummy = (hwndTree != (HWND) 0);
|
---|
538 |
|
---|
539 | PrfWriteProfileData(fmprof,
|
---|
540 | realappname,
|
---|
541 | "FM/4 TreeUp", (PVOID) & dummy, sizeof(dummy));
|
---|
542 | }
|
---|
543 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
544 | break;
|
---|
545 |
|
---|
546 | case IDM_TILEBACKWARDS:
|
---|
547 | WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
|
---|
548 | fTileBackwards = (fTileBackwards) ? FALSE : TRUE;
|
---|
549 | PrfWriteProfileData(fmprof,
|
---|
550 | FM3Str,
|
---|
551 | "TileBackwards",
|
---|
552 | (PVOID) & fTileBackwards, sizeof(BOOL));
|
---|
553 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
554 | break;
|
---|
555 |
|
---|
556 | case IDM_NEXTWINDOW:
|
---|
557 | case IDM_PREVWINDOW:
|
---|
558 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
559 | if (pd) {
|
---|
560 |
|
---|
561 | HWND hwndFocus;
|
---|
562 |
|
---|
563 | if (hwndTree) {
|
---|
564 | if (pd->hwndMax) {
|
---|
565 | if (hwndTree == pd->hwndCurr)
|
---|
566 | hwndFocus = pd->hwndMax;
|
---|
567 | else
|
---|
568 | hwndFocus = hwndTree;
|
---|
569 | }
|
---|
570 | else {
|
---|
571 | if (hwndTree == pd->hwndCurr)
|
---|
572 | hwndFocus = (SHORT1FROMMP(mp1) == IDM_PREVWINDOW) ?
|
---|
573 | pd->hwndDir1 : pd->hwndDir2;
|
---|
574 | else if (pd->hwndDir1 == pd->hwndCurr)
|
---|
575 | hwndFocus = (SHORT1FROMMP(mp1) == IDM_PREVWINDOW) ?
|
---|
576 | pd->hwndDir2 : hwndTree;
|
---|
577 | else
|
---|
578 | hwndFocus = (SHORT1FROMMP(mp1) == IDM_PREVWINDOW) ?
|
---|
579 | hwndTree : pd->hwndDir1;
|
---|
580 | }
|
---|
581 | }
|
---|
582 | else {
|
---|
583 | if (pd->hwndMax)
|
---|
584 | hwndFocus = pd->hwndMax;
|
---|
585 | else
|
---|
586 | hwndFocus = pd->hwndCurr == pd->hwndDir1 ?
|
---|
587 | pd->hwndDir2 : pd->hwndDir1;
|
---|
588 | }
|
---|
589 | WinSetFocus(HWND_DESKTOP, hwndFocus);
|
---|
590 | }
|
---|
591 | break;
|
---|
592 |
|
---|
593 | case IDM_NOTEBOOK:
|
---|
594 | case IDM_DIRCNRSETTINGS:
|
---|
595 | case IDM_DIRVIEWSETTINGS:
|
---|
596 | case IDM_DIRSORTSETTINGS:
|
---|
597 | case IDM_COLLECTORVIEWSETTINGS:
|
---|
598 | case IDM_COLLECTORSORTSETTINGS:
|
---|
599 | case IDM_ARCHIVERSETTINGS:
|
---|
600 | case IDM_TREECNRVIEWSETTINGS:
|
---|
601 | case IDM_TREECNRSORTSETTINGS:
|
---|
602 | case IDM_VIEWERSETTINGS:
|
---|
603 | case IDM_VIEWERSETTINGS2:
|
---|
604 | case IDM_COMPARESETTINGS:
|
---|
605 | case IDM_MONOLITHICSETTINGS:
|
---|
606 | case IDM_GENERALSETTINGS:
|
---|
607 | case IDM_SCANSETTINGS:
|
---|
608 | case IDM_BUBBLESSETTINGS:
|
---|
609 | WinDlgBox(HWND_DESKTOP,
|
---|
610 | hwnd,
|
---|
611 | CfgDlgProc,
|
---|
612 | FM3ModHandle,
|
---|
613 | CFG_FRAME,
|
---|
614 | MPFROMLONG(mp1)); // 15 Feb 08 SHL
|
---|
615 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
616 | break;
|
---|
617 |
|
---|
618 | case IDM_SEEALL:
|
---|
619 | case IDM_GREP:
|
---|
620 | case IDM_COLLECTOR:
|
---|
621 | {
|
---|
622 | HWND hwndC;
|
---|
623 |
|
---|
624 | hwndC = StartCollector(HWND_DESKTOP, 4);
|
---|
625 | if (hwndC) {
|
---|
626 | WinSetWindowPos(hwndC,
|
---|
627 | HWND_TOP,
|
---|
628 | 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | SWP_ACTIVATE);
|
---|
629 | if (SHORT1FROMMP(mp1) == IDM_GREP)
|
---|
630 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT),
|
---|
631 | WM_COMMAND, MPFROM2SHORT(IDM_GREP, 0), MPVOID);
|
---|
632 | if (SHORT1FROMMP(mp1) == IDM_SEEALL)
|
---|
633 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT),
|
---|
634 | WM_COMMAND, MPFROM2SHORT(IDM_SEEALL, 0), MPVOID);
|
---|
635 | }
|
---|
636 | }
|
---|
637 | break;
|
---|
638 |
|
---|
639 | case IDM_EDITCOMMANDS:
|
---|
640 | EditCommands(hwnd);
|
---|
641 | break;
|
---|
642 |
|
---|
643 | default:
|
---|
644 | if (SHORT1FROMMP(mp1) >= IDM_SWITCHSTART &&
|
---|
645 | SHORT1FROMMP(mp1) < IDM_SWITCHSTART + 499) {
|
---|
646 | if (SHORT1FROMMP(mp1) - IDM_SWITCHSTART < numswitches)
|
---|
647 | WinSwitchToProgram(switches[SHORT1FROMMP(mp1) - IDM_SWITCHSTART]);
|
---|
648 | break;
|
---|
649 | }
|
---|
650 | else if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
|
---|
651 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
|
---|
652 |
|
---|
653 | INT x;
|
---|
654 | HWND hwndCnr;
|
---|
655 |
|
---|
656 | if (!cmdloaded)
|
---|
657 | load_commands();
|
---|
658 | hwndCnr = TopWindow(hwnd, (HWND) 0);
|
---|
659 | hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT),
|
---|
660 | UM_CONTAINERHWND, MPVOID, MPVOID);
|
---|
661 | if (!hwndCnr) {
|
---|
662 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT);
|
---|
663 | break;
|
---|
664 | }
|
---|
665 | x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
|
---|
666 | if (x >= 0) {
|
---|
667 | x++;
|
---|
668 | RunCommand(hwndCnr, x);
|
---|
669 | if (fUnHilite) {
|
---|
670 |
|
---|
671 | PCNRITEM pci;
|
---|
672 | DIRCNRDATA *dcd = NULL;
|
---|
673 |
|
---|
674 | if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR)
|
---|
675 | dcd = INSTDATA(hwndCnr);
|
---|
676 | pci = (PCNRITEM) WinSendMsg(hwndCnr,
|
---|
677 | CM_QUERYRECORDEMPHASIS,
|
---|
678 | MPFROMLONG(CMA_FIRST),
|
---|
679 | MPFROMSHORT(CRA_CURSORED));
|
---|
680 | if (pci && (INT) pci != -1 && (pci->rc.flRecordAttr & CRA_SELECTED)) {
|
---|
681 | UnHilite(hwnd,
|
---|
682 | TRUE,
|
---|
683 | dcd ? &dcd->lastselection : NULL,
|
---|
684 | dcd ? dcd->ulItemsToUnHilite : 0);
|
---|
685 | }
|
---|
686 | }
|
---|
687 | }
|
---|
688 | }
|
---|
689 | else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART &&
|
---|
690 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 50) {
|
---|
691 | if (!qtloaded)
|
---|
692 | load_quicktools();
|
---|
693 | if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]) {
|
---|
694 | if (fToolsChanged)
|
---|
695 | save_tools(NULL);
|
---|
696 | if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]))
|
---|
697 | load_tools(NULL);
|
---|
698 | else {
|
---|
699 | strcpy(lasttoolbox,
|
---|
700 | quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]);
|
---|
701 | PrfWriteProfileString(fmprof, FM3Str, "LastToolBox", lasttoolbox);
|
---|
702 | }
|
---|
703 | BuildTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
704 | MAIN_TOOLS), TRUE);
|
---|
705 | }
|
---|
706 | }
|
---|
707 | else {
|
---|
708 |
|
---|
709 | HWND hwndActive;
|
---|
710 |
|
---|
711 | hwndActive = TopWindow(hwnd, (HWND) 0);
|
---|
712 | if (hwndActive)
|
---|
713 | PostMsg(WinWindowFromID(hwndActive, FID_CLIENT), msg, mp1, mp2);
|
---|
714 | }
|
---|
715 | break;
|
---|
716 | }
|
---|
717 | return 0;
|
---|
718 | }
|
---|
719 |
|
---|
720 | static MRESULT EXPENTRY MainWMOnce2(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
721 | MPARAM mp2)
|
---|
722 | {
|
---|
723 | PERSON1DATA *pd;
|
---|
724 |
|
---|
725 | switch (msg) {
|
---|
726 | case WM_CREATE:
|
---|
727 | {
|
---|
728 | TID tid;
|
---|
729 |
|
---|
730 | WinQueryWindowProcess(hwnd, &mypid, &tid);
|
---|
731 | }
|
---|
732 | hwndMain = hwnd;
|
---|
733 | WinSetWindowUShort(hwnd, QWL_USER + 8, 0);
|
---|
734 | WinSetWindowUShort(hwnd, QWL_USER + 10, 0);
|
---|
735 | WinSetWindowUShort(hwnd, QWL_USER + 12, 0);
|
---|
736 | WinSetWindowUShort(hwnd, QWL_USER + 16, 0);
|
---|
737 | if (_beginthread(MakeMainObjWin, NULL, 245760, MPVOID) == -1) {
|
---|
738 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
739 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
740 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
741 | return 0;
|
---|
742 | }
|
---|
743 | else
|
---|
744 | DosSleep(32);//05 Aug 07 GKY 64
|
---|
745 |
|
---|
746 | pd = xmallocz(sizeof(PERSON1DATA), pszSrcFile, __LINE__);
|
---|
747 | if (!pd)
|
---|
748 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
---|
749 | else {
|
---|
750 | pd->size = sizeof(PERSON1DATA);
|
---|
751 | WinSetWindowPtr(hwnd, QWL_USER + 4, (PVOID) pd);
|
---|
752 | }
|
---|
753 | {
|
---|
754 | SWP swp;
|
---|
755 | PFNWP oldproc;
|
---|
756 |
|
---|
757 | /*
|
---|
758 | * create frame children (not client children, frame children)
|
---|
759 | */
|
---|
760 | DosSleep(1);
|
---|
761 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
---|
762 | oldproc = WinSubclassWindow(WinQueryWindow(hwnd, QW_PARENT),
|
---|
763 | (PFNWP) MainFrameWndProc2);
|
---|
764 | if (oldproc)
|
---|
765 | WinSetWindowPtr(WinQueryWindow(hwnd, QW_PARENT), QWL_USER, (PVOID) oldproc);
|
---|
766 | CommonCreateMainChildren(hwnd, &swp);
|
---|
767 |
|
---|
768 | {
|
---|
769 | HWND hwndMenu;
|
---|
770 |
|
---|
771 | hwndMenu = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_MENU);
|
---|
772 | WinSetWindowULong(hwnd, QWL_USER, hwndMenu);
|
---|
773 | CfgMenuInit(hwndMenu, FALSE); // 14 Feb 08 SHL
|
---|
774 | SetConditionalCascade(hwndMenu, IDM_COMMANDLINESUBMENU, IDM_COMMANDLINE);
|
---|
775 | SetConditionalCascade(hwndMenu, IDM_COMMANDSMENU, IDM_DOITYOURSELF);
|
---|
776 | SetConditionalCascade(hwndMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
|
---|
777 | }
|
---|
778 | }
|
---|
779 | WinSetWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
780 | FID_TITLEBAR), "FM/2 Lite");
|
---|
781 | FixSwitchList(WinQueryWindow(hwnd, QW_PARENT), NULL);
|
---|
782 | SetSysMenu(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_SYSMENU));
|
---|
783 | break;
|
---|
784 |
|
---|
785 | case UM_SETUP:
|
---|
786 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
787 | if (pd) {
|
---|
788 |
|
---|
789 | CHAR s[CCHMAXPATH];
|
---|
790 | ULONG size;
|
---|
791 | DIRCNRDATA *dcd;
|
---|
792 | HWND hwndC;
|
---|
793 | BOOL dummy = TRUE;
|
---|
794 |
|
---|
795 | size = sizeof(BOOL);
|
---|
796 | PrfQueryProfileData(fmprof,
|
---|
797 | realappname, "FM/4 TreeUp", (PVOID) & dummy, &size);
|
---|
798 | if (dummy) {
|
---|
799 | size = sizeof(ULONG);
|
---|
800 | hwndTree = StartTreeCnr(hwnd, 3);
|
---|
801 | PrfQueryProfileData(fmprof,
|
---|
802 | realappname,
|
---|
803 | "FM/4 TreeWidth", (PVOID) & TreeWidth, &size);
|
---|
804 | TreeWidth = max(TreeWidth, 80);
|
---|
805 | }
|
---|
806 | size = sizeof(BOOL);
|
---|
807 | if (PrfQueryProfileData(fmprof,
|
---|
808 | FM3Str,
|
---|
809 | "Toolbar", &dummy, &size) && size && !dummy)
|
---|
810 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
|
---|
811 |
|
---|
812 | size = sizeof(s);
|
---|
813 | *s = 0;
|
---|
814 | if (PrfQueryProfileData(fmprof,
|
---|
815 | realappname, "FM/4 Dir1", s, &size) && *s)
|
---|
816 | MakeValidDir(s);
|
---|
817 | else
|
---|
818 | save_dir(s);
|
---|
819 | pd->hwndLastDir = pd->hwndCurr = pd->hwndDir1 =
|
---|
820 | StartDirCnr(hwnd, s, (HWND) 0, 3);
|
---|
821 | size = sizeof(s);
|
---|
822 | *s = 0;
|
---|
823 | if (PrfQueryProfileData(fmprof,
|
---|
824 | realappname, "FM/4 Dir2", s, &size) && *s)
|
---|
825 | MakeValidDir(s);
|
---|
826 | else
|
---|
827 | save_dir(s);
|
---|
828 | pd->hwndDir2 = StartDirCnr(hwnd, s, (HWND) 0, 3);
|
---|
829 | WinSetFocus(HWND_DESKTOP, pd->hwndCurr);
|
---|
830 |
|
---|
831 | hwndC = WinWindowFromID(pd->hwndDir1, FID_CLIENT);
|
---|
832 | if (hwndC) {
|
---|
833 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
834 | if (dcd) {
|
---|
835 | size = sizeof(INT);
|
---|
836 | if (PrfQueryProfileData(fmprof,
|
---|
837 | realappname,
|
---|
838 | "FM/4 Dir1.Sort",
|
---|
839 | (PVOID) & dcd->sortFlags,
|
---|
840 | &size) && size == sizeof(INT)) {
|
---|
841 | if (!dcd->sortFlags)
|
---|
842 | dcd->sortFlags = SORT_PATHNAME;
|
---|
843 | }
|
---|
844 | size = sizeof(MASK);
|
---|
845 | if (PrfQueryProfileData(fmprof,
|
---|
846 | realappname,
|
---|
847 | "FM/4 Dir1.Filter",
|
---|
848 | (PVOID) & dcd->mask, &size) && size) {
|
---|
849 | if (*dcd->mask.szMask)
|
---|
850 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
851 | UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
|
---|
852 | }
|
---|
853 | *(dcd->mask.prompt) = 0;
|
---|
854 | size = sizeof(ULONG);
|
---|
855 | if (PrfQueryProfileData(fmprof,
|
---|
856 | realappname,
|
---|
857 | "FM/4 Dir1.View",
|
---|
858 | (PVOID) & dcd->flWindowAttr,
|
---|
859 | &size) && size == sizeof(ULONG)) {
|
---|
860 |
|
---|
861 | CNRINFO cnri;
|
---|
862 |
|
---|
863 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
864 | cnri.cb = sizeof(CNRINFO);
|
---|
865 | if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
866 | CM_QUERYCNRINFO,
|
---|
867 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)))) {
|
---|
868 | cnri.flWindowAttr = dcd->flWindowAttr;
|
---|
869 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
870 | CM_SETCNRINFO,
|
---|
871 | MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));
|
---|
872 | }
|
---|
873 | }
|
---|
874 | }
|
---|
875 | }
|
---|
876 |
|
---|
877 | hwndC = WinWindowFromID(pd->hwndDir2, FID_CLIENT);
|
---|
878 | if (hwndC) {
|
---|
879 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
880 | if (dcd) {
|
---|
881 | size = sizeof(INT);
|
---|
882 | if (PrfQueryProfileData(fmprof,
|
---|
883 | realappname,
|
---|
884 | "FM/4 Dir2.Sort",
|
---|
885 | (PVOID) & dcd->sortFlags,
|
---|
886 | &size) && size == sizeof(INT)) {
|
---|
887 | if (!dcd->sortFlags)
|
---|
888 | dcd->sortFlags = SORT_PATHNAME;
|
---|
889 | }
|
---|
890 | size = sizeof(MASK);
|
---|
891 | if (PrfQueryProfileData(fmprof,
|
---|
892 | realappname,
|
---|
893 | "FM/4 Dir2.Filter",
|
---|
894 | (PVOID) & dcd->mask, &size) && size) {
|
---|
895 | if (*dcd->mask.szMask)
|
---|
896 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
897 | UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
|
---|
898 | }
|
---|
899 | *(dcd->mask.prompt) = 0;
|
---|
900 | size = sizeof(ULONG);
|
---|
901 | if (PrfQueryProfileData(fmprof,
|
---|
902 | realappname,
|
---|
903 | "FM/4 Dir2.View",
|
---|
904 | (PVOID) & dcd->flWindowAttr,
|
---|
905 | &size) && size == sizeof(ULONG)) {
|
---|
906 |
|
---|
907 | CNRINFO cnri;
|
---|
908 |
|
---|
909 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
910 | cnri.cb = sizeof(CNRINFO);
|
---|
911 | if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
912 | CM_QUERYCNRINFO,
|
---|
913 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)))) {
|
---|
914 | cnri.flWindowAttr = dcd->flWindowAttr;
|
---|
915 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
916 | CM_SETCNRINFO,
|
---|
917 | MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));
|
---|
918 | }
|
---|
919 | }
|
---|
920 | }
|
---|
921 | }
|
---|
922 | }
|
---|
923 | {
|
---|
924 | ULONG which = 0, size = sizeof(ULONG);
|
---|
925 |
|
---|
926 | if (PrfQueryProfileData(fmprof,
|
---|
927 | realappname,
|
---|
928 | "FM/4 Max",
|
---|
929 | (PVOID) & which,
|
---|
930 | &size) && size == sizeof(ULONG) && which) {
|
---|
931 | PostMsg(hwnd,
|
---|
932 | UM_MAXIMIZE,
|
---|
933 | MPFROMLONG(((which == 1) ?
|
---|
934 | pd->hwndDir1 : pd->hwndDir2)), MPVOID);
|
---|
935 | }
|
---|
936 | }
|
---|
937 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
938 | if (!hwndTree)
|
---|
939 | PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
|
---|
940 | load_tools(NULL);
|
---|
941 | BuildTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
942 | MAIN_TOOLS), TRUE);
|
---|
943 | fRunning = TRUE;
|
---|
944 | return 0;
|
---|
945 |
|
---|
946 | case WM_SAVEAPPLICATION:
|
---|
947 | WinStoreWindowPos(FM2Str,
|
---|
948 | "MainWindowPos2", WinQueryWindow(hwnd, QW_PARENT));
|
---|
949 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
950 | if (pd) {
|
---|
951 |
|
---|
952 | CHAR s[CCHMAXPATH];
|
---|
953 | HWND hwndC;
|
---|
954 | DIRCNRDATA *dcd;
|
---|
955 | ULONG flWindowAttr;
|
---|
956 |
|
---|
957 | *s = 0;
|
---|
958 | WinSendMsg(pd->hwndDir1, UM_CONTAINERDIR, MPFROMP(s), MPVOID);
|
---|
959 | if (*s) {
|
---|
960 | MakeValidDir(s);
|
---|
961 | PrfWriteProfileString(fmprof, realappname, "FM/4 Dir1", s);
|
---|
962 | }
|
---|
963 | *s = 0;
|
---|
964 | WinSendMsg(pd->hwndDir2, UM_CONTAINERDIR, MPFROMP(s), MPVOID);
|
---|
965 | if (*s) {
|
---|
966 | MakeValidDir(s);
|
---|
967 | PrfWriteProfileString(fmprof, realappname, "FM/4 Dir2", s);
|
---|
968 | }
|
---|
969 | flWindowAttr = (pd->hwndMax == pd->hwndDir1) ?
|
---|
970 | 1 : (pd->hwndMax == pd->hwndDir2) ? 2 : 0;
|
---|
971 | PrfWriteProfileData(fmprof,
|
---|
972 | realappname,
|
---|
973 | "FM/4 Max", &flWindowAttr, sizeof(flWindowAttr));
|
---|
974 | hwndC = WinWindowFromID(pd->hwndDir1, FID_CLIENT);
|
---|
975 | if (hwndC) {
|
---|
976 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
977 | if (dcd) {
|
---|
978 | flWindowAttr = dcd->flWindowAttr;
|
---|
979 | if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
|
---|
980 | flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
|
---|
981 | if (dcd->lastattr) {
|
---|
982 | if (dcd->lastattr & CV_TEXT)
|
---|
983 | flWindowAttr |= CV_TEXT;
|
---|
984 | else if (dcd->lastattr & CV_DETAIL)
|
---|
985 | flWindowAttr |= CV_DETAIL;
|
---|
986 | else if (dcd->lastattr & CV_ICON)
|
---|
987 | flWindowAttr |= CV_ICON;
|
---|
988 | else
|
---|
989 | flWindowAttr |= CV_NAME;
|
---|
990 | }
|
---|
991 | else
|
---|
992 | flWindowAttr |= CV_NAME;
|
---|
993 | }
|
---|
994 | PrfWriteProfileData(fmprof,
|
---|
995 | realappname,
|
---|
996 | "FM/4 Dir1.Sort",
|
---|
997 | (PVOID) & dcd->sortFlags, sizeof(INT));
|
---|
998 | PrfWriteProfileData(fmprof,
|
---|
999 | realappname,
|
---|
1000 | "FM/4 Dir1.Filter",
|
---|
1001 | (PVOID) & dcd->mask, sizeof(MASK));
|
---|
1002 | PrfWriteProfileData(fmprof,
|
---|
1003 | realappname,
|
---|
1004 | "FM/4 Dir1.View",
|
---|
1005 | (PVOID) & flWindowAttr, sizeof(ULONG));
|
---|
1006 | }
|
---|
1007 | }
|
---|
1008 |
|
---|
1009 | hwndC = WinWindowFromID(pd->hwndDir2, FID_CLIENT);
|
---|
1010 | if (hwndC) {
|
---|
1011 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
1012 | if (dcd) {
|
---|
1013 | flWindowAttr = dcd->flWindowAttr;
|
---|
1014 | if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
|
---|
1015 | flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
|
---|
1016 | if (dcd->lastattr) {
|
---|
1017 | if (dcd->lastattr & CV_TEXT)
|
---|
1018 | flWindowAttr |= CV_TEXT;
|
---|
1019 | else if (dcd->lastattr & CV_DETAIL)
|
---|
1020 | flWindowAttr |= CV_DETAIL;
|
---|
1021 | else if (dcd->lastattr & CV_ICON)
|
---|
1022 | flWindowAttr |= CV_ICON;
|
---|
1023 | else
|
---|
1024 | flWindowAttr |= CV_NAME;
|
---|
1025 | }
|
---|
1026 | else
|
---|
1027 | flWindowAttr |= CV_NAME;
|
---|
1028 | }
|
---|
1029 | PrfWriteProfileData(fmprof,
|
---|
1030 | realappname,
|
---|
1031 | "FM/4 Dir2.Sort",
|
---|
1032 | (PVOID) & dcd->sortFlags, sizeof(INT));
|
---|
1033 | PrfWriteProfileData(fmprof,
|
---|
1034 | realappname,
|
---|
1035 | "FM/4 Dir2.Filter",
|
---|
1036 | (PVOID) & dcd->mask, sizeof(MASK));
|
---|
1037 | PrfWriteProfileData(fmprof,
|
---|
1038 | realappname,
|
---|
1039 | "FM/4 Dir2.View",
|
---|
1040 | (PVOID) & flWindowAttr, sizeof(ULONG));
|
---|
1041 | }
|
---|
1042 | }
|
---|
1043 | }
|
---|
1044 | break;
|
---|
1045 | }
|
---|
1046 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
1047 | }
|
---|
1048 |
|
---|
1049 | MRESULT EXPENTRY MainWndProc2(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1050 | {
|
---|
1051 | PERSON1DATA *pd;
|
---|
1052 |
|
---|
1053 | switch (msg) {
|
---|
1054 | case WM_SAVEAPPLICATION:
|
---|
1055 | case UM_SETUP:
|
---|
1056 | case WM_CREATE:
|
---|
1057 | return MainWMOnce2(hwnd, msg, mp1, mp2);
|
---|
1058 |
|
---|
1059 | case UM_THREADUSE:
|
---|
1060 | case UM_LOADFILE:
|
---|
1061 | case UM_BUILDDRIVEBAR:
|
---|
1062 | return CommonMainWndProc(hwnd, msg, mp1, mp2);
|
---|
1063 |
|
---|
1064 | case UM_SETUP2:
|
---|
1065 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
1066 | if (pd) {
|
---|
1067 | if (mp1) {
|
---|
1068 | if (pd->hwndDir1 && (!pd->hwndMax || pd->hwndMax == pd->hwndDir1))
|
---|
1069 | BoxWindow(pd->hwndDir1, (HPS) 0, CLR_PALEGRAY);
|
---|
1070 | if (pd->hwndDir2 && (!pd->hwndMax || pd->hwndMax == pd->hwndDir2))
|
---|
1071 | BoxWindow(pd->hwndDir2, (HPS) 0, CLR_PALEGRAY);
|
---|
1072 | if (hwndTree)
|
---|
1073 | BoxWindow(hwndTree, (HPS) 0, CLR_PALEGRAY);
|
---|
1074 | }
|
---|
1075 | else {
|
---|
1076 | if (hwndTree)
|
---|
1077 | BoxWindow(hwndTree,
|
---|
1078 | (HPS) 0,
|
---|
1079 | (pd->hwndCurr == hwndTree) ? CLR_RED : CLR_WHITE);
|
---|
1080 | if (!pd->hwndMax || pd->hwndMax == pd->hwndDir1)
|
---|
1081 | BoxWindow(pd->hwndDir1,
|
---|
1082 | (HPS) 0,
|
---|
1083 | (pd->hwndDir1 == pd->hwndCurr) ?
|
---|
1084 | CLR_RED :
|
---|
1085 | (pd->hwndDir1 == pd->hwndLastDir) ?
|
---|
1086 | CLR_DARKRED : CLR_PALEGRAY);
|
---|
1087 | if (!pd->hwndMax || pd->hwndMax == pd->hwndDir2)
|
---|
1088 | BoxWindow(pd->hwndDir2,
|
---|
1089 | (HPS) 0,
|
---|
1090 | (pd->hwndDir2 == pd->hwndCurr) ?
|
---|
1091 | CLR_RED :
|
---|
1092 | (pd->hwndDir2 == pd->hwndLastDir) ?
|
---|
1093 | CLR_DARKRED : CLR_PALEGRAY);
|
---|
1094 | }
|
---|
1095 | }
|
---|
1096 | return 0;
|
---|
1097 |
|
---|
1098 | case WM_BUTTON1DOWN:
|
---|
1099 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
1100 | if (hwndTree) {
|
---|
1101 |
|
---|
1102 | SWP swp;
|
---|
1103 |
|
---|
1104 | WinQueryWindowPos(hwndTree, &swp);
|
---|
1105 | if (SHORT1FROMMP(mp1) > (swp.x + swp.cx) - 3 &&
|
---|
1106 | SHORT1FROMMP(mp1) < (swp.x + swp.cx) + 3) {
|
---|
1107 |
|
---|
1108 | SWP swpC;
|
---|
1109 | TRACKINFO track;
|
---|
1110 |
|
---|
1111 | WinQueryWindowPos(hwnd, &swpC);
|
---|
1112 | track.cxBorder = 4;
|
---|
1113 | track.cyBorder = 4;
|
---|
1114 | track.cxGrid = 1;
|
---|
1115 | track.cyGrid = 1;
|
---|
1116 | track.cxKeyboard = 8;
|
---|
1117 | track.cyKeyboard = 8;
|
---|
1118 | track.rclTrack.yBottom = 2;
|
---|
1119 | track.rclTrack.yTop = swpC.cy - 4;
|
---|
1120 | track.rclTrack.xLeft = 2;
|
---|
1121 | track.rclTrack.xRight = swp.x + swp.cx + 2;
|
---|
1122 | track.rclBoundary = track.rclTrack;
|
---|
1123 | track.rclBoundary.xRight = swpC.cx - 80;
|
---|
1124 | track.ptlMinTrackSize.x = 80;
|
---|
1125 | track.ptlMinTrackSize.y = swpC.cy - 4;
|
---|
1126 | track.ptlMaxTrackSize.x = swpC.cx - 80;
|
---|
1127 | track.ptlMaxTrackSize.y = swpC.cy - 4;
|
---|
1128 | track.fs = TF_RIGHT;
|
---|
1129 | if (WinTrackRect(hwnd, (HPS) 0, &track)) {
|
---|
1130 | TreeWidth = track.rclTrack.xRight - track.rclTrack.xLeft;
|
---|
1131 | PrfWriteProfileData(fmprof,
|
---|
1132 | realappname,
|
---|
1133 | "FM/4 TreeWidth", &TreeWidth, sizeof(ULONG));
|
---|
1134 | WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
|
---|
1135 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
1136 | }
|
---|
1137 | return (MRESULT) TRUE;
|
---|
1138 | }
|
---|
1139 | }
|
---|
1140 | break;
|
---|
1141 |
|
---|
1142 | case WM_MOUSEMOVE:
|
---|
1143 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
1144 | if (hwndTree) {
|
---|
1145 |
|
---|
1146 | SWP swp;
|
---|
1147 |
|
---|
1148 | if (WinQueryWindowPos(hwndTree, &swp)) {
|
---|
1149 | if (SHORT1FROMMP(mp1) > (swp.x + swp.cx) - 3 &&
|
---|
1150 | SHORT1FROMMP(mp1) < (swp.x + swp.cx) + 3)
|
---|
1151 | WinSetPointer(HWND_DESKTOP, hptrEW);
|
---|
1152 | else
|
---|
1153 | WinSetPointer(HWND_DESKTOP, hptrArrow);
|
---|
1154 | }
|
---|
1155 | else
|
---|
1156 | WinSetPointer(HWND_DESKTOP, hptrArrow);
|
---|
1157 | }
|
---|
1158 | return (MRESULT) TRUE;
|
---|
1159 |
|
---|
1160 | case WM_BUTTON1UP:
|
---|
1161 | case WM_BUTTON2UP:
|
---|
1162 | case WM_BUTTON3UP:
|
---|
1163 | case WM_CHAR:
|
---|
1164 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
1165 | break;
|
---|
1166 |
|
---|
1167 | case UM_ADVISEFOCUS:
|
---|
1168 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
1169 | if (mp1 && pd && (HWND) mp1 != pd->hwndCurr) {
|
---|
1170 | if ((HWND) mp1 != hwndTree)
|
---|
1171 | pd->hwndLastDir = (HWND) mp1;
|
---|
1172 | pd->hwndCurr = (HWND) mp1;
|
---|
1173 | WinSendMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
|
---|
1174 | }
|
---|
1175 | return 0;
|
---|
1176 |
|
---|
1177 | case UM_MAXIMIZE:
|
---|
1178 | if (mp1) {
|
---|
1179 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
1180 | if (pd) {
|
---|
1181 | WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
|
---|
1182 | if (pd->hwndMax != (HWND) mp1) {
|
---|
1183 | pd->hwndMax = (HWND) mp1;
|
---|
1184 | WinSetFocus(HWND_DESKTOP, pd->hwndMax);
|
---|
1185 | }
|
---|
1186 | else
|
---|
1187 | pd->hwndMax = (HWND) 0;
|
---|
1188 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
1189 | }
|
---|
1190 | }
|
---|
1191 | return 0;
|
---|
1192 |
|
---|
1193 | case WM_INITMENU:
|
---|
1194 | switch (SHORT1FROMMP(mp1)) {
|
---|
1195 | case IDM_FILESMENU:
|
---|
1196 | case IDM_VIEWSMENU:
|
---|
1197 | case IDM_DETAILSSETUP:
|
---|
1198 | case IDM_COMMANDSMENU:
|
---|
1199 | case IDM_SORTSUBMENU:
|
---|
1200 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
1201 | if (pd)
|
---|
1202 | WinSendMsg(pd->hwndCurr, UM_INITMENU, mp1, mp2);
|
---|
1203 | break;
|
---|
1204 | case IDM_CONFIGMENU:
|
---|
1205 | WinCheckMenuItem((HWND) mp2, IDM_TOOLSUBMENU, fToolbar);
|
---|
1206 | WinCheckMenuItem((HWND) mp2, IDM_AUTOVIEW, fAutoView);
|
---|
1207 | break;
|
---|
1208 | case IDM_TOOLSUBMENU:
|
---|
1209 | WinCheckMenuItem((HWND) mp2, IDM_TOOLBAR, fToolbar);
|
---|
1210 | WinCheckMenuItem((HWND) mp2, IDM_TEXTTOOLS, fTextTools);
|
---|
1211 | WinCheckMenuItem((HWND) mp2, IDM_TOOLTITLES, fToolTitles);
|
---|
1212 | break;
|
---|
1213 | case IDM_WINDOWSMENU:
|
---|
1214 | WinCheckMenuItem((HWND) mp2, IDM_VTREE, (hwndTree != (HWND) 0));
|
---|
1215 | WinCheckMenuItem((HWND) mp2, IDM_TILEBACKWARDS, fTileBackwards);
|
---|
1216 | SetupWinList((HWND) mp2, hwnd, WinQueryWindow(hwnd, QW_PARENT));
|
---|
1217 | break;
|
---|
1218 | }
|
---|
1219 | break;
|
---|
1220 |
|
---|
1221 | case WM_SETFOCUS:
|
---|
1222 | if (mp2)
|
---|
1223 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
1224 | break;
|
---|
1225 |
|
---|
1226 | case UM_FOCUSME:
|
---|
1227 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
1228 | if (pd)
|
---|
1229 | WinSetFocus(HWND_DESKTOP, pd->hwndCurr);
|
---|
1230 | return 0;
|
---|
1231 |
|
---|
1232 | case UM_RESCAN:
|
---|
1233 | return 0;
|
---|
1234 |
|
---|
1235 | case UM_SIZE:
|
---|
1236 | {
|
---|
1237 | SWP swp;
|
---|
1238 |
|
---|
1239 | if (WinQueryWindowPos(hwnd, &swp)) {
|
---|
1240 | mp1 = MPFROM2SHORT(swp.cx, swp.cy);
|
---|
1241 | mp2 = MPFROM2SHORT(swp.cx, swp.cy);
|
---|
1242 | }
|
---|
1243 | else
|
---|
1244 | return 0;
|
---|
1245 | }
|
---|
1246 | /* intentional fallthru */
|
---|
1247 | case WM_SIZE:
|
---|
1248 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
1249 | if (mp1 && mp2 && pd && pd->hwndDir1 && pd->hwndDir2) {
|
---|
1250 | if (hwndTree)
|
---|
1251 | WinSetWindowPos(hwndTree,
|
---|
1252 | HWND_TOP,
|
---|
1253 | 2,
|
---|
1254 | 2,
|
---|
1255 | TreeWidth - 4,
|
---|
1256 | SHORT2FROMMP(mp2) - 4,
|
---|
1257 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
1258 | else
|
---|
1259 | TreeWidth = 0;
|
---|
1260 | if (!pd->hwndMax) {
|
---|
1261 | if (fTileBackwards) {
|
---|
1262 | WinSetWindowPos(pd->hwndDir1, HWND_TOP,
|
---|
1263 | (((SHORT1FROMMP(mp2) - TreeWidth) / 2) +
|
---|
1264 | TreeWidth) + 2,
|
---|
1265 | 2,
|
---|
1266 | ((SHORT1FROMMP(mp2) - TreeWidth) / 2) - 4,
|
---|
1267 | SHORT2FROMMP(mp2) - 4,
|
---|
1268 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
1269 | WinSetWindowPos(pd->hwndDir2, HWND_TOP,
|
---|
1270 | TreeWidth + 2,
|
---|
1271 | 2,
|
---|
1272 | ((SHORT1FROMMP(mp2) - TreeWidth) / 2) - 4,
|
---|
1273 | SHORT2FROMMP(mp2) - 4,
|
---|
1274 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
1275 | }
|
---|
1276 | else {
|
---|
1277 | WinSetWindowPos(pd->hwndDir1, HWND_TOP,
|
---|
1278 | TreeWidth + 2,
|
---|
1279 | 2,
|
---|
1280 | (SHORT1FROMMP(mp2) - TreeWidth) - 4,
|
---|
1281 | (SHORT2FROMMP(mp2) / 2) - 4,
|
---|
1282 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
1283 | WinSetWindowPos(pd->hwndDir2, HWND_TOP,
|
---|
1284 | TreeWidth + 2,
|
---|
1285 | (SHORT2FROMMP(mp2) / 2) + 2,
|
---|
1286 | (SHORT1FROMMP(mp2) - TreeWidth) - 4,
|
---|
1287 | (SHORT2FROMMP(mp2) / 2) - 4,
|
---|
1288 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
1289 | }
|
---|
1290 | }
|
---|
1291 | else {
|
---|
1292 |
|
---|
1293 | HWND hwndOther;
|
---|
1294 |
|
---|
1295 | WinSetWindowPos(pd->hwndMax, HWND_TOP,
|
---|
1296 | TreeWidth + 2,
|
---|
1297 | 2,
|
---|
1298 | (SHORT1FROMMP(mp2) - TreeWidth) - 4,
|
---|
1299 | SHORT2FROMMP(mp2) - 4,
|
---|
1300 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
1301 | hwndOther = (pd->hwndMax == pd->hwndDir1) ?
|
---|
1302 | pd->hwndDir2 : pd->hwndDir1;
|
---|
1303 | WinSetWindowPos(hwndOther, HWND_BOTTOM, 0, 0, 0, 0, SWP_HIDE);
|
---|
1304 | }
|
---|
1305 | WinSendMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
|
---|
1306 | }
|
---|
1307 | if (msg == UM_SIZE)
|
---|
1308 | return 0;
|
---|
1309 | break;
|
---|
1310 |
|
---|
1311 | case WM_ERASEBACKGROUND:
|
---|
1312 | WinFillRect((HPS) mp1, (PRECTL) mp2, 0x00d0d0d0);
|
---|
1313 | return 0;
|
---|
1314 |
|
---|
1315 | case WM_PAINT:
|
---|
1316 | {
|
---|
1317 | HPS hps;
|
---|
1318 | RECTL rcl;
|
---|
1319 |
|
---|
1320 | hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
|
---|
1321 | if (hps) {
|
---|
1322 | WinQueryWindowRect(hwnd, &rcl);
|
---|
1323 | WinFillRect(hps, (PRECTL) & rcl, CLR_PALEGRAY);
|
---|
1324 | WinEndPaint(hps);
|
---|
1325 | WinSendMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
|
---|
1326 | }
|
---|
1327 | }
|
---|
1328 | break;
|
---|
1329 |
|
---|
1330 | case UM_COMMAND:
|
---|
1331 | case WM_COMMAND:
|
---|
1332 | return MainWMCommand2(hwnd, msg, mp1, mp2);
|
---|
1333 |
|
---|
1334 | case WM_CLOSE:
|
---|
1335 | fAmClosing = TRUE;
|
---|
1336 | WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
---|
1337 | CloseChildren(hwnd);
|
---|
1338 | PostMsg(hwnd, UM_CLOSE, MPVOID, MPVOID);
|
---|
1339 | DosSleep(1);
|
---|
1340 | return 0;
|
---|
1341 |
|
---|
1342 | case UM_CLOSE:
|
---|
1343 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
---|
1344 | return 0;
|
---|
1345 |
|
---|
1346 | case WM_DESTROY:
|
---|
1347 | hwndMain = (HWND) 0;
|
---|
1348 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
1349 | if (pd)
|
---|
1350 | free(pd);
|
---|
1351 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
1352 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
---|
1353 | break;
|
---|
1354 | }
|
---|
1355 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
1356 | }
|
---|
1357 |
|
---|
1358 | HWND StartFM32(HAB hab, INT argc, CHAR ** argv)
|
---|
1359 | {
|
---|
1360 | HWND hwndFrame, hwndClient;
|
---|
1361 | ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
|
---|
1362 | FCF_SIZEBORDER | FCF_MINMAX |
|
---|
1363 | FCF_ACCELTABLE | FCF_MENU | FCF_ICON | FCF_TASKLIST | FCF_NOBYTEALIGN;
|
---|
1364 |
|
---|
1365 | {
|
---|
1366 | INT x;
|
---|
1367 |
|
---|
1368 | for (x = 1; x < argc; x++) {
|
---|
1369 | if (*argv[x] == '+' && !argv[x][1])
|
---|
1370 | fLogFile = TRUE;
|
---|
1371 | if (*argv[x] == '-') {
|
---|
1372 | if (argv[x][1])
|
---|
1373 | strcpy(profile, &argv[x][1]);
|
---|
1374 | }
|
---|
1375 | }
|
---|
1376 | }
|
---|
1377 | {
|
---|
1378 | CHAR inipath[CCHMAXPATH], fullpath[CCHMAXPATH];
|
---|
1379 | FILESTATUS3 fsa;
|
---|
1380 |
|
---|
1381 | if (PrfQueryProfileString(HINI_USERPROFILE,
|
---|
1382 | FM2Str,
|
---|
1383 | "Home", NULL, inipath, sizeof(inipath))) {
|
---|
1384 | if (!DosQueryPathInfo(inipath, FIL_STANDARD, &fsa, sizeof(fsa))) {
|
---|
1385 | if (fsa.attrFile & FILE_DIRECTORY) {
|
---|
1386 | if (DosQueryPathInfo(inipath,
|
---|
1387 | FIL_QUERYFULLNAME, fullpath, sizeof(fullpath)))
|
---|
1388 | strcpy(fullpath, inipath);
|
---|
1389 | switch_to(fullpath);
|
---|
1390 | }
|
---|
1391 | }
|
---|
1392 | }
|
---|
1393 | }
|
---|
1394 |
|
---|
1395 | hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
|
---|
1396 | WS_VISIBLE,
|
---|
1397 | &FrameFlags,
|
---|
1398 | WC_MAINWND2,
|
---|
1399 | NULL,
|
---|
1400 | WS_VISIBLE | WS_ANIMATE,
|
---|
1401 | FM3ModHandle, MAIN2_FRAME, &hwndClient);
|
---|
1402 | if (hwndFrame) {
|
---|
1403 | hwndMainMenu = WinWindowFromID(hwndFrame, FID_MENU);
|
---|
1404 | if (!WinRestoreWindowPos(FM2Str, "MainWindowPos2", hwndFrame)) {
|
---|
1405 |
|
---|
1406 | ULONG fl = SWP_MOVE | SWP_SIZE;
|
---|
1407 | RECTL rcl;
|
---|
1408 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 3L;
|
---|
1409 | ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
|
---|
1410 |
|
---|
1411 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
---|
1412 | rcl.yBottom += icz;
|
---|
1413 | rcl.yTop -= bsz;
|
---|
1414 | rcl.xLeft += bsz;
|
---|
1415 | rcl.xRight -= bsz;
|
---|
1416 | WinSetWindowPos(hwndFrame,
|
---|
1417 | HWND_TOP,
|
---|
1418 | rcl.xLeft,
|
---|
1419 | rcl.yBottom,
|
---|
1420 | rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, fl);
|
---|
1421 | }
|
---|
1422 | if (fLogFile)
|
---|
1423 | LogFileHandle = _fsopen("FM2.LOG", "a+", SH_DENYWR);
|
---|
1424 | if (hwndHelp)
|
---|
1425 | WinAssociateHelpInstance(hwndHelp, hwndFrame);
|
---|
1426 | PostMsg(hwndClient, UM_SETUP, MPFROMLONG(argc), MPFROMP(argv));
|
---|
1427 | }
|
---|
1428 | return hwndFrame;
|
---|
1429 | }
|
---|
1430 |
|
---|
1431 | #pragma alloc_text(PERSON11,MainFrameWndProc2,MainWndProc2)
|
---|
1432 | #pragma alloc_text(PERSON12,StartFM32,MainWMOnce2)
|
---|
1433 | #pragma alloc_text(PERSON13,MainWMCommand2)
|
---|