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