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