source: trunk/dll/misc.c@ 1639

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

Hard coded the flags for the xDosAlloc* wrappers and added a description for each of them.

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