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