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