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