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