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