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