adjust insetcollapsable and insetcharstyle metrics (bug 1798, bug 1804)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9665 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2005-02-22 13:19:11 +00:00
parent d4cb992a3c
commit 83309e58af
3 changed files with 15 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2005-02-22 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* insetcharstyle.C: add TEXT_TO_INSET_OFFSET and adjust metrics.
* insettext.C: adjust metrics
2005-02-20 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* insettext.C: include boost/current_function.hpp (needed when

View File

@ -102,8 +102,13 @@ void InsetCharStyle::metrics(MetricsInfo & mi, Dimension & dim) const
{
LyXFont tmpfont = mi.base.font;
getDrawFont(mi.base.font);
mi.base.textwidth -= 2 * TEXT_TO_INSET_OFFSET;
InsetText::metrics(mi, dim);
mi.base.font = tmpfont;
dim.asc += TEXT_TO_INSET_OFFSET;
dim.des += TEXT_TO_INSET_OFFSET;
dim.wid += 2 * TEXT_TO_INSET_OFFSET;
mi.base.textwidth += 2 * TEXT_TO_INSET_OFFSET;
dim_ = dim;
if (has_label_)
dim_.des += ascent();
@ -124,9 +129,9 @@ void InsetCharStyle::draw(PainterInfo & pi, int x, int y) const
desc -= ascent();
pi.pain.line(x, y + desc - 4, x, y + desc, params_.labelfont.color());
pi.pain.line(x, y + desc, x + dim_.wid - 2, y + desc,
pi.pain.line(x, y + desc, x + dim_.wid - 3, y + desc,
params_.labelfont.color());
pi.pain.line(x + dim_.wid - 2, y + desc, x + dim_.wid - 2, y + desc - 4,
pi.pain.line(x + dim_.wid - 3, y + desc, x + dim_.wid - 3, y + desc - 4,
params_.labelfont.color());
// the name of the charstyle. Can be toggled.
@ -149,9 +154,9 @@ void InsetCharStyle::draw(PainterInfo & pi, int x, int y) const
y -= ascent();
pi.pain.line(x, y + 4, x, y, params_.labelfont.color());
pi.pain.line(x + 4, y, x, y, params_.labelfont.color());
pi.pain.line(x + dim_.wid - 2, y + 4, x + dim_.wid - 2, y,
pi.pain.line(x + dim_.wid - 3, y + 4, x + dim_.wid - 3, y,
params_.labelfont.color());
pi.pain.line(x + dim_.wid - 6, y, x + dim_.wid - 2, y,
pi.pain.line(x + dim_.wid - 7, y, x + dim_.wid - 3, y,
params_.labelfont.color());
}
}

View File

@ -213,7 +213,7 @@ void InsetText::drawSelection(PainterInfo & pi, int x, int y) const
void InsetText::drawFrame(Painter & pain, int x, int y) const
{
int const w = text_.width() + border_;
int const w = text_.width() + 2 * border_;
int const a = text_.ascent() + border_;
int const h = a + text_.descent() + border_;
pain.rectangle(x, y - a, w, h, frameColor());