| 1 | /***********************************************************************
 | 
|---|
| 2 | 
 | 
|---|
| 3 |   $Id: misc.c 1159 2008-09-05 21:41:13Z jbs $
 | 
|---|
| 4 | 
 | 
|---|
| 5 |   Misc GUI support functions
 | 
|---|
| 6 | 
 | 
|---|
| 7 |   Copyright (c) 1993-98 M. Kimes
 | 
|---|
| 8 |   Copyright (c) 2003, 2008 Steven H. Levine
 | 
|---|
| 9 | 
 | 
|---|
| 10 |   11 Jun 03 SHL Add JFS and FAT32 support
 | 
|---|
| 11 |   01 Aug 04 SHL Rework lstrip/rstrip usage
 | 
|---|
| 12 |   01 Aug 04 SHL LoadLibPath: avoid buffer overflow
 | 
|---|
| 13 |   07 Jun 05 SHL Drop obsoletes
 | 
|---|
| 14 |   24 Jul 05 SHL Beautify
 | 
|---|
| 15 |   24 Jul 05 SHL Correct longname display option
 | 
|---|
| 16 |   17 Jul 06 SHL Use Runtime_Error
 | 
|---|
| 17 |   26 Jul 06 SHL Use chop_at_crnl
 | 
|---|
| 18 |   27 Jul 06 SHL Comments, apply indent
 | 
|---|
| 19 |   29 Jul 06 SHL Use xfgets_bstripcr
 | 
|---|
| 20 |   16 Aug 06 SHL Comments
 | 
|---|
| 21 |   31 Aug 06 SHL disable_menuitem: rework args to match name - sheesh
 | 
|---|
| 22 |   10 Oct 06 GKY Add NDFS32 support
 | 
|---|
| 23 |   18 Feb 07 GKY More drive type and drive icon support
 | 
|---|
| 24 |   10 Jun 07 GKY Add IsFm2Window as part of work around PM drag limit
 | 
|---|
| 25 |   05 Jul 07 GKY Fix menu removals for WORKPLACE_PROCESS=YES
 | 
|---|
| 26 |   23 Jul 07 SHL Sync with CNRITEM updates (ticket#24)
 | 
|---|
| 27 |   31 Jul 07 SHL Clean up and report errors (ticket#24)
 | 
|---|
| 28 |   03 Aug 07 GKY Direct editting fixed (ticket#24)
 | 
|---|
| 29 |   06 Aug 07 SHL Use BldQuotedFileName
 | 
|---|
| 30 |   06 Aug 07 GKY Increase Subject EA to 1024
 | 
|---|
| 31 |   06 Aug 07 GKY Reduce DosSleep times (ticket 148)
 | 
|---|
| 32 |   14 Aug 07 SHL Delete obsoletes
 | 
|---|
| 33 |   14 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat
 | 
|---|
| 34 |   01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry
 | 
|---|
| 35 |   05 Nov 07 GKY Use commafmtULL to display file sizes for large file support
 | 
|---|
| 36 |   22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
 | 
|---|
| 37 |   12 Jan 08 SHL Document SetConditionalCascade
 | 
|---|
| 38 |   13 Jan 08 GKY Get Subjectwidth/Subjectleft working in the collector.
 | 
|---|
| 39 |   19 Jan 08 JBS Ticket 150: fix/improve save and restore of dir cnr state at FM/2 close/reopen
 | 
|---|
| 40 |   21 Jan 08 GKY Stop reallocating NullStr by direct editing of empty subject and longname strings.
 | 
|---|
| 41 |   29 Feb 08 GKY Use xfree where appropriate
 | 
|---|
| 42 |   08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with
 | 
|---|
| 43 |                 keys using a "DirCnr." prefix
 | 
|---|
| 44 |   19 Jun 08 JBS Ticket 239: Fix LoadDetailsSwitches so INI file is read correctly and details
 | 
|---|
| 45 |                 switches are set correctly.
 | 
|---|
| 46 |   11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
 | 
|---|
| 47 |                 all the details view settings (both the global variables and those in the
 | 
|---|
| 48 |                 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
 | 
|---|
| 49 |   17 Jul 08 SHL Add GetTidForWindow for Fortify support
 | 
|---|
| 50 |   20 Jul 08 GKY Add save/append filename to clipboard.
 | 
|---|
| 51 |                 Change menu wording to make these easier to find
 | 
|---|
| 52 |   23 Aug 08 GKY Add CheckDriveSpaceAvail To pre check drive space to prevent failures
 | 
|---|
| 53 | 
 | 
|---|
| 54 | ***********************************************************************/
 | 
|---|
| 55 | 
 | 
|---|
| 56 | #include <stdlib.h>
 | 
|---|
| 57 | #include <string.h>
 | 
|---|
| 58 | #include <ctype.h>
 | 
|---|
| 59 | #include <share.h>
 | 
|---|
| 60 | #include <malloc.h>                     // _heapmin
 | 
|---|
| 61 | 
 | 
|---|
| 62 | #define INCL_DOS
 | 
|---|
| 63 | #define INCL_WIN
 | 
|---|
| 64 | #define INCL_GPI
 | 
|---|
| 65 | #define INCL_LONGLONG
 | 
|---|
| 66 | 
 | 
|---|
| 67 | #include "fm3dlg.h"
 | 
|---|
| 68 | #include "fm3str.h"
 | 
|---|
| 69 | #include "pathutil.h"                   // BldQuotedFileName
 | 
|---|
| 70 | #include "errutil.h"                    // Dos_Error...
 | 
|---|
| 71 | #include "strutil.h"                    // GetPString
 | 
|---|
| 72 | #include "command.h"                    // LINKCMDS
 | 
|---|
| 73 | #include "cmdline.h"                    // CmdLineDlgProc
 | 
|---|
| 74 | #include "defview.h"                    // QuickView
 | 
|---|
| 75 | #include "copyf.h"                      // WriteLongName
 | 
|---|
| 76 | #include "strips.h"                     // chop_at_crnl
 | 
|---|
| 77 | #include "fm3dll.h"
 | 
|---|
| 78 | #include "fortify.h"
 | 
|---|
| 79 | #include "misc.h"
 | 
|---|
| 80 | 
 | 
|---|
| 81 | #pragma data_seg(DATA1)
 | 
|---|
| 82 | 
 | 
|---|
| 83 | static PSZ pszSrcFile = __FILE__;
 | 
|---|
| 84 | 
 | 
|---|
| 85 | #ifndef BEGIN_LIBPATH
 | 
|---|
| 86 | #define BEGIN_LIBPATH       1
 | 
|---|
| 87 | #endif
 | 
|---|
| 88 | 
 | 
|---|
| 89 | #ifndef END_LIBPATH
 | 
|---|
| 90 | #define END_LIBPATH           2
 | 
|---|
| 91 | #endif
 | 
|---|
| 92 | 
 | 
|---|
| 93 | #ifndef ORD_DOS32QUERYEXTLIBPATH
 | 
|---|
| 94 | #define ORD_DOS32QUERYEXTLIBPATH 874
 | 
|---|
| 95 | #endif
 | 
|---|
| 96 | 
 | 
|---|
| 97 | BOOL IsFm2Window(HWND hwnd, BOOL chkTid)
 | 
|---|
| 98 | {
 | 
|---|
| 99 |     PIB *ppib;
 | 
|---|
| 100 |     TIB *ptib;
 | 
|---|
| 101 |     BOOL yes;
 | 
|---|
| 102 |     APIRET rc = DosGetInfoBlocks(&ptib, &ppib);
 | 
|---|
| 103 | 
 | 
|---|
| 104 |     if (rc) {
 | 
|---|
| 105 |       Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
 | 
|---|
| 106 |                 "DosGetInfoBlocks");
 | 
|---|
| 107 |       yes = FALSE;
 | 
|---|
| 108 |     }
 | 
|---|
| 109 |     else {
 | 
|---|
| 110 |       PID pid;
 | 
|---|
| 111 |       TID tid;
 | 
|---|
| 112 | 
 | 
|---|
| 113 |       // Check window owned by FM2 process
 | 
|---|
| 114 |       // Check say same thread too, if requested
 | 
|---|
| 115 |       // OK for window to be dead - just return FALSE
 | 
|---|
| 116 |       yes = WinQueryWindowProcess(hwnd, &pid, &tid) &&
 | 
|---|
| 117 |             pid == ppib->pib_ulpid &&
 | 
|---|
| 118 |             (!chkTid || tid == ptib->tib_ptib2->tib2_ultid);
 | 
|---|
| 119 |     }
 | 
|---|
| 120 |     return yes;
 | 
|---|
| 121 | }
 | 
|---|
| 122 | 
 | 
|---|
| 123 | #ifdef FORTIFY
 | 
|---|
| 124 | 
 | 
|---|
| 125 | /**
 | 
|---|
| 126 |  * Return thread ordinal for fm/2 window
 | 
|---|
| 127 |  * window must exist and must be created by fm/2
 | 
|---|
| 128 |  * @param hwnd is window handle
 | 
|---|
| 129 |  * @returns thread ordinal or -1 if error
 | 
|---|
| 130 |  */
 | 
|---|
| 131 | 
 | 
|---|
| 132 | INT GetTidForWindow(HWND hwnd)
 | 
|---|
| 133 | {
 | 
|---|
| 134 |     PIB *ppib;
 | 
|---|
| 135 |     TIB *ptib;
 | 
|---|
| 136 |     LONG ordinal = -1;
 | 
|---|
| 137 |     APIRET rc = DosGetInfoBlocks(&ptib, &ppib);
 | 
|---|
| 138 | 
 | 
|---|
| 139 |     if (rc) {
 | 
|---|
| 140 |       Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
 | 
|---|
| 141 |                 "DosGetInfoBlocks");
 | 
|---|
| 142 |     }
 | 
|---|
| 143 |     else {
 | 
|---|
| 144 |       PID pid;
 | 
|---|
| 145 |       TID tid;
 | 
|---|
| 146 |       if (!WinQueryWindowProcess(hwnd, &pid, &tid))
 | 
|---|
| 147 |         Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryWindowProcess failed for %X", hwnd);
 | 
|---|
| 148 |       else if (pid != ppib->pib_ulpid)
 | 
|---|
| 149 |         Runtime_Error(pszSrcFile, __LINE__, "hwnd %X not created by fm/2", hwnd);
 | 
|---|
| 150 |       else
 | 
|---|
| 151 |         ordinal = ptib->tib_ptib2->tib2_ultid;
 | 
|---|
| 152 |     }
 | 
|---|
| 153 |     return ordinal;
 | 
|---|
| 154 | }
 | 
|---|
| 155 | 
 | 
|---|
| 156 | /**
 | 
|---|
| 157 |  * Return thread ordinal for current thread
 | 
|---|
| 158 |  * @returns thread ordinal or -1 if error
 | 
|---|
| 159 |  */
 | 
|---|
| 160 | 
 | 
|---|
| 161 | INT GetTidForThread(VOID)
 | 
|---|
| 162 | {
 | 
|---|
| 163 |     PIB *ppib;
 | 
|---|
| 164 |     TIB *ptib;
 | 
|---|
| 165 |     LONG ordinal = -1;
 | 
|---|
| 166 |     APIRET rc = DosGetInfoBlocks(&ptib, &ppib);
 | 
|---|
| 167 | 
 | 
|---|
| 168 |     if (rc) {
 | 
|---|
| 169 |       Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
 | 
|---|
| 170 |                 "DosGetInfoBlocks");
 | 
|---|
| 171 |     }
 | 
|---|
| 172 |     else
 | 
|---|
| 173 |       ordinal = ptib->tib_ptib2->tib2_ultid;
 | 
|---|
| 174 | 
 | 
|---|
| 175 |     return ordinal;
 | 
|---|
| 176 | }
 | 
|---|
| 177 | 
 | 
|---|
| 178 | #endif // FORTIFY
 | 
|---|
| 179 | 
 | 
|---|
| 180 | VOID SetShiftState(VOID)
 | 
|---|
| 181 | {
 | 
|---|
| 182 |   shiftstate = 0;
 | 
|---|
| 183 |   if (WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000)
 | 
|---|
| 184 |     shiftstate |= KC_CTRL;
 | 
|---|
| 185 |   if (WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000)
 | 
|---|
| 186 |     shiftstate |= KC_SHIFT;
 | 
|---|
| 187 |   if (WinGetKeyState(HWND_DESKTOP, VK_ALT) & 0x8000)
 | 
|---|
| 188 |     shiftstate |= KC_ALT;
 | 
|---|
| 189 | }
 | 
|---|
| 190 | 
 | 
|---|
| 191 | void EmphasizeButton(HWND hwnd, BOOL on)
 | 
|---|
| 192 | {
 | 
|---|
| 193 |   HPS hps = DrgGetPS(hwnd);
 | 
|---|
| 194 | 
 | 
|---|
| 195 |   // fixme to complain?
 | 
|---|
| 196 |   if (hps) {
 | 
|---|
| 197 |     POINTL ptl;
 | 
|---|
| 198 |     SWP swp;
 | 
|---|
| 199 | 
 | 
|---|
| 200 |     WinQueryWindowPos(hwnd, &swp);
 | 
|---|
| 201 |     ptl.x = 1;
 | 
|---|
| 202 |     ptl.y = 1;
 | 
|---|
| 203 |     GpiMove(hps, &ptl);
 | 
|---|
| 204 |     GpiSetColor(hps, on ? CLR_BLACK : CLR_PALEGRAY);
 | 
|---|
| 205 |     ptl.x = swp.cx - 2;
 | 
|---|
| 206 |     ptl.y = swp.cy - 2;
 | 
|---|
| 207 |     GpiBox(hps, DRO_OUTLINE, &ptl, 0, 0);
 | 
|---|
| 208 |     DrgReleasePS(hps);
 | 
|---|
| 209 |     if (remove) //fixme always true
 | 
|---|
| 210 |       WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 211 |   }
 | 
|---|
| 212 | }
 | 
|---|
| 213 | 
 | 
|---|
| 214 | void DrawTargetEmphasis(HWND hwnd, BOOL on)
 | 
|---|
| 215 | {
 | 
|---|
| 216 |   HPS hps = DrgGetPS(WinQueryWindow(hwnd, QW_PARENT));
 | 
|---|
| 217 | 
 | 
|---|
| 218 |   if (hps) {
 | 
|---|
| 219 |     BoxWindow(hwnd, hps, on ? CLR_BLACK : CLR_PALEGRAY);
 | 
|---|
| 220 |     DrgReleasePS(hps);
 | 
|---|
| 221 |   }
 | 
|---|
| 222 | }
 | 
|---|
| 223 | 
 | 
|---|
| 224 | void BoxWindow(HWND hwnd, HPS hps, LONG color)
 | 
|---|
| 225 | {
 | 
|---|
| 226 |   POINTL ptl;
 | 
|---|
| 227 |   SWP swp;
 | 
|---|
| 228 |   BOOL releaseme = FALSE;
 | 
|---|
| 229 | 
 | 
|---|
| 230 |   if (!hps) {
 | 
|---|
| 231 |     hps = WinGetPS(WinQueryWindow(hwnd, QW_PARENT));
 | 
|---|
| 232 |     releaseme = TRUE;
 | 
|---|
| 233 |   }
 | 
|---|
| 234 |   if (hps && WinQueryWindowPos(hwnd, &swp)) {
 | 
|---|
| 235 |     ptl.x = swp.x - 2;
 | 
|---|
| 236 |     ptl.y = swp.y - 2;
 | 
|---|
| 237 |     GpiMove(hps, &ptl);
 | 
|---|
| 238 |     GpiSetColor(hps, color);
 | 
|---|
| 239 |     ptl.x = swp.x + swp.cx + 1;
 | 
|---|
| 240 |     ptl.y = swp.y + swp.cy + 1;
 | 
|---|
| 241 |     GpiBox(hps, DRO_OUTLINE, &ptl, 0, 0);
 | 
|---|
| 242 |   }
 | 
|---|
| 243 |   if (releaseme && hps)
 | 
|---|
| 244 |     WinReleasePS(hps);
 | 
|---|
| 245 | }
 | 
|---|
| 246 | 
 | 
|---|
| 247 | void PaintSTextWindow(HWND hwnd, HPS hps)
 | 
|---|
| 248 | {
 | 
|---|
| 249 |   /*
 | 
|---|
| 250 |    * paint a text window such that the rightmost part of the text is
 | 
|---|
| 251 |    * always visible even if the text length exceeds the length of the
 | 
|---|
| 252 |    * window -- otherwise, paint the window so that it is left-justified
 | 
|---|
| 253 |    * and vertically centered.
 | 
|---|
| 254 |    */
 | 
|---|
| 255 | 
 | 
|---|
| 256 |   char *s = NULL;
 | 
|---|
| 257 |   long len;
 | 
|---|
| 258 |   POINTL aptl[TXTBOX_COUNT], ptl;
 | 
|---|
| 259 |   RECTL rcl;
 | 
|---|
| 260 |   char *p;
 | 
|---|
| 261 |   BOOL releaseme = FALSE;
 | 
|---|
| 262 | 
 | 
|---|
| 263 |   if (!hps) {
 | 
|---|
| 264 |     releaseme = TRUE;
 | 
|---|
| 265 |     hps = WinGetPS(hwnd);
 | 
|---|
| 266 |   }
 | 
|---|
| 267 |   if (hps) {
 | 
|---|
| 268 |     WinQueryWindowRect(hwnd, &rcl);
 | 
|---|
| 269 |     WinFillRect(hps, &rcl, CLR_PALEGRAY);
 | 
|---|
| 270 |     len = WinQueryWindowTextLength(hwnd);
 | 
|---|
| 271 |     if (len)
 | 
|---|
| 272 |       s = xmalloc(len + 1, pszSrcFile, __LINE__);
 | 
|---|
| 273 |     if (s) {
 | 
|---|
| 274 |       *s = 0;
 | 
|---|
| 275 |       WinQueryWindowText(hwnd, CCHMAXPATH, s);
 | 
|---|
| 276 |       if (*s) {
 | 
|---|
| 277 |         rcl.xRight -= 3;
 | 
|---|
| 278 |         p = s;
 | 
|---|
| 279 |         GpiQueryTextBox(hps, 3, "...", TXTBOX_COUNT, aptl);
 | 
|---|
| 280 |         len = aptl[TXTBOX_TOPRIGHT].x;
 | 
|---|
| 281 |         do {
 | 
|---|
| 282 |           GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
 | 
|---|
| 283 |           if (aptl[TXTBOX_TOPRIGHT].x > (rcl.xRight - (p != s ? len : 0)))
 | 
|---|
| 284 |             p++;
 | 
|---|
| 285 |           else
 | 
|---|
| 286 |             break;
 | 
|---|
| 287 |         }
 | 
|---|
| 288 |         while (*p);
 | 
|---|
| 289 |         if (*p) {
 | 
|---|
| 290 |           GpiSetMix(hps, FM_OVERPAINT);
 | 
|---|
| 291 |           GpiSetColor(hps, CLR_BLACK);
 | 
|---|
| 292 |           ptl.x = 3;
 | 
|---|
| 293 |           ptl.y = ((rcl.yTop / 2) -
 | 
|---|
| 294 |                    ((aptl[TXTBOX_TOPRIGHT].y +
 | 
|---|
| 295 |                      aptl[TXTBOX_BOTTOMLEFT].y) / 2));
 | 
|---|
| 296 |           GpiMove(hps, &ptl);
 | 
|---|
| 297 |           if (p != s)
 | 
|---|
| 298 |             GpiCharString(hps, 3, "...");
 | 
|---|
| 299 |           GpiCharString(hps, strlen(p), p);
 | 
|---|
| 300 |         }
 | 
|---|
| 301 |       }
 | 
|---|
| 302 |       free(s);
 | 
|---|
| 303 |     }
 | 
|---|
| 304 |     if (releaseme)
 | 
|---|
| 305 |       WinReleasePS(hps);
 | 
|---|
| 306 |   }
 | 
|---|
| 307 | }
 | 
|---|
| 308 | 
 | 
|---|
| 309 | VOID PaintRecessedWindow(HWND hwnd, HPS hps, BOOL outtie, BOOL dbl)
 | 
