From 4dd07b9d68bd00855fda20d5800e7098dd1f23fc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Thu, 8 Apr 2004 15:20:05 +0000 Subject: [PATCH] fix deco drawing bug. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8633 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_decorationinset.C | 6 +++++- src/mathed/math_dotsinset.C | 15 ++++++++------- src/mathed/math_support.C | 10 +++++++++- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/mathed/math_decorationinset.C b/src/mathed/math_decorationinset.C index e2dfb63bce..ba9ab175c2 100644 --- a/src/mathed/math_decorationinset.C +++ b/src/mathed/math_decorationinset.C @@ -17,6 +17,9 @@ #include "math_parser.h" #include "math_mathmlstream.h" #include "math_streamstr.h" + +#include "debug.h" + #include "support/std_ostream.h" using std::auto_ptr; @@ -107,11 +110,12 @@ void MathDecorationInset::metrics(MetricsInfo & mi, Dimension & dim) const void MathDecorationInset::draw(PainterInfo & pi, int x, int y) const { + lyxerr << "MathDecorationInset::draw: x: " << x << std::endl; cell(0).draw(pi, x + 1, y); if (wide()) mathed_draw_deco(pi, x + 1, y + dy_, cell(0).width(), dh_, key_->name); else - mathed_draw_deco(pi, x + 1 + (pi.width - dw_) / 2, + mathed_draw_deco(pi, x + 1 + (cell(0).width() - dw_) / 2, y + dy_, dw_, dh_, key_->name); drawMarkers(pi, x, y); } diff --git a/src/mathed/math_dotsinset.C b/src/mathed/math_dotsinset.C index c08c31a443..8ab3afe6fe 100644 --- a/src/mathed/math_dotsinset.C +++ b/src/mathed/math_dotsinset.C @@ -34,20 +34,20 @@ auto_ptr MathDotsInset::clone() const void MathDotsInset::metrics(MetricsInfo & mi, Dimension & dim) const { - mathed_char_dim(mi.base.font, 'M', dim_); + mathed_char_dim(mi.base.font, 'M', dim); dh_ = 0; if (key_->name == "cdots" || key_->name == "dotsb" || key_->name == "dotsm" || key_->name == "dotsi") - dh_ = dim_.asc / 2; + dh_ = dim.asc / 2; else if (key_->name == "dotsc") - dh_ = dim_.asc / 4; + dh_ = dim.asc / 4; else if (key_->name == "vdots") { - dim_.wid = (dim_.wid / 2) + 1; - dh_ = dim_.asc; + dim.wid = (dim.wid / 2) + 1; + dh_ = dim.asc; } else if (key_->name == "ddots") - dh_ = dim_.asc; - dim = dim_; + dh_ = dim.asc; + dim_ = dim; } @@ -61,6 +61,7 @@ void MathDotsInset::draw(PainterInfo & pain, int x, int y) const --y; mathed_draw_deco(pain, x + 2, y - dh_, dim_.width() - 2, dim_.ascent(), key_->name); + setPosCache(pain, x, y); } diff --git a/src/mathed/math_support.C b/src/mathed/math_support.C index 29e117df28..f1f979a902 100644 --- a/src/mathed/math_support.C +++ b/src/mathed/math_support.C @@ -458,7 +458,15 @@ void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h, int(x + xx + 0.5), int(y + yy + 0.5), int(x + x2 + 0.5), int(y + y2 + 0.5), LColor::math); - } else { + + lyxerr << "drew line " + << "xx=" << xx << ", yy=" << yy + << ", x2 = " << x2 << ", y2 = " << y2 << '\n' + << int(x + xx + 0.5) << ", " + << int(y + yy + 0.5) << ", " + << int(x + x2 + 0.5) << ", " + << int(y + y2 + 0.5) << std::endl; + } else { int xp[32]; int yp[32]; int const n = int(d[i++]); -- 2.39.2