]> git.lyx.org Git - features.git/commitdiff
Let tabular-feature commands fall through non-table math insets. (#4189)
authorGuillaume Munch <gm@lyx.org>
Fri, 11 Dec 2015 20:45:57 +0000 (20:45 +0000)
committerGuillaume Munch <gm@lyx.org>
Wed, 27 Jan 2016 17:36:07 +0000 (18:36 +0100)
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathHull.h

index 5b884b4a6259f558a9f7e33046c486ac5258785e..94e9ec4b476269100e8642e84d90bb91095ac49a 100644 (file)
@@ -1040,6 +1040,28 @@ void InsetMathHull::footer_write(WriteStream & os) const
 }
 
 
+bool InsetMathHull::isTable() const
+{
+       switch (type_) {
+       case hullEqnArray:
+       case hullAlign:
+       case hullAlignAt:
+       case hullXAlignAt:
+       case hullXXAlignAt:
+       case hullFlAlign:
+       case hullMultline:
+       case hullGather:
+               return true;
+       case hullNone:
+       case hullSimple:
+       case hullEquation:
+       case hullRegexp:
+               break;
+       }
+       return false;
+}
+
+
 bool InsetMathHull::rowChangeOK() const
 {
        return
@@ -1702,6 +1724,13 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
                break;
        }
 
+       case LFUN_TABULAR_FEATURE:
+               if (!isTable())
+                       cur.undispatched();
+               else
+                       InsetMathGrid::doDispatch(cur, cmd);
+               break;
+
        default:
                InsetMathGrid::doDispatch(cur, cmd);
                break;
@@ -1817,6 +1846,8 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd,
                return InsetMathGrid::getStatus(cur, cmd, status);
 
        case LFUN_TABULAR_FEATURE: {
+               if (!isTable())
+                       return false;
                string s = cmd.getArg(0);
                if (!rowChangeOK()
                    && (s == "append-row"
@@ -1838,16 +1869,6 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd,
                        status.setEnabled(false);
                        return true;
                }
-               if ((type_ == hullSimple
-                 || type_ == hullEquation
-                 || type_ == hullNone) &&
-                   (s == "add-hline-above" || s == "add-hline-below")) {
-                       status.message(bformat(
-                               from_utf8(N_("Can't add horizontal grid lines in '%1$s'")),
-                               hullName(type_)));
-                       status.setEnabled(false);
-                       return true;
-               }
                if (s == "add-vline-left" || s == "add-vline-right") {
                        status.message(bformat(
                                from_utf8(N_("Can't add vertical grid lines in '%1$s'")),
index 9598ad4281d092497f92acbdb7053e8ed72540b5..e02c61971e51f85ed73c20e67c91520857023cfb 100644 (file)
@@ -236,6 +236,8 @@ private:
        ColorCode standardColor() const;
        /// consistency check
        void check() const;
+       /// does it understand tabular-feature commands?
+       bool isTable() const;
        /// can this change its number of rows?
        bool rowChangeOK() const;
        /// can this change its number of cols?