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