mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Combine OutlineIn and OutlineOut blocks
They differ only by adding/subtracting 1.
This commit is contained in:
parent
2a0ae2e739
commit
4cfc110d4a
@ -409,25 +409,7 @@ static void outline(OutlineOp mode, Cursor & cur)
|
|||||||
cur.pit() = newpit - len;
|
cur.pit() = newpit - len;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OutlineIn: {
|
case OutlineIn:
|
||||||
pit_type const len = distance(start, finish);
|
|
||||||
buf.undo().recordUndo(cur, ATOMIC_UNDO, pit, pit + len - 1);
|
|
||||||
for (; start != finish; ++start) {
|
|
||||||
toclevel = buf.text().getTocLevel(distance(bgn, start));
|
|
||||||
if (toclevel == Layout::NOT_IN_TOC)
|
|
||||||
continue;
|
|
||||||
DocumentClass::const_iterator lit = tc.begin();
|
|
||||||
DocumentClass::const_iterator len = tc.end();
|
|
||||||
for (; lit != len; ++lit) {
|
|
||||||
if (lit->toclevel == toclevel + 1 &&
|
|
||||||
start->layout().labeltype == lit->labeltype) {
|
|
||||||
start->setLayout(*lit);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case OutlineOut: {
|
case OutlineOut: {
|
||||||
pit_type const len = distance(start, finish);
|
pit_type const len = distance(start, finish);
|
||||||
buf.undo().recordUndo(cur, ATOMIC_UNDO, pit, pit + len - 1);
|
buf.undo().recordUndo(cur, ATOMIC_UNDO, pit, pit + len - 1);
|
||||||
@ -438,10 +420,11 @@ static void outline(OutlineOp mode, Cursor & cur)
|
|||||||
DocumentClass::const_iterator lit = tc.begin();
|
DocumentClass::const_iterator lit = tc.begin();
|
||||||
DocumentClass::const_iterator len = tc.end();
|
DocumentClass::const_iterator len = tc.end();
|
||||||
for (; lit != len; ++lit) {
|
for (; lit != len; ++lit) {
|
||||||
if (lit->toclevel == toclevel - 1 &&
|
if (lit->toclevel == (mode == OutlineIn ?
|
||||||
start->layout().labeltype == lit->labeltype) {
|
toclevel + 1 : toclevel - 1) &&
|
||||||
start->setLayout(*lit);
|
start->layout().labeltype == lit->labeltype) {
|
||||||
break;
|
start->setLayout(*lit);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user