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