source: trunk/dll/misc.c@ 1647

Last change on this file since 1647 was 1647, checked in by Gregg Young, 14 years ago

Fixed Help Viewer's falure to open help files from its dialog and fixed failure of files with spaces; Ticket 481. (The previous commit was for Ticket 480).

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