* src/lyxfunc.C (getStatus): move handling of LFUN_LYX_QUIT,
LFUN_BOOKMARK_GOTO, LFUN_BOOKMARK_CLEAR and LFUN_TOOLBAR_TOGGLE_STATE
where they belong.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16810
a592a061-630c-0410-9148-
cb99ea01b6c8
{ LFUN_ACCENT_UNDERBAR, "accent-underbar", Noop },
{ LFUN_ACCENT_UNDERDOT, "accent-underdot", Noop },
{ LFUN_APPENDIX, "appendix", Noop },
{ LFUN_ACCENT_UNDERBAR, "accent-underbar", Noop },
{ LFUN_ACCENT_UNDERDOT, "accent-underdot", Noop },
{ LFUN_APPENDIX, "appendix", Noop },
- { LFUN_BOOKMARK_GOTO, "bookmark-goto", ReadOnly },
+ { LFUN_BOOKMARK_GOTO, "bookmark-goto", NoBuffer },
{ LFUN_BOOKMARK_SAVE, "bookmark-save", ReadOnly },
{ LFUN_BOOKMARK_SAVE, "bookmark-save", ReadOnly },
- { LFUN_BOOKMARK_CLEAR, "bookmark-clear", ReadOnly },
+ { LFUN_BOOKMARK_CLEAR, "bookmark-clear", NoBuffer },
{ LFUN_BREAK_LINE, "break-line", Noop },
{ LFUN_BREAK_PARAGRAPH, "break-paragraph", Noop },
{ LFUN_BREAK_PARAGRAPH_KEEP_LAYOUT, "break-paragraph-keep-layout", Noop },
{ LFUN_BREAK_LINE, "break-line", Noop },
{ LFUN_BREAK_PARAGRAPH, "break-paragraph", Noop },
{ LFUN_BREAK_PARAGRAPH_KEEP_LAYOUT, "break-paragraph-keep-layout", Noop },
//lyxerr << "LyXFunc::getStatus: cmd: " << cmd << endl;
FuncStatus flag;
//lyxerr << "LyXFunc::getStatus: cmd: " << cmd << endl;
FuncStatus flag;
- if (cmd.action == LFUN_LYX_QUIT) {
- 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<unsigned int>(to_utf8(cmd.argument()))));
- return flag;
- } else if (cmd.action == LFUN_BOOKMARK_CLEAR) {
- flag.enabled(LyX::ref().session().bookmarks().size() > 0);
- return flag;
- } else if (cmd.action == LFUN_TOOLBAR_TOGGLE_STATE) {
- ToolbarBackend::Flags flags = lyx_view_->getToolbarState(to_utf8(cmd.argument()));
- if (!(flags & ToolbarBackend::AUTO))
- flag.setOnOff(flags & ToolbarBackend::ON);
- return flag;
- }
-
LCursor & cur = view()->cursor();
/* In LyX/Mac, when a dialog is open, the menus of the
LCursor & cur = view()->cursor();
/* In LyX/Mac, when a dialog is open, the menus of the
+ case LFUN_BOOKMARK_GOTO: {
+ const unsigned int num = convert<unsigned int>(to_utf8(cmd.argument()));
+ enable = LyX::ref().session().bookmarks().isValid(num);
+ break;
+ }
+
+ case LFUN_BOOKMARK_CLEAR:
+ enable = LyX::ref().session().bookmarks().size() > 0;
+ 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);
+ break;
+ }
// this one is difficult to get right. As a half-baked
// solution, we consider only the first action of the sequence
// this one is difficult to get right. As a half-baked
// solution, we consider only the first action of the sequence
case LFUN_BUFFER_PREVIOUS:
case LFUN_WINDOW_NEW:
case LFUN_WINDOW_CLOSE:
case LFUN_BUFFER_PREVIOUS:
case LFUN_WINDOW_NEW:
case LFUN_WINDOW_CLOSE:
// these are handled in our dispatch()
break;
// these are handled in our dispatch()
break;
case LFUN_LYX_QUIT:
// quitting is triggered by the gui code
// (leaving the event loop).
case LFUN_LYX_QUIT:
// quitting is triggered by the gui code
// (leaving the event loop).
+ lyx_view_->message(from_utf8(N_("Exiting.")));
if (theBufferList().quitWriteAll())
theApp()->gui().closeAllViews();
break;
if (theBufferList().quitWriteAll())
theApp()->gui().closeAllViews();
break;