From 76957e7e5e6367d07c65767b3eaa4b577ea2d7be Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Thu, 1 Mar 2001 13:37:48 +0000 Subject: [PATCH] move inlines add pragma git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1647 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_parinset.C | 111 ++++++++++++++++---------------- src/mathed/math_parinset.h | 127 ++++++++++++++++++++++++++++++------- 2 files changed, 162 insertions(+), 76 deletions(-) diff --git a/src/mathed/math_parinset.C b/src/mathed/math_parinset.C index 53d1befdf8..5f89fec97a 100644 --- a/src/mathed/math_parinset.C +++ b/src/mathed/math_parinset.C @@ -1,5 +1,9 @@ #include +#ifdef __GNUG__ +#pragma implementation +#endif + #include "math_parinset.h" #include "math_iter.h" #include "array.h" @@ -80,67 +84,66 @@ MathParInset::draw(Painter & pain, int x, int y) data.GoBegin(); while (data.OK()) { data.GetPos(x, y); - byte cx = data.GetChar(); + byte const cx = data.GetChar(); if (cx >= ' ') { string const s = data.GetString(); drawStr(pain, data.fcode(), size(), x, y, s); mathed_char_height(LM_TC_CONST, size(), 'y', asc, des); limits = false; - } else { - if (cx == 0) - break; - if (MathIsInset(cx)) { - int yy = y; - MathedInset * p = data.GetInset(); - if (cx == LM_TC_UP) { - if (limits) { - x -= (xp > p->Width()) ? - p->Width() + (xp - p->Width()) / 2 : xp; - yy -= (asc + p->Descent() + 4); - } else - yy -= (p->Descent() > asc) ? - p->Descent() + 4 : asc; - } else if (cx == LM_TC_DOWN) { - if (limits) { - x -= (xp > p->Width()) ? - p->Width() + (xp - p->Width()) / 2 : xp; - yy += des + p->Ascent() + 2; - } else - yy += des + p->Ascent() / 2; - } else { - asc = p->Ascent(); - des = p->Descent(); - } - p->draw(pain, x, yy); - if (cx != LM_TC_UP && cx != LM_TC_DOWN) { - limits = p->GetLimits(); - if (limits) - xp = p->Width(); - } - data.Next(); - } else if (cx == LM_TC_TAB) { - if (cxp == cx - || cxp == LM_TC_CR || data.IsFirst()) { - pain.rectangle(x, y - df_asc, - df_width, df_asc, - LColor::mathline); - } - data.Next(); - limits = false; - } else if (cx == LM_TC_CR) { - if (cxp == LM_TC_TAB - || cxp == LM_TC_CR || data.IsFirst()) { - pain.rectangle(x, y - df_asc, - df_width, df_asc, - LColor::mathline); - } - data.Next(); - limits = false; - } else { - lyxerr << "GMathed Error: Unrecognized code[" << cx << "]" << endl; - break; + } else if (cx == 0) { + break; + } else if (MathIsInset(cx)) { + int yy = y; + MathedInset * p = data.GetInset(); + if (cx == LM_TC_UP) { + if (limits) { + x -= (xp > p->Width()) ? + p->Width() + (xp - p->Width()) / 2 : xp; + yy -= (asc + p->Descent() + 4); + } else + yy -= (p->Descent() > asc) ? + p->Descent() + 4 : asc; + } else if (cx == LM_TC_DOWN) { + if (limits) { + x -= (xp > p->Width()) ? + p->Width() + (xp - p->Width()) / 2 : xp; + yy += des + p->Ascent() + 2; + } else + yy += des + p->Ascent() / 2; + } else { + asc = p->Ascent(); + des = p->Descent(); + } + p->draw(pain, x, yy); + if (cx != LM_TC_UP && cx != LM_TC_DOWN) { + limits = p->GetLimits(); + if (limits) + xp = p->Width(); } + data.Next(); + } else if (cx == LM_TC_TAB) { + if (cxp == cx + || cxp == LM_TC_CR || data.IsFirst()) { + pain.rectangle(x, y - df_asc, + df_width, df_asc, + LColor::mathline); + } + data.Next(); + limits = false; + } else if (cx == LM_TC_CR) { + if (cxp == LM_TC_TAB + || cxp == LM_TC_CR || data.IsFirst()) { + pain.rectangle(x, y - df_asc, + df_width, df_asc, + LColor::mathline); + } + data.Next(); + limits = false; + } else { + lyxerr << "GMathed Error: Unrecognized code[" << cx << "]" << endl; + break; } + cxp = cx; } if (cxp == LM_TC_TAB || cxp == LM_TC_CR) { diff --git a/src/mathed/math_parinset.h b/src/mathed/math_parinset.h index 61b8b55e27..c8797ebd47 100644 --- a/src/mathed/math_parinset.h +++ b/src/mathed/math_parinset.h @@ -6,6 +6,10 @@ #include "math_inset.h" #include "math_defs.h" +#ifdef __GNUG__ +#pragma interface +#endif + class MathedRowSt; class MathedArray; @@ -13,7 +17,7 @@ class MathedArray; /** The math paragraph base class, base to all editable math objects \author Alejandro Aguilar Sierra */ -class MathParInset: public MathedInset { +class MathParInset : public MathedInset { public: /// MathParInset(short st = LM_ST_TEXT, string const & nm = string(), @@ -44,38 +48,34 @@ public: virtual bool Inside(int, int); // Tab stuff used by Matrix. /// - virtual void SetAlign(char, string const &) {} + virtual void SetAlign(char, string const &); /// - virtual int GetColumns() const { return 1; } + virtual int GetColumns() const; /// - virtual int GetRows() const { return 1; } + virtual int GetRows() const; /// - virtual bool isMatrix() const { return false; } + virtual bool isMatrix() const; // Vertical switching /// - virtual bool setArgumentIdx(int i) { return (i == 0); } + virtual bool setArgumentIdx(int i); /// - virtual bool setNextArgIdx() { return false; } + virtual bool setNextArgIdx(); /// - virtual int getArgumentIdx() const { return 0; } + virtual int getArgumentIdx() const; /// - virtual int getMaxArgumentIdx() const { return 0; } + virtual int getMaxArgumentIdx() const; /// virtual void SetStyle(short); /// virtual MathedRowSt * getRowSt() const; /// - virtual void setRowSt(MathedRowSt *) {} + virtual void setRowSt(MathedRowSt *); /// virtual bool Permit(short f) const; /// - int xo() const { - return xo_; - } + int xo() const; /// - int yo() const { - return yo_; - } + int yo() const; /// void clear(); protected: @@ -84,17 +84,100 @@ protected: /// short flag; /// - void xo(int tx) { - xo_ = tx; - } + void xo(int tx); /// - void yo(int ty) { - yo_ = ty; - } + void yo(int ty); private: /// Cursor start position int xo_; /// int yo_; }; + + +inline +void MathParInset::SetAlign(char, string const &) +{} + + +inline +int MathParInset::GetColumns() const +{ + return 1; +} + + +inline +int MathParInset::GetRows() const +{ + return 1; +} + + +inline +bool MathParInset::isMatrix() const +{ + return false; +} + + +inline +bool MathParInset::setArgumentIdx(int i) +{ + return (i == 0); +} + + +inline +bool MathParInset::setNextArgIdx() +{ + return false; +} + + +inline +int MathParInset::getArgumentIdx() const +{ + return 0; +} + + +inline +int MathParInset::getMaxArgumentIdx() const +{ + return 0; +} + + +inline +void MathParInset::setRowSt(MathedRowSt *) +{} + + +inline +int MathParInset::xo() const +{ + return xo_; +} + + +inline +int MathParInset::yo() const +{ + return yo_; +} + + +inline +void MathParInset::xo(int tx) +{ + xo_ = tx; +} + + +inline +void MathParInset::yo(int ty) +{ + yo_ = ty; +} #endif -- 2.39.2