From 98df633ced3c184bb1bd67e42eedb07cdd3d9084 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Wed, 2 Oct 2002 06:38:49 +0000 Subject: [PATCH] the fontsize changing in arrays [And 40 out of 44 occurences had the dummy variable. This fixes the other two in math_binominset.C, too] git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5355 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_arrayinset.C | 13 +++++++++---- src/mathed/math_arrayinset.h | 4 +++- src/mathed/math_binominset.C | 4 ++-- src/mathed/math_metricsinfo.C | 5 +++++ src/mathed/math_metricsinfo.h | 10 +++++++++- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/mathed/math_arrayinset.C b/src/mathed/math_arrayinset.C index 28739cdedc..767992f59b 100644 --- a/src/mathed/math_arrayinset.C +++ b/src/mathed/math_arrayinset.C @@ -68,10 +68,15 @@ MathInset * MathArrayInset::clone() const void MathArrayInset::metrics(MathMetricsInfo & mi) const { - MathMetricsInfo m = mi; - if (m.base.style == LM_ST_DISPLAY) - m.base.style = LM_ST_TEXT; - MathGridInset::metrics(m); + MathArrayChanger dummy(mi.base); + MathGridInset::metrics(mi); +} + + +void MathArrayInset::draw(MathPainterInfo & pi, int x, int y) const +{ + MathArrayChanger dummy(pi.base); + MathGridInset::draw(pi, x, y); } diff --git a/src/mathed/math_arrayinset.h b/src/mathed/math_arrayinset.h index cf8f4b0a21..baad8d81c5 100644 --- a/src/mathed/math_arrayinset.h +++ b/src/mathed/math_arrayinset.h @@ -30,7 +30,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MathMetricsInfo & mi) const; + /// + void draw(MathPainterInfo & pi, int x, int y) const; /// MathArrayInset * asArrayInset() { return this; } /// diff --git a/src/mathed/math_binominset.C b/src/mathed/math_binominset.C index f430470898..5b6fdce321 100644 --- a/src/mathed/math_binominset.C +++ b/src/mathed/math_binominset.C @@ -37,7 +37,7 @@ int MathBinomInset::dw() const void MathBinomInset::metrics(MathMetricsInfo & mi) const { - MathScriptChanger(mi.base); + MathScriptChanger dummy(mi.base); cell(0).metrics(mi); cell(1).metrics(mi); dim_.a = cell(0).height() + 4 + 5; @@ -49,7 +49,7 @@ void MathBinomInset::metrics(MathMetricsInfo & mi) const void MathBinomInset::draw(MathPainterInfo & pi, int x, int y) const { int m = x + width() / 2; - MathScriptChanger(pi.base); + MathScriptChanger dummy(pi.base); cell(0).draw(pi, m - cell(0).width() / 2, y - cell(0).descent() - 3 - 5); cell(1).draw(pi, m - cell(1).width() / 2, y + cell(1).ascent() + 3 - 5); mathed_draw_deco(pi, x, y - ascent(), dw(), height(), "("); diff --git a/src/mathed/math_metricsinfo.C b/src/mathed/math_metricsinfo.C index 9ffe4fb6fa..4ab66bacf9 100644 --- a/src/mathed/math_metricsinfo.C +++ b/src/mathed/math_metricsinfo.C @@ -81,6 +81,11 @@ MathFracChanger::MathFracChanger(MathMetricsBase & mb) +MathArrayChanger::MathArrayChanger(MathMetricsBase & mb) + : MathStyleChanger(mb, mb.style == LM_ST_DISPLAY ? LM_ST_TEXT : mb.style) +{} + + MathShapeChanger::MathShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape) : MathChanger(font) { diff --git a/src/mathed/math_metricsinfo.h b/src/mathed/math_metricsinfo.h index 3dc911b7b6..4f52237fd9 100644 --- a/src/mathed/math_metricsinfo.h +++ b/src/mathed/math_metricsinfo.h @@ -69,7 +69,8 @@ struct TextMetricsInfo {}; // Generic base for temporarily changing things. -// The original state gets restored when the Changer is destructed +// The original state gets restored when the Changer is destructed. + template struct MathChanger { /// @@ -119,6 +120,13 @@ struct MathFracChanger : public MathStyleChanger { }; +struct MathArrayChanger : public MathStyleChanger { + /// + MathArrayChanger(MathMetricsBase & mb); +}; + + + struct MathShapeChanger : public MathChanger { /// MathShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape); -- 2.39.5