mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-18 21:45:24 +00:00
backport r30557 (bug #1720)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@30900 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
39ba733bc1
commit
750d6b6a52
@ -397,7 +397,22 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
//lyxerr << "LyXFunc::getStatus: cmd: " << cmd << endl;
|
||||
FuncStatus flag;
|
||||
|
||||
Buffer * buf = lyx_view_ ? lyx_view_->buffer() : 0;
|
||||
/* In LyX/Mac, when a dialog is open, the menus of the
|
||||
application can still be accessed without giving focus to
|
||||
the main window. In this case, we want to disable the menu
|
||||
entries that are buffer or view-related.
|
||||
|
||||
If this code is moved somewhere else (like in
|
||||
GuiView::getStatus), then several functions will not be
|
||||
handled correctly.
|
||||
*/
|
||||
frontend::LyXView * lv = 0;
|
||||
Buffer * buf = 0;
|
||||
if (lyx_view_
|
||||
&& (cmd.origin != FuncRequest::MENU || lyx_view_->hasFocus())) {
|
||||
lv = lyx_view_;
|
||||
buf = lyx_view_->buffer();
|
||||
}
|
||||
|
||||
if (cmd.action == LFUN_NOACTION) {
|
||||
flag.message(from_utf8(N_("Nothing to do")));
|
||||
@ -648,11 +663,11 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
break;
|
||||
|
||||
// Does the view know something?
|
||||
if (!lyx_view_) {
|
||||
if (!lv) {
|
||||
enable = false;
|
||||
break;
|
||||
}
|
||||
if (lyx_view_->getStatus(cmd, flag))
|
||||
if (lv->getStatus(cmd, flag))
|
||||
break;
|
||||
|
||||
// If we have a BufferView, try cursor position and
|
||||
|
@ -66,6 +66,8 @@ public:
|
||||
virtual void setBuffer(Buffer * b) = 0; ///< \c Buffer to set.
|
||||
///
|
||||
virtual bool closeBuffer() = 0;
|
||||
///
|
||||
virtual bool hasFocus() const = 0;
|
||||
|
||||
/// load a document into the current workarea.
|
||||
virtual Buffer * loadDocument(
|
||||
|
@ -1154,17 +1154,6 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||
bool enable = true;
|
||||
Buffer * buf = buffer();
|
||||
|
||||
/* In LyX/Mac, when a dialog is open, the menus of the
|
||||
application can still be accessed without giving focus to
|
||||
the main window. In this case, we want to disable the menu
|
||||
entries that are buffer-related.
|
||||
|
||||
Note that this code is not perfect, as bug 1941 attests:
|
||||
http://bugzilla.lyx.org/show_bug.cgi?id=1941#c4
|
||||
*/
|
||||
if (cmd.origin == FuncRequest::MENU && !hasFocus())
|
||||
buf = 0;
|
||||
|
||||
switch(cmd.action) {
|
||||
case LFUN_BUFFER_WRITE:
|
||||
enable = buf && (buf->isUnnamed() || !buf->isClean());
|
||||
|
@ -301,6 +301,9 @@ What's new
|
||||
|
||||
- Fix bug where multimedia keys were intercepted by LyX (bug 6043).
|
||||
|
||||
- Disable some menu entries when the document windows does not have
|
||||
focus on OS X (bug 1720).
|
||||
|
||||
|
||||
* DOCUMENTATION AND LOCALIZATION
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user