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