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