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