1 |
|
---|
2 | /***********************************************************************
|
---|
3 |
|
---|
4 | $Id: select.c 317 2006-07-13 04:19:04Z root $
|
---|
5 |
|
---|
6 | Copyright (c) 1993-98 M. Kimes
|
---|
7 | Copyright (c) 2004, 2006 Steven H. Levine
|
---|
8 |
|
---|
9 | 01 Aug 04 SHL Rework lstrip/rstrip usage
|
---|
10 | 25 May 05 SHL Rework for ULONGLONG
|
---|
11 | 06 Jun 05 SHL Drop unused code
|
---|
12 | 06 Jul 06 SHL Support compare content (IDM_SELECTSAMECONTENT)
|
---|
13 |
|
---|
14 | ***********************************************************************/
|
---|
15 |
|
---|
16 | #define INCL_DOS
|
---|
17 | #define INCL_WIN
|
---|
18 | #define INCL_LONGLONG
|
---|
19 | #include <os2.h>
|
---|
20 |
|
---|
21 | #include <stdio.h>
|
---|
22 | #include <stdlib.h>
|
---|
23 | #include <string.h>
|
---|
24 | #include <share.h>
|
---|
25 | #include <io.h>
|
---|
26 |
|
---|
27 | #include "fm3dll.h"
|
---|
28 | #include "fm3str.h"
|
---|
29 |
|
---|
30 | #pragma alloc_text(SELECT,UnHilite,SelectAll,DeselectAll,MarkAll,SetMask)
|
---|
31 | #pragma alloc_text(SELECT,SelectList)
|
---|
32 | #pragma alloc_text(SELECT1,Deselect,HideAll,RemoveAll,ExpandAll,InvertAll)
|
---|
33 |
|
---|
34 | VOID UnHilite (HWND hwndCnr,BOOL all,CHAR ***list)
|
---|
35 | {
|
---|
36 | PCNRITEM pci;
|
---|
37 | INT numfiles = 0,numalloc = 0;
|
---|
38 | INT attribute = CRA_CURSORED;
|
---|
39 |
|
---|
40 | if(all && list && *list) {
|
---|
41 | FreeList(*list);
|
---|
42 | *list = NULL;
|
---|
43 | }
|
---|
44 | pci = (PCNRITEM)CurrentRecord(hwndCnr);
|
---|
45 | if(pci && (INT)pci != -1) {
|
---|
46 | if(pci->rc.flRecordAttr & CRA_SELECTED) {
|
---|
47 | attribute = CRA_SELECTED;
|
---|
48 | pci = WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,MPFROMLONG(CMA_FIRST),
|
---|
49 | MPFROMSHORT(attribute));
|
---|
50 | }
|
---|
51 | while(pci && (INT)pci != -1) {
|
---|
52 | WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,MPFROMP(pci),
|
---|
53 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
54 | if(!all)
|
---|
55 | break;
|
---|
56 | if(list)
|
---|
57 | AddToList(pci->szFileName,list,&numfiles,&numalloc);
|
---|
58 | pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,
|
---|
59 | MPFROMP(pci),
|
---|
60 | MPFROMSHORT(CRA_SELECTED));
|
---|
61 | }
|
---|
62 | }
|
---|
63 | }
|
---|
64 |
|
---|
65 | VOID SelectList (HWND hwndCnr,BOOL partial,BOOL deselect,BOOL clearfirst,
|
---|
66 | PCNRITEM pciParent,CHAR *filename,CHAR **list) {
|
---|
67 |
|
---|
68 | PCNRITEM pci;
|
---|
69 | register INT x;
|
---|
70 | BOOL foundone = FALSE;
|
---|
71 | ULONG errs = 0L;
|
---|
72 |
|
---|
73 | if(clearfirst && !deselect)
|
---|
74 | UnHilite(hwndCnr,TRUE,NULL);
|
---|
75 | if(list && list[0]) {
|
---|
76 | for(x = 0;list[x];x++) {
|
---|
77 | pci = FindCnrRecord(hwndCnr,
|
---|
78 | list[x],
|
---|
79 | pciParent,
|
---|
80 | partial,
|
---|
81 | partial,
|
---|
82 | TRUE);
|
---|
83 | if(pci) {
|
---|
84 | WinSendMsg(hwndCnr,
|
---|
85 | CM_SETRECORDEMPHASIS,
|
---|
86 | MPFROMP(pci),
|
---|
87 | MPFROM2SHORT((SHORT)((deselect) ? FALSE : TRUE),
|
---|
88 | CRA_SELECTED));
|
---|
89 | foundone = TRUE;
|
---|
90 | }
|
---|
91 | }
|
---|
92 | if(!foundone)
|
---|
93 | DosBeep(250,50);
|
---|
94 | }
|
---|
95 | else if(filename && *filename) {
|
---|
96 |
|
---|
97 | FILE *fp;
|
---|
98 | CHAR input[1024],*p;
|
---|
99 |
|
---|
100 | fp = _fsopen(filename,"r",SH_DENYNO);
|
---|
101 | if(fp) {
|
---|
102 | while(!feof(fp)) {
|
---|
103 | if(!fgets(input,1024,fp))
|
---|
104 | break;
|
---|
105 | input[1023] = 0;
|
---|
106 | bstripcr(input);
|
---|
107 | if(*input == '\"') {
|
---|
108 | memmove(input,input + 1,strlen(input) + 1);
|
---|
109 | lstrip(input);
|
---|
110 | p = strchr(input,'\"');
|
---|
111 | if(p)
|
---|
112 | *p = 0;
|
---|
113 | rstrip(input);
|
---|
114 | }
|
---|
115 | else {
|
---|
116 | p = strchr(input,' ');
|
---|
117 | if(p)
|
---|
118 | *p = 0;
|
---|
119 | }
|
---|
120 | /* input now contains name of file to select */
|
---|
121 | pci = FindCnrRecord(hwndCnr,
|
---|
122 | input,
|
---|
123 | pciParent,
|
---|
124 | partial,
|
---|
125 | partial,
|
---|
126 | TRUE);
|
---|
127 | if(pci) /* found it? */
|
---|
128 | WinSendMsg(hwndCnr,
|
---|
129 | CM_SETRECORDEMPHASIS,
|
---|
130 | MPFROMP(pci),
|
---|
131 | MPFROM2SHORT((SHORT)((deselect) ? FALSE : TRUE),
|
---|
132 | CRA_SELECTED));
|
---|
133 | else
|
---|
134 | errs++;
|
---|
135 | if(errs > 50L) { /* prevent runaway on bad file */
|
---|
136 |
|
---|
137 | APIRET ret;
|
---|
138 |
|
---|
139 | ret = saymsg(MB_YESNO,
|
---|
140 | hwndCnr,
|
---|
141 | GetPString(IDS_POSSIBLEERRORTEXT),
|
---|
142 | GetPString(IDS_MAYNOTBELISTTEXT),
|
---|
143 | filename);
|
---|
144 | if(ret == MBID_NO)
|
---|
145 | break;
|
---|
146 | errs = 0L;
|
---|
147 | }
|
---|
148 | }
|
---|
149 | fclose(fp);
|
---|
150 | }
|
---|
151 | }
|
---|
152 | }
|
---|
153 |
|
---|
154 | VOID SelectAll (HWND hwndCnr,BOOL files,BOOL dirs,CHAR *mask,
|
---|
155 | CHAR *text,BOOL arc) {
|
---|
156 |
|
---|
157 | PCNRITEM pci;
|
---|
158 | BOOL markit;
|
---|
159 | register CHAR *file;
|
---|
160 | MASK Mask;
|
---|
161 | register INT x;
|
---|
162 | ULONG textlen = 0;
|
---|
163 |
|
---|
164 | if(text)
|
---|
165 | textlen = strlen(text);
|
---|
166 | memset(&Mask,0,sizeof(Mask));
|
---|
167 | if(mask && *mask)
|
---|
168 | SetMask(mask,&Mask);
|
---|
169 | pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPVOID,
|
---|
170 | MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER));
|
---|
171 | while( pci && (INT)pci != -1 ) {
|
---|
172 | markit = FALSE;
|
---|
173 | if(!(pci->rc.flRecordAttr & CRA_FILTERED)) {
|
---|
174 | if(!arc) {
|
---|
175 | if(files && !(pci->attrFile & FILE_DIRECTORY))
|
---|
176 | markit = TRUE;
|
---|
177 | if(dirs && (pci->attrFile & FILE_DIRECTORY))
|
---|
178 | markit = TRUE;
|
---|
179 | }
|
---|
180 | else
|
---|
181 | markit = TRUE;
|
---|
182 | if(mask && *mask && markit) {
|
---|
183 | markit = FALSE;
|
---|
184 | file = strrchr(pci->szFileName,'\\');
|
---|
185 | if(!file)
|
---|
186 | file = strrchr(pci->szFileName,':');
|
---|
187 | if(file)
|
---|
188 | file++;
|
---|
189 | else
|
---|
190 | file = pci->szFileName;
|
---|
191 | for(x = 0;Mask.pszMasks[x];x++) {
|
---|
192 | if(*Mask.pszMasks[x]) {
|
---|
193 | if(*Mask.pszMasks[x] != '/') {
|
---|
194 | if(wildcard((strchr(Mask.pszMasks[x],'\\') ||
|
---|
195 | strchr(Mask.pszMasks[x],':')) ?
|
---|
196 | pci->szFileName : file,Mask.pszMasks[x],FALSE))
|
---|
197 | markit = TRUE;
|
---|
198 | }
|
---|
199 | else {
|
---|
200 | if(wildcard((strchr(Mask.pszMasks[x],'\\') ||
|
---|
201 | strchr(Mask.pszMasks[x],':'),FALSE) ?
|
---|
202 | pci->szFileName : file,Mask.pszMasks[x] + 1,
|
---|
203 | FALSE)) {
|
---|
204 | markit = FALSE;
|
---|
205 | break;
|
---|
206 | }
|
---|
207 | }
|
---|
208 | }
|
---|
209 | }
|
---|
210 | }
|
---|
211 | }
|
---|
212 | if(markit && text && *text && !(pci->attrFile & FILE_DIRECTORY)) {
|
---|
213 |
|
---|
214 | CHAR *input;
|
---|
215 |
|
---|
216 | markit = FALSE;
|
---|
217 | input = malloc(65537);
|
---|
218 | if(input) {
|
---|
219 |
|
---|
220 | ULONG pos;
|
---|
221 | LONG len;
|
---|
222 | FILE *inputFile;
|
---|
223 |
|
---|
224 | if((inputFile = _fsopen(pci->szFileName,"rb",SH_DENYNO)) != NULL) {
|
---|
225 | pos = ftell(inputFile);
|
---|
226 | while(!feof(inputFile)) {
|
---|
227 | if(pos)
|
---|
228 | fseek(inputFile,pos - 256,SEEK_SET);
|
---|
229 | len = fread(input,1,65536,inputFile);
|
---|
230 | if(len >= 0) {
|
---|
231 | if(findstring(text,textlen,input,len,FALSE)) {
|
---|
232 | markit = TRUE;
|
---|
233 | break;
|
---|
234 | }
|
---|
235 | }
|
---|
236 | else
|
---|
237 | break;
|
---|
238 | }
|
---|
239 | fclose(inputFile) ;
|
---|
240 | }
|
---|
241 | free(input);
|
---|
242 | DosSleep(1L);
|
---|
243 | }
|
---|
244 | }
|
---|
245 | else if(markit && text && *text && (pci->attrFile & FILE_DIRECTORY))
|
---|
246 | markit = FALSE;
|
---|
247 | if(markit)
|
---|
248 | WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,MPFROMP(pci),
|
---|
249 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
250 | pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(pci),
|
---|
251 | MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER));
|
---|
252 | } // while
|
---|
253 | }
|
---|
254 |
|
---|
255 | VOID DeselectAll (HWND hwndCnr,BOOL files,BOOL dirs,CHAR *mask,CHAR *text,
|
---|
256 | BOOL arc) {
|
---|
257 |
|
---|
258 | PCNRITEM pci;
|
---|
259 | BOOL unmarkit;
|
---|
260 | register CHAR *file;
|
---|
261 | MASK Mask;
|
---|
262 | register INT x;
|
---|
263 | ULONG textlen = 0;
|
---|
264 |
|
---|
265 | if(text)
|
---|
266 | textlen = strlen(text);
|
---|
267 | memset(&Mask,0,sizeof(Mask));
|
---|
268 | if(mask && *mask)
|
---|
269 | SetMask(mask,&Mask);
|
---|
270 | pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPVOID,
|
---|
271 | MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER));
|
---|
272 | while( pci && (INT)pci != -1 ) {
|
---|
273 | unmarkit = FALSE;
|
---|
274 | if(!(pci->rc.flRecordAttr & CRA_FILTERED)) {
|
---|
275 | if(!arc) {
|
---|
276 | if(files && !(pci->attrFile & FILE_DIRECTORY))
|
---|
277 | unmarkit = TRUE;
|
---|
278 | if(dirs && (pci->attrFile & FILE_DIRECTORY))
|
---|
279 | unmarkit = TRUE;
|
---|
280 | }
|
---|
281 | else
|
---|
282 | unmarkit = TRUE;
|
---|
283 | if(mask && *mask && unmarkit) {
|
---|
284 | unmarkit = FALSE;
|
---|
285 | file = strrchr(pci->szFileName,'\\');
|
---|
286 | if(!file)
|
---|
287 | file = strrchr(pci->szFileName,':');
|
---|
288 | if(file)
|
---|
289 | file++;
|
---|
290 | else
|
---|
291 | file = pci->szFileName;
|
---|
292 | for(x = 0;Mask.pszMasks[x];x++) {
|
---|
293 | if(*Mask.pszMasks[x]) {
|
---|
294 | if(*Mask.pszMasks[x] != '/') {
|
---|
295 | if(wildcard((strchr(Mask.pszMasks[x],'\\') ||
|
---|
296 | strchr(Mask.pszMasks[x],':')) ?
|
---|
297 | pci->szFileName : file,Mask.pszMasks[x],FALSE))
|
---|
298 | unmarkit = TRUE;
|
---|
299 | }
|
---|
300 | else {
|
---|
301 | if(wildcard((strchr(Mask.pszMasks[x],'\\') ||
|
---|
302 | strchr(Mask.pszMasks[x],':')) ?
|
---|
303 | pci->szFileName : file,Mask.pszMasks[x] + 1,
|
---|
304 | FALSE)) {
|
---|
305 | unmarkit = FALSE;
|
---|
306 | break;
|
---|
307 | }
|
---|
308 | }
|
---|
309 | }
|
---|
310 | }
|
---|
311 | }
|
---|
312 | }
|
---|
313 | if(unmarkit && text && *text && !(pci->attrFile & FILE_DIRECTORY)) {
|
---|
314 |
|
---|
315 | CHAR *input;
|
---|
316 |
|
---|
317 | unmarkit = FALSE;
|
---|
318 | input = malloc(65537);
|
---|
319 | if(input) {
|
---|
320 |
|
---|
321 | ULONG pos;
|
---|
322 | LONG len;
|
---|
323 | FILE *inputFile;
|
---|
324 |
|
---|
325 | if((inputFile = _fsopen(pci->szFileName,"rb",SH_DENYNO)) != NULL) {
|
---|
326 | pos = ftell(inputFile);
|
---|
327 | while(!feof(inputFile)) {
|
---|
328 | if(pos)
|
---|
329 | fseek(inputFile,pos - 256,SEEK_SET);
|
---|
330 | len = fread(input,1,65536,inputFile);
|
---|
331 | if(len >= 0) {
|
---|
332 | if(findstring(text,textlen,input,len,FALSE)) {
|
---|
333 | unmarkit = TRUE;
|
---|
334 | break;
|
---|
335 | }
|
---|
336 | }
|
---|
337 | else
|
---|
338 | break;
|
---|
339 | }
|
---|
340 | fclose(inputFile) ;
|
---|
341 | }
|
---|
342 | free(input);
|
---|
343 | DosSleep(1L);
|
---|
344 | }
|
---|
345 | }
|
---|
346 | else if(unmarkit && text && *text && (pci->attrFile & FILE_DIRECTORY))
|
---|
347 | unmarkit = FALSE;
|
---|
348 | if(unmarkit)
|
---|
349 | WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,pci,
|
---|
350 | MPFROM2SHORT(FALSE,CRA_SELECTED | CRA_CURSORED |
|
---|
351 | CRA_INUSE | CRA_SOURCE));
|
---|
352 | pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(pci),
|
---|
353 | MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER));
|
---|
354 | }
|
---|
355 | }
|
---|
356 |
|
---|
357 | VOID Deselect (HWND hwndCnr)
|
---|
358 | {
|
---|
359 | PCNRITEM pcil;
|
---|
360 |
|
---|
361 | pcil = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,
|
---|
362 | MPFROMLONG(CMA_FIRST),
|
---|
363 | MPFROMSHORT(CRA_SELECTED));
|
---|
364 | while(pcil && (INT)pcil != -1) {
|
---|
365 | WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,MPFROMP(pcil),
|
---|
366 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
367 | pcil = WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,MPFROMP(pcil),
|
---|
368 | MPFROMSHORT(CRA_SELECTED));
|
---|
369 | }
|
---|
370 | }
|
---|
371 |
|
---|
372 | //=== HideAll() Hide all selected records ===
|
---|
373 |
|
---|
374 | VOID HideAll (HWND hwndCnr)
|
---|
375 | {
|
---|
376 | PCNRITEM pci,pciH;
|
---|
377 | INT attribute = CRA_CURSORED;
|
---|
378 | CNRINFO cnri;
|
---|
379 | BOOL didone = FALSE;
|
---|
380 |
|
---|
381 | memset(&cnri,0,sizeof(CNRINFO));
|
---|
382 | cnri.cb = sizeof(CNRINFO);
|
---|
383 | WinSendMsg(hwndCnr,CM_QUERYCNRINFO,MPFROMP(&cnri),
|
---|
384 | MPFROMLONG(sizeof(CNRINFO)));
|
---|
385 | pci = (PCNRITEM)CurrentRecord(hwndCnr);
|
---|
386 | if(pci && (INT)pci != -1) {
|
---|
387 | if(pci->rc.flRecordAttr & CRA_SELECTED) {
|
---|
388 | attribute = CRA_SELECTED;
|
---|
389 | pci = WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,MPFROMLONG(CMA_FIRST),
|
---|
390 | MPFROMSHORT(attribute));
|
---|
391 | }
|
---|
392 | }
|
---|
393 | while(pci && (INT)pci != -1) {
|
---|
394 | pciH = WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,MPFROMP(pci),
|
---|
395 | MPFROMSHORT(attribute));
|
---|
396 | WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,MPFROMP(pci),
|
---|
397 | MPFROM2SHORT(FALSE,CRA_CURSORED | CRA_SELECTED |
|
---|
398 | CRA_INUSE | CRA_SOURCE));
|
---|
399 | pci->rc.flRecordAttr |= CRA_FILTERED;
|
---|
400 | didone = TRUE;
|
---|
401 | if(fSyncUpdates) {
|
---|
402 | if(cnri.flWindowAttr & CV_DETAIL)
|
---|
403 | WinSendMsg(hwndCnr,CM_INVALIDATERECORD,MPVOID,
|
---|
404 | MPFROM2SHORT(0,CMA_REPOSITION | CMA_ERASE));
|
---|
405 | else
|
---|
406 | WinSendMsg(hwndCnr,CM_INVALIDATERECORD,MPFROMP(&pci),
|
---|
407 | MPFROM2SHORT(1,CMA_REPOSITION | CMA_ERASE));
|
---|
408 | }
|
---|
409 | pci = pciH;
|
---|
410 | }
|
---|
411 | if(didone && !fSyncUpdates)
|
---|
412 | WinSendMsg(hwndCnr,CM_INVALIDATERECORD,MPVOID,
|
---|
413 | MPFROM2SHORT(0,CMA_ERASE | CMA_REPOSITION));
|
---|
414 | }
|
---|
415 |
|
---|
416 | VOID MarkAll (HWND hwndCnr,BOOL quitit,BOOL target,BOOL source)
|
---|
417 | {
|
---|
418 | PCNRITEM pci;
|
---|
419 | INT attribute = CRA_CURSORED;
|
---|
420 |
|
---|
421 | if(quitit)
|
---|
422 | attribute = (target) ? CRA_TARGET : (source) ? CRA_SOURCE : CRA_INUSE;
|
---|
423 | pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,
|
---|
424 | MPFROMLONG(CMA_FIRST),
|
---|
425 | MPFROMSHORT(attribute));
|
---|
426 | if(pci && (INT)pci != -1) {
|
---|
427 | if(attribute == CRA_CURSORED) {
|
---|
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 | }
|
---|
435 | while( pci && (INT)pci != -1) {
|
---|
436 | WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,MPFROMP(pci),
|
---|
437 | MPFROM2SHORT(!quitit,
|
---|
438 | ((target) ? CRA_TARGET : (source) ? CRA_SOURCE : CRA_INUSE)));
|
---|
439 | pci = WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,MPFROMP(pci),
|
---|
440 | MPFROMSHORT(attribute));
|
---|
441 | }
|
---|
442 | }
|
---|
443 |
|
---|
444 | VOID RemoveAll (HWND hwndCnr,ULONGLONG *pullTotalBytes,ULONG *pulTotalFiles)
|
---|
445 | {
|
---|
446 | PCNRITEM pci;
|
---|
447 | INT attribute = CRA_CURSORED;
|
---|
448 | BOOL didone = FALSE;
|
---|
449 |
|
---|
450 | pci = (PCNRITEM)CurrentRecord(hwndCnr);
|
---|
451 | if(pci && (INT)pci != -1) {
|
---|
452 | if(pci->rc.flRecordAttr & CRA_SELECTED) {
|
---|
453 | attribute = CRA_SELECTED;
|
---|
454 | pci = WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,MPFROMLONG(CMA_FIRST),
|
---|
455 | MPFROMSHORT(attribute));
|
---|
456 | }
|
---|
457 | }
|
---|
458 | while(pci && (INT)pci != -1) {
|
---|
459 | if (!(pci->rc.flRecordAttr & CRA_FILTERED))
|
---|
460 | {
|
---|
461 | didone = TRUE;
|
---|
462 | if (pulTotalFiles)
|
---|
463 | *pulTotalFiles--;
|
---|
464 | if (pullTotalBytes)
|
---|
465 | *pullTotalBytes -= (pci->cbFile + pci->easize);
|
---|
466 | WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,MPFROMP(pci),
|
---|
467 | MPFROM2SHORT(0,CRA_SELECTED));
|
---|
468 | if(fSyncUpdates)
|
---|
469 | WinSendMsg(hwndCnr,CM_REMOVERECORD,MPFROMP(&pci),
|
---|
470 | MPFROM2SHORT(1,CMA_FREE | CMA_INVALIDATE));
|
---|
471 | else
|
---|
472 | WinSendMsg(hwndCnr,CM_REMOVERECORD,MPFROMP(&pci),
|
---|
473 | MPFROM2SHORT(1,CMA_FREE));
|
---|
474 | if(attribute == CRA_CURSORED)
|
---|
475 | break;
|
---|
476 | pci = WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,MPFROMLONG(CMA_FIRST),
|
---|
477 | MPFROMSHORT(attribute));
|
---|
478 | }
|
---|
479 | else
|
---|
480 | pci = WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,MPFROMP(pci),
|
---|
481 | MPFROMSHORT(attribute));
|
---|
482 | }
|
---|
483 | if(didone && !fSyncUpdates)
|
---|
484 | WinSendMsg(hwndCnr,CM_INVALIDATERECORD,MPVOID,
|
---|
485 | MPFROM2SHORT(0,CMA_REPOSITION));
|
---|
486 | }
|
---|
487 |
|
---|
488 | VOID SetMask (CHAR *str,MASK *mask)
|
---|
489 | {
|
---|
490 | register INT x;
|
---|
491 | register CHAR *p;
|
---|
492 |
|
---|
493 | if(str != mask->szMask)
|
---|
494 | strcpy(mask->szMask,str);
|
---|
495 | strcpy(mask->szMaskCopy,mask->szMask);
|
---|
496 | memset(mask->pszMasks,0,sizeof(CHAR *) * 26);
|
---|
497 | p = mask->pszMasks[0] = mask->szMaskCopy;
|
---|
498 | for(x = 1;x < 24;x++) {
|
---|
499 | while(*p && *p != ';')
|
---|
500 | p++;
|
---|
501 | if(*p) {
|
---|
502 | *p = 0;
|
---|
503 | p++;
|
---|
504 | mask->pszMasks[x] = p;
|
---|
505 | }
|
---|
506 | else {
|
---|
507 | mask->pszMasks[x] = NULL;
|
---|
508 | break;
|
---|
509 | }
|
---|
510 | }
|
---|
511 | mask->pszMasks[x] = NULL;
|
---|
512 | }
|
---|
513 |
|
---|
514 | VOID ExpandAll (HWND hwndCnr,BOOL expand,PCNRITEM pciParent)
|
---|
515 | {
|
---|
516 | PCNRITEM pci;
|
---|
517 |
|
---|
518 | if(!pciParent)
|
---|
519 | pciParent = WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(NULL),
|
---|
520 | MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER));
|
---|
521 | if(pciParent) {
|
---|
522 | if(expand && !(pciParent->rc.flRecordAttr & CRA_EXPANDED))
|
---|
523 | WinSendMsg(hwndCnr,CM_EXPANDTREE,MPFROMP(pciParent),MPVOID);
|
---|
524 | else if(!expand && (pciParent->rc.flRecordAttr & CRA_EXPANDED))
|
---|
525 | WinSendMsg(hwndCnr,CM_COLLAPSETREE,MPFROMP(pciParent),MPVOID);
|
---|
526 | pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(pciParent),
|
---|
527 | MPFROM2SHORT(CMA_FIRSTCHILD,CMA_ITEMORDER));
|
---|
528 | if(pci)
|
---|
529 | DosSleep(1L);
|
---|
530 | while(pci && (INT)pci != -1) {
|
---|
531 | ExpandAll(hwndCnr,expand,pci);
|
---|
532 | pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(pci),
|
---|
533 | MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER));
|
---|
534 | }
|
---|
535 | }
|
---|
536 | DosSleep(0L);
|
---|
537 | }
|
---|
538 |
|
---|
539 | VOID InvertAll (HWND hwndCnr)
|
---|
540 | {
|
---|
541 | PCNRITEM pci;
|
---|
542 |
|
---|
543 | pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPVOID,
|
---|
544 | MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER));
|
---|
545 | while( pci && (INT)pci != -1 ) {
|
---|
546 | if(!(pci->rc.flRecordAttr & CRA_FILTERED)) {
|
---|
547 | if(!(pci->rc.flRecordAttr & CRA_SELECTED))
|
---|
548 | WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,MPFROMP(pci),
|
---|
549 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
550 | else
|
---|
551 | WinSendMsg(hwndCnr,CM_SETRECORDEMPHASIS,MPFROMP(pci),
|
---|
552 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
553 | }
|
---|
554 | pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(pci),
|
---|
555 | MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER));
|
---|
556 | }
|
---|
557 | }
|
---|
558 |
|
---|
559 | #pragma alloc_text (SELECT3,SpecialSelect)
|
---|
560 | #pragma alloc_text(SELECT4,FreeCnrs,SpecialSelect2,CompSSNames,CompSSNamesB)
|
---|
561 |
|
---|
562 | VOID SpecialSelect (HWND hwndCnrS,HWND hwndCnrD,INT action,BOOL reset)
|
---|
563 | {
|
---|
564 | PCNRITEM pciS,pciD,*pciSa = NULL,*pciDa = NULL;
|
---|
565 | CNRINFO cnri;
|
---|
566 | BOOL slow = FALSE;
|
---|
567 | register INT x,numD,numS;
|
---|
568 |
|
---|
569 | if(!hwndCnrS || !hwndCnrD)
|
---|
570 | return;
|
---|
571 |
|
---|
572 | memset(&cnri,0,sizeof(CNRINFO));
|
---|
573 | cnri.cb = sizeof(CNRINFO);
|
---|
574 | WinSendMsg(hwndCnrD,CM_QUERYCNRINFO,MPFROMP(&cnri),
|
---|
575 | MPFROMLONG(sizeof(CNRINFO)));
|
---|
576 | numD = (INT)cnri.cRecords;
|
---|
577 | memset(&cnri,0,sizeof(CNRINFO));
|
---|
578 | cnri.cb = sizeof(CNRINFO);
|
---|
579 | WinSendMsg(hwndCnrS,CM_QUERYCNRINFO,MPFROMP(&cnri),
|
---|
580 | MPFROMLONG(sizeof(CNRINFO)));
|
---|
581 | numS = (INT)cnri.cRecords;
|
---|
582 | if(!numD || numS != numD) {
|
---|
583 | DosBeep(250,100);
|
---|
584 | saymsg(MB_ENTER,
|
---|
585 | HWND_DESKTOP,
|
---|
586 | DEBUG_STRING,
|
---|
587 | "numD (%lu) != numS (%lu)",
|
---|
588 | numD,
|
---|
589 | numS);
|
---|
590 | return;
|
---|
591 | }
|
---|
592 | pciDa = malloc(sizeof(PCNRITEM) * numD);
|
---|
593 | if(!pciDa) {
|
---|
594 | DosBeep(250,100);
|
---|
595 | return;
|
---|
596 | }
|
---|
597 |
|
---|
598 | pciSa = malloc(sizeof(PCNRITEM) * numS);
|
---|
599 | if(!pciSa) {
|
---|
600 | if(pciDa)
|
---|
601 | free(pciDa);
|
---|
602 | DosBeep(250,100);
|
---|
603 | return;
|
---|
604 | }
|
---|
605 |
|
---|
606 | Restart:
|
---|
607 |
|
---|
608 | memset(pciDa,0,sizeof(PCNRITEM) * numD);
|
---|
609 | memset(pciSa,0,sizeof(PCNRITEM) * numS);
|
---|
610 |
|
---|
611 | pciD = (PCNRITEM)WinSendMsg(hwndCnrD,CM_QUERYRECORD,MPVOID,
|
---|
612 | MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER));
|
---|
613 | x = 0;
|
---|
614 | while( pciD && (INT)pciD != -1 && x < numD) {
|
---|
615 | if(reset)
|
---|
616 | pciD->flags = 0;
|
---|
617 | pciDa[x] = pciD;
|
---|
618 | x++;
|
---|
619 | if(!slow)
|
---|
620 | pciD = (PCNRITEM)pciD->rc.preccNextRecord;
|
---|
621 | else
|
---|
622 | pciD = (PCNRITEM)WinSendMsg(hwndCnrD,CM_QUERYRECORD,MPFROMP(pciD),
|
---|
623 | MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER));
|
---|
624 | if(!(x % 500))
|
---|
625 | DosSleep(1L);
|
---|
626 | else if(!(x % 50))
|
---|
627 | DosSleep(0L);
|
---|
628 | }
|
---|
629 | if(numD != x) {
|
---|
630 | if(!slow) {
|
---|
631 | slow = TRUE;
|
---|
632 | goto Restart;
|
---|
633 | }
|
---|
634 | free(pciDa);
|
---|
635 | free(pciSa);
|
---|
636 | DosBeep(250,100);
|
---|
637 | saymsg(MB_ENTER,
|
---|
638 | HWND_DESKTOP,
|
---|
639 | DEBUG_STRING,
|
---|
640 | "numD (%lu) != x (%lu)",
|
---|
641 | numD,
|
---|
642 | x);
|
---|
643 | return;
|
---|
644 | }
|
---|
645 |
|
---|
646 | pciS = (PCNRITEM)WinSendMsg(hwndCnrS,CM_QUERYRECORD,MPVOID,
|
---|
647 | MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER));
|
---|
648 | x = 0;
|
---|
649 | while( pciS && (INT)pciS != -1 && x < numS) {
|
---|
650 | if(reset)
|
---|
651 | pciS->flags = 0;
|
---|
652 | pciSa[x] = pciS;
|
---|
653 | x++;
|
---|
654 | if(!slow)
|
---|
655 | pciS = (PCNRITEM)pciS->rc.preccNextRecord;
|
---|
656 | else
|
---|
657 | pciS = (PCNRITEM)WinSendMsg(hwndCnrS,CM_QUERYRECORD,MPFROMP(pciS),
|
---|
658 | MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER));
|
---|
659 | if(!(x % 500))
|
---|
660 | DosSleep(1L);
|
---|
661 | else if(!(x % 50))
|
---|
662 | DosSleep(0L);
|
---|
663 | }
|
---|
664 | if(numS != x) {
|
---|
665 | if(!slow) {
|
---|
666 | slow = TRUE;
|
---|
667 | goto Restart;
|
---|
668 | }
|
---|
669 | free(pciSa);
|
---|
670 | free(pciDa);
|
---|
671 | DosBeep(250,100);
|
---|
672 | saymsg(MB_ENTER,
|
---|
673 | HWND_DESKTOP,
|
---|
674 | DEBUG_STRING,
|
---|
675 | "numS (%lu) != x (%lu)",
|
---|
676 | numS,
|
---|
677 | x);
|
---|
678 | return;
|
---|
679 | }
|
---|
680 |
|
---|
681 | if(reset) {
|
---|
682 | for(x = 0;x < numS;x++) {
|
---|
683 | if(!*pciSa[x]->szFileName || !*pciDa[x]->szFileName)
|
---|
684 | continue;
|
---|
685 | pciSa[x]->flags |= CNRITEM_EXISTS;
|
---|
686 | pciDa[x]->flags |= CNRITEM_EXISTS;
|
---|
687 | if(pciSa[x]->cbFile + pciSa[x]->easize >
|
---|
688 | pciDa[x]->cbFile + pciDa[x]->easize) {
|
---|
689 | pciSa[x]->flags |= CNRITEM_LARGER;
|
---|
690 | pciDa[x]->flags |= CNRITEM_SMALLER;
|
---|
691 | }
|
---|
692 | else if(pciSa[x]->cbFile + pciSa[x]->easize <
|
---|
693 | pciDa[x]->cbFile + pciDa[x]->easize) {
|
---|
694 | pciSa[x]->flags |= CNRITEM_SMALLER;
|
---|
695 | pciDa[x]->flags |= CNRITEM_LARGER;
|
---|
696 | }
|
---|
697 | if((pciSa[x]->date.year > pciDa[x]->date.year) ? TRUE :
|
---|
698 | (pciSa[x]->date.year < pciDa[x]->date.year) ? FALSE :
|
---|
699 | (pciSa[x]->date.month > pciDa[x]->date.month) ? TRUE :
|
---|
700 | (pciSa[x]->date.month < pciDa[x]->date.month) ? FALSE :
|
---|
701 | (pciSa[x]->date.day > pciDa[x]->date.day) ? TRUE :
|
---|
702 | (pciSa[x]->date.day < pciDa[x]->date.day) ? FALSE :
|
---|
703 | (pciSa[x]->time.hours > pciDa[x]->time.hours) ? TRUE :
|
---|
704 | (pciSa[x]->time.hours < pciDa[x]->time.hours) ? FALSE :
|
---|
705 | (pciSa[x]->time.minutes > pciDa[x]->time.minutes) ? TRUE :
|
---|
706 | (pciSa[x]->time.minutes < pciDa[x]->time.minutes) ? FALSE :
|
---|
707 | (pciSa[x]->time.seconds > pciDa[x]->time.seconds) ? TRUE :
|
---|
708 | (pciSa[x]->time.seconds < pciDa[x]->time.seconds) ? FALSE : FALSE) {
|
---|
709 | pciSa[x]->flags |= CNRITEM_NEWER;
|
---|
710 | pciDa[x]->flags |= CNRITEM_OLDER;
|
---|
711 | }
|
---|
712 | else if((pciSa[x]->date.year < pciDa[x]->date.year) ? TRUE :
|
---|
713 | (pciSa[x]->date.year > pciDa[x]->date.year) ? FALSE :
|
---|
714 | (pciSa[x]->date.month < pciDa[x]->date.month) ? TRUE :
|
---|
715 | (pciSa[x]->date.month > pciDa[x]->date.month) ? FALSE :
|
---|
716 | (pciSa[x]->date.day < pciDa[x]->date.day) ? TRUE :
|
---|
717 | (pciSa[x]->date.day > pciDa[x]->date.day) ? FALSE :
|
---|
718 | (pciSa[x]->time.hours < pciDa[x]->time.hours) ? TRUE :
|
---|
719 | (pciSa[x]->time.hours > pciDa[x]->time.hours) ? FALSE :
|
---|
720 | (pciSa[x]->time.minutes < pciDa[x]->time.minutes) ? TRUE :
|
---|
721 | (pciSa[x]->time.minutes > pciDa[x]->time.minutes) ? FALSE :
|
---|
722 | (pciSa[x]->time.seconds < pciDa[x]->time.seconds) ? TRUE :
|
---|
723 | (pciSa[x]->time.seconds > pciDa[x]->time.seconds) ? FALSE :
|
---|
724 | FALSE) {
|
---|
725 | pciSa[x]->flags |= CNRITEM_OLDER;
|
---|
726 | pciDa[x]->flags |= CNRITEM_NEWER;
|
---|
727 | }
|
---|
728 | if(!(x % 500))
|
---|
729 | DosSleep(1L);
|
---|
730 | else if(!(x % 50))
|
---|
731 | DosSleep(0L);
|
---|
732 | }
|
---|
733 | }
|
---|
734 |
|
---|
735 | switch(action) {
|
---|
736 | case IDM_SELECTIDENTICAL:
|
---|
737 | for(x = 0;x < numS;x++) {
|
---|
738 | if(!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED)) {
|
---|
739 | if(*pciSa[x]->szFileName &&
|
---|
740 | (pciSa[x]->flags & CNRITEM_EXISTS) &&
|
---|
741 | !(pciSa[x]->flags & CNRITEM_SMALLER) &&
|
---|
742 | !(pciSa[x]->flags & CNRITEM_LARGER) &&
|
---|
743 | !(pciSa[x]->flags & CNRITEM_NEWER) &&
|
---|
744 | !(pciSa[x]->flags & CNRITEM_OLDER)) {
|
---|
745 | if(!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
746 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
747 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
748 | if(!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
749 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
750 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
751 | }
|
---|
752 | if(!(x % 500))
|
---|
753 | DosSleep(1L);
|
---|
754 | else if(!(x % 50))
|
---|
755 | DosSleep(0L);
|
---|
756 | }
|
---|
757 | }
|
---|
758 | break;
|
---|
759 |
|
---|
760 | case IDM_SELECTSAME:
|
---|
761 | for(x = 0;x < numS;x++) {
|
---|
762 | if(!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
763 | *pciSa[x]->szFileName &&
|
---|
764 | (pciSa[x]->flags & CNRITEM_EXISTS) &&
|
---|
765 | !(pciSa[x]->flags & CNRITEM_SMALLER) &&
|
---|
766 | !(pciSa[x]->flags & CNRITEM_LARGER)) {
|
---|
767 | if(!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
768 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
769 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
770 | if(!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
771 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
772 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
773 | }
|
---|
774 | if(!(x % 500))
|
---|
775 | DosSleep(1L);
|
---|
776 | else if(!(x % 50))
|
---|
777 | DosSleep(0L);
|
---|
778 | }
|
---|
779 | break;
|
---|
780 |
|
---|
781 | case IDM_SELECTSAMECONTENT:
|
---|
782 | // fixme
|
---|
783 | for (x = 0;x < numS;x++) {
|
---|
784 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED &&
|
---|
785 | *pciSa[x]->szFileName &&
|
---|
786 | *pciDa[x]->szFileName &&
|
---|
787 | pciSa[x]->flags & CNRITEM_EXISTS &&
|
---|
788 | pciDa[x]->flags & CNRITEM_EXISTS) {
|
---|
789 |
|
---|
790 | FILE *fp1 = NULL;
|
---|
791 | FILE *fp2 = NULL;
|
---|
792 | BOOL gotMatch = FALSE;
|
---|
793 | BOOL gotError = FALSE;
|
---|
794 | CHAR buf1[1024];
|
---|
795 | CHAR buf2[1024];
|
---|
796 | HAB hab = WinQueryAnchorBlock(hwndCnrS);
|
---|
797 |
|
---|
798 | fp1 = _fsopen(pciSa[x]->szFileName,"rb",SH_DENYNO);
|
---|
799 | if(!fp1) {
|
---|
800 | gotError = TRUE;
|
---|
801 | }
|
---|
802 | else {
|
---|
803 | fp2 = _fsopen(pciDa[x]->szFileName,"rb",SH_DENYNO);
|
---|
804 | if(!fp2) {
|
---|
805 | gotError = TRUE;
|
---|
806 | }
|
---|
807 | else {
|
---|
808 | size_t len1 = filelength(fileno(fp1));
|
---|
809 | size_t len2 = filelength(fileno(fp2));
|
---|
810 | if (len1 == len2) {
|
---|
811 | setbuf(fp1, NULL);
|
---|
812 | setbuf(fp2, NULL);
|
---|
813 | while (WinIsWindow(hab,hwndCnrS)) {
|
---|
814 | size_t numread1 = fread(buf1,1,1024,fp1);
|
---|
815 | size_t numread2 = fread(buf2,1,1024,fp2);
|
---|
816 | if (!numread1 || !numread2 || numread1 != numread2) {
|
---|
817 | if (ferror(fp1) || ferror(fp2))
|
---|
818 | gotError = TRUE;
|
---|
819 | else if (feof(fp1) && feof(fp2))
|
---|
820 | gotMatch = TRUE;
|
---|
821 | break;
|
---|
822 | }
|
---|
823 | else if (memcmp(buf1,buf2,numread1))
|
---|
824 | break;
|
---|
825 | } // while
|
---|
826 | } // same len
|
---|
827 | }
|
---|
828 | }
|
---|
829 |
|
---|
830 | if (fp1)
|
---|
831 | fclose(fp1);
|
---|
832 |
|
---|
833 | if (fp2)
|
---|
834 | fclose(fp2);
|
---|
835 |
|
---|
836 | if (gotError) {
|
---|
837 | // fixme
|
---|
838 | DosBeep(250,100);
|
---|
839 | saymsg(MB_CANCEL,HWND_DESKTOP,
|
---|
840 | "Compare Content",
|
---|
841 | "Unexpected error comparing..."
|
---|
842 | );
|
---|
843 | }
|
---|
844 | if (gotMatch) {
|
---|
845 | if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
846 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
847 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
848 | if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
849 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
850 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
851 | }
|
---|
852 | }
|
---|
853 | if (!(x % 500))
|
---|
854 | DosSleep(1L);
|
---|
855 | else if (!(x % 50))
|
---|
856 | DosSleep(0L);
|
---|
857 | } // for records
|
---|
858 | break;
|
---|
859 |
|
---|
860 | case IDM_SELECTBOTH:
|
---|
861 | for(x = 0;x < numS;x++) {
|
---|
862 | if(!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
863 | *pciSa[x]->szFileName &&
|
---|
864 | (pciSa[x]->flags & CNRITEM_EXISTS)) {
|
---|
865 | if(!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
866 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
867 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
868 | if(!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
869 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
870 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
871 | }
|
---|
872 | if(!(x % 500))
|
---|
873 | DosSleep(1L);
|
---|
874 | else if(!(x % 50))
|
---|
875 | DosSleep(0L);
|
---|
876 | }
|
---|
877 | break;
|
---|
878 |
|
---|
879 | case IDM_SELECTONE:
|
---|
880 | for(x = 0;x < numS;x++) {
|
---|
881 | if(!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
882 | *pciSa[x]->szFileName &&
|
---|
883 | !(pciSa[x]->flags & CNRITEM_EXISTS)) {
|
---|
884 | if(!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
885 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
886 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
887 | }
|
---|
888 | else if(*pciDa[x]->szFileName &&
|
---|
889 | !(pciDa[x]->flags & CNRITEM_EXISTS)) {
|
---|
890 | if(!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
891 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
892 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
893 | }
|
---|
894 | if(!(x % 500))
|
---|
895 | DosSleep(1L);
|
---|
896 | else if(!(x % 50))
|
---|
897 | DosSleep(0L);
|
---|
898 | }
|
---|
899 | break;
|
---|
900 |
|
---|
901 | case IDM_SELECTBIGGER:
|
---|
902 | for(x = 0;x < numS;x++) {
|
---|
903 | if(!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
904 | *pciSa[x]->szFileName &&
|
---|
905 | (pciSa[x]->flags & CNRITEM_LARGER)) {
|
---|
906 | if(!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
907 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
908 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
909 | }
|
---|
910 | else if(!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
911 | *pciDa[x]->szFileName &&
|
---|
912 | (pciDa[x]->flags & CNRITEM_LARGER)) {
|
---|
913 | if(!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
914 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
915 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
916 | }
|
---|
917 | if(!(x % 500))
|
---|
918 | DosSleep(1L);
|
---|
919 | else if(!(x % 50))
|
---|
920 | DosSleep(0L);
|
---|
921 | }
|
---|
922 | break;
|
---|
923 |
|
---|
924 | case IDM_SELECTSMALLER:
|
---|
925 | for(x = 0;x < numS;x++) {
|
---|
926 | if(!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
927 | *pciSa[x]->szFileName &&
|
---|
928 | (pciSa[x]->flags & CNRITEM_SMALLER)) {
|
---|
929 | if(!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
930 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
931 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
932 | }
|
---|
933 | else if(!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
934 | *pciDa[x]->szFileName &&
|
---|
935 | (pciDa[x]->flags & CNRITEM_SMALLER)) {
|
---|
936 | if(!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
937 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
938 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
939 | }
|
---|
940 | if(!(x % 500))
|
---|
941 | DosSleep(1L);
|
---|
942 | else if(!(x % 50))
|
---|
943 | DosSleep(0L);
|
---|
944 | }
|
---|
945 | break;
|
---|
946 |
|
---|
947 | case IDM_SELECTNEWER:
|
---|
948 | for(x = 0;x < numS;x++) {
|
---|
949 | if(!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
950 | *pciSa[x]->szFileName &&
|
---|
951 | (pciSa[x]->flags & CNRITEM_NEWER)) {
|
---|
952 | if(!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
953 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
954 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
955 | }
|
---|
956 | else if(!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
957 | *pciDa[x]->szFileName &&
|
---|
958 | (pciDa[x]->flags & CNRITEM_NEWER)) {
|
---|
959 | if(!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
960 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
961 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
962 | }
|
---|
963 | if(!(x % 500))
|
---|
964 | DosSleep(1L);
|
---|
965 | else if(!(x % 50))
|
---|
966 | DosSleep(0L);
|
---|
967 | }
|
---|
968 | break;
|
---|
969 |
|
---|
970 | case IDM_SELECTOLDER:
|
---|
971 | for(x = 0;x < numS;x++) {
|
---|
972 | if(!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
973 | *pciSa[x]->szFileName &&
|
---|
974 | (pciSa[x]->flags & CNRITEM_OLDER)) {
|
---|
975 | if(!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
976 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
977 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
978 | }
|
---|
979 | else if(!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
980 | *pciDa[x]->szFileName &&
|
---|
981 | (pciDa[x]->flags & CNRITEM_OLDER)) {
|
---|
982 | if(!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED))
|
---|
983 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
984 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
985 | }
|
---|
986 | if(!(x % 500))
|
---|
987 | DosSleep(1L);
|
---|
988 | else if(!(x % 50))
|
---|
989 | DosSleep(0L);
|
---|
990 | }
|
---|
991 | break;
|
---|
992 |
|
---|
993 | case IDM_DESELECTBOTH:
|
---|
994 | for(x = 0;x < numS;x++) {
|
---|
995 | if(!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
996 | *pciSa[x]->szFileName &&
|
---|
997 | (pciSa[x]->flags & CNRITEM_EXISTS)) {
|
---|
998 | if(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
999 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
1000 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1001 | if(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
1002 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
1003 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1004 | }
|
---|
1005 | if(!(x % 500))
|
---|
1006 | DosSleep(1L);
|
---|
1007 | else if(!(x % 50))
|
---|
1008 | DosSleep(0L);
|
---|
1009 | }
|
---|
1010 | break;
|
---|
1011 |
|
---|
1012 | case IDM_DESELECTONE:
|
---|
1013 | for(x = 0;x < numS;x++) {
|
---|
1014 | if(!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
1015 | *pciSa[x]->szFileName &&
|
---|
1016 | !(pciSa[x]->flags & CNRITEM_EXISTS)) {
|
---|
1017 | if(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
1018 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
1019 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1020 | }
|
---|
1021 | else if(*pciDa[x]->szFileName &&
|
---|
1022 | !(pciDa[x]->flags & CNRITEM_EXISTS)) {
|
---|
1023 | if(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
1024 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
1025 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1026 | }
|
---|
1027 | if(!(x % 500))
|
---|
1028 | DosSleep(1L);
|
---|
1029 | else if(!(x % 50))
|
---|
1030 | DosSleep(0L);
|
---|
1031 | }
|
---|
1032 | break;
|
---|
1033 |
|
---|
1034 | case IDM_DESELECTBIGGER:
|
---|
1035 | for(x = 0;x < numS;x++) {
|
---|
1036 | if(!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
1037 | *pciSa[x]->szFileName &&
|
---|
1038 | (pciSa[x]->flags & CNRITEM_LARGER)) {
|
---|
1039 | if(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
1040 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
1041 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1042 | }
|
---|
1043 | else if(!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
1044 | *pciDa[x]->szFileName &&
|
---|
1045 | (pciDa[x]->flags & CNRITEM_LARGER)) {
|
---|
1046 | if(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
1047 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
1048 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1049 | }
|
---|
1050 | if(!(x % 500))
|
---|
1051 | DosSleep(1L);
|
---|
1052 | else if(!(x % 50))
|
---|
1053 | DosSleep(0L);
|
---|
1054 | }
|
---|
1055 | break;
|
---|
1056 |
|
---|
1057 | case IDM_DESELECTSMALLER:
|
---|
1058 | for(x = 0;x < numS;x++) {
|
---|
1059 | if(!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
1060 | *pciSa[x]->szFileName &&
|
---|
1061 | (pciSa[x]->flags & CNRITEM_SMALLER)) {
|
---|
1062 | if(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
1063 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
1064 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1065 | }
|
---|
1066 | else if(!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
1067 | *pciDa[x]->szFileName &&
|
---|
1068 | (pciDa[x]->flags & CNRITEM_SMALLER)) {
|
---|
1069 | if(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
1070 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
1071 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1072 | }
|
---|
1073 | if(!(x % 500))
|
---|
1074 | DosSleep(1L);
|
---|
1075 | else if(!(x % 50))
|
---|
1076 | DosSleep(0L);
|
---|
1077 | }
|
---|
1078 | break;
|
---|
1079 |
|
---|
1080 | case IDM_DESELECTNEWER:
|
---|
1081 | for(x = 0;x < numS;x++) {
|
---|
1082 | if(!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
1083 | *pciSa[x]->szFileName &&
|
---|
1084 | (pciSa[x]->flags & CNRITEM_NEWER)) {
|
---|
1085 | if(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
1086 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
1087 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1088 | }
|
---|
1089 | else if(!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
1090 | *pciDa[x]->szFileName &&
|
---|
1091 | (pciDa[x]->flags & CNRITEM_NEWER)) {
|
---|
1092 | if(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
1093 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
1094 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1095 | }
|
---|
1096 | if(!(x % 500))
|
---|
1097 | DosSleep(1L);
|
---|
1098 | else if(!(x % 50))
|
---|
1099 | DosSleep(0L);
|
---|
1100 | }
|
---|
1101 | break;
|
---|
1102 |
|
---|
1103 | case IDM_DESELECTOLDER:
|
---|
1104 | for(x = 0;x < numS;x++) {
|
---|
1105 | if(!(pciSa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
1106 | *pciSa[x]->szFileName &&
|
---|
1107 | (pciSa[x]->flags & CNRITEM_OLDER)) {
|
---|
1108 | if(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
1109 | WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]),
|
---|
1110 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1111 | }
|
---|
1112 | else if(!(pciDa[x]->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
1113 | *pciDa[x]->szFileName &&
|
---|
1114 | (pciDa[x]->flags & CNRITEM_OLDER)) {
|
---|
1115 | if(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
1116 | WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]),
|
---|
1117 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1118 | }
|
---|
1119 | if(!(x % 500))
|
---|
1120 | DosSleep(1L);
|
---|
1121 | else if(!(x % 50))
|
---|
1122 | DosSleep(0L);
|
---|
1123 | }
|
---|
1124 | break;
|
---|
1125 |
|
---|
1126 | default:
|
---|
1127 | break;
|
---|
1128 | }
|
---|
1129 |
|
---|
1130 | if(reset) {
|
---|
1131 | while(numS) {
|
---|
1132 | WinSendMsg(hwndCnrS,CM_INVALIDATERECORD,
|
---|
1133 | MPFROMP(pciSa),
|
---|
1134 | MPFROM2SHORT((min(numS,65535)),0));
|
---|
1135 | DosSleep(0L);
|
---|
1136 | WinSendMsg(hwndCnrD,CM_INVALIDATERECORD,
|
---|
1137 | MPFROMP(pciDa),
|
---|
1138 | MPFROM2SHORT((min(numD,65535)),0));
|
---|
1139 | numS -= min(numS,65535);
|
---|
1140 | if(numS)
|
---|
1141 | DosSleep(0L);
|
---|
1142 | }
|
---|
1143 | }
|
---|
1144 |
|
---|
1145 | free(pciSa);
|
---|
1146 | free(pciDa);
|
---|
1147 | DosPostEventSem(CompactSem);
|
---|
1148 | }
|
---|
1149 |
|
---|
1150 | struct SS {
|
---|
1151 | PCNRITEM pci;
|
---|
1152 | BOOL unique,
|
---|
1153 | all,
|
---|
1154 | smallest,
|
---|
1155 | largest,
|
---|
1156 | newest,
|
---|
1157 | oldest;
|
---|
1158 | };
|
---|
1159 |
|
---|
1160 | struct Cnr {
|
---|
1161 | HWND hwndCnr;
|
---|
1162 | ULONG numfiles;
|
---|
1163 | struct SS *ss;
|
---|
1164 | };
|
---|
1165 |
|
---|
1166 | static int CompSSNamesB (const void *s1,const void *s2)
|
---|
1167 | {
|
---|
1168 | struct SS *ss2 = (struct SS *)s2;
|
---|
1169 |
|
---|
1170 | return stricmp((CHAR *)s1,ss2->pci->pszFileName);
|
---|
1171 | }
|
---|
1172 |
|
---|
1173 | static int CompSSNames (const void *s1,const void *s2)
|
---|
1174 | {
|
---|
1175 | struct SS *ss1 = (struct SS *)s1;
|
---|
1176 | struct SS *ss2 = (struct SS *)s2;
|
---|
1177 |
|
---|
1178 | return stricmp(ss1->pci->pszFileName,ss2->pci->pszFileName);
|
---|
1179 | }
|
---|
1180 |
|
---|
1181 | VOID FreeCnrs (struct Cnr *Cnrs,INT numw)
|
---|
1182 | {
|
---|
1183 | register INT z;
|
---|
1184 |
|
---|
1185 | for(z = 0;z < numw;z++) {
|
---|
1186 | if(Cnrs[z].ss)
|
---|
1187 | free(Cnrs[z].ss);
|
---|
1188 | }
|
---|
1189 | free(Cnrs);
|
---|
1190 | DosPostEventSem(CompactSem);
|
---|
1191 | }
|
---|
1192 |
|
---|
1193 | VOID SpecialSelect2 (HWND hwndParent,INT action)
|
---|
1194 | {
|
---|
1195 | PCNRITEM pci;
|
---|
1196 | HENUM henum;
|
---|
1197 | HWND hwnd;
|
---|
1198 | register INT numwindows = 0,w,x,z,cmp;
|
---|
1199 | struct Cnr *Cnrs = NULL;
|
---|
1200 | struct SS *bsres;
|
---|
1201 |
|
---|
1202 | if(!hwndParent)
|
---|
1203 | return;
|
---|
1204 |
|
---|
1205 | /* count directory containers, build array of hwnds */
|
---|
1206 | henum = WinBeginEnumWindows(hwndParent);
|
---|
1207 | while((hwnd = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
1208 | if(WinWindowFromID(WinWindowFromID(hwnd,FID_CLIENT),DIR_CNR)) {
|
---|
1209 | Cnrs = realloc(Cnrs,(numwindows + 1) * sizeof(struct Cnr));
|
---|
1210 | if(!Cnrs) {
|
---|
1211 | Notify(GetPString(IDS_OUTOFMEMORY));
|
---|
1212 | return;
|
---|
1213 | }
|
---|
1214 | memset(&Cnrs[numwindows],0,sizeof(struct Cnr));
|
---|
1215 | Cnrs[numwindows].hwndCnr = WinWindowFromID(WinWindowFromID(hwnd,
|
---|
1216 | FID_CLIENT),DIR_CNR);
|
---|
1217 | numwindows++;
|
---|
1218 | }
|
---|
1219 | }
|
---|
1220 | WinEndEnumWindows(henum);
|
---|
1221 | if(numwindows < 2) {
|
---|
1222 | FreeCnrs(Cnrs,numwindows);
|
---|
1223 | DosBeep(250,100);
|
---|
1224 | Notify(GetPString(IDS_COMPSEL2ORMORETEXT));
|
---|
1225 | return;
|
---|
1226 | }
|
---|
1227 | if(numwindows > 4) {
|
---|
1228 | WinSendMsg(Cnrs[0].
|
---|
1229 | hwndCnr,
|
---|
1230 | UM_NOTIFY,
|
---|
1231 | MPFROMP(GetPString(IDS_BUILDINGLISTSTEXT)),
|
---|
1232 | MPVOID);
|
---|
1233 | DosSleep(0L);
|
---|
1234 | }
|
---|
1235 |
|
---|
1236 | /* count records, build array of pointers to records */
|
---|
1237 | for(z = 0;z < numwindows;z++) {
|
---|
1238 | pci = (PCNRITEM)WinSendMsg(Cnrs[z].hwndCnr,
|
---|
1239 | CM_QUERYRECORD,
|
---|
1240 | MPVOID,
|
---|
1241 | MPFROM2SHORT(CMA_FIRST,
|
---|
1242 | CMA_ITEMORDER));
|
---|
1243 | x = 0;
|
---|
1244 | while(pci && (INT)pci != -1) {
|
---|
1245 | if(!(pci->rc.flRecordAttr & CRA_FILTERED) &&
|
---|
1246 | !(pci->attrFile & FILE_DIRECTORY)) {
|
---|
1247 | Cnrs[z].ss = realloc(Cnrs[z].ss,(x + 1) * sizeof(struct SS));
|
---|
1248 | if(!Cnrs[z].ss) {
|
---|
1249 | FreeCnrs(Cnrs,numwindows);
|
---|
1250 | Notify(GetPString(IDS_OUTOFMEMORY));
|
---|
1251 | return;
|
---|
1252 | }
|
---|
1253 | memset(&Cnrs[z].ss[x],0,sizeof(struct SS));
|
---|
1254 | Cnrs[z].ss[x].pci = pci;
|
---|
1255 | x++;
|
---|
1256 | }
|
---|
1257 | pci = (PCNRITEM)WinSendMsg(Cnrs[z].hwndCnr,
|
---|
1258 | CM_QUERYRECORD,
|
---|
1259 | MPFROMP(pci),
|
---|
1260 | MPFROM2SHORT(CMA_NEXT,
|
---|
1261 | CMA_ITEMORDER));
|
---|
1262 | }
|
---|
1263 | DosSleep(0L);
|
---|
1264 | Cnrs[z].numfiles = x;
|
---|
1265 | if(Cnrs[z].numfiles)
|
---|
1266 | qsort(Cnrs[z].ss,Cnrs[z].numfiles,sizeof(struct SS),CompSSNames);
|
---|
1267 | }
|
---|
1268 |
|
---|
1269 | for(z = 0;z < numwindows;z++) {
|
---|
1270 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1271 | Cnrs[z].ss[x].all = Cnrs[z].ss[x].unique = Cnrs[z].ss[x].newest =
|
---|
1272 | Cnrs[z].ss[x].oldest = Cnrs[z].ss[x].smallest =
|
---|
1273 | Cnrs[z].ss[x].largest = TRUE;
|
---|
1274 | for(w = 0;w < numwindows;w++) {
|
---|
1275 | if(w != z && Cnrs[w].numfiles) {
|
---|
1276 | bsres = (struct SS *)bsearch(Cnrs[z].ss[x].pci->pszFileName,
|
---|
1277 | Cnrs[w].ss,Cnrs[w].numfiles,
|
---|
1278 | sizeof(struct SS),CompSSNamesB);
|
---|
1279 | if(bsres) {
|
---|
1280 | Cnrs[z].ss[x].unique = FALSE;
|
---|
1281 | if(Cnrs[z].ss[x].pci->cbFile + Cnrs[z].ss[x].pci->easize >
|
---|
1282 | bsres->pci->cbFile + bsres->pci->easize)
|
---|
1283 | Cnrs[z].ss[x].smallest = FALSE;
|
---|
1284 | if(Cnrs[z].ss[x].pci->cbFile + Cnrs[z].ss[x].pci->easize <
|
---|
1285 | bsres->pci->cbFile + bsres->pci->easize)
|
---|
1286 | Cnrs[z].ss[x].largest = FALSE;
|
---|
1287 | cmp = (Cnrs[z].ss[x].pci->date.year > bsres->pci->date.year) ? TRUE :
|
---|
1288 | (Cnrs[z].ss[x].pci->date.year < bsres->pci->date.year) ? FALSE :
|
---|
1289 | (Cnrs[z].ss[x].pci->date.month > bsres->pci->date.month) ? TRUE :
|
---|
1290 | (Cnrs[z].ss[x].pci->date.month < bsres->pci->date.month) ? FALSE :
|
---|
1291 | (Cnrs[z].ss[x].pci->date.day > bsres->pci->date.day) ? TRUE :
|
---|
1292 | (Cnrs[z].ss[x].pci->date.day < bsres->pci->date.day) ? FALSE :
|
---|
1293 | (Cnrs[z].ss[x].pci->time.hours > bsres->pci->time.hours) ? TRUE :
|
---|
1294 | (Cnrs[z].ss[x].pci->time.hours < bsres->pci->time.hours) ? FALSE :
|
---|
1295 | (Cnrs[z].ss[x].pci->time.minutes > bsres->pci->time.minutes) ? TRUE :
|
---|
1296 | (Cnrs[z].ss[x].pci->time.minutes < bsres->pci->time.minutes) ? FALSE :
|
---|
1297 | (Cnrs[z].ss[x].pci->time.seconds > bsres->pci->time.seconds) ? TRUE :
|
---|
1298 | (Cnrs[z].ss[x].pci->time.seconds < bsres->pci->time.seconds) ? FALSE :
|
---|
1299 | FALSE;
|
---|
1300 | if(!cmp)
|
---|
1301 | Cnrs[z].ss[x].newest = FALSE;
|
---|
1302 | cmp = (Cnrs[z].ss[x].pci->date.year < bsres->pci->date.year) ? TRUE :
|
---|
1303 | (Cnrs[z].ss[x].pci->date.year > bsres->pci->date.year) ? FALSE :
|
---|
1304 | (Cnrs[z].ss[x].pci->date.month < bsres->pci->date.month) ? TRUE :
|
---|
1305 | (Cnrs[z].ss[x].pci->date.month > bsres->pci->date.month) ? FALSE :
|
---|
1306 | (Cnrs[z].ss[x].pci->date.day < bsres->pci->date.day) ? TRUE :
|
---|
1307 | (Cnrs[z].ss[x].pci->date.day > bsres->pci->date.day) ? FALSE :
|
---|
1308 | (Cnrs[z].ss[x].pci->time.hours < bsres->pci->time.hours) ? TRUE :
|
---|
1309 | (Cnrs[z].ss[x].pci->time.hours > bsres->pci->time.hours) ? FALSE :
|
---|
1310 | (Cnrs[z].ss[x].pci->time.minutes < bsres->pci->time.minutes) ? TRUE :
|
---|
1311 | (Cnrs[z].ss[x].pci->time.minutes > bsres->pci->time.minutes) ? FALSE :
|
---|
1312 | (Cnrs[z].ss[x].pci->time.seconds < bsres->pci->time.seconds) ? TRUE :
|
---|
1313 | (Cnrs[z].ss[x].pci->time.seconds > bsres->pci->time.seconds) ? FALSE :
|
---|
1314 | FALSE;
|
---|
1315 | if(!cmp)
|
---|
1316 | Cnrs[z].ss[x].oldest = FALSE;
|
---|
1317 | cmp = 0;
|
---|
1318 | break;
|
---|
1319 | }
|
---|
1320 | else
|
---|
1321 | Cnrs[z].ss[x].all = FALSE;
|
---|
1322 | }
|
---|
1323 | }
|
---|
1324 | if(Cnrs[z].ss[x].unique)
|
---|
1325 | Cnrs[z].ss[x].oldest = Cnrs[z].ss[x].newest = Cnrs[z].ss[x].all =
|
---|
1326 | Cnrs[z].ss[x].largest = Cnrs[z].ss[x].smallest = FALSE;
|
---|
1327 | DosSleep(0L);
|
---|
1328 | }
|
---|
1329 | DosSleep(1L);
|
---|
1330 | }
|
---|
1331 |
|
---|
1332 | switch(action) {
|
---|
1333 | case IDM_SELECTBOTH:
|
---|
1334 | for(z = 0;z < numwindows;z++) {
|
---|
1335 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1336 | if(Cnrs[z].ss[x].all)
|
---|
1337 | WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS,
|
---|
1338 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
1339 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
1340 | }
|
---|
1341 | DosSleep(0L);
|
---|
1342 | }
|
---|
1343 | break;
|
---|
1344 | case IDM_SELECTMORE:
|
---|
1345 | for(z = 0;z < numwindows;z++) {
|
---|
1346 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1347 | if(!Cnrs[z].ss[x].unique)
|
---|
1348 | WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS,
|
---|
1349 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
1350 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
1351 | }
|
---|
1352 | DosSleep(0L);
|
---|
1353 | }
|
---|
1354 | break;
|
---|
1355 | case IDM_SELECTONE:
|
---|
1356 | for(z = 0;z < numwindows;z++) {
|
---|
1357 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1358 | if(Cnrs[z].ss[x].unique)
|
---|
1359 | WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS,
|
---|
1360 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
1361 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
1362 | }
|
---|
1363 | DosSleep(0L);
|
---|
1364 | }
|
---|
1365 | break;
|
---|
1366 | case IDM_SELECTNEWER:
|
---|
1367 | for(z = 0;z < numwindows;z++) {
|
---|
1368 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1369 | if(Cnrs[z].ss[x].newest)
|
---|
1370 | WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS,
|
---|
1371 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
1372 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
1373 | }
|
---|
1374 | DosSleep(0L);
|
---|
1375 | }
|
---|
1376 | break;
|
---|
1377 | case IDM_SELECTOLDER:
|
---|
1378 | for(z = 0;z < numwindows;z++) {
|
---|
1379 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1380 | if(Cnrs[z].ss[x].oldest)
|
---|
1381 | WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS,
|
---|
1382 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
1383 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
1384 | }
|
---|
1385 | DosSleep(0L);
|
---|
1386 | }
|
---|
1387 | break;
|
---|
1388 | case IDM_SELECTBIGGER:
|
---|
1389 | for(z = 0;z < numwindows;z++) {
|
---|
1390 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1391 | if(Cnrs[z].ss[x].largest)
|
---|
1392 | WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS,
|
---|
1393 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
1394 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
1395 | }
|
---|
1396 | DosSleep(0L);
|
---|
1397 | }
|
---|
1398 | break;
|
---|
1399 | case IDM_SELECTSMALLER:
|
---|
1400 | for(z = 0;z < numwindows;z++) {
|
---|
1401 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1402 | if(Cnrs[z].ss[x].smallest)
|
---|
1403 | WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS,
|
---|
1404 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
1405 | MPFROM2SHORT(TRUE,CRA_SELECTED));
|
---|
1406 | }
|
---|
1407 | DosSleep(0L);
|
---|
1408 | }
|
---|
1409 | break;
|
---|
1410 |
|
---|
1411 | case IDM_DESELECTBOTH:
|
---|
1412 | for(z = 0;z < numwindows;z++) {
|
---|
1413 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1414 | if(Cnrs[z].ss[x].all)
|
---|
1415 | WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS,
|
---|
1416 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
1417 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1418 | }
|
---|
1419 | DosSleep(0L);
|
---|
1420 | }
|
---|
1421 | break;
|
---|
1422 | case IDM_DESELECTMORE:
|
---|
1423 | for(z = 0;z < numwindows;z++) {
|
---|
1424 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1425 | if(!Cnrs[z].ss[x].unique)
|
---|
1426 | WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS,
|
---|
1427 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
1428 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1429 | }
|
---|
1430 | DosSleep(0L);
|
---|
1431 | }
|
---|
1432 | break;
|
---|
1433 | case IDM_DESELECTONE:
|
---|
1434 | for(z = 0;z < numwindows;z++) {
|
---|
1435 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1436 | if(Cnrs[z].ss[x].unique)
|
---|
1437 | WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS,
|
---|
1438 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
1439 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1440 | }
|
---|
1441 | DosSleep(0L);
|
---|
1442 | }
|
---|
1443 | break;
|
---|
1444 | case IDM_DESELECTNEWER:
|
---|
1445 | for(z = 0;z < numwindows;z++) {
|
---|
1446 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1447 | if(Cnrs[z].ss[x].newest)
|
---|
1448 | WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS,
|
---|
1449 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
1450 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1451 | }
|
---|
1452 | DosSleep(0L);
|
---|
1453 | }
|
---|
1454 | break;
|
---|
1455 | case IDM_DESELECTOLDER:
|
---|
1456 | for(z = 0;z < numwindows;z++) {
|
---|
1457 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1458 | if(Cnrs[z].ss[x].oldest)
|
---|
1459 | WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS,
|
---|
1460 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
1461 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1462 | }
|
---|
1463 | DosSleep(0L);
|
---|
1464 | }
|
---|
1465 | break;
|
---|
1466 | case IDM_DESELECTBIGGER:
|
---|
1467 | for(z = 0;z < numwindows;z++) {
|
---|
1468 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1469 | if(Cnrs[z].ss[x].largest)
|
---|
1470 | WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS,
|
---|
1471 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
1472 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1473 | }
|
---|
1474 | DosSleep(0L);
|
---|
1475 | }
|
---|
1476 | break;
|
---|
1477 | case IDM_DESELECTSMALLER:
|
---|
1478 | for(z = 0;z < numwindows;z++) {
|
---|
1479 | for(x = 0;x < Cnrs[z].numfiles;x++) {
|
---|
1480 | if(Cnrs[z].ss[x].smallest)
|
---|
1481 | WinSendMsg(Cnrs[z].hwndCnr,CM_SETRECORDEMPHASIS,
|
---|
1482 | MPFROMP(Cnrs[z].ss[x].pci),
|
---|
1483 | MPFROM2SHORT(FALSE,CRA_SELECTED));
|
---|
1484 | }
|
---|
1485 | DosSleep(0L);
|
---|
1486 | }
|
---|
1487 | break;
|
---|
1488 | }
|
---|
1489 |
|
---|
1490 | FreeCnrs(Cnrs,numwindows);
|
---|
1491 | }
|
---|