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