}
-MathMacro::MathMacro(MathMacroTemplate * t):
- MathParInset(LM_ST_TEXT, "", LM_OT_MACRO), tmplate_(t)
+MathMacro::MathMacro(MathMacroTemplate * t)
+ : MathParInset(LM_ST_TEXT, "", LM_OT_MACRO), tmplate_(t)
{
nargs_ = tmplate_->getNoArgs();
tcode_ = tmplate_->getTCode();
}
-MathMacro::MathMacro(MathMacro * m):
- MathParInset(LM_ST_TEXT, m->GetName(), LM_OT_MACRO)
+MathMacro::MathMacro(MathMacro * m)
+ : MathParInset(LM_ST_TEXT, m->GetName(), LM_OT_MACRO)
{
tmplate_ = m->tmplate_;
nargs_ = tmplate_->getNoArgs();
idx_ = 0;
SetName(tmplate_->GetName());
for (int i = 0; i < tmplate_->getNoArgs(); ++i) {
- m->setArgumentIdx(i);
+ //m->setArgumentIdx(i);
args_[i].row = m->args_[i].row;
- args_[i].array = m->GetData();
+ //args_[i].array = m->GetData();
+ args_[i].array = m->args_[i].array;
}
}
}
+// This is virtual and needed.
MathParInset::~MathParInset()
{
}
bool limits = false;
xo_ = x;
- yo_ = y;
+ yo_ = y;
+ MathedXIter data(this);
if (array.empty()) {
- MathedXIter data(this);
+ //MathedXIter data(this);
data.GetPos(x, y);
- pain.rectangle(x, y - df_asc, df_width, df_asc, LColor::mathline);
+ pain.rectangle(x, y - df_asc, df_width, df_asc,
+ LColor::mathline);
return;
- }
- MathedXIter data(this);
+ }
+ //MathedXIter data(this);
data.GoBegin();
while (data.OK()) {
data.GetPos(x, y);
byte cx = data.GetChar();
if (cx >= ' ') {
- string s = data.GetString();
+ string const s = data.GetString();
drawStr(pain, data.fcode(), size(), x, y, s);
mathed_char_height(LM_TC_CONST, size(), 'y', asc, des);
limits = false;
- }
- else {
+ } else {
if (cx == 0)
break;
if (MathIsInset(cx)) {
MathedInset * p = data.GetInset();
if (cx == LM_TC_UP) {
if (limits) {
- x -= (xp>p->Width()) ? p->Width()+(xp-p->Width())/2: xp;
- yy -= (asc + p->Descent()+4);
- }
- else
- yy -= (p->Descent()>asc) ? p->Descent()+4: asc;
- }
- else if (cx == LM_TC_DOWN) {
+ x -= (xp > p->Width()) ?
+ p->Width() + (xp - p->Width()) / 2 : xp;
+ yy -= (asc + p->Descent() + 4);
+ } else
+ yy -= (p->Descent() > asc) ?
+ p->Descent() + 4 : asc;
+ } else if (cx == LM_TC_DOWN) {
if (limits) {
- x -= (xp>p->Width()) ? p->Width()+(xp-p->Width())/2: xp;
+ x -= (xp > p->Width()) ?
+ p->Width() + (xp - p->Width()) / 2 : xp;
yy += des + p->Ascent() + 2;
} else
- yy += des + p->Ascent()/2;
- }
- else {
+ yy += des + p->Ascent() / 2;
+ } else {
asc = p->Ascent();
des = p->Descent();
}
p->draw(pain, x, yy);
- if (cx!= LM_TC_UP && cx!= LM_TC_DOWN) {
+ if (cx != LM_TC_UP && cx != LM_TC_DOWN) {
limits = p->GetLimits();
if (limits)
xp = p->Width();
}
data.Next();
- }
- else if (cx == LM_TC_TAB) {
- if (cxp == cx || cxp == LM_TC_CR || data.IsFirst()) {
- pain.rectangle(x, y - df_asc, df_width, df_asc, LColor::mathline);
+ } else if (cx == LM_TC_TAB) {
+ if (cxp == cx
+ || cxp == LM_TC_CR || data.IsFirst()) {
+ pain.rectangle(x, y - df_asc,
+ df_width, df_asc,
+ LColor::mathline);
}
data.Next();
limits = false;
- }
- else if (cx == LM_TC_CR) {
- if (cxp == LM_TC_TAB || cxp == LM_TC_CR || data.IsFirst()) {
- pain.rectangle(x, y - df_asc, df_width, df_asc, LColor::mathline);
+ } else if (cx == LM_TC_CR) {
+ if (cxp == LM_TC_TAB
+ || cxp == LM_TC_CR || data.IsFirst()) {
+ pain.rectangle(x, y - df_asc,
+ df_width, df_asc,
+ LColor::mathline);
}
data.Next();
limits = false;
- }
- else {
+ } else {
lyxerr << "GMathed Error: Unrecognized code[" << cx << "]" << endl;
break;
}
}
if (cxp == LM_TC_TAB || cxp == LM_TC_CR) {
data.GetPos(x, y);
- pain.rectangle(x, y - df_asc, df_width, df_asc, LColor::mathline);
+ pain.rectangle(x, y - df_asc, df_width, df_asc,
+ LColor::mathline);
}
}