From 8f4d5e8096341ccd7b36ce09215cdeb412ff7c5b Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 7 Oct 2004 08:03:18 +0000 Subject: [PATCH] fix dialogs in LyX/Mac git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9060 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 8 ++++++++ src/frontends/qt2/QLPopupMenu.C | 23 ++++++++++++++++++++++- src/frontends/qt2/lyx_gui.C | 11 ----------- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index faffcd3a41..0994d61248 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,11 @@ +2004-10-01 Jean-Marc Lasgouttes + + * QLPopupMenu.C (populate): move the code below to here, so that + it only has an effect on the menu entries + + * lyx_gui.C (getStatus): remove special Qt/Mac code, which broke + most dialogs (bug 1693) + 2004-10-05 Angus Leeming * QPrefs.C, QPRefsDialog.C, ui/QPrefLatexModule.ui: add code to diff --git a/src/frontends/qt2/QLPopupMenu.C b/src/frontends/qt2/QLPopupMenu.C index 0cb9ed3942..5bcede4bb2 100644 --- a/src/frontends/qt2/QLPopupMenu.C +++ b/src/frontends/qt2/QLPopupMenu.C @@ -24,6 +24,7 @@ #ifdef Q_WS_MACX #include "kbmap.h" +#include "LyXAction.h" #include "QLyXKeySym.h" extern boost::scoped_ptr toplevel_keymap; #endif @@ -113,7 +114,7 @@ void QLPopupMenu::populate(Menu * menu) setItemEnabled(res.first, m->status().enabled()); res.second->populate(m->submenu()); } else { // we have a MenuItem::Command - FuncStatus const status = m->status(); + FuncStatus status = m->status(); Funcs::iterator fit = funcs_.insert(funcs_.end(), m->func()); @@ -121,6 +122,26 @@ void QLPopupMenu::populate(Menu * menu) QString label = toqstr(getLabel(*m)); #ifdef Q_WS_MACX + /* 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. + */ + /* This test is actually not adequate, + for example "dialog-show document" is not + correctly disabled. What should be done + (but is maybe hackish) define a version of + LyXFunc::getStatus that takes a Buffer* as + argument, so that we can call it with buf=0 + (JMarc) + */ + if (status.enabled() + && qApp->activeWindow() != qApp->mainWidget() + && !lyxaction.funcHasFlag(m->func().action, + LyXAction::NoBuffer)) + status.enabled(false); + /* There are two constraints on Qt/Mac: (1) the bindings require a unicode string to be represented meaningfully and std::string diff --git a/src/frontends/qt2/lyx_gui.C b/src/frontends/qt2/lyx_gui.C index 193f4fc20a..e5d5b9d009 100644 --- a/src/frontends/qt2/lyx_gui.C +++ b/src/frontends/qt2/lyx_gui.C @@ -283,17 +283,6 @@ FuncStatus getStatus(FuncRequest const & ev) break; } -#ifdef Q_WS_MACX - // 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. - if (use_gui - && qApp->activeWindow() != qApp->mainWidget() - && !lyxaction.funcHasFlag(ev.action, LyXAction::NoBuffer)) - flag.enabled(false); -#endif - return flag; } -- 2.39.2