|---|
| 310 | {
 | 
|---|
| 311 |   /*
 | 
|---|
| 312 |    * paint a recessed box around the window
 | 
|---|
| 313 |    * two pixels width required around window for painting...
 | 
|---|
| 314 |    */
 | 
|---|
| 315 |   BOOL releaseme = FALSE;
 | 
|---|
| 316 | 
 | 
|---|
| 317 |   if (!hps) {
 | 
|---|
| 318 |     hps = WinGetPS(WinQueryWindow(hwnd, QW_PARENT));
 | 
|---|
| 319 |     releaseme = TRUE;
 | 
|---|
| 320 |   }
 | 
|---|
| 321 |   if (hps) {
 | 
|---|
| 322 | 
 | 
|---|
| 323 |     POINTL ptl;
 | 
|---|
| 324 |     SWP swp;
 | 
|---|
| 325 | 
 | 
|---|
| 326 |     WinQueryWindowPos(hwnd, &swp);
 | 
|---|
| 327 |     ptl.x = swp.x - 1;
 | 
|---|
| 328 |     ptl.y = swp.y - 1;
 | 
|---|
| 329 |     GpiMove(hps, &ptl);
 | 
|---|
| 330 |     if (!outtie)
 | 
|---|
| 331 |       GpiSetColor(hps, CLR_WHITE);
 | 
|---|
| 332 |     else
 | 
|---|
| 333 |       GpiSetColor(hps, CLR_DARKGRAY);
 | 
|---|
| 334 |     ptl.x = swp.x + swp.cx;
 | 
|---|
| 335 |     GpiLine(hps, &ptl);
 | 
|---|
| 336 |     ptl.y = swp.y + swp.cy;
 | 
|---|
| 337 |     GpiLine(hps, &ptl);
 | 
|---|
| 338 |     if (dbl) {
 | 
|---|
| 339 |       ptl.x = swp.x - 2;
 | 
|---|
| 340 |       ptl.y = swp.y - 2;
 | 
|---|
| 341 |       GpiMove(hps, &ptl);
 | 
|---|
| 342 |       ptl.x = swp.x + swp.cx + 1;
 | 
|---|
| 343 |       GpiLine(hps, &ptl);
 | 
|---|
| 344 |       ptl.y = swp.y + swp.cy + 1;
 | 
|---|
| 345 |       GpiLine(hps, &ptl);
 | 
|---|
| 346 |     }
 | 
|---|
| 347 |     if (!outtie)
 | 
|---|
| 348 |       GpiSetColor(hps, CLR_DARKGRAY);
 | 
|---|
| 349 |     else
 | 
|---|
| 350 |       GpiSetColor(hps, CLR_WHITE);
 | 
|---|
| 351 |     if (dbl) {
 | 
|---|
| 352 |       ptl.x = swp.x - 2;
 | 
|---|
| 353 |       GpiLine(hps, &ptl);
 | 
|---|
| 354 |       ptl.y = swp.y - 2;
 | 
|---|
| 355 |       GpiLine(hps, &ptl);
 | 
|---|
| 356 |       ptl.x = swp.x + swp.cx;
 | 
|---|
| 357 |       ptl.y = swp.y + swp.cy;
 | 
|---|
| 358 |       GpiMove(hps, &ptl);
 | 
|---|
| 359 |     }
 | 
|---|
| 360 |     ptl.x = swp.x - 1;
 | 
|---|
| 361 |     GpiLine(hps, &ptl);
 | 
|---|
| 362 |     ptl.y = swp.y - 1;
 | 
|---|
| 363 |     GpiLine(hps, &ptl);
 | 
|---|
| 364 |     GpiSetColor(hps, CLR_PALEGRAY);
 | 
|---|
| 365 |     ptl.x = swp.x - (2 + (dbl != FALSE));
 | 
|---|
| 366 |     ptl.y = swp.y - (2 + (dbl != FALSE));
 | 
|---|
| 367 |     GpiMove(hps, &ptl);
 | 
|---|
| 368 |     ptl.x = swp.x + swp.cx + (1 + (dbl != FALSE));
 | 
|---|
| 369 |     GpiLine(hps, &ptl);
 | 
|---|
| 370 |     ptl.y = swp.y + swp.cy + (1 + (dbl != FALSE));
 | 
|---|
| 371 |     GpiLine(hps, &ptl);
 | 
|---|
| 372 |     ptl.x = swp.x - (2 + (dbl != FALSE));
 | 
|---|
| 373 |     GpiLine(hps, &ptl);
 | 
|---|
| 374 |     ptl.y = swp.y - (2 + (dbl != FALSE));
 | 
|---|
| 375 |     GpiLine(hps, &ptl);
 | 
|---|
| 376 |     if (releaseme)
 | 
|---|
| 377 |       WinReleasePS(hps);
 | 
|---|
| 378 |   }
 | 
|---|
| 379 | }
 | 
|---|
| 380 | 
 | 
|---|
| 381 | BOOL AdjustCnrColVis(HWND hwndCnr, CHAR * title, BOOL visible, BOOL toggle)
 | 
|---|
| 382 | {
 | 
|---|
| 383 |   PFIELDINFO pfi = (PFIELDINFO) WinSendMsg(hwndCnr,
 | 
|---|
| 384 |                                            CM_QUERYDETAILFIELDINFO,
 | 
|---|
| 385 |                                            MPVOID, MPFROMSHORT(CMA_FIRST));
 | 
|---|
| 386 | 
 | 
|---|
| 387 |   while (pfi) {
 | 
|---|
| 388 |     if (!strcmp(pfi->pTitleData, title)) {
 | 
|---|
| 389 |       if (toggle) {
 | 
|---|
| 390 |         if (pfi->flData & CFA_INVISIBLE)
 | 
|---|
| 391 |           pfi->flData &= (~CFA_INVISIBLE);
 | 
|---|
| 392 |         else
 | 
|---|
| 393 |           pfi->flData |= CFA_INVISIBLE;
 | 
|---|
| 394 |         return !(pfi->flData & CFA_INVISIBLE);
 | 
|---|
| 395 |       }
 | 
|---|
| 396 |       else {
 | 
|---|
| 397 |         if (visible)
 | 
|---|
| 398 |           pfi->flData &= (~CFA_INVISIBLE);
 | 
|---|
| 399 |         else
 | 
|---|
| 400 |           pfi->flData |= CFA_INVISIBLE;
 | 
|---|
| 401 |       }
 | 
|---|
| 402 |       return TRUE;
 | 
|---|
| 403 |     }
 | 
|---|
| 404 |     pfi = pfi->pNextFieldInfo;
 | 
|---|
| 405 |   }
 | 
|---|
| 406 |   return FALSE;
 | 
|---|
| 407 | }
 | 
|---|
| 408 | 
 | 
|---|
| 409 | BOOL AdjustCnrColRO(HWND hwndCnr, CHAR * title, BOOL readonly, BOOL toggle)
 | 
|---|
| 410 | {
 | 
|---|
| 411 |   PFIELDINFO pfi = (PFIELDINFO) WinSendMsg(hwndCnr,
 | 
|---|
| 412 |                                            CM_QUERYDETAILFIELDINFO,
 | 
|---|
| 413 |                                            MPVOID, MPFROMSHORT(CMA_FIRST));
 | 
|---|
| 414 | 
 | 
|---|
| 415 |   while (pfi) {
 | 
|---|
| 416 |     if (!strcmp(pfi->pTitleData, title)) {
 | 
|---|
| 417 |       if (toggle) {
 | 
|---|
| 418 |         if (pfi->flData & CFA_FIREADONLY)
 | 
|---|
| 419 |           pfi->flData &= (~CFA_FIREADONLY);
 | 
|---|
| 420 |         else
 | 
|---|
| 421 |           pfi->flData |= CFA_FIREADONLY;
 | 
|---|
| 422 |         return (pfi->flData & CFA_FIREADONLY);
 | 
|---|
| 423 |       }
 | 
|---|
| 424 |       else {
 | 
|---|
| 425 |         if (!readonly)
 | 
|---|
| 426 |           pfi->flData &= (~CFA_FIREADONLY);
 | 
|---|
| 427 |         else
 | 
|---|
| 428 |           pfi->flData |= CFA_FIREADONLY;
 | 
|---|
| 429 |       }
 | 
|---|
| 430 |       return TRUE;
 | 
|---|
| 431 |     }
 | 
|---|
| 432 |     pfi = pfi->pNextFieldInfo;
 | 
|---|
| 433 |   }
 | 
|---|
| 434 |   return FALSE;
 | 
|---|
| 435 | }
 | 
|---|
| 436 | 
 | 
|---|
| 437 | VOID AdjustCnrColsForFSType(HWND hwndCnr, CHAR * directory, DETAILS_SETTINGS * pds)
 | 
|---|
| 438 | {
 | 
|---|
| 439 |   CHAR FileSystem[CCHMAXPATH];
 | 
|---|
| 440 |   INT x;
 | 
|---|
| 441 |   BOOL hasCreateDT;
 | 
|---|
| 442 |   BOOL hasAccessDT;
 | 
|---|
| 443 |   BOOL hasLongNames;
 | 
|---|
| 444 | 
 | 
|---|
| 445 |   if (!directory || !*directory)
 | 
|---|
| 446 |     return;
 | 
|---|
| 447 |   x = CheckDrive(toupper(*directory), FileSystem, NULL);
 | 
|---|
| 448 |   if (x != -1) {
 | 
|---|
| 449 |     if (!stricmp(FileSystem, HPFS) ||
 | 
|---|
| 450 |         !stricmp(FileSystem, JFS) ||
 | 
|---|
| 451 |         !stricmp(FileSystem, FAT32) ||
 | 
|---|
| 452 |         !stricmp(FileSystem, RAMFS) ||
 | 
|---|
| 453 |         !stricmp(FileSystem, NDFS32) ||
 | 
|---|
| 454 |         !stricmp(FileSystem, NTFS) ||
 | 
|---|
| 455 |         !stricmp(FileSystem, HPFS386)) {
 | 
|---|
| 456 |       hasCreateDT = TRUE;
 | 
|---|
| 457 |       hasAccessDT = TRUE;
 | 
|---|
| 458 |       hasLongNames = TRUE;
 | 
|---|
| 459 |     }
 | 
|---|
| 460 |     else if (!strcmp(FileSystem, CDFS) || !strcmp(FileSystem, ISOFS)) {
 | 
|---|
| 461 |       hasCreateDT = TRUE;
 | 
|---|
| 462 |       hasAccessDT = FALSE;
 | 
|---|
| 463 |       hasLongNames = FALSE;
 | 
|---|
| 464 |     }
 | 
|---|
| 465 |     else {
 | 
|---|
| 466 |       // Assume FAT
 | 
|---|
| 467 |       hasCreateDT = FALSE;
 | 
|---|
| 468 |       hasAccessDT = FALSE;
 | 
|---|
| 469 |       hasLongNames = FALSE;
 | 
|---|
| 470 |     }
 | 
|---|
| 471 |   }
 | 
|---|
| 472 |   else {
 | 
|---|
| 473 |     // Assume FAT
 | 
|---|
| 474 |     hasCreateDT = FALSE;
 | 
|---|
| 475 |     hasAccessDT = FALSE;
 | 
|---|
| 476 |     hasLongNames = FALSE;
 | 
|---|
| 477 |   }
 | 
|---|
| 478 |   AdjustCnrColVis(hwndCnr,
 | 
|---|
| 479 |                   GetPString(IDS_LADATE),
 | 
|---|
| 480 |                   pds->detailsladate ? hasAccessDT : FALSE,
 | 
|---|
| 481 |                   FALSE);
 | 
|---|
| 482 |   AdjustCnrColVis(hwndCnr,
 | 
|---|
| 483 |                   GetPString(IDS_LATIME),
 | 
|---|
| 484 |                   pds->detailslatime ? hasAccessDT : FALSE,
 | 
|---|
| 485 |                   FALSE);
 | 
|---|
| 486 |   AdjustCnrColVis(hwndCnr,
 | 
|---|
| 487 |                   GetPString(IDS_CRDATE),
 | 
|---|
| 488 |                   pds->detailscrdate ? hasCreateDT : FALSE,
 | 
|---|
| 489 |                   FALSE);
 | 
|---|
| 490 |   AdjustCnrColVis(hwndCnr,
 | 
|---|
| 491 |                   GetPString(IDS_CRTIME),
 | 
|---|
| 492 |                   pds->detailscrtime ? hasCreateDT : FALSE,
 | 
|---|
| 493 |                   FALSE);
 | 
|---|
| 494 |   AdjustCnrColVis(hwndCnr,
 | 
|---|
| 495 |                   GetPString(IDS_LNAME),
 | 
|---|
| 496 |                   pds->detailslongname ? hasLongNames : FALSE,
 | 
|---|
| 497 |                   FALSE);
 | 
|---|
| 498 |   WinSendMsg(hwndCnr, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID);
 | 
|---|
| 499 | }
 | 
|---|
| 500 | 
 | 
|---|
| 501 | VOID AdjustCnrColsForPref(HWND hwndCnr, CHAR * directory, DETAILS_SETTINGS * pds,
 | 
|---|
| 502 |                           BOOL compare)
 | 
|---|
| 503 | {
 | 
|---|
| 504 | 
 | 
|---|
| 505 |   AdjustCnrColVis(hwndCnr,
 | 
|---|
| 506 |                   compare ? GetPString(IDS_STATUS) : GetPString(IDS_SUBJ),
 | 
|---|
| 507 |                   pds->detailssubject,
 | 
|---|
| 508 |                   FALSE);
 | 
|---|
| 509 | 
 | 
|---|
| 510 |   AdjustCnrColVis(hwndCnr, GetPString(IDS_ATTR), pds->detailsattr, FALSE);
 | 
|---|
| 511 |   AdjustCnrColVis(hwndCnr, GetPString(IDS_ICON), pds->detailsicon, FALSE);
 | 
|---|
| 512 |   AdjustCnrColVis(hwndCnr, GetPString(IDS_LWDATE), pds->detailslwdate, FALSE);
 | 
|---|
| 513 |   AdjustCnrColVis(hwndCnr, GetPString(IDS_LWTIME), pds->detailslwtime, FALSE);
 | 
|---|
| 514 |   AdjustCnrColVis(hwndCnr, GetPString(IDS_EA), pds->detailsea, FALSE);
 | 
|---|
| 515 |   AdjustCnrColVis(hwndCnr, GetPString(IDS_SIZE), pds->detailssize, FALSE);
 | 
|---|
| 516 | 
 | 
|---|
| 517 |   if (!directory) {
 | 
|---|
| 518 |     AdjustCnrColVis(hwndCnr, GetPString(IDS_LADATE), pds->detailsladate, FALSE);
 | 
|---|
| 519 |     AdjustCnrColVis(hwndCnr, GetPString(IDS_LATIME), pds->detailslatime, FALSE);
 | 
|---|
| 520 |     AdjustCnrColVis(hwndCnr, GetPString(IDS_CRDATE), pds->detailscrdate, FALSE);
 | 
|---|
| 521 |     AdjustCnrColVis(hwndCnr, GetPString(IDS_CRTIME), pds->detailscrtime, FALSE);
 | 
|---|
| 522 |     AdjustCnrColVis(hwndCnr, GetPString(IDS_LNAME), pds->detailslongname, FALSE);
 | 
|---|
| 523 |     WinSendMsg(hwndCnr, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID);
 | 
|---|
| 524 |   }
 | 
|---|
| 525 |   else
 | 
|---|
| 526 |     AdjustCnrColsForFSType(hwndCnr, directory, pds);
 | 
|---|
| 527 | }
 | 
|---|
| 528 | 
 | 
|---|
| 529 | BOOL SetCnrCols(HWND hwndCnr, BOOL isCompCnr)
 | 
|---|
| 530 | {
 | 
|---|
| 531 |   BOOL fSuccess = TRUE;
 | 
|---|
| 532 |   PFIELDINFO pfi, pfiLastLeftCol, pfiIconCol;
 | 
|---|
| 533 | 
 | 
|---|
| 534 |   // Allocate storage for container column data
 | 
|---|
| 535 | 
 | 
|---|
| 536 |   pfi = WinSendMsg(hwndCnr, CM_ALLOCDETAILFIELDINFO,
 | 
|---|
| 537 |                    MPFROMLONG(CONTAINER_COLUMNS), NULL);
 | 
|---|
| 538 | 
 | 
|---|
| 539 |   if (!pfi) {
 | 
|---|
| 540 |     Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_ALLOCDETAILFIELDINFO");
 | 
|---|
| 541 |     fSuccess = FALSE;
 | 
|---|
| 542 |   }
 | 
|---|
| 543 |   else {
 | 
|---|
| 544 | 
 | 
|---|
| 545 |     PFIELDINFO pfiFirst;
 | 
|---|
| 546 |     FIELDINFOINSERT fii;
 | 
|---|
| 547 | 
 | 
|---|
| 548 |     // Store original value of pfi so we won't lose it when it changes.
 | 
|---|
| 549 |     // This will be needed on the CM_INSERTDETAILFIELDINFO message.
 | 
|---|
| 550 | 
 | 
|---|
| 551 |     pfiFirst = pfi;
 | 
|---|
| 552 | 
 | 
|---|
| 553 |     // Fill in column information for the icon column
 | 
|---|
| 554 | 
 | 
|---|
| 555 |     pfi->flData = CFA_BITMAPORICON | CFA_CENTER | CFA_FIREADONLY;
 | 
|---|
| 556 |     pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
 | 
|---|
| 557 |     pfi->pTitleData = GetPString(IDS_ICON);
 | 
|---|
| 558 |     pfi->offStruct = FIELDOFFSET(MINIRECORDCORE, hptrIcon);
 | 
|---|
| 559 | 
 | 
|---|
| 560 |     pfiIconCol = pfi;
 | 
|---|
| 561 | 
 | 
|---|
| 562 |     // Fill in column information for the file name. Note that we are
 | 
|---|
| 563 |     // using the pszDisplayName variable rather than pszFileName. We do this
 | 
|---|
| 564 |     // because the container does not always display the full path file name.
 | 
|---|
| 565 | 
 | 
|---|
| 566 |     pfi = pfi->pNextFieldInfo;
 | 
|---|
| 567 | 
 | 
|---|
| 568 |     pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR;
 | 
|---|
| 569 |     pfi->flTitle = CFA_LEFT;
 | 
|---|
| 570 |     pfi->pTitleData = GetPString(IDS_FILENAME);
 | 
|---|
| 571 |     pfi->offStruct = FIELDOFFSET(CNRITEM, pszDisplayName);
 | 
|---|
| 572 | 
 | 
|---|
| 573 |     // Fill in column information for the longname.
 | 
|---|
| 574 | 
 | 
|---|
| 575 |     pfi = pfi->pNextFieldInfo;
 | 
|---|
| 576 |     pfi->flData = CFA_STRING | CFA_LEFT;
 | 
|---|
| 577 |     pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY;
 | 
|---|
| 578 |     pfi->pTitleData = GetPString(IDS_LNAME);
 | 
|---|
| 579 |     pfi->offStruct = FIELDOFFSET(CNRITEM, pszLongName);
 | 
|---|
| 580 | 
 | 
|---|
| 581 |     // Fill in column info for subjects
 | 
|---|
| 582 | 
 | 
|---|
| 583 |     if (dsDirCnrDefault.fSubjectInLeftPane) {
 | 
|---|
| 584 |       pfi = pfi->pNextFieldInfo;
 | 
|---|
| 585 |       pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR;
 | 
|---|
| 586 |       if (isCompCnr)
 | 
|---|
| 587 |         pfi->flData |= CFA_FIREADONLY;
 | 
|---|
| 588 |       pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY;
 | 
|---|
| 589 |       pfi->pTitleData = isCompCnr ? GetPString(IDS_STATUS) :
 | 
|---|
| 590 |                                   GetPString(IDS_SUBJ);
 | 
|---|
| 591 |       pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject);
 | 
|---|
| 592 |       pfi->cxWidth = dsDirCnrDefault.SubjectDisplayWidth;
 | 
|---|
| 593 | 
 | 
|---|
| 594 |       // Store the current pfi value as that will be used to indicate the
 | 
|---|
| 595 |       // last column in the lefthand container window (we have a splitbar)
 | 
|---|
| 596 | 
 | 
|---|
| 597 |       pfiLastLeftCol = pfi;
 | 
|---|
| 598 |     }
 | 
|---|
| 599 |     else {
 | 
|---|
| 600 |       // Store the current pfi value as that will be used to indicate the
 | 
|---|
| 601 |       // last column in the lefthand container window (we have a splitbar)
 | 
|---|
| 602 | 
 | 
|---|
| 603 |       pfiLastLeftCol = pfi;
 | 
|---|
| 604 |       pfi = pfi->pNextFieldInfo;
 | 
|---|
| 605 |       pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR;
 | 
|---|
| 606 |       if (isCompCnr)
 | 
|---|
| 607 |         pfi->flData |= CFA_FIREADONLY;
 | 
|---|
| 608 |       pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY;
 | 
|---|
| 609 |       pfi->pTitleData = isCompCnr ? GetPString(IDS_STATUS) :
 | 
|---|
| 610 |                                   GetPString(IDS_SUBJ);
 | 
|---|
| 611 |       pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject);
 | 
|---|
| 612 |       pfi->cxWidth = dsDirCnrDefault.SubjectDisplayWidth;
 | 
|---|
| 613 |     }
 | 
|---|
| 614 | 
 | 
|---|
| 615 |     // Fill in column information for the file size
 | 
|---|
| 616 | 
 | 
|---|
| 617 | 
 | 
|---|
| 618 |     pfi = pfi->pNextFieldInfo;
 | 
|---|
| 619 |     pfi->flData = CFA_STRING | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
 | 
|---|
| 620 |     pfi->flTitle = CFA_CENTER;
 | 
