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