source: trunk/dll/select.c@ 907

Last change on this file since 907 was 907, checked in by Steven Levine, 18 years ago

Avoid out of memory traps in Compare Directories
Rework Compare Directories progress display for 2 second update rate
Start refactoring to reduce dependence on fm3dll.h
Add timer services (IsITimerExpired etc.)

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