Backport r38613 for branch, fixing #7532.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@38615 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2011-05-07 16:45:45 +00:00
parent 52aed2f480
commit 8f7c852b0f
6 changed files with 13 additions and 7 deletions

View File

@ -530,7 +530,7 @@ public:
/// Collect macro definitions in paragraphs
void updateMacros() const;
/// Iterate through the whole buffer and try to resolve macros
void updateMacroInstances() const;
void updateMacroInstances(UpdateType) const;
/// List macro names of this buffer, the parent and the children
void listMacroNames(MacroNameSet & macros) const;

View File

@ -252,7 +252,7 @@ void MathData::metrics(MetricsInfo & mi, Dimension & dim) const
}
Cursor & cur = mi.base.bv->cursor();
const_cast<MathData*>(this)->updateMacros(&cur, mi.macrocontext);
const_cast<MathData*>(this)->updateMacros(&cur, mi.macrocontext, InternalUpdate);
DocIterator const & inlineCompletionPos = mi.base.bv->inlineCompletionPos();
MathData const * inlineCompletionData = 0;
@ -387,7 +387,8 @@ void MathData::updateBuffer(ParIterator const & it, UpdateType utype)
}
void MathData::updateMacros(Cursor * cur, MacroContext const & mc)
void MathData::updateMacros(Cursor * cur, MacroContext const & mc,
UpdateType utype)
{
// If we are editing a macro, we cannot update it immediately,
// otherwise wrong undo steps will be recorded (bug 6208).
@ -484,7 +485,7 @@ void MathData::updateMacros(Cursor * cur, MacroContext const & mc)
if (inset->asScriptInset())
inset = inset->asScriptInset()->nuc()[0].nucleus();
LASSERT(inset->asMacro(), /**/);
inset->asMacro()->updateRepresentation();
inset->asMacro()->updateRepresentation(cur, mc, utype);
}
}

View File

@ -167,7 +167,7 @@ public:
/// attach/detach arguments to macros, updating the cur to
/// stay visually at the same position (cur==0 is allowed)
void updateMacros(Cursor * cur, MacroContext const & mc);
void updateMacros(Cursor * cur, MacroContext const & mc, UpdateType);
///
void updateBuffer(ParIterator const &, UpdateType);

View File

@ -311,7 +311,8 @@ void MathMacro::updateMacro(MacroContext const & mc)
}
void MathMacro::updateRepresentation()
void MathMacro::updateRepresentation(Cursor * cur, MacroContext const & mc,
UpdateType utype)
{
// known macro?
if (macro_ == 0)
@ -342,6 +343,8 @@ void MathMacro::updateRepresentation()
}
// expanding macro with the values
macro_->expand(values, expanded_.cell(0));
if (utype == OutputUpdate && !expanded_.cell(0).empty())
expanded_.cell(0).updateMacros(cur, mc, utype);
// get definition for list edit mode
docstring const & display = macro_->display();
asArray(display.empty() ? macro_->definition() : display, definition_);

View File

@ -139,7 +139,7 @@ protected:
/// update macro definition
void updateMacro(MacroContext const & mc);
/// check if macro definition changed, argument changed etc. and adapt
void updateRepresentation();
void updateRepresentation(Cursor * cur, MacroContext const & mc, UpdateType);
/// empty macro, put arguments into args, possibly strip arity-attachedArgsNum_ empty ones.
/// Includes the optional arguments.
void detachArguments(std::vector<MathData> & args, bool strip);

View File

@ -28,6 +28,8 @@ What's new
except on Windows, where 30 minutes are allowed. This is because the Windows
installer may trigger MiKTeX updates that suffer from network latencies.
- Macros that use other macros now output properly to XHTML (bug 7532).
* USER INTERFACE