]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathParser.cpp
add busy.gif to resources (in line with cmake)
[lyx.git] / src / mathed / MathParser.cpp
index f86a762be83e865f76c78ca856fc44021f416125..ad52e76105c3a0a0f8038672cdaa3230bf53237f 100644 (file)
@@ -1060,6 +1060,9 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
                        cell->push_back(MathAtom(new MathMacroTemplate(buf,
                                name, nargs, 0, MacroTypeDef,
                                vector<MathData>(), def, display)));
+
+                       if (buf && (mode_ & Parse::TRACKMACRO))
+                               buf->usermacros.insert(name);
                }
                
                else if (t.cs() == "newcommand" ||
@@ -1105,6 +1108,9 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
                        cell->push_back(MathAtom(new MathMacroTemplate(buf,
                                name, nargs, optionals, MacroTypeNewcommand,
                                optionalValues, def, display)));
+
+                       if (buf && (mode_ & Parse::TRACKMACRO))
+                               buf->usermacros.insert(name);
                }
                
                else if (t.cs() == "newcommandx" ||
@@ -1223,6 +1229,9 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
                        cell->push_back(MathAtom(new MathMacroTemplate(buf,
                                name, nargs, optionals, MacroTypeNewcommandx,
                                optionalValues, def, display)));
+
+                       if (buf && (mode_ & Parse::TRACKMACRO))
+                               buf->usermacros.insert(name);
                }
 
                else if (t.cs() == "(") {
@@ -1821,14 +1830,17 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
                }
 
                else if (t.cs().size()) {
-                       latexkeys const * l = in_word_set(t.cs());
-
-                       if (buf && (mode_ & Parse::TRACKMACRO) && l)
-                               buf->updateMacros();
+                       bool const no_mhchem =
+                               (t.cs() == "ce" || t.cs() == "cf")
+                               && buf && buf->params().use_mhchem ==
+                                               BufferParams::package_off;
 
-                       bool const is_user_macro =
-                               (buf && buf->getMacro(t.cs(), false) != 0);
+                       bool const is_user_macro = no_mhchem ||
+                               (buf && (mode_ & Parse::TRACKMACRO
+                                        ? buf->usermacros.count(t.cs()) != 0
+                                        : buf->getMacro(t.cs(), false) != 0));
 
+                       latexkeys const * l = in_word_set(t.cs());
                        if (l && !is_user_macro) {
                                if (l->inset == "big") {
                                        skipSpaces();