]> git.lyx.org Git - features.git/commitdiff
Now just use the Inset::updateMacros method.
authorRichard Kimberly Heck <rikiheck@lyx.org>
Thu, 12 Nov 2020 23:07:35 +0000 (18:07 -0500)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Thu, 12 Nov 2020 23:09:56 +0000 (18:09 -0500)
I did all this step by step so (a) I could check the output along
the way and (b) so it will be easier to isolate problems if those
should arise.

src/insets/InsetText.cpp

index 5776e16c4f0381f41095ed9c49a042c2a97835bc..aeb99c07793b54097a3077e320e5c837bd87667c 100644 (file)
@@ -924,48 +924,13 @@ void InsetText::updateMacros(DocIterator const & us, DocIterator const & scope)
        // look for macros in each paragraph
        while (it.pit() <= lastpit) {
                Paragraph & par = it.paragraph();
-
                // iterate over the insets of the current paragraph
                for (auto const & insit : par.insetList()) {
                        it.pos() = insit.pos;
-
-                       if (InsetText * itext = insit.inset->asInsetText()) {
-                               // collect macros in inset
-                               it.push_back(CursorSlice(*insit.inset));
-                               itext->updateMacros(it, ourscope);
-                               it.pop_back();
-                               continue;
-                       }
-
-                       if (InsetTabular * itext = insit.inset->asInsetTabular()) {
-                               it.push_back(CursorSlice(*insit.inset));
-                               itext->updateMacros(it, ourscope);
-                               it.pop_back();
-                               continue;
-                       }
-
-                       // is it an external file?
-                       if (insit.inset->lyxCode() == INCLUDE_CODE) {
-                               insit.inset->updateMacros(it, ourscope);
-                               continue;
-                       }
-
-                       InsetMath * im = insit.inset->asInsetMath();
-                       if (im)  {
-                               InsetMathHull * hull = im->asHullInset();
-                               if (hull)
-                                       hull->updateMacros(it, ourscope);
-                       }
-
-                       if (insit.inset->lyxCode() != MATHMACRO_CODE)
-                               continue;
-
-                       // get macro data
-                       InsetMathMacroTemplate * macroTemplate =
-                               insit.inset->asInsetMath()->asMacroTemplate();
-                       macroTemplate->updateMacros(it, ourscope);
+                       it.push_back(CursorSlice(*insit.inset));
+                       insit.inset->updateMacros(it, ourscope);
+                       it.pop_back();
                }
-
                // next paragraph
                it.pit()++;
                it.pos() = 0;