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