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