[33] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: mainwnd.c 1104 2008-08-02 20:33:03Z gyoung $
|
---|
| 5 |
|
---|
[178] | 6 | fm/2 main window
|
---|
[33] | 7 |
|
---|
| 8 | Copyright (c) 1993-98 M. Kimes
|
---|
[907] | 9 | Copyright (c) 2001, 2008 Steven H. Levine
|
---|
[33] | 10 |
|
---|
[130] | 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
|
---|
[133] | 15 | 23 May 05 SHL Use datamin.h
|
---|
[162] | 16 | 25 May 05 SHL Use ULONGLONG and CommaFmtULL
|
---|
[178] | 17 | 26 May 05 SHL Comments and localize code
|
---|
[186] | 18 | 05 Jun 05 SHL Use QWL_USER
|
---|
[200] | 19 | 06 Jun 05 SHL Rework MainWMCommand for VAC3.65 compat
|
---|
[260] | 20 | 13 Aug 05 SHL Renames and comments
|
---|
[297] | 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
|
---|
[352] | 24 | 17 Jul 06 SHL Use Runtime_Error
|
---|
[447] | 25 | 17 Aug 06 SHL Complain nicer if state name does not exist
|
---|
[552] | 26 | 18 Feb 07 GKY More drive type and icon support
|
---|
[557] | 27 | 08 Mar 07 SHL SaveDirCnrState: do not save state of NOPRESCAN volumes
|
---|
[558] | 28 | 09 Mar 07 SHL RestoreDirCnrState/SaveDirCnrState: optimize and avoid overflows
|
---|
[593] | 29 | 30 Mar 07 GKY Remove GetPString for window class names
|
---|
[603] | 30 | 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
|
---|
| 31 | 06 Apr 07 GKY Add some error checking in drag/drop
|
---|
[618] | 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
|
---|
[672] | 35 | 12 May 07 SHL Use dcd->ulItemsToUnHilite
|
---|
[688] | 36 | 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
|
---|
[775] | 37 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
|
---|
[773] | 38 | 07 Aug 07 SHL Use BldQuotedFileName
|
---|
[787] | 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
|
---|
[789] | 42 | 19 Aug 07 SHL Rework SaveDirCnrState to return better error info
|
---|
[824] | 43 | 30 Aug 07 SHL Add accelerator support to quicklist windows
|
---|
[872] | 44 | 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
|
---|
[921] | 45 | 12 Jan 08 SHL Support drag&drop dialog toggle
|
---|
[925] | 46 | 16 Jan 08 SHL Add sync updates toggle
|
---|
[927] | 47 | 16 Jan 08 GKY Fix changing background color on toolbar
|
---|
[940] | 48 | 17 Jan 08 GKY Add presparam save & restore for individual directory containers
|
---|
[965] | 49 | 19 Jan 08 JBS Ticket 150: fix/improve save and restore of dir cnr state at FM/2 close/reopen
|
---|
[940] | 50 | 19 Jan 08 GKY Rework Utilities menu
|
---|
[941] | 51 | 05 Feb 08 SHL Restore no-prescan drives if restoring named state
|
---|
[953] | 52 | 14 Feb 08 SHL Rework to support settings menu conditional cascade
|
---|
[954] | 53 | 15 Feb 08 SHL Rework ResizeChildren to honor fNoTreeGap and resize drive tree better
|
---|
[965] | 54 | 19 Feb 08 JBS Stop deleting "State at last FM/2 Close" from INI file so it be accessed from States combo box.
|
---|
[971] | 55 | 22 Feb 08 JBS Ticket 230: Fix/improve various code related to state or presparam values in the INI file.
|
---|
[985] | 56 | 29 Feb 08 GKY Use xfree where appropriate
|
---|
[1027] | 57 | 19 Jun 08 JBS Ticket 227: Allow temporary saving/deleting of the shutdown state of directory containers
|
---|
[1029] | 58 | 22 Jun 08 GKY Use free_... functions for fortify checking
|
---|
[1033] | 59 | 30 Jun 08 JBS Ticket 103: Fix restore of previous shutdown state when opening FM/2
|
---|
[1061] | 60 | 07 Jul 08 JBS Ticket 242: Delete obsolete INI keys when re-saving a state
|
---|
[1065] | 61 | 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
|
---|
[1077] | 62 | all the details view settings (both the global variables and those in the
|
---|
| 63 | DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
|
---|
[1066] | 64 | 12 Jul 08 JBS Ticket 246: Allow saved directory container states to have no directory containers
|
---|
[1077] | 65 | (i.e. just a directory tree container).
|
---|
[1104] | 66 | 18 Jul 08 SHL Use new Fortify feature to avoid spurious reports
|
---|
| 67 | 19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory
|
---|
[33] | 68 |
|
---|
| 69 | ***********************************************************************/
|
---|
| 70 |
|
---|
[907] | 71 | #include <stdlib.h>
|
---|
| 72 | #include <string.h>
|
---|
| 73 | #include <ctype.h>
|
---|
[1077] | 74 | #include <process.h> // _beginthread
|
---|
[907] | 75 |
|
---|
[2] | 76 | #define INCL_DOS
|
---|
| 77 | #define INCL_WIN
|
---|
[1077] | 78 | #define INCL_SHLERRORS // PMERR_NOT_IN_IDX
|
---|
[2] | 79 | #define INCL_WINHELP
|
---|
| 80 | #define INCL_GPI
|
---|
[162] | 81 | #define INCL_LONGLONG
|
---|
[2] | 82 |
|
---|
| 83 | #include "fm3dlg.h"
|
---|
| 84 | #include "fm3str.h"
|
---|
| 85 | #include "tools.h"
|
---|
[907] | 86 | #include "comp.h"
|
---|
[133] | 87 | #include "datamin.h"
|
---|
[1077] | 88 | #include "pathutil.h" // BldQuotedFileName
|
---|
| 89 | #include "errutil.h" // Dos_Error...
|
---|
| 90 | #include "strutil.h" // GetPString
|
---|
| 91 | #include "notebook.h" // CfgDlgProc CfgMenuInit
|
---|
| 92 | #include "command.h" // LINKCMDS
|
---|
| 93 | #include "avl.h" // free_archivers
|
---|
| 94 | #include "walkem.h" // free_setups...
|
---|
[907] | 95 | #include "fm3dll.h"
|
---|
[2] | 96 |
|
---|
[1017] | 97 | #include "fortify.h"
|
---|
| 98 |
|
---|
[2] | 99 | #pragma data_seg(DATA1)
|
---|
[352] | 100 |
|
---|
| 101 | static PSZ pszSrcFile = __FILE__;
|
---|
| 102 |
|
---|
[178] | 103 | static USHORT firsttool = 0;
|
---|
[2] | 104 |
|
---|
[200] | 105 | static BOOL CloseDirCnrChildren(HWND hwndClient);
|
---|
[557] | 106 | static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview);
|
---|
[1060] | 107 | static VOID DeletePresParams(PSZ pszKeyroot);
|
---|
[2] | 108 |
|
---|
[551] | 109 | static MRESULT EXPENTRY MainObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
[1077] | 110 | MPARAM mp2)
|
---|
[133] | 111 | {
|
---|
[551] | 112 | switch (msg) {
|
---|
[1077] | 113 | case WM_CREATE:
|
---|
| 114 | break;
|
---|
| 115 |
|
---|
[133] | 116 | case UM_SETUP:
|
---|
| 117 | case UM_SETUP2:
|
---|
| 118 | case UM_SETUP3:
|
---|
| 119 | case UM_SETUP4:
|
---|
| 120 | case UM_SETUP5:
|
---|
| 121 | /*
|
---|
| 122 | * feed setup messages to main window
|
---|
| 123 | */
|
---|
| 124 | PostMsg(hwndMain, msg, mp1, mp2);
|
---|
| 125 | return 0;
|
---|
[2] | 126 |
|
---|
[133] | 127 | case UM_SETUP6:
|
---|
| 128 | /*
|
---|
| 129 | * handle bubble help requests from drive bar buttons
|
---|
| 130 | */
|
---|
| 131 | {
|
---|
| 132 | char dv[3], d;
|
---|
[551] | 133 | HWND hwndB = (HWND) mp1;
|
---|
[133] | 134 | USHORT id;
|
---|
[2] | 135 |
|
---|
[133] | 136 | id = WinQueryWindowUShort(hwndB, QWS_ID);
|
---|
| 137 | *dv = 0;
|
---|
| 138 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwndB, QW_PARENT),
|
---|
[1077] | 139 | id + 50), sizeof(dv), dv);
|
---|
[133] | 140 | d = toupper(*dv);
|
---|
| 141 | if (isalpha(d) && d > 'B' &&
|
---|
[1077] | 142 | !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID |
|
---|
| 143 | DRIVE_SLOW)) &&
|
---|
| 144 | (!hwndBubble ||
|
---|
| 145 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&
|
---|
| 146 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
[2] | 147 |
|
---|
[1077] | 148 | FSALLOCATE fsa;
|
---|
| 149 | CHAR s[90], szQty[38];
|
---|
| 150 | ULONG ulPctFree;
|
---|
| 151 | ULONGLONG ullFreeQty;
|
---|
[2] | 152 |
|
---|
[1077] | 153 | if (!DosQueryFSInfo((d - 'A') + 1,
|
---|
| 154 | FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {
|
---|
| 155 | ullFreeQty = (ULONGLONG) fsa.cUnitAvail *
|
---|
| 156 | (fsa.cSectorUnit * fsa.cbSector);
|
---|
| 157 | ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ?
|
---|
| 158 | (fsa.cUnitAvail * 100) / fsa.cUnit : 0;
|
---|
| 159 | CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' ');
|
---|
| 160 | sprintf(s, "%s (%lu%%) free", szQty, ulPctFree);
|
---|
| 161 | }
|
---|
| 162 | if ((!hwndBubble ||
|
---|
| 163 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&
|
---|
| 164 | !WinQueryCapture(HWND_DESKTOP))
|
---|
| 165 | WinSendMsg(hwndB, UM_SETUP6, MPFROMP(s), MPVOID);
|
---|
[2] | 166 | }
|
---|
[133] | 167 | }
|
---|
| 168 | return 0;
|
---|
[2] | 169 |
|
---|
[133] | 170 | case UM_SETDIR:
|
---|
| 171 | {
|
---|
| 172 | CHAR s[8] = " :\\OS2";
|
---|
| 173 | ULONG bd;
|
---|
[2] | 174 |
|
---|
[133] | 175 | if (DosQuerySysInfo(QSV_BOOT_DRIVE,
|
---|
[1077] | 176 | QSV_BOOT_DRIVE,
|
---|
| 177 | (PVOID) & bd, (ULONG) sizeof(ULONG)))
|
---|
| 178 | bd = 3L;
|
---|
[133] | 179 | *s = (CHAR) bd + '@';
|
---|
[787] | 180 | WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPFROMLONG(1));
|
---|
[551] | 181 | if (!mp1) {
|
---|
[1077] | 182 | s[3] = 0;
|
---|
| 183 | WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID);
|
---|
[133] | 184 | }
|
---|
[787] | 185 | PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1), MPFROMLONG(1));
|
---|
[133] | 186 | }
|
---|
| 187 | return 0;
|
---|
[2] | 188 |
|
---|
[133] | 189 | case UM_RESTORE:
|
---|
[941] | 190 | switch ((ULONG)mp2) {
|
---|
| 191 | case 1:
|
---|
| 192 | TileChildren(hwndMain, TRUE);
|
---|
| 193 | break;
|
---|
| 194 | case 2:
|
---|
| 195 | CloseDirCnrChildren(hwndMain);
|
---|
| 196 | break;
|
---|
| 197 | case 0:
|
---|
[133] | 198 | fNoTileUpdate = TRUE;
|
---|
| 199 | WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), FALSE);
|
---|
[551] | 200 | RestoreDirCnrState(hwndMain, (char *)mp1, FALSE);
|
---|
[133] | 201 | WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), TRUE);
|
---|
| 202 | fNoTileUpdate = FALSE;
|
---|
[1011] | 203 | //xfree((char *)mp1, pszSrcFile, __LINE__);
|
---|
[1033] | 204 | // if (fAutoTile)
|
---|
| 205 | // TileChildren(hwndMain, TRUE);
|
---|
[941] | 206 | break;
|
---|
| 207 | default:
|
---|
| 208 | Runtime_Error(pszSrcFile, __LINE__, "%u unexpected", mp2);
|
---|
[133] | 209 | }
|
---|
| 210 | return 0;
|
---|
[2] | 211 |
|
---|
[133] | 212 | case UM_NOTIFY:
|
---|
| 213 | /*
|
---|
| 214 | * bring up notify messages for various windows
|
---|
| 215 | */
|
---|
| 216 | if (mp1)
|
---|
[551] | 217 | return MRFROMLONG(DoNotify((char *)mp1));
|
---|
[133] | 218 | return 0;
|
---|
[2] | 219 |
|
---|
[133] | 220 | case WM_DESTROY:
|
---|
[551] | 221 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
| 222 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
---|
[133] | 223 | break;
|
---|
| 224 | }
|
---|
| 225 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 226 | }
|
---|
| 227 |
|
---|
[133] | 228 | VOID MakeMainObjWin(VOID * args)
|
---|
| 229 | {
|
---|
| 230 | HAB hab2;
|
---|
| 231 | HMQ hmq2;
|
---|
| 232 | QMSG qmsg2;
|
---|
[2] | 233 |
|
---|
[133] | 234 | priority_bumped();
|
---|
| 235 | hab2 = WinInitialize(0);
|
---|
[551] | 236 | if (hab2) {
|
---|
[133] | 237 | hmq2 = WinCreateMsgQueue(hab2, 128);
|
---|
[551] | 238 | if (hmq2) {
|
---|
[133] | 239 | DosError(FERR_DISABLEHARDERR);
|
---|
| 240 | WinRegisterClass(hab2,
|
---|
[1077] | 241 | (PSZ) WC_OBJECTWINDOW,
|
---|
| 242 | MainObjectWndProc, 0, sizeof(PVOID));
|
---|
[133] | 243 | MainObjectHwnd = WinCreateWindow(HWND_OBJECT,
|
---|
[1077] | 244 | WC_OBJECTWINDOW,
|
---|
| 245 | (PSZ) NULL,
|
---|
| 246 | 0,
|
---|
| 247 | 0L,
|
---|
| 248 | 0L,
|
---|
| 249 | 0L,
|
---|
| 250 | 0L,
|
---|
| 251 | 0L, HWND_TOP, OBJ_FRAME, NULL, NULL);
|
---|
[376] | 252 | if (!MainObjectHwnd)
|
---|
[1077] | 253 | Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 254 | IDS_WINCREATEWINDOW);
|
---|
[551] | 255 | else {
|
---|
[1077] | 256 | WinSetWindowPtr(MainObjectHwnd, QWL_USER, args);
|
---|
| 257 | # ifdef FORTIFY
|
---|
| 258 | Fortify_EnterScope();
|
---|
| 259 | # endif
|
---|
| 260 | while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0))
|
---|
| 261 | WinDispatchMsg(hab2, &qmsg2);
|
---|
| 262 | WinDestroyWindow(MainObjectHwnd);
|
---|
| 263 | # ifdef FORTIFY
|
---|
| 264 | Fortify_LeaveScope();
|
---|
| 265 | # endif
|
---|
[133] | 266 | }
|
---|
| 267 | WinDestroyMsgQueue(hmq2);
|
---|
| 268 | }
|
---|
| 269 | WinTerminate(hab2);
|
---|
| 270 | }
|
---|
[2] | 271 | }
|
---|
| 272 |
|
---|
[551] | 273 | static MRESULT EXPENTRY IdealButtonProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
[1077] | 274 | MPARAM mp2)
|
---|
[133] | 275 | {
|
---|
[551] | 276 | switch (msg) {
|
---|
[133] | 277 | case WM_MOUSEMOVE:
|
---|
[551] | 278 | BubbleHelp(hwnd, TRUE, FALSE, FALSE, GetPString(IDS_IDEALBUTTONHELP));
|
---|
[133] | 279 | break;
|
---|
| 280 | }
|
---|
| 281 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
[2] | 282 | }
|
---|
| 283 |
|
---|
[133] | 284 | HWND TopWindow(HWND hwndParent, HWND exclude)
|
---|
| 285 | {
|
---|
| 286 | HENUM henum;
|
---|
[551] | 287 | HWND hwndC = (HWND) 0;
|
---|
[133] | 288 | USHORT id;
|
---|
[2] | 289 |
|
---|
[551] | 290 | if (hwndParent) {
|
---|
[133] | 291 | henum = WinBeginEnumWindows(hwndMain);
|
---|
[551] | 292 | while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 293 | if (hwndC != exclude) {
|
---|
[1077] | 294 | id = WinQueryWindowUShort(hwndC, QWS_ID);
|
---|
| 295 | if (id)
|
---|
| 296 | break;
|
---|
[133] | 297 | }
|
---|
| 298 | }
|
---|
| 299 | WinEndEnumWindows(henum);
|
---|
| 300 | }
|
---|
| 301 | return hwndC;
|
---|
[2] | 302 | }
|
---|
| 303 |
|
---|
[133] | 304 | HWND TopWindowName(HWND hwndParent, HWND exclude, CHAR * ret)
|
---|
| 305 | {
|
---|
| 306 | HENUM henum;
|
---|
[551] | 307 | HWND hwndC = (HWND) 0, hwndDir, hwndClient;
|
---|
[133] | 308 | USHORT id;
|
---|
| 309 | PCNRITEM pci = NULL;
|
---|
[2] | 310 |
|
---|
[551] | 311 | if (ret) {
|
---|
[133] | 312 | *ret = 0;
|
---|
[551] | 313 | if (hwndParent) {
|
---|
[133] | 314 | henum = WinBeginEnumWindows(hwndMain);
|
---|
[551] | 315 | while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[1077] | 316 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC);
|
---|
| 317 | if (hwndC != exclude && hwndC != hwndTree) {
|
---|
| 318 | id = WinQueryWindowUShort(hwndC, QWS_ID);
|
---|
| 319 | if (id) {
|
---|
| 320 | hwndClient = WinWindowFromID(hwndC, FID_CLIENT);
|
---|
| 321 | if (hwndClient) {
|
---|
| 322 | hwndDir = WinWindowFromID(hwndClient, DIR_CNR);
|
---|
| 323 | if (hwndDir) {
|
---|
| 324 | if (fLookInDir) {
|
---|
| 325 | pci = (PCNRITEM) WinSendMsg(hwndDir,
|
---|
| 326 | CM_QUERYRECORDEMPHASIS,
|
---|
| 327 | MPFROMLONG(CMA_FIRST),
|
---|
| 328 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 329 | if (pci && (INT) pci != -1)
|
---|
| 330 | break;
|
---|
| 331 | }
|
---|
| 332 | if (WinSendMsg(hwndClient,
|
---|
| 333 | UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) {
|
---|
| 334 | MakeValidDir(ret);
|
---|
| 335 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret);
|
---|
| 336 | WinEndEnumWindows(henum);
|
---|
| 337 | return hwndC;
|
---|
| 338 | }
|
---|
| 339 | }
|
---|
| 340 | }
|
---|
| 341 | }
|
---|
| 342 | }
|
---|
[133] | 343 | }
|
---|
| 344 | WinEndEnumWindows(henum);
|
---|
[551] | 345 | if (!pci || (INT) pci == -1) {
|
---|
[1077] | 346 | hwndC = hwndTree;
|
---|
| 347 | pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree,
|
---|
| 348 | FID_CLIENT),
|
---|
| 349 | TREE_CNR),
|
---|
| 350 | CM_QUERYRECORDEMPHASIS,
|
---|
| 351 | MPFROMLONG(CMA_FIRST),
|
---|
| 352 | MPFROMSHORT(CRA_CURSORED));
|
---|
[133] | 353 | }
|
---|
[551] | 354 | if (pci && (INT) pci != -1) {
|
---|
[1077] | 355 | strcpy(ret, pci->pszFileName);
|
---|
| 356 | MakeValidDir(ret);
|
---|
[133] | 357 | }
|
---|
| 358 | else
|
---|
[1104] | 359 | strcpy(ret, pFM2SaveDirectory);
|
---|
[133] | 360 | }
|
---|
| 361 | }
|
---|
| 362 | return hwndC;
|
---|
[2] | 363 | }
|
---|
| 364 |
|
---|
[133] | 365 | ULONG CountDirCnrs(HWND hwndParent)
|
---|
| 366 | {
|
---|
[2] | 367 | HENUM henum;
|
---|
[551] | 368 | HWND hwndF = (HWND) 0, hwndC, hwndDir;
|
---|
[2] | 369 | ULONG ret = 0;
|
---|
| 370 |
|
---|
| 371 | henum = WinBeginEnumWindows(hwndParent);
|
---|
[551] | 372 | while ((hwndF = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 373 | hwndC = WinWindowFromID(hwndF, FID_CLIENT);
|
---|
[551] | 374 | if (hwndC) {
|
---|
[133] | 375 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
---|
| 376 | if (hwndDir)
|
---|
[1077] | 377 | ret++;
|
---|
[2] | 378 | }
|
---|
| 379 | }
|
---|
| 380 | WinEndEnumWindows(henum);
|
---|
| 381 | return ret;
|
---|
| 382 | }
|
---|
| 383 |
|
---|
[133] | 384 | HWND FindDirCnrByName(CHAR * directory, BOOL restore)
|
---|
| 385 | {
|
---|
| 386 | HENUM henum;
|
---|
[551] | 387 | HWND hwndF = (HWND) 0, hwndC, hwndDir;
|
---|
[133] | 388 | CHAR retstr[CCHMAXPATH];
|
---|
[2] | 389 |
|
---|
[551] | 390 | if (hwndMain) {
|
---|
[69] | 391 | henum = WinBeginEnumWindows(hwndMain);
|
---|
[551] | 392 | while ((hwndF = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 393 | hwndC = WinWindowFromID(hwndF, FID_CLIENT);
|
---|
[551] | 394 | if (hwndC) {
|
---|
[1077] | 395 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
---|
| 396 | if (hwndDir) {
|
---|
| 397 | *retstr = 0;
|
---|
| 398 | WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID);
|
---|
| 399 | if (*retstr && !stricmp(retstr, directory)) {
|
---|
| 400 | if (restore)
|
---|
| 401 | WinSetWindowPos(hwndF,
|
---|
| 402 | HWND_TOP,
|
---|
| 403 | 0,
|
---|
| 404 | 0,
|
---|
| 405 | 0,
|
---|
| 406 | 0,
|
---|
| 407 | SWP_RESTORE | SWP_SHOW |
|
---|
| 408 | SWP_ACTIVATE | SWP_ZORDER);
|
---|
| 409 | break;
|
---|
| 410 | }
|
---|
| 411 | }
|
---|
[69] | 412 | }
|
---|
| 413 | }
|
---|
| 414 | WinEndEnumWindows(henum);
|
---|
| 415 | }
|
---|
| 416 | return hwndF;
|
---|
[2] | 417 | }
|
---|
| 418 |
|
---|
[178] | 419 | static VOID SetToggleChecks(HWND hwndMenu)
|
---|
[133] | 420 | {
|
---|
[551] | 421 | WinCheckMenuItem(hwndMenu, IDM_TEXTTOOLS, fTextTools);
|
---|
| 422 | WinCheckMenuItem(hwndMenu, IDM_TOOLTITLES, fToolTitles);
|
---|
| 423 | WinCheckMenuItem(hwndMenu, IDM_USERLIST, fUserComboBox);
|
---|
| 424 | WinCheckMenuItem(hwndMenu, IDM_TOOLSUBMENU, fToolbar);
|
---|
| 425 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWSUBMENU, fAutoView);
|
---|
| 426 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWFILE, !fComments);
|
---|
| 427 | WinCheckMenuItem(hwndMenu, IDM_AUTOVIEWCOMMENTS, fComments);
|
---|
| 428 | WinCheckMenuItem(hwndMenu, IDM_MOREBUTTONS, fMoreButtons);
|
---|
| 429 | WinCheckMenuItem(hwndMenu, IDM_DRIVEBAR, fDrivebar);
|
---|
| 430 | WinCheckMenuItem(hwndMenu, IDM_AUTOTILE, fAutoTile);
|
---|
| 431 | WinCheckMenuItem(hwndMenu, IDM_TILEBACKWARDS, fTileBackwards);
|
---|
[921] | 432 | WinCheckMenuItem(hwndMenu, IDM_TOGGLEDRAGDIALOG, fDragndropDlg);
|
---|
[925] | 433 | WinCheckMenuItem(hwndMenu, IDM_SYNCUPDATES, fSyncUpdates);
|
---|
[2] | 434 | }
|
---|
| 435 |
|
---|
[178] | 436 | static VOID ResizeTools(HWND hwnd)
|
---|
[133] | 437 | {
|
---|
| 438 | register ULONG butx = 18L;
|
---|
| 439 | INT attrib = SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER | SWP_NOREDRAW,
|
---|
[551] | 440 | noattrib;
|
---|
[133] | 441 | register TOOL *tool, *starttool;
|
---|
| 442 | SWP *swp;
|
---|
| 443 | register ULONG numtools, x;
|
---|
[2] | 444 |
|
---|
[133] | 445 | if (!fToolbar)
|
---|
| 446 | return;
|
---|
| 447 | noattrib = attrib;
|
---|
| 448 | noattrib &= (~(SWP_SHOW | SWP_ZORDER));
|
---|
| 449 | noattrib |= SWP_HIDE;
|
---|
| 450 | /* count tools */
|
---|
| 451 | tool = toolhead;
|
---|
| 452 | for (numtools = 0L; tool; numtools++)
|
---|
[551] | 453 | tool = tool->next;
|
---|
[133] | 454 | /* allocate swp array for WinSetMultWindowPos */
|
---|
[551] | 455 | swp = xmallocz(sizeof(SWP) * (numtools + 2), pszSrcFile, __LINE__);
|
---|
[352] | 456 | if (swp) {
|
---|
| 457 | for (x = 0; x < numtools + 2L; x++) {
|
---|
[133] | 458 | swp[x].hwndInsertBehind = HWND_TOP;
|
---|
| 459 | swp[x].fl = attrib;
|
---|
| 460 | swp[x].y = (fToolTitles) ? 14L : 3L;
|
---|
| 461 | swp[x].cx = 32L;
|
---|
| 462 | swp[x].cy = 32L;
|
---|
| 463 | }
|
---|
| 464 | swp[0].x = swp[1].x = 2L;
|
---|
| 465 | swp[0].y = (fTextTools) ? 14L : 18L;
|
---|
| 466 | swp[1].y = (fTextTools) ? 1L : 2L;
|
---|
| 467 | swp[0].cx = swp[1].cx = 14L;
|
---|
| 468 | swp[0].cy = swp[1].cy = 14L;
|
---|
| 469 | swp[0].hwnd = WinWindowFromID(hwnd, IDM_TOOLLEFT);
|
---|
| 470 | swp[1].hwnd = WinWindowFromID(hwnd, IDM_TOOLRIGHT);
|
---|
| 471 | x = 2L;
|
---|
| 472 | tool = find_tool(firsttool);
|
---|
| 473 | if (!tool)
|
---|
| 474 | tool = toolhead;
|
---|
| 475 | starttool = tool;
|
---|
[551] | 476 | while (tool) {
|
---|
| 477 | if (!(tool->flags & T_INVISIBLE)) {
|
---|
[1077] | 478 | swp[x].x = butx;
|
---|
| 479 | if (fTextTools || (tool->flags & T_TEXT)) {
|
---|
| 480 | butx += 55L;
|
---|
| 481 | swp[x].cx = 54L;
|
---|
| 482 | swp[x].cy = 24L;
|
---|
| 483 | swp[x].y = 3L;
|
---|
| 484 | }
|
---|
| 485 | else
|
---|
| 486 | butx += 33L;
|
---|
| 487 | if (tool->flags & T_SEPARATOR)
|
---|
| 488 | butx += 12;
|
---|
[133] | 489 | }
|
---|
| 490 | else
|
---|
[1077] | 491 | swp[x].fl = noattrib;
|
---|
[551] | 492 | swp[x].hwnd = WinWindowFromID(hwnd, tool->id);
|
---|
[133] | 493 | x++;
|
---|
[551] | 494 | tool = tool->next;
|
---|
[133] | 495 | }
|
---|
| 496 | tool = toolhead;
|
---|
[551] | 497 | while (tool && tool != starttool) {
|
---|
[133] | 498 | swp[x].x = butx;
|
---|
[551] | 499 | if (!(tool->flags & T_INVISIBLE)) {
|
---|
[1077] | 500 | if (fTextTools || (tool->flags & T_TEXT)) {
|
---|
| 501 | butx += 55L;
|
---|
| 502 | swp[x].cx = 54L;
|
---|
| 503 | swp[x].cy = 24L;
|
---|
| 504 | swp[x].y = 3L;
|
---|
| 505 | }
|
---|
| 506 | else
|
---|
| 507 | butx += 33L;
|
---|
| 508 | if (tool->flags & T_SEPARATOR)
|
---|
| 509 | butx += 12;
|
---|
[133] | 510 | }
|
---|
| 511 | else
|
---|
[1077] | 512 | swp[x].fl = noattrib;
|
---|
[551] | 513 | swp[x].hwnd = WinWindowFromID(hwnd, tool->id);
|
---|
[133] | 514 | x++;
|
---|
[551] | 515 | tool = tool->next;
|
---|
[133] | 516 | }
|
---|
| 517 | WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), swp, numtools + 2L);
|
---|
[551] | 518 | if (!fTextTools && fToolTitles) {
|
---|
| 519 | for (x = 2L; x < numtools + 2L; x++) {
|
---|
[1077] | 520 | if (fTextTools || !fToolTitles)
|
---|
| 521 | swp[x].fl = noattrib;
|
---|
| 522 | else {
|
---|
| 523 | tool = find_tool(WinQueryWindowUShort(swp[x].hwnd, QWS_ID));
|
---|
| 524 | if (tool && (tool->flags & T_TEXT))
|
---|
| 525 | swp[x].fl = noattrib;
|
---|
| 526 | else {
|
---|
| 527 | swp[x].hwndInsertBehind = HWND_TOP;
|
---|
| 528 | swp[x].y = 1L;
|
---|
| 529 | swp[x].cy = 10L;
|
---|
| 530 | }
|
---|
| 531 | }
|
---|
| 532 | swp[x].hwnd = WinWindowFromID(hwnd,
|
---|
| 533 | WinQueryWindowUShort(swp[x].hwnd,
|
---|
| 534 | QWS_ID) + 25000);
|
---|
[133] | 535 | }
|
---|
| 536 | WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), &swp[2], numtools);
|
---|
| 537 | }
|
---|
[1039] | 538 | free(swp);
|
---|
[133] | 539 | }
|
---|
| 540 | WinInvalidateRect(hwnd, NULL, TRUE);
|
---|
[2] | 541 | }
|
---|
| 542 |
|
---|
[551] | 543 | static MRESULT EXPENTRY DropDownListProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
[1077] | 544 | MPARAM mp2)
|
---|
[133] | 545 | {
|
---|
| 546 | PFNWP oldproc = (PFNWP) INSTDATA(hwnd);
|
---|
| 547 | USHORT id;
|
---|
[824] | 548 |
|
---|
| 549 | static HWND hwndMenu = (HWND)0;
|
---|
[133] | 550 | static BOOL emphasized = FALSE;
|
---|
[2] | 551 |
|
---|
[551] | 552 | switch (msg) {
|
---|
[133] | 553 | case WM_MOUSEMOVE:
|
---|
| 554 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 555 | break;
|
---|
[2] | 556 |
|
---|
[133] | 557 | case WM_CHAR:
|
---|
| 558 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 559 | break;
|
---|
[2] | 560 |
|
---|
[133] | 561 | case WM_MENUEND:
|
---|
[551] | 562 | if (hwndMenu == (HWND) mp2) {
|
---|
[133] | 563 | WinDestroyWindow(hwndMenu);
|
---|
[551] | 564 | hwndMenu = (HWND) 0;
|
---|
[133] | 565 | }
|
---|
| 566 | break;
|
---|
[2] | 567 |
|
---|
[824] | 568 | case WM_FOCUSCHANGE:
|
---|
| 569 | {
|
---|
| 570 | HAB hab = WinQueryAnchorBlock(hwnd);
|
---|
| 571 | HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT);
|
---|
| 572 | HWND hwndFrame = WinQueryWindow(hwndParent, QW_PARENT);
|
---|
| 573 | static HACCEL haccelSaved = NULLHANDLE;
|
---|
| 574 | static HACCEL haccelDriveList = NULLHANDLE;
|
---|
| 575 | static HACCEL haccelSetupList = NULLHANDLE;
|
---|
| 576 | static HACCEL haccelUserList = NULLHANDLE;
|
---|
| 577 | static HACCEL haccelCmdList = NULLHANDLE;
|
---|
| 578 | static HACCEL haccelButtonList = NULLHANDLE;
|
---|
| 579 | // DbgMsg(pszSrcFile, __LINE__, "WM_FOCUSCHANGE %u", SHORT1FROMMP(mp2));
|
---|
| 580 | id = WinQueryWindowUShort(hwndParent, QWS_ID);
|
---|
| 581 | if (SHORT1FROMMP(mp2)) {
|
---|
[1077] | 582 | // If getting focus 1st time - save original accelerator
|
---|
| 583 | if (haccelSaved == NULLHANDLE) {
|
---|
| 584 | haccelSaved = WinQueryAccelTable(hab, hwndFrame);
|
---|
| 585 | if (haccelSaved == NULLHANDLE)
|
---|
| 586 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable");
|
---|
| 587 | // else
|
---|
| 588 | // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved);
|
---|
| 589 | }
|
---|
| 590 | if (haccelSaved != NULLHANDLE) {
|
---|
| 591 | switch (id) {
|
---|
| 592 | case MAIN_DRIVELIST:
|
---|
| 593 | if (haccelDriveList == NULLHANDLE) {
|
---|
| 594 | haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST);
|
---|
| 595 | if (haccelDriveList == NULLHANDLE)
|
---|
| 596 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
| 597 | }
|
---|
| 598 | if (haccelDriveList != NULLHANDLE) {
|
---|
| 599 | if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame))
|
---|
| 600 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
| 601 | // else
|
---|
| 602 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList);
|
---|
| 603 | }
|
---|
| 604 | break;
|
---|
| 605 | case MAIN_SETUPLIST:
|
---|
| 606 | if (haccelSetupList == NULLHANDLE) {
|
---|
| 607 | haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST);
|
---|
| 608 | if (haccelSetupList == NULLHANDLE)
|
---|
| 609 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
| 610 | }
|
---|
| 611 | if (haccelSetupList != NULLHANDLE) {
|
---|
| 612 | if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame))
|
---|
| 613 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
| 614 | // else
|
---|
| 615 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList);
|
---|
| 616 | }
|
---|
| 617 | break;
|
---|
| 618 | case MAIN_CMDLIST:
|
---|
| 619 | if (haccelCmdList == NULLHANDLE) {
|
---|
| 620 | haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST);
|
---|
| 621 | if (haccelCmdList == NULLHANDLE)
|
---|
| 622 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
| 623 | }
|
---|
| 624 | if (haccelCmdList != NULLHANDLE) {
|
---|
| 625 | if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame))
|
---|
| 626 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
| 627 | // else
|
---|
| 628 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList);
|
---|
| 629 | }
|
---|
| 630 | break;
|
---|
| 631 | case MAIN_USERLIST:
|
---|
| 632 | if (haccelUserList == NULLHANDLE) {
|
---|
| 633 | haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST);
|
---|
| 634 | if (haccelUserList == NULLHANDLE)
|
---|
| 635 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
| 636 | }
|
---|
| 637 | if (haccelUserList != NULLHANDLE) {
|
---|
| 638 | if (!WinSetAccelTable(hab, haccelUserList, hwndFrame))
|
---|
| 639 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
| 640 | // else
|
---|
| 641 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList);
|
---|
| 642 | }
|
---|
| 643 | break;
|
---|
| 644 | case MAIN_BUTTONLIST:
|
---|
| 645 | if (haccelButtonList == NULLHANDLE) {
|
---|
| 646 | haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST);
|
---|
| 647 | if (haccelButtonList == NULLHANDLE)
|
---|
| 648 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
|
---|
| 649 | }
|
---|
| 650 | if (haccelButtonList != NULLHANDLE) {
|
---|
| 651 | if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame))
|
---|
| 652 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
| 653 | // else
|
---|
| 654 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList);
|
---|
| 655 | }
|
---|
| 656 | break;
|
---|
| 657 | } // switch
|
---|
| 658 | }
|
---|
[824] | 659 | }
|
---|
| 660 | else {
|
---|
[1077] | 661 | // Losing focus
|
---|
| 662 | switch (id) {
|
---|
| 663 | case MAIN_DRIVELIST:
|
---|
| 664 | case MAIN_SETUPLIST:
|
---|
| 665 | case MAIN_CMDLIST:
|
---|
| 666 | case MAIN_USERLIST:
|
---|
| 667 | case MAIN_BUTTONLIST:
|
---|
| 668 | if (haccelSaved != NULLHANDLE) {
|
---|
| 669 | if (!WinSetAccelTable(hab, haccelSaved, hwndFrame))
|
---|
| 670 | Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
|
---|
| 671 | // else
|
---|
| 672 | // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved);
|
---|
| 673 | }
|
---|
| 674 | break;
|
---|
| 675 | } // switch
|
---|
[824] | 676 | }
|
---|
| 677 | }
|
---|
| 678 | break; // WM_FOCUSCHANGE
|
---|
| 679 |
|
---|
[133] | 680 | case WM_CONTEXTMENU:
|
---|
| 681 | {
|
---|
| 682 | MRESULT ret = MRFROMSHORT(TRUE);
|
---|
[2] | 683 |
|
---|
[133] | 684 | if (hwndMenu)
|
---|
[1077] | 685 | WinDestroyWindow(hwndMenu);
|
---|
[551] | 686 | hwndMenu = (HWND) 0;
|
---|
[133] | 687 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
[551] | 688 | switch (id) {
|
---|
[133] | 689 | case MAIN_CMDLIST:
|
---|
[1077] | 690 | WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 691 | QW_PARENT),
|
---|
| 692 | QW_PARENT),
|
---|
| 693 | FID_CLIENT),
|
---|
| 694 | WM_COMMAND, MPFROM2SHORT(IDM_EDITCOMMANDS, 0), MPVOID);
|
---|
| 695 | break;
|
---|
[133] | 696 | case MAIN_USERLIST:
|
---|
| 697 | case MAIN_SETUPLIST:
|
---|
[1077] | 698 | hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
|
---|
| 699 | if (hwndMenu)
|
---|
| 700 | PopupMenu(hwnd,
|
---|
| 701 | WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 702 | QW_PARENT),
|
---|
| 703 | QW_PARENT),
|
---|
| 704 | FID_CLIENT), hwndMenu);
|
---|
| 705 | break;
|
---|
[133] | 706 | default:
|
---|
[1077] | 707 | ret = FALSE;
|
---|
| 708 | break;
|
---|
[824] | 709 | } // switch
|
---|
[133] | 710 | return ret;
|
---|
| 711 | }
|
---|
[2] | 712 |
|
---|
[133] | 713 | case WM_CONTROL:
|
---|
[551] | 714 | if (hwndStatus2) {
|
---|
| 715 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 716 | case CBID_EDIT:
|
---|
[1077] | 717 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 718 | switch (SHORT2FROMMP(mp1)) {
|
---|
| 719 | case EN_SETFOCUS:
|
---|
| 720 | switch (id) {
|
---|
| 721 | case MAIN_CMDLIST:
|
---|
| 722 | WinSetWindowText(hwndStatus2, GetPString(IDS_CMDLISTHELP));
|
---|
| 723 | break;
|
---|
| 724 | case MAIN_SETUPLIST:
|
---|
| 725 | WinSetWindowText(hwndStatus2, GetPString(IDS_SETUPLISTHELP));
|
---|
| 726 | break;
|
---|
| 727 | case MAIN_USERLIST:
|
---|
| 728 | WinSetWindowText(hwndStatus2, GetPString(IDS_USERLISTHELP));
|
---|
| 729 | break;
|
---|
| 730 | case MAIN_DRIVELIST:
|
---|
| 731 | WinSetWindowText(hwndStatus2, GetPString(IDS_DRIVELISTHELP));
|
---|
| 732 | break;
|
---|
| 733 | case MAIN_BUTTONLIST:
|
---|
| 734 | WinSetWindowText(hwndStatus2, GetPString(IDS_BUTTONLISTHELP));
|
---|
| 735 | break;
|
---|
| 736 | default:
|
---|
| 737 | break;
|
---|
| 738 | }
|
---|
| 739 | break;
|
---|
[2] | 740 |
|
---|
[1077] | 741 | default:
|
---|
| 742 | break;
|
---|
| 743 | }
|
---|
[133] | 744 | }
|
---|
| 745 | break;
|
---|
[2] | 746 |
|
---|
[133] | 747 | default:
|
---|
| 748 | break;
|
---|
| 749 | }
|
---|
| 750 | break;
|
---|
[2] | 751 |
|
---|
[133] | 752 | case WM_BEGINDRAG:
|
---|
| 753 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[447] | 754 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"%u %s %u",id,(id == CBID_EDIT) ? "TRUE" : "FALSE",WinQueryWindowUShort(WinQueryWindow(hwnd,QW_PARENT),QWS_ID) == MAIN_USERLIST);
|
---|
[133] | 755 | if (id == CBID_EDIT &&
|
---|
[1077] | 756 | WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) ==
|
---|
| 757 | MAIN_USERLIST) {
|
---|
[2] | 758 |
|
---|
[133] | 759 | CHAR path[CCHMAXPATH];
|
---|
[2] | 760 |
|
---|
[133] | 761 | *path = 0;
|
---|
| 762 | WinQueryWindowText(hwnd, CCHMAXPATH, path);
|
---|
| 763 | bstrip(path);
|
---|
[447] | 764 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Dragging: %s",path);
|
---|
[133] | 765 | if (*path && !IsRoot(path))
|
---|
[1077] | 766 | DragOne(hwnd, (HWND) 0, path, FALSE);
|
---|
[133] | 767 | return 0;
|
---|
| 768 | }
|
---|
| 769 | break;
|
---|
[2] | 770 |
|
---|
[133] | 771 | case DM_DRAGOVER:
|
---|
| 772 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
[551] | 773 | if (id == MAIN_USERLIST) {
|
---|
| 774 | if (!emphasized) {
|
---|
[1077] | 775 | emphasized = TRUE;
|
---|
| 776 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 777 | }
|
---|
[618] | 778 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
---|
[1077] | 779 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
---|
[133] | 780 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
---|
| 781 | }
|
---|
| 782 | break;
|
---|
[2] | 783 |
|
---|
[133] | 784 | case DM_DRAGLEAVE:
|
---|
| 785 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
[551] | 786 | if (id == MAIN_USERLIST) {
|
---|
| 787 | if (emphasized) {
|
---|
[1077] | 788 | emphasized = FALSE;
|
---|
| 789 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 790 | }
|
---|
| 791 | }
|
---|
| 792 | break;
|
---|
[2] | 793 |
|
---|
[133] | 794 | case DM_DROPHELP:
|
---|
| 795 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
[551] | 796 | if (id == MAIN_USERLIST) {
|
---|
[133] | 797 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_USERLISTDROPHELP));
|
---|
| 798 | return 0;
|
---|
| 799 | }
|
---|
| 800 | break;
|
---|
[2] | 801 |
|
---|
[133] | 802 | case DM_DROP:
|
---|
| 803 | id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
|
---|
[551] | 804 | if (id == MAIN_USERLIST) {
|
---|
[2] | 805 |
|
---|
[133] | 806 | char szFrom[CCHMAXPATH + 2];
|
---|
[2] | 807 |
|
---|
[551] | 808 | if (emphasized) {
|
---|
[1077] | 809 | emphasized = FALSE;
|
---|
| 810 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 811 | }
|
---|
[618] | 812 | if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
|
---|
[1077] | 813 | MakeValidDir(szFrom);
|
---|
| 814 | WinSetWindowText(hwnd, szFrom);
|
---|
| 815 | PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 816 | QW_PARENT),
|
---|
| 817 | QW_PARENT),
|
---|
| 818 | FID_CLIENT),
|
---|
| 819 | UM_COMMAND, MPFROM2SHORT(IDM_ADDTOUSERLIST, 0), MPVOID);
|
---|
| 820 | return 0;
|
---|
[133] | 821 | }
|
---|
| 822 | }
|
---|
| 823 | break;
|
---|
[2] | 824 |
|
---|
[133] | 825 | case WM_DESTROY:
|
---|
| 826 | if (hwndMenu)
|
---|
| 827 | WinDestroyWindow(hwndMenu);
|
---|
[551] | 828 | hwndMenu = (HWND) 0;
|
---|
[133] | 829 | break;
|
---|
| 830 | }
|
---|
[2] | 831 |
|
---|
[133] | 832 | return oldproc(hwnd, msg, mp1, mp2);
|
---|
[2] | 833 | }
|
---|
| 834 |
|
---|
[133] | 835 | void BubbleHelp(HWND hwnd, BOOL other, BOOL drive, BOOL above, char *help)
|
---|
| 836 | {
|
---|
| 837 | if (help && *help &&
|
---|
| 838 | ((drive && fDrivebarHelp) ||
|
---|
[551] | 839 | (other && fOtherHelp) || (!other && !drive && fToolbarHelp))) {
|
---|
[133] | 840 | if ((!hwndBubble ||
|
---|
[1077] | 841 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
---|
| 842 | !WinQueryCapture(HWND_DESKTOP))
|
---|
[551] | 843 | MakeBubble(hwnd, above, help);
|
---|
[133] | 844 | }
|
---|
[2] | 845 | }
|
---|
| 846 |
|
---|
[133] | 847 | VOID MakeBubble(HWND hwnd, BOOL above, CHAR * help)
|
---|
| 848 | {
|
---|
| 849 | if (!hwnd || !help || !*help)
|
---|
| 850 | return;
|
---|
[2] | 851 |
|
---|
[133] | 852 | if (hwndBubble)
|
---|
| 853 | WinDestroyWindow(hwndBubble);
|
---|
[2] | 854 |
|
---|
[133] | 855 | {
|
---|
| 856 | HWND hwndActive;
|
---|
| 857 | char ucClassname[8];
|
---|
[2] | 858 |
|
---|
[133] | 859 | hwndActive = WinQueryActiveWindow(HWND_DESKTOP);
|
---|
[551] | 860 | if (hwndActive) {
|
---|
[133] | 861 | /* don't bring up help if window isn't active */
|
---|
| 862 | if (!WinIsChild(hwnd, hwndActive))
|
---|
[1077] | 863 | return;
|
---|
[133] | 864 | }
|
---|
| 865 | hwndActive = WinQueryFocus(HWND_DESKTOP);
|
---|
[551] | 866 | if (WinQueryClassName(hwndActive, sizeof(ucClassname), ucClassname)) {
|
---|
[133] | 867 | /* don't bring up help if a menu is active */
|
---|
| 868 | if (!strcmp(ucClassname, "#4"))
|
---|
[1077] | 869 | return;
|
---|
[133] | 870 | }
|
---|
| 871 | }
|
---|
[2] | 872 |
|
---|
| 873 | hwndBubble = WinCreateWindow(HWND_DESKTOP,
|
---|
[1077] | 874 | WC_BUBBLE,
|
---|
| 875 | help,
|
---|
| 876 | WS_CLIPSIBLINGS | SS_TEXT |
|
---|
| 877 | DT_CENTER | DT_VCENTER,
|
---|
| 878 | 0,
|
---|
| 879 | 0,
|
---|
| 880 | 0,
|
---|
| 881 | 0,
|
---|
| 882 | HWND_DESKTOP, HWND_TOP, MAIN_HELP, NULL, NULL);
|
---|
[376] | 883 | if (!hwndBubble)
|
---|
[551] | 884 | Win_Error2(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
[1077] | 885 | IDS_WINCREATEWINDOW);
|
---|
[551] | 886 | else {
|
---|
[133] | 887 | HPS hps;
|
---|
| 888 | POINTL aptl[TXTBOX_COUNT], ptl, tptl;
|
---|
| 889 | LONG lxScreen, sx, sy, extra = 0, lyScreen;
|
---|
| 890 | char *p, *pp, *wp;
|
---|
| 891 | SWP swp;
|
---|
[2] | 892 |
|
---|
[133] | 893 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 894 | lyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
|
---|
| 895 | lxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
|
---|
| 896 | WinSetWindowULong(hwndBubble, QWL_USER, hwnd);
|
---|
[551] | 897 | SetPresParams(hwndBubble, NULL, NULL, NULL, GetPString(IDS_8HELVTEXT));
|
---|
[133] | 898 | hps = WinGetPS(hwndBubble);
|
---|
| 899 | p = help;
|
---|
| 900 | tptl.x = tptl.y = 0;
|
---|
[551] | 901 | while (p && *p) {
|
---|
[133] | 902 | wp = NULL;
|
---|
| 903 | pp = strchr(p, '\r');
|
---|
[551] | 904 | if (pp) {
|
---|
[1077] | 905 | wp = pp;
|
---|
| 906 | *pp = 0;
|
---|
| 907 | pp++;
|
---|
[133] | 908 | }
|
---|
| 909 | GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
|
---|
| 910 | tptl.x = max(aptl[TXTBOX_TOPRIGHT].x, tptl.x);
|
---|
| 911 | if (tptl.y)
|
---|
[1077] | 912 | tptl.y += extra;
|
---|
[133] | 913 | else
|
---|
[1077] | 914 | extra = aptl[TXTBOX_TOPLEFT].y / 4;
|
---|
[133] | 915 | tptl.y += aptl[TXTBOX_TOPLEFT].y;
|
---|
| 916 | if (wp)
|
---|
[1077] | 917 | *wp = '\r';
|
---|
[133] | 918 | p = pp;
|
---|
| 919 | }
|
---|
| 920 | WinSetWindowULong(hwndBubble, QWL_USER + 4, extra);
|
---|
| 921 | WinReleasePS(hps);
|
---|
| 922 | ptl.x = ptl.y = 0;
|
---|
| 923 | WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptl, 1);
|
---|
[551] | 924 | if (above) {
|
---|
[133] | 925 | sy = ptl.y + swp.cy + 4;
|
---|
[551] | 926 | if (sy + tptl.y + 12 > lyScreen) {
|
---|
[1077] | 927 | above = FALSE;
|
---|
| 928 | sy = ptl.y - (tptl.y + 14);
|
---|
[133] | 929 | }
|
---|
| 930 | }
|
---|
| 931 | else
|
---|
| 932 | sy = ptl.y - (tptl.y + 14);
|
---|
| 933 | if (ptl.x > (lxScreen / 2))
|
---|
| 934 | sx = (ptl.x - tptl.x) - 16;
|
---|
| 935 | else
|
---|
| 936 | sx = ptl.x + (54 * (above == FALSE)) + 2;
|
---|
| 937 | if (sx < 0)
|
---|
| 938 | sx = 0;
|
---|
| 939 | if (sx + tptl.x + 14 > lxScreen)
|
---|
| 940 | sx = lxScreen - (tptl.x + 14);
|
---|
[551] | 941 | if (sy < 0) {
|
---|
[133] | 942 | sy = ptl.y + swp.cy + 4;
|
---|
| 943 | if (sy + tptl.y + 12 > lyScreen)
|
---|
[1077] | 944 | sy = 0;
|
---|
[133] | 945 | }
|
---|
| 946 | WinSetWindowPos(hwndBubble, HWND_TOP, sx, sy,
|
---|
[1077] | 947 | tptl.x + 14,
|
---|
| 948 | tptl.y + 12,
|
---|
| 949 | SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER |
|
---|
| 950 | SWP_MOVE | SWP_SIZE);
|
---|
[133] | 951 | }
|
---|
[2] | 952 | }
|
---|
| 953 |
|
---|
[133] | 954 | MRESULT EXPENTRY BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 955 | {
|
---|
[551] | 956 | switch (msg) {
|
---|
[133] | 957 | case WM_SETFOCUS:
|
---|
| 958 | if (mp2)
|
---|
[551] | 959 | PostMsg(hwnd, UM_FOCUSME, mp1, MPVOID);
|
---|
[133] | 960 | break;
|
---|
[2] | 961 |
|
---|
[133] | 962 | case UM_FOCUSME:
|
---|
[551] | 963 | WinSetFocus(HWND_DESKTOP, (HWND) mp1);
|
---|
[133] | 964 | return 0;
|
---|
[2] | 965 |
|
---|
[133] | 966 | case WM_MOUSEMOVE:
|
---|
| 967 | WinShowWindow(hwnd, FALSE);
|
---|
| 968 | break;
|
---|
[2] | 969 |
|
---|
[133] | 970 | case UM_TIMER:
|
---|
| 971 | {
|
---|
| 972 | POINTL ptl;
|
---|
[2] | 973 |
|
---|
[133] | 974 | WinQueryPointerPos(HWND_DESKTOP, &ptl);
|
---|
| 975 | if (WinWindowFromPoint(HWND_DESKTOP, &ptl, TRUE) !=
|
---|
[1077] | 976 | WinQueryWindowULong(hwnd, QWL_USER) || !WinIsWindowVisible(hwnd))
|
---|
| 977 | WinDestroyWindow(hwnd);
|
---|
[133] | 978 | }
|
---|
| 979 | return 0;
|
---|
[2] | 980 |
|
---|
[133] | 981 | case WM_PAINT:
|
---|
| 982 | {
|
---|
| 983 | HPS hps;
|
---|
| 984 | SWP swp;
|
---|
| 985 | POINTL ptl, aptl[TXTBOX_COUNT];
|
---|
| 986 | CHAR *s, *p, *pp, *wp;
|
---|
| 987 | ULONG extra, tlen, y;
|
---|
[2] | 988 |
|
---|
[133] | 989 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
---|
[551] | 990 | if (hps) {
|
---|
[1077] | 991 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 992 | GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0);
|
---|
| 993 | GpiSetColor(hps, ((255 << 16) | (255 << 8) | 198));
|
---|
| 994 | GpiSetBackMix(hps, BM_LEAVEALONE);
|
---|
| 995 | GpiSetMix(hps, FM_OVERPAINT);
|
---|
| 996 | ptl.x = ptl.y = 0;
|
---|
| 997 | GpiMove(hps, &ptl);
|
---|
| 998 | ptl.x = swp.cx - 1;
|
---|
| 999 | ptl.y = swp.cy - 1;
|
---|
| 1000 | GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
|
---|
| 1001 | tlen = WinQueryWindowTextLength(hwnd);
|
---|
| 1002 | if (tlen) {
|
---|
| 1003 | s = xmalloc(tlen + 2, pszSrcFile, __LINE__);
|
---|
| 1004 | if (s) {
|
---|
| 1005 | WinQueryWindowText(hwnd, tlen + 1, s);
|
---|
| 1006 | if (*s) {
|
---|
| 1007 | p = s;
|
---|
| 1008 | y = swp.cy - 3;
|
---|
| 1009 | extra = WinQueryWindowULong(hwnd, QWL_USER + 4);
|
---|
| 1010 | GpiSetColor(hps, 0);
|
---|
| 1011 | GpiSetMix(hps, FM_OVERPAINT);
|
---|
| 1012 | while (p && *p) {
|
---|
| 1013 | wp = NULL;
|
---|
| 1014 | pp = strchr(p, '\r');
|
---|
| 1015 | if (pp) {
|
---|
| 1016 | wp = pp;
|
---|
| 1017 | *pp = 0;
|
---|
| 1018 | pp++;
|
---|
| 1019 | }
|
---|
| 1020 | GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
|
---|
| 1021 | ptl.x = 7;
|
---|
| 1022 | y -= aptl[TXTBOX_TOPLEFT].y;
|
---|
| 1023 | if (p != s)
|
---|
| 1024 | y -= extra;
|
---|
| 1025 | ptl.y = y;
|
---|
| 1026 | GpiCharStringAt(hps, &ptl, strlen(p), p);
|
---|
| 1027 | if (wp)
|
---|
| 1028 | *wp = '\r';
|
---|
| 1029 | p = pp;
|
---|
| 1030 | }
|
---|
| 1031 | }
|
---|
| 1032 | free(s);
|
---|
| 1033 | }
|
---|
| 1034 | }
|
---|
| 1035 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) && swp.cx > 6 && swp.cy > 6) {
|
---|
| 1036 | GpiSetColor(hps, CLR_WHITE);
|
---|
| 1037 | ptl.x = 1;
|
---|
| 1038 | ptl.y = 1;
|
---|
| 1039 | GpiMove(hps, &ptl);
|
---|
| 1040 | ptl.y = swp.cy - 2;
|
---|
| 1041 | GpiLine(hps, &ptl);
|
---|
| 1042 | ptl.x = swp.cx - 2;
|
---|
| 1043 | GpiLine(hps, &ptl);
|
---|
| 1044 | ptl.x = 2;
|
---|
| 1045 | ptl.y = 2;
|
---|
| 1046 | GpiMove(hps, &ptl);
|
---|
| 1047 | ptl.y = swp.cy - 3;
|
---|
| 1048 | GpiLine(hps, &ptl);
|
---|
| 1049 | ptl.x = swp.cx - 3;
|
---|
| 1050 | GpiLine(hps, &ptl);
|
---|
| 1051 | GpiSetColor(hps, CLR_BROWN);
|
---|
| 1052 | ptl.x = 1;
|
---|
| 1053 | ptl.y = 1;
|
---|
| 1054 | GpiMove(hps, &ptl);
|
---|
| 1055 | ptl.x = swp.cx - 2;
|
---|
| 1056 | GpiLine(hps, &ptl);
|
---|
| 1057 | ptl.y = swp.cy - 2;
|
---|
| 1058 | GpiLine(hps, &ptl);
|
---|
| 1059 | ptl.x = 2;
|
---|
| 1060 | ptl.y = 2;
|
---|
| 1061 | GpiMove(hps, &ptl);
|
---|
| 1062 | ptl.x = swp.cx - 3;
|
---|
| 1063 | GpiLine(hps, &ptl);
|
---|
| 1064 | ptl.y = swp.cy - 3;
|
---|
| 1065 | GpiLine(hps, &ptl);
|
---|
| 1066 | }
|
---|
| 1067 | WinEndPaint(hps);
|
---|
[133] | 1068 | }
|
---|
| 1069 | }
|
---|
| 1070 | return 0;
|
---|
[2] | 1071 |
|
---|
[133] | 1072 | case WM_CLOSE:
|
---|
| 1073 | WinDestroyWindow(hwnd);
|
---|
| 1074 | return 0;
|
---|
[2] | 1075 |
|
---|
[133] | 1076 | case WM_DESTROY:
|
---|
[551] | 1077 | hwndBubble = (HWND) 0;
|
---|
[133] | 1078 | break;
|
---|
| 1079 | }
|
---|
| 1080 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
[2] | 1081 | }
|
---|
| 1082 |
|
---|
[133] | 1083 | MRESULT EXPENTRY LEDProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1084 | {
|
---|
[551] | 1085 | switch (msg) {
|
---|
[133] | 1086 | case WM_CREATE:
|
---|
| 1087 | {
|
---|
| 1088 | MRESULT mr = PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
| 1089 | HBITMAP hbmold = (HBITMAP) 0;
|
---|
| 1090 | HPS hps = (HPS) 0;
|
---|
[2] | 1091 |
|
---|
[551] | 1092 | switch (WinQueryWindowUShort(hwnd, QWS_ID)) {
|
---|
[133] | 1093 | case MAIN_LED:
|
---|
[1077] | 1094 | hps = WinGetPS(hwnd);
|
---|
| 1095 | hbmold = (HBITMAP) WinSendMsg(hwnd, SM_QUERYHANDLE, MPVOID, MPVOID);
|
---|
| 1096 | if (!fBlueLED) {
|
---|
| 1097 | hbmLEDon = GpiLoadBitmap(hps, 0, LEDON_BMP, 12, 12);
|
---|
| 1098 | hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF_BMP, 12, 12);
|
---|
| 1099 | }
|
---|
| 1100 | else {
|
---|
| 1101 | hbmLEDon = GpiLoadBitmap(hps, 0, LEDON2_BMP, 12, 12);
|
---|
| 1102 | hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF2_BMP, 12, 12);
|
---|
| 1103 | }
|
---|
| 1104 | if (hbmLEDoff && hbmLEDon)
|
---|
| 1105 | WinSendMsg(hwnd, SM_SETHANDLE, MPFROMLONG(hbmLEDoff), MPVOID);
|
---|
| 1106 | else {
|
---|
| 1107 | if (hbmLEDoff)
|
---|
| 1108 | GpiDeleteBitmap(hbmLEDoff);
|
---|
| 1109 | if (hbmLEDon)
|
---|
| 1110 | GpiDeleteBitmap(hbmLEDon);
|
---|
| 1111 | }
|
---|
| 1112 | if (hbmold &&
|
---|
| 1113 | hbmLEDon &&
|
---|
| 1114 | hbmLEDoff && hbmold != hbmLEDon && hbmold != hbmLEDoff)
|
---|
| 1115 | GpiDeleteBitmap(hbmold);
|
---|
| 1116 | if (hps)
|
---|
| 1117 | WinReleasePS(hps);
|
---|
| 1118 | break;
|
---|
[133] | 1119 | default:
|
---|
[1077] | 1120 | SetPresParams(hwnd,
|
---|
| 1121 | &RGBGREY,
|
---|
| 1122 | &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));
|
---|
| 1123 | break;
|
---|
[2] | 1124 | }
|
---|
[133] | 1125 | return mr;
|
---|
| 1126 | }
|
---|
[2] | 1127 |
|
---|
[133] | 1128 | case WM_SETFOCUS:
|
---|
| 1129 | if (mp2)
|
---|
[551] | 1130 | PostMsg(hwnd, UM_FOCUSME, mp1, MPVOID);
|
---|
[133] | 1131 | break;
|
---|
[2] | 1132 |
|
---|
[133] | 1133 | case UM_FOCUSME:
|
---|
[551] | 1134 | WinSetFocus(HWND_DESKTOP, (HWND) mp1);
|
---|
[133] | 1135 | return 0;
|
---|
[2] | 1136 |
|
---|
[133] | 1137 | case WM_MOUSEMOVE:
|
---|
[551] | 1138 | BubbleHelp(hwnd, TRUE, FALSE, FALSE, GetPString(IDS_LEDHELP));
|
---|
| 1139 | if (!fNoFinger) {
|
---|
[133] | 1140 | WinSetPointer(HWND_DESKTOP, hptrFinger);
|
---|
| 1141 | return MRFROMLONG(TRUE);
|
---|
| 1142 | }
|
---|
| 1143 | break;
|
---|
[2] | 1144 |
|
---|
[133] | 1145 | case WM_BUTTON1CLICK:
|
---|
| 1146 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1147 | WM_COMMAND, MPFROM2SHORT(IDM_SHOWNOTEWND, 0), MPVOID);
|
---|
[133] | 1148 | break;
|
---|
[2] | 1149 |
|
---|
[133] | 1150 | case WM_BUTTON2CLICK:
|
---|
| 1151 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1152 | WM_COMMAND, MPFROM2SHORT(IDM_HIDENOTEWND, 0), MPVOID);
|
---|
[133] | 1153 | break;
|
---|
[2] | 1154 |
|
---|
[133] | 1155 | case WM_CHORD:
|
---|
| 1156 | case WM_BUTTON3CLICK:
|
---|
| 1157 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1158 | WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
---|
[133] | 1159 | break;
|
---|
| 1160 | }
|
---|
| 1161 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
[2] | 1162 | }
|
---|
| 1163 |
|
---|
[133] | 1164 | MRESULT EXPENTRY ChildButtonProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1165 | {
|
---|
| 1166 | USHORT id;
|
---|
[672] | 1167 | TOOL *tool;
|
---|
| 1168 |
|
---|
[551] | 1169 | static HWND hwndMenu = (HWND) 0;
|
---|
[2] | 1170 |
|
---|
[551] | 1171 | switch (msg) {
|
---|
[133] | 1172 | case WM_BUTTON1DOWN:
|
---|
| 1173 | case WM_BUTTON2DOWN:
|
---|
| 1174 | case WM_BUTTON3DOWN:
|
---|
| 1175 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 1176 | break;
|
---|
[2] | 1177 |
|
---|
[133] | 1178 | case WM_MOUSEMOVE:
|
---|
[551] | 1179 | if (fToolbarHelp) {
|
---|
| 1180 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
---|
[1077] | 1181 | && !WinQueryCapture(HWND_DESKTOP)) {
|
---|
| 1182 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 1183 | tool = find_tool(id);
|
---|
| 1184 | if (tool && tool->help && *tool->help) {
|
---|
[2] | 1185 |
|
---|
[1077] | 1186 | char s[128];
|
---|
[2] | 1187 |
|
---|
[1077] | 1188 | strcpy(s, tool->help);
|
---|
| 1189 | if (tool->flags & T_DROPABLE)
|
---|
| 1190 | strcat(s, GetPString(IDS_DROPONMETEXT));
|
---|
| 1191 | MakeBubble(hwnd, FALSE, s);
|
---|
| 1192 | }
|
---|
[133] | 1193 | }
|
---|
| 1194 | }
|
---|
| 1195 | break;
|
---|
[2] | 1196 |
|
---|
[133] | 1197 | case WM_COMMAND:
|
---|
[551] | 1198 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 1199 | case IDM_HELP:
|
---|
| 1200 | if (hwndHelp)
|
---|
[1077] | 1201 | WinSendMsg(hwndHelp,
|
---|
| 1202 | HM_DISPLAY_HELP,
|
---|
| 1203 | MPFROM2SHORT(HELP_TOOLBAR, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
[133] | 1204 | break;
|
---|
[2] | 1205 |
|
---|
[930] | 1206 | case IDM_HIDEANYTOOL: /* hide any tool */
|
---|
| 1207 | case IDM_HIDETOOL: /* hide tool */
|
---|
[133] | 1208 | if (SHORT1FROMMP(mp1) == IDM_HIDETOOL)
|
---|
[1077] | 1209 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[133] | 1210 | else
|
---|
[1077] | 1211 | id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd,
|
---|
| 1212 | PickToolProc, FM3ModHandle,
|
---|
| 1213 | PICKBTN_FRAME, GetPString(IDS_HIDETEXT));
|
---|
[551] | 1214 | if (id) {
|
---|
[1077] | 1215 | tool = find_tool(id);
|
---|
| 1216 | if (tool) {
|
---|
| 1217 | tool->flags |= T_INVISIBLE;
|
---|
| 1218 | fToolsChanged = TRUE;
|
---|
| 1219 | }
|
---|
[133] | 1220 | }
|
---|
| 1221 | break;
|
---|
[2] | 1222 |
|
---|
[930] | 1223 | case IDM_SHOWTOOLS: /* show all tools */
|
---|
[133] | 1224 | tool = toolhead;
|
---|
[551] | 1225 | while (tool) {
|
---|
[1077] | 1226 | tool->flags &= (~T_INVISIBLE);
|
---|
| 1227 | tool = tool->next;
|
---|
| 1228 | fToolsChanged = TRUE;
|
---|
[133] | 1229 | }
|
---|
| 1230 | break;
|
---|
[2] | 1231 |
|
---|
[930] | 1232 | case IDM_DELETEANYTOOL: /* delete any button */
|
---|
| 1233 | case IDM_DELETETOOL: /* delete button */
|
---|
[133] | 1234 | if (SHORT1FROMMP(mp1) == IDM_DELETETOOL)
|
---|
[1077] | 1235 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[133] | 1236 | else
|
---|
[1077] | 1237 | id =
|
---|
| 1238 | (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
|
---|
| 1239 | PICKBTN_FRAME, GetPString(IDS_DELETETEXT));
|
---|
[133] | 1240 | if (id)
|
---|
[1077] | 1241 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP,
|
---|
| 1242 | MPFROM2SHORT(id, 0), MPVOID);
|
---|
[133] | 1243 | return 0;
|
---|
[2] | 1244 |
|
---|
[930] | 1245 | case IDM_EDITANYTOOL: /* edit any button */
|
---|
| 1246 | case IDM_EDITTOOL: /* edit button */
|
---|
[133] | 1247 | if (SHORT1FROMMP(mp1) == IDM_EDITTOOL)
|
---|
[1077] | 1248 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[133] | 1249 | else
|
---|
[1077] | 1250 | id =
|
---|
| 1251 | (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
|
---|
| 1252 | PICKBTN_FRAME, GetPString(IDS_EDITTEXT));
|
---|
[551] | 1253 | if (id) {
|
---|
[1077] | 1254 | tool = find_tool(id);
|
---|
| 1255 | if (tool) {
|
---|
| 1256 | if (WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,
|
---|
| 1257 | ADDBTN_FRAME, (PVOID) tool))
|
---|
| 1258 | WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 1259 | QW_PARENT),
|
---|
| 1260 | QW_PARENT), FID_CLIENT),
|
---|
| 1261 | WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),
|
---|
| 1262 | MPFROM2SHORT(id, 0));
|
---|
| 1263 | }
|
---|
[133] | 1264 | }
|
---|
| 1265 | break;
|
---|
[2] | 1266 |
|
---|
[930] | 1267 | case IDM_ADDTOOL: /* add tool */
|
---|
[133] | 1268 | id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,
|
---|
[1077] | 1269 | ADDBTN_FRAME, MPVOID);
|
---|
[133] | 1270 | if (id && id != (USHORT) - 1)
|
---|
[1077] | 1271 | WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 1272 | QW_PARENT),
|
---|
| 1273 | QW_PARENT), FID_CLIENT),
|
---|
| 1274 | WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),
|
---|
| 1275 | MPFROM2SHORT(id, 0));
|
---|
[133] | 1276 | break;
|
---|
[2] | 1277 |
|
---|
[930] | 1278 | case IDM_REORDERTOOLS: /* reorder tools */
|
---|
[133] | 1279 | WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 1280 | hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID);
|
---|
[133] | 1281 | break;
|
---|
[2] | 1282 |
|
---|
[133] | 1283 | case IDM_SAVETOOLS:
|
---|
| 1284 | case IDM_LOADTOOLS:
|
---|
| 1285 | if (WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 1286 | hwnd,
|
---|
| 1287 | ToolIODlgProc,
|
---|
| 1288 | FM3ModHandle,
|
---|
| 1289 | SVBTN_FRAME,
|
---|
| 1290 | (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ?
|
---|
| 1291 | "TRUE" : NULL))
|
---|
| 1292 | BuildTools(hwndToolback, TRUE);
|
---|
[133] | 1293 | break;
|
---|
| 1294 | }
|
---|
| 1295 | ResizeTools(WinQueryWindow(hwnd, QW_PARENT));
|
---|
| 1296 | return 0;
|
---|
[2] | 1297 |
|
---|
[133] | 1298 | case WM_MENUEND:
|
---|
[551] | 1299 | if (hwndMenu == (HWND) mp2) {
|
---|
[133] | 1300 | WinDestroyWindow(hwndMenu);
|
---|
[551] | 1301 | hwndMenu = (HWND) 0;
|
---|
[133] | 1302 | }
|
---|
| 1303 | break;
|
---|
[2] | 1304 |
|
---|
[133] | 1305 | case WM_CONTEXTMENU:
|
---|
| 1306 | DosEnterCritSec();
|
---|
| 1307 | if (!hwndMenu)
|
---|
| 1308 | hwndMenu = WinLoadMenu(hwnd, FM3ModHandle, ID_BUTTONMENU);
|
---|
| 1309 | DosExitCritSec();
|
---|
[877] | 1310 | SetPresParams(hwndMenu, NULL, NULL, NULL, GetPString(IDS_10SYSPROTEXT));
|
---|
[133] | 1311 | if (PopupMenu(hwnd, hwnd, hwndMenu))
|
---|
| 1312 | WinShowWindow(hwndMenu, TRUE);
|
---|
| 1313 | return MRFROMSHORT(TRUE);
|
---|
[2] | 1314 |
|
---|
[133] | 1315 | case DM_DRAGOVER:
|
---|
| 1316 | {
|
---|
[930] | 1317 | PDRAGINFO pDInfo; /* Pointer to DRAGINFO */
|
---|
[2] | 1318 |
|
---|
[930] | 1319 | pDInfo = (PDRAGINFO) mp1; /* Get DRAGINFO pointer */
|
---|
| 1320 | DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
|
---|
[133] | 1321 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 1322 | tool = find_tool(id);
|
---|
[551] | 1323 | if (!tool) {
|
---|
[1077] | 1324 | DrgFreeDraginfo(pDInfo);
|
---|
| 1325 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
---|
[133] | 1326 | }
|
---|
[551] | 1327 | if (!(tool->flags & T_DROPABLE)) {
|
---|
[1077] | 1328 | DrgFreeDraginfo(pDInfo);
|
---|
| 1329 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
---|
[133] | 1330 | }
|
---|
| 1331 | {
|
---|
[1077] | 1332 | PDRAGITEM pDItem; /* Pointer to DRAGITEM */
|
---|
[2] | 1333 |
|
---|
[1077] | 1334 | pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
|
---|
| 1335 | 0); /* Index to DRAGITEM */
|
---|
| 1336 | if (DrgVerifyRMF(pDItem, /* Check valid rendering */
|
---|
| 1337 | DRM_OS2FILE, /* mechanisms and data */
|
---|
| 1338 | NULL)) { /* formats */
|
---|
| 1339 | if (!(tool->flags & T_EMPHASIZED)) {
|
---|
| 1340 | tool->flags |= T_EMPHASIZED;
|
---|
| 1341 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
---|
| 1342 | DrgFreeDraginfo(pDInfo);
|
---|
| 1343 | }
|
---|
| 1344 | return (MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
|
---|
| 1345 | DO_MOVE)); /* Move operation valid */
|
---|
| 1346 | }
|
---|
| 1347 | DrgFreeDraginfo(pDInfo);
|
---|
[133] | 1348 | }
|
---|
| 1349 | }
|
---|
[930] | 1350 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
---|
[2] | 1351 |
|
---|
[133] | 1352 | case DM_DROPHELP:
|
---|
| 1353 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 1354 | tool = find_tool(id);
|
---|
| 1355 | PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
| 1356 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_TOOLDROPHELP));
|
---|
| 1357 | return 0;
|
---|
[2] | 1358 |
|
---|
[133] | 1359 | case DM_DRAGLEAVE:
|
---|
| 1360 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 1361 | tool = find_tool(id);
|
---|
[551] | 1362 | if (tool && (tool->flags & T_DROPABLE)) {
|
---|
| 1363 | if (tool->flags & T_EMPHASIZED) {
|
---|
[1077] | 1364 | tool->flags &= (~T_EMPHASIZED);
|
---|
| 1365 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
---|
[133] | 1366 | }
|
---|
| 1367 | }
|
---|
| 1368 | break;
|
---|
[2] | 1369 |
|
---|
[133] | 1370 | case DM_DROP:
|
---|
| 1371 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 1372 | tool = find_tool(id);
|
---|
[551] | 1373 | if (tool && (tool->flags & T_DROPABLE) != 0) {
|
---|
[133] | 1374 | LISTINFO *li;
|
---|
| 1375 | CNRDRAGINFO cdi;
|
---|
[2] | 1376 |
|
---|
[551] | 1377 | if (tool->flags & T_EMPHASIZED) {
|
---|
[1077] | 1378 | DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
|
---|
| 1379 | tool->flags &= (~T_EMPHASIZED);
|
---|
[133] | 1380 | }
|
---|
| 1381 | memset(&cdi, 0, sizeof(cdi));
|
---|
| 1382 | cdi.pDragInfo = mp1;
|
---|
[551] | 1383 | li = DoFileDrop(hwnd, NULL, FALSE, mp1, MPFROMP(&cdi));
|
---|
[687] | 1384 | CheckPmDrgLimit(cdi.pDragInfo);
|
---|
[551] | 1385 | if (li) {
|
---|
[1077] | 1386 | li->type = id;
|
---|
| 1387 | if (!li->list || !li->list[0])
|
---|
| 1388 | FreeListInfo(li);
|
---|
| 1389 | else {
|
---|
| 1390 | HWND hwndActive;
|
---|
[2] | 1391 |
|
---|
[1077] | 1392 | hwndActive = TopWindow(hwndMain, (HWND) 0);
|
---|
| 1393 | if (hwndActive) {
|
---|
| 1394 | if (!WinSendMsg(hwndActive, UM_COMMAND, MPFROMP(li), MPVOID))
|
---|
| 1395 | FreeListInfo(li);
|
---|
| 1396 | }
|
---|
| 1397 | else
|
---|
| 1398 | FreeListInfo(li);
|
---|
| 1399 | }
|
---|
[133] | 1400 | }
|
---|
| 1401 | }
|
---|
| 1402 | return 0;
|
---|
[2] | 1403 |
|
---|
[133] | 1404 | case WM_CLOSE:
|
---|
| 1405 | WinDestroyWindow(hwnd);
|
---|
| 1406 | return 0;
|
---|
| 1407 | }
|
---|
| 1408 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
[2] | 1409 | }
|
---|
| 1410 |
|
---|
[133] | 1411 | VOID BuildTools(HWND hwndT, BOOL resize)
|
---|
| 1412 | {
|
---|
[376] | 1413 | TOOL *tool;
|
---|
| 1414 | ULONG ctrlxpos = 18L;
|
---|
[133] | 1415 | CHAR s[33];
|
---|
| 1416 | HENUM henum;
|
---|
| 1417 | HWND hwndTool;
|
---|
[2] | 1418 |
|
---|
[133] | 1419 | henum = WinBeginEnumWindows(hwndT);
|
---|
| 1420 | while ((hwndTool = WinGetNextWindow(henum)) != NULLHANDLE)
|
---|
| 1421 | WinDestroyWindow(hwndTool);
|
---|
| 1422 | WinEndEnumWindows(henum);
|
---|
[551] | 1423 | if (!fToolbar) {
|
---|
[133] | 1424 | load_quicktools();
|
---|
| 1425 | load_tools(NULL);
|
---|
| 1426 | return;
|
---|
| 1427 | }
|
---|
| 1428 | if (!toolhead)
|
---|
| 1429 | load_tools(NULL);
|
---|
| 1430 | tool = toolhead;
|
---|
[551] | 1431 | while (tool) {
|
---|
| 1432 | sprintf(s, "#%u", tool->id);
|
---|
| 1433 | hwndTool = (HWND) 0;
|
---|
[376] | 1434 | if (!fTextTools) {
|
---|
[551] | 1435 | if (!(tool->flags & T_MYICON)) {
|
---|
[1077] | 1436 | hwndTool = WinCreateWindow(hwndT,
|
---|
| 1437 | WC_TOOLBUTTONS,
|
---|
| 1438 | s,
|
---|
| 1439 | BS_NOPOINTERFOCUS |
|
---|
| 1440 | BS_BITMAP | BS_PUSHBUTTON,
|
---|
| 1441 | ctrlxpos,
|
---|
| 1442 | 14,
|
---|
| 1443 | 32,
|
---|
| 1444 | 32, hwndT, HWND_TOP, tool->id, NULL, NULL);
|
---|
[376] | 1445 | }
|
---|
| 1446 | if (!hwndTool) {
|
---|
[1077] | 1447 | HBITMAP hbm = LoadBitmapFromFileNum(tool->id);
|
---|
[551] | 1448 |
|
---|
[1077] | 1449 | if (hbm) {
|
---|
| 1450 | BTNCDATA btc;
|
---|
[551] | 1451 |
|
---|
[1077] | 1452 | memset(&btc, 0, sizeof(btc));
|
---|
| 1453 | btc.cb = sizeof(btc);
|
---|
| 1454 | btc.hImage = hbm;
|
---|
| 1455 | hwndTool = WinCreateWindow(hwndT,
|
---|
| 1456 | WC_TOOLBUTTONS,
|
---|
| 1457 | NullStr,
|
---|
| 1458 | BS_NOPOINTERFOCUS |
|
---|
| 1459 | BS_BITMAP | BS_PUSHBUTTON,
|
---|
| 1460 | ctrlxpos,
|
---|
| 1461 | 14,
|
---|
| 1462 | 32,
|
---|
| 1463 | 32,
|
---|
| 1464 | hwndT, HWND_TOP, tool->id, &btc, NULL);
|
---|
| 1465 | if (!hwndTool)
|
---|
| 1466 | GpiDeleteBitmap(hbm);
|
---|
| 1467 | }
|
---|
[133] | 1468 | }
|
---|
| 1469 | if (hwndTool)
|
---|
[1077] | 1470 | tool->flags &= (~T_TEXT);
|
---|
[133] | 1471 | }
|
---|
[376] | 1472 | if (!hwndTool) {
|
---|
| 1473 | hwndTool = WinCreateWindow(hwndT,
|
---|
[1077] | 1474 | WC_TOOLBUTTONS,
|
---|
| 1475 | (!tool->text && tool->id >= IDM_COMMANDSTART
|
---|
| 1476 | && tool->id <
|
---|
| 1477 | IDM_QUICKTOOLSTART) ? command_title(tool->
|
---|
| 1478 | id -
|
---|
| 1479 | IDM_COMMANDSTART)
|
---|
| 1480 | : tool->text,
|
---|
| 1481 | BS_NOPOINTERFOCUS | BS_PUSHBUTTON, ctrlxpos,
|
---|
| 1482 | 2, 54, 24, hwndT, HWND_TOP, tool->id, NULL,
|
---|
| 1483 | NULL);
|
---|
[376] | 1484 | if (!hwndTool)
|
---|
[1077] | 1485 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 1486 | IDS_WINCREATEWINDOW);
|
---|
[551] | 1487 | tool->flags |= T_TEXT;
|
---|
[133] | 1488 | }
|
---|
[551] | 1489 | if (fToolTitles && !fTextTools) {
|
---|
[376] | 1490 | hwndTool = WinCreateWindow(hwndT,
|
---|
[1077] | 1491 | WC_STATIC,
|
---|
| 1492 | tool->text,
|
---|
| 1493 | SS_TEXT | DT_LEFT | DT_VCENTER,
|
---|
| 1494 | ctrlxpos,
|
---|
| 1495 | 1,
|
---|
| 1496 | 32,
|
---|
| 1497 | 10,
|
---|
| 1498 | hwndT,
|
---|
| 1499 | HWND_TOP, tool->id + 25000, NULL, NULL);
|
---|
[376] | 1500 | if (!hwndTool)
|
---|
[1077] | 1501 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 1502 | IDS_WINCREATEWINDOW);
|
---|
[376] | 1503 | else {
|
---|
[1077] | 1504 | SetPresParams(hwndTool,
|
---|
| 1505 | &RGBGREY,
|
---|
| 1506 | &RGBBLACK, &RGBGREY, GetPString(IDS_2SYSTEMVIOTEXT));
|
---|
[376] | 1507 | }
|
---|
[133] | 1508 | }
|
---|
[551] | 1509 | ctrlxpos += ((tool->flags & T_TEXT) ? 55L : 33L);
|
---|
| 1510 | SetPresParams(WinWindowFromID(hwndT, tool->id),
|
---|
[1077] | 1511 | NULL, NULL, NULL, GetPString(IDS_8HELVTEXT));
|
---|
[551] | 1512 | tool = tool->next;
|
---|
[930] | 1513 | } // while tool
|
---|
[376] | 1514 |
|
---|
| 1515 | hwndTool = WinCreateWindow(hwndT,
|
---|
[1077] | 1516 | WC_BUTTON,
|
---|
| 1517 | "#6010",
|
---|
| 1518 | BS_NOPOINTERFOCUS |
|
---|
| 1519 | BS_BITMAP | BS_PUSHBUTTON,
|
---|
| 1520 | 1,
|
---|
| 1521 | 19,
|
---|
| 1522 | 14,
|
---|
| 1523 | 13, hwndT, HWND_TOP, IDM_TOOLLEFT, NULL, NULL);
|
---|
[376] | 1524 | if (!hwndTool)
|
---|
[551] | 1525 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
[1077] | 1526 | IDS_WINCREATEWINDOW);
|
---|
[551] | 1527 | hwndTool =
|
---|
| 1528 | WinCreateWindow(hwndT, WC_BUTTON, "#6011",
|
---|
[1077] | 1529 | BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 1, 4, 14,
|
---|
| 1530 | 13, hwndT, HWND_TOP, IDM_TOOLRIGHT, NULL, NULL);
|
---|
[376] | 1531 | if (!hwndTool)
|
---|
[551] | 1532 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
[1077] | 1533 | IDS_WINCREATEWINDOW);
|
---|
[133] | 1534 | if (resize)
|
---|
| 1535 | ResizeTools(hwndT);
|
---|
[2] | 1536 | }
|
---|
| 1537 |
|
---|
[551] | 1538 | static MRESULT EXPENTRY CommandLineProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
[1077] | 1539 | MPARAM mp2)
|
---|
[133] | 1540 | {
|
---|
| 1541 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 1542 | static BOOL lbup = FALSE;
|
---|
[2] | 1543 |
|
---|
[551] | 1544 | switch (msg) {
|
---|
[133] | 1545 | case UM_FOCUSME:
|
---|
[551] | 1546 | WinSetFocus(HWND_DESKTOP, hwnd);
|
---|
[133] | 1547 | return 0;
|
---|
[2] | 1548 |
|
---|
[133] | 1549 | case WM_SETFOCUS:
|
---|
[551] | 1550 | if (!mp2 && !lbup) {
|
---|
[2] | 1551 |
|
---|
[133] | 1552 | PID pid;
|
---|
| 1553 | TID tid;
|
---|
[2] | 1554 |
|
---|
[551] | 1555 | if (WinQueryWindowUShort((HWND) mp1, QWS_ID) == COMMAND_BUTTON)
|
---|
[1077] | 1556 | break;
|
---|
[551] | 1557 | if (!WinQueryWindowProcess((HWND) mp1, &pid, &tid) || pid == mypid)
|
---|
[1077] | 1558 | WinDestroyWindow(hwnd);
|
---|
[133] | 1559 | }
|
---|
| 1560 | break;
|
---|
[2] | 1561 |
|
---|
[133] | 1562 | case UM_RESCAN:
|
---|
| 1563 | {
|
---|
[989] | 1564 | PSZ pszCmdLine;
|
---|
[2] | 1565 |
|
---|
[989] | 1566 | pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
| 1567 | if (pszCmdLine) {
|
---|
[1077] | 1568 | lbup = TRUE;
|
---|
| 1569 | if (WinDlgBox(HWND_DESKTOP,
|
---|
| 1570 | hwnd,
|
---|
| 1571 | CmdLine2DlgProc,
|
---|
| 1572 | FM3ModHandle, EXEC2_FRAME, MPFROMP(pszCmdLine))) {
|
---|
| 1573 | lstrip(pszCmdLine);
|
---|
| 1574 | WinSetWindowText(hwnd, pszCmdLine);
|
---|
| 1575 | }
|
---|
| 1576 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
| 1577 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
| 1578 | free(pszCmdLine);
|
---|
[133] | 1579 | }
|
---|
| 1580 | }
|
---|
| 1581 | return 0;
|
---|
[2] | 1582 |
|
---|
[133] | 1583 | case UM_SETUP:
|
---|
| 1584 | lbup = FALSE;
|
---|
| 1585 | return 0;
|
---|
[2] | 1586 |
|
---|
[133] | 1587 | case WM_BUTTON1DBLCLK:
|
---|
[551] | 1588 | PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID);
|
---|
[133] | 1589 | return 0;
|
---|
[2] | 1590 |
|
---|
[133] | 1591 | case WM_COMMAND:
|
---|
[551] | 1592 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 1593 | case COMMAND_BUTTON:
|
---|
| 1594 | if (!lbup)
|
---|
[1077] | 1595 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
[133] | 1596 | break;
|
---|
| 1597 | }
|
---|
| 1598 | return 0;
|
---|
[2] | 1599 |
|
---|
[133] | 1600 | case UM_OPENWINDOWFORME:
|
---|
| 1601 | {
|
---|
| 1602 | static char directory[CCHMAXPATH], cl[1000];
|
---|
| 1603 | char **list = NULL;
|
---|
| 1604 | ULONG len;
|
---|
| 1605 | HWND hwndCnr;
|
---|
[2] | 1606 |
|
---|
[133] | 1607 | *directory = *cl = 0;
|
---|
| 1608 | strcpy(cl, GetCmdSpec(FALSE));
|
---|
| 1609 | strcat(cl, " /C ");
|
---|
| 1610 | len = strlen(cl);
|
---|
| 1611 | WinQueryWindowText(hwnd, 1000 - len, cl + len);
|
---|
| 1612 | bstrip(cl + len);
|
---|
[551] | 1613 | if (strlen(cl) > len) {
|
---|
[1077] | 1614 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 1615 | UM_SETUP, MPFROMP(cl + len), MPVOID);
|
---|
| 1616 | WinQueryWindowText(hwndStatus, CCHMAXPATH, directory);
|
---|
| 1617 | bstrip(directory);
|
---|
| 1618 | if (*directory && (IsRoot(directory) || !IsFile(directory))) {
|
---|
| 1619 | if (!FM2Command(directory, cl + len)) {
|
---|
| 1620 | hwndCnr = TopWindow(hwndMain, (HWND) 0);
|
---|
| 1621 | if (hwndCnr) {
|
---|
| 1622 | hwndCnr = WinWindowFromID(hwndCnr, FID_CLIENT);
|
---|
| 1623 | if (hwndCnr) {
|
---|
| 1624 | hwndCnr = WinWindowFromID(hwndCnr, DIR_CNR);
|
---|
| 1625 | if (hwndCnr)
|
---|
| 1626 | list = BuildList(hwndCnr);
|
---|
| 1627 | }
|
---|
| 1628 | }
|
---|
| 1629 | WinSetActiveWindow(HWND_DESKTOP, hwndCnr);
|
---|
| 1630 | if (add_cmdline(cl + len, FALSE) && fSaveMiniCmds)
|
---|
| 1631 | save_cmdlines(FALSE);
|
---|
| 1632 | ExecOnList(hwndCnr,
|
---|
| 1633 | cl,
|
---|
| 1634 | WINDOWED | ((fKeepCmdLine) ?
|
---|
| 1635 | SEPARATEKEEP : SEPARATE),
|
---|
| 1636 | directory, list, NULL, pszSrcFile, __LINE__);
|
---|
| 1637 | xfree(list, pszSrcFile, __LINE__);
|
---|
| 1638 | WinDestroyWindow(hwnd);
|
---|
| 1639 | break;
|
---|
| 1640 | }
|
---|
| 1641 | }
|
---|
[133] | 1642 | }
|
---|
| 1643 | WinSendMsg(hwnd, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);
|
---|
| 1644 | }
|
---|
| 1645 | return 0;
|
---|
[2] | 1646 |
|
---|
[133] | 1647 | case WM_CHAR:
|
---|
[551] | 1648 | if (!lbup && !(SHORT1FROMMP(mp1) & KC_KEYUP)) {
|
---|
| 1649 | if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
|
---|
[1077] | 1650 | if ((SHORT1FROMMP(mp2) & 255) == '\r')
|
---|
| 1651 | PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID);
|
---|
| 1652 | else if ((SHORT1FROMMP(mp2) & 0xff) == 0x1b)
|
---|
| 1653 | WinDestroyWindow(hwnd);
|
---|
| 1654 | else if (SHORT2FROMMP(mp2) == VK_UP || SHORT2FROMMP(mp2) == VK_DOWN)
|
---|
| 1655 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
[133] | 1656 | }
|
---|
| 1657 | }
|
---|
| 1658 | else if ((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) &&
|
---|
[1077] | 1659 | ((SHORT2FROMMP(mp2) == VK_UP ||
|
---|
| 1660 | SHORT2FROMMP(mp2) == VK_DOWN) ||
|
---|
| 1661 | (SHORT1FROMMP(mp2) == '\x1b') || (SHORT1FROMMP(mp2) == '\r')))
|
---|
[133] | 1662 | return 0;
|
---|
| 1663 | break;
|
---|
[2] | 1664 |
|
---|
[133] | 1665 | case WM_DESTROY:
|
---|
[551] | 1666 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_RESCAN, MPVOID, MPVOID);
|
---|
[133] | 1667 | lbup = FALSE;
|
---|
| 1668 | break;
|
---|
| 1669 | }
|
---|
| 1670 | return oldproc(hwnd, msg, mp1, mp2);
|
---|
[2] | 1671 | }
|
---|
| 1672 |
|
---|
[133] | 1673 | MRESULT EXPENTRY DriveBackProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1674 | {
|
---|
[551] | 1675 | switch (msg) {
|
---|
[133] | 1676 | case WM_CREATE:
|
---|
[551] | 1677 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
[133] | 1678 | break;
|
---|
[2] | 1679 |
|
---|
[133] | 1680 | case UM_SETUP:
|
---|
| 1681 | {
|
---|
| 1682 | RGB2 rgb;
|
---|
[2] | 1683 |
|
---|
[133] | 1684 | memset(&rgb, 0, sizeof(rgb));
|
---|
[689] | 1685 | rgb.bRed = (BYTE)128;
|
---|
[133] | 1686 | SetPresParams(hwnd,
|
---|
[1077] | 1687 | &RGBGREY, &rgb, &RGBGREY, GetPString(IDS_8HELVTEXT));
|
---|
[133] | 1688 | SetTargetDir(hwnd, TRUE);
|
---|
| 1689 | }
|
---|
| 1690 | return 0;
|
---|
[2] | 1691 |
|
---|
[133] | 1692 | case WM_SETFOCUS:
|
---|
| 1693 | case UM_FOCUSME:
|
---|
| 1694 | case WM_BUTTON1DOWN:
|
---|
| 1695 | case WM_BUTTON1UP:
|
---|
| 1696 | case WM_BUTTON2DOWN:
|
---|
| 1697 | case WM_BUTTON2UP:
|
---|
| 1698 | case WM_BUTTON3DOWN:
|
---|
| 1699 | case WM_BUTTON3UP:
|
---|
| 1700 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
[2] | 1701 |
|
---|
[133] | 1702 | case WM_MOUSEMOVE:
|
---|
| 1703 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 1704 | break;
|
---|
[2] | 1705 |
|
---|
[133] | 1706 | case UM_CLICKED:
|
---|
| 1707 | case UM_CLICKED3:
|
---|
[551] | 1708 | PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_SETTARGET, 0), MPVOID);
|
---|
[133] | 1709 | return 0;
|
---|
[2] | 1710 |
|
---|
[133] | 1711 | case WM_CHAR:
|
---|
| 1712 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 1713 | break;
|
---|
[2] | 1714 |
|
---|
[133] | 1715 | case WM_CONTROLPOINTER:
|
---|
| 1716 | if (!fNoFinger &&
|
---|
[1077] | 1717 | (SHORT1FROMMP(mp1) >= IDM_DRIVEA &&
|
---|
| 1718 | SHORT1FROMMP(mp1) < IDM_DRIVEA + 26))
|
---|
[133] | 1719 | return MRFROMLONG(hptrFinger);
|
---|
| 1720 | break;
|
---|
[2] | 1721 |
|
---|
[133] | 1722 | case WM_COMMAND:
|
---|
| 1723 | {
|
---|
| 1724 | CHAR dv[4];
|
---|
[2] | 1725 |
|
---|
[133] | 1726 | *dv = 0;
|
---|
| 1727 | WinQueryWindowText(WinWindowFromID(hwnd, SHORT1FROMMP(mp1) + 50),
|
---|
[1077] | 1728 | 2, dv);
|
---|
[551] | 1729 | if (isalpha(*dv)) {
|
---|
[2] | 1730 |
|
---|
[1077] | 1731 | HWND hwndActive;
|
---|
[2] | 1732 |
|
---|
[1077] | 1733 | dv[1] = ':';
|
---|
| 1734 | dv[2] = '\\';
|
---|
| 1735 | dv[3] = 0;
|
---|
| 1736 | hwndActive = TopWindow(hwnd, (HWND) 0);
|
---|
| 1737 | if (hwndActive)
|
---|
| 1738 | WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT),
|
---|
| 1739 | UM_DRIVECMD, MPFROMP(dv), MPVOID);
|
---|
[133] | 1740 | }
|
---|
| 1741 | }
|
---|
| 1742 | return 0;
|
---|
[2] | 1743 |
|
---|
[133] | 1744 | case WM_PAINT:
|
---|
[551] | 1745 | PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
|
---|
[133] | 1746 | break;
|
---|
[2] | 1747 |
|
---|
[133] | 1748 | case WM_CLOSE:
|
---|
| 1749 | WinDestroyWindow(hwnd);
|
---|
| 1750 | return 0;
|
---|
| 1751 | }
|
---|
| 1752 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
[2] | 1753 | }
|
---|
| 1754 |
|
---|
[133] | 1755 | MRESULT EXPENTRY DriveProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1756 | {
|
---|
| 1757 | USHORT id;
|
---|
[297] | 1758 | CHAR szDrv[CCHMAXPATH];
|
---|
| 1759 |
|
---|
[133] | 1760 | static BOOL emphasized = FALSE;
|
---|
[297] | 1761 | static HWND hwndMenu = NULLHANDLE;
|
---|
[2] | 1762 | static USHORT helpid = 0;
|
---|
| 1763 |
|
---|
[551] | 1764 | switch (msg) {
|
---|
[133] | 1765 | case WM_MOUSEMOVE:
|
---|
| 1766 | if (fDrivebarHelp &&
|
---|
[1077] | 1767 | (!hwndBubble ||
|
---|
| 1768 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
---|
| 1769 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
[133] | 1770 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 1771 | if (helpid != id) {
|
---|
[1077] | 1772 | helpid = id;
|
---|
| 1773 | PostMsg(MainObjectHwnd, UM_SETUP6, MPFROMLONG((ULONG) hwnd), MPVOID);
|
---|
[2] | 1774 | }
|
---|
[133] | 1775 | else
|
---|
[1077] | 1776 | helpid = 0;
|
---|
[133] | 1777 | }
|
---|
| 1778 | break;
|
---|
[2] | 1779 |
|
---|
[133] | 1780 | case UM_SETUP6:
|
---|
[551] | 1781 | if (helpid == WinQueryWindowUShort(hwnd, QWS_ID)) {
|
---|
| 1782 | if ((char *)mp1 &&
|
---|
[1077] | 1783 | (!hwndBubble ||
|
---|
| 1784 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
---|
| 1785 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
[2] | 1786 |
|
---|
[1077] | 1787 | RECTL rcl;
|
---|
| 1788 | POINTL ptl;
|
---|
[2] | 1789 |
|
---|
[1077] | 1790 | WinQueryPointerPos(HWND_DESKTOP, &ptl);
|
---|
| 1791 | WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);
|
---|
| 1792 | WinQueryWindowRect(hwnd, &rcl);
|
---|
| 1793 | if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl))
|
---|
| 1794 | BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1);
|
---|
[2] | 1795 | }
|
---|
[133] | 1796 | }
|
---|
| 1797 | return 0;
|
---|
[2] | 1798 |
|
---|
[133] | 1799 | case WM_MENUEND:
|
---|
[551] | 1800 | if (hwndMenu == (HWND) mp2) {
|
---|
[133] | 1801 | WinDestroyWindow(hwndMenu);
|
---|
[551] | 1802 | hwndMenu = (HWND) 0;
|
---|
[133] | 1803 | }
|
---|
| 1804 | break;
|
---|
[2] | 1805 |
|
---|
[133] | 1806 | case WM_CONTEXTMENU:
|
---|
| 1807 | if (hwndMenu)
|
---|
| 1808 | WinDestroyWindow(hwndMenu);
|
---|
[551] | 1809 | hwndMenu = (HWND) 0;
|
---|
[133] | 1810 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[297] | 1811 | *szDrv = 0;
|
---|
[133] | 1812 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1813 | id + 50), sizeof(szDrv), szDrv);
|
---|
[551] | 1814 | if (isalpha(*szDrv)) {
|
---|
| 1815 | hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, MAIN_DRIVES);
|
---|
| 1816 | if (hwndMenu) {
|
---|
[1077] | 1817 | BOOL rdy;
|
---|
| 1818 | CHAR chDrv = *szDrv;
|
---|
| 1819 | UINT iDrv;
|
---|
[551] | 1820 |
|
---|
[1077] | 1821 | strcpy(szDrv + 2, "\\");
|
---|
| 1822 | MakeValidDir(szDrv);
|
---|
| 1823 | // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c
|
---|
| 1824 | rdy = toupper(*szDrv) == toupper(chDrv);
|
---|
| 1825 | iDrv = toupper(*szDrv) - 'A';
|
---|
| 1826 | if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE)
|
---|
| 1827 | WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE);
|
---|
[549] | 1828 |
|
---|
[1077] | 1829 | if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) {
|
---|
| 1830 | WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE);
|
---|
| 1831 | WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE);
|
---|
| 1832 | WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE);
|
---|
| 1833 | WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE);
|
---|
| 1834 | }
|
---|
| 1835 | if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) {
|
---|
| 1836 | WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE);
|
---|
| 1837 | WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE);
|
---|
| 1838 | WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE);
|
---|
| 1839 | }
|
---|
| 1840 | if (!rdy) {
|
---|
| 1841 | WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE);
|
---|
| 1842 | WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE);
|
---|
| 1843 | WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE);
|
---|
| 1844 | WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE);
|
---|
| 1845 | WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE);
|
---|
| 1846 | }
|
---|
| 1847 | /* fixme to be gone?
|
---|
| 1848 | if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) {
|
---|
| 1849 | WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE);
|
---|
| 1850 | }
|
---|
| 1851 | */
|
---|
| 1852 | PopupMenu(hwnd, hwnd, hwndMenu);
|
---|
[133] | 1853 | }
|
---|
| 1854 | }
|
---|
| 1855 | return MRFROMSHORT(TRUE);
|
---|
[2] | 1856 |
|
---|
[133] | 1857 | case WM_BUTTON2CLICK:
|
---|
| 1858 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 1859 | if (!(shiftstate & KC_CTRL))
|
---|
| 1860 | break;
|
---|
[2] | 1861 |
|
---|
[133] | 1862 | case WM_CHORD:
|
---|
| 1863 | case WM_BUTTON3CLICK:
|
---|
| 1864 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[297] | 1865 | *szDrv = 0;
|
---|
[133] | 1866 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1867 | id + 50), sizeof(szDrv), szDrv);
|
---|
[551] | 1868 | if (isalpha(*szDrv)) {
|
---|
[297] | 1869 | strcat(szDrv, "\\");
|
---|
| 1870 | if (!FindDirCnrByName(szDrv, TRUE))
|
---|
[1077] | 1871 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv);
|
---|
[133] | 1872 | }
|
---|
| 1873 | break;
|
---|
[2] | 1874 |
|
---|
[133] | 1875 | case WM_COMMAND:
|
---|
| 1876 | PostMsg(hwnd, UM_COMMAND, mp1, mp2);
|
---|
| 1877 | return 0;
|
---|
[2] | 1878 |
|
---|
[133] | 1879 | case UM_COMMAND:
|
---|
| 1880 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[297] | 1881 | *szDrv = 0;
|
---|
[133] | 1882 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1883 | id + 50), sizeof(szDrv), szDrv);
|
---|
[551] | 1884 | if (isalpha(*szDrv)) {
|
---|
[297] | 1885 | strcat(szDrv, "\\");
|
---|
| 1886 | CommonDriveCmd(hwnd, szDrv, SHORT1FROMMP(mp1));
|
---|
[133] | 1887 | }
|
---|
| 1888 | return 0;
|
---|
[2] | 1889 |
|
---|
[133] | 1890 | case DM_DRAGOVER:
|
---|
| 1891 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[297] | 1892 | *szDrv = 0;
|
---|
[133] | 1893 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1894 | id + 50), sizeof(szDrv), szDrv);
|
---|
[297] | 1895 | if (isalpha(*szDrv) &&
|
---|
[1077] | 1896 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
[551] | 1897 | if (!emphasized) {
|
---|
[1077] | 1898 | emphasized = TRUE;
|
---|
| 1899 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 1900 | }
|
---|
[618] | 1901 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
---|
[1077] | 1902 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
---|
[133] | 1903 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
---|
| 1904 | }
|
---|
| 1905 | break;
|
---|
[2] | 1906 |
|
---|
[133] | 1907 | case DM_DRAGLEAVE:
|
---|
| 1908 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[297] | 1909 | *szDrv = 0;
|
---|
[133] | 1910 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1911 | id + 50), sizeof(szDrv), szDrv);
|
---|
[297] | 1912 | if (isalpha(*szDrv) &&
|
---|
[1077] | 1913 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
[551] | 1914 | if (emphasized) {
|
---|
[1077] | 1915 | emphasized = FALSE;
|
---|
| 1916 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 1917 | }
|
---|
| 1918 | }
|
---|
| 1919 | break;
|
---|
[2] | 1920 |
|
---|
[133] | 1921 | case DM_DROPHELP:
|
---|
| 1922 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[297] | 1923 | *szDrv = 0;
|
---|
[133] | 1924 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1925 | id + 50), sizeof(szDrv), szDrv);
|
---|
[297] | 1926 | if (isalpha(*szDrv) &&
|
---|
[1077] | 1927 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
[133] | 1928 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_DRIVEDROPHELP));
|
---|
| 1929 | return 0;
|
---|
| 1930 | }
|
---|
| 1931 | break;
|
---|
[2] | 1932 |
|
---|
[133] | 1933 | case DM_DROP:
|
---|
| 1934 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[297] | 1935 | *szDrv = 0;
|
---|
[133] | 1936 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 1937 | id + 50), sizeof(szDrv), szDrv);
|
---|
[297] | 1938 | if (isalpha(*szDrv) &&
|
---|
[1077] | 1939 | !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
[2] | 1940 |
|
---|
[133] | 1941 | CNRDRAGINFO cnd;
|
---|
| 1942 | LISTINFO *li;
|
---|
| 1943 | ULONG action = UM_ACTION;
|
---|
[2] | 1944 |
|
---|
[551] | 1945 | if (emphasized) {
|
---|
[1077] | 1946 | emphasized = FALSE;
|
---|
| 1947 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 1948 | }
|
---|
| 1949 | memset(&cnd, 0, sizeof(cnd));
|
---|
| 1950 | cnd.pDragInfo = (PDRAGINFO) mp1;
|
---|
| 1951 | cnd.pRecord = NULL;
|
---|
| 1952 | li = DoFileDrop(hwnd,
|
---|
[1077] | 1953 | NULL,
|
---|
| 1954 | TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd));
|
---|
[687] | 1955 | CheckPmDrgLimit(cnd.pDragInfo);
|
---|
[551] | 1956 | if (li) {
|
---|
[1077] | 1957 | strcpy(li->targetpath, szDrv);
|
---|
| 1958 | strcat(li->targetpath, "\\");
|
---|
| 1959 | if (li->list && li->list[0] && IsRoot(li->list[0]))
|
---|
| 1960 | li->type = DO_LINK;
|
---|
| 1961 | else if (fDragndropDlg && (!*li->arcname || !li->info)) {
|
---|
[2] | 1962 |
|
---|
[1077] | 1963 | CHECKLIST cl;
|
---|
[2] | 1964 |
|
---|
[1077] | 1965 | memset(&cl, 0, sizeof(cl));
|
---|
| 1966 | cl.size = sizeof(cl);
|
---|
| 1967 | cl.flags = li->type;
|
---|
| 1968 | cl.list = li->list;
|
---|
| 1969 | cl.cmd = li->type;
|
---|
| 1970 | cl.prompt = li->targetpath;
|
---|
| 1971 | li->type = WinDlgBox(HWND_DESKTOP,
|
---|
| 1972 | hwndMain,
|
---|
| 1973 | DropListProc,
|
---|
| 1974 | FM3ModHandle, DND_FRAME, MPFROMP(&cl));
|
---|
| 1975 | if (li->type == DID_ERROR)
|
---|
| 1976 | Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 1977 | "Drag & Drop Dialog");
|
---|
| 1978 | if (!li->type) {
|
---|
| 1979 | FreeListInfo(li);
|
---|
| 1980 | return 0;
|
---|
| 1981 | }
|
---|
| 1982 | li->list = cl.list;
|
---|
| 1983 | if (!li->list || !li->list[0]) {
|
---|
| 1984 | FreeListInfo(li);
|
---|
| 1985 | return 0;
|
---|
| 1986 | }
|
---|
| 1987 | }
|
---|
| 1988 | else {
|
---|
| 1989 | if (!WinDlgBox(HWND_DESKTOP,
|
---|
| 1990 | hwndMain,
|
---|
| 1991 | WalkDlgProc,
|
---|
| 1992 | FM3ModHandle,
|
---|
| 1993 | WALK_FRAME,
|
---|
| 1994 | MPFROMP(li->targetpath)) || !*li->targetpath) {
|
---|
| 1995 | FreeListInfo(li);
|
---|
| 1996 | return 0;
|
---|
| 1997 | }
|
---|
| 1998 | }
|
---|
| 1999 | switch (li->type) {
|
---|
| 2000 | case DND_LAUNCH:
|
---|
| 2001 | strcat(li->targetpath, " %a");
|
---|
| 2002 | ExecOnList(hwndMain,
|
---|
| 2003 | li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL,
|
---|
| 2004 | pszSrcFile, __LINE__);
|
---|
| 2005 | FreeList(li->list);
|
---|
| 2006 | li->list = NULL;
|
---|
| 2007 | break;
|
---|
| 2008 | case DO_LINK:
|
---|
| 2009 | if (fLinkSetsIcon) {
|
---|
| 2010 | li->type = IDM_SETICON;
|
---|
| 2011 | action = UM_MASSACTION;
|
---|
| 2012 | }
|
---|
| 2013 | else
|
---|
| 2014 | li->type = IDM_COMPARE;
|
---|
| 2015 | break;
|
---|
| 2016 | case DND_EXTRACT:
|
---|
| 2017 | if (*li->targetpath && !IsFile(li->targetpath))
|
---|
| 2018 | li->type = IDM_EXTRACT;
|
---|
| 2019 | break;
|
---|
| 2020 | case DND_MOVE:
|
---|
| 2021 | li->type = IDM_MOVE;
|
---|
| 2022 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
| 2023 | action = UM_MASSACTION;
|
---|
| 2024 | li->type = IDM_ARCHIVEM;
|
---|
| 2025 | }
|
---|
| 2026 | break;
|
---|
| 2027 | case DND_WILDMOVE:
|
---|
| 2028 | li->type = IDM_WILDMOVE;
|
---|
| 2029 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
| 2030 | action = UM_MASSACTION;
|
---|
| 2031 | li->type = IDM_ARCHIVEM;
|
---|
| 2032 | }
|
---|
| 2033 | break;
|
---|
| 2034 | case DND_OBJECT:
|
---|
| 2035 | li->type = IDM_OBJECT;
|
---|
| 2036 | action = UM_MASSACTION;
|
---|
| 2037 | break;
|
---|
| 2038 | case DND_SHADOW:
|
---|
| 2039 | li->type = IDM_SHADOW;
|
---|
| 2040 | action = UM_MASSACTION;
|
---|
| 2041 | break;
|
---|
| 2042 | case DND_COMPARE:
|
---|
| 2043 | li->type = IDM_COMPARE;
|
---|
| 2044 | break;
|
---|
| 2045 | case DND_SETICON:
|
---|
| 2046 | action = UM_MASSACTION;
|
---|
| 2047 | li->type = IDM_SETICON;
|
---|
| 2048 | break;
|
---|
| 2049 | case DND_COPY:
|
---|
| 2050 | li->type = IDM_COPY;
|
---|
| 2051 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
| 2052 | action = UM_MASSACTION;
|
---|
| 2053 | li->type = IDM_ARCHIVE;
|
---|
| 2054 | }
|
---|
| 2055 | break;
|
---|
| 2056 | case DND_WILDCOPY:
|
---|
| 2057 | li->type = IDM_WILDCOPY;
|
---|
| 2058 | if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
| 2059 | action = UM_MASSACTION;
|
---|
| 2060 | li->type = IDM_ARCHIVE;
|
---|
| 2061 | }
|
---|
| 2062 | break;
|
---|
| 2063 | default:
|
---|
| 2064 | if (*li->arcname && li->info) {
|
---|
| 2065 | action = UM_MASSACTION;
|
---|
| 2066 | li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM :
|
---|
| 2067 | IDM_FAKEEXTRACT;
|
---|
| 2068 | }
|
---|
| 2069 | else if (*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
| 2070 | action = UM_MASSACTION;
|
---|
| 2071 | li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
|
---|
| 2072 | }
|
---|
| 2073 | else
|
---|
| 2074 | li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
|
---|
| 2075 | break;
|
---|
| 2076 | }
|
---|
| 2077 | if (!li->list || !li->list[0])
|
---|
| 2078 | FreeListInfo(li);
|
---|
| 2079 | else
|
---|
| 2080 | WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action));
|
---|
[133] | 2081 | }
|
---|
| 2082 | return 0;
|
---|
| 2083 | }
|
---|
| 2084 | break;
|
---|
[2] | 2085 |
|
---|
[133] | 2086 | case WM_DESTROY:
|
---|
| 2087 | if (hwndMenu)
|
---|
| 2088 | WinDestroyWindow(hwndMenu);
|
---|
[551] | 2089 | hwndMenu = (HWND) 0;
|
---|
[133] | 2090 | break;
|
---|
| 2091 | }
|
---|
| 2092 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
[2] | 2093 | }
|
---|
| 2094 |
|
---|
[260] | 2095 | VOID BuildDriveBarButtons(HWND hwndT)
|
---|
[133] | 2096 | {
|
---|
| 2097 | register ULONG x, y = 0;
|
---|
| 2098 | ULONG ulDriveNum, ulDriveMap, iconid;
|
---|
| 2099 | CHAR s[8];
|
---|
| 2100 | HENUM henum;
|
---|
| 2101 | HWND hwndB;
|
---|
[2] | 2102 |
|
---|
[133] | 2103 | henum = WinBeginEnumWindows(hwndT);
|
---|
[2] | 2104 |
|
---|
[133] | 2105 | while ((hwndB = WinGetNextWindow(henum)) != NULLHANDLE)
|
---|
| 2106 | WinDestroyWindow(hwndB);
|
---|
| 2107 |
|
---|
| 2108 | WinEndEnumWindows(henum);
|
---|
[376] | 2109 | if (fDrivebar) {
|
---|
[2] | 2110 | DosError(FERR_DISABLEHARDERR);
|
---|
[133] | 2111 | DosQCurDisk(&ulDriveNum, &ulDriveMap);
|
---|
[376] | 2112 | for (x = 0; x < 26; x++) {
|
---|
[551] | 2113 | if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) {
|
---|
[1077] | 2114 | if (x > 1) {
|
---|
| 2115 | if (driveflags[x] & DRIVE_CDROM)
|
---|
| 2116 | iconid = CDROM_ICON;
|
---|
| 2117 | else
|
---|
| 2118 | iconid = (driveflags[x] & DRIVE_REMOVABLE) ?
|
---|
| 2119 | REMOVABLE_ICON :
|
---|
| 2120 | (driveflags[x] & DRIVE_VIRTUAL) ?
|
---|
| 2121 | VIRTUAL_ICON :
|
---|
| 2122 | (driveflags[x] & DRIVE_REMOTE) ?
|
---|
| 2123 | REMOTE_ICON :
|
---|
| 2124 | (driveflags[x] & DRIVE_RAMDISK) ?
|
---|
| 2125 | RAMDISK_ICON :
|
---|
| 2126 | (driveflags[x] & DRIVE_ZIPSTREAM) ?
|
---|
| 2127 | ZIPSTREAM_ICON :DRIVE_ICON;
|
---|
| 2128 | }
|
---|
| 2129 | else
|
---|
| 2130 | iconid = FLOPPY_ICON;
|
---|
| 2131 | sprintf(s, "#%lu", iconid);
|
---|
| 2132 | hwndB = WinCreateWindow(hwndT,
|
---|
| 2133 | WC_DRIVEBUTTONS,
|
---|
| 2134 | s,
|
---|
| 2135 | BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON,
|
---|
| 2136 | 0,
|
---|
| 2137 | 0,
|
---|
| 2138 | 28,
|
---|
| 2139 | 18,
|
---|
| 2140 | hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL);
|
---|
| 2141 | if (!hwndB)
|
---|
| 2142 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 2143 | IDS_WINCREATEWINDOW);
|
---|
| 2144 | else {
|
---|
| 2145 | WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
|
---|
| 2146 | sprintf(s, "%c:", (CHAR) x + 'A');
|
---|
| 2147 | hwndB = WinCreateWindow(hwndT,
|
---|
| 2148 | WC_STATIC,
|
---|
| 2149 | s,
|
---|
| 2150 | SS_TEXT | DT_LEFT | DT_VCENTER,
|
---|
| 2151 | 0,
|
---|
| 2152 | 0,
|
---|
| 2153 | 10,
|
---|
| 2154 | 18,
|
---|
| 2155 | hwndT,
|
---|
| 2156 | HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL);
|
---|
| 2157 | if (!hwndB)
|
---|
| 2158 | Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 2159 | IDS_WINCREATEWINDOW);
|
---|
| 2160 | else {
|
---|
| 2161 | SetPresParams(hwndB,
|
---|
| 2162 | &RGBGREY,
|
---|
| 2163 | &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));
|
---|
| 2164 | WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
|
---|
| 2165 | }
|
---|
| 2166 | y++;
|
---|
| 2167 | }
|
---|
[133] | 2168 | }
|
---|
[930] | 2169 | } // for
|
---|
| 2170 | } // if drivebar
|
---|
[133] | 2171 | PostMsg(WinQueryWindow(hwndT, QW_PARENT),
|
---|
[1077] | 2172 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[2] | 2173 | }
|
---|
| 2174 |
|
---|
[133] | 2175 | VOID ResizeDrives(HWND hwndT, long xwidth)
|
---|
| 2176 | {
|
---|
| 2177 | register ULONG ctrlxpos = 2, ctrlypos = 0, ctrlxsize;
|
---|
| 2178 | HENUM henum;
|
---|
| 2179 | HWND hwndB;
|
---|
| 2180 | RECTL rcl;
|
---|
[2] | 2181 |
|
---|
| 2182 | DriveLines = 0;
|
---|
[133] | 2183 | if (!fDrivebar)
|
---|
[2] | 2184 | return;
|
---|
[551] | 2185 | if (!xwidth) {
|
---|
[133] | 2186 | WinQueryWindowRect(hwndT, &rcl);
|
---|
[2] | 2187 | xwidth = rcl.xRight - ((WinQuerySysValue(HWND_DESKTOP,
|
---|
[1077] | 2188 | SV_CYSIZEBORDER) * 2) + 2);
|
---|
[2] | 2189 | }
|
---|
[133] | 2190 | henum = WinBeginEnumWindows(hwndT);
|
---|
[551] | 2191 | while ((hwndB = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 2192 | if (WinQueryWindowUShort(hwndB, QWS_ID) > IDM_DRIVEA + 27)
|
---|
[2] | 2193 | ctrlxsize = 10;
|
---|
| 2194 | else
|
---|
| 2195 | ctrlxsize = 28;
|
---|
| 2196 | WinSetWindowPos(hwndB,
|
---|
[1077] | 2197 | HWND_TOP,
|
---|
| 2198 | ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW);
|
---|
[2] | 2199 | ctrlxpos += (ctrlxsize + 2);
|
---|
[551] | 2200 | if (ctrlxsize == 10) {
|
---|
[133] | 2201 | if (ctrlxpos + (42 + ((fShowTarget && DriveLines == 0) ?
|
---|
[1077] | 2202 | 256 : 0)) > xwidth) {
|
---|
| 2203 | ctrlxpos = 2;
|
---|
| 2204 | ctrlypos += 18;
|
---|
| 2205 | DriveLines++;
|
---|
[2] | 2206 | }
|
---|
| 2207 | }
|
---|
| 2208 | }
|
---|
[133] | 2209 | if (ctrlxpos == 2 && DriveLines)
|
---|
[2] | 2210 | DriveLines--;
|
---|
| 2211 | }
|
---|
| 2212 |
|
---|
[133] | 2213 | MRESULT EXPENTRY StatusProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 2214 | {
|
---|
[551] | 2215 | static HWND hwndE = (HWND) 0, hwndB = (HWND) 0;
|
---|
[2] | 2216 | static CHAR lastcmd[1024] = "";
|
---|
| 2217 |
|
---|
[551] | 2218 | switch (msg) {
|
---|
[133] | 2219 | case WM_CREATE:
|
---|
| 2220 | {
|
---|
| 2221 | MRESULT mr = PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
[2] | 2222 |
|
---|
[133] | 2223 | SetPresParams(hwnd,
|
---|
[1077] | 2224 | &RGBGREY,
|
---|
| 2225 | &RGBBLACK, &RGBGREY, GetPString(IDS_8HELVBOLDTEXT));
|
---|
[133] | 2226 | return mr;
|
---|
| 2227 | }
|
---|
[2] | 2228 |
|
---|
[133] | 2229 | case WM_PRESPARAMCHANGED:
|
---|
[551] | 2230 | if (fRunning) {
|
---|
[2] | 2231 |
|
---|
[133] | 2232 | ULONG AttrFound, AttrValue[64], cbRetLen;
|
---|
[2] | 2233 |
|
---|
[133] | 2234 | cbRetLen = WinQueryPresParam(hwnd,
|
---|
[1077] | 2235 | (ULONG) mp1,
|
---|
| 2236 | 0,
|
---|
| 2237 | &AttrFound,
|
---|
| 2238 | (ULONG) sizeof(AttrValue), &AttrValue, 0);
|
---|
[551] | 2239 | if (cbRetLen) {
|
---|
[1077] | 2240 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 2241 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[133] | 2242 | }
|
---|
| 2243 | }
|
---|
| 2244 | break;
|
---|
[2] | 2245 |
|
---|
[133] | 2246 | case WM_CONTEXTMENU:
|
---|
[551] | 2247 | PostMsg(hwndMain, UM_CONTEXTMENU, MPVOID, MPVOID);
|
---|
[133] | 2248 | return MRFROMSHORT(TRUE);
|
---|
[2] | 2249 |
|
---|
[133] | 2250 | case WM_BEGINDRAG:
|
---|
[551] | 2251 | if (hwndTree) {
|
---|
[2] | 2252 |
|
---|
[133] | 2253 | SWP swp;
|
---|
| 2254 | ULONG fl = SWP_ACTIVATE | SWP_SHOW | SWP_ZORDER;
|
---|
[2] | 2255 |
|
---|
[133] | 2256 | WinQueryWindowPos(hwndTree, &swp);
|
---|
| 2257 | if (!(swp.fl & SWP_MAXIMIZE))
|
---|
[1077] | 2258 | fl |= SWP_RESTORE;
|
---|
[133] | 2259 | WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, fl);
|
---|
| 2260 | }
|
---|
| 2261 | break;
|
---|
[2] | 2262 |
|
---|
[133] | 2263 | case UM_SETUP:
|
---|
| 2264 | if (mp1)
|
---|
[1009] | 2265 | strcpy(lastcmd, (CHAR *)mp1);
|
---|
[133] | 2266 | return 0;
|
---|
[2] | 2267 |
|
---|
[133] | 2268 | case UM_RESCAN:
|
---|
[551] | 2269 | if (hwndE && WinIsWindow(WinQueryAnchorBlock(hwnd), hwndE))
|
---|
[133] | 2270 | WinDestroyWindow(hwndE);
|
---|
[551] | 2271 | if (hwndB && WinIsWindow(WinQueryAnchorBlock(hwnd), hwndB))
|
---|
[133] | 2272 | WinDestroyWindow(hwndB);
|
---|
[551] | 2273 | hwndE = hwndB = (HWND) 0;
|
---|
[133] | 2274 | return 0;
|
---|
[2] | 2275 |
|
---|
[133] | 2276 | case WM_COMMAND:
|
---|
[551] | 2277 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 2278 | case COMMAND_BUTTON:
|
---|
| 2279 | PostMsg(hwndE, msg, mp1, mp2);
|
---|
| 2280 | break;
|
---|
| 2281 | }
|
---|
| 2282 | return 0;
|
---|
[2] | 2283 |
|
---|
[133] | 2284 | case WM_MOUSEMOVE:
|
---|
| 2285 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 2286 | {
|
---|
| 2287 | USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 2288 | char *s = NULL;
|
---|
[2] | 2289 |
|
---|
[551] | 2290 | if (fOtherHelp) {
|
---|
[1077] | 2291 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
---|
| 2292 | && !WinQueryCapture(HWND_DESKTOP)) {
|
---|
| 2293 | switch (id) {
|
---|
| 2294 | case IDM_ATTRS:
|
---|
| 2295 | if (WinQueryWindowTextLength(hwnd))
|
---|
| 2296 | s = GetPString(IDS_ATTRSBUTTONHELP);
|
---|
| 2297 | break;
|
---|
| 2298 | case IDM_INFO:
|
---|
| 2299 | if (WinQueryWindowTextLength(hwnd))
|
---|
| 2300 | s = GetPString(IDS_INFOBUTTONHELP);
|
---|
| 2301 | break;
|
---|
| 2302 | case IDM_RENAME:
|
---|
| 2303 | if (WinQueryWindowTextLength(hwnd))
|
---|
| 2304 | s = GetPString(IDS_NAMEBUTTONHELP);
|
---|
| 2305 | break;
|
---|
| 2306 | case MAIN_STATUS2:
|
---|
| 2307 | if (!hwndE)
|
---|
| 2308 | s = GetPString(IDS_STATUS2HELP);
|
---|
| 2309 | break;
|
---|
| 2310 | default:
|
---|
| 2311 | break;
|
---|
| 2312 | }
|
---|
| 2313 | if (s)
|
---|
| 2314 | MakeBubble(hwnd, FALSE, s);
|
---|
| 2315 | else if (hwndBubble)
|
---|
| 2316 | WinDestroyWindow(hwndBubble);
|
---|
| 2317 | }
|
---|
[133] | 2318 | }
|
---|
[551] | 2319 | switch (id) {
|
---|
[133] | 2320 | case IDM_ATTRS:
|
---|
| 2321 | case IDM_INFO:
|
---|
| 2322 | case IDM_RENAME:
|
---|
| 2323 | case MAIN_STATUS2:
|
---|
[1077] | 2324 | return CommonTextProc(hwnd, msg, mp1, mp2);
|
---|
[133] | 2325 | default:
|
---|
[1077] | 2326 | break;
|
---|
[133] | 2327 | }
|
---|
| 2328 | }
|
---|
| 2329 | break;
|
---|
[2] | 2330 |
|
---|
[133] | 2331 | case WM_BUTTON2DOWN:
|
---|
| 2332 | case WM_BUTTON2UP:
|
---|
| 2333 | case UM_FOCUSME:
|
---|
| 2334 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
[2] | 2335 |
|
---|
[133] | 2336 | case WM_BUTTON1DOWN:
|
---|
| 2337 | case WM_BUTTON1UP:
|
---|
| 2338 | case WM_BUTTON3DOWN:
|
---|
| 2339 | case WM_BUTTON3UP:
|
---|
| 2340 | {
|
---|
| 2341 | USHORT id;
|
---|
| 2342 |
|
---|
| 2343 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 2344 | switch (id) {
|
---|
[133] | 2345 | case IDM_ATTRS:
|
---|
| 2346 | case IDM_INFO:
|
---|
| 2347 | case IDM_RENAME:
|
---|
| 2348 | case MAIN_STATUS2:
|
---|
[1077] | 2349 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
[133] | 2350 | default:
|
---|
[1077] | 2351 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
| 2352 | break;
|
---|
[133] | 2353 | }
|
---|
| 2354 | }
|
---|
| 2355 | break;
|
---|
[2] | 2356 |
|
---|
[133] | 2357 | case WM_SETFOCUS:
|
---|
[551] | 2358 | if (mp2) {
|
---|
[2] | 2359 |
|
---|
[133] | 2360 | USHORT id;
|
---|
[2] | 2361 |
|
---|
[133] | 2362 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 2363 | if (id == MAIN_STATUS2 && hwndE)
|
---|
[1077] | 2364 | WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
[133] | 2365 | else
|
---|
[1077] | 2366 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
[133] | 2367 | }
|
---|
| 2368 | break;
|
---|
[2] | 2369 |
|
---|
[133] | 2370 | case WM_BUTTON1CLICK:
|
---|
| 2371 | {
|
---|
| 2372 | USHORT id;
|
---|
[2] | 2373 |
|
---|
[133] | 2374 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 2375 | if (id == MAIN_STATUS) {
|
---|
[1077] | 2376 | if (SHORT2FROMMP(mp2) & KC_CTRL)
|
---|
| 2377 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 2378 | FID_CLIENT),
|
---|
| 2379 | WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
---|
| 2380 | else if (hwndTree)
|
---|
| 2381 | PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID);
|
---|
[2] | 2382 | }
|
---|
[133] | 2383 | }
|
---|
| 2384 | break;
|
---|
[2] | 2385 |
|
---|
[133] | 2386 | case UM_CLICKED:
|
---|
| 2387 | case UM_CLICKED3:
|
---|
| 2388 | {
|
---|
| 2389 | USHORT id;
|
---|
| 2390 |
|
---|
| 2391 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 2392 | if (id == MAIN_STATUS2 && !hwndE) {
|
---|
[2] | 2393 |
|
---|
[1077] | 2394 | SWP swp;
|
---|
| 2395 | CHAR directory[CCHMAXPATH];
|
---|
| 2396 | PFNWP oldproce;
|
---|
[2] | 2397 |
|
---|
[1077] | 2398 | *directory = 0;
|
---|
| 2399 | TopWindowName(hwndMain, (HWND) 0, directory);
|
---|
| 2400 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 2401 | hwndB = WinCreateWindow(hwnd,
|
---|
| 2402 | WC_BUTTON,
|
---|
| 2403 | "+",
|
---|
| 2404 | WS_VISIBLE | BS_PUSHBUTTON |
|
---|
| 2405 | BS_NOPOINTERFOCUS,
|
---|
| 2406 | swp.cx - swp.cy,
|
---|
| 2407 | 0,
|
---|
| 2408 | swp.cy,
|
---|
| 2409 | swp.cy,
|
---|
| 2410 | hwnd, HWND_TOP, COMMAND_BUTTON, NULL, NULL);
|
---|
| 2411 | if (!hwndB)
|
---|
| 2412 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
| 2413 | hwndE = WinCreateWindow(hwnd,
|
---|
| 2414 | WC_ENTRYFIELD,
|
---|
| 2415 | NULL,
|
---|
| 2416 | WS_VISIBLE | ES_AUTOSCROLL,
|
---|
| 2417 | 0,
|
---|
| 2418 | 0,
|
---|
| 2419 | swp.cx - swp.cy,
|
---|
| 2420 | swp.cy,
|
---|
| 2421 | hwnd, HWND_TOP, COMMAND_LINE, NULL, NULL);
|
---|
| 2422 | if (!hwndE)
|
---|
| 2423 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
| 2424 | if (!hwndE || !hwndB) {
|
---|
| 2425 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
| 2426 | return 0;
|
---|
| 2427 | }
|
---|
| 2428 | WinSendMsg(hwndE, EM_SETTEXTLIMIT, MPFROM2SHORT(1024, 0), MPVOID);
|
---|
| 2429 | WinSetWindowText(hwndStatus, directory);
|
---|
| 2430 | if (*lastcmd)
|
---|
| 2431 | WinSetWindowText(hwndE, lastcmd);
|
---|
| 2432 | else
|
---|
| 2433 | WinSetWindowText(hwndE, GetPString(IDS_HELPCMDTEXT));
|
---|
| 2434 | oldproce = WinSubclassWindow(hwndE, (PFNWP) CommandLineProc);
|
---|
| 2435 | if (oldproce)
|
---|
| 2436 | WinSetWindowPtr(hwndE, QWL_USER, (PVOID) oldproce);
|
---|
| 2437 | PostMsg(hwndE, UM_FOCUSME, MPVOID, MPVOID);
|
---|
| 2438 | PostMsg(hwndE, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);
|
---|
| 2439 | return 0;
|
---|
[133] | 2440 | }
|
---|
[551] | 2441 | if (msg == UM_CLICKED3 || (SHORT2FROMMP(mp2) & KC_CTRL)) {
|
---|
[1077] | 2442 | switch (id) {
|
---|
| 2443 | case IDM_ATTRS:
|
---|
| 2444 | id = IDM_SORTSIZE;
|
---|
| 2445 | break;
|
---|
| 2446 | case IDM_INFO:
|
---|
| 2447 | id = IDM_SORTLWDATE;
|
---|
| 2448 | break;
|
---|
| 2449 | case IDM_RENAME:
|
---|
| 2450 | id = IDM_SORTFILENAME;
|
---|
| 2451 | break;
|
---|
| 2452 | }
|
---|
[133] | 2453 | }
|
---|
| 2454 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 2455 | WM_COMMAND, MPFROM2SHORT(id, 0), MPVOID);
|
---|
[133] | 2456 | }
|
---|
| 2457 | return 0;
|
---|
[2] | 2458 |
|
---|
[133] | 2459 | case WM_PAINT:
|
---|
| 2460 | {
|
---|
| 2461 | USHORT id;
|
---|
[2] | 2462 |
|
---|
[133] | 2463 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 2464 | switch (id) {
|
---|
[133] | 2465 | case IDM_ATTRS:
|
---|
| 2466 | case IDM_INFO:
|
---|
| 2467 | case IDM_RENAME:
|
---|
| 2468 | case MAIN_STATUS2:
|
---|
[1077] | 2469 | PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
|
---|
| 2470 | break;
|
---|
[133] | 2471 | default:
|
---|
[1077] | 2472 | PaintRecessedWindow(hwnd, (HPS) 0, FALSE, TRUE);
|
---|
| 2473 | break;
|
---|
[133] | 2474 | }
|
---|
[551] | 2475 | if (id == IDM_RENAME) {
|
---|
[2] | 2476 |
|
---|
[1077] | 2477 | HPS hps;
|
---|
[2] | 2478 |
|
---|
[1077] | 2479 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
---|
| 2480 | if (hps) {
|
---|
| 2481 | PaintSTextWindow(hwnd, hps);
|
---|
| 2482 | WinEndPaint(hps);
|
---|
| 2483 | }
|
---|
| 2484 | return 0;
|
---|
[2] | 2485 | }
|
---|
[133] | 2486 | }
|
---|
| 2487 | break;
|
---|
[2] | 2488 |
|
---|
[133] | 2489 | }
|
---|
| 2490 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
[2] | 2491 | }
|
---|
| 2492 |
|
---|
[133] | 2493 | MRESULT EXPENTRY ToolBackProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 2494 | {
|
---|
[551] | 2495 | switch (msg) {
|
---|
[133] | 2496 | case WM_CREATE:
|
---|
| 2497 | hwndToolback = hwnd;
|
---|
[926] | 2498 | RestorePresParams(hwnd, "ToolBar");
|
---|
[133] | 2499 | break;
|
---|
[2] | 2500 |
|
---|
[133] | 2501 | case WM_MOUSEMOVE:
|
---|
| 2502 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 2503 | break;
|
---|
[2] | 2504 |
|
---|
[133] | 2505 | case WM_CONTROLPOINTER:
|
---|
[551] | 2506 | if (!fNoFinger && SHORT1FROMMP(mp1) < 25000)
|
---|
[133] | 2507 | return MRFROMLONG(hptrFinger);
|
---|
| 2508 | break;
|
---|
[2] | 2509 |
|
---|
[133] | 2510 | case WM_CHAR:
|
---|
| 2511 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 2512 | break;
|
---|
[2] | 2513 |
|
---|
[133] | 2514 | case WM_COMMAND:
|
---|
| 2515 | case UM_COMMAND:
|
---|
| 2516 | return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 2517 | FID_CLIENT), msg, mp1, mp2);
|
---|
[2] | 2518 |
|
---|
[133] | 2519 | case WM_PAINT:
|
---|
[926] | 2520 |
|
---|
| 2521 | PaintRecessedWindow(hwnd, (HPS)0, TRUE, FALSE);
|
---|
| 2522 |
|
---|
[133] | 2523 | {
|
---|
| 2524 | HPS hps;
|
---|
| 2525 | RECTL rcl;
|
---|
[926] | 2526 | ULONG lColor;
|
---|
[2] | 2527 |
|
---|
[926] | 2528 | hps = WinBeginPaint(hwnd, (HPS)0, NULL);
|
---|
[551] | 2529 | if (hps) {
|
---|
[1077] | 2530 | GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);
|
---|
| 2531 | WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, NULL,
|
---|
| 2532 | sizeof(lColor), &lColor, 0);
|
---|
| 2533 | WinQueryWindowRect(hwnd, &rcl);
|
---|
| 2534 | WinFillRect(hps, &rcl, lColor);
|
---|
| 2535 | WinEndPaint(hps);
|
---|
[133] | 2536 | }
|
---|
[926] | 2537 |
|
---|
[133] | 2538 | }
|
---|
| 2539 | break;
|
---|
[2] | 2540 |
|
---|
[926] | 2541 | case WM_PRESPARAMCHANGED:
|
---|
| 2542 | PresParamChanged(hwnd, "ToolBar", mp1, mp2);
|
---|
[946] | 2543 | WinInvalidateRect(hwnd, NULL, TRUE);
|
---|
[926] | 2544 | break;
|
---|
| 2545 |
|
---|
[133] | 2546 | case UM_SETUP:
|
---|
| 2547 | {
|
---|
| 2548 | USHORT id;
|
---|
| 2549 | TOOL *tool;
|
---|
[2] | 2550 |
|
---|
[133] | 2551 | id = SHORT1FROMMP(mp1);
|
---|
| 2552 | tool = find_tool(id);
|
---|
[551] | 2553 | if (tool) {
|
---|
[1077] | 2554 | del_tool(tool);
|
---|
| 2555 | WinShowWindow(WinWindowFromID(hwnd, id), FALSE);
|
---|
| 2556 | if (fToolTitles)
|
---|
| 2557 | WinShowWindow(WinWindowFromID(hwnd, id + 25000), FALSE);
|
---|
| 2558 | ResizeTools(hwnd);
|
---|
[133] | 2559 | }
|
---|
| 2560 | }
|
---|
| 2561 | return 0;
|
---|
[2] | 2562 |
|
---|
[133] | 2563 | case WM_CHORD:
|
---|
| 2564 | {
|
---|
| 2565 | USHORT id;
|
---|
[2] | 2566 |
|
---|
[133] | 2567 | id = (USHORT) WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 2568 | hwnd,
|
---|
| 2569 | AddToolProc,
|
---|
| 2570 | FM3ModHandle, ADDBTN_FRAME, MPVOID);
|
---|
[133] | 2571 | if (id && id != (USHORT) - 1)
|
---|
[1077] | 2572 | WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 2573 | FID_CLIENT),
|
---|
| 2574 | WM_COMMAND,
|
---|
| 2575 | MPFROM2SHORT(IDM_CREATETOOL, 0), MPFROM2SHORT(id, 0));
|
---|
[133] | 2576 | }
|
---|
| 2577 | break;
|
---|
[2] | 2578 |
|
---|
[133] | 2579 | case WM_CONTEXTMENU:
|
---|
| 2580 | if (WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 2581 | hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID))
|
---|
[133] | 2582 | BuildTools(hwnd, TRUE);
|
---|
| 2583 | return MRFROMSHORT(TRUE);
|
---|
[2] | 2584 |
|
---|
[133] | 2585 | case WM_CLOSE:
|
---|
| 2586 | WinDestroyWindow(hwnd);
|
---|
| 2587 | return 0;
|
---|
[2] | 2588 |
|
---|
[133] | 2589 | case WM_DESTROY:
|
---|
| 2590 | break;
|
---|
| 2591 | }
|
---|
| 2592 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 2593 | }
|
---|
| 2594 |
|
---|
[178] | 2595 | static VOID AdjustSizeOfClient(PSWP pswp, PRECTL prectl)
|
---|
[133] | 2596 | {
|
---|
| 2597 | SWP swp;
|
---|
| 2598 | RECTL rectl;
|
---|
[2] | 2599 |
|
---|
[133] | 2600 | if (fFreeTree)
|
---|
| 2601 | return;
|
---|
[551] | 2602 | if (pswp) {
|
---|
[133] | 2603 | if (WinQueryWindowPos(hwndTree, &swp) &&
|
---|
[1077] | 2604 | !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) {
|
---|
[551] | 2605 | pswp->x = swp.cx;
|
---|
| 2606 | pswp->cx -= swp.cx;
|
---|
[133] | 2607 | }
|
---|
| 2608 | }
|
---|
[551] | 2609 | if (prectl) {
|
---|
[133] | 2610 | if (WinQueryWindowPos(hwndTree, &swp) &&
|
---|
[1077] | 2611 | !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) &&
|
---|
| 2612 | WinQueryWindowRect(hwndTree, &rectl)) {
|
---|
[551] | 2613 | prectl->xLeft = rectl.xRight;
|
---|
| 2614 | prectl->xRight -= rectl.xRight;
|
---|
[133] | 2615 | }
|
---|
| 2616 | }
|
---|
[2] | 2617 | }
|
---|
| 2618 |
|
---|
[133] | 2619 | VOID FillClient(HWND hwndClient, PSWP pswp, PRECTL prectl, BOOL avoidtree)
|
---|
| 2620 | {
|
---|
| 2621 | ULONG adjust;
|
---|
[2] | 2622 |
|
---|
[133] | 2623 | adjust = WinQuerySysValue(HWND_DESKTOP, SV_CYICON);
|
---|
| 2624 | if (pswp)
|
---|
| 2625 | WinQueryWindowPos(hwndClient, pswp);
|
---|
| 2626 | if (prectl)
|
---|
| 2627 | WinQueryWindowRect(hwndClient, prectl);
|
---|
| 2628 | if (avoidtree && !fFreeTree)
|
---|
| 2629 | AdjustSizeOfClient(pswp, prectl);
|
---|
| 2630 | if (prectl)
|
---|
[551] | 2631 | prectl->yBottom += adjust;
|
---|
| 2632 | if (pswp) {
|
---|
[133] | 2633 | if (!avoidtree || fFreeTree)
|
---|
[551] | 2634 | pswp->x = 0;
|
---|
| 2635 | pswp->y = adjust;
|
---|
| 2636 | if (pswp->cy >= adjust)
|
---|
| 2637 | pswp->cy -= adjust;
|
---|
[133] | 2638 | else
|
---|
[551] | 2639 | pswp->cy = 0;
|
---|
[133] | 2640 | }
|
---|
[2] | 2641 | }
|
---|
| 2642 |
|
---|
[178] | 2643 | static VOID MoveChildrenAwayFromTree(HWND hwndClient)
|
---|
[133] | 2644 | {
|
---|
| 2645 | SWP swpC, swpT, swp;
|
---|
| 2646 | USHORT id;
|
---|
| 2647 | HWND hwndChild;
|
---|
| 2648 | HENUM henum;
|
---|
[2] | 2649 |
|
---|
[133] | 2650 | if (fFreeTree)
|
---|
| 2651 | return;
|
---|
| 2652 | WinQueryWindowPos(hwndClient, &swpC);
|
---|
| 2653 | if (swpC.fl & (SWP_MINIMIZE | SWP_HIDE))
|
---|
| 2654 | return;
|
---|
| 2655 | WinQueryWindowPos(hwndTree, &swpT);
|
---|
| 2656 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 2657 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 2658 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
---|
| 2659 | if (!id || id == TREE_FRAME)
|
---|
| 2660 | continue;
|
---|
| 2661 | WinQueryWindowPos(hwndChild, &swp);
|
---|
[551] | 2662 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
| 2663 | if (swp.x < swpT.cx) {
|
---|
[1077] | 2664 | swp.x = swpT.cx;
|
---|
| 2665 | if (swp.x + swp.cx > swpC.cx)
|
---|
| 2666 | swp.cx = swpC.cx - swp.x;
|
---|
| 2667 | if (swp.cx > 24)
|
---|
| 2668 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
| 2669 | SWP_SIZE | SWP_MOVE | SWP_SHOW);
|
---|
[133] | 2670 | }
|
---|
| 2671 | }
|
---|
| 2672 | }
|
---|
| 2673 | WinEndEnumWindows(henum);
|
---|
[2] | 2674 | }
|
---|
| 2675 |
|
---|
[178] | 2676 | static VOID ArrangeIcons(HWND hwndClient)
|
---|
[133] | 2677 | {
|
---|
| 2678 | HENUM henum;
|
---|
| 2679 | HWND hwndChild;
|
---|
| 2680 | SWP swp;
|
---|
[2] | 2681 |
|
---|
[133] | 2682 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 2683 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 2684 | WinQueryWindowPos(hwndChild, &swp);
|
---|
[551] | 2685 | if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {
|
---|
[133] | 2686 | WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1);
|
---|
| 2687 | WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);
|
---|
| 2688 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,
|
---|
[1077] | 2689 | SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE);
|
---|
[133] | 2690 | }
|
---|
| 2691 | }
|
---|
| 2692 | WinEndEnumWindows(henum);
|
---|
[2] | 2693 | }
|
---|
| 2694 |
|
---|
[178] | 2695 | static VOID NextChild(HWND hwndClient, BOOL previous)
|
---|
[133] | 2696 | {
|
---|
| 2697 | HENUM henum;
|
---|
[551] | 2698 | HWND hwndActive, hwndNext, hwndPrev = (HWND) 0;
|
---|
[133] | 2699 | BOOL next = FALSE, once = FALSE;
|
---|
[2] | 2700 |
|
---|
[133] | 2701 | previous = !previous;
|
---|
[2] | 2702 |
|
---|
[133] | 2703 | hwndActive = WinQueryActiveWindow(hwndClient);
|
---|
| 2704 | if (!hwndActive)
|
---|
| 2705 | next = TRUE;
|
---|
| 2706 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 2707 | for (;;) {
|
---|
[133] | 2708 | hwndNext = WinGetNextWindow(henum);
|
---|
[551] | 2709 | if (hwndNext) {
|
---|
[133] | 2710 | if (!WinQueryWindowUShort(hwndNext, QWS_ID))
|
---|
[1077] | 2711 | continue;
|
---|
[133] | 2712 | if (next)
|
---|
[1077] | 2713 | break;
|
---|
[551] | 2714 | if (hwndNext == hwndActive) {
|
---|
[1077] | 2715 | if (!previous && hwndPrev) {
|
---|
| 2716 | hwndNext = hwndPrev;
|
---|
| 2717 | break;
|
---|
| 2718 | }
|
---|
| 2719 | else if (previous)
|
---|
| 2720 | next = TRUE;
|
---|
[133] | 2721 | }
|
---|
| 2722 | hwndPrev = hwndNext;
|
---|
| 2723 | }
|
---|
[551] | 2724 | else {
|
---|
[133] | 2725 | if ((!next && previous) || once)
|
---|
[1077] | 2726 | break;
|
---|
[551] | 2727 | else if (!previous) {
|
---|
[1077] | 2728 | hwndNext = hwndPrev;
|
---|
| 2729 | break;
|
---|
[133] | 2730 | }
|
---|
| 2731 | else
|
---|
[1077] | 2732 | once = next = TRUE;
|
---|
[133] | 2733 | }
|
---|
| 2734 | }
|
---|
| 2735 | WinEndEnumWindows(henum);
|
---|
[2] | 2736 |
|
---|
[551] | 2737 | if (hwndNext && hwndNext != hwndActive) {
|
---|
| 2738 | WinSetWindowPos(hwndNext, HWND_TOP, 0, 0, 0, 0,
|
---|
[1077] | 2739 | SWP_ZORDER | SWP_ACTIVATE);
|
---|
[551] | 2740 | WinSetWindowPos(hwndActive, ((previous) ? HWND_BOTTOM : hwndNext), 0, 0,
|
---|
[1077] | 2741 | 0, 0, SWP_ZORDER);
|
---|
[133] | 2742 | }
|
---|
[2] | 2743 | }
|
---|
| 2744 |
|
---|
[133] | 2745 | BOOL CloseChildren(HWND hwndClient)
|
---|
| 2746 | {
|
---|
| 2747 | HENUM henum;
|
---|
| 2748 | HWND hwndChild;
|
---|
| 2749 | BOOL ret = FALSE;
|
---|
[2] | 2750 |
|
---|
[133] | 2751 | fNoTileUpdate = TRUE;
|
---|
| 2752 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 2753 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 2754 | if (hwndChild != hwndTree) {
|
---|
[133] | 2755 | WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
---|
[1077] | 2756 | WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
---|
[133] | 2757 | if (WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
---|
[1077] | 2758 | WM_CLOSE, MPVOID, MPVOID)) {
|
---|
| 2759 | ret = TRUE;
|
---|
| 2760 | break;
|
---|
[133] | 2761 | }
|
---|
| 2762 | }
|
---|
| 2763 | }
|
---|
| 2764 | WinEndEnumWindows(henum);
|
---|
| 2765 | fNoTileUpdate = FALSE;
|
---|
| 2766 | return ret;
|
---|
[2] | 2767 | }
|
---|
| 2768 |
|
---|
[133] | 2769 | BOOL CloseDirCnrChildren(HWND hwndClient)
|
---|
| 2770 | {
|
---|
| 2771 | /* returns TRUE if a directory container window was told to close */
|
---|
[2] | 2772 |
|
---|
[133] | 2773 | HENUM henum;
|
---|
| 2774 | HWND hwndChild, hwndDir, hwndTemp;
|
---|
| 2775 | BOOL ret = FALSE;
|
---|
[2] | 2776 |
|
---|
[133] | 2777 | fNoTileUpdate = TRUE;
|
---|
| 2778 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 2779 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 2780 | if (hwndChild != hwndTree) {
|
---|
[133] | 2781 | hwndTemp = WinWindowFromID(hwndChild, FID_CLIENT);
|
---|
[551] | 2782 | if (hwndTemp) {
|
---|
[1077] | 2783 | hwndDir = WinWindowFromID(hwndTemp, DIR_CNR);
|
---|
| 2784 | if (hwndDir) {
|
---|
| 2785 | WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
|
---|
| 2786 | WM_CLOSE, MPVOID, MPVOID);
|
---|
| 2787 | ret = TRUE;
|
---|
| 2788 | }
|
---|
[133] | 2789 | }
|
---|
| 2790 | }
|
---|
| 2791 | }
|
---|
| 2792 | WinEndEnumWindows(henum);
|
---|
| 2793 | fNoTileUpdate = FALSE;
|
---|
| 2794 | return ret;
|
---|
[2] | 2795 | }
|
---|
| 2796 |
|
---|
[557] | 2797 | /** Save directory container state
|
---|
| 2798 | * @param hwndClient Client window handle
|
---|
| 2799 | * @param pszStateName State name to save, NULL to save global state
|
---|
[789] | 2800 | * @returns Number of directory container windows that were saved or -1 if error
|
---|
[557] | 2801 | * @seealso RestoreDirCnrState
|
---|
| 2802 | */
|
---|
| 2803 |
|
---|
[930] | 2804 | #define STATE_NAME_MAX_BYTES 256
|
---|
[787] | 2805 |
|
---|
[789] | 2806 | INT SaveDirCnrState(HWND hwndClient, PSZ pszStateName)
|
---|
[133] | 2807 | {
|
---|
| 2808 | HENUM henum;
|
---|
| 2809 | HWND hwndChild, hwndDir, hwndC;
|
---|
| 2810 | ULONG numsaves = 0, flWindowAttr;
|
---|
[1060] | 2811 | ULONG previous_numsaves, ulTemp = sizeof(ULONG);
|
---|
[787] | 2812 | CHAR szPrefix[STATE_NAME_MAX_BYTES + 1];
|
---|
| 2813 | CHAR szKey[STATE_NAME_MAX_BYTES + 80];
|
---|
[558] | 2814 | CHAR szDir[CCHMAXPATH];
|
---|
[133] | 2815 | SWP swp;
|
---|
| 2816 | DIRCNRDATA *dcd;
|
---|
[941] | 2817 | BOOL fIsShutDownState;
|
---|
[2] | 2818 |
|
---|
[941] | 2819 | if (!pszStateName || !*pszStateName) {
|
---|
| 2820 | Runtime_Error(pszSrcFile, __LINE__, "no data");
|
---|
[789] | 2821 | return -1;
|
---|
[558] | 2822 | }
|
---|
[941] | 2823 | if (strlen(pszStateName) > sizeof(szPrefix) - 2) {
|
---|
| 2824 | Runtime_Error(pszSrcFile, __LINE__, "SaveDirCnrState");
|
---|
| 2825 | return -1;
|
---|
| 2826 | }
|
---|
[558] | 2827 |
|
---|
[961] | 2828 | fIsShutDownState = strcmp(pszStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0;
|
---|
[941] | 2829 | sprintf(szPrefix, "%s.", pszStateName);
|
---|
| 2830 |
|
---|
[133] | 2831 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 2832 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 2833 | if (hwndChild != hwndTree) {
|
---|
[133] | 2834 | hwndC = WinWindowFromID(hwndChild, FID_CLIENT);
|
---|
[551] | 2835 | if (hwndC) {
|
---|
[1077] | 2836 | hwndDir = WinWindowFromID(hwndC, DIR_CNR);
|
---|
| 2837 | if (hwndDir) {
|
---|
| 2838 | WinQueryWindowPos(hwndChild, &swp);
|
---|
| 2839 | *szDir = 0;
|
---|
| 2840 | WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(szDir), MPVOID);
|
---|
| 2841 | if (*szDir) {
|
---|
| 2842 | // If saving shutdown state skip no prescan drives
|
---|
| 2843 | if (fIsShutDownState &&
|
---|
| 2844 | driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
|
---|
| 2845 | continue;
|
---|
| 2846 | }
|
---|
| 2847 | sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves);
|
---|
| 2848 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp,
|
---|
| 2849 | sizeof(SWP));
|
---|
| 2850 | dcd =
|
---|
| 2851 | WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
| 2852 | if (dcd) {
|
---|
| 2853 | sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves);
|
---|
| 2854 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags,
|
---|
| 2855 | sizeof(INT));
|
---|
| 2856 | sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves);
|
---|
| 2857 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask,
|
---|
| 2858 | sizeof(MASK));
|
---|
| 2859 | sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves);
|
---|
| 2860 | flWindowAttr = dcd->flWindowAttr;
|
---|
| 2861 | if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
|
---|
| 2862 | flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
|
---|
| 2863 | if (dcd->lastattr) {
|
---|
| 2864 | if (dcd->lastattr & CV_TEXT)
|
---|
| 2865 | flWindowAttr |= CV_TEXT;
|
---|
| 2866 | else if (dcd->lastattr & CV_DETAIL)
|
---|
| 2867 | flWindowAttr |= CV_DETAIL;
|
---|
| 2868 | else if (dcd->lastattr & CV_ICON)
|
---|
| 2869 | flWindowAttr |= CV_ICON;
|
---|
| 2870 | else
|
---|
| 2871 | flWindowAttr |= CV_NAME;
|
---|
| 2872 | }
|
---|
| 2873 | else
|
---|
| 2874 | flWindowAttr |= CV_NAME;
|
---|
| 2875 | }
|
---|
| 2876 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr,
|
---|
| 2877 | sizeof(ULONG));
|
---|
| 2878 | sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves);
|
---|
| 2879 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslongname,
|
---|
| 2880 | sizeof(BOOL));
|
---|
| 2881 | sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, numsaves);
|
---|
| 2882 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssubject,
|
---|
| 2883 | sizeof(BOOL));
|
---|
| 2884 | sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, numsaves);
|
---|
| 2885 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssize,
|
---|
| 2886 | sizeof(BOOL));
|
---|
| 2887 | sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, numsaves);
|
---|
| 2888 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsea,
|
---|
| 2889 | sizeof(BOOL));
|
---|
| 2890 | sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, numsaves);
|
---|
| 2891 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsattr,
|
---|
| 2892 | sizeof(BOOL));
|
---|
| 2893 | sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, numsaves);
|
---|
| 2894 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsicon,
|
---|
| 2895 | sizeof(BOOL));
|
---|
| 2896 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, numsaves);
|
---|
| 2897 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwdate,
|
---|
| 2898 | sizeof(BOOL));
|
---|
| 2899 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, numsaves);
|
---|
| 2900 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwtime,
|
---|
| 2901 | sizeof(BOOL));
|
---|
| 2902 | sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, numsaves);
|
---|
| 2903 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsladate,
|
---|
| 2904 | sizeof(BOOL));
|
---|
| 2905 | sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, numsaves);
|
---|
| 2906 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslatime,
|
---|
| 2907 | sizeof(BOOL));
|
---|
| 2908 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, numsaves);
|
---|
| 2909 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrdate,
|
---|
| 2910 | sizeof(BOOL));
|
---|
| 2911 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, numsaves);
|
---|
| 2912 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrtime,
|
---|
| 2913 | sizeof(BOOL));
|
---|
| 2914 | sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves);
|
---|
| 2915 | SavePresParams(hwndDir, szKey);
|
---|
| 2916 | }
|
---|
| 2917 | sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++);
|
---|
| 2918 | PrfWriteProfileString(fmprof, FM3Str, szKey, szDir);
|
---|
| 2919 | }
|
---|
| 2920 | }
|
---|
[133] | 2921 | }
|
---|
| 2922 | }
|
---|
[557] | 2923 | } // while
|
---|
[133] | 2924 | WinEndEnumWindows(henum);
|
---|
[558] | 2925 |
|
---|
[1060] | 2926 | sprintf(szKey, "%sNumDirsLastTime", szPrefix);
|
---|
| 2927 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &previous_numsaves, &ulTemp))
|
---|
| 2928 | for (ulTemp = numsaves; ulTemp < previous_numsaves; ulTemp++) {
|
---|
| 2929 | sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, ulTemp);
|
---|
| 2930 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(SWP));
|
---|
| 2931 | sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, ulTemp);
|
---|
| 2932 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(INT));
|
---|
| 2933 | sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, ulTemp);
|
---|
| 2934 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(MASK));
|
---|
| 2935 | sprintf(szKey, "%sDirCnrView.%lu", szPrefix, ulTemp);
|
---|
| 2936 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(ULONG));
|
---|
| 2937 | sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, ulTemp);
|
---|
| 2938 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 2939 | sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, ulTemp);
|
---|
| 2940 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 2941 | sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, ulTemp);
|
---|
| 2942 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 2943 | sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, ulTemp);
|
---|
| 2944 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 2945 | sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, ulTemp);
|
---|
| 2946 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 2947 | sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, ulTemp);
|
---|
| 2948 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 2949 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, ulTemp);
|
---|
| 2950 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 2951 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, ulTemp);
|
---|
| 2952 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 2953 | sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, ulTemp);
|
---|
| 2954 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 2955 | sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, ulTemp);
|
---|
| 2956 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 2957 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, ulTemp);
|
---|
| 2958 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 2959 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, ulTemp);
|
---|
| 2960 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(BOOL));
|
---|
| 2961 | sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, ulTemp);
|
---|
| 2962 | PrfWriteProfileString(fmprof, FM3Str, szKey, NULL);
|
---|
| 2963 | sprintf(szKey, "%sDirCnr.%lu.", szPrefix, ulTemp);
|
---|
| 2964 | DeletePresParams(szKey);
|
---|
[133] | 2965 | }
|
---|
[1060] | 2966 | sprintf(szKey, "%sNumDirsLastTime", szPrefix);
|
---|
| 2967 | if (numsaves) {
|
---|
[787] | 2968 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & numsaves, sizeof(ULONG));
|
---|
[133] | 2969 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swp);
|
---|
[787] | 2970 | sprintf(szKey, "%sMySizeLastTime", szPrefix);
|
---|
| 2971 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, sizeof(SWP));
|
---|
[1060] | 2972 | if (WinQueryWindowPos(hwndTree, &swp)) {
|
---|
| 2973 | sprintf(szKey, "%sLastTreePos", szPrefix);
|
---|
| 2974 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, sizeof(SWP));
|
---|
| 2975 | }
|
---|
[133] | 2976 | }
|
---|
[1024] | 2977 | else if (fIsShutDownState) {
|
---|
| 2978 | PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & numsaves, sizeof(ULONG));
|
---|
| 2979 | }
|
---|
[558] | 2980 |
|
---|
[1060] | 2981 | return numsaves;
|
---|
[2] | 2982 | }
|
---|
| 2983 |
|
---|
[178] | 2984 | static VOID TransformSwp(PSWP pswp, double xtrans, double ytrans)
|
---|
[133] | 2985 | {
|
---|
| 2986 | SWP swp;
|
---|
| 2987 | HWND hwnd;
|
---|
[2] | 2988 |
|
---|
[551] | 2989 | if ((LONG) pswp->x < 0L) {
|
---|
| 2990 | pswp->cx -= abs(pswp->x);
|
---|
| 2991 | pswp->x = 0;
|
---|
[133] | 2992 | }
|
---|
[551] | 2993 | if ((LONG) pswp->y < 0L) {
|
---|
| 2994 | pswp->cy -= abs(pswp->y);
|
---|
| 2995 | pswp->y = 0;
|
---|
[133] | 2996 | }
|
---|
[551] | 2997 | pswp->x = (LONG) (((double)pswp->x * 100.0) / xtrans);
|
---|
| 2998 | pswp->cx = (LONG) (((double)pswp->cx * 100.0) / xtrans);
|
---|
| 2999 | pswp->y = (LONG) (((double)pswp->y * 100.0) / ytrans);
|
---|
| 3000 | pswp->cy = (LONG) (((double)pswp->cy * 100.0) / ytrans);
|
---|
| 3001 | if (pswp->hwnd) {
|
---|
| 3002 | hwnd = WinQueryWindow(pswp->hwnd, QW_PARENT);
|
---|
| 3003 | if (hwnd) {
|
---|
| 3004 | if (WinQueryWindowPos(hwnd, &swp)) {
|
---|
[1077] | 3005 | if (pswp->x > swp.cx)
|
---|
| 3006 | pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx;
|
---|
| 3007 | if (pswp->y > swp.cy)
|
---|
| 3008 | pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy;
|
---|
| 3009 | if (pswp->x + pswp->cx > swp.cx)
|
---|
| 3010 | pswp->cx = swp.cx - pswp->x;
|
---|
| 3011 | if (pswp->y + pswp->cy > swp.cy)
|
---|
| 3012 | pswp->cy = swp.cy - pswp->y;
|
---|
[133] | 3013 | }
|
---|
| 3014 | }
|
---|
| 3015 | }
|
---|
[2] | 3016 | }
|
---|
| 3017 |
|
---|
[557] | 3018 | /** Restore directory container state
|
---|
| 3019 | * @param hwndClient Client window handle
|
---|
| 3020 | * @param pszStateName State name to restore, NULL to restore global state
|
---|
[941] | 3021 | * @param noview request view state restore bypass
|
---|
[557] | 3022 | * @returns TRUE if one or more directory containers were opened
|
---|
| 3023 | * @seealso SaveDirCnrState
|
---|
| 3024 | */
|
---|
| 3025 |
|
---|
| 3026 | static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview)
|
---|
[133] | 3027 | {
|
---|
[787] | 3028 | CHAR szKey[STATE_NAME_MAX_BYTES + 80];
|
---|
[558] | 3029 | CHAR szDir[CCHMAXPATH];
|
---|
[787] | 3030 | CHAR szPrefix[STATE_NAME_MAX_BYTES + 2];
|
---|
[1033] | 3031 | HWND hwndDir, hwndC, hwndPPSave = NULLHANDLE;
|
---|
[133] | 3032 | SWP swp, swpO, swpN;
|
---|
[1033] | 3033 | ULONG size, numsaves = 0;
|
---|
| 3034 | LONG x;
|
---|
[133] | 3035 | double xtrans, ytrans;
|
---|
[558] | 3036 | BOOL fRestored = FALSE;
|
---|
[923] | 3037 | DIRCNRDATA localdcd, *dcd;
|
---|
[941] | 3038 | BOOL fIsShutDownState;
|
---|
[961] | 3039 | BOOL fDeleteState;
|
---|
[2] | 3040 |
|
---|
[941] | 3041 | if (!pszStateName || !*pszStateName) {
|
---|
| 3042 | Runtime_Error(pszSrcFile, __LINE__, "no name");
|
---|
| 3043 | return fRestored;
|
---|
[558] | 3044 | }
|
---|
[941] | 3045 | if (strlen(pszStateName) > sizeof(szPrefix) - 2) {
|
---|
| 3046 | Runtime_Error(pszSrcFile, __LINE__, "name too long");
|
---|
| 3047 | return fRestored;
|
---|
| 3048 | }
|
---|
[558] | 3049 |
|
---|
[941] | 3050 | sprintf(szPrefix, "%s.", pszStateName);
|
---|
| 3051 |
|
---|
[961] | 3052 | // If restoring shutdown state bypass no-prescan drives
|
---|
| 3053 | fIsShutDownState = strcmp(pszStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0;
|
---|
[981] | 3054 | // Delete saved state if internally saved state
|
---|
| 3055 | fDeleteState = strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)) == 0;
|
---|
[941] | 3056 |
|
---|
[133] | 3057 | size = sizeof(SWP);
|
---|
[787] | 3058 | sprintf(szKey, "%sMySizeLastTime", szPrefix);
|
---|
[133] | 3059 | if (!PrfQueryProfileData(fmprof,
|
---|
[1077] | 3060 | FM3Str,
|
---|
| 3061 | szKey,
|
---|
| 3062 | (PVOID) & swpO,
|
---|
| 3063 | &size) ||
|
---|
[133] | 3064 | size != sizeof(SWP) || !swp.cx || !swp.cy)
|
---|
[558] | 3065 | {
|
---|
[133] | 3066 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swpO);
|
---|
[558] | 3067 | }
|
---|
[1060] | 3068 | // If restoring internally saved state, forget info
|
---|
[961] | 3069 | if (fDeleteState)
|
---|
[787] | 3070 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
[133] | 3071 | WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swpN);
|
---|
| 3072 | if (swpN.fl & (SWP_MINIMIZE | SWP_HIDE))
|
---|
| 3073 | swpN = swpO;
|
---|
[551] | 3074 | xtrans = ((double)swpO.cx * 100.0) / (double)swpN.cx;
|
---|
| 3075 | ytrans = ((double)swpO.cy * 100.0) / (double)swpN.cy;
|
---|
[133] | 3076 | size = sizeof(SWP);
|
---|
[787] | 3077 | sprintf(szKey, "%sLastTreePos", szPrefix);
|
---|
| 3078 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, &size)) {
|
---|
[961] | 3079 | if (fDeleteState)
|
---|
[787] | 3080 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
[133] | 3081 | swp.hwnd = hwndTree;
|
---|
[551] | 3082 | TransformSwp(&swp, xtrans, ytrans);
|
---|
| 3083 | if (!fFreeTree) {
|
---|
[133] | 3084 | WinQueryWindowPos(hwndClient, &swpN);
|
---|
| 3085 | swp.x = 0;
|
---|
| 3086 | swp.y = (swpN.cy - swp.cy);
|
---|
| 3087 | }
|
---|
[551] | 3088 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE))) {
|
---|
[133] | 3089 | swp.fl &= (~SWP_ACTIVATE);
|
---|
[2] | 3090 | WinSetWindowPos(hwndTree,
|
---|
[1077] | 3091 | HWND_TOP,
|
---|
| 3092 | swp.x,
|
---|
| 3093 | swp.y,
|
---|
| 3094 | swp.cx,
|
---|
| 3095 | swp.cy,
|
---|
| 3096 | swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
---|
[133] | 3097 | }
|
---|
[551] | 3098 | else {
|
---|
[2] | 3099 | WinSetWindowPos(hwndTree,
|
---|
[1077] | 3100 | HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);
|
---|
[551] | 3101 | WinSetWindowUShort(hwndTree, QWS_XRESTORE, (USHORT) swp.x);
|
---|
| 3102 | WinSetWindowUShort(hwndTree, QWS_CXRESTORE, (USHORT) swp.cx);
|
---|
| 3103 | WinSetWindowUShort(hwndTree, QWS_YRESTORE, (USHORT) swp.y);
|
---|
| 3104 | WinSetWindowUShort(hwndTree, QWS_CYRESTORE, (USHORT) swp.cy);
|
---|
[133] | 3105 | }
|
---|
| 3106 | }
|
---|
| 3107 | size = sizeof(ULONG);
|
---|
[787] | 3108 | sprintf(szKey, "%sNumDirsLastTime", szPrefix);
|
---|
[133] | 3109 | if (PrfQueryProfileData(fmprof,
|
---|
[1077] | 3110 | FM3Str, szKey, (PVOID) & numsaves, &size)) {
|
---|
[961] | 3111 | if (fDeleteState)
|
---|
[787] | 3112 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
[1033] | 3113 | for (x = numsaves - 1; x >= 0; x--) {
|
---|
[787] | 3114 | sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, x);
|
---|
[133] | 3115 | size = sizeof(SWP);
|
---|
[940] | 3116 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) {
|
---|
[1077] | 3117 | if (fDeleteState)
|
---|
| 3118 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3119 | sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x);
|
---|
| 3120 | size = sizeof(szDir);
|
---|
| 3121 | if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) {
|
---|
| 3122 | // If restoring shutdown state and drive marked no prescan
|
---|
| 3123 | // bypass window restore
|
---|
| 3124 | if (fIsShutDownState &&
|
---|
| 3125 | driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
|
---|
| 3126 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3127 | continue;
|
---|
| 3128 | }
|
---|
| 3129 | if (fDeleteState)
|
---|
| 3130 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3131 | localdcd.ds.detailslongname = dsDirCnrDefault.detailslongname; // Set default
|
---|
| 3132 | size = sizeof(BOOL);
|
---|
| 3133 | sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x);
|
---|
| 3134 | if (PrfQueryProfileData(fmprof,
|
---|
| 3135 | FM3Str,
|
---|
| 3136 | szKey,
|
---|
| 3137 | (PVOID)&localdcd.ds.detailslongname,
|
---|
| 3138 | &size) &&
|
---|
| 3139 | size == sizeof(BOOL))
|
---|
| 3140 | {
|
---|
| 3141 | if (fDeleteState)
|
---|
| 3142 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3143 | }
|
---|
| 3144 | localdcd.ds.detailssubject = dsDirCnrDefault.detailssubject; // Set default
|
---|
| 3145 | size = sizeof(BOOL);
|
---|
| 3146 | sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, x);
|
---|
| 3147 | if (PrfQueryProfileData(fmprof,
|
---|
| 3148 | FM3Str,
|
---|
| 3149 | szKey,
|
---|
| 3150 | (PVOID)&localdcd.ds.detailssubject,
|
---|
| 3151 | &size) &&
|
---|
| 3152 | size == sizeof(BOOL))
|
---|
| 3153 | {
|
---|
| 3154 | if (fDeleteState)
|
---|
| 3155 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3156 | }
|
---|
| 3157 | localdcd.ds.detailsea = dsDirCnrDefault.detailsea; // Set default
|
---|
| 3158 | size = sizeof(BOOL);
|
---|
| 3159 | sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, x);
|
---|
| 3160 | if (PrfQueryProfileData(fmprof,
|
---|
| 3161 | FM3Str,
|
---|
| 3162 | szKey,
|
---|
| 3163 | (PVOID) & localdcd.ds.detailsea,
|
---|
| 3164 | &size) &&
|
---|
| 3165 | size == sizeof(BOOL))
|
---|
| 3166 | {
|
---|
| 3167 | if (fDeleteState)
|
---|
| 3168 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3169 | }
|
---|
| 3170 | localdcd.ds.detailssize = dsDirCnrDefault.detailssize; // Set default
|
---|
| 3171 | size = sizeof(BOOL);
|
---|
| 3172 | sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, x);
|
---|
| 3173 | if (PrfQueryProfileData(fmprof,
|
---|
| 3174 | FM3Str,
|
---|
| 3175 | szKey,
|
---|
| 3176 | (PVOID) & localdcd.ds.detailssize,
|
---|
| 3177 | &size) &&
|
---|
| 3178 | size == sizeof(BOOL))
|
---|
| 3179 | {
|
---|
| 3180 | if (fDeleteState)
|
---|
| 3181 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3182 | }
|
---|
| 3183 | localdcd.ds.detailsicon = dsDirCnrDefault.detailsicon; // Set default
|
---|
| 3184 | size = sizeof(BOOL);
|
---|
| 3185 | sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, x);
|
---|
| 3186 | if (PrfQueryProfileData(fmprof,
|
---|
| 3187 | FM3Str,
|
---|
| 3188 | szKey,
|
---|
| 3189 | (PVOID) & localdcd.ds.detailsicon,
|
---|
| 3190 | &size) &&
|
---|
| 3191 | size == sizeof(BOOL))
|
---|
| 3192 | {
|
---|
| 3193 | if (fDeleteState)
|
---|
| 3194 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3195 | }
|
---|
| 3196 | localdcd.ds.detailsattr = dsDirCnrDefault.detailsattr; // Set default
|
---|
| 3197 | size = sizeof(BOOL);
|
---|
| 3198 | sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, x);
|
---|
| 3199 | if (PrfQueryProfileData(fmprof,
|
---|
| 3200 | FM3Str,
|
---|
| 3201 | szKey,
|
---|
| 3202 | (PVOID)&localdcd.ds.detailsattr,
|
---|
| 3203 | &size) &&
|
---|
| 3204 | size == sizeof(BOOL))
|
---|
| 3205 | {
|
---|
| 3206 | if (fDeleteState)
|
---|
| 3207 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3208 | }
|
---|
| 3209 | localdcd.ds.detailscrdate = dsDirCnrDefault.detailscrdate; // Set default
|
---|
| 3210 | size = sizeof(BOOL);
|
---|
| 3211 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, x);
|
---|
| 3212 | if (PrfQueryProfileData(fmprof,
|
---|
| 3213 | FM3Str,
|
---|
| 3214 | szKey,
|
---|
| 3215 | (PVOID) & localdcd.ds.detailscrdate,
|
---|
| 3216 | &size) && size == sizeof(BOOL))
|
---|
| 3217 | {
|
---|
| 3218 | if (fDeleteState)
|
---|
| 3219 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3220 | }
|
---|
| 3221 | localdcd.ds.detailscrtime = dsDirCnrDefault.detailscrtime; // Set default
|
---|
| 3222 | size = sizeof(BOOL);
|
---|
| 3223 | sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, x);
|
---|
| 3224 | if (PrfQueryProfileData(fmprof,
|
---|
| 3225 | FM3Str,
|
---|
| 3226 | szKey,
|
---|
| 3227 | (PVOID)&localdcd.ds.detailscrtime,
|
---|
| 3228 | &size) &&
|
---|
| 3229 | size == sizeof(BOOL))
|
---|
| 3230 | {
|
---|
| 3231 | if (fDeleteState)
|
---|
| 3232 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3233 | }
|
---|
| 3234 | localdcd.ds.detailslwdate = dsDirCnrDefault.detailslwdate; // Set default
|
---|
| 3235 | size = sizeof(BOOL);
|
---|
| 3236 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, x);
|
---|
| 3237 | if (PrfQueryProfileData(fmprof,
|
---|
| 3238 | FM3Str,
|
---|
| 3239 | szKey,
|
---|
| 3240 | (PVOID) & localdcd.ds.detailslwdate,
|
---|
| 3241 | &size) &&
|
---|
| 3242 | size == sizeof(BOOL))
|
---|
| 3243 | {
|
---|
| 3244 | if (fDeleteState)
|
---|
| 3245 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3246 | }
|
---|
| 3247 | localdcd.ds.detailslwtime = dsDirCnrDefault.detailslwtime; // Set default
|
---|
| 3248 | size = sizeof(BOOL);
|
---|
| 3249 | sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, x);
|
---|
| 3250 | if (PrfQueryProfileData(fmprof,
|
---|
| 3251 | FM3Str,
|
---|
| 3252 | szKey,
|
---|
| 3253 | (PVOID) & localdcd.ds.detailslwtime,
|
---|
| 3254 | &size) &&
|
---|
| 3255 | size == sizeof(BOOL))
|
---|
| 3256 | {
|
---|
| 3257 | if (fDeleteState)
|
---|
| 3258 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3259 | }
|
---|
| 3260 | localdcd.ds.detailsladate = dsDirCnrDefault.detailsladate; // Set default
|
---|
| 3261 | size = sizeof(BOOL);
|
---|
| 3262 | sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, x);
|
---|
| 3263 | if (PrfQueryProfileData(fmprof,
|
---|
| 3264 | FM3Str,
|
---|
| 3265 | szKey,
|
---|
| 3266 | (PVOID) & localdcd.ds.detailsladate,
|
---|
| 3267 | &size) &&
|
---|
| 3268 | size == sizeof(BOOL))
|
---|
| 3269 | {
|
---|
| 3270 | if (fDeleteState)
|
---|
| 3271 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3272 | }
|
---|
| 3273 | localdcd.ds.detailslatime = dsDirCnrDefault.detailslatime; // Set default
|
---|
| 3274 | size = sizeof(BOOL);
|
---|
| 3275 | sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, x);
|
---|
| 3276 | if (PrfQueryProfileData(fmprof,
|
---|
| 3277 | FM3Str,
|
---|
| 3278 | szKey,
|
---|
| 3279 | (PVOID) & localdcd.ds.detailslatime,
|
---|
| 3280 | &size) &&
|
---|
| 3281 | size == sizeof(BOOL))
|
---|
| 3282 | {
|
---|
| 3283 | if (fDeleteState)
|
---|
| 3284 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3285 | }
|
---|
| 3286 | hwndDir = (HWND) WinSendMsg(hwndClient,
|
---|
| 3287 | UM_SETDIR,
|
---|
| 3288 | MPFROMP(szDir), MPFROMLONG(1));
|
---|
| 3289 | if (hwndDir) {
|
---|
| 3290 | hwndC = WinWindowFromID(hwndDir, FID_CLIENT);
|
---|
| 3291 | if (hwndC) {
|
---|
| 3292 | HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR);
|
---|
| 3293 | if (!hwndPPSave) {
|
---|
| 3294 | hwndPPSave = WinCreateWindow(hwndCnr, // Create a window (used to save default presparams)
|
---|
| 3295 | WC_CONTAINER,
|
---|
| 3296 | NULL,
|
---|
| 3297 | CCS_AUTOPOSITION | CCS_MINIICONS |
|
---|
| 3298 | CCS_MINIRECORDCORE | ulCnrType |
|
---|
| 3299 | WS_VISIBLE,
|
---|
| 3300 | 0,
|
---|
| 3301 | 0,
|
---|
| 3302 | 0,
|
---|
| 3303 | 0,
|
---|
| 3304 | hwndCnr,
|
---|
| 3305 | HWND_TOP, (ULONG) -1, NULL, NULL);
|
---|
| 3306 | CopyPresParams(hwndPPSave, hwndC);
|
---|
| 3307 | RestorePresParams(hwndPPSave, "DirCnr");
|
---|
| 3308 | }
|
---|
| 3309 | sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);
|
---|
| 3310 | RestorePresParams(hwndCnr, szKey);
|
---|
| 3311 | dcd = WinQueryWindowPtr(hwndCnr, QWL_USER);
|
---|
| 3312 | if (dcd) {
|
---|
| 3313 | dcd->ds.detailslongname = localdcd.ds.detailslongname;
|
---|
| 3314 | dcd->ds.detailssubject = localdcd.ds.detailssubject ;
|
---|
| 3315 | dcd->ds.detailsattr = localdcd.ds.detailsattr ;
|
---|
| 3316 | dcd->ds.detailsea = localdcd.ds.detailsea ;
|
---|
| 3317 | dcd->ds.detailssize = localdcd.ds.detailssize ;
|
---|
| 3318 | dcd->ds.detailsicon = localdcd.ds.detailsicon ;
|
---|
| 3319 | dcd->ds.detailscrdate = localdcd.ds.detailscrdate ;
|
---|
| 3320 | dcd->ds.detailscrtime = localdcd.ds.detailscrtime ;
|
---|
| 3321 | dcd->ds.detailsladate = localdcd.ds.detailsladate ;
|
---|
| 3322 | dcd->ds.detailslatime = localdcd.ds.detailslatime ;
|
---|
| 3323 | dcd->ds.detailslwdate = localdcd.ds.detailslwdate ;
|
---|
| 3324 | dcd->ds.detailslwtime = localdcd.ds.detailslwtime ;
|
---|
| 3325 | size = sizeof(INT);
|
---|
| 3326 | sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x);
|
---|
| 3327 | if (PrfQueryProfileData(fmprof,
|
---|
| 3328 | FM3Str,
|
---|
| 3329 | szKey,
|
---|
| 3330 | (PVOID) & dcd->sortFlags,
|
---|
| 3331 | &size) && size == sizeof(INT)) {
|
---|
| 3332 | if (!dcd->sortFlags)
|
---|
| 3333 | dcd->sortFlags = SORT_PATHNAME;
|
---|
| 3334 | }
|
---|
| 3335 | if (fDeleteState)
|
---|
| 3336 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3337 | size = sizeof(MASK);
|
---|
| 3338 | sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x);
|
---|
| 3339 | if (PrfQueryProfileData(fmprof,
|
---|
| 3340 | FM3Str,
|
---|
| 3341 | szKey,
|
---|
| 3342 | (PVOID) & dcd->mask, &size) && size) {
|
---|
| 3343 | if (*dcd->mask.szMask)
|
---|
| 3344 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
| 3345 | UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
|
---|
| 3346 | }
|
---|
| 3347 | *(dcd->mask.prompt) = 0;
|
---|
| 3348 | if (fDeleteState)
|
---|
| 3349 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3350 | size = sizeof(ULONG);
|
---|
| 3351 | sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x);
|
---|
| 3352 | if (!noview) {
|
---|
| 3353 | if (PrfQueryProfileData(fmprof,
|
---|
| 3354 | FM3Str,
|
---|
| 3355 | szKey,
|
---|
| 3356 | (PVOID) & dcd->flWindowAttr,
|
---|
| 3357 | &size) && size == sizeof(ULONG)) {
|
---|
[2] | 3358 |
|
---|
[1077] | 3359 | CNRINFO cnri;
|
---|
[2] | 3360 |
|
---|
[1077] | 3361 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 3362 | cnri.cb = sizeof(CNRINFO);
|
---|
| 3363 | if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
| 3364 | CM_QUERYCNRINFO,
|
---|
| 3365 | MPFROMP(&cnri),
|
---|
| 3366 | MPFROMLONG(sizeof(CNRINFO)))) {
|
---|
| 3367 | cnri.flWindowAttr = dcd->flWindowAttr;
|
---|
| 3368 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
| 3369 | CM_SETCNRINFO,
|
---|
| 3370 | MPFROMP(&cnri),
|
---|
| 3371 | MPFROMLONG(CMA_FLWINDOWATTR));
|
---|
| 3372 | }
|
---|
| 3373 | }
|
---|
| 3374 | }
|
---|
| 3375 | if (fDeleteState)
|
---|
| 3376 | PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
|
---|
| 3377 | if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL))
|
---|
| 3378 | WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL);
|
---|
| 3379 | }
|
---|
| 3380 | }
|
---|
| 3381 | fRestored = TRUE;
|
---|
| 3382 | swp.hwnd = hwndDir;
|
---|
| 3383 | TransformSwp(&swp, xtrans, ytrans);
|
---|
| 3384 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
---|
| 3385 | WinSetWindowPos(hwndDir,
|
---|
| 3386 | HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);
|
---|
| 3387 | WinSetWindowUShort(hwndDir, QWS_XRESTORE, (USHORT) swp.x);
|
---|
| 3388 | WinSetWindowUShort(hwndDir, QWS_CXRESTORE, (USHORT) swp.cx);
|
---|
| 3389 | WinSetWindowUShort(hwndDir, QWS_YRESTORE, (USHORT) swp.y);
|
---|
| 3390 | WinSetWindowUShort(hwndDir, QWS_CYRESTORE, (USHORT) swp.cy);
|
---|
| 3391 | } else
|
---|
| 3392 | WinSetWindowPos(hwndDir,
|
---|
| 3393 | HWND_TOP,
|
---|
| 3394 | swp.x,
|
---|
| 3395 | swp.y,
|
---|
| 3396 | swp.cx,
|
---|
| 3397 | swp.cy,
|
---|
| 3398 | swp.fl | SWP_MOVE |
|
---|
| 3399 | SWP_SIZE | SWP_SHOW | SWP_ZORDER |
|
---|
| 3400 | SWP_ACTIVATE);
|
---|
| 3401 | }
|
---|
| 3402 | }
|
---|
[133] | 3403 | }
|
---|
[557] | 3404 | } // for
|
---|
[981] | 3405 | if (hwndPPSave) {
|
---|
| 3406 | SavePresParams(hwndPPSave, "DirCnr");
|
---|
| 3407 | WinDestroyWindow(hwndPPSave);
|
---|
| 3408 | }
|
---|
[133] | 3409 | }
|
---|
[558] | 3410 | return fRestored;
|
---|
[2] | 3411 | }
|
---|
| 3412 |
|
---|
[178] | 3413 | static ULONG CountChildren(HWND hwndClient, ULONG * ulNumMinChildren)
|
---|
[133] | 3414 | {
|
---|
| 3415 | HENUM henum;
|
---|
| 3416 | HWND hwndChild;
|
---|
| 3417 | SWP swp;
|
---|
| 3418 | register ULONG ulCnt = 0L;
|
---|
| 3419 | USHORT id;
|
---|
[2] | 3420 |
|
---|
[133] | 3421 | if (ulNumMinChildren)
|
---|
| 3422 | *ulNumMinChildren = 0L;
|
---|
| 3423 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 3424 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 3425 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
---|
| 3426 | if (!id || (!fFreeTree && id == TREE_FRAME))
|
---|
| 3427 | continue;
|
---|
| 3428 | ulCnt++;
|
---|
[551] | 3429 | if (ulNumMinChildren) {
|
---|
| 3430 | if (WinQueryWindowPos(hwndChild, &swp) && (swp.fl & SWP_MINIMIZE))
|
---|
[1077] | 3431 | (*ulNumMinChildren)++;
|
---|
[133] | 3432 | }
|
---|
| 3433 | }
|
---|
| 3434 | WinEndEnumWindows(henum);
|
---|
| 3435 | return ulCnt;
|
---|
[2] | 3436 | }
|
---|
| 3437 |
|
---|
[133] | 3438 | VOID GetNextWindowPos(HWND hwndClient, PSWP pswp, ULONG * ulCntR,
|
---|
[1077] | 3439 | ULONG * ulNumMinChildrenR)
|
---|
[133] | 3440 | {
|
---|
| 3441 | register ULONG ulCnt;
|
---|
| 3442 | ULONG ulNumMinChildren;
|
---|
| 3443 | RECTL Rectl;
|
---|
| 3444 | register ULONG ulXDiff, ulYDiff, ulWindowsPerStack;
|
---|
[2] | 3445 |
|
---|
[133] | 3446 | if (!ulCntR || !ulNumMinChildrenR)
|
---|
| 3447 | ulCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
---|
[551] | 3448 | else {
|
---|
[133] | 3449 | ulCnt = *ulCntR;
|
---|
| 3450 | ulNumMinChildren = *ulNumMinChildrenR;
|
---|
[787] | 3451 | if (ulCnt == (ULONG) - 1) {
|
---|
[133] | 3452 | ulCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
---|
| 3453 | /* return these values to the caller for later use */
|
---|
| 3454 | *ulCntR = ulCnt;
|
---|
| 3455 | *ulNumMinChildrenR = ulNumMinChildren;
|
---|
| 3456 | }
|
---|
| 3457 | }
|
---|
| 3458 | WinQueryWindowRect(hwndClient, &Rectl);
|
---|
| 3459 | AdjustSizeOfClient(NULL, &Rectl);
|
---|
[551] | 3460 | if (!fFreeTree) {
|
---|
[2] | 3461 |
|
---|
[133] | 3462 | SWP swp;
|
---|
[2] | 3463 |
|
---|
[133] | 3464 | WinQueryWindowPos(hwndTree, &swp);
|
---|
| 3465 | if (ulNumMinChildren || (swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
| 3466 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
| 3467 | }
|
---|
| 3468 | else if (ulNumMinChildren)
|
---|
| 3469 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
[2] | 3470 |
|
---|
[133] | 3471 | ulXDiff = WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER) +
|
---|
| 3472 | WinQuerySysValue(HWND_DESKTOP, SV_CXMINMAXBUTTON) / 2;
|
---|
| 3473 | ulYDiff = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER) +
|
---|
| 3474 | WinQuerySysValue(HWND_DESKTOP, SV_CYMINMAXBUTTON);
|
---|
| 3475 | ulWindowsPerStack = (Rectl.yTop - Rectl.yBottom) / (3 * ulYDiff);
|
---|
[551] | 3476 | pswp->cx = Rectl.xRight - (ulWindowsPerStack * ulXDiff);
|
---|
| 3477 | pswp->cy = (Rectl.yTop - Rectl.yBottom) - (ulWindowsPerStack * ulYDiff);
|
---|
[133] | 3478 | ulWindowsPerStack++;
|
---|
[551] | 3479 | pswp->x = Rectl.xLeft + ((ulCnt % ulWindowsPerStack) * ulXDiff);
|
---|
| 3480 | pswp->y = (Rectl.yTop - pswp->cy - ((ulCnt % ulWindowsPerStack) * ulYDiff));
|
---|
[2] | 3481 | }
|
---|
| 3482 |
|
---|
[178] | 3483 | static VOID CascadeChildren(HWND hwndClient)
|
---|
[133] | 3484 | {
|
---|
| 3485 | ULONG ulCnt = 0L, ulNumMinChildren;
|
---|
| 3486 | HWND hwndChild;
|
---|
| 3487 | HENUM henum;
|
---|
| 3488 | SWP swp;
|
---|
| 3489 | USHORT id;
|
---|
| 3490 | RECTL Rectl;
|
---|
[2] | 3491 |
|
---|
[133] | 3492 | WinQueryWindowPos(hwndClient, &swp);
|
---|
| 3493 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
| 3494 | return;
|
---|
[2] | 3495 |
|
---|
[133] | 3496 | CountChildren(hwndClient, &ulNumMinChildren);
|
---|
[551] | 3497 | if (!fFreeTree) {
|
---|
[133] | 3498 | WinQueryWindowRect(hwndClient, &Rectl);
|
---|
| 3499 | AdjustSizeOfClient(NULL, &Rectl);
|
---|
| 3500 | WinQueryWindowPos(hwndTree, &swp);
|
---|
[551] | 3501 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
[133] | 3502 | if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
|
---|
[1077] | 3503 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
---|
[133] | 3504 | if (swp.x != 0)
|
---|
[1077] | 3505 | swp.x = 0;
|
---|
[133] | 3506 | if (swp.y < 0)
|
---|
[1077] | 3507 | swp.y = 0;
|
---|
[133] | 3508 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
---|
[1077] | 3509 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
---|
[133] | 3510 | WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
[1077] | 3511 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
[133] | 3512 | }
|
---|
| 3513 | }
|
---|
| 3514 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 3515 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 3516 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
---|
| 3517 | if (!id || (!fFreeTree && id == TREE_FRAME))
|
---|
| 3518 | continue;
|
---|
| 3519 | WinQueryWindowPos(hwndChild, &swp);
|
---|
[551] | 3520 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE))) {
|
---|
[133] | 3521 | GetNextWindowPos(hwndClient, &swp, &ulCnt, &ulNumMinChildren);
|
---|
| 3522 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
[1077] | 3523 | SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE |
|
---|
| 3524 | SWP_ZORDER | SWP_ACTIVATE);
|
---|
[133] | 3525 | ulCnt++;
|
---|
| 3526 | }
|
---|
| 3527 | }
|
---|
| 3528 | WinEndEnumWindows(henum);
|
---|
[2] | 3529 | }
|
---|
| 3530 |
|
---|
[133] | 3531 | VOID TileChildren(HWND hwndClient, BOOL absolute)
|
---|
| 3532 | {
|
---|
| 3533 | register ULONG ulChildCnt, ulSquare, ulNumRows, ulNumCols, ulExtraCols,
|
---|
[551] | 3534 | ulWidth, ulHeight;
|
---|
[133] | 3535 | ULONG ulNumMinChildren;
|
---|
| 3536 | RECTL Rectl;
|
---|
| 3537 | HWND hwndChild;
|
---|
[2] | 3538 |
|
---|
[133] | 3539 | if (fNoTileUpdate || hwndClient == HWND_DESKTOP)
|
---|
| 3540 | return;
|
---|
| 3541 | {
|
---|
| 3542 | SWP swp;
|
---|
[2] | 3543 |
|
---|
[133] | 3544 | WinQueryWindowPos(hwndClient, &swp);
|
---|
| 3545 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
| 3546 | return;
|
---|
| 3547 | }
|
---|
[551] | 3548 | ulChildCnt = CountChildren(hwndClient, &ulNumMinChildren);
|
---|
[133] | 3549 | ulChildCnt -= ulNumMinChildren;
|
---|
| 3550 | if (!ulChildCnt)
|
---|
| 3551 | return;
|
---|
[2] | 3552 |
|
---|
[133] | 3553 | fNoTileUpdate = TRUE;
|
---|
[2] | 3554 |
|
---|
[551] | 3555 | for (ulSquare = 2; ulSquare * ulSquare <= ulChildCnt; ulSquare++) {
|
---|
[133] | 3556 | ;
|
---|
[200] | 3557 | }
|
---|
[551] | 3558 | if (!fTileBackwards) {
|
---|
[787] | 3559 | ulNumCols = ulSquare - 1;
|
---|
[133] | 3560 | ulNumRows = ulChildCnt / ulNumCols;
|
---|
| 3561 | }
|
---|
[551] | 3562 | else {
|
---|
[787] | 3563 | ulNumRows = ulSquare - 1;
|
---|
[133] | 3564 | ulNumCols = ulChildCnt / ulNumRows;
|
---|
| 3565 | }
|
---|
| 3566 | ulExtraCols = ulChildCnt % ulNumCols;
|
---|
[2] | 3567 |
|
---|
[551] | 3568 | WinQueryWindowRect(hwndClient, &Rectl);
|
---|
[2] | 3569 |
|
---|
[551] | 3570 | if (!fFreeTree) {
|
---|
[2] | 3571 |
|
---|
[133] | 3572 | SWP swp;
|
---|
[2] | 3573 |
|
---|
[133] | 3574 | WinQueryWindowPos(hwndTree, &swp);
|
---|
[551] | 3575 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
[133] | 3576 | if (swp.y < 0)
|
---|
[1077] | 3577 | swp.y = 0;
|
---|
[133] | 3578 | if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
|
---|
[1077] | 3579 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
---|
[133] | 3580 | if (swp.x != 0)
|
---|
[1077] | 3581 | swp.x = 0;
|
---|
[133] | 3582 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
---|
[1077] | 3583 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
---|
[2] | 3584 | WinSetWindowPos(hwndTree,
|
---|
[1077] | 3585 | HWND_TOP,
|
---|
| 3586 | swp.x,
|
---|
| 3587 | swp.y,
|
---|
| 3588 | swp.cx,
|
---|
| 3589 | swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
[133] | 3590 | WinQueryWindowPos(hwndTree, &swp);
|
---|
| 3591 | }
|
---|
[551] | 3592 | if (ulNumMinChildren || (swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
[133] | 3593 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
| 3594 | }
|
---|
| 3595 | else if (ulNumMinChildren)
|
---|
| 3596 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
[2] | 3597 |
|
---|
[551] | 3598 | AdjustSizeOfClient(NULL, &Rectl);
|
---|
[2] | 3599 |
|
---|
[551] | 3600 | if (Rectl.xRight > 0L && (Rectl.yBottom < Rectl.yTop)) {
|
---|
[2] | 3601 |
|
---|
[133] | 3602 | HENUM henum;
|
---|
[2] | 3603 |
|
---|
[133] | 3604 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 3605 | if ((hwndChild = WinGetNextWindow(henum)) != (HWND) 0) {
|
---|
[2] | 3606 |
|
---|
[133] | 3607 | ULONG ulCurRow, ulCurCol;
|
---|
| 3608 | SWP swp;
|
---|
| 3609 | USHORT id;
|
---|
[2] | 3610 |
|
---|
[133] | 3611 | ulHeight = (Rectl.yTop - Rectl.yBottom) / ulNumRows;
|
---|
[2] | 3612 |
|
---|
[551] | 3613 | for (ulCurRow = 0; ulCurRow < ulNumRows; ulCurRow++) {
|
---|
[1077] | 3614 | if ((ulNumRows - ulCurRow) <= ulExtraCols)
|
---|
| 3615 | ulNumCols++;
|
---|
| 3616 | for (ulCurCol = 0; ulCurCol < ulNumCols; ulCurCol++) {
|
---|
| 3617 | ulWidth = Rectl.xRight / ulNumCols;
|
---|
[2] | 3618 |
|
---|
[1077] | 3619 | while (hwndChild) {
|
---|
| 3620 | id = WinQueryWindowUShort(hwndChild, QWS_ID);
|
---|
| 3621 | if (id && (id != TREE_FRAME || fFreeTree)) {
|
---|
| 3622 | WinQueryWindowPos(hwndChild, &swp);
|
---|
| 3623 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
| 3624 | break;
|
---|
| 3625 | }
|
---|
| 3626 | hwndChild = WinGetNextWindow(henum);
|
---|
| 3627 | }
|
---|
[2] | 3628 |
|
---|
[1077] | 3629 | if (hwndChild) {
|
---|
| 3630 | if (!absolute && (swp.fl & SWP_MAXIMIZE)) {
|
---|
| 3631 | WinGetMaxPosition(hwndChild, &swp);
|
---|
| 3632 | WinSetWindowPos(hwndChild,
|
---|
| 3633 | HWND_TOP,
|
---|
| 3634 | swp.x,
|
---|
| 3635 | swp.y,
|
---|
| 3636 | swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
---|
| 3637 | WinSetWindowUShort(hwndChild,
|
---|
| 3638 | QWS_XRESTORE,
|
---|
| 3639 | (USHORT) (ulWidth * ulCurCol) + Rectl.xLeft);
|
---|
| 3640 | WinSetWindowUShort(hwndChild,
|
---|
| 3641 | QWS_YRESTORE,
|
---|
| 3642 | (USHORT) (Rectl.yTop -
|
---|
| 3643 | (ulHeight * (ulCurRow + 1))));
|
---|
| 3644 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth);
|
---|
| 3645 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight);
|
---|
| 3646 | }
|
---|
| 3647 | else
|
---|
| 3648 | WinSetWindowPos(hwndChild,
|
---|
| 3649 | HWND_TOP,
|
---|
| 3650 | (ulWidth * ulCurCol) + Rectl.xLeft,
|
---|
| 3651 | Rectl.yTop - (ulHeight * (ulCurRow + 1)),
|
---|
| 3652 | ulWidth,
|
---|
| 3653 | ulHeight,
|
---|
| 3654 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
| 3655 | hwndChild = WinGetNextWindow(henum);
|
---|
| 3656 | }
|
---|
| 3657 | }
|
---|
| 3658 | if ((ulNumRows - ulCurRow) <= ulExtraCols) {
|
---|
| 3659 | ulNumCols--;
|
---|
| 3660 | ulExtraCols--;
|
---|
| 3661 | }
|
---|
[133] | 3662 | }
|
---|
| 3663 | }
|
---|
| 3664 | WinEndEnumWindows(henum);
|
---|
| 3665 | }
|
---|
[2] | 3666 |
|
---|
[133] | 3667 | fNoTileUpdate = FALSE;
|
---|
[2] | 3668 | }
|
---|
| 3669 |
|
---|
[551] | 3670 | static VOID ResizeChildren(HWND hwndClient, SHORT oldcx, SHORT oldcy,
|
---|
[1077] | 3671 | SHORT newcx, SHORT newcy)
|
---|
[133] | 3672 | {
|
---|
| 3673 | /*
|
---|
| 3674 | * resize all children of the client to maintain their proportional
|
---|
| 3675 | * sizes and positions
|
---|
| 3676 | */
|
---|
[2] | 3677 |
|
---|
[551] | 3678 | if (!newcx || !newcy || !oldcx || !oldcy)
|
---|
[133] | 3679 | return;
|
---|
| 3680 | {
|
---|
| 3681 | HENUM henum;
|
---|
| 3682 | HWND hwndChild;
|
---|
| 3683 | register LONG x, y, cx, cy, ucx, ucy, ux, uy;
|
---|
| 3684 | SWP swp;
|
---|
[2] | 3685 |
|
---|
[133] | 3686 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 3687 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 3688 | if (!WinQueryWindowUShort(hwndChild, QWS_ID))
|
---|
[1077] | 3689 | continue;
|
---|
[551] | 3690 | if (WinQueryWindowPos(hwndChild, &swp)) {
|
---|
[1077] | 3691 | if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {
|
---|
| 3692 | swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);
|
---|
| 3693 | swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);
|
---|
| 3694 | swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);
|
---|
| 3695 | swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);
|
---|
| 3696 | }
|
---|
| 3697 | else if (swp.fl & SWP_MAXIMIZE) {
|
---|
| 3698 | swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);
|
---|
| 3699 | swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);
|
---|
| 3700 | swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);
|
---|
| 3701 | swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);
|
---|
| 3702 | }
|
---|
| 3703 | cx = (swp.cx) ? (LONG) (((double)oldcx * 100.0) / (double)swp.cx) : 0;
|
---|
| 3704 | cy = (swp.cy) ? (LONG) (((double)oldcy * 100.0) / (double)swp.cy) : 0;
|
---|
| 3705 | x = (swp.x) ? (LONG) (((double)oldcx * 100.0) / (double)swp.x) : 0;
|
---|
| 3706 | y = (swp.y) ? (LONG) (((double)oldcy * 100.0) / (double)swp.y) : 0;
|
---|
| 3707 | if (x < 0)
|
---|
| 3708 | x = 0;
|
---|
| 3709 | if (y < 0)
|
---|
| 3710 | y = 0;
|
---|
| 3711 | ux = (x) ? (LONG) (((double)newcx * 100.0) / (double)x) : 0;
|
---|
| 3712 | uy = (y) ? (LONG) (((double)newcy * 100.0) / (double)y) : 0;
|
---|
| 3713 | ucx = (cx) ? (LONG) (((double)newcx * 100.0) / (double)cx) : 0;
|
---|
| 3714 | ucy = (cy) ? (LONG) (((double)newcy * 100.0) / (double)cy) : 0;
|
---|
| 3715 | if (ux + ucx > newcx)
|
---|
| 3716 | ucx = newcx - ux;
|
---|
| 3717 | if (uy + ucy > newcy)
|
---|
| 3718 | ucy = newcy - uy;
|
---|
[2] | 3719 |
|
---|
[1077] | 3720 | if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)))
|
---|
| 3721 | WinSetWindowPos(hwndChild, HWND_TOP, ux, uy, ucx, ucy,
|
---|
| 3722 | SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
---|
| 3723 | else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
---|
| 3724 | WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1);
|
---|
| 3725 | WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);
|
---|
| 3726 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,
|
---|
| 3727 | SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE);
|
---|
| 3728 | WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);
|
---|
| 3729 | WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);
|
---|
| 3730 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);
|
---|
| 3731 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);
|
---|
| 3732 | }
|
---|
| 3733 | else {
|
---|
| 3734 | WinGetMaxPosition(hwndChild, &swp);
|
---|
| 3735 | WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
| 3736 | SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
---|
| 3737 | WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);
|
---|
| 3738 | WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);
|
---|
| 3739 | WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);
|
---|
| 3740 | WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);
|
---|
| 3741 | }
|
---|
[133] | 3742 | }
|
---|
| 3743 | }
|
---|
| 3744 | WinEndEnumWindows(henum);
|
---|
| 3745 | }
|
---|
[551] | 3746 | if (!fFreeTree) {
|
---|
[2] | 3747 |
|
---|
[133] | 3748 | RECTL Rectl;
|
---|
| 3749 | SWP swp;
|
---|
[2] | 3750 |
|
---|
[133] | 3751 | WinQueryWindowRect(hwndClient, &Rectl);
|
---|
| 3752 | AdjustSizeOfClient(NULL, &Rectl);
|
---|
| 3753 | WinQueryWindowPos(hwndTree, &swp);
|
---|
[551] | 3754 | if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
[954] | 3755 |
|
---|
| 3756 | if (!fNoTreeGap) {
|
---|
[1077] | 3757 | INT height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
| 3758 | if (swp.y < height)
|
---|
| 3759 | swp.y = height; // Force bottom to position
|
---|
[954] | 3760 | }
|
---|
| 3761 | else
|
---|
[1077] | 3762 | swp.y = 0; // Force bottom to position
|
---|
[954] | 3763 |
|
---|
| 3764 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
---|
| 3765 | if (swp.cy < 0)
|
---|
[1077] | 3766 | swp.cy = 0;
|
---|
[954] | 3767 |
|
---|
[133] | 3768 | if (swp.x != 0)
|
---|
[1077] | 3769 | swp.x = 0; // Left align
|
---|
[954] | 3770 |
|
---|
| 3771 | // AdjustSizeOfClient can return bogus xRight values - fixme someday
|
---|
| 3772 | if (Rectl.xRight >= Rectl.xLeft) {
|
---|
[1077] | 3773 | if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
---|
| 3774 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
---|
[954] | 3775 | }
|
---|
[133] | 3776 | WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
|
---|
[1077] | 3777 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
[133] | 3778 | }
|
---|
| 3779 | }
|
---|
[2] | 3780 | }
|
---|
| 3781 |
|
---|
[178] | 3782 | static VOID MinResChildren(HWND hwndClient, ULONG cmd)
|
---|
[133] | 3783 | {
|
---|
| 3784 | HENUM henum;
|
---|
| 3785 | HWND hwndChild;
|
---|
[2] | 3786 |
|
---|
[133] | 3787 | {
|
---|
| 3788 | SWP swp;
|
---|
[2] | 3789 |
|
---|
[133] | 3790 | WinQueryWindowPos(hwndClient, &swp);
|
---|
| 3791 | if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
| 3792 | return;
|
---|
| 3793 | }
|
---|
| 3794 | henum = WinBeginEnumWindows(hwndClient);
|
---|
[551] | 3795 | while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
[133] | 3796 | if (!WinQueryWindowUShort(hwndChild, QWS_ID))
|
---|
| 3797 | continue;
|
---|
| 3798 | WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, cmd);
|
---|
| 3799 | }
|
---|
[2] | 3800 | }
|
---|
| 3801 |
|
---|
[178] | 3802 | //=== ChildFrameButtonProc: subclass handler for WALKBUTTON and QUICKBUTTON windows ===
|
---|
| 3803 |
|
---|
| 3804 | static MRESULT EXPENTRY ChildFrameButtonProc(HWND hwnd,
|
---|
[1077] | 3805 | ULONG msg,
|
---|
| 3806 | MPARAM mp1, MPARAM mp2)
|
---|
[133] | 3807 | {
|
---|
| 3808 | USHORT id;
|
---|
| 3809 | static BOOL emphasized = FALSE;
|
---|
[2] | 3810 |
|
---|
[551] | 3811 | switch (msg) {
|
---|
[133] | 3812 | case WM_BUTTON1CLICK:
|
---|
| 3813 | case WM_CHORD:
|
---|
| 3814 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 3815 | break;
|
---|
[2] | 3816 |
|
---|
[133] | 3817 | case WM_MOUSEMOVE:
|
---|
[551] | 3818 | if (fOtherHelp) {
|
---|
| 3819 | if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
|
---|
[1077] | 3820 | && !WinQueryCapture(HWND_DESKTOP)) {
|
---|
| 3821 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 3822 | switch (id) {
|
---|
| 3823 | case IDM_OPENWALK:
|
---|
| 3824 | MakeBubble(hwnd, FALSE, GetPString(IDS_WALKBUTTONHELP));
|
---|
| 3825 | break;
|
---|
| 3826 | case IDM_USERLIST:
|
---|
| 3827 | MakeBubble(hwnd, FALSE, GetPString(IDS_QUICKBUTTONHELP));
|
---|
| 3828 | break;
|
---|
| 3829 | }
|
---|
[133] | 3830 | }
|
---|
| 3831 | }
|
---|
| 3832 | break;
|
---|
[2] | 3833 |
|
---|
[133] | 3834 | case WM_BUTTON3CLICK:
|
---|
| 3835 | case WM_BUTTON2CLICK:
|
---|
| 3836 | {
|
---|
| 3837 | USHORT cmd = 0;
|
---|
[2] | 3838 |
|
---|
[133] | 3839 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 3840 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 3841 | switch (id) {
|
---|
[133] | 3842 | case IDM_OPENWALK:
|
---|
[1077] | 3843 | switch (msg) {
|
---|
| 3844 | case WM_BUTTON2CLICK:
|
---|
| 3845 | if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
|
---|
| 3846 | (KC_ALT | KC_SHIFT | KC_CTRL))
|
---|
| 3847 | cmd = IDM_GREP;
|
---|
| 3848 | else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))
|
---|
| 3849 | CascadeChildren(hwndMain);
|
---|
[2] | 3850 |
|
---|
| 3851 | #ifdef NEVER
|
---|
[1077] | 3852 | else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))
|
---|
| 3853 | cmd = IDM_SYSINFO;
|
---|
[2] | 3854 | #endif
|
---|
[133] | 3855 |
|
---|
[1077] | 3856 | else if (shiftstate & KC_SHIFT)
|
---|
| 3857 | cmd = IDM_WINDOWDLG;
|
---|
| 3858 | else if (shiftstate & KC_CTRL)
|
---|
| 3859 | cmd = IDM_SEEALL;
|
---|
| 3860 | else if (shiftstate & KC_ALT)
|
---|
| 3861 | TileChildren(hwndMain, TRUE);
|
---|
| 3862 | else
|
---|
| 3863 | cmd = IDM_WALKDIR;
|
---|
| 3864 | break;
|
---|
| 3865 | case WM_BUTTON3CLICK:
|
---|
| 3866 | TileChildren(hwndMain, TRUE);
|
---|
| 3867 | break;
|
---|
| 3868 | }
|
---|
| 3869 | break;
|
---|
[133] | 3870 | case IDM_USERLIST:
|
---|
[1077] | 3871 | switch (msg) {
|
---|
| 3872 | case WM_BUTTON2CLICK:
|
---|
| 3873 | if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
|
---|
| 3874 | (KC_ALT | KC_SHIFT | KC_CTRL))
|
---|
| 3875 | cmd = IDM_COLORPALETTE;
|
---|
| 3876 | else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))
|
---|
| 3877 | cmd = IDM_HIDEMENU;
|
---|
| 3878 | else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))
|
---|
| 3879 | cmd = IDM_NOTEBOOK;
|
---|
| 3880 | else if (shiftstate & KC_SHIFT)
|
---|
| 3881 | cmd = IDM_TOOLTITLES;
|
---|
| 3882 | else if (shiftstate & KC_CTRL)
|
---|
| 3883 | cmd = IDM_TEXTTOOLS;
|
---|
| 3884 | else if (shiftstate & KC_ALT)
|
---|
| 3885 | cmd = IDM_FONTPALETTE;
|
---|
| 3886 | else
|
---|
| 3887 | cmd = IDM_TOOLBAR;
|
---|
| 3888 | break;
|
---|
| 3889 | case WM_BUTTON3CLICK:
|
---|
| 3890 | cmd = IDM_DRIVEBAR;
|
---|
| 3891 | break;
|
---|
| 3892 | }
|
---|
| 3893 | break;
|
---|
[930] | 3894 | } // switch id
|
---|
[200] | 3895 |
|
---|
[551] | 3896 | if (cmd) {
|
---|
[1077] | 3897 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_CLIENT),
|
---|
| 3898 | WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
|
---|
[200] | 3899 | }
|
---|
[133] | 3900 | }
|
---|
| 3901 | break;
|
---|
[2] | 3902 |
|
---|
[133] | 3903 | case DM_DRAGOVER:
|
---|
| 3904 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[551] | 3905 | if (id == IDM_OPENWALK) {
|
---|
| 3906 | if (!emphasized) {
|
---|
[1077] | 3907 | emphasized = TRUE;
|
---|
| 3908 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 3909 | }
|
---|
[618] | 3910 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
---|
[1077] | 3911 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
---|
[133] | 3912 | }
|
---|
| 3913 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
---|
[2] | 3914 |
|
---|
[133] | 3915 | case DM_DRAGLEAVE:
|
---|
[551] | 3916 | if (emphasized) {
|
---|
[133] | 3917 | emphasized = FALSE;
|
---|
| 3918 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
| 3919 | }
|
---|
| 3920 | break;
|
---|
[2] | 3921 |
|
---|
[133] | 3922 | case DM_DROPHELP:
|
---|
| 3923 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_OPENDROPHELP));
|
---|
| 3924 | return 0;
|
---|
[2] | 3925 |
|
---|
[133] | 3926 | case DM_DROP:
|
---|
| 3927 | {
|
---|
| 3928 | char szFrom[CCHMAXPATH + 2];
|
---|
[2] | 3929 |
|
---|
[551] | 3930 | if (emphasized) {
|
---|
[1077] | 3931 | emphasized = FALSE;
|
---|
| 3932 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[133] | 3933 | }
|
---|
[618] | 3934 | if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
|
---|
[1077] | 3935 | if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) {
|
---|
| 3936 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom);
|
---|
| 3937 | }
|
---|
[133] | 3938 | }
|
---|
| 3939 | }
|
---|
| 3940 | return 0;
|
---|
[2] | 3941 |
|
---|
[133] | 3942 | case WM_CLOSE:
|
---|
| 3943 | WinDestroyWindow(hwnd);
|
---|
| 3944 | return 0;
|
---|
| 3945 | }
|
---|
| 3946 | return PFNWPButton(hwnd, msg, mp1, mp2);
|
---|
[2] | 3947 | }
|
---|
| 3948 |
|
---|
[551] | 3949 | static MRESULT EXPENTRY MainFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
[1077] | 3950 | MPARAM mp2)
|
---|
[133] | 3951 | {
|
---|
| 3952 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 3953 | static ULONG aheight = 0L;
|
---|
[2] | 3954 |
|
---|
[551] | 3955 | switch (msg) {
|
---|
[133] | 3956 | case WM_ADJUSTWINDOWPOS:
|
---|
| 3957 | {
|
---|
| 3958 | SWP *pswp;
|
---|
[2] | 3959 |
|
---|
[133] | 3960 | pswp = (SWP *) mp1;
|
---|
[551] | 3961 | if (fDataMin && !fAmClosing) {
|
---|
[1077] | 3962 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
---|
[2] | 3963 |
|
---|
[1077] | 3964 | SWP swp;
|
---|
[2] | 3965 |
|
---|
[1077] | 3966 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 3967 | PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID);
|
---|
| 3968 | HideNote();
|
---|
| 3969 | }
|
---|
| 3970 | else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) {
|
---|
| 3971 | if (DataHwnd)
|
---|
| 3972 | PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 3973 | }
|
---|
[133] | 3974 | }
|
---|
[551] | 3975 | if (!fAmClosing) {
|
---|
[1077] | 3976 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
| 3977 | HideNote();
|
---|
[133] | 3978 | }
|
---|
| 3979 | }
|
---|
| 3980 | break;
|
---|
[2] | 3981 |
|
---|
[133] | 3982 | case UM_FOCUSME:
|
---|
| 3983 | CreateDataBar(HWND_DESKTOP, (ULONG) mp1);
|
---|
| 3984 | return 0;
|
---|
[2] | 3985 |
|
---|
[133] | 3986 | case WM_BUTTON1UP:
|
---|
| 3987 | case WM_BUTTON2UP:
|
---|
| 3988 | case WM_BUTTON3UP:
|
---|
| 3989 | case WM_MOUSEMOVE:
|
---|
| 3990 | case WM_CHORD:
|
---|
| 3991 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 3992 | break;
|
---|
[2] | 3993 |
|
---|
[133] | 3994 | case WM_CHAR:
|
---|
| 3995 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 3996 | break;
|
---|
[2] | 3997 |
|
---|
[133] | 3998 | case WM_CONTROL:
|
---|
[551] | 3999 | return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_CONTROL, mp1,
|
---|
[1077] | 4000 | mp2);
|
---|
[2] | 4001 |
|
---|
[133] | 4002 | case WM_COMMAND:
|
---|
| 4003 | return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
|
---|
[2] | 4004 |
|
---|
[133] | 4005 | case WM_CALCFRAMERECT:
|
---|
| 4006 | {
|
---|
| 4007 | MRESULT mr;
|
---|
| 4008 | PRECTL prectl;
|
---|
| 4009 | LONG sheight = 20, bheight = 20;
|
---|
[2] | 4010 |
|
---|
[133] | 4011 | mr = oldproc(hwnd, msg, mp1, mp2);
|
---|
[2] | 4012 |
|
---|
[133] | 4013 | /*
|
---|
| 4014 | * Calculate the position of the client rectangle.
|
---|
[178] | 4015 | * Otherwise, we'll see a lot of redraw when we move the
|
---|
[133] | 4016 | * client during WM_FORMATFRAME.
|
---|
| 4017 | */
|
---|
[2] | 4018 |
|
---|
[551] | 4019 | if (mr && mp2) {
|
---|
[1077] | 4020 | prectl = (PRECTL) mp1;
|
---|
| 4021 | if (prectl->yBottom != prectl->yTop) {
|
---|
| 4022 | {
|
---|
| 4023 | HPS hps;
|
---|
| 4024 | POINTL aptl[TXTBOX_COUNT];
|
---|
[2] | 4025 |
|
---|
[1077] | 4026 | hps = WinGetPS(hwndStatus);
|
---|
| 4027 | if (hps) {
|
---|
| 4028 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
| 4029 | bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 4030 | WinReleasePS(hps);
|
---|
| 4031 | }
|
---|
| 4032 | }
|
---|
| 4033 | prectl->yBottom += (sheight + 4);
|
---|
| 4034 | prectl->yTop -= (sheight + 4);
|
---|
| 4035 | if (fMoreButtons) {
|
---|
[2] | 4036 |
|
---|
[1077] | 4037 | HPS hps;
|
---|
| 4038 | POINTL aptl[TXTBOX_COUNT];
|
---|
[2] | 4039 |
|
---|
[1077] | 4040 | hps = WinGetPS(hwndName);
|
---|
| 4041 | if (hps) {
|
---|
| 4042 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
| 4043 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 4044 | WinReleasePS(hps);
|
---|
| 4045 | }
|
---|
| 4046 | prectl->yBottom += (bheight + 4);
|
---|
| 4047 | prectl->yTop -= (bheight + 4);
|
---|
| 4048 | }
|
---|
| 4049 | if (fToolbar) {
|
---|
| 4050 | if (!fTextTools)
|
---|
| 4051 | prectl->yTop -= ((fToolTitles) ? 50 : 40);
|
---|
| 4052 | else
|
---|
| 4053 | prectl->yTop -= 32;
|
---|
| 4054 | }
|
---|
| 4055 | if (fDrivebar) {
|
---|
| 4056 | ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES),
|
---|
| 4057 | ((prectl->xRight -
|
---|
| 4058 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
| 4059 | SV_CYSIZEBORDER) * 2)) - 4));
|
---|
| 4060 | prectl->yTop -= (16 * (DriveLines * 18));
|
---|
| 4061 | }
|
---|
| 4062 | if (fUserComboBox) {
|
---|
| 4063 | if (!aheight) {
|
---|
[2] | 4064 |
|
---|
[1077] | 4065 | SWP swpTemp;
|
---|
[2] | 4066 |
|
---|
[1077] | 4067 | WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
| 4068 | &swpTemp);
|
---|
| 4069 | aheight = swpTemp.cy;
|
---|
| 4070 | }
|
---|
| 4071 | prectl->yTop -= (aheight + 6L);
|
---|
| 4072 | }
|
---|
| 4073 | if (fAutoView) {
|
---|
| 4074 | AutoviewHeight = min(AutoviewHeight,
|
---|
| 4075 | (prectl->yTop - prectl->yBottom) - 116);
|
---|
| 4076 | AutoviewHeight = max(AutoviewHeight, 36);
|
---|
| 4077 | prectl->yBottom += (AutoviewHeight + 6);
|
---|
| 4078 | }
|
---|
| 4079 | }
|
---|
[133] | 4080 | }
|
---|
| 4081 | return mr;
|
---|
| 4082 | }
|
---|
[2] | 4083 |
|
---|
[133] | 4084 | case WM_FORMATFRAME:
|
---|
| 4085 | {
|
---|
| 4086 | SHORT sCount, soldCount;
|
---|
| 4087 | PSWP pswp, pswpClient, pswpNew;
|
---|
| 4088 | SWP swpClient;
|
---|
| 4089 | LONG theight = 48L, dheight = 20L, width, sheight = 20, bheight = 20;
|
---|
[2] | 4090 |
|
---|
[133] | 4091 | sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
|
---|
| 4092 | soldCount = sCount;
|
---|
[2] | 4093 |
|
---|
[133] | 4094 | /*
|
---|
| 4095 | * Reformat the frame to "squeeze" the client
|
---|
| 4096 | * and make room for status window sibling beneath
|
---|
| 4097 | * and toolbar above (if toolbar's on) and userlists
|
---|
| 4098 | * (if userlists are on).
|
---|
| 4099 | */
|
---|
[2] | 4100 |
|
---|
[133] | 4101 | pswp = (PSWP) mp1;
|
---|
| 4102 | {
|
---|
[1077] | 4103 | SHORT x;
|
---|
[2] | 4104 |
|
---|
[1077] | 4105 | for (x = 0; x < soldCount; x++) {
|
---|
| 4106 | if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {
|
---|
| 4107 | pswpClient = pswp;
|
---|
| 4108 | break;
|
---|
| 4109 | }
|
---|
| 4110 | pswp++;
|
---|
| 4111 | }
|
---|
[133] | 4112 | }
|
---|
[2] | 4113 |
|
---|
[133] | 4114 | {
|
---|
[1077] | 4115 | HPS hps;
|
---|
| 4116 | POINTL aptl[TXTBOX_COUNT];
|
---|
[2] | 4117 |
|
---|
[1077] | 4118 | hps = WinGetPS(hwndStatus);
|
---|
| 4119 | if (hps) {
|
---|
| 4120 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
| 4121 | bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 4122 | WinReleasePS(hps);
|
---|
| 4123 | }
|
---|
| 4124 | if (fMoreButtons) {
|
---|
| 4125 | hps = WinGetPS(hwndName);
|
---|
| 4126 | if (hps) {
|
---|
| 4127 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
| 4128 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 4129 | WinReleasePS(hps);
|
---|
| 4130 | }
|
---|
| 4131 | }
|
---|
[133] | 4132 | }
|
---|
| 4133 | pswpNew = (PSWP) mp1 + soldCount;
|
---|
| 4134 | *pswpNew = *pswpClient;
|
---|
| 4135 | swpClient = *pswpClient;
|
---|
[551] | 4136 | pswpNew->hwnd = hwndStatus;
|
---|
| 4137 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
| 4138 | pswpNew->x = swpClient.x + 3;
|
---|
| 4139 | pswpNew->y = swpClient.y + 2;
|
---|
[133] | 4140 | if (!fSplitStatus)
|
---|
[1077] | 4141 | width = swpClient.cx - (16 + (sheight * 2) + 4);
|
---|
[133] | 4142 | else
|
---|
[1077] | 4143 | width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2;
|
---|
[133] | 4144 | width = max(width, 10);
|
---|
| 4145 | if (fSplitStatus)
|
---|
[1077] | 4146 | pswpNew->cx = width - 6;
|
---|
[133] | 4147 | else
|
---|
[1077] | 4148 | pswpNew->cx = width - 8;
|
---|
[551] | 4149 | pswpNew->cy = sheight;
|
---|
| 4150 | pswpClient->y = pswpNew->y + pswpNew->cy + 3;
|
---|
| 4151 | pswpClient->cy = (swpClient.cy - pswpNew->cy) - 3;
|
---|
[133] | 4152 | sCount++;
|
---|
[2] | 4153 |
|
---|
[551] | 4154 | if (fSplitStatus) {
|
---|
[1077] | 4155 | pswpNew = (PSWP) mp1 + (soldCount + 1);
|
---|
| 4156 | *pswpNew = *pswpClient;
|
---|
| 4157 | pswpNew->hwnd = hwndStatus2;
|
---|
| 4158 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
| 4159 | pswpNew->x = width + 8;
|
---|
| 4160 | pswpNew->y = swpClient.y + 2;
|
---|
| 4161 | pswpNew->cx = width - 6;
|
---|
| 4162 | pswpNew->cy = sheight;
|
---|
| 4163 | sCount++;
|
---|
[133] | 4164 | }
|
---|
[551] | 4165 | else {
|
---|
[1077] | 4166 | WinShowWindow(hwndStatus2, FALSE);
|
---|
| 4167 | WinSetWindowText(hwndStatus2, NullStr);
|
---|
[133] | 4168 | }
|
---|
[2] | 4169 |
|
---|
[551] | 4170 | if (fToolbar) {
|
---|
[1077] | 4171 | if (fTextTools)
|
---|
| 4172 | theight = 32L;
|
---|
| 4173 | else if (!fToolTitles)
|
---|
| 4174 | theight = 40L;
|
---|
| 4175 | pswpNew = (PSWP) mp1 + (soldCount + 1 + (fSplitStatus != FALSE));
|
---|
| 4176 | *pswpNew = *pswpClient;
|
---|
| 4177 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS);
|
---|
| 4178 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
| 4179 | pswpNew->x = swpClient.x + 2;
|
---|
| 4180 | pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2);
|
---|
| 4181 | pswpNew->cx = swpClient.cx - 4;
|
---|
| 4182 | pswpNew->cy = theight - 4;
|
---|
| 4183 | pswpClient->cy -= theight;
|
---|
| 4184 | sCount++;
|
---|
[133] | 4185 | }
|
---|
| 4186 | else
|
---|
[1077] | 4187 | WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE);
|
---|
[2] | 4188 |
|
---|
[551] | 4189 | if (fDrivebar) {
|
---|
[1077] | 4190 | ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4);
|
---|
| 4191 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
---|
| 4192 | (fSplitStatus != FALSE) +
|
---|
| 4193 | (fToolbar != FALSE));
|
---|
| 4194 | *pswpNew = *pswpClient;
|
---|
| 4195 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES);
|
---|
| 4196 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
| 4197 | pswpNew->x = swpClient.x + 2;
|
---|
| 4198 | dheight += ((dheight - 2) * DriveLines);
|
---|
| 4199 | pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);
|
---|
| 4200 | if (fToolbar)
|
---|
| 4201 | pswpNew->y -= theight;
|
---|
| 4202 | pswpNew->cx = swpClient.cx - 4;
|
---|
| 4203 | pswpNew->cy = dheight - 4;
|
---|
| 4204 | pswpClient->cy -= dheight;
|
---|
| 4205 | sCount++;
|
---|
[133] | 4206 | }
|
---|
| 4207 | else
|
---|
[1077] | 4208 | WinShowWindow(WinWindowFromID(hwnd, MAIN_DRIVES), FALSE);
|
---|
[2] | 4209 |
|
---|
[551] | 4210 | if (fAutoView) {
|
---|
[1077] | 4211 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
---|
| 4212 | (fToolbar != FALSE) +
|
---|
| 4213 | (fDrivebar != FALSE) +
|
---|
| 4214 | (fSplitStatus != FALSE));
|
---|
| 4215 | *pswpNew = *pswpClient;
|
---|
| 4216 | pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview;
|
---|
| 4217 | pswpNew->x = pswpClient->x + 3;
|
---|
| 4218 | pswpNew->y = pswpClient->y + 3;
|
---|
| 4219 | if (fMoreButtons)
|
---|
| 4220 | pswpNew->y += (bheight + 4);
|
---|
| 4221 | pswpNew->cx = pswpClient->cx - 6;
|
---|
| 4222 | AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116);
|
---|
| 4223 | AutoviewHeight = max(AutoviewHeight, 36);
|
---|
| 4224 | pswpNew->cy = AutoviewHeight;
|
---|
| 4225 | pswpClient->y += (AutoviewHeight + 6);
|
---|
| 4226 | pswpClient->cy -= (AutoviewHeight + 6);
|
---|
| 4227 | sCount++;
|
---|
| 4228 | WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE);
|
---|
[133] | 4229 | }
|
---|
[551] | 4230 | else {
|
---|
[1077] | 4231 | WinShowWindow(hwndAutoview, FALSE);
|
---|
| 4232 | WinShowWindow(hwndAutoMLE, FALSE);
|
---|
[133] | 4233 | }
|
---|
[2] | 4234 |
|
---|
[133] | 4235 | pswpNew = (PSWP) mp1 + (soldCount + 1 +
|
---|
[1077] | 4236 | (fToolbar != FALSE) +
|
---|
| 4237 | (fDrivebar != FALSE) +
|
---|
| 4238 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
---|
[133] | 4239 | *pswpNew = *pswpClient;
|
---|
[551] | 4240 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_OPENWALK);
|
---|
| 4241 | pswpNew->x = swpClient.cx - ((sheight * 2) + 4);
|
---|
| 4242 | pswpNew->y = swpClient.y;
|
---|
| 4243 | pswpNew->cx = sheight + 4;
|
---|
| 4244 | pswpNew->cy = sheight + 4;
|
---|
[133] | 4245 | sCount++;
|
---|
| 4246 | pswpNew = (PSWP) mp1 + (soldCount + 2 +
|
---|
[1077] | 4247 | (fToolbar != FALSE) +
|
---|
| 4248 | (fDrivebar != FALSE) +
|
---|
| 4249 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
---|
[133] | 4250 | *pswpNew = *pswpClient;
|
---|
[551] | 4251 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_USERLIST);
|
---|
| 4252 | pswpNew->x = swpClient.cx - (sheight + 2);
|
---|
| 4253 | pswpNew->y = swpClient.y;
|
---|
| 4254 | pswpNew->cx = sheight + 4;
|
---|
| 4255 | pswpNew->cy = sheight + 4;
|
---|
[133] | 4256 | sCount++;
|
---|
| 4257 | pswpNew = (PSWP) mp1 + (soldCount + 3 +
|
---|
[1077] | 4258 | (fToolbar != FALSE) +
|
---|
| 4259 | (fDrivebar != FALSE) +
|
---|
| 4260 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
---|
[133] | 4261 | *pswpNew = *pswpClient;
|
---|
[551] | 4262 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LED);
|
---|
| 4263 | pswpNew->x = swpClient.cx - ((sheight * 2) + 16);
|
---|
| 4264 | pswpNew->y = swpClient.y;
|
---|
| 4265 | pswpNew->cx = 12;
|
---|
| 4266 | pswpNew->cy = 12;
|
---|
[133] | 4267 | sCount++;
|
---|
| 4268 | pswpNew = (PSWP) mp1 + (soldCount + 4 +
|
---|
[1077] | 4269 | (fToolbar != FALSE) +
|
---|
| 4270 | (fDrivebar != FALSE) +
|
---|
| 4271 | (fSplitStatus != FALSE) + (fAutoView != FALSE));
|
---|
[133] | 4272 | *pswpNew = *pswpClient;
|
---|
[551] | 4273 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LEDHDR);
|
---|
| 4274 | pswpNew->x = swpClient.cx - ((sheight * 2) + 16);
|
---|
| 4275 | pswpNew->y = swpClient.y + 12;
|
---|
| 4276 | pswpNew->cx = 12;
|
---|
| 4277 | pswpNew->cy = sheight - 8;
|
---|
[133] | 4278 | sCount++;
|
---|
[551] | 4279 | if (fUserComboBox) {
|
---|
[1077] | 4280 | if (!aheight) {
|
---|
[2] | 4281 |
|
---|
[1077] | 4282 | SWP swpTemp;
|
---|
[2] | 4283 |
|
---|
[1077] | 4284 | WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
| 4285 | &swpTemp);
|
---|
| 4286 | aheight = swpTemp.cy;
|
---|
| 4287 | }
|
---|
| 4288 | pswpNew = (PSWP) mp1 + (soldCount + 5 +
|
---|
| 4289 | (fToolbar != FALSE) +
|
---|
| 4290 | (fSplitStatus != FALSE) +
|
---|
| 4291 | (fDrivebar != FALSE) + (fAutoView != FALSE));
|
---|
| 4292 | *pswpNew = *pswpClient;
|
---|
| 4293 | pswpNew->hwnd = hwndDrivelist;
|
---|
| 4294 | pswpNew->x = swpClient.x;
|
---|
| 4295 | pswpNew->cx = 48;
|
---|
| 4296 | pswpClient->cy -= (aheight + 6L);
|
---|
| 4297 | pswpNew->y = pswpClient->y;
|
---|
| 4298 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4299 | sCount++;
|
---|
| 4300 | pswpNew = (PSWP) mp1 + (soldCount + 6 +
|
---|
| 4301 | (fToolbar != FALSE) +
|
---|
| 4302 | (fDrivebar != FALSE) +
|
---|
| 4303 | (fSplitStatus != FALSE) +
|
---|
| 4304 | (fAutoView != FALSE));
|
---|
| 4305 | *pswpNew = *pswpClient;
|
---|
| 4306 | pswpNew->hwnd = hwndStatelist;
|
---|
| 4307 | pswpNew->x = swpClient.x + 48;
|
---|
| 4308 | pswpNew->cx = (swpClient.cx - 48) / 7;
|
---|
| 4309 | pswpNew->y = pswpClient->y;
|
---|
| 4310 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4311 | sCount++;
|
---|
| 4312 | pswpNew = (PSWP) mp1 + (soldCount + 7 +
|
---|
| 4313 | (fToolbar != FALSE) +
|
---|
| 4314 | (fDrivebar != FALSE) +
|
---|
| 4315 | (fSplitStatus != FALSE) +
|
---|
| 4316 | (fAutoView != FALSE));
|
---|
| 4317 | *pswpNew = *pswpClient;
|
---|
| 4318 | pswpNew->hwnd = hwndCmdlist;
|
---|
| 4319 | pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7);
|
---|
| 4320 | pswpNew->cx = (swpClient.cx - 48) / 5 +
|
---|
| 4321 | ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7);
|
---|
| 4322 | pswpNew->y = pswpClient->y;
|
---|
| 4323 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4324 | sCount++;
|
---|
| 4325 | pswpNew = (PSWP) mp1 + (soldCount + 8 +
|
---|
| 4326 | (fToolbar != FALSE) +
|
---|
| 4327 | (fDrivebar != FALSE) +
|
---|
| 4328 | (fSplitStatus != FALSE) +
|
---|
| 4329 | (fAutoView != FALSE));
|
---|
| 4330 | *pswpNew = *pswpClient;
|
---|
| 4331 | pswpNew->hwnd = hwndUserlist;
|
---|
| 4332 | pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2);
|
---|
| 4333 | pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) -
|
---|
| 4334 | ((fToolbar) ? ((swpClient.cx - 48) / 7) : 0);
|
---|
| 4335 | pswpNew->y = pswpClient->y;
|
---|
| 4336 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4337 | sCount++;
|
---|
| 4338 | if (fToolbar) {
|
---|
| 4339 | pswpNew = (PSWP) mp1 + (soldCount + 9 +
|
---|
| 4340 | (fToolbar != FALSE) +
|
---|
| 4341 | (fDrivebar != FALSE) +
|
---|
| 4342 | (fSplitStatus != FALSE) +
|
---|
| 4343 | (fAutoView != FALSE));
|
---|
| 4344 | *pswpNew = *pswpClient;
|
---|
| 4345 | pswpNew->hwnd = hwndButtonlist;
|
---|
| 4346 | pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4;
|
---|
| 4347 | pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x;
|
---|
| 4348 | pswpNew->y = pswpClient->y;
|
---|
| 4349 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4350 | sCount++;
|
---|
| 4351 | }
|
---|
| 4352 | else
|
---|
| 4353 | WinShowWindow(hwndButtonlist, FALSE);
|
---|
[133] | 4354 | }
|
---|
[551] | 4355 | else {
|
---|
[1077] | 4356 | WinShowWindow(hwndUserlist, FALSE);
|
---|
| 4357 | WinShowWindow(hwndDrivelist, FALSE);
|
---|
| 4358 | WinShowWindow(hwndStatelist, FALSE);
|
---|
| 4359 | WinShowWindow(hwndButtonlist, FALSE);
|
---|
| 4360 | WinShowWindow(hwndCmdlist, FALSE);
|
---|
[133] | 4361 | }
|
---|
| 4362 | {
|
---|
[1077] | 4363 | PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0;
|
---|
| 4364 | SHORT x;
|
---|
[2] | 4365 |
|
---|
[1077] | 4366 | pswpNew = (PSWP) mp1 + (soldCount + 5 +
|
---|
| 4367 | (fToolbar != FALSE) +
|
---|
| 4368 | (fDrivebar != FALSE) +
|
---|
| 4369 | (fSplitStatus != FALSE) +
|
---|
| 4370 | (fAutoView != FALSE) +
|
---|
| 4371 | ((fUserComboBox != FALSE) * 4) +
|
---|
| 4372 | (fUserComboBox != FALSE &&
|
---|
| 4373 | fToolbar != FALSE));
|
---|
| 4374 | pswp = (PSWP) mp1;
|
---|
| 4375 | for (x = 0; x < soldCount; x++) {
|
---|
| 4376 | if (!pswpTitlebar &&
|
---|
| 4377 | WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR)
|
---|
| 4378 | pswpTitlebar = pswp;
|
---|
| 4379 | else if (!pswpMinbutton &&
|
---|
| 4380 | WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX)
|
---|
| 4381 | pswpMinbutton = pswp;
|
---|
| 4382 | if (pswpTitlebar && pswpMinbutton)
|
---|
| 4383 | break;
|
---|
| 4384 | pswp++;
|
---|
| 4385 | }
|
---|
| 4386 | if (pswpMinbutton && pswpTitlebar) {
|
---|
| 4387 | *pswpNew = *pswpMinbutton;
|
---|
| 4388 | pswpNew->hwnd = WinWindowFromID(hwnd, IDM_IDEALSIZE);
|
---|
| 4389 | pswpNew->cy = pswpMinbutton->cy + 3;
|
---|
| 4390 | pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3);
|
---|
| 4391 | pswpTitlebar->cx -= (pswpNew->cx - 1);
|
---|
| 4392 | pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx);
|
---|
| 4393 | pswpNew->y = pswpMinbutton->y - 1;
|
---|
| 4394 | sCount++;
|
---|
| 4395 | }
|
---|
| 4396 | else
|
---|
| 4397 | WinShowWindow(WinWindowFromID(hwnd, IDM_IDEALSIZE), FALSE);
|
---|
[133] | 4398 | }
|
---|
[2] | 4399 |
|
---|
[551] | 4400 | if (fMoreButtons) {
|
---|
[2] | 4401 |
|
---|
[1077] | 4402 | LONG lastx;
|
---|
[2] | 4403 |
|
---|
[1077] | 4404 | pswpNew = (PSWP) mp1 + (soldCount + 6 +
|
---|
| 4405 | (fToolbar != FALSE) +
|
---|
| 4406 | (fDrivebar != FALSE) +
|
---|
| 4407 | (fSplitStatus != FALSE) +
|
---|
| 4408 | (fAutoView != FALSE) +
|
---|
| 4409 | ((fUserComboBox != FALSE) * 4) +
|
---|
| 4410 | (fUserComboBox != FALSE &&
|
---|
| 4411 | fToolbar != FALSE));
|
---|
| 4412 | *pswpNew = *pswpClient;
|
---|
| 4413 | pswpNew->hwnd = hwndName;
|
---|
| 4414 | pswpNew->x = swpClient.x + 3;
|
---|
| 4415 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
| 4416 | pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3;
|
---|
| 4417 | lastx = pswpNew->x + pswpNew->cx;
|
---|
| 4418 | pswpNew->cy = bheight;
|
---|
| 4419 | pswpClient->y += (bheight + 4);
|
---|
| 4420 | pswpClient->cy -= (bheight + 4);
|
---|
| 4421 | sCount++;
|
---|
| 4422 | pswpNew = (PSWP) mp1 + (soldCount + 7 +
|
---|
| 4423 | (fToolbar != FALSE) +
|
---|
| 4424 | (fDrivebar != FALSE) +
|
---|
| 4425 | (fSplitStatus != FALSE) +
|
---|
| 4426 | (fAutoView != FALSE) +
|
---|
| 4427 | ((fUserComboBox != FALSE) * 4) +
|
---|
| 4428 | (fUserComboBox != FALSE &&
|
---|
| 4429 | fToolbar != FALSE));
|
---|
| 4430 | *pswpNew = *pswpClient;
|
---|
| 4431 | pswpNew->hwnd = hwndDate;
|
---|
| 4432 | pswpNew->x = lastx + 3;
|
---|
| 4433 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
| 4434 | pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3;
|
---|
| 4435 | lastx = pswpNew->x + pswpNew->cx;
|
---|
| 4436 | pswpNew->cy = bheight;
|
---|
| 4437 | sCount++;
|
---|
| 4438 | pswpNew = (PSWP) mp1 + (soldCount + 8 +
|
---|
| 4439 | (fToolbar != FALSE) +
|
---|
| 4440 | (fDrivebar != FALSE) +
|
---|
| 4441 | (fSplitStatus != FALSE) +
|
---|
| 4442 | (fAutoView != FALSE) +
|
---|
| 4443 | ((fUserComboBox != FALSE) * 4) +
|
---|
| 4444 | (fUserComboBox != FALSE &&
|
---|
| 4445 | fToolbar != FALSE));
|
---|
| 4446 | *pswpNew = *pswpClient;
|
---|
| 4447 | pswpNew->hwnd = hwndAttr;
|
---|
| 4448 | pswpNew->x = lastx + 3;
|
---|
| 4449 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
| 4450 | pswpNew->cx = (swpClient.cx - pswpNew->x) - 1;
|
---|
| 4451 | pswpNew->cy = bheight;
|
---|
| 4452 | sCount++;
|
---|
[133] | 4453 | }
|
---|
[551] | 4454 | else {
|
---|
[1077] | 4455 | WinShowWindow(hwndAttr, FALSE);
|
---|
| 4456 | WinShowWindow(hwndName, FALSE);
|
---|
| 4457 | WinShowWindow(hwndDate, FALSE);
|
---|
[133] | 4458 | }
|
---|
| 4459 | return MRFROMSHORT(sCount);
|
---|
| 4460 | }
|
---|
[2] | 4461 |
|
---|
[133] | 4462 | case WM_QUERYFRAMECTLCOUNT:
|
---|
| 4463 | {
|
---|
| 4464 | SHORT sCount;
|
---|
[2] | 4465 |
|
---|
[133] | 4466 | sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
|
---|
[2] | 4467 |
|
---|
[133] | 4468 | sCount += 6;
|
---|
| 4469 | if (fSplitStatus)
|
---|
[1077] | 4470 | sCount++;
|
---|
[133] | 4471 | if (fToolbar)
|
---|
[1077] | 4472 | sCount++;
|
---|
[551] | 4473 | if (fUserComboBox) {
|
---|
[1077] | 4474 | sCount += 4;
|
---|
| 4475 | if (fToolbar)
|
---|
| 4476 | sCount++;
|
---|
[133] | 4477 | }
|
---|
| 4478 | if (fDrivebar)
|
---|
[1077] | 4479 | sCount++;
|
---|
[133] | 4480 | if (fAutoView)
|
---|
[1077] | 4481 | sCount++;
|
---|
[133] | 4482 | if (fMoreButtons)
|
---|
[1077] | 4483 | sCount += 3;
|
---|
[133] | 4484 | return MRFROMSHORT(sCount);
|
---|
| 4485 | }
|
---|
[2] | 4486 |
|
---|
[133] | 4487 | case WM_CLOSE:
|
---|
| 4488 | WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
|
---|
| 4489 | return 0;
|
---|
| 4490 | }
|
---|
| 4491 | return oldproc(hwnd, msg, mp1, mp2);
|
---|
[2] | 4492 | }
|
---|
| 4493 |
|
---|
[133] | 4494 | MRESULT EXPENTRY MainWMCommand(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
[130] | 4495 | {
|
---|
[2] | 4496 | SetShiftState();
|
---|
[551] | 4497 | switch (SHORT1FROMMP(mp1)) {
|
---|
[824] | 4498 |
|
---|
| 4499 | case IDM_CONTEXTMENU:
|
---|
| 4500 | {
|
---|
| 4501 | HWND hwnd = WinQueryFocus(HWND_DESKTOP);
|
---|
| 4502 | // DbgMsg(pszSrcFile, __LINE__, "IDM_CONTEXTMENU %x", hwnd);
|
---|
| 4503 | if (hwnd != NULLHANDLE) {
|
---|
[1077] | 4504 | HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT);
|
---|
| 4505 | USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID);
|
---|
| 4506 | switch (id) {
|
---|
| 4507 | case MAIN_SETUPLIST:
|
---|
| 4508 | case MAIN_USERLIST:
|
---|
| 4509 | case MAIN_CMDLIST:
|
---|
| 4510 | // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU");
|
---|
| 4511 | WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0);
|
---|
| 4512 | }
|
---|
[824] | 4513 | }
|
---|
| 4514 | }
|
---|
| 4515 | break;
|
---|
| 4516 |
|
---|
[133] | 4517 | case IDM_SETTARGET:
|
---|
| 4518 | SetTargetDir(hwnd, FALSE);
|
---|
| 4519 | break;
|
---|
[2] | 4520 |
|
---|
[133] | 4521 | case IDM_TOAUTOMLE:
|
---|
| 4522 | if (fComments && fAutoView)
|
---|
[551] | 4523 | WinSetFocus(HWND_DESKTOP, hwndAutoMLE);
|
---|
[133] | 4524 | break;
|
---|
[2] | 4525 |
|
---|
[133] | 4526 | case IDM_HIDENOTEWND:
|
---|
| 4527 | HideNote();
|
---|
| 4528 | break;
|
---|
| 4529 | case IDM_SHOWNOTEWND:
|
---|
| 4530 | ShowNote();
|
---|
| 4531 | break;
|
---|
[2] | 4532 |
|
---|
[133] | 4533 | case IDM_COMPARE:
|
---|
| 4534 | {
|
---|
| 4535 | WALK2 wa;
|
---|
| 4536 | PCNRITEM pci;
|
---|
| 4537 |
|
---|
| 4538 | memset(&wa, 0, sizeof(wa));
|
---|
| 4539 | wa.size = sizeof(wa);
|
---|
[551] | 4540 | pci =
|
---|
[1077] | 4541 | (PCNRITEM)
|
---|
| 4542 | WinSendMsg(WinWindowFromID
|
---|
| 4543 | (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
|
---|
| 4544 | CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
|
---|
| 4545 | MPFROMSHORT(CRA_CURSORED));
|
---|
[551] | 4546 | if (pci && (INT) pci != -1) {
|
---|
[1077] | 4547 | strcpy(wa.szCurrentPath1, pci->pszFileName);
|
---|
| 4548 | MakeValidDir(wa.szCurrentPath1);
|
---|
[133] | 4549 | }
|
---|
| 4550 | else
|
---|
[1104] | 4551 | strcpy(wa.szCurrentPath1, pFM2SaveDirectory);
|
---|
[551] | 4552 | TopWindowName(hwndMain, (HWND) 0, wa.szCurrentPath2);
|
---|
[133] | 4553 | if (!*wa.szCurrentPath2)
|
---|
[1077] | 4554 | strcpy(wa.szCurrentPath2, wa.szCurrentPath1);
|
---|
[133] | 4555 | MakeValidDir(wa.szCurrentPath2);
|
---|
| 4556 | if (WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 4557 | hwnd,
|
---|
| 4558 | WalkTwoCmpDlgProc,
|
---|
| 4559 | FM3ModHandle,
|
---|
| 4560 | WALK2_FRAME,
|
---|
| 4561 | MPFROMP(&wa)) &&
|
---|
| 4562 | !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) {
|
---|
| 4563 | if (!*dircompare) {
|
---|
[2] | 4564 |
|
---|
[1077] | 4565 | COMPARE *cmp;
|
---|
[2] | 4566 |
|
---|
[1077] | 4567 | cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
|
---|
| 4568 | if (cmp) {
|
---|
| 4569 | cmp->size = sizeof(COMPARE);
|
---|
| 4570 | strcpy(cmp->leftdir, wa.szCurrentPath1);
|
---|
| 4571 | strcpy(cmp->rightdir, wa.szCurrentPath2);
|
---|
| 4572 | cmp->hwndParent = hwnd;
|
---|
| 4573 | cmp->dcd.hwndParent = hwnd;
|
---|
| 4574 | WinDlgBox(HWND_DESKTOP,
|
---|
| 4575 | HWND_DESKTOP,
|
---|
| 4576 | CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
|
---|
| 4577 | }
|
---|
| 4578 | }
|
---|
| 4579 | else {
|
---|
[2] | 4580 |
|
---|
[1077] | 4581 | CHAR szPath1[CCHMAXPATH];
|
---|
| 4582 | CHAR szPath2[CCHMAXPATH];
|
---|
| 4583 | runemf2(SEPARATE,
|
---|
| 4584 | HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 4585 | NULL, NULL,
|
---|
| 4586 | "%s %s %s",
|
---|
| 4587 | dircompare,
|
---|
| 4588 | BldQuotedFileName(szPath1, wa.szCurrentPath1),
|
---|
| 4589 | BldQuotedFileName(szPath2, wa.szCurrentPath2));
|
---|
| 4590 | }
|
---|
[2] | 4591 | }
|
---|
[133] | 4592 | }
|
---|
| 4593 | break;
|
---|
[2] | 4594 |
|
---|
[133] | 4595 | case IDM_EXIT:
|
---|
| 4596 | case IDM_KILLME:
|
---|
[551] | 4597 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
[133] | 4598 | break;
|
---|
[2] | 4599 |
|
---|
[133] | 4600 | case IDM_CLI:
|
---|
| 4601 | if (fSplitStatus &&
|
---|
[1077] | 4602 | hwndStatus2 &&
|
---|
| 4603 | !WinIsWindow(WinQueryAnchorBlock(hwnd),
|
---|
| 4604 | WinWindowFromID(hwndStatus2, COMMAND_LINE)))
|
---|
[551] | 4605 | PostMsg(hwndStatus2, UM_CLICKED, MPVOID, MPVOID);
|
---|
[133] | 4606 | break;
|
---|
[2] | 4607 |
|
---|
[133] | 4608 | case IDM_ADDTOUSERLIST:
|
---|
| 4609 | case IDM_DELETEFROMUSERLIST:
|
---|
| 4610 | {
|
---|
| 4611 | CHAR temp[CCHMAXPATH], path[CCHMAXPATH];
|
---|
| 4612 |
|
---|
| 4613 | *temp = 0;
|
---|
[551] | 4614 | WinQueryWindowText(hwndUserlist, CCHMAXPATH, temp);
|
---|
[133] | 4615 | bstrip(temp);
|
---|
| 4616 | if (*temp &&
|
---|
[1077] | 4617 | !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) {
|
---|
| 4618 | if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) {
|
---|
| 4619 | add_udir(TRUE, path);
|
---|
| 4620 | if (fUdirsChanged)
|
---|
| 4621 | save_udirs();
|
---|
| 4622 | WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
---|
| 4623 | }
|
---|
| 4624 | else {
|
---|
| 4625 | if (!remove_udir(path))
|
---|
| 4626 | Runtime_Error(pszSrcFile, __LINE__, "remove_udir");
|
---|
| 4627 | else {
|
---|
| 4628 | if (fUdirsChanged)
|
---|
| 4629 | save_udirs();
|
---|
| 4630 | WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
---|
| 4631 | }
|
---|
| 4632 | }
|
---|
[2] | 4633 | }
|
---|
[133] | 4634 | }
|
---|
| 4635 | break;
|
---|
[2] | 4636 |
|
---|
[133] | 4637 | case IDM_SAVEDIRCNRSTATE:
|
---|
| 4638 | case IDM_DELETEDIRCNRSTATE:
|
---|
| 4639 | {
|
---|
[787] | 4640 | CHAR szStateName[STATE_NAME_MAX_BYTES + 1];
|
---|
[133] | 4641 |
|
---|
[558] | 4642 | *szStateName = 0;
|
---|
[787] | 4643 | WinQueryWindowText(hwndStatelist, STATE_NAME_MAX_BYTES, szStateName);
|
---|
[558] | 4644 | bstrip(szStateName);
|
---|
[961] | 4645 | // Complain if attempting to use reserved name
|
---|
| 4646 | if (stricmp(szStateName, GetPString(IDS_STATETEXT)) == 0 ||
|
---|
[1077] | 4647 | stricmp(szStateName, GetPString(IDS_FM2TEMPTEXT)) == 0)
|
---|
[961] | 4648 | {
|
---|
[1077] | 4649 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
---|
| 4650 | GetPString(IDS_WARNINGTEXT),
|
---|
| 4651 | "\"%s\" is a reserved state name", szStateName);
|
---|
[961] | 4652 | }
|
---|
| 4653 | // Ignore request if blank
|
---|
[1027] | 4654 | else if (*szStateName) {
|
---|
[1077] | 4655 | BOOL fAbortOperation = FALSE;
|
---|
| 4656 | if (!fNoSaveState && fSaveState && stricmp(szStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0)
|
---|
| 4657 | {
|
---|
| 4658 | if (saymsg(MB_YESNO | MB_DEFBUTTON2 | MB_ICONASTERISK, hwnd,
|
---|
| 4659 | GetPString(IDS_WARNINGTEXT),
|
---|
| 4660 | GetPString(IDS_SHUTDOWNSTATE_WARNING), szStateName) == MBID_NO)
|
---|
| 4661 | fAbortOperation = TRUE;
|
---|
| 4662 | }
|
---|
| 4663 | if (!fAbortOperation) {
|
---|
| 4664 | if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) {
|
---|
| 4665 | // Save
|
---|
| 4666 | INT nSaved = SaveDirCnrState(hwnd, szStateName);
|
---|
| 4667 | if (nSaved >= 0) {
|
---|
| 4668 | INT ret = add_setup(szStateName);
|
---|
| 4669 | if (ret == 0) {
|
---|
| 4670 | WinSendMsg(hwndStatelist, LM_INSERTITEM,
|
---|
| 4671 | MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName));
|
---|
| 4672 | save_setups();
|
---|
| 4673 | }
|
---|
| 4674 | else if (ret != 1) {
|
---|
| 4675 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
---|
| 4676 | GetPString(IDS_WARNINGTEXT),
|
---|
| 4677 | "\"%s\" state name add failed", szStateName); // 15 Apr 07 SHL failed
|
---|
| 4678 | WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
|
---|
| 4679 | }
|
---|
| 4680 | }
|
---|
| 4681 | else {
|
---|
| 4682 | saymsg(MB_ENTER | MB_ICONASTERISK,
|
---|
| 4683 | hwnd,
|
---|
| 4684 | GetPString(IDS_WARNINGTEXT),
|
---|
| 4685 | "State data save failed");
|
---|
| 4686 | WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
|
---|
| 4687 | }
|
---|
| 4688 | }
|
---|
| 4689 | else {
|
---|
| 4690 | // Delete
|
---|
| 4691 | ULONG numsaves = 0, size, x;
|
---|
| 4692 | CHAR s[STATE_NAME_MAX_BYTES + 80];
|
---|
[2] | 4693 |
|
---|
[1077] | 4694 | INT ret = remove_setup(szStateName);
|
---|
| 4695 | if (ret == 1)
|
---|
| 4696 | save_setups();
|
---|
| 4697 | sprintf(s, "%s.NumDirsLastTime", szStateName);
|
---|
| 4698 | size = sizeof(ULONG);
|
---|
| 4699 | if (!PrfQueryProfileData(fmprof,
|
---|
| 4700 | FM3Str,
|
---|
| 4701 | s,
|
---|
| 4702 | (PVOID)&numsaves,
|
---|
| 4703 | &size)) {
|
---|
| 4704 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
---|
| 4705 | GetPString(IDS_WARNINGTEXT),
|
---|
| 4706 | GetPString(IDS_DOESNTEXISTTEXT), szStateName);
|
---|
| 4707 | }
|
---|
| 4708 | else if (!size)
|
---|
| 4709 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
| 4710 | else {
|
---|
| 4711 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L);
|
---|
| 4712 | for (x = 0; x < numsaves; x++) {
|
---|
| 4713 | sprintf(s, "%s.DirCnrPos.%lu", szStateName, x);
|
---|
| 4714 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4715 | sprintf(s, "%s.DirCnrDir.%lu", szStateName, x);
|
---|
| 4716 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4717 | sprintf(s, "%s.DirCnrSort.%lu", szStateName, x);
|
---|
| 4718 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4719 | sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x);
|
---|
| 4720 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4721 | sprintf(s, "%s.DirCnrView.%lu", szStateName, x);
|
---|
| 4722 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4723 | sprintf(s, "%s.DirCnr.%lu.DetailsLongname", szStateName, x);
|
---|
| 4724 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4725 | sprintf(s, "%s.DirCnr.%lu.DetailsSubject", szStateName, x);
|
---|
| 4726 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4727 | sprintf(s, "%s.DirCnr.%lu.DetailsSize", szStateName, x);
|
---|
| 4728 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4729 | sprintf(s, "%s.DirCnr.%lu.DetailsEA", szStateName, x);
|
---|
| 4730 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4731 | sprintf(s, "%s.DirCnr.%lu.DetailsAttr", szStateName, x);
|
---|
| 4732 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4733 | sprintf(s, "%s.DirCnr.%lu.DetailsIcon", szStateName, x);
|
---|
| 4734 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4735 | sprintf(s, "%s.DirCnr.%lu.DetailsLWDate", szStateName, x);
|
---|
| 4736 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4737 | sprintf(s, "%s.DirCnr.%lu.DetailsLWTime", szStateName, x);
|
---|
| 4738 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4739 | sprintf(s, "%s.DirCnr.%lu.DetailsLADate", szStateName, x);
|
---|
| 4740 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4741 | sprintf(s, "%s.DirCnr.%lu.DetailsLATime", szStateName, x);
|
---|
| 4742 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4743 | sprintf(s, "%s.DirCnr.%lu.DetailsCRDate", szStateName, x);
|
---|
| 4744 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4745 | sprintf(s, "%s.DirCnr.%lu.DetailsCRTime", szStateName, x);
|
---|
| 4746 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4747 | sprintf(s, "%s.DirCnr.%lu.Backgroundcolor", szStateName, x);
|
---|
| 4748 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4749 | sprintf(s, "%s.DirCnr.%lu.Fontnamesize", szStateName, x);
|
---|
| 4750 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4751 | }
|
---|
| 4752 | sprintf(s, "%s.LastTreePos", szStateName);
|
---|
| 4753 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4754 | sprintf(s, "%s.MySizeLastTime", szStateName);
|
---|
| 4755 | PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
|
---|
| 4756 | }
|
---|
| 4757 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
---|
| 4758 | }
|
---|
| 4759 | }
|
---|
[2] | 4760 | }
|
---|
[133] | 4761 | }
|
---|
| 4762 | break;
|
---|
[2] | 4763 |
|
---|
[133] | 4764 | case IDM_IDEALSIZE:
|
---|
| 4765 | {
|
---|
| 4766 | SWP swp, swpD;
|
---|
| 4767 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L;
|
---|
| 4768 | ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
|
---|
| 4769 |
|
---|
| 4770 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
---|
[551] | 4771 | if (swp.fl & SWP_MAXIMIZE) {
|
---|
[1077] | 4772 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_SYSCOMMAND,
|
---|
| 4773 | MPFROM2SHORT(SC_RESTORE, 0), MPVOID);
|
---|
| 4774 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
---|
[2] | 4775 | }
|
---|
[133] | 4776 | WinGetMaxPosition(WinQueryWindow(hwnd, QW_PARENT), &swpD);
|
---|
| 4777 | swpD.x += bsz;
|
---|
| 4778 | swpD.cx -= (bsz * 2);
|
---|
| 4779 | swpD.y += icz;
|
---|
| 4780 | swpD.cy -= (icz + bsz);
|
---|
| 4781 | if (swp.x == swpD.x && swp.y == swpD.y &&
|
---|
[1077] | 4782 | swp.cx == swpD.cx && swp.cy == swpD.cy &&
|
---|
| 4783 | // fixme to be #defined someday
|
---|
| 4784 | WinQueryWindowUShort(hwnd, QWL_USER + 10) &&
|
---|
| 4785 | WinQueryWindowUShort(hwnd, QWL_USER + 14)) {
|
---|
| 4786 | swpD.x = WinQueryWindowUShort(hwnd, QWL_USER + 8);
|
---|
| 4787 | swpD.cx = WinQueryWindowUShort(hwnd, QWL_USER + 10);
|
---|
| 4788 | swpD.y = WinQueryWindowUShort(hwnd, QWL_USER + 12);
|
---|
| 4789 | swpD.cy = WinQueryWindowUShort(hwnd, QWL_USER + 14);
|
---|
[133] | 4790 | }
|
---|
[551] | 4791 | else {
|
---|
[1077] | 4792 | WinSetWindowUShort(hwnd, QWL_USER + 8, (USHORT) swp.x);
|
---|
| 4793 | WinSetWindowUShort(hwnd, QWL_USER + 10, (USHORT) swp.cx);
|
---|
| 4794 | WinSetWindowUShort(hwnd, QWL_USER + 12, (USHORT) swp.y);
|
---|
| 4795 | WinSetWindowUShort(hwnd, QWL_USER + 14, (USHORT) swp.cy);
|
---|
[133] | 4796 | }
|
---|
| 4797 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP,
|
---|
[1077] | 4798 | swpD.x, swpD.y, swpD.cx, swpD.cy, SWP_MOVE | SWP_SIZE);
|
---|
[133] | 4799 | }
|
---|
| 4800 | break;
|
---|
[2] | 4801 |
|
---|
[133] | 4802 | case IDM_BLINK:
|
---|
| 4803 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
|
---|
[1077] | 4804 | SWP_MINIMIZE);
|
---|
[133] | 4805 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
|
---|
[1077] | 4806 | SWP_RESTORE | SWP_ZORDER);
|
---|
[133] | 4807 | break;
|
---|
[2] | 4808 |
|
---|
[133] | 4809 | case DID_CANCEL:
|
---|
| 4810 | {
|
---|
[551] | 4811 | HWND hwndTop = TopWindow(hwndMain, (HWND) 0);
|
---|
[2] | 4812 |
|
---|
[133] | 4813 | if (hwndTop)
|
---|
[1077] | 4814 | WinSetFocus(HWND_DESKTOP, hwndTop);
|
---|
[133] | 4815 | }
|
---|
| 4816 | break;
|
---|
[2] | 4817 |
|
---|
[133] | 4818 | case IDM_NOTEBOOK:
|
---|
[917] | 4819 | case IDM_DIRCNRSETTINGS:
|
---|
[953] | 4820 | case IDM_DIRVIEWSETTINGS:
|
---|
| 4821 | case IDM_DIRSORTSETTINGS:
|
---|
| 4822 | case IDM_COLLECTORVIEWSETTINGS:
|
---|
| 4823 | case IDM_COLLECTORSORTSETTINGS:
|
---|
[917] | 4824 | case IDM_ARCHIVERSETTINGS:
|
---|
[953] | 4825 | case IDM_TREECNRVIEWSETTINGS:
|
---|
| 4826 | case IDM_TREECNRSORTSETTINGS:
|
---|
[917] | 4827 | case IDM_VIEWERSETTINGS:
|
---|
[953] | 4828 | case IDM_VIEWERSETTINGS2:
|
---|
[917] | 4829 | case IDM_COMPARESETTINGS:
|
---|
[953] | 4830 | case IDM_MONOLITHICSETTINGS:
|
---|
| 4831 | case IDM_GENERALSETTINGS:
|
---|
| 4832 | case IDM_SCANSETTINGS:
|
---|
| 4833 | case IDM_BUBBLESSETTINGS:
|
---|
[917] | 4834 | case IDM_QUICKSETTINGS:
|
---|
[133] | 4835 | WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 4836 | hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMLONG(mp1));
|
---|
[133] | 4837 | break;
|
---|
[2] | 4838 |
|
---|
[133] | 4839 | case IDM_VIEWHELPS:
|
---|
| 4840 | case IDM_VIEWINFS:
|
---|
| 4841 | WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 4842 | HWND_DESKTOP,
|
---|
| 4843 | ViewInfProc,
|
---|
| 4844 | FM3ModHandle,
|
---|
| 4845 | VINF_FRAME,
|
---|
| 4846 | ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ?
|
---|
| 4847 | MPFROMP(NullStr) : MPVOID));
|
---|
[133] | 4848 | break;
|
---|
[2] | 4849 |
|
---|
[133] | 4850 | case IDM_OPENWALK:
|
---|
| 4851 | {
|
---|
| 4852 | char newpath[CCHMAXPATH];
|
---|
[2] | 4853 |
|
---|
[133] | 4854 | *newpath = 0;
|
---|
[551] | 4855 | TopWindowName(hwnd, (HWND) 0, newpath);
|
---|
[133] | 4856 | if (WinDlgBox(HWND_DESKTOP,
|
---|
[1077] | 4857 | hwnd,
|
---|
| 4858 | WalkAllDlgProc,
|
---|
| 4859 | FM3ModHandle, WALK_FRAME, MPFROMP(newpath)) && *newpath)
|
---|
| 4860 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, newpath);
|
---|
[133] | 4861 | }
|
---|
| 4862 | break;
|
---|
[2] | 4863 |
|
---|
[133] | 4864 | case IDM_WINDOWDLG:
|
---|
| 4865 | WindowList(hwnd);
|
---|
| 4866 | break;
|
---|
[2] | 4867 |
|
---|
[133] | 4868 | case IDM_HELPMOUSE:
|
---|
| 4869 | case IDM_HELPCONTEXT:
|
---|
| 4870 | case IDM_HELPHINTS:
|
---|
| 4871 | case IDM_HELPPIX:
|
---|
| 4872 | case IDM_HELPTUTOR:
|
---|
| 4873 | case IDM_HELPUSERLIST:
|
---|
| 4874 | case IDM_HELP:
|
---|
| 4875 | case IDM_HELPCONTENTS:
|
---|
| 4876 | case IDM_HELPKEYS:
|
---|
| 4877 | case IDM_HELPGENERAL:
|
---|
[551] | 4878 | if (hwndHelp) {
|
---|
| 4879 | if (SHORT1FROMMP(mp2) == CMDSRC_MENU) {
|
---|
[2] | 4880 |
|
---|
[1077] | 4881 | RECTL rcl;
|
---|
| 4882 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L;
|
---|
[2] | 4883 |
|
---|
[1077] | 4884 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
---|
| 4885 | rcl.yBottom += icz;
|
---|
| 4886 | rcl.yTop -= icz;
|
---|
| 4887 | rcl.xLeft += icz;
|
---|
| 4888 | rcl.xRight -= icz;
|
---|
| 4889 | WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);
|
---|
[133] | 4890 | }
|
---|
[551] | 4891 | else {
|
---|
[2] | 4892 |
|
---|
[1077] | 4893 | RECTL rcl;
|
---|
[2] | 4894 |
|
---|
[1077] | 4895 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
---|
| 4896 | rcl.yBottom += 8;
|
---|
| 4897 | rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7);
|
---|
| 4898 | rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7);
|
---|
| 4899 | rcl.xRight -= 8;
|
---|
| 4900 | WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);
|
---|
[133] | 4901 | }
|
---|
[551] | 4902 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 4903 | case IDM_HELPCONTEXT:
|
---|
[1077] | 4904 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 4905 | MPFROM2SHORT(HELP_CONTEXT, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4906 | break;
|
---|
[2] | 4907 |
|
---|
[133] | 4908 | case IDM_HELPMOUSE:
|
---|
[1077] | 4909 | if (hwndHelp)
|
---|
| 4910 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 4911 | MPFROM2SHORT(HELP_MOUSE, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4912 | break;
|
---|
[2] | 4913 |
|
---|
[133] | 4914 | case IDM_HELPPIX:
|
---|
[1077] | 4915 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 4916 | MPFROM2SHORT(HELP_BITMAP1, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4917 | break;
|
---|
[2] | 4918 |
|
---|
[133] | 4919 | case IDM_HELPTUTOR:
|
---|
[1077] | 4920 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 4921 | MPFROM2SHORT(HELP_TUTORIAL, 0),
|
---|
| 4922 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4923 | break;
|
---|
[2] | 4924 |
|
---|
[133] | 4925 | case IDM_HELPHINTS:
|
---|
[1077] | 4926 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 4927 | MPFROM2SHORT(HELP_HINTS, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4928 | break;
|
---|
[2] | 4929 |
|
---|
[133] | 4930 | case IDM_HELPGENERAL:
|
---|
[1077] | 4931 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 4932 | MPFROM2SHORT(HELP_MAIN, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4933 | break;
|
---|
[133] | 4934 | case IDM_HELPKEYS:
|
---|
[1077] | 4935 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 4936 | MPFROM2SHORT(HELP_KEYS, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4937 | break;
|
---|
[2] | 4938 |
|
---|
[133] | 4939 | case IDM_HELP:
|
---|
| 4940 | case IDM_HELPCONTENTS:
|
---|
[1077] | 4941 | WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
|
---|
| 4942 | break;
|
---|
[2] | 4943 |
|
---|
[133] | 4944 | case IDM_HELPUSERLIST:
|
---|
[1077] | 4945 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 4946 | MPFROM2SHORT(HELP_USERLISTS, 0),
|
---|
| 4947 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4948 | break;
|
---|
[2] | 4949 | }
|
---|
[133] | 4950 | }
|
---|
| 4951 | break;
|
---|
[2] | 4952 |
|
---|
[133] | 4953 | case IDM_EDITANYARCHIVER:
|
---|
[419] | 4954 | EditArchiverDefinition(hwnd);
|
---|
[133] | 4955 | break;
|
---|
[2] | 4956 |
|
---|
[133] | 4957 | case IDM_ABOUT:
|
---|
| 4958 | WinDlgBox(HWND_DESKTOP, hwnd, AboutDlgProc, FM3ModHandle,
|
---|
[1077] | 4959 | ABT_FRAME, MPVOID);
|
---|
[133] | 4960 | break;
|
---|
[2] | 4961 |
|
---|
[133] | 4962 | case IDM_FONTPALETTE:
|
---|
| 4963 | OpenObject("<WP_FNTPAL>", Default, hwnd);
|
---|
| 4964 | break;
|
---|
[2] | 4965 |
|
---|
[133] | 4966 | case IDM_HICOLORPALETTE:
|
---|
| 4967 | case IDM_COLORPALETTE:
|
---|
| 4968 | {
|
---|
| 4969 | CHAR *palette = "<WP_CLRPAL>";
|
---|
| 4970 | ULONG version[2];
|
---|
| 4971 |
|
---|
| 4972 | if (!DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR,
|
---|
[1077] | 4973 | (PVOID) & version, (ULONG) sizeof(version))) {
|
---|
| 4974 | if (version[0] > 20L || (version[0] == 20L && version[1] > 29L)) {
|
---|
| 4975 | if (SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE)
|
---|
| 4976 | palette = "<WP_HIRESCLRPAL>";
|
---|
| 4977 | else
|
---|
| 4978 | palette = "<WP_LORESCLRPAL>";
|
---|
| 4979 | }
|
---|
[2] | 4980 | }
|
---|
[133] | 4981 | OpenObject(palette, Default, hwnd);
|
---|
| 4982 | }
|
---|
| 4983 | break;
|
---|
[2] | 4984 |
|
---|
[133] | 4985 | case IDM_SYSTEMSETUP:
|
---|
| 4986 | OpenObject("<WP_CONFIG>", Default, hwnd);
|
---|
| 4987 | break;
|
---|
[2] | 4988 |
|
---|
[133] | 4989 | case IDM_SCHEMEPALETTE:
|
---|
| 4990 | {
|
---|
| 4991 | HOBJECT hWPSObject;
|
---|
[2] | 4992 |
|
---|
[133] | 4993 | hWPSObject = WinQueryObject("<WP_SCHPAL>");
|
---|
| 4994 | if (hWPSObject != NULLHANDLE)
|
---|
[1077] | 4995 | WinSetObjectData(hWPSObject, "SCHEMES=Winter:PM_Winter,"
|
---|
| 4996 | "Spring:PM_Spring,Summer:PM_Summer,"
|
---|
| 4997 | "System:PM_System,Windows:PM_Windows;"
|
---|
| 4998 | "OPEN=DEFAULT");
|
---|
[133] | 4999 | }
|
---|
| 5000 | break;
|
---|
[2] | 5001 |
|
---|
[133] | 5002 | case IDM_SYSTEMCLOCK:
|
---|
| 5003 | OpenObject("<WP_CLOCK>", Default, hwnd);
|
---|
| 5004 | break;
|
---|
[2] | 5005 |
|
---|
| 5006 | #ifdef NEVER
|
---|
[133] | 5007 | case IDM_SYSINFO:
|
---|
| 5008 | WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, SysInfoDlgProc, FM3ModHandle,
|
---|
[1077] | 5009 | SYS_FRAME, NULL);
|
---|
[133] | 5010 | break;
|
---|
[2] | 5011 | #endif
|
---|
| 5012 |
|
---|
[133] | 5013 | case IDM_INSTANT:
|
---|
| 5014 | {
|
---|
| 5015 | CHAR path[CCHMAXPATH];
|
---|
| 5016 | PCNRITEM pci = (PCNRITEM) 0;
|
---|
| 5017 |
|
---|
| 5018 | if (hwndTree)
|
---|
[1077] | 5019 | pci = (PCNRITEM) WinSendMsg(hwndTree, CM_QUERYRECORDEMPHASIS,
|
---|
| 5020 | MPFROMLONG(CMA_FIRST),
|
---|
| 5021 | MPFROMSHORT(CRA_CURSORED));
|
---|
[551] | 5022 | if (pci && (INT) pci != -1) {
|
---|
[1077] | 5023 | strcpy(path, pci->pszFileName);
|
---|
| 5024 | MakeValidDir(path);
|
---|
[2] | 5025 | }
|
---|
[133] | 5026 | else
|
---|
[1104] | 5027 | strcpy(path, pFM2SaveDirectory);
|
---|
[133] | 5028 | WinDlgBox(HWND_DESKTOP, hwnd, InstantDlgProc, FM3ModHandle,
|
---|
[1077] | 5029 | BAT_FRAME, MPFROMP(path));
|
---|
[133] | 5030 | }
|
---|
| 5031 | break;
|
---|
[2] | 5032 |
|
---|
[133] | 5033 | case IDM_WINFULLSCREEN:
|
---|
| 5034 | case IDM_DOSCOMMANDLINE:
|
---|
| 5035 | case IDM_COMMANDLINE:
|
---|
| 5036 | {
|
---|
| 5037 | CHAR *env = GetCmdSpec(FALSE), path[CCHMAXPATH];
|
---|
| 5038 | INT type = SEPARATE | WINDOWED;
|
---|
| 5039 |
|
---|
| 5040 | *path = 0;
|
---|
[551] | 5041 | TopWindowName(hwnd, (HWND) 0, path);
|
---|
[133] | 5042 | if (SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE)
|
---|
[1077] | 5043 | env = GetCmdSpec(TRUE);
|
---|
[551] | 5044 | else if (SHORT1FROMMP(mp1) != IDM_COMMANDLINE) {
|
---|
[1077] | 5045 | env = "WINOS2.COM";
|
---|
| 5046 | type = SEPARATE | FULLSCREEN;
|
---|
[2] | 5047 | }
|
---|
[888] | 5048 | runemf2(type, hwnd, pszSrcFile, __LINE__,
|
---|
[1077] | 5049 | path, NULL, "%s", env);
|
---|
[133] | 5050 | }
|
---|
| 5051 | break;
|
---|
[2] | 5052 |
|
---|
[133] | 5053 | case IDM_KILLPROC:
|
---|
| 5054 | WinDlgBox(HWND_DESKTOP, hwnd, KillDlgProc, FM3ModHandle,
|
---|
[1077] | 5055 | KILL_FRAME, NULL);
|
---|
[133] | 5056 | break;
|
---|
[2] | 5057 |
|
---|
[133] | 5058 | case IDM_AUTOVIEWCOMMENTS:
|
---|
| 5059 | case IDM_AUTOVIEWFILE:
|
---|
| 5060 | if (SHORT1FROMMP(mp1) == IDM_AUTOVIEWFILE)
|
---|
| 5061 | fComments = FALSE;
|
---|
| 5062 | else
|
---|
| 5063 | fComments = TRUE;
|
---|
[551] | 5064 | PrfWriteProfileData(fmprof, FM3Str, "Comments", &fComments, sizeof(BOOL));
|
---|
[133] | 5065 | WinSetWindowText((fComments) ? hwndAutoview : hwndAutoMLE, NullStr);
|
---|
| 5066 | goto AutoChange;
|
---|
[2] | 5067 |
|
---|
[133] | 5068 | case IDM_AUTOVIEW:
|
---|
| 5069 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
---|
[1077] | 5070 | &fAutoView, TRUE, "AutoView");
|
---|
[133] | 5071 | AutoChange:
|
---|
| 5072 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
---|
[1077] | 5073 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[551] | 5074 | if (fAutoView) {
|
---|
[2] | 5075 |
|
---|
[133] | 5076 | CHAR s[CCHMAXPATH];
|
---|
| 5077 | HWND hwndDir;
|
---|
| 5078 | PCNRITEM pci;
|
---|
[2] | 5079 |
|
---|
[551] | 5080 | hwndDir = TopWindowName(hwnd, (HWND) 0, s);
|
---|
| 5081 | if (hwndDir) {
|
---|
[1077] | 5082 | hwndDir = WinWindowFromID(hwndDir, FID_CLIENT);
|
---|
| 5083 | if (hwndDir) {
|
---|
| 5084 | hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
|
---|
| 5085 | if (hwndDir) {
|
---|
| 5086 | pci = (PCNRITEM) WinSendMsg(hwndDir, CM_QUERYRECORDEMPHASIS,
|
---|
| 5087 | MPFROMLONG(CMA_FIRST),
|
---|
| 5088 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 5089 | if (pci && (INT) pci != -1 &&
|
---|
| 5090 | (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
|
---|
| 5091 | WinSendMsg(hwnd,
|
---|
| 5092 | UM_LOADFILE,
|
---|
| 5093 | MPFROMP(pci->pszFileName),
|
---|
| 5094 | (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ?
|
---|
| 5095 | MPVOID : MPFROMLONG(1));
|
---|
| 5096 | }
|
---|
| 5097 | }
|
---|
[2] | 5098 | }
|
---|
[133] | 5099 | }
|
---|
| 5100 | break;
|
---|
[2] | 5101 |
|
---|
[133] | 5102 | case IDM_TEXTTOOLS:
|
---|
| 5103 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
---|
[1077] | 5104 | &fTextTools, TRUE, "TextTools");
|
---|
[133] | 5105 | BuildTools(hwndToolback, TRUE);
|
---|
| 5106 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
---|
[1077] | 5107 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[133] | 5108 | break;
|
---|
[2] | 5109 |
|
---|
[133] | 5110 | case IDM_TOOLTITLES:
|
---|
| 5111 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
---|
[1077] | 5112 | &fToolTitles, TRUE, "ToolTitles");
|
---|
[133] | 5113 | BuildTools(hwndToolback, TRUE);
|
---|
| 5114 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
---|
[1077] | 5115 | MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[133] | 5116 | break;
|
---|
[2] | 5117 |
|
---|
[133] | 5118 | case IDM_HIDEMENU:
|
---|
| 5119 | {
|
---|
[953] | 5120 | HWND hwndMenu = WinQueryWindowULong(hwnd, QWL_USER);
|
---|
| 5121 | MenuInvisible = MenuInvisible ? FALSE : TRUE;
|
---|
[551] | 5122 | if (MenuInvisible) {
|
---|
[1077] | 5123 | WinSetParent(hwndMenu, HWND_OBJECT, FALSE);
|
---|
| 5124 | WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 5125 | FID_SYSMENU), IDM_HIDEMENU,
|
---|
| 5126 | GetPString(IDS_UNHIDEMENUTEXT));
|
---|
[2] | 5127 | }
|
---|
[551] | 5128 | else {
|
---|
[1077] | 5129 | WinSetParent(hwndMenu, WinQueryWindow(hwnd, QW_PARENT), FALSE);
|
---|
| 5130 | WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 5131 | FID_SYSMENU), IDM_HIDEMENU,
|
---|
| 5132 | GetPString(IDS_HIDEMENUTEXT));
|
---|
[133] | 5133 | }
|
---|
| 5134 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
|
---|
[1077] | 5135 | MPFROMLONG(FCF_MENU), MPVOID);
|
---|
[133] | 5136 | PrfWriteProfileData(fmprof, FM3Str, "MenuInvisible",
|
---|
[1077] | 5137 | &MenuInvisible, sizeof(BOOL));
|
---|
[133] | 5138 | }
|
---|
| 5139 | break;
|
---|
[2] | 5140 |
|
---|
[133] | 5141 | case IDM_SEEALL:
|
---|
| 5142 | case IDM_GREP:
|
---|
| 5143 | case IDM_COLLECTOR:
|
---|
| 5144 | {
|
---|
| 5145 | HWND hwndC;
|
---|
| 5146 | SWP swp;
|
---|
| 5147 | BOOL already = FALSE;
|
---|
| 5148 |
|
---|
| 5149 | if (Collector)
|
---|
[1077] | 5150 | already = TRUE;
|
---|
[133] | 5151 | if (!already && !fAutoTile && !fExternalCollector)
|
---|
[1077] | 5152 | GetNextWindowPos(hwnd, &swp, NULL, NULL);
|
---|
[735] | 5153 | hwndC = StartCollector(fExternalCollector ? HWND_DESKTOP : hwnd, 4);
|
---|
[551] | 5154 | if (hwndC) {
|
---|
[1077] | 5155 | if (!already && !fAutoTile && !fExternalCollector)
|
---|
| 5156 | WinSetWindowPos(hwndC, HWND_TOP,
|
---|
| 5157 | swp.x, swp.y, swp.cx, swp.cy,
|
---|
| 5158 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
---|
| 5159 | else if (fAutoTile && !already)
|
---|
| 5160 | TileChildren(hwnd, TRUE);
|
---|
| 5161 | WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE |
|
---|
| 5162 | SWP_ACTIVATE);
|
---|
| 5163 | if (SHORT1FROMMP(mp1) == IDM_GREP)
|
---|
| 5164 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,
|
---|
| 5165 | MPFROM2SHORT(IDM_GREP, 0), MPVOID);
|
---|
| 5166 | if (SHORT1FROMMP(mp1) == IDM_SEEALL)
|
---|
| 5167 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,
|
---|
| 5168 | MPFROM2SHORT(IDM_SEEALL, 0), MPVOID);
|
---|
[2] | 5169 | }
|
---|
[133] | 5170 | }
|
---|
| 5171 | break;
|
---|
[2] | 5172 |
|
---|
[133] | 5173 | case IDM_TOOLLEFT:
|
---|
| 5174 | case IDM_TOOLRIGHT:
|
---|
| 5175 | {
|
---|
| 5176 | TOOL *tool;
|
---|
| 5177 |
|
---|
[551] | 5178 | if (!toolhead || !toolhead->next) {
|
---|
[1077] | 5179 | firsttool = (toolhead) ? toolhead->id : 0;
|
---|
| 5180 | break;
|
---|
[2] | 5181 | }
|
---|
[133] | 5182 | tool = find_tool(firsttool);
|
---|
| 5183 | if (!tool)
|
---|
[1077] | 5184 | tool = toolhead;
|
---|
[551] | 5185 | if (SHORT1FROMMP(mp1) == IDM_TOOLRIGHT) {
|
---|
[1077] | 5186 | tool = prev_tool(tool, TRUE);
|
---|
| 5187 | firsttool = tool->id;
|
---|
[133] | 5188 | }
|
---|
[551] | 5189 | else {
|
---|
[1077] | 5190 | tool = next_tool(tool, TRUE);
|
---|
| 5191 | firsttool = tool->id;
|
---|
[133] | 5192 | }
|
---|
| 5193 | ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5194 | MAIN_TOOLS));
|
---|
[133] | 5195 | }
|
---|
| 5196 | break;
|
---|
[2] | 5197 |
|
---|
[133] | 5198 | case IDM_CREATETOOL:
|
---|
[551] | 5199 | BuildTools(hwndToolback, TRUE);
|
---|
[133] | 5200 | break;
|
---|
[2] | 5201 |
|
---|
[133] | 5202 | case IDM_TOOLBAR:
|
---|
| 5203 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5204 | IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar");
|
---|
[551] | 5205 | BuildTools(hwndToolback, TRUE);
|
---|
[133] | 5206 | WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5207 | MAIN_TOOLS), fToolbar);
|
---|
[133] | 5208 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5209 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[133] | 5210 | if (fDrivebar)
|
---|
| 5211 | WinInvalidateRect(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5212 | MAIN_DRIVES), NULL, TRUE);
|
---|
[133] | 5213 | break;
|
---|
[2] | 5214 |
|
---|
[133] | 5215 | case IDM_DRIVEBAR:
|
---|
| 5216 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5217 | IDM_DRIVEBAR, &fDrivebar, TRUE, "Drivebar");
|
---|
[133] | 5218 | WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5219 | MAIN_DRIVES), fDrivebar);
|
---|
[133] | 5220 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5221 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[551] | 5222 | PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
|
---|
[133] | 5223 | break;
|
---|
[2] | 5224 |
|
---|
[133] | 5225 | case IDM_USERLIST:
|
---|
| 5226 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5227 | SHORT1FROMMP(mp1), &fUserComboBox, TRUE, "UserComboBox");
|
---|
[133] | 5228 | WinShowWindow(hwndUserlist, fUserComboBox);
|
---|
| 5229 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5230 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[551] | 5231 | PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
---|
| 5232 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
---|
| 5233 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
---|
| 5234 | PostMsg(hwnd, UM_FILLBUTTONLIST, MPVOID, MPVOID);
|
---|
[133] | 5235 | break;
|
---|
[2] | 5236 |
|
---|
[133] | 5237 | case IDM_MOREBUTTONS:
|
---|
| 5238 | WinSetWindowText(hwndName, NullStr);
|
---|
| 5239 | WinSetWindowText(hwndDate, NullStr);
|
---|
| 5240 | WinSetWindowText(hwndAttr, NullStr);
|
---|
| 5241 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5242 | SHORT1FROMMP(mp1), &fMoreButtons, TRUE, "MoreButtons");
|
---|
[551] | 5243 | if (fMoreButtons) {
|
---|
[2] | 5244 |
|
---|
[133] | 5245 | HWND hwndTemp;
|
---|
[2] | 5246 |
|
---|
[551] | 5247 | hwndTemp = TopWindow(hwnd, (HWND) 0);
|
---|
[2] | 5248 |
|
---|
[551] | 5249 | if (hwndTemp) {
|
---|
[1077] | 5250 | WinSetFocus(HWND_DESKTOP, hwnd);
|
---|
| 5251 | WinSetFocus(HWND_DESKTOP, hwndTemp);
|
---|
[2] | 5252 | }
|
---|
[133] | 5253 | }
|
---|
| 5254 | PostMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5255 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
[133] | 5256 | break;
|
---|
[2] | 5257 |
|
---|
[921] | 5258 | case IDM_TOGGLEDRAGDIALOG:
|
---|
| 5259 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5260 | IDM_TOGGLEDRAGDIALOG,
|
---|
| 5261 | &fDragndropDlg,
|
---|
| 5262 | TRUE,
|
---|
| 5263 | "Drag&DropDlg");
|
---|
[921] | 5264 | break;
|
---|
| 5265 |
|
---|
[925] | 5266 | case IDM_SYNCUPDATES:
|
---|
| 5267 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5268 | IDM_SYNCUPDATES,
|
---|
| 5269 | &fSyncUpdates,
|
---|
| 5270 | TRUE,
|
---|
| 5271 | "SyncUpdates");
|
---|
[925] | 5272 | break;
|
---|
| 5273 |
|
---|
[133] | 5274 | case IDM_FREETREE:
|
---|
[551] | 5275 | if (fFreeTree) {
|
---|
[133] | 5276 | SWP swp, swpT;
|
---|
[2] | 5277 |
|
---|
[133] | 5278 | WinQueryWindowPos(hwndTree, &swpT);
|
---|
| 5279 | WinQueryWindowPos(hwnd, &swp);
|
---|
[551] | 5280 | WinSetWindowPos(hwndTree, HWND_TOP, 0, swp.cy - swpT.cy, 0, 0,
|
---|
[1077] | 5281 | SWP_MOVE);
|
---|
[133] | 5282 | }
|
---|
| 5283 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
|
---|
[1077] | 5284 | &fFreeTree, TRUE, "FreeTree");
|
---|
[133] | 5285 | if (fAutoTile)
|
---|
| 5286 | TileChildren(hwnd, TRUE);
|
---|
| 5287 | break;
|
---|
[2] | 5288 |
|
---|
[133] | 5289 | case IDM_AUTOTILE:
|
---|
| 5290 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5291 | SHORT1FROMMP(mp1), &fAutoTile, TRUE, "AutoTile");
|
---|
[133] | 5292 | if (fAutoTile)
|
---|
| 5293 | TileChildren(hwnd, TRUE);
|
---|
| 5294 | break;
|
---|
[2] | 5295 |
|
---|
[133] | 5296 | case IDM_TILEBACKWARDS:
|
---|
| 5297 | SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5298 | SHORT1FROMMP(mp1), &fTileBackwards, TRUE, "TileBackwards");
|
---|
[133] | 5299 | if (fAutoTile)
|
---|
| 5300 | TileChildren(hwnd, TRUE);
|
---|
| 5301 | break;
|
---|
[2] | 5302 |
|
---|
[133] | 5303 | case IDM_NEXTWINDOW:
|
---|
| 5304 | case IDM_PREVWINDOW:
|
---|
[551] | 5305 | NextChild(hwnd, (SHORT1FROMMP(mp1) == IDM_PREVWINDOW));
|
---|
[133] | 5306 | break;
|
---|
[2] | 5307 |
|
---|
[133] | 5308 | case IDM_CASCADE:
|
---|
| 5309 | CascadeChildren(hwnd);
|
---|
| 5310 | break;
|
---|
[2] | 5311 |
|
---|
[133] | 5312 | case IDM_TILE:
|
---|
| 5313 | TileChildren(hwnd, TRUE);
|
---|
| 5314 | break;
|
---|
[2] | 5315 |
|
---|
[133] | 5316 | case IDM_RESTORE:
|
---|
[551] | 5317 | MinResChildren(hwnd, SWP_RESTORE);
|
---|
[133] | 5318 | break;
|
---|
[2] | 5319 |
|
---|
[133] | 5320 | case IDM_MINIMIZE:
|
---|
[551] | 5321 | MinResChildren(hwnd, SWP_MINIMIZE);
|
---|
[133] | 5322 | break;
|
---|
[2] | 5323 |
|
---|
[133] | 5324 | case IDM_ARRANGEICONS:
|
---|
| 5325 | ArrangeIcons(hwnd);
|
---|
| 5326 | break;
|
---|
[2] | 5327 |
|
---|
[133] | 5328 | case IDM_INIVIEWER:
|
---|
| 5329 | StartIniEditor(hwnd, NULL, 4);
|
---|
| 5330 | break;
|
---|
[2] | 5331 |
|
---|
[133] | 5332 | case IDM_EDITASSOC:
|
---|
| 5333 | EditAssociations(hwnd);
|
---|
| 5334 | break;
|
---|
[2] | 5335 |
|
---|
[133] | 5336 | case IDM_EDITCOMMANDS:
|
---|
| 5337 | EditCommands(hwnd);
|
---|
[551] | 5338 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
---|
[133] | 5339 | break;
|
---|
[2] | 5340 |
|
---|
[133] | 5341 | default:
|
---|
[551] | 5342 | if (!SwitchCommand((HWND) WinQueryWindowULong(hwnd, QWL_USER),
|
---|
[1077] | 5343 | SHORT1FROMMP(mp1))) {
|
---|
[133] | 5344 | if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
|
---|
[1077] | 5345 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
|
---|
[2] | 5346 |
|
---|
[1077] | 5347 | INT x;
|
---|
| 5348 | HWND hwndCnr;
|
---|
[2] | 5349 |
|
---|
[1077] | 5350 | if (!cmdloaded)
|
---|
| 5351 | load_commands();
|
---|
| 5352 | hwndCnr = TopWindow(hwnd, (HWND) 0);
|
---|
| 5353 | hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT),
|
---|
| 5354 | UM_CONTAINERHWND, MPVOID, MPVOID);
|
---|
| 5355 | if (!hwndCnr) {
|
---|
| 5356 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT);
|
---|
| 5357 | break;
|
---|
| 5358 | }
|
---|
| 5359 | x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
|
---|
| 5360 | if (x >= 0) {
|
---|
| 5361 | x++;
|
---|
| 5362 | RunCommand(hwndCnr, x);
|
---|
| 5363 | if (fUnHilite) {
|
---|
[2] | 5364 |
|
---|
[1077] | 5365 | PCNRITEM pci;
|
---|
| 5366 | DIRCNRDATA *dcd = NULL;
|
---|
[2] | 5367 |
|
---|
[1077] | 5368 | // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR?
|
---|
| 5369 | if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR)
|
---|
| 5370 | dcd = INSTDATA(hwndCnr);
|
---|
| 5371 | pci = (PCNRITEM) WinSendMsg(hwndCnr,
|
---|
| 5372 | CM_QUERYRECORDEMPHASIS,
|
---|
| 5373 | MPFROMLONG(CMA_FIRST),
|
---|
| 5374 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 5375 | if (pci && (INT) pci != -1 &&
|
---|
| 5376 | (pci->rc.flRecordAttr & CRA_SELECTED))
|
---|
| 5377 | {
|
---|
| 5378 | UnHilite(hwnd,
|
---|
| 5379 | TRUE,
|
---|
| 5380 | dcd ? &dcd->lastselection : NULL,
|
---|
| 5381 | dcd ? dcd ->ulItemsToUnHilite : 0);
|
---|
| 5382 | }
|
---|
| 5383 | }
|
---|
| 5384 | }
|
---|
[133] | 5385 | }
|
---|
| 5386 | else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART &&
|
---|
[1077] | 5387 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 50) {
|
---|
| 5388 | if (!qtloaded)
|
---|
| 5389 | load_quicktools();
|
---|
| 5390 | if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]) {
|
---|
| 5391 | if (fToolsChanged)
|
---|
| 5392 | save_tools(NULL);
|
---|
| 5393 | if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]))
|
---|
| 5394 | load_tools(NULL);
|
---|
| 5395 | else {
|
---|
| 5396 | strcpy(lasttoolbox,
|
---|
| 5397 | quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]);
|
---|
| 5398 | PrfWriteProfileString(fmprof, FM3Str, "LastToolBox", lasttoolbox);
|
---|
| 5399 | }
|
---|
| 5400 | BuildTools(hwndToolback, TRUE);
|
---|
| 5401 | }
|
---|
[133] | 5402 | }
|
---|
[551] | 5403 | else {
|
---|
[2] | 5404 |
|
---|
[1077] | 5405 | HWND hwndActive;
|
---|
[2] | 5406 |
|
---|
[1077] | 5407 | hwndActive = TopWindow(hwnd, (HWND) 0);
|
---|
| 5408 | if (hwndActive)
|
---|
| 5409 | PostMsg(WinWindowFromID(hwndActive, FID_CLIENT),
|
---|
| 5410 | WM_COMMAND, mp1, mp2);
|
---|
[2] | 5411 | }
|
---|
[133] | 5412 | }
|
---|
[930] | 5413 | break; // default
|
---|
[824] | 5414 | } // switch mp1
|
---|
[2] | 5415 | return 0;
|
---|
| 5416 | }
|
---|
| 5417 |
|
---|
[551] | 5418 | static MRESULT EXPENTRY MainWMOnce(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
[1077] | 5419 | MPARAM mp2)
|
---|
[133] | 5420 | {
|
---|
[376] | 5421 | TID tid;
|
---|
| 5422 | SWP swp;
|
---|
| 5423 | PFNWP oldproc;
|
---|
| 5424 | HWND hwndTmp;
|
---|
| 5425 | HWND hwndFrame;
|
---|
| 5426 | HWND hwndSysMenu, hwndSysSubMenu, hwndMenu;
|
---|
| 5427 | USHORT idSysMenu;
|
---|
| 5428 | MENUITEM mi, mit;
|
---|
| 5429 | ULONG size;
|
---|
| 5430 | BOOL temp = FALSE;
|
---|
| 5431 |
|
---|
| 5432 | switch (msg) {
|
---|
[133] | 5433 | case WM_CREATE:
|
---|
[551] | 5434 | WinQueryWindowProcess(hwnd, &mypid, &tid);
|
---|
[133] | 5435 | hwndMain = hwnd;
|
---|
| 5436 | WinSetWindowUShort(hwnd, QWL_USER + 8, 0);
|
---|
| 5437 | WinSetWindowUShort(hwnd, QWL_USER + 10, 0);
|
---|
| 5438 | WinSetWindowUShort(hwnd, QWL_USER + 12, 0);
|
---|
| 5439 | WinSetWindowUShort(hwnd, QWL_USER + 16, 0);
|
---|
[551] | 5440 | if (_beginthread(MakeMainObjWin, NULL, 245760, MPVOID) == -1) {
|
---|
| 5441 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
[1077] | 5442 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
[551] | 5443 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
[133] | 5444 | return 0;
|
---|
| 5445 | }
|
---|
| 5446 | else
|
---|
[771] | 5447 | DosSleep(32);//05 Aug 07 GKY 64
|
---|
[133] | 5448 |
|
---|
[376] | 5449 | hwndFrame = WinQueryWindow(hwnd, QW_PARENT);
|
---|
[133] | 5450 |
|
---|
[376] | 5451 | /*
|
---|
| 5452 | * create frame children (not client children, frame children)
|
---|
| 5453 | */
|
---|
[771] | 5454 | DosSleep(1);
|
---|
[376] | 5455 | WinQueryWindowPos(hwndFrame, &swp);
|
---|
[551] | 5456 | oldproc = WinSubclassWindow(hwndFrame, MainFrameWndProc);
|
---|
| 5457 | WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
|
---|
[376] | 5458 | CommonCreateMainChildren(hwnd, &swp);
|
---|
| 5459 |
|
---|
| 5460 | if (!WinCreateWindow(hwndFrame,
|
---|
[1077] | 5461 | WC_BUTTON,
|
---|
| 5462 | "I",
|
---|
| 5463 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS,
|
---|
| 5464 | ((swp.cx -
|
---|
| 5465 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5466 | SV_CXMINMAXBUTTON)) -
|
---|
| 5467 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5468 | SV_CXMINMAXBUTTON) / 2) -
|
---|
| 5469 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5470 | SV_CXSIZEBORDER),
|
---|
| 5471 | (swp.cy - WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5472 | SV_CYMINMAXBUTTON)) -
|
---|
| 5473 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5474 | SV_CYSIZEBORDER),
|
---|
| 5475 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5476 | SV_CXMINMAXBUTTON) / 2,
|
---|
| 5477 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5478 | SV_CYMINMAXBUTTON),
|
---|
| 5479 | hwnd, HWND_TOP, IDM_IDEALSIZE, NULL, NULL)) {
|
---|
[551] | 5480 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
[376] | 5481 | }
|
---|
| 5482 | else {
|
---|
[551] | 5483 | WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_IDEALSIZE),
|
---|
[1077] | 5484 | IdealButtonProc);
|
---|
[376] | 5485 | SetPresParams(WinWindowFromID(hwndFrame,
|
---|
[1077] | 5486 | IDM_IDEALSIZE),
|
---|
| 5487 | NULL, NULL, NULL, GetPString(IDS_10SYSTEMVIOTEXT));
|
---|
[376] | 5488 | }
|
---|
[2] | 5489 |
|
---|
[376] | 5490 | hwndTmp = WinCreateWindow(hwndFrame,
|
---|
[1077] | 5491 | WC_BUTTON,
|
---|
| 5492 | "#1019",
|
---|
| 5493 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
|
---|
| 5494 | BS_BITMAP,
|
---|
| 5495 | swp.cx - 46,
|
---|
| 5496 | swp.y + 2,
|
---|
| 5497 | 24,
|
---|
| 5498 | 22, hwnd, HWND_TOP, IDM_OPENWALK, NULL, NULL);
|
---|
[376] | 5499 | if (!hwndTmp)
|
---|
[551] | 5500 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
[2] | 5501 |
|
---|
[376] | 5502 | hwndTmp = WinCreateWindow(hwndFrame,
|
---|
[1077] | 5503 | WC_BUTTON,
|
---|
| 5504 | "#3062",
|
---|
| 5505 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
|
---|
| 5506 | BS_BITMAP,
|
---|
| 5507 | swp.cx - 22,
|
---|
| 5508 | swp.y + 2,
|
---|
| 5509 | 24,
|
---|
| 5510 | 22, hwnd, HWND_TOP, IDM_USERLIST, NULL, NULL);
|
---|
[376] | 5511 | if (!hwndTmp)
|
---|
[551] | 5512 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
[376] | 5513 |
|
---|
| 5514 | hwndUserlist = WinCreateWindow(hwndFrame,
|
---|
[1077] | 5515 | WC_COMBOBOX,
|
---|
| 5516 | (PSZ) NULL,
|
---|
| 5517 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
| 5518 | LS_HORZSCROLL,
|
---|
| 5519 | (swp.x +
|
---|
| 5520 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5521 | SV_CXSIZEBORDER) + 48L),
|
---|
| 5522 | (swp.cy -
|
---|
| 5523 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5524 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5525 | ((swp.cx -
|
---|
| 5526 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5527 | SV_CXSIZEBORDER) *
|
---|
| 5528 | 2)) - 64L), 60L, hwndFrame, HWND_TOP,
|
---|
| 5529 | MAIN_USERLIST, NULL, NULL);
|
---|
[376] | 5530 | if (!hwndUserlist)
|
---|
[551] | 5531 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
[376] | 5532 | hwndCmdlist = WinCreateWindow(hwndFrame,
|
---|
[1077] | 5533 | WC_COMBOBOX,
|
---|
| 5534 | (PSZ) NULL,
|
---|
| 5535 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
| 5536 | LS_HORZSCROLL,
|
---|
| 5537 | (swp.x +
|
---|
| 5538 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5539 | SV_CXSIZEBORDER) + 48L),
|
---|
| 5540 | (swp.cy -
|
---|
| 5541 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5542 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5543 | ((swp.cx -
|
---|
| 5544 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5545 | SV_CXSIZEBORDER) * 2)) -
|
---|
| 5546 | 64L), 60L, hwndFrame, HWND_TOP,
|
---|
| 5547 | MAIN_CMDLIST, NULL, NULL);
|
---|
[376] | 5548 | if (!hwndCmdlist)
|
---|
[551] | 5549 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
| 5550 | WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));
|
---|
[376] | 5551 | hwndStatelist = WinCreateWindow(hwndFrame,
|
---|
[1077] | 5552 | WC_COMBOBOX,
|
---|
| 5553 | (PSZ) NULL,
|
---|
| 5554 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
| 5555 | LS_HORZSCROLL,
|
---|
| 5556 | (swp.x +
|
---|
| 5557 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5558 | SV_CXSIZEBORDER) + 48L),
|
---|
| 5559 | (swp.cy -
|
---|
| 5560 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5561 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5562 | ((swp.cx -
|
---|
| 5563 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5564 | SV_CXSIZEBORDER) *
|
---|
| 5565 | 2)) - 64L), 60L, hwndFrame, HWND_TOP,
|
---|
| 5566 | MAIN_SETUPLIST, NULL, NULL);
|
---|
[376] | 5567 | if (!hwndStatelist)
|
---|
[551] | 5568 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
[824] | 5569 |
|
---|
[376] | 5570 | hwndDrivelist = WinCreateWindow(hwndFrame,
|
---|
[1077] | 5571 | WC_COMBOBOX,
|
---|
| 5572 | (PSZ) NULL,
|
---|
| 5573 | WS_VISIBLE | CBS_DROPDOWN,
|
---|
| 5574 | (swp.x +
|
---|
| 5575 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5576 | SV_CXSIZEBORDER)),
|
---|
| 5577 | (swp.cy -
|
---|
| 5578 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5579 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5580 | 48L,
|
---|
| 5581 | 60L,
|
---|
| 5582 | hwndFrame,
|
---|
| 5583 | HWND_TOP, MAIN_DRIVELIST, NULL, NULL);
|
---|
[376] | 5584 | if (!hwndDrivelist)
|
---|
[551] | 5585 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
[376] | 5586 | SetPresParams(hwndDrivelist,
|
---|
[1077] | 5587 | NULL, NULL, NULL, GetPString(IDS_10SYSTEMMONOTEXT));
|
---|
[376] | 5588 | hwndButtonlist = WinCreateWindow(hwndFrame,
|
---|
[1077] | 5589 | WC_COMBOBOX,
|
---|
| 5590 | (PSZ) NULL,
|
---|
| 5591 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
| 5592 | LS_HORZSCROLL,
|
---|
| 5593 | (swp.cx -
|
---|
| 5594 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5595 | SV_CXSIZEBORDER)) -
|
---|
| 5596 | 164L,
|
---|
| 5597 | (swp.cy -
|
---|
| 5598 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5599 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5600 | 164L, 60L, hwndFrame, HWND_TOP,
|
---|
| 5601 | MAIN_BUTTONLIST, NULL, NULL);
|
---|
[376] | 5602 | if (!hwndButtonlist)
|
---|
[551] | 5603 | Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
|
---|
[376] | 5604 | WinSendMsg(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
---|
[1077] | 5605 | EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
|
---|
[376] | 5606 | WinSendMsg(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
---|
[1077] | 5607 | EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID);
|
---|
[376] | 5608 | WinSendMsg(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
[1077] | 5609 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
---|
[376] | 5610 | WinSendMsg(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
---|
[1077] | 5611 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
---|
[376] | 5612 | WinSendMsg(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
---|
[1077] | 5613 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
---|
[376] | 5614 |
|
---|
| 5615 | oldproc = WinSubclassWindow(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
---|
[1077] | 5616 | DropDownListProc);
|
---|
[376] | 5617 | WinSetWindowPtr(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
---|
[1077] | 5618 | QWL_USER, (PVOID) oldproc);
|
---|
[376] | 5619 | oldproc = WinSubclassWindow(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
---|
[1077] | 5620 | DropDownListProc);
|
---|
[376] | 5621 | WinSetWindowPtr(WinWindowFromID(hwndCmdlist, CBID_EDIT),
|
---|
[1077] | 5622 | QWL_USER, (PVOID) oldproc);
|
---|
[376] | 5623 | oldproc = WinSubclassWindow(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
---|
[1077] | 5624 | DropDownListProc);
|
---|
[376] | 5625 | WinSetWindowPtr(WinWindowFromID(hwndButtonlist, CBID_EDIT),
|
---|
[1077] | 5626 | QWL_USER, (PVOID) oldproc);
|
---|
[376] | 5627 | oldproc = WinSubclassWindow(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
---|
[1077] | 5628 | DropDownListProc);
|
---|
[376] | 5629 | WinSetWindowPtr(WinWindowFromID(hwndStatelist, CBID_EDIT),
|
---|
[1077] | 5630 | QWL_USER, (PVOID) oldproc);
|
---|
[376] | 5631 | oldproc = WinSubclassWindow(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
[1077] | 5632 | DropDownListProc);
|
---|
[376] | 5633 | WinSetWindowPtr(WinWindowFromID(hwndDrivelist, CBID_EDIT),
|
---|
[1077] | 5634 | QWL_USER, (PVOID) oldproc);
|
---|
[551] | 5635 | oldproc = WinSubclassWindow(hwndUserlist, DropDownListProc);
|
---|
| 5636 | WinSetWindowPtr(hwndUserlist, QWL_USER, (PVOID) oldproc);
|
---|
| 5637 | oldproc = WinSubclassWindow(hwndCmdlist, DropDownListProc);
|
---|
| 5638 | WinSetWindowPtr(hwndCmdlist, QWL_USER, (PVOID) oldproc);
|
---|
| 5639 | oldproc = WinSubclassWindow(hwndStatelist, DropDownListProc);
|
---|
| 5640 | WinSetWindowPtr(hwndStatelist, QWL_USER, (PVOID) oldproc);
|
---|
| 5641 | oldproc = WinSubclassWindow(hwndDrivelist, DropDownListProc);
|
---|
[376] | 5642 | WinSetWindowPtr(hwndDrivelist, QWL_USER, (PVOID) oldproc);
|
---|
[551] | 5643 | oldproc = WinSubclassWindow(hwndButtonlist, DropDownListProc);
|
---|
| 5644 | WinSetWindowPtr(hwndButtonlist, QWL_USER, (PVOID) oldproc);
|
---|
| 5645 | oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_USERLIST),
|
---|
[1077] | 5646 | ChildFrameButtonProc);
|
---|
[551] | 5647 | WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_USERLIST),
|
---|
[1077] | 5648 | QWL_USER, (PVOID) oldproc);
|
---|
[551] | 5649 | oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_OPENWALK),
|
---|
[1077] | 5650 | ChildFrameButtonProc);
|
---|
[551] | 5651 | WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_OPENWALK),
|
---|
[1077] | 5652 | QWL_USER, (PVOID) oldproc);
|
---|
[551] | 5653 | hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
|
---|
| 5654 | WinSendMsg(hwnd, UM_ADDTOMENU, MPVOID, MPVOID);
|
---|
[376] | 5655 | SetToggleChecks(hwndMenu);
|
---|
[1027] | 5656 | CfgMenuInit(hwndMenu, FALSE); // 14 Feb 08 SHL
|
---|
[933] | 5657 | SetConditionalCascade(hwndMenu, IDM_COMMANDLINESUBMENU, IDM_COMMANDLINE);
|
---|
[551] | 5658 | SetConditionalCascade(hwndMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
|
---|
| 5659 | SetConditionalCascade(hwndMenu, IDM_AUTOVIEWSUBMENU, IDM_AUTOVIEW);
|
---|
| 5660 | SetConditionalCascade(hwndMenu, IDM_TILEMENU, IDM_TILE);
|
---|
| 5661 | WinSetWindowULong(hwnd, QWL_USER, hwndMenu);
|
---|
[376] | 5662 | memset(&mi, 0, sizeof(mi));
|
---|
| 5663 | memset(&mit, 0, sizeof(mit));
|
---|
[551] | 5664 | hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU);
|
---|
[376] | 5665 | idSysMenu = SHORT1FROMMR(WinSendMsg(hwndSysMenu,
|
---|
[1077] | 5666 | MM_ITEMIDFROMPOSITION,
|
---|
| 5667 | MPVOID, MPVOID));
|
---|
[376] | 5668 | WinSendMsg(hwndSysMenu,
|
---|
[1077] | 5669 | MM_QUERYITEM, MPFROM2SHORT(idSysMenu, 0), MPFROMP(&mit));
|
---|
[376] | 5670 | hwndSysSubMenu = mit.hwndSubMenu;
|
---|
| 5671 | mi.iPosition = MIT_END;
|
---|
| 5672 | mi.afStyle = MIS_SEPARATOR;
|
---|
[551] | 5673 | mi.id = (USHORT) - 1;
|
---|
| 5674 | WinSendMsg(hwndSysSubMenu, MM_INSERTITEM, MPFROMP(&mi), MPFROMP(NULL));
|
---|
[376] | 5675 | mi.afStyle = MIS_TEXT;
|
---|
| 5676 | mi.id = IDM_IDEALSIZE;
|
---|
| 5677 | WinSendMsg(hwndSysSubMenu,
|
---|
[1077] | 5678 | MM_INSERTITEM,
|
---|
| 5679 | MPFROMP(&mi), MPFROMP(GetPString(IDS_IDEALMENUTEXT)));
|
---|
[376] | 5680 | mi.afStyle = MIS_TEXT;
|
---|
| 5681 | mi.id = IDM_HIDEMENU;
|
---|
| 5682 | WinSendMsg(hwndSysSubMenu,
|
---|
[1077] | 5683 | MM_INSERTITEM,
|
---|
| 5684 | MPFROMP(&mi), MPFROMP(GetPString(IDS_HIDEMENUTEXT)));
|
---|
[376] | 5685 | SetSysMenu(hwndSysMenu);
|
---|
| 5686 |
|
---|
| 5687 | size = sizeof(BOOL);
|
---|
| 5688 | if (PrfQueryProfileData(fmprof,
|
---|
[1077] | 5689 | FM3Str,
|
---|
| 5690 | "MenuInvisible", &temp, &size) && size && temp)
|
---|
[551] | 5691 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
|
---|
[376] | 5692 | size = sizeof(BOOL);
|
---|
| 5693 | if (PrfQueryProfileData(fmprof,
|
---|
[1077] | 5694 | FM3Str, "FreeTree", &temp, &size) && size && temp)
|
---|
[551] | 5695 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID);
|
---|
[376] | 5696 | size = sizeof(BOOL);
|
---|
| 5697 | if (PrfQueryProfileData(fmprof,
|
---|
[1077] | 5698 | FM3Str,
|
---|
| 5699 | "AutoTile", &temp, &size) && size && !temp)
|
---|
[551] | 5700 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID);
|
---|
[376] | 5701 | size = sizeof(BOOL);
|
---|
| 5702 | if (PrfQueryProfileData(fmprof,
|
---|
[1077] | 5703 | FM3Str, "Toolbar", &temp, &size) && size && !temp)
|
---|
[551] | 5704 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
|
---|
[2] | 5705 |
|
---|
[551] | 5706 | WinSetWindowText(WinWindowFromID(hwndFrame, FID_TITLEBAR), "FM/2");
|
---|
| 5707 | FixSwitchList(hwndFrame, NULL);
|
---|
[930] | 5708 | break; // WM_CREATE
|
---|
[2] | 5709 |
|
---|
[133] | 5710 | case UM_SETUP:
|
---|
| 5711 | /*
|
---|
| 5712 | * start up some initial children
|
---|
| 5713 | */
|
---|
| 5714 | load_tools(NULL);
|
---|
[551] | 5715 | BuildTools(hwndToolback, TRUE);
|
---|
| 5716 | WinShowWindow(WinQueryWindow(hwnd, QW_PARENT), TRUE);
|
---|
| 5717 | PostMsg(MainObjectHwnd, UM_SETUP2, mp1, mp2);
|
---|
[133] | 5718 | return 0;
|
---|
[2] | 5719 |
|
---|
[133] | 5720 | case UM_SETUP2:
|
---|
| 5721 | {
|
---|
| 5722 | SWP swp;
|
---|
| 5723 | ULONG size = sizeof(SWP);
|
---|
[2] | 5724 |
|
---|
[133] | 5725 | WinQueryWindowPos(hwnd, &swp);
|
---|
[947] | 5726 | hwndTree = StartTreeCnr(hwnd, 4);
|
---|
[133] | 5727 | if (!hwndTree)
|
---|
[1077] | 5728 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
---|
[551] | 5729 | else {
|
---|
[1077] | 5730 | if (!fSaveState ||
|
---|
| 5731 | !PrfQueryProfileData(fmprof,
|
---|
| 5732 | FM3Str,
|
---|
| 5733 | "LastTreePos",
|
---|
| 5734 | &swp, &size) || size != sizeof(SWP)) {
|
---|
[2] | 5735 |
|
---|
[1077] | 5736 | INT ratio, height = 0;
|
---|
[2] | 5737 |
|
---|
[1077] | 5738 | if (!fNoTreeGap)
|
---|
| 5739 | height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
|
---|
| 5740 | size = sizeof(ratio);
|
---|
| 5741 | if (!PrfQueryProfileData(fmprof,
|
---|
| 5742 | FM3Str,
|
---|
| 5743 | "TreeWindowRatio",
|
---|
| 5744 | (PVOID) & ratio,
|
---|
| 5745 | &size) || size < sizeof(ratio))
|
---|
| 5746 | ratio = 400;
|
---|
| 5747 | WinSetWindowPos(hwndTree,
|
---|
| 5748 | HWND_TOP,
|
---|
| 5749 | 0,
|
---|
| 5750 | height,
|
---|
| 5751 | (swp.cx * 100) / ratio,
|
---|
| 5752 | swp.cy - height,
|
---|
| 5753 | SWP_SHOW | SWP_SIZE | SWP_MOVE |
|
---|
| 5754 | SWP_ACTIVATE | SWP_ZORDER);
|
---|
| 5755 | }
|
---|
| 5756 | else
|
---|
| 5757 | WinSetWindowPos(hwndTree,
|
---|
| 5758 | HWND_TOP,
|
---|
| 5759 | swp.x,
|
---|
| 5760 | swp.y,
|
---|
| 5761 | swp.cx,
|
---|
| 5762 | swp.cy,
|
---|
| 5763 | swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW |
|
---|
| 5764 | SWP_ZORDER | SWP_ACTIVATE);
|
---|
[133] | 5765 | }
|
---|
| 5766 | ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5767 | MAIN_TOOLS));
|
---|
[133] | 5768 | }
|
---|
[551] | 5769 | PostMsg(MainObjectHwnd, UM_SETUP3, mp1, mp2);
|
---|
[133] | 5770 | return 0;
|
---|
[2] | 5771 |
|
---|
[133] | 5772 | case UM_SETUP3:
|
---|
| 5773 | /* start remaining child windows */
|
---|
[1025] | 5774 | if (!fNoSaveState && fSaveState) {
|
---|
[1046] | 5775 | PSZ pszStatename = GetPString(IDS_SHUTDOWNSTATE);
|
---|
| 5776 | PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszStatename), MPVOID);
|
---|
| 5777 | if (!add_setup(pszStatename))
|
---|
[1077] | 5778 | save_setups();
|
---|
[1025] | 5779 | }
|
---|
[551] | 5780 | PostMsg(MainObjectHwnd, UM_SETUP4, mp1, mp2);
|
---|
[133] | 5781 | return 0;
|
---|
[2] | 5782 |
|
---|
[133] | 5783 | case UM_SETUP4:
|
---|
| 5784 | {
|
---|
| 5785 | INT argc = (INT) mp1, x;
|
---|
| 5786 | CHAR **argv = (CHAR **) mp2;
|
---|
[2] | 5787 |
|
---|
[376] | 5788 | for (x = 1; x < argc; x++) {
|
---|
[1077] | 5789 | if (*argv[x] == '/' || *argv[x] == ';')
|
---|
| 5790 | continue;
|
---|
| 5791 | if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE))
|
---|
| 5792 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]);
|
---|
[2] | 5793 | }
|
---|
[133] | 5794 | }
|
---|
[551] | 5795 | PostMsg(MainObjectHwnd, UM_SETUP5, MPVOID, MPVOID);
|
---|
[133] | 5796 | return 0;
|
---|
[2] | 5797 |
|
---|
[133] | 5798 | case UM_SETUP5:
|
---|
[1033] | 5799 | // if (fAutoTile)
|
---|
| 5800 | // TileChildren(hwnd, TRUE);
|
---|
[551] | 5801 | PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
|
---|
| 5802 | PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
|
---|
| 5803 | PostMsg(hwnd, UM_FILLCMDLIST, MPVOID, MPVOID);
|
---|
| 5804 | PostMsg(hwnd, UM_FILLBUTTONLIST, MPVOID, MPVOID);
|
---|
[133] | 5805 | {
|
---|
| 5806 | HWND hwndActive;
|
---|
[2] | 5807 |
|
---|
[133] | 5808 | hwndActive = TopWindow(hwnd, hwndTree);
|
---|
| 5809 | if (hwndActive)
|
---|
[1077] | 5810 | WinSetWindowPos(hwndActive, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
|
---|
[133] | 5811 | }
|
---|
[376] | 5812 | if (fStartMinimized || fReminimize)
|
---|
[551] | 5813 | PostMsg(hwndTree, UM_MINIMIZE, MPVOID, MPVOID);
|
---|
[133] | 5814 | else if (fStartMaximized)
|
---|
[551] | 5815 | PostMsg(hwndTree, UM_MAXIMIZE, MPVOID, MPVOID);
|
---|
[133] | 5816 | fRunning = TRUE;
|
---|
[917] | 5817 | if (fWantFirstTimeInit) {
|
---|
| 5818 | fWantFirstTimeInit = FALSE;
|
---|
| 5819 | PostMsg(hwnd, WM_COMMAND, MPFROMLONG(IDM_QUICKSETTINGS), MPVOID);
|
---|
| 5820 | }
|
---|
[133] | 5821 | return 0;
|
---|
[2] | 5822 | }
|
---|
| 5823 |
|
---|
[133] | 5824 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 5825 | }
|
---|
| 5826 |
|
---|
[133] | 5827 | MRESULT EXPENTRY MainWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 5828 | {
|
---|
[551] | 5829 | switch (msg) {
|
---|
[133] | 5830 | case WM_CREATE:
|
---|
[1077] | 5831 | # ifdef FORTIFY
|
---|
| 5832 | Fortify_EnterScope();
|
---|
| 5833 | # endif
|
---|
[133] | 5834 | case UM_SETUP:
|
---|
| 5835 | case UM_SETUP2:
|
---|
| 5836 | case UM_SETUP3:
|
---|
| 5837 | case UM_SETUP4:
|
---|
| 5838 | case UM_SETUP5:
|
---|
| 5839 | return MainWMOnce(hwnd, msg, mp1, mp2);
|
---|
[2] | 5840 |
|
---|
[133] | 5841 | case WM_CONTROLPOINTER:
|
---|
| 5842 | if (!fNoFinger &&
|
---|
[1077] | 5843 | (SHORT1FROMMP(mp1) == IDM_OPENWALK ||
|
---|
| 5844 | SHORT1FROMMP(mp1) == IDM_USERLIST))
|
---|
[133] | 5845 | return MRFROMLONG(hptrFinger);
|
---|
| 5846 | break;
|
---|
[2] | 5847 |
|
---|
[133] | 5848 | case UM_LOADFILE:
|
---|
| 5849 | case UM_THREADUSE:
|
---|
[260] | 5850 | case UM_BUILDDRIVEBAR:
|
---|
[133] | 5851 | return CommonMainWndProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 5852 |
|
---|
[133] | 5853 | case WM_BUTTON1UP:
|
---|
| 5854 | case WM_BUTTON2UP:
|
---|
| 5855 | case WM_BUTTON3UP:
|
---|
| 5856 | case WM_MOUSEMOVE:
|
---|
| 5857 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 5858 | break;
|
---|
[2] | 5859 |
|
---|
[133] | 5860 | case WM_CHAR:
|
---|
| 5861 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 5862 | break;
|
---|
[2] | 5863 |
|
---|
[133] | 5864 | case WM_MENUEND:
|
---|
[551] | 5865 | if ((HWND) mp2 == MainPopupMenu) {
|
---|
[133] | 5866 | WinDestroyWindow(MainPopupMenu);
|
---|
[551] | 5867 | MainPopupMenu = (HWND) 0;
|
---|
[133] | 5868 | }
|
---|
| 5869 | break;
|
---|
[2] | 5870 |
|
---|
[133] | 5871 | case UM_CONTEXTMENU:
|
---|
| 5872 | case WM_CONTEXTMENU:
|
---|
[875] | 5873 | if (CheckMenu(hwndMainMenu, &MainPopupMenu, MAIN_POPUP)) {
|
---|
[133] | 5874 | SetToggleChecks(MainPopupMenu);
|
---|
| 5875 | PopupMenu(hwnd, hwnd, MainPopupMenu);
|
---|
| 5876 | }
|
---|
| 5877 | if (msg == UM_CONTEXTMENU)
|
---|
| 5878 | return 0;
|
---|
| 5879 | return MRFROMSHORT(TRUE);
|
---|
[2] | 5880 |
|
---|
[133] | 5881 | case UM_SETUSERLISTNAME:
|
---|
[551] | 5882 | if (mp1) {
|
---|
[133] | 5883 | if (fUserComboBox)
|
---|
[1077] | 5884 | WinSetWindowText(WinWindowFromID(hwndUserlist, CBID_EDIT),
|
---|
| 5885 | (CHAR *)mp1);
|
---|
[1009] | 5886 | if (add_udir(FALSE, (CHAR *)mp1)) {
|
---|
[1077] | 5887 | if (fUserComboBox && fAutoAddDirs) {
|
---|
| 5888 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
---|
| 5889 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
| 5890 | MPFROMP((CHAR *)mp1));
|
---|
| 5891 | }
|
---|
[133] | 5892 | }
|
---|
| 5893 | }
|
---|
| 5894 | return 0;
|
---|
[2] | 5895 |
|
---|
[133] | 5896 | case UM_ARRANGEICONS:
|
---|
| 5897 | ArrangeIcons(hwnd);
|
---|
| 5898 | return 0;
|
---|
[2] | 5899 |
|
---|
[133] | 5900 | case WM_CHORD:
|
---|
[551] | 5901 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
---|
[133] | 5902 | break;
|
---|
[2] | 5903 |
|
---|
[133] | 5904 | case WM_SETFOCUS:
|
---|
| 5905 | if (mp2)
|
---|
[551] | 5906 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
[133] | 5907 | break;
|
---|
[2] | 5908 |
|
---|
[133] | 5909 | case UM_FOCUSME:
|
---|
[551] | 5910 | WinSetFocus(hwndTree, TRUE);
|
---|
[133] | 5911 | return 0;
|
---|
[2] | 5912 |
|
---|
[133] | 5913 | case UM_RESCAN:
|
---|
| 5914 | TileChildren(hwnd, TRUE);
|
---|
| 5915 | return 0;
|
---|
[2] | 5916 |
|
---|
[133] | 5917 | case WM_SAVEAPPLICATION:
|
---|
| 5918 | {
|
---|
| 5919 | SWP swp;
|
---|
[2] | 5920 |
|
---|
[133] | 5921 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
---|
[551] | 5922 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) {
|
---|
[1077] | 5923 | WinStoreWindowPos(FM2Str,
|
---|
| 5924 | "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT));
|
---|
| 5925 | if (!fNoSaveState && fSaveState)
|
---|
| 5926 | SaveDirCnrState(hwnd, GetPString(IDS_SHUTDOWNSTATE));
|
---|
[133] | 5927 | }
|
---|
| 5928 | }
|
---|
| 5929 | break;
|
---|
[2] | 5930 |
|
---|
[133] | 5931 | case MM_PORTHOLEINIT:
|
---|
[551] | 5932 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 5933 | case 0:
|
---|
| 5934 | case 1:
|
---|
| 5935 | {
|
---|
[1077] | 5936 | HWND hwndCurrent;
|
---|
| 5937 | ULONG wmsg;
|
---|
[2] | 5938 |
|
---|
[1077] | 5939 | wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
|
---|
| 5940 | hwndCurrent = TopWindow(hwnd, (HWND) 0);
|
---|
| 5941 | PortholeInit((HWND) WinSendMsg(WinWindowFromID(hwndCurrent,
|
---|
| 5942 | FID_CLIENT), wmsg,
|
---|
| 5943 | MPVOID, MPVOID), mp1, mp2);
|
---|
[133] | 5944 | }
|
---|
| 5945 | break;
|
---|
| 5946 | }
|
---|
| 5947 | break;
|
---|
[2] | 5948 |
|
---|
[133] | 5949 | case WM_INITMENU:
|
---|
[551] | 5950 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 5951 | case IDM_CONFIGMENU:
|
---|
[551] | 5952 | SetToggleChecks((HWND) WinQueryWindowULong(hwnd, QWL_USER));
|
---|
[133] | 5953 | break;
|
---|
[2] | 5954 |
|
---|
[133] | 5955 | case IDM_WINDOWSMENU:
|
---|
| 5956 | /*
|
---|
| 5957 | * add child windows of client
|
---|
| 5958 | * and switchlist entries to end of pulldown menu
|
---|
| 5959 | */
|
---|
| 5960 | {
|
---|
[1077] | 5961 | HWND hwndMenu, hwndSubMenu;
|
---|
| 5962 | MENUITEM mi;
|
---|
[2] | 5963 |
|
---|
[1077] | 5964 | hwndMenu = WinQueryWindowULong(hwnd, QWL_USER);
|
---|
| 5965 | memset(&mi, 0, sizeof(mi));
|
---|
| 5966 | mi.iPosition = MIT_END;
|
---|
| 5967 | mi.afStyle = MIS_TEXT;
|
---|
| 5968 | if (!WinSendMsg(hwndMenu, MM_QUERYITEM,
|
---|
| 5969 | MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))
|
---|
| 5970 | break;
|
---|
| 5971 | hwndSubMenu = mi.hwndSubMenu;
|
---|
| 5972 | SetupWinList(hwndSubMenu, hwnd, WinQueryWindow(hwnd, QW_PARENT));
|
---|
[133] | 5973 | }
|
---|
| 5974 | break;
|
---|
[2] | 5975 |
|
---|
[133] | 5976 | default:
|
---|
| 5977 | {
|
---|
[1077] | 5978 | HWND hwndCurrent;
|
---|
[2] | 5979 |
|
---|
[1077] | 5980 | hwndCurrent = TopWindow(hwnd, (HWND) 0);
|
---|
| 5981 | if (hwndCurrent)
|
---|
| 5982 | WinSendMsg(hwndCurrent, UM_INITMENU, mp1, mp2);
|
---|
[133] | 5983 | }
|
---|
| 5984 | break;
|
---|
| 5985 | }
|
---|
| 5986 | break;
|
---|
[2] | 5987 |
|
---|
[133] | 5988 | case UM_ADDTOMENU:
|
---|
[1009] | 5989 | AddToMenu((CHAR *)mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 5990 | FID_MENU));
|
---|
[133] | 5991 | return 0;
|
---|
[2] | 5992 |
|
---|
[133] | 5993 | case UM_FILLCMDLIST:
|
---|
| 5994 | WinSendMsg(hwndCmdlist, LM_DELETEALL, MPVOID, MPVOID);
|
---|
| 5995 | if (!cmdloaded)
|
---|
| 5996 | load_commands();
|
---|
[551] | 5997 | if (cmdhead) {
|
---|
[2] | 5998 |
|
---|
[133] | 5999 | LINKCMDS *info;
|
---|
[2] | 6000 |
|
---|
[133] | 6001 | info = cmdhead;
|
---|
[551] | 6002 | while (info) {
|
---|
[1077] | 6003 | WinSendMsg(hwndCmdlist, LM_INSERTITEM,
|
---|
| 6004 | MPFROM2SHORT(LIT_END, 0), MPFROMP(info->title));
|
---|
| 6005 | info = info->next;
|
---|
[133] | 6006 | }
|
---|
| 6007 | }
|
---|
| 6008 | return 0;
|
---|
[2] | 6009 |
|
---|
[133] | 6010 | case UM_FILLSETUPLIST:
|
---|
[787] | 6011 | fill_setups_list();
|
---|
[133] | 6012 | return 0;
|
---|
[2] | 6013 |
|
---|
[133] | 6014 | case UM_FILLBUTTONLIST:
|
---|
| 6015 | WinSendMsg(hwndButtonlist, LM_DELETEALL, MPVOID, MPVOID);
|
---|
[551] | 6016 | if (fUserComboBox) {
|
---|
[2] | 6017 |
|
---|
[133] | 6018 | BOOL foundit = FALSE, thisone;
|
---|
| 6019 | ULONG ulSearchCount;
|
---|
| 6020 | SHORT sSelect;
|
---|
[847] | 6021 | FILEFINDBUF3 findbuf;
|
---|
[133] | 6022 | HDIR hDir;
|
---|
| 6023 | CHAR *p;
|
---|
[2] | 6024 |
|
---|
[133] | 6025 | DosError(FERR_DISABLEHARDERR);
|
---|
| 6026 | hDir = HDIR_CREATE;
|
---|
[787] | 6027 | ulSearchCount = 1;
|
---|
[847] | 6028 | if (!DosFindFirst("*.TLS", &hDir, FILE_READONLY | FILE_ARCHIVED,
|
---|
[1077] | 6029 | &findbuf, sizeof(FILEFINDBUF3),
|
---|
| 6030 | &ulSearchCount, FIL_STANDARD)) {
|
---|
| 6031 | do {
|
---|
| 6032 | priority_bumped();
|
---|
| 6033 | if (!foundit) {
|
---|
| 6034 | thisone = FALSE;
|
---|
| 6035 | p = strrchr(lasttoolbox, '\\');
|
---|
| 6036 | if (!p)
|
---|
| 6037 | p = lasttoolbox;
|
---|
| 6038 | else
|
---|
| 6039 | p++;
|
---|
| 6040 | if (!stricmp(findbuf.achName, p))
|
---|
| 6041 | thisone = TRUE;
|
---|
| 6042 | }
|
---|
| 6043 | p = strrchr(findbuf.achName, '.');
|
---|
| 6044 | if (p)
|
---|
| 6045 | *p = 0;
|
---|
| 6046 | sSelect = (SHORT) WinSendMsg(hwndButtonlist, LM_INSERTITEM,
|
---|
| 6047 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
| 6048 | MPFROMP(findbuf.achName));
|
---|
| 6049 | if (!foundit && thisone && sSelect >= 0) {
|
---|
| 6050 | WinSendMsg(hwndButtonlist, LM_SELECTITEM,
|
---|
| 6051 | MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE));
|
---|
| 6052 | foundit = TRUE;
|
---|
| 6053 | }
|
---|
| 6054 | }
|
---|
| 6055 | while (!DosFindNext(hDir, &findbuf, sizeof(FILEFINDBUF3),
|
---|
| 6056 | &ulSearchCount));
|
---|
| 6057 | DosFindClose(hDir);
|
---|
| 6058 | priority_bumped();
|
---|
[133] | 6059 | }
|
---|
| 6060 | WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT));
|
---|
| 6061 | }
|
---|
| 6062 | return 0;
|
---|
[2] | 6063 |
|
---|
[133] | 6064 | case UM_FILLUSERLIST:
|
---|
| 6065 | WinSendMsg(hwndUserlist, LM_DELETEALL, MPVOID, MPVOID);
|
---|
[551] | 6066 | if (fUserComboBox) {
|
---|
[260] | 6067 | ULONG ulDriveNum;
|
---|
| 6068 | ULONG ulDriveMap;
|
---|
[133] | 6069 | ULONG ulSearchCount;
|
---|
[847] | 6070 | FILEFINDBUF3 findbuf;
|
---|
[133] | 6071 | HDIR hDir;
|
---|
| 6072 | APIRET rc;
|
---|
[260] | 6073 | LINKDIRS *info;
|
---|
| 6074 | LINKDIRS *temp;
|
---|
[2] | 6075 |
|
---|
[133] | 6076 | if (!loadedudirs)
|
---|
[1077] | 6077 | load_udirs();
|
---|
[133] | 6078 | DosError(FERR_DISABLEHARDERR);
|
---|
| 6079 | DosQCurDisk(&ulDriveNum, &ulDriveMap);
|
---|
| 6080 | info = udirhead;
|
---|
[551] | 6081 | while (info) {
|
---|
[1077] | 6082 | if (IsFullName(info->path) &&
|
---|
| 6083 | !(driveflags[toupper(*info->path) - 'A'] &
|
---|
| 6084 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
---|
| 6085 | DosError(FERR_DISABLEHARDERR);
|
---|
| 6086 | hDir = HDIR_CREATE;
|
---|
| 6087 | ulSearchCount = 1;
|
---|
| 6088 | if (!IsRoot(info->path))
|
---|
| 6089 | rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
|
---|
| 6090 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
| 6091 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
| 6092 | &findbuf, sizeof(FILEFINDBUF3),
|
---|
| 6093 | &ulSearchCount, FIL_STANDARD);
|
---|
| 6094 | else {
|
---|
| 6095 | rc = 0;
|
---|
| 6096 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
| 6097 | }
|
---|
| 6098 | priority_bumped();
|
---|
| 6099 | if (!rc) {
|
---|
| 6100 | if (!IsRoot(info->path))
|
---|
| 6101 | DosFindClose(hDir);
|
---|
| 6102 | if (findbuf.attrFile & FILE_DIRECTORY)
|
---|
| 6103 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
---|
| 6104 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
| 6105 | MPFROMP(info->path));
|
---|
| 6106 | else {
|
---|
| 6107 | temp = info->next;
|
---|
| 6108 | remove_udir(info->path);
|
---|
| 6109 | info = temp;
|
---|
| 6110 | continue;
|
---|
| 6111 | }
|
---|
| 6112 | }
|
---|
| 6113 | else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
|
---|
| 6114 | temp = info->next;
|
---|
| 6115 | remove_udir(info->path);
|
---|
| 6116 | info = temp;
|
---|
| 6117 | continue;
|
---|
| 6118 | }
|
---|
| 6119 | }
|
---|
| 6120 | info = info->next;
|
---|
[133] | 6121 | }
|
---|
| 6122 | info = ldirhead;
|
---|
[551] | 6123 | while (info) {
|
---|
[1077] | 6124 | if (IsFullName(info->path) &&
|
---|
| 6125 | !(driveflags[toupper(*info->path) - 'A'] &
|
---|
| 6126 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
---|
| 6127 | DosError(FERR_DISABLEHARDERR);
|
---|
| 6128 | hDir = HDIR_CREATE;
|
---|
| 6129 | ulSearchCount = 1;
|
---|
| 6130 | if (!IsRoot(info->path))
|
---|
| 6131 | rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
|
---|
| 6132 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
| 6133 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
| 6134 | &findbuf, sizeof(FILEFINDBUF3),
|
---|
| 6135 | &ulSearchCount, FIL_STANDARD);
|
---|
| 6136 | else {
|
---|
| 6137 | rc = 0;
|
---|
| 6138 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
| 6139 | }
|
---|
| 6140 | priority_bumped();
|
---|
| 6141 | if (!rc) {
|
---|
| 6142 | if (!IsRoot(info->path))
|
---|
| 6143 | DosFindClose(hDir);
|
---|
| 6144 | if (findbuf.attrFile & FILE_DIRECTORY)
|
---|
| 6145 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
---|
| 6146 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
| 6147 | MPFROMP(info->path));
|
---|
| 6148 | else {
|
---|
| 6149 | temp = info->next;
|
---|
| 6150 | remove_udir(info->path);
|
---|
| 6151 | info = temp;
|
---|
| 6152 | continue;
|
---|
| 6153 | }
|
---|
| 6154 | }
|
---|
| 6155 | else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
|
---|
| 6156 | temp = info->next;
|
---|
| 6157 | remove_udir(info->path);
|
---|
| 6158 | info = temp;
|
---|
| 6159 | continue;
|
---|
| 6160 | }
|
---|
| 6161 | }
|
---|
| 6162 | info = info->next;
|
---|
[133] | 6163 | }
|
---|
| 6164 | WinSendMsg(hwndUserlist, LM_INSERTITEM,
|
---|
[1077] | 6165 | MPFROM2SHORT(0, 0),
|
---|
| 6166 | MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT)));
|
---|
[133] | 6167 | WinSetWindowText(hwndUserlist, GetPString(IDS_COMMONDIRTEXT));
|
---|
| 6168 | }
|
---|
| 6169 | return 0;
|
---|
[2] | 6170 |
|
---|
[133] | 6171 | case UM_SIZE:
|
---|
| 6172 | if (fAutoTile)
|
---|
| 6173 | TileChildren(hwnd, FALSE);
|
---|
| 6174 | else
|
---|
| 6175 | MoveChildrenAwayFromTree(hwnd);
|
---|
| 6176 | return 0;
|
---|
[2] | 6177 |
|
---|
[133] | 6178 | case WM_SIZE:
|
---|
| 6179 | ResizeChildren(hwnd, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1),
|
---|
[1077] | 6180 | SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
|
---|
[133] | 6181 | break;
|
---|
[2] | 6182 |
|
---|
[133] | 6183 | case WM_ERASEBACKGROUND:
|
---|
| 6184 | WinFillRect((HPS) mp1, (PRECTL) mp2, 0x00d0d0d0);
|
---|
| 6185 | return 0;
|
---|
[2] | 6186 |
|
---|
[133] | 6187 | case WM_PAINT:
|
---|
| 6188 | {
|
---|
| 6189 | HPS hps;
|
---|
| 6190 | RECTL rcl;
|
---|
[2] | 6191 |
|
---|
[133] | 6192 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
---|
[551] | 6193 | if (hps) {
|
---|
[1077] | 6194 | WinQueryWindowRect(hwnd, &rcl);
|
---|
| 6195 | WinFillRect(hps, &rcl, CLR_PALEGRAY);
|
---|
| 6196 | WinEndPaint(hps);
|
---|
[133] | 6197 | }
|
---|
| 6198 | }
|
---|
| 6199 | break;
|
---|
[2] | 6200 |
|
---|
[133] | 6201 | case UM_CONTROL:
|
---|
[551] | 6202 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 6203 | case MAIN_CMDLIST:
|
---|
| 6204 | case MAIN_SETUPLIST:
|
---|
| 6205 | case MAIN_DRIVELIST:
|
---|
| 6206 | case MAIN_USERLIST:
|
---|
| 6207 | case MAIN_BUTTONLIST:
|
---|
[551] | 6208 | switch (SHORT2FROMMP(mp1)) {
|
---|
[133] | 6209 | case CBN_ENTER:
|
---|
[1077] | 6210 | {
|
---|
| 6211 | HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 6212 | SHORT1FROMMP(mp1));
|
---|
| 6213 | CHAR path[CCHMAXPATH];
|
---|
| 6214 | ULONG ul;
|
---|
[2] | 6215 |
|
---|
[1077] | 6216 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 6217 | case MAIN_USERLIST:
|
---|
| 6218 | ul = CCHMAXPATH;
|
---|
| 6219 | break;
|
---|
| 6220 | case MAIN_SETUPLIST:
|
---|
| 6221 | ul = STATE_NAME_MAX_BYTES;
|
---|
| 6222 | break;
|
---|
| 6223 | default:
|
---|
| 6224 | ul = 13; // fixme to not be hardcoded
|
---|
| 6225 | }
|
---|
[787] | 6226 |
|
---|
[1077] | 6227 | SetShiftState();
|
---|
| 6228 | WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path);
|
---|
| 6229 | bstrip(path);
|
---|
| 6230 | if (*path) {
|
---|
| 6231 | if (SHORT1FROMMP(mp1) == MAIN_USERLIST) {
|
---|
| 6232 | if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) {
|
---|
| 6233 | if (!LastDir ||
|
---|
| 6234 | !WinSendMsg(WinQueryWindow(LastDir, QW_PARENT),
|
---|
| 6235 | UM_CONTAINERDIR, MPFROMP(path), MPVOID))
|
---|
[1104] | 6236 | strcpy(path, pFM2SaveDirectory);
|
---|
[1077] | 6237 | if (!PMMkDir(hwnd, path, TRUE)) {
|
---|
| 6238 | WinSetWindowText(hwndUL, GetPString(IDS_COMMONDIRTEXT));
|
---|
| 6239 | break;
|
---|
| 6240 | }
|
---|
| 6241 | }
|
---|
| 6242 | if (!IsFile(path) && !FindDirCnrByName(path, TRUE)) {
|
---|
[2] | 6243 |
|
---|
[1077] | 6244 | HWND hwndDir;
|
---|
[2] | 6245 |
|
---|
[1077] | 6246 | if ((fUserListSwitches &&
|
---|
| 6247 | !(shiftstate & KC_SHIFT)) ||
|
---|
| 6248 | (!fUserListSwitches && (shiftstate & KC_SHIFT))) {
|
---|
| 6249 | hwndDir = FindDirCnr(hwnd);
|
---|
| 6250 | if (hwndDir) {
|
---|
| 6251 | WinSendMsg(LastDir, UM_SETDIR, MPFROMP(path), MPVOID);
|
---|
| 6252 | break;
|
---|
| 6253 | }
|
---|
| 6254 | }
|
---|
| 6255 | OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, path);
|
---|
| 6256 | }
|
---|
| 6257 | }
|
---|
| 6258 | else if (SHORT1FROMMP(mp1) == MAIN_DRIVELIST) {
|
---|
| 6259 | ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree,
|
---|
| 6260 | FID_CLIENT),
|
---|
| 6261 | TREE_CNR), path, FALSE, TRUE);
|
---|
| 6262 | WinSetFocus(HWND_DESKTOP, hwndTree);
|
---|
| 6263 | }
|
---|
| 6264 | else if (SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) {
|
---|
| 6265 | strcat(path, ".TLS");
|
---|
| 6266 | load_tools(path);
|
---|
| 6267 | PrfWriteProfileString(fmprof,
|
---|
| 6268 | FM3Str, "LastToolBox", lasttoolbox);
|
---|
| 6269 | BuildTools(hwndToolback, TRUE);
|
---|
| 6270 | WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT));
|
---|
| 6271 | }
|
---|
| 6272 | else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) {
|
---|
| 6273 | CHAR szKey[80];
|
---|
| 6274 | ULONG size, numsaves = 0;
|
---|
[2] | 6275 |
|
---|
[1077] | 6276 | SetShiftState();
|
---|
| 6277 | size = sizeof(ULONG);
|
---|
| 6278 | sprintf(szKey, "%s.NumDirsLastTime", path); // path is state name
|
---|
| 6279 | if (!PrfQueryProfileData(fmprof,
|
---|
| 6280 | FM3Str,
|
---|
| 6281 | szKey,
|
---|
| 6282 | (PVOID)&numsaves,
|
---|
| 6283 | &size))
|
---|
| 6284 | {
|
---|
| 6285 | if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) {
|
---|
| 6286 | saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
|
---|
| 6287 | GetPString(IDS_WARNINGTEXT),
|
---|
| 6288 | GetPString(IDS_DOESNTEXISTTEXT), path);
|
---|
| 6289 | }
|
---|
| 6290 | else {
|
---|
| 6291 | Win_Error2(hwnd, hwnd, __FILE__, __LINE__,
|
---|
| 6292 | IDS_PRFQUERYPROFILEDATA);
|
---|
| 6293 | }
|
---|
| 6294 | }
|
---|
| 6295 | else {
|
---|
| 6296 | char *pszStateName;
|
---|
| 6297 | if ((shiftstate & KC_SHIFT) == 0)
|
---|
| 6298 | PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));
|
---|
| 6299 | pszStateName = xstrdup(path, pszSrcFile, __LINE__);
|
---|
| 6300 | if (!pszStateName) {
|
---|
| 6301 | // Fall back if out of memory - already complained
|
---|
| 6302 | if ((shiftstate & KC_SHIFT) != 0 || fAutoTile) {
|
---|
| 6303 | // Autotile requested or forced
|
---|
| 6304 | PostMsg(MainObjectHwnd,
|
---|
| 6305 | UM_RESTORE,
|
---|
| 6306 | MPVOID,
|
---|
| 6307 | MPFROMLONG(1)); // Autotile
|
---|
| 6308 | }
|
---|
| 6309 | }
|
---|
| 6310 | else if (!PostMsg(MainObjectHwnd,
|
---|
| 6311 | UM_RESTORE,
|
---|
| 6312 | MPFROMP(pszStateName),
|
---|
| 6313 | MPVOID)) {
|
---|
| 6314 | free(pszStateName);
|
---|
| 6315 | }
|
---|
| 6316 | }
|
---|
| 6317 | }
|
---|
| 6318 | else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) {
|
---|
[2] | 6319 |
|
---|
[1077] | 6320 | SHORT sSelect;
|
---|
[2] | 6321 |
|
---|
[1077] | 6322 | sSelect = (SHORT) WinSendMsg(hwndCmdlist,
|
---|
| 6323 | LM_QUERYSELECTION,
|
---|
| 6324 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
| 6325 | if (sSelect >= 0)
|
---|
| 6326 | WinPostMsg(hwnd,
|
---|
| 6327 | WM_COMMAND,
|
---|
| 6328 | MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0),
|
---|
| 6329 | MPVOID);
|
---|
| 6330 | WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));
|
---|
| 6331 | }
|
---|
| 6332 | }
|
---|
| 6333 | }
|
---|
| 6334 | break;
|
---|
[2] | 6335 |
|
---|
[133] | 6336 | default:
|
---|
[1077] | 6337 | break;
|
---|
[133] | 6338 | }
|
---|
| 6339 | break;
|
---|
[2] | 6340 |
|
---|
[133] | 6341 | default:
|
---|
| 6342 | break;
|
---|
| 6343 | }
|
---|
| 6344 | return 0;
|
---|
[2] | 6345 |
|
---|
[133] | 6346 | case WM_HELP:
|
---|
[551] | 6347 | WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
|
---|
[133] | 6348 | break;
|
---|
[2] | 6349 |
|
---|
[133] | 6350 | case UM_COMMAND:
|
---|
| 6351 | case WM_COMMAND:
|
---|
[2] | 6352 |
|
---|
[133] | 6353 | return MainWMCommand(hwnd, msg, mp1, mp2);
|
---|
[2] | 6354 |
|
---|
[133] | 6355 | case WM_CLOSE:
|
---|
| 6356 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 6357 | WM_SYSCOMMAND, MPFROM2SHORT(SC_RESTORE, 0), MPVOID);
|
---|
[551] | 6358 | WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
---|
[133] | 6359 | fAmClosing = TRUE;
|
---|
| 6360 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[1077] | 6361 | WM_SYSCOMMAND, MPFROM2SHORT(SC_MINIMIZE, 0), MPVOID);
|
---|
[551] | 6362 | if (CloseChildren(hwnd)) {
|
---|
[133] | 6363 | fAmClosing = FALSE;
|
---|
| 6364 | if (fAutoTile)
|
---|
[1077] | 6365 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TILE, 0), MPVOID);
|
---|
[133] | 6366 | return 0;
|
---|
| 6367 | }
|
---|
[551] | 6368 | if (hwndTree) {
|
---|
| 6369 | if (!PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID))
|
---|
[1077] | 6370 | WinSendMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID);
|
---|
[133] | 6371 | }
|
---|
[771] | 6372 | DosSleep(1);
|
---|
[930] | 6373 | return 0; // Hold off WM_QUIT
|
---|
[2] | 6374 |
|
---|
[133] | 6375 | case UM_CLOSE:
|
---|
| 6376 | HideNote();
|
---|
| 6377 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
---|
| 6378 | return 0;
|
---|
[2] | 6379 |
|
---|
[133] | 6380 | case UM_RESTORE:
|
---|
| 6381 | {
|
---|
[941] | 6382 | // Try to restore saved shutdown state
|
---|
[961] | 6383 | char *pszDefaultStateName = xstrdup(GetPString(IDS_SHUTDOWNSTATE),
|
---|
[1077] | 6384 | pszSrcFile, __LINE__);
|
---|
[941] | 6385 | if (pszDefaultStateName) {
|
---|
[1077] | 6386 | if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID))
|
---|
| 6387 | // 05 Feb 08 SHL fixme to complain?
|
---|
| 6388 | free(pszDefaultStateName);
|
---|
[133] | 6389 | }
|
---|
| 6390 | }
|
---|
| 6391 | return 0;
|
---|
[2] | 6392 |
|
---|
[133] | 6393 | case UM_SETDIR:
|
---|
[352] | 6394 | /* mp1 == name of directory to open */
|
---|
| 6395 | if (mp1)
|
---|
[551] | 6396 | return MRFROMLONG(OpenDirCnr((HWND) 0,
|
---|
[1077] | 6397 | hwndMain,
|
---|
| 6398 | hwndTree, (BOOL) mp2, (char *)mp1));
|
---|
[133] | 6399 | return 0;
|
---|
[2] | 6400 |
|
---|
[133] | 6401 | case WM_DESTROY:
|
---|
[551] | 6402 | hwndMain = (HWND) 0;
|
---|
| 6403 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
| 6404 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
---|
[1077] | 6405 | # ifdef FORTIFY
|
---|
| 6406 | free_commands();
|
---|
| 6407 | free_associations();
|
---|
| 6408 | free_udirs();
|
---|
| 6409 | free_ldir();
|
---|
| 6410 | free_archivers();
|
---|
| 6411 | free_tools();
|
---|
| 6412 | free_setups();
|
---|
| 6413 | Fortify_LeaveScope();
|
---|
| 6414 | # endif
|
---|
[133] | 6415 | break;
|
---|
| 6416 | }
|
---|
| 6417 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 6418 | }
|
---|
[787] | 6419 |
|
---|
[1060] | 6420 | VOID DeletePresParams(CHAR * pchKeyroot)
|
---|
| 6421 | // This code assumes that pchKeyroot points to a buffer large enough to
|
---|
| 6422 | // hold the full INI key: The state name.dircnr-number.PPName. The
|
---|
| 6423 | // PPNames are listed below.
|
---|
| 6424 | {
|
---|
| 6425 | PSZ apszPPNames[] =
|
---|
| 6426 | {
|
---|
| 6427 | "Backgroundcolor",
|
---|
| 6428 | "Foregroundcolor",
|
---|
| 6429 | "Hilitebackgroundcolor",
|
---|
| 6430 | "Hiliteforegroundcolor",
|
---|
| 6431 | "Bordercolor",
|
---|
| 6432 | "Fontnamesize"
|
---|
| 6433 | };
|
---|
| 6434 |
|
---|
| 6435 | ULONG ulSize, ulArraySize = sizeof(apszPPNames) / sizeof(PSZ), x;
|
---|
| 6436 | CHAR * eos = pchKeyroot + strlen(pchKeyroot);
|
---|
| 6437 |
|
---|
| 6438 | for (x = 0; x < ulArraySize; x++)
|
---|
| 6439 | {
|
---|
| 6440 | strcpy(eos, apszPPNames[x]);
|
---|
| 6441 | if (PrfQueryProfileSize(fmprof, appname, pchKeyroot, &ulSize) && ulSize)
|
---|
| 6442 | {
|
---|
| 6443 | PrfWriteProfileData(fmprof, appname, pchKeyroot, NULL, ulSize);
|
---|
| 6444 | }
|
---|
| 6445 | }
|
---|
| 6446 | }
|
---|
| 6447 |
|
---|
[787] | 6448 | #pragma alloc_text(MISC8,SetToggleChecks,FindDirCnrByName,TopWindow)
|
---|
| 6449 | #pragma alloc_text(MISC8,TopWindowName,CountDirCnrs)
|
---|
| 6450 | #pragma alloc_text(MAINWND,AdjustSizeOfClient,FillClient,ChildButtonProc)
|
---|
| 6451 | #pragma alloc_text(MAINWND,ToolBackProc,StatusProc)
|
---|
| 6452 | #pragma alloc_text(MAINWND,MoveChildrenAwayFromTree,ArrangeIcons,NextChild)
|
---|
| 6453 | #pragma alloc_text(MAINWND,ChildFrameButtonProc)
|
---|
| 6454 | #pragma alloc_text(MAINWND2,CloseChildren,CountChildren,GetNextWindowPos)
|
---|
| 6455 | #pragma alloc_text(MAINWND2,CascadeChildren,TileChildren,ResizeChildren)
|
---|
| 6456 | #pragma alloc_text(MAINWND2,MinResChildren,MainFrameWndProc,MainWndProc)
|
---|
| 6457 | #pragma alloc_text(MAINWND2,DropDownListProc)
|
---|
| 6458 | #pragma alloc_text(MAINWND3,RestoreDirCnrState,SaveDirCnrState)
|
---|
| 6459 | #pragma alloc_text(MAINWND3,CloseDirCnrChildren,TransformSwp)
|
---|
| 6460 | #pragma alloc_text(MAINWND3,ResizeTools,BuildTools,CommandLineProc)
|
---|
| 6461 | #pragma alloc_text(MAINWND4,DriveProc,DriveBackProc,BuildDriveBarButtons,ResizeDrives)
|
---|
| 6462 | #pragma alloc_text(MAINWND4,LEDProc,IdealButtonProc)
|
---|
| 6463 | #pragma alloc_text(MAINWND5,MainWMOnce)
|
---|
| 6464 | #pragma alloc_text(MAINWND6,MainWMCommand)
|
---|
| 6465 | #pragma alloc_text(BUBBLE,MakeBubble,BubbleProc,BubbleHelp)
|
---|
| 6466 | #pragma alloc_text(MAINOBJ,MainObjectWndProc,MakeMainObjWin)
|
---|
| 6467 |
|
---|