[33] | 1 | /***********************************************************************
|
---|
| 2 |
|
---|
| 3 | $Id: mainwnd.c 1181 2008-09-10 21:55:02Z jbs $
|
---|
| 4 |
|
---|
[178] | 5 | fm/2 main window
|
---|
[33] | 6 |
|
---|
| 7 | Copyright (c) 1993-98 M. Kimes
|
---|
[907] | 8 | Copyright (c) 2001, 2008 Steven H. Levine
|
---|
[33] | 9 |
|
---|
[130] | 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
|
---|
[133] | 14 | 23 May 05 SHL Use datamin.h
|
---|
[162] | 15 | 25 May 05 SHL Use ULONGLONG and CommaFmtULL
|
---|
[178] | 16 | 26 May 05 SHL Comments and localize code
|
---|
[186] | 17 | 05 Jun 05 SHL Use QWL_USER
|
---|
[200] | 18 | 06 Jun 05 SHL Rework MainWMCommand for VAC3.65 compat
|
---|
[260] | 19 | 13 Aug 05 SHL Renames and comments
|
---|
[297] | 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
|
---|
[352] | 23 | 17 Jul 06 SHL Use Runtime_Error
|
---|
[447] | 24 | 17 Aug 06 SHL Complain nicer if state name does not exist
|
---|
[552] | 25 | 18 Feb 07 GKY More drive type and icon support
|
---|
[557] | 26 | 08 Mar 07 SHL SaveDirCnrState: do not save state of NOPRESCAN volumes
|
---|
[558] | 27 | 09 Mar 07 SHL RestoreDirCnrState/SaveDirCnrState: optimize and avoid overflows
|
---|
[593] | 28 | 30 Mar 07 GKY Remove GetPString for window class names
|
---|
[603] | 29 | 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
|
---|
| 30 | 06 Apr 07 GKY Add some error checking in drag/drop
|
---|
[618] | 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
|
---|
[672] | 34 | 12 May 07 SHL Use dcd->ulItemsToUnHilite
|
---|
[688] | 35 | 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
|
---|
[775] | 36 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
|
---|
[773] | 37 | 07 Aug 07 SHL Use BldQuotedFileName
|
---|
[787] | 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
|
---|
[789] | 41 | 19 Aug 07 SHL Rework SaveDirCnrState to return better error info
|
---|
[824] | 42 | 30 Aug 07 SHL Add accelerator support to quicklist windows
|
---|
[872] | 43 | 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
|
---|
[921] | 44 | 12 Jan 08 SHL Support drag&drop dialog toggle
|
---|
[925] | 45 | 16 Jan 08 SHL Add sync updates toggle
|
---|
[927] | 46 | 16 Jan 08 GKY Fix changing background color on toolbar
|
---|
[940] | 47 | 17 Jan 08 GKY Add presparam save & restore for individual directory containers
|
---|
[965] | 48 | 19 Jan 08 JBS Ticket 150: fix/improve save and restore of dir cnr state at FM/2 close/reopen
|
---|
[940] | 49 | 19 Jan 08 GKY Rework Utilities menu
|
---|
[941] | 50 | 05 Feb 08 SHL Restore no-prescan drives if restoring named state
|
---|
[953] | 51 | 14 Feb 08 SHL Rework to support settings menu conditional cascade
|
---|
[954] | 52 | 15 Feb 08 SHL Rework ResizeChildren to honor fNoTreeGap and resize drive tree better
|
---|
[965] | 53 | 19 Feb 08 JBS Stop deleting "State at last FM/2 Close" from INI file so it be accessed from States combo box.
|
---|
[971] | 54 | 22 Feb 08 JBS Ticket 230: Fix/improve various code related to state or presparam values in the INI file.
|
---|
[985] | 55 | 29 Feb 08 GKY Use xfree where appropriate
|
---|
[1027] | 56 | 19 Jun 08 JBS Ticket 227: Allow temporary saving/deleting of the shutdown state of directory containers
|
---|
[1029] | 57 | 22 Jun 08 GKY Use free_... functions for fortify checking
|
---|
[1033] | 58 | 30 Jun 08 JBS Ticket 103: Fix restore of previous shutdown state when opening FM/2
|
---|
[1061] | 59 | 07 Jul 08 JBS Ticket 242: Delete obsolete INI keys when re-saving a state
|
---|
[1065] | 60 | 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
|
---|
[1077] | 61 | all the details view settings (both the global variables and those in the
|
---|
| 62 | DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
|
---|
[1066] | 63 | 12 Jul 08 JBS Ticket 246: Allow saved directory container states to have no directory containers
|
---|
[1077] | 64 | (i.e. just a directory tree container).
|
---|
[1104] | 65 | 18 Jul 08 SHL Use new Fortify feature to avoid spurious reports
|
---|
| 66 | 19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory
|
---|
[1121] | 67 | 26 Aug 08 GKY Require unique ID plus text and help strings for all tools save toolbar on button delete
|
---|
[1128] | 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)
|
---|
[1140] | 70 | 01 Sep 08 GKY Save toolbars immediately on change. Add bmps for default toolbars
|
---|
[33] | 71 |
|
---|
| 72 | ***********************************************************************/
|
---|
| 73 |
|
---|
[907] | 74 | #include <stdlib.h>
|
---|
| 75 | #include <string.h>
|
---|
| 76 | #include <ctype.h>
|
---|
[1077] | 77 | #include <process.h> // _beginthread
|
---|
[907] | 78 |
|
---|
[2] | 79 | #define INCL_DOS
|
---|
| 80 | #define INCL_WIN
|
---|
[1077] | 81 | #define INCL_SHLERRORS // PMERR_NOT_IN_IDX
|
---|
[2] | 82 | #define INCL_WINHELP
|
---|
| 83 | #define INCL_GPI
|
---|
[162] | 84 | #define INCL_LONGLONG
|
---|
[2] | 85 |
|
---|
[1181] | 86 | #include "fm3dll.h"
|
---|
[2] | 87 | #include "fm3dlg.h"
|
---|
| 88 | #include "fm3str.h"
|
---|
| 89 | #include "tools.h"
|
---|
[907] | 90 | #include "comp.h"
|
---|
[133] | 91 | #include "datamin.h"
|
---|
[1077] | 92 | #include "pathutil.h" // BldQuotedFileName
|
---|
| 93 | #include "errutil.h" // Dos_Error...
|
---|
| 94 | #include "strutil.h" // GetPString
|
---|
| 95 | #include "notebook.h" // CfgDlgProc CfgMenuInit
|
---|
| 96 | #include "command.h" // LINKCMDS
|
---|
| 97 | #include "avl.h" // free_archivers
|
---|
| 98 | #include "walkem.h" // free_setups...
|
---|
[1158] | 99 | #include "key.h" // AboutDlgProc
|
---|
| 100 | #include "menu.h" // AddToMenu
|
---|
| 101 | #include "mainwnd.h"
|
---|
| 102 | #include "cmdline.h" // CmdLine2DlgProc, save_cmdlines
|
---|
| 103 | #include "common.h" // CommonCreateMainChildren, CommonDriveCmd, CommonMainWndProc
|
---|
[1181] | 104 | // CommonTextButton
|
---|
[1158] | 105 | #include "notify.h" // DoNotify, HideNote, ShowNote
|
---|
| 106 | #include "draglist.h" // DragOne
|
---|
| 107 | #include "chklist.h" // DropListProc
|
---|
| 108 | #include "avv.h" // EditArchiverDefinition
|
---|
| 109 | #include "assoc.h" // EditAssociations
|
---|
| 110 | #include "fm2cmd.h" // FM2Command
|
---|
| 111 | #include "misc.h" // FindDirCnr, FixSwitchList, PaintSTextWindow,
|
---|
| 112 | // SetConditionalCascade, SetMenuCheck, SetSysMenu
|
---|
[1181] | 113 | // SwitchCommand, CheckMenu, DrawTargetEmphasis
|
---|
| 114 | // IsFm2Window
|
---|
[1158] | 115 | #include "instant.h" // InstantDlgProc
|
---|
| 116 | #include "killproc.h" // KillDlgProc
|
---|
| 117 | #include "loadbmp.h" // LoadBitmapFromFileNum
|
---|
| 118 | #include "presparm.h" // SavePresParams
|
---|
| 119 | #include "treecnr.h" // ShowTreeRec, StartTreeCnr
|
---|
| 120 | #include "inis.h" // StartIniEditor
|
---|
| 121 | #include "sysinfo.h" // SysInfoDlgProc
|
---|
| 122 | #include "viewinf.h" // ViewInfProc
|
---|
| 123 | #include "walkem.h" // WalkDlgProc, WalkTwoCmpDlgProc, add_setup, add_udir
|
---|
| 124 | // fill_setups_list, free_ldir, free_udirs, load_udirs
|
---|
| 125 | // remove_setup, remove_udir, save_setups, save_udirs
|
---|
| 126 | #include "winlist.h" // WindowList
|
---|
| 127 | #include "cmdline.h" // add_cmdline
|
---|
| 128 | #include "assoc.h" // free_associations
|
---|
[1181] | 129 | #include "droplist.h" // AcceptOneDrop, CheckPmDrgLimit, DropHelp, GetOneDrop
|
---|
| 130 | #include "common.h" // CommonTextProc
|
---|
| 131 | #include "presparm.h" // CopyPresParams
|
---|
| 132 | #include "systemf.h" // ExecOnList
|
---|
| 133 | #include "shadow.h" // OpenObject
|
---|
| 134 | #include "mkdir.h" // PMMkDir
|
---|
| 135 | #include "collect.h" // StartCollector
|
---|
| 136 | #include "select.h" // UnHilite
|
---|
| 137 | #include "strips.h" // bstrip
|
---|
| 138 | #include "commafmt.h" // CommaFmtULL
|
---|
| 139 | #include "valid.h" // IsFullName
|
---|
| 140 | #include "dirs.h" // save_dir2
|
---|
| 141 | #include "wrappers.h" // xfree
|
---|
[1017] | 142 | #include "fortify.h"
|
---|
| 143 |
|
---|
[2] | 144 | #pragma data_seg(DATA1)
|
---|
[352] | 145 |
|
---|
| 146 | static PSZ pszSrcFile = __FILE__;
|
---|
| 147 |
|
---|
[178] | 148 | static USHORT firsttool = 0;
|
---|
[2] | 149 |
|
---|
[200] | 150 | static BOOL CloseDirCnrChildren(HWND hwndClient);
|
---|
[557] | 151 | static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview);
|
---|
[1060] | 152 | static VOID DeletePresParams(PSZ pszKeyroot);
|
---|
[1125] | 153 | static VOID BuildTools(HWND hwndT, BOOL resize);
|
---|
[2] | 154 |
|
---|
[551] | 155 | static MRESULT EXPENTRY MainObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
[1077] | 156 | MPARAM mp2)
|
---|
[133] | 157 | {
|
---|
[551] | 158 | switch (msg) {
|
---|
[1077] | 159 | case WM_CREATE:
|
---|
| 160 | break;
|
---|
| 161 |
|
---|
[133] | 162 | case UM_SETUP:
|
---|
| 163 | case UM_SETUP2:
|
---|
| 164 | case UM_SETUP3:
|
---|
| 165 | case UM_SETUP4:
|
---|
| 166 | case UM_SETUP5:
|
---|
| 167 | /*
|
---|
| 168 | * feed setup messages to main window
|
---|
| 169 | */
|
---|
| 170 | PostMsg(hwndMain, msg, mp1, mp2);
|
---|
| 171 | return 0;
|
---|
[2] | 172 |
|
---|
[133] | 173 | case UM_SETUP6:
|
---|
| 174 | /*
|
---|
| 175 | * handle bubble help requests from drive bar buttons
|
---|
| 176 | */
|
---|
| 177 | {
|
---|
| 178 | char dv[3], d;
|
---|
[551] | 179 | HWND hwndB = (HWND) mp1;
|
---|
[133] | 180 | USHORT id;
|
---|
[2] | 181 |
|
---|
[133] | 182 | id = WinQueryWindowUShort(hwndB, QWS_ID);
|
---|
| 183 | *dv = 0;
|
---|
| 184 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwndB, QW_PARENT),
|
---|
[1077] | 185 | id + 50), sizeof(dv), dv);
|
---|
[133] | 186 | d = toupper(*dv);
|
---|
| 187 | if (isalpha(d) && d > 'B' &&
|
---|
[1077] | 188 | !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID |
|
---|
| 189 | DRIVE_SLOW)) &&
|
---|
| 190 | (!hwndBubble ||
|
---|
| 191 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&
|
---|
| 192 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
[2] | 193 |
|
---|
[1077] | 194 | FSALLOCATE fsa;
|
---|
| 195 | CHAR s[90], szQty[38];
|
---|
| 196 | ULONG ulPctFree;
|
---|
| 197 | ULONGLONG ullFreeQty;
|
---|
[2] | 198 |
|
---|
[1077] | 199 | if (!DosQueryFSInfo((d - 'A') + 1,
|
---|
| 200 | FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {
|
---|
| 201 | ullFreeQty = (ULONGLONG) fsa.cUnitAvail *
|
---|
| 202 | (fsa.cSectorUnit * fsa.cbSector);
|
---|
| 203 | ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ?
|
---|
| 204 | (fsa.cUnitAvail * 100) / fsa.cUnit : 0;
|
---|
| 205 | CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' ');
|
---|
| 206 | sprintf(s, "%s (%lu%%) free", szQty, ulPctFree);
|
---|
| 207 | }
|
---|
| 208 | if ((!hwndBubble ||
|
---|
| 209 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&
|
---|
| 210 | !WinQueryCapture(HWND_DESKTOP))
|
---|
| 211 | WinSendMsg(hwndB, UM_SETUP6, MPFROMP(s), MPVOID);
|
---|
[2] | 212 | }
|
---|
[133] | 213 | }
|
---|
| 214 | return 0;
|
---|
[2] | 215 |
|
---|
[133] | 216 | case UM_SETDIR:
|
---|
| 217 | {
|
---|
| 218 | CHAR s[8] = " :\\OS2";
|
---|
| 219 | ULONG bd;
|
---|
[2] | 220 |
|
---|
[133] | 221 | if (DosQuerySysInfo(QSV_BOOT_DRIVE,
|
---|
[1077] | 222 | QSV_BOOT_DRIVE,
|
---|
| 223 | (PVOID) & bd, (ULONG) sizeof(ULONG)))
|
---|
| 224 | bd = 3L;
|
---|
[133] | 225 | *s = (CHAR) bd + '@';
|
---|
[787] | 226 | WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPFROMLONG(1));
|
---|
[551] | 227 | if (!mp1) {
|
---|
[1077] | 228 | s[3] = 0;
|
---|
| 229 | WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID);
|
---|
[133] | 230 | }
|
---|
[787] | 231 | PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1), MPFROMLONG(1));
|
---|
[133] | 232 | }
|
---|
| 233 | return 0;
|
---|
[2] | 234 |
|
---|
[133] | 235 | case UM_RESTORE:
|
---|
[941] | 236 | switch ((ULONG)mp2) {
|
---|
| 237 | case 1:
|
---|
| 238 | TileChildren(hwndMain, TRUE);
|
---|
| 239 | break;
|
---|
| 240 | case 2:
|
---|
| 241 | CloseDirCnrChildren(hwndMain);
|
---|
| 242 | break;
|
---|
| 243 | case 0:
|
---|
[133] | 244 | fNoTileUpdate = TRUE;
|
---|
| 245 | WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), FALSE);
|
---|
[551] | 246 | RestoreDirCnrState(hwndMain, (char *)mp1, FALSE);
|
---|
[133] | 247 | WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), TRUE);
|
---|
| 248 | fNoTileUpdate = FALSE;
|
---|
[1011] | 249 | //xfree((char *)mp1, pszSrcFile, __LINE__);
|
---|
[1033] | 250 | // if (fAutoTile)
|
---|
| 251 | // TileChildren(hwndMain, TRUE);
|
---|
[941] | 252 | break;
|
---|
| 253 | default:
|
---|
| 254 | Runtime_Error(pszSrcFile, __LINE__, "%u unexpected", mp2);
|
---|
[133] | 255 | }
|
---|
| 256 | return 0;
|
---|
[2] | 257 |
|
---|
[133] | 258 | case UM_NOTIFY:
|
---|
| 259 | /*
|
---|
| 260 | * bring up notify messages for various windows
|
---|
| 261 | */
|
---|
| 262 | if (mp1)
|
---|
[551] | 263 | return MRFROMLONG(DoNotify((char *)mp1));
|
---|
[133] | 264 | return 0;
|
---|
[2] | 265 |
|
---|
[133] | 266 | case WM_DESTROY:
|
---|
[551] | 267 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
| 268 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
---|
[133] | 269 | break;
|
---|
| 270 | }
|
---|
| 271 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 272 | }
|
---|
| 273 |
|
---|
[133] | 274 | VOID MakeMainObjWin(VOID * args)
|
---|
| 275 | {
|
---|
| 276 | HAB hab2;
|
---|
| 277 | HMQ hmq2;
|
---|
| 278 | QMSG qmsg2;
|
---|
[2] | 279 |
|
---|
[133] | 280 | priority_bumped();
|
---|
| 281 | hab2 = WinInitialize(0);
|
---|
[551] | 282 | if (hab2) {
|
---|
[133] | 283 | hmq2 = WinCreateMsgQueue(hab2, 128);
|
---|
[551] | 284 | if (hmq2) {
|
---|
[133] | 285 | DosError(FERR_DISABLEHARDERR);
|
---|
| 286 | WinRegisterClass(hab2,
|
---|
[1077] | 287 | (PSZ) WC_OBJECTWINDOW,
|
---|
| 288 | MainObjectWndProc, 0, sizeof(PVOID));
|
---|
[133] | 289 | MainObjectHwnd = WinCreateWindow(HWND_OBJECT,
|
---|
[1077] | 290 | WC_OBJECTWINDOW,
|
---|
| 291 | (PSZ) NULL,
|
---|
| 292 | 0,
|
---|
| 293 | 0L,
|
---|
| 294 | 0L,
|
---|
| 295 | 0L,
|
---|
| 296 | 0L,
|
---|
| 297 | 0L, HWND_TOP, OBJ_FRAME, NULL, NULL);
|
---|
[376] | 298 | if (!MainObjectHwnd)
|
---|
[1077] | 299 | Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 300 | IDS_WINCREATEWINDOW);
|
---|
[551] | 301 | else {
|
---|
[1077] | 302 | WinSetWindowPtr(MainObjectHwnd, QWL_USER, args);
|
---|
| 303 | # ifdef FORTIFY
|
---|
| 304 | Fortify_EnterScope();
|
---|
| 305 | # endif
|
---|
| 306 | while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0))
|
---|
| 307 | WinDispatchMsg(hab2, &qmsg2);
|
---|
| 308 | WinDestroyWindow(MainObjectHwnd);
|
---|
| 309 | # ifdef FORTIFY
|
---|
| 310 | Fortify_LeaveScope();
|
---|
| 311 | # endif
|
---|
[133] | 312 | }
|
---|
| 313 | WinDestroyMsgQueue(hmq2);
|
---|
| 314 | }
|
---|
| 315 | WinTerminate(hab2);
|
---|
| 316 | }
|
---|
[2] | 317 | }
|
---|
| 318 |
|
---|
[551] | 319 | static MRESULT EXPENTRY IdealButtonProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
[1077] | 320 | MPARAM mp2)
|
---|
[133] | 321 | {
|
---|
[551] | 322 | switch (msg) {
|
---|
[133] | 323 | case WM_MOUSEMOVE:
|
---|
[551] | 324 | BubbleHelp(hwnd, TRUE, FALSE, FALSE, GetPString(IDS_IDEALBUTTONHELP));
|
---|
[133] | 325 | break;
|
---|
| 326 | }
|
---|
| 327 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
[2] | 328 | }
|
---|
| 329 |
|
---|
[133] | 330 | HWND TopWindow(HWND hwndParent, HWND exclude)
|
---|
| 331 | {
|
---|
| 332 | HENUM henum;
|
---|
[551] | 333 | HWND hwndC = (HWND) 0;
|
---|
[133] | 334 | USHORT id;
|
---|
[2] | 335 |
|
---|
[551] | 336 | if (hwndParent) {
|
---|
[133] | 337 | henum = WinBeginEnumWindows(hwndMain);
|
---|
[551] | 338 | while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 339 | if (hwndC != exclude) {
|
---|
[1077] | 340 | id = WinQueryWindowUShort(hwndC, QWS_ID);
|
---|
| 341 | if (id)
|
---|
| 342 | break;
|
---|
[133] | 343 | }
|
---|
| 344 | }
|
---|
| 345 | WinEndEnumWindows(henum);
|
---|
| 346 | }
|
---|
| 347 | return hwndC;
|
---|
[2] | 348 | }
|
---|
| 349 |
|
---|
[133] | 350 | HWND TopWindowName(HWND hwndParent, HWND exclude, CHAR * ret)
|
---|
| 351 | {
|
---|
| 352 | HENUM henum;
|
---|
[551] | 353 | HWND hwndC = (HWND) 0, hwndDir, hwndClient;
|
---|
[133] | 354 | USHORT id;
|
---|
| 355 | PCNRITEM pci = NULL;
|
---|
[2] | 356 |
|
---|
[551] | 357 | if (ret) {
|
---|
[133] | 358 | *ret = 0;
|
---|
[551] | 359 | if (hwndParent) {
|
---|
[133] | 360 | henum = WinBeginEnumWindows(hwndMain);
|
---|
[551] | 361 | while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[1077] | 362 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC);
|
---|
| 363 | if (hwndC != exclude && hwndC != hwndTree) {
|
---|
| 364 | id = WinQueryWindowUShort(hwndC, QWS_ID);
|
---|
| 365 | if (id) {
|
---|
| 366 | hwndClient = WinWindowFromID(hwndC, FID_CLIENT);
|
---|
| 367 | if (hwndClient) {
|
---|
| 368 | hwndDir = WinWindowFromID(hwndClient, DIR_CNR);
|
---|
| 369 | if (hwndDir) {
|
---|
| 370 | if (fLookInDir) {
|
---|
| 371 | pci = (PCNRITEM) WinSendMsg(hwndDir,
|
---|
| 372 | CM_QUERYRECORDEMPHASIS,
|
---|
| 373 | MPFROMLONG(CMA_FIRST),
|
---|
| 374 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 375 | if (pci && (INT) pci != -1)
|
---|
| 376 | break;
|
---|
| 377 | }
|
---|
| 378 | if (WinSendMsg(hwndClient,
|
---|
| 379 | UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) {
|
---|
| 380 | MakeValidDir(ret);
|
---|
| 381 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret);
|
---|
| 382 | WinEndEnumWindows(henum);
|
---|
| 383 | return hwndC;
|
---|
| 384 | }
|
---|
| 385 | }
|
---|
| 386 | }
|
---|
| 387 | }
|
---|
| 388 | }
|
---|
[133] | 389 | }
|
---|
| 390 | WinEndEnumWindows(henum);
|
---|
[551] | 391 | if (!pci || (INT) pci == -1) {
|
---|
[1077] | 392 | hwndC = hwndTree;
|
---|
| 393 | pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree,
|
---|
| 394 | FID_CLIENT),
|
---|
| 395 | TREE_CNR),
|
---|
| 396 | CM_QUERYRECORDEMPHASIS,
|
---|
| 397 | MPFROMLONG(CMA_FIRST),
|
---|
| 398 | MPFROMSHORT(CRA_CURSORED));
|
---|
[133] | 399 | }
|
---|
[551] | 400 | if (pci && (INT) pci != -1) {
|
---|
[1077] | 401 | strcpy(ret, pci->pszFileName);
|
---|
| 402 | MakeValidDir(ret);
|
---|
[133] | 403 | }
|
---|
| 404 | else
|
---|
[1104] | 405 | strcpy(ret, pFM2SaveDirectory);
|
---|
[133] | 406 | }
|
---|
| 407 | }
|
---|
| 408 | return hwndC;
|
---|
[2] | 409 | }
|
---|
| 410 |
|
---|
[133] | 411 | ULONG CountDirCnrs(HWND hwndParent)
|
---|
| 412 | {
|
---|
[2] | 413 | HENUM henum;
|
---|
[551] | 414 | HWND hwndF = (HWND) 0, hwndC, hwndDir;
|
---|
[2] | 415 | ULONG ret = 0;
|
---|
| 416 |
|
---|
| 417 | henum = WinBeginEnumWindows(hwndParent);
|
---|
[551] | 418 | while ((hwndF = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 419 | hwndC = WinWindowFromID(hwndF, FID_CLIENT);
|
---|
[551] | 420 | if (hwndC) {
|
---|
[133] | 421 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
---|
| 422 | if (hwndDir)
|
---|
[1077] | 423 | ret++;
|
---|
[2] | 424 | }
|
---|
| 425 | }
|
---|
| 426 | WinEndEnumWindows(henum);
|
---|
| 427 | return ret;
|
---|
| 428 | }
|
---|
| 429 |
|
---|
[133] | 430 | HWND FindDirCnrByName(CHAR * directory, BOOL restore)
|
---|
| 431 | {
|
---|
| 432 | HENUM henum;
|
---|
[551] | 433 | HWND hwndF = (HWND) 0, hwndC, hwndDir;
|
---|
[133] | 434 | CHAR retstr[CCHMAXPATH];
|
---|
[2] | 435 |
|
---|
[551] | 436 | if (hwndMain) {
|
---|
[69] | 437 | henum = WinBeginEnumWindows(hwndMain);
|
---|
[551] | 438 | while ((hwndF = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 439 | hwndC = WinWindowFromID(hwndF, FID_CLIENT);
|
---|
[551] | 440 | if (hwndC) {
|
---|
[1077] | 441 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
---|
| 442 | if (hwndDir) {
|
---|
| 443 | *retstr = 0;
|
---|
| 444 | WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID);
|
---|
| 445 | if (*retstr && !stricmp(retstr, directory)) {
|
---|
| 446 | if (restore)
|
---|
| 447 | WinSetWindowPos(hwndF,
|
---|
| 448 | HWND_TOP,
|
---|
| 449 | 0,
|
---|
| 450 | 0,
|
---|
| 451 | 0,
|
---|
| 452 | 0,
|
---|
| 453 | SWP_RESTORE | SWP_SHOW |
|
---|
| 454 | SWP_ACTIVATE | SWP_ZORDER);
|
---|
| 455 | break;
|
---|
| 456 | }
|
---|
| 457 | }
|
---|
[69] | 458 | }
|
---|
| 459 | }
|
---|
| 460 | WinEndEnumWindows(henum);
|
---|
| 461 | }
|
---|
| 462 | return hwndF;
|
---|
[2] | 463 | }
|
---|
| 464 |
|
---|
[178] | 465 | static VOID SetToggleChecks(HWND hwndMenu)
|
---|
[133] | 466 | {
|
---|
[551] | 467 | WinCheckMenuItem(hwndMenu, IDM_TEXTTOOLS, fTextTools);
|
---|
| 468 | WinCheckMenuItem(hwndMenu, IDM_TOOLTITLES, fToolTitles);
|
---|
| 469 | WinCheckMenuItem(hwndMenu, IDM_USERLIST, fUserComboBox);
|
---|
| 470 | WinCheckMenuItem(hwndMenu, IDM_TOOLSUBMENU, fToolbar);
|
---|
| 471 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWSUBMENU, fAutoView);
|
---|
| 472 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWFILE, !fComments);
|
---|
| 473 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWCOMMENTS, fComments);
|
---|
| 474 | WinCheckMenuItem(hwndMenu, IDM_MOREBUTTONS, fMoreButtons);
|
---|
| 475 | WinCheckMenuItem(hwndMenu, IDM_DRIVEBAR, fDrivebar);
|
---|
| 476 | WinCheckMenuItem(hwndMenu, IDM_AUTOTILE, fAutoTile);
|
---|
| 477 | WinCheckMenuItem(hwndMenu, IDM_TILEBACKWARDS, fTileBackwards);
|
---|
[921] | 478 | WinCheckMenuItem(hwndMenu, IDM_TOGGLEDRAGDIALOG, fDragndropDlg);
|
---|
[925] | 479 | WinCheckMenuItem(hwndMenu, IDM_SYNCUPDATES, fSyncUpdates);
|
---|
[2] | 480 | }
|
---|
| 481 |
|
---|
[178] | 482 | static VOID ResizeTools(HWND hwnd)
|
---|
[133] | 483 | {
|
---|
| 484 | register ULONG butx = 18L;
|
---|
| 485 | INT attrib = SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER | SWP_NOREDRAW,
|
---|
[551] | 486 | noattrib;
|
---|
[133] | 487 | register TOOL *tool, *starttool;
|
---|
| 488 | SWP *swp;
|
---|
| 489 | register ULONG numtools, x;
|
---|
[2] | 490 |
|
---|
[133] | 491 | if (!fToolbar)
|
---|
| 492 | return;
|
---|
| 493 | noattrib = attrib;
|
---|
| 494 | noattrib &= (~(SWP_SHOW | SWP_ZORDER));
|
---|
| 495 | noattrib |= SWP_HIDE;
|
---|
| 496 | /* count tools */
|
---|
| 497 | tool = toolhead;
|
---|
| 498 | for (numtools = 0L; tool; numtools++)
|
---|
[551] | 499 | tool = tool->next;
|
---|
[133] | 500 | /* allocate swp array for WinSetMultWindowPos */
|
---|
[551] | 501 | swp = xmallocz(sizeof(SWP) * (numtools + 2), pszSrcFile, __LINE__);
|
---|
[352] | 502 | if (swp) {
|
---|
| 503 | for (x = 0; x < numtools + 2L; x++) {
|
---|
[133] | 504 | swp[x].hwndInsertBehind = HWND_TOP;
|
---|
| 505 | swp[x].fl = attrib;
|
---|
| 506 | swp[x].y = (fToolTitles) ? 14L : 3L;
|
---|
| 507 | swp[x].cx = 32L;
|
---|
| 508 | swp[x].cy = 32L;
|
---|
| 509 | }
|
---|
| 510 | swp[0].x = swp[1].x = 2L;
|
---|
| 511 | swp[0].y = (fTextTools) ? 14L : 18L;
|
---|
| 512 | swp[1].y = (fTextTools) ? 1L : 2L;
|
---|
| 513 | swp[0].cx = swp[1].cx = 14L;
|
---|
| 514 | swp[0].cy = swp[1].cy = 14L;
|
---|
| 515 | swp[0].hwnd = WinWindowFromID(hwnd, IDM_TOOLLEFT);
|
---|
| 516 | swp[1].hwnd = WinWindowFromID(hwnd, IDM_TOOLRIGHT);
|
---|
| 517 | x = 2L;
|
---|
| 518 | tool = find_tool(firsttool);
|
---|
| 519 | if (!tool)
|
---|
| 520 | tool = toolhead;
|
---|
| 521 | starttool = tool;
|
---|
[551] | 522 | while (tool) {
|
---|
| 523 | if (!(tool->flags & T_INVISIBLE)) {
|
---|
[1077] | 524 | swp[x].x = butx;
|
---|
| 525 | if (fTextTools || (tool->flags & T_TEXT)) {
|
---|
| 526 | butx += 55L;
|
---|
| 527 | swp[x].cx = 54L;
|
---|
| 528 | swp[x].cy = 24L;
|
---|
| 529 | swp[x].y = 3L;
|
---|
| 530 | }
|
---|
| 531 | else
|
---|
| 532 | butx += 33L;
|
---|
| 533 | if (tool->flags & T_SEPARATOR)
|
---|
| 534 | butx += 12;
|
---|
[133] | 535 | }
|
---|
| 536 | else
|
---|
[1077] | 537 | swp[x].fl = noattrib;
|
---|
[551] | 538 | swp[x].hwnd = WinWindowFromID(hwnd, tool->id);
|
---|
[133] | 539 | x++;
|
---|
[551] | 540 | tool = tool->next;
|
---|
[133] | 541 | }
|
---|
| 542 | tool = toolhead;
|
---|
[551] | 543 | while (tool && tool != starttool) {
|
---|
[133] | 544 | swp[x].x = butx;
|
---|
[551] | 545 | if (!(tool->flags & T_INVISIBLE)) {
|
---|
[1077] | 546 | if (fTextTools || (tool->flags & T_TEXT)) {
|
---|
| 547 | butx += 55L;
|
---|
| 548 | swp[x].cx = 54L;
|
---|
| 549 | swp[x].cy = 24L;
|
---|
| 550 | swp[x].y = 3L;
|
---|
| 551 | }
|
---|
| 552 | else
|
---|
| 553 | butx += 33L;
|
---|
| 554 | if (tool->flags & T_SEPARATOR)
|
---|
| 555 | butx += 12;
|
---|
[133] | 556 | }
|
---|
| 557 | else
|
---|
[1077] | 558 | swp[x].fl = noattrib;
|
---|
[551] | 559 | swp[x].hwnd = WinWindowFromID(hwnd, tool->id);
|
---|
[133] | 560 | x++;
|
---|
[551] | 561 | tool = tool->next;
|
---|
[133] | 562 | }
|
---|
| 563 | WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), swp, numtools + 2L);
|
---|
[551] | 564 | if (!fTextTools && fToolTitles) {
|
---|
| 565 | for (x = 2L; x < numtools + 2L; x++) {
|
---|
[1077] | 566 | if (fTextTools || !fToolTitles)
|
---|
| 567 | swp[x].fl = noattrib;
|
---|
| 568 | else {
|
---|
| 569 | tool = find_tool(WinQueryWindowUShort(swp[x].hwnd, QWS_ID));
|
---|
| 570 | if (tool && (tool->flags & T_TEXT))
|
---|
| 571 | swp[x].fl = noattrib;
|
---|
| 572 | else {
|
---|
| 573 | swp[x].hwndInsertBehind = HWND_TOP;
|
---|
| 574 | swp[x].y = 1L;
|
---|
| 575 | swp[x].cy = 10L;
|
---|
| 576 | }
|
---|
| 577 | }
|
---|
| 578 | swp[x].hwnd = WinWindowFromID(hwnd,
|
---|
| 579 | WinQueryWindowUShort(swp[x].hwnd,
|
---|
| 580 | QWS_ID) + 25000);
|
---|
[133] | 581 | }
|
---|
| 582 | WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), &swp[2], numtools);
|
---|
| 583 | }
|
---|
[1039] | 584 | free(swp);
|
---|
[133] | 585 | }
|
---|
| 586 | WinInvalidateRect(hwnd, NULL, TRUE);
|
---|
[2] | 587 | }
|
---|
| 588 |
|
---|
[551] | 589 | static MRESULT EXPENTRY DropDownListProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
[1077] | 590 | MPARAM mp2)
|
---|
[133] | 591 | {
|
---|
| 592 | PFNWP oldproc = (PFNWP) INSTDATA(hwnd);
|
---|
| 593 | USHORT id;
|
---|
[824] | 594 |
|
---|
| 595 | static HWND hwndMenu = (HWND)0;
|
---|
[133] | 596 | static BOOL emphasized = FALSE;
|
---|
[2] | 597 |
|
---|
[551] | 598 | switch (msg) {
|
---|
[133] | 599 | case WM_MOUSEMOVE:
|
---|
| 600 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 601 | break;
|
---|
[2] | 602 |
|
---|
[133] | 603 | case WM_CHAR:
|
---|
| 604 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 605 | break;
|
---|
[2] | 606 |
|
---|
[133] | 607 | case WM_MENUEND:
|
---|
[551] | 608 | if (hwndMenu == (HWND) mp2) {
|
---|
[133] | 609 | WinDestroyWindow(hwndMenu);
|
---|
[551] | 610 | hwndMenu = (HWND) 0;
|
---|
[133] | 611 | }
|
---|
| 612 | break;
|
---|
[2] | 613 |
|
---|
[824] | 614 | case WM_FOCUSCHANGE:
|
---|
| 615 | {
|
---|
| 616 | HAB hab = WinQueryAnchorBlock(hwnd);
|
---|
| 617 | HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT);
|
---|
| 618 | HWND hwndFrame = WinQueryWindow(hwndParent, QW_PARENT);
|
---|
| 619 | static HACCEL haccelSaved = NULLHANDLE;
|
---|
| 620 | static HACCEL haccelDriveList = NULLHANDLE;
|
---|
| 621 | static HACCEL haccelSetupList = NULLHANDLE;
|
---|
| 622 | static HACCEL haccelUserList = NULLHANDLE;
|
---|
| 623 | static HACCEL haccelCmdList = NULLHANDLE;
|
---|
| 624 | static HACCEL haccelButtonList = NULLHANDLE;
|
---|
| 625 | // DbgMsg(pszSrcFile, __LINE__, "WM_FOCUSCHANGE %u", SHORT1FROMMP(mp2));
|
---|
| 626 | id = WinQueryWindowUShort(hwndParent, QWS_ID);
|
---|
| 627 | if (SHORT1FROMMP(mp2)) {
|
---|
[1077] | 628 | // If getting focus 1st time - save original accelerator
|
---|
| 629 | if (haccelSaved == NULLHANDLE) {
|
---|
| 630 | haccelSaved = WinQueryAccelTable(hab, hwndFrame);
|
---|
| 631 | if (haccelSaved == NULLHANDLE)
|
---|
| 632 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable");
|
---|
| 633 | // else
|
---|
| 634 | // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved);
|
---|
| 635 | }
|
---|
| 636 | if (haccelSaved != NULLHANDLE) {
|
---|
| 637 | switch (id) {
|
---|
| 638 | case MAIN_DRIVELIST:
|
---|
| 639 | if (haccelDriveList == NULLHANDLE) {
|
---|
| 640 | haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST);
|
---|
| 641 | if (haccelDriveList == NULLHANDLE)
|
---|
| 642 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
| 643 | }
|
---|
| 644 | if (haccelDriveList != NULLHANDLE) {
|
---|
| 645 | if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame))
|
---|
| 646 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
| 647 | // else
|
---|
| 648 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList);
|
---|
| 649 | }
|
---|
| 650 | break;
|
---|
| 651 | case MAIN_SETUPLIST:
|
---|
| 652 | if (haccelSetupList == NULLHANDLE) {
|
---|
| 653 | haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST);
|
---|
| 654 | if (haccelSetupList == NULLHANDLE)
|
---|
| 655 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
| 656 | }
|
---|
| 657 | if (haccelSetupList != NULLHANDLE) {
|
---|
| 658 | if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame))
|
---|
| 659 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
| 660 | // else
|
---|
| 661 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList);
|
---|
| 662 | }
|
---|
| 663 | break;
|
---|
| 664 | case MAIN_CMDLIST:
|
---|
| 665 | if (haccelCmdList == NULLHANDLE) {
|
---|
| 666 | haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST);
|
---|
| 667 | if (haccelCmdList == NULLHANDLE)
|
---|
| 668 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
| 669 | }
|
---|
| 670 | if (haccelCmdList != NULLHANDLE) {
|
---|
| 671 | if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame))
|
---|
| 672 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
| 673 | // else
|
---|
| 674 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList);
|
---|
| 675 | }
|
---|
| 676 | break;
|
---|
| 677 | case MAIN_USERLIST:
|
---|
| 678 | if (haccelUserList == NULLHANDLE) {
|
---|
| 679 | haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST);
|
---|
| 680 | if (haccelUserList == NULLHANDLE)
|
---|
| 681 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
| 682 | }
|
---|
| 683 | if (haccelUserList != NULLHANDLE) {
|
---|
| 684 | if (!WinSetAccelTable(hab, haccelUserList, hwndFrame))
|
---|
| 685 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
| 686 | // else
|
---|
| 687 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList);
|
---|
| 688 | }
|
---|
| 689 | break;
|
---|
| 690 | case MAIN_BUTTONLIST:
|
---|
| 691 | if (haccelButtonList == NULLHANDLE) {
|
---|
| 692 | haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST);
|
---|
| 693 | if (haccelButtonList == NULLHANDLE)
|
---|
| 694 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
| 695 | }
|
---|
| 696 | if (haccelButtonList != NULLHANDLE) {
|
---|
| 697 | if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame))
|
---|
| 698 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
| 699 | // else
|
---|
| 700 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList);
|
---|
| 701 | }
|
---|
| 702 | break;
|
---|
| 703 | } // switch
|
---|
| 704 | }
|
---|
[824] | 705 | }
|
---|
| 706 | else {
|
---|
[1077] | 707 | // Losing focus
|
---|
| 708 | switch (id) {
|
---|
| 709 | case MAIN_DRIVELIST:
|
---|
| 710 | case MAIN_SETUPLIST:
|
---|
| 711 | case MAIN_CMDLIST:
|
---|
| 712 | case MAIN_USERLIST:
|
---|
| 713 | case MAIN_BUTTONLIST:
|
---|
| 714 | if (haccelSaved != NULLHANDLE) {
|
---|
| 715 | if (!WinSetAccelTable(hab, haccelSaved, hwndFrame))
|
---|
| 716 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
| 717 | // else
|
---|
| 718 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved);
|
---|
| 719 | }
|
---|
| 720 | break;
|
---|
| 721 | } // switch
|
---|
[824] | 722 | }
|
---|
| 723 | }
|
---|
| 724 | break; // WM_FOCUSCHANGE
|
---|
| 725 |
|
---|
[133] | 726 | case WM_CONTEXTMENU:
|
---|
| 727 | {
|
---|
| 728 | MRESULT ret = MRFROMSHORT(TRUE);
|
---|
[2] | 729 |
|
---|
[133] | 730 | if (hwndMenu)
|
---|
[1077] | 731 | WinDestroyWindow(hwndMenu);
|
---|
[551] | 732 | hwndMenu = (HWND) 0;
|
---|
[133] | 733 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
[551] | 734 | switch (id) {
|
---|
[133] | 735 | case MAIN_CMDLIST:
|
---|
[1077] | 736 | WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 737 | QW_PARENT),
|
---|
| 738 | QW_PARENT),
|
---|
| 739 | FID_CLIENT),
|
---|
| 740 | WM_COMMAND, MPFROM2SHORT(IDM_EDITCOMMANDS, 0), MPVOID);
|
---|
| 741 | break;
|
---|
[133] | 742 | case MAIN_USERLIST:
|
---|
| 743 | case MAIN_SETUPLIST:
|
---|
[1077] | 744 | hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
|
---|
| 745 | if (hwndMenu)
|
---|
| 746 | PopupMenu(hwnd,
|
---|
| 747 | WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 748 | QW_PARENT),
|
---|
| 749 | QW_PARENT),
|
---|
| 750 | FID_CLIENT), hwndMenu);
|
---|
| 751 | break;
|
---|
[133] | 752 | default:
|
---|
[1077] | 753 | ret = FALSE;
|
---|
| 754 | break;
|
---|
[824] | 755 | } // switch
|
---|
[133] | 756 | return ret;
|
---|
| 757 | }
|
---|
[2] | 758 |
|
---|
[133] | 759 | case WM_CONTROL:
|
---|
[551] | 760 | if (hwndStatus2) {
|
---|
| 761 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 762 | case CBID_EDIT:
|
---|
[1077] | 763 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 764 | switch (SHORT2FROMMP(mp1)) {
|
---|
| 765 | case EN_SETFOCUS:
|
---|
| 766 | switch (id) {
|
---|
| 767 | case MAIN_CMDLIST:
|
---|
| 768 | WinSetWindowText(hwndStatus2, GetPString(IDS_CMDLISTHELP));
|
---|
| 769 | break;
|
---|
| 770 | case MAIN_SETUPLIST:
|
---|
| 771 | WinSetWindowText(hwndStatus2, GetPString(IDS_SETUPLISTHELP));
|
---|
| 772 | break;
|
---|
| 773 | case MAIN_USERLIST:
|
---|
| 774 | WinSetWindowText(hwndStatus2, GetPString(IDS_USERLISTHELP));
|
---|
| 775 | break;
|
---|
| 776 | case MAIN_DRIVELIST:
|
---|
| 777 | WinSetWindowText(hwndStatus2, GetPString(IDS_DRIVELISTHELP));
|
---|
| 778 | break;
|
---|
| 779 | case MAIN_BUTTONLIST:
|
---|
| 780 | WinSetWindowText(hwndStatus2, GetPString(IDS_BUTTONLISTHELP));
|
---|
| 781 | break;
|
---|
| 782 | default:
|
---|
| 783 | break;
|
---|
| 784 | }
|
---|
| 785 | break;
|
---|
[2] | 786 |
|
---|
[1077] | 787 | default:
|
---|
| 788 | break;
|
---|
| 789 | }
|
---|
[133] | 790 | }
|
---|
| 791 | break;
|
---|
[2] | 792 |
|
---|
[133] | 793 | default:
|
---|
| 794 | break;
|
---|
| 795 | }
|
---|
| 796 | break;
|
---|
[2] | 797 |
|
---|
[133] | 798 | case WM_BEGINDRAG:
|
---|
| 799 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[447] | 800 | // 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);
|
---|
[133] | 801 | if (id == CBID_EDIT &&
|
---|
[1077] | 802 | WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) ==
|
---|
| 803 | MAIN_USERLIST) {
|
---|
[2] | 804 |
|
---|
[133] | 805 | CHAR path[CCHMAXPATH];
|
---|
[2] | 806 |
|
---|
[133] | 807 | *path = 0;
|
---|
| 808 | WinQueryWindowText(hwnd, CCHMAXPATH, path);
|
---|
| 809 | bstrip(path);
|
---|
[447] | 810 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Dragging: %s",path);
|
---|
[133] | 811 | if (*path && !IsRoot(path))
|
---|
[1077] | 812 | DragOne(hwnd, (HWND) 0, path, FALSE);
|
---|
[133] | 813 | return 0;
|
---|
| 814 | }
|
---|
| 815 | break;
|
---|
[2] | 816 |
|
---|
[133] | 817 | case DM_DRAGOVER:
|
---|
| 818 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
[551] | 819 | if (id == MAIN_USERLIST) {
|
---|
| 820 | if (!emphasized) {
|
---|
[1077] | 821 | emphasized = TRUE;
|
---|
| 822 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 823 | }
|
---|
[618] | 824 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
---|
[1077] | 825 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
---|
[133] | 826 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
---|
| 827 | }
|
---|
| 828 | break;
|
---|
[2] | 829 |
|
---|
[133] | 830 | case DM_DRAGLEAVE:
|
---|
| 831 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
[551] | 832 | if (id == MAIN_USERLIST) {
|
---|
| 833 | if (emphasized) {
|
---|
[1077] | 834 | emphasized = FALSE;
|
---|
| 835 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 836 | }
|
---|
| 837 | }
|
---|
| 838 | break;
|
---|
[2] | 839 |
|
---|
[133] | 840 | case DM_DROPHELP:
|
---|
| 841 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
[551] | 842 | if (id == MAIN_USERLIST) {
|
---|
[133] | 843 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_USERLISTDROPHELP));
|
---|
| 844 | return 0;
|
---|
| 845 | }
|
---|
| 846 | break;
|
---|
[2] | 847 |
|
---|
[133] | 848 | case DM_DROP:
|
---|
| 849 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
[551] | 850 | if (id == MAIN_USERLIST) {
|
---|
[2] | 851 |
|
---|
[133] | 852 | char szFrom[CCHMAXPATH + 2];
|
---|
[2] | 853 |
|
---|
[551] | 854 | if (emphasized) {
|
---|
[1077] | 855 | emphasized = FALSE;
|
---|
| 856 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 857 | }
|
---|
[618] | 858 | if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
|
---|
[1077] | 859 | MakeValidDir(szFrom);
|
---|
| 860 | WinSetWindowText(hwnd, szFrom);
|
---|
| 861 | PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 862 | QW_PARENT),
|
---|
| 863 | QW_PARENT),
|
---|
| 864 | FID_CLIENT),
|
---|
| 865 | UM_COMMAND, MPFROM2SHORT(IDM_ADDTOUSERLIST, 0), MPVOID);
|
---|
| 866 | return 0;
|
---|
[133] | 867 | }
|
---|
| 868 | }
|
---|
| 869 | break;
|
---|
[2] | 870 |
|
---|
[133] | 871 | case WM_DESTROY:
|
---|
| 872 | if (hwndMenu)
|
---|
| 873 | WinDestroyWindow(hwndMenu);
|
---|
[551] | 874 | hwndMenu = (HWND) 0;
|
---|
[133] | 875 | break;
|
---|
| 876 | }
|
---|
[2] | 877 |
|
---|
[133] | 878 | return oldproc(hwnd, msg, mp1, mp2);
|
---|
[2] | 879 | }
|
---|
| 880 |
|
---|
[133] | 881 | void BubbleHelp(HWND hwnd, BOOL other, BOOL drive, BOOL above, char *help)
|
---|
| 882 | {
|
---|
| 883 | if (help && *help &&
|
---|
| 884 | ((drive && fDrivebarHelp) ||
|
---|
[551] | 885 | (other && fOtherHelp) || (!other && !drive && fToolbarHelp))) {
|
---|
[133] | 886 | if ((!hwndBubble ||
|
---|
[1077] | 887 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
---|
| 888 | !WinQueryCapture(HWND_DESKTOP))
|
---|
[551] | 889 | MakeBubble(hwnd, above, help);
|
---|
[133] | 890 | }
|
---|
[2] | 891 | }
|
---|
| 892 |
|
---|
[133] | 893 | VOID MakeBubble(HWND hwnd, BOOL above, CHAR * help)
|
---|
| 894 | {
|
---|
| 895 | if (!hwnd || !help || !*help)
|
---|
| 896 | return;
|
---|
[2] | 897 |
|
---|
[133] | 898 | if (hwndBubble)
|
---|
| 899 | WinDestroyWindow(hwndBubble);
|
---|
[2] | 900 |
|
---|
[133] | 901 | {
|
---|
| 902 | HWND hwndActive;
|
---|
| 903 | char ucClassname[8];
|
---|
[2] | 904 |
|
---|
[133] | 905 | hwndActive = WinQueryActiveWindow(HWND_DESKTOP);
|
---|
[551] | 906 | if (hwndActive) {
|
---|
[133] | 907 | /* don't bring up help if window isn't active */
|
---|
| 908 | if (!WinIsChild(hwnd, hwndActive))
|
---|
[1077] | 909 | return;
|
---|
[133] | 910 | }
|
---|
| 911 | hwndActive = WinQueryFocus(HWND_DESKTOP);
|
---|
[551] | 912 | if (WinQueryClassName(hwndActive, sizeof(ucClassname), ucClassname)) {
|
---|
[133] | 913 | /* don't bring up help if a menu is active */
|
---|
| 914 | if (!strcmp(ucClassname, "#4"))
|
---|
[1077] | 915 | return;
|
---|
[133] | 916 | }
|
---|
| 917 | }
|
---|
[2] | 918 |
|
---|
| 919 | hwndBubble = WinCreateWindow(HWND_DESKTOP,
|
---|
[1077] | 920 | WC_BUBBLE,
|
---|
| 921 | help,
|
---|
| 922 | WS_CLIPSIBLINGS | SS_TEXT |
|
---|
| 923 | DT_CENTER | DT_VCENTER,
|
---|
| 924 | 0,
|
---|
| 925 | 0,
|
---|
| 926 | 0,
|
---|
| 927 | 0,
|
---|
| 928 | HWND_DESKTOP, HWND_TOP, MAIN_HELP, NULL, NULL);
|
---|
[376] | 929 | if (!hwndBubble)
|
---|
[551] | 930 | Win_Error2(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
[1077] | 931 | IDS_WINCREATEWINDOW);
|
---|
[551] | 932 | else {
|
---|
[133] | 933 | HPS hps;
|
---|
| 934 | POINTL aptl[TXTBOX_COUNT], ptl, tptl;
|
---|
| 935 | LONG lxScreen, sx, sy, extra = 0, lyScreen;
|
---|
| 936 | char *p, *pp, *wp;
|
---|
| 937 | SWP swp;
|
---|
[2] | 938 |
|
---|
[133] | 939 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 940 | lyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
|
---|
| 941 | lxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
|
---|
| 942 | WinSetWindowULong(hwndBubble, QWL_USER, hwnd);
|
---|
[551] | 943 | SetPresParams(hwndBubble, NULL, NULL, NULL, GetPString(IDS_8HELVTEXT));
|
---|
[133] | 944 | hps = WinGetPS(hwndBubble);
|
---|
| 945 | p = help;
|
---|
| 946 | tptl.x = tptl.y = 0;
|
---|
[551] | 947 | while (p && *p) {
|
---|
[133] | 948 | wp = NULL;
|
---|
| 949 | pp = strchr(p, '\r');
|
---|
[551] | 950 | if (pp) {
|
---|
[1077] | 951 | wp = pp;
|
---|
| 952 | *pp = 0;
|
---|
| 953 | pp++;
|
---|
[133] | 954 | }
|
---|
| 955 | GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
|
---|
| 956 | tptl.x = max(aptl[TXTBOX_TOPRIGHT].x, tptl.x);
|
---|
| 957 | if (tptl.y)
|
---|
[1077] | 958 | tptl.y += extra;
|
---|
[133] | 959 | else
|
---|
[1077] | 960 | extra = aptl[TXTBOX_TOPLEFT].y / 4;
|
---|
[133] | 961 | tptl.y += aptl[TXTBOX_TOPLEFT].y;
|
---|
| 962 | if (wp)
|
---|
[1077] | 963 | *wp = '\r';
|
---|
[133] | 964 | p = pp;
|
---|
| 965 | }
|
---|
| 966 | WinSetWindowULong(hwndBubble, QWL_USER + 4, extra);
|
---|
| 967 | WinReleasePS(hps);
|
---|
| 968 | ptl.x = ptl.y = 0;
|
---|
| 969 | WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptl, 1);
|
---|
[551] | 970 | if (above) {
|
---|
[133] | 971 | sy = ptl.y + swp.cy + 4;
|
---|
[551] | 972 | if (sy + tptl.y + 12 > lyScreen) {
|
---|
[1077] | 973 | above = FALSE;
|
---|
| 974 | sy = ptl.y - (tptl.y + 14);
|
---|
[133] | 975 | }
|
---|
| 976 | }
|
---|
| 977 | else
|
---|
| 978 | sy = ptl.y - (tptl.y + 14);
|
---|
| 979 | if (ptl.x > (lxScreen / 2))
|
---|
| 980 | sx = (ptl.x - tptl.x) - 16;
|
---|
| 981 | else
|
---|
| 982 | sx = ptl.x + (54 * (above == FALSE)) + 2;
|
---|
| 983 | if (sx < 0)
|
---|
| 984 | sx = 0;
|
---|
| 985 | if (sx + tptl.x + 14 > lxScreen)
|
---|
| 986 | sx = lxScreen - (tptl.x + 14);
|
---|
[551] | 987 | if (sy < 0) {
|
---|
[133] | 988 | sy = ptl.y + swp.cy + 4;
|
---|
| 989 | if (sy + tptl.y + 12 > lyScreen)
|
---|
[1077] | 990 | sy = 0;
|
---|
[133] | 991 | }
|
---|
| 992 | WinSetWindowPos(hwndBubble, HWND_TOP, sx, sy,
|
---|
[1077] | 993 | tptl.x + 14,
|
---|
| 994 | tptl.y + 12,
|
---|
| 995 | SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER |
|
---|
| 996 | SWP_MOVE | SWP_SIZE);
|
---|
[133] | 997 | }
|
---|
[2] | 998 | }
|
---|
| 999 |
|
---|
[133] | 1000 | MRESULT EXPENTRY BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1001 | {
|
---|
[551] | 1002 | switch (msg) {
|
---|
[133] | 1003 | case WM_SETFOCUS:
|
---|
| 1004 | if (mp2)
|
---|
[551] | 1005 | PostMsg(hwnd, UM_FOCUSME, mp1, MPVOID);
|
---|
[133] | 1006 | break;
|
---|
[2] | 1007 |
|
---|
[133] | 1008 | case UM_FOCUSME:
|
---|
[551] | 1009 | WinSetFocus(HWND_DESKTOP, (HWND) mp1);
|
---|
[133] | 1010 | return 0;
|
---|
[2] | 1011 |
|
---|
[133] | 1012 | case WM_MOUSEMOVE:
|
---|
| 1013 | WinShowWindow(hwnd, FALSE);
|
---|
| 1014 | break;
|
---|
[2] | 1015 |
|
---|
[133] | 1016 | case UM_TIMER:
|
---|
| 1017 | {
|
---|
| 1018 | POINTL ptl;
|
---|
[2] | 1019 |
|
---|
[133] | 1020 | WinQueryPointerPos(HWND_DESKTOP, &ptl);
|
---|
| 1021 | if (WinWindowFromPoint(HWND_DESKTOP, &ptl, TRUE) !=
|
---|
[1077] | 1022 | WinQueryWindowULong(hwnd, QWL_USER) || !WinIsWindowVisible(hwnd))
|
---|
| 1023 | WinDestroyWindow(hwnd);
|
---|
[133] | 1024 | }
|
---|
| 1025 | return 0;
|
---|
[2] | 1026 |
|
---|
[133] | 1027 | case WM_PAINT:
|
---|
| 1028 | {
|
---|
| 1029 | HPS hps;
|
---|
| 1030 | SWP swp;
|
---|
| 1031 | POINTL ptl, aptl[TXTBOX_COUNT];
|
---|
| 1032 | CHAR *s, *p, *pp, *wp;
|
---|
| 1033 | ULONG extra, tlen, y;
|
---|
[2] | 1034 |
|
---|
[133] | 1035 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
---|
[551] | 1036 | if (hps) {
|
---|
[1077] | 1037 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 1038 | GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0);
|
---|
| 1039 | GpiSetColor(hps, ((255 << 16) | (255 << 8) | 198));
|
---|
| 1040 | GpiSetBackMix(hps, BM_LEAVEALONE);
|
---|
| 1041 | GpiSetMix(hps, FM_OVERPAINT);
|
---|
| 1042 | ptl.x = ptl.y = 0;
|
---|
| 1043 | GpiMove(hps, &ptl);
|
---|
| 1044 | ptl.x = swp.cx - 1;
|
---|
| 1045 | ptl.y = swp.cy - 1;
|
---|
| 1046 | GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
|
---|
| 1047 | tlen = WinQueryWindowTextLength(hwnd);
|
---|
| 1048 | if (tlen) {
|
---|
| 1049 | s = xmalloc(tlen + 2, pszSrcFile, __LINE__);
|
---|
| 1050 | if (s) {
|
---|
| 1051 | WinQueryWindowText(hwnd, tlen + 1, s);
|
---|
| 1052 | if (*s) {
|
---|
| 1053 | p = s;
|
---|
| 1054 | y = swp.cy - 3;
|
---|
| 1055 | extra = WinQueryWindowULong(hwnd, QWL_USER + 4);
|
---|
| 1056 | GpiSetColor(hps, 0);
|
---|
| 1057 | GpiSetMix(hps, FM_OVERPAINT);
|
---|
| 1058 | while (p && *p) {
|
---|
| 1059 | wp = NULL;
|
---|
| 1060 | pp = strchr(p, '\r');
|
---|
| 1061 | if (pp) {
|
---|
| 1062 | wp = pp;
|
---|
| 1063 | *pp = 0;
|
---|
| 1064 | pp++;
|
---|
| 1065 | }
|
---|
| 1066 | GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
|
---|
| 1067 | ptl.x = 7;
|
---|
| 1068 | y -= aptl[TXTBOX_TOPLEFT].y;
|
---|
| 1069 | if (p != s)
|
---|
| 1070 | y -= extra;
|
---|
| 1071 | ptl.y = y;
|
---|
| 1072 | GpiCharStringAt(hps, &ptl, strlen(p), p);
|
---|
| 1073 | if (wp)
|
---|
| 1074 | *wp = '\r';
|
---|
| 1075 | p = pp;
|
---|
| 1076 | }
|
---|
| 1077 | }
|
---|
| 1078 | free(s);
|
---|
| 1079 | }
|
---|
| 1080 | }
|
---|
| 1081 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) && swp.cx > 6 && swp.cy > 6) {
|
---|
| 1082 | GpiSetColor(hps, CLR_WHITE);
|
---|
| 1083 | ptl.x = 1;
|
---|
| 1084 | ptl.y = 1;
|
---|
| 1085 | GpiMove(hps, &ptl);
|
---|
| 1086 | ptl.y = swp.cy - 2;
|
---|
| 1087 | GpiLine(hps, &ptl);
|
---|
| 1088 | ptl.x = swp.cx - 2;
|
---|
| 1089 | GpiLine(hps, &ptl);
|
---|
| 1090 | ptl.x = 2;
|
---|
| 1091 | ptl.y = 2;
|
---|
| 1092 | GpiMove(hps, &ptl);
|
---|
| 1093 | ptl.y = swp.cy - 3;
|
---|
| 1094 | GpiLine(hps, &ptl);
|
---|
| 1095 | ptl.x = swp.cx - 3;
|
---|
| 1096 | GpiLine(hps, &ptl);
|
---|
| 1097 | GpiSetColor(hps, CLR_BROWN);
|
---|
| 1098 | ptl.x = 1;
|
---|
| 1099 | ptl.y = 1;
|
---|
| 1100 | GpiMove(hps, &ptl);
|
---|
| 1101 | ptl.x = swp.cx - 2;
|
---|
| 1102 | GpiLine(hps, &ptl);
|
---|
| 1103 | ptl.y = swp.cy - 2;
|
---|
| 1104 | GpiLine(hps, &ptl);
|
---|
| 1105 | ptl.x = 2;
|
---|
| 1106 | ptl.y = 2;
|
---|
| 1107 | GpiMove(hps, &ptl);
|
---|
| 1108 | ptl.x = swp.cx - 3;
|
---|
| 1109 | GpiLine(hps, &ptl);
|
---|
| 1110 | ptl.y = swp.cy - 3;
|
---|
| 1111 | GpiLine(hps, &ptl);
|
---|
| 1112 | }
|
---|
| 1113 | WinEndPaint(hps);
|
---|
[133] | 1114 | }
|
---|
| 1115 | }
|
---|
| 1116 | return 0;
|
---|
[2] | 1117 |
|
---|
[133] | 1118 | case WM_CLOSE:
|
---|
| 1119 | WinDestroyWindow(hwnd);
|
---|
| 1120 | return 0;
|
---|
[2] | 1121 |
|
---|
[133] | 1122 | case WM_DESTROY:
|
---|
[551] | 1123 | hwndBubble = (HWND) 0;
|
---|
[133] | 1124 | break;
|
---|
| 1125 | }
|
---|
| 1126 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
[2] | 1127 | }
|
---|
| 1128 |
|
---|
[133] | 1129 | MRESULT EXPENTRY LEDProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1130 | {
|
---|
[551] | 1131 | switch (msg) {
|
---|
[133] | 1132 | case WM_CREATE:
|
---|
| 1133 | {
|
---|
| 1134 | MRESULT mr = PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
| 1135 | HBITMAP hbmold = (HBITMAP) 0;
|
---|
| 1136 | HPS hps = (HPS) 0;
|
---|
[2] | 1137 |
|
---|
[551] | 1138 | switch (WinQueryWindowUShort(hwnd, QWS_ID)) {
|
---|
[133] | 1139 | case MAIN_LED:
|
---|
[1077] | 1140 | hps = WinGetPS(hwnd);
|
---|
| 1141 | hbmold = (HBITMAP) WinSendMsg(hwnd, SM_QUERYHANDLE, MPVOID, MPVOID);
|
---|
| 1142 | if (!fBlueLED) {
|
---|
| 1143 | hbmLEDon = GpiLoadBitmap(hps, 0, LEDON_BMP, 12, 12);
|
---|
| 1144 | hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF_BMP, 12, 12);
|
---|
| 1145 | }
|
---|
| 1146 | else {
|
---|
| 1147 | hbmLEDon = GpiLoadBitmap(hps, 0, LEDON2_BMP, 12, 12);
|
---|
| 1148 | hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF2_BMP, 12, 12);
|
---|
| 1149 | }
|
---|
| 1150 | if (hbmLEDoff && hbmLEDon)
|
---|
| 1151 | WinSendMsg(hwnd, SM_SETHANDLE, MPFROMLONG(hbmLEDoff), MPVOID);
|
---|
| 1152 | else {
|
---|
| 1153 | if (hbmLEDoff)
|
---|
| 1154 | GpiDeleteBitmap(hbmLEDoff);
|
---|
| 1155 | if (hbmLEDon)
|
---|
| 1156 | GpiDeleteBitmap(hbmLEDon);
|
---|
| 1157 | }
|
---|
| 1158 | if (hbmold &&
|
---|
| 1159 | hbmLEDon &&
|
---|
| 1160 | hbmLEDoff && hbmold != hbmLEDon && hbmold != hbmLEDoff)
|
---|
| 1161 | GpiDeleteBitmap(hbmold);
|
---|
| 1162 | if (hps)
|
---|
| 1163 | WinReleasePS(hps);
|
---|
| 1164 | break;
|
---|
[133] | 1165 | default:
|
---|
[1077] | 1166 | SetPresParams(hwnd,
|
---|
| 1167 | &RGBGREY,
|
---|
| 1168 | &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));
|
---|
| 1169 | break;
|
---|
[2] | 1170 | }
|
---|
[133] | 1171 | return mr;
|
---|
| 1172 | }
|
---|
[2] | 1173 |
|
---|
[133] | 1174 | case WM_SETFOCUS:
|
---|
| 1175 | if (mp2)
|
---|
[551] | 1176 | PostMsg(hwnd, UM_FOCUSME, mp1, MPVOID);
|
---|
[133] | 1177 | break;
|
---|
[2] | 1178 |
|
---|
[133] | 1179 | case UM_FOCUSME:
|
---|
[551] | 1180 | WinSetFocus(HWND_DESKTOP, (HWND) mp1);
|
---|
[133] | 1181 | return 0;
|
---|
[2] | 1182 |
|
---|
[133] | 1183 | case WM_MOUSEMOVE:
|
---|
[551] | 1184 | BubbleHelp(hwnd, TRUE, FALSE, FALSE, GetPString(IDS_LEDHELP));
|
---|
| 1185 | if (!fNoFinger) {
|
---|
[133] | 1186 | WinSetPointer(HWND_DESKTOP, hptrFinger);
|
---|
| 1187 | return MRFROMLONG(TRUE);
|
---|
| 1188 | }
|
---|
| 1189 | break;
|
---|
[2] | 1190 |
|
---|
[133] | 1191 | case WM_BUTTON1CLICK:
|
---|
| 1192 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1193 | WM_COMMAND, MPFROM2SHORT(IDM_SHOWNOTEWND, 0), MPVOID);
|
---|
[133] | 1194 | break;
|
---|
[2] | 1195 |
|
---|
[133] | 1196 | case WM_BUTTON2CLICK:
|
---|
| 1197 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1198 | WM_COMMAND, MPFROM2SHORT(IDM_HIDENOTEWND, 0), MPVOID);
|
---|
[133] | 1199 | break;
|
---|
[2] | 1200 |
|
---|
[133] | 1201 | case WM_CHORD:
|
---|
| 1202 | case WM_BUTTON3CLICK:
|
---|
| 1203 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1204 | WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
---|
[133] | 1205 | break;
|
---|
| 1206 | }
|
---|
| 1207 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
[2] | 1208 | }
|
---|
| 1209 |
|
---|
[133] | 1210 | MRESULT EXPENTRY ChildButtonProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1211 | {
|
---|
| 1212 | USHORT id;
|
---|
[672] | 1213 | TOOL *tool;
|
---|
| 1214 |
|
---|
[551] | 1215 | static HWND hwndMenu = (HWND) 0;
|
---|
[2] | 1216 |
|
---|
[551] | 1217 | switch (msg) {
|
---|
[133] | 1218 | case WM_BUTTON1DOWN:
|
---|
| 1219 | case WM_BUTTON2DOWN:
|
---|
| 1220 | case WM_BUTTON3DOWN:
|
---|
| 1221 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 1222 | break;
|
---|
[2] | 1223 |
|
---|
[133] | 1224 | case WM_MOUSEMOVE:
|
---|
[551] | 1225 | if (fToolbarHelp) {
|
---|
| 1226 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
---|
[1077] | 1227 | && !WinQueryCapture(HWND_DESKTOP)) {
|
---|
| 1228 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 1229 | tool = find_tool(id);
|
---|
| 1230 | if (tool && tool->help && *tool->help) {
|
---|
[2] | 1231 |
|
---|
[1077] | 1232 | char s[128];
|
---|
[2] | 1233 |
|
---|
[1077] | 1234 | strcpy(s, tool->help);
|
---|
| 1235 | if (tool->flags & T_DROPABLE)
|
---|
| 1236 | strcat(s, GetPString(IDS_DROPONMETEXT));
|
---|
| 1237 | MakeBubble(hwnd, FALSE, s);
|
---|
| 1238 | }
|
---|
[133] | 1239 | }
|
---|
| 1240 | }
|
---|
| 1241 | break;
|
---|
[2] | 1242 |
|
---|
[133] | 1243 | case WM_COMMAND:
|
---|
[551] | 1244 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 1245 | case IDM_HELP:
|
---|
| 1246 | if (hwndHelp)
|
---|
[1077] | 1247 | WinSendMsg(hwndHelp,
|
---|
| 1248 | HM_DISPLAY_HELP,
|
---|
| 1249 | MPFROM2SHORT(HELP_TOOLBAR, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
[133] | 1250 | break;
|
---|
[2] | 1251 |
|
---|
[930] | 1252 | case IDM_HIDEANYTOOL: /* hide any tool */
|
---|
| 1253 | case IDM_HIDETOOL: /* hide tool */
|
---|
[133] | 1254 | if (SHORT1FROMMP(mp1) == IDM_HIDETOOL)
|
---|
[1077] | 1255 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[133] | 1256 | else
|
---|
[1077] | 1257 | id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd,
|
---|
| 1258 | PickToolProc, FM3ModHandle,
|
---|
| 1259 | PICKBTN_FRAME, GetPString(IDS_HIDETEXT));
|
---|
[551] | 1260 | if (id) {
|
---|
[1077] | 1261 | tool = find_tool(id);
|
---|
| 1262 | if (tool) {
|
---|
| 1263 | tool->flags |= T_INVISIBLE;
|
---|
[1131] | 1264 | save_tools(NULL);
|
---|
[1077] | 1265 | }
|
---|
[133] | 1266 | }
|
---|
| 1267 | break;
|
---|
[2] | 1268 |
|
---|
[930] | 1269 | case IDM_SHOWTOOLS: /* show all tools */
|
---|
[133] | 1270 | tool = toolhead;
|
---|
[551] | 1271 | while (tool) {
|
---|
[1077] | 1272 | tool->flags &= (~T_INVISIBLE);
|
---|
| 1273 | tool = tool->next;
|
---|
[133] | 1274 | }
|
---|
[1131] | 1275 | save_tools(NULL);
|
---|
[133] | 1276 | break;
|
---|
[2] | 1277 |
|
---|
[930] | 1278 | case IDM_DELETEANYTOOL: /* delete any button */
|
---|
| 1279 | case IDM_DELETETOOL: /* delete button */
|
---|
[133] | 1280 | if (SHORT1FROMMP(mp1) == IDM_DELETETOOL)
|
---|
[1077] | 1281 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[133] | 1282 | else
|
---|
[1077] | 1283 | id =
|
---|
| 1284 | (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
|
---|
| 1285 | PICKBTN_FRAME, GetPString(IDS_DELETETEXT));
|
---|
[133] | 1286 | if (id)
|
---|
[1077] | 1287 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP,
|
---|
[1121] | 1288 | MPFROM2SHORT(id, 0), MPVOID);
|
---|
[133] | 1289 | return 0;
|
---|
[2] | 1290 |
|
---|
[930] | 1291 | case IDM_EDITANYTOOL: /* edit any button */
|
---|
| 1292 | case IDM_EDITTOOL: /* edit button */
|
---|
[133] | 1293 | if (SHORT1FROMMP(mp1) == IDM_EDITTOOL)
|
---|
[1077] | 1294 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[133] | 1295 | else
|
---|
[1077] | 1296 | id =
|
---|
| 1297 | (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
|
---|
| 1298 | PICKBTN_FRAME, GetPString(IDS_EDITTEXT));
|
---|
[551] | 1299 | if (id) {
|
---|
[1077] | 1300 | tool = find_tool(id);
|
---|
| 1301 | if (tool) {
|
---|
| 1302 | if (WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,
|
---|
| 1303 | ADDBTN_FRAME, (PVOID) tool))
|
---|
| 1304 | WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 1305 | QW_PARENT),
|
---|
| 1306 | QW_PARENT), FID_CLIENT),
|
---|
| 1307 | WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),
|
---|
| 1308 | MPFROM2SHORT(id, 0));
|
---|
| 1309 | }
|
---|
[133] | 1310 | }
|
---|
| 1311 | break;
|
---|
[2] | 1312 |
|
---|
[930] | 1313 | case IDM_ADDTOOL: /* add tool */
|
---|
[133] | 1314 | id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,
|
---|
[1077] | 1315 | ADDBTN_FRAME, MPVOID);
|
---|
[133] | 1316 | if (id && id != (USHORT) - 1)
|
---|
[1077] | 1317 | WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 1318 | QW_PARENT),
|
---|
| 1319 | QW_PARENT), FID_CLIENT),
|
---|
| 1320 | WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),
|
---|
| 1321 | MPFROM2SHORT(id, 0));
|
---|
[133] | 1322 | break;
|
---|
[2] | 1323 |
|
---|
[930] | 1324 | case IDM_REORDERTOOLS: /* reorder tools */
|
---|
[133] | 1325 | WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 1326 | hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID);
|
---|
[133] | 1327 | break;
|
---|
[2] | 1328 |
|
---|
[133] | 1329 | case IDM_SAVETOOLS:
|
---|
| 1330 | case IDM_LOADTOOLS:
|
---|
| 1331 | if (WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 1332 | hwnd,
|
---|
| 1333 | ToolIODlgProc,
|
---|
| 1334 | FM3ModHandle,
|
---|
| 1335 | SVBTN_FRAME,
|
---|
| 1336 | (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ?
|
---|
| 1337 | "TRUE" : NULL))
|
---|
[1125] | 1338 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
---|
[133] | 1339 | break;
|
---|
| 1340 | }
|
---|
| 1341 | ResizeTools(WinQueryWindow(hwnd, QW_PARENT));
|
---|
| 1342 | return 0;
|
---|
[2] | 1343 |
|
---|
[133] | 1344 | case WM_MENUEND:
|
---|
[551] | 1345 | if (hwndMenu == (HWND) mp2) {
|
---|
[133] | 1346 | WinDestroyWindow(hwndMenu);
|
---|
[551] | 1347 | hwndMenu = (HWND) 0;
|
---|
[133] | 1348 | }
|
---|
| 1349 | break;
|
---|
[2] | 1350 |
|
---|
[133] | 1351 | case WM_CONTEXTMENU:
|
---|
| 1352 | DosEnterCritSec();
|
---|
| 1353 | if (!hwndMenu)
|
---|
| 1354 | hwndMenu = WinLoadMenu(hwnd, FM3ModHandle, ID_BUTTONMENU);
|
---|
| 1355 | DosExitCritSec();
|
---|
[877] | 1356 | SetPresParams(hwndMenu, NULL, NULL, NULL, GetPString(IDS_10SYSPROTEXT));
|
---|
[133] | 1357 | if (PopupMenu(hwnd, hwnd, hwndMenu))
|
---|
| 1358 | WinShowWindow(hwndMenu, TRUE);
|
---|
| 1359 | return MRFROMSHORT(TRUE);
|
---|
[2] | 1360 |
|
---|
[133] | 1361 | case DM_DRAGOVER:
|
---|
| 1362 | {
|
---|
[930] | 1363 | PDRAGINFO pDInfo; /* Pointer to DRAGINFO */
|
---|
[2] | 1364 |
|
---|
[930] | 1365 | pDInfo = (PDRAGINFO) mp1; /* Get DRAGINFO pointer */
|
---|
| 1366 | DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
|
---|
[133] | 1367 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 1368 | tool = find_tool(id);
|
---|
[551] | 1369 | if (!tool) {
|
---|
[1077] | 1370 | DrgFreeDraginfo(pDInfo);
|
---|
| 1371 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
---|
[133] | 1372 | }
|
---|
[551] | 1373 | if (!(tool->flags & T_DROPABLE)) {
|
---|
[1077] | 1374 | DrgFreeDraginfo(pDInfo);
|
---|
| 1375 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
---|
[133] | 1376 | }
|
---|
| 1377 | {
|
---|
[1077] | 1378 | PDRAGITEM pDItem; /* Pointer to DRAGITEM */
|
---|
[2] | 1379 |
|
---|
[1077] | 1380 | pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
|
---|
| 1381 | 0); /* Index to DRAGITEM */
|
---|
| 1382 | if (DrgVerifyRMF(pDItem, /* Check valid rendering */
|
---|
| 1383 | DRM_OS2FILE, /* mechanisms and data */
|
---|
| 1384 | NULL)) { /* formats */
|
---|
| 1385 | if (!(tool->flags & T_EMPHASIZED)) {
|
---|
| 1386 | tool->flags |= T_EMPHASIZED;
|
---|
| 1387 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
---|
| 1388 | DrgFreeDraginfo(pDInfo);
|
---|
| 1389 | }
|
---|
| 1390 | return (MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
|
---|
| 1391 | DO_MOVE)); /* Move operation valid */
|
---|
| 1392 | }
|
---|
| 1393 | DrgFreeDraginfo(pDInfo);
|
---|
[133] | 1394 | }
|
---|
| 1395 | }
|
---|
[930] | 1396 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
---|
[2] | 1397 |
|
---|
[133] | 1398 | case DM_DROPHELP:
|
---|
| 1399 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 1400 | tool = find_tool(id);
|
---|
| 1401 | PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
| 1402 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_TOOLDROPHELP));
|
---|
| 1403 | return 0;
|
---|
[2] | 1404 |
|
---|
[133] | 1405 | case DM_DRAGLEAVE:
|
---|
| 1406 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 1407 | tool = find_tool(id);
|
---|
[551] | 1408 | if (tool && (tool->flags & T_DROPABLE)) {
|
---|
| 1409 | if (tool->flags & T_EMPHASIZED) {
|
---|
[1077] | 1410 | tool->flags &= (~T_EMPHASIZED);
|
---|
| 1411 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
---|
[133] | 1412 | }
|
---|
| 1413 | }
|
---|
| 1414 | break;
|
---|
[2] | 1415 |
|
---|
[133] | 1416 | case DM_DROP:
|
---|
| 1417 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 1418 | tool = find_tool(id);
|
---|
[551] | 1419 | if (tool && (tool->flags & T_DROPABLE) != 0) {
|
---|
[133] | 1420 | LISTINFO *li;
|
---|
| 1421 | CNRDRAGINFO cdi;
|
---|
[2] | 1422 |
|
---|
[551] | 1423 | if (tool->flags & T_EMPHASIZED) {
|
---|
[1077] | 1424 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
---|
| 1425 | tool->flags &= (~T_EMPHASIZED);
|
---|
[133] | 1426 | }
|
---|
| 1427 | memset(&cdi, 0, sizeof(cdi));
|
---|
| 1428 | cdi.pDragInfo = mp1;
|
---|
[551] | 1429 | li = DoFileDrop(hwnd, NULL, FALSE, mp1, MPFROMP(&cdi));
|
---|
[687] | 1430 | CheckPmDrgLimit(cdi.pDragInfo);
|
---|
[551] | 1431 | if (li) {
|
---|
[1077] | 1432 | li->type = id;
|
---|
| 1433 | if (!li->list || !li->list[0])
|
---|
| 1434 | FreeListInfo(li);
|
---|
| 1435 | else {
|
---|
| 1436 | HWND hwndActive;
|
---|
[2] | 1437 |
|
---|
[1077] | 1438 | hwndActive = TopWindow(hwndMain, (HWND) 0);
|
---|
| 1439 | if (hwndActive) {
|
---|
| 1440 | if (!WinSendMsg(hwndActive, UM_COMMAND, MPFROMP(li), MPVOID))
|
---|
| 1441 | FreeListInfo(li);
|
---|
| 1442 | }
|
---|
| 1443 | else
|
---|
| 1444 | FreeListInfo(li);
|
---|
| 1445 | }
|
---|
[133] | 1446 | }
|
---|
| 1447 | }
|
---|
| 1448 | return 0;
|
---|
[2] | 1449 |
|
---|
[133] | 1450 | case WM_CLOSE:
|
---|
| 1451 | WinDestroyWindow(hwnd);
|
---|
| 1452 | return 0;
|
---|
| 1453 | }
|
---|
| 1454 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
[2] | 1455 | }
|
---|
| 1456 |
|
---|
[1125] | 1457 | static VOID BuildTools(HWND hwndT, BOOL resize)
|
---|
[133] | 1458 | {
|
---|
[376] | 1459 | TOOL *tool;
|
---|
| 1460 | ULONG ctrlxpos = 18L;
|
---|
[133] | 1461 | CHAR s[33];
|
---|
| 1462 | HENUM henum;
|
---|
| 1463 | HWND hwndTool;
|
---|
[2] | 1464 |
|
---|
[133] | 1465 | henum = WinBeginEnumWindows(hwndT);
|
---|
| 1466 | while ((hwndTool = WinGetNextWindow(henum)) != NULLHANDLE)
|
---|
[1125] | 1467 | if (!WinDestroyWindow(hwndTool))
|
---|
| 1468 | Runtime_Error(pszSrcFile, __LINE__, "Unable to destroy toolbar button");
|
---|
[133] | 1469 | WinEndEnumWindows(henum);
|
---|
[551] | 1470 | if (!fToolbar) {
|
---|
[133] | 1471 | load_quicktools();
|
---|
| 1472 | load_tools(NULL);
|
---|
| 1473 | return;
|
---|
| 1474 | }
|
---|
| 1475 | if (!toolhead)
|
---|
| 1476 | load_tools(NULL);
|
---|
| 1477 | tool = toolhead;
|
---|
[551] | 1478 | while (tool) {
|
---|
| 1479 | sprintf(s, "#%u", tool->id);
|
---|
| 1480 | hwndTool = (HWND) 0;
|
---|
[376] | 1481 | if (!fTextTools) {
|
---|
[551] | 1482 | if (!(tool->flags & T_MYICON)) {
|
---|
[1077] | 1483 | hwndTool = WinCreateWindow(hwndT,
|
---|
| 1484 | WC_TOOLBUTTONS,
|
---|
| 1485 | s,
|
---|
| 1486 | BS_NOPOINTERFOCUS |
|
---|
| 1487 | BS_BITMAP | BS_PUSHBUTTON,
|
---|
| 1488 | ctrlxpos,
|
---|
| 1489 | 14,
|
---|
| 1490 | 32,
|
---|
| 1491 | 32, hwndT, HWND_TOP, tool->id, NULL, NULL);
|
---|
[376] | 1492 | }
|
---|
| 1493 | if (!hwndTool) {
|
---|
[1077] | 1494 | HBITMAP hbm = LoadBitmapFromFileNum(tool->id);
|
---|
[551] | 1495 |
|
---|
[1077] | 1496 | if (hbm) {
|
---|
| 1497 | BTNCDATA btc;
|
---|
[551] | 1498 |
|
---|
[1077] | 1499 | memset(&btc, 0, sizeof(btc));
|
---|
| 1500 | btc.cb = sizeof(btc);
|
---|
| 1501 | btc.hImage = hbm;
|
---|
| 1502 | hwndTool = WinCreateWindow(hwndT,
|
---|
| 1503 | WC_TOOLBUTTONS,
|
---|
| 1504 | NullStr,
|
---|
| 1505 | BS_NOPOINTERFOCUS |
|
---|
| 1506 | BS_BITMAP | BS_PUSHBUTTON,
|
---|
| 1507 | ctrlxpos,
|
---|
| 1508 | 14,
|
---|
| 1509 | 32,
|
---|
| 1510 | 32,
|
---|
| 1511 | hwndT, HWND_TOP, tool->id, &btc, NULL);
|
---|
| 1512 | if (!hwndTool)
|
---|
| 1513 | GpiDeleteBitmap(hbm);
|
---|
| 1514 | }
|
---|
[133] | 1515 | }
|
---|
| 1516 | if (hwndTool)
|
---|
[1077] | 1517 | tool->flags &= (~T_TEXT);
|
---|
[133] | 1518 | }
|
---|
[376] | 1519 | if (!hwndTool) {
|
---|
| 1520 | hwndTool = WinCreateWindow(hwndT,
|
---|
[1077] | 1521 | WC_TOOLBUTTONS,
|
---|
| 1522 | (!tool->text && tool->id >= IDM_COMMANDSTART
|
---|
| 1523 | && tool->id <
|
---|
| 1524 | IDM_QUICKTOOLSTART) ? command_title(tool->
|
---|
| 1525 | id -
|
---|
| 1526 | IDM_COMMANDSTART)
|
---|
| 1527 | : tool->text,
|
---|
| 1528 | BS_NOPOINTERFOCUS | BS_PUSHBUTTON, ctrlxpos,
|
---|
| 1529 | 2, 54, 24, hwndT, HWND_TOP, tool->id, NULL,
|
---|
| 1530 | NULL);
|
---|
[376] | 1531 | if (!hwndTool)
|
---|
[1077] | 1532 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 1533 | IDS_WINCREATEWINDOW);
|
---|
[551] | 1534 | tool->flags |= T_TEXT;
|
---|
[133] | 1535 | }
|
---|
[551] | 1536 | if (fToolTitles && !fTextTools) {
|
---|
[376] | 1537 | hwndTool = WinCreateWindow(hwndT,
|
---|
[1077] | 1538 | WC_STATIC,
|
---|
| 1539 | tool->text,
|
---|
| 1540 | SS_TEXT | DT_LEFT | DT_VCENTER,
|
---|
| 1541 | ctrlxpos,
|
---|
| 1542 | 1,
|
---|
| 1543 | 32,
|
---|
| 1544 | 10,
|
---|
| 1545 | hwndT,
|
---|
| 1546 | HWND_TOP, tool->id + 25000, NULL, NULL);
|
---|
[376] | 1547 | if (!hwndTool)
|
---|
[1077] | 1548 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 1549 | IDS_WINCREATEWINDOW);
|
---|
[376] | 1550 | else {
|
---|
[1077] | 1551 | SetPresParams(hwndTool,
|
---|
| 1552 | &RGBGREY,
|
---|
| 1553 | &RGBBLACK, &RGBGREY, GetPString(IDS_2SYSTEMVIOTEXT));
|
---|
[376] | 1554 | }
|
---|
[133] | 1555 | }
|
---|
[551] | 1556 | ctrlxpos += ((tool->flags & T_TEXT) ? 55L : 33L);
|
---|
| 1557 | SetPresParams(WinWindowFromID(hwndT, tool->id),
|
---|
[1077] | 1558 | NULL, NULL, NULL, GetPString(IDS_8HELVTEXT));
|
---|
[551] | 1559 | tool = tool->next;
|
---|
[930] | 1560 | } // while tool
|
---|
[376] | 1561 |
|
---|
| 1562 | hwndTool = WinCreateWindow(hwndT,
|
---|
[1077] | 1563 | WC_BUTTON,
|
---|
| 1564 | "#6010",
|
---|
| 1565 | BS_NOPOINTERFOCUS |
|
---|
| 1566 | BS_BITMAP | BS_PUSHBUTTON,
|
---|
| 1567 | 1,
|
---|
| 1568 | 19,
|
---|
| 1569 | 14,
|
---|
| 1570 | 13, hwndT, HWND_TOP, IDM_TOOLLEFT, NULL, NULL);
|
---|
[376] | 1571 | if (!hwndTool)
|
---|
[551] | 1572 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
[1077] | 1573 | IDS_WINCREATEWINDOW);
|
---|
[551] | 1574 | hwndTool =
|
---|
| 1575 | WinCreateWindow(hwndT, WC_BUTTON, "#6011",
|
---|
[1077] | 1576 | BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 1, 4, 14,
|
---|
| 1577 | 13, hwndT, HWND_TOP, IDM_TOOLRIGHT, NULL, NULL);
|
---|
[376] | 1578 | if (!hwndTool)
|
---|
[551] | 1579 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
[1077] | 1580 | IDS_WINCREATEWINDOW);
|
---|
[133] | 1581 | if (resize)
|
---|
| 1582 | ResizeTools(hwndT);
|
---|
[2] | 1583 | }
|
---|
| 1584 |
|
---|
[551] | 1585 | static MRESULT EXPENTRY CommandLineProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
[1077] | 1586 | MPARAM mp2)
|
---|
[133] | 1587 | {
|
---|
| 1588 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 1589 | static BOOL lbup = FALSE;
|
---|
[2] | 1590 |
|
---|
[551] | 1591 | switch (msg) {
|
---|
[133] | 1592 | case UM_FOCUSME:
|
---|
[551] | 1593 | WinSetFocus(HWND_DESKTOP, hwnd);
|
---|
[133] | 1594 | return 0;
|
---|
[2] | 1595 |
|
---|
[133] | 1596 | case WM_SETFOCUS:
|
---|
[551] | 1597 | if (!mp2 && !lbup) {
|
---|
[2] | 1598 |
|
---|
[133] | 1599 | PID pid;
|
---|
| 1600 | TID tid;
|
---|
[2] | 1601 |
|
---|
[551] | 1602 | if (WinQueryWindowUShort((HWND) mp1, QWS_ID) == COMMAND_BUTTON)
|
---|
[1077] | 1603 | break;
|
---|
[551] | 1604 | if (!WinQueryWindowProcess((HWND) mp1, &pid, &tid) || pid == mypid)
|
---|
[1077] | 1605 | WinDestroyWindow(hwnd);
|
---|
[133] | 1606 | }
|
---|
| 1607 | break;
|
---|
[2] | 1608 |
|
---|
[133] | 1609 | case UM_RESCAN:
|
---|
| 1610 | {
|
---|
[989] | 1611 | PSZ pszCmdLine;
|
---|
[2] | 1612 |
|
---|
[989] | 1613 | pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
| 1614 | if (pszCmdLine) {
|
---|
[1077] | 1615 | lbup = TRUE;
|
---|
| 1616 | if (WinDlgBox(HWND_DESKTOP,
|
---|
| 1617 | hwnd,
|
---|
| 1618 | CmdLine2DlgProc,
|
---|
| 1619 | FM3ModHandle, EXEC2_FRAME, MPFROMP(pszCmdLine))) {
|
---|
| 1620 | lstrip(pszCmdLine);
|
---|
| 1621 | WinSetWindowText(hwnd, pszCmdLine);
|
---|
| 1622 | }
|
---|
| 1623 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
| 1624 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
| 1625 | free(pszCmdLine);
|
---|
[133] | 1626 | }
|
---|
| 1627 | }
|
---|
| 1628 | return 0;
|
---|
[2] | 1629 |
|
---|
[133] | 1630 | case UM_SETUP:
|
---|
| 1631 | lbup = FALSE;
|
---|
| 1632 | return 0;
|
---|
[2] | 1633 |
|
---|
[133] | 1634 | case WM_BUTTON1DBLCLK:
|
---|
[551] | 1635 | PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID);
|
---|
[133] | 1636 | return 0;
|
---|
[2] | 1637 |
|
---|
[133] | 1638 | case WM_COMMAND:
|
---|
[551] | 1639 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 1640 | case COMMAND_BUTTON:
|
---|
| 1641 | if (!lbup)
|
---|
[1077] | 1642 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
[133] | 1643 | break;
|
---|
| 1644 | }
|
---|
| 1645 | return 0;
|
---|
[2] | 1646 |
|
---|
[133] | 1647 | case UM_OPENWINDOWFORME:
|
---|
| 1648 | {
|
---|
| 1649 | static char directory[CCHMAXPATH], cl[1000];
|
---|
| 1650 | char **list = NULL;
|
---|
| 1651 | ULONG len;
|
---|
| 1652 | HWND hwndCnr;
|
---|
[2] | 1653 |
|
---|
[133] | 1654 | *directory = *cl = 0;
|
---|
| 1655 | strcpy(cl, GetCmdSpec(FALSE));
|
---|
| 1656 | strcat(cl, " /C ");
|
---|
| 1657 | len = strlen(cl);
|
---|
| 1658 | WinQueryWindowText(hwnd, 1000 - len, cl + len);
|
---|
| 1659 | bstrip(cl + len);
|
---|
[551] | 1660 | if (strlen(cl) > len) {
|
---|
[1077] | 1661 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 1662 | UM_SETUP, MPFROMP(cl + len), MPVOID);
|
---|
| 1663 | WinQueryWindowText(hwndStatus, CCHMAXPATH, directory);
|
---|
| 1664 | bstrip(directory);
|
---|
| 1665 | if (*directory && (IsRoot(directory) || !IsFile(directory))) {
|
---|
| 1666 | if (!FM2Command(directory, cl + len)) {
|
---|
| 1667 | hwndCnr = TopWindow(hwndMain, (HWND) 0);
|
---|
| 1668 | if (hwndCnr) {
|
---|
| 1669 | hwndCnr = WinWindowFromID(hwndCnr, FID_CLIENT);
|
---|
| 1670 | if (hwndCnr) {
|
---|
| 1671 | hwndCnr = WinWindowFromID(hwndCnr, DIR_CNR);
|
---|
| 1672 | if (hwndCnr)
|
---|
| 1673 | list = BuildList(hwndCnr);
|
---|
| 1674 | }
|
---|
| 1675 | }
|
---|
| 1676 | WinSetActiveWindow(HWND_DESKTOP, hwndCnr);
|
---|
| 1677 | if (add_cmdline(cl + len, FALSE) && fSaveMiniCmds)
|
---|
| 1678 | save_cmdlines(FALSE);
|
---|
| 1679 | ExecOnList(hwndCnr,
|
---|
| 1680 | cl,
|
---|
| 1681 | WINDOWED | ((fKeepCmdLine) ?
|
---|
| 1682 | SEPARATEKEEP : SEPARATE),
|
---|
| 1683 | directory, list, NULL, pszSrcFile, __LINE__);
|
---|
| 1684 | xfree(list, pszSrcFile, __LINE__);
|
---|
| 1685 | WinDestroyWindow(hwnd);
|
---|
| 1686 | break;
|
---|
| 1687 | }
|
---|
| 1688 | }
|
---|
[133] | 1689 | }
|
---|
| 1690 | WinSendMsg(hwnd, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);
|
---|
| 1691 | }
|
---|
| 1692 | return 0;
|
---|
[2] | 1693 |
|
---|
[133] | 1694 | case WM_CHAR:
|
---|
[551] | 1695 | if (!lbup && !(SHORT1FROMMP(mp1) & KC_KEYUP)) {
|
---|
| 1696 | if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
|
---|
[1077] | 1697 | if ((SHORT1FROMMP(mp2) & 255) == '\r')
|
---|
| 1698 | PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID);
|
---|
| 1699 | else if ((SHORT1FROMMP(mp2) & 0xff) == 0x1b)
|
---|
| 1700 | WinDestroyWindow(hwnd);
|
---|
| 1701 | else if (SHORT2FROMMP(mp2) == VK_UP || SHORT2FROMMP(mp2) == VK_DOWN)
|
---|
| 1702 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
[133] | 1703 | }
|
---|
| 1704 | }
|
---|
| 1705 | else if ((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) &&
|
---|
[1077] | 1706 | ((SHORT2FROMMP(mp2) == VK_UP ||
|
---|
| 1707 | SHORT2FROMMP(mp2) == VK_DOWN) ||
|
---|
| 1708 | (SHORT1FROMMP(mp2) == '\x1b') || (SHORT1FROMMP(mp2) == '\r')))
|
---|
[133] | 1709 | return 0;
|
---|
| 1710 | break;
|
---|
[2] | 1711 |
|
---|
[133] | 1712 | case WM_DESTROY:
|
---|
[551] | 1713 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_RESCAN, MPVOID, MPVOID);
|
---|
[133] | 1714 | lbup = FALSE;
|
---|
| 1715 | break;
|
---|
| 1716 | }
|
---|
| 1717 | return oldproc(hwnd, msg, mp1, mp2);
|
---|
[2] | 1718 | }
|
---|
| 1719 |
|
---|
[133] | 1720 | MRESULT EXPENTRY DriveBackProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1721 | {
|
---|
[551] | 1722 | switch (msg) {
|
---|
[133] | 1723 | case WM_CREATE:
|
---|
[551] | 1724 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
[133] | 1725 | break;
|
---|
[2] | 1726 |
|
---|
[133] | 1727 | case UM_SETUP:
|
---|
| 1728 | {
|
---|
| 1729 | RGB2 rgb;
|
---|
[2] | 1730 |
|
---|
[133] | 1731 | memset(&rgb, 0, sizeof(rgb));
|
---|
[689] | 1732 | rgb.bRed = (BYTE)128;
|
---|
[133] | 1733 | SetPresParams(hwnd,
|
---|
[1077] | 1734 | &RGBGREY, &rgb, &RGBGREY, GetPString(IDS_8HELVTEXT));
|
---|
[133] | 1735 | SetTargetDir(hwnd, TRUE);
|
---|
| 1736 | }
|
---|
| 1737 | return 0;
|
---|
[2] | 1738 |
|
---|
[133] | 1739 | case WM_SETFOCUS:
|
---|
| 1740 | case UM_FOCUSME:
|
---|
| 1741 | case WM_BUTTON1DOWN:
|
---|
| 1742 | case WM_BUTTON1UP:
|
---|
| 1743 | case WM_BUTTON2DOWN:
|
---|
| 1744 | case WM_BUTTON2UP:
|
---|
| 1745 | case WM_BUTTON3DOWN:
|
---|
| 1746 | case WM_BUTTON3UP:
|
---|
| 1747 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
[2] | 1748 |
|
---|
[133] | 1749 | case WM_MOUSEMOVE:
|
---|
| 1750 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 1751 | break;
|
---|
[2] | 1752 |
|
---|
[133] | 1753 | case UM_CLICKED:
|
---|
| 1754 | case UM_CLICKED3:
|
---|
[551] | 1755 | PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_SETTARGET, 0), MPVOID);
|
---|
[133] | 1756 | return 0;
|
---|
[2] | 1757 |
|
---|
[133] | 1758 | case WM_CHAR:
|
---|
| 1759 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 1760 | break;
|
---|
[2] | 1761 |
|
---|
[133] | 1762 | case WM_CONTROLPOINTER:
|
---|
| 1763 | if (!fNoFinger &&
|
---|
[1077] | 1764 | (SHORT1FROMMP(mp1) >= IDM_DRIVEA &&
|
---|
| 1765 | SHORT1FROMMP(mp1) < IDM_DRIVEA + 26))
|
---|
[133] | 1766 | return MRFROMLONG(hptrFinger);
|
---|
| 1767 | break;
|
---|
[2] | 1768 |
|
---|
[133] | 1769 | case WM_COMMAND:
|
---|
| 1770 | {
|
---|
| 1771 | CHAR dv[4];
|
---|
[2] | 1772 |
|
---|
[133] | 1773 | *dv = 0;
|
---|
| 1774 | WinQueryWindowText(WinWindowFromID(hwnd, SHORT1FROMMP(mp1) + 50),
|
---|
[1077] | 1775 | 2, dv);
|
---|
[551] | 1776 | if (isalpha(*dv)) {
|
---|
[2] | 1777 |
|
---|
[1077] | 1778 | HWND hwndActive;
|
---|
[2] | 1779 |
|
---|
[1077] | 1780 | dv[1] = ':';
|
---|
| 1781 | dv[2] = '\\';
|
---|
| 1782 | dv[3] = 0;
|
---|
| 1783 | hwndActive = TopWindow(hwnd, (HWND) 0);
|
---|
| 1784 | if (hwndActive)
|
---|
| 1785 | WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT),
|
---|
| 1786 | UM_DRIVECMD, MPFROMP(dv), MPVOID);
|
---|
[133] | 1787 | }
|
---|
| 1788 | }
|
---|
| 1789 | return 0;
|
---|
[2] | 1790 |
|
---|
[133] | 1791 | case WM_PAINT:
|
---|
[551] | 1792 | PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
|
---|
[133] | 1793 | break;
|
---|
[2] | 1794 |
|
---|
[133] | 1795 | case WM_CLOSE:
|
---|
| 1796 | WinDestroyWindow(hwnd);
|
---|
| 1797 | return 0;
|
---|
| 1798 | }
|
---|
| 1799 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
[2] | 1800 | }
|
---|
| 1801 |
|
---|
[133] | 1802 | MRESULT EXPENTRY DriveProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1803 | {
|
---|
| 1804 | USHORT id;
|
---|
[297] | 1805 | CHAR szDrv[CCHMAXPATH];
|
---|
| 1806 |
|
---|
[133] | 1807 | static BOOL emphasized = FALSE;
|
---|
[297] | 1808 | static HWND hwndMenu = NULLHANDLE;
|
---|
[2] | 1809 | static USHORT helpid = 0;
|
---|
| 1810 |
|
---|
[551] | 1811 | switch (msg) {
|
---|
[133] | 1812 | case WM_MOUSEMOVE:
|
---|
| 1813 | if (fDrivebarHelp &&
|
---|
[1077] | 1814 | (!hwndBubble ||
|
---|
| 1815 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
---|
| 1816 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
[133] | 1817 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 1818 | if (helpid != id) {
|
---|
[1077] | 1819 | helpid = id;
|
---|
| 1820 | PostMsg(MainObjectHwnd, UM_SETUP6, MPFROMLONG((ULONG) hwnd), MPVOID);
|
---|
[2] | 1821 | }
|
---|
[133] | 1822 | else
|
---|
[1077] | 1823 | helpid = 0;
|
---|
[133] | 1824 | }
|
---|
| 1825 | break;
|
---|
[2] | 1826 |
|
---|
[133] | 1827 | case UM_SETUP6:
|
---|
[551] | 1828 | if (helpid == WinQueryWindowUShort(hwnd, QWS_ID)) {
|
---|
| 1829 | if ((char *)mp1 &&
|
---|
[1077] | 1830 | (!hwndBubble ||
|
---|
| 1831 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
---|
| 1832 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
[2] | 1833 |
|
---|
[1077] | 1834 | RECTL rcl;
|
---|
| 1835 | POINTL ptl;
|
---|
[2] | 1836 |
|
---|
[1077] | 1837 | WinQueryPointerPos(HWND_DESKTOP, &ptl);
|
---|
| 1838 | WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);
|
---|
| 1839 | WinQueryWindowRect(hwnd, &rcl);
|
---|
| 1840 | if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl))
|
---|
| 1841 | BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1);
|
---|
[2] | 1842 | }
|
---|
[133] | 1843 | }
|
---|
| 1844 | return 0;
|
---|
[2] | 1845 |
|
---|
[133] | 1846 | case WM_MENUEND:
|
---|
[551] | 1847 | if (hwndMenu == (HWND) mp2) {
|
---|
[133] | 1848 | WinDestroyWindow(hwndMenu);
|
---|
[551] | 1849 | hwndMenu = (HWND) 0;
|
---|
[133] | 1850 | }
|
---|
| 1851 | break;
|
---|
[2] | 1852 |
|
---|
[133] | 1853 | case WM_CONTEXTMENU:
|
---|
| 1854 | if (hwndMenu)
|
---|
| 1855 | WinDestroyWindow(hwndMenu);
|
---|
[551] | 1856 | hwndMenu = (HWND) 0;
|
---|
[133] | 1857 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[297] | 1858 | *szDrv = 0;
|
---|
[133] | 1859 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1860 | id + 50), sizeof(szDrv), szDrv);
|
---|
[551] | 1861 | if (isalpha(*szDrv)) {
|
---|
| 1862 | hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, MAIN_DRIVES);
|
---|
| 1863 | if (hwndMenu) {
|
---|
[1077] | 1864 | BOOL rdy;
|
---|
| 1865 | CHAR chDrv = *szDrv;
|
---|
| 1866 | UINT iDrv;
|
---|
[551] | 1867 |
|
---|
[1077] | 1868 | strcpy(szDrv + 2, "\\");
|
---|
| 1869 | MakeValidDir(szDrv);
|
---|
| 1870 | // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c
|
---|
| 1871 | rdy = toupper(*szDrv) == toupper(chDrv);
|
---|
| 1872 | iDrv = toupper(*szDrv) - 'A';
|
---|
| 1873 | if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE)
|
---|
| 1874 | WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE);
|
---|
[549] | 1875 |
|
---|
[1077] | 1876 | if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) {
|
---|
| 1877 | WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE);
|
---|
| 1878 | WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE);
|
---|
| 1879 | WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE);
|
---|
| 1880 | WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE);
|
---|
| 1881 | }
|
---|
| 1882 | if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) {
|
---|
| 1883 | WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE);
|
---|
| 1884 | WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE);
|
---|
| 1885 | WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE);
|
---|
| 1886 | }
|
---|
| 1887 | if (!rdy) {
|
---|
| 1888 | WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE);
|
---|
| 1889 | WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE);
|
---|
| 1890 | WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE);
|
---|
| 1891 | WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE);
|
---|
| 1892 | WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE);
|
---|
| 1893 | }
|
---|
| 1894 | /* fixme to be gone?
|
---|
| 1895 | if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) {
|
---|
| 1896 | WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE);
|
---|
| 1897 | }
|
---|
| 1898 | */
|
---|
| 1899 | PopupMenu(hwnd, hwnd, hwndMenu);
|
---|
[133] | 1900 | }
|
---|
| 1901 | }
|
---|
| 1902 | return MRFROMSHORT(TRUE);
|
---|
[2] | 1903 |
|
---|
[133] | 1904 | case WM_BUTTON2CLICK:
|
---|
| 1905 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 1906 | if (!(shiftstate & KC_CTRL))
|
---|
| 1907 | break;
|
---|
[2] | 1908 |
|
---|
[133] | 1909 | case WM_CHORD:
|
---|
| 1910 | case WM_BUTTON3CLICK:
|
---|
| 1911 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[297] | 1912 | *szDrv = 0;
|
---|
[133] | 1913 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1914 | id + 50), sizeof(szDrv), szDrv);
|
---|
[551] | 1915 | if (isalpha(*szDrv)) {
|
---|
[297] | 1916 | strcat(szDrv, "\\");
|
---|
| 1917 | if (!FindDirCnrByName(szDrv, TRUE))
|
---|
[1077] | 1918 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv);
|
---|
[133] | 1919 | }
|
---|
| 1920 | break;
|
---|
[2] | 1921 |
|
---|
[133] | 1922 | case WM_COMMAND:
|
---|
| 1923 | PostMsg(hwnd, UM_COMMAND, mp1, mp2);
|
---|
| 1924 | return 0;
|
---|
[2] | 1925 |
|
---|
[133] | 1926 | case UM_COMMAND:
|
---|
| 1927 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[297] | 1928 | *szDrv = 0;
|
---|
[133] | 1929 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1930 | id + 50), sizeof(szDrv), szDrv);
|
---|
[551] | 1931 | if (isalpha(*szDrv)) {
|
---|
[297] | 1932 | strcat(szDrv, "\\");
|
---|
| 1933 | CommonDriveCmd(hwnd, szDrv, SHORT1FROMMP(mp1));
|
---|
[133] | 1934 | }
|
---|
| 1935 | return 0;
|
---|
[2] | 1936 |
|
---|
[133] | 1937 | case DM_DRAGOVER:
|
---|
| 1938 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[297] | 1939 | *szDrv = 0;
|
---|
[133] | 1940 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1941 | id + 50), sizeof(szDrv), szDrv);
|
---|
[297] | 1942 | if (isalpha(*szDrv) &&
|
---|
[1077] | 1943 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
[551] | 1944 | if (!emphasized) {
|
---|
[1077] | 1945 | emphasized = TRUE;
|
---|
| 1946 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 1947 | }
|
---|
[618] | 1948 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
---|
[1077] | 1949 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
---|
[133] | 1950 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
---|
| 1951 | }
|
---|
| 1952 | break;
|
---|
[2] | 1953 |
|
---|
[133] | 1954 | case DM_DRAGLEAVE:
|
---|
| 1955 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[297] | 1956 | *szDrv = 0;
|
---|
[133] | 1957 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1958 | id + 50), sizeof(szDrv), szDrv);
|
---|
[297] | 1959 | if (isalpha(*szDrv) &&
|
---|
[1077] | 1960 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
[551] | 1961 | if (emphasized) {
|
---|
[1077] | 1962 | emphasized = FALSE;
|
---|
| 1963 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 1964 | }
|
---|
| 1965 | }
|
---|
| 1966 | break;
|
---|
[2] | 1967 |
|
---|
[133] | 1968 | case DM_DROPHELP:
|
---|
| 1969 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[297] | 1970 | *szDrv = 0;
|
---|
[133] | 1971 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1972 | id + 50), sizeof(szDrv), szDrv);
|
---|
[297] | 1973 | if (isalpha(*szDrv) &&
|
---|
[1077] | 1974 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
[133] | 1975 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_DRIVEDROPHELP));
|
---|
| 1976 | return 0;
|
---|
| 1977 | }
|
---|
| 1978 | break;
|
---|
[2] | 1979 |
|
---|
[133] | 1980 | case DM_DROP:
|
---|
| 1981 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[297] | 1982 | *szDrv = 0;
|
---|
[133] | 1983 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1984 | id + 50), sizeof(szDrv), szDrv);
|
---|
[297] | 1985 | if (isalpha(*szDrv) &&
|
---|
[1077] | 1986 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
[2] | 1987 |
|
---|
[133] | 1988 | CNRDRAGINFO cnd;
|
---|
| 1989 | LISTINFO *li;
|
---|
| 1990 | ULONG action = UM_ACTION;
|
---|
[2] | 1991 |
|
---|
[551] | 1992 | if (emphasized) {
|
---|
[1077] | 1993 | emphasized = FALSE;
|
---|
| 1994 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 1995 | }
|
---|
| 1996 | memset(&cnd, 0, sizeof(cnd));
|
---|
| 1997 | cnd.pDragInfo = (PDRAGINFO) mp1;
|
---|
| 1998 | cnd.pRecord = NULL;
|
---|
| 1999 | li = DoFileDrop(hwnd,
|
---|
[1077] | 2000 | NULL,
|
---|
| 2001 | TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd));
|
---|
[687] | 2002 | CheckPmDrgLimit(cnd.pDragInfo);
|
---|
[551] | 2003 | if (li) {
|
---|
[1077] | 2004 | strcpy(li->targetpath, szDrv);
|
---|
| 2005 | strcat(li->targetpath, "\\");
|
---|
| 2006 | if (li->list && li->list[0] && IsRoot(li->list[0]))
|
---|
| 2007 | li->type = DO_LINK;
|
---|
| 2008 | else if (fDragndropDlg && (!*li->arcname || !li->info)) {
|
---|
[2] | 2009 |
|
---|
[1077] | 2010 | CHECKLIST cl;
|
---|
[2] | 2011 |
|
---|
[1077] | 2012 | memset(&cl, 0, sizeof(cl));
|
---|
| 2013 | cl.size = sizeof(cl);
|
---|
| 2014 | cl.flags = li->type;
|
---|
| 2015 | cl.list = li->list;
|
---|
| 2016 | cl.cmd = li->type;
|
---|
| 2017 | cl.prompt = li->targetpath;
|
---|
| 2018 | li->type = WinDlgBox(HWND_DESKTOP,
|
---|
| 2019 | hwndMain,
|
---|
| 2020 | DropListProc,
|
---|
| 2021 | FM3ModHandle, DND_FRAME, MPFROMP(&cl));
|
---|
| 2022 | if (li->type == DID_ERROR)
|
---|
| 2023 | Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 2024 | "Drag & Drop Dialog");
|
---|
| 2025 | if (!li->type) {
|
---|
| 2026 | FreeListInfo(li);
|
---|
| 2027 | return 0;
|
---|
| 2028 | }
|
---|
| 2029 | li->list = cl.list;
|
---|
| 2030 | if (!li->list || !li->list[0]) {
|
---|
| 2031 | FreeListInfo(li);
|
---|
| 2032 | return 0;
|
---|
| 2033 | }
|
---|
| 2034 | }
|
---|
| 2035 | else {
|
---|
| 2036 | if (!WinDlgBox(HWND_DESKTOP,
|
---|
| 2037 | hwndMain,
|
---|
| 2038 | WalkDlgProc,
|
---|
| 2039 | FM3ModHandle,
|
---|
| 2040 | WALK_FRAME,
|
---|
| 2041 | MPFROMP(li->targetpath)) || !*li->targetpath) {
|
---|
| 2042 | FreeListInfo(li);
|
---|
| 2043 | return 0;
|
---|
| 2044 | }
|
---|
| 2045 | }
|
---|
| 2046 | switch (li->type) {
|
---|
| 2047 | case DND_LAUNCH:
|
---|
| 2048 | strcat(li->targetpath, " %a");
|
---|
| 2049 | ExecOnList(hwndMain,
|
---|
| 2050 | li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL,
|
---|
| 2051 | pszSrcFile, __LINE__);
|
---|
| 2052 | FreeList(li->list);
|
---|
| 2053 | li->list = NULL;
|
---|
| 2054 | break;
|
---|
| 2055 | case DO_LINK:
|
---|
| 2056 | if (fLinkSetsIcon) {
|
---|
| 2057 | li->type = IDM_SETICON;
|
---|
| 2058 | action = UM_MASSACTION;
|
---|
| 2059 | }
|
---|
| 2060 | else
|
---|
| 2061 | li->type = IDM_COMPARE;
|
---|
| 2062 | break;
|
---|
| 2063 | case DND_EXTRACT:
|
---|
| 2064 | if (*li->targetpath && !IsFile(li->targetpath))
|
---|
| 2065 | li->type = IDM_EXTRACT;
|
---|
| 2066 | break;
|
---|
| 2067 | case DND_MOVE:
|
---|
| 2068 | li->type = IDM_MOVE;
|
---|
| 2069 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
| 2070 | action = UM_MASSACTION;
|
---|
| 2071 | li->type = IDM_ARCHIVEM;
|
---|
| 2072 | }
|
---|
| 2073 | break;
|
---|
| 2074 | case DND_WILDMOVE:
|
---|
| 2075 | li->type = IDM_WILDMOVE;
|
---|
| 2076 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
| 2077 | action = UM_MASSACTION;
|
---|
| 2078 | li->type = IDM_ARCHIVEM;
|
---|
| 2079 | }
|
---|
| 2080 | break;
|
---|
| 2081 | case DND_OBJECT:
|
---|
| 2082 | li->type = IDM_OBJECT;
|
---|
| 2083 | action = UM_MASSACTION;
|
---|
| 2084 | break;
|
---|
| 2085 | case DND_SHADOW:
|
---|
| 2086 | li->type = IDM_SHADOW;
|
---|
| 2087 | action = UM_MASSACTION;
|
---|
| 2088 | break;
|
---|
| 2089 | case DND_COMPARE:
|
---|
| 2090 | li->type = IDM_COMPARE;
|
---|
| 2091 | break;
|
---|
| 2092 | case DND_SETICON:
|
---|
| 2093 | action = UM_MASSACTION;
|
---|
| 2094 | li->type = IDM_SETICON;
|
---|
| 2095 | break;
|
---|
| 2096 | case DND_COPY:
|
---|
| 2097 | li->type = IDM_COPY;
|
---|
| 2098 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
| 2099 | action = UM_MASSACTION;
|
---|
| 2100 | li->type = IDM_ARCHIVE;
|
---|
| 2101 | }
|
---|
| 2102 | break;
|
---|
| 2103 | case DND_WILDCOPY:
|
---|
| 2104 | li->type = IDM_WILDCOPY;
|
---|
| 2105 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
| 2106 | action = UM_MASSACTION;
|
---|
| 2107 | li->type = IDM_ARCHIVE;
|
---|
| 2108 | }
|
---|
| 2109 | break;
|
---|
| 2110 | default:
|
---|
| 2111 | if (*li->arcname && li->info) {
|
---|
| 2112 | action = UM_MASSACTION;
|
---|
| 2113 | li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM :
|
---|
| 2114 | IDM_FAKEEXTRACT;
|
---|
| 2115 | }
|
---|
| 2116 | else if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
| 2117 | action = UM_MASSACTION;
|
---|
| 2118 | li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
|
---|
| 2119 | }
|
---|
| 2120 | else
|
---|
| 2121 | li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
|
---|
| 2122 | break;
|
---|
| 2123 | }
|
---|
| 2124 | if (!li->list || !li->list[0])
|
---|
| 2125 | FreeListInfo(li);
|
---|
| 2126 | else
|
---|
| 2127 | WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action));
|
---|
[133] | 2128 | }
|
---|
| 2129 | return 0;
|
---|
| 2130 | }
|
---|
| 2131 | break;
|
---|
[2] | 2132 |
|
---|
[133] | 2133 | case WM_DESTROY:
|
---|
| 2134 | if (hwndMenu)
|
---|
| 2135 | WinDestroyWindow(hwndMenu);
|
---|
[551] | 2136 | hwndMenu = (HWND) 0;
|
---|
[133] | 2137 | break;
|
---|
| 2138 | }
|
---|
| 2139 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
[2] | 2140 | }
|
---|
| 2141 |
|
---|
[260] | 2142 | VOID BuildDriveBarButtons(HWND hwndT)
|
---|
[133] | 2143 | {
|
---|
| 2144 | register ULONG x, y = 0;
|
---|
| 2145 | ULONG ulDriveNum, ulDriveMap, iconid;
|
---|
| 2146 | CHAR s[8];
|
---|
| 2147 | HENUM henum;
|
---|
| 2148 | HWND hwndB;
|
---|
[2] | 2149 |
|
---|
[133] | 2150 | henum = WinBeginEnumWindows(hwndT);
|
---|
[2] | 2151 |
|
---|
[133] | 2152 | while ((hwndB = WinGetNextWindow(henum)) != NULLHANDLE)
|
---|
| 2153 | WinDestroyWindow(hwndB);
|
---|
| 2154 |
|
---|
| 2155 | WinEndEnumWindows(henum);
|
---|
[376] | 2156 | if (fDrivebar) {
|
---|
[2] | 2157 | DosError(FERR_DISABLEHARDERR);
|
---|
[133] | 2158 | DosQCurDisk(&ulDriveNum, &ulDriveMap);
|
---|
[376] | 2159 | for (x = 0; x < 26; x++) {
|
---|
[551] | 2160 | if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) {
|
---|
[1077] | 2161 | if (x > 1) {
|
---|
| 2162 | if (driveflags[x] & DRIVE_CDROM)
|
---|
| 2163 | iconid = CDROM_ICON;
|
---|
| 2164 | else
|
---|
| 2165 | iconid = (driveflags[x] & DRIVE_REMOVABLE) ?
|
---|
| 2166 | REMOVABLE_ICON :
|
---|
| 2167 | (driveflags[x] & DRIVE_VIRTUAL) ?
|
---|
| 2168 | VIRTUAL_ICON :
|
---|
| 2169 | (driveflags[x] & DRIVE_REMOTE) ?
|
---|
| 2170 | REMOTE_ICON :
|
---|
| 2171 | (driveflags[x] & DRIVE_RAMDISK) ?
|
---|
| 2172 | RAMDISK_ICON :
|
---|
| 2173 | (driveflags[x] & DRIVE_ZIPSTREAM) ?
|
---|
| 2174 | ZIPSTREAM_ICON :DRIVE_ICON;
|
---|
| 2175 | }
|
---|
| 2176 | else
|
---|
| 2177 | iconid = FLOPPY_ICON;
|
---|
| 2178 | sprintf(s, "#%lu", iconid);
|
---|
| 2179 | hwndB = WinCreateWindow(hwndT,
|
---|
| 2180 | WC_DRIVEBUTTONS,
|
---|
| 2181 | s,
|
---|
| 2182 | BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON,
|
---|
| 2183 | 0,
|
---|
| 2184 | 0,
|
---|
| 2185 | 28,
|
---|
| 2186 | 18,
|
---|
| 2187 | hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL);
|
---|
| 2188 | if (!hwndB)
|
---|
| 2189 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 2190 | IDS_WINCREATEWINDOW);
|
---|
| 2191 | else {
|
---|
| 2192 | WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
|
---|
| 2193 | sprintf(s, "%c:", (CHAR) x + 'A');
|
---|
| 2194 | hwndB = WinCreateWindow(hwndT,
|
---|
| 2195 | WC_STATIC,
|
---|
| 2196 | s,
|
---|
| 2197 | SS_TEXT | DT_LEFT | DT_VCENTER,
|
---|
| 2198 | 0,
|
---|
| 2199 | 0,
|
---|
| 2200 | 10,
|
---|
| 2201 | 18,
|
---|
| 2202 | hwndT,
|
---|
| 2203 | HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL);
|
---|
| 2204 | if (!hwndB)
|
---|
| 2205 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 2206 | IDS_WINCREATEWINDOW);
|
---|
| 2207 | else {
|
---|
| 2208 | SetPresParams(hwndB,
|
---|
| 2209 | &RGBGREY,
|
---|
| 2210 | &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));
|
---|
| 2211 | WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
|
---|
| 2212 | }
|
---|
| 2213 | y++;
|
---|
| 2214 | }
|
---|
[133] | 2215 | }
|
---|
[930] | 2216 | } // for
|
---|
| 2217 | } // if drivebar
|
---|
[133] | 2218 | PostMsg(WinQueryWindow(hwndT, QW_PARENT),
|
---|
[1077] | 2219 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[2] | 2220 | }
|
---|
| 2221 |
|
---|
[133] | 2222 | VOID ResizeDrives(HWND hwndT, long xwidth)
|
---|
| 2223 | {
|
---|
| 2224 | register ULONG ctrlxpos = 2, ctrlypos = 0, ctrlxsize;
|
---|
| 2225 | HENUM henum;
|
---|
| 2226 | HWND hwndB;
|
---|
| 2227 | RECTL rcl;
|
---|
[2] | 2228 |
|
---|
| 2229 | DriveLines = 0;
|
---|
[133] | 2230 | if (!fDrivebar)
|
---|
[2] | 2231 | return;
|
---|
[551] | 2232 | if (!xwidth) {
|
---|
[133] | 2233 | WinQueryWindowRect(hwndT, &rcl);
|
---|
[2] | 2234 | xwidth = rcl.xRight - ((WinQuerySysValue(HWND_DESKTOP,
|
---|
[1077] | 2235 | SV_CYSIZEBORDER) * 2) + 2);
|
---|
[2] | 2236 | }
|
---|
[133] | 2237 | henum = WinBeginEnumWindows(hwndT);
|
---|
[551] | 2238 | while ((hwndB = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 2239 | if (WinQueryWindowUShort(hwndB, QWS_ID) > IDM_DRIVEA + 27)
|
---|
[2] | 2240 | ctrlxsize = 10;
|
---|
| 2241 | else
|
---|
| 2242 | ctrlxsize = 28;
|
---|
| 2243 | WinSetWindowPos(hwndB,
|
---|
[1077] | 2244 | HWND_TOP,
|
---|
| 2245 | ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW);
|
---|
[2] | 2246 | ctrlxpos += (ctrlxsize + 2);
|
---|
[551] | 2247 | if (ctrlxsize == 10) {
|
---|
[133] | 2248 | if (ctrlxpos + (42 + ((fShowTarget && DriveLines == 0) ?
|
---|
[1077] | 2249 | 256 : 0)) > xwidth) {
|
---|
| 2250 | ctrlxpos = 2;
|
---|
| 2251 | ctrlypos += 18;
|
---|
| 2252 | DriveLines++;
|
---|
[2] | 2253 | }
|
---|
| 2254 | }
|
---|
| 2255 | }
|
---|
[133] | 2256 | if (ctrlxpos == 2 && DriveLines)
|
---|
[2] | 2257 | DriveLines--;
|
---|
| 2258 | }
|
---|
| 2259 |
|
---|
[133] | 2260 | MRESULT EXPENTRY StatusProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 2261 | {
|
---|
[551] | 2262 | static HWND hwndE = (HWND) 0, hwndB = (HWND) 0;
|
---|
[2] | 2263 | static CHAR lastcmd[1024] = "";
|
---|
| 2264 |
|
---|
[551] | 2265 | switch (msg) {
|
---|
[133] | 2266 | case WM_CREATE:
|
---|
| 2267 | {
|
---|
| 2268 | MRESULT mr = PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
[2] | 2269 |
|
---|
[133] | 2270 | SetPresParams(hwnd,
|
---|
[1077] | 2271 | &RGBGREY,
|
---|
| 2272 | &RGBBLACK, &RGBGREY, GetPString(IDS_8HELVBOLDTEXT));
|
---|
[133] | 2273 | return mr;
|
---|
| 2274 | }
|
---|
[2] | 2275 |
|
---|
[133] | 2276 | case WM_PRESPARAMCHANGED:
|
---|
[551] | 2277 | if (fRunning) {
|
---|
[2] | 2278 |
|
---|
[133] | 2279 | ULONG AttrFound, AttrValue[64], cbRetLen;
|
---|
[2] | 2280 |
|
---|
[133] | 2281 | cbRetLen = WinQueryPresParam(hwnd,
|
---|
[1077] | 2282 | (ULONG) mp1,
|
---|
| 2283 | 0,
|
---|
| 2284 | &AttrFound,
|
---|
| 2285 | (ULONG) sizeof(AttrValue), &AttrValue, 0);
|
---|
[551] | 2286 | if (cbRetLen) {
|
---|
[1077] | 2287 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 2288 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[133] | 2289 | }
|
---|
| 2290 | }
|
---|
| 2291 | break;
|
---|
[2] | 2292 |
|
---|
[133] | 2293 | case WM_CONTEXTMENU:
|
---|
[551] | 2294 | PostMsg(hwndMain, UM_CONTEXTMENU, MPVOID, MPVOID);
|
---|
[133] | 2295 | return MRFROMSHORT(TRUE);
|
---|
[2] | 2296 |
|
---|
[133] | 2297 | case WM_BEGINDRAG:
|
---|
[551] | 2298 | if (hwndTree) {
|
---|
[2] | 2299 |
|
---|
[133] | 2300 | SWP swp;
|
---|
| 2301 | ULONG fl = SWP_ACTIVATE | SWP_SHOW | SWP_ZORDER;
|
---|
[2] | 2302 |
|
---|
[133] | 2303 | WinQueryWindowPos(hwndTree, &swp);
|
---|
| 2304 | if (!(swp.fl & SWP_MAXIMIZE))
|
---|
[1077] | 2305 | fl |= SWP_RESTORE;
|
---|
[133] | 2306 | WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, fl);
|
---|
| 2307 | }
|
---|
| 2308 | break;
|
---|
[2] | 2309 |
|
---|
[133] | 2310 | case UM_SETUP:
|
---|
| 2311 | if (mp1)
|
---|
[1009] | 2312 | strcpy(lastcmd, (CHAR *)mp1);
|
---|
[133] | 2313 | return 0;
|
---|
[2] | 2314 |
|
---|
[133] | 2315 | case UM_RESCAN:
|
---|
[551] | 2316 | if (hwndE && WinIsWindow(WinQueryAnchorBlock(hwnd), hwndE))
|
---|
[133] | 2317 | WinDestroyWindow(hwndE);
|
---|
[551] | 2318 | if (hwndB && WinIsWindow(WinQueryAnchorBlock(hwnd), hwndB))
|
---|
[133] | 2319 | WinDestroyWindow(hwndB);
|
---|
[551] | 2320 | hwndE = hwndB = (HWND) 0;
|
---|
[133] | 2321 | return 0;
|
---|
[2] | 2322 |
|
---|
[133] | 2323 | case WM_COMMAND:
|
---|
[551] | 2324 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 2325 | case COMMAND_BUTTON:
|
---|
| 2326 | PostMsg(hwndE, msg, mp1, mp2);
|
---|
| 2327 | break;
|
---|
| 2328 | }
|
---|
| 2329 | return 0;
|
---|
[2] | 2330 |
|
---|
[133] | 2331 | case WM_MOUSEMOVE:
|
---|
| 2332 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 2333 | {
|
---|
| 2334 | USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 2335 | char *s = NULL;
|
---|
[2] | 2336 |
|
---|
[551] | 2337 | if (fOtherHelp) {
|
---|
[1077] | 2338 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
---|
| 2339 | && !WinQueryCapture(HWND_DESKTOP)) {
|
---|
| 2340 | switch (id) {
|
---|
| 2341 | case IDM_ATTRS:
|
---|
| 2342 | if (WinQueryWindowTextLength(hwnd))
|
---|
| 2343 | s = GetPString(IDS_ATTRSBUTTONHELP);
|
---|
| 2344 | break;
|
---|
| 2345 | case IDM_INFO:
|
---|
| 2346 | if (WinQueryWindowTextLength(hwnd))
|
---|
| 2347 | s = GetPString(IDS_INFOBUTTONHELP);
|
---|
| 2348 | break;
|
---|
| 2349 | case IDM_RENAME:
|
---|
| 2350 | if (WinQueryWindowTextLength(hwnd))
|
---|
| 2351 | s = GetPString(IDS_NAMEBUTTONHELP);
|
---|
| 2352 | break;
|
---|
| 2353 | case MAIN_STATUS2:
|
---|
| 2354 | if (!hwndE)
|
---|
| 2355 | s = GetPString(IDS_STATUS2HELP);
|
---|
| 2356 | break;
|
---|
| 2357 | default:
|
---|
| 2358 | break;
|
---|
| 2359 | }
|
---|
| 2360 | if (s)
|
---|
| 2361 | MakeBubble(hwnd, FALSE, s);
|
---|
| 2362 | else if (hwndBubble)
|
---|
| 2363 | WinDestroyWindow(hwndBubble);
|
---|
| 2364 | }
|
---|
[133] | 2365 | }
|
---|
[551] | 2366 | switch (id) {
|
---|
[133] | 2367 | case IDM_ATTRS:
|
---|
| 2368 | case IDM_INFO:
|
---|
| 2369 | case IDM_RENAME:
|
---|
| 2370 | case MAIN_STATUS2:
|
---|
[1077] | 2371 | return CommonTextProc(hwnd, msg, mp1, mp2);
|
---|
[133] | 2372 | default:
|
---|
[1077] | 2373 | break;
|
---|
[133] | 2374 | }
|
---|
| 2375 | }
|
---|
| 2376 | break;
|
---|
[2] | 2377 |
|
---|
[133] | 2378 | case WM_BUTTON2DOWN:
|
---|
| 2379 | case WM_BUTTON2UP:
|
---|
| 2380 | case UM_FOCUSME:
|
---|
| 2381 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
[2] | 2382 |
|
---|
[133] | 2383 | case WM_BUTTON1DOWN:
|
---|
| 2384 | case WM_BUTTON1UP:
|
---|
| 2385 | case WM_BUTTON3DOWN:
|
---|
| 2386 | case WM_BUTTON3UP:
|
---|
| 2387 | {
|
---|
| 2388 | USHORT id;
|
---|
| 2389 |
|
---|
| 2390 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 2391 | switch (id) {
|
---|
[133] | 2392 | case IDM_ATTRS:
|
---|
| 2393 | case IDM_INFO:
|
---|
| 2394 | case IDM_RENAME:
|
---|
| 2395 | case MAIN_STATUS2:
|
---|
[1077] | 2396 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
[133] | 2397 | default:
|
---|
[1077] | 2398 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
| 2399 | break;
|
---|
[133] | 2400 | }
|
---|
| 2401 | }
|
---|
| 2402 | break;
|
---|
[2] | 2403 |
|
---|
[133] | 2404 | case WM_SETFOCUS:
|
---|
[551] | 2405 | if (mp2) {
|
---|
[2] | 2406 |
|
---|
[133] | 2407 | USHORT id;
|
---|
[2] | 2408 |
|
---|
[133] | 2409 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 2410 | if (id == MAIN_STATUS2 && hwndE)
|
---|
[1077] | 2411 | WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
[133] | 2412 | else
|
---|
[1077] | 2413 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
[133] | 2414 | }
|
---|
| 2415 | break;
|
---|
[2] | 2416 |
|
---|
[133] | 2417 | case WM_BUTTON1CLICK:
|
---|
| 2418 | {
|
---|
| 2419 | USHORT id;
|
---|
[2] | 2420 |
|
---|
[133] | 2421 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 2422 | if (id == MAIN_STATUS) {
|
---|
[1077] | 2423 | if (SHORT2FROMMP(mp2) & KC_CTRL)
|
---|
| 2424 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 2425 | FID_CLIENT),
|
---|
| 2426 | WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
---|
| 2427 | else if (hwndTree)
|
---|
| 2428 | PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID);
|
---|
[2] | 2429 | }
|
---|
[133] | 2430 | }
|
---|
| 2431 | break;
|
---|
[2] | 2432 |
|
---|
[133] | 2433 | case UM_CLICKED:
|
---|
| 2434 | case UM_CLICKED3:
|
---|
| 2435 | {
|
---|
| 2436 | USHORT id;
|
---|
| 2437 |
|
---|
| 2438 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 2439 | if (id == MAIN_STATUS2 && !hwndE) {
|
---|
[2] | 2440 |
|
---|
[1077] | 2441 | SWP swp;
|
---|
| 2442 | CHAR directory[CCHMAXPATH];
|
---|
| 2443 | PFNWP oldproce;
|
---|
[2] | 2444 |
|
---|
[1077] | 2445 | *directory = 0;
|
---|
| 2446 | TopWindowName(hwndMain, (HWND) 0, directory);
|
---|
| 2447 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 2448 | hwndB = WinCreateWindow(hwnd,
|
---|
| 2449 | WC_BUTTON,
|
---|
| 2450 | "+",
|
---|
| 2451 | WS_VISIBLE | BS_PUSHBUTTON |
|
---|
| 2452 | BS_NOPOINTERFOCUS,
|
---|
| 2453 | swp.cx - swp.cy,
|
---|
| 2454 | 0,
|
---|
| 2455 | swp.cy,
|
---|
| 2456 | swp.cy,
|
---|
| 2457 | hwnd, HWND_TOP, COMMAND_BUTTON, NULL, NULL);
|
---|
| 2458 | if (!hwndB)
|
---|
| 2459 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
| 2460 | hwndE = WinCreateWindow(hwnd,
|
---|
| 2461 | WC_ENTRYFIELD,
|
---|
| 2462 | NULL,
|
---|
| 2463 | WS_VISIBLE | ES_AUTOSCROLL,
|
---|
| 2464 | 0,
|
---|
| 2465 | 0,
|
---|
| 2466 | swp.cx - swp.cy,
|
---|
| 2467 | swp.cy,
|
---|
| 2468 | hwnd, HWND_TOP, COMMAND_LINE, NULL, NULL);
|
---|
| 2469 | if (!hwndE)
|
---|
| 2470 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
| 2471 | if (!hwndE || !hwndB) {
|
---|
| 2472 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
| 2473 | return 0;
|
---|
| 2474 | }
|
---|
| 2475 | WinSendMsg(hwndE, EM_SETTEXTLIMIT, MPFROM2SHORT(1024, 0), MPVOID);
|
---|
| 2476 | WinSetWindowText(hwndStatus, directory);
|
---|
| 2477 | if (*lastcmd)
|
---|
| 2478 | WinSetWindowText(hwndE, lastcmd);
|
---|
| 2479 | else
|
---|
| 2480 | WinSetWindowText(hwndE, GetPString(IDS_HELPCMDTEXT));
|
---|
| 2481 | oldproce = WinSubclassWindow(hwndE, (PFNWP) CommandLineProc);
|
---|
| 2482 | if (oldproce)
|
---|
| 2483 | WinSetWindowPtr(hwndE, QWL_USER, (PVOID) oldproce);
|
---|
| 2484 | PostMsg(hwndE, UM_FOCUSME, MPVOID, MPVOID);
|
---|
| 2485 | PostMsg(hwndE, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);
|
---|
| 2486 | return 0;
|
---|
[133] | 2487 | }
|
---|
[551] | 2488 | if (msg == UM_CLICKED3 || (SHORT2FROMMP(mp2) & KC_CTRL)) {
|
---|
[1077] | 2489 | switch (id) {
|
---|
| 2490 | case IDM_ATTRS:
|
---|
| 2491 | id = IDM_SORTSIZE;
|
---|
| 2492 | break;
|
---|
| 2493 | case IDM_INFO:
|
---|
| 2494 | id = IDM_SORTLWDATE;
|
---|
| 2495 | break;
|
---|
| 2496 | case IDM_RENAME:
|
---|
| 2497 | id = IDM_SORTFILENAME;
|
---|
| 2498 | break;
|
---|
| 2499 | }
|
---|
[133] | 2500 | }
|
---|
| 2501 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 2502 | WM_COMMAND, MPFROM2SHORT(id, 0), MPVOID);
|
---|
[133] | 2503 | }
|
---|
| 2504 | return 0;
|
---|
[2] | 2505 |
|
---|
[133] | 2506 | case WM_PAINT:
|
---|
| 2507 | {
|
---|
| 2508 | USHORT id;
|
---|
[2] | 2509 |
|
---|
[133] | 2510 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 2511 | switch (id) {
|
---|
[133] | 2512 | case IDM_ATTRS:
|
---|
| 2513 | case IDM_INFO:
|
---|
| 2514 | case IDM_RENAME:
|
---|
| 2515 | case MAIN_STATUS2:
|
---|
[1077] | 2516 | PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
|
---|
| 2517 | break;
|
---|
[133] | 2518 | default:
|
---|
[1077] | 2519 | PaintRecessedWindow(hwnd, (HPS) 0, FALSE, TRUE);
|
---|
| 2520 | break;
|
---|
[133] | 2521 | }
|
---|
[551] | 2522 | if (id == IDM_RENAME) {
|
---|
[2] | 2523 |
|
---|
[1077] | 2524 | HPS hps;
|
---|
[2] | 2525 |
|
---|
[1077] | 2526 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
---|
| 2527 | if (hps) {
|
---|
| 2528 | PaintSTextWindow(hwnd, hps);
|
---|
| 2529 | WinEndPaint(hps);
|
---|
| 2530 | }
|
---|
| 2531 | return 0;
|
---|
[2] | 2532 | }
|
---|
[133] | 2533 | }
|
---|
| 2534 | break;
|
---|
[2] | 2535 |
|
---|
[133] | 2536 | }
|
---|
| 2537 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
[2] | 2538 | }
|
---|
| 2539 |
|
---|
[133] | 2540 | MRESULT EXPENTRY ToolBackProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 2541 | {
|
---|
[551] | 2542 | switch (msg) {
|
---|
[133] | 2543 | case WM_CREATE:
|
---|
| 2544 | hwndToolback = hwnd;
|
---|
[926] | 2545 | RestorePresParams(hwnd, "ToolBar");
|
---|
[133] | 2546 | break;
|
---|
[2] | 2547 |
|
---|
[133] | 2548 | case WM_MOUSEMOVE:
|
---|
| 2549 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 2550 | break;
|
---|
[2] | 2551 |
|
---|
[133] | 2552 | case WM_CONTROLPOINTER:
|
---|
[551] | 2553 | if (!fNoFinger && SHORT1FROMMP(mp1) < 25000)
|
---|
[133] | 2554 | return MRFROMLONG(hptrFinger);
|
---|
| 2555 | break;
|
---|
[2] | 2556 |
|
---|
[133] | 2557 | case WM_CHAR:
|
---|
| 2558 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 2559 | break;
|
---|
[2] | 2560 |
|
---|
[133] | 2561 | case WM_COMMAND:
|
---|
| 2562 | case UM_COMMAND:
|
---|
| 2563 | return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 2564 | FID_CLIENT), msg, mp1, mp2);
|
---|
[2] | 2565 |
|
---|
[133] | 2566 | case WM_PAINT:
|
---|
[926] | 2567 |
|
---|
| 2568 | PaintRecessedWindow(hwnd, (HPS)0, TRUE, FALSE);
|
---|
| 2569 |
|
---|
[133] | 2570 | {
|
---|
| 2571 | HPS hps;
|
---|
| 2572 | RECTL rcl;
|
---|
[1107] | 2573 | ULONG lColor = NULL;
|
---|
[2] | 2574 |
|
---|
[926] | 2575 | hps = WinBeginPaint(hwnd, (HPS)0, NULL);
|
---|
[551] | 2576 | if (hps) {
|
---|
[1077] | 2577 | GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);
|
---|
| 2578 | WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, NULL,
|
---|
[1107] | 2579 | sizeof(lColor), &lColor, 0);
|
---|
| 2580 | if (!lColor)
|
---|
| 2581 | lColor = CLR_PALEGRAY;
|
---|
[1077] | 2582 | WinQueryWindowRect(hwnd, &rcl);
|
---|
| 2583 | WinFillRect(hps, &rcl, lColor);
|
---|
| 2584 | WinEndPaint(hps);
|
---|
[133] | 2585 | }
|
---|
[926] | 2586 |
|
---|
[133] | 2587 | }
|
---|
| 2588 | break;
|
---|
[2] | 2589 |
|
---|
[926] | 2590 | case WM_PRESPARAMCHANGED:
|
---|
| 2591 | PresParamChanged(hwnd, "ToolBar", mp1, mp2);
|
---|
[946] | 2592 | WinInvalidateRect(hwnd, NULL, TRUE);
|
---|
[926] | 2593 | break;
|
---|
| 2594 |
|
---|
[133] | 2595 | case UM_SETUP:
|
---|
| 2596 | {
|
---|
| 2597 | USHORT id;
|
---|
| 2598 | TOOL *tool;
|
---|
[2] | 2599 |
|
---|
[133] | 2600 | id = SHORT1FROMMP(mp1);
|
---|
| 2601 | tool = find_tool(id);
|
---|
[551] | 2602 | if (tool) {
|
---|
[1077] | 2603 | del_tool(tool);
|
---|
| 2604 | WinShowWindow(WinWindowFromID(hwnd, id), FALSE);
|
---|
| 2605 | if (fToolTitles)
|
---|
| 2606 | WinShowWindow(WinWindowFromID(hwnd, id + 25000), FALSE);
|
---|
[1121] | 2607 | ResizeTools(hwnd);
|
---|
| 2608 | save_tools(NULL);
|
---|
[133] | 2609 | }
|
---|
| 2610 | }
|
---|
| 2611 | return 0;
|
---|
[2] | 2612 |
|
---|
[1125] | 2613 | case UM_SETUP2: /* Used to load a new a toolbar */
|
---|
| 2614 | BuildTools(hwnd, TRUE);
|
---|
| 2615 | return 0;
|
---|
| 2616 |
|
---|
[133] | 2617 | case WM_CHORD:
|
---|
| 2618 | {
|
---|
| 2619 | USHORT id;
|
---|
[2] | 2620 |
|
---|
[133] | 2621 | id = (USHORT) WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 2622 | hwnd,
|
---|
| 2623 | AddToolProc,
|
---|
| 2624 | FM3ModHandle, ADDBTN_FRAME, MPVOID);
|
---|
[133] | 2625 | if (id && id != (USHORT) - 1)
|
---|
[1077] | 2626 | WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 2627 | FID_CLIENT),
|
---|
| 2628 | WM_COMMAND,
|
---|
| 2629 | MPFROM2SHORT(IDM_CREATETOOL, 0), MPFROM2SHORT(id, 0));
|
---|
[133] | 2630 | }
|
---|
| 2631 | break;
|
---|
[2] | 2632 |
|
---|
[133] | 2633 | case WM_CONTEXTMENU:
|
---|
| 2634 | if (WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 2635 | hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID))
|
---|
[1125] | 2636 | PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
|
---|
[133] | 2637 | return MRFROMSHORT(TRUE);
|
---|
[2] | 2638 |
|
---|
[133] | 2639 | case WM_CLOSE:
|
---|
| 2640 | WinDestroyWindow(hwnd);
|
---|
| 2641 | return 0;
|
---|
[2] | 2642 |
|
---|
[133] | 2643 | case WM_DESTROY:
|
---|
| 2644 | break;
|
---|
| 2645 | }
|
---|
| 2646 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 2647 | }
|
---|
| 2648 |
|
---|
[178] | 2649 | static VOID AdjustSizeOfClient(PSWP pswp, PRECTL prectl)
|
---|
[133] | 2650 | {
|
---|
| 2651 | SWP swp;
|
---|
| 2652 | RECTL rectl;
|
---|
[2] | 2653 |
|
---|
[133] | 2654 | if (fFreeTree)
|
---|
| 2655 | return;
|
---|
[551] | 2656 | if (pswp) {
|
---|
[133] | 2657 | if (WinQueryWindowPos(hwndTree, &swp) &&
|
---|
[1077] | 2658 | !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) {
|
---|
[551] | 2659 | pswp->x = swp.cx;
|
---|
| 2660 | pswp->cx -= swp.cx;
|
---|
[133] | 2661 | }
|
---|
| 2662 | }
|
---|
[551] | 2663 | if (prectl) {
|
---|
[133] | 2664 | if (WinQueryWindowPos(hwndTree, &swp) &&
|
---|
[1077] | 2665 | !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) &&
|
---|
| 2666 | WinQueryWindowRect(hwndTree, &rectl)) {
|
---|
[551] | 2667 | prectl->xLeft = rectl.xRight;
|
---|
| 2668 | prectl->xRight -= rectl.xRight;
|
---|
[133] | 2669 | }
|
---|
| 2670 | }
|
---|
[2] | 2671 | }
|
---|
| 2672 |
|
---|
[133] | 2673 | VOID FillClient(HWND hwndClient, PSWP pswp, PRECTL prectl, BOOL avoidtree)
|
---|
| 2674 | {
|
---|
| 2675 | ULONG adjust;
|
---|
[2] | 2676 |
|
---|
[133] | 2677 | adjust = WinQuerySysValue(HWND_DESKTOP, SV_CYICON);
|
---|
| 2678 | if (pswp)
|
---|
| 2679 | WinQueryWindowPos(hwndClient, pswp);
|
---|
| 2680 | if (prectl)
|
---|
| 2681 | WinQueryWindowRect(hwndClient, prectl);
|
---|
| 2682 | if (avoidtree && !fFreeTree)
|
---|
| 2683 | AdjustSizeOfClient(pswp, prectl);
|
---|
| 2684 | if (prectl)
|
---|
[551] | 2685 | prectl->yBottom += adjust;
|
---|
| 2686 | if (pswp) {
|
---|
[133] | 2687 | if (!avoidtree || fFreeTree)
|
---|
[551] | 2688 | pswp->x = 0;
|
---|
| 2689 | pswp->y = adjust;
|
---|
| 2690 | if (pswp->cy >= adjust)
|
---|
| 2691 | pswp->cy -= adjust;
|
---|
[133] | 2692 | else
|
---|
[551] | 2693 | pswp->cy = 0;
|
---|
[133] | 2694 | }
|
---|
[2] | 2695 | }
|
---|
| 2696 |
|
---|
[178] | 2697 | static VOID MoveChildrenAwayFromTree(HWND hwndClient)
|
---|
[133] | 2698 | {
|
---|
| 2699 | SWP swpC, swpT, swp;
|
---|
| 2700 | USHORT id;
|
---|
| 2701 | HWND hwndChild;
|
---|
| 2702 | HENUM henum;
|
---|
[2] | 2703 |
|
---|
[133] | 2704 | if (fFreeTree)
|
---|
| 2705 | return;
|
---|
| 2706 | WinQueryWindowPos(hwndClient, &swpC);
|
---|
| 2707 | if (swpC.fl & (SWP_MINIMIZE | SWP_HIDE))
|
---|
| 2708 | return;
|
---|
| 2709 | WinQueryWindowPos(hwndTree, &swpT);
|
---|
| 2710 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 2711 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 2712 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
---|
| 2713 | if (!id || id == TREE_FRAME)
|
---|
| 2714 | continue;
|
---|
| 2715 | WinQueryWindowPos(hwndChild, &swp);
|
---|
[551] | 2716 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
| 2717 | if (swp.x < swpT.cx) {
|
---|
[1077] | 2718 | swp.x = swpT.cx;
|
---|
| 2719 | if (swp.x + swp.cx > swpC.cx)
|
---|
| 2720 | swp.cx = swpC.cx - swp.x;
|
---|
| 2721 | if (swp.cx > 24)
|
---|
| 2722 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
| 2723 | SWP_SIZE | SWP_MOVE | SWP_SHOW);
|
---|
[133] | 2724 | }
|
---|
| 2725 | }
|
---|
| 2726 | }
|
---|
| 2727 | WinEndEnumWindows(henum);
|
---|
[2] | 2728 | }
|
---|
| 2729 |
|
---|
[178] | 2730 | static VOID ArrangeIcons(HWND hwndClient)
|
---|
[133] | 2731 | {
|
---|
| 2732 | HENUM henum;
|
---|
| 2733 | HWND hwndChild;
|
---|
| 2734 | SWP swp;
|
---|
[2] | 2735 |
|
---|
[133] | 2736 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 2737 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 2738 | WinQueryWindowPos(hwndChild, &swp);
|
---|
[551] | 2739 | if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {
|
---|
[133] | 2740 | WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1);
|
---|
| 2741 | WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);
|
---|
| 2742 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,
|
---|
[1077] | 2743 | SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE);
|
---|
[133] | 2744 | }
|
---|
| 2745 | }
|
---|
| 2746 | WinEndEnumWindows(henum);
|
---|
[2] | 2747 | }
|
---|
| 2748 |
|
---|
[178] | 2749 | static VOID NextChild(HWND hwndClient, BOOL previous)
|
---|
[133] | 2750 | {
|
---|
| 2751 | HENUM henum;
|
---|
[551] | 2752 | HWND hwndActive, hwndNext, hwndPrev = (HWND) 0;
|
---|
[133] | 2753 | BOOL next = FALSE, once = FALSE;
|
---|
[2] | 2754 |
|
---|
[133] | 2755 | previous = !previous;
|
---|
[2] | 2756 |
|
---|
[133] | 2757 | hwndActive = WinQueryActiveWindow(hwndClient);
|
---|
| 2758 | if (!hwndActive)
|
---|
| 2759 | next = TRUE;
|
---|
| 2760 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 2761 | for (;;) {
|
---|
[133] | 2762 | hwndNext = WinGetNextWindow(henum);
|
---|
[551] | 2763 | if (hwndNext) {
|
---|
[133] | 2764 | if (!WinQueryWindowUShort(hwndNext, QWS_ID))
|
---|
[1077] | 2765 | continue;
|
---|
[133] | 2766 | if (next)
|
---|
[1077] | 2767 | break;
|
---|
[551] | 2768 | if (hwndNext == hwndActive) {
|
---|
[1077] | 2769 | if (!previous && hwndPrev) {
|
---|
| 2770 | hwndNext = hwndPrev;
|
---|
| 2771 | break;
|
---|
| 2772 | }
|
---|
| 2773 | else if (previous)
|
---|
| 2774 | next = TRUE;
|
---|
[133] | 2775 | }
|
---|
| 2776 | hwndPrev = hwndNext;
|
---|
| 2777 | }
|
---|
[551] | 2778 | else {
|
---|
[133] | 2779 | if ((!next && previous) || once)
|
---|
[1077] | 2780 | break;
|
---|
[551] | 2781 | else if (!previous) {
|
---|
[1077] | 2782 | hwndNext = hwndPrev;
|
---|
| 2783 | break;
|
---|
[133] | 2784 | }
|
---|
| 2785 | else
|
---|
[1077] | 2786 | once = next = TRUE;
|
---|
[133] | 2787 | }
|
---|
| 2788 | }
|
---|
| 2789 | WinEndEnumWindows(henum);
|
---|
[2] | 2790 |
|
---|
[551] | 2791 | if (hwndNext && hwndNext != hwndActive) {
|
---|
| 2792 | WinSetWindowPos(hwndNext, HWND_TOP, 0, 0, 0, 0,
|
---|
[1077] | 2793 | SWP_ZORDER | SWP_ACTIVATE);
|
---|
[551] | 2794 | WinSetWindowPos(hwndActive, ((previous) ? HWND_BOTTOM : hwndNext), 0, 0,
|
---|
[1077] | 2795 | 0, 0, SWP_ZORDER);
|
---|
[133] | 2796 | }
|
---|
[2] | 2797 | }
|
---|
| 2798 |
|
---|
[133] | 2799 | BOOL CloseChildren(HWND hwndClient)
|
---|
| 2800 | {
|
---|
| 2801 | HENUM henum;
|
---|
| 2802 | HWND hwndChild;
|
---|
| 2803 | BOOL ret = FALSE;
|
---|
[2] | 2804 |
|
---|
[133] | 2805 | fNoTileUpdate = TRUE;
|
---|
| 2806 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 2807 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 2808 | if (hwndChild != hwndTree) {
|
---|
[133] | 2809 | WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
---|
[1077] | 2810 | WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
---|
[133] | 2811 | if (WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
---|
[1077] | 2812 | WM_CLOSE, MPVOID, MPVOID)) {
|
---|
| 2813 | ret = TRUE;
|
---|
| 2814 | break;
|
---|
[133] | 2815 | }
|
---|
| 2816 | }
|
---|
| 2817 | }
|
---|
| 2818 | WinEndEnumWindows(henum);
|
---|
| 2819 | fNoTileUpdate = FALSE;
|
---|
| 2820 | return ret;
|
---|
[2] | 2821 | }
|
---|
| 2822 |
|
---|
[133] | 2823 | BOOL CloseDirCnrChildren(HWND hwndClient)
|
---|
| 2824 | {
|
---|
| 2825 | /* returns TRUE if a directory container window was told to close */
|
---|
[2] | 2826 |
|
---|
[133] | 2827 | HENUM henum;
|
---|
| 2828 | HWND hwndChild, hwndDir, hwndTemp;
|
---|
| 2829 | BOOL ret = FALSE;
|
---|
[2] | 2830 |
|
---|
[133] | 2831 | fNoTileUpdate = TRUE;
|
---|
| 2832 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 2833 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 2834 | if (hwndChild != hwndTree) {
|
---|
[133] | 2835 | hwndTemp = WinWindowFromID(hwndChild, FID_CLIENT);
|
---|
[551] | 2836 | if (hwndTemp) {
|
---|
[1077] | 2837 | hwndDir = WinWindowFromID(hwndTemp, DIR_CNR);
|
---|
| 2838 | if (hwndDir) {
|
---|
| 2839 | WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
---|
| 2840 | WM_CLOSE, MPVOID, MPVOID);
|
---|
| 2841 | ret = TRUE;
|
---|
| 2842 | }
|
---|
[133] | 2843 | }
|
---|
| 2844 | }
|
---|
| 2845 | }
|
---|
| 2846 | WinEndEnumWindows(henum);
|
---|
| 2847 | fNoTileUpdate = FALSE;
|
---|
| 2848 | return ret;
|
---|
[2] | 2849 | }
|
---|
| 2850 |
|
---|
[557] | 2851 | /** Save directory container state
|
---|
| 2852 | * @param hwndClient Client window handle
|
---|
| 2853 | * @param pszStateName State name to save, NULL to save global state
|
---|
[789] | 2854 | * @returns Number of directory container windows that were saved or -1 if error
|
---|
[557] | 2855 | * @seealso RestoreDirCnrState
|
---|
| 2856 | */
|
---|
| 2857 |
|
---|
[930] | 2858 | #define STATE_NAME_MAX_BYTES 256
|
---|
[787] | 2859 |
|
---|
[789] | 2860 | INT SaveDirCnrState(HWND hwndClient, PSZ pszStateName)
|
---|
[133] | 2861 | {
|
---|
| 2862 | HENUM henum;
|
---|
| 2863 | HWND hwndChild, hwndDir, hwndC;
|
---|
| 2864 | ULONG numsaves = 0, flWindowAttr;
|
---|
[1060] | 2865 | ULONG previous_numsaves, ulTemp = sizeof(ULONG);
|
---|
[787] | 2866 | CHAR szPrefix[STATE_NAME_MAX_BYTES + 1];
|
---|
| 2867 | CHAR szKey[STATE_NAME_MAX_BYTES + 80];
|
---|
[558] | 2868 | CHAR szDir[CCHMAXPATH];
|
---|
[133] | 2869 | SWP swp;
|
---|
| 2870 | DIRCNRDATA *dcd;
|
---|
[941] | 2871 | BOOL fIsShutDownState;
|
---|
[2] | 2872 |
|
---|
[941] | 2873 | if (!pszStateName || !*pszStateName) {
|
---|
| 2874 | Runtime_Error(pszSrcFile, __LINE__, "no data");
|
---|
[789] | 2875 | return -1;
|
---|
[558] | 2876 | }
|
---|
[941] | 2877 | if (strlen(pszStateName) > sizeof(szPrefix) - 2) {
|
---|
| 2878 | Runtime_Error(pszSrcFile, __LINE__, "SaveDirCnrState");
|
---|
| 2879 | return -1;
|
---|
| 2880 | }
|
---|
[558] | 2881 |
|
---|
[961] | 2882 | fIsShutDownState = strcmp(pszStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0;
|
---|
[941] | 2883 | sprintf(szPrefix, "%s.", pszStateName);
|
---|
| 2884 |
|
---|
[1128] | 2885 | if (*lasttoolbar) {
|
---|
| 2886 | sprintf(szKey, "%sToolbar", szPrefix);
|
---|
| 2887 | PrfWriteProfileString(fmprof, FM3Str, szKey, lasttoolbar);
|
---|
| 2888 | }
|
---|
[1125] | 2889 |
|
---|
[1134] | 2890 | if (!fIsShutDownState) {
|
---|
[1128] | 2891 | sprintf(szKey, "%sTargetDir", szPrefix);
|
---|
| 2892 | PrfWriteProfileString(fmprof, FM3Str, szKey, targetdir);
|
---|
| 2893 | }
|
---|
| 2894 |
|
---|
[133] | 2895 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 2896 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 2897 | if (hwndChild != hwndTree) {
|
---|
[133] | 2898 | hwndC = WinWindowFromID(hwndChild, FID_CLIENT);
|
---|
[551] | 2899 | if (hwndC) {
|
---|
[1077] | 2900 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
---|
| 2901 | if (hwndDir) {
|
---|
| 2902 | WinQueryWindowPos(hwndChild, &swp);
|
---|
| 2903 | *szDir = 0;
|
---|
| 2904 | WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(szDir), MPVOID);
|
---|
| 2905 | if (*szDir) {
|
---|
| 2906 | // If saving shutdown state skip no prescan drives
|
---|
| 2907 | if (fIsShutDownState &&
|
---|
| 2908 | driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
|
---|
| 2909 | continue;
|
---|
| 2910 | }
|
---|
| 2911 | sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves);
|
---|
| 2912 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp,
|
---|
| 2913 | sizeof(SWP));
|
---|
| 2914 | dcd =
|
---|
| 2915 | WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
| 2916 | if (dcd) {
|
---|
| 2917 | sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves);
|
---|
| 2918 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags,
|
---|
| 2919 | sizeof(INT));
|
---|
| 2920 | sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves);
|
---|
| 2921 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask,
|
---|
| 2922 | sizeof(MASK));
|
---|
| 2923 | sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves);
|
---|
| 2924 | flWindowAttr = dcd->flWindowAttr;
|
---|
| 2925 | if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
|
---|
| 2926 | flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
|
---|
| 2927 | if (dcd->lastattr) {
|
---|
| 2928 | if (dcd->lastattr & CV_TEXT)
|
---|
| 2929 | flWindowAttr |= CV_TEXT;
|
---|
| 2930 | else if (dcd->lastattr & CV_DETAIL)
|
---|
| 2931 | flWindowAttr |= CV_DETAIL;
|
---|
| 2932 | else if (dcd->lastattr & CV_ICON)
|
---|
| 2933 | flWindowAttr |= CV_ICON;
|
---|
| 2934 | else
|
---|
| 2935 | flWindowAttr |= CV_NAME;
|
---|
| 2936 | }
|
---|
| 2937 | else
|
---|
| 2938 | flWindowAttr |= CV_NAME;
|
---|
| 2939 | }
|
---|
| 2940 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr,
|
---|
| 2941 | sizeof(ULONG));
|
---|
| 2942 | sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves);
|
---|
| 2943 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslongname,
|
---|
| 2944 | sizeof(BOOL));
|
---|
| 2945 | sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, numsaves);
|
---|
| 2946 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssubject,
|
---|
| 2947 | sizeof(BOOL));
|
---|
| 2948 | sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, numsaves);
|
---|
| 2949 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssize,
|
---|
| 2950 | sizeof(BOOL));
|
---|
| 2951 | sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, numsaves);
|
---|
| 2952 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsea,
|
---|
| 2953 | sizeof(BOOL));
|
---|
| 2954 | sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, numsaves);
|
---|
| 2955 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsattr,
|
---|
| 2956 | sizeof(BOOL));
|
---|
| 2957 | sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, numsaves);
|
---|
| 2958 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsicon,
|
---|
| 2959 | sizeof(BOOL));
|
---|
| 2960 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, numsaves);
|
---|
| 2961 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwdate,
|
---|
| 2962 | sizeof(BOOL));
|
---|
| 2963 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, numsaves);
|
---|
| 2964 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwtime,
|
---|
| 2965 | sizeof(BOOL));
|
---|
| 2966 | sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, numsaves);
|
---|
| 2967 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsladate,
|
---|
| 2968 | sizeof(BOOL));
|
---|
| 2969 | sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, numsaves);
|
---|
| 2970 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslatime,
|
---|
| 2971 | sizeof(BOOL));
|
---|
| 2972 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, numsaves);
|
---|
| 2973 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrdate,
|
---|
| 2974 | sizeof(BOOL));
|
---|
| 2975 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, numsaves);
|
---|
| 2976 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrtime,
|
---|
| 2977 | sizeof(BOOL));
|
---|
| 2978 | sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves);
|
---|
| 2979 | SavePresParams(hwndDir, szKey);
|
---|
| 2980 | }
|
---|
| 2981 | sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++);
|
---|
| 2982 | PrfWriteProfileString(fmprof, FM3Str, szKey, szDir);
|
---|
| 2983 | }
|
---|
| 2984 | }
|
---|
[133] | 2985 | }
|
---|
| 2986 | }
|
---|
[557] | 2987 | } // while
|
---|
[133] | 2988 | WinEndEnumWindows(henum);
|
---|
[558] | 2989 |
|
---|
[1060] | 2990 | sprintf(szKey, "%sNumDirsLastTime", szPrefix);
|
---|
| 2991 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &previous_numsaves, &ulTemp))
|
---|
| 2992 | for (ulTemp = numsaves; ulTemp < previous_numsaves; ulTemp++) {
|
---|
| 2993 | sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, ulTemp);
|
---|
| 2994 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(SWP));
|
---|
| 2995 | sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, ulTemp);
|
---|
| 2996 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(INT));
|
---|
| 2997 | sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, ulTemp);
|
---|
| 2998 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(MASK));
|
---|
| 2999 | sprintf(szKey, "%sDirCnrView.%lu", szPrefix, ulTemp);
|
---|
| 3000 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(ULONG));
|
---|
| 3001 | sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, ulTemp);
|
---|
| 3002 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 3003 | sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, ulTemp);
|
---|
| 3004 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 3005 | sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, ulTemp);
|
---|
| 3006 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 3007 | sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, ulTemp);
|
---|
| 3008 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 3009 | sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, ulTemp);
|
---|
| 3010 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 3011 | sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, ulTemp);
|
---|
| 3012 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 3013 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, ulTemp);
|
---|
| 3014 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 3015 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, ulTemp);
|
---|
| 3016 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 3017 | sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, ulTemp);
|
---|
| 3018 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 3019 | sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, ulTemp);
|
---|
| 3020 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 3021 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, ulTemp);
|
---|
| 3022 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 3023 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, ulTemp);
|
---|
| 3024 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 3025 | sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, ulTemp);
|
---|
| 3026 | PrfWriteProfileString(fmprof, FM3Str, szKey, NULL);
|
---|
| 3027 | sprintf(szKey, "%sDirCnr.%lu.", szPrefix, ulTemp);
|
---|
| 3028 | DeletePresParams(szKey);
|
---|
[133] | 3029 | }
|
---|
[1060] | 3030 | sprintf(szKey, "%sNumDirsLastTime", szPrefix);
|
---|
| 3031 | if (numsaves) {
|
---|
[787] | 3032 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & numsaves, sizeof(ULONG));
|
---|
[133] | 3033 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swp);
|
---|
[787] | 3034 | sprintf(szKey, "%sMySizeLastTime", szPrefix);
|
---|
| 3035 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, sizeof(SWP));
|
---|
[1060] | 3036 | if (WinQueryWindowPos(hwndTree, &swp)) {
|
---|
| 3037 | sprintf(szKey, "%sLastTreePos", szPrefix);
|
---|
| 3038 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, sizeof(SWP));
|
---|
| 3039 | }
|
---|
[133] | 3040 | }
|
---|
[1024] | 3041 | else if (fIsShutDownState) {
|
---|
| 3042 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & numsaves, sizeof(ULONG));
|
---|
| 3043 | }
|
---|
[558] | 3044 |
|
---|
[1060] | 3045 | return numsaves;
|
---|
[2] | 3046 | }
|
---|
| 3047 |
|
---|
[178] | 3048 | static VOID TransformSwp(PSWP pswp, double xtrans, double ytrans)
|
---|
[133] | 3049 | {
|
---|
| 3050 | SWP swp;
|
---|
| 3051 | HWND hwnd;
|
---|
[2] | 3052 |
|
---|
[551] | 3053 | if ((LONG) pswp->x < 0L) {
|
---|
| 3054 | pswp->cx -= abs(pswp->x);
|
---|
| 3055 | pswp->x = 0;
|
---|
[133] | 3056 | }
|
---|
[551] | 3057 | if ((LONG) pswp->y < 0L) {
|
---|
| 3058 | pswp->cy -= abs(pswp->y);
|
---|
| 3059 | pswp->y = 0;
|
---|
[133] | 3060 | }
|
---|
[551] | 3061 | pswp->x = (LONG) (((double)pswp->x * 100.0) / xtrans);
|
---|
| 3062 | pswp->cx = (LONG) (((double)pswp->cx * 100.0) / xtrans);
|
---|
| 3063 | pswp->y = (LONG) (((double)pswp->y * 100.0) / ytrans);
|
---|
| 3064 | pswp->cy = (LONG) (((double)pswp->cy * 100.0) / ytrans);
|
---|
| 3065 | if (pswp->hwnd) {
|
---|
| 3066 | hwnd = WinQueryWindow(pswp->hwnd, QW_PARENT);
|
---|
| 3067 | if (hwnd) {
|
---|
| 3068 | if (WinQueryWindowPos(hwnd, &swp)) {
|
---|
[1077] | 3069 | if (pswp->x > swp.cx)
|
---|
| 3070 | pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx;
|
---|
| 3071 | if (pswp->y > swp.cy)
|
---|
| 3072 | pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy;
|
---|
| 3073 | if (pswp->x + pswp->cx > swp.cx)
|
---|
| 3074 | pswp->cx = swp.cx - pswp->x;
|
---|
| 3075 | if (pswp->y + pswp->cy > swp.cy)
|
---|
| 3076 | pswp->cy = swp.cy - pswp->y;
|
---|
[133] | 3077 | }
|
---|
| 3078 | }
|
---|
| 3079 | }
|
---|
[2] | 3080 | }
|
---|
| 3081 |
|
---|
[557] | 3082 | /** Restore directory container state
|
---|
| 3083 | * @param hwndClient Client window handle
|
---|
| 3084 | * @param pszStateName State name to restore, NULL to restore global state
|
---|
[941] | 3085 | * @param noview request view state restore bypass
|
---|
[557] | 3086 | * @returns TRUE if one or more directory containers were opened
|
---|
| 3087 | * @seealso SaveDirCnrState
|
---|
| 3088 | */
|
---|
| 3089 |
|
---|
| 3090 | static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview)
|
---|
[133] | 3091 | {
|
---|
[787] | 3092 | CHAR szKey[STATE_NAME_MAX_BYTES + 80];
|
---|
[558] | 3093 | CHAR szDir[CCHMAXPATH];
|
---|
[787] | 3094 | CHAR szPrefix[STATE_NAME_MAX_BYTES + 2];
|
---|
[1033] | 3095 | HWND hwndDir, hwndC, hwndPPSave = NULLHANDLE;
|
---|
[133] | 3096 | SWP swp, swpO, swpN;
|
---|
[1033] | 3097 | ULONG size, numsaves = 0;
|
---|
| 3098 | LONG x;
|
---|
[133] | 3099 | double xtrans, ytrans;
|
---|
[558] | 3100 | BOOL fRestored = FALSE;
|
---|
[923] | 3101 | DIRCNRDATA localdcd, *dcd;
|
---|
[941] | 3102 | BOOL fIsShutDownState;
|
---|
[961] | 3103 | BOOL fDeleteState;
|
---|
[2] | 3104 |
|
---|
[941] | 3105 | if (!pszStateName || !*pszStateName) {
|
---|
| 3106 | Runtime_Error(pszSrcFile, __LINE__, "no name");
|
---|
| 3107 | return fRestored;
|
---|
[558] | 3108 | }
|
---|
[941] | 3109 | if (strlen(pszStateName) > sizeof(szPrefix) - 2) {
|
---|
| 3110 | Runtime_Error(pszSrcFile, __LINE__, "name too long");
|
---|
| 3111 | return fRestored;
|
---|
| 3112 | }
|
---|
[558] | 3113 |
|
---|
[941] | 3114 | sprintf(szPrefix, "%s.", pszStateName);
|
---|
| 3115 |
|
---|
[961] | 3116 | // If restoring shutdown state bypass no-prescan drives
|
---|
| 3117 | fIsShutDownState = strcmp(pszStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0;
|
---|
[981] | 3118 | // Delete saved state if internally saved state
|
---|
| 3119 | fDeleteState = strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)) == 0;
|
---|
[941] | 3120 |
|
---|
[1125] | 3121 | size = (ULONG)0;
|
---|
| 3122 | sprintf(szKey, "%sToolbar", szPrefix);
|
---|
| 3123 | if (PrfQueryProfileSize(fmprof, FM3Str, szKey, &size) && size)
|
---|
| 3124 | {
|
---|
| 3125 | if (fToolsChanged)
|
---|
| 3126 | save_tools(NULL);
|
---|
| 3127 | PrfQueryProfileData(fmprof, FM3Str, szKey, lasttoolbar, &size);
|
---|
| 3128 | PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar);
|
---|
| 3129 | load_tools(NULL);
|
---|
| 3130 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
---|
| 3131 | }
|
---|
[1128] | 3132 | size = (ULONG)0;
|
---|
| 3133 | sprintf(szKey, "%sTargetDir", szPrefix);
|
---|
| 3134 | if (PrfQueryProfileSize(fmprof, FM3Str, szKey, &size) && size)
|
---|
| 3135 | {
|
---|
| 3136 | PrfQueryProfileData(fmprof, FM3Str, szKey, targetdir, &size);
|
---|
| 3137 | PrfWriteProfileString(fmprof, FM3Str, "TargetDir", targetdir);
|
---|
| 3138 | SetTargetDir(NULL, TRUE);
|
---|
| 3139 | }
|
---|
[133] | 3140 | size = sizeof(SWP);
|
---|
[787] | 3141 | sprintf(szKey, "%sMySizeLastTime", szPrefix);
|
---|
[133] | 3142 | if (!PrfQueryProfileData(fmprof,
|
---|
[1077] | 3143 | FM3Str,
|
---|
| 3144 | szKey,
|
---|
| 3145 | (PVOID) & swpO,
|
---|
| 3146 | &size) ||
|
---|
[133] | 3147 | size != sizeof(SWP) || !swp.cx || !swp.cy)
|
---|
[558] | 3148 | {
|
---|
[133] | 3149 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swpO);
|
---|
[558] | 3150 | }
|
---|
[1060] | 3151 | // If restoring internally saved state, forget info
|
---|
[961] | 3152 | if (fDeleteState)
|
---|
[787] | 3153 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
[133] | 3154 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swpN);
|
---|
| 3155 | if (swpN.fl & (SWP_MINIMIZE | SWP_HIDE))
|
---|
| 3156 | swpN = swpO;
|
---|
[551] | 3157 | xtrans = ((double)swpO.cx * 100.0) / (double)swpN.cx;
|
---|
| 3158 | ytrans = ((double)swpO.cy * 100.0) / (double)swpN.cy;
|
---|
[133] | 3159 | size = sizeof(SWP);
|
---|
[787] | 3160 | sprintf(szKey, "%sLastTreePos", szPrefix);
|
---|
| 3161 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, &size)) {
|
---|
[961] | 3162 | if (fDeleteState)
|
---|
[787] | 3163 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
[133] | 3164 | swp.hwnd = hwndTree;
|
---|
[551] | 3165 | TransformSwp(&swp, xtrans, ytrans);
|
---|
| 3166 | if (!fFreeTree) {
|
---|
[133] | 3167 | WinQueryWindowPos(hwndClient, &swpN);
|
---|
| 3168 | swp.x = 0;
|
---|
| 3169 | swp.y = (swpN.cy - swp.cy);
|
---|
| 3170 | }
|
---|
[551] | 3171 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE))) {
|
---|
[133] | 3172 | swp.fl &= (~SWP_ACTIVATE);
|
---|
[2] | 3173 | WinSetWindowPos(hwndTree,
|
---|
[1077] | 3174 | HWND_TOP,
|
---|
| 3175 | swp.x,
|
---|
| 3176 | swp.y,
|
---|
| 3177 | swp.cx,
|
---|
| 3178 | swp.cy,
|
---|
| 3179 | swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
---|
[133] | 3180 | }
|
---|
[551] | 3181 | else {
|
---|
[2] | 3182 | WinSetWindowPos(hwndTree,
|
---|
[1077] | 3183 | HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);
|
---|
[551] | 3184 | WinSetWindowUShort(hwndTree, QWS_XRESTORE, (USHORT) swp.x);
|
---|
| 3185 | WinSetWindowUShort(hwndTree, QWS_CXRESTORE, (USHORT) swp.cx);
|
---|
| 3186 | WinSetWindowUShort(hwndTree, QWS_YRESTORE, (USHORT) swp.y);
|
---|
| 3187 | WinSetWindowUShort(hwndTree, QWS_CYRESTORE, (USHORT) swp.cy);
|
---|
[133] | 3188 | }
|
---|
| 3189 | }
|
---|
| 3190 | size = sizeof(ULONG);
|
---|
[787] | 3191 | sprintf(szKey, "%sNumDirsLastTime", szPrefix);
|
---|
[133] | 3192 | if (PrfQueryProfileData(fmprof,
|
---|
[1077] | 3193 | FM3Str, szKey, (PVOID) & numsaves, &size)) {
|
---|
[961] | 3194 | if (fDeleteState)
|
---|
[787] | 3195 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
[1033] | 3196 | for (x = numsaves - 1; x >= 0; x--) {
|
---|
[787] | 3197 | sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, x);
|
---|
[133] | 3198 | size = sizeof(SWP);
|
---|
[940] | 3199 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) {
|
---|
[1077] | 3200 | if (fDeleteState)
|
---|
| 3201 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3202 | sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x);
|
---|
| 3203 | size = sizeof(szDir);
|
---|
| 3204 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) {
|
---|
| 3205 | // If restoring shutdown state and drive marked no prescan
|
---|
| 3206 | // bypass window restore
|
---|
| 3207 | if (fIsShutDownState &&
|
---|
| 3208 | driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
|
---|
| 3209 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3210 | continue;
|
---|
| 3211 | }
|
---|
| 3212 | if (fDeleteState)
|
---|
| 3213 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3214 | localdcd.ds.detailslongname = dsDirCnrDefault.detailslongname; // Set default
|
---|
| 3215 | size = sizeof(BOOL);
|
---|
| 3216 | sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x);
|
---|
| 3217 | if (PrfQueryProfileData(fmprof,
|
---|
| 3218 | FM3Str,
|
---|
| 3219 | szKey,
|
---|
| 3220 | (PVOID)&localdcd.ds.detailslongname,
|
---|
| 3221 | &size) &&
|
---|
| 3222 | size == sizeof(BOOL))
|
---|
| 3223 | {
|
---|
| 3224 | if (fDeleteState)
|
---|
| 3225 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3226 | }
|
---|
| 3227 | localdcd.ds.detailssubject = dsDirCnrDefault.detailssubject; // Set default
|
---|
| 3228 | size = sizeof(BOOL);
|
---|
| 3229 | sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, x);
|
---|
| 3230 | if (PrfQueryProfileData(fmprof,
|
---|
| 3231 | FM3Str,
|
---|
| 3232 | szKey,
|
---|
| 3233 | (PVOID)&localdcd.ds.detailssubject,
|
---|
| 3234 | &size) &&
|
---|
| 3235 | size == sizeof(BOOL))
|
---|
| 3236 | {
|
---|
| 3237 | if (fDeleteState)
|
---|
| 3238 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3239 | }
|
---|
| 3240 | localdcd.ds.detailsea = dsDirCnrDefault.detailsea; // Set default
|
---|
| 3241 | size = sizeof(BOOL);
|
---|
| 3242 | sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, x);
|
---|
| 3243 | if (PrfQueryProfileData(fmprof,
|
---|
| 3244 | FM3Str,
|
---|
| 3245 | szKey,
|
---|
| 3246 | (PVOID) & localdcd.ds.detailsea,
|
---|
| 3247 | &size) &&
|
---|
| 3248 | size == sizeof(BOOL))
|
---|
| 3249 | {
|
---|
| 3250 | if (fDeleteState)
|
---|
| 3251 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3252 | }
|
---|
| 3253 | localdcd.ds.detailssize = dsDirCnrDefault.detailssize; // Set default
|
---|
| 3254 | size = sizeof(BOOL);
|
---|
| 3255 | sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, x);
|
---|
| 3256 | if (PrfQueryProfileData(fmprof,
|
---|
| 3257 | FM3Str,
|
---|
| 3258 | szKey,
|
---|
| 3259 | (PVOID) & localdcd.ds.detailssize,
|
---|
| 3260 | &size) &&
|
---|
| 3261 | size == sizeof(BOOL))
|
---|
| 3262 | {
|
---|
| 3263 | if (fDeleteState)
|
---|
| 3264 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3265 | }
|
---|
| 3266 | localdcd.ds.detailsicon = dsDirCnrDefault.detailsicon; // Set default
|
---|
| 3267 | size = sizeof(BOOL);
|
---|
| 3268 | sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, x);
|
---|
| 3269 | if (PrfQueryProfileData(fmprof,
|
---|
| 3270 | FM3Str,
|
---|
| 3271 | szKey,
|
---|
| 3272 | (PVOID) & localdcd.ds.detailsicon,
|
---|
| 3273 | &size) &&
|
---|
| 3274 | size == sizeof(BOOL))
|
---|
| 3275 | {
|
---|
| 3276 | if (fDeleteState)
|
---|
| 3277 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3278 | }
|
---|
| 3279 | localdcd.ds.detailsattr = dsDirCnrDefault.detailsattr; // Set default
|
---|
| 3280 | size = sizeof(BOOL);
|
---|
| 3281 | sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, x);
|
---|
| 3282 | if (PrfQueryProfileData(fmprof,
|
---|
| 3283 | FM3Str,
|
---|
| 3284 | szKey,
|
---|
| 3285 | (PVOID)&localdcd.ds.detailsattr,
|
---|
| 3286 | &size) &&
|
---|
| 3287 | size == sizeof(BOOL))
|
---|
| 3288 | {
|
---|
| 3289 | if (fDeleteState)
|
---|
| 3290 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3291 | }
|
---|
| 3292 | localdcd.ds.detailscrdate = dsDirCnrDefault.detailscrdate; // Set default
|
---|
| 3293 | size = sizeof(BOOL);
|
---|
| 3294 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, x);
|
---|
| 3295 | if (PrfQueryProfileData(fmprof,
|
---|
| 3296 | FM3Str,
|
---|
| 3297 | szKey,
|
---|
| 3298 | (PVOID) & localdcd.ds.detailscrdate,
|
---|
| 3299 | &size) && size == sizeof(BOOL))
|
---|
| 3300 | {
|
---|
| 3301 | if (fDeleteState)
|
---|
| 3302 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3303 | }
|
---|
| 3304 | localdcd.ds.detailscrtime = dsDirCnrDefault.detailscrtime; // Set default
|
---|
| 3305 | size = sizeof(BOOL);
|
---|
| 3306 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, x);
|
---|
| 3307 | if (PrfQueryProfileData(fmprof,
|
---|
| 3308 | FM3Str,
|
---|
| 3309 | szKey,
|
---|
| 3310 | (PVOID)&localdcd.ds.detailscrtime,
|
---|
| 3311 | &size) &&
|
---|
| 3312 | size == sizeof(BOOL))
|
---|
| 3313 | {
|
---|
| 3314 | if (fDeleteState)
|
---|
| 3315 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3316 | }
|
---|
| 3317 | localdcd.ds.detailslwdate = dsDirCnrDefault.detailslwdate; // Set default
|
---|
| 3318 | size = sizeof(BOOL);
|
---|
| 3319 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, x);
|
---|
| 3320 | if (PrfQueryProfileData(fmprof,
|
---|
| 3321 | FM3Str,
|
---|
| 3322 | szKey,
|
---|
| 3323 | (PVOID) & localdcd.ds.detailslwdate,
|
---|
| 3324 | &size) &&
|
---|
| 3325 | size == sizeof(BOOL))
|
---|
| 3326 | {
|
---|
| 3327 | if (fDeleteState)
|
---|
| 3328 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3329 | }
|
---|
| 3330 | localdcd.ds.detailslwtime = dsDirCnrDefault.detailslwtime; // Set default
|
---|
| 3331 | size = sizeof(BOOL);
|
---|
| 3332 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, x);
|
---|
| 3333 | if (PrfQueryProfileData(fmprof,
|
---|
| 3334 | FM3Str,
|
---|
| 3335 | szKey,
|
---|
| 3336 | (PVOID) & localdcd.ds.detailslwtime,
|
---|
| 3337 | &size) &&
|
---|
| 3338 | size == sizeof(BOOL))
|
---|
| 3339 | {
|
---|
| 3340 | if (fDeleteState)
|
---|
| 3341 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3342 | }
|
---|
| 3343 | localdcd.ds.detailsladate = dsDirCnrDefault.detailsladate; // Set default
|
---|
| 3344 | size = sizeof(BOOL);
|
---|
| 3345 | sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, x);
|
---|
| 3346 | if (PrfQueryProfileData(fmprof,
|
---|
| 3347 | FM3Str,
|
---|
| 3348 | szKey,
|
---|
| 3349 | (PVOID) & localdcd.ds.detailsladate,
|
---|
| 3350 | &size) &&
|
---|
| 3351 | size == sizeof(BOOL))
|
---|
| 3352 | {
|
---|
| 3353 | if (fDeleteState)
|
---|
| 3354 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3355 | }
|
---|
| 3356 | localdcd.ds.detailslatime = dsDirCnrDefault.detailslatime; // Set default
|
---|
| 3357 | size = sizeof(BOOL);
|
---|
| 3358 | sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, x);
|
---|
| 3359 | if (PrfQueryProfileData(fmprof,
|
---|
| 3360 | FM3Str,
|
---|
| 3361 | szKey,
|
---|
| 3362 | (PVOID) & localdcd.ds.detailslatime,
|
---|
| 3363 | &size) &&
|
---|
| 3364 | size == sizeof(BOOL))
|
---|
| 3365 | {
|
---|
| 3366 | if (fDeleteState)
|
---|
| 3367 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3368 | }
|
---|
| 3369 | hwndDir = (HWND) WinSendMsg(hwndClient,
|
---|
| 3370 | UM_SETDIR,
|
---|
| 3371 | MPFROMP(szDir), MPFROMLONG(1));
|
---|
| 3372 | if (hwndDir) {
|
---|
| 3373 | hwndC = WinWindowFromID(hwndDir, FID_CLIENT);
|
---|
| 3374 | if (hwndC) {
|
---|
| 3375 | HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR);
|
---|
| 3376 | if (!hwndPPSave) {
|
---|
| 3377 | hwndPPSave = WinCreateWindow(hwndCnr, // Create a window (used to save default presparams)
|
---|
| 3378 | WC_CONTAINER,
|
---|
| 3379 | NULL,
|
---|
| 3380 | CCS_AUTOPOSITION | CCS_MINIICONS |
|
---|
| 3381 | CCS_MINIRECORDCORE | ulCnrType |
|
---|
| 3382 | WS_VISIBLE,
|
---|
| 3383 | 0,
|
---|
| 3384 | 0,
|
---|
| 3385 | 0,
|
---|
| 3386 | 0,
|
---|
| 3387 | hwndCnr,
|
---|
| 3388 | HWND_TOP, (ULONG) -1, NULL, NULL);
|
---|
| 3389 | CopyPresParams(hwndPPSave, hwndC);
|
---|
| 3390 | RestorePresParams(hwndPPSave, "DirCnr");
|
---|
| 3391 | }
|
---|
| 3392 | sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);
|
---|
| 3393 | RestorePresParams(hwndCnr, szKey);
|
---|
| 3394 | dcd = WinQueryWindowPtr(hwndCnr, QWL_USER);
|
---|
| 3395 | if (dcd) {
|
---|
| 3396 | dcd->ds.detailslongname = localdcd.ds.detailslongname;
|
---|
| 3397 | dcd->ds.detailssubject = localdcd.ds.detailssubject ;
|
---|
| 3398 | dcd->ds.detailsattr = localdcd.ds.detailsattr ;
|
---|
| 3399 | dcd->ds.detailsea = localdcd.ds.detailsea ;
|
---|
| 3400 | dcd->ds.detailssize = localdcd.ds.detailssize ;
|
---|
| 3401 | dcd->ds.detailsicon = localdcd.ds.detailsicon ;
|
---|
| 3402 | dcd->ds.detailscrdate = localdcd.ds.detailscrdate ;
|
---|
| 3403 | dcd->ds.detailscrtime = localdcd.ds.detailscrtime ;
|
---|
| 3404 | dcd->ds.detailsladate = localdcd.ds.detailsladate ;
|
---|
| 3405 | dcd->ds.detailslatime = localdcd.ds.detailslatime ;
|
---|
| 3406 | dcd->ds.detailslwdate = localdcd.ds.detailslwdate ;
|
---|
| 3407 | dcd->ds.detailslwtime = localdcd.ds.detailslwtime ;
|
---|
| 3408 | size = sizeof(INT);
|
---|
| 3409 | sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x);
|
---|
| 3410 | if (PrfQueryProfileData(fmprof,
|
---|
| 3411 | FM3Str,
|
---|
| 3412 | szKey,
|
---|
| 3413 | (PVOID) & dcd->sortFlags,
|
---|
| 3414 | &size) && size == sizeof(INT)) {
|
---|
| 3415 | if (!dcd->sortFlags)
|
---|
| 3416 | dcd->sortFlags = SORT_PATHNAME;
|
---|
| 3417 | }
|
---|
| 3418 | if (fDeleteState)
|
---|
| 3419 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3420 | size = sizeof(MASK);
|
---|
| 3421 | sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x);
|
---|
| 3422 | if (PrfQueryProfileData(fmprof,
|
---|
| 3423 | FM3Str,
|
---|
| 3424 | szKey,
|
---|
| 3425 | (PVOID) & dcd->mask, &size) && size) {
|
---|
| 3426 | if (*dcd->mask.szMask)
|
---|
| 3427 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
| 3428 | UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
|
---|
| 3429 | }
|
---|
| 3430 | *(dcd->mask.prompt) = 0;
|
---|
| 3431 | if (fDeleteState)
|
---|
| 3432 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3433 | size = sizeof(ULONG);
|
---|
| 3434 | sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x);
|
---|
| 3435 | if (!noview) {
|
---|
| 3436 | if (PrfQueryProfileData(fmprof,
|
---|
| 3437 | FM3Str,
|
---|
| 3438 | szKey,
|
---|
| 3439 | (PVOID) & dcd->flWindowAttr,
|
---|
| 3440 | &size) && size == sizeof(ULONG)) {
|
---|
[2] | 3441 |
|
---|
[1077] | 3442 | CNRINFO cnri;
|
---|
[2] | 3443 |
|
---|
[1077] | 3444 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 3445 | cnri.cb = sizeof(CNRINFO);
|
---|
| 3446 | if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
| 3447 | CM_QUERYCNRINFO,
|
---|
| 3448 | MPFROMP(&cnri),
|
---|
| 3449 | MPFROMLONG(sizeof(CNRINFO)))) {
|
---|
| 3450 | cnri.flWindowAttr = dcd->flWindowAttr;
|
---|
| 3451 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
| 3452 | CM_SETCNRINFO,
|
---|
| 3453 | MPFROMP(&cnri),
|
---|
| 3454 | MPFROMLONG(CMA_FLWINDOWATTR));
|
---|
| 3455 | }
|
---|
| 3456 | }
|
---|
| 3457 | }
|
---|
| 3458 | if (fDeleteState)
|
---|
| 3459 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3460 | if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL))
|
---|
| 3461 | WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL);
|
---|
| 3462 | }
|
---|
| 3463 | }
|
---|
| 3464 | fRestored = TRUE;
|
---|
| 3465 | swp.hwnd = hwndDir;
|
---|
| 3466 | TransformSwp(&swp, xtrans, ytrans);
|
---|
| 3467 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
---|
| 3468 | WinSetWindowPos(hwndDir,
|
---|
| 3469 | HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);
|
---|
| 3470 | WinSetWindowUShort(hwndDir, QWS_XRESTORE, (USHORT) swp.x);
|
---|
| 3471 | WinSetWindowUShort(hwndDir, QWS_CXRESTORE, (USHORT) swp.cx);
|
---|
| 3472 | WinSetWindowUShort(hwndDir, QWS_YRESTORE, (USHORT) swp.y);
|
---|
| 3473 | WinSetWindowUShort(hwndDir, QWS_CYRESTORE, (USHORT) swp.cy);
|
---|
| 3474 | } else
|
---|
| 3475 | WinSetWindowPos(hwndDir,
|
---|
| 3476 | HWND_TOP,
|
---|
| 3477 | swp.x,
|
---|
| 3478 | swp.y,
|
---|
| 3479 | swp.cx,
|
---|
| 3480 | swp.cy,
|
---|
| 3481 | swp.fl | SWP_MOVE |
|
---|
| 3482 | SWP_SIZE | SWP_SHOW | SWP_ZORDER |
|
---|
| 3483 | SWP_ACTIVATE);
|
---|
| 3484 | }
|
---|
| 3485 | }
|
---|
[133] | 3486 | }
|
---|
[557] | 3487 | } // for
|
---|
[981] | 3488 | if (hwndPPSave) {
|
---|
| 3489 | SavePresParams(hwndPPSave, "DirCnr");
|
---|
| 3490 | WinDestroyWindow(hwndPPSave);
|
---|
| 3491 | }
|
---|
[133] | 3492 | }
|
---|
[558] | 3493 | return fRestored;
|
---|
[2] | 3494 | }
|
---|
| 3495 |
|
---|
[178] | 3496 | static ULONG CountChildren(HWND hwndClient, ULONG * ulNumMinChildren)
|
---|
[133] | 3497 | {
|
---|
| 3498 | HENUM henum;
|
---|
| 3499 | HWND hwndChild;
|
---|
| 3500 | SWP swp;
|
---|
| 3501 | register ULONG ulCnt = 0L;
|
---|
| 3502 | USHORT id;
|
---|
[2] | 3503 |
|
---|
[133] | 3504 | if (ulNumMinChildren)
|
---|
| 3505 | *ulNumMinChildren = 0L;
|
---|
| 3506 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 3507 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 3508 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
---|
| 3509 | if (!id || (!fFreeTree && id == TREE_FRAME))
|
---|
| 3510 | continue;
|
---|
| 3511 | ulCnt++;
|
---|
[551] | 3512 | if (ulNumMinChildren) {
|
---|
| 3513 | if (WinQueryWindowPos(hwndChild, &swp) && (swp.fl & SWP_MINIMIZE))
|
---|
[1077] | 3514 | (*ulNumMinChildren)++;
|
---|
[133] | 3515 | }
|
---|
| 3516 | }
|
---|
| 3517 | WinEndEnumWindows(henum);
|
---|
| 3518 | return ulCnt;
|
---|
[2] | 3519 | }
|
---|
| 3520 |
|
---|
[133] | 3521 | VOID GetNextWindowPos(HWND hwndClient, PSWP pswp, ULONG * ulCntR,
|
---|
[1077] | 3522 | ULONG * ulNumMinChildrenR)
|
---|
[133] | 3523 | {
|
---|
| 3524 | register ULONG ulCnt;
|
---|
| 3525 | ULONG ulNumMinChildren;
|
---|
| 3526 | RECTL Rectl;
|
---|
| 3527 | register ULONG ulXDiff, ulYDiff, ulWindowsPerStack;
|
---|
[2] | 3528 |
|
---|
[133] | 3529 | if (!ulCntR || !ulNumMinChildrenR)
|
---|
| 3530 | ulCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
---|
[551] | 3531 | else {
|
---|
[133] | 3532 | ulCnt = *ulCntR;
|
---|
| 3533 | ulNumMinChildren = *ulNumMinChildrenR;
|
---|
[787] | 3534 | if (ulCnt == (ULONG) - 1) {
|
---|
[133] | 3535 | ulCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
---|
| 3536 | /* return these values to the caller for later use */
|
---|
| 3537 | *ulCntR = ulCnt;
|
---|
| 3538 | *ulNumMinChildrenR = ulNumMinChildren;
|
---|
| 3539 | }
|
---|
| 3540 | }
|
---|
| 3541 | WinQueryWindowRect(hwndClient, &Rectl);
|
---|
| 3542 | AdjustSizeOfClient(NULL, &Rectl);
|
---|
[551] | 3543 | if (!fFreeTree) {
|
---|
[2] | 3544 |
|
---|
[133] | 3545 | SWP swp;
|
---|
[2] | 3546 |
|
---|
[133] | 3547 | WinQueryWindowPos(hwndTree, &swp);
|
---|
| 3548 | if (ulNumMinChildren || (swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
| 3549 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
| 3550 | }
|
---|
| 3551 | else if (ulNumMinChildren)
|
---|
| 3552 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
[2] | 3553 |
|
---|
[133] | 3554 | ulXDiff = WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER) +
|
---|
| 3555 | WinQuerySysValue(HWND_DESKTOP, SV_CXMINMAXBUTTON) / 2;
|
---|
| 3556 | ulYDiff = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER) +
|
---|
| 3557 | WinQuerySysValue(HWND_DESKTOP, SV_CYMINMAXBUTTON);
|
---|
| 3558 | ulWindowsPerStack = (Rectl.yTop - Rectl.yBottom) / (3 * ulYDiff);
|
---|
[551] | 3559 | pswp->cx = Rectl.xRight - (ulWindowsPerStack * ulXDiff);
|
---|
| 3560 | pswp->cy = (Rectl.yTop - Rectl.yBottom) - (ulWindowsPerStack * ulYDiff);
|
---|
[133] | 3561 | ulWindowsPerStack++;
|
---|
[551] | 3562 | pswp->x = Rectl.xLeft + ((ulCnt % ulWindowsPerStack) * ulXDiff);
|
---|
| 3563 | pswp->y = (Rectl.yTop - pswp->cy - ((ulCnt % ulWindowsPerStack) * ulYDiff));
|
---|
[2] | 3564 | }
|
---|
| 3565 |
|
---|
[178] | 3566 | static VOID CascadeChildren(HWND hwndClient)
|
---|
[133] | 3567 | {
|
---|
| 3568 | ULONG ulCnt = 0L, ulNumMinChildren;
|
---|
| 3569 | HWND hwndChild;
|
---|
| 3570 | HENUM henum;
|
---|
| 3571 | SWP swp;
|
---|
| 3572 | USHORT id;
|
---|
| 3573 | RECTL Rectl;
|
---|
[2] | 3574 |
|
---|
[133] | 3575 | WinQueryWindowPos(hwndClient, &swp);
|
---|
| 3576 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
| 3577 | return;
|
---|
[2] | 3578 |
|
---|
[133] | 3579 | CountChildren(hwndClient, &ulNumMinChildren);
|
---|
[551] | 3580 | if (!fFreeTree) {
|
---|
[133] | 3581 | WinQueryWindowRect(hwndClient, &Rectl);
|
---|
| 3582 | AdjustSizeOfClient(NULL, &Rectl);
|
---|
| 3583 | WinQueryWindowPos(hwndTree, &swp);
|
---|
[551] | 3584 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
[133] | 3585 | if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
|
---|
[1077] | 3586 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
---|
[133] | 3587 | if (swp.x != 0)
|
---|
[1077] | 3588 | swp.x = 0;
|
---|
[133] | 3589 | if (swp.y < 0)
|
---|
[1077] | 3590 | swp.y = 0;
|
---|
[133] | 3591 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
---|
[1077] | 3592 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
---|
[133] | 3593 | WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
[1077] | 3594 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
[133] | 3595 | }
|
---|
| 3596 | }
|
---|
| 3597 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 3598 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 3599 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
---|
| 3600 | if (!id || (!fFreeTree && id == TREE_FRAME))
|
---|
| 3601 | continue;
|
---|
| 3602 | WinQueryWindowPos(hwndChild, &swp);
|
---|
[551] | 3603 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE))) {
|
---|
[133] | 3604 | GetNextWindowPos(hwndClient, &swp, &ulCnt, &ulNumMinChildren);
|
---|
| 3605 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
[1077] | 3606 | SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE |
|
---|
| 3607 | SWP_ZORDER | SWP_ACTIVATE);
|
---|
[133] | 3608 | ulCnt++;
|
---|
| 3609 | }
|
---|
| 3610 | }
|
---|
| 3611 | WinEndEnumWindows(henum);
|
---|
[2] | 3612 | }
|
---|
| 3613 |
|
---|
[133] | 3614 | VOID TileChildren(HWND hwndClient, BOOL absolute)
|
---|
| 3615 | {
|
---|
| 3616 | register ULONG ulChildCnt, ulSquare, ulNumRows, ulNumCols, ulExtraCols,
|
---|
[551] | 3617 | ulWidth, ulHeight;
|
---|
[133] | 3618 | ULONG ulNumMinChildren;
|
---|
| 3619 | RECTL Rectl;
|
---|
| 3620 | HWND hwndChild;
|
---|
[2] | 3621 |
|
---|
[133] | 3622 | if (fNoTileUpdate || hwndClient == HWND_DESKTOP)
|
---|
| 3623 | return;
|
---|
| 3624 | {
|
---|
| 3625 | SWP swp;
|
---|
[2] | 3626 |
|
---|
[133] | 3627 | WinQueryWindowPos(hwndClient, &swp);
|
---|
| 3628 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
| 3629 | return;
|
---|
| 3630 | }
|
---|
[551] | 3631 | ulChildCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
---|
[133] | 3632 | ulChildCnt -= ulNumMinChildren;
|
---|
| 3633 | if (!ulChildCnt)
|
---|
| 3634 | return;
|
---|
[2] | 3635 |
|
---|
[133] | 3636 | fNoTileUpdate = TRUE;
|
---|
[2] | 3637 |
|
---|
[551] | 3638 | for (ulSquare = 2; ulSquare * ulSquare <= ulChildCnt; ulSquare++) {
|
---|
[133] | 3639 | ;
|
---|
[200] | 3640 | }
|
---|
[551] | 3641 | if (!fTileBackwards) {
|
---|
[787] | 3642 | ulNumCols = ulSquare - 1;
|
---|
[133] | 3643 | ulNumRows = ulChildCnt / ulNumCols;
|
---|
| 3644 | }
|
---|
[551] | 3645 | else {
|
---|
[787] | 3646 | ulNumRows = ulSquare - 1;
|
---|
[133] | 3647 | ulNumCols = ulChildCnt / ulNumRows;
|
---|
| 3648 | }
|
---|
| 3649 | ulExtraCols = ulChildCnt % ulNumCols;
|
---|
[2] | 3650 |
|
---|
[551] | 3651 | WinQueryWindowRect(hwndClient, &Rectl);
|
---|
[2] | 3652 |
|
---|
[551] | 3653 | if (!fFreeTree) {
|
---|
[2] | 3654 |
|
---|
[133] | 3655 | SWP swp;
|
---|
[2] | 3656 |
|
---|
[133] | 3657 | WinQueryWindowPos(hwndTree, &swp);
|
---|
[551] | 3658 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
[133] | 3659 | if (swp.y < 0)
|
---|
[1077] | 3660 | swp.y = 0;
|
---|
[133] | 3661 | if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
|
---|
[1077] | 3662 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
---|
[133] | 3663 | if (swp.x != 0)
|
---|
[1077] | 3664 | swp.x = 0;
|
---|
[133] | 3665 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
---|
[1077] | 3666 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
---|
[2] | 3667 | WinSetWindowPos(hwndTree,
|
---|
[1077] | 3668 | HWND_TOP,
|
---|
| 3669 | swp.x,
|
---|
| 3670 | swp.y,
|
---|
| 3671 | swp.cx,
|
---|
| 3672 | swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
[133] | 3673 | WinQueryWindowPos(hwndTree, &swp);
|
---|
| 3674 | }
|
---|
[551] | 3675 | if (ulNumMinChildren || (swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
[133] | 3676 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
| 3677 | }
|
---|
| 3678 | else if (ulNumMinChildren)
|
---|
| 3679 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
[2] | 3680 |
|
---|
[551] | 3681 | AdjustSizeOfClient(NULL, &Rectl);
|
---|
[2] | 3682 |
|
---|
[551] | 3683 | if (Rectl.xRight > 0L && (Rectl.yBottom < Rectl.yTop)) {
|
---|
[2] | 3684 |
|
---|
[133] | 3685 | HENUM henum;
|
---|
[2] | 3686 |
|
---|
[133] | 3687 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 3688 | if ((hwndChild = WinGetNextWindow(henum)) != (HWND) 0) {
|
---|
[2] | 3689 |
|
---|
[133] | 3690 | ULONG ulCurRow, ulCurCol;
|
---|
| 3691 | SWP swp;
|
---|
| 3692 | USHORT id;
|
---|
[2] | 3693 |
|
---|
[133] | 3694 | ulHeight = (Rectl.yTop - Rectl.yBottom) / ulNumRows;
|
---|
[2] | 3695 |
|
---|
[551] | 3696 | for (ulCurRow = 0; ulCurRow < ulNumRows; ulCurRow++) {
|
---|
[1077] | 3697 | if ((ulNumRows - ulCurRow) <= ulExtraCols)
|
---|
| 3698 | ulNumCols++;
|
---|
| 3699 | for (ulCurCol = 0; ulCurCol < ulNumCols; ulCurCol++) {
|
---|
| 3700 | ulWidth = Rectl.xRight / ulNumCols;
|
---|
[2] | 3701 |
|
---|
[1077] | 3702 | while (hwndChild) {
|
---|
| 3703 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
---|
| 3704 | if (id && (id != TREE_FRAME || fFreeTree)) {
|
---|
| 3705 | WinQueryWindowPos(hwndChild, &swp);
|
---|
| 3706 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
| 3707 | break;
|
---|
| 3708 | }
|
---|
| 3709 | hwndChild = WinGetNextWindow(henum);
|
---|
| 3710 | }
|
---|
[2] | 3711 |
|
---|
[1077] | 3712 | if (hwndChild) {
|
---|
| 3713 | if (!absolute && (swp.fl & SWP_MAXIMIZE)) {
|
---|
| 3714 | WinGetMaxPosition(hwndChild, &swp);
|
---|
| 3715 | WinSetWindowPos(hwndChild,
|
---|
| 3716 | HWND_TOP,
|
---|
| 3717 | swp.x,
|
---|
| 3718 | swp.y,
|
---|
| 3719 | swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
---|
| 3720 | WinSetWindowUShort(hwndChild,
|
---|
| 3721 | QWS_XRESTORE,
|
---|
| 3722 | (USHORT) (ulWidth * ulCurCol) + Rectl.xLeft);
|
---|
| 3723 | WinSetWindowUShort(hwndChild,
|
---|
| 3724 | QWS_YRESTORE,
|
---|
| 3725 | (USHORT) (Rectl.yTop -
|
---|
| 3726 | (ulHeight * (ulCurRow + 1))));
|
---|
| 3727 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth);
|
---|
| 3728 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight);
|
---|
| 3729 | }
|
---|
| 3730 | else
|
---|
| 3731 | WinSetWindowPos(hwndChild,
|
---|
| 3732 | HWND_TOP,
|
---|
| 3733 | (ulWidth * ulCurCol) + Rectl.xLeft,
|
---|
| 3734 | Rectl.yTop - (ulHeight * (ulCurRow + 1)),
|
---|
| 3735 | ulWidth,
|
---|
| 3736 | ulHeight,
|
---|
| 3737 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
| 3738 | hwndChild = WinGetNextWindow(henum);
|
---|
| 3739 | }
|
---|
| 3740 | }
|
---|
| 3741 | if ((ulNumRows - ulCurRow) <= ulExtraCols) {
|
---|
| 3742 | ulNumCols--;
|
---|
| 3743 | ulExtraCols--;
|
---|
| 3744 | }
|
---|
[133] | 3745 | }
|
---|
| 3746 | }
|
---|
| 3747 | WinEndEnumWindows(henum);
|
---|
| 3748 | }
|
---|
[2] | 3749 |
|
---|
[133] | 3750 | fNoTileUpdate = FALSE;
|
---|
[2] | 3751 | }
|
---|
| 3752 |
|
---|
[551] | 3753 | static VOID ResizeChildren(HWND hwndClient, SHORT oldcx, SHORT oldcy,
|
---|
[1077] | 3754 | SHORT newcx, SHORT newcy)
|
---|
[133] | 3755 | {
|
---|
| 3756 | /*
|
---|
| 3757 | * resize all children of the client to maintain their proportional
|
---|
| 3758 | * sizes and positions
|
---|
| 3759 | */
|
---|
[2] | 3760 |
|
---|
[551] | 3761 | if (!newcx || !newcy || !oldcx || !oldcy)
|
---|
[133] | 3762 | return;
|
---|
| 3763 | {
|
---|
| 3764 | HENUM henum;
|
---|
| 3765 | HWND hwndChild;
|
---|
| 3766 | register LONG x, y, cx, cy, ucx, ucy, ux, uy;
|
---|
| 3767 | SWP swp;
|
---|
[2] | 3768 |
|
---|
[133] | 3769 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 3770 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 3771 | if (!WinQueryWindowUShort(hwndChild, QWS_ID))
|
---|
[1077] | 3772 | continue;
|
---|
[551] | 3773 | if (WinQueryWindowPos(hwndChild, &swp)) {
|
---|
[1077] | 3774 | if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {
|
---|
| 3775 | swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);
|
---|
| 3776 | swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);
|
---|
| 3777 | swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);
|
---|
| 3778 | swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);
|
---|
| 3779 | }
|
---|
| 3780 | else if (swp.fl & SWP_MAXIMIZE) {
|
---|
| 3781 | swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);
|
---|
| 3782 | swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);
|
---|
| 3783 | swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);
|
---|
| 3784 | swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);
|
---|
| 3785 | }
|
---|
| 3786 | cx = (swp.cx) ? (LONG) (((double)oldcx * 100.0) / (double)swp.cx) : 0;
|
---|
| 3787 | cy = (swp.cy) ? (LONG) (((double)oldcy * 100.0) / (double)swp.cy) : 0;
|
---|
| 3788 | x = (swp.x) ? (LONG) (((double)oldcx * 100.0) / (double)swp.x) : 0;
|
---|
| 3789 | y = (swp.y) ? (LONG) (((double)oldcy * 100.0) / (double)swp.y) : 0;
|
---|
| 3790 | if (x < 0)
|
---|
| 3791 | x = 0;
|
---|
| 3792 | if (y < 0)
|
---|
| 3793 | y = 0;
|
---|
| 3794 | ux = (x) ? (LONG) (((double)newcx * 100.0) / (double)x) : 0;
|
---|
| 3795 | uy = (y) ? (LONG) (((double)newcy * 100.0) / (double)y) : 0;
|
---|
| 3796 | ucx = (cx) ? (LONG) (((double)newcx * 100.0) / (double)cx) : 0;
|
---|
| 3797 | ucy = (cy) ? (LONG) (((double)newcy * 100.0) / (double)cy) : 0;
|
---|
| 3798 | if (ux + ucx > newcx)
|
---|
| 3799 | ucx = newcx - ux;
|
---|
| 3800 | if (uy + ucy > newcy)
|
---|
| 3801 | ucy = newcy - uy;
|
---|
[2] | 3802 |
|
---|
[1077] | 3803 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)))
|
---|
| 3804 | WinSetWindowPos(hwndChild, HWND_TOP, ux, uy, ucx, ucy,
|
---|
| 3805 | SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
---|
| 3806 | else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
---|
| 3807 | WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1);
|
---|
| 3808 | WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);
|
---|
| 3809 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,
|
---|
| 3810 | SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE);
|
---|
| 3811 | WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);
|
---|
| 3812 | WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);
|
---|
| 3813 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);
|
---|
| 3814 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);
|
---|
| 3815 | }
|
---|
| 3816 | else {
|
---|
| 3817 | WinGetMaxPosition(hwndChild, &swp);
|
---|
| 3818 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
| 3819 | SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
---|
| 3820 | WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);
|
---|
| 3821 | WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);
|
---|
| 3822 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);
|
---|
| 3823 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);
|
---|
| 3824 | }
|
---|
[133] | 3825 | }
|
---|
| 3826 | }
|
---|
| 3827 | WinEndEnumWindows(henum);
|
---|
| 3828 | }
|
---|
[551] | 3829 | if (!fFreeTree) {
|
---|
[2] | 3830 |
|
---|
[133] | 3831 | RECTL Rectl;
|
---|
| 3832 | SWP swp;
|
---|
[2] | 3833 |
|
---|
[133] | 3834 | WinQueryWindowRect(hwndClient, &Rectl);
|
---|
| 3835 | AdjustSizeOfClient(NULL, &Rectl);
|
---|
| 3836 | WinQueryWindowPos(hwndTree, &swp);
|
---|
[551] | 3837 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
[954] | 3838 |
|
---|
| 3839 | if (!fNoTreeGap) {
|
---|
[1077] | 3840 | INT height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
| 3841 | if (swp.y < height)
|
---|
| 3842 | swp.y = height; // Force bottom to position
|
---|
[954] | 3843 | }
|
---|
| 3844 | else
|
---|
[1077] | 3845 | swp.y = 0; // Force bottom to position
|
---|
[954] | 3846 |
|
---|
| 3847 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
---|
| 3848 | if (swp.cy < 0)
|
---|
[1077] | 3849 | swp.cy = 0;
|
---|
[954] | 3850 |
|
---|
[133] | 3851 | if (swp.x != 0)
|
---|
[1077] | 3852 | swp.x = 0; // Left align
|
---|
[954] | 3853 |
|
---|
| 3854 | // AdjustSizeOfClient can return bogus xRight values - fixme someday
|
---|
| 3855 | if (Rectl.xRight >= Rectl.xLeft) {
|
---|
[1077] | 3856 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
---|
| 3857 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
---|
[954] | 3858 | }
|
---|
[133] | 3859 | WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
[1077] | 3860 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
[133] | 3861 | }
|
---|
| 3862 | }
|
---|
[2] | 3863 | }
|
---|
| 3864 |
|
---|
[178] | 3865 | static VOID MinResChildren(HWND hwndClient, ULONG cmd)
|
---|
[133] | 3866 | {
|
---|
| 3867 | HENUM henum;
|
---|
| 3868 | HWND hwndChild;
|
---|
[2] | 3869 |
|
---|
[133] | 3870 | {
|
---|
| 3871 | SWP swp;
|
---|
[2] | 3872 |
|
---|
[133] | 3873 | WinQueryWindowPos(hwndClient, &swp);
|
---|
| 3874 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
| 3875 | return;
|
---|
| 3876 | }
|
---|
| 3877 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 3878 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 3879 | if (!WinQueryWindowUShort(hwndChild, QWS_ID))
|
---|
| 3880 | continue;
|
---|
| 3881 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, cmd);
|
---|
| 3882 | }
|
---|
[2] | 3883 | }
|
---|
| 3884 |
|
---|
[178] | 3885 | //=== ChildFrameButtonProc: subclass handler for WALKBUTTON and QUICKBUTTON windows ===
|
---|
| 3886 |
|
---|
| 3887 | static MRESULT EXPENTRY ChildFrameButtonProc(HWND hwnd,
|
---|
[1077] | 3888 | ULONG msg,
|
---|
| 3889 | MPARAM mp1, MPARAM mp2)
|
---|
[133] | 3890 | {
|
---|
| 3891 | USHORT id;
|
---|
| 3892 | static BOOL emphasized = FALSE;
|
---|
[2] | 3893 |
|
---|
[551] | 3894 | switch (msg) {
|
---|
[133] | 3895 | case WM_BUTTON1CLICK:
|
---|
| 3896 | case WM_CHORD:
|
---|
| 3897 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 3898 | break;
|
---|
[2] | 3899 |
|
---|
[133] | 3900 | case WM_MOUSEMOVE:
|
---|
[551] | 3901 | if (fOtherHelp) {
|
---|
| 3902 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
---|
[1077] | 3903 | && !WinQueryCapture(HWND_DESKTOP)) {
|
---|
| 3904 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 3905 | switch (id) {
|
---|
| 3906 | case IDM_OPENWALK:
|
---|
| 3907 | MakeBubble(hwnd, FALSE, GetPString(IDS_WALKBUTTONHELP));
|
---|
| 3908 | break;
|
---|
| 3909 | case IDM_USERLIST:
|
---|
| 3910 | MakeBubble(hwnd, FALSE, GetPString(IDS_QUICKBUTTONHELP));
|
---|
| 3911 | break;
|
---|
| 3912 | }
|
---|
[133] | 3913 | }
|
---|
| 3914 | }
|
---|
| 3915 | break;
|
---|
[2] | 3916 |
|
---|
[133] | 3917 | case WM_BUTTON3CLICK:
|
---|
| 3918 | case WM_BUTTON2CLICK:
|
---|
| 3919 | {
|
---|
| 3920 | USHORT cmd = 0;
|
---|
[2] | 3921 |
|
---|
[133] | 3922 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 3923 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 3924 | switch (id) {
|
---|
[133] | 3925 | case IDM_OPENWALK:
|
---|
[1077] | 3926 | switch (msg) {
|
---|
| 3927 | case WM_BUTTON2CLICK:
|
---|
| 3928 | if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
|
---|
| 3929 | (KC_ALT | KC_SHIFT | KC_CTRL))
|
---|
| 3930 | cmd = IDM_GREP;
|
---|
| 3931 | else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))
|
---|
| 3932 | CascadeChildren(hwndMain);
|
---|
[2] | 3933 |
|
---|
| 3934 | #ifdef NEVER
|
---|
[1077] | 3935 | else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))
|
---|
| 3936 | cmd = IDM_SYSINFO;
|
---|
[2] | 3937 | #endif
|
---|
[133] | 3938 |
|
---|
[1077] | 3939 | else if (shiftstate & KC_SHIFT)
|
---|
| 3940 | cmd = IDM_WINDOWDLG;
|
---|
| 3941 | else if (shiftstate & KC_CTRL)
|
---|
| 3942 | cmd = IDM_SEEALL;
|
---|
| 3943 | else if (shiftstate & KC_ALT)
|
---|
| 3944 | TileChildren(hwndMain, TRUE);
|
---|
| 3945 | else
|
---|
| 3946 | cmd = IDM_WALKDIR;
|
---|
| 3947 | break;
|
---|
| 3948 | case WM_BUTTON3CLICK:
|
---|
| 3949 | TileChildren(hwndMain, TRUE);
|
---|
| 3950 | break;
|
---|
| 3951 | }
|
---|
| 3952 | break;
|
---|
[133] | 3953 | case IDM_USERLIST:
|
---|
[1077] | 3954 | switch (msg) {
|
---|
| 3955 | case WM_BUTTON2CLICK:
|
---|
| 3956 | if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
|
---|
| 3957 | (KC_ALT | KC_SHIFT | KC_CTRL))
|
---|
| 3958 | cmd = IDM_COLORPALETTE;
|
---|
| 3959 | else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))
|
---|
| 3960 | cmd = IDM_HIDEMENU;
|
---|
| 3961 | else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))
|
---|
| 3962 | cmd = IDM_NOTEBOOK;
|
---|
| 3963 | else if (shiftstate & KC_SHIFT)
|
---|
| 3964 | cmd = IDM_TOOLTITLES;
|
---|
| 3965 | else if (shiftstate & KC_CTRL)
|
---|
| 3966 | cmd = IDM_TEXTTOOLS;
|
---|
| 3967 | else if (shiftstate & KC_ALT)
|
---|
| 3968 | cmd = IDM_FONTPALETTE;
|
---|
| 3969 | else
|
---|
| 3970 | cmd = IDM_TOOLBAR;
|
---|
| 3971 | break;
|
---|
| 3972 | case WM_BUTTON3CLICK:
|
---|
| 3973 | cmd = IDM_DRIVEBAR;
|
---|
| 3974 | break;
|
---|
| 3975 | }
|
---|
| 3976 | break;
|
---|
[930] | 3977 | } // switch id
|
---|
[200] | 3978 |
|
---|
[551] | 3979 | if (cmd) {
|
---|
[1077] | 3980 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_CLIENT),
|
---|
| 3981 | WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
|
---|
[200] | 3982 | }
|
---|
[133] | 3983 | }
|
---|
| 3984 | break;
|
---|
[2] | 3985 |
|
---|
[133] | 3986 | case DM_DRAGOVER:
|
---|
| 3987 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 3988 | if (id == IDM_OPENWALK) {
|
---|
| 3989 | if (!emphasized) {
|
---|
[1077] | 3990 | emphasized = TRUE;
|
---|
| 3991 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 3992 | }
|
---|
[618] | 3993 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
---|
[1077] | 3994 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
---|
[133] | 3995 | }
|
---|
| 3996 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
---|
[2] | 3997 |
|
---|
[133] | 3998 | case DM_DRAGLEAVE:
|
---|
[551] | 3999 | if (emphasized) {
|
---|
[133] | 4000 | emphasized = FALSE;
|
---|
| 4001 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
| 4002 | }
|
---|
| 4003 | break;
|
---|
[2] | 4004 |
|
---|
[133] | 4005 | case DM_DROPHELP:
|
---|
| 4006 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_OPENDROPHELP));
|
---|
| 4007 | return 0;
|
---|
[2] | 4008 |
|
---|
[133] | 4009 | case DM_DROP:
|
---|
| 4010 | {
|
---|
| 4011 | char szFrom[CCHMAXPATH + 2];
|
---|
[2] | 4012 |
|
---|
[551] | 4013 | if (emphasized) {
|
---|
[1077] | 4014 | emphasized = FALSE;
|
---|
| 4015 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 4016 | }
|
---|
[618] | 4017 | if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
|
---|
[1077] | 4018 | if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) {
|
---|
| 4019 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom);
|
---|
| 4020 | }
|
---|
[133] | 4021 | }
|
---|
| 4022 | }
|
---|
| 4023 | return 0;
|
---|
[2] | 4024 |
|
---|
[133] | 4025 | case WM_CLOSE:
|
---|
| 4026 | WinDestroyWindow(hwnd);
|
---|
| 4027 | return 0;
|
---|
| 4028 | }
|
---|
| 4029 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
[2] | 4030 | }
|
---|
| 4031 |
|
---|
[551] | 4032 | static MRESULT EXPENTRY MainFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
[1077] | 4033 | MPARAM mp2)
|
---|
[133] | 4034 | {
|
---|
| 4035 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 4036 | static ULONG aheight = 0L;
|
---|
[2] | 4037 |
|
---|
[551] | 4038 | switch (msg) {
|
---|
[133] | 4039 | case WM_ADJUSTWINDOWPOS:
|
---|
| 4040 | {
|
---|
| 4041 | SWP *pswp;
|
---|
[2] | 4042 |
|
---|
[133] | 4043 | pswp = (SWP *) mp1;
|
---|
[551] | 4044 | if (fDataMin && !fAmClosing) {
|
---|
[1077] | 4045 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
---|
[2] | 4046 |
|
---|
[1077] | 4047 | SWP swp;
|
---|
[2] | 4048 |
|
---|
[1077] | 4049 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 4050 | PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID);
|
---|
| 4051 | HideNote();
|
---|
| 4052 | }
|
---|
| 4053 | else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) {
|
---|
| 4054 | if (DataHwnd)
|
---|
| 4055 | PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 4056 | }
|
---|
[133] | 4057 | }
|
---|
[551] | 4058 | if (!fAmClosing) {
|
---|
[1077] | 4059 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
| 4060 | HideNote();
|
---|
[133] | 4061 | }
|
---|
| 4062 | }
|
---|
| 4063 | break;
|
---|
[2] | 4064 |
|
---|
[133] | 4065 | case UM_FOCUSME:
|
---|
| 4066 | CreateDataBar(HWND_DESKTOP, (ULONG) mp1);
|
---|
| 4067 | return 0;
|
---|
[2] | 4068 |
|
---|
[133] | 4069 | case WM_BUTTON1UP:
|
---|
| 4070 | case WM_BUTTON2UP:
|
---|
| 4071 | case WM_BUTTON3UP:
|
---|
| 4072 | case WM_MOUSEMOVE:
|
---|
| 4073 | case WM_CHORD:
|
---|
| 4074 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 4075 | break;
|
---|
[2] | 4076 |
|
---|
[133] | 4077 | case WM_CHAR:
|
---|
| 4078 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 4079 | break;
|
---|
[2] | 4080 |
|
---|
[133] | 4081 | case WM_CONTROL:
|
---|
[551] | 4082 | return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_CONTROL, mp1,
|
---|
[1077] | 4083 | mp2);
|
---|
[2] | 4084 |
|
---|
[133] | 4085 | case WM_COMMAND:
|
---|
| 4086 | return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
|
---|
[2] | 4087 |
|
---|
[133] | 4088 | case WM_CALCFRAMERECT:
|
---|
| 4089 | {
|
---|
| 4090 | MRESULT mr;
|
---|
| 4091 | PRECTL prectl;
|
---|
| 4092 | LONG sheight = 20, bheight = 20;
|
---|
[2] | 4093 |
|
---|
[133] | 4094 | mr = oldproc(hwnd, msg, mp1, mp2);
|
---|
[2] | 4095 |
|
---|
[133] | 4096 | /*
|
---|
| 4097 | * Calculate the position of the client rectangle.
|
---|
[178] | 4098 | * Otherwise, we'll see a lot of redraw when we move the
|
---|
[133] | 4099 | * client during WM_FORMATFRAME.
|
---|
| 4100 | */
|
---|
[2] | 4101 |
|
---|
[551] | 4102 | if (mr && mp2) {
|
---|
[1077] | 4103 | prectl = (PRECTL) mp1;
|
---|
| 4104 | if (prectl->yBottom != prectl->yTop) {
|
---|
| 4105 | {
|
---|
| 4106 | HPS hps;
|
---|
| 4107 | POINTL aptl[TXTBOX_COUNT];
|
---|
[2] | 4108 |
|
---|
[1077] | 4109 | hps = WinGetPS(hwndStatus);
|
---|
| 4110 | if (hps) {
|
---|
| 4111 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
| 4112 | bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 4113 | WinReleasePS(hps);
|
---|
| 4114 | }
|
---|
| 4115 | }
|
---|
| 4116 | prectl->yBottom += (sheight + 4);
|
---|
| 4117 | prectl->yTop -= (sheight + 4);
|
---|
| 4118 | if (fMoreButtons) {
|
---|
[2] | 4119 |
|
---|
[1077] | 4120 | HPS hps;
|
---|
| 4121 | POINTL aptl[TXTBOX_COUNT];
|
---|
[2] | 4122 |
|
---|
[1077] | 4123 | hps = WinGetPS(hwndName);
|
---|
| 4124 | if (hps) {
|
---|
| 4125 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
| 4126 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 4127 | WinReleasePS(hps);
|
---|
| 4128 | }
|
---|
| 4129 | prectl->yBottom += (bheight + 4);
|
---|
| 4130 | prectl->yTop -= (bheight + 4);
|
---|
| 4131 | }
|
---|
| 4132 | if (fToolbar) {
|
---|
| 4133 | if (!fTextTools)
|
---|
| 4134 | prectl->yTop -= ((fToolTitles) ? 50 : 40);
|
---|
| 4135 | else
|
---|
| 4136 | prectl->yTop -= 32;
|
---|
| 4137 | }
|
---|
| 4138 | if (fDrivebar) {
|
---|
| 4139 | ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES),
|
---|
| 4140 | ((prectl->xRight -
|
---|
| 4141 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
| 4142 | SV_CYSIZEBORDER) * 2)) - 4));
|
---|
| 4143 | prectl->yTop -= (16 * (DriveLines * 18));
|
---|
| 4144 | }
|
---|
| 4145 | if (fUserComboBox) {
|
---|
| 4146 | if (!aheight) {
|
---|
[2] | 4147 |
|
---|
[1077] | 4148 | SWP swpTemp;
|
---|
[2] | 4149 |
|
---|
[1077] | 4150 | WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
| 4151 | &swpTemp);
|
---|
| 4152 | aheight = swpTemp.cy;
|
---|
| 4153 | }
|
---|
| 4154 | prectl->yTop -= (aheight + 6L);
|
---|
| 4155 | }
|
---|
| 4156 | if (fAutoView) {
|
---|
| 4157 | AutoviewHeight = min(AutoviewHeight,
|
---|
| 4158 | (prectl->yTop - prectl->yBottom) - 116);
|
---|
| 4159 | AutoviewHeight = max(AutoviewHeight, 36);
|
---|
| 4160 | prectl->yBottom += (AutoviewHeight + 6);
|
---|
| 4161 | }
|
---|
| 4162 | }
|
---|
[133] | 4163 | }
|
---|
| 4164 | return mr;
|
---|
| 4165 | }
|
---|
[2] | 4166 |
|
---|
[133] | 4167 | case WM_FORMATFRAME:
|
---|
| 4168 | {
|
---|
| 4169 | SHORT sCount, soldCount;
|
---|
| 4170 | PSWP pswp, pswpClient, pswpNew;
|
---|
| 4171 | SWP swpClient;
|
---|
| 4172 | LONG theight = 48L, dheight = 20L, width, sheight = 20, bheight = 20;
|
---|
[2] | 4173 |
|
---|
[133] | 4174 | sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
|
---|
| 4175 | soldCount = sCount;
|
---|
[2] | 4176 |
|
---|
[133] | 4177 | /*
|
---|
| 4178 | * Reformat the frame to "squeeze" the client
|
---|
| 4179 | * and make room for status window sibling beneath
|
---|
| 4180 | * and toolbar above (if toolbar's on) and userlists
|
---|
| 4181 | * (if userlists are on).
|
---|
| 4182 | */
|
---|
[2] | 4183 |
|
---|
[133] | 4184 | pswp = (PSWP) mp1;
|
---|
| 4185 | {
|
---|
[1077] | 4186 | SHORT x;
|
---|
[2] | 4187 |
|
---|
[1077] | 4188 | for (x = 0; x < soldCount; x++) {
|
---|
| 4189 | if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {
|
---|
| 4190 | pswpClient = pswp;
|
---|
| 4191 | break;
|
---|
| 4192 | }
|
---|
| 4193 | pswp++;
|
---|
| 4194 | }
|
---|
[133] | 4195 | }
|
---|
[2] | 4196 |
|
---|
[133] | 4197 | {
|
---|
[1077] | 4198 | HPS hps;
|
---|
| 4199 | POINTL aptl[TXTBOX_COUNT];
|
---|
[2] | 4200 |
|
---|
[1077] | 4201 | hps = WinGetPS(hwndStatus);
|
---|
| 4202 | if (hps) {
|
---|
| 4203 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
| 4204 | bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 4205 | WinReleasePS(hps);
|
---|
| 4206 | }
|
---|
| 4207 | if (fMoreButtons) {
|
---|
| 4208 | hps = WinGetPS(hwndName);
|
---|
| 4209 | if (hps) {
|
---|
| 4210 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
| 4211 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 4212 | WinReleasePS(hps);
|
---|
| 4213 | }
|
---|
| 4214 | }
|
---|
[133] | 4215 | }
|
---|
| 4216 | pswpNew = (PSWP) mp1 + soldCount;
|
---|
| 4217 | *pswpNew = *pswpClient;
|
---|
| 4218 | swpClient = *pswpClient;
|
---|
[551] | 4219 | pswpNew->hwnd = hwndStatus;
|
---|
| 4220 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
| 4221 | pswpNew->x = swpClient.x + 3;
|
---|
| 4222 | pswpNew->y = swpClient.y + 2;
|
---|
[133] | 4223 | if (!fSplitStatus)
|
---|
[1077] | 4224 | width = swpClient.cx - (16 + (sheight * 2) + 4);
|
---|
[133] | 4225 | else
|
---|
[1077] | 4226 | width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2;
|
---|
[133] | 4227 | width = max(width, 10);
|
---|
| 4228 | if (fSplitStatus)
|
---|
[1077] | 4229 | pswpNew->cx = width - 6;
|
---|
[133] | 4230 | else
|
---|
[1077] | 4231 | pswpNew->cx = width - 8;
|
---|
[551] | 4232 | pswpNew->cy = sheight;
|
---|
| 4233 | pswpClient->y = pswpNew->y + pswpNew->cy + 3;
|
---|
| 4234 | pswpClient->cy = (swpClient.cy - pswpNew->cy) - 3;
|
---|
[133] | 4235 | sCount++;
|
---|
[2] | 4236 |
|
---|
[551] | 4237 | if (fSplitStatus) {
|
---|
[1077] | 4238 | pswpNew = (PSWP) mp1 + (soldCount + 1);
|
---|
| 4239 | *pswpNew = *pswpClient;
|
---|
| 4240 | pswpNew->hwnd = hwndStatus2;
|
---|
| 4241 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
| 4242 | pswpNew->x = width + 8;
|
---|
| 4243 | pswpNew->y = swpClient.y + 2;
|
---|
| 4244 | pswpNew->cx = width - 6;
|
---|
| 4245 | pswpNew->cy = sheight;
|
---|
| 4246 | sCount++;
|
---|
[133] | 4247 | }
|
---|
[551] | 4248 | else {
|
---|
[1077] | 4249 | WinShowWindow(hwndStatus2, FALSE);
|
---|
| 4250 | WinSetWindowText(hwndStatus2, NullStr);
|
---|
[133] | 4251 | }
|
---|
[2] | 4252 |
|
---|
[551] | 4253 | if (fToolbar) {
|
---|
[1077] | 4254 | if (fTextTools)
|
---|
| 4255 | theight = 32L;
|
---|
| 4256 | else if (!fToolTitles)
|
---|
| 4257 | theight = 40L;
|
---|
| 4258 | pswpNew = (PSWP) mp1 + (soldCount + 1 + (fSplitStatus != FALSE));
|
---|
| 4259 | *pswpNew = *pswpClient;
|
---|
| 4260 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS);
|
---|
| 4261 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
| 4262 | pswpNew->x = swpClient.x + 2;
|
---|
| 4263 | pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2);
|
---|
| 4264 | pswpNew->cx = swpClient.cx - 4;
|
---|
| 4265 | pswpNew->cy = theight - 4;
|
---|
| 4266 | pswpClient->cy -= theight;
|
---|
| 4267 | sCount++;
|
---|
[133] | 4268 | }
|
---|
| 4269 | else
|
---|
[1077] | 4270 | WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE);
|
---|
[2] | 4271 |
|
---|
[551] | 4272 | if (fDrivebar) {
|
---|
[1077] | 4273 | ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4);
|
---|
| 4274 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
---|
| 4275 | (fSplitStatus != FALSE) +
|
---|
| 4276 | (fToolbar != FALSE));
|
---|
| 4277 | *pswpNew = *pswpClient;
|
---|
| 4278 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES);
|
---|
| 4279 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
| 4280 | pswpNew->x = swpClient.x + 2;
|
---|
| 4281 | dheight += ((dheight - 2) * DriveLines);
|
---|
| 4282 | pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);
|
---|
| 4283 | if (fToolbar)
|
---|
| 4284 | pswpNew->y -= theight;
|
---|
| 4285 | pswpNew->cx = swpClient.cx - 4;
|
---|
| 4286 | pswpNew->cy = dheight - 4;
|
---|
| 4287 | pswpClient->cy -= dheight;
|
---|
| 4288 | sCount++;
|
---|
[133] | 4289 | }
|
---|
| 4290 | else
|
---|
[1077] | 4291 | WinShowWindow(WinWindowFromID(hwnd, MAIN_DRIVES), FALSE);
|
---|
[2] | 4292 |
|
---|
[551] | 4293 | if (fAutoView) {
|
---|
[1077] | 4294 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
---|
| 4295 | (fToolbar != FALSE) +
|
---|
| 4296 | (fDrivebar != FALSE) +
|
---|
| 4297 | (fSplitStatus != FALSE));
|
---|
| 4298 | *pswpNew = *pswpClient;
|
---|
| 4299 | pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview;
|
---|
| 4300 | pswpNew->x = pswpClient->x + 3;
|
---|
| 4301 | pswpNew->y = pswpClient->y + 3;
|
---|
| 4302 | if (fMoreButtons)
|
---|
| 4303 | pswpNew->y += (bheight + 4);
|
---|
| 4304 | pswpNew->cx = pswpClient->cx - 6;
|
---|
| 4305 | AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116);
|
---|
| 4306 | AutoviewHeight = max(AutoviewHeight, 36);
|
---|
| 4307 | pswpNew->cy = AutoviewHeight;
|
---|
| 4308 | pswpClient->y += (AutoviewHeight + 6);
|
---|
| 4309 | pswpClient->cy -= (AutoviewHeight + 6);
|
---|
| 4310 | sCount++;
|
---|
| 4311 | WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE);
|
---|
[133] | 4312 | }
|
---|
[551] | 4313 | else {
|
---|
[1077] | 4314 | WinShowWindow(hwndAutoview, FALSE);
|
---|
| 4315 | WinShowWindow(hwndAutoMLE, FALSE);
|
---|
[133] | 4316 | }
|
---|
[2] | 4317 |
|
---|
[133] | 4318 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
---|
[1077] | 4319 | (fToolbar != FALSE) +
|
---|
| 4320 | (fDrivebar != FALSE) +
|
---|
| 4321 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
---|
[133] | 4322 | *pswpNew = *pswpClient;
|
---|
[551] | 4323 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_OPENWALK);
|
---|
| 4324 | pswpNew->x = swpClient.cx - ((sheight * 2) + 4);
|
---|
| 4325 | pswpNew->y = swpClient.y;
|
---|
| 4326 | pswpNew->cx = sheight + 4;
|
---|
| 4327 | pswpNew->cy = sheight + 4;
|
---|
[133] | 4328 | sCount++;
|
---|
| 4329 | pswpNew = (PSWP) mp1 + (soldCount + 2 +
|
---|
[1077] | 4330 | (fToolbar != FALSE) +
|
---|
| 4331 | (fDrivebar != FALSE) +
|
---|
| 4332 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
---|
[133] | 4333 | *pswpNew = *pswpClient;
|
---|
[551] | 4334 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_USERLIST);
|
---|
| 4335 | pswpNew->x = swpClient.cx - (sheight + 2);
|
---|
| 4336 | pswpNew->y = swpClient.y;
|
---|
| 4337 | pswpNew->cx = sheight + 4;
|
---|
| 4338 | pswpNew->cy = sheight + 4;
|
---|
[133] | 4339 | sCount++;
|
---|
| 4340 | pswpNew = (PSWP) mp1 + (soldCount + 3 +
|
---|
[1077] | 4341 | (fToolbar != FALSE) +
|
---|
| 4342 | (fDrivebar != FALSE) +
|
---|
| 4343 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
---|
[133] | 4344 | *pswpNew = *pswpClient;
|
---|
[551] | 4345 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LED);
|
---|
| 4346 | pswpNew->x = swpClient.cx - ((sheight * 2) + 16);
|
---|
| 4347 | pswpNew->y = swpClient.y;
|
---|
| 4348 | pswpNew->cx = 12;
|
---|
| 4349 | pswpNew->cy = 12;
|
---|
[133] | 4350 | sCount++;
|
---|
| 4351 | pswpNew = (PSWP) mp1 + (soldCount + 4 +
|
---|
[1077] | 4352 | (fToolbar != FALSE) +
|
---|
| 4353 | (fDrivebar != FALSE) +
|
---|
| 4354 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
---|
[133] | 4355 | *pswpNew = *pswpClient;
|
---|
[551] | 4356 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LEDHDR);
|
---|
| 4357 | pswpNew->x = swpClient.cx - ((sheight * 2) + 16);
|
---|
| 4358 | pswpNew->y = swpClient.y + 12;
|
---|
| 4359 | pswpNew->cx = 12;
|
---|
| 4360 | pswpNew->cy = sheight - 8;
|
---|
[133] | 4361 | sCount++;
|
---|
[551] | 4362 | if (fUserComboBox) {
|
---|
[1077] | 4363 | if (!aheight) {
|
---|
[2] | 4364 |
|
---|
[1077] | 4365 | SWP swpTemp;
|
---|
[2] | 4366 |
|
---|
[1077] | 4367 | WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
| 4368 | &swpTemp);
|
---|
| 4369 | aheight = swpTemp.cy;
|
---|
| 4370 | }
|
---|
| 4371 | pswpNew = (PSWP) mp1 + (soldCount + 5 +
|
---|
| 4372 | (fToolbar != FALSE) +
|
---|
| 4373 | (fSplitStatus != FALSE) +
|
---|
| 4374 | (fDrivebar != FALSE) + (fAutoView != FALSE));
|
---|
| 4375 | *pswpNew = *pswpClient;
|
---|
| 4376 | pswpNew->hwnd = hwndDrivelist;
|
---|
| 4377 | pswpNew->x = swpClient.x;
|
---|
| 4378 | pswpNew->cx = 48;
|
---|
| 4379 | pswpClient->cy -= (aheight + 6L);
|
---|
| 4380 | pswpNew->y = pswpClient->y;
|
---|
| 4381 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4382 | sCount++;
|
---|
| 4383 | pswpNew = (PSWP) mp1 + (soldCount + 6 +
|
---|
| 4384 | (fToolbar != FALSE) +
|
---|
| 4385 | (fDrivebar != FALSE) +
|
---|
| 4386 | (fSplitStatus != FALSE) +
|
---|
| 4387 | (fAutoView != FALSE));
|
---|
| 4388 | *pswpNew = *pswpClient;
|
---|
| 4389 | pswpNew->hwnd = hwndStatelist;
|
---|
| 4390 | pswpNew->x = swpClient.x + 48;
|
---|
| 4391 | pswpNew->cx = (swpClient.cx - 48) / 7;
|
---|
| 4392 | pswpNew->y = pswpClient->y;
|
---|
| 4393 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4394 | sCount++;
|
---|
| 4395 | pswpNew = (PSWP) mp1 + (soldCount + 7 +
|
---|
| 4396 | (fToolbar != FALSE) +
|
---|
| 4397 | (fDrivebar != FALSE) +
|
---|
| 4398 | (fSplitStatus != FALSE) +
|
---|
| 4399 | (fAutoView != FALSE));
|
---|
| 4400 | *pswpNew = *pswpClient;
|
---|
| 4401 | pswpNew->hwnd = hwndCmdlist;
|
---|
| 4402 | pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7);
|
---|
| 4403 | pswpNew->cx = (swpClient.cx - 48) / 5 +
|
---|
| 4404 | ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7);
|
---|
| 4405 | pswpNew->y = pswpClient->y;
|
---|
| 4406 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4407 | sCount++;
|
---|
| 4408 | pswpNew = (PSWP) mp1 + (soldCount + 8 +
|
---|
| 4409 | (fToolbar != FALSE) +
|
---|
| 4410 | (fDrivebar != FALSE) +
|
---|
| 4411 | (fSplitStatus != FALSE) +
|
---|
| 4412 | (fAutoView != FALSE));
|
---|
| 4413 | *pswpNew = *pswpClient;
|
---|
| 4414 | pswpNew->hwnd = hwndUserlist;
|
---|
| 4415 | pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2);
|
---|
| 4416 | pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) -
|
---|
| 4417 | ((fToolbar) ? ((swpClient.cx - 48) / 7) : 0);
|
---|
| 4418 | pswpNew->y = pswpClient->y;
|
---|
| 4419 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4420 | sCount++;
|
---|
| 4421 | if (fToolbar) {
|
---|
| 4422 | pswpNew = (PSWP) mp1 + (soldCount + 9 +
|
---|
| 4423 | (fToolbar != FALSE) +
|
---|
| 4424 | (fDrivebar != FALSE) +
|
---|
| 4425 | (fSplitStatus != FALSE) +
|
---|
| 4426 | (fAutoView != FALSE));
|
---|
| 4427 | *pswpNew = *pswpClient;
|
---|
| 4428 | pswpNew->hwnd = hwndButtonlist;
|
---|
| 4429 | pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4;
|
---|
| 4430 | pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x;
|
---|
| 4431 | pswpNew->y = pswpClient->y;
|
---|
| 4432 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4433 | sCount++;
|
---|
| 4434 | }
|
---|
| 4435 | else
|
---|
| 4436 | WinShowWindow(hwndButtonlist, FALSE);
|
---|
[133] | 4437 | }
|
---|
[551] | 4438 | else {
|
---|
[1077] | 4439 | WinShowWindow(hwndUserlist, FALSE);
|
---|
| 4440 | WinShowWindow(hwndDrivelist, FALSE);
|
---|
| 4441 | WinShowWindow(hwndStatelist, FALSE);
|
---|
| 4442 | WinShowWindow(hwndButtonlist, FALSE);
|
---|
| 4443 | WinShowWindow(hwndCmdlist, FALSE);
|
---|
[133] | 4444 | }
|
---|
| 4445 | {
|
---|
[1077] | 4446 | PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0;
|
---|
| 4447 | SHORT x;
|
---|
[2] | 4448 |
|
---|
[1077] | 4449 | pswpNew = (PSWP) mp1 + (soldCount + 5 +
|
---|
| 4450 | (fToolbar != FALSE) +
|
---|
| 4451 | (fDrivebar != FALSE) +
|
---|
| 4452 | (fSplitStatus != FALSE) +
|
---|
| 4453 | (fAutoView != FALSE) +
|
---|
| 4454 | ((fUserComboBox != FALSE) * 4) +
|
---|
| 4455 | (fUserComboBox != FALSE &&
|
---|
| 4456 | fToolbar != FALSE));
|
---|
| 4457 | pswp = (PSWP) mp1;
|
---|
| 4458 | for (x = 0; x < soldCount; x++) {
|
---|
| 4459 | if (!pswpTitlebar &&
|
---|
| 4460 | WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR)
|
---|
| 4461 | pswpTitlebar = pswp;
|
---|
| 4462 | else if (!pswpMinbutton &&
|
---|
| 4463 | WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX)
|
---|
| 4464 | pswpMinbutton = pswp;
|
---|
| 4465 | if (pswpTitlebar && pswpMinbutton)
|
---|
| 4466 | break;
|
---|
| 4467 | pswp++;
|
---|
| 4468 | }
|
---|
| 4469 | if (pswpMinbutton && pswpTitlebar) {
|
---|
| 4470 | *pswpNew = *pswpMinbutton;
|
---|
| 4471 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_IDEALSIZE);
|
---|
| 4472 | pswpNew->cy = pswpMinbutton->cy + 3;
|
---|
| 4473 | pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3);
|
---|
| 4474 | pswpTitlebar->cx -= (pswpNew->cx - 1);
|
---|
| 4475 | pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx);
|
---|
| 4476 | pswpNew->y = pswpMinbutton->y - 1;
|
---|
| 4477 | sCount++;
|
---|
| 4478 | }
|
---|
| 4479 | else
|
---|
| 4480 | WinShowWindow(WinWindowFromID(hwnd, IDM_IDEALSIZE), FALSE);
|
---|
[133] | 4481 | }
|
---|
[2] | 4482 |
|
---|
[551] | 4483 | if (fMoreButtons) {
|
---|
[2] | 4484 |
|
---|
[1077] | 4485 | LONG lastx;
|
---|
[2] | 4486 |
|
---|
[1077] | 4487 | pswpNew = (PSWP) mp1 + (soldCount + 6 +
|
---|
| 4488 | (fToolbar != FALSE) +
|
---|
| 4489 | (fDrivebar != FALSE) +
|
---|
| 4490 | (fSplitStatus != FALSE) +
|
---|
| 4491 | (fAutoView != FALSE) +
|
---|
| 4492 | ((fUserComboBox != FALSE) * 4) +
|
---|
| 4493 | (fUserComboBox != FALSE &&
|
---|
| 4494 | fToolbar != FALSE));
|
---|
| 4495 | *pswpNew = *pswpClient;
|
---|
| 4496 | pswpNew->hwnd = hwndName;
|
---|
| 4497 | pswpNew->x = swpClient.x + 3;
|
---|
| 4498 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
| 4499 | pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3;
|
---|
| 4500 | lastx = pswpNew->x + pswpNew->cx;
|
---|
| 4501 | pswpNew->cy = bheight;
|
---|
| 4502 | pswpClient->y += (bheight + 4);
|
---|
| 4503 | pswpClient->cy -= (bheight + 4);
|
---|
| 4504 | sCount++;
|
---|
| 4505 | pswpNew = (PSWP) mp1 + (soldCount + 7 +
|
---|
| 4506 | (fToolbar != FALSE) +
|
---|
| 4507 | (fDrivebar != FALSE) +
|
---|
| 4508 | (fSplitStatus != FALSE) +
|
---|
| 4509 | (fAutoView != FALSE) +
|
---|
| 4510 | ((fUserComboBox != FALSE) * 4) +
|
---|
| 4511 | (fUserComboBox != FALSE &&
|
---|
| 4512 | fToolbar != FALSE));
|
---|
| 4513 | *pswpNew = *pswpClient;
|
---|
| 4514 | pswpNew->hwnd = hwndDate;
|
---|
| 4515 | pswpNew->x = lastx + 3;
|
---|
| 4516 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
| 4517 | pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3;
|
---|
| 4518 | lastx = pswpNew->x + pswpNew->cx;
|
---|
| 4519 | pswpNew->cy = bheight;
|
---|
| 4520 | sCount++;
|
---|
| 4521 | pswpNew = (PSWP) mp1 + (soldCount + 8 +
|
---|
| 4522 | (fToolbar != FALSE) +
|
---|
| 4523 | (fDrivebar != FALSE) +
|
---|
| 4524 | (fSplitStatus != FALSE) +
|
---|
| 4525 | (fAutoView != FALSE) +
|
---|
| 4526 | ((fUserComboBox != FALSE) * 4) +
|
---|
| 4527 | (fUserComboBox != FALSE &&
|
---|
| 4528 | fToolbar != FALSE));
|
---|
| 4529 | *pswpNew = *pswpClient;
|
---|
| 4530 | pswpNew->hwnd = hwndAttr;
|
---|
| 4531 | pswpNew->x = lastx + 3;
|
---|
| 4532 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
| 4533 | pswpNew->cx = (swpClient.cx - pswpNew->x) - 1;
|
---|
| 4534 | pswpNew->cy = bheight;
|
---|
| 4535 | sCount++;
|
---|
[133] | 4536 | }
|
---|
[551] | 4537 | else {
|
---|
[1077] | 4538 | WinShowWindow(hwndAttr, FALSE);
|
---|
| 4539 | WinShowWindow(hwndName, FALSE);
|
---|
| 4540 | WinShowWindow(hwndDate, FALSE);
|
---|
[133] | 4541 | }
|
---|
| 4542 | return MRFROMSHORT(sCount);
|
---|
| 4543 | }
|
---|
[2] | 4544 |
|
---|
[133] | 4545 | case WM_QUERYFRAMECTLCOUNT:
|
---|
| 4546 | {
|
---|
| 4547 | SHORT sCount;
|
---|
[2] | 4548 |
|
---|
[133] | 4549 | sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
|
---|
[2] | 4550 |
|
---|
[133] | 4551 | sCount += 6;
|
---|
| 4552 | if (fSplitStatus)
|
---|
[1077] | 4553 | sCount++;
|
---|
[133] | 4554 | if (fToolbar)
|
---|
[1077] | 4555 | sCount++;
|
---|
[551] | 4556 | if (fUserComboBox) {
|
---|
[1077] | 4557 | sCount += 4;
|
---|
| 4558 | if (fToolbar)
|
---|
| 4559 | sCount++;
|
---|
[133] | 4560 | }
|
---|
| 4561 | if (fDrivebar)
|
---|
[1077] | 4562 | sCount++;
|
---|
[133] | 4563 | if (fAutoView)
|
---|
[1077] | 4564 | sCount++;
|
---|
[133] | 4565 | if (fMoreButtons)
|
---|
[1077] | 4566 | sCount += 3;
|
---|
[133] | 4567 | return MRFROMSHORT(sCount);
|
---|
| 4568 | }
|
---|
[2] | 4569 |
|
---|
[133] | 4570 | case WM_CLOSE:
|
---|
| 4571 | WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
|
---|
| 4572 | return 0;
|
---|
| 4573 | }
|
---|
| 4574 | return oldproc(hwnd, msg, mp1, mp2);
|
---|
[2] | 4575 | }
|
---|
| 4576 |
|
---|
[133] | 4577 | MRESULT EXPENTRY MainWMCommand(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
[130] | 4578 | {
|
---|
[2] | 4579 | SetShiftState();
|
---|
[551] | 4580 | switch (SHORT1FROMMP(mp1)) {
|
---|
[824] | 4581 |
|
---|
| 4582 | case IDM_CONTEXTMENU:
|
---|
| 4583 | {
|
---|
| 4584 | HWND hwnd = WinQueryFocus(HWND_DESKTOP);
|
---|
| 4585 | // DbgMsg(pszSrcFile, __LINE__, "IDM_CONTEXTMENU %x", hwnd);
|
---|
| 4586 | if (hwnd != NULLHANDLE) {
|
---|
[1077] | 4587 | HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT);
|
---|
| 4588 | USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID);
|
---|
| 4589 | switch (id) {
|
---|
| 4590 | case MAIN_SETUPLIST:
|
---|
| 4591 | case MAIN_USERLIST:
|
---|
| 4592 | case MAIN_CMDLIST:
|
---|
| 4593 | // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU");
|
---|
| 4594 | WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0);
|
---|
| 4595 | }
|
---|
[824] | 4596 | }
|
---|
| 4597 | }
|
---|
| 4598 | break;
|
---|
| 4599 |
|
---|
[133] | 4600 | case IDM_SETTARGET:
|
---|
| 4601 | SetTargetDir(hwnd, FALSE);
|
---|
| 4602 | break;
|
---|
[2] | 4603 |
|
---|
[133] | 4604 | case IDM_TOAUTOMLE:
|
---|
| 4605 | if (fComments && fAutoView)
|
---|
[551] | 4606 | WinSetFocus(HWND_DESKTOP, hwndAutoMLE);
|
---|
[133] | 4607 | break;
|
---|
[2] | 4608 |
|
---|
[133] | 4609 | case IDM_HIDENOTEWND:
|
---|
| 4610 | HideNote();
|
---|
| 4611 | break;
|
---|
| 4612 | case IDM_SHOWNOTEWND:
|
---|
| 4613 | ShowNote();
|
---|
| 4614 | break;
|
---|
[2] | 4615 |
|
---|
[133] | 4616 | case IDM_COMPARE:
|
---|
| 4617 | {
|
---|
| 4618 | WALK2 wa;
|
---|
| 4619 | PCNRITEM pci;
|
---|
| 4620 |
|
---|
| 4621 | memset(&wa, 0, sizeof(wa));
|
---|
| 4622 | wa.size = sizeof(wa);
|
---|
[551] | 4623 | pci =
|
---|
[1077] | 4624 | (PCNRITEM)
|
---|
| 4625 | WinSendMsg(WinWindowFromID
|
---|
| 4626 | (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
|
---|
| 4627 | CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
|
---|
| 4628 | MPFROMSHORT(CRA_CURSORED));
|
---|
[551] | 4629 | if (pci && (INT) pci != -1) {
|
---|
[1077] | 4630 | strcpy(wa.szCurrentPath1, pci->pszFileName);
|
---|
| 4631 | MakeValidDir(wa.szCurrentPath1);
|
---|
[133] | 4632 | }
|
---|
| 4633 | else
|
---|
[1104] | 4634 | strcpy(wa.szCurrentPath1, pFM2SaveDirectory);
|
---|
[551] | 4635 | TopWindowName(hwndMain, (HWND) 0, wa.szCurrentPath2);
|
---|
[133] | 4636 | if (!*wa.szCurrentPath2)
|
---|
[1077] | 4637 | strcpy(wa.szCurrentPath2, wa.szCurrentPath1);
|
---|
[133] | 4638 | MakeValidDir(wa.szCurrentPath2);
|
---|
| 4639 | if (WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 4640 | hwnd,
|
---|
| 4641 | WalkTwoCmpDlgProc,
|
---|
| 4642 | FM3ModHandle,
|
---|
| 4643 | WALK2_FRAME,
|
---|
| 4644 | MPFROMP(&wa)) &&
|
---|
| 4645 | !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) {
|
---|
| 4646 | if (!*dircompare) {
|
---|
[2] | 4647 |
|
---|
[1077] | 4648 | COMPARE *cmp;
|
---|
[2] | 4649 |
|
---|
[1077] | 4650 | cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
|
---|
| 4651 | if (cmp) {
|
---|
| 4652 | cmp->size = sizeof(COMPARE);
|
---|
| 4653 | strcpy(cmp->leftdir, wa.szCurrentPath1);
|
---|
| 4654 | strcpy(cmp->rightdir, wa.szCurrentPath2);
|
---|
| 4655 | cmp->hwndParent = hwnd;
|
---|
| 4656 | cmp->dcd.hwndParent = hwnd;
|
---|
| 4657 | WinDlgBox(HWND_DESKTOP,
|
---|
| 4658 | HWND_DESKTOP,
|
---|
| 4659 | CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
|
---|
| 4660 | }
|
---|
| 4661 | }
|
---|
| 4662 | else {
|
---|
[2] | 4663 |
|
---|
[1077] | 4664 | CHAR szPath1[CCHMAXPATH];
|
---|
| 4665 | CHAR szPath2[CCHMAXPATH];
|
---|
| 4666 | runemf2(SEPARATE,
|
---|
| 4667 | HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 4668 | NULL, NULL,
|
---|
| 4669 | "%s %s %s",
|
---|
| 4670 | dircompare,
|
---|
| 4671 | BldQuotedFileName(szPath1, wa.szCurrentPath1),
|
---|
| 4672 | BldQuotedFileName(szPath2, wa.szCurrentPath2));
|
---|
| 4673 | }
|
---|
[2] | 4674 | }
|
---|
[133] | 4675 | }
|
---|
| 4676 | break;
|
---|
[2] | 4677 |
|
---|
[133] | 4678 | case IDM_EXIT:
|
---|
| 4679 | case IDM_KILLME:
|
---|
[551] | 4680 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
[133] | 4681 | break;
|
---|
[2] | 4682 |
|
---|
[133] | 4683 | case IDM_CLI:
|
---|
| 4684 | if (fSplitStatus &&
|
---|
[1077] | 4685 | hwndStatus2 &&
|
---|
| 4686 | !WinIsWindow(WinQueryAnchorBlock(hwnd),
|
---|
| 4687 | WinWindowFromID(hwndStatus2, COMMAND_LINE)))
|
---|
[551] | 4688 | PostMsg(hwndStatus2, UM_CLICKED, MPVOID, MPVOID);
|
---|
[133] | 4689 | break;
|
---|
[2] | 4690 |
|
---|
[133] | 4691 | case IDM_ADDTOUSERLIST:
|
---|
| 4692 | case IDM_DELETEFROMUSERLIST:
|
---|
| 4693 | {
|
---|
| 4694 | CHAR temp[CCHMAXPATH], path[CCHMAXPATH];
|
---|
| 4695 |
|
---|
| 4696 | *temp = 0;
|
---|
[551] | 4697 | WinQueryWindowText(hwndUserlist, CCHMAXPATH, temp);
|
---|
[133] | 4698 | bstrip(temp);
|
---|
| 4699 | if (*temp &&
|
---|
[1077] | 4700 | !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) {
|
---|
| 4701 | if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) {
|
---|
| 4702 | add_udir(TRUE, path);
|
---|
| 4703 | if (fUdirsChanged)
|
---|
| 4704 | save_udirs();
|
---|
| 4705 | WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
---|
| 4706 | }
|
---|
| 4707 | else {
|
---|
| 4708 | if (!remove_udir(path))
|
---|
| 4709 | Runtime_Error(pszSrcFile, __LINE__, "remove_udir");
|
---|
| 4710 | else {
|
---|
| 4711 | if (fUdirsChanged)
|
---|
| 4712 | save_udirs();
|
---|
| 4713 | WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
---|
| 4714 | }
|
---|
| 4715 | }
|
---|
[2] | 4716 | }
|
---|
[133] | 4717 | }
|
---|
| 4718 | break;
|
---|
[2] | 4719 |
|
---|
[133] | 4720 | case IDM_SAVEDIRCNRSTATE:
|
---|
| 4721 | case IDM_DELETEDIRCNRSTATE:
|
---|
| 4722 | {
|
---|
[787] | 4723 | CHAR szStateName[STATE_NAME_MAX_BYTES + 1];
|
---|
[133] | 4724 |
|
---|
[558] | 4725 | *szStateName = 0;
|
---|
[787] | 4726 | WinQueryWindowText(hwndStatelist, STATE_NAME_MAX_BYTES, szStateName);
|
---|
[558] | 4727 | bstrip(szStateName);
|
---|
[961] | 4728 | // Complain if attempting to use reserved name
|
---|
| 4729 | if (stricmp(szStateName, GetPString(IDS_STATETEXT)) == 0 ||
|
---|
[1077] | 4730 | stricmp(szStateName, GetPString(IDS_FM2TEMPTEXT)) == 0)
|
---|
[961] | 4731 | {
|
---|
[1077] | 4732 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
---|
| 4733 | GetPString(IDS_WARNINGTEXT),
|
---|
| 4734 | "\"%s\" is a reserved state name", szStateName);
|
---|
[961] | 4735 | }
|
---|
| 4736 | // Ignore request if blank
|
---|
[1027] | 4737 | else if (*szStateName) {
|
---|
[1077] | 4738 | BOOL fAbortOperation = FALSE;
|
---|
| 4739 | if (!fNoSaveState && fSaveState && stricmp(szStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0)
|
---|
| 4740 | {
|
---|
| 4741 | if (saymsg(MB_YESNO | MB_DEFBUTTON2 | MB_ICONASTERISK, hwnd,
|
---|
| 4742 | GetPString(IDS_WARNINGTEXT),
|
---|
| 4743 | GetPString(IDS_SHUTDOWNSTATE_WARNING), szStateName) == MBID_NO)
|
---|
| 4744 | fAbortOperation = TRUE;
|
---|
| 4745 | }
|
---|
| 4746 | if (!fAbortOperation) {
|
---|
| 4747 | if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) {
|
---|
| 4748 | // Save
|
---|
| 4749 | INT nSaved = SaveDirCnrState(hwnd, szStateName);
|
---|
| 4750 | if (nSaved >= 0) {
|
---|
| 4751 | INT ret = add_setup(szStateName);
|
---|
| 4752 | if (ret == 0) {
|
---|
| 4753 | WinSendMsg(hwndStatelist, LM_INSERTITEM,
|
---|
| 4754 | MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName));
|
---|
| 4755 | save_setups();
|
---|
| 4756 | }
|
---|
| 4757 | else if (ret != 1) {
|
---|
| 4758 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
---|
| 4759 | GetPString(IDS_WARNINGTEXT),
|
---|
| 4760 | "\"%s\" state name add failed", szStateName); // 15 Apr 07 SHL failed
|
---|
| 4761 | WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
|
---|
| 4762 | }
|
---|
| 4763 | }
|
---|
| 4764 | else {
|
---|
| 4765 | saymsg(MB_ENTER | MB_ICONASTERISK,
|
---|
| 4766 | hwnd,
|
---|
| 4767 | GetPString(IDS_WARNINGTEXT),
|
---|
| 4768 | "State data save failed");
|
---|
| 4769 | WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
|
---|
| 4770 | }
|
---|
| 4771 | }
|
---|
| 4772 | else {
|
---|
| 4773 | // Delete
|
---|
| 4774 | ULONG numsaves = 0, size, x;
|
---|
| 4775 | CHAR s[STATE_NAME_MAX_BYTES + 80];
|
---|
[2] | 4776 |
|
---|
[1077] | 4777 | INT ret = remove_setup(szStateName);
|
---|
| 4778 | if (ret == 1)
|
---|
| 4779 | save_setups();
|
---|
| 4780 | sprintf(s, "%s.NumDirsLastTime", szStateName);
|
---|
| 4781 | size = sizeof(ULONG);
|
---|
| 4782 | if (!PrfQueryProfileData(fmprof,
|
---|
| 4783 | FM3Str,
|
---|
| 4784 | s,
|
---|
| 4785 | (PVOID)&numsaves,
|
---|
| 4786 | &size)) {
|
---|
| 4787 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
---|
| 4788 | GetPString(IDS_WARNINGTEXT),
|
---|
| 4789 | GetPString(IDS_DOESNTEXISTTEXT), szStateName);
|
---|
| 4790 | }
|
---|
| 4791 | else if (!size)
|
---|
| 4792 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
| 4793 | else {
|
---|
| 4794 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L);
|
---|
| 4795 | for (x = 0; x < numsaves; x++) {
|
---|
| 4796 | sprintf(s, "%s.DirCnrPos.%lu", szStateName, x);
|
---|
| 4797 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4798 | sprintf(s, "%s.DirCnrDir.%lu", szStateName, x);
|
---|
| 4799 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4800 | sprintf(s, "%s.DirCnrSort.%lu", szStateName, x);
|
---|
| 4801 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4802 | sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x);
|
---|
| 4803 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4804 | sprintf(s, "%s.DirCnrView.%lu", szStateName, x);
|
---|
| 4805 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4806 | sprintf(s, "%s.DirCnr.%lu.DetailsLongname", szStateName, x);
|
---|
| 4807 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4808 | sprintf(s, "%s.DirCnr.%lu.DetailsSubject", szStateName, x);
|
---|
| 4809 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4810 | sprintf(s, "%s.DirCnr.%lu.DetailsSize", szStateName, x);
|
---|
| 4811 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4812 | sprintf(s, "%s.DirCnr.%lu.DetailsEA", szStateName, x);
|
---|
| 4813 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4814 | sprintf(s, "%s.DirCnr.%lu.DetailsAttr", szStateName, x);
|
---|
| 4815 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4816 | sprintf(s, "%s.DirCnr.%lu.DetailsIcon", szStateName, x);
|
---|
| 4817 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4818 | sprintf(s, "%s.DirCnr.%lu.DetailsLWDate", szStateName, x);
|
---|
| 4819 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4820 | sprintf(s, "%s.DirCnr.%lu.DetailsLWTime", szStateName, x);
|
---|
| 4821 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4822 | sprintf(s, "%s.DirCnr.%lu.DetailsLADate", szStateName, x);
|
---|
| 4823 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4824 | sprintf(s, "%s.DirCnr.%lu.DetailsLATime", szStateName, x);
|
---|
| 4825 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4826 | sprintf(s, "%s.DirCnr.%lu.DetailsCRDate", szStateName, x);
|
---|
| 4827 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4828 | sprintf(s, "%s.DirCnr.%lu.DetailsCRTime", szStateName, x);
|
---|
| 4829 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4830 | sprintf(s, "%s.DirCnr.%lu.Backgroundcolor", szStateName, x);
|
---|
| 4831 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4832 | sprintf(s, "%s.DirCnr.%lu.Fontnamesize", szStateName, x);
|
---|
| 4833 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4834 | }
|
---|
| 4835 | sprintf(s, "%s.LastTreePos", szStateName);
|
---|
| 4836 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4837 | sprintf(s, "%s.MySizeLastTime", szStateName);
|
---|
| 4838 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4839 | }
|
---|
| 4840 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
---|
| 4841 | }
|
---|
| 4842 | }
|
---|
[2] | 4843 | }
|
---|
[133] | 4844 | }
|
---|
| 4845 | break;
|
---|
[2] | 4846 |
|
---|
[133] | 4847 | case IDM_IDEALSIZE:
|
---|
| 4848 | {
|
---|
| 4849 | SWP swp, swpD;
|
---|
| 4850 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L;
|
---|
| 4851 | ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
|
---|
| 4852 |
|
---|
| 4853 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
---|
[551] | 4854 | if (swp.fl & SWP_MAXIMIZE) {
|
---|
[1077] | 4855 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_SYSCOMMAND,
|
---|
| 4856 | MPFROM2SHORT(SC_RESTORE, 0), MPVOID);
|
---|
| 4857 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
---|
[2] | 4858 | }
|
---|
[133] | 4859 | WinGetMaxPosition(WinQueryWindow(hwnd, QW_PARENT), &swpD);
|
---|
| 4860 | swpD.x += bsz;
|
---|
| 4861 | swpD.cx -= (bsz * 2);
|
---|
| 4862 | swpD.y += icz;
|
---|
| 4863 | swpD.cy -= (icz + bsz);
|
---|
| 4864 | if (swp.x == swpD.x && swp.y == swpD.y &&
|
---|
[1077] | 4865 | swp.cx == swpD.cx && swp.cy == swpD.cy &&
|
---|
| 4866 | // fixme to be #defined someday
|
---|
| 4867 | WinQueryWindowUShort(hwnd, QWL_USER + 10) &&
|
---|
| 4868 | WinQueryWindowUShort(hwnd, QWL_USER + 14)) {
|
---|
| 4869 | swpD.x = WinQueryWindowUShort(hwnd, QWL_USER + 8);
|
---|
| 4870 | swpD.cx = WinQueryWindowUShort(hwnd, QWL_USER + 10);
|
---|
| 4871 | swpD.y = WinQueryWindowUShort(hwnd, QWL_USER + 12);
|
---|
| 4872 | swpD.cy = WinQueryWindowUShort(hwnd, QWL_USER + 14);
|
---|
[133] | 4873 | }
|
---|
[551] | 4874 | else {
|
---|
[1077] | 4875 | WinSetWindowUShort(hwnd, QWL_USER + 8, (USHORT) swp.x);
|
---|
| 4876 | WinSetWindowUShort(hwnd, QWL_USER + 10, (USHORT) swp.cx);
|
---|
| 4877 | WinSetWindowUShort(hwnd, QWL_USER + 12, (USHORT) swp.y);
|
---|
| 4878 | WinSetWindowUShort(hwnd, QWL_USER + 14, (USHORT) swp.cy);
|
---|
[133] | 4879 | }
|
---|
| 4880 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP,
|
---|
[1077] | 4881 | swpD.x, swpD.y, swpD.cx, swpD.cy, SWP_MOVE | SWP_SIZE);
|
---|
[133] | 4882 | }
|
---|
| 4883 | break;
|
---|
[2] | 4884 |
|
---|
[133] | 4885 | case IDM_BLINK:
|
---|
| 4886 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
|
---|
[1077] | 4887 | SWP_MINIMIZE);
|
---|
[133] | 4888 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
|
---|
[1077] | 4889 | SWP_RESTORE | SWP_ZORDER);
|
---|
[133] | 4890 | break;
|
---|
[2] | 4891 |
|
---|
[133] | 4892 | case DID_CANCEL:
|
---|
| 4893 | {
|
---|
[551] | 4894 | HWND hwndTop = TopWindow(hwndMain, (HWND) 0);
|
---|
[2] | 4895 |
|
---|
[133] | 4896 | if (hwndTop)
|
---|
[1077] | 4897 | WinSetFocus(HWND_DESKTOP, hwndTop);
|
---|
[133] | 4898 | }
|
---|
| 4899 | break;
|
---|
[2] | 4900 |
|
---|
[133] | 4901 | case IDM_NOTEBOOK:
|
---|
[917] | 4902 | case IDM_DIRCNRSETTINGS:
|
---|
[953] | 4903 | case IDM_DIRVIEWSETTINGS:
|
---|
| 4904 | case IDM_DIRSORTSETTINGS:
|
---|
| 4905 | case IDM_COLLECTORVIEWSETTINGS:
|
---|
| 4906 | case IDM_COLLECTORSORTSETTINGS:
|
---|
[917] | 4907 | case IDM_ARCHIVERSETTINGS:
|
---|
[953] | 4908 | case IDM_TREECNRVIEWSETTINGS:
|
---|
| 4909 | case IDM_TREECNRSORTSETTINGS:
|
---|
[917] | 4910 | case IDM_VIEWERSETTINGS:
|
---|
[953] | 4911 | case IDM_VIEWERSETTINGS2:
|
---|
[917] | 4912 | case IDM_COMPARESETTINGS:
|
---|
[953] | 4913 | case IDM_MONOLITHICSETTINGS:
|
---|
| 4914 | case IDM_GENERALSETTINGS:
|
---|
| 4915 | case IDM_SCANSETTINGS:
|
---|
| 4916 | case IDM_BUBBLESSETTINGS:
|
---|
[917] | 4917 | case IDM_QUICKSETTINGS:
|
---|
[133] | 4918 | WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 4919 | hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMLONG(mp1));
|
---|
[133] | 4920 | break;
|
---|
[2] | 4921 |
|
---|
[133] | 4922 | case IDM_VIEWHELPS:
|
---|
| 4923 | case IDM_VIEWINFS:
|
---|
| 4924 | WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 4925 | HWND_DESKTOP,
|
---|
| 4926 | ViewInfProc,
|
---|
| 4927 | FM3ModHandle,
|
---|
| 4928 | VINF_FRAME,
|
---|
| 4929 | ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ?
|
---|
| 4930 | MPFROMP(NullStr) : MPVOID));
|
---|
[133] | 4931 | break;
|
---|
[2] | 4932 |
|
---|
[133] | 4933 | case IDM_OPENWALK:
|
---|
| 4934 | {
|
---|
| 4935 | char newpath[CCHMAXPATH];
|
---|
[2] | 4936 |
|
---|
[133] | 4937 | *newpath = 0;
|
---|
[551] | 4938 | TopWindowName(hwnd, (HWND) 0, newpath);
|
---|
[133] | 4939 | if (WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 4940 | hwnd,
|
---|
| 4941 | WalkAllDlgProc,
|
---|
| 4942 | FM3ModHandle, WALK_FRAME, MPFROMP(newpath)) && *newpath)
|
---|
| 4943 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, newpath);
|
---|
[133] | 4944 | }
|
---|
| 4945 | break;
|
---|
[2] | 4946 |
|
---|
[133] | 4947 | case IDM_WINDOWDLG:
|
---|
| 4948 | WindowList(hwnd);
|
---|
| 4949 | break;
|
---|
[2] | 4950 |
|
---|
[133] | 4951 | case IDM_HELPMOUSE:
|
---|
| 4952 | case IDM_HELPCONTEXT:
|
---|
| 4953 | case IDM_HELPHINTS:
|
---|
| 4954 | case IDM_HELPPIX:
|
---|
| 4955 | case IDM_HELPTUTOR:
|
---|
| 4956 | case IDM_HELPUSERLIST:
|
---|
| 4957 | case IDM_HELP:
|
---|
| 4958 | case IDM_HELPCONTENTS:
|
---|
| 4959 | case IDM_HELPKEYS:
|
---|
| 4960 | case IDM_HELPGENERAL:
|
---|
[551] | 4961 | if (hwndHelp) {
|
---|
| 4962 | if (SHORT1FROMMP(mp2) == CMDSRC_MENU) {
|
---|
[2] | 4963 |
|
---|
[1077] | 4964 | RECTL rcl;
|
---|
| 4965 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L;
|
---|
[2] | 4966 |
|
---|
[1077] | 4967 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
---|
| 4968 | rcl.yBottom += icz;
|
---|
| 4969 | rcl.yTop -= icz;
|
---|
| 4970 | rcl.xLeft += icz;
|
---|
| 4971 | rcl.xRight -= icz;
|
---|
| 4972 | WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);
|
---|
[133] | 4973 | }
|
---|
[551] | 4974 | else {
|
---|
[2] | 4975 |
|
---|
[1077] | 4976 | RECTL rcl;
|
---|
[2] | 4977 |
|
---|
[1077] | 4978 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
---|
| 4979 | rcl.yBottom += 8;
|
---|
| 4980 | rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7);
|
---|
| 4981 | rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7);
|
---|
| 4982 | rcl.xRight -= 8;
|
---|
| 4983 | WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);
|
---|
[133] | 4984 | }
|
---|
[551] | 4985 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 4986 | case IDM_HELPCONTEXT:
|
---|
[1077] | 4987 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 4988 | MPFROM2SHORT(HELP_CONTEXT, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4989 | break;
|
---|
[2] | 4990 |
|
---|
[133] | 4991 | case IDM_HELPMOUSE:
|
---|
[1077] | 4992 | if (hwndHelp)
|
---|
| 4993 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 4994 | MPFROM2SHORT(HELP_MOUSE, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4995 | break;
|
---|
[2] | 4996 |
|
---|
[133] | 4997 | case IDM_HELPPIX:
|
---|
[1077] | 4998 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 4999 | MPFROM2SHORT(HELP_BITMAP1, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 5000 | break;
|
---|
[2] | 5001 |
|
---|
[133] | 5002 | case IDM_HELPTUTOR:
|
---|
[1077] | 5003 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 5004 | MPFROM2SHORT(HELP_TUTORIAL, 0),
|
---|
| 5005 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 5006 | break;
|
---|
[2] | 5007 |
|
---|
[133] | 5008 | case IDM_HELPHINTS:
|
---|
[1077] | 5009 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 5010 | MPFROM2SHORT(HELP_HINTS, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 5011 | break;
|
---|
[2] | 5012 |
|
---|
[133] | 5013 | case IDM_HELPGENERAL:
|
---|
[1077] | 5014 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 5015 | MPFROM2SHORT(HELP_MAIN, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 5016 | break;
|
---|
[133] | 5017 | case IDM_HELPKEYS:
|
---|
[1077] | 5018 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 5019 | MPFROM2SHORT(HELP_KEYS, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 5020 | break;
|
---|
[2] | 5021 |
|
---|
[133] | 5022 | case IDM_HELP:
|
---|
| 5023 | case IDM_HELPCONTENTS:
|
---|
[1077] | 5024 | WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
|
---|
| 5025 | break;
|
---|
[2] | 5026 |
|
---|
[133] | 5027 | case IDM_HELPUSERLIST:
|
---|
[1077] | 5028 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 5029 | MPFROM2SHORT(HELP_USERLISTS, 0),
|
---|
| 5030 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 5031 | break;
|
---|
[2] | 5032 | }
|
---|
[133] | 5033 | }
|
---|
| 5034 | break;
|
---|
[2] | 5035 |
|
---|
[133] | 5036 | case IDM_EDITANYARCHIVER:
|
---|
[419] | 5037 | EditArchiverDefinition(hwnd);
|
---|
[133] | 5038 | break;
|
---|
[2] | 5039 |
|
---|
[133] | 5040 | case IDM_ABOUT:
|
---|
| 5041 | WinDlgBox(HWND_DESKTOP, hwnd, AboutDlgProc, FM3ModHandle,
|
---|
[1077] | 5042 | ABT_FRAME, MPVOID);
|
---|
[133] | 5043 | break;
|
---|
[2] | 5044 |
|
---|
[133] | 5045 | case IDM_FONTPALETTE:
|
---|
| 5046 | OpenObject("<WP_FNTPAL>", Default, hwnd);
|
---|
| 5047 | break;
|
---|
[2] | 5048 |
|
---|
[133] | 5049 | case IDM_HICOLORPALETTE:
|
---|
| 5050 | case IDM_COLORPALETTE:
|
---|
| 5051 | {
|
---|
| 5052 | CHAR *palette = "<WP_CLRPAL>";
|
---|
| 5053 | ULONG version[2];
|
---|
| 5054 |
|
---|
| 5055 | if (!DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR,
|
---|
[1077] | 5056 | (PVOID) & version, (ULONG) sizeof(version))) {
|
---|
| 5057 | if (version[0] > 20L || (version[0] == 20L && version[1] > 29L)) {
|
---|
| 5058 | if (SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE)
|
---|
| 5059 | palette = "<WP_HIRESCLRPAL>";
|
---|
| 5060 | else
|
---|
| 5061 | palette = "<WP_LORESCLRPAL>";
|
---|
| 5062 | }
|
---|
[2] | 5063 | }
|
---|
[133] | 5064 | OpenObject(palette, Default, hwnd);
|
---|
| 5065 | }
|
---|
| 5066 | break;
|
---|
[2] | 5067 |
|
---|
[133] | 5068 | case IDM_SYSTEMSETUP:
|
---|
| 5069 | OpenObject("<WP_CONFIG>", Default, hwnd);
|
---|
| 5070 | break;
|
---|
[2] | 5071 |
|
---|
[133] | 5072 | case IDM_SCHEMEPALETTE:
|
---|
| 5073 | {
|
---|
| 5074 | HOBJECT hWPSObject;
|
---|
[2] | 5075 |
|
---|
[133] | 5076 | hWPSObject = WinQueryObject("<WP_SCHPAL>");
|
---|
| 5077 | if (hWPSObject != NULLHANDLE)
|
---|
[1077] | 5078 | WinSetObjectData(hWPSObject, "SCHEMES=Winter:PM_Winter,"
|
---|
| 5079 | "Spring:PM_Spring,Summer:PM_Summer,"
|
---|
| 5080 | "System:PM_System,Windows:PM_Windows;"
|
---|
| 5081 | "OPEN=DEFAULT");
|
---|
[133] | 5082 | }
|
---|
| 5083 | break;
|
---|
[2] | 5084 |
|
---|
[133] | 5085 | case IDM_SYSTEMCLOCK:
|
---|
| 5086 | OpenObject("<WP_CLOCK>", Default, hwnd);
|
---|
| 5087 | break;
|
---|
[2] | 5088 |
|
---|
| 5089 | #ifdef NEVER
|
---|
[133] | 5090 | case IDM_SYSINFO:
|
---|
| 5091 | WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, SysInfoDlgProc, FM3ModHandle,
|
---|
[1077] | 5092 | SYS_FRAME, NULL);
|
---|
[133] | 5093 | break;
|
---|
[2] | 5094 | #endif
|
---|
| 5095 |
|
---|
[133] | 5096 | case IDM_INSTANT:
|
---|
| 5097 | {
|
---|
| 5098 | CHAR path[CCHMAXPATH];
|
---|
| 5099 | PCNRITEM pci = (PCNRITEM) 0;
|
---|
| 5100 |
|
---|
| 5101 | if (hwndTree)
|
---|
[1077] | 5102 | pci = (PCNRITEM) WinSendMsg(hwndTree, CM_QUERYRECORDEMPHASIS,
|
---|
| 5103 | MPFROMLONG(CMA_FIRST),
|
---|
| 5104 | MPFROMSHORT(CRA_CURSORED));
|
---|
[551] | 5105 | if (pci && (INT) pci != -1) {
|
---|
[1077] | 5106 | strcpy(path, pci->pszFileName);
|
---|
| 5107 | MakeValidDir(path);
|
---|
[2] | 5108 | }
|
---|
[133] | 5109 | else
|
---|
[1104] | 5110 | strcpy(path, pFM2SaveDirectory);
|
---|
[133] | 5111 | WinDlgBox(HWND_DESKTOP, hwnd, InstantDlgProc, FM3ModHandle,
|
---|
[1077] | 5112 | BAT_FRAME, MPFROMP(path));
|
---|
[133] | 5113 | }
|
---|
| 5114 | break;
|
---|
[2] | 5115 |
|
---|
[133] | 5116 | case IDM_WINFULLSCREEN:
|
---|
| 5117 | case IDM_DOSCOMMANDLINE:
|
---|
| 5118 | case IDM_COMMANDLINE:
|
---|
| 5119 | {
|
---|
| 5120 | CHAR *env = GetCmdSpec(FALSE), path[CCHMAXPATH];
|
---|
| 5121 | INT type = SEPARATE | WINDOWED;
|
---|
| 5122 |
|
---|
| 5123 | *path = 0;
|
---|
[551] | 5124 | TopWindowName(hwnd, (HWND) 0, path);
|
---|
[133] | 5125 | if (SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE)
|
---|
[1077] | 5126 | env = GetCmdSpec(TRUE);
|
---|
[551] | 5127 | else if (SHORT1FROMMP(mp1) != IDM_COMMANDLINE) {
|
---|
[1077] | 5128 | env = "WINOS2.COM";
|
---|
| 5129 | type = SEPARATE | FULLSCREEN;
|
---|
[2] | 5130 | }
|
---|
[888] | 5131 | runemf2(type, hwnd, pszSrcFile, __LINE__,
|
---|
[1077] | 5132 | path, NULL, "%s", env);
|
---|
[133] | 5133 | }
|
---|
| 5134 | break;
|
---|
[2] | 5135 |
|
---|
[133] | 5136 | case IDM_KILLPROC:
|
---|
| 5137 | WinDlgBox(HWND_DESKTOP, hwnd, KillDlgProc, FM3ModHandle,
|
---|
[1077] | 5138 | KILL_FRAME, NULL);
|
---|
[133] | 5139 | break;
|
---|
[2] | 5140 |
|
---|
[133] | 5141 | case IDM_AUTOVIEWCOMMENTS:
|
---|
| 5142 | case IDM_AUTOVIEWFILE:
|
---|
| 5143 | if (SHORT1FROMMP(mp1) == IDM_AUTOVIEWFILE)
|
---|
| 5144 | fComments = FALSE;
|
---|
| 5145 | else
|
---|
| 5146 | fComments = TRUE;
|
---|
[551] | 5147 | PrfWriteProfileData(fmprof, FM3Str, "Comments", &fComments, sizeof(BOOL));
|
---|
[133] | 5148 | WinSetWindowText((fComments) ? hwndAutoview : hwndAutoMLE, NullStr);
|
---|
| 5149 | goto AutoChange;
|
---|
[2] | 5150 |
|
---|
[133] | 5151 | case IDM_AUTOVIEW:
|
---|
| 5152 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
---|
[1077] | 5153 | &fAutoView, TRUE, "AutoView");
|
---|
[133] | 5154 | AutoChange:
|
---|
| 5155 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
---|
[1077] | 5156 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[551] | 5157 | if (fAutoView) {
|
---|
[2] | 5158 |
|
---|
[133] | 5159 | CHAR s[CCHMAXPATH];
|
---|
| 5160 | HWND hwndDir;
|
---|
| 5161 | PCNRITEM pci;
|
---|
[2] | 5162 |
|
---|
[551] | 5163 | hwndDir = TopWindowName(hwnd, (HWND) 0, s);
|
---|
| 5164 | if (hwndDir) {
|
---|
[1077] | 5165 | hwndDir = WinWindowFromID(hwndDir, FID_CLIENT);
|
---|
| 5166 | if (hwndDir) {
|
---|
| 5167 | hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
|
---|
| 5168 | if (hwndDir) {
|
---|
| 5169 | pci = (PCNRITEM) WinSendMsg(hwndDir, CM_QUERYRECORDEMPHASIS,
|
---|
| 5170 | MPFROMLONG(CMA_FIRST),
|
---|
| 5171 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 5172 | if (pci && (INT) pci != -1 &&
|
---|
| 5173 | (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
|
---|
| 5174 | WinSendMsg(hwnd,
|
---|
| 5175 | UM_LOADFILE,
|
---|
| 5176 | MPFROMP(pci->pszFileName),
|
---|
| 5177 | (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ?
|
---|
| 5178 | MPVOID : MPFROMLONG(1));
|
---|
| 5179 | }
|
---|
| 5180 | }
|
---|
[2] | 5181 | }
|
---|
[133] | 5182 | }
|
---|
| 5183 | break;
|
---|
[2] | 5184 |
|
---|
[133] | 5185 | case IDM_TEXTTOOLS:
|
---|
| 5186 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
---|
[1077] | 5187 | &fTextTools, TRUE, "TextTools");
|
---|
[1125] | 5188 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
---|
[133] | 5189 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
---|
[1077] | 5190 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[133] | 5191 | break;
|
---|
[2] | 5192 |
|
---|
[133] | 5193 | case IDM_TOOLTITLES:
|
---|
| 5194 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
---|
[1077] | 5195 | &fToolTitles, TRUE, "ToolTitles");
|
---|
[1125] | 5196 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
---|
[133] | 5197 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
---|
[1077] | 5198 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[133] | 5199 | break;
|
---|
[2] | 5200 |
|
---|
[133] | 5201 | case IDM_HIDEMENU:
|
---|
| 5202 | {
|
---|
[953] | 5203 | HWND hwndMenu = WinQueryWindowULong(hwnd, QWL_USER);
|
---|
| 5204 | MenuInvisible = MenuInvisible ? FALSE : TRUE;
|
---|
[551] | 5205 | if (MenuInvisible) {
|
---|
[1077] | 5206 | WinSetParent(hwndMenu, HWND_OBJECT, FALSE);
|
---|
| 5207 | WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 5208 | FID_SYSMENU), IDM_HIDEMENU,
|
---|
| 5209 | GetPString(IDS_UNHIDEMENUTEXT));
|
---|
[2] | 5210 | }
|
---|
[551] | 5211 | else {
|
---|
[1077] | 5212 | WinSetParent(hwndMenu, WinQueryWindow(hwnd, QW_PARENT), FALSE);
|
---|
| 5213 | WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 5214 | FID_SYSMENU), IDM_HIDEMENU,
|
---|
| 5215 | GetPString(IDS_HIDEMENUTEXT));
|
---|
[133] | 5216 | }
|
---|
| 5217 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
---|
[1077] | 5218 | MPFROMLONG(FCF_MENU), MPVOID);
|
---|
[133] | 5219 | PrfWriteProfileData(fmprof, FM3Str, "MenuInvisible",
|
---|
[1077] | 5220 | &MenuInvisible, sizeof(BOOL));
|
---|
[133] | 5221 | }
|
---|
| 5222 | break;
|
---|
[2] | 5223 |
|
---|
[133] | 5224 | case IDM_SEEALL:
|
---|
| 5225 | case IDM_GREP:
|
---|
| 5226 | case IDM_COLLECTOR:
|
---|
| 5227 | {
|
---|
| 5228 | HWND hwndC;
|
---|
| 5229 | SWP swp;
|
---|
| 5230 | BOOL already = FALSE;
|
---|
| 5231 |
|
---|
| 5232 | if (Collector)
|
---|
[1077] | 5233 | already = TRUE;
|
---|
[133] | 5234 | if (!already && !fAutoTile && !fExternalCollector)
|
---|
[1077] | 5235 | GetNextWindowPos(hwnd, &swp, NULL, NULL);
|
---|
[735] | 5236 | hwndC = StartCollector(fExternalCollector ? HWND_DESKTOP : hwnd, 4);
|
---|
[551] | 5237 | if (hwndC) {
|
---|
[1077] | 5238 | if (!already && !fAutoTile && !fExternalCollector)
|
---|
| 5239 | WinSetWindowPos(hwndC, HWND_TOP,
|
---|
| 5240 | swp.x, swp.y, swp.cx, swp.cy,
|
---|
| 5241 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
---|
| 5242 | else if (fAutoTile && !already)
|
---|
| 5243 | TileChildren(hwnd, TRUE);
|
---|
| 5244 | WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE |
|
---|
| 5245 | SWP_ACTIVATE);
|
---|
| 5246 | if (SHORT1FROMMP(mp1) == IDM_GREP)
|
---|
| 5247 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,
|
---|
| 5248 | MPFROM2SHORT(IDM_GREP, 0), MPVOID);
|
---|
| 5249 | if (SHORT1FROMMP(mp1) == IDM_SEEALL)
|
---|
| 5250 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,
|
---|
| 5251 | MPFROM2SHORT(IDM_SEEALL, 0), MPVOID);
|
---|
[2] | 5252 | }
|
---|
[133] | 5253 | }
|
---|
| 5254 | break;
|
---|
[2] | 5255 |
|
---|
[133] | 5256 | case IDM_TOOLLEFT:
|
---|
| 5257 | case IDM_TOOLRIGHT:
|
---|
| 5258 | {
|
---|
| 5259 | TOOL *tool;
|
---|
| 5260 |
|
---|
[551] | 5261 | if (!toolhead || !toolhead->next) {
|
---|
[1077] | 5262 | firsttool = (toolhead) ? toolhead->id : 0;
|
---|
| 5263 | break;
|
---|
[2] | 5264 | }
|
---|
[133] | 5265 | tool = find_tool(firsttool);
|
---|
| 5266 | if (!tool)
|
---|
[1077] | 5267 | tool = toolhead;
|
---|
[551] | 5268 | if (SHORT1FROMMP(mp1) == IDM_TOOLRIGHT) {
|
---|
[1077] | 5269 | tool = prev_tool(tool, TRUE);
|
---|
| 5270 | firsttool = tool->id;
|
---|
[133] | 5271 | }
|
---|
[551] | 5272 | else {
|
---|
[1077] | 5273 | tool = next_tool(tool, TRUE);
|
---|
| 5274 | firsttool = tool->id;
|
---|
[133] | 5275 | }
|
---|
| 5276 | ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5277 | MAIN_TOOLS));
|
---|
[133] | 5278 | }
|
---|
| 5279 | break;
|
---|
[2] | 5280 |
|
---|
[133] | 5281 | case IDM_CREATETOOL:
|
---|
[1125] | 5282 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
---|
[133] | 5283 | break;
|
---|
[2] | 5284 |
|
---|
[133] | 5285 | case IDM_TOOLBAR:
|
---|
| 5286 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5287 | IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar");
|
---|
[1125] | 5288 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
---|
[133] | 5289 | WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5290 | MAIN_TOOLS), fToolbar);
|
---|
[133] | 5291 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5292 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[133] | 5293 | if (fDrivebar)
|
---|
| 5294 | WinInvalidateRect(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5295 | MAIN_DRIVES), NULL, TRUE);
|
---|
[133] | 5296 | break;
|
---|
[2] | 5297 |
|
---|
[133] | 5298 | case IDM_DRIVEBAR:
|
---|
| 5299 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5300 | IDM_DRIVEBAR, &fDrivebar, TRUE, "Drivebar");
|
---|
[133] | 5301 | WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5302 | MAIN_DRIVES), fDrivebar);
|
---|
[133] | 5303 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5304 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[551] | 5305 | PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
|
---|
[133] | 5306 | break;
|
---|
[2] | 5307 |
|
---|
[133] | 5308 | case IDM_USERLIST:
|
---|
| 5309 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5310 | SHORT1FROMMP(mp1), &fUserComboBox, TRUE, "UserComboBox");
|
---|
[133] | 5311 | WinShowWindow(hwndUserlist, fUserComboBox);
|
---|
| 5312 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5313 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[551] | 5314 | PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
---|
| 5315 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
---|
| 5316 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
---|
| 5317 | PostMsg(hwnd, UM_FILLBUTTONLIST, MPVOID, MPVOID);
|
---|
[133] | 5318 | break;
|
---|
[2] | 5319 |
|
---|
[133] | 5320 | case IDM_MOREBUTTONS:
|
---|
| 5321 | WinSetWindowText(hwndName, NullStr);
|
---|
| 5322 | WinSetWindowText(hwndDate, NullStr);
|
---|
| 5323 | WinSetWindowText(hwndAttr, NullStr);
|
---|
| 5324 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5325 | SHORT1FROMMP(mp1), &fMoreButtons, TRUE, "MoreButtons");
|
---|
[551] | 5326 | if (fMoreButtons) {
|
---|
[2] | 5327 |
|
---|
[133] | 5328 | HWND hwndTemp;
|
---|
[2] | 5329 |
|
---|
[551] | 5330 | hwndTemp = TopWindow(hwnd, (HWND) 0);
|
---|
[2] | 5331 |
|
---|
[551] | 5332 | if (hwndTemp) {
|
---|
[1077] | 5333 | WinSetFocus(HWND_DESKTOP, hwnd);
|
---|
| 5334 | WinSetFocus(HWND_DESKTOP, hwndTemp);
|
---|
[2] | 5335 | }
|
---|
[133] | 5336 | }
|
---|
| 5337 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5338 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[133] | 5339 | break;
|
---|
[2] | 5340 |
|
---|
[921] | 5341 | case IDM_TOGGLEDRAGDIALOG:
|
---|
| 5342 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5343 | IDM_TOGGLEDRAGDIALOG,
|
---|
| 5344 | &fDragndropDlg,
|
---|
| 5345 | TRUE,
|
---|
| 5346 | "Drag&DropDlg");
|
---|
[921] | 5347 | break;
|
---|
| 5348 |
|
---|
[925] | 5349 | case IDM_SYNCUPDATES:
|
---|
| 5350 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5351 | IDM_SYNCUPDATES,
|
---|
| 5352 | &fSyncUpdates,
|
---|
| 5353 | TRUE,
|
---|
| 5354 | "SyncUpdates");
|
---|
[925] | 5355 | break;
|
---|
| 5356 |
|
---|
[133] | 5357 | case IDM_FREETREE:
|
---|
[551] | 5358 | if (fFreeTree) {
|
---|
[133] | 5359 | SWP swp, swpT;
|
---|
[2] | 5360 |
|
---|
[133] | 5361 | WinQueryWindowPos(hwndTree, &swpT);
|
---|
| 5362 | WinQueryWindowPos(hwnd, &swp);
|
---|
[551] | 5363 | WinSetWindowPos(hwndTree, HWND_TOP, 0, swp.cy - swpT.cy, 0, 0,
|
---|
[1077] | 5364 | SWP_MOVE);
|
---|
[133] | 5365 | }
|
---|
| 5366 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
---|
[1077] | 5367 | &fFreeTree, TRUE, "FreeTree");
|
---|
[133] | 5368 | if (fAutoTile)
|
---|
| 5369 | TileChildren(hwnd, TRUE);
|
---|
| 5370 | break;
|
---|
[2] | 5371 |
|
---|
[133] | 5372 | case IDM_AUTOTILE:
|
---|
| 5373 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5374 | SHORT1FROMMP(mp1), &fAutoTile, TRUE, "AutoTile");
|
---|
[133] | 5375 | if (fAutoTile)
|
---|
| 5376 | TileChildren(hwnd, TRUE);
|
---|
| 5377 | break;
|
---|
[2] | 5378 |
|
---|
[133] | 5379 | case IDM_TILEBACKWARDS:
|
---|
| 5380 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5381 | SHORT1FROMMP(mp1), &fTileBackwards, TRUE, "TileBackwards");
|
---|
[133] | 5382 | if (fAutoTile)
|
---|
| 5383 | TileChildren(hwnd, TRUE);
|
---|
| 5384 | break;
|
---|
[2] | 5385 |
|
---|
[133] | 5386 | case IDM_NEXTWINDOW:
|
---|
| 5387 | case IDM_PREVWINDOW:
|
---|
[551] | 5388 | NextChild(hwnd, (SHORT1FROMMP(mp1) == IDM_PREVWINDOW));
|
---|
[133] | 5389 | break;
|
---|
[2] | 5390 |
|
---|
[133] | 5391 | case IDM_CASCADE:
|
---|
| 5392 | CascadeChildren(hwnd);
|
---|
| 5393 | break;
|
---|
[2] | 5394 |
|
---|
[133] | 5395 | case IDM_TILE:
|
---|
| 5396 | TileChildren(hwnd, TRUE);
|
---|
| 5397 | break;
|
---|
[2] | 5398 |
|
---|
[133] | 5399 | case IDM_RESTORE:
|
---|
[551] | 5400 | MinResChildren(hwnd, SWP_RESTORE);
|
---|
[133] | 5401 | break;
|
---|
[2] | 5402 |
|
---|
[133] | 5403 | case IDM_MINIMIZE:
|
---|
[551] | 5404 | MinResChildren(hwnd, SWP_MINIMIZE);
|
---|
[133] | 5405 | break;
|
---|
[2] | 5406 |
|
---|
[133] | 5407 | case IDM_ARRANGEICONS:
|
---|
| 5408 | ArrangeIcons(hwnd);
|
---|
| 5409 | break;
|
---|
[2] | 5410 |
|
---|
[133] | 5411 | case IDM_INIVIEWER:
|
---|
| 5412 | StartIniEditor(hwnd, NULL, 4);
|
---|
| 5413 | break;
|
---|
[2] | 5414 |
|
---|
[133] | 5415 | case IDM_EDITASSOC:
|
---|
| 5416 | EditAssociations(hwnd);
|
---|
| 5417 | break;
|
---|
[2] | 5418 |
|
---|
[133] | 5419 | case IDM_EDITCOMMANDS:
|
---|
| 5420 | EditCommands(hwnd);
|
---|
[551] | 5421 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
---|
[133] | 5422 | break;
|
---|
[2] | 5423 |
|
---|
[133] | 5424 | default:
|
---|
[551] | 5425 | if (!SwitchCommand((HWND) WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5426 | SHORT1FROMMP(mp1))) {
|
---|
[133] | 5427 | if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
|
---|
[1077] | 5428 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
|
---|
[2] | 5429 |
|
---|
[1077] | 5430 | INT x;
|
---|
| 5431 | HWND hwndCnr;
|
---|
[2] | 5432 |
|
---|
[1077] | 5433 | if (!cmdloaded)
|
---|
| 5434 | load_commands();
|
---|
| 5435 | hwndCnr = TopWindow(hwnd, (HWND) 0);
|
---|
| 5436 | hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT),
|
---|
| 5437 | UM_CONTAINERHWND, MPVOID, MPVOID);
|
---|
| 5438 | if (!hwndCnr) {
|
---|
| 5439 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT);
|
---|
| 5440 | break;
|
---|
| 5441 | }
|
---|
| 5442 | x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
|
---|
| 5443 | if (x >= 0) {
|
---|
| 5444 | x++;
|
---|
| 5445 | RunCommand(hwndCnr, x);
|
---|
| 5446 | if (fUnHilite) {
|
---|
[2] | 5447 |
|
---|
[1077] | 5448 | PCNRITEM pci;
|
---|
| 5449 | DIRCNRDATA *dcd = NULL;
|
---|
[2] | 5450 |
|
---|
[1077] | 5451 | // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR?
|
---|
| 5452 | if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR)
|
---|
| 5453 | dcd = INSTDATA(hwndCnr);
|
---|
| 5454 | pci = (PCNRITEM) WinSendMsg(hwndCnr,
|
---|
| 5455 | CM_QUERYRECORDEMPHASIS,
|
---|
| 5456 | MPFROMLONG(CMA_FIRST),
|
---|
| 5457 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 5458 | if (pci && (INT) pci != -1 &&
|
---|
| 5459 | (pci->rc.flRecordAttr & CRA_SELECTED))
|
---|
| 5460 | {
|
---|
| 5461 | UnHilite(hwnd,
|
---|
| 5462 | TRUE,
|
---|
| 5463 | dcd ? &dcd->lastselection : NULL,
|
---|
| 5464 | dcd ? dcd ->ulItemsToUnHilite : 0);
|
---|
| 5465 | }
|
---|
| 5466 | }
|
---|
| 5467 | }
|
---|
[133] | 5468 | }
|
---|
| 5469 | else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART &&
|
---|
[1131] | 5470 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 51) {
|
---|
[1077] | 5471 | if (!qtloaded)
|
---|
| 5472 | load_quicktools();
|
---|
[1131] | 5473 | if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]) {
|
---|
[1077] | 5474 | if (fToolsChanged)
|
---|
| 5475 | save_tools(NULL);
|
---|
[1131] | 5476 | if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]))
|
---|
[1077] | 5477 | load_tools(NULL);
|
---|
| 5478 | else {
|
---|
[1125] | 5479 | strcpy(lasttoolbar,
|
---|
[1131] | 5480 | quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]);
|
---|
[1125] | 5481 | PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar);
|
---|
[1077] | 5482 | }
|
---|
[1125] | 5483 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
---|
[1077] | 5484 | }
|
---|
[133] | 5485 | }
|
---|
[551] | 5486 | else {
|
---|
[2] | 5487 |
|
---|
[1077] | 5488 | HWND hwndActive;
|
---|
[2] | 5489 |
|
---|
[1077] | 5490 | hwndActive = TopWindow(hwnd, (HWND) 0);
|
---|
| 5491 | if (hwndActive)
|
---|
| 5492 | PostMsg(WinWindowFromID(hwndActive, FID_CLIENT),
|
---|
| 5493 | WM_COMMAND, mp1, mp2);
|
---|
[2] | 5494 | }
|
---|
[133] | 5495 | }
|
---|
[930] | 5496 | break; // default
|
---|
[824] | 5497 | } // switch mp1
|
---|
[2] | 5498 | return 0;
|
---|
| 5499 | }
|
---|
| 5500 |
|
---|
[551] | 5501 | static MRESULT EXPENTRY MainWMOnce(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
[1077] | 5502 | MPARAM mp2)
|
---|
[133] | 5503 | {
|
---|
[376] | 5504 | TID tid;
|
---|
| 5505 | SWP swp;
|
---|
| 5506 | PFNWP oldproc;
|
---|
| 5507 | HWND hwndTmp;
|
---|
| 5508 | HWND hwndFrame;
|
---|
| 5509 | HWND hwndSysMenu, hwndSysSubMenu, hwndMenu;
|
---|
| 5510 | USHORT idSysMenu;
|
---|
| 5511 | MENUITEM mi, mit;
|
---|
| 5512 | ULONG size;
|
---|
| 5513 | BOOL temp = FALSE;
|
---|
| 5514 |
|
---|
| 5515 | switch (msg) {
|
---|
[133] | 5516 | case WM_CREATE:
|
---|
[551] | 5517 | WinQueryWindowProcess(hwnd, &mypid, &tid);
|
---|
[133] | 5518 | hwndMain = hwnd;
|
---|
| 5519 | WinSetWindowUShort(hwnd, QWL_USER + 8, 0);
|
---|
| 5520 | WinSetWindowUShort(hwnd, QWL_USER + 10, 0);
|
---|
| 5521 | WinSetWindowUShort(hwnd, QWL_USER + 12, 0);
|
---|
| 5522 | WinSetWindowUShort(hwnd, QWL_USER + 16, 0);
|
---|
[551] | 5523 | if (_beginthread(MakeMainObjWin, NULL, 245760, MPVOID) == -1) {
|
---|
| 5524 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
[1077] | 5525 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
[551] | 5526 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
[133] | 5527 | return 0;
|
---|
| 5528 | }
|
---|
| 5529 | else
|
---|
[771] | 5530 | DosSleep(32);//05 Aug 07 GKY 64
|
---|
[133] | 5531 |
|
---|
[376] | 5532 | hwndFrame = WinQueryWindow(hwnd, QW_PARENT);
|
---|
[133] | 5533 |
|
---|
[376] | 5534 | /*
|
---|
| 5535 | * create frame children (not client children, frame children)
|
---|
| 5536 | */
|
---|
[771] | 5537 | DosSleep(1);
|
---|
[376] | 5538 | WinQueryWindowPos(hwndFrame, &swp);
|
---|
[551] | 5539 | oldproc = WinSubclassWindow(hwndFrame, MainFrameWndProc);
|
---|
| 5540 | WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
|
---|
[376] | 5541 | CommonCreateMainChildren(hwnd, &swp);
|
---|
| 5542 |
|
---|
| 5543 | if (!WinCreateWindow(hwndFrame,
|
---|
[1077] | 5544 | WC_BUTTON,
|
---|
| 5545 | "I",
|
---|
| 5546 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS,
|
---|
| 5547 | ((swp.cx -
|
---|
| 5548 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5549 | SV_CXMINMAXBUTTON)) -
|
---|
| 5550 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5551 | SV_CXMINMAXBUTTON) / 2) -
|
---|
| 5552 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5553 | SV_CXSIZEBORDER),
|
---|
| 5554 | (swp.cy - WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5555 | SV_CYMINMAXBUTTON)) -
|
---|
| 5556 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5557 | SV_CYSIZEBORDER),
|
---|
| 5558 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5559 | SV_CXMINMAXBUTTON) / 2,
|
---|
| 5560 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5561 | SV_CYMINMAXBUTTON),
|
---|
| 5562 | hwnd, HWND_TOP, IDM_IDEALSIZE, NULL, NULL)) {
|
---|
[551] | 5563 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
[376] | 5564 | }
|
---|
| 5565 | else {
|
---|
[551] | 5566 | WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_IDEALSIZE),
|
---|
[1077] | 5567 | IdealButtonProc);
|
---|
[376] | 5568 | SetPresParams(WinWindowFromID(hwndFrame,
|
---|
[1077] | 5569 | IDM_IDEALSIZE),
|
---|
| 5570 | NULL, NULL, NULL, GetPString(IDS_10SYSTEMVIOTEXT));
|
---|
[376] | 5571 | }
|
---|
[2] | 5572 |
|
---|
[376] | 5573 | hwndTmp = WinCreateWindow(hwndFrame,
|
---|
[1077] | 5574 | WC_BUTTON,
|
---|
| 5575 | "#1019",
|
---|
| 5576 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
|
---|
| 5577 | BS_BITMAP,
|
---|
| 5578 | swp.cx - 46,
|
---|
| 5579 | swp.y + 2,
|
---|
| 5580 | 24,
|
---|
| 5581 | 22, hwnd, HWND_TOP, IDM_OPENWALK, NULL, NULL);
|
---|
[376] | 5582 | if (!hwndTmp)
|
---|
[551] | 5583 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
[2] | 5584 |
|
---|
[376] | 5585 | hwndTmp = WinCreateWindow(hwndFrame,
|
---|
[1077] | 5586 | WC_BUTTON,
|
---|
| 5587 | "#3062",
|
---|
| 5588 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
|
---|
| 5589 | BS_BITMAP,
|
---|
| 5590 | swp.cx - 22,
|
---|
| 5591 | swp.y + 2,
|
---|
| 5592 | 24,
|
---|
| 5593 | 22, hwnd, HWND_TOP, IDM_USERLIST, NULL, NULL);
|
---|
[376] | 5594 | if (!hwndTmp)
|
---|
[551] | 5595 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
[376] | 5596 |
|
---|
| 5597 | hwndUserlist = WinCreateWindow(hwndFrame,
|
---|
[1077] | 5598 | WC_COMBOBOX,
|
---|
| 5599 | (PSZ) NULL,
|
---|
| 5600 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
| 5601 | LS_HORZSCROLL,
|
---|
| 5602 | (swp.x +
|
---|
| 5603 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5604 | SV_CXSIZEBORDER) + 48L),
|
---|
| 5605 | (swp.cy -
|
---|
| 5606 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5607 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5608 | ((swp.cx -
|
---|
| 5609 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5610 | SV_CXSIZEBORDER) *
|
---|
| 5611 | 2)) - 64L), 60L, hwndFrame, HWND_TOP,
|
---|
| 5612 | MAIN_USERLIST, NULL, NULL);
|
---|
[376] | 5613 | if (!hwndUserlist)
|
---|
[551] | 5614 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
[376] | 5615 | hwndCmdlist = WinCreateWindow(hwndFrame,
|
---|
[1077] | 5616 | WC_COMBOBOX,
|
---|
| 5617 | (PSZ) NULL,
|
---|
| 5618 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
| 5619 | LS_HORZSCROLL,
|
---|
| 5620 | (swp.x +
|
---|
| 5621 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5622 | SV_CXSIZEBORDER) + 48L),
|
---|
| 5623 | (swp.cy -
|
---|
| 5624 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5625 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5626 | ((swp.cx -
|
---|
| 5627 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5628 | SV_CXSIZEBORDER) * 2)) -
|
---|
| 5629 | 64L), 60L, hwndFrame, HWND_TOP,
|
---|
| 5630 | MAIN_CMDLIST, NULL, NULL);
|
---|
[376] | 5631 | if (!hwndCmdlist)
|
---|
[551] | 5632 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
| 5633 | WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));
|
---|
[376] | 5634 | hwndStatelist = WinCreateWindow(hwndFrame,
|
---|
[1077] | 5635 | WC_COMBOBOX,
|
---|
| 5636 | (PSZ) NULL,
|
---|
| 5637 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
| 5638 | LS_HORZSCROLL,
|
---|
| 5639 | (swp.x +
|
---|
| 5640 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5641 | SV_CXSIZEBORDER) + 48L),
|
---|
| 5642 | (swp.cy -
|
---|
| 5643 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5644 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5645 | ((swp.cx -
|
---|
| 5646 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5647 | SV_CXSIZEBORDER) *
|
---|
| 5648 | 2)) - 64L), 60L, hwndFrame, HWND_TOP,
|
---|
| 5649 | MAIN_SETUPLIST, NULL, NULL);
|
---|
[376] | 5650 | if (!hwndStatelist)
|
---|
[551] | 5651 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
[824] | 5652 |
|
---|
[376] | 5653 | hwndDrivelist = WinCreateWindow(hwndFrame,
|
---|
[1077] | 5654 | WC_COMBOBOX,
|
---|
| 5655 | (PSZ) NULL,
|
---|
| 5656 | WS_VISIBLE | CBS_DROPDOWN,
|
---|
| 5657 | (swp.x +
|
---|
| 5658 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5659 | SV_CXSIZEBORDER)),
|
---|
| 5660 | (swp.cy -
|
---|
| 5661 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5662 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5663 | 48L,
|
---|
| 5664 | 60L,
|
---|
| 5665 | hwndFrame,
|
---|
| 5666 | HWND_TOP, MAIN_DRIVELIST, NULL, NULL);
|
---|
[376] | 5667 | if (!hwndDrivelist)
|
---|
[551] | 5668 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
[376] | 5669 | SetPresParams(hwndDrivelist,
|
---|
[1077] | 5670 | NULL, NULL, NULL, GetPString(IDS_10SYSTEMMONOTEXT));
|
---|
[376] | 5671 | hwndButtonlist = WinCreateWindow(hwndFrame,
|
---|
[1077] | 5672 | WC_COMBOBOX,
|
---|
| 5673 | (PSZ) NULL,
|
---|
| 5674 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
| 5675 | LS_HORZSCROLL,
|
---|
| 5676 | (swp.cx -
|
---|
| 5677 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5678 | SV_CXSIZEBORDER)) -
|
---|
| 5679 | 164L,
|
---|
| 5680 | (swp.cy -
|
---|
| 5681 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5682 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5683 | 164L, 60L, hwndFrame, HWND_TOP,
|
---|
| 5684 | MAIN_BUTTONLIST, NULL, NULL);
|
---|
[376] | 5685 | if (!hwndButtonlist)
|
---|
[551] | 5686 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
[376] | 5687 | WinSendMsg(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
---|
[1077] | 5688 | EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
|
---|
[376] | 5689 | WinSendMsg(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
---|
[1077] | 5690 | EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID);
|
---|
[376] | 5691 | WinSendMsg(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
[1077] | 5692 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
---|
[376] | 5693 | WinSendMsg(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
---|
[1077] | 5694 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
---|
[376] | 5695 | WinSendMsg(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
---|
[1077] | 5696 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
---|
[376] | 5697 |
|
---|
| 5698 | oldproc = WinSubclassWindow(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
---|
[1077] | 5699 | DropDownListProc);
|
---|
[376] | 5700 | WinSetWindowPtr(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
---|
[1077] | 5701 | QWL_USER, (PVOID) oldproc);
|
---|
[376] | 5702 | oldproc = WinSubclassWindow(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
---|
[1077] | 5703 | DropDownListProc);
|
---|
[376] | 5704 | WinSetWindowPtr(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
---|
[1077] | 5705 | QWL_USER, (PVOID) oldproc);
|
---|
[376] | 5706 | oldproc = WinSubclassWindow(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
---|
[1077] | 5707 | DropDownListProc);
|
---|
[376] | 5708 | WinSetWindowPtr(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
---|
[1077] | 5709 | QWL_USER, (PVOID) oldproc);
|
---|
[376] | 5710 | oldproc = WinSubclassWindow(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
---|
[1077] | 5711 | DropDownListProc);
|
---|
[376] | 5712 | WinSetWindowPtr(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
---|
[1077] | 5713 | QWL_USER, (PVOID) oldproc);
|
---|
[376] | 5714 | oldproc = WinSubclassWindow(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
[1077] | 5715 | DropDownListProc);
|
---|
[376] | 5716 | WinSetWindowPtr(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
[1077] | 5717 | QWL_USER, (PVOID) oldproc);
|
---|
[551] | 5718 | oldproc = WinSubclassWindow(hwndUserlist, DropDownListProc);
|
---|
| 5719 | WinSetWindowPtr(hwndUserlist, QWL_USER, (PVOID) oldproc);
|
---|
| 5720 | oldproc = WinSubclassWindow(hwndCmdlist, DropDownListProc);
|
---|
| 5721 | WinSetWindowPtr(hwndCmdlist, QWL_USER, (PVOID) oldproc);
|
---|
| 5722 | oldproc = WinSubclassWindow(hwndStatelist, DropDownListProc);
|
---|
| 5723 | WinSetWindowPtr(hwndStatelist, QWL_USER, (PVOID) oldproc);
|
---|
| 5724 | oldproc = WinSubclassWindow(hwndDrivelist, DropDownListProc);
|
---|
[376] | 5725 | WinSetWindowPtr(hwndDrivelist, QWL_USER, (PVOID) oldproc);
|
---|
[551] | 5726 | oldproc = WinSubclassWindow(hwndButtonlist, DropDownListProc);
|
---|
| 5727 | WinSetWindowPtr(hwndButtonlist, QWL_USER, (PVOID) oldproc);
|
---|
| 5728 | oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_USERLIST),
|
---|
[1077] | 5729 | ChildFrameButtonProc);
|
---|
[551] | 5730 | WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_USERLIST),
|
---|
[1077] | 5731 | QWL_USER, (PVOID) oldproc);
|
---|
[551] | 5732 | oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_OPENWALK),
|
---|
[1077] | 5733 | ChildFrameButtonProc);
|
---|
[551] | 5734 | WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_OPENWALK),
|
---|
[1077] | 5735 | QWL_USER, (PVOID) oldproc);
|
---|
[551] | 5736 | hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
|
---|
| 5737 | WinSendMsg(hwnd, UM_ADDTOMENU, MPVOID, MPVOID);
|
---|
[376] | 5738 | SetToggleChecks(hwndMenu);
|
---|
[1027] | 5739 | CfgMenuInit(hwndMenu, FALSE); // 14 Feb 08 SHL
|
---|
[933] | 5740 | SetConditionalCascade(hwndMenu, IDM_COMMANDLINESUBMENU, IDM_COMMANDLINE);
|
---|
[551] | 5741 | SetConditionalCascade(hwndMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
|
---|
| 5742 | SetConditionalCascade(hwndMenu, IDM_AUTOVIEWSUBMENU, IDM_AUTOVIEW);
|
---|
| 5743 | SetConditionalCascade(hwndMenu, IDM_TILEMENU, IDM_TILE);
|
---|
| 5744 | WinSetWindowULong(hwnd, QWL_USER, hwndMenu);
|
---|
[376] | 5745 | memset(&mi, 0, sizeof(mi));
|
---|
| 5746 | memset(&mit, 0, sizeof(mit));
|
---|
[551] | 5747 | hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU);
|
---|
[376] | 5748 | idSysMenu = SHORT1FROMMR(WinSendMsg(hwndSysMenu,
|
---|
[1077] | 5749 | MM_ITEMIDFROMPOSITION,
|
---|
| 5750 | MPVOID, MPVOID));
|
---|
[376] | 5751 | WinSendMsg(hwndSysMenu,
|
---|
[1077] | 5752 | MM_QUERYITEM, MPFROM2SHORT(idSysMenu, 0), MPFROMP(&mit));
|
---|
[376] | 5753 | hwndSysSubMenu = mit.hwndSubMenu;
|
---|
| 5754 | mi.iPosition = MIT_END;
|
---|
| 5755 | mi.afStyle = MIS_SEPARATOR;
|
---|
[551] | 5756 | mi.id = (USHORT) - 1;
|
---|
| 5757 | WinSendMsg(hwndSysSubMenu, MM_INSERTITEM, MPFROMP(&mi), MPFROMP(NULL));
|
---|
[376] | 5758 | mi.afStyle = MIS_TEXT;
|
---|
| 5759 | mi.id = IDM_IDEALSIZE;
|
---|
| 5760 | WinSendMsg(hwndSysSubMenu,
|
---|
[1077] | 5761 | MM_INSERTITEM,
|
---|
| 5762 | MPFROMP(&mi), MPFROMP(GetPString(IDS_IDEALMENUTEXT)));
|
---|
[376] | 5763 | mi.afStyle = MIS_TEXT;
|
---|
| 5764 | mi.id = IDM_HIDEMENU;
|
---|
| 5765 | WinSendMsg(hwndSysSubMenu,
|
---|
[1077] | 5766 | MM_INSERTITEM,
|
---|
| 5767 | MPFROMP(&mi), MPFROMP(GetPString(IDS_HIDEMENUTEXT)));
|
---|
[376] | 5768 | SetSysMenu(hwndSysMenu);
|
---|
| 5769 |
|
---|
| 5770 | size = sizeof(BOOL);
|
---|
| 5771 | if (PrfQueryProfileData(fmprof,
|
---|
[1077] | 5772 | FM3Str,
|
---|
| 5773 | "MenuInvisible", &temp, &size) && size && temp)
|
---|
[551] | 5774 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
|
---|
[376] | 5775 | size = sizeof(BOOL);
|
---|
| 5776 | if (PrfQueryProfileData(fmprof,
|
---|
[1077] | 5777 | FM3Str, "FreeTree", &temp, &size) && size && temp)
|
---|
[551] | 5778 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID);
|
---|
[376] | 5779 | size = sizeof(BOOL);
|
---|
| 5780 | if (PrfQueryProfileData(fmprof,
|
---|
[1077] | 5781 | FM3Str,
|
---|
| 5782 | "AutoTile", &temp, &size) && size && !temp)
|
---|
[551] | 5783 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID);
|
---|
[376] | 5784 | size = sizeof(BOOL);
|
---|
| 5785 | if (PrfQueryProfileData(fmprof,
|
---|
[1077] | 5786 | FM3Str, "Toolbar", &temp, &size) && size && !temp)
|
---|
[551] | 5787 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
|
---|
[2] | 5788 |
|
---|
[551] | 5789 | WinSetWindowText(WinWindowFromID(hwndFrame, FID_TITLEBAR), "FM/2");
|
---|
| 5790 | FixSwitchList(hwndFrame, NULL);
|
---|
[930] | 5791 | break; // WM_CREATE
|
---|
[2] | 5792 |
|
---|
[133] | 5793 | case UM_SETUP:
|
---|
| 5794 | /*
|
---|
| 5795 | * start up some initial children
|
---|
| 5796 | */
|
---|
[551] | 5797 | WinShowWindow(WinQueryWindow(hwnd, QW_PARENT), TRUE);
|
---|
| 5798 | PostMsg(MainObjectHwnd, UM_SETUP2, mp1, mp2);
|
---|
[133] | 5799 | return 0;
|
---|
[2] | 5800 |
|
---|
[133] | 5801 | case UM_SETUP2:
|
---|
| 5802 | {
|
---|
| 5803 | SWP swp;
|
---|
| 5804 | ULONG size = sizeof(SWP);
|
---|
[2] | 5805 |
|
---|
[133] | 5806 | WinQueryWindowPos(hwnd, &swp);
|
---|
[947] | 5807 | hwndTree = StartTreeCnr(hwnd, 4);
|
---|
[133] | 5808 | if (!hwndTree)
|
---|
[1077] | 5809 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
---|
[551] | 5810 | else {
|
---|
[1077] | 5811 | if (!fSaveState ||
|
---|
| 5812 | !PrfQueryProfileData(fmprof,
|
---|
| 5813 | FM3Str,
|
---|
| 5814 | "LastTreePos",
|
---|
| 5815 | &swp, &size) || size != sizeof(SWP)) {
|
---|
[2] | 5816 |
|
---|
[1077] | 5817 | INT ratio, height = 0;
|
---|
[2] | 5818 |
|
---|
[1077] | 5819 | if (!fNoTreeGap)
|
---|
| 5820 | height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
| 5821 | size = sizeof(ratio);
|
---|
| 5822 | if (!PrfQueryProfileData(fmprof,
|
---|
| 5823 | FM3Str,
|
---|
| 5824 | "TreeWindowRatio",
|
---|
| 5825 | (PVOID) & ratio,
|
---|
| 5826 | &size) || size < sizeof(ratio))
|
---|
| 5827 | ratio = 400;
|
---|
| 5828 | WinSetWindowPos(hwndTree,
|
---|
| 5829 | HWND_TOP,
|
---|
| 5830 | 0,
|
---|
| 5831 | height,
|
---|
| 5832 | (swp.cx * 100) / ratio,
|
---|
| 5833 | swp.cy - height,
|
---|
| 5834 | SWP_SHOW | SWP_SIZE | SWP_MOVE |
|
---|
| 5835 | SWP_ACTIVATE | SWP_ZORDER);
|
---|
| 5836 | }
|
---|
| 5837 | else
|
---|
| 5838 | WinSetWindowPos(hwndTree,
|
---|
| 5839 | HWND_TOP,
|
---|
| 5840 | swp.x,
|
---|
| 5841 | swp.y,
|
---|
| 5842 | swp.cx,
|
---|
| 5843 | swp.cy,
|
---|
| 5844 | swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW |
|
---|
| 5845 | SWP_ZORDER | SWP_ACTIVATE);
|
---|
[133] | 5846 | }
|
---|
[1125] | 5847 | // ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 5848 | // MAIN_TOOLS));
|
---|
[133] | 5849 | }
|
---|
[551] | 5850 | PostMsg(MainObjectHwnd, UM_SETUP3, mp1, mp2);
|
---|
[133] | 5851 | return 0;
|
---|
[2] | 5852 |
|
---|
[133] | 5853 | case UM_SETUP3:
|
---|
| 5854 | /* start remaining child windows */
|
---|
[1025] | 5855 | if (!fNoSaveState && fSaveState) {
|
---|
[1046] | 5856 | PSZ pszStatename = GetPString(IDS_SHUTDOWNSTATE);
|
---|
| 5857 | PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszStatename), MPVOID);
|
---|
| 5858 | if (!add_setup(pszStatename))
|
---|
[1125] | 5859 | save_setups();
|
---|
| 5860 | } else {
|
---|
| 5861 | load_tools(NULL);
|
---|
| 5862 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
---|
[1025] | 5863 | }
|
---|
[551] | 5864 | PostMsg(MainObjectHwnd, UM_SETUP4, mp1, mp2);
|
---|
[133] | 5865 | return 0;
|
---|
[2] | 5866 |
|
---|
[133] | 5867 | case UM_SETUP4:
|
---|
| 5868 | {
|
---|
| 5869 | INT argc = (INT) mp1, x;
|
---|
| 5870 | CHAR **argv = (CHAR **) mp2;
|
---|
[2] | 5871 |
|
---|
[376] | 5872 | for (x = 1; x < argc; x++) {
|
---|
[1077] | 5873 | if (*argv[x] == '/' || *argv[x] == ';')
|
---|
| 5874 | continue;
|
---|
| 5875 | if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE))
|
---|
| 5876 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]);
|
---|
[2] | 5877 | }
|
---|
[133] | 5878 | }
|
---|
[551] | 5879 | PostMsg(MainObjectHwnd, UM_SETUP5, MPVOID, MPVOID);
|
---|
[133] | 5880 | return 0;
|
---|
[2] | 5881 |
|
---|
[133] | 5882 | case UM_SETUP5:
|
---|
[1033] | 5883 | // if (fAutoTile)
|
---|
| 5884 | // TileChildren(hwnd, TRUE);
|
---|
[551] | 5885 | PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
---|
| 5886 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
---|
| 5887 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
---|
| 5888 | PostMsg(hwnd, UM_FILLBUTTONLIST, MPVOID, MPVOID);
|
---|
[133] | 5889 | {
|
---|
| 5890 | HWND hwndActive;
|
---|
[2] | 5891 |
|
---|
[133] | 5892 | hwndActive = TopWindow(hwnd, hwndTree);
|
---|
| 5893 | if (hwndActive)
|
---|
[1077] | 5894 | WinSetWindowPos(hwndActive, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
|
---|
[133] | 5895 | }
|
---|
[376] | 5896 | if (fStartMinimized || fReminimize)
|
---|
[551] | 5897 | PostMsg(hwndTree, UM_MINIMIZE, MPVOID, MPVOID);
|
---|
[133] | 5898 | else if (fStartMaximized)
|
---|
[551] | 5899 | PostMsg(hwndTree, UM_MAXIMIZE, MPVOID, MPVOID);
|
---|
[133] | 5900 | fRunning = TRUE;
|
---|
[917] | 5901 | if (fWantFirstTimeInit) {
|
---|
| 5902 | fWantFirstTimeInit = FALSE;
|
---|
| 5903 | PostMsg(hwnd, WM_COMMAND, MPFROMLONG(IDM_QUICKSETTINGS), MPVOID);
|
---|
| 5904 | }
|
---|
[133] | 5905 | return 0;
|
---|
[2] | 5906 | }
|
---|
| 5907 |
|
---|
[133] | 5908 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 5909 | }
|
---|
| 5910 |
|
---|
[133] | 5911 | MRESULT EXPENTRY MainWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 5912 | {
|
---|
[551] | 5913 | switch (msg) {
|
---|
[133] | 5914 | case WM_CREATE:
|
---|
[1077] | 5915 | # ifdef FORTIFY
|
---|
| 5916 | Fortify_EnterScope();
|
---|
| 5917 | # endif
|
---|
[133] | 5918 | case UM_SETUP:
|
---|
| 5919 | case UM_SETUP2:
|
---|
| 5920 | case UM_SETUP3:
|
---|
| 5921 | case UM_SETUP4:
|
---|
| 5922 | case UM_SETUP5:
|
---|
| 5923 | return MainWMOnce(hwnd, msg, mp1, mp2);
|
---|
[2] | 5924 |
|
---|
[133] | 5925 | case WM_CONTROLPOINTER:
|
---|
| 5926 | if (!fNoFinger &&
|
---|
[1077] | 5927 | (SHORT1FROMMP(mp1) == IDM_OPENWALK ||
|
---|
| 5928 | SHORT1FROMMP(mp1) == IDM_USERLIST))
|
---|
[133] | 5929 | return MRFROMLONG(hptrFinger);
|
---|
| 5930 | break;
|
---|
[2] | 5931 |
|
---|
[133] | 5932 | case UM_LOADFILE:
|
---|
| 5933 | case UM_THREADUSE:
|
---|
[260] | 5934 | case UM_BUILDDRIVEBAR:
|
---|
[133] | 5935 | return CommonMainWndProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 5936 |
|
---|
[133] | 5937 | case WM_BUTTON1UP:
|
---|
| 5938 | case WM_BUTTON2UP:
|
---|
| 5939 | case WM_BUTTON3UP:
|
---|
| 5940 | case WM_MOUSEMOVE:
|
---|
| 5941 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 5942 | break;
|
---|
[2] | 5943 |
|
---|
[133] | 5944 | case WM_CHAR:
|
---|
| 5945 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 5946 | break;
|
---|
[2] | 5947 |
|
---|
[133] | 5948 | case WM_MENUEND:
|
---|
[551] | 5949 | if ((HWND) mp2 == MainPopupMenu) {
|
---|
[133] | 5950 | WinDestroyWindow(MainPopupMenu);
|
---|
[551] | 5951 | MainPopupMenu = (HWND) 0;
|
---|
[133] | 5952 | }
|
---|
| 5953 | break;
|
---|
[2] | 5954 |
|
---|
[133] | 5955 | case UM_CONTEXTMENU:
|
---|
| 5956 | case WM_CONTEXTMENU:
|
---|
[875] | 5957 | if (CheckMenu(hwndMainMenu, &MainPopupMenu, MAIN_POPUP)) {
|
---|
[133] | 5958 | SetToggleChecks(MainPopupMenu);
|
---|
| 5959 | PopupMenu(hwnd, hwnd, MainPopupMenu);
|
---|
| 5960 | }
|
---|
| 5961 | if (msg == UM_CONTEXTMENU)
|
---|
| 5962 | return 0;
|
---|
| 5963 | return MRFROMSHORT(TRUE);
|
---|
[2] | 5964 |
|
---|
[133] | 5965 | case UM_SETUSERLISTNAME:
|
---|
[551] | 5966 | if (mp1) {
|
---|
[133] | 5967 | if (fUserComboBox)
|
---|
[1077] | 5968 | WinSetWindowText(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
---|
| 5969 | (CHAR *)mp1);
|
---|
[1009] | 5970 | if (add_udir(FALSE, (CHAR *)mp1)) {
|
---|
[1077] | 5971 | if (fUserComboBox && fAutoAddDirs) {
|
---|
| 5972 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
---|
| 5973 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
| 5974 | MPFROMP((CHAR *)mp1));
|
---|
| 5975 | }
|
---|
[133] | 5976 | }
|
---|
| 5977 | }
|
---|
| 5978 | return 0;
|
---|
[2] | 5979 |
|
---|
[133] | 5980 | case UM_ARRANGEICONS:
|
---|
| 5981 | ArrangeIcons(hwnd);
|
---|
| 5982 | return 0;
|
---|
[2] | 5983 |
|
---|
[133] | 5984 | case WM_CHORD:
|
---|
[551] | 5985 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
---|
[133] | 5986 | break;
|
---|
[2] | 5987 |
|
---|
[133] | 5988 | case WM_SETFOCUS:
|
---|
| 5989 | if (mp2)
|
---|
[551] | 5990 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
[133] | 5991 | break;
|
---|
[2] | 5992 |
|
---|
[133] | 5993 | case UM_FOCUSME:
|
---|
[551] | 5994 | WinSetFocus(hwndTree, TRUE);
|
---|
[133] | 5995 | return 0;
|
---|
[2] | 5996 |
|
---|
[133] | 5997 | case UM_RESCAN:
|
---|
| 5998 | TileChildren(hwnd, TRUE);
|
---|
| 5999 | return 0;
|
---|
[2] | 6000 |
|
---|
[133] | 6001 | case WM_SAVEAPPLICATION:
|
---|
| 6002 | {
|
---|
| 6003 | SWP swp;
|
---|
[2] | 6004 |
|
---|
[133] | 6005 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
---|
[551] | 6006 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) {
|
---|
[1077] | 6007 | WinStoreWindowPos(FM2Str,
|
---|
| 6008 | "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT));
|
---|
| 6009 | if (!fNoSaveState && fSaveState)
|
---|
| 6010 | SaveDirCnrState(hwnd, GetPString(IDS_SHUTDOWNSTATE));
|
---|
[133] | 6011 | }
|
---|
| 6012 | }
|
---|
| 6013 | break;
|
---|
[2] | 6014 |
|
---|
[133] | 6015 | case MM_PORTHOLEINIT:
|
---|
[551] | 6016 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 6017 | case 0:
|
---|
| 6018 | case 1:
|
---|
| 6019 | {
|
---|
[1077] | 6020 | HWND hwndCurrent;
|
---|
| 6021 | ULONG wmsg;
|
---|
[2] | 6022 |
|
---|
[1077] | 6023 | wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
|
---|
| 6024 | hwndCurrent = TopWindow(hwnd, (HWND) 0);
|
---|
| 6025 | PortholeInit((HWND) WinSendMsg(WinWindowFromID(hwndCurrent,
|
---|
| 6026 | FID_CLIENT), wmsg,
|
---|
| 6027 | MPVOID, MPVOID), mp1, mp2);
|
---|
[133] | 6028 | }
|
---|
| 6029 | break;
|
---|
| 6030 | }
|
---|
| 6031 | break;
|
---|
[2] | 6032 |
|
---|
[133] | 6033 | case WM_INITMENU:
|
---|
[551] | 6034 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 6035 | case IDM_CONFIGMENU:
|
---|
[551] | 6036 | SetToggleChecks((HWND) WinQueryWindowULong(hwnd, QWL_USER));
|
---|
[133] | 6037 | break;
|
---|
[2] | 6038 |
|
---|
[133] | 6039 | case IDM_WINDOWSMENU:
|
---|
| 6040 | /*
|
---|
| 6041 | * add child windows of client
|
---|
| 6042 | * and switchlist entries to end of pulldown menu
|
---|
| 6043 | */
|
---|
| 6044 | {
|
---|
[1077] | 6045 | HWND hwndMenu, hwndSubMenu;
|
---|
| 6046 | MENUITEM mi;
|
---|
[2] | 6047 |
|
---|
[1077] | 6048 | hwndMenu = WinQueryWindowULong(hwnd, QWL_USER);
|
---|
| 6049 | memset(&mi, 0, sizeof(mi));
|
---|
| 6050 | mi.iPosition = MIT_END;
|
---|
| 6051 | mi.afStyle = MIS_TEXT;
|
---|
| 6052 | if (!WinSendMsg(hwndMenu, MM_QUERYITEM,
|
---|
| 6053 | MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))
|
---|
| 6054 | break;
|
---|
| 6055 | hwndSubMenu = mi.hwndSubMenu;
|
---|
| 6056 | SetupWinList(hwndSubMenu, hwnd, WinQueryWindow(hwnd, QW_PARENT));
|
---|
[133] | 6057 | }
|
---|
| 6058 | break;
|
---|
[2] | 6059 |
|
---|
[133] | 6060 | default:
|
---|
| 6061 | {
|
---|
[1077] | 6062 | HWND hwndCurrent;
|
---|
[2] | 6063 |
|
---|
[1077] | 6064 | hwndCurrent = TopWindow(hwnd, (HWND) 0);
|
---|
| 6065 | if (hwndCurrent)
|
---|
| 6066 | WinSendMsg(hwndCurrent, UM_INITMENU, mp1, mp2);
|
---|
[133] | 6067 | }
|
---|
| 6068 | break;
|
---|
| 6069 | }
|
---|
| 6070 | break;
|
---|
[2] | 6071 |
|
---|
[133] | 6072 | case UM_ADDTOMENU:
|
---|
[1009] | 6073 | AddToMenu((CHAR *)mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 6074 | FID_MENU));
|
---|
[133] | 6075 | return 0;
|
---|
[2] | 6076 |
|
---|
[133] | 6077 | case UM_FILLCMDLIST:
|
---|
| 6078 | WinSendMsg(hwndCmdlist, LM_DELETEALL, MPVOID, MPVOID);
|
---|
| 6079 | if (!cmdloaded)
|
---|
| 6080 | load_commands();
|
---|
[551] | 6081 | if (cmdhead) {
|
---|
[2] | 6082 |
|
---|
[133] | 6083 | LINKCMDS *info;
|
---|
[2] | 6084 |
|
---|
[133] | 6085 | info = cmdhead;
|
---|
[551] | 6086 | while (info) {
|
---|
[1077] | 6087 | WinSendMsg(hwndCmdlist, LM_INSERTITEM,
|
---|
| 6088 | MPFROM2SHORT(LIT_END, 0), MPFROMP(info->title));
|
---|
| 6089 | info = info->next;
|
---|
[133] | 6090 | }
|
---|
| 6091 | }
|
---|
| 6092 | return 0;
|
---|
[2] | 6093 |
|
---|
[133] | 6094 | case UM_FILLSETUPLIST:
|
---|
[787] | 6095 | fill_setups_list();
|
---|
[133] | 6096 | return 0;
|
---|
[2] | 6097 |
|
---|
[133] | 6098 | case UM_FILLBUTTONLIST:
|
---|
| 6099 | WinSendMsg(hwndButtonlist, LM_DELETEALL, MPVOID, MPVOID);
|
---|
[551] | 6100 | if (fUserComboBox) {
|
---|
[2] | 6101 |
|
---|
[133] | 6102 | BOOL foundit = FALSE, thisone;
|
---|
| 6103 | ULONG ulSearchCount;
|
---|
| 6104 | SHORT sSelect;
|
---|
[847] | 6105 | FILEFINDBUF3 findbuf;
|
---|
[133] | 6106 | HDIR hDir;
|
---|
| 6107 | CHAR *p;
|
---|
[2] | 6108 |
|
---|
[133] | 6109 | DosError(FERR_DISABLEHARDERR);
|
---|
| 6110 | hDir = HDIR_CREATE;
|
---|
[787] | 6111 | ulSearchCount = 1;
|
---|
[847] | 6112 | if (!DosFindFirst("*.TLS", &hDir, FILE_READONLY | FILE_ARCHIVED,
|
---|
[1077] | 6113 | &findbuf, sizeof(FILEFINDBUF3),
|
---|
| 6114 | &ulSearchCount, FIL_STANDARD)) {
|
---|
| 6115 | do {
|
---|
| 6116 | priority_bumped();
|
---|
| 6117 | if (!foundit) {
|
---|
| 6118 | thisone = FALSE;
|
---|
[1125] | 6119 | p = strrchr(lasttoolbar, '\\');
|
---|
[1077] | 6120 | if (!p)
|
---|
[1125] | 6121 | p = lasttoolbar;
|
---|
[1077] | 6122 | else
|
---|
| 6123 | p++;
|
---|
| 6124 | if (!stricmp(findbuf.achName, p))
|
---|
| 6125 | thisone = TRUE;
|
---|
| 6126 | }
|
---|
| 6127 | p = strrchr(findbuf.achName, '.');
|
---|
| 6128 | if (p)
|
---|
| 6129 | *p = 0;
|
---|
| 6130 | sSelect = (SHORT) WinSendMsg(hwndButtonlist, LM_INSERTITEM,
|
---|
| 6131 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
| 6132 | MPFROMP(findbuf.achName));
|
---|
| 6133 | if (!foundit && thisone && sSelect >= 0) {
|
---|
| 6134 | WinSendMsg(hwndButtonlist, LM_SELECTITEM,
|
---|
| 6135 | MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE));
|
---|
| 6136 | foundit = TRUE;
|
---|
| 6137 | }
|
---|
| 6138 | }
|
---|
| 6139 | while (!DosFindNext(hDir, &findbuf, sizeof(FILEFINDBUF3),
|
---|
| 6140 | &ulSearchCount));
|
---|
| 6141 | DosFindClose(hDir);
|
---|
| 6142 | priority_bumped();
|
---|
[133] | 6143 | }
|
---|
[1125] | 6144 | WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBARTEXT));
|
---|
[133] | 6145 | }
|
---|
| 6146 | return 0;
|
---|
[2] | 6147 |
|
---|
[133] | 6148 | case UM_FILLUSERLIST:
|
---|
| 6149 | WinSendMsg(hwndUserlist, LM_DELETEALL, MPVOID, MPVOID);
|
---|
[551] | 6150 | if (fUserComboBox) {
|
---|
[260] | 6151 | ULONG ulDriveNum;
|
---|
| 6152 | ULONG ulDriveMap;
|
---|
[133] | 6153 | ULONG ulSearchCount;
|
---|
[847] | 6154 | FILEFINDBUF3 findbuf;
|
---|
[133] | 6155 | HDIR hDir;
|
---|
| 6156 | APIRET rc;
|
---|
[260] | 6157 | LINKDIRS *info;
|
---|
| 6158 | LINKDIRS *temp;
|
---|
[2] | 6159 |
|
---|
[133] | 6160 | if (!loadedudirs)
|
---|
[1077] | 6161 | load_udirs();
|
---|
[133] | 6162 | DosError(FERR_DISABLEHARDERR);
|
---|
| 6163 | DosQCurDisk(&ulDriveNum, &ulDriveMap);
|
---|
| 6164 | info = udirhead;
|
---|
[551] | 6165 | while (info) {
|
---|
[1077] | 6166 | if (IsFullName(info->path) &&
|
---|
| 6167 | !(driveflags[toupper(*info->path) - 'A'] &
|
---|
| 6168 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
---|
| 6169 | DosError(FERR_DISABLEHARDERR);
|
---|
| 6170 | hDir = HDIR_CREATE;
|
---|
| 6171 | ulSearchCount = 1;
|
---|
| 6172 | if (!IsRoot(info->path))
|
---|
| 6173 | rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
|
---|
| 6174 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
| 6175 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
| 6176 | &findbuf, sizeof(FILEFINDBUF3),
|
---|
| 6177 | &ulSearchCount, FIL_STANDARD);
|
---|
| 6178 | else {
|
---|
| 6179 | rc = 0;
|
---|
| 6180 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
| 6181 | }
|
---|
| 6182 | priority_bumped();
|
---|
| 6183 | if (!rc) {
|
---|
| 6184 | if (!IsRoot(info->path))
|
---|
| 6185 | DosFindClose(hDir);
|
---|
| 6186 | if (findbuf.attrFile & FILE_DIRECTORY)
|
---|
| 6187 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
---|
| 6188 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
| 6189 | MPFROMP(info->path));
|
---|
| 6190 | else {
|
---|
| 6191 | temp = info->next;
|
---|
| 6192 | remove_udir(info->path);
|
---|
| 6193 | info = temp;
|
---|
| 6194 | continue;
|
---|
| 6195 | }
|
---|
| 6196 | }
|
---|
| 6197 | else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
|
---|
| 6198 | temp = info->next;
|
---|
| 6199 | remove_udir(info->path);
|
---|
| 6200 | info = temp;
|
---|
| 6201 | continue;
|
---|
| 6202 | }
|
---|
| 6203 | }
|
---|
| 6204 | info = info->next;
|
---|
[133] | 6205 | }
|
---|
| 6206 | info = ldirhead;
|
---|
[551] | 6207 | while (info) {
|
---|
[1077] | 6208 | if (IsFullName(info->path) &&
|
---|
| 6209 | !(driveflags[toupper(*info->path) - 'A'] &
|
---|
| 6210 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
---|
| 6211 | DosError(FERR_DISABLEHARDERR);
|
---|
| 6212 | hDir = HDIR_CREATE;
|
---|
| 6213 | ulSearchCount = 1;
|
---|
| 6214 | if (!IsRoot(info->path))
|
---|
| 6215 | rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
|
---|
| 6216 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
| 6217 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
| 6218 | &findbuf, sizeof(FILEFINDBUF3),
|
---|
| 6219 | &ulSearchCount, FIL_STANDARD);
|
---|
| 6220 | else {
|
---|
| 6221 | rc = 0;
|
---|
| 6222 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
| 6223 | }
|
---|
| 6224 | priority_bumped();
|
---|
| 6225 | if (!rc) {
|
---|
| 6226 | if (!IsRoot(info->path))
|
---|
| 6227 | DosFindClose(hDir);
|
---|
| 6228 | if (findbuf.attrFile & FILE_DIRECTORY)
|
---|
| 6229 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
---|
| 6230 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
| 6231 | MPFROMP(info->path));
|
---|
| 6232 | else {
|
---|
| 6233 | temp = info->next;
|
---|
| 6234 | remove_udir(info->path);
|
---|
| 6235 | info = temp;
|
---|
| 6236 | continue;
|
---|
| 6237 | }
|
---|
| 6238 | }
|
---|
| 6239 | else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
|
---|
| 6240 | temp = info->next;
|
---|
| 6241 | remove_udir(info->path);
|
---|
| 6242 | info = temp;
|
---|
| 6243 | continue;
|
---|
| 6244 | }
|
---|
| 6245 | }
|
---|
| 6246 | info = info->next;
|
---|
[133] | 6247 | }
|
---|
| 6248 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
---|
[1077] | 6249 | MPFROM2SHORT(0, 0),
|
---|
| 6250 | MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT)));
|
---|
[133] | 6251 | WinSetWindowText(hwndUserlist, GetPString(IDS_COMMONDIRTEXT));
|
---|
| 6252 | }
|
---|
| 6253 | return 0;
|
---|
[2] | 6254 |
|
---|
[133] | 6255 | case UM_SIZE:
|
---|
| 6256 | if (fAutoTile)
|
---|
| 6257 | TileChildren(hwnd, FALSE);
|
---|
| 6258 | else
|
---|
| 6259 | MoveChildrenAwayFromTree(hwnd);
|
---|
| 6260 | return 0;
|
---|
[2] | 6261 |
|
---|
[133] | 6262 | case WM_SIZE:
|
---|
| 6263 | ResizeChildren(hwnd, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1),
|
---|
[1077] | 6264 | SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
|
---|
[133] | 6265 | break;
|
---|
[2] | 6266 |
|
---|
[133] | 6267 | case WM_ERASEBACKGROUND:
|
---|
| 6268 | WinFillRect((HPS) mp1, (PRECTL) mp2, 0x00d0d0d0);
|
---|
| 6269 | return 0;
|
---|
[2] | 6270 |
|
---|
[133] | 6271 | case WM_PAINT:
|
---|
| 6272 | {
|
---|
| 6273 | HPS hps;
|
---|
| 6274 | RECTL rcl;
|
---|
[2] | 6275 |
|
---|
[133] | 6276 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
---|
[551] | 6277 | if (hps) {
|
---|
[1077] | 6278 | WinQueryWindowRect(hwnd, &rcl);
|
---|
| 6279 | WinFillRect(hps, &rcl, CLR_PALEGRAY);
|
---|
| 6280 | WinEndPaint(hps);
|
---|
[133] | 6281 | }
|
---|
| 6282 | }
|
---|
| 6283 | break;
|
---|
[2] | 6284 |
|
---|
[133] | 6285 | case UM_CONTROL:
|
---|
[551] | 6286 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 6287 | case MAIN_CMDLIST:
|
---|
| 6288 | case MAIN_SETUPLIST:
|
---|
| 6289 | case MAIN_DRIVELIST:
|
---|
| 6290 | case MAIN_USERLIST:
|
---|
| 6291 | case MAIN_BUTTONLIST:
|
---|
[551] | 6292 | switch (SHORT2FROMMP(mp1)) {
|
---|
[133] | 6293 | case CBN_ENTER:
|
---|
[1077] | 6294 | {
|
---|
| 6295 | HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 6296 | SHORT1FROMMP(mp1));
|
---|
| 6297 | CHAR path[CCHMAXPATH];
|
---|
| 6298 | ULONG ul;
|
---|
[2] | 6299 |
|
---|
[1077] | 6300 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 6301 | case MAIN_USERLIST:
|
---|
| 6302 | ul = CCHMAXPATH;
|
---|
| 6303 | break;
|
---|
| 6304 | case MAIN_SETUPLIST:
|
---|
| 6305 | ul = STATE_NAME_MAX_BYTES;
|
---|
| 6306 | break;
|
---|
| 6307 | default:
|
---|
| 6308 | ul = 13; // fixme to not be hardcoded
|
---|
| 6309 | }
|
---|
[787] | 6310 |
|
---|
[1077] | 6311 | SetShiftState();
|
---|
| 6312 | WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path);
|
---|
| 6313 | bstrip(path);
|
---|
| 6314 | if (*path) {
|
---|
| 6315 | if (SHORT1FROMMP(mp1) == MAIN_USERLIST) {
|
---|
| 6316 | if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) {
|
---|
| 6317 | if (!LastDir ||
|
---|
| 6318 | !WinSendMsg(WinQueryWindow(LastDir, QW_PARENT),
|
---|
| 6319 | UM_CONTAINERDIR, MPFROMP(path), MPVOID))
|
---|
[1104] | 6320 | strcpy(path, pFM2SaveDirectory);
|
---|
[1077] | 6321 | if (!PMMkDir(hwnd, path, TRUE)) {
|
---|
| 6322 | WinSetWindowText(hwndUL, GetPString(IDS_COMMONDIRTEXT));
|
---|
| 6323 | break;
|
---|
| 6324 | }
|
---|
| 6325 | }
|
---|
| 6326 | if (!IsFile(path) && !FindDirCnrByName(path, TRUE)) {
|
---|
[2] | 6327 |
|
---|
[1077] | 6328 | HWND hwndDir;
|
---|
[2] | 6329 |
|
---|
[1077] | 6330 | if ((fUserListSwitches &&
|
---|
| 6331 | !(shiftstate & KC_SHIFT)) ||
|
---|
| 6332 | (!fUserListSwitches && (shiftstate & KC_SHIFT))) {
|
---|
| 6333 | hwndDir = FindDirCnr(hwnd);
|
---|
| 6334 | if (hwndDir) {
|
---|
| 6335 | WinSendMsg(LastDir, UM_SETDIR, MPFROMP(path), MPVOID);
|
---|
| 6336 | break;
|
---|
| 6337 | }
|
---|
| 6338 | }
|
---|
| 6339 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, path);
|
---|
| 6340 | }
|
---|
| 6341 | }
|
---|
| 6342 | else if (SHORT1FROMMP(mp1) == MAIN_DRIVELIST) {
|
---|
| 6343 | ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree,
|
---|
| 6344 | FID_CLIENT),
|
---|
| 6345 | TREE_CNR), path, FALSE, TRUE);
|
---|
| 6346 | WinSetFocus(HWND_DESKTOP, hwndTree);
|
---|
| 6347 | }
|
---|
| 6348 | else if (SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) {
|
---|
| 6349 | strcat(path, ".TLS");
|
---|
| 6350 | load_tools(path);
|
---|
| 6351 | PrfWriteProfileString(fmprof,
|
---|
[1125] | 6352 | FM3Str, "LastToolbar", lasttoolbar);
|
---|
| 6353 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
---|
| 6354 | WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBARTEXT));
|
---|
[1077] | 6355 | }
|
---|
| 6356 | else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) {
|
---|
| 6357 | CHAR szKey[80];
|
---|
| 6358 | ULONG size, numsaves = 0;
|
---|
[2] | 6359 |
|
---|
[1077] | 6360 | SetShiftState();
|
---|
| 6361 | size = sizeof(ULONG);
|
---|
| 6362 | sprintf(szKey, "%s.NumDirsLastTime", path); // path is state name
|
---|
| 6363 | if (!PrfQueryProfileData(fmprof,
|
---|
| 6364 | FM3Str,
|
---|
| 6365 | szKey,
|
---|
| 6366 | (PVOID)&numsaves,
|
---|
| 6367 | &size))
|
---|
| 6368 | {
|
---|
| 6369 | if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) {
|
---|
| 6370 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
---|
| 6371 | GetPString(IDS_WARNINGTEXT),
|
---|
| 6372 | GetPString(IDS_DOESNTEXISTTEXT), path);
|
---|
| 6373 | }
|
---|
| 6374 | else {
|
---|
| 6375 | Win_Error2(hwnd, hwnd, __FILE__, __LINE__,
|
---|
| 6376 | IDS_PRFQUERYPROFILEDATA);
|
---|
| 6377 | }
|
---|
| 6378 | }
|
---|
| 6379 | else {
|
---|
| 6380 | char *pszStateName;
|
---|
| 6381 | if ((shiftstate & KC_SHIFT) == 0)
|
---|
| 6382 | PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));
|
---|
| 6383 | pszStateName = xstrdup(path, pszSrcFile, __LINE__);
|
---|
| 6384 | if (!pszStateName) {
|
---|
| 6385 | // Fall back if out of memory - already complained
|
---|
| 6386 | if ((shiftstate & KC_SHIFT) != 0 || fAutoTile) {
|
---|
| 6387 | // Autotile requested or forced
|
---|
| 6388 | PostMsg(MainObjectHwnd,
|
---|
| 6389 | UM_RESTORE,
|
---|
| 6390 | MPVOID,
|
---|
| 6391 | MPFROMLONG(1)); // Autotile
|
---|
| 6392 | }
|
---|
| 6393 | }
|
---|
| 6394 | else if (!PostMsg(MainObjectHwnd,
|
---|
| 6395 | UM_RESTORE,
|
---|
| 6396 | MPFROMP(pszStateName),
|
---|
| 6397 | MPVOID)) {
|
---|
| 6398 | free(pszStateName);
|
---|
| 6399 | }
|
---|
| 6400 | }
|
---|
| 6401 | }
|
---|
| 6402 | else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) {
|
---|
[2] | 6403 |
|
---|
[1077] | 6404 | SHORT sSelect;
|
---|
[2] | 6405 |
|
---|
[1077] | 6406 | sSelect = (SHORT) WinSendMsg(hwndCmdlist,
|
---|
| 6407 | LM_QUERYSELECTION,
|
---|
| 6408 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
| 6409 | if (sSelect >= 0)
|
---|
| 6410 | WinPostMsg(hwnd,
|
---|
| 6411 | WM_COMMAND,
|
---|
| 6412 | MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0),
|
---|
| 6413 | MPVOID);
|
---|
| 6414 | WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));
|
---|
| 6415 | }
|
---|
| 6416 | }
|
---|
| 6417 | }
|
---|
| 6418 | break;
|
---|
[2] | 6419 |
|
---|
[133] | 6420 | default:
|
---|
[1077] | 6421 | break;
|
---|
[133] | 6422 | }
|
---|
| 6423 | break;
|
---|
[2] | 6424 |
|
---|
[133] | 6425 | default:
|
---|
| 6426 | break;
|
---|
| 6427 | }
|
---|
| 6428 | return 0;
|
---|
[2] | 6429 |
|
---|
[133] | 6430 | case WM_HELP:
|
---|
[551] | 6431 | WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
|
---|
[133] | 6432 | break;
|
---|
[2] | 6433 |
|
---|
[133] | 6434 | case UM_COMMAND:
|
---|
| 6435 | case WM_COMMAND:
|
---|
[2] | 6436 |
|
---|
[133] | 6437 | return MainWMCommand(hwnd, msg, mp1, mp2);
|
---|
[2] | 6438 |
|
---|
[133] | 6439 | case WM_CLOSE:
|
---|
| 6440 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 6441 | WM_SYSCOMMAND, MPFROM2SHORT(SC_RESTORE, 0), MPVOID);
|
---|
[551] | 6442 | WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
---|
[133] | 6443 | fAmClosing = TRUE;
|
---|
| 6444 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 6445 | WM_SYSCOMMAND, MPFROM2SHORT(SC_MINIMIZE, 0), MPVOID);
|
---|
[551] | 6446 | if (CloseChildren(hwnd)) {
|
---|
[133] | 6447 | fAmClosing = FALSE;
|
---|
| 6448 | if (fAutoTile)
|
---|
[1077] | 6449 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TILE, 0), MPVOID);
|
---|
[133] | 6450 | return 0;
|
---|
| 6451 | }
|
---|
[551] | 6452 | if (hwndTree) {
|
---|
| 6453 | if (!PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID))
|
---|
[1077] | 6454 | WinSendMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID);
|
---|
[133] | 6455 | }
|
---|
[771] | 6456 | DosSleep(1);
|
---|
[930] | 6457 | return 0; // Hold off WM_QUIT
|
---|
[2] | 6458 |
|
---|
[133] | 6459 | case UM_CLOSE:
|
---|
| 6460 | HideNote();
|
---|
| 6461 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
---|
| 6462 | return 0;
|
---|
[2] | 6463 |
|
---|
[133] | 6464 | case UM_RESTORE:
|
---|
| 6465 | {
|
---|
[941] | 6466 | // Try to restore saved shutdown state
|
---|
[961] | 6467 | char *pszDefaultStateName = xstrdup(GetPString(IDS_SHUTDOWNSTATE),
|
---|
[1077] | 6468 | pszSrcFile, __LINE__);
|
---|
[941] | 6469 | if (pszDefaultStateName) {
|
---|
[1077] | 6470 | if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID))
|
---|
| 6471 | // 05 Feb 08 SHL fixme to complain?
|
---|
| 6472 | free(pszDefaultStateName);
|
---|
[133] | 6473 | }
|
---|
| 6474 | }
|
---|
| 6475 | return 0;
|
---|
[2] | 6476 |
|
---|
[133] | 6477 | case UM_SETDIR:
|
---|
[352] | 6478 | /* mp1 == name of directory to open */
|
---|
| 6479 | if (mp1)
|
---|
[551] | 6480 | return MRFROMLONG(OpenDirCnr((HWND) 0,
|
---|
[1077] | 6481 | hwndMain,
|
---|
| 6482 | hwndTree, (BOOL) mp2, (char *)mp1));
|
---|
[133] | 6483 | return 0;
|
---|
[2] | 6484 |
|
---|
[133] | 6485 | case WM_DESTROY:
|
---|
[551] | 6486 | hwndMain = (HWND) 0;
|
---|
| 6487 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
| 6488 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
---|
[1077] | 6489 | # ifdef FORTIFY
|
---|
| 6490 | free_commands();
|
---|
| 6491 | free_associations();
|
---|
| 6492 | free_udirs();
|
---|
| 6493 | free_ldir();
|
---|
| 6494 | free_archivers();
|
---|
| 6495 | free_tools();
|
---|
| 6496 | free_setups();
|
---|
| 6497 | Fortify_LeaveScope();
|
---|
| 6498 | # endif
|
---|
[133] | 6499 | break;
|
---|
| 6500 | }
|
---|
| 6501 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 6502 | }
|
---|
[787] | 6503 |
|
---|
[1060] | 6504 | VOID DeletePresParams(CHAR * pchKeyroot)
|
---|
| 6505 | // This code assumes that pchKeyroot points to a buffer large enough to
|
---|
| 6506 | // hold the full INI key: The state name.dircnr-number.PPName. The
|
---|
| 6507 | // PPNames are listed below.
|
---|
| 6508 | {
|
---|
| 6509 | PSZ apszPPNames[] =
|
---|
| 6510 | {
|
---|
| 6511 | "Backgroundcolor",
|
---|
| 6512 | "Foregroundcolor",
|
---|
| 6513 | "Hilitebackgroundcolor",
|
---|
| 6514 | "Hiliteforegroundcolor",
|
---|
| 6515 | "Bordercolor",
|
---|
| 6516 | "Fontnamesize"
|
---|
| 6517 | };
|
---|
| 6518 |
|
---|
| 6519 | ULONG ulSize, ulArraySize = sizeof(apszPPNames) / sizeof(PSZ), x;
|
---|
| 6520 | CHAR * eos = pchKeyroot + strlen(pchKeyroot);
|
---|
| 6521 |
|
---|
| 6522 | for (x = 0; x < ulArraySize; x++)
|
---|
| 6523 | {
|
---|
| 6524 | strcpy(eos, apszPPNames[x]);
|
---|
| 6525 | if (PrfQueryProfileSize(fmprof, appname, pchKeyroot, &ulSize) && ulSize)
|
---|
| 6526 | {
|
---|
| 6527 | PrfWriteProfileData(fmprof, appname, pchKeyroot, NULL, ulSize);
|
---|
| 6528 | }
|
---|
| 6529 | }
|
---|
| 6530 | }
|
---|
| 6531 |
|
---|
[787] | 6532 | #pragma alloc_text(MISC8,SetToggleChecks,FindDirCnrByName,TopWindow)
|
---|
| 6533 | #pragma alloc_text(MISC8,TopWindowName,CountDirCnrs)
|
---|
| 6534 | #pragma alloc_text(MAINWND,AdjustSizeOfClient,FillClient,ChildButtonProc)
|
---|
| 6535 | #pragma alloc_text(MAINWND,ToolBackProc,StatusProc)
|
---|
| 6536 | #pragma alloc_text(MAINWND,MoveChildrenAwayFromTree,ArrangeIcons,NextChild)
|
---|
| 6537 | #pragma alloc_text(MAINWND,ChildFrameButtonProc)
|
---|
| 6538 | #pragma alloc_text(MAINWND2,CloseChildren,CountChildren,GetNextWindowPos)
|
---|
| 6539 | #pragma alloc_text(MAINWND2,CascadeChildren,TileChildren,ResizeChildren)
|
---|
| 6540 | #pragma alloc_text(MAINWND2,MinResChildren,MainFrameWndProc,MainWndProc)
|
---|
| 6541 | #pragma alloc_text(MAINWND2,DropDownListProc)
|
---|
| 6542 | #pragma alloc_text(MAINWND3,RestoreDirCnrState,SaveDirCnrState)
|
---|
| 6543 | #pragma alloc_text(MAINWND3,CloseDirCnrChildren,TransformSwp)
|
---|
| 6544 | #pragma alloc_text(MAINWND3,ResizeTools,BuildTools,CommandLineProc)
|
---|
| 6545 | #pragma alloc_text(MAINWND4,DriveProc,DriveBackProc,BuildDriveBarButtons,ResizeDrives)
|
---|
| 6546 | #pragma alloc_text(MAINWND4,LEDProc,IdealButtonProc)
|
---|
| 6547 | #pragma alloc_text(MAINWND5,MainWMOnce)
|
---|
| 6548 | #pragma alloc_text(MAINWND6,MainWMCommand)
|
---|
| 6549 | #pragma alloc_text(BUBBLE,MakeBubble,BubbleProc,BubbleHelp)
|
---|
| 6550 | #pragma alloc_text(MAINOBJ,MainObjectWndProc,MakeMainObjWin)
|
---|
| 6551 |
|
---|