}
+// static\r
+char InsetMathGrid::colAlign(HullType type, col_type col)\r
+{\r
+ switch (type) {\r
+ case hullEqnArray:\r
+ return "rcl"[col % 3];\r
+\r
+ case hullMultline:\r
+ case hullGather:\r
+ return 'c';\r
+\r
+ case hullAlign:\r
+ case hullAlignAt:\r
+ case hullXAlignAt:\r
+ case hullXXAlignAt:\r
+ case hullFlAlign:\r
+ return "rl"[col & 1];\r
+\r
+ default:\r
+ return 'c';\r
+ }\r
+}\r
+\r
+\r
+\r
} // namespace lyx
virtual docstring eocString(col_type col, col_type lastcol) const;
/// splits cells and shifts right part to the next cell
void splitCell(Cursor & cur);
- /// Column aligmment for display of cell \p idx.
+ /// Column alignment for display of cell \p idx.\r
/// Must not be written to file!
virtual char displayColAlign(idx_type idx) const;
-
+ /// The value of a fixed col align for a certain hull type \r
+ static char colAlign(HullType type, col_type col);\r
/// row info.
/// rowinfo_[nrows()] is a dummy row used only for hlines.
}
+//FIXME: This has probably no effect and can be removed.\r
char InsetMathHull::defaultColAlign(col_type col)
{
- if (type_ == hullEqnArray)
- return "rcl"[col];
- if (type_ == hullMultline)
- return 'c';
- if (type_ == hullGather)
- return 'c';
- if (type_ >= hullAlign)
- return "rl"[col & 1];
- return 'c';
+ return colAlign(type_, col);\r
}
char InsetMathHull::displayColAlign(idx_type idx) const
{
- if (type_ == hullMultline) {
+ switch (type_) {\r
+ case hullMultline: {\r
row_type const r = row(idx);
if (r == 0)
return 'l';
if (r == nrows() - 1)
return 'r';
+ return 'c';\r
+ }\r
+ case hullEqnArray:\r
+ case hullGather:\r
+ case hullAlign:\r
+ case hullAlignAt:\r
+ case hullXAlignAt:\r
+ case hullXXAlignAt:\r
+ case hullFlAlign:\r
+ return colAlign(type_, col(idx));\r
+ default:\r
+ break;\r
}
return InsetMathGrid::displayColAlign(idx);
}
}
+bool InsetMathHull::isMutable(HullType type)\r
+{\r
+ switch (type) {\r
+ case hullNone:\r
+ case hullSimple:\r
+ case hullEquation:\r
+ case hullEqnArray:\r
+ case hullAlign:\r
+ case hullFlAlign:\r
+ case hullAlignAt:\r
+ case hullXAlignAt:\r
+ case hullXXAlignAt:\r
+ case hullMultline:\r
+ case hullGather:\r
+ return true;\r
+ default:\r
+ return false;\r
+ }\r
+}\r
+\r
+\r
void InsetMathHull::mutate(HullType newtype)
{
//lyxerr << "mutating from '" << type_ << "' to '" << newtype << "'" << endl;
}
+//FIXME: This has probably no effect and can be removed.\r
char InsetMathSplit::defaultColAlign(col_type col)
{
- if (name_ == "split")
- return 'l';
if (name_ == "gathered")
return 'c';
- if (name_ == "aligned" || name_ == "align")
- return (col & 1) ? 'l' : 'r';
- if (name_ == "alignedat")
- return (col & 1) ? 'l' : 'r';
+ if (name_ == "lgathered")\r
+ return 'l';\r
+ if (name_ == "rgathered")\r
+ return 'r';\r
+ if (name_ == "split"\r
+ || name_ == "aligned"\r
+ || name_ == "align"\r
+ || name_ == "alignedat")\r
+ return colAlign(hullAlign, col);\r
return 'l';
}
+char InsetMathSplit::displayColAlign(idx_type idx) const\r
+{\r
+ if (name_ == "gathered")\r
+ return 'c';\r
+ if (name_ == "lgathered")\r
+ return 'l';\r
+ if (name_ == "rgathered")\r
+ return 'r';\r
+ if (name_ == "split"\r
+ || name_ == "aligned"\r
+ || name_ == "align"\r
+ || name_ == "alignedat")\r
+ return colAlign(hullAlign, col(idx));\r
+ return InsetMathGrid::displayColAlign(idx);\r
+}\r
+\r
+\r
void InsetMathSplit::draw(PainterInfo & pi, int x, int y) const
{
InsetMathGrid::draw(pi, x, y);
flag.setEnabled(false);
return true;
}
+ if (s == "align-left" || s == "align-center" || s == "align-right") {\r
+ flag.setEnabled(false);\r
+ return true;\r
+ }\r
break;
}
default:
///
char defaultColAlign(col_type);
///
+ char displayColAlign(idx_type idx) const;\r
+ ///\r
InsetCode lyxCode() const { return MATH_SPLIT_CODE; }
private: