From 356d7aed23d61543539117831b9517a1ca2497fb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Thu, 26 Jul 2001 15:28:45 +0000 Subject: [PATCH] small steps towards a unified symbol handling git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2361 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_bigopinset.C | 4 ++-- src/mathed/math_cursor.C | 10 +--------- src/mathed/math_defs.h | 4 +--- src/mathed/math_macrotable.C | 2 +- src/mathed/math_parser.C | 9 +-------- src/mathed/support.C | 7 ++----- 6 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/mathed/math_bigopinset.C b/src/mathed/math_bigopinset.C index cdf09f4282..4ae2fdb25b 100644 --- a/src/mathed/math_bigopinset.C +++ b/src/mathed/math_bigopinset.C @@ -18,7 +18,7 @@ MathInset * MathBigopInset::clone() const void MathBigopInset::write(ostream & os, bool /* fragile */) const { - os << '\\' << sym_->name; + os << '\\' << sym_->name << ' '; } @@ -35,7 +35,7 @@ void MathBigopInset::metrics(MathStyles st) if (sym_->id > 0 && sym_->id < 256) { ssym_ = string(); ssym_ += sym_->id; - code_ = LM_TC_BSYM; + code_ = (sym_->token == LM_TK_BIGSYM) ? LM_TC_BSYM : LM_TC_SYMB; } else { ssym_ = sym_->name; code_ = LM_TC_TEXTRM; diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index bc1ddf707c..4ffe77a4f2 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -665,19 +665,11 @@ void MathCursor::interpret(string const & s) p = new MathFuncInset(s); } else { switch (l->token) { + case LM_TK_SYM: case LM_TK_BIGSYM: case LM_TK_FUNCLIM: p = new MathBigopInset(l); break; - - case LM_TK_SYM: { - MathTextCodes code = static_cast(l->id); - if (code < 255) - insert(l->id, l->bin != LMB_NONE ? LM_TC_BOPS : LM_TC_SYMB); - else - p = new MathFuncInset(l->name); - break; - } case LM_TK_STACK: p = new MathFracInset("stackrel"); diff --git a/src/mathed/math_defs.h b/src/mathed/math_defs.h index 3d048b0162..4dc01bf78f 100644 --- a/src/mathed/math_defs.h +++ b/src/mathed/math_defs.h @@ -81,9 +81,7 @@ enum MathTextCodes { LM_TC_BOP, /// Internal code for symbols LM_TC_SYMB, - /// - LM_TC_BOPS, - /// + /// Internal code for symbols that get bigger in displayed math LM_TC_BSYM, /// LM_FONT_END, diff --git a/src/mathed/math_macrotable.C b/src/mathed/math_macrotable.C index 978766ab5b..ab116755c4 100644 --- a/src/mathed/math_macrotable.C +++ b/src/mathed/math_macrotable.C @@ -95,7 +95,7 @@ void MathMacroTable::builtinMacros() { MathMacroTemplate * t = new MathMacroTemplate("notin", 0); MathDecorationInset * p = new MathDecorationInset("not", LM_not); - p->cell(0).push_back(LM_in, LM_TC_BOPS); + p->cell(0).push_back(LM_in, LM_TC_SYMB); t->push_back(p); insertTemplate(t); } diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index a07d5ad7e5..b855c0732b 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -631,18 +631,11 @@ void mathed_parse(MathArray & array, unsigned flags) break; case LM_TK_BIGSYM: + case LM_TK_SYM: case LM_TK_FUNCLIM: limits = 0; array.push_back(new MathBigopInset(yylval.l)); break; - - case LM_TK_SYM: - if (yylval.l->id < 256) { - MathTextCodes tc = yylval.l->bin == LMB_NONE ? LM_TC_SYMB : LM_TC_BOPS; - array.push_back(yylval.l->id, tc); - } else - array.push_back(new MathFuncInset(yylval.l->name)); - break; case LM_TK_BOP: array.push_back(yylval.i, LM_TC_BOP); diff --git a/src/mathed/support.C b/src/mathed/support.C index 18c4f41161..a0de5d3154 100644 --- a/src/mathed/support.C +++ b/src/mathed/support.C @@ -30,13 +30,13 @@ bool MathIsAlphaFont(MathTextCodes x) bool MathIsBinary(MathTextCodes x) { - return x == LM_TC_BOP || x == LM_TC_BOPS; + return x == LM_TC_BOP; } bool MathIsSymbol(MathTextCodes x) { - return x == LM_TC_SYMB || x == LM_TC_BOPS || x == LM_TC_BSYM; + return x == LM_TC_SYMB || x == LM_TC_BSYM; } @@ -159,9 +159,6 @@ LyXFont WhichFont(MathTextCodes type, MathStyles size) switch (type) { case LM_TC_SYMB: - f = Math_Fonts[2]; - break; - case LM_TC_BSYM: f = Math_Fonts[2]; break; -- 2.39.5