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