fix drawing of displayed formula

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7606 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-08-26 11:06:04 +00:00
parent ef2290cf5e
commit f23775f346
2 changed files with 11 additions and 1 deletions

View File

@ -234,7 +234,7 @@ void InsetFormula::draw(PainterInfo & pi, int x, int y) const
//p.pain.rectangle(x, y - a, w, h, LColor::mathframe); //p.pain.rectangle(x, y - a, w, h, LColor::mathframe);
} }
par_->draw(p, x, y); par_->draw(p, x + offset_, y);
} }
xo_ = x; xo_ = x;
@ -287,6 +287,14 @@ void InsetFormula::metrics(MetricsInfo & m, Dimension & dim) const
dim.asc += 1; dim.asc += 1;
dim.des += 1; dim.des += 1;
} }
if (display()) {
offset_ = (m.base.textwidth - dim.wid) / 2;
dim.wid = m.base.textwidth;
} else {
offset_ = 0;
}
dim_ = dim; dim_ = dim;
} }

View File

@ -78,6 +78,8 @@ private:
/// contents /// contents
MathAtom par_; MathAtom par_;
/// x offset for drawing displayed formula
mutable int offset_;
/// Use the Pimpl idiom to hide the internals of the previewer. /// Use the Pimpl idiom to hide the internals of the previewer.
class PreviewImpl; class PreviewImpl;