mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
more streamlining
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3730 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d15da27db8
commit
b5c6adc5fb
@ -39,25 +39,13 @@ MathInset * MathIterator::par()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathXArray const & MathIterator::xcell() const
|
|
||||||
{
|
|
||||||
return par()->xcell(position().idx_);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MathArray const & MathIterator::cell() const
|
MathArray const & MathIterator::cell() const
|
||||||
{
|
{
|
||||||
return par()->xcell(position().idx_).data_;
|
MathCursorPos const & top = position();
|
||||||
|
return top.par_->cell(top.idx_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathInset * MathIterator::nextInset() const
|
|
||||||
{
|
|
||||||
if (position().pos_ == xcell().data_.size())
|
|
||||||
return 0;
|
|
||||||
return (xcell().begin() + position().pos_)->nucleus();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MathIterator::push(MathInset * p)
|
void MathIterator::push(MathInset * p)
|
||||||
{
|
{
|
||||||
@ -88,24 +76,29 @@ MathCursorPos const & MathIterator::operator->() const
|
|||||||
|
|
||||||
void MathIterator::goEnd()
|
void MathIterator::goEnd()
|
||||||
{
|
{
|
||||||
position().idx_ = par()->nargs() - 1;
|
MathCursorPos & top = position();
|
||||||
position().pos_ = xcell().data_.size();
|
top.idx_ = top.par_->nargs() - 1;
|
||||||
|
top.pos_ = cell().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathIterator::operator++()
|
void MathIterator::operator++()
|
||||||
{
|
{
|
||||||
|
MathCursorPos & top = position();
|
||||||
|
MathArray const & ar = top.par_->cell(top.idx_);
|
||||||
|
|
||||||
// move into the current inset if possible
|
// move into the current inset if possible
|
||||||
// it is impossible for pos() == size()!
|
// it is impossible for pos() == size()!
|
||||||
MathInset * n = nextInset();
|
MathInset * n = 0;
|
||||||
|
if (top.pos_ != ar.size())
|
||||||
|
n = (ar.begin() + top.pos_)->nucleus();
|
||||||
if (n && n->isActive()) {
|
if (n && n->isActive()) {
|
||||||
push(n);
|
push(n);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise move on one cell position if possible
|
// otherwise move on one cell position if possible
|
||||||
MathCursorPos & top = position();
|
if (top.pos_ < ar.size()) {
|
||||||
if (top.pos_ < top.par_->cell(top.idx_).size()) {
|
|
||||||
// pos() == size() is valid!
|
// pos() == size() is valid!
|
||||||
++top.pos_;
|
++top.pos_;
|
||||||
return;
|
return;
|
||||||
@ -121,8 +114,8 @@ void MathIterator::operator++()
|
|||||||
|
|
||||||
// otherwise leave array, move on one position
|
// otherwise leave array, move on one position
|
||||||
// this might yield pos() == size(), but that's a ok.
|
// this might yield pos() == size(), but that's a ok.
|
||||||
// it certainly invalidates top
|
|
||||||
pop();
|
pop();
|
||||||
|
// it certainly invalidates top
|
||||||
++position().pos_;
|
++position().pos_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,10 +38,6 @@ public:
|
|||||||
MathArray const & cell() const;
|
MathArray const & cell() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// read access to top most item
|
|
||||||
MathXArray const & xcell() const;
|
|
||||||
/// write access to top most item
|
|
||||||
MathInset * nextInset() const;
|
|
||||||
/// own level down
|
/// own level down
|
||||||
void push(MathInset *);
|
void push(MathInset *);
|
||||||
/// own level up
|
/// own level up
|
||||||
|
Loading…
Reference in New Issue
Block a user