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