]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
Fix up a few little things after r29065. If we're calculating the autosave
[lyx.git] / src / LyXFunc.cpp
index 40e26f95b5f1896e23591b53fd6b4408cbaf1244..d42b70b5b59b099c92c77563e7d3c58cf403adfe 100644 (file)
@@ -66,6 +66,7 @@
 #include "insets/InsetInclude.h"
 #include "insets/InsetListings.h"
 #include "insets/InsetNote.h"
+#include "insets/InsetPhantom.h"
 #include "insets/InsetSpace.h"
 #include "insets/InsetTabular.h"
 #include "insets/InsetVSpace.h"
@@ -256,15 +257,27 @@ void LyXFunc::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer)
        if (!theBufferList().exists(bm.filename))
                return;
 
+       // bm can be changed when saving
+       BookmarksSection::Bookmark tmp = bm;
+
+       // Special case idx == 0 used for back-from-back jump navigation
+       if (idx == 0)
+               dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"));
+
        // if the current buffer is not that one, switch to it.
-       if (lyx_view_->buffer()->fileName() != bm.filename) {
+       if (lyx_view_->buffer()->fileName() != tmp.filename) {
                if (!switchToBuffer)
                        return;
                dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file));
        }
+
        // moveToPosition try paragraph id first and then paragraph (pit, pos).
-       if (!view()->moveToPosition(bm.bottom_pit, bm.bottom_pos,
-               bm.top_id, bm.top_pos))
+       if (!view()->moveToPosition(tmp.bottom_pit, tmp.bottom_pos,
+               tmp.top_id, tmp.top_pos))
+               return;
+
+       // bm changed
+       if (idx == 0)
                return;
 
        // Cursor jump succeeded!
@@ -646,6 +659,13 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                        enable = false;
                        break;
                }
+
+               // Is this a function that acts on inset at point?
+               Inset * inset = view()->cursor().nextInset();
+               if (lyxaction.funcHasFlag(cmd.action, LyXAction::AtPoint)
+                   && inset && inset->getStatus(view()->cursor(), cmd, flag))
+                       break;
+
                if (!getLocalStatus(view()->cursor(), cmd, flag))
                        flag = view()->getStatus(cmd);
        }
@@ -1245,6 +1265,11 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                data = InsetNote::params2string(p);
                                break;
                        }
+                       case PHANTOM_CODE: {
+                               InsetPhantomParams p;
+                               data = InsetPhantom::params2string(p);
+                               break;
+                       }
                        case SPACE_CODE: {
                                InsetSpaceParams p;
                                data = InsetSpace::params2string(p);
@@ -1687,6 +1712,20 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                break;
                        }
 
+                       // Is this a function that acts on inset at point?
+                       Inset * inset = view()->cursor().nextInset();
+                       if (lyxaction.funcHasFlag(action, LyXAction::AtPoint)
+                           && inset) {
+                               view()->cursor().result().dispatched(true);
+                               view()->cursor().result().update(Update::FitCursor | Update::Force);
+                               FuncRequest tmpcmd = cmd;
+                               inset->dispatch(view()->cursor(), tmpcmd);
+                               if (view()->cursor().result().dispatched()) {
+                                       updateFlags = view()->cursor().result().update();
+                                       break;
+                               }
+                       }
+
                        // Let the current Cursor dispatch its own actions.
                        Cursor old = view()->cursor();
                        view()->cursor().getPos(cursorPosBeforeDispatchX_,
@@ -1923,6 +1962,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
        case LyXRC::RC_COPIER:
        case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
+       case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
        case LyXRC::RC_CUSTOM_EXPORT_COMMAND:
        case LyXRC::RC_CUSTOM_EXPORT_FORMAT:
        case LyXRC::RC_DATE_INSERT_FORMAT:
@@ -2007,6 +2047,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_SHOW_BANNER:
        case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
        case LyXRC::RC_SPELL_COMMAND:
+       case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
        case LyXRC::RC_TEMPDIRPATH:
        case LyXRC::RC_TEMPLATEPATH:
        case LyXRC::RC_TEX_ALLOWS_SPACES: