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