]> git.lyx.org Git - features.git/commitdiff
fix reading of math macros when they occur before any formula
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 24 Jan 2006 11:04:30 +0000 (11:04 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 24 Jan 2006 11:04:30 +0000 (11:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10770 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/math_factory.C
src/mathed/math_macrotemplate.C

index 07e96be67950fcebd8912240d011393ebddb7a7a..85505be24162cd8ddcc90676249c2670954cbb63 100644 (file)
@@ -1,3 +1,11 @@
+2006-01-18  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * math_factory.C (initMath): set initialized to true early to
+       avoid recursive invokation.
+
+       * math_macrotemplate.C (MathMacroTemplate): make sure math
+       structures are initialized.
+
 2006-01-11  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * math_nestinset.C (doDispatch/LFUN_SELFINSERT): when inserting a
index a009c1a550f1ce9d755f2766acd7dc7ff8b44e0b..e0529ad5e4472b630170b38d1d4ca2da9540e671 100644 (file)
@@ -225,9 +225,9 @@ void initMath()
 {
        static bool initialized = false;
        if (!initialized) {
+               initialized = true;
                initParser();
                initSymbols();
-               initialized = true;
        }
 }
 
index d4051c66983e08cc439f47bc5274551c6a11868b..c02ad4c18cd40c4c61a65fb92a8341eaf0022aee 100644 (file)
@@ -36,13 +36,17 @@ using std::endl;
 
 MathMacroTemplate::MathMacroTemplate()
        : MathNestInset(2), numargs_(0), name_(), type_("newcommand")
-{}
+{
+       initMath();
+}
 
 
 MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs,
                string const & type, MathArray const & ar1, MathArray const & ar2)
        : MathNestInset(2), numargs_(numargs), name_(nm), type_(type)
 {
+       initMath();
+
        if (numargs_ > 9)
                lyxerr << "MathMacroTemplate::MathMacroTemplate: wrong # of arguments: "
                        << numargs_ << std::endl;
@@ -54,6 +58,8 @@ MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs,
 MathMacroTemplate::MathMacroTemplate(std::istream & is)
        : MathNestInset(2), numargs_(0), name_()
 {
+       initMath();
+
        MathArray ar;
        mathed_parse_cell(ar, is);
        if (ar.size() != 1 || !ar[0]->asMacroTemplate()) {