+ case LFUN_WINDOW_NEW:
+ LyX::ref().newLyXView();
+ break;
+
+ case LFUN_WINDOW_CLOSE:
+ BOOST_ASSERT(lyx_view_);
+ BOOST_ASSERT(theApp);
+ lyx_view_->close();
+ // We return here because lyx_view does not exists anymore.
+ return;
+
+ case LFUN_BOOKMARK_GOTO: {
+ BOOST_ASSERT(lyx_view_);
+ unsigned int idx = convert<unsigned int>(to_utf8(cmd.argument()));
+ BookmarksSection::Bookmark const bm = LyX::ref().session().bookmarks().bookmark(idx);
+ BOOST_ASSERT(!bm.filename.empty());
+ // if the file is not opened, open it.
+ if (!theBufferList().exists(bm.filename))
+ dispatch(FuncRequest(LFUN_FILE_OPEN, bm.filename));
+ // 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.
+ if (lyx_view_->buffer()->fileName() != bm.filename)
+ dispatch(FuncRequest(LFUN_BUFFER_SWITCH, bm.filename));
+ // BOOST_ASSERT(lyx_view_->buffer()->fileName() != bm.filename);
+ view()->moveToPosition(bm.par_id, bm.par_pos);
+ }
+ break;
+ }
+
+ case LFUN_BOOKMARK_CLEAR:
+ LyX::ref().session().bookmarks().clear();
+ break;
+
+ case LFUN_TOOLBAR_TOGGLE_STATE:
+ lyx_view_->toggleToolbarState(argument);
+ break;
+