]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathFactory.cpp
Simplify Changers interface
[lyx.git] / src / mathed / MathFactory.cpp
index 0814167612e3c110fdd76cd1ec84e4ba42fa9bef..f00093746f8ca73f37b3ac80d9cc4cff473cb690 100644 (file)
@@ -19,6 +19,7 @@
 #include "InsetMathCancel.h"
 #include "InsetMathCancelto.h"
 #include "InsetMathCases.h"
+#include "InsetMathClass.h"
 #include "InsetMathColor.h"
 #include "InsetMathDecoration.h"
 #include "InsetMathDots.h"
@@ -387,7 +388,7 @@ bool ensureMath(WriteStream & os, bool needs_mathmode, bool macro,
                        brace = true;
                }
                os.textMode(true);
-       } else if (macro && brace && !textmode_macro) {
+       } else if (macro && brace && !needs_mathmode && !textmode_macro) {
                // This is a user defined macro, not a MathMacro, so we
                // cannot be sure what mode is needed. We leave it in the
                // same environment it was entered by closing either \lyxmathsym
@@ -662,10 +663,13 @@ MathAtom createInsetMath(docstring const & s, Buffer * buf)
                return MathAtom(new InsetMathSpecialChar(s));
        if (s == " ")
                return MathAtom(new InsetMathSpace(" ", ""));
-
        if (s == "regexp")
                return MathAtom(new InsetMathHull(buf, hullRegexp));
 
+       MathClass const mc = string_to_class(s);
+       if (mc != MC_UNKNOWN)
+               return MathAtom(new InsetMathClass(buf, mc));
+
        return MathAtom(new MathMacro(buf, s));
 }
 
@@ -689,7 +693,7 @@ bool createInsetMath_fromDialogStr(docstring const & str, MathData & ar)
                InsetSpace::string2params(to_utf8(str), isp);
                InsetSpace is(isp);
                odocstringstream ods;
-               otexstream os(ods, false);
+               otexstream os(ods);
                Encoding const * const ascii = encodings.fromLyXName("ascii");
                OutputParams op(ascii);
                is.latex(os, op);