source: trunk/dll/update.c@ 552

Last change on this file since 552 was 552, checked in by Gregg Young, 18 years ago

font cleanup; new image and archiver masks; messages moved to string file; new drive flags including David's icons mostly working

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