diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 1a350f45ea..7c77125919 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,11 @@ + +2005-04-04 Martin Vermeer + * 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 * math_amsarrayinset.[Ch], math_tabularinset.[Ch], diff --git a/src/mathed/math_amsarrayinset.C b/src/mathed/math_amsarrayinset.C index dea483859e..468f97bea3 100644 --- a/src/mathed/math_amsarrayinset.C +++ b/src/mathed/math_amsarrayinset.C @@ -91,7 +91,7 @@ void MathAMSArrayInset::metrics(MetricsInfo & mi, Dimension & dim) const 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()); diff --git a/src/mathed/math_casesinset.C b/src/mathed/math_casesinset.C index 6c489ccddc..a21a0bfa10 100644 --- a/src/mathed/math_casesinset.C +++ b/src/mathed/math_casesinset.C @@ -58,7 +58,7 @@ void MathCasesInset::metrics(MetricsInfo & mi, Dimension & dim) const 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); } diff --git a/src/mathed/math_gridinset.C b/src/mathed/math_gridinset.C index e104f2cbc2..b58054bd8f 100644 --- a/src/mathed/math_gridinset.C +++ b/src/mathed/math_gridinset.C @@ -478,22 +478,29 @@ void MathGridInset::metrics(MetricsInfo & mi, Dimension & dim) const 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, diff --git a/src/mathed/math_gridinset.h b/src/mathed/math_gridinset.h index e66b02765e..6acba46b43 100644 --- a/src/mathed/math_gridinset.h +++ b/src/mathed/math_gridinset.h @@ -98,6 +98,9 @@ public: /// 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;