]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
fix "make check" with gcc 4.3
[lyx.git] / src / LyXFunc.cpp
index 3bef300269db48e982fa577b715942b773055446..5fc04c1eac542e861f685f56a625e552266337ca 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!
@@ -702,7 +715,7 @@ bool LyXFunc::ensureBufferClean(BufferView * bv)
        int const ret = Alert::prompt(title, text, 0, 1, _("&Save"), _("&Cancel"));
 
        if (ret == 0)
-               dispatch(FuncRequest(LFUN_BUFFER_WRITE));
+               lyx_view_->dispatch(FuncRequest(LFUN_BUFFER_WRITE));
 
        return buf.isClean() && !buf.isUnnamed();
 }
@@ -1189,7 +1202,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                InsetCommandParams p(code);
                                data = InsetCommand::params2string(name, p);
                                break;
-                       } 
+                       }
                        case INCLUDE_CODE: {
                                // data is the include type: one of "include",
                                // "input", "verbatiminput" or "verbatiminput*"
@@ -1199,62 +1212,67 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                InsetCommandParams p(INCLUDE_CODE, data);
                                data = InsetCommand::params2string("include", p);
                                break;
-                       } 
+                       }
                        case BOX_CODE: {
                                // \c data == "Boxed" || "Frameless" etc
                                InsetBoxParams p(data);
                                data = InsetBox::params2string(p);
                                break;
-                       } 
+                       }
                        case BRANCH_CODE: {
                                InsetBranchParams p;
                                data = InsetBranch::params2string(p);
                                break;
-                       } 
+                       }
                        case CITE_CODE: {
                                InsetCommandParams p(CITE_CODE);
                                data = InsetCommand::params2string(name, p);
                                break;
-                       } 
+                       }
                        case ERT_CODE: {
                                data = InsetERT::params2string(InsetCollapsable::Open);
                                break;
-                       } 
+                       }
                        case EXTERNAL_CODE: {
                                InsetExternalParams p;
                                data = InsetExternal::params2string(p, *buffer);
                                break;
-                       } 
+                       }
                        case FLOAT_CODE:  {
                                InsetFloatParams p;
                                data = InsetFloat::params2string(p);
                                break;
-                       } 
+                       }
                        case LISTINGS_CODE: {
                                InsetListingsParams p;
                                data = InsetListings::params2string(p);
                                break;
-                       } 
+                       }
                        case GRAPHICS_CODE: {
                                InsetGraphicsParams p;
                                data = InsetGraphics::params2string(p, *buffer);
                                break;
-                       } 
+                       }
                        case NOTE_CODE: {
                                InsetNoteParams p;
                                data = InsetNote::params2string(p);
                                break;
-                       } 
+                       }
+                       case PHANTOM_CODE: {
+                               InsetPhantomParams p;
+                               data = InsetPhantom::params2string(p);
+                               break;
+                       }
                        case SPACE_CODE: {
                                InsetSpaceParams p;
                                data = InsetSpace::params2string(p);
                                break;
-                       } 
+                       }
                        case VSPACE_CODE: {
                                VSpace space;
                                data = InsetVSpace::params2string(space);
                                break;
-                       } 
+                       }
                        case WRAP_CODE: {
                                InsetWrapParams p;
                                data = InsetWrap::params2string(p);
@@ -1623,7 +1641,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        LYXERR(Debug::LYXVC, "Directory: " << path);
                        FileName pp(path);
                        if (!pp.isReadableDirectory()) {
-                               lyxerr<< _("Directory is not readable.\n");
+                               lyxerr << _("Directory is not accessible.") << endl;
                                break;
                        }
                        support::PathChanger p(pp);
@@ -1898,6 +1916,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_ALT_LANG:
        case LyXRC::RC_PLAINTEXT_LINELEN:
        case LyXRC::RC_PLAINTEXT_ROFF_COMMAND:
+       case LyXRC::RC_AUTOCORRECTION_MATH:
        case LyXRC::RC_AUTOREGIONDELETE:
        case LyXRC::RC_AUTORESET_OPTIONS:
        case LyXRC::RC_AUTOSAVE: