commit 8656c58312c6751578c64c134579848174fdb202
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Mon Apr 14 13:46:36 2025 +0200

    MATHMACRO_CODE => MATH_MACROTEMPLATE_CODE
    
    It was difficult in the code to differentiate MATHMACRO_CODE (macro
    template inset) from MATH_MACRO_CODE (macro inset).
    
    As an additional bonus, they do not share the "mathmacro" inset name 
anymore.
---
 src/Buffer.cpp                        | 2 +-
 src/Text.cpp                          | 2 +-
 src/TextMetrics.cpp                   | 2 +-
 src/insets/Inset.cpp                  | 2 +-
 src/insets/InsetCaption.cpp           | 2 +-
 src/insets/InsetCode.h                | 2 +-
 src/insets/InsetScript.cpp            | 2 +-
 src/insets/InsetTabular.cpp           | 4 ++--
 src/mathed/InsetMathMacroTemplate.cpp | 2 +-
 src/mathed/InsetMathMacroTemplate.h   | 2 +-
 src/mathed/MacroTable.cpp             | 4 ++--
 11 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index b2cf8ae3fb..a774b694ff 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -3936,7 +3936,7 @@ void Buffer::Impl::updateMacros(DocIterator & it, 
DocIterator & scope)
                                        hull->recordLocation(it);
                        }
 
-                       if (insit.inset->lyxCode() != MATHMACRO_CODE)
+                       if (im->asMacroTemplate())
                                continue;
 
                        // get macro data
diff --git a/src/Text.cpp b/src/Text.cpp
index c5446c55a1..3895837be6 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -6718,7 +6718,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & 
cmd,
                break;
 
        case LFUN_MATH_MACRO:
-               code = MATHMACRO_CODE;
+               code = MATH_MACROTEMPLATE_CODE;
                break;
 
        case LFUN_REGEXP_MODE:
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 67229c6cf3..3c9233c61d 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -535,7 +535,7 @@ bool TextMetrics::redoParagraph(pit_type const pit, bool 
const align_rows)
                        // by itself. But the tex macro semantics allow
                        // recursion, so we artifically take the context
                        // after the macro template to simulate this.
-                       if (e.inset->lyxCode() == MATHMACRO_CODE)
+                       if (e.inset->lyxCode() == MATH_MACROTEMPLATE_CODE)
                                parPos.pos()++;
                }
 
diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp
index f55c3e65d7..86252c38dc 100644
--- a/src/insets/Inset.cpp
+++ b/src/insets/Inset.cpp
@@ -105,7 +105,7 @@ static void build_translator()
        insetnames[TABULAR_CODE] = InsetName("tabular", _("Table"));
        insetnames[EXTERNAL_CODE] = InsetName("external");
        insetnames[CAPTION_CODE] = InsetName("caption");
-       insetnames[MATHMACRO_CODE] = InsetName("mathmacro");
+       insetnames[MATH_MACROTEMPLATE_CODE] = InsetName("mathmacrotemplate");
        insetnames[CITE_CODE] = InsetName("citation");
        insetnames[FLOAT_LIST_CODE] = InsetName("floatlist");
        insetnames[INDEX_PRINT_CODE] = InsetName("index_print");
diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp
index e1ace0dc92..b375e144bc 100644
--- a/src/insets/InsetCaption.cpp
+++ b/src/insets/InsetCaption.cpp
@@ -193,7 +193,7 @@ bool InsetCaption::insetAllowed(InsetCode code) const
        case FOOT_CODE:
        case NEWPAGE_CODE:
        case MARGIN_CODE:
-       case MATHMACRO_CODE:
+       case MATH_MACROTEMPLATE_CODE:
        case TABULAR_CODE:
        case WRAP_CODE:
                return false;
