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