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},
{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.
Menu special;
@ -218,15 +218,14 @@ void Menus::macxMenuBarInit(GuiView * view)
from_utf8(entries[i].arg));
special.add(MenuItem(MenuItem::Command, entries[i].label, func));
}
specialMenu(special);
setSpecialMenu(special);
// add the entries to a QMenu that will eventually be empty
// and therefore invisible.
QMenu * qMenu = view->menuBar()->addMenu("special");
// we do not use 'special' because it is a temporary variable,
// whereas Menus::specialMenu points to a persistent
// copy.
// whereas Menus::specialMenu points to a persistent copy.
Menu::const_iterator cit = specialMenu().begin();
Menu::const_iterator end = specialMenu().end();
for (size_t i = 0 ; cit != end ; ++cit, ++i) {
@ -234,7 +233,6 @@ void Menus::macxMenuBarInit(GuiView * view)
cit->func(), QString());
action->setMenuRole(entries[i].role);
qMenu->addAction(action);
}
}
@ -302,14 +300,7 @@ QString MenuItem::binding() const
}
Menu & Menu::add(MenuItem const & i)
{
items_.push_back(i);
return *this;
}
Menu & Menu::addWithStatusCheck(MenuItem const & i)
void Menu::addWithStatusCheck(MenuItem const & i)
{
switch (i.kind()) {
@ -352,12 +343,10 @@ Menu & Menu::addWithStatusCheck(MenuItem const & i)
default:
items_.push_back(i);
}
return *this;
}
Menu & Menu::read(Lexer & lex)
void Menu::read(Lexer & lex)
{
enum Menutags {
md_item = 1,
@ -526,7 +515,6 @@ Menu & Menu::read(Lexer & lex)
}
}
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 {
bool compareFormat(Format const * p1, Format const * p2)

View File

@ -167,12 +167,12 @@ public:
explicit Menu(QString const & name = QString()) : name_(name) {}
/// 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
/// menu item.
Menu & addWithStatusCheck(MenuItem const &);
void addWithStatusCheck(MenuItem const &);
///
Menu & read(Lexer &);
void read(Lexer &);
///
QString const & name() const { return name_; }
///
@ -246,7 +246,7 @@ public:
that will be removed by expand() in other menus. This is
used by the Qt/Mac code
*/
void specialMenu(Menu const &);
void setSpecialMenu(Menu const & menu) { specialmenu_ = menu; }
///
Menu const & specialMenu() { return specialmenu_; }