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