]> git.lyx.org Git - features.git/commitdiff
Move LFUN_ALL_INSETS_TOGGLE dispatch to BufferView.
authorPavel Sanda <sanda@lyx.org>
Tue, 24 Jun 2008 07:52:49 +0000 (07:52 +0000)
committerPavel Sanda <sanda@lyx.org>
Tue, 24 Jun 2008 07:52:49 +0000 (07:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25371 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp
src/LyXFunc.cpp

index 9dec257ac40ca59a60e96fe6aaafc709b22db227..053e2932af20ead9df2206aa9fb18d3d74f0740c 100644 (file)
@@ -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;
        }
index 8c352c2661d34d213b36a82be11b3e8cd558aa5f..6c9d532287bcefb8676ee844f91b2046e922ae8f 100644 (file)
@@ -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();