source: trunk/dll/misc.c@ 1789

Last change on this file since 1789 was 1789, checked in by Gregg Young, 11 years ago

Use saymsg2 for Suggest dialog Ticket [538] Add an @ to the end of the filters window label to indicate an attribute filter is set.

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