X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2Fmath_inset.h;h=9a50ca15574a53f26dcf6fb1650125fa71164a5d;hb=65b49997597efd5a5ba920c739ba6cd8384e1eeb;hp=67c495570eb86439cb604c56df50c4cc0989b485;hpb=0eccdd1c3613e5170deb77b22174dd0afde833e9;p=lyx.git diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index 67c495570e..9a50ca1557 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -19,8 +19,8 @@ // Note: These math insets are internal to Mathed and are not derived // from lyx inset. -#ifndef __MATH_INSET__ -#define __MATH_INSET__ +#ifndef MATH_INSET +#define MATH_INSET #ifdef __GNUG__ #pragma interface @@ -38,17 +38,18 @@ class MathFuncInset: public MathedInset { public: /// - MathFuncInset(char const *nm, short ot=LM_OT_FUNC, short st=LM_ST_TEXT); + MathFuncInset(char const * nm, + short ot = LM_OT_FUNC, short st = LM_ST_TEXT); /// ~MathFuncInset(); /// - MathedInset *Clone(); + MathedInset * Clone(); /// void Draw(int, int); /// - void Write(FILE *file); + void Write(FILE * file); /// - void Write(string &file); + void Write(string & file); /// void Metrics(); /// @@ -59,7 +60,7 @@ protected: /// bool lims; /// - char *fname; + char * fname; }; @@ -67,19 +68,19 @@ protected: class MathAccentInset: public MathedInset { public: /// - MathAccentInset(byte, MathedTextCodes, int, short st=LM_ST_TEXT); + MathAccentInset(byte, MathedTextCodes, int, short st = LM_ST_TEXT); /// - MathAccentInset(MathedInset *, int, short st=LM_ST_TEXT); + MathAccentInset(MathedInset *, int, short st = LM_ST_TEXT); /// ~MathAccentInset(); /// - MathedInset *Clone(); + MathedInset * Clone(); /// void Draw(int, int); /// - void Write(FILE *file); + void Write(FILE * file); /// - void Write(string &file); + void Write(string & file); /// void Metrics(); /// @@ -93,7 +94,7 @@ class MathAccentInset: public MathedInset { /// int code; /// - MathedInset *inset; + MathedInset * inset; /// int dh, dy; }; @@ -103,17 +104,17 @@ class MathAccentInset: public MathedInset { class MathDotsInset: public MathedInset { public: /// - MathDotsInset(char const*,int,short st=LM_ST_TEXT); + MathDotsInset(char const *, int, short st = LM_ST_TEXT); /// - ~MathDotsInset() { }; + ~MathDotsInset() {} /// - MathedInset *Clone(); + MathedInset * Clone(); /// void Draw(int, int); /// - void Write(FILE *file); + void Write(FILE * file); /// - void Write(string &file); + void Write(string & file); /// void Metrics(); protected: @@ -126,17 +127,17 @@ class MathDotsInset: public MathedInset { class MathSpaceInset: public MathedInset { public: /// - MathSpaceInset(int sp, short ot=LM_OT_SPACE, short st=LM_ST_TEXT); + MathSpaceInset(int sp, short ot = LM_OT_SPACE, short st = LM_ST_TEXT); /// - ~MathSpaceInset() { }; + ~MathSpaceInset() {} /// - MathedInset *Clone(); + MathedInset * Clone(); /// void Draw(int, int); /// - void Write(FILE *file); + void Write(FILE * file); /// - void Write(string &file); + void Write(string & file); /// inline void Metrics(); /// @@ -153,17 +154,17 @@ class MathSpaceInset: public MathedInset { class MathBigopInset: public MathedInset { public: /// - MathBigopInset(char const*, int, short st=LM_ST_TEXT); + MathBigopInset(char const *, int, short st = LM_ST_TEXT); /// - ~MathBigopInset() { }; + ~MathBigopInset() {} /// - MathedInset *Clone(); + MathedInset * Clone(); /// void Draw(int, int); /// - void Write(FILE *file); + void Write(FILE * file); /// - void Write(string &file); + void Write(string & file); /// void Metrics(); /// @@ -184,17 +185,17 @@ class MathBigopInset: public MathedInset { class MathSqrtInset: public MathParInset { public: /// - MathSqrtInset(short st=LM_ST_TEXT); + MathSqrtInset(short st = LM_ST_TEXT); /// - ~MathSqrtInset() { }; + ~MathSqrtInset() {} /// - MathedInset *Clone(); + MathedInset * Clone(); /// void Draw(int x, int baseline); /// - void Write(FILE *file); + void Write(FILE * file); /// - void Write(string &file); + void Write(string & file); /// void Metrics(); /// @@ -210,30 +211,30 @@ class MathSqrtInset: public MathParInset { class MathFracInset: public MathParInset { public: /// - MathFracInset(short ot=LM_OT_FRAC); + MathFracInset(short ot = LM_OT_FRAC); /// ~MathFracInset(); /// - MathedInset *Clone(); + MathedInset * Clone(); /// void Draw(int x, int baseline); /// - void Write(FILE *file); + void Write(FILE * file); /// - void Write(string &file); + void Write(string & file); /// void Metrics(); /** This does the same that SetData(LyxArrayBase*) but for both numerator and denominator at once. */ - void SetData(LyxArrayBase*, LyxArrayBase*); + void SetData(LyxArrayBase *, LyxArrayBase *); /// - void SetData(LyxArrayBase*); + void SetData(LyxArrayBase *); /// - void GetXY(int& x, int& y) const; + void GetXY(int & x, int & y) const; /// - void SetFocus(int,int); + void SetFocus(int, int); /// bool Inside(int, int); /// @@ -241,7 +242,7 @@ class MathFracInset: public MathParInset { /// bool setArgumentIdx(int i); // was bool Up/down(void); /// - int getArgumentIdx() { return (int)idx; } + int getArgumentIdx() { return int(idx); } /// int getMaxArgumentIdx() { return 1; } /// @@ -250,7 +251,7 @@ class MathFracInset: public MathParInset { /// short idx; /// - MathParInset *den; + MathParInset * den; /// int w0, w1, des0, dh; }; @@ -260,17 +261,17 @@ class MathFracInset: public MathParInset { class MathDelimInset: public MathParInset { public: /// - MathDelimInset(int, int, short st=LM_ST_TEXT); + MathDelimInset(int, int, short st = LM_ST_TEXT); /// - ~MathDelimInset() { }; + ~MathDelimInset() {} /// - MathedInset *Clone(); + MathedInset * Clone(); /// void Draw(int, int); /// - void Write(FILE *file); + void Write(FILE * file); /// - void Write(string &file); + void Write(string & file); /// void Metrics(); protected: @@ -285,17 +286,17 @@ class MathDelimInset: public MathParInset { class MathDecorationInset: public MathParInset { public: /// - MathDecorationInset(int, short st=LM_ST_TEXT); + MathDecorationInset(int, short st = LM_ST_TEXT); /// - ~MathDecorationInset() { }; + ~MathDecorationInset() {} /// - MathedInset *Clone(); + MathedInset * Clone(); /// void Draw(int, int); /// - void Write(FILE *file); + void Write(FILE * file); /// - void Write(string &file); + void Write(string & file); /// void Metrics(); /// @@ -316,39 +317,44 @@ class MathDecorationInset: public MathParInset { inline MathFuncInset::~MathFuncInset() { - if (fname && GetType()==LM_OT_UNDEF) delete[] fname; + if (fname && GetType() == LM_OT_UNDEF) delete[] fname; } + inline bool MathFuncInset::GetLimits() const { - return (bool)(lims && (GetStyle()==LM_ST_DISPLAY)); + return bool(lims && (GetStyle() == LM_ST_DISPLAY)); } + inline -void MathFuncInset::Write(FILE *file) +void MathFuncInset::Write(FILE * file) { fprintf(file, "\\%s ", name); } + inline -void MathFuncInset::Write(string &file) +void MathFuncInset::Write(string & file) { file += '\\'; file += name; file += ' '; } + inline void MathSpaceInset::Metrics() { - width = (space) ? space*2: 2; + width = (space) ? space * 2 : 2; if (space>3) width *= 2; - if (space==5) width *= 2; + if (space == 5) width *= 2; width += 4; ascent = 4; descent = 0; } + inline void MathSpaceInset::SetSpace(int sp) { @@ -356,30 +362,31 @@ void MathSpaceInset::SetSpace(int sp) Metrics(); } + inline bool MathBigopInset::GetLimits() const { // Default case - if (lims<0) { - return (bool)(sym!=LM_int && sym!=LM_oint && (GetStyle()==LM_ST_DISPLAY)); + if (lims < 0) { + return sym != LM_int && sym != LM_oint && GetStyle() == LM_ST_DISPLAY; } // Custom - return (bool)(lims>0); + return lims > 0; } + inline void MathBigopInset::SetLimits(bool ls) { - lims = (ls) ? 1: 0; + lims = ls ? 1 : 0; } + inline bool MathDecorationInset::GetLimits() const { - return (bool)(deco==LM_underbrace||deco==LM_overbrace); + return deco == LM_underbrace || deco == LM_overbrace; } - #endif -