]> git.lyx.org Git - features.git/commitdiff
Fix bug #2100: No display equations allowed in a non-fixed width tabular cell.
authorVincent van Ravesteijn <vfr@lyx.org>
Fri, 3 Dec 2010 02:44:16 +0000 (02:44 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Fri, 3 Dec 2010 02:44:16 +0000 (02:44 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36673 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetTabular.cpp
src/mathed/InsetMathHull.cpp

index 73344bd7b7a8f290ba1c6f12c6117d324f7d4343..0a0a9097b383a76bc1ae197eeb04e31defa44522 100644 (file)
@@ -3226,7 +3226,7 @@ bool InsetTableCell::allowParagraphCustomization(idx_type) const
 bool InsetTableCell::getStatus(Cursor & cur, FuncRequest const & cmd,
        FuncStatus & status) const
 {
-       bool enabled;
+       bool enabled = true;
        switch (cmd.action()) {
        case LFUN_LAYOUT:
                enabled = !forcePlainLayout();
@@ -3234,6 +3234,12 @@ bool InsetTableCell::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_LAYOUT_PARAGRAPH:
                enabled = allowParagraphCustomization();
                break;
+
+       case LFUN_MATH_DISPLAY:
+               if (!hasFixedWidth()) {
+                       enabled = false;
+                       break;
+               } //fall-through
        default:
                return InsetText::getStatus(cur, cmd, status);
        }
index 8ff7b230d444cd832e1791972572c0cd0e6d7726..04c5b82c3e0149800fcb05dddde5248b92250e02 100644 (file)
@@ -1480,9 +1480,25 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd,
                return true;
 
        case LFUN_MATH_MUTATE: {
-               HullType ht = hullType(cmd.argument());
+               HullType const ht = hullType(cmd.argument());
                status.setOnOff(type_ == ht);
-               // fall through
+               status.setEnabled(true);
+
+               if (ht != hullSimple) {
+                       Cursor tmpcur = cur;
+                       while (!tmpcur.empty()) {
+                               InsetCode code = tmpcur.inset().lyxCode();
+                               if (code == BOX_CODE) {
+                                       return true;
+                               } else if (code == TABULAR_CODE) {
+                                       FuncRequest tmpcmd(LFUN_MATH_DISPLAY);
+                                       if (tmpcur.getStatus(tmpcmd, status) && !status.enabled())
+                                               return true;
+                               }
+                               tmpcur.pop_back();
+                       }
+               }
+               return true;
        }
        case LFUN_MATH_DISPLAY: {
                bool enable = true;