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