|---|
| 621 |     pfi->pTitleData = GetPString(IDS_SIZE);
 | 
|---|
| 622 |     pfi->offStruct = FIELDOFFSET(CNRITEM, pszFmtFileSize);
 | 
|---|
| 623 | 
 | 
|---|
| 624 | 
 | 
|---|
| 625 |     // Fill in the column information for the file's ea size
 | 
|---|
| 626 | 
 | 
|---|
| 627 |     pfi = pfi->pNextFieldInfo;
 | 
|---|
| 628 |     pfi->flData = CFA_ULONG | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
 | 
|---|
| 629 |     pfi->flTitle = CFA_CENTER;
 | 
|---|
| 630 |     pfi->pTitleData = GetPString(IDS_EA);
 | 
|---|
| 631 |     pfi->offStruct = FIELDOFFSET(CNRITEM, easize);
 | 
|---|
| 632 | 
 | 
|---|
| 633 |     // Fill in the column information for the file attribute
 | 
|---|
| 634 | 
 | 
|---|
| 635 |     pfi = pfi->pNextFieldInfo;
 | 
|---|
| 636 |     pfi->flData = CFA_STRING | CFA_CENTER | CFA_SEPARATOR | CFA_FIREADONLY;
 | 
|---|
| 637 |     pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
 | 
|---|
| 638 |     pfi->pTitleData = GetPString(IDS_ATTR);
 | 
|---|
| 639 |     pfi->offStruct = FIELDOFFSET(CNRITEM, pszDispAttr);
 | 
|---|
| 640 | 
 | 
|---|
| 641 |     // Fill in column information for last write file date
 | 
|---|
| 642 | 
 | 
|---|
| 643 |     pfi = pfi->pNextFieldInfo;
 | 
|---|
| 644 |     pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
 | 
|---|
| 645 |     pfi->flTitle = CFA_CENTER;
 | 
|---|
| 646 |     pfi->pTitleData = GetPString(IDS_LWDATE);
 | 
|---|
| 647 |     pfi->offStruct = FIELDOFFSET(CNRITEM, date);
 | 
|---|
| 648 | 
 | 
|---|
| 649 |     // Fill in column information for the last write file time
 | 
|---|
| 650 | 
 | 
|---|
| 651 |     pfi = pfi->pNextFieldInfo;
 | 
|---|
| 652 |     pfi->flData = CFA_TIME | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
 | 
|---|
| 653 |     pfi->flTitle = CFA_CENTER;
 | 
|---|
| 654 |     pfi->pTitleData = GetPString(IDS_LWTIME);
 | 
|---|
| 655 |     pfi->offStruct = FIELDOFFSET(CNRITEM, time);
 | 
|---|
| 656 | 
 | 
|---|
| 657 |     // Fill in column information for last access file date
 | 
|---|
| 658 | 
 | 
|---|
| 659 |     pfi = pfi->pNextFieldInfo;
 | 
|---|
| 660 |     pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
 | 
|---|
| 661 |     pfi->flTitle = CFA_CENTER;
 | 
|---|
| 662 |     pfi->pTitleData = GetPString(IDS_LADATE);
 | 
|---|
| 663 |     pfi->offStruct = FIELDOFFSET(CNRITEM, ladate);
 | 
|---|
| 664 | 
 | 
|---|
| 665 |     // Fill in column information for the last access file time
 | 
|---|
| 666 | 
 | 
|---|
| 667 |     pfi = pfi->pNextFieldInfo;
 | 
|---|
| 668 |     pfi->flData = CFA_TIME | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
 | 
|---|
| 669 |     pfi->flTitle = CFA_CENTER;
 | 
|---|
| 670 |     pfi->pTitleData = GetPString(IDS_LATIME);
 | 
|---|
| 671 |     pfi->offStruct = FIELDOFFSET(CNRITEM, latime);
 | 
|---|
| 672 | 
 | 
|---|
| 673 |     // Fill in column information for create file date
 | 
|---|
| 674 | 
 | 
|---|
| 675 |     pfi = pfi->pNextFieldInfo;
 | 
|---|
| 676 |     pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
 | 
|---|
| 677 |     pfi->flTitle = CFA_CENTER;
 | 
|---|
| 678 |     pfi->pTitleData = GetPString(IDS_CRDATE);
 | 
|---|
| 679 |     pfi->offStruct = FIELDOFFSET(CNRITEM, crdate);
 | 
|---|
| 680 | 
 | 
|---|
| 681 |     // Fill in column information for the create file time
 | 
|---|
| 682 | 
 | 
|---|
| 683 |     pfi = pfi->pNextFieldInfo;
 | 
|---|
| 684 |     pfi->flData = CFA_TIME | CFA_RIGHT | CFA_FIREADONLY;
 | 
|---|
| 685 |     pfi->flTitle = CFA_CENTER;
 | 
|---|
| 686 |     pfi->pTitleData = GetPString(IDS_CRTIME);
 | 
|---|
| 687 |     pfi->offStruct = FIELDOFFSET(CNRITEM, crtime);
 | 
|---|
| 688 | 
 | 
|---|
| 689 |     // Use the CM_INSERTDETAILFIELDINFO message to tell the container
 | 
|---|
| 690 |     // all the column information it needs to function properly. Place
 | 
|---|
| 691 |     // this column info first in the column list and update the display
 | 
|---|
| 692 |     // after they are inserted (fInvalidateFieldInfo = TRUE)
 | 
|---|
| 693 | 
 | 
|---|
| 694 |     (void)memset(&fii, 0, sizeof(FIELDINFOINSERT));
 | 
|---|
| 695 | 
 | 
|---|
| 696 |     fii.cb = sizeof(FIELDINFOINSERT);
 | 
|---|
| 697 |     fii.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST;
 | 
|---|
| 698 |     fii.cFieldInfoInsert = (SHORT) CONTAINER_COLUMNS;
 | 
|---|
| 699 |     fii.fInvalidateFieldInfo = TRUE;
 | 
|---|
| 700 | 
 | 
|---|
| 701 |     if (!WinSendMsg(hwndCnr, CM_INSERTDETAILFIELDINFO, MPFROMP(pfiFirst),
 | 
|---|
| 702 |                     MPFROMP(&fii))) {
 | 
|---|
| 703 |       Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_INSERTDETAILFIELDINFO");
 | 
|---|
| 704 |       fSuccess = FALSE;
 | 
|---|
| 705 |     }
 | 
|---|
| 706 |   }
 | 
|---|
| 707 | 
 | 
|---|
| 708 |   if (fSuccess) {
 | 
|---|
| 709 | 
 | 
|---|
| 710 |     CNRINFO cnri;
 | 
|---|
| 711 |     ULONG size;
 | 
|---|
| 712 | 
 | 
|---|
| 713 |     // Tell the container about the splitbar and where it goes
 | 
|---|
| 714 | 
 | 
|---|
| 715 |     cnri.cb = sizeof(CNRINFO);
 | 
|---|
| 716 |     cnri.pFieldInfoLast = pfiLastLeftCol;
 | 
|---|
| 717 |     cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
 | 
|---|
| 718 |     cnri.pFieldInfoObject = pfiIconCol;
 | 
|---|
| 719 |     size = sizeof(LONG);
 | 
|---|
| 720 |     PrfQueryProfileData(fmprof,
 | 
|---|
| 721 |                         appname, "CnrSplitBar", &cnri.xVertSplitbar, &size);
 | 
|---|
| 722 |     if (cnri.xVertSplitbar <= 0)
 | 
|---|
| 723 |       cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
 | 
|---|
| 724 |     if (!WinSendMsg(hwndCnr, CM_SETCNRINFO, MPFROMP(&cnri),
 | 
|---|
| 725 |                     MPFROMLONG(CMA_PFIELDINFOLAST | CMA_PFIELDINFOOBJECT |
 | 
|---|
| 726 |                                CMA_XVERTSPLITBAR))) {
 | 
|---|
| 727 |       Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_SETCNRINFO");
 | 
|---|
| 728 |       fSuccess = FALSE;
 | 
|---|
| 729 |     }
 | 
|---|
| 730 |   }
 | 
|---|
| 731 | 
 | 
|---|
| 732 |   return fSuccess;
 | 
|---|
| 733 | }
 | 
|---|
| 734 | 
 | 
|---|
| 735 | MRESULT CnrDirectEdit(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| 736 | {
 | 
|---|
| 737 |   switch (SHORT2FROMMP(mp1)) {
 | 
|---|
| 738 |   case CN_BEGINEDIT:
 | 
|---|
| 739 |     if (mp2) {
 | 
|---|
| 740 |       PFIELDINFO pfi = ((PCNREDITDATA) mp2)->pFieldInfo;
 | 
|---|
| 741 |       PCNRITEM pci = (PCNRITEM) ((PCNREDITDATA) mp2)->pRecord;
 | 
|---|
| 742 | 
 | 
|---|
| 743 |       if (pci &&
 | 
|---|
| 744 |           (INT) pci != -1 &&
 | 
|---|
| 745 |           !IsRoot(pci->pszFileName) &&
 | 
|---|
| 746 |           !(pci->flags & RECFLAGS_ENV) && !(pci->flags & RECFLAGS_UNDERENV)) {
 | 
|---|
| 747 |         if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName)) {
 | 
|---|
| 748 |           PostMsg(hwnd, UM_FIXEDITNAME, MPFROMP(pci->pszFileName), MPVOID);
 | 
|---|
| 749 |         }
 | 
|---|
| 750 |         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject))
 | 
|---|
| 751 |           PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(1048), MPVOID);
 | 
|---|
| 752 |         else
 | 
|---|
| 753 |           PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(CCHMAXPATH), MPVOID);
 | 
|---|
| 754 |       }
 | 
|---|
| 755 |       else
 | 
|---|
| 756 |         PostMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
 | 
|---|
| 757 |     }
 | 
|---|
| 758 |     break;
 | 
|---|
| 759 | 
 | 
|---|
| 760 |   case CN_REALLOCPSZ:
 | 
|---|
| 761 |     if (mp2) {
 | 
|---|
| 762 |       PFIELDINFO pfi = ((PCNREDITDATA) mp2)->pFieldInfo;
 | 
|---|
| 763 |       PCNRITEM pci = (PCNRITEM) ((PCNREDITDATA) mp2)->pRecord;
 | 
|---|
| 764 |       CHAR szData[CCHMAXPATH], testname[CCHMAXPATH];
 | 
|---|
| 765 |       HWND hwndMLE = WinWindowFromID(hwnd, CID_MLE);
 | 
|---|
| 766 | 
 | 
|---|
| 767 |       if (pci && (INT) pci != -1 && !IsRoot(pci->pszFileName)) {
 | 
|---|
| 768 |         if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject)) {
 | 
|---|
| 769 | 
 | 
|---|
| 770 |           APIRET rc;
 | 
|---|
| 771 |           EAOP2 eaop;
 | 
|---|
| 772 |           PFEA2LIST pfealist = NULL;
 | 
|---|
| 773 |           CHAR szSubject[1048];
 | 
|---|
| 774 |           ULONG ealen;
 | 
|---|
| 775 |           USHORT len;
 | 
|---|
| 776 |           CHAR *eaval;
 | 
|---|
| 777 |           LONG retlen;
 | 
|---|
| 778 |           PSZ psz;
 | 
|---|
| 779 | 
 | 
|---|
| 780 |           retlen = WinQueryWindowText(hwndMLE, sizeof(szSubject), szSubject);
 | 
|---|
| 781 |           szSubject[retlen + 1] = 0;
 | 
|---|
| 782 |           bstrip(szSubject);
 | 
|---|
| 783 |           if (pci->pszSubject != NullStr) {
 | 
|---|
| 784 |             if (retlen == 0) {
 | 
|---|
| 785 |               psz = pci->pszSubject;
 | 
|---|
| 786 |               pci->pszSubject = NullStr;
 | 
|---|
| 787 |               xfree(psz, pszSrcFile, __LINE__);
 | 
|---|
| 788 |             }
 | 
|---|
| 789 |             else
 | 
|---|
| 790 |               pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__);
 | 
|---|
| 791 |           }
 | 
|---|
| 792 |           else {
 | 
|---|
| 793 |             pci->pszSubject = xmalloc(retlen + 1, pszSrcFile, __LINE__);
 | 
|---|
| 794 |             if (!pci->pszSubject)
 | 
|---|
| 795 |               return FALSE;
 | 
|---|
| 796 |           }
 | 
|---|
| 797 |           len = strlen(szSubject);
 | 
|---|
| 798 |           if (len)
 | 
|---|
| 799 |             ealen = sizeof(FEA2LIST) + 9 + len + 4;
 | 
|---|
| 800 |           else
 | 
|---|
| 801 |             ealen = sizeof(FEALIST) + 9;
 | 
|---|
| 802 |           rc = DosAllocMem((PPVOID) & pfealist, ealen + 64,
 | 
|---|
| 803 |                            OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
 | 
|---|
| 804 |           if (rc)
 | 
|---|
| 805 |             Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile,
 | 
|---|
| 806 |                       __LINE__, GetPString(IDS_OUTOFMEMORY));
 | 
|---|
| 807 |           else {
 | 
|---|
| 808 |             memset(pfealist, 0, ealen + 1);
 | 
|---|
| 809 |             pfealist->cbList = ealen;
 | 
|---|
| 810 |             pfealist->list[0].oNextEntryOffset = 0;
 | 
|---|
| 811 |             pfealist->list[0].fEA = 0;
 | 
|---|
| 812 |             pfealist->list[0].cbName = 8;
 | 
|---|
| 813 |             strcpy(pfealist->list[0].szName, SUBJECT);
 | 
|---|
| 814 |             if (len) {
 | 
|---|
| 815 |               eaval = pfealist->list[0].szName + 9;
 | 
|---|
| 816 |               *(USHORT *) eaval = (USHORT) EAT_ASCII;
 | 
|---|
| 817 |               eaval += sizeof(USHORT);
 | 
|---|
| 818 |               *(USHORT *) eaval = (USHORT) len;
 | 
|---|
| 819 |               eaval += sizeof(USHORT);
 | 
|---|
| 820 |               memcpy(eaval, szSubject, len);
 | 
|---|
| 821 |               pfealist->list[0].cbValue = len + (sizeof(USHORT) * 2);
 | 
|---|
| 822 |             }
 | 
|---|
| 823 |             else
 | 
|---|
| 824 |               pfealist->list[0].cbValue = 0;
 | 
|---|
| 825 |             eaop.fpGEA2List = (PGEA2LIST) 0;
 | 
|---|
| 826 |             eaop.fpFEA2List = pfealist;
 | 
|---|
| 827 |             eaop.oError = 0;
 | 
|---|
| 828 |             rc = xDosSetPathInfo(pci->pszFileName, FIL_QUERYEASIZE,
 | 
|---|
| 829 |                                  &eaop, sizeof(eaop), DSPI_WRTTHRU);
 | 
|---|
| 830 |             DosFreeMem(pfealist);
 | 
|---|
| 831 |             if (rc)
 | 
|---|
| 832 |               return FALSE;
 | 
|---|
| 833 |           }
 | 
|---|
| 834 |           return (MRESULT) TRUE;
 | 
|---|
| 835 |         }
 | 
|---|
| 836 |         else if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszLongName)) {
 | 
|---|
| 837 | 
 | 
|---|
| 838 |           CHAR longname[CCHMAXPATHCOMP];
 | 
|---|
| 839 |           LONG retlen;
 | 
|---|
| 840 |           PSZ psz;
 | 
|---|
| 841 | 
 | 
|---|
| 842 |           *longname = 0;
 | 
|---|
| 843 |           retlen = WinQueryWindowText(hwndMLE, sizeof(longname), longname);
 | 
|---|
| 844 |           longname[retlen + 1] = 0;
 | 
|---|
| 845 |           chop_at_crnl(longname);
 | 
|---|
| 846 |           bstrip(longname);
 | 
|---|
| 847 |           WinSetWindowText(hwndMLE, longname);
 | 
|---|
| 848 |           if (pci->pszLongName != NullStr) {
 | 
|---|
| 849 |             if (retlen == 0) {
 | 
|---|
| 850 |               psz = pci->pszLongName;
 | 
|---|
| 851 |               pci->pszLongName = NullStr;
 | 
|---|
| 852 |               xfree(psz, pszSrcFile, __LINE__);
 | 
|---|
| 853 |             }
 | 
|---|
| 854 |             else
 | 
|---|
| 855 |               pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__);
 | 
|---|
| 856 |           }
 | 
|---|
| 857 |           else {
 | 
|---|
| 858 |             pci->pszLongName = xmalloc(retlen + 1, pszSrcFile, __LINE__);
 | 
|---|
| 859 |             if (!pci->pszLongName)
 | 
|---|
| 860 |               return FALSE;
 | 
|---|
| 861 |           }
 | 
|---|
| 862 |           return (MRESULT) WriteLongName(pci->pszFileName, longname);
 | 
|---|
| 863 |         }
 | 
|---|
| 864 |         else {
 | 
|---|
| 865 |           WinQueryWindowText(hwndMLE, sizeof(szData), szData);
 | 
|---|
| 866 |           if (strchr(szData, '?') ||
 | 
|---|
| 867 |               strchr(szData, '*') || IsRoot(pci->pszFileName))
 | 
|---|
| 868 |             return (MRESULT) FALSE;
 | 
|---|
| 869 |           /* If the text changed, rename the file system object. */
 | 
|---|
| 870 |           chop_at_crnl(szData);
 | 
|---|
| 871 |           bstrip(szData);
 | 
|---|
| 872 |           if (!IsFullName(szData))
 | 
|---|
| 873 |             Runtime_Error(pszSrcFile, __LINE__, "bad name");
 | 
|---|
| 874 |           else {
 | 
|---|
| 875 |             if (DosQueryPathInfo(szData,
 | 
|---|
| 876 |                                  FIL_QUERYFULLNAME,
 | 
|---|
| 877 |                                  testname, sizeof(testname)))
 | 
|---|
| 878 |                 return FALSE;
 | 
|---|
| 879 |             if (DosQueryPathInfo(pci->pszFileName,
 | 
|---|
| 880 |                                  FIL_QUERYFULLNAME,
 | 
|---|
| 881 |                                  szData,
 | 
|---|
| 882 |                                  sizeof(szData)))
 | 
|---|
| 883 |             {
 | 
|---|
| 884 |               pci->pszFileName = xrealloc(pci->pszFileName, sizeof(szData), pszSrcFile, __LINE__);
 | 
|---|
| 885 |               strcpy(szData, pci->pszFileName);
 | 
|---|
| 886 |             }
 | 
|---|
| 887 |             WinSetWindowText(hwndMLE, szData);
 | 
|---|
| 888 |             if (strcmp(szData, testname)) {
 | 
|---|
| 889 |               if (stricmp(szData, testname) && IsFile(testname) != -1) {
 | 
|---|
| 890 |                 DosBeep(50, 100);       /* exists; disallow */
 | 
|---|
| 891 |                 return (MRESULT) FALSE;
 | 
|---|
| 892 |               }
 | 
|---|
| 893 |               if (docopyf(MOVE, szData, "%s", testname))
 | 
|---|
| 894 |                 Runtime_Error(pszSrcFile, __LINE__, "docopyf");
 | 
|---|
| 895 |               else {
 | 
|---|
| 896 |                 CHAR *filename;
 | 
|---|
| 897 | 
 | 
|---|
| 898 |                 filename = xstrdup(testname, pszSrcFile, __LINE__);
 | 
|---|
| 899 |                 if (filename) {
 | 
|---|
| 900 |                   if (!PostMsg(hwnd,
 | 
|---|
| 901 |                                UM_FIXEDITNAME, MPVOID, MPFROMP(filename)))
 | 
|---|
| 902 |                     free(filename);
 | 
|---|
| 903 |                 }
 | 
|---|
| 904 |                 if (stricmp(testname, pci->pszFileName)) {
 | 
|---|
| 905 |                   PostMsg(hwnd, UM_FIXEDITNAME, MPFROMLONG(-1), MPFROMP(pci));
 | 
|---|
| 906 |                   filename = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
 | 
|---|
| 907 |                   if (filename) {
 | 
|---|
| 908 |                     if (!PostMsg(hwnd,
 | 
|---|
| 909 |                                  UM_FIXEDITNAME, MPVOID, MPFROMP(filename)))
 | 
|---|
| 910 |                       free(filename);
 | 
|---|
| 911 |                   }
 | 
|---|
| 912 |                 }
 | 
|---|
| 913 |               }
 | 
|---|
| 914 |             }
 | 
|---|
| 915 |           }
 | 
|---|
| 916 |         }
 | 
|---|
| 917 |       }
 | 
|---|
| 918 |     }
 | 
|---|
| 919 |     return FALSE;
 | 
|---|
| 920 | 
 | 
|---|
| 921 |   case CN_ENDEDIT:
 | 
