RichText: fixed...

git-svn-id: svn://ultimatepp.org/upp/trunk@1528 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-08-24 12:27:23 +00:00
parent 73ed7a4fa5
commit 0c6ebc29e4
3 changed files with 5 additions and 3 deletions

View file

@ -67,7 +67,7 @@ protected:
int length;
String content;
Array<RichObject> object;
LazyUpdate dirty;
mutable LazyUpdate dirty;
int64 updateserial;
mutable int ccx;
mutable int cy;

View file

@ -6,8 +6,8 @@ void RichTxt::Para::Invalidate()
{
INTERLOCKED {
static int64 ss;
dirty.Invalidate();
updateserial = ++ss;
dirty.Invalidate();
ccx = -1;
}
}

View file

@ -24,7 +24,7 @@ void RichTxt::Sync0(const Para& pp, int parti, const RichContext& rc) const
{
int cx = rc.page.Width();
pp.ccx = cx;
RichPara p = Get(parti, rc.styles, true);
RichPara p = Get(parti, rc.styles, false);
RichPara::Lines pl = p.FormatLines(cx);
pp.ruler = p.format.ruler;
pp.before = p.format.before;
@ -44,6 +44,8 @@ inline void RichTxt::Sync(int parti, const RichContext& rc) const {
int cx = rc.page.Width();
ASSERT(part[parti].Is<Para>());
const Para& pp = part[parti].Get<Para>();
if(rc.page.Width() != pp.ccx)
pp.dirty.Invalidate();
if(pp.dirty.BeginUpdate()) {
Sync0(pp, parti, rc);
pp.dirty.EndUpdate();