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:
John Spray 2004-10-22 23:13:47 +00:00
parent 99f82e6460
commit f4811c91d7
2 changed files with 2 additions and 33 deletions

View File

@ -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, void GMenubar::onSubMenuActivate(MenuItem const * item,
Gtk::MenuItem * gitem) Gtk::MenuItem * gitem)
{ {
@ -178,13 +149,12 @@ void GMenubar::onSubMenuActivate(MenuItem const * item,
sigc::bind(sigc::mem_fun(*this, &GMenubar::onSubMenuActivate), sigc::bind(sigc::mem_fun(*this, &GMenubar::onSubMenuActivate),
&(*i), &(*i),
&gmenu->items().back())); &gmenu->items().back()));
if (submenuDisabled(&(*i))) if (!i->status().enabled())
gmenu->items().back().set_sensitive(false); gmenu->items().back().set_sensitive(false);
break; break;
case MenuItem::Command: case MenuItem::Command:
{ {
FuncStatus const flag = FuncStatus const flag = i->status();
view_->getLyXFunc().getStatus(i->func());
bool on = flag.onoff(true); bool on = flag.onoff(true);
bool off = flag.onoff(false); bool off = flag.onoff(false);

View File

@ -33,7 +33,6 @@ public:
private: private:
void onCommandActivate(MenuItem const * item, Gtk::MenuItem * gitem); void onCommandActivate(MenuItem const * item, Gtk::MenuItem * gitem);
void onSubMenuActivate(MenuItem const * item, Gtk::MenuItem * gitem); void onSubMenuActivate(MenuItem const * item, Gtk::MenuItem * gitem);
bool submenuDisabled(MenuItem const * item);
Gtk::MenuBar menubar_; Gtk::MenuBar menubar_;
LyXView * view_; LyXView * view_;
std::vector<Glib::ustring> mainMenuNames_; std::vector<Glib::ustring> mainMenuNames_;