| 1 | 
 | 
|---|
| 2 | /***********************************************************************
 | 
|---|
| 3 | 
 | 
|---|
| 4 |   $Id: mainwnd2.c 1335 2008-12-12 23:49:02Z stevenhl $
 | 
|---|
| 5 | 
 | 
|---|
| 6 |   fm/4 main window
 | 
|---|
| 7 | 
 | 
|---|
| 8 |   Copyright (c) 1993-98 M. Kimes
 | 
|---|
| 9 |   Copyright (c) 2005, 2008 Steven H. Levine
 | 
|---|
| 10 | 
 | 
|---|
| 11 |   23 May 05 SHL Use datamin.h
 | 
|---|
| 12 |   26 May 05 SHL Comments and localize code
 | 
|---|
| 13 |   06 Aug 05 SHL Renames
 | 
|---|
| 14 |   02 Jan 06 SHL Use QWL_USER more
 | 
|---|
| 15 |   02 Jan 06 SHL Map IDM_WINDOWDLG to match IBM_TWODIRS
 | 
|---|
| 16 |   17 Jul 06 SHL Use Runtime_Error
 | 
|---|
| 17 |   30 Mar 07 GKY Remove GetPString for window class names
 | 
|---|
| 18 |   12 May 07 SHL Pass ulItemsToUnHilite to UnHilite
 | 
|---|
| 19 |   06 Aug 07 GKY Reduce DosSleep times (ticket 148)
 | 
|---|
| 20 |   07 Aug 07 SHL Use BldQuotedFileName
 | 
|---|
| 21 |   20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
 | 
|---|
| 22 |   10 Jan 08 SHL Sync with CfgDlgProc mods
 | 
|---|
| 23 |   19 Jan 08 GKY Rework Utilities menu
 | 
|---|
| 24 |   14 Feb 08 SHL Rework to support settings menu conditional cascade
 | 
|---|
| 25 |   29 Feb 08 GKY Use xfree where appropriate
 | 
|---|
| 26 |   27 Aug 08 JBS Ticket 259: Support saving/restoring toolbars with states
 | 
|---|
| 27 |   01 Sep 08 GKY Add bmps for default toolbars
 | 
|---|
| 28 |   10 Dec 08 SHL Integrate exception handler support
 | 
|---|
| 29 | 
 | 
|---|
| 30 | ***********************************************************************/
 | 
|---|
| 31 | 
 | 
|---|
| 32 | #include <stdlib.h>
 | 
|---|
| 33 | #include <string.h>
 | 
|---|
| 34 | #include <share.h>
 | 
|---|
| 35 | // #include <process.h>                 // _beginthread
 | 
|---|
| 36 | 
 | 
|---|
| 37 | #define INCL_DOS
 | 
|---|
| 38 | #define INCL_WIN
 | 
|---|
| 39 | #define INCL_GPI
 | 
|---|
| 40 | #define INCL_LONGLONG
 | 
|---|
| 41 | 
 | 
|---|
| 42 | #include "fm3dll.h"
 | 
|---|
| 43 | #include "fm3dll2.h"                    // #define's for UM_*, control id's, etc.
 | 
|---|
| 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)
 | 
|---|
| 50 | #include "fm3dlg.h"
 | 
|---|
| 51 | #include "fm3str.h"
 | 
|---|
| 52 | #include "tools.h"
 | 
|---|
| 53 | #include "datamin.h"
 | 
|---|
| 54 | #include "comp.h"                       // COMPARE
 | 
|---|
| 55 | #include "pathutil.h"                   // BldQuotedFileName
 | 
|---|
| 56 | #include "errutil.h"                    // Dos_Error...
 | 
|---|
| 57 | #include "strutil.h"                    // GetPString
 | 
|---|
| 58 | #include "notebook.h"                   // CfgDlgProc
 | 
|---|
| 59 | #include "command.h"                    // RunCommand
 | 
|---|
| 60 | #include "misc.h"                       // BoxWindow, FixSwitchList, SetConditionalCascade
 | 
|---|
| 61 |                                         // SetSysMenu
 | 
|---|
| 62 | #include "mainwnd.h"                    // CloseChildren, MainWMCommand, MakeMainObjWin, ResizeDrives
 | 
|---|
| 63 |                                 // TopWindow
 | 
|---|
| 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
 | 
|---|
| 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
 | 
|---|
| 77 | #include "fortify.h"
 | 
|---|
| 78 | #include "excputil.h"                   // xbeginthread
 | 
|---|
| 79 | 
 | 
|---|
| 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;
 | 
|---|
| 89 | }
 | 
|---|
| 90 | PERSON1DATA;
 | 
|---|
| 91 | 
 | 
|---|
| 92 | // Data definitions
 | 
|---|
| 93 | static PSZ pszSrcFile = __FILE__;
 | 
|---|
| 94 | static ULONG TreeWidth;
 | 
|---|
| 95 | 
 | 
|---|
| 96 | #pragma data_seg(GLOBAL1)
 | 
|---|
| 97 | PFNWP PFNWPFrame;
 | 
|---|
| 98 | 
 | 
|---|
| 99 | #pragma data_seg(GLOBAL2)
 | 
|---|
| 100 | CHAR realappname[12];
 | 
|---|
| 101 | 
 | 
|---|
| 102 | static MRESULT EXPENTRY MainFrameWndProc2(HWND hwnd, ULONG msg, MPARAM mp1,
 | 
|---|
| 103 |                                           MPARAM mp2)
 | 
|---|
| 104 | {
 | 
|---|
| 105 |   PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 106 | 
 | 
|---|
| 107 |   switch (msg) {
 | 
|---|
| 108 |   case WM_ADJUSTWINDOWPOS:
 | 
|---|
| 109 |     {
 | 
|---|
| 110 |       SWP *pswp;
 | 
|---|
| 111 | 
 | 
|---|
| 112 |       pswp = (SWP *) mp1;
 | 
|---|
| 113 |       if (pswp->fl & (SWP_SHOW | SWP_RESTORE))
 | 
|---|
| 114 |         PostMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_SIZE, MPVOID, MPVOID);
 | 
|---|
| 115 |       if (fDataMin && !fAmClosing) {
 | 
|---|
| 116 |         if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) {
 | 
|---|
| 117 | 
 | 
|---|
| 118 |           SWP swp;
 | 
|---|
| 119 | 
 | 
|---|
| 120 |           WinQueryWindowPos(hwnd, &swp);
 | 
|---|
| 121 |           PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID);
 | 
|---|
| 122 |           HideNote();
 | 
|---|
| 123 |         }
 | 
|---|
| 124 |         else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) {
 | 
|---|
| 125 |           if (DataHwnd)
 | 
|---|
| 126 |             PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| 127 |         }
 | 
|---|
| 128 |       }
 | 
|---|
| 129 |       if (!fAmClosing) {
 | 
|---|
| 130 |         if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE))
 | 
|---|
| 131 |           HideNote();
 | 
|---|
| 132 |       }
 | 
|---|
| 133 |     }
 | 
|---|
| 134 |     break;
 | 
|---|
| 135 | 
 | 
|---|
| 136 |   case UM_FOCUSME:
 | 
|---|
| 137 |     CreateDataBar(HWND_DESKTOP, (ULONG) mp1);
 | 
|---|
| 138 |     return 0;
 | 
|---|
| 139 | 
 | 
|---|
| 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;
 | 
|---|
| 147 | 
 | 
|---|
| 148 |   case WM_CHAR:
 | 
|---|
| 149 |     shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
 | 
|---|
| 150 |     break;
 | 
|---|
| 151 | 
 | 
|---|
| 152 |   case WM_CONTROL:
 | 
|---|
| 153 |     return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_CONTROL, mp1,
 | 
|---|
| 154 |                       mp2);
 | 
|---|
| 155 | 
 | 
|---|
| 156 |   case WM_COMMAND:
 | 
|---|
| 157 |     return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
 | 
|---|
| 158 | 
 | 
|---|
| 159 |   case WM_CALCFRAMERECT:
 | 
|---|
| 160 |     {
 | 
|---|
| 161 |       MRESULT mr;
 | 
|---|
| 162 |       PRECTL prectl;
 | 
|---|
| 163 |       LONG sheight = 20, bheight = 20;
 | 
|---|
| 164 | 
 | 
|---|
| 165 |       mr = (oldproc) ? oldproc(hwnd, msg, mp1, mp2) :
 | 
|---|
| 166 |         PFNWPFrame(hwnd, msg, mp1, mp2);
 | 
|---|
| 167 | 
 | 
|---|
| 168 |       /*
 | 
|---|
| 169 |        * Calculate the position of the client rectangle.
 | 
|---|
| 170 |        * Otherwise, we'll see a lot of redraw when we move the
 | 
|---|
| 171 |        * client during WM_FORMATFRAME.
 | 
|---|
| 172 |        */
 | 
|---|
| 173 | 
 | 
|---|
| 174 |       if (mr && mp2) {
 | 
|---|
| 175 |         prectl = (PRECTL) mp1;
 | 
|---|
| 176 |         if (prectl->yBottom != prectl->yTop) {
 | 
|---|
| 177 |           {
 | 
|---|
| 178 |             HPS hps;
 | 
|---|
| 179 |             POINTL aptl[TXTBOX_COUNT];
 | 
|---|
| 180 | 
 | 
|---|
| 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 |           }
 | 
|---|
| 190 |           prectl->yBottom += (sheight + 4);
 | 
|---|
| 191 |           prectl->yTop -= (sheight + 4);
 | 
|---|
| 192 |           prectl->yBottom += (bheight + 4);
 | 
|---|
| 193 |           prectl->yTop -= (bheight + 4);
 | 
|---|
| 194 |           if (fToolbar) {
 | 
|---|
| 195 |             if (!fTextTools)
 | 
|---|
| 196 |               prectl->yTop -= ((fToolTitles) ? 50 : 40);
 | 
|---|
| 197 |             else
 | 
|---|
| 198 |               prectl->yTop -= 32;
 | 
|---|
| 199 |           }
 | 
|---|
| 200 |           ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES),
 | 
|---|
| 201 |                        ((prectl->xRight -
 | 
|---|
| 202 |                          (WinQuerySysValue(HWND_DESKTOP,
 | 
|---|
| 203 |                                            SV_CYSIZEBORDER) * 2)) - 4));
 | 
|---|
| 204 |           prectl->yTop -= (16 * (DriveLines * 18));
 | 
|---|
| 205 |           prectl->yTop -= 2;
 | 
|---|
| 206 |           if (fAutoView) {
 | 
|---|
| 207 |             AutoviewHeight = min(AutoviewHeight,
 | 
|---|
| 208 |                                  (prectl->yTop - prectl->yBottom) - 116);
 | 
|---|
| 209 |             AutoviewHeight = max(AutoviewHeight, 36);
 | 
|---|
| 210 |             prectl->yBottom += (AutoviewHeight + 6);
 | 
|---|
| 211 |           }
 | 
|---|
| 212 |         }
 | 
