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