From 305c1cb25ad24fc20660b827f5c78e17cde84f11 Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Wed, 1 Nov 2006 23:20:53 +0000 Subject: [PATCH] bookmarks: allow go to bookmark at any time (new window without buffer) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15687 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/lyxfunc.C | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 44c8419bd3..b290a637a0 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -352,8 +352,16 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const flag.message(from_utf8(N_("Exiting"))); flag.enabled(true); return flag; + } else if (cmd.action == LFUN_BOOKMARK_GOTO) { + // bookmarks can be valid even if there is no opened buffer + flag.enabled(LyX::ref().session().bookmarks().isValid(convert(to_utf8(cmd.argument())))); + return flag; + } else if (cmd.action == LFUN_BOOKMARK_CLEAR) { + flag.enabled(LyX::ref().session().bookmarks().size() > 0); + return flag; } + LCursor & cur = view()->cursor(); /* In LyX/Mac, when a dialog is open, the menus of the @@ -630,19 +638,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const // these are handled in our dispatch() break; - // FIXME: will move to the front of this function when SWITCH_TO_BUFFER - // is valid for a newly created window - case LFUN_BOOKMARK_GOTO: - // bookmarks can be valid even if there is no opened buffer - flag.enabled(LyX::ref().session().bookmarks().isValid(convert(to_utf8(cmd.argument())))); - break; - - // FIXME: will move to the front of this function when SWITCH_TO_BUFFER - // is valid for a newly created window - case LFUN_BOOKMARK_CLEAR: - flag.enabled(LyX::ref().session().bookmarks().size() > 0); - break; - default: if (!getLocalStatus(cur, cmd, flag)) flag = view()->getStatus(cmd); @@ -1683,8 +1678,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd) // open may fail, so we need to test it again if (theBufferList().exists(bm.filename)) { // if the current buffer is not that one, switch to it. - // FIXME: swtich buffer to a newly created window will crash lyx - // because of invalid view. if (lyx_view_->buffer()->fileName() != bm.filename) dispatch(FuncRequest(LFUN_BUFFER_SWITCH, bm.filename)); // BOOST_ASSERT(lyx_view_->buffer()->fileName() != bm.filename); -- 2.39.2