|---|
| 213 |       }
 | 
|---|
| 214 |       return mr;
 | 
|---|
| 215 |     }
 | 
|---|
| 216 | 
 | 
|---|
| 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;
 | 
|---|
| 224 | 
 | 
|---|
| 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 |        */
 | 
|---|
| 234 | 
 | 
|---|
| 235 |       pswp = (PSWP) mp1;
 | 
|---|
| 236 |       {
 | 
|---|
| 237 |         SHORT x;
 | 
|---|
| 238 | 
 | 
|---|
| 239 |         for (x = 0; x < sCount; x++) {
 | 
|---|
| 240 |           if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {
 | 
|---|
| 241 |             pswpClient = pswp;
 | 
|---|
| 242 |             break;
 | 
|---|
| 243 |           }
 | 
|---|
| 244 |           pswp++;
 | 
|---|
| 245 |         }
 | 
|---|
| 246 |       }
 | 
|---|
| 247 | 
 | 
|---|
| 248 |       {
 | 
|---|
| 249 |         HPS hps;
 | 
|---|
| 250 |         POINTL aptl[TXTBOX_COUNT];
 | 
|---|
| 251 | 
 | 
|---|
| 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 |       }
 | 
|---|
| 261 | 
 | 
|---|
| 262 |       pswpNew = (PSWP) mp1 + soldCount;
 | 
|---|
| 263 |       *pswpNew = *pswpClient;
 | 
|---|
| 264 |       swpClient = *pswpClient;
 | 
|---|
| 265 |       pswpNew->hwnd = hwndStatus;
 | 
|---|
| 266 |       pswpNew->x = swpClient.x + 3;
 | 
|---|
| 267 |       pswpNew->y = swpClient.y + 2;
 | 
|---|
| 268 |       width = (swpClient.cx / 2) - 6;
 | 
|---|
| 269 |       width = max(width, 10);
 | 
|---|
| 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;
 | 
|---|
| 274 |       sCount++;
 | 
|---|
| 275 | 
 | 
|---|
| 276 |       pswpNew = (PSWP) mp1 + (soldCount + 1);
 | 
|---|
| 277 |       *pswpNew = *pswpClient;
 | 
|---|
| 278 |       pswpNew->hwnd = hwndStatus2;
 | 
|---|
| 279 |       pswpNew->x = width + 8;
 | 
|---|
| 280 |       pswpNew->y = swpClient.y + 2;
 | 
|---|
| 281 |       pswpNew->cx = width - 6;
 | 
|---|
| 282 |       pswpNew->cy = sheight;
 | 
|---|
| 283 |       sCount++;
 | 
|---|
| 284 | 
 | 
|---|
| 285 |       if (fToolbar) {
 | 
|---|
| 286 |         if (fTextTools)
 | 
|---|
| 287 |           theight = 32L;
 | 
|---|
| 288 |         else if (!fToolTitles)
 | 
|---|
| 289 |           theight = 40L;
 | 
|---|
| 290 |         pswpNew = (PSWP) mp1 + (soldCount + 2);
 | 
|---|
| 291 |         *pswpNew = *pswpClient;
 | 
|---|
| 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;
 | 
|---|
| 298 |         sCount++;
 | 
|---|
| 299 |       }
 | 
|---|
| 300 |       else
 | 
|---|
| 301 |         WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE);
 | 
|---|
| 302 | 
 | 
|---|
| 303 |       ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4);
 | 
|---|
| 304 |       pswpNew = (PSWP) mp1 + (soldCount + 2 + (fToolbar != FALSE));
 | 
|---|
| 305 |       *pswpNew = *pswpClient;
 | 
|---|
| 306 |       pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES);
 | 
|---|
| 307 |       pswpNew->x = swpClient.x + 2;
 | 
|---|
| 308 |       dheight += ((dheight - 2) * DriveLines);
 | 
|---|
| 309 |       pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);
 | 
|---|
| 310 |       if (fToolbar)
 | 
|---|
| 311 |         pswpNew->y -= theight;
 | 
|---|
| 312 |       pswpNew->cx = swpClient.cx - 4;
 | 
|---|
| 313 |       pswpNew->cy = dheight - 4;
 | 
|---|
| 314 |       pswpClient->cy -= dheight;
 | 
|---|
| 315 |       pswpClient->cy -= 2;
 | 
|---|
| 316 |       sCount++;
 | 
|---|
| 317 | 
 | 
|---|
| 318 |       if (fAutoView) {
 | 
|---|
| 319 |         pswpNew = (PSWP) mp1 + (soldCount + 3 + (fToolbar != FALSE));
 | 
|---|
| 320 |         *pswpNew = *pswpClient;
 | 
|---|
| 321 |         pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview;
 | 
|---|
| 322 |         pswpNew->x = pswpClient->x + 3;
 | 
|---|
| 323 |         pswpNew->y = pswpClient->y + 3;
 | 
|---|
| 324 |         if (fMoreButtons)
 | 
|---|
| 325 |           pswpNew->y += (bheight + 4);
 | 
|---|
| 326 |         pswpNew->cx = pswpClient->cx - 6;
 | 
|---|
| 327 |         AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116);
 | 
|---|
| 328 |         AutoviewHeight = max(AutoviewHeight, 36);
 | 
|---|
| 329 |         pswpNew->cy = AutoviewHeight;
 | 
|---|
| 330 |         pswpClient->y += (AutoviewHeight + 6);
 | 
|---|
| 331 |         pswpClient->cy -= (AutoviewHeight + 6);
 | 
|---|
| 332 |         sCount++;
 | 
|---|
| 333 |         WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE);
 | 
|---|
| 334 |       }
 | 
|---|
| 335 |       else {
 | 
|---|
| 336 |         WinShowWindow(hwndAutoview, FALSE);
 | 
|---|
| 337 |         WinShowWindow(hwndAutoMLE, FALSE);
 | 
|---|
| 338 |       }
 | 
|---|
| 339 | 
 | 
|---|
| 340 |       pswpNew = (PSWP) mp1 + (soldCount + 3 + (fToolbar != FALSE) +
 | 
|---|
| 341 |                               (fAutoView != FALSE));
 | 
|---|
| 342 |       *pswpNew = *pswpClient;
 | 
|---|
| 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;
 | 
|---|
| 348 |       sCount++;
 | 
|---|
| 349 | 
 | 
|---|
| 350 |       pswpNew = (PSWP) mp1 + (soldCount + 4 + (fToolbar != FALSE) +
 | 
|---|
| 351 |                               (fAutoView != FALSE));
 | 
|---|
| 352 |       *pswpNew = *pswpClient;
 | 
|---|
| 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;
 | 
|---|
| 358 |       sCount++;
 | 
|---|
| 359 | 
 | 
|---|
| 360 |       pswpNew = (PSWP) mp1 + (soldCount + 5 + (fToolbar != FALSE) +
 | 
|---|
| 361 |                               (fAutoView != FALSE));
 | 
|---|
| 362 |       *pswpNew = *pswpClient;
 | 
|---|
| 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);
 | 
|---|
| 371 |       sCount++;
 | 
|---|
| 372 | 
 | 
|---|
| 373 |       pswpNew = (PSWP) mp1 + (soldCount + 6 + (fToolbar != FALSE) +
 | 
|---|
| 374 |                               (fAutoView != FALSE));
 | 
|---|
| 375 |       *pswpNew = *pswpClient;
 | 
|---|
| 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;
 | 
|---|
| 382 |       sCount++;
 | 
|---|
| 383 | 
 | 
|---|
| 384 |       pswpNew = (PSWP) mp1 + (soldCount + 7 + (fToolbar != FALSE) +
 | 
|---|
| 385 |                               (fAutoView != FALSE));
 | 
|---|
| 386 |       *pswpNew = *pswpClient;
 | 
|---|
| 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;
 | 
|---|
| 392 |       sCount++;
 | 
|---|
| 393 | 
 | 
|---|
| 394 |       return MRFROMSHORT(sCount);
 | 
|---|
| 395 |     }
 | 
|---|
| 396 | 
 | 
|---|
| 397 |   case WM_QUERYFRAMECTLCOUNT:
 | 
|---|
| 398 |     {
 | 
|---|
| 399 |       SHORT sCount;
 | 
|---|
| 400 | 
 | 
|---|
| 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 |     }
 | 
|---|
| 410 | 
 | 
|---|
| 411 |   case WM_CLOSE:
 | 
|---|
| 412 |     WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), msg, mp1, mp2);
 | 
|---|
| 413 |     return 0;
 | 
|---|
| 414 |   }
 | 
