source: trunk/dll/mainwnd.c@ 1224

Last change on this file since 1224 was 1224, checked in by John Small, 17 years ago

Ticket 187: Moved typedef's and some #define's from fm3dll.h

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