From 63d5a3c4d4f8b666ab86921dfd3a61e4b59e924b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Thu, 5 Jul 2001 14:48:45 +0000 Subject: [PATCH] Fix for mis-drawing reported by Dekel git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2188 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_decorationinset.C | 25 +++++++++---------------- src/mathed/math_decorationinset.h | 8 +++++--- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/mathed/math_decorationinset.C b/src/mathed/math_decorationinset.C index b1f112cd69..6dc0a649b0 100644 --- a/src/mathed/math_decorationinset.C +++ b/src/mathed/math_decorationinset.C @@ -21,24 +21,12 @@ MathDecorationInset::MathDecorationInset(int d) } -bool MathDecorationInset::GetLimits() const -{ - return deco_ == LM_underbrace || deco_ == LM_overbrace; -} - - MathInset * MathDecorationInset::clone() const { return new MathDecorationInset(*this); } -void MathDecorationInset::draw(Painter & pain, int x, int y) -{ - xcell(0).draw(pain, x, y); - mathed_draw_deco(pain, x, y + 10, width_, 10, deco_); -} - void MathDecorationInset::Metrics(MathStyles st) { @@ -50,14 +38,11 @@ void MathDecorationInset::Metrics(MathStyles st) descent_ = xcell(0).descent(); int w = width() + 4; - if (w < 16) - w = 16; - int dh_ = w / 5; + dh_ = w / 5; if (dh_ > h) dh_ = h; - int dy_; if (upper_) { ascent_ += dh_ + 2; dy_ = -ascent_; @@ -68,6 +53,14 @@ void MathDecorationInset::Metrics(MathStyles st) width_ = w; } +void MathDecorationInset::draw(Painter & pain, int x, int y) +{ + xo(x); + yo(x); + xcell(0).draw(pain, x, y); + mathed_draw_deco(pain, x, y + dy_, width_, dh_, deco_); +} + void MathDecorationInset::Write(ostream & os, bool fragile) const { diff --git a/src/mathed/math_decorationinset.h b/src/mathed/math_decorationinset.h index 6a38d7137c..7e6d44fd38 100644 --- a/src/mathed/math_decorationinset.h +++ b/src/mathed/math_decorationinset.h @@ -16,19 +16,21 @@ public: /// MathDecorationInset(int); /// - MathInset * clone() const; + MathInset * clone() const; /// void draw(Painter &, int, int); /// void Write(std::ostream &, bool fragile) const; /// void Metrics(MathStyles st); - /// - bool GetLimits() const; private: /// int deco_; /// bool upper_; + /// height of deco + int dh_; + /// vertical offset of deco + int dy_; }; #endif -- 2.39.2