source: trunk/dll/misc.c@ 1488

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

Fixed commands so reordering them in commands.dat no longer changes their ID or hot key assignment; added 20 new hot keys; the environment information is now used when executing a command; some code clean up in command.c; added CheckExecutibleFlags to systemf.c the eliminate repetative code in assoc.c, command.c & cmdline.c

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