From 83309e58af041eb328f7aa387b529ba227af839b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Tue, 22 Feb 2005 13:19:11 +0000 Subject: [PATCH] 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 --- src/insets/ChangeLog | 5 +++++ src/insets/insetcharstyle.C | 13 +++++++++---- src/insets/insettext.C | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index ac3b505e62..409f1c9edc 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2005-02-22 Jürgen Spitzmüller + + * insetcharstyle.C: add TEXT_TO_INSET_OFFSET and adjust metrics. + * insettext.C: adjust metrics + 2005-02-20 Jean-Marc Lasgouttes * insettext.C: include boost/current_function.hpp (needed when diff --git a/src/insets/insetcharstyle.C b/src/insets/insetcharstyle.C index 444f647e92..c9d8ecf515 100644 --- a/src/insets/insetcharstyle.C +++ b/src/insets/insetcharstyle.C @@ -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()); } } diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 0fa0568942..3d8515665d 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -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());