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