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