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