|---|
| 922 |     if (mp2) {
 | 
|---|
| 923 |       PFIELDINFO pfi = ((PCNREDITDATA) mp2)->pFieldInfo;
 | 
|---|
| 924 |       PCNRITEM pci = (PCNRITEM) ((PCNREDITDATA) mp2)->pRecord;
 | 
|---|
| 925 | 
 | 
|---|
| 926 |       if (pci && (INT) pci != -1 && !IsRoot(pci->pszFileName)) {
 | 
|---|
| 927 |         WinSendMsg(hwnd,
 | 
|---|
| 928 |                    CM_INVALIDATERECORD,
 | 
|---|
| 929 |                    MPFROMP(&pci),
 | 
|---|
| 930 |                    MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
 | 
|---|
| 931 |         if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName))
 | 
|---|
| 932 |           PostMsg(hwnd, UM_SORTRECORD, MPVOID, MPVOID);
 | 
|---|
| 933 |       }
 | 
|---|
| 934 |       else {
 | 
|---|
| 935 |         USHORT cmd = 0;
 | 
|---|
| 936 | 
 | 
|---|
| 937 |         if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName))
 | 
|---|
| 938 |           cmd = IDM_SORTSMARTNAME;
 | 
|---|
| 939 |         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, cbFile))
 | 
|---|
| 940 |           cmd = IDM_SORTSIZE;
 | 
|---|
| 941 |         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, easize))
 | 
|---|
| 942 |           cmd = IDM_SORTEASIZE;
 | 
|---|
| 943 |         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, date))
 | 
|---|
| 944 |           cmd = IDM_SORTLWDATE;
 | 
|---|
| 945 |         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, time))
 | 
|---|
| 946 |           cmd = IDM_SORTLWDATE;
 | 
|---|
| 947 |         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, ladate))
 | 
|---|
| 948 |           cmd = IDM_SORTLADATE;
 | 
|---|
| 949 |         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, latime))
 | 
|---|
| 950 |           cmd = IDM_SORTLADATE;
 | 
|---|
| 951 |         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crdate))
 | 
|---|
| 952 |           cmd = IDM_SORTCRDATE;
 | 
|---|
| 953 |         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crtime))
 | 
|---|
| 954 |           cmd = IDM_SORTCRDATE;
 | 
|---|
| 955 |         if (cmd)
 | 
|---|
| 956 |           PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
 | 
|---|
| 957 |       }
 | 
|---|
| 958 |     }
 | 
|---|
| 959 |     break;
 | 
|---|
| 960 |   }
 | 
|---|
| 961 |   return (MRESULT) - 1;
 | 
|---|
| 962 | }
 | 
|---|
| 963 | 
 | 
|---|
| 964 | BOOL SetMenuCheck(HWND hwndMenu, USHORT id, BOOL * bool, BOOL toggle,
 | 
|---|
| 965 |                   CHAR * savename)
 | 
|---|
| 966 | {
 | 
|---|
| 967 |   if (toggle) {
 | 
|---|
| 968 |     *bool = *bool ? FALSE : TRUE;
 | 
|---|
| 969 |     if (savename && *savename)
 | 
|---|
| 970 |       PrfWriteProfileData(fmprof, appname, savename, bool, sizeof(BOOL));
 | 
|---|
| 971 |   }
 | 
|---|
| 972 |   WinSendMsg(hwndMenu, MM_SETITEMATTR,
 | 
|---|
| 973 |              MPFROM2SHORT(id, 1),
 | 
|---|
| 974 |              MPFROM2SHORT(MIA_CHECKED, (*bool ? MIA_CHECKED : 0)));
 | 
|---|
| 975 |   return *bool;
 | 
|---|
| 976 | }
 | 
|---|
| 977 | 
 | 
|---|
| 978 | //== disable_menuitem() disable or enable_menuitem ==
 | 
|---|
| 979 | 
 | 
|---|
| 980 | VOID disable_menuitem(HWND hwndMenu, USHORT id, BOOL disable)
 | 
|---|
| 981 | {
 | 
|---|
| 982 |   WinSendMsg(hwndMenu, MM_SETITEMATTR,
 | 
|---|
| 983 |              MPFROM2SHORT(id, TRUE),
 | 
|---|
| 984 |              MPFROM2SHORT(MIA_DISABLED, (disable ? MIA_DISABLED : 0)));
 | 
|---|
| 985 | }
 | 
|---|
| 986 | 
 | 
|---|
| 987 | //== ViewHelp() invoke view.exe, return TRUE if OK ==
 | 
|---|
| 988 | 
 | 
|---|
| 989 | BOOL ViewHelp(CHAR * filename)
 | 
|---|
| 990 | {
 | 
|---|
| 991 |   CHAR s[CCHMAXPATH + 81];
 | 
|---|
| 992 |   CHAR szQuotedFileName[CCHMAXPATH];
 | 
|---|
| 993 |   FILE *fp;
 | 
|---|
| 994 |   INT ret = -1;
 | 
|---|
| 995 | 
 | 
|---|
| 996 |   fp = _fsopen(filename, "rb", SH_DENYNO);
 | 
|---|
| 997 |   if (fp) {
 | 
|---|
| 998 |     *s = 0;
 | 
|---|
| 999 |     fread(s, 1, 3, fp);
 | 
|---|
| 1000 |     if (*s != 'H' || s[1] != 'S' || s[2] != 'P') {
 | 
|---|
| 1001 |       fclose(fp);
 | 
|---|
| 1002 |       return FALSE;
 | 
|---|
| 1003 |     }
 | 
|---|
| 1004 |     fclose(fp);
 | 
|---|
| 1005 |     ret = runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
 | 
|---|
| 1006 |                   NULL, NULL,
 | 
|---|
| 1007 |                   "VIEW.EXE \"%s\"",
 | 
|---|
| 1008 |                   BldQuotedFileName(szQuotedFileName, filename));
 | 
|---|
| 1009 |   }
 | 
|---|
| 1010 | 
 | 
|---|
| 1011 |   return (ret != -1);
 | 
|---|
| 1012 | }
 | 
|---|
| 1013 | 
 | 
|---|
| 1014 | //== ExecFile() run file, return 1 if OK 0 if skipped -1 if can't run ==
 | 
|---|
| 1015 | 
 | 
|---|
| 1016 | INT ExecFile(HWND hwnd, CHAR * filename)
 | 
|---|
| 1017 | {
 | 
|---|
| 1018 |   EXECARGS ex;
 | 
|---|
| 1019 |   CHAR path[CCHMAXPATH], *p;
 | 
|---|
| 1020 |   PSZ pszCmdLine;
 | 
|---|
| 1021 |   APIRET ret;
 | 
|---|
| 1022 |   static INT lastflags = 0;
 | 
|---|
| 1023 | 
 | 
|---|
| 1024 |   strcpy(path, filename);
 | 
|---|
| 1025 |   p = strrchr(path, '\\');
 | 
|---|
| 1026 |   if (!p)
 | 
|---|
| 1027 |     p = strrchr(path, ':');
 | 
|---|
| 1028 |   if (p) {
 | 
|---|
| 1029 |     if (*p == ':') {
 | 
|---|
| 1030 |       p++;
 | 
|---|
| 1031 |       *p = '\\';
 | 
|---|
| 1032 |       p++;
 | 
|---|
| 1033 |     }
 | 
|---|
| 1034 |     *p = 0;
 | 
|---|
| 1035 |   }
 | 
|---|
| 1036 |   else
 | 
|---|
| 1037 |     *path = 0;
 | 
|---|
| 1038 |   pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
 | 
|---|
| 1039 |   if (pszCmdLine) {
 | 
|---|
| 1040 |     BldQuotedFileName(pszCmdLine, filename);
 | 
|---|
| 1041 |     memset(&ex, 0, sizeof(ex));
 | 
|---|
| 1042 |     ex.flags = lastflags;
 | 
|---|
| 1043 |     ex.commandline = pszCmdLine;
 | 
|---|
| 1044 |     *ex.path = 0;
 | 
|---|
| 1045 |     *ex.environment = 0;
 | 
|---|
| 1046 |     ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle,
 | 
|---|
| 1047 |                     EXEC_FRAME, &ex);
 | 
|---|
| 1048 |     if (ret == 1) {
 | 
|---|
| 1049 |       lastflags = ex.flags;
 | 
|---|
| 1050 |       return runemf2(ex.flags, hwnd, pszSrcFile, __LINE__, path,
 | 
|---|
| 1051 |                      *ex.environment ? ex.environment : NULL,
 | 
|---|
| 1052 |                      "%s", pszCmdLine) != -1;
 | 
|---|
| 1053 |     }
 | 
|---|
| 1054 |     else if (ret != 0)
 | 
|---|
| 1055 |       return -1;
 | 
|---|
| 1056 |     free(pszCmdLine);
 | 
|---|
| 1057 |   }
 | 
|---|
| 1058 |   return 0;
 | 
|---|
| 1059 | }
 | 
|---|
| 1060 | 
 | 
|---|
| 1061 | VOID SetDetailsSwitches(HWND hwnd, DETAILS_SETTINGS * pds)
 | 
|---|
| 1062 | {
 | 
|---|
| 1063 |   WinCheckMenuItem(hwnd, IDM_SHOWLNAMES, pds->detailslongname);
 | 
|---|
| 1064 |   WinCheckMenuItem(hwnd, IDM_SHOWSUBJECT, pds->detailssubject);
 | 
|---|
| 1065 |   WinCheckMenuItem(hwnd, IDM_SHOWEAS, pds->detailsea);
 | 
|---|
| 1066 |   WinCheckMenuItem(hwnd, IDM_SHOWSIZE, pds->detailssize);
 | 
|---|
| 1067 |   WinCheckMenuItem(hwnd, IDM_SHOWICON, pds->detailsicon);
 | 
|---|
| 1068 |   WinCheckMenuItem(hwnd, IDM_SHOWLWDATE, pds->detailslwdate);
 | 
|---|
| 1069 |   WinCheckMenuItem(hwnd, IDM_SHOWLWTIME, pds->detailslwtime);
 | 
|---|
| 1070 |   WinCheckMenuItem(hwnd, IDM_SHOWLADATE, pds->detailsladate);
 | 
|---|
| 1071 |   WinCheckMenuItem(hwnd, IDM_SHOWLATIME, pds->detailslatime);
 | 
|---|
| 1072 |   WinCheckMenuItem(hwnd, IDM_SHOWCRDATE, pds->detailscrdate);
 | 
|---|
| 1073 |   WinCheckMenuItem(hwnd, IDM_SHOWCRTIME, pds->detailscrtime);
 | 
|---|
| 1074 |   WinCheckMenuItem(hwnd, IDM_SHOWATTR, pds->detailsattr);
 | 
|---|
| 1075 | }
 | 
|---|
| 1076 | 
 | 
|---|
| 1077 | VOID AdjustDetailsSwitches(HWND hwnd, HWND hwndMenu, USHORT cmd,
 | 
|---|
| 1078 |                            CHAR * directory, CHAR * keyroot,
 | 
|---|
| 1079 |                            DETAILS_SETTINGS * pds, BOOL compare)
 | 
|---|
| 1080 | {
 | 
|---|
| 1081 |   BOOL *bool = NULL;
 | 
|---|
| 1082 | 
 | 
|---|
| 1083 |   switch (cmd) {
 | 
|---|
| 1084 |   case IDM_SHOWLNAMES:
 | 
|---|
| 1085 |     bool = &pds->detailslongname;
 | 
|---|
| 1086 |     break;
 | 
|---|
| 1087 |   case IDM_SHOWSUBJECT:
 | 
|---|
| 1088 |     bool = &pds->detailssubject;
 | 
|---|
| 1089 |     break;
 | 
|---|
| 1090 |   case IDM_SHOWEAS:
 | 
|---|
| 1091 |     bool = &pds->detailsea;
 | 
|---|
| 1092 |     break;
 | 
|---|
| 1093 |   case IDM_SHOWSIZE:
 | 
|---|
| 1094 |     bool = &pds->detailssize;
 | 
|---|
| 1095 |     break;
 | 
|---|
| 1096 |   case IDM_SHOWICON:
 | 
|---|
| 1097 |     bool = &pds->detailsicon;
 | 
|---|
| 1098 |     break;
 | 
|---|
| 1099 |   case IDM_SHOWLWDATE:
 | 
|---|
| 1100 |     bool = &pds->detailslwdate;
 | 
|---|
| 1101 |     break;
 | 
|---|
| 1102 |   case IDM_SHOWLWTIME:
 | 
|---|
| 1103 |     bool = &pds->detailslwtime;
 | 
|---|
| 1104 |     break;
 | 
|---|
| 1105 |   case IDM_SHOWLADATE:
 | 
|---|
| 1106 |     bool = &pds->detailsladate;
 | 
|---|
| 1107 |     break;
 | 
|---|
| 1108 |   case IDM_SHOWLATIME:
 | 
|---|
| 1109 |     bool = &pds->detailslatime;
 | 
|---|
| 1110 |     break;
 | 
|---|
| 1111 |   case IDM_SHOWCRDATE:
 | 
|---|
| 1112 |     bool = &pds->detailscrdate;
 | 
|---|
| 1113 |     break;
 | 
|---|
| 1114 |   case IDM_SHOWCRTIME:
 | 
|---|
| 1115 |     bool = &pds->detailscrtime;
 | 
|---|
| 1116 |     break;
 | 
|---|
| 1117 |   case IDM_SHOWATTR:
 | 
|---|
| 1118 |     bool = &pds->detailsattr;
 | 
|---|
| 1119 |     break;
 | 
|---|
| 1120 |   default:
 | 
|---|
| 1121 |     if (hwndMenu)
 | 
|---|
| 1122 |       SetDetailsSwitches(hwndMenu, pds);
 | 
|---|
| 1123 |     return;
 | 
|---|
| 1124 |   }
 | 
|---|
| 1125 |   if (bool)
 | 
|---|
| 1126 |     *bool = *bool ? FALSE : TRUE;
 | 
|---|
| 1127 |   if (hwnd)
 | 
|---|
| 1128 |     AdjustCnrColsForPref(hwnd, directory, pds, compare);
 | 
|---|
| 1129 |   if (hwndMenu)
 | 
|---|
| 1130 |     SetDetailsSwitches(hwndMenu, pds);
 | 
|---|
| 1131 | }
 | 
|---|
| 1132 | 
 | 
|---|
| 1133 | /**
 | 
|---|
| 1134 |  * Set default menu item to invoke for top level conditional cascade menu
 | 
|---|
| 1135 |  * @param def is default menu id (i.e. IDM_...)
 | 
|---|
| 1136 |  */
 | 
|---|
| 1137 | 
 | 
|---|
| 1138 | VOID SetConditionalCascade(HWND hwndMenu, USHORT id, USHORT def)
 | 
|---|
| 1139 | {
 | 
|---|
| 1140 |   MENUITEM mi;
 | 
|---|
| 1141 | 
 | 
|---|
| 1142 |   mi.iPosition = MIT_END;
 | 
|---|
| 1143 |   mi.hItem = 0;
 | 
|---|
| 1144 |   mi.hwndSubMenu = (HWND)0;
 | 
|---|
| 1145 |   mi.afAttribute = 0;
 | 
|---|
| 1146 |   mi.afStyle = MIS_TEXT;
 | 
|---|
| 1147 |   if (WinSendMsg(hwndMenu,
 | 
|---|
| 1148 |                  MM_QUERYITEM,
 | 
|---|
| 1149 |                  MPFROM2SHORT(id, TRUE),
 | 
|---|
| 1150 |                  MPFROMP(&mi)))
 | 
|---|
| 1151 |   {
 | 
|---|
| 1152 |     WinSetWindowBits(mi.hwndSubMenu, QWL_STYLE, MS_CONDITIONALCASCADE,
 | 
|---|
| 1153 |                      MS_CONDITIONALCASCADE);
 | 
|---|
| 1154 |     WinSendMsg(mi.hwndSubMenu, MM_SETDEFAULTITEMID, MPFROMSHORT(def), MPVOID);
 | 
|---|
| 1155 |     WinCheckMenuItem(mi.hwndSubMenu, def, TRUE);
 | 
|---|
| 1156 |   }
 | 
|---|
| 1157 | }
 | 
|---|
| 1158 | 
 | 
|---|
| 1159 | VOID SetSortChecks(HWND hwndMenu, INT sortflags)
 | 
|---|
| 1160 | {
 | 
|---|
| 1161 |   WinCheckMenuItem(hwndMenu, IDM_SORTNONE, FALSE);
 | 
|---|
| 1162 |   WinCheckMenuItem(hwndMenu, IDM_SORTFIRST, FALSE);
 | 
|---|
| 1163 |   WinCheckMenuItem(hwndMenu, IDM_SORTLAST, FALSE);
 | 
|---|
| 1164 |   WinCheckMenuItem(hwndMenu, IDM_SORTSIZE, FALSE);
 | 
|---|
| 1165 |   WinCheckMenuItem(hwndMenu, IDM_SORTEASIZE, FALSE);
 | 
|---|
| 1166 |   WinCheckMenuItem(hwndMenu, IDM_SORTLWDATE, FALSE);
 | 
|---|
| 1167 |   WinCheckMenuItem(hwndMenu, IDM_SORTLADATE, FALSE);
 | 
|---|
| 1168 |   WinCheckMenuItem(hwndMenu, IDM_SORTCRDATE, FALSE);
 | 
|---|
| 1169 |   WinCheckMenuItem(hwndMenu, IDM_SORTFILENAME, FALSE);
 | 
|---|
| 1170 |   WinCheckMenuItem(hwndMenu, IDM_SORTNAME, FALSE);
 | 
|---|
| 1171 |   WinCheckMenuItem(hwndMenu, IDM_SORTSUBJECT, FALSE);
 | 
|---|
| 1172 |   WinCheckMenuItem(hwndMenu, IDM_SORTDIRSFIRST, FALSE);
 | 
|---|
| 1173 |   WinCheckMenuItem(hwndMenu, IDM_SORTDIRSLAST, FALSE);
 | 
|---|
| 1174 |   WinCheckMenuItem(hwndMenu, IDM_SORTREVERSE, FALSE);
 | 
|---|
| 1175 |   if (sortflags & SORT_FIRSTEXTENSION)
 | 
|---|
| 1176 |     WinCheckMenuItem(hwndMenu, IDM_SORTFIRST, TRUE);
 | 
|---|
| 1177 |   else if (sortflags & SORT_LASTEXTENSION)
 | 
|---|
| 1178 |     WinCheckMenuItem(hwndMenu, IDM_SORTLAST, TRUE);
 | 
|---|
| 1179 |   else if (sortflags & SORT_SIZE)
 | 
|---|
| 1180 |     WinCheckMenuItem(hwndMenu, IDM_SORTSIZE, TRUE);
 | 
|---|
| 1181 |   else if (sortflags & SORT_EASIZE)
 | 
|---|
| 1182 |     WinCheckMenuItem(hwndMenu, IDM_SORTEASIZE, TRUE);
 | 
|---|
| 1183 |   else if (sortflags & SORT_LWDATE)
 | 
|---|
| 1184 |     WinCheckMenuItem(hwndMenu, IDM_SORTLWDATE, TRUE);
 | 
|---|
| 1185 |   else if (sortflags & SORT_LADATE)
 | 
|---|
| 1186 |     WinCheckMenuItem(hwndMenu, IDM_SORTLADATE, TRUE);
 | 
|---|
| 1187 |   else if (sortflags & SORT_CRDATE)
 | 
|---|
| 1188 |     WinCheckMenuItem(hwndMenu, IDM_SORTCRDATE, TRUE);
 | 
|---|
| 1189 |   else if (sortflags & SORT_FILENAME)
 | 
|---|
| 1190 |     WinCheckMenuItem(hwndMenu, IDM_SORTFILENAME, TRUE);
 | 
|---|
| 1191 |   else if (sortflags & SORT_NOSORT)
 | 
|---|
| 1192 |     WinCheckMenuItem(hwndMenu, IDM_SORTNONE, TRUE);
 | 
|---|
| 1193 |   else if (sortflags & SORT_SUBJECT)
 | 
|---|
| 1194 |     WinCheckMenuItem(hwndMenu, IDM_SORTSUBJECT, TRUE);
 | 
|---|
| 1195 |   else
 | 
|---|
| 1196 |     WinCheckMenuItem(hwndMenu, IDM_SORTNAME, TRUE);
 | 
|---|
| 1197 |   if (sortflags & SORT_DIRSFIRST)
 | 
|---|
| 1198 |     WinCheckMenuItem(hwndMenu, IDM_SORTDIRSFIRST, TRUE);
 | 
|---|
| 1199 |   else if (sortflags & SORT_DIRSLAST)
 | 
|---|
| 1200 |     WinCheckMenuItem(hwndMenu, IDM_SORTDIRSLAST, TRUE);
 | 
|---|
| 1201 |   if (sortflags & SORT_REVERSE)
 | 
|---|
| 1202 |     WinCheckMenuItem(hwndMenu, IDM_SORTREVERSE, TRUE);
 | 
|---|
| 1203 | }
 | 
|---|
| 1204 | 
 | 
|---|
| 1205 | VOID FcloseFile(FILE * fp)
 | 
