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