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