source: trunk/dll/update.c@ 1570

Last change on this file since 1570 was 1444, checked in by Gregg Young, 16 years ago

Rework of drivebar to rescan all drives and refresh media buttons and menu items grey out inappropriate menu items. Streamline Tree scan code and use semaphores to serialize access. Add NOEASUPPORT and LOCALHD driveflag; .LONGNAME usage fixes; (Tickets 377-386)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 17.8 KB
Line 
1
2/***********************************************************************
3
4 $Id: update.c 1444 2009-07-22 23:24:23Z gyoung $
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}
74PCNRITEM UpdateCnrRecord(HWND hwndCnr, CHAR * filename, BOOL partial,
75 DIRCNRDATA * dcd)
76{
77 PCNRITEM pci;
78 FILEFINDBUF4L ffb;
79 HDIR hDir = HDIR_CREATE;
80 ULONG nm = 1;
81 ULONG oldemphasis = 0;
82 APIRET status;
83
84 if (!filename || !*filename)
85 return (PCNRITEM) NULL;
86 if (IsFullName(filename)) {
87 if (driveflags[toupper(*filename) - 'A'] & DRIVE_NOTWRITEABLE)
88 /* ignore non-writeable drives */
89 return (PCNRITEM) NULL;
90 }
91 status = xDosFindFirst(filename,
92 &hDir,
93 FILE_NORMAL | FILE_DIRECTORY |
94 FILE_ARCHIVED | FILE_READONLY |
95 FILE_HIDDEN | FILE_SYSTEM,
96 &ffb, sizeof(ffb), &nm, FIL_QUERYEASIZEL);
97 if (!status) {
98 /* file exists */
99 DosFindClose(hDir);
100 if (!dcd)
101 dcd = INSTDATA(hwndCnr);
102/*
103 if(dcd->type == TREE_FRAME &&
104 !(ffb.attrFile & FILE_DIRECTORY))
105 return (PCNRITEM)NULL;
106*/
107 if (dcd->type == ARC_FRAME)
108 return (PCNRITEM) NULL;
109 if (*dcd->directory) {
110
111 CHAR *p, temp;
112
113 p = strrchr(filename, '\\');
114 if (p) {
115 if (p < filename + 3)
116 p++;
117 temp = *p;
118 *p = 0;
119 if (stricmp(filename, dcd->directory)) {
120 *p = temp;
121 return (PCNRITEM) NULL;
122 }
123 *p = temp;
124 }
125 else
126 return (PCNRITEM) NULL;
127 }
128 pci = FindCnrRecord(hwndCnr,
129 filename, (PCNRITEM) NULL, partial, FALSE, TRUE);
130 Update:
131 if (pci) { /* update record? */
132 if ((!fForceUpper && !fForceLower && strcmp(pci->pszFileName, filename)) ||
133 pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile ||
134 pci->easize != CBLIST_TO_EASIZE(ffb.cbList) || pci->date.day !=
135 ffb.fdateLastWrite.day || pci->date.month != ffb.fdateLastWrite.month ||
136 pci->date.year != ffb.fdateLastWrite.year + 1980 || pci->time.seconds !=
137 ffb.ftimeLastWrite.twosecs * 2 || pci->time.minutes != ffb.ftimeLastWrite.minutes ||
138 pci->time.hours != ffb.ftimeLastWrite.hours || pci->ladate.day !=
139 ffb.fdateLastAccess.day || pci->ladate.month != ffb.fdateLastAccess.month ||
140 pci->ladate.year != ffb.fdateLastAccess.year + 1980 || pci->latime.seconds !=
141 ffb.ftimeLastAccess.twosecs * 2 || pci->latime.minutes !=
142 ffb.ftimeLastAccess.minutes || pci->latime.hours != ffb.ftimeLastAccess.hours) { /* changed; update */
143 *ffb.achName = 0;
144 ffb.cchName = 0;
145 FillInRecordFromFFB(hwndCnr, pci, filename, &ffb, partial, dcd);
146 if (strlen(pci->pszFileName) < 4)
147 SelectDriveIcon(pci);
148 oldemphasis = pci->rc.flRecordAttr & (CRA_SELECTED | CRA_CURSORED);
149 if (oldemphasis)
150 WinSendMsg(hwndCnr,
151 CM_SETRECORDEMPHASIS,
152 MPFROMP(pci), MPFROM2SHORT(FALSE, oldemphasis));
153 WinSendMsg(hwndCnr,
154 CM_INVALIDATERECORD, MPFROMP(&pci), MPFROM2SHORT(1,
155 /* CMA_ERASE | */
156 CMA_TEXTCHANGED));
157 if (oldemphasis)
158 WinSendMsg(hwndCnr,
159 CM_SETRECORDEMPHASIS,
160 MPFROMP(pci), MPFROM2SHORT(TRUE, oldemphasis));
161 }
162 else /* existed, unchanged, do nothing but return */
163 return pci;
164 }
165 else { /* add record */
166 if (dcd->type == DIR_FRAME) {
167
168 RECORDINSERT ri;
169 ULONGLONG ullTotalBytes;
170
171 pci = WinSendMsg(hwndCnr,
172 CM_ALLOCRECORD,
173 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1));
174 if (pci) {
175 *ffb.achName = 0;
176 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
177 pci,
178 filename, &ffb, partial, dcd);
179 if (strlen(pci->pszFileName) < 4)
180 SelectDriveIcon(pci);
181 memset(&ri, 0, sizeof(RECORDINSERT));
182 ri.cb = sizeof(RECORDINSERT);
183 ri.pRecordOrder = (PRECORDCORE) CMA_END;
184 ri.pRecordParent = (PRECORDCORE) NULL;
185 ri.zOrder = (USHORT) CMA_TOP;
186 ri.cRecordsInsert = 1;
187 ri.fInvalidateRecord = TRUE;
188 if (WinSendMsg(hwndCnr,
189 CM_INSERTRECORD,
190 MPFROMP(pci), MPFROMP(&ri)) && ullTotalBytes) {
191 dcd->ullTotalBytes += ullTotalBytes;
192 PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID);
193 if (pci->attrFile & FILE_DIRECTORY) {
194 Stubby(hwndCnr, pci);
195 }
196 }
197 }
198 }
199 else if (ffb.attrFile & FILE_DIRECTORY) {
200
201 /* check all parts and insert as required */
202 CHAR *p, temp;
203 PCNRITEM pciParent = NULL, pciT;
204
205 p = strchr(filename, '\\');
206 if (p) {
207 while (p && *p) {
208 if (p < filename + 3)
209 p++;
210 temp = *p;
211 *p = 0;
212 pciT = FindCnrRecord(hwndCnr,
213 filename, NULL, partial, FALSE, TRUE);
214 if (!pciT || (INT) pciT == -1) {
215 pci = WinSendMsg(hwndCnr,
216 CM_ALLOCRECORD,
217 MPFROMLONG(EXTRA_RECORD_BYTES),
218 MPFROMLONG(1));
219 if (pci) {
220
221 RECORDINSERT ri;
222
223 *ffb.achName = 0;
224 FillInRecordFromFFB(hwndCnr,
225 pci, filename, &ffb, partial, dcd);
226 if (strlen(pci->pszFileName) < 4)
227 SelectDriveIcon(pci);
228 memset(&ri, 0, sizeof(RECORDINSERT));
229 ri.cb = sizeof(RECORDINSERT);
230 ri.pRecordOrder = (PRECORDCORE) CMA_END;
231 ri.pRecordParent = (PRECORDCORE) pciParent;
232 ri.zOrder = (USHORT) CMA_TOP;
233 ri.cRecordsInsert = 1;
234 ri.fInvalidateRecord = TRUE;
235 if (WinSendMsg(hwndCnr,
236 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
237 Flesh(hwndCnr, pci);
238 *p = temp;
239 pci = FindCnrRecord(hwndCnr,
240 filename, pciT, partial, FALSE, TRUE);
241 if (pci)
242 goto Update;
243 }
244 }
245 }
246 else {
247 pciParent = pciT;
248 if (!(pciT->rc.flRecordAttr & CRA_EXPANDED)) {
249 Flesh(hwndCnr, pciT);
250 *p = temp;
251 pci = FindCnrRecord(hwndCnr,
252 filename, pciT, partial, FALSE, TRUE);
253 if (pci)
254 goto Update;
255 }
256 }
257 *p = temp;
258 p = strchr(p + ((temp == '\\') ? 1 : 0), '\\');
259 }
260 }
261 pci = WinSendMsg(hwndCnr,
262 CM_ALLOCRECORD,
263 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1));
264 if (pci) {
265
266 RECORDINSERT ri;
267 ULONGLONG ullTotalBytes;
268
269 *ffb.achName = 0;
270 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
271 pci,
272 filename, &ffb, partial, dcd);
273 if (strlen(pci->pszFileName) < 4)
274 SelectDriveIcon(pci);
275 memset(&ri, 0, sizeof(RECORDINSERT));
276 ri.cb = sizeof(RECORDINSERT);
277 ri.pRecordOrder = (PRECORDCORE) CMA_END;
278 ri.pRecordParent = (PRECORDCORE) pciParent;
279 ri.zOrder = (USHORT) CMA_TOP;
280 ri.cRecordsInsert = 1;
281 ri.fInvalidateRecord = TRUE;
282 if (WinSendMsg(hwndCnr,
283 CM_INSERTRECORD,
284 MPFROMP(pci), MPFROMP(&ri)) && ullTotalBytes) {
285 if (dcd->type == DIR_FRAME) {
286 dcd->ullTotalBytes += ullTotalBytes;
287 }
288 Stubby(hwndCnr, pci);
289 }
290 }
291 }
292 }
293 }
294 else if ((pci = FindCnrRecord(hwndCnr,
295 filename,
296 (PCNRITEM) NULL,
297 partial,
298 FALSE,
299 TRUE)) !=
300 NULL && (INT) pci != -1 && strlen(pci->pszFileName) > 3) {
301 /* file doesn't exist; delete record */
302 if (!dcd)
303 dcd = INSTDATA(hwndCnr);
304 if (pci->rc.flRecordAttr & CRA_SELECTED)
305 WinSendMsg(hwndCnr,
306 CM_SETRECORDEMPHASIS,
307 MPFROMP(pci), MPFROM2SHORT(FALSE, CRA_SELECTED));
308 if (dcd->type == DIR_FRAME)
309 dcd->ullTotalBytes -= pci->cbFile + pci->easize;
310 RemoveCnrItems(hwndCnr, pci, 1, CMA_FREE | CMA_INVALIDATE);
311 pci = NULL;
312 PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID);
313 }
314 return pci;
315}
316
317BOOL UpdateCnrList(HWND hwndCnr, CHAR ** filename, INT howmany, BOOL partial,
318 DIRCNRDATA * dcd)
319{
320 PCNRITEM pci, *pciList = NULL;
321 FILEFINDBUF4L ffb;
322 HDIR hDir;
323 ULONG nm = (ULONG) howmany;
324 INT x;
325 INT numlist = 0;
326 INT numremain;
327 BOOL repos = FALSE;
328 BOOL ret = FALSE;
329 APIRET status;
330
331 if (!dcd)
332 dcd = INSTDATA(hwndCnr);
333 if (!dcd) {
334 Runtime_Error(pszSrcFile, __LINE__, NULL);
335 return ret;
336 }
337 if (!filename || !howmany || !filename[0])
338 return ret;
339 {
340 CNRINFO cnri;
341
342 memset(&cnri, 0, sizeof(CNRINFO));
343 cnri.cb = sizeof(CNRINFO);
344 WinSendMsg(hwndCnr,
345 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
346 numremain = cnri.cRecords;
347 }
348 pciList = xmalloc(sizeof(PCNRITEM) * howmany, pszSrcFile, __LINE__);
349 if (pciList) {
350 for (x = 0; filename[x] && x < howmany; x++) {
351 if (IsFullName(filename[x])) {
352 if (driveflags[toupper(*filename[x]) - 'A'] & DRIVE_NOTWRITEABLE)
353 /* ignore non-writeable drives */
354 continue;
355 }
356 hDir = HDIR_CREATE;
357 status = xDosFindFirst(filename[x],
358 &hDir,
359 FILE_NORMAL | FILE_DIRECTORY |
360 FILE_ARCHIVED | FILE_READONLY |
361 FILE_HIDDEN | FILE_SYSTEM,
362 &ffb, sizeof(ffb), &nm, FIL_QUERYEASIZEL);
363 if (!status) {
364 /* file exists */
365 DosFindClose(hDir);
366 // if(dcd->type == TREE_FRAME && !(ffb.attrFile & FILE_DIRECTORY))
367 // continue;
368 if (dcd->type == DIR_FRAME && *dcd->directory) {
369
370 CHAR *p, temp;
371
372 p = strrchr(filename[x], '\\');
373 if (p) {
374 if (p < filename[x] + 3)
375 p++;
376 temp = *p;
377 *p = 0;
378 if (stricmp(filename[x], dcd->directory)) {
379 *p = temp;
380 continue;
381 }
382 *p = temp;
383 }
384 else
385 continue;
386 }
387 ret = TRUE;
388 pci = FindCnrRecord(hwndCnr,
389 filename[x],
390 (PCNRITEM) NULL, partial, FALSE, TRUE);
391 if (pci) {
392 /* update record? */
393 if ((!fForceUpper && !fForceLower &&
394 strcmp(pci->pszFileName, filename[x])) ||
395 pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile ||
396 pci->easize != CBLIST_TO_EASIZE(ffb.cbList) ||
397 pci->date.day != ffb.fdateLastWrite.day ||
398 pci->date.month != ffb.fdateLastWrite.month ||
399 pci->date.year != ffb.fdateLastWrite.year + 1980 ||
400 pci->time.seconds != ffb.ftimeLastWrite.twosecs * 2 ||
401 pci->time.minutes != ffb.ftimeLastWrite.minutes ||
402 pci->time.hours != ffb.ftimeLastWrite.hours ||
403 pci->ladate.day != ffb.fdateLastAccess.day ||
404 pci->ladate.month != ffb.fdateLastAccess.month ||
405 pci->ladate.year != ffb.fdateLastAccess.year + 1980 ||
406 pci->latime.seconds != ffb.ftimeLastAccess.twosecs * 2 ||
407 pci->latime.minutes != ffb.ftimeLastAccess.minutes ||
408 pci->latime.hours != ffb.ftimeLastAccess.hours) {
409 /* changed; update */
410 pciList[numlist++] = pci;
411 *ffb.achName = 0;
412 ffb.cchName = 0;
413 FillInRecordFromFFB(hwndCnr,
414 pci, filename[x], &ffb, partial, dcd);
415 if (IsRoot(pci->pszFileName))
416 SelectDriveIcon(pci);
417 WinSendMsg(hwndCnr,
418 CM_SETRECORDEMPHASIS,
419 MPFROMP(pci),
420 MPFROM2SHORT(FALSE, CRA_SELECTED | CRA_CURSORED));
421 }
422 }
423 else {
424 /* add record */
425 if (dcd->type == DIR_FRAME) {
426 RECORDINSERT ri;
427 ULONGLONG ullTotalBytes;
428
429 pci = WinSendMsg(hwndCnr,
430 CM_ALLOCRECORD,
431 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1));
432 if (pci) {
433 ret = TRUE;
434 *ffb.achName = 0;
435 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
436 pci,
437 filename[x],
438 &ffb, partial, dcd);
439 if (strlen(pci->pszFileName) < 4)
440 SelectDriveIcon(pci);
441 memset(&ri, 0, sizeof(RECORDINSERT));
442 ri.cb = sizeof(RECORDINSERT);
443 ri.pRecordOrder = (PRECORDCORE) CMA_END;
444 ri.pRecordParent = (PRECORDCORE) NULL;
445 ri.zOrder = (USHORT) CMA_TOP;
446 ri.cRecordsInsert = 1;
447 ri.fInvalidateRecord = FALSE;
448 if (WinSendMsg(hwndCnr,
449 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
450 if (ullTotalBytes) {
451 dcd->ullTotalBytes += ullTotalBytes;
452 numremain++;
453 }
454 repos = TRUE;
455 if (pci->attrFile & FILE_DIRECTORY) {
456 Stubby(hwndCnr, pci);
457 }
458 }
459 else
460 FreeCnrItem(hwndCnr, pci);
461 }
462 }
463 else if (ffb.attrFile & FILE_DIRECTORY) {
464 /* check all parts and insert as required */
465 CHAR *p, temp;
466 PCNRITEM pciParent = NULL, pciT;
467
468 p = strchr(filename[x], '\\');
469 if (p) {
470 while (p && *p) {
471 if (p < filename[x] + 3)
472 p++;
473 temp = *p;
474 *p = 0;
475 pciT = FindCnrRecord(hwndCnr,
476 filename[x], NULL, partial, FALSE, TRUE);
477 if (!pciT || (INT) pciT == -1) {
478 pci = WinSendMsg(hwndCnr,
479 CM_ALLOCRECORD,
480 MPFROMLONG(EXTRA_RECORD_BYTES),
481 MPFROMLONG(1));
482 if (pci) {
483
484 RECORDINSERT ri;
485 ULONGLONG ullTotalBytes;
486
487 ret = TRUE;
488 *ffb.achName = 0;
489 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
490 pci,
491 filename[x],
492 &ffb, partial, dcd);
493 if (strlen(pci->pszFileName) < 4)
494 SelectDriveIcon(pci);
495 memset(&ri, 0, sizeof(RECORDINSERT));
496 ri.cb = sizeof(RECORDINSERT);
497 ri.pRecordOrder = (PRECORDCORE) CMA_END;
498 ri.pRecordParent = (PRECORDCORE) pciParent;
499 ri.zOrder = (USHORT) CMA_TOP;
500 ri.cRecordsInsert = 1;
501 ri.fInvalidateRecord = FALSE;
502 if (WinSendMsg(hwndCnr,
503 CM_INSERTRECORD,
504 MPFROMP(pci), MPFROMP(&ri))) {
505 if (ullTotalBytes) {
506 numremain++;
507 if (dcd->type == DIR_FRAME)
508 dcd->ullTotalBytes += ullTotalBytes;
509 }
510 repos = TRUE;
511 }
512 else
513 FreeCnrItem(hwndCnr, pci);
514 }
515 }
516 else
517 pciParent = pciT;
518 *p = temp;
519 p = strchr(p + ((temp == '\\') ? 1 : 0), '\\');
520 }
521 }
522 {
523 pci = WinSendMsg(hwndCnr,
524 CM_ALLOCRECORD,
525 MPFROMLONG(EXTRA_RECORD_BYTES),
526 MPFROMLONG(1));
527 if (pci) {
528
529 RECORDINSERT ri;
530 ULONGLONG ullTotalBytes;
531
532 ret = TRUE;
533 *ffb.achName = 0;
534 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
535 pci,
536 filename[x],
537 &ffb, partial, dcd);
538 if (strlen(pci->pszFileName) < 4)
539 SelectDriveIcon(pci);
540 memset(&ri, 0, sizeof(RECORDINSERT));
541 ri.cb = sizeof(RECORDINSERT);
542 ri.pRecordOrder = (PRECORDCORE) CMA_END;
543 ri.pRecordParent = (PRECORDCORE) pciParent;
544 ri.zOrder = (USHORT) CMA_TOP;
545 ri.cRecordsInsert = 1;
546 ri.fInvalidateRecord = FALSE;
547 if (WinSendMsg(hwndCnr,
548 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
549 if (ullTotalBytes) {
550 numremain++;
551 if (dcd->type == DIR_FRAME)
552 dcd->ullTotalBytes += ullTotalBytes;
553 }
554 repos = TRUE;
555 Stubby(hwndCnr, pci);
556 }
557 else
558 FreeCnrItem(hwndCnr, pci);
559 }
560 }
561 }
562 }
563 }
564 else if ((pci = FindCnrRecord(hwndCnr,
565 filename[x],
566 (PCNRITEM) NULL,
567 partial,
568 FALSE,
569 TRUE)) != NULL &&
570 (INT) pci != -1 && !IsRoot(pci->pszFileName)) {
571 /* file doesn't exist; delete record */
572 if (pci->rc.flRecordAttr & CRA_SELECTED)
573 WinSendMsg(hwndCnr,
574 CM_SETRECORDEMPHASIS,
575 MPFROMP(pci), MPFROM2SHORT(FALSE, CRA_SELECTED));
576 if (dcd->type == DIR_FRAME)
577 dcd->ullTotalBytes -= (pci->cbFile + pci->easize);
578 // 02 Aug 07 SHL rc check was wrong
579 if (RemoveCnrItems(hwndCnr, pci, 1,
580 CMA_FREE |
581 numremain == 1 ? CMA_INVALIDATE : 0) != -1) {
582 pci = NULL;
583 numremain--;
584 repos = TRUE;
585 }
586 }
587 } // for x
588 }
589 if (repos || (pciList && numlist)) {
590 QUERYRECORDRECT qrr;
591 RECTL rCnr, rCItem;
592
593 pci = WinSendMsg(hwndCnr,
594 CM_QUERYRECORDEMPHASIS,
595 MPFROMLONG(CMA_FIRST), MPFROMLONG(CRA_CURSORED));
596 if (pci && (INT) pci != -1) {
597 memset(&qrr, 0, sizeof(QUERYRECORDRECT));
598 qrr.cb = sizeof(QUERYRECORDRECT);
599 qrr.pRecord = (PRECORDCORE) pci;
600 qrr.fRightSplitWindow = FALSE;
601 qrr.fsExtent = CMA_TEXT;
602 if (!WinSendMsg(hwndCnr,
603 CM_QUERYRECORDRECT, MPFROMP(&rCItem), MPFROMP(&qrr)))
604 qrr.cb = 0;
605 }
606 if (pciList && numlist && !repos) {
607 WinSendMsg(hwndCnr,
608 CM_INVALIDATERECORD,
609 MPFROMP(pciList),
610 MPFROM2SHORT(numlist,
611 (repos ? CMA_NOREPOSITION :
612 CMA_REPOSITION | CMA_ERASE)));
613 }
614 if (repos)
615 WinSendMsg(hwndCnr,
616 CM_INVALIDATERECORD,
617 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
618 if (pci && (INT) pci != -1 && qrr.cb) {
619 WinSendMsg(hwndCnr,
620 CM_QUERYVIEWPORTRECT,
621 MPFROMP(&rCnr), MPFROM2SHORT(CMA_WINDOW, (SHORT) FALSE));
622 WinSendMsg(hwndCnr,
623 CM_SCROLLWINDOW,
624 MPFROMSHORT(CMA_VERTICAL),
625 MPFROMLONG(rCnr.yTop - rCItem.yTop));
626 }
627 }
628 PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID);
629 if (pciList) {
630 free(pciList);
631 DosPostEventSem(CompactSem);
632 }
633 return ret;
634}
635
636#pragma alloc_text(UPDATECNR,UpdateCnrRecord,UpdateCnrList)
Note: See TracBrowser for help on using the repository browser.