|---|
| 415 |   return (oldproc) ? oldproc(hwnd, msg, mp1, mp2) :
 | 
|---|
| 416 |     PFNWPFrame(hwnd, msg, mp1, mp2);
 | 
|---|
| 417 | }
 | 
|---|
| 418 | 
 | 
|---|
| 419 | static MRESULT EXPENTRY MainWMCommand2(HWND hwnd, ULONG msg, MPARAM mp1,
 | 
|---|
| 420 |                                        MPARAM mp2)
 | 
|---|
| 421 | {
 | 
|---|
| 422 |   PERSON1DATA *pd;
 | 
|---|
| 423 | 
 | 
|---|
| 424 |   SetShiftState();
 | 
|---|
| 425 |   switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 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:
 | 
|---|
| 444 | //    case IDM_SYSINFO:
 | 
|---|
| 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);
 | 
|---|
| 460 | 
 | 
|---|
| 461 |   case IDM_REMAP:
 | 
|---|
| 462 |     WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 463 |               hwnd, RemapDlgProc, FM3ModHandle, MAP_FRAME, NULL);
 | 
|---|
| 464 |     break;
 | 
|---|
| 465 | 
 | 
|---|
| 466 |   case IDM_TWODIRS:                     // Menu action
 | 
|---|
| 467 |   case IDM_WINDOWDLG:                   // Toolbar action
 | 
|---|
| 468 |     pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
 | 
|---|
| 469 |     if (pd) {
 | 
|---|
| 470 | 
 | 
|---|
| 471 |       WALK2 wa;
 | 
|---|
| 472 | 
 | 
|---|
| 473 |       memset(&wa, 0, sizeof(wa));
 | 
|---|
| 474 |       wa.size = sizeof(wa);
 | 
|---|
| 475 |       *wa.szCurrentPath1 = 0;
 | 
|---|
| 476 |       WinSendMsg(pd->hwndDir1,
 | 
|---|
| 477 |                  UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath1), MPVOID);
 | 
|---|
| 478 |       MakeValidDir(wa.szCurrentPath1);
 | 
|---|
| 479 |       *wa.szCurrentPath2 = 0;
 | 
|---|
| 480 |       WinSendMsg(pd->hwndDir2,
 | 
|---|
| 481 |                  UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath2), MPVOID);
 | 
|---|
| 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)) &&
 | 
|---|
| 491 |           (IsRoot(wa.szCurrentPath2) || !IsFile(wa.szCurrentPath2))) {
 | 
|---|
| 492 |         WinSendMsg(WinWindowFromID(WinWindowFromID(pd->hwndDir1,
 | 
|---|
| 493 |                                                    FID_CLIENT), DIR_CNR),
 | 
|---|
| 494 |                    UM_SETDIR, MPFROMP(wa.szCurrentPath1), MPVOID);
 | 
|---|
| 495 |         WinSendMsg(WinWindowFromID(WinWindowFromID(pd->hwndDir2,
 | 
|---|
| 496 |                                                    FID_CLIENT), DIR_CNR),
 | 
|---|
| 497 |                    UM_SETDIR, MPFROMP(wa.szCurrentPath2), MPVOID);
 | 
|---|
| 498 |       }
 | 
|---|
| 499 |     }
 | 
|---|
| 500 |     break;
 | 
|---|
| 501 | 
 | 
|---|
| 502 |   case IDM_COMPARE:
 | 
|---|
| 503 |     pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
 | 
|---|
| 504 |     if (pd) {
 | 
|---|
| 505 | 
 | 
|---|
| 506 |       WALK2 wa;
 | 
|---|
| 507 | 
 | 
|---|
| 508 |       memset(&wa, 0, sizeof(wa));
 | 
|---|
| 509 |       wa.size = sizeof(wa);
 | 
|---|
| 510 |       *wa.szCurrentPath1 = 0;
 | 
|---|
| 511 |       WinSendMsg(pd->hwndDir1,
 | 
|---|
| 512 |                  UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath1), MPVOID);
 | 
|---|
| 513 |       MakeValidDir(wa.szCurrentPath1);
 | 
|---|
| 514 |       *wa.szCurrentPath2 = 0;
 | 
|---|
| 515 |       WinSendMsg(pd->hwndDir2,
 | 
|---|
| 516 |                  UM_CONTAINERDIR, MPFROMP(wa.szCurrentPath2), MPVOID);
 | 
|---|
| 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)) &&
 | 
|---|
| 526 |           (IsRoot(wa.szCurrentPath2) || !IsFile(wa.szCurrentPath2))) {
 | 
|---|
| 527 |         if (!*dircompare) {
 | 
|---|
| 528 | 
 | 
|---|
| 529 |           COMPARE *cmp;
 | 
|---|
| 530 | 
 | 
|---|
| 531 |           cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
 | 
|---|
| 532 |           if (cmp) {
 | 
|---|
| 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;
 | 
|---|
| 538 |             WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 539 |                       HWND_DESKTOP,
 | 
|---|
| 540 |                       CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
 | 
|---|
| 541 |           }
 | 
|---|
| 542 |         }
 | 
|---|
| 543 |         else {
 | 
|---|
| 544 |           CHAR szPath1[CCHMAXPATH];
 | 
|---|
| 545 |           CHAR szPath2[CCHMAXPATH];
 | 
|---|
| 546 |           runemf2(SEPARATE,
 | 
|---|
| 547 |                   HWND_DESKTOP, pszSrcFile, __LINE__,
 | 
|---|
| 548 |                   NULL, NULL,
 | 
|---|
| 549 |                   "%s %s %s",
 | 
|---|
| 550 |                   dircompare,
 | 
|---|
| 551 |                   BldQuotedFileName(szPath1, wa.szCurrentPath1),
 | 
|---|
| 552 |                   BldQuotedFileName(szPath2, wa.szCurrentPath2));
 | 
|---|
| 553 |         }
 | 
|---|
| 554 |       }
 | 
|---|
| 555 |     }
 | 
|---|
| 556 |     break;
 | 
|---|
| 557 | 
 | 
|---|
| 558 |   case IDM_VTREE:
 | 
|---|
| 559 |     WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
 | 
|---|
| 560 |     if (hwndTree) {
 | 
|---|
| 561 |       WinShowWindow(hwndTree, FALSE);
 | 
|---|
| 562 |       PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| 563 |       hwndTree = (HWND) 0;
 | 
|---|
| 564 |     }
 | 
|---|
| 565 |     else {
 | 
|---|
| 566 | 
 | 
|---|
| 567 |       ULONG size = sizeof(ULONG);
 | 
|---|
| 568 | 
 | 
|---|
| 569 |       hwndTree = StartTreeCnr(hwnd, 3);
 | 
|---|
| 570 |       PrfQueryProfileData(fmprof,
 | 
|---|
| 571 |                           realappname,
 | 
|---|
| 572 |                           "FM/4 TreeWidth", (PVOID) & TreeWidth, &size);
 | 
|---|
| 573 |       TreeWidth = max(TreeWidth, 80);
 | 
|---|
| 574 |     }
 | 
|---|
| 575 |     {
 | 
|---|
| 576 |       BOOL dummy = (hwndTree != (HWND) 0);
 | 
|---|
| 577 | 
 | 
|---|
| 578 |       PrfWriteProfileData(fmprof,
 | 
|---|
| 579 |                           realappname,
 | 
|---|
| 580 |                           "FM/4 TreeUp", (PVOID) & dummy, sizeof(dummy));
 | 
|---|
| 581 |     }
 | 
|---|
| 582 |     PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
 | 
|---|
| 583 |     break;
 | 
|---|
| 584 | 
 | 
|---|
| 585 |   case IDM_TILEBACKWARDS:
 | 
|---|
| 586 |     WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
 | 
|---|
| 587 |     fTileBackwards = (fTileBackwards) ? FALSE : TRUE;
 | 
|---|
| 588 |     PrfWriteProfileData(fmprof,
 | 
|---|
| 589 |                         FM3Str,
 | 
|---|
| 590 |                         "TileBackwards",
 | 
|---|
| 591 |                         (PVOID) & fTileBackwards, sizeof(BOOL));
 | 
|---|
| 592 |     PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
 | 
|---|
| 593 |     break;
 | 
|---|
| 594 | 
 | 
|---|
| 595 |   case IDM_NEXTWINDOW:
 | 
|---|
| 596 |   case IDM_PREVWINDOW:
 | 
|---|
| 597 |     pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
 | 
|---|
| 598 |     if (pd) {
 | 
|---|
| 599 | 
 | 
|---|
| 600 |       HWND hwndFocus;
 | 
|---|
| 601 | 
 | 
|---|
| 602 |       if (hwndTree) {
 | 
|---|
| 603 |         if (pd->hwndMax) {
 | 
|---|
| 604 |           if (hwndTree == pd->hwndCurr)
 | 
|---|
| 605 |             hwndFocus = pd->hwndMax;
 | 
|---|
| 606 |           else
 | 
|---|
| 607 |             hwndFocus = hwndTree;
 | 
|---|
| 608 |         }
 | 
|---|
| 609 |         else {
 | 
|---|
| 610 |           if (hwndTree == pd->hwndCurr)
 | 
|---|
| 611 |             hwndFocus = (SHORT1FROMMP(mp1) == IDM_PREVWINDOW) ?
 | 
|---|
| 612 |               pd->hwndDir1 : pd->hwndDir2;
 | 
|---|
| 613 |           else if (pd->hwndDir1 == pd->hwndCurr)
 | 
|---|
| 614 |             hwndFocus = (SHORT1FROMMP(mp1) == IDM_PREVWINDOW) ?
 | 
|---|
| 615 |               pd->hwndDir2 : hwndTree;
 | 
|---|
| 616 |           else
 | 
|---|
| 617 |             hwndFocus = (SHORT1FROMMP(mp1) == IDM_PREVWINDOW) ?
 | 
|---|
| 618 |               hwndTree : pd->hwndDir1;
 | 
|---|
| 619 |         }
 | 
|---|
| 620 |       }
 | 
|---|
| 621 |       else {
 | 
|---|
| 622 |         if (pd->hwndMax)
 | 
|---|
| 623 |           hwndFocus = pd->hwndMax;
 | 
|---|
| 624 |         else
 | 
|---|
| 625 |           hwndFocus = pd->hwndCurr == pd->hwndDir1 ?
 | 
|---|
| 626 |                         pd->hwndDir2 : pd->hwndDir1;
 | 
|---|
| 627 |       }
 | 
|---|
| 628 |       WinSetFocus(HWND_DESKTOP, hwndFocus);
 | 
|---|
| 629 |     }
 | 
