From b6453203d2ff8fe67da1eb731f7bd75f9a54f79a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Wed, 28 Aug 2002 17:59:32 +0000 Subject: [PATCH] fix #593 [There are times when I simply forget thing, Herbert...] git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5143 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/formulabase.C | 7 +------ src/mathed/math_cursor.C | 11 ----------- src/mathed/math_cursor.h | 2 -- src/mathed/math_parser.C | 10 ++++++---- src/mathed/math_scriptinset.C | 13 +++++++++++++ src/mathed/math_scriptinset.h | 2 ++ 6 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 907863df07..d5d69ef12d 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -423,6 +423,7 @@ Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd) case LFUN_MATH_EXTERN: case LFUN_TABULAR_FEATURE: case LFUN_PASTESELECTION: + case LFUN_MATH_LIMITS: bv->lockedInsetStoreUndo(Undo::EDIT); mathcursor->dispatch(cmd); updateLocal(bv, true); @@ -603,12 +604,6 @@ Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd) //bv->owner()->message(_("math text mode toggled")); break; - case LFUN_MATH_LIMITS: - bv->lockedInsetStoreUndo(Undo::EDIT); - if (mathcursor->toggleLimits()) - updateLocal(bv, true); - break; - case LFUN_MATH_SIZE: #if 0 if (!arg.empty()) { diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index b75e938559..3752ae051e 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -526,17 +526,6 @@ bool MathCursor::down(bool sel) } -bool MathCursor::toggleLimits() -{ - if (!hasNextAtom() || !nextAtom()->asScriptInset()) - return false; - MathScriptInset * t = nextAtom().nucleus()->asScriptInset(); - int old = t->limits(); - t->limits(old < 0 ? 1 : -1); - return old != t->limits(); -} - - void MathCursor::macroModeClose() { if (!inMacroMode()) diff --git a/src/mathed/math_cursor.h b/src/mathed/math_cursor.h index 724a4b5677..a5518c454c 100644 --- a/src/mathed/math_cursor.h +++ b/src/mathed/math_cursor.h @@ -127,8 +127,6 @@ public: bool interpret(string const &); /// bool interpret(char); - /// - bool toggleLimits(); /// interpret name a name of a macro void macroModeClose(); /// are we currently typing the name of a macro? diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 993ddbd62a..35e205b1bd 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -550,7 +550,7 @@ void Parser::parse2(MathAtom & at, unsigned flags, mode_type mode, void Parser::parse1(MathGridInset & grid, unsigned flags, mode_type mode, bool numbered) { - int limits = 0; + int limits = 0; MathGridInset::row_type cellrow = 0; MathGridInset::col_type cellcol = 0; MathArray * cell = &grid.cell(grid.index(cellrow, cellcol)); @@ -710,14 +710,16 @@ void Parser::parse1(MathGridInset & grid, unsigned flags, else cell->back() = MathAtom(new MathScriptInset(cell->back(), up)); MathScriptInset * p = cell->back().nucleus()->asScriptInset(); - parse(p->cell(up), FLAG_ITEM, mode); - p->limits(limits); - limits = 0; // special handling of {}-bases // is this always correct? if (p->nuc().size() == 1 && p->nuc().back()->asNestInset() && p->nuc().back()->extraBraces()) p->nuc() = p->nuc().back()->asNestInset()->cell(0); + parse(p->cell(up), FLAG_ITEM, mode); + if (limits) { + p->limits(limits); + limits = 0; + } } } diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index 8c5a466cad..d1ba054d37 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -6,6 +6,7 @@ #include "math_support.h" #include "math_symbolinset.h" #include "math_mathmlstream.h" +#include "funcrequest.h" #include "support/LAssert.h" #include "debug.h" @@ -481,3 +482,15 @@ void MathScriptInset::infoize(std::ostream & os) const if (limits_) os << (limits_ == 1 ? ", Displayed limits" : ", Inlined limits"); } + + +MathInset::result_type MathScriptInset::dispatch + (FuncRequest const & cmd, idx_type & idx, pos_type & pos) +{ + if (cmd.action == LFUN_MATH_LIMITS) { + limits_ = limits_ < 0 ? 1 : -1; + return DISPATCHED; + } + + return MathNestInset::dispatch(cmd, idx, pos); +} diff --git a/src/mathed/math_scriptinset.h b/src/mathed/math_scriptinset.h index b376c7e301..a07cf2e563 100644 --- a/src/mathed/math_scriptinset.h +++ b/src/mathed/math_scriptinset.h @@ -91,6 +91,8 @@ public: void ensure(bool up); /// void infoize(std::ostream & os) const; + /// local dispatcher + result_type dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos); private: /// returns x offset for main part -- 2.39.2