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