mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-22 16:37:28 +00:00
Use MenuItem::status() instead of own submenudisabled function
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9107 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
99f82e6460
commit
f4811c91d7
@ -122,35 +122,6 @@ void GMenubar::openByName(string const & name)
|
||||
}
|
||||
|
||||
|
||||
bool GMenubar::submenuDisabled(MenuItem const * item)
|
||||
{
|
||||
Menu * from = item->submenu();
|
||||
Menu to;
|
||||
menubackend.expand(*from, to, view_);
|
||||
Menu::const_iterator i = to.begin();
|
||||
Menu::const_iterator end = to.end();
|
||||
for (; i != end; ++i) {
|
||||
switch (i->kind()) {
|
||||
case MenuItem::Submenu:
|
||||
if (!submenuDisabled(&(*i)))
|
||||
return false;
|
||||
break;
|
||||
case MenuItem::Command:
|
||||
{
|
||||
FuncStatus const flag =
|
||||
view_->getLyXFunc().getStatus(i->func());
|
||||
if (flag.enabled())
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void GMenubar::onSubMenuActivate(MenuItem const * item,
|
||||
Gtk::MenuItem * gitem)
|
||||
{
|
||||
@ -178,13 +149,12 @@ void GMenubar::onSubMenuActivate(MenuItem const * item,
|
||||
sigc::bind(sigc::mem_fun(*this, &GMenubar::onSubMenuActivate),
|
||||
&(*i),
|
||||
&gmenu->items().back()));
|
||||
if (submenuDisabled(&(*i)))
|
||||
if (!i->status().enabled())
|
||||
gmenu->items().back().set_sensitive(false);
|
||||
break;
|
||||
case MenuItem::Command:
|
||||
{
|
||||
FuncStatus const flag =
|
||||
view_->getLyXFunc().getStatus(i->func());
|
||||
FuncStatus const flag = i->status();
|
||||
bool on = flag.onoff(true);
|
||||
bool off = flag.onoff(false);
|
||||
|
||||
|
@ -33,7 +33,6 @@ public:
|
||||
private:
|
||||
void onCommandActivate(MenuItem const * item, Gtk::MenuItem * gitem);
|
||||
void onSubMenuActivate(MenuItem const * item, Gtk::MenuItem * gitem);
|
||||
bool submenuDisabled(MenuItem const * item);
|
||||
Gtk::MenuBar menubar_;
|
||||
LyXView * view_;
|
||||
std::vector<Glib::ustring> mainMenuNames_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user