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