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