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