]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetvspace.C
* BufferParams:
[lyx.git] / src / insets / insetvspace.C
index c03dd4d67141854d641738ba3bec93318ef58130..789b75c585f5be64795cb03464d492cd411bea1d 100644 (file)
@@ -22,6 +22,7 @@
 #include "lyxlex.h"
 #include "lyxtext.h"
 #include "metricsinfo.h"
+#include "outputparams.h"
 
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
@@ -87,7 +88,7 @@ void InsetVSpace::read(Buffer const &, LyXLex & lex)
        BOOST_ASSERT(lex.isOK());
        string vsp;
        lex >> vsp;
-       if (lex)
+       if (lex.isOK())
                space_ = VSpace(vsp);
 
        string end_token;
@@ -107,8 +108,7 @@ void InsetVSpace::write(Buffer const &, ostream & os) const
 docstring const InsetVSpace::label() const
 {
        static docstring const label = _("Vertical Space");
-       // FIXME UNICODE
-       return label + " (" + from_utf8(space_.asGUIName()) + ')';
+       return label + " (" + space_.asGUIName() + ')';
 }
 
 
@@ -117,7 +117,7 @@ int const arrow_size = 4;
 }
 
 
-void InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
+bool InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        int height = 3 * arrow_size;
        if (space_.length().len().value() >= 0.0)
@@ -137,7 +137,9 @@ void InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
        dim.asc = height / 2 + (a - d) / 2; // align cursor with the
        dim.des = height - dim.asc;         // label text
        dim.wid = ADD_TO_VSPACE_WIDTH + 2 * arrow_size + 5 + w;
+       bool const changed = dim_ != dim;
        dim_ = dim;
+       return changed;
 }
 
 
@@ -201,7 +203,7 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
 
 
 int InsetVSpace::latex(Buffer const & buf, odocstream & os,
-                         OutputParams const &) const
+                       OutputParams const &) const
 {
        os << from_ascii(space_.asLatexCommand(buf.params())) << '\n';
        return 1;
@@ -209,15 +211,15 @@ int InsetVSpace::latex(Buffer const & buf, odocstream & os,
 
 
 int InsetVSpace::plaintext(Buffer const &, odocstream & os,
-                          OutputParams const &) const
+                           OutputParams const &) const
 {
        os << "\n\n";
-       return 2;
+       return PLAINTEXT_NEWLINE;
 }
 
 
 int InsetVSpace::docbook(Buffer const &, odocstream & os,
-                        OutputParams const &) const
+                         OutputParams const &) const
 {
        os << '\n';
        return 1;
@@ -255,7 +257,7 @@ void InsetVSpaceMailer::string2params(string const & in, VSpace & vspace)
 
        string vsp;
        lex >> vsp;
-       if (lex)
+       if (lex.isOK())
                vspace = VSpace(vsp);
 }