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