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