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