commit cd1018fa8558976c12b305c1f5274ad55573ed77 Author: Jean-Marc Lasgouttes <lasgout...@lyx.org> Date: Fri May 23 18:32:42 2025 +0200
Fixup 29378af4cdf: rename InsetMath::asMacroXxx to asMacroXxxInset This was forgotten at the time. --- src/Buffer.cpp | 2 +- src/Cursor.cpp | 6 +++--- src/CursorSlice.cpp | 2 +- src/mathed/InsetMath.h | 12 ++++++------ src/mathed/InsetMathHull.cpp | 4 ++-- src/mathed/InsetMathMacro.cpp | 4 ++-- src/mathed/InsetMathMacro.h | 4 ++-- src/mathed/InsetMathMacroTemplate.cpp | 10 +++++----- src/mathed/InsetMathMacroTemplate.h | 4 ++-- src/mathed/InsetMathNest.cpp | 12 ++++++------ src/mathed/MathData.cpp | 18 +++++++++--------- src/mathed/MathExtern.cpp | 2 +- 12 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index dec9f4d635..f1e226aad9 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -3945,7 +3945,7 @@ void Buffer::Impl::updateMacros(DocIterator & it, DocIterator & scope) // get macro data InsetMathMacroTemplate & macroTemplate = - *insit.inset->asInsetMath()->asMacroTemplate(); + *insit.inset->asInsetMath()->asMacroTemplateInset(); MacroContext mc(owner_, it); macroTemplate.updateToContext(mc); diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 1547c53eec..099b6f2a58 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1573,10 +1573,10 @@ void Cursor::niceInsert(MathAtom const & t) asMathData(safe, md); prevMath().cell(idx).insert(0, md); editInsertedInset(); - } else if (t->asMacro() && !safe.empty()) { + } else if (t->asMacroInset() && !safe.empty()) { MathData md(buffer()); asMathData(safe, md); - docstring const name = t->asMacro()->name(); + docstring const name = t->asMacroInset()->name(); MacroData const * data = buffer()->getMacro(name); if (data && data->numargs() - data->optionals() > 0) { plainInsert(MathAtom(new InsetMathBrace(buffer(), md))); @@ -1791,7 +1791,7 @@ bool Cursor::macroModeClose(bool cancel) // try to put argument into macro, if we just inserted a macro bool macroArg = false; - InsetMathMacro * atomAsMacro = atom.nucleus()->asMacro(); + InsetMathMacro * atomAsMacro = atom.nucleus()->asMacroInset(); InsetMathNest * atomAsNest = atom.nucleus()->asNestInset(); if (atomAsMacro) { // macros here are still unfolded (in init mode in fact). So diff --git a/src/CursorSlice.cpp b/src/CursorSlice.cpp index 105df9685b..522e35b7b8 100644 --- a/src/CursorSlice.cpp +++ b/src/CursorSlice.cpp @@ -62,7 +62,7 @@ pos_type CursorSlice::lastpos() const { LBUFERR(inset_); InsetMath const * math = inset_->asInsetMath(); - bool paramless_macro = math && math->asMacro() && !math->asMacro()->nargs(); + bool paramless_macro = math && math->asMacroInset() && !math->asMacroInset()->nargs(); return math ? (paramless_macro ? 0 : cell().size()) : (text()->empty() ? 0 : paragraph().size()); } diff --git a/src/mathed/InsetMath.h b/src/mathed/InsetMath.h index f812bac8e2..7e10264130 100644 --- a/src/mathed/InsetMath.h +++ b/src/mathed/InsetMath.h @@ -156,8 +156,8 @@ public: virtual InsetMathBrace const * asBraceInset() const { return nullptr; } virtual InsetMathChar const * asCharInset() const { return nullptr; } virtual InsetMathClass const * asClassInset() const { return nullptr; } - virtual InsetMathDecoration * asDecorationInset() { return nullptr; } - virtual InsetMathDecoration const * asDecorationInset() const { return nullptr; } + virtual InsetMathDecoration * asDecorationInset() { return nullptr; } + virtual InsetMathDecoration const * asDecorationInset() const { return nullptr; } virtual InsetMathDelim * asDelimInset() { return nullptr; } virtual InsetMathDelim const * asDelimInset() const { return nullptr; } virtual InsetMathFracBase * asFracBaseInset() { return nullptr; } @@ -170,10 +170,10 @@ public: virtual InsetMathGrid const * asGridInset() const { return nullptr; } virtual InsetMathHull * asHullInset() { return nullptr; } virtual InsetMathHull const * asHullInset() const { return nullptr; } - virtual InsetMathMacro * asMacro() { return nullptr; } - virtual InsetMathMacro const * asMacro() const { return nullptr; } - virtual InsetMathMacroTemplate * asMacroTemplate() { return nullptr; } - virtual InsetMathMacroTemplate const * asMacroTemplate() const { return nullptr; } + virtual InsetMathMacro * asMacroInset() { return nullptr; } + virtual InsetMathMacro const * asMacroInset() const { return nullptr; } + virtual InsetMathMacroTemplate * asMacroTemplateInset() { return nullptr; } + virtual InsetMathMacroTemplate const * asMacroTemplateInset() const { return nullptr; } virtual InsetMathMatrix const * asMatrixInset() const { return nullptr; } virtual InsetMathNest * asNestInset() { return nullptr; } virtual InsetMathNest const * asNestInset() const { return nullptr; } diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index e35bd22c61..6cd30c42d3 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -770,8 +770,8 @@ void InsetMathHull::usedMacros(MathData const & md, DocIterator const & pos, MacroNameSet::iterator const end = macros.end(); for (size_t i = 0; i < md.size(); ++i) { - InsetMathMacro const * mi = md[i].nucleus()->asMacro(); - InsetMathMacroTemplate const * mt = md[i].nucleus()->asMacroTemplate(); + InsetMathMacro const * mi = md[i].nucleus()->asMacroInset(); + InsetMathMacroTemplate const * mt = md[i].nucleus()->asMacroTemplateInset(); InsetMathScript const * si = md[i].nucleus()->asScriptInset(); InsetMathFracBase const * fi = md[i].nucleus()->asFracBaseInset(); InsetMathGrid const * gi = md[i].nucleus()->asGridInset(); diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp index 29f0f67c52..b8665e7068 100644 --- a/src/mathed/InsetMathMacro.cpp +++ b/src/mathed/InsetMathMacro.cpp @@ -524,7 +524,7 @@ bool InsetMathMacro::editMode(BufferView const * bv) const { for (; i != cur.depth(); ++i) { InsetMath * im = cur[i].asInsetMath(); if (im) { - InsetMathMacro const * macro = im->asMacro(); + InsetMathMacro const * macro = im->asMacroInset(); if (macro && macro->displayMode() == DISPLAY_NORMAL) return false; } @@ -1244,7 +1244,7 @@ void InsetMathMacro::write(TeXMathStream & os) const braced = cell(i)[0]->asScriptInset()->nuc().empty(); } else { for (size_type j = 0; j < cell(i).size(); ++j) { - InsetMathMacro const * ma = cell(i)[j]->asMacro(); + InsetMathMacro const * ma = cell(i)[j]->asMacroInset(); if (ma && ma->optionals()) { braced = true; break; diff --git a/src/mathed/InsetMathMacro.h b/src/mathed/InsetMathMacro.h index f1da21162a..b630d751d5 100644 --- a/src/mathed/InsetMathMacro.h +++ b/src/mathed/InsetMathMacro.h @@ -31,9 +31,9 @@ public: /// ~InsetMathMacro(); /// - InsetMathMacro * asMacro() override { return this; } + InsetMathMacro * asMacroInset() override { return this; } /// - InsetMathMacro const * asMacro() const override { return this; } + InsetMathMacro const * asMacroInset() const override { return this; } /// marker_type marker(BufferView const *) const override; /// If the macro is in normal edit mode, dissolve its contents in diff --git a/src/mathed/InsetMathMacroTemplate.cpp b/src/mathed/InsetMathMacroTemplate.cpp index 53991977d5..791eb0430d 100644 --- a/src/mathed/InsetMathMacroTemplate.cpp +++ b/src/mathed/InsetMathMacroTemplate.cpp @@ -441,13 +441,13 @@ bool InsetMathMacroTemplate::fromString(docstring const & str) { MathData md(buffer_); mathed_parse_cell(md, str, Parse::NORMAL); - if (md.size() != 1 || !md[0]->asMacroTemplate()) { + if (md.size() != 1 || !md[0]->asMacroTemplateInset()) { lyxerr << "Cannot read macro from '" << md << "'" << endl; asMathData(from_ascii("invalidmacro"), cell(0)); // The macro template does not make sense after this. return false; } - operator=( *(md[0]->asMacroTemplate()) ); + operator=( *(md[0]->asMacroTemplateInset()) ); updateLook(); return true; @@ -845,7 +845,7 @@ void fixMacroInstances(Cursor & cur, DocIterator const & inset_pos, hull = dit; } - InsetMathMacro * macro = insetMath->asMacro(); + InsetMathMacro * macro = insetMath->asMacroInset(); if (macro && macro->name() == name && macro->folded()) { fix(macro); if (RenderPreview::previewMath()) @@ -1175,12 +1175,12 @@ void InsetMathMacroTemplate::read(Lexer & lex) { MathData md(buffer_); mathed_parse_cell(md, lex.getStream(), Parse::TRACKMACRO); - if (md.size() != 1 || !md[0]->asMacroTemplate()) { + if (md.size() != 1 || !md[0]->asMacroTemplateInset()) { lyxerr << "Cannot read macro from '" << md << "'" << endl; lyxerr << "Read: " << to_utf8(asString(md)) << endl; return; } - operator=( *(md[0]->asMacroTemplate()) ); + operator=( *(md[0]->asMacroTemplateInset()) ); updateLook(); } diff --git a/src/mathed/InsetMathMacroTemplate.h b/src/mathed/InsetMathMacroTemplate.h index 31cb1a9fe8..c13a479bbf 100644 --- a/src/mathed/InsetMathMacroTemplate.h +++ b/src/mathed/InsetMathMacroTemplate.h @@ -97,9 +97,9 @@ public: /// void metrics(MetricsInfo & mi, Dimension & dim) const override; /// identifies macro templates - InsetMathMacroTemplate * asMacroTemplate() override { return this; } + InsetMathMacroTemplate * asMacroTemplateInset() override { return this; } /// identifies macro templates - InsetMathMacroTemplate const * asMacroTemplate() const override { return this; } + InsetMathMacroTemplate const * asMacroTemplateInset() const override { return this; } /// InsetCode lyxCode() const override { return MATH_MACROTEMPLATE_CODE; } /// diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 9472a3a22d..d508822d8d 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -847,7 +847,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) buffer().params().authors())); } InsetMath const * im = cur.inset().asInsetMath(); - InsetMathMacro const * macro = im ? im->asMacro() : nullptr; + InsetMathMacro const * macro = im ? im->asMacroInset() : nullptr; // do not allow pasting a backslash in the name of a macro if (macro && macro->displayMode() == InsetMathMacro::DISPLAY_UNFOLDED @@ -1523,7 +1523,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) bool fold = act == LFUN_MATH_MACRO_FOLD; bool found = findMacroToFoldUnfold(it, fold); if (found) { - InsetMathMacro * macro = it.nextInset()->asInsetMath()->asMacro(); + InsetMathMacro * macro = it.nextInset()->asInsetMath()->asMacroInset(); cur.recordUndoInset(); if (fold) macro->fold(cur); @@ -1585,7 +1585,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) break; } case LFUN_INSET_DISSOLVE: - if (cmd.argument().empty() && !asHullInset() && !asMacroTemplate()) { + if (cmd.argument().empty() && !asHullInset() && !asMacroTemplateInset()) { // we have been triggered via the AtPoint mechanism if (cur.nextInset() == this) cur.push(*this); @@ -1654,7 +1654,7 @@ bool InsetMathNest::findMacroToFoldUnfold(Cursor & it, bool fold) const { // go backward through the current cell Inset * inset = it.nextInset(); while (inset && inset->asInsetMath()) { - InsetMathMacro * macro = inset->asInsetMath()->asMacro(); + InsetMathMacro * macro = inset->asInsetMath()->asMacroInset(); if (macro) { // found the an macro to open/close? if (macro->folded() != fold) @@ -1831,7 +1831,7 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd, } case LFUN_INSET_DISSOLVE: - flag.setEnabled(cmd.argument().empty() && !asHullInset() && !asMacroTemplate()); + flag.setEnabled(cmd.argument().empty() && !asHullInset() && !asMacroTemplateInset()); break; case LFUN_PASTE: { @@ -2144,7 +2144,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c) bool reduced = cap::reduceSelectionToOneCell(cur); if (reduced || !cur.selection()) { InsetMath const * im = cur.inset().asInsetMath(); - InsetMathMacro const * macro = im ? im->asMacro() + InsetMathMacro const * macro = im ? im->asMacroInset() : nullptr; bool in_macro_name = macro && macro->displayMode() == diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp index de29fa0d8c..2724c8cd31 100644 --- a/src/mathed/MathData.cpp +++ b/src/mathed/MathData.cpp @@ -480,12 +480,12 @@ void MathData::updateMacros(Cursor * cur, MacroContext const & mc, // If we are editing a macro, we cannot update it immediately, // otherwise wrong undo steps will be recorded (bug 6208). InsetMath const * inmath = cur ? cur->inset().asInsetMath() : 0; - InsetMathMacro const * inmacro = inmath ? inmath->asMacro() : 0; + InsetMathMacro const * inmacro = inmath ? inmath->asMacroInset() : 0; docstring const edited_name = inmacro ? inmacro->name() : docstring(); // go over the data and look for macros for (size_t i = 0; i < size(); ++i) { - InsetMathMacro * macroInset = operator[](i).nucleus()->asMacro(); + InsetMathMacro * macroInset = operator[](i).nucleus()->asMacroInset(); if (!macroInset || macroInset->macroName().empty() || macroInset->macroName()[0] == '^' || macroInset->macroName()[0] == '_' @@ -517,7 +517,7 @@ void MathData::updateMacros(Cursor * cur, MacroContext const & mc, detachMacroParameters(cur, i); // the macro could have been copied while resizing this - macroInset = operator[](i).nucleus()->asMacro(); + macroInset = operator[](i).nucleus()->asMacroInset(); // Cursor in \label? if (newDisplayMode != InsetMathMacro::DISPLAY_UNFOLDED @@ -563,15 +563,15 @@ void MathData::updateMacros(Cursor * cur, MacroContext const & mc, InsetMath * inset = operator[](i).nucleus(); if (inset->asScriptInset()) inset = inset->asScriptInset()->nuc()[0].nucleus(); - LASSERT(inset->asMacro(), continue); - inset->asMacro()->updateRepresentation(cur, mc, utype, nesting + 1); + LASSERT(inset->asMacroInset(), continue); + inset->asMacroInset()->updateRepresentation(cur, mc, utype, nesting + 1); } } void MathData::detachMacroParameters(DocIterator * cur, const size_type macroPos) { - InsetMathMacro * macroInset = operator[](macroPos).nucleus()->asMacro(); + InsetMathMacro * macroInset = operator[](macroPos).nucleus()->asMacroInset(); // We store this now, because the inset pointer will be invalidated in the scond loop below size_t const optionals = macroInset->optionals(); @@ -669,7 +669,7 @@ void MathData::detachMacroParameters(DocIterator * cur, const size_type macroPos MathData const & arg = detachedArgs[j]; if (arg.size() == 1 && !arg[0]->asScriptInset() - && !(arg[0]->asMacro() && arg[0]->asMacro()->arity() > 0)) + && !(arg[0]->asMacroInset() && arg[0]->asMacroInset()->arity() > 0)) insert(p, arg[0]); else insert(p, MathAtom(new InsetMathBrace(buffer_, arg))); @@ -705,7 +705,7 @@ void MathData::attachMacroParameters(Cursor * cur, // Coverity Scan believes that this can happen LATTEST(macroPos != lyx::npos); - InsetMathMacro * macroInset = operator[](macroPos).nucleus()->asMacro(); + InsetMathMacro * macroInset = operator[](macroPos).nucleus()->asMacroInset(); // start at atom behind the macro again, maybe with some new arguments // from the detach phase above, to add them back into the macro inset @@ -753,7 +753,7 @@ void MathData::attachMacroParameters(Cursor * cur, // get pointer to "deep" copied macro inset scriptInset = operator[](macroPos).nucleus()->asScriptInset(); - macroInset = scriptInset->nuc()[0].nucleus()->asMacro(); + macroInset = scriptInset->nuc()[0].nucleus()->asMacroInset(); } // remove them from the MathData diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp index 7834331216..7f05a5a529 100644 --- a/src/mathed/MathExtern.cpp +++ b/src/mathed/MathExtern.cpp @@ -292,7 +292,7 @@ bool testString(MathAtom const & at, char const * const str) bool testSymbol(MathAtom const & at, docstring const & name) { - return (at->asSymbolInset() || at->asMacro()) && at->name() == name; + return (at->asSymbolInset() || at->asMacroInset()) && at->name() == name; } -- lyx-cvs mailing list lyx-cvs@lists.lyx.org https://lists.lyx.org/mailman/listinfo/lyx-cvs