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