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