* a MathMacro is like a normal InsetMathNest in folded mode. Hence it should also behave like that concerning completion.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23109 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stefan Schimanski 2008-02-21 19:45:36 +00:00
parent 7794f870f2
commit 4c5c14ff62

View File

@ -725,6 +725,9 @@ void MathMacro::infoize2(odocstream & os) const
bool MathMacro::completionSupported(Cursor const & cur) const bool MathMacro::completionSupported(Cursor const & cur) const
{ {
if (displayMode() != DISPLAY_UNFOLDED)
return InsetMathNest::completionSupported(cur);
return lyxrc.completion_popup_math return lyxrc.completion_popup_math
&& displayMode() == DISPLAY_UNFOLDED && displayMode() == DISPLAY_UNFOLDED
&& cur.bv().cursor().pos() == int(name().size()); && cur.bv().cursor().pos() == int(name().size());
@ -733,6 +736,9 @@ bool MathMacro::completionSupported(Cursor const & cur) const
bool MathMacro::inlineCompletionSupported(Cursor const & cur) const bool MathMacro::inlineCompletionSupported(Cursor const & cur) const
{ {
if (displayMode() != DISPLAY_UNFOLDED)
return InsetMathNest::inlineCompletionSupported(cur);
return lyxrc.completion_inline_math return lyxrc.completion_inline_math
&& displayMode() == DISPLAY_UNFOLDED && displayMode() == DISPLAY_UNFOLDED
&& cur.bv().cursor().pos() == int(name().size()); && cur.bv().cursor().pos() == int(name().size());
@ -741,24 +747,36 @@ bool MathMacro::inlineCompletionSupported(Cursor const & cur) const
bool MathMacro::automaticInlineCompletion() const bool MathMacro::automaticInlineCompletion() const
{ {
if (displayMode() != DISPLAY_UNFOLDED)
return InsetMathNest::automaticInlineCompletion();
return lyxrc.completion_inline_math; return lyxrc.completion_inline_math;
} }
bool MathMacro::automaticPopupCompletion() const bool MathMacro::automaticPopupCompletion() const
{ {
if (displayMode() != DISPLAY_UNFOLDED)
return InsetMathNest::automaticPopupCompletion();
return lyxrc.completion_popup_math; return lyxrc.completion_popup_math;
} }
Inset::CompletionListPtr MathMacro::completionList(Cursor const & cur) const Inset::CompletionListPtr MathMacro::completionList(Cursor const & cur) const
{ {
if (displayMode() != DISPLAY_UNFOLDED)
return InsetMathNest::completionList(cur);
return CompletionListPtr(new MathCompletionList(cur.bv().cursor())); return CompletionListPtr(new MathCompletionList(cur.bv().cursor()));
} }
docstring MathMacro::completionPrefix(Cursor const & cur) const docstring MathMacro::completionPrefix(Cursor const & cur) const
{ {
if (displayMode() != DISPLAY_UNFOLDED)
return InsetMathNest::completionPrefix(cur);
if (!completionSupported(cur)) if (!completionSupported(cur))
return docstring(); return docstring();
@ -769,7 +787,10 @@ docstring MathMacro::completionPrefix(Cursor const & cur) const
bool MathMacro::insertCompletion(Cursor & cur, docstring const & s, bool MathMacro::insertCompletion(Cursor & cur, docstring const & s,
bool finished) bool finished)
{ {
if (completionSupported(cur)) if (displayMode() != DISPLAY_UNFOLDED)
return InsetMathNest::insertCompletion(cur, s, finished);
if (!completionSupported(cur))
return false; return false;
// append completion // append completion
@ -798,6 +819,9 @@ bool MathMacro::insertCompletion(Cursor & cur, docstring const & s,
void MathMacro::completionPosAndDim(Cursor const & cur, int & x, int & y, void MathMacro::completionPosAndDim(Cursor const & cur, int & x, int & y,
Dimension & dim) const Dimension & dim) const
{ {
if (displayMode() != DISPLAY_UNFOLDED)
InsetMathNest::completionPosAndDim(cur, x, y, dim);
// get inset dimensions // get inset dimensions
dim = cur.bv().coordCache().insets().dim(this); dim = cur.bv().coordCache().insets().dim(this);
// FIXME: these 3 are no accurate, but should depend on the font. // FIXME: these 3 are no accurate, but should depend on the font.