small mathed change add the find_if

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1632 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-02-27 11:26:18 +00:00
parent 4541e746fe
commit d559de976f
6 changed files with 62 additions and 43 deletions

View File

@ -63,6 +63,7 @@ extern int greek_kb_flag;
using SigC::slot;
#endif
using std::find_if;
using std::pair;
using std::endl;
using std::make_pair;

View File

@ -1,3 +1,7 @@
2001-02-27 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* BufferView_pimpl.C: add using std::find_if
2001-02-27 José Matos <jamatos@fep.up.pt>
* LaTeXFeatures.C (getIncludedFiles): call to BasePath replaced

View File

@ -1,3 +1,11 @@
2001-02-27 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* math_parinset.C (draw): move MathedXiter data(this) up. and
remove it two other places.
* math_macro.C (MathMacro): use array directly, don't use
setArgumentIdx and GetData
2001-02-26 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* math_macroarg.C (MathMacroArgument): delete

View File

@ -44,8 +44,8 @@ ostream & operator<<(ostream & o, MathedTextCodes mtc)
}
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();
@ -58,8 +58,8 @@ MathMacro::MathMacro(MathMacroTemplate * t):
}
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();
@ -68,9 +68,10 @@ MathMacro::MathMacro(MathMacro * m):
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;
}
}

View File

@ -59,8 +59,7 @@ void MathMacroTemplate::setEditMode(bool ed)
for (int i = 0; i < nargs_; ++i) {
args_[i].setExpand(false);
}
}
else {
} else {
flags_ &= ~MMF_Edit;
for (int i = 0; i < nargs_; ++i) {
args_[i].setExpand(true);
@ -73,7 +72,7 @@ void MathMacroTemplate::draw(Painter & pain, int x, int y)
{
int x2;
int y2;
bool expnd = (nargs_ > 0) ? args_[0].getExpand(): false;
bool expnd = (nargs_ > 0) ? args_[0].getExpand() : false;
if (flags_ & MMF_Edit) {
for (int i = 0; i < nargs_; ++i) {
args_[i].setExpand(false);
@ -99,7 +98,7 @@ void MathMacroTemplate::draw(Painter & pain, int x, int y)
void MathMacroTemplate::Metrics()
{
bool expnd = (nargs_ > 0) ? args_[0].getExpand(): false;
bool expnd = (nargs_ > 0) ? args_[0].getExpand() : false;
if (flags_ & MMF_Edit) {
for (int i = 0; i < nargs_; ++i) {

View File

@ -35,6 +35,7 @@ MathParInset::MathParInset(short st, string const & nm, short ot)
}
// This is virtual and needed.
MathParInset::~MathParInset()
{
}
@ -73,24 +74,25 @@ MathParInset::draw(Painter & pain, int x, int y)
xo_ = x;
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)) {
@ -98,46 +100,49 @@ MathParInset::draw(Painter & pain, int x, int y)
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;
}
@ -146,7 +151,8 @@ MathParInset::draw(Painter & pain, int x, int y)
}
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);
}
}