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