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