source: trunk/dll/update.c@ 1611

Last change on this file since 1611 was 1611, checked in by Steven Levine, 14 years ago

Allow SVN/CVS file ignore in Seek and scan

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 17.9 KB
Line 
1
2/***********************************************************************
3
4 $Id: update.c 1611 2011-08-08 22:08:03Z stevenhl $
5
6 Update Container record/list
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2003, 2008 Steven H. Levine
10
11 12 Feb 03 SHL Standardize EA math
12 10 Jan 04 SHL Add some intermin large drive error avoidance
13 25 May 05 SHL Rework for ULONGLONG
14 25 May 05 SHL Rework for FillInRecordFromFFB
15 06 Jun 05 SHL Drop unused code
16 22 Jul 06 SHL Use wrappers
17 20 Feb 07 GKY Add SelectDriveIcon()
18 09 Mar 07 GKY Cleanup SelectDriveIcon using "driveflag =" from Steven
19 02 Aug 07 SHL Sync with CNRITEM mods
20 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
21 14 Mar 09 GKY Prevent execution of UM_SHOWME while drive scan is occuring
22 22 Jul 09 GKY Code changes to use semaphores to serialize drive scanning
23
24***********************************************************************/
25
26#include <stdlib.h>
27#include <string.h>
28#include <ctype.h>
29
30#define INCL_DOS
31#define INCL_WIN
32#define INCL_LONGLONG
33
34#include "fm3dll.h"
35#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
36#include "update.h"
37#include "init.h" // Data declaration(s)
38#include "notebook.h" // Data declaration(s)
39#include "info.h" // Data declaration(s)
40#include "newview.h" // Data declarations
41#include "fm3str.h"
42#include "errutil.h" // Dos_Error...
43#include "filldir.h" // FillInRecordFromFFB
44#include "dircnrs.h"
45#include "flesh.h" // Flesh, Stubby
46#include "findrec.h" // FindCnrRecord
47#include "valid.h" // IsFullName
48#include "wrappers.h" // xDosFindFirst
49#include "misc.h" // PostMsg
50#include "fortify.h"
51
52static PSZ pszSrcFile = __FILE__;
53
54HPOINTER SelectDriveIcon(PCNRITEM pci)
55{
56 UINT driveflag = driveflags[toupper(*pci->pszFileName) - 'A'];
57 *pci->pszFileName = toupper(*pci->pszFileName);
58 if (isalpha(*pci->pszFileName) &&
59 toupper(*pci->pszFileName) > 'B') {
60 if (driveflag & DRIVE_CDROM)
61 pci->rc.hptrIcon = hptrCDROM;
62 else
63 pci->rc.hptrIcon =
64 (driveflag & DRIVE_REMOVABLE) ? hptrRemovable
65 :(driveflag & DRIVE_VIRTUAL) ? hptrVirtual
66 :(driveflag & DRIVE_REMOTE) ? hptrRemote
67 :(driveflag & DRIVE_RAMDISK) ? hptrRamdisk
68 :(driveflag & DRIVE_ZIPSTREAM) ? hptrZipstrm : hptrDrive;
69 }
70 else
71 pci->rc.hptrIcon = hptrFloppy;
72 return pci->rc.hptrIcon;
73}
74
75/* Update/add CNRITEM record for filename
76 * Deletes existing CNRITEM if file has disappeared
77 * @returns pci pointer to CNRITEM record or NULL if not found or if stale CNRITEM deleted
78 */
79
80PCNRITEM UpdateCnrRecord(HWND hwndCnr, CHAR *filename, BOOL partial,
81 DIRCNRDATA *dcd)
82{
83 PCNRITEM pci;
84 FILEFINDBUF4L ffb;
85 HDIR hDir = HDIR_CREATE;
86 ULONG nm = 1;
87 ULONG oldemphasis = 0;
88 APIRET status;
89
90 if (!filename || !*filename)
91 return (PCNRITEM) NULL;
92 if (IsFullName(filename)) {
93 if (driveflags[toupper(*filename) - 'A'] & DRIVE_NOTWRITEABLE)
94 /* ignore non-writeable drives */
95 return (PCNRITEM) NULL;
96 }
97 status = xDosFindFirst(filename,
98 &hDir,
99 FILE_NORMAL | FILE_DIRECTORY |
100 FILE_ARCHIVED | FILE_READONLY |
101 FILE_HIDDEN | FILE_SYSTEM,
102 &ffb, sizeof(ffb), &nm, FIL_QUERYEASIZEL);
103 if (!status) {
104 /* file exists */
105 DosFindClose(hDir);
106 if (!dcd)
107 dcd = INSTDATA(hwndCnr);
108/*
109 if(dcd->type == TREE_FRAME &&
110 !(ffb.attrFile & FILE_DIRECTORY))
111 return (PCNRITEM)NULL;
112*/
113 if (dcd->type == ARC_FRAME)
114 return (PCNRITEM) NULL;
115 if (*dcd->directory) {
116
117 CHAR *p, temp;
118
119 p = strrchr(filename, '\\');
120 if (p) {
121 if (p < filename + 3)
122 p++;
123 temp = *p;
124 *p = 0;
125 if (stricmp(filename, dcd->directory)) {
126 *p = temp;
127 return (PCNRITEM) NULL;
128 }
129 *p = temp;
130 }
131 else
132 return (PCNRITEM) NULL;
133 }
134 pci = FindCnrRecord(hwndCnr,
135 filename, (PCNRITEM) NULL, partial, FALSE, TRUE);
136 Update:
137 if (pci) {
138 // Check if record needs to be updated
139 if ((!fForceUpper && !fForceLower && strcmp(pci->pszFileName, filename)) ||
140 pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile ||
141 pci->easize != CBLIST_TO_EASIZE(ffb.cbList) || pci->date.day !=
142 ffb.fdateLastWrite.day || pci->date.month != ffb.fdateLastWrite.month ||
143 pci->date.year != ffb.fdateLastWrite.year + 1980 || pci->time.seconds !=
144 ffb.ftimeLastWrite.twosecs * 2 || pci->time.minutes != ffb.ftimeLastWrite.minutes ||
145 pci->time.hours != ffb.ftimeLastWrite.hours || pci->ladate.day !=
146 ffb.fdateLastAccess.day || pci->ladate.month != ffb.fdateLastAccess.month ||
147 pci->ladate.year != ffb.fdateLastAccess.year + 1980 || pci->latime.seconds !=
148 ffb.ftimeLastAccess.twosecs * 2 || pci->latime.minutes !=
149 ffb.ftimeLastAccess.minutes || pci->latime.hours != ffb.ftimeLastAccess.hours)
150 {
151 // Something changed - update
152 *ffb.achName = 0; // Tell FillInRecordFromFFB that filename contains full pathname
153 ffb.cchName = 0;
154 FillInRecordFromFFB(hwndCnr, pci, filename, &ffb, partial, dcd);
155 if (strlen(pci->pszFileName) < 4)
156 SelectDriveIcon(pci);
157 oldemphasis = pci->rc.flRecordAttr & (CRA_SELECTED | CRA_CURSORED);
158 if (oldemphasis)
159 WinSendMsg(hwndCnr,
160 CM_SETRECORDEMPHASIS,
161 MPFROMP(pci), MPFROM2SHORT(FALSE, oldemphasis));
162 WinSendMsg(hwndCnr,
163 CM_INVALIDATERECORD, MPFROMP(&pci), MPFROM2SHORT(1, CMA_TEXTCHANGED));
164 if (oldemphasis)
165 WinSendMsg(hwndCnr,
166 CM_SETRECORDEMPHASIS,
167 MPFROMP(pci), MPFROM2SHORT(TRUE, oldemphasis));
168 }
169 else /* existed, unchanged, do nothing but return */
170 return pci;
171 }
172 else {
173 // Add record
174 if (dcd->type == DIR_FRAME) {
175
176 RECORDINSERT ri;
177 ULONGLONG ullTotalBytes;
178
179 pci = WinSendMsg(hwndCnr,
180 CM_ALLOCRECORD,
181 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1));
182 if (pci) {
183 *ffb.achName = 0;
184 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
185 pci,
186 filename, &ffb, partial, dcd);
187 if (strlen(pci->pszFileName) < 4)
188 SelectDriveIcon(pci);
189 memset(&ri, 0, sizeof(RECORDINSERT));
190 ri.cb = sizeof(RECORDINSERT);
191 ri.pRecordOrder = (PRECORDCORE) CMA_END;
192 ri.pRecordParent = (PRECORDCORE) NULL;
193 ri.zOrder = (USHORT) CMA_TOP;
194 ri.cRecordsInsert = 1;
195 ri.fInvalidateRecord = TRUE;
196 if (WinSendMsg(hwndCnr,
197 CM_INSERTRECORD,
198 MPFROMP(pci), MPFROMP(&ri)) && ullTotalBytes) {
199 dcd->ullTotalBytes += ullTotalBytes;
200 PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID);
201 if (pci->attrFile & FILE_DIRECTORY) {
202 Stubby(hwndCnr, pci);
203 }
204 }
205 }
206 }
207 else if (ffb.attrFile & FILE_DIRECTORY) {
208
209 /* check all parts and insert as required */
210 CHAR *p, temp;
211 PCNRITEM pciParent = NULL, pciT;
212
213 p = strchr(filename, '\\');
214 if (p) {
215 while (p && *p) {
216 if (p < filename + 3)
217 p++;
218 temp = *p;
219 *p = 0;
220 pciT = FindCnrRecord(hwndCnr,
221 filename, NULL, partial, FALSE, TRUE);
222 if (!pciT || (INT) pciT == -1) {
223 pci = WinSendMsg(hwndCnr,
224 CM_ALLOCRECORD,
225 MPFROMLONG(EXTRA_RECORD_BYTES),
226 MPFROMLONG(1));
227 if (pci) {
228
229 RECORDINSERT ri;
230
231 *ffb.achName = 0;
232 FillInRecordFromFFB(hwndCnr,
233 pci, filename, &ffb, partial, dcd);
234 if (strlen(pci->pszFileName) < 4)
235 SelectDriveIcon(pci);
236 memset(&ri, 0, sizeof(RECORDINSERT));
237 ri.cb = sizeof(RECORDINSERT);
238 ri.pRecordOrder = (PRECORDCORE) CMA_END;
239 ri.pRecordParent = (PRECORDCORE) pciParent;
240 ri.zOrder = (USHORT) CMA_TOP;
241 ri.cRecordsInsert = 1;
242 ri.fInvalidateRecord = TRUE;
243 if (WinSendMsg(hwndCnr,
244 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
245 Flesh(hwndCnr, pci);
246 *p = temp;
247 pci = FindCnrRecord(hwndCnr,
248 filename, pciT, partial, FALSE, TRUE);
249 if (pci)
250 goto Update;
251 }
252 }
253 }
254 else {
255 pciParent = pciT;
256 if (!(pciT->rc.flRecordAttr & CRA_EXPANDED)) {
257 Flesh(hwndCnr, pciT);
258 *p = temp;
259 pci = FindCnrRecord(hwndCnr,
260 filename, pciT, partial, FALSE, TRUE);
261 if (pci)
262 goto Update;
263 }
264 }
265 *p = temp;
266 p = strchr(p + ((temp == '\\') ? 1 : 0), '\\');
267 }
268 }
269 pci = WinSendMsg(hwndCnr,
270 CM_ALLOCRECORD,
271 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1));
272 if (pci) {
273
274 RECORDINSERT ri;
275 ULONGLONG ullTotalBytes;
276
277 *ffb.achName = 0;
278 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
279 pci,
280 filename, &ffb, partial, dcd);
281 if (strlen(pci->pszFileName) < 4)
282 SelectDriveIcon(pci);
283 memset(&ri, 0, sizeof(RECORDINSERT));
284 ri.cb = sizeof(RECORDINSERT);
285 ri.pRecordOrder = (PRECORDCORE) CMA_END;
286 ri.pRecordParent = (PRECORDCORE) pciParent;
287 ri.zOrder = (USHORT) CMA_TOP;
288 ri.cRecordsInsert = 1;
289 ri.fInvalidateRecord = TRUE;
290 if (WinSendMsg(hwndCnr,
291 CM_INSERTRECORD,
292 MPFROMP(pci), MPFROMP(&ri)) && ullTotalBytes) {
293 if (dcd->type == DIR_FRAME) {
294 dcd->ullTotalBytes += ullTotalBytes;
295 }
296 Stubby(hwndCnr, pci);
297 }
298 }
299 }
300 }
301 }
302 else if ((pci = FindCnrRecord(hwndCnr,
303 filename,
304 (PCNRITEM) NULL,
305 partial,
306 FALSE,
307 TRUE)) !=
308 NULL && (INT) pci != -1 && strlen(pci->pszFileName) > 3) {
309 // File has disappeared and found stale CNRITEM record delete it
310 if (!dcd)
311 dcd = INSTDATA(hwndCnr);
312 if (pci->rc.flRecordAttr & CRA_SELECTED)
313 WinSendMsg(hwndCnr,
314 CM_SETRECORDEMPHASIS,
315 MPFROMP(pci), MPFROM2SHORT(FALSE, CRA_SELECTED));
316 if (dcd->type == DIR_FRAME)
317 dcd->ullTotalBytes -= pci->cbFile + pci->easize;
318 RemoveCnrItems(hwndCnr, pci, 1, CMA_FREE | CMA_INVALIDATE);
319 pci = NULL;
320 PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID);
321 }
322 return pci;
323}
324
325BOOL UpdateCnrList(HWND hwndCnr, CHAR ** filename, INT howmany, BOOL partial,
326 DIRCNRDATA * dcd)
327{
328 PCNRITEM pci, *pciList = NULL;
329 FILEFINDBUF4L ffb;
330 HDIR hDir;
331 ULONG nm = (ULONG) howmany;
332 INT x;
333 INT numlist = 0;
334 INT numremain;
335 BOOL repos = FALSE;
336 BOOL ret = FALSE;
337 APIRET status;
338
339 if (!dcd)
340 dcd = INSTDATA(hwndCnr);
341 if (!dcd) {
342 Runtime_Error(pszSrcFile, __LINE__, NULL);
343 return ret;
344 }
345 if (!filename || !howmany || !filename[0])
346 return ret;
347 {
348 CNRINFO cnri;
349
350 memset(&cnri, 0, sizeof(CNRINFO));
351 cnri.cb = sizeof(CNRINFO);
352 WinSendMsg(hwndCnr,
353 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
354 numremain = cnri.cRecords;
355 }
356 pciList = xmalloc(sizeof(PCNRITEM) * howmany, pszSrcFile, __LINE__);
357 if (pciList) {
358 for (x = 0; filename[x] && x < howmany; x++) {
359 if (IsFullName(filename[x])) {
360 if (driveflags[toupper(*filename[x]) - 'A'] & DRIVE_NOTWRITEABLE)
361 /* ignore non-writeable drives */
362 continue;
363 }
364 hDir = HDIR_CREATE;
365 status = xDosFindFirst(filename[x],
366 &hDir,
367 FILE_NORMAL | FILE_DIRECTORY |
368 FILE_ARCHIVED | FILE_READONLY |
369 FILE_HIDDEN | FILE_SYSTEM,
370 &ffb, sizeof(ffb), &nm, FIL_QUERYEASIZEL);
371 if (!status) {
372 /* file exists */
373 DosFindClose(hDir);
374 // if(dcd->type == TREE_FRAME && !(ffb.attrFile & FILE_DIRECTORY))
375 // continue;
376 if (dcd->type == DIR_FRAME && *dcd->directory) {
377
378 CHAR *p, temp;
379
380 p = strrchr(filename[x], '\\');
381 if (p) {
382 if (p < filename[x] + 3)
383 p++;
384 temp = *p;
385 *p = 0;
386 if (stricmp(filename[x], dcd->directory)) {
387 *p = temp;
388 continue;
389 }
390 *p = temp;
391 }
392 else
393 continue;
394 }
395 ret = TRUE;
396 pci = FindCnrRecord(hwndCnr,
397 filename[x],
398 (PCNRITEM) NULL, partial, FALSE, TRUE);
399 if (pci) {
400 /* update record? */
401 if ((!fForceUpper && !fForceLower &&
402 strcmp(pci->pszFileName, filename[x])) ||
403 pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile ||
404 pci->easize != CBLIST_TO_EASIZE(ffb.cbList) ||
405 pci->date.day != ffb.fdateLastWrite.day ||
406 pci->date.month != ffb.fdateLastWrite.month ||
407 pci->date.year != ffb.fdateLastWrite.year + 1980 ||
408 pci->time.seconds != ffb.ftimeLastWrite.twosecs * 2 ||
409 pci->time.minutes != ffb.ftimeLastWrite.minutes ||
410 pci->time.hours != ffb.ftimeLastWrite.hours ||
411 pci->ladate.day != ffb.fdateLastAccess.day ||
412 pci->ladate.month != ffb.fdateLastAccess.month ||
413 pci->ladate.year != ffb.fdateLastAccess.year + 1980 ||
414 pci->latime.seconds != ffb.ftimeLastAccess.twosecs * 2 ||
415 pci->latime.minutes != ffb.ftimeLastAccess.minutes ||
416 pci->latime.hours != ffb.ftimeLastAccess.hours) {
417 /* changed; update */
418 pciList[numlist++] = pci;
419 *ffb.achName = 0;
420 ffb.cchName = 0;
421 FillInRecordFromFFB(hwndCnr,
422 pci, filename[x], &ffb, partial, dcd);
423 if (IsRoot(pci->pszFileName))
424 SelectDriveIcon(pci);
425 WinSendMsg(hwndCnr,
426 CM_SETRECORDEMPHASIS,
427 MPFROMP(pci),
428 MPFROM2SHORT(FALSE, CRA_SELECTED | CRA_CURSORED));
429 }
430 }
431 else {
432 /* add record */
433 if (dcd->type == DIR_FRAME) {
434 RECORDINSERT ri;
435 ULONGLONG ullTotalBytes;
436
437 pci = WinSendMsg(hwndCnr,
438 CM_ALLOCRECORD,
439 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1));
440 if (pci) {
441 ret = TRUE;
442 *ffb.achName = 0;
443 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
444 pci,
445 filename[x],
446 &ffb, partial, dcd);
447 if (strlen(pci->pszFileName) < 4)
448 SelectDriveIcon(pci);
449 memset(&ri, 0, sizeof(RECORDINSERT));
450 ri.cb = sizeof(RECORDINSERT);
451 ri.pRecordOrder = (PRECORDCORE) CMA_END;
452 ri.pRecordParent = (PRECORDCORE) NULL;
453 ri.zOrder = (USHORT) CMA_TOP;
454 ri.cRecordsInsert = 1;
455 ri.fInvalidateRecord = FALSE;
456 if (WinSendMsg(hwndCnr,
457 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
458 if (ullTotalBytes) {
459 dcd->ullTotalBytes += ullTotalBytes;
460 numremain++;
461 }
462 repos = TRUE;
463 if (pci->attrFile & FILE_DIRECTORY) {
464 Stubby(hwndCnr, pci);
465 }
466 }
467 else
468 FreeCnrItem(hwndCnr, pci);
469 }
470 }
471 else if (ffb.attrFile & FILE_DIRECTORY) {
472 /* check all parts and insert as required */
473 CHAR *p, temp;
474 PCNRITEM pciParent = NULL, pciT;
475
476 p = strchr(filename[x], '\\');
477 if (p) {
478 while (p && *p) {
479 if (p < filename[x] + 3)
480 p++;
481 temp = *p;
482 *p = 0;
483 pciT = FindCnrRecord(hwndCnr,
484 filename[x], NULL, partial, FALSE, TRUE);
485 if (!pciT || (INT) pciT == -1) {
486 pci = WinSendMsg(hwndCnr,
487 CM_ALLOCRECORD,
488 MPFROMLONG(EXTRA_RECORD_BYTES),
489 MPFROMLONG(1));
490 if (pci) {
491
492 RECORDINSERT ri;
493 ULONGLONG ullTotalBytes;
494
495 ret = TRUE;
496 *ffb.achName = 0;
497 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
498 pci,
499 filename[x],
500 &ffb, partial, dcd);
501 if (strlen(pci->pszFileName) < 4)
502 SelectDriveIcon(pci);
503 memset(&ri, 0, sizeof(RECORDINSERT));
504 ri.cb = sizeof(RECORDINSERT);
505 ri.pRecordOrder = (PRECORDCORE) CMA_END;
506 ri.pRecordParent = (PRECORDCORE) pciParent;
507 ri.zOrder = (USHORT) CMA_TOP;
508 ri.cRecordsInsert = 1;
509 ri.fInvalidateRecord = FALSE;
510 if (WinSendMsg(hwndCnr,
511 CM_INSERTRECORD,
512 MPFROMP(pci), MPFROMP(&ri))) {
513 if (ullTotalBytes) {
514 numremain++;
515 if (dcd->type == DIR_FRAME)
516 dcd->ullTotalBytes += ullTotalBytes;
517 }
518 repos = TRUE;
519 }
520 else
521 FreeCnrItem(hwndCnr, pci);
522 }
523 }
524 else
525 pciParent = pciT;
526 *p = temp;
527 p = strchr(p + ((temp == '\\') ? 1 : 0), '\\');
528 }
529 }
530 {
531 pci = WinSendMsg(hwndCnr,
532 CM_ALLOCRECORD,
533 MPFROMLONG(EXTRA_RECORD_BYTES),
534 MPFROMLONG(1));
535 if (pci) {
536
537 RECORDINSERT ri;
538 ULONGLONG ullTotalBytes;
539
540 ret = TRUE;
541 *ffb.achName = 0;
542 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
543 pci,
544 filename[x],
545 &ffb, partial, dcd);
546 if (strlen(pci->pszFileName) < 4)
547 SelectDriveIcon(pci);
548 memset(&ri, 0, sizeof(RECORDINSERT));
549 ri.cb = sizeof(RECORDINSERT);
550 ri.pRecordOrder = (PRECORDCORE) CMA_END;
551 ri.pRecordParent = (PRECORDCORE) pciParent;
552 ri.zOrder = (USHORT) CMA_TOP;
553 ri.cRecordsInsert = 1;
554 ri.fInvalidateRecord = FALSE;
555 if (WinSendMsg(hwndCnr,
556 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
557 if (ullTotalBytes) {
558 numremain++;
559 if (dcd->type == DIR_FRAME)
560 dcd->ullTotalBytes += ullTotalBytes;
561 }
562 repos = TRUE;
563 Stubby(hwndCnr, pci);
564 }
565 else
566 FreeCnrItem(hwndCnr, pci);
567 }
568 }
569 }
570 }
571 }
572 else if ((pci = FindCnrRecord(hwndCnr,
573 filename[x],
574 (PCNRITEM) NULL,
575 partial,
576 FALSE,
577 TRUE)) != NULL &&
578 (INT) pci != -1 && !IsRoot(pci->pszFileName)) {
579 /* file doesn't exist; delete record */
580 if (pci->rc.flRecordAttr & CRA_SELECTED)
581 WinSendMsg(hwndCnr,
582 CM_SETRECORDEMPHASIS,
583 MPFROMP(pci), MPFROM2SHORT(FALSE, CRA_SELECTED));
584 if (dcd->type == DIR_FRAME)
585 dcd->ullTotalBytes -= (pci->cbFile + pci->easize);
586 // 02 Aug 07 SHL rc check was wrong
587 if (RemoveCnrItems(hwndCnr, pci, 1,
588 CMA_FREE |
589 numremain == 1 ? CMA_INVALIDATE : 0) != -1) {
590 pci = NULL;
591 numremain--;
592 repos = TRUE;
593 }
594 }
595 } // for x
596 }
597 if (repos || (pciList && numlist)) {
598 QUERYRECORDRECT qrr;
599 RECTL rCnr, rCItem;
600
601 pci = WinSendMsg(hwndCnr,
602 CM_QUERYRECORDEMPHASIS,
603 MPFROMLONG(CMA_FIRST), MPFROMLONG(CRA_CURSORED));
604 if (pci && (INT) pci != -1) {
605 memset(&qrr, 0, sizeof(QUERYRECORDRECT));
606 qrr.cb = sizeof(QUERYRECORDRECT);
607 qrr.pRecord = (PRECORDCORE) pci;
608 qrr.fRightSplitWindow = FALSE;
609 qrr.fsExtent = CMA_TEXT;
610 if (!WinSendMsg(hwndCnr,
611 CM_QUERYRECORDRECT, MPFROMP(&rCItem), MPFROMP(&qrr)))
612 qrr.cb = 0;
613 }
614 if (pciList && numlist && !repos) {
615 WinSendMsg(hwndCnr,
616 CM_INVALIDATERECORD,
617 MPFROMP(pciList),
618 MPFROM2SHORT(numlist,
619 (repos ? CMA_NOREPOSITION :
620 CMA_REPOSITION | CMA_ERASE)));
621 }
622 if (repos)
623 WinSendMsg(hwndCnr,
624 CM_INVALIDATERECORD,
625 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
626 if (pci && (INT) pci != -1 && qrr.cb) {
627 WinSendMsg(hwndCnr,
628 CM_QUERYVIEWPORTRECT,
629 MPFROMP(&rCnr), MPFROM2SHORT(CMA_WINDOW, (SHORT) FALSE));
630 WinSendMsg(hwndCnr,
631 CM_SCROLLWINDOW,
632 MPFROMSHORT(CMA_VERTICAL),
633 MPFROMLONG(rCnr.yTop - rCItem.yTop));
634 }
635 }
636 PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID);
637 if (pciList) {
638 free(pciList);
639 DosPostEventSem(CompactSem);
640 }
641 return ret;
642}
643
644#pragma alloc_text(UPDATECNR,UpdateCnrRecord,UpdateCnrList)
Note: See TracBrowser for help on using the repository browser.