]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetvspace.C
hopefully fix tex2lyx linking.
[lyx.git] / src / insets / insetvspace.C
index ff23de94694832f50a70ed86999eb41ef2bb6410..64b9441d32d409201898ba4eb753ba3d6aacaada 100644 (file)
@@ -14,7 +14,6 @@
 #include "insetvspace.h"
 
 #include "buffer.h"
-#include "BufferView.h"
 #include "cursor.h"
 #include "dispatchresult.h"
 #include "funcrequest.h"
 #include "lyxtext.h"
 #include "metricsinfo.h"
 
-#include "frontends/font_metrics.h"
+#include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
 #include <sstream>
 
-using lyx::docstring;
+
+namespace lyx {
 
 using std::istringstream;
 using std::ostream;
@@ -67,11 +67,11 @@ void InsetVSpace::doDispatch(LCursor & cur, FuncRequest & cmd)
        switch (cmd.action) {
 
        case LFUN_INSET_MODIFY: {
-               InsetVSpaceMailer::string2params(lyx::to_utf8(cmd.argument()), space_);
+               InsetVSpaceMailer::string2params(to_utf8(cmd.argument()), space_);
                break;
        }
 
-       case LFUN_MOUSE_PRESS:
+       case LFUN_MOUSE_RELEASE:
                InsetVSpaceMailer(*this).showDialog(&cur.bv());
                break;
 
@@ -104,10 +104,9 @@ void InsetVSpace::write(Buffer const &, ostream & os) const
 }
 
 
-string const InsetVSpace::label() const
+docstring const InsetVSpace::label() const
 {
-       // FIXME UNICODE
-       static string const label = lyx::to_utf8(_("Vertical Space"));
+       static docstring const label = _("Vertical Space");
        return label + " (" + space_.asGUIName() + ')';
 }
 
@@ -130,9 +129,7 @@ void InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
        int w = 0;
        int a = 0;
        int d = 0;
-       string lab = label();
-       docstring dlab(lab.begin(), lab.end());
-       font_metrics::rectText(dlab, font, w, a, d);
+       theFontMetrics(font).rectText(label(), w, a, d);
 
        height = max(height, a + d);
 
@@ -182,13 +179,12 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
        font.setColor(LColor::added_space);
        font.decSize();
        font.decSize();
-       string lab = label();
-       docstring dlab(lab.begin(), lab.end());
-       font_metrics::rectText(dlab, font, w, a, d);
+       docstring const lab = label();
+       theFontMetrics(font).rectText(lab, w, a, d);
 
        pi.pain.rectText(x + 2 * arrow_size + 5,
                         start + (end - start) / 2 + (a - d) / 2,
-                        dlab, font, LColor::none, LColor::none);
+                        lab, font, LColor::none, LColor::none);
 
        // top arrow
        pi.pain.line(x, ty1, midx, ty2, LColor::added_space);
@@ -203,15 +199,15 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
 }
 
 
-int InsetVSpace::latex(Buffer const & buf, ostream & os,
+int InsetVSpace::latex(Buffer const & buf, odocstream & os,
                          OutputParams const &) const
 {
-       os << space_.asLatexCommand(buf.params()) << '\n';
+       os << from_ascii(space_.asLatexCommand(buf.params())) << '\n';
        return 1;
 }
 
 
-int InsetVSpace::plaintext(Buffer const &, ostream & os,
+int InsetVSpace::plaintext(Buffer const &, odocstream & os,
                           OutputParams const &) const
 {
        os << "\n\n";
@@ -219,7 +215,7 @@ int InsetVSpace::plaintext(Buffer const &, ostream & os,
 }
 
 
-int InsetVSpace::docbook(Buffer const &, std::ostream & os,
+int InsetVSpace::docbook(Buffer const &, odocstream & os,
                         OutputParams const &) const
 {
        os << '\n';
@@ -269,3 +265,6 @@ string const InsetVSpaceMailer::params2string(VSpace const & vspace)
        data << name_ << ' ' << vspace.asLyXCommand();
        return data.str();
 }
+
+
+} // namespace lyx