| 1 | /***********************************************************************
|
|---|
| 2 |
|
|---|
| 3 | $Id: mainwnd.c 1318 2008-12-05 01:57:40Z gyoung $
|
|---|
| 4 |
|
|---|
| 5 | fm/2 main window
|
|---|
| 6 |
|
|---|
| 7 | Copyright (c) 1993-98 M. Kimes
|
|---|
| 8 | Copyright (c) 2001, 2008 Steven H. Levine
|
|---|
| 9 |
|
|---|
| 10 | 11 Jun 02 SHL Drop obsolete xor code
|
|---|
| 11 | 16 Oct 02 SHL Handle large partitions
|
|---|
| 12 | 01 Aug 04 SHL Rework lstrip/rstrip usage
|
|---|
| 13 | 23 May 05 SHL Use QWL_USER
|
|---|
| 14 | 23 May 05 SHL Use datamin.h
|
|---|
| 15 | 25 May 05 SHL Use ULONGLONG and CommaFmtULL
|
|---|
| 16 | 26 May 05 SHL Comments and localize code
|
|---|
| 17 | 05 Jun 05 SHL Use QWL_USER
|
|---|
| 18 | 06 Jun 05 SHL Rework MainWMCommand for VAC3.65 compat
|
|---|
| 19 | 13 Aug 05 SHL Renames and comments
|
|---|
| 20 | 08 Dec 05 SHL DriveProc: disable menu items if drive not ready
|
|---|
| 21 | 17 Dec 05 SHL DriveProc: correct my stupid
|
|---|
| 22 | 29 May 06 SHL IDM_EDITANYARCHIVER: sanitize code
|
|---|
| 23 | 17 Jul 06 SHL Use Runtime_Error
|
|---|
| 24 | 17 Aug 06 SHL Complain nicer if state name does not exist
|
|---|
| 25 | 18 Feb 07 GKY More drive type and icon support
|
|---|
| 26 | 08 Mar 07 SHL SaveDirCnrState: do not save state of NOPRESCAN volumes
|
|---|
| 27 | 09 Mar 07 SHL RestoreDirCnrState/SaveDirCnrState: optimize and avoid overflows
|
|---|
| 28 | 30 Mar 07 GKY Remove GetPString for window class names
|
|---|
| 29 | 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
|
|---|
| 30 | 06 Apr 07 GKY Add some error checking in drag/drop
|
|---|
| 31 | 15 Apr 07 SHL mainwnd MAIN_SETUPLIST restore state not found reporting
|
|---|
| 32 | 19 Apr 07 SHL Sync with AcceptOneDrop GetOneDrop mods
|
|---|
| 33 | 20 Apr 07 SHL Avoid spurious add_udir error reports
|
|---|
| 34 | 12 May 07 SHL Use dcd->ulItemsToUnHilite
|
|---|
| 35 | 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
|
|---|
| 36 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
|
|---|
| 37 | 07 Aug 07 SHL Use BldQuotedFileName
|
|---|
| 38 | 16 Aug 07 SHL Update IDM_SAVEDIRCNRSTATE logic for ticket# 109
|
|---|
| 39 | 18 Aug 07 SHL Rework UM_FILLSETUPLIST for new setups storage
|
|---|
| 40 | 19 Aug 07 SHL Move #pragma alloc_text to end of file for OpenWatcom
|
|---|
| 41 | 19 Aug 07 SHL Rework SaveDirCnrState to return better error info
|
|---|
| 42 | 30 Aug 07 SHL Add accelerator support to quicklist windows
|
|---|
| 43 | 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
|
|---|
| 44 | 12 Jan 08 SHL Support drag&drop dialog toggle
|
|---|
| 45 | 16 Jan 08 SHL Add sync updates toggle
|
|---|
| 46 | 16 Jan 08 GKY Fix changing background color on toolbar
|
|---|
| 47 | 17 Jan 08 GKY Add presparam save & restore for individual directory containers
|
|---|
| 48 | 19 Jan 08 JBS Ticket 150: fix/improve save and restore of dir cnr state at FM/2 close/reopen
|
|---|
| 49 | 19 Jan 08 GKY Rework Utilities menu
|
|---|
| 50 | 05 Feb 08 SHL Restore no-prescan drives if restoring named state
|
|---|
| 51 | 14 Feb 08 SHL Rework to support settings menu conditional cascade
|
|---|
| 52 | 15 Feb 08 SHL Rework ResizeChildren to honor fNoTreeGap and resize drive tree better
|
|---|
| 53 | 19 Feb 08 JBS Stop deleting "State at last FM/2 Close" from INI file so it be accessed from States combo box.
|
|---|
| 54 | 22 Feb 08 JBS Ticket 230: Fix/improve various code related to state or presparam values in the INI file.
|
|---|
| 55 | 29 Feb 08 GKY Use xfree where appropriate
|
|---|
| 56 | 19 Jun 08 JBS Ticket 227: Allow temporary saving/deleting of the shutdown state of directory containers
|
|---|
| 57 | 22 Jun 08 GKY Use free_... functions for fortify checking
|
|---|
| 58 | 30 Jun 08 JBS Ticket 103: Fix restore of previous shutdown state when opening FM/2
|
|---|
| 59 | 07 Jul 08 JBS Ticket 242: Delete obsolete INI keys when re-saving a state
|
|---|
| 60 | 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
|
|---|
| 61 | all the details view settings (both the global variables and those in the
|
|---|
| 62 | DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
|
|---|
| 63 | 12 Jul 08 JBS Ticket 246: Allow saved directory container states to have no directory containers
|
|---|
| 64 | (i.e. just a directory tree container).
|
|---|
| 65 | 18 Jul 08 SHL Use new Fortify feature to avoid spurious reports
|
|---|
| 66 | 19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory
|
|---|
| 67 | 26 Aug 08 GKY Require unique ID plus text and help strings for all tools save toolbar on button delete
|
|---|
| 68 | 27 Aug 08 JBS Ticket 259: Support saving/restoring toolbars with states
|
|---|
| 69 | 29 Aug 08 JBS Ticket 259: Support saving/restoring target directories with states (except the shutdown state)
|
|---|
| 70 | 01 Sep 08 GKY Save toolbars immediately on change. Add bmps for default toolbars
|
|---|
| 71 | 29 Nov 08 GKY Remove or replace with a mutex semaphore DosEnterCriSec where appropriate.
|
|---|
| 72 | 04 Dec 08 GKY Use event semaphore to prevent scan of "last" directory container prior to
|
|---|
| 73 | tree scan completion; prevents duplicate directory names in tree.
|
|---|
| 74 |
|
|---|
| 75 | ***********************************************************************/
|
|---|
| 76 |
|
|---|
| 77 | #include <stdlib.h>
|
|---|
| 78 | #include <string.h>
|
|---|
| 79 | #include <ctype.h>
|
|---|
| 80 | #include <process.h> // _beginthread
|
|---|
| 81 |
|
|---|
| 82 | #define INCL_DOS
|
|---|
| 83 | #define INCL_WIN
|
|---|
| 84 | #define INCL_SHLERRORS // PMERR_NOT_IN_IDX
|
|---|
| 85 | #define INCL_WINHELP
|
|---|
| 86 | #define INCL_GPI
|
|---|
| 87 | #define INCL_LONGLONG
|
|---|
| 88 |
|
|---|
| 89 | #include "fm3dll.h"
|
|---|
| 90 | #include "fm3dll2.h" // #define's for UM_*, control id's, etc.
|
|---|
| 91 | #include "grep.h" // Data declaration(s)
|
|---|
| 92 | #include "autoview.h" // Data declaration(s)
|
|---|
| 93 | #include "dircnrs.h" // Data declaration(s)
|
|---|
| 94 | #include "info.h" // Data declaration(s)
|
|---|
| 95 | #include "defview.h" // Data declaration(s)
|
|---|
| 96 | #include "init.h" // Data declaration(s)
|
|---|
| 97 | #include "fm3dlg.h"
|
|---|
| 98 | #include "fm3str.h"
|
|---|
| 99 | #include "tools.h"
|
|---|
| 100 | #include "comp.h"
|
|---|
| 101 | #include "datamin.h"
|
|---|
| 102 | #include "pathutil.h" // BldQuotedFileName
|
|---|
| 103 | #include "errutil.h" // Dos_Error...
|
|---|
| 104 | #include "strutil.h" // GetPString
|
|---|
| 105 | #include "notebook.h" // CfgDlgProc CfgMenuInit
|
|---|
| 106 | #include "command.h" // LINKCMDS
|
|---|
| 107 | #include "avl.h" // free_archivers
|
|---|
| 108 | #include "walkem.h" // free_setups...
|
|---|
| 109 | #include "key.h" // AboutDlgProc
|
|---|
| 110 | #include "menu.h" // AddToMenu
|
|---|
| 111 | #include "mainwnd.h"
|
|---|
| 112 | #include "cmdline.h" // CmdLine2DlgProc, save_cmdlines
|
|---|
| 113 | #include "common.h" // CommonCreateMainChildren, CommonDriveCmd, CommonMainWndProc
|
|---|
| 114 | // CommonTextButton
|
|---|
| 115 | #include "notify.h" // DoNotify, HideNote, ShowNote
|
|---|
| 116 | #include "draglist.h" // DragOne
|
|---|
| 117 | #include "chklist.h" // DropListProc
|
|---|
| 118 | #include "avv.h" // EditArchiverDefinition
|
|---|
| 119 | #include "assoc.h" // EditAssociations
|
|---|
| 120 | #include "fm2cmd.h" // FM2Command
|
|---|
| 121 | #include "misc.h" // FindDirCnr, FixSwitchList, PaintSTextWindow,
|
|---|
| 122 | // SetConditionalCascade, SetMenuCheck, SetSysMenu
|
|---|
| 123 | // SwitchCommand, CheckMenu, DrawTargetEmphasis
|
|---|
| 124 | // IsFm2Window
|
|---|
| 125 | #include "instant.h" // InstantDlgProc
|
|---|
| 126 | #include "killproc.h" // KillDlgProc
|
|---|
| 127 | #include "loadbmp.h" // LoadBitmapFromFileNum
|
|---|
| 128 | #include "presparm.h" // SavePresParams
|
|---|
| 129 | #include "treecnr.h" // ShowTreeRec, StartTreeCnr
|
|---|
| 130 | #include "inis.h" // StartIniEditor
|
|---|
| 131 | #include "sysinfo.h" // SysInfoDlgProc
|
|---|
| 132 | #include "viewinf.h" // ViewInfProc
|
|---|
| 133 | #include "walkem.h" // WalkDlgProc, WalkTwoCmpDlgProc, add_setup, add_udir
|
|---|
| 134 | // fill_setups_list, free_ldir, free_udirs, load_udirs
|
|---|
| 135 | // remove_setup, remove_udir, save_setups, save_udirs
|
|---|
| 136 | #include "winlist.h" // WindowList
|
|---|
| 137 | #include "cmdline.h" // add_cmdline
|
|---|
| 138 | #include "assoc.h" // free_associations
|
|---|
| 139 | #include "droplist.h" // AcceptOneDrop, CheckPmDrgLimit, DropHelp, GetOneDrop
|
|---|
| 140 | #include "common.h" // CommonTextProc
|
|---|
| 141 | #include "presparm.h" // CopyPresParams
|
|---|
| 142 | #include "systemf.h" // ExecOnList
|
|---|
| 143 | #include "shadow.h" // OpenObject
|
|---|
| 144 | #include "mkdir.h" // PMMkDir
|
|---|
| 145 | #include "collect.h" // StartCollector
|
|---|
| 146 | #include "select.h" // UnHilite
|
|---|
| 147 | #include "strips.h" // bstrip
|
|---|
| 148 | #include "commafmt.h" // CommaFmtULL
|
|---|
| 149 | #include "valid.h" // IsFullName
|
|---|
| 150 | #include "dirs.h" // save_dir2
|
|---|
| 151 | #include "wrappers.h" // xfree
|
|---|
| 152 | #include "fortify.h"
|
|---|
| 153 | #include "filldir.h" // StubbyScanCount
|
|---|
| 154 |
|
|---|
| 155 | static BOOL CloseDirCnrChildren(HWND hwndClient);
|
|---|
| 156 | static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview);
|
|---|
| 157 | static VOID DeletePresParams(PSZ pszKeyroot);
|
|---|
| 158 | static VOID BuildTools(HWND hwndT, BOOL resize);
|
|---|
| 159 |
|
|---|
| 160 | // Data definitions
|
|---|
| 161 | #pragma data_seg(GLOBAL1)
|
|---|
| 162 | ULONG DriveLines;
|
|---|
| 163 | HWND MainObjectHwnd;
|
|---|
| 164 | HWND MainPopupMenu;
|
|---|
| 165 | BOOL MenuInvisible;
|
|---|
| 166 | PFNWP PFNWPButton;
|
|---|
| 167 | PFNWP PFNWPStatic;
|
|---|
| 168 | BOOL fAmClosing;
|
|---|
| 169 | BOOL fAutoTile;
|
|---|
| 170 | BOOL fAutoView;
|
|---|
| 171 | BOOL fComments;
|
|---|
| 172 | BOOL fDrivebar;
|
|---|
| 173 | BOOL fFreeTree;
|
|---|
| 174 | BOOL fMoreButtons;
|
|---|
| 175 | BOOL fNoFinger;
|
|---|
| 176 | BOOL fNoSaveState;
|
|---|
| 177 | BOOL fNoTileUpdate;
|
|---|
| 178 | BOOL fRunning;
|
|---|
| 179 | BOOL fSplitStatus;
|
|---|
| 180 | BOOL fTextTools;
|
|---|
| 181 | BOOL fToolTitles;
|
|---|
| 182 | BOOL fToolbar;
|
|---|
| 183 | BOOL fUserComboBox;
|
|---|
| 184 | HBITMAP hbmLEDoff;
|
|---|
| 185 | HBITMAP hbmLEDon;
|
|---|
| 186 | HPOINTER hptrFinger;
|
|---|
| 187 | HWND hwndAutoview;
|
|---|
| 188 | HWND hwndBubble;
|
|---|
| 189 | HWND hwndName;
|
|---|
| 190 | HWND hwndStatelist;
|
|---|
| 191 | HWND hwndToolback;
|
|---|
| 192 | HWND hwndTree;
|
|---|
| 193 | USHORT shiftstate;
|
|---|
| 194 |
|
|---|
| 195 | #pragma data_seg(GLOBAL2)
|
|---|
| 196 | HMODULE FM3ModHandle;
|
|---|
| 197 | CHAR *FM3Str;
|
|---|
| 198 | RGB2 RGBGREY;
|
|---|
| 199 |
|
|---|
| 200 | #pragma data_seg(DATA1)
|
|---|
| 201 |
|
|---|
| 202 | static PSZ pszSrcFile = __FILE__;
|
|---|
| 203 | static USHORT firsttool = 0;
|
|---|
| 204 | static HWND hwndButtonlist;
|
|---|
| 205 | static HWND hwndCmdlist;
|
|---|
| 206 | static HWND hwndDrivelist;
|
|---|
| 207 | static HWND hwndUserlist;
|
|---|
| 208 |
|
|---|
| 209 |
|
|---|
| 210 | static MRESULT EXPENTRY MainObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
|---|
| 211 | MPARAM mp2)
|
|---|
| 212 | {
|
|---|
| 213 | switch (msg) {
|
|---|
| 214 | case WM_CREATE:
|
|---|
| 215 | break;
|
|---|
| 216 |
|
|---|
| 217 | case UM_SETUP:
|
|---|
| 218 | case UM_SETUP2:
|
|---|
| 219 | case UM_SETUP3:
|
|---|
| 220 | case UM_SETUP4:
|
|---|
| 221 | case UM_SETUP5:
|
|---|
| 222 | /*
|
|---|
| 223 | * feed setup messages to main window
|
|---|
| 224 | */
|
|---|
| 225 | PostMsg(hwndMain, msg, mp1, mp2);
|
|---|
| 226 | return 0;
|
|---|
| 227 |
|
|---|
| 228 | case UM_SETUP6:
|
|---|
| 229 | /*
|
|---|
| 230 | * handle bubble help requests from drive bar buttons
|
|---|
| 231 | */
|
|---|
| 232 | {
|
|---|
| 233 | char dv[3], d;
|
|---|
| 234 | HWND hwndB = (HWND) mp1;
|
|---|
| 235 | USHORT id;
|
|---|
| 236 |
|
|---|
| 237 | id = WinQueryWindowUShort(hwndB, QWS_ID);
|
|---|
| 238 | *dv = 0;
|
|---|
| 239 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwndB, QW_PARENT),
|
|---|
| 240 | id + 50), sizeof(dv), dv);
|
|---|
| 241 | d = toupper(*dv);
|
|---|
| 242 | if (isalpha(d) && d > 'B' &&
|
|---|
| 243 | !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID |
|
|---|
| 244 | DRIVE_SLOW)) &&
|
|---|
| 245 | (!hwndBubble ||
|
|---|
| 246 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&
|
|---|
| 247 | !WinQueryCapture(HWND_DESKTOP)) {
|
|---|
| 248 |
|
|---|
| 249 | FSALLOCATE fsa;
|
|---|
| 250 | CHAR s[90], szQty[38];
|
|---|
| 251 | ULONG ulPctFree;
|
|---|
| 252 | ULONGLONG ullFreeQty;
|
|---|
| 253 |
|
|---|
| 254 | if (!DosQueryFSInfo((d - 'A') + 1,
|
|---|
| 255 | FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {
|
|---|
| 256 | ullFreeQty = (ULONGLONG) fsa.cUnitAvail *
|
|---|
| 257 | (fsa.cSectorUnit * fsa.cbSector);
|
|---|
| 258 | ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ?
|
|---|
| 259 | (fsa.cUnitAvail * 100) / fsa.cUnit : 0;
|
|---|
| 260 | CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' ');
|
|---|
| 261 | sprintf(s, "%s (%lu%%) free", szQty, ulPctFree);
|
|---|
| 262 | }
|
|---|
| 263 | if ((!hwndBubble ||
|
|---|
| 264 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&
|
|---|
| 265 | !WinQueryCapture(HWND_DESKTOP))
|
|---|
| 266 | WinSendMsg(hwndB, UM_SETUP6, MPFROMP(s), MPVOID);
|
|---|
| 267 | }
|
|---|
| 268 | }
|
|---|
| 269 | return 0;
|
|---|
| 270 |
|
|---|
| 271 | case UM_SETDIR:
|
|---|
| 272 | {
|
|---|
| 273 | CHAR s[8] = " :\\OS2";
|
|---|
| 274 | ULONG bd;
|
|---|
| 275 |
|
|---|
| 276 | if (DosQuerySysInfo(QSV_BOOT_DRIVE,
|
|---|
| 277 | QSV_BOOT_DRIVE,
|
|---|
| 278 | (PVOID) & bd, (ULONG) sizeof(ULONG)))
|
|---|
| 279 | bd = 3L;
|
|---|
| 280 | *s = (CHAR) bd + '@';
|
|---|
| 281 | WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPFROMLONG(1));
|
|---|
| 282 | if (!mp1) {
|
|---|
| 283 | s[3] = 0;
|
|---|
| 284 | WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID);
|
|---|
| 285 | }
|
|---|
| 286 | PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1), MPFROMLONG(1));
|
|---|
| 287 | }
|
|---|
| 288 | return 0;
|
|---|
| 289 |
|
|---|
| 290 | case UM_RESTORE:
|
|---|
| 291 | switch ((ULONG)mp2) {
|
|---|
| 292 | case 1:
|
|---|
| 293 | TileChildren(hwndMain, TRUE);
|
|---|
| 294 | break;
|
|---|
| 295 | case 2:
|
|---|
| 296 | CloseDirCnrChildren(hwndMain);
|
|---|
| 297 | break;
|
|---|
| 298 | case 0:
|
|---|
| 299 | fNoTileUpdate = TRUE;
|
|---|
| 300 | WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), FALSE);
|
|---|
| 301 | RestoreDirCnrState(hwndMain, (char *)mp1, FALSE);
|
|---|
| 302 | WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), TRUE);
|
|---|
| 303 | fNoTileUpdate = FALSE;
|
|---|
| 304 | //xfree((char *)mp1, pszSrcFile, __LINE__);
|
|---|
| 305 | // if (fAutoTile)
|
|---|
| 306 | // TileChildren(hwndMain, TRUE);
|
|---|
| 307 | break;
|
|---|
| 308 | default:
|
|---|
| 309 | Runtime_Error(pszSrcFile, __LINE__, "%u unexpected", mp2);
|
|---|
| 310 | }
|
|---|
| 311 | return 0;
|
|---|
| 312 |
|
|---|
| 313 | case UM_NOTIFY:
|
|---|
| 314 | /*
|
|---|
| 315 | * bring up notify messages for various windows
|
|---|
| 316 | */
|
|---|
| 317 | if (mp1)
|
|---|
| 318 | return MRFROMLONG(DoNotify((char *)mp1));
|
|---|
| 319 | return 0;
|
|---|
| 320 |
|
|---|
| 321 | case WM_DESTROY:
|
|---|
| 322 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
|---|
| 323 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
|---|
| 324 | break;
|
|---|
| 325 | }
|
|---|
| 326 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
|---|
| 327 | }
|
|---|
| 328 |
|
|---|
| 329 | VOID MakeMainObjWin(VOID * args)
|
|---|
| 330 | {
|
|---|
| 331 | HAB hab2;
|
|---|
| 332 | HMQ hmq2;
|
|---|
| 333 | QMSG qmsg2;
|
|---|
| 334 |
|
|---|
| 335 | priority_bumped();
|
|---|
| 336 | hab2 = WinInitialize(0);
|
|---|
| 337 | if (hab2) {
|
|---|
| 338 | hmq2 = WinCreateMsgQueue(hab2, 128);
|
|---|
| 339 | if (hmq2) {
|
|---|
| 340 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 341 | WinRegisterClass(hab2,
|
|---|
| 342 | (PSZ) WC_OBJECTWINDOW,
|
|---|
| 343 | MainObjectWndProc, 0, sizeof(PVOID));
|
|---|
| 344 | MainObjectHwnd = WinCreateWindow(HWND_OBJECT,
|
|---|
| 345 | WC_OBJECTWINDOW,
|
|---|
| 346 | (PSZ) NULL,
|
|---|
| 347 | 0,
|
|---|
| 348 | 0L,
|
|---|
| 349 | 0L,
|
|---|
| 350 | 0L,
|
|---|
| 351 | 0L,
|
|---|
| 352 | 0L, HWND_TOP, OBJ_FRAME, NULL, NULL);
|
|---|
| 353 | if (!MainObjectHwnd)
|
|---|
| 354 | Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 355 | IDS_WINCREATEWINDOW);
|
|---|
| 356 | else {
|
|---|
| 357 | WinSetWindowPtr(MainObjectHwnd, QWL_USER, args);
|
|---|
| 358 | # ifdef FORTIFY
|
|---|
| 359 | Fortify_EnterScope();
|
|---|
| 360 | # endif
|
|---|
| 361 | while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0))
|
|---|
| 362 | WinDispatchMsg(hab2, &qmsg2);
|
|---|
| 363 | WinDestroyWindow(MainObjectHwnd);
|
|---|
| 364 | # ifdef FORTIFY
|
|---|
| 365 | Fortify_LeaveScope();
|
|---|
| 366 | # endif
|
|---|
| 367 | }
|
|---|
| 368 | WinDestroyMsgQueue(hmq2);
|
|---|
| 369 | }
|
|---|
| 370 | WinTerminate(hab2);
|
|---|
| 371 | }
|
|---|
| 372 | }
|
|---|
| 373 |
|
|---|
| 374 | static MRESULT EXPENTRY IdealButtonProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
|---|
| 375 | MPARAM mp2)
|
|---|
| 376 | {
|
|---|
| 377 | switch (msg) {
|
|---|
| 378 | case WM_MOUSEMOVE:
|
|---|
| 379 | BubbleHelp(hwnd, TRUE, FALSE, FALSE, GetPString(IDS_IDEALBUTTONHELP));
|
|---|
| 380 | break;
|
|---|
| 381 | }
|
|---|
| 382 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
|---|
| 383 | }
|
|---|
| 384 |
|
|---|
| 385 | HWND TopWindow(HWND hwndParent, HWND exclude)
|
|---|
| 386 | {
|
|---|
| 387 | HENUM henum;
|
|---|
| 388 | HWND hwndC = (HWND) 0;
|
|---|
| 389 | USHORT id;
|
|---|
| 390 |
|
|---|
| 391 | if (hwndParent) {
|
|---|
| 392 | henum = WinBeginEnumWindows(hwndMain);
|
|---|
| 393 | while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 394 | if (hwndC != exclude) {
|
|---|
| 395 | id = WinQueryWindowUShort(hwndC, QWS_ID);
|
|---|
| 396 | if (id)
|
|---|
| 397 | break;
|
|---|
| 398 | }
|
|---|
| 399 | }
|
|---|
| 400 | WinEndEnumWindows(henum);
|
|---|
| 401 | }
|
|---|
| 402 | return hwndC;
|
|---|
| 403 | }
|
|---|
| 404 |
|
|---|
| 405 | HWND TopWindowName(HWND hwndParent, HWND exclude, CHAR * ret)
|
|---|
| 406 | {
|
|---|
| 407 | HENUM henum;
|
|---|
| 408 | HWND hwndC = (HWND) 0, hwndDir, hwndClient;
|
|---|
| 409 | USHORT id;
|
|---|
| 410 | PCNRITEM pci = NULL;
|
|---|
| 411 |
|
|---|
| 412 | if (ret) {
|
|---|
| 413 | *ret = 0;
|
|---|
| 414 | if (hwndParent) {
|
|---|
| 415 | henum = WinBeginEnumWindows(hwndMain);
|
|---|
| 416 | while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 417 | //saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC);
|
|---|
| 418 | if (hwndC != exclude && hwndC != hwndTree) {
|
|---|
| 419 | id = WinQueryWindowUShort(hwndC, QWS_ID);
|
|---|
| 420 | if (id) {
|
|---|
| 421 | hwndClient = WinWindowFromID(hwndC, FID_CLIENT);
|
|---|
| 422 | if (hwndClient) {
|
|---|
| 423 | hwndDir = WinWindowFromID(hwndClient, DIR_CNR);
|
|---|
| 424 | if (hwndDir) {
|
|---|
| 425 | if (fLookInDir) {
|
|---|
| 426 | pci = (PCNRITEM) WinSendMsg(hwndDir,
|
|---|
| 427 | CM_QUERYRECORDEMPHASIS,
|
|---|
| 428 | MPFROMLONG(CMA_FIRST),
|
|---|
| 429 | MPFROMSHORT(CRA_CURSORED));
|
|---|
| 430 | if (pci && (INT) pci != -1)
|
|---|
| 431 | break;
|
|---|
| 432 | }
|
|---|
| 433 | if (WinSendMsg(hwndClient,
|
|---|
| 434 | UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) {
|
|---|
| 435 | MakeValidDir(ret);
|
|---|
| 436 | //saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret);
|
|---|
| 437 | WinEndEnumWindows(henum);
|
|---|
| 438 | return hwndC;
|
|---|
| 439 | }
|
|---|
| 440 | }
|
|---|
| 441 | }
|
|---|
| 442 | }
|
|---|
| 443 | }
|
|---|
| 444 | }
|
|---|
| 445 | WinEndEnumWindows(henum);
|
|---|
| 446 | if (!pci || (INT) pci == -1) {
|
|---|
| 447 | hwndC = hwndTree;
|
|---|
| 448 | pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree,
|
|---|
| 449 | FID_CLIENT),
|
|---|
| 450 | TREE_CNR),
|
|---|
| 451 | CM_QUERYRECORDEMPHASIS,
|
|---|
| 452 | MPFROMLONG(CMA_FIRST),
|
|---|
| 453 | MPFROMSHORT(CRA_CURSORED));
|
|---|
| 454 | }
|
|---|
| 455 | if (pci && (INT) pci != -1) {
|
|---|
| 456 | strcpy(ret, pci->pszFileName);
|
|---|
| 457 | MakeValidDir(ret);
|
|---|
| 458 | }
|
|---|
| 459 | else
|
|---|
| 460 | strcpy(ret, pFM2SaveDirectory);
|
|---|
| 461 | }
|
|---|
| 462 | }
|
|---|
| 463 | return hwndC;
|
|---|
| 464 | }
|
|---|
| 465 |
|
|---|
| 466 | ULONG CountDirCnrs(HWND hwndParent)
|
|---|
| 467 | {
|
|---|
| 468 | HENUM henum;
|
|---|
| 469 | HWND hwndF = (HWND) 0, hwndC, hwndDir;
|
|---|
| 470 | ULONG ret = 0;
|
|---|
| 471 |
|
|---|
| 472 | henum = WinBeginEnumWindows(hwndParent);
|
|---|
| 473 | while ((hwndF = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 474 | hwndC = WinWindowFromID(hwndF, FID_CLIENT);
|
|---|
| 475 | if (hwndC) {
|
|---|
| 476 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
|---|
| 477 | if (hwndDir)
|
|---|
| 478 | ret++;
|
|---|
| 479 | }
|
|---|
| 480 | }
|
|---|
| 481 | WinEndEnumWindows(henum);
|
|---|
| 482 | return ret;
|
|---|
| 483 | }
|
|---|
| 484 |
|
|---|
| 485 | HWND FindDirCnrByName(CHAR * directory, BOOL restore)
|
|---|
| 486 | {
|
|---|
| 487 | HENUM henum;
|
|---|
| 488 | HWND hwndF = (HWND) 0, hwndC, hwndDir;
|
|---|
| 489 | CHAR retstr[CCHMAXPATH];
|
|---|
| 490 |
|
|---|
| 491 | if (hwndMain) {
|
|---|
| 492 | henum = WinBeginEnumWindows(hwndMain);
|
|---|
| 493 | while ((hwndF = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 494 | hwndC = WinWindowFromID(hwndF, FID_CLIENT);
|
|---|
| 495 | if (hwndC) {
|
|---|
| 496 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
|---|
| 497 | if (hwndDir) {
|
|---|
| 498 | *retstr = 0;
|
|---|
| 499 | WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID);
|
|---|
| 500 | if (*retstr && !stricmp(retstr, directory)) {
|
|---|
| 501 | if (restore)
|
|---|
| 502 | WinSetWindowPos(hwndF,
|
|---|
| 503 | HWND_TOP,
|
|---|
| 504 | 0,
|
|---|
| 505 | 0,
|
|---|
| 506 | 0,
|
|---|
| 507 | 0,
|
|---|
| 508 | SWP_RESTORE | SWP_SHOW |
|
|---|
| 509 | SWP_ACTIVATE | SWP_ZORDER);
|
|---|
| 510 | break;
|
|---|
| 511 | }
|
|---|
| 512 | }
|
|---|
| 513 | }
|
|---|
| 514 | }
|
|---|
| 515 | WinEndEnumWindows(henum);
|
|---|
| 516 | }
|
|---|
| 517 | return hwndF;
|
|---|
| 518 | }
|
|---|
| 519 |
|
|---|
| 520 | static VOID SetToggleChecks(HWND hwndMenu)
|
|---|
| 521 | {
|
|---|
| 522 | WinCheckMenuItem(hwndMenu, IDM_TEXTTOOLS, fTextTools);
|
|---|
| 523 | WinCheckMenuItem(hwndMenu, IDM_TOOLTITLES, fToolTitles);
|
|---|
| 524 | WinCheckMenuItem(hwndMenu, IDM_USERLIST, fUserComboBox);
|
|---|
| 525 | WinCheckMenuItem(hwndMenu, IDM_TOOLSUBMENU, fToolbar);
|
|---|
| 526 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWSUBMENU, fAutoView);
|
|---|
| 527 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWFILE, !fComments);
|
|---|
| 528 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWCOMMENTS, fComments);
|
|---|
| 529 | WinCheckMenuItem(hwndMenu, IDM_MOREBUTTONS, fMoreButtons);
|
|---|
| 530 | WinCheckMenuItem(hwndMenu, IDM_DRIVEBAR, fDrivebar);
|
|---|
| 531 | WinCheckMenuItem(hwndMenu, IDM_AUTOTILE, fAutoTile);
|
|---|
| 532 | WinCheckMenuItem(hwndMenu, IDM_TILEBACKWARDS, fTileBackwards);
|
|---|
| 533 | WinCheckMenuItem(hwndMenu, IDM_TOGGLEDRAGDIALOG, fDragndropDlg);
|
|---|
| 534 | WinCheckMenuItem(hwndMenu, IDM_SYNCUPDATES, fSyncUpdates);
|
|---|
| 535 | }
|
|---|
| 536 |
|
|---|
| 537 | static VOID ResizeTools(HWND hwnd)
|
|---|
| 538 | {
|
|---|
| 539 | register ULONG butx = 18L;
|
|---|
| 540 | INT attrib = SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER | SWP_NOREDRAW,
|
|---|
| 541 | noattrib;
|
|---|
| 542 | register TOOL *tool, *starttool;
|
|---|
| 543 | SWP *swp;
|
|---|
| 544 | register ULONG numtools, x;
|
|---|
| 545 |
|
|---|
| 546 | if (!fToolbar)
|
|---|
| 547 | return;
|
|---|
| 548 | noattrib = attrib;
|
|---|
| 549 | noattrib &= (~(SWP_SHOW | SWP_ZORDER));
|
|---|
| 550 | noattrib |= SWP_HIDE;
|
|---|
| 551 | /* count tools */
|
|---|
| 552 | tool = toolhead;
|
|---|
| 553 | for (numtools = 0L; tool; numtools++)
|
|---|
| 554 | tool = tool->next;
|
|---|
| 555 | /* allocate swp array for WinSetMultWindowPos */
|
|---|
| 556 | swp = xmallocz(sizeof(SWP) * (numtools + 2), pszSrcFile, __LINE__);
|
|---|
| 557 | if (swp) {
|
|---|
| 558 | for (x = 0; x < numtools + 2L; x++) {
|
|---|
| 559 | swp[x].hwndInsertBehind = HWND_TOP;
|
|---|
| 560 | swp[x].fl = attrib;
|
|---|
| 561 | swp[x].y = (fToolTitles) ? 14L : 3L;
|
|---|
| 562 | swp[x].cx = 32L;
|
|---|
| 563 | swp[x].cy = 32L;
|
|---|
| 564 | }
|
|---|
| 565 | swp[0].x = swp[1].x = 2L;
|
|---|
| 566 | swp[0].y = (fTextTools) ? 14L : 18L;
|
|---|
| 567 | swp[1].y = (fTextTools) ? 1L : 2L;
|
|---|
| 568 | swp[0].cx = swp[1].cx = 14L;
|
|---|
| 569 | swp[0].cy = swp[1].cy = 14L;
|
|---|
| 570 | swp[0].hwnd = WinWindowFromID(hwnd, IDM_TOOLLEFT);
|
|---|
| 571 | swp[1].hwnd = WinWindowFromID(hwnd, IDM_TOOLRIGHT);
|
|---|
| 572 | x = 2L;
|
|---|
| 573 | tool = find_tool(firsttool);
|
|---|
| 574 | if (!tool)
|
|---|
| 575 | tool = toolhead;
|
|---|
| 576 | starttool = tool;
|
|---|
| 577 | while (tool) {
|
|---|
| 578 | if (!(tool->flags & T_INVISIBLE)) {
|
|---|
| 579 | swp[x].x = butx;
|
|---|
| 580 | if (fTextTools || (tool->flags & T_TEXT)) {
|
|---|
| 581 | butx += 55L;
|
|---|
| 582 | swp[x].cx = 54L;
|
|---|
| 583 | swp[x].cy = 24L;
|
|---|
| 584 | swp[x].y = 3L;
|
|---|
| 585 | }
|
|---|
| 586 | else
|
|---|
| 587 | butx += 33L;
|
|---|
| 588 | if (tool->flags & T_SEPARATOR)
|
|---|
| 589 | butx += 12;
|
|---|
| 590 | }
|
|---|
| 591 | else
|
|---|
| 592 | swp[x].fl = noattrib;
|
|---|
| 593 | swp[x].hwnd = WinWindowFromID(hwnd, tool->id);
|
|---|
| 594 | x++;
|
|---|
| 595 | tool = tool->next;
|
|---|
| 596 | }
|
|---|
| 597 | tool = toolhead;
|
|---|
| 598 | while (tool && tool != starttool) {
|
|---|
| 599 | swp[x].x = butx;
|
|---|
| 600 | if (!(tool->flags & T_INVISIBLE)) {
|
|---|
| 601 | if (fTextTools || (tool->flags & T_TEXT)) {
|
|---|
| 602 | butx += 55L;
|
|---|
| 603 | swp[x].cx = 54L;
|
|---|
| 604 | swp[x].cy = 24L;
|
|---|
| 605 | swp[x].y = 3L;
|
|---|
| 606 | }
|
|---|
| 607 | else
|
|---|
| 608 | butx += 33L;
|
|---|
| 609 | if (tool->flags & T_SEPARATOR)
|
|---|
| 610 | butx += 12;
|
|---|
| 611 | }
|
|---|
| 612 | else
|
|---|
| 613 | swp[x].fl = noattrib;
|
|---|
| 614 | swp[x].hwnd = WinWindowFromID(hwnd, tool->id);
|
|---|
| 615 | x++;
|
|---|
| 616 | tool = tool->next;
|
|---|
| 617 | }
|
|---|
| 618 | WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), swp, numtools + 2L);
|
|---|
| 619 | if (!fTextTools && fToolTitles) {
|
|---|
| 620 | for (x = 2L; x < numtools + 2L; x++) {
|
|---|
| 621 | if (fTextTools || !fToolTitles)
|
|---|
| 622 | swp[x].fl = noattrib;
|
|---|
| 623 | else {
|
|---|
| 624 | tool = find_tool(WinQueryWindowUShort(swp[x].hwnd, QWS_ID));
|
|---|
| 625 | if (tool && (tool->flags & T_TEXT))
|
|---|
| 626 | swp[x].fl = noattrib;
|
|---|
| 627 | else {
|
|---|
| 628 | swp[x].hwndInsertBehind = HWND_TOP;
|
|---|
| 629 | swp[x].y = 1L;
|
|---|
| 630 | swp[x].cy = 10L;
|
|---|
| 631 | }
|
|---|
| 632 | }
|
|---|
| 633 | swp[x].hwnd = WinWindowFromID(hwnd,
|
|---|
| 634 | WinQueryWindowUShort(swp[x].hwnd,
|
|---|
| 635 | QWS_ID) + 25000);
|
|---|
| 636 | }
|
|---|
| 637 | WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), &swp[2], numtools);
|
|---|
| 638 | }
|
|---|
| 639 | free(swp);
|
|---|
| 640 | }
|
|---|
| 641 | WinInvalidateRect(hwnd, NULL, TRUE);
|
|---|
| 642 | }
|
|---|
| 643 |
|
|---|
| 644 | static MRESULT EXPENTRY DropDownListProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
|---|
| 645 | MPARAM mp2)
|
|---|
| 646 | {
|
|---|
| 647 | PFNWP oldproc = (PFNWP) INSTDATA(hwnd);
|
|---|
| 648 | USHORT id;
|
|---|
| 649 |
|
|---|
| 650 | static HWND hwndMenu = (HWND)0;
|
|---|
| 651 | static BOOL emphasized = FALSE;
|
|---|
| 652 |
|
|---|
| 653 | switch (msg) {
|
|---|
| 654 | case WM_MOUSEMOVE:
|
|---|
| 655 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 656 | break;
|
|---|
| 657 |
|
|---|
| 658 | case WM_CHAR:
|
|---|
| 659 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
|---|
| 660 | break;
|
|---|
| 661 |
|
|---|
| 662 | case WM_MENUEND:
|
|---|
| 663 | if (hwndMenu == (HWND) mp2) {
|
|---|
| 664 | WinDestroyWindow(hwndMenu);
|
|---|
| 665 | hwndMenu = (HWND) 0;
|
|---|
| 666 | }
|
|---|
| 667 | break;
|
|---|
| 668 |
|
|---|
| 669 | case WM_FOCUSCHANGE:
|
|---|
| 670 | {
|
|---|
| 671 | HAB hab = WinQueryAnchorBlock(hwnd);
|
|---|
| 672 | HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT);
|
|---|
| 673 | HWND hwndFrame = WinQueryWindow(hwndParent, QW_PARENT);
|
|---|
| 674 | static HACCEL haccelSaved = NULLHANDLE;
|
|---|
| 675 | static HACCEL haccelDriveList = NULLHANDLE;
|
|---|
| 676 | static HACCEL haccelSetupList = NULLHANDLE;
|
|---|
| 677 | static HACCEL haccelUserList = NULLHANDLE;
|
|---|
| 678 | static HACCEL haccelCmdList = NULLHANDLE;
|
|---|
| 679 | static HACCEL haccelButtonList = NULLHANDLE;
|
|---|
| 680 | // DbgMsg(pszSrcFile, __LINE__, "WM_FOCUSCHANGE %u", SHORT1FROMMP(mp2));
|
|---|
| 681 | id = WinQueryWindowUShort(hwndParent, QWS_ID);
|
|---|
| 682 | if (SHORT1FROMMP(mp2)) {
|
|---|
| 683 | // If getting focus 1st time - save original accelerator
|
|---|
| 684 | if (haccelSaved == NULLHANDLE) {
|
|---|
| 685 | haccelSaved = WinQueryAccelTable(hab, hwndFrame);
|
|---|
| 686 | if (haccelSaved == NULLHANDLE)
|
|---|
| 687 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable");
|
|---|
| 688 | // else
|
|---|
| 689 | // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved);
|
|---|
| 690 | }
|
|---|
| 691 | if (haccelSaved != NULLHANDLE) {
|
|---|
| 692 | switch (id) {
|
|---|
| 693 | case MAIN_DRIVELIST:
|
|---|
| 694 | if (haccelDriveList == NULLHANDLE) {
|
|---|
| 695 | haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST);
|
|---|
| 696 | if (haccelDriveList == NULLHANDLE)
|
|---|
| 697 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
|---|
| 698 | }
|
|---|
| 699 | if (haccelDriveList != NULLHANDLE) {
|
|---|
| 700 | if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame))
|
|---|
| 701 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
|---|
| 702 | // else
|
|---|
| 703 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList);
|
|---|
| 704 | }
|
|---|
| 705 | break;
|
|---|
| 706 | case MAIN_SETUPLIST:
|
|---|
| 707 | if (haccelSetupList == NULLHANDLE) {
|
|---|
| 708 | haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST);
|
|---|
| 709 | if (haccelSetupList == NULLHANDLE)
|
|---|
| 710 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
|---|
| 711 | }
|
|---|
| 712 | if (haccelSetupList != NULLHANDLE) {
|
|---|
| 713 | if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame))
|
|---|
| 714 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
|---|
| 715 | // else
|
|---|
| 716 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList);
|
|---|
| 717 | }
|
|---|
| 718 | break;
|
|---|
| 719 | case MAIN_CMDLIST:
|
|---|
| 720 | if (haccelCmdList == NULLHANDLE) {
|
|---|
| 721 | haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST);
|
|---|
| 722 | if (haccelCmdList == NULLHANDLE)
|
|---|
| 723 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
|---|
| 724 | }
|
|---|
| 725 | if (haccelCmdList != NULLHANDLE) {
|
|---|
| 726 | if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame))
|
|---|
| 727 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
|---|
| 728 | // else
|
|---|
| 729 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList);
|
|---|
| 730 | }
|
|---|
| 731 | break;
|
|---|
| 732 | case MAIN_USERLIST:
|
|---|
| 733 | if (haccelUserList == NULLHANDLE) {
|
|---|
| 734 | haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST);
|
|---|
| 735 | if (haccelUserList == NULLHANDLE)
|
|---|
| 736 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
|---|
| 737 | }
|
|---|
| 738 | if (haccelUserList != NULLHANDLE) {
|
|---|
| 739 | if (!WinSetAccelTable(hab, haccelUserList, hwndFrame))
|
|---|
| 740 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
|---|
| 741 | // else
|
|---|
| 742 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList);
|
|---|
| 743 | }
|
|---|
| 744 | break;
|
|---|
| 745 | case MAIN_BUTTONLIST:
|
|---|
| 746 | if (haccelButtonList == NULLHANDLE) {
|
|---|
| 747 | haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST);
|
|---|
| 748 | if (haccelButtonList == NULLHANDLE)
|
|---|
| 749 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
|---|
| 750 | }
|
|---|
| 751 | if (haccelButtonList != NULLHANDLE) {
|
|---|
| 752 | if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame))
|
|---|
| 753 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
|---|
| 754 | // else
|
|---|
| 755 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList);
|
|---|
| 756 | }
|
|---|
| 757 | break;
|
|---|
| 758 | } // switch
|
|---|
| 759 | }
|
|---|
| 760 | }
|
|---|
| 761 | else {
|
|---|
| 762 | // Losing focus
|
|---|
| 763 | switch (id) {
|
|---|
| 764 | case MAIN_DRIVELIST:
|
|---|
| 765 | case MAIN_SETUPLIST:
|
|---|
| 766 | case MAIN_CMDLIST:
|
|---|
| 767 | case MAIN_USERLIST:
|
|---|
| 768 | case MAIN_BUTTONLIST:
|
|---|
| 769 | if (haccelSaved != NULLHANDLE) {
|
|---|
| 770 | if (!WinSetAccelTable(hab, haccelSaved, hwndFrame))
|
|---|
| 771 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
|---|
| 772 | // else
|
|---|
| 773 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved);
|
|---|
| 774 | }
|
|---|
| 775 | break;
|
|---|
| 776 | } // switch
|
|---|
| 777 | }
|
|---|
| 778 | }
|
|---|
| 779 | break; // WM_FOCUSCHANGE
|
|---|
| 780 |
|
|---|
| 781 | case WM_CONTEXTMENU:
|
|---|
| 782 | {
|
|---|
| 783 | MRESULT ret = MRFROMSHORT(TRUE);
|
|---|
| 784 |
|
|---|
| 785 | if (hwndMenu)
|
|---|
| 786 | WinDestroyWindow(hwndMenu);
|
|---|
| 787 | hwndMenu = (HWND) 0;
|
|---|
| 788 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
|---|
| 789 | switch (id) {
|
|---|
| 790 | case MAIN_CMDLIST:
|
|---|
| 791 | WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
|---|
| 792 | QW_PARENT),
|
|---|
| 793 | QW_PARENT),
|
|---|
| 794 | FID_CLIENT),
|
|---|
| 795 | WM_COMMAND, MPFROM2SHORT(IDM_EDITCOMMANDS, 0), MPVOID);
|
|---|
| 796 | break;
|
|---|
| 797 | case MAIN_USERLIST:
|
|---|
| 798 | case MAIN_SETUPLIST:
|
|---|
| 799 | hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
|
|---|
| 800 | if (hwndMenu)
|
|---|
| 801 | PopupMenu(hwnd,
|
|---|
| 802 | WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
|---|
| 803 | QW_PARENT),
|
|---|
| 804 | QW_PARENT),
|
|---|
| 805 | FID_CLIENT), hwndMenu);
|
|---|
| 806 | break;
|
|---|
| 807 | default:
|
|---|
| 808 | ret = FALSE;
|
|---|
| 809 | break;
|
|---|
| 810 | } // switch
|
|---|
| 811 | return ret;
|
|---|
| 812 | }
|
|---|
| 813 |
|
|---|
| 814 | case WM_CONTROL:
|
|---|
| 815 | if (hwndStatus2) {
|
|---|
| 816 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| 817 | case CBID_EDIT:
|
|---|
| 818 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 819 | switch (SHORT2FROMMP(mp1)) {
|
|---|
| 820 | case EN_SETFOCUS:
|
|---|
| 821 | switch (id) {
|
|---|
| 822 | case MAIN_CMDLIST:
|
|---|
| 823 | WinSetWindowText(hwndStatus2, GetPString(IDS_CMDLISTHELP));
|
|---|
| 824 | break;
|
|---|
| 825 | case MAIN_SETUPLIST:
|
|---|
| 826 | WinSetWindowText(hwndStatus2, GetPString(IDS_SETUPLISTHELP));
|
|---|
| 827 | break;
|
|---|
| 828 | case MAIN_USERLIST:
|
|---|
| 829 | WinSetWindowText(hwndStatus2, GetPString(IDS_USERLISTHELP));
|
|---|
| 830 | break;
|
|---|
| 831 | case MAIN_DRIVELIST:
|
|---|
| 832 | WinSetWindowText(hwndStatus2, GetPString(IDS_DRIVELISTHELP));
|
|---|
| 833 | break;
|
|---|
| 834 | case MAIN_BUTTONLIST:
|
|---|
| 835 | WinSetWindowText(hwndStatus2, GetPString(IDS_BUTTONLISTHELP));
|
|---|
| 836 | break;
|
|---|
| 837 | default:
|
|---|
| 838 | break;
|
|---|
| 839 | }
|
|---|
| 840 | break;
|
|---|
| 841 |
|
|---|
| 842 | default:
|
|---|
| 843 | break;
|
|---|
| 844 | }
|
|---|
| 845 | }
|
|---|
| 846 | break;
|
|---|
| 847 |
|
|---|
| 848 | default:
|
|---|
| 849 | break;
|
|---|
| 850 | }
|
|---|
| 851 | break;
|
|---|
| 852 |
|
|---|
| 853 | case WM_BEGINDRAG:
|
|---|
| 854 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 855 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"%u %s %u",id,(id == CBID_EDIT) ? "TRUE" : "FALSE",WinQueryWindowUShort(WinQueryWindow(hwnd,QW_PARENT),QWS_ID) == MAIN_USERLIST);
|
|---|
| 856 | if (id == CBID_EDIT &&
|
|---|
| 857 | WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) ==
|
|---|
| 858 | MAIN_USERLIST) {
|
|---|
| 859 |
|
|---|
| 860 | CHAR path[CCHMAXPATH];
|
|---|
| 861 |
|
|---|
| 862 | *path = 0;
|
|---|
| 863 | WinQueryWindowText(hwnd, CCHMAXPATH, path);
|
|---|
| 864 | bstrip(path);
|
|---|
| 865 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Dragging: %s",path);
|
|---|
| 866 | if (*path && !IsRoot(path))
|
|---|
| 867 | DragOne(hwnd, (HWND) 0, path, FALSE);
|
|---|
| 868 | return 0;
|
|---|
| 869 | }
|
|---|
| 870 | break;
|
|---|
| 871 |
|
|---|
| 872 | case DM_DRAGOVER:
|
|---|
| 873 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
|---|
| 874 | if (id == MAIN_USERLIST) {
|
|---|
| 875 | if (!emphasized) {
|
|---|
| 876 | emphasized = TRUE;
|
|---|
| 877 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| 878 | }
|
|---|
| 879 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
|---|
| 880 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
|---|
| 881 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
|---|
| 882 | }
|
|---|
| 883 | break;
|
|---|
| 884 |
|
|---|
| 885 | case DM_DRAGLEAVE:
|
|---|
| 886 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
|---|
| 887 | if (id == MAIN_USERLIST) {
|
|---|
| 888 | if (emphasized) {
|
|---|
| 889 | emphasized = FALSE;
|
|---|
| 890 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| 891 | }
|
|---|
| 892 | }
|
|---|
| 893 | break;
|
|---|
| 894 |
|
|---|
| 895 | case DM_DROPHELP:
|
|---|
| 896 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
|---|
| 897 | if (id == MAIN_USERLIST) {
|
|---|
| 898 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_USERLISTDROPHELP));
|
|---|
| 899 | return 0;
|
|---|
| 900 | }
|
|---|
| 901 | break;
|
|---|
| 902 |
|
|---|
| 903 | case DM_DROP:
|
|---|
| 904 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
|---|
| 905 | if (id == MAIN_USERLIST) {
|
|---|
| 906 |
|
|---|
| 907 | char szFrom[CCHMAXPATH + 2];
|
|---|
| 908 |
|
|---|
| 909 | if (emphasized) {
|
|---|
| 910 | emphasized = FALSE;
|
|---|
| 911 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| 912 | }
|
|---|
| 913 | if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
|
|---|
| 914 | MakeValidDir(szFrom);
|
|---|
| 915 | WinSetWindowText(hwnd, szFrom);
|
|---|
| 916 | PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
|---|
| 917 | QW_PARENT),
|
|---|
| 918 | QW_PARENT),
|
|---|
| 919 | FID_CLIENT),
|
|---|
| 920 | UM_COMMAND, MPFROM2SHORT(IDM_ADDTOUSERLIST, 0), MPVOID);
|
|---|
| 921 | return 0;
|
|---|
| 922 | }
|
|---|
| 923 | }
|
|---|
| 924 | break;
|
|---|
| 925 |
|
|---|
| 926 | case WM_DESTROY:
|
|---|
| 927 | if (hwndMenu)
|
|---|
| 928 | WinDestroyWindow(hwndMenu);
|
|---|
| 929 | hwndMenu = (HWND) 0;
|
|---|
| 930 | break;
|
|---|
| 931 | }
|
|---|
| 932 |
|
|---|
| 933 | return oldproc(hwnd, msg, mp1, mp2);
|
|---|
| 934 | }
|
|---|
| 935 |
|
|---|
| 936 | void BubbleHelp(HWND hwnd, BOOL other, BOOL drive, BOOL above, char *help)
|
|---|
| 937 | {
|
|---|
| 938 | if (help && *help &&
|
|---|
| 939 | ((drive && fDrivebarHelp) ||
|
|---|
| 940 | (other && fOtherHelp) || (!other && !drive && fToolbarHelp))) {
|
|---|
| 941 | if ((!hwndBubble ||
|
|---|
| 942 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
|---|
| 943 | !WinQueryCapture(HWND_DESKTOP))
|
|---|
| 944 | MakeBubble(hwnd, above, help);
|
|---|
| 945 | }
|
|---|
| 946 | }
|
|---|
| 947 |
|
|---|
| 948 | VOID MakeBubble(HWND hwnd, BOOL above, CHAR * help)
|
|---|
| 949 | {
|
|---|
| 950 | if (!hwnd || !help || !*help)
|
|---|
| 951 | return;
|
|---|
| 952 |
|
|---|
| 953 | if (hwndBubble)
|
|---|
| 954 | WinDestroyWindow(hwndBubble);
|
|---|
| 955 |
|
|---|
| 956 | {
|
|---|
| 957 | HWND hwndActive;
|
|---|
| 958 | char ucClassname[8];
|
|---|
| 959 |
|
|---|
| 960 | hwndActive = WinQueryActiveWindow(HWND_DESKTOP);
|
|---|
| 961 | if (hwndActive) {
|
|---|
| 962 | /* don't bring up help if window isn't active */
|
|---|
| 963 | if (!WinIsChild(hwnd, hwndActive))
|
|---|
| 964 | return;
|
|---|
| 965 | }
|
|---|
| 966 | hwndActive = WinQueryFocus(HWND_DESKTOP);
|
|---|
| 967 | if (WinQueryClassName(hwndActive, sizeof(ucClassname), ucClassname)) {
|
|---|
| 968 | /* don't bring up help if a menu is active */
|
|---|
| 969 | if (!strcmp(ucClassname, "#4"))
|
|---|
| 970 | return;
|
|---|
| 971 | }
|
|---|
| 972 | }
|
|---|
| 973 |
|
|---|
| 974 | hwndBubble = WinCreateWindow(HWND_DESKTOP,
|
|---|
| 975 | WC_BUBBLE,
|
|---|
| 976 | help,
|
|---|
| 977 | WS_CLIPSIBLINGS | SS_TEXT |
|
|---|
| 978 | DT_CENTER | DT_VCENTER,
|
|---|
| 979 | 0,
|
|---|
| 980 | 0,
|
|---|
| 981 | 0,
|
|---|
| 982 | 0,
|
|---|
| 983 | HWND_DESKTOP, HWND_TOP, MAIN_HELP, NULL, NULL);
|
|---|
| 984 | if (!hwndBubble)
|
|---|
| 985 | Win_Error2(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 986 | IDS_WINCREATEWINDOW);
|
|---|
| 987 | else {
|
|---|
| 988 | HPS hps;
|
|---|
| 989 | POINTL aptl[TXTBOX_COUNT], ptl, tptl;
|
|---|
| 990 | LONG lxScreen, sx, sy, extra = 0, lyScreen;
|
|---|
| 991 | char *p, *pp, *wp;
|
|---|
| 992 | SWP swp;
|
|---|
| 993 |
|
|---|
| 994 | WinQueryWindowPos(hwnd, &swp);
|
|---|
| 995 | lyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
|
|---|
| 996 | lxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
|
|---|
| 997 | WinSetWindowULong(hwndBubble, QWL_USER, hwnd);
|
|---|
| 998 | SetPresParams(hwndBubble, NULL, NULL, NULL, GetPString(IDS_8HELVTEXT));
|
|---|
| 999 | hps = WinGetPS(hwndBubble);
|
|---|
| 1000 | p = help;
|
|---|
| 1001 | tptl.x = tptl.y = 0;
|
|---|
| 1002 | while (p && *p) {
|
|---|
| 1003 | wp = NULL;
|
|---|
| 1004 | pp = strchr(p, '\r');
|
|---|
| 1005 | if (pp) {
|
|---|
| 1006 | wp = pp;
|
|---|
| 1007 | *pp = 0;
|
|---|
| 1008 | pp++;
|
|---|
| 1009 | }
|
|---|
| 1010 | GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
|
|---|
| 1011 | tptl.x = max(aptl[TXTBOX_TOPRIGHT].x, tptl.x);
|
|---|
| 1012 | if (tptl.y)
|
|---|
| 1013 | tptl.y += extra;
|
|---|
| 1014 | else
|
|---|
| 1015 | extra = aptl[TXTBOX_TOPLEFT].y / 4;
|
|---|
| 1016 | tptl.y += aptl[TXTBOX_TOPLEFT].y;
|
|---|
| 1017 | if (wp)
|
|---|
| 1018 | *wp = '\r';
|
|---|
| 1019 | p = pp;
|
|---|
| 1020 | }
|
|---|
| 1021 | WinSetWindowULong(hwndBubble, QWL_USER + 4, extra);
|
|---|
| 1022 | WinReleasePS(hps);
|
|---|
| 1023 | ptl.x = ptl.y = 0;
|
|---|
| 1024 | WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptl, 1);
|
|---|
| 1025 | if (above) {
|
|---|
| 1026 | sy = ptl.y + swp.cy + 4;
|
|---|
| 1027 | if (sy + tptl.y + 12 > lyScreen) {
|
|---|
| 1028 | above = FALSE;
|
|---|
| 1029 | sy = ptl.y - (tptl.y + 14);
|
|---|
| 1030 | }
|
|---|
| 1031 | }
|
|---|
| 1032 | else
|
|---|
| 1033 | sy = ptl.y - (tptl.y + 14);
|
|---|
| 1034 | if (ptl.x > (lxScreen / 2))
|
|---|
| 1035 | sx = (ptl.x - tptl.x) - 16;
|
|---|
| 1036 | else
|
|---|
| 1037 | sx = ptl.x + (54 * (above == FALSE)) + 2;
|
|---|
| 1038 | if (sx < 0)
|
|---|
| 1039 | sx = 0;
|
|---|
| 1040 | if (sx + tptl.x + 14 > lxScreen)
|
|---|
| 1041 | sx = lxScreen - (tptl.x + 14);
|
|---|
| 1042 | if (sy < 0) {
|
|---|
| 1043 | sy = ptl.y + swp.cy + 4;
|
|---|
| 1044 | if (sy + tptl.y + 12 > lyScreen)
|
|---|
| 1045 | sy = 0;
|
|---|
| 1046 | }
|
|---|
| 1047 | WinSetWindowPos(hwndBubble, HWND_TOP, sx, sy,
|
|---|
| 1048 | tptl.x + 14,
|
|---|
| 1049 | tptl.y + 12,
|
|---|
| 1050 | SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER |
|
|---|
| 1051 | SWP_MOVE | SWP_SIZE);
|
|---|
| 1052 | }
|
|---|
| 1053 | }
|
|---|
| 1054 |
|
|---|
| 1055 | MRESULT EXPENTRY BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 1056 | {
|
|---|
| 1057 | switch (msg) {
|
|---|
| 1058 | case WM_SETFOCUS:
|
|---|
| 1059 | if (mp2)
|
|---|
| 1060 | PostMsg(hwnd, UM_FOCUSME, mp1, MPVOID);
|
|---|
| 1061 | break;
|
|---|
| 1062 |
|
|---|
| 1063 | case UM_FOCUSME:
|
|---|
| 1064 | WinSetFocus(HWND_DESKTOP, (HWND) mp1);
|
|---|
| 1065 | return 0;
|
|---|
| 1066 |
|
|---|
| 1067 | case WM_MOUSEMOVE:
|
|---|
| 1068 | WinShowWindow(hwnd, FALSE);
|
|---|
| 1069 | break;
|
|---|
| 1070 |
|
|---|
| 1071 | case UM_TIMER:
|
|---|
| 1072 | {
|
|---|
| 1073 | POINTL ptl;
|
|---|
| 1074 |
|
|---|
| 1075 | WinQueryPointerPos(HWND_DESKTOP, &ptl);
|
|---|
| 1076 | if (WinWindowFromPoint(HWND_DESKTOP, &ptl, TRUE) !=
|
|---|
| 1077 | WinQueryWindowULong(hwnd, QWL_USER) || !WinIsWindowVisible(hwnd))
|
|---|
| 1078 | WinDestroyWindow(hwnd);
|
|---|
| 1079 | }
|
|---|
| 1080 | return 0;
|
|---|
| 1081 |
|
|---|
| 1082 | case WM_PAINT:
|
|---|
| 1083 | {
|
|---|
| 1084 | HPS hps;
|
|---|
| 1085 | SWP swp;
|
|---|
| 1086 | POINTL ptl, aptl[TXTBOX_COUNT];
|
|---|
| 1087 | CHAR *s, *p, *pp, *wp;
|
|---|
| 1088 | ULONG extra, tlen, y;
|
|---|
| 1089 |
|
|---|
| 1090 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
|---|
| 1091 | if (hps) {
|
|---|
| 1092 | WinQueryWindowPos(hwnd, &swp);
|
|---|
| 1093 | GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0);
|
|---|
| 1094 | GpiSetColor(hps, ((255 << 16) | (255 << 8) | 198));
|
|---|
| 1095 | GpiSetBackMix(hps, BM_LEAVEALONE);
|
|---|
| 1096 | GpiSetMix(hps, FM_OVERPAINT);
|
|---|
| 1097 | ptl.x = ptl.y = 0;
|
|---|
| 1098 | GpiMove(hps, &ptl);
|
|---|
| 1099 | ptl.x = swp.cx - 1;
|
|---|
| 1100 | ptl.y = swp.cy - 1;
|
|---|
| 1101 | GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
|
|---|
| 1102 | tlen = WinQueryWindowTextLength(hwnd);
|
|---|
| 1103 | if (tlen) {
|
|---|
| 1104 | s = xmalloc(tlen + 2, pszSrcFile, __LINE__);
|
|---|
| 1105 | if (s) {
|
|---|
| 1106 | WinQueryWindowText(hwnd, tlen + 1, s);
|
|---|
| 1107 | if (*s) {
|
|---|
| 1108 | p = s;
|
|---|
| 1109 | y = swp.cy - 3;
|
|---|
| 1110 | extra = WinQueryWindowULong(hwnd, QWL_USER + 4);
|
|---|
| 1111 | GpiSetColor(hps, 0);
|
|---|
| 1112 | GpiSetMix(hps, FM_OVERPAINT);
|
|---|
| 1113 | while (p && *p) {
|
|---|
| 1114 | wp = NULL;
|
|---|
| 1115 | pp = strchr(p, '\r');
|
|---|
| 1116 | if (pp) {
|
|---|
| 1117 | wp = pp;
|
|---|
| 1118 | *pp = 0;
|
|---|
| 1119 | pp++;
|
|---|
| 1120 | }
|
|---|
| 1121 | GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
|
|---|
| 1122 | ptl.x = 7;
|
|---|
| 1123 | y -= aptl[TXTBOX_TOPLEFT].y;
|
|---|
| 1124 | if (p != s)
|
|---|
| 1125 | y -= extra;
|
|---|
| 1126 | ptl.y = y;
|
|---|
| 1127 | GpiCharStringAt(hps, &ptl, strlen(p), p);
|
|---|
| 1128 | if (wp)
|
|---|
| 1129 | *wp = '\r';
|
|---|
| 1130 | p = pp;
|
|---|
| 1131 | }
|
|---|
| 1132 | }
|
|---|
| 1133 | free(s);
|
|---|
| 1134 | }
|
|---|
| 1135 | }
|
|---|
| 1136 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) && swp.cx > 6 && swp.cy > 6) {
|
|---|
| 1137 | GpiSetColor(hps, CLR_WHITE);
|
|---|
| 1138 | ptl.x = 1;
|
|---|
| 1139 | ptl.y = 1;
|
|---|
| 1140 | GpiMove(hps, &ptl);
|
|---|
| 1141 | ptl.y = swp.cy - 2;
|
|---|
| 1142 | GpiLine(hps, &ptl);
|
|---|
| 1143 | ptl.x = swp.cx - 2;
|
|---|
| 1144 | GpiLine(hps, &ptl);
|
|---|
| 1145 | ptl.x = 2;
|
|---|
| 1146 | ptl.y = 2;
|
|---|
| 1147 | GpiMove(hps, &ptl);
|
|---|
| 1148 | ptl.y = swp.cy - 3;
|
|---|
| 1149 | GpiLine(hps, &ptl);
|
|---|
| 1150 | ptl.x = swp.cx - 3;
|
|---|
| 1151 | GpiLine(hps, &ptl);
|
|---|
| 1152 | GpiSetColor(hps, CLR_BROWN);
|
|---|
| 1153 | ptl.x = 1;
|
|---|
| 1154 | ptl.y = 1;
|
|---|
| 1155 | GpiMove(hps, &ptl);
|
|---|
| 1156 | ptl.x = swp.cx - 2;
|
|---|
| 1157 | GpiLine(hps, &ptl);
|
|---|
| 1158 | ptl.y = swp.cy - 2;
|
|---|
| 1159 | GpiLine(hps, &ptl);
|
|---|
| 1160 | ptl.x = 2;
|
|---|
| 1161 | ptl.y = 2;
|
|---|
| 1162 | GpiMove(hps, &ptl);
|
|---|
| 1163 | ptl.x = swp.cx - 3;
|
|---|
| 1164 | GpiLine(hps, &ptl);
|
|---|
| 1165 | ptl.y = swp.cy - 3;
|
|---|
| 1166 | GpiLine(hps, &ptl);
|
|---|
| 1167 | }
|
|---|
| 1168 | WinEndPaint(hps);
|
|---|
| 1169 | }
|
|---|
| 1170 | }
|
|---|
| 1171 | return 0;
|
|---|
| 1172 |
|
|---|
| 1173 | case WM_CLOSE:
|
|---|
| 1174 | WinDestroyWindow(hwnd);
|
|---|
| 1175 | return 0;
|
|---|
| 1176 |
|
|---|
| 1177 | case WM_DESTROY:
|
|---|
| 1178 | hwndBubble = (HWND) 0;
|
|---|
| 1179 | break;
|
|---|
| 1180 | }
|
|---|
| 1181 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
|---|
| 1182 | }
|
|---|
| 1183 |
|
|---|
| 1184 | MRESULT EXPENTRY LEDProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 1185 | {
|
|---|
| 1186 | switch (msg) {
|
|---|
| 1187 | case WM_CREATE:
|
|---|
| 1188 | {
|
|---|
| 1189 | MRESULT mr = PFNWPStatic(hwnd, msg, mp1, mp2);
|
|---|
| 1190 | HBITMAP hbmold = (HBITMAP) 0;
|
|---|
| 1191 | HPS hps = (HPS) 0;
|
|---|
| 1192 |
|
|---|
| 1193 | switch (WinQueryWindowUShort(hwnd, QWS_ID)) {
|
|---|
| 1194 | case MAIN_LED:
|
|---|
| 1195 | hps = WinGetPS(hwnd);
|
|---|
| 1196 | hbmold = (HBITMAP) WinSendMsg(hwnd, SM_QUERYHANDLE, MPVOID, MPVOID);
|
|---|
| 1197 | if (!fBlueLED) {
|
|---|
| 1198 | hbmLEDon = GpiLoadBitmap(hps, 0, LEDON_BMP, 12, 12);
|
|---|
| 1199 | hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF_BMP, 12, 12);
|
|---|
| 1200 | }
|
|---|
| 1201 | else {
|
|---|
| 1202 | hbmLEDon = GpiLoadBitmap(hps, 0, LEDON2_BMP, 12, 12);
|
|---|
| 1203 | hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF2_BMP, 12, 12);
|
|---|
| 1204 | }
|
|---|
| 1205 | if (hbmLEDoff && hbmLEDon)
|
|---|
| 1206 | WinSendMsg(hwnd, SM_SETHANDLE, MPFROMLONG(hbmLEDoff), MPVOID);
|
|---|
| 1207 | else {
|
|---|
| 1208 | if (hbmLEDoff)
|
|---|
| 1209 | GpiDeleteBitmap(hbmLEDoff);
|
|---|
| 1210 | if (hbmLEDon)
|
|---|
| 1211 | GpiDeleteBitmap(hbmLEDon);
|
|---|
| 1212 | }
|
|---|
| 1213 | if (hbmold &&
|
|---|
| 1214 | hbmLEDon &&
|
|---|
| 1215 | hbmLEDoff && hbmold != hbmLEDon && hbmold != hbmLEDoff)
|
|---|
| 1216 | GpiDeleteBitmap(hbmold);
|
|---|
| 1217 | if (hps)
|
|---|
| 1218 | WinReleasePS(hps);
|
|---|
| 1219 | break;
|
|---|
| 1220 | default:
|
|---|
| 1221 | SetPresParams(hwnd,
|
|---|
| 1222 | &RGBGREY,
|
|---|
| 1223 | &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));
|
|---|
| 1224 | break;
|
|---|
| 1225 | }
|
|---|
| 1226 | return mr;
|
|---|
| 1227 | }
|
|---|
| 1228 |
|
|---|
| 1229 | case WM_SETFOCUS:
|
|---|
| 1230 | if (mp2)
|
|---|
| 1231 | PostMsg(hwnd, UM_FOCUSME, mp1, MPVOID);
|
|---|
| 1232 | break;
|
|---|
| 1233 |
|
|---|
| 1234 | case UM_FOCUSME:
|
|---|
| 1235 | WinSetFocus(HWND_DESKTOP, (HWND) mp1);
|
|---|
| 1236 | return 0;
|
|---|
| 1237 |
|
|---|
| 1238 | case WM_MOUSEMOVE:
|
|---|
| 1239 | BubbleHelp(hwnd, TRUE, FALSE, FALSE, GetPString(IDS_LEDHELP));
|
|---|
| 1240 | if (!fNoFinger) {
|
|---|
| 1241 | WinSetPointer(HWND_DESKTOP, hptrFinger);
|
|---|
| 1242 | return MRFROMLONG(TRUE);
|
|---|
| 1243 | }
|
|---|
| 1244 | break;
|
|---|
| 1245 |
|
|---|
| 1246 | case WM_BUTTON1CLICK:
|
|---|
| 1247 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 1248 | WM_COMMAND, MPFROM2SHORT(IDM_SHOWNOTEWND, 0), MPVOID);
|
|---|
| 1249 | break;
|
|---|
| 1250 |
|
|---|
| 1251 | case WM_BUTTON2CLICK:
|
|---|
| 1252 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 1253 | WM_COMMAND, MPFROM2SHORT(IDM_HIDENOTEWND, 0), MPVOID);
|
|---|
| 1254 | break;
|
|---|
| 1255 |
|
|---|
| 1256 | case WM_CHORD:
|
|---|
| 1257 | case WM_BUTTON3CLICK:
|
|---|
| 1258 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 1259 | WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
|---|
| 1260 | break;
|
|---|
| 1261 | }
|
|---|
| 1262 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
|---|
| 1263 | }
|
|---|
| 1264 |
|
|---|
| 1265 | MRESULT EXPENTRY ChildButtonProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 1266 | {
|
|---|
| 1267 | USHORT id;
|
|---|
| 1268 | TOOL *tool;
|
|---|
| 1269 |
|
|---|
| 1270 | static HWND hwndMenu = (HWND) 0;
|
|---|
| 1271 |
|
|---|
| 1272 | switch (msg) {
|
|---|
| 1273 | case WM_BUTTON1DOWN:
|
|---|
| 1274 | case WM_BUTTON2DOWN:
|
|---|
| 1275 | case WM_BUTTON3DOWN:
|
|---|
| 1276 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 1277 | break;
|
|---|
| 1278 |
|
|---|
| 1279 | case WM_MOUSEMOVE:
|
|---|
| 1280 | if (fToolbarHelp) {
|
|---|
| 1281 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
|---|
| 1282 | && !WinQueryCapture(HWND_DESKTOP)) {
|
|---|
| 1283 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1284 | tool = find_tool(id);
|
|---|
| 1285 | if (tool && tool->help && *tool->help) {
|
|---|
| 1286 |
|
|---|
| 1287 | char s[128];
|
|---|
| 1288 |
|
|---|
| 1289 | strcpy(s, tool->help);
|
|---|
| 1290 | if (tool->flags & T_DROPABLE)
|
|---|
| 1291 | strcat(s, GetPString(IDS_DROPONMETEXT));
|
|---|
| 1292 | MakeBubble(hwnd, FALSE, s);
|
|---|
| 1293 | }
|
|---|
| 1294 | }
|
|---|
| 1295 | }
|
|---|
| 1296 | break;
|
|---|
| 1297 |
|
|---|
| 1298 | case WM_COMMAND:
|
|---|
| 1299 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| 1300 | case IDM_HELP:
|
|---|
| 1301 | if (hwndHelp)
|
|---|
| 1302 | WinSendMsg(hwndHelp,
|
|---|
| 1303 | HM_DISPLAY_HELP,
|
|---|
| 1304 | MPFROM2SHORT(HELP_TOOLBAR, 0), MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 1305 | break;
|
|---|
| 1306 |
|
|---|
| 1307 | case IDM_HIDEANYTOOL: /* hide any tool */
|
|---|
| 1308 | case IDM_HIDETOOL: /* hide tool */
|
|---|
| 1309 | if (SHORT1FROMMP(mp1) == IDM_HIDETOOL)
|
|---|
| 1310 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1311 | else
|
|---|
| 1312 | id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd,
|
|---|
| 1313 | PickToolProc, FM3ModHandle,
|
|---|
| 1314 | PICKBTN_FRAME, GetPString(IDS_HIDETEXT));
|
|---|
| 1315 | if (id) {
|
|---|
| 1316 | tool = find_tool(id);
|
|---|
| 1317 | if (tool) {
|
|---|
| 1318 | tool->flags |= T_INVISIBLE;
|
|---|
| 1319 | save_tools(NULL);
|
|---|
| 1320 | }
|
|---|
| 1321 | }
|
|---|
| 1322 | break;
|
|---|
| 1323 |
|
|---|
| 1324 | case IDM_SHOWTOOLS: /* show all tools */
|
|---|
| 1325 | tool = toolhead;
|
|---|
| 1326 | while (tool) {
|
|---|
| 1327 | tool->flags &= (~T_INVISIBLE);
|
|---|
| 1328 | tool = tool->next;
|
|---|
| 1329 | }
|
|---|
| 1330 | save_tools(NULL);
|
|---|
| 1331 | break;
|
|---|
| 1332 |
|
|---|
| 1333 | case IDM_DELETEANYTOOL: /* delete any button */
|
|---|
| 1334 | case IDM_DELETETOOL: /* delete button */
|
|---|
| 1335 | if (SHORT1FROMMP(mp1) == IDM_DELETETOOL)
|
|---|
| 1336 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1337 | else
|
|---|
| 1338 | id =
|
|---|
| 1339 | (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
|
|---|
| 1340 | PICKBTN_FRAME, GetPString(IDS_DELETETEXT));
|
|---|
| 1341 | if (id)
|
|---|
| 1342 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP,
|
|---|
| 1343 | MPFROM2SHORT(id, 0), MPVOID);
|
|---|
| 1344 | return 0;
|
|---|
| 1345 |
|
|---|
| 1346 | case IDM_EDITANYTOOL: /* edit any button */
|
|---|
| 1347 | case IDM_EDITTOOL: /* edit button */
|
|---|
| 1348 | if (SHORT1FROMMP(mp1) == IDM_EDITTOOL)
|
|---|
| 1349 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1350 | else
|
|---|
| 1351 | id =
|
|---|
| 1352 | (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
|
|---|
| 1353 | PICKBTN_FRAME, GetPString(IDS_EDITTEXT));
|
|---|
| 1354 | if (id) {
|
|---|
| 1355 | tool = find_tool(id);
|
|---|
| 1356 | if (tool) {
|
|---|
| 1357 | if (WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,
|
|---|
| 1358 | ADDBTN_FRAME, (PVOID) tool))
|
|---|
| 1359 | WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
|---|
| 1360 | QW_PARENT),
|
|---|
| 1361 | QW_PARENT), FID_CLIENT),
|
|---|
| 1362 | WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),
|
|---|
| 1363 | MPFROM2SHORT(id, 0));
|
|---|
| 1364 | }
|
|---|
| 1365 | }
|
|---|
| 1366 | break;
|
|---|
| 1367 |
|
|---|
| 1368 | case IDM_ADDTOOL: /* add tool */
|
|---|
| 1369 | id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,
|
|---|
| 1370 | ADDBTN_FRAME, MPVOID);
|
|---|
| 1371 | if (id && id != (USHORT) - 1)
|
|---|
| 1372 | WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
|---|
| 1373 | QW_PARENT),
|
|---|
| 1374 | QW_PARENT), FID_CLIENT),
|
|---|
| 1375 | WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),
|
|---|
| 1376 | MPFROM2SHORT(id, 0));
|
|---|
| 1377 | break;
|
|---|
| 1378 |
|
|---|
| 1379 | case IDM_REORDERTOOLS: /* reorder tools */
|
|---|
| 1380 | WinDlgBox(HWND_DESKTOP,
|
|---|
| 1381 | hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID);
|
|---|
| 1382 | break;
|
|---|
| 1383 |
|
|---|
| 1384 | case IDM_SAVETOOLS:
|
|---|
| 1385 | case IDM_LOADTOOLS:
|
|---|
| 1386 | if (WinDlgBox(HWND_DESKTOP,
|
|---|
| 1387 | hwnd,
|
|---|
| 1388 | ToolIODlgProc,
|
|---|
| 1389 | FM3ModHandle,
|
|---|
| 1390 | SVBTN_FRAME,
|
|---|
| 1391 | (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ?
|
|---|
| 1392 | "TRUE" : NULL))
|
|---|
| 1393 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| 1394 | break;
|
|---|
| 1395 | }
|
|---|
| 1396 | ResizeTools(WinQueryWindow(hwnd, QW_PARENT));
|
|---|
| 1397 | return 0;
|
|---|
| 1398 |
|
|---|
| 1399 | case WM_MENUEND:
|
|---|
| 1400 | if (hwndMenu == (HWND) mp2) {
|
|---|
| 1401 | WinDestroyWindow(hwndMenu);
|
|---|
| 1402 | hwndMenu = (HWND) 0;
|
|---|
| 1403 | }
|
|---|
| 1404 | break;
|
|---|
| 1405 |
|
|---|
| 1406 | case WM_CONTEXTMENU:
|
|---|
| 1407 | //DosEnterCritSec(); //GKY 11-29-08
|
|---|
| 1408 | DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
|
|---|
| 1409 | if (!hwndMenu)
|
|---|
| 1410 | hwndMenu = WinLoadMenu(hwnd, FM3ModHandle, ID_BUTTONMENU);
|
|---|
| 1411 | DosReleaseMutexSem(hmtxFM2Globals);
|
|---|
| 1412 | //DosExitCritSec();
|
|---|
| 1413 | SetPresParams(hwndMenu, NULL, NULL, NULL, GetPString(IDS_10SYSPROTEXT));
|
|---|
| 1414 | if (PopupMenu(hwnd, hwnd, hwndMenu))
|
|---|
| 1415 | WinShowWindow(hwndMenu, TRUE);
|
|---|
| 1416 | return MRFROMSHORT(TRUE);
|
|---|
| 1417 |
|
|---|
| 1418 | case DM_DRAGOVER:
|
|---|
| 1419 | {
|
|---|
| 1420 | PDRAGINFO pDInfo; /* Pointer to DRAGINFO */
|
|---|
| 1421 |
|
|---|
| 1422 | pDInfo = (PDRAGINFO) mp1; /* Get DRAGINFO pointer */
|
|---|
| 1423 | DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
|
|---|
| 1424 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1425 | tool = find_tool(id);
|
|---|
| 1426 | if (!tool) {
|
|---|
| 1427 | DrgFreeDraginfo(pDInfo);
|
|---|
| 1428 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
|---|
| 1429 | }
|
|---|
| 1430 | if (!(tool->flags & T_DROPABLE)) {
|
|---|
| 1431 | DrgFreeDraginfo(pDInfo);
|
|---|
| 1432 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
|---|
| 1433 | }
|
|---|
| 1434 | {
|
|---|
| 1435 | PDRAGITEM pDItem; /* Pointer to DRAGITEM */
|
|---|
| 1436 |
|
|---|
| 1437 | pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
|
|---|
| 1438 | 0); /* Index to DRAGITEM */
|
|---|
| 1439 | if (DrgVerifyRMF(pDItem, /* Check valid rendering */
|
|---|
| 1440 | DRM_OS2FILE, /* mechanisms and data */
|
|---|
| 1441 | NULL)) { /* formats */
|
|---|
| 1442 | if (!(tool->flags & T_EMPHASIZED)) {
|
|---|
| 1443 | tool->flags |= T_EMPHASIZED;
|
|---|
| 1444 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
|---|
| 1445 | DrgFreeDraginfo(pDInfo);
|
|---|
| 1446 | }
|
|---|
| 1447 | return (MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
|
|---|
| 1448 | DO_MOVE)); /* Move operation valid */
|
|---|
| 1449 | }
|
|---|
| 1450 | DrgFreeDraginfo(pDInfo);
|
|---|
| 1451 | }
|
|---|
| 1452 | }
|
|---|
| 1453 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
|---|
| 1454 |
|
|---|
| 1455 | case DM_DROPHELP:
|
|---|
| 1456 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1457 | tool = find_tool(id);
|
|---|
| 1458 | PFNWPButton(hwnd, msg, mp1, mp2);
|
|---|
| 1459 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_TOOLDROPHELP));
|
|---|
| 1460 | return 0;
|
|---|
| 1461 |
|
|---|
| 1462 | case DM_DRAGLEAVE:
|
|---|
| 1463 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1464 | tool = find_tool(id);
|
|---|
| 1465 | if (tool && (tool->flags & T_DROPABLE)) {
|
|---|
| 1466 | if (tool->flags & T_EMPHASIZED) {
|
|---|
| 1467 | tool->flags &= (~T_EMPHASIZED);
|
|---|
| 1468 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
|---|
| 1469 | }
|
|---|
| 1470 | }
|
|---|
| 1471 | break;
|
|---|
| 1472 |
|
|---|
| 1473 | case DM_DROP:
|
|---|
| 1474 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1475 | tool = find_tool(id);
|
|---|
| 1476 | if (tool && (tool->flags & T_DROPABLE) != 0) {
|
|---|
| 1477 | LISTINFO *li;
|
|---|
| 1478 | CNRDRAGINFO cdi;
|
|---|
| 1479 |
|
|---|
| 1480 | if (tool->flags & T_EMPHASIZED) {
|
|---|
| 1481 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
|---|
| 1482 | tool->flags &= (~T_EMPHASIZED);
|
|---|
| 1483 | }
|
|---|
| 1484 | memset(&cdi, 0, sizeof(cdi));
|
|---|
| 1485 | cdi.pDragInfo = mp1;
|
|---|
| 1486 | li = DoFileDrop(hwnd, NULL, FALSE, mp1, MPFROMP(&cdi));
|
|---|
| 1487 | CheckPmDrgLimit(cdi.pDragInfo);
|
|---|
| 1488 | if (li) {
|
|---|
| 1489 | li->type = id;
|
|---|
| 1490 | if (!li->list || !li->list[0])
|
|---|
| 1491 | FreeListInfo(li);
|
|---|
| 1492 | else {
|
|---|
| 1493 | HWND hwndActive;
|
|---|
| 1494 |
|
|---|
| 1495 | hwndActive = TopWindow(hwndMain, (HWND) 0);
|
|---|
| 1496 | if (hwndActive) {
|
|---|
| 1497 | if (!WinSendMsg(hwndActive, UM_COMMAND, MPFROMP(li), MPVOID))
|
|---|
| 1498 | FreeListInfo(li);
|
|---|
| 1499 | }
|
|---|
| 1500 | else
|
|---|
| 1501 | FreeListInfo(li);
|
|---|
| 1502 | }
|
|---|
| 1503 | }
|
|---|
| 1504 | }
|
|---|
| 1505 | return 0;
|
|---|
| 1506 |
|
|---|
| 1507 | case WM_CLOSE:
|
|---|
| 1508 | WinDestroyWindow(hwnd);
|
|---|
| 1509 | return 0;
|
|---|
| 1510 | }
|
|---|
| 1511 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
|---|
| 1512 | }
|
|---|
| 1513 |
|
|---|
| 1514 | static VOID BuildTools(HWND hwndT, BOOL resize)
|
|---|
| 1515 | {
|
|---|
| 1516 | TOOL *tool;
|
|---|
| 1517 | ULONG ctrlxpos = 18L;
|
|---|
| 1518 | CHAR s[33];
|
|---|
| 1519 | HENUM henum;
|
|---|
| 1520 | HWND hwndTool;
|
|---|
| 1521 |
|
|---|
| 1522 | henum = WinBeginEnumWindows(hwndT);
|
|---|
| 1523 | while ((hwndTool = WinGetNextWindow(henum)) != NULLHANDLE)
|
|---|
| 1524 | if (!WinDestroyWindow(hwndTool))
|
|---|
| 1525 | Runtime_Error(pszSrcFile, __LINE__, "Unable to destroy toolbar button");
|
|---|
| 1526 | WinEndEnumWindows(henum);
|
|---|
| 1527 | if (!fToolbar) {
|
|---|
| 1528 | load_quicktools();
|
|---|
| 1529 | load_tools(NULL);
|
|---|
| 1530 | return;
|
|---|
| 1531 | }
|
|---|
| 1532 | if (!toolhead)
|
|---|
| 1533 | load_tools(NULL);
|
|---|
| 1534 | tool = toolhead;
|
|---|
| 1535 | while (tool) {
|
|---|
| 1536 | sprintf(s, "#%u", tool->id);
|
|---|
| 1537 | hwndTool = (HWND) 0;
|
|---|
| 1538 | if (!fTextTools) {
|
|---|
| 1539 | if (!(tool->flags & T_MYICON)) {
|
|---|
| 1540 | hwndTool = WinCreateWindow(hwndT,
|
|---|
| 1541 | WC_TOOLBUTTONS,
|
|---|
| 1542 | s,
|
|---|
| 1543 | BS_NOPOINTERFOCUS |
|
|---|
| 1544 | BS_BITMAP | BS_PUSHBUTTON,
|
|---|
| 1545 | ctrlxpos,
|
|---|
| 1546 | 14,
|
|---|
| 1547 | 32,
|
|---|
| 1548 | 32, hwndT, HWND_TOP, tool->id, NULL, NULL);
|
|---|
| 1549 | }
|
|---|
| 1550 | if (!hwndTool) {
|
|---|
| 1551 | HBITMAP hbm = LoadBitmapFromFileNum(tool->id);
|
|---|
| 1552 |
|
|---|
| 1553 | if (hbm) {
|
|---|
| 1554 | BTNCDATA btc;
|
|---|
| 1555 |
|
|---|
| 1556 | memset(&btc, 0, sizeof(btc));
|
|---|
| 1557 | btc.cb = sizeof(btc);
|
|---|
| 1558 | btc.hImage = hbm;
|
|---|
| 1559 | hwndTool = WinCreateWindow(hwndT,
|
|---|
| 1560 | WC_TOOLBUTTONS,
|
|---|
| 1561 | NullStr,
|
|---|
| 1562 | BS_NOPOINTERFOCUS |
|
|---|
| 1563 | BS_BITMAP | BS_PUSHBUTTON,
|
|---|
| 1564 | ctrlxpos,
|
|---|
| 1565 | 14,
|
|---|
| 1566 | 32,
|
|---|
| 1567 | 32,
|
|---|
| 1568 | hwndT, HWND_TOP, tool->id, &btc, NULL);
|
|---|
| 1569 | if (!hwndTool)
|
|---|
| 1570 | GpiDeleteBitmap(hbm);
|
|---|
| 1571 | }
|
|---|
| 1572 | }
|
|---|
| 1573 | if (hwndTool)
|
|---|
| 1574 | tool->flags &= (~T_TEXT);
|
|---|
| 1575 | }
|
|---|
| 1576 | if (!hwndTool) {
|
|---|
| 1577 | hwndTool = WinCreateWindow(hwndT,
|
|---|
| 1578 | WC_TOOLBUTTONS,
|
|---|
| 1579 | (!tool->text && tool->id >= IDM_COMMANDSTART
|
|---|
| 1580 | && tool->id <
|
|---|
| 1581 | IDM_QUICKTOOLSTART) ? command_title(tool->
|
|---|
| 1582 | id -
|
|---|
| 1583 | IDM_COMMANDSTART)
|
|---|
| 1584 | : tool->text,
|
|---|
| 1585 | BS_NOPOINTERFOCUS | BS_PUSHBUTTON, ctrlxpos,
|
|---|
| 1586 | 2, 54, 24, hwndT, HWND_TOP, tool->id, NULL,
|
|---|
| 1587 | NULL);
|
|---|
| 1588 | if (!hwndTool)
|
|---|
| 1589 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 1590 | IDS_WINCREATEWINDOW);
|
|---|
| 1591 | tool->flags |= T_TEXT;
|
|---|
| 1592 | }
|
|---|
| 1593 | if (fToolTitles && !fTextTools) {
|
|---|
| 1594 | hwndTool = WinCreateWindow(hwndT,
|
|---|
| 1595 | WC_STATIC,
|
|---|
| 1596 | tool->text,
|
|---|
| 1597 | SS_TEXT | DT_LEFT | DT_VCENTER,
|
|---|
| 1598 | ctrlxpos,
|
|---|
| 1599 | 1,
|
|---|
| 1600 | 32,
|
|---|
| 1601 | 10,
|
|---|
| 1602 | hwndT,
|
|---|
| 1603 | HWND_TOP, tool->id + 25000, NULL, NULL);
|
|---|
| 1604 | if (!hwndTool)
|
|---|
| 1605 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 1606 | IDS_WINCREATEWINDOW);
|
|---|
| 1607 | else {
|
|---|
| 1608 | SetPresParams(hwndTool,
|
|---|
| 1609 | &RGBGREY,
|
|---|
| 1610 | &RGBBLACK, &RGBGREY, GetPString(IDS_2SYSTEMVIOTEXT));
|
|---|
| 1611 | }
|
|---|
| 1612 | }
|
|---|
| 1613 | ctrlxpos += ((tool->flags & T_TEXT) ? 55L : 33L);
|
|---|
| 1614 | SetPresParams(WinWindowFromID(hwndT, tool->id),
|
|---|
| 1615 | NULL, NULL, NULL, GetPString(IDS_8HELVTEXT));
|
|---|
| 1616 | tool = tool->next;
|
|---|
| 1617 | } // while tool
|
|---|
| 1618 |
|
|---|
| 1619 | hwndTool = WinCreateWindow(hwndT,
|
|---|
| 1620 | WC_BUTTON,
|
|---|
| 1621 | "#6010",
|
|---|
| 1622 | BS_NOPOINTERFOCUS |
|
|---|
| 1623 | BS_BITMAP | BS_PUSHBUTTON,
|
|---|
| 1624 | 1,
|
|---|
| 1625 | 19,
|
|---|
| 1626 | 14,
|
|---|
| 1627 | 13, hwndT, HWND_TOP, IDM_TOOLLEFT, NULL, NULL);
|
|---|
| 1628 | if (!hwndTool)
|
|---|
| 1629 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 1630 | IDS_WINCREATEWINDOW);
|
|---|
| 1631 | hwndTool =
|
|---|
| 1632 | WinCreateWindow(hwndT, WC_BUTTON, "#6011",
|
|---|
| 1633 | BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 1, 4, 14,
|
|---|
| 1634 | 13, hwndT, HWND_TOP, IDM_TOOLRIGHT, NULL, NULL);
|
|---|
| 1635 | if (!hwndTool)
|
|---|
| 1636 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 1637 | IDS_WINCREATEWINDOW);
|
|---|
| 1638 | if (resize)
|
|---|
| 1639 | ResizeTools(hwndT);
|
|---|
| 1640 | }
|
|---|
| 1641 |
|
|---|
| 1642 | static MRESULT EXPENTRY CommandLineProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
|---|
| 1643 | MPARAM mp2)
|
|---|
| 1644 | {
|
|---|
| 1645 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
|---|
| 1646 | static BOOL lbup = FALSE;
|
|---|
| 1647 |
|
|---|
| 1648 | switch (msg) {
|
|---|
| 1649 | case UM_FOCUSME:
|
|---|
| 1650 | WinSetFocus(HWND_DESKTOP, hwnd);
|
|---|
| 1651 | return 0;
|
|---|
| 1652 |
|
|---|
| 1653 | case WM_SETFOCUS:
|
|---|
| 1654 | if (!mp2 && !lbup) {
|
|---|
| 1655 |
|
|---|
| 1656 | PID pid;
|
|---|
| 1657 | TID tid;
|
|---|
| 1658 |
|
|---|
| 1659 | if (WinQueryWindowUShort((HWND) mp1, QWS_ID) == COMMAND_BUTTON)
|
|---|
| 1660 | break;
|
|---|
| 1661 | if (!WinQueryWindowProcess((HWND) mp1, &pid, &tid) || pid == mypid)
|
|---|
| 1662 | WinDestroyWindow(hwnd);
|
|---|
| 1663 | }
|
|---|
| 1664 | break;
|
|---|
| 1665 |
|
|---|
| 1666 | case UM_RESCAN:
|
|---|
| 1667 | {
|
|---|
| 1668 | PSZ pszCmdLine;
|
|---|
| 1669 |
|
|---|
| 1670 | pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
|---|
| 1671 | if (pszCmdLine) {
|
|---|
| 1672 | lbup = TRUE;
|
|---|
| 1673 | if (WinDlgBox(HWND_DESKTOP,
|
|---|
| 1674 | hwnd,
|
|---|
| 1675 | CmdLine2DlgProc,
|
|---|
| 1676 | FM3ModHandle, EXEC2_FRAME, MPFROMP(pszCmdLine))) {
|
|---|
| 1677 | lstrip(pszCmdLine);
|
|---|
| 1678 | WinSetWindowText(hwnd, pszCmdLine);
|
|---|
| 1679 | }
|
|---|
| 1680 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
|---|
| 1681 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
|---|
| 1682 | free(pszCmdLine);
|
|---|
| 1683 | }
|
|---|
| 1684 | }
|
|---|
| 1685 | return 0;
|
|---|
| 1686 |
|
|---|
| 1687 | case UM_SETUP:
|
|---|
| 1688 | lbup = FALSE;
|
|---|
| 1689 | return 0;
|
|---|
| 1690 |
|
|---|
| 1691 | case WM_BUTTON1DBLCLK:
|
|---|
| 1692 | PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID);
|
|---|
| 1693 | return 0;
|
|---|
| 1694 |
|
|---|
| 1695 | case WM_COMMAND:
|
|---|
| 1696 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| 1697 | case COMMAND_BUTTON:
|
|---|
| 1698 | if (!lbup)
|
|---|
| 1699 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
|---|
| 1700 | break;
|
|---|
| 1701 | }
|
|---|
| 1702 | return 0;
|
|---|
| 1703 |
|
|---|
| 1704 | case UM_OPENWINDOWFORME:
|
|---|
| 1705 | {
|
|---|
| 1706 | static char directory[CCHMAXPATH], cl[1000];
|
|---|
| 1707 | char **list = NULL;
|
|---|
| 1708 | ULONG len;
|
|---|
| 1709 | HWND hwndCnr;
|
|---|
| 1710 |
|
|---|
| 1711 | *directory = *cl = 0;
|
|---|
| 1712 | strcpy(cl, GetCmdSpec(FALSE));
|
|---|
| 1713 | strcat(cl, " /C ");
|
|---|
| 1714 | len = strlen(cl);
|
|---|
| 1715 | WinQueryWindowText(hwnd, 1000 - len, cl + len);
|
|---|
| 1716 | bstrip(cl + len);
|
|---|
| 1717 | if (strlen(cl) > len) {
|
|---|
| 1718 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 1719 | UM_SETUP, MPFROMP(cl + len), MPVOID);
|
|---|
| 1720 | WinQueryWindowText(hwndStatus, CCHMAXPATH, directory);
|
|---|
| 1721 | bstrip(directory);
|
|---|
| 1722 | if (*directory && (IsRoot(directory) || !IsFile(directory))) {
|
|---|
| 1723 | if (!FM2Command(directory, cl + len)) {
|
|---|
| 1724 | hwndCnr = TopWindow(hwndMain, (HWND) 0);
|
|---|
| 1725 | if (hwndCnr) {
|
|---|
| 1726 | hwndCnr = WinWindowFromID(hwndCnr, FID_CLIENT);
|
|---|
| 1727 | if (hwndCnr) {
|
|---|
| 1728 | hwndCnr = WinWindowFromID(hwndCnr, DIR_CNR);
|
|---|
| 1729 | if (hwndCnr)
|
|---|
| 1730 | list = BuildList(hwndCnr);
|
|---|
| 1731 | }
|
|---|
| 1732 | }
|
|---|
| 1733 | WinSetActiveWindow(HWND_DESKTOP, hwndCnr);
|
|---|
| 1734 | if (add_cmdline(cl + len, FALSE) && fSaveMiniCmds)
|
|---|
| 1735 | save_cmdlines(FALSE);
|
|---|
| 1736 | ExecOnList(hwndCnr,
|
|---|
| 1737 | cl,
|
|---|
| 1738 | WINDOWED | ((fKeepCmdLine) ?
|
|---|
| 1739 | SEPARATEKEEP : SEPARATE),
|
|---|
| 1740 | directory, list, NULL, pszSrcFile, __LINE__);
|
|---|
| 1741 | xfree(list, pszSrcFile, __LINE__);
|
|---|
| 1742 | WinDestroyWindow(hwnd);
|
|---|
| 1743 | break;
|
|---|
| 1744 | }
|
|---|
| 1745 | }
|
|---|
| 1746 | }
|
|---|
| 1747 | WinSendMsg(hwnd, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);
|
|---|
| 1748 | }
|
|---|
| 1749 | return 0;
|
|---|
| 1750 |
|
|---|
| 1751 | case WM_CHAR:
|
|---|
| 1752 | if (!lbup && !(SHORT1FROMMP(mp1) & KC_KEYUP)) {
|
|---|
| 1753 | if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
|
|---|
| 1754 | if ((SHORT1FROMMP(mp2) & 255) == '\r')
|
|---|
| 1755 | PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID);
|
|---|
| 1756 | else if ((SHORT1FROMMP(mp2) & 0xff) == 0x1b)
|
|---|
| 1757 | WinDestroyWindow(hwnd);
|
|---|
| 1758 | else if (SHORT2FROMMP(mp2) == VK_UP || SHORT2FROMMP(mp2) == VK_DOWN)
|
|---|
| 1759 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
|---|
| 1760 | }
|
|---|
| 1761 | }
|
|---|
| 1762 | else if ((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) &&
|
|---|
| 1763 | ((SHORT2FROMMP(mp2) == VK_UP ||
|
|---|
| 1764 | SHORT2FROMMP(mp2) == VK_DOWN) ||
|
|---|
| 1765 | (SHORT1FROMMP(mp2) == '\x1b') || (SHORT1FROMMP(mp2) == '\r')))
|
|---|
| 1766 | return 0;
|
|---|
| 1767 | break;
|
|---|
| 1768 |
|
|---|
| 1769 | case WM_DESTROY:
|
|---|
| 1770 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_RESCAN, MPVOID, MPVOID);
|
|---|
| 1771 | lbup = FALSE;
|
|---|
| 1772 | break;
|
|---|
| 1773 | }
|
|---|
| 1774 | return oldproc(hwnd, msg, mp1, mp2);
|
|---|
| 1775 | }
|
|---|
| 1776 |
|
|---|
| 1777 | MRESULT EXPENTRY DriveBackProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 1778 | {
|
|---|
| 1779 | switch (msg) {
|
|---|
| 1780 | case WM_CREATE:
|
|---|
| 1781 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
|---|
| 1782 | break;
|
|---|
| 1783 |
|
|---|
| 1784 | case UM_SETUP:
|
|---|
| 1785 | {
|
|---|
| 1786 | RGB2 rgb;
|
|---|
| 1787 |
|
|---|
| 1788 | memset(&rgb, 0, sizeof(rgb));
|
|---|
| 1789 | rgb.bRed = (BYTE)128;
|
|---|
| 1790 | SetPresParams(hwnd,
|
|---|
| 1791 | &RGBGREY, &rgb, &RGBGREY, GetPString(IDS_8HELVTEXT));
|
|---|
| 1792 | SetTargetDir(hwnd, TRUE);
|
|---|
| 1793 | }
|
|---|
| 1794 | return 0;
|
|---|
| 1795 |
|
|---|
| 1796 | case WM_SETFOCUS:
|
|---|
| 1797 | case UM_FOCUSME:
|
|---|
| 1798 | case WM_BUTTON1DOWN:
|
|---|
| 1799 | case WM_BUTTON1UP:
|
|---|
| 1800 | case WM_BUTTON2DOWN:
|
|---|
| 1801 | case WM_BUTTON2UP:
|
|---|
| 1802 | case WM_BUTTON3DOWN:
|
|---|
| 1803 | case WM_BUTTON3UP:
|
|---|
| 1804 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
|---|
| 1805 |
|
|---|
| 1806 | case WM_MOUSEMOVE:
|
|---|
| 1807 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
|---|
| 1808 | break;
|
|---|
| 1809 |
|
|---|
| 1810 | case UM_CLICKED:
|
|---|
| 1811 | case UM_CLICKED3:
|
|---|
| 1812 | PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_SETTARGET, 0), MPVOID);
|
|---|
| 1813 | return 0;
|
|---|
| 1814 |
|
|---|
| 1815 | case WM_CHAR:
|
|---|
| 1816 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
|---|
| 1817 | break;
|
|---|
| 1818 |
|
|---|
| 1819 | case WM_CONTROLPOINTER:
|
|---|
| 1820 | if (!fNoFinger &&
|
|---|
| 1821 | (SHORT1FROMMP(mp1) >= IDM_DRIVEA &&
|
|---|
| 1822 | SHORT1FROMMP(mp1) < IDM_DRIVEA + 26))
|
|---|
| 1823 | return MRFROMLONG(hptrFinger);
|
|---|
| 1824 | break;
|
|---|
| 1825 |
|
|---|
| 1826 | case WM_COMMAND:
|
|---|
| 1827 | {
|
|---|
| 1828 | CHAR dv[4];
|
|---|
| 1829 |
|
|---|
| 1830 | *dv = 0;
|
|---|
| 1831 | WinQueryWindowText(WinWindowFromID(hwnd, SHORT1FROMMP(mp1) + 50),
|
|---|
| 1832 | 2, dv);
|
|---|
| 1833 | if (isalpha(*dv)) {
|
|---|
| 1834 |
|
|---|
| 1835 | HWND hwndActive;
|
|---|
| 1836 |
|
|---|
| 1837 | dv[1] = ':';
|
|---|
| 1838 | dv[2] = '\\';
|
|---|
| 1839 | dv[3] = 0;
|
|---|
| 1840 | hwndActive = TopWindow(hwnd, (HWND) 0);
|
|---|
| 1841 | if (hwndActive)
|
|---|
| 1842 | WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT),
|
|---|
| 1843 | UM_DRIVECMD, MPFROMP(dv), MPVOID);
|
|---|
| 1844 | }
|
|---|
| 1845 | }
|
|---|
| 1846 | return 0;
|
|---|
| 1847 |
|
|---|
| 1848 | case WM_PAINT:
|
|---|
| 1849 | PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
|
|---|
| 1850 | break;
|
|---|
| 1851 |
|
|---|
| 1852 | case WM_CLOSE:
|
|---|
| 1853 | WinDestroyWindow(hwnd);
|
|---|
| 1854 | return 0;
|
|---|
| 1855 | }
|
|---|
| 1856 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
|---|
| 1857 | }
|
|---|
| 1858 |
|
|---|
| 1859 | MRESULT EXPENTRY DriveProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 1860 | {
|
|---|
| 1861 | USHORT id;
|
|---|
| 1862 | CHAR szDrv[CCHMAXPATH];
|
|---|
| 1863 |
|
|---|
| 1864 | static BOOL emphasized = FALSE;
|
|---|
| 1865 | static HWND hwndMenu = NULLHANDLE;
|
|---|
| 1866 | static USHORT helpid = 0;
|
|---|
| 1867 |
|
|---|
| 1868 | switch (msg) {
|
|---|
| 1869 | case WM_MOUSEMOVE:
|
|---|
| 1870 | if (fDrivebarHelp &&
|
|---|
| 1871 | (!hwndBubble ||
|
|---|
| 1872 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
|---|
| 1873 | !WinQueryCapture(HWND_DESKTOP)) {
|
|---|
| 1874 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1875 | if (helpid != id) {
|
|---|
| 1876 | helpid = id;
|
|---|
| 1877 | PostMsg(MainObjectHwnd, UM_SETUP6, MPFROMLONG((ULONG) hwnd), MPVOID);
|
|---|
| 1878 | }
|
|---|
| 1879 | else
|
|---|
| 1880 | helpid = 0;
|
|---|
| 1881 | }
|
|---|
| 1882 | break;
|
|---|
| 1883 |
|
|---|
| 1884 | case UM_SETUP6:
|
|---|
| 1885 | if (helpid == WinQueryWindowUShort(hwnd, QWS_ID)) {
|
|---|
| 1886 | if ((char *)mp1 &&
|
|---|
| 1887 | (!hwndBubble ||
|
|---|
| 1888 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
|---|
| 1889 | !WinQueryCapture(HWND_DESKTOP)) {
|
|---|
| 1890 |
|
|---|
| 1891 | RECTL rcl;
|
|---|
| 1892 | POINTL ptl;
|
|---|
| 1893 |
|
|---|
| 1894 | WinQueryPointerPos(HWND_DESKTOP, &ptl);
|
|---|
| 1895 | WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);
|
|---|
| 1896 | WinQueryWindowRect(hwnd, &rcl);
|
|---|
| 1897 | if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl))
|
|---|
| 1898 | BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1);
|
|---|
| 1899 | }
|
|---|
| 1900 | }
|
|---|
| 1901 | return 0;
|
|---|
| 1902 |
|
|---|
| 1903 | case WM_MENUEND:
|
|---|
| 1904 | if (hwndMenu == (HWND) mp2) {
|
|---|
| 1905 | WinDestroyWindow(hwndMenu);
|
|---|
| 1906 | hwndMenu = (HWND) 0;
|
|---|
| 1907 | }
|
|---|
| 1908 | break;
|
|---|
| 1909 |
|
|---|
| 1910 | case WM_CONTEXTMENU:
|
|---|
| 1911 | if (hwndMenu)
|
|---|
| 1912 | WinDestroyWindow(hwndMenu);
|
|---|
| 1913 | hwndMenu = (HWND) 0;
|
|---|
| 1914 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1915 | *szDrv = 0;
|
|---|
| 1916 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 1917 | id + 50), sizeof(szDrv), szDrv);
|
|---|
| 1918 | if (isalpha(*szDrv)) {
|
|---|
| 1919 | hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, MAIN_DRIVES);
|
|---|
| 1920 | if (hwndMenu) {
|
|---|
| 1921 | BOOL rdy;
|
|---|
| 1922 | CHAR chDrv = *szDrv;
|
|---|
| 1923 | UINT iDrv;
|
|---|
| 1924 |
|
|---|
| 1925 | strcpy(szDrv + 2, "\\");
|
|---|
| 1926 | MakeValidDir(szDrv);
|
|---|
| 1927 | // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c
|
|---|
| 1928 | rdy = toupper(*szDrv) == toupper(chDrv);
|
|---|
| 1929 | iDrv = toupper(*szDrv) - 'A';
|
|---|
| 1930 | if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE)
|
|---|
| 1931 | WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE);
|
|---|
| 1932 |
|
|---|
| 1933 | if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) {
|
|---|
| 1934 | WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE);
|
|---|
| 1935 | WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE);
|
|---|
| 1936 | WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE);
|
|---|
| 1937 | WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE);
|
|---|
| 1938 | }
|
|---|
| 1939 | if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) {
|
|---|
| 1940 | WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE);
|
|---|
| 1941 | WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE);
|
|---|
| 1942 | WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE);
|
|---|
| 1943 | }
|
|---|
| 1944 | if (!rdy) {
|
|---|
| 1945 | WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE);
|
|---|
| 1946 | WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE);
|
|---|
| 1947 | WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE);
|
|---|
| 1948 | WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE);
|
|---|
| 1949 | WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE);
|
|---|
| 1950 | }
|
|---|
| 1951 | /* fixme to be gone?
|
|---|
| 1952 | if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) {
|
|---|
| 1953 | WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE);
|
|---|
| 1954 | }
|
|---|
| 1955 | */
|
|---|
| 1956 | PopupMenu(hwnd, hwnd, hwndMenu);
|
|---|
| 1957 | }
|
|---|
| 1958 | }
|
|---|
| 1959 | return MRFROMSHORT(TRUE);
|
|---|
| 1960 |
|
|---|
| 1961 | case WM_BUTTON2CLICK:
|
|---|
| 1962 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 1963 | if (!(shiftstate & KC_CTRL))
|
|---|
| 1964 | break;
|
|---|
| 1965 |
|
|---|
| 1966 | case WM_CHORD:
|
|---|
| 1967 | case WM_BUTTON3CLICK:
|
|---|
| 1968 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1969 | *szDrv = 0;
|
|---|
| 1970 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 1971 | id + 50), sizeof(szDrv), szDrv);
|
|---|
| 1972 | if (isalpha(*szDrv)) {
|
|---|
| 1973 | strcat(szDrv, "\\");
|
|---|
| 1974 | if (!FindDirCnrByName(szDrv, TRUE))
|
|---|
| 1975 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv);
|
|---|
| 1976 | }
|
|---|
| 1977 | break;
|
|---|
| 1978 |
|
|---|
| 1979 | case WM_COMMAND:
|
|---|
| 1980 | PostMsg(hwnd, UM_COMMAND, mp1, mp2);
|
|---|
| 1981 | return 0;
|
|---|
| 1982 |
|
|---|
| 1983 | case UM_COMMAND:
|
|---|
| 1984 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1985 | *szDrv = 0;
|
|---|
| 1986 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 1987 | id + 50), sizeof(szDrv), szDrv);
|
|---|
| 1988 | if (isalpha(*szDrv)) {
|
|---|
| 1989 | strcat(szDrv, "\\");
|
|---|
| 1990 | CommonDriveCmd(hwnd, szDrv, SHORT1FROMMP(mp1));
|
|---|
| 1991 | }
|
|---|
| 1992 | return 0;
|
|---|
| 1993 |
|
|---|
| 1994 | case DM_DRAGOVER:
|
|---|
| 1995 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 1996 | *szDrv = 0;
|
|---|
| 1997 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 1998 | id + 50), sizeof(szDrv), szDrv);
|
|---|
| 1999 | if (isalpha(*szDrv) &&
|
|---|
| 2000 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
|---|
| 2001 | if (!emphasized) {
|
|---|
| 2002 | emphasized = TRUE;
|
|---|
| 2003 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| 2004 | }
|
|---|
| 2005 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
|---|
| 2006 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
|---|
| 2007 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
|---|
| 2008 | }
|
|---|
| 2009 | break;
|
|---|
| 2010 |
|
|---|
| 2011 | case DM_DRAGLEAVE:
|
|---|
| 2012 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 2013 | *szDrv = 0;
|
|---|
| 2014 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 2015 | id + 50), sizeof(szDrv), szDrv);
|
|---|
| 2016 | if (isalpha(*szDrv) &&
|
|---|
| 2017 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
|---|
| 2018 | if (emphasized) {
|
|---|
| 2019 | emphasized = FALSE;
|
|---|
| 2020 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| 2021 | }
|
|---|
| 2022 | }
|
|---|
| 2023 | break;
|
|---|
| 2024 |
|
|---|
| 2025 | case DM_DROPHELP:
|
|---|
| 2026 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 2027 | *szDrv = 0;
|
|---|
| 2028 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 2029 | id + 50), sizeof(szDrv), szDrv);
|
|---|
| 2030 | if (isalpha(*szDrv) &&
|
|---|
| 2031 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
|---|
| 2032 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_DRIVEDROPHELP));
|
|---|
| 2033 | return 0;
|
|---|
| 2034 | }
|
|---|
| 2035 | break;
|
|---|
| 2036 |
|
|---|
| 2037 | case DM_DROP:
|
|---|
| 2038 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 2039 | *szDrv = 0;
|
|---|
| 2040 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 2041 | id + 50), sizeof(szDrv), szDrv);
|
|---|
| 2042 | if (isalpha(*szDrv) &&
|
|---|
| 2043 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
|---|
| 2044 |
|
|---|
| 2045 | CNRDRAGINFO cnd;
|
|---|
| 2046 | LISTINFO *li;
|
|---|
| 2047 | ULONG action = UM_ACTION;
|
|---|
| 2048 |
|
|---|
| 2049 | if (emphasized) {
|
|---|
| 2050 | emphasized = FALSE;
|
|---|
| 2051 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| 2052 | }
|
|---|
| 2053 | memset(&cnd, 0, sizeof(cnd));
|
|---|
| 2054 | cnd.pDragInfo = (PDRAGINFO) mp1;
|
|---|
| 2055 | cnd.pRecord = NULL;
|
|---|
| 2056 | li = DoFileDrop(hwnd,
|
|---|
| 2057 | NULL,
|
|---|
| 2058 | TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd));
|
|---|
| 2059 | CheckPmDrgLimit(cnd.pDragInfo);
|
|---|
| 2060 | if (li) {
|
|---|
| 2061 | strcpy(li->targetpath, szDrv);
|
|---|
| 2062 | strcat(li->targetpath, "\\");
|
|---|
| 2063 | if (li->list && li->list[0] && IsRoot(li->list[0]))
|
|---|
| 2064 | li->type = DO_LINK;
|
|---|
| 2065 | else if (fDragndropDlg && (!*li->arcname || !li->info)) {
|
|---|
| 2066 |
|
|---|
| 2067 | CHECKLIST cl;
|
|---|
| 2068 |
|
|---|
| 2069 | memset(&cl, 0, sizeof(cl));
|
|---|
| 2070 | cl.size = sizeof(cl);
|
|---|
| 2071 | cl.flags = li->type;
|
|---|
| 2072 | cl.list = li->list;
|
|---|
| 2073 | cl.cmd = li->type;
|
|---|
| 2074 | cl.prompt = li->targetpath;
|
|---|
| 2075 | li->type = WinDlgBox(HWND_DESKTOP,
|
|---|
| 2076 | hwndMain,
|
|---|
| 2077 | DropListProc,
|
|---|
| 2078 | FM3ModHandle, DND_FRAME, MPFROMP(&cl));
|
|---|
| 2079 | if (li->type == DID_ERROR)
|
|---|
| 2080 | Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 2081 | "Drag & Drop Dialog");
|
|---|
| 2082 | if (!li->type) {
|
|---|
| 2083 | FreeListInfo(li);
|
|---|
| 2084 | return 0;
|
|---|
| 2085 | }
|
|---|
| 2086 | li->list = cl.list;
|
|---|
| 2087 | if (!li->list || !li->list[0]) {
|
|---|
| 2088 | FreeListInfo(li);
|
|---|
| 2089 | return 0;
|
|---|
| 2090 | }
|
|---|
| 2091 | }
|
|---|
| 2092 | else {
|
|---|
| 2093 | if (!WinDlgBox(HWND_DESKTOP,
|
|---|
| 2094 | hwndMain,
|
|---|
| 2095 | WalkDlgProc,
|
|---|
| 2096 | FM3ModHandle,
|
|---|
| 2097 | WALK_FRAME,
|
|---|
| 2098 | MPFROMP(li->targetpath)) || !*li->targetpath) {
|
|---|
| 2099 | FreeListInfo(li);
|
|---|
| 2100 | return 0;
|
|---|
| 2101 | }
|
|---|
| 2102 | }
|
|---|
| 2103 | switch (li->type) {
|
|---|
| 2104 | case DND_LAUNCH:
|
|---|
| 2105 | strcat(li->targetpath, " %a");
|
|---|
| 2106 | ExecOnList(hwndMain,
|
|---|
| 2107 | li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL,
|
|---|
| 2108 | pszSrcFile, __LINE__);
|
|---|
| 2109 | FreeList(li->list);
|
|---|
| 2110 | li->list = NULL;
|
|---|
| 2111 | break;
|
|---|
| 2112 | case DO_LINK:
|
|---|
| 2113 | if (fLinkSetsIcon) {
|
|---|
| 2114 | li->type = IDM_SETICON;
|
|---|
| 2115 | action = UM_MASSACTION;
|
|---|
| 2116 | }
|
|---|
| 2117 | else
|
|---|
| 2118 | li->type = IDM_COMPARE;
|
|---|
| 2119 | break;
|
|---|
| 2120 | case DND_EXTRACT:
|
|---|
| 2121 | if (*li->targetpath && !IsFile(li->targetpath))
|
|---|
| 2122 | li->type = IDM_EXTRACT;
|
|---|
| 2123 | break;
|
|---|
| 2124 | case DND_MOVE:
|
|---|
| 2125 | li->type = IDM_MOVE;
|
|---|
| 2126 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
|---|
| 2127 | action = UM_MASSACTION;
|
|---|
| 2128 | li->type = IDM_ARCHIVEM;
|
|---|
| 2129 | }
|
|---|
| 2130 | break;
|
|---|
| 2131 | case DND_WILDMOVE:
|
|---|
| 2132 | li->type = IDM_WILDMOVE;
|
|---|
| 2133 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
|---|
| 2134 | action = UM_MASSACTION;
|
|---|
| 2135 | li->type = IDM_ARCHIVEM;
|
|---|
| 2136 | }
|
|---|
| 2137 | break;
|
|---|
| 2138 | case DND_OBJECT:
|
|---|
| 2139 | li->type = IDM_OBJECT;
|
|---|
| 2140 | action = UM_MASSACTION;
|
|---|
| 2141 | break;
|
|---|
| 2142 | case DND_SHADOW:
|
|---|
| 2143 | li->type = IDM_SHADOW;
|
|---|
| 2144 | action = UM_MASSACTION;
|
|---|
| 2145 | break;
|
|---|
| 2146 | case DND_COMPARE:
|
|---|
| 2147 | li->type = IDM_COMPARE;
|
|---|
| 2148 | break;
|
|---|
| 2149 | case DND_SETICON:
|
|---|
| 2150 | action = UM_MASSACTION;
|
|---|
| 2151 | li->type = IDM_SETICON;
|
|---|
| 2152 | break;
|
|---|
| 2153 | case DND_COPY:
|
|---|
| 2154 | li->type = IDM_COPY;
|
|---|
| 2155 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
|---|
| 2156 | action = UM_MASSACTION;
|
|---|
| 2157 | li->type = IDM_ARCHIVE;
|
|---|
| 2158 | }
|
|---|
| 2159 | break;
|
|---|
| 2160 | case DND_WILDCOPY:
|
|---|
| 2161 | li->type = IDM_WILDCOPY;
|
|---|
| 2162 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
|---|
| 2163 | action = UM_MASSACTION;
|
|---|
| 2164 | li->type = IDM_ARCHIVE;
|
|---|
| 2165 | }
|
|---|
| 2166 | break;
|
|---|
| 2167 | default:
|
|---|
| 2168 | if (*li->arcname && li->info) {
|
|---|
| 2169 | action = UM_MASSACTION;
|
|---|
| 2170 | li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM :
|
|---|
| 2171 | IDM_FAKEEXTRACT;
|
|---|
| 2172 | }
|
|---|
| 2173 | else if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
|---|
| 2174 | action = UM_MASSACTION;
|
|---|
| 2175 | li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
|
|---|
| 2176 | }
|
|---|
| 2177 | else
|
|---|
| 2178 | li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
|
|---|
| 2179 | break;
|
|---|
| 2180 | }
|
|---|
| 2181 | if (!li->list || !li->list[0])
|
|---|
| 2182 | FreeListInfo(li);
|
|---|
| 2183 | else
|
|---|
| 2184 | WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action));
|
|---|
| 2185 | }
|
|---|
| 2186 | return 0;
|
|---|
| 2187 | }
|
|---|
| 2188 | break;
|
|---|
| 2189 |
|
|---|
| 2190 | case WM_DESTROY:
|
|---|
| 2191 | if (hwndMenu)
|
|---|
| 2192 | WinDestroyWindow(hwndMenu);
|
|---|
| 2193 | hwndMenu = (HWND) 0;
|
|---|
| 2194 | break;
|
|---|
| 2195 | }
|
|---|
| 2196 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
|---|
| 2197 | }
|
|---|
| 2198 |
|
|---|
| 2199 | VOID BuildDriveBarButtons(HWND hwndT)
|
|---|
| 2200 | {
|
|---|
| 2201 | register ULONG x, y = 0;
|
|---|
| 2202 | ULONG ulDriveNum, ulDriveMap, iconid;
|
|---|
| 2203 | CHAR s[8];
|
|---|
| 2204 | HENUM henum;
|
|---|
| 2205 | HWND hwndB;
|
|---|
| 2206 |
|
|---|
| 2207 | henum = WinBeginEnumWindows(hwndT);
|
|---|
| 2208 |
|
|---|
| 2209 | while ((hwndB = WinGetNextWindow(henum)) != NULLHANDLE)
|
|---|
| 2210 | WinDestroyWindow(hwndB);
|
|---|
| 2211 |
|
|---|
| 2212 | WinEndEnumWindows(henum);
|
|---|
| 2213 | if (fDrivebar) {
|
|---|
| 2214 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 2215 | DosQCurDisk(&ulDriveNum, &ulDriveMap);
|
|---|
| 2216 | for (x = 0; x < 26; x++) {
|
|---|
| 2217 | if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) {
|
|---|
| 2218 | if (x > 1) {
|
|---|
| 2219 | if (driveflags[x] & DRIVE_CDROM)
|
|---|
| 2220 | iconid = CDROM_ICON;
|
|---|
| 2221 | else
|
|---|
| 2222 | iconid = (driveflags[x] & DRIVE_REMOVABLE) ?
|
|---|
| 2223 | REMOVABLE_ICON :
|
|---|
| 2224 | (driveflags[x] & DRIVE_VIRTUAL) ?
|
|---|
| 2225 | VIRTUAL_ICON :
|
|---|
| 2226 | (driveflags[x] & DRIVE_REMOTE) ?
|
|---|
| 2227 | REMOTE_ICON :
|
|---|
| 2228 | (driveflags[x] & DRIVE_RAMDISK) ?
|
|---|
| 2229 | RAMDISK_ICON :
|
|---|
| 2230 | (driveflags[x] & DRIVE_ZIPSTREAM) ?
|
|---|
| 2231 | ZIPSTREAM_ICON :DRIVE_ICON;
|
|---|
| 2232 | }
|
|---|
| 2233 | else
|
|---|
| 2234 | iconid = FLOPPY_ICON;
|
|---|
| 2235 | sprintf(s, "#%lu", iconid);
|
|---|
| 2236 | hwndB = WinCreateWindow(hwndT,
|
|---|
| 2237 | WC_DRIVEBUTTONS,
|
|---|
| 2238 | s,
|
|---|
| 2239 | BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON,
|
|---|
| 2240 | 0,
|
|---|
| 2241 | 0,
|
|---|
| 2242 | 28,
|
|---|
| 2243 | 18,
|
|---|
| 2244 | hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL);
|
|---|
| 2245 | if (!hwndB)
|
|---|
| 2246 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 2247 | IDS_WINCREATEWINDOW);
|
|---|
| 2248 | else {
|
|---|
| 2249 | WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
|
|---|
| 2250 | sprintf(s, "%c:", (CHAR) x + 'A');
|
|---|
| 2251 | hwndB = WinCreateWindow(hwndT,
|
|---|
| 2252 | WC_STATIC,
|
|---|
| 2253 | s,
|
|---|
| 2254 | SS_TEXT | DT_LEFT | DT_VCENTER,
|
|---|
| 2255 | 0,
|
|---|
| 2256 | 0,
|
|---|
| 2257 | 10,
|
|---|
| 2258 | 18,
|
|---|
| 2259 | hwndT,
|
|---|
| 2260 | HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL);
|
|---|
| 2261 | if (!hwndB)
|
|---|
| 2262 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 2263 | IDS_WINCREATEWINDOW);
|
|---|
| 2264 | else {
|
|---|
| 2265 | SetPresParams(hwndB,
|
|---|
| 2266 | &RGBGREY,
|
|---|
| 2267 | &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));
|
|---|
| 2268 | WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
|
|---|
| 2269 | }
|
|---|
| 2270 | y++;
|
|---|
| 2271 | }
|
|---|
| 2272 | }
|
|---|
| 2273 | } // for
|
|---|
| 2274 | } // if drivebar
|
|---|
| 2275 | PostMsg(WinQueryWindow(hwndT, QW_PARENT),
|
|---|
| 2276 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| 2277 | }
|
|---|
| 2278 |
|
|---|
| 2279 | VOID ResizeDrives(HWND hwndT, long xwidth)
|
|---|
| 2280 | {
|
|---|
| 2281 | register ULONG ctrlxpos = 2, ctrlypos = 0, ctrlxsize;
|
|---|
| 2282 | HENUM henum;
|
|---|
| 2283 | HWND hwndB;
|
|---|
| 2284 | RECTL rcl;
|
|---|
| 2285 |
|
|---|
| 2286 | DriveLines = 0;
|
|---|
| 2287 | if (!fDrivebar)
|
|---|
| 2288 | return;
|
|---|
| 2289 | if (!xwidth) {
|
|---|
| 2290 | WinQueryWindowRect(hwndT, &rcl);
|
|---|
| 2291 | xwidth = rcl.xRight - ((WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 2292 | SV_CYSIZEBORDER) * 2) + 2);
|
|---|
| 2293 | }
|
|---|
| 2294 | henum = WinBeginEnumWindows(hwndT);
|
|---|
| 2295 | while ((hwndB = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 2296 | if (WinQueryWindowUShort(hwndB, QWS_ID) > IDM_DRIVEA + 27)
|
|---|
| 2297 | ctrlxsize = 10;
|
|---|
| 2298 | else
|
|---|
| 2299 | ctrlxsize = 28;
|
|---|
| 2300 | WinSetWindowPos(hwndB,
|
|---|
| 2301 | HWND_TOP,
|
|---|
| 2302 | ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW);
|
|---|
| 2303 | ctrlxpos += (ctrlxsize + 2);
|
|---|
| 2304 | if (ctrlxsize == 10) {
|
|---|
| 2305 | if (ctrlxpos + (42 + ((fShowTarget && DriveLines == 0) ?
|
|---|
| 2306 | 256 : 0)) > xwidth) {
|
|---|
| 2307 | ctrlxpos = 2;
|
|---|
| 2308 | ctrlypos += 18;
|
|---|
| 2309 | DriveLines++;
|
|---|
| 2310 | }
|
|---|
| 2311 | }
|
|---|
| 2312 | }
|
|---|
| 2313 | if (ctrlxpos == 2 && DriveLines)
|
|---|
| 2314 | DriveLines--;
|
|---|
| 2315 | }
|
|---|
| 2316 |
|
|---|
| 2317 | MRESULT EXPENTRY StatusProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 2318 | {
|
|---|
| 2319 | static HWND hwndE = (HWND) 0, hwndB = (HWND) 0;
|
|---|
| 2320 | static CHAR lastcmd[1024] = "";
|
|---|
| 2321 |
|
|---|
| 2322 | switch (msg) {
|
|---|
| 2323 | case WM_CREATE:
|
|---|
| 2324 | {
|
|---|
| 2325 | MRESULT mr = PFNWPStatic(hwnd, msg, mp1, mp2);
|
|---|
| 2326 |
|
|---|
| 2327 | SetPresParams(hwnd,
|
|---|
| 2328 | &RGBGREY,
|
|---|
| 2329 | &RGBBLACK, &RGBGREY, GetPString(IDS_8HELVBOLDTEXT));
|
|---|
| 2330 | return mr;
|
|---|
| 2331 | }
|
|---|
| 2332 |
|
|---|
| 2333 | case WM_PRESPARAMCHANGED:
|
|---|
| 2334 | if (fRunning) {
|
|---|
| 2335 |
|
|---|
| 2336 | ULONG AttrFound, AttrValue[64], cbRetLen;
|
|---|
| 2337 |
|
|---|
| 2338 | cbRetLen = WinQueryPresParam(hwnd,
|
|---|
| 2339 | (ULONG) mp1,
|
|---|
| 2340 | 0,
|
|---|
| 2341 | &AttrFound,
|
|---|
| 2342 | (ULONG) sizeof(AttrValue), &AttrValue, 0);
|
|---|
| 2343 | if (cbRetLen) {
|
|---|
| 2344 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 2345 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| 2346 | }
|
|---|
| 2347 | }
|
|---|
| 2348 | break;
|
|---|
| 2349 |
|
|---|
| 2350 | case WM_CONTEXTMENU:
|
|---|
| 2351 | PostMsg(hwndMain, UM_CONTEXTMENU, MPVOID, MPVOID);
|
|---|
| 2352 | return MRFROMSHORT(TRUE);
|
|---|
| 2353 |
|
|---|
| 2354 | case WM_BEGINDRAG:
|
|---|
| 2355 | if (hwndTree) {
|
|---|
| 2356 |
|
|---|
| 2357 | SWP swp;
|
|---|
| 2358 | ULONG fl = SWP_ACTIVATE | SWP_SHOW | SWP_ZORDER;
|
|---|
| 2359 |
|
|---|
| 2360 | WinQueryWindowPos(hwndTree, &swp);
|
|---|
| 2361 | if (!(swp.fl & SWP_MAXIMIZE))
|
|---|
| 2362 | fl |= SWP_RESTORE;
|
|---|
| 2363 | WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, fl);
|
|---|
| 2364 | }
|
|---|
| 2365 | break;
|
|---|
| 2366 |
|
|---|
| 2367 | case UM_SETUP:
|
|---|
| 2368 | if (mp1)
|
|---|
| 2369 | strcpy(lastcmd, (CHAR *)mp1);
|
|---|
| 2370 | return 0;
|
|---|
| 2371 |
|
|---|
| 2372 | case UM_RESCAN:
|
|---|
| 2373 | if (hwndE && WinIsWindow(WinQueryAnchorBlock(hwnd), hwndE))
|
|---|
| 2374 | WinDestroyWindow(hwndE);
|
|---|
| 2375 | if (hwndB && WinIsWindow(WinQueryAnchorBlock(hwnd), hwndB))
|
|---|
| 2376 | WinDestroyWindow(hwndB);
|
|---|
| 2377 | hwndE = hwndB = (HWND) 0;
|
|---|
| 2378 | return 0;
|
|---|
| 2379 |
|
|---|
| 2380 | case WM_COMMAND:
|
|---|
| 2381 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| 2382 | case COMMAND_BUTTON:
|
|---|
| 2383 | PostMsg(hwndE, msg, mp1, mp2);
|
|---|
| 2384 | break;
|
|---|
| 2385 | }
|
|---|
| 2386 | return 0;
|
|---|
| 2387 |
|
|---|
| 2388 | case WM_MOUSEMOVE:
|
|---|
| 2389 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 2390 | {
|
|---|
| 2391 | USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 2392 | char *s = NULL;
|
|---|
| 2393 |
|
|---|
| 2394 | if (fOtherHelp) {
|
|---|
| 2395 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
|---|
| 2396 | && !WinQueryCapture(HWND_DESKTOP)) {
|
|---|
| 2397 | switch (id) {
|
|---|
| 2398 | case IDM_ATTRS:
|
|---|
| 2399 | if (WinQueryWindowTextLength(hwnd))
|
|---|
| 2400 | s = GetPString(IDS_ATTRSBUTTONHELP);
|
|---|
| 2401 | break;
|
|---|
| 2402 | case IDM_INFO:
|
|---|
| 2403 | if (WinQueryWindowTextLength(hwnd))
|
|---|
| 2404 | s = GetPString(IDS_INFOBUTTONHELP);
|
|---|
| 2405 | break;
|
|---|
| 2406 | case IDM_RENAME:
|
|---|
| 2407 | if (WinQueryWindowTextLength(hwnd))
|
|---|
| 2408 | s = GetPString(IDS_NAMEBUTTONHELP);
|
|---|
| 2409 | break;
|
|---|
| 2410 | case MAIN_STATUS2:
|
|---|
| 2411 | if (!hwndE)
|
|---|
| 2412 | s = GetPString(IDS_STATUS2HELP);
|
|---|
| 2413 | break;
|
|---|
| 2414 | default:
|
|---|
| 2415 | break;
|
|---|
| 2416 | }
|
|---|
| 2417 | if (s)
|
|---|
| 2418 | MakeBubble(hwnd, FALSE, s);
|
|---|
| 2419 | else if (hwndBubble)
|
|---|
| 2420 | WinDestroyWindow(hwndBubble);
|
|---|
| 2421 | }
|
|---|
| 2422 | }
|
|---|
| 2423 | switch (id) {
|
|---|
| 2424 | case IDM_ATTRS:
|
|---|
| 2425 | case IDM_INFO:
|
|---|
| 2426 | case IDM_RENAME:
|
|---|
| 2427 | case MAIN_STATUS2:
|
|---|
| 2428 | return CommonTextProc(hwnd, msg, mp1, mp2);
|
|---|
| 2429 | default:
|
|---|
| 2430 | break;
|
|---|
| 2431 | }
|
|---|
| 2432 | }
|
|---|
| 2433 | break;
|
|---|
| 2434 |
|
|---|
| 2435 | case WM_BUTTON2DOWN:
|
|---|
| 2436 | case WM_BUTTON2UP:
|
|---|
| 2437 | case UM_FOCUSME:
|
|---|
| 2438 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
|---|
| 2439 |
|
|---|
| 2440 | case WM_BUTTON1DOWN:
|
|---|
| 2441 | case WM_BUTTON1UP:
|
|---|
| 2442 | case WM_BUTTON3DOWN:
|
|---|
| 2443 | case WM_BUTTON3UP:
|
|---|
| 2444 | {
|
|---|
| 2445 | USHORT id;
|
|---|
| 2446 |
|
|---|
| 2447 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 2448 | switch (id) {
|
|---|
| 2449 | case IDM_ATTRS:
|
|---|
| 2450 | case IDM_INFO:
|
|---|
| 2451 | case IDM_RENAME:
|
|---|
| 2452 | case MAIN_STATUS2:
|
|---|
| 2453 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
|---|
| 2454 | default:
|
|---|
| 2455 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
|---|
| 2456 | break;
|
|---|
| 2457 | }
|
|---|
| 2458 | }
|
|---|
| 2459 | break;
|
|---|
| 2460 |
|
|---|
| 2461 | case WM_SETFOCUS:
|
|---|
| 2462 | if (mp2) {
|
|---|
| 2463 |
|
|---|
| 2464 | USHORT id;
|
|---|
| 2465 |
|
|---|
| 2466 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 2467 | if (id == MAIN_STATUS2 && hwndE)
|
|---|
| 2468 | WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
|---|
| 2469 | else
|
|---|
| 2470 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
|---|
| 2471 | }
|
|---|
| 2472 | break;
|
|---|
| 2473 |
|
|---|
| 2474 | case WM_BUTTON1CLICK:
|
|---|
| 2475 | {
|
|---|
| 2476 | USHORT id;
|
|---|
| 2477 |
|
|---|
| 2478 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 2479 | if (id == MAIN_STATUS) {
|
|---|
| 2480 | if (SHORT2FROMMP(mp2) & KC_CTRL)
|
|---|
| 2481 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 2482 | FID_CLIENT),
|
|---|
| 2483 | WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
|---|
| 2484 | else if (hwndTree)
|
|---|
| 2485 | PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID);
|
|---|
| 2486 | }
|
|---|
| 2487 | }
|
|---|
| 2488 | break;
|
|---|
| 2489 |
|
|---|
| 2490 | case UM_CLICKED:
|
|---|
| 2491 | case UM_CLICKED3:
|
|---|
| 2492 | {
|
|---|
| 2493 | USHORT id;
|
|---|
| 2494 |
|
|---|
| 2495 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 2496 | if (id == MAIN_STATUS2 && !hwndE) {
|
|---|
| 2497 |
|
|---|
| 2498 | SWP swp;
|
|---|
| 2499 | CHAR directory[CCHMAXPATH];
|
|---|
| 2500 | PFNWP oldproce;
|
|---|
| 2501 |
|
|---|
| 2502 | *directory = 0;
|
|---|
| 2503 | TopWindowName(hwndMain, (HWND) 0, directory);
|
|---|
| 2504 | WinQueryWindowPos(hwnd, &swp);
|
|---|
| 2505 | hwndB = WinCreateWindow(hwnd,
|
|---|
| 2506 | WC_BUTTON,
|
|---|
| 2507 | "+",
|
|---|
| 2508 | WS_VISIBLE | BS_PUSHBUTTON |
|
|---|
| 2509 | BS_NOPOINTERFOCUS,
|
|---|
| 2510 | swp.cx - swp.cy,
|
|---|
| 2511 | 0,
|
|---|
| 2512 | swp.cy,
|
|---|
| 2513 | swp.cy,
|
|---|
| 2514 | hwnd, HWND_TOP, COMMAND_BUTTON, NULL, NULL);
|
|---|
| 2515 | if (!hwndB)
|
|---|
| 2516 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| 2517 | hwndE = WinCreateWindow(hwnd,
|
|---|
| 2518 | WC_ENTRYFIELD,
|
|---|
| 2519 | NULL,
|
|---|
| 2520 | WS_VISIBLE | ES_AUTOSCROLL,
|
|---|
| 2521 | 0,
|
|---|
| 2522 | 0,
|
|---|
| 2523 | swp.cx - swp.cy,
|
|---|
| 2524 | swp.cy,
|
|---|
| 2525 | hwnd, HWND_TOP, COMMAND_LINE, NULL, NULL);
|
|---|
| 2526 | if (!hwndE)
|
|---|
| 2527 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| 2528 | if (!hwndE || !hwndB) {
|
|---|
| 2529 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
|---|
| 2530 | return 0;
|
|---|
| 2531 | }
|
|---|
| 2532 | WinSendMsg(hwndE, EM_SETTEXTLIMIT, MPFROM2SHORT(1024, 0), MPVOID);
|
|---|
| 2533 | WinSetWindowText(hwndStatus, directory);
|
|---|
| 2534 | if (*lastcmd)
|
|---|
| 2535 | WinSetWindowText(hwndE, lastcmd);
|
|---|
| 2536 | else
|
|---|
| 2537 | WinSetWindowText(hwndE, GetPString(IDS_HELPCMDTEXT));
|
|---|
| 2538 | oldproce = WinSubclassWindow(hwndE, (PFNWP) CommandLineProc);
|
|---|
| 2539 | if (oldproce)
|
|---|
| 2540 | WinSetWindowPtr(hwndE, QWL_USER, (PVOID) oldproce);
|
|---|
| 2541 | PostMsg(hwndE, UM_FOCUSME, MPVOID, MPVOID);
|
|---|
| 2542 | PostMsg(hwndE, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);
|
|---|
| 2543 | return 0;
|
|---|
| 2544 | }
|
|---|
| 2545 | if (msg == UM_CLICKED3 || (SHORT2FROMMP(mp2) & KC_CTRL)) {
|
|---|
| 2546 | switch (id) {
|
|---|
| 2547 | case IDM_ATTRS:
|
|---|
| 2548 | id = IDM_SORTSIZE;
|
|---|
| 2549 | break;
|
|---|
| 2550 | case IDM_INFO:
|
|---|
| 2551 | id = IDM_SORTLWDATE;
|
|---|
| 2552 | break;
|
|---|
| 2553 | case IDM_RENAME:
|
|---|
| 2554 | id = IDM_SORTFILENAME;
|
|---|
| 2555 | break;
|
|---|
| 2556 | }
|
|---|
| 2557 | }
|
|---|
| 2558 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 2559 | WM_COMMAND, MPFROM2SHORT(id, 0), MPVOID);
|
|---|
| 2560 | }
|
|---|
| 2561 | return 0;
|
|---|
| 2562 |
|
|---|
| 2563 | case WM_PAINT:
|
|---|
| 2564 | {
|
|---|
| 2565 | USHORT id;
|
|---|
| 2566 |
|
|---|
| 2567 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 2568 | switch (id) {
|
|---|
| 2569 | case IDM_ATTRS:
|
|---|
| 2570 | case IDM_INFO:
|
|---|
| 2571 | case IDM_RENAME:
|
|---|
| 2572 | case MAIN_STATUS2:
|
|---|
| 2573 | PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
|
|---|
| 2574 | break;
|
|---|
| 2575 | default:
|
|---|
| 2576 | PaintRecessedWindow(hwnd, (HPS) 0, FALSE, TRUE);
|
|---|
| 2577 | break;
|
|---|
| 2578 | }
|
|---|
| 2579 | if (id == IDM_RENAME) {
|
|---|
| 2580 |
|
|---|
| 2581 | HPS hps;
|
|---|
| 2582 |
|
|---|
| 2583 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
|---|
| 2584 | if (hps) {
|
|---|
| 2585 | PaintSTextWindow(hwnd, hps);
|
|---|
| 2586 | WinEndPaint(hps);
|
|---|
| 2587 | }
|
|---|
| 2588 | return 0;
|
|---|
| 2589 | }
|
|---|
| 2590 | }
|
|---|
| 2591 | break;
|
|---|
| 2592 |
|
|---|
| 2593 | }
|
|---|
| 2594 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
|---|
| 2595 | }
|
|---|
| 2596 |
|
|---|
| 2597 | MRESULT EXPENTRY ToolBackProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 2598 | {
|
|---|
| 2599 | switch (msg) {
|
|---|
| 2600 | case WM_CREATE:
|
|---|
| 2601 | hwndToolback = hwnd;
|
|---|
| 2602 | RestorePresParams(hwnd, "ToolBar");
|
|---|
| 2603 | break;
|
|---|
| 2604 |
|
|---|
| 2605 | case WM_MOUSEMOVE:
|
|---|
| 2606 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 2607 | break;
|
|---|
| 2608 |
|
|---|
| 2609 | case WM_CONTROLPOINTER:
|
|---|
| 2610 | if (!fNoFinger && SHORT1FROMMP(mp1) < 25000)
|
|---|
| 2611 | return MRFROMLONG(hptrFinger);
|
|---|
| 2612 | break;
|
|---|
| 2613 |
|
|---|
| 2614 | case WM_CHAR:
|
|---|
| 2615 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
|---|
| 2616 | break;
|
|---|
| 2617 |
|
|---|
| 2618 | case WM_COMMAND:
|
|---|
| 2619 | case UM_COMMAND:
|
|---|
| 2620 | return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 2621 | FID_CLIENT), msg, mp1, mp2);
|
|---|
| 2622 |
|
|---|
| 2623 | case WM_PAINT:
|
|---|
| 2624 |
|
|---|
| 2625 | PaintRecessedWindow(hwnd, (HPS)0, TRUE, FALSE);
|
|---|
| 2626 |
|
|---|
| 2627 | {
|
|---|
| 2628 | HPS hps;
|
|---|
| 2629 | RECTL rcl;
|
|---|
| 2630 | ULONG lColor = NULL;
|
|---|
| 2631 |
|
|---|
| 2632 | hps = WinBeginPaint(hwnd, (HPS)0, NULL);
|
|---|
| 2633 | if (hps) {
|
|---|
| 2634 | GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);
|
|---|
| 2635 | WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, NULL,
|
|---|
| 2636 | sizeof(lColor), &lColor, 0);
|
|---|
| 2637 | if (!lColor)
|
|---|
| 2638 | lColor = CLR_PALEGRAY;
|
|---|
| 2639 | WinQueryWindowRect(hwnd, &rcl);
|
|---|
| 2640 | WinFillRect(hps, &rcl, lColor);
|
|---|
| 2641 | WinEndPaint(hps);
|
|---|
| 2642 | }
|
|---|
| 2643 |
|
|---|
| 2644 | }
|
|---|
| 2645 | break;
|
|---|
| 2646 |
|
|---|
| 2647 | case WM_PRESPARAMCHANGED:
|
|---|
| 2648 | PresParamChanged(hwnd, "ToolBar", mp1, mp2);
|
|---|
| 2649 | WinInvalidateRect(hwnd, NULL, TRUE);
|
|---|
| 2650 | break;
|
|---|
| 2651 |
|
|---|
| 2652 | case UM_SETUP:
|
|---|
| 2653 | {
|
|---|
| 2654 | USHORT id;
|
|---|
| 2655 | TOOL *tool;
|
|---|
| 2656 |
|
|---|
| 2657 | id = SHORT1FROMMP(mp1);
|
|---|
| 2658 | tool = find_tool(id);
|
|---|
| 2659 | if (tool) {
|
|---|
| 2660 | del_tool(tool);
|
|---|
| 2661 | WinShowWindow(WinWindowFromID(hwnd, id), FALSE);
|
|---|
| 2662 | if (fToolTitles)
|
|---|
| 2663 | WinShowWindow(WinWindowFromID(hwnd, id + 25000), FALSE);
|
|---|
| 2664 | ResizeTools(hwnd);
|
|---|
| 2665 | save_tools(NULL);
|
|---|
| 2666 | }
|
|---|
| 2667 | }
|
|---|
| 2668 | return 0;
|
|---|
| 2669 |
|
|---|
| 2670 | case UM_SETUP2: /* Used to load a new a toolbar */
|
|---|
| 2671 | BuildTools(hwnd, TRUE);
|
|---|
| 2672 | return 0;
|
|---|
| 2673 |
|
|---|
| 2674 | case WM_CHORD:
|
|---|
| 2675 | {
|
|---|
| 2676 | USHORT id;
|
|---|
| 2677 |
|
|---|
| 2678 | id = (USHORT) WinDlgBox(HWND_DESKTOP,
|
|---|
| 2679 | hwnd,
|
|---|
| 2680 | AddToolProc,
|
|---|
| 2681 | FM3ModHandle, ADDBTN_FRAME, MPVOID);
|
|---|
| 2682 | if (id && id != (USHORT) - 1)
|
|---|
| 2683 | WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 2684 | FID_CLIENT),
|
|---|
| 2685 | WM_COMMAND,
|
|---|
| 2686 | MPFROM2SHORT(IDM_CREATETOOL, 0), MPFROM2SHORT(id, 0));
|
|---|
| 2687 | }
|
|---|
| 2688 | break;
|
|---|
| 2689 |
|
|---|
| 2690 | case WM_CONTEXTMENU:
|
|---|
| 2691 | if (WinDlgBox(HWND_DESKTOP,
|
|---|
| 2692 | hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID))
|
|---|
| 2693 | PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| 2694 | return MRFROMSHORT(TRUE);
|
|---|
| 2695 |
|
|---|
| 2696 | case WM_CLOSE:
|
|---|
| 2697 | WinDestroyWindow(hwnd);
|
|---|
| 2698 | return 0;
|
|---|
| 2699 |
|
|---|
| 2700 | case WM_DESTROY:
|
|---|
| 2701 | break;
|
|---|
| 2702 | }
|
|---|
| 2703 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
|---|
| 2704 | }
|
|---|
| 2705 |
|
|---|
| 2706 | static VOID AdjustSizeOfClient(PSWP pswp, PRECTL prectl)
|
|---|
| 2707 | {
|
|---|
| 2708 | SWP swp;
|
|---|
| 2709 | RECTL rectl;
|
|---|
| 2710 |
|
|---|
| 2711 | if (fFreeTree)
|
|---|
| 2712 | return;
|
|---|
| 2713 | if (pswp) {
|
|---|
| 2714 | if (WinQueryWindowPos(hwndTree, &swp) &&
|
|---|
| 2715 | !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) {
|
|---|
| 2716 | pswp->x = swp.cx;
|
|---|
| 2717 | pswp->cx -= swp.cx;
|
|---|
| 2718 | }
|
|---|
| 2719 | }
|
|---|
| 2720 | if (prectl) {
|
|---|
| 2721 | if (WinQueryWindowPos(hwndTree, &swp) &&
|
|---|
| 2722 | !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) &&
|
|---|
| 2723 | WinQueryWindowRect(hwndTree, &rectl)) {
|
|---|
| 2724 | prectl->xLeft = rectl.xRight;
|
|---|
| 2725 | prectl->xRight -= rectl.xRight;
|
|---|
| 2726 | }
|
|---|
| 2727 | }
|
|---|
| 2728 | }
|
|---|
| 2729 |
|
|---|
| 2730 | VOID FillClient(HWND hwndClient, PSWP pswp, PRECTL prectl, BOOL avoidtree)
|
|---|
| 2731 | {
|
|---|
| 2732 | ULONG adjust;
|
|---|
| 2733 |
|
|---|
| 2734 | adjust = WinQuerySysValue(HWND_DESKTOP, SV_CYICON);
|
|---|
| 2735 | if (pswp)
|
|---|
| 2736 | WinQueryWindowPos(hwndClient, pswp);
|
|---|
| 2737 | if (prectl)
|
|---|
| 2738 | WinQueryWindowRect(hwndClient, prectl);
|
|---|
| 2739 | if (avoidtree && !fFreeTree)
|
|---|
| 2740 | AdjustSizeOfClient(pswp, prectl);
|
|---|
| 2741 | if (prectl)
|
|---|
| 2742 | prectl->yBottom += adjust;
|
|---|
| 2743 | if (pswp) {
|
|---|
| 2744 | if (!avoidtree || fFreeTree)
|
|---|
| 2745 | pswp->x = 0;
|
|---|
| 2746 | pswp->y = adjust;
|
|---|
| 2747 | if (pswp->cy >= adjust)
|
|---|
| 2748 | pswp->cy -= adjust;
|
|---|
| 2749 | else
|
|---|
| 2750 | pswp->cy = 0;
|
|---|
| 2751 | }
|
|---|
| 2752 | }
|
|---|
| 2753 |
|
|---|
| 2754 | static VOID MoveChildrenAwayFromTree(HWND hwndClient)
|
|---|
| 2755 | {
|
|---|
| 2756 | SWP swpC, swpT, swp;
|
|---|
| 2757 | USHORT id;
|
|---|
| 2758 | HWND hwndChild;
|
|---|
| 2759 | HENUM henum;
|
|---|
| 2760 |
|
|---|
| 2761 | if (fFreeTree)
|
|---|
| 2762 | return;
|
|---|
| 2763 | WinQueryWindowPos(hwndClient, &swpC);
|
|---|
| 2764 | if (swpC.fl & (SWP_MINIMIZE | SWP_HIDE))
|
|---|
| 2765 | return;
|
|---|
| 2766 | WinQueryWindowPos(hwndTree, &swpT);
|
|---|
| 2767 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| 2768 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 2769 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
|---|
| 2770 | if (!id || id == TREE_FRAME)
|
|---|
| 2771 | continue;
|
|---|
| 2772 | WinQueryWindowPos(hwndChild, &swp);
|
|---|
| 2773 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
|---|
| 2774 | if (swp.x < swpT.cx) {
|
|---|
| 2775 | swp.x = swpT.cx;
|
|---|
| 2776 | if (swp.x + swp.cx > swpC.cx)
|
|---|
| 2777 | swp.cx = swpC.cx - swp.x;
|
|---|
| 2778 | if (swp.cx > 24)
|
|---|
| 2779 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
|---|
| 2780 | SWP_SIZE | SWP_MOVE | SWP_SHOW);
|
|---|
| 2781 | }
|
|---|
| 2782 | }
|
|---|
| 2783 | }
|
|---|
| 2784 | WinEndEnumWindows(henum);
|
|---|
| 2785 | }
|
|---|
| 2786 |
|
|---|
| 2787 | static VOID ArrangeIcons(HWND hwndClient)
|
|---|
| 2788 | {
|
|---|
| 2789 | HENUM henum;
|
|---|
| 2790 | HWND hwndChild;
|
|---|
| 2791 | SWP swp;
|
|---|
| 2792 |
|
|---|
| 2793 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| 2794 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 2795 | WinQueryWindowPos(hwndChild, &swp);
|
|---|
| 2796 | if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {
|
|---|
| 2797 | WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1);
|
|---|
| 2798 | WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);
|
|---|
| 2799 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,
|
|---|
| 2800 | SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE);
|
|---|
| 2801 | }
|
|---|
| 2802 | }
|
|---|
| 2803 | WinEndEnumWindows(henum);
|
|---|
| 2804 | }
|
|---|
| 2805 |
|
|---|
| 2806 | static VOID NextChild(HWND hwndClient, BOOL previous)
|
|---|
| 2807 | {
|
|---|
| 2808 | HENUM henum;
|
|---|
| 2809 | HWND hwndActive, hwndNext, hwndPrev = (HWND) 0;
|
|---|
| 2810 | BOOL next = FALSE, once = FALSE;
|
|---|
| 2811 |
|
|---|
| 2812 | previous = !previous;
|
|---|
| 2813 |
|
|---|
| 2814 | hwndActive = WinQueryActiveWindow(hwndClient);
|
|---|
| 2815 | if (!hwndActive)
|
|---|
| 2816 | next = TRUE;
|
|---|
| 2817 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| 2818 | for (;;) {
|
|---|
| 2819 | hwndNext = WinGetNextWindow(henum);
|
|---|
| 2820 | if (hwndNext) {
|
|---|
| 2821 | if (!WinQueryWindowUShort(hwndNext, QWS_ID))
|
|---|
| 2822 | continue;
|
|---|
| 2823 | if (next)
|
|---|
| 2824 | break;
|
|---|
| 2825 | if (hwndNext == hwndActive) {
|
|---|
| 2826 | if (!previous && hwndPrev) {
|
|---|
| 2827 | hwndNext = hwndPrev;
|
|---|
| 2828 | break;
|
|---|
| 2829 | }
|
|---|
| 2830 | else if (previous)
|
|---|
| 2831 | next = TRUE;
|
|---|
| 2832 | }
|
|---|
| 2833 | hwndPrev = hwndNext;
|
|---|
| 2834 | }
|
|---|
| 2835 | else {
|
|---|
| 2836 | if ((!next && previous) || once)
|
|---|
| 2837 | break;
|
|---|
| 2838 | else if (!previous) {
|
|---|
| 2839 | hwndNext = hwndPrev;
|
|---|
| 2840 | break;
|
|---|
| 2841 | }
|
|---|
| 2842 | else
|
|---|
| 2843 | once = next = TRUE;
|
|---|
| 2844 | }
|
|---|
| 2845 | }
|
|---|
| 2846 | WinEndEnumWindows(henum);
|
|---|
| 2847 |
|
|---|
| 2848 | if (hwndNext && hwndNext != hwndActive) {
|
|---|
| 2849 | WinSetWindowPos(hwndNext, HWND_TOP, 0, 0, 0, 0,
|
|---|
| 2850 | SWP_ZORDER | SWP_ACTIVATE);
|
|---|
| 2851 | WinSetWindowPos(hwndActive, ((previous) ? HWND_BOTTOM : hwndNext), 0, 0,
|
|---|
| 2852 | 0, 0, SWP_ZORDER);
|
|---|
| 2853 | }
|
|---|
| 2854 | }
|
|---|
| 2855 |
|
|---|
| 2856 | BOOL CloseChildren(HWND hwndClient)
|
|---|
| 2857 | {
|
|---|
| 2858 | HENUM henum;
|
|---|
| 2859 | HWND hwndChild;
|
|---|
| 2860 | BOOL ret = FALSE;
|
|---|
| 2861 |
|
|---|
| 2862 | fNoTileUpdate = TRUE;
|
|---|
| 2863 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| 2864 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 2865 | if (hwndChild != hwndTree) {
|
|---|
| 2866 | WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
|---|
| 2867 | WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
|---|
| 2868 | if (WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
|---|
| 2869 | WM_CLOSE, MPVOID, MPVOID)) {
|
|---|
| 2870 | ret = TRUE;
|
|---|
| 2871 | break;
|
|---|
| 2872 | }
|
|---|
| 2873 | }
|
|---|
| 2874 | }
|
|---|
| 2875 | WinEndEnumWindows(henum);
|
|---|
| 2876 | fNoTileUpdate = FALSE;
|
|---|
| 2877 | return ret;
|
|---|
| 2878 | }
|
|---|
| 2879 |
|
|---|
| 2880 | BOOL CloseDirCnrChildren(HWND hwndClient)
|
|---|
| 2881 | {
|
|---|
| 2882 | /* returns TRUE if a directory container window was told to close */
|
|---|
| 2883 |
|
|---|
| 2884 | HENUM henum;
|
|---|
| 2885 | HWND hwndChild, hwndDir, hwndTemp;
|
|---|
| 2886 | BOOL ret = FALSE;
|
|---|
| 2887 |
|
|---|
| 2888 | fNoTileUpdate = TRUE;
|
|---|
| 2889 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| 2890 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 2891 | if (hwndChild != hwndTree) {
|
|---|
| 2892 | hwndTemp = WinWindowFromID(hwndChild, FID_CLIENT);
|
|---|
| 2893 | if (hwndTemp) {
|
|---|
| 2894 | hwndDir = WinWindowFromID(hwndTemp, DIR_CNR);
|
|---|
| 2895 | if (hwndDir) {
|
|---|
| 2896 | WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
|---|
| 2897 | WM_CLOSE, MPVOID, MPVOID);
|
|---|
| 2898 | ret = TRUE;
|
|---|
| 2899 | }
|
|---|
| 2900 | }
|
|---|
| 2901 | }
|
|---|
| 2902 | }
|
|---|
| 2903 | WinEndEnumWindows(henum);
|
|---|
| 2904 | fNoTileUpdate = FALSE;
|
|---|
| 2905 | return ret;
|
|---|
| 2906 | }
|
|---|
| 2907 |
|
|---|
| 2908 | /** Save directory container state
|
|---|
| 2909 | * @param hwndClient Client window handle
|
|---|
| 2910 | * @param pszStateName State name to save, NULL to save global state
|
|---|
| 2911 | * @returns Number of directory container windows that were saved or -1 if error
|
|---|
| 2912 | * @seealso RestoreDirCnrState
|
|---|
| 2913 | */
|
|---|
| 2914 |
|
|---|
| 2915 | #define STATE_NAME_MAX_BYTES 256
|
|---|
| 2916 |
|
|---|
| 2917 | INT SaveDirCnrState(HWND hwndClient, PSZ pszStateName)
|
|---|
| 2918 | {
|
|---|
| 2919 | HENUM henum;
|
|---|
| 2920 | HWND hwndChild, hwndDir, hwndC;
|
|---|
| 2921 | ULONG numsaves = 0, flWindowAttr;
|
|---|
| 2922 | ULONG previous_numsaves, ulTemp = sizeof(ULONG);
|
|---|
| 2923 | CHAR szPrefix[STATE_NAME_MAX_BYTES + 1];
|
|---|
| 2924 | CHAR szKey[STATE_NAME_MAX_BYTES + 80];
|
|---|
| 2925 | CHAR szDir[CCHMAXPATH];
|
|---|
| 2926 | SWP swp;
|
|---|
| 2927 | DIRCNRDATA *dcd;
|
|---|
| 2928 | BOOL fIsShutDownState;
|
|---|
| 2929 |
|
|---|
| 2930 | if (!pszStateName || !*pszStateName) {
|
|---|
| 2931 | Runtime_Error(pszSrcFile, __LINE__, "no data");
|
|---|
| 2932 | return -1;
|
|---|
| 2933 | }
|
|---|
| 2934 | if (strlen(pszStateName) > sizeof(szPrefix) - 2) {
|
|---|
| 2935 | Runtime_Error(pszSrcFile, __LINE__, "SaveDirCnrState");
|
|---|
| 2936 | return -1;
|
|---|
| 2937 | }
|
|---|
| 2938 |
|
|---|
| 2939 | fIsShutDownState = strcmp(pszStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0;
|
|---|
| 2940 | sprintf(szPrefix, "%s.", pszStateName);
|
|---|
| 2941 |
|
|---|
| 2942 | if (*lasttoolbar) {
|
|---|
| 2943 | sprintf(szKey, "%sToolbar", szPrefix);
|
|---|
| 2944 | PrfWriteProfileString(fmprof, FM3Str, szKey, lasttoolbar);
|
|---|
| 2945 | }
|
|---|
| 2946 |
|
|---|
| 2947 | if (!fIsShutDownState) {
|
|---|
| 2948 | sprintf(szKey, "%sTargetDir", szPrefix);
|
|---|
| 2949 | PrfWriteProfileString(fmprof, FM3Str, szKey, targetdir);
|
|---|
| 2950 | }
|
|---|
| 2951 |
|
|---|
| 2952 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| 2953 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 2954 | if (hwndChild != hwndTree) {
|
|---|
| 2955 | hwndC = WinWindowFromID(hwndChild, FID_CLIENT);
|
|---|
| 2956 | if (hwndC) {
|
|---|
| 2957 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
|---|
| 2958 | if (hwndDir) {
|
|---|
| 2959 | WinQueryWindowPos(hwndChild, &swp);
|
|---|
| 2960 | *szDir = 0;
|
|---|
| 2961 | WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(szDir), MPVOID);
|
|---|
| 2962 | if (*szDir) {
|
|---|
| 2963 | // If saving shutdown state skip no prescan drives
|
|---|
| 2964 | if (fIsShutDownState &&
|
|---|
| 2965 | driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
|
|---|
| 2966 | continue;
|
|---|
| 2967 | }
|
|---|
| 2968 | sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves);
|
|---|
| 2969 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp,
|
|---|
| 2970 | sizeof(SWP));
|
|---|
| 2971 | dcd =
|
|---|
| 2972 | WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
|---|
| 2973 | if (dcd) {
|
|---|
| 2974 | sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves);
|
|---|
| 2975 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags,
|
|---|
| 2976 | sizeof(INT));
|
|---|
| 2977 | sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves);
|
|---|
| 2978 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask,
|
|---|
| 2979 | sizeof(MASK));
|
|---|
| 2980 | sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves);
|
|---|
| 2981 | flWindowAttr = dcd->flWindowAttr;
|
|---|
| 2982 | if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
|
|---|
| 2983 | flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
|
|---|
| 2984 | if (dcd->lastattr) {
|
|---|
| 2985 | if (dcd->lastattr & CV_TEXT)
|
|---|
| 2986 | flWindowAttr |= CV_TEXT;
|
|---|
| 2987 | else if (dcd->lastattr & CV_DETAIL)
|
|---|
| 2988 | flWindowAttr |= CV_DETAIL;
|
|---|
| 2989 | else if (dcd->lastattr & CV_ICON)
|
|---|
| 2990 | flWindowAttr |= CV_ICON;
|
|---|
| 2991 | else
|
|---|
| 2992 | flWindowAttr |= CV_NAME;
|
|---|
| 2993 | }
|
|---|
| 2994 | else
|
|---|
| 2995 | flWindowAttr |= CV_NAME;
|
|---|
| 2996 | }
|
|---|
| 2997 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr,
|
|---|
| 2998 | sizeof(ULONG));
|
|---|
| 2999 | sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves);
|
|---|
| 3000 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslongname,
|
|---|
| 3001 | sizeof(BOOL));
|
|---|
| 3002 | sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, numsaves);
|
|---|
| 3003 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssubject,
|
|---|
| 3004 | sizeof(BOOL));
|
|---|
| 3005 | sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, numsaves);
|
|---|
| 3006 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssize,
|
|---|
| 3007 | sizeof(BOOL));
|
|---|
| 3008 | sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, numsaves);
|
|---|
| 3009 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsea,
|
|---|
| 3010 | sizeof(BOOL));
|
|---|
| 3011 | sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, numsaves);
|
|---|
| 3012 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsattr,
|
|---|
| 3013 | sizeof(BOOL));
|
|---|
| 3014 | sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, numsaves);
|
|---|
| 3015 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsicon,
|
|---|
| 3016 | sizeof(BOOL));
|
|---|
| 3017 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, numsaves);
|
|---|
| 3018 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwdate,
|
|---|
| 3019 | sizeof(BOOL));
|
|---|
| 3020 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, numsaves);
|
|---|
| 3021 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwtime,
|
|---|
| 3022 | sizeof(BOOL));
|
|---|
| 3023 | sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, numsaves);
|
|---|
| 3024 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsladate,
|
|---|
| 3025 | sizeof(BOOL));
|
|---|
| 3026 | sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, numsaves);
|
|---|
| 3027 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslatime,
|
|---|
| 3028 | sizeof(BOOL));
|
|---|
| 3029 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, numsaves);
|
|---|
| 3030 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrdate,
|
|---|
| 3031 | sizeof(BOOL));
|
|---|
| 3032 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, numsaves);
|
|---|
| 3033 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrtime,
|
|---|
| 3034 | sizeof(BOOL));
|
|---|
| 3035 | sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves);
|
|---|
| 3036 | SavePresParams(hwndDir, szKey);
|
|---|
| 3037 | }
|
|---|
| 3038 | sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++);
|
|---|
| 3039 | PrfWriteProfileString(fmprof, FM3Str, szKey, szDir);
|
|---|
| 3040 | }
|
|---|
| 3041 | }
|
|---|
| 3042 | }
|
|---|
| 3043 | }
|
|---|
| 3044 | } // while
|
|---|
| 3045 | WinEndEnumWindows(henum);
|
|---|
| 3046 |
|
|---|
| 3047 | sprintf(szKey, "%sNumDirsLastTime", szPrefix);
|
|---|
| 3048 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &previous_numsaves, &ulTemp))
|
|---|
| 3049 | for (ulTemp = numsaves; ulTemp < previous_numsaves; ulTemp++) {
|
|---|
| 3050 | sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, ulTemp);
|
|---|
| 3051 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(SWP));
|
|---|
| 3052 | sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, ulTemp);
|
|---|
| 3053 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(INT));
|
|---|
| 3054 | sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, ulTemp);
|
|---|
| 3055 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(MASK));
|
|---|
| 3056 | sprintf(szKey, "%sDirCnrView.%lu", szPrefix, ulTemp);
|
|---|
| 3057 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(ULONG));
|
|---|
| 3058 | sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, ulTemp);
|
|---|
| 3059 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| 3060 | sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, ulTemp);
|
|---|
| 3061 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| 3062 | sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, ulTemp);
|
|---|
| 3063 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| 3064 | sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, ulTemp);
|
|---|
| 3065 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| 3066 | sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, ulTemp);
|
|---|
| 3067 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| 3068 | sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, ulTemp);
|
|---|
| 3069 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| 3070 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, ulTemp);
|
|---|
| 3071 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| 3072 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, ulTemp);
|
|---|
| 3073 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| 3074 | sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, ulTemp);
|
|---|
| 3075 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| 3076 | sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, ulTemp);
|
|---|
| 3077 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| 3078 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, ulTemp);
|
|---|
| 3079 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| 3080 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, ulTemp);
|
|---|
| 3081 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
|---|
| 3082 | sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, ulTemp);
|
|---|
| 3083 | PrfWriteProfileString(fmprof, FM3Str, szKey, NULL);
|
|---|
| 3084 | sprintf(szKey, "%sDirCnr.%lu.", szPrefix, ulTemp);
|
|---|
| 3085 | DeletePresParams(szKey);
|
|---|
| 3086 | }
|
|---|
| 3087 | sprintf(szKey, "%sNumDirsLastTime", szPrefix);
|
|---|
| 3088 | if (numsaves) {
|
|---|
| 3089 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & numsaves, sizeof(ULONG));
|
|---|
| 3090 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swp);
|
|---|
| 3091 | sprintf(szKey, "%sMySizeLastTime", szPrefix);
|
|---|
| 3092 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, sizeof(SWP));
|
|---|
| 3093 | if (WinQueryWindowPos(hwndTree, &swp)) {
|
|---|
| 3094 | sprintf(szKey, "%sLastTreePos", szPrefix);
|
|---|
| 3095 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, sizeof(SWP));
|
|---|
| 3096 | }
|
|---|
| 3097 | }
|
|---|
| 3098 | else if (fIsShutDownState) {
|
|---|
| 3099 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & numsaves, sizeof(ULONG));
|
|---|
| 3100 | }
|
|---|
| 3101 |
|
|---|
| 3102 | return numsaves;
|
|---|
| 3103 | }
|
|---|
| 3104 |
|
|---|
| 3105 | static VOID TransformSwp(PSWP pswp, double xtrans, double ytrans)
|
|---|
| 3106 | {
|
|---|
| 3107 | SWP swp;
|
|---|
| 3108 | HWND hwnd;
|
|---|
| 3109 |
|
|---|
| 3110 | if ((LONG) pswp->x < 0L) {
|
|---|
| 3111 | pswp->cx -= abs(pswp->x);
|
|---|
| 3112 | pswp->x = 0;
|
|---|
| 3113 | }
|
|---|
| 3114 | if ((LONG) pswp->y < 0L) {
|
|---|
| 3115 | pswp->cy -= abs(pswp->y);
|
|---|
| 3116 | pswp->y = 0;
|
|---|
| 3117 | }
|
|---|
| 3118 | pswp->x = (LONG) (((double)pswp->x * 100.0) / xtrans);
|
|---|
| 3119 | pswp->cx = (LONG) (((double)pswp->cx * 100.0) / xtrans);
|
|---|
| 3120 | pswp->y = (LONG) (((double)pswp->y * 100.0) / ytrans);
|
|---|
| 3121 | pswp->cy = (LONG) (((double)pswp->cy * 100.0) / ytrans);
|
|---|
| 3122 | if (pswp->hwnd) {
|
|---|
| 3123 | hwnd = WinQueryWindow(pswp->hwnd, QW_PARENT);
|
|---|
| 3124 | if (hwnd) {
|
|---|
| 3125 | if (WinQueryWindowPos(hwnd, &swp)) {
|
|---|
| 3126 | if (pswp->x > swp.cx)
|
|---|
| 3127 | pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx;
|
|---|
| 3128 | if (pswp->y > swp.cy)
|
|---|
| 3129 | pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy;
|
|---|
| 3130 | if (pswp->x + pswp->cx > swp.cx)
|
|---|
| 3131 | pswp->cx = swp.cx - pswp->x;
|
|---|
| 3132 | if (pswp->y + pswp->cy > swp.cy)
|
|---|
| 3133 | pswp->cy = swp.cy - pswp->y;
|
|---|
| 3134 | }
|
|---|
| 3135 | }
|
|---|
| 3136 | }
|
|---|
| 3137 | }
|
|---|
| 3138 |
|
|---|
| 3139 | /** Restore directory container state
|
|---|
| 3140 | * @param hwndClient Client window handle
|
|---|
| 3141 | * @param pszStateName State name to restore, NULL to restore global state
|
|---|
| 3142 | * @param noview request view state restore bypass
|
|---|
| 3143 | * @returns TRUE if one or more directory containers were opened
|
|---|
| 3144 | * @seealso SaveDirCnrState
|
|---|
| 3145 | */
|
|---|
| 3146 |
|
|---|
| 3147 | static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview)
|
|---|
| 3148 | {
|
|---|
| 3149 | CHAR szKey[STATE_NAME_MAX_BYTES + 80];
|
|---|
| 3150 | CHAR szDir[CCHMAXPATH];
|
|---|
| 3151 | CHAR szPrefix[STATE_NAME_MAX_BYTES + 2];
|
|---|
| 3152 | HWND hwndDir, hwndC, hwndPPSave = NULLHANDLE;
|
|---|
| 3153 | SWP swp, swpO, swpN;
|
|---|
| 3154 | ULONG size, numsaves = 0;
|
|---|
| 3155 | LONG x;
|
|---|
| 3156 | double xtrans, ytrans;
|
|---|
| 3157 | BOOL fRestored = FALSE;
|
|---|
| 3158 | DIRCNRDATA localdcd, *dcd;
|
|---|
| 3159 | BOOL fIsShutDownState;
|
|---|
| 3160 | BOOL fDeleteState;
|
|---|
| 3161 |
|
|---|
| 3162 | if (!pszStateName || !*pszStateName) {
|
|---|
| 3163 | Runtime_Error(pszSrcFile, __LINE__, "no name");
|
|---|
| 3164 | return fRestored;
|
|---|
| 3165 | }
|
|---|
| 3166 | if (strlen(pszStateName) > sizeof(szPrefix) - 2) {
|
|---|
| 3167 | Runtime_Error(pszSrcFile, __LINE__, "name too long");
|
|---|
| 3168 | return fRestored;
|
|---|
| 3169 | }
|
|---|
| 3170 |
|
|---|
| 3171 | sprintf(szPrefix, "%s.", pszStateName);
|
|---|
| 3172 |
|
|---|
| 3173 | // If restoring shutdown state bypass no-prescan drives
|
|---|
| 3174 | fIsShutDownState = strcmp(pszStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0;
|
|---|
| 3175 | // Delete saved state if internally saved state
|
|---|
| 3176 | fDeleteState = strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)) == 0;
|
|---|
| 3177 |
|
|---|
| 3178 | size = (ULONG)0;
|
|---|
| 3179 | sprintf(szKey, "%sToolbar", szPrefix);
|
|---|
| 3180 | if (PrfQueryProfileSize(fmprof, FM3Str, szKey, &size) && size)
|
|---|
| 3181 | {
|
|---|
| 3182 | if (fToolsChanged)
|
|---|
| 3183 | save_tools(NULL);
|
|---|
| 3184 | PrfQueryProfileData(fmprof, FM3Str, szKey, lasttoolbar, &size);
|
|---|
| 3185 | PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar);
|
|---|
| 3186 | load_tools(NULL);
|
|---|
| 3187 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| 3188 | }
|
|---|
| 3189 | DosWaitEventSem(DriveScanStart, 20000);
|
|---|
| 3190 | size = (ULONG)0;
|
|---|
| 3191 | sprintf(szKey, "%sTargetDir", szPrefix);
|
|---|
| 3192 | if (PrfQueryProfileSize(fmprof, FM3Str, szKey, &size) && size)
|
|---|
| 3193 | {
|
|---|
| 3194 | PrfQueryProfileData(fmprof, FM3Str, szKey, targetdir, &size);
|
|---|
| 3195 | PrfWriteProfileString(fmprof, FM3Str, "TargetDir", targetdir);
|
|---|
| 3196 | SetTargetDir(NULL, TRUE);
|
|---|
| 3197 | }
|
|---|
| 3198 | size = sizeof(SWP);
|
|---|
| 3199 | sprintf(szKey, "%sMySizeLastTime", szPrefix);
|
|---|
| 3200 | if (!PrfQueryProfileData(fmprof,
|
|---|
| 3201 | FM3Str,
|
|---|
| 3202 | szKey,
|
|---|
| 3203 | (PVOID) & swpO,
|
|---|
| 3204 | &size) ||
|
|---|
| 3205 | size != sizeof(SWP) || !swp.cx || !swp.cy)
|
|---|
| 3206 | {
|
|---|
| 3207 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swpO);
|
|---|
| 3208 | }
|
|---|
| 3209 | // If restoring internally saved state, forget info
|
|---|
| 3210 | if (fDeleteState)
|
|---|
| 3211 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3212 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swpN);
|
|---|
| 3213 | if (swpN.fl & (SWP_MINIMIZE | SWP_HIDE))
|
|---|
| 3214 | swpN = swpO;
|
|---|
| 3215 | xtrans = ((double)swpO.cx * 100.0) / (double)swpN.cx;
|
|---|
| 3216 | ytrans = ((double)swpO.cy * 100.0) / (double)swpN.cy;
|
|---|
| 3217 | size = sizeof(SWP);
|
|---|
| 3218 | sprintf(szKey, "%sLastTreePos", szPrefix);
|
|---|
| 3219 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, &size)) {
|
|---|
| 3220 | if (fDeleteState)
|
|---|
| 3221 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3222 | swp.hwnd = hwndTree;
|
|---|
| 3223 | TransformSwp(&swp, xtrans, ytrans);
|
|---|
| 3224 | if (!fFreeTree) {
|
|---|
| 3225 | WinQueryWindowPos(hwndClient, &swpN);
|
|---|
| 3226 | swp.x = 0;
|
|---|
| 3227 | swp.y = (swpN.cy - swp.cy);
|
|---|
| 3228 | }
|
|---|
| 3229 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE))) {
|
|---|
| 3230 | swp.fl &= (~SWP_ACTIVATE);
|
|---|
| 3231 | WinSetWindowPos(hwndTree,
|
|---|
| 3232 | HWND_TOP,
|
|---|
| 3233 | swp.x,
|
|---|
| 3234 | swp.y,
|
|---|
| 3235 | swp.cx,
|
|---|
| 3236 | swp.cy,
|
|---|
| 3237 | swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
|---|
| 3238 | }
|
|---|
| 3239 | else {
|
|---|
| 3240 | WinSetWindowPos(hwndTree,
|
|---|
| 3241 | HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);
|
|---|
| 3242 | WinSetWindowUShort(hwndTree, QWS_XRESTORE, (USHORT) swp.x);
|
|---|
| 3243 | WinSetWindowUShort(hwndTree, QWS_CXRESTORE, (USHORT) swp.cx);
|
|---|
| 3244 | WinSetWindowUShort(hwndTree, QWS_YRESTORE, (USHORT) swp.y);
|
|---|
| 3245 | WinSetWindowUShort(hwndTree, QWS_CYRESTORE, (USHORT) swp.cy);
|
|---|
| 3246 | }
|
|---|
| 3247 | }
|
|---|
| 3248 | size = sizeof(ULONG);
|
|---|
| 3249 | sprintf(szKey, "%sNumDirsLastTime", szPrefix);
|
|---|
| 3250 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3251 | FM3Str, szKey, (PVOID) & numsaves, &size)) {
|
|---|
| 3252 | if (fDeleteState)
|
|---|
| 3253 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3254 | for (x = numsaves - 1; x >= 0; x--) {
|
|---|
| 3255 | sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, x);
|
|---|
| 3256 | size = sizeof(SWP);
|
|---|
| 3257 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) {
|
|---|
| 3258 | if (fDeleteState)
|
|---|
| 3259 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3260 | sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x);
|
|---|
| 3261 | size = sizeof(szDir);
|
|---|
| 3262 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) {
|
|---|
| 3263 | // If restoring shutdown state and drive marked no prescan
|
|---|
| 3264 | // bypass window restore
|
|---|
| 3265 | if (fIsShutDownState &&
|
|---|
| 3266 | driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
|
|---|
| 3267 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3268 | continue;
|
|---|
| 3269 | }
|
|---|
| 3270 | if (fDeleteState)
|
|---|
| 3271 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3272 | localdcd.ds.detailslongname = dsDirCnrDefault.detailslongname; // Set default
|
|---|
| 3273 | size = sizeof(BOOL);
|
|---|
| 3274 | sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x);
|
|---|
| 3275 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3276 | FM3Str,
|
|---|
| 3277 | szKey,
|
|---|
| 3278 | (PVOID)&localdcd.ds.detailslongname,
|
|---|
| 3279 | &size) &&
|
|---|
| 3280 | size == sizeof(BOOL))
|
|---|
| 3281 | {
|
|---|
| 3282 | if (fDeleteState)
|
|---|
| 3283 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3284 | }
|
|---|
| 3285 | localdcd.ds.detailssubject = dsDirCnrDefault.detailssubject; // Set default
|
|---|
| 3286 | size = sizeof(BOOL);
|
|---|
| 3287 | sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, x);
|
|---|
| 3288 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3289 | FM3Str,
|
|---|
| 3290 | szKey,
|
|---|
| 3291 | (PVOID)&localdcd.ds.detailssubject,
|
|---|
| 3292 | &size) &&
|
|---|
| 3293 | size == sizeof(BOOL))
|
|---|
| 3294 | {
|
|---|
| 3295 | if (fDeleteState)
|
|---|
| 3296 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3297 | }
|
|---|
| 3298 | localdcd.ds.detailsea = dsDirCnrDefault.detailsea; // Set default
|
|---|
| 3299 | size = sizeof(BOOL);
|
|---|
| 3300 | sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, x);
|
|---|
| 3301 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3302 | FM3Str,
|
|---|
| 3303 | szKey,
|
|---|
| 3304 | (PVOID) & localdcd.ds.detailsea,
|
|---|
| 3305 | &size) &&
|
|---|
| 3306 | size == sizeof(BOOL))
|
|---|
| 3307 | {
|
|---|
| 3308 | if (fDeleteState)
|
|---|
| 3309 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3310 | }
|
|---|
| 3311 | localdcd.ds.detailssize = dsDirCnrDefault.detailssize; // Set default
|
|---|
| 3312 | size = sizeof(BOOL);
|
|---|
| 3313 | sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, x);
|
|---|
| 3314 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3315 | FM3Str,
|
|---|
| 3316 | szKey,
|
|---|
| 3317 | (PVOID) & localdcd.ds.detailssize,
|
|---|
| 3318 | &size) &&
|
|---|
| 3319 | size == sizeof(BOOL))
|
|---|
| 3320 | {
|
|---|
| 3321 | if (fDeleteState)
|
|---|
| 3322 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3323 | }
|
|---|
| 3324 | localdcd.ds.detailsicon = dsDirCnrDefault.detailsicon; // Set default
|
|---|
| 3325 | size = sizeof(BOOL);
|
|---|
| 3326 | sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, x);
|
|---|
| 3327 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3328 | FM3Str,
|
|---|
| 3329 | szKey,
|
|---|
| 3330 | (PVOID) & localdcd.ds.detailsicon,
|
|---|
| 3331 | &size) &&
|
|---|
| 3332 | size == sizeof(BOOL))
|
|---|
| 3333 | {
|
|---|
| 3334 | if (fDeleteState)
|
|---|
| 3335 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3336 | }
|
|---|
| 3337 | localdcd.ds.detailsattr = dsDirCnrDefault.detailsattr; // Set default
|
|---|
| 3338 | size = sizeof(BOOL);
|
|---|
| 3339 | sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, x);
|
|---|
| 3340 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3341 | FM3Str,
|
|---|
| 3342 | szKey,
|
|---|
| 3343 | (PVOID)&localdcd.ds.detailsattr,
|
|---|
| 3344 | &size) &&
|
|---|
| 3345 | size == sizeof(BOOL))
|
|---|
| 3346 | {
|
|---|
| 3347 | if (fDeleteState)
|
|---|
| 3348 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3349 | }
|
|---|
| 3350 | localdcd.ds.detailscrdate = dsDirCnrDefault.detailscrdate; // Set default
|
|---|
| 3351 | size = sizeof(BOOL);
|
|---|
| 3352 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, x);
|
|---|
| 3353 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3354 | FM3Str,
|
|---|
| 3355 | szKey,
|
|---|
| 3356 | (PVOID) & localdcd.ds.detailscrdate,
|
|---|
| 3357 | &size) && size == sizeof(BOOL))
|
|---|
| 3358 | {
|
|---|
| 3359 | if (fDeleteState)
|
|---|
| 3360 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3361 | }
|
|---|
| 3362 | localdcd.ds.detailscrtime = dsDirCnrDefault.detailscrtime; // Set default
|
|---|
| 3363 | size = sizeof(BOOL);
|
|---|
| 3364 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, x);
|
|---|
| 3365 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3366 | FM3Str,
|
|---|
| 3367 | szKey,
|
|---|
| 3368 | (PVOID)&localdcd.ds.detailscrtime,
|
|---|
| 3369 | &size) &&
|
|---|
| 3370 | size == sizeof(BOOL))
|
|---|
| 3371 | {
|
|---|
| 3372 | if (fDeleteState)
|
|---|
| 3373 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3374 | }
|
|---|
| 3375 | localdcd.ds.detailslwdate = dsDirCnrDefault.detailslwdate; // Set default
|
|---|
| 3376 | size = sizeof(BOOL);
|
|---|
| 3377 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, x);
|
|---|
| 3378 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3379 | FM3Str,
|
|---|
| 3380 | szKey,
|
|---|
| 3381 | (PVOID) & localdcd.ds.detailslwdate,
|
|---|
| 3382 | &size) &&
|
|---|
| 3383 | size == sizeof(BOOL))
|
|---|
| 3384 | {
|
|---|
| 3385 | if (fDeleteState)
|
|---|
| 3386 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3387 | }
|
|---|
| 3388 | localdcd.ds.detailslwtime = dsDirCnrDefault.detailslwtime; // Set default
|
|---|
| 3389 | size = sizeof(BOOL);
|
|---|
| 3390 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, x);
|
|---|
| 3391 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3392 | FM3Str,
|
|---|
| 3393 | szKey,
|
|---|
| 3394 | (PVOID) & localdcd.ds.detailslwtime,
|
|---|
| 3395 | &size) &&
|
|---|
| 3396 | size == sizeof(BOOL))
|
|---|
| 3397 | {
|
|---|
| 3398 | if (fDeleteState)
|
|---|
| 3399 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3400 | }
|
|---|
| 3401 | localdcd.ds.detailsladate = dsDirCnrDefault.detailsladate; // Set default
|
|---|
| 3402 | size = sizeof(BOOL);
|
|---|
| 3403 | sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, x);
|
|---|
| 3404 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3405 | FM3Str,
|
|---|
| 3406 | szKey,
|
|---|
| 3407 | (PVOID) & localdcd.ds.detailsladate,
|
|---|
| 3408 | &size) &&
|
|---|
| 3409 | size == sizeof(BOOL))
|
|---|
| 3410 | {
|
|---|
| 3411 | if (fDeleteState)
|
|---|
| 3412 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3413 | }
|
|---|
| 3414 | localdcd.ds.detailslatime = dsDirCnrDefault.detailslatime; // Set default
|
|---|
| 3415 | size = sizeof(BOOL);
|
|---|
| 3416 | sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, x);
|
|---|
| 3417 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3418 | FM3Str,
|
|---|
| 3419 | szKey,
|
|---|
| 3420 | (PVOID) & localdcd.ds.detailslatime,
|
|---|
| 3421 | &size) &&
|
|---|
| 3422 | size == sizeof(BOOL))
|
|---|
| 3423 | {
|
|---|
| 3424 | if (fDeleteState)
|
|---|
| 3425 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3426 | }
|
|---|
| 3427 | hwndDir = (HWND) WinSendMsg(hwndClient,
|
|---|
| 3428 | UM_SETDIR,
|
|---|
| 3429 | MPFROMP(szDir), MPFROMLONG(1));
|
|---|
| 3430 | if (hwndDir) {
|
|---|
| 3431 | hwndC = WinWindowFromID(hwndDir, FID_CLIENT);
|
|---|
| 3432 | if (hwndC) {
|
|---|
| 3433 | HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR);
|
|---|
| 3434 | if (!hwndPPSave) {
|
|---|
| 3435 | hwndPPSave = WinCreateWindow(hwndCnr, // Create a window (used to save default presparams)
|
|---|
| 3436 | WC_CONTAINER,
|
|---|
| 3437 | NULL,
|
|---|
| 3438 | CCS_AUTOPOSITION | CCS_MINIICONS |
|
|---|
| 3439 | CCS_MINIRECORDCORE | ulCnrType |
|
|---|
| 3440 | WS_VISIBLE,
|
|---|
| 3441 | 0,
|
|---|
| 3442 | 0,
|
|---|
| 3443 | 0,
|
|---|
| 3444 | 0,
|
|---|
| 3445 | hwndCnr,
|
|---|
| 3446 | HWND_TOP, (ULONG) -1, NULL, NULL);
|
|---|
| 3447 | CopyPresParams(hwndPPSave, hwndC);
|
|---|
| 3448 | RestorePresParams(hwndPPSave, "DirCnr");
|
|---|
| 3449 | }
|
|---|
| 3450 | sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);
|
|---|
| 3451 | RestorePresParams(hwndCnr, szKey);
|
|---|
| 3452 | dcd = WinQueryWindowPtr(hwndCnr, QWL_USER);
|
|---|
| 3453 | if (dcd) {
|
|---|
| 3454 | dcd->ds.detailslongname = localdcd.ds.detailslongname;
|
|---|
| 3455 | dcd->ds.detailssubject = localdcd.ds.detailssubject ;
|
|---|
| 3456 | dcd->ds.detailsattr = localdcd.ds.detailsattr ;
|
|---|
| 3457 | dcd->ds.detailsea = localdcd.ds.detailsea ;
|
|---|
| 3458 | dcd->ds.detailssize = localdcd.ds.detailssize ;
|
|---|
| 3459 | dcd->ds.detailsicon = localdcd.ds.detailsicon ;
|
|---|
| 3460 | dcd->ds.detailscrdate = localdcd.ds.detailscrdate ;
|
|---|
| 3461 | dcd->ds.detailscrtime = localdcd.ds.detailscrtime ;
|
|---|
| 3462 | dcd->ds.detailsladate = localdcd.ds.detailsladate ;
|
|---|
| 3463 | dcd->ds.detailslatime = localdcd.ds.detailslatime ;
|
|---|
| 3464 | dcd->ds.detailslwdate = localdcd.ds.detailslwdate ;
|
|---|
| 3465 | dcd->ds.detailslwtime = localdcd.ds.detailslwtime ;
|
|---|
| 3466 | size = sizeof(INT);
|
|---|
| 3467 | sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x);
|
|---|
| 3468 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3469 | FM3Str,
|
|---|
| 3470 | szKey,
|
|---|
| 3471 | (PVOID) & dcd->sortFlags,
|
|---|
| 3472 | &size) && size == sizeof(INT)) {
|
|---|
| 3473 | if (!dcd->sortFlags)
|
|---|
| 3474 | dcd->sortFlags = SORT_PATHNAME;
|
|---|
| 3475 | }
|
|---|
| 3476 | if (fDeleteState)
|
|---|
| 3477 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3478 | size = sizeof(MASK);
|
|---|
| 3479 | sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x);
|
|---|
| 3480 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3481 | FM3Str,
|
|---|
| 3482 | szKey,
|
|---|
| 3483 | (PVOID) & dcd->mask, &size) && size) {
|
|---|
| 3484 | if (*dcd->mask.szMask)
|
|---|
| 3485 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
|---|
| 3486 | UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
|
|---|
| 3487 | }
|
|---|
| 3488 | *(dcd->mask.prompt) = 0;
|
|---|
| 3489 | if (fDeleteState)
|
|---|
| 3490 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3491 | size = sizeof(ULONG);
|
|---|
| 3492 | sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x);
|
|---|
| 3493 | if (!noview) {
|
|---|
| 3494 | if (PrfQueryProfileData(fmprof,
|
|---|
| 3495 | FM3Str,
|
|---|
| 3496 | szKey,
|
|---|
| 3497 | (PVOID) & dcd->flWindowAttr,
|
|---|
| 3498 | &size) && size == sizeof(ULONG)) {
|
|---|
| 3499 |
|
|---|
| 3500 | CNRINFO cnri;
|
|---|
| 3501 |
|
|---|
| 3502 | memset(&cnri, 0, sizeof(CNRINFO));
|
|---|
| 3503 | cnri.cb = sizeof(CNRINFO);
|
|---|
| 3504 | if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
|---|
| 3505 | CM_QUERYCNRINFO,
|
|---|
| 3506 | MPFROMP(&cnri),
|
|---|
| 3507 | MPFROMLONG(sizeof(CNRINFO)))) {
|
|---|
| 3508 | cnri.flWindowAttr = dcd->flWindowAttr;
|
|---|
| 3509 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
|---|
| 3510 | CM_SETCNRINFO,
|
|---|
| 3511 | MPFROMP(&cnri),
|
|---|
| 3512 | MPFROMLONG(CMA_FLWINDOWATTR));
|
|---|
| 3513 | }
|
|---|
| 3514 | }
|
|---|
| 3515 | }
|
|---|
| 3516 | if (fDeleteState)
|
|---|
| 3517 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
|---|
| 3518 | if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL))
|
|---|
| 3519 | WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL);
|
|---|
| 3520 | }
|
|---|
| 3521 | }
|
|---|
| 3522 | fRestored = TRUE;
|
|---|
| 3523 | swp.hwnd = hwndDir;
|
|---|
| 3524 | TransformSwp(&swp, xtrans, ytrans);
|
|---|
| 3525 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
|---|
| 3526 | WinSetWindowPos(hwndDir,
|
|---|
| 3527 | HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);
|
|---|
| 3528 | WinSetWindowUShort(hwndDir, QWS_XRESTORE, (USHORT) swp.x);
|
|---|
| 3529 | WinSetWindowUShort(hwndDir, QWS_CXRESTORE, (USHORT) swp.cx);
|
|---|
| 3530 | WinSetWindowUShort(hwndDir, QWS_YRESTORE, (USHORT) swp.y);
|
|---|
| 3531 | WinSetWindowUShort(hwndDir, QWS_CYRESTORE, (USHORT) swp.cy);
|
|---|
| 3532 | } else
|
|---|
| 3533 | WinSetWindowPos(hwndDir,
|
|---|
| 3534 | HWND_TOP,
|
|---|
| 3535 | swp.x,
|
|---|
| 3536 | swp.y,
|
|---|
| 3537 | swp.cx,
|
|---|
| 3538 | swp.cy,
|
|---|
| 3539 | swp.fl | SWP_MOVE |
|
|---|
| 3540 | SWP_SIZE | SWP_SHOW | SWP_ZORDER |
|
|---|
| 3541 | SWP_ACTIVATE);
|
|---|
| 3542 | }
|
|---|
| 3543 | }
|
|---|
| 3544 | }
|
|---|
| 3545 | } // for
|
|---|
| 3546 | if (hwndPPSave) {
|
|---|
| 3547 | SavePresParams(hwndPPSave, "DirCnr");
|
|---|
| 3548 | WinDestroyWindow(hwndPPSave);
|
|---|
| 3549 | }
|
|---|
| 3550 | }
|
|---|
| 3551 | return fRestored;
|
|---|
| 3552 | }
|
|---|
| 3553 |
|
|---|
| 3554 | static ULONG CountChildren(HWND hwndClient, ULONG * ulNumMinChildren)
|
|---|
| 3555 | {
|
|---|
| 3556 | HENUM henum;
|
|---|
| 3557 | HWND hwndChild;
|
|---|
| 3558 | SWP swp;
|
|---|
| 3559 | register ULONG ulCnt = 0L;
|
|---|
| 3560 | USHORT id;
|
|---|
| 3561 |
|
|---|
| 3562 | if (ulNumMinChildren)
|
|---|
| 3563 | *ulNumMinChildren = 0L;
|
|---|
| 3564 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| 3565 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 3566 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
|---|
| 3567 | if (!id || (!fFreeTree && id == TREE_FRAME))
|
|---|
| 3568 | continue;
|
|---|
| 3569 | ulCnt++;
|
|---|
| 3570 | if (ulNumMinChildren) {
|
|---|
| 3571 | if (WinQueryWindowPos(hwndChild, &swp) && (swp.fl & SWP_MINIMIZE))
|
|---|
| 3572 | (*ulNumMinChildren)++;
|
|---|
| 3573 | }
|
|---|
| 3574 | }
|
|---|
| 3575 | WinEndEnumWindows(henum);
|
|---|
| 3576 | return ulCnt;
|
|---|
| 3577 | }
|
|---|
| 3578 |
|
|---|
| 3579 | VOID GetNextWindowPos(HWND hwndClient, PSWP pswp, ULONG * ulCntR,
|
|---|
| 3580 | ULONG * ulNumMinChildrenR)
|
|---|
| 3581 | {
|
|---|
| 3582 | register ULONG ulCnt;
|
|---|
| 3583 | ULONG ulNumMinChildren;
|
|---|
| 3584 | RECTL Rectl;
|
|---|
| 3585 | register ULONG ulXDiff, ulYDiff, ulWindowsPerStack;
|
|---|
| 3586 |
|
|---|
| 3587 | if (!ulCntR || !ulNumMinChildrenR)
|
|---|
| 3588 | ulCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
|---|
| 3589 | else {
|
|---|
| 3590 | ulCnt = *ulCntR;
|
|---|
| 3591 | ulNumMinChildren = *ulNumMinChildrenR;
|
|---|
| 3592 | if (ulCnt == (ULONG) - 1) {
|
|---|
| 3593 | ulCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
|---|
| 3594 | /* return these values to the caller for later use */
|
|---|
| 3595 | *ulCntR = ulCnt;
|
|---|
| 3596 | *ulNumMinChildrenR = ulNumMinChildren;
|
|---|
| 3597 | }
|
|---|
| 3598 | }
|
|---|
| 3599 | WinQueryWindowRect(hwndClient, &Rectl);
|
|---|
| 3600 | AdjustSizeOfClient(NULL, &Rectl);
|
|---|
| 3601 | if (!fFreeTree) {
|
|---|
| 3602 |
|
|---|
| 3603 | SWP swp;
|
|---|
| 3604 |
|
|---|
| 3605 | WinQueryWindowPos(hwndTree, &swp);
|
|---|
| 3606 | if (ulNumMinChildren || (swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
|---|
| 3607 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
|---|
| 3608 | }
|
|---|
| 3609 | else if (ulNumMinChildren)
|
|---|
| 3610 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
|---|
| 3611 |
|
|---|
| 3612 | ulXDiff = WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER) +
|
|---|
| 3613 | WinQuerySysValue(HWND_DESKTOP, SV_CXMINMAXBUTTON) / 2;
|
|---|
| 3614 | ulYDiff = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER) +
|
|---|
| 3615 | WinQuerySysValue(HWND_DESKTOP, SV_CYMINMAXBUTTON);
|
|---|
| 3616 | ulWindowsPerStack = (Rectl.yTop - Rectl.yBottom) / (3 * ulYDiff);
|
|---|
| 3617 | pswp->cx = Rectl.xRight - (ulWindowsPerStack * ulXDiff);
|
|---|
| 3618 | pswp->cy = (Rectl.yTop - Rectl.yBottom) - (ulWindowsPerStack * ulYDiff);
|
|---|
| 3619 | ulWindowsPerStack++;
|
|---|
| 3620 | pswp->x = Rectl.xLeft + ((ulCnt % ulWindowsPerStack) * ulXDiff);
|
|---|
| 3621 | pswp->y = (Rectl.yTop - pswp->cy - ((ulCnt % ulWindowsPerStack) * ulYDiff));
|
|---|
| 3622 | }
|
|---|
| 3623 |
|
|---|
| 3624 | static VOID CascadeChildren(HWND hwndClient)
|
|---|
| 3625 | {
|
|---|
| 3626 | ULONG ulCnt = 0L, ulNumMinChildren;
|
|---|
| 3627 | HWND hwndChild;
|
|---|
| 3628 | HENUM henum;
|
|---|
| 3629 | SWP swp;
|
|---|
| 3630 | USHORT id;
|
|---|
| 3631 | RECTL Rectl;
|
|---|
| 3632 |
|
|---|
| 3633 | WinQueryWindowPos(hwndClient, &swp);
|
|---|
| 3634 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
|---|
| 3635 | return;
|
|---|
| 3636 |
|
|---|
| 3637 | CountChildren(hwndClient, &ulNumMinChildren);
|
|---|
| 3638 | if (!fFreeTree) {
|
|---|
| 3639 | WinQueryWindowRect(hwndClient, &Rectl);
|
|---|
| 3640 | AdjustSizeOfClient(NULL, &Rectl);
|
|---|
| 3641 | WinQueryWindowPos(hwndTree, &swp);
|
|---|
| 3642 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
|---|
| 3643 | if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
|
|---|
| 3644 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
|---|
| 3645 | if (swp.x != 0)
|
|---|
| 3646 | swp.x = 0;
|
|---|
| 3647 | if (swp.y < 0)
|
|---|
| 3648 | swp.y = 0;
|
|---|
| 3649 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
|---|
| 3650 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
|---|
| 3651 | WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
|---|
| 3652 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
|---|
| 3653 | }
|
|---|
| 3654 | }
|
|---|
| 3655 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| 3656 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 3657 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
|---|
| 3658 | if (!id || (!fFreeTree && id == TREE_FRAME))
|
|---|
| 3659 | continue;
|
|---|
| 3660 | WinQueryWindowPos(hwndChild, &swp);
|
|---|
| 3661 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE))) {
|
|---|
| 3662 | GetNextWindowPos(hwndClient, &swp, &ulCnt, &ulNumMinChildren);
|
|---|
| 3663 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
|---|
| 3664 | SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE |
|
|---|
| 3665 | SWP_ZORDER | SWP_ACTIVATE);
|
|---|
| 3666 | ulCnt++;
|
|---|
| 3667 | }
|
|---|
| 3668 | }
|
|---|
| 3669 | WinEndEnumWindows(henum);
|
|---|
| 3670 | }
|
|---|
| 3671 |
|
|---|
| 3672 | VOID TileChildren(HWND hwndClient, BOOL absolute)
|
|---|
| 3673 | {
|
|---|
| 3674 | register ULONG ulChildCnt, ulSquare, ulNumRows, ulNumCols, ulExtraCols,
|
|---|
| 3675 | ulWidth, ulHeight;
|
|---|
| 3676 | ULONG ulNumMinChildren;
|
|---|
| 3677 | RECTL Rectl;
|
|---|
| 3678 | HWND hwndChild;
|
|---|
| 3679 |
|
|---|
| 3680 | if (fNoTileUpdate || hwndClient == HWND_DESKTOP)
|
|---|
| 3681 | return;
|
|---|
| 3682 | {
|
|---|
| 3683 | SWP swp;
|
|---|
| 3684 |
|
|---|
| 3685 | WinQueryWindowPos(hwndClient, &swp);
|
|---|
| 3686 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
|---|
| 3687 | return;
|
|---|
| 3688 | }
|
|---|
| 3689 | ulChildCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
|---|
| 3690 | ulChildCnt -= ulNumMinChildren;
|
|---|
| 3691 | if (!ulChildCnt)
|
|---|
| 3692 | return;
|
|---|
| 3693 |
|
|---|
| 3694 | fNoTileUpdate = TRUE;
|
|---|
| 3695 |
|
|---|
| 3696 | for (ulSquare = 2; ulSquare * ulSquare <= ulChildCnt; ulSquare++) {
|
|---|
| 3697 | ;
|
|---|
| 3698 | }
|
|---|
| 3699 | if (!fTileBackwards) {
|
|---|
| 3700 | ulNumCols = ulSquare - 1;
|
|---|
| 3701 | ulNumRows = ulChildCnt / ulNumCols;
|
|---|
| 3702 | }
|
|---|
| 3703 | else {
|
|---|
| 3704 | ulNumRows = ulSquare - 1;
|
|---|
| 3705 | ulNumCols = ulChildCnt / ulNumRows;
|
|---|
| 3706 | }
|
|---|
| 3707 | ulExtraCols = ulChildCnt % ulNumCols;
|
|---|
| 3708 |
|
|---|
| 3709 | WinQueryWindowRect(hwndClient, &Rectl);
|
|---|
| 3710 |
|
|---|
| 3711 | if (!fFreeTree) {
|
|---|
| 3712 |
|
|---|
| 3713 | SWP swp;
|
|---|
| 3714 |
|
|---|
| 3715 | WinQueryWindowPos(hwndTree, &swp);
|
|---|
| 3716 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
|---|
| 3717 | if (swp.y < 0)
|
|---|
| 3718 | swp.y = 0;
|
|---|
| 3719 | if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
|
|---|
| 3720 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
|---|
| 3721 | if (swp.x != 0)
|
|---|
| 3722 | swp.x = 0;
|
|---|
| 3723 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
|---|
| 3724 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
|---|
| 3725 | WinSetWindowPos(hwndTree,
|
|---|
| 3726 | HWND_TOP,
|
|---|
| 3727 | swp.x,
|
|---|
| 3728 | swp.y,
|
|---|
| 3729 | swp.cx,
|
|---|
| 3730 | swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
|---|
| 3731 | WinQueryWindowPos(hwndTree, &swp);
|
|---|
| 3732 | }
|
|---|
| 3733 | if (ulNumMinChildren || (swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
|---|
| 3734 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
|---|
| 3735 | }
|
|---|
| 3736 | else if (ulNumMinChildren)
|
|---|
| 3737 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
|---|
| 3738 |
|
|---|
| 3739 | AdjustSizeOfClient(NULL, &Rectl);
|
|---|
| 3740 |
|
|---|
| 3741 | if (Rectl.xRight > 0L && (Rectl.yBottom < Rectl.yTop)) {
|
|---|
| 3742 |
|
|---|
| 3743 | HENUM henum;
|
|---|
| 3744 |
|
|---|
| 3745 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| 3746 | if ((hwndChild = WinGetNextWindow(henum)) != (HWND) 0) {
|
|---|
| 3747 |
|
|---|
| 3748 | ULONG ulCurRow, ulCurCol;
|
|---|
| 3749 | SWP swp;
|
|---|
| 3750 | USHORT id;
|
|---|
| 3751 |
|
|---|
| 3752 | ulHeight = (Rectl.yTop - Rectl.yBottom) / ulNumRows;
|
|---|
| 3753 |
|
|---|
| 3754 | for (ulCurRow = 0; ulCurRow < ulNumRows; ulCurRow++) {
|
|---|
| 3755 | if ((ulNumRows - ulCurRow) <= ulExtraCols)
|
|---|
| 3756 | ulNumCols++;
|
|---|
| 3757 | for (ulCurCol = 0; ulCurCol < ulNumCols; ulCurCol++) {
|
|---|
| 3758 | ulWidth = Rectl.xRight / ulNumCols;
|
|---|
| 3759 |
|
|---|
| 3760 | while (hwndChild) {
|
|---|
| 3761 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
|---|
| 3762 | if (id && (id != TREE_FRAME || fFreeTree)) {
|
|---|
| 3763 | WinQueryWindowPos(hwndChild, &swp);
|
|---|
| 3764 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
|---|
| 3765 | break;
|
|---|
| 3766 | }
|
|---|
| 3767 | hwndChild = WinGetNextWindow(henum);
|
|---|
| 3768 | }
|
|---|
| 3769 |
|
|---|
| 3770 | if (hwndChild) {
|
|---|
| 3771 | if (!absolute && (swp.fl & SWP_MAXIMIZE)) {
|
|---|
| 3772 | WinGetMaxPosition(hwndChild, &swp);
|
|---|
| 3773 | WinSetWindowPos(hwndChild,
|
|---|
| 3774 | HWND_TOP,
|
|---|
| 3775 | swp.x,
|
|---|
| 3776 | swp.y,
|
|---|
| 3777 | swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
|---|
| 3778 | WinSetWindowUShort(hwndChild,
|
|---|
| 3779 | QWS_XRESTORE,
|
|---|
| 3780 | (USHORT) (ulWidth * ulCurCol) + Rectl.xLeft);
|
|---|
| 3781 | WinSetWindowUShort(hwndChild,
|
|---|
| 3782 | QWS_YRESTORE,
|
|---|
| 3783 | (USHORT) (Rectl.yTop -
|
|---|
| 3784 | (ulHeight * (ulCurRow + 1))));
|
|---|
| 3785 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth);
|
|---|
| 3786 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight);
|
|---|
| 3787 | }
|
|---|
| 3788 | else
|
|---|
| 3789 | WinSetWindowPos(hwndChild,
|
|---|
| 3790 | HWND_TOP,
|
|---|
| 3791 | (ulWidth * ulCurCol) + Rectl.xLeft,
|
|---|
| 3792 | Rectl.yTop - (ulHeight * (ulCurRow + 1)),
|
|---|
| 3793 | ulWidth,
|
|---|
| 3794 | ulHeight,
|
|---|
| 3795 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
|---|
| 3796 | hwndChild = WinGetNextWindow(henum);
|
|---|
| 3797 | }
|
|---|
| 3798 | }
|
|---|
| 3799 | if ((ulNumRows - ulCurRow) <= ulExtraCols) {
|
|---|
| 3800 | ulNumCols--;
|
|---|
| 3801 | ulExtraCols--;
|
|---|
| 3802 | }
|
|---|
| 3803 | }
|
|---|
| 3804 | }
|
|---|
| 3805 | WinEndEnumWindows(henum);
|
|---|
| 3806 | }
|
|---|
| 3807 |
|
|---|
| 3808 | fNoTileUpdate = FALSE;
|
|---|
| 3809 | }
|
|---|
| 3810 |
|
|---|
| 3811 | static VOID ResizeChildren(HWND hwndClient, SHORT oldcx, SHORT oldcy,
|
|---|
| 3812 | SHORT newcx, SHORT newcy)
|
|---|
| 3813 | {
|
|---|
| 3814 | /*
|
|---|
| 3815 | * resize all children of the client to maintain their proportional
|
|---|
| 3816 | * sizes and positions
|
|---|
| 3817 | */
|
|---|
| 3818 |
|
|---|
| 3819 | if (!newcx || !newcy || !oldcx || !oldcy)
|
|---|
| 3820 | return;
|
|---|
| 3821 | {
|
|---|
| 3822 | HENUM henum;
|
|---|
| 3823 | HWND hwndChild;
|
|---|
| 3824 | register LONG x, y, cx, cy, ucx, ucy, ux, uy;
|
|---|
| 3825 | SWP swp;
|
|---|
| 3826 |
|
|---|
| 3827 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| 3828 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 3829 | if (!WinQueryWindowUShort(hwndChild, QWS_ID))
|
|---|
| 3830 | continue;
|
|---|
| 3831 | if (WinQueryWindowPos(hwndChild, &swp)) {
|
|---|
| 3832 | if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {
|
|---|
| 3833 | swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);
|
|---|
| 3834 | swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);
|
|---|
| 3835 | swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);
|
|---|
| 3836 | swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);
|
|---|
| 3837 | }
|
|---|
| 3838 | else if (swp.fl & SWP_MAXIMIZE) {
|
|---|
| 3839 | swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);
|
|---|
| 3840 | swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);
|
|---|
| 3841 | swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);
|
|---|
| 3842 | swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);
|
|---|
| 3843 | }
|
|---|
| 3844 | cx = (swp.cx) ? (LONG) (((double)oldcx * 100.0) / (double)swp.cx) : 0;
|
|---|
| 3845 | cy = (swp.cy) ? (LONG) (((double)oldcy * 100.0) / (double)swp.cy) : 0;
|
|---|
| 3846 | x = (swp.x) ? (LONG) (((double)oldcx * 100.0) / (double)swp.x) : 0;
|
|---|
| 3847 | y = (swp.y) ? (LONG) (((double)oldcy * 100.0) / (double)swp.y) : 0;
|
|---|
| 3848 | if (x < 0)
|
|---|
| 3849 | x = 0;
|
|---|
| 3850 | if (y < 0)
|
|---|
| 3851 | y = 0;
|
|---|
| 3852 | ux = (x) ? (LONG) (((double)newcx * 100.0) / (double)x) : 0;
|
|---|
| 3853 | uy = (y) ? (LONG) (((double)newcy * 100.0) / (double)y) : 0;
|
|---|
| 3854 | ucx = (cx) ? (LONG) (((double)newcx * 100.0) / (double)cx) : 0;
|
|---|
| 3855 | ucy = (cy) ? (LONG) (((double)newcy * 100.0) / (double)cy) : 0;
|
|---|
| 3856 | if (ux + ucx > newcx)
|
|---|
| 3857 | ucx = newcx - ux;
|
|---|
| 3858 | if (uy + ucy > newcy)
|
|---|
| 3859 | ucy = newcy - uy;
|
|---|
| 3860 |
|
|---|
| 3861 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)))
|
|---|
| 3862 | WinSetWindowPos(hwndChild, HWND_TOP, ux, uy, ucx, ucy,
|
|---|
| 3863 | SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
|---|
| 3864 | else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
|---|
| 3865 | WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1);
|
|---|
| 3866 | WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);
|
|---|
| 3867 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,
|
|---|
| 3868 | SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE);
|
|---|
| 3869 | WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);
|
|---|
| 3870 | WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);
|
|---|
| 3871 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);
|
|---|
| 3872 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);
|
|---|
| 3873 | }
|
|---|
| 3874 | else {
|
|---|
| 3875 | WinGetMaxPosition(hwndChild, &swp);
|
|---|
| 3876 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
|---|
| 3877 | SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
|---|
| 3878 | WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);
|
|---|
| 3879 | WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);
|
|---|
| 3880 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);
|
|---|
| 3881 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);
|
|---|
| 3882 | }
|
|---|
| 3883 | }
|
|---|
| 3884 | }
|
|---|
| 3885 | WinEndEnumWindows(henum);
|
|---|
| 3886 | }
|
|---|
| 3887 | if (!fFreeTree) {
|
|---|
| 3888 |
|
|---|
| 3889 | RECTL Rectl;
|
|---|
| 3890 | SWP swp;
|
|---|
| 3891 |
|
|---|
| 3892 | WinQueryWindowRect(hwndClient, &Rectl);
|
|---|
| 3893 | AdjustSizeOfClient(NULL, &Rectl);
|
|---|
| 3894 | WinQueryWindowPos(hwndTree, &swp);
|
|---|
| 3895 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
|---|
| 3896 |
|
|---|
| 3897 | if (!fNoTreeGap) {
|
|---|
| 3898 | INT height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
|---|
| 3899 | if (swp.y < height)
|
|---|
| 3900 | swp.y = height; // Force bottom to position
|
|---|
| 3901 | }
|
|---|
| 3902 | else
|
|---|
| 3903 | swp.y = 0; // Force bottom to position
|
|---|
| 3904 |
|
|---|
| 3905 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
|---|
| 3906 | if (swp.cy < 0)
|
|---|
| 3907 | swp.cy = 0;
|
|---|
| 3908 |
|
|---|
| 3909 | if (swp.x != 0)
|
|---|
| 3910 | swp.x = 0; // Left align
|
|---|
| 3911 |
|
|---|
| 3912 | // AdjustSizeOfClient can return bogus xRight values - fixme someday
|
|---|
| 3913 | if (Rectl.xRight >= Rectl.xLeft) {
|
|---|
| 3914 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
|---|
| 3915 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
|---|
| 3916 | }
|
|---|
| 3917 | WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
|---|
| 3918 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
|---|
| 3919 | }
|
|---|
| 3920 | }
|
|---|
| 3921 | }
|
|---|
| 3922 |
|
|---|
| 3923 | static VOID MinResChildren(HWND hwndClient, ULONG cmd)
|
|---|
| 3924 | {
|
|---|
| 3925 | HENUM henum;
|
|---|
| 3926 | HWND hwndChild;
|
|---|
| 3927 |
|
|---|
| 3928 | {
|
|---|
| 3929 | SWP swp;
|
|---|
| 3930 |
|
|---|
| 3931 | WinQueryWindowPos(hwndClient, &swp);
|
|---|
| 3932 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
|---|
| 3933 | return;
|
|---|
| 3934 | }
|
|---|
| 3935 | henum = WinBeginEnumWindows(hwndClient);
|
|---|
| 3936 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
|---|
| 3937 | if (!WinQueryWindowUShort(hwndChild, QWS_ID))
|
|---|
| 3938 | continue;
|
|---|
| 3939 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, cmd);
|
|---|
| 3940 | }
|
|---|
| 3941 | }
|
|---|
| 3942 |
|
|---|
| 3943 | //=== ChildFrameButtonProc: subclass handler for WALKBUTTON and QUICKBUTTON windows ===
|
|---|
| 3944 |
|
|---|
| 3945 | static MRESULT EXPENTRY ChildFrameButtonProc(HWND hwnd,
|
|---|
| 3946 | ULONG msg,
|
|---|
| 3947 | MPARAM mp1, MPARAM mp2)
|
|---|
| 3948 | {
|
|---|
| 3949 | USHORT id;
|
|---|
| 3950 | static BOOL emphasized = FALSE;
|
|---|
| 3951 |
|
|---|
| 3952 | switch (msg) {
|
|---|
| 3953 | case WM_BUTTON1CLICK:
|
|---|
| 3954 | case WM_CHORD:
|
|---|
| 3955 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 3956 | break;
|
|---|
| 3957 |
|
|---|
| 3958 | case WM_MOUSEMOVE:
|
|---|
| 3959 | if (fOtherHelp) {
|
|---|
| 3960 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
|---|
| 3961 | && !WinQueryCapture(HWND_DESKTOP)) {
|
|---|
| 3962 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 3963 | switch (id) {
|
|---|
| 3964 | case IDM_OPENWALK:
|
|---|
| 3965 | MakeBubble(hwnd, FALSE, GetPString(IDS_WALKBUTTONHELP));
|
|---|
| 3966 | break;
|
|---|
| 3967 | case IDM_USERLIST:
|
|---|
| 3968 | MakeBubble(hwnd, FALSE, GetPString(IDS_QUICKBUTTONHELP));
|
|---|
| 3969 | break;
|
|---|
| 3970 | }
|
|---|
| 3971 | }
|
|---|
| 3972 | }
|
|---|
| 3973 | break;
|
|---|
| 3974 |
|
|---|
| 3975 | case WM_BUTTON3CLICK:
|
|---|
| 3976 | case WM_BUTTON2CLICK:
|
|---|
| 3977 | {
|
|---|
| 3978 | USHORT cmd = 0;
|
|---|
| 3979 |
|
|---|
| 3980 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 3981 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 3982 | switch (id) {
|
|---|
| 3983 | case IDM_OPENWALK:
|
|---|
| 3984 | switch (msg) {
|
|---|
| 3985 | case WM_BUTTON2CLICK:
|
|---|
| 3986 | if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
|
|---|
| 3987 | (KC_ALT | KC_SHIFT | KC_CTRL))
|
|---|
| 3988 | cmd = IDM_GREP;
|
|---|
| 3989 | else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))
|
|---|
| 3990 | CascadeChildren(hwndMain);
|
|---|
| 3991 |
|
|---|
| 3992 | #ifdef NEVER
|
|---|
| 3993 | else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))
|
|---|
| 3994 | cmd = IDM_SYSINFO;
|
|---|
| 3995 | #endif
|
|---|
| 3996 |
|
|---|
| 3997 | else if (shiftstate & KC_SHIFT)
|
|---|
| 3998 | cmd = IDM_WINDOWDLG;
|
|---|
| 3999 | else if (shiftstate & KC_CTRL)
|
|---|
| 4000 | cmd = IDM_SEEALL;
|
|---|
| 4001 | else if (shiftstate & KC_ALT)
|
|---|
| 4002 | TileChildren(hwndMain, TRUE);
|
|---|
| 4003 | else
|
|---|
| 4004 | cmd = IDM_WALKDIR;
|
|---|
| 4005 | break;
|
|---|
| 4006 | case WM_BUTTON3CLICK:
|
|---|
| 4007 | TileChildren(hwndMain, TRUE);
|
|---|
| 4008 | break;
|
|---|
| 4009 | }
|
|---|
| 4010 | break;
|
|---|
| 4011 | case IDM_USERLIST:
|
|---|
| 4012 | switch (msg) {
|
|---|
| 4013 | case WM_BUTTON2CLICK:
|
|---|
| 4014 | if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
|
|---|
| 4015 | (KC_ALT | KC_SHIFT | KC_CTRL))
|
|---|
| 4016 | cmd = IDM_COLORPALETTE;
|
|---|
| 4017 | else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))
|
|---|
| 4018 | cmd = IDM_HIDEMENU;
|
|---|
| 4019 | else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))
|
|---|
| 4020 | cmd = IDM_NOTEBOOK;
|
|---|
| 4021 | else if (shiftstate & KC_SHIFT)
|
|---|
| 4022 | cmd = IDM_TOOLTITLES;
|
|---|
| 4023 | else if (shiftstate & KC_CTRL)
|
|---|
| 4024 | cmd = IDM_TEXTTOOLS;
|
|---|
| 4025 | else if (shiftstate & KC_ALT)
|
|---|
| 4026 | cmd = IDM_FONTPALETTE;
|
|---|
| 4027 | else
|
|---|
| 4028 | cmd = IDM_TOOLBAR;
|
|---|
| 4029 | break;
|
|---|
| 4030 | case WM_BUTTON3CLICK:
|
|---|
| 4031 | cmd = IDM_DRIVEBAR;
|
|---|
| 4032 | break;
|
|---|
| 4033 | }
|
|---|
| 4034 | break;
|
|---|
| 4035 | } // switch id
|
|---|
| 4036 |
|
|---|
| 4037 | if (cmd) {
|
|---|
| 4038 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_CLIENT),
|
|---|
| 4039 | WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
|
|---|
| 4040 | }
|
|---|
| 4041 | }
|
|---|
| 4042 | break;
|
|---|
| 4043 |
|
|---|
| 4044 | case DM_DRAGOVER:
|
|---|
| 4045 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
|---|
| 4046 | if (id == IDM_OPENWALK) {
|
|---|
| 4047 | if (!emphasized) {
|
|---|
| 4048 | emphasized = TRUE;
|
|---|
| 4049 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| 4050 | }
|
|---|
| 4051 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
|---|
| 4052 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
|---|
| 4053 | }
|
|---|
| 4054 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
|---|
| 4055 |
|
|---|
| 4056 | case DM_DRAGLEAVE:
|
|---|
| 4057 | if (emphasized) {
|
|---|
| 4058 | emphasized = FALSE;
|
|---|
| 4059 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| 4060 | }
|
|---|
| 4061 | break;
|
|---|
| 4062 |
|
|---|
| 4063 | case DM_DROPHELP:
|
|---|
| 4064 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_OPENDROPHELP));
|
|---|
| 4065 | return 0;
|
|---|
| 4066 |
|
|---|
| 4067 | case DM_DROP:
|
|---|
| 4068 | {
|
|---|
| 4069 | char szFrom[CCHMAXPATH + 2];
|
|---|
| 4070 |
|
|---|
| 4071 | if (emphasized) {
|
|---|
| 4072 | emphasized = FALSE;
|
|---|
| 4073 | DrawTargetEmphasis(hwnd, emphasized);
|
|---|
| 4074 | }
|
|---|
| 4075 | if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
|
|---|
| 4076 | if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) {
|
|---|
| 4077 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom);
|
|---|
| 4078 | }
|
|---|
| 4079 | }
|
|---|
| 4080 | }
|
|---|
| 4081 | return 0;
|
|---|
| 4082 |
|
|---|
| 4083 | case WM_CLOSE:
|
|---|
| 4084 | WinDestroyWindow(hwnd);
|
|---|
| 4085 | return 0;
|
|---|
| 4086 | }
|
|---|
| 4087 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
|---|
| 4088 | }
|
|---|
| 4089 |
|
|---|
| 4090 | static MRESULT EXPENTRY MainFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
|---|
| 4091 | MPARAM mp2)
|
|---|
| 4092 | {
|
|---|
| 4093 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
|---|
| 4094 | static ULONG aheight = 0L;
|
|---|
| 4095 |
|
|---|
| 4096 | switch (msg) {
|
|---|
| 4097 | case WM_ADJUSTWINDOWPOS:
|
|---|
| 4098 | {
|
|---|
| 4099 | SWP *pswp;
|
|---|
| 4100 |
|
|---|
| 4101 | pswp = (SWP *) mp1;
|
|---|
| 4102 | if (fDataMin && !fAmClosing) {
|
|---|
| 4103 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
|---|
| 4104 |
|
|---|
| 4105 | SWP swp;
|
|---|
| 4106 |
|
|---|
| 4107 | WinQueryWindowPos(hwnd, &swp);
|
|---|
| 4108 | PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID);
|
|---|
| 4109 | HideNote();
|
|---|
| 4110 | }
|
|---|
| 4111 | else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) {
|
|---|
| 4112 | if (DataHwnd)
|
|---|
| 4113 | PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID);
|
|---|
| 4114 | }
|
|---|
| 4115 | }
|
|---|
| 4116 | if (!fAmClosing) {
|
|---|
| 4117 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE))
|
|---|
| 4118 | HideNote();
|
|---|
| 4119 | }
|
|---|
| 4120 | }
|
|---|
| 4121 | break;
|
|---|
| 4122 |
|
|---|
| 4123 | case UM_FOCUSME:
|
|---|
| 4124 | CreateDataBar(HWND_DESKTOP, (ULONG) mp1);
|
|---|
| 4125 | return 0;
|
|---|
| 4126 |
|
|---|
| 4127 | case WM_BUTTON1UP:
|
|---|
| 4128 | case WM_BUTTON2UP:
|
|---|
| 4129 | case WM_BUTTON3UP:
|
|---|
| 4130 | case WM_MOUSEMOVE:
|
|---|
| 4131 | case WM_CHORD:
|
|---|
| 4132 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 4133 | break;
|
|---|
| 4134 |
|
|---|
| 4135 | case WM_CHAR:
|
|---|
| 4136 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
|---|
| 4137 | break;
|
|---|
| 4138 |
|
|---|
| 4139 | case WM_CONTROL:
|
|---|
| 4140 | return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_CONTROL, mp1,
|
|---|
| 4141 | mp2);
|
|---|
| 4142 |
|
|---|
| 4143 | case WM_COMMAND:
|
|---|
| 4144 | return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
|
|---|
| 4145 |
|
|---|
| 4146 | case WM_CALCFRAMERECT:
|
|---|
| 4147 | {
|
|---|
| 4148 | MRESULT mr;
|
|---|
| 4149 | PRECTL prectl;
|
|---|
| 4150 | LONG sheight = 20, bheight = 20;
|
|---|
| 4151 |
|
|---|
| 4152 | mr = oldproc(hwnd, msg, mp1, mp2);
|
|---|
| 4153 |
|
|---|
| 4154 | /*
|
|---|
| 4155 | * Calculate the position of the client rectangle.
|
|---|
| 4156 | * Otherwise, we'll see a lot of redraw when we move the
|
|---|
| 4157 | * client during WM_FORMATFRAME.
|
|---|
| 4158 | */
|
|---|
| 4159 |
|
|---|
| 4160 | if (mr && mp2) {
|
|---|
| 4161 | prectl = (PRECTL) mp1;
|
|---|
| 4162 | if (prectl->yBottom != prectl->yTop) {
|
|---|
| 4163 | {
|
|---|
| 4164 | HPS hps;
|
|---|
| 4165 | POINTL aptl[TXTBOX_COUNT];
|
|---|
| 4166 |
|
|---|
| 4167 | hps = WinGetPS(hwndStatus);
|
|---|
| 4168 | if (hps) {
|
|---|
| 4169 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
|---|
| 4170 | bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
|---|
| 4171 | WinReleasePS(hps);
|
|---|
| 4172 | }
|
|---|
| 4173 | }
|
|---|
| 4174 | prectl->yBottom += (sheight + 4);
|
|---|
| 4175 | prectl->yTop -= (sheight + 4);
|
|---|
| 4176 | if (fMoreButtons) {
|
|---|
| 4177 |
|
|---|
| 4178 | HPS hps;
|
|---|
| 4179 | POINTL aptl[TXTBOX_COUNT];
|
|---|
| 4180 |
|
|---|
| 4181 | hps = WinGetPS(hwndName);
|
|---|
| 4182 | if (hps) {
|
|---|
| 4183 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
|---|
| 4184 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
|---|
| 4185 | WinReleasePS(hps);
|
|---|
| 4186 | }
|
|---|
| 4187 | prectl->yBottom += (bheight + 4);
|
|---|
| 4188 | prectl->yTop -= (bheight + 4);
|
|---|
| 4189 | }
|
|---|
| 4190 | if (fToolbar) {
|
|---|
| 4191 | if (!fTextTools)
|
|---|
| 4192 | prectl->yTop -= ((fToolTitles) ? 50 : 40);
|
|---|
| 4193 | else
|
|---|
| 4194 | prectl->yTop -= 32;
|
|---|
| 4195 | }
|
|---|
| 4196 | if (fDrivebar) {
|
|---|
| 4197 | ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES),
|
|---|
| 4198 | ((prectl->xRight -
|
|---|
| 4199 | (WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 4200 | SV_CYSIZEBORDER) * 2)) - 4));
|
|---|
| 4201 | prectl->yTop -= (16 * (DriveLines * 18));
|
|---|
| 4202 | }
|
|---|
| 4203 | if (fUserComboBox) {
|
|---|
| 4204 | if (!aheight) {
|
|---|
| 4205 |
|
|---|
| 4206 | SWP swpTemp;
|
|---|
| 4207 |
|
|---|
| 4208 | WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
|---|
| 4209 | &swpTemp);
|
|---|
| 4210 | aheight = swpTemp.cy;
|
|---|
| 4211 | }
|
|---|
| 4212 | prectl->yTop -= (aheight + 6L);
|
|---|
| 4213 | }
|
|---|
| 4214 | if (fAutoView) {
|
|---|
| 4215 | AutoviewHeight = min(AutoviewHeight,
|
|---|
| 4216 | (prectl->yTop - prectl->yBottom) - 116);
|
|---|
| 4217 | AutoviewHeight = max(AutoviewHeight, 36);
|
|---|
| 4218 | prectl->yBottom += (AutoviewHeight + 6);
|
|---|
| 4219 | }
|
|---|
| 4220 | }
|
|---|
| 4221 | }
|
|---|
| 4222 | return mr;
|
|---|
| 4223 | }
|
|---|
| 4224 |
|
|---|
| 4225 | case WM_FORMATFRAME:
|
|---|
| 4226 | {
|
|---|
| 4227 | SHORT sCount, soldCount;
|
|---|
| 4228 | PSWP pswp, pswpClient, pswpNew;
|
|---|
| 4229 | SWP swpClient;
|
|---|
| 4230 | LONG theight = 48L, dheight = 20L, width, sheight = 20, bheight = 20;
|
|---|
| 4231 |
|
|---|
| 4232 | sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
|
|---|
| 4233 | soldCount = sCount;
|
|---|
| 4234 |
|
|---|
| 4235 | /*
|
|---|
| 4236 | * Reformat the frame to "squeeze" the client
|
|---|
| 4237 | * and make room for status window sibling beneath
|
|---|
| 4238 | * and toolbar above (if toolbar's on) and userlists
|
|---|
| 4239 | * (if userlists are on).
|
|---|
| 4240 | */
|
|---|
| 4241 |
|
|---|
| 4242 | pswp = (PSWP) mp1;
|
|---|
| 4243 | {
|
|---|
| 4244 | SHORT x;
|
|---|
| 4245 |
|
|---|
| 4246 | for (x = 0; x < soldCount; x++) {
|
|---|
| 4247 | if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {
|
|---|
| 4248 | pswpClient = pswp;
|
|---|
| 4249 | break;
|
|---|
| 4250 | }
|
|---|
| 4251 | pswp++;
|
|---|
| 4252 | }
|
|---|
| 4253 | }
|
|---|
| 4254 |
|
|---|
| 4255 | {
|
|---|
| 4256 | HPS hps;
|
|---|
| 4257 | POINTL aptl[TXTBOX_COUNT];
|
|---|
| 4258 |
|
|---|
| 4259 | hps = WinGetPS(hwndStatus);
|
|---|
| 4260 | if (hps) {
|
|---|
| 4261 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
|---|
| 4262 | bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
|---|
| 4263 | WinReleasePS(hps);
|
|---|
| 4264 | }
|
|---|
| 4265 | if (fMoreButtons) {
|
|---|
| 4266 | hps = WinGetPS(hwndName);
|
|---|
| 4267 | if (hps) {
|
|---|
| 4268 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
|---|
| 4269 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
|---|
| 4270 | WinReleasePS(hps);
|
|---|
| 4271 | }
|
|---|
| 4272 | }
|
|---|
| 4273 | }
|
|---|
| 4274 | pswpNew = (PSWP) mp1 + soldCount;
|
|---|
| 4275 | *pswpNew = *pswpClient;
|
|---|
| 4276 | swpClient = *pswpClient;
|
|---|
| 4277 | pswpNew->hwnd = hwndStatus;
|
|---|
| 4278 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
|---|
| 4279 | pswpNew->x = swpClient.x + 3;
|
|---|
| 4280 | pswpNew->y = swpClient.y + 2;
|
|---|
| 4281 | if (!fSplitStatus)
|
|---|
| 4282 | width = swpClient.cx - (16 + (sheight * 2) + 4);
|
|---|
| 4283 | else
|
|---|
| 4284 | width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2;
|
|---|
| 4285 | width = max(width, 10);
|
|---|
| 4286 | if (fSplitStatus)
|
|---|
| 4287 | pswpNew->cx = width - 6;
|
|---|
| 4288 | else
|
|---|
| 4289 | pswpNew->cx = width - 8;
|
|---|
| 4290 | pswpNew->cy = sheight;
|
|---|
| 4291 | pswpClient->y = pswpNew->y + pswpNew->cy + 3;
|
|---|
| 4292 | pswpClient->cy = (swpClient.cy - pswpNew->cy) - 3;
|
|---|
| 4293 | sCount++;
|
|---|
| 4294 |
|
|---|
| 4295 | if (fSplitStatus) {
|
|---|
| 4296 | pswpNew = (PSWP) mp1 + (soldCount + 1);
|
|---|
| 4297 | *pswpNew = *pswpClient;
|
|---|
| 4298 | pswpNew->hwnd = hwndStatus2;
|
|---|
| 4299 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
|---|
| 4300 | pswpNew->x = width + 8;
|
|---|
| 4301 | pswpNew->y = swpClient.y + 2;
|
|---|
| 4302 | pswpNew->cx = width - 6;
|
|---|
| 4303 | pswpNew->cy = sheight;
|
|---|
| 4304 | sCount++;
|
|---|
| 4305 | }
|
|---|
| 4306 | else {
|
|---|
| 4307 | WinShowWindow(hwndStatus2, FALSE);
|
|---|
| 4308 | WinSetWindowText(hwndStatus2, NullStr);
|
|---|
| 4309 | }
|
|---|
| 4310 |
|
|---|
| 4311 | if (fToolbar) {
|
|---|
| 4312 | if (fTextTools)
|
|---|
| 4313 | theight = 32L;
|
|---|
| 4314 | else if (!fToolTitles)
|
|---|
| 4315 | theight = 40L;
|
|---|
| 4316 | pswpNew = (PSWP) mp1 + (soldCount + 1 + (fSplitStatus != FALSE));
|
|---|
| 4317 | *pswpNew = *pswpClient;
|
|---|
| 4318 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS);
|
|---|
| 4319 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
|---|
| 4320 | pswpNew->x = swpClient.x + 2;
|
|---|
| 4321 | pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2);
|
|---|
| 4322 | pswpNew->cx = swpClient.cx - 4;
|
|---|
| 4323 | pswpNew->cy = theight - 4;
|
|---|
| 4324 | pswpClient->cy -= theight;
|
|---|
| 4325 | sCount++;
|
|---|
| 4326 | }
|
|---|
| 4327 | else
|
|---|
| 4328 | WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE);
|
|---|
| 4329 |
|
|---|
| 4330 | if (fDrivebar) {
|
|---|
| 4331 | ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4);
|
|---|
| 4332 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
|---|
| 4333 | (fSplitStatus != FALSE) +
|
|---|
| 4334 | (fToolbar != FALSE));
|
|---|
| 4335 | *pswpNew = *pswpClient;
|
|---|
| 4336 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES);
|
|---|
| 4337 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
|---|
| 4338 | pswpNew->x = swpClient.x + 2;
|
|---|
| 4339 | dheight += ((dheight - 2) * DriveLines);
|
|---|
| 4340 | pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);
|
|---|
| 4341 | if (fToolbar)
|
|---|
| 4342 | pswpNew->y -= theight;
|
|---|
| 4343 | pswpNew->cx = swpClient.cx - 4;
|
|---|
| 4344 | pswpNew->cy = dheight - 4;
|
|---|
| 4345 | pswpClient->cy -= dheight;
|
|---|
| 4346 | sCount++;
|
|---|
| 4347 | }
|
|---|
| 4348 | else
|
|---|
| 4349 | WinShowWindow(WinWindowFromID(hwnd, MAIN_DRIVES), FALSE);
|
|---|
| 4350 |
|
|---|
| 4351 | if (fAutoView) {
|
|---|
| 4352 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
|---|
| 4353 | (fToolbar != FALSE) +
|
|---|
| 4354 | (fDrivebar != FALSE) +
|
|---|
| 4355 | (fSplitStatus != FALSE));
|
|---|
| 4356 | *pswpNew = *pswpClient;
|
|---|
| 4357 | pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview;
|
|---|
| 4358 | pswpNew->x = pswpClient->x + 3;
|
|---|
| 4359 | pswpNew->y = pswpClient->y + 3;
|
|---|
| 4360 | if (fMoreButtons)
|
|---|
| 4361 | pswpNew->y += (bheight + 4);
|
|---|
| 4362 | pswpNew->cx = pswpClient->cx - 6;
|
|---|
| 4363 | AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116);
|
|---|
| 4364 | AutoviewHeight = max(AutoviewHeight, 36);
|
|---|
| 4365 | pswpNew->cy = AutoviewHeight;
|
|---|
| 4366 | pswpClient->y += (AutoviewHeight + 6);
|
|---|
| 4367 | pswpClient->cy -= (AutoviewHeight + 6);
|
|---|
| 4368 | sCount++;
|
|---|
| 4369 | WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE);
|
|---|
| 4370 | }
|
|---|
| 4371 | else {
|
|---|
| 4372 | WinShowWindow(hwndAutoview, FALSE);
|
|---|
| 4373 | WinShowWindow(hwndAutoMLE, FALSE);
|
|---|
| 4374 | }
|
|---|
| 4375 |
|
|---|
| 4376 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
|---|
| 4377 | (fToolbar != FALSE) +
|
|---|
| 4378 | (fDrivebar != FALSE) +
|
|---|
| 4379 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
|---|
| 4380 | *pswpNew = *pswpClient;
|
|---|
| 4381 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_OPENWALK);
|
|---|
| 4382 | pswpNew->x = swpClient.cx - ((sheight * 2) + 4);
|
|---|
| 4383 | pswpNew->y = swpClient.y;
|
|---|
| 4384 | pswpNew->cx = sheight + 4;
|
|---|
| 4385 | pswpNew->cy = sheight + 4;
|
|---|
| 4386 | sCount++;
|
|---|
| 4387 | pswpNew = (PSWP) mp1 + (soldCount + 2 +
|
|---|
| 4388 | (fToolbar != FALSE) +
|
|---|
| 4389 | (fDrivebar != FALSE) +
|
|---|
| 4390 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
|---|
| 4391 | *pswpNew = *pswpClient;
|
|---|
| 4392 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_USERLIST);
|
|---|
| 4393 | pswpNew->x = swpClient.cx - (sheight + 2);
|
|---|
| 4394 | pswpNew->y = swpClient.y;
|
|---|
| 4395 | pswpNew->cx = sheight + 4;
|
|---|
| 4396 | pswpNew->cy = sheight + 4;
|
|---|
| 4397 | sCount++;
|
|---|
| 4398 | pswpNew = (PSWP) mp1 + (soldCount + 3 +
|
|---|
| 4399 | (fToolbar != FALSE) +
|
|---|
| 4400 | (fDrivebar != FALSE) +
|
|---|
| 4401 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
|---|
| 4402 | *pswpNew = *pswpClient;
|
|---|
| 4403 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LED);
|
|---|
| 4404 | pswpNew->x = swpClient.cx - ((sheight * 2) + 16);
|
|---|
| 4405 | pswpNew->y = swpClient.y;
|
|---|
| 4406 | pswpNew->cx = 12;
|
|---|
| 4407 | pswpNew->cy = 12;
|
|---|
| 4408 | sCount++;
|
|---|
| 4409 | pswpNew = (PSWP) mp1 + (soldCount + 4 +
|
|---|
| 4410 | (fToolbar != FALSE) +
|
|---|
| 4411 | (fDrivebar != FALSE) +
|
|---|
| 4412 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
|---|
| 4413 | *pswpNew = *pswpClient;
|
|---|
| 4414 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LEDHDR);
|
|---|
| 4415 | pswpNew->x = swpClient.cx - ((sheight * 2) + 16);
|
|---|
| 4416 | pswpNew->y = swpClient.y + 12;
|
|---|
| 4417 | pswpNew->cx = 12;
|
|---|
| 4418 | pswpNew->cy = sheight - 8;
|
|---|
| 4419 | sCount++;
|
|---|
| 4420 | if (fUserComboBox) {
|
|---|
| 4421 | if (!aheight) {
|
|---|
| 4422 |
|
|---|
| 4423 | SWP swpTemp;
|
|---|
| 4424 |
|
|---|
| 4425 | WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
|---|
| 4426 | &swpTemp);
|
|---|
| 4427 | aheight = swpTemp.cy;
|
|---|
| 4428 | }
|
|---|
| 4429 | pswpNew = (PSWP) mp1 + (soldCount + 5 +
|
|---|
| 4430 | (fToolbar != FALSE) +
|
|---|
| 4431 | (fSplitStatus != FALSE) +
|
|---|
| 4432 | (fDrivebar != FALSE) + (fAutoView != FALSE));
|
|---|
| 4433 | *pswpNew = *pswpClient;
|
|---|
| 4434 | pswpNew->hwnd = hwndDrivelist;
|
|---|
| 4435 | pswpNew->x = swpClient.x;
|
|---|
| 4436 | pswpNew->cx = 48;
|
|---|
| 4437 | pswpClient->cy -= (aheight + 6L);
|
|---|
| 4438 | pswpNew->y = pswpClient->y;
|
|---|
| 4439 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
|---|
| 4440 | sCount++;
|
|---|
| 4441 | pswpNew = (PSWP) mp1 + (soldCount + 6 +
|
|---|
| 4442 | (fToolbar != FALSE) +
|
|---|
| 4443 | (fDrivebar != FALSE) +
|
|---|
| 4444 | (fSplitStatus != FALSE) +
|
|---|
| 4445 | (fAutoView != FALSE));
|
|---|
| 4446 | *pswpNew = *pswpClient;
|
|---|
| 4447 | pswpNew->hwnd = hwndStatelist;
|
|---|
| 4448 | pswpNew->x = swpClient.x + 48;
|
|---|
| 4449 | pswpNew->cx = (swpClient.cx - 48) / 7;
|
|---|
| 4450 | pswpNew->y = pswpClient->y;
|
|---|
| 4451 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
|---|
| 4452 | sCount++;
|
|---|
| 4453 | pswpNew = (PSWP) mp1 + (soldCount + 7 +
|
|---|
| 4454 | (fToolbar != FALSE) +
|
|---|
| 4455 | (fDrivebar != FALSE) +
|
|---|
| 4456 | (fSplitStatus != FALSE) +
|
|---|
| 4457 | (fAutoView != FALSE));
|
|---|
| 4458 | *pswpNew = *pswpClient;
|
|---|
| 4459 | pswpNew->hwnd = hwndCmdlist;
|
|---|
| 4460 | pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7);
|
|---|
| 4461 | pswpNew->cx = (swpClient.cx - 48) / 5 +
|
|---|
| 4462 | ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7);
|
|---|
| 4463 | pswpNew->y = pswpClient->y;
|
|---|
| 4464 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
|---|
| 4465 | sCount++;
|
|---|
| 4466 | pswpNew = (PSWP) mp1 + (soldCount + 8 +
|
|---|
| 4467 | (fToolbar != FALSE) +
|
|---|
| 4468 | (fDrivebar != FALSE) +
|
|---|
| 4469 | (fSplitStatus != FALSE) +
|
|---|
| 4470 | (fAutoView != FALSE));
|
|---|
| 4471 | *pswpNew = *pswpClient;
|
|---|
| 4472 | pswpNew->hwnd = hwndUserlist;
|
|---|
| 4473 | pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2);
|
|---|
| 4474 | pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) -
|
|---|
| 4475 | ((fToolbar) ? ((swpClient.cx - 48) / 7) : 0);
|
|---|
| 4476 | pswpNew->y = pswpClient->y;
|
|---|
| 4477 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
|---|
| 4478 | sCount++;
|
|---|
| 4479 | if (fToolbar) {
|
|---|
| 4480 | pswpNew = (PSWP) mp1 + (soldCount + 9 +
|
|---|
| 4481 | (fToolbar != FALSE) +
|
|---|
| 4482 | (fDrivebar != FALSE) +
|
|---|
| 4483 | (fSplitStatus != FALSE) +
|
|---|
| 4484 | (fAutoView != FALSE));
|
|---|
| 4485 | *pswpNew = *pswpClient;
|
|---|
| 4486 | pswpNew->hwnd = hwndButtonlist;
|
|---|
| 4487 | pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4;
|
|---|
| 4488 | pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x;
|
|---|
| 4489 | pswpNew->y = pswpClient->y;
|
|---|
| 4490 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
|---|
| 4491 | sCount++;
|
|---|
| 4492 | }
|
|---|
| 4493 | else
|
|---|
| 4494 | WinShowWindow(hwndButtonlist, FALSE);
|
|---|
| 4495 | }
|
|---|
| 4496 | else {
|
|---|
| 4497 | WinShowWindow(hwndUserlist, FALSE);
|
|---|
| 4498 | WinShowWindow(hwndDrivelist, FALSE);
|
|---|
| 4499 | WinShowWindow(hwndStatelist, FALSE);
|
|---|
| 4500 | WinShowWindow(hwndButtonlist, FALSE);
|
|---|
| 4501 | WinShowWindow(hwndCmdlist, FALSE);
|
|---|
| 4502 | }
|
|---|
| 4503 | {
|
|---|
| 4504 | PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0;
|
|---|
| 4505 | SHORT x;
|
|---|
| 4506 |
|
|---|
| 4507 | pswpNew = (PSWP) mp1 + (soldCount + 5 +
|
|---|
| 4508 | (fToolbar != FALSE) +
|
|---|
| 4509 | (fDrivebar != FALSE) +
|
|---|
| 4510 | (fSplitStatus != FALSE) +
|
|---|
| 4511 | (fAutoView != FALSE) +
|
|---|
| 4512 | ((fUserComboBox != FALSE) * 4) +
|
|---|
| 4513 | (fUserComboBox != FALSE &&
|
|---|
| 4514 | fToolbar != FALSE));
|
|---|
| 4515 | pswp = (PSWP) mp1;
|
|---|
| 4516 | for (x = 0; x < soldCount; x++) {
|
|---|
| 4517 | if (!pswpTitlebar &&
|
|---|
| 4518 | WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR)
|
|---|
| 4519 | pswpTitlebar = pswp;
|
|---|
| 4520 | else if (!pswpMinbutton &&
|
|---|
| 4521 | WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX)
|
|---|
| 4522 | pswpMinbutton = pswp;
|
|---|
| 4523 | if (pswpTitlebar && pswpMinbutton)
|
|---|
| 4524 | break;
|
|---|
| 4525 | pswp++;
|
|---|
| 4526 | }
|
|---|
| 4527 | if (pswpMinbutton && pswpTitlebar) {
|
|---|
| 4528 | *pswpNew = *pswpMinbutton;
|
|---|
| 4529 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_IDEALSIZE);
|
|---|
| 4530 | pswpNew->cy = pswpMinbutton->cy + 3;
|
|---|
| 4531 | pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3);
|
|---|
| 4532 | pswpTitlebar->cx -= (pswpNew->cx - 1);
|
|---|
| 4533 | pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx);
|
|---|
| 4534 | pswpNew->y = pswpMinbutton->y - 1;
|
|---|
| 4535 | sCount++;
|
|---|
| 4536 | }
|
|---|
| 4537 | else
|
|---|
| 4538 | WinShowWindow(WinWindowFromID(hwnd, IDM_IDEALSIZE), FALSE);
|
|---|
| 4539 | }
|
|---|
| 4540 |
|
|---|
| 4541 | if (fMoreButtons) {
|
|---|
| 4542 |
|
|---|
| 4543 | LONG lastx;
|
|---|
| 4544 |
|
|---|
| 4545 | pswpNew = (PSWP) mp1 + (soldCount + 6 +
|
|---|
| 4546 | (fToolbar != FALSE) +
|
|---|
| 4547 | (fDrivebar != FALSE) +
|
|---|
| 4548 | (fSplitStatus != FALSE) +
|
|---|
| 4549 | (fAutoView != FALSE) +
|
|---|
| 4550 | ((fUserComboBox != FALSE) * 4) +
|
|---|
| 4551 | (fUserComboBox != FALSE &&
|
|---|
| 4552 | fToolbar != FALSE));
|
|---|
| 4553 | *pswpNew = *pswpClient;
|
|---|
| 4554 | pswpNew->hwnd = hwndName;
|
|---|
| 4555 | pswpNew->x = swpClient.x + 3;
|
|---|
| 4556 | pswpNew->y = swpClient.y + (sheight + 6);
|
|---|
| 4557 | pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3;
|
|---|
| 4558 | lastx = pswpNew->x + pswpNew->cx;
|
|---|
| 4559 | pswpNew->cy = bheight;
|
|---|
| 4560 | pswpClient->y += (bheight + 4);
|
|---|
| 4561 | pswpClient->cy -= (bheight + 4);
|
|---|
| 4562 | sCount++;
|
|---|
| 4563 | pswpNew = (PSWP) mp1 + (soldCount + 7 +
|
|---|
| 4564 | (fToolbar != FALSE) +
|
|---|
| 4565 | (fDrivebar != FALSE) +
|
|---|
| 4566 | (fSplitStatus != FALSE) +
|
|---|
| 4567 | (fAutoView != FALSE) +
|
|---|
| 4568 | ((fUserComboBox != FALSE) * 4) +
|
|---|
| 4569 | (fUserComboBox != FALSE &&
|
|---|
| 4570 | fToolbar != FALSE));
|
|---|
| 4571 | *pswpNew = *pswpClient;
|
|---|
| 4572 | pswpNew->hwnd = hwndDate;
|
|---|
| 4573 | pswpNew->x = lastx + 3;
|
|---|
| 4574 | pswpNew->y = swpClient.y + (sheight + 6);
|
|---|
| 4575 | pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3;
|
|---|
| 4576 | lastx = pswpNew->x + pswpNew->cx;
|
|---|
| 4577 | pswpNew->cy = bheight;
|
|---|
| 4578 | sCount++;
|
|---|
| 4579 | pswpNew = (PSWP) mp1 + (soldCount + 8 +
|
|---|
| 4580 | (fToolbar != FALSE) +
|
|---|
| 4581 | (fDrivebar != FALSE) +
|
|---|
| 4582 | (fSplitStatus != FALSE) +
|
|---|
| 4583 | (fAutoView != FALSE) +
|
|---|
| 4584 | ((fUserComboBox != FALSE) * 4) +
|
|---|
| 4585 | (fUserComboBox != FALSE &&
|
|---|
| 4586 | fToolbar != FALSE));
|
|---|
| 4587 | *pswpNew = *pswpClient;
|
|---|
| 4588 | pswpNew->hwnd = hwndAttr;
|
|---|
| 4589 | pswpNew->x = lastx + 3;
|
|---|
| 4590 | pswpNew->y = swpClient.y + (sheight + 6);
|
|---|
| 4591 | pswpNew->cx = (swpClient.cx - pswpNew->x) - 1;
|
|---|
| 4592 | pswpNew->cy = bheight;
|
|---|
| 4593 | sCount++;
|
|---|
| 4594 | }
|
|---|
| 4595 | else {
|
|---|
| 4596 | WinShowWindow(hwndAttr, FALSE);
|
|---|
| 4597 | WinShowWindow(hwndName, FALSE);
|
|---|
| 4598 | WinShowWindow(hwndDate, FALSE);
|
|---|
| 4599 | }
|
|---|
| 4600 | return MRFROMSHORT(sCount);
|
|---|
| 4601 | }
|
|---|
| 4602 |
|
|---|
| 4603 | case WM_QUERYFRAMECTLCOUNT:
|
|---|
| 4604 | {
|
|---|
| 4605 | SHORT sCount;
|
|---|
| 4606 |
|
|---|
| 4607 | sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
|
|---|
| 4608 |
|
|---|
| 4609 | sCount += 6;
|
|---|
| 4610 | if (fSplitStatus)
|
|---|
| 4611 | sCount++;
|
|---|
| 4612 | if (fToolbar)
|
|---|
| 4613 | sCount++;
|
|---|
| 4614 | if (fUserComboBox) {
|
|---|
| 4615 | sCount += 4;
|
|---|
| 4616 | if (fToolbar)
|
|---|
| 4617 | sCount++;
|
|---|
| 4618 | }
|
|---|
| 4619 | if (fDrivebar)
|
|---|
| 4620 | sCount++;
|
|---|
| 4621 | if (fAutoView)
|
|---|
| 4622 | sCount++;
|
|---|
| 4623 | if (fMoreButtons)
|
|---|
| 4624 | sCount += 3;
|
|---|
| 4625 | return MRFROMSHORT(sCount);
|
|---|
| 4626 | }
|
|---|
| 4627 |
|
|---|
| 4628 | case WM_CLOSE:
|
|---|
| 4629 | WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
|
|---|
| 4630 | return 0;
|
|---|
| 4631 | }
|
|---|
| 4632 | return oldproc(hwnd, msg, mp1, mp2);
|
|---|
| 4633 | }
|
|---|
| 4634 |
|
|---|
| 4635 | MRESULT EXPENTRY MainWMCommand(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 4636 | {
|
|---|
| 4637 | SetShiftState();
|
|---|
| 4638 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| 4639 |
|
|---|
| 4640 | case IDM_CONTEXTMENU:
|
|---|
| 4641 | {
|
|---|
| 4642 | HWND hwnd = WinQueryFocus(HWND_DESKTOP);
|
|---|
| 4643 | // DbgMsg(pszSrcFile, __LINE__, "IDM_CONTEXTMENU %x", hwnd);
|
|---|
| 4644 | if (hwnd != NULLHANDLE) {
|
|---|
| 4645 | HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT);
|
|---|
| 4646 | USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID);
|
|---|
| 4647 | switch (id) {
|
|---|
| 4648 | case MAIN_SETUPLIST:
|
|---|
| 4649 | case MAIN_USERLIST:
|
|---|
| 4650 | case MAIN_CMDLIST:
|
|---|
| 4651 | // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU");
|
|---|
| 4652 | WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0);
|
|---|
| 4653 | }
|
|---|
| 4654 | }
|
|---|
| 4655 | }
|
|---|
| 4656 | break;
|
|---|
| 4657 |
|
|---|
| 4658 | case IDM_SETTARGET:
|
|---|
| 4659 | SetTargetDir(hwnd, FALSE);
|
|---|
| 4660 | break;
|
|---|
| 4661 |
|
|---|
| 4662 | case IDM_TOAUTOMLE:
|
|---|
| 4663 | if (fComments && fAutoView)
|
|---|
| 4664 | WinSetFocus(HWND_DESKTOP, hwndAutoMLE);
|
|---|
| 4665 | break;
|
|---|
| 4666 |
|
|---|
| 4667 | case IDM_HIDENOTEWND:
|
|---|
| 4668 | HideNote();
|
|---|
| 4669 | break;
|
|---|
| 4670 | case IDM_SHOWNOTEWND:
|
|---|
| 4671 | ShowNote();
|
|---|
| 4672 | break;
|
|---|
| 4673 |
|
|---|
| 4674 | case IDM_COMPARE:
|
|---|
| 4675 | {
|
|---|
| 4676 | WALK2 wa;
|
|---|
| 4677 | PCNRITEM pci;
|
|---|
| 4678 |
|
|---|
| 4679 | memset(&wa, 0, sizeof(wa));
|
|---|
| 4680 | wa.size = sizeof(wa);
|
|---|
| 4681 | pci =
|
|---|
| 4682 | (PCNRITEM)
|
|---|
| 4683 | WinSendMsg(WinWindowFromID
|
|---|
| 4684 | (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
|
|---|
| 4685 | CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
|
|---|
| 4686 | MPFROMSHORT(CRA_CURSORED));
|
|---|
| 4687 | if (pci && (INT) pci != -1) {
|
|---|
| 4688 | strcpy(wa.szCurrentPath1, pci->pszFileName);
|
|---|
| 4689 | MakeValidDir(wa.szCurrentPath1);
|
|---|
| 4690 | }
|
|---|
| 4691 | else
|
|---|
| 4692 | strcpy(wa.szCurrentPath1, pFM2SaveDirectory);
|
|---|
| 4693 | TopWindowName(hwndMain, (HWND) 0, wa.szCurrentPath2);
|
|---|
| 4694 | if (!*wa.szCurrentPath2)
|
|---|
| 4695 | strcpy(wa.szCurrentPath2, wa.szCurrentPath1);
|
|---|
| 4696 | MakeValidDir(wa.szCurrentPath2);
|
|---|
| 4697 | if (WinDlgBox(HWND_DESKTOP,
|
|---|
| 4698 | hwnd,
|
|---|
| 4699 | WalkTwoCmpDlgProc,
|
|---|
| 4700 | FM3ModHandle,
|
|---|
| 4701 | WALK2_FRAME,
|
|---|
| 4702 | MPFROMP(&wa)) &&
|
|---|
| 4703 | !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) {
|
|---|
| 4704 | if (!*dircompare) {
|
|---|
| 4705 |
|
|---|
| 4706 | COMPARE *cmp;
|
|---|
| 4707 |
|
|---|
| 4708 | cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
|
|---|
| 4709 | if (cmp) {
|
|---|
| 4710 | cmp->size = sizeof(COMPARE);
|
|---|
| 4711 | strcpy(cmp->leftdir, wa.szCurrentPath1);
|
|---|
| 4712 | strcpy(cmp->rightdir, wa.szCurrentPath2);
|
|---|
| 4713 | cmp->hwndParent = hwnd;
|
|---|
| 4714 | cmp->dcd.hwndParent = hwnd;
|
|---|
| 4715 | WinDlgBox(HWND_DESKTOP,
|
|---|
| 4716 | HWND_DESKTOP,
|
|---|
| 4717 | CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
|
|---|
| 4718 | }
|
|---|
| 4719 | }
|
|---|
| 4720 | else {
|
|---|
| 4721 |
|
|---|
| 4722 | CHAR szPath1[CCHMAXPATH];
|
|---|
| 4723 | CHAR szPath2[CCHMAXPATH];
|
|---|
| 4724 | runemf2(SEPARATE,
|
|---|
| 4725 | HWND_DESKTOP, pszSrcFile, __LINE__,
|
|---|
| 4726 | NULL, NULL,
|
|---|
| 4727 | "%s %s %s",
|
|---|
| 4728 | dircompare,
|
|---|
| 4729 | BldQuotedFileName(szPath1, wa.szCurrentPath1),
|
|---|
| 4730 | BldQuotedFileName(szPath2, wa.szCurrentPath2));
|
|---|
| 4731 | }
|
|---|
| 4732 | }
|
|---|
| 4733 | }
|
|---|
| 4734 | break;
|
|---|
| 4735 |
|
|---|
| 4736 | case IDM_EXIT:
|
|---|
| 4737 | case IDM_KILLME:
|
|---|
| 4738 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
|---|
| 4739 | break;
|
|---|
| 4740 |
|
|---|
| 4741 | case IDM_CLI:
|
|---|
| 4742 | if (fSplitStatus &&
|
|---|
| 4743 | hwndStatus2 &&
|
|---|
| 4744 | !WinIsWindow(WinQueryAnchorBlock(hwnd),
|
|---|
| 4745 | WinWindowFromID(hwndStatus2, COMMAND_LINE)))
|
|---|
| 4746 | PostMsg(hwndStatus2, UM_CLICKED, MPVOID, MPVOID);
|
|---|
| 4747 | break;
|
|---|
| 4748 |
|
|---|
| 4749 | case IDM_ADDTOUSERLIST:
|
|---|
| 4750 | case IDM_DELETEFROMUSERLIST:
|
|---|
| 4751 | {
|
|---|
| 4752 | CHAR temp[CCHMAXPATH], path[CCHMAXPATH];
|
|---|
| 4753 |
|
|---|
| 4754 | *temp = 0;
|
|---|
| 4755 | WinQueryWindowText(hwndUserlist, CCHMAXPATH, temp);
|
|---|
| 4756 | bstrip(temp);
|
|---|
| 4757 | if (*temp &&
|
|---|
| 4758 | !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) {
|
|---|
| 4759 | if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) {
|
|---|
| 4760 | add_udir(TRUE, path);
|
|---|
| 4761 | if (fUdirsChanged)
|
|---|
| 4762 | save_udirs();
|
|---|
| 4763 | WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
|---|
| 4764 | }
|
|---|
| 4765 | else {
|
|---|
| 4766 | if (!remove_udir(path))
|
|---|
| 4767 | Runtime_Error(pszSrcFile, __LINE__, "remove_udir");
|
|---|
| 4768 | else {
|
|---|
| 4769 | if (fUdirsChanged)
|
|---|
| 4770 | save_udirs();
|
|---|
| 4771 | WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
|---|
| 4772 | }
|
|---|
| 4773 | }
|
|---|
| 4774 | }
|
|---|
| 4775 | }
|
|---|
| 4776 | break;
|
|---|
| 4777 |
|
|---|
| 4778 | case IDM_SAVEDIRCNRSTATE:
|
|---|
| 4779 | case IDM_DELETEDIRCNRSTATE:
|
|---|
| 4780 | {
|
|---|
| 4781 | CHAR szStateName[STATE_NAME_MAX_BYTES + 1];
|
|---|
| 4782 |
|
|---|
| 4783 | *szStateName = 0;
|
|---|
| 4784 | WinQueryWindowText(hwndStatelist, STATE_NAME_MAX_BYTES, szStateName);
|
|---|
| 4785 | bstrip(szStateName);
|
|---|
| 4786 | // Complain if attempting to use reserved name
|
|---|
| 4787 | if (stricmp(szStateName, GetPString(IDS_STATETEXT)) == 0 ||
|
|---|
| 4788 | stricmp(szStateName, GetPString(IDS_FM2TEMPTEXT)) == 0)
|
|---|
| 4789 | {
|
|---|
| 4790 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
|---|
| 4791 | GetPString(IDS_WARNINGTEXT),
|
|---|
| 4792 | "\"%s\" is a reserved state name", szStateName);
|
|---|
| 4793 | }
|
|---|
| 4794 | // Ignore request if blank
|
|---|
| 4795 | else if (*szStateName) {
|
|---|
| 4796 | BOOL fAbortOperation = FALSE;
|
|---|
| 4797 | if (!fNoSaveState && fSaveState && stricmp(szStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0)
|
|---|
| 4798 | {
|
|---|
| 4799 | if (saymsg(MB_YESNO | MB_DEFBUTTON2 | MB_ICONASTERISK, hwnd,
|
|---|
| 4800 | GetPString(IDS_WARNINGTEXT),
|
|---|
| 4801 | GetPString(IDS_SHUTDOWNSTATE_WARNING), szStateName) == MBID_NO)
|
|---|
| 4802 | fAbortOperation = TRUE;
|
|---|
| 4803 | }
|
|---|
| 4804 | if (!fAbortOperation) {
|
|---|
| 4805 | if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) {
|
|---|
| 4806 | // Save
|
|---|
| 4807 | INT nSaved = SaveDirCnrState(hwnd, szStateName);
|
|---|
| 4808 | if (nSaved >= 0) {
|
|---|
| 4809 | INT ret = add_setup(szStateName);
|
|---|
| 4810 | if (ret == 0) {
|
|---|
| 4811 | WinSendMsg(hwndStatelist, LM_INSERTITEM,
|
|---|
| 4812 | MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName));
|
|---|
| 4813 | save_setups();
|
|---|
| 4814 | }
|
|---|
| 4815 | else if (ret != 1) {
|
|---|
| 4816 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
|---|
| 4817 | GetPString(IDS_WARNINGTEXT),
|
|---|
| 4818 | "\"%s\" state name add failed", szStateName); // 15 Apr 07 SHL failed
|
|---|
| 4819 | WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
|
|---|
| 4820 | }
|
|---|
| 4821 | }
|
|---|
| 4822 | else {
|
|---|
| 4823 | saymsg(MB_ENTER | MB_ICONASTERISK,
|
|---|
| 4824 | hwnd,
|
|---|
| 4825 | GetPString(IDS_WARNINGTEXT),
|
|---|
| 4826 | "State data save failed");
|
|---|
| 4827 | WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
|
|---|
| 4828 | }
|
|---|
| 4829 | }
|
|---|
| 4830 | else {
|
|---|
| 4831 | // Delete
|
|---|
| 4832 | ULONG numsaves = 0, size, x;
|
|---|
| 4833 | CHAR s[STATE_NAME_MAX_BYTES + 80];
|
|---|
| 4834 |
|
|---|
| 4835 | INT ret = remove_setup(szStateName);
|
|---|
| 4836 | if (ret == 1)
|
|---|
| 4837 | save_setups();
|
|---|
| 4838 | sprintf(s, "%s.NumDirsLastTime", szStateName);
|
|---|
| 4839 | size = sizeof(ULONG);
|
|---|
| 4840 | if (!PrfQueryProfileData(fmprof,
|
|---|
| 4841 | FM3Str,
|
|---|
| 4842 | s,
|
|---|
| 4843 | (PVOID)&numsaves,
|
|---|
| 4844 | &size)) {
|
|---|
| 4845 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
|---|
| 4846 | GetPString(IDS_WARNINGTEXT),
|
|---|
| 4847 | GetPString(IDS_DOESNTEXISTTEXT), szStateName);
|
|---|
| 4848 | }
|
|---|
| 4849 | else if (!size)
|
|---|
| 4850 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
|---|
| 4851 | else {
|
|---|
| 4852 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L);
|
|---|
| 4853 | for (x = 0; x < numsaves; x++) {
|
|---|
| 4854 | sprintf(s, "%s.DirCnrPos.%lu", szStateName, x);
|
|---|
| 4855 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4856 | sprintf(s, "%s.DirCnrDir.%lu", szStateName, x);
|
|---|
| 4857 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4858 | sprintf(s, "%s.DirCnrSort.%lu", szStateName, x);
|
|---|
| 4859 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4860 | sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x);
|
|---|
| 4861 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4862 | sprintf(s, "%s.DirCnrView.%lu", szStateName, x);
|
|---|
| 4863 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4864 | sprintf(s, "%s.DirCnr.%lu.DetailsLongname", szStateName, x);
|
|---|
| 4865 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4866 | sprintf(s, "%s.DirCnr.%lu.DetailsSubject", szStateName, x);
|
|---|
| 4867 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4868 | sprintf(s, "%s.DirCnr.%lu.DetailsSize", szStateName, x);
|
|---|
| 4869 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4870 | sprintf(s, "%s.DirCnr.%lu.DetailsEA", szStateName, x);
|
|---|
| 4871 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4872 | sprintf(s, "%s.DirCnr.%lu.DetailsAttr", szStateName, x);
|
|---|
| 4873 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4874 | sprintf(s, "%s.DirCnr.%lu.DetailsIcon", szStateName, x);
|
|---|
| 4875 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4876 | sprintf(s, "%s.DirCnr.%lu.DetailsLWDate", szStateName, x);
|
|---|
| 4877 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4878 | sprintf(s, "%s.DirCnr.%lu.DetailsLWTime", szStateName, x);
|
|---|
| 4879 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4880 | sprintf(s, "%s.DirCnr.%lu.DetailsLADate", szStateName, x);
|
|---|
| 4881 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4882 | sprintf(s, "%s.DirCnr.%lu.DetailsLATime", szStateName, x);
|
|---|
| 4883 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4884 | sprintf(s, "%s.DirCnr.%lu.DetailsCRDate", szStateName, x);
|
|---|
| 4885 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4886 | sprintf(s, "%s.DirCnr.%lu.DetailsCRTime", szStateName, x);
|
|---|
| 4887 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4888 | sprintf(s, "%s.DirCnr.%lu.Backgroundcolor", szStateName, x);
|
|---|
| 4889 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4890 | sprintf(s, "%s.DirCnr.%lu.Fontnamesize", szStateName, x);
|
|---|
| 4891 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4892 | }
|
|---|
| 4893 | sprintf(s, "%s.LastTreePos", szStateName);
|
|---|
| 4894 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4895 | sprintf(s, "%s.MySizeLastTime", szStateName);
|
|---|
| 4896 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
|---|
| 4897 | }
|
|---|
| 4898 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
|---|
| 4899 | }
|
|---|
| 4900 | }
|
|---|
| 4901 | }
|
|---|
| 4902 | }
|
|---|
| 4903 | break;
|
|---|
| 4904 |
|
|---|
| 4905 | case IDM_IDEALSIZE:
|
|---|
| 4906 | {
|
|---|
| 4907 | SWP swp, swpD;
|
|---|
| 4908 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L;
|
|---|
| 4909 | ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
|
|---|
| 4910 |
|
|---|
| 4911 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
|---|
| 4912 | if (swp.fl & SWP_MAXIMIZE) {
|
|---|
| 4913 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_SYSCOMMAND,
|
|---|
| 4914 | MPFROM2SHORT(SC_RESTORE, 0), MPVOID);
|
|---|
| 4915 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
|---|
| 4916 | }
|
|---|
| 4917 | WinGetMaxPosition(WinQueryWindow(hwnd, QW_PARENT), &swpD);
|
|---|
| 4918 | swpD.x += bsz;
|
|---|
| 4919 | swpD.cx -= (bsz * 2);
|
|---|
| 4920 | swpD.y += icz;
|
|---|
| 4921 | swpD.cy -= (icz + bsz);
|
|---|
| 4922 | if (swp.x == swpD.x && swp.y == swpD.y &&
|
|---|
| 4923 | swp.cx == swpD.cx && swp.cy == swpD.cy &&
|
|---|
| 4924 | // fixme to be #defined someday
|
|---|
| 4925 | WinQueryWindowUShort(hwnd, QWL_USER + 10) &&
|
|---|
| 4926 | WinQueryWindowUShort(hwnd, QWL_USER + 14)) {
|
|---|
| 4927 | swpD.x = WinQueryWindowUShort(hwnd, QWL_USER + 8);
|
|---|
| 4928 | swpD.cx = WinQueryWindowUShort(hwnd, QWL_USER + 10);
|
|---|
| 4929 | swpD.y = WinQueryWindowUShort(hwnd, QWL_USER + 12);
|
|---|
| 4930 | swpD.cy = WinQueryWindowUShort(hwnd, QWL_USER + 14);
|
|---|
| 4931 | }
|
|---|
| 4932 | else {
|
|---|
| 4933 | WinSetWindowUShort(hwnd, QWL_USER + 8, (USHORT) swp.x);
|
|---|
| 4934 | WinSetWindowUShort(hwnd, QWL_USER + 10, (USHORT) swp.cx);
|
|---|
| 4935 | WinSetWindowUShort(hwnd, QWL_USER + 12, (USHORT) swp.y);
|
|---|
| 4936 | WinSetWindowUShort(hwnd, QWL_USER + 14, (USHORT) swp.cy);
|
|---|
| 4937 | }
|
|---|
| 4938 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP,
|
|---|
| 4939 | swpD.x, swpD.y, swpD.cx, swpD.cy, SWP_MOVE | SWP_SIZE);
|
|---|
| 4940 | }
|
|---|
| 4941 | break;
|
|---|
| 4942 |
|
|---|
| 4943 | case IDM_BLINK:
|
|---|
| 4944 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
|
|---|
| 4945 | SWP_MINIMIZE);
|
|---|
| 4946 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
|
|---|
| 4947 | SWP_RESTORE | SWP_ZORDER);
|
|---|
| 4948 | break;
|
|---|
| 4949 |
|
|---|
| 4950 | case DID_CANCEL:
|
|---|
| 4951 | {
|
|---|
| 4952 | HWND hwndTop = TopWindow(hwndMain, (HWND) 0);
|
|---|
| 4953 |
|
|---|
| 4954 | if (hwndTop)
|
|---|
| 4955 | WinSetFocus(HWND_DESKTOP, hwndTop);
|
|---|
| 4956 | }
|
|---|
| 4957 | break;
|
|---|
| 4958 |
|
|---|
| 4959 | case IDM_NOTEBOOK:
|
|---|
| 4960 | case IDM_DIRCNRSETTINGS:
|
|---|
| 4961 | case IDM_DIRVIEWSETTINGS:
|
|---|
| 4962 | case IDM_DIRSORTSETTINGS:
|
|---|
| 4963 | case IDM_COLLECTORVIEWSETTINGS:
|
|---|
| 4964 | case IDM_COLLECTORSORTSETTINGS:
|
|---|
| 4965 | case IDM_ARCHIVERSETTINGS:
|
|---|
| 4966 | case IDM_TREECNRVIEWSETTINGS:
|
|---|
| 4967 | case IDM_TREECNRSORTSETTINGS:
|
|---|
| 4968 | case IDM_VIEWERSETTINGS:
|
|---|
| 4969 | case IDM_VIEWERSETTINGS2:
|
|---|
| 4970 | case IDM_COMPARESETTINGS:
|
|---|
| 4971 | case IDM_MONOLITHICSETTINGS:
|
|---|
| 4972 | case IDM_GENERALSETTINGS:
|
|---|
| 4973 | case IDM_SCANSETTINGS:
|
|---|
| 4974 | case IDM_BUBBLESSETTINGS:
|
|---|
| 4975 | case IDM_QUICKSETTINGS:
|
|---|
| 4976 | WinDlgBox(HWND_DESKTOP,
|
|---|
| 4977 | hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMLONG(mp1));
|
|---|
| 4978 | break;
|
|---|
| 4979 |
|
|---|
| 4980 | case IDM_VIEWHELPS:
|
|---|
| 4981 | case IDM_VIEWINFS:
|
|---|
| 4982 | WinDlgBox(HWND_DESKTOP,
|
|---|
| 4983 | HWND_DESKTOP,
|
|---|
| 4984 | ViewInfProc,
|
|---|
| 4985 | FM3ModHandle,
|
|---|
| 4986 | VINF_FRAME,
|
|---|
| 4987 | ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ?
|
|---|
| 4988 | MPFROMP(NullStr) : MPVOID));
|
|---|
| 4989 | break;
|
|---|
| 4990 |
|
|---|
| 4991 | case IDM_OPENWALK:
|
|---|
| 4992 | {
|
|---|
| 4993 | char newpath[CCHMAXPATH];
|
|---|
| 4994 |
|
|---|
| 4995 | *newpath = 0;
|
|---|
| 4996 | TopWindowName(hwnd, (HWND) 0, newpath);
|
|---|
| 4997 | if (WinDlgBox(HWND_DESKTOP,
|
|---|
| 4998 | hwnd,
|
|---|
| 4999 | WalkAllDlgProc,
|
|---|
| 5000 | FM3ModHandle, WALK_FRAME, MPFROMP(newpath)) && *newpath)
|
|---|
| 5001 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, newpath);
|
|---|
| 5002 | }
|
|---|
| 5003 | break;
|
|---|
| 5004 |
|
|---|
| 5005 | case IDM_WINDOWDLG:
|
|---|
| 5006 | WindowList(hwnd);
|
|---|
| 5007 | break;
|
|---|
| 5008 |
|
|---|
| 5009 | case IDM_HELPMOUSE:
|
|---|
| 5010 | case IDM_HELPCONTEXT:
|
|---|
| 5011 | case IDM_HELPHINTS:
|
|---|
| 5012 | case IDM_HELPPIX:
|
|---|
| 5013 | case IDM_HELPTUTOR:
|
|---|
| 5014 | case IDM_HELPUSERLIST:
|
|---|
| 5015 | case IDM_HELP:
|
|---|
| 5016 | case IDM_HELPCONTENTS:
|
|---|
| 5017 | case IDM_HELPKEYS:
|
|---|
| 5018 | case IDM_HELPGENERAL:
|
|---|
| 5019 | if (hwndHelp) {
|
|---|
| 5020 | if (SHORT1FROMMP(mp2) == CMDSRC_MENU) {
|
|---|
| 5021 |
|
|---|
| 5022 | RECTL rcl;
|
|---|
| 5023 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L;
|
|---|
| 5024 |
|
|---|
| 5025 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
|---|
| 5026 | rcl.yBottom += icz;
|
|---|
| 5027 | rcl.yTop -= icz;
|
|---|
| 5028 | rcl.xLeft += icz;
|
|---|
| 5029 | rcl.xRight -= icz;
|
|---|
| 5030 | WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);
|
|---|
| 5031 | }
|
|---|
| 5032 | else {
|
|---|
| 5033 |
|
|---|
| 5034 | RECTL rcl;
|
|---|
| 5035 |
|
|---|
| 5036 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
|---|
| 5037 | rcl.yBottom += 8;
|
|---|
| 5038 | rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7);
|
|---|
| 5039 | rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7);
|
|---|
| 5040 | rcl.xRight -= 8;
|
|---|
| 5041 | WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);
|
|---|
| 5042 | }
|
|---|
| 5043 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| 5044 | case IDM_HELPCONTEXT:
|
|---|
| 5045 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5046 | MPFROM2SHORT(HELP_CONTEXT, 0), MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5047 | break;
|
|---|
| 5048 |
|
|---|
| 5049 | case IDM_HELPMOUSE:
|
|---|
| 5050 | if (hwndHelp)
|
|---|
| 5051 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5052 | MPFROM2SHORT(HELP_MOUSE, 0), MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5053 | break;
|
|---|
| 5054 |
|
|---|
| 5055 | case IDM_HELPPIX:
|
|---|
| 5056 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5057 | MPFROM2SHORT(HELP_BITMAP1, 0), MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5058 | break;
|
|---|
| 5059 |
|
|---|
| 5060 | case IDM_HELPTUTOR:
|
|---|
| 5061 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5062 | MPFROM2SHORT(HELP_TUTORIAL, 0),
|
|---|
| 5063 | MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5064 | break;
|
|---|
| 5065 |
|
|---|
| 5066 | case IDM_HELPHINTS:
|
|---|
| 5067 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5068 | MPFROM2SHORT(HELP_HINTS, 0), MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5069 | break;
|
|---|
| 5070 |
|
|---|
| 5071 | case IDM_HELPGENERAL:
|
|---|
| 5072 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5073 | MPFROM2SHORT(HELP_MAIN, 0), MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5074 | break;
|
|---|
| 5075 | case IDM_HELPKEYS:
|
|---|
| 5076 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5077 | MPFROM2SHORT(HELP_KEYS, 0), MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5078 | break;
|
|---|
| 5079 |
|
|---|
| 5080 | case IDM_HELP:
|
|---|
| 5081 | case IDM_HELPCONTENTS:
|
|---|
| 5082 | WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
|
|---|
| 5083 | break;
|
|---|
| 5084 |
|
|---|
| 5085 | case IDM_HELPUSERLIST:
|
|---|
| 5086 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 5087 | MPFROM2SHORT(HELP_USERLISTS, 0),
|
|---|
| 5088 | MPFROMSHORT(HM_RESOURCEID));
|
|---|
| 5089 | break;
|
|---|
| 5090 | }
|
|---|
| 5091 | }
|
|---|
| 5092 | break;
|
|---|
| 5093 |
|
|---|
| 5094 | case IDM_EDITANYARCHIVER:
|
|---|
| 5095 | EditArchiverDefinition(hwnd);
|
|---|
| 5096 | break;
|
|---|
| 5097 |
|
|---|
| 5098 | case IDM_ABOUT:
|
|---|
| 5099 | WinDlgBox(HWND_DESKTOP, hwnd, AboutDlgProc, FM3ModHandle,
|
|---|
| 5100 | ABT_FRAME, MPVOID);
|
|---|
| 5101 | break;
|
|---|
| 5102 |
|
|---|
| 5103 | case IDM_FONTPALETTE:
|
|---|
| 5104 | OpenObject("<WP_FNTPAL>", Default, hwnd);
|
|---|
| 5105 | break;
|
|---|
| 5106 |
|
|---|
| 5107 | case IDM_HICOLORPALETTE:
|
|---|
| 5108 | case IDM_COLORPALETTE:
|
|---|
| 5109 | {
|
|---|
| 5110 | CHAR *palette = "<WP_CLRPAL>";
|
|---|
| 5111 | ULONG version[2];
|
|---|
| 5112 |
|
|---|
| 5113 | if (!DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR,
|
|---|
| 5114 | (PVOID) & version, (ULONG) sizeof(version))) {
|
|---|
| 5115 | if (version[0] > 20L || (version[0] == 20L && version[1] > 29L)) {
|
|---|
| 5116 | if (SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE)
|
|---|
| 5117 | palette = "<WP_HIRESCLRPAL>";
|
|---|
| 5118 | else
|
|---|
| 5119 | palette = "<WP_LORESCLRPAL>";
|
|---|
| 5120 | }
|
|---|
| 5121 | }
|
|---|
| 5122 | OpenObject(palette, Default, hwnd);
|
|---|
| 5123 | }
|
|---|
| 5124 | break;
|
|---|
| 5125 |
|
|---|
| 5126 | case IDM_SYSTEMSETUP:
|
|---|
| 5127 | OpenObject("<WP_CONFIG>", Default, hwnd);
|
|---|
| 5128 | break;
|
|---|
| 5129 |
|
|---|
| 5130 | case IDM_SCHEMEPALETTE:
|
|---|
| 5131 | {
|
|---|
| 5132 | HOBJECT hWPSObject;
|
|---|
| 5133 |
|
|---|
| 5134 | hWPSObject = WinQueryObject("<WP_SCHPAL>");
|
|---|
| 5135 | if (hWPSObject != NULLHANDLE)
|
|---|
| 5136 | WinSetObjectData(hWPSObject, "SCHEMES=Winter:PM_Winter,"
|
|---|
| 5137 | "Spring:PM_Spring,Summer:PM_Summer,"
|
|---|
| 5138 | "System:PM_System,Windows:PM_Windows;"
|
|---|
| 5139 | "OPEN=DEFAULT");
|
|---|
| 5140 | }
|
|---|
| 5141 | break;
|
|---|
| 5142 |
|
|---|
| 5143 | case IDM_SYSTEMCLOCK:
|
|---|
| 5144 | OpenObject("<WP_CLOCK>", Default, hwnd);
|
|---|
| 5145 | break;
|
|---|
| 5146 |
|
|---|
| 5147 | #ifdef NEVER
|
|---|
| 5148 | case IDM_SYSINFO:
|
|---|
| 5149 | WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, SysInfoDlgProc, FM3ModHandle,
|
|---|
| 5150 | SYS_FRAME, NULL);
|
|---|
| 5151 | break;
|
|---|
| 5152 | #endif
|
|---|
| 5153 |
|
|---|
| 5154 | case IDM_INSTANT:
|
|---|
| 5155 | {
|
|---|
| 5156 | CHAR path[CCHMAXPATH];
|
|---|
| 5157 | PCNRITEM pci = (PCNRITEM) 0;
|
|---|
| 5158 |
|
|---|
| 5159 | if (hwndTree)
|
|---|
| 5160 | pci = (PCNRITEM) WinSendMsg(hwndTree, CM_QUERYRECORDEMPHASIS,
|
|---|
| 5161 | MPFROMLONG(CMA_FIRST),
|
|---|
| 5162 | MPFROMSHORT(CRA_CURSORED));
|
|---|
| 5163 | if (pci && (INT) pci != -1) {
|
|---|
| 5164 | strcpy(path, pci->pszFileName);
|
|---|
| 5165 | MakeValidDir(path);
|
|---|
| 5166 | }
|
|---|
| 5167 | else
|
|---|
| 5168 | strcpy(path, pFM2SaveDirectory);
|
|---|
| 5169 | WinDlgBox(HWND_DESKTOP, hwnd, InstantDlgProc, FM3ModHandle,
|
|---|
| 5170 | BAT_FRAME, MPFROMP(path));
|
|---|
| 5171 | }
|
|---|
| 5172 | break;
|
|---|
| 5173 |
|
|---|
| 5174 | case IDM_WINFULLSCREEN:
|
|---|
| 5175 | case IDM_DOSCOMMANDLINE:
|
|---|
| 5176 | case IDM_COMMANDLINE:
|
|---|
| 5177 | {
|
|---|
| 5178 | CHAR *env = GetCmdSpec(FALSE), path[CCHMAXPATH];
|
|---|
| 5179 | INT type = SEPARATE | WINDOWED;
|
|---|
| 5180 |
|
|---|
| 5181 | *path = 0;
|
|---|
| 5182 | TopWindowName(hwnd, (HWND) 0, path);
|
|---|
| 5183 | if (SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE)
|
|---|
| 5184 | env = GetCmdSpec(TRUE);
|
|---|
| 5185 | else if (SHORT1FROMMP(mp1) != IDM_COMMANDLINE) {
|
|---|
| 5186 | env = "WINOS2.COM";
|
|---|
| 5187 | type = SEPARATE | FULLSCREEN;
|
|---|
| 5188 | }
|
|---|
| 5189 | runemf2(type, hwnd, pszSrcFile, __LINE__,
|
|---|
| 5190 | path, NULL, "%s", env);
|
|---|
| 5191 | }
|
|---|
| 5192 | break;
|
|---|
| 5193 |
|
|---|
| 5194 | case IDM_KILLPROC:
|
|---|
| 5195 | WinDlgBox(HWND_DESKTOP, hwnd, KillDlgProc, FM3ModHandle,
|
|---|
| 5196 | KILL_FRAME, NULL);
|
|---|
| 5197 | break;
|
|---|
| 5198 |
|
|---|
| 5199 | case IDM_AUTOVIEWCOMMENTS:
|
|---|
| 5200 | case IDM_AUTOVIEWFILE:
|
|---|
| 5201 | if (SHORT1FROMMP(mp1) == IDM_AUTOVIEWFILE)
|
|---|
| 5202 | fComments = FALSE;
|
|---|
| 5203 | else
|
|---|
| 5204 | fComments = TRUE;
|
|---|
| 5205 | PrfWriteProfileData(fmprof, FM3Str, "Comments", &fComments, sizeof(BOOL));
|
|---|
| 5206 | WinSetWindowText((fComments) ? hwndAutoview : hwndAutoMLE, NullStr);
|
|---|
| 5207 | goto AutoChange;
|
|---|
| 5208 |
|
|---|
| 5209 | case IDM_AUTOVIEW:
|
|---|
| 5210 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
|---|
| 5211 | &fAutoView, TRUE, "AutoView");
|
|---|
| 5212 | AutoChange:
|
|---|
| 5213 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
|---|
| 5214 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| 5215 | if (fAutoView) {
|
|---|
| 5216 |
|
|---|
| 5217 | CHAR s[CCHMAXPATH];
|
|---|
| 5218 | HWND hwndDir;
|
|---|
| 5219 | PCNRITEM pci;
|
|---|
| 5220 |
|
|---|
| 5221 | hwndDir = TopWindowName(hwnd, (HWND) 0, s);
|
|---|
| 5222 | if (hwndDir) {
|
|---|
| 5223 | hwndDir = WinWindowFromID(hwndDir, FID_CLIENT);
|
|---|
| 5224 | if (hwndDir) {
|
|---|
| 5225 | hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
|
|---|
| 5226 | if (hwndDir) {
|
|---|
| 5227 | pci = (PCNRITEM) WinSendMsg(hwndDir, CM_QUERYRECORDEMPHASIS,
|
|---|
| 5228 | MPFROMLONG(CMA_FIRST),
|
|---|
| 5229 | MPFROMSHORT(CRA_CURSORED));
|
|---|
| 5230 | if (pci && (INT) pci != -1 &&
|
|---|
| 5231 | (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
|
|---|
| 5232 | WinSendMsg(hwnd,
|
|---|
| 5233 | UM_LOADFILE,
|
|---|
| 5234 | MPFROMP(pci->pszFileName),
|
|---|
| 5235 | (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ?
|
|---|
| 5236 | MPVOID : MPFROMLONG(1));
|
|---|
| 5237 | }
|
|---|
| 5238 | }
|
|---|
| 5239 | }
|
|---|
| 5240 | }
|
|---|
| 5241 | break;
|
|---|
| 5242 |
|
|---|
| 5243 | case IDM_TEXTTOOLS:
|
|---|
| 5244 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
|---|
| 5245 | &fTextTools, TRUE, "TextTools");
|
|---|
| 5246 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| 5247 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
|---|
| 5248 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| 5249 | break;
|
|---|
| 5250 |
|
|---|
| 5251 | case IDM_TOOLTITLES:
|
|---|
| 5252 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
|---|
| 5253 | &fToolTitles, TRUE, "ToolTitles");
|
|---|
| 5254 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| 5255 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
|---|
| 5256 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| 5257 | break;
|
|---|
| 5258 |
|
|---|
| 5259 | case IDM_HIDEMENU:
|
|---|
| 5260 | {
|
|---|
| 5261 | HWND hwndMenu = WinQueryWindowULong(hwnd, QWL_USER);
|
|---|
| 5262 | MenuInvisible = MenuInvisible ? FALSE : TRUE;
|
|---|
| 5263 | if (MenuInvisible) {
|
|---|
| 5264 | WinSetParent(hwndMenu, HWND_OBJECT, FALSE);
|
|---|
| 5265 | WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 5266 | FID_SYSMENU), IDM_HIDEMENU,
|
|---|
| 5267 | GetPString(IDS_UNHIDEMENUTEXT));
|
|---|
| 5268 | }
|
|---|
| 5269 | else {
|
|---|
| 5270 | WinSetParent(hwndMenu, WinQueryWindow(hwnd, QW_PARENT), FALSE);
|
|---|
| 5271 | WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 5272 | FID_SYSMENU), IDM_HIDEMENU,
|
|---|
| 5273 | GetPString(IDS_HIDEMENUTEXT));
|
|---|
| 5274 | }
|
|---|
| 5275 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
|---|
| 5276 | MPFROMLONG(FCF_MENU), MPVOID);
|
|---|
| 5277 | PrfWriteProfileData(fmprof, FM3Str, "MenuInvisible",
|
|---|
| 5278 | &MenuInvisible, sizeof(BOOL));
|
|---|
| 5279 | }
|
|---|
| 5280 | break;
|
|---|
| 5281 |
|
|---|
| 5282 | case IDM_SEEALL:
|
|---|
| 5283 | case IDM_GREP:
|
|---|
| 5284 | case IDM_COLLECTOR:
|
|---|
| 5285 | {
|
|---|
| 5286 | HWND hwndC;
|
|---|
| 5287 | SWP swp;
|
|---|
| 5288 | BOOL already = FALSE;
|
|---|
| 5289 |
|
|---|
| 5290 | if (Collector)
|
|---|
| 5291 | already = TRUE;
|
|---|
| 5292 | if (!already && !fAutoTile && !fExternalCollector)
|
|---|
| 5293 | GetNextWindowPos(hwnd, &swp, NULL, NULL);
|
|---|
| 5294 | hwndC = StartCollector(fExternalCollector ? HWND_DESKTOP : hwnd, 4);
|
|---|
| 5295 | if (hwndC) {
|
|---|
| 5296 | if (!already && !fAutoTile && !fExternalCollector)
|
|---|
| 5297 | WinSetWindowPos(hwndC, HWND_TOP,
|
|---|
| 5298 | swp.x, swp.y, swp.cx, swp.cy,
|
|---|
| 5299 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
|---|
| 5300 | else if (fAutoTile && !already)
|
|---|
| 5301 | TileChildren(hwnd, TRUE);
|
|---|
| 5302 | WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE |
|
|---|
| 5303 | SWP_ACTIVATE);
|
|---|
| 5304 | if (SHORT1FROMMP(mp1) == IDM_GREP)
|
|---|
| 5305 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,
|
|---|
| 5306 | MPFROM2SHORT(IDM_GREP, 0), MPVOID);
|
|---|
| 5307 | if (SHORT1FROMMP(mp1) == IDM_SEEALL)
|
|---|
| 5308 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,
|
|---|
| 5309 | MPFROM2SHORT(IDM_SEEALL, 0), MPVOID);
|
|---|
| 5310 | }
|
|---|
| 5311 | }
|
|---|
| 5312 | break;
|
|---|
| 5313 |
|
|---|
| 5314 | case IDM_TOOLLEFT:
|
|---|
| 5315 | case IDM_TOOLRIGHT:
|
|---|
| 5316 | {
|
|---|
| 5317 | TOOL *tool;
|
|---|
| 5318 |
|
|---|
| 5319 | if (!toolhead || !toolhead->next) {
|
|---|
| 5320 | firsttool = (toolhead) ? toolhead->id : 0;
|
|---|
| 5321 | break;
|
|---|
| 5322 | }
|
|---|
| 5323 | tool = find_tool(firsttool);
|
|---|
| 5324 | if (!tool)
|
|---|
| 5325 | tool = toolhead;
|
|---|
| 5326 | if (SHORT1FROMMP(mp1) == IDM_TOOLRIGHT) {
|
|---|
| 5327 | tool = prev_tool(tool, TRUE);
|
|---|
| 5328 | firsttool = tool->id;
|
|---|
| 5329 | }
|
|---|
| 5330 | else {
|
|---|
| 5331 | tool = next_tool(tool, TRUE);
|
|---|
| 5332 | firsttool = tool->id;
|
|---|
| 5333 | }
|
|---|
| 5334 | ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 5335 | MAIN_TOOLS));
|
|---|
| 5336 | }
|
|---|
| 5337 | break;
|
|---|
| 5338 |
|
|---|
| 5339 | case IDM_CREATETOOL:
|
|---|
| 5340 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| 5341 | break;
|
|---|
| 5342 |
|
|---|
| 5343 | case IDM_TOOLBAR:
|
|---|
| 5344 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| 5345 | IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar");
|
|---|
| 5346 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| 5347 | WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 5348 | MAIN_TOOLS), fToolbar);
|
|---|
| 5349 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 5350 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| 5351 | if (fDrivebar)
|
|---|
| 5352 | WinInvalidateRect(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 5353 | MAIN_DRIVES), NULL, TRUE);
|
|---|
| 5354 | break;
|
|---|
| 5355 |
|
|---|
| 5356 | case IDM_DRIVEBAR:
|
|---|
| 5357 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| 5358 | IDM_DRIVEBAR, &fDrivebar, TRUE, "Drivebar");
|
|---|
| 5359 | WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 5360 | MAIN_DRIVES), fDrivebar);
|
|---|
| 5361 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 5362 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| 5363 | PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
|
|---|
| 5364 | break;
|
|---|
| 5365 |
|
|---|
| 5366 | case IDM_USERLIST:
|
|---|
| 5367 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| 5368 | SHORT1FROMMP(mp1), &fUserComboBox, TRUE, "UserComboBox");
|
|---|
| 5369 | WinShowWindow(hwndUserlist, fUserComboBox);
|
|---|
| 5370 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 5371 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| 5372 | PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
|---|
| 5373 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
|---|
| 5374 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
|---|
| 5375 | PostMsg(hwnd, UM_FILLBUTTONLIST, MPVOID, MPVOID);
|
|---|
| 5376 | break;
|
|---|
| 5377 |
|
|---|
| 5378 | case IDM_MOREBUTTONS:
|
|---|
| 5379 | WinSetWindowText(hwndName, NullStr);
|
|---|
| 5380 | WinSetWindowText(hwndDate, NullStr);
|
|---|
| 5381 | WinSetWindowText(hwndAttr, NullStr);
|
|---|
| 5382 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| 5383 | SHORT1FROMMP(mp1), &fMoreButtons, TRUE, "MoreButtons");
|
|---|
| 5384 | if (fMoreButtons) {
|
|---|
| 5385 |
|
|---|
| 5386 | HWND hwndTemp;
|
|---|
| 5387 |
|
|---|
| 5388 | hwndTemp = TopWindow(hwnd, (HWND) 0);
|
|---|
| 5389 |
|
|---|
| 5390 | if (hwndTemp) {
|
|---|
| 5391 | WinSetFocus(HWND_DESKTOP, hwnd);
|
|---|
| 5392 | WinSetFocus(HWND_DESKTOP, hwndTemp);
|
|---|
| 5393 | }
|
|---|
| 5394 | }
|
|---|
| 5395 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 5396 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
|---|
| 5397 | break;
|
|---|
| 5398 |
|
|---|
| 5399 | case IDM_TOGGLEDRAGDIALOG:
|
|---|
| 5400 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| 5401 | IDM_TOGGLEDRAGDIALOG,
|
|---|
| 5402 | &fDragndropDlg,
|
|---|
| 5403 | TRUE,
|
|---|
| 5404 | "Drag&DropDlg");
|
|---|
| 5405 | break;
|
|---|
| 5406 |
|
|---|
| 5407 | case IDM_SYNCUPDATES:
|
|---|
| 5408 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| 5409 | IDM_SYNCUPDATES,
|
|---|
| 5410 | &fSyncUpdates,
|
|---|
| 5411 | TRUE,
|
|---|
| 5412 | "SyncUpdates");
|
|---|
| 5413 | break;
|
|---|
| 5414 |
|
|---|
| 5415 | case IDM_FREETREE:
|
|---|
| 5416 | if (fFreeTree) {
|
|---|
| 5417 | SWP swp, swpT;
|
|---|
| 5418 |
|
|---|
| 5419 | WinQueryWindowPos(hwndTree, &swpT);
|
|---|
| 5420 | WinQueryWindowPos(hwnd, &swp);
|
|---|
| 5421 | WinSetWindowPos(hwndTree, HWND_TOP, 0, swp.cy - swpT.cy, 0, 0,
|
|---|
| 5422 | SWP_MOVE);
|
|---|
| 5423 | }
|
|---|
| 5424 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
|---|
| 5425 | &fFreeTree, TRUE, "FreeTree");
|
|---|
| 5426 | if (fAutoTile)
|
|---|
| 5427 | TileChildren(hwnd, TRUE);
|
|---|
| 5428 | break;
|
|---|
| 5429 |
|
|---|
| 5430 | case IDM_AUTOTILE:
|
|---|
| 5431 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| 5432 | SHORT1FROMMP(mp1), &fAutoTile, TRUE, "AutoTile");
|
|---|
| 5433 | if (fAutoTile)
|
|---|
| 5434 | TileChildren(hwnd, TRUE);
|
|---|
| 5435 | break;
|
|---|
| 5436 |
|
|---|
| 5437 | case IDM_TILEBACKWARDS:
|
|---|
| 5438 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| 5439 | SHORT1FROMMP(mp1), &fTileBackwards, TRUE, "TileBackwards");
|
|---|
| 5440 | if (fAutoTile)
|
|---|
| 5441 | TileChildren(hwnd, TRUE);
|
|---|
| 5442 | break;
|
|---|
| 5443 |
|
|---|
| 5444 | case IDM_NEXTWINDOW:
|
|---|
| 5445 | case IDM_PREVWINDOW:
|
|---|
| 5446 | NextChild(hwnd, (SHORT1FROMMP(mp1) == IDM_PREVWINDOW));
|
|---|
| 5447 | break;
|
|---|
| 5448 |
|
|---|
| 5449 | case IDM_CASCADE:
|
|---|
| 5450 | CascadeChildren(hwnd);
|
|---|
| 5451 | break;
|
|---|
| 5452 |
|
|---|
| 5453 | case IDM_TILE:
|
|---|
| 5454 | TileChildren(hwnd, TRUE);
|
|---|
| 5455 | break;
|
|---|
| 5456 |
|
|---|
| 5457 | case IDM_RESTORE:
|
|---|
| 5458 | MinResChildren(hwnd, SWP_RESTORE);
|
|---|
| 5459 | break;
|
|---|
| 5460 |
|
|---|
| 5461 | case IDM_MINIMIZE:
|
|---|
| 5462 | MinResChildren(hwnd, SWP_MINIMIZE);
|
|---|
| 5463 | break;
|
|---|
| 5464 |
|
|---|
| 5465 | case IDM_ARRANGEICONS:
|
|---|
| 5466 | ArrangeIcons(hwnd);
|
|---|
| 5467 | break;
|
|---|
| 5468 |
|
|---|
| 5469 | case IDM_INIVIEWER:
|
|---|
| 5470 | StartIniEditor(hwnd, NULL, 4);
|
|---|
| 5471 | break;
|
|---|
| 5472 |
|
|---|
| 5473 | case IDM_EDITASSOC:
|
|---|
| 5474 | EditAssociations(hwnd);
|
|---|
| 5475 | break;
|
|---|
| 5476 |
|
|---|
| 5477 | case IDM_EDITCOMMANDS:
|
|---|
| 5478 | EditCommands(hwnd);
|
|---|
| 5479 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
|---|
| 5480 | break;
|
|---|
| 5481 |
|
|---|
| 5482 | default:
|
|---|
| 5483 | if (!SwitchCommand((HWND) WinQueryWindowULong(hwnd, QWL_USER),
|
|---|
| 5484 | SHORT1FROMMP(mp1))) {
|
|---|
| 5485 | if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
|
|---|
| 5486 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
|
|---|
| 5487 |
|
|---|
| 5488 | INT x;
|
|---|
| 5489 | HWND hwndCnr;
|
|---|
| 5490 |
|
|---|
| 5491 | if (!cmdloaded)
|
|---|
| 5492 | load_commands();
|
|---|
| 5493 | hwndCnr = TopWindow(hwnd, (HWND) 0);
|
|---|
| 5494 | hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT),
|
|---|
| 5495 | UM_CONTAINERHWND, MPVOID, MPVOID);
|
|---|
| 5496 | if (!hwndCnr) {
|
|---|
| 5497 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT);
|
|---|
| 5498 | break;
|
|---|
| 5499 | }
|
|---|
| 5500 | x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
|
|---|
| 5501 | if (x >= 0) {
|
|---|
| 5502 | x++;
|
|---|
| 5503 | RunCommand(hwndCnr, x);
|
|---|
| 5504 | if (fUnHilite) {
|
|---|
| 5505 |
|
|---|
| 5506 | PCNRITEM pci;
|
|---|
| 5507 | DIRCNRDATA *dcd = NULL;
|
|---|
| 5508 |
|
|---|
| 5509 | // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR?
|
|---|
| 5510 | if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR)
|
|---|
| 5511 | dcd = INSTDATA(hwndCnr);
|
|---|
| 5512 | pci = (PCNRITEM) WinSendMsg(hwndCnr,
|
|---|
| 5513 | CM_QUERYRECORDEMPHASIS,
|
|---|
| 5514 | MPFROMLONG(CMA_FIRST),
|
|---|
| 5515 | MPFROMSHORT(CRA_CURSORED));
|
|---|
| 5516 | if (pci && (INT) pci != -1 &&
|
|---|
| 5517 | (pci->rc.flRecordAttr & CRA_SELECTED))
|
|---|
| 5518 | {
|
|---|
| 5519 | UnHilite(hwnd,
|
|---|
| 5520 | TRUE,
|
|---|
| 5521 | dcd ? &dcd->lastselection : NULL,
|
|---|
| 5522 | dcd ? dcd ->ulItemsToUnHilite : 0);
|
|---|
| 5523 | }
|
|---|
| 5524 | }
|
|---|
| 5525 | }
|
|---|
| 5526 | }
|
|---|
| 5527 | else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART &&
|
|---|
| 5528 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 51) {
|
|---|
| 5529 | if (!qtloaded)
|
|---|
| 5530 | load_quicktools();
|
|---|
| 5531 | if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]) {
|
|---|
| 5532 | if (fToolsChanged)
|
|---|
| 5533 | save_tools(NULL);
|
|---|
| 5534 | if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]))
|
|---|
| 5535 | load_tools(NULL);
|
|---|
| 5536 | else {
|
|---|
| 5537 | strcpy(lasttoolbar,
|
|---|
| 5538 | quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]);
|
|---|
| 5539 | PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar);
|
|---|
| 5540 | }
|
|---|
| 5541 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| 5542 | }
|
|---|
| 5543 | }
|
|---|
| 5544 | else {
|
|---|
| 5545 |
|
|---|
| 5546 | HWND hwndActive;
|
|---|
| 5547 |
|
|---|
| 5548 | hwndActive = TopWindow(hwnd, (HWND) 0);
|
|---|
| 5549 | if (hwndActive)
|
|---|
| 5550 | PostMsg(WinWindowFromID(hwndActive, FID_CLIENT),
|
|---|
| 5551 | WM_COMMAND, mp1, mp2);
|
|---|
| 5552 | }
|
|---|
| 5553 | }
|
|---|
| 5554 | break; // default
|
|---|
| 5555 | } // switch mp1
|
|---|
| 5556 | return 0;
|
|---|
| 5557 | }
|
|---|
| 5558 |
|
|---|
| 5559 | static MRESULT EXPENTRY MainWMOnce(HWND hwnd, ULONG msg, MPARAM mp1,
|
|---|
| 5560 | MPARAM mp2)
|
|---|
| 5561 | {
|
|---|
| 5562 | TID tid;
|
|---|
| 5563 | SWP swp;
|
|---|
| 5564 | PFNWP oldproc;
|
|---|
| 5565 | HWND hwndTmp;
|
|---|
| 5566 | HWND hwndFrame;
|
|---|
| 5567 | HWND hwndSysMenu, hwndSysSubMenu, hwndMenu;
|
|---|
| 5568 | USHORT idSysMenu;
|
|---|
| 5569 | MENUITEM mi, mit;
|
|---|
| 5570 | ULONG size;
|
|---|
| 5571 | BOOL temp = FALSE;
|
|---|
| 5572 |
|
|---|
| 5573 | switch (msg) {
|
|---|
| 5574 | case WM_CREATE:
|
|---|
| 5575 | WinQueryWindowProcess(hwnd, &mypid, &tid);
|
|---|
| 5576 | hwndMain = hwnd;
|
|---|
| 5577 | WinSetWindowUShort(hwnd, QWL_USER + 8, 0);
|
|---|
| 5578 | WinSetWindowUShort(hwnd, QWL_USER + 10, 0);
|
|---|
| 5579 | WinSetWindowUShort(hwnd, QWL_USER + 12, 0);
|
|---|
| 5580 | WinSetWindowUShort(hwnd, QWL_USER + 16, 0);
|
|---|
| 5581 | if (_beginthread(MakeMainObjWin, NULL, 245760, MPVOID) == -1) {
|
|---|
| 5582 | Runtime_Error(pszSrcFile, __LINE__,
|
|---|
| 5583 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
|---|
| 5584 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
|---|
| 5585 | return 0;
|
|---|
| 5586 | }
|
|---|
| 5587 | else
|
|---|
| 5588 | DosSleep(32);//05 Aug 07 GKY 64
|
|---|
| 5589 |
|
|---|
| 5590 | hwndFrame = WinQueryWindow(hwnd, QW_PARENT);
|
|---|
| 5591 |
|
|---|
| 5592 | /*
|
|---|
| 5593 | * create frame children (not client children, frame children)
|
|---|
| 5594 | */
|
|---|
| 5595 | DosSleep(1);
|
|---|
| 5596 | WinQueryWindowPos(hwndFrame, &swp);
|
|---|
| 5597 | oldproc = WinSubclassWindow(hwndFrame, MainFrameWndProc);
|
|---|
| 5598 | WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
|
|---|
| 5599 | CommonCreateMainChildren(hwnd, &swp);
|
|---|
| 5600 |
|
|---|
| 5601 | if (!WinCreateWindow(hwndFrame,
|
|---|
| 5602 | WC_BUTTON,
|
|---|
| 5603 | "I",
|
|---|
| 5604 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS,
|
|---|
| 5605 | ((swp.cx -
|
|---|
| 5606 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5607 | SV_CXMINMAXBUTTON)) -
|
|---|
| 5608 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5609 | SV_CXMINMAXBUTTON) / 2) -
|
|---|
| 5610 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5611 | SV_CXSIZEBORDER),
|
|---|
| 5612 | (swp.cy - WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5613 | SV_CYMINMAXBUTTON)) -
|
|---|
| 5614 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5615 | SV_CYSIZEBORDER),
|
|---|
| 5616 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5617 | SV_CXMINMAXBUTTON) / 2,
|
|---|
| 5618 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5619 | SV_CYMINMAXBUTTON),
|
|---|
| 5620 | hwnd, HWND_TOP, IDM_IDEALSIZE, NULL, NULL)) {
|
|---|
| 5621 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| 5622 | }
|
|---|
| 5623 | else {
|
|---|
| 5624 | WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_IDEALSIZE),
|
|---|
| 5625 | IdealButtonProc);
|
|---|
| 5626 | SetPresParams(WinWindowFromID(hwndFrame,
|
|---|
| 5627 | IDM_IDEALSIZE),
|
|---|
| 5628 | NULL, NULL, NULL, GetPString(IDS_10SYSTEMVIOTEXT));
|
|---|
| 5629 | }
|
|---|
| 5630 |
|
|---|
| 5631 | hwndTmp = WinCreateWindow(hwndFrame,
|
|---|
| 5632 | WC_BUTTON,
|
|---|
| 5633 | "#1019",
|
|---|
| 5634 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
|
|---|
| 5635 | BS_BITMAP,
|
|---|
| 5636 | swp.cx - 46,
|
|---|
| 5637 | swp.y + 2,
|
|---|
| 5638 | 24,
|
|---|
| 5639 | 22, hwnd, HWND_TOP, IDM_OPENWALK, NULL, NULL);
|
|---|
| 5640 | if (!hwndTmp)
|
|---|
| 5641 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| 5642 |
|
|---|
| 5643 | hwndTmp = WinCreateWindow(hwndFrame,
|
|---|
| 5644 | WC_BUTTON,
|
|---|
| 5645 | "#3062",
|
|---|
| 5646 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
|
|---|
| 5647 | BS_BITMAP,
|
|---|
| 5648 | swp.cx - 22,
|
|---|
| 5649 | swp.y + 2,
|
|---|
| 5650 | 24,
|
|---|
| 5651 | 22, hwnd, HWND_TOP, IDM_USERLIST, NULL, NULL);
|
|---|
| 5652 | if (!hwndTmp)
|
|---|
| 5653 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| 5654 |
|
|---|
| 5655 | hwndUserlist = WinCreateWindow(hwndFrame,
|
|---|
| 5656 | WC_COMBOBOX,
|
|---|
| 5657 | (PSZ) NULL,
|
|---|
| 5658 | WS_VISIBLE | CBS_DROPDOWN |
|
|---|
| 5659 | LS_HORZSCROLL,
|
|---|
| 5660 | (swp.x +
|
|---|
| 5661 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5662 | SV_CXSIZEBORDER) + 48L),
|
|---|
| 5663 | (swp.cy -
|
|---|
| 5664 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5665 | SV_CYSIZEBORDER)) - 60,
|
|---|
| 5666 | ((swp.cx -
|
|---|
| 5667 | (WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5668 | SV_CXSIZEBORDER) *
|
|---|
| 5669 | 2)) - 64L), 60L, hwndFrame, HWND_TOP,
|
|---|
| 5670 | MAIN_USERLIST, NULL, NULL);
|
|---|
| 5671 | if (!hwndUserlist)
|
|---|
| 5672 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| 5673 | hwndCmdlist = WinCreateWindow(hwndFrame,
|
|---|
| 5674 | WC_COMBOBOX,
|
|---|
| 5675 | (PSZ) NULL,
|
|---|
| 5676 | WS_VISIBLE | CBS_DROPDOWN |
|
|---|
| 5677 | LS_HORZSCROLL,
|
|---|
| 5678 | (swp.x +
|
|---|
| 5679 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5680 | SV_CXSIZEBORDER) + 48L),
|
|---|
| 5681 | (swp.cy -
|
|---|
| 5682 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5683 | SV_CYSIZEBORDER)) - 60,
|
|---|
| 5684 | ((swp.cx -
|
|---|
| 5685 | (WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5686 | SV_CXSIZEBORDER) * 2)) -
|
|---|
| 5687 | 64L), 60L, hwndFrame, HWND_TOP,
|
|---|
| 5688 | MAIN_CMDLIST, NULL, NULL);
|
|---|
| 5689 | if (!hwndCmdlist)
|
|---|
| 5690 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| 5691 | WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));
|
|---|
| 5692 | hwndStatelist = WinCreateWindow(hwndFrame,
|
|---|
| 5693 | WC_COMBOBOX,
|
|---|
| 5694 | (PSZ) NULL,
|
|---|
| 5695 | WS_VISIBLE | CBS_DROPDOWN |
|
|---|
| 5696 | LS_HORZSCROLL,
|
|---|
| 5697 | (swp.x +
|
|---|
| 5698 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5699 | SV_CXSIZEBORDER) + 48L),
|
|---|
| 5700 | (swp.cy -
|
|---|
| 5701 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5702 | SV_CYSIZEBORDER)) - 60,
|
|---|
| 5703 | ((swp.cx -
|
|---|
| 5704 | (WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5705 | SV_CXSIZEBORDER) *
|
|---|
| 5706 | 2)) - 64L), 60L, hwndFrame, HWND_TOP,
|
|---|
| 5707 | MAIN_SETUPLIST, NULL, NULL);
|
|---|
| 5708 | if (!hwndStatelist)
|
|---|
| 5709 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| 5710 |
|
|---|
| 5711 | hwndDrivelist = WinCreateWindow(hwndFrame,
|
|---|
| 5712 | WC_COMBOBOX,
|
|---|
| 5713 | (PSZ) NULL,
|
|---|
| 5714 | WS_VISIBLE | CBS_DROPDOWN,
|
|---|
| 5715 | (swp.x +
|
|---|
| 5716 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5717 | SV_CXSIZEBORDER)),
|
|---|
| 5718 | (swp.cy -
|
|---|
| 5719 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5720 | SV_CYSIZEBORDER)) - 60,
|
|---|
| 5721 | 48L,
|
|---|
| 5722 | 60L,
|
|---|
| 5723 | hwndFrame,
|
|---|
| 5724 | HWND_TOP, MAIN_DRIVELIST, NULL, NULL);
|
|---|
| 5725 | if (!hwndDrivelist)
|
|---|
| 5726 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| 5727 | SetPresParams(hwndDrivelist,
|
|---|
| 5728 | NULL, NULL, NULL, GetPString(IDS_10SYSTEMMONOTEXT));
|
|---|
| 5729 | hwndButtonlist = WinCreateWindow(hwndFrame,
|
|---|
| 5730 | WC_COMBOBOX,
|
|---|
| 5731 | (PSZ) NULL,
|
|---|
| 5732 | WS_VISIBLE | CBS_DROPDOWN |
|
|---|
| 5733 | LS_HORZSCROLL,
|
|---|
| 5734 | (swp.cx -
|
|---|
| 5735 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5736 | SV_CXSIZEBORDER)) -
|
|---|
| 5737 | 164L,
|
|---|
| 5738 | (swp.cy -
|
|---|
| 5739 | WinQuerySysValue(HWND_DESKTOP,
|
|---|
| 5740 | SV_CYSIZEBORDER)) - 60,
|
|---|
| 5741 | 164L, 60L, hwndFrame, HWND_TOP,
|
|---|
| 5742 | MAIN_BUTTONLIST, NULL, NULL);
|
|---|
| 5743 | if (!hwndButtonlist)
|
|---|
| 5744 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
|---|
| 5745 | WinSendMsg(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
|---|
| 5746 | EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
|
|---|
| 5747 | WinSendMsg(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
|---|
| 5748 | EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID);
|
|---|
| 5749 | WinSendMsg(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
|---|
| 5750 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
|---|
| 5751 | WinSendMsg(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
|---|
| 5752 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
|---|
| 5753 | WinSendMsg(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
|---|
| 5754 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
|---|
| 5755 |
|
|---|
| 5756 | oldproc = WinSubclassWindow(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
|---|
| 5757 | DropDownListProc);
|
|---|
| 5758 | WinSetWindowPtr(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
|---|
| 5759 | QWL_USER, (PVOID) oldproc);
|
|---|
| 5760 | oldproc = WinSubclassWindow(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
|---|
| 5761 | DropDownListProc);
|
|---|
| 5762 | WinSetWindowPtr(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
|---|
| 5763 | QWL_USER, (PVOID) oldproc);
|
|---|
| 5764 | oldproc = WinSubclassWindow(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
|---|
| 5765 | DropDownListProc);
|
|---|
| 5766 | WinSetWindowPtr(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
|---|
| 5767 | QWL_USER, (PVOID) oldproc);
|
|---|
| 5768 | oldproc = WinSubclassWindow(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
|---|
| 5769 | DropDownListProc);
|
|---|
| 5770 | WinSetWindowPtr(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
|---|
| 5771 | QWL_USER, (PVOID) oldproc);
|
|---|
| 5772 | oldproc = WinSubclassWindow(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
|---|
| 5773 | DropDownListProc);
|
|---|
| 5774 | WinSetWindowPtr(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
|---|
| 5775 | QWL_USER, (PVOID) oldproc);
|
|---|
| 5776 | oldproc = WinSubclassWindow(hwndUserlist, DropDownListProc);
|
|---|
| 5777 | WinSetWindowPtr(hwndUserlist, QWL_USER, (PVOID) oldproc);
|
|---|
| 5778 | oldproc = WinSubclassWindow(hwndCmdlist, DropDownListProc);
|
|---|
| 5779 | WinSetWindowPtr(hwndCmdlist, QWL_USER, (PVOID) oldproc);
|
|---|
| 5780 | oldproc = WinSubclassWindow(hwndStatelist, DropDownListProc);
|
|---|
| 5781 | WinSetWindowPtr(hwndStatelist, QWL_USER, (PVOID) oldproc);
|
|---|
| 5782 | oldproc = WinSubclassWindow(hwndDrivelist, DropDownListProc);
|
|---|
| 5783 | WinSetWindowPtr(hwndDrivelist, QWL_USER, (PVOID) oldproc);
|
|---|
| 5784 | oldproc = WinSubclassWindow(hwndButtonlist, DropDownListProc);
|
|---|
| 5785 | WinSetWindowPtr(hwndButtonlist, QWL_USER, (PVOID) oldproc);
|
|---|
| 5786 | oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_USERLIST),
|
|---|
| 5787 | ChildFrameButtonProc);
|
|---|
| 5788 | WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_USERLIST),
|
|---|
| 5789 | QWL_USER, (PVOID) oldproc);
|
|---|
| 5790 | oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_OPENWALK),
|
|---|
| 5791 | ChildFrameButtonProc);
|
|---|
| 5792 | WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_OPENWALK),
|
|---|
| 5793 | QWL_USER, (PVOID) oldproc);
|
|---|
| 5794 | hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
|
|---|
| 5795 | WinSendMsg(hwnd, UM_ADDTOMENU, MPVOID, MPVOID);
|
|---|
| 5796 | SetToggleChecks(hwndMenu);
|
|---|
| 5797 | CfgMenuInit(hwndMenu, FALSE); // 14 Feb 08 SHL
|
|---|
| 5798 | SetConditionalCascade(hwndMenu, IDM_COMMANDLINESUBMENU, IDM_COMMANDLINE);
|
|---|
| 5799 | SetConditionalCascade(hwndMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
|
|---|
| 5800 | SetConditionalCascade(hwndMenu, IDM_AUTOVIEWSUBMENU, IDM_AUTOVIEW);
|
|---|
| 5801 | SetConditionalCascade(hwndMenu, IDM_TILEMENU, IDM_TILE);
|
|---|
| 5802 | WinSetWindowULong(hwnd, QWL_USER, hwndMenu);
|
|---|
| 5803 | memset(&mi, 0, sizeof(mi));
|
|---|
| 5804 | memset(&mit, 0, sizeof(mit));
|
|---|
| 5805 | hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU);
|
|---|
| 5806 | idSysMenu = SHORT1FROMMR(WinSendMsg(hwndSysMenu,
|
|---|
| 5807 | MM_ITEMIDFROMPOSITION,
|
|---|
| 5808 | MPVOID, MPVOID));
|
|---|
| 5809 | WinSendMsg(hwndSysMenu,
|
|---|
| 5810 | MM_QUERYITEM, MPFROM2SHORT(idSysMenu, 0), MPFROMP(&mit));
|
|---|
| 5811 | hwndSysSubMenu = mit.hwndSubMenu;
|
|---|
| 5812 | mi.iPosition = MIT_END;
|
|---|
| 5813 | mi.afStyle = MIS_SEPARATOR;
|
|---|
| 5814 | mi.id = (USHORT) - 1;
|
|---|
| 5815 | WinSendMsg(hwndSysSubMenu, MM_INSERTITEM, MPFROMP(&mi), MPFROMP(NULL));
|
|---|
| 5816 | mi.afStyle = MIS_TEXT;
|
|---|
| 5817 | mi.id = IDM_IDEALSIZE;
|
|---|
| 5818 | WinSendMsg(hwndSysSubMenu,
|
|---|
| 5819 | MM_INSERTITEM,
|
|---|
| 5820 | MPFROMP(&mi), MPFROMP(GetPString(IDS_IDEALMENUTEXT)));
|
|---|
| 5821 | mi.afStyle = MIS_TEXT;
|
|---|
| 5822 | mi.id = IDM_HIDEMENU;
|
|---|
| 5823 | WinSendMsg(hwndSysSubMenu,
|
|---|
| 5824 | MM_INSERTITEM,
|
|---|
| 5825 | MPFROMP(&mi), MPFROMP(GetPString(IDS_HIDEMENUTEXT)));
|
|---|
| 5826 | SetSysMenu(hwndSysMenu);
|
|---|
| 5827 |
|
|---|
| 5828 | size = sizeof(BOOL);
|
|---|
| 5829 | if (PrfQueryProfileData(fmprof,
|
|---|
| 5830 | FM3Str,
|
|---|
| 5831 | "MenuInvisible", &temp, &size) && size && temp)
|
|---|
| 5832 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
|
|---|
| 5833 | size = sizeof(BOOL);
|
|---|
| 5834 | if (PrfQueryProfileData(fmprof,
|
|---|
| 5835 | FM3Str, "FreeTree", &temp, &size) && size && temp)
|
|---|
| 5836 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID);
|
|---|
| 5837 | size = sizeof(BOOL);
|
|---|
| 5838 | if (PrfQueryProfileData(fmprof,
|
|---|
| 5839 | FM3Str,
|
|---|
| 5840 | "AutoTile", &temp, &size) && size && !temp)
|
|---|
| 5841 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID);
|
|---|
| 5842 | size = sizeof(BOOL);
|
|---|
| 5843 | if (PrfQueryProfileData(fmprof,
|
|---|
| 5844 | FM3Str, "Toolbar", &temp, &size) && size && !temp)
|
|---|
| 5845 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
|
|---|
| 5846 |
|
|---|
| 5847 | WinSetWindowText(WinWindowFromID(hwndFrame, FID_TITLEBAR), "FM/2");
|
|---|
| 5848 | FixSwitchList(hwndFrame, NULL);
|
|---|
| 5849 | break; // WM_CREATE
|
|---|
| 5850 |
|
|---|
| 5851 | case UM_SETUP:
|
|---|
| 5852 | /*
|
|---|
| 5853 | * start up some initial children
|
|---|
| 5854 | */
|
|---|
| 5855 | WinShowWindow(WinQueryWindow(hwnd, QW_PARENT), TRUE);
|
|---|
| 5856 | PostMsg(MainObjectHwnd, UM_SETUP2, mp1, mp2);
|
|---|
| 5857 | return 0;
|
|---|
| 5858 |
|
|---|
| 5859 | case UM_SETUP2:
|
|---|
| 5860 | {
|
|---|
| 5861 | SWP swp;
|
|---|
| 5862 | ULONG size = sizeof(SWP);
|
|---|
| 5863 |
|
|---|
| 5864 | WinQueryWindowPos(hwnd, &swp);
|
|---|
| 5865 | hwndTree = StartTreeCnr(hwnd, 4);
|
|---|
| 5866 | if (!hwndTree)
|
|---|
| 5867 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
|---|
| 5868 | else {
|
|---|
| 5869 | if (!fSaveState ||
|
|---|
| 5870 | !PrfQueryProfileData(fmprof,
|
|---|
| 5871 | FM3Str,
|
|---|
| 5872 | "LastTreePos",
|
|---|
| 5873 | &swp, &size) || size != sizeof(SWP)) {
|
|---|
| 5874 |
|
|---|
| 5875 | INT ratio, height = 0;
|
|---|
| 5876 |
|
|---|
| 5877 | if (!fNoTreeGap)
|
|---|
| 5878 | height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
|---|
| 5879 | size = sizeof(ratio);
|
|---|
| 5880 | if (!PrfQueryProfileData(fmprof,
|
|---|
| 5881 | FM3Str,
|
|---|
| 5882 | "TreeWindowRatio",
|
|---|
| 5883 | (PVOID) & ratio,
|
|---|
| 5884 | &size) || size < sizeof(ratio))
|
|---|
| 5885 | ratio = 400;
|
|---|
| 5886 | WinSetWindowPos(hwndTree,
|
|---|
| 5887 | HWND_TOP,
|
|---|
| 5888 | 0,
|
|---|
| 5889 | height,
|
|---|
| 5890 | (swp.cx * 100) / ratio,
|
|---|
| 5891 | swp.cy - height,
|
|---|
| 5892 | SWP_SHOW | SWP_SIZE | SWP_MOVE |
|
|---|
| 5893 | SWP_ACTIVATE | SWP_ZORDER);
|
|---|
| 5894 | }
|
|---|
| 5895 | else
|
|---|
| 5896 | WinSetWindowPos(hwndTree,
|
|---|
| 5897 | HWND_TOP,
|
|---|
| 5898 | swp.x,
|
|---|
| 5899 | swp.y,
|
|---|
| 5900 | swp.cx,
|
|---|
| 5901 | swp.cy,
|
|---|
| 5902 | swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW |
|
|---|
| 5903 | SWP_ZORDER | SWP_ACTIVATE);
|
|---|
| 5904 | }
|
|---|
| 5905 | // ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 5906 | // MAIN_TOOLS));
|
|---|
| 5907 | }
|
|---|
| 5908 | PostMsg(MainObjectHwnd, UM_SETUP3, mp1, mp2);
|
|---|
| 5909 | return 0;
|
|---|
| 5910 |
|
|---|
| 5911 | case UM_SETUP3:
|
|---|
| 5912 | /* start remaining child windows */
|
|---|
| 5913 | if (!fNoSaveState && fSaveState) {
|
|---|
| 5914 | PSZ pszStatename = GetPString(IDS_SHUTDOWNSTATE);
|
|---|
| 5915 | PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszStatename), MPVOID);
|
|---|
| 5916 | if (!add_setup(pszStatename))
|
|---|
| 5917 | save_setups();
|
|---|
| 5918 | } else {
|
|---|
| 5919 | load_tools(NULL);
|
|---|
| 5920 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| 5921 | }
|
|---|
| 5922 | PostMsg(MainObjectHwnd, UM_SETUP4, mp1, mp2);
|
|---|
| 5923 | return 0;
|
|---|
| 5924 |
|
|---|
| 5925 | case UM_SETUP4:
|
|---|
| 5926 | {
|
|---|
| 5927 | INT argc = (INT) mp1, x;
|
|---|
| 5928 | CHAR **argv = (CHAR **) mp2;
|
|---|
| 5929 |
|
|---|
| 5930 | for (x = 1; x < argc; x++) {
|
|---|
| 5931 | if (*argv[x] == '/' || *argv[x] == ';')
|
|---|
| 5932 | continue;
|
|---|
| 5933 | if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE)) {
|
|---|
| 5934 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]);
|
|---|
| 5935 | }
|
|---|
| 5936 | }
|
|---|
| 5937 | }
|
|---|
| 5938 | PostMsg(MainObjectHwnd, UM_SETUP5, MPVOID, MPVOID);
|
|---|
| 5939 | return 0;
|
|---|
| 5940 |
|
|---|
| 5941 | case UM_SETUP5:
|
|---|
| 5942 | // if (fAutoTile)
|
|---|
| 5943 | // TileChildren(hwnd, TRUE);
|
|---|
| 5944 | PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
|---|
| 5945 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
|---|
| 5946 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
|---|
| 5947 | PostMsg(hwnd, UM_FILLBUTTONLIST, MPVOID, MPVOID);
|
|---|
| 5948 | {
|
|---|
| 5949 | HWND hwndActive;
|
|---|
| 5950 |
|
|---|
| 5951 | hwndActive = TopWindow(hwnd, hwndTree);
|
|---|
| 5952 | if (hwndActive)
|
|---|
| 5953 | WinSetWindowPos(hwndActive, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
|
|---|
| 5954 | }
|
|---|
| 5955 | if (fStartMinimized || fReminimize)
|
|---|
| 5956 | PostMsg(hwndTree, UM_MINIMIZE, MPVOID, MPVOID);
|
|---|
| 5957 | else if (fStartMaximized)
|
|---|
| 5958 | PostMsg(hwndTree, UM_MAXIMIZE, MPVOID, MPVOID);
|
|---|
| 5959 | fRunning = TRUE;
|
|---|
| 5960 | if (fWantFirstTimeInit) {
|
|---|
| 5961 | fWantFirstTimeInit = FALSE;
|
|---|
| 5962 | PostMsg(hwnd, WM_COMMAND, MPFROMLONG(IDM_QUICKSETTINGS), MPVOID);
|
|---|
| 5963 | }
|
|---|
| 5964 | return 0;
|
|---|
| 5965 | }
|
|---|
| 5966 |
|
|---|
| 5967 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
|---|
| 5968 | }
|
|---|
| 5969 |
|
|---|
| 5970 | MRESULT EXPENTRY MainWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|---|
| 5971 | {
|
|---|
| 5972 | switch (msg) {
|
|---|
| 5973 | case WM_CREATE:
|
|---|
| 5974 | # ifdef FORTIFY
|
|---|
| 5975 | Fortify_EnterScope();
|
|---|
| 5976 | # endif
|
|---|
| 5977 | case UM_SETUP:
|
|---|
| 5978 | case UM_SETUP2:
|
|---|
| 5979 | case UM_SETUP3:
|
|---|
| 5980 | case UM_SETUP4:
|
|---|
| 5981 | case UM_SETUP5:
|
|---|
| 5982 | return MainWMOnce(hwnd, msg, mp1, mp2);
|
|---|
| 5983 |
|
|---|
| 5984 | case WM_CONTROLPOINTER:
|
|---|
| 5985 | if (!fNoFinger &&
|
|---|
| 5986 | (SHORT1FROMMP(mp1) == IDM_OPENWALK ||
|
|---|
| 5987 | SHORT1FROMMP(mp1) == IDM_USERLIST))
|
|---|
| 5988 | return MRFROMLONG(hptrFinger);
|
|---|
| 5989 | break;
|
|---|
| 5990 |
|
|---|
| 5991 | case UM_LOADFILE:
|
|---|
| 5992 | case UM_THREADUSE:
|
|---|
| 5993 | case UM_BUILDDRIVEBAR:
|
|---|
| 5994 | return CommonMainWndProc(hwnd, msg, mp1, mp2);
|
|---|
| 5995 |
|
|---|
| 5996 | case WM_BUTTON1UP:
|
|---|
| 5997 | case WM_BUTTON2UP:
|
|---|
| 5998 | case WM_BUTTON3UP:
|
|---|
| 5999 | case WM_MOUSEMOVE:
|
|---|
| 6000 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
|---|
| 6001 | break;
|
|---|
| 6002 |
|
|---|
| 6003 | case WM_CHAR:
|
|---|
| 6004 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
|---|
| 6005 | break;
|
|---|
| 6006 |
|
|---|
| 6007 | case WM_MENUEND:
|
|---|
| 6008 | if ((HWND) mp2 == MainPopupMenu) {
|
|---|
| 6009 | WinDestroyWindow(MainPopupMenu);
|
|---|
| 6010 | MainPopupMenu = (HWND) 0;
|
|---|
| 6011 | }
|
|---|
| 6012 | break;
|
|---|
| 6013 |
|
|---|
| 6014 | case UM_CONTEXTMENU:
|
|---|
| 6015 | case WM_CONTEXTMENU:
|
|---|
| 6016 | if (CheckMenu(hwndMainMenu, &MainPopupMenu, MAIN_POPUP)) {
|
|---|
| 6017 | SetToggleChecks(MainPopupMenu);
|
|---|
| 6018 | PopupMenu(hwnd, hwnd, MainPopupMenu);
|
|---|
| 6019 | }
|
|---|
| 6020 | if (msg == UM_CONTEXTMENU)
|
|---|
| 6021 | return 0;
|
|---|
| 6022 | return MRFROMSHORT(TRUE);
|
|---|
| 6023 |
|
|---|
| 6024 | case UM_SETUSERLISTNAME:
|
|---|
| 6025 | if (mp1) {
|
|---|
| 6026 | if (fUserComboBox)
|
|---|
| 6027 | WinSetWindowText(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
|---|
| 6028 | (CHAR *)mp1);
|
|---|
| 6029 | if (add_udir(FALSE, (CHAR *)mp1)) {
|
|---|
| 6030 | if (fUserComboBox && fAutoAddDirs) {
|
|---|
| 6031 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
|---|
| 6032 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
|---|
| 6033 | MPFROMP((CHAR *)mp1));
|
|---|
| 6034 | }
|
|---|
| 6035 | }
|
|---|
| 6036 | }
|
|---|
| 6037 | return 0;
|
|---|
| 6038 |
|
|---|
| 6039 | case UM_ARRANGEICONS:
|
|---|
| 6040 | ArrangeIcons(hwnd);
|
|---|
| 6041 | return 0;
|
|---|
| 6042 |
|
|---|
| 6043 | case WM_CHORD:
|
|---|
| 6044 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
|---|
| 6045 | break;
|
|---|
| 6046 |
|
|---|
| 6047 | case WM_SETFOCUS:
|
|---|
| 6048 | if (mp2)
|
|---|
| 6049 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
|---|
| 6050 | break;
|
|---|
| 6051 |
|
|---|
| 6052 | case UM_FOCUSME:
|
|---|
| 6053 | WinSetFocus(hwndTree, TRUE);
|
|---|
| 6054 | return 0;
|
|---|
| 6055 |
|
|---|
| 6056 | case UM_RESCAN:
|
|---|
| 6057 | TileChildren(hwnd, TRUE);
|
|---|
| 6058 | return 0;
|
|---|
| 6059 |
|
|---|
| 6060 | case WM_SAVEAPPLICATION:
|
|---|
| 6061 | {
|
|---|
| 6062 | SWP swp;
|
|---|
| 6063 |
|
|---|
| 6064 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
|---|
| 6065 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) {
|
|---|
| 6066 | WinStoreWindowPos(FM2Str,
|
|---|
| 6067 | "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT));
|
|---|
| 6068 | if (!fNoSaveState && fSaveState)
|
|---|
| 6069 | SaveDirCnrState(hwnd, GetPString(IDS_SHUTDOWNSTATE));
|
|---|
| 6070 | }
|
|---|
| 6071 | }
|
|---|
| 6072 | break;
|
|---|
| 6073 |
|
|---|
| 6074 | case MM_PORTHOLEINIT:
|
|---|
| 6075 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| 6076 | case 0:
|
|---|
| 6077 | case 1:
|
|---|
| 6078 | {
|
|---|
| 6079 | HWND hwndCurrent;
|
|---|
| 6080 | ULONG wmsg;
|
|---|
| 6081 |
|
|---|
| 6082 | wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
|
|---|
| 6083 | hwndCurrent = TopWindow(hwnd, (HWND) 0);
|
|---|
| 6084 | PortholeInit((HWND) WinSendMsg(WinWindowFromID(hwndCurrent,
|
|---|
| 6085 | FID_CLIENT), wmsg,
|
|---|
| 6086 | MPVOID, MPVOID), mp1, mp2);
|
|---|
| 6087 | }
|
|---|
| 6088 | break;
|
|---|
| 6089 | }
|
|---|
| 6090 | break;
|
|---|
| 6091 |
|
|---|
| 6092 | case WM_INITMENU:
|
|---|
| 6093 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| 6094 | case IDM_CONFIGMENU:
|
|---|
| 6095 | SetToggleChecks((HWND) WinQueryWindowULong(hwnd, QWL_USER));
|
|---|
| 6096 | break;
|
|---|
| 6097 |
|
|---|
| 6098 | case IDM_WINDOWSMENU:
|
|---|
| 6099 | /*
|
|---|
| 6100 | * add child windows of client
|
|---|
| 6101 | * and switchlist entries to end of pulldown menu
|
|---|
| 6102 | */
|
|---|
| 6103 | {
|
|---|
| 6104 | HWND hwndMenu, hwndSubMenu;
|
|---|
| 6105 | MENUITEM mi;
|
|---|
| 6106 |
|
|---|
| 6107 | hwndMenu = WinQueryWindowULong(hwnd, QWL_USER);
|
|---|
| 6108 | memset(&mi, 0, sizeof(mi));
|
|---|
| 6109 | mi.iPosition = MIT_END;
|
|---|
| 6110 | mi.afStyle = MIS_TEXT;
|
|---|
| 6111 | if (!WinSendMsg(hwndMenu, MM_QUERYITEM,
|
|---|
| 6112 | MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))
|
|---|
| 6113 | break;
|
|---|
| 6114 | hwndSubMenu = mi.hwndSubMenu;
|
|---|
| 6115 | SetupWinList(hwndSubMenu, hwnd, WinQueryWindow(hwnd, QW_PARENT));
|
|---|
| 6116 | }
|
|---|
| 6117 | break;
|
|---|
| 6118 |
|
|---|
| 6119 | default:
|
|---|
| 6120 | {
|
|---|
| 6121 | HWND hwndCurrent;
|
|---|
| 6122 |
|
|---|
| 6123 | hwndCurrent = TopWindow(hwnd, (HWND) 0);
|
|---|
| 6124 | if (hwndCurrent)
|
|---|
| 6125 | WinSendMsg(hwndCurrent, UM_INITMENU, mp1, mp2);
|
|---|
| 6126 | }
|
|---|
| 6127 | break;
|
|---|
| 6128 | }
|
|---|
| 6129 | break;
|
|---|
| 6130 |
|
|---|
| 6131 | case UM_ADDTOMENU:
|
|---|
| 6132 | AddToMenu((CHAR *)mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 6133 | FID_MENU));
|
|---|
| 6134 | return 0;
|
|---|
| 6135 |
|
|---|
| 6136 | case UM_FILLCMDLIST:
|
|---|
| 6137 | WinSendMsg(hwndCmdlist, LM_DELETEALL, MPVOID, MPVOID);
|
|---|
| 6138 | if (!cmdloaded)
|
|---|
| 6139 | load_commands();
|
|---|
| 6140 | if (cmdhead) {
|
|---|
| 6141 |
|
|---|
| 6142 | LINKCMDS *info;
|
|---|
| 6143 |
|
|---|
| 6144 | info = cmdhead;
|
|---|
| 6145 | while (info) {
|
|---|
| 6146 | WinSendMsg(hwndCmdlist, LM_INSERTITEM,
|
|---|
| 6147 | MPFROM2SHORT(LIT_END, 0), MPFROMP(info->title));
|
|---|
| 6148 | info = info->next;
|
|---|
| 6149 | }
|
|---|
| 6150 | }
|
|---|
| 6151 | return 0;
|
|---|
| 6152 |
|
|---|
| 6153 | case UM_FILLSETUPLIST:
|
|---|
| 6154 | fill_setups_list();
|
|---|
| 6155 | return 0;
|
|---|
| 6156 |
|
|---|
| 6157 | case UM_FILLBUTTONLIST:
|
|---|
| 6158 | WinSendMsg(hwndButtonlist, LM_DELETEALL, MPVOID, MPVOID);
|
|---|
| 6159 | if (fUserComboBox) {
|
|---|
| 6160 |
|
|---|
| 6161 | BOOL foundit = FALSE, thisone;
|
|---|
| 6162 | ULONG ulSearchCount;
|
|---|
| 6163 | SHORT sSelect;
|
|---|
| 6164 | FILEFINDBUF3 findbuf;
|
|---|
| 6165 | HDIR hDir;
|
|---|
| 6166 | CHAR *p;
|
|---|
| 6167 |
|
|---|
| 6168 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 6169 | hDir = HDIR_CREATE;
|
|---|
| 6170 | ulSearchCount = 1;
|
|---|
| 6171 | if (!DosFindFirst("*.TLS", &hDir, FILE_READONLY | FILE_ARCHIVED,
|
|---|
| 6172 | &findbuf, sizeof(FILEFINDBUF3),
|
|---|
| 6173 | &ulSearchCount, FIL_STANDARD)) {
|
|---|
| 6174 | do {
|
|---|
| 6175 | priority_bumped();
|
|---|
| 6176 | if (!foundit) {
|
|---|
| 6177 | thisone = FALSE;
|
|---|
| 6178 | p = strrchr(lasttoolbar, '\\');
|
|---|
| 6179 | if (!p)
|
|---|
| 6180 | p = lasttoolbar;
|
|---|
| 6181 | else
|
|---|
| 6182 | p++;
|
|---|
| 6183 | if (!stricmp(findbuf.achName, p))
|
|---|
| 6184 | thisone = TRUE;
|
|---|
| 6185 | }
|
|---|
| 6186 | p = strrchr(findbuf.achName, '.');
|
|---|
| 6187 | if (p)
|
|---|
| 6188 | *p = 0;
|
|---|
| 6189 | sSelect = (SHORT) WinSendMsg(hwndButtonlist, LM_INSERTITEM,
|
|---|
| 6190 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
|---|
| 6191 | MPFROMP(findbuf.achName));
|
|---|
| 6192 | if (!foundit && thisone && sSelect >= 0) {
|
|---|
| 6193 | WinSendMsg(hwndButtonlist, LM_SELECTITEM,
|
|---|
| 6194 | MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE));
|
|---|
| 6195 | foundit = TRUE;
|
|---|
| 6196 | }
|
|---|
| 6197 | }
|
|---|
| 6198 | while (!DosFindNext(hDir, &findbuf, sizeof(FILEFINDBUF3),
|
|---|
| 6199 | &ulSearchCount));
|
|---|
| 6200 | DosFindClose(hDir);
|
|---|
| 6201 | priority_bumped();
|
|---|
| 6202 | }
|
|---|
| 6203 | WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBARTEXT));
|
|---|
| 6204 | }
|
|---|
| 6205 | return 0;
|
|---|
| 6206 |
|
|---|
| 6207 | case UM_FILLUSERLIST:
|
|---|
| 6208 | WinSendMsg(hwndUserlist, LM_DELETEALL, MPVOID, MPVOID);
|
|---|
| 6209 | if (fUserComboBox) {
|
|---|
| 6210 | ULONG ulDriveNum;
|
|---|
| 6211 | ULONG ulDriveMap;
|
|---|
| 6212 | ULONG ulSearchCount;
|
|---|
| 6213 | FILEFINDBUF3 findbuf;
|
|---|
| 6214 | HDIR hDir;
|
|---|
| 6215 | APIRET rc;
|
|---|
| 6216 | LINKDIRS *info;
|
|---|
| 6217 | LINKDIRS *temp;
|
|---|
| 6218 |
|
|---|
| 6219 | if (!loadedudirs)
|
|---|
| 6220 | load_udirs();
|
|---|
| 6221 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 6222 | DosQCurDisk(&ulDriveNum, &ulDriveMap);
|
|---|
| 6223 | info = udirhead;
|
|---|
| 6224 | while (info) {
|
|---|
| 6225 | if (IsFullName(info->path) &&
|
|---|
| 6226 | !(driveflags[toupper(*info->path) - 'A'] &
|
|---|
| 6227 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
|---|
| 6228 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 6229 | hDir = HDIR_CREATE;
|
|---|
| 6230 | ulSearchCount = 1;
|
|---|
| 6231 | if (!IsRoot(info->path))
|
|---|
| 6232 | rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
|
|---|
| 6233 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
|---|
| 6234 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
|---|
| 6235 | &findbuf, sizeof(FILEFINDBUF3),
|
|---|
| 6236 | &ulSearchCount, FIL_STANDARD);
|
|---|
| 6237 | else {
|
|---|
| 6238 | rc = 0;
|
|---|
| 6239 | findbuf.attrFile = FILE_DIRECTORY;
|
|---|
| 6240 | }
|
|---|
| 6241 | priority_bumped();
|
|---|
| 6242 | if (!rc) {
|
|---|
| 6243 | if (!IsRoot(info->path))
|
|---|
| 6244 | DosFindClose(hDir);
|
|---|
| 6245 | if (findbuf.attrFile & FILE_DIRECTORY)
|
|---|
| 6246 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
|---|
| 6247 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
|---|
| 6248 | MPFROMP(info->path));
|
|---|
| 6249 | else {
|
|---|
| 6250 | temp = info->next;
|
|---|
| 6251 | remove_udir(info->path);
|
|---|
| 6252 | info = temp;
|
|---|
| 6253 | continue;
|
|---|
| 6254 | }
|
|---|
| 6255 | }
|
|---|
| 6256 | else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
|
|---|
| 6257 | temp = info->next;
|
|---|
| 6258 | remove_udir(info->path);
|
|---|
| 6259 | info = temp;
|
|---|
| 6260 | continue;
|
|---|
| 6261 | }
|
|---|
| 6262 | }
|
|---|
| 6263 | info = info->next;
|
|---|
| 6264 | }
|
|---|
| 6265 | info = ldirhead;
|
|---|
| 6266 | while (info) {
|
|---|
| 6267 | if (IsFullName(info->path) &&
|
|---|
| 6268 | !(driveflags[toupper(*info->path) - 'A'] &
|
|---|
| 6269 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
|---|
| 6270 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 6271 | hDir = HDIR_CREATE;
|
|---|
| 6272 | ulSearchCount = 1;
|
|---|
| 6273 | if (!IsRoot(info->path))
|
|---|
| 6274 | rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
|
|---|
| 6275 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
|---|
| 6276 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
|---|
| 6277 | &findbuf, sizeof(FILEFINDBUF3),
|
|---|
| 6278 | &ulSearchCount, FIL_STANDARD);
|
|---|
| 6279 | else {
|
|---|
| 6280 | rc = 0;
|
|---|
| 6281 | findbuf.attrFile = FILE_DIRECTORY;
|
|---|
| 6282 | }
|
|---|
| 6283 | priority_bumped();
|
|---|
| 6284 | if (!rc) {
|
|---|
| 6285 | if (!IsRoot(info->path))
|
|---|
| 6286 | DosFindClose(hDir);
|
|---|
| 6287 | if (findbuf.attrFile & FILE_DIRECTORY)
|
|---|
| 6288 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
|---|
| 6289 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
|---|
| 6290 | MPFROMP(info->path));
|
|---|
| 6291 | else {
|
|---|
| 6292 | temp = info->next;
|
|---|
| 6293 | remove_udir(info->path);
|
|---|
| 6294 | info = temp;
|
|---|
| 6295 | continue;
|
|---|
| 6296 | }
|
|---|
| 6297 | }
|
|---|
| 6298 | else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
|
|---|
| 6299 | temp = info->next;
|
|---|
| 6300 | remove_udir(info->path);
|
|---|
| 6301 | info = temp;
|
|---|
| 6302 | continue;
|
|---|
| 6303 | }
|
|---|
| 6304 | }
|
|---|
| 6305 | info = info->next;
|
|---|
| 6306 | }
|
|---|
| 6307 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
|---|
| 6308 | MPFROM2SHORT(0, 0),
|
|---|
| 6309 | MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT)));
|
|---|
| 6310 | WinSetWindowText(hwndUserlist, GetPString(IDS_COMMONDIRTEXT));
|
|---|
| 6311 | }
|
|---|
| 6312 | return 0;
|
|---|
| 6313 |
|
|---|
| 6314 | case UM_SIZE:
|
|---|
| 6315 | if (fAutoTile)
|
|---|
| 6316 | TileChildren(hwnd, FALSE);
|
|---|
| 6317 | else
|
|---|
| 6318 | MoveChildrenAwayFromTree(hwnd);
|
|---|
| 6319 | return 0;
|
|---|
| 6320 |
|
|---|
| 6321 | case WM_SIZE:
|
|---|
| 6322 | ResizeChildren(hwnd, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1),
|
|---|
| 6323 | SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
|
|---|
| 6324 | break;
|
|---|
| 6325 |
|
|---|
| 6326 | case WM_ERASEBACKGROUND:
|
|---|
| 6327 | WinFillRect((HPS) mp1, (PRECTL) mp2, 0x00d0d0d0);
|
|---|
| 6328 | return 0;
|
|---|
| 6329 |
|
|---|
| 6330 | case WM_PAINT:
|
|---|
| 6331 | {
|
|---|
| 6332 | HPS hps;
|
|---|
| 6333 | RECTL rcl;
|
|---|
| 6334 |
|
|---|
| 6335 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
|---|
| 6336 | if (hps) {
|
|---|
| 6337 | WinQueryWindowRect(hwnd, &rcl);
|
|---|
| 6338 | WinFillRect(hps, &rcl, CLR_PALEGRAY);
|
|---|
| 6339 | WinEndPaint(hps);
|
|---|
| 6340 | }
|
|---|
| 6341 | }
|
|---|
| 6342 | break;
|
|---|
| 6343 |
|
|---|
| 6344 | case UM_CONTROL:
|
|---|
| 6345 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| 6346 | case MAIN_CMDLIST:
|
|---|
| 6347 | case MAIN_SETUPLIST:
|
|---|
| 6348 | case MAIN_DRIVELIST:
|
|---|
| 6349 | case MAIN_USERLIST:
|
|---|
| 6350 | case MAIN_BUTTONLIST:
|
|---|
| 6351 | switch (SHORT2FROMMP(mp1)) {
|
|---|
| 6352 | case CBN_ENTER:
|
|---|
| 6353 | {
|
|---|
| 6354 | HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 6355 | SHORT1FROMMP(mp1));
|
|---|
| 6356 | CHAR path[CCHMAXPATH];
|
|---|
| 6357 | ULONG ul;
|
|---|
| 6358 |
|
|---|
| 6359 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| 6360 | case MAIN_USERLIST:
|
|---|
| 6361 | ul = CCHMAXPATH;
|
|---|
| 6362 | break;
|
|---|
| 6363 | case MAIN_SETUPLIST:
|
|---|
| 6364 | ul = STATE_NAME_MAX_BYTES;
|
|---|
| 6365 | break;
|
|---|
| 6366 | default:
|
|---|
| 6367 | ul = 13; // fixme to not be hardcoded
|
|---|
| 6368 | }
|
|---|
| 6369 |
|
|---|
| 6370 | SetShiftState();
|
|---|
| 6371 | WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path);
|
|---|
| 6372 | bstrip(path);
|
|---|
| 6373 | if (*path) {
|
|---|
| 6374 | if (SHORT1FROMMP(mp1) == MAIN_USERLIST) {
|
|---|
| 6375 | if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) {
|
|---|
| 6376 | if (!LastDir ||
|
|---|
| 6377 | !WinSendMsg(WinQueryWindow(LastDir, QW_PARENT),
|
|---|
| 6378 | UM_CONTAINERDIR, MPFROMP(path), MPVOID))
|
|---|
| 6379 | strcpy(path, pFM2SaveDirectory);
|
|---|
| 6380 | if (!PMMkDir(hwnd, path, TRUE)) {
|
|---|
| 6381 | WinSetWindowText(hwndUL, GetPString(IDS_COMMONDIRTEXT));
|
|---|
| 6382 | break;
|
|---|
| 6383 | }
|
|---|
| 6384 | }
|
|---|
| 6385 | if (!IsFile(path) && !FindDirCnrByName(path, TRUE)) {
|
|---|
| 6386 |
|
|---|
| 6387 | HWND hwndDir;
|
|---|
| 6388 |
|
|---|
| 6389 | if ((fUserListSwitches &&
|
|---|
| 6390 | !(shiftstate & KC_SHIFT)) ||
|
|---|
| 6391 | (!fUserListSwitches && (shiftstate & KC_SHIFT))) {
|
|---|
| 6392 | hwndDir = FindDirCnr(hwnd);
|
|---|
| 6393 | if (hwndDir) {
|
|---|
| 6394 | WinSendMsg(LastDir, UM_SETDIR, MPFROMP(path), MPVOID);
|
|---|
| 6395 | break;
|
|---|
| 6396 | }
|
|---|
| 6397 | }
|
|---|
| 6398 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, path);
|
|---|
| 6399 | }
|
|---|
| 6400 | }
|
|---|
| 6401 | else if (SHORT1FROMMP(mp1) == MAIN_DRIVELIST) {
|
|---|
| 6402 | ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree,
|
|---|
| 6403 | FID_CLIENT),
|
|---|
| 6404 | TREE_CNR), path, FALSE, TRUE);
|
|---|
| 6405 | WinSetFocus(HWND_DESKTOP, hwndTree);
|
|---|
| 6406 | }
|
|---|
| 6407 | else if (SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) {
|
|---|
| 6408 | strcat(path, ".TLS");
|
|---|
| 6409 | load_tools(path);
|
|---|
| 6410 | PrfWriteProfileString(fmprof,
|
|---|
| 6411 | FM3Str, "LastToolbar", lasttoolbar);
|
|---|
| 6412 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
|---|
| 6413 | WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBARTEXT));
|
|---|
| 6414 | }
|
|---|
| 6415 | else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) {
|
|---|
| 6416 | CHAR szKey[80];
|
|---|
| 6417 | ULONG size, numsaves = 0;
|
|---|
| 6418 |
|
|---|
| 6419 | SetShiftState();
|
|---|
| 6420 | size = sizeof(ULONG);
|
|---|
| 6421 | sprintf(szKey, "%s.NumDirsLastTime", path); // path is state name
|
|---|
| 6422 | if (!PrfQueryProfileData(fmprof,
|
|---|
| 6423 | FM3Str,
|
|---|
| 6424 | szKey,
|
|---|
| 6425 | (PVOID)&numsaves,
|
|---|
| 6426 | &size))
|
|---|
| 6427 | {
|
|---|
| 6428 | if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) {
|
|---|
| 6429 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
|---|
| 6430 | GetPString(IDS_WARNINGTEXT),
|
|---|
| 6431 | GetPString(IDS_DOESNTEXISTTEXT), path);
|
|---|
| 6432 | }
|
|---|
| 6433 | else {
|
|---|
| 6434 | Win_Error2(hwnd, hwnd, __FILE__, __LINE__,
|
|---|
| 6435 | IDS_PRFQUERYPROFILEDATA);
|
|---|
| 6436 | }
|
|---|
| 6437 | }
|
|---|
| 6438 | else {
|
|---|
| 6439 | char *pszStateName;
|
|---|
| 6440 | if ((shiftstate & KC_SHIFT) == 0)
|
|---|
| 6441 | PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));
|
|---|
| 6442 | pszStateName = xstrdup(path, pszSrcFile, __LINE__);
|
|---|
| 6443 | if (!pszStateName) {
|
|---|
| 6444 | // Fall back if out of memory - already complained
|
|---|
| 6445 | if ((shiftstate & KC_SHIFT) != 0 || fAutoTile) {
|
|---|
| 6446 | // Autotile requested or forced
|
|---|
| 6447 | PostMsg(MainObjectHwnd,
|
|---|
| 6448 | UM_RESTORE,
|
|---|
| 6449 | MPVOID,
|
|---|
| 6450 | MPFROMLONG(1)); // Autotile
|
|---|
| 6451 | }
|
|---|
| 6452 | }
|
|---|
| 6453 | else if (!PostMsg(MainObjectHwnd,
|
|---|
| 6454 | UM_RESTORE,
|
|---|
| 6455 | MPFROMP(pszStateName),
|
|---|
| 6456 | MPVOID)) {
|
|---|
| 6457 | free(pszStateName);
|
|---|
| 6458 | }
|
|---|
| 6459 | }
|
|---|
| 6460 | }
|
|---|
| 6461 | else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) {
|
|---|
| 6462 |
|
|---|
| 6463 | SHORT sSelect;
|
|---|
| 6464 |
|
|---|
| 6465 | sSelect = (SHORT) WinSendMsg(hwndCmdlist,
|
|---|
| 6466 | LM_QUERYSELECTION,
|
|---|
| 6467 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
|---|
| 6468 | if (sSelect >= 0)
|
|---|
| 6469 | WinPostMsg(hwnd,
|
|---|
| 6470 | WM_COMMAND,
|
|---|
| 6471 | MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0),
|
|---|
| 6472 | MPVOID);
|
|---|
| 6473 | WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));
|
|---|
| 6474 | }
|
|---|
| 6475 | }
|
|---|
| 6476 | }
|
|---|
| 6477 | break;
|
|---|
| 6478 |
|
|---|
| 6479 | default:
|
|---|
| 6480 | break;
|
|---|
| 6481 | }
|
|---|
| 6482 | break;
|
|---|
| 6483 |
|
|---|
| 6484 | default:
|
|---|
| 6485 | break;
|
|---|
| 6486 | }
|
|---|
| 6487 | return 0;
|
|---|
| 6488 |
|
|---|
| 6489 | case WM_HELP:
|
|---|
| 6490 | WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
|
|---|
| 6491 | break;
|
|---|
| 6492 |
|
|---|
| 6493 | case UM_COMMAND:
|
|---|
| 6494 | case WM_COMMAND:
|
|---|
| 6495 |
|
|---|
| 6496 | return MainWMCommand(hwnd, msg, mp1, mp2);
|
|---|
| 6497 |
|
|---|
| 6498 | case WM_CLOSE:
|
|---|
| 6499 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 6500 | WM_SYSCOMMAND, MPFROM2SHORT(SC_RESTORE, 0), MPVOID);
|
|---|
| 6501 | WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
|---|
| 6502 | fAmClosing = TRUE;
|
|---|
| 6503 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
|---|
| 6504 | WM_SYSCOMMAND, MPFROM2SHORT(SC_MINIMIZE, 0), MPVOID);
|
|---|
| 6505 | if (CloseChildren(hwnd)) {
|
|---|
| 6506 | fAmClosing = FALSE;
|
|---|
| 6507 | if (fAutoTile)
|
|---|
| 6508 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TILE, 0), MPVOID);
|
|---|
| 6509 | return 0;
|
|---|
| 6510 | }
|
|---|
| 6511 | if (hwndTree) {
|
|---|
| 6512 | if (!PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID))
|
|---|
| 6513 | WinSendMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID);
|
|---|
| 6514 | }
|
|---|
| 6515 | DosSleep(1);
|
|---|
| 6516 | return 0; // Hold off WM_QUIT
|
|---|
| 6517 |
|
|---|
| 6518 | case UM_CLOSE:
|
|---|
| 6519 | HideNote();
|
|---|
| 6520 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
|---|
| 6521 | return 0;
|
|---|
| 6522 |
|
|---|
| 6523 | case UM_RESTORE:
|
|---|
| 6524 | {
|
|---|
| 6525 | // Try to restore saved shutdown state
|
|---|
| 6526 | char *pszDefaultStateName = xstrdup(GetPString(IDS_SHUTDOWNSTATE),
|
|---|
| 6527 | pszSrcFile, __LINE__);
|
|---|
| 6528 | if (pszDefaultStateName) {
|
|---|
| 6529 | if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID))
|
|---|
| 6530 | // 05 Feb 08 SHL fixme to complain?
|
|---|
| 6531 | free(pszDefaultStateName);
|
|---|
| 6532 | }
|
|---|
| 6533 | }
|
|---|
| 6534 | return 0;
|
|---|
| 6535 |
|
|---|
| 6536 | case UM_SETDIR:
|
|---|
| 6537 | /* mp1 == name of directory to open */
|
|---|
| 6538 | if (mp1)
|
|---|
| 6539 | return MRFROMLONG(OpenDirCnr((HWND) 0,
|
|---|
| 6540 | hwndMain,
|
|---|
| 6541 | hwndTree, (BOOL) mp2, (char *)mp1));
|
|---|
| 6542 | return 0;
|
|---|
| 6543 |
|
|---|
| 6544 | case WM_DESTROY:
|
|---|
| 6545 | hwndMain = (HWND) 0;
|
|---|
| 6546 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
|---|
| 6547 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
|---|
| 6548 | # ifdef FORTIFY
|
|---|
| 6549 | free_commands();
|
|---|
| 6550 | free_associations();
|
|---|
| 6551 | free_udirs();
|
|---|
| 6552 | free_ldir();
|
|---|
| 6553 | free_archivers();
|
|---|
| 6554 | free_tools();
|
|---|
| 6555 | free_setups();
|
|---|
| 6556 | Fortify_LeaveScope();
|
|---|
| 6557 | # endif
|
|---|
| 6558 | break;
|
|---|
| 6559 | }
|
|---|
| 6560 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
|---|
| 6561 | }
|
|---|
| 6562 |
|
|---|
| 6563 | VOID DeletePresParams(CHAR * pchKeyroot)
|
|---|
| 6564 | // This code assumes that pchKeyroot points to a buffer large enough to
|
|---|
| 6565 | // hold the full INI key: The state name.dircnr-number.PPName. The
|
|---|
| 6566 | // PPNames are listed below.
|
|---|
| 6567 | {
|
|---|
| 6568 | PSZ apszPPNames[] =
|
|---|
| 6569 | {
|
|---|
| 6570 | "Backgroundcolor",
|
|---|
| 6571 | "Foregroundcolor",
|
|---|
| 6572 | "Hilitebackgroundcolor",
|
|---|
| 6573 | "Hiliteforegroundcolor",
|
|---|
| 6574 | "Bordercolor",
|
|---|
| 6575 | "Fontnamesize"
|
|---|
| 6576 | };
|
|---|
| 6577 |
|
|---|
| 6578 | ULONG ulSize, ulArraySize = sizeof(apszPPNames) / sizeof(PSZ), x;
|
|---|
| 6579 | CHAR * eos = pchKeyroot + strlen(pchKeyroot);
|
|---|
| 6580 |
|
|---|
| 6581 | for (x = 0; x < ulArraySize; x++)
|
|---|
| 6582 | {
|
|---|
| 6583 | strcpy(eos, apszPPNames[x]);
|
|---|
| 6584 | if (PrfQueryProfileSize(fmprof, appname, pchKeyroot, &ulSize) && ulSize)
|
|---|
| 6585 | {
|
|---|
| 6586 | PrfWriteProfileData(fmprof, appname, pchKeyroot, NULL, ulSize);
|
|---|
| 6587 | }
|
|---|
| 6588 | }
|
|---|
| 6589 | }
|
|---|
| 6590 |
|
|---|
| 6591 | #pragma alloc_text(MISC8,SetToggleChecks,FindDirCnrByName,TopWindow)
|
|---|
| 6592 | #pragma alloc_text(MISC8,TopWindowName,CountDirCnrs)
|
|---|
| 6593 | #pragma alloc_text(MAINWND,AdjustSizeOfClient,FillClient,ChildButtonProc)
|
|---|
| 6594 | #pragma alloc_text(MAINWND,ToolBackProc,StatusProc)
|
|---|
| 6595 | #pragma alloc_text(MAINWND,MoveChildrenAwayFromTree,ArrangeIcons,NextChild)
|
|---|
| 6596 | #pragma alloc_text(MAINWND,ChildFrameButtonProc)
|
|---|
| 6597 | #pragma alloc_text(MAINWND2,CloseChildren,CountChildren,GetNextWindowPos)
|
|---|
| 6598 | #pragma alloc_text(MAINWND2,CascadeChildren,TileChildren,ResizeChildren)
|
|---|
| 6599 | #pragma alloc_text(MAINWND2,MinResChildren,MainFrameWndProc,MainWndProc)
|
|---|
| 6600 | #pragma alloc_text(MAINWND2,DropDownListProc)
|
|---|
| 6601 | #pragma alloc_text(MAINWND3,RestoreDirCnrState,SaveDirCnrState)
|
|---|
| 6602 | #pragma alloc_text(MAINWND3,CloseDirCnrChildren,TransformSwp)
|
|---|
| 6603 | #pragma alloc_text(MAINWND3,ResizeTools,BuildTools,CommandLineProc)
|
|---|
| 6604 | #pragma alloc_text(MAINWND4,DriveProc,DriveBackProc,BuildDriveBarButtons,ResizeDrives)
|
|---|
| 6605 | #pragma alloc_text(MAINWND4,LEDProc,IdealButtonProc)
|
|---|
| 6606 | #pragma alloc_text(MAINWND5,MainWMOnce)
|
|---|
| 6607 | #pragma alloc_text(MAINWND6,MainWMCommand)
|
|---|
| 6608 | #pragma alloc_text(BUBBLE,MakeBubble,BubbleProc,BubbleHelp)
|
|---|
| 6609 | #pragma alloc_text(MAINOBJ,MainObjectWndProc,MakeMainObjWin)
|
|---|
| 6610 |
|
|---|