]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathSplit.cpp
Fix bug #8782.
[lyx.git] / src / mathed / InsetMathSplit.cpp
index 2adb84522b40392ec63b6257572a0df1ee59419c..515dcb04591f6490a95d962c029ea9ffbf9cdbd5 100644 (file)
@@ -48,20 +48,56 @@ Inset * InsetMathSplit::clone() const
 }
 
 
+// FIXME: InsetMathGrid should be changed to let the real column alignment be
+// given by a virtual method like displayColAlign, because the values produced
+// by defaultColAlign can be invalidated by lfuns such as add-column. I suspect
+// that for the moment the values produced by defaultColAlign are not used,
+// notably because alignment is not implemented in the LyXHTML output.
 char InsetMathSplit::defaultColAlign(col_type col)
 {
-       if (name_ == "split")
+       if (name_ == "gathered")
+               return 'c';
+       if (name_ == "lgathered")
                return 'l';
+       if (name_ == "rgathered")
+               return 'r';
+       if (name_ == "split"
+           || name_ == "aligned"
+           || name_ == "align"
+           || name_ == "alignedat")
+               return colAlign(hullAlign, col);
+       return 'l';
+}
+
+
+char InsetMathSplit::displayColAlign(idx_type idx) const
+{
        if (name_ == "gathered")
                return 'c';
-       if (name_ == "aligned" || name_ == "align")
-               return (col & 1) ? 'l' : 'r';
+       if (name_ == "lgathered")
+               return 'l';
+       if (name_ == "rgathered")
+               return 'r';
+       if (name_ == "split"
+           || name_ == "aligned"
+           || name_ == "align"
+           || name_ == "alignedat")
+               return colAlign(hullAlign, col(idx));
+       return InsetMathGrid::displayColAlign(idx);
+}
+
+
+int InsetMathSplit::displayColSpace(col_type col) const
+{
+       if (name_ == "split" || name_ == "aligned" || name_ == "align")
+               return colSpace(hullAlign, col);
        if (name_ == "alignedat")
-               return (col & 1) ? 'l' : 'r';
-       return 'l';
+               return colSpace(hullAlignAt, col);
+       return 0;
 }
 
 
+
 void InsetMathSplit::draw(PainterInfo & pi, int x, int y) const
 {
        InsetMathGrid::draw(pi, x, y);
@@ -82,6 +118,10 @@ bool InsetMathSplit::getStatus(Cursor & cur, FuncRequest const & cmd,
                        flag.setEnabled(false);
                        return true;
                }
+               if (s == "align-left" || s == "align-center" || s == "align-right") {
+                       flag.setEnabled(false);
+                       return true;
+               }
                break;
        }
        default: