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