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