[133] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: mainwnd2.c 1904 2024-06-01 19:03:22Z stevenhl $
|
---|
| 5 |
|
---|
[178] | 6 | fm/4 main window
|
---|
[133] | 7 |
|
---|
| 8 | Copyright (c) 1993-98 M. Kimes
|
---|
[1498] | 9 | Copyright (c) 2005, 2010 Steven H. Levine
|
---|
[133] | 10 |
|
---|
| 11 | 23 May 05 SHL Use datamin.h
|
---|
[178] | 12 | 26 May 05 SHL Comments and localize code
|
---|
[246] | 13 | 06 Aug 05 SHL Renames
|
---|
[299] | 14 | 02 Jan 06 SHL Use QWL_USER more
|
---|
| 15 | 02 Jan 06 SHL Map IDM_WINDOWDLG to match IBM_TWODIRS
|
---|
[352] | 16 | 17 Jul 06 SHL Use Runtime_Error
|
---|
[593] | 17 | 30 Mar 07 GKY Remove GetPString for window class names
|
---|
[672] | 18 | 12 May 07 SHL Pass ulItemsToUnHilite to UnHilite
|
---|
[775] | 19 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
|
---|
[773] | 20 | 07 Aug 07 SHL Use BldQuotedFileName
|
---|
[793] | 21 | 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
|
---|
[917] | 22 | 10 Jan 08 SHL Sync with CfgDlgProc mods
|
---|
[940] | 23 | 19 Jan 08 GKY Rework Utilities menu
|
---|
[953] | 24 | 14 Feb 08 SHL Rework to support settings menu conditional cascade
|
---|
[985] | 25 | 29 Feb 08 GKY Use xfree where appropriate
|
---|
[1128] | 26 | 27 Aug 08 JBS Ticket 259: Support saving/restoring toolbars with states
|
---|
[1140] | 27 | 01 Sep 08 GKY Add bmps for default toolbars
|
---|
[1335] | 28 | 10 Dec 08 SHL Integrate exception handler support
|
---|
[1375] | 29 | 03 Jan 09 GKY Check for system that is protectonly to gray out Dos/Win command lines and prevent
|
---|
[1777] | 30 | Dos/Win programs from being inserted into the execute dialog with message why.
|
---|
[1437] | 31 | 21 Jun 09 GKY Added drive letter to bitmap buttons in drive bar; Eliminate static drive
|
---|
[1777] | 32 | letter windows; Use button ID to identify drive letter for processing.
|
---|
[1444] | 33 | 22 Jul 09 GKY Code changes to use semaphores to serialize drive scanning
|
---|
[1454] | 34 | 12 Sep 09 GKY Add FM3.INI User ini and system ini to submenu for view ini
|
---|
[1482] | 35 | 13 Dec 09 GKY Fixed separate paramenters. Please note that appname should be used in
|
---|
[1777] | 36 | profile calls for user settings that work and are setable in more than one
|
---|
| 37 | miniapp; FM3Str should be used for setting only relavent to FM/2 or that
|
---|
| 38 | aren't user settable; realappname should be used for setting applicable to
|
---|
| 39 | one or more miniapp but not to FM/2
|
---|
[1498] | 40 | 17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
|
---|
[1506] | 41 | 11 Apr 10 GKY Fix drive tree rescan failure and program hang caused by event sem
|
---|
[1777] | 42 | never being posted
|
---|
[1670] | 43 | 12 Aug 12 GKY Allow for selection of include subdirectories or a list file on initial startup of compare dirs
|
---|
[1782] | 44 | 28 Jun 14 GKY Fix errors identified with CPPCheck;
|
---|
[672] | 45 |
|
---|
[133] | 46 | ***********************************************************************/
|
---|
| 47 |
|
---|
[907] | 48 | #include <stdlib.h>
|
---|
| 49 | #include <string.h>
|
---|
| 50 | #include <share.h>
|
---|
| 51 |
|
---|
[2] | 52 | #define INCL_DOS
|
---|
| 53 | #define INCL_WIN
|
---|
| 54 | #define INCL_GPI
|
---|
[841] | 55 | #define INCL_LONGLONG
|
---|
[2] | 56 |
|
---|
[1186] | 57 | #include "fm3dll.h"
|
---|
[1224] | 58 | #include "fm3dll2.h" // #define's for UM_*, control id's, etc.
|
---|
[1210] | 59 | #include "killproc.h" // Data declaration(s)
|
---|
| 60 | #include "grep.h" // Data declaration(s)
|
---|
| 61 | #include "autoview.h" // Data declaration(s)
|
---|
| 62 | #include "dircnrs.h" // Data declaration(s)
|
---|
| 63 | #include "worker.h" // Data declaration(s)
|
---|
| 64 | #include "init.h" // Data declaration(s)
|
---|
[2] | 65 | #include "fm3dlg.h"
|
---|
| 66 | #include "fm3str.h"
|
---|
| 67 | #include "tools.h"
|
---|
[133] | 68 | #include "datamin.h"
|
---|
[907] | 69 | #include "comp.h" // COMPARE
|
---|
[989] | 70 | #include "pathutil.h" // BldQuotedFileName
|
---|
[907] | 71 | #include "errutil.h" // Dos_Error...
|
---|
| 72 | #include "strutil.h" // GetPString
|
---|
[953] | 73 | #include "notebook.h" // CfgDlgProc
|
---|
[989] | 74 | #include "command.h" // RunCommand
|
---|
[1161] | 75 | #include "misc.h" // BoxWindow, FixSwitchList, SetConditionalCascade
|
---|
| 76 | // SetSysMenu
|
---|
| 77 | #include "mainwnd.h" // CloseChildren, MainWMCommand, MakeMainObjWin, ResizeDrives
|
---|
[1777] | 78 | // TopWindow
|
---|
[1161] | 79 | #include "common.h" // CommonCreateMainChildren, CommonMainWndProc
|
---|
| 80 | #include "notify.h" // HideNote
|
---|
| 81 | #include "mainwnd2.h"
|
---|
| 82 | #include "remap.h" // RemapDlgProc
|
---|
| 83 | #include "treecnr.h" // StartTreeCnr
|
---|
| 84 | #include "walkem.h" // WalkTwoCmpDlgProc, WalkTwoSetDlgProc
|
---|
| 85 | #include "dirs.h" // switch_to
|
---|
[1186] | 86 | #include "filter.h" // Filter
|
---|
| 87 | #include "collect.h" // StartCollector
|
---|
| 88 | #include "select.h" // UnHilite
|
---|
| 89 | #include "valid.h" // MakeValidDir
|
---|
| 90 | #include "systemf.h" // runemf2
|
---|
| 91 | #include "wrappers.h" // xfree
|
---|
[1039] | 92 | #include "fortify.h"
|
---|
[1335] | 93 | #include "excputil.h" // xbeginthread
|
---|
[2] | 94 |
|
---|
[133] | 95 | typedef struct
|
---|
| 96 | {
|
---|
| 97 | USHORT size;
|
---|
| 98 | USHORT dummy;
|
---|
| 99 | HWND hwndDir1;
|
---|
| 100 | HWND hwndDir2;
|
---|
| 101 | HWND hwndCurr;
|
---|
| 102 | HWND hwndLastDir;
|
---|
| 103 | HWND hwndMax;
|
---|
[551] | 104 | }
|
---|
| 105 | PERSON1DATA;
|
---|
[2] | 106 |
|
---|
[1210] | 107 | // Data definitions
|
---|
[352] | 108 | static PSZ pszSrcFile = __FILE__;
|
---|
[1210] | 109 | static ULONG TreeWidth;
|
---|
[352] | 110 |
|
---|
[1210] | 111 | #pragma data_seg(GLOBAL1)
|
---|
| 112 | PFNWP PFNWPFrame;
|
---|
| 113 |
|
---|
| 114 | #pragma data_seg(GLOBAL2)
|
---|
| 115 | CHAR realappname[12];
|
---|
| 116 |
|
---|
[551] | 117 | static MRESULT EXPENTRY MainFrameWndProc2(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
| 118 | MPARAM mp2)
|
---|
[133] | 119 | {
|
---|
[299] | 120 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
[2] | 121 |
|
---|
[551] | 122 | switch (msg) {
|
---|
[133] | 123 | case WM_ADJUSTWINDOWPOS:
|
---|
| 124 | {
|
---|
| 125 | SWP *pswp;
|
---|
[2] | 126 |
|
---|
[133] | 127 | pswp = (SWP *) mp1;
|
---|
[551] | 128 | if (pswp->fl & (SWP_SHOW | SWP_RESTORE))
|
---|
[133] | 129 | PostMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_SIZE, MPVOID, MPVOID);
|
---|
[551] | 130 | if (fDataMin && !fAmClosing) {
|
---|
| 131 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
---|
[2] | 132 |
|
---|
[133] | 133 | SWP swp;
|
---|
[2] | 134 |
|
---|
[133] | 135 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 136 | PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID);
|
---|
| 137 | HideNote();
|
---|
| 138 | }
|
---|
[551] | 139 | else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) {
|
---|
[133] | 140 | if (DataHwnd)
|
---|
| 141 | PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 142 | }
|
---|
[2] | 143 | }
|
---|
[551] | 144 | if (!fAmClosing) {
|
---|
| 145 | if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
[133] | 146 | HideNote();
|
---|
| 147 | }
|
---|
| 148 | }
|
---|
| 149 | break;
|
---|
[2] | 150 |
|
---|
[133] | 151 | case UM_FOCUSME:
|
---|
| 152 | CreateDataBar(HWND_DESKTOP, (ULONG) mp1);
|
---|
| 153 | return 0;
|
---|
[2] | 154 |
|
---|
[133] | 155 | case WM_BUTTON1UP:
|
---|
| 156 | case WM_BUTTON2UP:
|
---|
| 157 | case WM_BUTTON3UP:
|
---|
| 158 | case WM_MOUSEMOVE:
|
---|
| 159 | case WM_CHORD:
|
---|
| 160 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 161 | break;
|
---|
[2] | 162 |
|
---|
[133] | 163 | case WM_CHAR:
|
---|
| 164 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 165 | break;
|
---|
[2] | 166 |
|
---|
[133] | 167 | case WM_CONTROL:
|
---|
[551] | 168 | return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_CONTROL, mp1,
|
---|
| 169 | mp2);
|
---|
[2] | 170 |
|
---|
[133] | 171 | case WM_COMMAND:
|
---|
| 172 | return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
|
---|
[2] | 173 |
|
---|
[133] | 174 | case WM_CALCFRAMERECT:
|
---|
| 175 | {
|
---|
| 176 | MRESULT mr;
|
---|
| 177 | PRECTL prectl;
|
---|
| 178 | LONG sheight = 20, bheight = 20;
|
---|
[2] | 179 |
|
---|
[133] | 180 | mr = (oldproc) ? oldproc(hwnd, msg, mp1, mp2) :
|
---|
| 181 | PFNWPFrame(hwnd, msg, mp1, mp2);
|
---|
[2] | 182 |
|
---|
[1673] | 183 | /**
|
---|
[133] | 184 | * Calculate the position of the client rectangle.
|
---|
[773] | 185 | * Otherwise, we'll see a lot of redraw when we move the
|
---|
[133] | 186 | * client during WM_FORMATFRAME.
|
---|
| 187 | */
|
---|
[2] | 188 |
|
---|
[551] | 189 | if (mr && mp2) {
|
---|
[133] | 190 | prectl = (PRECTL) mp1;
|
---|
[551] | 191 | if (prectl->yBottom != prectl->yTop) {
|
---|
[133] | 192 | {
|
---|
| 193 | HPS hps;
|
---|
| 194 | POINTL aptl[TXTBOX_COUNT];
|
---|
[2] | 195 |
|
---|
[133] | 196 | hps = WinGetPS(hwndStatus);
|
---|
| 197 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
| 198 | WinReleasePS(hps);
|
---|
| 199 | sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 200 | hps = WinGetPS(hwndName);
|
---|
| 201 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
| 202 | WinReleasePS(hps);
|
---|
| 203 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 204 | }
|
---|
[551] | 205 | prectl->yBottom += (sheight + 4);
|
---|
| 206 | prectl->yTop -= (sheight + 4);
|
---|
| 207 | prectl->yBottom += (bheight + 4);
|
---|
| 208 | prectl->yTop -= (bheight + 4);
|
---|
| 209 | if (fToolbar) {
|
---|
[133] | 210 | if (!fTextTools)
|
---|
[551] | 211 | prectl->yTop -= ((fToolTitles) ? 50 : 40);
|
---|
[133] | 212 | else
|
---|
[551] | 213 | prectl->yTop -= 32;
|
---|
[133] | 214 | }
|
---|
| 215 | ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES),
|
---|
[551] | 216 | ((prectl->xRight -
|
---|
[133] | 217 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
| 218 | SV_CYSIZEBORDER) * 2)) - 4));
|
---|
[1436] | 219 | prectl->yTop -= (16 * (DriveLines * 22));
|
---|
[551] | 220 | prectl->yTop -= 2;
|
---|
| 221 | if (fAutoView) {
|
---|
[133] | 222 | AutoviewHeight = min(AutoviewHeight,
|
---|
[551] | 223 | (prectl->yTop - prectl->yBottom) - 116);
|
---|
[1436] | 224 | AutoviewHeight = max(AutoviewHeight, 44);
|
---|
[551] | 225 | prectl->yBottom += (AutoviewHeight + 6);
|
---|
[133] | 226 | }
|
---|
| 227 | }
|
---|
[2] | 228 | }
|
---|
[133] | 229 | return mr;
|
---|
| 230 | }
|
---|
[2] | 231 |
|
---|
[133] | 232 | case WM_FORMATFRAME:
|
---|
| 233 | {
|
---|
| 234 | SHORT sCount, soldCount;
|
---|
| 235 | PSWP pswp, pswpClient, pswpNew;
|
---|
| 236 | SWP swpClient;
|
---|
[1438] | 237 | ULONG theight = 48L, dheight = DRIVE_BUTTON_HEIGHT, bheight = 20, sheight = 20;
|
---|
[133] | 238 | LONG width, lastx;
|
---|
[2] | 239 |
|
---|
[133] | 240 | sCount = (SHORT) ((oldproc) ? oldproc(hwnd, msg, mp1, mp2) :
|
---|
| 241 | PFNWPFrame(hwnd, msg, mp1, mp2));
|
---|
| 242 | soldCount = sCount;
|
---|
[1673] | 243 | /**
|
---|
[133] | 244 | * Reformat the frame to "squeeze" the client
|
---|
| 245 | * and make room for status window sibling beneath
|
---|
| 246 | * and toolbar above (if toolbar's on) and userlists
|
---|
| 247 | * (if userlists are on).
|
---|
| 248 | */
|
---|
[2] | 249 |
|
---|
[133] | 250 | pswp = (PSWP) mp1;
|
---|
| 251 | {
|
---|
| 252 | SHORT x;
|
---|
[2] | 253 |
|
---|
[551] | 254 | for (x = 0; x < sCount; x++) {
|
---|
| 255 | if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {
|
---|
[133] | 256 | pswpClient = pswp;
|
---|
| 257 | break;
|
---|
| 258 | }
|
---|
| 259 | pswp++;
|
---|
| 260 | }
|
---|
| 261 | }
|
---|
[2] | 262 |
|
---|
[133] | 263 | {
|
---|
| 264 | HPS hps;
|
---|
| 265 | POINTL aptl[TXTBOX_COUNT];
|
---|
[2] | 266 |
|
---|
[133] | 267 | hps = WinGetPS(hwndStatus);
|
---|
| 268 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
| 269 | WinReleasePS(hps);
|
---|
| 270 | bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 271 | hps = WinGetPS(hwndName);
|
---|
| 272 | GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
|
---|
| 273 | WinReleasePS(hps);
|
---|
| 274 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 275 | }
|
---|
[2] | 276 |
|
---|
[133] | 277 | pswpNew = (PSWP) mp1 + soldCount;
|
---|
| 278 | *pswpNew = *pswpClient;
|
---|
| 279 | swpClient = *pswpClient;
|
---|
[551] | 280 | pswpNew->hwnd = hwndStatus;
|
---|
| 281 | pswpNew->x = swpClient.x + 3;
|
---|
| 282 | pswpNew->y = swpClient.y + 2;
|
---|
[133] | 283 | width = (swpClient.cx / 2) - 6;
|
---|
| 284 | width = max(width, 10);
|
---|
[551] | 285 | pswpNew->cx = width - 6;
|
---|
| 286 | pswpNew->cy = sheight;
|
---|
| 287 | pswpClient->y = pswpNew->y + pswpNew->cy + 3;
|
---|
| 288 | pswpClient->cy = (swpClient.cy - pswpNew->cy) - 3;
|
---|
[133] | 289 | sCount++;
|
---|
[2] | 290 |
|
---|
[133] | 291 | pswpNew = (PSWP) mp1 + (soldCount + 1);
|
---|
| 292 | *pswpNew = *pswpClient;
|
---|
[551] | 293 | pswpNew->hwnd = hwndStatus2;
|
---|
| 294 | pswpNew->x = width + 8;
|
---|
| 295 | pswpNew->y = swpClient.y + 2;
|
---|
| 296 | pswpNew->cx = width - 6;
|
---|
| 297 | pswpNew->cy = sheight;
|
---|
[133] | 298 | sCount++;
|
---|
[2] | 299 |
|
---|
[551] | 300 | if (fToolbar) {
|
---|
[133] | 301 | if (fTextTools)
|
---|
| 302 | theight = 32L;
|
---|
| 303 | else if (!fToolTitles)
|
---|
| 304 | theight = 40L;
|
---|
| 305 | pswpNew = (PSWP) mp1 + (soldCount + 2);
|
---|
| 306 | *pswpNew = *pswpClient;
|
---|
[551] | 307 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS);
|
---|
| 308 | pswpNew->x = swpClient.x + 2;
|
---|
| 309 | pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2);
|
---|
| 310 | pswpNew->cx = swpClient.cx - 4;
|
---|
| 311 | pswpNew->cy = theight - 4;
|
---|
| 312 | pswpClient->cy -= theight;
|
---|
[133] | 313 | sCount++;
|
---|
| 314 | }
|
---|
| 315 | else
|
---|
| 316 | WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE);
|
---|
[2] | 317 |
|
---|
[551] | 318 | ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4);
|
---|
[133] | 319 | pswpNew = (PSWP) mp1 + (soldCount + 2 + (fToolbar != FALSE));
|
---|
| 320 | *pswpNew = *pswpClient;
|
---|
[551] | 321 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES);
|
---|
| 322 | pswpNew->x = swpClient.x + 2;
|
---|
[1438] | 323 | dheight += ((dheight) * DriveLines);
|
---|
| 324 | pswpNew->y = (swpClient.y + swpClient.cy) - (dheight);
|
---|
[133] | 325 | if (fToolbar)
|
---|
[551] | 326 | pswpNew->y -= theight;
|
---|
| 327 | pswpNew->cx = swpClient.cx - 4;
|
---|
[1438] | 328 | pswpNew->cy = dheight;
|
---|
[551] | 329 | pswpClient->cy -= dheight;
|
---|
| 330 | pswpClient->cy -= 2;
|
---|
[133] | 331 | sCount++;
|
---|
[2] | 332 |
|
---|
[551] | 333 | if (fAutoView) {
|
---|
[133] | 334 | pswpNew = (PSWP) mp1 + (soldCount + 3 + (fToolbar != FALSE));
|
---|
| 335 | *pswpNew = *pswpClient;
|
---|
[551] | 336 | pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview;
|
---|
| 337 | pswpNew->x = pswpClient->x + 3;
|
---|
| 338 | pswpNew->y = pswpClient->y + 3;
|
---|
[133] | 339 | if (fMoreButtons)
|
---|
[551] | 340 | pswpNew->y += (bheight + 4);
|
---|
| 341 | pswpNew->cx = pswpClient->cx - 6;
|
---|
| 342 | AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116);
|
---|
[1436] | 343 | AutoviewHeight = max(AutoviewHeight, 44);
|
---|
[551] | 344 | pswpNew->cy = AutoviewHeight;
|
---|
| 345 | pswpClient->y += (AutoviewHeight + 6);
|
---|
| 346 | pswpClient->cy -= (AutoviewHeight + 6);
|
---|
[133] | 347 | sCount++;
|
---|
| 348 | WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE);
|
---|
| 349 | }
|
---|
[551] | 350 | else {
|
---|
[133] | 351 | WinShowWindow(hwndAutoview, FALSE);
|
---|
| 352 | WinShowWindow(hwndAutoMLE, FALSE);
|
---|
| 353 | }
|
---|
[2] | 354 |
|
---|
[133] | 355 | pswpNew = (PSWP) mp1 + (soldCount + 3 + (fToolbar != FALSE) +
|
---|
| 356 | (fAutoView != FALSE));
|
---|
| 357 | *pswpNew = *pswpClient;
|
---|
[551] | 358 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LED);
|
---|
| 359 | pswpNew->x = (swpClient.x + swpClient.cx) - 12;
|
---|
| 360 | pswpNew->y = swpClient.y;
|
---|
| 361 | pswpNew->cx = 12;
|
---|
| 362 | pswpNew->cy = 12;
|
---|
[133] | 363 | sCount++;
|
---|
[2] | 364 |
|
---|
[133] | 365 | pswpNew = (PSWP) mp1 + (soldCount + 4 + (fToolbar != FALSE) +
|
---|
| 366 | (fAutoView != FALSE));
|
---|
| 367 | *pswpNew = *pswpClient;
|
---|
[551] | 368 | pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LEDHDR);
|
---|
| 369 | pswpNew->x = (swpClient.x + swpClient.cx) - 12;
|
---|
| 370 | pswpNew->y = swpClient.y + 12;
|
---|
| 371 | pswpNew->cx = 12;
|
---|
| 372 | pswpNew->cy = sheight - 8;
|
---|
[133] | 373 | sCount++;
|
---|
[2] | 374 |
|
---|
[133] | 375 | pswpNew = (PSWP) mp1 + (soldCount + 5 + (fToolbar != FALSE) +
|
---|
| 376 | (fAutoView != FALSE));
|
---|
| 377 | *pswpNew = *pswpClient;
|
---|
[551] | 378 | pswpNew->hwnd = hwndName;
|
---|
| 379 | pswpNew->x = swpClient.x + 3;
|
---|
| 380 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
| 381 | pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3;
|
---|
| 382 | lastx = pswpNew->x + pswpNew->cx;
|
---|
| 383 | pswpNew->cy = bheight;
|
---|
| 384 | pswpClient->y += (bheight + 4);
|
---|
| 385 | pswpClient->cy -= (bheight + 4);
|
---|
[133] | 386 | sCount++;
|
---|
[2] | 387 |
|
---|
[133] | 388 | pswpNew = (PSWP) mp1 + (soldCount + 6 + (fToolbar != FALSE) +
|
---|
| 389 | (fAutoView != FALSE));
|
---|
| 390 | *pswpNew = *pswpClient;
|
---|
[551] | 391 | pswpNew->hwnd = hwndDate;
|
---|
| 392 | pswpNew->x = lastx + 3;
|
---|
| 393 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
| 394 | pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3;
|
---|
| 395 | lastx = pswpNew->x + pswpNew->cx;
|
---|
| 396 | pswpNew->cy = bheight;
|
---|
[133] | 397 | sCount++;
|
---|
[2] | 398 |
|
---|
[133] | 399 | pswpNew = (PSWP) mp1 + (soldCount + 7 + (fToolbar != FALSE) +
|
---|
| 400 | (fAutoView != FALSE));
|
---|
| 401 | *pswpNew = *pswpClient;
|
---|
[551] | 402 | pswpNew->hwnd = hwndAttr;
|
---|
| 403 | pswpNew->x = lastx + 3;
|
---|
| 404 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
| 405 | pswpNew->cx = (swpClient.cx - pswpNew->x) - 1;
|
---|
| 406 | pswpNew->cy = bheight;
|
---|
[133] | 407 | sCount++;
|
---|
[2] | 408 |
|
---|
[133] | 409 | return MRFROMSHORT(sCount);
|
---|
| 410 | }
|
---|
[2] | 411 |
|
---|
[133] | 412 | case WM_QUERYFRAMECTLCOUNT:
|
---|
| 413 | {
|
---|
| 414 | SHORT sCount;
|
---|
[2] | 415 |
|
---|
[133] | 416 | sCount = (SHORT) ((oldproc) ? oldproc(hwnd, msg, mp1, mp2) :
|
---|
| 417 | PFNWPFrame(hwnd, msg, mp1, mp2));
|
---|
| 418 | sCount += 8;
|
---|
| 419 | if (fToolbar)
|
---|
| 420 | sCount++;
|
---|
| 421 | if (fAutoView)
|
---|
| 422 | sCount++;
|
---|
| 423 | return MRFROMSHORT(sCount);
|
---|
| 424 | }
|
---|
[2] | 425 |
|
---|
[133] | 426 | case WM_CLOSE:
|
---|
| 427 | WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
|
---|
| 428 | return 0;
|
---|
[2] | 429 | }
|
---|
[133] | 430 | return (oldproc) ? oldproc(hwnd, msg, mp1, mp2) :
|
---|
| 431 | PFNWPFrame(hwnd, msg, mp1, mp2);
|
---|
[2] | 432 | }
|
---|
| 433 |
|
---|
[551] | 434 | static MRESULT EXPENTRY MainWMCommand2(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
| 435 | MPARAM mp2)
|
---|
[133] | 436 | {
|
---|
[2] | 437 | PERSON1DATA *pd;
|
---|
[1778] | 438 | BOOL yes;
|
---|
[2] | 439 |
|
---|
| 440 | SetShiftState();
|
---|
[551] | 441 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 442 | case IDM_TOAUTOMLE:
|
---|
| 443 | case IDM_CLI:
|
---|
| 444 | case IDM_CREATETOOL:
|
---|
| 445 | case IDM_ABOUT:
|
---|
| 446 | case IDM_WINFULLSCREEN:
|
---|
| 447 | case IDM_DOSCOMMANDLINE:
|
---|
| 448 | case IDM_INIVIEWER:
|
---|
[1454] | 449 | case IDM_INIVIEWERFM2:
|
---|
| 450 | case IDM_INIVIEWERSYS:
|
---|
[133] | 451 | case IDM_EDITASSOC:
|
---|
| 452 | case IDM_COMMANDLINE:
|
---|
| 453 | case IDM_KILLPROC:
|
---|
| 454 | case IDM_TOOLBAR:
|
---|
| 455 | case IDM_TEXTTOOLS:
|
---|
| 456 | case IDM_TOOLTITLES:
|
---|
| 457 | case IDM_TOOLLEFT:
|
---|
| 458 | case IDM_TOOLRIGHT:
|
---|
| 459 | case IDM_AUTOVIEWCOMMENTS:
|
---|
| 460 | case IDM_AUTOVIEWFILE:
|
---|
| 461 | case IDM_AUTOVIEW:
|
---|
[1777] | 462 | case IDM_CONFIRMDELETE: // 2014-05-17 SHL
|
---|
| 463 | case IDM_TOGGLEDRAGDIALOG: // 2014-05-15 SHL
|
---|
[133] | 464 | case IDM_HIDENOTEWND:
|
---|
| 465 | case IDM_SHOWNOTEWND:
|
---|
| 466 | case IDM_INSTANT:
|
---|
| 467 | case IDM_HELPCONTEXT:
|
---|
| 468 | case IDM_HELPHINTS:
|
---|
| 469 | case IDM_HELPPIX:
|
---|
| 470 | case IDM_KILLME:
|
---|
| 471 | case IDM_EXIT:
|
---|
| 472 | case IDM_HELPTUTOR:
|
---|
| 473 | case IDM_HELPCONTENTS:
|
---|
| 474 | case IDM_HELPGENERAL:
|
---|
| 475 | case IDM_HELPKEYS:
|
---|
| 476 | case IDM_HELPMOUSE:
|
---|
| 477 | case IDM_HELP:
|
---|
[1416] | 478 | case IDM_FONTPALETTE:
|
---|
| 479 | case IDM_HICOLORPALETTE:
|
---|
| 480 | case IDM_COLORPALETTE:
|
---|
| 481 | case IDM_SYSTEMCLOCK:
|
---|
[133] | 482 | return MainWMCommand(hwnd, msg, mp1, mp2);
|
---|
[2] | 483 |
|
---|
[133] | 484 | case IDM_REMAP:
|
---|
| 485 | WinDlgBox(HWND_DESKTOP,
|
---|
[551] | 486 | hwnd, RemapDlgProc, FM3ModHandle, MAP_FRAME, NULL);
|
---|
[133] | 487 | break;
|
---|
[2] | 488 |
|
---|
[551] | 489 | case IDM_TWODIRS: // Menu action
|
---|
| 490 | case IDM_WINDOWDLG: // Toolbar action
|
---|
[299] | 491 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 492 | if (pd) {
|
---|
[2] | 493 |
|
---|
[133] | 494 | WALK2 wa;
|
---|
[2] | 495 |
|
---|
[133] | 496 | memset(&wa, 0, sizeof(wa));
|
---|
| 497 | wa.size = sizeof(wa);
|
---|
| 498 | *wa.szCurrentPath1 = 0;
|
---|
[551] | 499 | WinSendMsg(pd->hwndDir1,
|
---|
| 500 | UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath1), MPVOID);
|
---|
[133] | 501 | MakeValidDir(wa.szCurrentPath1);
|
---|
| 502 | *wa.szCurrentPath2 = 0;
|
---|
[551] | 503 | WinSendMsg(pd->hwndDir2,
|
---|
| 504 | UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath2), MPVOID);
|
---|
[133] | 505 | MakeValidDir(wa.szCurrentPath2);
|
---|
| 506 | if (WinDlgBox(HWND_DESKTOP,
|
---|
| 507 | hwnd,
|
---|
| 508 | WalkTwoSetDlgProc,
|
---|
| 509 | FM3ModHandle,
|
---|
| 510 | WALK2_FRAME,
|
---|
| 511 | MPFROMP(&wa)) &&
|
---|
| 512 | (IsRoot(wa.szCurrentPath1) ||
|
---|
| 513 | !IsFile(wa.szCurrentPath1)) &&
|
---|
[551] | 514 | (IsRoot(wa.szCurrentPath2) || !IsFile(wa.szCurrentPath2))) {
|
---|
| 515 | WinSendMsg(WinWindowFromID(WinWindowFromID(pd->hwndDir1,
|
---|
[133] | 516 | FID_CLIENT), DIR_CNR),
|
---|
[551] | 517 | UM_SETDIR, MPFROMP(wa.szCurrentPath1), MPVOID);
|
---|
| 518 | WinSendMsg(WinWindowFromID(WinWindowFromID(pd->hwndDir2,
|
---|
[133] | 519 | FID_CLIENT), DIR_CNR),
|
---|
[551] | 520 | UM_SETDIR, MPFROMP(wa.szCurrentPath2), MPVOID);
|
---|
[2] | 521 | }
|
---|
[133] | 522 | }
|
---|
| 523 | break;
|
---|
[2] | 524 |
|
---|
[133] | 525 | case IDM_COMPARE:
|
---|
[299] | 526 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 527 | if (pd) {
|
---|
[2] | 528 |
|
---|
[133] | 529 | WALK2 wa;
|
---|
[2] | 530 |
|
---|
[133] | 531 | memset(&wa, 0, sizeof(wa));
|
---|
| 532 | wa.size = sizeof(wa);
|
---|
| 533 | *wa.szCurrentPath1 = 0;
|
---|
[551] | 534 | WinSendMsg(pd->hwndDir1,
|
---|
| 535 | UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath1), MPVOID);
|
---|
[133] | 536 | MakeValidDir(wa.szCurrentPath1);
|
---|
| 537 | *wa.szCurrentPath2 = 0;
|
---|
[551] | 538 | WinSendMsg(pd->hwndDir2,
|
---|
| 539 | UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath2), MPVOID);
|
---|
[133] | 540 | MakeValidDir(wa.szCurrentPath2);
|
---|
| 541 | if (WinDlgBox(HWND_DESKTOP,
|
---|
| 542 | hwnd,
|
---|
| 543 | WalkTwoCmpDlgProc,
|
---|
| 544 | FM3ModHandle,
|
---|
| 545 | WALK2_FRAME,
|
---|
| 546 | MPFROMP(&wa)) &&
|
---|
| 547 | (IsRoot(wa.szCurrentPath1) ||
|
---|
| 548 | !IsFile(wa.szCurrentPath1)) &&
|
---|
[551] | 549 | (IsRoot(wa.szCurrentPath2) || !IsFile(wa.szCurrentPath2))) {
|
---|
| 550 | if (!*dircompare) {
|
---|
[2] | 551 |
|
---|
[133] | 552 | COMPARE *cmp;
|
---|
[2] | 553 |
|
---|
[551] | 554 | cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
|
---|
[352] | 555 | if (cmp) {
|
---|
[551] | 556 | cmp->size = sizeof(COMPARE);
|
---|
| 557 | strcpy(cmp->leftdir, wa.szCurrentPath1);
|
---|
| 558 | strcpy(cmp->rightdir, wa.szCurrentPath2);
|
---|
[1777] | 559 | cmp->listfile = wa.listfile;
|
---|
| 560 | cmp->includesubdirs = wa.includesubdirs;
|
---|
[551] | 561 | cmp->hwndParent = hwnd;
|
---|
| 562 | cmp->dcd.hwndParent = hwnd;
|
---|
[133] | 563 | WinDlgBox(HWND_DESKTOP,
|
---|
| 564 | HWND_DESKTOP,
|
---|
[551] | 565 | CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
|
---|
[133] | 566 | }
|
---|
| 567 | }
|
---|
[551] | 568 | else {
|
---|
[773] | 569 | CHAR szPath1[CCHMAXPATH];
|
---|
| 570 | CHAR szPath2[CCHMAXPATH];
|
---|
[133] | 571 | runemf2(SEPARATE,
|
---|
[917] | 572 | HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 573 | NULL, NULL,
|
---|
[773] | 574 | "%s %s %s",
|
---|
[133] | 575 | dircompare,
|
---|
[773] | 576 | BldQuotedFileName(szPath1, wa.szCurrentPath1),
|
---|
| 577 | BldQuotedFileName(szPath2, wa.szCurrentPath2));
|
---|
[133] | 578 | }
|
---|
[2] | 579 | }
|
---|
[133] | 580 | }
|
---|
| 581 | break;
|
---|
[2] | 582 |
|
---|
[133] | 583 | case IDM_VTREE:
|
---|
[551] | 584 | WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
|
---|
| 585 | if (hwndTree) {
|
---|
[1778] | 586 | // Hide
|
---|
[133] | 587 | WinShowWindow(hwndTree, FALSE);
|
---|
[551] | 588 | PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID);
|
---|
[1778] | 589 | hwndTree = NULLHANDLE;
|
---|
[133] | 590 | }
|
---|
[551] | 591 | else {
|
---|
[1778] | 592 | // Create tree window if needed and make visible
|
---|
[133] | 593 | ULONG size = sizeof(ULONG);
|
---|
| 594 | hwndTree = StartTreeCnr(hwnd, 3);
|
---|
[1778] | 595 | PrfQueryProfileData(fmprof, realappname,
|
---|
| 596 | "FM/4 TreeWidth", (PVOID)&TreeWidth, &size);
|
---|
[133] | 597 | TreeWidth = max(TreeWidth, 80);
|
---|
| 598 | }
|
---|
[1778] | 599 | yes = hwndTree != NULLHANDLE;
|
---|
| 600 | PrfWriteProfileData(fmprof, realappname,
|
---|
| 601 | "FM/4 TreeUp", (PVOID)&yes, sizeof(yes));
|
---|
[551] | 602 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
[133] | 603 | break;
|
---|
[2] | 604 |
|
---|
[133] | 605 | case IDM_TILEBACKWARDS:
|
---|
[551] | 606 | WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
|
---|
[133] | 607 | fTileBackwards = (fTileBackwards) ? FALSE : TRUE;
|
---|
| 608 | PrfWriteProfileData(fmprof,
|
---|
[1506] | 609 | FM3Str,
|
---|
[133] | 610 | "TileBackwards",
|
---|
[551] | 611 | (PVOID) & fTileBackwards, sizeof(BOOL));
|
---|
| 612 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
[133] | 613 | break;
|
---|
[2] | 614 |
|
---|
[133] | 615 | case IDM_NEXTWINDOW:
|
---|
| 616 | case IDM_PREVWINDOW:
|
---|
[299] | 617 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 618 | if (pd) {
|
---|
[2] | 619 |
|
---|
[133] | 620 | HWND hwndFocus;
|
---|
| 621 |
|
---|
[551] | 622 | if (hwndTree) {
|
---|
| 623 | if (pd->hwndMax) {
|
---|
| 624 | if (hwndTree == pd->hwndCurr)
|
---|
| 625 | hwndFocus = pd->hwndMax;
|
---|
[133] | 626 | else
|
---|
| 627 | hwndFocus = hwndTree;
|
---|
| 628 | }
|
---|
[551] | 629 | else {
|
---|
| 630 | if (hwndTree == pd->hwndCurr)
|
---|
[133] | 631 | hwndFocus = (SHORT1FROMMP(mp1) == IDM_PREVWINDOW) ?
|
---|
[551] | 632 | pd->hwndDir1 : pd->hwndDir2;
|
---|
| 633 | else if (pd->hwndDir1 == pd->hwndCurr)
|
---|
[133] | 634 | hwndFocus = (SHORT1FROMMP(mp1) == IDM_PREVWINDOW) ?
|
---|
[551] | 635 | pd->hwndDir2 : hwndTree;
|
---|
[133] | 636 | else
|
---|
| 637 | hwndFocus = (SHORT1FROMMP(mp1) == IDM_PREVWINDOW) ?
|
---|
[551] | 638 | hwndTree : pd->hwndDir1;
|
---|
[133] | 639 | }
|
---|
[2] | 640 | }
|
---|
[551] | 641 | else {
|
---|
| 642 | if (pd->hwndMax)
|
---|
| 643 | hwndFocus = pd->hwndMax;
|
---|
[133] | 644 | else
|
---|
[953] | 645 | hwndFocus = pd->hwndCurr == pd->hwndDir1 ?
|
---|
| 646 | pd->hwndDir2 : pd->hwndDir1;
|
---|
[133] | 647 | }
|
---|
| 648 | WinSetFocus(HWND_DESKTOP, hwndFocus);
|
---|
| 649 | }
|
---|
| 650 | break;
|
---|
[2] | 651 |
|
---|
[133] | 652 | case IDM_NOTEBOOK:
|
---|
[953] | 653 | case IDM_DIRCNRSETTINGS:
|
---|
| 654 | case IDM_DIRVIEWSETTINGS:
|
---|
| 655 | case IDM_DIRSORTSETTINGS:
|
---|
| 656 | case IDM_COLLECTORVIEWSETTINGS:
|
---|
| 657 | case IDM_COLLECTORSORTSETTINGS:
|
---|
| 658 | case IDM_ARCHIVERSETTINGS:
|
---|
| 659 | case IDM_TREECNRVIEWSETTINGS:
|
---|
| 660 | case IDM_TREECNRSORTSETTINGS:
|
---|
| 661 | case IDM_VIEWERSETTINGS:
|
---|
| 662 | case IDM_VIEWERSETTINGS2:
|
---|
| 663 | case IDM_COMPARESETTINGS:
|
---|
| 664 | case IDM_MONOLITHICSETTINGS:
|
---|
| 665 | case IDM_GENERALSETTINGS:
|
---|
| 666 | case IDM_SCANSETTINGS:
|
---|
| 667 | case IDM_BUBBLESSETTINGS:
|
---|
[133] | 668 | WinDlgBox(HWND_DESKTOP,
|
---|
| 669 | hwnd,
|
---|
[917] | 670 | CfgDlgProc,
|
---|
| 671 | FM3ModHandle,
|
---|
| 672 | CFG_FRAME,
|
---|
[953] | 673 | MPFROMLONG(mp1)); // 15 Feb 08 SHL
|
---|
[551] | 674 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
[133] | 675 | break;
|
---|
[2] | 676 |
|
---|
[133] | 677 | case IDM_SEEALL:
|
---|
| 678 | case IDM_GREP:
|
---|
| 679 | case IDM_COLLECTOR:
|
---|
| 680 | {
|
---|
| 681 | HWND hwndC;
|
---|
| 682 |
|
---|
| 683 | hwndC = StartCollector(HWND_DESKTOP, 4);
|
---|
[551] | 684 | if (hwndC) {
|
---|
[133] | 685 | WinSetWindowPos(hwndC,
|
---|
| 686 | HWND_TOP,
|
---|
[551] | 687 | 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | SWP_ACTIVATE);
|
---|
[133] | 688 | if (SHORT1FROMMP(mp1) == IDM_GREP)
|
---|
| 689 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT),
|
---|
[551] | 690 | WM_COMMAND, MPFROM2SHORT(IDM_GREP, 0), MPVOID);
|
---|
[133] | 691 | if (SHORT1FROMMP(mp1) == IDM_SEEALL)
|
---|
| 692 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT),
|
---|
[551] | 693 | WM_COMMAND, MPFROM2SHORT(IDM_SEEALL, 0), MPVOID);
|
---|
[2] | 694 | }
|
---|
[133] | 695 | }
|
---|
| 696 | break;
|
---|
[2] | 697 |
|
---|
[133] | 698 | case IDM_EDITCOMMANDS:
|
---|
| 699 | EditCommands(hwnd);
|
---|
| 700 | break;
|
---|
| 701 |
|
---|
| 702 | default:
|
---|
| 703 | if (SHORT1FROMMP(mp1) >= IDM_SWITCHSTART &&
|
---|
[551] | 704 | SHORT1FROMMP(mp1) < IDM_SWITCHSTART + 499) {
|
---|
[133] | 705 | if (SHORT1FROMMP(mp1) - IDM_SWITCHSTART < numswitches)
|
---|
[551] | 706 | WinSwitchToProgram(switches[SHORT1FROMMP(mp1) - IDM_SWITCHSTART]);
|
---|
[2] | 707 | break;
|
---|
[133] | 708 | }
|
---|
| 709 | else if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
|
---|
[551] | 710 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
|
---|
[2] | 711 |
|
---|
[133] | 712 | INT x;
|
---|
| 713 | HWND hwndCnr;
|
---|
| 714 |
|
---|
| 715 | if (!cmdloaded)
|
---|
| 716 | load_commands();
|
---|
[551] | 717 | hwndCnr = TopWindow(hwnd, (HWND) 0);
|
---|
| 718 | hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT),
|
---|
| 719 | UM_CONTAINERHWND, MPVOID, MPVOID);
|
---|
| 720 | if (!hwndCnr) {
|
---|
[1398] | 721 | Runtime_Error(pszSrcFile, __LINE__, NULL);
|
---|
[133] | 722 | break;
|
---|
[2] | 723 | }
|
---|
[1880] | 724 | x = SHORT1FROMMP(mp1);
|
---|
[551] | 725 | if (x >= 0) {
|
---|
[133] | 726 | RunCommand(hwndCnr, x);
|
---|
[551] | 727 | if (fUnHilite) {
|
---|
[2] | 728 |
|
---|
[133] | 729 | PCNRITEM pci;
|
---|
| 730 | DIRCNRDATA *dcd = NULL;
|
---|
[2] | 731 |
|
---|
[133] | 732 | if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR)
|
---|
| 733 | dcd = INSTDATA(hwndCnr);
|
---|
| 734 | pci = (PCNRITEM) WinSendMsg(hwndCnr,
|
---|
| 735 | CM_QUERYRECORDEMPHASIS,
|
---|
| 736 | MPFROMLONG(CMA_FIRST),
|
---|
| 737 | MPFROMSHORT(CRA_CURSORED));
|
---|
[672] | 738 | if (pci && (INT) pci != -1 && (pci->rc.flRecordAttr & CRA_SELECTED)) {
|
---|
| 739 | UnHilite(hwnd,
|
---|
| 740 | TRUE,
|
---|
| 741 | dcd ? &dcd->lastselection : NULL,
|
---|
| 742 | dcd ? dcd->ulItemsToUnHilite : 0);
|
---|
| 743 | }
|
---|
[133] | 744 | }
|
---|
[2] | 745 | }
|
---|
[133] | 746 | }
|
---|
| 747 | else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART &&
|
---|
[1131] | 748 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 51) {
|
---|
[133] | 749 | if (!qtloaded)
|
---|
| 750 | load_quicktools();
|
---|
[1131] | 751 | if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]) {
|
---|
[133] | 752 | if (fToolsChanged)
|
---|
| 753 | save_tools(NULL);
|
---|
[1131] | 754 | if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]))
|
---|
[133] | 755 | load_tools(NULL);
|
---|
[551] | 756 | else {
|
---|
[1125] | 757 | strcpy(lasttoolbar,
|
---|
[1131] | 758 | quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]);
|
---|
[1128] | 759 | PrfWriteProfileString(fmprof, appname, "LastToolbar", lasttoolbar);
|
---|
[133] | 760 | }
|
---|
[1125] | 761 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
---|
[2] | 762 | }
|
---|
[133] | 763 | }
|
---|
[551] | 764 | else {
|
---|
[2] | 765 |
|
---|
[133] | 766 | HWND hwndActive;
|
---|
[2] | 767 |
|
---|
[551] | 768 | hwndActive = TopWindow(hwnd, (HWND) 0);
|
---|
[133] | 769 | if (hwndActive)
|
---|
[551] | 770 | PostMsg(WinWindowFromID(hwndActive, FID_CLIENT), msg, mp1, mp2);
|
---|
[133] | 771 | }
|
---|
| 772 | break;
|
---|
[2] | 773 | }
|
---|
| 774 | return 0;
|
---|
| 775 | }
|
---|
| 776 |
|
---|
[551] | 777 | static MRESULT EXPENTRY MainWMOnce2(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
| 778 | MPARAM mp2)
|
---|
[133] | 779 | {
|
---|
[2] | 780 | PERSON1DATA *pd;
|
---|
[1777] | 781 | TID tid;
|
---|
| 782 | SWP swp;
|
---|
| 783 | PFNWP oldproc;
|
---|
| 784 | HWND hwndMenu;
|
---|
| 785 | DIRCNRDATA *dcd;
|
---|
| 786 | HWND hwndC;
|
---|
| 787 | ULONG which;
|
---|
| 788 | ULONG size;
|
---|
[1778] | 789 | BOOL yes;
|
---|
[2] | 790 |
|
---|
[551] | 791 | switch (msg) {
|
---|
[133] | 792 | case WM_CREATE:
|
---|
[1777] | 793 | WinQueryWindowProcess(hwnd, &mypid, &tid);
|
---|
| 794 | hwndMain = hwnd;
|
---|
[2] | 795 |
|
---|
[133] | 796 | WinSetWindowUShort(hwnd, QWL_USER + 8, 0);
|
---|
| 797 | WinSetWindowUShort(hwnd, QWL_USER + 10, 0);
|
---|
| 798 | WinSetWindowUShort(hwnd, QWL_USER + 12, 0);
|
---|
| 799 | WinSetWindowUShort(hwnd, QWL_USER + 16, 0);
|
---|
[1335] | 800 | if (xbeginthread(MakeMainObjWin,
|
---|
| 801 | 245760,
|
---|
| 802 | MPVOID,
|
---|
| 803 | pszSrcFile,
|
---|
| 804 | __LINE__) == -1)
|
---|
| 805 | {
|
---|
[551] | 806 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
[133] | 807 | return 0;
|
---|
| 808 | }
|
---|
| 809 | else
|
---|
[1880] | 810 | DosSleep(32);
|
---|
[2] | 811 |
|
---|
[551] | 812 | pd = xmallocz(sizeof(PERSON1DATA), pszSrcFile, __LINE__);
|
---|
[133] | 813 | if (!pd)
|
---|
| 814 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
---|
[352] | 815 | else {
|
---|
[551] | 816 | pd->size = sizeof(PERSON1DATA);
|
---|
| 817 | WinSetWindowPtr(hwnd, QWL_USER + 4, (PVOID) pd);
|
---|
[133] | 818 | }
|
---|
[2] | 819 |
|
---|
[1777] | 820 | // create frame children (not client children, frame children)
|
---|
| 821 | DosSleep(1);
|
---|
| 822 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
---|
| 823 | oldproc = WinSubclassWindow(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 824 | (PFNWP) MainFrameWndProc2);
|
---|
| 825 | if (oldproc)
|
---|
| 826 | WinSetWindowPtr(WinQueryWindow(hwnd, QW_PARENT), QWL_USER, (PVOID) oldproc);
|
---|
[2] | 827 |
|
---|
[1777] | 828 | CommonCreateMainChildren(hwnd, &swp);
|
---|
[2] | 829 |
|
---|
[1777] | 830 | hwndMenu = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_MENU);
|
---|
| 831 | WinSetWindowULong(hwnd, QWL_USER, hwndMenu);
|
---|
| 832 |
|
---|
| 833 | // 2014-05-15 SHL FIXME to be sure needed
|
---|
| 834 | // WinCheckMenuItem(hwndMenu, IDM_TOGGLEDRAGDIALOG, fDragndropDlg); // 2014-05-15 SHL
|
---|
| 835 |
|
---|
| 836 | CfgMenuInit(hwndMenu, FALSE); // 14 Feb 08 SHL
|
---|
| 837 | SetConditionalCascade(hwndMenu, IDM_COMMANDLINESUBMENU, IDM_COMMANDLINE);
|
---|
| 838 |
|
---|
| 839 | if (fProtectOnly) {
|
---|
| 840 | WinEnableMenuItem(hwndMenu, IDM_DOSCOMMANDLINE, FALSE);
|
---|
| 841 | WinEnableMenuItem(hwndMenu, IDM_WINFULLSCREEN, FALSE);
|
---|
[133] | 842 | }
|
---|
[1777] | 843 |
|
---|
| 844 | SetConditionalCascade(hwndMenu, IDM_COMMANDSMENU, IDM_DOITYOURSELF);
|
---|
| 845 | SetConditionalCascade(hwndMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
|
---|
| 846 |
|
---|
[133] | 847 | WinSetWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[551] | 848 | FID_TITLEBAR), "FM/2 Lite");
|
---|
[1777] | 849 |
|
---|
[551] | 850 | FixSwitchList(WinQueryWindow(hwnd, QW_PARENT), NULL);
|
---|
| 851 | SetSysMenu(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_SYSMENU));
|
---|
[133] | 852 | break;
|
---|
[2] | 853 |
|
---|
[133] | 854 | case UM_SETUP:
|
---|
[299] | 855 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 856 | if (pd) {
|
---|
[133] | 857 | CHAR s[CCHMAXPATH];
|
---|
[1778] | 858 | yes = TRUE;
|
---|
[133] | 859 | size = sizeof(BOOL);
|
---|
[1778] | 860 | PrfQueryProfileData(fmprof, realappname,
|
---|
| 861 | "FM/4 TreeUp", (PVOID)&yes, &size);
|
---|
| 862 | if (yes) {
|
---|
[133] | 863 | hwndTree = StartTreeCnr(hwnd, 3);
|
---|
[1778] | 864 | size = sizeof(TreeWidth);
|
---|
[1777] | 865 | PrfQueryProfileData(fmprof, realappname, "FM/4 TreeWidth",
|
---|
[1778] | 866 | (PVOID)&TreeWidth, &size);
|
---|
[133] | 867 | TreeWidth = max(TreeWidth, 80);
|
---|
| 868 | }
|
---|
| 869 | size = sizeof(BOOL);
|
---|
[1778] | 870 | if (PrfQueryProfileData(fmprof, appname, "Toolbar", &yes, &size) &&
|
---|
| 871 | size &&
|
---|
| 872 | !yes)
|
---|
| 873 | {
|
---|
[551] | 874 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
|
---|
[1778] | 875 | }
|
---|
[2] | 876 |
|
---|
[1904] | 877 | // 2017-12-30 SHL FIXME to support directory override from command line
|
---|
[133] | 878 | size = sizeof(s);
|
---|
| 879 | *s = 0;
|
---|
[1482] | 880 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir1", s, &size) && *s)
|
---|
[133] | 881 | MakeValidDir(s);
|
---|
| 882 | else
|
---|
| 883 | save_dir(s);
|
---|
[551] | 884 | pd->hwndLastDir = pd->hwndCurr = pd->hwndDir1 =
|
---|
| 885 | StartDirCnr(hwnd, s, (HWND) 0, 3);
|
---|
[1904] | 886 |
|
---|
[133] | 887 | size = sizeof(s);
|
---|
| 888 | *s = 0;
|
---|
[1482] | 889 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir2", s, &size) && *s)
|
---|
[133] | 890 | MakeValidDir(s);
|
---|
| 891 | else
|
---|
| 892 | save_dir(s);
|
---|
[551] | 893 | pd->hwndDir2 = StartDirCnr(hwnd, s, (HWND) 0, 3);
|
---|
[1904] | 894 |
|
---|
[551] | 895 | WinSetFocus(HWND_DESKTOP, pd->hwndCurr);
|
---|
[2] | 896 |
|
---|
[551] | 897 | hwndC = WinWindowFromID(pd->hwndDir1, FID_CLIENT);
|
---|
| 898 | if (hwndC) {
|
---|
[299] | 899 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
[551] | 900 | if (dcd) {
|
---|
[133] | 901 | size = sizeof(INT);
|
---|
[1482] | 902 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir1.Sort",
|
---|
[551] | 903 | (PVOID) & dcd->sortFlags,
|
---|
| 904 | &size) && size == sizeof(INT)) {
|
---|
| 905 | if (!dcd->sortFlags)
|
---|
| 906 | dcd->sortFlags = SORT_PATHNAME;
|
---|
[133] | 907 | }
|
---|
| 908 | size = sizeof(MASK);
|
---|
[1482] | 909 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir1.Filter",
|
---|
[551] | 910 | (PVOID) & dcd->mask, &size) && size) {
|
---|
| 911 | if (*dcd->mask.szMask)
|
---|
[133] | 912 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
[551] | 913 | UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
|
---|
[133] | 914 | }
|
---|
[551] | 915 | *(dcd->mask.prompt) = 0;
|
---|
[133] | 916 | size = sizeof(ULONG);
|
---|
[1482] | 917 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir1.View",
|
---|
[551] | 918 | (PVOID) & dcd->flWindowAttr,
|
---|
| 919 | &size) && size == sizeof(ULONG)) {
|
---|
[2] | 920 |
|
---|
[133] | 921 | CNRINFO cnri;
|
---|
[2] | 922 |
|
---|
[133] | 923 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 924 | cnri.cb = sizeof(CNRINFO);
|
---|
| 925 | if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
| 926 | CM_QUERYCNRINFO,
|
---|
[551] | 927 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)))) {
|
---|
| 928 | cnri.flWindowAttr = dcd->flWindowAttr;
|
---|
[133] | 929 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
| 930 | CM_SETCNRINFO,
|
---|
[551] | 931 | MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));
|
---|
[133] | 932 | }
|
---|
| 933 | }
|
---|
| 934 | }
|
---|
| 935 | }
|
---|
[2] | 936 |
|
---|
[551] | 937 | hwndC = WinWindowFromID(pd->hwndDir2, FID_CLIENT);
|
---|
| 938 | if (hwndC) {
|
---|
[299] | 939 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
[551] | 940 | if (dcd) {
|
---|
[133] | 941 | size = sizeof(INT);
|
---|
[1482] | 942 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir2.Sort",
|
---|
[551] | 943 | (PVOID) & dcd->sortFlags,
|
---|
| 944 | &size) && size == sizeof(INT)) {
|
---|
| 945 | if (!dcd->sortFlags)
|
---|
| 946 | dcd->sortFlags = SORT_PATHNAME;
|
---|
[133] | 947 | }
|
---|
| 948 | size = sizeof(MASK);
|
---|
[1482] | 949 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir2.Filter",
|
---|
[551] | 950 | (PVOID) & dcd->mask, &size) && size) {
|
---|
| 951 | if (*dcd->mask.szMask)
|
---|
[133] | 952 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
[551] | 953 | UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
|
---|
[133] | 954 | }
|
---|
[551] | 955 | *(dcd->mask.prompt) = 0;
|
---|
[133] | 956 | size = sizeof(ULONG);
|
---|
[1482] | 957 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir2.View",
|
---|
[551] | 958 | (PVOID) & dcd->flWindowAttr,
|
---|
| 959 | &size) && size == sizeof(ULONG)) {
|
---|
[2] | 960 |
|
---|
[133] | 961 | CNRINFO cnri;
|
---|
[2] | 962 |
|
---|
[133] | 963 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 964 | cnri.cb = sizeof(CNRINFO);
|
---|
| 965 | if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
| 966 | CM_QUERYCNRINFO,
|
---|
[551] | 967 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)))) {
|
---|
| 968 | cnri.flWindowAttr = dcd->flWindowAttr;
|
---|
[133] | 969 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
| 970 | CM_SETCNRINFO,
|
---|
[551] | 971 | MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));
|
---|
[133] | 972 | }
|
---|
| 973 | }
|
---|
| 974 | }
|
---|
[2] | 975 | }
|
---|
[1904] | 976 |
|
---|
[1782] | 977 | // 2014-06-11 SHL Initialize view, sort and filter button text
|
---|
| 978 | if (pd->hwndDir1) {
|
---|
| 979 | hwndC = WinWindowFromID(pd->hwndDir1, FID_CLIENT);
|
---|
| 980 | if (hwndC) {
|
---|
| 981 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
| 982 | if (dcd && dcd->hwndCnr)
|
---|
| 983 | PostMsg(dcd->hwndCnr, UM_SETUP2, MPVOID, MPVOID);
|
---|
| 984 | }
|
---|
[2] | 985 | }
|
---|
[1782] | 986 | if (pd->hwndDir2) {
|
---|
| 987 | hwndC = WinWindowFromID(pd->hwndDir2, FID_CLIENT);
|
---|
| 988 | if (hwndC) {
|
---|
| 989 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
| 990 | if (dcd && dcd->hwndCnr)
|
---|
| 991 | PostMsg(dcd->hwndCnr, UM_SETUP2, MPVOID, MPVOID);
|
---|
| 992 | }
|
---|
[1777] | 993 | }
|
---|
[1782] | 994 |
|
---|
| 995 | which = 0;
|
---|
| 996 | size = sizeof(ULONG);
|
---|
| 997 | if (PrfQueryProfileData(fmprof,
|
---|
| 998 | realappname,
|
---|
| 999 | "FM/4 Max",
|
---|
| 1000 | (PVOID)&which,
|
---|
| 1001 | &size) &&
|
---|
| 1002 | size == sizeof(ULONG) &&
|
---|
| 1003 | which)
|
---|
| 1004 | {
|
---|
| 1005 | PostMsg(hwnd,
|
---|
| 1006 | UM_MAXIMIZE,
|
---|
| 1007 | MPFROMLONG(((which == 1) ?
|
---|
| 1008 | pd->hwndDir1 : pd->hwndDir2)), MPVOID);
|
---|
| 1009 | }
|
---|
| 1010 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
| 1011 | if (!hwndTree)
|
---|
| 1012 | PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
|
---|
| 1013 | load_tools(NULL);
|
---|
| 1014 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
---|
| 1015 | fRunning = TRUE;
|
---|
[1904] | 1016 | } // if pd
|
---|
[133] | 1017 | return 0;
|
---|
[2] | 1018 |
|
---|
[133] | 1019 | case WM_SAVEAPPLICATION:
|
---|
[1498] | 1020 | WinStoreWindowPos((CHAR *) FM2Str,
|
---|
[551] | 1021 | "MainWindowPos2", WinQueryWindow(hwnd, QW_PARENT));
|
---|
[299] | 1022 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 1023 | if (pd) {
|
---|
[2] | 1024 |
|
---|
[133] | 1025 | CHAR s[CCHMAXPATH];
|
---|
| 1026 | HWND hwndC;
|
---|
| 1027 | DIRCNRDATA *dcd;
|
---|
| 1028 | ULONG flWindowAttr;
|
---|
[2] | 1029 |
|
---|
[133] | 1030 | *s = 0;
|
---|
[551] | 1031 | WinSendMsg(pd->hwndDir1, UM_CONTAINERDIR, MPFROMP(s), MPVOID);
|
---|
| 1032 | if (*s) {
|
---|
[133] | 1033 | MakeValidDir(s);
|
---|
[551] | 1034 | PrfWriteProfileString(fmprof, realappname, "FM/4 Dir1", s);
|
---|
[133] | 1035 | }
|
---|
| 1036 | *s = 0;
|
---|
[551] | 1037 | WinSendMsg(pd->hwndDir2, UM_CONTAINERDIR, MPFROMP(s), MPVOID);
|
---|
| 1038 | if (*s) {
|
---|
[133] | 1039 | MakeValidDir(s);
|
---|
[551] | 1040 | PrfWriteProfileString(fmprof, realappname, "FM/4 Dir2", s);
|
---|
[133] | 1041 | }
|
---|
[551] | 1042 | flWindowAttr = (pd->hwndMax == pd->hwndDir1) ?
|
---|
| 1043 | 1 : (pd->hwndMax == pd->hwndDir2) ? 2 : 0;
|
---|
[133] | 1044 | PrfWriteProfileData(fmprof,
|
---|
| 1045 | realappname,
|
---|
[551] | 1046 | "FM/4 Max", &flWindowAttr, sizeof(flWindowAttr));
|
---|
| 1047 | hwndC = WinWindowFromID(pd->hwndDir1, FID_CLIENT);
|
---|
| 1048 | if (hwndC) {
|
---|
[299] | 1049 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
[551] | 1050 | if (dcd) {
|
---|
| 1051 | flWindowAttr = dcd->flWindowAttr;
|
---|
| 1052 | if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
|
---|
[133] | 1053 | flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
|
---|
[551] | 1054 | if (dcd->lastattr) {
|
---|
| 1055 | if (dcd->lastattr & CV_TEXT)
|
---|
[133] | 1056 | flWindowAttr |= CV_TEXT;
|
---|
[551] | 1057 | else if (dcd->lastattr & CV_DETAIL)
|
---|
[133] | 1058 | flWindowAttr |= CV_DETAIL;
|
---|
[551] | 1059 | else if (dcd->lastattr & CV_ICON)
|
---|
[133] | 1060 | flWindowAttr |= CV_ICON;
|
---|
| 1061 | else
|
---|
| 1062 | flWindowAttr |= CV_NAME;
|
---|
| 1063 | }
|
---|
| 1064 | else
|
---|
| 1065 | flWindowAttr |= CV_NAME;
|
---|
| 1066 | }
|
---|
[1482] | 1067 | PrfWriteProfileData(fmprof, realappname, "FM/4 Dir1.Sort",
|
---|
[551] | 1068 | (PVOID) & dcd->sortFlags, sizeof(INT));
|
---|
[1482] | 1069 | PrfWriteProfileData(fmprof, realappname, "FM/4 Dir1.Filter",
|
---|
[551] | 1070 | (PVOID) & dcd->mask, sizeof(MASK));
|
---|
[1482] | 1071 | PrfWriteProfileData(fmprof, realappname, "FM/4 Dir1.View",
|
---|
[551] | 1072 | (PVOID) & flWindowAttr, sizeof(ULONG));
|
---|
[133] | 1073 | }
|
---|
| 1074 | }
|
---|
[2] | 1075 |
|
---|
[551] | 1076 | hwndC = WinWindowFromID(pd->hwndDir2, FID_CLIENT);
|
---|
| 1077 | if (hwndC) {
|
---|
[299] | 1078 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
[551] | 1079 | if (dcd) {
|
---|
| 1080 | flWindowAttr = dcd->flWindowAttr;
|
---|
| 1081 | if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
|
---|
[133] | 1082 | flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
|
---|
[551] | 1083 | if (dcd->lastattr) {
|
---|
| 1084 | if (dcd->lastattr & CV_TEXT)
|
---|
[133] | 1085 | flWindowAttr |= CV_TEXT;
|
---|
[551] | 1086 | else if (dcd->lastattr & CV_DETAIL)
|
---|
[133] | 1087 | flWindowAttr |= CV_DETAIL;
|
---|
[551] | 1088 | else if (dcd->lastattr & CV_ICON)
|
---|
[133] | 1089 | flWindowAttr |= CV_ICON;
|
---|
| 1090 | else
|
---|
| 1091 | flWindowAttr |= CV_NAME;
|
---|
| 1092 | }
|
---|
| 1093 | else
|
---|
| 1094 | flWindowAttr |= CV_NAME;
|
---|
| 1095 | }
|
---|
[1482] | 1096 | PrfWriteProfileData(fmprof, realappname, "FM/4 Dir2.Sort",
|
---|
[551] | 1097 | (PVOID) & dcd->sortFlags, sizeof(INT));
|
---|
[1482] | 1098 | PrfWriteProfileData(fmprof, realappname, "FM/4 Dir2.Filter",
|
---|
[551] | 1099 | (PVOID) & dcd->mask, sizeof(MASK));
|
---|
[1482] | 1100 | PrfWriteProfileData(fmprof, realappname, "FM/4 Dir2.View",
|
---|
[551] | 1101 | (PVOID) & flWindowAttr, sizeof(ULONG));
|
---|
[133] | 1102 | }
|
---|
[2] | 1103 | }
|
---|
[133] | 1104 | }
|
---|
| 1105 | break;
|
---|
[2] | 1106 | }
|
---|
[133] | 1107 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 1108 | }
|
---|
| 1109 |
|
---|
[133] | 1110 | MRESULT EXPENTRY MainWndProc2(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1111 | {
|
---|
[2] | 1112 | PERSON1DATA *pd;
|
---|
| 1113 |
|
---|
[551] | 1114 | switch (msg) {
|
---|
[133] | 1115 | case WM_SAVEAPPLICATION:
|
---|
| 1116 | case UM_SETUP:
|
---|
| 1117 | case WM_CREATE:
|
---|
| 1118 | return MainWMOnce2(hwnd, msg, mp1, mp2);
|
---|
[2] | 1119 |
|
---|
[133] | 1120 | case UM_THREADUSE:
|
---|
| 1121 | case UM_LOADFILE:
|
---|
[246] | 1122 | case UM_BUILDDRIVEBAR:
|
---|
[1457] | 1123 | case WM_TIMER:
|
---|
[133] | 1124 | return CommonMainWndProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 1125 |
|
---|
[133] | 1126 | case UM_SETUP2:
|
---|
[299] | 1127 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 1128 | if (pd) {
|
---|
| 1129 | if (mp1) {
|
---|
| 1130 | if (pd->hwndDir1 && (!pd->hwndMax || pd->hwndMax == pd->hwndDir1))
|
---|
| 1131 | BoxWindow(pd->hwndDir1, (HPS) 0, CLR_PALEGRAY);
|
---|
| 1132 | if (pd->hwndDir2 && (!pd->hwndMax || pd->hwndMax == pd->hwndDir2))
|
---|
| 1133 | BoxWindow(pd->hwndDir2, (HPS) 0, CLR_PALEGRAY);
|
---|
[133] | 1134 | if (hwndTree)
|
---|
[551] | 1135 | BoxWindow(hwndTree, (HPS) 0, CLR_PALEGRAY);
|
---|
[2] | 1136 | }
|
---|
[551] | 1137 | else {
|
---|
[133] | 1138 | if (hwndTree)
|
---|
| 1139 | BoxWindow(hwndTree,
|
---|
| 1140 | (HPS) 0,
|
---|
[551] | 1141 | (pd->hwndCurr == hwndTree) ? CLR_RED : CLR_WHITE);
|
---|
| 1142 | if (!pd->hwndMax || pd->hwndMax == pd->hwndDir1)
|
---|
| 1143 | BoxWindow(pd->hwndDir1,
|
---|
[133] | 1144 | (HPS) 0,
|
---|
[551] | 1145 | (pd->hwndDir1 == pd->hwndCurr) ?
|
---|
[133] | 1146 | CLR_RED :
|
---|
[551] | 1147 | (pd->hwndDir1 == pd->hwndLastDir) ?
|
---|
| 1148 | CLR_DARKRED : CLR_PALEGRAY);
|
---|
| 1149 | if (!pd->hwndMax || pd->hwndMax == pd->hwndDir2)
|
---|
| 1150 | BoxWindow(pd->hwndDir2,
|
---|
[133] | 1151 | (HPS) 0,
|
---|
[551] | 1152 | (pd->hwndDir2 == pd->hwndCurr) ?
|
---|
[133] | 1153 | CLR_RED :
|
---|
[551] | 1154 | (pd->hwndDir2 == pd->hwndLastDir) ?
|
---|
| 1155 | CLR_DARKRED : CLR_PALEGRAY);
|
---|
[133] | 1156 | }
|
---|
| 1157 | }
|
---|
| 1158 | return 0;
|
---|
[2] | 1159 |
|
---|
[133] | 1160 | case WM_BUTTON1DOWN:
|
---|
| 1161 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
[551] | 1162 | if (hwndTree) {
|
---|
[2] | 1163 |
|
---|
[133] | 1164 | SWP swp;
|
---|
[2] | 1165 |
|
---|
[133] | 1166 | WinQueryWindowPos(hwndTree, &swp);
|
---|
| 1167 | if (SHORT1FROMMP(mp1) > (swp.x + swp.cx) - 3 &&
|
---|
[551] | 1168 | SHORT1FROMMP(mp1) < (swp.x + swp.cx) + 3) {
|
---|
[2] | 1169 |
|
---|
[133] | 1170 | SWP swpC;
|
---|
| 1171 | TRACKINFO track;
|
---|
[2] | 1172 |
|
---|
[133] | 1173 | WinQueryWindowPos(hwnd, &swpC);
|
---|
| 1174 | track.cxBorder = 4;
|
---|
| 1175 | track.cyBorder = 4;
|
---|
| 1176 | track.cxGrid = 1;
|
---|
| 1177 | track.cyGrid = 1;
|
---|
| 1178 | track.cxKeyboard = 8;
|
---|
| 1179 | track.cyKeyboard = 8;
|
---|
| 1180 | track.rclTrack.yBottom = 2;
|
---|
| 1181 | track.rclTrack.yTop = swpC.cy - 4;
|
---|
| 1182 | track.rclTrack.xLeft = 2;
|
---|
| 1183 | track.rclTrack.xRight = swp.x + swp.cx + 2;
|
---|
| 1184 | track.rclBoundary = track.rclTrack;
|
---|
| 1185 | track.rclBoundary.xRight = swpC.cx - 80;
|
---|
| 1186 | track.ptlMinTrackSize.x = 80;
|
---|
| 1187 | track.ptlMinTrackSize.y = swpC.cy - 4;
|
---|
| 1188 | track.ptlMaxTrackSize.x = swpC.cx - 80;
|
---|
| 1189 | track.ptlMaxTrackSize.y = swpC.cy - 4;
|
---|
| 1190 | track.fs = TF_RIGHT;
|
---|
[551] | 1191 | if (WinTrackRect(hwnd, (HPS) 0, &track)) {
|
---|
[133] | 1192 | TreeWidth = track.rclTrack.xRight - track.rclTrack.xLeft;
|
---|
| 1193 | PrfWriteProfileData(fmprof,
|
---|
| 1194 | realappname,
|
---|
[551] | 1195 | "FM/4 TreeWidth", &TreeWidth, sizeof(ULONG));
|
---|
| 1196 | WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
|
---|
| 1197 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
[133] | 1198 | }
|
---|
| 1199 | return (MRESULT) TRUE;
|
---|
[2] | 1200 | }
|
---|
[133] | 1201 | }
|
---|
| 1202 | break;
|
---|
[2] | 1203 |
|
---|
[133] | 1204 | case WM_MOUSEMOVE:
|
---|
| 1205 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
[551] | 1206 | if (hwndTree) {
|
---|
[2] | 1207 |
|
---|
[133] | 1208 | SWP swp;
|
---|
[2] | 1209 |
|
---|
[551] | 1210 | if (WinQueryWindowPos(hwndTree, &swp)) {
|
---|
[133] | 1211 | if (SHORT1FROMMP(mp1) > (swp.x + swp.cx) - 3 &&
|
---|
| 1212 | SHORT1FROMMP(mp1) < (swp.x + swp.cx) + 3)
|
---|
| 1213 | WinSetPointer(HWND_DESKTOP, hptrEW);
|
---|
| 1214 | else
|
---|
| 1215 | WinSetPointer(HWND_DESKTOP, hptrArrow);
|
---|
[2] | 1216 | }
|
---|
[133] | 1217 | else
|
---|
| 1218 | WinSetPointer(HWND_DESKTOP, hptrArrow);
|
---|
| 1219 | }
|
---|
| 1220 | return (MRESULT) TRUE;
|
---|
[2] | 1221 |
|
---|
[133] | 1222 | case WM_BUTTON1UP:
|
---|
| 1223 | case WM_BUTTON2UP:
|
---|
| 1224 | case WM_BUTTON3UP:
|
---|
| 1225 | case WM_CHAR:
|
---|
| 1226 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 1227 | break;
|
---|
[2] | 1228 |
|
---|
[133] | 1229 | case UM_ADVISEFOCUS:
|
---|
[299] | 1230 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 1231 | if (mp1 && pd && (HWND) mp1 != pd->hwndCurr) {
|
---|
| 1232 | if ((HWND) mp1 != hwndTree)
|
---|
| 1233 | pd->hwndLastDir = (HWND) mp1;
|
---|
| 1234 | pd->hwndCurr = (HWND) mp1;
|
---|
| 1235 | WinSendMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
|
---|
[133] | 1236 | }
|
---|
| 1237 | return 0;
|
---|
[2] | 1238 |
|
---|
[133] | 1239 | case UM_MAXIMIZE:
|
---|
[551] | 1240 | if (mp1) {
|
---|
[299] | 1241 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 1242 | if (pd) {
|
---|
| 1243 | WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
|
---|
| 1244 | if (pd->hwndMax != (HWND) mp1) {
|
---|
| 1245 | pd->hwndMax = (HWND) mp1;
|
---|
| 1246 | WinSetFocus(HWND_DESKTOP, pd->hwndMax);
|
---|
[133] | 1247 | }
|
---|
| 1248 | else
|
---|
[551] | 1249 | pd->hwndMax = (HWND) 0;
|
---|
| 1250 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
[2] | 1251 | }
|
---|
[133] | 1252 | }
|
---|
| 1253 | return 0;
|
---|
[2] | 1254 |
|
---|
[133] | 1255 | case WM_INITMENU:
|
---|
[551] | 1256 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 1257 | case IDM_FILESMENU:
|
---|
| 1258 | case IDM_VIEWSMENU:
|
---|
| 1259 | case IDM_DETAILSSETUP:
|
---|
| 1260 | case IDM_COMMANDSMENU:
|
---|
| 1261 | case IDM_SORTSUBMENU:
|
---|
[299] | 1262 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[133] | 1263 | if (pd)
|
---|
[551] | 1264 | WinSendMsg(pd->hwndCurr, UM_INITMENU, mp1, mp2);
|
---|
[2] | 1265 | break;
|
---|
[133] | 1266 | case IDM_CONFIGMENU:
|
---|
[1856] | 1267 | // 2014-05-17 SHL FIXME to use SetToggleChecks maybe
|
---|
[551] | 1268 | WinCheckMenuItem((HWND) mp2, IDM_TOOLSUBMENU, fToolbar);
|
---|
| 1269 | WinCheckMenuItem((HWND) mp2, IDM_AUTOVIEW, fAutoView);
|
---|
[1777] | 1270 | WinCheckMenuItem((HWND) mp2, IDM_CONFIRMDELETE, fConfirmDelete); // 2014-05-17 SHL
|
---|
| 1271 | WinCheckMenuItem((HWND) mp2, IDM_TOGGLEDRAGDIALOG, fDragndropDlg); // 2014-05-15 SHL
|
---|
[2] | 1272 | break;
|
---|
[133] | 1273 | case IDM_TOOLSUBMENU:
|
---|
[1856] | 1274 | // 2014-05-17 SHL FIXME to use SetToggleChecks maybe
|
---|
[551] | 1275 | WinCheckMenuItem((HWND) mp2, IDM_TOOLBAR, fToolbar);
|
---|
| 1276 | WinCheckMenuItem((HWND) mp2, IDM_TEXTTOOLS, fTextTools);
|
---|
| 1277 | WinCheckMenuItem((HWND) mp2, IDM_TOOLTITLES, fToolTitles);
|
---|
[133] | 1278 | break;
|
---|
| 1279 | case IDM_WINDOWSMENU:
|
---|
[1856] | 1280 | // 2014-05-17 SHL FIXME to use SetToggleChecks maybe
|
---|
[551] | 1281 | WinCheckMenuItem((HWND) mp2, IDM_VTREE, (hwndTree != (HWND) 0));
|
---|
| 1282 | WinCheckMenuItem((HWND) mp2, IDM_TILEBACKWARDS, fTileBackwards);
|
---|
| 1283 | SetupWinList((HWND) mp2, hwnd, WinQueryWindow(hwnd, QW_PARENT));
|
---|
[133] | 1284 | break;
|
---|
| 1285 | }
|
---|
| 1286 | break;
|
---|
[2] | 1287 |
|
---|
[133] | 1288 | case WM_SETFOCUS:
|
---|
| 1289 | if (mp2)
|
---|
[551] | 1290 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
[133] | 1291 | break;
|
---|
[2] | 1292 |
|
---|
[133] | 1293 | case UM_FOCUSME:
|
---|
[299] | 1294 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[133] | 1295 | if (pd)
|
---|
[551] | 1296 | WinSetFocus(HWND_DESKTOP, pd->hwndCurr);
|
---|
[133] | 1297 | return 0;
|
---|
[2] | 1298 |
|
---|
[133] | 1299 | case UM_RESCAN:
|
---|
| 1300 | return 0;
|
---|
| 1301 |
|
---|
| 1302 | case UM_SIZE:
|
---|
| 1303 | {
|
---|
| 1304 | SWP swp;
|
---|
| 1305 |
|
---|
[551] | 1306 | if (WinQueryWindowPos(hwnd, &swp)) {
|
---|
[133] | 1307 | mp1 = MPFROM2SHORT(swp.cx, swp.cy);
|
---|
| 1308 | mp2 = MPFROM2SHORT(swp.cx, swp.cy);
|
---|
[2] | 1309 | }
|
---|
[133] | 1310 | else
|
---|
| 1311 | return 0;
|
---|
| 1312 | }
|
---|
[1673] | 1313 | // intentional fallthru
|
---|
[133] | 1314 | case WM_SIZE:
|
---|
[299] | 1315 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 1316 | if (mp1 && mp2 && pd && pd->hwndDir1 && pd->hwndDir2) {
|
---|
[133] | 1317 | if (hwndTree)
|
---|
| 1318 | WinSetWindowPos(hwndTree,
|
---|
| 1319 | HWND_TOP,
|
---|
| 1320 | 2,
|
---|
| 1321 | 2,
|
---|
| 1322 | TreeWidth - 4,
|
---|
| 1323 | SHORT2FROMMP(mp2) - 4,
|
---|
| 1324 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
| 1325 | else
|
---|
| 1326 | TreeWidth = 0;
|
---|
[551] | 1327 | if (!pd->hwndMax) {
|
---|
| 1328 | if (fTileBackwards) {
|
---|
| 1329 | WinSetWindowPos(pd->hwndDir1, HWND_TOP,
|
---|
[133] | 1330 | (((SHORT1FROMMP(mp2) - TreeWidth) / 2) +
|
---|
| 1331 | TreeWidth) + 2,
|
---|
| 1332 | 2,
|
---|
| 1333 | ((SHORT1FROMMP(mp2) - TreeWidth) / 2) - 4,
|
---|
| 1334 | SHORT2FROMMP(mp2) - 4,
|
---|
| 1335 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
[551] | 1336 | WinSetWindowPos(pd->hwndDir2, HWND_TOP,
|
---|
[133] | 1337 | TreeWidth + 2,
|
---|
| 1338 | 2,
|
---|
| 1339 | ((SHORT1FROMMP(mp2) - TreeWidth) / 2) - 4,
|
---|
| 1340 | SHORT2FROMMP(mp2) - 4,
|
---|
| 1341 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
| 1342 | }
|
---|
[551] | 1343 | else {
|
---|
| 1344 | WinSetWindowPos(pd->hwndDir1, HWND_TOP,
|
---|
[133] | 1345 | TreeWidth + 2,
|
---|
| 1346 | 2,
|
---|
| 1347 | (SHORT1FROMMP(mp2) - TreeWidth) - 4,
|
---|
| 1348 | (SHORT2FROMMP(mp2) / 2) - 4,
|
---|
| 1349 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
[551] | 1350 | WinSetWindowPos(pd->hwndDir2, HWND_TOP,
|
---|
[133] | 1351 | TreeWidth + 2,
|
---|
| 1352 | (SHORT2FROMMP(mp2) / 2) + 2,
|
---|
| 1353 | (SHORT1FROMMP(mp2) - TreeWidth) - 4,
|
---|
| 1354 | (SHORT2FROMMP(mp2) / 2) - 4,
|
---|
| 1355 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
| 1356 | }
|
---|
| 1357 | }
|
---|
[551] | 1358 | else {
|
---|
[2] | 1359 |
|
---|
[133] | 1360 | HWND hwndOther;
|
---|
[2] | 1361 |
|
---|
[551] | 1362 | WinSetWindowPos(pd->hwndMax, HWND_TOP,
|
---|
[133] | 1363 | TreeWidth + 2,
|
---|
| 1364 | 2,
|
---|
| 1365 | (SHORT1FROMMP(mp2) - TreeWidth) - 4,
|
---|
| 1366 | SHORT2FROMMP(mp2) - 4,
|
---|
| 1367 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
[551] | 1368 | hwndOther = (pd->hwndMax == pd->hwndDir1) ?
|
---|
| 1369 | pd->hwndDir2 : pd->hwndDir1;
|
---|
[133] | 1370 | WinSetWindowPos(hwndOther, HWND_BOTTOM, 0, 0, 0, 0, SWP_HIDE);
|
---|
[2] | 1371 | }
|
---|
[551] | 1372 | WinSendMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
|
---|
[133] | 1373 | }
|
---|
| 1374 | if (msg == UM_SIZE)
|
---|
[2] | 1375 | return 0;
|
---|
[133] | 1376 | break;
|
---|
[2] | 1377 |
|
---|
[133] | 1378 | case WM_ERASEBACKGROUND:
|
---|
[551] | 1379 | WinFillRect((HPS) mp1, (PRECTL) mp2, 0x00d0d0d0);
|
---|
[133] | 1380 | return 0;
|
---|
| 1381 |
|
---|
| 1382 | case WM_PAINT:
|
---|
| 1383 | {
|
---|
| 1384 | HPS hps;
|
---|
| 1385 | RECTL rcl;
|
---|
| 1386 |
|
---|
[551] | 1387 | hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
|
---|
| 1388 | if (hps) {
|
---|
[133] | 1389 | WinQueryWindowRect(hwnd, &rcl);
|
---|
[551] | 1390 | WinFillRect(hps, (PRECTL) & rcl, CLR_PALEGRAY);
|
---|
[133] | 1391 | WinEndPaint(hps);
|
---|
[551] | 1392 | WinSendMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
|
---|
[2] | 1393 | }
|
---|
[133] | 1394 | }
|
---|
| 1395 | break;
|
---|
[2] | 1396 |
|
---|
[133] | 1397 | case UM_COMMAND:
|
---|
| 1398 | case WM_COMMAND:
|
---|
| 1399 | return MainWMCommand2(hwnd, msg, mp1, mp2);
|
---|
[2] | 1400 |
|
---|
[133] | 1401 | case WM_CLOSE:
|
---|
| 1402 | fAmClosing = TRUE;
|
---|
[551] | 1403 | WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
---|
[133] | 1404 | CloseChildren(hwnd);
|
---|
[551] | 1405 | PostMsg(hwnd, UM_CLOSE, MPVOID, MPVOID);
|
---|
[1858] | 1406 | fAmQuitting = TRUE; // Let world know quit in progress
|
---|
[771] | 1407 | DosSleep(1);
|
---|
[1700] | 1408 | return 0; // Suppress WinDefWindowProc WM_QUIT message generation
|
---|
[2] | 1409 |
|
---|
[133] | 1410 | case UM_CLOSE:
|
---|
| 1411 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
---|
| 1412 | return 0;
|
---|
[2] | 1413 |
|
---|
[133] | 1414 | case WM_DESTROY:
|
---|
[551] | 1415 | hwndMain = (HWND) 0;
|
---|
[299] | 1416 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[1009] | 1417 | xfree(pd, pszSrcFile, __LINE__);
|
---|
[551] | 1418 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
| 1419 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
---|
[133] | 1420 | break;
|
---|
[2] | 1421 | }
|
---|
[133] | 1422 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 1423 | }
|
---|
| 1424 |
|
---|
[133] | 1425 | HWND StartFM32(HAB hab, INT argc, CHAR ** argv)
|
---|
| 1426 | {
|
---|
| 1427 | HWND hwndFrame, hwndClient;
|
---|
| 1428 | ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
|
---|
[551] | 1429 | FCF_SIZEBORDER | FCF_MINMAX |
|
---|
| 1430 | FCF_ACCELTABLE | FCF_MENU | FCF_ICON | FCF_TASKLIST | FCF_NOBYTEALIGN;
|
---|
[2] | 1431 |
|
---|
| 1432 | {
|
---|
| 1433 | INT x;
|
---|
| 1434 |
|
---|
[551] | 1435 | for (x = 1; x < argc; x++) {
|
---|
[133] | 1436 | if (*argv[x] == '+' && !argv[x][1])
|
---|
| 1437 | fLogFile = TRUE;
|
---|
[551] | 1438 | if (*argv[x] == '-') {
|
---|
[133] | 1439 | if (argv[x][1])
|
---|
| 1440 | strcpy(profile, &argv[x][1]);
|
---|
[2] | 1441 | }
|
---|
| 1442 | }
|
---|
| 1443 | }
|
---|
| 1444 | {
|
---|
[133] | 1445 | CHAR inipath[CCHMAXPATH], fullpath[CCHMAXPATH];
|
---|
[843] | 1446 | FILESTATUS3 fsa;
|
---|
[2] | 1447 |
|
---|
[133] | 1448 | if (PrfQueryProfileString(HINI_USERPROFILE,
|
---|
[1498] | 1449 | (CHAR *) FM2Str,
|
---|
[551] | 1450 | "Home", NULL, inipath, sizeof(inipath))) {
|
---|
[843] | 1451 | if (!DosQueryPathInfo(inipath, FIL_STANDARD, &fsa, sizeof(fsa))) {
|
---|
[551] | 1452 | if (fsa.attrFile & FILE_DIRECTORY) {
|
---|
[133] | 1453 | if (DosQueryPathInfo(inipath,
|
---|
[551] | 1454 | FIL_QUERYFULLNAME, fullpath, sizeof(fullpath)))
|
---|
[133] | 1455 | strcpy(fullpath, inipath);
|
---|
| 1456 | switch_to(fullpath);
|
---|
| 1457 | }
|
---|
[2] | 1458 | }
|
---|
| 1459 | }
|
---|
| 1460 | }
|
---|
| 1461 |
|
---|
| 1462 | hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
|
---|
[133] | 1463 | WS_VISIBLE,
|
---|
| 1464 | &FrameFlags,
|
---|
[1498] | 1465 | (CHAR *) WC_MAINWND2,
|
---|
[133] | 1466 | NULL,
|
---|
| 1467 | WS_VISIBLE | WS_ANIMATE,
|
---|
[551] | 1468 | FM3ModHandle, MAIN2_FRAME, &hwndClient);
|
---|
| 1469 | if (hwndFrame) {
|
---|
[875] | 1470 | hwndMainMenu = WinWindowFromID(hwndFrame, FID_MENU);
|
---|
[1498] | 1471 | if (!WinRestoreWindowPos((CHAR *) FM2Str, "MainWindowPos2", hwndFrame)) {
|
---|
[2] | 1472 |
|
---|
[133] | 1473 | ULONG fl = SWP_MOVE | SWP_SIZE;
|
---|
[2] | 1474 | RECTL rcl;
|
---|
[133] | 1475 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 3L;
|
---|
| 1476 | ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
|
---|
[2] | 1477 |
|
---|
[133] | 1478 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
---|
[2] | 1479 | rcl.yBottom += icz;
|
---|
| 1480 | rcl.yTop -= bsz;
|
---|
| 1481 | rcl.xLeft += bsz;
|
---|
| 1482 | rcl.xRight -= bsz;
|
---|
| 1483 | WinSetWindowPos(hwndFrame,
|
---|
[133] | 1484 | HWND_TOP,
|
---|
| 1485 | rcl.xLeft,
|
---|
| 1486 | rcl.yBottom,
|
---|
[551] | 1487 | rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, fl);
|
---|
[2] | 1488 | }
|
---|
[1544] | 1489 | if (fLogFile) {
|
---|
| 1490 | CHAR *modea = "a+";
|
---|
| 1491 |
|
---|
| 1492 | LogFileHandle = xfsopen("FM2.LOG", modea, SH_DENYWR, pszSrcFile, __LINE__, TRUE);
|
---|
| 1493 | }
|
---|
[133] | 1494 | if (hwndHelp)
|
---|
| 1495 | WinAssociateHelpInstance(hwndHelp, hwndFrame);
|
---|
[551] | 1496 | PostMsg(hwndClient, UM_SETUP, MPFROMLONG(argc), MPFROMP(argv));
|
---|
[2] | 1497 | }
|
---|
| 1498 | return hwndFrame;
|
---|
| 1499 | }
|
---|
[793] | 1500 |
|
---|
| 1501 | #pragma alloc_text(PERSON11,MainFrameWndProc2,MainWndProc2)
|
---|
| 1502 | #pragma alloc_text(PERSON12,StartFM32,MainWMOnce2)
|
---|
| 1503 | #pragma alloc_text(PERSON13,MainWMCommand2)
|
---|