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