]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathSymbol.C
Fix comment according to Enricos explanation
[lyx.git] / src / mathed / InsetMathSymbol.C
index 70d747df1d1115ab772d4e7bcf952afe76b2b2cb..1733b4587959dacc1984c321640106d11bd3d9f0 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "InsetMathSymbol.h"
 #include "dimension.h"
-#include "MathMLStream.h"
+#include "MathStream.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "MathParser.h"
@@ -20,7 +20,8 @@
 #include "LaTeXFeatures.h"
 #include "debug.h"
 
-using lyx::docstring;
+
+namespace lyx {
 
 using std::string;
 using std::auto_ptr;
@@ -32,12 +33,12 @@ InsetMathSymbol::InsetMathSymbol(latexkeys const * l)
 
 
 InsetMathSymbol::InsetMathSymbol(char const * name)
-       : sym_(in_word_set(name)), h_(0), width_(0), scriptable_(false)
+       : sym_(in_word_set(from_ascii(name))), h_(0), width_(0), scriptable_(false)
 {}
 
 
-InsetMathSymbol::InsetMathSymbol(string const & name)
-       : sym_(in_word_set(name.c_str())), h_(0), width_(0), scriptable_(false)
+InsetMathSymbol::InsetMathSymbol(docstring const & name)
+       : sym_(in_word_set(name)), h_(0), width_(0), scriptable_(false)
 {}
 
 
@@ -47,7 +48,7 @@ auto_ptr<InsetBase> InsetMathSymbol::doClone() const
 }
 
 
-string InsetMathSymbol::name() const
+docstring InsetMathSymbol::name() const
 {
        return sym_->name;
 }
@@ -61,9 +62,8 @@ void InsetMathSymbol::metrics(MetricsInfo & mi, Dimension & dim) const
        //      << "'" << std::endl;
 
        int const em = mathed_char_width(mi.base.font, 'M');
-       FontSetChanger dummy(mi.base, sym_->inset.c_str());
-       // FIXME UNICODE
-       mathed_string_dim(mi.base.font, lyx::from_utf8(sym_->draw), dim);
+       FontSetChanger dummy(mi.base, sym_->inset);
+       mathed_string_dim(mi.base.font, sym_->draw, dim);
        // correct height for broken cmex and wasy font
 #if defined(__APPLE__) && defined(__GNUC__)
        if (sym_->inset == "cmex") {
@@ -112,7 +112,8 @@ void InsetMathSymbol::draw(PainterInfo & pi, int x, int y) const
 
        FontSetChanger dummy(pi.base, sym_->inset.c_str());
        // FIXME UNICODE
-       pi.draw(x, y - h_, lyx::from_utf8(sym_->draw));
+       docstring n(sym_->draw.begin(), sym_->draw.end());
+       pi.draw(x, y - h_, n);
 }
 
 
@@ -140,7 +141,7 @@ bool InsetMathSymbol::takesLimits() const
 void InsetMathSymbol::validate(LaTeXFeatures & features) const
 {
        if (!sym_->requires.empty())
-               features.require(sym_->requires);
+               features.require(to_utf8(sym_->requires));
 }
 
 
@@ -182,7 +183,7 @@ void InsetMathSymbol::mathematica(MathematicaStream & os) const
 }
 
 
-char const * MathMLtype(string const & s)
+char const * MathMLtype(docstring const & s)
 {
        if (s == "mathop")
                return "mo";
@@ -190,7 +191,7 @@ char const * MathMLtype(string const & s)
 }
 
 
-void InsetMathSymbol::mathmlize(MathMLStream & os) const
+void InsetMathSymbol::mathmlize(MathStream & os) const
 {
        char const * type = MathMLtype(sym_->extra);
        os << '<' << type << "> ";
@@ -218,7 +219,10 @@ void InsetMathSymbol::write(WriteStream & os) const
 }
 
 
-void InsetMathSymbol::infoize2(std::ostream & os) const
+void InsetMathSymbol::infoize2(odocstream & os) const
 {
        os << "Symbol: " << name();
 }
+
+
+} // namespace lyx