MathCharInset::MathCharInset(char c, MathTextCodes t)
- : char_(c)
-{
- code(t);
-}
+ : char_(c), code_(t)
+{}
MathInset * MathCharInset::clone() const
{
return char_ == '=' || char_ == '<' || char_ == '>';
}
+
+
+void MathCharInset::handleFont(MathTextCodes t)
+{
+ code_ = (code_ == t) ? LM_TC_VAR : t;
+}
char getChar() const { return char_; }
///
bool isRelOp() const;
+ ///
+ void handleFont(MathTextCodes t);
private:
/// the character
char char_;
+ ///
+ MathTextCodes code_;
};
#endif
MathTextCodes MathCursor::nextCode() const
{
- return (pos() == size()) ? LM_TC_MIN : nextInset()->code();
+ //return (pos() == size()) ? LM_TC_MIN : nextInset()->code();
+ return LM_TC_MIN;
}
getSelection(i1, i2);
if (i1.idx_ == i2.idx_) {
MathArray & ar = i1.cell();
- for (int pos = i1.pos_; pos != i2.pos_; ++pos) {
- MathInset * p = ar.nextInset(pos);
- if (isalnum(p->getChar())) {
- MathTextCodes c = (p->code() == t) ? LM_TC_VAR : t;
- p->code(c);
- }
- }
+ for (int pos = i1.pos_; pos != i2.pos_; ++pos)
+ ar.nextInset(pos)->handleFont(t);
}
} else
lastcode_ = (lastcode_ == t) ? LM_TC_VAR : t;
MathInset::MathInset()
- : size_(LM_ST_DISPLAY), code_(LM_TC_MIN), xo_(0), yo_(0)
+ : size_(LM_ST_DISPLAY), xo_(0), yo_(0)
{}
}
-MathTextCodes MathInset::code() const
-{
- return code_;
-}
-
-
-void MathInset::code(MathTextCodes t)
-{
- code_ = t;
-}
-
-
void MathInset::metrics(MathStyles st) const
{
lyxerr << "MathInset::metrics() called directly!\n";
///
virtual void validate(LaTeXFeatures & features) const;
-
///
- static int workwidth;
+ virtual void handleFont(MathTextCodes) {}
- /// the inherited text style
- virtual MathTextCodes code() const;
///
- virtual void code(MathTextCodes t);
+ static int workwidth;
protected:
/// _sets_ style
void size(MathStyles s) const;
/// the used font size
mutable MathStyles size_;
- /// the inherited text style
- mutable MathTextCodes code_;
private:
/// the following are used for positioning the cursor with the mouse
void Parser::parse_into(MathArray & array, unsigned flags)
{
- static int plevel = -1;
-
- ++plevel;
MathTextCodes yyvarcode = LM_TC_VAR;
int t = yylex();
case LM_TK_ARGUMENT: {
MathMacroArgument * p = new MathMacroArgument(ival_);
- p->code(yyvarcode);
+ //p->code(yyvarcode);
array.push_back(p);
break;
}
case '&':
if (flags & FLAG_AMPERSAND) {
flags &= ~FLAG_AMPERSAND;
- --plevel;
return;
}
lyxerr[Debug::MATHED]
curr_skip_ = lexArg('[');
if (flags & FLAG_NEWLINE) {
flags &= ~FLAG_NEWLINE;
- --plevel;
return;
}
lyxerr[Debug::MATHED]
}
case LM_TK_RIGHT:
- if (flags & FLAG_RIGHT) {
- --plevel;
+ if (flags & FLAG_RIGHT)
return;
- }
error("Unmatched right delimiter");
// panic = true;
break;
case LM_TK_MATH:
case LM_TK_END:
- --plevel;
return;
case LM_TK_BEGIN:
t = yylex();
}
}
- --plevel;
}