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