From 1829cdef6a34ec623c25ec8967dc048e8f19eee9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 21 Mar 2003 14:20:48 +0000 Subject: [PATCH] promote MathMetricsInfo to MetricsInfo, change mathed accordingly git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6555 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 + src/Makefile.am | 2 + src/lyxrow.C | 24 +++ src/lyxrow.h | 28 --- src/mathed/Makefile.am | 2 - src/mathed/button_inset.C | 10 +- src/mathed/button_inset.h | 4 +- src/mathed/formula.C | 4 +- src/mathed/formulabase.C | 6 +- src/mathed/formulamacro.C | 4 +- src/mathed/math_amsarrayinset.C | 8 +- src/mathed/math_amsarrayinset.h | 4 +- src/mathed/math_arrayinset.C | 10 +- src/mathed/math_arrayinset.h | 4 +- src/mathed/math_biginset.C | 4 +- src/mathed/math_biginset.h | 4 +- src/mathed/math_binaryopinset.C | 6 +- src/mathed/math_binaryopinset.h | 6 +- src/mathed/math_binominset.C | 8 +- src/mathed/math_binominset.h | 4 +- src/mathed/math_boxinset.C | 8 +- src/mathed/math_boxinset.h | 4 +- src/mathed/math_braceinset.C | 4 +- src/mathed/math_braceinset.h | 4 +- src/mathed/math_casesinset.C | 4 +- src/mathed/math_casesinset.h | 4 +- src/mathed/math_charinset.C | 16 +- src/mathed/math_charinset.h | 4 +- src/mathed/math_commentinset.C | 4 +- src/mathed/math_commentinset.h | 4 +- src/mathed/math_cursor.C | 2 +- src/mathed/math_cursor.h | 4 +- src/mathed/math_data.C | 6 +- src/mathed/math_data.h | 8 +- src/mathed/math_decorationinset.C | 4 +- src/mathed/math_decorationinset.h | 4 +- src/mathed/math_deliminset.C | 4 +- src/mathed/math_deliminset.h | 4 +- src/mathed/math_diffinset.C | 4 +- src/mathed/math_diffinset.h | 4 +- src/mathed/math_dotsinset.C | 4 +- src/mathed/math_dotsinset.h | 4 +- src/mathed/math_envinset.C | 4 +- src/mathed/math_envinset.h | 6 +- src/mathed/math_ertinset.C | 8 +- src/mathed/math_ertinset.h | 4 +- src/mathed/math_exfuncinset.C | 4 +- src/mathed/math_exfuncinset.h | 4 +- src/mathed/math_exintinset.C | 4 +- src/mathed/math_exintinset.h | 4 +- src/mathed/math_factory.C | 2 +- src/mathed/math_fboxinset.C | 8 +- src/mathed/math_fboxinset.h | 6 +- src/mathed/math_fontinset.C | 8 +- src/mathed/math_fontinset.h | 4 +- src/mathed/math_fontoldinset.C | 8 +- src/mathed/math_fontoldinset.h | 4 +- src/mathed/math_fracinset.C | 8 +- src/mathed/math_fracinset.h | 4 +- src/mathed/math_frameboxinset.C | 8 +- src/mathed/math_frameboxinset.h | 4 +- src/mathed/math_gridinset.C | 87 ++++++---- src/mathed/math_gridinset.h | 4 +- src/mathed/math_hullinset.C | 16 +- src/mathed/math_hullinset.h | 4 +- src/mathed/math_inferinset.C | 4 +- src/mathed/math_inferinset.h | 4 +- src/mathed/math_inset.C | 6 +- src/mathed/math_inset.h | 6 +- src/mathed/math_kerninset.C | 4 +- src/mathed/math_kerninset.h | 4 +- src/mathed/math_lefteqninset.C | 4 +- src/mathed/math_lefteqninset.h | 4 +- src/mathed/math_liminset.C | 4 +- src/mathed/math_liminset.h | 4 +- src/mathed/math_macro.C | 4 +- src/mathed/math_macro.h | 8 +- src/mathed/math_macroarg.C | 4 +- src/mathed/math_macroarg.h | 4 +- src/mathed/math_macrotemplate.C | 4 +- src/mathed/math_macrotemplate.h | 4 +- src/mathed/math_mathmlstream.h | 2 +- src/mathed/math_matrixinset.h | 2 +- src/mathed/math_metricsinfo.h | 144 ---------------- src/mathed/math_nestinset.C | 14 +- src/mathed/math_nestinset.h | 10 +- src/mathed/math_numberinset.C | 4 +- src/mathed/math_numberinset.h | 4 +- src/mathed/math_parboxinset.C | 10 +- src/mathed/math_parboxinset.h | 4 +- src/mathed/math_parinset.C | 8 +- src/mathed/math_parinset.h | 4 +- src/mathed/math_rootinset.C | 4 +- src/mathed/math_rootinset.h | 4 +- src/mathed/math_scriptinset.C | 8 +- src/mathed/math_scriptinset.h | 4 +- src/mathed/math_sizeinset.C | 10 +- src/mathed/math_sizeinset.h | 8 +- src/mathed/math_spaceinset.C | 4 +- src/mathed/math_spaceinset.h | 4 +- src/mathed/math_sqrtinset.C | 4 +- src/mathed/math_sqrtinset.h | 4 +- src/mathed/math_stackrelinset.C | 8 +- src/mathed/math_stackrelinset.h | 4 +- src/mathed/math_stringinset.C | 4 +- src/mathed/math_stringinset.h | 4 +- src/mathed/math_substackinset.C | 4 +- src/mathed/math_substackinset.h | 2 +- src/mathed/math_support.C | 14 +- src/mathed/math_support.h | 14 +- src/mathed/math_symbolinset.C | 8 +- src/mathed/math_symbolinset.h | 4 +- src/mathed/math_tabularinset.C | 10 +- src/mathed/math_tabularinset.h | 4 +- src/mathed/math_textinset.C | 8 +- src/mathed/math_textinset.h | 6 +- src/mathed/math_undersetinset.C | 8 +- src/mathed/math_undersetinset.h | 4 +- src/mathed/math_unknowninset.C | 4 +- src/mathed/math_unknowninset.h | 4 +- src/mathed/math_xarrowinset.C | 8 +- src/mathed/math_xarrowinset.h | 4 +- src/mathed/math_xyarrowinset.C | 8 +- src/mathed/math_xyarrowinset.h | 8 +- src/mathed/math_xymatrixinset.C | 4 +- src/mathed/math_xymatrixinset.h | 2 +- .../math_metricsinfo.C => metricsinfo.C} | 55 +++--- src/metricsinfo.h | 163 ++++++++++++++++++ 128 files changed, 605 insertions(+), 561 deletions(-) delete mode 100644 src/mathed/math_metricsinfo.h rename src/{mathed/math_metricsinfo.C => metricsinfo.C} (51%) create mode 100644 src/metricsinfo.h diff --git a/src/ChangeLog b/src/ChangeLog index b0c6496b16..e6c4d0cc6b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,9 @@ +2003-03-21 André Pönitz + + * metricsinfo.[Ch]: new files containing structures to be passed around + during the two-phase-drawing... + 2003-03-21 André Pönitz * lyxtextclass.C: read 'environment' tag. diff --git a/src/Makefile.am b/src/Makefile.am index 28272f4935..bcbf37e63b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -180,6 +180,8 @@ lyx_SOURCES = \ lyxvc.C \ lyxvc.h \ main.C \ + metricsinfo.C \ + metricsinfo.h \ paragraph.C \ paragraph.h \ paragraph_pimpl.C \ diff --git a/src/lyxrow.C b/src/lyxrow.C index b12b17ad0f..2ba125665e 100644 --- a/src/lyxrow.C +++ b/src/lyxrow.C @@ -28,6 +28,30 @@ Row::Row() {} +Paragraph * Row::par() +{ + return par_; +} + + +Paragraph * Row::par() const +{ + return par_; +} + + +unsigned short Row::height() const +{ + return height_; +} + + +Row * Row::next() const +{ + return next_; +} + + void Row::par(Paragraph * p) { par_ = p; diff --git a/src/lyxrow.h b/src/lyxrow.h index fb53c7d454..68f229f7fb 100644 --- a/src/lyxrow.h +++ b/src/lyxrow.h @@ -124,32 +124,4 @@ private: Row * previous_; }; - -inline -Paragraph * Row::par() -{ - return par_; -} - - -inline -Paragraph * Row::par() const -{ - return par_; -} - - -inline -unsigned short Row::height() const -{ - return height_; -} - - -inline -Row * Row::next() const -{ - return next_; -} - #endif diff --git a/src/mathed/Makefile.am b/src/mathed/Makefile.am index c2a116b542..a10edf4fe9 100644 --- a/src/mathed/Makefile.am +++ b/src/mathed/Makefile.am @@ -103,8 +103,6 @@ libmathed_la_SOURCES = \ math_mathmlstream.h \ math_matrixinset.C \ math_matrixinset.h \ - math_metricsinfo.C \ - math_metricsinfo.h \ math_nestinset.C \ math_nestinset.h \ math_numberinset.C \ diff --git a/src/mathed/button_inset.C b/src/mathed/button_inset.C index 4585b81712..91d6cfcbb1 100644 --- a/src/mathed/button_inset.C +++ b/src/mathed/button_inset.C @@ -3,7 +3,7 @@ #include "button_inset.h" #include "math_support.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" #include "frontends/Painter.h" #include @@ -16,9 +16,9 @@ ButtonInset::ButtonInset() {} -void ButtonInset::metrics(MathMetricsInfo & mi) const +void ButtonInset::metrics(MetricsInfo & mi) const { - MathFontSetChanger dummy(mi.base, "textnormal"); + FontSetChanger dummy(mi.base, "textnormal"); if (editing()) { MathNestInset::metrics(mi); dim_.w = cell(0).width() + cell(1).width() + 4; @@ -31,9 +31,9 @@ void ButtonInset::metrics(MathMetricsInfo & mi) const } -void ButtonInset::draw(MathPainterInfo & pi, int x, int y) const +void ButtonInset::draw(PainterInfo & pi, int x, int y) const { - MathFontSetChanger dummy(pi.base, "textnormal"); + FontSetChanger dummy(pi.base, "textnormal"); if (editing()) { cell(0).draw(pi, x, y); cell(1).draw(pi, x + cell(0).width() + 2, y); diff --git a/src/mathed/button_inset.h b/src/mathed/button_inset.h index 2e402da100..0b1160b66e 100644 --- a/src/mathed/button_inset.h +++ b/src/mathed/button_inset.h @@ -23,9 +23,9 @@ public: /// ButtonInset(); /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; protected: /// This should provide the text for the button diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 15d10238f5..1d7119fc13 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -21,7 +21,7 @@ #include "math_parser.h" #include "math_charinset.h" #include "math_arrayinset.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" #include "math_deliminset.h" #include "math_hullinset.h" #include "math_support.h" @@ -207,7 +207,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font, int const a = ascent(bv, font); int const h = a + d; - MathPainterInfo pi(bv->painter()); + PainterInfo pi(bv->painter()); if (use_preview) { pi.pain.image(x + 1, y - a, w, h, // one pixel gap in front diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 20bc11b66e..6f9d2a4855 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -29,7 +29,7 @@ #include "LaTeXFeatures.h" #include "debug.h" #include "math_support.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" #include "support/lstrings.h" #include "frontends/LyXView.h" #include "frontends/font_metrics.h" @@ -91,7 +91,7 @@ InsetFormulaBase::InsetFormulaBase() // This is needed as long the math parser is not re-entrant initMath(); //lyxerr << "sizeof MathInset: " << sizeof(MathInset) << "\n"; - //lyxerr << "sizeof MathMetricsInfo: " << sizeof(MathMetricsInfo) << "\n"; + //lyxerr << "sizeof MetricsInfo: " << sizeof(MetricsInfo) << "\n"; //lyxerr << "sizeof MathCharInset: " << sizeof(MathCharInset) << "\n"; //lyxerr << "sizeof LyXFont: " << sizeof(LyXFont) << "\n"; } @@ -155,7 +155,7 @@ void InsetFormulaBase::metrics(BufferView * bv) const { if (bv) view_ = bv->owner()->view(); - MathMetricsInfo mi; + MetricsInfo mi; mi.base.style = LM_ST_TEXT; mi.base.font = font_; mi.base.font.setColor(LColor::math); diff --git a/src/mathed/formulamacro.C b/src/mathed/formulamacro.C index c9231fe82c..f44a96aeb1 100644 --- a/src/mathed/formulamacro.C +++ b/src/mathed/formulamacro.C @@ -21,7 +21,7 @@ #include "math_macro.h" #include "math_macrotable.h" #include "math_macrotemplate.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" #include "math_support.h" #include "math_mathmlstream.h" #include "BufferView.h" @@ -177,7 +177,7 @@ void InsetFormulaMacro::draw(BufferView * bv, LyXFont const & f, LyXFont font(f); font.setColor(LColor::math); - MathPainterInfo pi = MathPainterInfo(bv->painter()); + PainterInfo pi = PainterInfo(bv->painter()); pi.base.style = LM_ST_TEXT; pi.base.font = font; diff --git a/src/mathed/math_amsarrayinset.C b/src/mathed/math_amsarrayinset.C index ba0df89a18..ca329ca041 100644 --- a/src/mathed/math_amsarrayinset.C +++ b/src/mathed/math_amsarrayinset.C @@ -3,7 +3,7 @@ #include "math_amsarrayinset.h" #include "math_mathmlstream.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" #include "math_support.h" #include "math_streamstr.h" #include "math_support.h" @@ -58,9 +58,9 @@ char const * MathAMSArrayInset::name_right() const } -void MathAMSArrayInset::metrics(MathMetricsInfo & mi) const +void MathAMSArrayInset::metrics(MetricsInfo & mi) const { - MathMetricsInfo m = mi; + MetricsInfo m = mi; if (m.base.style == LM_ST_DISPLAY) m.base.style = LM_ST_TEXT; MathGridInset::metrics(m); @@ -68,7 +68,7 @@ void MathAMSArrayInset::metrics(MathMetricsInfo & mi) const } -void MathAMSArrayInset::draw(MathPainterInfo & pi, int x, int y) const +void MathAMSArrayInset::draw(PainterInfo & pi, int x, int y) const { MathGridInset::draw(pi, x + 6, y); int const yy = y - ascent(); diff --git a/src/mathed/math_amsarrayinset.h b/src/mathed/math_amsarrayinset.h index 7a96998f0e..aac377e508 100644 --- a/src/mathed/math_amsarrayinset.h +++ b/src/mathed/math_amsarrayinset.h @@ -22,9 +22,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; /// - void draw(MathPainterInfo & pain, int x, int y) const; + void draw(PainterInfo & pain, int x, int y) const; /// MathAMSArrayInset * asAMSArrayInset() { return this; } /// diff --git a/src/mathed/math_arrayinset.C b/src/mathed/math_arrayinset.C index 83e756a574..e035cebee6 100644 --- a/src/mathed/math_arrayinset.C +++ b/src/mathed/math_arrayinset.C @@ -4,7 +4,7 @@ #include "math_arrayinset.h" #include "math_parser.h" #include "math_mathmlstream.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" #include "math_streamstr.h" #include "Lsstream.h" @@ -63,16 +63,16 @@ MathInset * MathArrayInset::clone() const } -void MathArrayInset::metrics(MathMetricsInfo & mi) const +void MathArrayInset::metrics(MetricsInfo & mi) const { - MathArrayChanger dummy(mi.base); + ArrayChanger dummy(mi.base); MathGridInset::metrics(mi); } -void MathArrayInset::draw(MathPainterInfo & pi, int x, int y) const +void MathArrayInset::draw(PainterInfo & pi, int x, int y) const { - MathArrayChanger dummy(pi.base); + ArrayChanger dummy(pi.base); MathGridInset::draw(pi, x, y); } diff --git a/src/mathed/math_arrayinset.h b/src/mathed/math_arrayinset.h index 10fe6146c5..51cde07e0e 100644 --- a/src/mathed/math_arrayinset.h +++ b/src/mathed/math_arrayinset.h @@ -27,9 +27,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// MathArrayInset * asArrayInset() { return this; } /// diff --git a/src/mathed/math_biginset.C b/src/mathed/math_biginset.C index 07f91c8ccc..ecceb7948f 100644 --- a/src/mathed/math_biginset.C +++ b/src/mathed/math_biginset.C @@ -37,7 +37,7 @@ double MathBigInset::increase() const } -void MathBigInset::metrics(MathMetricsInfo & mi) const +void MathBigInset::metrics(MetricsInfo & mi) const { double const h = mathed_char_ascent(mi.base.font, 'I'); double const f = increase(); @@ -47,7 +47,7 @@ void MathBigInset::metrics(MathMetricsInfo & mi) const } -void MathBigInset::draw(MathPainterInfo & pi, int x, int y) const +void MathBigInset::draw(PainterInfo & pi, int x, int y) const { mathed_draw_deco(pi, x + 1, y - ascent(), 4, height(), delim_); } diff --git a/src/mathed/math_biginset.h b/src/mathed/math_biginset.h index aeb1aac6ad..554429e453 100644 --- a/src/mathed/math_biginset.h +++ b/src/mathed/math_biginset.h @@ -26,11 +26,11 @@ public: /// MathInset * clone() const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void write(WriteStream & os) const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; /// void normalize(NormalStream & os) const; diff --git a/src/mathed/math_binaryopinset.C b/src/mathed/math_binaryopinset.C index b38add432d..20966ce96e 100644 --- a/src/mathed/math_binaryopinset.C +++ b/src/mathed/math_binaryopinset.C @@ -2,7 +2,7 @@ #include "math_binaryopinset.h" -#include "MathPainterInfo.h" +#include "PainterInfo.h" #include "support/LOstream.h" #include "math_support.h" #include "math_mathmlstream.h" @@ -28,7 +28,7 @@ int MathBinaryOpInset::opwidth() const } -void MathBinaryOpInset::metrics(MathMetricsInfo & mi) const +void MathBinaryOpInset::metrics(MetricsInfo & mi) const { mi_ = mi; cell(0).metrics(mi); @@ -39,7 +39,7 @@ void MathBinaryOpInset::metrics(MathMetricsInfo & mi) const } -void MathBinaryOpInset::draw(MathPainterInfo & pain, int x, int y) const +void MathBinaryOpInset::draw(PainterInfo & pain, int x, int y) const { cell(0).draw(pain, x, y); drawChar(pain, LM_TC_CONST, mi_, x + cell(0).width() , y, op_); diff --git a/src/mathed/math_binaryopinset.h b/src/mathed/math_binaryopinset.h index 06e0efe186..1a736a396e 100644 --- a/src/mathed/math_binaryopinset.h +++ b/src/mathed/math_binaryopinset.h @@ -18,19 +18,19 @@ public: /// MathInset * clone() const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void write(WriteStream & os) const; /// void normalize(NormalStream &) const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; private: /// int opwidth() const; /// char op_; /// - mutable MathMetricsInfo mi_; + mutable MetricsInfo mi_; }; #endif diff --git a/src/mathed/math_binominset.C b/src/mathed/math_binominset.C index 84a875ec8d..88cc3ed8ba 100644 --- a/src/mathed/math_binominset.C +++ b/src/mathed/math_binominset.C @@ -32,9 +32,9 @@ int MathBinomInset::dw() const } -void MathBinomInset::metrics(MathMetricsInfo & mi) const +void MathBinomInset::metrics(MetricsInfo & mi) const { - MathScriptChanger dummy(mi.base); + ScriptChanger dummy(mi.base); cell(0).metrics(mi); cell(1).metrics(mi); dim_.a = cell(0).height() + 4 + 5; @@ -43,10 +43,10 @@ void MathBinomInset::metrics(MathMetricsInfo & mi) const } -void MathBinomInset::draw(MathPainterInfo & pi, int x, int y) const +void MathBinomInset::draw(PainterInfo & pi, int x, int y) const { int m = x + width() / 2; - MathScriptChanger dummy(pi.base); + ScriptChanger 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_binominset.h b/src/mathed/math_binominset.h index a7c56cfd3b..9894862a40 100644 --- a/src/mathed/math_binominset.h +++ b/src/mathed/math_binominset.h @@ -19,9 +19,9 @@ public: /// void normalize(NormalStream &) const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; private: /// int dw() const; diff --git a/src/mathed/math_boxinset.C b/src/mathed/math_boxinset.C index 135d526944..29c5e2c727 100644 --- a/src/mathed/math_boxinset.C +++ b/src/mathed/math_boxinset.C @@ -33,18 +33,18 @@ void MathBoxInset::normalize(NormalStream & os) const } -void MathBoxInset::metrics(MathMetricsInfo & mi) const +void MathBoxInset::metrics(MetricsInfo & mi) const { - MathFontSetChanger dummy(mi.base, "textnormal"); + FontSetChanger dummy(mi.base, "textnormal"); cell(0).metrics(mi); dim_ = cell(0).dim(); metricsMarkers2(); } -void MathBoxInset::draw(MathPainterInfo & pi, int x, int y) const +void MathBoxInset::draw(PainterInfo & pi, int x, int y) const { - MathFontSetChanger dummy(pi.base, "textnormal"); + FontSetChanger dummy(pi.base, "textnormal"); cell(0).draw(pi, x, y); drawMarkers2(pi, x + 1, y); } diff --git a/src/mathed/math_boxinset.h b/src/mathed/math_boxinset.h index 992d595380..37553b1af6 100644 --- a/src/mathed/math_boxinset.h +++ b/src/mathed/math_boxinset.h @@ -19,9 +19,9 @@ public: /// mode_type currentMode() const { return TEXT_MODE; } /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void write(WriteStream & os) const; /// diff --git a/src/mathed/math_braceinset.C b/src/mathed/math_braceinset.C index 4cd94c1950..b0213e2c38 100644 --- a/src/mathed/math_braceinset.C +++ b/src/mathed/math_braceinset.C @@ -28,7 +28,7 @@ MathInset * MathBraceInset::clone() const } -void MathBraceInset::metrics(MathMetricsInfo & mi) const +void MathBraceInset::metrics(MetricsInfo & mi) const { cell(0).metrics(mi); Dimension t; @@ -40,7 +40,7 @@ void MathBraceInset::metrics(MathMetricsInfo & mi) const } -void MathBraceInset::draw(MathPainterInfo & pi, int x, int y) const +void MathBraceInset::draw(PainterInfo & pi, int x, int y) const { LyXFont font = pi.base.font; font.setColor(LColor::latex); diff --git a/src/mathed/math_braceinset.h b/src/mathed/math_braceinset.h index 133ee5e8a0..7ba25f3d6a 100644 --- a/src/mathed/math_braceinset.h +++ b/src/mathed/math_braceinset.h @@ -22,9 +22,9 @@ public: /// we write extra braces in any case... bool extraBraces() const { return true; } /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void write(WriteStream & os) const; /// write normalized content diff --git a/src/mathed/math_casesinset.C b/src/mathed/math_casesinset.C index be93fe8f2c..ae53aa089d 100644 --- a/src/mathed/math_casesinset.C +++ b/src/mathed/math_casesinset.C @@ -20,14 +20,14 @@ MathInset * MathCasesInset::clone() const } -void MathCasesInset::metrics(MathMetricsInfo & mi) const +void MathCasesInset::metrics(MetricsInfo & mi) const { MathGridInset::metrics(mi); dim_.w += 8; } -void MathCasesInset::draw(MathPainterInfo & pain, int x, int y) const +void MathCasesInset::draw(PainterInfo & pain, int x, int y) const { mathed_draw_deco(pain, x + 1, y - ascent(), 6, height(), "{"); MathGridInset::draw(pain, x + 8, y); diff --git a/src/mathed/math_casesinset.h b/src/mathed/math_casesinset.h index 60efc5336c..93398d104b 100644 --- a/src/mathed/math_casesinset.h +++ b/src/mathed/math_casesinset.h @@ -14,9 +14,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; /// - void draw(MathPainterInfo & pain, int x, int y) const; + void draw(PainterInfo & pain, int x, int y) const; /// void infoize(std::ostream & os) const; diff --git a/src/mathed/math_charinset.C b/src/mathed/math_charinset.C index b7e49f6c73..f19371233c 100644 --- a/src/mathed/math_charinset.C +++ b/src/mathed/math_charinset.C @@ -55,17 +55,17 @@ MathInset * MathCharInset::clone() const } -void MathCharInset::metrics(MathMetricsInfo & mi) const +void MathCharInset::metrics(MetricsInfo & mi) const { #if 1 if (char_ == '=' && has_math_fonts) { - MathFontSetChanger dummy(mi.base, "cmr"); + FontSetChanger dummy(mi.base, "cmr"); mathed_char_dim(mi.base.font, char_, dim_); } else if ((char_ == '>' || char_ == '<') && has_math_fonts) { - MathFontSetChanger dummy(mi.base, "cmm"); + FontSetChanger dummy(mi.base, "cmm"); mathed_char_dim(mi.base.font, char_, dim_); } else if (slanted(char_) && mi.base.fontname == "mathnormal") { - MathShapeChanger dummy(mi.base.font, LyXFont::ITALIC_SHAPE); + ShapeChanger dummy(mi.base.font, LyXFont::ITALIC_SHAPE); mathed_char_dim(mi.base.font, char_, dim_); } else { mathed_char_dim(mi.base.font, char_, dim_); @@ -85,7 +85,7 @@ void MathCharInset::metrics(MathMetricsInfo & mi) const } -void MathCharInset::draw(MathPainterInfo & pi, int x, int y) const +void MathCharInset::draw(PainterInfo & pi, int x, int y) const { //lyxerr << "drawing '" << char_ << "' font: " << pi.base.fontname << endl; int const em = mathed_char_width(pi.base.font, 'M'); @@ -95,13 +95,13 @@ void MathCharInset::draw(MathPainterInfo & pi, int x, int y) const x += static_cast(0.0833*em+0.5); #if 1 if (char_ == '=' && has_math_fonts) { - MathFontSetChanger dummy(pi.base, "cmr"); + FontSetChanger dummy(pi.base, "cmr"); pi.draw(x, y, char_); } else if ((char_ == '>' || char_ == '<') && has_math_fonts) { - MathFontSetChanger dummy(pi.base, "cmm"); + FontSetChanger dummy(pi.base, "cmm"); pi.draw(x, y, char_); } else if (slanted(char_) && pi.base.fontname == "mathnormal") { - MathShapeChanger dummy(pi.base.font, LyXFont::ITALIC_SHAPE); + ShapeChanger dummy(pi.base.font, LyXFont::ITALIC_SHAPE); pi.draw(x, y, char_); } else { pi.draw(x, y, char_); diff --git a/src/mathed/math_charinset.h b/src/mathed/math_charinset.h index 3673ba15c5..1f9fa26ccf 100644 --- a/src/mathed/math_charinset.h +++ b/src/mathed/math_charinset.h @@ -18,9 +18,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void metricsT(TextMetricsInfo const & st) const; /// diff --git a/src/mathed/math_commentinset.C b/src/mathed/math_commentinset.C index 929b544e57..047b6ea166 100644 --- a/src/mathed/math_commentinset.C +++ b/src/mathed/math_commentinset.C @@ -27,14 +27,14 @@ MathInset * MathCommentInset::clone() const } -void MathCommentInset::metrics(MathMetricsInfo & mi) const +void MathCommentInset::metrics(MetricsInfo & mi) const { dim_ = cell(0).metrics(mi); metricsMarkers(); } -void MathCommentInset::draw(MathPainterInfo & pi, int x, int y) const +void MathCommentInset::draw(PainterInfo & pi, int x, int y) const { cell(0).draw(pi, x + 1, y); drawMarkers(pi, x, y); diff --git a/src/mathed/math_commentinset.h b/src/mathed/math_commentinset.h index e4827c89e1..bb2619dd7c 100644 --- a/src/mathed/math_commentinset.h +++ b/src/mathed/math_commentinset.h @@ -22,9 +22,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void metricsT(TextMetricsInfo const & mi) const; /// diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index cfc4f88e56..b5032bde44 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -608,7 +608,7 @@ void MathCursor::selClearOrDel() } -void MathCursor::drawSelection(MathPainterInfo & pi) const +void MathCursor::drawSelection(PainterInfo & pi) const { if (!selection_) return; diff --git a/src/mathed/math_cursor.h b/src/mathed/math_cursor.h index 8043f3b7d9..6e33ddf5bf 100644 --- a/src/mathed/math_cursor.h +++ b/src/mathed/math_cursor.h @@ -24,7 +24,7 @@ class InsetFormulaBase; class BufferView; -class MathPainterInfo; +class PainterInfo; class MathUnknownInset; /** @@ -160,7 +160,7 @@ public: /// clears or deletes selection depending on lyxrc setting void selClearOrDel(); /// draws light-blue selection background - void drawSelection(MathPainterInfo & pi) const; + void drawSelection(PainterInfo & pi) const; /// void handleNest(MathAtom const & at); /// remove this as soon as LyXFunc::getStatus is "localized" diff --git a/src/mathed/math_data.C b/src/mathed/math_data.C index 1f65cd705a..34a27220ee 100644 --- a/src/mathed/math_data.C +++ b/src/mathed/math_data.C @@ -12,7 +12,7 @@ #include "math_replace.h" #include "debug.h" #include "support/LAssert.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" #include "frontends/Painter.h" #include "textpainter.h" @@ -204,7 +204,7 @@ void MathArray::touch() const } -Dimension const & MathArray::metrics(MathMetricsInfo & mi) const +Dimension const & MathArray::metrics(MetricsInfo & mi) const { //if (clean_) // return; @@ -224,7 +224,7 @@ Dimension const & MathArray::metrics(MathMetricsInfo & mi) const } -void MathArray::draw(MathPainterInfo & pi, int x, int y) const +void MathArray::draw(PainterInfo & pi, int x, int y) const { //if (drawn_ && x == xo_ && y == yo_) // return; diff --git a/src/mathed/math_data.h b/src/mathed/math_data.h index 8de3ed250e..1749c3da74 100644 --- a/src/mathed/math_data.h +++ b/src/mathed/math_data.h @@ -26,8 +26,8 @@ class MathMacro; class LaTeXFeatures; class ReplaceData; -class MathMetricsInfo; -class MathPainterInfo; +class MetricsInfo; +class PainterInfo; class TextMetricsInfo; class TextPainter; @@ -105,9 +105,9 @@ public: /// checked read access MathAtom const & operator[](pos_type) const; /// rebuild cached metrics information - Dimension const & metrics(MathMetricsInfo & mi) const; + Dimension const & metrics(MetricsInfo & mi) const; /// redraw cell using cache metrics information - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// rebuild cached metrics information Dimension const & metricsT(TextMetricsInfo const & mi) const; /// redraw cell using cache metrics information diff --git a/src/mathed/math_decorationinset.C b/src/mathed/math_decorationinset.C index 2701258775..fc8aee71a9 100644 --- a/src/mathed/math_decorationinset.C +++ b/src/mathed/math_decorationinset.C @@ -72,7 +72,7 @@ bool MathDecorationInset::wide() const } -void MathDecorationInset::metrics(MathMetricsInfo & mi) const +void MathDecorationInset::metrics(MetricsInfo & mi) const { cell(0).metrics(mi); dim_ = cell(0).dim(); @@ -91,7 +91,7 @@ void MathDecorationInset::metrics(MathMetricsInfo & mi) const } -void MathDecorationInset::draw(MathPainterInfo & pi, int x, int y) const +void MathDecorationInset::draw(PainterInfo & pi, int x, int y) const { cell(0).draw(pi, x + 1, y); if (wide()) diff --git a/src/mathed/math_decorationinset.h b/src/mathed/math_decorationinset.h index 97c56ba383..09c50d58d3 100644 --- a/src/mathed/math_decorationinset.h +++ b/src/mathed/math_decorationinset.h @@ -21,11 +21,11 @@ public: /// MathInset * clone() const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void write(WriteStream & os) const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// void normalize(NormalStream & os) const; /// diff --git a/src/mathed/math_deliminset.C b/src/mathed/math_deliminset.C index bb7dbce5e9..ea73243b1f 100644 --- a/src/mathed/math_deliminset.C +++ b/src/mathed/math_deliminset.C @@ -84,7 +84,7 @@ int MathDelimInset::dw() const } -void MathDelimInset::metrics(MathMetricsInfo & mi) const +void MathDelimInset::metrics(MetricsInfo & mi) const { cell(0).metrics(mi); Dimension t; @@ -98,7 +98,7 @@ void MathDelimInset::metrics(MathMetricsInfo & mi) const } -void MathDelimInset::draw(MathPainterInfo & pi, int x, int y) const +void MathDelimInset::draw(PainterInfo & pi, int x, int y) const { int const w = dw(); int const b = y - ascent(); diff --git a/src/mathed/math_deliminset.h b/src/mathed/math_deliminset.h index 8c1feef1ed..54ec58cab9 100644 --- a/src/mathed/math_deliminset.h +++ b/src/mathed/math_deliminset.h @@ -31,9 +31,9 @@ public: /// is it |...|? bool isAbs() const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void write(WriteStream & os) const; diff --git a/src/mathed/math_diffinset.C b/src/mathed/math_diffinset.C index d872157586..de162b5b6e 100644 --- a/src/mathed/math_diffinset.C +++ b/src/mathed/math_diffinset.C @@ -32,13 +32,13 @@ void MathDiffInset::normalize(NormalStream & os) const } -void MathDiffInset::metrics(MathMetricsInfo &) const +void MathDiffInset::metrics(MetricsInfo &) const { lyxerr << "should not happen\n"; } -void MathDiffInset::draw(MathPainterInfo &, int, int) const +void MathDiffInset::draw(PainterInfo &, int, int) const { lyxerr << "should not happen\n"; } diff --git a/src/mathed/math_diffinset.h b/src/mathed/math_diffinset.h index 651a60d67b..16e67642cf 100644 --- a/src/mathed/math_diffinset.h +++ b/src/mathed/math_diffinset.h @@ -17,9 +17,9 @@ public: /// void addDer(MathArray const & der); /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void normalize(NormalStream &) const; diff --git a/src/mathed/math_dotsinset.C b/src/mathed/math_dotsinset.C index 8251356cf7..c322ada2b3 100644 --- a/src/mathed/math_dotsinset.C +++ b/src/mathed/math_dotsinset.C @@ -19,7 +19,7 @@ MathInset * MathDotsInset::clone() const } -void MathDotsInset::metrics(MathMetricsInfo & mi) const +void MathDotsInset::metrics(MetricsInfo & mi) const { mathed_char_dim(mi.base.font, 'M', dim_); dh_ = 0; @@ -37,7 +37,7 @@ void MathDotsInset::metrics(MathMetricsInfo & mi) const } -void MathDotsInset::draw(MathPainterInfo & pain, int x, int y) const +void MathDotsInset::draw(PainterInfo & pain, int x, int y) const { mathed_draw_deco(pain, x + 2, y - dh_, width() - 2, ascent(), key_->name); if (key_->name == "vdots" || key_->name == "ddots") diff --git a/src/mathed/math_dotsinset.h b/src/mathed/math_dotsinset.h index 967435d93e..0eb9b3b1a7 100644 --- a/src/mathed/math_dotsinset.h +++ b/src/mathed/math_dotsinset.h @@ -15,9 +15,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// string name() const; protected: diff --git a/src/mathed/math_envinset.C b/src/mathed/math_envinset.C index c4a6ef7102..1fe6093ee6 100644 --- a/src/mathed/math_envinset.C +++ b/src/mathed/math_envinset.C @@ -18,14 +18,14 @@ MathInset * MathEnvInset::clone() const } -void MathEnvInset::metrics(MathMetricsInfo & mi) const +void MathEnvInset::metrics(MetricsInfo & mi) const { dim_ = cell(0).metrics(mi); metricsMarkers2(); } -void MathEnvInset::draw(MathPainterInfo & pi, int x, int y) const +void MathEnvInset::draw(PainterInfo & pi, int x, int y) const { cell(0).draw(pi, x + 1, y); drawMarkers2(pi, x, y); diff --git a/src/mathed/math_envinset.h b/src/mathed/math_envinset.h index 363554a1b1..f56622f28b 100644 --- a/src/mathed/math_envinset.h +++ b/src/mathed/math_envinset.h @@ -3,7 +3,7 @@ #define MATH_ENVINSET_H #include "math_nestinset.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" /** Environtments á la \begin{something}...\end{something} @@ -19,13 +19,13 @@ public: /// MathInset * clone() const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void write(WriteStream & os) const; /// write normalized content void normalize(NormalStream & ns) const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// void infoize(std::ostream & os) const; diff --git a/src/mathed/math_ertinset.C b/src/mathed/math_ertinset.C index 60479696a3..eeeca0c9e4 100644 --- a/src/mathed/math_ertinset.C +++ b/src/mathed/math_ertinset.C @@ -12,18 +12,18 @@ MathInset * MathErtInset::clone() const } -void MathErtInset::metrics(MathMetricsInfo & mi) const +void MathErtInset::metrics(MetricsInfo & mi) const { - MathFontSetChanger dummy(mi.base, "lyxert"); + FontSetChanger dummy(mi.base, "lyxert"); MathTextInset::metrics(mi); cache_.colinfo_[0].align_ = 'l'; metricsMarkers2(); } -void MathErtInset::draw(MathPainterInfo & pi, int x, int y) const +void MathErtInset::draw(PainterInfo & pi, int x, int y) const { - MathFontSetChanger dummy(pi.base, "lyxert"); + FontSetChanger dummy(pi.base, "lyxert"); MathTextInset::draw(pi, x + 1, y); drawMarkers2(pi, x, y); } diff --git a/src/mathed/math_ertinset.h b/src/mathed/math_ertinset.h index 86b126b217..77680bfb1e 100644 --- a/src/mathed/math_ertinset.h +++ b/src/mathed/math_ertinset.h @@ -15,9 +15,9 @@ public: /// mode_type currentMode() const { return TEXT_MODE; } /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void infoize(std::ostream & os) const; /// diff --git a/src/mathed/math_exfuncinset.C b/src/mathed/math_exfuncinset.C index e0b6e1c049..e81c032fb7 100644 --- a/src/mathed/math_exfuncinset.C +++ b/src/mathed/math_exfuncinset.C @@ -25,13 +25,13 @@ MathInset * MathExFuncInset::clone() const } -void MathExFuncInset::metrics(MathMetricsInfo & mi) const +void MathExFuncInset::metrics(MetricsInfo & mi) const { mathed_string_dim(mi.base.font, name_, dim_); } -void MathExFuncInset::draw(MathPainterInfo & pi, int x, int y) const +void MathExFuncInset::draw(PainterInfo & pi, int x, int y) const { drawStrBlack(pi, x, y, name_); } diff --git a/src/mathed/math_exfuncinset.h b/src/mathed/math_exfuncinset.h index 1e0b04d9c6..a123101951 100644 --- a/src/mathed/math_exfuncinset.h +++ b/src/mathed/math_exfuncinset.h @@ -17,9 +17,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// string name() const; diff --git a/src/mathed/math_exintinset.C b/src/mathed/math_exintinset.C index 4cdf247e41..2f9d07ca19 100644 --- a/src/mathed/math_exintinset.C +++ b/src/mathed/math_exintinset.C @@ -48,13 +48,13 @@ void MathExIntInset::normalize(NormalStream & os) const } -void MathExIntInset::metrics(MathMetricsInfo &) const +void MathExIntInset::metrics(MetricsInfo &) const { lyxerr << "should not happen\n"; } -void MathExIntInset::draw(MathPainterInfo &, int, int) const +void MathExIntInset::draw(PainterInfo &, int, int) const { lyxerr << "should not happen\n"; } diff --git a/src/mathed/math_exintinset.h b/src/mathed/math_exintinset.h index 71aefb4607..9681b31b59 100644 --- a/src/mathed/math_exintinset.h +++ b/src/mathed/math_exintinset.h @@ -18,9 +18,9 @@ public: /// void symbol(string const &); /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void normalize(NormalStream &) const; diff --git a/src/mathed/math_factory.C b/src/mathed/math_factory.C index 68166b7215..b0fa5e7dff 100644 --- a/src/mathed/math_factory.C +++ b/src/mathed/math_factory.C @@ -41,7 +41,7 @@ //#include "insets/insetref.h" #include "ref_inset.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" #include "debug.h" #include "math_support.h" #include "Lsstream.h" diff --git a/src/mathed/math_fboxinset.C b/src/mathed/math_fboxinset.C index 0b7f49d669..d6f9e1fbd4 100644 --- a/src/mathed/math_fboxinset.C +++ b/src/mathed/math_fboxinset.C @@ -29,10 +29,10 @@ MathInset::mode_type MathFboxInset::currentMode() const } -void MathFboxInset::metrics(MathMetricsInfo & mi) const +void MathFboxInset::metrics(MetricsInfo & mi) const { if (key_->name == "fbox") { - MathFontSetChanger dummy(mi.base, "textnormal"); + FontSetChanger dummy(mi.base, "textnormal"); dim_ = cell(0).metrics(mi); metricsMarkers2(5); // 5 pixels margin } else { @@ -42,12 +42,12 @@ void MathFboxInset::metrics(MathMetricsInfo & mi) const } -void MathFboxInset::draw(MathPainterInfo & pi, int x, int y) const +void MathFboxInset::draw(PainterInfo & pi, int x, int y) const { pi.pain.rectangle(x + 1, y - ascent() + 1, width() - 2, height() - 2, LColor::black); if (key_->name == "fbox") { - MathFontSetChanger dummy(pi.base, "textnormal"); + FontSetChanger dummy(pi.base, "textnormal"); cell(0).draw(pi, x + 5, y); } else { cell(0).draw(pi, x + 5, y); diff --git a/src/mathed/math_fboxinset.h b/src/mathed/math_fboxinset.h index eb385816e5..549dab00ea 100644 --- a/src/mathed/math_fboxinset.h +++ b/src/mathed/math_fboxinset.h @@ -3,7 +3,7 @@ #define MATH_FBOXINSET_H #include "math_nestinset.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" /** Extra nesting @@ -23,9 +23,9 @@ public: /// mode_type currentMode() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void write(WriteStream & os) const; /// write normalized content diff --git a/src/mathed/math_fontinset.C b/src/mathed/math_fontinset.C index 9a288afd73..a73dbb78ff 100644 --- a/src/mathed/math_fontinset.C +++ b/src/mathed/math_fontinset.C @@ -33,17 +33,17 @@ MathInset::mode_type MathFontInset::currentMode() const } -void MathFontInset::metrics(MathMetricsInfo & mi) const +void MathFontInset::metrics(MetricsInfo & mi) const { - MathFontSetChanger dummy(mi.base, key_->name.c_str()); + FontSetChanger dummy(mi.base, key_->name.c_str()); dim_ = cell(0).metrics(mi); metricsMarkers(); } -void MathFontInset::draw(MathPainterInfo & pi, int x, int y) const +void MathFontInset::draw(PainterInfo & pi, int x, int y) const { - MathFontSetChanger dummy(pi.base, key_->name.c_str()); + FontSetChanger dummy(pi.base, key_->name.c_str()); cell(0).draw(pi, x + 1, y); drawMarkers(pi, x, y); } diff --git a/src/mathed/math_fontinset.h b/src/mathed/math_fontinset.h index 48791027ac..7673b07422 100644 --- a/src/mathed/math_fontinset.h +++ b/src/mathed/math_fontinset.h @@ -28,9 +28,9 @@ public: /// string name() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void metricsT(TextMetricsInfo const & mi) const; /// diff --git a/src/mathed/math_fontoldinset.C b/src/mathed/math_fontoldinset.C index cb0e3ba4ee..11bf5f153c 100644 --- a/src/mathed/math_fontoldinset.C +++ b/src/mathed/math_fontoldinset.C @@ -25,17 +25,17 @@ MathInset * MathFontOldInset::clone() const } -void MathFontOldInset::metrics(MathMetricsInfo & mi) const +void MathFontOldInset::metrics(MetricsInfo & mi) const { - MathFontSetChanger dummy(mi.base, key_->name.c_str()); + FontSetChanger dummy(mi.base, key_->name.c_str()); dim_ = cell(0).metrics(mi); metricsMarkers(); } -void MathFontOldInset::draw(MathPainterInfo & pi, int x, int y) const +void MathFontOldInset::draw(PainterInfo & pi, int x, int y) const { - MathFontSetChanger dummy(pi.base, key_->name.c_str()); + FontSetChanger dummy(pi.base, key_->name.c_str()); cell(0).draw(pi, x + 1, y); drawMarkers(pi, x, y); } diff --git a/src/mathed/math_fontoldinset.h b/src/mathed/math_fontoldinset.h index 98f7e52286..8d68e3064e 100644 --- a/src/mathed/math_fontoldinset.h +++ b/src/mathed/math_fontoldinset.h @@ -24,9 +24,9 @@ public: /// we write extra braces in any case... bool extraBraces() const { return true; } /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void metricsT(TextMetricsInfo const & mi) const; /// diff --git a/src/mathed/math_fracinset.C b/src/mathed/math_fracinset.C index ec0517161d..5af56d7b53 100644 --- a/src/mathed/math_fracinset.C +++ b/src/mathed/math_fracinset.C @@ -32,9 +32,9 @@ MathFracInset const * MathFracInset::asFracInset() const } -void MathFracInset::metrics(MathMetricsInfo & mi) const +void MathFracInset::metrics(MetricsInfo & mi) const { - MathFracChanger dummy(mi.base); + FracChanger dummy(mi.base); cell(0).metrics(mi); cell(1).metrics(mi); dim_.w = max(cell(0).width(), cell(1).width()) + 2; @@ -43,10 +43,10 @@ void MathFracInset::metrics(MathMetricsInfo & mi) const } -void MathFracInset::draw(MathPainterInfo & pi, int x, int y) const +void MathFracInset::draw(PainterInfo & pi, int x, int y) const { int m = x + width() / 2; - MathFracChanger dummy(pi.base); + FracChanger dummy(pi.base); cell(0).draw(pi, m - cell(0).width() / 2, y - cell(0).descent() - 2 - 5); cell(1).draw(pi, m - cell(1).width() / 2, y + cell(1).ascent() + 2 - 5); if (!atop_) diff --git a/src/mathed/math_fracinset.h b/src/mathed/math_fracinset.h index 53ec035ca6..a720ed93a8 100644 --- a/src/mathed/math_fracinset.h +++ b/src/mathed/math_fracinset.h @@ -17,9 +17,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void metricsT(TextMetricsInfo const & mi) const; /// diff --git a/src/mathed/math_frameboxinset.C b/src/mathed/math_frameboxinset.C index 88f69a9957..44306c45bd 100644 --- a/src/mathed/math_frameboxinset.C +++ b/src/mathed/math_frameboxinset.C @@ -20,9 +20,9 @@ MathInset * MathFrameboxInset::clone() const } -void MathFrameboxInset::metrics(MathMetricsInfo & mi) const +void MathFrameboxInset::metrics(MetricsInfo & mi) const { - MathFontSetChanger dummy(mi.base, "textnormal"); + FontSetChanger dummy(mi.base, "textnormal"); w_ = mathed_char_width(mi.base.font, '['); MathNestInset::metrics(mi); dim_ = cell(0).dim(); @@ -33,9 +33,9 @@ void MathFrameboxInset::metrics(MathMetricsInfo & mi) const } -void MathFrameboxInset::draw(MathPainterInfo & pi, int x, int y) const +void MathFrameboxInset::draw(PainterInfo & pi, int x, int y) const { - MathFontSetChanger dummy(pi.base, "textnormal"); + FontSetChanger dummy(pi.base, "textnormal"); pi.pain.rectangle(x + 1, y - ascent() + 1, width() - 2, height() - 2, LColor::black); x += 5; diff --git a/src/mathed/math_frameboxinset.h b/src/mathed/math_frameboxinset.h index c93cdb9cbe..a102afddaa 100644 --- a/src/mathed/math_frameboxinset.h +++ b/src/mathed/math_frameboxinset.h @@ -18,9 +18,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void write(WriteStream & os) const; /// write normalized content diff --git a/src/mathed/math_gridinset.C b/src/mathed/math_gridinset.C index 7b773ed54d..fd8ef6e11c 100644 --- a/src/mathed/math_gridinset.C +++ b/src/mathed/math_gridinset.C @@ -14,6 +14,7 @@ using std::swap; using std::max; using std::min; using std::vector; +using std::istream; class GridInsetMailer : public MailInset { @@ -56,8 +57,17 @@ string verboseHLine(int n) return res; } + +int extractInt(istream & is) +{ + int num = 1; + is >> num; + return (num == 0) ? 1 : num; } +} + + ////////////////////////////////////////////////////////////// @@ -288,7 +298,7 @@ LyXLength MathGridInset::vcrskip(row_type row) const } -void MathGridInset::metrics(MathMetricsInfo & mi) const +void MathGridInset::metrics(MetricsInfo & mi) const { // let the cells adjust themselves MathNestInset::metrics(mi); @@ -427,7 +437,7 @@ void MathGridInset::metrics(MathMetricsInfo & mi) const } -void MathGridInset::draw(MathPainterInfo & pi, int x, int y) const +void MathGridInset::draw(PainterInfo & pi, int x, int y) const { for (idx_type idx = 0; idx < nargs(); ++idx) cell(idx).draw(pi, x + cellXOffset(idx), y + cellYOffset(idx)); @@ -1063,49 +1073,62 @@ dispatch_result MathGridInset::dispatch return DISPATCHED_POP; } - case LFUN_TABULAR_FEATURE: + case LFUN_TABULAR_FEATURE: { //lyxerr << "handling tabular-feature " << cmd.argument << "\n"; - if (cmd.argument == "valign-top") + istringstream is(cmd.argument); + string s; + is >> s; + if (s == "valign-top") valign('t'); - else if (cmd.argument == "valign-center") + else if (s == "valign-center") valign('c'); - else if (cmd.argument == "valign-bottom") + else if (s == "valign-bottom") valign('b'); - else if (cmd.argument == "align-left") + else if (s == "align-left") halign('l', col(idx)); - else if (cmd.argument == "align-right") + else if (s == "align-right") halign('r', col(idx)); - else if (cmd.argument == "align-center") + else if (s == "align-center") halign('c', col(idx)); - else if (cmd.argument == "append-row") - addRow(row(idx)); - else if (cmd.argument == "delete-row") { - delRow(row(idx)); - if (idx > nargs()) - idx -= ncols(); - } else if (cmd.argument == "copy-row") - copyRow(row(idx)); - else if (cmd.argument == "swap-row") + else if (s == "append-row") + for (int i = 0, n = extractInt(is); i < n; ++i) + addRow(row(idx)); + else if (s == "delete-row") + for (int i = 0, n = extractInt(is); i < n; ++i) { + delRow(row(idx)); + if (idx > nargs()) + idx -= ncols(); + } + else if (s == "copy-row") + for (int i = 0, n = extractInt(is); i < n; ++i) + copyRow(row(idx)); + else if (s == "swap-row") swapRow(row(idx)); - else if (cmd.argument == "append-column") { - row_type r = row(idx); - col_type c = col(idx); - addCol(c); - idx = index(r, c); - } else if (cmd.argument == "delete-column") { - row_type r = row(idx); - col_type c = col(idx); - delCol(col(idx)); - idx = index(r, c); - if (idx > nargs()) - idx -= ncols(); - } else if (cmd.argument == "copy-column") + else if (s == "append-column") + for (int i = 0, n = extractInt(is); i < n; ++i) { + row_type r = row(idx); + col_type c = col(idx); + addCol(c); + idx = index(r, c); + } + else if (s == "delete-column") + for (int i = 0, n = extractInt(is); i < n; ++i) { + row_type r = row(idx); + col_type c = col(idx); + delCol(col(idx)); + idx = index(r, c); + if (idx > nargs()) + idx -= ncols(); + } + else if (s == "copy-column") copyCol(col(idx)); - else if (cmd.argument == "swap-column") + else if (s == "swap-column") swapCol(col(idx)); else return UNDISPATCHED; + lyxerr << "returning DISPATCHED_POP\n"; return DISPATCHED_POP; + } case LFUN_PASTE: { //lyxerr << "pasting '" << cmd.argument << "'\n"; diff --git a/src/mathed/math_gridinset.h b/src/mathed/math_gridinset.h index 1a94eb36a1..1beffcb7c1 100644 --- a/src/mathed/math_gridinset.h +++ b/src/mathed/math_gridinset.h @@ -92,9 +92,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void metricsT(TextMetricsInfo const & mi) const; /// diff --git a/src/mathed/math_hullinset.C b/src/mathed/math_hullinset.C index c70f25fa74..c127190139 100644 --- a/src/mathed/math_hullinset.C +++ b/src/mathed/math_hullinset.C @@ -166,10 +166,10 @@ char const * MathHullInset::standardFont() const } -void MathHullInset::metrics(MathMetricsInfo & mi) const +void MathHullInset::metrics(MetricsInfo & mi) const { - MathFontSetChanger dummy1(mi.base, standardFont()); - MathStyleChanger dummy2(mi.base, display() ? LM_ST_DISPLAY : LM_ST_TEXT); + FontSetChanger dummy1(mi.base, standardFont()); + StyleChanger dummy2(mi.base, display() ? LM_ST_DISPLAY : LM_ST_TEXT); // let the cells adjust themselves MathGridInset::metrics(mi); @@ -180,7 +180,7 @@ void MathHullInset::metrics(MathMetricsInfo & mi) const } if (numberedType()) { - MathFontSetChanger dummy(mi.base, "mathbf"); + FontSetChanger dummy(mi.base, "mathbf"); int l = 0; for (row_type row = 0; row < nrows(); ++row) l = max(l, mathed_string_width(mi.base.font, nicelabel(row))); @@ -201,17 +201,17 @@ void MathHullInset::metrics(MathMetricsInfo & mi) const } -void MathHullInset::draw(MathPainterInfo & pi, int x, int y) const +void MathHullInset::draw(PainterInfo & pi, int x, int y) const { - MathFontSetChanger dummy1(pi.base, standardFont()); - MathStyleChanger dummy2(pi.base, display() ? LM_ST_DISPLAY : LM_ST_TEXT); + FontSetChanger dummy1(pi.base, standardFont()); + StyleChanger dummy2(pi.base, display() ? LM_ST_DISPLAY : LM_ST_TEXT); MathGridInset::draw(pi, x + 1, y); if (numberedType()) { int const xx = x + colinfo_.back().offset_ + colinfo_.back().width_ + 20; for (row_type row = 0; row < nrows(); ++row) { int const yy = y + rowinfo_[row].offset_; - MathFontSetChanger dummy(pi.base, "mathrm"); + FontSetChanger dummy(pi.base, "mathrm"); drawStr(pi, pi.base.font, xx, yy, nicelabel(row)); } } diff --git a/src/mathed/math_hullinset.h b/src/mathed/math_hullinset.h index 63e580f105..3beaa30e4f 100644 --- a/src/mathed/math_hullinset.h +++ b/src/mathed/math_hullinset.h @@ -24,9 +24,9 @@ public: /// mode_type currentMode() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void metricsT(TextMetricsInfo const & mi) const; /// diff --git a/src/mathed/math_inferinset.C b/src/mathed/math_inferinset.C index 5148d0e952..930fec7a82 100644 --- a/src/mathed/math_inferinset.C +++ b/src/mathed/math_inferinset.C @@ -17,12 +17,12 @@ MathInset * MathInferInset::clone() const } -void MathInferInset::metrics(MathMetricsInfo &) const +void MathInferInset::metrics(MetricsInfo &) const { } -void MathInferInset::draw(MathPainterInfo &, int, int) const +void MathInferInset::draw(PainterInfo &, int, int) const { } diff --git a/src/mathed/math_inferinset.h b/src/mathed/math_inferinset.h index 057dd98199..ca74627bc5 100644 --- a/src/mathed/math_inferinset.h +++ b/src/mathed/math_inferinset.h @@ -17,9 +17,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void write(WriteStream & os) const; diff --git a/src/mathed/math_inset.C b/src/mathed/math_inset.C index 4c8038cc09..48763a7526 100644 --- a/src/mathed/math_inset.C +++ b/src/mathed/math_inset.C @@ -166,19 +166,19 @@ bool MathInset::idxBetween(idx_type idx, idx_type from, idx_type to) const } -void MathInset::metrics(MathMetricsInfo &) const +void MathInset::metrics(MetricsInfo &) const { lyxerr << "MathInset::metrics() called directly!\n"; } -void MathInset::draw(MathPainterInfo &, int, int) const +void MathInset::draw(PainterInfo &, int, int) const { lyxerr << "MathInset::draw() called directly!\n"; } -void MathInset::drawSelection(MathPainterInfo &, +void MathInset::drawSelection(PainterInfo &, idx_type, pos_type, idx_type, pos_type) const { lyxerr << "MathInset::drawSelection() called directly!\n"; diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index ed95d8d3e2..fa8d1a98a3 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -107,11 +107,11 @@ public: virtual void substitute(MathMacro const & macro); /// compute the size of the object, sets ascend_, descend_ and width_ // updates the (xo,yo)-caches of all contained cells - virtual void metrics(MathMetricsInfo & mi) const; + virtual void metrics(MetricsInfo & mi) const; /// draw the object - virtual void draw(MathPainterInfo & pi, int x, int y) const; + virtual void draw(PainterInfo & pi, int x, int y) const; /// draw selection between two positions - virtual void drawSelection(MathPainterInfo & pi, + virtual void drawSelection(PainterInfo & pi, idx_type idx1, pos_type pos1, idx_type idx2, pos_type pos2) const; /// the ascent of the inset above the baseline /// compute the size of the object for text based drawing diff --git a/src/mathed/math_kerninset.C b/src/mathed/math_kerninset.C index 0b03d25fa8..9d7f7489e3 100644 --- a/src/mathed/math_kerninset.C +++ b/src/mathed/math_kerninset.C @@ -28,7 +28,7 @@ MathInset * MathKernInset::clone() const } -void MathKernInset::metrics(MathMetricsInfo & mi) const +void MathKernInset::metrics(MetricsInfo & mi) const { dim_.w = wid_.inPixels(0, mathed_char_width(mi.base.font, 'M')); dim_.a = 0; @@ -36,7 +36,7 @@ void MathKernInset::metrics(MathMetricsInfo & mi) const } -void MathKernInset::draw(MathPainterInfo &, int, int) const +void MathKernInset::draw(PainterInfo &, int, int) const {} diff --git a/src/mathed/math_kerninset.h b/src/mathed/math_kerninset.h index b4a857101b..480486cdb6 100644 --- a/src/mathed/math_kerninset.h +++ b/src/mathed/math_kerninset.h @@ -22,13 +22,13 @@ public: /// MathInset * clone() const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void write(WriteStream & os) const; /// void normalize(NormalStream & ns) const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; private: /// width in em LyXLength wid_; diff --git a/src/mathed/math_lefteqninset.C b/src/mathed/math_lefteqninset.C index 39ac7522fa..febd73aafe 100644 --- a/src/mathed/math_lefteqninset.C +++ b/src/mathed/math_lefteqninset.C @@ -15,7 +15,7 @@ MathInset * MathLefteqnInset::clone() const } -void MathLefteqnInset::metrics(MathMetricsInfo & mi) const +void MathLefteqnInset::metrics(MetricsInfo & mi) const { cell(0).metrics(mi); dim_.a = cell(0).ascent() + 2; @@ -25,7 +25,7 @@ void MathLefteqnInset::metrics(MathMetricsInfo & mi) const } -void MathLefteqnInset::draw(MathPainterInfo & pi, int x, int y) const +void MathLefteqnInset::draw(PainterInfo & pi, int x, int y) const { cell(0).draw(pi, x + 2, y); drawMarkers2(pi, x, y); diff --git a/src/mathed/math_lefteqninset.h b/src/mathed/math_lefteqninset.h index c257958e2f..6a82a59502 100644 --- a/src/mathed/math_lefteqninset.h +++ b/src/mathed/math_lefteqninset.h @@ -16,9 +16,9 @@ public: /// string name() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void infoize(std::ostream & os) const; }; diff --git a/src/mathed/math_liminset.C b/src/mathed/math_liminset.C index 6330df80bb..8608db0edf 100644 --- a/src/mathed/math_liminset.C +++ b/src/mathed/math_liminset.C @@ -28,13 +28,13 @@ void MathLimInset::normalize(NormalStream & os) const } -void MathLimInset::metrics(MathMetricsInfo &) const +void MathLimInset::metrics(MetricsInfo &) const { lyxerr << "should not happen\n"; } -void MathLimInset::draw(MathPainterInfo &, int, int) const +void MathLimInset::draw(PainterInfo &, int, int) const { lyxerr << "should not happen\n"; } diff --git a/src/mathed/math_liminset.h b/src/mathed/math_liminset.h index 2016e6effa..ee914d85a1 100644 --- a/src/mathed/math_liminset.h +++ b/src/mathed/math_liminset.h @@ -15,9 +15,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void normalize(NormalStream &) const; diff --git a/src/mathed/math_macro.C b/src/mathed/math_macro.C index faaa701158..17c05dcbea 100644 --- a/src/mathed/math_macro.C +++ b/src/mathed/math_macro.C @@ -69,7 +69,7 @@ void MathMacro::expand() const } -void MathMacro::metrics(MathMetricsInfo & mi) const +void MathMacro::metrics(MetricsInfo & mi) const { augmentFont(font_, "lyxtex"); mi_ = mi; @@ -106,7 +106,7 @@ void MathMacro::metrics(MathMetricsInfo & mi) const } -void MathMacro::draw(MathPainterInfo & pi, int x, int y) const +void MathMacro::draw(PainterInfo & pi, int x, int y) const { metrics(mi_); diff --git a/src/mathed/math_macro.h b/src/mathed/math_macro.h index ac9f3c497c..39bda1ccf0 100644 --- a/src/mathed/math_macro.h +++ b/src/mathed/math_macro.h @@ -19,7 +19,7 @@ #include "math_nestinset.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" #include "math_macroarg.h" #include "LString.h" @@ -39,9 +39,9 @@ public: /// MathMacro(MathMacro const &); /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// MathInset * clone() const; /// @@ -89,7 +89,7 @@ private: /// mutable MathArray expanded_; /// - mutable MathMetricsInfo mi_; + mutable MetricsInfo mi_; /// mutable LyXFont font_; }; diff --git a/src/mathed/math_macroarg.C b/src/mathed/math_macroarg.C index 09b28d1a67..8de0f3af41 100644 --- a/src/mathed/math_macroarg.C +++ b/src/mathed/math_macroarg.C @@ -34,7 +34,7 @@ void MathMacroArgument::write(WriteStream & os) const } -void MathMacroArgument::metrics(MathMetricsInfo & mi) const +void MathMacroArgument::metrics(MetricsInfo & mi) const { if (expanded_) dim_ = cell(0).metrics(mi); @@ -43,7 +43,7 @@ void MathMacroArgument::metrics(MathMetricsInfo & mi) const } -void MathMacroArgument::draw(MathPainterInfo & pi, int x, int y) const +void MathMacroArgument::draw(PainterInfo & pi, int x, int y) const { if (expanded_) cell(0).draw(pi, x, y); diff --git a/src/mathed/math_macroarg.h b/src/mathed/math_macroarg.h index 26f76ed033..d6bb6f919d 100644 --- a/src/mathed/math_macroarg.h +++ b/src/mathed/math_macroarg.h @@ -19,9 +19,9 @@ public: /// bool isActive() const { return false; } /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void substitute(MathMacro const & macro); diff --git a/src/mathed/math_macrotemplate.C b/src/mathed/math_macrotemplate.C index f35dace5bf..60e270e20f 100644 --- a/src/mathed/math_macrotemplate.C +++ b/src/mathed/math_macrotemplate.C @@ -62,7 +62,7 @@ string MathMacroTemplate::name() const } -void MathMacroTemplate::metrics(MathMetricsInfo & mi) const +void MathMacroTemplate::metrics(MetricsInfo & mi) const { cell(0).metrics(mi); cell(1).metrics(mi); @@ -72,7 +72,7 @@ void MathMacroTemplate::metrics(MathMetricsInfo & mi) const } -void MathMacroTemplate::draw(MathPainterInfo & pi, int x, int y) const +void MathMacroTemplate::draw(PainterInfo & pi, int x, int y) const { int const w0 = cell(0).width(); int const w1 = cell(1).width(); diff --git a/src/mathed/math_macrotemplate.h b/src/mathed/math_macrotemplate.h index 3c3fbe3726..dc90d9c977 100644 --- a/src/mathed/math_macrotemplate.h +++ b/src/mathed/math_macrotemplate.h @@ -35,9 +35,9 @@ public: /// string name() const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; /// identifies macro templates MathMacroTemplate * asMacroTemplate() { return this; } /// identifies macro templates diff --git a/src/mathed/math_mathmlstream.h b/src/mathed/math_mathmlstream.h index 0339c8a95e..3c0d69ae38 100644 --- a/src/mathed/math_mathmlstream.h +++ b/src/mathed/math_mathmlstream.h @@ -6,7 +6,7 @@ // settled. -#include "math_metricsinfo.h" +#include "metricsinfo.h" #include diff --git a/src/mathed/math_matrixinset.h b/src/mathed/math_matrixinset.h index 8d8386bf68..e77b8253a9 100644 --- a/src/mathed/math_matrixinset.h +++ b/src/mathed/math_matrixinset.h @@ -16,7 +16,7 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo &) const {} + void metrics(MetricsInfo &) const {} /// identifies MatrixInsets MathMatrixInset const * asMatrixInset() const { return this; } diff --git a/src/mathed/math_metricsinfo.h b/src/mathed/math_metricsinfo.h deleted file mode 100644 index e9bbd9d7dd..0000000000 --- a/src/mathed/math_metricsinfo.h +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef MATH_METRICSINFO_H -#define MATH_METRICSINFO_H - - -#include "lyxfont.h" -#include "LString.h" - -class Painter; - - -/// Standard Math Sizes (Math mode styles) -enum MathStyles { - /// - LM_ST_DISPLAY = 0, - /// - LM_ST_TEXT, - /// - LM_ST_SCRIPT, - /// - LM_ST_SCRIPTSCRIPT -}; - - -struct MathMetricsBase { - /// - MathMetricsBase(); - - /// - LyXFont font; - /// - MathStyles style; - /// - string fontname; - /// if this is set... - bool restrictwidth; - /// ... this is valid - int textwidth; -}; - - -struct MathMetricsInfo { - /// - MathMetricsInfo(); - - /// - MathMetricsBase base; - /// - bool fullredraw; -}; - - -struct MathPainterInfo { - /// - MathPainterInfo(Painter & pain); - /// - void draw(int x, int y, char c); - - /// - MathMetricsBase base; - /// - Painter & pain; -}; - - -struct TextMetricsInfo {}; - - -// Generic base for temporarily changing things. -// The original state gets restored when the Changer is destructed. - -template -struct MathChanger { - /// - MathChanger(Struct & orig) : orig_(orig) {} -protected: - /// - Struct & orig_; - /// - Temp save_; -}; - - - -struct MathFontChanger : public MathChanger { - /// - MathFontChanger(LyXFont & orig, char const * font); - /// - ~MathFontChanger(); -}; - - -struct MathFontSetChanger : public MathChanger { - /// - MathFontSetChanger(MathMetricsBase & mb, char const * font); - /// - ~MathFontSetChanger(); -}; - - -struct MathStyleChanger : public MathChanger { - /// - MathStyleChanger(MathMetricsBase & mb, MathStyles shape); - /// - ~MathStyleChanger(); -}; - - -struct MathScriptChanger : public MathStyleChanger { - /// - MathScriptChanger(MathMetricsBase & mb); -}; - - -struct MathFracChanger : public MathStyleChanger { - /// - MathFracChanger(MathMetricsBase & mb); -}; - - -struct MathArrayChanger : public MathStyleChanger { - /// - MathArrayChanger(MathMetricsBase & mb); -}; - - - -struct MathShapeChanger : public MathChanger { - /// - MathShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape); - /// - ~MathShapeChanger(); -}; - - -struct MathWidthChanger : public MathChanger -{ - /// - MathWidthChanger(MathMetricsBase & mb, int width); - /// - ~MathWidthChanger(); -}; - - -#endif diff --git a/src/mathed/math_nestinset.C b/src/mathed/math_nestinset.C index 890fe5c017..44649e2cdc 100644 --- a/src/mathed/math_nestinset.C +++ b/src/mathed/math_nestinset.C @@ -50,9 +50,9 @@ void MathNestInset::substitute(MathMacro const & m) } -void MathNestInset::metrics(MathMetricsInfo const & mi) const +void MathNestInset::metrics(MetricsInfo const & mi) const { - MathMetricsInfo m = mi; + MetricsInfo m = mi; for (idx_type i = 0; i < nargs(); ++i) cell(i).metrics(m); } @@ -156,8 +156,8 @@ void MathNestInset::dump() const } -//void MathNestInset::draw(MathPainterInfo & pi, int x, int y) const -void MathNestInset::draw(MathPainterInfo &, int, int) const +//void MathNestInset::draw(PainterInfo & pi, int x, int y) const +void MathNestInset::draw(PainterInfo &, int, int) const { #if 0 if (lock_) @@ -167,7 +167,7 @@ void MathNestInset::draw(MathPainterInfo &, int, int) const } -void MathNestInset::drawSelection(MathPainterInfo & pi, +void MathNestInset::drawSelection(PainterInfo & pi, idx_type idx1, pos_type pos1, idx_type idx2, pos_type pos2) const { if (idx1 == idx2) { @@ -192,7 +192,7 @@ void MathNestInset::drawSelection(MathPainterInfo & pi, } -void MathNestInset::drawMarkers(MathPainterInfo & pi, int x, int y) const +void MathNestInset::drawMarkers(PainterInfo & pi, int x, int y) const { if (!editing()) return; @@ -205,7 +205,7 @@ void MathNestInset::drawMarkers(MathPainterInfo & pi, int x, int y) const } -void MathNestInset::drawMarkers2(MathPainterInfo & pi, int x, int y) const +void MathNestInset::drawMarkers2(PainterInfo & pi, int x, int y) const { if (!editing()) return; diff --git a/src/mathed/math_nestinset.h b/src/mathed/math_nestinset.h index 42dad7d977..e44bb6516a 100644 --- a/src/mathed/math_nestinset.h +++ b/src/mathed/math_nestinset.h @@ -18,19 +18,19 @@ public: explicit MathNestInset(idx_type ncells); /// the size is usuall some sort of convex hull of the cells - void metrics(MathMetricsInfo const & mi) const; + void metrics(MetricsInfo const & mi) const; /// add space for markers void metricsMarkers(int frame = 1) const; /// add space for markers void metricsMarkers2(int frame = 1) const; /// draw background if locked - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// draw selection background - void drawSelection(MathPainterInfo & pi, + void drawSelection(PainterInfo & pi, idx_type idx1, pos_type pos1, idx_type idx2, pos_type pos2) const; - void drawMarkers(MathPainterInfo & pi, int x, int y) const; + void drawMarkers(PainterInfo & pi, int x, int y) const; /// draw four angular markers - void drawMarkers2(MathPainterInfo & pi, int x, int y) const; + void drawMarkers2(PainterInfo & pi, int x, int y) const; /// appends itself with macro arguments substituted void substitute(MathMacro const & macro); /// identifies NestInsets diff --git a/src/mathed/math_numberinset.C b/src/mathed/math_numberinset.C index 87bc4b05bc..d14b183fc8 100644 --- a/src/mathed/math_numberinset.C +++ b/src/mathed/math_numberinset.C @@ -19,13 +19,13 @@ MathInset * MathNumberInset::clone() const } -void MathNumberInset::metrics(MathMetricsInfo & mi) const +void MathNumberInset::metrics(MetricsInfo & mi) const { mathed_string_dim(mi.base.font, str_, dim_); } -void MathNumberInset::draw(MathPainterInfo & pi, int x, int y) const +void MathNumberInset::draw(PainterInfo & pi, int x, int y) const { //lyxerr << "drawing '" << str_ << "' code: " << code_ << endl; drawStr(pi, pi.base.font, x, y, str_); diff --git a/src/mathed/math_numberinset.h b/src/mathed/math_numberinset.h index b0a64fa24e..5f6d54a699 100644 --- a/src/mathed/math_numberinset.h +++ b/src/mathed/math_numberinset.h @@ -19,9 +19,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// string str() const { return str_; } /// diff --git a/src/mathed/math_parboxinset.C b/src/mathed/math_parboxinset.C index 5a4ad25dd6..f8a3254e0e 100644 --- a/src/mathed/math_parboxinset.C +++ b/src/mathed/math_parboxinset.C @@ -33,18 +33,18 @@ void MathParboxInset::setWidth(string const & w) } -void MathParboxInset::metrics(MathMetricsInfo & mi) const +void MathParboxInset::metrics(MetricsInfo & mi) const { - MathFontSetChanger dummy1(mi.base, "textnormal"); - MathWidthChanger dummy2(mi.base, lyx_width_); + FontSetChanger dummy1(mi.base, "textnormal"); + WidthChanger dummy2(mi.base, lyx_width_); MathTextInset::metrics(mi); metricsMarkers2(); } -void MathParboxInset::draw(MathPainterInfo & pi, int x, int y) const +void MathParboxInset::draw(PainterInfo & pi, int x, int y) const { - MathFontSetChanger dummy(pi.base, "textnormal"); + FontSetChanger dummy(pi.base, "textnormal"); MathTextInset::draw(pi, x + 1, y); drawMarkers2(pi, x, y); } diff --git a/src/mathed/math_parboxinset.h b/src/mathed/math_parboxinset.h index 715fde9acc..1b56b32f74 100644 --- a/src/mathed/math_parboxinset.h +++ b/src/mathed/math_parboxinset.h @@ -17,9 +17,9 @@ public: /// mode_type currentMode() const { return TEXT_MODE; } /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void infoize(std::ostream & os) const; /// diff --git a/src/mathed/math_parinset.C b/src/mathed/math_parinset.C index 24d0853937..03bb1d6c32 100644 --- a/src/mathed/math_parinset.C +++ b/src/mathed/math_parinset.C @@ -12,16 +12,16 @@ MathParInset::MathParInset(MathArray const & ar) } -void MathParInset::metrics(MathMetricsInfo & mi) const +void MathParInset::metrics(MetricsInfo & mi) const { - MathFontSetChanger dummy1(mi.base, "textnormal"); + FontSetChanger dummy1(mi.base, "textnormal"); MathGridInset::metrics(mi); } -void MathParInset::draw(MathPainterInfo & pi, int x, int y) const +void MathParInset::draw(PainterInfo & pi, int x, int y) const { - MathFontSetChanger dummy1(pi.base, "textnormal"); + FontSetChanger dummy1(pi.base, "textnormal"); MathGridInset::draw(pi, x, y); } diff --git a/src/mathed/math_parinset.h b/src/mathed/math_parinset.h index 54c4e04f24..aa3f40ffbc 100644 --- a/src/mathed/math_parinset.h +++ b/src/mathed/math_parinset.h @@ -13,9 +13,9 @@ public: /// mode_type currentMode() const { return TEXT_MODE; } /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void infoize(std::ostream & os) const; /// diff --git a/src/mathed/math_rootinset.C b/src/mathed/math_rootinset.C index 4e22bdbd2d..345b4c31ea 100644 --- a/src/mathed/math_rootinset.C +++ b/src/mathed/math_rootinset.C @@ -31,7 +31,7 @@ MathInset * MathRootInset::clone() const } -void MathRootInset::metrics(MathMetricsInfo & mi) const +void MathRootInset::metrics(MetricsInfo & mi) const { MathNestInset::metrics(mi); dim_.a = max(cell(0).ascent() + 5, cell(1).ascent()) + 2; @@ -41,7 +41,7 @@ void MathRootInset::metrics(MathMetricsInfo & mi) const } -void MathRootInset::draw(MathPainterInfo & pi, int x, int y) const +void MathRootInset::draw(PainterInfo & pi, int x, int y) const { int const w = cell(0).width(); // the "exponent" diff --git a/src/mathed/math_rootinset.h b/src/mathed/math_rootinset.h index d4debe2821..d483027fcf 100644 --- a/src/mathed/math_rootinset.h +++ b/src/mathed/math_rootinset.h @@ -33,9 +33,9 @@ public: /// bool idxUpDown(idx_type & idx, pos_type & pos, bool up, int targetx) const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void write(WriteStream & os) const; diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index 3892ba8832..c118f4be3c 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -180,10 +180,10 @@ int MathScriptInset::ndes() const } -void MathScriptInset::metrics(MathMetricsInfo & mi) const +void MathScriptInset::metrics(MetricsInfo & mi) const { cell(2).metrics(mi); - MathScriptChanger dummy(mi.base); + ScriptChanger dummy(mi.base); cell(0).metrics(mi); cell(1).metrics(mi); dim_.w = 0; @@ -206,7 +206,7 @@ void MathScriptInset::metrics(MathMetricsInfo & mi) const } -void MathScriptInset::draw(MathPainterInfo & pi, int x, int y) const +void MathScriptInset::draw(PainterInfo & pi, int x, int y) const { if (nuc().size()) nuc().draw(pi, x + dxx(), y); @@ -215,7 +215,7 @@ void MathScriptInset::draw(MathPainterInfo & pi, int x, int y) const if (editing()) drawStr(pi, pi.base.font, x + dxx(), y, "."); } - MathScriptChanger dummy(pi.base); + ScriptChanger dummy(pi.base); if (hasUp()) up().draw(pi, x + dx1(), y - dy1()); if (hasDown()) diff --git a/src/mathed/math_scriptinset.h b/src/mathed/math_scriptinset.h index fa5dc7653f..38bdebb1f4 100644 --- a/src/mathed/math_scriptinset.h +++ b/src/mathed/math_scriptinset.h @@ -22,9 +22,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void metricsT(TextMetricsInfo const & mi) const; /// diff --git a/src/mathed/math_sizeinset.C b/src/mathed/math_sizeinset.C index 2b6f667fd4..849874214a 100644 --- a/src/mathed/math_sizeinset.C +++ b/src/mathed/math_sizeinset.C @@ -11,7 +11,7 @@ using std::atoi; MathSizeInset::MathSizeInset(latexkeys const * l) - : MathNestInset(1), key_(l), style_(MathStyles(atoi(l->extra.c_str()))) + : MathNestInset(1), key_(l), style_(Styles(atoi(l->extra.c_str()))) {} @@ -21,17 +21,17 @@ MathInset * MathSizeInset::clone() const } -void MathSizeInset::metrics(MathMetricsInfo & mi) const +void MathSizeInset::metrics(MetricsInfo & mi) const { - MathStyleChanger dummy(mi.base, style_); + StyleChanger dummy(mi.base, style_); dim_ = cell(0).metrics(mi); metricsMarkers2(); } -void MathSizeInset::draw(MathPainterInfo & pi, int x, int y) const +void MathSizeInset::draw(PainterInfo & pi, int x, int y) const { - MathStyleChanger dummy(pi.base, style_); + StyleChanger dummy(pi.base, style_); cell(0).draw(pi, x + 1, y); drawMarkers2(pi, x, y); } diff --git a/src/mathed/math_sizeinset.h b/src/mathed/math_sizeinset.h index 5f812dbdba..70c56c3641 100644 --- a/src/mathed/math_sizeinset.h +++ b/src/mathed/math_sizeinset.h @@ -3,7 +3,7 @@ #define MATHSIZEINSET_H #include "math_nestinset.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" /** An inset for \scriptsize etc @@ -23,9 +23,9 @@ public: /// we write extra braces in any case... bool extraBraces() const { return true; } /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void write(WriteStream & os) const; @@ -38,7 +38,7 @@ private: /// latexkeys const * key_; /// - MathStyles const style_; + Styles const style_; }; #endif diff --git a/src/mathed/math_spaceinset.C b/src/mathed/math_spaceinset.C index d2d2232595..101553962d 100644 --- a/src/mathed/math_spaceinset.C +++ b/src/mathed/math_spaceinset.C @@ -38,7 +38,7 @@ MathInset * MathSpaceInset::clone() const } -void MathSpaceInset::metrics(MathMetricsInfo &) const +void MathSpaceInset::metrics(MetricsInfo &) const { switch (space_) { case 0: dim_.w = 6; break; @@ -58,7 +58,7 @@ void MathSpaceInset::metrics(MathMetricsInfo &) const } -void MathSpaceInset::draw(MathPainterInfo & pi, int x, int y) const +void MathSpaceInset::draw(PainterInfo & pi, int x, int y) const { // Sadly, HP-UX CC can't handle that kind of initialization. diff --git a/src/mathed/math_spaceinset.h b/src/mathed/math_spaceinset.h index d48ff330d4..c22c05fc53 100644 --- a/src/mathed/math_spaceinset.h +++ b/src/mathed/math_spaceinset.h @@ -21,9 +21,9 @@ public: /// void incSpace(); /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void normalize(NormalStream &) const; diff --git a/src/mathed/math_sqrtinset.C b/src/mathed/math_sqrtinset.C index 960ccc2ab6..93f08762eb 100644 --- a/src/mathed/math_sqrtinset.C +++ b/src/mathed/math_sqrtinset.C @@ -17,7 +17,7 @@ MathInset * MathSqrtInset::clone() const } -void MathSqrtInset::metrics(MathMetricsInfo & mi) const +void MathSqrtInset::metrics(MetricsInfo & mi) const { cell(0).metrics(mi); dim_.a = cell(0).ascent() + 4; @@ -27,7 +27,7 @@ void MathSqrtInset::metrics(MathMetricsInfo & mi) const } -void MathSqrtInset::draw(MathPainterInfo & pi, int x, int y) const +void MathSqrtInset::draw(PainterInfo & pi, int x, int y) const { cell(0).draw(pi, x + 10, y); int const a = ascent(); diff --git a/src/mathed/math_sqrtinset.h b/src/mathed/math_sqrtinset.h index 942d9d5eda..d9cdcfd261 100644 --- a/src/mathed/math_sqrtinset.h +++ b/src/mathed/math_sqrtinset.h @@ -17,9 +17,9 @@ public: /// MathInset * clone() const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// void drawT(TextPainter &, int x, int y) const; /// diff --git a/src/mathed/math_stackrelinset.C b/src/mathed/math_stackrelinset.C index afcd72b852..bb62d6e7a7 100644 --- a/src/mathed/math_stackrelinset.C +++ b/src/mathed/math_stackrelinset.C @@ -17,10 +17,10 @@ MathInset * MathStackrelInset::clone() const } -void MathStackrelInset::metrics(MathMetricsInfo & mi) const +void MathStackrelInset::metrics(MetricsInfo & mi) const { cell(1).metrics(mi); - MathFracChanger dummy(mi.base); + FracChanger dummy(mi.base); cell(0).metrics(mi); dim_.w = max(cell(0).width(), cell(1).width()) + 4; dim_.a = cell(1).ascent() + cell(0).height() + 4; @@ -28,12 +28,12 @@ void MathStackrelInset::metrics(MathMetricsInfo & mi) const } -void MathStackrelInset::draw(MathPainterInfo & pi, int x, int y) const +void MathStackrelInset::draw(PainterInfo & pi, int x, int y) const { int m = x + width() / 2; int yo = y - cell(1).ascent() - cell(0).descent() - 1; cell(1).draw(pi, m - cell(1).width() / 2, y); - MathFracChanger dummy(pi.base); + FracChanger dummy(pi.base); cell(0).draw(pi, m - cell(0).width() / 2, yo); } diff --git a/src/mathed/math_stackrelinset.h b/src/mathed/math_stackrelinset.h index e24db841e2..96755245da 100644 --- a/src/mathed/math_stackrelinset.h +++ b/src/mathed/math_stackrelinset.h @@ -17,9 +17,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void write(WriteStream & os) const; diff --git a/src/mathed/math_stringinset.C b/src/mathed/math_stringinset.C index 005eecf4e9..d8a37291bb 100644 --- a/src/mathed/math_stringinset.C +++ b/src/mathed/math_stringinset.C @@ -19,13 +19,13 @@ MathInset * MathStringInset::clone() const } -void MathStringInset::metrics(MathMetricsInfo & mi) const +void MathStringInset::metrics(MetricsInfo & mi) const { mathed_string_dim(mi.base.font, str_, dim_); } -void MathStringInset::draw(MathPainterInfo & pi, int x, int y) const +void MathStringInset::draw(PainterInfo & pi, int x, int y) const { //lyxerr << "drawing '" << str_ << "' code: " << code_ << endl; drawStr(pi, pi.base.font, x, y, str_); diff --git a/src/mathed/math_stringinset.h b/src/mathed/math_stringinset.h index d38a7cddf9..47d0613c36 100644 --- a/src/mathed/math_stringinset.h +++ b/src/mathed/math_stringinset.h @@ -19,9 +19,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// string str() const { return str_; } /// diff --git a/src/mathed/math_substackinset.C b/src/mathed/math_substackinset.C index 801a45f62d..c996d8bd7b 100644 --- a/src/mathed/math_substackinset.C +++ b/src/mathed/math_substackinset.C @@ -17,10 +17,10 @@ MathInset * MathSubstackInset::clone() const } -void MathSubstackInset::metrics(MathMetricsInfo & mi) const +void MathSubstackInset::metrics(MetricsInfo & mi) const { if (mi.base.style == LM_ST_DISPLAY) { - MathStyleChanger dummy(mi.base, LM_ST_TEXT); + StyleChanger dummy(mi.base, LM_ST_TEXT); MathGridInset::metrics(mi); } else { MathGridInset::metrics(mi); diff --git a/src/mathed/math_substackinset.h b/src/mathed/math_substackinset.h index 428d4ede49..2de0c7b470 100644 --- a/src/mathed/math_substackinset.h +++ b/src/mathed/math_substackinset.h @@ -13,7 +13,7 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// MathSubstackInset const * asSubstackInset() const { return this; } diff --git a/src/mathed/math_support.C b/src/mathed/math_support.C index ee036fe9ef..4694964c07 100644 --- a/src/mathed/math_support.C +++ b/src/mathed/math_support.C @@ -6,7 +6,7 @@ #include "math_cursor.h" #include "math_inset.h" #include "math_parser.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" #include "frontends/Painter.h" #include "frontends/font_metrics.h" #include "frontends/lyx_gui.h" @@ -395,7 +395,7 @@ int mathed_string_width(LyXFont const & font, string const & s) } -void mathed_draw_deco(MathPainterInfo & pi, int x, int y, int w, int h, +void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h, const string & name) { if (name == ".") { @@ -465,7 +465,7 @@ void mathed_draw_deco(MathPainterInfo & pi, int x, int y, int w, int h, } -void mathed_draw_framebox(MathPainterInfo & pi, int x, int y, MathInset const * p) +void mathed_draw_framebox(PainterInfo & pi, int x, int y, MathInset const * p) { if (mathcursor && mathcursor->isInside(p)) pi.pain.rectangle(x, y - p->ascent(), p->width(), p->height(), @@ -474,14 +474,14 @@ void mathed_draw_framebox(MathPainterInfo & pi, int x, int y, MathInset const * // In the future maybe we use a better fonts renderer -void drawStr(MathPainterInfo & pi, LyXFont const & font, +void drawStr(PainterInfo & pi, LyXFont const & font, int x, int y, string const & str) { pi.pain.text(x, y, str, font); } -void drawStrRed(MathPainterInfo & pi, int x, int y, string const & str) +void drawStrRed(PainterInfo & pi, int x, int y, string const & str) { LyXFont f = pi.base.font; f.setColor(LColor::latex); @@ -489,7 +489,7 @@ void drawStrRed(MathPainterInfo & pi, int x, int y, string const & str) } -void drawStrBlack(MathPainterInfo & pi, int x, int y, string const & str) +void drawStrBlack(PainterInfo & pi, int x, int y, string const & str) { LyXFont f = pi.base.font; f.setColor(LColor::black); @@ -497,7 +497,7 @@ void drawStrBlack(MathPainterInfo & pi, int x, int y, string const & str) } -void drawChar(MathPainterInfo & pi, LyXFont const & font, int x, int y, char c) +void drawChar(PainterInfo & pi, LyXFont const & font, int x, int y, char c) { pi.pain.text(x, y, c, font); } diff --git a/src/mathed/math_support.h b/src/mathed/math_support.h index 9e9224b8ae..722f983328 100644 --- a/src/mathed/math_support.h +++ b/src/mathed/math_support.h @@ -6,7 +6,7 @@ #include "LString.h" -class MathPainterInfo; +class PainterInfo; class MathInset; class LyXFont; class Dimension; @@ -16,19 +16,19 @@ int mathed_char_width(LyXFont const &, unsigned char c); int mathed_char_ascent(LyXFont const &, unsigned char c); int mathed_char_descent(LyXFont const &, unsigned char c); -void mathed_draw_deco(MathPainterInfo & pi, int x, int y, int w, int h, +void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h, string const & name); -void mathed_draw_framebox(MathPainterInfo & pi, int x, int y, MathInset const *); +void mathed_draw_framebox(PainterInfo & pi, int x, int y, MathInset const *); void mathed_string_dim(LyXFont const & font, string const & s, Dimension & dim); int mathed_string_width(LyXFont const &, string const & s); -void drawStr(MathPainterInfo & pi, +void drawStr(PainterInfo & pi, LyXFont const &, int x, int y, string const & s); -void drawStrRed(MathPainterInfo & pi, int x, int y, string const & s); -void drawStrBlack(MathPainterInfo & pi, int x, int y, string const & s); -void drawChar(MathPainterInfo & pi, LyXFont const & font, int x, int y, char c); +void drawStrRed(PainterInfo & pi, int x, int y, string const & s); +void drawStrBlack(PainterInfo & pi, int x, int y, string const & s); +void drawChar(PainterInfo & pi, LyXFont const & font, int x, int y, char c); void math_font_max_dim(LyXFont const &, int & asc, int & desc); diff --git a/src/mathed/math_symbolinset.C b/src/mathed/math_symbolinset.C index 272c38861d..774366aa03 100644 --- a/src/mathed/math_symbolinset.C +++ b/src/mathed/math_symbolinset.C @@ -37,7 +37,7 @@ string MathSymbolInset::name() const } -void MathSymbolInset::metrics(MathMetricsInfo & mi) const +void MathSymbolInset::metrics(MetricsInfo & mi) const { //lyxerr << "metrics: symbol: '" << sym_->name // << "' in font: '" << sym_->inset @@ -45,7 +45,7 @@ void MathSymbolInset::metrics(MathMetricsInfo & mi) const // << "'\n"; int const em = mathed_char_width(mi.base.font, 'M'); - MathFontSetChanger dummy(mi.base, sym_->inset.c_str()); + FontSetChanger dummy(mi.base, sym_->inset.c_str()); mathed_string_dim(mi.base.font, sym_->draw, dim_); // correct height for broken cmex and wasy font if (sym_->inset == "cmex" || sym_->inset == "wasy") { @@ -66,7 +66,7 @@ void MathSymbolInset::metrics(MathMetricsInfo & mi) const } -void MathSymbolInset::draw(MathPainterInfo & pi, int x, int y) const +void MathSymbolInset::draw(PainterInfo & pi, int x, int y) const { //lyxerr << "metrics: symbol: '" << sym_->name // << "' in font: '" << sym_->inset @@ -78,7 +78,7 @@ void MathSymbolInset::draw(MathPainterInfo & pi, int x, int y) const else x += static_cast(0.0833*em+0.5); - MathFontSetChanger dummy(pi.base, sym_->inset.c_str()); + FontSetChanger dummy(pi.base, sym_->inset.c_str()); drawStr(pi, pi.base.font, x, y - h_, sym_->draw); } diff --git a/src/mathed/math_symbolinset.h b/src/mathed/math_symbolinset.h index 7aa6ac1a13..a26f54d030 100644 --- a/src/mathed/math_symbolinset.h +++ b/src/mathed/math_symbolinset.h @@ -21,9 +21,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// bool isRelOp() const; /// do we take scripts? diff --git a/src/mathed/math_tabularinset.C b/src/mathed/math_tabularinset.C index 2fd1b697b0..2e8282ec03 100644 --- a/src/mathed/math_tabularinset.C +++ b/src/mathed/math_tabularinset.C @@ -4,7 +4,7 @@ #include "math_tabularinset.h" #include "math_parser.h" #include "math_mathmlstream.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" #include "math_streamstr.h" #include "Lsstream.h" @@ -39,16 +39,16 @@ MathInset * MathTabularInset::clone() const } -void MathTabularInset::metrics(MathMetricsInfo & mi) const +void MathTabularInset::metrics(MetricsInfo & mi) const { - MathFontSetChanger dummy(mi.base, "textnormal"); + FontSetChanger dummy(mi.base, "textnormal"); MathGridInset::metrics(mi); } -void MathTabularInset::draw(MathPainterInfo & pi, int x, int y) const +void MathTabularInset::draw(PainterInfo & pi, int x, int y) const { - MathFontSetChanger dummy(pi.base, "textnormal"); + FontSetChanger dummy(pi.base, "textnormal"); MathGridInset::draw(pi, x, y); } diff --git a/src/mathed/math_tabularinset.h b/src/mathed/math_tabularinset.h index 7e1bfe92a4..bf530309ba 100644 --- a/src/mathed/math_tabularinset.h +++ b/src/mathed/math_tabularinset.h @@ -25,9 +25,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// MathTabularInset * asTabularInset() { return this; } /// diff --git a/src/mathed/math_textinset.C b/src/mathed/math_textinset.C index aa1e2e2638..2e32ea9e21 100644 --- a/src/mathed/math_textinset.C +++ b/src/mathed/math_textinset.C @@ -1,6 +1,6 @@ #include "math_textinset.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" #include "debug.h" @@ -55,7 +55,7 @@ bool MathTextInset::idxUpDown(idx_type &, pos_type & pos, bool up, } -void MathTextInset::metrics(MathMetricsInfo & mi) const +void MathTextInset::metrics(MetricsInfo & mi) const { cell(0).metrics(mi); @@ -151,13 +151,13 @@ void MathTextInset::metrics(MathMetricsInfo & mi) const } -void MathTextInset::draw(MathPainterInfo & pi, int x, int y) const +void MathTextInset::draw(PainterInfo & pi, int x, int y) const { cache_.draw(pi, x + 1, y); } -void MathTextInset::drawSelection(MathPainterInfo & pi, +void MathTextInset::drawSelection(PainterInfo & pi, idx_type idx1, pos_type pos1, idx_type idx2, pos_type pos2) const { cache_.drawSelection(pi, idx1, pos1, idx2, pos2); diff --git a/src/mathed/math_textinset.h b/src/mathed/math_textinset.h index 19ed4f080b..25458e97ba 100644 --- a/src/mathed/math_textinset.h +++ b/src/mathed/math_textinset.h @@ -15,11 +15,11 @@ public: /// get cursor position void getPos(idx_type idx, pos_type pos, int & x, int & y) const; /// this stores metrics information in cache_ - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// draw according to cached metrics - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// draw selection background - void drawSelection(MathPainterInfo & pi, + void drawSelection(PainterInfo & pi, idx_type idx1, pos_type pos1, idx_type idx2, pos_type pos2) const; /// moves cursor up or down bool idxUpDown(idx_type &, pos_type & pos, bool up, int targetx) const; diff --git a/src/mathed/math_undersetinset.C b/src/mathed/math_undersetinset.C index 50b60c8999..5093baa814 100644 --- a/src/mathed/math_undersetinset.C +++ b/src/mathed/math_undersetinset.C @@ -17,10 +17,10 @@ MathInset * MathUndersetInset::clone() const } -void MathUndersetInset::metrics(MathMetricsInfo & mi) const +void MathUndersetInset::metrics(MetricsInfo & mi) const { cell(1).metrics(mi); - MathFracChanger dummy(mi.base); + FracChanger dummy(mi.base); cell(0).metrics(mi); dim_.w = max(cell(0).width(), cell(1).width()) + 4; dim_.a = cell(1).ascent(); @@ -28,12 +28,12 @@ void MathUndersetInset::metrics(MathMetricsInfo & mi) const } -void MathUndersetInset::draw(MathPainterInfo & pi, int x, int y) const +void MathUndersetInset::draw(PainterInfo & pi, int x, int y) const { int m = x + width() / 2; int yo = y + cell(1).descent() + cell(0).ascent() + 1; cell(1).draw(pi, m - cell(1).width() / 2, y); - MathFracChanger dummy(pi.base); + FracChanger dummy(pi.base); cell(0).draw(pi, m - cell(0).width() / 2, yo); } diff --git a/src/mathed/math_undersetinset.h b/src/mathed/math_undersetinset.h index 16f50793ca..8c24e47701 100644 --- a/src/mathed/math_undersetinset.h +++ b/src/mathed/math_undersetinset.h @@ -20,9 +20,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; /// - void draw(MathPainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const; /// void write(WriteStream & os) const; diff --git a/src/mathed/math_unknowninset.C b/src/mathed/math_unknowninset.C index b562092460..c350985a73 100644 --- a/src/mathed/math_unknowninset.C +++ b/src/mathed/math_unknowninset.C @@ -43,13 +43,13 @@ void MathUnknownInset::normalize(NormalStream & os) const } -void MathUnknownInset::metrics(MathMetricsInfo & mi) const +void MathUnknownInset::metrics(MetricsInfo & mi) const { mathed_string_dim(mi.base.font, name_, dim_); } -void MathUnknownInset::draw(MathPainterInfo & pi, int x, int y) const +void MathUnknownInset::draw(PainterInfo & pi, int x, int y) const { if (black_) drawStrBlack(pi, x, y, name_); diff --git a/src/mathed/math_unknowninset.h b/src/mathed/math_unknowninset.h index d18ddb3fea..99df75a64f 100644 --- a/src/mathed/math_unknowninset.h +++ b/src/mathed/math_unknowninset.h @@ -16,9 +16,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void setName(string const & name); /// diff --git a/src/mathed/math_xarrowinset.C b/src/mathed/math_xarrowinset.C index ed6813ff10..d5ca0388ea 100644 --- a/src/mathed/math_xarrowinset.C +++ b/src/mathed/math_xarrowinset.C @@ -19,9 +19,9 @@ MathInset * MathXArrowInset::clone() const } -void MathXArrowInset::metrics(MathMetricsInfo & mi) const +void MathXArrowInset::metrics(MetricsInfo & mi) const { - MathScriptChanger dummy(mi.base); + ScriptChanger dummy(mi.base); cell(0).metrics(mi); cell(1).metrics(mi); dim_.w = std::max(cell(0).width(), cell(1).width()) + 10; @@ -30,9 +30,9 @@ void MathXArrowInset::metrics(MathMetricsInfo & mi) const } -void MathXArrowInset::draw(MathPainterInfo & pi, int x, int y) const +void MathXArrowInset::draw(PainterInfo & pi, int x, int y) const { - MathScriptChanger dummy(pi.base); + ScriptChanger dummy(pi.base); cell(0).draw(pi, x + 5, y - 10); cell(1).draw(pi, x + 5, y + cell(1).height()); mathed_draw_deco(pi, x + 1, y - 7, width() - 2, 5, name_); diff --git a/src/mathed/math_xarrowinset.h b/src/mathed/math_xarrowinset.h index a4f9740b16..be7d4efa8f 100644 --- a/src/mathed/math_xarrowinset.h +++ b/src/mathed/math_xarrowinset.h @@ -19,11 +19,11 @@ public: /// MathInset * clone() const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// void write(WriteStream & os) const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// void normalize(NormalStream & os) const; diff --git a/src/mathed/math_xyarrowinset.C b/src/mathed/math_xyarrowinset.C index b0047d99ef..3f812214da 100644 --- a/src/mathed/math_xyarrowinset.C +++ b/src/mathed/math_xyarrowinset.C @@ -71,11 +71,11 @@ MathArray const & MathXYArrowInset::sourceCell() const } -void MathXYArrowInset::metrics(MathMetricsInfo & mi) const +void MathXYArrowInset::metrics(MetricsInfo & mi) const { MathNestInset::metrics(mi); mi_ = mi; - MathFontSetChanger dummy(mi.base, "textrm"); + FontSetChanger dummy(mi.base, "textrm"); #if 0 target_ = mi.inset ? mi.inset->asXYMatrixInset() : 0; @@ -94,10 +94,10 @@ void MathXYArrowInset::metrics(MathMetricsInfo & mi) const } -void MathXYArrowInset::draw(MathPainterInfo & pi, int x, int y) const +void MathXYArrowInset::draw(PainterInfo & pi, int x, int y) const { metrics(mi_); - MathFontSetChanger dummy(pi.base, "textrm"); + FontSetChanger dummy(pi.base, "textrm"); if (editing()) { diff --git a/src/mathed/math_xyarrowinset.h b/src/mathed/math_xyarrowinset.h index 17861354dd..950db5540b 100644 --- a/src/mathed/math_xyarrowinset.h +++ b/src/mathed/math_xyarrowinset.h @@ -3,7 +3,7 @@ #define MATH_ARROWINSET_H #include "math_nestinset.h" -#include "math_metricsinfo.h" +#include "metricsinfo.h" // for the \ar stuff in \xymatrix @@ -17,9 +17,9 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & mi) const; + void metrics(MetricsInfo & mi) const; /// - void draw(MathPainterInfo & pi, int x, int y) const; + void draw(PainterInfo & pi, int x, int y) const; /// MathXYArrowInset * asXYArrowInset() { return this; } @@ -41,7 +41,7 @@ public: /// bool up_; /// - mutable MathMetricsInfo mi_; + mutable MetricsInfo mi_; /// mutable LyXFont font_; /// diff --git a/src/mathed/math_xymatrixinset.C b/src/mathed/math_xymatrixinset.C index 37781b7f8d..46da10ee96 100644 --- a/src/mathed/math_xymatrixinset.C +++ b/src/mathed/math_xymatrixinset.C @@ -29,9 +29,9 @@ int MathXYMatrixInset::rowsep() const } -void MathXYMatrixInset::metrics(MathMetricsInfo & st) const +void MathXYMatrixInset::metrics(MetricsInfo & st) const { - MathMetricsInfo mi = st; + MetricsInfo mi = st; if (mi.base.style == LM_ST_DISPLAY) mi.base.style = LM_ST_TEXT; MathGridInset::metrics(mi); diff --git a/src/mathed/math_xymatrixinset.h b/src/mathed/math_xymatrixinset.h index 32f16f9f37..0311047bc1 100644 --- a/src/mathed/math_xymatrixinset.h +++ b/src/mathed/math_xymatrixinset.h @@ -13,7 +13,7 @@ public: /// MathInset * clone() const; /// - void metrics(MathMetricsInfo & st) const; + void metrics(MetricsInfo & st) const; /// MathXYMatrixInset const * asXYMatrixInset() const { return this; } /// diff --git a/src/mathed/math_metricsinfo.C b/src/metricsinfo.C similarity index 51% rename from src/mathed/math_metricsinfo.C rename to src/metricsinfo.C index 8b106a1d62..34b504fd3d 100644 --- a/src/mathed/math_metricsinfo.C +++ b/src/metricsinfo.C @@ -1,14 +1,14 @@ #include -#include "math_metricsinfo.h" -#include "math_support.h" -#include "debug.h" +#include "metricsinfo.h" +#include "mathed/math_support.h" #include "frontends/Painter.h" +#include "debug.h" -MathMetricsBase::MathMetricsBase() +MetricsBase::MetricsBase() : font(), style(LM_ST_TEXT), fontname("mathnormal"), restrictwidth(false), textwidth(0) {} @@ -16,25 +16,25 @@ MathMetricsBase::MathMetricsBase() -MathMetricsInfo::MathMetricsInfo() +MetricsInfo::MetricsInfo() : fullredraw(false) {} -MathPainterInfo::MathPainterInfo(Painter & p) +PainterInfo::PainterInfo(Painter & p) : pain(p) {} -void MathPainterInfo::draw(int x, int y, char c) +void PainterInfo::draw(int x, int y, char c) { pain.text(x, y, c, base.font); } -MathStyles smallerScriptStyle(MathStyles st) +Styles smallerScriptStyle(Styles st) { switch (st) { case LM_ST_DISPLAY: @@ -49,13 +49,13 @@ MathStyles smallerScriptStyle(MathStyles st) return LM_ST_DISPLAY; } -MathScriptChanger::MathScriptChanger(MathMetricsBase & mb) - : MathStyleChanger(mb, smallerScriptStyle(mb.style)) +ScriptChanger::ScriptChanger(MetricsBase & mb) + : StyleChanger(mb, smallerScriptStyle(mb.style)) {} -MathStyles smallerFracStyle(MathStyles st) +Styles smallerFracStyle(Styles st) { switch (st) { case LM_ST_DISPLAY: @@ -71,33 +71,33 @@ MathStyles smallerFracStyle(MathStyles st) return LM_ST_DISPLAY; } -MathFracChanger::MathFracChanger(MathMetricsBase & mb) - : MathStyleChanger(mb, smallerFracStyle(mb.style)) +FracChanger::FracChanger(MetricsBase & mb) + : StyleChanger(mb, smallerFracStyle(mb.style)) {} -MathArrayChanger::MathArrayChanger(MathMetricsBase & mb) - : MathStyleChanger(mb, mb.style == LM_ST_DISPLAY ? LM_ST_TEXT : mb.style) +ArrayChanger::ArrayChanger(MetricsBase & mb) + : StyleChanger(mb, mb.style == LM_ST_DISPLAY ? LM_ST_TEXT : mb.style) {} -MathShapeChanger::MathShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape) - : MathChanger(font) +ShapeChanger::ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape) + : Changer(font) { save_ = orig_.shape(); orig_.setShape(shape); } -MathShapeChanger::~MathShapeChanger() +ShapeChanger::~ShapeChanger() { orig_.setShape(save_); } -MathStyleChanger::MathStyleChanger(MathMetricsBase & mb, MathStyles style) - : MathChanger(mb) +StyleChanger::StyleChanger(MetricsBase & mb, Styles style) + : Changer(mb) { static const int diff[4][4] = { { 0, 0, -3, -5 }, { 0, 0, -3, -5 }, @@ -114,29 +114,30 @@ MathStyleChanger::MathStyleChanger(MathMetricsBase & mb, MathStyles style) mb.style = style; } -MathStyleChanger::~MathStyleChanger() + +StyleChanger::~StyleChanger() { orig_ = save_; } -MathFontSetChanger::MathFontSetChanger(MathMetricsBase & mb, char const * name) - : MathChanger(mb) +FontSetChanger::FontSetChanger(MetricsBase & mb, char const * name) + : Changer(mb) { save_ = mb; mb.fontname = name; augmentFont(mb.font, name); } -MathFontSetChanger::~MathFontSetChanger() +FontSetChanger::~FontSetChanger() { orig_ = save_; } -MathWidthChanger::MathWidthChanger(MathMetricsBase & mb, int w) - : MathChanger(mb) +WidthChanger::WidthChanger(MetricsBase & mb, int w) + : Changer(mb) { save_ = mb; mb.restrictwidth = true; @@ -144,7 +145,7 @@ MathWidthChanger::MathWidthChanger(MathMetricsBase & mb, int w) } -MathWidthChanger::~MathWidthChanger() +WidthChanger::~WidthChanger() { orig_ = save_; } diff --git a/src/metricsinfo.h b/src/metricsinfo.h new file mode 100644 index 0000000000..c1acab6a67 --- /dev/null +++ b/src/metricsinfo.h @@ -0,0 +1,163 @@ +#ifndef METRICSINFO_H +#define METRICSINFO_H + + +#include "lyxfont.h" +#include "LString.h" + +class Painter; + + +/// Standard Sizes (mode styles) +enum Styles { + /// + LM_ST_DISPLAY = 0, + /// + LM_ST_TEXT, + /// + LM_ST_SCRIPT, + /// + LM_ST_SCRIPTSCRIPT +}; + + +// +// This is the part common to MetricsInfo and PainterInfo +// +struct MetricsBase { + /// + MetricsBase(); + + /// + LyXFont font; + /// + Styles style; + /// + string fontname; + /// if this is set... + bool restrictwidth; + /// ... this is valid + int textwidth; +}; + + +// +// This contains a Metricsbase and Information that's only relevant during +// the first phase of the two-phase draw +// +struct MetricsInfo { + /// + MetricsInfo(); + + /// + MetricsBase base; + /// + bool fullredraw; +}; + + +// +// This contains a Metricsbase and Information that's only relevant during +// the second phase of the two-phase draw +// +struct PainterInfo { + /// + PainterInfo(Painter & pain); + /// + void draw(int x, int y, char c); + + /// + MetricsBase base; + /// + Painter & pain; +}; + + +struct TextMetricsInfo {}; + + +// Generic base for temporarily changing things. +// The original state gets restored when the Changer is destructed. + +template +struct Changer { + /// + Changer(Struct & orig) : orig_(orig) {} +protected: + /// + Struct & orig_; + /// + Temp save_; +}; + + + +// temporarily change some aspect of a font +struct FontChanger : public Changer { + /// + FontChanger(LyXFont & orig, char const * font); + /// + ~FontChanger(); +}; + + +// temporarily change a full font +struct FontSetChanger : public Changer { + /// + FontSetChanger(MetricsBase & mb, char const * font); + /// + ~FontSetChanger(); +}; + + +// temporarily change the style +struct StyleChanger : public Changer { + /// + StyleChanger(MetricsBase & mb, Styles style); + /// + ~StyleChanger(); +}; + + +// temporarily change the style to script style +struct ScriptChanger : public StyleChanger { + /// + ScriptChanger(MetricsBase & mb); +}; + + +// temporarily change the style suitable for use in fractions +struct FracChanger : public StyleChanger { + /// + FracChanger(MetricsBase & mb); +}; + + +// temporarily change the style suitable for use in tabulars and arrays +struct ArrayChanger : public StyleChanger { + /// + ArrayChanger(MetricsBase & mb); +}; + + + +// temporarily change the shape of a font +struct ShapeChanger : public Changer { + /// + ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape); + /// + ~ShapeChanger(); +}; + + +// temporarily change the available text width +struct WidthChanger : public Changer +{ + /// + WidthChanger(MetricsBase & mb, int width); + /// + ~WidthChanger(); +}; + + +#endif -- 2.39.5