]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
God damn tabular dual head :-/
[lyx.git] / src / LyXFunc.cpp
index 6a3db5bb8559c086dcc1db2b4096cd755988c9f9..f69f5f88826ff0803202e9d6c55137e3a02f8992 100644 (file)
@@ -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.
@@ -461,15 +461,17 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                enable = !buf->lyxvc().inUse();
                break;
        case LFUN_VC_CHECK_IN:
-               enable = buf->lyxvc().inUse() && !buf->isReadonly();
+               enable = buf->lyxvc().checkInEnabled();
                break;
        case LFUN_VC_CHECK_OUT:
-               enable = buf->lyxvc().inUse() && buf->isReadonly();
+               enable = buf->lyxvc().checkOutEnabled();
                break;
        case LFUN_VC_REVERT:
-       case LFUN_VC_UNDO_LAST:
                enable = buf->lyxvc().inUse();
                break;
+       case LFUN_VC_UNDO_LAST:
+               enable = buf->lyxvc().undoLastEnabled();
+               break;
        case LFUN_BUFFER_RELOAD:
                enable = !buf->isUnnamed() && buf->fileName().exists()
                        && (!buf->isClean() || buf->isExternallyModified(Buffer::timestamp_method));
@@ -512,12 +514,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 +536,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 +566,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:
@@ -1059,8 +1061,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
                        if (!ensureBufferClean(view()))
                                break;
-                       if (lyx_view_->buffer()->lyxvc().inUse()
-                                       && lyx_view_->buffer()->isReadonly()) {
+                       if (lyx_view_->buffer()->lyxvc().inUse()) {
                                lyx_view_->buffer()->lyxvc().checkOut();
                                reloadBuffer();
                        }
@@ -1079,7 +1080,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["
@@ -1345,10 +1346,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
@@ -1529,9 +1530,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
 
                        actOnUpdatedPrefs(lyxrc_orig, lyxrc);
 
-                       // Set the language defined by the user.
-                       LyX::ref().setRcGuiLanguage();
-
                        theApp()->resetGui();
 
                        /// We force the redraw in any case because there might be
@@ -1549,7 +1547,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        break;
 
                case LFUN_BOOKMARK_CLEAR:
-                       LyX::ref().session().bookmarks().clear();
+                       theSession().bookmarks().clear();
                        break;
 
                default:
@@ -1841,6 +1839,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: