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