mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 14:29:21 +00:00
Move LFUN_ALL_INSETS_TOGGLE dispatch to BufferView.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25371 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4080b7cc24
commit
78356819ea
@ -867,6 +867,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
case LFUN_BIBTEX_DATABASE_DEL:
|
||||
case LFUN_GRAPHICS_GROUPS_UNIFY:
|
||||
case LFUN_NOTES_MUTATE:
|
||||
case LFUN_ALL_INSETS_TOGGLE:
|
||||
case LFUN_STATISTICS:
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
@ -1404,7 +1405,7 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
processUpdateFlags(Update::Force);
|
||||
break;
|
||||
|
||||
// These Two could be rewriten using some command like forall <insetname> <command>
|
||||
// These two could be rewriten using some command like forall <insetname> <command>
|
||||
// once the insets refactoring is done.
|
||||
case LFUN_GRAPHICS_GROUPS_UNIFY: {
|
||||
if (cmd.argument().empty())
|
||||
@ -1426,6 +1427,29 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_ALL_INSETS_TOGGLE: {
|
||||
string action;
|
||||
string const name = split(to_utf8(cmd.argument()), action, ' ');
|
||||
InsetCode const inset_code = insetCode(name);
|
||||
|
||||
FuncRequest fr(LFUN_INSET_TOGGLE, action);
|
||||
|
||||
Inset & inset = cur.buffer().inset();
|
||||
InsetIterator it = inset_iterator_begin(inset);
|
||||
InsetIterator const end = inset_iterator_end(inset);
|
||||
for (; it != end; ++it) {
|
||||
if (!it->asInsetMath()
|
||||
&& (inset_code == NO_CODE
|
||||
|| inset_code == it->lyxCode())) {
|
||||
Cursor tmpcur = cur;
|
||||
tmpcur.pushBackward(*it);
|
||||
it->dispatch(tmpcur, fr);
|
||||
}
|
||||
}
|
||||
processUpdateFlags(Update::Force | Update::FitCursor);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -581,7 +581,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
case LFUN_PREFERENCES_SAVE:
|
||||
case LFUN_MESSAGE:
|
||||
case LFUN_INSET_EDIT:
|
||||
case LFUN_ALL_INSETS_TOGGLE:
|
||||
case LFUN_BUFFER_LANGUAGE:
|
||||
case LFUN_TEXTCLASS_APPLY:
|
||||
case LFUN_TEXTCLASS_LOAD:
|
||||
@ -1378,32 +1377,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
lyx_view_->message(from_utf8(argument));
|
||||
break;
|
||||
|
||||
|
||||
case LFUN_ALL_INSETS_TOGGLE: {
|
||||
LASSERT(lyx_view_, /**/);
|
||||
string action;
|
||||
string const name = split(argument, action, ' ');
|
||||
InsetCode const inset_code = insetCode(name);
|
||||
|
||||
Cursor & cur = view()->cursor();
|
||||
FuncRequest fr(LFUN_INSET_TOGGLE, action);
|
||||
|
||||
Inset & inset = lyx_view_->buffer()->inset();
|
||||
InsetIterator it = inset_iterator_begin(inset);
|
||||
InsetIterator const end = inset_iterator_end(inset);
|
||||
for (; it != end; ++it) {
|
||||
if (!it->asInsetMath()
|
||||
&& (inset_code == NO_CODE
|
||||
|| inset_code == it->lyxCode())) {
|
||||
Cursor tmpcur = cur;
|
||||
tmpcur.pushBackward(*it);
|
||||
it->dispatch(tmpcur, fr);
|
||||
}
|
||||
}
|
||||
updateFlags = Update::Force | Update::FitCursor;
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_BUFFER_LANGUAGE: {
|
||||
LASSERT(lyx_view_, /**/);
|
||||
Buffer & buffer = *lyx_view_->buffer();
|
||||
|
Loading…
Reference in New Issue
Block a user