source: trunk/dll/misc.c@ 1402

Last change on this file since 1402 was 1402, checked in by Gregg Young, 16 years ago

Remove variable aurgs from docopy & unlinkf (not used); Move more strings to PCSZs and string table; Move PCSZs to compile time initialization; Fix hang on startup caused by a drive scan and a dircnr scan trying to update a drive in the tree at the same time (related to the "treeswitch options); Code cleanup mainly removal of old printfs, SayMsgs, DbgMsg and unneeded %s.

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