AMS align environment should have some spacing between odd and even columns.
Add a new virtual method displayColSpace() to InsetMathGrid, InsetMathHull and
InsetMathSplit.
colinfo_[col].offset_ =
colinfo_[col - 1].offset_ +
colinfo_[col - 1].width_ +
- colinfo_[col - 1].skip_ +
+ displayColSpace(col - 1) +\r
colsep() +
colinfo_[col].lines_ * vlinesep();
}
int const nextoffset =
colinfo_[first].offset_ +
wid +
- colinfo_[last].skip_ +
+ displayColSpace(last) +\r
colsep() +
colinfo_[last+1].lines_ * vlinesep();
int const dx = nextoffset - colinfo_[last+1].offset_;
colinfo_[col].offset_ =
colinfo_[col - 1].offset_ +
colinfo_[col - 1].width_ +
- colinfo_[col - 1].skip_ +
+ displayColSpace(col - 1) +\r
1 ; //colsep() +
//colinfo_[col].lines_ * vlinesep();
}
col_type c2 = c1 + ncellcols(idx);
return colinfo_[c2].offset_
- colinfo_[c1].offset_
- - colinfo_[c2].skip_
+ - displayColSpace(c2)\r
- colsep()
- colinfo_[c2].lines_ * vlinesep();
}
}
+int InsetMathGrid::displayColSpace(col_type col) const\r
+{\r
+ return colinfo_[col].skip_;\r
+}\r
+\r
void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
{
//lyxerr << "*** InsetMathGrid: request: " << cmd << endl;
}\r
\r
\r
+//static\r
+int InsetMathGrid::colSpace(HullType type, col_type col)\r
+{\r
+ int alignInterSpace;\r
+ switch (type) {\r
+ case hullEqnArray:\r
+ return 5;\r
+ \r
+ case hullAlign:\r
+ alignInterSpace = 20;\r
+ break;\r
+ case hullAlignAt:\r
+ alignInterSpace = 0;\r
+ break;\r
+ case hullXAlignAt:\r
+ alignInterSpace = 40;\r
+ break;\r
+ case hullXXAlignAt:\r
+ case hullFlAlign:\r
+ alignInterSpace = 60;\r
+ break;\r
+ default:\r
+ return 0;\r
+ }\r
+ return (col % 2) ? alignInterSpace : 0;\r
+}\r
+\r
\r
} // namespace lyx
/// Column alignment for display of cell \p idx.\r
/// Must not be written to file!
virtual char displayColAlign(idx_type idx) const;
+ /// Column spacing for display of column \p col.\r
+ /// Must not be written to file!\r
+ virtual int displayColSpace(col_type col) const;\r
+\r
+ // The following two functions are used in InsetMathHull and\r
+ // InsetMathSplit.\r
/// The value of a fixed col align for a certain hull type \r
static char colAlign(HullType type, col_type col);\r
+ /// The value of a fixed col spacing for a certain hull type\r
+ static int colSpace(HullType type, col_type col);\r
/// row info.
/// rowinfo_[nrows()] is a dummy row used only for hlines.
}
+int InsetMathHull::displayColSpace(col_type col) const\r
+{\r
+ return colSpace(type_, col);\r
+}\r
+\r
+\r
+//FIXME: This has probably no effect and can be removed.\r
int InsetMathHull::defaultColSpace(col_type col)
{
if (type_ == hullAlign || type_ == hullAlignAt)
///
int defaultColSpace(col_type col);
///
+ int displayColSpace(col_type col) const;\r
+ ///\r
char defaultColAlign(col_type col);
///
char displayColAlign(idx_type idx) const;
}\r
\r
\r
+int InsetMathSplit::displayColSpace(col_type col) const\r
+{\r
+ if (name_ == "split" || name_ == "aligned" || name_ == "align")\r
+ return colSpace(hullAlign, col);\r
+ if (name_ == "alignedat")\r
+ return colSpace(hullAlignAt, col);\r
+ return 0;\r
+}\r
+\r
+\r
+\r
void InsetMathSplit::draw(PainterInfo & pi, int x, int y) const
{
InsetMathGrid::draw(pi, x, y);
///
int defaultColSpace(col_type) { return 0; }
///
+ int displayColSpace(col_type col) const;\r
+ ///\r
char defaultColAlign(col_type);
///
char displayColAlign(idx_type idx) const;\r