]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
* GuiDocument.cpp:
[lyx.git] / src / LyXFunc.cpp
index 59d62159897fbf015bc91666d52108362c5e3d3c..29d4db283267782891ecfe519fd6a7ac3f986abc 100644 (file)
@@ -265,7 +265,7 @@ void LyXFunc::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer)
                dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"));
 
        // if the current buffer is not that one, switch to it.
-       if (lyx_view_->buffer()->fileName() != tmp.filename) {
+       if (!lyx_view_->buffer() || lyx_view_->buffer()->fileName() != tmp.filename) {
                if (!switchToBuffer)
                        return;
                dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file));
@@ -408,9 +408,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
 
        switch (cmd.action) {
        case LFUN_UNKNOWN_ACTION:
-#if !defined(HAVE_LIBMYTHES) && !defined(HAVE_LIBAIKSAURUS)
-       case LFUN_THESAURUS_ENTRY:
-#endif
                flag.unknown(true);
                flag.setEnabled(false);
                break;
@@ -474,6 +471,10 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        case LFUN_VC_CHECK_OUT:
                enable = buf->lyxvc().checkOutEnabled();
                break;
+       case LFUN_VC_LOCKING_TOGGLE:
+               enable = !buf->isReadonly() && buf->lyxvc().lockingToggleEnabled();
+               flag.setOnOff(enable && !buf->lyxvc().locker().empty());
+               break;
        case LFUN_VC_REVERT:
                enable = buf->lyxvc().inUse();
                break;
@@ -566,9 +567,11 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                        flag = getStatus(func);
                        theTopLevelCmdDef().release(name);
                } else {
-                       // catch recursion or unknown command definiton
-                       // all operations until the recursion or unknown command 
-                       // definiton occures are performed, so set the state to enabled
+                       // catch recursion or unknown command
+                       // definition. all operations until the
+                       // recursion or unknown command definition
+                       // occurs are performed, so set the state to
+                       // enabled
                        enable = true;
                }
                break;
@@ -1046,6 +1049,22 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        }
                        break;
 
+               case LFUN_VC_LOCKING_TOGGLE:
+                       LASSERT(lyx_view_ && buffer, /**/);
+                       if (!ensureBufferClean(view()) || buffer->isReadonly())
+                               break;
+                       if (buffer->lyxvc().inUse()) {
+                               string res = buffer->lyxvc().lockingToggle();
+                               if (res.empty())
+                                       frontend::Alert::error(_("Revision control error."),
+                                               _("Error when setting the locking property."));
+                               else {
+                                       setMessage(from_utf8(res));
+                                       reloadBuffer();
+                               }
+                       }
+                       break;
+
                case LFUN_VC_REVERT:
                        LASSERT(lyx_view_ && buffer, /**/);
                        buffer->lyxvc().revert();
@@ -1079,21 +1098,34 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        is >> file_name >> row;
                        Buffer * buf = 0;
                        bool loaded = false;
-                       if (prefixIs(file_name, package().temp_dir().absFilename()))
+                       string const abstmp = package().temp_dir().absFilename();
+                       string const realtmp = package().temp_dir().realPath();
+                       // We have to use os::path_prefix_is() here, instead of
+                       // simply prefixIs(), because the file name comes from
+                       // an external application and may need case adjustment.
+                       if (os::path_prefix_is(file_name, abstmp, os::CASE_ADJUSTED)
+                           || os::path_prefix_is(file_name, realtmp, os::CASE_ADJUSTED)) {
                                // Needed by inverse dvi search. If it is a file
-                               // in tmpdir, call the apropriated function
+                               // in tmpdir, call the apropriated function.
+                               // If tmpdir is a symlink, we may have the real
+                               // path passed back, so we correct for that.
+                               if (!prefixIs(file_name, abstmp))
+                                       file_name = subst(file_name, realtmp, abstmp);
                                buf = theBufferList().getBufferFromTmp(file_name);
-                       else {
+                       else {
                                // Must replace extension of the file to be .lyx
                                // and get full path
                                FileName const s = fileSearch(string(), changeExtension(file_name, ".lyx"), "lyx");
                                // Either change buffer or load the file
                                if (theBufferList().exists(s))
                                        buf = theBufferList().getBuffer(s);
-                               else {
+                               else if (s.exists()) {
                                        buf = lyx_view_->loadDocument(s);
                                        loaded = true;
-                               }
+                               } else
+                                       lyx_view_->message(bformat(
+                                               _("File does not exist: %1$s"),
+                                               makeDisplayPath(file_name)));
                        }
 
                        if (!buf) {
@@ -1123,6 +1155,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        case INDEX_CODE:
                        case LABEL_CODE:
                        case NOMENCL_CODE:
+                       case NOMENCL_PRINT_CODE:
                        case REF_CODE:
                        case TOC_CODE:
                        case HYPERLINK_CODE: {
@@ -1871,6 +1904,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_AUTOSAVE:
        case LyXRC::RC_AUTO_NUMBER:
        case LyXRC::RC_BACKUPDIR_PATH:
+       case LyXRC::RC_BIBTEX_ALTERNATIVES:
        case LyXRC::RC_BIBTEX_COMMAND:
        case LyXRC::RC_BINDFILE:
        case LyXRC::RC_CHECKLASTFILES:
@@ -1910,6 +1944,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_FONT_ENCODING:
        case LyXRC::RC_FORMAT:
        case LyXRC::RC_GROUP_LAYOUTS:
+       case LyXRC::RC_INDEX_ALTERNATIVES:
        case LyXRC::RC_INDEX_COMMAND:
        case LyXRC::RC_JBIBTEX_COMMAND:
        case LyXRC::RC_JINDEX_COMMAND:
@@ -1977,6 +2012,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
        case LyXRC::RC_SPELL_COMMAND:
        case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
+       case LyXRC::RC_SPLITINDEX_COMMAND:
        case LyXRC::RC_TEMPDIRPATH:
        case LyXRC::RC_TEMPLATEPATH:
        case LyXRC::RC_TEX_ALLOWS_SPACES:
@@ -2001,6 +2037,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_SORT_LAYOUTS:
        case LyXRC::RC_FULL_SCREEN_LIMIT:
        case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
+       case LyXRC::RC_FULL_SCREEN_MENUBAR:
        case LyXRC::RC_FULL_SCREEN_TABBAR:
        case LyXRC::RC_FULL_SCREEN_TOOLBARS:
        case LyXRC::RC_FULL_SCREEN_WIDTH: