re-enable automatic deletion of empty super/subscripts;

remove now unneeded pos() argument from idxUp/idxDown functions;


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3197 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-12-12 13:11:28 +00:00
parent 3b4ee1725c
commit 18f613448f
11 changed files with 28 additions and 36 deletions

View File

@ -156,11 +156,9 @@ bool MathCursor::popLeft()
//cerr << "Leaving atom "; par()->write(cerr, false); cerr << " left\n";
if (Cursor_.size() <= 1)
return false;
//if (nextInset())
// nextInset()->removeEmptyScripts();
if (par()->asScriptInset())
par()->asScriptInset()->removeEmptyScripts();
Cursor_.pop_back();
//if (nextAtom())
// nextAtom()->removeEmptyScripts();
return true;
}
@ -170,11 +168,9 @@ bool MathCursor::popRight()
//cerr << "Leaving atom "; par()->write(cerr, false); cerr << " right\n";
if (Cursor_.size() <= 1)
return false;
//if (nextInset())
// nextInset()->removeEmptyScripts();
if (par()->asScriptInset())
par()->asScriptInset()->removeEmptyScripts();
Cursor_.pop_back();
//if (nextInset())
// nextInset()->removeEmptyScripts();
posRight();
return true;
}
@ -1141,10 +1137,10 @@ bool MathCursor::goUpDown(bool up)
while (1) {
// we found a cell that think something "below" us.
if (up) {
if (par()->idxUp(idx(), pos()))
if (par()->idxUp(idx()))
break;
} else {
if (par()->idxDown(idx(), pos()))
if (par()->idxDown(idx()))
break;
}

View File

@ -57,23 +57,19 @@ bool MathFracbaseInset::idxLastDown(idx_type & idx, pos_type & pos) const
}
bool MathFracbaseInset::idxUp(MathInset::idx_type & idx,
MathInset::pos_type & pos) const
bool MathFracbaseInset::idxUp(idx_type & idx) const
{
if (idx == 0)
return false;
idx = 0;
pos = std::min(pos, cell(idx).size());
return true;
}
bool MathFracbaseInset::idxDown(MathInset::idx_type & idx,
MathInset::pos_type & pos) const
bool MathFracbaseInset::idxDown(idx_type & idx) const
{
if (idx == 1)
return false;
idx = 1;
pos = std::min(pos, cell(idx).size());
return true;
}

View File

@ -13,9 +13,9 @@ public:
///
MathFracbaseInset();
///
bool idxUp(idx_type &, pos_type &) const;
bool idxUp(idx_type &) const;
///
bool idxDown(idx_type &, pos_type &) const;
bool idxDown(idx_type &) const;
///
bool idxLeft(idx_type &, pos_type &) const;
///

View File

@ -487,7 +487,7 @@ int MathGridInset::cellYOffset(idx_type idx) const
}
bool MathGridInset::idxUp(idx_type & idx, pos_type & pos) const
bool MathGridInset::idxUp(idx_type & idx) const
{
if (idx < ncols())
return false;
@ -496,7 +496,7 @@ bool MathGridInset::idxUp(idx_type & idx, pos_type & pos) const
}
bool MathGridInset::idxDown(idx_type & idx, pos_type & pos) const
bool MathGridInset::idxDown(idx_type & idx) const
{
if (idx >= ncols() * (nrows() - 1))
return false;

View File

@ -110,9 +110,9 @@ public:
int cellYOffset(idx_type idx) const;
///
bool idxUp(idx_type &, pos_type &) const;
bool idxUp(idx_type &) const;
///
bool idxDown(idx_type &, pos_type &) const;
bool idxDown(idx_type &) const;
///
bool idxLeft(idx_type &, pos_type &) const;
///

View File

@ -106,13 +106,13 @@ bool MathInset::idxLeft(idx_type &, pos_type &) const
}
bool MathInset::idxUp(idx_type &, pos_type &) const
bool MathInset::idxUp(idx_type &) const
{
return false;
}
bool MathInset::idxDown(idx_type &, pos_type &) const
bool MathInset::idxDown(idx_type &) const
{
return false;
}

View File

@ -114,9 +114,9 @@ public:
virtual int height() const;
/// Where should we go when we press the up cursor key?
virtual bool idxUp(idx_type & idx, pos_type & pos) const;
virtual bool idxUp(idx_type & idx) const;
/// The down key
virtual bool idxDown(idx_type & idx, pos_type & pos) const;
virtual bool idxDown(idx_type & idx) const;
/// The left key
virtual bool idxLeft(idx_type & idx, pos_type & pos) const;
/// The right key

View File

@ -162,14 +162,16 @@ void MathMacro::dump() const
}
bool MathMacro::idxUp(idx_type & idx, pos_type & pos) const
bool MathMacro::idxUp(idx_type & idx) const
{
pos_type pos;
return MathNestInset::idxLeft(idx, pos);
}
bool MathMacro::idxDown(idx_type & idx, pos_type & pos) const
bool MathMacro::idxDown(idx_type & idx) const
{
pos_type pos;
return MathNestInset::idxRight(idx, pos);
}

View File

@ -51,9 +51,9 @@ public:
void dump() const;
///
bool idxUp(idx_type &, pos_type &) const;
bool idxUp(idx_type &) const;
///
bool idxDown(idx_type &, pos_type &) const;
bool idxDown(idx_type &) const;
///
bool idxLeft(idx_type &, pos_type &) const;
///

View File

@ -70,22 +70,20 @@ void MathRootInset::normalize(NormalStream & os) const
}
bool MathRootInset::idxUp(idx_type & idx, pos_type & pos) const
bool MathRootInset::idxUp(idx_type & idx) const
{
if (idx == 0)
return false;
idx = 0;
pos = cell(0).size();
return true;
}
bool MathRootInset::idxDown(idx_type & idx, pos_type & pos) const
bool MathRootInset::idxDown(idx_type & idx) const
{
if (idx == 1)
return false;
idx = 1;
pos = 0;
return true;
}

View File

@ -32,9 +32,9 @@ public:
///
MathInset * clone() const;
///
bool idxUp(idx_type & idx, pos_type & pos) const;
bool idxUp(idx_type & idx) const;
///
bool idxDown(idx_type & idx, pos_type & pos) const;
bool idxDown(idx_type & idx) const;
///
void metrics(MathMetricsInfo const & st) const;
///