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