]> git.lyx.org Git - features.git/commitdiff
fix bug 2022
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Mon, 12 Sep 2005 14:57:50 +0000 (14:57 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Mon, 12 Sep 2005 14:57:50 +0000 (14:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10439 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetvspace.C
src/insets/insetvspace.h

index 289c6496784f0bc6ec3877f54861220b07a15e04..b1bae44276f6a0fdbc26324f7094abe8b76e8c51 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-12  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
+
+       * insetvspace.C (metrics): include label text
+       * insetvspace.[Ch] (label): new, needed for the above
+
 2005-08-10  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * insetbase.[Ch]: new bool neverIndent() which indicates if
index 8299f1ed08e4a332e96fb1fd641942e710ce63ad..ee6a92792a97d32cd03a3f507d4477b574011286 100644 (file)
@@ -102,10 +102,21 @@ void InsetVSpace::write(Buffer const &, ostream & os) const
 }
 
 
+string const InsetVSpace::label() const
+{
+       static string const label = _("Vertical Space");
+       return label + " (" + space_.asGUIName() + ')';
+}
+
+
+namespace {
+int const arrow_size = 4;
+}
+
+
 void InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        int size = 10;
-       int const arrow_size = 4;
        int const space_size = space_.inPixels(*mi.base.bv);
 
        LyXFont font;
@@ -119,7 +130,12 @@ void InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
 
        dim.asc = size / 2;
        dim.des = size / 2;
-       dim.wid = 10 + 2 * ADD_TO_VSPACE_WIDTH;
+       int w = 0;
+       int a = 0;
+       int d = 0;
+       font.decSize();
+       font_metrics::rectText(label(), font, w, a, d);
+       dim.wid = ADD_TO_VSPACE_WIDTH + 2 * arrow_size + 5 + w;
 
        dim_ = dim;
 }
@@ -127,25 +143,20 @@ void InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
 {
-       static std::string const label = _("Vertical Space");
-
        setPosCache(pi, x, y);
 
        x += ADD_TO_VSPACE_WIDTH;
 
-       int const arrow_size = 4;
        int const start = y - dim_.asc;
        int const end   = y + dim_.des;
 
        // the label to display (if any)
-       string str;
+       string const str = label();
        // y-values for top arrow
        int ty1, ty2;
        // y-values for bottom arrow
        int by1, by2;
 
-       str = label + " (" + space_.asGUIName() + ")";
-
        if (space_.kind() == VSpace::VFILL) {
                ty1 = ty2 = start;
                by1 = by2 = end;
@@ -171,7 +182,7 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
        font.setColor(LColor::added_space);
        font.decSize();
        font.decSize();
-       font_metrics::rectText(str, font, w, a, d);
+       font_metrics::rectText(label(), font, w, a, d);
 
        pi.pain.rectText(x + 2 * arrow_size + 5, y + d,
                       str, font, LColor::none, LColor::none);
index 3fe0caf90c82bacd770d43ff4446f925cd227399..1d63291a61e187d8e66dfd7b10d1fa142491cd25 100644 (file)
@@ -56,6 +56,8 @@ protected:
 
 private:
        virtual std::auto_ptr<InsetBase> doClone() const;
+       ///
+       std::string const label() const;
 
        ///
        VSpace space_;