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