| 1 |  | 
|---|
| 2 | /*********************************************************************** | 
|---|
| 3 |  | 
|---|
| 4 | $Id: seeall.c 1741 2014-02-22 23:32:04Z gyoung $ | 
|---|
| 5 |  | 
|---|
| 6 | See all matching files | 
|---|
| 7 |  | 
|---|
| 8 | Copyright (c) 1993-98 M. Kimes | 
|---|
| 9 | Copyright (c) 2001, 2010 Steven H. Levine | 
|---|
| 10 |  | 
|---|
| 11 | 16 Oct 02 SHL Handle large partitions | 
|---|
| 12 | 25 Nov 03 SHL StartSeeAll: avoid forgetting startpath | 
|---|
| 13 | 06 Dec 03 SHL StartSeeAll: correct malloc arg oops | 
|---|
| 14 | 23 May 05 SHL Use QWL_USER | 
|---|
| 15 | 25 May 05 SHL Use ULONGLONG and CommaFmtULL | 
|---|
| 16 | 05 Jun 05 SHL Use QWL_USER | 
|---|
| 17 | 06 Jun 05 SHL Drop unused code | 
|---|
| 18 | 29 May 06 SHL Comments | 
|---|
| 19 | 17 Jul 06 SHL Use Runtime_Error | 
|---|
| 20 | 19 Oct 06 SHL Correct . and .. detect | 
|---|
| 21 | 03 Nov 06 SHL Renames | 
|---|
| 22 | 03 Nov 06 SHL Count thread usage | 
|---|
| 23 | 30 Mar 07 GKY Remove GetPString for window class names | 
|---|
| 24 | 03 Aug 07 GKY Enlarged and made setable everywhere Findbuf (speeds file loading) | 
|---|
| 25 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148) | 
|---|
| 26 | 07 Aug 07 SHL Use BldQuotedFullPathName and BldQuotedFileName | 
|---|
| 27 | 13 Aug 07 SHL Sync code with other FilesToGet usage | 
|---|
| 28 | 13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat | 
|---|
| 29 | 14 Aug 07 SHL Revert to DosSleep(0) to speed up inner loops | 
|---|
| 30 | 14 Aug 07 SHL Drop afFilesToGet | 
|---|
| 31 | 26 Aug 07 GKY DosSleep(1) in loops changed to (0) | 
|---|
| 32 | 27 Sep 07 SHL Correct ULONGLONG size formatting | 
|---|
| 33 | 30 Dec 07 GKY Use CommaFmtULL | 
|---|
| 34 | 30 Dec 07 GKY Use TestFDates for comparing by date | 
|---|
| 35 | 15 Feb 08 GKY Prevent trap on scan of drive containing files that exceed maxpath | 
|---|
| 36 | 29 Feb 08 GKY Use xfree where appropriate | 
|---|
| 37 | 29 Feb 08 GKY Refactor global command line variables to notebook.h | 
|---|
| 38 | 20 Jul 08 GKY Add save/append filename to clipboard. | 
|---|
| 39 | Change menu wording to make these easier to find | 
|---|
| 40 | 10 Dec 08 SHL Integrate exception handler support | 
|---|
| 41 | 25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis | 
|---|
| 42 | 11 Jan 09 GKY Replace font names in the string file with global set at compile in init.c | 
|---|
| 43 | 11 Jan 08 GKY Change flag on GetMLEFont to 3 from 11 to give a larger selection of mono spaced fonts | 
|---|
| 44 | 07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook. | 
|---|
| 45 | 07 Feb 09 GKY Add *DateFormat functions to format dates based on locale | 
|---|
| 46 | 07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error | 
|---|
| 47 | 08 Mar 09 GKY Renamed commafmt.h i18nutil.h | 
|---|
| 48 | 08 Mar 09 GKY Additional strings move to PCSZs in init.c | 
|---|
| 49 | 08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used) | 
|---|
| 50 | 28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code. | 
|---|
| 51 | 17 Jan 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *. | 
|---|
| 52 | 01 Dec 10 SHL Ensure FindAllThread thread quits fast when requested | 
|---|
| 53 | 04 Aug 12 GKY Changes to use Unlock to unlock files if Unlock.exe is in path both from menu/toolbar and as part of | 
|---|
| 54 | copy, move and delete operations | 
|---|
| 55 | 04 Aug 12 GKY Changes to allow copy and move over readonly files with a warning dialog; also added a warning dialog | 
|---|
| 56 | for delete of readonly files | 
|---|
| 57 | 10 Mar 13 GKY Improvrd readonly check on delete to allow cancel and don't ask again options | 
|---|
| 58 | Added saymsg2 for this purpose | 
|---|
| 59 | 09 Feb 14 GKY Modified wipeallf to allow suppression of the readonly warning on delete | 
|---|
| 60 | of temporary files | 
|---|
| 61 | 16 Feb 14 GKY Rework readonly check on delete code so it actually works in a logical way | 
|---|
| 62 | and so it works with move to trashcan inabled. | 
|---|
| 63 | 22 Feb 14 GKY Fix warn readonly yes don't ask to work when recursing directories. | 
|---|
| 64 |  | 
|---|
| 65 | ***********************************************************************/ | 
|---|
| 66 |  | 
|---|
| 67 | #include <stdlib.h> | 
|---|
| 68 | #include <string.h> | 
|---|
| 69 | #include <ctype.h> | 
|---|
| 70 | // #include <process.h> | 
|---|
| 71 |  | 
|---|
| 72 | #define INCL_DOS | 
|---|
| 73 | #define INCL_DOSERRORS | 
|---|
| 74 | #define INCL_WIN | 
|---|
| 75 | #define INCL_GPI | 
|---|
| 76 | #define INCL_LONGLONG | 
|---|
| 77 |  | 
|---|
| 78 | #include "fm3dll.h" | 
|---|
| 79 | #include "fm3dll2.h"                    // #define's for UM_*, control id's, etc. | 
|---|
| 80 | #include "seeall.h" | 
|---|
| 81 | #include "mainwnd2.h"                   // Data declaration(s) | 
|---|
| 82 | #include "grep.h"                       // Data declaration(s) | 
|---|
| 83 | #include "arccnrs.h"                    // Data declaration(s) | 
|---|
| 84 | #include "init.h"                       // Data declaration(s) | 
|---|
| 85 | #include "worker.h"                     // Data declaration(s) | 
|---|
| 86 | #include "newview.h"                    // Data declarations | 
|---|
| 87 | #include "fm3dlg.h" | 
|---|
| 88 | #include "fm3str.h" | 
|---|
| 89 | #include "pathutil.h"                   // BldQuotedFullPathName... | 
|---|
| 90 | #include "makelist.h"                   // AddToList | 
|---|
| 91 | #include "errutil.h"                    // Dos_Error... | 
|---|
| 92 | #include "strutil.h"                    // GetPString | 
|---|
| 93 | #include "notebook.h"                   // targetdirectory | 
|---|
| 94 | #include "copyf.h"                      // AdjustWildcardName, make_deleteable | 
|---|
| 95 | #include "attribs.h"                    // AttrListDlgProc | 
|---|
| 96 | #include "chklist.h"                    // CenterOverWindow, CheckListProc | 
|---|
| 97 | #include "colors.h"                     // ColorDlgProc | 
|---|
| 98 | #include "draglist.h"                   // DragList | 
|---|
| 99 | #include "extract.h"                    // ExtractDlgProc | 
|---|
| 100 | #include "info.h"                       // FileInfoProc | 
|---|
| 101 | #include "valid.h"                      // GetDesktopName, IsNewer, TestFDates | 
|---|
| 102 | #include "saveclip.h"                   // ListToClipboardHab, SaveAllListDlgProc | 
|---|
| 103 | #include "shadow.h"                     // MakeShadows | 
|---|
| 104 | #include "mkdir.h"                      // MassMkdir | 
|---|
| 105 | #include "objcnr.h"                     // ObjCnrDlgProc | 
|---|
| 106 | #include "codepage.h"                   // PickCodepage | 
|---|
| 107 | #include "printer.h"                    // PrintDlgProc, PrintListThread | 
|---|
| 108 | #include "rename.h"                     // RenameProc | 
|---|
| 109 | #include "uudecode.h"                   // UUD | 
|---|
| 110 | #include "walkem.h"                     // WalkCopyDlgProc, WalkMoveDlgProc | 
|---|
| 111 | #include "archive.h"                    // ArchiveDlgProc | 
|---|
| 112 | #include "common.h"                     // CommonTextProc, DecrThreadUsage, IncrThreadUsage | 
|---|
| 113 | #include "defview.h"                    // DefaultViewKeys | 
|---|
| 114 | #include "eas.h"                        // DisplayEAsProc | 
|---|
| 115 | #include "mainwnd.h"                    // GetNextWindowPos | 
|---|
| 116 | #include "filter.h"                     // PickMaskDlgProc | 
|---|
| 117 | #include "avl.h"                        // SBoxDlgProc | 
|---|
| 118 | #include "collect.h"                    // StartCollector | 
|---|
| 119 | #include "subj.h"                       // Subject | 
|---|
| 120 | #include "i18nutil.h"                   // commafmt | 
|---|
| 121 | #include "literal.h"                    // wildcard | 
|---|
| 122 | #include "wrappers.h"                   // xDosFindNext | 
|---|
| 123 | #include "misc.h"                       // SetConditionalCascade | 
|---|
| 124 | #include "fonts.h"                      // SetMLEFont | 
|---|
| 125 | #include "stristr.h"                    // stristr | 
|---|
| 126 | #include "systemf.h"                    // runemf2 | 
|---|
| 127 | #include "fortify.h" | 
|---|
| 128 | #include "excputil.h"                   // xbeginthread | 
|---|
| 129 |  | 
|---|
| 130 | #pragma data_seg(DATA2) | 
|---|
| 131 |  | 
|---|
| 132 | static PSZ pszSrcFile = __FILE__; | 
|---|
| 133 |  | 
|---|
| 134 | typedef struct | 
|---|
| 135 | { | 
|---|
| 136 | CHAR *fullname, *filename; | 
|---|
| 137 | USHORT attrFile, flags; | 
|---|
| 138 | FDATE date; | 
|---|
| 139 | FTIME time; | 
|---|
| 140 | ULONGLONG cbFile; | 
|---|
| 141 | ULONG CRC; | 
|---|
| 142 | } | 
|---|
| 143 | ALLFILES; | 
|---|
| 144 |  | 
|---|
| 145 | #define AF_SELECTED     0x0001 | 
|---|
| 146 | #define AF_DELETED      0x0002 | 
|---|
| 147 | #define AF_FILTERED     0x0004 | 
|---|
| 148 | #define AF_DUPE         0x0008 | 
|---|
| 149 | #define AF_CRCED        0x0010 | 
|---|
| 150 |  | 
|---|
| 151 | #define AFM_MARK        0 | 
|---|
| 152 | #define AFM_UNMARK      1 | 
|---|
| 153 | #define AFM_INVERT      2 | 
|---|
| 154 | #define AFM_MARKDELETED 3 | 
|---|
| 155 | #define AFM_FILTER      4 | 
|---|
| 156 |  | 
|---|
| 157 | #define DP_NAMES        0x0001 | 
|---|
| 158 | #define DP_DATES        0x0002 | 
|---|
| 159 | #define DP_SIZES        0x0004 | 
|---|
| 160 | #define DP_CRCS         0x0008 | 
|---|
| 161 | #define DP_EXTS         0x0010 | 
|---|
| 162 |  | 
|---|
| 163 | #define SEEALLFILECNR_FONT_LCID 15 | 
|---|
| 164 |  | 
|---|
| 165 | #define COLORS_MAX                   8 | 
|---|
| 166 |  | 
|---|
| 167 | #define COLORS_CURSOREDNORMALBACK    0 | 
|---|
| 168 | #define COLORS_CURSOREDSELECTEDBACK  1 | 
|---|
| 169 | #define COLORS_NORMALBACK            2 | 
|---|
| 170 | #define COLORS_SELECTEDBACK          3 | 
|---|
| 171 | #define COLORS_SELECTEDNORMALFORE    4 | 
|---|
| 172 | #define COLORS_NORMALFORE            5 | 
|---|
| 173 | #define COLORS_READONLYFORE          6 | 
|---|
| 174 | #define COLORS_SYSTEMFORE            7 | 
|---|
| 175 |  | 
|---|
| 176 | static LONG Colors[COLORS_MAX] = { COLR_WHITE, COLR_DARKGRAY, COLR_PALEGRAY, | 
|---|
| 177 | COLR_BLACK, COLR_WHITE, COLR_BLACK, | 
|---|
| 178 | COLR_DARKBLUE, COLR_DARKRED | 
|---|
| 179 | }; | 
|---|
| 180 |  | 
|---|
| 181 | typedef int (FNSORT) (const void *, const void *); | 
|---|
| 182 | typedef FNSORT *PFNSORT; | 
|---|
| 183 |  | 
|---|
| 184 | typedef struct | 
|---|
| 185 | { | 
|---|
| 186 | USHORT size; | 
|---|
| 187 | USHORT dupeflags; | 
|---|
| 188 | ALLFILES *afhead; | 
|---|
| 189 | ALLFILES **afindex; | 
|---|
| 190 | ULONG afheadcnt; | 
|---|
| 191 | ULONG afalloc; | 
|---|
| 192 | ULONG longest; | 
|---|
| 193 | ULONG longestw; | 
|---|
| 194 | ULONG topfile; | 
|---|
| 195 | ULONG cursored; | 
|---|
| 196 | ULONG selected; | 
|---|
| 197 | ULONGLONG ullSelectedBytes; | 
|---|
| 198 | ULONG afindexcnt; | 
|---|
| 199 | ULONG lastselected; | 
|---|
| 200 | ULONG lastdirection; | 
|---|
| 201 | ULONG multiplier; | 
|---|
| 202 | ULONG lasttime; | 
|---|
| 203 | CHAR stopflag; | 
|---|
| 204 | CHAR abDrvFlags[26]; | 
|---|
| 205 | CHAR szCommonName[CCHMAXPATH]; | 
|---|
| 206 | CHAR szFindPath[CCHMAXPATH]; | 
|---|
| 207 | LONG lMaxAscender; | 
|---|
| 208 | LONG lMaxDescender; | 
|---|
| 209 | LONG lMaxHeight; | 
|---|
| 210 | LONG maxx; | 
|---|
| 211 | LONG horzscroll; | 
|---|
| 212 | BOOL fullnames; | 
|---|
| 213 | BOOL invertsort; | 
|---|
| 214 | BOOL mousecaptured; | 
|---|
| 215 | HMTX hmtxScan; | 
|---|
| 216 | HWND hvscroll; | 
|---|
| 217 | HWND hhscroll; | 
|---|
| 218 | HWND hwndMenu; | 
|---|
| 219 | HWND hwndObj; | 
|---|
| 220 | HWND hwndClient; | 
|---|
| 221 | HWND hwndPopup; | 
|---|
| 222 | HWND hwndStatus; | 
|---|
| 223 | HWND hwndFrame; | 
|---|
| 224 | HPS hps; | 
|---|
| 225 | PFNSORT pfnCompare; | 
|---|
| 226 | MASK mask; | 
|---|
| 227 | FATTRS fattrs; | 
|---|
| 228 | LONG aulColors[8]; | 
|---|
| 229 | BOOL killme; | 
|---|
| 230 | } | 
|---|
| 231 | ALLDATA; | 
|---|
| 232 |  | 
|---|
| 233 | static BOOL Fullnames = FALSE; | 
|---|
| 234 | static BOOL Firsttime = TRUE; | 
|---|
| 235 | static BOOL SortReverse; | 
|---|
| 236 | static USHORT Codepage, SortType; | 
|---|
| 237 | static FATTRS Fattrs; | 
|---|
| 238 |  | 
|---|
| 239 | extern LONG CRCFile(CHAR * filename, INT * error); | 
|---|
| 240 |  | 
|---|
| 241 | MRESULT EXPENTRY DupeDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| 242 | { | 
|---|
| 243 | switch (msg) { | 
|---|
| 244 | case WM_INITDLG: | 
|---|
| 245 | { | 
|---|
| 246 | USHORT flags = SHORT1FROMMP(mp2); | 
|---|
| 247 |  | 
|---|
| 248 | WinCheckButton(hwnd, DUPE_NAMES, ((flags & DP_NAMES) != 0)); | 
|---|
| 249 | WinCheckButton(hwnd, DUPE_DATES, ((flags & DP_NAMES) != 0)); | 
|---|
| 250 | WinCheckButton(hwnd, DUPE_SIZES, ((flags & DP_NAMES) != 0)); | 
|---|
| 251 | WinCheckButton(hwnd, DUPE_CRCS, ((flags & DP_NAMES) != 0)); | 
|---|
| 252 | if (!(flags & DP_NAMES)) | 
|---|
| 253 | WinEnableWindow(WinWindowFromID(hwnd, DUPE_EXTS), FALSE); | 
|---|
| 254 | } | 
|---|
| 255 | break; | 
|---|
| 256 |  | 
|---|
| 257 | case WM_CONTROL: | 
|---|
| 258 | switch (SHORT1FROMMP(mp1)) { | 
|---|
| 259 | case DUPE_NAMES: | 
|---|
| 260 | if (WinQueryButtonCheckstate(hwnd, DUPE_NAMES)) | 
|---|
| 261 | WinEnableWindow(WinWindowFromID(hwnd, DUPE_EXTS), TRUE); | 
|---|
| 262 | else { | 
|---|
| 263 | WinCheckButton(hwnd, DUPE_EXTS, FALSE); | 
|---|
| 264 | WinEnableWindow(WinWindowFromID(hwnd, DUPE_EXTS), FALSE); | 
|---|
| 265 | } | 
|---|
| 266 | break; | 
|---|
| 267 | case DUPE_SIZES: | 
|---|
| 268 | if (!WinQueryButtonCheckstate(hwnd, DUPE_SIZES)) | 
|---|
| 269 | WinCheckButton(hwnd, DUPE_CRCS, FALSE); | 
|---|
| 270 | break; | 
|---|
| 271 | case DUPE_CRCS: | 
|---|
| 272 | if (WinQueryButtonCheckstate(hwnd, DUPE_CRCS)) | 
|---|
| 273 | WinCheckButton(hwnd, DUPE_SIZES, TRUE); | 
|---|
| 274 | break; | 
|---|
| 275 | } | 
|---|
| 276 | return 0; | 
|---|
| 277 |  | 
|---|
| 278 | case WM_COMMAND: | 
|---|
| 279 | switch (SHORT1FROMMP(mp1)) { | 
|---|
| 280 | case DID_OK: | 
|---|
| 281 | { | 
|---|
| 282 | USHORT flags = 0; | 
|---|
| 283 |  | 
|---|
| 284 | if (WinQueryButtonCheckstate(hwnd, DUPE_NAMES)) { | 
|---|
| 285 | flags |= DP_NAMES; | 
|---|
| 286 | if (WinQueryButtonCheckstate(hwnd, DUPE_EXTS)) | 
|---|
| 287 | flags |= DP_EXTS; | 
|---|
| 288 | } | 
|---|
| 289 | if (WinQueryButtonCheckstate(hwnd, DUPE_DATES)) | 
|---|
| 290 | flags |= DP_DATES; | 
|---|
| 291 | if (WinQueryButtonCheckstate(hwnd, DUPE_SIZES)) { | 
|---|
| 292 | flags |= DP_SIZES; | 
|---|
| 293 | if (WinQueryButtonCheckstate(hwnd, DUPE_CRCS)) | 
|---|
| 294 | flags |= (DP_CRCS | DP_SIZES); | 
|---|
| 295 | } | 
|---|
| 296 | if (!flags) | 
|---|
| 297 | saymsg(MB_ENTER, | 
|---|
| 298 | hwnd, | 
|---|
| 299 | GetPString(IDS_ERRORTEXT), | 
|---|
| 300 | GetPString(IDS_CHECKONETEXT)); | 
|---|
| 301 | else | 
|---|
| 302 | WinDismissDlg(hwnd, flags); | 
|---|
| 303 | } | 
|---|
| 304 | break; | 
|---|
| 305 |  | 
|---|
| 306 | case DID_CANCEL: | 
|---|
| 307 | WinDismissDlg(hwnd, 0); | 
|---|
| 308 | break; | 
|---|
| 309 |  | 
|---|
| 310 | case IDM_HELP: | 
|---|
| 311 | if (hwndHelp) | 
|---|
| 312 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP, | 
|---|
| 313 | MPFROM2SHORT(HELP_DUPES, 0), MPFROMSHORT(HM_RESOURCEID)); | 
|---|
| 314 | break; | 
|---|
| 315 | } | 
|---|
| 316 | return 0; | 
|---|
| 317 | } | 
|---|
| 318 | return WinDefDlgProc(hwnd, msg, mp1, mp2); | 
|---|
| 319 | } | 
|---|
| 320 |  | 
|---|
| 321 | static ULONG NumLines(RECTL * rcl, ALLDATA * ad) | 
|---|
| 322 | { | 
|---|
| 323 | ULONG numlines; | 
|---|
| 324 |  | 
|---|
| 325 | numlines = (rcl->yTop - rcl->yBottom) / ad->lMaxHeight; | 
|---|
| 326 | if (ad->lMaxDescender && numlines && | 
|---|
| 327 | ((rcl->yTop - rcl->yBottom) - | 
|---|
| 328 | (numlines * ad->lMaxHeight) <= ad->lMaxDescender)) | 
|---|
| 329 | numlines--; | 
|---|
| 330 | return numlines; | 
|---|
| 331 | } | 
|---|
| 332 |  | 
|---|
| 333 | MRESULT EXPENTRY SeeObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| 334 | { | 
|---|
| 335 | switch (msg) { | 
|---|
| 336 | case UM_MASSACTION: | 
|---|
| 337 | { | 
|---|
| 338 | CHAR **files = NULL, **list = (CHAR **) mp2, path[CCHMAXPATH]; | 
|---|
| 339 | UINT numfiles = 0, numalloc = 0; | 
|---|
| 340 | INT plen = 0; | 
|---|
| 341 | HWND hwndFrame = WinQueryWindowULong(hwnd, QWL_USER); | 
|---|
| 342 | CHAR message[CCHMAXPATH * 2], wildname[CCHMAXPATH]; | 
|---|
| 343 | register INT x; | 
|---|
| 344 | register CHAR *p, *pp; | 
|---|
| 345 | BOOL dontask = FALSE, wildcarding = FALSE, | 
|---|
| 346 | overold = FALSE, overnew = FALSE; | 
|---|
| 347 |  | 
|---|
| 348 | if (!list || !list[0]) | 
|---|
| 349 | goto Abort; | 
|---|
| 350 | *path = *wildname = 0; | 
|---|
| 351 |  | 
|---|
| 352 | switch (SHORT1FROMMP(mp1)) { | 
|---|
| 353 | case IDM_MOVEPRESERVE: | 
|---|
| 354 | { | 
|---|
| 355 | CHAR preserve[CCHMAXPATH], *end; | 
|---|
| 356 |  | 
|---|
| 357 | mp1 = MPFROM2SHORT(IDM_MOVE, SHORT2FROMMP(mp1)); | 
|---|
| 358 | strcpy(preserve, list[0] + 2); | 
|---|
| 359 | end = strrchr(preserve, '\\'); | 
|---|
| 360 | if (end) { | 
|---|
| 361 | end++; | 
|---|
| 362 | for (x = 1; list[x]; x++) { | 
|---|
| 363 | p = preserve; | 
|---|
| 364 | pp = list[x] + 2; | 
|---|
| 365 | while (p < end && toupper(*p) == toupper(*pp)) { | 
|---|
| 366 | p++; | 
|---|
| 367 | pp++; | 
|---|
| 368 | } | 
|---|
| 369 | if (*p == '\\') | 
|---|
| 370 | p++; | 
|---|
| 371 | if (p < end) | 
|---|
| 372 | end = p; | 
|---|
| 373 | } | 
|---|
| 374 | *end = 0; | 
|---|
| 375 | } | 
|---|
| 376 | else | 
|---|
| 377 | *preserve = 0; | 
|---|
| 378 | plen = strlen(preserve); | 
|---|
| 379 | if (plen) | 
|---|
| 380 | plen += 2; | 
|---|
| 381 | } | 
|---|
| 382 | break; | 
|---|
| 383 | case IDM_COPYPRESERVE: | 
|---|
| 384 | { | 
|---|
| 385 | CHAR preserve[CCHMAXPATH], *end; | 
|---|
| 386 |  | 
|---|
| 387 | mp1 = MPFROM2SHORT(IDM_COPY, SHORT2FROMMP(mp1)); | 
|---|
| 388 | strcpy(preserve, list[0] + 2); | 
|---|
| 389 | end = strrchr(preserve, '\\'); | 
|---|
| 390 | if (end) { | 
|---|
| 391 | end++; | 
|---|
| 392 | for (x = 1; list[x]; x++) { | 
|---|
| 393 | p = preserve; | 
|---|
| 394 | pp = list[x] + 2; | 
|---|
| 395 | while (p < end && toupper(*p) == toupper(*pp)) { | 
|---|
| 396 | p++; | 
|---|
| 397 | pp++; | 
|---|
| 398 | } | 
|---|
| 399 | if (*p == '\\') | 
|---|
| 400 | p++; | 
|---|
| 401 | if (p < end) | 
|---|
| 402 | end = p; | 
|---|
| 403 | } | 
|---|
| 404 | *end = 0; | 
|---|
| 405 | } | 
|---|
| 406 | else | 
|---|
| 407 | *preserve = 0; | 
|---|
| 408 | plen = strlen(preserve); | 
|---|
| 409 | if (plen) | 
|---|
| 410 | plen += 2; | 
|---|
| 411 | } | 
|---|
| 412 | break; | 
|---|
| 413 | case IDM_WILDMOVE: | 
|---|
| 414 | wildcarding = TRUE; | 
|---|
| 415 | mp1 = MPFROM2SHORT(IDM_MOVE, SHORT2FROMMP(mp1)); | 
|---|
| 416 | break; | 
|---|
| 417 | case IDM_WILDRENAME: | 
|---|
| 418 | wildcarding = TRUE; | 
|---|
| 419 | mp1 = MPFROM2SHORT(IDM_RENAME, SHORT2FROMMP(mp1)); | 
|---|
| 420 | break; | 
|---|
| 421 | case IDM_WILDCOPY: | 
|---|
| 422 | wildcarding = TRUE; | 
|---|
| 423 | mp1 = MPFROM2SHORT(IDM_COPY, SHORT2FROMMP(mp1)); | 
|---|
| 424 | break; | 
|---|
| 425 | } | 
|---|
| 426 |  | 
|---|
| 427 | switch (SHORT1FROMMP(mp1)) { | 
|---|
| 428 | case IDM_OBJECT: | 
|---|
| 429 | case IDM_SHADOW: | 
|---|
| 430 | { | 
|---|
| 431 | APIRET rc; | 
|---|
| 432 |  | 
|---|
| 433 | GetDesktopName(path, sizeof(path)); | 
|---|
| 434 | rc = WinDlgBox(HWND_DESKTOP, | 
|---|
| 435 | hwndFrame, | 
|---|
| 436 | ObjCnrDlgProc, | 
|---|
| 437 | FM3ModHandle, OBJCNR_FRAME, MPFROMP(path)); | 
|---|
| 438 | if (rc) { | 
|---|
| 439 | if (rc > 1) | 
|---|
| 440 | strcpy(path, "<WP_DESKTOP>"); | 
|---|
| 441 | } | 
|---|
| 442 | else { | 
|---|
| 443 | FreeList(list); | 
|---|
| 444 | break; | 
|---|
| 445 | } | 
|---|
| 446 | MakeShadows(hwndFrame, | 
|---|
| 447 | list, (SHORT1FROMMP(mp1) == IDM_SHADOW), path, NULL); | 
|---|
| 448 | } | 
|---|
| 449 | FreeList(list); | 
|---|
| 450 | break; | 
|---|
| 451 |  | 
|---|
| 452 | case IDM_PRINT: | 
|---|
| 453 | { | 
|---|
| 454 | LISTINFO *li; | 
|---|
| 455 | #         ifdef FORTIFY | 
|---|
| 456 | Fortify_EnterScope(); | 
|---|
| 457 | #          endif | 
|---|
| 458 | li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__); | 
|---|
| 459 | if (li) { | 
|---|
| 460 | li->hwndS = WinWindowFromID(hwndFrame, FID_CLIENT); | 
|---|
| 461 | li->type = IDM_PRINT; | 
|---|
| 462 | li->list = list; | 
|---|
| 463 | if (WinDlgBox(HWND_DESKTOP, | 
|---|
| 464 | li->hwndS, | 
|---|
| 465 | PrintDlgProc, | 
|---|
| 466 | FM3ModHandle, PRN_FRAME, MPFROMP(li))) { | 
|---|
| 467 | if (li && li->list && li->list[0]) { | 
|---|
| 468 | strcpy(li->targetpath, printer); | 
|---|
| 469 | if (xbeginthread(PrintListThread, | 
|---|
| 470 | 65536, | 
|---|
| 471 | li, | 
|---|
| 472 | pszSrcFile, | 
|---|
| 473 | __LINE__) == -1) | 
|---|
| 474 | { | 
|---|
| 475 | FreeListInfo(li); | 
|---|
| 476 | } | 
|---|
| 477 | } | 
|---|
| 478 | } | 
|---|
| 479 | } | 
|---|
| 480 | } | 
|---|
| 481 | break; | 
|---|
| 482 |  | 
|---|
| 483 | case IDM_EAS: | 
|---|
| 484 | if (WinDlgBox(HWND_DESKTOP, | 
|---|
| 485 | hwndFrame, | 
|---|
| 486 | DisplayEAsProc, FM3ModHandle, EA_FRAME, (PVOID) list)) { | 
|---|
| 487 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| 488 | UM_UPDATERECORDLIST, MPFROMP(list), MPVOID)) | 
|---|
| 489 | FreeList(list); | 
|---|
| 490 | } | 
|---|
| 491 | else | 
|---|
| 492 | FreeList(list); | 
|---|
| 493 | break; | 
|---|
| 494 |  | 
|---|
| 495 | case IDM_INFO: | 
|---|
| 496 | if (WinDlgBox(HWND_DESKTOP, | 
|---|
| 497 | hwndFrame, | 
|---|
| 498 | FileInfoProc, | 
|---|
| 499 | FM3ModHandle, FLE_FRAME, (PVOID) list) == 2) { | 
|---|
| 500 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| 501 | UM_UPDATERECORDLIST, MPFROMP(list), MPVOID)) | 
|---|
| 502 | FreeList(list); | 
|---|
| 503 | } | 
|---|
| 504 | else | 
|---|
| 505 | FreeList(list); | 
|---|
| 506 | break; | 
|---|
| 507 |  | 
|---|
| 508 | case IDM_ARCHIVE: | 
|---|
| 509 | { | 
|---|
| 510 | DIRCNRDATA ad; | 
|---|
| 511 | CHAR szBuffer[1025]; | 
|---|
| 512 |  | 
|---|
| 513 | memset(&ad, 0, sizeof(ad)); | 
|---|
| 514 | ad.namecanchange = 1; | 
|---|
| 515 | ad.info = arcsighead;         // Hide dups | 
|---|
| 516 | if (!WinDlgBox(HWND_DESKTOP, | 
|---|
| 517 | hwndFrame, | 
|---|
| 518 | SBoxDlgProc, | 
|---|
| 519 | FM3ModHandle, | 
|---|
| 520 | ASEL_FRAME, (PVOID) & ad.info) || !ad.info) { | 
|---|
| 521 | // we blew it | 
|---|
| 522 | FreeList(list); | 
|---|
| 523 | break; | 
|---|
| 524 | } | 
|---|
| 525 | if (!ad.info->create && | 
|---|
| 526 | !ad.info->move && | 
|---|
| 527 | !ad.info->createwdirs && | 
|---|
| 528 | !ad.info->movewdirs && !ad.info->createrecurse) { | 
|---|
| 529 | // 14 Aug 07 SHL fixme to tell user why we failed | 
|---|
| 530 | FreeList(list); | 
|---|
| 531 | break; | 
|---|
| 532 | } | 
|---|
| 533 | if (!WinDlgBox(HWND_DESKTOP, hwndFrame, ArchiveDlgProc, FM3ModHandle, ARCH_FRAME, (PVOID) & ad) || | 
|---|
| 534 | !*ad.arcname || !*ad.command) {    // we blew it | 
|---|
| 535 | FreeList(list); | 
|---|
| 536 | break; | 
|---|
| 537 | } | 
|---|
| 538 | // Build archiver command line | 
|---|
| 539 | strcpy(szBuffer, ad.command); | 
|---|
| 540 | strcat(szBuffer, " "); | 
|---|
| 541 | strcat(szBuffer, ad.arcname); | 
|---|
| 542 | p = &szBuffer[strlen(szBuffer)]; | 
|---|
| 543 | if (ad.mask.szMask) { | 
|---|
| 544 | strcat(szBuffer, " "); | 
|---|
| 545 | strcat(szBuffer, ad.mask.szMask); | 
|---|
| 546 | } | 
|---|
| 547 | strcat(szBuffer, " "); | 
|---|
| 548 | x = 0; | 
|---|
| 549 | while (list[x]) { | 
|---|
| 550 | FILESTATUS3 fsa; | 
|---|
| 551 | memset(&fsa, 0, sizeof(fsa)); | 
|---|
| 552 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 553 | DosQueryPathInfo(list[x], FIL_STANDARD, &fsa, sizeof(fsa)); | 
|---|
| 554 | if (fsa.attrFile & FILE_DIRECTORY) { | 
|---|
| 555 | BldQuotedFullPathName(szBuffer + strlen(szBuffer), | 
|---|
| 556 | list[x], "*"); | 
|---|
| 557 | } | 
|---|
| 558 | else | 
|---|
| 559 | BldQuotedFileName(szBuffer + strlen(szBuffer), list[x]); | 
|---|
| 560 | x++; | 
|---|
| 561 | if (!list[x] || strlen(szBuffer) + strlen(list[x]) + 5 > 1024) { | 
|---|
| 562 | runemf2(SEPARATE | WINDOWED | WAIT | | 
|---|
| 563 | (fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED)), | 
|---|
| 564 | HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| 565 | NULL, NULL, "%s", szBuffer); | 
|---|
| 566 | DosSleep(1);              // Let archiver get started | 
|---|
| 567 | *p = 0; | 
|---|
| 568 | } | 
|---|
| 569 | strcat(szBuffer, " "); | 
|---|
| 570 | } // while | 
|---|
| 571 | AddToList(ad.arcname, &files, &numfiles, &numalloc); | 
|---|
| 572 | } | 
|---|
| 573 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| 574 | UM_UPDATERECORDLIST, MPFROMP(list), MPVOID)) | 
|---|
| 575 | FreeList(list); | 
|---|
| 576 | break; | 
|---|
| 577 |  | 
|---|
| 578 | case IDM_ATTRS: | 
|---|
| 579 | { | 
|---|
| 580 | LISTINFO li; | 
|---|
| 581 |  | 
|---|
| 582 | memset(&li, 0, sizeof(li)); | 
|---|
| 583 | li.list = list; | 
|---|
| 584 | if (WinDlgBox(HWND_DESKTOP, | 
|---|
| 585 | hwndFrame, | 
|---|
| 586 | AttrListDlgProc, | 
|---|
| 587 | FM3ModHandle, ATR_FRAME, MPFROMP(&li))) { | 
|---|
| 588 | if (li.list && li.list[0]) { | 
|---|
| 589 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| 590 | UM_UPDATERECORDLIST, MPFROMP(li.list), MPVOID)) | 
|---|
| 591 | FreeList(li.list); | 
|---|
| 592 | } | 
|---|
| 593 | } | 
|---|
| 594 | else | 
|---|
| 595 | FreeList(list); | 
|---|
| 596 | } | 
|---|
| 597 | break; | 
|---|
| 598 |  | 
|---|
| 599 | case IDM_MOVE: | 
|---|
| 600 | case IDM_COPY: | 
|---|
| 601 | if (!*path) | 
|---|
| 602 | strcpy(path, targetdir); | 
|---|
| 603 | if (!*path) | 
|---|
| 604 | strcpy(path, list[0]); | 
|---|
| 605 | MakeValidDir(path); | 
|---|
| 606 | RetryPath: | 
|---|
| 607 | if (SHORT1FROMMP(mp1) == IDM_MOVE) { | 
|---|
| 608 | if (!WinDlgBox(HWND_DESKTOP, | 
|---|
| 609 | hwndFrame, | 
|---|
| 610 | WalkMoveDlgProc, | 
|---|
| 611 | FM3ModHandle, WALK_FRAME, MPFROMP(path)) || !*path) { | 
|---|
| 612 | FreeList(list); | 
|---|
| 613 | goto Abort; | 
|---|
| 614 | } | 
|---|
| 615 | } | 
|---|
| 616 | else { | 
|---|
| 617 | if (!WinDlgBox(HWND_DESKTOP, | 
|---|
| 618 | hwndFrame, | 
|---|
| 619 | WalkCopyDlgProc, | 
|---|
| 620 | FM3ModHandle, WALK_FRAME, MPFROMP(path)) || !*path) { | 
|---|
| 621 | FreeList(list); | 
|---|
| 622 | goto Abort; | 
|---|
| 623 | } | 
|---|
| 624 | } | 
|---|
| 625 | if (driveflags[toupper(*path) - 'A'] & DRIVE_NOTWRITEABLE) { | 
|---|
| 626 | saymsg(MB_CANCEL, | 
|---|
| 627 | hwndFrame, | 
|---|
| 628 | GetPString(IDS_ERRORTEXT), | 
|---|
| 629 | GetPString(IDS_NOTWRITENOTARGETTEXT)); | 
|---|
| 630 | goto RetryPath; | 
|---|
| 631 | } | 
|---|
| 632 | // intentional fallthru | 
|---|
| 633 | case IDM_RENAME: | 
|---|
| 634 | { | 
|---|
| 635 | CHAR newname[CCHMAXPATH]; | 
|---|
| 636 | PCSZ moving, move, moved; | 
|---|
| 637 | APIRET rc; | 
|---|
| 638 | INT type; | 
|---|
| 639 | FILESTATUS4L fs4; | 
|---|
| 640 | BOOL isnewer, existed, fResetVerify = FALSE; | 
|---|
| 641 |  | 
|---|
| 642 | for (x = 0; list[x]; x++) { | 
|---|
| 643 | Retry: | 
|---|
| 644 | type = (SHORT1FROMMP(mp1) == IDM_RENAME) ? MOVE : | 
|---|
| 645 | (SHORT1FROMMP(mp1) == IDM_MOVE) ? MOVE : | 
|---|
| 646 | (SHORT1FROMMP(mp1) == IDM_WPSMOVE) ? WPSMOVE : | 
|---|
| 647 | (SHORT1FROMMP(mp1) == IDM_WPSCOPY) ? WPSCOPY : COPY; | 
|---|
| 648 | moving = (SHORT1FROMMP(mp1) == IDM_RENAME) ? | 
|---|
| 649 | GetPString(IDS_RENAMINGTEXT) : | 
|---|
| 650 | (SHORT1FROMMP(mp1) == IDM_MOVE || | 
|---|
| 651 | SHORT1FROMMP(mp1) == IDM_WPSMOVE) ? | 
|---|
| 652 | GetPString(IDS_MOVINGTEXT) : GetPString(IDS_COPYINGTEXT); | 
|---|
| 653 | move = (SHORT1FROMMP(mp1) == IDM_RENAME) ? | 
|---|
| 654 | GetPString(IDS_RENAMETEXT) : | 
|---|
| 655 | (SHORT1FROMMP(mp1) == IDM_MOVE || | 
|---|
| 656 | SHORT1FROMMP(mp1) == IDM_WPSMOVE) ? | 
|---|
| 657 | GetPString(IDS_MOVETEXT) : GetPString(IDS_COPYTEXT); | 
|---|
| 658 | moved = (SHORT1FROMMP(mp1) == IDM_RENAME) ? | 
|---|
| 659 | GetPString(IDS_RENAMEDTEXT) : | 
|---|
| 660 | (SHORT1FROMMP(mp1) == IDM_MOVE || | 
|---|
| 661 | SHORT1FROMMP(mp1) == IDM_WPSMOVE) ? | 
|---|
| 662 | GetPString(IDS_MOVEDTEXT) : GetPString(IDS_COPIEDTEXT); | 
|---|
| 663 | if (*path) { | 
|---|
| 664 | strcpy(newname, path); | 
|---|
| 665 | AddBackslashToPath(newname); | 
|---|
| 666 | if (plen) | 
|---|
| 667 | p = list[x] + plen; | 
|---|
| 668 | else { | 
|---|
| 669 | p = strrchr(list[x], '\\'); | 
|---|
| 670 | if (p) | 
|---|
| 671 | p++; | 
|---|
| 672 | else | 
|---|
| 673 | p = list[x]; | 
|---|
| 674 | } | 
|---|
| 675 | strcat(newname, p); | 
|---|
| 676 | } | 
|---|
| 677 | else | 
|---|
| 678 | strcpy(newname, list[x]); | 
|---|
| 679 | if ((wildcarding || SHORT1FROMMP(mp1) == IDM_RENAME) && *wildname) { | 
|---|
| 680 |  | 
|---|
| 681 | CHAR testname[CCHMAXPATH]; | 
|---|
| 682 |  | 
|---|
| 683 | strcpy(testname, wildname); | 
|---|
| 684 | if (AdjustWildcardName(newname, testname)) | 
|---|
| 685 | strcpy(newname, testname); | 
|---|
| 686 | } | 
|---|
| 687 | existed = (IsFile(newname) != -1); | 
|---|
| 688 | isnewer = IsNewer(list[x], newname); | 
|---|
| 689 | if (existed && SHORT1FROMMP(mp1) != IDM_RENAME && dontask) { | 
|---|
| 690 | if (!overold && !overnew) | 
|---|
| 691 | break; | 
|---|
| 692 | if (!overold && !isnewer) | 
|---|
| 693 | break; | 
|---|
| 694 | if (!overnew && isnewer) | 
|---|
| 695 | break; | 
|---|
| 696 | } | 
|---|
| 697 | if ((SHORT1FROMMP(mp1) == IDM_RENAME && | 
|---|
| 698 | (!dontask || !*wildname)) || | 
|---|
| 699 | (!dontask && existed) || | 
|---|
| 700 | (!dontask && wildcarding) || | 
|---|
| 701 | (IsFile(newname) == 0 && IsFile(list[x]) == 1)) { | 
|---|
| 702 |  | 
|---|
| 703 | MOVEIT mv; | 
|---|
| 704 |  | 
|---|
| 705 | memset(&mv, 0, sizeof(mv)); | 
|---|
| 706 | mv.rename = (SHORT1FROMMP(mp1) == IDM_RENAME); | 
|---|
| 707 | mv.source = list[x]; | 
|---|
| 708 | strcpy(mv.target, newname); | 
|---|
| 709 | rc = WinDlgBox(HWND_DESKTOP, | 
|---|
| 710 | hwndFrame, | 
|---|
| 711 | RenameProc, | 
|---|
| 712 | FM3ModHandle, REN_FRAME, (PVOID) & mv); | 
|---|
| 713 | if (!rc) { | 
|---|
| 714 | FreeList(list); | 
|---|
| 715 | goto Abort; | 
|---|
| 716 | } | 
|---|
| 717 | DosSleep(0);              //26 Aug 07 GKY 1 | 
|---|
| 718 | if (mv.skip || !*mv.target) | 
|---|
| 719 | break; | 
|---|
| 720 | if (mv.dontask) | 
|---|
| 721 | dontask = TRUE; | 
|---|
| 722 | if (mv.overold) | 
|---|
| 723 | overold = TRUE; | 
|---|
| 724 | if (mv.overnew) | 
|---|
| 725 | overnew = TRUE; | 
|---|
| 726 | if (wildcarding || SHORT1FROMMP(mp1) == IDM_RENAME) { | 
|---|
| 727 | p = strrchr(mv.target, '\\'); | 
|---|
| 728 | if (p && (strchr(p, '*') || strchr(p, '?'))) { | 
|---|
| 729 | strcpy(wildname, mv.target); | 
|---|
| 730 | AdjustWildcardName(list[x], mv.target); | 
|---|
| 731 | } | 
|---|
| 732 | else | 
|---|
| 733 | *wildname = 0; | 
|---|
| 734 | } | 
|---|
| 735 | strcpy(newname, mv.target); | 
|---|
| 736 | existed = (IsFile(newname) != -1); | 
|---|
| 737 | isnewer = IsNewer(list[x], newname); | 
|---|
| 738 | if (!mv.overwrite) { | 
|---|
| 739 | if (existed && SHORT1FROMMP(mp1) != IDM_RENAME && dontask) { | 
|---|
| 740 | if (!overold && !overnew) | 
|---|
| 741 | break; | 
|---|
| 742 | if (!overold && !isnewer) | 
|---|
| 743 | break; | 
|---|
| 744 | if (!overnew && isnewer) | 
|---|
| 745 | break; | 
|---|
| 746 | } | 
|---|
| 747 | } | 
|---|
| 748 | } | 
|---|
| 749 | if (!stricmp(list[x], newname)) | 
|---|
| 750 | break; | 
|---|
| 751 | sprintf(message, | 
|---|
| 752 | " %s \"%s\" %s \"%s\"", | 
|---|
| 753 | moving, list[x], GetPString(IDS_TOTEXT), newname); | 
|---|
| 754 | WinSetWindowText(WinWindowFromID(hwndFrame, SEEALL_STATUS), | 
|---|
| 755 | message); | 
|---|
| 756 | if (fRealIdle) | 
|---|
| 757 | priority_idle(); | 
|---|
| 758 | if (fVerify && (driveflags[toupper(*list[x]) - 'A'] & DRIVE_WRITEVERIFYOFF || | 
|---|
| 759 | driveflags[toupper(*newname) - 'A'] & DRIVE_WRITEVERIFYOFF)) { | 
|---|
| 760 | DosSetVerify(FALSE); | 
|---|
| 761 | fResetVerify = TRUE; | 
|---|
| 762 | } | 
|---|
| 763 | if (plen) { | 
|---|
| 764 | // make directory/ies, if required | 
|---|
| 765 |  | 
|---|
| 766 | CHAR dirpart[CCHMAXPATH]; | 
|---|
| 767 |  | 
|---|
| 768 | strcpy(dirpart, newname); | 
|---|
| 769 | p = strrchr(dirpart, '\\'); | 
|---|
| 770 | if (p) { | 
|---|
| 771 | *p = 0; | 
|---|
| 772 | if (p > dirpart + 3) | 
|---|
| 773 | MassMkdir((hwndMain) ? hwndMain : (HWND) 0, dirpart); | 
|---|
| 774 | } | 
|---|
| 775 | } | 
|---|
| 776 | rc = docopyf(type, list[x], newname); | 
|---|
| 777 | if (fResetVerify) { | 
|---|
| 778 | DosSetVerify(fVerify); | 
|---|
| 779 | fResetVerify = FALSE; | 
|---|
| 780 | } | 
|---|
| 781 | priority_normal(); | 
|---|
| 782 | if (rc) { | 
|---|
| 783 | if ((rc == ERROR_DISK_FULL || | 
|---|
| 784 | rc == ERROR_HANDLE_DISK_FULL) && | 
|---|
| 785 | isalpha(*newname) && | 
|---|
| 786 | (driveflags[toupper(*newname) - 'A'] & DRIVE_REMOVABLE) && | 
|---|
| 787 | !(driveflags[toupper(*newname) - 'A'] & DRIVE_NOTWRITEABLE) | 
|---|
| 788 | && toupper(*newname) != toupper(*list[x]) | 
|---|
| 789 | && !DosQueryPathInfo(list[x], FIL_QUERYEASIZEL, &fs4, | 
|---|
| 790 | sizeof(fs4)) | 
|---|
| 791 | && !(fs4.attrFile & FILE_DIRECTORY)) { | 
|---|
| 792 |  | 
|---|
| 793 | FSALLOCATE fsa; | 
|---|
| 794 | ULONGLONG ullFreeBytes; | 
|---|
| 795 | CHAR *ptr; | 
|---|
| 796 | INT cntr; | 
|---|
| 797 |  | 
|---|
| 798 | WinSetWindowText(WinWindowFromID(hwndFrame, SEEALL_STATUS), | 
|---|
| 799 | (CHAR *) GetPString(IDS_FITTINGTEXT)); | 
|---|
| 800 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 801 | if (!DosQueryFSInfo(toupper(*newname) - '@', | 
|---|
| 802 | FSIL_ALLOC, &fsa, sizeof(fsa))) { | 
|---|
| 803 | // Assume large file support | 
|---|
| 804 | ullFreeBytes = (ULONGLONG) fsa.cUnitAvail * fsa.cSectorUnit * | 
|---|
| 805 | fsa.cbSector; | 
|---|
| 806 | if (ullFreeBytes) { | 
|---|
| 807 | // Find item that will fit in available space | 
|---|
| 808 | for (cntr = x + 1; list[cntr]; cntr++) { | 
|---|
| 809 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 810 | if (!DosQueryPathInfo(list[cntr], | 
|---|
| 811 | FIL_QUERYEASIZEL, | 
|---|
| 812 | &fs4, sizeof(fs4)) && | 
|---|
| 813 | !(fs4.attrFile & FILE_DIRECTORY) && | 
|---|
| 814 | // fixme to use CBLIST_TO_EASIZE? | 
|---|
| 815 | fs4.cbFile + fs4.cbList <= ullFreeBytes) { | 
|---|
| 816 | // Swap with failing item | 
|---|
| 817 | ptr = list[x]; | 
|---|
| 818 | list[x] = list[cntr]; | 
|---|
| 819 | list[cntr] = ptr; | 
|---|
| 820 | goto Retry; | 
|---|
| 821 | } | 
|---|
| 822 | } | 
|---|
| 823 | WinSetWindowText(WinWindowFromID(hwndFrame, | 
|---|
| 824 | SEEALL_STATUS), | 
|---|
| 825 | (CHAR *) GetPString(IDS_COULDNTFITTEXT)); | 
|---|
| 826 | } | 
|---|
| 827 | } | 
|---|
| 828 | rc = saymsg(MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION, | 
|---|
| 829 | hwndFrame, | 
|---|
| 830 | GetPString(IDS_DISKFULLTEXT), | 
|---|
| 831 | GetPString(IDS_ANOTHERDISKTEXT)); | 
|---|
| 832 | if (rc == MBID_RETRY) | 
|---|
| 833 | goto Retry; | 
|---|
| 834 | if (rc == MBID_ABORT) { | 
|---|
| 835 | FreeList(list); | 
|---|
| 836 | goto Abort; | 
|---|
| 837 | } | 
|---|
| 838 | } | 
|---|
| 839 | else { | 
|---|
| 840 | if (LogFileHandle) | 
|---|
| 841 | fprintf(LogFileHandle, | 
|---|
| 842 | GetPString(IDS_LOGTOFAILEDTEXT), | 
|---|
| 843 | move, list[x], newname, rc); | 
|---|
| 844 | rc = Dos_Error(MB_ENTERCANCEL, | 
|---|
| 845 | rc, | 
|---|
| 846 | hwndFrame, | 
|---|
| 847 | pszSrcFile, | 
|---|
| 848 | __LINE__, | 
|---|
| 849 | "%s %s \"%s\" %s\"%s\" %s.", | 
|---|
| 850 | move, | 
|---|
| 851 | GetPString(IDS_OFTEXT), | 
|---|
| 852 | list[x], | 
|---|
| 853 | GetPString(IDS_TOTEXT), | 
|---|
| 854 | newname, GetPString(IDS_FAILEDTEXT)); | 
|---|
| 855 | if (rc == MBID_CANCEL) { | 
|---|
| 856 | FreeList(list); | 
|---|
| 857 | goto Abort; | 
|---|
| 858 | } | 
|---|
| 859 | } | 
|---|
| 860 | } | 
|---|
| 861 | else { | 
|---|
| 862 | if (LogFileHandle) | 
|---|
| 863 | fprintf(LogFileHandle, | 
|---|
| 864 | "%s \"%s\" %s \"%s\"\n", | 
|---|
| 865 | moved, list[x], GetPString(IDS_TOTEXT), newname); | 
|---|
| 866 | AddToList(newname, &files, &numfiles, &numalloc); | 
|---|
| 867 | } | 
|---|
| 868 | } | 
|---|
| 869 | } | 
|---|
| 870 | if (SHORT1FROMMP(mp1) != IDM_COPY) { | 
|---|
| 871 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| 872 | UM_UPDATERECORDLIST, MPFROMP(list), MPVOID)) | 
|---|
| 873 | FreeList(list); | 
|---|
| 874 | } | 
|---|
| 875 | else | 
|---|
| 876 | FreeList(list); | 
|---|
| 877 | break; | 
|---|
| 878 |  | 
|---|
| 879 | case IDM_UUDECODE: | 
|---|
| 880 | for (x = 0; list[x]; x++) | 
|---|
| 881 | UUD(list[x], NULL); | 
|---|
| 882 | break; | 
|---|
| 883 |  | 
|---|
| 884 | case IDM_UNLOCKFILE: | 
|---|
| 885 | for (x = 0; list[x]; x++) { | 
|---|
| 886 | if (IsFile(list[x]) > 0 && fUnlock) { | 
|---|
| 887 | runemf2(SEPARATE | INVISIBLE | BACKGROUND | WAIT, | 
|---|
| 888 | HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| 889 | NULL, NULL, "%s %s", PCSZ_UNLOCKEXE, list[x]); | 
|---|
| 890 | } | 
|---|
| 891 | } | 
|---|
| 892 | break; | 
|---|
| 893 |  | 
|---|
| 894 | case IDM_EXTRACT: | 
|---|
| 895 | for (x = 0; list[x]; x++) { | 
|---|
| 896 |  | 
|---|
| 897 | EXTRDATA ex; | 
|---|
| 898 | BOOL maskspaces = FALSE; | 
|---|
| 899 |  | 
|---|
| 900 | memset(&ex, 0, sizeof(ex)); | 
|---|
| 901 | ex.info = find_type(list[x], NULL); | 
|---|
| 902 | if (!ex.info || (!ex.info->extract && !ex.info->exwdirs)) | 
|---|
| 903 | break; | 
|---|
| 904 | ex.size = sizeof(ex); | 
|---|
| 905 | ex.arcname = list[x]; | 
|---|
| 906 | strcpy(ex.masks, "*"); | 
|---|
| 907 | if (!WinDlgBox(HWND_DESKTOP, | 
|---|
| 908 | hwndFrame, | 
|---|
| 909 | ExtractDlgProc, | 
|---|
| 910 | FM3ModHandle, | 
|---|
| 911 | EXT_FRAME, | 
|---|
| 912 | (PVOID) & ex) || | 
|---|
| 913 | !ex.ret || !*ex.command || !*ex.arcname || !*ex.extractdir) | 
|---|
| 914 | break; | 
|---|
| 915 | if (IsFile(ex.extractdir) != 0) | 
|---|
| 916 | Runtime_Error(pszSrcFile, __LINE__, "directory expected"); | 
|---|
| 917 | else { | 
|---|
| 918 | if (needs_quoting(ex.masks) && !strchr(ex.masks, '\"')) | 
|---|
| 919 | maskspaces = TRUE; | 
|---|
| 920 | runemf2(SEPARATE | WINDOWED | | 
|---|
| 921 | (fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED)), | 
|---|
| 922 | HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| 923 | ex.extractdir, NULL, | 
|---|
| 924 | "%s %s %s%s%s", | 
|---|
| 925 | ex.command, | 
|---|
| 926 | ex.arcname, | 
|---|
| 927 | maskspaces ? "\"" : NullStr, | 
|---|
| 928 | *ex.masks ? ex.masks : "*", | 
|---|
| 929 | maskspaces ? "\"" : NullStr); | 
|---|
| 930 | } | 
|---|
| 931 | } | 
|---|
| 932 | // fixme to not leak? | 
|---|
| 933 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| 934 | UM_UPDATERECORDLIST, MPFROMP(list), MPVOID)) | 
|---|
| 935 | FreeList(list); | 
|---|
| 936 | break; | 
|---|
| 937 |  | 
|---|
| 938 | case IDM_SUBJECT: | 
|---|
| 939 | for (x = 0; list[x]; x++) { | 
|---|
| 940 |  | 
|---|
| 941 | INT ret; | 
|---|
| 942 |  | 
|---|
| 943 | if (IsFile(list[x]) == 1) { | 
|---|
| 944 | ret = Subject(hwndFrame, list[x]); | 
|---|
| 945 | if (!ret) | 
|---|
| 946 | break; | 
|---|
| 947 | } | 
|---|
| 948 | } | 
|---|
| 949 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| 950 | UM_UPDATERECORDLIST, MPFROMP(list), MPVOID)) | 
|---|
| 951 | FreeList(list); | 
|---|
| 952 | break; | 
|---|
| 953 |  | 
|---|
| 954 | case IDM_OPENDEFAULT: | 
|---|
| 955 | case IDM_OPENSETTINGS: | 
|---|
| 956 | for (x = 0; list[x]; x++) { | 
|---|
| 957 | if (IsFile(list[x]) != -1) { | 
|---|
| 958 |  | 
|---|
| 959 | CHAR *s; | 
|---|
| 960 |  | 
|---|
| 961 | switch (SHORT1FROMMP(mp1)) { | 
|---|
| 962 | case IDM_OPENSETTINGS: | 
|---|
| 963 | s = (PSZ) Settings; | 
|---|
| 964 | break; | 
|---|
| 965 | default: | 
|---|
| 966 | s = (PSZ) Default; | 
|---|
| 967 | break; | 
|---|
| 968 | } | 
|---|
| 969 | OpenObject(list[x], s, hwndFrame); | 
|---|
| 970 | } | 
|---|
| 971 | } | 
|---|
| 972 | FreeList(list); | 
|---|
| 973 | break; | 
|---|
| 974 |  | 
|---|
| 975 | case IDM_DELETE: | 
|---|
| 976 | case IDM_PERMDELETE: | 
|---|
| 977 | { | 
|---|
| 978 | CHECKLIST cl; | 
|---|
| 979 | INT isdir = 0, sysdir = 0, ro = 0, hs = 0; | 
|---|
| 980 | FILESTATUS3 fsa; | 
|---|
| 981 | CHAR prompt[CCHMAXPATH * 3]; | 
|---|
| 982 | APIRET error; | 
|---|
| 983 |  | 
|---|
| 984 | for (x = 0; list[x]; x++) { | 
|---|
| 985 | if (IsRoot(list[x])) { | 
|---|
| 986 | list = RemoveFromList(list, list[x]); | 
|---|
| 987 | if (!list) | 
|---|
| 988 | break; | 
|---|
| 989 | x--; | 
|---|
| 990 | continue; | 
|---|
| 991 | } | 
|---|
| 992 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 993 | if (DosQueryPathInfo(list[x], FIL_STANDARD, &fsa, sizeof(fsa))) { | 
|---|
| 994 | list = RemoveFromList(list, list[x]); | 
|---|
| 995 | if (!list) | 
|---|
| 996 | break; | 
|---|
| 997 | x--; | 
|---|
| 998 | continue; | 
|---|
| 999 | } | 
|---|
| 1000 | if (fsa.attrFile & FILE_DIRECTORY) { | 
|---|
| 1001 | isdir++; | 
|---|
| 1002 | if (stristr(list[x], ":\\OS2\\") || | 
|---|
| 1003 | !stricmp(list[x] + 1, ":\\OS2")) | 
|---|
| 1004 | sysdir++; | 
|---|
| 1005 | } | 
|---|
| 1006 | else { | 
|---|
| 1007 | if (fsa.attrFile & (FILE_HIDDEN | FILE_SYSTEM)) | 
|---|
| 1008 | hs++; | 
|---|
| 1009 | if (fsa.attrFile & FILE_READONLY) | 
|---|
| 1010 | ro++; | 
|---|
| 1011 | } | 
|---|
| 1012 | } | 
|---|
| 1013 | if (!list) | 
|---|
| 1014 | break; | 
|---|
| 1015 | if (fConfirmDelete || isdir) { | 
|---|
| 1016 | memset(&cl, 0, sizeof(cl)); | 
|---|
| 1017 | cl.size = sizeof(cl); | 
|---|
| 1018 | cl.list = list; | 
|---|
| 1019 | cl.prompt = prompt; | 
|---|
| 1020 | cl.flags |= CHECK_FILES; | 
|---|
| 1021 | cl.cmd = SHORT1FROMMP(mp1); | 
|---|
| 1022 | sprintf(prompt, | 
|---|
| 1023 | GetPString(IDS_DELPROMPT1TEXT), | 
|---|
| 1024 | (SHORT1FROMMP(mp1) == IDM_DELETE) ? | 
|---|
| 1025 | NullStr : | 
|---|
| 1026 | GetPString(IDS_PERMANENTLYTEXT), &"s"[list[1] == NULL]); | 
|---|
| 1027 | if (isdir) { | 
|---|
| 1028 | sprintf(&prompt[strlen(prompt)], | 
|---|
| 1029 | GetPString(IDS_DELPROMPT2TEXT), | 
|---|
| 1030 | isdir, | 
|---|
| 1031 | (isdir > 1) ? | 
|---|
| 1032 | GetPString(IDS_ARETEXT) : | 
|---|
| 1033 | GetPString(IDS_ISTEXT), | 
|---|
| 1034 | (isdir == 1) ? | 
|---|
| 1035 | GetPString(IDS_ATEXT) : | 
|---|
| 1036 | NullStr, | 
|---|
| 1037 | (isdir > 1) ? | 
|---|
| 1038 | GetPString(IDS_IESTEXT) : GetPString(IDS_YTEXT)); | 
|---|
| 1039 | if (sysdir) | 
|---|
| 1040 | sprintf(&prompt[strlen(prompt)], | 
|---|
| 1041 | GetPString(IDS_DELPROMPT3TEXT), | 
|---|
| 1042 | sysdir, | 
|---|
| 1043 | (sysdir == 1) ? | 
|---|
| 1044 | GetPString(IDS_YTEXT) : GetPString(IDS_IESTEXT)); | 
|---|
| 1045 | } | 
|---|
| 1046 | if (ro) | 
|---|
| 1047 | sprintf(&prompt[strlen(prompt)], | 
|---|
| 1048 | GetPString(IDS_DELPROMPT4TEXT), | 
|---|
| 1049 | ro, | 
|---|
| 1050 | &"s"[ro == 1], | 
|---|
| 1051 | (ro > 1) ? | 
|---|
| 1052 | GetPString(IDS_ARETEXT) : GetPString(IDS_ISTEXT)); | 
|---|
| 1053 | if (hs) | 
|---|
| 1054 | sprintf(&prompt[strlen(prompt)], | 
|---|
| 1055 | GetPString(IDS_DELPROMPT5TEXT), | 
|---|
| 1056 | hs, | 
|---|
| 1057 | &"s"[hs == 1], | 
|---|
| 1058 | (hs > 1) ? | 
|---|
| 1059 | GetPString(IDS_ARETEXT) : GetPString(IDS_ISTEXT)); | 
|---|
| 1060 | if ((ro || hs || sysdir) && !fAlertBeepOff) | 
|---|
| 1061 | DosBeep(300, 100); | 
|---|
| 1062 | strcat(prompt, GetPString(IDS_DELPROMPT6TEXT)); | 
|---|
| 1063 | if (!WinDlgBox(HWND_DESKTOP, | 
|---|
| 1064 | WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| 1065 | CheckListProc, | 
|---|
| 1066 | FM3ModHandle, CHECK_FRAME, MPFROMP(&cl))) | 
|---|
| 1067 | break; | 
|---|
| 1068 | list = cl.list; | 
|---|
| 1069 | if (!list || !list[0]) | 
|---|
| 1070 | break; | 
|---|
| 1071 | } | 
|---|
| 1072 | for (x = 0; list[x]; x++) { | 
|---|
| 1073 | fsa.attrFile = 0; | 
|---|
| 1074 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 1075 | DosQueryPathInfo(list[x], FIL_STANDARD, &fsa, sizeof(fsa)); | 
|---|
| 1076 | if (fsa.attrFile & FILE_DIRECTORY) { | 
|---|
| 1077 | sprintf(prompt, GetPString(IDS_DELETINGTEXT), list[x]); | 
|---|
| 1078 | WinSetWindowText(WinWindowFromID(hwndFrame, SEEALL_STATUS), | 
|---|
| 1079 | prompt); | 
|---|
| 1080 | error = (APIRET) wipeallf(FALSE, "%s%s*", | 
|---|
| 1081 | list[x], | 
|---|
| 1082 | (*list[x] && | 
|---|
| 1083 | list[x][strlen(list[x]) - 1] != | 
|---|
| 1084 | '\\') ? PCSZ_BACKSLASH : NullStr); | 
|---|
| 1085 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 1086 | if (!error) | 
|---|
| 1087 | error = DosDeleteDir(list[x]); | 
|---|
| 1088 | else | 
|---|
| 1089 | DosDeleteDir(list[x]); | 
|---|
| 1090 | } | 
|---|
| 1091 | else { | 
|---|
| 1092 | INT retrn = 0; | 
|---|
| 1093 |  | 
|---|
| 1094 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 1095 | if (SHORT1FROMMP(mp1) == IDM_DELETE) | 
|---|
| 1096 | error = DosDelete(list[x]); | 
|---|
| 1097 | else | 
|---|
| 1098 | error = DosForceDelete(list[x]); | 
|---|
| 1099 | if (error) { | 
|---|
| 1100 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 1101 | retrn = make_deleteable(list[x], error, ignorereadonly); | 
|---|
| 1102 | if (retrn == SM2_CANCEL) | 
|---|
| 1103 | break; | 
|---|
| 1104 | if (retrn == SM2_DONTASK) | 
|---|
| 1105 | ignorereadonly = TRUE; | 
|---|
| 1106 | if (retrn == SM2_NO) | 
|---|
| 1107 | continue; | 
|---|
| 1108 | if (SHORT1FROMMP(mp1) == IDM_DELETE) | 
|---|
| 1109 | error = DosDelete(list[x]); | 
|---|
| 1110 | else | 
|---|
| 1111 | error = DosForceDelete(list[x]); | 
|---|
| 1112 | } | 
|---|
| 1113 | } | 
|---|
| 1114 | if (error) { | 
|---|
| 1115 | if (LogFileHandle) | 
|---|
| 1116 | fprintf(LogFileHandle, | 
|---|
| 1117 | GetPString(IDS_DELETEFAILED1TEXT), list[x], error); | 
|---|
| 1118 | if (Dos_Error(MB_ENTERCANCEL, | 
|---|
| 1119 | error, | 
|---|
| 1120 | hwndFrame, | 
|---|
| 1121 | pszSrcFile, | 
|---|
| 1122 | __LINE__, | 
|---|
| 1123 | GetPString(IDS_DELETEFAILED2TEXT), | 
|---|
| 1124 | list[x]) == MBID_CANCEL) | 
|---|
| 1125 | break; | 
|---|
| 1126 | } | 
|---|
| 1127 | else if (LogFileHandle) | 
|---|
| 1128 | fprintf(LogFileHandle, | 
|---|
| 1129 | "%s\n", GetPString(IDS_DELETEDTEXT), list[x]); | 
|---|
| 1130 | AddToList(list[x], &files, &numfiles, &numalloc); | 
|---|
| 1131 | } | 
|---|
| 1132 | } | 
|---|
| 1133 | FreeList(list); | 
|---|
| 1134 | break; | 
|---|
| 1135 |  | 
|---|
| 1136 | case IDM_SAVETOLIST: | 
|---|
| 1137 | if (list) { | 
|---|
| 1138 | WinDlgBox(HWND_DESKTOP, | 
|---|
| 1139 | WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| 1140 | SaveAllListDlgProc, | 
|---|
| 1141 | FM3ModHandle, SAV_FRAME, MPFROMP(list)); | 
|---|
| 1142 | FreeList(list); | 
|---|
| 1143 | } | 
|---|
| 1144 | break; | 
|---|
| 1145 |  | 
|---|
| 1146 | case IDM_SAVETOCLIP: | 
|---|
| 1147 | case IDM_APPENDTOCLIP: | 
|---|
| 1148 | case IDM_SAVETOCLIPFILENAME: | 
|---|
| 1149 | case IDM_APPENDTOCLIPFILENAME: | 
|---|
| 1150 | if (list) { | 
|---|
| 1151 | ListToClipboardHab(WinQueryAnchorBlock(hwnd), | 
|---|
| 1152 | list, SHORT1FROMMP(mp1)); | 
|---|
| 1153 | FreeList(list); | 
|---|
| 1154 | } | 
|---|
| 1155 | break; | 
|---|
| 1156 |  | 
|---|
| 1157 | default: | 
|---|
| 1158 | if (list) | 
|---|
| 1159 | FreeList(list); | 
|---|
| 1160 | break; | 
|---|
| 1161 | } | 
|---|
| 1162 |  | 
|---|
| 1163 | switch (SHORT1FROMMP(mp1)) { | 
|---|
| 1164 | case IDM_MOVE: | 
|---|
| 1165 | case IDM_COPY: | 
|---|
| 1166 | case IDM_RENAME: | 
|---|
| 1167 | sprintf(message, | 
|---|
| 1168 | GetPString(IDS_OPSCOMPLETETEXT), | 
|---|
| 1169 | SHORT1FROMMP(mp1) == IDM_MOVE ? | 
|---|
| 1170 | GetPString(IDS_MOVETEXT) : | 
|---|
| 1171 | SHORT1FROMMP(mp1) == IDM_COPY ? | 
|---|
| 1172 | GetPString(IDS_COPYTEXT) : | 
|---|
| 1173 | SHORT1FROMMP(mp1) == IDM_WPSMOVE ? | 
|---|
| 1174 | GetPString(IDS_WPSMOVETEXT) : | 
|---|
| 1175 | SHORT1FROMMP(mp1) == IDM_WPSCOPY ? | 
|---|
| 1176 | GetPString(IDS_WPSCOPYTEXT) : | 
|---|
| 1177 | GetPString(IDS_RENAMETEXT), | 
|---|
| 1178 | &"s"[x == 1], | 
|---|
| 1179 | SHORT1FROMMP(mp1) == IDM_MOVE || | 
|---|
| 1180 | SHORT1FROMMP(mp1) == IDM_COPY || | 
|---|
| 1181 | SHORT1FROMMP(mp1) == IDM_WPSMOVE || | 
|---|
| 1182 | SHORT1FROMMP(mp1) == IDM_WPSCOPY ? | 
|---|
| 1183 | GetPString(IDS_TOTEXT) : NullStr, | 
|---|
| 1184 | SHORT1FROMMP(mp1) == IDM_MOVE || | 
|---|
| 1185 | SHORT1FROMMP(mp1) == IDM_COPY || | 
|---|
| 1186 | SHORT1FROMMP(mp1) == IDM_WPSCOPY ? | 
|---|
| 1187 | path : NullStr, | 
|---|
| 1188 | x != 1 ? GetPString(IDS_ARETEXT) : GetPString(IDS_ISTEXT)); | 
|---|
| 1189 | WinSetWindowText(WinWindowFromID(hwndFrame, SEEALL_STATUS), message); | 
|---|
| 1190 | if (toupper(*path) < 'C' && !fAlertBeepOff) | 
|---|
| 1191 | DosBeep(1000, 25); | 
|---|
| 1192 | DosSleep(16);                   // 05 Aug 07 GKY 33 | 
|---|
| 1193 | break; | 
|---|
| 1194 |  | 
|---|
| 1195 | default: | 
|---|
| 1196 | break; | 
|---|
| 1197 | } | 
|---|
| 1198 | Abort: | 
|---|
| 1199 | if (files) { | 
|---|
| 1200 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| 1201 | UM_UPDATERECORDLIST, MPFROMP(files), MPVOID)) | 
|---|
| 1202 | FreeList(files); | 
|---|
| 1203 | } | 
|---|
| 1204 | PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| 1205 | UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 1206 | } | 
|---|
| 1207 | return 0; | 
|---|
| 1208 |  | 
|---|
| 1209 | case WM_CLOSE: | 
|---|
| 1210 | WinDestroyWindow(hwnd); | 
|---|
| 1211 | break; | 
|---|
| 1212 |  | 
|---|
| 1213 | case WM_DESTROY: | 
|---|
| 1214 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID)) | 
|---|
| 1215 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); | 
|---|
| 1216 | break; | 
|---|
| 1217 | } | 
|---|
| 1218 | return WinDefWindowProc(hwnd, msg, mp1, mp2); | 
|---|
| 1219 | } | 
|---|
| 1220 |  | 
|---|
| 1221 | static VOID MakeSeeObjWinThread(VOID * args) | 
|---|
| 1222 | { | 
|---|
| 1223 | HAB hab2; | 
|---|
| 1224 | HMQ hmq2; | 
|---|
| 1225 | HWND hwndObj; | 
|---|
| 1226 | ALLDATA *ad = (ALLDATA *) args; | 
|---|
| 1227 | QMSG qmsg2; | 
|---|
| 1228 |  | 
|---|
| 1229 | if (ad) { | 
|---|
| 1230 | #   ifdef FORTIFY | 
|---|
| 1231 | Fortify_EnterScope(); | 
|---|
| 1232 | #    endif | 
|---|
| 1233 | hab2 = WinInitialize(0); | 
|---|
| 1234 | if (hab2) { | 
|---|
| 1235 | hmq2 = WinCreateMsgQueue(hab2, 256); | 
|---|
| 1236 | if (hmq2) { | 
|---|
| 1237 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 1238 | WinRegisterClass(hab2, | 
|---|
| 1239 | (CHAR *) WC_OBJECTWINDOW, | 
|---|
| 1240 | SeeObjWndProc, 0, sizeof(PVOID)); | 
|---|
| 1241 | hwndObj = WinCreateWindow(HWND_OBJECT, | 
|---|
| 1242 | (CHAR *) WC_OBJECTWINDOW, | 
|---|
| 1243 | (PSZ) NULL, | 
|---|
| 1244 | 0, | 
|---|
| 1245 | 0, | 
|---|
| 1246 | 0, | 
|---|
| 1247 | 0, | 
|---|
| 1248 | 0, 0, HWND_TOP, SEEALL_OBJ, NULL, NULL); | 
|---|
| 1249 | if (!hwndObj) { | 
|---|
| 1250 | Win_Error(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| 1251 | PCSZ_WINCREATEWINDOW); | 
|---|
| 1252 | if (!PostMsg(ad->hwndClient, WM_CLOSE, MPVOID, MPVOID)) | 
|---|
| 1253 | WinSendMsg(ad->hwndClient, WM_CLOSE, MPVOID, MPVOID); | 
|---|
| 1254 | } | 
|---|
| 1255 | else { | 
|---|
| 1256 | ad->hwndObj = hwndObj; | 
|---|
| 1257 | WinSetWindowULong(hwndObj, QWL_USER, ad->hwndFrame); | 
|---|
| 1258 | priority_normal(); | 
|---|
| 1259 | while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0)) | 
|---|
| 1260 | WinDispatchMsg(hab2, &qmsg2); | 
|---|
| 1261 | WinDestroyWindow(hwndObj); | 
|---|
| 1262 | } | 
|---|
| 1263 | WinDestroyMsgQueue(hmq2); | 
|---|
| 1264 | } | 
|---|
| 1265 | else | 
|---|
| 1266 | WinTerminate(hab2); | 
|---|
| 1267 | } | 
|---|
| 1268 | #   ifdef FORTIFY | 
|---|
| 1269 | Fortify_LeaveScope(); | 
|---|
| 1270 | #    endif | 
|---|
| 1271 | } | 
|---|
| 1272 | } | 
|---|
| 1273 |  | 
|---|
| 1274 | static VOID SelectMask(HWND hwnd, BOOL deselect) | 
|---|
| 1275 | { | 
|---|
| 1276 | MASK mask; | 
|---|
| 1277 | register ULONG x, y, z; | 
|---|
| 1278 | BOOL ret; | 
|---|
| 1279 | ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 1280 |  | 
|---|
| 1281 | memset(&mask, 0, sizeof(mask)); | 
|---|
| 1282 | mask.fNoAttribs = FALSE; | 
|---|
| 1283 | mask.fNoDirs = TRUE; | 
|---|
| 1284 | mask.attrFile = pAD->mask.attrFile; | 
|---|
| 1285 | mask.antiattr = pAD->mask.antiattr; | 
|---|
| 1286 | mask.fIsSeeAll = TRUE; | 
|---|
| 1287 | strcpy(mask.prompt, | 
|---|
| 1288 | GetPString((!deselect) ? | 
|---|
| 1289 | IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT)); | 
|---|
| 1290 | if (WinDlgBox(HWND_DESKTOP, | 
|---|
| 1291 | hwnd, | 
|---|
| 1292 | PickMaskDlgProc, | 
|---|
| 1293 | FM3ModHandle, | 
|---|
| 1294 | MSK_FRAME, | 
|---|
| 1295 | MPFROMP(&mask)) && | 
|---|
| 1296 | (*mask.szMask || | 
|---|
| 1297 | mask.attrFile != pAD->mask.attrFile || | 
|---|
| 1298 | mask.antiattr != pAD->mask.antiattr)) { | 
|---|
| 1299 | for (x = 0; x < pAD->afindexcnt; x++) { | 
|---|
| 1300 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; | 
|---|
| 1301 | ret = FALSE; | 
|---|
| 1302 | if (mask.pszMasks[1]) { | 
|---|
| 1303 | for (z = 0; mask.pszMasks[z]; z++) { | 
|---|
| 1304 | if (*mask.pszMasks[z]) { | 
|---|
| 1305 | if (*mask.pszMasks[z] != '/') { | 
|---|
| 1306 | if (wildcard((strchr(mask.pszMasks[z], '\\') || | 
|---|
| 1307 | strchr(mask.pszMasks[z], ':')) ? | 
|---|
| 1308 | pAD->afindex[y]->fullname : pAD->afindex[y]-> | 
|---|
| 1309 | filename, mask.pszMasks[z], FALSE)) | 
|---|
| 1310 | ret = TRUE; | 
|---|
| 1311 | } | 
|---|
| 1312 | else { | 
|---|
| 1313 | if (wildcard((strchr(mask.pszMasks[z], '\\') || | 
|---|
| 1314 | strchr(mask.pszMasks[z], ':')) ? | 
|---|
| 1315 | pAD->afindex[y]->fullname : pAD->afindex[y]-> | 
|---|
| 1316 | filename, mask.pszMasks[y] + 1, FALSE)) { | 
|---|
| 1317 | ret = FALSE; | 
|---|
| 1318 | break; | 
|---|
| 1319 | } | 
|---|
| 1320 | } | 
|---|
| 1321 | } | 
|---|
| 1322 | } | 
|---|
| 1323 | } | 
|---|
| 1324 | else if (*mask.szMask) { | 
|---|
| 1325 | if (wildcard((strchr(mask.szMask, '\\') || | 
|---|
| 1326 | strchr(mask.szMask, ':')) ? | 
|---|
| 1327 | pAD->afindex[y]->fullname : pAD->afindex[y]->filename, | 
|---|
| 1328 | mask.szMask, FALSE)) | 
|---|
| 1329 | ret = TRUE; | 
|---|
| 1330 | } | 
|---|
| 1331 | else | 
|---|
| 1332 | ret = TRUE; | 
|---|
| 1333 | if (ret) { | 
|---|
| 1334 | if ((!(mask.attrFile & FILE_HIDDEN) | 
|---|
| 1335 | && (pAD->afindex[y]->attrFile & FILE_HIDDEN)) | 
|---|
| 1336 | || (!(mask.attrFile & FILE_SYSTEM) | 
|---|
| 1337 | && (pAD->afindex[y]->attrFile & FILE_SYSTEM)) | 
|---|
| 1338 | || (!(mask.attrFile & FILE_READONLY) | 
|---|
| 1339 | && (pAD->afindex[y]->attrFile & FILE_READONLY)) | 
|---|
| 1340 | || (!(mask.attrFile & FILE_ARCHIVED) | 
|---|
| 1341 | && (pAD->afindex[y]->attrFile & FILE_ARCHIVED))) | 
|---|
| 1342 | ret = FALSE; | 
|---|
| 1343 | else | 
|---|
| 1344 | if (((mask.antiattr & FILE_HIDDEN) | 
|---|
| 1345 | && !(pAD->afindex[y]->attrFile & FILE_HIDDEN)) | 
|---|
| 1346 | || ((mask.antiattr & FILE_SYSTEM) | 
|---|
| 1347 | && !(pAD->afindex[y]->attrFile & FILE_SYSTEM)) | 
|---|
| 1348 | || ((mask.antiattr & FILE_READONLY) | 
|---|
| 1349 | && !(pAD->afindex[y]->attrFile & FILE_READONLY)) | 
|---|
| 1350 | || ((mask.antiattr & FILE_ARCHIVED) | 
|---|
| 1351 | && !(pAD->afindex[y]->attrFile & FILE_ARCHIVED))) | 
|---|
| 1352 | ret = FALSE; | 
|---|
| 1353 | } | 
|---|
| 1354 | if (ret) { | 
|---|
| 1355 | if (deselect) { | 
|---|
| 1356 | if (pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
| 1357 | pAD->selected--; | 
|---|
| 1358 | pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile; | 
|---|
| 1359 | pAD->afindex[y]->flags &= ~AF_SELECTED; | 
|---|
| 1360 | } | 
|---|
| 1361 | } | 
|---|
| 1362 | else { | 
|---|
| 1363 | if (~pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
| 1364 | pAD->selected++; | 
|---|
| 1365 | pAD->ullSelectedBytes += pAD->afindex[y]->cbFile; | 
|---|
| 1366 | pAD->afindex[y]->flags |= AF_SELECTED; | 
|---|
| 1367 | } | 
|---|
| 1368 | } | 
|---|
| 1369 | } | 
|---|
| 1370 | }                                   // for | 
|---|
| 1371 | } | 
|---|
| 1372 | } | 
|---|
| 1373 |  | 
|---|
| 1374 | static VOID CollectList(HWND hwnd, CHAR ** list) | 
|---|
| 1375 | { | 
|---|
| 1376 | if (!Collector) { | 
|---|
| 1377 | if (hwndMain && !fExternalCollector && !strcmp(realappname, FM3Str)) { | 
|---|
| 1378 |  | 
|---|
| 1379 | HWND hwndC; | 
|---|
| 1380 | SWP swp; | 
|---|
| 1381 |  | 
|---|
| 1382 | if (!fAutoTile) | 
|---|
| 1383 | GetNextWindowPos(hwndMain, &swp, NULL, NULL); | 
|---|
| 1384 | hwndC = StartCollector(hwndMain, 4); | 
|---|
| 1385 | if (hwndC) { | 
|---|
| 1386 | if (!fAutoTile) | 
|---|
| 1387 | WinSetWindowPos(hwndC, HWND_TOP, swp.x, swp.y, | 
|---|
| 1388 | swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | | 
|---|
| 1389 | SWP_SHOW | SWP_ZORDER); | 
|---|
| 1390 | else | 
|---|
| 1391 | TileChildren(hwndMain, TRUE); | 
|---|
| 1392 | WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE); | 
|---|
| 1393 | DosSleep(100);//05 Aug 07 GKY 250 | 
|---|
| 1394 | } | 
|---|
| 1395 | } | 
|---|
| 1396 | else { | 
|---|
| 1397 | StartCollector(HWND_DESKTOP, 4); | 
|---|
| 1398 | DosSleep(100);//05 Aug 07 GKY 250 | 
|---|
| 1399 | } | 
|---|
| 1400 | } | 
|---|
| 1401 | if (!PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_COLLECTOR, 0), | 
|---|
| 1402 | MPFROMP(list))) | 
|---|
| 1403 | FreeList(list); | 
|---|
| 1404 | } | 
|---|
| 1405 |  | 
|---|
| 1406 | static VOID FreeAllFilesList(HWND hwnd) | 
|---|
| 1407 | { | 
|---|
| 1408 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 1409 | register ULONG x; | 
|---|
| 1410 |  | 
|---|
| 1411 | if (ad->afhead && ad->afheadcnt) { | 
|---|
| 1412 | for (x = 0; x < ad->afheadcnt; x++) { | 
|---|
| 1413 | xfree(ad->afhead[x].fullname, pszSrcFile, __LINE__); | 
|---|
| 1414 | } | 
|---|
| 1415 | free(ad->afhead); | 
|---|
| 1416 | ad->afhead = NULL; | 
|---|
| 1417 | xfree(ad->afindex, pszSrcFile, __LINE__); | 
|---|
| 1418 | ad->afindex = NULL; | 
|---|
| 1419 | } | 
|---|
| 1420 | DosPostEventSem(CompactSem); | 
|---|
| 1421 | ad->afalloc = ad->afindexcnt = ad->afheadcnt = ad->longest = ad->longestw = | 
|---|
| 1422 | ad->maxx = ad->horzscroll = 0; | 
|---|
| 1423 | } | 
|---|
| 1424 |  | 
|---|
| 1425 | static CHAR **BuildAList(HWND hwnd) | 
|---|
| 1426 | { | 
|---|
| 1427 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 1428 | ULONG x; | 
|---|
| 1429 | ULONG y; | 
|---|
| 1430 | ULONG z = 0; | 
|---|
| 1431 | CHAR **list = NULL; | 
|---|
| 1432 | UINT numfiles = 0; | 
|---|
| 1433 | UINT numalloc = 0; | 
|---|
| 1434 | INT error; | 
|---|
| 1435 |  | 
|---|
| 1436 | if (ad->selected) { | 
|---|
| 1437 | for (x = 0; x < ad->afindexcnt; x++) { | 
|---|
| 1438 | y = (ad->invertsort) ? (ad->afindexcnt - 1) - x : x; | 
|---|
| 1439 | if (ad->afindex[y]->flags & AF_SELECTED) { | 
|---|
| 1440 | error = AddToList(ad->afindex[y]->fullname, &list, | 
|---|
| 1441 | &numfiles, &numalloc); | 
|---|
| 1442 | if (error) | 
|---|
| 1443 | break; | 
|---|
| 1444 | z++; | 
|---|
| 1445 | if (z >= ad->selected) | 
|---|
| 1446 | break; | 
|---|
| 1447 | } | 
|---|
| 1448 | } | 
|---|
| 1449 | } | 
|---|
| 1450 | return list; | 
|---|
| 1451 | } | 
|---|
| 1452 |  | 
|---|
| 1453 | static BOOL Mark(HWND hwnd, INT command, CHAR ** list) | 
|---|
| 1454 | { | 
|---|
| 1455 | // Marks only unfiltered files | 
|---|
| 1456 |  | 
|---|
| 1457 | ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 1458 | register ULONG x, y, z; | 
|---|
| 1459 | BOOL ret = TRUE; | 
|---|
| 1460 | BOOL didone = FALSE; | 
|---|
| 1461 |  | 
|---|
| 1462 | for (x = 0; x < pAD->afindexcnt; x++) { | 
|---|
| 1463 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; | 
|---|
| 1464 | if (list) { | 
|---|
| 1465 | ret = FALSE; | 
|---|
| 1466 | for (z = 0; list[z]; z++) { | 
|---|
| 1467 | if (!stricmp(list[z], pAD->afindex[y]->fullname)) { | 
|---|
| 1468 | ret = TRUE; | 
|---|
| 1469 | break; | 
|---|
| 1470 | } | 
|---|
| 1471 | } | 
|---|
| 1472 | } | 
|---|
| 1473 | if (ret) { | 
|---|
| 1474 | didone = TRUE; | 
|---|
| 1475 | if (command == AFM_UNMARK) { | 
|---|
| 1476 | if (pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
| 1477 | pAD->selected--; | 
|---|
| 1478 | pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile; | 
|---|
| 1479 | pAD->afindex[y]->flags &= ~AF_SELECTED; | 
|---|
| 1480 | } | 
|---|
| 1481 | } | 
|---|
| 1482 | else if (command == AFM_MARK) { | 
|---|
| 1483 | if (~pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
| 1484 | pAD->selected++; | 
|---|
| 1485 | pAD->ullSelectedBytes += pAD->afindex[y]->cbFile; | 
|---|
| 1486 | pAD->afindex[y]->flags |= AF_SELECTED; | 
|---|
| 1487 | } | 
|---|
| 1488 | } | 
|---|
| 1489 | else if (command == AFM_INVERT) { | 
|---|
| 1490 | if (pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
| 1491 | pAD->selected--; | 
|---|
| 1492 | pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile; | 
|---|
| 1493 | pAD->afindex[y]->flags &= ~AF_SELECTED; | 
|---|
| 1494 | } | 
|---|
| 1495 | else { | 
|---|
| 1496 | pAD->selected++; | 
|---|
| 1497 | pAD->ullSelectedBytes += pAD->afindex[y]->cbFile; | 
|---|
| 1498 | pAD->afindex[y]->flags |= AF_SELECTED; | 
|---|
| 1499 | } | 
|---|
| 1500 | } | 
|---|
| 1501 | else if (command == AFM_MARKDELETED) { | 
|---|
| 1502 | if (pAD->afindex[y]->flags & AF_SELECTED) | 
|---|
| 1503 | pAD->afindex[y]->flags |= AF_DELETED; | 
|---|
| 1504 | } | 
|---|
| 1505 | else if (command == AFM_FILTER) { | 
|---|
| 1506 | if (pAD->afindex[y]->flags & AF_SELECTED) | 
|---|
| 1507 | pAD->afindex[y]->flags |= AF_FILTERED; | 
|---|
| 1508 | } | 
|---|
| 1509 | } | 
|---|
| 1510 | }                                     // for x | 
|---|
| 1511 | return didone; | 
|---|
| 1512 | } | 
|---|
| 1513 |  | 
|---|
| 1514 | static BOOL UpdateList(HWND hwnd, CHAR **list) | 
|---|
| 1515 | { | 
|---|
| 1516 | // Updates files in the list | 
|---|
| 1517 |  | 
|---|
| 1518 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 1519 | ULONG x, z; | 
|---|
| 1520 | BOOL ret, didone = FALSE; | 
|---|
| 1521 | FILEFINDBUF3L ffb; | 
|---|
| 1522 | ULONG ulFindCnt; | 
|---|
| 1523 | HDIR hdir; | 
|---|
| 1524 | CHAR *p; | 
|---|
| 1525 |  | 
|---|
| 1526 | if (list) { | 
|---|
| 1527 | for (z = 0; list[z] && !ad->stopflag; z++) { | 
|---|
| 1528 | ret = FALSE; | 
|---|
| 1529 | for (x = 0; x < ad->afheadcnt; x++) { | 
|---|
| 1530 | if (!stricmp(list[z], ad->afhead[x].fullname)) { | 
|---|
| 1531 | ret = TRUE; | 
|---|
| 1532 | break; | 
|---|
| 1533 | } | 
|---|
| 1534 | } | 
|---|
| 1535 | if (ret) { | 
|---|
| 1536 | didone = TRUE; | 
|---|
| 1537 | hdir = HDIR_CREATE; | 
|---|
| 1538 | ulFindCnt = 1; | 
|---|
| 1539 | if (!xDosFindFirst(list[z], &hdir, FILE_NORMAL | FILE_ARCHIVED | | 
|---|
| 1540 | FILE_DIRECTORY | FILE_READONLY | FILE_SYSTEM | | 
|---|
| 1541 | FILE_HIDDEN, &ffb, sizeof(ffb), &ulFindCnt, | 
|---|
| 1542 | FIL_STANDARDL)) { | 
|---|
| 1543 | DosFindClose(hdir); | 
|---|
| 1544 | if (!(ffb.attrFile & FILE_DIRECTORY)) { | 
|---|
| 1545 | ad->afhead[x].attrFile = (USHORT) ffb.attrFile; | 
|---|
| 1546 | ad->afhead[x].cbFile = ffb.cbFile; | 
|---|
| 1547 | ad->afhead[x].date = ffb.fdateLastWrite; | 
|---|
| 1548 | ad->afhead[x].time = ffb.ftimeLastWrite; | 
|---|
| 1549 | } | 
|---|
| 1550 | else | 
|---|
| 1551 | ad->afhead[x].flags |= AF_DELETED; | 
|---|
| 1552 | } | 
|---|
| 1553 | else | 
|---|
| 1554 | ad->afhead[x].flags |= AF_DELETED; | 
|---|
| 1555 | } | 
|---|
| 1556 | else if (isalpha(*list[z]) && ad->abDrvFlags[toupper(*list[z]) - 'A']) { | 
|---|
| 1557 | didone = TRUE; | 
|---|
| 1558 | hdir = HDIR_CREATE; | 
|---|
| 1559 | ulFindCnt = 1; | 
|---|
| 1560 | if (!xDosFindFirst(list[z], &hdir, FILE_NORMAL | FILE_ARCHIVED | | 
|---|
| 1561 | FILE_DIRECTORY | FILE_READONLY | FILE_SYSTEM | | 
|---|
| 1562 | FILE_HIDDEN, &ffb, sizeof(ffb), &ulFindCnt, | 
|---|
| 1563 | FIL_STANDARDL)) { | 
|---|
| 1564 | DosFindClose(hdir); | 
|---|
| 1565 | if (!(ffb.attrFile & FILE_DIRECTORY)) { | 
|---|
| 1566 | if (!ad->afalloc || ad->afheadcnt > ad->afalloc - 1) { | 
|---|
| 1567 |  | 
|---|
| 1568 | ALLFILES *temp, **templ; | 
|---|
| 1569 |  | 
|---|
| 1570 | temp = | 
|---|
| 1571 | xrealloc(ad->afhead, (ad->afalloc + 1) * sizeof(ALLFILES), | 
|---|
| 1572 | pszSrcFile, __LINE__); | 
|---|
| 1573 | if (!temp) { | 
|---|
| 1574 | ad->stopflag = 1; | 
|---|
| 1575 | break; | 
|---|
| 1576 | } | 
|---|
| 1577 | else { | 
|---|
| 1578 | ad->afhead = temp; | 
|---|
| 1579 | templ = | 
|---|
| 1580 | xrealloc(ad->afindex, | 
|---|
| 1581 | (ad->afalloc + 1) * sizeof(ALLFILES *), pszSrcFile, | 
|---|
| 1582 | __LINE__); | 
|---|
| 1583 | if (!templ) { | 
|---|
| 1584 | ad->stopflag = 1; | 
|---|
| 1585 | break; | 
|---|
| 1586 | } | 
|---|
| 1587 | else | 
|---|
| 1588 | ad->afindex = templ; | 
|---|
| 1589 | ad->afalloc++; | 
|---|
| 1590 | } | 
|---|
| 1591 | } | 
|---|
| 1592 | ad->afhead[ad->afheadcnt].fullname = | 
|---|
| 1593 | xstrdup(list[z], pszSrcFile, __LINE__); | 
|---|
| 1594 | if (ad->afhead[ad->afheadcnt].fullname) { | 
|---|
| 1595 | p = strrchr(ad->afhead[ad->afheadcnt].fullname, '\\'); | 
|---|
| 1596 | if (!p) | 
|---|
| 1597 | p = ad->afhead[ad->afheadcnt].fullname; | 
|---|
| 1598 | else | 
|---|
| 1599 | p++; | 
|---|
| 1600 | ad->afhead[ad->afheadcnt].filename = p; | 
|---|
| 1601 | ad->afhead[ad->afheadcnt].cbFile = ffb.cbFile; | 
|---|
| 1602 | ad->afhead[ad->afheadcnt].date = ffb.fdateLastWrite; | 
|---|
| 1603 | ad->afhead[ad->afheadcnt].time = ffb.ftimeLastWrite; | 
|---|
| 1604 | ad->afhead[ad->afheadcnt].attrFile = (USHORT) ffb.attrFile; | 
|---|
| 1605 | ad->afhead[ad->afheadcnt].flags = 0; | 
|---|
| 1606 | if (ad->longest < strlen(ad->afhead[ad->afheadcnt].filename)) | 
|---|
| 1607 | ad->longest = strlen(ad->afhead[ad->afheadcnt].filename); | 
|---|
| 1608 | if (ad->longestw < strlen(ad->afhead[ad->afheadcnt].fullname)) | 
|---|
| 1609 | ad->longestw = strlen(ad->afhead[ad->afheadcnt].fullname); | 
|---|
| 1610 |  | 
|---|
| 1611 | ad->afheadcnt++; | 
|---|
| 1612 | } | 
|---|
| 1613 | else { | 
|---|
| 1614 | ad->stopflag = 1; | 
|---|
| 1615 | break; | 
|---|
| 1616 | } | 
|---|
| 1617 | } | 
|---|
| 1618 | } | 
|---|
| 1619 | } | 
|---|
| 1620 | } | 
|---|
| 1621 | } | 
|---|
| 1622 | return didone; | 
|---|
| 1623 | } | 
|---|
| 1624 |  | 
|---|
| 1625 | static int comparefullnames(const void *v1, const void *v2) | 
|---|
| 1626 | { | 
|---|
| 1627 | ALLFILES *d1 = *(ALLFILES **) v1; | 
|---|
| 1628 | ALLFILES *d2 = *(ALLFILES **) v2; | 
|---|
| 1629 | int ret; | 
|---|
| 1630 |  | 
|---|
| 1631 | ret = stricmp(d1->fullname, d2->fullname); | 
|---|
| 1632 | return ret; | 
|---|
| 1633 | } | 
|---|
| 1634 |  | 
|---|
| 1635 | static int comparenames(const void *v1, const void *v2) | 
|---|
| 1636 | { | 
|---|
| 1637 | ALLFILES *d1 = *(ALLFILES **) v1; | 
|---|
| 1638 | ALLFILES *d2 = *(ALLFILES **) v2; | 
|---|
| 1639 | int ret; | 
|---|
| 1640 |  | 
|---|
| 1641 | ret = stricmp(d1->filename, d2->filename); | 
|---|
| 1642 | if (!ret) | 
|---|
| 1643 | ret = comparefullnames(v1, v2); | 
|---|
| 1644 | return ret; | 
|---|
| 1645 | } | 
|---|
| 1646 |  | 
|---|
| 1647 | static int compareexts(const void *v1, const void *v2) | 
|---|
| 1648 | { | 
|---|
| 1649 | ALLFILES *d1 = *(ALLFILES **) v1; | 
|---|
| 1650 | ALLFILES *d2 = *(ALLFILES **) v2; | 
|---|
| 1651 | register CHAR *p1, *p2; | 
|---|
| 1652 | int ret; | 
|---|
| 1653 |  | 
|---|
| 1654 | p1 = strrchr(d1->filename, '.'); | 
|---|
| 1655 | p2 = strrchr(d2->filename, '.'); | 
|---|
| 1656 | if (!p1) | 
|---|
| 1657 | p1 = NullStr; | 
|---|
| 1658 | else | 
|---|
| 1659 | p1++; | 
|---|
| 1660 | if (!p2) | 
|---|
| 1661 | p2 = NullStr; | 
|---|
| 1662 | else | 
|---|
| 1663 | p2++; | 
|---|
| 1664 | ret = stricmp(p1, p2); | 
|---|
| 1665 | if (!ret) | 
|---|
| 1666 | ret = comparenames(v1, v2); | 
|---|
| 1667 | return ret; | 
|---|
| 1668 | } | 
|---|
| 1669 |  | 
|---|
| 1670 | static int comparesizes(const void *v1, const void *v2) | 
|---|
| 1671 | { | 
|---|
| 1672 | ALLFILES *d1 = *(ALLFILES **) v1; | 
|---|
| 1673 | ALLFILES *d2 = *(ALLFILES **) v2; | 
|---|
| 1674 | int ret; | 
|---|
| 1675 |  | 
|---|
| 1676 | ret = (d1->cbFile > d2->cbFile) ? 1 : (d1->cbFile == d2->cbFile) ? 0 : -1; | 
|---|
| 1677 | if (!ret) | 
|---|
| 1678 | ret = comparenames(v1, v2); | 
|---|
| 1679 | return ret; | 
|---|
| 1680 | } | 
|---|
| 1681 |  | 
|---|
| 1682 | static int comparedates(const void *v1, const void *v2) | 
|---|
| 1683 | { | 
|---|
| 1684 | ALLFILES *d1 = *(ALLFILES **) v1; | 
|---|
| 1685 | ALLFILES *d2 = *(ALLFILES **) v2; | 
|---|
| 1686 | int ret; | 
|---|
| 1687 |  | 
|---|
| 1688 | ret = TestFDates(NULL, NULL, | 
|---|
| 1689 | &d2->date, &d2->time, | 
|---|
| 1690 | &d1->date, &d1->time); | 
|---|
| 1691 |  | 
|---|
| 1692 | if (!ret) | 
|---|
| 1693 | ret = comparenames(v1, v2); | 
|---|
| 1694 | return ret; | 
|---|
| 1695 | } | 
|---|
| 1696 |  | 
|---|
| 1697 | static VOID ReSort(HWND hwnd) | 
|---|
| 1698 | { | 
|---|
| 1699 | ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 1700 | register ULONG x, y; | 
|---|
| 1701 |  | 
|---|
| 1702 | pAD->selected = 0; | 
|---|
| 1703 | pAD->ullSelectedBytes = 0; | 
|---|
| 1704 | for (x = 0, y = 0; x < pAD->afheadcnt; x++) { | 
|---|
| 1705 | if (!(pAD->afhead[x].flags & (AF_DELETED | AF_FILTERED))) { | 
|---|
| 1706 | if (pAD->afhead[x].flags & AF_SELECTED) { | 
|---|
| 1707 | pAD->selected++; | 
|---|
| 1708 | pAD->ullSelectedBytes += pAD->afhead[x].cbFile; | 
|---|
| 1709 | } | 
|---|
| 1710 | pAD->afindex[y++] = &(pAD->afhead[x]); | 
|---|
| 1711 | } | 
|---|
| 1712 | }                                     // for x | 
|---|
| 1713 | pAD->afindexcnt = y; | 
|---|
| 1714 | PostMsg(hwnd, UM_SETUP3, MPVOID, MPVOID); | 
|---|
| 1715 | if (!pAD->stopflag && pAD->pfnCompare && pAD->afindexcnt) { | 
|---|
| 1716 | WinSendMsg(hwnd, UM_RESCAN, MPFROMLONG(1), MPVOID); | 
|---|
| 1717 | qsort(pAD->afindex, pAD->afindexcnt, sizeof(ALLFILES *), pAD->pfnCompare); | 
|---|
| 1718 | } | 
|---|
| 1719 | } | 
|---|
| 1720 |  | 
|---|
| 1721 | VOID FindDupesThread(VOID * args) | 
|---|
| 1722 | { | 
|---|
| 1723 | register ULONG x, z; | 
|---|
| 1724 | register CHAR *px, *pz; | 
|---|
| 1725 | CHAR s[80]; | 
|---|
| 1726 | INT error; | 
|---|
| 1727 | HWND hwnd = (HWND) args; | 
|---|
| 1728 | HAB hab2 = (HAB) 0; | 
|---|
| 1729 | HMQ hmq2 = (HMQ) 0; | 
|---|
| 1730 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 1731 |  | 
|---|
| 1732 | # ifdef FORTIFY | 
|---|
| 1733 | Fortify_EnterScope(); | 
|---|
| 1734 | #  endif | 
|---|
| 1735 | if (!DosRequestMutexSem(ad->hmtxScan, SEM_INDEFINITE_WAIT)) { | 
|---|
| 1736 | priority_normal(); | 
|---|
| 1737 | hab2 = WinInitialize(0); | 
|---|
| 1738 | if (hab2) { | 
|---|
| 1739 | hmq2 = WinCreateMsgQueue(hab2, 0); | 
|---|
| 1740 | if (hmq2) { | 
|---|
| 1741 | WinCancelShutdown(hmq2, TRUE); | 
|---|
| 1742 | IncrThreadUsage(); | 
|---|
| 1743 | if (ad->cursored <= ad->afindexcnt) { | 
|---|
| 1744 | for (x = 0; x < ad->afheadcnt; x++) | 
|---|
| 1745 | ad->afhead[x].flags &= (~(AF_DUPE | AF_SELECTED)); | 
|---|
| 1746 | DosSleep(0);  //26 Aug 07 GKY 1 | 
|---|
| 1747 | for (x = 0; x < ad->afheadcnt && !ad->stopflag; x++) { | 
|---|
| 1748 | if (!(ad->afhead[x].flags & (AF_DUPE | AF_FILTERED))) { | 
|---|
| 1749 | if (!(x % 50)) { | 
|---|
| 1750 | sprintf(s, | 
|---|
| 1751 | GetPString(IDS_DUPECHECKINGOFTEXT), x, ad->afheadcnt); | 
|---|
| 1752 | WinSetWindowText(ad->hwndStatus, s); | 
|---|
| 1753 | } | 
|---|
| 1754 | for (z = 0; z < ad->afheadcnt && !ad->stopflag; z++) { | 
|---|
| 1755 | if (x != z && | 
|---|
| 1756 | !(ad->afhead[z].flags & (AF_DUPE | AF_FILTERED))) | 
|---|
| 1757 | { | 
|---|
| 1758 | if (ad->dupeflags & DP_SIZES) { | 
|---|
| 1759 | if (ad->afhead[x].cbFile != ad->afhead[z].cbFile) | 
|---|
| 1760 | goto SkipNonDupe; | 
|---|
| 1761 | } | 
|---|
| 1762 | if (ad->dupeflags & DP_DATES) { | 
|---|
| 1763 | if (*(INT *) & ad->afhead[x].date != | 
|---|
| 1764 | *(INT *) & ad->afhead[z].date || | 
|---|
| 1765 | *(INT *) & ad->afhead[x].time != | 
|---|
| 1766 | *(INT *) & ad->afhead[z].time) | 
|---|
| 1767 | goto SkipNonDupe; | 
|---|
| 1768 | } | 
|---|
| 1769 | if (ad->dupeflags & DP_NAMES) { | 
|---|
| 1770 | if (ad->dupeflags & DP_EXTS) { | 
|---|
| 1771 | px = strrchr(ad->afhead[x].filename, '.'); | 
|---|
| 1772 | pz = strrchr(ad->afhead[z].filename, '.'); | 
|---|
| 1773 | if ((px || pz) && (!px || !pz)) | 
|---|
| 1774 | goto SkipNonDupe; | 
|---|
| 1775 | if (px) { | 
|---|
| 1776 | *px = 0; | 
|---|
| 1777 | *pz = 0; | 
|---|
| 1778 | } | 
|---|
| 1779 | } | 
|---|
| 1780 | if (stricmp(ad->afhead[x].filename, | 
|---|
| 1781 | ad->afhead[z].filename)) { | 
|---|
| 1782 | if (ad->dupeflags & DP_EXTS) { | 
|---|
| 1783 | if (px) { | 
|---|
| 1784 | *px = '.'; | 
|---|
| 1785 | *pz = '.'; | 
|---|
| 1786 | } | 
|---|
| 1787 | } | 
|---|
| 1788 | goto SkipNonDupe; | 
|---|
| 1789 | } | 
|---|
| 1790 | if (ad->dupeflags & DP_EXTS) { | 
|---|
| 1791 | if (px) { | 
|---|
| 1792 | *px = '.'; | 
|---|
| 1793 | *pz = '.'; | 
|---|
| 1794 | } | 
|---|
| 1795 | } | 
|---|
| 1796 | } | 
|---|
| 1797 | if (ad->dupeflags & DP_CRCS) { | 
|---|
| 1798 | if (!(ad->afhead[x].flags & AF_CRCED)) { | 
|---|
| 1799 | ad->afhead[x].CRC = CRCFile(ad->afhead[x].fullname, | 
|---|
| 1800 | &error); | 
|---|
| 1801 | if (!error) | 
|---|
| 1802 | ad->afhead[x].flags |= AF_CRCED; | 
|---|
| 1803 | } | 
|---|
| 1804 | if (!(ad->afhead[z].flags & AF_CRCED)) { | 
|---|
| 1805 | ad->afhead[z].CRC = CRCFile(ad->afhead[z].fullname, | 
|---|
| 1806 | &error); | 
|---|
| 1807 | if (!error) | 
|---|
| 1808 | ad->afhead[z].flags |= AF_CRCED; | 
|---|
| 1809 | } | 
|---|
| 1810 | if ((ad->afhead[x].flags & AF_CRCED) && | 
|---|
| 1811 | (ad->afhead[z].flags & AF_CRCED)) { | 
|---|
| 1812 | if (ad->afhead[x].CRC != ad->afhead[z].CRC) | 
|---|
| 1813 | goto SkipNonDupe; | 
|---|
| 1814 | } | 
|---|
| 1815 | DosSleep(0); | 
|---|
| 1816 | } | 
|---|
| 1817 | ad->afhead[x].flags |= AF_DUPE; | 
|---|
| 1818 | ad->afhead[z].flags |= AF_DUPE; | 
|---|
| 1819 | SkipNonDupe: | 
|---|
| 1820 | ; | 
|---|
| 1821 | } | 
|---|
| 1822 | } // for | 
|---|
| 1823 | DosSleep(0); | 
|---|
| 1824 | } | 
|---|
| 1825 | } // for | 
|---|
| 1826 | for (x = 0; x < ad->afheadcnt && !ad->stopflag; x++) { | 
|---|
| 1827 | if (!(ad->afhead[x].flags & AF_DUPE)) | 
|---|
| 1828 | ad->afhead[x].flags |= AF_FILTERED; | 
|---|
| 1829 | } | 
|---|
| 1830 | ReSort(hwnd); | 
|---|
| 1831 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 1832 | } | 
|---|
| 1833 | } | 
|---|
| 1834 | } | 
|---|
| 1835 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 1836 | DosReleaseMutexSem(ad->hmtxScan); | 
|---|
| 1837 | } // if got sem | 
|---|
| 1838 | if (hmq2) { | 
|---|
| 1839 | PostMsg(hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID); | 
|---|
| 1840 | WinDestroyMsgQueue(hmq2); | 
|---|
| 1841 | } | 
|---|
| 1842 | if (hab2) { | 
|---|
| 1843 | DecrThreadUsage(); | 
|---|
| 1844 | WinTerminate(hab2); | 
|---|
| 1845 | } | 
|---|
| 1846 | # ifdef FORTIFY | 
|---|
| 1847 | Fortify_LeaveScope(); | 
|---|
| 1848 | #  endif | 
|---|
| 1849 | } | 
|---|
| 1850 |  | 
|---|
| 1851 | static VOID FilterAll(HWND hwnd, ALLDATA *ad); | 
|---|
| 1852 |  | 
|---|
| 1853 | static VOID FilterList(HWND hwnd) | 
|---|
| 1854 | { | 
|---|
| 1855 | ULONG x; | 
|---|
| 1856 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 1857 | CHAR *p; | 
|---|
| 1858 |  | 
|---|
| 1859 | if (ad->cursored <= ad->afindexcnt) { | 
|---|
| 1860 | x = ad->cursored - 1; | 
|---|
| 1861 | x = (ad->invertsort) ? (ad->afindexcnt - 1) - x : x; | 
|---|
| 1862 | p = strrchr(ad->afindex[x]->filename, '.'); | 
|---|
| 1863 | if (p) { | 
|---|
| 1864 | strcpy(ad->mask.szMask, "*"); | 
|---|
| 1865 | strcat(ad->mask.szMask, p); | 
|---|
| 1866 | } | 
|---|
| 1867 | } | 
|---|
| 1868 | *(ad->mask.prompt) = 0; | 
|---|
| 1869 | ad->mask.fIsSeeAll = TRUE; | 
|---|
| 1870 | if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc, | 
|---|
| 1871 | FM3ModHandle, MSK_FRAME, MPFROMP(&ad->mask))) | 
|---|
| 1872 | FilterAll(hwnd, ad); | 
|---|
| 1873 | } | 
|---|
| 1874 |  | 
|---|
| 1875 | static VOID FilterAll(HWND hwnd, ALLDATA *ad) | 
|---|
| 1876 | { | 
|---|
| 1877 | ULONG x, z; | 
|---|
| 1878 | BOOL ret; | 
|---|
| 1879 |  | 
|---|
| 1880 | if (ad) { | 
|---|
| 1881 | for (x = 0; x < ad->afheadcnt; x++) { | 
|---|
| 1882 | ret = FALSE; | 
|---|
| 1883 | if (ad->mask.pszMasks[1]) { | 
|---|
| 1884 | for (z = 0; ad->mask.pszMasks[z]; z++) { | 
|---|
| 1885 | if (*ad->mask.pszMasks[z]) { | 
|---|
| 1886 | if (*ad->mask.pszMasks[z] != '/') { | 
|---|
| 1887 | if (wildcard((strchr(ad->mask.pszMasks[z], '\\') || | 
|---|
| 1888 | strchr(ad->mask.pszMasks[z], ':')) ? | 
|---|
| 1889 | ad->afhead[x].fullname : ad->afhead[x].filename, | 
|---|
| 1890 | ad->mask.pszMasks[z], FALSE)) | 
|---|
| 1891 | ret = TRUE; | 
|---|
| 1892 | } | 
|---|
| 1893 | else { | 
|---|
| 1894 | if (wildcard((strchr(ad->mask.pszMasks[z], '\\') || | 
|---|
| 1895 | strchr(ad->mask.pszMasks[z], ':')) ? | 
|---|
| 1896 | ad->afhead[x].fullname : ad->afhead[x].filename, | 
|---|
| 1897 | ad->mask.pszMasks[z] + 1, FALSE)) { | 
|---|
| 1898 | ret = FALSE; | 
|---|
| 1899 | break; | 
|---|
| 1900 | } | 
|---|
| 1901 | } | 
|---|
| 1902 | } | 
|---|
| 1903 | } | 
|---|
| 1904 | } | 
|---|
| 1905 | else if (*ad->mask.szMask) { | 
|---|
| 1906 | if (wildcard((strchr(ad->mask.szMask, '\\') || | 
|---|
| 1907 | strchr(ad->mask.szMask, ':')) ? | 
|---|
| 1908 | ad->afhead[x].fullname : ad->afhead[x].filename, | 
|---|
| 1909 | ad->mask.szMask, FALSE)) | 
|---|
| 1910 | ret = TRUE; | 
|---|
| 1911 | } | 
|---|
| 1912 | else | 
|---|
| 1913 | ret = TRUE; | 
|---|
| 1914 |  | 
|---|
| 1915 | if (ret) { | 
|---|
| 1916 | if ((!(ad->mask.attrFile & FILE_HIDDEN) | 
|---|
| 1917 | && (ad->afhead[x].attrFile & FILE_HIDDEN)) | 
|---|
| 1918 | || (!(ad->mask.attrFile & FILE_SYSTEM) | 
|---|
| 1919 | && (ad->afhead[x].attrFile & FILE_SYSTEM)) | 
|---|
| 1920 | || (!(ad->mask.attrFile & FILE_READONLY) | 
|---|
| 1921 | && (ad->afhead[x].attrFile & FILE_READONLY)) | 
|---|
| 1922 | || (!(ad->mask.attrFile & FILE_ARCHIVED) | 
|---|
| 1923 | && (ad->afhead[x].attrFile & FILE_ARCHIVED))) | 
|---|
| 1924 | ret = FALSE; | 
|---|
| 1925 | else | 
|---|
| 1926 | if (((ad->mask.antiattr & FILE_HIDDEN) | 
|---|
| 1927 | && !(ad->afhead[x].attrFile & FILE_HIDDEN)) | 
|---|
| 1928 | || ((ad->mask.antiattr & FILE_SYSTEM) | 
|---|
| 1929 | && !(ad->afhead[x].attrFile & FILE_SYSTEM)) | 
|---|
| 1930 | || ((ad->mask.antiattr & FILE_READONLY) | 
|---|
| 1931 | && !(ad->afhead[x].attrFile & FILE_READONLY)) | 
|---|
| 1932 | || ((ad->mask.antiattr & FILE_ARCHIVED) | 
|---|
| 1933 | && !(ad->afhead[x].attrFile & FILE_ARCHIVED))) | 
|---|
| 1934 | ret = FALSE; | 
|---|
| 1935 | } | 
|---|
| 1936 |  | 
|---|
| 1937 | if (!ret) | 
|---|
| 1938 | ad->afhead[x].flags |= AF_FILTERED; | 
|---|
| 1939 | else | 
|---|
| 1940 | ad->afhead[x].flags &= (~AF_FILTERED); | 
|---|
| 1941 | } | 
|---|
| 1942 | ReSort(hwnd); | 
|---|
| 1943 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 1944 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 1945 | } | 
|---|
| 1946 | } | 
|---|
| 1947 |  | 
|---|
| 1948 | static ULONG RemoveDeleted(HWND hwnd) | 
|---|
| 1949 | { | 
|---|
| 1950 | ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 1951 | ULONG oldafheadcnt = pAD->afheadcnt; | 
|---|
| 1952 | register ULONG x, y; | 
|---|
| 1953 |  | 
|---|
| 1954 | for (x = 0; x < pAD->afheadcnt; x++) { | 
|---|
| 1955 | if (pAD->afhead[x].flags & AF_DELETED) { | 
|---|
| 1956 | for (y = x; y < pAD->afheadcnt; y++) { | 
|---|
| 1957 | if (~pAD->afhead[y].flags & AF_DELETED) | 
|---|
| 1958 | break; | 
|---|
| 1959 | if (pAD->afhead[y].flags & AF_SELECTED && | 
|---|
| 1960 | ~pAD->afhead[y].flags & AF_FILTERED) { | 
|---|
| 1961 | pAD->selected--; | 
|---|
| 1962 | pAD->ullSelectedBytes -= pAD->afhead[y].cbFile; | 
|---|
| 1963 | } | 
|---|
| 1964 | xfree(pAD->afhead[y].fullname, pszSrcFile, __LINE__); | 
|---|
| 1965 | } | 
|---|
| 1966 | memmove(&(pAD->afhead[x]), &(pAD->afhead[y]), | 
|---|
| 1967 | (pAD->afheadcnt - y) * sizeof(ALLFILES)); | 
|---|
| 1968 | pAD->afheadcnt -= (y - x); | 
|---|
| 1969 | } | 
|---|
| 1970 | }                                     // for x | 
|---|
| 1971 | if (pAD->afheadcnt != oldafheadcnt) { | 
|---|
| 1972 |  | 
|---|
| 1973 | ALLFILES *tempa, **templ; | 
|---|
| 1974 |  | 
|---|
| 1975 | if (!pAD->afheadcnt) | 
|---|
| 1976 | FreeAllFilesList(hwnd); | 
|---|
| 1977 | else { | 
|---|
| 1978 | tempa = | 
|---|
| 1979 | xrealloc(pAD->afhead, pAD->afheadcnt * sizeof(ALLFILES), pszSrcFile, | 
|---|
| 1980 | __LINE__); | 
|---|
| 1981 | if (tempa) { | 
|---|
| 1982 | pAD->afhead = tempa; | 
|---|
| 1983 | pAD->afalloc = pAD->afheadcnt; | 
|---|
| 1984 | } | 
|---|
| 1985 | templ = | 
|---|
| 1986 | xrealloc(pAD->afindex, pAD->afheadcnt * sizeof(ALLFILES *), pszSrcFile, | 
|---|
| 1987 | __LINE__); | 
|---|
| 1988 | if (templ) | 
|---|
| 1989 | pAD->afindex = templ; | 
|---|
| 1990 | DosPostEventSem(CompactSem); | 
|---|
| 1991 | ReSort(hwnd); | 
|---|
| 1992 | } | 
|---|
| 1993 | } | 
|---|
| 1994 | return pAD->afheadcnt; | 
|---|
| 1995 | } | 
|---|
| 1996 |  | 
|---|
| 1997 | static VOID DoADir(HWND hwnd, CHAR * pathname) | 
|---|
| 1998 | { | 
|---|
| 1999 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 2000 | CHAR *filename, *enddir; | 
|---|
| 2001 | PFILEFINDBUF3L pffbArray, pffbFile; | 
|---|
| 2002 | HDIR hdir = HDIR_CREATE; | 
|---|
| 2003 | ULONG ulFindCnt; | 
|---|
| 2004 | ULONG ulFindMax; | 
|---|
| 2005 | ULONG ulBufBytes; | 
|---|
| 2006 | ULONG x; | 
|---|
| 2007 | APIRET rc; | 
|---|
| 2008 | static BOOL fDone; | 
|---|
| 2009 |  | 
|---|
| 2010 | filename = xmalloc(CCHMAXPATH + 100, pszSrcFile, __LINE__); | 
|---|
| 2011 | if (!filename) | 
|---|
| 2012 | return; | 
|---|
| 2013 |  | 
|---|
| 2014 | ulFindMax = FilesToGet; | 
|---|
| 2015 | if (fRemoteBug && isalpha(*pathname) && pathname[1] == ':' && | 
|---|
| 2016 | pathname[2] == '\\' && | 
|---|
| 2017 | (driveflags[toupper(*pathname) - 'A'] & DRIVE_REMOTE)) | 
|---|
| 2018 | ulFindMax = 1; | 
|---|
| 2019 |  | 
|---|
| 2020 | ulBufBytes = sizeof(FILEFINDBUF3L) * ulFindMax; | 
|---|
| 2021 | pffbArray = xmalloc(ulBufBytes, pszSrcFile, __LINE__); | 
|---|
| 2022 | if (!pffbArray) { | 
|---|
| 2023 | free(filename); | 
|---|
| 2024 | return; | 
|---|
| 2025 | } | 
|---|
| 2026 |  | 
|---|
| 2027 | strcpy(filename, pathname); | 
|---|
| 2028 | enddir = &filename[strlen(filename) - 1]; | 
|---|
| 2029 | if (*enddir != '\\') { | 
|---|
| 2030 | enddir++; | 
|---|
| 2031 | *enddir = '\\'; | 
|---|
| 2032 | } | 
|---|
| 2033 | enddir++; | 
|---|
| 2034 | strcpy(enddir, "*"); | 
|---|
| 2035 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 2036 | ulFindCnt = ulFindMax; | 
|---|
| 2037 | rc = xDosFindFirst(filename, &hdir, FILE_NORMAL | FILE_ARCHIVED | | 
|---|
| 2038 | FILE_READONLY | FILE_DIRECTORY | FILE_SYSTEM | | 
|---|
| 2039 | FILE_HIDDEN, | 
|---|
| 2040 | pffbArray, ulBufBytes, &ulFindCnt, FIL_STANDARDL); | 
|---|
| 2041 | if (!rc) { | 
|---|
| 2042 | do { | 
|---|
| 2043 | priority_normal(); | 
|---|
| 2044 | pffbFile = pffbArray; | 
|---|
| 2045 |  | 
|---|
| 2046 | for (x = 0; x < ulFindCnt; x++) { | 
|---|
| 2047 | if (ad->stopflag) | 
|---|
| 2048 | break; | 
|---|
| 2049 | if (pffbFile->attrFile & FILE_DIRECTORY) { | 
|---|
| 2050 | // Skip . and .. | 
|---|
| 2051 | if (pffbFile->achName[0] != '.' || | 
|---|
| 2052 | (pffbFile->achName[1] && | 
|---|
| 2053 | (pffbFile->achName[1] != '.' || pffbFile->achName[2]))) { | 
|---|
| 2054 | strcpy(enddir, pffbFile->achName); | 
|---|
| 2055 | DoADir(hwnd, filename); | 
|---|
| 2056 | } | 
|---|
| 2057 | } | 
|---|
| 2058 | else { | 
|---|
| 2059 | *enddir = 0; | 
|---|
| 2060 | strcpy(enddir, pffbFile->achName); | 
|---|
| 2061 | if (strlen(filename) > CCHMAXPATH) { | 
|---|
| 2062 | // Complain if pathnames exceeds max | 
|---|
| 2063 | DosFindClose(hdir); | 
|---|
| 2064 | free(pffbArray); | 
|---|
| 2065 | free(filename); | 
|---|
| 2066 | if (!fDone) { | 
|---|
| 2067 | fDone = TRUE; | 
|---|
| 2068 | saymsg(MB_OK | MB_ICONASTERISK, | 
|---|
| 2069 | HWND_DESKTOP, | 
|---|
| 2070 | GetPString(IDS_WARNINGTEXT), | 
|---|
| 2071 | GetPString(IDS_LENGTHEXCEEDSMAXPATHTEXT)); | 
|---|
| 2072 | } | 
|---|
| 2073 | return; | 
|---|
| 2074 | } | 
|---|
| 2075 | if (!ad->afalloc || ad->afheadcnt > ad->afalloc - 1) { | 
|---|
| 2076 |  | 
|---|
| 2077 | ALLFILES *temp; | 
|---|
| 2078 |  | 
|---|
| 2079 | temp = xrealloc(ad->afhead, (ad->afalloc + 1000) * | 
|---|
| 2080 | sizeof(ALLFILES), pszSrcFile, __LINE__); | 
|---|
| 2081 | if (!temp) { | 
|---|
| 2082 | ad->stopflag = 1; | 
|---|
| 2083 | break; | 
|---|
| 2084 | } | 
|---|
| 2085 | else { | 
|---|
| 2086 | ad->afhead = temp; | 
|---|
| 2087 | if (ad->stopflag) | 
|---|
| 2088 | break; | 
|---|
| 2089 | ad->afalloc += 1000; | 
|---|
| 2090 | } | 
|---|
| 2091 | } | 
|---|
| 2092 | ad->afhead[ad->afheadcnt].fullname = | 
|---|
| 2093 | xstrdup(filename, pszSrcFile, __LINE__); | 
|---|
| 2094 | if (!ad->afhead[ad->afheadcnt].fullname) { | 
|---|
| 2095 | ad->stopflag = 1; | 
|---|
| 2096 | break; | 
|---|
| 2097 | } | 
|---|
| 2098 | else { | 
|---|
| 2099 | ad->afhead[ad->afheadcnt].filename = | 
|---|
| 2100 | ad->afhead[ad->afheadcnt].fullname + (enddir - filename); | 
|---|
| 2101 | ad->afhead[ad->afheadcnt].cbFile = pffbFile->cbFile; | 
|---|
| 2102 | ad->afhead[ad->afheadcnt].date = pffbFile->fdateLastWrite; | 
|---|
| 2103 | ad->afhead[ad->afheadcnt].time = pffbFile->ftimeLastWrite; | 
|---|
| 2104 | ad->afhead[ad->afheadcnt].attrFile = (USHORT) pffbFile->attrFile; | 
|---|
| 2105 | ad->afhead[ad->afheadcnt].flags = 0; | 
|---|
| 2106 | ad->afheadcnt++; | 
|---|
| 2107 | if (ad->longest < pffbFile->cchName) | 
|---|
| 2108 | ad->longest = pffbFile->cchName; | 
|---|
| 2109 | if (ad->longestw < pffbFile->cchName + (enddir - filename)) | 
|---|
| 2110 | ad->longestw = pffbFile->cchName + (enddir - filename); | 
|---|
| 2111 | } | 
|---|
| 2112 | } | 
|---|
| 2113 | pffbFile = (PFILEFINDBUF3L)((PBYTE)pffbFile + pffbFile->oNextEntryOffset); | 
|---|
| 2114 | } // for | 
|---|
| 2115 |  | 
|---|
| 2116 | if (ad->stopflag) | 
|---|
| 2117 | break; | 
|---|
| 2118 |  | 
|---|
| 2119 | ulFindCnt = ulFindMax; | 
|---|
| 2120 | rc = xDosFindNext(hdir, | 
|---|
| 2121 | pffbArray, | 
|---|
| 2122 | sizeof(FILEFINDBUF3L) * ulFindCnt, | 
|---|
| 2123 | &ulFindCnt, | 
|---|
| 2124 | FIL_STANDARDL); | 
|---|
| 2125 | } while (!rc); | 
|---|
| 2126 | DosFindClose(hdir); | 
|---|
| 2127 | } | 
|---|
| 2128 |  | 
|---|
| 2129 | if (rc && rc != ERROR_NO_MORE_FILES) { | 
|---|
| 2130 | Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| 2131 | GetPString(IDS_CANTFINDDIRTEXT), filename); | 
|---|
| 2132 | } | 
|---|
| 2133 |  | 
|---|
| 2134 | free(pffbArray); | 
|---|
| 2135 | free(filename); | 
|---|
| 2136 | } | 
|---|
| 2137 |  | 
|---|
| 2138 | static VOID FindAllThread(VOID * args) | 
|---|
| 2139 | { | 
|---|
| 2140 | ULONG ulDriveNum, ulDriveMap, x; | 
|---|
| 2141 | CHAR startname[] = " :\\"; | 
|---|
| 2142 | HWND hwnd = (HWND) args; | 
|---|
| 2143 | HAB hab2 = (HAB) 0; | 
|---|
| 2144 | HMQ hmq2 = (HMQ) 0; | 
|---|
| 2145 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 2146 | APIRET apiret; | 
|---|
| 2147 |  | 
|---|
| 2148 | # ifdef FORTIFY | 
|---|
| 2149 | Fortify_EnterScope(); | 
|---|
| 2150 | #  endif | 
|---|
| 2151 |  | 
|---|
| 2152 | // DbgMsg(pszSrcFile, __LINE__, "FindAllThread requesting hmtxScan"); | 
|---|
| 2153 | apiret = DosRequestMutexSem(ad->hmtxScan, SEM_INDEFINITE_WAIT); | 
|---|
| 2154 | if (apiret != NO_ERROR) | 
|---|
| 2155 | Dos_Error(MB_CANCEL, apiret, hwnd, pszSrcFile, __LINE__, "DosRequestMutexSem"); | 
|---|
| 2156 | else { | 
|---|
| 2157 | priority_normal(); | 
|---|
| 2158 | hab2 = WinInitialize(0); | 
|---|
| 2159 |  | 
|---|
| 2160 | if (hab2) { | 
|---|
| 2161 | hmq2 = WinCreateMsgQueue(hab2, 0); | 
|---|
| 2162 | if (hmq2) { | 
|---|
| 2163 | WinCancelShutdown(hmq2, TRUE); | 
|---|
| 2164 | IncrThreadUsage(); | 
|---|
| 2165 | if (!*ad->szFindPath) { | 
|---|
| 2166 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 2167 | if (!DosQCurDisk(&ulDriveNum, &ulDriveMap)) { | 
|---|
| 2168 | for (x = 2; x < 26 && !ad->stopflag; x++) { | 
|---|
| 2169 | if ((ulDriveMap & (1 << x)) && ad->abDrvFlags[x]) { | 
|---|
| 2170 | *startname = (CHAR) (x + 'A'); | 
|---|
| 2171 | DoADir(hwnd, startname); | 
|---|
| 2172 | if (ad->stopflag) | 
|---|
| 2173 | break; | 
|---|
| 2174 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 2175 | DosSleep(0); //26 Aug 07 GKY 1 | 
|---|
| 2176 | } | 
|---|
| 2177 | } // for | 
|---|
| 2178 | } | 
|---|
| 2179 | } | 
|---|
| 2180 | else | 
|---|
| 2181 | DoADir(hwnd, ad->szFindPath); | 
|---|
| 2182 |  | 
|---|
| 2183 | DosPostEventSem(CompactSem); | 
|---|
| 2184 | } | 
|---|
| 2185 | } | 
|---|
| 2186 |  | 
|---|
| 2187 | if (!ad->stopflag) { | 
|---|
| 2188 | if (ad->afalloc != ad->afheadcnt) { | 
|---|
| 2189 |  | 
|---|
| 2190 | ALLFILES *tempa, **templ; | 
|---|
| 2191 |  | 
|---|
| 2192 | tempa = | 
|---|
| 2193 | xrealloc(ad->afhead, sizeof(ALLFILES) * ad->afheadcnt, pszSrcFile, | 
|---|
| 2194 | __LINE__); | 
|---|
| 2195 | if (tempa) { | 
|---|
| 2196 | ad->afhead = tempa; | 
|---|
| 2197 | ad->afalloc = ad->afheadcnt; | 
|---|
| 2198 | } | 
|---|
| 2199 | templ = | 
|---|
| 2200 | xrealloc(ad->afindex, sizeof(ALLFILES *) * ad->afheadcnt, pszSrcFile, | 
|---|
| 2201 | __LINE__); | 
|---|
| 2202 | if (templ) | 
|---|
| 2203 | ad->afindex = templ; | 
|---|
| 2204 | DosPostEventSem(CompactSem); | 
|---|
| 2205 | } | 
|---|
| 2206 | PostMsg(hwnd, UM_RESCAN, MPFROMLONG(1), MPVOID); | 
|---|
| 2207 | ReSort(hwnd); | 
|---|
| 2208 | } | 
|---|
| 2209 |  | 
|---|
| 2210 | // DbgMsg(pszSrcFile, __LINE__, "FindAllThread releasing hmtxScan"); | 
|---|
| 2211 | DosReleaseMutexSem(ad->hmtxScan); | 
|---|
| 2212 | } | 
|---|
| 2213 |  | 
|---|
| 2214 | if (hmq2) { | 
|---|
| 2215 | PostMsg(hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID); | 
|---|
| 2216 | WinDestroyMsgQueue(hmq2); | 
|---|
| 2217 | } | 
|---|
| 2218 |  | 
|---|
| 2219 | if (hab2) { | 
|---|
| 2220 | DecrThreadUsage(); | 
|---|
| 2221 | WinTerminate(hab2); | 
|---|
| 2222 | } | 
|---|
| 2223 |  | 
|---|
| 2224 | # ifdef FORTIFY | 
|---|
| 2225 | Fortify_LeaveScope(); | 
|---|
| 2226 | #  endif | 
|---|
| 2227 | } | 
|---|
| 2228 |  | 
|---|
| 2229 | MRESULT EXPENTRY AFDrvsWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| 2230 | { | 
|---|
| 2231 | switch (msg) { | 
|---|
| 2232 | case WM_INITDLG: | 
|---|
| 2233 | if (mp2) { | 
|---|
| 2234 |  | 
|---|
| 2235 | ULONG ulDriveNum, ulDriveMap, x; | 
|---|
| 2236 | CHAR startname[] = " :"; | 
|---|
| 2237 | SHORT sSelect; | 
|---|
| 2238 | ALLDATA *ad; | 
|---|
| 2239 |  | 
|---|
| 2240 | ad = (ALLDATA *) mp2; | 
|---|
| 2241 | WinSetWindowPtr(hwnd, QWL_USER, mp2); | 
|---|
| 2242 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 2243 | if (!DosQCurDisk(&ulDriveNum, &ulDriveMap)) { | 
|---|
| 2244 | for (x = 2; x < 26 && !ad->stopflag; x++) { | 
|---|
| 2245 | if (!(driveflags[x] & (DRIVE_IGNORE | DRIVE_INVALID))) { | 
|---|
| 2246 | if (ulDriveMap & (1 << x)) { | 
|---|
| 2247 | *startname = (CHAR) (x + 'A'); | 
|---|
| 2248 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd, DRVS_LISTBOX, | 
|---|
| 2249 | LM_INSERTITEM, | 
|---|
| 2250 | MPFROM2SHORT(LIT_END, 0), | 
|---|
| 2251 | MPFROMP(startname)); | 
|---|
| 2252 | if (sSelect >= 0 && ad->abDrvFlags[x]) | 
|---|
| 2253 | WinSendDlgItemMsg(hwnd, DRVS_LISTBOX, LM_SELECTITEM, | 
|---|
| 2254 | MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE)); | 
|---|
| 2255 | } | 
|---|
| 2256 | } | 
|---|
| 2257 | } | 
|---|
| 2258 | } | 
|---|
| 2259 | } | 
|---|
| 2260 | else | 
|---|
| 2261 | WinDismissDlg(hwnd, 0); | 
|---|
| 2262 | break; | 
|---|
| 2263 |  | 
|---|
| 2264 | case WM_CONTROL: | 
|---|
| 2265 | switch (SHORT1FROMMP(mp1)) { | 
|---|
| 2266 | case DRVS_LISTBOX: | 
|---|
| 2267 | switch (SHORT2FROMMP(mp1)) { | 
|---|
| 2268 | case LN_ENTER: | 
|---|
| 2269 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID); | 
|---|
| 2270 | break; | 
|---|
| 2271 | } | 
|---|
| 2272 | break; | 
|---|
| 2273 | } | 
|---|
| 2274 | return 0; | 
|---|
| 2275 |  | 
|---|
| 2276 | case WM_COMMAND: | 
|---|
| 2277 | switch (SHORT1FROMMP(mp1)) { | 
|---|
| 2278 | case DID_OK: | 
|---|
| 2279 | { | 
|---|
| 2280 | INT x; | 
|---|
| 2281 | SHORT sSelect; | 
|---|
| 2282 | CHAR filename[3]; | 
|---|
| 2283 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 2284 |  | 
|---|
| 2285 | memset(ad->abDrvFlags, 0, sizeof(ad->abDrvFlags)); | 
|---|
| 2286 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd, DRVS_LISTBOX, | 
|---|
| 2287 | LM_QUERYSELECTION, | 
|---|
| 2288 | MPFROM2SHORT(LIT_FIRST, 0), | 
|---|
| 2289 | MPVOID); | 
|---|
| 2290 | while (sSelect >= 0) { | 
|---|
| 2291 | *filename = 0; | 
|---|
| 2292 | if (WinSendDlgItemMsg(hwnd, DRVS_LISTBOX, LM_QUERYITEMTEXT, | 
|---|
| 2293 | MPFROM2SHORT(sSelect, 2), | 
|---|
| 2294 | MPFROMP(filename)) && *filename) | 
|---|
| 2295 | ad->abDrvFlags[*filename - 'A'] = 1; | 
|---|
| 2296 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd, DRVS_LISTBOX, | 
|---|
| 2297 | LM_QUERYSELECTION, | 
|---|
| 2298 | MPFROM2SHORT(sSelect, 0), | 
|---|
| 2299 | MPVOID); | 
|---|
| 2300 | } | 
|---|
| 2301 | for (x = 2; x < 26; x++) { | 
|---|
| 2302 | if (ad->abDrvFlags[x]) { | 
|---|
| 2303 | WinDismissDlg(hwnd, 1); | 
|---|
| 2304 | return 0; | 
|---|
| 2305 | } | 
|---|
| 2306 | } | 
|---|
| 2307 | } | 
|---|
| 2308 | WinDismissDlg(hwnd, 0); | 
|---|
| 2309 | break; | 
|---|
| 2310 |  | 
|---|
| 2311 | case IDM_HELP: | 
|---|
| 2312 | if (hwndHelp) | 
|---|
| 2313 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP, | 
|---|
| 2314 | MPFROM2SHORT(HELP_DRVSWND, 0), MPFROMSHORT(HM_RESOURCEID)); | 
|---|
| 2315 | break; | 
|---|
| 2316 |  | 
|---|
| 2317 | case DID_CANCEL: | 
|---|
| 2318 | WinDismissDlg(hwnd, 0); | 
|---|
| 2319 | break; | 
|---|
| 2320 | } | 
|---|
| 2321 | return 0; | 
|---|
| 2322 | } | 
|---|
| 2323 | return WinDefDlgProc(hwnd, msg, mp1, mp2); | 
|---|
| 2324 | } | 
|---|
| 2325 |  | 
|---|
| 2326 | static HPS InitWindow(HWND hwnd) | 
|---|
| 2327 | { | 
|---|
| 2328 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 2329 | HPS hps = (HPS) 0; | 
|---|
| 2330 | SIZEL sizel; | 
|---|
| 2331 | FONTMETRICS FontMetrics; | 
|---|
| 2332 |  | 
|---|
| 2333 | if (ad) { | 
|---|
| 2334 | sizel.cx = sizel.cy = 0; | 
|---|
| 2335 | hps = GpiCreatePS(WinQueryAnchorBlock(hwnd), WinOpenWindowDC(hwnd), | 
|---|
| 2336 | (PSIZEL) & sizel, PU_PELS | GPIF_DEFAULT | GPIT_MICRO | | 
|---|
| 2337 | GPIA_ASSOC); | 
|---|
| 2338 | if (hps) { | 
|---|
| 2339 | GpiSetCp(hps, (ULONG) ad->fattrs.usCodePage); | 
|---|
| 2340 | GpiCreateLogFont(hps, NULL, SEEALLFILECNR_FONT_LCID, &ad->fattrs); | 
|---|
| 2341 | GpiSetCharSet(hps, SEEALLFILECNR_FONT_LCID); | 
|---|
| 2342 | GpiQueryFontMetrics(hps, sizeof(FontMetrics), &FontMetrics); | 
|---|
| 2343 | ad->fattrs.lAveCharWidth = FontMetrics.lAveCharWidth; | 
|---|
| 2344 | ad->fattrs.lMaxBaselineExt = FontMetrics.lMaxBaselineExt; | 
|---|
| 2345 | ad->lMaxAscender = max(FontMetrics.lMaxAscender, 0); | 
|---|
| 2346 | ad->lMaxDescender = max(FontMetrics.lMaxDescender, 0); | 
|---|
| 2347 | ad->lMaxHeight = ad->lMaxDescender + ad->lMaxAscender; | 
|---|
| 2348 | if (ad->fattrs.usCodePage != FontMetrics.usCodePage) { | 
|---|
| 2349 | ad->fattrs.usCodePage = FontMetrics.usCodePage; | 
|---|
| 2350 | Codepage = ad->fattrs.usCodePage; | 
|---|
| 2351 | PrfWriteProfileData(fmprof, | 
|---|
| 2352 | appname, | 
|---|
| 2353 | "Seeall.Codepage", | 
|---|
| 2354 | &ad->fattrs.usCodePage, sizeof(USHORT)); | 
|---|
| 2355 | } | 
|---|
| 2356 | else if (ad->fattrs.usCodePage) { | 
|---|
| 2357 |  | 
|---|
| 2358 | HMQ hmq; | 
|---|
| 2359 | ULONG cps[50], len, x; | 
|---|
| 2360 |  | 
|---|
| 2361 | if (!DosQueryCp(sizeof(cps), cps, &len)) { | 
|---|
| 2362 | for (x = 0; x < len / sizeof(ULONG); x++) { | 
|---|
| 2363 | if (cps[x] == (ULONG) ad->fattrs.usCodePage) { | 
|---|
| 2364 | hmq = WinQueryWindowULong(hwnd, QWL_HMQ); | 
|---|
| 2365 | WinSetCp(hmq, ad->fattrs.usCodePage); | 
|---|
| 2366 | break; | 
|---|
| 2367 | } | 
|---|
| 2368 | } | 
|---|
| 2369 | } | 
|---|
| 2370 | DosSetProcessCp((ULONG) ad->fattrs.usCodePage); | 
|---|
| 2371 | } | 
|---|
| 2372 | GpiSetBackMix(hps, BM_OVERPAINT); | 
|---|
| 2373 | } | 
|---|
| 2374 | } | 
|---|
| 2375 | return (hps); | 
|---|
| 2376 | } | 
|---|
| 2377 |  | 
|---|
| 2378 | static VOID PaintLine(HWND hwnd, HPS hps, ULONG whichfile, ULONG topfile, | 
|---|
| 2379 | RECTL * Rectl) | 
|---|
| 2380 | { | 
|---|
| 2381 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 2382 | POINTL ptl; | 
|---|
| 2383 | CHAR szBuff[CCHMAXPATH + 80], szCmmaFmtFileSize[81], szDate[DATE_BUF_BYTES]; | 
|---|
| 2384 | ULONG len, y; | 
|---|
| 2385 |  | 
|---|
| 2386 | y = (ad->invertsort) ? (ad->afindexcnt - 1) - whichfile : whichfile; | 
|---|
| 2387 | ptl.y = (Rectl->yTop - | 
|---|
| 2388 | (ad->lMaxHeight * (((whichfile + 1) - topfile) + 1))); | 
|---|
| 2389 | ptl.x = ad->horzscroll; | 
|---|
| 2390 | if (ptl.y < Rectl->yBottom || ptl.y > Rectl->yTop || y > ad->afindexcnt) | 
|---|
| 2391 | return; | 
|---|
| 2392 | GpiSetBackMix(hps, BM_OVERPAINT); | 
|---|
| 2393 | if (ad->afindex[y]->flags & AF_SELECTED) { | 
|---|
| 2394 | GpiSetColor(hps, standardcolors[Colors[COLORS_SELECTEDNORMALFORE]]); | 
|---|
| 2395 | GpiSetBackColor(hps, (whichfile == ad->cursored - 1) ? | 
|---|
| 2396 | standardcolors[Colors[COLORS_CURSOREDSELECTEDBACK]] : | 
|---|
| 2397 | standardcolors[Colors[COLORS_SELECTEDBACK]]); | 
|---|
| 2398 | } | 
|---|
| 2399 | else { | 
|---|
| 2400 | GpiSetColor(hps, | 
|---|
| 2401 | ((ad->afindex[y]->attrFile & (FILE_SYSTEM | FILE_HIDDEN)) != | 
|---|
| 2402 | 0) ? standardcolors[Colors[COLORS_SYSTEMFORE]] : ((ad-> | 
|---|
| 2403 | afindex | 
|---|
| 2404 | [y]-> | 
|---|
| 2405 | attrFile & | 
|---|
| 2406 | FILE_READONLY) | 
|---|
| 2407 | != | 
|---|
| 2408 | 0) ? | 
|---|
| 2409 | standardcolors[Colors[COLORS_READONLYFORE]] : | 
|---|
| 2410 | standardcolors[Colors[COLORS_NORMALFORE]]); | 
|---|
| 2411 | GpiSetBackColor(hps, | 
|---|
| 2412 | (whichfile == | 
|---|
| 2413 | ad->cursored - | 
|---|
| 2414 | 1) ? standardcolors[Colors[COLORS_CURSOREDNORMALBACK]] : | 
|---|
| 2415 | standardcolors[Colors[COLORS_NORMALBACK]]); | 
|---|
| 2416 | } | 
|---|
| 2417 | CommaFmtULL(szCmmaFmtFileSize, | 
|---|
| 2418 | sizeof(szCmmaFmtFileSize), ad->afindex[y]->cbFile, ' '); | 
|---|
| 2419 | FDateFormat(szDate, ad->afindex[y]->date); | 
|---|
| 2420 | len = sprintf(szBuff, | 
|---|
| 2421 | "%c%-*.*s  %-12s  %c%c%c%c%c  %s %02u%s%02u%s%02u ", | 
|---|
| 2422 | whichfile == ad->cursored - 1 ? '>' : ' ', | 
|---|
| 2423 | ad->fullnames ? ad->longestw : ad->longest, | 
|---|
| 2424 | ad->fullnames ? ad->longestw : ad->longest, | 
|---|
| 2425 | ad->fullnames ? ad->afindex[y]->fullname : | 
|---|
| 2426 | ad->afindex[y]->filename, | 
|---|
| 2427 | szCmmaFmtFileSize, | 
|---|
| 2428 | "-A"[((ad->afindex[y]->attrFile & FILE_ARCHIVED) != 0)], | 
|---|
| 2429 | "-R"[((ad->afindex[y]->attrFile & FILE_READONLY) != 0)], | 
|---|
| 2430 | "-H"[((ad->afindex[y]->attrFile & FILE_HIDDEN) != 0)], | 
|---|
| 2431 | "-S"[((ad->afindex[y]->attrFile & FILE_SYSTEM) != 0)], | 
|---|
| 2432 | "-D"[((ad->afindex[y]->attrFile & FILE_DIRECTORY) != 0)], | 
|---|
| 2433 | szDate, | 
|---|
| 2434 | ad->afindex[y]->time.hours, TimeSeparator, | 
|---|
| 2435 | ad->afindex[y]->time.minutes, TimeSeparator, | 
|---|
| 2436 | ad->afindex[y]->time.twosecs * 2); | 
|---|
| 2437 | GpiCharStringAt(hps, &ptl, len, szBuff); | 
|---|
| 2438 | GpiQueryCurrentPosition(hps, &ptl); | 
|---|
| 2439 | if (ptl.x + abs(ad->horzscroll) > ad->maxx) { | 
|---|
| 2440 | ad->maxx = ptl.x + abs(ad->horzscroll); | 
|---|
| 2441 | WinSendMsg(ad->hhscroll, SBM_SETTHUMBSIZE, | 
|---|
| 2442 | MPFROM2SHORT((SHORT) Rectl->xRight, (SHORT) ad->maxx), MPVOID); | 
|---|
| 2443 | } | 
|---|
| 2444 | } | 
|---|
| 2445 |  | 
|---|
| 2446 | MRESULT EXPENTRY SeeStatusProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| 2447 | { | 
|---|
| 2448 | switch (msg) { | 
|---|
| 2449 | case WM_CREATE: | 
|---|
| 2450 | return CommonTextProc(hwnd, msg, mp1, mp2); | 
|---|
| 2451 |  | 
|---|
| 2452 | case WM_SETFOCUS: | 
|---|
| 2453 | if (mp2) | 
|---|
| 2454 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); | 
|---|
| 2455 | break; | 
|---|
| 2456 |  | 
|---|
| 2457 | case WM_PAINT: | 
|---|
| 2458 | { | 
|---|
| 2459 | SWP swp; | 
|---|
| 2460 | POINTL ptl; | 
|---|
| 2461 | HPS hps; | 
|---|
| 2462 |  | 
|---|
| 2463 | PaintRecessedWindow(hwnd, (HPS) 0, FALSE, FALSE); | 
|---|
| 2464 | hps = WinGetPS(WinQueryWindow(hwnd, QW_PARENT)); | 
|---|
| 2465 | if (hps) { | 
|---|
| 2466 | WinQueryWindowPos(hwnd, &swp); | 
|---|
| 2467 | ptl.x = swp.x - 1; | 
|---|
| 2468 | ptl.y = swp.y + swp.cy + 2; | 
|---|
| 2469 | GpiMove(hps, &ptl); | 
|---|
| 2470 | GpiSetColor(hps, CLR_WHITE); | 
|---|
| 2471 | ptl.x = swp.x + swp.cx; | 
|---|
| 2472 | GpiLine(hps, &ptl); | 
|---|
| 2473 | WinReleasePS(hps); | 
|---|
| 2474 | } | 
|---|
| 2475 | } | 
|---|
| 2476 | break; | 
|---|
| 2477 |  | 
|---|
| 2478 | case UM_FOCUSME: | 
|---|
| 2479 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), | 
|---|
| 2480 | FID_CLIENT)); | 
|---|
| 2481 | return 0; | 
|---|
| 2482 | } | 
|---|
| 2483 | return PFNWPStatic(hwnd, msg, mp1, mp2); | 
|---|
| 2484 | } | 
|---|
| 2485 |  | 
|---|
| 2486 | MRESULT EXPENTRY SeeFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| 2487 | { | 
|---|
| 2488 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 2489 |  | 
|---|
| 2490 | switch (msg) { | 
|---|
| 2491 | case WM_BUTTON1UP: | 
|---|
| 2492 | case WM_BUTTON2UP: | 
|---|
| 2493 | case WM_BUTTON3UP: | 
|---|
| 2494 | case WM_MOUSEMOVE: | 
|---|
| 2495 | case WM_CHORD: | 
|---|
| 2496 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL)); | 
|---|
| 2497 | break; | 
|---|
| 2498 |  | 
|---|
| 2499 | case WM_CHAR: | 
|---|
| 2500 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL)); | 
|---|
| 2501 | break; | 
|---|
| 2502 |  | 
|---|
| 2503 | case WM_CALCFRAMERECT: | 
|---|
| 2504 | { | 
|---|
| 2505 | MRESULT mr; | 
|---|
| 2506 | PRECTL prectl; | 
|---|
| 2507 |  | 
|---|
| 2508 | mr = oldproc(hwnd, msg, mp1, mp2); | 
|---|
| 2509 |  | 
|---|
| 2510 | /** | 
|---|
| 2511 | * Calculate the position of the client rectangle. | 
|---|
| 2512 | * Otherwise,  we'll see a lot of redraw when we move the | 
|---|
| 2513 | * client during WM_FORMATFRAME. | 
|---|
| 2514 | */ | 
|---|
| 2515 |  | 
|---|
| 2516 | if (mr && mp2) { | 
|---|
| 2517 | prectl = (PRECTL) mp1; | 
|---|
| 2518 | prectl->yBottom += 22; | 
|---|
| 2519 | prectl->yTop -= 24; | 
|---|
| 2520 | } | 
|---|
| 2521 | return mr; | 
|---|
| 2522 | } | 
|---|
| 2523 |  | 
|---|
| 2524 | case WM_FORMATFRAME: | 
|---|
| 2525 | { | 
|---|
| 2526 | SHORT sCount; | 
|---|
| 2527 | PSWP pswp, pswpClient, pswpNew; | 
|---|
| 2528 |  | 
|---|
| 2529 | sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2); | 
|---|
| 2530 |  | 
|---|
| 2531 | /** | 
|---|
| 2532 | * Reformat the frame to "squeeze" the client | 
|---|
| 2533 | * and make room for status window sibling beneath | 
|---|
| 2534 | */ | 
|---|
| 2535 |  | 
|---|
| 2536 | pswp = (PSWP) mp1; | 
|---|
| 2537 | { | 
|---|
| 2538 | SHORT x; | 
|---|
| 2539 |  | 
|---|
| 2540 | for (x = 0; x < sCount; x++) { | 
|---|
| 2541 | if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) { | 
|---|
| 2542 | pswpClient = pswp; | 
|---|
| 2543 | break; | 
|---|
| 2544 | } | 
|---|
| 2545 | pswp++; | 
|---|
| 2546 | } | 
|---|
| 2547 | } | 
|---|
| 2548 | pswpNew = (PSWP) mp1 + sCount; | 
|---|
| 2549 | *pswpNew = *pswpClient; | 
|---|
| 2550 | pswpNew->hwnd = WinWindowFromID(hwnd, SEEALL_STATUS); | 
|---|
| 2551 | pswpNew->x = pswpClient->x + 2; | 
|---|
| 2552 | pswpNew->y = pswpClient->y + 2; | 
|---|
| 2553 | pswpNew->cx = pswpClient->cx - 3; | 
|---|
| 2554 | pswpNew->cy = 20; | 
|---|
| 2555 | pswpClient->y = pswpNew->y + pswpNew->cy + 3; | 
|---|
| 2556 | pswpClient->cy = (pswpClient->cy - pswpNew->cy) - 5; | 
|---|
| 2557 | sCount++; | 
|---|
| 2558 | return MRFROMSHORT(sCount); | 
|---|
| 2559 | } | 
|---|
| 2560 |  | 
|---|
| 2561 | case WM_QUERYFRAMECTLCOUNT: | 
|---|
| 2562 | { | 
|---|
| 2563 | SHORT sCount; | 
|---|
| 2564 |  | 
|---|
| 2565 | sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2); | 
|---|
| 2566 | sCount++; | 
|---|
| 2567 | return MRFROMSHORT(sCount); | 
|---|
| 2568 | } | 
|---|
| 2569 | } | 
|---|
| 2570 | return oldproc(hwnd, msg, mp1, mp2); | 
|---|
| 2571 | } | 
|---|
| 2572 |  | 
|---|
| 2573 | MRESULT EXPENTRY SeeAllWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| 2574 | { | 
|---|
| 2575 | ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 2576 | APIRET apiret; | 
|---|
| 2577 |  | 
|---|
| 2578 | switch (msg) { | 
|---|
| 2579 | case WM_CREATE: | 
|---|
| 2580 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_CREATE"); | 
|---|
| 2581 | WinSetWindowPtr(hwnd, QWL_USER, NULL); | 
|---|
| 2582 | #   ifdef FORTIFY | 
|---|
| 2583 | Fortify_EnterScope(); | 
|---|
| 2584 | #    endif | 
|---|
| 2585 | pAD = xmallocz(sizeof(ALLDATA), pszSrcFile, __LINE__); | 
|---|
| 2586 | if (pAD) { | 
|---|
| 2587 | HWND hwndFrame; | 
|---|
| 2588 |  | 
|---|
| 2589 | pAD->size = sizeof(ALLDATA); | 
|---|
| 2590 | hwndFrame = WinQueryWindow(hwnd, QW_PARENT); | 
|---|
| 2591 | pAD->hwndFrame = hwndFrame; | 
|---|
| 2592 | pAD->mask.attrFile = FILE_READONLY | FILE_HIDDEN | | 
|---|
| 2593 | FILE_SYSTEM | FILE_ARCHIVED; | 
|---|
| 2594 | pAD->mask.fNoDirs = TRUE; | 
|---|
| 2595 | *(pAD->mask.prompt) = 0; | 
|---|
| 2596 | WinSetWindowPtr(hwnd, QWL_USER, (PVOID) pAD); | 
|---|
| 2597 | pAD->pfnCompare = comparenames; | 
|---|
| 2598 | if (Firsttime) { | 
|---|
| 2599 |  | 
|---|
| 2600 | ULONG size; | 
|---|
| 2601 |  | 
|---|
| 2602 | size = sizeof(USHORT); | 
|---|
| 2603 | PrfQueryProfileData(fmprof, | 
|---|
| 2604 | appname, | 
|---|
| 2605 | "Seeall.Codepage", (PVOID) & Codepage, &size); | 
|---|
| 2606 | size = sizeof(BOOL); | 
|---|
| 2607 | PrfQueryProfileData(fmprof, | 
|---|
| 2608 | appname, | 
|---|
| 2609 | "Seeall.Fullnames", (PVOID) & Fullnames, &size); | 
|---|
| 2610 | size = sizeof(USHORT); | 
|---|
| 2611 | PrfQueryProfileData(fmprof, | 
|---|
| 2612 | appname, | 
|---|
| 2613 | "Seeall.Sort", (PVOID) & SortType, &size); | 
|---|
| 2614 | size = sizeof(BOOL); | 
|---|
| 2615 | PrfQueryProfileData(fmprof, | 
|---|
| 2616 | appname, | 
|---|
| 2617 | "Seeall.SortReverse", | 
|---|
| 2618 | (PVOID) & SortReverse, &size); | 
|---|
| 2619 | memset(&Fattrs, 0, sizeof(Fattrs)); | 
|---|
| 2620 | size = sizeof(Fattrs); | 
|---|
| 2621 | Fattrs.usRecordLength = sizeof(Fattrs); | 
|---|
| 2622 | Fattrs.lMaxBaselineExt = 16; | 
|---|
| 2623 | Fattrs.lAveCharWidth = 8; | 
|---|
| 2624 | Fattrs.usCodePage = Codepage; | 
|---|
| 2625 | strcpy(Fattrs.szFacename, GetPString(IDS_SYSMONOTEXT)); | 
|---|
| 2626 | PrfQueryProfileData(fmprof, | 
|---|
| 2627 | appname, | 
|---|
| 2628 | "Seeall.Fattrs", (PVOID) & Fattrs, &size); | 
|---|
| 2629 | size = sizeof(LONG) * COLORS_MAX; | 
|---|
| 2630 | PrfQueryProfileData(fmprof, | 
|---|
| 2631 | appname, "Seeall.Colors", (PVOID) Colors, &size); | 
|---|
| 2632 | Firsttime = FALSE; | 
|---|
| 2633 | } | 
|---|
| 2634 | switch (SortType) { | 
|---|
| 2635 | case IDM_SORTEASIZE: | 
|---|
| 2636 | pAD->pfnCompare = (PFNSORT) NULL; | 
|---|
| 2637 | break; | 
|---|
| 2638 | case IDM_SORTNAME: | 
|---|
| 2639 | pAD->pfnCompare = comparefullnames; | 
|---|
| 2640 | break; | 
|---|
| 2641 | case IDM_SORTFILENAME: | 
|---|
| 2642 | pAD->pfnCompare = comparenames; | 
|---|
| 2643 | break; | 
|---|
| 2644 | case IDM_SORTSIZE: | 
|---|
| 2645 | pAD->pfnCompare = comparesizes; | 
|---|
| 2646 | break; | 
|---|
| 2647 | case IDM_SORTLWDATE: | 
|---|
| 2648 | pAD->pfnCompare = comparedates; | 
|---|
| 2649 | break; | 
|---|
| 2650 | case IDM_SORTFIRST: | 
|---|
| 2651 | pAD->pfnCompare = compareexts; | 
|---|
| 2652 | break; | 
|---|
| 2653 | } | 
|---|
| 2654 | pAD->invertsort = SortReverse; | 
|---|
| 2655 | pAD->fattrs = Fattrs; | 
|---|
| 2656 | pAD->fullnames = Fullnames; | 
|---|
| 2657 | pAD->stopflag = 0; | 
|---|
| 2658 | pAD->cursored = pAD->topfile = 1; | 
|---|
| 2659 | pAD->fattrs.usCodePage = Codepage; | 
|---|
| 2660 | memcpy(pAD->aulColors, Colors, sizeof(LONG) * COLORS_MAX); | 
|---|
| 2661 | pAD->hwndMenu = WinWindowFromID(hwndFrame, FID_MENU); | 
|---|
| 2662 | SetConditionalCascade(pAD->hwndMenu, IDM_DELETESUBMENU, | 
|---|
| 2663 | (fDefaultDeletePerm) ? | 
|---|
| 2664 | IDM_PERMDELETE : IDM_DELETE); | 
|---|
| 2665 | SetConditionalCascade(pAD->hwndMenu, IDM_MOVEMENU, IDM_MOVE); | 
|---|
| 2666 | SetConditionalCascade(pAD->hwndMenu, IDM_COPYMENU, IDM_COPY); | 
|---|
| 2667 | SetConditionalCascade(pAD->hwndMenu, IDM_OPENSUBMENU, IDM_OPENDEFAULT); | 
|---|
| 2668 | SetConditionalCascade(pAD->hwndMenu, IDM_OBJECTSUBMENU, IDM_SHADOW); | 
|---|
| 2669 | if (fWorkPlace) { | 
|---|
| 2670 | WinSendMsg(pAD->hwndMenu, MM_DELETEITEM, | 
|---|
| 2671 | MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); | 
|---|
| 2672 | WinSendMsg(pAD->hwndMenu, MM_DELETEITEM, | 
|---|
| 2673 | MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID); | 
|---|
| 2674 | } | 
|---|
| 2675 | pAD->hwndClient = hwnd; | 
|---|
| 2676 | pAD->hps = InitWindow(hwnd); | 
|---|
| 2677 | pAD->hvscroll = WinWindowFromID(hwndFrame, FID_VERTSCROLL); | 
|---|
| 2678 | pAD->hhscroll = WinWindowFromID(hwndFrame, FID_HORZSCROLL); | 
|---|
| 2679 | pAD->multiplier = 1; | 
|---|
| 2680 | if (xbeginthread(MakeSeeObjWinThread, | 
|---|
| 2681 | 122880, | 
|---|
| 2682 | pAD, | 
|---|
| 2683 | pszSrcFile, | 
|---|
| 2684 | __LINE__) != -1) | 
|---|
| 2685 | { | 
|---|
| 2686 | if (!DosCreateMutexSem(NULL, &pAD->hmtxScan, 0, FALSE)) { | 
|---|
| 2687 | pAD->hwndStatus = WinCreateWindow(hwndFrame, | 
|---|
| 2688 | (CHAR *) WC_SEESTATUS, | 
|---|
| 2689 | NullStr, | 
|---|
| 2690 | WS_VISIBLE | SS_TEXT | | 
|---|
| 2691 | DT_LEFT | DT_VCENTER, | 
|---|
| 2692 | 0, | 
|---|
| 2693 | 0, | 
|---|
| 2694 | 0, | 
|---|
| 2695 | 0, | 
|---|
| 2696 | hwndFrame, | 
|---|
| 2697 | HWND_TOP, | 
|---|
| 2698 | SEEALL_STATUS, NULL, NULL); | 
|---|
| 2699 | if (!pAD->hwndStatus) | 
|---|
| 2700 | Win_Error(hwndFrame, hwnd, pszSrcFile, __LINE__, | 
|---|
| 2701 | PCSZ_WINCREATEWINDOW); | 
|---|
| 2702 | else { | 
|---|
| 2703 | PFNWP oldproc; | 
|---|
| 2704 |  | 
|---|
| 2705 | oldproc = WinSubclassWindow(hwndFrame, SeeFrameWndProc); | 
|---|
| 2706 | WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc); | 
|---|
| 2707 | } | 
|---|
| 2708 | break; | 
|---|
| 2709 | } | 
|---|
| 2710 | } | 
|---|
| 2711 | } | 
|---|
| 2712 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); | 
|---|
| 2713 | break; | 
|---|
| 2714 |  | 
|---|
| 2715 | case UM_SETUP5: | 
|---|
| 2716 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP5"); | 
|---|
| 2717 | if (pAD) { | 
|---|
| 2718 | if (mp1 && *((CHAR *)mp1)) | 
|---|
| 2719 | strcpy(pAD->szFindPath, (CHAR *)mp1); | 
|---|
| 2720 | else { | 
|---|
| 2721 | if (!WinDlgBox(HWND_DESKTOP, hwnd, AFDrvsWndProc, | 
|---|
| 2722 | FM3ModHandle, DRVS_FRAME, (PVOID) pAD)) { | 
|---|
| 2723 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); | 
|---|
| 2724 | return 0; | 
|---|
| 2725 | } | 
|---|
| 2726 | } | 
|---|
| 2727 | if (xbeginthread(FindAllThread, | 
|---|
| 2728 | 524288, | 
|---|
| 2729 | (PVOID)hwnd, | 
|---|
| 2730 | pszSrcFile, | 
|---|
| 2731 | __LINE__) == -1) | 
|---|
| 2732 | { | 
|---|
| 2733 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); | 
|---|
| 2734 | } | 
|---|
| 2735 | else { | 
|---|
| 2736 | DosSleep(50);//05 Aug 07 GKY 100 | 
|---|
| 2737 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID); | 
|---|
| 2738 | PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID); | 
|---|
| 2739 | } | 
|---|
| 2740 | } | 
|---|
| 2741 | else | 
|---|
| 2742 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); | 
|---|
| 2743 | return 0; | 
|---|
| 2744 |  | 
|---|
| 2745 | case UM_UPDATERECORDLIST: | 
|---|
| 2746 | if (mp1) { | 
|---|
| 2747 |  | 
|---|
| 2748 | APIRET rc; | 
|---|
| 2749 |  | 
|---|
| 2750 | rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN); | 
|---|
| 2751 | if (!rc) { | 
|---|
| 2752 | WinSetPointer(HWND_DESKTOP, hptrBusy); | 
|---|
| 2753 | if (UpdateList(hwnd, mp1)) { | 
|---|
| 2754 | FreeList(mp1); | 
|---|
| 2755 | RemoveDeleted(hwnd); | 
|---|
| 2756 | ReSort(hwnd); | 
|---|
| 2757 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 2758 | } | 
|---|
| 2759 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 2760 | WinSetPointer(HWND_DESKTOP, hptrArrow); | 
|---|
| 2761 | } | 
|---|
| 2762 | } | 
|---|
| 2763 | return 0; | 
|---|
| 2764 |  | 
|---|
| 2765 | case UM_SETUP2: | 
|---|
| 2766 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP2"); | 
|---|
| 2767 | if (pAD) { | 
|---|
| 2768 |  | 
|---|
| 2769 | CHAR s[256]; | 
|---|
| 2770 | BOOL once = FALSE; | 
|---|
| 2771 | ULONG x, ulDriveNum, ulDriveMap; | 
|---|
| 2772 |  | 
|---|
| 2773 | strcpy(s, GetPString(IDS_SEEALLTITLETEXT)); | 
|---|
| 2774 | if (!*pAD->szFindPath) { | 
|---|
| 2775 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 2776 | if (!DosQCurDisk(&ulDriveNum, &ulDriveMap)) { | 
|---|
| 2777 | for (x = 2; x < 26 && !pAD->stopflag; x++) { | 
|---|
| 2778 | if ((ulDriveMap & (1 << x)) && pAD->abDrvFlags[x]) { | 
|---|
| 2779 | sprintf(&s[strlen(s)], "%s%c:", (once) ? ", " : " (", x + 'A'); | 
|---|
| 2780 | once = TRUE; | 
|---|
| 2781 | } | 
|---|
| 2782 | } | 
|---|
| 2783 | if (once) | 
|---|
| 2784 | strcat(s, ")"); | 
|---|
| 2785 | } | 
|---|
| 2786 | } | 
|---|
| 2787 | else { | 
|---|
| 2788 | strcat(s, " ("); | 
|---|
| 2789 | strcat(s, pAD->szFindPath); | 
|---|
| 2790 | strcat(s, ")"); | 
|---|
| 2791 | } | 
|---|
| 2792 | WinSetWindowText(WinQueryWindow(hwnd, QW_PARENT), s); | 
|---|
| 2793 | } | 
|---|
| 2794 | return 0; | 
|---|
| 2795 |  | 
|---|
| 2796 | case UM_SETUP3: | 
|---|
| 2797 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP3"); | 
|---|
| 2798 | if (pAD) { | 
|---|
| 2799 | pAD->multiplier = pAD->afindexcnt / 32767; | 
|---|
| 2800 | if (pAD->multiplier * 32767 != pAD->afindexcnt) | 
|---|
| 2801 | pAD->multiplier++; | 
|---|
| 2802 | if (!pAD->multiplier) | 
|---|
| 2803 | pAD->multiplier++; | 
|---|
| 2804 | { | 
|---|
| 2805 | RECTL Rectl; | 
|---|
| 2806 | ULONG numlines; | 
|---|
| 2807 |  | 
|---|
| 2808 | WinQueryWindowRect(hwnd, &Rectl); | 
|---|
| 2809 | numlines = NumLines(&Rectl, pAD); | 
|---|
| 2810 | if (numlines) { | 
|---|
| 2811 | WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE, | 
|---|
| 2812 | MPFROM2SHORT((SHORT) Rectl.xRight, (SHORT) pAD->maxx), | 
|---|
| 2813 | MPVOID); | 
|---|
| 2814 | WinSendMsg(pAD->hvscroll, SBM_SETTHUMBSIZE, | 
|---|
| 2815 | MPFROM2SHORT((SHORT) numlines, | 
|---|
| 2816 | (SHORT) min(pAD->afindexcnt, 32767)), | 
|---|
| 2817 | MPFROM2SHORT(1, pAD->afindexcnt + 1)); | 
|---|
| 2818 | WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR, | 
|---|
| 2819 | MPFROMSHORT((SHORT) abs(pAD->horzscroll)), | 
|---|
| 2820 | MPFROM2SHORT(0, (SHORT) (pAD->maxx - Rectl.xRight))); | 
|---|
| 2821 | WinSendMsg(pAD->hvscroll, SBM_SETSCROLLBAR, | 
|---|
| 2822 | MPFROMSHORT((SHORT) (pAD->topfile / pAD->multiplier)), | 
|---|
| 2823 | MPFROM2SHORT(1, | 
|---|
| 2824 | (SHORT) (pAD->afindexcnt / pAD->multiplier) - | 
|---|
| 2825 | (numlines - 1))); | 
|---|
| 2826 | if (pAD->afindexcnt - pAD->topfile < numlines) { | 
|---|
| 2827 | pAD->topfile = ((pAD->afindexcnt - pAD->topfile) - numlines); | 
|---|
| 2828 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 2829 | } | 
|---|
| 2830 | } | 
|---|
| 2831 | } | 
|---|
| 2832 | } | 
|---|
| 2833 | return 0; | 
|---|
| 2834 |  | 
|---|
| 2835 | case UM_SETUP4: | 
|---|
| 2836 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP4"); | 
|---|
| 2837 | if (pAD) | 
|---|
| 2838 | pAD->killme = TRUE; | 
|---|
| 2839 | else | 
|---|
| 2840 | PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); | 
|---|
| 2841 | return 0; | 
|---|
| 2842 |  | 
|---|
| 2843 | case UM_RESCAN: | 
|---|
| 2844 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_RESCAN"); | 
|---|
| 2845 | if (pAD && !pAD->stopflag) { | 
|---|
| 2846 | if (DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| 2847 | // Assume still working - show progress | 
|---|
| 2848 | CHAR s[CCHMAXPATH + 80], tm[34]; | 
|---|
| 2849 |  | 
|---|
| 2850 | if (mp1) { | 
|---|
| 2851 | strcpy(s, GetPString(IDS_SORTINGTEXT)); | 
|---|
| 2852 | if (pAD->afindexcnt) { | 
|---|
| 2853 | commafmt(tm, sizeof(tm), pAD->afindexcnt); | 
|---|
| 2854 | strcat(s, tm); | 
|---|
| 2855 | } | 
|---|
| 2856 | } | 
|---|
| 2857 | else { | 
|---|
| 2858 | strcpy(s, GetPString(IDS_WORKINGTEXT)); | 
|---|
| 2859 | if (pAD->afheadcnt) { | 
|---|
| 2860 | commafmt(tm, sizeof(tm), pAD->afheadcnt); | 
|---|
| 2861 | strcat(s, tm); | 
|---|
| 2862 | } | 
|---|
| 2863 | } | 
|---|
| 2864 | if (mp2) { | 
|---|
| 2865 | strcat(s, " "); | 
|---|
| 2866 | strcat(s, (CHAR *)mp2); | 
|---|
| 2867 | } | 
|---|
| 2868 | WinSetWindowText(pAD->hwndStatus, s); | 
|---|
| 2869 | } | 
|---|
| 2870 | else { | 
|---|
| 2871 | // Assume scan done | 
|---|
| 2872 | CHAR s[(CCHMAXPATH * 2) + 80], tm[34], ts[34], tb[34]; | 
|---|
| 2873 | ULONG y; | 
|---|
| 2874 |  | 
|---|
| 2875 | if (mp1) { | 
|---|
| 2876 | strcpy(s, GetPString(IDS_SORTINGTEXT)); | 
|---|
| 2877 | if (pAD->afindexcnt) { | 
|---|
| 2878 | commafmt(tm, sizeof(tm), pAD->afindexcnt); | 
|---|
| 2879 | strcat(s, tm); | 
|---|
| 2880 | } | 
|---|
| 2881 | if (mp2) { | 
|---|
| 2882 | strcat(s, " "); | 
|---|
| 2883 | strcat(s, (CHAR *)mp2); | 
|---|
| 2884 | } | 
|---|
| 2885 | } | 
|---|
| 2886 | else if (pAD->afindexcnt) { | 
|---|
| 2887 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - (pAD->cursored - 1) : | 
|---|
| 2888 | pAD->cursored - 1; | 
|---|
| 2889 | commafmt(tm, sizeof(tm), pAD->afindexcnt); | 
|---|
| 2890 | commafmt(ts, sizeof(ts), pAD->selected); | 
|---|
| 2891 | CommaFmtULL(tb, sizeof(tb), pAD->ullSelectedBytes, ' '); | 
|---|
| 2892 | sprintf(s, | 
|---|
| 2893 | " %s %s%s%s  %s %s (%s)  %s %s", | 
|---|
| 2894 | tm, | 
|---|
| 2895 | GetPString(IDS_FILETEXT), | 
|---|
| 2896 | &"s"[pAD->afindexcnt == 1], | 
|---|
| 2897 | (*pAD->mask.szMask || | 
|---|
| 2898 | (pAD->mask.attrFile & (~FILE_DIRECTORY)) != | 
|---|
| 2899 | (ALLATTRS & (~FILE_DIRECTORY)) || | 
|---|
| 2900 | pAD->mask.antiattr) ? | 
|---|
| 2901 | GetPString(IDS_FILTEREDTEXT) : | 
|---|
| 2902 | NullStr, | 
|---|
| 2903 | ts, | 
|---|
| 2904 | GetPString(IDS_SELECTEDTEXT), | 
|---|
| 2905 | tb, GetPString(IDS_CURRTEXT), pAD->afindex[y]->fullname); | 
|---|
| 2906 | } | 
|---|
| 2907 | else | 
|---|
| 2908 | sprintf(s, | 
|---|
| 2909 | GetPString(IDS_NOFILESPSTEXT), | 
|---|
| 2910 | (*pAD->mask.szMask || | 
|---|
| 2911 | (pAD->mask.attrFile & (~FILE_DIRECTORY)) != | 
|---|
| 2912 | (ALLATTRS & (~FILE_DIRECTORY)) || | 
|---|
| 2913 | pAD->mask.antiattr) ? | 
|---|
| 2914 | GetPString(IDS_FILTEREDTEXT) : NullStr); | 
|---|
| 2915 | WinSetWindowText(pAD->hwndStatus, s); | 
|---|
| 2916 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 2917 | } | 
|---|
| 2918 | } | 
|---|
| 2919 | return 0; | 
|---|
| 2920 |  | 
|---|
| 2921 | case UM_SETUP: | 
|---|
| 2922 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP"); | 
|---|
| 2923 | if (pAD) { | 
|---|
| 2924 | WinSendMsg(pAD->hvscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1), MPVOID); | 
|---|
| 2925 | WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1), MPVOID); | 
|---|
| 2926 | WinSetActiveWindow(HWND_DESKTOP, WinQueryWindow(hwnd, QW_PARENT)); | 
|---|
| 2927 | } | 
|---|
| 2928 | return 0; | 
|---|
| 2929 |  | 
|---|
| 2930 | case WM_CHAR: | 
|---|
| 2931 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL)); | 
|---|
| 2932 | if (pAD && !(SHORT1FROMMP(mp1) & KC_KEYUP)) { | 
|---|
| 2933 |  | 
|---|
| 2934 | register ULONG x; | 
|---|
| 2935 | ULONG numlines, y, wascursored = pAD->cursored, thistime, len; | 
|---|
| 2936 | BOOL found = FALSE; | 
|---|
| 2937 | RECTL rcl; | 
|---|
| 2938 |  | 
|---|
| 2939 | WinQueryWindowRect(hwnd, &rcl); | 
|---|
| 2940 | numlines = NumLines(&rcl, pAD); | 
|---|
| 2941 | if (numlines) { | 
|---|
| 2942 | if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) { | 
|---|
| 2943 | pAD->lasttime = 0; | 
|---|
| 2944 | *pAD->szCommonName = 0; | 
|---|
| 2945 | switch (SHORT2FROMMP(mp2)) { | 
|---|
| 2946 | case VK_DELETE: | 
|---|
| 2947 | if ((shiftstate & KC_CTRL) == KC_CTRL) | 
|---|
| 2948 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PERMDELETE, 0), | 
|---|
| 2949 | MPVOID); | 
|---|
| 2950 | else if ((shiftstate & KC_SHIFT) == KC_SHIFT) | 
|---|
| 2951 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SAVETOCLIP, 0), | 
|---|
| 2952 | MPVOID); | 
|---|
| 2953 | else | 
|---|
| 2954 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID); | 
|---|
| 2955 | break; | 
|---|
| 2956 | case VK_LEFT: | 
|---|
| 2957 | WinSendMsg(hwnd, WM_HSCROLL, MPFROM2SHORT(FID_HORZSCROLL, 0), | 
|---|
| 2958 | MPFROM2SHORT(0, SB_LINELEFT)); | 
|---|
| 2959 | break; | 
|---|
| 2960 | case VK_RIGHT: | 
|---|
| 2961 | WinSendMsg(hwnd, WM_HSCROLL, MPFROM2SHORT(FID_HORZSCROLL, 0), | 
|---|
| 2962 | MPFROM2SHORT(0, SB_LINERIGHT)); | 
|---|
| 2963 | break; | 
|---|
| 2964 | case VK_PAGEUP: | 
|---|
| 2965 | WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0), | 
|---|
| 2966 | MPFROM2SHORT(0, SB_PAGEUP)); | 
|---|
| 2967 | break; | 
|---|
| 2968 | case VK_PAGEDOWN: | 
|---|
| 2969 | WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0), | 
|---|
| 2970 | MPFROM2SHORT(0, SB_PAGEDOWN)); | 
|---|
| 2971 | break; | 
|---|
| 2972 | case VK_UP: | 
|---|
| 2973 | if (pAD->cursored > 1) { | 
|---|
| 2974 | if (shiftstate & KC_SHIFT) | 
|---|
| 2975 | WinSendMsg(hwnd, WM_BUTTON1CLICK, | 
|---|
| 2976 | MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2, | 
|---|
| 2977 | ((rcl.yTop - (pAD->lMaxHeight * | 
|---|
| 2978 | ((pAD->cursored) - | 
|---|
| 2979 | pAD->topfile))) - | 
|---|
| 2980 | pAD->lMaxDescender) - 1), | 
|---|
| 2981 | MPFROM2SHORT(TRUE, 0)); | 
|---|
| 2982 | pAD->cursored--; | 
|---|
| 2983 | if (pAD->cursored < pAD->topfile) { | 
|---|
| 2984 | PaintLine(hwnd, pAD->hps, pAD->cursored, pAD->topfile, &rcl); | 
|---|
| 2985 | WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0), | 
|---|
| 2986 | MPFROM2SHORT(0, SB_LINEUP)); | 
|---|
| 2987 | } | 
|---|
| 2988 | else { | 
|---|
| 2989 | PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, | 
|---|
| 2990 | &rcl); | 
|---|
| 2991 | PaintLine(hwnd, pAD->hps, pAD->cursored, pAD->topfile, &rcl); | 
|---|
| 2992 | } | 
|---|
| 2993 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 2994 | } | 
|---|
| 2995 | break; | 
|---|
| 2996 | case VK_DOWN: | 
|---|
| 2997 | if (pAD->cursored < pAD->afindexcnt | 
|---|
| 2998 | && pAD->cursored < pAD->topfile + numlines) { | 
|---|
| 2999 | if (shiftstate & KC_SHIFT) | 
|---|
| 3000 | WinSendMsg(hwnd, WM_BUTTON1CLICK, | 
|---|
| 3001 | MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2, | 
|---|
| 3002 | ((rcl.yTop - (pAD->lMaxHeight * | 
|---|
| 3003 | ((pAD->cursored) - | 
|---|
| 3004 | pAD->topfile))) - | 
|---|
| 3005 | pAD->lMaxDescender) - 1), | 
|---|
| 3006 | MPFROM2SHORT(TRUE, 0)); | 
|---|
| 3007 | pAD->cursored++; | 
|---|
| 3008 | if (pAD->cursored >= pAD->topfile + numlines) { | 
|---|
| 3009 | PaintLine(hwnd, pAD->hps, pAD->cursored - 2, pAD->topfile, | 
|---|
| 3010 | &rcl); | 
|---|
| 3011 | WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0), | 
|---|
| 3012 | MPFROM2SHORT(0, SB_LINEDOWN)); | 
|---|
| 3013 | } | 
|---|
| 3014 | else { | 
|---|
| 3015 | PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, | 
|---|
| 3016 | &rcl); | 
|---|
| 3017 | PaintLine(hwnd, pAD->hps, pAD->cursored - 2, pAD->topfile, | 
|---|
| 3018 | &rcl); | 
|---|
| 3019 | } | 
|---|
| 3020 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 3021 | } | 
|---|
| 3022 | break; | 
|---|
| 3023 | case VK_END: | 
|---|
| 3024 | if ((shiftstate & KC_CTRL) || | 
|---|
| 3025 | pAD->cursored == (pAD->topfile - 1) + numlines) { | 
|---|
| 3026 | pAD->cursored = pAD->afindexcnt; | 
|---|
| 3027 | pAD->topfile = (pAD->afindexcnt + 1) - numlines; | 
|---|
| 3028 | if (pAD->topfile > pAD->afindexcnt) | 
|---|
| 3029 | pAD->topfile = 1; | 
|---|
| 3030 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 3031 | } | 
|---|
| 3032 | else { | 
|---|
| 3033 | pAD->cursored = (pAD->topfile - 1) + numlines; | 
|---|
| 3034 | if (pAD->cursored > pAD->afindexcnt) | 
|---|
| 3035 | pAD->cursored = pAD->afindexcnt; | 
|---|
| 3036 | PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, | 
|---|
| 3037 | &rcl); | 
|---|
| 3038 | PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, &rcl); | 
|---|
| 3039 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 3040 | } | 
|---|
| 3041 | break; | 
|---|
| 3042 | case VK_HOME: | 
|---|
| 3043 | if ((shiftstate & KC_CTRL) || pAD->cursored == pAD->topfile) { | 
|---|
| 3044 | pAD->topfile = 1; | 
|---|
| 3045 | pAD->cursored = 1; | 
|---|
| 3046 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 3047 | } | 
|---|
| 3048 | else { | 
|---|
| 3049 | pAD->cursored = pAD->topfile; | 
|---|
| 3050 | PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, | 
|---|
| 3051 | &rcl); | 
|---|
| 3052 | PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, &rcl); | 
|---|
| 3053 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 3054 | } | 
|---|
| 3055 | break; | 
|---|
| 3056 | case VK_SPACE: | 
|---|
| 3057 | WinSendMsg(hwnd, WM_BUTTON1CLICK, | 
|---|
| 3058 | MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2, | 
|---|
| 3059 | ((rcl.yTop - (pAD->lMaxHeight * | 
|---|
| 3060 | ((pAD->cursored) - | 
|---|
| 3061 | pAD->topfile))) - | 
|---|
| 3062 | pAD->lMaxDescender) - 1), | 
|---|
| 3063 | MPFROM2SHORT(TRUE, 0)); | 
|---|
| 3064 | break; | 
|---|
| 3065 | case VK_NEWLINE: | 
|---|
| 3066 | case VK_ENTER: | 
|---|
| 3067 | WinSendMsg(hwnd, WM_BUTTON1DBLCLK, | 
|---|
| 3068 | MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2, | 
|---|
| 3069 | ((rcl.yTop - (pAD->lMaxHeight * | 
|---|
| 3070 | ((pAD->cursored) - | 
|---|
| 3071 | pAD->topfile))) - | 
|---|
| 3072 | pAD->lMaxDescender) - 1), MPFROM2SHORT(0, | 
|---|
| 3073 | 0)); | 
|---|
| 3074 | break; | 
|---|
| 3075 | } | 
|---|
| 3076 | } | 
|---|
| 3077 | else if (SHORT1FROMMP(mp1) & KC_CHAR) { | 
|---|
| 3078 | switch (SHORT1FROMMP(mp2)) { | 
|---|
| 3079 | case '\x1b': | 
|---|
| 3080 | case '\r': | 
|---|
| 3081 | case '\n': | 
|---|
| 3082 | WinSendMsg(hwnd, WM_BUTTON1DBLCLK, | 
|---|
| 3083 | MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2, | 
|---|
| 3084 | (rcl.yTop - (pAD->lMaxHeight * | 
|---|
| 3085 | ((pAD->cursored) - | 
|---|
| 3086 | pAD->topfile))) - 1), | 
|---|
| 3087 | MPFROM2SHORT(0, 0)); | 
|---|
| 3088 | pAD->lasttime = 0; | 
|---|
| 3089 | *pAD->szCommonName = 0; | 
|---|
| 3090 | break; | 
|---|
| 3091 | default: | 
|---|
| 3092 | thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd)); | 
|---|
| 3093 | if (thistime > pAD->lasttime + 1000) | 
|---|
| 3094 | *pAD->szCommonName = 0; | 
|---|
| 3095 | pAD->lasttime = thistime; | 
|---|
| 3096 | KbdRetry: | 
|---|
| 3097 | len = strlen(pAD->szCommonName); | 
|---|
| 3098 | if (len >= CCHMAXPATH - 1) { | 
|---|
| 3099 | *pAD->szCommonName = 0; | 
|---|
| 3100 | len = 0; | 
|---|
| 3101 | } | 
|---|
| 3102 | pAD->szCommonName[len] = toupper(SHORT1FROMMP(mp2)); | 
|---|
| 3103 | pAD->szCommonName[len + 1] = 0; | 
|---|
| 3104 | for (x = pAD->cursored - (len > 0); x < pAD->afindexcnt; x++) { | 
|---|
| 3105 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; | 
|---|
| 3106 | if (pAD->fullnames) { | 
|---|
| 3107 | if (!strnicmp(pAD->afindex[y]->fullname, pAD->szCommonName, | 
|---|
| 3108 | len + 1)) { | 
|---|
| 3109 | found = TRUE; | 
|---|
| 3110 | break; | 
|---|
| 3111 | } | 
|---|
| 3112 | } | 
|---|
| 3113 | else { | 
|---|
| 3114 | if (!strnicmp(pAD->afindex[y]->filename, pAD->szCommonName, | 
|---|
| 3115 | len + 1)) { | 
|---|
| 3116 | found = TRUE; | 
|---|
| 3117 | break; | 
|---|
| 3118 | } | 
|---|
| 3119 | } | 
|---|
| 3120 | } | 
|---|
| 3121 | if (!found) { | 
|---|
| 3122 | for (x = 0; x < pAD->cursored - (len > 0); x++) { | 
|---|
| 3123 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; | 
|---|
| 3124 | if (pAD->fullnames) { | 
|---|
| 3125 | if (!strnicmp(pAD->afindex[y]->fullname, pAD->szCommonName, | 
|---|
| 3126 | len + 1)) { | 
|---|
| 3127 | found = TRUE; | 
|---|
| 3128 | break; | 
|---|
| 3129 | } | 
|---|
| 3130 | } | 
|---|
| 3131 | else { | 
|---|
| 3132 | if (!strnicmp(pAD->afindex[y]->filename, pAD->szCommonName, | 
|---|
| 3133 | len + 1)) { | 
|---|
| 3134 | found = TRUE; | 
|---|
| 3135 | break; | 
|---|
| 3136 | } | 
|---|
| 3137 | } | 
|---|
| 3138 | } | 
|---|
| 3139 | } | 
|---|
| 3140 | if (found) { | 
|---|
| 3141 | if (x + 1 != pAD->cursored) { | 
|---|
| 3142 | pAD->cursored = x + 1; | 
|---|
| 3143 | if (pAD->cursored >= pAD->topfile && | 
|---|
| 3144 | pAD->cursored < pAD->topfile + numlines && | 
|---|
| 3145 | wascursored != pAD->cursored) { | 
|---|
| 3146 | PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, | 
|---|
| 3147 | &rcl); | 
|---|
| 3148 | PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, | 
|---|
| 3149 | &rcl); | 
|---|
| 3150 | } | 
|---|
| 3151 | else { | 
|---|
| 3152 | if (pAD->cursored < numlines) | 
|---|
| 3153 | pAD->topfile = 1; | 
|---|
| 3154 | else if (pAD->cursored > | 
|---|
| 3155 | (pAD->afindexcnt + 1) - (numlines / 2)) | 
|---|
| 3156 | pAD->topfile = (pAD->afindexcnt + 1) - numlines; | 
|---|
| 3157 | else | 
|---|
| 3158 | pAD->topfile = pAD->cursored - (numlines / 2); | 
|---|
| 3159 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 3160 | } | 
|---|
| 3161 | } | 
|---|
| 3162 | } | 
|---|
| 3163 | else { | 
|---|
| 3164 | *pAD->szCommonName = 0; | 
|---|
| 3165 | pAD->lasttime = 0; | 
|---|
| 3166 | if (len)                  // retry as first letter if no match | 
|---|
| 3167 | goto KbdRetry; | 
|---|
| 3168 | } | 
|---|
| 3169 | break; | 
|---|
| 3170 | } | 
|---|
| 3171 | } | 
|---|
| 3172 | } | 
|---|
| 3173 | } | 
|---|
| 3174 | break; | 
|---|
| 3175 |  | 
|---|
| 3176 | case DM_PRINTOBJECT: | 
|---|
| 3177 | return MRFROMLONG(DRR_TARGET); | 
|---|
| 3178 |  | 
|---|
| 3179 | case DM_DISCARDOBJECT: | 
|---|
| 3180 | return MRFROMLONG(DRR_TARGET); | 
|---|
| 3181 |  | 
|---|
| 3182 | case WM_BEGINDRAG: | 
|---|
| 3183 | { | 
|---|
| 3184 | CHAR **list; | 
|---|
| 3185 |  | 
|---|
| 3186 | list = BuildAList(hwnd); | 
|---|
| 3187 | if (!list) | 
|---|
| 3188 | Runtime_Error(pszSrcFile, __LINE__, NULL); | 
|---|
| 3189 | else { | 
|---|
| 3190 | WinSetWindowText(pAD->hwndStatus, (CHAR *) GetPString(IDS_DRAGGINGFILESTEXT)); | 
|---|
| 3191 | DragList(hwnd, (HWND) 0, list, TRUE); | 
|---|
| 3192 | FreeList(list); | 
|---|
| 3193 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 3194 | } | 
|---|
| 3195 | } | 
|---|
| 3196 | break; | 
|---|
| 3197 |  | 
|---|
| 3198 | case WM_BUTTON1MOTIONSTART: | 
|---|
| 3199 | if (pAD && !pAD->stopflag && | 
|---|
| 3200 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| 3201 | pAD->mousecaptured = TRUE; | 
|---|
| 3202 | pAD->lastselected = (ULONG) - 1; | 
|---|
| 3203 | pAD->lastdirection = 0; | 
|---|
| 3204 | WinSetCapture(HWND_DESKTOP, hwnd); | 
|---|
| 3205 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 3206 | WinSendMsg(hwnd, WM_BUTTON1CLICK, mp1, MPFROM2SHORT(TRUE, 0)); | 
|---|
| 3207 | } | 
|---|
| 3208 | break; | 
|---|
| 3209 |  | 
|---|
| 3210 | case WM_MOUSEMOVE: | 
|---|
| 3211 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL)); | 
|---|
| 3212 | if (pAD && pAD->mousecaptured) { | 
|---|
| 3213 |  | 
|---|
| 3214 | ULONG numlines, whichfile, y, x; | 
|---|
| 3215 | LONG inc; | 
|---|
| 3216 | RECTL Rectl; | 
|---|
| 3217 | POINTS pts; | 
|---|
| 3218 | BOOL outofwindow = FALSE; | 
|---|
| 3219 |  | 
|---|
| 3220 | WinQueryWindowRect(hwnd, &Rectl); | 
|---|
| 3221 | numlines = NumLines(&Rectl, pAD); | 
|---|
| 3222 | if (numlines) { | 
|---|
| 3223 | pts.x = SHORT1FROMMP(mp1); | 
|---|
| 3224 | pts.y = SHORT2FROMMP(mp1); | 
|---|
| 3225 | if (pts.y < 0) { | 
|---|
| 3226 | WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0), | 
|---|
| 3227 | MPFROM2SHORT(0, SB_LINEDOWN)); | 
|---|
| 3228 | pts.y = 1; | 
|---|
| 3229 | outofwindow = TRUE; | 
|---|
| 3230 | } | 
|---|
| 3231 | else if (pts.y > Rectl.yTop - Rectl.yBottom) { | 
|---|
| 3232 | WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0), | 
|---|
| 3233 | MPFROM2SHORT(0, SB_LINEUP)); | 
|---|
| 3234 | pts.y = (SHORT) (Rectl.yTop - Rectl.yBottom) - 1; | 
|---|
| 3235 | outofwindow = TRUE; | 
|---|
| 3236 | } | 
|---|
| 3237 | whichfile = ((Rectl.yTop - Rectl.yBottom) - | 
|---|
| 3238 | ((LONG) pts.y + pAD->lMaxDescender)) / pAD->lMaxHeight; | 
|---|
| 3239 | if (whichfile > numlines - 1) | 
|---|
| 3240 | whichfile = numlines - 1; | 
|---|
| 3241 | whichfile += (pAD->topfile - 1); | 
|---|
| 3242 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - whichfile : whichfile; | 
|---|
| 3243 | if (y < pAD->afindexcnt && pAD->lastselected != whichfile) { | 
|---|
| 3244 | if (pAD->lastselected != (ULONG) - 1) { | 
|---|
| 3245 | inc = (pAD->lastselected < whichfile) ? 1 : -1; | 
|---|
| 3246 | for (x = pAD->lastselected + inc; | 
|---|
| 3247 | x != whichfile && x < pAD->afindexcnt; | 
|---|
| 3248 | (pAD->lastselected < whichfile) ? x++ : x--) { | 
|---|
| 3249 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; | 
|---|
| 3250 | if (pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
| 3251 | pAD->afindex[y]->flags &= ~AF_SELECTED; | 
|---|
| 3252 | pAD->selected--; | 
|---|
| 3253 | pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile; | 
|---|
| 3254 | } | 
|---|
| 3255 | else { | 
|---|
| 3256 | pAD->afindex[y]->flags |= AF_SELECTED; | 
|---|
| 3257 | pAD->selected++; | 
|---|
| 3258 | pAD->ullSelectedBytes += pAD->afindex[y]->cbFile; | 
|---|
| 3259 | } | 
|---|
| 3260 | PaintLine(hwnd, pAD->hps, x, pAD->topfile, &Rectl); | 
|---|
| 3261 | } | 
|---|
| 3262 | } | 
|---|
| 3263 | WinSendMsg(hwnd, WM_BUTTON1CLICK, MPFROM2SHORT(pts.x, pts.y), | 
|---|
| 3264 | MPFROM2SHORT(TRUE, 0)); | 
|---|
| 3265 | } | 
|---|
| 3266 | } | 
|---|
| 3267 | if (outofwindow) { | 
|---|
| 3268 |  | 
|---|
| 3269 | POINTL ptl; | 
|---|
| 3270 |  | 
|---|
| 3271 | WinQueryPointerPos(HWND_DESKTOP, &ptl); | 
|---|
| 3272 | WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1); | 
|---|
| 3273 | if ((SHORT) ptl.y == (SHORT) SHORT2FROMMP(mp1) && | 
|---|
| 3274 | (SHORT) ptl.x == (SHORT) SHORT1FROMMP(mp1) && | 
|---|
| 3275 | ((SHORT) ptl.y < 0 || ptl.y > (Rectl.yTop - Rectl.yBottom))) { | 
|---|
| 3276 | PostMsg(hwnd, UM_MOUSEMOVE, mp1, MPVOID); | 
|---|
| 3277 | DosSleep(1); | 
|---|
| 3278 | } | 
|---|
| 3279 | } | 
|---|
| 3280 | } | 
|---|
| 3281 | break; | 
|---|
| 3282 |  | 
|---|
| 3283 | case UM_MOUSEMOVE: | 
|---|
| 3284 | if (pAD && pAD->mousecaptured) { | 
|---|
| 3285 |  | 
|---|
| 3286 | POINTL ptl; | 
|---|
| 3287 | RECTL Rectl; | 
|---|
| 3288 |  | 
|---|
| 3289 | WinQueryWindowRect(hwnd, &Rectl); | 
|---|
| 3290 | WinQueryPointerPos(HWND_DESKTOP, &ptl); | 
|---|
| 3291 | WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1); | 
|---|
| 3292 | if ((SHORT) ptl.y == (SHORT) SHORT2FROMMP(mp1) && | 
|---|
| 3293 | (SHORT) ptl.x == (SHORT) SHORT1FROMMP(mp1) && | 
|---|
| 3294 | ((SHORT) ptl.y < 0 || ptl.y > (Rectl.yTop - Rectl.yBottom))) { | 
|---|
| 3295 | DosSleep(1); | 
|---|
| 3296 | PostMsg(hwnd, WM_MOUSEMOVE, mp1, MPFROM2SHORT(TRUE, 0)); | 
|---|
| 3297 | } | 
|---|
| 3298 | } | 
|---|
| 3299 | return 0; | 
|---|
| 3300 |  | 
|---|
| 3301 | case WM_BUTTON1UP: | 
|---|
| 3302 | case WM_BUTTON1MOTIONEND: | 
|---|
| 3303 | if (pAD) { | 
|---|
| 3304 | pAD->mousecaptured = FALSE; | 
|---|
| 3305 | pAD->lastselected = (ULONG) - 1; | 
|---|
| 3306 | pAD->lastdirection = 0; | 
|---|
| 3307 | WinSetCapture(HWND_DESKTOP, NULLHANDLE); | 
|---|
| 3308 | } | 
|---|
| 3309 | break; | 
|---|
| 3310 |  | 
|---|
| 3311 | case WM_BUTTON1CLICK: | 
|---|
| 3312 | case WM_BUTTON1DBLCLK: | 
|---|
| 3313 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL)); | 
|---|
| 3314 | if (pAD && !pAD->stopflag && | 
|---|
| 3315 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| 3316 |  | 
|---|
| 3317 | ULONG numlines, whichfile, y, wascursored; | 
|---|
| 3318 | RECTL Rectl; | 
|---|
| 3319 | POINTS pts; | 
|---|
| 3320 |  | 
|---|
| 3321 | if (pAD->afindexcnt) { | 
|---|
| 3322 | WinQueryWindowRect(hwnd, &Rectl); | 
|---|
| 3323 | numlines = NumLines(&Rectl, pAD); | 
|---|
| 3324 | if (numlines) { | 
|---|
| 3325 | pts.x = SHORT1FROMMP(mp1); | 
|---|
| 3326 | pts.y = SHORT2FROMMP(mp1); | 
|---|
| 3327 | whichfile = ((Rectl.yTop - Rectl.yBottom) - | 
|---|
| 3328 | ((LONG) pts.y + pAD->lMaxDescender)) / pAD->lMaxHeight; | 
|---|
| 3329 | if (whichfile > numlines - 1) | 
|---|
| 3330 | whichfile = numlines - 1; | 
|---|
| 3331 | whichfile += (pAD->topfile - 1); | 
|---|
| 3332 | if (whichfile + 1 > pAD->afindexcnt) | 
|---|
| 3333 | break; | 
|---|
| 3334 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - whichfile : whichfile; | 
|---|
| 3335 | wascursored = pAD->cursored; | 
|---|
| 3336 | pAD->cursored = whichfile + 1; | 
|---|
| 3337 | if (pAD->cursored != wascursored) | 
|---|
| 3338 | PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, &Rectl); | 
|---|
| 3339 | if (y < pAD->afindexcnt) { | 
|---|
| 3340 | if (msg == WM_BUTTON1CLICK || fUnHilite) { | 
|---|
| 3341 | if (pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
| 3342 | pAD->afindex[y]->flags &= ~AF_SELECTED; | 
|---|
| 3343 | pAD->selected--; | 
|---|
| 3344 | pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile; | 
|---|
| 3345 | } | 
|---|
| 3346 | else { | 
|---|
| 3347 | pAD->afindex[y]->flags |= AF_SELECTED; | 
|---|
| 3348 | pAD->selected++; | 
|---|
| 3349 | pAD->ullSelectedBytes += pAD->afindex[y]->cbFile; | 
|---|
| 3350 | } | 
|---|
| 3351 | PaintLine(hwnd, pAD->hps, whichfile, pAD->topfile, &Rectl); | 
|---|
| 3352 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 3353 | } | 
|---|
| 3354 | } | 
|---|
| 3355 | if (msg == WM_BUTTON1CLICK) { | 
|---|
| 3356 | if (pAD->lastselected != (ULONG) - 1) { | 
|---|
| 3357 | if (whichfile > pAD->lastselected) | 
|---|
| 3358 | pAD->lastdirection = 1; | 
|---|
| 3359 | else | 
|---|
| 3360 | pAD->lastdirection = 2; | 
|---|
| 3361 | } | 
|---|
| 3362 | else | 
|---|
| 3363 | pAD->lastdirection = 0; | 
|---|
| 3364 | pAD->lastselected = whichfile; | 
|---|
| 3365 | } | 
|---|
| 3366 | else | 
|---|
| 3367 | DefaultViewKeys(hwnd, pAD->hwndFrame, HWND_DESKTOP, NULL, | 
|---|
| 3368 | pAD->afindex[y]->fullname); | 
|---|
| 3369 | } | 
|---|
| 3370 | } | 
|---|
| 3371 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 3372 | } | 
|---|
| 3373 | break; | 
|---|
| 3374 |  | 
|---|
| 3375 | case WM_MENUEND: | 
|---|
| 3376 | if (pAD && (HWND) mp2 == pAD->hwndPopup) { | 
|---|
| 3377 | WinDestroyWindow(pAD->hwndPopup); | 
|---|
| 3378 | pAD->hwndPopup = (HWND) 0; | 
|---|
| 3379 | } | 
|---|
| 3380 | break; | 
|---|
| 3381 |  | 
|---|
| 3382 | case WM_CONTEXTMENU: | 
|---|
| 3383 | if (pAD) { | 
|---|
| 3384 | if (!pAD->hwndPopup) { | 
|---|
| 3385 | pAD->hwndPopup = | 
|---|
| 3386 | WinLoadMenu(HWND_DESKTOP, FM3ModHandle, SEEALL_POPUP); | 
|---|
| 3387 | if (pAD->hwndPopup) { | 
|---|
| 3388 | //fixme to allow user to change presparams 1-10-09 GKY | 
|---|
| 3389 | WinSetPresParam(pAD->hwndPopup, PP_FONTNAMESIZE, | 
|---|
| 3390 | strlen(FNT_8HELVETICA) + 1, | 
|---|
| 3391 | (PVOID) FNT_8HELVETICA); | 
|---|
| 3392 | SetConditionalCascade(pAD->hwndPopup, | 
|---|
| 3393 | IDM_DELETESUBMENU, | 
|---|
| 3394 | (fDefaultDeletePerm) ? | 
|---|
| 3395 | IDM_PERMDELETE : IDM_DELETE); | 
|---|
| 3396 | SetConditionalCascade(pAD->hwndPopup, IDM_MOVEMENU, IDM_MOVE); | 
|---|
| 3397 | SetConditionalCascade(pAD->hwndPopup, IDM_COPYMENU, IDM_COPY); | 
|---|
| 3398 | SetConditionalCascade(pAD->hwndPopup, IDM_OPENSUBMENU, | 
|---|
| 3399 | IDM_OPENDEFAULT); | 
|---|
| 3400 | SetConditionalCascade(pAD->hwndMenu, IDM_OBJECTSUBMENU, IDM_SHADOW); | 
|---|
| 3401 | if (fWorkPlace) { | 
|---|
| 3402 | WinSendMsg(pAD->hwndPopup, MM_DELETEITEM, | 
|---|
| 3403 | MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); | 
|---|
| 3404 | WinSendMsg(pAD->hwndPopup, MM_DELETEITEM, | 
|---|
| 3405 | MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID); | 
|---|
| 3406 | } | 
|---|
| 3407 | } | 
|---|
| 3408 | } | 
|---|
| 3409 | if (pAD->hwndPopup) { | 
|---|
| 3410 |  | 
|---|
| 3411 | APIRET rc; | 
|---|
| 3412 |  | 
|---|
| 3413 | rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN); | 
|---|
| 3414 | WinEnableMenuItem(pAD->hwndPopup, IDM_EAS, (rc == 0 && | 
|---|
| 3415 | pAD->selected != 0)); | 
|---|
| 3416 | WinEnableMenuItem(pAD->hwndPopup, IDM_UUDECODE, (rc == 0 && | 
|---|
| 3417 | pAD->selected != 0)); | 
|---|
| 3418 | WinEnableMenuItem(pAD->hwndPopup, IDM_UNLOCKFILE, (rc == 0 && fUnlock && | 
|---|
| 3419 | pAD->selected != 0)); | 
|---|
| 3420 | WinEnableMenuItem(pAD->hwndPopup, IDM_EXTRACT, (rc == 0 && | 
|---|
| 3421 | pAD->selected != 0)); | 
|---|
| 3422 | WinEnableMenuItem(pAD->hwndPopup, IDM_ARCHIVE, (rc == 0 && | 
|---|
| 3423 | pAD->selected != 0)); | 
|---|
| 3424 | WinEnableMenuItem(pAD->hwndPopup, IDM_MOVEMENU, (rc == 0 && | 
|---|
| 3425 | pAD->selected != 0)); | 
|---|
| 3426 | WinEnableMenuItem(pAD->hwndPopup, IDM_COPYMENU, (rc == 0 && | 
|---|
| 3427 | pAD->selected != 0)); | 
|---|
| 3428 | WinEnableMenuItem(pAD->hwndPopup, IDM_RENAME, (rc == 0 && | 
|---|
| 3429 | pAD->selected != 0)); | 
|---|
| 3430 | WinEnableMenuItem(pAD->hwndPopup, IDM_PRINT, (rc == 0 && | 
|---|
| 3431 | pAD->selected != 0)); | 
|---|
| 3432 | WinEnableMenuItem(pAD->hwndPopup, IDM_SUBJECT, (rc == 0 && | 
|---|
| 3433 | pAD->selected != 0)); | 
|---|
| 3434 | WinEnableMenuItem(pAD->hwndPopup, IDM_OPENSUBMENU, (rc == 0 && | 
|---|
| 3435 | pAD->selected != | 
|---|
| 3436 | 0)); | 
|---|
| 3437 | WinEnableMenuItem(pAD->hwndPopup, IDM_OBJECTSUBMENU, | 
|---|
| 3438 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3439 | WinEnableMenuItem(pAD->hwndPopup, IDM_DELETESUBMENU, | 
|---|
| 3440 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3441 | WinEnableMenuItem(pAD->hwndPopup, IDM_INFO, | 
|---|
| 3442 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3443 | WinEnableMenuItem(pAD->hwndPopup, IDM_ATTRS, | 
|---|
| 3444 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3445 | WinEnableMenuItem(pAD->hwndPopup, IDM_COLLECT, | 
|---|
| 3446 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3447 | WinEnableMenuItem(pAD->hwndPopup, IDM_SAVETOCLIP, | 
|---|
| 3448 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3449 | WinEnableMenuItem(pAD->hwndPopup, IDM_SAVETOCLIPFILENAME, | 
|---|
| 3450 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3451 | WinEnableMenuItem(pAD->hwndPopup, IDM_APPENDTOCLIP, | 
|---|
| 3452 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3453 | WinEnableMenuItem(pAD->hwndPopup, IDM_APPENDTOCLIPFILENAME, | 
|---|
| 3454 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3455 | WinEnableMenuItem(pAD->hwndPopup, IDM_SAVETOLIST, | 
|---|
| 3456 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3457 | WinEnableMenuItem(pAD->hwndPopup, IDM_REMOVE, | 
|---|
| 3458 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3459 | WinEnableMenuItem(pAD->hwndPopup, IDM_HIDEALL, | 
|---|
| 3460 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3461 | WinEnableMenuItem(pAD->hwndPopup, IDM_SELECTALL, | 
|---|
| 3462 | (rc == 0 && pAD->afindexcnt != 0)); | 
|---|
| 3463 | WinEnableMenuItem(pAD->hwndPopup, IDM_SELECTMASK, | 
|---|
| 3464 | (rc == 0 && pAD->afindexcnt != 0)); | 
|---|
| 3465 | WinEnableMenuItem(pAD->hwndPopup, IDM_DESELECTALL, | 
|---|
| 3466 | (rc == 0 && pAD->afindexcnt != 0)); | 
|---|
| 3467 | WinEnableMenuItem(pAD->hwndPopup, IDM_DESELECTMASK, | 
|---|
| 3468 | (rc == 0 && pAD->afindexcnt != 0)); | 
|---|
| 3469 | WinEnableMenuItem(pAD->hwndPopup, IDM_INVERT, | 
|---|
| 3470 | (rc == 0 && pAD->afindexcnt != 0)); | 
|---|
| 3471 | WinEnableMenuItem(pAD->hwndPopup, IDM_FILTER, | 
|---|
| 3472 | (rc == 0 && pAD->afheadcnt != 0)); | 
|---|
| 3473 | if (!rc) | 
|---|
| 3474 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 3475 | if (WinPopupMenu(hwnd, hwnd, pAD->hwndPopup, SHORT1FROMMP(mp1), | 
|---|
| 3476 | SHORT2FROMMP(mp1), 0, | 
|---|
| 3477 | PU_HCONSTRAIN | PU_VCONSTRAIN | | 
|---|
| 3478 | PU_KEYBOARD | PU_MOUSEBUTTON1)) | 
|---|
| 3479 | CenterOverWindow(pAD->hwndPopup); | 
|---|
| 3480 | } | 
|---|
| 3481 | } | 
|---|
| 3482 | break; | 
|---|
| 3483 |  | 
|---|
| 3484 | case UM_CONTAINER_FILLED: | 
|---|
| 3485 | if (pAD) { | 
|---|
| 3486 | pAD->stopflag = 0; | 
|---|
| 3487 | pAD->topfile = 1; | 
|---|
| 3488 | pAD->cursored = 1; | 
|---|
| 3489 | pAD->multiplier = 1; | 
|---|
| 3490 | if (!pAD->afindexcnt) { | 
|---|
| 3491 | if (!fAlertBeepOff) | 
|---|
| 3492 | DosBeep(250, 50); | 
|---|
| 3493 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 3494 | } | 
|---|
| 3495 | else { | 
|---|
| 3496 | if (!fAlertBeepOff) | 
|---|
| 3497 | DosBeep(1000, 25); | 
|---|
| 3498 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 3499 | PostMsg(hwnd, UM_SETUP3, MPVOID, MPVOID); | 
|---|
| 3500 | } | 
|---|
| 3501 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0, | 
|---|
| 3502 | SWP_SHOW | SWP_RESTORE | SWP_ACTIVATE | SWP_ZORDER); | 
|---|
| 3503 | } | 
|---|
| 3504 | return 0; | 
|---|
| 3505 |  | 
|---|
| 3506 | case WM_ERASEBACKGROUND: | 
|---|
| 3507 | WinFillRect((HPS) mp1, (PRECTL) mp2, | 
|---|
| 3508 | standardcolors[Colors[COLORS_NORMALBACK]]); | 
|---|
| 3509 | return 0; | 
|---|
| 3510 |  | 
|---|
| 3511 | case WM_PAINT: | 
|---|
| 3512 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_PAINT"); | 
|---|
| 3513 | if (pAD) { | 
|---|
| 3514 |  | 
|---|
| 3515 | HPS hpsp; | 
|---|
| 3516 | RECTL Rectl; | 
|---|
| 3517 | POINTL ptl; | 
|---|
| 3518 | register ULONG x; | 
|---|
| 3519 | ULONG y, len, numlines; | 
|---|
| 3520 | CHAR szBuff[CCHMAXPATH + 80], szCmmaFmtFileSize[81], szDate[DATE_BUF_BYTES]; | 
|---|
| 3521 | BOOL inverted, hidsys, reado, wascursored; | 
|---|
| 3522 |  | 
|---|
| 3523 | hpsp = WinBeginPaint(hwnd, pAD->hps, &Rectl); | 
|---|
| 3524 | WinFillRect(hpsp, &Rectl, standardcolors[Colors[COLORS_NORMALBACK]]); | 
|---|
| 3525 | if (!pAD->stopflag && | 
|---|
| 3526 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| 3527 | WinQueryWindowRect(hwnd, &Rectl); | 
|---|
| 3528 | numlines = NumLines(&Rectl, pAD); | 
|---|
| 3529 | if (pAD->afindexcnt && numlines) { | 
|---|
| 3530 | if (pAD->topfile > (pAD->afindexcnt + 1) - numlines) | 
|---|
| 3531 | pAD->topfile = (pAD->afindexcnt + 1) - numlines; | 
|---|
| 3532 | if (pAD->topfile > pAD->afindexcnt) | 
|---|
| 3533 | pAD->topfile = 1; | 
|---|
| 3534 | if (!pAD->topfile) | 
|---|
| 3535 | pAD->topfile = 1; | 
|---|
| 3536 | if (pAD->cursored < pAD->topfile) | 
|---|
| 3537 | pAD->cursored = pAD->topfile; | 
|---|
| 3538 | else if (pAD->cursored > (pAD->topfile + numlines) - 1) | 
|---|
| 3539 | pAD->cursored = (pAD->topfile + numlines) - 1; | 
|---|
| 3540 | if (pAD->cursored > pAD->afindexcnt) | 
|---|
| 3541 | pAD->cursored = pAD->afindexcnt; | 
|---|
| 3542 | } | 
|---|
| 3543 | else | 
|---|
| 3544 | pAD->topfile = pAD->cursored = 1; | 
|---|
| 3545 | if (numlines && pAD->afindexcnt) { | 
|---|
| 3546 | GpiSetBackMix(hpsp, BM_OVERPAINT); | 
|---|
| 3547 | wascursored = TRUE; | 
|---|
| 3548 | for (x = pAD->topfile - 1; x < pAD->afindexcnt; x++) { | 
|---|
| 3549 | ptl.x = pAD->horzscroll; | 
|---|
| 3550 | if (wascursored) {          // reestablish normal colors | 
|---|
| 3551 | GpiSetColor(pAD->hps, | 
|---|
| 3552 | standardcolors[Colors[COLORS_NORMALFORE]]); | 
|---|
| 3553 | GpiSetBackColor(pAD->hps, | 
|---|
| 3554 | standardcolors[Colors[COLORS_NORMALBACK]]); | 
|---|
| 3555 | wascursored = inverted = hidsys = reado = FALSE; | 
|---|
| 3556 | } | 
|---|
| 3557 | if (x == pAD->cursored - 1) | 
|---|
| 3558 | wascursored = TRUE; | 
|---|
| 3559 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; | 
|---|
| 3560 | ptl.y = (Rectl.yTop - | 
|---|
| 3561 | (pAD->lMaxHeight * (((x + 1) - pAD->topfile) + 1))); | 
|---|
| 3562 | if (ptl.y - pAD->lMaxDescender <= 0) | 
|---|
| 3563 | break; | 
|---|
| 3564 | if (pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
| 3565 | if (!inverted) { | 
|---|
| 3566 | GpiSetColor(pAD->hps, | 
|---|
| 3567 | standardcolors[Colors | 
|---|
| 3568 | [COLORS_SELECTEDNORMALFORE]]); | 
|---|
| 3569 | GpiSetBackColor(pAD->hps, | 
|---|
| 3570 | (wascursored) ? | 
|---|
| 3571 | standardcolors[Colors | 
|---|
| 3572 | [COLORS_CURSOREDSELECTEDBACK]] | 
|---|
| 3573 | : | 
|---|
| 3574 | standardcolors[Colors[COLORS_SELECTEDBACK]]); | 
|---|
| 3575 | inverted = TRUE; | 
|---|
| 3576 | } | 
|---|
| 3577 | } | 
|---|
| 3578 | else if (inverted || | 
|---|
| 3579 | ((pAD->afindex[y]->attrFile & | 
|---|
| 3580 | (FILE_SYSTEM | FILE_HIDDEN)) != 0) != hidsys || | 
|---|
| 3581 | ((pAD->afindex[y]->attrFile & FILE_READONLY) != 0) != | 
|---|
| 3582 | reado) { | 
|---|
| 3583 | if (pAD->afindex[y]->attrFile & (FILE_SYSTEM | FILE_HIDDEN)) { | 
|---|
| 3584 | GpiSetColor(pAD->hps, | 
|---|
| 3585 | standardcolors[Colors[COLORS_SYSTEMFORE]]); | 
|---|
| 3586 | hidsys = TRUE; | 
|---|
| 3587 | } | 
|---|
| 3588 | else if ((pAD->afindex[y]->attrFile & FILE_READONLY) != 0) { | 
|---|
| 3589 | GpiSetColor(pAD->hps, | 
|---|
| 3590 | standardcolors[Colors[COLORS_READONLYFORE]]); | 
|---|
| 3591 | reado = TRUE; | 
|---|
| 3592 | } | 
|---|
| 3593 | else | 
|---|
| 3594 | GpiSetColor(pAD->hps, | 
|---|
| 3595 | standardcolors[Colors[COLORS_NORMALFORE]]); | 
|---|
| 3596 | GpiSetBackColor(pAD->hps, | 
|---|
| 3597 | (wascursored) ? | 
|---|
| 3598 | standardcolors[Colors | 
|---|
| 3599 | [COLORS_CURSOREDNORMALBACK]] : | 
|---|
| 3600 | standardcolors[Colors[COLORS_NORMALBACK]]); | 
|---|
| 3601 | inverted = FALSE; | 
|---|
| 3602 | } | 
|---|
| 3603 | else if (wascursored) | 
|---|
| 3604 | GpiSetBackColor(pAD->hps, | 
|---|
| 3605 | standardcolors[Colors | 
|---|
| 3606 | [COLORS_CURSOREDNORMALBACK]]); | 
|---|
| 3607 | CommaFmtULL(szCmmaFmtFileSize, | 
|---|
| 3608 | sizeof(szCmmaFmtFileSize), pAD->afindex[y]->cbFile, ' '); | 
|---|
| 3609 | FDateFormat(szDate, pAD->afindex[y]->date); | 
|---|
| 3610 | len = | 
|---|
| 3611 | sprintf(szBuff, | 
|---|
| 3612 | "%c%-*.*s  %-12s  %c%c%c%c%c  %s %02u%s%02u%s%02u ", | 
|---|
| 3613 | wascursored ? '>' : ' ', | 
|---|
| 3614 | pAD->fullnames ? pAD->longestw : pAD->longest, | 
|---|
| 3615 | pAD->fullnames ? pAD->longestw : pAD->longest, | 
|---|
| 3616 | (pAD->fullnames) ? pAD->afindex[y]->fullname : pAD-> | 
|---|
| 3617 | afindex[y]->filename, szCmmaFmtFileSize, | 
|---|
| 3618 | "-A"[((pAD->afindex[y]->attrFile & FILE_ARCHIVED) != | 
|---|
| 3619 | 0)], | 
|---|
| 3620 | "-R"[((pAD->afindex[y]->attrFile & FILE_READONLY) != | 
|---|
| 3621 | 0)], | 
|---|
| 3622 | "-H"[((pAD->afindex[y]->attrFile & FILE_HIDDEN) != 0)], | 
|---|
| 3623 | "-S"[((pAD->afindex[y]->attrFile & FILE_SYSTEM) != 0)], | 
|---|
| 3624 | "-D"[((pAD->afindex[y]->attrFile & FILE_DIRECTORY) != 0)], | 
|---|
| 3625 | szDate, | 
|---|
| 3626 | pAD->afindex[y]->time.hours, TimeSeparator, | 
|---|
| 3627 | pAD->afindex[y]->time.minutes, TimeSeparator, | 
|---|
| 3628 | pAD->afindex[y]->time.twosecs * 2); | 
|---|
| 3629 | GpiCharStringAt(hpsp, &ptl, len, szBuff); | 
|---|
| 3630 | GpiQueryCurrentPosition(hpsp, &ptl); | 
|---|
| 3631 | if (ptl.x + abs(pAD->horzscroll) > pAD->maxx) { | 
|---|
| 3632 | pAD->maxx = ptl.x + abs(pAD->horzscroll); | 
|---|
| 3633 | WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE, | 
|---|
| 3634 | MPFROM2SHORT((SHORT) Rectl.xRight, | 
|---|
| 3635 | (SHORT) pAD->maxx), MPVOID); | 
|---|
| 3636 | } | 
|---|
| 3637 | } | 
|---|
| 3638 | } | 
|---|
| 3639 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 3640 | } | 
|---|
| 3641 | WinEndPaint(hpsp); | 
|---|
| 3642 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 3643 | if (!pAD->stopflag) | 
|---|
| 3644 | WinSendMsg(pAD->hvscroll, SBM_SETSCROLLBAR, | 
|---|
| 3645 | MPFROMSHORT((SHORT) (pAD->topfile / pAD->multiplier)), | 
|---|
| 3646 | MPFROM2SHORT(1, | 
|---|
| 3647 | (SHORT) (pAD->afindexcnt / pAD->multiplier) - | 
|---|
| 3648 | (numlines - 1))); | 
|---|
| 3649 | WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR, | 
|---|
| 3650 | MPFROMSHORT((SHORT) abs(pAD->horzscroll)), | 
|---|
| 3651 | MPFROM2SHORT(0, (SHORT) (pAD->maxx - Rectl.xRight))); | 
|---|
| 3652 | WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE, | 
|---|
| 3653 | MPFROM2SHORT((SHORT) Rectl.xRight, (SHORT) pAD->maxx), | 
|---|
| 3654 | MPVOID); | 
|---|
| 3655 | } | 
|---|
| 3656 | break; | 
|---|
| 3657 |  | 
|---|
| 3658 | case WM_HSCROLL: | 
|---|
| 3659 | { | 
|---|
| 3660 | RECTL rectl; | 
|---|
| 3661 | BOOL invalidate = TRUE; | 
|---|
| 3662 |  | 
|---|
| 3663 | WinQueryWindowRect(hwnd, &rectl); | 
|---|
| 3664 | switch (SHORT2FROMMP(mp2)) { | 
|---|
| 3665 | case SB_PAGERIGHT: | 
|---|
| 3666 | if (abs(pAD->horzscroll) < pAD->maxx - rectl.xRight) { | 
|---|
| 3667 | pAD->horzscroll -= rectl.xRight; | 
|---|
| 3668 | if (abs(pAD->horzscroll) > pAD->maxx - rectl.xRight) | 
|---|
| 3669 | pAD->horzscroll = -(pAD->maxx - rectl.xRight); | 
|---|
| 3670 | } | 
|---|
| 3671 | break; | 
|---|
| 3672 |  | 
|---|
| 3673 | case SB_PAGELEFT: | 
|---|
| 3674 | if (pAD->horzscroll < 0) { | 
|---|
| 3675 | pAD->horzscroll += rectl.xRight; | 
|---|
| 3676 | if (pAD->horzscroll > 0) | 
|---|
| 3677 | pAD->horzscroll = 0; | 
|---|
| 3678 | } | 
|---|
| 3679 | break; | 
|---|
| 3680 |  | 
|---|
| 3681 | case SB_LINERIGHT: | 
|---|
| 3682 | if (abs(pAD->horzscroll) < pAD->maxx - rectl.xRight) | 
|---|
| 3683 | pAD->horzscroll -= pAD->fattrs.lAveCharWidth; | 
|---|
| 3684 | break; | 
|---|
| 3685 |  | 
|---|
| 3686 | case SB_LINELEFT: | 
|---|
| 3687 | if (pAD->horzscroll < 0) | 
|---|
| 3688 | pAD->horzscroll += pAD->fattrs.lAveCharWidth; | 
|---|
| 3689 | break; | 
|---|
| 3690 |  | 
|---|
| 3691 | case SB_SLIDERTRACK: | 
|---|
| 3692 | pAD->horzscroll = SHORT1FROMMP(mp2); | 
|---|
| 3693 | pAD->horzscroll = -(pAD->horzscroll); | 
|---|
| 3694 | if (pAD->horzscroll > 0) | 
|---|
| 3695 | pAD->horzscroll = 0; | 
|---|
| 3696 | if (abs(pAD->horzscroll) > pAD->maxx - rectl.xRight) | 
|---|
| 3697 | pAD->horzscroll = -(pAD->maxx - rectl.xRight); | 
|---|
| 3698 | break; | 
|---|
| 3699 |  | 
|---|
| 3700 | default: | 
|---|
| 3701 | invalidate = FALSE; | 
|---|
| 3702 | break; | 
|---|
| 3703 | } | 
|---|
| 3704 | if (invalidate) | 
|---|
| 3705 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 3706 | } | 
|---|
| 3707 | break; | 
|---|
| 3708 |  | 
|---|
| 3709 | case WM_VSCROLL: | 
|---|
| 3710 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_VSCROLL"); | 
|---|
| 3711 | if (pAD && !pAD->stopflag && | 
|---|
| 3712 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| 3713 |  | 
|---|
| 3714 | ULONG numlines, wascursored; | 
|---|
| 3715 | RECTL rcl; | 
|---|
| 3716 |  | 
|---|
| 3717 | if (pAD->afindexcnt) { | 
|---|
| 3718 | WinQueryWindowRect(hwnd, &rcl); | 
|---|
| 3719 | numlines = NumLines(&rcl, pAD); | 
|---|
| 3720 | if (numlines) { | 
|---|
| 3721 | wascursored = pAD->cursored; | 
|---|
| 3722 | switch (SHORT2FROMMP(mp2)) { | 
|---|
| 3723 | case SB_PAGEUP: | 
|---|
| 3724 | if (pAD->topfile > 1) { | 
|---|
| 3725 | pAD->topfile -= numlines; | 
|---|
| 3726 | if (pAD->topfile > pAD->afindexcnt || | 
|---|
| 3727 | pAD->topfile > (pAD->afindexcnt + 1) - numlines) | 
|---|
| 3728 | pAD->topfile = 1; | 
|---|
| 3729 | if (pAD->cursored > pAD->topfile + numlines) | 
|---|
| 3730 | pAD->cursored = pAD->topfile + numlines; | 
|---|
| 3731 | if (pAD->cursored > pAD->afindexcnt) | 
|---|
| 3732 | pAD->cursored = pAD->afindexcnt; | 
|---|
| 3733 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 3734 | } | 
|---|
| 3735 | break; | 
|---|
| 3736 | case SB_PAGEDOWN: | 
|---|
| 3737 | if (pAD->topfile <= pAD->afindexcnt - numlines) { | 
|---|
| 3738 | pAD->topfile += numlines; | 
|---|
| 3739 | if (pAD->topfile > (pAD->afindexcnt + 1) - numlines) | 
|---|
| 3740 | pAD->topfile = (pAD->afindexcnt + 1) - numlines; | 
|---|
| 3741 | if (pAD->cursored < pAD->topfile) | 
|---|
| 3742 | pAD->cursored = pAD->topfile; | 
|---|
| 3743 | if (pAD->cursored > (pAD->topfile + numlines) - 1) | 
|---|
| 3744 | pAD->cursored = (pAD->topfile + numlines) - 1; | 
|---|
| 3745 | if (pAD->cursored > pAD->afindexcnt) | 
|---|
| 3746 | pAD->cursored = pAD->afindexcnt; | 
|---|
| 3747 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 3748 | } | 
|---|
| 3749 | break; | 
|---|
| 3750 | case SB_LINEDOWN: | 
|---|
| 3751 | if (pAD->topfile <= pAD->afindexcnt - numlines) { | 
|---|
| 3752 |  | 
|---|
| 3753 | RECTL Rectl, iRectl; | 
|---|
| 3754 |  | 
|---|
| 3755 | pAD->topfile++; | 
|---|
| 3756 | if (pAD->cursored < pAD->topfile) | 
|---|
| 3757 | pAD->cursored = pAD->topfile; | 
|---|
| 3758 | else if (pAD->cursored > (pAD->topfile + numlines) - 1) | 
|---|
| 3759 | pAD->cursored = (pAD->topfile + numlines) - 1; | 
|---|
| 3760 | if (pAD->cursored > pAD->afindexcnt) | 
|---|
| 3761 | pAD->cursored = pAD->afindexcnt; | 
|---|
| 3762 | WinQueryWindowRect(hwnd, &Rectl); | 
|---|
| 3763 | WinScrollWindow(hwnd, 0, pAD->lMaxHeight, | 
|---|
| 3764 | NULL, NULL, NULLHANDLE, &iRectl, 0); | 
|---|
| 3765 | WinFillRect(pAD->hps, &iRectl, | 
|---|
| 3766 | standardcolors[Colors[COLORS_NORMALBACK]]); | 
|---|
| 3767 | PaintLine(hwnd, pAD->hps, (pAD->topfile + numlines) - 2, | 
|---|
| 3768 | pAD->topfile, &Rectl); | 
|---|
| 3769 | if (pAD->cursored != pAD->topfile + numlines) | 
|---|
| 3770 | PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, | 
|---|
| 3771 | &Rectl); | 
|---|
| 3772 | if (wascursored != pAD->cursored | 
|---|
| 3773 | && wascursored < pAD->topfile + numlines | 
|---|
| 3774 | && wascursored >= pAD->topfile) | 
|---|
| 3775 | PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, | 
|---|
| 3776 | &Rectl); | 
|---|
| 3777 | if (wascursored != pAD->cursored) | 
|---|
| 3778 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 3779 | WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR, | 
|---|
| 3780 | MPFROMSHORT((SHORT) abs(pAD->horzscroll)), | 
|---|
| 3781 | MPFROM2SHORT(0, (SHORT) (pAD->maxx - Rectl.xRight))); | 
|---|
| 3782 | WinSendMsg(pAD->hvscroll, SBM_SETSCROLLBAR, | 
|---|
| 3783 | MPFROMSHORT((SHORT) (pAD->topfile / | 
|---|
| 3784 | pAD->multiplier)), | 
|---|
| 3785 | MPFROM2SHORT(1, (SHORT) (pAD->afindexcnt / | 
|---|
| 3786 | pAD->multiplier) - | 
|---|
| 3787 | (numlines - 1))); | 
|---|
| 3788 | } | 
|---|
| 3789 | break; | 
|---|
| 3790 | case SB_LINEUP: | 
|---|
| 3791 | if (pAD->topfile > 1) { | 
|---|
| 3792 |  | 
|---|
| 3793 | RECTL Rectl, iRectl; | 
|---|
| 3794 |  | 
|---|
| 3795 | pAD->topfile--; | 
|---|
| 3796 | if (pAD->cursored < pAD->topfile) | 
|---|
| 3797 | pAD->cursored = pAD->topfile; | 
|---|
| 3798 | else if (pAD->cursored > (pAD->topfile + numlines) - 1) | 
|---|
| 3799 | pAD->cursored = (pAD->topfile + numlines) - 1; | 
|---|
| 3800 | if (pAD->cursored > pAD->afindexcnt) | 
|---|
| 3801 | pAD->cursored = pAD->afindexcnt; | 
|---|
| 3802 | WinQueryWindowRect(hwnd, &Rectl); | 
|---|
| 3803 | WinScrollWindow(hwnd, 0, -pAD->lMaxHeight, | 
|---|
| 3804 | NULL, NULL, NULLHANDLE, &iRectl, 0); | 
|---|
| 3805 | WinFillRect(pAD->hps, &iRectl, | 
|---|
| 3806 | standardcolors[Colors[COLORS_NORMALBACK]]); | 
|---|
| 3807 | iRectl = Rectl; | 
|---|
| 3808 | iRectl.yTop -= ((numlines * pAD->lMaxHeight) + | 
|---|
| 3809 | pAD->lMaxDescender); | 
|---|
| 3810 | WinFillRect(pAD->hps, &iRectl, | 
|---|
| 3811 | standardcolors[pAD->aulColors[COLORS_NORMALBACK]]); | 
|---|
| 3812 | PaintLine(hwnd, pAD->hps, pAD->topfile - 1, pAD->topfile, | 
|---|
| 3813 | &Rectl); | 
|---|
| 3814 | if (pAD->cursored != pAD->topfile) | 
|---|
| 3815 | PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, | 
|---|
| 3816 | &Rectl); | 
|---|
| 3817 | if (pAD->cursored != wascursored && wascursored >= pAD->topfile | 
|---|
| 3818 | && wascursored < pAD->topfile + numlines) | 
|---|
| 3819 | PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, | 
|---|
| 3820 | &Rectl); | 
|---|
| 3821 | if (pAD->cursored != wascursored) | 
|---|
| 3822 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 3823 | WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR, | 
|---|
| 3824 | MPFROMSHORT((SHORT) abs(pAD->horzscroll)), | 
|---|
| 3825 | MPFROM2SHORT(0, (SHORT) (pAD->maxx - Rectl.xRight))); | 
|---|
| 3826 | WinSendMsg(pAD->hvscroll, SBM_SETSCROLLBAR, | 
|---|
| 3827 | MPFROMSHORT((SHORT) (pAD->topfile / | 
|---|
| 3828 | pAD->multiplier)), | 
|---|
| 3829 | MPFROM2SHORT(1, (SHORT) (pAD->afindexcnt / | 
|---|
| 3830 | pAD->multiplier) - | 
|---|
| 3831 | (numlines - 1))); | 
|---|
| 3832 | } | 
|---|
| 3833 | break; | 
|---|
| 3834 | case SB_SLIDERTRACK: | 
|---|
| 3835 | if ((SHORT1FROMMP(mp2) >= 1) || | 
|---|
| 3836 | (SHORT1FROMMP(mp2)) <= pAD->afindexcnt) { | 
|---|
| 3837 | pAD->topfile = (ULONG) SHORT1FROMMP(mp2) * pAD->multiplier; | 
|---|
| 3838 | if (pAD->topfile > (pAD->afindexcnt + 1) - numlines) | 
|---|
| 3839 | pAD->topfile = (pAD->afindexcnt + 1) - numlines; | 
|---|
| 3840 | if (!pAD->topfile) | 
|---|
| 3841 | pAD->topfile = 1; | 
|---|
| 3842 | if (pAD->cursored < pAD->topfile) | 
|---|
| 3843 | pAD->cursored = pAD->topfile; | 
|---|
| 3844 | else if (pAD->cursored > pAD->topfile + numlines) | 
|---|
| 3845 | pAD->cursored = pAD->topfile + numlines; | 
|---|
| 3846 | if (pAD->cursored > pAD->afindexcnt) | 
|---|
| 3847 | pAD->cursored = pAD->afindexcnt; | 
|---|
| 3848 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 3849 | } | 
|---|
| 3850 | else | 
|---|
| 3851 | WinAlarm(HWND_DESKTOP, WA_NOTE); | 
|---|
| 3852 | break; | 
|---|
| 3853 | } | 
|---|
| 3854 | } | 
|---|
| 3855 | } | 
|---|
| 3856 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 3857 | } | 
|---|
| 3858 | break; | 
|---|
| 3859 |  | 
|---|
| 3860 | case WM_INITMENU: | 
|---|
| 3861 | if (pAD) { | 
|---|
| 3862 | switch (SHORT1FROMMP(mp1)) { | 
|---|
| 3863 | case IDM_FILESMENU: | 
|---|
| 3864 | { | 
|---|
| 3865 | APIRET rc; | 
|---|
| 3866 |  | 
|---|
| 3867 | rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN); | 
|---|
| 3868 | WinEnableMenuItem((HWND) mp2, IDM_DUPES, (rc == 0)); | 
|---|
| 3869 | WinEnableMenuItem((HWND) mp2, IDM_COLLECT, (rc == 0 && | 
|---|
| 3870 | pAD->selected != 0)); | 
|---|
| 3871 | WinEnableMenuItem((HWND) mp2, IDM_SAVETOCLIP, (rc == 0 && | 
|---|
| 3872 | pAD->selected != 0)); | 
|---|
| 3873 | WinEnableMenuItem((HWND) mp2, IDM_SAVETOCLIPFILENAME, | 
|---|
| 3874 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3875 | WinEnableMenuItem((HWND) mp2, IDM_APPENDTOCLIP, | 
|---|
| 3876 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3877 | WinEnableMenuItem((HWND) mp2, IDM_APPENDTOCLIPFILENAME, | 
|---|
| 3878 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3879 | WinEnableMenuItem((HWND) mp2, IDM_SAVETOLIST, | 
|---|
| 3880 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3881 | WinEnableMenuItem((HWND) mp2, IDM_REMOVE, | 
|---|
| 3882 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3883 | WinEnableMenuItem((HWND) mp2, IDM_HIDEALL, | 
|---|
| 3884 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3885 | WinEnableMenuItem((HWND) mp2, IDM_DELETESUBMENU, | 
|---|
| 3886 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3887 | WinEnableMenuItem((HWND) mp2, IDM_INFO, | 
|---|
| 3888 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3889 | WinEnableMenuItem((HWND) mp2, IDM_ATTRS, | 
|---|
| 3890 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3891 | WinEnableMenuItem((HWND) mp2, IDM_EAS, | 
|---|
| 3892 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3893 | WinEnableMenuItem((HWND) mp2, IDM_UUDECODE, | 
|---|
| 3894 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3895 | WinEnableMenuItem((HWND) mp2, IDM_UNLOCKFILE, | 
|---|
| 3896 | (rc == 0 && fUnlock && pAD->selected != 0)); | 
|---|
| 3897 | WinEnableMenuItem((HWND) mp2, IDM_EXTRACT, | 
|---|
| 3898 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3899 | WinEnableMenuItem((HWND) mp2, IDM_ARCHIVE, | 
|---|
| 3900 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3901 | WinEnableMenuItem((HWND) mp2, IDM_MOVEMENU, | 
|---|
| 3902 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3903 | WinEnableMenuItem((HWND) mp2, IDM_COPYMENU, | 
|---|
| 3904 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3905 | WinEnableMenuItem((HWND) mp2, IDM_RENAME, | 
|---|
| 3906 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3907 | WinEnableMenuItem((HWND) mp2, IDM_PRINT, | 
|---|
| 3908 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3909 | WinEnableMenuItem((HWND) mp2, IDM_SUBJECT, | 
|---|
| 3910 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3911 | WinEnableMenuItem((HWND) mp2, IDM_OPENSUBMENU, | 
|---|
| 3912 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3913 | WinEnableMenuItem((HWND) mp2, IDM_OBJECTSUBMENU, | 
|---|
| 3914 | (rc == 0 && pAD->selected != 0)); | 
|---|
| 3915 | if (!rc) | 
|---|
| 3916 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 3917 | } | 
|---|
| 3918 | break; | 
|---|
| 3919 |  | 
|---|
| 3920 | case IDM_SELECTSUBMENU: | 
|---|
| 3921 | { | 
|---|
| 3922 | APIRET rc; | 
|---|
| 3923 |  | 
|---|
| 3924 | rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN); | 
|---|
| 3925 | WinEnableMenuItem((HWND) mp2, IDM_SELECTALL, (rc == 0 && | 
|---|
| 3926 | pAD->afindexcnt != 0 && | 
|---|
| 3927 | (pAD->afindexcnt != | 
|---|
| 3928 | pAD->selected || | 
|---|
| 3929 | !pAD->selected))); | 
|---|
| 3930 | WinEnableMenuItem((HWND) mp2, IDM_SELECTMASK, (rc == 0 && | 
|---|
| 3931 | pAD->afindexcnt != 0 && | 
|---|
| 3932 | (pAD->afindexcnt != | 
|---|
| 3933 | pAD->selected || | 
|---|
| 3934 | !pAD->selected))); | 
|---|
| 3935 | WinEnableMenuItem((HWND) mp2, IDM_DESELECTALL, (rc == 0 && | 
|---|
| 3936 | pAD->afindexcnt != 0 | 
|---|
| 3937 | && pAD->selected)); | 
|---|
| 3938 | WinEnableMenuItem((HWND) mp2, IDM_DESELECTMASK, | 
|---|
| 3939 | (rc == 0 && pAD->afindexcnt != 0) && pAD->selected); | 
|---|
| 3940 | WinEnableMenuItem((HWND) mp2, IDM_INVERT, | 
|---|
| 3941 | (rc == 0 && pAD->afindexcnt != 0)); | 
|---|
| 3942 | if (!rc) | 
|---|
| 3943 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 3944 | } | 
|---|
| 3945 | break; | 
|---|
| 3946 |  | 
|---|
| 3947 | case IDM_SORTSUBMENU: | 
|---|
| 3948 | { | 
|---|
| 3949 | APIRET rc; | 
|---|
| 3950 |  | 
|---|
| 3951 | rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN); | 
|---|
| 3952 | WinEnableMenuItem((HWND) mp2, IDM_SORTNAME, (rc == 0)); | 
|---|
| 3953 | WinEnableMenuItem((HWND) mp2, IDM_SORTEASIZE, (rc == 0)); | 
|---|
| 3954 | WinEnableMenuItem((HWND) mp2, IDM_SORTSIZE, (rc == 0)); | 
|---|
| 3955 | WinEnableMenuItem((HWND) mp2, IDM_SORTLWDATE, (rc == 0)); | 
|---|
| 3956 | WinEnableMenuItem((HWND) mp2, IDM_SORTFILENAME, (rc == 0)); | 
|---|
| 3957 | WinEnableMenuItem((HWND) mp2, IDM_SORTFIRST, (rc == 0)); | 
|---|
| 3958 | if (!rc) | 
|---|
| 3959 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 3960 | } | 
|---|
| 3961 | WinCheckMenuItem((HWND) mp2, IDM_SORTNAME, | 
|---|
| 3962 | (pAD->pfnCompare == comparefullnames)); | 
|---|
| 3963 | WinCheckMenuItem((HWND) mp2, IDM_SORTEASIZE, | 
|---|
| 3964 | (pAD->pfnCompare == (PFNSORT) NULL)); | 
|---|
| 3965 | WinCheckMenuItem((HWND) mp2, IDM_SORTSIZE, | 
|---|
| 3966 | (pAD->pfnCompare == comparesizes)); | 
|---|
| 3967 | WinCheckMenuItem((HWND) mp2, IDM_SORTLWDATE, | 
|---|
| 3968 | (pAD->pfnCompare == comparedates)); | 
|---|
| 3969 | WinCheckMenuItem((HWND) mp2, IDM_SORTFILENAME, | 
|---|
| 3970 | (pAD->pfnCompare == comparenames)); | 
|---|
| 3971 | WinCheckMenuItem((HWND) mp2, IDM_SORTREVERSE, pAD->invertsort); | 
|---|
| 3972 | WinCheckMenuItem((HWND) mp2, IDM_SORTFIRST, | 
|---|
| 3973 | (pAD->pfnCompare == compareexts)); | 
|---|
| 3974 | break; | 
|---|
| 3975 |  | 
|---|
| 3976 | case IDM_VIEWSMENU: | 
|---|
| 3977 | { | 
|---|
| 3978 | APIRET rc; | 
|---|
| 3979 |  | 
|---|
| 3980 | rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN); | 
|---|
| 3981 | WinEnableMenuItem((HWND) mp2, IDM_RESCAN, (rc == 0)); | 
|---|
| 3982 | WinEnableMenuItem((HWND) mp2, IDM_FILTER, (rc == 0 && | 
|---|
| 3983 | pAD->afheadcnt != 0)); | 
|---|
| 3984 | if (!rc) | 
|---|
| 3985 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 3986 | } | 
|---|
| 3987 | WinCheckMenuItem((HWND) mp2, IDM_SHOWLNAMES, pAD->fullnames); | 
|---|
| 3988 | break; | 
|---|
| 3989 | } | 
|---|
| 3990 | } | 
|---|
| 3991 | break; | 
|---|
| 3992 |  | 
|---|
| 3993 | case WM_COMMAND: | 
|---|
| 3994 | if (!pAD) { | 
|---|
| 3995 | Runtime_Error(pszSrcFile, __LINE__, NULL); | 
|---|
| 3996 | return 0; | 
|---|
| 3997 | } | 
|---|
| 3998 | switch (SHORT1FROMMP(mp1)) { | 
|---|
| 3999 | case IDM_SETTARGET: | 
|---|
| 4000 | SetTargetDir(hwnd, FALSE, NULL); | 
|---|
| 4001 | break; | 
|---|
| 4002 |  | 
|---|
| 4003 | case IDM_DUPES: | 
|---|
| 4004 | if (!pAD->stopflag && | 
|---|
| 4005 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| 4006 | pAD->dupeflags = (USHORT) WinDlgBox(HWND_DESKTOP, | 
|---|
| 4007 | hwnd, | 
|---|
| 4008 | DupeDlgProc, | 
|---|
| 4009 | FM3ModHandle, | 
|---|
| 4010 | DUPE_FRAME, | 
|---|
| 4011 | MPFROM2SHORT(pAD->dupeflags, 0)); | 
|---|
| 4012 | if (pAD->dupeflags) { | 
|---|
| 4013 | xbeginthread(FindDupesThread, | 
|---|
| 4014 | 65536, | 
|---|
| 4015 | (PVOID)hwnd, | 
|---|
| 4016 | pszSrcFile, | 
|---|
| 4017 | __LINE__); | 
|---|
| 4018 | } | 
|---|
| 4019 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 4020 | } | 
|---|
| 4021 | break; | 
|---|
| 4022 |  | 
|---|
| 4023 | case IDM_COLORPALETTE: | 
|---|
| 4024 | { | 
|---|
| 4025 | COLORS co; | 
|---|
| 4026 | LONG temp[COLORS_MAX]; | 
|---|
| 4027 |  | 
|---|
| 4028 | memset(&co, 0, sizeof(co)); | 
|---|
| 4029 | co.size = sizeof(co); | 
|---|
| 4030 | co.numcolors = COLORS_MAX; | 
|---|
| 4031 | co.colors = pAD->aulColors; | 
|---|
| 4032 | co.descriptions = IDS_SACOLORS1TEXT; | 
|---|
| 4033 | co.origs = temp; | 
|---|
| 4034 | co.prompt = IDS_SACOLORSPROMPTTEXT; | 
|---|
| 4035 | memcpy(temp, pAD->aulColors, sizeof(LONG) * COLORS_MAX); | 
|---|
| 4036 | if (WinDlgBox(HWND_DESKTOP, | 
|---|
| 4037 | hwnd, | 
|---|
| 4038 | ColorDlgProc, | 
|---|
| 4039 | FM3ModHandle, COLOR_FRAME, (PVOID) & co)) { | 
|---|
| 4040 | memcpy(Colors, pAD->aulColors, sizeof(LONG) * COLORS_MAX); | 
|---|
| 4041 | PrfWriteProfileData(fmprof, | 
|---|
| 4042 | appname, | 
|---|
| 4043 | "Seeall.Colors", | 
|---|
| 4044 | &pAD->aulColors, sizeof(LONG) * COLORS_MAX); | 
|---|
| 4045 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 4046 | } | 
|---|
| 4047 | } | 
|---|
| 4048 | break; | 
|---|
| 4049 |  | 
|---|
| 4050 | case IDM_CODEPAGE: | 
|---|
| 4051 | { | 
|---|
| 4052 | INT cp; | 
|---|
| 4053 |  | 
|---|
| 4054 | cp = PickCodepage(hwnd); | 
|---|
| 4055 | if (cp != -1) { | 
|---|
| 4056 | pAD->fattrs.usCodePage = (USHORT) cp; | 
|---|
| 4057 | Codepage = pAD->fattrs.usCodePage; | 
|---|
| 4058 | PrfWriteProfileData(fmprof, | 
|---|
| 4059 | appname, | 
|---|
| 4060 | "Seeall.Codepage", | 
|---|
| 4061 | &pAD->fattrs.usCodePage, sizeof(USHORT)); | 
|---|
| 4062 | GpiDeleteSetId(pAD->hps, SEEALLFILECNR_FONT_LCID); | 
|---|
| 4063 | GpiAssociate(pAD->hps, 0); | 
|---|
| 4064 | GpiDestroyPS(pAD->hps); | 
|---|
| 4065 | pAD->hps = InitWindow(hwnd); | 
|---|
| 4066 | pAD->maxx = pAD->horzscroll = 0; | 
|---|
| 4067 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 4068 | } | 
|---|
| 4069 | } | 
|---|
| 4070 | break; | 
|---|
| 4071 |  | 
|---|
| 4072 | case IDM_FONTPALETTE: | 
|---|
| 4073 | SetMLEFont(hwnd, &pAD->fattrs, 3); | 
|---|
| 4074 | PrfWriteProfileData(fmprof, | 
|---|
| 4075 | appname, | 
|---|
| 4076 | "Seeall.Fattrs", &pAD->fattrs, sizeof(pAD->fattrs)); | 
|---|
| 4077 | Fattrs = pAD->fattrs; | 
|---|
| 4078 | GpiDeleteSetId(pAD->hps, SEEALLFILECNR_FONT_LCID); | 
|---|
| 4079 | GpiAssociate(pAD->hps, 0); | 
|---|
| 4080 | GpiDestroyPS(pAD->hps); | 
|---|
| 4081 | pAD->hps = InitWindow(hwnd); | 
|---|
| 4082 | pAD->maxx = pAD->horzscroll = 0; | 
|---|
| 4083 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 4084 | break; | 
|---|
| 4085 |  | 
|---|
| 4086 | case IDM_SHOWLNAMES: | 
|---|
| 4087 | pAD->fullnames = (pAD->fullnames) ? FALSE : TRUE; | 
|---|
| 4088 | PrfWriteProfileData(fmprof, | 
|---|
| 4089 | appname, | 
|---|
| 4090 | "Seeall.Fullnames", &pAD->fullnames, sizeof(BOOL)); | 
|---|
| 4091 | Fullnames = pAD->fullnames; | 
|---|
| 4092 | pAD->maxx = pAD->horzscroll = 0; | 
|---|
| 4093 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 4094 | break; | 
|---|
| 4095 |  | 
|---|
| 4096 | case IDM_SORTREVERSE: | 
|---|
| 4097 | pAD->invertsort = (pAD->invertsort) ? FALSE : TRUE; | 
|---|
| 4098 | SortReverse = pAD->invertsort; | 
|---|
| 4099 | PrfWriteProfileData(fmprof, | 
|---|
| 4100 | appname, | 
|---|
| 4101 | "Seeall.SortReverse", | 
|---|
| 4102 | (PVOID) & pAD->invertsort, sizeof(BOOL)); | 
|---|
| 4103 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 4104 | break; | 
|---|
| 4105 |  | 
|---|
| 4106 | case IDM_SORTEASIZE: | 
|---|
| 4107 | case IDM_SORTNAME: | 
|---|
| 4108 | case IDM_SORTFILENAME: | 
|---|
| 4109 | case IDM_SORTSIZE: | 
|---|
| 4110 | case IDM_SORTLWDATE: | 
|---|
| 4111 | case IDM_SORTFIRST: | 
|---|
| 4112 | if (!pAD->stopflag && | 
|---|
| 4113 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| 4114 | { | 
|---|
| 4115 | USHORT dummy = SHORT1FROMMP(mp1); | 
|---|
| 4116 |  | 
|---|
| 4117 | PrfWriteProfileData(fmprof, | 
|---|
| 4118 | appname, | 
|---|
| 4119 | "Seeall.Sort", (PVOID) & dummy, sizeof(USHORT)); | 
|---|
| 4120 | SortType = SHORT1FROMMP(mp1); | 
|---|
| 4121 | } | 
|---|
| 4122 | WinSetPointer(HWND_DESKTOP, hptrBusy); | 
|---|
| 4123 | WinSendMsg(hwnd, UM_RESCAN, MPFROMLONG(1), MPVOID); | 
|---|
| 4124 | switch (SHORT1FROMMP(mp1)) { | 
|---|
| 4125 | case IDM_SORTEASIZE: | 
|---|
| 4126 | pAD->pfnCompare = (PFNSORT) NULL; | 
|---|
| 4127 | ReSort(hwnd); | 
|---|
| 4128 | break; | 
|---|
| 4129 |  | 
|---|
| 4130 | case IDM_SORTNAME: | 
|---|
| 4131 | pAD->pfnCompare = comparefullnames; | 
|---|
| 4132 | ReSort(hwnd); | 
|---|
| 4133 | break; | 
|---|
| 4134 |  | 
|---|
| 4135 | case IDM_SORTFILENAME: | 
|---|
| 4136 | pAD->pfnCompare = comparenames; | 
|---|
| 4137 | ReSort(hwnd); | 
|---|
| 4138 | break; | 
|---|
| 4139 |  | 
|---|
| 4140 | case IDM_SORTSIZE: | 
|---|
| 4141 | pAD->pfnCompare = comparesizes; | 
|---|
| 4142 | ReSort(hwnd); | 
|---|
| 4143 | break; | 
|---|
| 4144 |  | 
|---|
| 4145 | case IDM_SORTLWDATE: | 
|---|
| 4146 | pAD->pfnCompare = comparedates; | 
|---|
| 4147 | ReSort(hwnd); | 
|---|
| 4148 | break; | 
|---|
| 4149 |  | 
|---|
| 4150 | case IDM_SORTFIRST: | 
|---|
| 4151 | pAD->pfnCompare = compareexts; | 
|---|
| 4152 | ReSort(hwnd); | 
|---|
| 4153 | break; | 
|---|
| 4154 | } | 
|---|
| 4155 | WinSetPointer(HWND_DESKTOP, hptrArrow); | 
|---|
| 4156 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 4157 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 4158 | } | 
|---|
| 4159 | break; | 
|---|
| 4160 |  | 
|---|
| 4161 | case IDM_FILTER: | 
|---|
| 4162 | if (!pAD->stopflag && | 
|---|
| 4163 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| 4164 | FilterList(hwnd); | 
|---|
| 4165 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 4166 | } | 
|---|
| 4167 | break; | 
|---|
| 4168 |  | 
|---|
| 4169 | case IDM_RESCAN: | 
|---|
| 4170 | if (!pAD->stopflag && | 
|---|
| 4171 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| 4172 |  | 
|---|
| 4173 | CHAR tempflags[26]; | 
|---|
| 4174 |  | 
|---|
| 4175 | memcpy(tempflags, pAD->abDrvFlags, sizeof(tempflags)); | 
|---|
| 4176 | if (!WinDlgBox(HWND_DESKTOP, hwnd, AFDrvsWndProc, FM3ModHandle, | 
|---|
| 4177 | DRVS_FRAME, (PVOID) pAD)) { | 
|---|
| 4178 | memcpy(pAD->abDrvFlags, tempflags, sizeof(tempflags)); | 
|---|
| 4179 | *pAD->szFindPath = 0; | 
|---|
| 4180 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 4181 | break; | 
|---|
| 4182 | } | 
|---|
| 4183 | WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1), | 
|---|
| 4184 | MPVOID); | 
|---|
| 4185 | WinSendMsg(pAD->hvscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1), | 
|---|
| 4186 | MPVOID); | 
|---|
| 4187 | pAD->topfile = 1; | 
|---|
| 4188 | pAD->cursored = 1; | 
|---|
| 4189 | pAD->selected = 0; | 
|---|
| 4190 | pAD->ullSelectedBytes = 0; | 
|---|
| 4191 | pAD->maxx = pAD->horzscroll = 0; | 
|---|
| 4192 | FreeAllFilesList(hwnd); | 
|---|
| 4193 | pAD->stopflag = 0; | 
|---|
| 4194 | if (xbeginthread(FindAllThread, | 
|---|
| 4195 | 524288, | 
|---|
| 4196 | (PVOID)hwnd, | 
|---|
| 4197 | pszSrcFile, | 
|---|
| 4198 | __LINE__) == -1) | 
|---|
| 4199 | { | 
|---|
| 4200 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT)); | 
|---|
| 4201 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 4202 | } | 
|---|
| 4203 | else { | 
|---|
| 4204 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 4205 | DosSleep(50);//05 Aug 07 GKY 100 | 
|---|
| 4206 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 4207 | PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID); | 
|---|
| 4208 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| 4209 | } | 
|---|
| 4210 | } | 
|---|
| 4211 | break; | 
|---|
| 4212 | case IDM_UNHIDEALL: | 
|---|
| 4213 | { | 
|---|
| 4214 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| 4215 | FilterAll(hwnd, ad); | 
|---|
| 4216 | } | 
|---|
| 4217 | break; | 
|---|
| 4218 |  | 
|---|
| 4219 | case IDM_DELETE: | 
|---|
| 4220 | case IDM_PERMDELETE: | 
|---|
| 4221 | case IDM_SELECTALL: | 
|---|
| 4222 | case IDM_DESELECTALL: | 
|---|
| 4223 | case IDM_INVERT: | 
|---|
| 4224 | case IDM_SELECTMASK: | 
|---|
| 4225 | case IDM_DESELECTMASK: | 
|---|
| 4226 | case IDM_REMOVE: | 
|---|
| 4227 | case IDM_HIDEALL: | 
|---|
| 4228 | case IDM_COLLECT: | 
|---|
| 4229 | case IDM_COLLECTOR: | 
|---|
| 4230 | case IDM_SAVETOCLIP: | 
|---|
| 4231 | case IDM_SAVETOCLIPFILENAME: | 
|---|
| 4232 | case IDM_APPENDTOCLIP: | 
|---|
| 4233 | case IDM_APPENDTOCLIPFILENAME: | 
|---|
| 4234 | case IDM_SAVETOLIST: | 
|---|
| 4235 | case IDM_INFO: | 
|---|
| 4236 | case IDM_ATTRS: | 
|---|
| 4237 | case IDM_MOVE: | 
|---|
| 4238 | case IDM_COPY: | 
|---|
| 4239 | case IDM_RENAME: | 
|---|
| 4240 | case IDM_MOVEPRESERVE: | 
|---|
| 4241 | case IDM_COPYPRESERVE: | 
|---|
| 4242 | case IDM_WILDMOVE: | 
|---|
| 4243 | case IDM_WILDCOPY: | 
|---|
| 4244 | case IDM_SUBJECT: | 
|---|
| 4245 | case IDM_EAS: | 
|---|
| 4246 | case IDM_PRINT: | 
|---|
| 4247 | case IDM_ARCHIVE: | 
|---|
| 4248 | case IDM_EXTRACT: | 
|---|
| 4249 | case IDM_UUDECODE: | 
|---|
| 4250 | case IDM_UNLOCKFILE: | 
|---|
| 4251 | case IDM_SHADOW: | 
|---|
| 4252 | case IDM_OBJECT: | 
|---|
| 4253 | case IDM_OPENSETTINGS: | 
|---|
| 4254 | case IDM_OPENDEFAULT: | 
|---|
| 4255 | if (!pAD->stopflag && | 
|---|
| 4256 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| 4257 | switch (SHORT1FROMMP(mp1)) { | 
|---|
| 4258 | case IDM_SELECTALL: | 
|---|
| 4259 | case IDM_DESELECTALL: | 
|---|
| 4260 | case IDM_INVERT: | 
|---|
| 4261 | case IDM_HIDEALL: | 
|---|
| 4262 | case IDM_REMOVE: | 
|---|
| 4263 | Mark(hwnd, (SHORT1FROMMP(mp1) == IDM_DESELECTALL) ? | 
|---|
| 4264 | AFM_UNMARK : (SHORT1FROMMP(mp1) == IDM_INVERT) ? | 
|---|
| 4265 | AFM_INVERT : (SHORT1FROMMP(mp1) == IDM_HIDEALL) ? | 
|---|
| 4266 | AFM_FILTER : (SHORT1FROMMP(mp1) == IDM_REMOVE) ? | 
|---|
| 4267 | AFM_MARKDELETED : 0, NULL); | 
|---|
| 4268 | if (SHORT1FROMMP(mp1) == IDM_REMOVE || | 
|---|
| 4269 | SHORT1FROMMP(mp1) == IDM_HIDEALL) { | 
|---|
| 4270 | if (SHORT1FROMMP(mp1) == IDM_REMOVE) | 
|---|
| 4271 | RemoveDeleted(hwnd); | 
|---|
| 4272 | else | 
|---|
| 4273 | ReSort(hwnd); | 
|---|
| 4274 | } | 
|---|
| 4275 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 4276 | break; | 
|---|
| 4277 |  | 
|---|
| 4278 | case IDM_SELECTMASK: | 
|---|
| 4279 | case IDM_DESELECTMASK: | 
|---|
| 4280 | SelectMask(hwnd, (SHORT1FROMMP(mp1) == IDM_DESELECTMASK)); | 
|---|
| 4281 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 4282 | break; | 
|---|
| 4283 |  | 
|---|
| 4284 | case IDM_DELETE: | 
|---|
| 4285 | case IDM_PERMDELETE: | 
|---|
| 4286 | case IDM_APPENDTOCLIP: | 
|---|
| 4287 | case IDM_APPENDTOCLIPFILENAME: | 
|---|
| 4288 | case IDM_SAVETOCLIP: | 
|---|
| 4289 | case IDM_SAVETOCLIPFILENAME: | 
|---|
| 4290 | case IDM_SAVETOLIST: | 
|---|
| 4291 | case IDM_COLLECT: | 
|---|
| 4292 | case IDM_INFO: | 
|---|
| 4293 | case IDM_ATTRS: | 
|---|
| 4294 | case IDM_MOVE: | 
|---|
| 4295 | case IDM_COPY: | 
|---|
| 4296 | case IDM_RENAME: | 
|---|
| 4297 | case IDM_MOVEPRESERVE: | 
|---|
| 4298 | case IDM_COPYPRESERVE: | 
|---|
| 4299 | case IDM_WILDMOVE: | 
|---|
| 4300 | case IDM_WILDCOPY: | 
|---|
| 4301 | case IDM_SUBJECT: | 
|---|
| 4302 | case IDM_PRINT: | 
|---|
| 4303 | case IDM_EAS: | 
|---|
| 4304 | case IDM_ARCHIVE: | 
|---|
| 4305 | case IDM_EXTRACT: | 
|---|
| 4306 | case IDM_SHADOW: | 
|---|
| 4307 | case IDM_OBJECT: | 
|---|
| 4308 | case IDM_OPENSETTINGS: | 
|---|
| 4309 | case IDM_OPENDEFAULT: | 
|---|
| 4310 | case IDM_UUDECODE: | 
|---|
| 4311 | case IDM_UNLOCKFILE: | 
|---|
| 4312 | { | 
|---|
| 4313 | CHAR **list = BuildAList(hwnd); | 
|---|
| 4314 |  | 
|---|
| 4315 | if (!list) | 
|---|
| 4316 | Runtime_Error(pszSrcFile, __LINE__, NULL); | 
|---|
| 4317 | else { | 
|---|
| 4318 | switch (SHORT1FROMMP(mp1)) { | 
|---|
| 4319 | case IDM_COLLECT: | 
|---|
| 4320 | CollectList(hwnd, list); | 
|---|
| 4321 | break; | 
|---|
| 4322 | case IDM_DELETE: | 
|---|
| 4323 | case IDM_PERMDELETE: | 
|---|
| 4324 | case IDM_APPENDTOCLIP: | 
|---|
| 4325 | case IDM_APPENDTOCLIPFILENAME: | 
|---|
| 4326 | case IDM_SAVETOCLIP: | 
|---|
| 4327 | case IDM_SAVETOCLIPFILENAME: | 
|---|
| 4328 | case IDM_SAVETOLIST: | 
|---|
| 4329 | case IDM_INFO: | 
|---|
| 4330 | case IDM_ATTRS: | 
|---|
| 4331 | case IDM_MOVE: | 
|---|
| 4332 | case IDM_COPY: | 
|---|
| 4333 | case IDM_RENAME: | 
|---|
| 4334 | case IDM_MOVEPRESERVE: | 
|---|
| 4335 | case IDM_COPYPRESERVE: | 
|---|
| 4336 | case IDM_WILDMOVE: | 
|---|
| 4337 | case IDM_WILDCOPY: | 
|---|
| 4338 | case IDM_SUBJECT: | 
|---|
| 4339 | case IDM_PRINT: | 
|---|
| 4340 | case IDM_EAS: | 
|---|
| 4341 | case IDM_ARCHIVE: | 
|---|
| 4342 | case IDM_EXTRACT: | 
|---|
| 4343 | case IDM_UUDECODE: | 
|---|
| 4344 | case IDM_UNLOCKFILE: | 
|---|
| 4345 | case IDM_OBJECT: | 
|---|
| 4346 | case IDM_SHADOW: | 
|---|
| 4347 | case IDM_OPENSETTINGS: | 
|---|
| 4348 | case IDM_OPENDEFAULT: | 
|---|
| 4349 | if (SHORT1FROMMP(mp1) == IDM_DELETE) | 
|---|
| 4350 | ignorereadonly = FALSE; | 
|---|
| 4351 | if (!PostMsg(pAD->hwndObj, UM_MASSACTION, mp1, MPFROMP(list))) | 
|---|
| 4352 | FreeList(list); | 
|---|
| 4353 | break; | 
|---|
| 4354 | } | 
|---|
| 4355 | if (fUnHilite) { | 
|---|
| 4356 | Mark(hwnd, AFM_UNMARK, NULL); | 
|---|
| 4357 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 4358 | } | 
|---|
| 4359 | } | 
|---|
| 4360 | } | 
|---|
| 4361 | break; | 
|---|
| 4362 |  | 
|---|
| 4363 | case IDM_COLLECTOR: | 
|---|
| 4364 | if (mp2) { | 
|---|
| 4365 |  | 
|---|
| 4366 | CHAR **list = mp2; | 
|---|
| 4367 |  | 
|---|
| 4368 | if (Collector) { | 
|---|
| 4369 | if (!PostMsg(Collector, WM_COMMAND, | 
|---|
| 4370 | MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(list))) | 
|---|
| 4371 | FreeList(list); | 
|---|
| 4372 | else if (fUnHilite) { | 
|---|
| 4373 | Mark(hwnd, AFM_UNMARK, NULL); | 
|---|
| 4374 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| 4375 | } | 
|---|
| 4376 | } | 
|---|
| 4377 | else | 
|---|
| 4378 | FreeList(list); | 
|---|
| 4379 | } | 
|---|
| 4380 | break; | 
|---|
| 4381 | } | 
|---|
| 4382 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| 4383 | } | 
|---|
| 4384 | else if (SHORT1FROMMP(mp1) == IDM_COLLECTOR) { | 
|---|
| 4385 | DosSleep(50);//05 Aug 07 GKY 100 | 
|---|
| 4386 | if (!PostMsg(hwnd, msg, mp1, mp2)) | 
|---|
| 4387 | WinSendMsg(hwnd, msg, mp1, mp2); | 
|---|
| 4388 | } | 
|---|
| 4389 | break; | 
|---|
| 4390 |  | 
|---|
| 4391 | case IDM_HELP: | 
|---|
| 4392 | if (hwndHelp) | 
|---|
| 4393 | WinSendMsg(hwndHelp, | 
|---|
| 4394 | HM_DISPLAY_HELP, | 
|---|
| 4395 | MPFROM2SHORT(HELP_SEEALL, 0), MPFROMSHORT(HM_RESOURCEID)); | 
|---|
| 4396 | break; | 
|---|
| 4397 | } | 
|---|
| 4398 | return 0; | 
|---|
| 4399 |  | 
|---|
| 4400 | case WM_SIZE: | 
|---|
| 4401 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_SIZE"); | 
|---|
| 4402 | PostMsg(hwnd, UM_SETUP3, MPVOID, MPVOID); | 
|---|
| 4403 | break; | 
|---|
| 4404 |  | 
|---|
| 4405 | case WM_CLOSE: | 
|---|
| 4406 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_CLOSE"); | 
|---|
| 4407 | if (pAD) | 
|---|
| 4408 | pAD->stopflag = 1; | 
|---|
| 4409 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT)); | 
|---|
| 4410 | return 0; | 
|---|
| 4411 |  | 
|---|
| 4412 | case WM_DESTROY: | 
|---|
| 4413 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_DESTROY"); | 
|---|
| 4414 | if (pAD) { | 
|---|
| 4415 | pAD->stopflag = 1; | 
|---|
| 4416 | if (pAD->hmtxScan) { | 
|---|
| 4417 | apiret = DosRequestMutexSem(pAD->hmtxScan, 2000); | 
|---|
| 4418 | if (apiret != NO_ERROR) | 
|---|
| 4419 | Dos_Error(MB_CANCEL, apiret, hwnd, pszSrcFile, __LINE__, "DosRequestMutexSem"); | 
|---|
| 4420 | DosCloseMutexSem(pAD->hmtxScan);        // Are probably going to die anyway | 
|---|
| 4421 | } | 
|---|
| 4422 | if (pAD->hwndPopup) | 
|---|
| 4423 | WinDestroyWindow(pAD->hwndPopup); | 
|---|
| 4424 | if (pAD->hwndObj) { | 
|---|
| 4425 | if (!PostMsg(pAD->hwndObj, WM_CLOSE, MPVOID, MPVOID)) | 
|---|
| 4426 | WinSendMsg(pAD->hwndObj, WM_CLOSE, MPVOID, MPVOID); | 
|---|
| 4427 | } | 
|---|
| 4428 | if (pAD->hps) { | 
|---|
| 4429 | GpiDeleteSetId(pAD->hps, SEEALLFILECNR_FONT_LCID); | 
|---|
| 4430 | GpiAssociate(pAD->hps, 0); | 
|---|
| 4431 | GpiDestroyPS(pAD->hps); | 
|---|
| 4432 | } | 
|---|
| 4433 | if (pAD->killme) { | 
|---|
| 4434 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID)) | 
|---|
| 4435 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); | 
|---|
| 4436 | } | 
|---|
| 4437 | FreeAllFilesList(hwnd); | 
|---|
| 4438 | free(pAD); | 
|---|
| 4439 | } | 
|---|
| 4440 | #   ifdef FORTIFY | 
|---|
| 4441 | Fortify_LeaveScope(); | 
|---|
| 4442 | #    endif | 
|---|
| 4443 | break; | 
|---|
| 4444 | } | 
|---|
| 4445 |  | 
|---|
| 4446 | return WinDefWindowProc(hwnd, msg, mp1, mp2); | 
|---|
| 4447 | } | 
|---|
| 4448 |  | 
|---|
| 4449 | HWND StartSeeAll(HWND hwndParent, BOOL standalone,      // called by applet | 
|---|
| 4450 | CHAR * pszStartPath)   // pathname or NULL | 
|---|
| 4451 | { | 
|---|
| 4452 | HWND hwndFrame = (HWND) 0, hwndClient; | 
|---|
| 4453 | ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU | | 
|---|
| 4454 | FCF_SIZEBORDER | FCF_MINMAX | | 
|---|
| 4455 | FCF_NOBYTEALIGN | FCF_VERTSCROLL | | 
|---|
| 4456 | FCF_MENU | FCF_ICON | FCF_ACCELTABLE | FCF_HORZSCROLL; | 
|---|
| 4457 |  | 
|---|
| 4458 | if (ParentIsDesktop(hwndParent, hwndParent)) | 
|---|
| 4459 | FrameFlags |= (FCF_TASKLIST | FCF_SHELLPOSITION); | 
|---|
| 4460 | hwndFrame = WinCreateStdWindow(hwndParent, | 
|---|
| 4461 | WS_VISIBLE, | 
|---|
| 4462 | &FrameFlags, | 
|---|
| 4463 | (CHAR *) WC_SEEALL, | 
|---|
| 4464 | (CHAR *) GetPString(IDS_SEEALLTITLETEXT), | 
|---|
| 4465 | WS_VISIBLE | fwsAnimate, | 
|---|
| 4466 | FM3ModHandle, SEEALL_FRAME, &hwndClient); | 
|---|
| 4467 | if (hwndFrame) { | 
|---|
| 4468 | static CHAR *pszDir; | 
|---|
| 4469 |  | 
|---|
| 4470 | if (standalone) { | 
|---|
| 4471 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| 4472 | UM_SETUP4, MPVOID, MPVOID)) { | 
|---|
| 4473 | PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); | 
|---|
| 4474 | return (HWND) 0; | 
|---|
| 4475 | } | 
|---|
| 4476 | } | 
|---|
| 4477 | if (pszStartPath) { | 
|---|
| 4478 | // Needs to be static for other thread | 
|---|
| 4479 | if (!pszDir) | 
|---|
| 4480 | pszDir = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__); | 
|---|
| 4481 | if (pszDir) { | 
|---|
| 4482 | strcpy(pszDir, pszStartPath); | 
|---|
| 4483 | pszStartPath = pszDir; | 
|---|
| 4484 | } | 
|---|
| 4485 | } | 
|---|
| 4486 | PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| 4487 | UM_SETUP5, MPFROMP(pszStartPath), MPVOID); | 
|---|
| 4488 | } | 
|---|
| 4489 | else if (standalone) | 
|---|
| 4490 | PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); | 
|---|
| 4491 | return hwndFrame; | 
|---|
| 4492 | } | 
|---|
| 4493 |  | 
|---|
| 4494 | #pragma alloc_text(SEEALL,comparefullnames,comparenames,comparesizes) | 
|---|
| 4495 | #pragma alloc_text(SEEALL,comparedates,compareexts,SeeStatusProc) | 
|---|
| 4496 | #pragma alloc_text(SEEALL,InitWindow,PaintLine,SeeAllWndProc) | 
|---|
| 4497 | #pragma alloc_text(SEEALL,UpdateList,CollectList,ReSort,Mark) | 
|---|
| 4498 | #pragma alloc_text(SEEALL,BuildAList,RemoveDeleted,SeeFrameWndProc,FilterList,FilterAll) | 
|---|
| 4499 | #pragma alloc_text(SEEALL2,SeeObjWndProc,MakeSeeObjWinThread,FindDupesThread,DupeDlgProc) | 
|---|
| 4500 | #pragma alloc_text(SEEALL3,FreeAllFilesList,DoADir,FindAllThread,AFDrvsWndProc) | 
|---|
| 4501 | #pragma alloc_text(SEEALL3,StartSeeAll) | 
|---|
| 4502 |  | 
|---|