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