diff --git a/src/mathed/button_inset.C b/src/mathed/button_inset.C index 0034107f42..1cd3ea07f1 100644 --- a/src/mathed/button_inset.C +++ b/src/mathed/button_inset.C @@ -2,6 +2,7 @@ #include "button_inset.h" #include "math_support.h" +#include "math_metricsinfo.h" #include "frontends/Painter.h" #include @@ -37,7 +38,6 @@ void ButtonInset::draw(MathPainterInfo & pi, int x, int y) const xcell(1).draw(pi, x + xcell(0).width() + 2, y); mathed_draw_framebox(pi, x, y, this); } else { - pi.pain.buttonText(x + 2, y, screenLabel(), - pi.base.font); + pi.pain.buttonText(x + 2, y, screenLabel(), pi.base.font); } } diff --git a/src/mathed/formula.C b/src/mathed/formula.C index a9683b2c52..8cc653e901 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -25,6 +25,7 @@ #include "math_parser.h" #include "math_charinset.h" #include "math_arrayinset.h" +#include "math_metricsinfo.h" #include "math_deliminset.h" #include "math_hullinset.h" #include "math_support.h" diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 4d7c4ab61b..5952705d85 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -33,6 +33,7 @@ #include "LaTeXFeatures.h" #include "debug.h" #include "math_support.h" +#include "math_metricsinfo.h" #include "support/lstrings.h" #include "frontends/LyXView.h" #include "frontends/font_metrics.h" @@ -153,7 +154,6 @@ void InsetFormulaBase::metrics(BufferView * bv) const if (bv) view_ = bv->owner()->view(); MathMetricsInfo mi; - mi.view = view_; //mi.base.style = display() ? LM_ST_DISPLAY : LM_ST_TEXT; mi.base.style = LM_ST_TEXT; mi.base.font = font_; diff --git a/src/mathed/formulamacro.C b/src/mathed/formulamacro.C index 80d68d0587..4309703663 100644 --- a/src/mathed/formulamacro.C +++ b/src/mathed/formulamacro.C @@ -24,6 +24,7 @@ #include "math_macro.h" #include "math_macrotable.h" #include "math_macrotemplate.h" +#include "math_metricsinfo.h" #include "math_support.h" #include "math_mathmlstream.h" #include "BufferView.h" diff --git a/src/mathed/math_amsarrayinset.C b/src/mathed/math_amsarrayinset.C index 1e4245e526..ad8056138c 100644 --- a/src/mathed/math_amsarrayinset.C +++ b/src/mathed/math_amsarrayinset.C @@ -6,6 +6,7 @@ #include "math_amsarrayinset.h" #include "math_mathmlstream.h" +#include "math_metricsinfo.h" #include "math_support.h" #include "math_streamstr.h" #include "math_support.h" diff --git a/src/mathed/math_arrayinset.C b/src/mathed/math_arrayinset.C index d785b4cede..e0cb5bed15 100644 --- a/src/mathed/math_arrayinset.C +++ b/src/mathed/math_arrayinset.C @@ -7,6 +7,7 @@ #include "math_arrayinset.h" #include "math_parser.h" #include "math_mathmlstream.h" +#include "math_metricsinfo.h" #include "math_streamstr.h" #include "Lsstream.h" diff --git a/src/mathed/math_macro.h b/src/mathed/math_macro.h index 77e7784baf..17aeb7cbf9 100644 --- a/src/mathed/math_macro.h +++ b/src/mathed/math_macro.h @@ -21,10 +21,8 @@ #pragma interface #endif -#include -#include - #include "math_nestinset.h" +#include "math_metricsinfo.h" #include "math_macroarg.h" #include "LString.h" diff --git a/src/mathed/math_mathmlstream.h b/src/mathed/math_mathmlstream.h index 6425e27d3b..c5e0a31af2 100644 --- a/src/mathed/math_mathmlstream.h +++ b/src/mathed/math_mathmlstream.h @@ -6,6 +6,8 @@ // settled. +#include "math_metricsinfo.h" + #include class MathArray; diff --git a/src/mathed/math_metricsinfo.C b/src/mathed/math_metricsinfo.C index 10e2e195f9..075470a4da 100644 --- a/src/mathed/math_metricsinfo.C +++ b/src/mathed/math_metricsinfo.C @@ -14,14 +14,12 @@ MathMetricsBase::MathMetricsBase() - MathMetricsInfo::MathMetricsInfo() : fullredraw(false) {} - MathPainterInfo::MathPainterInfo(Painter & p) : pain(p) {} diff --git a/src/mathed/math_metricsinfo.h b/src/mathed/math_metricsinfo.h index 54202829fe..6985a6d309 100644 --- a/src/mathed/math_metricsinfo.h +++ b/src/mathed/math_metricsinfo.h @@ -4,11 +4,7 @@ #include "lyxfont.h" #include "LString.h" -#include - -class BufferView; class Painter; -class MathNestInset; /// Standard Math Sizes (Math mode styles) @@ -48,15 +44,13 @@ struct MathMetricsInfo { /// MathMetricsBase base; /// - boost::weak_ptr view; - /// bool fullredraw; }; struct MathPainterInfo { /// - MathPainterInfo(Painter & p); + MathPainterInfo(Painter & pain); /// void draw(int x, int y, char c); diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index cb50c07d82..cc2475c522 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -139,7 +139,7 @@ int MathScriptInset::dy1() const asc += na + 2; else asc = max(asc, na); - asc = max(asc, mathed_char_ascent(font_, 'I')); + asc = max(asc, 5); return asc; } @@ -166,19 +166,19 @@ int MathScriptInset::dxx() const int MathScriptInset::nwid() const { - return nuc().size() ? nuc().width() : mathed_char_width(font_, '.'); + return nuc().size() ? nuc().width() : 2; } int MathScriptInset::nasc() const { - return nuc().size() ? nuc().ascent() : mathed_char_ascent(font_, 'I'); + return nuc().size() ? nuc().ascent() : 5; } int MathScriptInset::ndes() const { - return nuc().size() ? nuc().descent() : mathed_char_descent(font_, 'I'); + return nuc().size() ? nuc().descent() : 0; } @@ -211,7 +211,7 @@ void MathScriptInset::draw(MathPainterInfo & pi, int x, int y) const if (nuc().size()) nuc().draw(pi, x + dxx(), y); else if (editing()) - drawStr(pi, font_, x + dxx(), y, "."); + drawStr(pi, pi.base.font, x + dxx(), y, "."); MathScriptChanger dummy(pi.base); if (hasUp()) up().draw(pi, x + dx1(), y - dy1()); diff --git a/src/mathed/math_scriptinset.h b/src/mathed/math_scriptinset.h index c0964b107d..9052a59df4 100644 --- a/src/mathed/math_scriptinset.h +++ b/src/mathed/math_scriptinset.h @@ -118,8 +118,6 @@ private: bool script_[2]; /// 1 - "limits", -1 - "nolimits", 0 - "default" int limits_; - /// cached font - mutable LyXFont font_; }; #endif diff --git a/src/mathed/math_sizeinset.h b/src/mathed/math_sizeinset.h index 7d52d63170..4ba28743f3 100644 --- a/src/mathed/math_sizeinset.h +++ b/src/mathed/math_sizeinset.h @@ -3,6 +3,7 @@ #define MATHSIZEINSET_H #include "math_nestinset.h" +#include "math_metricsinfo.h" #ifdef __GNUG__ #pragma interface diff --git a/src/mathed/math_support.C b/src/mathed/math_support.C index 4dc8980364..59b4df2c42 100644 --- a/src/mathed/math_support.C +++ b/src/mathed/math_support.C @@ -7,6 +7,7 @@ #include "math_cursor.h" #include "math_inset.h" #include "math_parser.h" +#include "math_metricsinfo.h" #include "frontends/Painter.h" #include "frontends/font_metrics.h" #include "frontends/lyx_gui.h" diff --git a/src/mathed/math_textinset.C b/src/mathed/math_textinset.C index de7fd64e74..494fc753a7 100644 --- a/src/mathed/math_textinset.C +++ b/src/mathed/math_textinset.C @@ -1,5 +1,6 @@ #include "math_textinset.h" +#include "math_metricsinfo.h" #include "debug.h" diff --git a/src/mathed/math_xdata.C b/src/mathed/math_xdata.C index 3e6d47f6d8..0deaf68154 100644 --- a/src/mathed/math_xdata.C +++ b/src/mathed/math_xdata.C @@ -5,6 +5,7 @@ #endif #include "math_xdata.h" +#include "math_metricsinfo.h" #include "math_support.h" #include "math_inset.h" #include "frontends/Painter.h" diff --git a/src/mathed/math_xdata.h b/src/mathed/math_xdata.h index 7045208394..ef05735bee 100644 --- a/src/mathed/math_xdata.h +++ b/src/mathed/math_xdata.h @@ -6,14 +6,16 @@ #include #include "math_data.h" -#include "math_metricsinfo.h" +//#include "math_metricsinfo.h" #include "dimension.h" #ifdef __GNUG__ #pragma interface #endif +class MathMetricsInfo; class MathPainterInfo; +class TextMetricsInfo; class TextPainter; diff --git a/src/mathed/math_xyarrowinset.h b/src/mathed/math_xyarrowinset.h index ecdfd3e247..758981c787 100644 --- a/src/mathed/math_xyarrowinset.h +++ b/src/mathed/math_xyarrowinset.h @@ -3,6 +3,7 @@ #define MATH_ARROWINSET_H #include "math_nestinset.h" +#include "math_metricsinfo.h" #ifdef __GNUG__ #pragma interface @@ -19,9 +20,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MathMetricsInfo & mi) const; /// - void draw(MathPainterInfo & pain, int x, int y) const; + void draw(MathPainterInfo & pi, int x, int y) const; /// MathXYArrowInset * asXYArrowInset() { return this; }