]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
* GuiView.cpp:
[lyx.git] / src / LyXFunc.cpp
index 03f87ff2b255b479b4eb7bbb2d4db277ae3ceda8..baea6d962c8560b5499c6c0b90e88eee3c25a2a8 100644 (file)
@@ -62,9 +62,9 @@
 #include "insets/InsetERT.h"
 #include "insets/InsetExternal.h"
 #include "insets/InsetFloat.h"
-#include "insets/InsetListings.h"
 #include "insets/InsetGraphics.h"
 #include "insets/InsetInclude.h"
+#include "insets/InsetListings.h"
 #include "insets/InsetNote.h"
 #include "insets/InsetSpace.h"
 #include "insets/InsetTabular.h"
@@ -240,9 +240,9 @@ void LyXFunc::handleKeyFunc(FuncCode action)
 void LyXFunc::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer)
 {
        LASSERT(lyx_view_, /**/);
-       if (!LyX::ref().session().bookmarks().isValid(idx))
+       if (!theSession().bookmarks().isValid(idx))
                return;
-       BookmarksSection::Bookmark const & bm = LyX::ref().session().bookmarks().bookmark(idx);
+       BookmarksSection::Bookmark const & bm = theSession().bookmarks().bookmark(idx);
        LASSERT(!bm.filename.empty(), /**/);
        string const file = bm.filename.absFilename();
        // if the file is not opened, open it.
@@ -512,12 +512,12 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
 
        case LFUN_BOOKMARK_GOTO: {
                const unsigned int num = convert<unsigned int>(to_utf8(cmd.argument()));
-               enable = LyX::ref().session().bookmarks().isValid(num);
+               enable = theSession().bookmarks().isValid(num);
                break;
        }
 
        case LFUN_BOOKMARK_CLEAR:
-               enable = LyX::ref().session().bookmarks().size() > 0;
+               enable = theSession().bookmarks().size() > 0;
                break;
 
        // this one is difficult to get right. As a half-baked
@@ -534,10 +534,10 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        case LFUN_CALL: {
                FuncRequest func;
                string name = to_utf8(cmd.argument());
-               if (LyX::ref().topLevelCmdDef().lock(name, func)) {
+               if (theTopLevelCmdDef().lock(name, func)) {
                        func.origin = cmd.origin;
                        flag = getStatus(func);
-                       LyX::ref().topLevelCmdDef().release(name);
+                       theTopLevelCmdDef().release(name);
                } else {
                        // catch recursion or unknown command definiton
                        // all operations until the recursion or unknown command 
@@ -564,7 +564,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        case LFUN_HELP_OPEN:
        case LFUN_DROP_LAYOUTS_CHOICE:
        case LFUN_MENU_OPEN:
-       case LFUN_SERVER_GET_NAME:
+       case LFUN_SERVER_GET_FILENAME:
        case LFUN_SERVER_NOTIFY:
        case LFUN_SERVER_GOTO_FILE_ROW:
        case LFUN_DIALOG_HIDE:
@@ -581,9 +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_GRAPHICS_GROUPS_UNIFY:
-       case LFUN_NOTES_MUTATE:
        case LFUN_BUFFER_LANGUAGE:
        case LFUN_TEXTCLASS_APPLY:
        case LFUN_TEXTCLASS_LOAD:
@@ -1082,7 +1079,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        break;
 
                // --- lyxserver commands ----------------------------
-               case LFUN_SERVER_GET_NAME:
+               case LFUN_SERVER_GET_FILENAME:
                        LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
                        setMessage(from_utf8(lyx_view_->buffer()->absFileName()));
                        LYXERR(Debug::INFO, "FNAME["
@@ -1348,10 +1345,10 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
 
                case LFUN_CALL: {
                        FuncRequest func;
-                       if (LyX::ref().topLevelCmdDef().lock(argument, func)) {
+                       if (theTopLevelCmdDef().lock(argument, func)) {
                                func.origin = cmd.origin;
                                dispatch(func);
-                               LyX::ref().topLevelCmdDef().release(argument);
+                               theTopLevelCmdDef().release(argument);
                        } else {
                                if (func.action == LFUN_UNKNOWN_ACTION) {
                                        // unknown command definition
@@ -1380,58 +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_GRAPHICS_GROUPS_UNIFY: {
-                       LASSERT(lyx_view_, /**/);
-                       if (argument.empty())
-                               break;
-                       //view()->cursor().recordUndoFullDocument(); let inset-apply do that job
-                       graphics::unifyGraphicsGroups(*lyx_view_->buffer(), argument);
-                       updateFlags = Update::Force | Update::FitCursor;
-                       break;
-               }
-
-               // BOTH GRAPHICS_GROUPS_UNIFY and NOTES_MUTATE should be in Buffer dispatch once
-               // view->cursor() is not needed.
-               // Also they could be rewriten using some command like forall <insetname> <command>
-               // once the insets refactoring is done.
-               case LFUN_NOTES_MUTATE: {
-                       LASSERT(lyx_view_ && lyx_view_->view(), /**/);
-                       if (argument.empty())
-                               break;
-                       view()->cursor().recordUndoFullDocument();
-
-                       if (mutateNotes(view(), cmd.getArg(0), cmd.getArg(1))) {
-                               updateFlags = Update::Force;
-                       }
-                       break;
-               }
-
                case LFUN_BUFFER_LANGUAGE: {
                        LASSERT(lyx_view_, /**/);
                        Buffer & buffer = *lyx_view_->buffer();
@@ -1601,7 +1546,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        break;
 
                case LFUN_BOOKMARK_CLEAR:
-                       LyX::ref().session().bookmarks().clear();
+                       theSession().bookmarks().clear();
                        break;
 
                default:
@@ -1863,6 +1808,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_CUSTOM_EXPORT_FORMAT:
        case LyXRC::RC_DATE_INSERT_FORMAT:
        case LyXRC::RC_DEFAULT_LANGUAGE:
+       case LyXRC::RC_GUI_LANGUAGE:
        case LyXRC::RC_DEFAULT_PAPERSIZE:
        case LyXRC::RC_DEFFILE:
        case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
@@ -1892,6 +1838,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
        case LyXRC::RC_LANGUAGE_PACKAGE:
        case LyXRC::RC_LANGUAGE_USE_BABEL:
+       case LyXRC::RC_MAC_LIKE_WORD_MOVEMENT:
        case LyXRC::RC_MACRO_EDIT_STYLE:
        case LyXRC::RC_MAKE_BACKUP:
        case LyXRC::RC_MARK_FOREIGN_LANGUAGE: