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