Thanks Georg. Here is my patch. It is a little different from what I
proposed earlier: I had also to adapt the horizontal grid lines, which
use width() which has changed. Please review.

BTW there is still a bug in the math_splitinset: it has no setPosCache,
so you cannot click the cursor inside split/gathered/aligned/alignedat.
Should be fixed by adding a draw routine calling MathGridInset::draw 
and setPosCache. OK?

- Martin

Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v
retrieving revision 1.483
diff -u -r1.483 ChangeLog
--- ChangeLog   3 Apr 2005 12:07:49 -0000       1.483
+++ ChangeLog   3 Apr 2005 14:40:37 -0000
@@ -1,3 +1,11 @@
+
+2005-04-03  Martin Vermeer  <[EMAIL PROTECTED]>
+       * math_amsarrayinset.C:
+       * math_casesinset.C:
+       * math_gridinset.C:
+       * math_gridinset.h: Add drawWithMargin method for use by
+       AMSArray and Cases, to position corner markers right
+
 2005-03-31  Georg Baum  <[EMAIL PROTECTED]>
 
        * math_amsarrayinset.[Ch], math_tabularinset.[Ch],
Index: math_amsarrayinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_amsarrayinset.C,v
retrieving revision 1.27
diff -u -r1.27 math_amsarrayinset.C
--- math_amsarrayinset.C        3 Apr 2005 12:07:49 -0000       1.27
+++ math_amsarrayinset.C        3 Apr 2005 14:40:37 -0000
@@ -91,7 +91,7 @@
 
 void MathAMSArrayInset::draw(PainterInfo & pi, int x, int y) const
 {
-       MathGridInset::draw(pi, x + 6, y);
+       MathGridInset::drawWithMargin(pi, x, y, 6, 6);
        int const yy = y - dim_.ascent();
        mathed_draw_deco(pi, x + 1, yy, 5, dim_.height(), name_left());
        mathed_draw_deco(pi, x + dim_.width() - 6, yy, 5, dim_.height(), 
name_right());
Index: math_casesinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_casesinset.C,v
retrieving revision 1.29
diff -u -r1.29 math_casesinset.C
--- math_casesinset.C   3 Apr 2005 12:07:49 -0000       1.29
+++ math_casesinset.C   3 Apr 2005 14:40:38 -0000
@@ -58,7 +58,7 @@
 void MathCasesInset::draw(PainterInfo & pi, int x, int y) const
 {
        mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 6, dim_.height(), "{");
-       MathGridInset::draw(pi, x + 8, y);
+       MathGridInset::drawWithMargin(pi, x, y, 8, 0);
        setPosCache(pi, x, y);
 }
 
Index: math_gridinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_gridinset.C,v
retrieving revision 1.157
diff -u -r1.157 math_gridinset.C
--- math_gridinset.C    3 Apr 2005 12:07:49 -0000       1.157
+++ math_gridinset.C    3 Apr 2005 14:40:38 -0000
@@ -479,21 +479,28 @@
 
 void MathGridInset::draw(PainterInfo & pi, int x, int y) const
 {
+       drawWithMargin(pi, x, y, 0, 0);
+}
+
+void MathGridInset::drawWithMargin(PainterInfo & pi, int x, int y, 
+       int lmargin, int rmargin) const
+{
        for (idx_type idx = 0; idx < nargs(); ++idx)
-               cell(idx).draw(pi, x + cellXOffset(idx), y + cellYOffset(idx));
+               cell(idx).draw(pi, x + lmargin + cellXOffset(idx), 
+                       y + cellYOffset(idx));
 
        for (row_type row = 0; row <= nrows(); ++row)
                for (unsigned int i = 0; i < rowinfo_[row].lines_; ++i) {
                        int yy = y + rowinfo_[row].offset_ - 
rowinfo_[row].ascent_
                                - i * hlinesep() - hlinesep()/2 - rowsep()/2;
-                       pi.pain.line(x + 1, yy,
-                                    x + dim_.width() - 1, yy,
+                       pi.pain.line(x + lmargin + 1, yy,
+                                    x + dim_.width() - rmargin - 1, yy,
                                     LColor::foreground);
                }
 
        for (col_type col = 0; col <= ncols(); ++col)
                for (unsigned int i = 0; i < colinfo_[col].lines_; ++i) {
-                       int xx = x + colinfo_[col].offset_
+                       int xx = x + lmargin + colinfo_[col].offset_
                                - i * vlinesep() - vlinesep()/2 - colsep()/2;
                        pi.pain.line(xx, y - dim_.ascent() + 1,
                                     xx, y + dim_.descent() - 1,
Index: math_gridinset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_gridinset.h,v
retrieving revision 1.86
diff -u -r1.86 math_gridinset.h
--- math_gridinset.h    14 Feb 2005 14:25:17 -0000      1.86
+++ math_gridinset.h    3 Apr 2005 14:40:38 -0000
@@ -98,6 +98,9 @@
        ///
        void draw(PainterInfo & pi, int x, int y) const;
        ///
+       void drawWithMargin(PainterInfo & pi, int x, int y, 
+               int lmargin = 0, int rmargin = 0) const;
+       ///
        void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
        ///
        void drawT(TextPainter & pi, int x, int y) const;

Attachment: pgpF7jmTqRNry.pgp
Description: PGP signature

Reply via email to