small cleanups

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2359 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-07-26 13:52:47 +00:00
parent 3fb186cc5e
commit d812b509d0
8 changed files with 15 additions and 32 deletions

View File

@ -32,10 +32,10 @@ void MathBigopInset::writeNormal(ostream & os) const
void MathBigopInset::metrics(MathStyles st)
{
//cerr << "\nBigopDraw\n";
//cerr << "\nBigopDraw: " << name_ << ": " << sym_ << "\n";
size(st);
if (sym_ < 256 || sym_ == LM_oint) {
if (sym_ && (sym_ < 256 || sym_ == LM_oint)) {
ssym_ = string();
ssym_ += (sym_ == LM_oint) ? LM_int : sym_;
code_ = LM_TC_BSYM;

View File

@ -602,7 +602,10 @@ void MathCursor::interpret(string const & s)
//lyxerr << "interpret: '" << s << "'\n";
//lyxerr << "in: " << in_word_set(s) << " \n";
if (s.size() && (s[0] == '^' || s[0] == '_')) {
if (s.empty())
return;
if (s[0] == '^' || s[0] == '_') {
bool const up = (s[0] == '^');
selCut();
MathScriptInset * p = prevScriptInset();
@ -659,10 +662,11 @@ void MathCursor::interpret(string const & s)
p = pp;
}
else
p = new MathFuncInset(s, LM_OT_UNDEF);
p = new MathFuncInset(s);
} else {
switch (l->token) {
case LM_TK_BIGSYM:
case LM_TK_FUNCLIM:
p = new MathBigopInset(s, l->id);
break;
@ -691,10 +695,6 @@ void MathCursor::interpret(string const & s)
p = new MathDecorationInset(l->name, l->id);
break;
case LM_TK_FUNCLIM:
p = new MathFuncInset(l->name, LM_OT_FUNCLIM);
break;
case LM_TK_SPACE:
p = new MathSpaceInset(l->id);
break;

View File

@ -117,8 +117,6 @@ enum MathInsetTypes {
/// A LaTeX macro
LM_OT_UNDEF,
///
LM_OT_FUNC,
///
LM_OT_FUNCLIM,
///
LM_OT_MACRO,

View File

@ -14,11 +14,9 @@ using std::ostream;
extern LyXFont WhichFont(short type, int size);
MathFuncInset::MathFuncInset(string const & nm, MathInsetTypes ot)
: MathInset(0, nm, ot)
{
lims_ = (getType() == LM_OT_FUNCLIM);
}
MathFuncInset::MathFuncInset(string const & nm)
: MathInset(0, nm)
{}
MathInset * MathFuncInset::clone() const

View File

@ -15,7 +15,7 @@
class MathFuncInset : public MathInset {
public:
///
explicit MathFuncInset(string const & nm, MathInsetTypes ot = LM_OT_FUNC);
explicit MathFuncInset(string const & nm);
///
virtual MathInset * clone() const;
///
@ -26,8 +26,5 @@ public:
void writeNormal(std::ostream &) const;
///
void metrics(MathStyles st);
private:
///
bool lims_;
};
#endif

View File

@ -200,7 +200,7 @@ latexkeys const wordlist[] =
{"phi", LM_TK_SYM, LM_phi, LMB_NONE},
{"pi", LM_TK_SYM, LM_pi, LMB_NONE},
{"pm", LM_TK_SYM, LM_pm, LMB_OPERATOR},
{"pmod", LM_TK_PMOD, 0, LMB_NONE},
//{"pmod", LM_TK_SYM, 0, LMB_NONE},
{"prec", LM_TK_SYM, LM_prec, LMB_RELATION},
{"preceq", LM_TK_SYM, LM_preceq, LMB_RELATION},
{"prime", LM_TK_SYM, LM_prime, LMB_NONE},

View File

@ -631,9 +631,8 @@ void mathed_parse(MathArray & array, unsigned flags)
break;
case LM_TK_BIGSYM:
//lyxerr << "clearing limits " << limits << "\n";
case LM_TK_FUNCLIM:
limits = 0;
//lyxerr << "found bigop '" << yylval.l->name << "'\n";
array.push_back(new MathBigopInset(yylval.l->name, yylval.l->id));
break;
@ -746,15 +745,10 @@ void mathed_parse(MathArray & array, unsigned flags)
curr_num = false;
break;
case LM_TK_PMOD:
case LM_TK_FUNC:
array.push_back(new MathFuncInset(yylval.l->name));
break;
case LM_TK_FUNCLIM:
array.push_back(new MathFuncInset(yylval.l->name, LM_OT_FUNCLIM));
break;
case LM_TK_UNDEF:
if (MathMacroTable::hasTemplate(yytext)) {
MathMacro * m = MathMacroTable::cloneTemplate(yytext);
@ -763,7 +757,7 @@ void mathed_parse(MathArray & array, unsigned flags)
array.push_back(m);
m->metrics(LM_ST_TEXT);
} else
array.push_back(new MathFuncInset(yytext, LM_OT_UNDEF));
array.push_back(new MathFuncInset(yytext));
break;
case LM_TK_END:

View File

@ -84,10 +84,6 @@ enum MathTokenEnum
///
LM_TK_STY,
///
LM_TK_PMOD,
///
LM_TK_BMOD,
///
LM_TK_MACRO,
///
LM_TK_SPECIAL,