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