]> git.lyx.org Git - features.git/commitdiff
Fix bug 2789 (as discussed)
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sat, 30 Sep 2006 17:17:31 +0000 (17:17 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sat, 30 Sep 2006 17:17:31 +0000 (17:17 +0000)
* src/mathed/InsetMathHull.C
(InsetMathHull::doDispatch): move code for ref insert to InsetMathNest
(InsetMathHull::getStatus): move code for ref insert to InsetMathNest

* src/mathed/InsetMathNest.C
(InsetMathNest::doDispatch): move code from InsetMathHull here
(InsetMathNest::getStatus): move code from InsetMathHull here

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

src/mathed/InsetMathHull.C
src/mathed/InsetMathNest.C

index ebc5f8972c499cc2fd4fe298047c7cccad78ceba..cdcaa57a23c89db9cb4ea96820d51197501e1420 100644 (file)
@@ -1105,13 +1105,8 @@ void InsetMathHull::doDispatch(LCursor & cur, FuncRequest & cmd)
                        }
                        break;
                }
-               MathArray ar;
-               if (createInsetMath_fromDialogStr(lyx::to_utf8(cmd.argument()), ar)) {
-                       recordUndo(cur);
-                       cur.insert(ar);
-               } else
-                       cur.undispatched();
-               break;
+               InsetMathGrid::doDispatch(cur, cmd);
+               return;
        }
 
        case LFUN_MATH_EXTERN:
@@ -1173,15 +1168,12 @@ bool InsetMathHull::getStatus(LCursor & cur, FuncRequest const & cmd,
        case LFUN_LABEL_INSERT:
                status.enabled(type_ != hullSimple);
                return true;
-       case LFUN_INSET_INSERT: {
-               // Don't test createInsetMath_fromDialogStr(), since
-               // getStatus is not called with a valid reference and the
-               // dialog would not be applyable.
-               string const name = cmd.getArg(0);
-               status.enabled(name == "ref" ||
-                              (name == "label" && type_ != hullSimple));
-               break;
-       }
+       case LFUN_INSET_INSERT:
+               if (cmd.getArg(0) == "label") {
+                       status.enabled(type_ != hullSimple);
+                       return true;
+               }
+               return InsetMathGrid::getStatus(cur, cmd, status);
        case LFUN_TABULAR_FEATURE: {
                istringstream is(lyx::to_utf8(cmd.argument()));
                string s;
index c357c94a7a96c67970a2cff372112162b44228fb..1a0bbb8d2beaf4768b37333063191799ca5bad3e 100644 (file)
@@ -945,6 +945,16 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
                break;
        }
 
+       case LFUN_INSET_INSERT: {
+               MathArray ar;
+               if (createInsetMath_fromDialogStr(lyx::to_utf8(cmd.argument()), ar)) {
+                       recordUndo(cur);
+                       cur.insert(ar);
+               } else
+                       cur.undispatched();
+               break;
+       }
+
        default:
                InsetMathDim::doDispatch(cur, cmd);
                break;
@@ -1029,6 +1039,15 @@ bool InsetMathNest::getStatus(LCursor & cur, FuncRequest const & cmd,
                flag.enabled(currentMode() == MATH_MODE);
                break;
 
+       case LFUN_INSET_INSERT: {
+               // Don't test createMathInset_fromDialogStr(), since
+               // getStatus is not called with a valid reference and the
+               // dialog would not be applyable.
+               string const name = cmd.getArg(0);
+               flag.enabled(name == "ref");
+               break;
+       }
+
        case LFUN_MATH_DELIM:
        case LFUN_MATH_BIGDELIM:
                // Don't do this with multi-cell selections