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