1 |
|
---|
2 | /***********************************************************************
|
---|
3 |
|
---|
4 | $Id: select.c 1544 2010-09-30 13:00:59Z gyoung $
|
---|
5 |
|
---|
6 | Container item selection support routines
|
---|
7 |
|
---|
8 | Copyright (c) 1993-98 M. Kimes
|
---|
9 | Copyright (c) 2004, 2008 Steven H. Levine
|
---|
10 |
|
---|
11 | 01 Aug 04 SHL Rework lstrip/rstrip usage
|
---|
12 | 25 May 05 SHL Rework for ULONGLONG
|
---|
13 | 06 Jun 05 SHL Drop unused code
|
---|
14 | 06 Jul 06 SHL Support compare content (IDM_SELECTSAMECONTENT)
|
---|
15 | 13 Jul 06 SHL Use Runtime_Error
|
---|
16 | 29 Jul 06 SHL Use xfgets_bstripcr
|
---|
17 | 15 Aug 06 SHL Rework SetMask args and logic
|
---|
18 | 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
|
---|
19 | 19 Apr 07 SHL Sync with NumItemsToUnhilite mods
|
---|
20 | 12 May 07 SHL Use dcd->ulItemsToUnHilite
|
---|
21 | 14 Jun 07 SHL SelectAll: make odd expression go away
|
---|
22 | 02 Aug 07 SHL Sync with CNRITEM mods
|
---|
23 | 04 Aug 07 SHL Use Runtime_Error
|
---|
24 | 05 Aug 07 SHL Rework SpecialSelect to use CNRITEM_EXISTS and
|
---|
25 | not use pszFileName since CNRITEM_EXISTS set implies
|
---|
26 | pszFileName not null
|
---|
27 | 14 Aug 07 SHL Revert ExpandAll DosSleep to 0
|
---|
28 | 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
|
---|
29 | 26 Aug 07 GKY DosSleep(1) in loops changed to (0)
|
---|
30 | 12 Jan 08 SHL Localize SpecialSelect in comp.c
|
---|
31 | 29 Feb 08 GKY Use xfree where appropriate
|
---|
32 |
|
---|
33 | ***********************************************************************/
|
---|
34 |
|
---|
35 | #include <stdlib.h>
|
---|
36 | #include <string.h>
|
---|
37 | #include <share.h>
|
---|
38 | #include <io.h>
|
---|
39 |
|
---|
40 | #define INCL_DOS
|
---|
41 | #define INCL_WIN
|
---|
42 | #define INCL_LONGLONG
|
---|
43 |
|
---|
44 | #include "fm3dll.h"
|
---|
45 | #include "fm3dll2.h" // #define's for UM_*, control id's, etc.
|
---|
46 | #include "select.h"
|
---|
47 | #include "notebook.h" // Data declaration(s)
|
---|
48 | #include "newview.h" // Data declarations
|
---|
49 | #include "fm3str.h"
|
---|
50 | #include "filldir.h" // RemoveCnrItems
|
---|
51 | #include "makelist.h" // AddToList
|
---|
52 | #include "errutil.h" // Dos_Error...
|
---|
53 | #include "strutil.h" // GetPString
|
---|
54 | #include "valid.h" // TestCDates
|
---|
55 | #include "misc.h" // CurrentRecord
|
---|
56 | #include "findrec.h" // FindCnrRecord
|
---|
57 | #include "notify.h" // Notify
|
---|
58 | #include "literal.h" // wildcard
|
---|
59 | #include "wrappers.h" // xrealloc
|
---|
60 | #include "strips.h" // bstrip
|
---|
61 | #include "stristr.h" // findstring
|
---|
62 | #include "fortify.h"
|
---|
63 |
|
---|
64 | static PSZ pszSrcFile = __FILE__;
|
---|
65 |
|
---|
66 | VOID UnHilite(HWND hwndCnr, BOOL all, CHAR *** list, ULONG ulItemsToUnHilite)
|
---|
67 | {
|
---|
68 | PCNRITEM pci;
|
---|
69 | UINT numfiles = 0, numalloc = 0;
|
---|
70 | UINT x = 0;
|
---|
71 | INT attribute = CRA_CURSORED;
|
---|
72 |
|
---|
73 | if (all && list && *list) {
|
---|
74 | FreeList(*list);
|
---|
75 | *list = NULL;
|
---|
76 | }
|
---|
77 | pci = (PCNRITEM) CurrentRecord(hwndCnr);
|
---|
78 | if (pci && (INT)pci != -1) {
|
---|
79 | if (pci->rc.flRecordAttr & CRA_SELECTED) {
|
---|
80 | attribute = CRA_SELECTED;
|
---|
81 | pci = WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
|
---|
82 | MPFROMSHORT(attribute));
|
---|
83 | }
|
---|
84 | while (pci && (INT)pci != -1) {
|
---|
85 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
86 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
87 | if (!all)
|
---|
88 | break;
|
---|
89 | // Count is one extra to ensure non-zero elsewhere
|
---|
90 | // x is 0 based index
|
---|
91 | if (x + 2 == ulItemsToUnHilite)
|
---|
92 | break;
|
---|
93 | if (list)
|
---|
94 | AddToList(pci->pszFileName, list, &numfiles, &numalloc);
|
---|
95 | pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS,
|
---|
96 | MPFROMP(pci), MPFROMSHORT(CRA_SELECTED));
|
---|
97 | x++;
|
---|
98 | }
|
---|
99 | }
|
---|
100 | }
|
---|
101 |
|
---|
102 | VOID SelectList(HWND hwndCnr, BOOL partial, BOOL deselect, BOOL clearfirst,
|
---|
103 | PCNRITEM pciParent, PSZ filename, CHAR ** list)
|
---|
104 | {
|
---|
105 |
|
---|
106 | PCNRITEM pci;
|
---|
107 | register INT x;
|
---|
108 | BOOL foundone = FALSE;
|
---|
109 | ULONG errs = 0;
|
---|
110 |
|
---|
111 | if (clearfirst && !deselect)
|
---|
112 | UnHilite(hwndCnr, TRUE, NULL, 0);
|
---|
113 | if (list && list[0]) {
|
---|
114 | for (x = 0; list[x]; x++) {
|
---|
115 | pci = FindCnrRecord(hwndCnr,
|
---|
116 | list[x], pciParent, partial, partial, TRUE);
|
---|
117 | if (pci) {
|
---|
118 | WinSendMsg(hwndCnr,
|
---|
119 | CM_SETRECORDEMPHASIS,
|
---|
120 | MPFROMP(pci),
|
---|
121 | MPFROM2SHORT((SHORT) ((deselect) ? FALSE : TRUE),
|
---|
122 | CRA_SELECTED));
|
---|
123 | foundone = TRUE;
|
---|
124 | }
|
---|
125 | }
|
---|
126 | if (!foundone)
|
---|
127 | Runtime_Error(pszSrcFile, __LINE__, "select failed");
|
---|
128 | }
|
---|
129 | else if (filename && *filename) {
|
---|
130 |
|
---|
131 | FILE *fp;
|
---|
132 | CHAR input[1024], *p;
|
---|
133 | CHAR *moder = "r";
|
---|
134 |
|
---|
135 | fp = xfsopen(filename, moder, SH_DENYNO, pszSrcFile, __LINE__, TRUE);
|
---|
136 | if (fp) {
|
---|
137 | while (!feof(fp)) {
|
---|
138 | if (!xfgets_bstripcr(input, sizeof(input), fp, pszSrcFile, __LINE__))
|
---|
139 | break;
|
---|
140 | if (*input == '\"') {
|
---|
141 | memmove(input, input + 1, strlen(input) + 1);
|
---|
142 | lstrip(input);
|
---|
143 | p = strchr(input, '\"');
|
---|
144 | if (p)
|
---|
145 | *p = 0;
|
---|
146 | rstrip(input);
|
---|
147 | }
|
---|
148 | else {
|
---|
149 | p = strchr(input, ' ');
|
---|
150 | if (p)
|
---|
151 | *p = 0;
|
---|
152 | }
|
---|
153 | /* input now contains name of file to select */
|
---|
154 | pci = FindCnrRecord(hwndCnr,
|
---|
155 | input, pciParent, partial, partial, TRUE);
|
---|
156 | if (pci) /* found it? */
|
---|
157 | WinSendMsg(hwndCnr,
|
---|
158 | CM_SETRECORDEMPHASIS,
|
---|
159 | MPFROMP(pci),
|
---|
160 | MPFROM2SHORT((SHORT) ((deselect) ? FALSE : TRUE),
|
---|
161 | CRA_SELECTED));
|
---|
162 | else
|
---|
163 | errs++;
|
---|
164 | if (errs > 50) { /* prevent runaway on bad file */
|
---|
165 |
|
---|
166 | APIRET ret;
|
---|
167 |
|
---|
168 | ret = saymsg(MB_YESNO,
|
---|
169 | hwndCnr,
|
---|
170 | GetPString(IDS_POSSIBLEERRORTEXT),
|
---|
171 | GetPString(IDS_MAYNOTBELISTTEXT), filename);
|
---|
172 | if (ret == MBID_NO)
|
---|
173 | break;
|
---|
174 | errs = 0;
|
---|
175 | }
|
---|
176 | }
|
---|
177 | fclose(fp);
|
---|
178 | }
|
---|
179 | }
|
---|
180 | }
|
---|
181 |
|
---|
182 | VOID SelectAll(HWND hwndCnr, BOOL files, BOOL dirs, PSZ maskstr,
|
---|
183 | PSZ text, BOOL is_arc)
|
---|
184 | {
|
---|
185 |
|
---|
186 | PCNRITEM pci;
|
---|
187 | BOOL markit;
|
---|
188 | PSZ file;
|
---|
189 | PSZ pszToMatch;
|
---|
190 | MASK Mask;
|
---|
191 | INT x;
|
---|
192 | ULONG textlen = 0;
|
---|
193 |
|
---|
194 | if (text)
|
---|
195 | textlen = strlen(text);
|
---|
196 | memset(&Mask, 0, sizeof(Mask));
|
---|
197 | if (maskstr)
|
---|
198 | SetMask(maskstr, &Mask);
|
---|
199 | pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPVOID,
|
---|
200 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
201 | while (pci && (INT)pci != -1) {
|
---|
202 |
|
---|
203 | markit = FALSE;
|
---|
204 |
|
---|
205 | if (~pci->rc.flRecordAttr & CRA_FILTERED) {
|
---|
206 | if (!is_arc) {
|
---|
207 | if (files && ~pci->attrFile & FILE_DIRECTORY)
|
---|
208 | markit = TRUE;
|
---|
209 | if (dirs && pci->attrFile & FILE_DIRECTORY)
|
---|
210 | markit = TRUE;
|
---|
211 | }
|
---|
212 | else
|
---|
213 | markit = TRUE;
|
---|
214 | if (maskstr && *maskstr && markit) {
|
---|
215 | markit = FALSE;
|
---|
216 | // Point a filename part
|
---|
217 | file = strrchr(pci->pszFileName, '\\');
|
---|
218 | if (!file)
|
---|
219 | file = strrchr(pci->pszFileName, ':');
|
---|
220 | if (file)
|
---|
221 | file++;
|
---|
222 | else
|
---|
223 | file = pci->pszFileName;
|
---|
224 | for (x = 0; Mask.pszMasks[x]; x++) {
|
---|
225 | if (*Mask.pszMasks[x]) {
|
---|
226 | if ((strchr(Mask.pszMasks[x], '\\') ||
|
---|
227 | strchr(Mask.pszMasks[x], ':')))
|
---|
228 | pszToMatch = pci->pszFileName;
|
---|
229 | else
|
---|
230 | pszToMatch = file;
|
---|
231 | if (*Mask.pszMasks[x] != '/') {
|
---|
232 | if (wildcard(pszToMatch, Mask.pszMasks[x], TRUE)) {
|
---|
233 | markit = TRUE;
|
---|
234 | }
|
---|
235 | }
|
---|
236 | else {
|
---|
237 | if (wildcard(pszToMatch, Mask.pszMasks[x] + 1, TRUE)) {
|
---|
238 | markit = FALSE;
|
---|
239 | break;
|
---|
240 | }
|
---|
241 | }
|
---|
242 | }
|
---|
243 | } // for
|
---|
244 | }
|
---|
245 | }
|
---|
246 |
|
---|
247 | if (markit && text && *text) {
|
---|
248 | if (~pci->attrFile & FILE_DIRECTORY) {
|
---|
249 | PSZ input;
|
---|
250 | markit = FALSE;
|
---|
251 | input = xmalloc(65537, pszSrcFile, __LINE__);
|
---|
252 | if (input) {
|
---|
253 | ULONG pos;
|
---|
254 | LONG len;
|
---|
255 | FILE *inputFile;
|
---|
256 | CHAR *moderb = "rb";
|
---|
257 |
|
---|
258 | if ((inputFile = xfsopen(pci->pszFileName, moderb, SH_DENYNO,
|
---|
259 | pszSrcFile, __LINE__, TRUE)) != NULL) {
|
---|
260 | pos = ftell(inputFile);
|
---|
261 | while (!feof(inputFile)) {
|
---|
262 | if (pos)
|
---|
263 | fseek(inputFile, pos - 256, SEEK_SET);
|
---|
264 | len = fread(input, 1, 65536, inputFile);
|
---|
265 | if (len >= 0) {
|
---|
266 | if (findstring(text, textlen, input, len, FALSE)) {
|
---|
267 | markit = TRUE;
|
---|
268 | break;
|
---|
269 | }
|
---|
270 | }
|
---|
271 | else
|
---|
272 | break;
|
---|
273 | } // while
|
---|
274 | fclose(inputFile);
|
---|
275 | }
|
---|
276 | free(input);
|
---|
277 | DosSleep(1);
|
---|
278 | }
|
---|
279 | }
|
---|
280 | else
|
---|
281 | markit = FALSE;
|
---|
282 | }
|
---|
283 |
|
---|
284 | if (markit)
|
---|
285 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
286 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
287 | pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
|
---|
288 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
289 | } // while
|
---|
290 | }
|
---|
291 |
|
---|
292 | VOID DeselectAll(HWND hwndCnr, BOOL files, BOOL dirs, PSZ maskstr,
|
---|
293 | PSZ text, BOOL is_arc)
|
---|
294 | {
|
---|
295 | PCNRITEM pci;
|
---|
296 | BOOL unmarkit;
|
---|
297 | PSZ file;
|
---|
298 | PSZ pszToMatch;
|
---|
299 | MASK Mask;
|
---|
300 | register INT x;
|
---|
301 | ULONG textlen = 0;
|
---|
302 |
|
---|
303 | if (text)
|
---|
304 | textlen = strlen(text);
|
---|
305 | memset(&Mask, 0, sizeof(Mask));
|
---|
306 | if (maskstr && *maskstr)
|
---|
307 | SetMask(maskstr, &Mask);
|
---|
308 | pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPVOID,
|
---|
309 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
310 | while (pci && (INT)pci != -1) {
|
---|
311 | unmarkit = FALSE;
|
---|
312 | if (~pci->rc.flRecordAttr & CRA_FILTERED) {
|
---|
313 | if (!is_arc) {
|
---|
314 | if (files && ~pci->attrFile & FILE_DIRECTORY)
|
---|
315 | unmarkit = TRUE;
|
---|
316 | if (dirs && (pci->attrFile & FILE_DIRECTORY))
|
---|
317 | unmarkit = TRUE;
|
---|
318 | }
|
---|
319 | else
|
---|
320 | unmarkit = TRUE;
|
---|
321 | if (maskstr && *maskstr && unmarkit) {
|
---|
322 | unmarkit = FALSE;
|
---|
323 | file = strrchr(pci->pszFileName, '\\');
|
---|
324 | if (!file)
|
---|
325 | file = strrchr(pci->pszFileName, ':');
|
---|
326 | if (file)
|
---|
327 | file++;
|
---|
328 | else
|
---|
329 | file = pci->pszFileName;
|
---|
330 | for (x = 0; Mask.pszMasks[x]; x++) {
|
---|
331 | if (*Mask.pszMasks[x]) {
|
---|
332 | if (strchr(Mask.pszMasks[x], '\\') ||
|
---|
333 | strchr(Mask.pszMasks[x], ':'))
|
---|
334 | pszToMatch = pci->pszFileName;
|
---|
335 | else
|
---|
336 | pszToMatch = file;
|
---|
337 | if (*Mask.pszMasks[x] != '/') {
|
---|
338 | if (wildcard(pszToMatch, Mask.pszMasks[x], TRUE))
|
---|
339 | unmarkit = TRUE;
|
---|
340 | }
|
---|
341 | else {
|
---|
342 | if (wildcard(pszToMatch, Mask.pszMasks[x] + 1, TRUE)) {
|
---|
343 | unmarkit = FALSE;
|
---|
344 | break;
|
---|
345 | }
|
---|
346 | }
|
---|
347 | }
|
---|
348 | }
|
---|
349 | }
|
---|
350 | }
|
---|
351 |
|
---|
352 | if (unmarkit && text && *text) {
|
---|
353 | if (~pci->attrFile & FILE_DIRECTORY) {
|
---|
354 | PSZ input;
|
---|
355 | unmarkit = FALSE;
|
---|
356 | input = xmalloc(65537, pszSrcFile, __LINE__);
|
---|
357 | if (input) {
|
---|
358 | ULONG pos;
|
---|
359 | LONG len;
|
---|
360 | FILE *inputFile;
|
---|
361 | CHAR *moderb = "rb";
|
---|
362 |
|
---|
363 | if ((inputFile = xfsopen(pci->pszFileName, moderb, SH_DENYNO,
|
---|
364 | pszSrcFile, __LINE__, TRUE)) != NULL) {
|
---|
365 | pos = ftell(inputFile);
|
---|
366 | while (!feof(inputFile)) {
|
---|
367 | if (pos)
|
---|
368 | fseek(inputFile, pos - 256, SEEK_SET);
|
---|
369 | len = fread(input, 1, 65536, inputFile);
|
---|
370 | if (len >= 0) {
|
---|
371 | if (findstring(text, textlen, input, len, FALSE)) {
|
---|
372 | unmarkit = TRUE;
|
---|
373 | break;
|
---|
374 | }
|
---|
375 | }
|
---|
376 | else
|
---|
377 | break;
|
---|
378 | } // while
|
---|
379 | fclose(inputFile);
|
---|
380 | }
|
---|
381 | free(input);
|
---|
382 | DosSleep(1);
|
---|
383 | }
|
---|
384 | }
|
---|
385 | else
|
---|
386 | unmarkit = FALSE;
|
---|
387 | }
|
---|
388 |
|
---|
389 | if (unmarkit)
|
---|
390 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS, pci,
|
---|
391 | MPFROM2SHORT(FALSE, CRA_SELECTED | CRA_CURSORED |
|
---|
392 | CRA_INUSE | CRA_SOURCE));
|
---|
393 | pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
|
---|
394 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
395 | }
|
---|
396 | }
|
---|
397 |
|
---|
398 | VOID Deselect(HWND hwndCnr)
|
---|
399 | {
|
---|
400 | PCNRITEM pcil;
|
---|
401 |
|
---|
402 | pcil = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS,
|
---|
403 | MPFROMLONG(CMA_FIRST),
|
---|
404 | MPFROMSHORT(CRA_SELECTED));
|
---|
405 | while (pcil && (INT)pcil != -1) {
|
---|
406 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pcil),
|
---|
407 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
408 | pcil = WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS, MPFROMP(pcil),
|
---|
409 | MPFROMSHORT(CRA_SELECTED));
|
---|
410 | }
|
---|
411 | }
|
---|
412 |
|
---|
413 | //=== HideAll() Hide all selected records ===
|
---|
414 |
|
---|
415 | VOID HideAll(HWND hwndCnr)
|
---|
416 | {
|
---|
417 | PCNRITEM pci, pciH;
|
---|
418 | INT attribute = CRA_CURSORED;
|
---|
419 | CNRINFO cnri;
|
---|
420 | BOOL didone = FALSE;
|
---|
421 |
|
---|
422 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
423 | cnri.cb = sizeof(CNRINFO);
|
---|
424 | WinSendMsg(hwndCnr, CM_QUERYCNRINFO, MPFROMP(&cnri),
|
---|
425 | MPFROMLONG(sizeof(CNRINFO)));
|
---|
426 | pci = (PCNRITEM) CurrentRecord(hwndCnr);
|
---|
427 | if (pci && (INT)pci != -1) {
|
---|
428 | if (pci->rc.flRecordAttr & CRA_SELECTED) {
|
---|
429 | attribute = CRA_SELECTED;
|
---|
430 | pci = WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
|
---|
431 | MPFROMSHORT(attribute));
|
---|
432 | }
|
---|
433 | }
|
---|
434 | while (pci && (INT)pci != -1) {
|
---|
435 | pciH = WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS, MPFROMP(pci),
|
---|
436 | MPFROMSHORT(attribute));
|
---|
437 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
438 | MPFROM2SHORT(FALSE, CRA_CURSORED | CRA_SELECTED |
|
---|
439 | CRA_INUSE | CRA_SOURCE));
|
---|
440 | pci->rc.flRecordAttr |= CRA_FILTERED;
|
---|
441 | didone = TRUE;
|
---|
442 | if (fSyncUpdates) {
|
---|
443 | if (cnri.flWindowAttr & CV_DETAIL)
|
---|
444 | WinSendMsg(hwndCnr, CM_INVALIDATERECORD, MPVOID,
|
---|
445 | MPFROM2SHORT(0, CMA_REPOSITION | CMA_ERASE));
|
---|
446 | else
|
---|
447 | WinSendMsg(hwndCnr, CM_INVALIDATERECORD, MPFROMP(&pci),
|
---|
448 | MPFROM2SHORT(1, CMA_REPOSITION | CMA_ERASE));
|
---|
449 | }
|
---|
450 | pci = pciH;
|
---|
451 | }
|
---|
452 | if (didone && !fSyncUpdates)
|
---|
453 | WinSendMsg(hwndCnr, CM_INVALIDATERECORD, MPVOID,
|
---|
454 | MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
|
---|
455 | }
|
---|
456 |
|
---|
457 | VOID MarkAll(HWND hwndCnr, BOOL quitit, BOOL target, BOOL source)
|
---|
458 | {
|
---|
459 | PCNRITEM pci;
|
---|
460 | INT attribute = CRA_CURSORED;
|
---|
461 |
|
---|
462 | if (quitit)
|
---|
463 | attribute = target ? CRA_TARGET : source ? CRA_SOURCE : CRA_INUSE;
|
---|
464 | pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS,
|
---|
465 | MPFROMLONG(CMA_FIRST), MPFROMSHORT(attribute));
|
---|
466 | if (pci && (INT)pci != -1) {
|
---|
467 | if (attribute == CRA_CURSORED) {
|
---|
468 | if (pci->rc.flRecordAttr & CRA_SELECTED) {
|
---|
469 | attribute = CRA_SELECTED;
|
---|
470 | pci =
|
---|
471 | WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
|
---|
472 | MPFROMSHORT(attribute));
|
---|
473 | }
|
---|
474 | }
|
---|
475 | }
|
---|
476 | while (pci && (INT)pci != -1) {
|
---|
477 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
478 | MPFROM2SHORT(!quitit,
|
---|
479 | target ? CRA_TARGET : source ? CRA_SOURCE :
|
---|
480 | CRA_INUSE));
|
---|
481 | pci =
|
---|
482 | WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS, MPFROMP(pci),
|
---|
483 | MPFROMSHORT(attribute));
|
---|
484 | }
|
---|
485 | }
|
---|
486 |
|
---|
487 | VOID RemoveAll(HWND hwndCnr, ULONGLONG * pullTotalBytes,
|
---|
488 | ULONG * pulTotalFiles)
|
---|
489 | {
|
---|
490 | PCNRITEM pci;
|
---|
491 | INT attribute = CRA_CURSORED;
|
---|
492 | BOOL didone = FALSE;
|
---|
493 |
|
---|
494 | pci = (PCNRITEM) CurrentRecord(hwndCnr);
|
---|
495 | if (pci && (INT)pci != -1) {
|
---|
496 | if (pci->rc.flRecordAttr & CRA_SELECTED) {
|
---|
497 | attribute = CRA_SELECTED;
|
---|
498 | pci = WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
|
---|
499 | MPFROMSHORT(attribute));
|
---|
500 | }
|
---|
501 | }
|
---|
502 | while (pci && (INT)pci != -1) {
|
---|
503 | if (~pci->rc.flRecordAttr & CRA_FILTERED) {
|
---|
504 | didone = TRUE;
|
---|
505 | if (pulTotalFiles)
|
---|
506 | *pulTotalFiles -= 1;
|
---|
507 | if (pullTotalBytes)
|
---|
508 | *pullTotalBytes -= (pci->cbFile + pci->easize);
|
---|
509 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
510 | MPFROM2SHORT(0, CRA_SELECTED));
|
---|
511 | if (fSyncUpdates)
|
---|
512 | RemoveCnrItems(hwndCnr, pci, 1, CMA_FREE | CMA_INVALIDATE);
|
---|
513 | else
|
---|
514 | RemoveCnrItems(hwndCnr, pci, 1, CMA_FREE);
|
---|
515 | if (attribute == CRA_CURSORED)
|
---|
516 | break;
|
---|
517 | pci = WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
|
---|
518 | MPFROMSHORT(attribute));
|
---|
519 | }
|
---|
520 | else
|
---|
521 | pci = WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS, MPFROMP(pci),
|
---|
522 | MPFROMSHORT(attribute));
|
---|
523 | }
|
---|
524 | if (didone && !fSyncUpdates)
|
---|
525 | WinSendMsg(hwndCnr, CM_INVALIDATERECORD, MPVOID,
|
---|
526 | MPFROM2SHORT(0, CMA_REPOSITION));
|
---|
527 | }
|
---|
528 |
|
---|
529 | //== SetMask() Convert mask string to array of pointers to masks ==
|
---|
530 |
|
---|
531 | VOID SetMask(PSZ maskstr, MASK * mask)
|
---|
532 | {
|
---|
533 | UINT x;
|
---|
534 | PSZ p;
|
---|
535 |
|
---|
536 | DosEnterCritSec();
|
---|
537 | if (maskstr)
|
---|
538 | strcpy(mask->szMask, maskstr); // Got new mask string
|
---|
539 | // Build array of pointers
|
---|
540 | p = mask->szMaskCopy;
|
---|
541 | strcpy(p, mask->szMask);
|
---|
542 | // Allow up to 25 masks - ignore extras
|
---|
543 | for (x = 0; *p && x < 25; x++) {
|
---|
544 | mask->pszMasks[x] = p;
|
---|
545 | while (*p && *p != ';')
|
---|
546 | p++; // Find separator
|
---|
547 | if (*p) {
|
---|
548 | *p = 0; // Replace ;
|
---|
549 | p++;
|
---|
550 | }
|
---|
551 | } // for
|
---|
552 | mask->pszMasks[x] = NULL; // Mark end
|
---|
553 | DosExitCritSec();
|
---|
554 | }
|
---|
555 |
|
---|
556 | VOID ExpandAll(HWND hwndCnr, BOOL expand, PCNRITEM pciParent)
|
---|
557 | {
|
---|
558 | PCNRITEM pci;
|
---|
559 |
|
---|
560 | if (!pciParent)
|
---|
561 | pciParent = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(NULL),
|
---|
562 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
563 | if (pciParent) {
|
---|
564 | if (expand && ~pciParent->rc.flRecordAttr & CRA_EXPANDED)
|
---|
565 | WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciParent), MPVOID);
|
---|
566 | else if (!expand && (pciParent->rc.flRecordAttr & CRA_EXPANDED))
|
---|
567 | WinSendMsg(hwndCnr, CM_COLLAPSETREE, MPFROMP(pciParent), MPVOID);
|
---|
568 | pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pciParent),
|
---|
569 | MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
|
---|
570 | if (pci)
|
---|
571 | DosSleep(0);
|
---|
572 | while (pci && (INT)pci != -1) {
|
---|
573 | ExpandAll(hwndCnr, expand, pci);
|
---|
574 | pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
|
---|
575 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
576 | }
|
---|
577 | }
|
---|
578 | DosSleep(0);
|
---|
579 | }
|
---|
580 |
|
---|
581 | VOID InvertAll(HWND hwndCnr)
|
---|
582 | {
|
---|
583 | PCNRITEM pci;
|
---|
584 |
|
---|
585 | pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPVOID,
|
---|
586 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
587 | while (pci && (INT)pci != -1) {
|
---|
588 | if (~pci->rc.flRecordAttr & CRA_FILTERED) {
|
---|
589 | if (~pci->rc.flRecordAttr & CRA_SELECTED)
|
---|
590 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
591 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
592 | else
|
---|
593 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
594 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
595 | }
|
---|
596 | pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
|
---|
597 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
598 | }
|
---|
599 | }
|
---|
600 |
|
---|
601 | struct SS
|
---|
602 | {
|
---|
603 | PCNRITEM pci;
|
---|
604 | BOOL unique, all, smallest, largest, newest, oldest;
|
---|
605 | };
|
---|
606 |
|
---|
607 | struct Cnr
|
---|
608 | {
|
---|
609 | HWND hwndCnr;
|
---|
610 | ULONG numfiles;
|
---|
611 | struct SS *ss;
|
---|
612 | };
|
---|
613 |
|
---|
614 | static int CompSSNamesB(const void *s1, const void *s2)
|
---|
615 | {
|
---|
616 | struct SS *ss2 = (struct SS *)s2;
|
---|
617 |
|
---|
618 | return stricmp((PSZ)s1, ss2->pci->pszFileName);
|
---|
619 | }
|
---|
620 |
|
---|
621 | static int CompSSNames(const void *s1, const void *s2)
|
---|
622 | {
|
---|
623 | struct SS *ss1 = (struct SS *)s1;
|
---|
624 | struct SS *ss2 = (struct SS *)s2;
|
---|
625 |
|
---|
626 | return stricmp(ss1->pci->pszFileName, ss2->pci->pszFileName);
|
---|
627 | }
|
---|
628 |
|
---|
629 | VOID FreeCnrs(struct Cnr * Cnrs, INT numw)
|
---|
630 | {
|
---|
631 | register INT z;
|
---|
632 |
|
---|
633 | for (z = 0; z < numw; z++) {
|
---|
634 | xfree(Cnrs[z].ss, pszSrcFile, __LINE__);
|
---|
635 | }
|
---|
636 | xfree(Cnrs, pszSrcFile, __LINE__);
|
---|
637 | DosPostEventSem(CompactSem);
|
---|
638 | }
|
---|
639 |
|
---|
640 | /**
|
---|
641 | * Do select actions for single container
|
---|
642 | *
|
---|
643 | */
|
---|
644 |
|
---|
645 | VOID SpecialSelect2(HWND hwndParent, INT action)
|
---|
646 | {
|
---|
647 | PCNRITEM pci;
|
---|
648 | HENUM henum;
|
---|
649 | HWND hwnd;
|
---|
650 | INT numwindows = 0, w, x, z, cmp = 0;
|
---|
651 | struct Cnr *Cnrs = NULL;
|
---|
652 | struct SS *bsres;
|
---|
653 |
|
---|
654 | if (!hwndParent)
|
---|
655 | return;
|
---|
656 |
|
---|
657 | /* count directory containers, build array of hwnds */
|
---|
658 | henum = WinBeginEnumWindows(hwndParent);
|
---|
659 | while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
660 | if (WinWindowFromID(WinWindowFromID(hwnd, FID_CLIENT), DIR_CNR)) {
|
---|
661 | Cnrs =
|
---|
662 | xrealloc(Cnrs, (numwindows + 1) * sizeof(struct Cnr), pszSrcFile,
|
---|
663 | __LINE__);
|
---|
664 | if (!Cnrs) {
|
---|
665 | Notify(GetPString(IDS_OUTOFMEMORY));
|
---|
666 | return;
|
---|
667 | }
|
---|
668 | memset(&Cnrs[numwindows], 0, sizeof(struct Cnr));
|
---|
669 | Cnrs[numwindows].hwndCnr = WinWindowFromID(WinWindowFromID(hwnd,
|
---|
670 | FID_CLIENT),
|
---|
671 | DIR_CNR);
|
---|
672 | numwindows++;
|
---|
673 | }
|
---|
674 | }
|
---|
675 | WinEndEnumWindows(henum);
|
---|
676 | if (numwindows < 2) {
|
---|
677 | FreeCnrs(Cnrs, numwindows);
|
---|
678 | Runtime_Error(pszSrcFile, __LINE__, "expected two windows");
|
---|
679 | Notify(GetPString(IDS_COMPSEL2ORMORETEXT));
|
---|
680 | return;
|
---|
681 | }
|
---|
682 | if (numwindows > 4) {
|
---|
683 | WinSendMsg(Cnrs[0].
|
---|
684 | hwndCnr,
|
---|
685 | UM_NOTIFY, MPFROMP(GetPString(IDS_BUILDINGLISTSTEXT)), MPVOID);
|
---|
686 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
687 | }
|
---|
688 |
|
---|
689 | /* count records, build array of pointers to records */
|
---|
690 | for (z = 0; z < numwindows; z++) {
|
---|
691 | pci = (PCNRITEM) WinSendMsg(Cnrs[z].hwndCnr,
|
---|
692 | CM_QUERYRECORD,
|
---|
693 | MPVOID,
|
---|
694 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
695 | x = 0;
|
---|
696 | while (pci && (INT)pci != -1) {
|
---|
697 | if (~pci->rc.flRecordAttr & CRA_FILTERED &&
|
---|
698 | ~pci->attrFile & FILE_DIRECTORY) {
|
---|
699 | Cnrs[z].ss =
|
---|
700 | xrealloc(Cnrs[z].ss, (x + 1) * sizeof(struct SS), pszSrcFile,
|
---|
701 | __LINE__);
|
---|
702 | if (!Cnrs[z].ss) {
|
---|
703 | FreeCnrs(Cnrs, numwindows);
|
---|
704 | Notify(GetPString(IDS_OUTOFMEMORY));
|
---|
705 | return;
|
---|
706 | }
|
---|
707 | memset(&Cnrs[z].ss[x], 0, sizeof(struct SS));
|
---|
708 | Cnrs[z].ss[x].pci = pci;
|
---|
709 | x++;
|
---|
710 | }
|
---|
711 | pci = (PCNRITEM) WinSendMsg(Cnrs[z].hwndCnr,
|
---|
712 | CM_QUERYRECORD,
|
---|
713 | MPFROMP(pci),
|
---|
714 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
715 | }
|
---|
716 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
717 | Cnrs[z].numfiles = x;
|
---|
718 | if (Cnrs[z].numfiles)
|
---|
719 | qsort(Cnrs[z].ss, Cnrs[z].numfiles, sizeof(struct SS), CompSSNames);
|
---|
720 | }
|
---|
721 |
|
---|
722 | for (z = 0; z < numwindows; z++) {
|
---|
723 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
724 | Cnrs[z].ss[x].all = Cnrs[z].ss[x].unique = Cnrs[z].ss[x].newest =
|
---|
725 | Cnrs[z].ss[x].oldest = Cnrs[z].ss[x].smallest =
|
---|
726 | Cnrs[z].ss[x].largest = TRUE;
|
---|
727 | for (w = 0; w < numwindows; w++) {
|
---|
728 | if (w != z && Cnrs[w].numfiles) {
|
---|
729 | bsres = (struct SS *)bsearch(Cnrs[z].ss[x].pci->pszFileName,
|
---|
730 | Cnrs[w].ss, Cnrs[w].numfiles,
|
---|
731 | sizeof(struct SS), CompSSNamesB);
|
---|
732 | if (bsres) {
|
---|
733 | Cnrs[z].ss[x].unique = FALSE;
|
---|
734 | if (Cnrs[z].ss[x].pci->cbFile + Cnrs[z].ss[x].pci->easize >
|
---|
735 | bsres->pci->cbFile + bsres->pci->easize)
|
---|
736 | Cnrs[z].ss[x].smallest = FALSE;
|
---|
737 | if (Cnrs[z].ss[x].pci->cbFile + Cnrs[z].ss[x].pci->easize <
|
---|
738 | bsres->pci->cbFile + bsres->pci->easize)
|
---|
739 | Cnrs[z].ss[x].largest = FALSE;
|
---|
740 | cmp = TestCDates(&bsres->pci->date, &bsres->pci->time,
|
---|
741 | &Cnrs[z].ss[x].pci->date, &Cnrs[z].ss[x].pci->time);
|
---|
742 | /*(Cnrs[z].ss[x].pci->date.year >
|
---|
743 | bsres->pci->date.year) ? TRUE : (Cnrs[z].ss[x].pci->date.year <
|
---|
744 | bsres->pci->date.
|
---|
745 | year) ? FALSE : (Cnrs[z].
|
---|
746 | ss[x].pci->
|
---|
747 | date.month >
|
---|
748 | bsres->pci->
|
---|
749 | date.
|
---|
750 | month) ? TRUE
|
---|
751 | : (Cnrs[z].ss[x].pci->date.month <
|
---|
752 | bsres->pci->date.month) ? FALSE : (Cnrs[z].ss[x].pci->date.
|
---|
753 | day >
|
---|
754 | bsres->pci->date.
|
---|
755 | day) ? TRUE : (Cnrs[z].
|
---|
756 | ss[x].pci->
|
---|
757 | date.day <
|
---|
758 | bsres->
|
---|
759 | pci->date.
|
---|
760 | day) ?
|
---|
761 | FALSE : (Cnrs[z].ss[x].pci->time.hours >
|
---|
762 | bsres->pci->time.hours) ? TRUE : (Cnrs[z].ss[x].pci->
|
---|
763 | time.hours <
|
---|
764 | bsres->pci->time.
|
---|
765 | hours) ? FALSE
|
---|
766 | : (Cnrs[z].ss[x].pci->time.minutes >
|
---|
767 | bsres->pci->time.minutes) ? TRUE : (Cnrs[z].ss[x].pci->time.
|
---|
768 | minutes <
|
---|
769 | bsres->pci->time.
|
---|
770 | minutes) ? FALSE
|
---|
771 | : (Cnrs[z].ss[x].pci->time.seconds >
|
---|
772 | bsres->pci->time.seconds) ? TRUE : (Cnrs[z].ss[x].pci->time.
|
---|
773 | seconds <
|
---|
774 | bsres->pci->time.
|
---|
775 | seconds) ? FALSE : FALSE;*/
|
---|
776 | if (cmp != 1)
|
---|
777 | Cnrs[z].ss[x].newest = FALSE;
|
---|
778 | /*cmp =
|
---|
779 | (Cnrs[z].ss[x].pci->date.year <
|
---|
780 | bsres->pci->date.year) ? TRUE : (Cnrs[z].ss[x].pci->date.year >
|
---|
781 | bsres->pci->date.
|
---|
782 | year) ? FALSE : (Cnrs[z].
|
---|
783 | ss[x].pci->
|
---|
784 | date.month <
|
---|
785 | bsres->pci->
|
---|
786 | date.
|
---|
787 | month) ? TRUE
|
---|
788 | : (Cnrs[z].ss[x].pci->date.month >
|
---|
789 | bsres->pci->date.month) ? FALSE : (Cnrs[z].ss[x].pci->date.
|
---|
790 | day <
|
---|
791 | bsres->pci->date.
|
---|
792 | day) ? TRUE : (Cnrs[z].
|
---|
793 | ss[x].pci->
|
---|
794 | date.day >
|
---|
795 | bsres->
|
---|
796 | pci->date.
|
---|
797 | day) ?
|
---|
798 | FALSE : (Cnrs[z].ss[x].pci->time.hours <
|
---|
799 | bsres->pci->time.hours) ? TRUE : (Cnrs[z].ss[x].pci->
|
---|
800 | time.hours >
|
---|
801 | bsres->pci->time.
|
---|
802 | hours) ? FALSE
|
---|
803 | : (Cnrs[z].ss[x].pci->time.minutes <
|
---|
804 | bsres->pci->time.minutes) ? TRUE : (Cnrs[z].ss[x].pci->time.
|
---|
805 | minutes >
|
---|
806 | bsres->pci->time.
|
---|
807 | minutes) ? FALSE
|
---|
808 | : (Cnrs[z].ss[x].pci->time.seconds <
|
---|
809 | bsres->pci->time.seconds) ? TRUE : (Cnrs[z].ss[x].pci->time.
|
---|
810 | seconds >
|
---|
811 | bsres->pci->time.
|
---|
812 | seconds) ? FALSE : FALSE;*/
|
---|
813 | if (cmp != -1)
|
---|
814 | Cnrs[z].ss[x].oldest = FALSE;
|
---|
815 | cmp = 0;
|
---|
816 | break;
|
---|
817 | }
|
---|
818 | else
|
---|
819 | Cnrs[z].ss[x].all = FALSE;
|
---|
820 | }
|
---|
821 | }
|
---|
822 | if (Cnrs[z].ss[x].unique)
|
---|
823 | Cnrs[z].ss[x].oldest = Cnrs[z].ss[x].newest = Cnrs[z].ss[x].all =
|
---|
824 | Cnrs[z].ss[x].largest = Cnrs[z].ss[x].smallest = FALSE;
|
---|
825 | DosSleep(1);
|
---|
826 | }
|
---|
827 | DosSleep(1);
|
---|
828 | }
|
---|
829 |
|
---|
830 | switch (action) {
|
---|
831 | case IDM_SELECTBOTH:
|
---|
832 | for (z = 0; z < numwindows; z++) {
|
---|
833 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
834 | if (Cnrs[z].ss[x].all)
|
---|
835 | WinSendMsg(Cnrs[z].hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
836 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
837 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
838 | }
|
---|
839 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
840 | }
|
---|
841 | break;
|
---|
842 | case IDM_SELECTMORE:
|
---|
843 | for (z = 0; z < numwindows; z++) {
|
---|
844 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
845 | if (!Cnrs[z].ss[x].unique)
|
---|
846 | WinSendMsg(Cnrs[z].hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
847 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
848 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
849 | }
|
---|
850 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
851 | }
|
---|
852 | break;
|
---|
853 | case IDM_SELECTONE:
|
---|
854 | for (z = 0; z < numwindows; z++) {
|
---|
855 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
856 | if (Cnrs[z].ss[x].unique)
|
---|
857 | WinSendMsg(Cnrs[z].hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
858 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
859 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
860 | }
|
---|
861 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
862 | }
|
---|
863 | break;
|
---|
864 | case IDM_SELECTNEWER:
|
---|
865 | for (z = 0; z < numwindows; z++) {
|
---|
866 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
867 | if (Cnrs[z].ss[x].newest)
|
---|
868 | WinSendMsg(Cnrs[z].hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
869 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
870 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
871 | }
|
---|
872 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
873 | }
|
---|
874 | break;
|
---|
875 | case IDM_SELECTOLDER:
|
---|
876 | for (z = 0; z < numwindows; z++) {
|
---|
877 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
878 | if (Cnrs[z].ss[x].oldest)
|
---|
879 | WinSendMsg(Cnrs[z].hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
880 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
881 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
882 | }
|
---|
883 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
884 | }
|
---|
885 | break;
|
---|
886 | case IDM_SELECTBIGGER:
|
---|
887 | for (z = 0; z < numwindows; z++) {
|
---|
888 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
889 | if (Cnrs[z].ss[x].largest)
|
---|
890 | WinSendMsg(Cnrs[z].hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
891 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
892 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
893 | }
|
---|
894 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
895 | }
|
---|
896 | break;
|
---|
897 | case IDM_SELECTSMALLER:
|
---|
898 | for (z = 0; z < numwindows; z++) {
|
---|
899 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
900 | if (Cnrs[z].ss[x].smallest)
|
---|
901 | WinSendMsg(Cnrs[z].hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
902 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
903 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
904 | }
|
---|
905 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
906 | }
|
---|
907 | break;
|
---|
908 |
|
---|
909 | case IDM_DESELECTBOTH:
|
---|
910 | for (z = 0; z < numwindows; z++) {
|
---|
911 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
912 | if (Cnrs[z].ss[x].all)
|
---|
913 | WinSendMsg(Cnrs[z].hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
914 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
915 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
916 | }
|
---|
917 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
918 | }
|
---|
919 | break;
|
---|
920 | case IDM_DESELECTMORE:
|
---|
921 | for (z = 0; z < numwindows; z++) {
|
---|
922 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
923 | if (!Cnrs[z].ss[x].unique)
|
---|
924 | WinSendMsg(Cnrs[z].hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
925 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
926 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
927 | }
|
---|
928 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
929 | }
|
---|
930 | break;
|
---|
931 | case IDM_DESELECTONE:
|
---|
932 | for (z = 0; z < numwindows; z++) {
|
---|
933 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
934 | if (Cnrs[z].ss[x].unique)
|
---|
935 | WinSendMsg(Cnrs[z].hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
936 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
937 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
938 | }
|
---|
939 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
940 | }
|
---|
941 | break;
|
---|
942 | case IDM_DESELECTNEWER:
|
---|
943 | for (z = 0; z < numwindows; z++) {
|
---|
944 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
945 | if (Cnrs[z].ss[x].newest)
|
---|
946 | WinSendMsg(Cnrs[z].hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
947 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
948 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
949 | }
|
---|
950 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
951 | }
|
---|
952 | break;
|
---|
953 | case IDM_DESELECTOLDER:
|
---|
954 | for (z = 0; z < numwindows; z++) {
|
---|
955 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
956 | if (Cnrs[z].ss[x].oldest)
|
---|
957 | WinSendMsg(Cnrs[z].hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
958 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
959 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
960 | }
|
---|
961 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
962 | }
|
---|
963 | break;
|
---|
964 | case IDM_DESELECTBIGGER:
|
---|
965 | for (z = 0; z < numwindows; z++) {
|
---|
966 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
967 | if (Cnrs[z].ss[x].largest)
|
---|
968 | WinSendMsg(Cnrs[z].hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
969 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
970 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
971 | }
|
---|
972 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
973 | }
|
---|
974 | break;
|
---|
975 | case IDM_DESELECTSMALLER:
|
---|
976 | for (z = 0; z < numwindows; z++) {
|
---|
977 | for (x = 0; x < Cnrs[z].numfiles; x++) {
|
---|
978 | if (Cnrs[z].ss[x].smallest)
|
---|
979 | WinSendMsg(Cnrs[z].hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
980 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
981 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
982 | }
|
---|
983 | DosSleep(0); //26 Aug 07 GKY 1
|
---|
984 | }
|
---|
985 | break;
|
---|
986 | }
|
---|
987 |
|
---|
988 | FreeCnrs(Cnrs, numwindows);
|
---|
989 | }
|
---|
990 |
|
---|
991 | #pragma alloc_text(SELECT,UnHilite,SelectAll,DeselectAll,MarkAll,SetMask)
|
---|
992 | #pragma alloc_text(SELECT,SelectList)
|
---|
993 | #pragma alloc_text(SELECT1,Deselect,HideAll,RemoveAll,ExpandAll,InvertAll)
|
---|
994 | #pragma alloc_text(SELECT4,FreeCnrs,SpecialSelect2,CompSSNames,CompSSNamesB)
|
---|