[133] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: mainwnd2.c 1778 2014-06-26 22:30:54Z 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
|
---|
[672] | 44 |
|
---|
[133] | 45 | ***********************************************************************/
|
---|
| 46 |
|
---|
[907] | 47 | #include <stdlib.h>
|
---|
| 48 | #include <string.h>
|
---|
| 49 | #include <share.h>
|
---|
[1335] | 50 | // #include <process.h> // _beginthread
|
---|
[907] | 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
|
---|
[2] | 464 | // case IDM_SYSINFO:
|
---|
[133] | 465 | case IDM_HIDENOTEWND:
|
---|
| 466 | case IDM_SHOWNOTEWND:
|
---|
| 467 | case IDM_INSTANT:
|
---|
| 468 | case IDM_HELPCONTEXT:
|
---|
| 469 | case IDM_HELPHINTS:
|
---|
| 470 | case IDM_HELPPIX:
|
---|
| 471 | case IDM_KILLME:
|
---|
| 472 | case IDM_EXIT:
|
---|
| 473 | case IDM_HELPTUTOR:
|
---|
| 474 | case IDM_HELPCONTENTS:
|
---|
| 475 | case IDM_HELPGENERAL:
|
---|
| 476 | case IDM_HELPKEYS:
|
---|
| 477 | case IDM_HELPMOUSE:
|
---|
| 478 | case IDM_HELP:
|
---|
[1416] | 479 | case IDM_FONTPALETTE:
|
---|
| 480 | case IDM_HICOLORPALETTE:
|
---|
| 481 | case IDM_COLORPALETTE:
|
---|
| 482 | case IDM_SYSTEMCLOCK:
|
---|
[133] | 483 | return MainWMCommand(hwnd, msg, mp1, mp2);
|
---|
[2] | 484 |
|
---|
[133] | 485 | case IDM_REMAP:
|
---|
| 486 | WinDlgBox(HWND_DESKTOP,
|
---|
[551] | 487 | hwnd, RemapDlgProc, FM3ModHandle, MAP_FRAME, NULL);
|
---|
[133] | 488 | break;
|
---|
[2] | 489 |
|
---|
[551] | 490 | case IDM_TWODIRS: // Menu action
|
---|
| 491 | case IDM_WINDOWDLG: // Toolbar action
|
---|
[299] | 492 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 493 | if (pd) {
|
---|
[2] | 494 |
|
---|
[133] | 495 | WALK2 wa;
|
---|
[2] | 496 |
|
---|
[133] | 497 | memset(&wa, 0, sizeof(wa));
|
---|
| 498 | wa.size = sizeof(wa);
|
---|
| 499 | *wa.szCurrentPath1 = 0;
|
---|
[551] | 500 | WinSendMsg(pd->hwndDir1,
|
---|
| 501 | UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath1), MPVOID);
|
---|
[133] | 502 | MakeValidDir(wa.szCurrentPath1);
|
---|
| 503 | *wa.szCurrentPath2 = 0;
|
---|
[551] | 504 | WinSendMsg(pd->hwndDir2,
|
---|
| 505 | UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath2), MPVOID);
|
---|
[133] | 506 | MakeValidDir(wa.szCurrentPath2);
|
---|
| 507 | if (WinDlgBox(HWND_DESKTOP,
|
---|
| 508 | hwnd,
|
---|
| 509 | WalkTwoSetDlgProc,
|
---|
| 510 | FM3ModHandle,
|
---|
| 511 | WALK2_FRAME,
|
---|
| 512 | MPFROMP(&wa)) &&
|
---|
| 513 | (IsRoot(wa.szCurrentPath1) ||
|
---|
| 514 | !IsFile(wa.szCurrentPath1)) &&
|
---|
[551] | 515 | (IsRoot(wa.szCurrentPath2) || !IsFile(wa.szCurrentPath2))) {
|
---|
| 516 | WinSendMsg(WinWindowFromID(WinWindowFromID(pd->hwndDir1,
|
---|
[133] | 517 | FID_CLIENT), DIR_CNR),
|
---|
[551] | 518 | UM_SETDIR, MPFROMP(wa.szCurrentPath1), MPVOID);
|
---|
| 519 | WinSendMsg(WinWindowFromID(WinWindowFromID(pd->hwndDir2,
|
---|
[133] | 520 | FID_CLIENT), DIR_CNR),
|
---|
[551] | 521 | UM_SETDIR, MPFROMP(wa.szCurrentPath2), MPVOID);
|
---|
[2] | 522 | }
|
---|
[133] | 523 | }
|
---|
| 524 | break;
|
---|
[2] | 525 |
|
---|
[133] | 526 | case IDM_COMPARE:
|
---|
[299] | 527 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 528 | if (pd) {
|
---|
[2] | 529 |
|
---|
[133] | 530 | WALK2 wa;
|
---|
[2] | 531 |
|
---|
[133] | 532 | memset(&wa, 0, sizeof(wa));
|
---|
| 533 | wa.size = sizeof(wa);
|
---|
| 534 | *wa.szCurrentPath1 = 0;
|
---|
[551] | 535 | WinSendMsg(pd->hwndDir1,
|
---|
| 536 | UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath1), MPVOID);
|
---|
[133] | 537 | MakeValidDir(wa.szCurrentPath1);
|
---|
| 538 | *wa.szCurrentPath2 = 0;
|
---|
[551] | 539 | WinSendMsg(pd->hwndDir2,
|
---|
| 540 | UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath2), MPVOID);
|
---|
[133] | 541 | MakeValidDir(wa.szCurrentPath2);
|
---|
| 542 | if (WinDlgBox(HWND_DESKTOP,
|
---|
| 543 | hwnd,
|
---|
| 544 | WalkTwoCmpDlgProc,
|
---|
| 545 | FM3ModHandle,
|
---|
| 546 | WALK2_FRAME,
|
---|
| 547 | MPFROMP(&wa)) &&
|
---|
| 548 | (IsRoot(wa.szCurrentPath1) ||
|
---|
| 549 | !IsFile(wa.szCurrentPath1)) &&
|
---|
[551] | 550 | (IsRoot(wa.szCurrentPath2) || !IsFile(wa.szCurrentPath2))) {
|
---|
| 551 | if (!*dircompare) {
|
---|
[2] | 552 |
|
---|
[133] | 553 | COMPARE *cmp;
|
---|
[2] | 554 |
|
---|
[551] | 555 | cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
|
---|
[352] | 556 | if (cmp) {
|
---|
[551] | 557 | cmp->size = sizeof(COMPARE);
|
---|
| 558 | strcpy(cmp->leftdir, wa.szCurrentPath1);
|
---|
| 559 | strcpy(cmp->rightdir, wa.szCurrentPath2);
|
---|
[1777] | 560 | cmp->listfile = wa.listfile;
|
---|
| 561 | cmp->includesubdirs = wa.includesubdirs;
|
---|
[551] | 562 | cmp->hwndParent = hwnd;
|
---|
| 563 | cmp->dcd.hwndParent = hwnd;
|
---|
[133] | 564 | WinDlgBox(HWND_DESKTOP,
|
---|
| 565 | HWND_DESKTOP,
|
---|
[551] | 566 | CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
|
---|
[133] | 567 | }
|
---|
| 568 | }
|
---|
[551] | 569 | else {
|
---|
[773] | 570 | CHAR szPath1[CCHMAXPATH];
|
---|
| 571 | CHAR szPath2[CCHMAXPATH];
|
---|
[133] | 572 | runemf2(SEPARATE,
|
---|
[917] | 573 | HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 574 | NULL, NULL,
|
---|
[773] | 575 | "%s %s %s",
|
---|
[133] | 576 | dircompare,
|
---|
[773] | 577 | BldQuotedFileName(szPath1, wa.szCurrentPath1),
|
---|
| 578 | BldQuotedFileName(szPath2, wa.szCurrentPath2));
|
---|
[133] | 579 | }
|
---|
[2] | 580 | }
|
---|
[133] | 581 | }
|
---|
| 582 | break;
|
---|
[2] | 583 |
|
---|
[133] | 584 | case IDM_VTREE:
|
---|
[551] | 585 | WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
|
---|
| 586 | if (hwndTree) {
|
---|
[1778] | 587 | // Hide
|
---|
[133] | 588 | WinShowWindow(hwndTree, FALSE);
|
---|
[551] | 589 | PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID);
|
---|
[1778] | 590 | hwndTree = NULLHANDLE;
|
---|
[133] | 591 | }
|
---|
[551] | 592 | else {
|
---|
[1778] | 593 | // Create tree window if needed and make visible
|
---|
[133] | 594 | ULONG size = sizeof(ULONG);
|
---|
| 595 | hwndTree = StartTreeCnr(hwnd, 3);
|
---|
[1778] | 596 | PrfQueryProfileData(fmprof, realappname,
|
---|
| 597 | "FM/4 TreeWidth", (PVOID)&TreeWidth, &size);
|
---|
[133] | 598 | TreeWidth = max(TreeWidth, 80);
|
---|
| 599 | }
|
---|
[1778] | 600 | yes = hwndTree != NULLHANDLE;
|
---|
| 601 | PrfWriteProfileData(fmprof, realappname,
|
---|
| 602 | "FM/4 TreeUp", (PVOID)&yes, sizeof(yes));
|
---|
[551] | 603 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
[133] | 604 | break;
|
---|
[2] | 605 |
|
---|
[133] | 606 | case IDM_TILEBACKWARDS:
|
---|
[551] | 607 | WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
|
---|
[133] | 608 | fTileBackwards = (fTileBackwards) ? FALSE : TRUE;
|
---|
| 609 | PrfWriteProfileData(fmprof,
|
---|
[1506] | 610 | FM3Str,
|
---|
[133] | 611 | "TileBackwards",
|
---|
[551] | 612 | (PVOID) & fTileBackwards, sizeof(BOOL));
|
---|
| 613 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
[133] | 614 | break;
|
---|
[2] | 615 |
|
---|
[133] | 616 | case IDM_NEXTWINDOW:
|
---|
| 617 | case IDM_PREVWINDOW:
|
---|
[299] | 618 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 619 | if (pd) {
|
---|
[2] | 620 |
|
---|
[133] | 621 | HWND hwndFocus;
|
---|
| 622 |
|
---|
[551] | 623 | if (hwndTree) {
|
---|
| 624 | if (pd->hwndMax) {
|
---|
| 625 | if (hwndTree == pd->hwndCurr)
|
---|
| 626 | hwndFocus = pd->hwndMax;
|
---|
[133] | 627 | else
|
---|
| 628 | hwndFocus = hwndTree;
|
---|
| 629 | }
|
---|
[551] | 630 | else {
|
---|
| 631 | if (hwndTree == pd->hwndCurr)
|
---|
[133] | 632 | hwndFocus = (SHORT1FROMMP(mp1) == IDM_PREVWINDOW) ?
|
---|
[551] | 633 | pd->hwndDir1 : pd->hwndDir2;
|
---|
| 634 | else if (pd->hwndDir1 == pd->hwndCurr)
|
---|
[133] | 635 | hwndFocus = (SHORT1FROMMP(mp1) == IDM_PREVWINDOW) ?
|
---|
[551] | 636 | pd->hwndDir2 : hwndTree;
|
---|
[133] | 637 | else
|
---|
| 638 | hwndFocus = (SHORT1FROMMP(mp1) == IDM_PREVWINDOW) ?
|
---|
[551] | 639 | hwndTree : pd->hwndDir1;
|
---|
[133] | 640 | }
|
---|
[2] | 641 | }
|
---|
[551] | 642 | else {
|
---|
| 643 | if (pd->hwndMax)
|
---|
| 644 | hwndFocus = pd->hwndMax;
|
---|
[133] | 645 | else
|
---|
[953] | 646 | hwndFocus = pd->hwndCurr == pd->hwndDir1 ?
|
---|
| 647 | pd->hwndDir2 : pd->hwndDir1;
|
---|
[133] | 648 | }
|
---|
| 649 | WinSetFocus(HWND_DESKTOP, hwndFocus);
|
---|
| 650 | }
|
---|
| 651 | break;
|
---|
[2] | 652 |
|
---|
[133] | 653 | case IDM_NOTEBOOK:
|
---|
[953] | 654 | case IDM_DIRCNRSETTINGS:
|
---|
| 655 | case IDM_DIRVIEWSETTINGS:
|
---|
| 656 | case IDM_DIRSORTSETTINGS:
|
---|
| 657 | case IDM_COLLECTORVIEWSETTINGS:
|
---|
| 658 | case IDM_COLLECTORSORTSETTINGS:
|
---|
| 659 | case IDM_ARCHIVERSETTINGS:
|
---|
| 660 | case IDM_TREECNRVIEWSETTINGS:
|
---|
| 661 | case IDM_TREECNRSORTSETTINGS:
|
---|
| 662 | case IDM_VIEWERSETTINGS:
|
---|
| 663 | case IDM_VIEWERSETTINGS2:
|
---|
| 664 | case IDM_COMPARESETTINGS:
|
---|
| 665 | case IDM_MONOLITHICSETTINGS:
|
---|
| 666 | case IDM_GENERALSETTINGS:
|
---|
| 667 | case IDM_SCANSETTINGS:
|
---|
| 668 | case IDM_BUBBLESSETTINGS:
|
---|
[133] | 669 | WinDlgBox(HWND_DESKTOP,
|
---|
| 670 | hwnd,
|
---|
[917] | 671 | CfgDlgProc,
|
---|
| 672 | FM3ModHandle,
|
---|
| 673 | CFG_FRAME,
|
---|
[953] | 674 | MPFROMLONG(mp1)); // 15 Feb 08 SHL
|
---|
[551] | 675 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
[133] | 676 | break;
|
---|
[2] | 677 |
|
---|
[133] | 678 | case IDM_SEEALL:
|
---|
| 679 | case IDM_GREP:
|
---|
| 680 | case IDM_COLLECTOR:
|
---|
| 681 | {
|
---|
| 682 | HWND hwndC;
|
---|
| 683 |
|
---|
| 684 | hwndC = StartCollector(HWND_DESKTOP, 4);
|
---|
[551] | 685 | if (hwndC) {
|
---|
[133] | 686 | WinSetWindowPos(hwndC,
|
---|
| 687 | HWND_TOP,
|
---|
[551] | 688 | 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | SWP_ACTIVATE);
|
---|
[133] | 689 | if (SHORT1FROMMP(mp1) == IDM_GREP)
|
---|
| 690 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT),
|
---|
[551] | 691 | WM_COMMAND, MPFROM2SHORT(IDM_GREP, 0), MPVOID);
|
---|
[133] | 692 | if (SHORT1FROMMP(mp1) == IDM_SEEALL)
|
---|
| 693 | PostMsg(WinWindowFromID(hwndC, FID_CLIENT),
|
---|
[551] | 694 | WM_COMMAND, MPFROM2SHORT(IDM_SEEALL, 0), MPVOID);
|
---|
[2] | 695 | }
|
---|
[133] | 696 | }
|
---|
| 697 | break;
|
---|
[2] | 698 |
|
---|
[133] | 699 | case IDM_EDITCOMMANDS:
|
---|
| 700 | EditCommands(hwnd);
|
---|
| 701 | break;
|
---|
| 702 |
|
---|
| 703 | default:
|
---|
| 704 | if (SHORT1FROMMP(mp1) >= IDM_SWITCHSTART &&
|
---|
[551] | 705 | SHORT1FROMMP(mp1) < IDM_SWITCHSTART + 499) {
|
---|
[133] | 706 | if (SHORT1FROMMP(mp1) - IDM_SWITCHSTART < numswitches)
|
---|
[551] | 707 | WinSwitchToProgram(switches[SHORT1FROMMP(mp1) - IDM_SWITCHSTART]);
|
---|
[2] | 708 | break;
|
---|
[133] | 709 | }
|
---|
| 710 | else if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
|
---|
[551] | 711 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
|
---|
[2] | 712 |
|
---|
[133] | 713 | INT x;
|
---|
| 714 | HWND hwndCnr;
|
---|
| 715 |
|
---|
| 716 | if (!cmdloaded)
|
---|
| 717 | load_commands();
|
---|
[551] | 718 | hwndCnr = TopWindow(hwnd, (HWND) 0);
|
---|
| 719 | hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT),
|
---|
| 720 | UM_CONTAINERHWND, MPVOID, MPVOID);
|
---|
| 721 | if (!hwndCnr) {
|
---|
[1398] | 722 | Runtime_Error(pszSrcFile, __LINE__, NULL);
|
---|
[133] | 723 | break;
|
---|
[2] | 724 | }
|
---|
[1486] | 725 | x = SHORT1FROMMP(mp1);// - IDM_COMMANDSTART;
|
---|
[551] | 726 | if (x >= 0) {
|
---|
[1486] | 727 | //x++;
|
---|
[133] | 728 | RunCommand(hwndCnr, x);
|
---|
[551] | 729 | if (fUnHilite) {
|
---|
[2] | 730 |
|
---|
[133] | 731 | PCNRITEM pci;
|
---|
| 732 | DIRCNRDATA *dcd = NULL;
|
---|
[2] | 733 |
|
---|
[133] | 734 | if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR)
|
---|
| 735 | dcd = INSTDATA(hwndCnr);
|
---|
| 736 | pci = (PCNRITEM) WinSendMsg(hwndCnr,
|
---|
| 737 | CM_QUERYRECORDEMPHASIS,
|
---|
| 738 | MPFROMLONG(CMA_FIRST),
|
---|
| 739 | MPFROMSHORT(CRA_CURSORED));
|
---|
[672] | 740 | if (pci && (INT) pci != -1 && (pci->rc.flRecordAttr & CRA_SELECTED)) {
|
---|
| 741 | UnHilite(hwnd,
|
---|
| 742 | TRUE,
|
---|
| 743 | dcd ? &dcd->lastselection : NULL,
|
---|
| 744 | dcd ? dcd->ulItemsToUnHilite : 0);
|
---|
| 745 | }
|
---|
[133] | 746 | }
|
---|
[2] | 747 | }
|
---|
[133] | 748 | }
|
---|
| 749 | else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART &&
|
---|
[1131] | 750 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 51) {
|
---|
[133] | 751 | if (!qtloaded)
|
---|
| 752 | load_quicktools();
|
---|
[1131] | 753 | if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]) {
|
---|
[133] | 754 | if (fToolsChanged)
|
---|
| 755 | save_tools(NULL);
|
---|
[1131] | 756 | if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]))
|
---|
[133] | 757 | load_tools(NULL);
|
---|
[551] | 758 | else {
|
---|
[1125] | 759 | strcpy(lasttoolbar,
|
---|
[1131] | 760 | quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]);
|
---|
[1128] | 761 | PrfWriteProfileString(fmprof, appname, "LastToolbar", lasttoolbar);
|
---|
[133] | 762 | }
|
---|
[1125] | 763 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
---|
[2] | 764 | }
|
---|
[133] | 765 | }
|
---|
[551] | 766 | else {
|
---|
[2] | 767 |
|
---|
[133] | 768 | HWND hwndActive;
|
---|
[2] | 769 |
|
---|
[551] | 770 | hwndActive = TopWindow(hwnd, (HWND) 0);
|
---|
[133] | 771 | if (hwndActive)
|
---|
[551] | 772 | PostMsg(WinWindowFromID(hwndActive, FID_CLIENT), msg, mp1, mp2);
|
---|
[133] | 773 | }
|
---|
| 774 | break;
|
---|
[2] | 775 | }
|
---|
| 776 | return 0;
|
---|
| 777 | }
|
---|
| 778 |
|
---|
[551] | 779 | static MRESULT EXPENTRY MainWMOnce2(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
| 780 | MPARAM mp2)
|
---|
[133] | 781 | {
|
---|
[2] | 782 | PERSON1DATA *pd;
|
---|
[1777] | 783 | TID tid;
|
---|
| 784 | SWP swp;
|
---|
| 785 | PFNWP oldproc;
|
---|
| 786 | HWND hwndMenu;
|
---|
| 787 | DIRCNRDATA *dcd;
|
---|
| 788 | HWND hwndC;
|
---|
| 789 | ULONG which;
|
---|
| 790 | ULONG size;
|
---|
[1778] | 791 | BOOL yes;
|
---|
[2] | 792 |
|
---|
[551] | 793 | switch (msg) {
|
---|
[133] | 794 | case WM_CREATE:
|
---|
[1777] | 795 | WinQueryWindowProcess(hwnd, &mypid, &tid);
|
---|
| 796 | hwndMain = hwnd;
|
---|
[2] | 797 |
|
---|
[133] | 798 | WinSetWindowUShort(hwnd, QWL_USER + 8, 0);
|
---|
| 799 | WinSetWindowUShort(hwnd, QWL_USER + 10, 0);
|
---|
| 800 | WinSetWindowUShort(hwnd, QWL_USER + 12, 0);
|
---|
| 801 | WinSetWindowUShort(hwnd, QWL_USER + 16, 0);
|
---|
[1335] | 802 | if (xbeginthread(MakeMainObjWin,
|
---|
| 803 | 245760,
|
---|
| 804 | MPVOID,
|
---|
| 805 | pszSrcFile,
|
---|
| 806 | __LINE__) == -1)
|
---|
| 807 | {
|
---|
[551] | 808 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
[133] | 809 | return 0;
|
---|
| 810 | }
|
---|
| 811 | else
|
---|
[771] | 812 | DosSleep(32);//05 Aug 07 GKY 64
|
---|
[2] | 813 |
|
---|
[551] | 814 | pd = xmallocz(sizeof(PERSON1DATA), pszSrcFile, __LINE__);
|
---|
[133] | 815 | if (!pd)
|
---|
| 816 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
---|
[352] | 817 | else {
|
---|
[551] | 818 | pd->size = sizeof(PERSON1DATA);
|
---|
| 819 | WinSetWindowPtr(hwnd, QWL_USER + 4, (PVOID) pd);
|
---|
[133] | 820 | }
|
---|
[2] | 821 |
|
---|
[1777] | 822 | // create frame children (not client children, frame children)
|
---|
| 823 | DosSleep(1);
|
---|
| 824 | WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
|
---|
| 825 | oldproc = WinSubclassWindow(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 826 | (PFNWP) MainFrameWndProc2);
|
---|
| 827 | if (oldproc)
|
---|
| 828 | WinSetWindowPtr(WinQueryWindow(hwnd, QW_PARENT), QWL_USER, (PVOID) oldproc);
|
---|
[2] | 829 |
|
---|
[1777] | 830 | CommonCreateMainChildren(hwnd, &swp);
|
---|
[2] | 831 |
|
---|
[1777] | 832 | hwndMenu = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_MENU);
|
---|
| 833 | WinSetWindowULong(hwnd, QWL_USER, hwndMenu);
|
---|
| 834 |
|
---|
| 835 | // 2014-05-15 SHL FIXME to be sure needed
|
---|
| 836 | // WinCheckMenuItem(hwndMenu, IDM_TOGGLEDRAGDIALOG, fDragndropDlg); // 2014-05-15 SHL
|
---|
| 837 |
|
---|
| 838 | CfgMenuInit(hwndMenu, FALSE); // 14 Feb 08 SHL
|
---|
| 839 | SetConditionalCascade(hwndMenu, IDM_COMMANDLINESUBMENU, IDM_COMMANDLINE);
|
---|
| 840 |
|
---|
| 841 | if (fProtectOnly) {
|
---|
| 842 | WinEnableMenuItem(hwndMenu, IDM_DOSCOMMANDLINE, FALSE);
|
---|
| 843 | WinEnableMenuItem(hwndMenu, IDM_WINFULLSCREEN, FALSE);
|
---|
[133] | 844 | }
|
---|
[1777] | 845 |
|
---|
| 846 | SetConditionalCascade(hwndMenu, IDM_COMMANDSMENU, IDM_DOITYOURSELF);
|
---|
| 847 | SetConditionalCascade(hwndMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
|
---|
| 848 |
|
---|
[133] | 849 | WinSetWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
[551] | 850 | FID_TITLEBAR), "FM/2 Lite");
|
---|
[1777] | 851 |
|
---|
[551] | 852 | FixSwitchList(WinQueryWindow(hwnd, QW_PARENT), NULL);
|
---|
| 853 | SetSysMenu(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_SYSMENU));
|
---|
[133] | 854 | break;
|
---|
[2] | 855 |
|
---|
[133] | 856 | case UM_SETUP:
|
---|
[299] | 857 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 858 | if (pd) {
|
---|
[133] | 859 | CHAR s[CCHMAXPATH];
|
---|
[1778] | 860 | yes = TRUE;
|
---|
[133] | 861 | size = sizeof(BOOL);
|
---|
[1778] | 862 | PrfQueryProfileData(fmprof, realappname,
|
---|
| 863 | "FM/4 TreeUp", (PVOID)&yes, &size);
|
---|
| 864 | if (yes) {
|
---|
[133] | 865 | hwndTree = StartTreeCnr(hwnd, 3);
|
---|
[1778] | 866 | size = sizeof(TreeWidth);
|
---|
[1777] | 867 | PrfQueryProfileData(fmprof, realappname, "FM/4 TreeWidth",
|
---|
[1778] | 868 | (PVOID)&TreeWidth, &size);
|
---|
[133] | 869 | TreeWidth = max(TreeWidth, 80);
|
---|
| 870 | }
|
---|
| 871 | size = sizeof(BOOL);
|
---|
[1778] | 872 | if (PrfQueryProfileData(fmprof, appname, "Toolbar", &yes, &size) &&
|
---|
| 873 | size &&
|
---|
| 874 | !yes)
|
---|
| 875 | {
|
---|
[551] | 876 | WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
|
---|
[1778] | 877 | }
|
---|
[2] | 878 |
|
---|
[133] | 879 | size = sizeof(s);
|
---|
| 880 | *s = 0;
|
---|
[1482] | 881 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir1", s, &size) && *s)
|
---|
[133] | 882 | MakeValidDir(s);
|
---|
| 883 | else
|
---|
| 884 | save_dir(s);
|
---|
[551] | 885 | pd->hwndLastDir = pd->hwndCurr = pd->hwndDir1 =
|
---|
| 886 | StartDirCnr(hwnd, s, (HWND) 0, 3);
|
---|
[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);
|
---|
| 894 | WinSetFocus(HWND_DESKTOP, pd->hwndCurr);
|
---|
[2] | 895 |
|
---|
[551] | 896 | hwndC = WinWindowFromID(pd->hwndDir1, FID_CLIENT);
|
---|
| 897 | if (hwndC) {
|
---|
[299] | 898 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
[551] | 899 | if (dcd) {
|
---|
[133] | 900 | size = sizeof(INT);
|
---|
[1482] | 901 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir1.Sort",
|
---|
[551] | 902 | (PVOID) & dcd->sortFlags,
|
---|
| 903 | &size) && size == sizeof(INT)) {
|
---|
| 904 | if (!dcd->sortFlags)
|
---|
| 905 | dcd->sortFlags = SORT_PATHNAME;
|
---|
[133] | 906 | }
|
---|
| 907 | size = sizeof(MASK);
|
---|
[1482] | 908 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir1.Filter",
|
---|
[551] | 909 | (PVOID) & dcd->mask, &size) && size) {
|
---|
| 910 | if (*dcd->mask.szMask)
|
---|
[133] | 911 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
[551] | 912 | UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
|
---|
[133] | 913 | }
|
---|
[551] | 914 | *(dcd->mask.prompt) = 0;
|
---|
[133] | 915 | size = sizeof(ULONG);
|
---|
[1482] | 916 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir1.View",
|
---|
[551] | 917 | (PVOID) & dcd->flWindowAttr,
|
---|
| 918 | &size) && size == sizeof(ULONG)) {
|
---|
[2] | 919 |
|
---|
[133] | 920 | CNRINFO cnri;
|
---|
[2] | 921 |
|
---|
[133] | 922 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 923 | cnri.cb = sizeof(CNRINFO);
|
---|
| 924 | if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
| 925 | CM_QUERYCNRINFO,
|
---|
[551] | 926 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)))) {
|
---|
| 927 | cnri.flWindowAttr = dcd->flWindowAttr;
|
---|
[133] | 928 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
| 929 | CM_SETCNRINFO,
|
---|
[551] | 930 | MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));
|
---|
[133] | 931 | }
|
---|
| 932 | }
|
---|
| 933 | }
|
---|
| 934 | }
|
---|
[2] | 935 |
|
---|
[551] | 936 | hwndC = WinWindowFromID(pd->hwndDir2, FID_CLIENT);
|
---|
| 937 | if (hwndC) {
|
---|
[299] | 938 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
[551] | 939 | if (dcd) {
|
---|
[133] | 940 | size = sizeof(INT);
|
---|
[1482] | 941 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir2.Sort",
|
---|
[551] | 942 | (PVOID) & dcd->sortFlags,
|
---|
| 943 | &size) && size == sizeof(INT)) {
|
---|
| 944 | if (!dcd->sortFlags)
|
---|
| 945 | dcd->sortFlags = SORT_PATHNAME;
|
---|
[133] | 946 | }
|
---|
| 947 | size = sizeof(MASK);
|
---|
[1482] | 948 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir2.Filter",
|
---|
[551] | 949 | (PVOID) & dcd->mask, &size) && size) {
|
---|
| 950 | if (*dcd->mask.szMask)
|
---|
[133] | 951 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
[551] | 952 | UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
|
---|
[133] | 953 | }
|
---|
[551] | 954 | *(dcd->mask.prompt) = 0;
|
---|
[133] | 955 | size = sizeof(ULONG);
|
---|
[1482] | 956 | if (PrfQueryProfileData(fmprof, realappname, "FM/4 Dir2.View",
|
---|
[551] | 957 | (PVOID) & dcd->flWindowAttr,
|
---|
| 958 | &size) && size == sizeof(ULONG)) {
|
---|
[2] | 959 |
|
---|
[133] | 960 | CNRINFO cnri;
|
---|
[2] | 961 |
|
---|
[133] | 962 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 963 | cnri.cb = sizeof(CNRINFO);
|
---|
| 964 | if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
| 965 | CM_QUERYCNRINFO,
|
---|
[551] | 966 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)))) {
|
---|
| 967 | cnri.flWindowAttr = dcd->flWindowAttr;
|
---|
[133] | 968 | WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
|
---|
| 969 | CM_SETCNRINFO,
|
---|
[551] | 970 | MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));
|
---|
[133] | 971 | }
|
---|
| 972 | }
|
---|
| 973 | }
|
---|
[2] | 974 | }
|
---|
[133] | 975 | }
|
---|
[1777] | 976 | // 2014-06-11 SHL Initialize view, sort and filter button text
|
---|
| 977 | if (pd->hwndDir1) {
|
---|
| 978 | hwndC = WinWindowFromID(pd->hwndDir1, FID_CLIENT);
|
---|
| 979 | if (hwndC) {
|
---|
| 980 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
| 981 | if (dcd && dcd->hwndCnr)
|
---|
| 982 | PostMsg(dcd->hwndCnr, UM_SETUP2, MPVOID, MPVOID);
|
---|
[2] | 983 | }
|
---|
[133] | 984 | }
|
---|
[1777] | 985 | if (pd->hwndDir2) {
|
---|
| 986 | hwndC = WinWindowFromID(pd->hwndDir2, FID_CLIENT);
|
---|
| 987 | if (hwndC) {
|
---|
| 988 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
| 989 | if (dcd && dcd->hwndCnr)
|
---|
| 990 | PostMsg(dcd->hwndCnr, UM_SETUP2, MPVOID, MPVOID);
|
---|
| 991 | }
|
---|
| 992 | }
|
---|
| 993 |
|
---|
| 994 | which = 0;
|
---|
| 995 | size = sizeof(ULONG);
|
---|
| 996 | if (PrfQueryProfileData(fmprof,
|
---|
| 997 | realappname,
|
---|
| 998 | "FM/4 Max",
|
---|
| 999 | (PVOID)&which,
|
---|
| 1000 | &size) &&
|
---|
| 1001 | size == sizeof(ULONG) &&
|
---|
| 1002 | which)
|
---|
| 1003 | {
|
---|
| 1004 | PostMsg(hwnd,
|
---|
| 1005 | UM_MAXIMIZE,
|
---|
| 1006 | MPFROMLONG(((which == 1) ?
|
---|
| 1007 | pd->hwndDir1 : pd->hwndDir2)), MPVOID);
|
---|
| 1008 | }
|
---|
[551] | 1009 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
[133] | 1010 | if (!hwndTree)
|
---|
[551] | 1011 | PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
|
---|
[133] | 1012 | load_tools(NULL);
|
---|
[1125] | 1013 | PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
|
---|
[133] | 1014 | fRunning = TRUE;
|
---|
| 1015 | return 0;
|
---|
[2] | 1016 |
|
---|
[133] | 1017 | case WM_SAVEAPPLICATION:
|
---|
[1498] | 1018 | WinStoreWindowPos((CHAR *) FM2Str,
|
---|
[551] | 1019 | "MainWindowPos2", WinQueryWindow(hwnd, QW_PARENT));
|
---|
[299] | 1020 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 1021 | if (pd) {
|
---|
[2] | 1022 |
|
---|
[133] | 1023 | CHAR s[CCHMAXPATH];
|
---|
| 1024 | HWND hwndC;
|
---|
| 1025 | DIRCNRDATA *dcd;
|
---|
| 1026 | ULONG flWindowAttr;
|
---|
[2] | 1027 |
|
---|
[133] | 1028 | *s = 0;
|
---|
[551] | 1029 | WinSendMsg(pd->hwndDir1, UM_CONTAINERDIR, MPFROMP(s), MPVOID);
|
---|
| 1030 | if (*s) {
|
---|
[133] | 1031 | MakeValidDir(s);
|
---|
[551] | 1032 | PrfWriteProfileString(fmprof, realappname, "FM/4 Dir1", s);
|
---|
[133] | 1033 | }
|
---|
| 1034 | *s = 0;
|
---|
[551] | 1035 | WinSendMsg(pd->hwndDir2, UM_CONTAINERDIR, MPFROMP(s), MPVOID);
|
---|
| 1036 | if (*s) {
|
---|
[133] | 1037 | MakeValidDir(s);
|
---|
[551] | 1038 | PrfWriteProfileString(fmprof, realappname, "FM/4 Dir2", s);
|
---|
[133] | 1039 | }
|
---|
[551] | 1040 | flWindowAttr = (pd->hwndMax == pd->hwndDir1) ?
|
---|
| 1041 | 1 : (pd->hwndMax == pd->hwndDir2) ? 2 : 0;
|
---|
[133] | 1042 | PrfWriteProfileData(fmprof,
|
---|
| 1043 | realappname,
|
---|
[551] | 1044 | "FM/4 Max", &flWindowAttr, sizeof(flWindowAttr));
|
---|
| 1045 | hwndC = WinWindowFromID(pd->hwndDir1, FID_CLIENT);
|
---|
| 1046 | if (hwndC) {
|
---|
[299] | 1047 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
[551] | 1048 | if (dcd) {
|
---|
| 1049 | flWindowAttr = dcd->flWindowAttr;
|
---|
| 1050 | if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
|
---|
[133] | 1051 | flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
|
---|
[551] | 1052 | if (dcd->lastattr) {
|
---|
| 1053 | if (dcd->lastattr & CV_TEXT)
|
---|
[133] | 1054 | flWindowAttr |= CV_TEXT;
|
---|
[551] | 1055 | else if (dcd->lastattr & CV_DETAIL)
|
---|
[133] | 1056 | flWindowAttr |= CV_DETAIL;
|
---|
[551] | 1057 | else if (dcd->lastattr & CV_ICON)
|
---|
[133] | 1058 | flWindowAttr |= CV_ICON;
|
---|
| 1059 | else
|
---|
| 1060 | flWindowAttr |= CV_NAME;
|
---|
| 1061 | }
|
---|
| 1062 | else
|
---|
| 1063 | flWindowAttr |= CV_NAME;
|
---|
| 1064 | }
|
---|
[1482] | 1065 | PrfWriteProfileData(fmprof, realappname, "FM/4 Dir1.Sort",
|
---|
[551] | 1066 | (PVOID) & dcd->sortFlags, sizeof(INT));
|
---|
[1482] | 1067 | PrfWriteProfileData(fmprof, realappname, "FM/4 Dir1.Filter",
|
---|
[551] | 1068 | (PVOID) & dcd->mask, sizeof(MASK));
|
---|
[1482] | 1069 | PrfWriteProfileData(fmprof, realappname, "FM/4 Dir1.View",
|
---|
[551] | 1070 | (PVOID) & flWindowAttr, sizeof(ULONG));
|
---|
[133] | 1071 | }
|
---|
| 1072 | }
|
---|
[2] | 1073 |
|
---|
[551] | 1074 | hwndC = WinWindowFromID(pd->hwndDir2, FID_CLIENT);
|
---|
| 1075 | if (hwndC) {
|
---|
[299] | 1076 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
|
---|
[551] | 1077 | if (dcd) {
|
---|
| 1078 | flWindowAttr = dcd->flWindowAttr;
|
---|
| 1079 | if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
|
---|
[133] | 1080 | flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
|
---|
[551] | 1081 | if (dcd->lastattr) {
|
---|
| 1082 | if (dcd->lastattr & CV_TEXT)
|
---|
[133] | 1083 | flWindowAttr |= CV_TEXT;
|
---|
[551] | 1084 | else if (dcd->lastattr & CV_DETAIL)
|
---|
[133] | 1085 | flWindowAttr |= CV_DETAIL;
|
---|
[551] | 1086 | else if (dcd->lastattr & CV_ICON)
|
---|
[133] | 1087 | flWindowAttr |= CV_ICON;
|
---|
| 1088 | else
|
---|
| 1089 | flWindowAttr |= CV_NAME;
|
---|
| 1090 | }
|
---|
| 1091 | else
|
---|
| 1092 | flWindowAttr |= CV_NAME;
|
---|
| 1093 | }
|
---|
[1482] | 1094 | PrfWriteProfileData(fmprof, realappname, "FM/4 Dir2.Sort",
|
---|
[551] | 1095 | (PVOID) & dcd->sortFlags, sizeof(INT));
|
---|
[1482] | 1096 | PrfWriteProfileData(fmprof, realappname, "FM/4 Dir2.Filter",
|
---|
[551] | 1097 | (PVOID) & dcd->mask, sizeof(MASK));
|
---|
[1482] | 1098 | PrfWriteProfileData(fmprof, realappname, "FM/4 Dir2.View",
|
---|
[551] | 1099 | (PVOID) & flWindowAttr, sizeof(ULONG));
|
---|
[133] | 1100 | }
|
---|
[2] | 1101 | }
|
---|
[133] | 1102 | }
|
---|
| 1103 | break;
|
---|
[2] | 1104 | }
|
---|
[133] | 1105 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 1106 | }
|
---|
| 1107 |
|
---|
[133] | 1108 | MRESULT EXPENTRY MainWndProc2(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1109 | {
|
---|
[2] | 1110 | PERSON1DATA *pd;
|
---|
| 1111 |
|
---|
[551] | 1112 | switch (msg) {
|
---|
[133] | 1113 | case WM_SAVEAPPLICATION:
|
---|
| 1114 | case UM_SETUP:
|
---|
| 1115 | case WM_CREATE:
|
---|
| 1116 | return MainWMOnce2(hwnd, msg, mp1, mp2);
|
---|
[2] | 1117 |
|
---|
[133] | 1118 | case UM_THREADUSE:
|
---|
| 1119 | case UM_LOADFILE:
|
---|
[246] | 1120 | case UM_BUILDDRIVEBAR:
|
---|
[1457] | 1121 | case WM_TIMER:
|
---|
[133] | 1122 | return CommonMainWndProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 1123 |
|
---|
[133] | 1124 | case UM_SETUP2:
|
---|
[299] | 1125 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 1126 | if (pd) {
|
---|
| 1127 | if (mp1) {
|
---|
| 1128 | if (pd->hwndDir1 && (!pd->hwndMax || pd->hwndMax == pd->hwndDir1))
|
---|
| 1129 | BoxWindow(pd->hwndDir1, (HPS) 0, CLR_PALEGRAY);
|
---|
| 1130 | if (pd->hwndDir2 && (!pd->hwndMax || pd->hwndMax == pd->hwndDir2))
|
---|
| 1131 | BoxWindow(pd->hwndDir2, (HPS) 0, CLR_PALEGRAY);
|
---|
[133] | 1132 | if (hwndTree)
|
---|
[551] | 1133 | BoxWindow(hwndTree, (HPS) 0, CLR_PALEGRAY);
|
---|
[2] | 1134 | }
|
---|
[551] | 1135 | else {
|
---|
[133] | 1136 | if (hwndTree)
|
---|
| 1137 | BoxWindow(hwndTree,
|
---|
| 1138 | (HPS) 0,
|
---|
[551] | 1139 | (pd->hwndCurr == hwndTree) ? CLR_RED : CLR_WHITE);
|
---|
| 1140 | if (!pd->hwndMax || pd->hwndMax == pd->hwndDir1)
|
---|
| 1141 | BoxWindow(pd->hwndDir1,
|
---|
[133] | 1142 | (HPS) 0,
|
---|
[551] | 1143 | (pd->hwndDir1 == pd->hwndCurr) ?
|
---|
[133] | 1144 | CLR_RED :
|
---|
[551] | 1145 | (pd->hwndDir1 == pd->hwndLastDir) ?
|
---|
| 1146 | CLR_DARKRED : CLR_PALEGRAY);
|
---|
| 1147 | if (!pd->hwndMax || pd->hwndMax == pd->hwndDir2)
|
---|
| 1148 | BoxWindow(pd->hwndDir2,
|
---|
[133] | 1149 | (HPS) 0,
|
---|
[551] | 1150 | (pd->hwndDir2 == pd->hwndCurr) ?
|
---|
[133] | 1151 | CLR_RED :
|
---|
[551] | 1152 | (pd->hwndDir2 == pd->hwndLastDir) ?
|
---|
| 1153 | CLR_DARKRED : CLR_PALEGRAY);
|
---|
[133] | 1154 | }
|
---|
| 1155 | }
|
---|
| 1156 | return 0;
|
---|
[2] | 1157 |
|
---|
[133] | 1158 | case WM_BUTTON1DOWN:
|
---|
| 1159 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
[551] | 1160 | if (hwndTree) {
|
---|
[2] | 1161 |
|
---|
[133] | 1162 | SWP swp;
|
---|
[2] | 1163 |
|
---|
[133] | 1164 | WinQueryWindowPos(hwndTree, &swp);
|
---|
| 1165 | if (SHORT1FROMMP(mp1) > (swp.x + swp.cx) - 3 &&
|
---|
[551] | 1166 | SHORT1FROMMP(mp1) < (swp.x + swp.cx) + 3) {
|
---|
[2] | 1167 |
|
---|
[133] | 1168 | SWP swpC;
|
---|
| 1169 | TRACKINFO track;
|
---|
[2] | 1170 |
|
---|
[133] | 1171 | WinQueryWindowPos(hwnd, &swpC);
|
---|
| 1172 | track.cxBorder = 4;
|
---|
| 1173 | track.cyBorder = 4;
|
---|
| 1174 | track.cxGrid = 1;
|
---|
| 1175 | track.cyGrid = 1;
|
---|
| 1176 | track.cxKeyboard = 8;
|
---|
| 1177 | track.cyKeyboard = 8;
|
---|
| 1178 | track.rclTrack.yBottom = 2;
|
---|
| 1179 | track.rclTrack.yTop = swpC.cy - 4;
|
---|
| 1180 | track.rclTrack.xLeft = 2;
|
---|
| 1181 | track.rclTrack.xRight = swp.x + swp.cx + 2;
|
---|
| 1182 | track.rclBoundary = track.rclTrack;
|
---|
| 1183 | track.rclBoundary.xRight = swpC.cx - 80;
|
---|
| 1184 | track.ptlMinTrackSize.x = 80;
|
---|
| 1185 | track.ptlMinTrackSize.y = swpC.cy - 4;
|
---|
| 1186 | track.ptlMaxTrackSize.x = swpC.cx - 80;
|
---|
| 1187 | track.ptlMaxTrackSize.y = swpC.cy - 4;
|
---|
| 1188 | track.fs = TF_RIGHT;
|
---|
[551] | 1189 | if (WinTrackRect(hwnd, (HPS) 0, &track)) {
|
---|
[133] | 1190 | TreeWidth = track.rclTrack.xRight - track.rclTrack.xLeft;
|
---|
| 1191 | PrfWriteProfileData(fmprof,
|
---|
| 1192 | realappname,
|
---|
[551] | 1193 | "FM/4 TreeWidth", &TreeWidth, sizeof(ULONG));
|
---|
| 1194 | WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
|
---|
| 1195 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
[133] | 1196 | }
|
---|
| 1197 | return (MRESULT) TRUE;
|
---|
[2] | 1198 | }
|
---|
[133] | 1199 | }
|
---|
| 1200 | break;
|
---|
[2] | 1201 |
|
---|
[133] | 1202 | case WM_MOUSEMOVE:
|
---|
| 1203 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
[551] | 1204 | if (hwndTree) {
|
---|
[2] | 1205 |
|
---|
[133] | 1206 | SWP swp;
|
---|
[2] | 1207 |
|
---|
[551] | 1208 | if (WinQueryWindowPos(hwndTree, &swp)) {
|
---|
[133] | 1209 | if (SHORT1FROMMP(mp1) > (swp.x + swp.cx) - 3 &&
|
---|
| 1210 | SHORT1FROMMP(mp1) < (swp.x + swp.cx) + 3)
|
---|
| 1211 | WinSetPointer(HWND_DESKTOP, hptrEW);
|
---|
| 1212 | else
|
---|
| 1213 | WinSetPointer(HWND_DESKTOP, hptrArrow);
|
---|
[2] | 1214 | }
|
---|
[133] | 1215 | else
|
---|
| 1216 | WinSetPointer(HWND_DESKTOP, hptrArrow);
|
---|
| 1217 | }
|
---|
| 1218 | return (MRESULT) TRUE;
|
---|
[2] | 1219 |
|
---|
[133] | 1220 | case WM_BUTTON1UP:
|
---|
| 1221 | case WM_BUTTON2UP:
|
---|
| 1222 | case WM_BUTTON3UP:
|
---|
| 1223 | case WM_CHAR:
|
---|
| 1224 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 1225 | break;
|
---|
[2] | 1226 |
|
---|
[133] | 1227 | case UM_ADVISEFOCUS:
|
---|
[299] | 1228 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 1229 | if (mp1 && pd && (HWND) mp1 != pd->hwndCurr) {
|
---|
| 1230 | if ((HWND) mp1 != hwndTree)
|
---|
| 1231 | pd->hwndLastDir = (HWND) mp1;
|
---|
| 1232 | pd->hwndCurr = (HWND) mp1;
|
---|
| 1233 | WinSendMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
|
---|
[133] | 1234 | }
|
---|
| 1235 | return 0;
|
---|
[2] | 1236 |
|
---|
[133] | 1237 | case UM_MAXIMIZE:
|
---|
[551] | 1238 | if (mp1) {
|
---|
[299] | 1239 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 1240 | if (pd) {
|
---|
| 1241 | WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
|
---|
| 1242 | if (pd->hwndMax != (HWND) mp1) {
|
---|
| 1243 | pd->hwndMax = (HWND) mp1;
|
---|
| 1244 | WinSetFocus(HWND_DESKTOP, pd->hwndMax);
|
---|
[133] | 1245 | }
|
---|
| 1246 | else
|
---|
[551] | 1247 | pd->hwndMax = (HWND) 0;
|
---|
| 1248 | PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
|
---|
[2] | 1249 | }
|
---|
[133] | 1250 | }
|
---|
| 1251 | return 0;
|
---|
[2] | 1252 |
|
---|
[133] | 1253 | case WM_INITMENU:
|
---|
[551] | 1254 | switch (SHORT1FROMMP(mp1)) {
|
---|
[133] | 1255 | case IDM_FILESMENU:
|
---|
| 1256 | case IDM_VIEWSMENU:
|
---|
| 1257 | case IDM_DETAILSSETUP:
|
---|
| 1258 | case IDM_COMMANDSMENU:
|
---|
| 1259 | case IDM_SORTSUBMENU:
|
---|
[299] | 1260 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[133] | 1261 | if (pd)
|
---|
[551] | 1262 | WinSendMsg(pd->hwndCurr, UM_INITMENU, mp1, mp2);
|
---|
[2] | 1263 | break;
|
---|
[133] | 1264 | case IDM_CONFIGMENU:
|
---|
[1777] | 1265 | // 2014-05-17 SHL FIXME to use SetToggleChecks maybe
|
---|
[551] | 1266 | WinCheckMenuItem((HWND) mp2, IDM_TOOLSUBMENU, fToolbar);
|
---|
| 1267 | WinCheckMenuItem((HWND) mp2, IDM_AUTOVIEW, fAutoView);
|
---|
[1777] | 1268 | WinCheckMenuItem((HWND) mp2, IDM_CONFIRMDELETE, fConfirmDelete); // 2014-05-17 SHL
|
---|
| 1269 | WinCheckMenuItem((HWND) mp2, IDM_TOGGLEDRAGDIALOG, fDragndropDlg); // 2014-05-15 SHL
|
---|
[2] | 1270 | break;
|
---|
[133] | 1271 | case IDM_TOOLSUBMENU:
|
---|
[1777] | 1272 | // 2014-05-17 SHL FIXME to use SetToggleChecks maybe
|
---|
[551] | 1273 | WinCheckMenuItem((HWND) mp2, IDM_TOOLBAR, fToolbar);
|
---|
| 1274 | WinCheckMenuItem((HWND) mp2, IDM_TEXTTOOLS, fTextTools);
|
---|
| 1275 | WinCheckMenuItem((HWND) mp2, IDM_TOOLTITLES, fToolTitles);
|
---|
[133] | 1276 | break;
|
---|
| 1277 | case IDM_WINDOWSMENU:
|
---|
[1777] | 1278 | // 2014-05-17 SHL FIXME to use SetToggleChecks maybe
|
---|
[551] | 1279 | WinCheckMenuItem((HWND) mp2, IDM_VTREE, (hwndTree != (HWND) 0));
|
---|
| 1280 | WinCheckMenuItem((HWND) mp2, IDM_TILEBACKWARDS, fTileBackwards);
|
---|
| 1281 | SetupWinList((HWND) mp2, hwnd, WinQueryWindow(hwnd, QW_PARENT));
|
---|
[133] | 1282 | break;
|
---|
| 1283 | }
|
---|
| 1284 | break;
|
---|
[2] | 1285 |
|
---|
[133] | 1286 | case WM_SETFOCUS:
|
---|
| 1287 | if (mp2)
|
---|
[551] | 1288 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
[133] | 1289 | break;
|
---|
[2] | 1290 |
|
---|
[133] | 1291 | case UM_FOCUSME:
|
---|
[299] | 1292 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[133] | 1293 | if (pd)
|
---|
[551] | 1294 | WinSetFocus(HWND_DESKTOP, pd->hwndCurr);
|
---|
[133] | 1295 | return 0;
|
---|
[2] | 1296 |
|
---|
[133] | 1297 | case UM_RESCAN:
|
---|
| 1298 | return 0;
|
---|
| 1299 |
|
---|
| 1300 | case UM_SIZE:
|
---|
| 1301 | {
|
---|
| 1302 | SWP swp;
|
---|
| 1303 |
|
---|
[551] | 1304 | if (WinQueryWindowPos(hwnd, &swp)) {
|
---|
[133] | 1305 | mp1 = MPFROM2SHORT(swp.cx, swp.cy);
|
---|
| 1306 | mp2 = MPFROM2SHORT(swp.cx, swp.cy);
|
---|
[2] | 1307 | }
|
---|
[133] | 1308 | else
|
---|
| 1309 | return 0;
|
---|
| 1310 | }
|
---|
[1673] | 1311 | // intentional fallthru
|
---|
[133] | 1312 | case WM_SIZE:
|
---|
[299] | 1313 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[551] | 1314 | if (mp1 && mp2 && pd && pd->hwndDir1 && pd->hwndDir2) {
|
---|
[133] | 1315 | if (hwndTree)
|
---|
| 1316 | WinSetWindowPos(hwndTree,
|
---|
| 1317 | HWND_TOP,
|
---|
| 1318 | 2,
|
---|
| 1319 | 2,
|
---|
| 1320 | TreeWidth - 4,
|
---|
| 1321 | SHORT2FROMMP(mp2) - 4,
|
---|
| 1322 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
| 1323 | else
|
---|
| 1324 | TreeWidth = 0;
|
---|
[551] | 1325 | if (!pd->hwndMax) {
|
---|
| 1326 | if (fTileBackwards) {
|
---|
| 1327 | WinSetWindowPos(pd->hwndDir1, HWND_TOP,
|
---|
[133] | 1328 | (((SHORT1FROMMP(mp2) - TreeWidth) / 2) +
|
---|
| 1329 | TreeWidth) + 2,
|
---|
| 1330 | 2,
|
---|
| 1331 | ((SHORT1FROMMP(mp2) - TreeWidth) / 2) - 4,
|
---|
| 1332 | SHORT2FROMMP(mp2) - 4,
|
---|
| 1333 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
[551] | 1334 | WinSetWindowPos(pd->hwndDir2, HWND_TOP,
|
---|
[133] | 1335 | TreeWidth + 2,
|
---|
| 1336 | 2,
|
---|
| 1337 | ((SHORT1FROMMP(mp2) - TreeWidth) / 2) - 4,
|
---|
| 1338 | SHORT2FROMMP(mp2) - 4,
|
---|
| 1339 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
| 1340 | }
|
---|
[551] | 1341 | else {
|
---|
| 1342 | WinSetWindowPos(pd->hwndDir1, HWND_TOP,
|
---|
[133] | 1343 | TreeWidth + 2,
|
---|
| 1344 | 2,
|
---|
| 1345 | (SHORT1FROMMP(mp2) - TreeWidth) - 4,
|
---|
| 1346 | (SHORT2FROMMP(mp2) / 2) - 4,
|
---|
| 1347 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
[551] | 1348 | WinSetWindowPos(pd->hwndDir2, HWND_TOP,
|
---|
[133] | 1349 | TreeWidth + 2,
|
---|
| 1350 | (SHORT2FROMMP(mp2) / 2) + 2,
|
---|
| 1351 | (SHORT1FROMMP(mp2) - TreeWidth) - 4,
|
---|
| 1352 | (SHORT2FROMMP(mp2) / 2) - 4,
|
---|
| 1353 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
| 1354 | }
|
---|
| 1355 | }
|
---|
[551] | 1356 | else {
|
---|
[2] | 1357 |
|
---|
[133] | 1358 | HWND hwndOther;
|
---|
[2] | 1359 |
|
---|
[551] | 1360 | WinSetWindowPos(pd->hwndMax, HWND_TOP,
|
---|
[133] | 1361 | TreeWidth + 2,
|
---|
| 1362 | 2,
|
---|
| 1363 | (SHORT1FROMMP(mp2) - TreeWidth) - 4,
|
---|
| 1364 | SHORT2FROMMP(mp2) - 4,
|
---|
| 1365 | SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
[551] | 1366 | hwndOther = (pd->hwndMax == pd->hwndDir1) ?
|
---|
| 1367 | pd->hwndDir2 : pd->hwndDir1;
|
---|
[133] | 1368 | WinSetWindowPos(hwndOther, HWND_BOTTOM, 0, 0, 0, 0, SWP_HIDE);
|
---|
[2] | 1369 | }
|
---|
[551] | 1370 | WinSendMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
|
---|
[133] | 1371 | }
|
---|
| 1372 | if (msg == UM_SIZE)
|
---|
[2] | 1373 | return 0;
|
---|
[133] | 1374 | break;
|
---|
[2] | 1375 |
|
---|
[133] | 1376 | case WM_ERASEBACKGROUND:
|
---|
[551] | 1377 | WinFillRect((HPS) mp1, (PRECTL) mp2, 0x00d0d0d0);
|
---|
[133] | 1378 | return 0;
|
---|
| 1379 |
|
---|
| 1380 | case WM_PAINT:
|
---|
| 1381 | {
|
---|
| 1382 | HPS hps;
|
---|
| 1383 | RECTL rcl;
|
---|
| 1384 |
|
---|
[551] | 1385 | hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
|
---|
| 1386 | if (hps) {
|
---|
[133] | 1387 | WinQueryWindowRect(hwnd, &rcl);
|
---|
[551] | 1388 | WinFillRect(hps, (PRECTL) & rcl, CLR_PALEGRAY);
|
---|
[133] | 1389 | WinEndPaint(hps);
|
---|
[551] | 1390 | WinSendMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
|
---|
[2] | 1391 | }
|
---|
[133] | 1392 | }
|
---|
| 1393 | break;
|
---|
[2] | 1394 |
|
---|
[133] | 1395 | case UM_COMMAND:
|
---|
| 1396 | case WM_COMMAND:
|
---|
| 1397 | return MainWMCommand2(hwnd, msg, mp1, mp2);
|
---|
[2] | 1398 |
|
---|
[133] | 1399 | case WM_CLOSE:
|
---|
| 1400 | fAmClosing = TRUE;
|
---|
[551] | 1401 | WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
---|
[133] | 1402 | CloseChildren(hwnd);
|
---|
[551] | 1403 | PostMsg(hwnd, UM_CLOSE, MPVOID, MPVOID);
|
---|
[771] | 1404 | DosSleep(1);
|
---|
[1700] | 1405 | return 0; // Suppress WinDefWindowProc WM_QUIT message generation
|
---|
[2] | 1406 |
|
---|
[133] | 1407 | case UM_CLOSE:
|
---|
| 1408 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
|
---|
| 1409 | return 0;
|
---|
[2] | 1410 |
|
---|
[133] | 1411 | case WM_DESTROY:
|
---|
[551] | 1412 | hwndMain = (HWND) 0;
|
---|
[299] | 1413 | pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
|
---|
[1009] | 1414 | xfree(pd, pszSrcFile, __LINE__);
|
---|
[551] | 1415 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
| 1416 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
---|
[133] | 1417 | break;
|
---|
[2] | 1418 | }
|
---|
[133] | 1419 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 1420 | }
|
---|
| 1421 |
|
---|
[133] | 1422 | HWND StartFM32(HAB hab, INT argc, CHAR ** argv)
|
---|
| 1423 | {
|
---|
| 1424 | HWND hwndFrame, hwndClient;
|
---|
| 1425 | ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
|
---|
[551] | 1426 | FCF_SIZEBORDER | FCF_MINMAX |
|
---|
| 1427 | FCF_ACCELTABLE | FCF_MENU | FCF_ICON | FCF_TASKLIST | FCF_NOBYTEALIGN;
|
---|
[2] | 1428 |
|
---|
| 1429 | {
|
---|
| 1430 | INT x;
|
---|
| 1431 |
|
---|
[551] | 1432 | for (x = 1; x < argc; x++) {
|
---|
[133] | 1433 | if (*argv[x] == '+' && !argv[x][1])
|
---|
| 1434 | fLogFile = TRUE;
|
---|
[551] | 1435 | if (*argv[x] == '-') {
|
---|
[133] | 1436 | if (argv[x][1])
|
---|
| 1437 | strcpy(profile, &argv[x][1]);
|
---|
[2] | 1438 | }
|
---|
| 1439 | }
|
---|
| 1440 | }
|
---|
| 1441 | {
|
---|
[133] | 1442 | CHAR inipath[CCHMAXPATH], fullpath[CCHMAXPATH];
|
---|
[843] | 1443 | FILESTATUS3 fsa;
|
---|
[2] | 1444 |
|
---|
[133] | 1445 | if (PrfQueryProfileString(HINI_USERPROFILE,
|
---|
[1498] | 1446 | (CHAR *) FM2Str,
|
---|
[551] | 1447 | "Home", NULL, inipath, sizeof(inipath))) {
|
---|
[843] | 1448 | if (!DosQueryPathInfo(inipath, FIL_STANDARD, &fsa, sizeof(fsa))) {
|
---|
[551] | 1449 | if (fsa.attrFile & FILE_DIRECTORY) {
|
---|
[133] | 1450 | if (DosQueryPathInfo(inipath,
|
---|
[551] | 1451 | FIL_QUERYFULLNAME, fullpath, sizeof(fullpath)))
|
---|
[133] | 1452 | strcpy(fullpath, inipath);
|
---|
| 1453 | switch_to(fullpath);
|
---|
| 1454 | }
|
---|
[2] | 1455 | }
|
---|
| 1456 | }
|
---|
| 1457 | }
|
---|
| 1458 |
|
---|
| 1459 | hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
|
---|
[133] | 1460 | WS_VISIBLE,
|
---|
| 1461 | &FrameFlags,
|
---|
[1498] | 1462 | (CHAR *) WC_MAINWND2,
|
---|
[133] | 1463 | NULL,
|
---|
| 1464 | WS_VISIBLE | WS_ANIMATE,
|
---|
[551] | 1465 | FM3ModHandle, MAIN2_FRAME, &hwndClient);
|
---|
| 1466 | if (hwndFrame) {
|
---|
[875] | 1467 | hwndMainMenu = WinWindowFromID(hwndFrame, FID_MENU);
|
---|
[1498] | 1468 | if (!WinRestoreWindowPos((CHAR *) FM2Str, "MainWindowPos2", hwndFrame)) {
|
---|
[2] | 1469 |
|
---|
[133] | 1470 | ULONG fl = SWP_MOVE | SWP_SIZE;
|
---|
[2] | 1471 | RECTL rcl;
|
---|
[133] | 1472 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 3L;
|
---|
| 1473 | ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
|
---|
[2] | 1474 |
|
---|
[133] | 1475 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
---|
[2] | 1476 | rcl.yBottom += icz;
|
---|
| 1477 | rcl.yTop -= bsz;
|
---|
| 1478 | rcl.xLeft += bsz;
|
---|
| 1479 | rcl.xRight -= bsz;
|
---|
| 1480 | WinSetWindowPos(hwndFrame,
|
---|
[133] | 1481 | HWND_TOP,
|
---|
| 1482 | rcl.xLeft,
|
---|
| 1483 | rcl.yBottom,
|
---|
[551] | 1484 | rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, fl);
|
---|
[2] | 1485 | }
|
---|
[1544] | 1486 | if (fLogFile) {
|
---|
| 1487 | CHAR *modea = "a+";
|
---|
| 1488 |
|
---|
| 1489 | LogFileHandle = xfsopen("FM2.LOG", modea, SH_DENYWR, pszSrcFile, __LINE__, TRUE);
|
---|
| 1490 | }
|
---|
[133] | 1491 | if (hwndHelp)
|
---|
| 1492 | WinAssociateHelpInstance(hwndHelp, hwndFrame);
|
---|
[551] | 1493 | PostMsg(hwndClient, UM_SETUP, MPFROMLONG(argc), MPFROMP(argv));
|
---|
[2] | 1494 | }
|
---|
| 1495 | return hwndFrame;
|
---|
| 1496 | }
|
---|
[793] | 1497 |
|
---|
| 1498 | #pragma alloc_text(PERSON11,MainFrameWndProc2,MainWndProc2)
|
---|
| 1499 | #pragma alloc_text(PERSON12,StartFM32,MainWMOnce2)
|
---|
| 1500 | #pragma alloc_text(PERSON13,MainWMCommand2)
|
---|