mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 11:08:41 +00:00
* src/LyXAction.C: mark goto-clear-bookmark as working without buffer
* 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
This commit is contained in:
parent
f653a9e979
commit
e28331ed63
@ -100,9 +100,9 @@ void LyXAction::init()
|
|||||||
{ LFUN_ACCENT_UNDERBAR, "accent-underbar", Noop },
|
{ LFUN_ACCENT_UNDERBAR, "accent-underbar", Noop },
|
||||||
{ LFUN_ACCENT_UNDERDOT, "accent-underdot", Noop },
|
{ LFUN_ACCENT_UNDERDOT, "accent-underdot", Noop },
|
||||||
{ LFUN_APPENDIX, "appendix", 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_LINE, "break-line", Noop },
|
||||||
{ LFUN_BREAK_PARAGRAPH, "break-paragraph", Noop },
|
{ LFUN_BREAK_PARAGRAPH, "break-paragraph", Noop },
|
||||||
{ LFUN_BREAK_PARAGRAPH_KEEP_LAYOUT, "break-paragraph-keep-layout", Noop },
|
{ LFUN_BREAK_PARAGRAPH_KEEP_LAYOUT, "break-paragraph-keep-layout", Noop },
|
||||||
|
@ -386,24 +386,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
|||||||
//lyxerr << "LyXFunc::getStatus: cmd: " << cmd << endl;
|
//lyxerr << "LyXFunc::getStatus: cmd: " << cmd << endl;
|
||||||
FuncStatus flag;
|
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();
|
LCursor & cur = view()->cursor();
|
||||||
|
|
||||||
/* In LyX/Mac, when a dialog is open, the menus of the
|
/* In LyX/Mac, when a dialog is open, the menus of the
|
||||||
@ -614,6 +596,22 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
// this one is difficult to get right. As a half-baked
|
||||||
// solution, we consider only the first action of the sequence
|
// solution, we consider only the first action of the sequence
|
||||||
@ -677,6 +675,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
|||||||
case LFUN_BUFFER_PREVIOUS:
|
case LFUN_BUFFER_PREVIOUS:
|
||||||
case LFUN_WINDOW_NEW:
|
case LFUN_WINDOW_NEW:
|
||||||
case LFUN_WINDOW_CLOSE:
|
case LFUN_WINDOW_CLOSE:
|
||||||
|
case LFUN_LYX_QUIT:
|
||||||
// these are handled in our dispatch()
|
// these are handled in our dispatch()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1074,6 +1073,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
case LFUN_LYX_QUIT:
|
case LFUN_LYX_QUIT:
|
||||||
// quitting is triggered by the gui code
|
// quitting is triggered by the gui code
|
||||||
// (leaving the event loop).
|
// (leaving the event loop).
|
||||||
|
lyx_view_->message(from_utf8(N_("Exiting.")));
|
||||||
if (theBufferList().quitWriteAll())
|
if (theBufferList().quitWriteAll())
|
||||||
theApp()->gui().closeAllViews();
|
theApp()->gui().closeAllViews();
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user