mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
* frontends/LyXView.h:
* frontends/qt4/GuiView.h: * frontends/qt4/GuiView.cpp (getStatus): change signature to return a bool indicating whether the view knows something about the lfun. * LyXFunc.cpp (getStatus): remove knowledge about what lfuns are handled in view. Call LyXView::getStatus() when nothing is known at LyXFunc level. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24887 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9799ff19db
commit
b5d3d3b722
@ -440,19 +440,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
|||||||
enable = false;
|
enable = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// FIXME: these cases should be hidden in GuiView::getStatus().
|
|
||||||
case LFUN_DIALOG_TOGGLE:
|
|
||||||
case LFUN_DIALOG_SHOW:
|
|
||||||
case LFUN_UI_TOGGLE:
|
|
||||||
case LFUN_DIALOG_UPDATE:
|
|
||||||
// FIXME: add special handling for about and prefs dialogs here
|
|
||||||
// which do not depend on GuiView.
|
|
||||||
if (lyx_view_)
|
|
||||||
return lyx_view_->getStatus(cmd);
|
|
||||||
else
|
|
||||||
enable = false;
|
|
||||||
break;
|
|
||||||
|
|
||||||
// FIXME optimally this should be in Text::getStatus. In such a case the flags
|
// FIXME optimally this should be in Text::getStatus. In such a case the flags
|
||||||
// are not passed when using context menu. This way it works.
|
// are not passed when using context menu. This way it works.
|
||||||
case LFUN_SET_GRAPHICS_GROUP: {
|
case LFUN_SET_GRAPHICS_GROUP: {
|
||||||
@ -467,20 +454,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_TOOLBAR_TOGGLE:
|
|
||||||
case LFUN_INSET_APPLY:
|
|
||||||
case LFUN_BUFFER_WRITE:
|
|
||||||
case LFUN_BUFFER_WRITE_AS:
|
|
||||||
case LFUN_SPLIT_VIEW:
|
|
||||||
case LFUN_CLOSE_TAB_GROUP:
|
|
||||||
case LFUN_COMPLETION_POPUP:
|
|
||||||
case LFUN_COMPLETION_INLINE:
|
|
||||||
case LFUN_COMPLETION_COMPLETE:
|
|
||||||
if (lyx_view_)
|
|
||||||
return lyx_view_->getStatus(cmd);
|
|
||||||
enable = false;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LFUN_BUFFER_TOGGLE_READ_ONLY:
|
case LFUN_BUFFER_TOGGLE_READ_ONLY:
|
||||||
flag.setOnOff(buf->isReadonly());
|
flag.setOnOff(buf->isReadonly());
|
||||||
break;
|
break;
|
||||||
@ -653,6 +626,16 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
// Does the view know something?
|
||||||
|
if (!lyx_view_) {
|
||||||
|
enable = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (lyx_view_->getStatus(cmd, flag))
|
||||||
|
break;
|
||||||
|
|
||||||
|
// If we have a BufferView, try cursor position and
|
||||||
|
// then the BufferView.
|
||||||
if (!view()) {
|
if (!view()) {
|
||||||
enable = false;
|
enable = false;
|
||||||
break;
|
break;
|
||||||
|
@ -82,7 +82,7 @@ public:
|
|||||||
virtual void message(docstring const &) = 0;
|
virtual void message(docstring const &) = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
virtual FuncStatus getStatus(FuncRequest const & cmd) = 0;
|
virtual bool getStatus(FuncRequest const & cmd, FuncStatus & flag) = 0;
|
||||||
/// dispatch command.
|
/// dispatch command.
|
||||||
/// \return true if the \c FuncRequest has been dispatched.
|
/// \return true if the \c FuncRequest has been dispatched.
|
||||||
virtual bool dispatch(FuncRequest const & cmd) = 0;
|
virtual bool dispatch(FuncRequest const & cmd) = 0;
|
||||||
|
@ -985,9 +985,8 @@ void GuiView::resetAutosaveTimers()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FuncStatus GuiView::getStatus(FuncRequest const & cmd)
|
bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||||
{
|
{
|
||||||
FuncStatus flag;
|
|
||||||
bool enable = true;
|
bool enable = true;
|
||||||
Buffer * buf = buffer();
|
Buffer * buf = buffer();
|
||||||
|
|
||||||
@ -1077,10 +1076,6 @@ FuncStatus GuiView::getStatus(FuncRequest const & cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_INSET_APPLY: {
|
case LFUN_INSET_APPLY: {
|
||||||
if (!buf) {
|
|
||||||
enable = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
string const name = cmd.getArg(0);
|
string const name = cmd.getArg(0);
|
||||||
Inset * inset = getOpenInset(name);
|
Inset * inset = getOpenInset(name);
|
||||||
if (inset) {
|
if (inset) {
|
||||||
@ -1093,7 +1088,7 @@ FuncStatus GuiView::getStatus(FuncRequest const & cmd)
|
|||||||
flag |= fs;
|
flag |= fs;
|
||||||
} else {
|
} else {
|
||||||
FuncRequest fr(LFUN_INSET_INSERT, cmd.argument());
|
FuncRequest fr(LFUN_INSET_INSERT, cmd.argument());
|
||||||
flag |= getStatus(fr);
|
flag |= lyx::getStatus(fr);
|
||||||
}
|
}
|
||||||
enable = flag.enabled();
|
enable = flag.enabled();
|
||||||
break;
|
break;
|
||||||
@ -1118,16 +1113,13 @@ FuncStatus GuiView::getStatus(FuncRequest const & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (!view()) {
|
return false;
|
||||||
enable = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!enable)
|
if (!enable)
|
||||||
flag.enabled(false);
|
flag.enabled(false);
|
||||||
|
|
||||||
return flag;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public:
|
|||||||
void updateLayoutList();
|
void updateLayoutList();
|
||||||
void updateToolbars();
|
void updateToolbars();
|
||||||
QMenu * createPopupMenu();
|
QMenu * createPopupMenu();
|
||||||
FuncStatus getStatus(FuncRequest const & cmd);
|
bool getStatus(FuncRequest const & cmd, FuncStatus & flag);
|
||||||
bool dispatch(FuncRequest const & cmd);
|
bool dispatch(FuncRequest const & cmd);
|
||||||
|
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user