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