cosmetics

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23528 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-03-07 00:29:12 +00:00
parent 4b12782854
commit 6e9980f149
2 changed files with 9 additions and 27 deletions

View File

@ -209,7 +209,7 @@ void Menus::macxMenuBarInit(GuiView * view)
QAction::ApplicationSpecificRole}, QAction::ApplicationSpecificRole},
{LFUN_LYX_QUIT, "", "Quit LyX", QAction::QuitRole} {LFUN_LYX_QUIT, "", "Quit LyX", QAction::QuitRole}
}; };
const size_t num_entries = sizeof(entries) / sizeof(MacMenuEntry); const size_t num_entries = sizeof(entries) / sizeof(entries[0]);
// the special menu for Menus. // the special menu for Menus.
Menu special; Menu special;
@ -218,15 +218,14 @@ void Menus::macxMenuBarInit(GuiView * view)
from_utf8(entries[i].arg)); from_utf8(entries[i].arg));
special.add(MenuItem(MenuItem::Command, entries[i].label, func)); special.add(MenuItem(MenuItem::Command, entries[i].label, func));
} }
specialMenu(special); setSpecialMenu(special);
// 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 = view->menuBar()->addMenu("special"); QMenu * qMenu = view->menuBar()->addMenu("special");
// we do not use 'special' because it is a temporary variable, // we do not use 'special' because it is a temporary variable,
// whereas Menus::specialMenu points to a persistent // whereas Menus::specialMenu points to a persistent copy.
// copy.
Menu::const_iterator cit = specialMenu().begin(); Menu::const_iterator cit = specialMenu().begin();
Menu::const_iterator end = specialMenu().end(); Menu::const_iterator end = specialMenu().end();
for (size_t i = 0 ; cit != end ; ++cit, ++i) { for (size_t i = 0 ; cit != end ; ++cit, ++i) {
@ -234,7 +233,6 @@ void Menus::macxMenuBarInit(GuiView * view)
cit->func(), QString()); cit->func(), QString());
action->setMenuRole(entries[i].role); action->setMenuRole(entries[i].role);
qMenu->addAction(action); qMenu->addAction(action);
} }
} }
@ -302,14 +300,7 @@ QString MenuItem::binding() const
} }
Menu & Menu::add(MenuItem const & i) void Menu::addWithStatusCheck(MenuItem const & i)
{
items_.push_back(i);
return *this;
}
Menu & Menu::addWithStatusCheck(MenuItem const & i)
{ {
switch (i.kind()) { switch (i.kind()) {
@ -352,12 +343,10 @@ Menu & Menu::addWithStatusCheck(MenuItem const & i)
default: default:
items_.push_back(i); items_.push_back(i);
} }
return *this;
} }
Menu & Menu::read(Lexer & lex) void Menu::read(Lexer & lex)
{ {
enum Menutags { enum Menutags {
md_item = 1, md_item = 1,
@ -526,7 +515,6 @@ Menu & Menu::read(Lexer & lex)
} }
} }
lex.popTable(); lex.popTable();
return *this;
} }
@ -591,12 +579,6 @@ bool Menu::searchMenu(FuncRequest const & func, vector<docstring> & names) const
} }
void Menus::specialMenu(Menu const & menu)
{
specialmenu_ = menu;
}
namespace { namespace {
bool compareFormat(Format const * p1, Format const * p2) bool compareFormat(Format const * p1, Format const * p2)

View File

@ -167,12 +167,12 @@ public:
explicit Menu(QString const & name = QString()) : name_(name) {} explicit Menu(QString const & name = QString()) : name_(name) {}
/// Add the menu item unconditionally /// Add the menu item unconditionally
Menu & add(MenuItem const &); void add(MenuItem const & item) { items_.push_back(item); }
/// Checks the associated FuncRequest status before adding the /// Checks the associated FuncRequest status before adding the
/// menu item. /// menu item.
Menu & addWithStatusCheck(MenuItem const &); void addWithStatusCheck(MenuItem const &);
/// ///
Menu & read(Lexer &); void read(Lexer &);
/// ///
QString const & name() const { return name_; } QString const & name() const { return name_; }
/// ///
@ -246,7 +246,7 @@ public:
that will be removed by expand() in other menus. This is that will be removed by expand() in other menus. This is
used by the Qt/Mac code used by the Qt/Mac code
*/ */
void specialMenu(Menu const &); void setSpecialMenu(Menu const & menu) { specialmenu_ = menu; }
/// ///
Menu const & specialMenu() { return specialmenu_; } Menu const & specialMenu() { return specialmenu_; }