mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
small stuff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2484 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6c12ac0526
commit
2da8fcabdc
@ -12,10 +12,8 @@
|
||||
|
||||
|
||||
MathCharInset::MathCharInset(char c, MathTextCodes t)
|
||||
: char_(c)
|
||||
{
|
||||
code(t);
|
||||
}
|
||||
: char_(c), code_(t)
|
||||
{}
|
||||
|
||||
|
||||
MathInset * MathCharInset::clone() const
|
||||
@ -82,3 +80,9 @@ bool MathCharInset::isRelOp() const
|
||||
{
|
||||
return char_ == '=' || char_ == '<' || char_ == '>';
|
||||
}
|
||||
|
||||
|
||||
void MathCharInset::handleFont(MathTextCodes t)
|
||||
{
|
||||
code_ = (code_ == t) ? LM_TC_VAR : t;
|
||||
}
|
||||
|
@ -38,9 +38,13 @@ public:
|
||||
char getChar() const { return char_; }
|
||||
///
|
||||
bool isRelOp() const;
|
||||
///
|
||||
void handleFont(MathTextCodes t);
|
||||
|
||||
private:
|
||||
/// the character
|
||||
char char_;
|
||||
///
|
||||
MathTextCodes code_;
|
||||
};
|
||||
#endif
|
||||
|
@ -870,7 +870,8 @@ void MathCursor::drawSelection(Painter & pain) const
|
||||
|
||||
MathTextCodes MathCursor::nextCode() const
|
||||
{
|
||||
return (pos() == size()) ? LM_TC_MIN : nextInset()->code();
|
||||
//return (pos() == size()) ? LM_TC_MIN : nextInset()->code();
|
||||
return LM_TC_MIN;
|
||||
}
|
||||
|
||||
|
||||
@ -882,13 +883,8 @@ void MathCursor::handleFont(MathTextCodes t)
|
||||
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;
|
||||
|
@ -27,7 +27,7 @@ int MathInset::workwidth;
|
||||
|
||||
|
||||
MathInset::MathInset()
|
||||
: size_(LM_ST_DISPLAY), code_(LM_TC_MIN), xo_(0), yo_(0)
|
||||
: size_(LM_ST_DISPLAY), xo_(0), yo_(0)
|
||||
{}
|
||||
|
||||
|
||||
@ -283,18 +283,6 @@ std::vector<int> MathInset::idxBetween(int from, int to) const
|
||||
}
|
||||
|
||||
|
||||
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";
|
||||
|
@ -192,22 +192,17 @@ public:
|
||||
|
||||
///
|
||||
virtual void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
virtual void handleFont(MathTextCodes) {}
|
||||
|
||||
///
|
||||
static int workwidth;
|
||||
|
||||
/// the inherited text style
|
||||
virtual MathTextCodes code() const;
|
||||
///
|
||||
virtual void code(MathTextCodes t);
|
||||
|
||||
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
|
||||
|
@ -556,9 +556,6 @@ latexkeys const * Parser::read_delim()
|
||||
|
||||
void Parser::parse_into(MathArray & array, unsigned flags)
|
||||
{
|
||||
static int plevel = -1;
|
||||
|
||||
++plevel;
|
||||
MathTextCodes yyvarcode = LM_TC_VAR;
|
||||
|
||||
int t = yylex();
|
||||
@ -602,7 +599,7 @@ void Parser::parse_into(MathArray & array, unsigned flags)
|
||||
|
||||
case LM_TK_ARGUMENT: {
|
||||
MathMacroArgument * p = new MathMacroArgument(ival_);
|
||||
p->code(yyvarcode);
|
||||
//p->code(yyvarcode);
|
||||
array.push_back(p);
|
||||
break;
|
||||
}
|
||||
@ -670,7 +667,6 @@ void Parser::parse_into(MathArray & array, unsigned flags)
|
||||
case '&':
|
||||
if (flags & FLAG_AMPERSAND) {
|
||||
flags &= ~FLAG_AMPERSAND;
|
||||
--plevel;
|
||||
return;
|
||||
}
|
||||
lyxerr[Debug::MATHED]
|
||||
@ -682,7 +678,6 @@ void Parser::parse_into(MathArray & array, unsigned flags)
|
||||
curr_skip_ = lexArg('[');
|
||||
if (flags & FLAG_NEWLINE) {
|
||||
flags &= ~FLAG_NEWLINE;
|
||||
--plevel;
|
||||
return;
|
||||
}
|
||||
lyxerr[Debug::MATHED]
|
||||
@ -773,10 +768,8 @@ void Parser::parse_into(MathArray & array, unsigned flags)
|
||||
}
|
||||
|
||||
case LM_TK_RIGHT:
|
||||
if (flags & FLAG_RIGHT) {
|
||||
--plevel;
|
||||
if (flags & FLAG_RIGHT)
|
||||
return;
|
||||
}
|
||||
error("Unmatched right delimiter");
|
||||
// panic = true;
|
||||
break;
|
||||
@ -825,7 +818,6 @@ void Parser::parse_into(MathArray & array, unsigned flags)
|
||||
|
||||
case LM_TK_MATH:
|
||||
case LM_TK_END:
|
||||
--plevel;
|
||||
return;
|
||||
|
||||
case LM_TK_BEGIN:
|
||||
@ -881,7 +873,6 @@ void Parser::parse_into(MathArray & array, unsigned flags)
|
||||
t = yylex();
|
||||
}
|
||||
}
|
||||
--plevel;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user