]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathRef.C
fix reading UTF8 encoded symbol file
[lyx.git] / src / mathed / InsetMathRef.C
index f292cf090dccd244beeddf7a2539c313d1ce0f8a..eb4a14466b06181e121b59d0bbfd0a974abe757a 100644 (file)
@@ -26,8 +26,8 @@
 #include "outputparams.h"
 #include "sgml.h"
 
-using lyx::docstring;
-using lyx::odocstream;
+
+namespace lyx {
 
 using std::string;
 using std::auto_ptr;
@@ -35,11 +35,11 @@ using std::endl;
 
 
 RefInset::RefInset()
-       : CommandInset("ref")
+       : CommandInset(from_ascii("ref"))
 {}
 
 
-RefInset::RefInset(string const & data)
+RefInset::RefInset(docstring const & data)
        : CommandInset(data)
 {}
 
@@ -50,7 +50,7 @@ auto_ptr<InsetBase> RefInset::doClone() const
 }
 
 
-void RefInset::infoize(std::ostream & os) const
+void RefInset::infoize(odocstream & os) const
 {
        os << "Ref: " << cell(0);
 }
@@ -62,7 +62,7 @@ void RefInset::doDispatch(LCursor & cur, FuncRequest & cmd)
        case LFUN_INSET_MODIFY:
                if (cmd.getArg(0) == "ref") {
                        MathArray ar;
-                       if (createInsetMath_fromDialogStr(lyx::to_utf8(cmd.argument()), ar)) {
+                       if (createInsetMath_fromDialogStr(cmd.argument(), ar)) {
                                *this = *ar[0].nucleus()->asRefInset();
                                break;
                        }
@@ -78,7 +78,7 @@ void RefInset::doDispatch(LCursor & cur, FuncRequest & cmd)
 
        case LFUN_MOUSE_RELEASE:
                if (cmd.button() == mouse_button::button3) {
-                       lyxerr << "trying to goto ref '" << asString(cell(0)) << "'" << endl;
+                       lyxerr << "trying to goto ref '" << to_utf8(asString(cell(0))) << "'" << endl;
                        cur.bv().dispatch(FuncRequest(LFUN_LABEL_GOTO, asString(cell(0))));
                        break;
                }
@@ -124,13 +124,13 @@ bool RefInset::getStatus(LCursor & cur, FuncRequest const & cmd,
 docstring const RefInset::screenLabel() const
 {
        docstring str;
-       for (int i = 0; !types[i].latex_name.empty(); ++i)
+       for (int i = 0; !types[i].latex_name.empty(); ++i) {
                if (commandname() == types[i].latex_name) {
-                       str = _(types[i].short_gui_name);
+                       str = _(to_utf8(types[i].short_gui_name));
                        break;
                }
-       // FIXME UNICODE
-       str += lyx::from_utf8(asString(cell(0)));
+       }
+       str += asString(cell(0));
 
        //if (/* !isLatex && */ !cell(0).empty()) {
        //      str += "||";
@@ -149,31 +149,30 @@ void RefInset::validate(LaTeXFeatures & features) const
 }
 
 
-int RefInset::plaintext(lyx::odocstream & os, OutputParams const &) const
+int RefInset::plaintext(odocstream & os, OutputParams const &) const
 {
        // FIXME UNICODE
-       os << '[' << lyx::from_utf8(asString(cell(0))) << ']';
+       os << '[' << asString(cell(0)) << ']';
        return 0;
 }
 
 
-int RefInset::docbook(Buffer const & buf, odocstream & os, OutputParams const & runparams) const
+int RefInset::docbook(Buffer const & buf, odocstream & os,
+               OutputParams const & runparams) const
 {
        if (cell(1).empty()) {
-                // FIXME UNICODE
                os << "<xref linkend=\""
-                   << lyx::from_ascii(sgml::cleanID(buf, runparams, asString(cell(0))));
+                  << sgml::cleanID(buf, runparams, asString(cell(0)));
                if (runparams.flavor == OutputParams::XML)
                        os << "\"/>";
                else
                        os << "\">";
        } else {
-                // FIXME UNICODE
                os << "<link linkend=\""
-                   << lyx::from_ascii(sgml::cleanID(buf, runparams, asString(cell(0))))
+                  << sgml::cleanID(buf, runparams, asString(cell(0)))
                   << "\">"
-                   << lyx::from_ascii(asString(cell(1)))
-                   << "</link>";
+                  << asString(cell(1))
+                  << "</link>";
        }
 
        return 0;
@@ -181,11 +180,14 @@ int RefInset::docbook(Buffer const & buf, odocstream & os, OutputParams const &
 
 
 RefInset::ref_type_info RefInset::types[] = {
-       { "ref",       N_("Standard"),              N_("Ref: ")},
-       { "eqref",     N_("Equation"),              N_("EqRef: ")},
-       { "pageref",   N_("Page Number"),           N_("Page: ")},
-       { "vpageref",  N_("Textual Page Number"),   N_("TextPage: ")},
-       { "vref",      N_("Standard+Textual Page"), N_("Ref+Text: ")},
-       { "prettyref", N_("PrettyRef"),             N_("PrettyRef: ")},
-       { "", "", "" }
+       { from_ascii("ref"),       from_ascii(N_("Standard")),              from_ascii(N_("Ref: "))},
+       { from_ascii("eqref"),     from_ascii(N_("Equation")),              from_ascii(N_("EqRef: "))},
+       { from_ascii("pageref"),   from_ascii(N_("Page Number")),           from_ascii(N_("Page: "))},
+       { from_ascii("vpageref"),  from_ascii(N_("Textual Page Number")),   from_ascii(N_("TextPage: "))},
+       { from_ascii("vref"),      from_ascii(N_("Standard+Textual Page")), from_ascii(N_("Ref+Text: "))},
+       { from_ascii("prettyref"), from_ascii(N_("PrettyRef")),             from_ascii(N_("PrettyRef: "))},
+       { from_ascii(""), from_ascii(""), from_ascii("") }
 };
+
+
+} // namespace lyx