From 4665fc9c306dd3cd93a87a306e07902f7a4ac7f0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 13 Jul 2001 09:54:32 +0000 Subject: [PATCH] remove unneeded #includes, cosmetics git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2232 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/Makefile.am | 2 - src/mathed/array.C | 4 +- src/mathed/formula.C | 10 +- src/mathed/formula.h | 1 - src/mathed/formulabase.h | 2 - src/mathed/macro_support.C | 11 -- src/mathed/macro_support.h | 14 --- src/mathed/math_arrayinset.C | 4 - src/mathed/math_bigopinset.C | 2 - src/mathed/math_decorationinset.C | 3 - src/mathed/math_deliminset.C | 3 - src/mathed/math_dotsinset.C | 2 - src/mathed/math_fracinset.C | 7 +- src/mathed/math_funcinset.C | 3 - src/mathed/math_grid.C | 2 - src/mathed/math_hash.C | 1 - src/mathed/math_inset.C | 4 - src/mathed/math_inset.h | 2 + src/mathed/math_macro.C | 2 - src/mathed/math_macroarg.C | 4 - src/mathed/math_macrotemplate.C | 2 - src/mathed/math_matrixinset.C | 3 - src/mathed/math_root.C | 4 - src/mathed/math_scriptinset.C | 2 - src/mathed/math_sizeinset.C | 2 - src/mathed/math_spaceinset.C | 3 - src/mathed/math_sqrtinset.C | 3 - src/mathed/math_updowninset.C | 2 - src/mathed/math_utils.C | 2 - src/mathed/support.C | 182 ++++++++++++++---------------- src/mathed/xarray.C | 1 - 31 files changed, 91 insertions(+), 198 deletions(-) delete mode 100644 src/mathed/macro_support.C delete mode 100644 src/mathed/macro_support.h diff --git a/src/mathed/Makefile.am b/src/mathed/Makefile.am index 341cf55729..5c1d408dce 100644 --- a/src/mathed/Makefile.am +++ b/src/mathed/Makefile.am @@ -18,8 +18,6 @@ libmathed_la_SOURCES = \ formula.h \ formulamacro.C \ formulamacro.h \ - macro_support.C \ - macro_support.h \ math_arrayinset.C \ math_arrayinset.h \ math_bigopinset.C \ diff --git a/src/mathed/array.C b/src/mathed/array.C index 7141bb79dc..afe0994684 100644 --- a/src/mathed/array.C +++ b/src/mathed/array.C @@ -1,13 +1,11 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif +#include "math_inset.h" #include "debug.h" #include "array.h" -#include "math_inset.h" #include "math_scriptinset.h" #include "math_parser.h" #include "mathed/support.h" diff --git a/src/mathed/formula.C b/src/mathed/formula.C index b3a6489903..576769e17e 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -13,22 +13,19 @@ * the GNU General Public Licence version 2 or later. */ -#include -#include - -#include "support/LOstream.h" - #ifdef __GNUG__ #pragma implementation #endif +#include +#include + #include "formula.h" #include "commandtags.h" #include "math_cursor.h" #include "math_parser.h" #include "lyx_main.h" #include "BufferView.h" -#include "lyxtext.h" #include "gettext.h" #include "debug.h" #include "lyx_gui_misc.h" @@ -37,7 +34,6 @@ #include "support/syscall.h" #include "LyXView.h" #include "Painter.h" -#include "font.h" #include "lyxrc.h" #include "math_matrixinset.h" #include "mathed/support.h" diff --git a/src/mathed/formula.h b/src/mathed/formula.h index d73fd375b8..9a65ae5dee 100644 --- a/src/mathed/formula.h +++ b/src/mathed/formula.h @@ -21,7 +21,6 @@ #pragma interface #endif -#include "LString.h" #include "mathed/formulabase.h" #include "math_defs.h" diff --git a/src/mathed/formulabase.h b/src/mathed/formulabase.h index be8e5ce689..aa330d6568 100644 --- a/src/mathed/formulabase.h +++ b/src/mathed/formulabase.h @@ -20,8 +20,6 @@ #endif #include -#include - #include "insets/inset.h" class Buffer; diff --git a/src/mathed/macro_support.C b/src/mathed/macro_support.C deleted file mode 100644 index 1643061986..0000000000 --- a/src/mathed/macro_support.C +++ /dev/null @@ -1,11 +0,0 @@ -#include - -#include "support/LOstream.h" -#include "macro_support.h" - -using std::ostream; - -ostream & operator<<(ostream & o, MathMacroFlag mmf) -{ - return o << int(mmf); -} diff --git a/src/mathed/macro_support.h b/src/mathed/macro_support.h deleted file mode 100644 index a8a36243ee..0000000000 --- a/src/mathed/macro_support.h +++ /dev/null @@ -1,14 +0,0 @@ -// -*- C++ -*- -#ifndef MACRO_SUPPORT_H -#define MACRO_SUPPORT_H - -#include - -enum MathMacroFlag { - MMF_Env = 1, - MMF_Exp = 2, - MMF_Edit = 4 -}; - -std::ostream & operator<<(std::ostream & o, MathMacroFlag mmf); -#endif diff --git a/src/mathed/math_arrayinset.C b/src/mathed/math_arrayinset.C index 9a8b6adf90..83577735db 100644 --- a/src/mathed/math_arrayinset.C +++ b/src/mathed/math_arrayinset.C @@ -1,13 +1,9 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif #include "math_arrayinset.h" #include "support/LOstream.h" -#include "Painter.h" - MathArrayInset::MathArrayInset(int m, int n) diff --git a/src/mathed/math_bigopinset.C b/src/mathed/math_bigopinset.C index 2da8735809..d081406217 100644 --- a/src/mathed/math_bigopinset.C +++ b/src/mathed/math_bigopinset.C @@ -1,5 +1,3 @@ -#include - #include "math_bigopinset.h" #include "Painter.h" #include "mathed/support.h" diff --git a/src/mathed/math_decorationinset.C b/src/mathed/math_decorationinset.C index 4126f3a918..fb3ae4009c 100644 --- a/src/mathed/math_decorationinset.C +++ b/src/mathed/math_decorationinset.C @@ -1,5 +1,3 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif @@ -8,7 +6,6 @@ #include "mathed/support.h" #include "math_parser.h" #include "support/LOstream.h" -#include "support/lstrings.h" using std::ostream; diff --git a/src/mathed/math_deliminset.C b/src/mathed/math_deliminset.C index 44a0a0c403..1ee6475ddb 100644 --- a/src/mathed/math_deliminset.C +++ b/src/mathed/math_deliminset.C @@ -1,12 +1,9 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif #include "math_deliminset.h" #include "math_parser.h" -#include "LColor.h" #include "Painter.h" #include "mathed/support.h" #include "support/LOstream.h" diff --git a/src/mathed/math_dotsinset.C b/src/mathed/math_dotsinset.C index e08ef4f789..7054cde4bf 100644 --- a/src/mathed/math_dotsinset.C +++ b/src/mathed/math_dotsinset.C @@ -1,5 +1,3 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif diff --git a/src/mathed/math_fracinset.C b/src/mathed/math_fracinset.C index 7e6a166d9d..576f98c4e8 100644 --- a/src/mathed/math_fracinset.C +++ b/src/mathed/math_fracinset.C @@ -1,15 +1,10 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif -#include - #include "math_fracinset.h" -#include "LColor.h" -#include "Painter.h" #include "mathed/support.h" +#include "Painter.h" #include "support/LOstream.h" diff --git a/src/mathed/math_funcinset.C b/src/mathed/math_funcinset.C index c2e7f61df3..f88af12da8 100644 --- a/src/mathed/math_funcinset.C +++ b/src/mathed/math_funcinset.C @@ -1,11 +1,8 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif #include "math_funcinset.h" -#include "lyxfont.h" #include "font.h" #include "Painter.h" #include "mathed/support.h" diff --git a/src/mathed/math_grid.C b/src/mathed/math_grid.C index 28bb8208d2..51265a497d 100644 --- a/src/mathed/math_grid.C +++ b/src/mathed/math_grid.C @@ -1,5 +1,3 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif diff --git a/src/mathed/math_hash.C b/src/mathed/math_hash.C index 99292e98ba..51b70065cb 100644 --- a/src/mathed/math_hash.C +++ b/src/mathed/math_hash.C @@ -1,5 +1,4 @@ #include - #include #include "math_defs.h" diff --git a/src/mathed/math_inset.C b/src/mathed/math_inset.C index bc635a3a7b..fece66cb1e 100644 --- a/src/mathed/math_inset.C +++ b/src/mathed/math_inset.C @@ -15,15 +15,11 @@ * the GNU General Public Licence version 2 or later. */ -#include - #ifdef __GNUG__ #pragma implementation #endif #include "math_inset.h" -#include "mathed/support.h" -#include "Painter.h" #include "debug.h" diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index c479e517df..91077fe5a0 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -22,6 +22,8 @@ #ifndef MATH_INSET_H #define MATH_INSET_H +#include + #ifdef __GNUG__ #pragma interface #endif diff --git a/src/mathed/math_macro.C b/src/mathed/math_macro.C index f0a9e13c96..01ce91fc4b 100644 --- a/src/mathed/math_macro.C +++ b/src/mathed/math_macro.C @@ -14,8 +14,6 @@ * This code is under the GNU General Public Licence version 2 or later. */ -#include - #ifdef __GNUG__ #pragma implementation #endif diff --git a/src/mathed/math_macroarg.C b/src/mathed/math_macroarg.C index 553aaef9f5..c64f750c77 100644 --- a/src/mathed/math_macroarg.C +++ b/src/mathed/math_macroarg.C @@ -1,5 +1,3 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif @@ -8,7 +6,6 @@ #include "math_macro.h" #include "math_defs.h" #include "mathed/support.h" -#include "support/LAssert.h" #include "debug.h" @@ -19,7 +16,6 @@ MathMacroArgument::MathMacroArgument(int n) if (n < 1 || n > 9) { lyxerr << "MathMacroArgument::MathMacroArgument: wrong Argument id: " << n << std::endl; - lyx::Assert(0); } } diff --git a/src/mathed/math_macrotemplate.C b/src/mathed/math_macrotemplate.C index e3846aa0ca..5401991cdc 100644 --- a/src/mathed/math_macrotemplate.C +++ b/src/mathed/math_macrotemplate.C @@ -1,5 +1,3 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif diff --git a/src/mathed/math_matrixinset.C b/src/mathed/math_matrixinset.C index 2314150915..bed9f943b1 100644 --- a/src/mathed/math_matrixinset.C +++ b/src/mathed/math_matrixinset.C @@ -1,11 +1,8 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif #include -#include #include "math_matrixinset.h" #include "debug.h" diff --git a/src/mathed/math_root.C b/src/mathed/math_root.C index 19e3cbd442..e440b798af 100644 --- a/src/mathed/math_root.C +++ b/src/mathed/math_root.C @@ -11,14 +11,10 @@ * the GNU General Public Licence version 2 or later. */ -#include - #ifdef __GNUG__ #pragma implementation #endif -#include - #include "math_root.h" #include "support/LOstream.h" #include "Painter.h" diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index 3cf77fbcd6..09e52cccf0 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -1,5 +1,3 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif diff --git a/src/mathed/math_sizeinset.C b/src/mathed/math_sizeinset.C index f6dc71f82c..124f03bce3 100644 --- a/src/mathed/math_sizeinset.C +++ b/src/mathed/math_sizeinset.C @@ -1,5 +1,3 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif diff --git a/src/mathed/math_spaceinset.C b/src/mathed/math_spaceinset.C index 8c6d91369c..926546a72c 100644 --- a/src/mathed/math_spaceinset.C +++ b/src/mathed/math_spaceinset.C @@ -1,5 +1,3 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif @@ -7,7 +5,6 @@ #include "math_spaceinset.h" #include "LColor.h" #include "Painter.h" -#include "mathed/support.h" #include "support/LOstream.h" diff --git a/src/mathed/math_sqrtinset.C b/src/mathed/math_sqrtinset.C index e802a4e0c7..6ad124ef0f 100644 --- a/src/mathed/math_sqrtinset.C +++ b/src/mathed/math_sqrtinset.C @@ -1,5 +1,3 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif @@ -7,7 +5,6 @@ #include "math_sqrtinset.h" #include "LColor.h" #include "Painter.h" -#include "support.h" #include "support/LOstream.h" diff --git a/src/mathed/math_updowninset.C b/src/mathed/math_updowninset.C index 457225c276..86aeb2b317 100644 --- a/src/mathed/math_updowninset.C +++ b/src/mathed/math_updowninset.C @@ -1,5 +1,3 @@ -#include - #ifdef __GNUG__ #pragma implementation #endif diff --git a/src/mathed/math_utils.C b/src/mathed/math_utils.C index cd1b0a6c1a..7d559ec52c 100644 --- a/src/mathed/math_utils.C +++ b/src/mathed/math_utils.C @@ -9,8 +9,6 @@ * License: GNU GPL version 2 or later */ -#include - #include #include "math_defs.h" diff --git a/src/mathed/support.C b/src/mathed/support.C index 2446694eb9..cdac2c67c0 100644 --- a/src/mathed/support.C +++ b/src/mathed/support.C @@ -17,10 +17,6 @@ using std::lower_bound; using std::endl; using std::max; -/// -/// rotating things -/// - /// class Matrix { public: @@ -29,69 +25,66 @@ public: /// Matrix(); /// - void rota(int); + void rotate(int); /// - void escala(float, float); + void escalate(float, float); /// - void transf(float, float, float &, float &); + void transform(float, float, float &, float &); private: /// matriz_data m_; /// - void matmat(matriz_data & a); - /// - static matriz_data const MATIDEN; + void multiply(matriz_data & a); }; - -#define mateq(m1, m2) memcpy(m1, m2, sizeof(matriz_data)) - - -Matrix::matriz_data const Matrix::MATIDEN = { {1, 0}, {0, 1}}; - - Matrix::Matrix() { - mateq(m_, MATIDEN); + m_[0][0] = 1; + m_[0][1] = 0; + m_[1][0] = 0; + m_[1][1] = 1; } - -void Matrix::rota(int code) +void Matrix::rotate(int code) { matriz_data r; - mateq(r, MATIDEN); + r[0][0] = 1; + r[0][1] = 0; + r[1][0] = 0; + r[1][1] = 1; float const cs = (code & 1) ? 0 : (1 - code); float const sn = (code & 1) ? (2 - code) : 0; r[0][0] = cs; r[0][1] = sn; r[1][0] = -r[0][1]; r[1][1] = r[0][0]; - matmat(r); + multiply(r); } - -void Matrix::escala(float x, float y) +void Matrix::escalate(float x, float y) { matriz_data s; - mateq(s, MATIDEN); s[0][0] = x; + s[0][1] = 0; + s[1][0] = 0; s[1][1] = y; - matmat(s); + multiply(s); } - -void Matrix::matmat(matriz_data & a) +void Matrix::multiply(matriz_data & a) { matriz_data c; c[0][0] = a[0][0] * m_[0][0] + a[0][1] * m_[1][0]; c[1][0] = a[1][0] * m_[0][0] + a[1][1] * m_[1][0]; c[0][1] = a[0][0] * m_[0][1] + a[0][1] * m_[1][1]; c[1][1] = a[1][0] * m_[0][1] + a[1][1] * m_[1][1]; - mateq(m_, c); + m_[0][0] = c[0][0]; + m_[0][1] = c[0][1]; + m_[1][0] = c[1][0]; + m_[1][1] = c[1][1]; } - -void Matrix::transf(float xp, float yp, float & x, float & y) +void Matrix::transform(float xp, float yp, float & x, float & y) { x = m_[0][0] * xp + m_[0][1] * yp; y = m_[1][0] * xp + m_[1][1] * yp; @@ -99,12 +92,6 @@ void Matrix::transf(float xp, float yp, float & x, float & y) - - - - - - extern LyXFont WhichFont(short type, int size); char const * math_font_name[] = { @@ -300,57 +287,57 @@ struct math_deco_struct { math_deco_struct math_deco_table[] = { // Decorations - { LM_widehat, &angle[0], 3 }, - { LM_widetilde, &tilde[0], 0 }, - { LM_underline, &hline[0], 0 }, - { LM_overline, &hline[0], 0 }, - { LM_underbrace, &brace[0], 1 }, - { LM_overbrace, &brace[0], 3 }, - { LM_overleftarrow, &arrow[0], 1 }, - { LM_overightarrow, &arrow[0], 3 }, - - // Delimiters - { '(', &parenth[0], 0 }, - { ')', &parenth[0], 2 }, - { '{', &brace[0], 0 }, - { '}', &brace[0], 2 }, - { '[', &brack[0], 0 }, - { ']', &brack[0], 2 }, - { '|', &vert[0], 0 }, - { '/', &slash[0], 0 }, - { LM_Vert, &Vert[0], 0 }, - { LM_backslash, &slash[0], 1 }, - { LM_langle, &angle[0], 0 }, - { LM_lceil, &corner[0], 0 }, - { LM_lfloor, &corner[0], 1 }, - { LM_rangle, &angle[0], 2 }, - { LM_rceil, &corner[0], 3 }, - { LM_rfloor, &corner[0], 2 }, - { LM_downarrow, &arrow[0], 2 }, - { LM_Downarrow, &Arrow[0], 2 }, - { LM_uparrow, &arrow[0], 0 }, - { LM_Uparrow, &Arrow[0], 0 }, - { LM_updownarrow, &udarrow[0], 0 }, - { LM_Updownarrow, &Udarrow[0], 0 }, - - // Accents - { LM_ddot, &hline2[0], 0 }, - { LM_hat, &angle[0], 3 }, - { LM_grave, &slash[0], 1 }, - { LM_acute, &slash[0], 0 }, - { LM_tilde, &tilde[0], 0 }, - { LM_bar, &hline[0], 0 }, + { LM_widehat, &angle[0], 3 }, + { LM_widetilde, &tilde[0], 0 }, + { LM_underline, &hline[0], 0 }, + { LM_overline, &hline[0], 0 }, + { LM_underbrace, &brace[0], 1 }, + { LM_overbrace, &brace[0], 3 }, + { LM_overleftarrow, &arrow[0], 1 }, + { LM_overightarrow, &arrow[0], 3 }, + + // Delimiters + { '(', &parenth[0], 0 }, + { ')', &parenth[0], 2 }, + { '{', &brace[0], 0 }, + { '}', &brace[0], 2 }, + { '[', &brack[0], 0 }, + { ']', &brack[0], 2 }, + { '|', &vert[0], 0 }, + { '/', &slash[0], 0 }, + { LM_Vert, &Vert[0], 0 }, + { LM_backslash, &slash[0], 1 }, + { LM_langle, &angle[0], 0 }, + { LM_lceil, &corner[0], 0 }, + { LM_lfloor, &corner[0], 1 }, + { LM_rangle, &angle[0], 2 }, + { LM_rceil, &corner[0], 3 }, + { LM_rfloor, &corner[0], 2 }, + { LM_downarrow, &arrow[0], 2 }, + { LM_Downarrow, &Arrow[0], 2 }, + { LM_uparrow, &arrow[0], 0 }, + { LM_Uparrow, &Arrow[0], 0 }, + { LM_updownarrow, &udarrow[0], 0 }, + { LM_Updownarrow, &Udarrow[0], 0 }, + + // Accents + { LM_ddot, &hline2[0], 0 }, + { LM_hat, &angle[0], 3 }, + { LM_grave, &slash[0], 1 }, + { LM_acute, &slash[0], 0 }, + { LM_tilde, &tilde[0], 0 }, + { LM_bar, &hline[0], 0 }, { LM_dot, &hlinesmall[0], 0 }, - { LM_check, &angle[0], 1 }, - { LM_breve, &parenth[0], 1 }, - { LM_vec, &arrow[0], 3 }, - { LM_not, &slash[0], 0 }, - - // Dots - { LM_ldots, &hline3[0], 0 }, - { LM_cdots, &hline3[0], 0 }, - { LM_vdots, &hline3[0], 1 }, - { LM_ddots, &dline3[0], 0 } + { LM_check, &angle[0], 1 }, + { LM_breve, &parenth[0], 1 }, + { LM_vec, &arrow[0], 3 }, + { LM_not, &slash[0], 0 }, + + // Dots + { LM_ldots, &hline3[0], 0 }, + { LM_cdots, &hline3[0], 0 }, + { LM_vdots, &hline3[0], 1 }, + { LM_ddots, &dline3[0], 0 } }; @@ -388,8 +375,7 @@ static init_deco_table idt; } // namespace anon -void mathed_char_dim - (short type, int size, byte c, int & asc, int & des, int & wid) +void mathed_char_dim (short type, int size, byte c, int & asc, int & des, int & wid) { LyXFont const font = WhichFont(type, size); des = lyxfont::descent(c, font); @@ -508,12 +494,12 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h, int code) if (h > 70 && (mds->code == int('(') || mds->code == int(')'))) d = parenthHigh; - mt.rota(r); - mt.escala(w, h); + mt.rotate(r); + mt.escalate(w, h); int const n = (w < h) ? w : h; - sqmt.rota(r); - sqmt.escala(n, n); + sqmt.rotate(r); + sqmt.escalate(n, n); if (r > 0 && r < 3) y += h; if (r >= 2) x += w; do { @@ -526,10 +512,10 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h, int code) xx = d[i++]; yy = d[i++]; x2 = d[i++]; y2 = d[i++]; if (code == 3) - sqmt.transf(xx, yy, xx, yy); + sqmt.transform(xx, yy, xx, yy); else - mt.transf(xx, yy, xx, yy); - mt.transf(x2, y2, x2, y2); + mt.transform(xx, yy, xx, yy); + mt.transform(x2, y2, x2, y2); pain.line(x + int(xx), y + int(yy), x + int(x2), y + int(y2), LColor::mathline); @@ -545,9 +531,9 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h, int code) xx = d[i++]; yy = d[i++]; // lyxerr << " " << xx << " " << yy << " "; if (code == 4) - sqmt.transf(xx, yy, xx, yy); + sqmt.transform(xx, yy, xx, yy); else - mt.transf(xx, yy, xx, yy); + mt.transform(xx, yy, xx, yy); xp[j] = x + int(xx); yp[j] = y + int(yy); // lyxerr << "P[" << j " " << xx << " " << yy << " " << x << " " << y << "]"; diff --git a/src/mathed/xarray.C b/src/mathed/xarray.C index 8d3c9c11a7..0c19f1e8bc 100644 --- a/src/mathed/xarray.C +++ b/src/mathed/xarray.C @@ -1,4 +1,3 @@ - #include #ifdef __GNUG__ -- 2.39.2