| [1335] | 1 |
|
|---|
| [33] | 2 | /***********************************************************************
|
|---|
| 3 |
|
|---|
| 4 | $Id: mainwnd.c 1391 2009-01-11 23:55:53Z gyoung $
|
|---|
| 5 |
|
|---|
| [178] | 6 | fm/2 main window
|
|---|
| [33] | 7 |
|
|---|
| 8 | Copyright (c) 1993-98 M. Kimes
|
|---|
| [907] | 9 | Copyright (c) 2001, 2008 Steven H. Levine
|
|---|
| [33] | 10 |
|
|---|
| [130] | 11 | 11 Jun 02 SHL Drop obsolete xor code
|
|---|
| 12 | 16 Oct 02 SHL Handle large partitions
|
|---|
| 13 | 01 Aug 04 SHL Rework lstrip/rstrip usage
|
|---|
| 14 | 23 May 05 SHL Use QWL_USER
|
|---|
| [133] | 15 | 23 May 05 SHL Use datamin.h
|
|---|
| [162] | 16 | 25 May 05 SHL Use ULONGLONG and CommaFmtULL
|
|---|
| [178] | 17 | 26 May 05 SHL Comments and localize code
|
|---|
| [186] | 18 | 05 Jun 05 SHL Use QWL_USER
|
|---|
| [200] | 19 | 06 Jun 05 SHL Rework MainWMCommand for VAC3.65 compat
|
|---|
| [260] | 20 | 13 Aug 05 SHL Renames and comments
|
|---|
| [297] | 21 | 08 Dec 05 SHL DriveProc: disable menu items if drive not ready
|
|---|
| 22 | 17 Dec 05 SHL DriveProc: correct my stupid
|
|---|
| 23 | 29 May 06 SHL IDM_EDITANYARCHIVER: sanitize code
|
|---|
| [352] | 24 | 17 Jul 06 SHL Use Runtime_Error
|
|---|
| [447] | 25 | 17 Aug 06 SHL Complain nicer if state name does not exist
|
|---|
| [552] | 26 | 18 Feb 07 GKY More drive type and icon support
|
|---|
| [557] | 27 | 08 Mar 07 SHL SaveDirCnrState: do not save state of NOPRESCAN volumes
|
|---|
| [558] | 28 | 09 Mar 07 SHL RestoreDirCnrState/SaveDirCnrState: optimize and avoid overflows
|
|---|
| [593] | 29 | 30 Mar 07 GKY Remove GetPString for window class names
|
|---|
| [603] | 30 | 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
|
|---|
| 31 | 06 Apr 07 GKY Add some error checking in drag/drop
|
|---|
| [618] | 32 | 15 Apr 07 SHL mainwnd MAIN_SETUPLIST restore state not found reporting
|
|---|
| 33 | 19 Apr 07 SHL Sync with AcceptOneDrop GetOneDrop mods
|
|---|
| 34 | 20 Apr 07 SHL Avoid spurious add_udir error reports
|
|---|
| [672] | 35 | 12 May 07 SHL Use dcd->ulItemsToUnHilite
|
|---|
| [688] | 36 | 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
|
|---|
| [775] | 37 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
|
|---|
| [773] | 38 | 07 Aug 07 SHL Use BldQuotedFileName
|
|---|
| [787] | 39 | 16 Aug 07 SHL Update IDM_SAVEDIRCNRSTATE logic for ticket# 109
|
|---|
| 40 | 18 Aug 07 SHL Rework UM_FILLSETUPLIST for new setups storage
|
|---|
| 41 | 19 Aug 07 SHL Move #pragma alloc_text to end of file for OpenWatcom
|
|---|
| [789] | 42 | 19 Aug 07 SHL Rework SaveDirCnrState to return better error info
|
|---|
| [824] | 43 | 30 Aug 07 SHL Add accelerator support to quicklist windows
|
|---|
| [872] | 44 | 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
|
|---|
| [921] | 45 | 12 Jan 08 SHL Support drag&drop dialog toggle
|
|---|
| [925] | 46 | 16 Jan 08 SHL Add sync updates toggle
|
|---|
| [927] | 47 | 16 Jan 08 GKY Fix changing background color on toolbar
|
|---|
| [940] | 48 | 17 Jan 08 GKY Add presparam save & restore for individual directory containers
|
|---|
| [965] | 49 | 19 Jan 08 JBS Ticket 150: fix/improve save and restore of dir cnr state at FM/2 close/reopen
|
|---|
| [940] | 50 | 19 Jan 08 GKY Rework Utilities menu
|
|---|
| [941] | 51 | 05 Feb 08 SHL Restore no-prescan drives if restoring named state
|
|---|
| [953] | 52 | 14 Feb 08 SHL Rework to support settings menu conditional cascade
|
|---|
| [954] | 53 | 15 Feb 08 SHL Rework ResizeChildren to honor fNoTreeGap and resize drive tree better
|
|---|
| [965] | 54 | 19 Feb 08 JBS Stop deleting "State at last FM/2 Close" from INI file so it be accessed from States combo box.
|
|---|
| [971] | 55 | 22 Feb 08 JBS Ticket 230: Fix/improve various code related to state or presparam values in the INI file.
|
|---|
| [985] | 56 | 29 Feb 08 GKY Use xfree where appropriate
|
|---|
| [1027] | 57 | 19 Jun 08 JBS Ticket 227: Allow temporary saving/deleting of the shutdown state of directory containers
|
|---|
| [1029] | 58 | 22 Jun 08 GKY Use free_... functions for fortify checking
|
|---|
| [1033] | 59 | 30 Jun 08 JBS Ticket 103: Fix restore of previous shutdown state when opening FM/2
|
|---|
| [1061] | 60 | 07 Jul 08 JBS Ticket 242: Delete obsolete INI keys when re-saving a state
|
|---|
| [1065] | 61 | 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
|
|---|
| [1335] | 62 | all the details view settings (both the global variables and those in the
|
|---|
| 63 | DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
|
|---|
| [1066] | 64 | 12 Jul 08 JBS Ticket 246: Allow saved directory container states to have no directory containers
|
|---|
| [1335] | 65 | (i.e. just a directory tree container).
|
|---|
| 66 | 18 Jul 08 SHL Use new Fortify feature to avoid spurious reports
|
|---|
| [1104] | 67 | 19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory
|
|---|
| [1121] | 68 | 26 Aug 08 GKY Require unique ID plus text and help strings for all tools save toolbar on button delete
|
|---|
| [1128] | 69 | 27 Aug 08 JBS Ticket 259: Support saving/restoring toolbars with states
|
|---|
| 70 | 29 Aug 08 JBS Ticket 259: Support saving/restoring target directories with states (except the shutdown state)
|
|---|
| [1140] | 71 | 01 Sep 08 GKY Save toolbars immediately on change. Add bmps for default toolbars
|
|---|
| [1303] | 72 | 29 Nov 08 GKY Remove or replace with a mutex semaphore DosEnterCriSec where appropriate.
|
|---|
| [1318] | 73 | 04 Dec 08 GKY Use event semaphore to prevent scan of "last" directory container prior to
|
|---|
| [1335] | 74 | tree scan completion; prevents duplicate directory names in tree.
|
|---|
| 75 | 10 Dec 08 SHL Integrate exception handler support
|
|---|
| [1362] | 76 | 28 Dec 08 GKY Added Databar to utilities menu
|
|---|
| [1375] | 77 | 30 Dec 08 GKY Initialize tool bar background color to palegray not black
|
|---|
| 78 | 03 Jan 09 GKY Check for system that is protectonly to gray out Dos/Win command lines and prevent
|
|---|
| 79 | Dos/Win programs from being inserted into the execute dialog with message why.
|
|---|
| [1391] | 80 | 11 Jan 09 GKY Replace font names in the string file with global set at compile in init.c
|
|---|
| [33] | 81 |
|
|---|
| 82 | ***********************************************************************/
|
|---|
| 83 |
|
|---|
| [907] | 84 | #include <stdlib.h>
|
|---|
| 85 | #include <string.h>
|
|---|
| 86 | #include <ctype.h>
|
|---|
| [1335] | 87 | // #include <process.h> // _beginthread
|
|---|
| [907] | 88 |
|
|---|
| [2] | 89 | #define INCL_DOS
|
|---|
| 90 | #define INCL_WIN
|
|---|
| [1209] | 91 | #define INCL_SHLERRORS // PMERR_NOT_IN_IDX
|
|---|
| [2] | 92 | #define INCL_WINHELP
|
|---|
| 93 | #define INCL_GPI
|
|---|
| [162] | 94 | #define INCL_LONGLONG
|
|---|
| [2] | 95 |
|
|---|
| [1181] | 96 | #include "fm3dll.h"
|
|---|
| [1224] | 97 | #include "fm3dll2.h" // #define's for UM_*, control id's, etc.
|
|---|
| [1209] | 98 | #include "grep.h" // Data declaration(s)
|
|---|
| 99 | #include "autoview.h" // Data declaration(s)
|
|---|
| 100 | #include "dircnrs.h" // Data declaration(s)
|
|---|
| 101 | #include "info.h" // Data declaration(s)
|
|---|
| 102 | #include "defview.h" // Data declaration(s)
|
|---|
| 103 | #include "init.h" // Data declaration(s)
|
|---|
| [2] | 104 | #include "fm3dlg.h"
|
|---|
| 105 | #include "fm3str.h"
|
|---|
| 106 | #include "tools.h"
|
|---|
| [907] | 107 | #include "comp.h"
|
|---|
| [133] | 108 | #include "datamin.h"
|
|---|
| [1209] | 109 | #include "pathutil.h" // BldQuotedFileName
|
|---|
| 110 | #include "errutil.h" // Dos_Error...
|
|---|
| 111 | #include "strutil.h" // GetPString
|
|---|
| 112 | #include "notebook.h" // CfgDlgProc CfgMenuInit
|
|---|
| 113 | #include "command.h" // LINKCMDS
|
|---|
| 114 | #include "avl.h" // free_archivers
|
|---|
| 115 | #include "walkem.h" // free_setups...
|
|---|
| 116 | #include "key.h" // AboutDlgProc
|
|---|
| 117 | #include "menu.h" // AddToMenu
|
|---|
| [1158] | 118 | #include "mainwnd.h"
|
|---|
| [1209] | 119 | #include "cmdline.h" // CmdLine2DlgProc, save_cmdlines
|
|---|
| 120 | #include "common.h" // CommonCreateMainChildren, CommonDriveCmd, CommonMainWndProc
|
|---|
| [1335] | 121 | // CommonTextButton
|
|---|
| [1209] | 122 | #include "notify.h" // DoNotify, HideNote, ShowNote
|
|---|
| 123 | #include "draglist.h" // DragOne
|
|---|
| 124 | #include "chklist.h" // DropListProc
|
|---|
| 125 | #include "avv.h" // EditArchiverDefinition
|
|---|
| 126 | #include "assoc.h" // EditAssociations
|
|---|
| 127 | #include "fm2cmd.h" // FM2Command
|
|---|
| 128 | #include "misc.h" // FindDirCnr, FixSwitchList, PaintSTextWindow,
|
|---|
| [1335] | 129 | // SetConditionalCascade, SetMenuCheck, SetSysMenu
|
|---|
| 130 | // SwitchCommand, CheckMenu, DrawTargetEmphasis
|
|---|
| 131 | // IsFm2Window
|
|---|
| [1209] | 132 | #include "instant.h" // InstantDlgProc
|
|---|
| 133 | #include "killproc.h" // KillDlgProc
|
|---|
| 134 | #include "loadbmp.h" // LoadBitmapFromFileNum
|
|---|
| 135 | #include "presparm.h" // SavePresParams
|
|---|
| 136 | #include "treecnr.h" // ShowTreeRec, StartTreeCnr
|
|---|
| 137 | #include "inis.h" // StartIniEditor
|
|---|
| 138 | #include "sysinfo.h" // SysInfoDlgProc
|
|---|
| 139 | #include "viewinf.h" // ViewInfProc
|
|---|
| 140 | #include "walkem.h" // WalkDlgProc, WalkTwoCmpDlgProc, add_setup, add_udir
|
|---|
| [1335] | 141 | // fill_setups_list, free_ldir, free_udirs, load_udirs
|
|---|
| 142 | // remove_setup, remove_udir, save_setups, save_udirs
|
|---|
| [1209] | 143 | #include "winlist.h" // WindowList
|
|---|
| 144 | #include "cmdline.h" // add_cmdline
|
|---|
| 145 | #include "assoc.h" // free_associations
|
|---|
| 146 | #include "droplist.h" // AcceptOneDrop, CheckPmDrgLimit, DropHelp, GetOneDrop
|
|---|
| 147 | #include "common.h" // CommonTextProc
|
|---|
| 148 | #include "presparm.h" // CopyPresParams
|
|---|
| 149 | #include "systemf.h" // ExecOnList
|
|---|
| 150 | #include "shadow.h" // OpenObject
|
|---|
| 151 | #include "mkdir.h" // PMMkDir
|
|---|
| 152 | #include "collect.h" // StartCollector
|
|---|
| 153 | #include "select.h" // UnHilite
|
|---|
| 154 | #include "strips.h" // bstrip
|
|---|
| 155 | #include "commafmt.h" // CommaFmtULL
|
|---|
| 156 | #include "valid.h" // IsFullName
|
|---|
| 157 | #include "dirs.h" // save_dir2
|
|---|
| 158 | #include "wrappers.h" // xfree
|
|---|
| [1017] | 159 | #include "fortify.h"
|
|---|
| [1315] | 160 | #include "filldir.h" // StubbyScanCount
|
|---|
| [1335] | 161 | #include "excputil.h" // xbeginthread
|
|---|
| [1017] | 162 |
|
|---|
| [1209] | 163 | static BOOL CloseDirCnrChildren(HWND hwndClient);
|
|---|
| 164 | static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview);
|
|---|
| 165 | static VOID DeletePresParams(PSZ pszKeyroot);
|
|---|
| 166 | static VOID BuildTools(HWND hwndT, BOOL resize);
|
|---|
| 167 |
|
|---|
| 168 | // Data definitions
|
|---|
| 169 | #pragma data_seg(GLOBAL1)
|
|---|
| 170 | ULONG DriveLines;
|
|---|
| 171 | HWND MainObjectHwnd;
|
|---|
| 172 | HWND MainPopupMenu;
|
|---|
| 173 | BOOL MenuInvisible;
|
|---|
| 174 | PFNWP PFNWPButton;
|
|---|
| 175 | PFNWP PFNWPStatic;
|
|---|
| 176 | BOOL fAmClosing;
|
|---|
| 177 | BOOL fAutoTile;
|
|---|
| 178 | BOOL fAutoView;
|
|---|
| 179 | BOOL fComments;
|
|---|
| 180 | BOOL fDrivebar;
|
|---|
| 181 | BOOL fFreeTree;
|
|---|
| 182 | BOOL fMoreButtons;
|
|---|
| 183 | BOOL fNoFinger;
|
|---|
| 184 | BOOL fNoSaveState;
|
|---|
| 185 | BOOL fNoTileUpdate;
|
|---|
| 186 | BOOL fRunning;
|
|---|
| 187 | BOOL fSplitStatus;
|
|---|
| 188 | BOOL fTextTools;
|
|---|
| 189 | BOOL fToolTitles;
|
|---|
| 190 | BOOL fToolbar;
|
|---|
| 191 | BOOL fUserComboBox;
|
|---|
| 192 | HBITMAP hbmLEDoff;
|
|---|
| 193 | HBITMAP hbmLEDon;
|
|---|
| 194 | HPOINTER hptrFinger;
|
|---|
| 195 | HWND hwndAutoview;
|
|---|
| 196 | HWND hwndBubble;
|
|---|
| 197 | HWND hwndName;
|
|---|
| 198 | HWND hwndStatelist;
|
|---|
| 199 | HWND hwndToolback;
|
|---|
| 200 | HWND hwndTree;
|
|---|
| 201 | USHORT shiftstate;
|
|---|
| 202 |
|
|---|
| 203 | #pragma data_seg(GLOBAL2)
|
|---|
| 204 | HMODULE FM3ModHandle;
|
|---|
| 205 | CHAR *FM3Str;
|
|---|
| 206 | RGB2 RGBGREY;
|
|---|
| 207 |
|
|---|
| [2] | 208 | #pragma data_seg(DATA1)
|
|---|
| [352] | 209 |
|
|---|
| 210 | static PSZ pszSrcFile = __FILE__;
|
|---|
| [178] | 211 | static USHORT firsttool = 0;
|
|---|
| [1209] | 212 | static HWND hwndButtonlist;
|
|---|
| 213 | static HWND hwndCmdlist;
|
|---|
| 214 | static HWND hwndDrivelist;
|
|---|
| 215 | static HWND hwndUserlist;
|
|---|
| [2] | 216 |
|
|---|
| 217 |
|
|---|
| [551] | 218 | static MRESULT EXPENTRY MainObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
|---|
| [1335] | 219 | MPARAM mp2)
|
|---|
| [133] | 220 | {
|
|---|
| [551] | 221 | switch (msg) {
|
|---|
| [1077] | 222 | case WM_CREATE:
|
|---|
| 223 | break;
|
|---|
| 224 |
|
|---|
| [133] | 225 | case UM_SETUP:
|
|---|
| 226 | case UM_SETUP2:
|
|---|
| 227 | case UM_SETUP3:
|
|---|
| 228 | case UM_SETUP4:
|
|---|
| 229 | case UM_SETUP5:
|
|---|
| 230 | /*
|
|---|
| 231 | * feed setup messages to main window
|
|---|
| 232 | */
|
|---|
| 233 | PostMsg(hwndMain, msg, mp1, mp2);
|
|---|
| 234 | return 0;
|
|---|
| [2] | 235 |
|
|---|
| [133] | 236 | case UM_SETUP6:
|
|---|
| 237 | /*
|
|---|
| 238 | * handle bubble help requests from drive bar buttons
|
|---|
| 239 | */
|
|---|
| 240 | {
|
|---|
| 241 | char dv[3], d;
|
|---|
| [551] | 242 | HWND hwndB = (HWND) mp1;
|
|---|
| [133] | 243 | USHORT id;
|
|---|
| [2] | 244 |
|
|---|
| [133] | 245 | id = WinQueryWindowUShort(hwndB, QWS_ID);
|
|---|
| 246 | *dv = 0;
|
|---|
| 247 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwndB, QW_PARENT),
|
|---|
| [1335] | 248 | id + 50), sizeof(dv), dv);
|
|---|
| [133] | 249 | d = toupper(*dv);
|
|---|
| 250 | if (isalpha(d) && d > 'B' &&
|
|---|
| [1335] | 251 | !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID |
|
|---|
| 252 | DRIVE_SLOW)) &&
|
|---|
| 253 | (!hwndBubble ||
|
|---|
| 254 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&
|
|---|
| 255 | !WinQueryCapture(HWND_DESKTOP)) {
|
|---|
| [2] | 256 |
|
|---|
| [1335] | 257 | FSALLOCATE fsa;
|
|---|
| 258 | CHAR s[90], szQty[38];
|
|---|
| 259 | ULONG ulPctFree;
|
|---|
| 260 | ULONGLONG ullFreeQty;
|
|---|
| [2] | 261 |
|
|---|
| [1335] | 262 | if (!DosQueryFSInfo((d - 'A') + 1,
|
|---|
| 263 | FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {
|
|---|
| 264 | ullFreeQty = (ULONGLONG) fsa.cUnitAvail *
|
|---|
| 265 | (fsa.cSectorUnit * fsa.cbSector);
|
|---|
| 266 | ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ?
|
|---|
| 267 | (fsa.cUnitAvail * 100) / fsa.cUnit : 0;
|
|---|
| 268 | CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' ');
|
|---|
| 269 | sprintf(s, "%s (%lu%%) free", szQty, ulPctFree);
|
|---|
| 270 | }
|
|---|
| 271 | if ((!hwndBubble ||
|
|---|
| 272 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&
|
|---|
| 273 | !WinQueryCapture(HWND_DESKTOP))
|
|---|
| 274 | WinSendMsg(hwndB, UM_SETUP6, MPFROMP(s), MPVOID);
|
|---|
| [2] | 275 | }
|
|---|
| [133] | 276 | }
|
|---|
| 277 | return 0;
|
|---|
| [2] | 278 |
|
|---|
| [133] | 279 | case UM_SETDIR:
|
|---|
| 280 | {
|
|---|
| 281 | CHAR s[8] = " :\\OS2";
|
|---|
| 282 | ULONG bd;
|
|---|
| [2] | 283 |
|
|---|
| [133] | 284 | if (DosQuerySysInfo(QSV_BOOT_DRIVE,
|
|---|
| [1335] | 285 | QSV_BOOT_DRIVE,
|
|---|
| 286 | (PVOID) & bd, (ULONG) sizeof(ULONG)))
|
|---|
| 287 | bd = 3L;
|
|---|
| [133] | 288 | *s = (CHAR) bd + '@';
|
|---|
| [787] | 289 | WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPFROMLONG(1));
|
|---|
| [551] | 290 | if (!mp1) {
|
|---|
| [1335] | 291 | s[3] = 0;
|
|---|
| 292 | WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID);
|
|---|
| [133] | 293 | }
|
|---|
| [787] | 294 | PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1), MPFROMLONG(1));
|
|---|
| [133] | 295 | }
|
|---|
| 296 | return 0;
|
|---|
| [2] | 297 |
|
|---|
| [133] | 298 | case UM_RESTORE:
|
|---|
| [941] | 299 | switch ((ULONG)mp2) {
|
|---|
| 300 | case 1:
|
|---|
| 301 | TileChildren(hwndMain, TRUE);
|
|---|
| 302 | break;
|
|---|
| 303 | case 2:
|
|---|
| 304 | CloseDirCnrChildren(hwndMain);
|
|---|
| 305 | break;
|
|---|
| 306 | case 0:
|
|---|
| [133] | 307 | fNoTileUpdate = TRUE;
|
|---|
| 308 | WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), FALSE);
|
|---|
| [551] | 309 | RestoreDirCnrState(hwndMain, (char *)mp1, FALSE);
|
|---|
| [133] | 310 | WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), TRUE);
|
|---|
| 311 | fNoTileUpdate = FALSE;
|
|---|
| [1011] | 312 | //xfree((char *)mp1, pszSrcFile, __LINE__);
|
|---|
| [1033] | 313 | // if (fAutoTile)
|
|---|
| 314 | // TileChildren(hwndMain, TRUE);
|
|---|
| [941] | 315 | break;
|
|---|
| 316 | default:
|
|---|
| 317 | Runtime_Error(pszSrcFile, __LINE__, "%u unexpected", mp2);
|
|---|
| [133] | 318 | }
|
|---|
| 319 | return 0;
|
|---|
| [2] | 320 |
|
|---|
| [133] | 321 | case UM_NOTIFY:
|
|---|
| 322 | /*
|
|---|
| 323 | * bring up notify messages for various windows
|
|---|
| 324 | */
|
|---|
| 325 | if (mp1)
|
|---|
| [551] | 326 | return MRFROMLONG(DoNotify((char *)mp1));
|
|---|
| [133] | 327 | return 0;
|
|---|
| [2] | 328 |
|
|---|
| [133] | 329 | case WM_DESTROY:
|
|---|
| [551] | 330 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
|---|
| 331 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
|---|
| [133] | 332 | break;
|
|---|
| 333 | }
|
|---|
| 334 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 335 | }
|
|---|
| 336 |
|
|---|
| [133] | 337 | VOID MakeMainObjWin(VOID * args)
|
|---|
| 338 | {
|
|---|
| 339 | HAB hab2;
|
|---|
| 340 | HMQ hmq2;
|
|---|
| 341 | QMSG qmsg2;
|
|---|
| [2] | 342 |
|
|---|
| [133] | 343 | priority_bumped();
|
|---|
| 344 | hab2 = WinInitialize(0);
|
|---|
| [551] | 345 | if (hab2) {
|
|---|
| [133] | 346 | hmq2 = WinCreateMsgQueue(hab2, 128);
|
|---|
| [551] | 347 | if (hmq2) {
|
|---|
| [133] | 348 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 349 | WinRegisterClass(hab2,
|
|---|
| [1335] | 350 | (PSZ) WC_OBJECTWINDOW,
|
|---|
| 351 | MainObjectWndProc, 0, sizeof(PVOID));
|
|---|
| [133] | 352 | MainObjectHwnd = WinCreateWindow(HWND_OBJECT,
|
|---|
| [1335] | 353 | WC_OBJECTWINDOW,
|
|---|
| 354 | (PSZ) NULL,
|
|---|
| 355 | 0,
|
|---|
| 356 | 0L,
|
|---|
| 357 | 0L,
|
|---|
| 358 | 0L,
|
|---|
| 359 | 0L,
|
|---|
| 360 | 0L, HWND_TOP, OBJ_FRAME, NULL, NULL);
|
|---|
| [376] | 361 | if (!MainObjectHwnd)
|
|---|
| [1335] | 362 | Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 363 | IDS_WINCREATEWINDOW);
|
|---|
| [551] | 364 | else {
|
|---|
| [1335] | 365 | WinSetWindowPtr(MainObjectHwnd, QWL_USER, args);
|
|---|
| [1209] | 366 | # ifdef FORTIFY
|
|---|
| [1335] | 367 | Fortify_EnterScope();
|
|---|
| [1209] | 368 | # endif
|
|---|
| [1335] | 369 | while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0))
|
|---|
| 370 | WinDispatchMsg(hab2, &qmsg2);
|
|---|
| 371 | WinDestroyWindow(MainObjectHwnd);
|
|---|
| [1209] | 372 | # ifdef FORTIFY
|
|---|
| [1335] | 373 | Fortify_LeaveScope();
|
|---|
| [1209] | 374 | # endif
|
|---|
| [133] | 375 | }
|
|---|
| 376 | WinDestroyMsgQueue(hmq2);
|
|---|
| 377 | }
|
|---|
| 378 | WinTerminate(hab2);
|
|---|
| 379 | }
|
|---|
| [2] | 380 | }
|
|---|
| 381 |
|
|---|
| [551] | 382 | static MRESULT EXPENTRY IdealButtonProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
|---|
| [1335] | 383 | MPARAM mp2)
|
|---|
| [133] | 384 | {
|
|---|
| [551] | 385 | switch (msg) {
|
|---|
| [133] | 386 | case WM_MOUSEMOVE:
|
|---|
| [551] | 387 | BubbleHelp(hwnd, TRUE, FALSE, FALSE, GetPString(IDS_IDEALBUTTONHELP));
|
|---|
| [133] | 388 | break;
|
|---|
| 389 | }
|
|---|
| 390 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 391 | }
|
|---|
| 392 |
|
|---|
| [133] | 393 | HWND TopWindow(HWND hwndParent, HWND exclude)
|
|---|
| 394 | {
|
|---|
| 395 | HENUM henum;
|
|---|
| [551] | 396 | HWND hwndC = (HWND) 0;
|
|---|
| [133] | 397 | USHORT id;
|
|---|
| [2] | 398 |
|
|---|
| [551] | 399 | if (hwndParent) {
|
|---|
| [133] | 400 | henum = WinBeginEnumWindows(hwndMain);
|
|---|
| [551] | 401 | while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 402 | if (hwndC != exclude) {
|
|---|
| [1335] | 403 | id = WinQueryWindowUShort(hwndC, QWS_ID);
|
|---|
| 404 | if (id)
|
|---|
| 405 | break;
|
|---|
| [133] | 406 | }
|
|---|
| 407 | }
|
|---|
| 408 | WinEndEnumWindows(henum);
|
|---|
| 409 | }
|
|---|
| 410 | return hwndC;
|
|---|
| [2] | 411 | }
|
|---|
| 412 |
|
|---|
| [133] | 413 | HWND TopWindowName(HWND hwndParent, HWND exclude, CHAR * ret)
|
|---|
| 414 | {
|
|---|
| 415 | HENUM henum;
|
|---|
| [551] | 416 | HWND hwndC = (HWND) 0, hwndDir, hwndClient;
|
|---|
| [133] | 417 | USHORT id;
|
|---|
| 418 | PCNRITEM pci = NULL;
|
|---|
| [2] | 419 |
|
|---|
| [551] | 420 | if (ret) {
|
|---|
| [133] | 421 | *ret = 0;
|
|---|
| [551] | 422 | if (hwndParent) {
|
|---|
| [133] | 423 | henum = WinBeginEnumWindows(hwndMain);
|
|---|
| [551] | 424 | while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| [1335] | 425 | //saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC);
|
|---|
| 426 | if (hwndC != exclude && hwndC != hwndTree) {
|
|---|
| 427 | id = WinQueryWindowUShort(hwndC, QWS_ID);
|
|---|
| 428 | if (id) {
|
|---|
| 429 | hwndClient = WinWindowFromID(hwndC, FID_CLIENT);
|
|---|
| 430 | if (hwndClient) {
|
|---|
| 431 | hwndDir = WinWindowFromID(hwndClient, DIR_CNR);
|
|---|
| 432 | if (hwndDir) {
|
|---|
| 433 | if (fLookInDir) {
|
|---|
| 434 | pci = (PCNRITEM) WinSendMsg(hwndDir,
|
|---|
| 435 | CM_QUERYRECORDEMPHASIS,
|
|---|
| 436 | MPFROMLONG(CMA_FIRST),
|
|---|
| 437 | MPFROMSHORT(CRA_CURSORED));
|
|---|
| 438 | if (pci && (INT) pci != -1)
|
|---|
| 439 | break;
|
|---|
| 440 | }
|
|---|
| 441 | if (WinSendMsg(hwndClient,
|
|---|
| 442 | UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) {
|
|---|
| 443 | MakeValidDir(ret);
|
|---|
| 444 | //saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret);
|
|---|
| 445 | WinEndEnumWindows(henum);
|
|---|
| 446 | return hwndC;
|
|---|
| 447 | }
|
|---|
| 448 | }
|
|---|
| 449 | }
|
|---|
| 450 | }
|
|---|
| 451 | }
|
|---|
| [133] | 452 | }
|
|---|
| 453 | WinEndEnumWindows(henum);
|
|---|
| [551] | 454 | if (!pci || (INT) pci == -1) {
|
|---|
| [1335] | 455 | hwndC = hwndTree;
|
|---|
| 456 | pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree,
|
|---|
| 457 | FID_CLIENT),
|
|---|
| 458 | TREE_CNR),
|
|---|
| 459 | CM_QUERYRECORDEMPHASIS,
|
|---|
| 460 | MPFROMLONG(CMA_FIRST),
|
|---|
| 461 | MPFROMSHORT(CRA_CURSORED));
|
|---|
| [133] | 462 | }
|
|---|
| [551] | 463 | if (pci && (INT) pci != -1) {
|
|---|
| [1335] | 464 | strcpy(ret, pci->pszFileName);
|
|---|
| 465 | MakeValidDir(ret);
|
|---|
| [133] | 466 | }
|
|---|
| 467 | else
|
|---|
| [1335] | 468 | strcpy(ret, pFM2SaveDirectory);
|
|---|
| [133] | 469 | }
|
|---|
| 470 | }
|
|---|
| 471 | return hwndC;
|
|---|
| [2] | 472 | }
|
|---|
| 473 |
|
|---|
| [133] | 474 | ULONG CountDirCnrs(HWND hwndParent)
|
|---|
| 475 | {
|
|---|
| [2] | 476 | HENUM henum;
|
|---|
| [551] | 477 | HWND hwndF = (HWND) 0, hwndC, hwndDir;
|
|---|
| [2] | 478 | ULONG ret = 0;
|
|---|
| 479 |
|
|---|
| 480 | henum = WinBeginEnumWindows(hwndParent);
|
|---|
| [551] | 481 | while ((hwndF = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| [133] | 482 | hwndC = WinWindowFromID(hwndF, FID_CLIENT);
|
|---|
| [551] | 483 | if (hwndC) {
|
|---|
| [133] | 484 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
|---|
| 485 | if (hwndDir)
|
|---|
| [1335] | 486 | ret++;
|
|---|
| [2] | 487 | }
|
|---|
| 488 | }
|
|---|
| 489 | WinEndEnumWindows(henum);
|
|---|
| 490 | return ret;
|
|---|
| 491 | }
|
|---|
| 492 |
|
|---|
| [133] | 493 | HWND FindDirCnrByName(CHAR * directory, BOOL restore)
|
|---|
| 494 | {
|
|---|
| 495 | HENUM henum;
|
|---|
| [551] | 496 | HWND hwndF = (HWND) 0, hwndC, hwndDir;
|
|---|
| [133] | 497 | CHAR retstr[CCHMAXPATH];
|
|---|
| [2] | 498 |
|
|---|
| [551] | 499 | if (hwndMain) {
|
|---|
| [69] | 500 | henum = WinBeginEnumWindows(hwndMain);
|
|---|
| [551] | 501 | while ((hwndF = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| [133] | 502 | hwndC = WinWindowFromID(hwndF, FID_CLIENT);
|
|---|
| [551] | 503 | if (hwndC) {
|
|---|
| [1335] | 504 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
|---|
| 505 | if (hwndDir) {
|
|---|
| 506 | *retstr = 0;
|
|---|
| 507 | WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID);
|
|---|
| 508 | if (*retstr && !stricmp(retstr, directory)) {
|
|---|
| 509 | if (restore)
|
|---|
| 510 | WinSetWindowPos(hwndF,
|
|---|
| 511 | HWND_TOP,
|
|---|
| 512 | 0,
|
|---|
| 513 | 0,
|
|---|
| 514 | 0,
|
|---|
| 515 | 0,
|
|---|
| 516 | SWP_RESTORE | SWP_SHOW |
|
|---|
| 517 | SWP_ACTIVATE | SWP_ZORDER);
|
|---|
| 518 | break;
|
|---|
| 519 | }
|
|---|
| 520 | }
|
|---|
| [69] | 521 | }
|
|---|
| 522 | }
|
|---|
| 523 | WinEndEnumWindows(henum);
|
|---|
| 524 | }
|
|---|
| 525 | return hwndF;
|
|---|
| [2] | 526 | }
|
|---|
| 527 |
|
|---|
| [178] | 528 | static VOID SetToggleChecks(HWND hwndMenu)
|
|---|
| [133] | 529 | {
|
|---|
| [551] | 530 | WinCheckMenuItem(hwndMenu, IDM_TEXTTOOLS, fTextTools);
|
|---|
| 531 | WinCheckMenuItem(hwndMenu, IDM_TOOLTITLES, fToolTitles);
|
|---|
| 532 | WinCheckMenuItem(hwndMenu, IDM_USERLIST, fUserComboBox);
|
|---|
| 533 | WinCheckMenuItem(hwndMenu, IDM_TOOLSUBMENU, fToolbar);
|
|---|
| 534 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWSUBMENU, fAutoView);
|
|---|
| 535 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWFILE, !fComments);
|
|---|
| 536 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWCOMMENTS, fComments);
|
|---|
| 537 | WinCheckMenuItem(hwndMenu, IDM_MOREBUTTONS, fMoreButtons);
|
|---|
| 538 | WinCheckMenuItem(hwndMenu, IDM_DRIVEBAR, fDrivebar);
|
|---|
| 539 | WinCheckMenuItem(hwndMenu, IDM_AUTOTILE, fAutoTile);
|
|---|
| 540 | WinCheckMenuItem(hwndMenu, IDM_TILEBACKWARDS, fTileBackwards);
|
|---|
| [921] | 541 | WinCheckMenuItem(hwndMenu, IDM_TOGGLEDRAGDIALOG, fDragndropDlg);
|
|---|
| [925] | 542 | WinCheckMenuItem(hwndMenu, IDM_SYNCUPDATES, fSyncUpdates);
|
|---|
| [2] | 543 | }
|
|---|
| 544 |
|
|---|
| [178] | 545 | static VOID ResizeTools(HWND hwnd)
|
|---|
| [133] | 546 | {
|
|---|
| 547 | register ULONG butx = 18L;
|
|---|
| 548 | INT attrib = SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER | SWP_NOREDRAW,
|
|---|
| [551] | 549 | noattrib;
|
|---|
| [133] | 550 | register TOOL *tool, *starttool;
|
|---|
| 551 | SWP *swp;
|
|---|
| 552 | register ULONG numtools, x;
|
|---|
| [2] | 553 |
|
|---|
| [133] | 554 | if (!fToolbar)
|
|---|
| 555 | return;
|
|---|
| 556 | noattrib = attrib;
|
|---|
| 557 | noattrib &= (~(SWP_SHOW | SWP_ZORDER));
|
|---|
| 558 | noattrib |= SWP_HIDE;
|
|---|
| 559 | /* count tools */
|
|---|
| 560 | tool = toolhead;
|
|---|
| 561 | for (numtools = 0L; tool; numtools++)
|
|---|
| [551] | 562 | tool = tool->next;
|
|---|
| [133] | 563 | /* allocate swp array for WinSetMultWindowPos */
|
|---|
| [551] | 564 | swp = xmallocz(sizeof(SWP) * (numtools + 2), pszSrcFile, __LINE__);
|
|---|
| [352] | 565 | if (swp) {
|
|---|
| 566 | for (x = 0; x < numtools + 2L; x++) {
|
|---|
| [133] | 567 | swp[x].hwndInsertBehind = HWND_TOP;
|
|---|
| 568 | swp[x].fl = attrib;
|
|---|
| 569 | swp[x].y = (fToolTitles) ? 14L : 3L;
|
|---|
| 570 | swp[x].cx = 32L;
|
|---|
| 571 | swp[x].cy = 32L;
|
|---|
| 572 | }
|
|---|
| 573 | swp[0].x = swp[1].x = 2L;
|
|---|
| 574 | swp[0].y = (fTextTools) ? 14L : 18L;
|
|---|
| 575 | swp[1].y = (fTextTools) ? 1L : 2L;
|
|---|
| 576 | swp[0].cx = swp[1].cx = 14L;
|
|---|
| 577 | swp[0].cy = swp[1].cy = 14L;
|
|---|
| 578 | swp[0].hwnd = WinWindowFromID(hwnd, IDM_TOOLLEFT);
|
|---|
| 579 | swp[1].hwnd = WinWindowFromID(hwnd, IDM_TOOLRIGHT);
|
|---|
| 580 | x = 2L;
|
|---|
| 581 | tool = find_tool(firsttool);
|
|---|
| 582 | if (!tool)
|
|---|
| 583 | tool = toolhead;
|
|---|
| 584 | starttool = tool;
|
|---|
| [551] | 585 | while (tool) {
|
|---|
| 586 | if (!(tool->flags & T_INVISIBLE)) {
|
|---|
| [1335] | 587 | swp[x].x = butx;
|
|---|
| 588 | if (fTextTools || (tool->flags & T_TEXT)) {
|
|---|
| 589 | butx += 55L;
|
|---|
| 590 | swp[x].cx = 54L;
|
|---|
| 591 | swp[x].cy = 24L;
|
|---|
| 592 | swp[x].y = 3L;
|
|---|
| 593 | }
|
|---|
| 594 | else
|
|---|
| 595 | butx += 33L;
|
|---|
| 596 | if (tool->flags & T_SEPARATOR)
|
|---|
| 597 | butx += 12;
|
|---|
| [133] | 598 | }
|
|---|
| 599 | else
|
|---|
| [1335] | 600 | swp[x].fl = noattrib;
|
|---|
| [551] | 601 | swp[x].hwnd = WinWindowFromID(hwnd, tool->id);
|
|---|
| [133] | 602 | x++;
|
|---|
| [551] | 603 | tool = tool->next;
|
|---|
| [133] | 604 | }
|
|---|
| 605 | tool = toolhead;
|
|---|
| [551] | 606 | while (tool && tool != starttool) {
|
|---|
| [133] | 607 | swp[x].x = butx;
|
|---|
| [551] | 608 | if (!(tool->flags & T_INVISIBLE)) {
|
|---|
| [1335] | 609 | if (fTextTools || (tool->flags & T_TEXT)) {
|
|---|
| 610 | butx += 55L;
|
|---|
| 611 | swp[x].cx = 54L;
|
|---|
| 612 | swp[x].cy = 24L;
|
|---|
| 613 | swp[x].y = 3L;
|
|---|
| 614 | }
|
|---|
| 615 | else
|
|---|
| 616 | butx += 33L;
|
|---|
| 617 | if (tool->flags & T_SEPARATOR)
|
|---|
| 618 | butx += 12;
|
|---|
| [133] | 619 | }
|
|---|
| 620 | else
|
|---|
| [1335] | 621 | swp[x].fl = noattrib;
|
|---|
| [551] | 622 | swp[x].hwnd = WinWindowFromID(hwnd, tool->id);
|
|---|
| [133] | 623 | x++;
|
|---|
| [551] | 624 | tool = tool->next;
|
|---|
| [133] | 625 | }
|
|---|
| 626 | WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), swp, numtools + 2L);
|
|---|
| [551] | 627 | if (!fTextTools && fToolTitles) {
|
|---|
| 628 | for (x = 2L; x < numtools + 2L; x++) {
|
|---|
| [1335] | 629 | if (fTextTools || !fToolTitles)
|
|---|
| 630 | swp[x].fl = noattrib;
|
|---|
| 631 | else {
|
|---|
| 632 | tool = find_tool(WinQueryWindowUShort(swp[x].hwnd, QWS_ID));
|
|---|
| 633 | if (tool && (tool->flags & T_TEXT))
|
|---|
| 634 | swp[x].fl = noattrib;
|
|---|
| 635 | else {
|
|---|
| 636 | swp[x].hwndInsertBehind = HWND_TOP;
|
|---|
| 637 | swp[x].y = 1L;
|
|---|
| 638 | swp[x].cy = 10L;
|
|---|
| 639 | }
|
|---|
| 640 | }
|
|---|
| 641 | swp[x].hwnd = WinWindowFromID(hwnd,
|
|---|
| 642 | WinQueryWindowUShort(swp[x].hwnd,
|
|---|
| 643 | QWS_ID) + 25000);
|
|---|
| [133] | 644 | }
|
|---|
| 645 | WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), &swp[2], numtools);
|
|---|
| 646 | }
|
|---|
| [1039] | 647 | free(swp);
|
|---|
| [133] | 648 | }
|
|---|
| 649 | WinInvalidateRect(hwnd, NULL, TRUE);
|
|---|
| [2] | 650 | }
|
|---|
| 651 |
|
|---|
| [551] | 652 | static MRESULT EXPENTRY DropDownListProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
|---|
| [1335] | 653 | MPARAM mp2)
|
|---|
| [133] | 654 | {
|
|---|
| 655 | PFNWP oldproc = (PFNWP) INSTDATA(hwnd);
|
|---|
| 656 | USHORT id;
|
|---|
| [824] | 657 |
|
|---|
| 658 | static HWND hwndMenu = (HWND)0;
|
|---|
| [133] | 659 | static BOOL emphasized = FALSE;
|
|---|
| [2] | 660 |
|
|---|
| [551] | 661 | switch (msg) {
|
|---|
| [133] | 662 | case WM_MOUSEMOVE:
|
|---|
| 663 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 664 | break;
|
|---|
| [2] | 665 |
|
|---|
| [133] | 666 | case WM_CHAR:
|
|---|
| 667 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
|---|
| 668 | break;
|
|---|
| [2] | 669 |
|
|---|
| [133] | 670 | case WM_MENUEND:
|
|---|
| [551] | 671 | if (hwndMenu == (HWND) mp2) {
|
|---|
| [133] | 672 | WinDestroyWindow(hwndMenu);
|
|---|
| [551] | 673 | hwndMenu = (HWND) 0;
|
|---|
| [133] | 674 | }
|
|---|
| 675 | break;
|
|---|
| [2] | 676 |
|
|---|
| [824] | 677 | case WM_FOCUSCHANGE:
|
|---|
| 678 | {
|
|---|
| 679 | HAB hab = WinQueryAnchorBlock(hwnd);
|
|---|
| 680 | HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT);
|
|---|
| 681 | HWND hwndFrame = WinQueryWindow(hwndParent, QW_PARENT);
|
|---|
| 682 | static HACCEL haccelSaved = NULLHANDLE;
|
|---|
| 683 | static HACCEL haccelDriveList = NULLHANDLE;
|
|---|
| 684 | static HACCEL haccelSetupList = NULLHANDLE;
|
|---|
| 685 | static HACCEL haccelUserList = NULLHANDLE;
|
|---|
| 686 | static HACCEL haccelCmdList = NULLHANDLE;
|
|---|
| 687 | static HACCEL haccelButtonList = NULLHANDLE;
|
|---|
| 688 | // DbgMsg(pszSrcFile, __LINE__, "WM_FOCUSCHANGE %u", SHORT1FROMMP(mp2));
|
|---|
| 689 | id = WinQueryWindowUShort(hwndParent, QWS_ID);
|
|---|
| 690 | if (SHORT1FROMMP(mp2)) {
|
|---|
| [1335] | 691 | // If getting focus 1st time - save original accelerator
|
|---|
| 692 | if (haccelSaved == NULLHANDLE) {
|
|---|
| 693 | haccelSaved = WinQueryAccelTable(hab, hwndFrame);
|
|---|
| 694 | if (haccelSaved == NULLHANDLE)
|
|---|
| 695 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable");
|
|---|
| 696 | // else
|
|---|
| 697 | // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved);
|
|---|
| 698 | }
|
|---|
| 699 | if (haccelSaved != NULLHANDLE) {
|
|---|
| 700 | switch (id) {
|
|---|
| 701 | case MAIN_DRIVELIST:
|
|---|
| 702 | if (haccelDriveList == NULLHANDLE) {
|
|---|
| 703 | haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST);
|
|---|
| 704 | if (haccelDriveList == NULLHANDLE)
|
|---|
| 705 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
|---|
| 706 | }
|
|---|
| 707 | if (haccelDriveList != NULLHANDLE) {
|
|---|
| 708 | if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame))
|
|---|
| 709 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
|---|
| 710 | // else
|
|---|
| 711 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList);
|
|---|
| 712 | }
|
|---|
| 713 | break;
|
|---|
| 714 | case MAIN_SETUPLIST:
|
|---|
| 715 | if (haccelSetupList == NULLHANDLE) {
|
|---|
| 716 | haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST);
|
|---|
| 717 | if (haccelSetupList == NULLHANDLE)
|
|---|
| 718 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
|---|
| 719 | }
|
|---|
| 720 | if (haccelSetupList != NULLHANDLE) {
|
|---|
| 721 | if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame))
|
|---|
| 722 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
|---|
| 723 | // else
|
|---|
| 724 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList);
|
|---|
| 725 | }
|
|---|
| 726 | break;
|
|---|
| 727 | case MAIN_CMDLIST:
|
|---|
| 728 | if (haccelCmdList == NULLHANDLE) {
|
|---|
| 729 | haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST);
|
|---|
| 730 | if (haccelCmdList == NULLHANDLE)
|
|---|
| 731 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
|---|
| 732 | }
|
|---|
| 733 | if (haccelCmdList != NULLHANDLE) {
|
|---|
| 734 | if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame))
|
|---|
| 735 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
|---|
| 736 | // else
|
|---|
| 737 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList);
|
|---|
| 738 | }
|
|---|
| 739 | break;
|
|---|
| 740 | case MAIN_USERLIST:
|
|---|
| 741 | if (haccelUserList == NULLHANDLE) {
|
|---|
| 742 | haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST);
|
|---|
| 743 | if (haccelUserList == NULLHANDLE)
|
|---|
| 744 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
|---|
| 745 | }
|
|---|
| 746 | if (haccelUserList != NULLHANDLE) {
|
|---|
| 747 | if (!WinSetAccelTable(hab, haccelUserList, hwndFrame))
|
|---|
| 748 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
|---|
| 749 | // else
|
|---|
| 750 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList);
|
|---|
| 751 | }
|
|---|
| 752 | break;
|
|---|
| 753 | case MAIN_BUTTONLIST:
|
|---|
| 754 | if (haccelButtonList == NULLHANDLE) {
|
|---|
| 755 | haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST);
|
|---|
| 756 | if (haccelButtonList == NULLHANDLE)
|
|---|
| 757 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
|---|
| 758 | }
|
|---|
| 759 | if (haccelButtonList != NULLHANDLE) {
|
|---|
| 760 | if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame))
|
|---|
| 761 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
|---|
| 762 | // else
|
|---|
| 763 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList);
|
|---|
| 764 | }
|
|---|
| 765 | break;
|
|---|
| 766 | } // switch
|
|---|
| 767 | }
|
|---|
| [824] | 768 | }
|
|---|
| 769 | else {
|
|---|
| [1335] | 770 | // Losing focus
|
|---|
| 771 | switch (id) {
|
|---|
| 772 | case MAIN_DRIVELIST:
|
|---|
| 773 | case MAIN_SETUPLIST:
|
|---|
| 774 | case MAIN_CMDLIST:
|
|---|
| 775 | case MAIN_USERLIST:
|
|---|
| 776 | case MAIN_BUTTONLIST:
|
|---|
| 777 | if (haccelSaved != NULLHANDLE) {
|
|---|
| 778 | if (!WinSetAccelTable(hab, haccelSaved, hwndFrame))
|
|---|
| 779 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
|---|
| 780 | // else
|
|---|
| 781 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved);
|
|---|
| 782 | }
|
|---|
| 783 | break;
|
|---|
| 784 | } // switch
|
|---|
| [824] | 785 | }
|
|---|
| 786 | }
|
|---|
| 787 | break; // WM_FOCUSCHANGE
|
|---|
| 788 |
|
|---|
| [133] | 789 | case WM_CONTEXTMENU:
|
|---|
| 790 | {
|
|---|
| 791 | MRESULT ret = MRFROMSHORT(TRUE);
|
|---|
| [2] | 792 |
|
|---|
| [133] | 793 | if (hwndMenu)
|
|---|
| [1335] | 794 | WinDestroyWindow(hwndMenu);
|
|---|
| [551] | 795 | hwndMenu = (HWND) 0;
|
|---|
| [133] | 796 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
|---|
| [551] | 797 | switch (id) {
|
|---|
| [133] | 798 | case MAIN_CMDLIST:
|
|---|
| [1335] | 799 | WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
|---|
| 800 | QW_PARENT),
|
|---|
| 801 | QW_PARENT),
|
|---|
| 802 | FID_CLIENT),
|
|---|
| 803 | WM_COMMAND, MPFROM2SHORT(IDM_EDITCOMMANDS, 0), MPVOID);
|
|---|
| 804 | break;
|
|---|
| [133] | 805 | case MAIN_USERLIST:
|
|---|
| 806 | case MAIN_SETUPLIST:
|
|---|
| [1335] | 807 | hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
|
|---|
| 808 | if (hwndMenu)
|
|---|
| 809 | PopupMenu(hwnd,
|
|---|
| 810 | WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
|---|
| 811 | QW_PARENT),
|
|---|
| 812 | QW_PARENT),
|
|---|
| 813 | FID_CLIENT), hwndMenu);
|
|---|
| 814 | break;
|
|---|
| [133] | 815 | default:
|
|---|
| [1335] | 816 | ret = FALSE;
|
|---|
| 817 | break;
|
|---|
| [824] | 818 | } // switch
|
|---|
| [133] | 819 | return ret;
|
|---|
| 820 | }
|
|---|
| [2] | 821 |
|
|---|
| [133] | 822 | case WM_CONTROL:
|
|---|
| [551] | 823 | if (hwndStatus2) {
|
|---|
| 824 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| [133] | 825 | case CBID_EDIT:
|
|---|
| [1335] | 826 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 827 | switch (SHORT2FROMMP(mp1)) {
|
|---|
| 828 | case EN_SETFOCUS:
|
|---|
| 829 | switch (id) {
|
|---|
| 830 | case MAIN_CMDLIST:
|
|---|
| 831 | WinSetWindowText(hwndStatus2, GetPString(IDS_CMDLISTHELP));
|
|---|
| 832 | break;
|
|---|
| 833 | case MAIN_SETUPLIST:
|
|---|
| 834 | WinSetWindowText(hwndStatus2, GetPString(IDS_SETUPLISTHELP));
|
|---|
| 835 | break;
|
|---|
| 836 | case MAIN_USERLIST:
|
|---|
| 837 | WinSetWindowText(hwndStatus2, GetPString(IDS_USERLISTHELP));
|
|---|
| 838 | break;
|
|---|
| 839 | case MAIN_DRIVELIST:
|
|---|
| 840 | WinSetWindowText(hwndStatus2, GetPString(IDS_DRIVELISTHELP));
|
|---|
| 841 | break;
|
|---|
| 842 | case MAIN_BUTTONLIST:
|
|---|
| 843 | WinSetWindowText(hwndStatus2, GetPString(IDS_BUTTONLISTHELP));
|
|---|
| 844 | break;
|
|---|
| 845 | default:
|
|---|
| 846 | break;
|
|---|
| 847 | }
|
|---|
| 848 | break;
|
|---|
| [2] | 849 |
|
|---|
| [1335] | 850 | default:
|
|---|
| 851 | break;
|
|---|
| 852 | }
|
|---|
| [133] | 853 | }
|
|---|
| 854 | break;
|
|---|
| [2] | 855 |
|
|---|
| [133] | 856 | default:
|
|---|
| 857 | break;
|
|---|
| 858 | }
|
|---|
| 859 | break;
|
|---|
| [2] | 860 |
|
|---|
| [133] | 861 | case WM_BEGINDRAG:
|
|---|
| 862 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [447] | 863 | // 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] | 864 | if (id == CBID_EDIT &&
|
|---|
| [1335] | 865 | WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) ==
|
|---|
| 866 | MAIN_USERLIST) {
|
|---|
| [2] | 867 |
|
|---|
| [133] | 868 | CHAR path[CCHMAXPATH];
|
|---|
| [2] | 869 |
|
|---|
| [133] | 870 | *path = 0;
|
|---|
| 871 | WinQueryWindowText(hwnd, CCHMAXPATH, path);
|
|---|
| 872 | bstrip(path);
|
|---|
| [447] | 873 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Dragging: %s",path);
|
|---|
| [133] | 874 | if (*path && !IsRoot(path))
|
|---|
| [1335] | 875 | DragOne(hwnd, (HWND) 0, path, FALSE);
|
|---|
| [133] | 876 | return 0;
|
|---|
| 877 | }
|
|---|
| 878 | break;
|
|---|
| [2] | 879 |
|
|---|
| [133] | 880 | case DM_DRAGOVER:
|
|---|
| 881 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
|---|
| [551] | 882 | if (id == MAIN_USERLIST) {
|
|---|
| 883 | if (!emphasized) {
|
|---|
| [1335] | 884 | emphasized = TRUE;
|
|---|
| 885 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| [133] | 886 | }
|
|---|
| [618] | 887 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
|---|
| [1335] | 888 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
|---|
| [133] | 889 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
|---|
| 890 | }
|
|---|
| 891 | break;
|
|---|
| [2] | 892 |
|
|---|
| [133] | 893 | case DM_DRAGLEAVE:
|
|---|
| 894 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
|---|
| [551] | 895 | if (id == MAIN_USERLIST) {
|
|---|
| 896 | if (emphasized) {
|
|---|
| [1335] | 897 | emphasized = FALSE;
|
|---|
| 898 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| [133] | 899 | }
|
|---|
| 900 | }
|
|---|
| 901 | break;
|
|---|
| [2] | 902 |
|
|---|
| [133] | 903 | case DM_DROPHELP:
|
|---|
| 904 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
|---|
| [551] | 905 | if (id == MAIN_USERLIST) {
|
|---|
| [133] | 906 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_USERLISTDROPHELP));
|
|---|
| 907 | return 0;
|
|---|
| 908 | }
|
|---|
| 909 | break;
|
|---|
| [2] | 910 |
|
|---|
| [133] | 911 | case DM_DROP:
|
|---|
| 912 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
|---|
| [551] | 913 | if (id == MAIN_USERLIST) {
|
|---|
| [2] | 914 |
|
|---|
| [133] | 915 | char szFrom[CCHMAXPATH + 2];
|
|---|
| [2] | 916 |
|
|---|
| [551] | 917 | if (emphasized) {
|
|---|
| [1335] | 918 | emphasized = FALSE;
|
|---|
| 919 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| [133] | 920 | }
|
|---|
| [618] | 921 | if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
|
|---|
| [1335] | 922 | MakeValidDir(szFrom);
|
|---|
| 923 | WinSetWindowText(hwnd, szFrom);
|
|---|
| 924 | PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
|---|
| 925 | QW_PARENT),
|
|---|
| 926 | QW_PARENT),
|
|---|
| 927 | FID_CLIENT),
|
|---|
| 928 | UM_COMMAND, MPFROM2SHORT(IDM_ADDTOUSERLIST, 0), MPVOID);
|
|---|
| 929 | return 0;
|
|---|
| [133] | 930 | }
|
|---|
| 931 | }
|
|---|
| 932 | break;
|
|---|
| [2] | 933 |
|
|---|
| [133] | 934 | case WM_DESTROY:
|
|---|
| 935 | if (hwndMenu)
|
|---|
| 936 | WinDestroyWindow(hwndMenu);
|
|---|
| [551] | 937 | hwndMenu = (HWND) 0;
|
|---|
| [133] | 938 | break;
|
|---|
| 939 | }
|
|---|
| [2] | 940 |
|
|---|
| [133] | 941 | return oldproc(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 942 | }
|
|---|
| 943 |
|
|---|
| [133] | 944 | void BubbleHelp(HWND hwnd, BOOL other, BOOL drive, BOOL above, char *help)
|
|---|
| 945 | {
|
|---|
| 946 | if (help && *help &&
|
|---|
| 947 | ((drive && fDrivebarHelp) ||
|
|---|
| [551] | 948 | (other && fOtherHelp) || (!other && !drive && fToolbarHelp))) {
|
|---|
| [133] | 949 | if ((!hwndBubble ||
|
|---|
| [1335] | 950 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
|---|
| 951 | !WinQueryCapture(HWND_DESKTOP))
|
|---|
| [551] | 952 | MakeBubble(hwnd, above, help);
|
|---|
| [133] | 953 | }
|
|---|
| [2] | 954 | }
|
|---|
| 955 |
|
|---|
| [133] | 956 | VOID MakeBubble(HWND hwnd, BOOL above, CHAR * help)
|
|---|
| 957 | {
|
|---|
| 958 | if (!hwnd || !help || !*help)
|
|---|
| 959 | return;
|
|---|
| [2] | 960 |
|
|---|
| [133] | 961 | if (hwndBubble)
|
|---|
| 962 | WinDestroyWindow(hwndBubble);
|
|---|
| [2] | 963 |
|
|---|
| [133] | 964 | {
|
|---|
| 965 | HWND hwndActive;
|
|---|
| 966 | char ucClassname[8];
|
|---|
| [2] | 967 |
|
|---|
| [133] | 968 | hwndActive = WinQueryActiveWindow(HWND_DESKTOP);
|
|---|
| [551] | 969 | if (hwndActive) {
|
|---|
| [133] | 970 | /* don't bring up help if window isn't active */
|
|---|
| 971 | if (!WinIsChild(hwnd, hwndActive))
|
|---|
| [1335] | 972 | return;
|
|---|
| [133] | 973 | }
|
|---|
| 974 | hwndActive = WinQueryFocus(HWND_DESKTOP);
|
|---|
| [551] | 975 | if (WinQueryClassName(hwndActive, sizeof(ucClassname), ucClassname)) {
|
|---|
| [133] | 976 | /* don't bring up help if a menu is active */
|
|---|
| 977 | if (!strcmp(ucClassname, "#4"))
|
|---|
| [1335] | 978 | return;
|
|---|
| [133] | 979 | }
|
|---|
| 980 | }
|
|---|
| [2] | 981 |
|
|---|
| 982 | hwndBubble = WinCreateWindow(HWND_DESKTOP,
|
|---|
| [1335] | 983 | WC_BUBBLE,
|
|---|
| 984 | help,
|
|---|
| 985 | WS_CLIPSIBLINGS | SS_TEXT |
|
|---|
| 986 | DT_CENTER | DT_VCENTER,
|
|---|
| 987 | 0,
|
|---|
| 988 | 0,
|
|---|
| 989 | 0,
|
|---|
| 990 | 0,
|
|---|
| 991 | HWND_DESKTOP, HWND_TOP, MAIN_HELP, NULL, NULL);
|
|---|
| [376] | 992 | if (!hwndBubble)
|
|---|
| [551] | 993 | Win_Error2(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| [1335] | 994 | IDS_WINCREATEWINDOW);
|
|---|
| [551] | 995 | else {
|
|---|
| [133] | 996 | HPS hps;
|
|---|
| 997 | POINTL aptl[TXTBOX_COUNT], ptl, tptl;
|
|---|
| 998 | LONG lxScreen, sx, sy, extra = 0, lyScreen;
|
|---|
| 999 | char *p, *pp, *wp;
|
|---|
| 1000 | SWP swp;
|
|---|
| [2] | 1001 |
|
|---|
| [133] | 1002 | WinQueryWindowPos(hwnd, &swp);
|
|---|
| 1003 | lyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
|
|---|
| 1004 | lxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
|
|---|
| 1005 | WinSetWindowULong(hwndBubble, QWL_USER, hwnd);
|
|---|
| [1391] | 1006 | //fixme to allow user to change presparams 1-10-09 GKY
|
|---|
| 1007 | SetPresParams(hwndBubble, NULL, NULL, NULL, FNT_8HELVETICA);
|
|---|
| [133] | 1008 | hps = WinGetPS(hwndBubble);
|
|---|
| 1009 | p = help;
|
|---|
| 1010 | tptl.x = tptl.y = 0;
|
|---|
| [551] | 1011 | while (p && *p) {
|
|---|
| [133] | 1012 | wp = NULL;
|
|---|
| 1013 | pp = strchr(p, '\r');
|
|---|
| [551] | 1014 | if (pp) {
|
|---|
| [1335] | 1015 | wp = pp;
|
|---|
| 1016 | *pp = 0;
|
|---|
| 1017 | pp++;
|
|---|
| [133] | 1018 | }
|
|---|
| 1019 | GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
|
|---|
| 1020 | tptl.x = max(aptl[TXTBOX_TOPRIGHT].x, tptl.x);
|
|---|
| 1021 | if (tptl.y)
|
|---|
| [1335] | 1022 | tptl.y += extra;
|
|---|
| [133] | 1023 | else
|
|---|
| [1335] | 1024 | extra = aptl[TXTBOX_TOPLEFT].y / 4;
|
|---|
| [133] | 1025 | tptl.y += aptl[TXTBOX_TOPLEFT].y;
|
|---|
| 1026 | if (wp)
|
|---|
| [1335] | 1027 | *wp = '\r';
|
|---|
| [133] | 1028 | p = pp;
|
|---|
| 1029 | }
|
|---|
| 1030 | WinSetWindowULong(hwndBubble, QWL_USER + 4, extra);
|
|---|
| 1031 | WinReleasePS(hps);
|
|---|
| 1032 | ptl.x = ptl.y = 0;
|
|---|
| 1033 | WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptl, 1);
|
|---|
| [551] | 1034 | if (above) {
|
|---|
| [133] | 1035 | sy = ptl.y + swp.cy + 4;
|
|---|
| [551] | 1036 | if (sy + tptl.y + 12 > lyScreen) {
|
|---|
| [1335] | 1037 | above = FALSE;
|
|---|
| 1038 | sy = ptl.y - (tptl.y + 14);
|
|---|
| [133] | 1039 | }
|
|---|
| 1040 | }
|
|---|
| 1041 | else
|
|---|
| 1042 | sy = ptl.y - (tptl.y + 14);
|
|---|
| 1043 | if (ptl.x > (lxScreen / 2))
|
|---|
| 1044 | sx = (ptl.x - tptl.x) - 16;
|
|---|
| 1045 | else
|
|---|
| 1046 | sx = ptl.x + (54 * (above == FALSE)) + 2;
|
|---|
| 1047 | if (sx < 0)
|
|---|
| 1048 | sx = 0;
|
|---|
| 1049 | if (sx + tptl.x + 14 > lxScreen)
|
|---|
| 1050 | sx = lxScreen - (tptl.x + 14);
|
|---|
| [551] | 1051 | if (sy < 0) {
|
|---|
| [133] | 1052 | sy = ptl.y + swp.cy + 4;
|
|---|
| 1053 | if (sy + tptl.y + 12 > lyScreen)
|
|---|
| [1335] | 1054 | sy = 0;
|
|---|
| [133] | 1055 | }
|
|---|
| 1056 | WinSetWindowPos(hwndBubble, HWND_TOP, sx, sy,
|
|---|
| [1335] | 1057 | tptl.x + 14,
|
|---|
| 1058 | tptl.y + 12,
|
|---|
| 1059 | SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER |
|
|---|
| 1060 | SWP_MOVE | SWP_SIZE);
|
|---|
| [133] | 1061 | }
|
|---|
| [2] | 1062 | }
|
|---|
| 1063 |
|
|---|
| [133] | 1064 | MRESULT EXPENTRY BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 1065 | {
|
|---|
| [551] | 1066 | switch (msg) {
|
|---|
| [133] | 1067 | case WM_SETFOCUS:
|
|---|
| 1068 | if (mp2)
|
|---|
| [551] | 1069 | PostMsg(hwnd, UM_FOCUSME, mp1, MPVOID);
|
|---|
| [133] | 1070 | break;
|
|---|
| [2] | 1071 |
|
|---|
| [133] | 1072 | case UM_FOCUSME:
|
|---|
| [551] | 1073 | WinSetFocus(HWND_DESKTOP, (HWND) mp1);
|
|---|
| [133] | 1074 | return 0;
|
|---|
| [2] | 1075 |
|
|---|
| [133] | 1076 | case WM_MOUSEMOVE:
|
|---|
| 1077 | WinShowWindow(hwnd, FALSE);
|
|---|
| 1078 | break;
|
|---|
| [2] | 1079 |
|
|---|
| [133] | 1080 | case UM_TIMER:
|
|---|
| 1081 | {
|
|---|
| 1082 | POINTL ptl;
|
|---|
| [2] | 1083 |
|
|---|
| [133] | 1084 | WinQueryPointerPos(HWND_DESKTOP, &ptl);
|
|---|
| 1085 | if (WinWindowFromPoint(HWND_DESKTOP, &ptl, TRUE) !=
|
|---|
| [1335] | 1086 | WinQueryWindowULong(hwnd, QWL_USER) || !WinIsWindowVisible(hwnd))
|
|---|
| 1087 | WinDestroyWindow(hwnd);
|
|---|
| [133] | 1088 | }
|
|---|
| 1089 | return 0;
|
|---|
| [2] | 1090 |
|
|---|
| [133] | 1091 | case WM_PAINT:
|
|---|
| 1092 | {
|
|---|
| 1093 | HPS hps;
|
|---|
| 1094 | SWP swp;
|
|---|
| 1095 | POINTL ptl, aptl[TXTBOX_COUNT];
|
|---|
| 1096 | CHAR *s, *p, *pp, *wp;
|
|---|
| 1097 | ULONG extra, tlen, y;
|
|---|
| [2] | 1098 |
|
|---|
| [133] | 1099 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
|---|
| [551] | 1100 | if (hps) {
|
|---|
| [1335] | 1101 | WinQueryWindowPos(hwnd, &swp);
|
|---|
| 1102 | GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0);
|
|---|
| 1103 | GpiSetColor(hps, ((255 << 16) | (255 << 8) | 198));
|
|---|
| 1104 | GpiSetBackMix(hps, BM_LEAVEALONE);
|
|---|
| 1105 | GpiSetMix(hps, FM_OVERPAINT);
|
|---|
| 1106 | ptl.x = ptl.y = 0;
|
|---|
| 1107 | GpiMove(hps, &ptl);
|
|---|
| 1108 | ptl.x = swp.cx - 1;
|
|---|
| 1109 | ptl.y = swp.cy - 1;
|
|---|
| 1110 | GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
|
|---|
| 1111 | tlen = WinQueryWindowTextLength(hwnd);
|
|---|
| 1112 | if (tlen) {
|
|---|
| 1113 | s = xmalloc(tlen + 2, pszSrcFile, __LINE__);
|
|---|
| 1114 | if (s) {
|
|---|
| 1115 | WinQueryWindowText(hwnd, tlen + 1, s);
|
|---|
| 1116 | if (*s) {
|
|---|
| 1117 | p = s;
|
|---|
| 1118 | y = swp.cy - 3;
|
|---|
| 1119 | extra = WinQueryWindowULong(hwnd, QWL_USER + 4);
|
|---|
| 1120 | GpiSetColor(hps, 0);
|
|---|
| 1121 | GpiSetMix(hps, FM_OVERPAINT);
|
|---|
| 1122 | while (p && *p) {
|
|---|
| 1123 | wp = NULL;
|
|---|
| 1124 | pp = strchr(p, '\r');
|
|---|
| 1125 | if (pp) {
|
|---|
| 1126 | wp = pp;
|
|---|
| 1127 | *pp = 0;
|
|---|
| 1128 | pp++;
|
|---|
| 1129 | }
|
|---|
| 1130 | GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
|
|---|
| 1131 | ptl.x = 7;
|
|---|
| 1132 | y -= aptl[TXTBOX_TOPLEFT].y;
|
|---|
| 1133 | if (p != s)
|
|---|
| 1134 | y -= extra;
|
|---|
| 1135 | ptl.y = y;
|
|---|
| 1136 | GpiCharStringAt(hps, &ptl, strlen(p), p);
|
|---|
| 1137 | if (wp)
|
|---|
| 1138 | *wp = '\r';
|
|---|
| 1139 | p = pp;
|
|---|
| 1140 | }
|
|---|
| 1141 | }
|
|---|
| 1142 | free(s);
|
|---|
| 1143 | }
|
|---|
| 1144 | }
|
|---|
| 1145 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) && swp.cx > 6 && swp.cy > 6) {
|
|---|
| 1146 | GpiSetColor(hps, CLR_WHITE);
|
|---|
| 1147 | ptl.x = 1;
|
|---|
| 1148 | ptl.y = 1;
|
|---|
| 1149 | GpiMove(hps, &ptl);
|
|---|
| 1150 | ptl.y = swp.cy - 2;
|
|---|
| 1151 | GpiLine(hps, &ptl);
|
|---|
| 1152 | ptl.x = swp.cx - 2;
|
|---|
| 1153 | GpiLine(hps, &ptl);
|
|---|
| 1154 | ptl.x = 2;
|
|---|
| 1155 | ptl.y = 2;
|
|---|
| 1156 | GpiMove(hps, &ptl);
|
|---|
| 1157 | ptl.y = swp.cy - 3;
|
|---|
| 1158 | GpiLine(hps, &ptl);
|
|---|
| 1159 | ptl.x = swp.cx - 3;
|
|---|
| 1160 | GpiLine(hps, &ptl);
|
|---|
| 1161 | GpiSetColor(hps, CLR_BROWN);
|
|---|
| 1162 | ptl.x = 1;
|
|---|
| 1163 | ptl.y = 1;
|
|---|
| 1164 | GpiMove(hps, &ptl);
|
|---|
| 1165 | ptl.x = swp.cx - 2;
|
|---|
| 1166 | GpiLine(hps, &ptl);
|
|---|
| 1167 | ptl.y = swp.cy - 2;
|
|---|
| 1168 | GpiLine(hps, &ptl);
|
|---|
| 1169 | ptl.x = 2;
|
|---|
| 1170 | ptl.y = 2;
|
|---|
| 1171 | GpiMove(hps, &ptl);
|
|---|
| 1172 | ptl.x = swp.cx - 3;
|
|---|
| 1173 | GpiLine(hps, &ptl);
|
|---|
| 1174 | ptl.y = swp.cy - 3;
|
|---|
| 1175 | GpiLine(hps, &ptl);
|
|---|
| 1176 | }
|
|---|
| 1177 | WinEndPaint(hps);
|
|---|
| [133] | 1178 | }
|
|---|
| 1179 | }
|
|---|
| 1180 | return 0;
|
|---|
| [2] | 1181 |
|
|---|
| [133] | 1182 | case WM_CLOSE:
|
|---|
| 1183 | WinDestroyWindow(hwnd);
|
|---|
| 1184 | return 0;
|
|---|
| [2] | 1185 |
|
|---|
| [133] | 1186 | case WM_DESTROY:
|
|---|
| [551] | 1187 | hwndBubble = (HWND) 0;
|
|---|
| [133] | 1188 | break;
|
|---|
| 1189 | }
|
|---|
| 1190 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 1191 | }
|
|---|
| 1192 |
|
|---|
| [133] | 1193 | MRESULT EXPENTRY LEDProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 1194 | {
|
|---|
| [551] | 1195 | switch (msg) {
|
|---|
| [133] | 1196 | case WM_CREATE:
|
|---|
| 1197 | {
|
|---|
| 1198 | MRESULT mr = PFNWPStatic(hwnd, msg, mp1, mp2);
|
|---|
| 1199 | HBITMAP hbmold = (HBITMAP) 0;
|
|---|
| 1200 | HPS hps = (HPS) 0;
|
|---|
| [2] | 1201 |
|
|---|
| [551] | 1202 | switch (WinQueryWindowUShort(hwnd, QWS_ID)) {
|
|---|
| [133] | 1203 | case MAIN_LED:
|
|---|
| [1335] | 1204 | hps = WinGetPS(hwnd);
|
|---|
| 1205 | hbmold = (HBITMAP) WinSendMsg(hwnd, SM_QUERYHANDLE, MPVOID, MPVOID);
|
|---|
| 1206 | if (!fBlueLED) {
|
|---|
| 1207 | hbmLEDon = GpiLoadBitmap(hps, 0, LEDON_BMP, 12, 12);
|
|---|
| 1208 | hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF_BMP, 12, 12);
|
|---|
| 1209 | }
|
|---|
| 1210 | else {
|
|---|
| 1211 | hbmLEDon = GpiLoadBitmap(hps, 0, LEDON2_BMP, 12, 12);
|
|---|
| 1212 | hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF2_BMP, 12, 12);
|
|---|
| 1213 | }
|
|---|
| 1214 | if (hbmLEDoff && hbmLEDon)
|
|---|
| 1215 | WinSendMsg(hwnd, SM_SETHANDLE, MPFROMLONG(hbmLEDoff), MPVOID);
|
|---|
| 1216 | else {
|
|---|
| 1217 | if (hbmLEDoff)
|
|---|
| 1218 | GpiDeleteBitmap(hbmLEDoff);
|
|---|
| 1219 | if (hbmLEDon)
|
|---|
| 1220 | GpiDeleteBitmap(hbmLEDon);
|
|---|
| 1221 | }
|
|---|
| 1222 | if (hbmold &&
|
|---|
| 1223 | hbmLEDon &&
|
|---|
| 1224 | hbmLEDoff && hbmold != hbmLEDon && hbmold != hbmLEDoff)
|
|---|
| 1225 | GpiDeleteBitmap(hbmold);
|
|---|
| 1226 | if (hps)
|
|---|
| 1227 | WinReleasePS(hps);
|
|---|
| 1228 | break;
|
|---|
| [133] | 1229 | default:
|
|---|
| [1391] | 1230 | //fixme to allow user to change presparams 1-10-09 GKY
|
|---|
| [1335] | 1231 | SetPresParams(hwnd,
|
|---|
| 1232 | &RGBGREY,
|
|---|
| [1391] | 1233 | &RGBBLACK, &RGBGREY, FNT_6HELVETICA );
|
|---|
| [1335] | 1234 | break;
|
|---|
| [2] | 1235 | }
|
|---|
| [133] | 1236 | return mr;
|
|---|
| 1237 | }
|
|---|
| [2] | 1238 |
|
|---|
| [133] | 1239 | case WM_SETFOCUS:
|
|---|
| 1240 | if (mp2)
|
|---|
| [551] | 1241 | PostMsg(hwnd, UM_FOCUSME, mp1, MPVOID);
|
|---|
| [133] | 1242 | break;
|
|---|
| [2] | 1243 |
|
|---|
| [133] | 1244 | case UM_FOCUSME:
|
|---|
| [551] | 1245 | WinSetFocus(HWND_DESKTOP, (HWND) mp1);
|
|---|
| [133] | 1246 | return 0;
|
|---|
| [2] | 1247 |
|
|---|
| [133] | 1248 | case WM_MOUSEMOVE:
|
|---|
| [551] | 1249 | BubbleHelp(hwnd, TRUE, FALSE, FALSE, GetPString(IDS_LEDHELP));
|
|---|
| 1250 | if (!fNoFinger) {
|
|---|
| [133] | 1251 | WinSetPointer(HWND_DESKTOP, hptrFinger);
|
|---|
| 1252 | return MRFROMLONG(TRUE);
|
|---|
| 1253 | }
|
|---|
| 1254 | break;
|
|---|
| [2] | 1255 |
|
|---|
| [133] | 1256 | case WM_BUTTON1CLICK:
|
|---|
| 1257 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 1258 | WM_COMMAND, MPFROM2SHORT(IDM_SHOWNOTEWND, 0), MPVOID);
|
|---|
| [133] | 1259 | break;
|
|---|
| [2] | 1260 |
|
|---|
| [133] | 1261 | case WM_BUTTON2CLICK:
|
|---|
| 1262 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 1263 | WM_COMMAND, MPFROM2SHORT(IDM_HIDENOTEWND, 0), MPVOID);
|
|---|
| [133] | 1264 | break;
|
|---|
| [2] | 1265 |
|
|---|
| [133] | 1266 | case WM_CHORD:
|
|---|
| 1267 | case WM_BUTTON3CLICK:
|
|---|
| 1268 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 1269 | WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
|---|
| [133] | 1270 | break;
|
|---|
| 1271 | }
|
|---|
| 1272 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 1273 | }
|
|---|
| 1274 |
|
|---|
| [133] | 1275 | MRESULT EXPENTRY ChildButtonProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 1276 | {
|
|---|
| 1277 | USHORT id;
|
|---|
| [672] | 1278 | TOOL *tool;
|
|---|
| 1279 |
|
|---|
| [551] | 1280 | static HWND hwndMenu = (HWND) 0;
|
|---|
| [2] | 1281 |
|
|---|
| [551] | 1282 | switch (msg) {
|
|---|
| [133] | 1283 | case WM_BUTTON1DOWN:
|
|---|
| 1284 | case WM_BUTTON2DOWN:
|
|---|
| 1285 | case WM_BUTTON3DOWN:
|
|---|
| 1286 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 1287 | break;
|
|---|
| [2] | 1288 |
|
|---|
| [133] | 1289 | case WM_MOUSEMOVE:
|
|---|
| [551] | 1290 | if (fToolbarHelp) {
|
|---|
| 1291 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
|---|
| [1335] | 1292 | && !WinQueryCapture(HWND_DESKTOP)) {
|
|---|
| 1293 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1294 | tool = find_tool(id);
|
|---|
| 1295 | if (tool && tool->help && *tool->help) {
|
|---|
| [2] | 1296 |
|
|---|
| [1335] | 1297 | char s[128];
|
|---|
| [2] | 1298 |
|
|---|
| [1335] | 1299 | strcpy(s, tool->help);
|
|---|
| 1300 | if (tool->flags & T_DROPABLE)
|
|---|
| 1301 | strcat(s, GetPString(IDS_DROPONMETEXT));
|
|---|
| 1302 | MakeBubble(hwnd, FALSE, s);
|
|---|
| 1303 | }
|
|---|
| [133] | 1304 | }
|
|---|
| 1305 | }
|
|---|
| 1306 | break;
|
|---|
| [2] | 1307 |
|
|---|
| [133] | 1308 | case WM_COMMAND:
|
|---|
| [551] | 1309 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| [133] | 1310 | case IDM_HELP:
|
|---|
| 1311 | if (hwndHelp)
|
|---|
| [1335] | 1312 | WinSendMsg(hwndHelp,
|
|---|
| 1313 | HM_DISPLAY_HELP,
|
|---|
| 1314 | MPFROM2SHORT(HELP_TOOLBAR, 0), MPFROMSHORT(HM_RESOURCEID));
|
|---|
| [133] | 1315 | break;
|
|---|
| [2] | 1316 |
|
|---|
| [930] | 1317 | case IDM_HIDEANYTOOL: /* hide any tool */
|
|---|
| 1318 | case IDM_HIDETOOL: /* hide tool */
|
|---|
| [133] | 1319 | if (SHORT1FROMMP(mp1) == IDM_HIDETOOL)
|
|---|
| [1335] | 1320 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [133] | 1321 | else
|
|---|
| [1335] | 1322 | id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd,
|
|---|
| 1323 | PickToolProc, FM3ModHandle,
|
|---|
| 1324 | PICKBTN_FRAME, GetPString(IDS_HIDETEXT));
|
|---|
| [551] | 1325 | if (id) {
|
|---|
| [1335] | 1326 | tool = find_tool(id);
|
|---|
| 1327 | if (tool) {
|
|---|
| 1328 | tool->flags |= T_INVISIBLE;
|
|---|
| 1329 | save_tools(NULL);
|
|---|
| 1330 | }
|
|---|
| [133] | 1331 | }
|
|---|
| 1332 | break;
|
|---|
| [2] | 1333 |
|
|---|
| [930] | 1334 | case IDM_SHOWTOOLS: /* show all tools */
|
|---|
| [133] | 1335 | tool = toolhead;
|
|---|
| [551] | 1336 | while (tool) {
|
|---|
| [1335] | 1337 | tool->flags &= (~T_INVISIBLE);
|
|---|
| 1338 | tool = tool->next;
|
|---|
| [133] | 1339 | }
|
|---|
| [1131] | 1340 | save_tools(NULL);
|
|---|
| [133] | 1341 | break;
|
|---|
| [2] | 1342 |
|
|---|
| [930] | 1343 | case IDM_DELETEANYTOOL: /* delete any button */
|
|---|
| 1344 | case IDM_DELETETOOL: /* delete button */
|
|---|
| [133] | 1345 | if (SHORT1FROMMP(mp1) == IDM_DELETETOOL)
|
|---|
| [1335] | 1346 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [133] | 1347 | else
|
|---|
| [1335] | 1348 | id =
|
|---|
| 1349 | (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
|
|---|
| 1350 | PICKBTN_FRAME, GetPString(IDS_DELETETEXT));
|
|---|
| [133] | 1351 | if (id)
|
|---|
| [1335] | 1352 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP,
|
|---|
| 1353 | MPFROM2SHORT(id, 0), MPVOID);
|
|---|
| [133] | 1354 | return 0;
|
|---|
| [2] | 1355 |
|
|---|
| [930] | 1356 | case IDM_EDITANYTOOL: /* edit any button */
|
|---|
| 1357 | case IDM_EDITTOOL: /* edit button */
|
|---|
| [133] | 1358 | if (SHORT1FROMMP(mp1) == IDM_EDITTOOL)
|
|---|
| [1335] | 1359 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [133] | 1360 | else
|
|---|
| [1335] | 1361 | id =
|
|---|
| 1362 | (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
|
|---|
| 1363 | PICKBTN_FRAME, GetPString(IDS_EDITTEXT));
|
|---|
| [551] | 1364 | if (id) {
|
|---|
| [1335] | 1365 | tool = find_tool(id);
|
|---|
| 1366 | if (tool) {
|
|---|
| 1367 | if (WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,
|
|---|
| 1368 | ADDBTN_FRAME, (PVOID) tool))
|
|---|
| 1369 | WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
|---|
| 1370 | QW_PARENT),
|
|---|
| 1371 | QW_PARENT), FID_CLIENT),
|
|---|
| 1372 | WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),
|
|---|
| 1373 | MPFROM2SHORT(id, 0));
|
|---|
| 1374 | }
|
|---|
| [133] | 1375 | }
|
|---|
| 1376 | break;
|
|---|
| [2] | 1377 |
|
|---|
| [930] | 1378 | case IDM_ADDTOOL: /* add tool */
|
|---|
| [133] | 1379 | id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,
|
|---|
| [1335] | 1380 | ADDBTN_FRAME, MPVOID);
|
|---|
| [133] | 1381 | if (id && id != (USHORT) - 1)
|
|---|
| [1335] | 1382 | WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
|---|
| 1383 | QW_PARENT),
|
|---|
| 1384 | QW_PARENT), FID_CLIENT),
|
|---|
| 1385 | WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),
|
|---|
| 1386 | MPFROM2SHORT(id, 0));
|
|---|
| [133] | 1387 | break;
|
|---|
| [2] | 1388 |
|
|---|
| [930] | 1389 | case IDM_REORDERTOOLS: /* reorder tools */
|
|---|
| [133] | 1390 | WinDlgBox(HWND_DESKTOP,
|
|---|
| [1335] | 1391 | hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID);
|
|---|
| [133] | 1392 | break;
|
|---|
| [2] | 1393 |
|
|---|
| [133] | 1394 | case IDM_SAVETOOLS:
|
|---|
| 1395 | case IDM_LOADTOOLS:
|
|---|
| 1396 | if (WinDlgBox(HWND_DESKTOP,
|
|---|
| [1335] | 1397 | hwnd,
|
|---|
| 1398 | ToolIODlgProc,
|
|---|
| 1399 | FM3ModHandle,
|
|---|
| 1400 | SVBTN_FRAME,
|
|---|
| 1401 | (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ?
|
|---|
| 1402 | "TRUE" : NULL))
|
|---|
| 1403 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| [133] | 1404 | break;
|
|---|
| 1405 | }
|
|---|
| 1406 | ResizeTools(WinQueryWindow(hwnd, QW_PARENT));
|
|---|
| 1407 | return 0;
|
|---|
| [2] | 1408 |
|
|---|
| [133] | 1409 | case WM_MENUEND:
|
|---|
| [551] | 1410 | if (hwndMenu == (HWND) mp2) {
|
|---|
| [133] | 1411 | WinDestroyWindow(hwndMenu);
|
|---|
| [551] | 1412 | hwndMenu = (HWND) 0;
|
|---|
| [133] | 1413 | }
|
|---|
| 1414 | break;
|
|---|
| [2] | 1415 |
|
|---|
| [133] | 1416 | case WM_CONTEXTMENU:
|
|---|
| [1303] | 1417 | //DosEnterCritSec(); //GKY 11-29-08
|
|---|
| 1418 | DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
|
|---|
| [133] | 1419 | if (!hwndMenu)
|
|---|
| 1420 | hwndMenu = WinLoadMenu(hwnd, FM3ModHandle, ID_BUTTONMENU);
|
|---|
| [1303] | 1421 | DosReleaseMutexSem(hmtxFM2Globals);
|
|---|
| 1422 | //DosExitCritSec();
|
|---|
| [1391] | 1423 | //fixme to allow user to change font 1-10-09 GKY
|
|---|
| 1424 | SetPresParams(hwndMenu, NULL, NULL, NULL, FNT_10SYSTEMPROPORT);
|
|---|
| [133] | 1425 | if (PopupMenu(hwnd, hwnd, hwndMenu))
|
|---|
| 1426 | WinShowWindow(hwndMenu, TRUE);
|
|---|
| 1427 | return MRFROMSHORT(TRUE);
|
|---|
| [2] | 1428 |
|
|---|
| [133] | 1429 | case DM_DRAGOVER:
|
|---|
| 1430 | {
|
|---|
| [930] | 1431 | PDRAGINFO pDInfo; /* Pointer to DRAGINFO */
|
|---|
| [2] | 1432 |
|
|---|
| [930] | 1433 | pDInfo = (PDRAGINFO) mp1; /* Get DRAGINFO pointer */
|
|---|
| 1434 | DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
|
|---|
| [133] | 1435 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1436 | tool = find_tool(id);
|
|---|
| [551] | 1437 | if (!tool) {
|
|---|
| [1335] | 1438 | DrgFreeDraginfo(pDInfo);
|
|---|
| 1439 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
|---|
| [133] | 1440 | }
|
|---|
| [551] | 1441 | if (!(tool->flags & T_DROPABLE)) {
|
|---|
| [1335] | 1442 | DrgFreeDraginfo(pDInfo);
|
|---|
| 1443 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
|---|
| [133] | 1444 | }
|
|---|
| 1445 | {
|
|---|
| [1335] | 1446 | PDRAGITEM pDItem; /* Pointer to DRAGITEM */
|
|---|
| [2] | 1447 |
|
|---|
| [1335] | 1448 | pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
|
|---|
| 1449 | 0); /* Index to DRAGITEM */
|
|---|
| 1450 | if (DrgVerifyRMF(pDItem, /* Check valid rendering */
|
|---|
| 1451 | DRM_OS2FILE, /* mechanisms and data */
|
|---|
| 1452 | NULL)) { /* formats */
|
|---|
| 1453 | if (!(tool->flags & T_EMPHASIZED)) {
|
|---|
| 1454 | tool->flags |= T_EMPHASIZED;
|
|---|
| 1455 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
|---|
| 1456 | DrgFreeDraginfo(pDInfo);
|
|---|
| 1457 | }
|
|---|
| 1458 | return (MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
|
|---|
| 1459 | DO_MOVE)); /* Move operation valid */
|
|---|
| 1460 | }
|
|---|
| 1461 | DrgFreeDraginfo(pDInfo);
|
|---|
| [133] | 1462 | }
|
|---|
| 1463 | }
|
|---|
| [930] | 1464 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
|---|
| [2] | 1465 |
|
|---|
| [133] | 1466 | case DM_DROPHELP:
|
|---|
| 1467 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1468 | tool = find_tool(id);
|
|---|
| 1469 | PFNWPButton(hwnd, msg, mp1, mp2);
|
|---|
| 1470 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_TOOLDROPHELP));
|
|---|
| 1471 | return 0;
|
|---|
| [2] | 1472 |
|
|---|
| [133] | 1473 | case DM_DRAGLEAVE:
|
|---|
| 1474 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1475 | tool = find_tool(id);
|
|---|
| [551] | 1476 | if (tool && (tool->flags & T_DROPABLE)) {
|
|---|
| 1477 | if (tool->flags & T_EMPHASIZED) {
|
|---|
| [1335] | 1478 | tool->flags &= (~T_EMPHASIZED);
|
|---|
| 1479 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
|---|
| [133] | 1480 | }
|
|---|
| 1481 | }
|
|---|
| 1482 | break;
|
|---|
| [2] | 1483 |
|
|---|
| [133] | 1484 | case DM_DROP:
|
|---|
| 1485 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1486 | tool = find_tool(id);
|
|---|
| [551] | 1487 | if (tool && (tool->flags & T_DROPABLE) != 0) {
|
|---|
| [133] | 1488 | LISTINFO *li;
|
|---|
| 1489 | CNRDRAGINFO cdi;
|
|---|
| [2] | 1490 |
|
|---|
| [551] | 1491 | if (tool->flags & T_EMPHASIZED) {
|
|---|
| [1335] | 1492 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
|---|
| 1493 | tool->flags &= (~T_EMPHASIZED);
|
|---|
| [133] | 1494 | }
|
|---|
| 1495 | memset(&cdi, 0, sizeof(cdi));
|
|---|
| 1496 | cdi.pDragInfo = mp1;
|
|---|
| [551] | 1497 | li = DoFileDrop(hwnd, NULL, FALSE, mp1, MPFROMP(&cdi));
|
|---|
| [687] | 1498 | CheckPmDrgLimit(cdi.pDragInfo);
|
|---|
| [551] | 1499 | if (li) {
|
|---|
| [1335] | 1500 | li->type = id;
|
|---|
| 1501 | if (!li->list || !li->list[0])
|
|---|
| 1502 | FreeListInfo(li);
|
|---|
| 1503 | else {
|
|---|
| 1504 | HWND hwndActive;
|
|---|
| [2] | 1505 |
|
|---|
| [1335] | 1506 | hwndActive = TopWindow(hwndMain, (HWND) 0);
|
|---|
| 1507 | if (hwndActive) {
|
|---|
| 1508 | if (!WinSendMsg(hwndActive, UM_COMMAND, MPFROMP(li), MPVOID))
|
|---|
| 1509 | FreeListInfo(li);
|
|---|
| 1510 | }
|
|---|
| 1511 | else
|
|---|
| 1512 | FreeListInfo(li);
|
|---|
| 1513 | }
|
|---|
| [133] | 1514 | }
|
|---|
| 1515 | }
|
|---|
| 1516 | return 0;
|
|---|
| [2] | 1517 |
|
|---|
| [133] | 1518 | case WM_CLOSE:
|
|---|
| 1519 | WinDestroyWindow(hwnd);
|
|---|
| 1520 | return 0;
|
|---|
| 1521 | }
|
|---|
| 1522 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 1523 | }
|
|---|
| 1524 |
|
|---|
| [1125] | 1525 | static VOID BuildTools(HWND hwndT, BOOL resize)
|
|---|
| [133] | 1526 | {
|
|---|
| [376] | 1527 | TOOL *tool;
|
|---|
| 1528 | ULONG ctrlxpos = 18L;
|
|---|
| [133] | 1529 | CHAR s[33];
|
|---|
| 1530 | HENUM henum;
|
|---|
| 1531 | HWND hwndTool;
|
|---|
| [2] | 1532 |
|
|---|
| [133] | 1533 | henum = WinBeginEnumWindows(hwndT);
|
|---|
| 1534 | while ((hwndTool = WinGetNextWindow(henum)) != NULLHANDLE)
|
|---|
| [1125] | 1535 | if (!WinDestroyWindow(hwndTool))
|
|---|
| 1536 | Runtime_Error(pszSrcFile, __LINE__, "Unable to destroy toolbar button");
|
|---|
| [133] | 1537 | WinEndEnumWindows(henum);
|
|---|
| [551] | 1538 | if (!fToolbar) {
|
|---|
| [133] | 1539 | load_quicktools();
|
|---|
| 1540 | load_tools(NULL);
|
|---|
| 1541 | return;
|
|---|
| 1542 | }
|
|---|
| 1543 | if (!toolhead)
|
|---|
| 1544 | load_tools(NULL);
|
|---|
| 1545 | tool = toolhead;
|
|---|
| [551] | 1546 | while (tool) {
|
|---|
| 1547 | sprintf(s, "#%u", tool->id);
|
|---|
| 1548 | hwndTool = (HWND) 0;
|
|---|
| [376] | 1549 | if (!fTextTools) {
|
|---|
| [551] | 1550 | if (!(tool->flags & T_MYICON)) {
|
|---|
| [1335] | 1551 | hwndTool = WinCreateWindow(hwndT,
|
|---|
| 1552 | WC_TOOLBUTTONS,
|
|---|
| 1553 | s,
|
|---|
| 1554 | BS_NOPOINTERFOCUS |
|
|---|
| 1555 | BS_BITMAP | BS_PUSHBUTTON,
|
|---|
| 1556 | ctrlxpos,
|
|---|
| 1557 | 14,
|
|---|
| 1558 | 32,
|
|---|
| 1559 | 32, hwndT, HWND_TOP, tool->id, NULL, NULL);
|
|---|
| [376] | 1560 | }
|
|---|
| 1561 | if (!hwndTool) {
|
|---|
| [1335] | 1562 | HBITMAP hbm = LoadBitmapFromFileNum(tool->id);
|
|---|
| [551] | 1563 |
|
|---|
| [1335] | 1564 | if (hbm) {
|
|---|
| 1565 | BTNCDATA btc;
|
|---|
| [551] | 1566 |
|
|---|
| [1335] | 1567 | memset(&btc, 0, sizeof(btc));
|
|---|
| 1568 | btc.cb = sizeof(btc);
|
|---|
| 1569 | btc.hImage = hbm;
|
|---|
| 1570 | hwndTool = WinCreateWindow(hwndT,
|
|---|
| 1571 | WC_TOOLBUTTONS,
|
|---|
| 1572 | NullStr,
|
|---|
| 1573 | BS_NOPOINTERFOCUS |
|
|---|
| 1574 | BS_BITMAP | BS_PUSHBUTTON,
|
|---|
| 1575 | ctrlxpos,
|
|---|
| 1576 | 14,
|
|---|
| 1577 | 32,
|
|---|
| 1578 | 32,
|
|---|
| 1579 | hwndT, HWND_TOP, tool->id, &btc, NULL);
|
|---|
| 1580 | if (!hwndTool)
|
|---|
| 1581 | GpiDeleteBitmap(hbm);
|
|---|
| 1582 | }
|
|---|
| [133] | 1583 | }
|
|---|
| 1584 | if (hwndTool)
|
|---|
| [1335] | 1585 | tool->flags &= (~T_TEXT);
|
|---|
| [133] | 1586 | }
|
|---|
| [376] | 1587 | if (!hwndTool) {
|
|---|
| 1588 | hwndTool = WinCreateWindow(hwndT,
|
|---|
| [1335] | 1589 | WC_TOOLBUTTONS,
|
|---|
| 1590 | (!tool->text && tool->id >= IDM_COMMANDSTART
|
|---|
| 1591 | && tool->id <
|
|---|
| 1592 | IDM_QUICKTOOLSTART) ? command_title(tool->
|
|---|
| 1593 | id -
|
|---|
| 1594 | IDM_COMMANDSTART)
|
|---|
| 1595 | : tool->text,
|
|---|
| 1596 | BS_NOPOINTERFOCUS | BS_PUSHBUTTON, ctrlxpos,
|
|---|
| 1597 | 2, 54, 24, hwndT, HWND_TOP, tool->id, NULL,
|
|---|
| 1598 | NULL);
|
|---|
| [376] | 1599 | if (!hwndTool)
|
|---|
| [1335] | 1600 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 1601 | IDS_WINCREATEWINDOW);
|
|---|
| [551] | 1602 | tool->flags |= T_TEXT;
|
|---|
| [133] | 1603 | }
|
|---|
| [551] | 1604 | if (fToolTitles && !fTextTools) {
|
|---|
| [376] | 1605 | hwndTool = WinCreateWindow(hwndT,
|
|---|
| [1335] | 1606 | WC_STATIC,
|
|---|
| 1607 | tool->text,
|
|---|
| 1608 | SS_TEXT | DT_LEFT | DT_VCENTER,
|
|---|
| 1609 | ctrlxpos,
|
|---|
| 1610 | 1,
|
|---|
| 1611 | 32,
|
|---|
| 1612 | 10,
|
|---|
| 1613 | hwndT,
|
|---|
| 1614 | HWND_TOP, tool->id + 25000, NULL, NULL);
|
|---|
| [376] | 1615 | if (!hwndTool)
|
|---|
| [1335] | 1616 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 1617 | IDS_WINCREATEWINDOW);
|
|---|
| [376] | 1618 | else {
|
|---|
| [1335] | 1619 | SetPresParams(hwndTool,
|
|---|
| 1620 | &RGBGREY,
|
|---|
| [1391] | 1621 | &RGBBLACK, &RGBGREY, FNT_2SYSTEMVIO);
|
|---|
| [376] | 1622 | }
|
|---|
| [133] | 1623 | }
|
|---|
| [551] | 1624 | ctrlxpos += ((tool->flags & T_TEXT) ? 55L : 33L);
|
|---|
| [1391] | 1625 | //fixme to allow user to change presparams 1-10-09 GKY
|
|---|
| [551] | 1626 | SetPresParams(WinWindowFromID(hwndT, tool->id),
|
|---|
| [1391] | 1627 | NULL, NULL, NULL, FNT_8HELVETICA);
|
|---|
| [551] | 1628 | tool = tool->next;
|
|---|
| [930] | 1629 | } // while tool
|
|---|
| [376] | 1630 |
|
|---|
| 1631 | hwndTool = WinCreateWindow(hwndT,
|
|---|
| [1335] | 1632 | WC_BUTTON,
|
|---|
| 1633 | "#6010",
|
|---|
| 1634 | BS_NOPOINTERFOCUS |
|
|---|
| 1635 | BS_BITMAP | BS_PUSHBUTTON,
|
|---|
| 1636 | 1,
|
|---|
| 1637 | 19,
|
|---|
| 1638 | 14,
|
|---|
| 1639 | 13, hwndT, HWND_TOP, IDM_TOOLLEFT, NULL, NULL);
|
|---|
| [376] | 1640 | if (!hwndTool)
|
|---|
| [551] | 1641 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| [1335] | 1642 | IDS_WINCREATEWINDOW);
|
|---|
| [551] | 1643 | hwndTool =
|
|---|
| 1644 | WinCreateWindow(hwndT, WC_BUTTON, "#6011",
|
|---|
| [1335] | 1645 | BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 1, 4, 14,
|
|---|
| 1646 | 13, hwndT, HWND_TOP, IDM_TOOLRIGHT, NULL, NULL);
|
|---|
| [376] | 1647 | if (!hwndTool)
|
|---|
| [551] | 1648 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| [1335] | 1649 | IDS_WINCREATEWINDOW);
|
|---|
| [133] | 1650 | if (resize)
|
|---|
| 1651 | ResizeTools(hwndT);
|
|---|
| [2] | 1652 | }
|
|---|
| 1653 |
|
|---|
| [551] | 1654 | static MRESULT EXPENTRY CommandLineProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
|---|
| [1335] | 1655 | MPARAM mp2)
|
|---|
| [133] | 1656 | {
|
|---|
| 1657 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
|---|
| 1658 | static BOOL lbup = FALSE;
|
|---|
| [2] | 1659 |
|
|---|
| [551] | 1660 | switch (msg) {
|
|---|
| [133] | 1661 | case UM_FOCUSME:
|
|---|
| [551] | 1662 | WinSetFocus(HWND_DESKTOP, hwnd);
|
|---|
| [133] | 1663 | return 0;
|
|---|
| [2] | 1664 |
|
|---|
| [133] | 1665 | case WM_SETFOCUS:
|
|---|
| [551] | 1666 | if (!mp2 && !lbup) {
|
|---|
| [2] | 1667 |
|
|---|
| [133] | 1668 | PID pid;
|
|---|
| 1669 | TID tid;
|
|---|
| [2] | 1670 |
|
|---|
| [551] | 1671 | if (WinQueryWindowUShort((HWND) mp1, QWS_ID) == COMMAND_BUTTON)
|
|---|
| [1335] | 1672 | break;
|
|---|
| [551] | 1673 | if (!WinQueryWindowProcess((HWND) mp1, &pid, &tid) || pid == mypid)
|
|---|
| [1335] | 1674 | WinDestroyWindow(hwnd);
|
|---|
| [133] | 1675 | }
|
|---|
| 1676 | break;
|
|---|
| [2] | 1677 |
|
|---|
| [133] | 1678 | case UM_RESCAN:
|
|---|
| 1679 | {
|
|---|
| [989] | 1680 | PSZ pszCmdLine;
|
|---|
| [2] | 1681 |
|
|---|
| [989] | 1682 | pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
|---|
| 1683 | if (pszCmdLine) {
|
|---|
| [1335] | 1684 | lbup = TRUE;
|
|---|
| 1685 | if (WinDlgBox(HWND_DESKTOP,
|
|---|
| 1686 | hwnd,
|
|---|
| 1687 | CmdLine2DlgProc,
|
|---|
| 1688 | FM3ModHandle, EXEC2_FRAME, MPFROMP(pszCmdLine))) {
|
|---|
| 1689 | lstrip(pszCmdLine);
|
|---|
| 1690 | WinSetWindowText(hwnd, pszCmdLine);
|
|---|
| 1691 | }
|
|---|
| 1692 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
|---|
| 1693 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
|---|
| 1694 | free(pszCmdLine);
|
|---|
| [133] | 1695 | }
|
|---|
| 1696 | }
|
|---|
| 1697 | return 0;
|
|---|
| [2] | 1698 |
|
|---|
| [133] | 1699 | case UM_SETUP:
|
|---|
| 1700 | lbup = FALSE;
|
|---|
| 1701 | return 0;
|
|---|
| [2] | 1702 |
|
|---|
| [133] | 1703 | case WM_BUTTON1DBLCLK:
|
|---|
| [551] | 1704 | PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID);
|
|---|
| [133] | 1705 | return 0;
|
|---|
| [2] | 1706 |
|
|---|
| [133] | 1707 | case WM_COMMAND:
|
|---|
| [551] | 1708 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| [133] | 1709 | case COMMAND_BUTTON:
|
|---|
| 1710 | if (!lbup)
|
|---|
| [1335] | 1711 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
|---|
| [133] | 1712 | break;
|
|---|
| 1713 | }
|
|---|
| 1714 | return 0;
|
|---|
| [2] | 1715 |
|
|---|
| [133] | 1716 | case UM_OPENWINDOWFORME:
|
|---|
| 1717 | {
|
|---|
| 1718 | static char directory[CCHMAXPATH], cl[1000];
|
|---|
| 1719 | char **list = NULL;
|
|---|
| 1720 | ULONG len;
|
|---|
| 1721 | HWND hwndCnr;
|
|---|
| [2] | 1722 |
|
|---|
| [133] | 1723 | *directory = *cl = 0;
|
|---|
| 1724 | strcpy(cl, GetCmdSpec(FALSE));
|
|---|
| 1725 | strcat(cl, " /C ");
|
|---|
| 1726 | len = strlen(cl);
|
|---|
| 1727 | WinQueryWindowText(hwnd, 1000 - len, cl + len);
|
|---|
| 1728 | bstrip(cl + len);
|
|---|
| [551] | 1729 | if (strlen(cl) > len) {
|
|---|
| [1335] | 1730 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 1731 | UM_SETUP, MPFROMP(cl + len), MPVOID);
|
|---|
| 1732 | WinQueryWindowText(hwndStatus, CCHMAXPATH, directory);
|
|---|
| 1733 | bstrip(directory);
|
|---|
| 1734 | if (*directory && (IsRoot(directory) || !IsFile(directory))) {
|
|---|
| 1735 | if (!FM2Command(directory, cl + len)) {
|
|---|
| 1736 | hwndCnr = TopWindow(hwndMain, (HWND) 0);
|
|---|
| 1737 | if (hwndCnr) {
|
|---|
| 1738 | hwndCnr = WinWindowFromID(hwndCnr, FID_CLIENT);
|
|---|
| 1739 | if (hwndCnr) {
|
|---|
| 1740 | hwndCnr = WinWindowFromID(hwndCnr, DIR_CNR);
|
|---|
| 1741 | if (hwndCnr)
|
|---|
| 1742 | list = BuildList(hwndCnr);
|
|---|
| 1743 | }
|
|---|
| 1744 | }
|
|---|
| 1745 | WinSetActiveWindow(HWND_DESKTOP, hwndCnr);
|
|---|
| 1746 | if (add_cmdline(cl + len, FALSE) && fSaveMiniCmds)
|
|---|
| 1747 | save_cmdlines(FALSE);
|
|---|
| 1748 | ExecOnList(hwndCnr,
|
|---|
| 1749 | cl,
|
|---|
| 1750 | WINDOWED | ((fKeepCmdLine) ?
|
|---|
| 1751 | SEPARATEKEEP : SEPARATE),
|
|---|
| 1752 | directory, list, NULL, pszSrcFile, __LINE__);
|
|---|
| 1753 | xfree(list, pszSrcFile, __LINE__);
|
|---|
| 1754 | WinDestroyWindow(hwnd);
|
|---|
| 1755 | break;
|
|---|
| 1756 | }
|
|---|
| 1757 | }
|
|---|
| [133] | 1758 | }
|
|---|
| 1759 | WinSendMsg(hwnd, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);
|
|---|
| 1760 | }
|
|---|
| 1761 | return 0;
|
|---|
| [2] | 1762 |
|
|---|
| [133] | 1763 | case WM_CHAR:
|
|---|
| [551] | 1764 | if (!lbup && !(SHORT1FROMMP(mp1) & KC_KEYUP)) {
|
|---|
| 1765 | if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
|
|---|
| [1335] | 1766 | if ((SHORT1FROMMP(mp2) & 255) == '\r')
|
|---|
| 1767 | PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID);
|
|---|
| 1768 | else if ((SHORT1FROMMP(mp2) & 0xff) == 0x1b)
|
|---|
| 1769 | WinDestroyWindow(hwnd);
|
|---|
| 1770 | else if (SHORT2FROMMP(mp2) == VK_UP || SHORT2FROMMP(mp2) == VK_DOWN)
|
|---|
| 1771 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
|---|
| [133] | 1772 | }
|
|---|
| 1773 | }
|
|---|
| 1774 | else if ((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) &&
|
|---|
| [1335] | 1775 | ((SHORT2FROMMP(mp2) == VK_UP ||
|
|---|
| 1776 | SHORT2FROMMP(mp2) == VK_DOWN) ||
|
|---|
| 1777 | (SHORT1FROMMP(mp2) == '\x1b') || (SHORT1FROMMP(mp2) == '\r')))
|
|---|
| [133] | 1778 | return 0;
|
|---|
| 1779 | break;
|
|---|
| [2] | 1780 |
|
|---|
| [133] | 1781 | case WM_DESTROY:
|
|---|
| [551] | 1782 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_RESCAN, MPVOID, MPVOID);
|
|---|
| [133] | 1783 | lbup = FALSE;
|
|---|
| 1784 | break;
|
|---|
| 1785 | }
|
|---|
| 1786 | return oldproc(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 1787 | }
|
|---|
| 1788 |
|
|---|
| [133] | 1789 | MRESULT EXPENTRY DriveBackProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 1790 | {
|
|---|
| [551] | 1791 | switch (msg) {
|
|---|
| [133] | 1792 | case WM_CREATE:
|
|---|
| [551] | 1793 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
|---|
| [133] | 1794 | break;
|
|---|
| [2] | 1795 |
|
|---|
| [133] | 1796 | case UM_SETUP:
|
|---|
| 1797 | {
|
|---|
| 1798 | RGB2 rgb;
|
|---|
| [2] | 1799 |
|
|---|
| [133] | 1800 | memset(&rgb, 0, sizeof(rgb));
|
|---|
| [689] | 1801 | rgb.bRed = (BYTE)128;
|
|---|
| [1391] | 1802 | //fixme to allow user to change presparams 1-10-09 GKY
|
|---|
| [133] | 1803 | SetPresParams(hwnd,
|
|---|
| [1391] | 1804 | &RGBGREY, &rgb, &RGBGREY, FNT_8HELVETICA);
|
|---|
| [133] | 1805 | SetTargetDir(hwnd, TRUE);
|
|---|
| 1806 | }
|
|---|
| 1807 | return 0;
|
|---|
| [2] | 1808 |
|
|---|
| [133] | 1809 | case WM_SETFOCUS:
|
|---|
| 1810 | case UM_FOCUSME:
|
|---|
| 1811 | case WM_BUTTON1DOWN:
|
|---|
| 1812 | case WM_BUTTON1UP:
|
|---|
| 1813 | case WM_BUTTON2DOWN:
|
|---|
| 1814 | case WM_BUTTON2UP:
|
|---|
| 1815 | case WM_BUTTON3DOWN:
|
|---|
| 1816 | case WM_BUTTON3UP:
|
|---|
| 1817 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 1818 |
|
|---|
| [133] | 1819 | case WM_MOUSEMOVE:
|
|---|
| 1820 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
|---|
| 1821 | break;
|
|---|
| [2] | 1822 |
|
|---|
| [133] | 1823 | case UM_CLICKED:
|
|---|
| 1824 | case UM_CLICKED3:
|
|---|
| [551] | 1825 | PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_SETTARGET, 0), MPVOID);
|
|---|
| [133] | 1826 | return 0;
|
|---|
| [2] | 1827 |
|
|---|
| [133] | 1828 | case WM_CHAR:
|
|---|
| 1829 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
|---|
| 1830 | break;
|
|---|
| [2] | 1831 |
|
|---|
| [133] | 1832 | case WM_CONTROLPOINTER:
|
|---|
| 1833 | if (!fNoFinger &&
|
|---|
| [1335] | 1834 | (SHORT1FROMMP(mp1) >= IDM_DRIVEA &&
|
|---|
| 1835 | SHORT1FROMMP(mp1) < IDM_DRIVEA + 26))
|
|---|
| [133] | 1836 | return MRFROMLONG(hptrFinger);
|
|---|
| 1837 | break;
|
|---|
| [2] | 1838 |
|
|---|
| [133] | 1839 | case WM_COMMAND:
|
|---|
| 1840 | {
|
|---|
| 1841 | CHAR dv[4];
|
|---|
| [2] | 1842 |
|
|---|
| [133] | 1843 | *dv = 0;
|
|---|
| 1844 | WinQueryWindowText(WinWindowFromID(hwnd, SHORT1FROMMP(mp1) + 50),
|
|---|
| [1335] | 1845 | 2, dv);
|
|---|
| [551] | 1846 | if (isalpha(*dv)) {
|
|---|
| [2] | 1847 |
|
|---|
| [1335] | 1848 | HWND hwndActive;
|
|---|
| [2] | 1849 |
|
|---|
| [1335] | 1850 | dv[1] = ':';
|
|---|
| 1851 | dv[2] = '\\';
|
|---|
| 1852 | dv[3] = 0;
|
|---|
| 1853 | hwndActive = TopWindow(hwnd, (HWND) 0);
|
|---|
| 1854 | if (hwndActive)
|
|---|
| 1855 | WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT),
|
|---|
| 1856 | UM_DRIVECMD, MPFROMP(dv), MPVOID);
|
|---|
| [133] | 1857 | }
|
|---|
| 1858 | }
|
|---|
| 1859 | return 0;
|
|---|
| [2] | 1860 |
|
|---|
| [133] | 1861 | case WM_PAINT:
|
|---|
| [551] | 1862 | PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
|
|---|
| [133] | 1863 | break;
|
|---|
| [2] | 1864 |
|
|---|
| [133] | 1865 | case WM_CLOSE:
|
|---|
| 1866 | WinDestroyWindow(hwnd);
|
|---|
| 1867 | return 0;
|
|---|
| 1868 | }
|
|---|
| 1869 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 1870 | }
|
|---|
| 1871 |
|
|---|
| [133] | 1872 | MRESULT EXPENTRY DriveProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 1873 | {
|
|---|
| 1874 | USHORT id;
|
|---|
| [297] | 1875 | CHAR szDrv[CCHMAXPATH];
|
|---|
| 1876 |
|
|---|
| [133] | 1877 | static BOOL emphasized = FALSE;
|
|---|
| [297] | 1878 | static HWND hwndMenu = NULLHANDLE;
|
|---|
| [2] | 1879 | static USHORT helpid = 0;
|
|---|
| 1880 |
|
|---|
| [551] | 1881 | switch (msg) {
|
|---|
| [133] | 1882 | case WM_MOUSEMOVE:
|
|---|
| 1883 | if (fDrivebarHelp &&
|
|---|
| [1335] | 1884 | (!hwndBubble ||
|
|---|
| 1885 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
|---|
| 1886 | !WinQueryCapture(HWND_DESKTOP)) {
|
|---|
| [133] | 1887 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [551] | 1888 | if (helpid != id) {
|
|---|
| [1335] | 1889 | helpid = id;
|
|---|
| 1890 | PostMsg(MainObjectHwnd, UM_SETUP6, MPFROMLONG((ULONG) hwnd), MPVOID);
|
|---|
| [2] | 1891 | }
|
|---|
| [133] | 1892 | else
|
|---|
| [1335] | 1893 | helpid = 0;
|
|---|
| [133] | 1894 | }
|
|---|
| 1895 | break;
|
|---|
| [2] | 1896 |
|
|---|
| [133] | 1897 | case UM_SETUP6:
|
|---|
| [551] | 1898 | if (helpid == WinQueryWindowUShort(hwnd, QWS_ID)) {
|
|---|
| 1899 | if ((char *)mp1 &&
|
|---|
| [1335] | 1900 | (!hwndBubble ||
|
|---|
| 1901 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
|---|
| 1902 | !WinQueryCapture(HWND_DESKTOP)) {
|
|---|
| [2] | 1903 |
|
|---|
| [1335] | 1904 | RECTL rcl;
|
|---|
| 1905 | POINTL ptl;
|
|---|
| [2] | 1906 |
|
|---|
| [1335] | 1907 | WinQueryPointerPos(HWND_DESKTOP, &ptl);
|
|---|
| 1908 | WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);
|
|---|
| 1909 | WinQueryWindowRect(hwnd, &rcl);
|
|---|
| 1910 | if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl))
|
|---|
| 1911 | BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1);
|
|---|
| [2] | 1912 | }
|
|---|
| [133] | 1913 | }
|
|---|
| 1914 | return 0;
|
|---|
| [2] | 1915 |
|
|---|
| [133] | 1916 | case WM_MENUEND:
|
|---|
| [551] | 1917 | if (hwndMenu == (HWND) mp2) {
|
|---|
| [133] | 1918 | WinDestroyWindow(hwndMenu);
|
|---|
| [551] | 1919 | hwndMenu = (HWND) 0;
|
|---|
| [133] | 1920 | }
|
|---|
| 1921 | break;
|
|---|
| [2] | 1922 |
|
|---|
| [133] | 1923 | case WM_CONTEXTMENU:
|
|---|
| 1924 | if (hwndMenu)
|
|---|
| 1925 | WinDestroyWindow(hwndMenu);
|
|---|
| [551] | 1926 | hwndMenu = (HWND) 0;
|
|---|
| [133] | 1927 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [297] | 1928 | *szDrv = 0;
|
|---|
| [133] | 1929 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 1930 | id + 50), sizeof(szDrv), szDrv);
|
|---|
| [551] | 1931 | if (isalpha(*szDrv)) {
|
|---|
| 1932 | hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, MAIN_DRIVES);
|
|---|
| 1933 | if (hwndMenu) {
|
|---|
| [1335] | 1934 | BOOL rdy;
|
|---|
| 1935 | CHAR chDrv = *szDrv;
|
|---|
| 1936 | UINT iDrv;
|
|---|
| [551] | 1937 |
|
|---|
| [1335] | 1938 | strcpy(szDrv + 2, "\\");
|
|---|
| 1939 | MakeValidDir(szDrv);
|
|---|
| 1940 | // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c
|
|---|
| 1941 | rdy = toupper(*szDrv) == toupper(chDrv);
|
|---|
| 1942 | iDrv = toupper(*szDrv) - 'A';
|
|---|
| 1943 | if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE)
|
|---|
| 1944 | WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE);
|
|---|
| [549] | 1945 |
|
|---|
| [1335] | 1946 | if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) {
|
|---|
| 1947 | WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE);
|
|---|
| 1948 | WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE);
|
|---|
| 1949 | WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE);
|
|---|
| 1950 | WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE);
|
|---|
| 1951 | }
|
|---|
| 1952 | if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) {
|
|---|
| 1953 | WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE);
|
|---|
| 1954 | WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE);
|
|---|
| 1955 | WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE);
|
|---|
| 1956 | }
|
|---|
| 1957 | if (!rdy) {
|
|---|
| 1958 | WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE);
|
|---|
| 1959 | WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE);
|
|---|
| 1960 | WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE);
|
|---|
| 1961 | WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE);
|
|---|
| 1962 | WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE);
|
|---|
| 1963 | }
|
|---|
| 1964 | /* fixme to be gone?
|
|---|
| 1965 | if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) {
|
|---|
| 1966 | WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE);
|
|---|
| 1967 | }
|
|---|
| 1968 | */
|
|---|
| 1969 | PopupMenu(hwnd, hwnd, hwndMenu);
|
|---|
| [133] | 1970 | }
|
|---|
| 1971 | }
|
|---|
| 1972 | return MRFROMSHORT(TRUE);
|
|---|
| [2] | 1973 |
|
|---|
| [133] | 1974 | case WM_BUTTON2CLICK:
|
|---|
| 1975 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 1976 | if (!(shiftstate & KC_CTRL))
|
|---|
| 1977 | break;
|
|---|
| [2] | 1978 |
|
|---|
| [133] | 1979 | case WM_CHORD:
|
|---|
| 1980 | case WM_BUTTON3CLICK:
|
|---|
| 1981 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [297] | 1982 | *szDrv = 0;
|
|---|
| [133] | 1983 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 1984 | id + 50), sizeof(szDrv), szDrv);
|
|---|
| [551] | 1985 | if (isalpha(*szDrv)) {
|
|---|
| [297] | 1986 | strcat(szDrv, "\\");
|
|---|
| 1987 | if (!FindDirCnrByName(szDrv, TRUE))
|
|---|
| [1335] | 1988 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv);
|
|---|
| [133] | 1989 | }
|
|---|
| 1990 | break;
|
|---|
| [2] | 1991 |
|
|---|
| [133] | 1992 | case WM_COMMAND:
|
|---|
| 1993 | PostMsg(hwnd, UM_COMMAND, mp1, mp2);
|
|---|
| 1994 | return 0;
|
|---|
| [2] | 1995 |
|
|---|
| [133] | 1996 | case UM_COMMAND:
|
|---|
| 1997 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [297] | 1998 | *szDrv = 0;
|
|---|
| [133] | 1999 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 2000 | id + 50), sizeof(szDrv), szDrv);
|
|---|
| [551] | 2001 | if (isalpha(*szDrv)) {
|
|---|
| [297] | 2002 | strcat(szDrv, "\\");
|
|---|
| 2003 | CommonDriveCmd(hwnd, szDrv, SHORT1FROMMP(mp1));
|
|---|
| [133] | 2004 | }
|
|---|
| 2005 | return 0;
|
|---|
| [2] | 2006 |
|
|---|
| [133] | 2007 | case DM_DRAGOVER:
|
|---|
| 2008 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [297] | 2009 | *szDrv = 0;
|
|---|
| [133] | 2010 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 2011 | id + 50), sizeof(szDrv), szDrv);
|
|---|
| [297] | 2012 | if (isalpha(*szDrv) &&
|
|---|
| [1335] | 2013 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
|---|
| [551] | 2014 | if (!emphasized) {
|
|---|
| [1335] | 2015 | emphasized = TRUE;
|
|---|
| 2016 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| [133] | 2017 | }
|
|---|
| [618] | 2018 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
|---|
| [1335] | 2019 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
|---|
| [133] | 2020 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
|---|
| 2021 | }
|
|---|
| 2022 | break;
|
|---|
| [2] | 2023 |
|
|---|
| [133] | 2024 | case DM_DRAGLEAVE:
|
|---|
| 2025 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [297] | 2026 | *szDrv = 0;
|
|---|
| [133] | 2027 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 2028 | id + 50), sizeof(szDrv), szDrv);
|
|---|
| [297] | 2029 | if (isalpha(*szDrv) &&
|
|---|
| [1335] | 2030 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
|---|
| [551] | 2031 | if (emphasized) {
|
|---|
| [1335] | 2032 | emphasized = FALSE;
|
|---|
| 2033 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| [133] | 2034 | }
|
|---|
| 2035 | }
|
|---|
| 2036 | break;
|
|---|
| [2] | 2037 |
|
|---|
| [133] | 2038 | case DM_DROPHELP:
|
|---|
| 2039 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [297] | 2040 | *szDrv = 0;
|
|---|
| [133] | 2041 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 2042 | id + 50), sizeof(szDrv), szDrv);
|
|---|
| [297] | 2043 | if (isalpha(*szDrv) &&
|
|---|
| [1335] | 2044 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
|---|
| [133] | 2045 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_DRIVEDROPHELP));
|
|---|
| 2046 | return 0;
|
|---|
| 2047 | }
|
|---|
| 2048 | break;
|
|---|
| [2] | 2049 |
|
|---|
| [133] | 2050 | case DM_DROP:
|
|---|
| 2051 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [297] | 2052 | *szDrv = 0;
|
|---|
| [133] | 2053 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 2054 | id + 50), sizeof(szDrv), szDrv);
|
|---|
| [297] | 2055 | if (isalpha(*szDrv) &&
|
|---|
| [1335] | 2056 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
|---|
| [2] | 2057 |
|
|---|
| [133] | 2058 | CNRDRAGINFO cnd;
|
|---|
| 2059 | LISTINFO *li;
|
|---|
| 2060 | ULONG action = UM_ACTION;
|
|---|
| [2] | 2061 |
|
|---|
| [551] | 2062 | if (emphasized) {
|
|---|
| [1335] | 2063 | emphasized = FALSE;
|
|---|
| 2064 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| [133] | 2065 | }
|
|---|
| 2066 | memset(&cnd, 0, sizeof(cnd));
|
|---|
| 2067 | cnd.pDragInfo = (PDRAGINFO) mp1;
|
|---|
| 2068 | cnd.pRecord = NULL;
|
|---|
| 2069 | li = DoFileDrop(hwnd,
|
|---|
| [1335] | 2070 | NULL,
|
|---|
| 2071 | TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd));
|
|---|
| [687] | 2072 | CheckPmDrgLimit(cnd.pDragInfo);
|
|---|
| [551] | 2073 | if (li) {
|
|---|
| [1335] | 2074 | strcpy(li->targetpath, szDrv);
|
|---|
| 2075 | strcat(li->targetpath, "\\");
|
|---|
| 2076 | if (li->list && li->list[0] && IsRoot(li->list[0]))
|
|---|
| 2077 | li->type = DO_LINK;
|
|---|
| 2078 | else if (fDragndropDlg && (!*li->arcname || !li->info)) {
|
|---|
| [2] | 2079 |
|
|---|
| [1335] | 2080 | CHECKLIST cl;
|
|---|
| [2] | 2081 |
|
|---|
| [1335] | 2082 | memset(&cl, 0, sizeof(cl));
|
|---|
| 2083 | cl.size = sizeof(cl);
|
|---|
| 2084 | cl.flags = li->type;
|
|---|
| 2085 | cl.list = li->list;
|
|---|
| 2086 | cl.cmd = li->type;
|
|---|
| 2087 | cl.prompt = li->targetpath;
|
|---|
| 2088 | li->type = WinDlgBox(HWND_DESKTOP,
|
|---|
| 2089 | hwndMain,
|
|---|
| 2090 | DropListProc,
|
|---|
| 2091 | FM3ModHandle, DND_FRAME, MPFROMP(&cl));
|
|---|
| 2092 | if (li->type == DID_ERROR)
|
|---|
| 2093 | Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 2094 | "Drag & Drop Dialog");
|
|---|
| 2095 | if (!li->type) {
|
|---|
| 2096 | FreeListInfo(li);
|
|---|
| 2097 | return 0;
|
|---|
| 2098 | }
|
|---|
| 2099 | li->list = cl.list;
|
|---|
| 2100 | if (!li->list || !li->list[0]) {
|
|---|
| 2101 | FreeListInfo(li);
|
|---|
| 2102 | return 0;
|
|---|
| 2103 | }
|
|---|
| 2104 | }
|
|---|
| 2105 | else {
|
|---|
| 2106 | if (!WinDlgBox(HWND_DESKTOP,
|
|---|
| 2107 | hwndMain,
|
|---|
| 2108 | WalkDlgProc,
|
|---|
| 2109 | FM3ModHandle,
|
|---|
| 2110 | WALK_FRAME,
|
|---|
| 2111 | MPFROMP(li->targetpath)) || !*li->targetpath) {
|
|---|
| 2112 | FreeListInfo(li);
|
|---|
| 2113 | return 0;
|
|---|
| 2114 | }
|
|---|
| 2115 | }
|
|---|
| 2116 | switch (li->type) {
|
|---|
| 2117 | case DND_LAUNCH:
|
|---|
| 2118 | strcat(li->targetpath, " %a");
|
|---|
| 2119 | ExecOnList(hwndMain,
|
|---|
| 2120 | li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL,
|
|---|
| 2121 | pszSrcFile, __LINE__);
|
|---|
| 2122 | FreeList(li->list);
|
|---|
| 2123 | li->list = NULL;
|
|---|
| 2124 | break;
|
|---|
| 2125 | case DO_LINK:
|
|---|
| 2126 | if (fLinkSetsIcon) {
|
|---|
| 2127 | li->type = IDM_SETICON;
|
|---|
| 2128 | action = UM_MASSACTION;
|
|---|
| 2129 | }
|
|---|
| 2130 | else
|
|---|
| 2131 | li->type = IDM_COMPARE;
|
|---|
| 2132 | break;
|
|---|
| 2133 | case DND_EXTRACT:
|
|---|
| 2134 | if (*li->targetpath && !IsFile(li->targetpath))
|
|---|
| 2135 | li->type = IDM_EXTRACT;
|
|---|
| 2136 | break;
|
|---|
| 2137 | case DND_MOVE:
|
|---|
| 2138 | li->type = IDM_MOVE;
|
|---|
| 2139 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
|---|
| 2140 | action = UM_MASSACTION;
|
|---|
| 2141 | li->type = IDM_ARCHIVEM;
|
|---|
| 2142 | }
|
|---|
| 2143 | break;
|
|---|
| 2144 | case DND_WILDMOVE:
|
|---|
| 2145 | li->type = IDM_WILDMOVE;
|
|---|
| 2146 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
|---|
| 2147 | action = UM_MASSACTION;
|
|---|
| 2148 | li->type = IDM_ARCHIVEM;
|
|---|
| 2149 | }
|
|---|
| 2150 | break;
|
|---|
| 2151 | case DND_OBJECT:
|
|---|
| 2152 | li->type = IDM_OBJECT;
|
|---|
| 2153 | action = UM_MASSACTION;
|
|---|
| 2154 | break;
|
|---|
| 2155 | case DND_SHADOW:
|
|---|
| 2156 | li->type = IDM_SHADOW;
|
|---|
| 2157 | action = UM_MASSACTION;
|
|---|
| 2158 | break;
|
|---|
| 2159 | case DND_COMPARE:
|
|---|
| 2160 | li->type = IDM_COMPARE;
|
|---|
| 2161 | break;
|
|---|
| 2162 | case DND_SETICON:
|
|---|
| 2163 | action = UM_MASSACTION;
|
|---|
| 2164 | li->type = IDM_SETICON;
|
|---|
| 2165 | break;
|
|---|
| 2166 | case DND_COPY:
|
|---|
| 2167 | li->type = IDM_COPY;
|
|---|
| 2168 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
|---|
| 2169 | action = UM_MASSACTION;
|
|---|
| 2170 | li->type = IDM_ARCHIVE;
|
|---|
| 2171 | }
|
|---|
| 2172 | break;
|
|---|
| 2173 | case DND_WILDCOPY:
|
|---|
| 2174 | li->type = IDM_WILDCOPY;
|
|---|
| 2175 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
|---|
| 2176 | action = UM_MASSACTION;
|
|---|
| 2177 | li->type = IDM_ARCHIVE;
|
|---|
| 2178 | }
|
|---|
| 2179 | break;
|
|---|
| 2180 | default:
|
|---|
| 2181 | if (*li->arcname && li->info) {
|
|---|
| 2182 | action = UM_MASSACTION;
|
|---|
| 2183 | li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM :
|
|---|
| 2184 | IDM_FAKEEXTRACT;
|
|---|
| 2185 | }
|
|---|
| 2186 | else if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
|---|
| 2187 | action = UM_MASSACTION;
|
|---|
| 2188 | li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
|
|---|
| 2189 | }
|
|---|
| 2190 | else
|
|---|
| 2191 | li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
|
|---|
| 2192 | break;
|
|---|
| 2193 | }
|
|---|
| 2194 | if (!li->list || !li->list[0])
|
|---|
| 2195 | FreeListInfo(li);
|
|---|
| 2196 | else
|
|---|
| 2197 | WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action));
|
|---|
| [133] | 2198 | }
|
|---|
| 2199 | return 0;
|
|---|
| 2200 | }
|
|---|
| 2201 | break;
|
|---|
| [2] | 2202 |
|
|---|
| [133] | 2203 | case WM_DESTROY:
|
|---|
| 2204 | if (hwndMenu)
|
|---|
| 2205 | WinDestroyWindow(hwndMenu);
|
|---|
| [551] | 2206 | hwndMenu = (HWND) 0;
|
|---|
| [133] | 2207 | break;
|
|---|
| 2208 | }
|
|---|
| 2209 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 2210 | }
|
|---|
| 2211 |
|
|---|
| [260] | 2212 | VOID BuildDriveBarButtons(HWND hwndT)
|
|---|
| [133] | 2213 | {
|
|---|
| 2214 | register ULONG x, y = 0;
|
|---|
| 2215 | ULONG ulDriveNum, ulDriveMap, iconid;
|
|---|
| 2216 | CHAR s[8];
|
|---|
| 2217 | HENUM henum;
|
|---|
| 2218 | HWND hwndB;
|
|---|
| [2] | 2219 |
|
|---|
| [133] | 2220 | henum = WinBeginEnumWindows(hwndT);
|
|---|
| [2] | 2221 |
|
|---|
| [133] | 2222 | while ((hwndB = WinGetNextWindow(henum)) != NULLHANDLE)
|
|---|
| 2223 | WinDestroyWindow(hwndB);
|
|---|
| 2224 |
|
|---|
| 2225 | WinEndEnumWindows(henum);
|
|---|
| [376] | 2226 | if (fDrivebar) {
|
|---|
| [2] | 2227 | DosError(FERR_DISABLEHARDERR);
|
|---|
| [133] | 2228 | DosQCurDisk(&ulDriveNum, &ulDriveMap);
|
|---|
| [376] | 2229 | for (x = 0; x < 26; x++) {
|
|---|
| [551] | 2230 | if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) {
|
|---|
| [1335] | 2231 | if (x > 1) {
|
|---|
| 2232 | if (driveflags[x] & DRIVE_CDROM)
|
|---|
| 2233 | iconid = CDROM_ICON;
|
|---|
| 2234 | else
|
|---|
| 2235 | iconid = (driveflags[x] & DRIVE_REMOVABLE) ?
|
|---|
| 2236 | REMOVABLE_ICON :
|
|---|
| 2237 | (driveflags[x] & DRIVE_VIRTUAL) ?
|
|---|
| 2238 | VIRTUAL_ICON :
|
|---|
| 2239 | (driveflags[x] & DRIVE_REMOTE) ?
|
|---|
| 2240 | REMOTE_ICON :
|
|---|
| 2241 | (driveflags[x] & DRIVE_RAMDISK) ?
|
|---|
| 2242 | RAMDISK_ICON :
|
|---|
| 2243 | (driveflags[x] & DRIVE_ZIPSTREAM) ?
|
|---|
| 2244 | ZIPSTREAM_ICON :DRIVE_ICON;
|
|---|
| 2245 | }
|
|---|
| 2246 | else
|
|---|
| 2247 | iconid = FLOPPY_ICON;
|
|---|
| 2248 | sprintf(s, "#%lu", iconid);
|
|---|
| 2249 | hwndB = WinCreateWindow(hwndT,
|
|---|
| 2250 | WC_DRIVEBUTTONS,
|
|---|
| 2251 | s,
|
|---|
| 2252 | BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON,
|
|---|
| 2253 | 0,
|
|---|
| 2254 | 0,
|
|---|
| 2255 | 28,
|
|---|
| 2256 | 18,
|
|---|
| 2257 | hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL);
|
|---|
| 2258 | if (!hwndB)
|
|---|
| 2259 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 2260 | IDS_WINCREATEWINDOW);
|
|---|
| 2261 | else {
|
|---|
| 2262 | WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
|
|---|
| 2263 | sprintf(s, "%c:", (CHAR) x + 'A');
|
|---|
| 2264 | hwndB = WinCreateWindow(hwndT,
|
|---|
| 2265 | WC_STATIC,
|
|---|
| 2266 | s,
|
|---|
| 2267 | SS_TEXT | DT_LEFT | DT_VCENTER,
|
|---|
| 2268 | 0,
|
|---|
| 2269 | 0,
|
|---|
| 2270 | 10,
|
|---|
| 2271 | 18,
|
|---|
| 2272 | hwndT,
|
|---|
| 2273 | HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL);
|
|---|
| 2274 | if (!hwndB)
|
|---|
| 2275 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 2276 | IDS_WINCREATEWINDOW);
|
|---|
| [1391] | 2277 | else {
|
|---|
| 2278 | //fixme to allow user to change presparams 1-10-09 GKY
|
|---|
| [1335] | 2279 | SetPresParams(hwndB,
|
|---|
| 2280 | &RGBGREY,
|
|---|
| [1391] | 2281 | &RGBBLACK, &RGBGREY, FNT_6HELVETICA);
|
|---|
| [1335] | 2282 | WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
|
|---|
| 2283 | }
|
|---|
| 2284 | y++;
|
|---|
| 2285 | }
|
|---|
| [133] | 2286 | }
|
|---|
| [930] | 2287 | } // for
|
|---|
| 2288 | } // if drivebar
|
|---|
| [133] | 2289 | PostMsg(WinQueryWindow(hwndT, QW_PARENT),
|
|---|
| [1335] | 2290 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| [2] | 2291 | }
|
|---|
| 2292 |
|
|---|
| [133] | 2293 | VOID ResizeDrives(HWND hwndT, long xwidth)
|
|---|
| 2294 | {
|
|---|
| 2295 | register ULONG ctrlxpos = 2, ctrlypos = 0, ctrlxsize;
|
|---|
| 2296 | HENUM henum;
|
|---|
| 2297 | HWND hwndB;
|
|---|
| 2298 | RECTL rcl;
|
|---|
| [2] | 2299 |
|
|---|
| 2300 | DriveLines = 0;
|
|---|
| [133] | 2301 | if (!fDrivebar)
|
|---|
| [2] | 2302 | return;
|
|---|
| [551] | 2303 | if (!xwidth) {
|
|---|
| [133] | 2304 | WinQueryWindowRect(hwndT, &rcl);
|
|---|
| [2] | 2305 | xwidth = rcl.xRight - ((WinQuerySysValue(HWND_DESKTOP,
|
|---|
| [1335] | 2306 | SV_CYSIZEBORDER) * 2) + 2);
|
|---|
| [2] | 2307 | }
|
|---|
| [133] | 2308 | henum = WinBeginEnumWindows(hwndT);
|
|---|
| [551] | 2309 | while ((hwndB = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| [133] | 2310 | if (WinQueryWindowUShort(hwndB, QWS_ID) > IDM_DRIVEA + 27)
|
|---|
| [2] | 2311 | ctrlxsize = 10;
|
|---|
| 2312 | else
|
|---|
| 2313 | ctrlxsize = 28;
|
|---|
| 2314 | WinSetWindowPos(hwndB,
|
|---|
| [1335] | 2315 | HWND_TOP,
|
|---|
| 2316 | ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW);
|
|---|
| [2] | 2317 | ctrlxpos += (ctrlxsize + 2);
|
|---|
| [551] | 2318 | if (ctrlxsize == 10) {
|
|---|
| [133] | 2319 | if (ctrlxpos + (42 + ((fShowTarget && DriveLines == 0) ?
|
|---|
| [1335] | 2320 | 256 : 0)) > xwidth) {
|
|---|
| 2321 | ctrlxpos = 2;
|
|---|
| 2322 | ctrlypos += 18;
|
|---|
| 2323 | DriveLines++;
|
|---|
| [2] | 2324 | }
|
|---|
| 2325 | }
|
|---|
| 2326 | }
|
|---|
| [133] | 2327 | if (ctrlxpos == 2 && DriveLines)
|
|---|
| [2] | 2328 | DriveLines--;
|
|---|
| 2329 | }
|
|---|
| 2330 |
|
|---|
| [133] | 2331 | MRESULT EXPENTRY StatusProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 2332 | {
|
|---|
| [551] | 2333 | static HWND hwndE = (HWND) 0, hwndB = (HWND) 0;
|
|---|
| [2] | 2334 | static CHAR lastcmd[1024] = "";
|
|---|
| 2335 |
|
|---|
| [551] | 2336 | switch (msg) {
|
|---|
| [133] | 2337 | case WM_CREATE:
|
|---|
| 2338 | {
|
|---|
| 2339 | MRESULT mr = PFNWPStatic(hwnd, msg, mp1, mp2);
|
|---|
| [1391] | 2340 | //fixme to allow user to change presparams 1-10-09 GKY
|
|---|
| [133] | 2341 | SetPresParams(hwnd,
|
|---|
| [1335] | 2342 | &RGBGREY,
|
|---|
| [1391] | 2343 | &RGBBLACK, &RGBGREY, FNT_8HELVETICABOLD);
|
|---|
| [133] | 2344 | return mr;
|
|---|
| 2345 | }
|
|---|
| [2] | 2346 |
|
|---|
| [133] | 2347 | case WM_PRESPARAMCHANGED:
|
|---|
| [551] | 2348 | if (fRunning) {
|
|---|
| [2] | 2349 |
|
|---|
| [133] | 2350 | ULONG AttrFound, AttrValue[64], cbRetLen;
|
|---|
| [2] | 2351 |
|
|---|
| [133] | 2352 | cbRetLen = WinQueryPresParam(hwnd,
|
|---|
| [1335] | 2353 | (ULONG) mp1,
|
|---|
| 2354 | 0,
|
|---|
| 2355 | &AttrFound,
|
|---|
| 2356 | (ULONG) sizeof(AttrValue), &AttrValue, 0);
|
|---|
| [551] | 2357 | if (cbRetLen) {
|
|---|
| [1335] | 2358 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 2359 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| [133] | 2360 | }
|
|---|
| 2361 | }
|
|---|
| 2362 | break;
|
|---|
| [2] | 2363 |
|
|---|
| [133] | 2364 | case WM_CONTEXTMENU:
|
|---|
| [551] | 2365 | PostMsg(hwndMain, UM_CONTEXTMENU, MPVOID, MPVOID);
|
|---|
| [133] | 2366 | return MRFROMSHORT(TRUE);
|
|---|
| [2] | 2367 |
|
|---|
| [133] | 2368 | case WM_BEGINDRAG:
|
|---|
| [551] | 2369 | if (hwndTree) {
|
|---|
| [2] | 2370 |
|
|---|
| [133] | 2371 | SWP swp;
|
|---|
| 2372 | ULONG fl = SWP_ACTIVATE | SWP_SHOW | SWP_ZORDER;
|
|---|
| [2] | 2373 |
|
|---|
| [133] | 2374 | WinQueryWindowPos(hwndTree, &swp);
|
|---|
| 2375 | if (!(swp.fl & SWP_MAXIMIZE))
|
|---|
| [1335] | 2376 | fl |= SWP_RESTORE;
|
|---|
| [133] | 2377 | WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, fl);
|
|---|
| 2378 | }
|
|---|
| 2379 | break;
|
|---|
| [2] | 2380 |
|
|---|
| [133] | 2381 | case UM_SETUP:
|
|---|
| 2382 | if (mp1)
|
|---|
| [1009] | 2383 | strcpy(lastcmd, (CHAR *)mp1);
|
|---|
| [133] | 2384 | return 0;
|
|---|
| [2] | 2385 |
|
|---|
| [133] | 2386 | case UM_RESCAN:
|
|---|
| [551] | 2387 | if (hwndE && WinIsWindow(WinQueryAnchorBlock(hwnd), hwndE))
|
|---|
| [133] | 2388 | WinDestroyWindow(hwndE);
|
|---|
| [551] | 2389 | if (hwndB && WinIsWindow(WinQueryAnchorBlock(hwnd), hwndB))
|
|---|
| [133] | 2390 | WinDestroyWindow(hwndB);
|
|---|
| [551] | 2391 | hwndE = hwndB = (HWND) 0;
|
|---|
| [133] | 2392 | return 0;
|
|---|
| [2] | 2393 |
|
|---|
| [133] | 2394 | case WM_COMMAND:
|
|---|
| [551] | 2395 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| [133] | 2396 | case COMMAND_BUTTON:
|
|---|
| 2397 | PostMsg(hwndE, msg, mp1, mp2);
|
|---|
| 2398 | break;
|
|---|
| 2399 | }
|
|---|
| 2400 | return 0;
|
|---|
| [2] | 2401 |
|
|---|
| [133] | 2402 | case WM_MOUSEMOVE:
|
|---|
| 2403 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 2404 | {
|
|---|
| 2405 | USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 2406 | char *s = NULL;
|
|---|
| [2] | 2407 |
|
|---|
| [551] | 2408 | if (fOtherHelp) {
|
|---|
| [1335] | 2409 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
|---|
| 2410 | && !WinQueryCapture(HWND_DESKTOP)) {
|
|---|
| 2411 | switch (id) {
|
|---|
| 2412 | case IDM_ATTRS:
|
|---|
| 2413 | if (WinQueryWindowTextLength(hwnd))
|
|---|
| 2414 | s = GetPString(IDS_ATTRSBUTTONHELP);
|
|---|
| 2415 | break;
|
|---|
| 2416 | case IDM_INFO:
|
|---|
| 2417 | if (WinQueryWindowTextLength(hwnd))
|
|---|
| 2418 | s = GetPString(IDS_INFOBUTTONHELP);
|
|---|
| 2419 | break;
|
|---|
| 2420 | case IDM_RENAME:
|
|---|
| 2421 | if (WinQueryWindowTextLength(hwnd))
|
|---|
| 2422 | s = GetPString(IDS_NAMEBUTTONHELP);
|
|---|
| 2423 | break;
|
|---|
| 2424 | case MAIN_STATUS2:
|
|---|
| 2425 | if (!hwndE)
|
|---|
| 2426 | s = GetPString(IDS_STATUS2HELP);
|
|---|
| 2427 | break;
|
|---|
| 2428 | default:
|
|---|
| 2429 | break;
|
|---|
| 2430 | }
|
|---|
| 2431 | if (s)
|
|---|
| 2432 | MakeBubble(hwnd, FALSE, s);
|
|---|
| 2433 | else if (hwndBubble)
|
|---|
| 2434 | WinDestroyWindow(hwndBubble);
|
|---|
| 2435 | }
|
|---|
| [133] | 2436 | }
|
|---|
| [551] | 2437 | switch (id) {
|
|---|
| [133] | 2438 | case IDM_ATTRS:
|
|---|
| 2439 | case IDM_INFO:
|
|---|
| 2440 | case IDM_RENAME:
|
|---|
| 2441 | case MAIN_STATUS2:
|
|---|
| [1335] | 2442 | return CommonTextProc(hwnd, msg, mp1, mp2);
|
|---|
| [133] | 2443 | default:
|
|---|
| [1335] | 2444 | break;
|
|---|
| [133] | 2445 | }
|
|---|
| 2446 | }
|
|---|
| 2447 | break;
|
|---|
| [2] | 2448 |
|
|---|
| [133] | 2449 | case WM_BUTTON2DOWN:
|
|---|
| 2450 | case WM_BUTTON2UP:
|
|---|
| 2451 | case UM_FOCUSME:
|
|---|
| 2452 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 2453 |
|
|---|
| [133] | 2454 | case WM_BUTTON1DOWN:
|
|---|
| 2455 | case WM_BUTTON1UP:
|
|---|
| 2456 | case WM_BUTTON3DOWN:
|
|---|
| 2457 | case WM_BUTTON3UP:
|
|---|
| 2458 | {
|
|---|
| 2459 | USHORT id;
|
|---|
| 2460 |
|
|---|
| 2461 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [551] | 2462 | switch (id) {
|
|---|
| [133] | 2463 | case IDM_ATTRS:
|
|---|
| 2464 | case IDM_INFO:
|
|---|
| 2465 | case IDM_RENAME:
|
|---|
| 2466 | case MAIN_STATUS2:
|
|---|
| [1335] | 2467 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
|---|
| [133] | 2468 | default:
|
|---|
| [1335] | 2469 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
|---|
| 2470 | break;
|
|---|
| [133] | 2471 | }
|
|---|
| 2472 | }
|
|---|
| 2473 | break;
|
|---|
| [2] | 2474 |
|
|---|
| [133] | 2475 | case WM_SETFOCUS:
|
|---|
| [551] | 2476 | if (mp2) {
|
|---|
| [2] | 2477 |
|
|---|
| [133] | 2478 | USHORT id;
|
|---|
| [2] | 2479 |
|
|---|
| [133] | 2480 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [551] | 2481 | if (id == MAIN_STATUS2 && hwndE)
|
|---|
| [1335] | 2482 | WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
|---|
| [133] | 2483 | else
|
|---|
| [1335] | 2484 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
|---|
| [133] | 2485 | }
|
|---|
| 2486 | break;
|
|---|
| [2] | 2487 |
|
|---|
| [133] | 2488 | case WM_BUTTON1CLICK:
|
|---|
| 2489 | {
|
|---|
| 2490 | USHORT id;
|
|---|
| [2] | 2491 |
|
|---|
| [133] | 2492 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [551] | 2493 | if (id == MAIN_STATUS) {
|
|---|
| [1335] | 2494 | if (SHORT2FROMMP(mp2) & KC_CTRL)
|
|---|
| 2495 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 2496 | FID_CLIENT),
|
|---|
| 2497 | WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
|---|
| 2498 | else if (hwndTree)
|
|---|
| 2499 | PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID);
|
|---|
| [2] | 2500 | }
|
|---|
| [133] | 2501 | }
|
|---|
| 2502 | break;
|
|---|
| [2] | 2503 |
|
|---|
| [133] | 2504 | case UM_CLICKED:
|
|---|
| 2505 | case UM_CLICKED3:
|
|---|
| 2506 | {
|
|---|
| 2507 | USHORT id;
|
|---|
| 2508 |
|
|---|
| 2509 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [551] | 2510 | if (id == MAIN_STATUS2 && !hwndE) {
|
|---|
| [2] | 2511 |
|
|---|
| [1335] | 2512 | SWP swp;
|
|---|
| 2513 | CHAR directory[CCHMAXPATH];
|
|---|
| 2514 | PFNWP oldproce;
|
|---|
| [2] | 2515 |
|
|---|
| [1335] | 2516 | *directory = 0;
|
|---|
| 2517 | TopWindowName(hwndMain, (HWND) 0, directory);
|
|---|
| 2518 | WinQueryWindowPos(hwnd, &swp);
|
|---|
| 2519 | hwndB = WinCreateWindow(hwnd,
|
|---|
| 2520 | WC_BUTTON,
|
|---|
| 2521 | "+",
|
|---|
| 2522 | WS_VISIBLE | BS_PUSHBUTTON |
|
|---|
| 2523 | BS_NOPOINTERFOCUS,
|
|---|
| 2524 | swp.cx - swp.cy,
|
|---|
| 2525 | 0,
|
|---|
| 2526 | swp.cy,
|
|---|
| 2527 | swp.cy,
|
|---|
| 2528 | hwnd, HWND_TOP, COMMAND_BUTTON, NULL, NULL);
|
|---|
| 2529 | if (!hwndB)
|
|---|
| 2530 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| 2531 | hwndE = WinCreateWindow(hwnd,
|
|---|
| 2532 | WC_ENTRYFIELD,
|
|---|
| 2533 | NULL,
|
|---|
| 2534 | WS_VISIBLE | ES_AUTOSCROLL,
|
|---|
| 2535 | 0,
|
|---|
| 2536 | 0,
|
|---|
| 2537 | swp.cx - swp.cy,
|
|---|
| 2538 | swp.cy,
|
|---|
| 2539 | hwnd, HWND_TOP, COMMAND_LINE, NULL, NULL);
|
|---|
| 2540 | if (!hwndE)
|
|---|
| 2541 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| 2542 | if (!hwndE || !hwndB) {
|
|---|
| 2543 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
|---|
| 2544 | return 0;
|
|---|
| 2545 | }
|
|---|
| 2546 | WinSendMsg(hwndE, EM_SETTEXTLIMIT, MPFROM2SHORT(1024, 0), MPVOID);
|
|---|
| 2547 | WinSetWindowText(hwndStatus, directory);
|
|---|
| 2548 | if (*lastcmd)
|
|---|
| 2549 | WinSetWindowText(hwndE, lastcmd);
|
|---|
| 2550 | else
|
|---|
| 2551 | WinSetWindowText(hwndE, GetPString(IDS_HELPCMDTEXT));
|
|---|
| 2552 | oldproce = WinSubclassWindow(hwndE, (PFNWP) CommandLineProc);
|
|---|
| 2553 | if (oldproce)
|
|---|
| 2554 | WinSetWindowPtr(hwndE, QWL_USER, (PVOID) oldproce);
|
|---|
| 2555 | PostMsg(hwndE, UM_FOCUSME, MPVOID, MPVOID);
|
|---|
| 2556 | PostMsg(hwndE, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);
|
|---|
| 2557 | return 0;
|
|---|
| [133] | 2558 | }
|
|---|
| [551] | 2559 | if (msg == UM_CLICKED3 || (SHORT2FROMMP(mp2) & KC_CTRL)) {
|
|---|
| [1335] | 2560 | switch (id) {
|
|---|
| 2561 | case IDM_ATTRS:
|
|---|
| 2562 | id = IDM_SORTSIZE;
|
|---|
| 2563 | break;
|
|---|
| 2564 | case IDM_INFO:
|
|---|
| 2565 | id = IDM_SORTLWDATE;
|
|---|
| 2566 | break;
|
|---|
| 2567 | case IDM_RENAME:
|
|---|
| 2568 | id = IDM_SORTFILENAME;
|
|---|
| 2569 | break;
|
|---|
| 2570 | }
|
|---|
| [133] | 2571 | }
|
|---|
| 2572 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 2573 | WM_COMMAND, MPFROM2SHORT(id, 0), MPVOID);
|
|---|
| [133] | 2574 | }
|
|---|
| 2575 | return 0;
|
|---|
| [2] | 2576 |
|
|---|
| [133] | 2577 | case WM_PAINT:
|
|---|
| 2578 | {
|
|---|
| 2579 | USHORT id;
|
|---|
| [2] | 2580 |
|
|---|
| [133] | 2581 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [551] | 2582 | switch (id) {
|
|---|
| [133] | 2583 | case IDM_ATTRS:
|
|---|
| 2584 | case IDM_INFO:
|
|---|
| 2585 | case IDM_RENAME:
|
|---|
| 2586 | case MAIN_STATUS2:
|
|---|
| [1335] | 2587 | PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
|
|---|
| 2588 | break;
|
|---|
| [133] | 2589 | default:
|
|---|
| [1335] | 2590 | PaintRecessedWindow(hwnd, (HPS) 0, FALSE, TRUE);
|
|---|
| 2591 | break;
|
|---|
| [133] | 2592 | }
|
|---|
| [551] | 2593 | if (id == IDM_RENAME) {
|
|---|
| [2] | 2594 |
|
|---|
| [1335] | 2595 | HPS hps;
|
|---|
| [2] | 2596 |
|
|---|
| [1335] | 2597 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
|---|
| 2598 | if (hps) {
|
|---|
| 2599 | PaintSTextWindow(hwnd, hps);
|
|---|
| 2600 | WinEndPaint(hps);
|
|---|
| 2601 | }
|
|---|
| 2602 | return 0;
|
|---|
| [2] | 2603 | }
|
|---|
| [133] | 2604 | }
|
|---|
| 2605 | break;
|
|---|
| [2] | 2606 |
|
|---|
| [133] | 2607 | }
|
|---|
| 2608 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 2609 | }
|
|---|
| 2610 |
|
|---|
| [133] | 2611 | MRESULT EXPENTRY ToolBackProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 2612 | {
|
|---|
| [551] | 2613 | switch (msg) {
|
|---|
| [133] | 2614 | case WM_CREATE:
|
|---|
| 2615 | hwndToolback = hwnd;
|
|---|
| 2616 | break;
|
|---|
| [2] | 2617 |
|
|---|
| [133] | 2618 | case WM_MOUSEMOVE:
|
|---|
| 2619 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 2620 | break;
|
|---|
| [2] | 2621 |
|
|---|
| [133] | 2622 | case WM_CONTROLPOINTER:
|
|---|
| [551] | 2623 | if (!fNoFinger && SHORT1FROMMP(mp1) < 25000)
|
|---|
| [133] | 2624 | return MRFROMLONG(hptrFinger);
|
|---|
| 2625 | break;
|
|---|
| [2] | 2626 |
|
|---|
| [133] | 2627 | case WM_CHAR:
|
|---|
| 2628 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
|---|
| 2629 | break;
|
|---|
| [2] | 2630 |
|
|---|
| [133] | 2631 | case WM_COMMAND:
|
|---|
| 2632 | case UM_COMMAND:
|
|---|
| 2633 | return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 2634 | FID_CLIENT), msg, mp1, mp2);
|
|---|
| [2] | 2635 |
|
|---|
| [133] | 2636 | case WM_PAINT:
|
|---|
| 2637 | {
|
|---|
| 2638 | HPS hps;
|
|---|
| 2639 | RECTL rcl;
|
|---|
| [1364] | 2640 | ULONG lColor = 0L;
|
|---|
| [2] | 2641 |
|
|---|
| [926] | 2642 | hps = WinBeginPaint(hwnd, (HPS)0, NULL);
|
|---|
| [551] | 2643 | if (hps) {
|
|---|
| [1364] | 2644 | GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);
|
|---|
| 2645 | if (!WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, NULL,
|
|---|
| 2646 | sizeof(lColor), &lColor, 0))
|
|---|
| 2647 | lColor = 0x00CCCCCCL; //Palegray
|
|---|
| [1335] | 2648 | WinQueryWindowRect(hwnd, &rcl);
|
|---|
| 2649 | WinFillRect(hps, &rcl, lColor);
|
|---|
| 2650 | WinEndPaint(hps);
|
|---|
| [133] | 2651 | }
|
|---|
| [926] | 2652 |
|
|---|
| [133] | 2653 | }
|
|---|
| 2654 | break;
|
|---|
| [2] | 2655 |
|
|---|
| [926] | 2656 | case WM_PRESPARAMCHANGED:
|
|---|
| 2657 | PresParamChanged(hwnd, "ToolBar", mp1, mp2);
|
|---|
| [946] | 2658 | WinInvalidateRect(hwnd, NULL, TRUE);
|
|---|
| [926] | 2659 | break;
|
|---|
| 2660 |
|
|---|
| [133] | 2661 | case UM_SETUP:
|
|---|
| 2662 | {
|
|---|
| 2663 | USHORT id;
|
|---|
| 2664 | TOOL *tool;
|
|---|
| [2] | 2665 |
|
|---|
| [1364] | 2666 | RestorePresParams(hwnd, "ToolBar");
|
|---|
| [133] | 2667 | id = SHORT1FROMMP(mp1);
|
|---|
| 2668 | tool = find_tool(id);
|
|---|
| [551] | 2669 | if (tool) {
|
|---|
| [1335] | 2670 | del_tool(tool);
|
|---|
| 2671 | WinShowWindow(WinWindowFromID(hwnd, id), FALSE);
|
|---|
| 2672 | if (fToolTitles)
|
|---|
| 2673 | WinShowWindow(WinWindowFromID(hwnd, id + 25000), FALSE);
|
|---|
| 2674 | ResizeTools(hwnd);
|
|---|
| 2675 | save_tools(NULL);
|
|---|
| [133] | 2676 | }
|
|---|
| 2677 | }
|
|---|
| 2678 | return 0;
|
|---|
| [2] | 2679 |
|
|---|
| [1125] | 2680 | case UM_SETUP2: /* Used to load a new a toolbar */
|
|---|
| 2681 | BuildTools(hwnd, TRUE);
|
|---|
| 2682 | return 0;
|
|---|
| 2683 |
|
|---|
| [133] | 2684 | case WM_CHORD:
|
|---|
| 2685 | {
|
|---|
| 2686 | USHORT id;
|
|---|
| [2] | 2687 |
|
|---|
| [133] | 2688 | id = (USHORT) WinDlgBox(HWND_DESKTOP,
|
|---|
| [1335] | 2689 | hwnd,
|
|---|
| 2690 | AddToolProc,
|
|---|
| 2691 | FM3ModHandle, ADDBTN_FRAME, MPVOID);
|
|---|
| [133] | 2692 | if (id && id != (USHORT) - 1)
|
|---|
| [1335] | 2693 | WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 2694 | FID_CLIENT),
|
|---|
| 2695 | WM_COMMAND,
|
|---|
| 2696 | MPFROM2SHORT(IDM_CREATETOOL, 0), MPFROM2SHORT(id, 0));
|
|---|
| [133] | 2697 | }
|
|---|
| 2698 | break;
|
|---|
| [2] | 2699 |
|
|---|
| [133] | 2700 | case WM_CONTEXTMENU:
|
|---|
| 2701 | if (WinDlgBox(HWND_DESKTOP,
|
|---|
| [1335] | 2702 | hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID))
|
|---|
| [1125] | 2703 | PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| [133] | 2704 | return MRFROMSHORT(TRUE);
|
|---|
| [2] | 2705 |
|
|---|
| [133] | 2706 | case WM_CLOSE:
|
|---|
| 2707 | WinDestroyWindow(hwnd);
|
|---|
| 2708 | return 0;
|
|---|
| [2] | 2709 |
|
|---|
| [133] | 2710 | case WM_DESTROY:
|
|---|
| 2711 | break;
|
|---|
| 2712 | }
|
|---|
| 2713 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 2714 | }
|
|---|
| 2715 |
|
|---|
| [178] | 2716 | static VOID AdjustSizeOfClient(PSWP pswp, PRECTL prectl)
|
|---|
| [133] | 2717 | {
|
|---|
| 2718 | SWP swp;
|
|---|
| 2719 | RECTL rectl;
|
|---|
| [2] | 2720 |
|
|---|
| [133] | 2721 | if (fFreeTree)
|
|---|
| 2722 | return;
|
|---|
| [551] | 2723 | if (pswp) {
|
|---|
| [133] | 2724 | if (WinQueryWindowPos(hwndTree, &swp) &&
|
|---|
| [1335] | 2725 | !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) {
|
|---|
| [551] | 2726 | pswp->x = swp.cx;
|
|---|
| 2727 | pswp->cx -= swp.cx;
|
|---|
| [133] | 2728 | }
|
|---|
| 2729 | }
|
|---|
| [551] | 2730 | if (prectl) {
|
|---|
| [133] | 2731 | if (WinQueryWindowPos(hwndTree, &swp) &&
|
|---|
| [1335] | 2732 | !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) &&
|
|---|
| 2733 | WinQueryWindowRect(hwndTree, &rectl)) {
|
|---|
| [551] | 2734 | prectl->xLeft = rectl.xRight;
|
|---|
| 2735 | prectl->xRight -= rectl.xRight;
|
|---|
| [133] | 2736 | }
|
|---|
| 2737 | }
|
|---|
| [2] | 2738 | }
|
|---|
| 2739 |
|
|---|
| [133] | 2740 | VOID FillClient(HWND hwndClient, PSWP pswp, PRECTL prectl, BOOL avoidtree)
|
|---|
| 2741 | {
|
|---|
| 2742 | ULONG adjust;
|
|---|
| [2] | 2743 |
|
|---|
| [133] | 2744 | adjust = WinQuerySysValue(HWND_DESKTOP, SV_CYICON);
|
|---|
| 2745 | if (pswp)
|
|---|
| 2746 | WinQueryWindowPos(hwndClient, pswp);
|
|---|
| 2747 | if (prectl)
|
|---|
| 2748 | WinQueryWindowRect(hwndClient, prectl);
|
|---|
| 2749 | if (avoidtree && !fFreeTree)
|
|---|
| 2750 | AdjustSizeOfClient(pswp, prectl);
|
|---|
| 2751 | if (prectl)
|
|---|
| [551] | 2752 | prectl->yBottom += adjust;
|
|---|
| 2753 | if (pswp) {
|
|---|
| [133] | 2754 | if (!avoidtree || fFreeTree)
|
|---|
| [551] | 2755 | pswp->x = 0;
|
|---|
| 2756 | pswp->y = adjust;
|
|---|
| 2757 | if (pswp->cy >= adjust)
|
|---|
| 2758 | pswp->cy -= adjust;
|
|---|
| [133] | 2759 | else
|
|---|
| [551] | 2760 | pswp->cy = 0;
|
|---|
| [133] | 2761 | }
|
|---|
| [2] | 2762 | }
|
|---|
| 2763 |
|
|---|
| [178] | 2764 | static VOID MoveChildrenAwayFromTree(HWND hwndClient)
|
|---|
| [133] | 2765 | {
|
|---|
| 2766 | SWP swpC, swpT, swp;
|
|---|
| 2767 | USHORT id;
|
|---|
| 2768 | HWND hwndChild;
|
|---|
| 2769 | HENUM henum;
|
|---|
| [2] | 2770 |
|
|---|
| [133] | 2771 | if (fFreeTree)
|
|---|
| 2772 | return;
|
|---|
| 2773 | WinQueryWindowPos(hwndClient, &swpC);
|
|---|
| 2774 | if (swpC.fl & (SWP_MINIMIZE | SWP_HIDE))
|
|---|
| 2775 | return;
|
|---|
| 2776 | WinQueryWindowPos(hwndTree, &swpT);
|
|---|
| 2777 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| [551] | 2778 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| [133] | 2779 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
|---|
| 2780 | if (!id || id == TREE_FRAME)
|
|---|
| 2781 | continue;
|
|---|
| 2782 | WinQueryWindowPos(hwndChild, &swp);
|
|---|
| [551] | 2783 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
|---|
| 2784 | if (swp.x < swpT.cx) {
|
|---|
| [1335] | 2785 | swp.x = swpT.cx;
|
|---|
| 2786 | if (swp.x + swp.cx > swpC.cx)
|
|---|
| 2787 | swp.cx = swpC.cx - swp.x;
|
|---|
| 2788 | if (swp.cx > 24)
|
|---|
| 2789 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
|---|
| 2790 | SWP_SIZE | SWP_MOVE | SWP_SHOW);
|
|---|
| [133] | 2791 | }
|
|---|
| 2792 | }
|
|---|
| 2793 | }
|
|---|
| 2794 | WinEndEnumWindows(henum);
|
|---|
| [2] | 2795 | }
|
|---|
| 2796 |
|
|---|
| [178] | 2797 | static VOID ArrangeIcons(HWND hwndClient)
|
|---|
| [133] | 2798 | {
|
|---|
| 2799 | HENUM henum;
|
|---|
| 2800 | HWND hwndChild;
|
|---|
| 2801 | SWP swp;
|
|---|
| [2] | 2802 |
|
|---|
| [133] | 2803 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| [551] | 2804 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| [133] | 2805 | WinQueryWindowPos(hwndChild, &swp);
|
|---|
| [551] | 2806 | if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {
|
|---|
| [133] | 2807 | WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1);
|
|---|
| 2808 | WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);
|
|---|
| 2809 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,
|
|---|
| [1335] | 2810 | SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE);
|
|---|
| [133] | 2811 | }
|
|---|
| 2812 | }
|
|---|
| 2813 | WinEndEnumWindows(henum);
|
|---|
| [2] | 2814 | }
|
|---|
| 2815 |
|
|---|
| [178] | 2816 | static VOID NextChild(HWND hwndClient, BOOL previous)
|
|---|
| [133] | 2817 | {
|
|---|
| 2818 | HENUM henum;
|
|---|
| [551] | 2819 | HWND hwndActive, hwndNext, hwndPrev = (HWND) 0;
|
|---|
| [133] | 2820 | BOOL next = FALSE, once = FALSE;
|
|---|
| [2] | 2821 |
|
|---|
| [133] | 2822 | previous = !previous;
|
|---|
| [2] | 2823 |
|
|---|
| [133] | 2824 | hwndActive = WinQueryActiveWindow(hwndClient);
|
|---|
| 2825 | if (!hwndActive)
|
|---|
| 2826 | next = TRUE;
|
|---|
| 2827 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| [551] | 2828 | for (;;) {
|
|---|
| [133] | 2829 | hwndNext = WinGetNextWindow(henum);
|
|---|
| [551] | 2830 | if (hwndNext) {
|
|---|
| [133] | 2831 | if (!WinQueryWindowUShort(hwndNext, QWS_ID))
|
|---|
| [1335] | 2832 | continue;
|
|---|
| [133] | 2833 | if (next)
|
|---|
| [1335] | 2834 | break;
|
|---|
| [551] | 2835 | if (hwndNext == hwndActive) {
|
|---|
| [1335] | 2836 | if (!previous && hwndPrev) {
|
|---|
| 2837 | hwndNext = hwndPrev;
|
|---|
| 2838 | break;
|
|---|
| 2839 | }
|
|---|
| 2840 | else if (previous)
|
|---|
| 2841 | next = TRUE;
|
|---|
| [133] | 2842 | }
|
|---|
| 2843 | hwndPrev = hwndNext;
|
|---|
| 2844 | }
|
|---|
| [551] | 2845 | else {
|
|---|
| [133] | 2846 | if ((!next && previous) || once)
|
|---|
| [1335] | 2847 | break;
|
|---|
| [551] | 2848 | else if (!previous) {
|
|---|
| [1335] | 2849 | hwndNext = hwndPrev;
|
|---|
| 2850 | break;
|
|---|
| [133] | 2851 | }
|
|---|
| 2852 | else
|
|---|
| [1335] | 2853 | once = next = TRUE;
|
|---|
| [133] | 2854 | }
|
|---|
| 2855 | }
|
|---|
| 2856 | WinEndEnumWindows(henum);
|
|---|
| [2] | 2857 |
|
|---|
| [551] | 2858 | if (hwndNext && hwndNext != hwndActive) {
|
|---|
| 2859 | WinSetWindowPos(hwndNext, HWND_TOP, 0, 0, 0, 0,
|
|---|
| [1335] | 2860 | SWP_ZORDER | SWP_ACTIVATE);
|
|---|
| [551] | 2861 | WinSetWindowPos(hwndActive, ((previous) ? HWND_BOTTOM : hwndNext), 0, 0,
|
|---|
| [1335] | 2862 | 0, 0, SWP_ZORDER);
|
|---|
| [133] | 2863 | }
|
|---|
| [2] | 2864 | }
|
|---|
| 2865 |
|
|---|
| [133] | 2866 | BOOL CloseChildren(HWND hwndClient)
|
|---|
| 2867 | {
|
|---|
| 2868 | HENUM henum;
|
|---|
| 2869 | HWND hwndChild;
|
|---|
| 2870 | BOOL ret = FALSE;
|
|---|
| [2] | 2871 |
|
|---|
| [133] | 2872 | fNoTileUpdate = TRUE;
|
|---|
| 2873 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| [551] | 2874 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 2875 | if (hwndChild != hwndTree) {
|
|---|
| [133] | 2876 | WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
|---|
| [1335] | 2877 | WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
|---|
| [133] | 2878 | if (WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
|---|
| [1335] | 2879 | WM_CLOSE, MPVOID, MPVOID)) {
|
|---|
| 2880 | ret = TRUE;
|
|---|
| 2881 | break;
|
|---|
| [133] | 2882 | }
|
|---|
| 2883 | }
|
|---|
| 2884 | }
|
|---|
| 2885 | WinEndEnumWindows(henum);
|
|---|
| 2886 | fNoTileUpdate = FALSE;
|
|---|
| 2887 | return ret;
|
|---|
| [2] | 2888 | }
|
|---|
| 2889 |
|
|---|
| [133] | 2890 | BOOL CloseDirCnrChildren(HWND hwndClient)
|
|---|
| 2891 | {
|
|---|
| 2892 | /* returns TRUE if a directory container window was told to close */
|
|---|
| [2] | 2893 |
|
|---|
| [133] | 2894 | HENUM henum;
|
|---|
| 2895 | HWND hwndChild, hwndDir, hwndTemp;
|
|---|
| 2896 | BOOL ret = FALSE;
|
|---|
| [2] | 2897 |
|
|---|
| [133] | 2898 | fNoTileUpdate = TRUE;
|
|---|
| 2899 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| [551] | 2900 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 2901 | if (hwndChild != hwndTree) {
|
|---|
| [133] | 2902 | hwndTemp = WinWindowFromID(hwndChild, FID_CLIENT);
|
|---|
| [551] | 2903 | if (hwndTemp) {
|
|---|
| [1335] | 2904 | hwndDir = WinWindowFromID(hwndTemp, DIR_CNR);
|
|---|
| 2905 | if (hwndDir) {
|
|---|
| 2906 | WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
|---|
| 2907 | WM_CLOSE, MPVOID, MPVOID);
|
|---|
| 2908 | ret = TRUE;
|
|---|
| 2909 | }
|
|---|
| [133] | 2910 | }
|
|---|
| 2911 | }
|
|---|
| 2912 | }
|
|---|
| 2913 | WinEndEnumWindows(henum);
|
|---|
| 2914 | fNoTileUpdate = FALSE;
|
|---|
| 2915 | return ret;
|
|---|
| [2] | 2916 | }
|
|---|
| 2917 |
|
|---|
| [557] | 2918 | /** Save directory container state
|
|---|
| 2919 | * @param hwndClient Client window handle
|
|---|
| 2920 | * @param pszStateName State name to save, NULL to save global state
|
|---|
| [789] | 2921 | * @returns Number of directory container windows that were saved or -1 if error
|
|---|
| [557] | 2922 | * @seealso RestoreDirCnrState
|
|---|
| 2923 | */
|
|---|
| 2924 |
|
|---|
| [789] | 2925 | INT SaveDirCnrState(HWND hwndClient, PSZ pszStateName)
|
|---|
| [133] | 2926 | {
|
|---|
| 2927 | HENUM henum;
|
|---|
| 2928 | HWND hwndChild, hwndDir, hwndC;
|
|---|
| 2929 | ULONG numsaves = 0, flWindowAttr;
|
|---|
| [1060] | 2930 | ULONG previous_numsaves, ulTemp = sizeof(ULONG);
|
|---|
| [787] | 2931 | CHAR szPrefix[STATE_NAME_MAX_BYTES + 1];
|
|---|
| 2932 | CHAR szKey[STATE_NAME_MAX_BYTES + 80];
|
|---|
| [558] | 2933 | CHAR szDir[CCHMAXPATH];
|
|---|
| [133] | 2934 | SWP swp;
|
|---|
| 2935 | DIRCNRDATA *dcd;
|
|---|
| [941] | 2936 | BOOL fIsShutDownState;
|
|---|
| [2] | 2937 |
|
|---|
| [941] | 2938 | if (!pszStateName || !*pszStateName) {
|
|---|
| 2939 | Runtime_Error(pszSrcFile, __LINE__, "no data");
|
|---|
| [1321] | 2940 | return -1;
|
|---|
| [558] | 2941 | }
|
|---|
| [941] | 2942 | if (strlen(pszStateName) > sizeof(szPrefix) - 2) {
|
|---|
| 2943 | Runtime_Error(pszSrcFile, __LINE__, "SaveDirCnrState");
|
|---|
| 2944 | return -1;
|
|---|
| 2945 | }
|
|---|
| [558] | 2946 |
|
|---|
| [961] | 2947 | fIsShutDownState = strcmp(pszStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0;
|
|---|
| [941] | 2948 | sprintf(szPrefix, "%s.", pszStateName);
|
|---|
| 2949 |
|
|---|
| [1128] | 2950 | if (*lasttoolbar) {
|
|---|
| 2951 | sprintf(szKey, "%sToolbar", szPrefix);
|
|---|
| 2952 | PrfWriteProfileString(fmprof, FM3Str, szKey, lasttoolbar);
|
|---|
| 2953 | }
|
|---|
| [1125] | 2954 |
|
|---|
| [1134] | 2955 | if (!fIsShutDownState) {
|
|---|
| [1128] | 2956 | sprintf(szKey, "%sTargetDir", szPrefix);
|
|---|
| 2957 | PrfWriteProfileString(fmprof, FM3Str, szKey, targetdir);
|
|---|
| 2958 | }
|
|---|
| 2959 |
|
|---|
| [133] | 2960 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| [551] | 2961 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 2962 | if (hwndChild != hwndTree) {
|
|---|
| [133] | 2963 | hwndC = WinWindowFromID(hwndChild, FID_CLIENT);
|
|---|
| [551] | 2964 | if (hwndC) {
|
|---|
| [1335] | 2965 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
|---|
| 2966 | if (hwndDir) {
|
|---|
| 2967 | WinQueryWindowPos(hwndChild, &swp);
|
|---|
| 2968 | *szDir = 0;
|
|---|
| 2969 | WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(szDir), MPVOID);
|
|---|
| 2970 | if (*szDir) {
|
|---|
| 2971 | // If saving shutdown state skip no prescan drives
|
|---|
| 2972 | if (fIsShutDownState &&
|
|---|
| 2973 | driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
|
|---|
| 2974 | continue;
|
|---|
| 2975 | }
|
|---|
| 2976 | sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves);
|
|---|
| 2977 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp,
|
|---|
| 2978 | sizeof(SWP));
|
|---|
| 2979 | dcd =
|
|---|
| 2980 | WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
|---|
| 2981 | if (dcd) {
|
|---|
| 2982 | sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves);
|
|---|
| 2983 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags,
|
|---|
| 2984 | sizeof(INT));
|
|---|
| 2985 | sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves);
|
|---|
| 2986 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask,
|
|---|
| 2987 | sizeof(MASK));
|
|---|
| 2988 | sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves);
|
|---|
| 2989 | flWindowAttr = dcd->flWindowAttr;
|
|---|
| 2990 | if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
|
|---|
| 2991 | flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
|
|---|
| 2992 | if (dcd->lastattr) {
|
|---|
| 2993 | if (dcd->lastattr & CV_TEXT)
|
|---|
| 2994 | flWindowAttr |= CV_TEXT;
|
|---|
| 2995 | else if (dcd->lastattr & CV_DETAIL)
|
|---|
| 2996 | flWindowAttr |= CV_DETAIL;
|
|---|
| 2997 | else if (dcd->lastattr & CV_ICON)
|
|---|
| 2998 | flWindowAttr |= CV_ICON;
|
|---|
| 2999 | else
|
|---|
| 3000 | flWindowAttr |= CV_NAME;
|
|---|
| 3001 | }
|
|---|
| 3002 | else
|
|---|
| 3003 | flWindowAttr |= CV_NAME;
|
|---|
| 3004 | }
|
|---|
| 3005 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr,
|
|---|
| 3006 | sizeof(ULONG));
|
|---|
| 3007 | sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves);
|
|---|
| 3008 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslongname,
|
|---|
| 3009 | sizeof(BOOL));
|
|---|
| 3010 | sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, numsaves);
|
|---|
| 3011 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssubject,
|
|---|
| 3012 | sizeof(BOOL));
|
|---|
| 3013 | sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, numsaves);
|
|---|
| 3014 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssize,
|
|---|
| 3015 | sizeof(BOOL));
|
|---|
| 3016 | sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, numsaves);
|
|---|
| 3017 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsea,
|
|---|
| 3018 | sizeof(BOOL));
|
|---|
| 3019 | sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, numsaves);
|
|---|
| 3020 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsattr,
|
|---|
| 3021 | sizeof(BOOL));
|
|---|
| 3022 | sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, numsaves);
|
|---|
| 3023 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsicon,
|
|---|
| 3024 | sizeof(BOOL));
|
|---|
| 3025 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, numsaves);
|
|---|
| 3026 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwdate,
|
|---|
| 3027 | sizeof(BOOL));
|
|---|
| 3028 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, numsaves);
|
|---|
| 3029 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwtime,
|
|---|
| 3030 | sizeof(BOOL));
|
|---|
| 3031 | sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, numsaves);
|
|---|
| 3032 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsladate,
|
|---|
| 3033 | sizeof(BOOL));
|
|---|
| 3034 | sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, numsaves);
|
|---|
| 3035 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslatime,
|
|---|
| 3036 | sizeof(BOOL));
|
|---|
| 3037 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, numsaves);
|
|---|
| 3038 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrdate,
|
|---|
| 3039 | sizeof(BOOL));
|
|---|
| 3040 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, numsaves);
|
|---|
| 3041 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrtime,
|
|---|
| 3042 | sizeof(BOOL));
|
|---|
| 3043 | sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves);
|
|---|
| 3044 | SavePresParams(hwndDir, szKey);
|
|---|
| 3045 | }
|
|---|
| 3046 | sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++);
|
|---|
| 3047 | PrfWriteProfileString(fmprof, FM3Str, szKey, szDir);
|
|---|
| 3048 | }
|
|---|
| 3049 | }
|
|---|
| [133] | 3050 | }
|
|---|
| 3051 | }
|
|---|
| [557] | 3052 | } // while
|
|---|
| [133] | 3053 | WinEndEnumWindows(henum);
|
|---|
| [558] | 3054 |
|
|---|
| [1060] | 3055 | sprintf(szKey, "%sNumDirsLastTime", szPrefix);
|
|---|
| 3056 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &previous_numsaves, &ulTemp))
|
|---|
| 3057 | for (ulTemp = numsaves; ulTemp < previous_numsaves; ulTemp++) {
|
|---|
| 3058 | sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, ulTemp);
|
|---|
| 3059 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(SWP));
|
|---|
| 3060 | sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, ulTemp);
|
|---|
| [1328] | 3061 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(INT));
|
|---|
| [1060] | 3062 | sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, ulTemp);
|
|---|
| 3063 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(MASK));
|
|---|
| 3064 | sprintf(szKey, "%sDirCnrView.%lu", szPrefix, ulTemp);
|
|---|
| [1328] | 3065 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(ULONG));
|
|---|
| [1060] | 3066 | sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, ulTemp);
|
|---|
| [1328] | 3067 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| [1060] | 3068 | sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, ulTemp);
|
|---|
| [1328] | 3069 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| [1060] | 3070 | sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, ulTemp);
|
|---|
| [1328] | 3071 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| [1060] | 3072 | sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, ulTemp);
|
|---|
| [1328] | 3073 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| [1060] | 3074 | sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, ulTemp);
|
|---|
| [1328] | 3075 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| [1060] | 3076 | sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, ulTemp);
|
|---|
| [1328] | 3077 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| [1060] | 3078 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, ulTemp);
|
|---|
| [1328] | 3079 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| [1060] | 3080 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, ulTemp);
|
|---|
| [1328] | 3081 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| [1060] | 3082 | sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, ulTemp);
|
|---|
| [1328] | 3083 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| [1060] | 3084 | sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, ulTemp);
|
|---|
| [1328] | 3085 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| [1060] | 3086 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, ulTemp);
|
|---|
| [1328] | 3087 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| [1060] | 3088 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, ulTemp);
|
|---|
| [1328] | 3089 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| [1060] | 3090 | sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, ulTemp);
|
|---|
| 3091 | PrfWriteProfileString(fmprof, FM3Str, szKey, NULL);
|
|---|
| 3092 | sprintf(szKey, "%sDirCnr.%lu.", szPrefix, ulTemp);
|
|---|
| 3093 | DeletePresParams(szKey);
|
|---|
| [133] | 3094 | }
|
|---|
| [1060] | 3095 | sprintf(szKey, "%sNumDirsLastTime", szPrefix);
|
|---|
| 3096 | if (numsaves) {
|
|---|
| [1328] | 3097 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & numsaves, sizeof(ULONG));
|
|---|
| [133] | 3098 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swp);
|
|---|
| [787] | 3099 | sprintf(szKey, "%sMySizeLastTime", szPrefix);
|
|---|
| 3100 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, sizeof(SWP));
|
|---|
| [1060] | 3101 | if (WinQueryWindowPos(hwndTree, &swp)) {
|
|---|
| 3102 | sprintf(szKey, "%sLastTreePos", szPrefix);
|
|---|
| 3103 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, sizeof(SWP));
|
|---|
| 3104 | }
|
|---|
| [133] | 3105 | }
|
|---|
| [1024] | 3106 | else if (fIsShutDownState) {
|
|---|
| [1328] | 3107 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & numsaves, sizeof(ULONG));
|
|---|
| [1024] | 3108 | }
|
|---|
| [558] | 3109 |
|
|---|
| [1060] | 3110 | return numsaves;
|
|---|
| [2] | 3111 | }
|
|---|
| 3112 |
|
|---|
| [178] | 3113 | static VOID TransformSwp(PSWP pswp, double xtrans, double ytrans)
|
|---|
| [133] | 3114 | {
|
|---|
| 3115 | SWP swp;
|
|---|
| 3116 | HWND hwnd;
|
|---|
| [2] | 3117 |
|
|---|
| [551] | 3118 | if ((LONG) pswp->x < 0L) {
|
|---|
| 3119 | pswp->cx -= abs(pswp->x);
|
|---|
| 3120 | pswp->x = 0;
|
|---|
| [133] | 3121 | }
|
|---|
| [551] | 3122 | if ((LONG) pswp->y < 0L) {
|
|---|
| 3123 | pswp->cy -= abs(pswp->y);
|
|---|
| 3124 | pswp->y = 0;
|
|---|
| [133] | 3125 | }
|
|---|
| [551] | 3126 | pswp->x = (LONG) (((double)pswp->x * 100.0) / xtrans);
|
|---|
| 3127 | pswp->cx = (LONG) (((double)pswp->cx * 100.0) / xtrans);
|
|---|
| 3128 | pswp->y = (LONG) (((double)pswp->y * 100.0) / ytrans);
|
|---|
| 3129 | pswp->cy = (LONG) (((double)pswp->cy * 100.0) / ytrans);
|
|---|
| 3130 | if (pswp->hwnd) {
|
|---|
| 3131 | hwnd = WinQueryWindow(pswp->hwnd, QW_PARENT);
|
|---|
| 3132 | if (hwnd) {
|
|---|
| 3133 | if (WinQueryWindowPos(hwnd, &swp)) {
|
|---|
| [1335] | 3134 | if (pswp->x > swp.cx)
|
|---|
| 3135 | pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx;
|
|---|
| 3136 | if (pswp->y > swp.cy)
|
|---|
| 3137 | pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy;
|
|---|
| 3138 | if (pswp->x + pswp->cx > swp.cx)
|
|---|
| 3139 | pswp->cx = swp.cx - pswp->x;
|
|---|
| 3140 | if (pswp->y + pswp->cy > swp.cy)
|
|---|
| 3141 | pswp->cy = swp.cy - pswp->y;
|
|---|
| [133] | 3142 | }
|
|---|
| 3143 | }
|
|---|
| 3144 | }
|
|---|
| [2] | 3145 | }
|
|---|
| 3146 |
|
|---|
| [557] | 3147 | /** Restore directory container state
|
|---|
| 3148 | * @param hwndClient Client window handle
|
|---|
| 3149 | * @param pszStateName State name to restore, NULL to restore global state
|
|---|
| [941] | 3150 | * @param noview request view state restore bypass
|
|---|
| [557] | 3151 | * @returns TRUE if one or more directory containers were opened
|
|---|
| 3152 | * @seealso SaveDirCnrState
|
|---|
| 3153 | */
|
|---|
| 3154 |
|
|---|
| 3155 | static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview)
|
|---|
| [133] | 3156 | {
|
|---|
| [787] | 3157 | CHAR szKey[STATE_NAME_MAX_BYTES + 80];
|
|---|
| [558] | 3158 | CHAR szDir[CCHMAXPATH];
|
|---|
| [787] | 3159 | CHAR szPrefix[STATE_NAME_MAX_BYTES + 2];
|
|---|
| [1033] | 3160 | HWND hwndDir, hwndC, hwndPPSave = NULLHANDLE;
|
|---|
| [133] | 3161 | SWP swp, swpO, swpN;
|
|---|
| [1033] | 3162 | ULONG size, numsaves = 0;
|
|---|
| 3163 | LONG x;
|
|---|
| [133] | 3164 | double xtrans, ytrans;
|
|---|
| [558] | 3165 | BOOL fRestored = FALSE;
|
|---|
| [923] | 3166 | DIRCNRDATA localdcd, *dcd;
|
|---|
| [941] | 3167 | BOOL fIsShutDownState;
|
|---|
| [961] | 3168 | BOOL fDeleteState;
|
|---|
| [2] | 3169 |
|
|---|
| [941] | 3170 | if (!pszStateName || !*pszStateName) {
|
|---|
| 3171 | Runtime_Error(pszSrcFile, __LINE__, "no name");
|
|---|
| 3172 | return fRestored;
|
|---|
| [558] | 3173 | }
|
|---|
| [941] | 3174 | if (strlen(pszStateName) > sizeof(szPrefix) - 2) {
|
|---|
| 3175 | Runtime_Error(pszSrcFile, __LINE__, "name too long");
|
|---|
| 3176 | return fRestored;
|
|---|
| 3177 | }
|
|---|
| [558] | 3178 |
|
|---|
| [941] | 3179 | sprintf(szPrefix, "%s.", pszStateName);
|
|---|
| 3180 |
|
|---|
| [961] | 3181 | // If restoring shutdown state bypass no-prescan drives
|
|---|
| 3182 | fIsShutDownState = strcmp(pszStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0;
|
|---|
| [981] | 3183 | // Delete saved state if internally saved state
|
|---|
| 3184 | fDeleteState = strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)) == 0;
|
|---|
| [941] | 3185 |
|
|---|
| [1333] | 3186 | //size = (ULONG)0;
|
|---|
| [1125] | 3187 | sprintf(szKey, "%sToolbar", szPrefix);
|
|---|
| [1333] | 3188 | //if (PrfQueryProfileSize(fmprof, FM3Str, szKey, &size) && size)
|
|---|
| [1125] | 3189 | {
|
|---|
| 3190 | if (fToolsChanged)
|
|---|
| 3191 | save_tools(NULL);
|
|---|
| [1333] | 3192 | PrfQueryProfileString(fmprof, FM3Str, szKey, NULL, lasttoolbar, sizeof(lasttoolbar));
|
|---|
| [1125] | 3193 | PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar);
|
|---|
| 3194 | load_tools(NULL);
|
|---|
| 3195 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| 3196 | }
|
|---|
| [1333] | 3197 | //size = (ULONG)0;
|
|---|
| [1128] | 3198 | sprintf(szKey, "%sTargetDir", szPrefix);
|
|---|
| [1333] | 3199 | //if (PrfQueryProfileSize(fmprof, FM3Str, szKey, &size) && size)
|
|---|
| [1128] | 3200 | {
|
|---|
| [1333] | 3201 | PrfQueryProfileString(fmprof, FM3Str, szKey, NULL, targetdir, sizeof(targetdir));
|
|---|
| [1128] | 3202 | PrfWriteProfileString(fmprof, FM3Str, "TargetDir", targetdir);
|
|---|
| 3203 | SetTargetDir(NULL, TRUE);
|
|---|
| 3204 | }
|
|---|
| [133] | 3205 | size = sizeof(SWP);
|
|---|
| [787] | 3206 | sprintf(szKey, "%sMySizeLastTime", szPrefix);
|
|---|
| [133] | 3207 | if (!PrfQueryProfileData(fmprof,
|
|---|
| [1335] | 3208 | FM3Str,
|
|---|
| 3209 | szKey,
|
|---|
| 3210 | (PVOID) &swpO,
|
|---|
| 3211 | &size) ||
|
|---|
| [133] | 3212 | size != sizeof(SWP) || !swp.cx || !swp.cy)
|
|---|
| [558] | 3213 | {
|
|---|
| [133] | 3214 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swpO);
|
|---|
| [558] | 3215 | }
|
|---|
| [1060] | 3216 | // If restoring internally saved state, forget info
|
|---|
| [961] | 3217 | if (fDeleteState)
|
|---|
| [787] | 3218 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| [133] | 3219 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swpN);
|
|---|
| 3220 | if (swpN.fl & (SWP_MINIMIZE | SWP_HIDE))
|
|---|
| 3221 | swpN = swpO;
|
|---|
| [551] | 3222 | xtrans = ((double)swpO.cx * 100.0) / (double)swpN.cx;
|
|---|
| 3223 | ytrans = ((double)swpO.cy * 100.0) / (double)swpN.cy;
|
|---|
| [133] | 3224 | size = sizeof(SWP);
|
|---|
| [787] | 3225 | sprintf(szKey, "%sLastTreePos", szPrefix);
|
|---|
| [1326] | 3226 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) {
|
|---|
| [961] | 3227 | if (fDeleteState)
|
|---|
| [787] | 3228 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| [133] | 3229 | swp.hwnd = hwndTree;
|
|---|
| [551] | 3230 | TransformSwp(&swp, xtrans, ytrans);
|
|---|
| 3231 | if (!fFreeTree) {
|
|---|
| [133] | 3232 | WinQueryWindowPos(hwndClient, &swpN);
|
|---|
| 3233 | swp.x = 0;
|
|---|
| 3234 | swp.y = (swpN.cy - swp.cy);
|
|---|
| 3235 | }
|
|---|
| [551] | 3236 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE))) {
|
|---|
| [133] | 3237 | swp.fl &= (~SWP_ACTIVATE);
|
|---|
| [2] | 3238 | WinSetWindowPos(hwndTree,
|
|---|
| [1335] | 3239 | HWND_TOP,
|
|---|
| 3240 | swp.x,
|
|---|
| 3241 | swp.y,
|
|---|
| 3242 | swp.cx,
|
|---|
| 3243 | swp.cy,
|
|---|
| 3244 | swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
|---|
| [133] | 3245 | }
|
|---|
| [551] | 3246 | else {
|
|---|
| [2] | 3247 | WinSetWindowPos(hwndTree,
|
|---|
| [1335] | 3248 | HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);
|
|---|
| [551] | 3249 | WinSetWindowUShort(hwndTree, QWS_XRESTORE, (USHORT) swp.x);
|
|---|
| 3250 | WinSetWindowUShort(hwndTree, QWS_CXRESTORE, (USHORT) swp.cx);
|
|---|
| 3251 | WinSetWindowUShort(hwndTree, QWS_YRESTORE, (USHORT) swp.y);
|
|---|
| 3252 | WinSetWindowUShort(hwndTree, QWS_CYRESTORE, (USHORT) swp.cy);
|
|---|
| [133] | 3253 | }
|
|---|
| 3254 | }
|
|---|
| [787] | 3255 | sprintf(szKey, "%sNumDirsLastTime", szPrefix);
|
|---|
| [1328] | 3256 | size = sizeof(ULONG);
|
|---|
| [133] | 3257 | if (PrfQueryProfileData(fmprof,
|
|---|
| [1335] | 3258 | FM3Str, szKey, (PVOID) &numsaves, &size)) {
|
|---|
| [961] | 3259 | if (fDeleteState)
|
|---|
| [787] | 3260 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| [1033] | 3261 | for (x = numsaves - 1; x >= 0; x--) {
|
|---|
| [787] | 3262 | sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, x);
|
|---|
| [133] | 3263 | size = sizeof(SWP);
|
|---|
| [940] | 3264 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) {
|
|---|
| [1335] | 3265 | if (fDeleteState)
|
|---|
| 3266 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3267 | sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x);
|
|---|
| 3268 | size = sizeof(szDir);
|
|---|
| 3269 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) {
|
|---|
| 3270 | // If restoring shutdown state and drive marked no prescan
|
|---|
| 3271 | // bypass window restore
|
|---|
| 3272 | if (fIsShutDownState &&
|
|---|
| 3273 | driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
|
|---|
| 3274 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3275 | continue;
|
|---|
| 3276 | }
|
|---|
| 3277 | if (fDeleteState)
|
|---|
| 3278 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3279 | localdcd.ds.detailslongname = dsDirCnrDefault.detailslongname; // Set default
|
|---|
| 3280 | sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x);
|
|---|
| 3281 | size = sizeof(BOOL);
|
|---|
| 3282 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3283 | FM3Str,
|
|---|
| 3284 | szKey,
|
|---|
| 3285 | (PVOID) &localdcd.ds.detailslongname,
|
|---|
| 3286 | &size))
|
|---|
| 3287 | {
|
|---|
| 3288 | if (fDeleteState)
|
|---|
| 3289 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3290 | }
|
|---|
| 3291 | localdcd.ds.detailssubject = dsDirCnrDefault.detailssubject; // Set default
|
|---|
| 3292 | sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, x);
|
|---|
| 3293 | size = sizeof(BOOL);
|
|---|
| 3294 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3295 | FM3Str,
|
|---|
| 3296 | szKey,
|
|---|
| 3297 | (PVOID) &localdcd.ds.detailssubject,
|
|---|
| 3298 | &size))
|
|---|
| 3299 | {
|
|---|
| 3300 | if (fDeleteState)
|
|---|
| 3301 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3302 | }
|
|---|
| 3303 | localdcd.ds.detailsea = dsDirCnrDefault.detailsea; // Set default
|
|---|
| 3304 | sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, x);
|
|---|
| 3305 | size = sizeof(BOOL);
|
|---|
| 3306 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3307 | FM3Str,
|
|---|
| 3308 | szKey,
|
|---|
| 3309 | (PVOID) &localdcd.ds.detailsea,
|
|---|
| 3310 | &size))
|
|---|
| 3311 | {
|
|---|
| 3312 | if (fDeleteState)
|
|---|
| 3313 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3314 | }
|
|---|
| 3315 | localdcd.ds.detailssize = dsDirCnrDefault.detailssize; // Set default
|
|---|
| 3316 | sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, x);
|
|---|
| 3317 | size = sizeof(BOOL);
|
|---|
| 3318 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3319 | FM3Str,
|
|---|
| 3320 | szKey,
|
|---|
| 3321 | (PVOID) &localdcd.ds.detailssize,
|
|---|
| 3322 | &size))
|
|---|
| 3323 | {
|
|---|
| 3324 | if (fDeleteState)
|
|---|
| 3325 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3326 | }
|
|---|
| 3327 | localdcd.ds.detailsicon = dsDirCnrDefault.detailsicon; // Set default
|
|---|
| 3328 | sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, x);
|
|---|
| 3329 | size = sizeof(BOOL);
|
|---|
| 3330 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3331 | FM3Str,
|
|---|
| 3332 | szKey,
|
|---|
| 3333 | (PVOID) &localdcd.ds.detailsicon,
|
|---|
| 3334 | &size))
|
|---|
| 3335 | {
|
|---|
| 3336 | if (fDeleteState)
|
|---|
| 3337 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3338 | }
|
|---|
| 3339 | localdcd.ds.detailsattr = dsDirCnrDefault.detailsattr; // Set default
|
|---|
| 3340 | sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, x);
|
|---|
| 3341 | size = sizeof(BOOL);
|
|---|
| 3342 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3343 | FM3Str,
|
|---|
| 3344 | szKey,
|
|---|
| 3345 | (PVOID) &localdcd.ds.detailsattr,
|
|---|
| 3346 | &size))
|
|---|
| 3347 | {
|
|---|
| 3348 | if (fDeleteState)
|
|---|
| 3349 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3350 | }
|
|---|
| 3351 | localdcd.ds.detailscrdate = dsDirCnrDefault.detailscrdate; // Set default
|
|---|
| 3352 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, x);
|
|---|
| 3353 | size = sizeof(BOOL);
|
|---|
| 3354 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3355 | FM3Str,
|
|---|
| 3356 | szKey,
|
|---|
| 3357 | (PVOID) &localdcd.ds.detailscrdate,
|
|---|
| 3358 | &size))
|
|---|
| 3359 | {
|
|---|
| 3360 | if (fDeleteState)
|
|---|
| 3361 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3362 | }
|
|---|
| 3363 | localdcd.ds.detailscrtime = dsDirCnrDefault.detailscrtime; // Set default
|
|---|
| 3364 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, x);
|
|---|
| 3365 | size = sizeof(BOOL);
|
|---|
| 3366 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3367 | FM3Str,
|
|---|
| 3368 | szKey,
|
|---|
| 3369 | (PVOID) &localdcd.ds.detailscrtime,
|
|---|
| 3370 | &size))
|
|---|
| 3371 | {
|
|---|
| 3372 | if (fDeleteState)
|
|---|
| 3373 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3374 | }
|
|---|
| 3375 | localdcd.ds.detailslwdate = dsDirCnrDefault.detailslwdate; // Set default
|
|---|
| 3376 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, x);
|
|---|
| 3377 | size = sizeof(BOOL);
|
|---|
| 3378 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3379 | FM3Str,
|
|---|
| 3380 | szKey,
|
|---|
| 3381 | (PVOID) &localdcd.ds.detailslwdate,
|
|---|
| 3382 | &size))
|
|---|
| 3383 | {
|
|---|
| 3384 | if (fDeleteState)
|
|---|
| 3385 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3386 | }
|
|---|
| 3387 | localdcd.ds.detailslwtime = dsDirCnrDefault.detailslwtime; // Set default
|
|---|
| 3388 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, x);
|
|---|
| 3389 | size = sizeof(BOOL);
|
|---|
| 3390 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3391 | FM3Str,
|
|---|
| 3392 | szKey,
|
|---|
| 3393 | (PVOID) &localdcd.ds.detailslwtime,
|
|---|
| 3394 | &size))
|
|---|
| 3395 | {
|
|---|
| 3396 | if (fDeleteState)
|
|---|
| 3397 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3398 | }
|
|---|
| 3399 | localdcd.ds.detailsladate = dsDirCnrDefault.detailsladate; // Set default
|
|---|
| 3400 | sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, x);
|
|---|
| 3401 | size = sizeof(BOOL);
|
|---|
| 3402 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3403 | FM3Str,
|
|---|
| 3404 | szKey,
|
|---|
| 3405 | (PVOID) &localdcd.ds.detailsladate,
|
|---|
| 3406 | &size))
|
|---|
| 3407 | {
|
|---|
| 3408 | if (fDeleteState)
|
|---|
| 3409 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3410 | }
|
|---|
| 3411 | localdcd.ds.detailslatime = dsDirCnrDefault.detailslatime; // Set default
|
|---|
| 3412 | sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, x);
|
|---|
| 3413 | size = sizeof(BOOL);
|
|---|
| 3414 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3415 | FM3Str,
|
|---|
| 3416 | szKey,
|
|---|
| 3417 | (PVOID) &localdcd.ds.detailslatime,
|
|---|
| 3418 | &size))
|
|---|
| 3419 | {
|
|---|
| 3420 | if (fDeleteState)
|
|---|
| 3421 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3422 | }
|
|---|
| 3423 | hwndDir = (HWND) WinSendMsg(hwndClient,
|
|---|
| 3424 | UM_SETDIR,
|
|---|
| 3425 | MPFROMP(szDir), MPFROMLONG(1));
|
|---|
| 3426 | if (hwndDir) {
|
|---|
| 3427 | hwndC = WinWindowFromID(hwndDir, FID_CLIENT);
|
|---|
| [1354] | 3428 | if (hwndC) {
|
|---|
| [1335] | 3429 | HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR);
|
|---|
| 3430 | if (!hwndPPSave) {
|
|---|
| 3431 | hwndPPSave = WinCreateWindow(hwndCnr, // Create a window (used to save default presparams)
|
|---|
| 3432 | WC_CONTAINER,
|
|---|
| 3433 | NULL,
|
|---|
| 3434 | CCS_AUTOPOSITION | CCS_MINIICONS |
|
|---|
| 3435 | CCS_MINIRECORDCORE | ulCnrType,
|
|---|
| 3436 | 0,
|
|---|
| 3437 | 0,
|
|---|
| 3438 | 0,
|
|---|
| 3439 | 0,
|
|---|
| 3440 | hwndCnr,
|
|---|
| 3441 | HWND_TOP, (ULONG) -1, NULL, NULL);
|
|---|
| 3442 | CopyPresParams(hwndPPSave, hwndC);
|
|---|
| 3443 | RestorePresParams(hwndPPSave, "DirCnr");
|
|---|
| 3444 | }
|
|---|
| 3445 | sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);
|
|---|
| 3446 | RestorePresParams(hwndCnr, szKey);
|
|---|
| 3447 | dcd = WinQueryWindowPtr(hwndCnr, QWL_USER);
|
|---|
| 3448 | if (dcd) {
|
|---|
| 3449 | dcd->ds.detailslongname = localdcd.ds.detailslongname;
|
|---|
| 3450 | dcd->ds.detailssubject = localdcd.ds.detailssubject ;
|
|---|
| 3451 | dcd->ds.detailsattr = localdcd.ds.detailsattr ;
|
|---|
| 3452 | dcd->ds.detailsea = localdcd.ds.detailsea ;
|
|---|
| 3453 | dcd->ds.detailssize = localdcd.ds.detailssize ;
|
|---|
| 3454 | dcd->ds.detailsicon = localdcd.ds.detailsicon ;
|
|---|
| 3455 | dcd->ds.detailscrdate = localdcd.ds.detailscrdate ;
|
|---|
| 3456 | dcd->ds.detailscrtime = localdcd.ds.detailscrtime ;
|
|---|
| 3457 | dcd->ds.detailsladate = localdcd.ds.detailsladate ;
|
|---|
| 3458 | dcd->ds.detailslatime = localdcd.ds.detailslatime ;
|
|---|
| 3459 | dcd->ds.detailslwdate = localdcd.ds.detailslwdate ;
|
|---|
| 3460 | dcd->ds.detailslwtime = localdcd.ds.detailslwtime ;
|
|---|
| 3461 | sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x);
|
|---|
| 3462 | size = sizeof(INT);
|
|---|
| 3463 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3464 | FM3Str,
|
|---|
| 3465 | szKey,
|
|---|
| 3466 | (PVOID) &dcd->sortFlags,
|
|---|
| 3467 | &size)) {
|
|---|
| 3468 | if (!dcd->sortFlags)
|
|---|
| 3469 | dcd->sortFlags = SORT_PATHNAME;
|
|---|
| 3470 | }
|
|---|
| 3471 | if (fDeleteState)
|
|---|
| 3472 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3473 | size = sizeof(MASK);
|
|---|
| 3474 | sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x);
|
|---|
| 3475 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3476 | FM3Str,
|
|---|
| 3477 | szKey,
|
|---|
| 3478 | (PVOID) &dcd->mask, &size)) {
|
|---|
| 3479 | if (*dcd->mask.szMask)
|
|---|
| 3480 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
|---|
| 3481 | UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
|
|---|
| 3482 | }
|
|---|
| 3483 | *(dcd->mask.prompt) = 0;
|
|---|
| 3484 | if (fDeleteState)
|
|---|
| 3485 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3486 | sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x);
|
|---|
| 3487 | if (!noview) {
|
|---|
| 3488 | size = sizeof(ULONG);
|
|---|
| 3489 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3490 | FM3Str,
|
|---|
| 3491 | szKey,
|
|---|
| 3492 | (PVOID) &dcd->flWindowAttr,
|
|---|
| 3493 | &size)) {
|
|---|
| [2] | 3494 |
|
|---|
| [1335] | 3495 | CNRINFO cnri;
|
|---|
| [2] | 3496 |
|
|---|
| [1335] | 3497 | memset(&cnri, 0, sizeof(CNRINFO));
|
|---|
| 3498 | cnri.cb = sizeof(CNRINFO);
|
|---|
| 3499 | if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
|---|
| 3500 | CM_QUERYCNRINFO,
|
|---|
| 3501 | MPFROMP(&cnri),
|
|---|
| 3502 | MPFROMLONG(sizeof(CNRINFO)))) {
|
|---|
| 3503 | cnri.flWindowAttr = dcd->flWindowAttr;
|
|---|
| [1354] | 3504 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
|---|
| 3505 | CM_SETCNRINFO,
|
|---|
| 3506 | MPFROMP(&cnri),
|
|---|
| 3507 | MPFROMLONG(CMA_FLWINDOWATTR));
|
|---|
| [1335] | 3508 | }
|
|---|
| 3509 | }
|
|---|
| 3510 | }
|
|---|
| 3511 | if (fDeleteState)
|
|---|
| 3512 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| [1354] | 3513 | if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL))
|
|---|
| 3514 | WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL);
|
|---|
| 3515 | }
|
|---|
| [1335] | 3516 | }
|
|---|
| 3517 | fRestored = TRUE;
|
|---|
| 3518 | swp.hwnd = hwndDir;
|
|---|
| 3519 | TransformSwp(&swp, xtrans, ytrans);
|
|---|
| 3520 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
|---|
| 3521 | WinSetWindowPos(hwndDir,
|
|---|
| 3522 | HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);
|
|---|
| 3523 | WinSetWindowUShort(hwndDir, QWS_XRESTORE, (USHORT) swp.x);
|
|---|
| 3524 | WinSetWindowUShort(hwndDir, QWS_CXRESTORE, (USHORT) swp.cx);
|
|---|
| 3525 | WinSetWindowUShort(hwndDir, QWS_YRESTORE, (USHORT) swp.y);
|
|---|
| 3526 | WinSetWindowUShort(hwndDir, QWS_CYRESTORE, (USHORT) swp.cy);
|
|---|
| 3527 | } else
|
|---|
| 3528 | WinSetWindowPos(hwndDir,
|
|---|
| 3529 | HWND_TOP,
|
|---|
| 3530 | swp.x,
|
|---|
| 3531 | swp.y,
|
|---|
| 3532 | swp.cx,
|
|---|
| 3533 | swp.cy,
|
|---|
| 3534 | swp.fl | SWP_MOVE |
|
|---|
| 3535 | SWP_SIZE | SWP_SHOW | SWP_ZORDER |
|
|---|
| 3536 | SWP_ACTIVATE);
|
|---|
| 3537 | }
|
|---|
| 3538 | }
|
|---|
| [133] | 3539 | }
|
|---|
| [557] | 3540 | } // for
|
|---|
| [981] | 3541 | if (hwndPPSave) {
|
|---|
| [1326] | 3542 | SavePresParams(hwndPPSave, "DirCnr");
|
|---|
| 3543 | WinDestroyWindow(hwndPPSave);
|
|---|
| [981] | 3544 | }
|
|---|
| [133] | 3545 | }
|
|---|
| [558] | 3546 | return fRestored;
|
|---|
| [2] | 3547 | }
|
|---|
| 3548 |
|
|---|
| [178] | 3549 | static ULONG CountChildren(HWND hwndClient, ULONG * ulNumMinChildren)
|
|---|
| [133] | 3550 | {
|
|---|
| 3551 | HENUM henum;
|
|---|
| 3552 | HWND hwndChild;
|
|---|
| 3553 | SWP swp;
|
|---|
| 3554 | register ULONG ulCnt = 0L;
|
|---|
| 3555 | USHORT id;
|
|---|
| [2] | 3556 |
|
|---|
| [133] | 3557 | if (ulNumMinChildren)
|
|---|
| 3558 | *ulNumMinChildren = 0L;
|
|---|
| 3559 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| [551] | 3560 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| [133] | 3561 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
|---|
| 3562 | if (!id || (!fFreeTree && id == TREE_FRAME))
|
|---|
| 3563 | continue;
|
|---|
| 3564 | ulCnt++;
|
|---|
| [551] | 3565 | if (ulNumMinChildren) {
|
|---|
| 3566 | if (WinQueryWindowPos(hwndChild, &swp) && (swp.fl & SWP_MINIMIZE))
|
|---|
| [1335] | 3567 | (*ulNumMinChildren)++;
|
|---|
| [133] | 3568 | }
|
|---|
| 3569 | }
|
|---|
| 3570 | WinEndEnumWindows(henum);
|
|---|
| 3571 | return ulCnt;
|
|---|
| [2] | 3572 | }
|
|---|
| 3573 |
|
|---|
| [133] | 3574 | VOID GetNextWindowPos(HWND hwndClient, PSWP pswp, ULONG * ulCntR,
|
|---|
| [1335] | 3575 | ULONG * ulNumMinChildrenR)
|
|---|
| [133] | 3576 | {
|
|---|
| 3577 | register ULONG ulCnt;
|
|---|
| 3578 | ULONG ulNumMinChildren;
|
|---|
| 3579 | RECTL Rectl;
|
|---|
| 3580 | register ULONG ulXDiff, ulYDiff, ulWindowsPerStack;
|
|---|
| [2] | 3581 |
|
|---|
| [133] | 3582 | if (!ulCntR || !ulNumMinChildrenR)
|
|---|
| 3583 | ulCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
|---|
| [551] | 3584 | else {
|
|---|
| [133] | 3585 | ulCnt = *ulCntR;
|
|---|
| 3586 | ulNumMinChildren = *ulNumMinChildrenR;
|
|---|
| [787] | 3587 | if (ulCnt == (ULONG) - 1) {
|
|---|
| [133] | 3588 | ulCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
|---|
| 3589 | /* return these values to the caller for later use */
|
|---|
| 3590 | *ulCntR = ulCnt;
|
|---|
| 3591 | *ulNumMinChildrenR = ulNumMinChildren;
|
|---|
| 3592 | }
|
|---|
| 3593 | }
|
|---|
| 3594 | WinQueryWindowRect(hwndClient, &Rectl);
|
|---|
| 3595 | AdjustSizeOfClient(NULL, &Rectl);
|
|---|
| [551] | 3596 | if (!fFreeTree) {
|
|---|
| [2] | 3597 |
|
|---|
| [133] | 3598 | SWP swp;
|
|---|
| [2] | 3599 |
|
|---|
| [133] | 3600 | WinQueryWindowPos(hwndTree, &swp);
|
|---|
| 3601 | if (ulNumMinChildren || (swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
|---|
| 3602 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
|---|
| 3603 | }
|
|---|
| 3604 | else if (ulNumMinChildren)
|
|---|
| 3605 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
|---|
| [2] | 3606 |
|
|---|
| [133] | 3607 | ulXDiff = WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER) +
|
|---|
| 3608 | WinQuerySysValue(HWND_DESKTOP, SV_CXMINMAXBUTTON) / 2;
|
|---|
| 3609 | ulYDiff = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER) +
|
|---|
| 3610 | WinQuerySysValue(HWND_DESKTOP, SV_CYMINMAXBUTTON);
|
|---|
| 3611 | ulWindowsPerStack = (Rectl.yTop - Rectl.yBottom) / (3 * ulYDiff);
|
|---|
| [551] | 3612 | pswp->cx = Rectl.xRight - (ulWindowsPerStack * ulXDiff);
|
|---|
| 3613 | pswp->cy = (Rectl.yTop - Rectl.yBottom) - (ulWindowsPerStack * ulYDiff);
|
|---|
| [133] | 3614 | ulWindowsPerStack++;
|
|---|
| [551] | 3615 | pswp->x = Rectl.xLeft + ((ulCnt % ulWindowsPerStack) * ulXDiff);
|
|---|
| 3616 | pswp->y = (Rectl.yTop - pswp->cy - ((ulCnt % ulWindowsPerStack) * ulYDiff));
|
|---|
| [2] | 3617 | }
|
|---|
| 3618 |
|
|---|
| [178] | 3619 | static VOID CascadeChildren(HWND hwndClient)
|
|---|
| [133] | 3620 | {
|
|---|
| 3621 | ULONG ulCnt = 0L, ulNumMinChildren;
|
|---|
| 3622 | HWND hwndChild;
|
|---|
| 3623 | HENUM henum;
|
|---|
| 3624 | SWP swp;
|
|---|
| 3625 | USHORT id;
|
|---|
| 3626 | RECTL Rectl;
|
|---|
| [2] | 3627 |
|
|---|
| [133] | 3628 | WinQueryWindowPos(hwndClient, &swp);
|
|---|
| 3629 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
|---|
| 3630 | return;
|
|---|
| [2] | 3631 |
|
|---|
| [133] | 3632 | CountChildren(hwndClient, &ulNumMinChildren);
|
|---|
| [551] | 3633 | if (!fFreeTree) {
|
|---|
| [133] | 3634 | WinQueryWindowRect(hwndClient, &Rectl);
|
|---|
| 3635 | AdjustSizeOfClient(NULL, &Rectl);
|
|---|
| 3636 | WinQueryWindowPos(hwndTree, &swp);
|
|---|
| [551] | 3637 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
|---|
| [133] | 3638 | if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
|
|---|
| [1335] | 3639 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
|---|
| [133] | 3640 | if (swp.x != 0)
|
|---|
| [1335] | 3641 | swp.x = 0;
|
|---|
| [133] | 3642 | if (swp.y < 0)
|
|---|
| [1335] | 3643 | swp.y = 0;
|
|---|
| [133] | 3644 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
|---|
| [1335] | 3645 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
|---|
| [133] | 3646 | WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
|---|
| [1335] | 3647 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
|---|
| [133] | 3648 | }
|
|---|
| 3649 | }
|
|---|
| 3650 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| [551] | 3651 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| [133] | 3652 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
|---|
| 3653 | if (!id || (!fFreeTree && id == TREE_FRAME))
|
|---|
| 3654 | continue;
|
|---|
| 3655 | WinQueryWindowPos(hwndChild, &swp);
|
|---|
| [551] | 3656 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE))) {
|
|---|
| [133] | 3657 | GetNextWindowPos(hwndClient, &swp, &ulCnt, &ulNumMinChildren);
|
|---|
| 3658 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
|---|
| [1335] | 3659 | SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE |
|
|---|
| 3660 | SWP_ZORDER | SWP_ACTIVATE);
|
|---|
| [133] | 3661 | ulCnt++;
|
|---|
| 3662 | }
|
|---|
| 3663 | }
|
|---|
| 3664 | WinEndEnumWindows(henum);
|
|---|
| [2] | 3665 | }
|
|---|
| 3666 |
|
|---|
| [133] | 3667 | VOID TileChildren(HWND hwndClient, BOOL absolute)
|
|---|
| 3668 | {
|
|---|
| 3669 | register ULONG ulChildCnt, ulSquare, ulNumRows, ulNumCols, ulExtraCols,
|
|---|
| [551] | 3670 | ulWidth, ulHeight;
|
|---|
| [133] | 3671 | ULONG ulNumMinChildren;
|
|---|
| 3672 | RECTL Rectl;
|
|---|
| 3673 | HWND hwndChild;
|
|---|
| [2] | 3674 |
|
|---|
| [133] | 3675 | if (fNoTileUpdate || hwndClient == HWND_DESKTOP)
|
|---|
| 3676 | return;
|
|---|
| 3677 | {
|
|---|
| 3678 | SWP swp;
|
|---|
| [2] | 3679 |
|
|---|
| [133] | 3680 | WinQueryWindowPos(hwndClient, &swp);
|
|---|
| 3681 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
|---|
| 3682 | return;
|
|---|
| 3683 | }
|
|---|
| [551] | 3684 | ulChildCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
|---|
| [133] | 3685 | ulChildCnt -= ulNumMinChildren;
|
|---|
| 3686 | if (!ulChildCnt)
|
|---|
| 3687 | return;
|
|---|
| [2] | 3688 |
|
|---|
| [133] | 3689 | fNoTileUpdate = TRUE;
|
|---|
| [2] | 3690 |
|
|---|
| [551] | 3691 | for (ulSquare = 2; ulSquare * ulSquare <= ulChildCnt; ulSquare++) {
|
|---|
| [133] | 3692 | ;
|
|---|
| [200] | 3693 | }
|
|---|
| [551] | 3694 | if (!fTileBackwards) {
|
|---|
| [787] | 3695 | ulNumCols = ulSquare - 1;
|
|---|
| [133] | 3696 | ulNumRows = ulChildCnt / ulNumCols;
|
|---|
| 3697 | }
|
|---|
| [551] | 3698 | else {
|
|---|
| [787] | 3699 | ulNumRows = ulSquare - 1;
|
|---|
| [133] | 3700 | ulNumCols = ulChildCnt / ulNumRows;
|
|---|
| 3701 | }
|
|---|
| 3702 | ulExtraCols = ulChildCnt % ulNumCols;
|
|---|
| [2] | 3703 |
|
|---|
| [551] | 3704 | WinQueryWindowRect(hwndClient, &Rectl);
|
|---|
| [2] | 3705 |
|
|---|
| [551] | 3706 | if (!fFreeTree) {
|
|---|
| [2] | 3707 |
|
|---|
| [133] | 3708 | SWP swp;
|
|---|
| [2] | 3709 |
|
|---|
| [133] | 3710 | WinQueryWindowPos(hwndTree, &swp);
|
|---|
| [551] | 3711 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
|---|
| [133] | 3712 | if (swp.y < 0)
|
|---|
| [1335] | 3713 | swp.y = 0;
|
|---|
| [133] | 3714 | if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
|
|---|
| [1335] | 3715 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
|---|
| [133] | 3716 | if (swp.x != 0)
|
|---|
| [1335] | 3717 | swp.x = 0;
|
|---|
| [133] | 3718 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
|---|
| [1335] | 3719 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
|---|
| [2] | 3720 | WinSetWindowPos(hwndTree,
|
|---|
| [1335] | 3721 | HWND_TOP,
|
|---|
| 3722 | swp.x,
|
|---|
| 3723 | swp.y,
|
|---|
| 3724 | swp.cx,
|
|---|
| 3725 | swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
|---|
| [133] | 3726 | WinQueryWindowPos(hwndTree, &swp);
|
|---|
| 3727 | }
|
|---|
| [551] | 3728 | if (ulNumMinChildren || (swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
|---|
| [133] | 3729 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
|---|
| 3730 | }
|
|---|
| 3731 | else if (ulNumMinChildren)
|
|---|
| 3732 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
|---|
| [2] | 3733 |
|
|---|
| [551] | 3734 | AdjustSizeOfClient(NULL, &Rectl);
|
|---|
| [2] | 3735 |
|
|---|
| [551] | 3736 | if (Rectl.xRight > 0L && (Rectl.yBottom < Rectl.yTop)) {
|
|---|
| [2] | 3737 |
|
|---|
| [133] | 3738 | HENUM henum;
|
|---|
| [2] | 3739 |
|
|---|
| [133] | 3740 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| [551] | 3741 | if ((hwndChild = WinGetNextWindow(henum)) != (HWND) 0) {
|
|---|
| [2] | 3742 |
|
|---|
| [133] | 3743 | ULONG ulCurRow, ulCurCol;
|
|---|
| 3744 | SWP swp;
|
|---|
| 3745 | USHORT id;
|
|---|
| [2] | 3746 |
|
|---|
| [133] | 3747 | ulHeight = (Rectl.yTop - Rectl.yBottom) / ulNumRows;
|
|---|
| [2] | 3748 |
|
|---|
| [551] | 3749 | for (ulCurRow = 0; ulCurRow < ulNumRows; ulCurRow++) {
|
|---|
| [1335] | 3750 | if ((ulNumRows - ulCurRow) <= ulExtraCols)
|
|---|
| 3751 | ulNumCols++;
|
|---|
| 3752 | for (ulCurCol = 0; ulCurCol < ulNumCols; ulCurCol++) {
|
|---|
| 3753 | ulWidth = Rectl.xRight / ulNumCols;
|
|---|
| [2] | 3754 |
|
|---|
| [1335] | 3755 | while (hwndChild) {
|
|---|
| 3756 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
|---|
| 3757 | if (id && (id != TREE_FRAME || fFreeTree)) {
|
|---|
| 3758 | WinQueryWindowPos(hwndChild, &swp);
|
|---|
| 3759 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
|---|
| 3760 | break;
|
|---|
| 3761 | }
|
|---|
| 3762 | hwndChild = WinGetNextWindow(henum);
|
|---|
| 3763 | }
|
|---|
| [2] | 3764 |
|
|---|
| [1335] | 3765 | if (hwndChild) {
|
|---|
| 3766 | if (!absolute && (swp.fl & SWP_MAXIMIZE)) {
|
|---|
| 3767 | WinGetMaxPosition(hwndChild, &swp);
|
|---|
| 3768 | WinSetWindowPos(hwndChild,
|
|---|
| 3769 | HWND_TOP,
|
|---|
| 3770 | swp.x,
|
|---|
| 3771 | swp.y,
|
|---|
| 3772 | swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
|---|
| 3773 | WinSetWindowUShort(hwndChild,
|
|---|
| 3774 | QWS_XRESTORE,
|
|---|
| 3775 | (USHORT) (ulWidth * ulCurCol) + Rectl.xLeft);
|
|---|
| 3776 | WinSetWindowUShort(hwndChild,
|
|---|
| 3777 | QWS_YRESTORE,
|
|---|
| 3778 | (USHORT) (Rectl.yTop -
|
|---|
| 3779 | (ulHeight * (ulCurRow + 1))));
|
|---|
| 3780 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth);
|
|---|
| 3781 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight);
|
|---|
| 3782 | }
|
|---|
| 3783 | else
|
|---|
| 3784 | WinSetWindowPos(hwndChild,
|
|---|
| 3785 | HWND_TOP,
|
|---|
| 3786 | (ulWidth * ulCurCol) + Rectl.xLeft,
|
|---|
| 3787 | Rectl.yTop - (ulHeight * (ulCurRow + 1)),
|
|---|
| 3788 | ulWidth,
|
|---|
| 3789 | ulHeight,
|
|---|
| 3790 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
|---|
| 3791 | hwndChild = WinGetNextWindow(henum);
|
|---|
| 3792 | }
|
|---|
| 3793 | }
|
|---|
| 3794 | if ((ulNumRows - ulCurRow) <= ulExtraCols) {
|
|---|
| 3795 | ulNumCols--;
|
|---|
| 3796 | ulExtraCols--;
|
|---|
| 3797 | }
|
|---|
| [133] | 3798 | }
|
|---|
| 3799 | }
|
|---|
| 3800 | WinEndEnumWindows(henum);
|
|---|
| 3801 | }
|
|---|
| [2] | 3802 |
|
|---|
| [133] | 3803 | fNoTileUpdate = FALSE;
|
|---|
| [2] | 3804 | }
|
|---|
| 3805 |
|
|---|
| [551] | 3806 | static VOID ResizeChildren(HWND hwndClient, SHORT oldcx, SHORT oldcy,
|
|---|
| [1335] | 3807 | SHORT newcx, SHORT newcy)
|
|---|
| [133] | 3808 | {
|
|---|
| 3809 | /*
|
|---|
| 3810 | * resize all children of the client to maintain their proportional
|
|---|
| 3811 | * sizes and positions
|
|---|
| 3812 | */
|
|---|
| [2] | 3813 |
|
|---|
| [551] | 3814 | if (!newcx || !newcy || !oldcx || !oldcy)
|
|---|
| [133] | 3815 | return;
|
|---|
| 3816 | {
|
|---|
| 3817 | HENUM henum;
|
|---|
| 3818 | HWND hwndChild;
|
|---|
| 3819 | register LONG x, y, cx, cy, ucx, ucy, ux, uy;
|
|---|
| 3820 | SWP swp;
|
|---|
| [2] | 3821 |
|
|---|
| [133] | 3822 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| [551] | 3823 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| [133] | 3824 | if (!WinQueryWindowUShort(hwndChild, QWS_ID))
|
|---|
| [1335] | 3825 | continue;
|
|---|
| [551] | 3826 | if (WinQueryWindowPos(hwndChild, &swp)) {
|
|---|
| [1335] | 3827 | if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {
|
|---|
| 3828 | swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);
|
|---|
| 3829 | swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);
|
|---|
| 3830 | swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);
|
|---|
| 3831 | swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);
|
|---|
| 3832 | }
|
|---|
| 3833 | else if (swp.fl & SWP_MAXIMIZE) {
|
|---|
| 3834 | swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);
|
|---|
| 3835 | swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);
|
|---|
| 3836 | swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);
|
|---|
| 3837 | swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);
|
|---|
| 3838 | }
|
|---|
| 3839 | cx = (swp.cx) ? (LONG) (((double)oldcx * 100.0) / (double)swp.cx) : 0;
|
|---|
| 3840 | cy = (swp.cy) ? (LONG) (((double)oldcy * 100.0) / (double)swp.cy) : 0;
|
|---|
| 3841 | x = (swp.x) ? (LONG) (((double)oldcx * 100.0) / (double)swp.x) : 0;
|
|---|
| 3842 | y = (swp.y) ? (LONG) (((double)oldcy * 100.0) / (double)swp.y) : 0;
|
|---|
| 3843 | if (x < 0)
|
|---|
| 3844 | x = 0;
|
|---|
| 3845 | if (y < 0)
|
|---|
| 3846 | y = 0;
|
|---|
| 3847 | ux = (x) ? (LONG) (((double)newcx * 100.0) / (double)x) : 0;
|
|---|
| 3848 | uy = (y) ? (LONG) (((double)newcy * 100.0) / (double)y) : 0;
|
|---|
| 3849 | ucx = (cx) ? (LONG) (((double)newcx * 100.0) / (double)cx) : 0;
|
|---|
| 3850 | ucy = (cy) ? (LONG) (((double)newcy * 100.0) / (double)cy) : 0;
|
|---|
| 3851 | if (ux + ucx > newcx)
|
|---|
| 3852 | ucx = newcx - ux;
|
|---|
| 3853 | if (uy + ucy > newcy)
|
|---|
| 3854 | ucy = newcy - uy;
|
|---|
| [2] | 3855 |
|
|---|
| [1335] | 3856 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)))
|
|---|
| 3857 | WinSetWindowPos(hwndChild, HWND_TOP, ux, uy, ucx, ucy,
|
|---|
| 3858 | SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
|---|
| 3859 | else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
|---|
| 3860 | WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1);
|
|---|
| 3861 | WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);
|
|---|
| 3862 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,
|
|---|
| 3863 | SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE);
|
|---|
| 3864 | WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);
|
|---|
| 3865 | WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);
|
|---|
| 3866 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);
|
|---|
| 3867 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);
|
|---|
| 3868 | }
|
|---|
| 3869 | else {
|
|---|
| 3870 | WinGetMaxPosition(hwndChild, &swp);
|
|---|
| 3871 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
|---|
| 3872 | SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
|---|
| 3873 | WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);
|
|---|
| 3874 | WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);
|
|---|
| 3875 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);
|
|---|
| 3876 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);
|
|---|
| 3877 | }
|
|---|
| [133] | 3878 | }
|
|---|
| 3879 | }
|
|---|
| 3880 | WinEndEnumWindows(henum);
|
|---|
| 3881 | }
|
|---|
| [551] | 3882 | if (!fFreeTree) {
|
|---|
| [2] | 3883 |
|
|---|
| [133] | 3884 | RECTL Rectl;
|
|---|
| 3885 | SWP swp;
|
|---|
| [2] | 3886 |
|
|---|
| [133] | 3887 | WinQueryWindowRect(hwndClient, &Rectl);
|
|---|
| 3888 | AdjustSizeOfClient(NULL, &Rectl);
|
|---|
| 3889 | WinQueryWindowPos(hwndTree, &swp);
|
|---|
| [551] | 3890 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
|---|
| [954] | 3891 |
|
|---|
| 3892 | if (!fNoTreeGap) {
|
|---|
| [1335] | 3893 | INT height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
|---|
| 3894 | if (swp.y < height)
|
|---|
| 3895 | swp.y = height; // Force bottom to position
|
|---|
| [954] | 3896 | }
|
|---|
| 3897 | else
|
|---|
| [1335] | 3898 | swp.y = 0; // Force bottom to position
|
|---|
| [954] | 3899 |
|
|---|
| 3900 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
|---|
| 3901 | if (swp.cy < 0)
|
|---|
| [1335] | 3902 | swp.cy = 0;
|
|---|
| [954] | 3903 |
|
|---|
| [133] | 3904 | if (swp.x != 0)
|
|---|
| [1335] | 3905 | swp.x = 0; // Left align
|
|---|
| [954] | 3906 |
|
|---|
| 3907 | // AdjustSizeOfClient can return bogus xRight values - fixme someday
|
|---|
| 3908 | if (Rectl.xRight >= Rectl.xLeft) {
|
|---|
| [1335] | 3909 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
|---|
| 3910 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
|---|
| [954] | 3911 | }
|
|---|
| [133] | 3912 | WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
|---|
| [1335] | 3913 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
|---|
| [133] | 3914 | }
|
|---|
| 3915 | }
|
|---|
| [2] | 3916 | }
|
|---|
| 3917 |
|
|---|
| [178] | 3918 | static VOID MinResChildren(HWND hwndClient, ULONG cmd)
|
|---|
| [133] | 3919 | {
|
|---|
| 3920 | HENUM henum;
|
|---|
| 3921 | HWND hwndChild;
|
|---|
| [2] | 3922 |
|
|---|
| [133] | 3923 | {
|
|---|
| 3924 | SWP swp;
|
|---|
| [2] | 3925 |
|
|---|
| [133] | 3926 | WinQueryWindowPos(hwndClient, &swp);
|
|---|
| 3927 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
|---|
| 3928 | return;
|
|---|
| 3929 | }
|
|---|
| 3930 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| [551] | 3931 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| [133] | 3932 | if (!WinQueryWindowUShort(hwndChild, QWS_ID))
|
|---|
| 3933 | continue;
|
|---|
| 3934 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, cmd);
|
|---|
| 3935 | }
|
|---|
| [2] | 3936 | }
|
|---|
| 3937 |
|
|---|
| [178] | 3938 | //=== ChildFrameButtonProc: subclass handler for WALKBUTTON and QUICKBUTTON windows ===
|
|---|
| 3939 |
|
|---|
| 3940 | static MRESULT EXPENTRY ChildFrameButtonProc(HWND hwnd,
|
|---|
| [1335] | 3941 | ULONG msg,
|
|---|
| 3942 | MPARAM mp1, MPARAM mp2)
|
|---|
| [133] | 3943 | {
|
|---|
| 3944 | USHORT id;
|
|---|
| 3945 | static BOOL emphasized = FALSE;
|
|---|
| [2] | 3946 |
|
|---|
| [551] | 3947 | switch (msg) {
|
|---|
| [133] | 3948 | case WM_BUTTON1CLICK:
|
|---|
| 3949 | case WM_CHORD:
|
|---|
| 3950 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 3951 | break;
|
|---|
| [2] | 3952 |
|
|---|
| [133] | 3953 | case WM_MOUSEMOVE:
|
|---|
| [551] | 3954 | if (fOtherHelp) {
|
|---|
| 3955 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
|---|
| [1335] | 3956 | && !WinQueryCapture(HWND_DESKTOP)) {
|
|---|
| 3957 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 3958 | switch (id) {
|
|---|
| 3959 | case IDM_OPENWALK:
|
|---|
| 3960 | MakeBubble(hwnd, FALSE, GetPString(IDS_WALKBUTTONHELP));
|
|---|
| 3961 | break;
|
|---|
| 3962 | case IDM_USERLIST:
|
|---|
| 3963 | MakeBubble(hwnd, FALSE, GetPString(IDS_QUICKBUTTONHELP));
|
|---|
| 3964 | break;
|
|---|
| 3965 | }
|
|---|
| [133] | 3966 | }
|
|---|
| 3967 | }
|
|---|
| 3968 | break;
|
|---|
| [2] | 3969 |
|
|---|
| [133] | 3970 | case WM_BUTTON3CLICK:
|
|---|
| 3971 | case WM_BUTTON2CLICK:
|
|---|
| 3972 | {
|
|---|
| 3973 | USHORT cmd = 0;
|
|---|
| [2] | 3974 |
|
|---|
| [133] | 3975 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 3976 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [551] | 3977 | switch (id) {
|
|---|
| [133] | 3978 | case IDM_OPENWALK:
|
|---|
| [1335] | 3979 | switch (msg) {
|
|---|
| 3980 | case WM_BUTTON2CLICK:
|
|---|
| 3981 | if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
|
|---|
| 3982 | (KC_ALT | KC_SHIFT | KC_CTRL))
|
|---|
| 3983 | cmd = IDM_GREP;
|
|---|
| 3984 | else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))
|
|---|
| 3985 | CascadeChildren(hwndMain);
|
|---|
| [2] | 3986 |
|
|---|
| 3987 | #ifdef NEVER
|
|---|
| [1335] | 3988 | else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))
|
|---|
| 3989 | cmd = IDM_SYSINFO;
|
|---|
| [2] | 3990 | #endif
|
|---|
| [133] | 3991 |
|
|---|
| [1335] | 3992 | else if (shiftstate & KC_SHIFT)
|
|---|
| 3993 | cmd = IDM_WINDOWDLG;
|
|---|
| 3994 | else if (shiftstate & KC_CTRL)
|
|---|
| 3995 | cmd = IDM_SEEALL;
|
|---|
| 3996 | else if (shiftstate & KC_ALT)
|
|---|
| 3997 | TileChildren(hwndMain, TRUE);
|
|---|
| 3998 | else
|
|---|
| 3999 | cmd = IDM_WALKDIR;
|
|---|
| 4000 | break;
|
|---|
| 4001 | case WM_BUTTON3CLICK:
|
|---|
| 4002 | TileChildren(hwndMain, TRUE);
|
|---|
| 4003 | break;
|
|---|
| 4004 | }
|
|---|
| 4005 | break;
|
|---|
| [133] | 4006 | case IDM_USERLIST:
|
|---|
| [1335] | 4007 | switch (msg) {
|
|---|
| 4008 | case WM_BUTTON2CLICK:
|
|---|
| 4009 | if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
|
|---|
| 4010 | (KC_ALT | KC_SHIFT | KC_CTRL))
|
|---|
| 4011 | cmd = IDM_COLORPALETTE;
|
|---|
| 4012 | else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))
|
|---|
| 4013 | cmd = IDM_HIDEMENU;
|
|---|
| 4014 | else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))
|
|---|
| 4015 | cmd = IDM_NOTEBOOK;
|
|---|
| 4016 | else if (shiftstate & KC_SHIFT)
|
|---|
| 4017 | cmd = IDM_TOOLTITLES;
|
|---|
| 4018 | else if (shiftstate & KC_CTRL)
|
|---|
| 4019 | cmd = IDM_TEXTTOOLS;
|
|---|
| 4020 | else if (shiftstate & KC_ALT)
|
|---|
| 4021 | cmd = IDM_FONTPALETTE;
|
|---|
| 4022 | else
|
|---|
| 4023 | cmd = IDM_TOOLBAR;
|
|---|
| 4024 | break;
|
|---|
| 4025 | case WM_BUTTON3CLICK:
|
|---|
| 4026 | cmd = IDM_DRIVEBAR;
|
|---|
| 4027 | break;
|
|---|
| 4028 | }
|
|---|
| 4029 | break;
|
|---|
| [930] | 4030 | } // switch id
|
|---|
| [200] | 4031 |
|
|---|
| [551] | 4032 | if (cmd) {
|
|---|
| [1335] | 4033 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_CLIENT),
|
|---|
| 4034 | WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
|
|---|
| [200] | 4035 | }
|
|---|
| [133] | 4036 | }
|
|---|
| 4037 | break;
|
|---|
| [2] | 4038 |
|
|---|
| [133] | 4039 | case DM_DRAGOVER:
|
|---|
| 4040 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| [551] | 4041 | if (id == IDM_OPENWALK) {
|
|---|
| 4042 | if (!emphasized) {
|
|---|
| [1335] | 4043 | emphasized = TRUE;
|
|---|
| 4044 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| [133] | 4045 | }
|
|---|
| [618] | 4046 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
|---|
| [1335] | 4047 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
|---|
| [133] | 4048 | }
|
|---|
| 4049 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
|---|
| [2] | 4050 |
|
|---|
| [133] | 4051 | case DM_DRAGLEAVE:
|
|---|
| [551] | 4052 | if (emphasized) {
|
|---|
| [133] | 4053 | emphasized = FALSE;
|
|---|
| 4054 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| 4055 | }
|
|---|
| 4056 | break;
|
|---|
| [2] | 4057 |
|
|---|
| [133] | 4058 | case DM_DROPHELP:
|
|---|
| 4059 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_OPENDROPHELP));
|
|---|
| 4060 | return 0;
|
|---|
| [2] | 4061 |
|
|---|
| [133] | 4062 | case DM_DROP:
|
|---|
| 4063 | {
|
|---|
| 4064 | char szFrom[CCHMAXPATH + 2];
|
|---|
| [2] | 4065 |
|
|---|
| [551] | 4066 | if (emphasized) {
|
|---|
| [1335] | 4067 | emphasized = FALSE;
|
|---|
| 4068 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| [133] | 4069 | }
|
|---|
| [618] | 4070 | if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
|
|---|
| [1335] | 4071 | if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) {
|
|---|
| 4072 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom);
|
|---|
| 4073 | }
|
|---|
| [133] | 4074 | }
|
|---|
| 4075 | }
|
|---|
| 4076 | return 0;
|
|---|
| [2] | 4077 |
|
|---|
| [133] | 4078 | case WM_CLOSE:
|
|---|
| 4079 | WinDestroyWindow(hwnd);
|
|---|
| 4080 | return 0;
|
|---|
| 4081 | }
|
|---|
| 4082 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 4083 | }
|
|---|
| 4084 |
|
|---|
| [551] | 4085 | static MRESULT EXPENTRY MainFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
|---|
| [1335] | 4086 | MPARAM mp2)
|
|---|
| [133] | 4087 | {
|
|---|
| 4088 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
|---|
| 4089 | static ULONG aheight = 0L;
|
|---|
| [2] | 4090 |
|
|---|
| [551] | 4091 | switch (msg) {
|
|---|
| [133] | 4092 | case WM_ADJUSTWINDOWPOS:
|
|---|
| 4093 | {
|
|---|
| 4094 | SWP *pswp;
|
|---|
| [2] | 4095 |
|
|---|
| [133] | 4096 | pswp = (SWP *) mp1;
|
|---|
| [551] | 4097 | if (fDataMin && !fAmClosing) {
|
|---|
| [1335] | 4098 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
|---|
| [2] | 4099 |
|
|---|
| [1335] | 4100 | SWP swp;
|
|---|
| [2] | 4101 |
|
|---|
| [1335] | 4102 | WinQueryWindowPos(hwnd, &swp);
|
|---|
| 4103 | PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID);
|
|---|
| 4104 | HideNote();
|
|---|
| 4105 | }
|
|---|
| 4106 | else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) {
|
|---|
| 4107 | if (DataHwnd)
|
|---|
| 4108 | PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID);
|
|---|
| 4109 | }
|
|---|
| [133] | 4110 | }
|
|---|
| [551] | 4111 | if (!fAmClosing) {
|
|---|
| [1335] | 4112 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE))
|
|---|
| 4113 | HideNote();
|
|---|
| [133] | 4114 | }
|
|---|
| 4115 | }
|
|---|
| 4116 | break;
|
|---|
| [2] | 4117 |
|
|---|
| [133] | 4118 | case UM_FOCUSME:
|
|---|
| 4119 | CreateDataBar(HWND_DESKTOP, (ULONG) mp1);
|
|---|
| 4120 | return 0;
|
|---|
| [2] | 4121 |
|
|---|
| [133] | 4122 | case WM_BUTTON1UP:
|
|---|
| 4123 | case WM_BUTTON2UP:
|
|---|
| 4124 | case WM_BUTTON3UP:
|
|---|
| 4125 | case WM_MOUSEMOVE:
|
|---|
| 4126 | case WM_CHORD:
|
|---|
| 4127 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 4128 | break;
|
|---|
| [2] | 4129 |
|
|---|
| [133] | 4130 | case WM_CHAR:
|
|---|
| 4131 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
|---|
| 4132 | break;
|
|---|
| [2] | 4133 |
|
|---|
| [133] | 4134 | case WM_CONTROL:
|
|---|
| [551] | 4135 | return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_CONTROL, mp1,
|
|---|
| [1335] | 4136 | mp2);
|
|---|
| [2] | 4137 |
|
|---|
| [133] | 4138 | case WM_COMMAND:
|
|---|
| 4139 | return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
|
|---|
| [2] | 4140 |
|
|---|
| [133] | 4141 | case WM_CALCFRAMERECT:
|
|---|
| 4142 | {
|
|---|
| 4143 | MRESULT mr;
|
|---|
| 4144 | PRECTL prectl;
|
|---|
| 4145 | LONG sheight = 20, bheight = 20;
|
|---|
| [2] | 4146 |
|
|---|
| [133] | 4147 | mr = oldproc(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 4148 |
|
|---|
| [133] | 4149 | /*
|
|---|
| 4150 | * Calculate the position of the client rectangle.
|
|---|
| [178] | 4151 | * Otherwise, we'll see a lot of redraw when we move the
|
|---|
| [133] | 4152 | * client during WM_FORMATFRAME.
|
|---|
| 4153 | */
|
|---|
| [2] | 4154 |
|
|---|
| [551] | 4155 | if (mr && mp2) {
|
|---|
| [1335] | 4156 | prectl = (PRECTL) mp1;
|
|---|
| 4157 | if (prectl->yBottom != prectl->yTop) {
|
|---|
| 4158 | {
|
|---|
| 4159 | HPS hps;
|
|---|
| 4160 | POINTL aptl[TXTBOX_COUNT];
|
|---|
| [2] | 4161 |
|
|---|
| [1335] | 4162 | hps = WinGetPS(hwndStatus);
|
|---|
| 4163 | if (hps) {
|
|---|
| 4164 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
|---|
| 4165 | bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
|---|
| 4166 | WinReleasePS(hps);
|
|---|
| 4167 | }
|
|---|
| 4168 | }
|
|---|
| 4169 | prectl->yBottom += (sheight + 4);
|
|---|
| 4170 | prectl->yTop -= (sheight + 4);
|
|---|
| 4171 | if (fMoreButtons) {
|
|---|
| [2] | 4172 |
|
|---|
| [1335] | 4173 | HPS hps;
|
|---|
| 4174 | POINTL aptl[TXTBOX_COUNT];
|
|---|
| [2] | 4175 |
|
|---|
| [1335] | 4176 | hps = WinGetPS(hwndName);
|
|---|
| 4177 | if (hps) {
|
|---|
| 4178 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
|---|
| 4179 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
|---|
| 4180 | WinReleasePS(hps);
|
|---|
| 4181 | }
|
|---|
| 4182 | prectl->yBottom += (bheight + 4);
|
|---|
| 4183 | prectl->yTop -= (bheight + 4);
|
|---|
| 4184 | }
|
|---|
| 4185 | if (fToolbar) {
|
|---|
| 4186 | if (!fTextTools)
|
|---|
| 4187 | prectl->yTop -= ((fToolTitles) ? 50 : 40);
|
|---|
| 4188 | else
|
|---|
| 4189 | prectl->yTop -= 32;
|
|---|
| 4190 | }
|
|---|
| 4191 | if (fDrivebar) {
|
|---|
| 4192 | ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES),
|
|---|
| 4193 | ((prectl->xRight -
|
|---|
| 4194 | (WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 4195 | SV_CYSIZEBORDER) * 2)) - 4));
|
|---|
| 4196 | prectl->yTop -= (16 * (DriveLines * 18));
|
|---|
| 4197 | }
|
|---|
| 4198 | if (fUserComboBox) {
|
|---|
| 4199 | if (!aheight) {
|
|---|
| [2] | 4200 |
|
|---|
| [1335] | 4201 | SWP swpTemp;
|
|---|
| [2] | 4202 |
|
|---|
| [1335] | 4203 | WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
|---|
| 4204 | &swpTemp);
|
|---|
| 4205 | aheight = swpTemp.cy;
|
|---|
| 4206 | }
|
|---|
| 4207 | prectl->yTop -= (aheight + 6L);
|
|---|
| 4208 | }
|
|---|
| 4209 | if (fAutoView) {
|
|---|
| 4210 | AutoviewHeight = min(AutoviewHeight,
|
|---|
| 4211 | (prectl->yTop - prectl->yBottom) - 116);
|
|---|
| 4212 | AutoviewHeight = max(AutoviewHeight, 36);
|
|---|
| 4213 | prectl->yBottom += (AutoviewHeight + 6);
|
|---|
| 4214 | }
|
|---|
| 4215 | }
|
|---|
| [133] | 4216 | }
|
|---|
| 4217 | return mr;
|
|---|
| 4218 | }
|
|---|
| [2] | 4219 |
|
|---|
| [133] | 4220 | case WM_FORMATFRAME:
|
|---|
| 4221 | {
|
|---|
| 4222 | SHORT sCount, soldCount;
|
|---|
| 4223 | PSWP pswp, pswpClient, pswpNew;
|
|---|
| 4224 | SWP swpClient;
|
|---|
| 4225 | LONG theight = 48L, dheight = 20L, width, sheight = 20, bheight = 20;
|
|---|
| [2] | 4226 |
|
|---|
| [133] | 4227 | sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
|
|---|
| 4228 | soldCount = sCount;
|
|---|
| [2] | 4229 |
|
|---|
| [133] | 4230 | /*
|
|---|
| 4231 | * Reformat the frame to "squeeze" the client
|
|---|
| 4232 | * and make room for status window sibling beneath
|
|---|
| 4233 | * and toolbar above (if toolbar's on) and userlists
|
|---|
| 4234 | * (if userlists are on).
|
|---|
| 4235 | */
|
|---|
| [2] | 4236 |
|
|---|
| [133] | 4237 | pswp = (PSWP) mp1;
|
|---|
| 4238 | {
|
|---|
| [1335] | 4239 | SHORT x;
|
|---|
| [2] | 4240 |
|
|---|
| [1335] | 4241 | for (x = 0; x < soldCount; x++) {
|
|---|
| 4242 | if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {
|
|---|
| 4243 | pswpClient = pswp;
|
|---|
| 4244 | break;
|
|---|
| 4245 | }
|
|---|
| 4246 | pswp++;
|
|---|
| 4247 | }
|
|---|
| [133] | 4248 | }
|
|---|
| [2] | 4249 |
|
|---|
| [133] | 4250 | {
|
|---|
| [1335] | 4251 | HPS hps;
|
|---|
| 4252 | POINTL aptl[TXTBOX_COUNT];
|
|---|
| [2] | 4253 |
|
|---|
| [1335] | 4254 | hps = WinGetPS(hwndStatus);
|
|---|
| 4255 | if (hps) {
|
|---|
| 4256 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
|---|
| 4257 | bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
|---|
| 4258 | WinReleasePS(hps);
|
|---|
| 4259 | }
|
|---|
| 4260 | if (fMoreButtons) {
|
|---|
| 4261 | hps = WinGetPS(hwndName);
|
|---|
| 4262 | if (hps) {
|
|---|
| 4263 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
|---|
| 4264 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
|---|
| 4265 | WinReleasePS(hps);
|
|---|
| 4266 | }
|
|---|
| 4267 | }
|
|---|
| [133] | 4268 | }
|
|---|
| 4269 | pswpNew = (PSWP) mp1 + soldCount;
|
|---|
| 4270 | *pswpNew = *pswpClient;
|
|---|
| 4271 | swpClient = *pswpClient;
|
|---|
| [551] | 4272 | pswpNew->hwnd = hwndStatus;
|
|---|
| 4273 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
|---|
| 4274 | pswpNew->x = swpClient.x + 3;
|
|---|
| 4275 | pswpNew->y = swpClient.y + 2;
|
|---|
| [133] | 4276 | if (!fSplitStatus)
|
|---|
| [1335] | 4277 | width = swpClient.cx - (16 + (sheight * 2) + 4);
|
|---|
| [133] | 4278 | else
|
|---|
| [1335] | 4279 | width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2;
|
|---|
| [133] | 4280 | width = max(width, 10);
|
|---|
| 4281 | if (fSplitStatus)
|
|---|
| [1335] | 4282 | pswpNew->cx = width - 6;
|
|---|
| [133] | 4283 | else
|
|---|
| [1335] | 4284 | pswpNew->cx = width - 8;
|
|---|
| [551] | 4285 | pswpNew->cy = sheight;
|
|---|
| 4286 | pswpClient->y = pswpNew->y + pswpNew->cy + 3;
|
|---|
| 4287 | pswpClient->cy = (swpClient.cy - pswpNew->cy) - 3;
|
|---|
| [133] | 4288 | sCount++;
|
|---|
| [2] | 4289 |
|
|---|
| [551] | 4290 | if (fSplitStatus) {
|
|---|
| [1335] | 4291 | pswpNew = (PSWP) mp1 + (soldCount + 1);
|
|---|
| 4292 | *pswpNew = *pswpClient;
|
|---|
| 4293 | pswpNew->hwnd = hwndStatus2;
|
|---|
| 4294 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
|---|
| 4295 | pswpNew->x = width + 8;
|
|---|
| 4296 | pswpNew->y = swpClient.y + 2;
|
|---|
| 4297 | pswpNew->cx = width - 6;
|
|---|
| 4298 | pswpNew->cy = sheight;
|
|---|
| 4299 | sCount++;
|
|---|
| [133] | 4300 | }
|
|---|
| [551] | 4301 | else {
|
|---|
| [1335] | 4302 | WinShowWindow(hwndStatus2, FALSE);
|
|---|
| 4303 | WinSetWindowText(hwndStatus2, NullStr);
|
|---|
| [133] | 4304 | }
|
|---|
| [2] | 4305 |
|
|---|
| [551] | 4306 | if (fToolbar) {
|
|---|
| [1335] | 4307 | if (fTextTools)
|
|---|
| 4308 | theight = 32L;
|
|---|
| 4309 | else if (!fToolTitles)
|
|---|
| 4310 | theight = 40L;
|
|---|
| 4311 | pswpNew = (PSWP) mp1 + (soldCount + 1 + (fSplitStatus != FALSE));
|
|---|
| 4312 | *pswpNew = *pswpClient;
|
|---|
| 4313 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS);
|
|---|
| 4314 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
|---|
| 4315 | pswpNew->x = swpClient.x + 2;
|
|---|
| 4316 | pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2);
|
|---|
| 4317 | pswpNew->cx = swpClient.cx - 4;
|
|---|
| 4318 | pswpNew->cy = theight - 4;
|
|---|
| 4319 | pswpClient->cy -= theight;
|
|---|
| 4320 | sCount++;
|
|---|
| [133] | 4321 | }
|
|---|
| 4322 | else
|
|---|
| [1335] | 4323 | WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE);
|
|---|
| [2] | 4324 |
|
|---|
| [551] | 4325 | if (fDrivebar) {
|
|---|
| [1335] | 4326 | ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4);
|
|---|
| 4327 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
|---|
| 4328 | (fSplitStatus != FALSE) +
|
|---|
| 4329 | (fToolbar != FALSE));
|
|---|
| 4330 | *pswpNew = *pswpClient;
|
|---|
| 4331 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES);
|
|---|
| 4332 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
|---|
| 4333 | pswpNew->x = swpClient.x + 2;
|
|---|
| 4334 | dheight += ((dheight - 2) * DriveLines);
|
|---|
| 4335 | pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);
|
|---|
| 4336 | if (fToolbar)
|
|---|
| 4337 | pswpNew->y -= theight;
|
|---|
| 4338 | pswpNew->cx = swpClient.cx - 4;
|
|---|
| 4339 | pswpNew->cy = dheight - 4;
|
|---|
| 4340 | pswpClient->cy -= dheight;
|
|---|
| 4341 | sCount++;
|
|---|
| [133] | 4342 | }
|
|---|
| 4343 | else
|
|---|
| [1335] | 4344 | WinShowWindow(WinWindowFromID(hwnd, MAIN_DRIVES), FALSE);
|
|---|
| [2] | 4345 |
|
|---|
| [551] | 4346 | if (fAutoView) {
|
|---|
| [1335] | 4347 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
|---|
| 4348 | (fToolbar != FALSE) +
|
|---|
| 4349 | (fDrivebar != FALSE) +
|
|---|
| 4350 | (fSplitStatus != FALSE));
|
|---|
| 4351 | *pswpNew = *pswpClient;
|
|---|
| 4352 | pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview;
|
|---|
| 4353 | pswpNew->x = pswpClient->x + 3;
|
|---|
| 4354 | pswpNew->y = pswpClient->y + 3;
|
|---|
| 4355 | if (fMoreButtons)
|
|---|
| 4356 | pswpNew->y += (bheight + 4);
|
|---|
| 4357 | pswpNew->cx = pswpClient->cx - 6;
|
|---|
| 4358 | AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116);
|
|---|
| 4359 | AutoviewHeight = max(AutoviewHeight, 36);
|
|---|
| 4360 | pswpNew->cy = AutoviewHeight;
|
|---|
| 4361 | pswpClient->y += (AutoviewHeight + 6);
|
|---|
| 4362 | pswpClient->cy -= (AutoviewHeight + 6);
|
|---|
| 4363 | sCount++;
|
|---|
| 4364 | WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE);
|
|---|
| [133] | 4365 | }
|
|---|
| [551] | 4366 | else {
|
|---|
| [1335] | 4367 | WinShowWindow(hwndAutoview, FALSE);
|
|---|
| 4368 | WinShowWindow(hwndAutoMLE, FALSE);
|
|---|
| [133] | 4369 | }
|
|---|
| [2] | 4370 |
|
|---|
| [133] | 4371 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
|---|
| [1335] | 4372 | (fToolbar != FALSE) +
|
|---|
| 4373 | (fDrivebar != FALSE) +
|
|---|
| 4374 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
|---|
| [133] | 4375 | *pswpNew = *pswpClient;
|
|---|
| [551] | 4376 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_OPENWALK);
|
|---|
| 4377 | pswpNew->x = swpClient.cx - ((sheight * 2) + 4);
|
|---|
| 4378 | pswpNew->y = swpClient.y;
|
|---|
| 4379 | pswpNew->cx = sheight + 4;
|
|---|
| 4380 | pswpNew->cy = sheight + 4;
|
|---|
| [133] | 4381 | sCount++;
|
|---|
| 4382 | pswpNew = (PSWP) mp1 + (soldCount + 2 +
|
|---|
| [1335] | 4383 | (fToolbar != FALSE) +
|
|---|
| 4384 | (fDrivebar != FALSE) +
|
|---|
| 4385 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
|---|
| [133] | 4386 | *pswpNew = *pswpClient;
|
|---|
| [551] | 4387 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_USERLIST);
|
|---|
| 4388 | pswpNew->x = swpClient.cx - (sheight + 2);
|
|---|
| 4389 | pswpNew->y = swpClient.y;
|
|---|
| 4390 | pswpNew->cx = sheight + 4;
|
|---|
| 4391 | pswpNew->cy = sheight + 4;
|
|---|
| [133] | 4392 | sCount++;
|
|---|
| 4393 | pswpNew = (PSWP) mp1 + (soldCount + 3 +
|
|---|
| [1335] | 4394 | (fToolbar != FALSE) +
|
|---|
| 4395 | (fDrivebar != FALSE) +
|
|---|
| 4396 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
|---|
| [133] | 4397 | *pswpNew = *pswpClient;
|
|---|
| [551] | 4398 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LED);
|
|---|
| 4399 | pswpNew->x = swpClient.cx - ((sheight * 2) + 16);
|
|---|
| 4400 | pswpNew->y = swpClient.y;
|
|---|
| 4401 | pswpNew->cx = 12;
|
|---|
| 4402 | pswpNew->cy = 12;
|
|---|
| [133] | 4403 | sCount++;
|
|---|
| 4404 | pswpNew = (PSWP) mp1 + (soldCount + 4 +
|
|---|
| [1335] | 4405 | (fToolbar != FALSE) +
|
|---|
| 4406 | (fDrivebar != FALSE) +
|
|---|
| 4407 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
|---|
| [133] | 4408 | *pswpNew = *pswpClient;
|
|---|
| [551] | 4409 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LEDHDR);
|
|---|
| 4410 | pswpNew->x = swpClient.cx - ((sheight * 2) + 16);
|
|---|
| 4411 | pswpNew->y = swpClient.y + 12;
|
|---|
| 4412 | pswpNew->cx = 12;
|
|---|
| 4413 | pswpNew->cy = sheight - 8;
|
|---|
| [133] | 4414 | sCount++;
|
|---|
| [551] | 4415 | if (fUserComboBox) {
|
|---|
| [1335] | 4416 | if (!aheight) {
|
|---|
| [2] | 4417 |
|
|---|
| [1335] | 4418 | SWP swpTemp;
|
|---|
| [2] | 4419 |
|
|---|
| [1335] | 4420 | WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
|---|
| 4421 | &swpTemp);
|
|---|
| 4422 | aheight = swpTemp.cy;
|
|---|
| 4423 | }
|
|---|
| 4424 | pswpNew = (PSWP) mp1 + (soldCount + 5 +
|
|---|
| 4425 | (fToolbar != FALSE) +
|
|---|
| 4426 | (fSplitStatus != FALSE) +
|
|---|
| 4427 | (fDrivebar != FALSE) + (fAutoView != FALSE));
|
|---|
| 4428 | *pswpNew = *pswpClient;
|
|---|
| 4429 | pswpNew->hwnd = hwndDrivelist;
|
|---|
| 4430 | pswpNew->x = swpClient.x;
|
|---|
| 4431 | pswpNew->cx = 48;
|
|---|
| 4432 | pswpClient->cy -= (aheight + 6L);
|
|---|
| 4433 | pswpNew->y = pswpClient->y;
|
|---|
| 4434 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
|---|
| 4435 | sCount++;
|
|---|
| 4436 | pswpNew = (PSWP) mp1 + (soldCount + 6 +
|
|---|
| 4437 | (fToolbar != FALSE) +
|
|---|
| 4438 | (fDrivebar != FALSE) +
|
|---|
| 4439 | (fSplitStatus != FALSE) +
|
|---|
| 4440 | (fAutoView != FALSE));
|
|---|
| 4441 | *pswpNew = *pswpClient;
|
|---|
| 4442 | pswpNew->hwnd = hwndStatelist;
|
|---|
| 4443 | pswpNew->x = swpClient.x + 48;
|
|---|
| 4444 | pswpNew->cx = (swpClient.cx - 48) / 7;
|
|---|
| 4445 | pswpNew->y = pswpClient->y;
|
|---|
| 4446 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
|---|
| 4447 | sCount++;
|
|---|
| 4448 | pswpNew = (PSWP) mp1 + (soldCount + 7 +
|
|---|
| 4449 | (fToolbar != FALSE) +
|
|---|
| 4450 | (fDrivebar != FALSE) +
|
|---|
| 4451 | (fSplitStatus != FALSE) +
|
|---|
| 4452 | (fAutoView != FALSE));
|
|---|
| 4453 | *pswpNew = *pswpClient;
|
|---|
| 4454 | pswpNew->hwnd = hwndCmdlist;
|
|---|
| 4455 | pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7);
|
|---|
| 4456 | pswpNew->cx = (swpClient.cx - 48) / 5 +
|
|---|
| 4457 | ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7);
|
|---|
| 4458 | pswpNew->y = pswpClient->y;
|
|---|
| 4459 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
|---|
| 4460 | sCount++;
|
|---|
| 4461 | pswpNew = (PSWP) mp1 + (soldCount + 8 +
|
|---|
| 4462 | (fToolbar != FALSE) +
|
|---|
| 4463 | (fDrivebar != FALSE) +
|
|---|
| 4464 | (fSplitStatus != FALSE) +
|
|---|
| 4465 | (fAutoView != FALSE));
|
|---|
| 4466 | *pswpNew = *pswpClient;
|
|---|
| 4467 | pswpNew->hwnd = hwndUserlist;
|
|---|
| 4468 | pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2);
|
|---|
| 4469 | pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) -
|
|---|
| 4470 | ((fToolbar) ? ((swpClient.cx - 48) / 7) : 0);
|
|---|
| 4471 | pswpNew->y = pswpClient->y;
|
|---|
| 4472 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
|---|
| 4473 | sCount++;
|
|---|
| 4474 | if (fToolbar) {
|
|---|
| 4475 | pswpNew = (PSWP) mp1 + (soldCount + 9 +
|
|---|
| 4476 | (fToolbar != FALSE) +
|
|---|
| 4477 | (fDrivebar != FALSE) +
|
|---|
| 4478 | (fSplitStatus != FALSE) +
|
|---|
| 4479 | (fAutoView != FALSE));
|
|---|
| 4480 | *pswpNew = *pswpClient;
|
|---|
| 4481 | pswpNew->hwnd = hwndButtonlist;
|
|---|
| 4482 | pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4;
|
|---|
| 4483 | pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x;
|
|---|
| 4484 | pswpNew->y = pswpClient->y;
|
|---|
| 4485 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
|---|
| 4486 | sCount++;
|
|---|
| 4487 | }
|
|---|
| 4488 | else
|
|---|
| 4489 | WinShowWindow(hwndButtonlist, FALSE);
|
|---|
| [133] | 4490 | }
|
|---|
| [551] | 4491 | else {
|
|---|
| [1335] | 4492 | WinShowWindow(hwndUserlist, FALSE);
|
|---|
| 4493 | WinShowWindow(hwndDrivelist, FALSE);
|
|---|
| 4494 | WinShowWindow(hwndStatelist, FALSE);
|
|---|
| 4495 | WinShowWindow(hwndButtonlist, FALSE);
|
|---|
| 4496 | WinShowWindow(hwndCmdlist, FALSE);
|
|---|
| [133] | 4497 | }
|
|---|
| 4498 | {
|
|---|
| [1335] | 4499 | PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0;
|
|---|
| 4500 | SHORT x;
|
|---|
| [2] | 4501 |
|
|---|
| [1335] | 4502 | pswpNew = (PSWP) mp1 + (soldCount + 5 +
|
|---|
| 4503 | (fToolbar != FALSE) +
|
|---|
| 4504 | (fDrivebar != FALSE) +
|
|---|
| 4505 | (fSplitStatus != FALSE) +
|
|---|
| 4506 | (fAutoView != FALSE) +
|
|---|
| 4507 | ((fUserComboBox != FALSE) * 4) +
|
|---|
| 4508 | (fUserComboBox != FALSE &&
|
|---|
| 4509 | fToolbar != FALSE));
|
|---|
| 4510 | pswp = (PSWP) mp1;
|
|---|
| 4511 | for (x = 0; x < soldCount; x++) {
|
|---|
| 4512 | if (!pswpTitlebar &&
|
|---|
| 4513 | WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR)
|
|---|
| 4514 | pswpTitlebar = pswp;
|
|---|
| 4515 | else if (!pswpMinbutton &&
|
|---|
| 4516 | WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX)
|
|---|
| 4517 | pswpMinbutton = pswp;
|
|---|
| 4518 | if (pswpTitlebar && pswpMinbutton)
|
|---|
| 4519 | break;
|
|---|
| 4520 | pswp++;
|
|---|
| 4521 | }
|
|---|
| 4522 | if (pswpMinbutton && pswpTitlebar) {
|
|---|
| 4523 | *pswpNew = *pswpMinbutton;
|
|---|
| 4524 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_IDEALSIZE);
|
|---|
| 4525 | pswpNew->cy = pswpMinbutton->cy + 3;
|
|---|
| 4526 | pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3);
|
|---|
| 4527 | pswpTitlebar->cx -= (pswpNew->cx - 1);
|
|---|
| 4528 | pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx);
|
|---|
| 4529 | pswpNew->y = pswpMinbutton->y - 1;
|
|---|
| 4530 | sCount++;
|
|---|
| 4531 | }
|
|---|
| 4532 | else
|
|---|
| 4533 | WinShowWindow(WinWindowFromID(hwnd, IDM_IDEALSIZE), FALSE);
|
|---|
| [133] | 4534 | }
|
|---|
| [2] | 4535 |
|
|---|
| [551] | 4536 | if (fMoreButtons) {
|
|---|
| [2] | 4537 |
|
|---|
| [1335] | 4538 | LONG lastx;
|
|---|
| [2] | 4539 |
|
|---|
| [1335] | 4540 | pswpNew = (PSWP) mp1 + (soldCount + 6 +
|
|---|
| 4541 | (fToolbar != FALSE) +
|
|---|
| 4542 | (fDrivebar != FALSE) +
|
|---|
| 4543 | (fSplitStatus != FALSE) +
|
|---|
| 4544 | (fAutoView != FALSE) +
|
|---|
| 4545 | ((fUserComboBox != FALSE) * 4) +
|
|---|
| 4546 | (fUserComboBox != FALSE &&
|
|---|
| 4547 | fToolbar != FALSE));
|
|---|
| 4548 | *pswpNew = *pswpClient;
|
|---|
| 4549 | pswpNew->hwnd = hwndName;
|
|---|
| 4550 | pswpNew->x = swpClient.x + 3;
|
|---|
| 4551 | pswpNew->y = swpClient.y + (sheight + 6);
|
|---|
| 4552 | pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3;
|
|---|
| 4553 | lastx = pswpNew->x + pswpNew->cx;
|
|---|
| 4554 | pswpNew->cy = bheight;
|
|---|
| 4555 | pswpClient->y += (bheight + 4);
|
|---|
| 4556 | pswpClient->cy -= (bheight + 4);
|
|---|
| 4557 | sCount++;
|
|---|
| 4558 | pswpNew = (PSWP) mp1 + (soldCount + 7 +
|
|---|
| 4559 | (fToolbar != FALSE) +
|
|---|
| 4560 | (fDrivebar != FALSE) +
|
|---|
| 4561 | (fSplitStatus != FALSE) +
|
|---|
| 4562 | (fAutoView != FALSE) +
|
|---|
| 4563 | ((fUserComboBox != FALSE) * 4) +
|
|---|
| 4564 | (fUserComboBox != FALSE &&
|
|---|
| 4565 | fToolbar != FALSE));
|
|---|
| 4566 | *pswpNew = *pswpClient;
|
|---|
| 4567 | pswpNew->hwnd = hwndDate;
|
|---|
| 4568 | pswpNew->x = lastx + 3;
|
|---|
| 4569 | pswpNew->y = swpClient.y + (sheight + 6);
|
|---|
| 4570 | pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3;
|
|---|
| 4571 | lastx = pswpNew->x + pswpNew->cx;
|
|---|
| 4572 | pswpNew->cy = bheight;
|
|---|
| 4573 | sCount++;
|
|---|
| 4574 | pswpNew = (PSWP) mp1 + (soldCount + 8 +
|
|---|
| 4575 | (fToolbar != FALSE) +
|
|---|
| 4576 | (fDrivebar != FALSE) +
|
|---|
| 4577 | (fSplitStatus != FALSE) +
|
|---|
| 4578 | (fAutoView != FALSE) +
|
|---|
| 4579 | ((fUserComboBox != FALSE) * 4) +
|
|---|
| 4580 | (fUserComboBox != FALSE &&
|
|---|
| 4581 | fToolbar != FALSE));
|
|---|
| 4582 | *pswpNew = *pswpClient;
|
|---|
| 4583 | pswpNew->hwnd = hwndAttr;
|
|---|
| 4584 | pswpNew->x = lastx + 3;
|
|---|
| 4585 | pswpNew->y = swpClient.y + (sheight + 6);
|
|---|
| 4586 | pswpNew->cx = (swpClient.cx - pswpNew->x) - 1;
|
|---|
| 4587 | pswpNew->cy = bheight;
|
|---|
| 4588 | sCount++;
|
|---|
| [133] | 4589 | }
|
|---|
| [551] | 4590 | else {
|
|---|
| [1335] | 4591 | WinShowWindow(hwndAttr, FALSE);
|
|---|
| 4592 | WinShowWindow(hwndName, FALSE);
|
|---|
| 4593 | WinShowWindow(hwndDate, FALSE);
|
|---|
| [133] | 4594 | }
|
|---|
| 4595 | return MRFROMSHORT(sCount);
|
|---|
| 4596 | }
|
|---|
| [2] | 4597 |
|
|---|
| [133] | 4598 | case WM_QUERYFRAMECTLCOUNT:
|
|---|
| 4599 | {
|
|---|
| 4600 | SHORT sCount;
|
|---|
| [2] | 4601 |
|
|---|
| [133] | 4602 | sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 4603 |
|
|---|
| [133] | 4604 | sCount += 6;
|
|---|
| 4605 | if (fSplitStatus)
|
|---|
| [1335] | 4606 | sCount++;
|
|---|
| [133] | 4607 | if (fToolbar)
|
|---|
| [1335] | 4608 | sCount++;
|
|---|
| [551] | 4609 | if (fUserComboBox) {
|
|---|
| [1335] | 4610 | sCount += 4;
|
|---|
| 4611 | if (fToolbar)
|
|---|
| 4612 | sCount++;
|
|---|
| [133] | 4613 | }
|
|---|
| 4614 | if (fDrivebar)
|
|---|
| [1335] | 4615 | sCount++;
|
|---|
| [133] | 4616 | if (fAutoView)
|
|---|
| [1335] | 4617 | sCount++;
|
|---|
| [133] | 4618 | if (fMoreButtons)
|
|---|
| [1335] | 4619 | sCount += 3;
|
|---|
| [133] | 4620 | return MRFROMSHORT(sCount);
|
|---|
| 4621 | }
|
|---|
| [2] | 4622 |
|
|---|
| [133] | 4623 | case WM_CLOSE:
|
|---|
| 4624 | WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
|
|---|
| 4625 | return 0;
|
|---|
| 4626 | }
|
|---|
| 4627 | return oldproc(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 4628 | }
|
|---|
| 4629 |
|
|---|
| [133] | 4630 | MRESULT EXPENTRY MainWMCommand(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| [130] | 4631 | {
|
|---|
| [2] | 4632 | SetShiftState();
|
|---|
| [551] | 4633 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| [824] | 4634 |
|
|---|
| 4635 | case IDM_CONTEXTMENU:
|
|---|
| 4636 | {
|
|---|
| 4637 | HWND hwnd = WinQueryFocus(HWND_DESKTOP);
|
|---|
| 4638 | // DbgMsg(pszSrcFile, __LINE__, "IDM_CONTEXTMENU %x", hwnd);
|
|---|
| 4639 | if (hwnd != NULLHANDLE) {
|
|---|
| [1335] | 4640 | HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT);
|
|---|
| 4641 | USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID);
|
|---|
| 4642 | switch (id) {
|
|---|
| 4643 | case MAIN_SETUPLIST:
|
|---|
| 4644 | case MAIN_USERLIST:
|
|---|
| 4645 | case MAIN_CMDLIST:
|
|---|
| 4646 | // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU");
|
|---|
| 4647 | WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0);
|
|---|
| 4648 | }
|
|---|
| [824] | 4649 | }
|
|---|
| 4650 | }
|
|---|
| 4651 | break;
|
|---|
| 4652 |
|
|---|
| [133] | 4653 | case IDM_SETTARGET:
|
|---|
| 4654 | SetTargetDir(hwnd, FALSE);
|
|---|
| 4655 | break;
|
|---|
| [2] | 4656 |
|
|---|
| [133] | 4657 | case IDM_TOAUTOMLE:
|
|---|
| 4658 | if (fComments && fAutoView)
|
|---|
| [551] | 4659 | WinSetFocus(HWND_DESKTOP, hwndAutoMLE);
|
|---|
| [133] | 4660 | break;
|
|---|
| [2] | 4661 |
|
|---|
| [133] | 4662 | case IDM_HIDENOTEWND:
|
|---|
| 4663 | HideNote();
|
|---|
| 4664 | break;
|
|---|
| 4665 | case IDM_SHOWNOTEWND:
|
|---|
| 4666 | ShowNote();
|
|---|
| 4667 | break;
|
|---|
| [2] | 4668 |
|
|---|
| [133] | 4669 | case IDM_COMPARE:
|
|---|
| 4670 | {
|
|---|
| 4671 | WALK2 wa;
|
|---|
| 4672 | PCNRITEM pci;
|
|---|
| 4673 |
|
|---|
| 4674 | memset(&wa, 0, sizeof(wa));
|
|---|
| 4675 | wa.size = sizeof(wa);
|
|---|
| [551] | 4676 | pci =
|
|---|
| [1335] | 4677 | (PCNRITEM)
|
|---|
| 4678 | WinSendMsg(WinWindowFromID
|
|---|
| 4679 | (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
|
|---|
| 4680 | CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
|
|---|
| 4681 | MPFROMSHORT(CRA_CURSORED));
|
|---|
| [551] | 4682 | if (pci && (INT) pci != -1) {
|
|---|
| [1335] | 4683 | strcpy(wa.szCurrentPath1, pci->pszFileName);
|
|---|
| 4684 | MakeValidDir(wa.szCurrentPath1);
|
|---|
| [133] | 4685 | }
|
|---|
| 4686 | else
|
|---|
| [1335] | 4687 | strcpy(wa.szCurrentPath1, pFM2SaveDirectory);
|
|---|
| [551] | 4688 | TopWindowName(hwndMain, (HWND) 0, wa.szCurrentPath2);
|
|---|
| [133] | 4689 | if (!*wa.szCurrentPath2)
|
|---|
| [1335] | 4690 | strcpy(wa.szCurrentPath2, wa.szCurrentPath1);
|
|---|
| [133] | 4691 | MakeValidDir(wa.szCurrentPath2);
|
|---|
| 4692 | if (WinDlgBox(HWND_DESKTOP,
|
|---|
| [1335] | 4693 | hwnd,
|
|---|
| 4694 | WalkTwoCmpDlgProc,
|
|---|
| 4695 | FM3ModHandle,
|
|---|
| 4696 | WALK2_FRAME,
|
|---|
| 4697 | MPFROMP(&wa)) &&
|
|---|
| 4698 | !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) {
|
|---|
| 4699 | if (!*dircompare) {
|
|---|
| [2] | 4700 |
|
|---|
| [1335] | 4701 | COMPARE *cmp;
|
|---|
| [2] | 4702 |
|
|---|
| [1335] | 4703 | cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
|
|---|
| 4704 | if (cmp) {
|
|---|
| 4705 | cmp->size = sizeof(COMPARE);
|
|---|
| 4706 | strcpy(cmp->leftdir, wa.szCurrentPath1);
|
|---|
| 4707 | strcpy(cmp->rightdir, wa.szCurrentPath2);
|
|---|
| 4708 | cmp->hwndParent = hwnd;
|
|---|
| 4709 | cmp->dcd.hwndParent = hwnd;
|
|---|
| 4710 | WinDlgBox(HWND_DESKTOP,
|
|---|
| 4711 | HWND_DESKTOP,
|
|---|
| 4712 | CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
|
|---|
| 4713 | }
|
|---|
| 4714 | }
|
|---|
| 4715 | else {
|
|---|
| [2] | 4716 |
|
|---|
| [1335] | 4717 | CHAR szPath1[CCHMAXPATH];
|
|---|
| 4718 | CHAR szPath2[CCHMAXPATH];
|
|---|
| 4719 | runemf2(SEPARATE,
|
|---|
| 4720 | HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 4721 | NULL, NULL,
|
|---|
| 4722 | "%s %s %s",
|
|---|
| 4723 | dircompare,
|
|---|
| 4724 | BldQuotedFileName(szPath1, wa.szCurrentPath1),
|
|---|
| 4725 | BldQuotedFileName(szPath2, wa.szCurrentPath2));
|
|---|
| 4726 | }
|
|---|
| [2] | 4727 | }
|
|---|
| [133] | 4728 | }
|
|---|
| 4729 | break;
|
|---|
| [2] | 4730 |
|
|---|
| [133] | 4731 | case IDM_EXIT:
|
|---|
| 4732 | case IDM_KILLME:
|
|---|
| [551] | 4733 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
|---|
| [133] | 4734 | break;
|
|---|
| [2] | 4735 |
|
|---|
| [133] | 4736 | case IDM_CLI:
|
|---|
| 4737 | if (fSplitStatus &&
|
|---|
| [1335] | 4738 | hwndStatus2 &&
|
|---|
| 4739 | !WinIsWindow(WinQueryAnchorBlock(hwnd),
|
|---|
| 4740 | WinWindowFromID(hwndStatus2, COMMAND_LINE)))
|
|---|
| [551] | 4741 | PostMsg(hwndStatus2, UM_CLICKED, MPVOID, MPVOID);
|
|---|
| [133] | 4742 | break;
|
|---|
| [2] | 4743 |
|
|---|
| [133] | 4744 | case IDM_ADDTOUSERLIST:
|
|---|
| 4745 | case IDM_DELETEFROMUSERLIST:
|
|---|
| 4746 | {
|
|---|
| 4747 | CHAR temp[CCHMAXPATH], path[CCHMAXPATH];
|
|---|
| 4748 |
|
|---|
| 4749 | *temp = 0;
|
|---|
| [551] | 4750 | WinQueryWindowText(hwndUserlist, CCHMAXPATH, temp);
|
|---|
| [133] | 4751 | bstrip(temp);
|
|---|
| 4752 | if (*temp &&
|
|---|
| [1335] | 4753 | !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) {
|
|---|
| 4754 | if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) {
|
|---|
| 4755 | add_udir(TRUE, path);
|
|---|
| 4756 | if (fUdirsChanged)
|
|---|
| 4757 | save_udirs();
|
|---|
| 4758 | WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
|---|
| 4759 | }
|
|---|
| 4760 | else {
|
|---|
| 4761 | if (!remove_udir(path))
|
|---|
| 4762 | Runtime_Error(pszSrcFile, __LINE__, "remove_udir");
|
|---|
| 4763 | else {
|
|---|
| 4764 | if (fUdirsChanged)
|
|---|
| 4765 | save_udirs();
|
|---|
| 4766 | WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
|---|
| 4767 | }
|
|---|
| 4768 | }
|
|---|
| [2] | 4769 | }
|
|---|
| [133] | 4770 | }
|
|---|
| 4771 | break;
|
|---|
| [2] | 4772 |
|
|---|
| [133] | 4773 | case IDM_SAVEDIRCNRSTATE:
|
|---|
| 4774 | case IDM_DELETEDIRCNRSTATE:
|
|---|
| 4775 | {
|
|---|
| [787] | 4776 | CHAR szStateName[STATE_NAME_MAX_BYTES + 1];
|
|---|
| [133] | 4777 |
|
|---|
| [558] | 4778 | *szStateName = 0;
|
|---|
| [787] | 4779 | WinQueryWindowText(hwndStatelist, STATE_NAME_MAX_BYTES, szStateName);
|
|---|
| [558] | 4780 | bstrip(szStateName);
|
|---|
| [961] | 4781 | // Complain if attempting to use reserved name
|
|---|
| 4782 | if (stricmp(szStateName, GetPString(IDS_STATETEXT)) == 0 ||
|
|---|
| [1335] | 4783 | stricmp(szStateName, GetPString(IDS_FM2TEMPTEXT)) == 0)
|
|---|
| [961] | 4784 | {
|
|---|
| [1335] | 4785 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
|---|
| 4786 | GetPString(IDS_WARNINGTEXT),
|
|---|
| 4787 | "\"%s\" is a reserved state name", szStateName);
|
|---|
| [961] | 4788 | }
|
|---|
| 4789 | // Ignore request if blank
|
|---|
| [1027] | 4790 | else if (*szStateName) {
|
|---|
| [1335] | 4791 | BOOL fAbortOperation = FALSE;
|
|---|
| 4792 | if (!fNoSaveState && fSaveState && stricmp(szStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0)
|
|---|
| 4793 | {
|
|---|
| 4794 | if (saymsg(MB_YESNO | MB_DEFBUTTON2 | MB_ICONASTERISK, hwnd,
|
|---|
| 4795 | GetPString(IDS_WARNINGTEXT),
|
|---|
| 4796 | GetPString(IDS_SHUTDOWNSTATE_WARNING), szStateName) == MBID_NO)
|
|---|
| 4797 | fAbortOperation = TRUE;
|
|---|
| 4798 | }
|
|---|
| 4799 | if (!fAbortOperation) {
|
|---|
| 4800 | if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) {
|
|---|
| 4801 | // Save
|
|---|
| 4802 | INT nSaved = SaveDirCnrState(hwnd, szStateName);
|
|---|
| 4803 | if (nSaved >= 0) {
|
|---|
| 4804 | INT ret = add_setup(szStateName);
|
|---|
| 4805 | if (ret == 0) {
|
|---|
| 4806 | WinSendMsg(hwndStatelist, LM_INSERTITEM,
|
|---|
| 4807 | MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName));
|
|---|
| 4808 | save_setups();
|
|---|
| 4809 | }
|
|---|
| 4810 | else if (ret != 1) {
|
|---|
| 4811 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
|---|
| 4812 | GetPString(IDS_WARNINGTEXT),
|
|---|
| 4813 | "\"%s\" state name add failed", szStateName); // 15 Apr 07 SHL failed
|
|---|
| 4814 | WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
|
|---|
| 4815 | }
|
|---|
| 4816 | }
|
|---|
| 4817 | else {
|
|---|
| 4818 | saymsg(MB_ENTER | MB_ICONASTERISK,
|
|---|
| 4819 | hwnd,
|
|---|
| 4820 | GetPString(IDS_WARNINGTEXT),
|
|---|
| 4821 | "State data save failed");
|
|---|
| 4822 | WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
|
|---|
| 4823 | }
|
|---|
| 4824 | }
|
|---|
| 4825 | else {
|
|---|
| 4826 | // Delete
|
|---|
| 4827 | ULONG numsaves = 0, size, x;
|
|---|
| 4828 | CHAR s[STATE_NAME_MAX_BYTES + 80];
|
|---|
| [2] | 4829 |
|
|---|
| [1335] | 4830 | INT ret = remove_setup(szStateName);
|
|---|
| 4831 | if (ret == 1)
|
|---|
| 4832 | save_setups();
|
|---|
| 4833 | sprintf(s, "%s.NumDirsLastTime", szStateName);
|
|---|
| 4834 | size = sizeof(ULONG);
|
|---|
| 4835 | if (!PrfQueryProfileData(fmprof,
|
|---|
| 4836 | FM3Str,
|
|---|
| 4837 | s,
|
|---|
| 4838 | (PVOID)&numsaves,
|
|---|
| 4839 | &size)) {
|
|---|
| 4840 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
|---|
| 4841 | GetPString(IDS_WARNINGTEXT),
|
|---|
| 4842 | GetPString(IDS_DOESNTEXISTTEXT), szStateName);
|
|---|
| 4843 | }
|
|---|
| 4844 | else if (!size)
|
|---|
| 4845 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
|---|
| 4846 | else {
|
|---|
| 4847 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L);
|
|---|
| 4848 | for (x = 0; x < numsaves; x++) {
|
|---|
| 4849 | sprintf(s, "%s.DirCnrPos.%lu", szStateName, x);
|
|---|
| 4850 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4851 | sprintf(s, "%s.DirCnrDir.%lu", szStateName, x);
|
|---|
| 4852 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4853 | sprintf(s, "%s.DirCnrSort.%lu", szStateName, x);
|
|---|
| 4854 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4855 | sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x);
|
|---|
| 4856 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4857 | sprintf(s, "%s.DirCnrView.%lu", szStateName, x);
|
|---|
| 4858 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4859 | sprintf(s, "%s.DirCnr.%lu.DetailsLongname", szStateName, x);
|
|---|
| 4860 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4861 | sprintf(s, "%s.DirCnr.%lu.DetailsSubject", szStateName, x);
|
|---|
| 4862 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4863 | sprintf(s, "%s.DirCnr.%lu.DetailsSize", szStateName, x);
|
|---|
| 4864 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4865 | sprintf(s, "%s.DirCnr.%lu.DetailsEA", szStateName, x);
|
|---|
| 4866 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4867 | sprintf(s, "%s.DirCnr.%lu.DetailsAttr", szStateName, x);
|
|---|
| 4868 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4869 | sprintf(s, "%s.DirCnr.%lu.DetailsIcon", szStateName, x);
|
|---|
| 4870 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4871 | sprintf(s, "%s.DirCnr.%lu.DetailsLWDate", szStateName, x);
|
|---|
| 4872 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4873 | sprintf(s, "%s.DirCnr.%lu.DetailsLWTime", szStateName, x);
|
|---|
| 4874 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4875 | sprintf(s, "%s.DirCnr.%lu.DetailsLADate", szStateName, x);
|
|---|
| 4876 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4877 | sprintf(s, "%s.DirCnr.%lu.DetailsLATime", szStateName, x);
|
|---|
| 4878 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4879 | sprintf(s, "%s.DirCnr.%lu.DetailsCRDate", szStateName, x);
|
|---|
| 4880 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4881 | sprintf(s, "%s.DirCnr.%lu.DetailsCRTime", szStateName, x);
|
|---|
| 4882 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4883 | sprintf(s, "%s.DirCnr.%lu.Backgroundcolor", szStateName, x);
|
|---|
| 4884 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4885 | sprintf(s, "%s.DirCnr.%lu.Fontnamesize", szStateName, x);
|
|---|
| 4886 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4887 | }
|
|---|
| 4888 | sprintf(s, "%s.LastTreePos", szStateName);
|
|---|
| 4889 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4890 | sprintf(s, "%s.MySizeLastTime", szStateName);
|
|---|
| 4891 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4892 | }
|
|---|
| 4893 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
|---|
| 4894 | }
|
|---|
| 4895 | }
|
|---|
| [2] | 4896 | }
|
|---|
| [133] | 4897 | }
|
|---|
| 4898 | break;
|
|---|
| [2] | 4899 |
|
|---|
| [133] | 4900 | case IDM_IDEALSIZE:
|
|---|
| 4901 | {
|
|---|
| 4902 | SWP swp, swpD;
|
|---|
| 4903 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L;
|
|---|
| 4904 | ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
|
|---|
| 4905 |
|
|---|
| 4906 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
|---|
| [551] | 4907 | if (swp.fl & SWP_MAXIMIZE) {
|
|---|
| [1335] | 4908 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_SYSCOMMAND,
|
|---|
| 4909 | MPFROM2SHORT(SC_RESTORE, 0), MPVOID);
|
|---|
| 4910 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
|---|
| [2] | 4911 | }
|
|---|
| [133] | 4912 | WinGetMaxPosition(WinQueryWindow(hwnd, QW_PARENT), &swpD);
|
|---|
| 4913 | swpD.x += bsz;
|
|---|
| 4914 | swpD.cx -= (bsz * 2);
|
|---|
| 4915 | swpD.y += icz;
|
|---|
| 4916 | swpD.cy -= (icz + bsz);
|
|---|
| 4917 | if (swp.x == swpD.x && swp.y == swpD.y &&
|
|---|
| [1335] | 4918 | swp.cx == swpD.cx && swp.cy == swpD.cy &&
|
|---|
| 4919 | // fixme to be #defined someday
|
|---|
| 4920 | WinQueryWindowUShort(hwnd, QWL_USER + 10) &&
|
|---|
| 4921 | WinQueryWindowUShort(hwnd, QWL_USER + 14)) {
|
|---|
| 4922 | swpD.x = WinQueryWindowUShort(hwnd, QWL_USER + 8);
|
|---|
| 4923 | swpD.cx = WinQueryWindowUShort(hwnd, QWL_USER + 10);
|
|---|
| 4924 | swpD.y = WinQueryWindowUShort(hwnd, QWL_USER + 12);
|
|---|
| 4925 | swpD.cy = WinQueryWindowUShort(hwnd, QWL_USER + 14);
|
|---|
| [133] | 4926 | }
|
|---|
| [551] | 4927 | else {
|
|---|
| [1335] | 4928 | WinSetWindowUShort(hwnd, QWL_USER + 8, (USHORT) swp.x);
|
|---|
| 4929 | WinSetWindowUShort(hwnd, QWL_USER + 10, (USHORT) swp.cx);
|
|---|
| 4930 | WinSetWindowUShort(hwnd, QWL_USER + 12, (USHORT) swp.y);
|
|---|
| 4931 | WinSetWindowUShort(hwnd, QWL_USER + 14, (USHORT) swp.cy);
|
|---|
| [133] | 4932 | }
|
|---|
| 4933 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP,
|
|---|
| [1335] | 4934 | swpD.x, swpD.y, swpD.cx, swpD.cy, SWP_MOVE | SWP_SIZE);
|
|---|
| [133] | 4935 | }
|
|---|
| 4936 | break;
|
|---|
| [2] | 4937 |
|
|---|
| [133] | 4938 | case IDM_BLINK:
|
|---|
| 4939 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
|
|---|
| [1335] | 4940 | SWP_MINIMIZE);
|
|---|
| [133] | 4941 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
|
|---|
| [1335] | 4942 | SWP_RESTORE | SWP_ZORDER);
|
|---|
| [133] | 4943 | break;
|
|---|
| [2] | 4944 |
|
|---|
| [133] | 4945 | case DID_CANCEL:
|
|---|
| 4946 | {
|
|---|
| [551] | 4947 | HWND hwndTop = TopWindow(hwndMain, (HWND) 0);
|
|---|
| [2] | 4948 |
|
|---|
| [133] | 4949 | if (hwndTop)
|
|---|
| [1335] | 4950 | WinSetFocus(HWND_DESKTOP, hwndTop);
|
|---|
| [133] | 4951 | }
|
|---|
| 4952 | break;
|
|---|
| [2] | 4953 |
|
|---|
| [133] | 4954 | case IDM_NOTEBOOK:
|
|---|
| [917] | 4955 | case IDM_DIRCNRSETTINGS:
|
|---|
| [953] | 4956 | case IDM_DIRVIEWSETTINGS:
|
|---|
| 4957 | case IDM_DIRSORTSETTINGS:
|
|---|
| 4958 | case IDM_COLLECTORVIEWSETTINGS:
|
|---|
| 4959 | case IDM_COLLECTORSORTSETTINGS:
|
|---|
| [917] | 4960 | case IDM_ARCHIVERSETTINGS:
|
|---|
| [953] | 4961 | case IDM_TREECNRVIEWSETTINGS:
|
|---|
| 4962 | case IDM_TREECNRSORTSETTINGS:
|
|---|
| [917] | 4963 | case IDM_VIEWERSETTINGS:
|
|---|
| [953] | 4964 | case IDM_VIEWERSETTINGS2:
|
|---|
| [917] | 4965 | case IDM_COMPARESETTINGS:
|
|---|
| [953] | 4966 | case IDM_MONOLITHICSETTINGS:
|
|---|
| 4967 | case IDM_GENERALSETTINGS:
|
|---|
| 4968 | case IDM_SCANSETTINGS:
|
|---|
| 4969 | case IDM_BUBBLESSETTINGS:
|
|---|
| [917] | 4970 | case IDM_QUICKSETTINGS:
|
|---|
| [133] | 4971 | WinDlgBox(HWND_DESKTOP,
|
|---|
| [1335] | 4972 | hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMLONG(mp1));
|
|---|
| [133] | 4973 | break;
|
|---|
| [2] | 4974 |
|
|---|
| [133] | 4975 | case IDM_VIEWHELPS:
|
|---|
| 4976 | case IDM_VIEWINFS:
|
|---|
| 4977 | WinDlgBox(HWND_DESKTOP,
|
|---|
| [1335] | 4978 | HWND_DESKTOP,
|
|---|
| 4979 | ViewInfProc,
|
|---|
| 4980 | FM3ModHandle,
|
|---|
| 4981 | VINF_FRAME,
|
|---|
| 4982 | ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ?
|
|---|
| 4983 | MPFROMP(NullStr) : MPVOID));
|
|---|
| [133] | 4984 | break;
|
|---|
| [2] | 4985 |
|
|---|
| [133] | 4986 | case IDM_OPENWALK:
|
|---|
| 4987 | {
|
|---|
| 4988 | char newpath[CCHMAXPATH];
|
|---|
| [2] | 4989 |
|
|---|
| [133] | 4990 | *newpath = 0;
|
|---|
| [551] | 4991 | TopWindowName(hwnd, (HWND) 0, newpath);
|
|---|
| [133] | 4992 | if (WinDlgBox(HWND_DESKTOP,
|
|---|
| [1335] | 4993 | hwnd,
|
|---|
| 4994 | WalkAllDlgProc,
|
|---|
| 4995 | FM3ModHandle, WALK_FRAME, MPFROMP(newpath)) && *newpath)
|
|---|
| 4996 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, newpath);
|
|---|
| [133] | 4997 | }
|
|---|
| 4998 | break;
|
|---|
| [2] | 4999 |
|
|---|
| [133] | 5000 | case IDM_WINDOWDLG:
|
|---|
| 5001 | WindowList(hwnd);
|
|---|
| 5002 | break;
|
|---|
| [2] | 5003 |
|
|---|
| [133] | 5004 | case IDM_HELPMOUSE:
|
|---|
| 5005 | case IDM_HELPCONTEXT:
|
|---|
| 5006 | case IDM_HELPHINTS:
|
|---|
| 5007 | case IDM_HELPPIX:
|
|---|
| 5008 | case IDM_HELPTUTOR:
|
|---|
| 5009 | case IDM_HELPUSERLIST:
|
|---|
| 5010 | case IDM_HELP:
|
|---|
| 5011 | case IDM_HELPCONTENTS:
|
|---|
| 5012 | case IDM_HELPKEYS:
|
|---|
| 5013 | case IDM_HELPGENERAL:
|
|---|
| [551] | 5014 | if (hwndHelp) {
|
|---|
| 5015 | if (SHORT1FROMMP(mp2) == CMDSRC_MENU) {
|
|---|
| [2] | 5016 |
|
|---|
| [1335] | 5017 | RECTL rcl;
|
|---|
| 5018 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L;
|
|---|
| [2] | 5019 |
|
|---|
| [1335] | 5020 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
|---|
| 5021 | rcl.yBottom += icz;
|
|---|
| 5022 | rcl.yTop -= icz;
|
|---|
| 5023 | rcl.xLeft += icz;
|
|---|
| 5024 | rcl.xRight -= icz;
|
|---|
| 5025 | WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);
|
|---|
| [133] | 5026 | }
|
|---|
| [551] | 5027 | else {
|
|---|
| [2] | 5028 |
|
|---|
| [1335] | 5029 | RECTL rcl;
|
|---|
| [2] | 5030 |
|
|---|
| [1335] | 5031 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
|---|
| 5032 | rcl.yBottom += 8;
|
|---|
| 5033 | rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7);
|
|---|
| 5034 | rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7);
|
|---|
| 5035 | rcl.xRight -= 8;
|
|---|
| 5036 | WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);
|
|---|
| [133] | 5037 | }
|
|---|
| [551] | 5038 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| [133] | 5039 | case IDM_HELPCONTEXT:
|
|---|
| [1335] | 5040 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5041 | MPFROM2SHORT(HELP_CONTEXT, 0), MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5042 | break;
|
|---|
| [2] | 5043 |
|
|---|
| [133] | 5044 | case IDM_HELPMOUSE:
|
|---|
| [1335] | 5045 | if (hwndHelp)
|
|---|
| 5046 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5047 | MPFROM2SHORT(HELP_MOUSE, 0), MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5048 | break;
|
|---|
| [2] | 5049 |
|
|---|
| [133] | 5050 | case IDM_HELPPIX:
|
|---|
| [1335] | 5051 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5052 | MPFROM2SHORT(HELP_BITMAP1, 0), MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5053 | break;
|
|---|
| [2] | 5054 |
|
|---|
| [133] | 5055 | case IDM_HELPTUTOR:
|
|---|
| [1335] | 5056 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5057 | MPFROM2SHORT(HELP_TUTORIAL, 0),
|
|---|
| 5058 | MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5059 | break;
|
|---|
| [2] | 5060 |
|
|---|
| [133] | 5061 | case IDM_HELPHINTS:
|
|---|
| [1335] | 5062 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5063 | MPFROM2SHORT(HELP_HINTS, 0), MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5064 | break;
|
|---|
| [2] | 5065 |
|
|---|
| [133] | 5066 | case IDM_HELPGENERAL:
|
|---|
| [1335] | 5067 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5068 | MPFROM2SHORT(HELP_MAIN, 0), MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5069 | break;
|
|---|
| [133] | 5070 | case IDM_HELPKEYS:
|
|---|
| [1335] | 5071 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5072 | MPFROM2SHORT(HELP_KEYS, 0), MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5073 | break;
|
|---|
| [2] | 5074 |
|
|---|
| [133] | 5075 | case IDM_HELP:
|
|---|
| 5076 | case IDM_HELPCONTENTS:
|
|---|
| [1335] | 5077 | WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
|
|---|
| 5078 | break;
|
|---|
| [2] | 5079 |
|
|---|
| [133] | 5080 | case IDM_HELPUSERLIST:
|
|---|
| [1335] | 5081 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5082 | MPFROM2SHORT(HELP_USERLISTS, 0),
|
|---|
| 5083 | MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5084 | break;
|
|---|
| [2] | 5085 | }
|
|---|
| [133] | 5086 | }
|
|---|
| 5087 | break;
|
|---|
| [2] | 5088 |
|
|---|
| [133] | 5089 | case IDM_EDITANYARCHIVER:
|
|---|
| [419] | 5090 | EditArchiverDefinition(hwnd);
|
|---|
| [133] | 5091 | break;
|
|---|
| [2] | 5092 |
|
|---|
| [133] | 5093 | case IDM_ABOUT:
|
|---|
| 5094 | WinDlgBox(HWND_DESKTOP, hwnd, AboutDlgProc, FM3ModHandle,
|
|---|
| [1335] | 5095 | ABT_FRAME, MPVOID);
|
|---|
| [133] | 5096 | break;
|
|---|
| [2] | 5097 |
|
|---|
| [133] | 5098 | case IDM_FONTPALETTE:
|
|---|
| 5099 | OpenObject("<WP_FNTPAL>", Default, hwnd);
|
|---|
| 5100 | break;
|
|---|
| [2] | 5101 |
|
|---|
| [133] | 5102 | case IDM_HICOLORPALETTE:
|
|---|
| 5103 | case IDM_COLORPALETTE:
|
|---|
| 5104 | {
|
|---|
| 5105 | CHAR *palette = "<WP_CLRPAL>";
|
|---|
| 5106 | ULONG version[2];
|
|---|
| 5107 |
|
|---|
| 5108 | if (!DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR,
|
|---|
| [1335] | 5109 | (PVOID) & version, (ULONG) sizeof(version))) {
|
|---|
| 5110 | if (version[0] > 20L || (version[0] == 20L && version[1] > 29L)) {
|
|---|
| 5111 | if (SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE)
|
|---|
| 5112 | palette = "<WP_HIRESCLRPAL>";
|
|---|
| 5113 | else
|
|---|
| 5114 | palette = "<WP_LORESCLRPAL>";
|
|---|
| 5115 | }
|
|---|
| [2] | 5116 | }
|
|---|
| [133] | 5117 | OpenObject(palette, Default, hwnd);
|
|---|
| 5118 | }
|
|---|
| 5119 | break;
|
|---|
| [2] | 5120 |
|
|---|
| [133] | 5121 | case IDM_SYSTEMSETUP:
|
|---|
| 5122 | OpenObject("<WP_CONFIG>", Default, hwnd);
|
|---|
| 5123 | break;
|
|---|
| [2] | 5124 |
|
|---|
| [133] | 5125 | case IDM_SCHEMEPALETTE:
|
|---|
| 5126 | {
|
|---|
| 5127 | HOBJECT hWPSObject;
|
|---|
| [2] | 5128 |
|
|---|
| [133] | 5129 | hWPSObject = WinQueryObject("<WP_SCHPAL>");
|
|---|
| 5130 | if (hWPSObject != NULLHANDLE)
|
|---|
| [1335] | 5131 | WinSetObjectData(hWPSObject, "SCHEMES=Winter:PM_Winter,"
|
|---|
| 5132 | "Spring:PM_Spring,Summer:PM_Summer,"
|
|---|
| 5133 | "System:PM_System,Windows:PM_Windows;"
|
|---|
| 5134 | "OPEN=DEFAULT");
|
|---|
| [133] | 5135 | }
|
|---|
| 5136 | break;
|
|---|
| [2] | 5137 |
|
|---|
| [133] | 5138 | case IDM_SYSTEMCLOCK:
|
|---|
| 5139 | OpenObject("<WP_CLOCK>", Default, hwnd);
|
|---|
| 5140 | break;
|
|---|
| [2] | 5141 |
|
|---|
| 5142 | #ifdef NEVER
|
|---|
| [133] | 5143 | case IDM_SYSINFO:
|
|---|
| 5144 | WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, SysInfoDlgProc, FM3ModHandle,
|
|---|
| [1335] | 5145 | SYS_FRAME, NULL);
|
|---|
| [133] | 5146 | break;
|
|---|
| [2] | 5147 | #endif
|
|---|
| 5148 |
|
|---|
| [133] | 5149 | case IDM_INSTANT:
|
|---|
| 5150 | {
|
|---|
| 5151 | CHAR path[CCHMAXPATH];
|
|---|
| 5152 | PCNRITEM pci = (PCNRITEM) 0;
|
|---|
| 5153 |
|
|---|
| 5154 | if (hwndTree)
|
|---|
| [1335] | 5155 | pci = (PCNRITEM) WinSendMsg(hwndTree, CM_QUERYRECORDEMPHASIS,
|
|---|
| 5156 | MPFROMLONG(CMA_FIRST),
|
|---|
| 5157 | MPFROMSHORT(CRA_CURSORED));
|
|---|
| [551] | 5158 | if (pci && (INT) pci != -1) {
|
|---|
| [1335] | 5159 | strcpy(path, pci->pszFileName);
|
|---|
| 5160 | MakeValidDir(path);
|
|---|
| [2] | 5161 | }
|
|---|
| [133] | 5162 | else
|
|---|
| [1335] | 5163 | strcpy(path, pFM2SaveDirectory);
|
|---|
| [133] | 5164 | WinDlgBox(HWND_DESKTOP, hwnd, InstantDlgProc, FM3ModHandle,
|
|---|
| [1335] | 5165 | BAT_FRAME, MPFROMP(path));
|
|---|
| [133] | 5166 | }
|
|---|
| 5167 | break;
|
|---|
| [2] | 5168 |
|
|---|
| [133] | 5169 | case IDM_WINFULLSCREEN:
|
|---|
| 5170 | case IDM_DOSCOMMANDLINE:
|
|---|
| 5171 | case IDM_COMMANDLINE:
|
|---|
| 5172 | {
|
|---|
| 5173 | CHAR *env = GetCmdSpec(FALSE), path[CCHMAXPATH];
|
|---|
| 5174 | INT type = SEPARATE | WINDOWED;
|
|---|
| 5175 |
|
|---|
| 5176 | *path = 0;
|
|---|
| [551] | 5177 | TopWindowName(hwnd, (HWND) 0, path);
|
|---|
| [133] | 5178 | if (SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE)
|
|---|
| [1335] | 5179 | env = GetCmdSpec(TRUE);
|
|---|
| [551] | 5180 | else if (SHORT1FROMMP(mp1) != IDM_COMMANDLINE) {
|
|---|
| [1335] | 5181 | env = "WINOS2.COM";
|
|---|
| 5182 | type = SEPARATE | FULLSCREEN;
|
|---|
| [2] | 5183 | }
|
|---|
| [888] | 5184 | runemf2(type, hwnd, pszSrcFile, __LINE__,
|
|---|
| [1335] | 5185 | path, NULL, "%s", env);
|
|---|
| [133] | 5186 | }
|
|---|
| 5187 | break;
|
|---|
| [2] | 5188 |
|
|---|
| [133] | 5189 | case IDM_KILLPROC:
|
|---|
| 5190 | WinDlgBox(HWND_DESKTOP, hwnd, KillDlgProc, FM3ModHandle,
|
|---|
| [1335] | 5191 | KILL_FRAME, NULL);
|
|---|
| [133] | 5192 | break;
|
|---|
| [2] | 5193 |
|
|---|
| [133] | 5194 | case IDM_AUTOVIEWCOMMENTS:
|
|---|
| 5195 | case IDM_AUTOVIEWFILE:
|
|---|
| 5196 | if (SHORT1FROMMP(mp1) == IDM_AUTOVIEWFILE)
|
|---|
| 5197 | fComments = FALSE;
|
|---|
| 5198 | else
|
|---|
| 5199 | fComments = TRUE;
|
|---|
| [551] | 5200 | PrfWriteProfileData(fmprof, FM3Str, "Comments", &fComments, sizeof(BOOL));
|
|---|
| [133] | 5201 | WinSetWindowText((fComments) ? hwndAutoview : hwndAutoMLE, NullStr);
|
|---|
| 5202 | goto AutoChange;
|
|---|
| [2] | 5203 |
|
|---|
| [133] | 5204 | case IDM_AUTOVIEW:
|
|---|
| 5205 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
|---|
| [1335] | 5206 | &fAutoView, TRUE, "AutoView");
|
|---|
| [133] | 5207 | AutoChange:
|
|---|
| 5208 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
|---|
| [1335] | 5209 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| [551] | 5210 | if (fAutoView) {
|
|---|
| [2] | 5211 |
|
|---|
| [133] | 5212 | CHAR s[CCHMAXPATH];
|
|---|
| 5213 | HWND hwndDir;
|
|---|
| 5214 | PCNRITEM pci;
|
|---|
| [2] | 5215 |
|
|---|
| [551] | 5216 | hwndDir = TopWindowName(hwnd, (HWND) 0, s);
|
|---|
| 5217 | if (hwndDir) {
|
|---|
| [1335] | 5218 | hwndDir = WinWindowFromID(hwndDir, FID_CLIENT);
|
|---|
| 5219 | if (hwndDir) {
|
|---|
| 5220 | hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
|
|---|
| 5221 | if (hwndDir) {
|
|---|
| 5222 | pci = (PCNRITEM) WinSendMsg(hwndDir, CM_QUERYRECORDEMPHASIS,
|
|---|
| 5223 | MPFROMLONG(CMA_FIRST),
|
|---|
| 5224 | MPFROMSHORT(CRA_CURSORED));
|
|---|
| 5225 | if (pci && (INT) pci != -1 &&
|
|---|
| 5226 | (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
|
|---|
| 5227 | WinSendMsg(hwnd,
|
|---|
| 5228 | UM_LOADFILE,
|
|---|
| 5229 | MPFROMP(pci->pszFileName),
|
|---|
| 5230 | (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ?
|
|---|
| 5231 | MPVOID : MPFROMLONG(1));
|
|---|
| 5232 | }
|
|---|
| 5233 | }
|
|---|
| [2] | 5234 | }
|
|---|
| [133] | 5235 | }
|
|---|
| 5236 | break;
|
|---|
| [2] | 5237 |
|
|---|
| [133] | 5238 | case IDM_TEXTTOOLS:
|
|---|
| 5239 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
|---|
| [1335] | 5240 | &fTextTools, TRUE, "TextTools");
|
|---|
| [1125] | 5241 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| [133] | 5242 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
|---|
| [1335] | 5243 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| [133] | 5244 | break;
|
|---|
| [2] | 5245 |
|
|---|
| [133] | 5246 | case IDM_TOOLTITLES:
|
|---|
| 5247 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
|---|
| [1335] | 5248 | &fToolTitles, TRUE, "ToolTitles");
|
|---|
| [1125] | 5249 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| [133] | 5250 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
|---|
| [1335] | 5251 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| [133] | 5252 | break;
|
|---|
| [2] | 5253 |
|
|---|
| [133] | 5254 | case IDM_HIDEMENU:
|
|---|
| 5255 | {
|
|---|
| [953] | 5256 | HWND hwndMenu = WinQueryWindowULong(hwnd, QWL_USER);
|
|---|
| 5257 | MenuInvisible = MenuInvisible ? FALSE : TRUE;
|
|---|
| [551] | 5258 | if (MenuInvisible) {
|
|---|
| [1335] | 5259 | WinSetParent(hwndMenu, HWND_OBJECT, FALSE);
|
|---|
| 5260 | WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 5261 | FID_SYSMENU), IDM_HIDEMENU,
|
|---|
| 5262 | GetPString(IDS_UNHIDEMENUTEXT));
|
|---|
| [2] | 5263 | }
|
|---|
| [551] | 5264 | else {
|
|---|
| [1335] | 5265 | WinSetParent(hwndMenu, WinQueryWindow(hwnd, QW_PARENT), FALSE);
|
|---|
| 5266 | WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 5267 | FID_SYSMENU), IDM_HIDEMENU,
|
|---|
| 5268 | GetPString(IDS_HIDEMENUTEXT));
|
|---|
| [133] | 5269 | }
|
|---|
| 5270 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
|---|
| [1335] | 5271 | MPFROMLONG(FCF_MENU), MPVOID);
|
|---|
| [133] | 5272 | PrfWriteProfileData(fmprof, FM3Str, "MenuInvisible",
|
|---|
| [1335] | 5273 | &MenuInvisible, sizeof(BOOL));
|
|---|
| [133] | 5274 | }
|
|---|
| 5275 | break;
|
|---|
| [2] | 5276 |
|
|---|
| [133] | 5277 | case IDM_SEEALL:
|
|---|
| 5278 | case IDM_GREP:
|
|---|
| 5279 | case IDM_COLLECTOR:
|
|---|
| 5280 | {
|
|---|
| 5281 | HWND hwndC;
|
|---|
| 5282 | SWP swp;
|
|---|
| 5283 | BOOL already = FALSE;
|
|---|
| 5284 |
|
|---|
| 5285 | if (Collector)
|
|---|
| [1335] | 5286 | already = TRUE;
|
|---|
| [133] | 5287 | if (!already && !fAutoTile && !fExternalCollector)
|
|---|
| [1335] | 5288 | GetNextWindowPos(hwnd, &swp, NULL, NULL);
|
|---|
| [735] | 5289 | hwndC = StartCollector(fExternalCollector ? HWND_DESKTOP : hwnd, 4);
|
|---|
| [551] | 5290 | if (hwndC) {
|
|---|
| [1335] | 5291 | if (!already && !fAutoTile && !fExternalCollector)
|
|---|
| 5292 | WinSetWindowPos(hwndC, HWND_TOP,
|
|---|
| 5293 | swp.x, swp.y, swp.cx, swp.cy,
|
|---|
| 5294 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
|---|
| 5295 | else if (fAutoTile && !already)
|
|---|
| 5296 | TileChildren(hwnd, TRUE);
|
|---|
| 5297 | WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE |
|
|---|
| 5298 | SWP_ACTIVATE);
|
|---|
| 5299 | if (SHORT1FROMMP(mp1) == IDM_GREP)
|
|---|
| 5300 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,
|
|---|
| 5301 | MPFROM2SHORT(IDM_GREP, 0), MPVOID);
|
|---|
| 5302 | if (SHORT1FROMMP(mp1) == IDM_SEEALL)
|
|---|
| 5303 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,
|
|---|
| 5304 | MPFROM2SHORT(IDM_SEEALL, 0), MPVOID);
|
|---|
| [2] | 5305 | }
|
|---|
| [133] | 5306 | }
|
|---|
| 5307 | break;
|
|---|
| [2] | 5308 |
|
|---|
| [1362] | 5309 | case IDM_DATABAR:
|
|---|
| 5310 | CreateDataBar(HWND_DESKTOP, 0);
|
|---|
| 5311 | break;
|
|---|
| 5312 |
|
|---|
| [133] | 5313 | case IDM_TOOLLEFT:
|
|---|
| 5314 | case IDM_TOOLRIGHT:
|
|---|
| 5315 | {
|
|---|
| 5316 | TOOL *tool;
|
|---|
| 5317 |
|
|---|
| [551] | 5318 | if (!toolhead || !toolhead->next) {
|
|---|
| [1335] | 5319 | firsttool = (toolhead) ? toolhead->id : 0;
|
|---|
| 5320 | break;
|
|---|
| [2] | 5321 | }
|
|---|
| [133] | 5322 | tool = find_tool(firsttool);
|
|---|
| 5323 | if (!tool)
|
|---|
| [1335] | 5324 | tool = toolhead;
|
|---|
| [551] | 5325 | if (SHORT1FROMMP(mp1) == IDM_TOOLRIGHT) {
|
|---|
| [1335] | 5326 | tool = prev_tool(tool, TRUE);
|
|---|
| 5327 | firsttool = tool->id;
|
|---|
| [133] | 5328 | }
|
|---|
| [551] | 5329 | else {
|
|---|
| [1335] | 5330 | tool = next_tool(tool, TRUE);
|
|---|
| 5331 | firsttool = tool->id;
|
|---|
| [133] | 5332 | }
|
|---|
| 5333 | ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 5334 | MAIN_TOOLS));
|
|---|
| [133] | 5335 | }
|
|---|
| 5336 | break;
|
|---|
| [2] | 5337 |
|
|---|
| [133] | 5338 | case IDM_CREATETOOL:
|
|---|
| [1125] | 5339 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| [133] | 5340 | break;
|
|---|
| [2] | 5341 |
|
|---|
| [133] | 5342 | case IDM_TOOLBAR:
|
|---|
| 5343 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| [1335] | 5344 | IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar");
|
|---|
| [1125] | 5345 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| [133] | 5346 | WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 5347 | MAIN_TOOLS), fToolbar);
|
|---|
| [133] | 5348 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 5349 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| [133] | 5350 | if (fDrivebar)
|
|---|
| 5351 | WinInvalidateRect(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 5352 | MAIN_DRIVES), NULL, TRUE);
|
|---|
| [133] | 5353 | break;
|
|---|
| [2] | 5354 |
|
|---|
| [133] | 5355 | case IDM_DRIVEBAR:
|
|---|
| 5356 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| [1335] | 5357 | IDM_DRIVEBAR, &fDrivebar, TRUE, "Drivebar");
|
|---|
| [133] | 5358 | WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 5359 | MAIN_DRIVES), fDrivebar);
|
|---|
| [133] | 5360 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 5361 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| [551] | 5362 | PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
|
|---|
| [133] | 5363 | break;
|
|---|
| [2] | 5364 |
|
|---|
| [133] | 5365 | case IDM_USERLIST:
|
|---|
| 5366 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| [1335] | 5367 | SHORT1FROMMP(mp1), &fUserComboBox, TRUE, "UserComboBox");
|
|---|
| [133] | 5368 | WinShowWindow(hwndUserlist, fUserComboBox);
|
|---|
| 5369 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 5370 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| [551] | 5371 | PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
|---|
| 5372 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
|---|
| 5373 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
|---|
| 5374 | PostMsg(hwnd, UM_FILLBUTTONLIST, MPVOID, MPVOID);
|
|---|
| [133] | 5375 | break;
|
|---|
| [2] | 5376 |
|
|---|
| [133] | 5377 | case IDM_MOREBUTTONS:
|
|---|
| 5378 | WinSetWindowText(hwndName, NullStr);
|
|---|
| 5379 | WinSetWindowText(hwndDate, NullStr);
|
|---|
| 5380 | WinSetWindowText(hwndAttr, NullStr);
|
|---|
| 5381 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| [1335] | 5382 | SHORT1FROMMP(mp1), &fMoreButtons, TRUE, "MoreButtons");
|
|---|
| [551] | 5383 | if (fMoreButtons) {
|
|---|
| [2] | 5384 |
|
|---|
| [133] | 5385 | HWND hwndTemp;
|
|---|
| [2] | 5386 |
|
|---|
| [551] | 5387 | hwndTemp = TopWindow(hwnd, (HWND) 0);
|
|---|
| [2] | 5388 |
|
|---|
| [551] | 5389 | if (hwndTemp) {
|
|---|
| [1335] | 5390 | WinSetFocus(HWND_DESKTOP, hwnd);
|
|---|
| 5391 | WinSetFocus(HWND_DESKTOP, hwndTemp);
|
|---|
| [2] | 5392 | }
|
|---|
| [133] | 5393 | }
|
|---|
| 5394 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 5395 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| [133] | 5396 | break;
|
|---|
| [2] | 5397 |
|
|---|
| [921] | 5398 | case IDM_TOGGLEDRAGDIALOG:
|
|---|
| 5399 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| [1335] | 5400 | IDM_TOGGLEDRAGDIALOG,
|
|---|
| 5401 | &fDragndropDlg,
|
|---|
| 5402 | TRUE,
|
|---|
| 5403 | "Drag&DropDlg");
|
|---|
| [921] | 5404 | break;
|
|---|
| 5405 |
|
|---|
| [925] | 5406 | case IDM_SYNCUPDATES:
|
|---|
| 5407 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| [1335] | 5408 | IDM_SYNCUPDATES,
|
|---|
| 5409 | &fSyncUpdates,
|
|---|
| 5410 | TRUE,
|
|---|
| 5411 | "SyncUpdates");
|
|---|
| [925] | 5412 | break;
|
|---|
| 5413 |
|
|---|
| [133] | 5414 | case IDM_FREETREE:
|
|---|
| [551] | 5415 | if (fFreeTree) {
|
|---|
| [133] | 5416 | SWP swp, swpT;
|
|---|
| [2] | 5417 |
|
|---|
| [133] | 5418 | WinQueryWindowPos(hwndTree, &swpT);
|
|---|
| 5419 | WinQueryWindowPos(hwnd, &swp);
|
|---|
| [551] | 5420 | WinSetWindowPos(hwndTree, HWND_TOP, 0, swp.cy - swpT.cy, 0, 0,
|
|---|
| [1335] | 5421 | SWP_MOVE);
|
|---|
| [133] | 5422 | }
|
|---|
| 5423 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
|---|
| [1335] | 5424 | &fFreeTree, TRUE, "FreeTree");
|
|---|
| [133] | 5425 | if (fAutoTile)
|
|---|
| 5426 | TileChildren(hwnd, TRUE);
|
|---|
| 5427 | break;
|
|---|
| [2] | 5428 |
|
|---|
| [133] | 5429 | case IDM_AUTOTILE:
|
|---|
| 5430 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| [1335] | 5431 | SHORT1FROMMP(mp1), &fAutoTile, TRUE, "AutoTile");
|
|---|
| [133] | 5432 | if (fAutoTile)
|
|---|
| 5433 | TileChildren(hwnd, TRUE);
|
|---|
| 5434 | break;
|
|---|
| [2] | 5435 |
|
|---|
| [133] | 5436 | case IDM_TILEBACKWARDS:
|
|---|
| 5437 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| [1335] | 5438 | SHORT1FROMMP(mp1), &fTileBackwards, TRUE, "TileBackwards");
|
|---|
| [133] | 5439 | if (fAutoTile)
|
|---|
| 5440 | TileChildren(hwnd, TRUE);
|
|---|
| 5441 | break;
|
|---|
| [2] | 5442 |
|
|---|
| [133] | 5443 | case IDM_NEXTWINDOW:
|
|---|
| 5444 | case IDM_PREVWINDOW:
|
|---|
| [551] | 5445 | NextChild(hwnd, (SHORT1FROMMP(mp1) == IDM_PREVWINDOW));
|
|---|
| [133] | 5446 | break;
|
|---|
| [2] | 5447 |
|
|---|
| [133] | 5448 | case IDM_CASCADE:
|
|---|
| 5449 | CascadeChildren(hwnd);
|
|---|
| 5450 | break;
|
|---|
| [2] | 5451 |
|
|---|
| [133] | 5452 | case IDM_TILE:
|
|---|
| 5453 | TileChildren(hwnd, TRUE);
|
|---|
| 5454 | break;
|
|---|
| [2] | 5455 |
|
|---|
| [133] | 5456 | case IDM_RESTORE:
|
|---|
| [551] | 5457 | MinResChildren(hwnd, SWP_RESTORE);
|
|---|
| [133] | 5458 | break;
|
|---|
| [2] | 5459 |
|
|---|
| [133] | 5460 | case IDM_MINIMIZE:
|
|---|
| [551] | 5461 | MinResChildren(hwnd, SWP_MINIMIZE);
|
|---|
| [133] | 5462 | break;
|
|---|
| [2] | 5463 |
|
|---|
| [133] | 5464 | case IDM_ARRANGEICONS:
|
|---|
| 5465 | ArrangeIcons(hwnd);
|
|---|
| 5466 | break;
|
|---|
| [2] | 5467 |
|
|---|
| [133] | 5468 | case IDM_INIVIEWER:
|
|---|
| 5469 | StartIniEditor(hwnd, NULL, 4);
|
|---|
| 5470 | break;
|
|---|
| [2] | 5471 |
|
|---|
| [133] | 5472 | case IDM_EDITASSOC:
|
|---|
| 5473 | EditAssociations(hwnd);
|
|---|
| 5474 | break;
|
|---|
| [2] | 5475 |
|
|---|
| [133] | 5476 | case IDM_EDITCOMMANDS:
|
|---|
| 5477 | EditCommands(hwnd);
|
|---|
| [551] | 5478 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
|---|
| [133] | 5479 | break;
|
|---|
| [2] | 5480 |
|
|---|
| [133] | 5481 | default:
|
|---|
| [551] | 5482 | if (!SwitchCommand((HWND) WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| [1335] | 5483 | SHORT1FROMMP(mp1))) {
|
|---|
| [133] | 5484 | if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
|
|---|
| [1335] | 5485 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
|
|---|
| [2] | 5486 |
|
|---|
| [1335] | 5487 | INT x;
|
|---|
| 5488 | HWND hwndCnr;
|
|---|
| [2] | 5489 |
|
|---|
| [1335] | 5490 | if (!cmdloaded)
|
|---|
| 5491 | load_commands();
|
|---|
| 5492 | hwndCnr = TopWindow(hwnd, (HWND) 0);
|
|---|
| 5493 | hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT),
|
|---|
| 5494 | UM_CONTAINERHWND, MPVOID, MPVOID);
|
|---|
| 5495 | if (!hwndCnr) {
|
|---|
| 5496 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT);
|
|---|
| 5497 | break;
|
|---|
| 5498 | }
|
|---|
| 5499 | x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
|
|---|
| 5500 | if (x >= 0) {
|
|---|
| 5501 | x++;
|
|---|
| 5502 | RunCommand(hwndCnr, x);
|
|---|
| 5503 | if (fUnHilite) {
|
|---|
| [2] | 5504 |
|
|---|
| [1335] | 5505 | PCNRITEM pci;
|
|---|
| 5506 | DIRCNRDATA *dcd = NULL;
|
|---|
| [2] | 5507 |
|
|---|
| [1335] | 5508 | // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR?
|
|---|
| 5509 | if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR)
|
|---|
| 5510 | dcd = INSTDATA(hwndCnr);
|
|---|
| 5511 | pci = (PCNRITEM) WinSendMsg(hwndCnr,
|
|---|
| 5512 | CM_QUERYRECORDEMPHASIS,
|
|---|
| 5513 | MPFROMLONG(CMA_FIRST),
|
|---|
| 5514 | MPFROMSHORT(CRA_CURSORED));
|
|---|
| 5515 | if (pci && (INT) pci != -1 &&
|
|---|
| 5516 | (pci->rc.flRecordAttr & CRA_SELECTED))
|
|---|
| 5517 | {
|
|---|
| 5518 | UnHilite(hwnd,
|
|---|
| 5519 | TRUE,
|
|---|
| 5520 | dcd ? &dcd->lastselection : NULL,
|
|---|
| 5521 | dcd ? dcd ->ulItemsToUnHilite : 0);
|
|---|
| 5522 | }
|
|---|
| 5523 | }
|
|---|
| 5524 | }
|
|---|
| [133] | 5525 | }
|
|---|
| 5526 | else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART &&
|
|---|
| [1335] | 5527 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 51) {
|
|---|
| 5528 | if (!qtloaded)
|
|---|
| 5529 | load_quicktools();
|
|---|
| 5530 | if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]) {
|
|---|
| 5531 | if (fToolsChanged)
|
|---|
| 5532 | save_tools(NULL);
|
|---|
| 5533 | if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]))
|
|---|
| 5534 | load_tools(NULL);
|
|---|
| 5535 | else {
|
|---|
| 5536 | strcpy(lasttoolbar,
|
|---|
| 5537 | quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]);
|
|---|
| 5538 | PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar);
|
|---|
| 5539 | }
|
|---|
| 5540 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| 5541 | }
|
|---|
| [133] | 5542 | }
|
|---|
| [551] | 5543 | else {
|
|---|
| [2] | 5544 |
|
|---|
| [1335] | 5545 | HWND hwndActive;
|
|---|
| [2] | 5546 |
|
|---|
| [1335] | 5547 | hwndActive = TopWindow(hwnd, (HWND) 0);
|
|---|
| 5548 | if (hwndActive)
|
|---|
| 5549 | PostMsg(WinWindowFromID(hwndActive, FID_CLIENT),
|
|---|
| 5550 | WM_COMMAND, mp1, mp2);
|
|---|
| [2] | 5551 | }
|
|---|
| [133] | 5552 | }
|
|---|
| [930] | 5553 | break; // default
|
|---|
| [824] | 5554 | } // switch mp1
|
|---|
| [2] | 5555 | return 0;
|
|---|
| 5556 | }
|
|---|
| 5557 |
|
|---|
| [551] | 5558 | static MRESULT EXPENTRY MainWMOnce(HWND hwnd, ULONG msg, MPARAM mp1,
|
|---|
| [1335] | 5559 | MPARAM mp2)
|
|---|
| [133] | 5560 | {
|
|---|
| [376] | 5561 | TID tid;
|
|---|
| 5562 | SWP swp;
|
|---|
| 5563 | PFNWP oldproc;
|
|---|
| 5564 | HWND hwndTmp;
|
|---|
| 5565 | HWND hwndFrame;
|
|---|
| 5566 | HWND hwndSysMenu, hwndSysSubMenu, hwndMenu;
|
|---|
| 5567 | USHORT idSysMenu;
|
|---|
| 5568 | MENUITEM mi, mit;
|
|---|
| 5569 | ULONG size;
|
|---|
| 5570 | BOOL temp = FALSE;
|
|---|
| 5571 |
|
|---|
| 5572 | switch (msg) {
|
|---|
| [133] | 5573 | case WM_CREATE:
|
|---|
| [551] | 5574 | WinQueryWindowProcess(hwnd, &mypid, &tid);
|
|---|
| [133] | 5575 | hwndMain = hwnd;
|
|---|
| 5576 | WinSetWindowUShort(hwnd, QWL_USER + 8, 0);
|
|---|
| 5577 | WinSetWindowUShort(hwnd, QWL_USER + 10, 0);
|
|---|
| 5578 | WinSetWindowUShort(hwnd, QWL_USER + 12, 0);
|
|---|
| 5579 | WinSetWindowUShort(hwnd, QWL_USER + 16, 0);
|
|---|
| [1335] | 5580 | if (xbeginthread(MakeMainObjWin,
|
|---|
| 5581 | 245760,
|
|---|
| 5582 | MPVOID,
|
|---|
| 5583 | pszSrcFile,
|
|---|
| 5584 | __LINE__) == -1)
|
|---|
| 5585 | {
|
|---|
| [551] | 5586 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
|---|
| [133] | 5587 | return 0;
|
|---|
| 5588 | }
|
|---|
| 5589 | else
|
|---|
| [771] | 5590 | DosSleep(32);//05 Aug 07 GKY 64
|
|---|
| [133] | 5591 |
|
|---|
| [376] | 5592 | hwndFrame = WinQueryWindow(hwnd, QW_PARENT);
|
|---|
| [133] | 5593 |
|
|---|
| [376] | 5594 | /*
|
|---|
| 5595 | * create frame children (not client children, frame children)
|
|---|
| 5596 | */
|
|---|
| [771] | 5597 | DosSleep(1);
|
|---|
| [376] | 5598 | WinQueryWindowPos(hwndFrame, &swp);
|
|---|
| [551] | 5599 | oldproc = WinSubclassWindow(hwndFrame, MainFrameWndProc);
|
|---|
| 5600 | WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
|
|---|
| [376] | 5601 | CommonCreateMainChildren(hwnd, &swp);
|
|---|
| 5602 |
|
|---|
| 5603 | if (!WinCreateWindow(hwndFrame,
|
|---|
| [1335] | 5604 | WC_BUTTON,
|
|---|
| 5605 | "I",
|
|---|
| 5606 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS,
|
|---|
| 5607 | ((swp.cx -
|
|---|
| 5608 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5609 | SV_CXMINMAXBUTTON)) -
|
|---|
| 5610 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5611 | SV_CXMINMAXBUTTON) / 2) -
|
|---|
| 5612 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5613 | SV_CXSIZEBORDER),
|
|---|
| 5614 | (swp.cy - WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5615 | SV_CYMINMAXBUTTON)) -
|
|---|
| 5616 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5617 | SV_CYSIZEBORDER),
|
|---|
| 5618 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5619 | SV_CXMINMAXBUTTON) / 2,
|
|---|
| 5620 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5621 | SV_CYMINMAXBUTTON),
|
|---|
| 5622 | hwnd, HWND_TOP, IDM_IDEALSIZE, NULL, NULL)) {
|
|---|
| [551] | 5623 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| [376] | 5624 | }
|
|---|
| 5625 | else {
|
|---|
| [551] | 5626 | WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_IDEALSIZE),
|
|---|
| [1391] | 5627 | IdealButtonProc);
|
|---|
| 5628 | //fixme to allow user to change presparams 1-10-09 GKY
|
|---|
| [376] | 5629 | SetPresParams(WinWindowFromID(hwndFrame,
|
|---|
| [1335] | 5630 | IDM_IDEALSIZE),
|
|---|
| [1391] | 5631 | NULL, NULL, NULL, FNT_10SYSTEMVIO);
|
|---|
| [376] | 5632 | }
|
|---|
| [2] | 5633 |
|
|---|
| [376] | 5634 | hwndTmp = WinCreateWindow(hwndFrame,
|
|---|
| [1335] | 5635 | WC_BUTTON,
|
|---|
| 5636 | "#1019",
|
|---|
| 5637 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
|
|---|
| 5638 | BS_BITMAP,
|
|---|
| 5639 | swp.cx - 46,
|
|---|
| 5640 | swp.y + 2,
|
|---|
| 5641 | 24,
|
|---|
| 5642 | 22, hwnd, HWND_TOP, IDM_OPENWALK, NULL, NULL);
|
|---|
| [376] | 5643 | if (!hwndTmp)
|
|---|
| [551] | 5644 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| [2] | 5645 |
|
|---|
| [376] | 5646 | hwndTmp = WinCreateWindow(hwndFrame,
|
|---|
| [1335] | 5647 | WC_BUTTON,
|
|---|
| 5648 | "#3062",
|
|---|
| 5649 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
|
|---|
| 5650 | BS_BITMAP,
|
|---|
| 5651 | swp.cx - 22,
|
|---|
| 5652 | swp.y + 2,
|
|---|
| 5653 | 24,
|
|---|
| 5654 | 22, hwnd, HWND_TOP, IDM_USERLIST, NULL, NULL);
|
|---|
| [376] | 5655 | if (!hwndTmp)
|
|---|
| [551] | 5656 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| [376] | 5657 |
|
|---|
| 5658 | hwndUserlist = WinCreateWindow(hwndFrame,
|
|---|
| [1335] | 5659 | WC_COMBOBOX,
|
|---|
| 5660 | (PSZ) NULL,
|
|---|
| 5661 | WS_VISIBLE | CBS_DROPDOWN |
|
|---|
| 5662 | LS_HORZSCROLL,
|
|---|
| 5663 | (swp.x +
|
|---|
| 5664 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5665 | SV_CXSIZEBORDER) + 48L),
|
|---|
| 5666 | (swp.cy -
|
|---|
| 5667 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5668 | SV_CYSIZEBORDER)) - 60,
|
|---|
| 5669 | ((swp.cx -
|
|---|
| 5670 | (WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5671 | SV_CXSIZEBORDER) *
|
|---|
| 5672 | 2)) - 64L), 60L, hwndFrame, HWND_TOP,
|
|---|
| 5673 | MAIN_USERLIST, NULL, NULL);
|
|---|
| [376] | 5674 | if (!hwndUserlist)
|
|---|
| [551] | 5675 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| [376] | 5676 | hwndCmdlist = WinCreateWindow(hwndFrame,
|
|---|
| [1335] | 5677 | WC_COMBOBOX,
|
|---|
| 5678 | (PSZ) NULL,
|
|---|
| 5679 | WS_VISIBLE | CBS_DROPDOWN |
|
|---|
| 5680 | LS_HORZSCROLL,
|
|---|
| 5681 | (swp.x +
|
|---|
| 5682 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5683 | SV_CXSIZEBORDER) + 48L),
|
|---|
| 5684 | (swp.cy -
|
|---|
| 5685 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5686 | SV_CYSIZEBORDER)) - 60,
|
|---|
| 5687 | ((swp.cx -
|
|---|
| 5688 | (WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5689 | SV_CXSIZEBORDER) * 2)) -
|
|---|
| 5690 | 64L), 60L, hwndFrame, HWND_TOP,
|
|---|
| 5691 | MAIN_CMDLIST, NULL, NULL);
|
|---|
| [376] | 5692 | if (!hwndCmdlist)
|
|---|
| [551] | 5693 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| 5694 | WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));
|
|---|
| [376] | 5695 | hwndStatelist = WinCreateWindow(hwndFrame,
|
|---|
| [1335] | 5696 | WC_COMBOBOX,
|
|---|
| 5697 | (PSZ) NULL,
|
|---|
| 5698 | WS_VISIBLE | CBS_DROPDOWN |
|
|---|
| 5699 | LS_HORZSCROLL,
|
|---|
| 5700 | (swp.x +
|
|---|
| 5701 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5702 | SV_CXSIZEBORDER) + 48L),
|
|---|
| 5703 | (swp.cy -
|
|---|
| 5704 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5705 | SV_CYSIZEBORDER)) - 60,
|
|---|
| 5706 | ((swp.cx -
|
|---|
| 5707 | (WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5708 | SV_CXSIZEBORDER) *
|
|---|
| 5709 | 2)) - 64L), 60L, hwndFrame, HWND_TOP,
|
|---|
| 5710 | MAIN_SETUPLIST, NULL, NULL);
|
|---|
| [376] | 5711 | if (!hwndStatelist)
|
|---|
| [551] | 5712 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| [824] | 5713 |
|
|---|
| [376] | 5714 | hwndDrivelist = WinCreateWindow(hwndFrame,
|
|---|
| [1335] | 5715 | WC_COMBOBOX,
|
|---|
| 5716 | (PSZ) NULL,
|
|---|
| [1354] | 5717 | //WS_VISIBLE |
|
|---|
| 5718 | CBS_DROPDOWN,
|
|---|
| [1335] | 5719 | (swp.x +
|
|---|
| 5720 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5721 | SV_CXSIZEBORDER)),
|
|---|
| 5722 | (swp.cy -
|
|---|
| 5723 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5724 | SV_CYSIZEBORDER)) - 60,
|
|---|
| 5725 | 48L,
|
|---|
| 5726 | 60L,
|
|---|
| 5727 | hwndFrame,
|
|---|
| 5728 | HWND_TOP, MAIN_DRIVELIST, NULL, NULL);
|
|---|
| [376] | 5729 | if (!hwndDrivelist)
|
|---|
| [551] | 5730 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| [1391] | 5731 | //fixme to allow user to change presparams 1-10-09 GKY
|
|---|
| [376] | 5732 | SetPresParams(hwndDrivelist,
|
|---|
| [1391] | 5733 | NULL, NULL, NULL, "10.System Monospaced");
|
|---|
| [376] | 5734 | hwndButtonlist = WinCreateWindow(hwndFrame,
|
|---|
| [1335] | 5735 | WC_COMBOBOX,
|
|---|
| 5736 | (PSZ) NULL,
|
|---|
| 5737 | WS_VISIBLE | CBS_DROPDOWN |
|
|---|
| 5738 | LS_HORZSCROLL,
|
|---|
| 5739 | (swp.cx -
|
|---|
| 5740 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5741 | SV_CXSIZEBORDER)) -
|
|---|
| 5742 | 164L,
|
|---|
| 5743 | (swp.cy -
|
|---|
| 5744 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5745 | SV_CYSIZEBORDER)) - 60,
|
|---|
| 5746 | 164L, 60L, hwndFrame, HWND_TOP,
|
|---|
| 5747 | MAIN_BUTTONLIST, NULL, NULL);
|
|---|
| [376] | 5748 | if (!hwndButtonlist)
|
|---|
| [551] | 5749 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| [376] | 5750 | WinSendMsg(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
|---|
| [1335] | 5751 | EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
|
|---|
| [376] | 5752 | WinSendMsg(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
|---|
| [1335] | 5753 | EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID);
|
|---|
| [376] | 5754 | WinSendMsg(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
|---|
| [1335] | 5755 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
|---|
| [376] | 5756 | WinSendMsg(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
|---|
| [1335] | 5757 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
|---|
| [376] | 5758 | WinSendMsg(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
|---|
| [1335] | 5759 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
|---|
| [376] | 5760 |
|
|---|
| 5761 | oldproc = WinSubclassWindow(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
|---|
| [1335] | 5762 | DropDownListProc);
|
|---|
| [376] | 5763 | WinSetWindowPtr(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
|---|
| [1335] | 5764 | QWL_USER, (PVOID) oldproc);
|
|---|
| [376] | 5765 | oldproc = WinSubclassWindow(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
|---|
| [1335] | 5766 | DropDownListProc);
|
|---|
| [376] | 5767 | WinSetWindowPtr(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
|---|
| [1335] | 5768 | QWL_USER, (PVOID) oldproc);
|
|---|
| [376] | 5769 | oldproc = WinSubclassWindow(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
|---|
| [1335] | 5770 | DropDownListProc);
|
|---|
| [376] | 5771 | WinSetWindowPtr(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
|---|
| [1335] | 5772 | QWL_USER, (PVOID) oldproc);
|
|---|
| [376] | 5773 | oldproc = WinSubclassWindow(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
|---|
| [1335] | 5774 | DropDownListProc);
|
|---|
| [376] | 5775 | WinSetWindowPtr(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
|---|
| [1335] | 5776 | QWL_USER, (PVOID) oldproc);
|
|---|
| [376] | 5777 | oldproc = WinSubclassWindow(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
|---|
| [1335] | 5778 | DropDownListProc);
|
|---|
| [376] | 5779 | WinSetWindowPtr(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
|---|
| [1335] | 5780 | QWL_USER, (PVOID) oldproc);
|
|---|
| [551] | 5781 | oldproc = WinSubclassWindow(hwndUserlist, DropDownListProc);
|
|---|
| 5782 | WinSetWindowPtr(hwndUserlist, QWL_USER, (PVOID) oldproc);
|
|---|
| 5783 | oldproc = WinSubclassWindow(hwndCmdlist, DropDownListProc);
|
|---|
| 5784 | WinSetWindowPtr(hwndCmdlist, QWL_USER, (PVOID) oldproc);
|
|---|
| 5785 | oldproc = WinSubclassWindow(hwndStatelist, DropDownListProc);
|
|---|
| 5786 | WinSetWindowPtr(hwndStatelist, QWL_USER, (PVOID) oldproc);
|
|---|
| 5787 | oldproc = WinSubclassWindow(hwndDrivelist, DropDownListProc);
|
|---|
| [376] | 5788 | WinSetWindowPtr(hwndDrivelist, QWL_USER, (PVOID) oldproc);
|
|---|
| [551] | 5789 | oldproc = WinSubclassWindow(hwndButtonlist, DropDownListProc);
|
|---|
| 5790 | WinSetWindowPtr(hwndButtonlist, QWL_USER, (PVOID) oldproc);
|
|---|
| 5791 | oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_USERLIST),
|
|---|
| [1335] | 5792 | ChildFrameButtonProc);
|
|---|
| [551] | 5793 | WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_USERLIST),
|
|---|
| [1335] | 5794 | QWL_USER, (PVOID) oldproc);
|
|---|
| [551] | 5795 | oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_OPENWALK),
|
|---|
| [1335] | 5796 | ChildFrameButtonProc);
|
|---|
| [551] | 5797 | WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_OPENWALK),
|
|---|
| [1335] | 5798 | QWL_USER, (PVOID) oldproc);
|
|---|
| [551] | 5799 | hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
|
|---|
| 5800 | WinSendMsg(hwnd, UM_ADDTOMENU, MPVOID, MPVOID);
|
|---|
| [376] | 5801 | SetToggleChecks(hwndMenu);
|
|---|
| [1027] | 5802 | CfgMenuInit(hwndMenu, FALSE); // 14 Feb 08 SHL
|
|---|
| [933] | 5803 | SetConditionalCascade(hwndMenu, IDM_COMMANDLINESUBMENU, IDM_COMMANDLINE);
|
|---|
| [1369] | 5804 | if (fProtectOnly) {
|
|---|
| 5805 | WinEnableMenuItem(hwndMenu, IDM_DOSCOMMANDLINE, FALSE);
|
|---|
| 5806 | WinEnableMenuItem(hwndMenu, IDM_WINFULLSCREEN, FALSE);
|
|---|
| 5807 | }
|
|---|
| [551] | 5808 | SetConditionalCascade(hwndMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
|
|---|
| 5809 | SetConditionalCascade(hwndMenu, IDM_AUTOVIEWSUBMENU, IDM_AUTOVIEW);
|
|---|
| 5810 | SetConditionalCascade(hwndMenu, IDM_TILEMENU, IDM_TILE);
|
|---|
| 5811 | WinSetWindowULong(hwnd, QWL_USER, hwndMenu);
|
|---|
| [376] | 5812 | memset(&mi, 0, sizeof(mi));
|
|---|
| 5813 | memset(&mit, 0, sizeof(mit));
|
|---|
| [551] | 5814 | hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU);
|
|---|
| [376] | 5815 | idSysMenu = SHORT1FROMMR(WinSendMsg(hwndSysMenu,
|
|---|
| [1335] | 5816 | MM_ITEMIDFROMPOSITION,
|
|---|
| 5817 | MPVOID, MPVOID));
|
|---|
| [376] | 5818 | WinSendMsg(hwndSysMenu,
|
|---|
| [1335] | 5819 | MM_QUERYITEM, MPFROM2SHORT(idSysMenu, 0), MPFROMP(&mit));
|
|---|
| [376] | 5820 | hwndSysSubMenu = mit.hwndSubMenu;
|
|---|
| 5821 | mi.iPosition = MIT_END;
|
|---|
| 5822 | mi.afStyle = MIS_SEPARATOR;
|
|---|
| [551] | 5823 | mi.id = (USHORT) - 1;
|
|---|
| 5824 | WinSendMsg(hwndSysSubMenu, MM_INSERTITEM, MPFROMP(&mi), MPFROMP(NULL));
|
|---|
| [376] | 5825 | mi.afStyle = MIS_TEXT;
|
|---|
| 5826 | mi.id = IDM_IDEALSIZE;
|
|---|
| 5827 | WinSendMsg(hwndSysSubMenu,
|
|---|
| [1335] | 5828 | MM_INSERTITEM,
|
|---|
| 5829 | MPFROMP(&mi), MPFROMP(GetPString(IDS_IDEALMENUTEXT)));
|
|---|
| [376] | 5830 | mi.afStyle = MIS_TEXT;
|
|---|
| 5831 | mi.id = IDM_HIDEMENU;
|
|---|
| 5832 | WinSendMsg(hwndSysSubMenu,
|
|---|
| [1335] | 5833 | MM_INSERTITEM,
|
|---|
| 5834 | MPFROMP(&mi), MPFROMP(GetPString(IDS_HIDEMENUTEXT)));
|
|---|
| [376] | 5835 | SetSysMenu(hwndSysMenu);
|
|---|
| 5836 |
|
|---|
| 5837 | size = sizeof(BOOL);
|
|---|
| 5838 | if (PrfQueryProfileData(fmprof,
|
|---|
| [1335] | 5839 | FM3Str,
|
|---|
| 5840 | "MenuInvisible", &temp, &size) && size && temp)
|
|---|
| [551] | 5841 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
|
|---|
| [376] | 5842 | size = sizeof(BOOL);
|
|---|
| 5843 | if (PrfQueryProfileData(fmprof,
|
|---|
| [1335] | 5844 | FM3Str, "FreeTree", &temp, &size) && size && temp)
|
|---|
| [551] | 5845 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID);
|
|---|
| [376] | 5846 | size = sizeof(BOOL);
|
|---|
| 5847 | if (PrfQueryProfileData(fmprof,
|
|---|
| [1335] | 5848 | FM3Str,
|
|---|
| 5849 | "AutoTile", &temp, &size) && size && !temp)
|
|---|
| [551] | 5850 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID);
|
|---|
| [376] | 5851 | size = sizeof(BOOL);
|
|---|
| 5852 | if (PrfQueryProfileData(fmprof,
|
|---|
| [1335] | 5853 | FM3Str, "Toolbar", &temp, &size) && size && !temp)
|
|---|
| [551] | 5854 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
|
|---|
| [2] | 5855 |
|
|---|
| [551] | 5856 | WinSetWindowText(WinWindowFromID(hwndFrame, FID_TITLEBAR), "FM/2");
|
|---|
| 5857 | FixSwitchList(hwndFrame, NULL);
|
|---|
| [930] | 5858 | break; // WM_CREATE
|
|---|
| [2] | 5859 |
|
|---|
| [133] | 5860 | case UM_SETUP:
|
|---|
| 5861 | /*
|
|---|
| 5862 | * start up some initial children
|
|---|
| 5863 | */
|
|---|
| [551] | 5864 | WinShowWindow(WinQueryWindow(hwnd, QW_PARENT), TRUE);
|
|---|
| 5865 | PostMsg(MainObjectHwnd, UM_SETUP2, mp1, mp2);
|
|---|
| [133] | 5866 | return 0;
|
|---|
| [2] | 5867 |
|
|---|
| [133] | 5868 | case UM_SETUP2:
|
|---|
| 5869 | {
|
|---|
| 5870 | SWP swp;
|
|---|
| 5871 | ULONG size = sizeof(SWP);
|
|---|
| [2] | 5872 |
|
|---|
| [133] | 5873 | WinQueryWindowPos(hwnd, &swp);
|
|---|
| [947] | 5874 | hwndTree = StartTreeCnr(hwnd, 4);
|
|---|
| [133] | 5875 | if (!hwndTree)
|
|---|
| [1335] | 5876 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
|---|
| [551] | 5877 | else {
|
|---|
| [1335] | 5878 | if (!fSaveState ||
|
|---|
| 5879 | !PrfQueryProfileData(fmprof,
|
|---|
| 5880 | FM3Str,
|
|---|
| 5881 | "LastTreePos",
|
|---|
| 5882 | &swp, &size) || size != sizeof(SWP)) {
|
|---|
| [2] | 5883 |
|
|---|
| [1335] | 5884 | INT ratio, height = 0;
|
|---|
| [2] | 5885 |
|
|---|
| [1335] | 5886 | if (!fNoTreeGap)
|
|---|
| 5887 | height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
|---|
| 5888 | size = sizeof(ratio);
|
|---|
| 5889 | if (!PrfQueryProfileData(fmprof,
|
|---|
| 5890 | FM3Str,
|
|---|
| 5891 | "TreeWindowRatio",
|
|---|
| 5892 | (PVOID) & ratio,
|
|---|
| 5893 | &size) || size < sizeof(ratio))
|
|---|
| 5894 | ratio = 400;
|
|---|
| 5895 | WinSetWindowPos(hwndTree,
|
|---|
| 5896 | HWND_TOP,
|
|---|
| 5897 | 0,
|
|---|
| 5898 | height,
|
|---|
| 5899 | (swp.cx * 100) / ratio,
|
|---|
| 5900 | swp.cy - height,
|
|---|
| 5901 | SWP_SHOW | SWP_SIZE | SWP_MOVE |
|
|---|
| 5902 | SWP_ACTIVATE | SWP_ZORDER);
|
|---|
| 5903 | }
|
|---|
| 5904 | else
|
|---|
| 5905 | WinSetWindowPos(hwndTree,
|
|---|
| 5906 | HWND_TOP,
|
|---|
| 5907 | swp.x,
|
|---|
| 5908 | swp.y,
|
|---|
| 5909 | swp.cx,
|
|---|
| 5910 | swp.cy,
|
|---|
| 5911 | swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW |
|
|---|
| 5912 | SWP_ZORDER | SWP_ACTIVATE);
|
|---|
| [133] | 5913 | }
|
|---|
| [1125] | 5914 | // ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1209] | 5915 | // MAIN_TOOLS));
|
|---|
| [133] | 5916 | }
|
|---|
| [551] | 5917 | PostMsg(MainObjectHwnd, UM_SETUP3, mp1, mp2);
|
|---|
| [133] | 5918 | return 0;
|
|---|
| [2] | 5919 |
|
|---|
| [133] | 5920 | case UM_SETUP3:
|
|---|
| 5921 | /* start remaining child windows */
|
|---|
| [1025] | 5922 | if (!fNoSaveState && fSaveState) {
|
|---|
| [1046] | 5923 | PSZ pszStatename = GetPString(IDS_SHUTDOWNSTATE);
|
|---|
| 5924 | PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszStatename), MPVOID);
|
|---|
| 5925 | if (!add_setup(pszStatename))
|
|---|
| [1335] | 5926 | save_setups();
|
|---|
| [1125] | 5927 | } else {
|
|---|
| 5928 | load_tools(NULL);
|
|---|
| 5929 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| [1025] | 5930 | }
|
|---|
| [551] | 5931 | PostMsg(MainObjectHwnd, UM_SETUP4, mp1, mp2);
|
|---|
| [133] | 5932 | return 0;
|
|---|
| [2] | 5933 |
|
|---|
| [133] | 5934 | case UM_SETUP4:
|
|---|
| 5935 | {
|
|---|
| 5936 | INT argc = (INT) mp1, x;
|
|---|
| 5937 | CHAR **argv = (CHAR **) mp2;
|
|---|
| [2] | 5938 |
|
|---|
| [376] | 5939 | for (x = 1; x < argc; x++) {
|
|---|
| [1335] | 5940 | if (*argv[x] == '/' || *argv[x] == ';')
|
|---|
| 5941 | continue;
|
|---|
| 5942 | if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE)) {
|
|---|
| 5943 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]);
|
|---|
| 5944 | }
|
|---|
| [2] | 5945 | }
|
|---|
| [133] | 5946 | }
|
|---|
| [551] | 5947 | PostMsg(MainObjectHwnd, UM_SETUP5, MPVOID, MPVOID);
|
|---|
| [133] | 5948 | return 0;
|
|---|
| [2] | 5949 |
|
|---|
| [133] | 5950 | case UM_SETUP5:
|
|---|
| [1033] | 5951 | // if (fAutoTile)
|
|---|
| 5952 | // TileChildren(hwnd, TRUE);
|
|---|
| [551] | 5953 | PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
|---|
| 5954 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
|---|
| 5955 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
|---|
| 5956 | PostMsg(hwnd, UM_FILLBUTTONLIST, MPVOID, MPVOID);
|
|---|
| [133] | 5957 | {
|
|---|
| 5958 | HWND hwndActive;
|
|---|
| [2] | 5959 |
|
|---|
| [133] | 5960 | hwndActive = TopWindow(hwnd, hwndTree);
|
|---|
| 5961 | if (hwndActive)
|
|---|
| [1335] | 5962 | WinSetWindowPos(hwndActive, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
|
|---|
| [133] | 5963 | }
|
|---|
| [376] | 5964 | if (fStartMinimized || fReminimize)
|
|---|
| [551] | 5965 | PostMsg(hwndTree, UM_MINIMIZE, MPVOID, MPVOID);
|
|---|
| [133] | 5966 | else if (fStartMaximized)
|
|---|
| [551] | 5967 | PostMsg(hwndTree, UM_MAXIMIZE, MPVOID, MPVOID);
|
|---|
| [133] | 5968 | fRunning = TRUE;
|
|---|
| [917] | 5969 | if (fWantFirstTimeInit) {
|
|---|
| 5970 | fWantFirstTimeInit = FALSE;
|
|---|
| 5971 | PostMsg(hwnd, WM_COMMAND, MPFROMLONG(IDM_QUICKSETTINGS), MPVOID);
|
|---|
| 5972 | }
|
|---|
| [133] | 5973 | return 0;
|
|---|
| [2] | 5974 | }
|
|---|
| 5975 |
|
|---|
| [133] | 5976 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 5977 | }
|
|---|
| 5978 |
|
|---|
| [133] | 5979 | MRESULT EXPENTRY MainWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 5980 | {
|
|---|
| [551] | 5981 | switch (msg) {
|
|---|
| [133] | 5982 | case WM_CREATE:
|
|---|
| [1077] | 5983 | # ifdef FORTIFY
|
|---|
| 5984 | Fortify_EnterScope();
|
|---|
| 5985 | # endif
|
|---|
| [133] | 5986 | case UM_SETUP:
|
|---|
| 5987 | case UM_SETUP2:
|
|---|
| 5988 | case UM_SETUP3:
|
|---|
| 5989 | case UM_SETUP4:
|
|---|
| 5990 | case UM_SETUP5:
|
|---|
| 5991 | return MainWMOnce(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 5992 |
|
|---|
| [133] | 5993 | case WM_CONTROLPOINTER:
|
|---|
| 5994 | if (!fNoFinger &&
|
|---|
| [1335] | 5995 | (SHORT1FROMMP(mp1) == IDM_OPENWALK ||
|
|---|
| 5996 | SHORT1FROMMP(mp1) == IDM_USERLIST))
|
|---|
| [133] | 5997 | return MRFROMLONG(hptrFinger);
|
|---|
| 5998 | break;
|
|---|
| [2] | 5999 |
|
|---|
| [133] | 6000 | case UM_LOADFILE:
|
|---|
| 6001 | case UM_THREADUSE:
|
|---|
| [260] | 6002 | case UM_BUILDDRIVEBAR:
|
|---|
| [133] | 6003 | return CommonMainWndProc(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 6004 |
|
|---|
| [133] | 6005 | case WM_BUTTON1UP:
|
|---|
| 6006 | case WM_BUTTON2UP:
|
|---|
| 6007 | case WM_BUTTON3UP:
|
|---|
| 6008 | case WM_MOUSEMOVE:
|
|---|
| 6009 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 6010 | break;
|
|---|
| [2] | 6011 |
|
|---|
| [133] | 6012 | case WM_CHAR:
|
|---|
| 6013 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
|---|
| 6014 | break;
|
|---|
| [2] | 6015 |
|
|---|
| [133] | 6016 | case WM_MENUEND:
|
|---|
| [551] | 6017 | if ((HWND) mp2 == MainPopupMenu) {
|
|---|
| [133] | 6018 | WinDestroyWindow(MainPopupMenu);
|
|---|
| [551] | 6019 | MainPopupMenu = (HWND) 0;
|
|---|
| [133] | 6020 | }
|
|---|
| 6021 | break;
|
|---|
| [2] | 6022 |
|
|---|
| [133] | 6023 | case UM_CONTEXTMENU:
|
|---|
| 6024 | case WM_CONTEXTMENU:
|
|---|
| [875] | 6025 | if (CheckMenu(hwndMainMenu, &MainPopupMenu, MAIN_POPUP)) {
|
|---|
| [133] | 6026 | SetToggleChecks(MainPopupMenu);
|
|---|
| 6027 | PopupMenu(hwnd, hwnd, MainPopupMenu);
|
|---|
| 6028 | }
|
|---|
| 6029 | if (msg == UM_CONTEXTMENU)
|
|---|
| 6030 | return 0;
|
|---|
| 6031 | return MRFROMSHORT(TRUE);
|
|---|
| [2] | 6032 |
|
|---|
| [133] | 6033 | case UM_SETUSERLISTNAME:
|
|---|
| [551] | 6034 | if (mp1) {
|
|---|
| [133] | 6035 | if (fUserComboBox)
|
|---|
| [1335] | 6036 | WinSetWindowText(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
|---|
| 6037 | (CHAR *)mp1);
|
|---|
| [1009] | 6038 | if (add_udir(FALSE, (CHAR *)mp1)) {
|
|---|
| [1335] | 6039 | if (fUserComboBox && fAutoAddDirs) {
|
|---|
| 6040 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
|---|
| 6041 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
|---|
| 6042 | MPFROMP((CHAR *)mp1));
|
|---|
| 6043 | }
|
|---|
| [133] | 6044 | }
|
|---|
| 6045 | }
|
|---|
| 6046 | return 0;
|
|---|
| [2] | 6047 |
|
|---|
| [133] | 6048 | case UM_ARRANGEICONS:
|
|---|
| 6049 | ArrangeIcons(hwnd);
|
|---|
| 6050 | return 0;
|
|---|
| [2] | 6051 |
|
|---|
| [133] | 6052 | case WM_CHORD:
|
|---|
| [551] | 6053 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
|---|
| [133] | 6054 | break;
|
|---|
| [2] | 6055 |
|
|---|
| [133] | 6056 | case WM_SETFOCUS:
|
|---|
| 6057 | if (mp2)
|
|---|
| [551] | 6058 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
|---|
| [133] | 6059 | break;
|
|---|
| [2] | 6060 |
|
|---|
| [133] | 6061 | case UM_FOCUSME:
|
|---|
| [551] | 6062 | WinSetFocus(hwndTree, TRUE);
|
|---|
| [133] | 6063 | return 0;
|
|---|
| [2] | 6064 |
|
|---|
| [133] | 6065 | case UM_RESCAN:
|
|---|
| 6066 | TileChildren(hwnd, TRUE);
|
|---|
| 6067 | return 0;
|
|---|
| [2] | 6068 |
|
|---|
| [133] | 6069 | case WM_SAVEAPPLICATION:
|
|---|
| 6070 | {
|
|---|
| 6071 | SWP swp;
|
|---|
| [2] | 6072 |
|
|---|
| [133] | 6073 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
|---|
| [551] | 6074 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) {
|
|---|
| [1335] | 6075 | WinStoreWindowPos(FM2Str,
|
|---|
| 6076 | "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT));
|
|---|
| 6077 | if (!fNoSaveState && fSaveState)
|
|---|
| 6078 | SaveDirCnrState(hwnd, GetPString(IDS_SHUTDOWNSTATE));
|
|---|
| [133] | 6079 | }
|
|---|
| 6080 | }
|
|---|
| 6081 | break;
|
|---|
| [2] | 6082 |
|
|---|
| [133] | 6083 | case MM_PORTHOLEINIT:
|
|---|
| [551] | 6084 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| [133] | 6085 | case 0:
|
|---|
| 6086 | case 1:
|
|---|
| 6087 | {
|
|---|
| [1335] | 6088 | HWND hwndCurrent;
|
|---|
| 6089 | ULONG wmsg;
|
|---|
| [2] | 6090 |
|
|---|
| [1335] | 6091 | wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
|
|---|
| 6092 | hwndCurrent = TopWindow(hwnd, (HWND) 0);
|
|---|
| 6093 | PortholeInit((HWND) WinSendMsg(WinWindowFromID(hwndCurrent,
|
|---|
| 6094 | FID_CLIENT), wmsg,
|
|---|
| 6095 | MPVOID, MPVOID), mp1, mp2);
|
|---|
| [133] | 6096 | }
|
|---|
| 6097 | break;
|
|---|
| 6098 | }
|
|---|
| 6099 | break;
|
|---|
| [2] | 6100 |
|
|---|
| [133] | 6101 | case WM_INITMENU:
|
|---|
| [551] | 6102 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| [133] | 6103 | case IDM_CONFIGMENU:
|
|---|
| [551] | 6104 | SetToggleChecks((HWND) WinQueryWindowULong(hwnd, QWL_USER));
|
|---|
| [133] | 6105 | break;
|
|---|
| [2] | 6106 |
|
|---|
| [133] | 6107 | case IDM_WINDOWSMENU:
|
|---|
| 6108 | /*
|
|---|
| 6109 | * add child windows of client
|
|---|
| 6110 | * and switchlist entries to end of pulldown menu
|
|---|
| 6111 | */
|
|---|
| 6112 | {
|
|---|
| [1335] | 6113 | HWND hwndMenu, hwndSubMenu;
|
|---|
| 6114 | MENUITEM mi;
|
|---|
| [2] | 6115 |
|
|---|
| [1335] | 6116 | hwndMenu = WinQueryWindowULong(hwnd, QWL_USER);
|
|---|
| 6117 | memset(&mi, 0, sizeof(mi));
|
|---|
| 6118 | mi.iPosition = MIT_END;
|
|---|
| 6119 | mi.afStyle = MIS_TEXT;
|
|---|
| 6120 | if (!WinSendMsg(hwndMenu, MM_QUERYITEM,
|
|---|
| 6121 | MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))
|
|---|
| 6122 | break;
|
|---|
| 6123 | hwndSubMenu = mi.hwndSubMenu;
|
|---|
| 6124 | SetupWinList(hwndSubMenu, hwnd, WinQueryWindow(hwnd, QW_PARENT));
|
|---|
| [133] | 6125 | }
|
|---|
| 6126 | break;
|
|---|
| [2] | 6127 |
|
|---|
| [133] | 6128 | default:
|
|---|
| 6129 | {
|
|---|
| [1335] | 6130 | HWND hwndCurrent;
|
|---|
| [2] | 6131 |
|
|---|
| [1335] | 6132 | hwndCurrent = TopWindow(hwnd, (HWND) 0);
|
|---|
| 6133 | if (hwndCurrent)
|
|---|
| 6134 | WinSendMsg(hwndCurrent, UM_INITMENU, mp1, mp2);
|
|---|
| [133] | 6135 | }
|
|---|
| 6136 | break;
|
|---|
| 6137 | }
|
|---|
| 6138 | break;
|
|---|
| [2] | 6139 |
|
|---|
| [133] | 6140 | case UM_ADDTOMENU:
|
|---|
| [1009] | 6141 | AddToMenu((CHAR *)mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 6142 | FID_MENU));
|
|---|
| [133] | 6143 | return 0;
|
|---|
| [2] | 6144 |
|
|---|
| [133] | 6145 | case UM_FILLCMDLIST:
|
|---|
| 6146 | WinSendMsg(hwndCmdlist, LM_DELETEALL, MPVOID, MPVOID);
|
|---|
| 6147 | if (!cmdloaded)
|
|---|
| 6148 | load_commands();
|
|---|
| [551] | 6149 | if (cmdhead) {
|
|---|
| [2] | 6150 |
|
|---|
| [133] | 6151 | LINKCMDS *info;
|
|---|
| [2] | 6152 |
|
|---|
| [133] | 6153 | info = cmdhead;
|
|---|
| [551] | 6154 | while (info) {
|
|---|
| [1335] | 6155 | WinSendMsg(hwndCmdlist, LM_INSERTITEM,
|
|---|
| 6156 | MPFROM2SHORT(LIT_END, 0), MPFROMP(info->title));
|
|---|
| 6157 | info = info->next;
|
|---|
| [133] | 6158 | }
|
|---|
| 6159 | }
|
|---|
| 6160 | return 0;
|
|---|
| [2] | 6161 |
|
|---|
| [133] | 6162 | case UM_FILLSETUPLIST:
|
|---|
| [787] | 6163 | fill_setups_list();
|
|---|
| [133] | 6164 | return 0;
|
|---|
| [2] | 6165 |
|
|---|
| [133] | 6166 | case UM_FILLBUTTONLIST:
|
|---|
| 6167 | WinSendMsg(hwndButtonlist, LM_DELETEALL, MPVOID, MPVOID);
|
|---|
| [551] | 6168 | if (fUserComboBox) {
|
|---|
| [2] | 6169 |
|
|---|
| [133] | 6170 | BOOL foundit = FALSE, thisone;
|
|---|
| 6171 | ULONG ulSearchCount;
|
|---|
| 6172 | SHORT sSelect;
|
|---|
| [847] | 6173 | FILEFINDBUF3 findbuf;
|
|---|
| [133] | 6174 | HDIR hDir;
|
|---|
| 6175 | CHAR *p;
|
|---|
| [2] | 6176 |
|
|---|
| [133] | 6177 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 6178 | hDir = HDIR_CREATE;
|
|---|
| [787] | 6179 | ulSearchCount = 1;
|
|---|
| [847] | 6180 | if (!DosFindFirst("*.TLS", &hDir, FILE_READONLY | FILE_ARCHIVED,
|
|---|
| [1335] | 6181 | &findbuf, sizeof(FILEFINDBUF3),
|
|---|
| 6182 | &ulSearchCount, FIL_STANDARD)) {
|
|---|
| 6183 | do {
|
|---|
| 6184 | priority_bumped();
|
|---|
| 6185 | if (!foundit) {
|
|---|
| 6186 | thisone = FALSE;
|
|---|
| 6187 | p = strrchr(lasttoolbar, '\\');
|
|---|
| 6188 | if (!p)
|
|---|
| 6189 | p = lasttoolbar;
|
|---|
| 6190 | else
|
|---|
| 6191 | p++;
|
|---|
| 6192 | if (!stricmp(findbuf.achName, p))
|
|---|
| 6193 | thisone = TRUE;
|
|---|
| 6194 | }
|
|---|
| 6195 | p = strrchr(findbuf.achName, '.');
|
|---|
| 6196 | if (p)
|
|---|
| 6197 | *p = 0;
|
|---|
| 6198 | sSelect = (SHORT) WinSendMsg(hwndButtonlist, LM_INSERTITEM,
|
|---|
| 6199 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
|---|
| 6200 | MPFROMP(findbuf.achName));
|
|---|
| 6201 | if (!foundit && thisone && sSelect >= 0) {
|
|---|
| 6202 | WinSendMsg(hwndButtonlist, LM_SELECTITEM,
|
|---|
| 6203 | MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE));
|
|---|
| 6204 | foundit = TRUE;
|
|---|
| 6205 | }
|
|---|
| 6206 | }
|
|---|
| 6207 | while (!DosFindNext(hDir, &findbuf, sizeof(FILEFINDBUF3),
|
|---|
| 6208 | &ulSearchCount));
|
|---|
| 6209 | DosFindClose(hDir);
|
|---|
| 6210 | priority_bumped();
|
|---|
| [133] | 6211 | }
|
|---|
| [1125] | 6212 | WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBARTEXT));
|
|---|
| [133] | 6213 | }
|
|---|
| 6214 | return 0;
|
|---|
| [2] | 6215 |
|
|---|
| [133] | 6216 | case UM_FILLUSERLIST:
|
|---|
| 6217 | WinSendMsg(hwndUserlist, LM_DELETEALL, MPVOID, MPVOID);
|
|---|
| [551] | 6218 | if (fUserComboBox) {
|
|---|
| [260] | 6219 | ULONG ulDriveNum;
|
|---|
| 6220 | ULONG ulDriveMap;
|
|---|
| [133] | 6221 | ULONG ulSearchCount;
|
|---|
| [847] | 6222 | FILEFINDBUF3 findbuf;
|
|---|
| [133] | 6223 | HDIR hDir;
|
|---|
| 6224 | APIRET rc;
|
|---|
| [260] | 6225 | LINKDIRS *info;
|
|---|
| 6226 | LINKDIRS *temp;
|
|---|
| [2] | 6227 |
|
|---|
| [133] | 6228 | if (!loadedudirs)
|
|---|
| [1335] | 6229 | load_udirs();
|
|---|
| [133] | 6230 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 6231 | DosQCurDisk(&ulDriveNum, &ulDriveMap);
|
|---|
| 6232 | info = udirhead;
|
|---|
| [551] | 6233 | while (info) {
|
|---|
| [1335] | 6234 | if (IsFullName(info->path) &&
|
|---|
| 6235 | !(driveflags[toupper(*info->path) - 'A'] &
|
|---|
| 6236 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
|---|
| 6237 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 6238 | hDir = HDIR_CREATE;
|
|---|
| 6239 | ulSearchCount = 1;
|
|---|
| 6240 | if (!IsRoot(info->path))
|
|---|
| 6241 | rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
|
|---|
| 6242 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
|---|
| 6243 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
|---|
| 6244 | &findbuf, sizeof(FILEFINDBUF3),
|
|---|
| 6245 | &ulSearchCount, FIL_STANDARD);
|
|---|
| 6246 | else {
|
|---|
| 6247 | rc = 0;
|
|---|
| 6248 | findbuf.attrFile = FILE_DIRECTORY;
|
|---|
| 6249 | }
|
|---|
| 6250 | priority_bumped();
|
|---|
| 6251 | if (!rc) {
|
|---|
| 6252 | if (!IsRoot(info->path))
|
|---|
| 6253 | DosFindClose(hDir);
|
|---|
| 6254 | if (findbuf.attrFile & FILE_DIRECTORY)
|
|---|
| 6255 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
|---|
| 6256 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
|---|
| 6257 | MPFROMP(info->path));
|
|---|
| 6258 | else {
|
|---|
| 6259 | temp = info->next;
|
|---|
| 6260 | remove_udir(info->path);
|
|---|
| 6261 | info = temp;
|
|---|
| 6262 | continue;
|
|---|
| 6263 | }
|
|---|
| 6264 | }
|
|---|
| 6265 | else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
|
|---|
| 6266 | temp = info->next;
|
|---|
| 6267 | remove_udir(info->path);
|
|---|
| 6268 | info = temp;
|
|---|
| 6269 | continue;
|
|---|
| 6270 | }
|
|---|
| 6271 | }
|
|---|
| 6272 | info = info->next;
|
|---|
| [133] | 6273 | }
|
|---|
| 6274 | info = ldirhead;
|
|---|
| [551] | 6275 | while (info) {
|
|---|
| [1335] | 6276 | if (IsFullName(info->path) &&
|
|---|
| 6277 | !(driveflags[toupper(*info->path) - 'A'] &
|
|---|
| 6278 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
|---|
| 6279 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 6280 | hDir = HDIR_CREATE;
|
|---|
| 6281 | ulSearchCount = 1;
|
|---|
| 6282 | if (!IsRoot(info->path))
|
|---|
| 6283 | rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
|
|---|
| 6284 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
|---|
| 6285 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
|---|
| 6286 | &findbuf, sizeof(FILEFINDBUF3),
|
|---|
| 6287 | &ulSearchCount, FIL_STANDARD);
|
|---|
| 6288 | else {
|
|---|
| 6289 | rc = 0;
|
|---|
| 6290 | findbuf.attrFile = FILE_DIRECTORY;
|
|---|
| 6291 | }
|
|---|
| 6292 | priority_bumped();
|
|---|
| 6293 | if (!rc) {
|
|---|
| 6294 | if (!IsRoot(info->path))
|
|---|
| 6295 | DosFindClose(hDir);
|
|---|
| 6296 | if (findbuf.attrFile & FILE_DIRECTORY)
|
|---|
| 6297 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
|---|
| 6298 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
|---|
| 6299 | MPFROMP(info->path));
|
|---|
| 6300 | else {
|
|---|
| 6301 | temp = info->next;
|
|---|
| 6302 | remove_udir(info->path);
|
|---|
| 6303 | info = temp;
|
|---|
| 6304 | continue;
|
|---|
| 6305 | }
|
|---|
| 6306 | }
|
|---|
| 6307 | else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
|
|---|
| 6308 | temp = info->next;
|
|---|
| 6309 | remove_udir(info->path);
|
|---|
| 6310 | info = temp;
|
|---|
| 6311 | continue;
|
|---|
| 6312 | }
|
|---|
| 6313 | }
|
|---|
| 6314 | info = info->next;
|
|---|
| [133] | 6315 | }
|
|---|
| 6316 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
|---|
| [1335] | 6317 | MPFROM2SHORT(0, 0),
|
|---|
| 6318 | MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT)));
|
|---|
| [133] | 6319 | WinSetWindowText(hwndUserlist, GetPString(IDS_COMMONDIRTEXT));
|
|---|
| 6320 | }
|
|---|
| 6321 | return 0;
|
|---|
| [2] | 6322 |
|
|---|
| [133] | 6323 | case UM_SIZE:
|
|---|
| 6324 | if (fAutoTile)
|
|---|
| 6325 | TileChildren(hwnd, FALSE);
|
|---|
| 6326 | else
|
|---|
| 6327 | MoveChildrenAwayFromTree(hwnd);
|
|---|
| 6328 | return 0;
|
|---|
| [2] | 6329 |
|
|---|
| [133] | 6330 | case WM_SIZE:
|
|---|
| 6331 | ResizeChildren(hwnd, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1),
|
|---|
| [1335] | 6332 | SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
|
|---|
| [133] | 6333 | break;
|
|---|
| [2] | 6334 |
|
|---|
| [133] | 6335 | case WM_ERASEBACKGROUND:
|
|---|
| 6336 | WinFillRect((HPS) mp1, (PRECTL) mp2, 0x00d0d0d0);
|
|---|
| 6337 | return 0;
|
|---|
| [2] | 6338 |
|
|---|
| [133] | 6339 | case WM_PAINT:
|
|---|
| 6340 | {
|
|---|
| 6341 | HPS hps;
|
|---|
| 6342 | RECTL rcl;
|
|---|
| [2] | 6343 |
|
|---|
| [133] | 6344 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
|---|
| [551] | 6345 | if (hps) {
|
|---|
| [1335] | 6346 | WinQueryWindowRect(hwnd, &rcl);
|
|---|
| 6347 | WinFillRect(hps, &rcl, CLR_PALEGRAY);
|
|---|
| 6348 | WinEndPaint(hps);
|
|---|
| [133] | 6349 | }
|
|---|
| 6350 | }
|
|---|
| 6351 | break;
|
|---|
| [2] | 6352 |
|
|---|
| [133] | 6353 | case UM_CONTROL:
|
|---|
| [551] | 6354 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| [133] | 6355 | case MAIN_CMDLIST:
|
|---|
| 6356 | case MAIN_SETUPLIST:
|
|---|
| 6357 | case MAIN_DRIVELIST:
|
|---|
| 6358 | case MAIN_USERLIST:
|
|---|
| 6359 | case MAIN_BUTTONLIST:
|
|---|
| [551] | 6360 | switch (SHORT2FROMMP(mp1)) {
|
|---|
| [133] | 6361 | case CBN_ENTER:
|
|---|
| [1335] | 6362 | {
|
|---|
| 6363 | HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 6364 | SHORT1FROMMP(mp1));
|
|---|
| 6365 | CHAR path[CCHMAXPATH];
|
|---|
| 6366 | ULONG ul;
|
|---|
| [2] | 6367 |
|
|---|
| [1335] | 6368 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| 6369 | case MAIN_USERLIST:
|
|---|
| 6370 | ul = CCHMAXPATH;
|
|---|
| 6371 | break;
|
|---|
| 6372 | case MAIN_SETUPLIST:
|
|---|
| 6373 | ul = STATE_NAME_MAX_BYTES;
|
|---|
| 6374 | break;
|
|---|
| 6375 | default:
|
|---|
| 6376 | ul = 13; // fixme to not be hardcoded
|
|---|
| 6377 | }
|
|---|
| [787] | 6378 |
|
|---|
| [1335] | 6379 | SetShiftState();
|
|---|
| 6380 | WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path);
|
|---|
| 6381 | bstrip(path);
|
|---|
| 6382 | if (*path) {
|
|---|
| 6383 | if (SHORT1FROMMP(mp1) == MAIN_USERLIST) {
|
|---|
| 6384 | if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) {
|
|---|
| 6385 | if (!LastDir ||
|
|---|
| 6386 | !WinSendMsg(WinQueryWindow(LastDir, QW_PARENT),
|
|---|
| 6387 | UM_CONTAINERDIR, MPFROMP(path), MPVOID))
|
|---|
| 6388 | strcpy(path, pFM2SaveDirectory);
|
|---|
| 6389 | if (!PMMkDir(hwnd, path, TRUE)) {
|
|---|
| 6390 | WinSetWindowText(hwndUL, GetPString(IDS_COMMONDIRTEXT));
|
|---|
| 6391 | break;
|
|---|
| 6392 | }
|
|---|
| 6393 | }
|
|---|
| 6394 | if (!IsFile(path) && !FindDirCnrByName(path, TRUE)) {
|
|---|
| [2] | 6395 |
|
|---|
| [1335] | 6396 | HWND hwndDir;
|
|---|
| [2] | 6397 |
|
|---|
| [1335] | 6398 | if ((fUserListSwitches &&
|
|---|
| 6399 | !(shiftstate & KC_SHIFT)) ||
|
|---|
| 6400 | (!fUserListSwitches && (shiftstate & KC_SHIFT))) {
|
|---|
| 6401 | hwndDir = FindDirCnr(hwnd);
|
|---|
| 6402 | if (hwndDir) {
|
|---|
| 6403 | WinSendMsg(LastDir, UM_SETDIR, MPFROMP(path), MPVOID);
|
|---|
| 6404 | break;
|
|---|
| 6405 | }
|
|---|
| 6406 | }
|
|---|
| 6407 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, path);
|
|---|
| 6408 | }
|
|---|
| 6409 | }
|
|---|
| 6410 | else if (SHORT1FROMMP(mp1) == MAIN_DRIVELIST) {
|
|---|
| 6411 | ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree,
|
|---|
| 6412 | FID_CLIENT),
|
|---|
| 6413 | TREE_CNR), path, FALSE, TRUE);
|
|---|
| 6414 | WinSetFocus(HWND_DESKTOP, hwndTree);
|
|---|
| 6415 | }
|
|---|
| 6416 | else if (SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) {
|
|---|
| 6417 | strcat(path, ".TLS");
|
|---|
| 6418 | load_tools(path);
|
|---|
| 6419 | PrfWriteProfileString(fmprof,
|
|---|
| 6420 | FM3Str, "LastToolbar", lasttoolbar);
|
|---|
| 6421 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| 6422 | WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBARTEXT));
|
|---|
| 6423 | }
|
|---|
| 6424 | else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) {
|
|---|
| 6425 | CHAR szKey[80];
|
|---|
| 6426 | ULONG size, numsaves = 0;
|
|---|
| [2] | 6427 |
|
|---|
| [1335] | 6428 | SetShiftState();
|
|---|
| 6429 | size = sizeof(ULONG);
|
|---|
| 6430 | sprintf(szKey, "%s.NumDirsLastTime", path); // path is state name
|
|---|
| 6431 | if (!PrfQueryProfileData(fmprof,
|
|---|
| 6432 | FM3Str,
|
|---|
| 6433 | szKey,
|
|---|
| 6434 | (PVOID)&numsaves,
|
|---|
| 6435 | &size))
|
|---|
| 6436 | {
|
|---|
| 6437 | if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) {
|
|---|
| 6438 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
|---|
| 6439 | GetPString(IDS_WARNINGTEXT),
|
|---|
| 6440 | GetPString(IDS_DOESNTEXISTTEXT), path);
|
|---|
| 6441 | }
|
|---|
| 6442 | else {
|
|---|
| 6443 | Win_Error2(hwnd, hwnd, __FILE__, __LINE__,
|
|---|
| 6444 | IDS_PRFQUERYPROFILEDATA);
|
|---|
| 6445 | }
|
|---|
| 6446 | }
|
|---|
| 6447 | else {
|
|---|
| 6448 | char *pszStateName;
|
|---|
| 6449 | if ((shiftstate & KC_SHIFT) == 0)
|
|---|
| 6450 | PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));
|
|---|
| 6451 | pszStateName = xstrdup(path, pszSrcFile, __LINE__);
|
|---|
| 6452 | if (!pszStateName) {
|
|---|
| 6453 | // Fall back if out of memory - already complained
|
|---|
| 6454 | if ((shiftstate & KC_SHIFT) != 0 || fAutoTile) {
|
|---|
| 6455 | // Autotile requested or forced
|
|---|
| 6456 | PostMsg(MainObjectHwnd,
|
|---|
| 6457 | UM_RESTORE,
|
|---|
| 6458 | MPVOID,
|
|---|
| 6459 | MPFROMLONG(1)); // Autotile
|
|---|
| 6460 | }
|
|---|
| 6461 | }
|
|---|
| 6462 | else if (!PostMsg(MainObjectHwnd,
|
|---|
| 6463 | UM_RESTORE,
|
|---|
| 6464 | MPFROMP(pszStateName),
|
|---|
| 6465 | MPVOID)) {
|
|---|
| 6466 | free(pszStateName);
|
|---|
| 6467 | }
|
|---|
| 6468 | }
|
|---|
| 6469 | }
|
|---|
| 6470 | else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) {
|
|---|
| [2] | 6471 |
|
|---|
| [1335] | 6472 | SHORT sSelect;
|
|---|
| [2] | 6473 |
|
|---|
| [1335] | 6474 | sSelect = (SHORT) WinSendMsg(hwndCmdlist,
|
|---|
| 6475 | LM_QUERYSELECTION,
|
|---|
| 6476 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
|---|
| 6477 | if (sSelect >= 0)
|
|---|
| 6478 | WinPostMsg(hwnd,
|
|---|
| 6479 | WM_COMMAND,
|
|---|
| 6480 | MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0),
|
|---|
| 6481 | MPVOID);
|
|---|
| 6482 | WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));
|
|---|
| 6483 | }
|
|---|
| 6484 | }
|
|---|
| 6485 | }
|
|---|
| 6486 | break;
|
|---|
| [2] | 6487 |
|
|---|
| [133] | 6488 | default:
|
|---|
| [1335] | 6489 | break;
|
|---|
| [133] | 6490 | }
|
|---|
| 6491 | break;
|
|---|
| [2] | 6492 |
|
|---|
| [133] | 6493 | default:
|
|---|
| 6494 | break;
|
|---|
| 6495 | }
|
|---|
| 6496 | return 0;
|
|---|
| [2] | 6497 |
|
|---|
| [133] | 6498 | case WM_HELP:
|
|---|
| [551] | 6499 | WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
|
|---|
| [133] | 6500 | break;
|
|---|
| [2] | 6501 |
|
|---|
| [133] | 6502 | case UM_COMMAND:
|
|---|
| 6503 | case WM_COMMAND:
|
|---|
| [2] | 6504 |
|
|---|
| [133] | 6505 | return MainWMCommand(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 6506 |
|
|---|
| [133] | 6507 | case WM_CLOSE:
|
|---|
| 6508 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 6509 | WM_SYSCOMMAND, MPFROM2SHORT(SC_RESTORE, 0), MPVOID);
|
|---|
| [551] | 6510 | WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
|---|
| [133] | 6511 | fAmClosing = TRUE;
|
|---|
| 6512 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| [1335] | 6513 | WM_SYSCOMMAND, MPFROM2SHORT(SC_MINIMIZE, 0), MPVOID);
|
|---|
| [551] | 6514 | if (CloseChildren(hwnd)) {
|
|---|
| [133] | 6515 | fAmClosing = FALSE;
|
|---|
| 6516 | if (fAutoTile)
|
|---|
| [1335] | 6517 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TILE, 0), MPVOID);
|
|---|
| [133] | 6518 | return 0;
|
|---|
| 6519 | }
|
|---|
| [551] | 6520 | if (hwndTree) {
|
|---|
| 6521 | if (!PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID))
|
|---|
| [1335] | 6522 | WinSendMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID);
|
|---|
| [133] | 6523 | }
|
|---|
| [771] | 6524 | DosSleep(1);
|
|---|
| [930] | 6525 | return 0; // Hold off WM_QUIT
|
|---|
| [2] | 6526 |
|
|---|
| [133] | 6527 | case UM_CLOSE:
|
|---|
| 6528 | HideNote();
|
|---|
| 6529 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
|---|
| 6530 | return 0;
|
|---|
| [2] | 6531 |
|
|---|
| [133] | 6532 | case UM_RESTORE:
|
|---|
| 6533 | {
|
|---|
| [941] | 6534 | // Try to restore saved shutdown state
|
|---|
| [961] | 6535 | char *pszDefaultStateName = xstrdup(GetPString(IDS_SHUTDOWNSTATE),
|
|---|
| [1335] | 6536 | pszSrcFile, __LINE__);
|
|---|
| [941] | 6537 | if (pszDefaultStateName) {
|
|---|
| [1335] | 6538 | if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID))
|
|---|
| 6539 | // 05 Feb 08 SHL fixme to complain?
|
|---|
| 6540 | free(pszDefaultStateName);
|
|---|
| [133] | 6541 | }
|
|---|
| 6542 | }
|
|---|
| 6543 | return 0;
|
|---|
| [2] | 6544 |
|
|---|
| [133] | 6545 | case UM_SETDIR:
|
|---|
| [352] | 6546 | /* mp1 == name of directory to open */
|
|---|
| 6547 | if (mp1)
|
|---|
| [551] | 6548 | return MRFROMLONG(OpenDirCnr((HWND) 0,
|
|---|
| [1335] | 6549 | hwndMain,
|
|---|
| 6550 | hwndTree, (BOOL) mp2, (char *)mp1));
|
|---|
| [133] | 6551 | return 0;
|
|---|
| [2] | 6552 |
|
|---|
| [133] | 6553 | case WM_DESTROY:
|
|---|
| [1321] | 6554 | # ifdef FORTIFY
|
|---|
| 6555 | DbgMsg(pszSrcFile, __LINE__, "WM_DESTROY hwnd %p TID %u", hwnd, GetTidForThread()); // 22 Jul 08 SHL fixme
|
|---|
| 6556 | # endif
|
|---|
| [551] | 6557 | hwndMain = (HWND) 0;
|
|---|
| 6558 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
|---|
| 6559 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
|---|
| [1077] | 6560 | # ifdef FORTIFY
|
|---|
| 6561 | free_commands();
|
|---|
| 6562 | free_associations();
|
|---|
| 6563 | free_udirs();
|
|---|
| 6564 | free_ldir();
|
|---|
| 6565 | free_archivers();
|
|---|
| 6566 | free_tools();
|
|---|
| 6567 | free_setups();
|
|---|
| 6568 | Fortify_LeaveScope();
|
|---|
| 6569 | # endif
|
|---|
| [133] | 6570 | break;
|
|---|
| 6571 | }
|
|---|
| 6572 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
|---|
| [2] | 6573 | }
|
|---|
| [787] | 6574 |
|
|---|
| [1060] | 6575 | VOID DeletePresParams(CHAR * pchKeyroot)
|
|---|
| 6576 | // This code assumes that pchKeyroot points to a buffer large enough to
|
|---|
| 6577 | // hold the full INI key: The state name.dircnr-number.PPName. The
|
|---|
| 6578 | // PPNames are listed below.
|
|---|
| 6579 | {
|
|---|
| 6580 | PSZ apszPPNames[] =
|
|---|
| 6581 | {
|
|---|
| 6582 | "Backgroundcolor",
|
|---|
| 6583 | "Foregroundcolor",
|
|---|
| 6584 | "Hilitebackgroundcolor",
|
|---|
| 6585 | "Hiliteforegroundcolor",
|
|---|
| 6586 | "Bordercolor",
|
|---|
| 6587 | "Fontnamesize"
|
|---|
| 6588 | };
|
|---|
| 6589 |
|
|---|
| 6590 | ULONG ulSize, ulArraySize = sizeof(apszPPNames) / sizeof(PSZ), x;
|
|---|
| 6591 | CHAR * eos = pchKeyroot + strlen(pchKeyroot);
|
|---|
| 6592 |
|
|---|
| 6593 | for (x = 0; x < ulArraySize; x++)
|
|---|
| 6594 | {
|
|---|
| 6595 | strcpy(eos, apszPPNames[x]);
|
|---|
| 6596 | if (PrfQueryProfileSize(fmprof, appname, pchKeyroot, &ulSize) && ulSize)
|
|---|
| 6597 | {
|
|---|
| 6598 | PrfWriteProfileData(fmprof, appname, pchKeyroot, NULL, ulSize);
|
|---|
| 6599 | }
|
|---|
| 6600 | }
|
|---|
| 6601 | }
|
|---|
| 6602 |
|
|---|
| [787] | 6603 | #pragma alloc_text(MISC8,SetToggleChecks,FindDirCnrByName,TopWindow)
|
|---|
| 6604 | #pragma alloc_text(MISC8,TopWindowName,CountDirCnrs)
|
|---|
| 6605 | #pragma alloc_text(MAINWND,AdjustSizeOfClient,FillClient,ChildButtonProc)
|
|---|
| 6606 | #pragma alloc_text(MAINWND,ToolBackProc,StatusProc)
|
|---|
| 6607 | #pragma alloc_text(MAINWND,MoveChildrenAwayFromTree,ArrangeIcons,NextChild)
|
|---|
| 6608 | #pragma alloc_text(MAINWND,ChildFrameButtonProc)
|
|---|
| 6609 | #pragma alloc_text(MAINWND2,CloseChildren,CountChildren,GetNextWindowPos)
|
|---|
| 6610 | #pragma alloc_text(MAINWND2,CascadeChildren,TileChildren,ResizeChildren)
|
|---|
| 6611 | #pragma alloc_text(MAINWND2,MinResChildren,MainFrameWndProc,MainWndProc)
|
|---|
| 6612 | #pragma alloc_text(MAINWND2,DropDownListProc)
|
|---|
| 6613 | #pragma alloc_text(MAINWND3,RestoreDirCnrState,SaveDirCnrState)
|
|---|
| 6614 | #pragma alloc_text(MAINWND3,CloseDirCnrChildren,TransformSwp)
|
|---|
| 6615 | #pragma alloc_text(MAINWND3,ResizeTools,BuildTools,CommandLineProc)
|
|---|
| 6616 | #pragma alloc_text(MAINWND4,DriveProc,DriveBackProc,BuildDriveBarButtons,ResizeDrives)
|
|---|
| 6617 | #pragma alloc_text(MAINWND4,LEDProc,IdealButtonProc)
|
|---|
| 6618 | #pragma alloc_text(MAINWND5,MainWMOnce)
|
|---|
| 6619 | #pragma alloc_text(MAINWND6,MainWMCommand)
|
|---|
| 6620 | #pragma alloc_text(BUBBLE,MakeBubble,BubbleProc,BubbleHelp)
|
|---|
| 6621 | #pragma alloc_text(MAINOBJ,MainObjectWndProc,MakeMainObjWin)
|
|---|
| 6622 |
|
|---|