|---|
| 630 |     break;
 | 
|---|
| 631 | 
 | 
|---|
| 632 |   case IDM_NOTEBOOK:
 | 
|---|
| 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:
 | 
|---|
| 648 |     WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 649 |               hwnd,
 | 
|---|
| 650 |               CfgDlgProc,
 | 
|---|
| 651 |               FM3ModHandle,
 | 
|---|
| 652 |               CFG_FRAME,
 | 
|---|
| 653 |               MPFROMLONG(mp1)); // 15 Feb 08 SHL
 | 
|---|
| 654 |     PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
 | 
|---|
| 655 |     break;
 | 
|---|
| 656 | 
 | 
|---|
| 657 |   case IDM_SEEALL:
 | 
|---|
| 658 |   case IDM_GREP:
 | 
|---|
| 659 |   case IDM_COLLECTOR:
 | 
|---|
| 660 |     {
 | 
|---|
| 661 |       HWND hwndC;
 | 
|---|
| 662 | 
 | 
|---|
| 663 |       hwndC = StartCollector(HWND_DESKTOP, 4);
 | 
|---|
| 664 |       if (hwndC) {
 | 
|---|
| 665 |         WinSetWindowPos(hwndC,
 | 
|---|
| 666 |                         HWND_TOP,
 | 
|---|
| 667 |                         0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | SWP_ACTIVATE);
 | 
|---|
| 668 |         if (SHORT1FROMMP(mp1) == IDM_GREP)
 | 
|---|
| 669 |           PostMsg(WinWindowFromID(hwndC, FID_CLIENT),
 | 
|---|
| 670 |                   WM_COMMAND, MPFROM2SHORT(IDM_GREP, 0), MPVOID);
 | 
|---|
| 671 |         if (SHORT1FROMMP(mp1) == IDM_SEEALL)
 | 
|---|
| 672 |           PostMsg(WinWindowFromID(hwndC, FID_CLIENT),
 | 
|---|
| 673 |                   WM_COMMAND, MPFROM2SHORT(IDM_SEEALL, 0), MPVOID);
 | 
|---|
| 674 |       }
 | 
|---|
| 675 |     }
 | 
|---|
| 676 |     break;
 | 
|---|
| 677 | 
 | 
|---|
| 678 |   case IDM_EDITCOMMANDS:
 | 
|---|
| 679 |     EditCommands(hwnd);
 | 
|---|
| 680 |     break;
 | 
|---|
| 681 | 
 | 
|---|
| 682 |   default:
 | 
|---|
| 683 |     if (SHORT1FROMMP(mp1) >= IDM_SWITCHSTART &&
 | 
|---|
| 684 |         SHORT1FROMMP(mp1) < IDM_SWITCHSTART + 499) {
 | 
|---|
| 685 |       if (SHORT1FROMMP(mp1) - IDM_SWITCHSTART < numswitches)
 | 
|---|
| 686 |         WinSwitchToProgram(switches[SHORT1FROMMP(mp1) - IDM_SWITCHSTART]);
 | 
|---|
| 687 |       break;
 | 
|---|
| 688 |     }
 | 
|---|
| 689 |     else if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
 | 
|---|
| 690 |              SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
 | 
|---|
| 691 | 
 | 
|---|
| 692 |       INT x;
 | 
|---|
| 693 |       HWND hwndCnr;
 | 
|---|
| 694 | 
 | 
|---|
| 695 |       if (!cmdloaded)
 | 
|---|
| 696 |         load_commands();
 | 
|---|
| 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);
 | 
|---|
| 702 |         break;
 | 
|---|
| 703 |       }
 | 
|---|
| 704 |       x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
 | 
|---|
| 705 |       if (x >= 0) {
 | 
|---|
| 706 |         x++;
 | 
|---|
| 707 |         RunCommand(hwndCnr, x);
 | 
|---|
| 708 |         if (fUnHilite) {
 | 
|---|
| 709 | 
 | 
|---|
| 710 |           PCNRITEM pci;
 | 
|---|
| 711 |           DIRCNRDATA *dcd = NULL;
 | 
|---|
| 712 | 
 | 
|---|
| 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));
 | 
|---|
| 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 |           }
 | 
|---|
| 725 |         }
 | 
|---|
| 726 |       }
 | 
|---|
| 727 |     }
 | 
|---|
| 728 |     else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART &&
 | 
|---|
| 729 |              SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 51) {
 | 
|---|
| 730 |       if (!qtloaded)
 | 
|---|
| 731 |         load_quicktools();
 | 
|---|
| 732 |       if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]) {
 | 
|---|
| 733 |         if (fToolsChanged)
 | 
|---|
| 734 |           save_tools(NULL);
 | 
|---|
| 735 |         if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]))
 | 
|---|
| 736 |           load_tools(NULL);
 | 
|---|
| 737 |         else {
 | 
|---|
| 738 |           strcpy(lasttoolbar,
 | 
|---|
| 739 |                  quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]);
 | 
|---|
| 740 |           PrfWriteProfileString(fmprof, appname, "LastToolbar", lasttoolbar);
 | 
|---|
| 741 |         }
 | 
|---|
| 742 |         PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
 | 
|---|
| 743 |       }
 | 
|---|
| 744 |     }
 | 
|---|
| 745 |     else {
 | 
|---|
| 746 | 
 | 
|---|
| 747 |       HWND hwndActive;
 | 
|---|
| 748 | 
 | 
|---|
| 749 |       hwndActive = TopWindow(hwnd, (HWND) 0);
 | 
|---|
| 750 |       if (hwndActive)
 | 
|---|
| 751 |         PostMsg(WinWindowFromID(hwndActive, FID_CLIENT), msg, mp1, mp2);
 | 
|---|
| 752 |     }
 | 
|---|
| 753 |     break;
 | 
|---|
| 754 |   }
 | 
|---|
| 755 |   return 0;
 | 
|---|
| 756 | }
 | 
|---|
| 757 | 
 | 
|---|
| 758 | static MRESULT EXPENTRY MainWMOnce2(HWND hwnd, ULONG msg, MPARAM mp1,
 | 
|---|
| 759 |                                     MPARAM mp2)
 | 
|---|
| 760 | {
 | 
|---|
| 761 |   PERSON1DATA *pd;
 | 
|---|
| 762 | 
 | 
|---|
| 763 |   switch (msg) {
 | 
|---|
| 764 |   case WM_CREATE:
 | 
|---|
| 765 |     {
 | 
|---|
| 766 |       TID tid;
 | 
|---|
| 767 | 
 | 
|---|
| 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);
 | 
|---|
| 775 |     if (xbeginthread(MakeMainObjWin,
 | 
|---|
| 776 |                      245760,
 | 
|---|
| 777 |                      MPVOID,
 | 
|---|
| 778 |                      pszSrcFile,
 | 
|---|
| 779 |                      __LINE__) == -1)
 | 
|---|
| 780 |     {
 | 
|---|
| 781 |       PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| 782 |       return 0;
 | 
|---|
| 783 |     }
 | 
|---|
| 784 |     else
 | 
|---|
| 785 |       DosSleep(32);//05 Aug 07 GKY 64
 | 
|---|
| 786 | 
 | 
|---|
| 787 |     pd = xmallocz(sizeof(PERSON1DATA), pszSrcFile, __LINE__);
 | 
|---|
| 788 |     if (!pd)
 | 
|---|
| 789 |       WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
 | 
|---|
| 790 |     else {
 | 
|---|
| 791 |       pd->size = sizeof(PERSON1DATA);
 | 
|---|
| 792 |       WinSetWindowPtr(hwnd, QWL_USER + 4, (PVOID) pd);
 | 
|---|
| 793 |     }
 | 
|---|
| 794 |     {
 | 
|---|
| 795 |       SWP swp;
 | 
|---|
| 796 |       PFNWP oldproc;
 | 
|---|
| 797 | 
 | 
|---|
| 798 |       /*
 | 
|---|
| 799 |        * create frame children (not client children, frame children)
 | 
|---|
| 800 |        */
 | 
|---|
| 801 |       DosSleep(1);
 | 
|---|
| 802 |       WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
 | 
|---|
| 803 |       oldproc = WinSubclassWindow(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
| 804 |                                   (PFNWP) MainFrameWndProc2);
 | 
|---|
| 805 |       if (oldproc)
 | 
|---|
| 806 |         WinSetWindowPtr(WinQueryWindow(hwnd, QW_PARENT), QWL_USER, (PVOID) oldproc);
 | 
|---|
| 807 |       CommonCreateMainChildren(hwnd, &swp);
 | 
|---|
| 808 | 
 | 
|---|
| 809 |       {
 | 
|---|
| 810 |         HWND hwndMenu;
 | 
|---|
| 811 | 
 | 
|---|
| 812 |         hwndMenu = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_MENU);
 | 
|---|
| 813 |         WinSetWindowULong(hwnd, QWL_USER, hwndMenu);
 | 
|---|
| 814 |         CfgMenuInit(hwndMenu, FALSE);   // 14 Feb 08 SHL
 | 
|---|
| 815 |         SetConditionalCascade(hwndMenu, IDM_COMMANDLINESUBMENU, IDM_COMMANDLINE);
 | 
|---|
| 816 |         SetConditionalCascade(hwndMenu, IDM_COMMANDSMENU, IDM_DOITYOURSELF);
 | 
|---|
| 817 |         SetConditionalCascade(hwndMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
 | 
|---|
| 818 |       }
 | 
|---|
| 819 |     }
 | 
|---|
| 820 |     WinSetWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
| 821 |                                      FID_TITLEBAR), "FM/2 Lite");
 | 
