]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
Fix bug 2474; partial fix for 1777. Added last_reference_ member to QRef class and...
[lyx.git] / src / lyxfunc.C
index 2c68a83f10a081acedb98354156c57812d62eac4..7a05ca4325cf0b745aa596d74f354dac812ed34c 100644 (file)
@@ -264,12 +264,13 @@ void LyXFunc::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer)
                }
                // moveToPosition use par_id, and par_pit and return new par_id.
                pit_type new_pit;
+               pos_type new_pos;
                int new_id;
-               boost::tie(new_pit, new_id) = view()->moveToPosition(bm.par_pit, bm.par_id, bm.par_pos);
-               // if par_id or pit has been changed, reset par_pit and par_id
+               boost::tie(new_pit, new_pos, new_id) = view()->moveToPosition(bm.bottom_pit, bm.bottom_pos, bm.top_id, bm.top_pos);
+               // if bottom_pit, bottom_pos or top_id has been changed, update bookmark
                // see http://bugzilla.lyx.org/show_bug.cgi?id=3092
-               if (bm.par_pit != new_pit || bm.par_id != new_id)
-                       const_cast<BookmarksSection::Bookmark &>(bm).setPos(new_pit, new_id);
+               if (bm.bottom_pit != new_pit || bm.bottom_pos != new_pos || bm.top_id != new_id )
+                       const_cast<BookmarksSection::Bookmark &>(bm).updatePos(new_pit, new_pos, new_id);
        } 
 }
 
@@ -547,25 +548,24 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                string const name = cmd.getArg(0);
                if (!buf)
                        enable = name == "aboutlyx"
-                               || name == "file"
-                               || name == "forks"
+                               || name == "file" //FIXME: should be removed.
                                || name == "prefs"
                                || name == "texinfo";
                else if (name == "print")
                        enable = Exporter::isExportable(*buf, "dvi")
                                && lyxrc.print_command != "none";
-               else if (name == "character" || name == "mathpanel")
+               else if (name == "character")
                        enable = cur.inset().lyxCode() != InsetBase::ERT_CODE;
                else if (name == "latexlog")
                        enable = isFileReadable(FileName(buf->getLogName().second));
-#if !defined (USE_ASPELL) && !defined (USE_ISPELL) && !defined (USE_PSPELL)
                else if (name == "spellchecker")
+#if defined (USE_ASPELL) || defined (USE_ISPELL) || defined (USE_PSPELL)
+                       enable = !buf->isReadonly();
+#else
                        enable = false;
 #endif
                else if (name == "vclog")
                        enable = buf->lyxvc().inUse();
-               else if (name == "view-source")
-                       enable = buf;
                break;
        }
 
@@ -608,9 +608,9 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                break;
 
        case LFUN_TOOLBAR_TOGGLE_STATE: {
-               ToolbarBackend::Flags flags = lyx_view_->getToolbarState(to_utf8(cmd.argument()));
-               if (!(flags & ToolbarBackend::AUTO))
-                       flag.setOnOff(flags & ToolbarBackend::ON);
+               ToolbarInfo::Flags flags = lyx_view_->getToolbarState(to_utf8(cmd.argument()));
+               if (!(flags & ToolbarInfo::AUTO))
+                       flag.setOnOff(flags & ToolbarInfo::ON);
                break;
        }
 
@@ -2040,9 +2040,6 @@ void LyXFunc::doImport(string const & argument)
 
 void LyXFunc::closeBuffer()
 {
-       // save current cursor position
-       LyX::ref().session().lastFilePos().save(FileName(lyx_view_->buffer()->fileName()),
-               boost::tie(view()->cursor().pit(), view()->cursor().pos()) );
        // goto bookmark to update bookmark pit.
        for (size_t i = 0; i < LyX::ref().session().bookmarks().size(); ++i)
                gotoBookmark(i+1, false, false);