Fix bug 2756:

* src/BufferView_pimpl.C (dispatch/LFUN_NEXT_INSET_TOGGLE): moved from
	LyXText.

	* src/text3.C (dispatch/LFUN_NEXT_INSET_TOGGLE): moved to
	BufferView::Pimpl, since this should work in mathed too.

	* src/mathed/math_nestinset.C (doDispatch/LFUN_INSET_TOGGLE): do not try to
	do the work which belongs to LFUN_NEXT_INSET_TOGGLE (bug 2756).



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@14616 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2006-08-11 21:40:24 +00:00
parent 8d7df59e74
commit 84e22d209e
6 changed files with 45 additions and 33 deletions

View File

@ -1054,6 +1054,7 @@ FuncStatus BufferView::Pimpl::getStatus(FuncRequest const & cmd)
case LFUN_BIBDB_ADD: case LFUN_BIBDB_ADD:
case LFUN_BIBDB_DEL: case LFUN_BIBDB_DEL:
case LFUN_WORDS_COUNT: case LFUN_WORDS_COUNT:
case LFUN_NEXT_INSET_TOGGLE:
flag.enabled(true); flag.enabled(true);
break; break;
@ -1351,6 +1352,30 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
buffer_->params().compressed = !buffer_->params().compressed; buffer_->params().compressed = !buffer_->params().compressed;
break; break;
case LFUN_NEXT_INSET_TOGGLE: {
// this is the real function we want to invoke
FuncRequest tmpcmd = FuncRequest(LFUN_INSET_TOGGLE, cmd.origin);
// if there is an inset at cursor, see whether it
// wants to toggle.
InsetBase * inset = cur.nextInset();
if (inset && inset->isActive()) {
LCursor tmpcur = cur;
tmpcur.pushLeft(*inset);
inset->dispatch(tmpcur, tmpcmd);
if (tmpcur.result().dispatched()) {
cur.dispatched();
}
}
// if it did not work, try the underlying inset.
if (!cur.result().dispatched())
cur.dispatch(tmpcmd);
if (cur.result().dispatched())
cur.clearSelection();
break;
}
default: default:
return false; return false;
} }

View File

@ -1,3 +1,11 @@
2006-08-09 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* BufferView_pimpl.C (dispatch/LFUN_NEXT_INSET_TOGGLE): moved from
LyXText.
* text3.C (dispatch/LFUN_NEXT_INSET_TOGGLE): moved to
BufferView::Pimpl, since this should work in mathed too.
2006-08-10 Jean-Marc Lasgouttes <lasgouttes@lyx.org> 2006-08-10 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* buffer.C (save): fix logic error in fix to bug 2740. * buffer.C (save): fix logic error in fix to bug 2740.

View File

@ -1,3 +1,8 @@
2006-08-09 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* math_nestinset.C (doDispatch/LFUN_INSET_TOGGLE): do not try to
do the work which belongs to LFUN_NEXT_INSET_TOGGLE (bug 2756).
2006-08-09 Jean-Marc Lasgouttes <lasgouttes@lyx.org> 2006-08-09 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* math_nestinset.C (script): * math_nestinset.C (script):

View File

@ -649,15 +649,8 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
case LFUN_INSET_TOGGLE: case LFUN_INSET_TOGGLE:
recordUndo(cur); recordUndo(cur);
//lockToggle(); lock(!lock());
if (cur.pos() != cur.lastpos()) { cur.popRight();
// toggle previous inset ...
cur.nextAtom().nucleus()->lock(!cur.nextAtom()->lock());
} else if (cur.popLeft() && cur.pos() != cur.lastpos()) {
// ... or enclosing inset if we are in the last inset position
cur.nextAtom().nucleus()->lock(!cur.nextAtom()->lock());
++cur.pos();
}
break; break;
case LFUN_SELFINSERT: case LFUN_SELFINSERT:

View File

@ -674,28 +674,6 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
cur.inset().showInsetDialog(bv); cur.inset().showInsetDialog(bv);
break; break;
case LFUN_NEXT_INSET_TOGGLE: {
InsetBase * inset = cur.nextInset();
// this is the real function we want to invoke
cmd = FuncRequest(LFUN_INSET_TOGGLE);
cur.undispatched();
// if there is an inset at cursor, see whether it
// wants to toggle.
if (inset) {
LCursor tmpcur = cur;
tmpcur.pushLeft(*inset);
inset->dispatch(tmpcur, cmd);
if (tmpcur.result().dispatched()) {
cur.clearSelection();
cur.dispatched();
}
}
// if it did not work, try the underlying inset.
if (!cur.result().dispatched())
cur.inset().dispatch(cur, cmd);
break;
}
case LFUN_SPACE_INSERT: case LFUN_SPACE_INSERT:
if (cur.paragraph().layout()->free_spacing) if (cur.paragraph().layout()->free_spacing)
insertChar(cur, ' '); insertChar(cur, ' ');
@ -1719,7 +1697,6 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
case LFUN_BREAKPARAGRAPH_SKIP: case LFUN_BREAKPARAGRAPH_SKIP:
case LFUN_PARAGRAPH_SPACING: case LFUN_PARAGRAPH_SPACING:
case LFUN_INSET_INSERT: case LFUN_INSET_INSERT:
case LFUN_NEXT_INSET_TOGGLE:
case LFUN_UPCASE_WORD: case LFUN_UPCASE_WORD:
case LFUN_LOWCASE_WORD: case LFUN_LOWCASE_WORD:
case LFUN_CAPITALIZE_WORD: case LFUN_CAPITALIZE_WORD:

View File

@ -24,12 +24,16 @@ What's new
- New Czech translation; update Italian localization. - New Czech translation; update Italian localization.
- Updated Czech translation of the Tutorial. - Updated Czech translation of the Tutorial; new Czech translation of
the splash document.
** Bug fixes: ** Bug fixes:
* Document Input/Output * Document Input/Output
- Fix crash when using next-inset-toggle (Ctrl+I) inside mathed; make
inset locking in mathed generally work (bug 2756).
- Fix crash on save (including dataloss) when the backup directory - Fix crash on save (including dataloss) when the backup directory
was invalid or not writeable(bug 2740). was invalid or not writeable(bug 2740).