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