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