fix deco drawing bug.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8633 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2004-04-08 15:20:05 +00:00
parent 2bdaf96dfb
commit 4dd07b9d68
3 changed files with 22 additions and 9 deletions

View File

@ -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);
}

View File

@ -34,20 +34,20 @@ auto_ptr<InsetBase> 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);
}

View File

@ -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++]);