]> git.lyx.org Git - lyx.git/commitdiff
* InsetMathScript::doDispatch : properly record undo information before
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 2 Feb 2012 13:39:05 +0000 (13:39 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 2 Feb 2012 13:39:05 +0000 (13:39 +0000)
changing limits status (fixes bug #8007)
* InsetMathScript::getStatus (new) : handle properly status for LFUN_MATH_LIMITS here, along with checkmark support for the menu)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40700 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathNest.cpp
src/mathed/InsetMathScript.cpp
src/mathed/InsetMathScript.h

index affe7918c69b749479e38cf7e3af9b1a3862a974..bd702464c35da390883f52609dc66f36c97deb08 100644 (file)
@@ -1368,7 +1368,6 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd,
        // we just need to be in math mode to enable that
        case LFUN_MATH_SIZE:
        case LFUN_MATH_SPACE:
-       case LFUN_MATH_LIMITS:
        case LFUN_MATH_EXTERN:
                flag.setEnabled(true);
                break;
index ed06d363d651a8650d9059107aafd16a7815b3cc..a9f4b38bd19c55ab384a2986378bb6c7255e93e6 100644 (file)
@@ -14,6 +14,7 @@
 #include "Cursor.h"
 #include "DispatchResult.h"
 #include "FuncRequest.h"
+#include "FuncStatus.h"
 #include "InsetMathFont.h"
 #include "InsetMathScript.h"
 #include "InsetMathSymbol.h"
@@ -754,6 +755,7 @@ void InsetMathScript::doDispatch(Cursor & cur, FuncRequest & cmd)
        //LYXERR("InsetMathScript: request: " << cmd);
 
        if (cmd.action() == LFUN_MATH_LIMITS) {
+               cur.recordUndoInset();
                if (!cmd.argument().empty()) {
                        if (cmd.argument() == "limits")
                                limits_ = 1;
@@ -772,6 +774,26 @@ void InsetMathScript::doDispatch(Cursor & cur, FuncRequest & cmd)
 }
 
 
+bool InsetMathScript::getStatus(Cursor & cur, FuncRequest const & cmd,
+                               FuncStatus & flag) const
+{
+       if (cmd.action() == LFUN_MATH_LIMITS) {
+               if (!cmd.argument().empty()) {
+                       if (cmd.argument() == "limits")
+                               flag.setOnOff(limits_ == 1);
+                       else if (cmd.argument() == "nolimits")
+                               flag.setOnOff(limits_ == -1);
+                       else
+                               flag.setOnOff(limits_ == 0);
+               } 
+               flag.setEnabled(true);
+               return true;
+       }
+
+       return InsetMathNest::getStatus(cur, cmd, flag);
+}
+
+
 // the idea for dual scripts came from the eLyXer code
 void InsetMathScript::validate(LaTeXFeatures & features) const
 {
index ecdda3b5a71e9262b335133e1a88cf282aece5e7..e84886b7d3bf922a8d42cae1e0beff345cc5de53 100644 (file)
@@ -110,6 +110,9 @@ public:
        void validate(LaTeXFeatures &features) const;
 protected:
        virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
+       /// do we want to handle this event?
+       bool getStatus(Cursor & cur, FuncRequest const & cmd,
+               FuncStatus & status) const;
 private:
        virtual Inset * clone() const;
        /// returns x offset for main part