|---|
| 822 |     FixSwitchList(WinQueryWindow(hwnd, QW_PARENT), NULL);
 | 
|---|
| 823 |     SetSysMenu(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_SYSMENU));
 | 
|---|
| 824 |     break;
 | 
|---|
| 825 | 
 | 
|---|
| 826 |   case UM_SETUP:
 | 
|---|
| 827 |     pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
 | 
|---|
| 828 |     if (pd) {
 | 
|---|
| 829 | 
 | 
|---|
| 830 |       CHAR s[CCHMAXPATH];
 | 
|---|
| 831 |       ULONG size;
 | 
|---|
| 832 |       DIRCNRDATA *dcd;
 | 
|---|
| 833 |       HWND hwndC;
 | 
|---|
| 834 |       BOOL dummy = TRUE;
 | 
|---|
| 835 | 
 | 
|---|
| 836 |       size = sizeof(BOOL);
 | 
|---|
| 837 |       PrfQueryProfileData(fmprof,
 | 
|---|
| 838 |                           realappname, "FM/4 TreeUp", (PVOID) & dummy, &size);
 | 
|---|
| 839 |       if (dummy) {
 | 
|---|
| 840 |         size = sizeof(ULONG);
 | 
|---|
| 841 |         hwndTree = StartTreeCnr(hwnd, 3);
 | 
|---|
| 842 |         PrfQueryProfileData(fmprof,
 | 
|---|
| 843 |                             realappname,
 | 
|---|
| 844 |                             "FM/4 TreeWidth", (PVOID) & TreeWidth, &size);
 | 
|---|
| 845 |         TreeWidth = max(TreeWidth, 80);
 | 
|---|
| 846 |       }
 | 
|---|
| 847 |       size = sizeof(BOOL);
 | 
|---|
| 848 |       if (PrfQueryProfileData(fmprof,
 | 
|---|
| 849 |                               FM3Str,
 | 
|---|
| 850 |                               "Toolbar", &dummy, &size) && size && !dummy)
 | 
|---|
| 851 |         WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
 | 
|---|
| 852 | 
 | 
|---|
| 853 |       size = sizeof(s);
 | 
|---|
| 854 |       *s = 0;
 | 
|---|
| 855 |       if (PrfQueryProfileData(fmprof,
 | 
|---|
| 856 |                               realappname, "FM/4 Dir1", s, &size) && *s)
 | 
|---|
| 857 |         MakeValidDir(s);
 | 
|---|
| 858 |       else
 | 
|---|
| 859 |         save_dir(s);
 | 
|---|
| 860 |       pd->hwndLastDir = pd->hwndCurr = pd->hwndDir1 =
 | 
|---|
| 861 |         StartDirCnr(hwnd, s, (HWND) 0, 3);
 | 
|---|
| 862 |       size = sizeof(s);
 | 
|---|
| 863 |       *s = 0;
 | 
|---|
| 864 |       if (PrfQueryProfileData(fmprof,
 | 
|---|
| 865 |                               realappname, "FM/4 Dir2", s, &size) && *s)
 | 
|---|
| 866 |         MakeValidDir(s);
 | 
|---|
| 867 |       else
 | 
|---|
| 868 |         save_dir(s);
 | 
|---|
| 869 |       pd->hwndDir2 = StartDirCnr(hwnd, s, (HWND) 0, 3);
 | 
|---|
| 870 |       WinSetFocus(HWND_DESKTOP, pd->hwndCurr);
 | 
|---|
| 871 | 
 | 
|---|
| 872 |       hwndC = WinWindowFromID(pd->hwndDir1, FID_CLIENT);
 | 
|---|
| 873 |       if (hwndC) {
 | 
|---|
| 874 |         dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
 | 
|---|
| 875 |         if (dcd) {
 | 
|---|
| 876 |           size = sizeof(INT);
 | 
|---|
| 877 |           if (PrfQueryProfileData(fmprof,
 | 
|---|
| 878 |                                   realappname,
 | 
|---|
| 879 |                                   "FM/4 Dir1.Sort",
 | 
|---|
| 880 |                                   (PVOID) & dcd->sortFlags,
 | 
|---|
| 881 |                                   &size) && size == sizeof(INT)) {
 | 
|---|
| 882 |             if (!dcd->sortFlags)
 | 
|---|
| 883 |               dcd->sortFlags = SORT_PATHNAME;
 | 
|---|
| 884 |           }
 | 
|---|
| 885 |           size = sizeof(MASK);
 | 
|---|
| 886 |           if (PrfQueryProfileData(fmprof,
 | 
|---|
| 887 |                                   realappname,
 | 
|---|
| 888 |                                   "FM/4 Dir1.Filter",
 | 
|---|
| 889 |                                   (PVOID) & dcd->mask, &size) && size) {
 | 
|---|
| 890 |             if (*dcd->mask.szMask)
 | 
|---|
| 891 |               WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
 | 
|---|
| 892 |                          UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
 | 
|---|
| 893 |           }
 | 
|---|
| 894 |           *(dcd->mask.prompt) = 0;
 | 
|---|
| 895 |           size = sizeof(ULONG);
 | 
|---|
| 896 |           if (PrfQueryProfileData(fmprof,
 | 
|---|
| 897 |                                   realappname,
 | 
|---|
| 898 |                                   "FM/4 Dir1.View",
 | 
|---|
| 899 |                                   (PVOID) & dcd->flWindowAttr,
 | 
|---|
| 900 |                                   &size) && size == sizeof(ULONG)) {
 | 
|---|
| 901 | 
 | 
|---|
| 902 |             CNRINFO cnri;
 | 
|---|
| 903 | 
 | 
|---|
| 904 |             memset(&cnri, 0, sizeof(CNRINFO));
 | 
|---|
| 905 |             cnri.cb = sizeof(CNRINFO);
 | 
|---|
| 906 |             if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
 | 
|---|
| 907 |                            CM_QUERYCNRINFO,
 | 
|---|
| 908 |                            MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)))) {
 | 
|---|
| 909 |               cnri.flWindowAttr = dcd->flWindowAttr;
 | 
|---|
| 910 |               WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
 | 
|---|
| 911 |                          CM_SETCNRINFO,
 | 
|---|
| 912 |                          MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));
 | 
|---|
| 913 |             }
 | 
|---|
| 914 |           }
 | 
|---|
| 915 |         }
 | 
|---|
| 916 |       }
 | 
|---|
| 917 | 
 | 
|---|
| 918 |       hwndC = WinWindowFromID(pd->hwndDir2, FID_CLIENT);
 | 
|---|
| 919 |       if (hwndC) {
 | 
|---|
| 920 |         dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
 | 
|---|
| 921 |         if (dcd) {
 | 
|---|
| 922 |           size = sizeof(INT);
 | 
|---|
| 923 |           if (PrfQueryProfileData(fmprof,
 | 
|---|
| 924 |                                   realappname,
 | 
|---|
| 925 |                                   "FM/4 Dir2.Sort",
 | 
|---|
| 926 |                                   (PVOID) & dcd->sortFlags,
 | 
|---|
| 927 |                                   &size) && size == sizeof(INT)) {
 | 
|---|
| 928 |             if (!dcd->sortFlags)
 | 
|---|
| 929 |               dcd->sortFlags = SORT_PATHNAME;
 | 
|---|
| 930 |           }
 | 
|---|
| 931 |           size = sizeof(MASK);
 | 
|---|
| 932 |           if (PrfQueryProfileData(fmprof,
 | 
|---|
| 933 |                                   realappname,
 | 
|---|
| 934 |                                   "FM/4 Dir2.Filter",
 | 
|---|
| 935 |                                   (PVOID) & dcd->mask, &size) && size) {
 | 
|---|
| 936 |             if (*dcd->mask.szMask)
 | 
|---|
| 937 |               WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
 | 
|---|
| 938 |                          UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
 | 
|---|
| 939 |           }
 | 
|---|
| 940 |           *(dcd->mask.prompt) = 0;
 | 
|---|
| 941 |           size = sizeof(ULONG);
 | 
|---|
| 942 |           if (PrfQueryProfileData(fmprof,
 | 
|---|
| 943 |                                   realappname,
 | 
|---|
| 944 |                                   "FM/4 Dir2.View",
 | 
|---|
| 945 |                                   (PVOID) & dcd->flWindowAttr,
 | 
|---|
| 946 |                                   &size) && size == sizeof(ULONG)) {
 | 
|---|
| 947 | 
 | 
|---|
| 948 |             CNRINFO cnri;
 | 
|---|
| 949 | 
 | 
|---|
| 950 |             memset(&cnri, 0, sizeof(CNRINFO));
 | 
|---|
| 951 |             cnri.cb = sizeof(CNRINFO);
 | 
|---|
| 952 |             if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
 | 
|---|
| 953 |                            CM_QUERYCNRINFO,
 | 
|---|
| 954 |                            MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)))) {
 | 
|---|
| 955 |               cnri.flWindowAttr = dcd->flWindowAttr;
 | 
|---|
| 956 |               WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
 | 
|---|
| 957 |                          CM_SETCNRINFO,
 | 
|---|
| 958 |                          MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));
 | 
