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