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