|---|
| 959 |             }
 | 
|---|
| 960 |           }
 | 
|---|
| 961 |         }
 | 
|---|
| 962 |       }
 | 
|---|
| 963 |     }
 | 
|---|
| 964 |     {
 | 
|---|
| 965 |       ULONG which = 0, size = sizeof(ULONG);
 | 
|---|
| 966 | 
 | 
|---|
| 967 |       if (PrfQueryProfileData(fmprof,
 | 
|---|
| 968 |                               realappname,
 | 
|---|
| 969 |                               "FM/4 Max",
 | 
|---|
| 970 |                               (PVOID) & which,
 | 
|---|
| 971 |                               &size) && size == sizeof(ULONG) && which) {
 | 
|---|
| 972 |         PostMsg(hwnd,
 | 
|---|
| 973 |                 UM_MAXIMIZE,
 | 
|---|
| 974 |                 MPFROMLONG(((which == 1) ?
 | 
|---|
| 975 |                             pd->hwndDir1 : pd->hwndDir2)), MPVOID);
 | 
|---|
| 976 |       }
 | 
|---|
| 977 |     }
 | 
|---|
| 978 |     PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
 | 
|---|
| 979 |     if (!hwndTree)
 | 
|---|
| 980 |       PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
 | 
|---|
| 981 |     load_tools(NULL);
 | 
|---|
| 982 |     PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
 | 
|---|
| 983 |     fRunning = TRUE;
 | 
|---|
| 984 |     return 0;
 | 
|---|
| 985 | 
 | 
|---|
| 986 |   case WM_SAVEAPPLICATION:
 | 
|---|
| 987 |     WinStoreWindowPos(FM2Str,
 | 
|---|
| 988 |                       "MainWindowPos2", WinQueryWindow(hwnd, QW_PARENT));
 | 
|---|
| 989 |     pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
 | 
|---|
| 990 |     if (pd) {
 | 
|---|
| 991 | 
 | 
|---|
| 992 |       CHAR s[CCHMAXPATH];
 | 
|---|
| 993 |       HWND hwndC;
 | 
|---|
| 994 |       DIRCNRDATA *dcd;
 | 
|---|
| 995 |       ULONG flWindowAttr;
 | 
|---|
| 996 | 
 | 
|---|
| 997 |       *s = 0;
 | 
|---|
| 998 |       WinSendMsg(pd->hwndDir1, UM_CONTAINERDIR, MPFROMP(s), MPVOID);
 | 
|---|
| 999 |       if (*s) {
 | 
|---|
| 1000 |         MakeValidDir(s);
 | 
|---|
| 1001 |         PrfWriteProfileString(fmprof, realappname, "FM/4 Dir1", s);
 | 
|---|
| 1002 |       }
 | 
|---|
| 1003 |       *s = 0;
 | 
|---|
| 1004 |       WinSendMsg(pd->hwndDir2, UM_CONTAINERDIR, MPFROMP(s), MPVOID);
 | 
|---|
| 1005 |       if (*s) {
 | 
|---|
| 1006 |         MakeValidDir(s);
 | 
|---|
| 1007 |         PrfWriteProfileString(fmprof, realappname, "FM/4 Dir2", s);
 | 
|---|
| 1008 |       }
 | 
|---|
| 1009 |       flWindowAttr = (pd->hwndMax == pd->hwndDir1) ?
 | 
|---|
| 1010 |         1 : (pd->hwndMax == pd->hwndDir2) ? 2 : 0;
 | 
|---|
| 1011 |       PrfWriteProfileData(fmprof,
 | 
|---|
| 1012 |                           realappname,
 | 
|---|
| 1013 |                           "FM/4 Max", &flWindowAttr, sizeof(flWindowAttr));
 | 
|---|
| 1014 |       hwndC = WinWindowFromID(pd->hwndDir1, FID_CLIENT);
 | 
|---|
| 1015 |       if (hwndC) {
 | 
|---|
| 1016 |         dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
 | 
|---|
| 1017 |         if (dcd) {
 | 
|---|
| 1018 |           flWindowAttr = dcd->flWindowAttr;
 | 
|---|
| 1019 |           if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
 | 
|---|
| 1020 |             flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
 | 
|---|
| 1021 |             if (dcd->lastattr) {
 | 
|---|
| 1022 |               if (dcd->lastattr & CV_TEXT)
 | 
|---|
| 1023 |                 flWindowAttr |= CV_TEXT;
 | 
|---|
| 1024 |               else if (dcd->lastattr & CV_DETAIL)
 | 
|---|
| 1025 |                 flWindowAttr |= CV_DETAIL;
 | 
|---|
| 1026 |               else if (dcd->lastattr & CV_ICON)
 | 
|---|
| 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",
 | 
|---|
| 1037 |                               (PVOID) & dcd->sortFlags, sizeof(INT));
 | 
|---|
| 1038 |           PrfWriteProfileData(fmprof,
 | 
|---|
| 1039 |                               realappname,
 | 
|---|
| 1040 |                               "FM/4 Dir1.Filter",
 | 
|---|
| 1041 |                               (PVOID) & dcd->mask, sizeof(MASK));
 | 
|---|
| 1042 |           PrfWriteProfileData(fmprof,
 | 
|---|
| 1043 |                               realappname,
 | 
|---|
| 1044 |                               "FM/4 Dir1.View",
 | 
|---|
| 1045 |                               (PVOID) & flWindowAttr, sizeof(ULONG));
 | 
|---|
| 1046 |         }
 | 
|---|
| 1047 |       }
 | 
|---|
| 1048 | 
 | 
|---|
| 1049 |       hwndC = WinWindowFromID(pd->hwndDir2, FID_CLIENT);
 | 
|---|
| 1050 |       if (hwndC) {
 | 
|---|
| 1051 |         dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
 | 
|---|
| 1052 |         if (dcd) {
 | 
|---|
| 1053 |           flWindowAttr = dcd->flWindowAttr;
 | 
|---|
| 1054 |           if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
 | 
|---|
| 1055 |             flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
 | 
|---|
| 1056 |             if (dcd->lastattr) {
 | 
|---|
| 1057 |               if (dcd->lastattr & CV_TEXT)
 | 
|---|
| 1058 |                 flWindowAttr |= CV_TEXT;
 | 
|---|
| 1059 |               else if (dcd->lastattr & CV_DETAIL)
 | 
|---|
| 1060 |                 flWindowAttr |= CV_DETAIL;
 | 
|---|
| 1061 |               else if (dcd->lastattr & CV_ICON)
 | 
|---|
| 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",
 | 
|---|
| 1072 |                               (PVOID) & dcd->sortFlags, sizeof(INT));
 | 
|---|
| 1073 |           PrfWriteProfileData(fmprof,
 | 
|---|
| 1074 |                               realappname,
 | 
|---|
| 1075 |                               "FM/4 Dir2.Filter",
 | 
|---|
| 1076 |                               (PVOID) & dcd->mask, sizeof(MASK));
 | 
|---|
| 1077 |           PrfWriteProfileData(fmprof,
 | 
|---|
| 1078 |                               realappname,
 | 
|---|
| 1079 |                               "FM/4 Dir2.View",
 | 
|---|
| 1080 |                               (PVOID) & flWindowAttr, sizeof(ULONG));
 | 
|---|
| 1081 |         }
 | 
|---|
| 1082 |       }
 | 
|---|
| 1083 |     }
 | 
|---|
| 1084 |     break;
 | 
|---|
| 1085 |   }
 | 
|---|
| 1086 |   return WinDefWindowProc(hwnd, msg, mp1, mp2);
 | 
|---|
| 1087 | }
 | 
|---|
| 1088 | 
 | 
|---|
| 1089 | MRESULT EXPENTRY MainWndProc2(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| 1090 | {
 | 
|---|
| 1091 |   PERSON1DATA *pd;
 | 
|---|
| 1092 | 
 | 
|---|
| 1093 |   switch (msg) {
 | 
|---|
| 1094 |   case WM_SAVEAPPLICATION:
 | 
|---|
| 1095 |   case UM_SETUP:
 | 
|---|
| 1096 |   case WM_CREATE:
 | 
|---|
| 1097 |     return MainWMOnce2(hwnd, msg, mp1, mp2);
 | 
|---|
| 1098 | 
 | 
|---|
| 1099 |   case UM_THREADUSE:
 | 
|---|
| 1100 |   case UM_LOADFILE:
 | 
|---|
| 1101 |   case UM_BUILDDRIVEBAR:
 | 
|---|
| 1102 |     return CommonMainWndProc(hwnd, msg, mp1, mp2);
 | 
|---|
| 1103 | 
 | 
|---|
| 1104 |   case UM_SETUP2:
 | 
|---|
| 1105 |     pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
 | 
|---|
| 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);
 | 
|---|
| 1112 |         if (hwndTree)
 | 
|---|
| 1113 |           BoxWindow(hwndTree, (HPS) 0, CLR_PALEGRAY);
 | 
|---|
| 1114 |       }
 | 
|---|
| 1115 |       else {
 | 
|---|
| 1116 |         if (hwndTree)
 | 
|---|
| 1117 |           BoxWindow(hwndTree,
 | 
|---|
| 1118 |                     (HPS) 0,
 | 
|---|
| 1119 |                     (pd->hwndCurr == hwndTree) ? CLR_RED : CLR_WHITE);
 | 
|---|
| 1120 |         if (!pd->hwndMax || pd->hwndMax == pd->hwndDir1)
 | 
|---|
| 1121 |           BoxWindow(pd->hwndDir1,
 | 
|---|
| 1122 |                     (HPS) 0,
 | 
|---|
| 1123 |                     (pd->hwndDir1 == pd->hwndCurr) ?
 | 
|---|
| 1124 |                     CLR_RED :
 | 
|---|
| 1125 |                     (pd->hwndDir1 == pd->hwndLastDir) ?
 | 
|---|
| 1126 |                     CLR_DARKRED : CLR_PALEGRAY);
 | 
|---|
| 1127 |         if (!pd->hwndMax || pd->hwndMax == pd->hwndDir2)
 | 
|---|
| 1128 |           BoxWindow(pd->hwndDir2,
 | 
|---|
| 1129 |                     (HPS) 0,
 | 
|---|
| 1130 |                     (pd->hwndDir2 == pd->hwndCurr) ?
 | 
|---|
| 1131 |                     CLR_RED :
 | 
|---|
| 1132 |                     (pd->hwndDir2 == pd->hwndLastDir) ?
 | 
|---|
| 1133 |                     CLR_DARKRED : CLR_PALEGRAY);
 | 
|---|
| 1134 |       }
 | 
|---|
| 1135 |     }
 | 