|---|
| 1206 | {
 | 
|---|
| 1207 |   /* for use by apps that don't use the DLLs runtime library */
 | 
|---|
| 1208 |   fclose(fp);
 | 
|---|
| 1209 | }
 | 
|---|
| 1210 | 
 | 
|---|
| 1211 | VOID SetupCommandMenu(HWND hwndMenu, HWND hwndCnr)
 | 
|---|
| 1212 | {
 | 
|---|
| 1213 |   MENUITEM mi, mit;
 | 
|---|
| 1214 |   INT x;
 | 
|---|
| 1215 |   SHORT numitems;
 | 
|---|
| 1216 |   LINKCMDS *info;
 | 
|---|
| 1217 | 
 | 
|---|
| 1218 |   if (!cmdloaded)
 | 
|---|
| 1219 |     load_commands();
 | 
|---|
| 1220 |   mi.iPosition = MIT_END;
 | 
|---|
| 1221 |   mi.hwndSubMenu = (HWND) 0;
 | 
|---|
| 1222 |   mi.hItem = 0L;
 | 
|---|
| 1223 |   mi.afAttribute = 0;
 | 
|---|
| 1224 |   mi.afStyle = MIS_TEXT;
 | 
|---|
| 1225 |   memset(&mit, 0, sizeof(MENUITEM));
 | 
|---|
| 1226 |   if (WinQueryWindowUShort(hwndMenu, QWS_ID) == IDM_COMMANDSMENU)
 | 
|---|
| 1227 |     mit.hwndSubMenu = hwndMenu;
 | 
|---|
| 1228 |   else
 | 
|---|
| 1229 |     WinSendMsg(hwndMenu, MM_QUERYITEM,
 | 
|---|
| 1230 |                MPFROM2SHORT(IDM_COMMANDSMENU, TRUE), MPFROMP(&mit));
 | 
|---|
| 1231 |   if (mit.hwndSubMenu) {
 | 
|---|
| 1232 |     numitems = (SHORT) WinSendMsg(mit.hwndSubMenu, MM_QUERYITEMCOUNT,
 | 
|---|
| 1233 |                                   MPVOID, MPVOID);
 | 
|---|
| 1234 |     WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM, MPFROMSHORT(-1), MPVOID);
 | 
|---|
| 1235 |     for (x = 0; x < numitems; x++)
 | 
|---|
| 1236 |       WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM,
 | 
|---|
| 1237 |                  MPFROMSHORT((SHORT) (x + IDM_COMMANDSTART)), MPVOID);
 | 
|---|
| 1238 |     if (hwndCnr && cmdhead) {
 | 
|---|
| 1239 |       x = 0;
 | 
|---|
| 1240 |       info = cmdhead;
 | 
|---|
| 1241 |       while (info) {
 | 
|---|
| 1242 | 
 | 
|---|
| 1243 |         CHAR s[CCHMAXPATH + 24];
 | 
|---|
| 1244 | 
 | 
|---|
| 1245 |         sprintf(s,
 | 
|---|
| 1246 |                 "%s%s%s",
 | 
|---|
| 1247 |                 info->title,
 | 
|---|
| 1248 |                 x < 20 ? "\tCtrl + " : NullStr,
 | 
|---|
| 1249 |                 x < 20 && x > 9 ? "Shift + " : NullStr);
 | 
|---|
| 1250 |         if (x < 20)
 | 
|---|
| 1251 |           sprintf(&s[strlen(s)], "%d",
 | 
|---|
| 1252 |                   ((x % 10) + 1) == 10 ? 0 : (x % 10) + 1);
 | 
|---|
| 1253 |         mi.id = IDM_COMMANDSTART + x;
 | 
|---|
| 1254 |         mi.afAttribute = (info->flags & ONCE ? MIA_CHECKED : 0) |
 | 
|---|
| 1255 |                          (info->flags & PROMPT ? MIA_FRAMED : 0);
 | 
|---|
| 1256 |         mi.afStyle = MIS_TEXT;
 | 
|---|
| 1257 |         if (!(x % 24) && x && info->next)
 | 
|---|
| 1258 |           mi.afStyle |= MIS_BREAK;
 | 
|---|
| 1259 |         WinSendMsg(mit.hwndSubMenu, MM_INSERTITEM, MPFROMP(&mi), MPFROMP(s));
 | 
|---|
| 1260 |         x++;
 | 
|---|
| 1261 |         info = info->next;
 | 
|---|
| 1262 |       }
 | 
|---|
| 1263 |     }
 | 
|---|
| 1264 |   }
 | 
|---|
| 1265 | }
 | 
|---|
| 1266 | 
 | 
|---|
| 1267 | VOID LoadDetailsSwitches(CHAR * keyroot, DETAILS_SETTINGS * pds)
 | 
|---|
| 1268 | {
 | 
|---|
| 1269 |   ULONG size;
 | 
|---|
| 1270 |   CHAR s[CCHMAXPATH], *eos = s;
 | 
|---|
| 1271 | 
 | 
|---|
| 1272 |   strcpy(s, keyroot);
 | 
|---|
| 1273 |   strcat(s, ".");
 | 
|---|
| 1274 |   eos = &s[strlen(s)];
 | 
|---|
| 1275 |   strcpy(eos, "DetailsLongname");
 | 
|---|
| 1276 |   pds->detailslongname = dsDirCnrDefault.detailslongname;
 | 
|---|
| 1277 |   size = sizeof(BOOL);
 | 
|---|
| 1278 |   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailslongname, &size);
 | 
|---|
| 1279 |   strcpy(eos, "DetailsSubject");
 | 
|---|
| 1280 |   pds->detailssubject = dsDirCnrDefault.detailssubject;
 | 
|---|
| 1281 |   size = sizeof(BOOL);
 | 
|---|
| 1282 |   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailssubject, &size);
 | 
|---|
| 1283 |   strcpy(eos, "DetailsEA");
 | 
|---|
| 1284 |   pds->detailsea = dsDirCnrDefault.detailsea;
 | 
|---|
| 1285 |   size = sizeof(BOOL);
 | 
|---|
| 1286 |   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailsea, &size);
 | 
|---|
| 1287 |   strcpy(eos, "DetailsSize");
 | 
|---|
| 1288 |   pds->detailssize = dsDirCnrDefault.detailssize;
 | 
|---|
| 1289 |   size = sizeof(BOOL);
 | 
|---|
| 1290 |   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailssize, &size);
 | 
|---|
| 1291 |   strcpy(eos, "DetailsIcon");
 | 
|---|
| 1292 |   pds->detailsicon = dsDirCnrDefault.detailsicon;
 | 
|---|
| 1293 |   size = sizeof(BOOL);
 | 
|---|
| 1294 |   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailsicon, &size);
 | 
|---|
| 1295 |   strcpy(eos, "DetailsAttr");
 | 
|---|
| 1296 |   pds->detailsattr = dsDirCnrDefault.detailsattr;
 | 
|---|
| 1297 |   size = sizeof(BOOL);
 | 
|---|
| 1298 |   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailsattr, &size);
 | 
|---|
| 1299 |   strcpy(eos, "DetailsCRDate");
 | 
|---|
| 1300 |   pds->detailscrdate = dsDirCnrDefault.detailscrdate;
 | 
|---|
| 1301 |   size = sizeof(BOOL);
 | 
|---|
| 1302 |   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailscrdate, &size);
 | 
|---|
| 1303 |   strcpy(eos, "DetailsCRTime");
 | 
|---|
| 1304 |   pds->detailscrtime = dsDirCnrDefault.detailscrtime;
 | 
|---|
| 1305 |   size = sizeof(BOOL);
 | 
|---|
| 1306 |   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailscrtime, &size);
 | 
|---|
| 1307 |   strcpy(eos, "DetailsLWDate");
 | 
|---|
| 1308 |   pds->detailslwdate = dsDirCnrDefault.detailslwdate;
 | 
|---|
| 1309 |   size = sizeof(BOOL);
 | 
|---|
| 1310 |   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailslwdate, &size);
 | 
|---|
| 1311 |   strcpy(eos, "DetailsLWTime");
 | 
|---|
| 1312 |   pds->detailslwtime = dsDirCnrDefault.detailslwtime;
 | 
|---|
| 1313 |   size = sizeof(BOOL);
 | 
|---|
| 1314 |   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailslwtime, &size);
 | 
|---|
| 1315 |   strcpy(eos, "DetailsLADate");
 | 
|---|
| 1316 |   pds->detailsladate = dsDirCnrDefault.detailsladate;
 | 
|---|
| 1317 |   size = sizeof(BOOL);
 | 
|---|
| 1318 |   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailsladate, &size);
 | 
|---|
| 1319 |   strcpy(eos, "DetailsLATime");
 | 
|---|
| 1320 |   pds->detailslatime = dsDirCnrDefault.detailslatime;
 | 
|---|
| 1321 |   size = sizeof(BOOL);
 | 
|---|
| 1322 |   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailslatime, &size);
 | 
|---|
| 1323 |   strcpy(eos, "SubjectInLeftPane");
 | 
|---|
| 1324 |   pds->fSubjectInLeftPane = dsDirCnrDefault.fSubjectInLeftPane;
 | 
|---|
| 1325 |   size = sizeof(BOOL);
 | 
|---|
| 1326 |   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->fSubjectInLeftPane, &size);
 | 
|---|
| 1327 |   strcpy(eos, "SubjectLengthMax");
 | 
|---|
| 1328 |   pds->fSubjectLengthMax = dsDirCnrDefault.fSubjectLengthMax;
 | 
|---|
| 1329 |   size = sizeof(BOOL);
 | 
|---|
| 1330 |   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->fSubjectLengthMax, &size);
 | 
|---|
| 1331 |   if (pds->fSubjectLengthMax)
 | 
|---|
| 1332 |     pds->SubjectDisplayWidth = 0;
 | 
|---|
| 1333 |   else {
 | 
|---|
| 1334 |     strcpy(eos, "SubjectDisplayWidth");
 | 
|---|
| 1335 |     pds->SubjectDisplayWidth = dsDirCnrDefault.SubjectDisplayWidth;
 | 
|---|
| 1336 |     size = sizeof(ULONG);
 | 
|---|
| 1337 |     PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->SubjectDisplayWidth, &size);
 | 
|---|
| 1338 |     if (pds->SubjectDisplayWidth < 50)
 | 
|---|
| 1339 |       pds->SubjectDisplayWidth = 0;
 | 
|---|
| 1340 |     else if (pds->SubjectDisplayWidth > 1000)
 | 
|---|
| 1341 |       pds->SubjectDisplayWidth = 1000;
 | 
|---|
| 1342 |   }
 | 
|---|
| 1343 | }
 | 
|---|
| 1344 | 
 | 
|---|
| 1345 | HWND FindDirCnr(HWND hwndParent)
 | 
|---|
| 1346 | {
 | 
|---|
| 1347 |   HWND found, hwndDir = (HWND) 0;
 | 
|---|
| 1348 |   HENUM henum;
 | 
|---|
| 1349 | 
 | 
|---|
| 1350 |   henum = WinBeginEnumWindows(hwndParent);
 | 
|---|
| 1351 |   while ((found = WinGetNextWindow(henum)) != NULLHANDLE) {
 | 
|---|
| 1352 |     hwndDir = WinWindowFromID(found, FID_CLIENT);
 | 
|---|
| 1353 |     if (hwndDir) {
 | 
|---|
| 1354 |       hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
 | 
|---|
| 1355 |       if (hwndDir)
 | 
|---|
| 1356 |         break;
 | 
|---|
| 1357 |       hwndDir = (HWND) 0;
 | 
|---|
| 1358 |     }
 | 
|---|
| 1359 |   }
 | 
|---|
| 1360 |   WinEndEnumWindows(henum);
 | 
|---|
| 1361 | 
 | 
|---|
| 1362 |   return hwndDir;
 | 
|---|
| 1363 | }
 | 
|---|
| 1364 | 
 | 
|---|
| 1365 | VOID HeapThread(VOID * dummy)
 | 
|---|
| 1366 | {
 | 
|---|
| 1367 |   ULONG postcount;
 | 
|---|
| 1368 |   APIRET rc;
 | 
|---|
| 1369 | 
 | 
|---|
| 1370 |   rc = DosCreateEventSem(NULL, &CompactSem, 0L, FALSE);
 | 
|---|
| 1371 |   if (rc)
 | 
|---|
| 1372 |     Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
 | 
|---|
| 1373 |               "DosCreateEventSem");
 | 
|---|
| 1374 |   else {
 | 
|---|
| 1375 |     priority_normal();
 | 
|---|
| 1376 |     for (;;) {
 | 
|---|
| 1377 |       if (DosWaitEventSem(CompactSem, SEM_INDEFINITE_WAIT))
 | 
|---|
| 1378 |         break;
 | 
|---|
| 1379 |       _heapmin();
 | 
|---|
| 1380 |       DosResetEventSem(CompactSem, &postcount);
 | 
|---|
| 1381 |     }
 | 
|---|
| 1382 |   }
 | 
|---|
| 1383 | }
 | 
|---|
| 1384 | 
 | 
|---|
| 1385 | VOID FixSwitchList(HWND hwnd, CHAR * text)
 | 
|---|
| 1386 | {
 | 
|---|
| 1387 |   HSWITCH hswitch;
 | 
|---|
| 1388 |   SWCNTRL swctl;
 | 
|---|
| 1389 | 
 | 
|---|
| 1390 |   hswitch = WinQuerySwitchHandle(hwnd, 0);
 | 
|---|
| 1391 |   if (hswitch) {
 | 
|---|
| 1392 |     if (!WinQuerySwitchEntry(hswitch, &swctl)) {
 | 
|---|
| 1393 |       strcpy(swctl.szSwtitle, "FM/2");
 | 
|---|
| 1394 |       WinChangeSwitchEntry(hswitch, &swctl);
 | 
|---|
| 1395 |     }
 | 
|---|
| 1396 |   }
 | 
|---|
| 1397 | }
 | 
|---|
| 1398 | 
 | 
|---|
| 1399 | VOID QuickPopup(HWND hwnd, DIRCNRDATA * dcd, HWND hwndMenu, USHORT id)
 | 
|---|
| 1400 | {
 | 
|---|
| 1401 |   dcd->hwndLastMenu = hwndMenu;
 | 
|---|
| 1402 |   if (dcd->hwndLastMenu && !dcd->cnremphasized) {
 | 
|---|
| 1403 |     WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
 | 
|---|
| 1404 |                MPFROM2SHORT(TRUE, CRA_SOURCE));
 | 
|---|
| 1405 |     dcd->cnremphasized = TRUE;
 | 
|---|
| 1406 |   }
 | 
|---|
| 1407 |   if (dcd->flWindowAttr & CV_MINI)
 | 
|---|
| 1408 |     WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE);
 | 
|---|
| 1409 |   if (!WinPopupMenu(hwnd, hwnd, dcd->hwndLastMenu,
 | 
|---|
| 1410 |                     8, 8, 0,
 | 
|---|
| 1411 |                     PU_HCONSTRAIN | PU_VCONSTRAIN |
 | 
|---|
| 1412 |                     PU_KEYBOARD | PU_MOUSEBUTTON1)) {
 | 
|---|
| 1413 |     if (dcd->cnremphasized) {
 | 
|---|
| 1414 |       WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
 | 
|---|
| 1415 |                  MPFROM2SHORT(FALSE, CRA_SOURCE));
 | 
|---|
| 1416 |       dcd->cnremphasized = FALSE;
 | 
|---|
| 1417 |     }
 | 
|---|
| 1418 |   }
 | 
|---|
| 1419 |   else
 | 
|---|
| 1420 |     WinSendMsg(dcd->hwndLastMenu, MM_SELECTITEM,
 | 
|---|
| 1421 |                MPFROM2SHORT(id, TRUE), MPFROM2SHORT(0, FALSE));
 | 
|---|
| 1422 | }
 | 
|---|
| 1423 | 
 | 
|---|
| 1424 | PMINIRECORDCORE CurrentRecord(HWND hwndCnr)
 | 
|---|
| 1425 | {
 | 
|---|
| 1426 |   SHORT attrib = fSelectedAlways ? CRA_SELECTED : CRA_CURSORED;
 | 
|---|
| 1427 |   PMINIRECORDCORE pmi;
 | 
|---|
| 1428 | 
 | 
|---|
| 1429 |   for (;;) {
 | 
|---|
| 1430 |     pmi = (PMINIRECORDCORE) WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS,
 | 
|---|
| 1431 |                                        MPFROMLONG(CMA_FIRST),
 | 
|---|
| 1432 |                                        MPFROMSHORT(attrib));
 | 
|---|
| 1433 |     if ((!pmi || (INT) pmi == -1) && attrib == CRA_SELECTED)    /* punt */
 | 
|---|
| 1434 |       attrib = CRA_CURSORED;
 | 
|---|
| 1435 |     else
 | 
|---|
| 1436 |       break;
 | 
|---|
| 1437 |   }
 | 
|---|
| 1438 |   return ((INT)pmi == -1) ? NULL : pmi;
 | 
|---|
| 1439 | }
 | 
|---|
| 1440 | 
 | 
