1 |
|
---|
2 | /***********************************************************************
|
---|
3 |
|
---|
4 | $Id: mainwnd.c 971 2008-02-23 00:56:38Z jbs $
|
---|
5 |
|
---|
6 | fm/2 main window
|
---|
7 |
|
---|
8 | Copyright (c) 1993-98 M. Kimes
|
---|
9 | Copyright (c) 2001, 2008 Steven H. Levine
|
---|
10 |
|
---|
11 | 11 Jun 02 SHL Drop obsolete xor code
|
---|
12 | 16 Oct 02 SHL Handle large partitions
|
---|
13 | 01 Aug 04 SHL Rework lstrip/rstrip usage
|
---|
14 | 23 May 05 SHL Use QWL_USER
|
---|
15 | 23 May 05 SHL Use datamin.h
|
---|
16 | 25 May 05 SHL Use ULONGLONG and CommaFmtULL
|
---|
17 | 26 May 05 SHL Comments and localize code
|
---|
18 | 05 Jun 05 SHL Use QWL_USER
|
---|
19 | 06 Jun 05 SHL Rework MainWMCommand for VAC3.65 compat
|
---|
20 | 13 Aug 05 SHL Renames and comments
|
---|
21 | 08 Dec 05 SHL DriveProc: disable menu items if drive not ready
|
---|
22 | 17 Dec 05 SHL DriveProc: correct my stupid
|
---|
23 | 29 May 06 SHL IDM_EDITANYARCHIVER: sanitize code
|
---|
24 | 17 Jul 06 SHL Use Runtime_Error
|
---|
25 | 17 Aug 06 SHL Complain nicer if state name does not exist
|
---|
26 | 18 Feb 07 GKY More drive type and icon support
|
---|
27 | 08 Mar 07 SHL SaveDirCnrState: do not save state of NOPRESCAN volumes
|
---|
28 | 09 Mar 07 SHL RestoreDirCnrState/SaveDirCnrState: optimize and avoid overflows
|
---|
29 | 30 Mar 07 GKY Remove GetPString for window class names
|
---|
30 | 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
|
---|
31 | 06 Apr 07 GKY Add some error checking in drag/drop
|
---|
32 | 15 Apr 07 SHL mainwnd MAIN_SETUPLIST restore state not found reporting
|
---|
33 | 19 Apr 07 SHL Sync with AcceptOneDrop GetOneDrop mods
|
---|
34 | 20 Apr 07 SHL Avoid spurious add_udir error reports
|
---|
35 | 12 May 07 SHL Use dcd->ulItemsToUnHilite
|
---|
36 | 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
|
---|
37 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
|
---|
38 | 07 Aug 07 SHL Use BldQuotedFileName
|
---|
39 | 16 Aug 07 SHL Update IDM_SAVEDIRCNRSTATE logic for ticket# 109
|
---|
40 | 18 Aug 07 SHL Rework UM_FILLSETUPLIST for new setups storage
|
---|
41 | 19 Aug 07 SHL Move #pragma alloc_text to end of file for OpenWatcom
|
---|
42 | 19 Aug 07 SHL Rework SaveDirCnrState to return better error info
|
---|
43 | 30 Aug 07 SHL Add accelerator support to quicklist windows
|
---|
44 | 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
|
---|
45 | 12 Jan 08 SHL Support drag&drop dialog toggle
|
---|
46 | 16 Jan 08 SHL Add sync updates toggle
|
---|
47 | 16 Jan 08 GKY Fix changing background color on toolbar
|
---|
48 | 17 Jan 08 GKY Add presparam save & restore for individual directory containers
|
---|
49 | 19 Jan 08 JBS Ticket 150: fix/improve save and restore of dir cnr state at FM/2 close/reopen
|
---|
50 | 19 Jan 08 GKY Rework Utilities menu
|
---|
51 | 05 Feb 08 SHL Restore no-prescan drives if restoring named state
|
---|
52 | 14 Feb 08 SHL Rework to support settings menu conditional cascade
|
---|
53 | 15 Feb 08 SHL Rework ResizeChildren to honor fNoTreeGap and resize drive tree better
|
---|
54 | 19 Feb 08 JBS Stop deleting "State at last FM/2 Close" from INI file so it be accessed from States combo box.
|
---|
55 | 22 Feb 08 JBS Ticket 230: Fix/improve various code related to state or presparam values in the INI file.
|
---|
56 |
|
---|
57 | ***********************************************************************/
|
---|
58 |
|
---|
59 | #include <stdlib.h>
|
---|
60 | #include <string.h>
|
---|
61 | #include <ctype.h>
|
---|
62 | #include <process.h> // _beginthread
|
---|
63 |
|
---|
64 | #define INCL_DOS
|
---|
65 | #define INCL_WIN
|
---|
66 | #define INCL_SHLERRORS // PMERR_NOT_IN_IDX
|
---|
67 | #define INCL_WINHELP
|
---|
68 | #define INCL_GPI
|
---|
69 | #define INCL_LONGLONG
|
---|
70 |
|
---|
71 | #include "fm3dlg.h"
|
---|
72 | #include "fm3str.h"
|
---|
73 | #include "tools.h"
|
---|
74 | #include "comp.h"
|
---|
75 | #include "datamin.h"
|
---|
76 | #include "arccnrs.h" // BldQuotedFileName
|
---|
77 | #include "errutil.h" // Dos_Error...
|
---|
78 | #include "strutil.h" // GetPString
|
---|
79 | #include "notebook.h" // CfgDlgProc CfgMenuInit
|
---|
80 | #include "fm3dll.h"
|
---|
81 |
|
---|
82 | #pragma data_seg(DATA1)
|
---|
83 |
|
---|
84 | static PSZ pszSrcFile = __FILE__;
|
---|
85 |
|
---|
86 | static USHORT firsttool = 0;
|
---|
87 |
|
---|
88 | static BOOL CloseDirCnrChildren(HWND hwndClient);
|
---|
89 | static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview);
|
---|
90 |
|
---|
91 | static MRESULT EXPENTRY MainObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
92 | MPARAM mp2)
|
---|
93 | {
|
---|
94 | switch (msg) {
|
---|
95 | case UM_SETUP:
|
---|
96 | case UM_SETUP2:
|
---|
97 | case UM_SETUP3:
|
---|
98 | case UM_SETUP4:
|
---|
99 | case UM_SETUP5:
|
---|
100 | /*
|
---|
101 | * feed setup messages to main window
|
---|
102 | */
|
---|
103 | PostMsg(hwndMain, msg, mp1, mp2);
|
---|
104 | return 0;
|
---|
105 |
|
---|
106 | case UM_SETUP6:
|
---|
107 | /*
|
---|
108 | * handle bubble help requests from drive bar buttons
|
---|
109 | */
|
---|
110 | {
|
---|
111 | char dv[3], d;
|
---|
112 | HWND hwndB = (HWND) mp1;
|
---|
113 | USHORT id;
|
---|
114 |
|
---|
115 | id = WinQueryWindowUShort(hwndB, QWS_ID);
|
---|
116 | *dv = 0;
|
---|
117 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwndB, QW_PARENT),
|
---|
118 | id + 50), sizeof(dv), dv);
|
---|
119 | d = toupper(*dv);
|
---|
120 | if (isalpha(d) && d > 'B' &&
|
---|
121 | !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID |
|
---|
122 | DRIVE_SLOW)) &&
|
---|
123 | (!hwndBubble ||
|
---|
124 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&
|
---|
125 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
126 |
|
---|
127 | FSALLOCATE fsa;
|
---|
128 | CHAR s[90], szQty[38];
|
---|
129 | ULONG ulPctFree;
|
---|
130 | ULONGLONG ullFreeQty;
|
---|
131 |
|
---|
132 | if (!DosQueryFSInfo((d - 'A') + 1,
|
---|
133 | FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {
|
---|
134 | ullFreeQty = (ULONGLONG) fsa.cUnitAvail *
|
---|
135 | (fsa.cSectorUnit * fsa.cbSector);
|
---|
136 | ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ?
|
---|
137 | (fsa.cUnitAvail * 100) / fsa.cUnit : 0;
|
---|
138 | CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' ');
|
---|
139 | sprintf(s, "%s (%lu%%) free", szQty, ulPctFree);
|
---|
140 | }
|
---|
141 | if ((!hwndBubble ||
|
---|
142 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&
|
---|
143 | !WinQueryCapture(HWND_DESKTOP))
|
---|
144 | WinSendMsg(hwndB, UM_SETUP6, MPFROMP(s), MPVOID);
|
---|
145 | }
|
---|
146 | }
|
---|
147 | return 0;
|
---|
148 |
|
---|
149 | case UM_SETDIR:
|
---|
150 | {
|
---|
151 | CHAR s[8] = " :\\OS2";
|
---|
152 | ULONG bd;
|
---|
153 |
|
---|
154 | if (DosQuerySysInfo(QSV_BOOT_DRIVE,
|
---|
155 | QSV_BOOT_DRIVE,
|
---|
156 | (PVOID) & bd, (ULONG) sizeof(ULONG)))
|
---|
157 | bd = 3L;
|
---|
158 | *s = (CHAR) bd + '@';
|
---|
159 | WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPFROMLONG(1));
|
---|
160 | if (!mp1) {
|
---|
161 | s[3] = 0;
|
---|
162 | WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID);
|
---|
163 | }
|
---|
164 | PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1), MPFROMLONG(1));
|
---|
165 | }
|
---|
166 | return 0;
|
---|
167 |
|
---|
168 | case UM_RESTORE:
|
---|
169 | switch ((ULONG)mp2) {
|
---|
170 | case 1:
|
---|
171 | TileChildren(hwndMain, TRUE);
|
---|
172 | break;
|
---|
173 | case 2:
|
---|
174 | CloseDirCnrChildren(hwndMain);
|
---|
175 | break;
|
---|
176 | case 0:
|
---|
177 | fNoTileUpdate = TRUE;
|
---|
178 | WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), FALSE);
|
---|
179 | RestoreDirCnrState(hwndMain, (char *)mp1, FALSE);
|
---|
180 | WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), TRUE);
|
---|
181 | fNoTileUpdate = FALSE;
|
---|
182 | if (mp1)
|
---|
183 | free((char *)mp1);
|
---|
184 | if (fAutoTile)
|
---|
185 | TileChildren(hwndMain, TRUE);
|
---|
186 | break;
|
---|
187 | default:
|
---|
188 | Runtime_Error(pszSrcFile, __LINE__, "%u unexpected", mp2);
|
---|
189 | }
|
---|
190 | return 0;
|
---|
191 |
|
---|
192 | case UM_NOTIFY:
|
---|
193 | /*
|
---|
194 | * bring up notify messages for various windows
|
---|
195 | */
|
---|
196 | if (mp1)
|
---|
197 | return MRFROMLONG(DoNotify((char *)mp1));
|
---|
198 | return 0;
|
---|
199 |
|
---|
200 | case WM_DESTROY:
|
---|
201 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
202 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
---|
203 | break;
|
---|
204 | }
|
---|
205 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
206 | }
|
---|
207 |
|
---|
208 | VOID MakeMainObjWin(VOID * args)
|
---|
209 | {
|
---|
210 | HAB hab2;
|
---|
211 | HMQ hmq2;
|
---|
212 | QMSG qmsg2;
|
---|
213 |
|
---|
214 | priority_bumped();
|
---|
215 | hab2 = WinInitialize(0);
|
---|
216 | if (hab2) {
|
---|
217 | hmq2 = WinCreateMsgQueue(hab2, 128);
|
---|
218 | if (hmq2) {
|
---|
219 | DosError(FERR_DISABLEHARDERR);
|
---|
220 | WinRegisterClass(hab2,
|
---|
221 | (PSZ) WC_OBJECTWINDOW,
|
---|
222 | MainObjectWndProc, 0, sizeof(PVOID));
|
---|
223 | MainObjectHwnd = WinCreateWindow(HWND_OBJECT,
|
---|
224 | WC_OBJECTWINDOW,
|
---|
225 | (PSZ) NULL,
|
---|
226 | 0,
|
---|
227 | 0L,
|
---|
228 | 0L,
|
---|
229 | 0L,
|
---|
230 | 0L,
|
---|
231 | 0L, HWND_TOP, OBJ_FRAME, NULL, NULL);
|
---|
232 | if (!MainObjectHwnd)
|
---|
233 | Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
234 | IDS_WINCREATEWINDOW);
|
---|
235 | else {
|
---|
236 | WinSetWindowPtr(MainObjectHwnd, QWL_USER, args);
|
---|
237 | while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0))
|
---|
238 | WinDispatchMsg(hab2, &qmsg2);
|
---|
239 | WinDestroyWindow(MainObjectHwnd);
|
---|
240 | }
|
---|
241 | WinDestroyMsgQueue(hmq2);
|
---|
242 | }
|
---|
243 | WinTerminate(hab2);
|
---|
244 | }
|
---|
245 | }
|
---|
246 |
|
---|
247 | static MRESULT EXPENTRY IdealButtonProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
248 | MPARAM mp2)
|
---|
249 | {
|
---|
250 | switch (msg) {
|
---|
251 | case WM_MOUSEMOVE:
|
---|
252 | BubbleHelp(hwnd, TRUE, FALSE, FALSE, GetPString(IDS_IDEALBUTTONHELP));
|
---|
253 | break;
|
---|
254 | }
|
---|
255 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
256 | }
|
---|
257 |
|
---|
258 | HWND TopWindow(HWND hwndParent, HWND exclude)
|
---|
259 | {
|
---|
260 | HENUM henum;
|
---|
261 | HWND hwndC = (HWND) 0;
|
---|
262 | USHORT id;
|
---|
263 |
|
---|
264 | if (hwndParent) {
|
---|
265 | henum = WinBeginEnumWindows(hwndMain);
|
---|
266 | while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
267 | if (hwndC != exclude) {
|
---|
268 | id = WinQueryWindowUShort(hwndC, QWS_ID);
|
---|
269 | if (id)
|
---|
270 | break;
|
---|
271 | }
|
---|
272 | }
|
---|
273 | WinEndEnumWindows(henum);
|
---|
274 | }
|
---|
275 | return hwndC;
|
---|
276 | }
|
---|
277 |
|
---|
278 | HWND TopWindowName(HWND hwndParent, HWND exclude, CHAR * ret)
|
---|
279 | {
|
---|
280 | HENUM henum;
|
---|
281 | HWND hwndC = (HWND) 0, hwndDir, hwndClient;
|
---|
282 | USHORT id;
|
---|
283 | PCNRITEM pci = NULL;
|
---|
284 |
|
---|
285 | if (ret) {
|
---|
286 | *ret = 0;
|
---|
287 | if (hwndParent) {
|
---|
288 | henum = WinBeginEnumWindows(hwndMain);
|
---|
289 | while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
290 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC);
|
---|
291 | if (hwndC != exclude && hwndC != hwndTree) {
|
---|
292 | id = WinQueryWindowUShort(hwndC, QWS_ID);
|
---|
293 | if (id) {
|
---|
294 | hwndClient = WinWindowFromID(hwndC, FID_CLIENT);
|
---|
295 | if (hwndClient) {
|
---|
296 | hwndDir = WinWindowFromID(hwndClient, DIR_CNR);
|
---|
297 | if (hwndDir) {
|
---|
298 | if (fLookInDir) {
|
---|
299 | pci = (PCNRITEM) WinSendMsg(hwndDir,
|
---|
300 | CM_QUERYRECORDEMPHASIS,
|
---|
301 | MPFROMLONG(CMA_FIRST),
|
---|
302 | MPFROMSHORT(CRA_CURSORED));
|
---|
303 | if (pci && (INT) pci != -1)
|
---|
304 | break;
|
---|
305 | }
|
---|
306 | if (WinSendMsg(hwndClient,
|
---|
307 | UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) {
|
---|
308 | MakeValidDir(ret);
|
---|
309 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret);
|
---|
310 | WinEndEnumWindows(henum);
|
---|
311 | return hwndC;
|
---|
312 | }
|
---|
313 | }
|
---|
314 | }
|
---|
315 | }
|
---|
316 | }
|
---|
317 | }
|
---|
318 | WinEndEnumWindows(henum);
|
---|
319 | if (!pci || (INT) pci == -1) {
|
---|
320 | hwndC = hwndTree;
|
---|
321 | pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree,
|
---|
322 | FID_CLIENT),
|
---|
323 | TREE_CNR),
|
---|
324 | CM_QUERYRECORDEMPHASIS,
|
---|
325 | MPFROMLONG(CMA_FIRST),
|
---|
326 | MPFROMSHORT(CRA_CURSORED));
|
---|
327 | }
|
---|
328 | if (pci && (INT) pci != -1) {
|
---|
329 | strcpy(ret, pci->pszFileName);
|
---|
330 | MakeValidDir(ret);
|
---|
331 | }
|
---|
332 | else
|
---|
333 | save_dir2(ret);
|
---|
334 | }
|
---|
335 | }
|
---|
336 | return hwndC;
|
---|
337 | }
|
---|
338 |
|
---|
339 | ULONG CountDirCnrs(HWND hwndParent)
|
---|
340 | {
|
---|
341 | HENUM henum;
|
---|
342 | HWND hwndF = (HWND) 0, hwndC, hwndDir;
|
---|
343 | ULONG ret = 0;
|
---|
344 |
|
---|
345 | henum = WinBeginEnumWindows(hwndParent);
|
---|
346 | while ((hwndF = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
347 | hwndC = WinWindowFromID(hwndF, FID_CLIENT);
|
---|
348 | if (hwndC) {
|
---|
349 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
---|
350 | if (hwndDir)
|
---|
351 | ret++;
|
---|
352 | }
|
---|
353 | }
|
---|
354 | WinEndEnumWindows(henum);
|
---|
355 | return ret;
|
---|
356 | }
|
---|
357 |
|
---|
358 | HWND FindDirCnrByName(CHAR * directory, BOOL restore)
|
---|
359 | {
|
---|
360 | HENUM henum;
|
---|
361 | HWND hwndF = (HWND) 0, hwndC, hwndDir;
|
---|
362 | CHAR retstr[CCHMAXPATH];
|
---|
363 |
|
---|
364 | if (hwndMain) {
|
---|
365 | henum = WinBeginEnumWindows(hwndMain);
|
---|
366 | while ((hwndF = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
367 | hwndC = WinWindowFromID(hwndF, FID_CLIENT);
|
---|
368 | if (hwndC) {
|
---|
369 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
---|
370 | if (hwndDir) {
|
---|
371 | *retstr = 0;
|
---|
372 | WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID);
|
---|
373 | if (*retstr && !stricmp(retstr, directory)) {
|
---|
374 | if (restore)
|
---|
375 | WinSetWindowPos(hwndF,
|
---|
376 | HWND_TOP,
|
---|
377 | 0,
|
---|
378 | 0,
|
---|
379 | 0,
|
---|
380 | 0,
|
---|
381 | SWP_RESTORE | SWP_SHOW |
|
---|
382 | SWP_ACTIVATE | SWP_ZORDER);
|
---|
383 | break;
|
---|
384 | }
|
---|
385 | }
|
---|
386 | }
|
---|
387 | }
|
---|
388 | WinEndEnumWindows(henum);
|
---|
389 | }
|
---|
390 | return hwndF;
|
---|
391 | }
|
---|
392 |
|
---|
393 | static VOID SetToggleChecks(HWND hwndMenu)
|
---|
394 | {
|
---|
395 | WinCheckMenuItem(hwndMenu, IDM_TEXTTOOLS, fTextTools);
|
---|
396 | WinCheckMenuItem(hwndMenu, IDM_TOOLTITLES, fToolTitles);
|
---|
397 | WinCheckMenuItem(hwndMenu, IDM_USERLIST, fUserComboBox);
|
---|
398 | WinCheckMenuItem(hwndMenu, IDM_TOOLSUBMENU, fToolbar);
|
---|
399 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWSUBMENU, fAutoView);
|
---|
400 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWFILE, !fComments);
|
---|
401 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWCOMMENTS, fComments);
|
---|
402 | WinCheckMenuItem(hwndMenu, IDM_MOREBUTTONS, fMoreButtons);
|
---|
403 | WinCheckMenuItem(hwndMenu, IDM_DRIVEBAR, fDrivebar);
|
---|
404 | WinCheckMenuItem(hwndMenu, IDM_AUTOTILE, fAutoTile);
|
---|
405 | WinCheckMenuItem(hwndMenu, IDM_TILEBACKWARDS, fTileBackwards);
|
---|
406 | WinCheckMenuItem(hwndMenu, IDM_TOGGLEDRAGDIALOG, fDragndropDlg);
|
---|
407 | WinCheckMenuItem(hwndMenu, IDM_SYNCUPDATES, fSyncUpdates);
|
---|
408 | }
|
---|
409 |
|
---|
410 | static VOID ResizeTools(HWND hwnd)
|
---|
411 | {
|
---|
412 | register ULONG butx = 18L;
|
---|
413 | INT attrib = SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER | SWP_NOREDRAW,
|
---|
414 | noattrib;
|
---|
415 | register TOOL *tool, *starttool;
|
---|
416 | SWP *swp;
|
---|
417 | register ULONG numtools, x;
|
---|
418 |
|
---|
419 | if (!fToolbar)
|
---|
420 | return;
|
---|
421 | noattrib = attrib;
|
---|
422 | noattrib &= (~(SWP_SHOW | SWP_ZORDER));
|
---|
423 | noattrib |= SWP_HIDE;
|
---|
424 | /* count tools */
|
---|
425 | tool = toolhead;
|
---|
426 | for (numtools = 0L; tool; numtools++)
|
---|
427 | tool = tool->next;
|
---|
428 | /* allocate swp array for WinSetMultWindowPos */
|
---|
429 | swp = xmallocz(sizeof(SWP) * (numtools + 2), pszSrcFile, __LINE__);
|
---|
430 | if (swp) {
|
---|
431 | for (x = 0; x < numtools + 2L; x++) {
|
---|
432 | swp[x].hwndInsertBehind = HWND_TOP;
|
---|
433 | swp[x].fl = attrib;
|
---|
434 | swp[x].y = (fToolTitles) ? 14L : 3L;
|
---|
435 | swp[x].cx = 32L;
|
---|
436 | swp[x].cy = 32L;
|
---|
437 | }
|
---|
438 | swp[0].x = swp[1].x = 2L;
|
---|
439 | swp[0].y = (fTextTools) ? 14L : 18L;
|
---|
440 | swp[1].y = (fTextTools) ? 1L : 2L;
|
---|
441 | swp[0].cx = swp[1].cx = 14L;
|
---|
442 | swp[0].cy = swp[1].cy = 14L;
|
---|
443 | swp[0].hwnd = WinWindowFromID(hwnd, IDM_TOOLLEFT);
|
---|
444 | swp[1].hwnd = WinWindowFromID(hwnd, IDM_TOOLRIGHT);
|
---|
445 | x = 2L;
|
---|
446 | tool = find_tool(firsttool);
|
---|
447 | if (!tool)
|
---|
448 | tool = toolhead;
|
---|
449 | starttool = tool;
|
---|
450 | while (tool) {
|
---|
451 | if (!(tool->flags & T_INVISIBLE)) {
|
---|
452 | swp[x].x = butx;
|
---|
453 | if (fTextTools || (tool->flags & T_TEXT)) {
|
---|
454 | butx += 55L;
|
---|
455 | swp[x].cx = 54L;
|
---|
456 | swp[x].cy = 24L;
|
---|
457 | swp[x].y = 3L;
|
---|
458 | }
|
---|
459 | else
|
---|
460 | butx += 33L;
|
---|
461 | if (tool->flags & T_SEPARATOR)
|
---|
462 | butx += 12;
|
---|
463 | }
|
---|
464 | else
|
---|
465 | swp[x].fl = noattrib;
|
---|
466 | swp[x].hwnd = WinWindowFromID(hwnd, tool->id);
|
---|
467 | x++;
|
---|
468 | tool = tool->next;
|
---|
469 | }
|
---|
470 | tool = toolhead;
|
---|
471 | while (tool && tool != starttool) {
|
---|
472 | swp[x].x = butx;
|
---|
473 | if (!(tool->flags & T_INVISIBLE)) {
|
---|
474 | if (fTextTools || (tool->flags & T_TEXT)) {
|
---|
475 | butx += 55L;
|
---|
476 | swp[x].cx = 54L;
|
---|
477 | swp[x].cy = 24L;
|
---|
478 | swp[x].y = 3L;
|
---|
479 | }
|
---|
480 | else
|
---|
481 | butx += 33L;
|
---|
482 | if (tool->flags & T_SEPARATOR)
|
---|
483 | butx += 12;
|
---|
484 | }
|
---|
485 | else
|
---|
486 | swp[x].fl = noattrib;
|
---|
487 | swp[x].hwnd = WinWindowFromID(hwnd, tool->id);
|
---|
488 | x++;
|
---|
489 | tool = tool->next;
|
---|
490 | }
|
---|
491 | WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), swp, numtools + 2L);
|
---|
492 | if (!fTextTools && fToolTitles) {
|
---|
493 | for (x = 2L; x < numtools + 2L; x++) {
|
---|
494 | if (fTextTools || !fToolTitles)
|
---|
495 | swp[x].fl = noattrib;
|
---|
496 | else {
|
---|
497 | tool = find_tool(WinQueryWindowUShort(swp[x].hwnd, QWS_ID));
|
---|
498 | if (tool && (tool->flags & T_TEXT))
|
---|
499 | swp[x].fl = noattrib;
|
---|
500 | else {
|
---|
501 | swp[x].hwndInsertBehind = HWND_TOP;
|
---|
502 | swp[x].y = 1L;
|
---|
503 | swp[x].cy = 10L;
|
---|
504 | }
|
---|
505 | }
|
---|
506 | swp[x].hwnd = WinWindowFromID(hwnd,
|
---|
507 | WinQueryWindowUShort(swp[x].hwnd,
|
---|
508 | QWS_ID) + 25000);
|
---|
509 | }
|
---|
510 | WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), &swp[2], numtools);
|
---|
511 | }
|
---|
512 | free(swp);
|
---|
513 | }
|
---|
514 | WinInvalidateRect(hwnd, NULL, TRUE);
|
---|
515 | }
|
---|
516 |
|
---|
517 | static MRESULT EXPENTRY DropDownListProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
518 | MPARAM mp2)
|
---|
519 | {
|
---|
520 | PFNWP oldproc = (PFNWP) INSTDATA(hwnd);
|
---|
521 | USHORT id;
|
---|
522 |
|
---|
523 | static HWND hwndMenu = (HWND)0;
|
---|
524 | static BOOL emphasized = FALSE;
|
---|
525 |
|
---|
526 | switch (msg) {
|
---|
527 | case WM_MOUSEMOVE:
|
---|
528 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
529 | break;
|
---|
530 |
|
---|
531 | case WM_CHAR:
|
---|
532 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
533 | break;
|
---|
534 |
|
---|
535 | case WM_MENUEND:
|
---|
536 | if (hwndMenu == (HWND) mp2) {
|
---|
537 | WinDestroyWindow(hwndMenu);
|
---|
538 | hwndMenu = (HWND) 0;
|
---|
539 | }
|
---|
540 | break;
|
---|
541 |
|
---|
542 | case WM_FOCUSCHANGE:
|
---|
543 | {
|
---|
544 | HAB hab = WinQueryAnchorBlock(hwnd);
|
---|
545 | HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT);
|
---|
546 | HWND hwndFrame = WinQueryWindow(hwndParent, QW_PARENT);
|
---|
547 | static HACCEL haccelSaved = NULLHANDLE;
|
---|
548 | static HACCEL haccelDriveList = NULLHANDLE;
|
---|
549 | static HACCEL haccelSetupList = NULLHANDLE;
|
---|
550 | static HACCEL haccelUserList = NULLHANDLE;
|
---|
551 | static HACCEL haccelCmdList = NULLHANDLE;
|
---|
552 | static HACCEL haccelButtonList = NULLHANDLE;
|
---|
553 | // DbgMsg(pszSrcFile, __LINE__, "WM_FOCUSCHANGE %u", SHORT1FROMMP(mp2));
|
---|
554 | id = WinQueryWindowUShort(hwndParent, QWS_ID);
|
---|
555 | if (SHORT1FROMMP(mp2)) {
|
---|
556 | // If getting focus 1st time - save original accelerator
|
---|
557 | if (haccelSaved == NULLHANDLE) {
|
---|
558 | haccelSaved = WinQueryAccelTable(hab, hwndFrame);
|
---|
559 | if (haccelSaved == NULLHANDLE)
|
---|
560 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable");
|
---|
561 | // else
|
---|
562 | // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved);
|
---|
563 | }
|
---|
564 | if (haccelSaved != NULLHANDLE) {
|
---|
565 | switch (id) {
|
---|
566 | case MAIN_DRIVELIST:
|
---|
567 | if (haccelDriveList == NULLHANDLE) {
|
---|
568 | haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST);
|
---|
569 | if (haccelDriveList == NULLHANDLE)
|
---|
570 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
571 | }
|
---|
572 | if (haccelDriveList != NULLHANDLE) {
|
---|
573 | if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame))
|
---|
574 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
575 | // else
|
---|
576 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList);
|
---|
577 | }
|
---|
578 | break;
|
---|
579 | case MAIN_SETUPLIST:
|
---|
580 | if (haccelSetupList == NULLHANDLE) {
|
---|
581 | haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST);
|
---|
582 | if (haccelSetupList == NULLHANDLE)
|
---|
583 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
584 | }
|
---|
585 | if (haccelSetupList != NULLHANDLE) {
|
---|
586 | if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame))
|
---|
587 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
588 | // else
|
---|
589 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList);
|
---|
590 | }
|
---|
591 | break;
|
---|
592 | case MAIN_CMDLIST:
|
---|
593 | if (haccelCmdList == NULLHANDLE) {
|
---|
594 | haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST);
|
---|
595 | if (haccelCmdList == NULLHANDLE)
|
---|
596 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
597 | }
|
---|
598 | if (haccelCmdList != NULLHANDLE) {
|
---|
599 | if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame))
|
---|
600 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
601 | // else
|
---|
602 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList);
|
---|
603 | }
|
---|
604 | break;
|
---|
605 | case MAIN_USERLIST:
|
---|
606 | if (haccelUserList == NULLHANDLE) {
|
---|
607 | haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST);
|
---|
608 | if (haccelUserList == NULLHANDLE)
|
---|
609 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
610 | }
|
---|
611 | if (haccelUserList != NULLHANDLE) {
|
---|
612 | if (!WinSetAccelTable(hab, haccelUserList, hwndFrame))
|
---|
613 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
614 | // else
|
---|
615 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList);
|
---|
616 | }
|
---|
617 | break;
|
---|
618 | case MAIN_BUTTONLIST:
|
---|
619 | if (haccelButtonList == NULLHANDLE) {
|
---|
620 | haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST);
|
---|
621 | if (haccelButtonList == NULLHANDLE)
|
---|
622 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
623 | }
|
---|
624 | if (haccelButtonList != NULLHANDLE) {
|
---|
625 | if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame))
|
---|
626 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
627 | // else
|
---|
628 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList);
|
---|
629 | }
|
---|
630 | break;
|
---|
631 | } // switch
|
---|
632 | }
|
---|
633 | }
|
---|
634 | else {
|
---|
635 | // Losing focus
|
---|
636 | switch (id) {
|
---|
637 | case MAIN_DRIVELIST:
|
---|
638 | case MAIN_SETUPLIST:
|
---|
639 | case MAIN_CMDLIST:
|
---|
640 | case MAIN_USERLIST:
|
---|
641 | case MAIN_BUTTONLIST:
|
---|
642 | if (haccelSaved != NULLHANDLE) {
|
---|
643 | if (!WinSetAccelTable(hab, haccelSaved, hwndFrame))
|
---|
644 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
645 | // else
|
---|
646 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved);
|
---|
647 | }
|
---|
648 | break;
|
---|
649 | } // switch
|
---|
650 | }
|
---|
651 | }
|
---|
652 | break; // WM_FOCUSCHANGE
|
---|
653 |
|
---|
654 | case WM_CONTEXTMENU:
|
---|
655 | {
|
---|
656 | MRESULT ret = MRFROMSHORT(TRUE);
|
---|
657 |
|
---|
658 | if (hwndMenu)
|
---|
659 | WinDestroyWindow(hwndMenu);
|
---|
660 | hwndMenu = (HWND) 0;
|
---|
661 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
662 | switch (id) {
|
---|
663 | case MAIN_CMDLIST:
|
---|
664 | WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
665 | QW_PARENT),
|
---|
666 | QW_PARENT),
|
---|
667 | FID_CLIENT),
|
---|
668 | WM_COMMAND, MPFROM2SHORT(IDM_EDITCOMMANDS, 0), MPVOID);
|
---|
669 | break;
|
---|
670 | case MAIN_USERLIST:
|
---|
671 | case MAIN_SETUPLIST:
|
---|
672 | hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
|
---|
673 | if (hwndMenu)
|
---|
674 | PopupMenu(hwnd,
|
---|
675 | WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
676 | QW_PARENT),
|
---|
677 | QW_PARENT),
|
---|
678 | FID_CLIENT), hwndMenu);
|
---|
679 | break;
|
---|
680 | default:
|
---|
681 | ret = FALSE;
|
---|
682 | break;
|
---|
683 | } // switch
|
---|
684 | return ret;
|
---|
685 | }
|
---|
686 |
|
---|
687 | case WM_CONTROL:
|
---|
688 | if (hwndStatus2) {
|
---|
689 | switch (SHORT1FROMMP(mp1)) {
|
---|
690 | case CBID_EDIT:
|
---|
691 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
692 | switch (SHORT2FROMMP(mp1)) {
|
---|
693 | case EN_SETFOCUS:
|
---|
694 | switch (id) {
|
---|
695 | case MAIN_CMDLIST:
|
---|
696 | WinSetWindowText(hwndStatus2, GetPString(IDS_CMDLISTHELP));
|
---|
697 | break;
|
---|
698 | case MAIN_SETUPLIST:
|
---|
699 | WinSetWindowText(hwndStatus2, GetPString(IDS_SETUPLISTHELP));
|
---|
700 | break;
|
---|
701 | case MAIN_USERLIST:
|
---|
702 | WinSetWindowText(hwndStatus2, GetPString(IDS_USERLISTHELP));
|
---|
703 | break;
|
---|
704 | case MAIN_DRIVELIST:
|
---|
705 | WinSetWindowText(hwndStatus2, GetPString(IDS_DRIVELISTHELP));
|
---|
706 | break;
|
---|
707 | case MAIN_BUTTONLIST:
|
---|
708 | WinSetWindowText(hwndStatus2, GetPString(IDS_BUTTONLISTHELP));
|
---|
709 | break;
|
---|
710 | default:
|
---|
711 | break;
|
---|
712 | }
|
---|
713 | break;
|
---|
714 |
|
---|
715 | default:
|
---|
716 | break;
|
---|
717 | }
|
---|
718 | }
|
---|
719 | break;
|
---|
720 |
|
---|
721 | default:
|
---|
722 | break;
|
---|
723 | }
|
---|
724 | break;
|
---|
725 |
|
---|
726 | case WM_BEGINDRAG:
|
---|
727 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
728 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"%u %s %u",id,(id == CBID_EDIT) ? "TRUE" : "FALSE",WinQueryWindowUShort(WinQueryWindow(hwnd,QW_PARENT),QWS_ID) == MAIN_USERLIST);
|
---|
729 | if (id == CBID_EDIT &&
|
---|
730 | WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) ==
|
---|
731 | MAIN_USERLIST) {
|
---|
732 |
|
---|
733 | CHAR path[CCHMAXPATH];
|
---|
734 |
|
---|
735 | *path = 0;
|
---|
736 | WinQueryWindowText(hwnd, CCHMAXPATH, path);
|
---|
737 | bstrip(path);
|
---|
738 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Dragging: %s",path);
|
---|
739 | if (*path && !IsRoot(path))
|
---|
740 | DragOne(hwnd, (HWND) 0, path, FALSE);
|
---|
741 | return 0;
|
---|
742 | }
|
---|
743 | break;
|
---|
744 |
|
---|
745 | case DM_DRAGOVER:
|
---|
746 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
747 | if (id == MAIN_USERLIST) {
|
---|
748 | if (!emphasized) {
|
---|
749 | emphasized = TRUE;
|
---|
750 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
751 | }
|
---|
752 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
---|
753 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
---|
754 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
---|
755 | }
|
---|
756 | break;
|
---|
757 |
|
---|
758 | case DM_DRAGLEAVE:
|
---|
759 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
760 | if (id == MAIN_USERLIST) {
|
---|
761 | if (emphasized) {
|
---|
762 | emphasized = FALSE;
|
---|
763 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
764 | }
|
---|
765 | }
|
---|
766 | break;
|
---|
767 |
|
---|
768 | case DM_DROPHELP:
|
---|
769 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
770 | if (id == MAIN_USERLIST) {
|
---|
771 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_USERLISTDROPHELP));
|
---|
772 | return 0;
|
---|
773 | }
|
---|
774 | break;
|
---|
775 |
|
---|
776 | case DM_DROP:
|
---|
777 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
778 | if (id == MAIN_USERLIST) {
|
---|
779 |
|
---|
780 | char szFrom[CCHMAXPATH + 2];
|
---|
781 |
|
---|
782 | if (emphasized) {
|
---|
783 | emphasized = FALSE;
|
---|
784 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
785 | }
|
---|
786 | if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
|
---|
787 | MakeValidDir(szFrom);
|
---|
788 | WinSetWindowText(hwnd, szFrom);
|
---|
789 | PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
790 | QW_PARENT),
|
---|
791 | QW_PARENT),
|
---|
792 | FID_CLIENT),
|
---|
793 | UM_COMMAND, MPFROM2SHORT(IDM_ADDTOUSERLIST, 0), MPVOID);
|
---|
794 | return 0;
|
---|
795 | }
|
---|
796 | }
|
---|
797 | break;
|
---|
798 |
|
---|
799 | case WM_DESTROY:
|
---|
800 | if (hwndMenu)
|
---|
801 | WinDestroyWindow(hwndMenu);
|
---|
802 | hwndMenu = (HWND) 0;
|
---|
803 | break;
|
---|
804 | }
|
---|
805 |
|
---|
806 | return oldproc(hwnd, msg, mp1, mp2);
|
---|
807 | }
|
---|
808 |
|
---|
809 | void BubbleHelp(HWND hwnd, BOOL other, BOOL drive, BOOL above, char *help)
|
---|
810 | {
|
---|
811 | if (help && *help &&
|
---|
812 | ((drive && fDrivebarHelp) ||
|
---|
813 | (other && fOtherHelp) || (!other && !drive && fToolbarHelp))) {
|
---|
814 | if ((!hwndBubble ||
|
---|
815 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
---|
816 | !WinQueryCapture(HWND_DESKTOP))
|
---|
817 | MakeBubble(hwnd, above, help);
|
---|
818 | }
|
---|
819 | }
|
---|
820 |
|
---|
821 | VOID MakeBubble(HWND hwnd, BOOL above, CHAR * help)
|
---|
822 | {
|
---|
823 | if (!hwnd || !help || !*help)
|
---|
824 | return;
|
---|
825 |
|
---|
826 | if (hwndBubble)
|
---|
827 | WinDestroyWindow(hwndBubble);
|
---|
828 |
|
---|
829 | {
|
---|
830 | HWND hwndActive;
|
---|
831 | char ucClassname[8];
|
---|
832 |
|
---|
833 | hwndActive = WinQueryActiveWindow(HWND_DESKTOP);
|
---|
834 | if (hwndActive) {
|
---|
835 | /* don't bring up help if window isn't active */
|
---|
836 | if (!WinIsChild(hwnd, hwndActive))
|
---|
837 | return;
|
---|
838 | }
|
---|
839 | hwndActive = WinQueryFocus(HWND_DESKTOP);
|
---|
840 | if (WinQueryClassName(hwndActive, sizeof(ucClassname), ucClassname)) {
|
---|
841 | /* don't bring up help if a menu is active */
|
---|
842 | if (!strcmp(ucClassname, "#4"))
|
---|
843 | return;
|
---|
844 | }
|
---|
845 | }
|
---|
846 |
|
---|
847 | hwndBubble = WinCreateWindow(HWND_DESKTOP,
|
---|
848 | WC_BUBBLE,
|
---|
849 | help,
|
---|
850 | WS_CLIPSIBLINGS | SS_TEXT |
|
---|
851 | DT_CENTER | DT_VCENTER,
|
---|
852 | 0,
|
---|
853 | 0,
|
---|
854 | 0,
|
---|
855 | 0,
|
---|
856 | HWND_DESKTOP, HWND_TOP, MAIN_HELP, NULL, NULL);
|
---|
857 | if (!hwndBubble)
|
---|
858 | Win_Error2(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
859 | IDS_WINCREATEWINDOW);
|
---|
860 | else {
|
---|
861 | HPS hps;
|
---|
862 | POINTL aptl[TXTBOX_COUNT], ptl, tptl;
|
---|
863 | LONG lxScreen, sx, sy, extra = 0, lyScreen;
|
---|
864 | char *p, *pp, *wp;
|
---|
865 | SWP swp;
|
---|
866 |
|
---|
867 | WinQueryWindowPos(hwnd, &swp);
|
---|
868 | lyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
|
---|
869 | lxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
|
---|
870 | WinSetWindowULong(hwndBubble, QWL_USER, hwnd);
|
---|
871 | SetPresParams(hwndBubble, NULL, NULL, NULL, GetPString(IDS_8HELVTEXT));
|
---|
872 | hps = WinGetPS(hwndBubble);
|
---|
873 | p = help;
|
---|
874 | tptl.x = tptl.y = 0;
|
---|
875 | while (p && *p) {
|
---|
876 | wp = NULL;
|
---|
877 | pp = strchr(p, '\r');
|
---|
878 | if (pp) {
|
---|
879 | wp = pp;
|
---|
880 | *pp = 0;
|
---|
881 | pp++;
|
---|
882 | }
|
---|
883 | GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
|
---|
884 | tptl.x = max(aptl[TXTBOX_TOPRIGHT].x, tptl.x);
|
---|
885 | if (tptl.y)
|
---|
886 | tptl.y += extra;
|
---|
887 | else
|
---|
888 | extra = aptl[TXTBOX_TOPLEFT].y / 4;
|
---|
889 | tptl.y += aptl[TXTBOX_TOPLEFT].y;
|
---|
890 | if (wp)
|
---|
891 | *wp = '\r';
|
---|
892 | p = pp;
|
---|
893 | }
|
---|
894 | WinSetWindowULong(hwndBubble, QWL_USER + 4, extra);
|
---|
895 | WinReleasePS(hps);
|
---|
896 | ptl.x = ptl.y = 0;
|
---|
897 | WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptl, 1);
|
---|
898 | if (above) {
|
---|
899 | sy = ptl.y + swp.cy + 4;
|
---|
900 | if (sy + tptl.y + 12 > lyScreen) {
|
---|
901 | above = FALSE;
|
---|
902 | sy = ptl.y - (tptl.y + 14);
|
---|
903 | }
|
---|
904 | }
|
---|
905 | else
|
---|
906 | sy = ptl.y - (tptl.y + 14);
|
---|
907 | if (ptl.x > (lxScreen / 2))
|
---|
908 | sx = (ptl.x - tptl.x) - 16;
|
---|
909 | else
|
---|
910 | sx = ptl.x + (54 * (above == FALSE)) + 2;
|
---|
911 | if (sx < 0)
|
---|
912 | sx = 0;
|
---|
913 | if (sx + tptl.x + 14 > lxScreen)
|
---|
914 | sx = lxScreen - (tptl.x + 14);
|
---|
915 | if (sy < 0) {
|
---|
916 | sy = ptl.y + swp.cy + 4;
|
---|
917 | if (sy + tptl.y + 12 > lyScreen)
|
---|
918 | sy = 0;
|
---|
919 | }
|
---|
920 | WinSetWindowPos(hwndBubble, HWND_TOP, sx, sy,
|
---|
921 | tptl.x + 14,
|
---|
922 | tptl.y + 12,
|
---|
923 | SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER |
|
---|
924 | SWP_MOVE | SWP_SIZE);
|
---|
925 | }
|
---|
926 | }
|
---|
927 |
|
---|
928 | MRESULT EXPENTRY BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
929 | {
|
---|
930 | switch (msg) {
|
---|
931 | case WM_SETFOCUS:
|
---|
932 | if (mp2)
|
---|
933 | PostMsg(hwnd, UM_FOCUSME, mp1, MPVOID);
|
---|
934 | break;
|
---|
935 |
|
---|
936 | case UM_FOCUSME:
|
---|
937 | WinSetFocus(HWND_DESKTOP, (HWND) mp1);
|
---|
938 | return 0;
|
---|
939 |
|
---|
940 | case WM_MOUSEMOVE:
|
---|
941 | WinShowWindow(hwnd, FALSE);
|
---|
942 | break;
|
---|
943 |
|
---|
944 | case UM_TIMER:
|
---|
945 | {
|
---|
946 | POINTL ptl;
|
---|
947 |
|
---|
948 | WinQueryPointerPos(HWND_DESKTOP, &ptl);
|
---|
949 | if (WinWindowFromPoint(HWND_DESKTOP, &ptl, TRUE) !=
|
---|
950 | WinQueryWindowULong(hwnd, QWL_USER) || !WinIsWindowVisible(hwnd))
|
---|
951 | WinDestroyWindow(hwnd);
|
---|
952 | }
|
---|
953 | return 0;
|
---|
954 |
|
---|
955 | case WM_PAINT:
|
---|
956 | {
|
---|
957 | HPS hps;
|
---|
958 | SWP swp;
|
---|
959 | POINTL ptl, aptl[TXTBOX_COUNT];
|
---|
960 | CHAR *s, *p, *pp, *wp;
|
---|
961 | ULONG extra, tlen, y;
|
---|
962 |
|
---|
963 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
---|
964 | if (hps) {
|
---|
965 | WinQueryWindowPos(hwnd, &swp);
|
---|
966 | GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0);
|
---|
967 | GpiSetColor(hps, ((255 << 16) | (255 << 8) | 198));
|
---|
968 | GpiSetBackMix(hps, BM_LEAVEALONE);
|
---|
969 | GpiSetMix(hps, FM_OVERPAINT);
|
---|
970 | ptl.x = ptl.y = 0;
|
---|
971 | GpiMove(hps, &ptl);
|
---|
972 | ptl.x = swp.cx - 1;
|
---|
973 | ptl.y = swp.cy - 1;
|
---|
974 | GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
|
---|
975 | tlen = WinQueryWindowTextLength(hwnd);
|
---|
976 | if (tlen) {
|
---|
977 | s = xmalloc(tlen + 2, pszSrcFile, __LINE__);
|
---|
978 | if (s) {
|
---|
979 | WinQueryWindowText(hwnd, tlen + 1, s);
|
---|
980 | if (*s) {
|
---|
981 | p = s;
|
---|
982 | y = swp.cy - 3;
|
---|
983 | extra = WinQueryWindowULong(hwnd, QWL_USER + 4);
|
---|
984 | GpiSetColor(hps, 0);
|
---|
985 | GpiSetMix(hps, FM_OVERPAINT);
|
---|
986 | while (p && *p) {
|
---|
987 | wp = NULL;
|
---|
988 | pp = strchr(p, '\r');
|
---|
989 | if (pp) {
|
---|
990 | wp = pp;
|
---|
991 | *pp = 0;
|
---|
992 | pp++;
|
---|
993 | }
|
---|
994 | GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
|
---|
995 | ptl.x = 7;
|
---|
996 | y -= aptl[TXTBOX_TOPLEFT].y;
|
---|
997 | if (p != s)
|
---|
998 | y -= extra;
|
---|
999 | ptl.y = y;
|
---|
1000 | GpiCharStringAt(hps, &ptl, strlen(p), p);
|
---|
1001 | if (wp)
|
---|
1002 | *wp = '\r';
|
---|
1003 | p = pp;
|
---|
1004 | }
|
---|
1005 | }
|
---|
1006 | free(s);
|
---|
1007 | }
|
---|
1008 | }
|
---|
1009 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) && swp.cx > 6 && swp.cy > 6) {
|
---|
1010 | GpiSetColor(hps, CLR_WHITE);
|
---|
1011 | ptl.x = 1;
|
---|
1012 | ptl.y = 1;
|
---|
1013 | GpiMove(hps, &ptl);
|
---|
1014 | ptl.y = swp.cy - 2;
|
---|
1015 | GpiLine(hps, &ptl);
|
---|
1016 | ptl.x = swp.cx - 2;
|
---|
1017 | GpiLine(hps, &ptl);
|
---|
1018 | ptl.x = 2;
|
---|
1019 | ptl.y = 2;
|
---|
1020 | GpiMove(hps, &ptl);
|
---|
1021 | ptl.y = swp.cy - 3;
|
---|
1022 | GpiLine(hps, &ptl);
|
---|
1023 | ptl.x = swp.cx - 3;
|
---|
1024 | GpiLine(hps, &ptl);
|
---|
1025 | GpiSetColor(hps, CLR_BROWN);
|
---|
1026 | ptl.x = 1;
|
---|
1027 | ptl.y = 1;
|
---|
1028 | GpiMove(hps, &ptl);
|
---|
1029 | ptl.x = swp.cx - 2;
|
---|
1030 | GpiLine(hps, &ptl);
|
---|
1031 | ptl.y = swp.cy - 2;
|
---|
1032 | GpiLine(hps, &ptl);
|
---|
1033 | ptl.x = 2;
|
---|
1034 | ptl.y = 2;
|
---|
1035 | GpiMove(hps, &ptl);
|
---|
1036 | ptl.x = swp.cx - 3;
|
---|
1037 | GpiLine(hps, &ptl);
|
---|
1038 | ptl.y = swp.cy - 3;
|
---|
1039 | GpiLine(hps, &ptl);
|
---|
1040 | }
|
---|
1041 | WinEndPaint(hps);
|
---|
1042 | }
|
---|
1043 | }
|
---|
1044 | return 0;
|
---|
1045 |
|
---|
1046 | case WM_CLOSE:
|
---|
1047 | WinDestroyWindow(hwnd);
|
---|
1048 | return 0;
|
---|
1049 |
|
---|
1050 | case WM_DESTROY:
|
---|
1051 | hwndBubble = (HWND) 0;
|
---|
1052 | break;
|
---|
1053 | }
|
---|
1054 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
1055 | }
|
---|
1056 |
|
---|
1057 | MRESULT EXPENTRY LEDProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1058 | {
|
---|
1059 | switch (msg) {
|
---|
1060 | case WM_CREATE:
|
---|
1061 | {
|
---|
1062 | MRESULT mr = PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
1063 | HBITMAP hbmold = (HBITMAP) 0;
|
---|
1064 | HPS hps = (HPS) 0;
|
---|
1065 |
|
---|
1066 | switch (WinQueryWindowUShort(hwnd, QWS_ID)) {
|
---|
1067 | case MAIN_LED:
|
---|
1068 | hps = WinGetPS(hwnd);
|
---|
1069 | hbmold = (HBITMAP) WinSendMsg(hwnd, SM_QUERYHANDLE, MPVOID, MPVOID);
|
---|
1070 | if (!fBlueLED) {
|
---|
1071 | hbmLEDon = GpiLoadBitmap(hps, 0, LEDON_BMP, 12, 12);
|
---|
1072 | hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF_BMP, 12, 12);
|
---|
1073 | }
|
---|
1074 | else {
|
---|
1075 | hbmLEDon = GpiLoadBitmap(hps, 0, LEDON2_BMP, 12, 12);
|
---|
1076 | hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF2_BMP, 12, 12);
|
---|
1077 | }
|
---|
1078 | if (hbmLEDoff && hbmLEDon)
|
---|
1079 | WinSendMsg(hwnd, SM_SETHANDLE, MPFROMLONG(hbmLEDoff), MPVOID);
|
---|
1080 | else {
|
---|
1081 | if (hbmLEDoff)
|
---|
1082 | GpiDeleteBitmap(hbmLEDoff);
|
---|
1083 | if (hbmLEDon)
|
---|
1084 | GpiDeleteBitmap(hbmLEDon);
|
---|
1085 | }
|
---|
1086 | if (hbmold &&
|
---|
1087 | hbmLEDon &&
|
---|
1088 | hbmLEDoff && hbmold != hbmLEDon && hbmold != hbmLEDoff)
|
---|
1089 | GpiDeleteBitmap(hbmold);
|
---|
1090 | if (hps)
|
---|
1091 | WinReleasePS(hps);
|
---|
1092 | break;
|
---|
1093 | default:
|
---|
1094 | SetPresParams(hwnd,
|
---|
1095 | &RGBGREY,
|
---|
1096 | &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));
|
---|
1097 | break;
|
---|
1098 | }
|
---|
1099 | return mr;
|
---|
1100 | }
|
---|
1101 |
|
---|
1102 | case WM_SETFOCUS:
|
---|
1103 | if (mp2)
|
---|
1104 | PostMsg(hwnd, UM_FOCUSME, mp1, MPVOID);
|
---|
1105 | break;
|
---|
1106 |
|
---|
1107 | case UM_FOCUSME:
|
---|
1108 | WinSetFocus(HWND_DESKTOP, (HWND) mp1);
|
---|
1109 | return 0;
|
---|
1110 |
|
---|
1111 | case WM_MOUSEMOVE:
|
---|
1112 | BubbleHelp(hwnd, TRUE, FALSE, FALSE, GetPString(IDS_LEDHELP));
|
---|
1113 | if (!fNoFinger) {
|
---|
1114 | WinSetPointer(HWND_DESKTOP, hptrFinger);
|
---|
1115 | return MRFROMLONG(TRUE);
|
---|
1116 | }
|
---|
1117 | break;
|
---|
1118 |
|
---|
1119 | case WM_BUTTON1CLICK:
|
---|
1120 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
1121 | WM_COMMAND, MPFROM2SHORT(IDM_SHOWNOTEWND, 0), MPVOID);
|
---|
1122 | break;
|
---|
1123 |
|
---|
1124 | case WM_BUTTON2CLICK:
|
---|
1125 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
1126 | WM_COMMAND, MPFROM2SHORT(IDM_HIDENOTEWND, 0), MPVOID);
|
---|
1127 | break;
|
---|
1128 |
|
---|
1129 | case WM_CHORD:
|
---|
1130 | case WM_BUTTON3CLICK:
|
---|
1131 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
1132 | WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
---|
1133 | break;
|
---|
1134 | }
|
---|
1135 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
1136 | }
|
---|
1137 |
|
---|
1138 | MRESULT EXPENTRY ChildButtonProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1139 | {
|
---|
1140 | USHORT id;
|
---|
1141 | TOOL *tool;
|
---|
1142 |
|
---|
1143 | static HWND hwndMenu = (HWND) 0;
|
---|
1144 |
|
---|
1145 | switch (msg) {
|
---|
1146 | case WM_BUTTON1DOWN:
|
---|
1147 | case WM_BUTTON2DOWN:
|
---|
1148 | case WM_BUTTON3DOWN:
|
---|
1149 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
1150 | break;
|
---|
1151 |
|
---|
1152 | case WM_MOUSEMOVE:
|
---|
1153 | if (fToolbarHelp) {
|
---|
1154 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
---|
1155 | && !WinQueryCapture(HWND_DESKTOP)) {
|
---|
1156 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1157 | tool = find_tool(id);
|
---|
1158 | if (tool && tool->help && *tool->help) {
|
---|
1159 |
|
---|
1160 | char s[128];
|
---|
1161 |
|
---|
1162 | strcpy(s, tool->help);
|
---|
1163 | if (tool->flags & T_DROPABLE)
|
---|
1164 | strcat(s, GetPString(IDS_DROPONMETEXT));
|
---|
1165 | MakeBubble(hwnd, FALSE, s);
|
---|
1166 | }
|
---|
1167 | }
|
---|
1168 | }
|
---|
1169 | break;
|
---|
1170 |
|
---|
1171 | case WM_COMMAND:
|
---|
1172 | switch (SHORT1FROMMP(mp1)) {
|
---|
1173 | case IDM_HELP:
|
---|
1174 | if (hwndHelp)
|
---|
1175 | WinSendMsg(hwndHelp,
|
---|
1176 | HM_DISPLAY_HELP,
|
---|
1177 | MPFROM2SHORT(HELP_TOOLBAR, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
1178 | break;
|
---|
1179 |
|
---|
1180 | case IDM_HIDEANYTOOL: /* hide any tool */
|
---|
1181 | case IDM_HIDETOOL: /* hide tool */
|
---|
1182 | if (SHORT1FROMMP(mp1) == IDM_HIDETOOL)
|
---|
1183 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1184 | else
|
---|
1185 | id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd,
|
---|
1186 | PickToolProc, FM3ModHandle,
|
---|
1187 | PICKBTN_FRAME, GetPString(IDS_HIDETEXT));
|
---|
1188 | if (id) {
|
---|
1189 | tool = find_tool(id);
|
---|
1190 | if (tool) {
|
---|
1191 | tool->flags |= T_INVISIBLE;
|
---|
1192 | fToolsChanged = TRUE;
|
---|
1193 | }
|
---|
1194 | }
|
---|
1195 | break;
|
---|
1196 |
|
---|
1197 | case IDM_SHOWTOOLS: /* show all tools */
|
---|
1198 | tool = toolhead;
|
---|
1199 | while (tool) {
|
---|
1200 | tool->flags &= (~T_INVISIBLE);
|
---|
1201 | tool = tool->next;
|
---|
1202 | fToolsChanged = TRUE;
|
---|
1203 | }
|
---|
1204 | break;
|
---|
1205 |
|
---|
1206 | case IDM_DELETEANYTOOL: /* delete any button */
|
---|
1207 | case IDM_DELETETOOL: /* delete button */
|
---|
1208 | if (SHORT1FROMMP(mp1) == IDM_DELETETOOL)
|
---|
1209 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1210 | else
|
---|
1211 | id =
|
---|
1212 | (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
|
---|
1213 | PICKBTN_FRAME, GetPString(IDS_DELETETEXT));
|
---|
1214 | if (id)
|
---|
1215 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP,
|
---|
1216 | MPFROM2SHORT(id, 0), MPVOID);
|
---|
1217 | return 0;
|
---|
1218 |
|
---|
1219 | case IDM_EDITANYTOOL: /* edit any button */
|
---|
1220 | case IDM_EDITTOOL: /* edit button */
|
---|
1221 | if (SHORT1FROMMP(mp1) == IDM_EDITTOOL)
|
---|
1222 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1223 | else
|
---|
1224 | id =
|
---|
1225 | (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
|
---|
1226 | PICKBTN_FRAME, GetPString(IDS_EDITTEXT));
|
---|
1227 | if (id) {
|
---|
1228 | tool = find_tool(id);
|
---|
1229 | if (tool) {
|
---|
1230 | if (WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,
|
---|
1231 | ADDBTN_FRAME, (PVOID) tool))
|
---|
1232 | WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
1233 | QW_PARENT),
|
---|
1234 | QW_PARENT), FID_CLIENT),
|
---|
1235 | WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),
|
---|
1236 | MPFROM2SHORT(id, 0));
|
---|
1237 | }
|
---|
1238 | }
|
---|
1239 | break;
|
---|
1240 |
|
---|
1241 | case IDM_ADDTOOL: /* add tool */
|
---|
1242 | id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,
|
---|
1243 | ADDBTN_FRAME, MPVOID);
|
---|
1244 | if (id && id != (USHORT) - 1)
|
---|
1245 | WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
1246 | QW_PARENT),
|
---|
1247 | QW_PARENT), FID_CLIENT),
|
---|
1248 | WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),
|
---|
1249 | MPFROM2SHORT(id, 0));
|
---|
1250 | break;
|
---|
1251 |
|
---|
1252 | case IDM_REORDERTOOLS: /* reorder tools */
|
---|
1253 | WinDlgBox(HWND_DESKTOP,
|
---|
1254 | hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID);
|
---|
1255 | break;
|
---|
1256 |
|
---|
1257 | case IDM_SAVETOOLS:
|
---|
1258 | case IDM_LOADTOOLS:
|
---|
1259 | if (WinDlgBox(HWND_DESKTOP,
|
---|
1260 | hwnd,
|
---|
1261 | ToolIODlgProc,
|
---|
1262 | FM3ModHandle,
|
---|
1263 | SVBTN_FRAME,
|
---|
1264 | (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ?
|
---|
1265 | "TRUE" : NULL))
|
---|
1266 | BuildTools(hwndToolback, TRUE);
|
---|
1267 | break;
|
---|
1268 | }
|
---|
1269 | ResizeTools(WinQueryWindow(hwnd, QW_PARENT));
|
---|
1270 | return 0;
|
---|
1271 |
|
---|
1272 | case WM_MENUEND:
|
---|
1273 | if (hwndMenu == (HWND) mp2) {
|
---|
1274 | WinDestroyWindow(hwndMenu);
|
---|
1275 | hwndMenu = (HWND) 0;
|
---|
1276 | }
|
---|
1277 | break;
|
---|
1278 |
|
---|
1279 | case WM_CONTEXTMENU:
|
---|
1280 | DosEnterCritSec();
|
---|
1281 | if (!hwndMenu)
|
---|
1282 | hwndMenu = WinLoadMenu(hwnd, FM3ModHandle, ID_BUTTONMENU);
|
---|
1283 | DosExitCritSec();
|
---|
1284 | SetPresParams(hwndMenu, NULL, NULL, NULL, GetPString(IDS_10SYSPROTEXT));
|
---|
1285 | if (PopupMenu(hwnd, hwnd, hwndMenu))
|
---|
1286 | WinShowWindow(hwndMenu, TRUE);
|
---|
1287 | return MRFROMSHORT(TRUE);
|
---|
1288 |
|
---|
1289 | case DM_DRAGOVER:
|
---|
1290 | {
|
---|
1291 | PDRAGINFO pDInfo; /* Pointer to DRAGINFO */
|
---|
1292 |
|
---|
1293 | pDInfo = (PDRAGINFO) mp1; /* Get DRAGINFO pointer */
|
---|
1294 | DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
|
---|
1295 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1296 | tool = find_tool(id);
|
---|
1297 | if (!tool) {
|
---|
1298 | DrgFreeDraginfo(pDInfo);
|
---|
1299 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
---|
1300 | }
|
---|
1301 | if (!(tool->flags & T_DROPABLE)) {
|
---|
1302 | DrgFreeDraginfo(pDInfo);
|
---|
1303 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
---|
1304 | }
|
---|
1305 | {
|
---|
1306 | PDRAGITEM pDItem; /* Pointer to DRAGITEM */
|
---|
1307 |
|
---|
1308 | pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
|
---|
1309 | 0); /* Index to DRAGITEM */
|
---|
1310 | if (DrgVerifyRMF(pDItem, /* Check valid rendering */
|
---|
1311 | DRM_OS2FILE, /* mechanisms and data */
|
---|
1312 | NULL)) { /* formats */
|
---|
1313 | if (!(tool->flags & T_EMPHASIZED)) {
|
---|
1314 | tool->flags |= T_EMPHASIZED;
|
---|
1315 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
---|
1316 | DrgFreeDraginfo(pDInfo);
|
---|
1317 | }
|
---|
1318 | return (MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
|
---|
1319 | DO_MOVE)); /* Move operation valid */
|
---|
1320 | }
|
---|
1321 | DrgFreeDraginfo(pDInfo);
|
---|
1322 | }
|
---|
1323 | }
|
---|
1324 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
---|
1325 |
|
---|
1326 | case DM_DROPHELP:
|
---|
1327 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1328 | tool = find_tool(id);
|
---|
1329 | PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
1330 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_TOOLDROPHELP));
|
---|
1331 | return 0;
|
---|
1332 |
|
---|
1333 | case DM_DRAGLEAVE:
|
---|
1334 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1335 | tool = find_tool(id);
|
---|
1336 | if (tool && (tool->flags & T_DROPABLE)) {
|
---|
1337 | if (tool->flags & T_EMPHASIZED) {
|
---|
1338 | tool->flags &= (~T_EMPHASIZED);
|
---|
1339 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
---|
1340 | }
|
---|
1341 | }
|
---|
1342 | break;
|
---|
1343 |
|
---|
1344 | case DM_DROP:
|
---|
1345 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1346 | tool = find_tool(id);
|
---|
1347 | if (tool && (tool->flags & T_DROPABLE) != 0) {
|
---|
1348 | LISTINFO *li;
|
---|
1349 | CNRDRAGINFO cdi;
|
---|
1350 |
|
---|
1351 | if (tool->flags & T_EMPHASIZED) {
|
---|
1352 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
---|
1353 | tool->flags &= (~T_EMPHASIZED);
|
---|
1354 | }
|
---|
1355 | memset(&cdi, 0, sizeof(cdi));
|
---|
1356 | cdi.pDragInfo = mp1;
|
---|
1357 | li = DoFileDrop(hwnd, NULL, FALSE, mp1, MPFROMP(&cdi));
|
---|
1358 | CheckPmDrgLimit(cdi.pDragInfo);
|
---|
1359 | if (li) {
|
---|
1360 | li->type = id;
|
---|
1361 | if (!li->list || !li->list[0])
|
---|
1362 | FreeListInfo(li);
|
---|
1363 | else {
|
---|
1364 | HWND hwndActive;
|
---|
1365 |
|
---|
1366 | hwndActive = TopWindow(hwndMain, (HWND) 0);
|
---|
1367 | if (hwndActive) {
|
---|
1368 | if (!WinSendMsg(hwndActive, UM_COMMAND, MPFROMP(li), MPVOID))
|
---|
1369 | FreeListInfo(li);
|
---|
1370 | }
|
---|
1371 | else
|
---|
1372 | FreeListInfo(li);
|
---|
1373 | }
|
---|
1374 | }
|
---|
1375 | }
|
---|
1376 | return 0;
|
---|
1377 |
|
---|
1378 | case WM_CLOSE:
|
---|
1379 | WinDestroyWindow(hwnd);
|
---|
1380 | return 0;
|
---|
1381 | }
|
---|
1382 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
1383 | }
|
---|
1384 |
|
---|
1385 | VOID BuildTools(HWND hwndT, BOOL resize)
|
---|
1386 | {
|
---|
1387 | TOOL *tool;
|
---|
1388 | ULONG ctrlxpos = 18L;
|
---|
1389 | CHAR s[33];
|
---|
1390 | HENUM henum;
|
---|
1391 | HWND hwndTool;
|
---|
1392 |
|
---|
1393 | henum = WinBeginEnumWindows(hwndT);
|
---|
1394 | while ((hwndTool = WinGetNextWindow(henum)) != NULLHANDLE)
|
---|
1395 | WinDestroyWindow(hwndTool);
|
---|
1396 | WinEndEnumWindows(henum);
|
---|
1397 | if (!fToolbar) {
|
---|
1398 | load_quicktools();
|
---|
1399 | load_tools(NULL);
|
---|
1400 | return;
|
---|
1401 | }
|
---|
1402 | if (!toolhead)
|
---|
1403 | load_tools(NULL);
|
---|
1404 | tool = toolhead;
|
---|
1405 | while (tool) {
|
---|
1406 | sprintf(s, "#%u", tool->id);
|
---|
1407 | hwndTool = (HWND) 0;
|
---|
1408 | if (!fTextTools) {
|
---|
1409 | if (!(tool->flags & T_MYICON)) {
|
---|
1410 | hwndTool = WinCreateWindow(hwndT,
|
---|
1411 | WC_TOOLBUTTONS,
|
---|
1412 | s,
|
---|
1413 | BS_NOPOINTERFOCUS |
|
---|
1414 | BS_BITMAP | BS_PUSHBUTTON,
|
---|
1415 | ctrlxpos,
|
---|
1416 | 14,
|
---|
1417 | 32,
|
---|
1418 | 32, hwndT, HWND_TOP, tool->id, NULL, NULL);
|
---|
1419 | }
|
---|
1420 | if (!hwndTool) {
|
---|
1421 | HBITMAP hbm = LoadBitmapFromFileNum(tool->id);
|
---|
1422 |
|
---|
1423 | if (hbm) {
|
---|
1424 | BTNCDATA btc;
|
---|
1425 |
|
---|
1426 | memset(&btc, 0, sizeof(btc));
|
---|
1427 | btc.cb = sizeof(btc);
|
---|
1428 | btc.hImage = hbm;
|
---|
1429 | hwndTool = WinCreateWindow(hwndT,
|
---|
1430 | WC_TOOLBUTTONS,
|
---|
1431 | NullStr,
|
---|
1432 | BS_NOPOINTERFOCUS |
|
---|
1433 | BS_BITMAP | BS_PUSHBUTTON,
|
---|
1434 | ctrlxpos,
|
---|
1435 | 14,
|
---|
1436 | 32,
|
---|
1437 | 32,
|
---|
1438 | hwndT, HWND_TOP, tool->id, &btc, NULL);
|
---|
1439 | if (!hwndTool)
|
---|
1440 | GpiDeleteBitmap(hbm);
|
---|
1441 | }
|
---|
1442 | }
|
---|
1443 | if (hwndTool)
|
---|
1444 | tool->flags &= (~T_TEXT);
|
---|
1445 | }
|
---|
1446 | if (!hwndTool) {
|
---|
1447 | hwndTool = WinCreateWindow(hwndT,
|
---|
1448 | WC_TOOLBUTTONS,
|
---|
1449 | (!tool->text && tool->id >= IDM_COMMANDSTART
|
---|
1450 | && tool->id <
|
---|
1451 | IDM_QUICKTOOLSTART) ? command_title(tool->
|
---|
1452 | id -
|
---|
1453 | IDM_COMMANDSTART)
|
---|
1454 | : tool->text,
|
---|
1455 | BS_NOPOINTERFOCUS | BS_PUSHBUTTON, ctrlxpos,
|
---|
1456 | 2, 54, 24, hwndT, HWND_TOP, tool->id, NULL,
|
---|
1457 | NULL);
|
---|
1458 | if (!hwndTool)
|
---|
1459 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
1460 | IDS_WINCREATEWINDOW);
|
---|
1461 | tool->flags |= T_TEXT;
|
---|
1462 | }
|
---|
1463 | if (fToolTitles && !fTextTools) {
|
---|
1464 | hwndTool = WinCreateWindow(hwndT,
|
---|
1465 | WC_STATIC,
|
---|
1466 | tool->text,
|
---|
1467 | SS_TEXT | DT_LEFT | DT_VCENTER,
|
---|
1468 | ctrlxpos,
|
---|
1469 | 1,
|
---|
1470 | 32,
|
---|
1471 | 10,
|
---|
1472 | hwndT,
|
---|
1473 | HWND_TOP, tool->id + 25000, NULL, NULL);
|
---|
1474 | if (!hwndTool)
|
---|
1475 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
1476 | IDS_WINCREATEWINDOW);
|
---|
1477 | else {
|
---|
1478 | SetPresParams(hwndTool,
|
---|
1479 | &RGBGREY,
|
---|
1480 | &RGBBLACK, &RGBGREY, GetPString(IDS_2SYSTEMVIOTEXT));
|
---|
1481 | }
|
---|
1482 | }
|
---|
1483 | ctrlxpos += ((tool->flags & T_TEXT) ? 55L : 33L);
|
---|
1484 | SetPresParams(WinWindowFromID(hwndT, tool->id),
|
---|
1485 | NULL, NULL, NULL, GetPString(IDS_8HELVTEXT));
|
---|
1486 | tool = tool->next;
|
---|
1487 | } // while tool
|
---|
1488 |
|
---|
1489 | hwndTool = WinCreateWindow(hwndT,
|
---|
1490 | WC_BUTTON,
|
---|
1491 | "#6010",
|
---|
1492 | BS_NOPOINTERFOCUS |
|
---|
1493 | BS_BITMAP | BS_PUSHBUTTON,
|
---|
1494 | 1,
|
---|
1495 | 19,
|
---|
1496 | 14,
|
---|
1497 | 13, hwndT, HWND_TOP, IDM_TOOLLEFT, NULL, NULL);
|
---|
1498 | if (!hwndTool)
|
---|
1499 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
1500 | IDS_WINCREATEWINDOW);
|
---|
1501 | hwndTool =
|
---|
1502 | WinCreateWindow(hwndT, WC_BUTTON, "#6011",
|
---|
1503 | BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 1, 4, 14,
|
---|
1504 | 13, hwndT, HWND_TOP, IDM_TOOLRIGHT, NULL, NULL);
|
---|
1505 | if (!hwndTool)
|
---|
1506 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
1507 | IDS_WINCREATEWINDOW);
|
---|
1508 | if (resize)
|
---|
1509 | ResizeTools(hwndT);
|
---|
1510 | }
|
---|
1511 |
|
---|
1512 | static MRESULT EXPENTRY CommandLineProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
1513 | MPARAM mp2)
|
---|
1514 | {
|
---|
1515 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
1516 | static BOOL lbup = FALSE;
|
---|
1517 |
|
---|
1518 | switch (msg) {
|
---|
1519 | case UM_FOCUSME:
|
---|
1520 | WinSetFocus(HWND_DESKTOP, hwnd);
|
---|
1521 | return 0;
|
---|
1522 |
|
---|
1523 | case WM_SETFOCUS:
|
---|
1524 | if (!mp2 && !lbup) {
|
---|
1525 |
|
---|
1526 | PID pid;
|
---|
1527 | TID tid;
|
---|
1528 |
|
---|
1529 | if (WinQueryWindowUShort((HWND) mp1, QWS_ID) == COMMAND_BUTTON)
|
---|
1530 | break;
|
---|
1531 | if (!WinQueryWindowProcess((HWND) mp1, &pid, &tid) || pid == mypid)
|
---|
1532 | WinDestroyWindow(hwnd);
|
---|
1533 | }
|
---|
1534 | break;
|
---|
1535 |
|
---|
1536 | case UM_RESCAN:
|
---|
1537 | {
|
---|
1538 | CHAR cl[1024];
|
---|
1539 |
|
---|
1540 | *cl = 0;
|
---|
1541 | lbup = TRUE;
|
---|
1542 | if (WinDlgBox(HWND_DESKTOP,
|
---|
1543 | hwnd,
|
---|
1544 | CmdLine2DlgProc,
|
---|
1545 | FM3ModHandle, EXEC2_FRAME, MPFROMP(cl))) {
|
---|
1546 | lstrip(cl);
|
---|
1547 | WinSetWindowText(hwnd, cl);
|
---|
1548 | }
|
---|
1549 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
1550 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
1551 | }
|
---|
1552 | return 0;
|
---|
1553 |
|
---|
1554 | case UM_SETUP:
|
---|
1555 | lbup = FALSE;
|
---|
1556 | return 0;
|
---|
1557 |
|
---|
1558 | case WM_BUTTON1DBLCLK:
|
---|
1559 | PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID);
|
---|
1560 | return 0;
|
---|
1561 |
|
---|
1562 | case WM_COMMAND:
|
---|
1563 | switch (SHORT1FROMMP(mp1)) {
|
---|
1564 | case COMMAND_BUTTON:
|
---|
1565 | if (!lbup)
|
---|
1566 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
1567 | break;
|
---|
1568 | }
|
---|
1569 | return 0;
|
---|
1570 |
|
---|
1571 | case UM_OPENWINDOWFORME:
|
---|
1572 | {
|
---|
1573 | static char directory[CCHMAXPATH], cl[1000];
|
---|
1574 | char **list = NULL;
|
---|
1575 | ULONG len;
|
---|
1576 | HWND hwndCnr;
|
---|
1577 |
|
---|
1578 | *directory = *cl = 0;
|
---|
1579 | strcpy(cl, GetCmdSpec(FALSE));
|
---|
1580 | strcat(cl, " /C ");
|
---|
1581 | len = strlen(cl);
|
---|
1582 | WinQueryWindowText(hwnd, 1000 - len, cl + len);
|
---|
1583 | bstrip(cl + len);
|
---|
1584 | if (strlen(cl) > len) {
|
---|
1585 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
1586 | UM_SETUP, MPFROMP(cl + len), MPVOID);
|
---|
1587 | WinQueryWindowText(hwndStatus, CCHMAXPATH, directory);
|
---|
1588 | bstrip(directory);
|
---|
1589 | if (*directory && (IsRoot(directory) || !IsFile(directory))) {
|
---|
1590 | if (!FM2Command(directory, cl + len)) {
|
---|
1591 | hwndCnr = TopWindow(hwndMain, (HWND) 0);
|
---|
1592 | if (hwndCnr) {
|
---|
1593 | hwndCnr = WinWindowFromID(hwndCnr, FID_CLIENT);
|
---|
1594 | if (hwndCnr) {
|
---|
1595 | hwndCnr = WinWindowFromID(hwndCnr, DIR_CNR);
|
---|
1596 | if (hwndCnr)
|
---|
1597 | list = BuildList(hwndCnr);
|
---|
1598 | }
|
---|
1599 | }
|
---|
1600 | WinSetActiveWindow(HWND_DESKTOP, hwndCnr);
|
---|
1601 | if (add_cmdline(cl + len, FALSE) && fSaveMiniCmds)
|
---|
1602 | save_cmdlines(FALSE);
|
---|
1603 | ExecOnList(hwndCnr,
|
---|
1604 | cl,
|
---|
1605 | WINDOWED | ((fKeepCmdLine) ?
|
---|
1606 | SEPARATEKEEP : SEPARATE),
|
---|
1607 | directory, list, NULL, pszSrcFile, __LINE__);
|
---|
1608 | if (list)
|
---|
1609 | free(list);
|
---|
1610 | WinDestroyWindow(hwnd);
|
---|
1611 | break;
|
---|
1612 | }
|
---|
1613 | }
|
---|
1614 | }
|
---|
1615 | WinSendMsg(hwnd, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);
|
---|
1616 | }
|
---|
1617 | return 0;
|
---|
1618 |
|
---|
1619 | case WM_CHAR:
|
---|
1620 | if (!lbup && !(SHORT1FROMMP(mp1) & KC_KEYUP)) {
|
---|
1621 | if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
|
---|
1622 | if ((SHORT1FROMMP(mp2) & 255) == '\r')
|
---|
1623 | PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID);
|
---|
1624 | else if ((SHORT1FROMMP(mp2) & 0xff) == 0x1b)
|
---|
1625 | WinDestroyWindow(hwnd);
|
---|
1626 | else if (SHORT2FROMMP(mp2) == VK_UP || SHORT2FROMMP(mp2) == VK_DOWN)
|
---|
1627 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
1628 | }
|
---|
1629 | }
|
---|
1630 | else if ((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) &&
|
---|
1631 | ((SHORT2FROMMP(mp2) == VK_UP ||
|
---|
1632 | SHORT2FROMMP(mp2) == VK_DOWN) ||
|
---|
1633 | (SHORT1FROMMP(mp2) == '\x1b') || (SHORT1FROMMP(mp2) == '\r')))
|
---|
1634 | return 0;
|
---|
1635 | break;
|
---|
1636 |
|
---|
1637 | case WM_DESTROY:
|
---|
1638 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_RESCAN, MPVOID, MPVOID);
|
---|
1639 | lbup = FALSE;
|
---|
1640 | break;
|
---|
1641 | }
|
---|
1642 | return oldproc(hwnd, msg, mp1, mp2);
|
---|
1643 | }
|
---|
1644 |
|
---|
1645 | MRESULT EXPENTRY DriveBackProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1646 | {
|
---|
1647 | switch (msg) {
|
---|
1648 | case WM_CREATE:
|
---|
1649 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
1650 | break;
|
---|
1651 |
|
---|
1652 | case UM_SETUP:
|
---|
1653 | {
|
---|
1654 | RGB2 rgb;
|
---|
1655 |
|
---|
1656 | memset(&rgb, 0, sizeof(rgb));
|
---|
1657 | rgb.bRed = (BYTE)128;
|
---|
1658 | SetPresParams(hwnd,
|
---|
1659 | &RGBGREY, &rgb, &RGBGREY, GetPString(IDS_8HELVTEXT));
|
---|
1660 | SetTargetDir(hwnd, TRUE);
|
---|
1661 | }
|
---|
1662 | return 0;
|
---|
1663 |
|
---|
1664 | case WM_SETFOCUS:
|
---|
1665 | case UM_FOCUSME:
|
---|
1666 | case WM_BUTTON1DOWN:
|
---|
1667 | case WM_BUTTON1UP:
|
---|
1668 | case WM_BUTTON2DOWN:
|
---|
1669 | case WM_BUTTON2UP:
|
---|
1670 | case WM_BUTTON3DOWN:
|
---|
1671 | case WM_BUTTON3UP:
|
---|
1672 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
1673 |
|
---|
1674 | case WM_MOUSEMOVE:
|
---|
1675 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
1676 | break;
|
---|
1677 |
|
---|
1678 | case UM_CLICKED:
|
---|
1679 | case UM_CLICKED3:
|
---|
1680 | PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_SETTARGET, 0), MPVOID);
|
---|
1681 | return 0;
|
---|
1682 |
|
---|
1683 | case WM_CHAR:
|
---|
1684 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
1685 | break;
|
---|
1686 |
|
---|
1687 | case WM_CONTROLPOINTER:
|
---|
1688 | if (!fNoFinger &&
|
---|
1689 | (SHORT1FROMMP(mp1) >= IDM_DRIVEA &&
|
---|
1690 | SHORT1FROMMP(mp1) < IDM_DRIVEA + 26))
|
---|
1691 | return MRFROMLONG(hptrFinger);
|
---|
1692 | break;
|
---|
1693 |
|
---|
1694 | case WM_COMMAND:
|
---|
1695 | {
|
---|
1696 | CHAR dv[4];
|
---|
1697 |
|
---|
1698 | *dv = 0;
|
---|
1699 | WinQueryWindowText(WinWindowFromID(hwnd, SHORT1FROMMP(mp1) + 50),
|
---|
1700 | 2, dv);
|
---|
1701 | if (isalpha(*dv)) {
|
---|
1702 |
|
---|
1703 | HWND hwndActive;
|
---|
1704 |
|
---|
1705 | dv[1] = ':';
|
---|
1706 | dv[2] = '\\';
|
---|
1707 | dv[3] = 0;
|
---|
1708 | hwndActive = TopWindow(hwnd, (HWND) 0);
|
---|
1709 | if (hwndActive)
|
---|
1710 | WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT),
|
---|
1711 | UM_DRIVECMD, MPFROMP(dv), MPVOID);
|
---|
1712 | }
|
---|
1713 | }
|
---|
1714 | return 0;
|
---|
1715 |
|
---|
1716 | case WM_PAINT:
|
---|
1717 | PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
|
---|
1718 | break;
|
---|
1719 |
|
---|
1720 | case WM_CLOSE:
|
---|
1721 | WinDestroyWindow(hwnd);
|
---|
1722 | return 0;
|
---|
1723 | }
|
---|
1724 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
1725 | }
|
---|
1726 |
|
---|
1727 | MRESULT EXPENTRY DriveProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1728 | {
|
---|
1729 | USHORT id;
|
---|
1730 | CHAR szDrv[CCHMAXPATH];
|
---|
1731 |
|
---|
1732 | static BOOL emphasized = FALSE;
|
---|
1733 | static HWND hwndMenu = NULLHANDLE;
|
---|
1734 | static USHORT helpid = 0;
|
---|
1735 |
|
---|
1736 | switch (msg) {
|
---|
1737 | case WM_MOUSEMOVE:
|
---|
1738 | if (fDrivebarHelp &&
|
---|
1739 | (!hwndBubble ||
|
---|
1740 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
---|
1741 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
1742 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1743 | if (helpid != id) {
|
---|
1744 | helpid = id;
|
---|
1745 | PostMsg(MainObjectHwnd, UM_SETUP6, MPFROMLONG((ULONG) hwnd), MPVOID);
|
---|
1746 | }
|
---|
1747 | else
|
---|
1748 | helpid = 0;
|
---|
1749 | }
|
---|
1750 | break;
|
---|
1751 |
|
---|
1752 | case UM_SETUP6:
|
---|
1753 | if (helpid == WinQueryWindowUShort(hwnd, QWS_ID)) {
|
---|
1754 | if ((char *)mp1 &&
|
---|
1755 | (!hwndBubble ||
|
---|
1756 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
---|
1757 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
1758 |
|
---|
1759 | RECTL rcl;
|
---|
1760 | POINTL ptl;
|
---|
1761 |
|
---|
1762 | WinQueryPointerPos(HWND_DESKTOP, &ptl);
|
---|
1763 | WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);
|
---|
1764 | WinQueryWindowRect(hwnd, &rcl);
|
---|
1765 | if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl))
|
---|
1766 | BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1);
|
---|
1767 | }
|
---|
1768 | }
|
---|
1769 | return 0;
|
---|
1770 |
|
---|
1771 | case WM_MENUEND:
|
---|
1772 | if (hwndMenu == (HWND) mp2) {
|
---|
1773 | WinDestroyWindow(hwndMenu);
|
---|
1774 | hwndMenu = (HWND) 0;
|
---|
1775 | }
|
---|
1776 | break;
|
---|
1777 |
|
---|
1778 | case WM_CONTEXTMENU:
|
---|
1779 | if (hwndMenu)
|
---|
1780 | WinDestroyWindow(hwndMenu);
|
---|
1781 | hwndMenu = (HWND) 0;
|
---|
1782 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1783 | *szDrv = 0;
|
---|
1784 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
1785 | id + 50), sizeof(szDrv), szDrv);
|
---|
1786 | if (isalpha(*szDrv)) {
|
---|
1787 | hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, MAIN_DRIVES);
|
---|
1788 | if (hwndMenu) {
|
---|
1789 | BOOL rdy;
|
---|
1790 | CHAR chDrv = *szDrv;
|
---|
1791 | UINT iDrv;
|
---|
1792 |
|
---|
1793 | strcpy(szDrv + 2, "\\");
|
---|
1794 | MakeValidDir(szDrv);
|
---|
1795 | // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c
|
---|
1796 | rdy = toupper(*szDrv) == toupper(chDrv);
|
---|
1797 | iDrv = toupper(*szDrv) - 'A';
|
---|
1798 | if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE)
|
---|
1799 | WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE);
|
---|
1800 |
|
---|
1801 | if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) {
|
---|
1802 | WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE);
|
---|
1803 | WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE);
|
---|
1804 | WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE);
|
---|
1805 | WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE);
|
---|
1806 | }
|
---|
1807 | if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) {
|
---|
1808 | WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE);
|
---|
1809 | WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE);
|
---|
1810 | WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE);
|
---|
1811 | }
|
---|
1812 | if (!rdy) {
|
---|
1813 | WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE);
|
---|
1814 | WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE);
|
---|
1815 | WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE);
|
---|
1816 | WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE);
|
---|
1817 | WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE);
|
---|
1818 | }
|
---|
1819 | /* fixme to be gone?
|
---|
1820 | if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) {
|
---|
1821 | WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE);
|
---|
1822 | }
|
---|
1823 | */
|
---|
1824 | PopupMenu(hwnd, hwnd, hwndMenu);
|
---|
1825 | }
|
---|
1826 | }
|
---|
1827 | return MRFROMSHORT(TRUE);
|
---|
1828 |
|
---|
1829 | case WM_BUTTON2CLICK:
|
---|
1830 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
1831 | if (!(shiftstate & KC_CTRL))
|
---|
1832 | break;
|
---|
1833 |
|
---|
1834 | case WM_CHORD:
|
---|
1835 | case WM_BUTTON3CLICK:
|
---|
1836 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1837 | *szDrv = 0;
|
---|
1838 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
1839 | id + 50), sizeof(szDrv), szDrv);
|
---|
1840 | if (isalpha(*szDrv)) {
|
---|
1841 | strcat(szDrv, "\\");
|
---|
1842 | if (!FindDirCnrByName(szDrv, TRUE))
|
---|
1843 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv);
|
---|
1844 | }
|
---|
1845 | break;
|
---|
1846 |
|
---|
1847 | case WM_COMMAND:
|
---|
1848 | PostMsg(hwnd, UM_COMMAND, mp1, mp2);
|
---|
1849 | return 0;
|
---|
1850 |
|
---|
1851 | case UM_COMMAND:
|
---|
1852 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1853 | *szDrv = 0;
|
---|
1854 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
1855 | id + 50), sizeof(szDrv), szDrv);
|
---|
1856 | if (isalpha(*szDrv)) {
|
---|
1857 | strcat(szDrv, "\\");
|
---|
1858 | CommonDriveCmd(hwnd, szDrv, SHORT1FROMMP(mp1));
|
---|
1859 | }
|
---|
1860 | return 0;
|
---|
1861 |
|
---|
1862 | case DM_DRAGOVER:
|
---|
1863 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1864 | *szDrv = 0;
|
---|
1865 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
1866 | id + 50), sizeof(szDrv), szDrv);
|
---|
1867 | if (isalpha(*szDrv) &&
|
---|
1868 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
1869 | if (!emphasized) {
|
---|
1870 | emphasized = TRUE;
|
---|
1871 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
1872 | }
|
---|
1873 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
---|
1874 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
---|
1875 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
---|
1876 | }
|
---|
1877 | break;
|
---|
1878 |
|
---|
1879 | case DM_DRAGLEAVE:
|
---|
1880 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1881 | *szDrv = 0;
|
---|
1882 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
1883 | id + 50), sizeof(szDrv), szDrv);
|
---|
1884 | if (isalpha(*szDrv) &&
|
---|
1885 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
1886 | if (emphasized) {
|
---|
1887 | emphasized = FALSE;
|
---|
1888 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
1889 | }
|
---|
1890 | }
|
---|
1891 | break;
|
---|
1892 |
|
---|
1893 | case DM_DROPHELP:
|
---|
1894 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1895 | *szDrv = 0;
|
---|
1896 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
1897 | id + 50), sizeof(szDrv), szDrv);
|
---|
1898 | if (isalpha(*szDrv) &&
|
---|
1899 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
1900 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_DRIVEDROPHELP));
|
---|
1901 | return 0;
|
---|
1902 | }
|
---|
1903 | break;
|
---|
1904 |
|
---|
1905 | case DM_DROP:
|
---|
1906 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
1907 | *szDrv = 0;
|
---|
1908 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
1909 | id + 50), sizeof(szDrv), szDrv);
|
---|
1910 | if (isalpha(*szDrv) &&
|
---|
1911 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
1912 |
|
---|
1913 | CNRDRAGINFO cnd;
|
---|
1914 | LISTINFO *li;
|
---|
1915 | ULONG action = UM_ACTION;
|
---|
1916 |
|
---|
1917 | if (emphasized) {
|
---|
1918 | emphasized = FALSE;
|
---|
1919 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
1920 | }
|
---|
1921 | memset(&cnd, 0, sizeof(cnd));
|
---|
1922 | cnd.pDragInfo = (PDRAGINFO) mp1;
|
---|
1923 | cnd.pRecord = NULL;
|
---|
1924 | li = DoFileDrop(hwnd,
|
---|
1925 | NULL,
|
---|
1926 | TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd));
|
---|
1927 | CheckPmDrgLimit(cnd.pDragInfo);
|
---|
1928 | if (li) {
|
---|
1929 | strcpy(li->targetpath, szDrv);
|
---|
1930 | strcat(li->targetpath, "\\");
|
---|
1931 | if (li->list && li->list[0] && IsRoot(li->list[0]))
|
---|
1932 | li->type = DO_LINK;
|
---|
1933 | else if (fDragndropDlg && (!*li->arcname || !li->info)) {
|
---|
1934 |
|
---|
1935 | CHECKLIST cl;
|
---|
1936 |
|
---|
1937 | memset(&cl, 0, sizeof(cl));
|
---|
1938 | cl.size = sizeof(cl);
|
---|
1939 | cl.flags = li->type;
|
---|
1940 | cl.list = li->list;
|
---|
1941 | cl.cmd = li->type;
|
---|
1942 | cl.prompt = li->targetpath;
|
---|
1943 | li->type = WinDlgBox(HWND_DESKTOP,
|
---|
1944 | hwndMain,
|
---|
1945 | DropListProc,
|
---|
1946 | FM3ModHandle, DND_FRAME, MPFROMP(&cl));
|
---|
1947 | if (li->type == DID_ERROR)
|
---|
1948 | Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
1949 | "Drag & Drop Dialog");
|
---|
1950 | if (!li->type) {
|
---|
1951 | FreeListInfo(li);
|
---|
1952 | return 0;
|
---|
1953 | }
|
---|
1954 | li->list = cl.list;
|
---|
1955 | if (!li->list || !li->list[0]) {
|
---|
1956 | FreeListInfo(li);
|
---|
1957 | return 0;
|
---|
1958 | }
|
---|
1959 | }
|
---|
1960 | else {
|
---|
1961 | if (!WinDlgBox(HWND_DESKTOP,
|
---|
1962 | hwndMain,
|
---|
1963 | WalkDlgProc,
|
---|
1964 | FM3ModHandle,
|
---|
1965 | WALK_FRAME,
|
---|
1966 | MPFROMP(li->targetpath)) || !*li->targetpath) {
|
---|
1967 | FreeListInfo(li);
|
---|
1968 | return 0;
|
---|
1969 | }
|
---|
1970 | }
|
---|
1971 | switch (li->type) {
|
---|
1972 | case DND_LAUNCH:
|
---|
1973 | strcat(li->targetpath, " %a");
|
---|
1974 | ExecOnList(hwndMain,
|
---|
1975 | li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL,
|
---|
1976 | pszSrcFile, __LINE__);
|
---|
1977 | FreeList(li->list);
|
---|
1978 | li->list = NULL;
|
---|
1979 | break;
|
---|
1980 | case DO_LINK:
|
---|
1981 | if (fLinkSetsIcon) {
|
---|
1982 | li->type = IDM_SETICON;
|
---|
1983 | action = UM_MASSACTION;
|
---|
1984 | }
|
---|
1985 | else
|
---|
1986 | li->type = IDM_COMPARE;
|
---|
1987 | break;
|
---|
1988 | case DND_EXTRACT:
|
---|
1989 | if (*li->targetpath && !IsFile(li->targetpath))
|
---|
1990 | li->type = IDM_EXTRACT;
|
---|
1991 | break;
|
---|
1992 | case DND_MOVE:
|
---|
1993 | li->type = IDM_MOVE;
|
---|
1994 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
1995 | action = UM_MASSACTION;
|
---|
1996 | li->type = IDM_ARCHIVEM;
|
---|
1997 | }
|
---|
1998 | break;
|
---|
1999 | case DND_WILDMOVE:
|
---|
2000 | li->type = IDM_WILDMOVE;
|
---|
2001 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
2002 | action = UM_MASSACTION;
|
---|
2003 | li->type = IDM_ARCHIVEM;
|
---|
2004 | }
|
---|
2005 | break;
|
---|
2006 | case DND_OBJECT:
|
---|
2007 | li->type = IDM_OBJECT;
|
---|
2008 | action = UM_MASSACTION;
|
---|
2009 | break;
|
---|
2010 | case DND_SHADOW:
|
---|
2011 | li->type = IDM_SHADOW;
|
---|
2012 | action = UM_MASSACTION;
|
---|
2013 | break;
|
---|
2014 | case DND_COMPARE:
|
---|
2015 | li->type = IDM_COMPARE;
|
---|
2016 | break;
|
---|
2017 | case DND_SETICON:
|
---|
2018 | action = UM_MASSACTION;
|
---|
2019 | li->type = IDM_SETICON;
|
---|
2020 | break;
|
---|
2021 | case DND_COPY:
|
---|
2022 | li->type = IDM_COPY;
|
---|
2023 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
2024 | action = UM_MASSACTION;
|
---|
2025 | li->type = IDM_ARCHIVE;
|
---|
2026 | }
|
---|
2027 | break;
|
---|
2028 | case DND_WILDCOPY:
|
---|
2029 | li->type = IDM_WILDCOPY;
|
---|
2030 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
2031 | action = UM_MASSACTION;
|
---|
2032 | li->type = IDM_ARCHIVE;
|
---|
2033 | }
|
---|
2034 | break;
|
---|
2035 | default:
|
---|
2036 | if (*li->arcname && li->info) {
|
---|
2037 | action = UM_MASSACTION;
|
---|
2038 | li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM :
|
---|
2039 | IDM_FAKEEXTRACT;
|
---|
2040 | }
|
---|
2041 | else if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
2042 | action = UM_MASSACTION;
|
---|
2043 | li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
|
---|
2044 | }
|
---|
2045 | else
|
---|
2046 | li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
|
---|
2047 | break;
|
---|
2048 | }
|
---|
2049 | if (!li->list || !li->list[0])
|
---|
2050 | FreeListInfo(li);
|
---|
2051 | else
|
---|
2052 | WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action));
|
---|
2053 | }
|
---|
2054 | return 0;
|
---|
2055 | }
|
---|
2056 | break;
|
---|
2057 |
|
---|
2058 | case WM_DESTROY:
|
---|
2059 | if (hwndMenu)
|
---|
2060 | WinDestroyWindow(hwndMenu);
|
---|
2061 | hwndMenu = (HWND) 0;
|
---|
2062 | break;
|
---|
2063 | }
|
---|
2064 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
2065 | }
|
---|
2066 |
|
---|
2067 | VOID BuildDriveBarButtons(HWND hwndT)
|
---|
2068 | {
|
---|
2069 | register ULONG x, y = 0;
|
---|
2070 | ULONG ulDriveNum, ulDriveMap, iconid;
|
---|
2071 | CHAR s[8];
|
---|
2072 | HENUM henum;
|
---|
2073 | HWND hwndB;
|
---|
2074 |
|
---|
2075 | henum = WinBeginEnumWindows(hwndT);
|
---|
2076 |
|
---|
2077 | while ((hwndB = WinGetNextWindow(henum)) != NULLHANDLE)
|
---|
2078 | WinDestroyWindow(hwndB);
|
---|
2079 |
|
---|
2080 | WinEndEnumWindows(henum);
|
---|
2081 | if (fDrivebar) {
|
---|
2082 | DosError(FERR_DISABLEHARDERR);
|
---|
2083 | DosQCurDisk(&ulDriveNum, &ulDriveMap);
|
---|
2084 | for (x = 0; x < 26; x++) {
|
---|
2085 | if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) {
|
---|
2086 | if (x > 1) {
|
---|
2087 | if (driveflags[x] & DRIVE_CDROM)
|
---|
2088 | iconid = CDROM_ICON;
|
---|
2089 | else
|
---|
2090 | iconid = (driveflags[x] & DRIVE_REMOVABLE) ?
|
---|
2091 | REMOVABLE_ICON :
|
---|
2092 | (driveflags[x] & DRIVE_VIRTUAL) ?
|
---|
2093 | VIRTUAL_ICON :
|
---|
2094 | (driveflags[x] & DRIVE_REMOTE) ?
|
---|
2095 | REMOTE_ICON :
|
---|
2096 | (driveflags[x] & DRIVE_RAMDISK) ?
|
---|
2097 | RAMDISK_ICON :
|
---|
2098 | (driveflags[x] & DRIVE_ZIPSTREAM) ?
|
---|
2099 | ZIPSTREAM_ICON :DRIVE_ICON;
|
---|
2100 | }
|
---|
2101 | else
|
---|
2102 | iconid = FLOPPY_ICON;
|
---|
2103 | sprintf(s, "#%lu", iconid);
|
---|
2104 | hwndB = WinCreateWindow(hwndT,
|
---|
2105 | WC_DRIVEBUTTONS,
|
---|
2106 | s,
|
---|
2107 | BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON,
|
---|
2108 | 0,
|
---|
2109 | 0,
|
---|
2110 | 28,
|
---|
2111 | 18,
|
---|
2112 | hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL);
|
---|
2113 | if (!hwndB)
|
---|
2114 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
2115 | IDS_WINCREATEWINDOW);
|
---|
2116 | else {
|
---|
2117 | WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
|
---|
2118 | sprintf(s, "%c:", (CHAR) x + 'A');
|
---|
2119 | hwndB = WinCreateWindow(hwndT,
|
---|
2120 | WC_STATIC,
|
---|
2121 | s,
|
---|
2122 | SS_TEXT | DT_LEFT | DT_VCENTER,
|
---|
2123 | 0,
|
---|
2124 | 0,
|
---|
2125 | 10,
|
---|
2126 | 18,
|
---|
2127 | hwndT,
|
---|
2128 | HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL);
|
---|
2129 | if (!hwndB)
|
---|
2130 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
2131 | IDS_WINCREATEWINDOW);
|
---|
2132 | else {
|
---|
2133 | SetPresParams(hwndB,
|
---|
2134 | &RGBGREY,
|
---|
2135 | &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));
|
---|
2136 | WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
|
---|
2137 | }
|
---|
2138 | y++;
|
---|
2139 | }
|
---|
2140 | }
|
---|
2141 | } // for
|
---|
2142 | } // if drivebar
|
---|
2143 | PostMsg(WinQueryWindow(hwndT, QW_PARENT),
|
---|
2144 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
2145 | }
|
---|
2146 |
|
---|
2147 | VOID ResizeDrives(HWND hwndT, long xwidth)
|
---|
2148 | {
|
---|
2149 | register ULONG ctrlxpos = 2, ctrlypos = 0, ctrlxsize;
|
---|
2150 | HENUM henum;
|
---|
2151 | HWND hwndB;
|
---|
2152 | RECTL rcl;
|
---|
2153 |
|
---|
2154 | DriveLines = 0;
|
---|
2155 | if (!fDrivebar)
|
---|
2156 | return;
|
---|
2157 | if (!xwidth) {
|
---|
2158 | WinQueryWindowRect(hwndT, &rcl);
|
---|
2159 | xwidth = rcl.xRight - ((WinQuerySysValue(HWND_DESKTOP,
|
---|
2160 | SV_CYSIZEBORDER) * 2) + 2);
|
---|
2161 | }
|
---|
2162 | henum = WinBeginEnumWindows(hwndT);
|
---|
2163 | while ((hwndB = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
2164 | if (WinQueryWindowUShort(hwndB, QWS_ID) > IDM_DRIVEA + 27)
|
---|
2165 | ctrlxsize = 10;
|
---|
2166 | else
|
---|
2167 | ctrlxsize = 28;
|
---|
2168 | WinSetWindowPos(hwndB,
|
---|
2169 | HWND_TOP,
|
---|
2170 | ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW);
|
---|
2171 | ctrlxpos += (ctrlxsize + 2);
|
---|
2172 | if (ctrlxsize == 10) {
|
---|
2173 | if (ctrlxpos + (42 + ((fShowTarget && DriveLines == 0) ?
|
---|
2174 | 256 : 0)) > xwidth) {
|
---|
2175 | ctrlxpos = 2;
|
---|
2176 | ctrlypos += 18;
|
---|
2177 | DriveLines++;
|
---|
2178 | }
|
---|
2179 | }
|
---|
2180 | }
|
---|
2181 | if (ctrlxpos == 2 && DriveLines)
|
---|
2182 | DriveLines--;
|
---|
2183 | }
|
---|
2184 |
|
---|
2185 | MRESULT EXPENTRY StatusProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
2186 | {
|
---|
2187 | static HWND hwndE = (HWND) 0, hwndB = (HWND) 0;
|
---|
2188 | static CHAR lastcmd[1024] = "";
|
---|
2189 |
|
---|
2190 | switch (msg) {
|
---|
2191 | case WM_CREATE:
|
---|
2192 | {
|
---|
2193 | MRESULT mr = PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
2194 |
|
---|
2195 | SetPresParams(hwnd,
|
---|
2196 | &RGBGREY,
|
---|
2197 | &RGBBLACK, &RGBGREY, GetPString(IDS_8HELVBOLDTEXT));
|
---|
2198 | return mr;
|
---|
2199 | }
|
---|
2200 |
|
---|
2201 | case WM_PRESPARAMCHANGED:
|
---|
2202 | if (fRunning) {
|
---|
2203 |
|
---|
2204 | ULONG AttrFound, AttrValue[64], cbRetLen;
|
---|
2205 |
|
---|
2206 | cbRetLen = WinQueryPresParam(hwnd,
|
---|
2207 | (ULONG) mp1,
|
---|
2208 | 0,
|
---|
2209 | &AttrFound,
|
---|
2210 | (ULONG) sizeof(AttrValue), &AttrValue, 0);
|
---|
2211 | if (cbRetLen) {
|
---|
2212 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
2213 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
2214 | }
|
---|
2215 | }
|
---|
2216 | break;
|
---|
2217 |
|
---|
2218 | case WM_CONTEXTMENU:
|
---|
2219 | PostMsg(hwndMain, UM_CONTEXTMENU, MPVOID, MPVOID);
|
---|
2220 | return MRFROMSHORT(TRUE);
|
---|
2221 |
|
---|
2222 | case WM_BEGINDRAG:
|
---|
2223 | if (hwndTree) {
|
---|
2224 |
|
---|
2225 | SWP swp;
|
---|
2226 | ULONG fl = SWP_ACTIVATE | SWP_SHOW | SWP_ZORDER;
|
---|
2227 |
|
---|
2228 | WinQueryWindowPos(hwndTree, &swp);
|
---|
2229 | if (!(swp.fl & SWP_MAXIMIZE))
|
---|
2230 | fl |= SWP_RESTORE;
|
---|
2231 | WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, fl);
|
---|
2232 | }
|
---|
2233 | break;
|
---|
2234 |
|
---|
2235 | case UM_SETUP:
|
---|
2236 | if (mp1)
|
---|
2237 | strcpy(lastcmd, (CHAR *) mp1);
|
---|
2238 | return 0;
|
---|
2239 |
|
---|
2240 | case UM_RESCAN:
|
---|
2241 | if (hwndE && WinIsWindow(WinQueryAnchorBlock(hwnd), hwndE))
|
---|
2242 | WinDestroyWindow(hwndE);
|
---|
2243 | if (hwndB && WinIsWindow(WinQueryAnchorBlock(hwnd), hwndB))
|
---|
2244 | WinDestroyWindow(hwndB);
|
---|
2245 | hwndE = hwndB = (HWND) 0;
|
---|
2246 | return 0;
|
---|
2247 |
|
---|
2248 | case WM_COMMAND:
|
---|
2249 | switch (SHORT1FROMMP(mp1)) {
|
---|
2250 | case COMMAND_BUTTON:
|
---|
2251 | PostMsg(hwndE, msg, mp1, mp2);
|
---|
2252 | break;
|
---|
2253 | }
|
---|
2254 | return 0;
|
---|
2255 |
|
---|
2256 | case WM_MOUSEMOVE:
|
---|
2257 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
2258 | {
|
---|
2259 | USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
2260 | char *s = NULL;
|
---|
2261 |
|
---|
2262 | if (fOtherHelp) {
|
---|
2263 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
---|
2264 | && !WinQueryCapture(HWND_DESKTOP)) {
|
---|
2265 | switch (id) {
|
---|
2266 | case IDM_ATTRS:
|
---|
2267 | if (WinQueryWindowTextLength(hwnd))
|
---|
2268 | s = GetPString(IDS_ATTRSBUTTONHELP);
|
---|
2269 | break;
|
---|
2270 | case IDM_INFO:
|
---|
2271 | if (WinQueryWindowTextLength(hwnd))
|
---|
2272 | s = GetPString(IDS_INFOBUTTONHELP);
|
---|
2273 | break;
|
---|
2274 | case IDM_RENAME:
|
---|
2275 | if (WinQueryWindowTextLength(hwnd))
|
---|
2276 | s = GetPString(IDS_NAMEBUTTONHELP);
|
---|
2277 | break;
|
---|
2278 | case MAIN_STATUS2:
|
---|
2279 | if (!hwndE)
|
---|
2280 | s = GetPString(IDS_STATUS2HELP);
|
---|
2281 | break;
|
---|
2282 | default:
|
---|
2283 | break;
|
---|
2284 | }
|
---|
2285 | if (s)
|
---|
2286 | MakeBubble(hwnd, FALSE, s);
|
---|
2287 | else if (hwndBubble)
|
---|
2288 | WinDestroyWindow(hwndBubble);
|
---|
2289 | }
|
---|
2290 | }
|
---|
2291 | switch (id) {
|
---|
2292 | case IDM_ATTRS:
|
---|
2293 | case IDM_INFO:
|
---|
2294 | case IDM_RENAME:
|
---|
2295 | case MAIN_STATUS2:
|
---|
2296 | return CommonTextProc(hwnd, msg, mp1, mp2);
|
---|
2297 | default:
|
---|
2298 | break;
|
---|
2299 | }
|
---|
2300 | }
|
---|
2301 | break;
|
---|
2302 |
|
---|
2303 | case WM_BUTTON2DOWN:
|
---|
2304 | case WM_BUTTON2UP:
|
---|
2305 | case UM_FOCUSME:
|
---|
2306 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
2307 |
|
---|
2308 | case WM_BUTTON1DOWN:
|
---|
2309 | case WM_BUTTON1UP:
|
---|
2310 | case WM_BUTTON3DOWN:
|
---|
2311 | case WM_BUTTON3UP:
|
---|
2312 | {
|
---|
2313 | USHORT id;
|
---|
2314 |
|
---|
2315 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
2316 | switch (id) {
|
---|
2317 | case IDM_ATTRS:
|
---|
2318 | case IDM_INFO:
|
---|
2319 | case IDM_RENAME:
|
---|
2320 | case MAIN_STATUS2:
|
---|
2321 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
2322 | default:
|
---|
2323 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
2324 | break;
|
---|
2325 | }
|
---|
2326 | }
|
---|
2327 | break;
|
---|
2328 |
|
---|
2329 | case WM_SETFOCUS:
|
---|
2330 | if (mp2) {
|
---|
2331 |
|
---|
2332 | USHORT id;
|
---|
2333 |
|
---|
2334 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
2335 | if (id == MAIN_STATUS2 && hwndE)
|
---|
2336 | WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
2337 | else
|
---|
2338 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
2339 | }
|
---|
2340 | break;
|
---|
2341 |
|
---|
2342 | case WM_BUTTON1CLICK:
|
---|
2343 | {
|
---|
2344 | USHORT id;
|
---|
2345 |
|
---|
2346 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
2347 | if (id == MAIN_STATUS) {
|
---|
2348 | if (SHORT2FROMMP(mp2) & KC_CTRL)
|
---|
2349 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
2350 | FID_CLIENT),
|
---|
2351 | WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
---|
2352 | else if (hwndTree)
|
---|
2353 | PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID);
|
---|
2354 | }
|
---|
2355 | }
|
---|
2356 | break;
|
---|
2357 |
|
---|
2358 | case UM_CLICKED:
|
---|
2359 | case UM_CLICKED3:
|
---|
2360 | {
|
---|
2361 | USHORT id;
|
---|
2362 |
|
---|
2363 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
2364 | if (id == MAIN_STATUS2 && !hwndE) {
|
---|
2365 |
|
---|
2366 | SWP swp;
|
---|
2367 | CHAR directory[CCHMAXPATH];
|
---|
2368 | PFNWP oldproce;
|
---|
2369 |
|
---|
2370 | *directory = 0;
|
---|
2371 | TopWindowName(hwndMain, (HWND) 0, directory);
|
---|
2372 | WinQueryWindowPos(hwnd, &swp);
|
---|
2373 | hwndB = WinCreateWindow(hwnd,
|
---|
2374 | WC_BUTTON,
|
---|
2375 | "+",
|
---|
2376 | WS_VISIBLE | BS_PUSHBUTTON |
|
---|
2377 | BS_NOPOINTERFOCUS,
|
---|
2378 | swp.cx - swp.cy,
|
---|
2379 | 0,
|
---|
2380 | swp.cy,
|
---|
2381 | swp.cy,
|
---|
2382 | hwnd, HWND_TOP, COMMAND_BUTTON, NULL, NULL);
|
---|
2383 | if (!hwndB)
|
---|
2384 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
2385 | hwndE = WinCreateWindow(hwnd,
|
---|
2386 | WC_ENTRYFIELD,
|
---|
2387 | NULL,
|
---|
2388 | WS_VISIBLE | ES_AUTOSCROLL,
|
---|
2389 | 0,
|
---|
2390 | 0,
|
---|
2391 | swp.cx - swp.cy,
|
---|
2392 | swp.cy,
|
---|
2393 | hwnd, HWND_TOP, COMMAND_LINE, NULL, NULL);
|
---|
2394 | if (!hwndE)
|
---|
2395 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
2396 | if (!hwndE || !hwndB) {
|
---|
2397 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
2398 | return 0;
|
---|
2399 | }
|
---|
2400 | WinSendMsg(hwndE, EM_SETTEXTLIMIT, MPFROM2SHORT(1024, 0), MPVOID);
|
---|
2401 | WinSetWindowText(hwndStatus, directory);
|
---|
2402 | if (*lastcmd)
|
---|
2403 | WinSetWindowText(hwndE, lastcmd);
|
---|
2404 | else
|
---|
2405 | WinSetWindowText(hwndE, GetPString(IDS_HELPCMDTEXT));
|
---|
2406 | oldproce = WinSubclassWindow(hwndE, (PFNWP) CommandLineProc);
|
---|
2407 | if (oldproce)
|
---|
2408 | WinSetWindowPtr(hwndE, QWL_USER, (PVOID) oldproce);
|
---|
2409 | PostMsg(hwndE, UM_FOCUSME, MPVOID, MPVOID);
|
---|
2410 | PostMsg(hwndE, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);
|
---|
2411 | return 0;
|
---|
2412 | }
|
---|
2413 | if (msg == UM_CLICKED3 || (SHORT2FROMMP(mp2) & KC_CTRL)) {
|
---|
2414 | switch (id) {
|
---|
2415 | case IDM_ATTRS:
|
---|
2416 | id = IDM_SORTSIZE;
|
---|
2417 | break;
|
---|
2418 | case IDM_INFO:
|
---|
2419 | id = IDM_SORTLWDATE;
|
---|
2420 | break;
|
---|
2421 | case IDM_RENAME:
|
---|
2422 | id = IDM_SORTFILENAME;
|
---|
2423 | break;
|
---|
2424 | }
|
---|
2425 | }
|
---|
2426 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
2427 | WM_COMMAND, MPFROM2SHORT(id, 0), MPVOID);
|
---|
2428 | }
|
---|
2429 | return 0;
|
---|
2430 |
|
---|
2431 | case WM_PAINT:
|
---|
2432 | {
|
---|
2433 | USHORT id;
|
---|
2434 |
|
---|
2435 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
2436 | switch (id) {
|
---|
2437 | case IDM_ATTRS:
|
---|
2438 | case IDM_INFO:
|
---|
2439 | case IDM_RENAME:
|
---|
2440 | case MAIN_STATUS2:
|
---|
2441 | PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
|
---|
2442 | break;
|
---|
2443 | default:
|
---|
2444 | PaintRecessedWindow(hwnd, (HPS) 0, FALSE, TRUE);
|
---|
2445 | break;
|
---|
2446 | }
|
---|
2447 | if (id == IDM_RENAME) {
|
---|
2448 |
|
---|
2449 | HPS hps;
|
---|
2450 |
|
---|
2451 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
---|
2452 | if (hps) {
|
---|
2453 | PaintSTextWindow(hwnd, hps);
|
---|
2454 | WinEndPaint(hps);
|
---|
2455 | }
|
---|
2456 | return 0;
|
---|
2457 | }
|
---|
2458 | }
|
---|
2459 | break;
|
---|
2460 |
|
---|
2461 | }
|
---|
2462 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
2463 | }
|
---|
2464 |
|
---|
2465 | MRESULT EXPENTRY ToolBackProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
2466 | {
|
---|
2467 | switch (msg) {
|
---|
2468 | case WM_CREATE:
|
---|
2469 | hwndToolback = hwnd;
|
---|
2470 | RestorePresParams(hwnd, "ToolBar");
|
---|
2471 | break;
|
---|
2472 |
|
---|
2473 | case WM_MOUSEMOVE:
|
---|
2474 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
2475 | break;
|
---|
2476 |
|
---|
2477 | case WM_CONTROLPOINTER:
|
---|
2478 | if (!fNoFinger && SHORT1FROMMP(mp1) < 25000)
|
---|
2479 | return MRFROMLONG(hptrFinger);
|
---|
2480 | break;
|
---|
2481 |
|
---|
2482 | case WM_CHAR:
|
---|
2483 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
2484 | break;
|
---|
2485 |
|
---|
2486 | case WM_COMMAND:
|
---|
2487 | case UM_COMMAND:
|
---|
2488 | return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
2489 | FID_CLIENT), msg, mp1, mp2);
|
---|
2490 |
|
---|
2491 | case WM_PAINT:
|
---|
2492 |
|
---|
2493 | PaintRecessedWindow(hwnd, (HPS)0, TRUE, FALSE);
|
---|
2494 |
|
---|
2495 | {
|
---|
2496 | HPS hps;
|
---|
2497 | RECTL rcl;
|
---|
2498 | ULONG lColor;
|
---|
2499 |
|
---|
2500 | hps = WinBeginPaint(hwnd, (HPS)0, NULL);
|
---|
2501 | if (hps) {
|
---|
2502 | GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);
|
---|
2503 | WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, NULL,
|
---|
2504 | sizeof(lColor), &lColor, 0);
|
---|
2505 | WinQueryWindowRect(hwnd, &rcl);
|
---|
2506 | WinFillRect(hps, &rcl, lColor);
|
---|
2507 | WinEndPaint(hps);
|
---|
2508 | }
|
---|
2509 |
|
---|
2510 | }
|
---|
2511 | break;
|
---|
2512 |
|
---|
2513 | case WM_PRESPARAMCHANGED:
|
---|
2514 | PresParamChanged(hwnd, "ToolBar", mp1, mp2);
|
---|
2515 | WinInvalidateRect(hwnd, NULL, TRUE);
|
---|
2516 | break;
|
---|
2517 |
|
---|
2518 | case UM_SETUP:
|
---|
2519 | {
|
---|
2520 | USHORT id;
|
---|
2521 | TOOL *tool;
|
---|
2522 |
|
---|
2523 | id = SHORT1FROMMP(mp1);
|
---|
2524 | tool = find_tool(id);
|
---|
2525 | if (tool) {
|
---|
2526 | del_tool(tool);
|
---|
2527 | WinShowWindow(WinWindowFromID(hwnd, id), FALSE);
|
---|
2528 | if (fToolTitles)
|
---|
2529 | WinShowWindow(WinWindowFromID(hwnd, id + 25000), FALSE);
|
---|
2530 | ResizeTools(hwnd);
|
---|
2531 | }
|
---|
2532 | }
|
---|
2533 | return 0;
|
---|
2534 |
|
---|
2535 | case WM_CHORD:
|
---|
2536 | {
|
---|
2537 | USHORT id;
|
---|
2538 |
|
---|
2539 | id = (USHORT) WinDlgBox(HWND_DESKTOP,
|
---|
2540 | hwnd,
|
---|
2541 | AddToolProc,
|
---|
2542 | FM3ModHandle, ADDBTN_FRAME, MPVOID);
|
---|
2543 | if (id && id != (USHORT) - 1)
|
---|
2544 | WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
2545 | FID_CLIENT),
|
---|
2546 | WM_COMMAND,
|
---|
2547 | MPFROM2SHORT(IDM_CREATETOOL, 0), MPFROM2SHORT(id, 0));
|
---|
2548 | }
|
---|
2549 | break;
|
---|
2550 |
|
---|
2551 | case WM_CONTEXTMENU:
|
---|
2552 | if (WinDlgBox(HWND_DESKTOP,
|
---|
2553 | hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID))
|
---|
2554 | BuildTools(hwnd, TRUE);
|
---|
2555 | return MRFROMSHORT(TRUE);
|
---|
2556 |
|
---|
2557 | case WM_CLOSE:
|
---|
2558 | WinDestroyWindow(hwnd);
|
---|
2559 | return 0;
|
---|
2560 |
|
---|
2561 | case WM_DESTROY:
|
---|
2562 | break;
|
---|
2563 | }
|
---|
2564 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
2565 | }
|
---|
2566 |
|
---|
2567 | static VOID AdjustSizeOfClient(PSWP pswp, PRECTL prectl)
|
---|
2568 | {
|
---|
2569 | SWP swp;
|
---|
2570 | RECTL rectl;
|
---|
2571 |
|
---|
2572 | if (fFreeTree)
|
---|
2573 | return;
|
---|
2574 | if (pswp) {
|
---|
2575 | if (WinQueryWindowPos(hwndTree, &swp) &&
|
---|
2576 | !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) {
|
---|
2577 | pswp->x = swp.cx;
|
---|
2578 | pswp->cx -= swp.cx;
|
---|
2579 | }
|
---|
2580 | }
|
---|
2581 | if (prectl) {
|
---|
2582 | if (WinQueryWindowPos(hwndTree, &swp) &&
|
---|
2583 | !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) &&
|
---|
2584 | WinQueryWindowRect(hwndTree, &rectl)) {
|
---|
2585 | prectl->xLeft = rectl.xRight;
|
---|
2586 | prectl->xRight -= rectl.xRight;
|
---|
2587 | }
|
---|
2588 | }
|
---|
2589 | }
|
---|
2590 |
|
---|
2591 | VOID FillClient(HWND hwndClient, PSWP pswp, PRECTL prectl, BOOL avoidtree)
|
---|
2592 | {
|
---|
2593 | ULONG adjust;
|
---|
2594 |
|
---|
2595 | adjust = WinQuerySysValue(HWND_DESKTOP, SV_CYICON);
|
---|
2596 | if (pswp)
|
---|
2597 | WinQueryWindowPos(hwndClient, pswp);
|
---|
2598 | if (prectl)
|
---|
2599 | WinQueryWindowRect(hwndClient, prectl);
|
---|
2600 | if (avoidtree && !fFreeTree)
|
---|
2601 | AdjustSizeOfClient(pswp, prectl);
|
---|
2602 | if (prectl)
|
---|
2603 | prectl->yBottom += adjust;
|
---|
2604 | if (pswp) {
|
---|
2605 | if (!avoidtree || fFreeTree)
|
---|
2606 | pswp->x = 0;
|
---|
2607 | pswp->y = adjust;
|
---|
2608 | if (pswp->cy >= adjust)
|
---|
2609 | pswp->cy -= adjust;
|
---|
2610 | else
|
---|
2611 | pswp->cy = 0;
|
---|
2612 | }
|
---|
2613 | }
|
---|
2614 |
|
---|
2615 | static VOID MoveChildrenAwayFromTree(HWND hwndClient)
|
---|
2616 | {
|
---|
2617 | SWP swpC, swpT, swp;
|
---|
2618 | USHORT id;
|
---|
2619 | HWND hwndChild;
|
---|
2620 | HENUM henum;
|
---|
2621 |
|
---|
2622 | if (fFreeTree)
|
---|
2623 | return;
|
---|
2624 | WinQueryWindowPos(hwndClient, &swpC);
|
---|
2625 | if (swpC.fl & (SWP_MINIMIZE | SWP_HIDE))
|
---|
2626 | return;
|
---|
2627 | WinQueryWindowPos(hwndTree, &swpT);
|
---|
2628 | henum = WinBeginEnumWindows(hwndClient);
|
---|
2629 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
2630 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
---|
2631 | if (!id || id == TREE_FRAME)
|
---|
2632 | continue;
|
---|
2633 | WinQueryWindowPos(hwndChild, &swp);
|
---|
2634 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
2635 | if (swp.x < swpT.cx) {
|
---|
2636 | swp.x = swpT.cx;
|
---|
2637 | if (swp.x + swp.cx > swpC.cx)
|
---|
2638 | swp.cx = swpC.cx - swp.x;
|
---|
2639 | if (swp.cx > 24)
|
---|
2640 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
2641 | SWP_SIZE | SWP_MOVE | SWP_SHOW);
|
---|
2642 | }
|
---|
2643 | }
|
---|
2644 | }
|
---|
2645 | WinEndEnumWindows(henum);
|
---|
2646 | }
|
---|
2647 |
|
---|
2648 | static VOID ArrangeIcons(HWND hwndClient)
|
---|
2649 | {
|
---|
2650 | HENUM henum;
|
---|
2651 | HWND hwndChild;
|
---|
2652 | SWP swp;
|
---|
2653 |
|
---|
2654 | henum = WinBeginEnumWindows(hwndClient);
|
---|
2655 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
2656 | WinQueryWindowPos(hwndChild, &swp);
|
---|
2657 | if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {
|
---|
2658 | WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1);
|
---|
2659 | WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);
|
---|
2660 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,
|
---|
2661 | SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE);
|
---|
2662 | }
|
---|
2663 | }
|
---|
2664 | WinEndEnumWindows(henum);
|
---|
2665 | }
|
---|
2666 |
|
---|
2667 | static VOID NextChild(HWND hwndClient, BOOL previous)
|
---|
2668 | {
|
---|
2669 | HENUM henum;
|
---|
2670 | HWND hwndActive, hwndNext, hwndPrev = (HWND) 0;
|
---|
2671 | BOOL next = FALSE, once = FALSE;
|
---|
2672 |
|
---|
2673 | previous = !previous;
|
---|
2674 |
|
---|
2675 | hwndActive = WinQueryActiveWindow(hwndClient);
|
---|
2676 | if (!hwndActive)
|
---|
2677 | next = TRUE;
|
---|
2678 | henum = WinBeginEnumWindows(hwndClient);
|
---|
2679 | for (;;) {
|
---|
2680 | hwndNext = WinGetNextWindow(henum);
|
---|
2681 | if (hwndNext) {
|
---|
2682 | if (!WinQueryWindowUShort(hwndNext, QWS_ID))
|
---|
2683 | continue;
|
---|
2684 | if (next)
|
---|
2685 | break;
|
---|
2686 | if (hwndNext == hwndActive) {
|
---|
2687 | if (!previous && hwndPrev) {
|
---|
2688 | hwndNext = hwndPrev;
|
---|
2689 | break;
|
---|
2690 | }
|
---|
2691 | else if (previous)
|
---|
2692 | next = TRUE;
|
---|
2693 | }
|
---|
2694 | hwndPrev = hwndNext;
|
---|
2695 | }
|
---|
2696 | else {
|
---|
2697 | if ((!next && previous) || once)
|
---|
2698 | break;
|
---|
2699 | else if (!previous) {
|
---|
2700 | hwndNext = hwndPrev;
|
---|
2701 | break;
|
---|
2702 | }
|
---|
2703 | else
|
---|
2704 | once = next = TRUE;
|
---|
2705 | }
|
---|
2706 | }
|
---|
2707 | WinEndEnumWindows(henum);
|
---|
2708 |
|
---|
2709 | if (hwndNext && hwndNext != hwndActive) {
|
---|
2710 | WinSetWindowPos(hwndNext, HWND_TOP, 0, 0, 0, 0,
|
---|
2711 | SWP_ZORDER | SWP_ACTIVATE);
|
---|
2712 | WinSetWindowPos(hwndActive, ((previous) ? HWND_BOTTOM : hwndNext), 0, 0,
|
---|
2713 | 0, 0, SWP_ZORDER);
|
---|
2714 | }
|
---|
2715 | }
|
---|
2716 |
|
---|
2717 | BOOL CloseChildren(HWND hwndClient)
|
---|
2718 | {
|
---|
2719 | HENUM henum;
|
---|
2720 | HWND hwndChild;
|
---|
2721 | BOOL ret = FALSE;
|
---|
2722 |
|
---|
2723 | fNoTileUpdate = TRUE;
|
---|
2724 | henum = WinBeginEnumWindows(hwndClient);
|
---|
2725 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
2726 | if (hwndChild != hwndTree) {
|
---|
2727 | WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
---|
2728 | WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
---|
2729 | if (WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
---|
2730 | WM_CLOSE, MPVOID, MPVOID)) {
|
---|
2731 | ret = TRUE;
|
---|
2732 | break;
|
---|
2733 | }
|
---|
2734 | }
|
---|
2735 | }
|
---|
2736 | WinEndEnumWindows(henum);
|
---|
2737 | fNoTileUpdate = FALSE;
|
---|
2738 | return ret;
|
---|
2739 | }
|
---|
2740 |
|
---|
2741 | BOOL CloseDirCnrChildren(HWND hwndClient)
|
---|
2742 | {
|
---|
2743 | /* returns TRUE if a directory container window was told to close */
|
---|
2744 |
|
---|
2745 | HENUM henum;
|
---|
2746 | HWND hwndChild, hwndDir, hwndTemp;
|
---|
2747 | BOOL ret = FALSE;
|
---|
2748 |
|
---|
2749 | fNoTileUpdate = TRUE;
|
---|
2750 | henum = WinBeginEnumWindows(hwndClient);
|
---|
2751 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
2752 | if (hwndChild != hwndTree) {
|
---|
2753 | hwndTemp = WinWindowFromID(hwndChild, FID_CLIENT);
|
---|
2754 | if (hwndTemp) {
|
---|
2755 | hwndDir = WinWindowFromID(hwndTemp, DIR_CNR);
|
---|
2756 | if (hwndDir) {
|
---|
2757 | WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
---|
2758 | WM_CLOSE, MPVOID, MPVOID);
|
---|
2759 | ret = TRUE;
|
---|
2760 | }
|
---|
2761 | }
|
---|
2762 | }
|
---|
2763 | }
|
---|
2764 | WinEndEnumWindows(henum);
|
---|
2765 | fNoTileUpdate = FALSE;
|
---|
2766 | return ret;
|
---|
2767 | }
|
---|
2768 |
|
---|
2769 | /** Save directory container state
|
---|
2770 | * @param hwndClient Client window handle
|
---|
2771 | * @param pszStateName State name to save, NULL to save global state
|
---|
2772 | * @returns Number of directory container windows that were saved or -1 if error
|
---|
2773 | * @seealso RestoreDirCnrState
|
---|
2774 | */
|
---|
2775 |
|
---|
2776 | #define STATE_NAME_MAX_BYTES 256
|
---|
2777 |
|
---|
2778 | INT SaveDirCnrState(HWND hwndClient, PSZ pszStateName)
|
---|
2779 | {
|
---|
2780 | HENUM henum;
|
---|
2781 | HWND hwndChild, hwndDir, hwndC;
|
---|
2782 | ULONG numsaves = 0, flWindowAttr;
|
---|
2783 | CHAR szPrefix[STATE_NAME_MAX_BYTES + 1];
|
---|
2784 | CHAR szKey[STATE_NAME_MAX_BYTES + 80];
|
---|
2785 | CHAR szDir[CCHMAXPATH];
|
---|
2786 | SWP swp;
|
---|
2787 | INT nSaved = 0;
|
---|
2788 | DIRCNRDATA *dcd;
|
---|
2789 | BOOL fIsShutDownState;
|
---|
2790 |
|
---|
2791 | if (!pszStateName || !*pszStateName) {
|
---|
2792 | Runtime_Error(pszSrcFile, __LINE__, "no data");
|
---|
2793 | return -1;
|
---|
2794 | }
|
---|
2795 | if (strlen(pszStateName) > sizeof(szPrefix) - 2) {
|
---|
2796 | Runtime_Error(pszSrcFile, __LINE__, "SaveDirCnrState");
|
---|
2797 | return -1;
|
---|
2798 | }
|
---|
2799 |
|
---|
2800 | fIsShutDownState = strcmp(pszStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0;
|
---|
2801 | sprintf(szPrefix, "%s.", pszStateName);
|
---|
2802 |
|
---|
2803 | henum = WinBeginEnumWindows(hwndClient);
|
---|
2804 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
2805 | if (hwndChild != hwndTree) {
|
---|
2806 | hwndC = WinWindowFromID(hwndChild, FID_CLIENT);
|
---|
2807 | if (hwndC) {
|
---|
2808 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
---|
2809 | if (hwndDir) {
|
---|
2810 | WinQueryWindowPos(hwndChild, &swp);
|
---|
2811 | *szDir = 0;
|
---|
2812 | WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(szDir), MPVOID);
|
---|
2813 | if (*szDir) {
|
---|
2814 | // If saving shutdown state skip no prescan drives
|
---|
2815 | if (fIsShutDownState &&
|
---|
2816 | driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
|
---|
2817 | continue;
|
---|
2818 | }
|
---|
2819 | sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves);
|
---|
2820 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp,
|
---|
2821 | sizeof(SWP));
|
---|
2822 | dcd =
|
---|
2823 | WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
2824 | if (dcd) {
|
---|
2825 | sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves);
|
---|
2826 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags,
|
---|
2827 | sizeof(INT));
|
---|
2828 | sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves);
|
---|
2829 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask,
|
---|
2830 | sizeof(MASK));
|
---|
2831 | sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves);
|
---|
2832 | flWindowAttr = dcd->flWindowAttr;
|
---|
2833 | if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
|
---|
2834 | flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
|
---|
2835 | if (dcd->lastattr) {
|
---|
2836 | if (dcd->lastattr & CV_TEXT)
|
---|
2837 | flWindowAttr |= CV_TEXT;
|
---|
2838 | else if (dcd->lastattr & CV_DETAIL)
|
---|
2839 | flWindowAttr |= CV_DETAIL;
|
---|
2840 | else if (dcd->lastattr & CV_ICON)
|
---|
2841 | flWindowAttr |= CV_ICON;
|
---|
2842 | else
|
---|
2843 | flWindowAttr |= CV_NAME;
|
---|
2844 | }
|
---|
2845 | else
|
---|
2846 | flWindowAttr |= CV_NAME;
|
---|
2847 | }
|
---|
2848 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr,
|
---|
2849 | sizeof(ULONG));
|
---|
2850 | sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves);
|
---|
2851 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslongname,
|
---|
2852 | sizeof(BOOL));
|
---|
2853 | sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, numsaves);
|
---|
2854 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailssubject,
|
---|
2855 | sizeof(BOOL));
|
---|
2856 | sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, numsaves);
|
---|
2857 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailssize,
|
---|
2858 | sizeof(BOOL));
|
---|
2859 | sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, numsaves);
|
---|
2860 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsea,
|
---|
2861 | sizeof(BOOL));
|
---|
2862 | sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, numsaves);
|
---|
2863 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsattr,
|
---|
2864 | sizeof(BOOL));
|
---|
2865 | sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, numsaves);
|
---|
2866 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsicon,
|
---|
2867 | sizeof(BOOL));
|
---|
2868 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, numsaves);
|
---|
2869 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslwdate,
|
---|
2870 | sizeof(BOOL));
|
---|
2871 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, numsaves);
|
---|
2872 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslwtime,
|
---|
2873 | sizeof(BOOL));
|
---|
2874 | sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, numsaves);
|
---|
2875 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsladate,
|
---|
2876 | sizeof(BOOL));
|
---|
2877 | sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, numsaves);
|
---|
2878 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslatime,
|
---|
2879 | sizeof(BOOL));
|
---|
2880 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, numsaves);
|
---|
2881 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailscrdate,
|
---|
2882 | sizeof(BOOL));
|
---|
2883 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, numsaves);
|
---|
2884 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailscrtime,
|
---|
2885 | sizeof(BOOL));
|
---|
2886 | sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves);
|
---|
2887 | SavePresParams(hwndDir, szKey);
|
---|
2888 | }
|
---|
2889 | sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++);
|
---|
2890 | PrfWriteProfileString(fmprof, FM3Str, szKey, szDir);
|
---|
2891 | nSaved++;
|
---|
2892 | }
|
---|
2893 | }
|
---|
2894 | }
|
---|
2895 | }
|
---|
2896 | } // while
|
---|
2897 | WinEndEnumWindows(henum);
|
---|
2898 |
|
---|
2899 | if (nSaved) {
|
---|
2900 | if (WinQueryWindowPos(hwndTree, &swp)) {
|
---|
2901 | sprintf(szKey, "%sLastTreePos", szPrefix);
|
---|
2902 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, sizeof(SWP));
|
---|
2903 | }
|
---|
2904 | sprintf(szKey, "%sNumDirsLastTime", szPrefix);
|
---|
2905 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & numsaves, sizeof(ULONG));
|
---|
2906 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swp);
|
---|
2907 | sprintf(szKey, "%sMySizeLastTime", szPrefix);
|
---|
2908 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, sizeof(SWP));
|
---|
2909 | }
|
---|
2910 |
|
---|
2911 | return nSaved;
|
---|
2912 | }
|
---|
2913 |
|
---|
2914 | static VOID TransformSwp(PSWP pswp, double xtrans, double ytrans)
|
---|
2915 | {
|
---|
2916 | SWP swp;
|
---|
2917 | HWND hwnd;
|
---|
2918 |
|
---|
2919 | if ((LONG) pswp->x < 0L) {
|
---|
2920 | pswp->cx -= abs(pswp->x);
|
---|
2921 | pswp->x = 0;
|
---|
2922 | }
|
---|
2923 | if ((LONG) pswp->y < 0L) {
|
---|
2924 | pswp->cy -= abs(pswp->y);
|
---|
2925 | pswp->y = 0;
|
---|
2926 | }
|
---|
2927 | pswp->x = (LONG) (((double)pswp->x * 100.0) / xtrans);
|
---|
2928 | pswp->cx = (LONG) (((double)pswp->cx * 100.0) / xtrans);
|
---|
2929 | pswp->y = (LONG) (((double)pswp->y * 100.0) / ytrans);
|
---|
2930 | pswp->cy = (LONG) (((double)pswp->cy * 100.0) / ytrans);
|
---|
2931 | if (pswp->hwnd) {
|
---|
2932 | hwnd = WinQueryWindow(pswp->hwnd, QW_PARENT);
|
---|
2933 | if (hwnd) {
|
---|
2934 | if (WinQueryWindowPos(hwnd, &swp)) {
|
---|
2935 | if (pswp->x > swp.cx)
|
---|
2936 | pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx;
|
---|
2937 | if (pswp->y > swp.cy)
|
---|
2938 | pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy;
|
---|
2939 | if (pswp->x + pswp->cx > swp.cx)
|
---|
2940 | pswp->cx = swp.cx - pswp->x;
|
---|
2941 | if (pswp->y + pswp->cy > swp.cy)
|
---|
2942 | pswp->cy = swp.cy - pswp->y;
|
---|
2943 | }
|
---|
2944 | }
|
---|
2945 | }
|
---|
2946 | }
|
---|
2947 |
|
---|
2948 | /** Restore directory container state
|
---|
2949 | * @param hwndClient Client window handle
|
---|
2950 | * @param pszStateName State name to restore, NULL to restore global state
|
---|
2951 | * @param noview request view state restore bypass
|
---|
2952 | * @returns TRUE if one or more directory containers were opened
|
---|
2953 | * @seealso SaveDirCnrState
|
---|
2954 | */
|
---|
2955 |
|
---|
2956 | static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview)
|
---|
2957 | {
|
---|
2958 | CHAR szKey[STATE_NAME_MAX_BYTES + 80];
|
---|
2959 | CHAR szDir[CCHMAXPATH];
|
---|
2960 | CHAR szPrefix[STATE_NAME_MAX_BYTES + 2];
|
---|
2961 | HWND hwndDir, hwndC;
|
---|
2962 | SWP swp, swpO, swpN;
|
---|
2963 | ULONG size, numsaves = 0, x;
|
---|
2964 | double xtrans, ytrans;
|
---|
2965 | BOOL fRestored = FALSE;
|
---|
2966 | DIRCNRDATA localdcd, *dcd;
|
---|
2967 | BOOL fIsShutDownState;
|
---|
2968 | BOOL fDeleteState;
|
---|
2969 |
|
---|
2970 | if (!pszStateName || !*pszStateName) {
|
---|
2971 | Runtime_Error(pszSrcFile, __LINE__, "no name");
|
---|
2972 | return fRestored;
|
---|
2973 | }
|
---|
2974 | if (strlen(pszStateName) > sizeof(szPrefix) - 2) {
|
---|
2975 | Runtime_Error(pszSrcFile, __LINE__, "name too long");
|
---|
2976 | return fRestored;
|
---|
2977 | }
|
---|
2978 |
|
---|
2979 | sprintf(szPrefix, "%s.", pszStateName);
|
---|
2980 |
|
---|
2981 | // If restoring shutdown state bypass no-prescan drives
|
---|
2982 | fIsShutDownState = strcmp(pszStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0;
|
---|
2983 | // Delete saved state if restored saved state or internally saved state
|
---|
2984 | fDeleteState = /* fIsShutDownState || */
|
---|
2985 | strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)) == 0;
|
---|
2986 |
|
---|
2987 | size = sizeof(SWP);
|
---|
2988 | sprintf(szKey, "%sMySizeLastTime", szPrefix);
|
---|
2989 | if (!PrfQueryProfileData(fmprof,
|
---|
2990 | FM3Str,
|
---|
2991 | szKey,
|
---|
2992 | (PVOID) & swpO,
|
---|
2993 | &size) ||
|
---|
2994 | size != sizeof(SWP) || !swp.cx || !swp.cy)
|
---|
2995 | {
|
---|
2996 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swpO);
|
---|
2997 | }
|
---|
2998 | // If restoring saved shutdown state or internally saved state, forget info
|
---|
2999 | if (fDeleteState)
|
---|
3000 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3001 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swpN);
|
---|
3002 | if (swpN.fl & (SWP_MINIMIZE | SWP_HIDE))
|
---|
3003 | swpN = swpO;
|
---|
3004 | xtrans = ((double)swpO.cx * 100.0) / (double)swpN.cx;
|
---|
3005 | ytrans = ((double)swpO.cy * 100.0) / (double)swpN.cy;
|
---|
3006 | size = sizeof(SWP);
|
---|
3007 | sprintf(szKey, "%sLastTreePos", szPrefix);
|
---|
3008 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, &size)) {
|
---|
3009 | if (fDeleteState)
|
---|
3010 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3011 | swp.hwnd = hwndTree;
|
---|
3012 | TransformSwp(&swp, xtrans, ytrans);
|
---|
3013 | if (!fFreeTree) {
|
---|
3014 | WinQueryWindowPos(hwndClient, &swpN);
|
---|
3015 | swp.x = 0;
|
---|
3016 | swp.y = (swpN.cy - swp.cy);
|
---|
3017 | }
|
---|
3018 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE))) {
|
---|
3019 | swp.fl &= (~SWP_ACTIVATE);
|
---|
3020 | WinSetWindowPos(hwndTree,
|
---|
3021 | HWND_TOP,
|
---|
3022 | swp.x,
|
---|
3023 | swp.y,
|
---|
3024 | swp.cx,
|
---|
3025 | swp.cy,
|
---|
3026 | swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
---|
3027 | }
|
---|
3028 | else {
|
---|
3029 | WinSetWindowPos(hwndTree,
|
---|
3030 | HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);
|
---|
3031 | WinSetWindowUShort(hwndTree, QWS_XRESTORE, (USHORT) swp.x);
|
---|
3032 | WinSetWindowUShort(hwndTree, QWS_CXRESTORE, (USHORT) swp.cx);
|
---|
3033 | WinSetWindowUShort(hwndTree, QWS_YRESTORE, (USHORT) swp.y);
|
---|
3034 | WinSetWindowUShort(hwndTree, QWS_CYRESTORE, (USHORT) swp.cy);
|
---|
3035 | }
|
---|
3036 | }
|
---|
3037 | size = sizeof(ULONG);
|
---|
3038 | sprintf(szKey, "%sNumDirsLastTime", szPrefix);
|
---|
3039 | if (PrfQueryProfileData(fmprof,
|
---|
3040 | FM3Str, szKey, (PVOID) & numsaves, &size) && numsaves) {
|
---|
3041 | if (fDeleteState)
|
---|
3042 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3043 | for (x = 0; x < numsaves; x++) {
|
---|
3044 | sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, x);
|
---|
3045 | size = sizeof(SWP);
|
---|
3046 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) {
|
---|
3047 | if (fDeleteState)
|
---|
3048 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3049 | sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x);
|
---|
3050 | size = sizeof(szDir);
|
---|
3051 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) {
|
---|
3052 | // If restoring shutdown state and drive marked no prescan
|
---|
3053 | // bypass window restore
|
---|
3054 | if (fIsShutDownState &&
|
---|
3055 | driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
|
---|
3056 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3057 | continue;
|
---|
3058 | }
|
---|
3059 | if (fDeleteState)
|
---|
3060 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3061 | localdcd.detailslongname = detailslongname; // Set default
|
---|
3062 | size = sizeof(BOOL);
|
---|
3063 | sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x);
|
---|
3064 | if (PrfQueryProfileData(fmprof,
|
---|
3065 | FM3Str,
|
---|
3066 | szKey,
|
---|
3067 | (PVOID)&localdcd.detailslongname,
|
---|
3068 | &size) &&
|
---|
3069 | size == sizeof(BOOL))
|
---|
3070 | {
|
---|
3071 | if (fDeleteState)
|
---|
3072 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3073 | }
|
---|
3074 | localdcd.detailssubject = detailssubject; // Set default
|
---|
3075 | size = sizeof(BOOL);
|
---|
3076 | sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, x);
|
---|
3077 | if (PrfQueryProfileData(fmprof,
|
---|
3078 | FM3Str,
|
---|
3079 | szKey,
|
---|
3080 | (PVOID)&localdcd.detailssubject,
|
---|
3081 | &size) &&
|
---|
3082 | size == sizeof(BOOL))
|
---|
3083 | {
|
---|
3084 | if (fDeleteState)
|
---|
3085 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3086 | }
|
---|
3087 | localdcd.detailsea = detailsea; // Set default
|
---|
3088 | size = sizeof(BOOL);
|
---|
3089 | sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, x);
|
---|
3090 | if (PrfQueryProfileData(fmprof,
|
---|
3091 | FM3Str,
|
---|
3092 | szKey,
|
---|
3093 | (PVOID) & localdcd.detailsea,
|
---|
3094 | &size) &&
|
---|
3095 | size == sizeof(BOOL))
|
---|
3096 | {
|
---|
3097 | if (fDeleteState)
|
---|
3098 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3099 | }
|
---|
3100 | localdcd.detailssize = detailssize; // Set default
|
---|
3101 | size = sizeof(BOOL);
|
---|
3102 | sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, x);
|
---|
3103 | if (PrfQueryProfileData(fmprof,
|
---|
3104 | FM3Str,
|
---|
3105 | szKey,
|
---|
3106 | (PVOID) & localdcd.detailssize,
|
---|
3107 | &size) &&
|
---|
3108 | size == sizeof(BOOL))
|
---|
3109 | {
|
---|
3110 | if (fDeleteState)
|
---|
3111 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3112 | }
|
---|
3113 | localdcd.detailsicon = detailsicon; // Set default
|
---|
3114 | size = sizeof(BOOL);
|
---|
3115 | sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, x);
|
---|
3116 | if (PrfQueryProfileData(fmprof,
|
---|
3117 | FM3Str,
|
---|
3118 | szKey,
|
---|
3119 | (PVOID) & localdcd.detailsicon,
|
---|
3120 | &size) &&
|
---|
3121 | size == sizeof(BOOL))
|
---|
3122 | {
|
---|
3123 | if (fDeleteState)
|
---|
3124 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3125 | }
|
---|
3126 | localdcd.detailsattr = detailsattr; // Set default
|
---|
3127 | size = sizeof(BOOL);
|
---|
3128 | sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, x);
|
---|
3129 | if (PrfQueryProfileData(fmprof,
|
---|
3130 | FM3Str,
|
---|
3131 | szKey,
|
---|
3132 | (PVOID)&localdcd.detailsattr,
|
---|
3133 | &size) &&
|
---|
3134 | size == sizeof(BOOL))
|
---|
3135 | {
|
---|
3136 | if (fDeleteState)
|
---|
3137 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3138 | }
|
---|
3139 | localdcd.detailscrdate = detailscrdate; // Set default
|
---|
3140 | size = sizeof(BOOL);
|
---|
3141 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, x);
|
---|
3142 | if (PrfQueryProfileData(fmprof,
|
---|
3143 | FM3Str,
|
---|
3144 | szKey,
|
---|
3145 | (PVOID) & localdcd.detailscrdate,
|
---|
3146 | &size) && size == sizeof(BOOL))
|
---|
3147 | {
|
---|
3148 | if (fDeleteState)
|
---|
3149 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3150 | }
|
---|
3151 | localdcd.detailscrtime = detailscrtime; // Set default
|
---|
3152 | size = sizeof(BOOL);
|
---|
3153 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, x);
|
---|
3154 | if (PrfQueryProfileData(fmprof,
|
---|
3155 | FM3Str,
|
---|
3156 | szKey,
|
---|
3157 | (PVOID)&localdcd.detailscrtime,
|
---|
3158 | &size) &&
|
---|
3159 | size == sizeof(BOOL))
|
---|
3160 | {
|
---|
3161 | if (fDeleteState)
|
---|
3162 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3163 | }
|
---|
3164 | localdcd.detailslwdate = detailslwdate; // Set default
|
---|
3165 | size = sizeof(BOOL);
|
---|
3166 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, x);
|
---|
3167 | if (PrfQueryProfileData(fmprof,
|
---|
3168 | FM3Str,
|
---|
3169 | szKey,
|
---|
3170 | (PVOID) & localdcd.detailslwdate,
|
---|
3171 | &size) &&
|
---|
3172 | size == sizeof(BOOL))
|
---|
3173 | {
|
---|
3174 | if (fDeleteState)
|
---|
3175 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3176 | }
|
---|
3177 | localdcd.detailslwtime = detailslwtime; // Set default
|
---|
3178 | size = sizeof(BOOL);
|
---|
3179 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, x);
|
---|
3180 | if (PrfQueryProfileData(fmprof,
|
---|
3181 | FM3Str,
|
---|
3182 | szKey,
|
---|
3183 | (PVOID) & localdcd.detailslwtime,
|
---|
3184 | &size) &&
|
---|
3185 | size == sizeof(BOOL))
|
---|
3186 | {
|
---|
3187 | if (fDeleteState)
|
---|
3188 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3189 | }
|
---|
3190 | localdcd.detailsladate = detailsladate; // Set default
|
---|
3191 | size = sizeof(BOOL);
|
---|
3192 | sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, x);
|
---|
3193 | if (PrfQueryProfileData(fmprof,
|
---|
3194 | FM3Str,
|
---|
3195 | szKey,
|
---|
3196 | (PVOID) & localdcd.detailsladate,
|
---|
3197 | &size) &&
|
---|
3198 | size == sizeof(BOOL))
|
---|
3199 | {
|
---|
3200 | if (fDeleteState)
|
---|
3201 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3202 | }
|
---|
3203 | localdcd.detailslatime = detailslatime; // Set default
|
---|
3204 | size = sizeof(BOOL);
|
---|
3205 | sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, x);
|
---|
3206 | if (PrfQueryProfileData(fmprof,
|
---|
3207 | FM3Str,
|
---|
3208 | szKey,
|
---|
3209 | (PVOID) & localdcd.detailslatime,
|
---|
3210 | &size) &&
|
---|
3211 | size == sizeof(BOOL))
|
---|
3212 | {
|
---|
3213 | if (fDeleteState)
|
---|
3214 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3215 | }
|
---|
3216 | // sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);
|
---|
3217 | // RestorePresParams(hwndClient, szKey);
|
---|
3218 | // SavePresParams(hwndClient, "DirCnr");
|
---|
3219 | hwndDir = (HWND) WinSendMsg(hwndClient,
|
---|
3220 | UM_SETDIR,
|
---|
3221 | MPFROMP(szDir), MPFROMLONG(1));
|
---|
3222 | if (hwndDir) {
|
---|
3223 | hwndC = WinWindowFromID(hwndDir, FID_CLIENT);
|
---|
3224 | if (hwndC) {
|
---|
3225 | HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR);
|
---|
3226 | sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);
|
---|
3227 | RestorePresParams(hwndCnr, szKey);
|
---|
3228 | dcd = WinQueryWindowPtr(hwndCnr, QWL_USER);
|
---|
3229 | if (dcd) {
|
---|
3230 | dcd->detailslongname = localdcd.detailslongname;
|
---|
3231 | dcd->detailssubject = localdcd.detailssubject ;
|
---|
3232 | dcd->detailsattr = localdcd.detailsattr ;
|
---|
3233 | dcd->detailsea = localdcd.detailsea ;
|
---|
3234 | dcd->detailssize = localdcd.detailssize ;
|
---|
3235 | dcd->detailsicon = localdcd.detailsicon ;
|
---|
3236 | dcd->detailscrdate = localdcd.detailscrdate ;
|
---|
3237 | dcd->detailscrtime = localdcd.detailscrtime ;
|
---|
3238 | dcd->detailsladate = localdcd.detailsladate ;
|
---|
3239 | dcd->detailslatime = localdcd.detailslatime ;
|
---|
3240 | dcd->detailslwdate = localdcd.detailslwdate ;
|
---|
3241 | dcd->detailslwtime = localdcd.detailslwtime ;
|
---|
3242 | size = sizeof(INT);
|
---|
3243 | sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x);
|
---|
3244 | if (PrfQueryProfileData(fmprof,
|
---|
3245 | FM3Str,
|
---|
3246 | szKey,
|
---|
3247 | (PVOID) & dcd->sortFlags,
|
---|
3248 | &size) && size == sizeof(INT)) {
|
---|
3249 | if (!dcd->sortFlags)
|
---|
3250 | dcd->sortFlags = SORT_PATHNAME;
|
---|
3251 | }
|
---|
3252 | if (fDeleteState)
|
---|
3253 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3254 | size = sizeof(MASK);
|
---|
3255 | sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x);
|
---|
3256 | if (PrfQueryProfileData(fmprof,
|
---|
3257 | FM3Str,
|
---|
3258 | szKey,
|
---|
3259 | (PVOID) & dcd->mask, &size) && size) {
|
---|
3260 | if (*dcd->mask.szMask)
|
---|
3261 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
3262 | UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
|
---|
3263 | }
|
---|
3264 | *(dcd->mask.prompt) = 0;
|
---|
3265 | if (fDeleteState)
|
---|
3266 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3267 | size = sizeof(ULONG);
|
---|
3268 | sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x);
|
---|
3269 | if (!noview) {
|
---|
3270 | if (PrfQueryProfileData(fmprof,
|
---|
3271 | FM3Str,
|
---|
3272 | szKey,
|
---|
3273 | (PVOID) & dcd->flWindowAttr,
|
---|
3274 | &size) && size == sizeof(ULONG)) {
|
---|
3275 |
|
---|
3276 | CNRINFO cnri;
|
---|
3277 |
|
---|
3278 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
3279 | cnri.cb = sizeof(CNRINFO);
|
---|
3280 | if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
3281 | CM_QUERYCNRINFO,
|
---|
3282 | MPFROMP(&cnri),
|
---|
3283 | MPFROMLONG(sizeof(CNRINFO)))) {
|
---|
3284 | cnri.flWindowAttr = dcd->flWindowAttr;
|
---|
3285 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
3286 | CM_SETCNRINFO,
|
---|
3287 | MPFROMP(&cnri),
|
---|
3288 | MPFROMLONG(CMA_FLWINDOWATTR));
|
---|
3289 | }
|
---|
3290 | }
|
---|
3291 | }
|
---|
3292 | if (fDeleteState)
|
---|
3293 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
3294 | if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL))
|
---|
3295 | WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL);
|
---|
3296 | }
|
---|
3297 | }
|
---|
3298 | fRestored = TRUE;
|
---|
3299 | swp.hwnd = hwndDir;
|
---|
3300 | TransformSwp(&swp, xtrans, ytrans);
|
---|
3301 | if (!fAutoTile && !(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
3302 | WinSetWindowPos(hwndDir,
|
---|
3303 | HWND_TOP,
|
---|
3304 | swp.x,
|
---|
3305 | swp.y,
|
---|
3306 | swp.cx,
|
---|
3307 | swp.cy,
|
---|
3308 | swp.fl | SWP_MOVE |
|
---|
3309 | SWP_SIZE | SWP_SHOW | SWP_ZORDER |
|
---|
3310 | SWP_ACTIVATE);
|
---|
3311 | else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
---|
3312 | WinSetWindowPos(hwndDir,
|
---|
3313 | HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);
|
---|
3314 | WinSetWindowUShort(hwndDir, QWS_XRESTORE, (USHORT) swp.x);
|
---|
3315 | WinSetWindowUShort(hwndDir, QWS_CXRESTORE, (USHORT) swp.cx);
|
---|
3316 | WinSetWindowUShort(hwndDir, QWS_YRESTORE, (USHORT) swp.y);
|
---|
3317 | WinSetWindowUShort(hwndDir, QWS_CYRESTORE, (USHORT) swp.cy);
|
---|
3318 | }
|
---|
3319 | else
|
---|
3320 | WinSetWindowPos(hwndDir,
|
---|
3321 | HWND_BOTTOM,
|
---|
3322 | 0, 0, 0, 0, SWP_ZORDER | SWP_ACTIVATE);
|
---|
3323 | }
|
---|
3324 | }
|
---|
3325 | }
|
---|
3326 | } // for
|
---|
3327 | }
|
---|
3328 | return fRestored;
|
---|
3329 | }
|
---|
3330 |
|
---|
3331 | static ULONG CountChildren(HWND hwndClient, ULONG * ulNumMinChildren)
|
---|
3332 | {
|
---|
3333 | HENUM henum;
|
---|
3334 | HWND hwndChild;
|
---|
3335 | SWP swp;
|
---|
3336 | register ULONG ulCnt = 0L;
|
---|
3337 | USHORT id;
|
---|
3338 |
|
---|
3339 | if (ulNumMinChildren)
|
---|
3340 | *ulNumMinChildren = 0L;
|
---|
3341 | henum = WinBeginEnumWindows(hwndClient);
|
---|
3342 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
3343 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
---|
3344 | if (!id || (!fFreeTree && id == TREE_FRAME))
|
---|
3345 | continue;
|
---|
3346 | ulCnt++;
|
---|
3347 | if (ulNumMinChildren) {
|
---|
3348 | if (WinQueryWindowPos(hwndChild, &swp) && (swp.fl & SWP_MINIMIZE))
|
---|
3349 | (*ulNumMinChildren)++;
|
---|
3350 | }
|
---|
3351 | }
|
---|
3352 | WinEndEnumWindows(henum);
|
---|
3353 | return ulCnt;
|
---|
3354 | }
|
---|
3355 |
|
---|
3356 | VOID GetNextWindowPos(HWND hwndClient, PSWP pswp, ULONG * ulCntR,
|
---|
3357 | ULONG * ulNumMinChildrenR)
|
---|
3358 | {
|
---|
3359 | register ULONG ulCnt;
|
---|
3360 | ULONG ulNumMinChildren;
|
---|
3361 | RECTL Rectl;
|
---|
3362 | register ULONG ulXDiff, ulYDiff, ulWindowsPerStack;
|
---|
3363 |
|
---|
3364 | if (!ulCntR || !ulNumMinChildrenR)
|
---|
3365 | ulCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
---|
3366 | else {
|
---|
3367 | ulCnt = *ulCntR;
|
---|
3368 | ulNumMinChildren = *ulNumMinChildrenR;
|
---|
3369 | if (ulCnt == (ULONG) - 1) {
|
---|
3370 | ulCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
---|
3371 | /* return these values to the caller for later use */
|
---|
3372 | *ulCntR = ulCnt;
|
---|
3373 | *ulNumMinChildrenR = ulNumMinChildren;
|
---|
3374 | }
|
---|
3375 | }
|
---|
3376 | WinQueryWindowRect(hwndClient, &Rectl);
|
---|
3377 | AdjustSizeOfClient(NULL, &Rectl);
|
---|
3378 | if (!fFreeTree) {
|
---|
3379 |
|
---|
3380 | SWP swp;
|
---|
3381 |
|
---|
3382 | WinQueryWindowPos(hwndTree, &swp);
|
---|
3383 | if (ulNumMinChildren || (swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
3384 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
3385 | }
|
---|
3386 | else if (ulNumMinChildren)
|
---|
3387 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
3388 |
|
---|
3389 | ulXDiff = WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER) +
|
---|
3390 | WinQuerySysValue(HWND_DESKTOP, SV_CXMINMAXBUTTON) / 2;
|
---|
3391 | ulYDiff = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER) +
|
---|
3392 | WinQuerySysValue(HWND_DESKTOP, SV_CYMINMAXBUTTON);
|
---|
3393 | ulWindowsPerStack = (Rectl.yTop - Rectl.yBottom) / (3 * ulYDiff);
|
---|
3394 | pswp->cx = Rectl.xRight - (ulWindowsPerStack * ulXDiff);
|
---|
3395 | pswp->cy = (Rectl.yTop - Rectl.yBottom) - (ulWindowsPerStack * ulYDiff);
|
---|
3396 | ulWindowsPerStack++;
|
---|
3397 | pswp->x = Rectl.xLeft + ((ulCnt % ulWindowsPerStack) * ulXDiff);
|
---|
3398 | pswp->y = (Rectl.yTop - pswp->cy - ((ulCnt % ulWindowsPerStack) * ulYDiff));
|
---|
3399 | }
|
---|
3400 |
|
---|
3401 | static VOID CascadeChildren(HWND hwndClient)
|
---|
3402 | {
|
---|
3403 | ULONG ulCnt = 0L, ulNumMinChildren;
|
---|
3404 | HWND hwndChild;
|
---|
3405 | HENUM henum;
|
---|
3406 | SWP swp;
|
---|
3407 | USHORT id;
|
---|
3408 | RECTL Rectl;
|
---|
3409 |
|
---|
3410 | WinQueryWindowPos(hwndClient, &swp);
|
---|
3411 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
3412 | return;
|
---|
3413 |
|
---|
3414 | CountChildren(hwndClient, &ulNumMinChildren);
|
---|
3415 | if (!fFreeTree) {
|
---|
3416 | WinQueryWindowRect(hwndClient, &Rectl);
|
---|
3417 | AdjustSizeOfClient(NULL, &Rectl);
|
---|
3418 | WinQueryWindowPos(hwndTree, &swp);
|
---|
3419 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
3420 | if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
|
---|
3421 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
---|
3422 | if (swp.x != 0)
|
---|
3423 | swp.x = 0;
|
---|
3424 | if (swp.y < 0)
|
---|
3425 | swp.y = 0;
|
---|
3426 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
---|
3427 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
---|
3428 | WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
3429 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
3430 | }
|
---|
3431 | }
|
---|
3432 | henum = WinBeginEnumWindows(hwndClient);
|
---|
3433 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
3434 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
---|
3435 | if (!id || (!fFreeTree && id == TREE_FRAME))
|
---|
3436 | continue;
|
---|
3437 | WinQueryWindowPos(hwndChild, &swp);
|
---|
3438 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE))) {
|
---|
3439 | GetNextWindowPos(hwndClient, &swp, &ulCnt, &ulNumMinChildren);
|
---|
3440 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
3441 | SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE |
|
---|
3442 | SWP_ZORDER | SWP_ACTIVATE);
|
---|
3443 | ulCnt++;
|
---|
3444 | }
|
---|
3445 | }
|
---|
3446 | WinEndEnumWindows(henum);
|
---|
3447 | }
|
---|
3448 |
|
---|
3449 | VOID TileChildren(HWND hwndClient, BOOL absolute)
|
---|
3450 | {
|
---|
3451 | register ULONG ulChildCnt, ulSquare, ulNumRows, ulNumCols, ulExtraCols,
|
---|
3452 | ulWidth, ulHeight;
|
---|
3453 | ULONG ulNumMinChildren;
|
---|
3454 | RECTL Rectl;
|
---|
3455 | HWND hwndChild;
|
---|
3456 |
|
---|
3457 | if (fNoTileUpdate || hwndClient == HWND_DESKTOP)
|
---|
3458 | return;
|
---|
3459 | {
|
---|
3460 | SWP swp;
|
---|
3461 |
|
---|
3462 | WinQueryWindowPos(hwndClient, &swp);
|
---|
3463 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
3464 | return;
|
---|
3465 | }
|
---|
3466 | ulChildCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
---|
3467 | ulChildCnt -= ulNumMinChildren;
|
---|
3468 | if (!ulChildCnt)
|
---|
3469 | return;
|
---|
3470 |
|
---|
3471 | fNoTileUpdate = TRUE;
|
---|
3472 |
|
---|
3473 | for (ulSquare = 2; ulSquare * ulSquare <= ulChildCnt; ulSquare++) {
|
---|
3474 | ;
|
---|
3475 | }
|
---|
3476 | if (!fTileBackwards) {
|
---|
3477 | ulNumCols = ulSquare - 1;
|
---|
3478 | ulNumRows = ulChildCnt / ulNumCols;
|
---|
3479 | }
|
---|
3480 | else {
|
---|
3481 | ulNumRows = ulSquare - 1;
|
---|
3482 | ulNumCols = ulChildCnt / ulNumRows;
|
---|
3483 | }
|
---|
3484 | ulExtraCols = ulChildCnt % ulNumCols;
|
---|
3485 |
|
---|
3486 | WinQueryWindowRect(hwndClient, &Rectl);
|
---|
3487 |
|
---|
3488 | if (!fFreeTree) {
|
---|
3489 |
|
---|
3490 | SWP swp;
|
---|
3491 |
|
---|
3492 | WinQueryWindowPos(hwndTree, &swp);
|
---|
3493 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
3494 | if (swp.y < 0)
|
---|
3495 | swp.y = 0;
|
---|
3496 | if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
|
---|
3497 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
---|
3498 | if (swp.x != 0)
|
---|
3499 | swp.x = 0;
|
---|
3500 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
---|
3501 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
---|
3502 | WinSetWindowPos(hwndTree,
|
---|
3503 | HWND_TOP,
|
---|
3504 | swp.x,
|
---|
3505 | swp.y,
|
---|
3506 | swp.cx,
|
---|
3507 | swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
3508 | WinQueryWindowPos(hwndTree, &swp);
|
---|
3509 | }
|
---|
3510 | if (ulNumMinChildren || (swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
3511 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
3512 | }
|
---|
3513 | else if (ulNumMinChildren)
|
---|
3514 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
3515 |
|
---|
3516 | AdjustSizeOfClient(NULL, &Rectl);
|
---|
3517 |
|
---|
3518 | if (Rectl.xRight > 0L && (Rectl.yBottom < Rectl.yTop)) {
|
---|
3519 |
|
---|
3520 | HENUM henum;
|
---|
3521 |
|
---|
3522 | henum = WinBeginEnumWindows(hwndClient);
|
---|
3523 | if ((hwndChild = WinGetNextWindow(henum)) != (HWND) 0) {
|
---|
3524 |
|
---|
3525 | ULONG ulCurRow, ulCurCol;
|
---|
3526 | SWP swp;
|
---|
3527 | USHORT id;
|
---|
3528 |
|
---|
3529 | ulHeight = (Rectl.yTop - Rectl.yBottom) / ulNumRows;
|
---|
3530 |
|
---|
3531 | for (ulCurRow = 0; ulCurRow < ulNumRows; ulCurRow++) {
|
---|
3532 | if ((ulNumRows - ulCurRow) <= ulExtraCols)
|
---|
3533 | ulNumCols++;
|
---|
3534 | for (ulCurCol = 0; ulCurCol < ulNumCols; ulCurCol++) {
|
---|
3535 | ulWidth = Rectl.xRight / ulNumCols;
|
---|
3536 |
|
---|
3537 | while (hwndChild) {
|
---|
3538 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
---|
3539 | if (id && (id != TREE_FRAME || fFreeTree)) {
|
---|
3540 | WinQueryWindowPos(hwndChild, &swp);
|
---|
3541 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
3542 | break;
|
---|
3543 | }
|
---|
3544 | hwndChild = WinGetNextWindow(henum);
|
---|
3545 | }
|
---|
3546 |
|
---|
3547 | if (hwndChild) {
|
---|
3548 | if (!absolute && (swp.fl & SWP_MAXIMIZE)) {
|
---|
3549 | WinGetMaxPosition(hwndChild, &swp);
|
---|
3550 | WinSetWindowPos(hwndChild,
|
---|
3551 | HWND_TOP,
|
---|
3552 | swp.x,
|
---|
3553 | swp.y,
|
---|
3554 | swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
---|
3555 | WinSetWindowUShort(hwndChild,
|
---|
3556 | QWS_XRESTORE,
|
---|
3557 | (USHORT) (ulWidth * ulCurCol) + Rectl.xLeft);
|
---|
3558 | WinSetWindowUShort(hwndChild,
|
---|
3559 | QWS_YRESTORE,
|
---|
3560 | (USHORT) (Rectl.yTop -
|
---|
3561 | (ulHeight * (ulCurRow + 1))));
|
---|
3562 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth);
|
---|
3563 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight);
|
---|
3564 | }
|
---|
3565 | else
|
---|
3566 | WinSetWindowPos(hwndChild,
|
---|
3567 | HWND_TOP,
|
---|
3568 | (ulWidth * ulCurCol) + Rectl.xLeft,
|
---|
3569 | Rectl.yTop - (ulHeight * (ulCurRow + 1)),
|
---|
3570 | ulWidth,
|
---|
3571 | ulHeight,
|
---|
3572 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
3573 | hwndChild = WinGetNextWindow(henum);
|
---|
3574 | }
|
---|
3575 | }
|
---|
3576 | if ((ulNumRows - ulCurRow) <= ulExtraCols) {
|
---|
3577 | ulNumCols--;
|
---|
3578 | ulExtraCols--;
|
---|
3579 | }
|
---|
3580 | }
|
---|
3581 | }
|
---|
3582 | WinEndEnumWindows(henum);
|
---|
3583 | }
|
---|
3584 |
|
---|
3585 | fNoTileUpdate = FALSE;
|
---|
3586 | }
|
---|
3587 |
|
---|
3588 | static VOID ResizeChildren(HWND hwndClient, SHORT oldcx, SHORT oldcy,
|
---|
3589 | SHORT newcx, SHORT newcy)
|
---|
3590 | {
|
---|
3591 | /*
|
---|
3592 | * resize all children of the client to maintain their proportional
|
---|
3593 | * sizes and positions
|
---|
3594 | */
|
---|
3595 |
|
---|
3596 | if (!newcx || !newcy || !oldcx || !oldcy)
|
---|
3597 | return;
|
---|
3598 | {
|
---|
3599 | HENUM henum;
|
---|
3600 | HWND hwndChild;
|
---|
3601 | register LONG x, y, cx, cy, ucx, ucy, ux, uy;
|
---|
3602 | SWP swp;
|
---|
3603 |
|
---|
3604 | henum = WinBeginEnumWindows(hwndClient);
|
---|
3605 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
3606 | if (!WinQueryWindowUShort(hwndChild, QWS_ID))
|
---|
3607 | continue;
|
---|
3608 | if (WinQueryWindowPos(hwndChild, &swp)) {
|
---|
3609 | if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {
|
---|
3610 | swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);
|
---|
3611 | swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);
|
---|
3612 | swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);
|
---|
3613 | swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);
|
---|
3614 | }
|
---|
3615 | else if (swp.fl & SWP_MAXIMIZE) {
|
---|
3616 | swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);
|
---|
3617 | swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);
|
---|
3618 | swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);
|
---|
3619 | swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);
|
---|
3620 | }
|
---|
3621 | cx = (swp.cx) ? (LONG) (((double)oldcx * 100.0) / (double)swp.cx) : 0;
|
---|
3622 | cy = (swp.cy) ? (LONG) (((double)oldcy * 100.0) / (double)swp.cy) : 0;
|
---|
3623 | x = (swp.x) ? (LONG) (((double)oldcx * 100.0) / (double)swp.x) : 0;
|
---|
3624 | y = (swp.y) ? (LONG) (((double)oldcy * 100.0) / (double)swp.y) : 0;
|
---|
3625 | if (x < 0)
|
---|
3626 | x = 0;
|
---|
3627 | if (y < 0)
|
---|
3628 | y = 0;
|
---|
3629 | ux = (x) ? (LONG) (((double)newcx * 100.0) / (double)x) : 0;
|
---|
3630 | uy = (y) ? (LONG) (((double)newcy * 100.0) / (double)y) : 0;
|
---|
3631 | ucx = (cx) ? (LONG) (((double)newcx * 100.0) / (double)cx) : 0;
|
---|
3632 | ucy = (cy) ? (LONG) (((double)newcy * 100.0) / (double)cy) : 0;
|
---|
3633 | if (ux + ucx > newcx)
|
---|
3634 | ucx = newcx - ux;
|
---|
3635 | if (uy + ucy > newcy)
|
---|
3636 | ucy = newcy - uy;
|
---|
3637 |
|
---|
3638 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)))
|
---|
3639 | WinSetWindowPos(hwndChild, HWND_TOP, ux, uy, ucx, ucy,
|
---|
3640 | SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
---|
3641 | else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
---|
3642 | WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1);
|
---|
3643 | WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);
|
---|
3644 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,
|
---|
3645 | SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE);
|
---|
3646 | WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);
|
---|
3647 | WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);
|
---|
3648 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);
|
---|
3649 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);
|
---|
3650 | }
|
---|
3651 | else {
|
---|
3652 | WinGetMaxPosition(hwndChild, &swp);
|
---|
3653 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
3654 | SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
---|
3655 | WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);
|
---|
3656 | WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);
|
---|
3657 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);
|
---|
3658 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);
|
---|
3659 | }
|
---|
3660 | }
|
---|
3661 | }
|
---|
3662 | WinEndEnumWindows(henum);
|
---|
3663 | }
|
---|
3664 | if (!fFreeTree) {
|
---|
3665 |
|
---|
3666 | RECTL Rectl;
|
---|
3667 | SWP swp;
|
---|
3668 |
|
---|
3669 | WinQueryWindowRect(hwndClient, &Rectl);
|
---|
3670 | AdjustSizeOfClient(NULL, &Rectl);
|
---|
3671 | WinQueryWindowPos(hwndTree, &swp);
|
---|
3672 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
3673 |
|
---|
3674 | if (!fNoTreeGap) {
|
---|
3675 | INT height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
3676 | if (swp.y < height)
|
---|
3677 | swp.y = height; // Force bottom to position
|
---|
3678 | }
|
---|
3679 | else
|
---|
3680 | swp.y = 0; // Force bottom to position
|
---|
3681 |
|
---|
3682 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
---|
3683 | if (swp.cy < 0)
|
---|
3684 | swp.cy = 0;
|
---|
3685 |
|
---|
3686 | if (swp.x != 0)
|
---|
3687 | swp.x = 0; // Left align
|
---|
3688 |
|
---|
3689 | // AdjustSizeOfClient can return bogus xRight values - fixme someday
|
---|
3690 | if (Rectl.xRight >= Rectl.xLeft) {
|
---|
3691 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
---|
3692 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
---|
3693 | }
|
---|
3694 | WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
3695 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
3696 | }
|
---|
3697 | }
|
---|
3698 | }
|
---|
3699 |
|
---|
3700 | static VOID MinResChildren(HWND hwndClient, ULONG cmd)
|
---|
3701 | {
|
---|
3702 | HENUM henum;
|
---|
3703 | HWND hwndChild;
|
---|
3704 |
|
---|
3705 | {
|
---|
3706 | SWP swp;
|
---|
3707 |
|
---|
3708 | WinQueryWindowPos(hwndClient, &swp);
|
---|
3709 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
3710 | return;
|
---|
3711 | }
|
---|
3712 | henum = WinBeginEnumWindows(hwndClient);
|
---|
3713 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
3714 | if (!WinQueryWindowUShort(hwndChild, QWS_ID))
|
---|
3715 | continue;
|
---|
3716 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, cmd);
|
---|
3717 | }
|
---|
3718 | }
|
---|
3719 |
|
---|
3720 | //=== ChildFrameButtonProc: subclass handler for WALKBUTTON and QUICKBUTTON windows ===
|
---|
3721 |
|
---|
3722 | static MRESULT EXPENTRY ChildFrameButtonProc(HWND hwnd,
|
---|
3723 | ULONG msg,
|
---|
3724 | MPARAM mp1, MPARAM mp2)
|
---|
3725 | {
|
---|
3726 | USHORT id;
|
---|
3727 | static BOOL emphasized = FALSE;
|
---|
3728 |
|
---|
3729 | switch (msg) {
|
---|
3730 | case WM_BUTTON1CLICK:
|
---|
3731 | case WM_CHORD:
|
---|
3732 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
3733 | break;
|
---|
3734 |
|
---|
3735 | case WM_MOUSEMOVE:
|
---|
3736 | if (fOtherHelp) {
|
---|
3737 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
---|
3738 | && !WinQueryCapture(HWND_DESKTOP)) {
|
---|
3739 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
3740 | switch (id) {
|
---|
3741 | case IDM_OPENWALK:
|
---|
3742 | MakeBubble(hwnd, FALSE, GetPString(IDS_WALKBUTTONHELP));
|
---|
3743 | break;
|
---|
3744 | case IDM_USERLIST:
|
---|
3745 | MakeBubble(hwnd, FALSE, GetPString(IDS_QUICKBUTTONHELP));
|
---|
3746 | break;
|
---|
3747 | }
|
---|
3748 | }
|
---|
3749 | }
|
---|
3750 | break;
|
---|
3751 |
|
---|
3752 | case WM_BUTTON3CLICK:
|
---|
3753 | case WM_BUTTON2CLICK:
|
---|
3754 | {
|
---|
3755 | USHORT cmd = 0;
|
---|
3756 |
|
---|
3757 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
3758 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
3759 | switch (id) {
|
---|
3760 | case IDM_OPENWALK:
|
---|
3761 | switch (msg) {
|
---|
3762 | case WM_BUTTON2CLICK:
|
---|
3763 | if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
|
---|
3764 | (KC_ALT | KC_SHIFT | KC_CTRL))
|
---|
3765 | cmd = IDM_GREP;
|
---|
3766 | else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))
|
---|
3767 | CascadeChildren(hwndMain);
|
---|
3768 |
|
---|
3769 | #ifdef NEVER
|
---|
3770 | else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))
|
---|
3771 | cmd = IDM_SYSINFO;
|
---|
3772 | #endif
|
---|
3773 |
|
---|
3774 | else if (shiftstate & KC_SHIFT)
|
---|
3775 | cmd = IDM_WINDOWDLG;
|
---|
3776 | else if (shiftstate & KC_CTRL)
|
---|
3777 | cmd = IDM_SEEALL;
|
---|
3778 | else if (shiftstate & KC_ALT)
|
---|
3779 | TileChildren(hwndMain, TRUE);
|
---|
3780 | else
|
---|
3781 | cmd = IDM_WALKDIR;
|
---|
3782 | break;
|
---|
3783 | case WM_BUTTON3CLICK:
|
---|
3784 | TileChildren(hwndMain, TRUE);
|
---|
3785 | break;
|
---|
3786 | }
|
---|
3787 | break;
|
---|
3788 | case IDM_USERLIST:
|
---|
3789 | switch (msg) {
|
---|
3790 | case WM_BUTTON2CLICK:
|
---|
3791 | if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
|
---|
3792 | (KC_ALT | KC_SHIFT | KC_CTRL))
|
---|
3793 | cmd = IDM_COLORPALETTE;
|
---|
3794 | else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))
|
---|
3795 | cmd = IDM_HIDEMENU;
|
---|
3796 | else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))
|
---|
3797 | cmd = IDM_NOTEBOOK;
|
---|
3798 | else if (shiftstate & KC_SHIFT)
|
---|
3799 | cmd = IDM_TOOLTITLES;
|
---|
3800 | else if (shiftstate & KC_CTRL)
|
---|
3801 | cmd = IDM_TEXTTOOLS;
|
---|
3802 | else if (shiftstate & KC_ALT)
|
---|
3803 | cmd = IDM_FONTPALETTE;
|
---|
3804 | else
|
---|
3805 | cmd = IDM_TOOLBAR;
|
---|
3806 | break;
|
---|
3807 | case WM_BUTTON3CLICK:
|
---|
3808 | cmd = IDM_DRIVEBAR;
|
---|
3809 | break;
|
---|
3810 | }
|
---|
3811 | break;
|
---|
3812 | } // switch id
|
---|
3813 |
|
---|
3814 | if (cmd) {
|
---|
3815 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_CLIENT),
|
---|
3816 | WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
|
---|
3817 | }
|
---|
3818 | }
|
---|
3819 | break;
|
---|
3820 |
|
---|
3821 | case DM_DRAGOVER:
|
---|
3822 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
3823 | if (id == IDM_OPENWALK) {
|
---|
3824 | if (!emphasized) {
|
---|
3825 | emphasized = TRUE;
|
---|
3826 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
3827 | }
|
---|
3828 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
---|
3829 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
---|
3830 | }
|
---|
3831 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
---|
3832 |
|
---|
3833 | case DM_DRAGLEAVE:
|
---|
3834 | if (emphasized) {
|
---|
3835 | emphasized = FALSE;
|
---|
3836 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
3837 | }
|
---|
3838 | break;
|
---|
3839 |
|
---|
3840 | case DM_DROPHELP:
|
---|
3841 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_OPENDROPHELP));
|
---|
3842 | return 0;
|
---|
3843 |
|
---|
3844 | case DM_DROP:
|
---|
3845 | {
|
---|
3846 | char szFrom[CCHMAXPATH + 2];
|
---|
3847 |
|
---|
3848 | if (emphasized) {
|
---|
3849 | emphasized = FALSE;
|
---|
3850 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
3851 | }
|
---|
3852 | if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
|
---|
3853 | if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) {
|
---|
3854 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom);
|
---|
3855 | }
|
---|
3856 | }
|
---|
3857 | }
|
---|
3858 | return 0;
|
---|
3859 |
|
---|
3860 | case WM_CLOSE:
|
---|
3861 | WinDestroyWindow(hwnd);
|
---|
3862 | return 0;
|
---|
3863 | }
|
---|
3864 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
3865 | }
|
---|
3866 |
|
---|
3867 | static MRESULT EXPENTRY MainFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
3868 | MPARAM mp2)
|
---|
3869 | {
|
---|
3870 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
3871 | static ULONG aheight = 0L;
|
---|
3872 |
|
---|
3873 | switch (msg) {
|
---|
3874 | case WM_ADJUSTWINDOWPOS:
|
---|
3875 | {
|
---|
3876 | SWP *pswp;
|
---|
3877 |
|
---|
3878 | pswp = (SWP *) mp1;
|
---|
3879 | if (fDataMin && !fAmClosing) {
|
---|
3880 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
---|
3881 |
|
---|
3882 | SWP swp;
|
---|
3883 |
|
---|
3884 | WinQueryWindowPos(hwnd, &swp);
|
---|
3885 | PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID);
|
---|
3886 | HideNote();
|
---|
3887 | }
|
---|
3888 | else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) {
|
---|
3889 | if (DataHwnd)
|
---|
3890 | PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
3891 | }
|
---|
3892 | }
|
---|
3893 | if (!fAmClosing) {
|
---|
3894 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
3895 | HideNote();
|
---|
3896 | }
|
---|
3897 | }
|
---|
3898 | break;
|
---|
3899 |
|
---|
3900 | case UM_FOCUSME:
|
---|
3901 | CreateDataBar(HWND_DESKTOP, (ULONG) mp1);
|
---|
3902 | return 0;
|
---|
3903 |
|
---|
3904 | case WM_BUTTON1UP:
|
---|
3905 | case WM_BUTTON2UP:
|
---|
3906 | case WM_BUTTON3UP:
|
---|
3907 | case WM_MOUSEMOVE:
|
---|
3908 | case WM_CHORD:
|
---|
3909 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
3910 | break;
|
---|
3911 |
|
---|
3912 | case WM_CHAR:
|
---|
3913 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
3914 | break;
|
---|
3915 |
|
---|
3916 | case WM_CONTROL:
|
---|
3917 | return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_CONTROL, mp1,
|
---|
3918 | mp2);
|
---|
3919 |
|
---|
3920 | case WM_COMMAND:
|
---|
3921 | return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
|
---|
3922 |
|
---|
3923 | case WM_CALCFRAMERECT:
|
---|
3924 | {
|
---|
3925 | MRESULT mr;
|
---|
3926 | PRECTL prectl;
|
---|
3927 | LONG sheight = 20, bheight = 20;
|
---|
3928 |
|
---|
3929 | mr = oldproc(hwnd, msg, mp1, mp2);
|
---|
3930 |
|
---|
3931 | /*
|
---|
3932 | * Calculate the position of the client rectangle.
|
---|
3933 | * Otherwise, we'll see a lot of redraw when we move the
|
---|
3934 | * client during WM_FORMATFRAME.
|
---|
3935 | */
|
---|
3936 |
|
---|
3937 | if (mr && mp2) {
|
---|
3938 | prectl = (PRECTL) mp1;
|
---|
3939 | if (prectl->yBottom != prectl->yTop) {
|
---|
3940 | {
|
---|
3941 | HPS hps;
|
---|
3942 | POINTL aptl[TXTBOX_COUNT];
|
---|
3943 |
|
---|
3944 | hps = WinGetPS(hwndStatus);
|
---|
3945 | if (hps) {
|
---|
3946 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
3947 | bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
3948 | WinReleasePS(hps);
|
---|
3949 | }
|
---|
3950 | }
|
---|
3951 | prectl->yBottom += (sheight + 4);
|
---|
3952 | prectl->yTop -= (sheight + 4);
|
---|
3953 | if (fMoreButtons) {
|
---|
3954 |
|
---|
3955 | HPS hps;
|
---|
3956 | POINTL aptl[TXTBOX_COUNT];
|
---|
3957 |
|
---|
3958 | hps = WinGetPS(hwndName);
|
---|
3959 | if (hps) {
|
---|
3960 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
3961 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
3962 | WinReleasePS(hps);
|
---|
3963 | }
|
---|
3964 | prectl->yBottom += (bheight + 4);
|
---|
3965 | prectl->yTop -= (bheight + 4);
|
---|
3966 | }
|
---|
3967 | if (fToolbar) {
|
---|
3968 | if (!fTextTools)
|
---|
3969 | prectl->yTop -= ((fToolTitles) ? 50 : 40);
|
---|
3970 | else
|
---|
3971 | prectl->yTop -= 32;
|
---|
3972 | }
|
---|
3973 | if (fDrivebar) {
|
---|
3974 | ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES),
|
---|
3975 | ((prectl->xRight -
|
---|
3976 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
3977 | SV_CYSIZEBORDER) * 2)) - 4));
|
---|
3978 | prectl->yTop -= (16 * (DriveLines * 18));
|
---|
3979 | }
|
---|
3980 | if (fUserComboBox) {
|
---|
3981 | if (!aheight) {
|
---|
3982 |
|
---|
3983 | SWP swpTemp;
|
---|
3984 |
|
---|
3985 | WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
3986 | &swpTemp);
|
---|
3987 | aheight = swpTemp.cy;
|
---|
3988 | }
|
---|
3989 | prectl->yTop -= (aheight + 6L);
|
---|
3990 | }
|
---|
3991 | if (fAutoView) {
|
---|
3992 | AutoviewHeight = min(AutoviewHeight,
|
---|
3993 | (prectl->yTop - prectl->yBottom) - 116);
|
---|
3994 | AutoviewHeight = max(AutoviewHeight, 36);
|
---|
3995 | prectl->yBottom += (AutoviewHeight + 6);
|
---|
3996 | }
|
---|
3997 | }
|
---|
3998 | }
|
---|
3999 | return mr;
|
---|
4000 | }
|
---|
4001 |
|
---|
4002 | case WM_FORMATFRAME:
|
---|
4003 | {
|
---|
4004 | SHORT sCount, soldCount;
|
---|
4005 | PSWP pswp, pswpClient, pswpNew;
|
---|
4006 | SWP swpClient;
|
---|
4007 | LONG theight = 48L, dheight = 20L, width, sheight = 20, bheight = 20;
|
---|
4008 |
|
---|
4009 | sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
|
---|
4010 | soldCount = sCount;
|
---|
4011 |
|
---|
4012 | /*
|
---|
4013 | * Reformat the frame to "squeeze" the client
|
---|
4014 | * and make room for status window sibling beneath
|
---|
4015 | * and toolbar above (if toolbar's on) and userlists
|
---|
4016 | * (if userlists are on).
|
---|
4017 | */
|
---|
4018 |
|
---|
4019 | pswp = (PSWP) mp1;
|
---|
4020 | {
|
---|
4021 | SHORT x;
|
---|
4022 |
|
---|
4023 | for (x = 0; x < soldCount; x++) {
|
---|
4024 | if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {
|
---|
4025 | pswpClient = pswp;
|
---|
4026 | break;
|
---|
4027 | }
|
---|
4028 | pswp++;
|
---|
4029 | }
|
---|
4030 | }
|
---|
4031 |
|
---|
4032 | {
|
---|
4033 | HPS hps;
|
---|
4034 | POINTL aptl[TXTBOX_COUNT];
|
---|
4035 |
|
---|
4036 | hps = WinGetPS(hwndStatus);
|
---|
4037 | if (hps) {
|
---|
4038 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
4039 | bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
4040 | WinReleasePS(hps);
|
---|
4041 | }
|
---|
4042 | if (fMoreButtons) {
|
---|
4043 | hps = WinGetPS(hwndName);
|
---|
4044 | if (hps) {
|
---|
4045 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
4046 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
4047 | WinReleasePS(hps);
|
---|
4048 | }
|
---|
4049 | }
|
---|
4050 | }
|
---|
4051 | pswpNew = (PSWP) mp1 + soldCount;
|
---|
4052 | *pswpNew = *pswpClient;
|
---|
4053 | swpClient = *pswpClient;
|
---|
4054 | pswpNew->hwnd = hwndStatus;
|
---|
4055 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
4056 | pswpNew->x = swpClient.x + 3;
|
---|
4057 | pswpNew->y = swpClient.y + 2;
|
---|
4058 | if (!fSplitStatus)
|
---|
4059 | width = swpClient.cx - (16 + (sheight * 2) + 4);
|
---|
4060 | else
|
---|
4061 | width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2;
|
---|
4062 | width = max(width, 10);
|
---|
4063 | if (fSplitStatus)
|
---|
4064 | pswpNew->cx = width - 6;
|
---|
4065 | else
|
---|
4066 | pswpNew->cx = width - 8;
|
---|
4067 | pswpNew->cy = sheight;
|
---|
4068 | pswpClient->y = pswpNew->y + pswpNew->cy + 3;
|
---|
4069 | pswpClient->cy = (swpClient.cy - pswpNew->cy) - 3;
|
---|
4070 | sCount++;
|
---|
4071 |
|
---|
4072 | if (fSplitStatus) {
|
---|
4073 | pswpNew = (PSWP) mp1 + (soldCount + 1);
|
---|
4074 | *pswpNew = *pswpClient;
|
---|
4075 | pswpNew->hwnd = hwndStatus2;
|
---|
4076 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
4077 | pswpNew->x = width + 8;
|
---|
4078 | pswpNew->y = swpClient.y + 2;
|
---|
4079 | pswpNew->cx = width - 6;
|
---|
4080 | pswpNew->cy = sheight;
|
---|
4081 | sCount++;
|
---|
4082 | }
|
---|
4083 | else {
|
---|
4084 | WinShowWindow(hwndStatus2, FALSE);
|
---|
4085 | WinSetWindowText(hwndStatus2, NullStr);
|
---|
4086 | }
|
---|
4087 |
|
---|
4088 | if (fToolbar) {
|
---|
4089 | if (fTextTools)
|
---|
4090 | theight = 32L;
|
---|
4091 | else if (!fToolTitles)
|
---|
4092 | theight = 40L;
|
---|
4093 | pswpNew = (PSWP) mp1 + (soldCount + 1 + (fSplitStatus != FALSE));
|
---|
4094 | *pswpNew = *pswpClient;
|
---|
4095 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS);
|
---|
4096 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
4097 | pswpNew->x = swpClient.x + 2;
|
---|
4098 | pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2);
|
---|
4099 | pswpNew->cx = swpClient.cx - 4;
|
---|
4100 | pswpNew->cy = theight - 4;
|
---|
4101 | pswpClient->cy -= theight;
|
---|
4102 | sCount++;
|
---|
4103 | }
|
---|
4104 | else
|
---|
4105 | WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE);
|
---|
4106 |
|
---|
4107 | if (fDrivebar) {
|
---|
4108 | ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4);
|
---|
4109 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
---|
4110 | (fSplitStatus != FALSE) +
|
---|
4111 | (fToolbar != FALSE));
|
---|
4112 | *pswpNew = *pswpClient;
|
---|
4113 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES);
|
---|
4114 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
4115 | pswpNew->x = swpClient.x + 2;
|
---|
4116 | dheight += ((dheight - 2) * DriveLines);
|
---|
4117 | pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);
|
---|
4118 | if (fToolbar)
|
---|
4119 | pswpNew->y -= theight;
|
---|
4120 | pswpNew->cx = swpClient.cx - 4;
|
---|
4121 | pswpNew->cy = dheight - 4;
|
---|
4122 | pswpClient->cy -= dheight;
|
---|
4123 | sCount++;
|
---|
4124 | }
|
---|
4125 | else
|
---|
4126 | WinShowWindow(WinWindowFromID(hwnd, MAIN_DRIVES), FALSE);
|
---|
4127 |
|
---|
4128 | if (fAutoView) {
|
---|
4129 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
---|
4130 | (fToolbar != FALSE) +
|
---|
4131 | (fDrivebar != FALSE) +
|
---|
4132 | (fSplitStatus != FALSE));
|
---|
4133 | *pswpNew = *pswpClient;
|
---|
4134 | pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview;
|
---|
4135 | pswpNew->x = pswpClient->x + 3;
|
---|
4136 | pswpNew->y = pswpClient->y + 3;
|
---|
4137 | if (fMoreButtons)
|
---|
4138 | pswpNew->y += (bheight + 4);
|
---|
4139 | pswpNew->cx = pswpClient->cx - 6;
|
---|
4140 | AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116);
|
---|
4141 | AutoviewHeight = max(AutoviewHeight, 36);
|
---|
4142 | pswpNew->cy = AutoviewHeight;
|
---|
4143 | pswpClient->y += (AutoviewHeight + 6);
|
---|
4144 | pswpClient->cy -= (AutoviewHeight + 6);
|
---|
4145 | sCount++;
|
---|
4146 | WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE);
|
---|
4147 | }
|
---|
4148 | else {
|
---|
4149 | WinShowWindow(hwndAutoview, FALSE);
|
---|
4150 | WinShowWindow(hwndAutoMLE, FALSE);
|
---|
4151 | }
|
---|
4152 |
|
---|
4153 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
---|
4154 | (fToolbar != FALSE) +
|
---|
4155 | (fDrivebar != FALSE) +
|
---|
4156 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
---|
4157 | *pswpNew = *pswpClient;
|
---|
4158 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_OPENWALK);
|
---|
4159 | pswpNew->x = swpClient.cx - ((sheight * 2) + 4);
|
---|
4160 | pswpNew->y = swpClient.y;
|
---|
4161 | pswpNew->cx = sheight + 4;
|
---|
4162 | pswpNew->cy = sheight + 4;
|
---|
4163 | sCount++;
|
---|
4164 | pswpNew = (PSWP) mp1 + (soldCount + 2 +
|
---|
4165 | (fToolbar != FALSE) +
|
---|
4166 | (fDrivebar != FALSE) +
|
---|
4167 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
---|
4168 | *pswpNew = *pswpClient;
|
---|
4169 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_USERLIST);
|
---|
4170 | pswpNew->x = swpClient.cx - (sheight + 2);
|
---|
4171 | pswpNew->y = swpClient.y;
|
---|
4172 | pswpNew->cx = sheight + 4;
|
---|
4173 | pswpNew->cy = sheight + 4;
|
---|
4174 | sCount++;
|
---|
4175 | pswpNew = (PSWP) mp1 + (soldCount + 3 +
|
---|
4176 | (fToolbar != FALSE) +
|
---|
4177 | (fDrivebar != FALSE) +
|
---|
4178 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
---|
4179 | *pswpNew = *pswpClient;
|
---|
4180 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LED);
|
---|
4181 | pswpNew->x = swpClient.cx - ((sheight * 2) + 16);
|
---|
4182 | pswpNew->y = swpClient.y;
|
---|
4183 | pswpNew->cx = 12;
|
---|
4184 | pswpNew->cy = 12;
|
---|
4185 | sCount++;
|
---|
4186 | pswpNew = (PSWP) mp1 + (soldCount + 4 +
|
---|
4187 | (fToolbar != FALSE) +
|
---|
4188 | (fDrivebar != FALSE) +
|
---|
4189 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
---|
4190 | *pswpNew = *pswpClient;
|
---|
4191 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LEDHDR);
|
---|
4192 | pswpNew->x = swpClient.cx - ((sheight * 2) + 16);
|
---|
4193 | pswpNew->y = swpClient.y + 12;
|
---|
4194 | pswpNew->cx = 12;
|
---|
4195 | pswpNew->cy = sheight - 8;
|
---|
4196 | sCount++;
|
---|
4197 | if (fUserComboBox) {
|
---|
4198 | if (!aheight) {
|
---|
4199 |
|
---|
4200 | SWP swpTemp;
|
---|
4201 |
|
---|
4202 | WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
4203 | &swpTemp);
|
---|
4204 | aheight = swpTemp.cy;
|
---|
4205 | }
|
---|
4206 | pswpNew = (PSWP) mp1 + (soldCount + 5 +
|
---|
4207 | (fToolbar != FALSE) +
|
---|
4208 | (fSplitStatus != FALSE) +
|
---|
4209 | (fDrivebar != FALSE) + (fAutoView != FALSE));
|
---|
4210 | *pswpNew = *pswpClient;
|
---|
4211 | pswpNew->hwnd = hwndDrivelist;
|
---|
4212 | pswpNew->x = swpClient.x;
|
---|
4213 | pswpNew->cx = 48;
|
---|
4214 | pswpClient->cy -= (aheight + 6L);
|
---|
4215 | pswpNew->y = pswpClient->y;
|
---|
4216 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
4217 | sCount++;
|
---|
4218 | pswpNew = (PSWP) mp1 + (soldCount + 6 +
|
---|
4219 | (fToolbar != FALSE) +
|
---|
4220 | (fDrivebar != FALSE) +
|
---|
4221 | (fSplitStatus != FALSE) +
|
---|
4222 | (fAutoView != FALSE));
|
---|
4223 | *pswpNew = *pswpClient;
|
---|
4224 | pswpNew->hwnd = hwndStatelist;
|
---|
4225 | pswpNew->x = swpClient.x + 48;
|
---|
4226 | pswpNew->cx = (swpClient.cx - 48) / 7;
|
---|
4227 | pswpNew->y = pswpClient->y;
|
---|
4228 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
4229 | sCount++;
|
---|
4230 | pswpNew = (PSWP) mp1 + (soldCount + 7 +
|
---|
4231 | (fToolbar != FALSE) +
|
---|
4232 | (fDrivebar != FALSE) +
|
---|
4233 | (fSplitStatus != FALSE) +
|
---|
4234 | (fAutoView != FALSE));
|
---|
4235 | *pswpNew = *pswpClient;
|
---|
4236 | pswpNew->hwnd = hwndCmdlist;
|
---|
4237 | pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7);
|
---|
4238 | pswpNew->cx = (swpClient.cx - 48) / 5 +
|
---|
4239 | ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7);
|
---|
4240 | pswpNew->y = pswpClient->y;
|
---|
4241 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
4242 | sCount++;
|
---|
4243 | pswpNew = (PSWP) mp1 + (soldCount + 8 +
|
---|
4244 | (fToolbar != FALSE) +
|
---|
4245 | (fDrivebar != FALSE) +
|
---|
4246 | (fSplitStatus != FALSE) +
|
---|
4247 | (fAutoView != FALSE));
|
---|
4248 | *pswpNew = *pswpClient;
|
---|
4249 | pswpNew->hwnd = hwndUserlist;
|
---|
4250 | pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2);
|
---|
4251 | pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) -
|
---|
4252 | ((fToolbar) ? ((swpClient.cx - 48) / 7) : 0);
|
---|
4253 | pswpNew->y = pswpClient->y;
|
---|
4254 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
4255 | sCount++;
|
---|
4256 | if (fToolbar) {
|
---|
4257 | pswpNew = (PSWP) mp1 + (soldCount + 9 +
|
---|
4258 | (fToolbar != FALSE) +
|
---|
4259 | (fDrivebar != FALSE) +
|
---|
4260 | (fSplitStatus != FALSE) +
|
---|
4261 | (fAutoView != FALSE));
|
---|
4262 | *pswpNew = *pswpClient;
|
---|
4263 | pswpNew->hwnd = hwndButtonlist;
|
---|
4264 | pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4;
|
---|
4265 | pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x;
|
---|
4266 | pswpNew->y = pswpClient->y;
|
---|
4267 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
4268 | sCount++;
|
---|
4269 | }
|
---|
4270 | else
|
---|
4271 | WinShowWindow(hwndButtonlist, FALSE);
|
---|
4272 | }
|
---|
4273 | else {
|
---|
4274 | WinShowWindow(hwndUserlist, FALSE);
|
---|
4275 | WinShowWindow(hwndDrivelist, FALSE);
|
---|
4276 | WinShowWindow(hwndStatelist, FALSE);
|
---|
4277 | WinShowWindow(hwndButtonlist, FALSE);
|
---|
4278 | WinShowWindow(hwndCmdlist, FALSE);
|
---|
4279 | }
|
---|
4280 | {
|
---|
4281 | PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0;
|
---|
4282 | SHORT x;
|
---|
4283 |
|
---|
4284 | pswpNew = (PSWP) mp1 + (soldCount + 5 +
|
---|
4285 | (fToolbar != FALSE) +
|
---|
4286 | (fDrivebar != FALSE) +
|
---|
4287 | (fSplitStatus != FALSE) +
|
---|
4288 | (fAutoView != FALSE) +
|
---|
4289 | ((fUserComboBox != FALSE) * 4) +
|
---|
4290 | (fUserComboBox != FALSE &&
|
---|
4291 | fToolbar != FALSE));
|
---|
4292 | pswp = (PSWP) mp1;
|
---|
4293 | for (x = 0; x < soldCount; x++) {
|
---|
4294 | if (!pswpTitlebar &&
|
---|
4295 | WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR)
|
---|
4296 | pswpTitlebar = pswp;
|
---|
4297 | else if (!pswpMinbutton &&
|
---|
4298 | WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX)
|
---|
4299 | pswpMinbutton = pswp;
|
---|
4300 | if (pswpTitlebar && pswpMinbutton)
|
---|
4301 | break;
|
---|
4302 | pswp++;
|
---|
4303 | }
|
---|
4304 | if (pswpMinbutton && pswpTitlebar) {
|
---|
4305 | *pswpNew = *pswpMinbutton;
|
---|
4306 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_IDEALSIZE);
|
---|
4307 | pswpNew->cy = pswpMinbutton->cy + 3;
|
---|
4308 | pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3);
|
---|
4309 | pswpTitlebar->cx -= (pswpNew->cx - 1);
|
---|
4310 | pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx);
|
---|
4311 | pswpNew->y = pswpMinbutton->y - 1;
|
---|
4312 | sCount++;
|
---|
4313 | }
|
---|
4314 | else
|
---|
4315 | WinShowWindow(WinWindowFromID(hwnd, IDM_IDEALSIZE), FALSE);
|
---|
4316 | }
|
---|
4317 |
|
---|
4318 | if (fMoreButtons) {
|
---|
4319 |
|
---|
4320 | LONG lastx;
|
---|
4321 |
|
---|
4322 | pswpNew = (PSWP) mp1 + (soldCount + 6 +
|
---|
4323 | (fToolbar != FALSE) +
|
---|
4324 | (fDrivebar != FALSE) +
|
---|
4325 | (fSplitStatus != FALSE) +
|
---|
4326 | (fAutoView != FALSE) +
|
---|
4327 | ((fUserComboBox != FALSE) * 4) +
|
---|
4328 | (fUserComboBox != FALSE &&
|
---|
4329 | fToolbar != FALSE));
|
---|
4330 | *pswpNew = *pswpClient;
|
---|
4331 | pswpNew->hwnd = hwndName;
|
---|
4332 | pswpNew->x = swpClient.x + 3;
|
---|
4333 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
4334 | pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3;
|
---|
4335 | lastx = pswpNew->x + pswpNew->cx;
|
---|
4336 | pswpNew->cy = bheight;
|
---|
4337 | pswpClient->y += (bheight + 4);
|
---|
4338 | pswpClient->cy -= (bheight + 4);
|
---|
4339 | sCount++;
|
---|
4340 | pswpNew = (PSWP) mp1 + (soldCount + 7 +
|
---|
4341 | (fToolbar != FALSE) +
|
---|
4342 | (fDrivebar != FALSE) +
|
---|
4343 | (fSplitStatus != FALSE) +
|
---|
4344 | (fAutoView != FALSE) +
|
---|
4345 | ((fUserComboBox != FALSE) * 4) +
|
---|
4346 | (fUserComboBox != FALSE &&
|
---|
4347 | fToolbar != FALSE));
|
---|
4348 | *pswpNew = *pswpClient;
|
---|
4349 | pswpNew->hwnd = hwndDate;
|
---|
4350 | pswpNew->x = lastx + 3;
|
---|
4351 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
4352 | pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3;
|
---|
4353 | lastx = pswpNew->x + pswpNew->cx;
|
---|
4354 | pswpNew->cy = bheight;
|
---|
4355 | sCount++;
|
---|
4356 | pswpNew = (PSWP) mp1 + (soldCount + 8 +
|
---|
4357 | (fToolbar != FALSE) +
|
---|
4358 | (fDrivebar != FALSE) +
|
---|
4359 | (fSplitStatus != FALSE) +
|
---|
4360 | (fAutoView != FALSE) +
|
---|
4361 | ((fUserComboBox != FALSE) * 4) +
|
---|
4362 | (fUserComboBox != FALSE &&
|
---|
4363 | fToolbar != FALSE));
|
---|
4364 | *pswpNew = *pswpClient;
|
---|
4365 | pswpNew->hwnd = hwndAttr;
|
---|
4366 | pswpNew->x = lastx + 3;
|
---|
4367 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
4368 | pswpNew->cx = (swpClient.cx - pswpNew->x) - 1;
|
---|
4369 | pswpNew->cy = bheight;
|
---|
4370 | sCount++;
|
---|
4371 | }
|
---|
4372 | else {
|
---|
4373 | WinShowWindow(hwndAttr, FALSE);
|
---|
4374 | WinShowWindow(hwndName, FALSE);
|
---|
4375 | WinShowWindow(hwndDate, FALSE);
|
---|
4376 | }
|
---|
4377 | return MRFROMSHORT(sCount);
|
---|
4378 | }
|
---|
4379 |
|
---|
4380 | case WM_QUERYFRAMECTLCOUNT:
|
---|
4381 | {
|
---|
4382 | SHORT sCount;
|
---|
4383 |
|
---|
4384 | sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
|
---|
4385 |
|
---|
4386 | sCount += 6;
|
---|
4387 | if (fSplitStatus)
|
---|
4388 | sCount++;
|
---|
4389 | if (fToolbar)
|
---|
4390 | sCount++;
|
---|
4391 | if (fUserComboBox) {
|
---|
4392 | sCount += 4;
|
---|
4393 | if (fToolbar)
|
---|
4394 | sCount++;
|
---|
4395 | }
|
---|
4396 | if (fDrivebar)
|
---|
4397 | sCount++;
|
---|
4398 | if (fAutoView)
|
---|
4399 | sCount++;
|
---|
4400 | if (fMoreButtons)
|
---|
4401 | sCount += 3;
|
---|
4402 | return MRFROMSHORT(sCount);
|
---|
4403 | }
|
---|
4404 |
|
---|
4405 | case WM_CLOSE:
|
---|
4406 | WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
|
---|
4407 | return 0;
|
---|
4408 | }
|
---|
4409 | return oldproc(hwnd, msg, mp1, mp2);
|
---|
4410 | }
|
---|
4411 |
|
---|
4412 | MRESULT EXPENTRY MainWMCommand(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
4413 | {
|
---|
4414 | SetShiftState();
|
---|
4415 | switch (SHORT1FROMMP(mp1)) {
|
---|
4416 |
|
---|
4417 | case IDM_CONTEXTMENU:
|
---|
4418 | {
|
---|
4419 | HWND hwnd = WinQueryFocus(HWND_DESKTOP);
|
---|
4420 | // DbgMsg(pszSrcFile, __LINE__, "IDM_CONTEXTMENU %x", hwnd);
|
---|
4421 | if (hwnd != NULLHANDLE) {
|
---|
4422 | HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT);
|
---|
4423 | USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID);
|
---|
4424 | switch (id) {
|
---|
4425 | case MAIN_SETUPLIST:
|
---|
4426 | case MAIN_USERLIST:
|
---|
4427 | case MAIN_CMDLIST:
|
---|
4428 | // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU");
|
---|
4429 | WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0);
|
---|
4430 | }
|
---|
4431 | }
|
---|
4432 | }
|
---|
4433 | break;
|
---|
4434 |
|
---|
4435 | case IDM_SETTARGET:
|
---|
4436 | SetTargetDir(hwnd, FALSE);
|
---|
4437 | break;
|
---|
4438 |
|
---|
4439 | case IDM_TOAUTOMLE:
|
---|
4440 | if (fComments && fAutoView)
|
---|
4441 | WinSetFocus(HWND_DESKTOP, hwndAutoMLE);
|
---|
4442 | break;
|
---|
4443 |
|
---|
4444 | case IDM_HIDENOTEWND:
|
---|
4445 | HideNote();
|
---|
4446 | break;
|
---|
4447 | case IDM_SHOWNOTEWND:
|
---|
4448 | ShowNote();
|
---|
4449 | break;
|
---|
4450 |
|
---|
4451 | case IDM_COMPARE:
|
---|
4452 | {
|
---|
4453 | WALK2 wa;
|
---|
4454 | PCNRITEM pci;
|
---|
4455 |
|
---|
4456 | memset(&wa, 0, sizeof(wa));
|
---|
4457 | wa.size = sizeof(wa);
|
---|
4458 | pci =
|
---|
4459 | (PCNRITEM)
|
---|
4460 | WinSendMsg(WinWindowFromID
|
---|
4461 | (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
|
---|
4462 | CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
|
---|
4463 | MPFROMSHORT(CRA_CURSORED));
|
---|
4464 | if (pci && (INT) pci != -1) {
|
---|
4465 | strcpy(wa.szCurrentPath1, pci->pszFileName);
|
---|
4466 | MakeValidDir(wa.szCurrentPath1);
|
---|
4467 | }
|
---|
4468 | else
|
---|
4469 | save_dir2(wa.szCurrentPath1);
|
---|
4470 | TopWindowName(hwndMain, (HWND) 0, wa.szCurrentPath2);
|
---|
4471 | if (!*wa.szCurrentPath2)
|
---|
4472 | strcpy(wa.szCurrentPath2, wa.szCurrentPath1);
|
---|
4473 | MakeValidDir(wa.szCurrentPath2);
|
---|
4474 | if (WinDlgBox(HWND_DESKTOP,
|
---|
4475 | hwnd,
|
---|
4476 | WalkTwoCmpDlgProc,
|
---|
4477 | FM3ModHandle,
|
---|
4478 | WALK2_FRAME,
|
---|
4479 | MPFROMP(&wa)) &&
|
---|
4480 | !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) {
|
---|
4481 | if (!*dircompare) {
|
---|
4482 |
|
---|
4483 | COMPARE *cmp;
|
---|
4484 |
|
---|
4485 | cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
|
---|
4486 | if (cmp) {
|
---|
4487 | cmp->size = sizeof(COMPARE);
|
---|
4488 | strcpy(cmp->leftdir, wa.szCurrentPath1);
|
---|
4489 | strcpy(cmp->rightdir, wa.szCurrentPath2);
|
---|
4490 | cmp->hwndParent = hwnd;
|
---|
4491 | cmp->dcd.hwndParent = hwnd;
|
---|
4492 | WinDlgBox(HWND_DESKTOP,
|
---|
4493 | HWND_DESKTOP,
|
---|
4494 | CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
|
---|
4495 | }
|
---|
4496 | }
|
---|
4497 | else {
|
---|
4498 |
|
---|
4499 | CHAR szPath1[CCHMAXPATH];
|
---|
4500 | CHAR szPath2[CCHMAXPATH];
|
---|
4501 | runemf2(SEPARATE,
|
---|
4502 | HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
4503 | NULL, NULL,
|
---|
4504 | "%s %s %s",
|
---|
4505 | dircompare,
|
---|
4506 | BldQuotedFileName(szPath1, wa.szCurrentPath1),
|
---|
4507 | BldQuotedFileName(szPath2, wa.szCurrentPath2));
|
---|
4508 | }
|
---|
4509 | }
|
---|
4510 | }
|
---|
4511 | break;
|
---|
4512 |
|
---|
4513 | case IDM_EXIT:
|
---|
4514 | case IDM_KILLME:
|
---|
4515 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
4516 | break;
|
---|
4517 |
|
---|
4518 | case IDM_CLI:
|
---|
4519 | if (fSplitStatus &&
|
---|
4520 | hwndStatus2 &&
|
---|
4521 | !WinIsWindow(WinQueryAnchorBlock(hwnd),
|
---|
4522 | WinWindowFromID(hwndStatus2, COMMAND_LINE)))
|
---|
4523 | PostMsg(hwndStatus2, UM_CLICKED, MPVOID, MPVOID);
|
---|
4524 | break;
|
---|
4525 |
|
---|
4526 | case IDM_ADDTOUSERLIST:
|
---|
4527 | case IDM_DELETEFROMUSERLIST:
|
---|
4528 | {
|
---|
4529 | CHAR temp[CCHMAXPATH], path[CCHMAXPATH];
|
---|
4530 |
|
---|
4531 | *temp = 0;
|
---|
4532 | WinQueryWindowText(hwndUserlist, CCHMAXPATH, temp);
|
---|
4533 | bstrip(temp);
|
---|
4534 | if (*temp &&
|
---|
4535 | !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) {
|
---|
4536 | if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) {
|
---|
4537 | add_udir(TRUE, path);
|
---|
4538 | if (fUdirsChanged)
|
---|
4539 | save_udirs();
|
---|
4540 | WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
---|
4541 | }
|
---|
4542 | else {
|
---|
4543 | if (!remove_udir(path))
|
---|
4544 | Runtime_Error(pszSrcFile, __LINE__, "remove_udir");
|
---|
4545 | else {
|
---|
4546 | if (fUdirsChanged)
|
---|
4547 | save_udirs();
|
---|
4548 | WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
---|
4549 | }
|
---|
4550 | }
|
---|
4551 | }
|
---|
4552 | }
|
---|
4553 | break;
|
---|
4554 |
|
---|
4555 | case IDM_SAVEDIRCNRSTATE:
|
---|
4556 | case IDM_DELETEDIRCNRSTATE:
|
---|
4557 | {
|
---|
4558 | CHAR szStateName[STATE_NAME_MAX_BYTES + 1];
|
---|
4559 |
|
---|
4560 | *szStateName = 0;
|
---|
4561 | WinQueryWindowText(hwndStatelist, STATE_NAME_MAX_BYTES, szStateName);
|
---|
4562 | bstrip(szStateName);
|
---|
4563 | // Complain if attempting to use reserved name
|
---|
4564 | if (stricmp(szStateName, GetPString(IDS_STATETEXT)) == 0 ||
|
---|
4565 | stricmp(szStateName, GetPString(IDS_FM2TEMPTEXT)) == 0 ||
|
---|
4566 | stricmp(szStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0)
|
---|
4567 | {
|
---|
4568 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
---|
4569 | GetPString(IDS_WARNINGTEXT),
|
---|
4570 | "\"%s\" is a reserved state name", szStateName);
|
---|
4571 | }
|
---|
4572 | // Ignore request if blank
|
---|
4573 | else if (*szStateName) {
|
---|
4574 | if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) {
|
---|
4575 | // Save
|
---|
4576 | INT nSaved = SaveDirCnrState(hwnd, szStateName);
|
---|
4577 | if (nSaved > 0) {
|
---|
4578 | INT ret = add_setup(szStateName);
|
---|
4579 | if (ret == 0) {
|
---|
4580 | WinSendMsg(hwndStatelist, LM_INSERTITEM,
|
---|
4581 | MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName));
|
---|
4582 | save_setups();
|
---|
4583 | }
|
---|
4584 | else if (ret != 1) {
|
---|
4585 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
---|
4586 | GetPString(IDS_WARNINGTEXT),
|
---|
4587 | "\"%s\" state name add failed", szStateName); // 15 Apr 07 SHL failed
|
---|
4588 | WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
|
---|
4589 | }
|
---|
4590 | }
|
---|
4591 | else {
|
---|
4592 | saymsg(MB_ENTER | MB_ICONASTERISK,
|
---|
4593 | hwnd,
|
---|
4594 | GetPString(IDS_WARNINGTEXT),
|
---|
4595 | nSaved == 0 ?
|
---|
4596 | "Nothing to save" :
|
---|
4597 | "State data save failed");
|
---|
4598 | WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
|
---|
4599 | }
|
---|
4600 | }
|
---|
4601 | else {
|
---|
4602 | // Delete
|
---|
4603 | ULONG numsaves = 0, size, x;
|
---|
4604 | CHAR s[STATE_NAME_MAX_BYTES + 80];
|
---|
4605 |
|
---|
4606 | INT ret = remove_setup(szStateName);
|
---|
4607 | if (ret == 1)
|
---|
4608 | save_setups();
|
---|
4609 | sprintf(s, "%s.NumDirsLastTime", szStateName);
|
---|
4610 | size = sizeof(ULONG);
|
---|
4611 | if (!PrfQueryProfileData(fmprof,
|
---|
4612 | FM3Str,
|
---|
4613 | s,
|
---|
4614 | (PVOID)&numsaves,
|
---|
4615 | &size)) {
|
---|
4616 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
---|
4617 | GetPString(IDS_WARNINGTEXT),
|
---|
4618 | GetPString(IDS_DOESNTEXISTTEXT), szStateName);
|
---|
4619 | }
|
---|
4620 | else if (!size)
|
---|
4621 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
4622 | else {
|
---|
4623 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L);
|
---|
4624 | for (x = 0; x < numsaves; x++) {
|
---|
4625 | sprintf(s, "%s.DirCnrPos.%lu", szStateName, x);
|
---|
4626 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4627 | sprintf(s, "%s.DirCnrDir.%lu", szStateName, x);
|
---|
4628 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4629 | sprintf(s, "%s.DirCnrSort.%lu", szStateName, x);
|
---|
4630 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4631 | sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x);
|
---|
4632 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4633 | sprintf(s, "%s.DirCnrView.%lu", szStateName, x);
|
---|
4634 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4635 | sprintf(s, "%s.DirCnr.%lu.DetailsLongname", szStateName, x);
|
---|
4636 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4637 | sprintf(s, "%s.DirCnr.%lu.DetailsSubject", szStateName, x);
|
---|
4638 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4639 | sprintf(s, "%s.DirCnr.%lu.DetailsSize", szStateName, x);
|
---|
4640 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4641 | sprintf(s, "%s.DirCnr.%lu.DetailsEA", szStateName, x);
|
---|
4642 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4643 | sprintf(s, "%s.DirCnr.%lu.DetailsAttr", szStateName, x);
|
---|
4644 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4645 | sprintf(s, "%s.DirCnr.%lu.DetailsIcon", szStateName, x);
|
---|
4646 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4647 | sprintf(s, "%s.DirCnr.%lu.DetailsLWDate", szStateName, x);
|
---|
4648 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4649 | sprintf(s, "%s.DirCnr.%lu.DetailsLWTime", szStateName, x);
|
---|
4650 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4651 | sprintf(s, "%s.DirCnr.%lu.DetailsLADate", szStateName, x);
|
---|
4652 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4653 | sprintf(s, "%s.DirCnr.%lu.DetailsLATime", szStateName, x);
|
---|
4654 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4655 | sprintf(s, "%s.DirCnr.%lu.DetailsCRDate", szStateName, x);
|
---|
4656 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4657 | sprintf(s, "%s.DirCnr.%lu.DetailsCRTime", szStateName, x);
|
---|
4658 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4659 | sprintf(s, "%s.DirCnr.%lu.Backgroundcolor", szStateName, x);
|
---|
4660 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4661 | sprintf(s, "%s.DirCnr.%lu.Fontnamesize", szStateName, x);
|
---|
4662 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4663 | }
|
---|
4664 | sprintf(s, "%s.LastTreePos", szStateName);
|
---|
4665 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4666 | sprintf(s, "%s.MySizeLastTime", szStateName);
|
---|
4667 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
4668 | }
|
---|
4669 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
---|
4670 | }
|
---|
4671 | }
|
---|
4672 | }
|
---|
4673 | break;
|
---|
4674 |
|
---|
4675 | case IDM_IDEALSIZE:
|
---|
4676 | {
|
---|
4677 | SWP swp, swpD;
|
---|
4678 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L;
|
---|
4679 | ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
|
---|
4680 |
|
---|
4681 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
---|
4682 | if (swp.fl & SWP_MAXIMIZE) {
|
---|
4683 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_SYSCOMMAND,
|
---|
4684 | MPFROM2SHORT(SC_RESTORE, 0), MPVOID);
|
---|
4685 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
---|
4686 | }
|
---|
4687 | WinGetMaxPosition(WinQueryWindow(hwnd, QW_PARENT), &swpD);
|
---|
4688 | swpD.x += bsz;
|
---|
4689 | swpD.cx -= (bsz * 2);
|
---|
4690 | swpD.y += icz;
|
---|
4691 | swpD.cy -= (icz + bsz);
|
---|
4692 | if (swp.x == swpD.x && swp.y == swpD.y &&
|
---|
4693 | swp.cx == swpD.cx && swp.cy == swpD.cy &&
|
---|
4694 | // fixme to be #defined someday
|
---|
4695 | WinQueryWindowUShort(hwnd, QWL_USER + 10) &&
|
---|
4696 | WinQueryWindowUShort(hwnd, QWL_USER + 14)) {
|
---|
4697 | swpD.x = WinQueryWindowUShort(hwnd, QWL_USER + 8);
|
---|
4698 | swpD.cx = WinQueryWindowUShort(hwnd, QWL_USER + 10);
|
---|
4699 | swpD.y = WinQueryWindowUShort(hwnd, QWL_USER + 12);
|
---|
4700 | swpD.cy = WinQueryWindowUShort(hwnd, QWL_USER + 14);
|
---|
4701 | }
|
---|
4702 | else {
|
---|
4703 | WinSetWindowUShort(hwnd, QWL_USER + 8, (USHORT) swp.x);
|
---|
4704 | WinSetWindowUShort(hwnd, QWL_USER + 10, (USHORT) swp.cx);
|
---|
4705 | WinSetWindowUShort(hwnd, QWL_USER + 12, (USHORT) swp.y);
|
---|
4706 | WinSetWindowUShort(hwnd, QWL_USER + 14, (USHORT) swp.cy);
|
---|
4707 | }
|
---|
4708 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP,
|
---|
4709 | swpD.x, swpD.y, swpD.cx, swpD.cy, SWP_MOVE | SWP_SIZE);
|
---|
4710 | }
|
---|
4711 | break;
|
---|
4712 |
|
---|
4713 | case IDM_BLINK:
|
---|
4714 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
|
---|
4715 | SWP_MINIMIZE);
|
---|
4716 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
|
---|
4717 | SWP_RESTORE | SWP_ZORDER);
|
---|
4718 | break;
|
---|
4719 |
|
---|
4720 | case DID_CANCEL:
|
---|
4721 | {
|
---|
4722 | HWND hwndTop = TopWindow(hwndMain, (HWND) 0);
|
---|
4723 |
|
---|
4724 | if (hwndTop)
|
---|
4725 | WinSetFocus(HWND_DESKTOP, hwndTop);
|
---|
4726 | }
|
---|
4727 | break;
|
---|
4728 |
|
---|
4729 | case IDM_NOTEBOOK:
|
---|
4730 | case IDM_DIRCNRSETTINGS:
|
---|
4731 | case IDM_DIRVIEWSETTINGS:
|
---|
4732 | case IDM_DIRSORTSETTINGS:
|
---|
4733 | case IDM_COLLECTORVIEWSETTINGS:
|
---|
4734 | case IDM_COLLECTORSORTSETTINGS:
|
---|
4735 | case IDM_ARCHIVERSETTINGS:
|
---|
4736 | case IDM_TREECNRVIEWSETTINGS:
|
---|
4737 | case IDM_TREECNRSORTSETTINGS:
|
---|
4738 | case IDM_VIEWERSETTINGS:
|
---|
4739 | case IDM_VIEWERSETTINGS2:
|
---|
4740 | case IDM_COMPARESETTINGS:
|
---|
4741 | case IDM_MONOLITHICSETTINGS:
|
---|
4742 | case IDM_GENERALSETTINGS:
|
---|
4743 | case IDM_SCANSETTINGS:
|
---|
4744 | case IDM_BUBBLESSETTINGS:
|
---|
4745 | case IDM_QUICKSETTINGS:
|
---|
4746 | WinDlgBox(HWND_DESKTOP,
|
---|
4747 | hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMLONG(mp1));
|
---|
4748 | break;
|
---|
4749 |
|
---|
4750 | case IDM_VIEWHELPS:
|
---|
4751 | case IDM_VIEWINFS:
|
---|
4752 | WinDlgBox(HWND_DESKTOP,
|
---|
4753 | HWND_DESKTOP,
|
---|
4754 | ViewInfProc,
|
---|
4755 | FM3ModHandle,
|
---|
4756 | VINF_FRAME,
|
---|
4757 | ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ?
|
---|
4758 | MPFROMP(NullStr) : MPVOID));
|
---|
4759 | break;
|
---|
4760 |
|
---|
4761 | case IDM_OPENWALK:
|
---|
4762 | {
|
---|
4763 | char newpath[CCHMAXPATH];
|
---|
4764 |
|
---|
4765 | *newpath = 0;
|
---|
4766 | TopWindowName(hwnd, (HWND) 0, newpath);
|
---|
4767 | if (WinDlgBox(HWND_DESKTOP,
|
---|
4768 | hwnd,
|
---|
4769 | WalkAllDlgProc,
|
---|
4770 | FM3ModHandle, WALK_FRAME, MPFROMP(newpath)) && *newpath)
|
---|
4771 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, newpath);
|
---|
4772 | }
|
---|
4773 | break;
|
---|
4774 |
|
---|
4775 | case IDM_WINDOWDLG:
|
---|
4776 | WindowList(hwnd);
|
---|
4777 | break;
|
---|
4778 |
|
---|
4779 | case IDM_HELPMOUSE:
|
---|
4780 | case IDM_HELPCONTEXT:
|
---|
4781 | case IDM_HELPHINTS:
|
---|
4782 | case IDM_HELPPIX:
|
---|
4783 | case IDM_HELPTUTOR:
|
---|
4784 | case IDM_HELPUSERLIST:
|
---|
4785 | case IDM_HELP:
|
---|
4786 | case IDM_HELPCONTENTS:
|
---|
4787 | case IDM_HELPKEYS:
|
---|
4788 | case IDM_HELPGENERAL:
|
---|
4789 | if (hwndHelp) {
|
---|
4790 | if (SHORT1FROMMP(mp2) == CMDSRC_MENU) {
|
---|
4791 |
|
---|
4792 | RECTL rcl;
|
---|
4793 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L;
|
---|
4794 |
|
---|
4795 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
---|
4796 | rcl.yBottom += icz;
|
---|
4797 | rcl.yTop -= icz;
|
---|
4798 | rcl.xLeft += icz;
|
---|
4799 | rcl.xRight -= icz;
|
---|
4800 | WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);
|
---|
4801 | }
|
---|
4802 | else {
|
---|
4803 |
|
---|
4804 | RECTL rcl;
|
---|
4805 |
|
---|
4806 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
---|
4807 | rcl.yBottom += 8;
|
---|
4808 | rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7);
|
---|
4809 | rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7);
|
---|
4810 | rcl.xRight -= 8;
|
---|
4811 | WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);
|
---|
4812 | }
|
---|
4813 | switch (SHORT1FROMMP(mp1)) {
|
---|
4814 | case IDM_HELPCONTEXT:
|
---|
4815 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
4816 | MPFROM2SHORT(HELP_CONTEXT, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
4817 | break;
|
---|
4818 |
|
---|
4819 | case IDM_HELPMOUSE:
|
---|
4820 | if (hwndHelp)
|
---|
4821 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
4822 | MPFROM2SHORT(HELP_MOUSE, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
4823 | break;
|
---|
4824 |
|
---|
4825 | case IDM_HELPPIX:
|
---|
4826 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
4827 | MPFROM2SHORT(HELP_BITMAP1, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
4828 | break;
|
---|
4829 |
|
---|
4830 | case IDM_HELPTUTOR:
|
---|
4831 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
4832 | MPFROM2SHORT(HELP_TUTORIAL, 0),
|
---|
4833 | MPFROMSHORT(HM_RESOURCEID));
|
---|
4834 | break;
|
---|
4835 |
|
---|
4836 | case IDM_HELPHINTS:
|
---|
4837 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
4838 | MPFROM2SHORT(HELP_HINTS, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
4839 | break;
|
---|
4840 |
|
---|
4841 | case IDM_HELPGENERAL:
|
---|
4842 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
4843 | MPFROM2SHORT(HELP_MAIN, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
4844 | break;
|
---|
4845 | case IDM_HELPKEYS:
|
---|
4846 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
4847 | MPFROM2SHORT(HELP_KEYS, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
4848 | break;
|
---|
4849 |
|
---|
4850 | case IDM_HELP:
|
---|
4851 | case IDM_HELPCONTENTS:
|
---|
4852 | WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
|
---|
4853 | break;
|
---|
4854 |
|
---|
4855 | case IDM_HELPUSERLIST:
|
---|
4856 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
4857 | MPFROM2SHORT(HELP_USERLISTS, 0),
|
---|
4858 | MPFROMSHORT(HM_RESOURCEID));
|
---|
4859 | break;
|
---|
4860 | }
|
---|
4861 | }
|
---|
4862 | break;
|
---|
4863 |
|
---|
4864 | case IDM_EDITANYARCHIVER:
|
---|
4865 | EditArchiverDefinition(hwnd);
|
---|
4866 | break;
|
---|
4867 |
|
---|
4868 | case IDM_ABOUT:
|
---|
4869 | WinDlgBox(HWND_DESKTOP, hwnd, AboutDlgProc, FM3ModHandle,
|
---|
4870 | ABT_FRAME, MPVOID);
|
---|
4871 | break;
|
---|
4872 |
|
---|
4873 | case IDM_FONTPALETTE:
|
---|
4874 | OpenObject("<WP_FNTPAL>", Default, hwnd);
|
---|
4875 | break;
|
---|
4876 |
|
---|
4877 | case IDM_HICOLORPALETTE:
|
---|
4878 | case IDM_COLORPALETTE:
|
---|
4879 | {
|
---|
4880 | CHAR *palette = "<WP_CLRPAL>";
|
---|
4881 | ULONG version[2];
|
---|
4882 |
|
---|
4883 | if (!DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR,
|
---|
4884 | (PVOID) & version, (ULONG) sizeof(version))) {
|
---|
4885 | if (version[0] > 20L || (version[0] == 20L && version[1] > 29L)) {
|
---|
4886 | if (SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE)
|
---|
4887 | palette = "<WP_HIRESCLRPAL>";
|
---|
4888 | else
|
---|
4889 | palette = "<WP_LORESCLRPAL>";
|
---|
4890 | }
|
---|
4891 | }
|
---|
4892 | OpenObject(palette, Default, hwnd);
|
---|
4893 | }
|
---|
4894 | break;
|
---|
4895 |
|
---|
4896 | case IDM_SYSTEMSETUP:
|
---|
4897 | OpenObject("<WP_CONFIG>", Default, hwnd);
|
---|
4898 | break;
|
---|
4899 |
|
---|
4900 | case IDM_SCHEMEPALETTE:
|
---|
4901 | {
|
---|
4902 | HOBJECT hWPSObject;
|
---|
4903 |
|
---|
4904 | hWPSObject = WinQueryObject("<WP_SCHPAL>");
|
---|
4905 | if (hWPSObject != NULLHANDLE)
|
---|
4906 | WinSetObjectData(hWPSObject, "SCHEMES=Winter:PM_Winter,"
|
---|
4907 | "Spring:PM_Spring,Summer:PM_Summer,"
|
---|
4908 | "System:PM_System,Windows:PM_Windows;"
|
---|
4909 | "OPEN=DEFAULT");
|
---|
4910 | }
|
---|
4911 | break;
|
---|
4912 |
|
---|
4913 | case IDM_SYSTEMCLOCK:
|
---|
4914 | OpenObject("<WP_CLOCK>", Default, hwnd);
|
---|
4915 | break;
|
---|
4916 |
|
---|
4917 | #ifdef NEVER
|
---|
4918 | case IDM_SYSINFO:
|
---|
4919 | WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, SysInfoDlgProc, FM3ModHandle,
|
---|
4920 | SYS_FRAME, NULL);
|
---|
4921 | break;
|
---|
4922 | #endif
|
---|
4923 |
|
---|
4924 | case IDM_INSTANT:
|
---|
4925 | {
|
---|
4926 | CHAR path[CCHMAXPATH];
|
---|
4927 | PCNRITEM pci = (PCNRITEM) 0;
|
---|
4928 |
|
---|
4929 | if (hwndTree)
|
---|
4930 | pci = (PCNRITEM) WinSendMsg(hwndTree, CM_QUERYRECORDEMPHASIS,
|
---|
4931 | MPFROMLONG(CMA_FIRST),
|
---|
4932 | MPFROMSHORT(CRA_CURSORED));
|
---|
4933 | if (pci && (INT) pci != -1) {
|
---|
4934 | strcpy(path, pci->pszFileName);
|
---|
4935 | MakeValidDir(path);
|
---|
4936 | }
|
---|
4937 | else
|
---|
4938 | save_dir2(path);
|
---|
4939 | WinDlgBox(HWND_DESKTOP, hwnd, InstantDlgProc, FM3ModHandle,
|
---|
4940 | BAT_FRAME, MPFROMP(path));
|
---|
4941 | }
|
---|
4942 | break;
|
---|
4943 |
|
---|
4944 | case IDM_WINFULLSCREEN:
|
---|
4945 | case IDM_DOSCOMMANDLINE:
|
---|
4946 | case IDM_COMMANDLINE:
|
---|
4947 | {
|
---|
4948 | CHAR *env = GetCmdSpec(FALSE), path[CCHMAXPATH];
|
---|
4949 | INT type = SEPARATE | WINDOWED;
|
---|
4950 |
|
---|
4951 | *path = 0;
|
---|
4952 | TopWindowName(hwnd, (HWND) 0, path);
|
---|
4953 | if (SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE)
|
---|
4954 | env = GetCmdSpec(TRUE);
|
---|
4955 | else if (SHORT1FROMMP(mp1) != IDM_COMMANDLINE) {
|
---|
4956 | env = "WINOS2.COM";
|
---|
4957 | type = SEPARATE | FULLSCREEN;
|
---|
4958 | }
|
---|
4959 | runemf2(type, hwnd, pszSrcFile, __LINE__,
|
---|
4960 | path, NULL, "%s", env);
|
---|
4961 | }
|
---|
4962 | break;
|
---|
4963 |
|
---|
4964 | case IDM_KILLPROC:
|
---|
4965 | WinDlgBox(HWND_DESKTOP, hwnd, KillDlgProc, FM3ModHandle,
|
---|
4966 | KILL_FRAME, NULL);
|
---|
4967 | break;
|
---|
4968 |
|
---|
4969 | case IDM_AUTOVIEWCOMMENTS:
|
---|
4970 | case IDM_AUTOVIEWFILE:
|
---|
4971 | if (SHORT1FROMMP(mp1) == IDM_AUTOVIEWFILE)
|
---|
4972 | fComments = FALSE;
|
---|
4973 | else
|
---|
4974 | fComments = TRUE;
|
---|
4975 | PrfWriteProfileData(fmprof, FM3Str, "Comments", &fComments, sizeof(BOOL));
|
---|
4976 | WinSetWindowText((fComments) ? hwndAutoview : hwndAutoMLE, NullStr);
|
---|
4977 | goto AutoChange;
|
---|
4978 |
|
---|
4979 | case IDM_AUTOVIEW:
|
---|
4980 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
---|
4981 | &fAutoView, TRUE, "AutoView");
|
---|
4982 | AutoChange:
|
---|
4983 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
---|
4984 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
4985 | if (fAutoView) {
|
---|
4986 |
|
---|
4987 | CHAR s[CCHMAXPATH];
|
---|
4988 | HWND hwndDir;
|
---|
4989 | PCNRITEM pci;
|
---|
4990 |
|
---|
4991 | hwndDir = TopWindowName(hwnd, (HWND) 0, s);
|
---|
4992 | if (hwndDir) {
|
---|
4993 | hwndDir = WinWindowFromID(hwndDir, FID_CLIENT);
|
---|
4994 | if (hwndDir) {
|
---|
4995 | hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
|
---|
4996 | if (hwndDir) {
|
---|
4997 | pci = (PCNRITEM) WinSendMsg(hwndDir, CM_QUERYRECORDEMPHASIS,
|
---|
4998 | MPFROMLONG(CMA_FIRST),
|
---|
4999 | MPFROMSHORT(CRA_CURSORED));
|
---|
5000 | if (pci && (INT) pci != -1 &&
|
---|
5001 | (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
|
---|
5002 | WinSendMsg(hwnd,
|
---|
5003 | UM_LOADFILE,
|
---|
5004 | MPFROMP(pci->pszFileName),
|
---|
5005 | (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ?
|
---|
5006 | MPVOID : MPFROMLONG(1));
|
---|
5007 | }
|
---|
5008 | }
|
---|
5009 | }
|
---|
5010 | }
|
---|
5011 | break;
|
---|
5012 |
|
---|
5013 | case IDM_TEXTTOOLS:
|
---|
5014 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
---|
5015 | &fTextTools, TRUE, "TextTools");
|
---|
5016 | BuildTools(hwndToolback, TRUE);
|
---|
5017 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
---|
5018 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
5019 | break;
|
---|
5020 |
|
---|
5021 | case IDM_TOOLTITLES:
|
---|
5022 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
---|
5023 | &fToolTitles, TRUE, "ToolTitles");
|
---|
5024 | BuildTools(hwndToolback, TRUE);
|
---|
5025 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
---|
5026 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
5027 | break;
|
---|
5028 |
|
---|
5029 | case IDM_HIDEMENU:
|
---|
5030 | {
|
---|
5031 | HWND hwndMenu = WinQueryWindowULong(hwnd, QWL_USER);
|
---|
5032 | MenuInvisible = MenuInvisible ? FALSE : TRUE;
|
---|
5033 | if (MenuInvisible) {
|
---|
5034 | WinSetParent(hwndMenu, HWND_OBJECT, FALSE);
|
---|
5035 | WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
5036 | FID_SYSMENU), IDM_HIDEMENU,
|
---|
5037 | GetPString(IDS_UNHIDEMENUTEXT));
|
---|
5038 | }
|
---|
5039 | else {
|
---|
5040 | WinSetParent(hwndMenu, WinQueryWindow(hwnd, QW_PARENT), FALSE);
|
---|
5041 | WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
5042 | FID_SYSMENU), IDM_HIDEMENU,
|
---|
5043 | GetPString(IDS_HIDEMENUTEXT));
|
---|
5044 | }
|
---|
5045 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
---|
5046 | MPFROMLONG(FCF_MENU), MPVOID);
|
---|
5047 | PrfWriteProfileData(fmprof, FM3Str, "MenuInvisible",
|
---|
5048 | &MenuInvisible, sizeof(BOOL));
|
---|
5049 | }
|
---|
5050 | break;
|
---|
5051 |
|
---|
5052 | case IDM_SEEALL:
|
---|
5053 | case IDM_GREP:
|
---|
5054 | case IDM_COLLECTOR:
|
---|
5055 | {
|
---|
5056 | HWND hwndC;
|
---|
5057 | SWP swp;
|
---|
5058 | BOOL already = FALSE;
|
---|
5059 |
|
---|
5060 | if (Collector)
|
---|
5061 | already = TRUE;
|
---|
5062 | if (!already && !fAutoTile && !fExternalCollector)
|
---|
5063 | GetNextWindowPos(hwnd, &swp, NULL, NULL);
|
---|
5064 | hwndC = StartCollector(fExternalCollector ? HWND_DESKTOP : hwnd, 4);
|
---|
5065 | if (hwndC) {
|
---|
5066 | if (!already && !fAutoTile && !fExternalCollector)
|
---|
5067 | WinSetWindowPos(hwndC, HWND_TOP,
|
---|
5068 | swp.x, swp.y, swp.cx, swp.cy,
|
---|
5069 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
---|
5070 | else if (fAutoTile && !already)
|
---|
5071 | TileChildren(hwnd, TRUE);
|
---|
5072 | WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE |
|
---|
5073 | SWP_ACTIVATE);
|
---|
5074 | if (SHORT1FROMMP(mp1) == IDM_GREP)
|
---|
5075 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,
|
---|
5076 | MPFROM2SHORT(IDM_GREP, 0), MPVOID);
|
---|
5077 | if (SHORT1FROMMP(mp1) == IDM_SEEALL)
|
---|
5078 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,
|
---|
5079 | MPFROM2SHORT(IDM_SEEALL, 0), MPVOID);
|
---|
5080 | }
|
---|
5081 | }
|
---|
5082 | break;
|
---|
5083 |
|
---|
5084 | case IDM_TOOLLEFT:
|
---|
5085 | case IDM_TOOLRIGHT:
|
---|
5086 | {
|
---|
5087 | TOOL *tool;
|
---|
5088 |
|
---|
5089 | if (!toolhead || !toolhead->next) {
|
---|
5090 | firsttool = (toolhead) ? toolhead->id : 0;
|
---|
5091 | break;
|
---|
5092 | }
|
---|
5093 | tool = find_tool(firsttool);
|
---|
5094 | if (!tool)
|
---|
5095 | tool = toolhead;
|
---|
5096 | if (SHORT1FROMMP(mp1) == IDM_TOOLRIGHT) {
|
---|
5097 | tool = prev_tool(tool, TRUE);
|
---|
5098 | firsttool = tool->id;
|
---|
5099 | }
|
---|
5100 | else {
|
---|
5101 | tool = next_tool(tool, TRUE);
|
---|
5102 | firsttool = tool->id;
|
---|
5103 | }
|
---|
5104 | ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
5105 | MAIN_TOOLS));
|
---|
5106 | }
|
---|
5107 | break;
|
---|
5108 |
|
---|
5109 | case IDM_CREATETOOL:
|
---|
5110 | BuildTools(hwndToolback, TRUE);
|
---|
5111 | break;
|
---|
5112 |
|
---|
5113 | case IDM_TOOLBAR:
|
---|
5114 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
5115 | IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar");
|
---|
5116 | BuildTools(hwndToolback, TRUE);
|
---|
5117 | WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
5118 | MAIN_TOOLS), fToolbar);
|
---|
5119 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
5120 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
5121 | if (fDrivebar)
|
---|
5122 | WinInvalidateRect(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
5123 | MAIN_DRIVES), NULL, TRUE);
|
---|
5124 | break;
|
---|
5125 |
|
---|
5126 | case IDM_DRIVEBAR:
|
---|
5127 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
5128 | IDM_DRIVEBAR, &fDrivebar, TRUE, "Drivebar");
|
---|
5129 | WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
5130 | MAIN_DRIVES), fDrivebar);
|
---|
5131 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
5132 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
5133 | PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
|
---|
5134 | break;
|
---|
5135 |
|
---|
5136 | case IDM_USERLIST:
|
---|
5137 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
5138 | SHORT1FROMMP(mp1), &fUserComboBox, TRUE, "UserComboBox");
|
---|
5139 | WinShowWindow(hwndUserlist, fUserComboBox);
|
---|
5140 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
5141 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
5142 | PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
---|
5143 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
---|
5144 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
---|
5145 | PostMsg(hwnd, UM_FILLBUTTONLIST, MPVOID, MPVOID);
|
---|
5146 | break;
|
---|
5147 |
|
---|
5148 | case IDM_MOREBUTTONS:
|
---|
5149 | WinSetWindowText(hwndName, NullStr);
|
---|
5150 | WinSetWindowText(hwndDate, NullStr);
|
---|
5151 | WinSetWindowText(hwndAttr, NullStr);
|
---|
5152 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
5153 | SHORT1FROMMP(mp1), &fMoreButtons, TRUE, "MoreButtons");
|
---|
5154 | if (fMoreButtons) {
|
---|
5155 |
|
---|
5156 | HWND hwndTemp;
|
---|
5157 |
|
---|
5158 | hwndTemp = TopWindow(hwnd, (HWND) 0);
|
---|
5159 |
|
---|
5160 | if (hwndTemp) {
|
---|
5161 | WinSetFocus(HWND_DESKTOP, hwnd);
|
---|
5162 | WinSetFocus(HWND_DESKTOP, hwndTemp);
|
---|
5163 | }
|
---|
5164 | }
|
---|
5165 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
5166 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
5167 | break;
|
---|
5168 |
|
---|
5169 | case IDM_TOGGLEDRAGDIALOG:
|
---|
5170 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
5171 | IDM_TOGGLEDRAGDIALOG,
|
---|
5172 | &fDragndropDlg,
|
---|
5173 | TRUE,
|
---|
5174 | "Drag&DropDlg");
|
---|
5175 | break;
|
---|
5176 |
|
---|
5177 | case IDM_SYNCUPDATES:
|
---|
5178 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
5179 | IDM_SYNCUPDATES,
|
---|
5180 | &fSyncUpdates,
|
---|
5181 | TRUE,
|
---|
5182 | "SyncUpdates");
|
---|
5183 | break;
|
---|
5184 |
|
---|
5185 | case IDM_FREETREE:
|
---|
5186 | if (fFreeTree) {
|
---|
5187 | SWP swp, swpT;
|
---|
5188 |
|
---|
5189 | WinQueryWindowPos(hwndTree, &swpT);
|
---|
5190 | WinQueryWindowPos(hwnd, &swp);
|
---|
5191 | WinSetWindowPos(hwndTree, HWND_TOP, 0, swp.cy - swpT.cy, 0, 0,
|
---|
5192 | SWP_MOVE);
|
---|
5193 | }
|
---|
5194 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
---|
5195 | &fFreeTree, TRUE, "FreeTree");
|
---|
5196 | if (fAutoTile)
|
---|
5197 | TileChildren(hwnd, TRUE);
|
---|
5198 | break;
|
---|
5199 |
|
---|
5200 | case IDM_AUTOTILE:
|
---|
5201 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
5202 | SHORT1FROMMP(mp1), &fAutoTile, TRUE, "AutoTile");
|
---|
5203 | if (fAutoTile)
|
---|
5204 | TileChildren(hwnd, TRUE);
|
---|
5205 | break;
|
---|
5206 |
|
---|
5207 | case IDM_TILEBACKWARDS:
|
---|
5208 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
5209 | SHORT1FROMMP(mp1), &fTileBackwards, TRUE, "TileBackwards");
|
---|
5210 | if (fAutoTile)
|
---|
5211 | TileChildren(hwnd, TRUE);
|
---|
5212 | break;
|
---|
5213 |
|
---|
5214 | case IDM_NEXTWINDOW:
|
---|
5215 | case IDM_PREVWINDOW:
|
---|
5216 | NextChild(hwnd, (SHORT1FROMMP(mp1) == IDM_PREVWINDOW));
|
---|
5217 | break;
|
---|
5218 |
|
---|
5219 | case IDM_CASCADE:
|
---|
5220 | CascadeChildren(hwnd);
|
---|
5221 | break;
|
---|
5222 |
|
---|
5223 | case IDM_TILE:
|
---|
5224 | TileChildren(hwnd, TRUE);
|
---|
5225 | break;
|
---|
5226 |
|
---|
5227 | case IDM_RESTORE:
|
---|
5228 | MinResChildren(hwnd, SWP_RESTORE);
|
---|
5229 | break;
|
---|
5230 |
|
---|
5231 | case IDM_MINIMIZE:
|
---|
5232 | MinResChildren(hwnd, SWP_MINIMIZE);
|
---|
5233 | break;
|
---|
5234 |
|
---|
5235 | case IDM_ARRANGEICONS:
|
---|
5236 | ArrangeIcons(hwnd);
|
---|
5237 | break;
|
---|
5238 |
|
---|
5239 | case IDM_INIVIEWER:
|
---|
5240 | StartIniEditor(hwnd, NULL, 4);
|
---|
5241 | break;
|
---|
5242 |
|
---|
5243 | case IDM_EDITASSOC:
|
---|
5244 | EditAssociations(hwnd);
|
---|
5245 | break;
|
---|
5246 |
|
---|
5247 | case IDM_EDITCOMMANDS:
|
---|
5248 | EditCommands(hwnd);
|
---|
5249 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
---|
5250 | break;
|
---|
5251 |
|
---|
5252 | default:
|
---|
5253 | if (!SwitchCommand((HWND) WinQueryWindowULong(hwnd, QWL_USER),
|
---|
5254 | SHORT1FROMMP(mp1))) {
|
---|
5255 | if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
|
---|
5256 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
|
---|
5257 |
|
---|
5258 | INT x;
|
---|
5259 | HWND hwndCnr;
|
---|
5260 |
|
---|
5261 | if (!cmdloaded)
|
---|
5262 | load_commands();
|
---|
5263 | hwndCnr = TopWindow(hwnd, (HWND) 0);
|
---|
5264 | hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT),
|
---|
5265 | UM_CONTAINERHWND, MPVOID, MPVOID);
|
---|
5266 | if (!hwndCnr) {
|
---|
5267 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT);
|
---|
5268 | break;
|
---|
5269 | }
|
---|
5270 | x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
|
---|
5271 | if (x >= 0) {
|
---|
5272 | x++;
|
---|
5273 | RunCommand(hwndCnr, x);
|
---|
5274 | if (fUnHilite) {
|
---|
5275 |
|
---|
5276 | PCNRITEM pci;
|
---|
5277 | DIRCNRDATA *dcd = NULL;
|
---|
5278 |
|
---|
5279 | // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR?
|
---|
5280 | if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR)
|
---|
5281 | dcd = INSTDATA(hwndCnr);
|
---|
5282 | pci = (PCNRITEM) WinSendMsg(hwndCnr,
|
---|
5283 | CM_QUERYRECORDEMPHASIS,
|
---|
5284 | MPFROMLONG(CMA_FIRST),
|
---|
5285 | MPFROMSHORT(CRA_CURSORED));
|
---|
5286 | if (pci && (INT) pci != -1 &&
|
---|
5287 | (pci->rc.flRecordAttr & CRA_SELECTED))
|
---|
5288 | {
|
---|
5289 | UnHilite(hwnd,
|
---|
5290 | TRUE,
|
---|
5291 | dcd ? &dcd->lastselection : NULL,
|
---|
5292 | dcd ? dcd ->ulItemsToUnHilite : 0);
|
---|
5293 | }
|
---|
5294 | }
|
---|
5295 | }
|
---|
5296 | }
|
---|
5297 | else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART &&
|
---|
5298 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 50) {
|
---|
5299 | if (!qtloaded)
|
---|
5300 | load_quicktools();
|
---|
5301 | if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]) {
|
---|
5302 | if (fToolsChanged)
|
---|
5303 | save_tools(NULL);
|
---|
5304 | if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]))
|
---|
5305 | load_tools(NULL);
|
---|
5306 | else {
|
---|
5307 | strcpy(lasttoolbox,
|
---|
5308 | quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]);
|
---|
5309 | PrfWriteProfileString(fmprof, FM3Str, "LastToolBox", lasttoolbox);
|
---|
5310 | }
|
---|
5311 | BuildTools(hwndToolback, TRUE);
|
---|
5312 | }
|
---|
5313 | }
|
---|
5314 | else {
|
---|
5315 |
|
---|
5316 | HWND hwndActive;
|
---|
5317 |
|
---|
5318 | hwndActive = TopWindow(hwnd, (HWND) 0);
|
---|
5319 | if (hwndActive)
|
---|
5320 | PostMsg(WinWindowFromID(hwndActive, FID_CLIENT),
|
---|
5321 | WM_COMMAND, mp1, mp2);
|
---|
5322 | }
|
---|
5323 | }
|
---|
5324 | break; // default
|
---|
5325 | } // switch mp1
|
---|
5326 | return 0;
|
---|
5327 | }
|
---|
5328 |
|
---|
5329 | static MRESULT EXPENTRY MainWMOnce(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
5330 | MPARAM mp2)
|
---|
5331 | {
|
---|
5332 | TID tid;
|
---|
5333 | SWP swp;
|
---|
5334 | PFNWP oldproc;
|
---|
5335 | HWND hwndTmp;
|
---|
5336 | HWND hwndFrame;
|
---|
5337 | HWND hwndSysMenu, hwndSysSubMenu, hwndMenu;
|
---|
5338 | USHORT idSysMenu;
|
---|
5339 | MENUITEM mi, mit;
|
---|
5340 | ULONG size;
|
---|
5341 | BOOL temp = FALSE;
|
---|
5342 |
|
---|
5343 | switch (msg) {
|
---|
5344 | case WM_CREATE:
|
---|
5345 | WinQueryWindowProcess(hwnd, &mypid, &tid);
|
---|
5346 | hwndMain = hwnd;
|
---|
5347 | WinSetWindowUShort(hwnd, QWL_USER + 8, 0);
|
---|
5348 | WinSetWindowUShort(hwnd, QWL_USER + 10, 0);
|
---|
5349 | WinSetWindowUShort(hwnd, QWL_USER + 12, 0);
|
---|
5350 | WinSetWindowUShort(hwnd, QWL_USER + 16, 0);
|
---|
5351 | if (_beginthread(MakeMainObjWin, NULL, 245760, MPVOID) == -1) {
|
---|
5352 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
5353 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
5354 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
5355 | return 0;
|
---|
5356 | }
|
---|
5357 | else
|
---|
5358 | DosSleep(32);//05 Aug 07 GKY 64
|
---|
5359 |
|
---|
5360 | hwndFrame = WinQueryWindow(hwnd, QW_PARENT);
|
---|
5361 |
|
---|
5362 | /*
|
---|
5363 | * create frame children (not client children, frame children)
|
---|
5364 | */
|
---|
5365 | DosSleep(1);
|
---|
5366 | WinQueryWindowPos(hwndFrame, &swp);
|
---|
5367 | oldproc = WinSubclassWindow(hwndFrame, MainFrameWndProc);
|
---|
5368 | WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
|
---|
5369 | CommonCreateMainChildren(hwnd, &swp);
|
---|
5370 |
|
---|
5371 | if (!WinCreateWindow(hwndFrame,
|
---|
5372 | WC_BUTTON,
|
---|
5373 | "I",
|
---|
5374 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS,
|
---|
5375 | ((swp.cx -
|
---|
5376 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5377 | SV_CXMINMAXBUTTON)) -
|
---|
5378 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5379 | SV_CXMINMAXBUTTON) / 2) -
|
---|
5380 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5381 | SV_CXSIZEBORDER),
|
---|
5382 | (swp.cy - WinQuerySysValue(HWND_DESKTOP,
|
---|
5383 | SV_CYMINMAXBUTTON)) -
|
---|
5384 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5385 | SV_CYSIZEBORDER),
|
---|
5386 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5387 | SV_CXMINMAXBUTTON) / 2,
|
---|
5388 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5389 | SV_CYMINMAXBUTTON),
|
---|
5390 | hwnd, HWND_TOP, IDM_IDEALSIZE, NULL, NULL)) {
|
---|
5391 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
5392 | }
|
---|
5393 | else {
|
---|
5394 | WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_IDEALSIZE),
|
---|
5395 | IdealButtonProc);
|
---|
5396 | SetPresParams(WinWindowFromID(hwndFrame,
|
---|
5397 | IDM_IDEALSIZE),
|
---|
5398 | NULL, NULL, NULL, GetPString(IDS_10SYSTEMVIOTEXT));
|
---|
5399 | }
|
---|
5400 |
|
---|
5401 | hwndTmp = WinCreateWindow(hwndFrame,
|
---|
5402 | WC_BUTTON,
|
---|
5403 | "#1019",
|
---|
5404 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
|
---|
5405 | BS_BITMAP,
|
---|
5406 | swp.cx - 46,
|
---|
5407 | swp.y + 2,
|
---|
5408 | 24,
|
---|
5409 | 22, hwnd, HWND_TOP, IDM_OPENWALK, NULL, NULL);
|
---|
5410 | if (!hwndTmp)
|
---|
5411 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
5412 |
|
---|
5413 | hwndTmp = WinCreateWindow(hwndFrame,
|
---|
5414 | WC_BUTTON,
|
---|
5415 | "#3062",
|
---|
5416 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
|
---|
5417 | BS_BITMAP,
|
---|
5418 | swp.cx - 22,
|
---|
5419 | swp.y + 2,
|
---|
5420 | 24,
|
---|
5421 | 22, hwnd, HWND_TOP, IDM_USERLIST, NULL, NULL);
|
---|
5422 | if (!hwndTmp)
|
---|
5423 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
5424 |
|
---|
5425 | hwndUserlist = WinCreateWindow(hwndFrame,
|
---|
5426 | WC_COMBOBOX,
|
---|
5427 | (PSZ) NULL,
|
---|
5428 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
5429 | LS_HORZSCROLL,
|
---|
5430 | (swp.x +
|
---|
5431 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5432 | SV_CXSIZEBORDER) + 48L),
|
---|
5433 | (swp.cy -
|
---|
5434 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5435 | SV_CYSIZEBORDER)) - 60,
|
---|
5436 | ((swp.cx -
|
---|
5437 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
5438 | SV_CXSIZEBORDER) *
|
---|
5439 | 2)) - 64L), 60L, hwndFrame, HWND_TOP,
|
---|
5440 | MAIN_USERLIST, NULL, NULL);
|
---|
5441 | if (!hwndUserlist)
|
---|
5442 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
5443 | hwndCmdlist = WinCreateWindow(hwndFrame,
|
---|
5444 | WC_COMBOBOX,
|
---|
5445 | (PSZ) NULL,
|
---|
5446 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
5447 | LS_HORZSCROLL,
|
---|
5448 | (swp.x +
|
---|
5449 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5450 | SV_CXSIZEBORDER) + 48L),
|
---|
5451 | (swp.cy -
|
---|
5452 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5453 | SV_CYSIZEBORDER)) - 60,
|
---|
5454 | ((swp.cx -
|
---|
5455 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
5456 | SV_CXSIZEBORDER) * 2)) -
|
---|
5457 | 64L), 60L, hwndFrame, HWND_TOP,
|
---|
5458 | MAIN_CMDLIST, NULL, NULL);
|
---|
5459 | if (!hwndCmdlist)
|
---|
5460 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
5461 | WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));
|
---|
5462 | hwndStatelist = WinCreateWindow(hwndFrame,
|
---|
5463 | WC_COMBOBOX,
|
---|
5464 | (PSZ) NULL,
|
---|
5465 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
5466 | LS_HORZSCROLL,
|
---|
5467 | (swp.x +
|
---|
5468 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5469 | SV_CXSIZEBORDER) + 48L),
|
---|
5470 | (swp.cy -
|
---|
5471 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5472 | SV_CYSIZEBORDER)) - 60,
|
---|
5473 | ((swp.cx -
|
---|
5474 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
5475 | SV_CXSIZEBORDER) *
|
---|
5476 | 2)) - 64L), 60L, hwndFrame, HWND_TOP,
|
---|
5477 | MAIN_SETUPLIST, NULL, NULL);
|
---|
5478 | if (!hwndStatelist)
|
---|
5479 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
5480 |
|
---|
5481 | hwndDrivelist = WinCreateWindow(hwndFrame,
|
---|
5482 | WC_COMBOBOX,
|
---|
5483 | (PSZ) NULL,
|
---|
5484 | WS_VISIBLE | CBS_DROPDOWN,
|
---|
5485 | (swp.x +
|
---|
5486 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5487 | SV_CXSIZEBORDER)),
|
---|
5488 | (swp.cy -
|
---|
5489 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5490 | SV_CYSIZEBORDER)) - 60,
|
---|
5491 | 48L,
|
---|
5492 | 60L,
|
---|
5493 | hwndFrame,
|
---|
5494 | HWND_TOP, MAIN_DRIVELIST, NULL, NULL);
|
---|
5495 | if (!hwndDrivelist)
|
---|
5496 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
5497 | SetPresParams(hwndDrivelist,
|
---|
5498 | NULL, NULL, NULL, GetPString(IDS_10SYSTEMMONOTEXT));
|
---|
5499 | hwndButtonlist = WinCreateWindow(hwndFrame,
|
---|
5500 | WC_COMBOBOX,
|
---|
5501 | (PSZ) NULL,
|
---|
5502 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
5503 | LS_HORZSCROLL,
|
---|
5504 | (swp.cx -
|
---|
5505 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5506 | SV_CXSIZEBORDER)) -
|
---|
5507 | 164L,
|
---|
5508 | (swp.cy -
|
---|
5509 | WinQuerySysValue(HWND_DESKTOP,
|
---|
5510 | SV_CYSIZEBORDER)) - 60,
|
---|
5511 | 164L, 60L, hwndFrame, HWND_TOP,
|
---|
5512 | MAIN_BUTTONLIST, NULL, NULL);
|
---|
5513 | if (!hwndButtonlist)
|
---|
5514 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
5515 | WinSendMsg(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
---|
5516 | EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
|
---|
5517 | WinSendMsg(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
---|
5518 | EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID);
|
---|
5519 | WinSendMsg(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
5520 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
---|
5521 | WinSendMsg(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
---|
5522 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
---|
5523 | WinSendMsg(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
---|
5524 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
---|
5525 |
|
---|
5526 | oldproc = WinSubclassWindow(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
---|
5527 | DropDownListProc);
|
---|
5528 | WinSetWindowPtr(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
---|
5529 | QWL_USER, (PVOID) oldproc);
|
---|
5530 | oldproc = WinSubclassWindow(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
---|
5531 | DropDownListProc);
|
---|
5532 | WinSetWindowPtr(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
---|
5533 | QWL_USER, (PVOID) oldproc);
|
---|
5534 | oldproc = WinSubclassWindow(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
---|
5535 | DropDownListProc);
|
---|
5536 | WinSetWindowPtr(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
---|
5537 | QWL_USER, (PVOID) oldproc);
|
---|
5538 | oldproc = WinSubclassWindow(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
---|
5539 | DropDownListProc);
|
---|
5540 | WinSetWindowPtr(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
---|
5541 | QWL_USER, (PVOID) oldproc);
|
---|
5542 | oldproc = WinSubclassWindow(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
5543 | DropDownListProc);
|
---|
5544 | WinSetWindowPtr(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
5545 | QWL_USER, (PVOID) oldproc);
|
---|
5546 | oldproc = WinSubclassWindow(hwndUserlist, DropDownListProc);
|
---|
5547 | WinSetWindowPtr(hwndUserlist, QWL_USER, (PVOID) oldproc);
|
---|
5548 | oldproc = WinSubclassWindow(hwndCmdlist, DropDownListProc);
|
---|
5549 | WinSetWindowPtr(hwndCmdlist, QWL_USER, (PVOID) oldproc);
|
---|
5550 | oldproc = WinSubclassWindow(hwndStatelist, DropDownListProc);
|
---|
5551 | WinSetWindowPtr(hwndStatelist, QWL_USER, (PVOID) oldproc);
|
---|
5552 | oldproc = WinSubclassWindow(hwndDrivelist, DropDownListProc);
|
---|
5553 | WinSetWindowPtr(hwndDrivelist, QWL_USER, (PVOID) oldproc);
|
---|
5554 | oldproc = WinSubclassWindow(hwndButtonlist, DropDownListProc);
|
---|
5555 | WinSetWindowPtr(hwndButtonlist, QWL_USER, (PVOID) oldproc);
|
---|
5556 | oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_USERLIST),
|
---|
5557 | ChildFrameButtonProc);
|
---|
5558 | WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_USERLIST),
|
---|
5559 | QWL_USER, (PVOID) oldproc);
|
---|
5560 | oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_OPENWALK),
|
---|
5561 | ChildFrameButtonProc);
|
---|
5562 | WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_OPENWALK),
|
---|
5563 | QWL_USER, (PVOID) oldproc);
|
---|
5564 | hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
|
---|
5565 | WinSendMsg(hwnd, UM_ADDTOMENU, MPVOID, MPVOID);
|
---|
5566 | SetToggleChecks(hwndMenu);
|
---|
5567 | CfgMenuInit(hwndMenu, FALSE); // 14 Feb 08 SHL
|
---|
5568 | SetConditionalCascade(hwndMenu, IDM_COMMANDLINESUBMENU, IDM_COMMANDLINE);
|
---|
5569 | SetConditionalCascade(hwndMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
|
---|
5570 | SetConditionalCascade(hwndMenu, IDM_AUTOVIEWSUBMENU, IDM_AUTOVIEW);
|
---|
5571 | SetConditionalCascade(hwndMenu, IDM_TILEMENU, IDM_TILE);
|
---|
5572 | WinSetWindowULong(hwnd, QWL_USER, hwndMenu);
|
---|
5573 | memset(&mi, 0, sizeof(mi));
|
---|
5574 | memset(&mit, 0, sizeof(mit));
|
---|
5575 | hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU);
|
---|
5576 | idSysMenu = SHORT1FROMMR(WinSendMsg(hwndSysMenu,
|
---|
5577 | MM_ITEMIDFROMPOSITION,
|
---|
5578 | MPVOID, MPVOID));
|
---|
5579 | WinSendMsg(hwndSysMenu,
|
---|
5580 | MM_QUERYITEM, MPFROM2SHORT(idSysMenu, 0), MPFROMP(&mit));
|
---|
5581 | hwndSysSubMenu = mit.hwndSubMenu;
|
---|
5582 | mi.iPosition = MIT_END;
|
---|
5583 | mi.afStyle = MIS_SEPARATOR;
|
---|
5584 | mi.id = (USHORT) - 1;
|
---|
5585 | WinSendMsg(hwndSysSubMenu, MM_INSERTITEM, MPFROMP(&mi), MPFROMP(NULL));
|
---|
5586 | mi.afStyle = MIS_TEXT;
|
---|
5587 | mi.id = IDM_IDEALSIZE;
|
---|
5588 | WinSendMsg(hwndSysSubMenu,
|
---|
5589 | MM_INSERTITEM,
|
---|
5590 | MPFROMP(&mi), MPFROMP(GetPString(IDS_IDEALMENUTEXT)));
|
---|
5591 | mi.afStyle = MIS_TEXT;
|
---|
5592 | mi.id = IDM_HIDEMENU;
|
---|
5593 | WinSendMsg(hwndSysSubMenu,
|
---|
5594 | MM_INSERTITEM,
|
---|
5595 | MPFROMP(&mi), MPFROMP(GetPString(IDS_HIDEMENUTEXT)));
|
---|
5596 | SetSysMenu(hwndSysMenu);
|
---|
5597 |
|
---|
5598 | size = sizeof(BOOL);
|
---|
5599 | if (PrfQueryProfileData(fmprof,
|
---|
5600 | FM3Str,
|
---|
5601 | "MenuInvisible", &temp, &size) && size && temp)
|
---|
5602 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
|
---|
5603 | size = sizeof(BOOL);
|
---|
5604 | if (PrfQueryProfileData(fmprof,
|
---|
5605 | FM3Str, "FreeTree", &temp, &size) && size && temp)
|
---|
5606 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID);
|
---|
5607 | size = sizeof(BOOL);
|
---|
5608 | if (PrfQueryProfileData(fmprof,
|
---|
5609 | FM3Str,
|
---|
5610 | "AutoTile", &temp, &size) && size && !temp)
|
---|
5611 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID);
|
---|
5612 | size = sizeof(BOOL);
|
---|
5613 | if (PrfQueryProfileData(fmprof,
|
---|
5614 | FM3Str, "Toolbar", &temp, &size) && size && !temp)
|
---|
5615 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
|
---|
5616 |
|
---|
5617 | WinSetWindowText(WinWindowFromID(hwndFrame, FID_TITLEBAR), "FM/2");
|
---|
5618 | FixSwitchList(hwndFrame, NULL);
|
---|
5619 | break; // WM_CREATE
|
---|
5620 |
|
---|
5621 | case UM_SETUP:
|
---|
5622 | /*
|
---|
5623 | * start up some initial children
|
---|
5624 | */
|
---|
5625 | load_tools(NULL);
|
---|
5626 | BuildTools(hwndToolback, TRUE);
|
---|
5627 | WinShowWindow(WinQueryWindow(hwnd, QW_PARENT), TRUE);
|
---|
5628 | PostMsg(MainObjectHwnd, UM_SETUP2, mp1, mp2);
|
---|
5629 | return 0;
|
---|
5630 |
|
---|
5631 | case UM_SETUP2:
|
---|
5632 | {
|
---|
5633 | SWP swp;
|
---|
5634 | ULONG size = sizeof(SWP);
|
---|
5635 |
|
---|
5636 | WinQueryWindowPos(hwnd, &swp);
|
---|
5637 | hwndTree = StartTreeCnr(hwnd, 4);
|
---|
5638 | if (!hwndTree)
|
---|
5639 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
---|
5640 | else {
|
---|
5641 | if (!fSaveState ||
|
---|
5642 | !PrfQueryProfileData(fmprof,
|
---|
5643 | FM3Str,
|
---|
5644 | "LastTreePos",
|
---|
5645 | &swp, &size) || size != sizeof(SWP)) {
|
---|
5646 |
|
---|
5647 | INT ratio, height = 0;
|
---|
5648 |
|
---|
5649 | if (!fNoTreeGap)
|
---|
5650 | height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
5651 | size = sizeof(ratio);
|
---|
5652 | if (!PrfQueryProfileData(fmprof,
|
---|
5653 | FM3Str,
|
---|
5654 | "TreeWindowRatio",
|
---|
5655 | (PVOID) & ratio,
|
---|
5656 | &size) || size < sizeof(ratio))
|
---|
5657 | ratio = 400;
|
---|
5658 | WinSetWindowPos(hwndTree,
|
---|
5659 | HWND_TOP,
|
---|
5660 | 0,
|
---|
5661 | height,
|
---|
5662 | (swp.cx * 100) / ratio,
|
---|
5663 | swp.cy - height,
|
---|
5664 | SWP_SHOW | SWP_SIZE | SWP_MOVE |
|
---|
5665 | SWP_ACTIVATE | SWP_ZORDER);
|
---|
5666 | }
|
---|
5667 | else
|
---|
5668 | WinSetWindowPos(hwndTree,
|
---|
5669 | HWND_TOP,
|
---|
5670 | swp.x,
|
---|
5671 | swp.y,
|
---|
5672 | swp.cx,
|
---|
5673 | swp.cy,
|
---|
5674 | swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW |
|
---|
5675 | SWP_ZORDER | SWP_ACTIVATE);
|
---|
5676 | }
|
---|
5677 | ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
5678 | MAIN_TOOLS));
|
---|
5679 | }
|
---|
5680 | PostMsg(MainObjectHwnd, UM_SETUP3, mp1, mp2);
|
---|
5681 | return 0;
|
---|
5682 |
|
---|
5683 | case UM_SETUP3:
|
---|
5684 | /* start remaining child windows */
|
---|
5685 | if (!fNoSaveState && fSaveState)
|
---|
5686 | PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(GetPString(IDS_SHUTDOWNSTATE)), MPVOID);
|
---|
5687 | PostMsg(MainObjectHwnd, UM_SETUP4, mp1, mp2);
|
---|
5688 | return 0;
|
---|
5689 |
|
---|
5690 | case UM_SETUP4:
|
---|
5691 | {
|
---|
5692 | INT argc = (INT) mp1, x;
|
---|
5693 | CHAR **argv = (CHAR **) mp2;
|
---|
5694 |
|
---|
5695 | for (x = 1; x < argc; x++) {
|
---|
5696 | if (*argv[x] == '/' || *argv[x] == ';')
|
---|
5697 | continue;
|
---|
5698 | if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE))
|
---|
5699 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]);
|
---|
5700 | }
|
---|
5701 | }
|
---|
5702 | PostMsg(MainObjectHwnd, UM_SETUP5, MPVOID, MPVOID);
|
---|
5703 | return 0;
|
---|
5704 |
|
---|
5705 | case UM_SETUP5:
|
---|
5706 | if (fAutoTile)
|
---|
5707 | TileChildren(hwnd, TRUE);
|
---|
5708 | PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
---|
5709 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
---|
5710 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
---|
5711 | PostMsg(hwnd, UM_FILLBUTTONLIST, MPVOID, MPVOID);
|
---|
5712 | {
|
---|
5713 | HWND hwndActive;
|
---|
5714 |
|
---|
5715 | hwndActive = TopWindow(hwnd, hwndTree);
|
---|
5716 | if (hwndActive)
|
---|
5717 | WinSetWindowPos(hwndActive, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
|
---|
5718 | }
|
---|
5719 | if (fStartMinimized || fReminimize)
|
---|
5720 | PostMsg(hwndTree, UM_MINIMIZE, MPVOID, MPVOID);
|
---|
5721 | else if (fStartMaximized)
|
---|
5722 | PostMsg(hwndTree, UM_MAXIMIZE, MPVOID, MPVOID);
|
---|
5723 | fRunning = TRUE;
|
---|
5724 | if (fWantFirstTimeInit) {
|
---|
5725 | fWantFirstTimeInit = FALSE;
|
---|
5726 | PostMsg(hwnd, WM_COMMAND, MPFROMLONG(IDM_QUICKSETTINGS), MPVOID);
|
---|
5727 | }
|
---|
5728 | return 0;
|
---|
5729 | }
|
---|
5730 |
|
---|
5731 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
5732 | }
|
---|
5733 |
|
---|
5734 | MRESULT EXPENTRY MainWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
5735 | {
|
---|
5736 | switch (msg) {
|
---|
5737 | case WM_CREATE:
|
---|
5738 | case UM_SETUP:
|
---|
5739 | case UM_SETUP2:
|
---|
5740 | case UM_SETUP3:
|
---|
5741 | case UM_SETUP4:
|
---|
5742 | case UM_SETUP5:
|
---|
5743 | return MainWMOnce(hwnd, msg, mp1, mp2);
|
---|
5744 |
|
---|
5745 | case WM_CONTROLPOINTER:
|
---|
5746 | if (!fNoFinger &&
|
---|
5747 | (SHORT1FROMMP(mp1) == IDM_OPENWALK ||
|
---|
5748 | SHORT1FROMMP(mp1) == IDM_USERLIST))
|
---|
5749 | return MRFROMLONG(hptrFinger);
|
---|
5750 | break;
|
---|
5751 |
|
---|
5752 | case UM_LOADFILE:
|
---|
5753 | case UM_THREADUSE:
|
---|
5754 | case UM_BUILDDRIVEBAR:
|
---|
5755 | return CommonMainWndProc(hwnd, msg, mp1, mp2);
|
---|
5756 |
|
---|
5757 | case WM_BUTTON1UP:
|
---|
5758 | case WM_BUTTON2UP:
|
---|
5759 | case WM_BUTTON3UP:
|
---|
5760 | case WM_MOUSEMOVE:
|
---|
5761 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
5762 | break;
|
---|
5763 |
|
---|
5764 | case WM_CHAR:
|
---|
5765 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
5766 | break;
|
---|
5767 |
|
---|
5768 | case WM_MENUEND:
|
---|
5769 | if ((HWND) mp2 == MainPopupMenu) {
|
---|
5770 | WinDestroyWindow(MainPopupMenu);
|
---|
5771 | MainPopupMenu = (HWND) 0;
|
---|
5772 | }
|
---|
5773 | break;
|
---|
5774 |
|
---|
5775 | case UM_CONTEXTMENU:
|
---|
5776 | case WM_CONTEXTMENU:
|
---|
5777 | if (CheckMenu(hwndMainMenu, &MainPopupMenu, MAIN_POPUP)) {
|
---|
5778 | SetToggleChecks(MainPopupMenu);
|
---|
5779 | PopupMenu(hwnd, hwnd, MainPopupMenu);
|
---|
5780 | }
|
---|
5781 | if (msg == UM_CONTEXTMENU)
|
---|
5782 | return 0;
|
---|
5783 | return MRFROMSHORT(TRUE);
|
---|
5784 |
|
---|
5785 | case UM_SETUSERLISTNAME:
|
---|
5786 | if (mp1) {
|
---|
5787 | if (fUserComboBox)
|
---|
5788 | WinSetWindowText(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
---|
5789 | (CHAR *) mp1);
|
---|
5790 | if (add_udir(FALSE, (CHAR *) mp1)) {
|
---|
5791 | if (fUserComboBox && fAutoAddDirs) {
|
---|
5792 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
---|
5793 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
5794 | MPFROMP((CHAR *) mp1));
|
---|
5795 | }
|
---|
5796 | }
|
---|
5797 | }
|
---|
5798 | return 0;
|
---|
5799 |
|
---|
5800 | case UM_ARRANGEICONS:
|
---|
5801 | ArrangeIcons(hwnd);
|
---|
5802 | return 0;
|
---|
5803 |
|
---|
5804 | case WM_CHORD:
|
---|
5805 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
---|
5806 | break;
|
---|
5807 |
|
---|
5808 | case WM_SETFOCUS:
|
---|
5809 | if (mp2)
|
---|
5810 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
5811 | break;
|
---|
5812 |
|
---|
5813 | case UM_FOCUSME:
|
---|
5814 | WinSetFocus(hwndTree, TRUE);
|
---|
5815 | return 0;
|
---|
5816 |
|
---|
5817 | case UM_RESCAN:
|
---|
5818 | TileChildren(hwnd, TRUE);
|
---|
5819 | return 0;
|
---|
5820 |
|
---|
5821 | case WM_SAVEAPPLICATION:
|
---|
5822 | {
|
---|
5823 | SWP swp;
|
---|
5824 |
|
---|
5825 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
---|
5826 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) {
|
---|
5827 | WinStoreWindowPos(FM2Str,
|
---|
5828 | "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT));
|
---|
5829 | if (!fNoSaveState && fSaveState)
|
---|
5830 | SaveDirCnrState(hwnd, GetPString(IDS_SHUTDOWNSTATE));
|
---|
5831 | }
|
---|
5832 | }
|
---|
5833 | break;
|
---|
5834 |
|
---|
5835 | case MM_PORTHOLEINIT:
|
---|
5836 | switch (SHORT1FROMMP(mp1)) {
|
---|
5837 | case 0:
|
---|
5838 | case 1:
|
---|
5839 | {
|
---|
5840 | HWND hwndCurrent;
|
---|
5841 | ULONG wmsg;
|
---|
5842 |
|
---|
5843 | wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
|
---|
5844 | hwndCurrent = TopWindow(hwnd, (HWND) 0);
|
---|
5845 | PortholeInit((HWND) WinSendMsg(WinWindowFromID(hwndCurrent,
|
---|
5846 | FID_CLIENT), wmsg,
|
---|
5847 | MPVOID, MPVOID), mp1, mp2);
|
---|
5848 | }
|
---|
5849 | break;
|
---|
5850 | }
|
---|
5851 | break;
|
---|
5852 |
|
---|
5853 | case WM_INITMENU:
|
---|
5854 | switch (SHORT1FROMMP(mp1)) {
|
---|
5855 | case IDM_CONFIGMENU:
|
---|
5856 | SetToggleChecks((HWND) WinQueryWindowULong(hwnd, QWL_USER));
|
---|
5857 | break;
|
---|
5858 |
|
---|
5859 | case IDM_WINDOWSMENU:
|
---|
5860 | /*
|
---|
5861 | * add child windows of client
|
---|
5862 | * and switchlist entries to end of pulldown menu
|
---|
5863 | */
|
---|
5864 | {
|
---|
5865 | HWND hwndMenu, hwndSubMenu;
|
---|
5866 | MENUITEM mi;
|
---|
5867 |
|
---|
5868 | hwndMenu = WinQueryWindowULong(hwnd, QWL_USER);
|
---|
5869 | memset(&mi, 0, sizeof(mi));
|
---|
5870 | mi.iPosition = MIT_END;
|
---|
5871 | mi.afStyle = MIS_TEXT;
|
---|
5872 | if (!WinSendMsg(hwndMenu, MM_QUERYITEM,
|
---|
5873 | MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))
|
---|
5874 | break;
|
---|
5875 | hwndSubMenu = mi.hwndSubMenu;
|
---|
5876 | SetupWinList(hwndSubMenu, hwnd, WinQueryWindow(hwnd, QW_PARENT));
|
---|
5877 | }
|
---|
5878 | break;
|
---|
5879 |
|
---|
5880 | default:
|
---|
5881 | {
|
---|
5882 | HWND hwndCurrent;
|
---|
5883 |
|
---|
5884 | hwndCurrent = TopWindow(hwnd, (HWND) 0);
|
---|
5885 | if (hwndCurrent)
|
---|
5886 | WinSendMsg(hwndCurrent, UM_INITMENU, mp1, mp2);
|
---|
5887 | }
|
---|
5888 | break;
|
---|
5889 | }
|
---|
5890 | break;
|
---|
5891 |
|
---|
5892 | case UM_ADDTOMENU:
|
---|
5893 | AddToMenu((CHAR *) mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
5894 | FID_MENU));
|
---|
5895 | return 0;
|
---|
5896 |
|
---|
5897 | case UM_FILLCMDLIST:
|
---|
5898 | WinSendMsg(hwndCmdlist, LM_DELETEALL, MPVOID, MPVOID);
|
---|
5899 | if (!cmdloaded)
|
---|
5900 | load_commands();
|
---|
5901 | if (cmdhead) {
|
---|
5902 |
|
---|
5903 | LINKCMDS *info;
|
---|
5904 |
|
---|
5905 | info = cmdhead;
|
---|
5906 | while (info) {
|
---|
5907 | WinSendMsg(hwndCmdlist, LM_INSERTITEM,
|
---|
5908 | MPFROM2SHORT(LIT_END, 0), MPFROMP(info->title));
|
---|
5909 | info = info->next;
|
---|
5910 | }
|
---|
5911 | }
|
---|
5912 | return 0;
|
---|
5913 |
|
---|
5914 | case UM_FILLSETUPLIST:
|
---|
5915 | fill_setups_list();
|
---|
5916 | return 0;
|
---|
5917 |
|
---|
5918 | case UM_FILLBUTTONLIST:
|
---|
5919 | WinSendMsg(hwndButtonlist, LM_DELETEALL, MPVOID, MPVOID);
|
---|
5920 | if (fUserComboBox) {
|
---|
5921 |
|
---|
5922 | BOOL foundit = FALSE, thisone;
|
---|
5923 | ULONG ulSearchCount;
|
---|
5924 | SHORT sSelect;
|
---|
5925 | FILEFINDBUF3 findbuf;
|
---|
5926 | HDIR hDir;
|
---|
5927 | CHAR *p;
|
---|
5928 |
|
---|
5929 | DosError(FERR_DISABLEHARDERR);
|
---|
5930 | hDir = HDIR_CREATE;
|
---|
5931 | ulSearchCount = 1;
|
---|
5932 | if (!DosFindFirst("*.TLS", &hDir, FILE_READONLY | FILE_ARCHIVED,
|
---|
5933 | &findbuf, sizeof(FILEFINDBUF3),
|
---|
5934 | &ulSearchCount, FIL_STANDARD)) {
|
---|
5935 | do {
|
---|
5936 | priority_bumped();
|
---|
5937 | if (!foundit) {
|
---|
5938 | thisone = FALSE;
|
---|
5939 | p = strrchr(lasttoolbox, '\\');
|
---|
5940 | if (!p)
|
---|
5941 | p = lasttoolbox;
|
---|
5942 | else
|
---|
5943 | p++;
|
---|
5944 | if (!stricmp(findbuf.achName, p))
|
---|
5945 | thisone = TRUE;
|
---|
5946 | }
|
---|
5947 | p = strrchr(findbuf.achName, '.');
|
---|
5948 | if (p)
|
---|
5949 | *p = 0;
|
---|
5950 | sSelect = (SHORT) WinSendMsg(hwndButtonlist, LM_INSERTITEM,
|
---|
5951 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
5952 | MPFROMP(findbuf.achName));
|
---|
5953 | if (!foundit && thisone && sSelect >= 0) {
|
---|
5954 | WinSendMsg(hwndButtonlist, LM_SELECTITEM,
|
---|
5955 | MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE));
|
---|
5956 | foundit = TRUE;
|
---|
5957 | }
|
---|
5958 | }
|
---|
5959 | while (!DosFindNext(hDir, &findbuf, sizeof(FILEFINDBUF3),
|
---|
5960 | &ulSearchCount));
|
---|
5961 | DosFindClose(hDir);
|
---|
5962 | priority_bumped();
|
---|
5963 | }
|
---|
5964 | WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT));
|
---|
5965 | }
|
---|
5966 | return 0;
|
---|
5967 |
|
---|
5968 | case UM_FILLUSERLIST:
|
---|
5969 | WinSendMsg(hwndUserlist, LM_DELETEALL, MPVOID, MPVOID);
|
---|
5970 | if (fUserComboBox) {
|
---|
5971 | ULONG ulDriveNum;
|
---|
5972 | ULONG ulDriveMap;
|
---|
5973 | ULONG ulSearchCount;
|
---|
5974 | FILEFINDBUF3 findbuf;
|
---|
5975 | HDIR hDir;
|
---|
5976 | APIRET rc;
|
---|
5977 | LINKDIRS *info;
|
---|
5978 | LINKDIRS *temp;
|
---|
5979 |
|
---|
5980 | if (!loadedudirs)
|
---|
5981 | load_udirs();
|
---|
5982 | DosError(FERR_DISABLEHARDERR);
|
---|
5983 | DosQCurDisk(&ulDriveNum, &ulDriveMap);
|
---|
5984 | info = udirhead;
|
---|
5985 | while (info) {
|
---|
5986 | if (IsFullName(info->path) &&
|
---|
5987 | !(driveflags[toupper(*info->path) - 'A'] &
|
---|
5988 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
---|
5989 | DosError(FERR_DISABLEHARDERR);
|
---|
5990 | hDir = HDIR_CREATE;
|
---|
5991 | ulSearchCount = 1;
|
---|
5992 | if (!IsRoot(info->path))
|
---|
5993 | rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
|
---|
5994 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
5995 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
5996 | &findbuf, sizeof(FILEFINDBUF3),
|
---|
5997 | &ulSearchCount, FIL_STANDARD);
|
---|
5998 | else {
|
---|
5999 | rc = 0;
|
---|
6000 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
6001 | }
|
---|
6002 | priority_bumped();
|
---|
6003 | if (!rc) {
|
---|
6004 | if (!IsRoot(info->path))
|
---|
6005 | DosFindClose(hDir);
|
---|
6006 | if (findbuf.attrFile & FILE_DIRECTORY)
|
---|
6007 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
---|
6008 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
6009 | MPFROMP(info->path));
|
---|
6010 | else {
|
---|
6011 | temp = info->next;
|
---|
6012 | remove_udir(info->path);
|
---|
6013 | info = temp;
|
---|
6014 | continue;
|
---|
6015 | }
|
---|
6016 | }
|
---|
6017 | else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
|
---|
6018 | temp = info->next;
|
---|
6019 | remove_udir(info->path);
|
---|
6020 | info = temp;
|
---|
6021 | continue;
|
---|
6022 | }
|
---|
6023 | }
|
---|
6024 | info = info->next;
|
---|
6025 | }
|
---|
6026 | info = ldirhead;
|
---|
6027 | while (info) {
|
---|
6028 | if (IsFullName(info->path) &&
|
---|
6029 | !(driveflags[toupper(*info->path) - 'A'] &
|
---|
6030 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
---|
6031 | DosError(FERR_DISABLEHARDERR);
|
---|
6032 | hDir = HDIR_CREATE;
|
---|
6033 | ulSearchCount = 1;
|
---|
6034 | if (!IsRoot(info->path))
|
---|
6035 | rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
|
---|
6036 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
6037 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
6038 | &findbuf, sizeof(FILEFINDBUF3),
|
---|
6039 | &ulSearchCount, FIL_STANDARD);
|
---|
6040 | else {
|
---|
6041 | rc = 0;
|
---|
6042 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
6043 | }
|
---|
6044 | priority_bumped();
|
---|
6045 | if (!rc) {
|
---|
6046 | if (!IsRoot(info->path))
|
---|
6047 | DosFindClose(hDir);
|
---|
6048 | if (findbuf.attrFile & FILE_DIRECTORY)
|
---|
6049 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
---|
6050 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
6051 | MPFROMP(info->path));
|
---|
6052 | else {
|
---|
6053 | temp = info->next;
|
---|
6054 | remove_udir(info->path);
|
---|
6055 | info = temp;
|
---|
6056 | continue;
|
---|
6057 | }
|
---|
6058 | }
|
---|
6059 | else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
|
---|
6060 | temp = info->next;
|
---|
6061 | remove_udir(info->path);
|
---|
6062 | info = temp;
|
---|
6063 | continue;
|
---|
6064 | }
|
---|
6065 | }
|
---|
6066 | info = info->next;
|
---|
6067 | }
|
---|
6068 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
---|
6069 | MPFROM2SHORT(0, 0),
|
---|
6070 | MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT)));
|
---|
6071 | WinSetWindowText(hwndUserlist, GetPString(IDS_COMMONDIRTEXT));
|
---|
6072 | }
|
---|
6073 | return 0;
|
---|
6074 |
|
---|
6075 | case UM_SIZE:
|
---|
6076 | if (fAutoTile)
|
---|
6077 | TileChildren(hwnd, FALSE);
|
---|
6078 | else
|
---|
6079 | MoveChildrenAwayFromTree(hwnd);
|
---|
6080 | return 0;
|
---|
6081 |
|
---|
6082 | case WM_SIZE:
|
---|
6083 | ResizeChildren(hwnd, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1),
|
---|
6084 | SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
|
---|
6085 | break;
|
---|
6086 |
|
---|
6087 | case WM_ERASEBACKGROUND:
|
---|
6088 | WinFillRect((HPS) mp1, (PRECTL) mp2, 0x00d0d0d0);
|
---|
6089 | return 0;
|
---|
6090 |
|
---|
6091 | case WM_PAINT:
|
---|
6092 | {
|
---|
6093 | HPS hps;
|
---|
6094 | RECTL rcl;
|
---|
6095 |
|
---|
6096 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
---|
6097 | if (hps) {
|
---|
6098 | WinQueryWindowRect(hwnd, &rcl);
|
---|
6099 | WinFillRect(hps, &rcl, CLR_PALEGRAY);
|
---|
6100 | WinEndPaint(hps);
|
---|
6101 | }
|
---|
6102 | }
|
---|
6103 | break;
|
---|
6104 |
|
---|
6105 | case UM_CONTROL:
|
---|
6106 | switch (SHORT1FROMMP(mp1)) {
|
---|
6107 | case MAIN_CMDLIST:
|
---|
6108 | case MAIN_SETUPLIST:
|
---|
6109 | case MAIN_DRIVELIST:
|
---|
6110 | case MAIN_USERLIST:
|
---|
6111 | case MAIN_BUTTONLIST:
|
---|
6112 | switch (SHORT2FROMMP(mp1)) {
|
---|
6113 | case CBN_ENTER:
|
---|
6114 | {
|
---|
6115 | HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
6116 | SHORT1FROMMP(mp1));
|
---|
6117 | CHAR path[CCHMAXPATH];
|
---|
6118 | ULONG ul;
|
---|
6119 |
|
---|
6120 | switch (SHORT1FROMMP(mp1)) {
|
---|
6121 | case MAIN_USERLIST:
|
---|
6122 | ul = CCHMAXPATH;
|
---|
6123 | break;
|
---|
6124 | case MAIN_SETUPLIST:
|
---|
6125 | ul = STATE_NAME_MAX_BYTES;
|
---|
6126 | break;
|
---|
6127 | default:
|
---|
6128 | ul = 13; // fixme to not be hardcoded
|
---|
6129 | }
|
---|
6130 |
|
---|
6131 | SetShiftState();
|
---|
6132 | WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path);
|
---|
6133 | bstrip(path);
|
---|
6134 | if (*path) {
|
---|
6135 | if (SHORT1FROMMP(mp1) == MAIN_USERLIST) {
|
---|
6136 | if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) {
|
---|
6137 | if (!LastDir ||
|
---|
6138 | !WinSendMsg(WinQueryWindow(LastDir, QW_PARENT),
|
---|
6139 | UM_CONTAINERDIR, MPFROMP(path), MPVOID))
|
---|
6140 | save_dir2(path);
|
---|
6141 | if (!PMMkDir(hwnd, path, TRUE)) {
|
---|
6142 | WinSetWindowText(hwndUL, GetPString(IDS_COMMONDIRTEXT));
|
---|
6143 | break;
|
---|
6144 | }
|
---|
6145 | }
|
---|
6146 | if (!IsFile(path) && !FindDirCnrByName(path, TRUE)) {
|
---|
6147 |
|
---|
6148 | HWND hwndDir;
|
---|
6149 |
|
---|
6150 | if ((fUserListSwitches &&
|
---|
6151 | !(shiftstate & KC_SHIFT)) ||
|
---|
6152 | (!fUserListSwitches && (shiftstate & KC_SHIFT))) {
|
---|
6153 | hwndDir = FindDirCnr(hwnd);
|
---|
6154 | if (hwndDir) {
|
---|
6155 | WinSendMsg(LastDir, UM_SETDIR, MPFROMP(path), MPVOID);
|
---|
6156 | break;
|
---|
6157 | }
|
---|
6158 | }
|
---|
6159 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, path);
|
---|
6160 | }
|
---|
6161 | }
|
---|
6162 | else if (SHORT1FROMMP(mp1) == MAIN_DRIVELIST) {
|
---|
6163 | ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree,
|
---|
6164 | FID_CLIENT),
|
---|
6165 | TREE_CNR), path, FALSE, TRUE);
|
---|
6166 | WinSetFocus(HWND_DESKTOP, hwndTree);
|
---|
6167 | }
|
---|
6168 | else if (SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) {
|
---|
6169 | strcat(path, ".TLS");
|
---|
6170 | load_tools(path);
|
---|
6171 | PrfWriteProfileString(fmprof,
|
---|
6172 | FM3Str, "LastToolBox", lasttoolbox);
|
---|
6173 | BuildTools(hwndToolback, TRUE);
|
---|
6174 | WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT));
|
---|
6175 | }
|
---|
6176 | else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) {
|
---|
6177 | CHAR szKey[80];
|
---|
6178 | ULONG size, numsaves = 0;
|
---|
6179 |
|
---|
6180 | SetShiftState();
|
---|
6181 | size = sizeof(ULONG);
|
---|
6182 | sprintf(szKey, "%s.NumDirsLastTime", path); // path is state name
|
---|
6183 | if (!PrfQueryProfileData(fmprof,
|
---|
6184 | FM3Str,
|
---|
6185 | szKey,
|
---|
6186 | (PVOID)&numsaves,
|
---|
6187 | &size))
|
---|
6188 | {
|
---|
6189 | if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) {
|
---|
6190 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
---|
6191 | GetPString(IDS_WARNINGTEXT),
|
---|
6192 | GetPString(IDS_DOESNTEXISTTEXT), path);
|
---|
6193 | }
|
---|
6194 | else {
|
---|
6195 | Win_Error2(hwnd, hwnd, __FILE__, __LINE__,
|
---|
6196 | IDS_PRFQUERYPROFILEDATA);
|
---|
6197 | }
|
---|
6198 | }
|
---|
6199 | else if (!numsaves)
|
---|
6200 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
6201 | else {
|
---|
6202 | char *pszStateName;
|
---|
6203 | if ((shiftstate & KC_SHIFT) == 0)
|
---|
6204 | PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));
|
---|
6205 | pszStateName = xstrdup(path, pszSrcFile, __LINE__);
|
---|
6206 | if (!pszStateName) {
|
---|
6207 | // Fall back if out of memory - already complained
|
---|
6208 | if ((shiftstate & KC_SHIFT) != 0 || fAutoTile) {
|
---|
6209 | // Autotile requested or forced
|
---|
6210 | PostMsg(MainObjectHwnd,
|
---|
6211 | UM_RESTORE,
|
---|
6212 | MPVOID,
|
---|
6213 | MPFROMLONG(1)); // Autotile
|
---|
6214 | }
|
---|
6215 | }
|
---|
6216 | else if (!PostMsg(MainObjectHwnd,
|
---|
6217 | UM_RESTORE,
|
---|
6218 | MPFROMP(pszStateName),
|
---|
6219 | MPVOID)) {
|
---|
6220 | free(pszStateName);
|
---|
6221 | }
|
---|
6222 | }
|
---|
6223 | }
|
---|
6224 | else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) {
|
---|
6225 |
|
---|
6226 | SHORT sSelect;
|
---|
6227 |
|
---|
6228 | sSelect = (SHORT) WinSendMsg(hwndCmdlist,
|
---|
6229 | LM_QUERYSELECTION,
|
---|
6230 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
6231 | if (sSelect >= 0)
|
---|
6232 | WinPostMsg(hwnd,
|
---|
6233 | WM_COMMAND,
|
---|
6234 | MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0),
|
---|
6235 | MPVOID);
|
---|
6236 | WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));
|
---|
6237 | }
|
---|
6238 | }
|
---|
6239 | }
|
---|
6240 | break;
|
---|
6241 |
|
---|
6242 | default:
|
---|
6243 | break;
|
---|
6244 | }
|
---|
6245 | break;
|
---|
6246 |
|
---|
6247 | default:
|
---|
6248 | break;
|
---|
6249 | }
|
---|
6250 | return 0;
|
---|
6251 |
|
---|
6252 | case WM_HELP:
|
---|
6253 | WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
|
---|
6254 | break;
|
---|
6255 |
|
---|
6256 | case UM_COMMAND:
|
---|
6257 | case WM_COMMAND:
|
---|
6258 |
|
---|
6259 | return MainWMCommand(hwnd, msg, mp1, mp2);
|
---|
6260 |
|
---|
6261 | case WM_CLOSE:
|
---|
6262 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
6263 | WM_SYSCOMMAND, MPFROM2SHORT(SC_RESTORE, 0), MPVOID);
|
---|
6264 | WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
---|
6265 | fAmClosing = TRUE;
|
---|
6266 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
6267 | WM_SYSCOMMAND, MPFROM2SHORT(SC_MINIMIZE, 0), MPVOID);
|
---|
6268 | if (CloseChildren(hwnd)) {
|
---|
6269 | fAmClosing = FALSE;
|
---|
6270 | if (fAutoTile)
|
---|
6271 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TILE, 0), MPVOID);
|
---|
6272 | return 0;
|
---|
6273 | }
|
---|
6274 | if (hwndTree) {
|
---|
6275 | if (!PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID))
|
---|
6276 | WinSendMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID);
|
---|
6277 | }
|
---|
6278 | DosSleep(1);
|
---|
6279 | return 0; // Hold off WM_QUIT
|
---|
6280 |
|
---|
6281 | case UM_CLOSE:
|
---|
6282 | HideNote();
|
---|
6283 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
---|
6284 | return 0;
|
---|
6285 |
|
---|
6286 | case UM_RESTORE:
|
---|
6287 | {
|
---|
6288 | // Try to restore saved shutdown state
|
---|
6289 | char *pszDefaultStateName = xstrdup(GetPString(IDS_SHUTDOWNSTATE),
|
---|
6290 | pszSrcFile, __LINE__);
|
---|
6291 | if (pszDefaultStateName) {
|
---|
6292 | if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID))
|
---|
6293 | // 05 Feb 08 SHL fixme to complain?
|
---|
6294 | free(pszDefaultStateName);
|
---|
6295 | }
|
---|
6296 | }
|
---|
6297 | return 0;
|
---|
6298 |
|
---|
6299 | case UM_SETDIR:
|
---|
6300 | /* mp1 == name of directory to open */
|
---|
6301 | if (mp1)
|
---|
6302 | return MRFROMLONG(OpenDirCnr((HWND) 0,
|
---|
6303 | hwndMain,
|
---|
6304 | hwndTree, (BOOL) mp2, (char *)mp1));
|
---|
6305 | return 0;
|
---|
6306 |
|
---|
6307 | case WM_DESTROY:
|
---|
6308 | hwndMain = (HWND) 0;
|
---|
6309 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
6310 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
---|
6311 | break;
|
---|
6312 | }
|
---|
6313 |
|
---|
6314 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
6315 | }
|
---|
6316 |
|
---|
6317 | #pragma alloc_text(MISC8,SetToggleChecks,FindDirCnrByName,TopWindow)
|
---|
6318 | #pragma alloc_text(MISC8,TopWindowName,CountDirCnrs)
|
---|
6319 | #pragma alloc_text(MAINWND,AdjustSizeOfClient,FillClient,ChildButtonProc)
|
---|
6320 | #pragma alloc_text(MAINWND,ToolBackProc,StatusProc)
|
---|
6321 | #pragma alloc_text(MAINWND,MoveChildrenAwayFromTree,ArrangeIcons,NextChild)
|
---|
6322 | #pragma alloc_text(MAINWND,ChildFrameButtonProc)
|
---|
6323 | #pragma alloc_text(MAINWND2,CloseChildren,CountChildren,GetNextWindowPos)
|
---|
6324 | #pragma alloc_text(MAINWND2,CascadeChildren,TileChildren,ResizeChildren)
|
---|
6325 | #pragma alloc_text(MAINWND2,MinResChildren,MainFrameWndProc,MainWndProc)
|
---|
6326 | #pragma alloc_text(MAINWND2,DropDownListProc)
|
---|
6327 | #pragma alloc_text(MAINWND3,RestoreDirCnrState,SaveDirCnrState)
|
---|
6328 | #pragma alloc_text(MAINWND3,CloseDirCnrChildren,TransformSwp)
|
---|
6329 | #pragma alloc_text(MAINWND3,ResizeTools,BuildTools,CommandLineProc)
|
---|
6330 | #pragma alloc_text(MAINWND4,DriveProc,DriveBackProc,BuildDriveBarButtons,ResizeDrives)
|
---|
6331 | #pragma alloc_text(MAINWND4,LEDProc,IdealButtonProc)
|
---|
6332 | #pragma alloc_text(MAINWND5,MainWMOnce)
|
---|
6333 | #pragma alloc_text(MAINWND6,MainWMCommand)
|
---|
6334 | #pragma alloc_text(BUBBLE,MakeBubble,BubbleProc,BubbleHelp)
|
---|
6335 | #pragma alloc_text(MAINOBJ,MainObjectWndProc,MakeMainObjWin)
|
---|
6336 |
|
---|