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