Fix the missing dynamic menus in general and restore correctly from fullscreen.

This commit is contained in:
Stephan Witt 2014-01-29 19:20:01 +01:00
parent 3ac29dd9be
commit 00a7f002db
4 changed files with 19 additions and 14 deletions

View File

@ -528,7 +528,7 @@ QVector<GuiWorkArea*> GuiView::GuiViewPrivate::guiWorkAreas()
} }
#if defined(Q_WS_MACX) #if defined(Q_WS_MACX) && defined(QT_MAC_USE_COCOA)
QMenuBar * GuiView::menuBar() const QMenuBar * GuiView::menuBar() const
{ {
static QMenuBar * globalMenuBar = new QMenuBar(0); static QMenuBar * globalMenuBar = new QMenuBar(0);

View File

@ -137,7 +137,7 @@ public:
GuiToolbar * makeToolbar(ToolbarInfo const & tbinfo, bool newline); GuiToolbar * makeToolbar(ToolbarInfo const & tbinfo, bool newline);
void updateStatusBar(); void updateStatusBar();
#if defined(Q_WS_MACX) #if defined(Q_WS_MACX) && defined(QT_MAC_USE_COCOA)
// We have to share one menu bar, so we must create a menu bar that does not have a parent. // We have to share one menu bar, so we must create a menu bar that does not have a parent.
// To enforce this we override the QMainWindow::menuBar() implementation. // To enforce this we override the QMainWindow::menuBar() implementation.
// See https://bugreports.qt-project.org/browse/QTBUG-25399 // See https://bugreports.qt-project.org/browse/QTBUG-25399

View File

@ -1355,6 +1355,7 @@ void MenuDefinition::expandBranches(Buffer const * buf)
BufferParams const & master_params = buf->masterBuffer()->params(); BufferParams const & master_params = buf->masterBuffer()->params();
BufferParams const & params = buf->params(); BufferParams const & params = buf->params();
if (params.branchlist().empty() && master_params.branchlist().empty() ) { if (params.branchlist().empty() && master_params.branchlist().empty() ) {
LYXERR(Debug::GUI, "No Branches set for Document");
add(MenuItem(MenuItem::Help, qt_("No Branches Set for Document!"))); add(MenuItem(MenuItem::Help, qt_("No Branches Set for Document!")));
return; return;
} }
@ -1368,6 +1369,7 @@ void MenuDefinition::expandBranches(Buffer const * buf)
label = convert<docstring>(ii) + ". " + label label = convert<docstring>(ii) + ". " + label
+ char_type('|') + convert<docstring>(ii); + char_type('|') + convert<docstring>(ii);
} }
LYXERR(Debug::GUI, "Add item for branch " << label);
addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(label), addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(label),
FuncRequest(LFUN_BRANCH_INSERT, FuncRequest(LFUN_BRANCH_INSERT,
cit->branch()))); cit->branch())));
@ -1737,24 +1739,25 @@ void Menus::Impl::macxMenuBarInit(GuiView * view, QMenuBar * qmb)
// the special menu for Menus. Fill it up only once. // the special menu for Menus. Fill it up only once.
if (mac_special_menu_.size() == 0) { if (mac_special_menu_.size() == 0) {
LYXERR(Debug::GUI, "Prepare Mac OS X special menu");
for (size_t i = 0 ; i < num_entries ; ++i) { for (size_t i = 0 ; i < num_entries ; ++i) {
FuncRequest const func(entries[i].action, FuncRequest const func(entries[i].action,
from_utf8(entries[i].arg)); from_utf8(entries[i].arg));
mac_special_menu_.add(MenuItem(MenuItem::Command, mac_special_menu_.add(MenuItem(MenuItem::Command,
entries[i].label, func)); entries[i].label, func));
} }
}
// add the entries to a QMenu that will eventually be empty // add the entries to a QMenu that will eventually be empty
// and therefore invisible. // and therefore invisible.
QMenu * qMenu = qmb->addMenu("special"); QMenu * qMenu = qmb->addMenu("special");
MenuDefinition::const_iterator cit = mac_special_menu_.begin(); MenuDefinition::const_iterator cit = mac_special_menu_.begin();
MenuDefinition::const_iterator end = mac_special_menu_.end(); MenuDefinition::const_iterator end = mac_special_menu_.end();
for (size_t i = 0 ; cit != end ; ++cit, ++i) { for (size_t i = 0 ; cit != end ; ++cit, ++i) {
Action * action = new Action(view, QIcon(), cit->label(), Action * action = new Action(view, QIcon(), cit->label(),
cit->func(), QString(), qMenu); cit->func(), QString(), qMenu);
action->setMenuRole(entries[i].role); action->setMenuRole(entries[i].role);
qMenu->addAction(action); qMenu->addAction(action);
} LYXERR(Debug::GUI, "Add special menu item " << cit->label());
} }
} }

View File

@ -64,6 +64,8 @@ What's new
- Handle undo in `branch-add' function. - Handle undo in `branch-add' function.
- Fix the missing dynamic menus in general and restore correctly from fullscreen.
* DOCUMENTATION AND LOCALIZATION * DOCUMENTATION AND LOCALIZATION