|---|
| 1136 |     return 0;
 | 
|---|
| 1137 | 
 | 
|---|
| 1138 |   case WM_BUTTON1DOWN:
 | 
|---|
| 1139 |     shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
 | 
|---|
| 1140 |     if (hwndTree) {
 | 
|---|
| 1141 | 
 | 
|---|
| 1142 |       SWP swp;
 | 
|---|
| 1143 | 
 | 
|---|
| 1144 |       WinQueryWindowPos(hwndTree, &swp);
 | 
|---|
| 1145 |       if (SHORT1FROMMP(mp1) > (swp.x + swp.cx) - 3 &&
 | 
|---|
| 1146 |           SHORT1FROMMP(mp1) < (swp.x + swp.cx) + 3) {
 | 
|---|
| 1147 | 
 | 
|---|
| 1148 |         SWP swpC;
 | 
|---|
| 1149 |         TRACKINFO track;
 | 
|---|
| 1150 | 
 | 
|---|
| 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;
 | 
|---|
| 1169 |         if (WinTrackRect(hwnd, (HPS) 0, &track)) {
 | 
|---|
| 1170 |           TreeWidth = track.rclTrack.xRight - track.rclTrack.xLeft;
 | 
|---|
| 1171 |           PrfWriteProfileData(fmprof,
 | 
|---|
| 1172 |                               realappname,
 | 
|---|
| 1173 |                               "FM/4 TreeWidth", &TreeWidth, sizeof(ULONG));
 | 
|---|
| 1174 |           WinSendMsg(hwnd, UM_SETUP2, MPFROMLONG(1), MPVOID);
 | 
|---|
| 1175 |           PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
 | 
|---|
| 1176 |         }
 | 
|---|
| 1177 |         return (MRESULT) TRUE;
 | 
|---|
| 1178 |       }
 | 
|---|
| 1179 |     }
 | 
|---|
| 1180 |     break;
 | 
|---|
| 1181 | 
 | 
|---|
| 1182 |   case WM_MOUSEMOVE:
 | 
|---|
| 1183 |     shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
 | 
|---|
| 1184 |     if (hwndTree) {
 | 
|---|
| 1185 | 
 | 
|---|
| 1186 |       SWP swp;
 | 
|---|
| 1187 | 
 | 
|---|
| 1188 |       if (WinQueryWindowPos(hwndTree, &swp)) {
 | 
|---|
| 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);
 | 
|---|
| 1194 |       }
 | 
|---|
| 1195 |       else
 | 
|---|
| 1196 |         WinSetPointer(HWND_DESKTOP, hptrArrow);
 | 
|---|
| 1197 |     }
 | 
|---|
| 1198 |     return (MRESULT) TRUE;
 | 
|---|
| 1199 | 
 | 
|---|
| 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;
 | 
|---|
| 1206 | 
 | 
|---|
| 1207 |   case UM_ADVISEFOCUS:
 | 
|---|
| 1208 |     pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
 | 
|---|
| 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);
 | 
|---|
| 1214 |     }
 | 
|---|
| 1215 |     return 0;
 | 
|---|
| 1216 | 
 | 
|---|
| 1217 |   case UM_MAXIMIZE:
 | 
|---|
| 1218 |     if (mp1) {
 | 
|---|
| 1219 |       pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
 | 
|---|
| 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);
 | 
|---|
| 1225 |         }
 | 
|---|
| 1226 |         else
 | 
|---|
| 1227 |           pd->hwndMax = (HWND) 0;
 | 
|---|
| 1228 |         PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
 | 
|---|
| 1229 |       }
 | 
|---|
| 1230 |     }
 | 
|---|
| 1231 |     return 0;
 | 
|---|
| 1232 | 
 | 
|---|
| 1233 |   case WM_INITMENU:
 | 
|---|
| 1234 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 1235 |     case IDM_FILESMENU:
 | 
|---|
| 1236 |     case IDM_VIEWSMENU:
 | 
|---|
| 1237 |     case IDM_DETAILSSETUP:
 | 
|---|
| 1238 |     case IDM_COMMANDSMENU:
 | 
|---|
| 1239 |     case IDM_SORTSUBMENU:
 | 
|---|
| 1240 |       pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
 | 
|---|
| 1241 |       if (pd)
 | 
|---|
| 1242 |         WinSendMsg(pd->hwndCurr, UM_INITMENU, mp1, mp2);
 | 
|---|
| 1243 |       break;
 | 
|---|
| 1244 |     case IDM_CONFIGMENU:
 | 
|---|
| 1245 |       WinCheckMenuItem((HWND) mp2, IDM_TOOLSUBMENU, fToolbar);
 | 
|---|
| 1246 |       WinCheckMenuItem((HWND) mp2, IDM_AUTOVIEW, fAutoView);
 | 
|---|
| 1247 |       break;
 | 
|---|
| 1248 |     case IDM_TOOLSUBMENU:
 | 
|---|
| 1249 |       WinCheckMenuItem((HWND) mp2, IDM_TOOLBAR, fToolbar);
 | 
|---|
| 1250 |       WinCheckMenuItem((HWND) mp2, IDM_TEXTTOOLS, fTextTools);
 | 
|---|
| 1251 |       WinCheckMenuItem((HWND) mp2, IDM_TOOLTITLES, fToolTitles);
 | 
|---|
| 1252 |       break;
 | 
|---|
| 1253 |     case IDM_WINDOWSMENU:
 | 
|---|
| 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));
 | 
|---|
| 1257 |       break;
 | 
|---|
| 1258 |     }
 | 
|---|
| 1259 |     break;
 | 
|---|
| 1260 | 
 | 
|---|
| 1261 |   case WM_SETFOCUS:
 | 
|---|
| 1262 |     if (mp2)
 | 
|---|
| 1263 |       PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
 | 
|---|
| 1264 |     break;
 | 
|---|
| 1265 | 
 | 
|---|
| 1266 |   case UM_FOCUSME:
 | 
|---|
| 1267 |     pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
 | 
|---|
| 1268 |     if (pd)
 | 
|---|
| 1269 |       WinSetFocus(HWND_DESKTOP, pd->hwndCurr);
 | 
|---|
| 1270 |     return 0;
 | 
|---|
| 1271 | 
 | 
|---|
| 1272 |   case UM_RESCAN:
 | 
|---|
| 1273 |     return 0;
 | 
|---|
| 1274 | 
 | 
|---|
| 1275 |   case UM_SIZE:
 | 
|---|
| 1276 |     {
 | 
|---|
| 1277 |       SWP swp;
 | 
|---|
| 1278 | 
 | 
|---|
| 1279 |       if (WinQueryWindowPos(hwnd, &swp)) {
 | 
|---|
| 1280 |         mp1 = MPFROM2SHORT(swp.cx, swp.cy);
 | 
|---|
| 1281 |         mp2 = MPFROM2SHORT(swp.cx, swp.cy);
 | 
|---|
| 1282 |       }
 | 
|---|
| 1283 |       else
 | 
|---|
| 1284 |         return 0;
 | 
|---|
| 1285 |     }
 | 
|---|
| 1286 |     /* intentional fallthru */
 | 
|---|
| 1287 |   case WM_SIZE:
 | 
|---|
| 1288 |     pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
 | 
