From 8d9f14a22b40f91f07cb5ff0831c5b5e3af74d90 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 4 Jun 2002 09:06:04 +0000 Subject: [PATCH] small advances with \mbox git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4331 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/formulabase.C | 1 - src/mathed/math_boxinset.C | 14 +++++++++++--- src/mathed/math_boxinset.h | 10 ++++++---- src/mathed/math_fontinset.h | 8 ++++---- src/mathed/math_hullinset.C | 8 +++----- src/mathed/math_hullinset.h | 2 -- 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 66317c27d6..09f31f5564 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -155,7 +155,6 @@ void InsetFormulaBase::metrics(BufferView * bv) const mi.base.style = display() ? LM_ST_DISPLAY : LM_ST_TEXT; mi.base.font = font_; mi.base.font.setColor(LColor::math); - //whichFont(mi.font, LM_TC_MIN, mi); par()->metrics(mi); } diff --git a/src/mathed/math_boxinset.C b/src/mathed/math_boxinset.C index eeb4005c55..3d5f14b6ad 100644 --- a/src/mathed/math_boxinset.C +++ b/src/mathed/math_boxinset.C @@ -41,8 +41,16 @@ void MathBoxInset::rebreak() } -void MathBoxInset::draw(MathPainterInfo & pain, int x, int y) const +void MathBoxInset::metrics(MathMetricsInfo & mi) const { - MathGridInset::draw(pain, x, y); - mathed_draw_framebox(pain, x, y, this); + MathFontSetChanger dummy(mi.base, "textnormal"); + MathGridInset::metrics(mi); +} + + +void MathBoxInset::draw(MathPainterInfo & pi, int x, int y) const +{ + MathFontSetChanger dummy(pi.base, "textnormal"); + MathGridInset::draw(pi, x, y); + mathed_draw_framebox(pi, x, y, this); } diff --git a/src/mathed/math_boxinset.h b/src/mathed/math_boxinset.h index 0dfc8e4476..cbf358edd8 100644 --- a/src/mathed/math_boxinset.h +++ b/src/mathed/math_boxinset.h @@ -16,9 +16,13 @@ class LyXFont; class MathBoxInset : public MathGridInset { public: /// - explicit MathBoxInset(string const &); + explicit MathBoxInset(string const & name); /// MathInset * clone() const; + /// + void metrics(MathMetricsInfo & mi) const; + /// + void draw(MathPainterInfo & pi, int x, int y) const; /// identifies BoxInsets MathBoxInset * asBoxInset() { return this; } /// identifies BoxInsets @@ -28,9 +32,7 @@ public: /// void write(WriteStream & os) const; /// - void normalize(NormalStream &) const; - /// - void draw(MathPainterInfo &, int x, int y) const; + void normalize(NormalStream & ns) const; private: /// diff --git a/src/mathed/math_fontinset.h b/src/mathed/math_fontinset.h index 1c62eb9a7b..a07f2ad02e 100644 --- a/src/mathed/math_fontinset.h +++ b/src/mathed/math_fontinset.h @@ -21,13 +21,13 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MathMetricsInfo & mi) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(MathPainterInfo & pi, int x, int y) const; /// - void metricsT(TextMetricsInfo const & st) const; + void metricsT(TextMetricsInfo const & mi) const; /// - void drawT(TextPainter &, int x, int y) const; + void drawT(TextPainter & pi, int x, int y) const; /// void write(WriteStream & os) const; /// diff --git a/src/mathed/math_hullinset.C b/src/mathed/math_hullinset.C index 010d1758dd..25b076855b 100644 --- a/src/mathed/math_hullinset.C +++ b/src/mathed/math_hullinset.C @@ -159,6 +159,7 @@ int MathHullInset::defaultColSpace(col_type col) void MathHullInset::metrics(MathMetricsInfo & mi) const { + // let the cells adjust themselves MathGridInset::metrics(mi); @@ -167,14 +168,11 @@ void MathHullInset::metrics(MathMetricsInfo & mi) const descent_ += 12; } - mi_ = mi; - mi_.base.style = (getType() == LM_OT_SIMPLE) ? LM_ST_TEXT : LM_ST_DISPLAY; - if (numberedType()) { //augmentFont(mi_.base.font, "mathbf"); int l = 0; for (row_type row = 0; row < nrows(); ++row) - l = max(l, mathed_string_width(mi_.base.font, nicelabel(row))); + l = max(l, mathed_string_width(mi.base.font, nicelabel(row))); if (l) width_ += 30 + l; @@ -183,7 +181,7 @@ void MathHullInset::metrics(MathMetricsInfo & mi) const // make it at least as high as the current font int asc = 0; int des = 0; - math_font_max_dim(mi_.base.font, asc, des); + math_font_max_dim(mi.base.font, asc, des); ascent_ = max(ascent_, asc); descent_ = max(descent_, des); } diff --git a/src/mathed/math_hullinset.h b/src/mathed/math_hullinset.h index 3b09efe7db..8202b807bc 100644 --- a/src/mathed/math_hullinset.h +++ b/src/mathed/math_hullinset.h @@ -109,8 +109,6 @@ private: std::vector nonum_; /// std::vector label_; - /// - mutable MathMetricsInfo mi_; }; #endif -- 2.39.5