|---|
| 1441 | BOOL PostMsg(HWND h, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| 1442 | {
 | 
|---|
| 1443 |   BOOL rc = WinPostMsg(h, msg, mp1, mp2);
 | 
|---|
| 1444 | 
 | 
|---|
| 1445 |   if (!rc) {
 | 
|---|
| 1446 | 
 | 
|---|
| 1447 |     // If window owned by some other process or some other thread?
 | 
|---|
| 1448 |     if (!IsFm2Window(h, 1)) {
 | 
|---|
| 1449 |       QMSG qmsg;
 | 
|---|
| 1450 |       for (;;) {
 | 
|---|
| 1451 |         DosSleep(1);
 | 
|---|
| 1452 |         rc = WinPostMsg(h, msg, mp1, mp2);
 | 
|---|
| 1453 |         if (rc)
 | 
|---|
| 1454 |           break;                        // OK
 | 
|---|
| 1455 |         if (!WinIsWindow((HAB) 0, h))
 | 
|---|
| 1456 |           break;                        // Window gone
 | 
|---|
| 1457 |         if (WinPeekMsg((HAB) 0, &qmsg, (HWND) 0, 0, 0, PM_NOREMOVE))
 | 
|---|
| 1458 |           break;                        // Queue has message(s)
 | 
|---|
| 1459 |       }                  // for
 | 
|---|
| 1460 |     }
 | 
|---|
| 1461 |   }
 | 
|---|
| 1462 |   return rc;
 | 
|---|
| 1463 | }
 | 
|---|
| 1464 | 
 | 
|---|
| 1465 | VOID OpenEdit(HWND hwnd)
 | 
|---|
| 1466 | {
 | 
|---|
| 1467 |   CNREDITDATA ced;
 | 
|---|
| 1468 |   PCNRITEM pci;
 | 
|---|
| 1469 |   PFIELDINFO pfi;
 | 
|---|
| 1470 | 
 | 
|---|
| 1471 |   pci = (PCNRITEM) WinSendMsg(hwnd,
 | 
|---|
| 1472 |                               CM_QUERYRECORDEMPHASIS,
 | 
|---|
| 1473 |                               MPFROMLONG(CMA_FIRST),
 | 
|---|
| 1474 |                               MPFROMSHORT(CRA_CURSORED));
 | 
|---|
| 1475 |   if (pci && (INT) pci != -1) {
 | 
|---|
| 1476 |     memset(&ced, 0, sizeof(ced));
 | 
|---|
| 1477 |     ced.cb = sizeof(ced);
 | 
|---|
| 1478 |     ced.hwndCnr = hwnd;
 | 
|---|
| 1479 |     ced.id = WinQueryWindowUShort(hwnd, QWS_ID);
 | 
|---|
| 1480 |     ced.pRecord = (PRECORDCORE) pci;
 | 
|---|
| 1481 |     pfi = (PFIELDINFO) WinSendMsg(hwnd,
 | 
|---|
| 1482 |                                   CM_QUERYDETAILFIELDINFO,
 | 
|---|
| 1483 |                                   MPVOID, MPFROMSHORT(CMA_FIRST));
 | 
|---|
| 1484 |     if (!pfi)
 | 
|---|
| 1485 |       WinSendMsg(hwnd, CM_OPENEDIT, MPFROMP(&ced), MPVOID);
 | 
|---|
| 1486 |     else {
 | 
|---|
| 1487 |       while (pfi && (INT) pfi != -1 &&
 | 
|---|
| 1488 |              pfi->offStruct != FIELDOFFSET(CNRITEM, pszFileName))
 | 
|---|
| 1489 |         pfi = (PFIELDINFO) WinSendMsg(hwnd,
 | 
|---|
| 1490 |                                       CM_QUERYDETAILFIELDINFO,
 | 
|---|
| 1491 |                                       MPFROMP(pfi), MPFROMSHORT(CMA_NEXT));
 | 
|---|
| 1492 |       if (pfi && (INT) pfi != -1) {
 | 
|---|
| 1493 |         ced.pFieldInfo = pfi;
 | 
|---|
| 1494 |         {
 | 
|---|
| 1495 |           CNRINFO cnri;
 | 
|---|
| 1496 | 
 | 
|---|
| 1497 |           memset(&cnri, 0, sizeof(CNRINFO));
 | 
|---|
| 1498 |           cnri.cb = sizeof(CNRINFO);
 | 
|---|
| 1499 |           WinSendMsg(hwnd,
 | 
|---|
| 1500 |                      CM_QUERYCNRINFO,
 | 
|---|
| 1501 |                      MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
 | 
|---|
| 1502 |           if (cnri.flWindowAttr & CV_DETAIL)
 | 
|---|
| 1503 |             ced.id = CID_LEFTDVWND;
 | 
|---|
| 1504 |         }
 | 
|---|
| 1505 |         WinSendMsg(hwnd, CM_OPENEDIT, MPFROMP(&ced), MPVOID);
 | 
|---|
| 1506 |       }
 | 
|---|
| 1507 |     }
 | 
|---|
| 1508 |   }
 | 
|---|
| 1509 | }
 | 
|---|
| 1510 | 
 | 
|---|
| 1511 | #ifdef NEVER
 | 
|---|
| 1512 | VOID QuickView(HWND hwnd, CHAR * filename)
 | 
|---|
| 1513 | {
 | 
|---|
| 1514 |   if (filename && IsFile(filename) == 1) {
 | 
|---|
| 1515 |     if (TestBinary(filename) && *binview) {
 | 
|---|
| 1516 | 
 | 
|---|
| 1517 |       CHAR *list[2];
 | 
|---|
| 1518 | 
 | 
|---|
| 1519 |       list[0] = filename;
 | 
|---|
| 1520 |       list[1] = NULL;
 | 
|---|
| 1521 |       ExecOnList(hwnd, binview, WINDOWED | SEPARATE, NULL, list, NULL,
 | 
|---|
| 1522 |                  pszSrcFile, __LINE__);
 | 
|---|
| 1523 |       return;
 | 
|---|
| 1524 |     }
 | 
|---|
| 1525 |     else if (*viewer) {
 | 
|---|
| 1526 | 
 | 
|---|
| 1527 |       CHAR *list[2];
 | 
|---|
| 1528 | 
 | 
|---|
| 1529 |       list[0] = filename;
 | 
|---|
| 1530 |       list[1] = NULL;
 | 
|---|
| 1531 |       ExecOnList(hwnd, viewer,
 | 
|---|
| 1532 |                  WINDOWED | SEPARATE | (fViewChild ? CHILD : 0),
 | 
|---|
| 1533 |                  NULL, list, NULL, pszSrcFile, __LINE__);
 | 
|---|
| 1534 |       return;
 | 
|---|
| 1535 |     }
 | 
|---|
| 1536 |     StartMLEEditor(HWND_DESKTOP, 5, filename, (HWND) 0);
 | 
|---|
| 1537 |   }
 | 
|---|
| 1538 | }
 | 
|---|
| 1539 | 
 | 
|---|
| 1540 | VOID QuickEdit(HWND hwnd, CHAR * filename)
 | 
|---|
| 1541 | {
 | 
|---|
| 1542 |   if (filename && IsFile(filename) == 1) {
 | 
|---|
| 1543 |     if (TestBinary(filename) && *bined) {
 | 
|---|
| 1544 | 
 | 
|---|
| 1545 |       CHAR *list[2];
 | 
|---|
| 1546 | 
 | 
|---|
| 1547 |       list[0] = filename;
 | 
|---|
| 1548 |       list[1] = NULL;
 | 
|---|
| 1549 |       ExecOnList(hwnd, bined, WINDOWED | SEPARATE, NULL, list, NULL,
 | 
|---|
| 1550 |                  pszSrcFile, __LINE__);
 | 
|---|
| 1551 |       return;
 | 
|---|
| 1552 |     }
 | 
|---|
| 1553 |     else if (*editor) {
 | 
|---|
| 1554 | 
 | 
|---|
| 1555 |       CHAR *list[2];
 | 
|---|
| 1556 | 
 | 
|---|
| 1557 |       list[0] = filename;
 | 
|---|
| 1558 |       list[1] = NULL;
 | 
|---|
| 1559 |       ExecOnList(hwnd, editor, WINDOWED | SEPARATE, NULL, list, NULL,
 | 
|---|
| 1560 |                  pszSrcFile, __LINE__);
 | 
|---|
| 1561 |       return;
 | 
|---|
| 1562 |     }
 | 
|---|
| 1563 |     StartMLEEditor(HWND_DESKTOP, 4, filename, (HWND) 0);
 | 
|---|
| 1564 |   }
 | 
|---|
| 1565 | }
 | 
|---|
| 1566 | #endif
 | 
|---|
| 1567 | 
 | 
|---|
| 1568 | VOID PortholeInit(HWND hwndNew, MPARAM mp1, MPARAM mp2)
 | 
|---|
| 1569 | {
 | 
|---|
| 1570 |   static HWND DefMenu = (HWND) 0;
 | 
|---|
| 1571 |   HWND hwndMenu = (HWND) mp2;
 | 
|---|
| 1572 | 
 | 
|---|
| 1573 |   {
 | 
|---|
| 1574 |     ULONG style;
 | 
|---|
| 1575 | 
 | 
|---|
| 1576 |     style = WinQueryWindowULong(hwndMenu, QWL_STYLE);
 | 
|---|
| 1577 |     if (!(style & MS_ACTIONBAR))
 | 
|---|
| 1578 |       return;
 | 
|---|
| 1579 |   }
 | 
|---|
| 1580 | 
 | 
|---|
| 1581 |   switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 1582 |   case 0:
 | 
|---|
| 1583 |     {
 | 
|---|
| 1584 |       HWND hwndNow;
 | 
|---|
| 1585 |       MENUITEM mi;
 | 
|---|
| 1586 |       ULONG ulStyle;
 | 
|---|
| 1587 | 
 | 
|---|
| 1588 |       memset(&mi, 0, sizeof(mi));
 | 
|---|
| 1589 |       mi.iPosition = MIT_END;
 | 
|---|
| 1590 |       mi.afStyle = MIS_TEXT;
 | 
|---|
| 1591 |       WinSendMsg(hwndMenu, MM_QUERYITEM,
 | 
|---|
| 1592 |                  MPFROM2SHORT(IDM_FILESMENU, TRUE), MPFROMP(&mi));
 | 
|---|
| 1593 |       if (!DefMenu)
 | 
|---|
| 1594 |         DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU);
 | 
|---|
| 1595 |       hwndNow = mi.hwndSubMenu;
 | 
|---|
| 1596 |       mi.hwndSubMenu = hwndNew;
 | 
|---|
| 1597 |       if (!mi.hwndSubMenu)
 | 
|---|
| 1598 |         mi.hwndSubMenu = DefMenu;
 | 
|---|
| 1599 |       WinSetParent(hwndNow, WinQueryObjectWindow(HWND_DESKTOP), FALSE);
 | 
|---|
| 1600 |       WinSetOwner(hwndNow, WinQueryObjectWindow(HWND_DESKTOP));
 | 
|---|
| 1601 |       WinSetOwner(mi.hwndSubMenu, hwndMenu);
 | 
|---|
| 1602 |       WinSetParent(mi.hwndSubMenu, hwndMenu, FALSE);
 | 
|---|
| 1603 |       WinSetWindowUShort(mi.hwndSubMenu, QWS_ID, IDM_FILESMENU);
 | 
|---|
| 1604 |       mi.afStyle = MIS_SUBMENU;
 | 
|---|
| 1605 |       ulStyle = WinQueryWindowULong(mi.hwndSubMenu, QWL_STYLE);
 | 
|---|
| 1606 |       ulStyle &= -WS_SAVEBITS;
 | 
|---|
| 1607 |       ulStyle |= MS_POPUP | WS_CLIPSIBLINGS | WS_SAVEBITS;
 | 
|---|
| 1608 |       WinSetWindowULong(mi.hwndSubMenu, QWL_STYLE, ulStyle);
 | 
|---|
| 1609 |       WinSendMsg(hwndMenu, MM_SETITEM, MPFROM2SHORT(0, TRUE), MPFROMP(&mi));
 | 
|---|
| 1610 |     }
 | 
|---|
| 1611 |     break;
 | 
|---|
| 1612 | 
 | 
|---|
| 1613 |   case 1:
 | 
|---|
| 1614 |     {
 | 
|---|
| 1615 |       HWND hwndNow;
 | 
|---|
| 1616 |       MENUITEM mi;
 | 
|---|
| 1617 |       ULONG ulStyle;
 | 
|---|
| 1618 | 
 | 
|---|
| 1619 |       memset(&mi, 0, sizeof(mi));
 | 
|---|
| 1620 |       mi.iPosition = MIT_END;
 | 
|---|
| 1621 |       mi.afStyle = MIS_TEXT;
 | 
|---|
| 1622 |       WinSendMsg(hwndMenu, MM_QUERYITEM,
 | 
|---|
| 1623 |                  MPFROM2SHORT(IDM_VIEWSMENU, TRUE), MPFROMP(&mi));
 | 
|---|
| 1624 |       if (!DefMenu)
 | 
|---|
| 1625 |         DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU);
 | 
|---|
| 1626 |       hwndNow = mi.hwndSubMenu;
 | 
|---|
| 1627 |       mi.hwndSubMenu = hwndNew;
 | 
|---|
| 1628 |       if (!mi.hwndSubMenu)
 | 
|---|
| 1629 |         mi.hwndSubMenu = DefMenu;
 | 
|---|
| 1630 |       WinSetParent(hwndNow, WinQueryObjectWindow(HWND_DESKTOP), FALSE);
 | 
|---|
| 1631 |       WinSetOwner(hwndNow, WinQueryObjectWindow(HWND_DESKTOP));
 | 
|---|
| 1632 |       WinSetOwner(mi.hwndSubMenu, hwndMenu);
 | 
|---|
| 1633 |       WinSetParent(mi.hwndSubMenu, hwndMenu, FALSE);
 | 
|---|
| 1634 |       WinSetWindowUShort(mi.hwndSubMenu, QWS_ID, IDM_VIEWSMENU);
 | 
|---|
| 1635 |       mi.afStyle = MIS_SUBMENU;
 | 
|---|
| 1636 |       ulStyle = WinQueryWindowULong(mi.hwndSubMenu, QWL_STYLE);
 | 
|---|
| 1637 |       ulStyle &= -WS_SAVEBITS;
 | 
|---|
| 1638 |       ulStyle |= MS_POPUP | WS_CLIPSIBLINGS | WS_SAVEBITS;
 | 
|---|
| 1639 |       WinSetWindowULong(mi.hwndSubMenu, QWL_STYLE, ulStyle);
 | 
|---|
| 1640 |       WinSendMsg(hwndMenu, MM_SETITEM, MPFROM2SHORT(0, TRUE), MPFROMP(&mi));
 | 
|---|
| 1641 |     }
 | 
|---|
| 1642 |     break;
 | 
|---|
| 1643 |   }
 | 
|---|
| 1644 | }
 | 
|---|
| 1645 | 
 | 
|---|
| 1646 | HWND CheckMenu(HWND hwnd, HWND * hwndMenu, USHORT id)
 | 