|---|
| 1289 |     if (mp1 && mp2 && pd && pd->hwndDir1 && pd->hwndDir2) {
 | 
|---|
| 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;
 | 
|---|
| 1300 |       if (!pd->hwndMax) {
 | 
|---|
| 1301 |         if (fTileBackwards) {
 | 
|---|
| 1302 |           WinSetWindowPos(pd->hwndDir1, HWND_TOP,
 | 
|---|
| 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);
 | 
|---|
| 1309 |           WinSetWindowPos(pd->hwndDir2, HWND_TOP,
 | 
|---|
| 1310 |                           TreeWidth + 2,
 | 
|---|
| 1311 |                           2,
 | 
|---|
| 1312 |                           ((SHORT1FROMMP(mp2) - TreeWidth) / 2) - 4,
 | 
|---|
| 1313 |                           SHORT2FROMMP(mp2) - 4,
 | 
|---|
| 1314 |                           SWP_SHOW | SWP_MOVE | SWP_SIZE);
 | 
|---|
| 1315 |         }
 | 
|---|
| 1316 |         else {
 | 
|---|
| 1317 |           WinSetWindowPos(pd->hwndDir1, HWND_TOP,
 | 
|---|
| 1318 |                           TreeWidth + 2,
 | 
|---|
| 1319 |                           2,
 | 
|---|
| 1320 |                           (SHORT1FROMMP(mp2) - TreeWidth) - 4,
 | 
|---|
| 1321 |                           (SHORT2FROMMP(mp2) / 2) - 4,
 | 
|---|
| 1322 |                           SWP_SHOW | SWP_MOVE | SWP_SIZE);
 | 
|---|
| 1323 |           WinSetWindowPos(pd->hwndDir2, HWND_TOP,
 | 
|---|
| 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 |       }
 | 
|---|
| 1331 |       else {
 | 
|---|
| 1332 | 
 | 
|---|
| 1333 |         HWND hwndOther;
 | 
|---|
| 1334 | 
 | 
|---|
| 1335 |         WinSetWindowPos(pd->hwndMax, HWND_TOP,
 | 
|---|
| 1336 |                         TreeWidth + 2,
 | 
|---|
| 1337 |                         2,
 | 
|---|
| 1338 |                         (SHORT1FROMMP(mp2) - TreeWidth) - 4,
 | 
|---|
| 1339 |                         SHORT2FROMMP(mp2) - 4,
 | 
|---|
| 1340 |                         SWP_SHOW | SWP_MOVE | SWP_SIZE);
 | 
|---|
| 1341 |         hwndOther = (pd->hwndMax == pd->hwndDir1) ?
 | 
|---|
| 1342 |           pd->hwndDir2 : pd->hwndDir1;
 | 
|---|
| 1343 |         WinSetWindowPos(hwndOther, HWND_BOTTOM, 0, 0, 0, 0, SWP_HIDE);
 | 
|---|
| 1344 |       }
 | 
|---|
| 1345 |       WinSendMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
 | 
|---|
| 1346 |     }
 | 
|---|
| 1347 |     if (msg == UM_SIZE)
 | 
|---|
| 1348 |       return 0;
 | 
|---|
| 1349 |     break;
 | 
|---|
| 1350 | 
 | 
|---|
| 1351 |   case WM_ERASEBACKGROUND:
 | 
|---|
| 1352 |     WinFillRect((HPS) mp1, (PRECTL) mp2, 0x00d0d0d0);
 | 
|---|
| 1353 |     return 0;
 | 
|---|
| 1354 | 
 | 
|---|
| 1355 |   case WM_PAINT:
 | 
|---|
| 1356 |     {
 | 
|---|
| 1357 |       HPS hps;
 | 
|---|
| 1358 |       RECTL rcl;
 | 
|---|
| 1359 | 
 | 
|---|
| 1360 |       hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
 | 
|---|
| 1361 |       if (hps) {
 | 
|---|
| 1362 |         WinQueryWindowRect(hwnd, &rcl);
 | 
|---|
| 1363 |         WinFillRect(hps, (PRECTL) & rcl, CLR_PALEGRAY);
 | 
|---|
| 1364 |         WinEndPaint(hps);
 | 
|---|
| 1365 |         WinSendMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
 | 
|---|
| 1366 |       }
 | 
|---|
| 1367 |     }
 | 
|---|
| 1368 |     break;
 | 
|---|
| 1369 | 
 | 
|---|
| 1370 |   case UM_COMMAND:
 | 
|---|
| 1371 |   case WM_COMMAND:
 | 
|---|
| 1372 |     return MainWMCommand2(hwnd, msg, mp1, mp2);
 | 
|---|
| 1373 | 
 | 
|---|
| 1374 |   case WM_CLOSE:
 | 
|---|
| 1375 |     fAmClosing = TRUE;
 | 
|---|
| 1376 |     WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
 | 
|---|
| 1377 |     CloseChildren(hwnd);
 | 
|---|
| 1378 |     PostMsg(hwnd, UM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| 1379 |     DosSleep(1);
 | 
|---|
| 1380 |     return 0;
 | 
|---|
| 1381 | 
 | 
|---|
| 1382 |   case UM_CLOSE:
 | 
|---|
| 1383 |     WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
 | 
|---|
| 1384 |     return 0;
 | 
|---|
| 1385 | 
 | 
|---|
| 1386 |   case WM_DESTROY:
 | 
|---|
| 1387 |     hwndMain = (HWND) 0;
 | 
|---|
| 1388 |     pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
 | 
|---|
| 1389 |     xfree(pd, pszSrcFile, __LINE__);
 | 
|---|
| 1390 |     if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
 | 
|---|
| 1391 |       WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
 | 
|---|
| 1392 |     break;
 | 
|---|
| 1393 |   }
 | 
|---|
| 1394 |   return WinDefWindowProc(hwnd, msg, mp1, mp2);
 | 
|---|
| 1395 | }
 | 
|---|
| 1396 | 
 | 
|---|
| 1397 | HWND StartFM32(HAB hab, INT argc, CHAR ** argv)
 | 
|---|
| 1398 | {
 | 
|---|
| 1399 |   HWND hwndFrame, hwndClient;
 | 
|---|
| 1400 |   ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
 | 
|---|
| 1401 |     FCF_SIZEBORDER | FCF_MINMAX |
 | 
|---|
| 1402 |     FCF_ACCELTABLE | FCF_MENU | FCF_ICON | FCF_TASKLIST | FCF_NOBYTEALIGN;
 | 
|---|
| 1403 | 
 | 
|---|
| 1404 |   {
 | 
|---|
| 1405 |     INT x;
 | 
|---|
| 1406 | 
 | 
|---|
| 1407 |     for (x = 1; x < argc; x++) {
 | 
|---|
| 1408 |       if (*argv[x] == '+' && !argv[x][1])
 | 
|---|
| 1409 |         fLogFile = TRUE;
 | 
|---|
| 1410 |       if (*argv[x] == '-') {
 | 
|---|
| 1411 |         if (argv[x][1])
 | 
|---|
| 1412 |           strcpy(profile, &argv[x][1]);
 | 
|---|
| 1413 |       }
 | 
|---|
| 1414 |     }
 | 
|---|
| 1415 |   }
 | 
|---|
| 1416 |   {
 | 
|---|
| 1417 |     CHAR inipath[CCHMAXPATH], fullpath[CCHMAXPATH];
 | 
|---|
| 1418 |     FILESTATUS3 fsa;
 | 
|---|
| 1419 | 
 | 
|---|
| 1420 |     if (PrfQueryProfileString(HINI_USERPROFILE,
 | 
|---|
| 1421 |                               FM2Str,
 | 
|---|
| 1422 |                               "Home", NULL, inipath, sizeof(inipath))) {
 | 
|---|
| 1423 |       if (!DosQueryPathInfo(inipath, FIL_STANDARD, &fsa, sizeof(fsa))) {
 | 
|---|
| 1424 |         if (fsa.attrFile & FILE_DIRECTORY) {
 | 
|---|
| 1425 |           if (DosQueryPathInfo(inipath,
 | 
|---|
| 1426 |                                FIL_QUERYFULLNAME, fullpath, sizeof(fullpath)))
 | 
|---|
| 1427 |             strcpy(fullpath, inipath);
 | 
|---|
| 1428 |           switch_to(fullpath);
 | 
|---|
| 1429 |         }
 | 
|---|
| 1430 |       }
 | 
|---|
| 1431 |     }
 | 
|---|
| 1432 |   }
 | 
|---|
| 1433 | 
 | 
|---|
| 1434 |   hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
 | 
|---|
| 1435 |                                  WS_VISIBLE,
 | 
|---|
| 1436 |                                  &FrameFlags,
 | 
|---|
| 1437 |                                  WC_MAINWND2,
 | 
|---|
| 1438 |                                  NULL,
 | 
|---|
| 1439 |                                  WS_VISIBLE | WS_ANIMATE,
 | 
|---|
| 1440 |                                  FM3ModHandle, MAIN2_FRAME, &hwndClient);
 | 
|---|
| 1441 |   if (hwndFrame) {
 | 
|---|
| 1442 |     hwndMainMenu = WinWindowFromID(hwndFrame, FID_MENU);
 | 
|---|
| 1443 |     if (!WinRestoreWindowPos(FM2Str, "MainWindowPos2", hwndFrame)) {
 | 
|---|
| 1444 | 
 | 
|---|
| 1445 |       ULONG fl = SWP_MOVE | SWP_SIZE;
 | 
|---|
| 1446 |       RECTL rcl;
 | 
|---|
| 1447 |       ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 3L;
 | 
|---|
| 1448 |       ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
 | 
|---|
| 1449 | 
 | 
|---|
| 1450 |       WinQueryWindowRect(HWND_DESKTOP, &rcl);
 | 
|---|
| 1451 |       rcl.yBottom += icz;
 | 
|---|
| 1452 |       rcl.yTop -= bsz;
 | 
|---|
| 1453 |       rcl.xLeft += bsz;
 | 
|---|
| 1454 |       rcl.xRight -= bsz;
 | 
|---|
| 1455 |       WinSetWindowPos(hwndFrame,
 | 
|---|
| 1456 |                       HWND_TOP,
 | 
|---|
| 1457 |                       rcl.xLeft,
 | 
|---|
| 1458 |                       rcl.yBottom,
 | 
|---|
| 1459 |                       rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, fl);
 | 
|---|
| 1460 |     }
 | 
|---|
| 1461 |     if (fLogFile)
 | 
|---|
| 1462 |       LogFileHandle = _fsopen("FM2.LOG", "a+", SH_DENYWR);
 | 
|---|
| 1463 |     if (hwndHelp)
 | 
|---|
| 1464 |       WinAssociateHelpInstance(hwndHelp, hwndFrame);
 | 
|---|
| 1465 |     PostMsg(hwndClient, UM_SETUP, MPFROMLONG(argc), MPFROMP(argv));
 | 
|---|
| 1466 |   }
 | 
|---|
| 1467 |   return hwndFrame;
 | 
|---|
| 1468 | }
 | 
|---|
| 1469 | 
 | 
|---|
| 1470 | #pragma alloc_text(PERSON11,MainFrameWndProc2,MainWndProc2)
 | 
|---|
| 1471 | #pragma alloc_text(PERSON12,StartFM32,MainWMOnce2)
 | 
|---|
| 1472 | #pragma alloc_text(PERSON13,MainWMCommand2)
 | 
|---|