Fix on-screen alignment of multline equations

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39882 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2011-10-18 18:46:57 +00:00
parent 1b6f5014ae
commit 76962d5515
4 changed files with 22 additions and 1 deletions

View File

@ -788,7 +788,7 @@ int InsetMathGrid::cellXOffset(BufferView const & bv, idx_type idx) const
{ {
col_type c = col(idx); col_type c = col(idx);
int x = colinfo_[c].offset_; int x = colinfo_[c].offset_;
char align = colinfo_[c].align_; char align = displayColAlign(c, row(idx));
Dimension const & celldim = cell(idx).dimension(bv); Dimension const & celldim = cell(idx).dimension(bv);
if (align == 'r' || align == 'R') if (align == 'r' || align == 'R')
x += colinfo_[c].width_ - celldim.wid; x += colinfo_[c].width_ - celldim.wid;

View File

@ -242,6 +242,10 @@ protected:
virtual docstring eocString(col_type col, col_type lastcol) const; virtual docstring eocString(col_type col, col_type lastcol) const;
/// splits cells and shifts right part to the next cell /// splits cells and shifts right part to the next cell
void splitCell(Cursor & cur); void splitCell(Cursor & cur);
/// Column aligmment for display of cell at (\p row, \p col).
/// Must not be written to file!
virtual char displayColAlign(col_type col, row_type) const { return colinfo_[col].align_; }
/// row info. /// row info.
/// rowinfo_[nrows()] is a dummy row used only for hlines. /// rowinfo_[nrows()] is a dummy row used only for hlines.

View File

@ -342,6 +342,8 @@ char InsetMathHull::defaultColAlign(col_type col)
{ {
if (type_ == hullEqnArray) if (type_ == hullEqnArray)
return "rcl"[col]; return "rcl"[col];
if (type_ == hullMultline)
return 'c';
if (type_ == hullGather) if (type_ == hullGather)
return 'c'; return 'c';
if (type_ >= hullAlign) if (type_ >= hullAlign)
@ -350,6 +352,18 @@ char InsetMathHull::defaultColAlign(col_type col)
} }
char InsetMathHull::displayColAlign(col_type col, row_type row) const
{
if (type_ == hullMultline) {
if (row == 0)
return 'l';
if (row == nrows() - 1)
return 'r';
}
return InsetMathGrid::displayColAlign(col, row);
}
int InsetMathHull::defaultColSpace(col_type col) int InsetMathHull::defaultColSpace(col_type col)
{ {
if (type_ == hullAlign || type_ == hullAlignAt) if (type_ == hullAlign || type_ == hullAlignAt)

View File

@ -101,6 +101,9 @@ public:
/// ///
char defaultColAlign(col_type col); char defaultColAlign(col_type col);
/// ///
///
char displayColAlign(col_type col, row_type row) const;
///
bool idxFirst(Cursor &) const; bool idxFirst(Cursor &) const;
/// ///
bool idxLast(Cursor &) const; bool idxLast(Cursor &) const;