]> git.lyx.org Git - lyx.git/commitdiff
fix #593
authorAndré Pönitz <poenitz@gmx.net>
Wed, 28 Aug 2002 17:59:32 +0000 (17:59 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 28 Aug 2002 17:59:32 +0000 (17:59 +0000)
[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
src/mathed/math_cursor.C
src/mathed/math_cursor.h
src/mathed/math_parser.C
src/mathed/math_scriptinset.C
src/mathed/math_scriptinset.h

index 907863df075f3c1492bb0263b0fba2b91490ab46..d5d69ef12d4dd10ed0007b1f1571520d071d39cb 100644 (file)
@@ -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()) {
index b75e938559739defbfd8e572f5fb3df9688706b6..3752ae051e8b05bf7b8600d37c3b97488d1d2e31 100644 (file)
@@ -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())
index 724a4b567720b83087f92450643b1fe1f23760db..a5518c454c3755620144927334f8be6e2bd357c7 100644 (file)
@@ -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?
index 993ddbd62a4f08ffde72adfade316f8486045ce3..35e205b1bdce721fec92c06b6688efc23b6f8453 100644 (file)
@@ -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;
+                               }
                        }
                }
 
index 8c5a466cadf08e3aba8d291687acadc4f51a3d83..d1ba054d371788d0ace2b0fa03cb59b3344e20ac 100644 (file)
@@ -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);
+}
index b376c7e301305bc31c11f9f23520b45a92584e74..a07cf2e563463cf3ef2ede86650581f327d10ed7 100644 (file)
@@ -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