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