|---|
| 1647 | {
 | 
|---|
| 1648 |   /* load and adjust menus as required */
 | 
|---|
| 1649 |   if (!*hwndMenu || !WinIsWindow((HAB) 0, *hwndMenu)) {
 | 
|---|
| 1650 |     *hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
 | 
|---|
| 1651 |     CopyPresParams(*hwndMenu, hwnd);
 | 
|---|
| 1652 |     if (hwndMenu == &DirMenu) {
 | 
|---|
| 1653 |       WinSetWindowUShort(DirMenu, QWS_ID, IDM_FILESMENU);
 | 
|---|
| 1654 |       SetConditionalCascade(DirMenu, IDM_COMMANDSMENU, IDM_DOITYOURSELF);
 | 
|---|
| 1655 |       SetConditionalCascade(DirMenu, IDM_COPYMENU, IDM_COPY);
 | 
|---|
| 1656 |       SetConditionalCascade(DirMenu, IDM_MOVEMENU, IDM_MOVE);
 | 
|---|
| 1657 |       SetConditionalCascade(DirMenu, IDM_SAVESUBMENU, IDM_SAVETOCLIP);
 | 
|---|
| 1658 |       SetConditionalCascade(DirMenu, IDM_SAVESUBMENU, IDM_SAVETOCLIPFILENAME);
 | 
|---|
| 1659 |       SetConditionalCascade(DirMenu, IDM_VIEWSUBMENU, IDM_INFO);
 | 
|---|
| 1660 |       SetConditionalCascade(DirMenu, IDM_EDITSUBMENU, IDM_ATTRS);
 | 
|---|
| 1661 |       SetConditionalCascade(DirMenu, IDM_DELETESUBMENU,
 | 
|---|
| 1662 |                             fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
 | 
|---|
| 1663 |       SetConditionalCascade(DirMenu, IDM_MISCSUBMENU, IDM_SIZES);
 | 
|---|
| 1664 |       SetConditionalCascade(DirMenu, IDM_OPENSUBMENU, IDM_OPENWINDOW);
 | 
|---|
| 1665 |       if (fWorkPlace) {
 | 
|---|
| 1666 |         WinSendMsg(DirMenu, MM_DELETEITEM,
 | 
|---|
| 1667 |                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
 | 
|---|
| 1668 |         WinSendMsg(DirMenu, MM_DELETEITEM,
 | 
|---|
| 1669 |                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
 | 
|---|
| 1670 |       }
 | 
|---|
| 1671 |     }
 | 
|---|
| 1672 |     else if (hwndMenu == &TreeMenu) {
 | 
|---|
| 1673 |       WinSetWindowUShort(TreeMenu, QWS_ID, IDM_FILESMENU);
 | 
|---|
| 1674 |       SetConditionalCascade(TreeMenu, IDM_COMMANDSMENU, IDM_DOITYOURSELF);
 | 
|---|
| 1675 |       SetConditionalCascade(TreeMenu, IDM_SAVESUBMENU, IDM_SAVETOCLIP);
 | 
|---|
| 1676 |       SetConditionalCascade(TreeMenu, IDM_EDITSUBMENU, IDM_ATTRS);
 | 
|---|
| 1677 |       SetConditionalCascade(TreeMenu, IDM_EXPANDSUBMENU, IDM_EXPAND);
 | 
|---|
| 1678 |       SetConditionalCascade(TreeMenu, IDM_MISCSUBMENU, IDM_SIZES);
 | 
|---|
| 1679 |       SetConditionalCascade(TreeMenu, IDM_OPENSUBMENU, IDM_OPENWINDOW);
 | 
|---|
| 1680 |       if (fWorkPlace) {
 | 
|---|
| 1681 |         WinSendMsg(TreeMenu, MM_DELETEITEM,
 | 
|---|
| 1682 |                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
 | 
|---|
| 1683 |         WinSendMsg(TreeMenu, MM_DELETEITEM,
 | 
|---|
| 1684 |                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
 | 
|---|
| 1685 |       }
 | 
|---|
| 1686 |     }
 | 
|---|
| 1687 |     else if (hwndMenu == &ArcMenu) {
 | 
|---|
| 1688 |       WinSetWindowUShort(ArcMenu, QWS_ID, IDM_FILESMENU);
 | 
|---|
| 1689 |       SetConditionalCascade(ArcMenu, IDM_EXTRACTSUBMENU, IDM_EXTRACT);
 | 
|---|
| 1690 |       SetConditionalCascade(ArcMenu, IDM_EDITSUBMENU, IDM_EDIT);
 | 
|---|
| 1691 |       SetConditionalCascade(ArcMenu, IDM_VIEWSUBMENU, IDM_VIEW);
 | 
|---|
| 1692 |       if (fWorkPlace)
 | 
|---|
| 1693 |         WinSendMsg(ArcMenu, MM_DELETEITEM,
 | 
|---|
| 1694 |                    MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID);
 | 
|---|
| 1695 |     }
 | 
|---|
| 1696 |     else if (hwndMenu == &FileMenu) {
 | 
|---|
| 1697 |       WinSetWindowUShort(FileMenu, QWS_ID, IDM_FILESMENU);
 | 
|---|
| 1698 |       SetConditionalCascade(FileMenu, IDM_COMMANDSMENU, IDM_DOITYOURSELF);
 | 
|---|
| 1699 |       SetConditionalCascade(FileMenu, IDM_COPYMENU, IDM_COPY);
 | 
|---|
| 1700 |       SetConditionalCascade(FileMenu, IDM_MOVEMENU, IDM_MOVE);
 | 
|---|
| 1701 |       SetConditionalCascade(FileMenu, IDM_SAVESUBMENU, IDM_SAVETOCLIP);
 | 
|---|
| 1702 |       SetConditionalCascade(FileMenu, IDM_VIEWSUBMENU, IDM_VIEW);
 | 
|---|
| 1703 |       SetConditionalCascade(FileMenu, IDM_EDITSUBMENU, IDM_EDIT);
 | 
|---|
| 1704 |       SetConditionalCascade(FileMenu, IDM_COLLECTMENU, IDM_COLLECT);
 | 
|---|
| 1705 |       SetConditionalCascade(FileMenu, IDM_DELETESUBMENU,
 | 
|---|
| 1706 |                             fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
 | 
|---|
| 1707 |       SetConditionalCascade(FileMenu, IDM_OPENSUBMENU, IDM_OPENDEFAULT);
 | 
|---|
| 1708 |       SetConditionalCascade(FileMenu, IDM_OBJECTSUBMENU, IDM_SHADOW);
 | 
|---|
| 1709 |       if (fWorkPlace) {
 | 
|---|
| 1710 |         WinSendMsg(FileMenu, MM_DELETEITEM,
 | 
|---|
| 1711 |                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
 | 
|---|
| 1712 |         WinSendMsg(FileMenu, MM_DELETEITEM,
 | 
|---|
| 1713 |                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
 | 
|---|
| 1714 |       }
 | 
|---|
| 1715 |     }
 | 
|---|
| 1716 |     else if (hwndMenu == &DirCnrMenu) {
 | 
|---|
| 1717 |       WinSetWindowUShort(DirCnrMenu, QWS_ID, IDM_VIEWSMENU);
 | 
|---|
| 1718 |       SetConditionalCascade(DirCnrMenu, IDM_MISCSUBMENU, IDM_SIZES);
 | 
|---|
| 1719 |       SetConditionalCascade(DirCnrMenu, IDM_OPENSUBMENU, IDM_OPENSETTINGSME);
 | 
|---|
| 1720 |       if (fWorkPlace)
 | 
|---|
| 1721 |         WinSendMsg(DirCnrMenu, MM_DELETEITEM,
 | 
|---|
| 1722 |                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
 | 
|---|
| 1723 |     }
 | 
|---|
| 1724 |     else if (hwndMenu == &TreeCnrMenu) {
 | 
|---|
| 1725 |       WinSetWindowUShort(TreeCnrMenu, QWS_ID, IDM_VIEWSMENU);
 | 
|---|
| 1726 |       SetConditionalCascade(TreeCnrMenu, IDM_PARTITIONSMENU, IDM_PARTITION);
 | 
|---|
| 1727 |     }
 | 
|---|
| 1728 |     else if (hwndMenu == &ArcCnrMenu) {
 | 
|---|
| 1729 |       WinSetWindowUShort(ArcCnrMenu, QWS_ID, IDM_VIEWSMENU);
 | 
|---|
| 1730 |       SetConditionalCascade(ArcCnrMenu, IDM_EXTRACTSUBMENU, IDM_ARCEXTRACT);
 | 
|---|
| 1731 |       if (fWorkPlace)
 | 
|---|
| 1732 |         WinSendMsg(ArcCnrMenu, MM_DELETEITEM,
 | 
|---|
| 1733 |                    MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID);
 | 
|---|
| 1734 |     }
 | 
|---|
| 1735 |     else if (hwndMenu == &CollectorCnrMenu) {
 | 
|---|
| 1736 |       WinSetWindowUShort(CollectorCnrMenu, QWS_ID, IDM_VIEWSMENU);
 | 
|---|
| 1737 |       SetConditionalCascade(CollectorCnrMenu, IDM_COLLECTMENU,
 | 
|---|
| 1738 |                             IDM_COLLECTFROMCLIP);
 | 
|---|
| 1739 |     }
 | 
|---|
| 1740 |     else if (hwndMenu == &CollectorFileMenu) {
 | 
|---|
| 1741 |       WinSetWindowUShort(CollectorFileMenu, QWS_ID, IDM_FILESMENU);
 | 
|---|
| 1742 |       SetConditionalCascade(CollectorFileMenu, IDM_COMMANDSMENU,
 | 
|---|
| 1743 |                             IDM_DOITYOURSELF);
 | 
|---|
| 1744 |       SetConditionalCascade(CollectorFileMenu, IDM_COPYMENU, IDM_COPY);
 | 
|---|
| 1745 |       SetConditionalCascade(CollectorFileMenu, IDM_MOVEMENU, IDM_MOVE);
 | 
|---|
| 1746 |       SetConditionalCascade(CollectorFileMenu, IDM_SAVESUBMENU,
 | 
|---|
| 1747 |                             IDM_SAVETOCLIP);
 | 
|---|
| 1748 |       SetConditionalCascade(CollectorFileMenu, IDM_VIEWSUBMENU, IDM_VIEW);
 | 
|---|
| 1749 |       SetConditionalCascade(CollectorFileMenu, IDM_EDITSUBMENU, IDM_EDIT);
 | 
|---|
| 1750 |       SetConditionalCascade(CollectorFileMenu, IDM_DELETESUBMENU,
 | 
|---|
| 1751 |                             fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
 | 
|---|
| 1752 |       SetConditionalCascade(CollectorFileMenu, IDM_OPENSUBMENU,
 | 
|---|
| 1753 |                             IDM_OPENDEFAULT);
 | 
|---|
| 1754 |       SetConditionalCascade(CollectorFileMenu, IDM_OBJECTSUBMENU, IDM_SHADOW);
 | 
|---|
| 1755 |       if (fWorkPlace) {
 | 
|---|
| 1756 |         WinSendMsg(CollectorFileMenu, MM_DELETEITEM,
 | 
|---|
| 1757 |                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
 | 
|---|
| 1758 |         WinSendMsg(CollectorFileMenu, MM_DELETEITEM,
 | 
|---|
| 1759 |                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
 | 
|---|
| 1760 |       }
 | 
|---|
| 1761 |     }
 | 
|---|
| 1762 |     else if (hwndMenu == &CollectorDirMenu) {
 | 
|---|
| 1763 |       WinSetWindowUShort(CollectorDirMenu, QWS_ID, IDM_FILESMENU);
 | 
|---|
| 1764 |       SetConditionalCascade(CollectorDirMenu, IDM_COMMANDSMENU,
 | 
|---|
| 1765 |                             IDM_DOITYOURSELF);
 | 
|---|
| 1766 |       SetConditionalCascade(CollectorDirMenu, IDM_COPYMENU, IDM_COPY);
 | 
|---|
| 1767 |       SetConditionalCascade(CollectorDirMenu, IDM_MOVEMENU, IDM_MOVE);
 | 
|---|
| 1768 |       SetConditionalCascade(CollectorDirMenu, IDM_SAVESUBMENU,
 | 
|---|
| 1769 |                             IDM_SAVETOCLIP);
 | 
|---|
| 1770 |       SetConditionalCascade(CollectorDirMenu, IDM_VIEWSUBMENU, IDM_INFO);
 | 
|---|
| 1771 |       SetConditionalCascade(CollectorDirMenu, IDM_EDITSUBMENU, IDM_ATTRS);
 | 
|---|
| 1772 |       SetConditionalCascade(CollectorDirMenu, IDM_DELETESUBMENU,
 | 
|---|
| 1773 |                             fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
 | 
|---|
| 1774 |       SetConditionalCascade(CollectorDirMenu, IDM_MISCSUBMENU, IDM_SIZES);
 | 
|---|
| 1775 |       SetConditionalCascade(CollectorDirMenu, IDM_OPENSUBMENU,
 | 
|---|
| 1776 |                             IDM_OPENWINDOW);
 | 
|---|
| 1777 |       if (fWorkPlace) {
 | 
|---|
| 1778 |         WinSendMsg(CollectorDirMenu, MM_DELETEITEM,
 | 
|---|
| 1779 |                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
 | 
|---|
| 1780 |         WinSendMsg(CollectorDirMenu, MM_DELETEITEM,
 | 
|---|
| 1781 |                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
 | 
|---|
| 1782 |       }
 | 
|---|
| 1783 |     }
 | 
|---|
| 1784 |     else if (hwndMenu == &MainPopupMenu) {
 | 
|---|
| 1785 |       WinSetWindowUShort(MainPopupMenu, QWS_ID, IDM_MAINPOPUP);
 | 
|---|
| 1786 |       SetConditionalCascade(MainPopupMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
 | 
|---|
| 1787 |       SetConditionalCascade(MainPopupMenu, IDM_AUTOVIEWSUBMENU, IDM_AUTOVIEW);
 | 
|---|
| 1788 |     }
 | 
|---|
| 1789 |   }
 | 
|---|
| 1790 |   CopyPresParams(*hwndMenu, hwnd);
 | 
|---|
| 1791 |   return *hwndMenu;
 | 
|---|
| 1792 | }
 | 
|---|
| 1793 | 
 | 
|---|
| 1794 | SHORT AddToListboxBottom(HWND hwnd, CHAR * str)
 | 
|---|
| 1795 | {
 | 
|---|
| 1796 |   SHORT ln;
 | 
|---|
| 1797 | 
 | 
|---|
| 1798 |   ln = (SHORT) WinSendMsg(hwnd, LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0),
 | 
|---|
| 1799 |                           MPFROMP(str));
 | 
|---|
| 1800 |   if (ln)
 | 
|---|
| 1801 |     WinSendMsg(hwnd, LM_SELECTITEM, MPFROM2SHORT(ln, 0), MPVOID);
 | 
|---|
| 1802 |   return ln;
 | 
|---|
| 1803 | }
 | 
|---|
| 1804 | 
 | 
|---|
| 1805 | VOID SetSysMenu(HWND hwndSysMenu)
 | 
|---|
| 1806 | {
 | 
|---|
| 1807 |   CHAR s[128], *p;
 | 
|---|
| 1808 | 
 | 
|---|
| 1809 |   if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
 | 
|---|
| 1810 |                  MPFROM2SHORT(SC_RESTORE, 128), MPFROMP(s))) {
 | 
|---|
| 1811 |     p = strchr(s, '\t');
 | 
|---|
| 1812 |     if (p) {
 | 
|---|
| 1813 |       p++;
 | 
|---|
| 1814 |       strcpy(p, "Ctrl+Alt+F5");
 | 
|---|
| 1815 |       WinSetMenuItemText(hwndSysMenu, SC_RESTORE, s);
 | 
|---|
| 1816 |     }
 | 
|---|
| 1817 |   }
 | 
|---|
| 1818 |   if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
 | 
|---|
| 1819 |                  MPFROM2SHORT(SC_CLOSE, 128), MPFROMP(s))) {
 | 
|---|
| 1820 |     p = strchr(s, '\t');
 | 
|---|
| 1821 |     if (p) {
 | 
|---|
| 1822 |       p++;
 | 
|---|
| 1823 |       strcpy(p, "Ctrl+Alt+F4");
 | 
|---|
| 1824 |       WinSetMenuItemText(hwndSysMenu, SC_CLOSE, s);
 | 
|---|
| 1825 |     }
 | 
|---|
| 1826 |   }
 | 
|---|
| 1827 |   if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
 | 
|---|
| 1828 |                  MPFROM2SHORT(SC_MOVE, 128), MPFROMP(s))) {
 | 
|---|
| 1829 |     p = strchr(s, '\t');
 | 
|---|
| 1830 |     if (p) {
 | 
|---|
| 1831 |       p++;
 | 
|---|
| 1832 |       strcpy(p, "Ctrl+Alt+F7");
 | 
|---|
| 1833 |       WinSetMenuItemText(hwndSysMenu, SC_MOVE, s);
 | 
|---|
| 1834 |     }
 | 
|---|
| 1835 |   }
 | 
|---|
| 1836 |   if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
 | 
|---|
| 1837 |                  MPFROM2SHORT(SC_SIZE, 128), MPFROMP(s))) {
 | 
|---|
| 1838 |     p = strchr(s, '\t');
 | 
|---|
| 1839 |     if (p) {
 | 
|---|
| 1840 |       p++;
 | 
|---|
| 1841 |       strcpy(p, "Ctrl+Alt+F8");
 | 
|---|
| 1842 |       WinSetMenuItemText(hwndSysMenu, SC_SIZE, s);
 | 
|---|
| 1843 |     }
 | 
|---|
| 1844 |   }
 | 
|---|
| 1845 |   if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
 | 
|---|
| 1846 |                  MPFROM2SHORT(SC_MINIMIZE, 128), MPFROMP(s))) {
 | 
|---|
| 1847 |     p = strchr(s, '\t');
 | 
|---|
| 1848 |     if (p) {
 | 
|---|
| 1849 |       p++;
 | 
|---|
| 1850 |       strcpy(p, "Ctrl+Alt+F9");
 | 
|---|
| 1851 |       WinSetMenuItemText(hwndSysMenu, SC_MINIMIZE, s);
 | 
|---|
| 1852 |     }
 | 
|---|
| 1853 |   }
 | 
|---|
| 1854 |   if (WinSendMsg(hwndSysMenu,
 | 
|---|
| 1855 |                  MM_QUERYITEMTEXT,
 | 
|---|
| 1856 |                  MPFROM2SHORT(SC_MAXIMIZE, 128), MPFROMP(s))) {
 | 
|---|
| 1857 |     p = strchr(s, '\t');
 | 
|---|
| 1858 |     if (p) {
 | 
|---|
| 1859 |       p++;
 | 
|---|
| 1860 |       strcpy(p, "Ctrl+Alt+F10");
 | 
|---|
| 1861 |       WinSetMenuItemText(hwndSysMenu, SC_MAXIMIZE, s);
 | 
|---|
| 1862 |     }
 | 
|---|
| 1863 |   }
 | 
|---|
| 1864 |   if (WinSendMsg(hwndSysMenu,
 | 
|---|
| 1865 |                  MM_QUERYITEMTEXT, MPFROM2SHORT(SC_HIDE, 128), MPFROMP(s))) {
 | 
|---|
| 1866 |     p = strchr(s, '\t');
 | 
|---|
| 1867 |     if (p) {
 | 
|---|
| 1868 |       p++;
 | 
|---|
| 1869 |       strcpy(p, "Ctrl+Alt+F11");
 | 
|---|
| 1870 |       WinSetMenuItemText(hwndSysMenu, SC_HIDE, s);
 | 
|---|
| 1871 |     }
 | 
|---|
| 1872 |   }
 | 
|---|
| 1873 | }
 | 
|---|
| 1874 | 
 | 
|---|
| 1875 | VOID LoadLibPath(CHAR * str, LONG len)
 | 
|---|
| 1876 | {
 | 
|---|
| 1877 |   ULONG ver[2];
 | 
|---|
| 1878 |   CHAR configsys[] = "C:\\CONFIG.SYS";
 | 
|---|
| 1879 |   static CHAR var[8192], beg[16384], end[16384];
 | 
|---|
| 1880 |   BOOL warp;
 | 
|---|
| 1881 |   FILE *fp;
 | 
|---|
| 1882 |   PFN DQELIBPATH = NULL;
 | 
|---|
| 1883 |   HMODULE hmod;
 | 
|---|
| 1884 | 
 | 
|---|
| 1885 |   if (str && len) {
 | 
|---|
| 1886 |     *str = 0;
 | 
|---|
| 1887 |     if (DosQuerySysInfo(QSV_BOOT_DRIVE,
 | 
|---|
| 1888 |                         QSV_BOOT_DRIVE, (PVOID) ver, (ULONG) sizeof(ULONG)))
 | 
|---|
| 1889 |       ver[0] = 3L;
 | 
|---|
| 1890 |     *configsys = (CHAR) ver[0] + '@';
 | 
|---|
| 1891 |     if (!DosQuerySysInfo(QSV_VERSION_MAJOR,
 | 
|---|
| 1892 |                          QSV_VERSION_MINOR,
 | 
|---|
| 1893 |                          (PVOID) ver, (ULONG) sizeof(ver)) && ver[1] >= 30)
 | 
|---|
| 1894 |       warp = TRUE;
 | 
|---|
| 1895 |     *var = *beg = *end = 0;
 | 
|---|
| 1896 |     if (warp) {
 | 
|---|
| 1897 |       if (!DosLoadModule(var, sizeof(var), "DOSCALL1.DLL", &hmod)) {
 | 
|---|
| 1898 |         if (!DosQueryProcAddr(hmod,
 | 
|---|
| 1899 |                               ORD_DOS32QUERYEXTLIBPATH,
 | 
|---|
| 1900 |                               NULL, (PFN *) & DQELIBPATH)) {
 | 
|---|
| 1901 |           DQELIBPATH(beg, BEGIN_LIBPATH);
 | 
|---|
| 1902 |           DQELIBPATH(end, END_LIBPATH);
 | 
|---|
| 1903 |         }
 | 
|---|
| 1904 |         DosFreeModule(hmod);
 | 
|---|
| 1905 |       }
 | 
|---|
| 1906 |       *var = 0;
 | 
|---|
| 1907 |     }
 | 
|---|
| 1908 |     fp = xfopen(configsys, "r", pszSrcFile, __LINE__);
 | 
|---|
| 1909 |     if (fp) {
 | 
|---|
| 1910 |       while (!feof(fp)) {
 | 
|---|
| 1911 |         if (!xfgets_bstripcr(var, sizeof(var), fp, pszSrcFile, __LINE__))
 | 
|---|
| 1912 |           break;
 | 
|---|
| 1913 |         if (!strnicmp(var, "LIBPATH=", 8)) {
 | 
|---|
| 1914 |           memmove(var, var + 8, strlen(var + 8) + 1);
 | 
|---|
| 1915 |           lstrip(var);
 | 
|---|
| 1916 |           break;
 | 
|---|
| 1917 |         }
 | 
|---|
| 1918 |       }
 | 
|---|
| 1919 |       fclose(fp);
 | 
|---|
| 1920 |     }
 | 
|---|
| 1921 |     strncpy(str, beg, len);
 | 
|---|
| 1922 |     strncat(str, var, len - strlen(str));
 | 
|---|
| 1923 |     strncat(str, end, len - strlen(str));
 | 
|---|
| 1924 |     str[len - 1] = 0;
 | 
|---|
| 1925 |   }
 | 
|---|
| 1926 | }
 | 
|---|
| 1927 | 
 | 
|---|
| 1928 | void SetViewMenu(HWND hwndMenu, ULONG flWindowAttr)
 | 
|---|
| 1929 | {
 | 
|---|
| 1930 |   WinCheckMenuItem(hwndMenu, IDM_MINIICONS, ((flWindowAttr & CV_MINI)));
 | 
|---|
| 1931 |   WinCheckMenuItem(hwndMenu, IDM_TEXT, ((flWindowAttr & CV_TEXT)));
 | 
|---|
| 1932 |   WinCheckMenuItem(hwndMenu, IDM_ICON, ((flWindowAttr & CV_ICON) &&
 | 
|---|
| 1933 |                                         !(flWindowAttr & CV_TREE)));
 | 
|---|
| 1934 |   WinCheckMenuItem(hwndMenu, IDM_TREEVIEW, ((flWindowAttr & CV_TREE)));
 | 
|---|
| 1935 |   WinCheckMenuItem(hwndMenu, IDM_DETAILS, ((flWindowAttr & CV_DETAIL)));
 | 
|---|
| 1936 |   WinCheckMenuItem(hwndMenu, IDM_NAME, ((flWindowAttr & CV_NAME)));
 | 
|---|
| 1937 | }
 | 
|---|
| 1938 | 
 | 
|---|
| 1939 | void SaySort(HWND hwnd, INT sortflags, BOOL archive)
 | 
|---|
| 1940 | {
 | 
|---|
| 1941 |   char *s = NULL;
 | 
|---|
| 1942 | 
 | 
|---|
| 1943 |   s = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__);
 | 
|---|
| 1944 |   if (s) {
 | 
|---|
| 1945 |     sprintf(s, "S:%s%s",
 | 
|---|
| 1946 |             sortflags & SORT_REVERSE ? "^" : NullStr,
 | 
|---|
| 1947 |             (sortflags & SORT_FIRSTEXTENSION) ?
 | 
|---|
| 1948 |               GetPString(IDS_FIRSTX) : (sortflags & SORT_LASTEXTENSION) ?
 | 
|---|
| 1949 |                 GetPString(IDS_LASTX) : (sortflags & SORT_SIZE) ?
 | 
|---|
| 1950 |                   "Size" : (sortflags & SORT_EASIZE) ?
 | 
|---|
| 1951 |                     (archive == 0) ?
 | 
|---|
| 1952 |                       GetPString(IDS_EASIZE) : GetPString(IDS_CSIZE) :
 | 
|---|
| 1953 |                     (sortflags & SORT_LWDATE) ?
 | 
|---|
| 1954 |                       (archive == 0) ?
 | 
|---|
| 1955 |                         GetPString(IDS_LWDATE) : GetPString(IDS_DATE) :
 | 
|---|
| 1956 |                         (sortflags & SORT_LADATE) ?
 | 
|---|
| 1957 |                           GetPString(IDS_LADATE) : (sortflags & SORT_CRDATE) ?
 | 
|---|
| 1958 |                             GetPString(IDS_CRDATE) :
 | 
|---|
| 1959 |                             (sortflags & SORT_PATHNAME) ?
 | 
|---|
| 1960 |                               GetPString(IDS_PATH) : (sortflags & SORT_NOSORT) ?
 | 
|---|
| 1961 |                                 GetPString(IDS_NONE) : (sortflags & SORT_SUBJECT) ?
 | 
|---|
| 1962 |                                   GetPString(IDS_SUBJ) : GetPString(IDS_NAME));
 | 
|---|
| 1963 |     WinSetWindowText(hwnd, s);
 | 
|---|
| 1964 |     free(s);
 | 
|---|
| 1965 |   }
 | 
|---|
| 1966 | }
 | 
|---|
| 1967 | 
 | 
|---|
| 1968 | void SayView(HWND hwnd, ULONG flWindowAttr)
 | 
|---|
| 1969 | {
 | 
|---|
| 1970 |   char *s = NULL;
 | 
|---|
| 1971 | 
 | 
|---|
| 1972 |   s = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__);
 | 
|---|
| 1973 |   if (s) {
 | 
|---|
| 1974 |     sprintf(s, "V:%s%s",
 | 
|---|
| 1975 |             (flWindowAttr & CV_TREE) ? GetPString(IDS_TREE) :
 | 
|---|
| 1976 |             (flWindowAttr & CV_NAME) ? GetPString(IDS_NAME) :
 | 
|---|
| 1977 |             (flWindowAttr & CV_DETAIL) ? GetPString(IDS_DETAIL) :
 | 
|---|
| 1978 |             (flWindowAttr & CV_TEXT) ? GetPString(IDS_TEXT) :
 | 
|---|
| 1979 |             GetPString(IDS_ICON),
 | 
|---|
| 1980 |             ((flWindowAttr & CV_MINI) &&
 | 
|---|
| 1981 |              !(flWindowAttr & CV_TEXT)) ? GetPString(IDS_MINI) : NullStr);
 | 
|---|
| 1982 |     WinSetWindowText(hwnd, s);
 | 
|---|
| 1983 |     free(s);
 | 
|---|
| 1984 |   }
 | 
|---|
| 1985 | }
 | 
|---|
| 1986 | 
 | 
|---|
| 1987 | void SayFilter(HWND hwnd, MASK * mask, BOOL archive)
 | 
|---|
| 1988 | {
 | 
|---|
| 1989 |   char *s = NULL;
 | 
|---|
| 1990 | 
 | 
|---|
| 1991 |   s = xmalloc(CCHMAXPATH * 2, pszSrcFile, __LINE__);
 | 
|---|
| 1992 |   if (s) {
 | 
|---|
| 1993 |     sprintf(s, "F:%s%s",
 | 
|---|
| 1994 |             mask->szMask,
 | 
|---|
| 1995 |             (!archive && (mask->attrFile != ALLATTRS ||
 | 
|---|
| 1996 |                           mask->antiattr != 0)) ? " " : NullStr,
 | 
|---|
| 1997 |             (!archive && (mask->attrFile != ALLATTRS ||
 | 
|---|
| 1998 |                           mask->antiattr !=
 | 
|---|
| 1999 |                           0)) ? GetPString(IDS_ATTRTEXT) : NullStr);
 | 
|---|
| 2000 |     if (!s[2])
 | 
|---|
| 2001 |       sprintf(s, "F:%s", GetPString(IDS_ALLTEXT));
 | 
|---|
| 2002 |     WinSetWindowText(hwnd, s);
 | 
|---|
| 2003 |     free(s);
 | 
|---|
| 2004 |   }
 | 
|---|
| 2005 | }
 | 
|---|
| 2006 | 
 | 
|---|
| 2007 | char *GetCmdSpec(BOOL dos)
 | 
|---|
| 2008 | {
 | 
|---|
| 2009 |   char *cmspec;
 | 
|---|
| 2010 | 
 | 
|---|
| 2011 |   if (!dos) {
 | 
|---|
| 2012 |     cmspec = getenv("OS2_SHELL");
 | 
|---|
| 2013 |     if (!cmspec)
 | 
|---|
| 2014 |       cmspec = getenv("COMSPEC");
 | 
|---|
| 2015 |     if (!cmspec)
 | 
|---|
| 2016 |       cmspec = "CMD.EXE";
 | 
|---|
| 2017 |   }
 | 
|---|
| 2018 |   else {
 | 
|---|
| 2019 |     cmspec = getenv("DOS_SHELL");
 | 
|---|
| 2020 |     if (!cmspec)
 | 
|---|
| 2021 |       cmspec = "COMMAND.COM";
 | 
|---|
| 2022 |   }
 | 
|---|
| 2023 |   return cmspec;
 | 
|---|
| 2024 | }
 | 
|---|
| 2025 | 
 | 
|---|
| 2026 | void Broadcast(HAB hab, HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| 2027 | {
 | 
|---|
| 2028 |   if (hwndMain)
 | 
|---|
| 2029 |     WinBroadcastMsg(hwndMain, msg, mp1, mp2, BMSG_SEND | BMSG_FRAMEONLY);
 | 
|---|
| 2030 |   if (hwnd &&
 | 
|---|
| 2031 |       hwnd != HWND_DESKTOP &&
 | 
|---|
| 2032 |       hwnd != hwndMain &&
 | 
|---|
| 2033 |       hwnd != WinQueryDesktopWindow(hab, NULLHANDLE) &&
 | 
|---|
| 2034 |       WinIsWindow(hab, hwnd) && (!hwndMain || !WinIsChild(hwnd, hwndMain)))
 | 
|---|
| 2035 |     WinSendMsg(hwnd, msg, mp1, mp2);
 | 
|---|
| 2036 | }
 | 
|---|
| 2037 | 
 | 
|---|
| 2038 | void SetupWinList(HWND hwndMenu, HWND hwndTop, HWND hwndFrame)
 | 
|---|
| 2039 | {
 | 
|---|
| 2040 |   /*
 | 
|---|
| 2041 |    * add switchlist entries to end of pulldown menu
 | 
|---|
| 2042 |    */
 | 
|---|
| 2043 | 
 | 
|---|
| 2044 |   SHORT sItemCount, x = 0, y = 0;
 | 
|---|
| 2045 |   MENUITEM mi;
 | 
|---|
| 2046 | 
 | 
|---|
| 2047 |   sItemCount = (SHORT) WinSendMsg(hwndMenu,
 | 
|---|
| 2048 |                                   MM_QUERYITEMCOUNT, MPVOID, MPVOID);
 | 
|---|
| 2049 | 
 | 
|---|
| 2050 |   /* clean out old additions */
 | 
|---|
| 2051 |   while ((SHORT) WinSendMsg(hwndMenu,
 | 
|---|
| 2052 |                             MM_DELETEITEM,
 | 
|---|
| 2053 |                             MPFROM2SHORT(IDM_SWITCHSTART + x++,
 | 
|---|
| 2054 |                                          TRUE), MPVOID) < sItemCount)
 | 
|---|
| 2055 |     sItemCount--;
 | 
|---|
| 2056 |   x = 0;
 | 
|---|
| 2057 |   while ((SHORT) WinSendMsg(hwndMenu,
 | 
|---|
| 2058 |                             MM_DELETEITEM,
 | 
|---|
| 2059 |                             MPFROM2SHORT(IDM_WINDOWSTART + x++,
 | 
|---|
| 2060 |                                          TRUE), MPVOID) < sItemCount)
 | 
|---|
| 2061 |     sItemCount--;
 | 
|---|
| 2062 | 
 | 
|---|
| 2063 |   x = 0;
 | 
|---|
| 2064 |   if (hwndTop) {
 | 
|---|
| 2065 | 
 | 
|---|
| 2066 |     char wtext[CCHMAXPATH + 8];
 | 
|---|
| 2067 |     HENUM henum;
 | 
|---|
| 2068 |     HWND hwndChild;
 | 
|---|
| 2069 | 
 | 
|---|
| 2070 |     /* add children of the main FM/2 client */
 | 
|---|
| 2071 |     henum = WinBeginEnumWindows(hwndTop);
 | 
|---|
| 2072 |     memset(&mi, 0, sizeof(mi));
 | 
|---|
| 2073 |     while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
 | 
|---|
| 2074 |       if (WinQueryWindowUShort(hwndChild, QWS_ID) && hwndChild != hwndFrame) {
 | 
|---|
| 2075 |         *wtext = 0;
 | 
|---|
| 2076 |         WinQueryWindowText(hwndChild, CCHMAXPATH + 8, wtext);
 | 
|---|
| 2077 |         if (*wtext) {
 | 
|---|
| 2078 |           wtext[CCHMAXPATH + 7] = 0;
 | 
|---|
| 2079 |           mi.afStyle = MIS_TEXT;
 | 
|---|
| 2080 |           if (!((x + sItemCount) % 28))
 | 
|---|
| 2081 |             mi.afStyle |= MIS_BREAK;
 | 
|---|
| 2082 |           mi.id = IDM_WINDOWSTART + x;
 | 
|---|
| 2083 |           mi.iPosition = MIT_END;
 | 
|---|
| 2084 |           if ((SHORT) WinSendMsg(hwndMenu,
 | 
|---|
| 2085 |                                  MM_INSERTITEM,
 | 
|---|
| 2086 |                                  MPFROMP(&mi), MPFROMP(wtext)) >= 0)
 | 
|---|
| 2087 |             x++;
 | 
|---|
| 2088 |         }
 | 
|---|
| 2089 |       }
 | 
|---|
| 2090 |     }
 | 
|---|
| 2091 |     WinEndEnumWindows(henum);
 | 
|---|
| 2092 |   }
 | 
|---|
| 2093 | 
 | 
|---|
| 2094 |   /* add external FM/2 windows */
 | 
|---|
| 2095 |   {
 | 
|---|
| 2096 |     PSWBLOCK pswb;
 | 
|---|
| 2097 |     ULONG ulSize, ulcEntries;
 | 
|---|
| 2098 |     HWND hwndTopFrame;
 | 
|---|
| 2099 |     register INT i;
 | 
|---|
| 2100 | 
 | 
|---|
| 2101 |     hwndTopFrame = hwndTop ? WinQueryWindow(hwndTop, QW_PARENT) : (HWND)0;
 | 
|---|
| 2102 |     /* Get the switch list information */
 | 
|---|
| 2103 |     x = 0;
 | 
|---|
| 2104 |     ulcEntries = WinQuerySwitchList(0, NULL, 0);
 | 
|---|
| 2105 |     ulSize = sizeof(SWBLOCK) + sizeof(HSWITCH) + (ulcEntries + 4L) *
 | 
|---|
| 2106 |       (LONG) sizeof(SWENTRY);
 | 
|---|
| 2107 |     /* Allocate memory for list */
 | 
|---|
| 2108 |     pswb = xmalloc(ulSize, pszSrcFile, __LINE__);
 | 
|---|
| 2109 |     if (pswb) {
 | 
|---|
| 2110 |       /* Put the info in the list */
 | 
|---|
| 2111 |       ulcEntries = WinQuerySwitchList(0, pswb, ulSize - sizeof(SWENTRY));
 | 
|---|
| 2112 |       /* do the dirty deed */
 | 
|---|
| 2113 |       memset(&mi, 0, sizeof(mi));
 | 
|---|
| 2114 |       for (i = 0; i < pswb->cswentry; i++) {
 | 
|---|
| 2115 |         if (pswb->aswentry[i].swctl.uchVisibility == SWL_VISIBLE &&
 | 
|---|
| 2116 |             pswb->aswentry[i].swctl.fbJump == SWL_JUMPABLE &&
 | 
|---|
| 2117 |             (pswb->aswentry[i].swctl.idProcess != mypid ||
 | 
|---|
| 2118 |              !hwndFrame ||
 | 
|---|
| 2119 |              pswb->aswentry[i].swctl.hwnd != hwndFrame) &&
 | 
|---|
| 2120 |             (pswb->aswentry[i].swctl.idProcess != mypid ||
 | 
|---|
| 2121 |              !hwndTopFrame ||
 | 
|---|
| 2122 |              pswb->aswentry[i].swctl.hwnd != hwndTopFrame ||
 | 
|---|
| 2123 |              !WinIsChild(hwndFrame, hwndTop))) {
 | 
|---|
| 2124 |           if (!strnicmp(pswb->aswentry[i].swctl.szSwtitle, "AV/2", 4)
 | 
|---|
| 2125 |               || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "File Manager/2")
 | 
|---|
| 2126 |               || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "Collector")
 | 
|---|
| 2127 |               || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VTree", 5)
 | 
|---|
| 2128 |               || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VDir", 4)
 | 
|---|
| 2129 |               || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, FM2Str, 4)) {
 | 
|---|
| 2130 |             mi.afStyle = MIS_TEXT;
 | 
|---|
| 2131 |             if (x && !(x % 28))
 | 
|---|
| 2132 |               mi.afStyle |= MIS_BREAK;
 | 
|---|
| 2133 |             mi.id = IDM_SWITCHSTART + y;
 | 
|---|
| 2134 |             mi.iPosition = MIT_END;
 | 
|---|
| 2135 |             switches[y] = pswb->aswentry[i].hswitch;
 | 
|---|
| 2136 |             if ((SHORT) WinSendMsg(hwndMenu,
 | 
|---|
| 2137 |                                    MM_INSERTITEM,
 | 
|---|
| 2138 |                                    MPFROMP(&mi),
 | 
|---|
| 2139 |                                    MPFROMP(pswb->aswentry[i].
 | 
|---|
| 2140 |                                            swctl.szSwtitle)) >= 0) {
 | 
|---|
| 2141 |               y++;
 | 
|---|
| 2142 |               x++;
 | 
|---|
| 2143 |             }
 | 
|---|
| 2144 |           }
 | 
|---|
| 2145 |         }
 | 
|---|
| 2146 |       }
 | 
|---|
| 2147 |       numswitches = y;
 | 
|---|
| 2148 |       free(pswb);
 | 
|---|
| 2149 |       DosPostEventSem(CompactSem);
 | 
|---|
| 2150 |     }
 | 
|---|
| 2151 |   }
 | 
|---|
| 2152 | }
 | 
