case LFUN_SERVER_NOTIFY:
enable = true;
break;
-
+
+ case LFUN_DIALOG_SHOW: {
+ string const name = cmd.getArg(0);
+ if (name == "aboutlyx" || name == "prefs") {
+ return true;
+ }
+ }
+
default:
return false;
}
lyxerr.setLevel(Debug::value(to_utf8(cmd.argument())));
break;
+ case LFUN_DIALOG_SHOW: {
+ string const name = cmd.getArg(0);
+
+ if ( name == "aboutlyx" || name == "prefs") {
+ if (current_view_ == 0)
+ createView();
+ }
+ }
+
default:
// The LFUN must be for one of GuiView, BufferView, Buffer or Cursor;
// let's try that:
// filling, at least for the static special menu item on Mac. Otherwise
// they are greyed out.
guiApp->setCurrentView(this);
-
- // Fill up the menu bar.
- guiApp->menus().fillMenuBar(menuBar(), this, true);
+
+#if defined(Q_WS_MACX)
+ static QMenuBar * qmb = new QMenuBar(0);
+#else
+ QMenuBar * qmb = menuBar();
+#endif
+ // Fill up the menu bar.
+ guiApp->menus().fillMenuBar(qmb, this, true);
setCentralWidget(d.stack_widget_);
QAction::MenuRole role;
};
- MacMenuEntry entries[] = {
+ static MacMenuEntry entries[] = {
{LFUN_DIALOG_SHOW, "aboutlyx", "About LyX",
QAction::AboutRole},
{LFUN_DIALOG_SHOW, "prefs", "Preferences",
mac_special_menu_.add(MenuItem(MenuItem::Command,
entries[i].label, func));
}
- }
-
- // add the entries to a QMenu that will eventually be empty
- // and therefore invisible.
- QMenu * qMenu = qmb->addMenu("special");
- MenuDefinition::const_iterator cit = mac_special_menu_.begin();
- MenuDefinition::const_iterator end = mac_special_menu_.end();
- for (size_t i = 0 ; cit != end ; ++cit, ++i) {
- Action * action = new Action(view, QIcon(), cit->label(),
- cit->func(), QString(), qMenu);
- action->setMenuRole(entries[i].role);
- qMenu->addAction(action);
+
+ // add the entries to a QMenu that will eventually be empty
+ // and therefore invisible.
+ QMenu * qMenu = qmb->addMenu("special");
+ MenuDefinition::const_iterator cit = mac_special_menu_.begin();
+ MenuDefinition::const_iterator end = mac_special_menu_.end();
+ for (size_t i = 0 ; cit != end ; ++cit, ++i) {
+ Action * action = new Action(view, QIcon(), cit->label(),
+ cit->func(), QString(), qMenu);
+ action->setMenuRole(entries[i].role);
+ qMenu->addAction(action);
+ }
}
}