From 76962d5515dec69d709543cc48dbc09103d422e4 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Tue, 18 Oct 2011 18:46:57 +0000 Subject: [PATCH] Fix on-screen alignment of multline equations git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39882 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/InsetMathGrid.cpp | 2 +- src/mathed/InsetMathGrid.h | 4 ++++ src/mathed/InsetMathHull.cpp | 14 ++++++++++++++ src/mathed/InsetMathHull.h | 3 +++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index 6d3d97cc0d..5b58f09a03 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -788,7 +788,7 @@ int InsetMathGrid::cellXOffset(BufferView const & bv, idx_type idx) const { col_type c = col(idx); int x = colinfo_[c].offset_; - char align = colinfo_[c].align_; + char align = displayColAlign(c, row(idx)); Dimension const & celldim = cell(idx).dimension(bv); if (align == 'r' || align == 'R') x += colinfo_[c].width_ - celldim.wid; diff --git a/src/mathed/InsetMathGrid.h b/src/mathed/InsetMathGrid.h index 96e525319b..bfa286b766 100644 --- a/src/mathed/InsetMathGrid.h +++ b/src/mathed/InsetMathGrid.h @@ -242,6 +242,10 @@ protected: 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 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. /// rowinfo_[nrows()] is a dummy row used only for hlines. diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 50fb014dc4..e06a40ec5a 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -342,6 +342,8 @@ 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) @@ -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) { if (type_ == hullAlign || type_ == hullAlignAt) diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index 8c0ed98265..4bbb573174 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -101,6 +101,9 @@ public: /// char defaultColAlign(col_type col); /// + /// + char displayColAlign(col_type col, row_type row) const; + /// bool idxFirst(Cursor &) const; /// bool idxLast(Cursor &) const; -- 2.39.2