* MenuBackend.cpp (binding): remove forgui argument

* frontends/qt4/GuiPopupMenu.cpp (addBinding): remove (merge into
	getLabel and remove mac-specific code).


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22412 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2008-01-07 10:53:04 +00:00
parent a63ec64642
commit cdb78de525
4 changed files with 10 additions and 24 deletions

View File

@ -116,7 +116,7 @@ docstring const MenuItem::shortcut() const
}
docstring const MenuItem::binding(bool forgui) const
docstring const MenuItem::binding() const
{
if (kind_ != Command)
return docstring();

View File

@ -117,11 +117,8 @@ public:
FuncStatus & status() { return status_; }
/// returns the status of the lfun associated with this entry
void status(FuncStatus const & status) { status_ = status; }
/**
* returns the binding associated to this action.
* Use the native UI format when \c forgui is true.
*/
docstring const binding(bool forgui) const;
///returns the binding associated to this action.
docstring const binding() const;
/// the description of the submenu (if relevant)
docstring const & submenuname() const { return submenuname_; }
/// set the description of the submenu

View File

@ -96,8 +96,7 @@ void GuiPopupMenu::populate(QMenu * qMenu, Menu * menu)
LYXERR(Debug::GUI, "creating Menu Item "
<< to_utf8(m->label()));
docstring label = getLabel(*m);
addBinding(label, *m);
docstring const label = getLabel(*m);
Action * action = new Action(*(owner_),
QIcon(), toqstr(label), m->func(), QString());
@ -109,29 +108,21 @@ void GuiPopupMenu::populate(QMenu * qMenu, Menu * menu)
docstring const GuiPopupMenu::getLabel(MenuItem const & mi)
{
docstring const shortcut = mi.shortcut();
docstring label = support::subst(mi.label(),
from_ascii("&"), from_ascii("&&"));
docstring label = support::subst(mi.label(),
from_ascii("&"), from_ascii("&&"));
docstring const shortcut = mi.shortcut();
if (!shortcut.empty()) {
size_t pos = label.find(shortcut);
if (pos != docstring::npos)
label.insert(pos, 1, char_type('&'));
}
return label;
}
void GuiPopupMenu::addBinding(docstring & label, MenuItem const & mi)
{
#ifdef Q_WS_MACX
docstring const binding = mi.binding(false);
#else
docstring const binding = mi.binding(true);
#endif
docstring const binding = mi.binding();
if (!binding.empty())
label += '\t' + binding;
return label;
}

View File

@ -42,8 +42,6 @@ public Q_SLOTS:
private:
/// Get a Menu item label from the menu backend
docstring const getLabel(MenuItem const & mi);
/// add binding keys a the menu item label.
void addBinding(docstring & label, MenuItem const & mi);
/// our owning view
GuiView * owner_;