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