]> git.lyx.org Git - features.git/commitdiff
adjust insetcollapsable and insetcharstyle metrics (bug 1798, bug 1804)
authorJürgen Spitzmüller <spitz@lyx.org>
Tue, 22 Feb 2005 13:19:11 +0000 (13:19 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Tue, 22 Feb 2005 13:19:11 +0000 (13:19 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9665 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetcharstyle.C
src/insets/insettext.C

index ac3b505e62220fcf3cd9042d737d653defd88d6e..409f1c9edc7f164c0575fa3e3f9e323711e6b4c2 100644 (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
index 444f647e9245afd76e877877299a9f6eab2cfcee..c9d8ecf515ec73779455b4575a78785488e3a198 100644 (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());
        }
 }
index 0fa0568942071d8051cba650fee027ca53e8c476..3d8515665d7d356333a2ef3020b4ab225e96a0a1 100644 (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());