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