|---|
| 2153 | 
 | 
|---|
| 2154 | BOOL SwitchCommand(HWND hwndMenu, USHORT cmd)
 | 
|---|
| 2155 | {
 | 
|---|
| 2156 |   BOOL ret = FALSE;
 | 
|---|
| 2157 | 
 | 
|---|
| 2158 |   if (hwndMain && hwndMenu && cmd >= IDM_WINDOWSTART && cmd < IDM_SWITCHSTART) {
 | 
|---|
| 2159 |     /*
 | 
|---|
| 2160 |      * select a child window (of client)
 | 
|---|
| 2161 |      */
 | 
|---|
| 2162 | 
 | 
|---|
| 2163 |     MENUITEM mi;
 | 
|---|
| 2164 |     HWND hwndSubMenu = (HWND) 0, hwndChild;
 | 
|---|
| 2165 |     CHAR s[CCHMAXPATH + 8];
 | 
|---|
| 2166 | 
 | 
|---|
| 2167 |     if (WinQueryWindowUShort(hwndMenu, QWS_ID) != IDM_WINDOWSMENU) {
 | 
|---|
| 2168 |       memset(&mi, 0, sizeof(mi));
 | 
|---|
| 2169 |       mi.iPosition = MIT_END;
 | 
|---|
| 2170 |       mi.afStyle = MIS_TEXT;
 | 
|---|
| 2171 |       if (WinSendMsg(hwndMenu,
 | 
|---|
| 2172 |                      MM_QUERYITEM,
 | 
|---|
| 2173 |                      MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))
 | 
|---|
| 2174 |         hwndSubMenu = mi.hwndSubMenu;
 | 
|---|
| 2175 |     }
 | 
|---|
| 2176 |     else
 | 
|---|
| 2177 |       hwndSubMenu = hwndMenu;
 | 
|---|
| 2178 |     if (hwndSubMenu) {
 | 
|---|
| 2179 |       *s = 0;
 | 
|---|
| 2180 |       if (WinSendMsg(hwndSubMenu,
 | 
|---|
| 2181 |                      MM_QUERYITEMTEXT,
 | 
|---|
| 2182 |                      MPFROM2SHORT(cmd, CCHMAXPATH + 8), MPFROMP(s)) && *s) {
 | 
|---|
| 2183 | 
 | 
|---|
| 2184 |         HENUM henum;
 | 
|---|
| 2185 |         CHAR checkText[CCHMAXPATH + 8];
 | 
|---|
| 2186 |         SWP swp;
 | 
|---|
| 2187 | 
 | 
|---|
| 2188 |         s[CCHMAXPATH + 7] = 0;
 | 
|---|
| 2189 |         henum = WinBeginEnumWindows(hwndMain);
 | 
|---|
| 2190 |         while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
 | 
|---|
| 2191 |           if (WinQueryWindowUShort(hwndChild, QWS_ID)) {
 | 
|---|
| 2192 |             *checkText = 0;
 | 
|---|
| 2193 |             WinQueryWindowText(hwndChild, CCHMAXPATH + 8, checkText);
 | 
|---|
| 2194 |             checkText[CCHMAXPATH + 7] = 0;
 | 
|---|
| 2195 |             if (!stricmp(checkText, s)) {
 | 
|---|
| 2196 |               if (WinQueryWindowPos(hwndChild, &swp)) {
 | 
|---|
| 2197 |                 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE))
 | 
|---|
| 2198 |                   WinSetWindowPos(hwndChild,
 | 
|---|
| 2199 |                                   HWND_TOP,
 | 
|---|
| 2200 |                                   0, 0, 0, 0, SWP_RESTORE | SWP_ZORDER);
 | 
|---|
| 2201 |               }
 | 
|---|
| 2202 |               WinSetActiveWindow(HWND_DESKTOP, hwndChild);
 | 
|---|
| 2203 |               ret = TRUE;
 | 
|---|
| 2204 |               break;
 | 
|---|
| 2205 |             }
 | 
|---|
| 2206 |           }
 | 
|---|
| 2207 |         }
 | 
|---|
| 2208 |         WinEndEnumWindows(henum);
 | 
|---|
| 2209 |       }
 | 
|---|
| 2210 |     }
 | 
|---|
| 2211 |   }
 | 
|---|
| 2212 |   else if (cmd >= IDM_SWITCHSTART && cmd < IDM_SWITCHSTART + 499) {
 | 
|---|
| 2213 |     if (cmd - IDM_SWITCHSTART < numswitches) {
 | 
|---|
| 2214 |       WinSwitchToProgram(switches[cmd - IDM_SWITCHSTART]);
 | 
|---|
| 2215 |       ret = TRUE;
 | 
|---|
| 2216 |     }
 | 
|---|
| 2217 |   }
 | 
|---|
| 2218 | 
 | 
|---|
| 2219 |   return ret;
 | 
|---|
| 2220 | }
 | 
|---|
| 2221 | 
 | 
|---|
| 2222 | /** CheckDriveSpaceAvail
 | 
|---|
| 2223 |  *  Take space needed and checks that drive has at least 1000 bits in excess of the required space.
 | 
|---|
| 2224 |  *  Returns 0 if sufficient space is available; 1 if the drive is full & 2 on abort of operation
 | 
|---|
| 2225 |  *  when the drive would have less than ullFreeSpaceWhenComplete remaining or has insufficient space.
 | 
|---|
| 2226 |  */
 | 
|---|
| 2227 | 
 | 
|---|
| 2228 | INT CheckDriveSpaceAvail(CHAR *pTargetPath, ULONGLONG ullSpaceNeeded,
 | 
|---|
| 2229 |                           ULONGLONG ullFreeSpaceWhenComplete)
 | 
|---|
| 2230 | {
 | 
|---|
| 2231 |   FSALLOCATE fsa;
 | 
|---|
| 2232 |   ULONGLONG  ullFreeQty;
 | 
|---|
| 2233 |   APIRET ret;
 | 
|---|
| 2234 | 
 | 
|---|
| 2235 |   DosQueryFSInfo(toupper(*pTargetPath) - 'A' + 1, FSIL_ALLOC, &fsa, sizeof(FSALLOCATE));
 | 
|---|
| 2236 |   ullFreeQty = (ULONGLONG) fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector);
 | 
|---|
| 2237 |   if (ullFreeQty > ullSpaceNeeded + ullFreeSpaceWhenComplete)
 | 
|---|
| 2238 |     return 0;
 | 
|---|
| 2239 |   else if (ullFreeQty < ullSpaceNeeded + 1024) {
 | 
|---|
| 2240 |     CHAR szKB[20];
 | 
|---|
| 2241 | 
 | 
|---|
| 2242 |     CommaFmtULL(szKB, sizeof(szKB),
 | 
|---|
| 2243 |                 ullFreeQty - ullSpaceNeeded, ' ');
 | 
|---|
| 2244 |     if (ullFreeSpaceWhenComplete == 0) {
 | 
|---|
| 2245 |       saymsg(MB_OK,
 | 
|---|
| 2246 |              HWND_DESKTOP,
 | 
|---|
| 2247 |              NullStr,
 | 
|---|
| 2248 |              GetPString(IDS_DRIVESPACELIMITEDTMPSAVE),
 | 
|---|
| 2249 |              pTargetPath);
 | 
|---|
| 2250 |       return 0;
 | 
|---|
| 2251 |     }
 | 
|---|
| 2252 |     else {
 | 
|---|
| 2253 |       if (ullFreeQty > ullSpaceNeeded) {
 | 
|---|
| 2254 |         ret = saymsg(MB_YESNO,
 | 
|---|
| 2255 |                      HWND_DESKTOP,
 | 
|---|
| 2256 |                      NullStr,
 | 
|---|
| 2257 |                      GetPString(IDS_DRIVESPACELIMITED),
 | 
|---|
| 2258 |                      pTargetPath,
 | 
|---|
| 2259 |                      szKB);
 | 
|---|
| 2260 |         if (ret == MBID_YES)
 | 
|---|
| 2261 |           return 0;
 | 
|---|
| 2262 |         else
 | 
|---|
| 2263 |           return 2;
 | 
|---|
| 2264 |       }
 | 
|---|
| 2265 |       else {
 | 
|---|
| 2266 |         saymsg(MB_OK,
 | 
|---|
| 2267 |                HWND_DESKTOP,
 | 
|---|
| 2268 |                NullStr,
 | 
|---|
| 2269 |                GetPString(IDS_DRIVESPACEEXCEEDED),
 | 
|---|
| 2270 |                pTargetPath);
 | 
|---|
| 2271 |         return 2;
 | 
|---|
| 2272 |       }
 | 
|---|
| 2273 |     }
 | 
|---|
| 2274 |   }
 | 
|---|
| 2275 |   else
 | 
|---|
| 2276 |     return 1;
 | 
|---|
| 2277 | }
 | 
|---|
| 2278 | 
 | 
|---|
| 2279 | #pragma alloc_text(MAINWND5,SetSysMenu)
 | 
|---|
| 2280 | #pragma alloc_text(MISC1,BoxWindow,PaintRecessedWindow,PostMsg,PaintSTextWindow,IsFm2Window)
 | 
|---|
| 2281 | #pragma alloc_text(MISC1,FixSwitchList,FindDirCnr,CurrentRecord,SetShiftState,AddToListboxBottom)
 | 
|---|
| 2282 | #pragma alloc_text(MISC1,CheckDriveSpaceAvail)
 | 
|---|
| 2283 | 
 | 
|---|
| 2284 | #ifdef FORTIFY
 | 
|---|
| 2285 | #pragma alloc_text(MISC1,GetTidForWindow)
 | 
|---|
| 2286 | #endif // FORTIFY
 | 
|---|
| 2287 | 
 | 
|---|
| 2288 | #pragma alloc_text(CNR_MISC1,AdjustCnrColVis,AdjustCnrColsForFSType)
 | 
|---|
| 2289 | #pragma alloc_text(CNR_MISC1,AdjustCnrColsForPref,SetCnrCols)
 | 
|---|
| 2290 | #pragma alloc_text(CNR_MISC2,CnrDirectEdit,OpenEdit)
 | 
|---|
| 2291 | #pragma alloc_text(MISC2,SetMenuCheck,disable_menuitem,SetSortChecks)
 | 
|---|
| 2292 | #pragma alloc_text(MISC2,SetDetailsSwitches,SetViewMenu)
 | 
|---|
| 2293 | #pragma alloc_text(MISC3,SetupCommandMenu,AdjustDetailsSwitches)
 | 
|---|
| 2294 | #pragma alloc_text(MISC3,ViewHelp,GetCmdSpec)
 | 
|---|
| 2295 | #pragma alloc_text(MISC3,ExecFile,SetConditionalCascade,LoadDetailsSwitches)
 | 
|---|
| 2296 | #pragma alloc_text(MISC4,PortholeInit,CheckMenu,Broadcast,SetupWinList,SwitchCommand)
 | 
|---|
| 2297 | #pragma alloc_text(MISC6,DrawTargetEmphasis,EmphasizeButton)
 | 
|---|
| 2298 | #pragma alloc_text(MISC_LIBPATH,LoadLibPath)
 | 
|---|
| 2299 | #pragma alloc_text(MISC_SAY,SayView,SaySort,SayFilter)
 | 
|---|
| 2300 | 
 | 
|---|