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