diff --git a/src/insets/InsetCode.h b/src/insets/InsetCode.h
index a3d3e8f671..6082e76395 100644
--- a/src/insets/InsetCode.h
+++ b/src/insets/InsetCode.h
@@ -75,7 +75,7 @@ enum InsetCode {
        ///
        CAPTION_CODE,
        ///
-       MATHMACRO_CODE,
+       MATH_MACROTEMPLATE_CODE,
        ///
        CITE_CODE,
        ///
diff --git a/src/insets/InsetScript.cpp b/src/insets/InsetScript.cpp
index 759445db73..d0a57677f3 100644
--- a/src/insets/InsetScript.cpp
+++ b/src/insets/InsetScript.cpp
@@ -236,7 +236,7 @@ bool InsetScript::insetAllowed(InsetCode code) const
        case LISTINGS_CODE:
        case MARGIN_CODE:
        case MATH_MACRO_CODE:
-       case MATHMACRO_CODE:
+       case MATH_MACROTEMPLATE_CODE:
        case NEWLINE_CODE:
        case NEWPAGE_CODE:
        case NOMENCL_PRINT_CODE:
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 87a79ba200..e379bffd97 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -4973,7 +4973,7 @@ bool InsetTableCell::insetAllowed(InsetCode code) const
        switch (code) {
        case FLOAT_CODE:
        case MARGIN_CODE:
-       case MATHMACRO_CODE:
+       case MATH_MACROTEMPLATE_CODE:
        case WRAP_CODE:
                return false;
 
@@ -5025,7 +5025,7 @@ bool InsetTabular::insetAllowed(InsetCode code) const
        switch (code) {
        case FLOAT_CODE:
        case MARGIN_CODE:
-       case MATHMACRO_CODE:
+       case MATH_MACROTEMPLATE_CODE:
        case WRAP_CODE:
                return false;
 
diff --git a/src/mathed/InsetMathMacroTemplate.cpp 
b/src/mathed/InsetMathMacroTemplate.cpp
index 1bb4ba1814..1be92d299d 100644
--- a/src/mathed/InsetMathMacroTemplate.cpp
+++ b/src/mathed/InsetMathMacroTemplate.cpp
@@ -824,7 +824,7 @@ void fixMacroInstances(Cursor & cur, DocIterator const & 
inset_pos,
                }
 
                // only until a macro is redefined
-               if (dit.inset().lyxCode() == MATHMACRO_CODE) {
+               if (dit.inset().lyxCode() == MATH_MACROTEMPLATE_CODE) {
                        InsetMathMacroTemplate const & macroTemplate
                        = static_cast<InsetMathMacroTemplate const 
&>(dit.inset());
                        if (macroTemplate.name() == name)
diff --git a/src/mathed/InsetMathMacroTemplate.h 
b/src/mathed/InsetMathMacroTemplate.h
index ba17a91742..31cb1a9fe8 100644
--- a/src/mathed/InsetMathMacroTemplate.h
+++ b/src/mathed/InsetMathMacroTemplate.h
@@ -101,7 +101,7 @@ public:
        /// identifies macro templates
        InsetMathMacroTemplate const * asMacroTemplate() const override { 
return this; }
        ///
-       InsetCode lyxCode() const override { return MATHMACRO_CODE; }
+       InsetCode lyxCode() const override { return MATH_MACROTEMPLATE_CODE; }
        ///
        void infoize(odocstream & os) const override;
        ///
diff --git a/src/mathed/MacroTable.cpp b/src/mathed/MacroTable.cpp
index 56f36a4595..bf12af82db 100644
--- a/src/mathed/MacroTable.cpp
+++ b/src/mathed/MacroTable.cpp
@@ -171,7 +171,7 @@ void MacroData::updateData() const
 
        // find macro template
        Inset * inset = pos_.nextInset();
-       if (inset == 0 || inset->lyxCode() != MATHMACRO_CODE) {
+       if (inset == 0 || inset->lyxCode() != MATH_MACROTEMPLATE_CODE) {
                lyxerr << "BUG: No macro template found by MacroData" << endl;
                return;
        }
@@ -187,7 +187,7 @@ int MacroData::write(odocstream & os, bool 
overwriteRedefinition) const
 
        // find macro template
        Inset * inset = pos_.nextInset();
-       if (inset == 0 || inset->lyxCode() != MATHMACRO_CODE) {
+       if (inset == 0 || inset->lyxCode() != MATH_MACROTEMPLATE_CODE) {
                lyxerr << "BUG: No macro template found by MacroData" << endl;
                return 0;
        }
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to