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