]> git.lyx.org Git - features.git/commitdiff
Fix on-screen alignment of multline equations
authorGeorg Baum <georg.baum@post.rwth-aachen.de>
Tue, 18 Oct 2011 18:46:57 +0000 (18:46 +0000)
committerGeorg Baum <georg.baum@post.rwth-aachen.de>
Tue, 18 Oct 2011 18:46:57 +0000 (18:46 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39882 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathGrid.cpp
src/mathed/InsetMathGrid.h
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathHull.h

index 6d3d97cc0dcb3b6d12be0106df1555e2a02559f1..5b58f09a03eb1b746873057d84b00d19f985ac60 100644 (file)
@@ -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;
index 96e525319bec807ad182f50c0d9d5f643c63214a..bfa286b766a95c34e4d663bb840b2f5b985229f8 100644 (file)
@@ -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.
index 50fb014dc4acbb85da72f72d483a2d7dc17098d8..e06a40ec5a9c9bc56c6f79d97d50f327d571273c 100644 (file)
@@ -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)
index 8c0ed98265d36663420dfefc5edb8cf69fd245ed..4bbb5731743d754c5ee41b84eded7a4012f00028 100644 (file)
@@ -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;