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