mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Compare: simplify the step functions.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32927 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
28b0075b11
commit
c49dea81a9
@ -34,35 +34,22 @@ enum Direction {
|
||||
};
|
||||
|
||||
|
||||
void step_forward(DocIterator & dit)
|
||||
static void step(DocIterator & dit, Direction direction)
|
||||
{
|
||||
dit.top().forwardPos();
|
||||
if (direction == Forward)
|
||||
dit.top().forwardPos();
|
||||
else
|
||||
dit.top().backwardPos();
|
||||
}
|
||||
|
||||
|
||||
void step_backward(DocIterator & dit)
|
||||
static void step(DocIterator & dit, DocIterator const & end, Direction direction)
|
||||
{
|
||||
dit.top().backwardPos();
|
||||
if (dit != end)
|
||||
step(dit, direction);
|
||||
}
|
||||
|
||||
|
||||
bool step_forward(DocIterator & dit, DocIterator const & end)
|
||||
{
|
||||
if (dit == end)
|
||||
return false;
|
||||
step_forward(dit);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool step_backward(DocIterator & dit, DocIterator const & beg)
|
||||
{
|
||||
if (dit == beg)
|
||||
return false;
|
||||
step_backward(dit);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* A pair of two DocIterators that form a range.
|
||||
*/
|
||||
@ -138,15 +125,15 @@ public:
|
||||
|
||||
DocPair & operator++()
|
||||
{
|
||||
step_forward(o);
|
||||
step_forward(n);
|
||||
step(o, Forward);
|
||||
step(n, Forward);
|
||||
return *this;
|
||||
}
|
||||
|
||||
DocPair & operator--()
|
||||
{
|
||||
step_backward(o);
|
||||
step_backward(n);
|
||||
step(o, Backward);
|
||||
step(n, Backward);
|
||||
return *this;
|
||||
}
|
||||
///
|
||||
@ -188,8 +175,8 @@ DocRangePair stepIntoInset(DocPair const & inset_location)
|
||||
DocRangePair rp(inset_location, inset_location);
|
||||
rp.o.from.forwardPos();
|
||||
rp.n.from.forwardPos();
|
||||
step_forward(rp.o.to);
|
||||
step_forward(rp.n.to);
|
||||
step(rp.o.to, Forward);
|
||||
step(rp.n.to, Forward);
|
||||
rp.o.to.backwardPos();
|
||||
rp.n.to.backwardPos();
|
||||
return rp;
|
||||
|
Loading…
Reference in New Issue
Block a user