From 91feee6f690f22f0fc72690bf96f5ff19609f27e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 4 Jul 2011 19:58:24 +0000 Subject: Eliminate weird-looking empty menus on non-control ports git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3413 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/PatchPortModule.cpp | 6 ++---- src/gui/PatchPortModule.hpp | 1 - src/gui/PortMenu.cpp | 26 ++++++++++++++------------ 3 files changed, 16 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp index 851f694b..4c2b321b 100644 --- a/src/gui/PatchPortModule.cpp +++ b/src/gui/PatchPortModule.cpp @@ -73,10 +73,8 @@ PatchPortModule::create(PatchCanvas& canvas, bool PatchPortModule::show_menu(GdkEventButton* ev) { - WidgetFactory::get_widget_derived("object_menu", _menu); - _menu->init(_model, true); - _menu->popup(ev->button, ev->time); - return true; + std::cout << "PPM SHOW MENU" << std::endl; + return _port->show_menu(ev); } void diff --git a/src/gui/PatchPortModule.hpp b/src/gui/PatchPortModule.hpp index b96d5dcb..655e6bfc 100644 --- a/src/gui/PatchPortModule.hpp +++ b/src/gui/PatchPortModule.hpp @@ -74,7 +74,6 @@ protected: SharedPtr _model; Port* _port; - PortMenu* _menu; }; } // namespace GUI diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index d958b278..c496d675 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -57,25 +57,27 @@ PortMenu::init(SharedPtr port, bool patch_port) if ( ! PtrCast(port->parent()) ) { _polyphonic_menuitem->set_sensitive(false); - _rename_menuitem->hide(); - _destroy_menuitem->hide(); + _rename_menuitem->set_sensitive(false); + _destroy_menuitem->set_sensitive(false); } if (port->is_a(PortType::EVENTS)) _polyphonic_menuitem->hide(); - _port_menu->remove(*_reset_range_menuitem); - _port_menu->remove(*_set_min_menuitem); - _port_menu->remove(*_set_max_menuitem); - if (App::instance().can_control(port.get()) && port->is_numeric()) { - _learn_menuitem->show(); - _unlearn_menuitem->show(); + items().push_back( + Gtk::Menu_Helpers::MenuElem( + "Disconnect All", sigc::mem_fun(this, &PortMenu::on_menu_disconnect))); + + const bool is_control = App::instance().can_control(port.get()) + && port->is_numeric(); - items().push_front(Gtk::Menu_Helpers::SeparatorElem()); + _reset_range_menuitem->set_sensitive(is_control); + _set_max_menuitem->set_sensitive(is_control); + _set_min_menuitem->set_sensitive(is_control); - insert(*_reset_range_menuitem, 0); - insert(*_set_max_menuitem, 0); - insert(*_set_min_menuitem, 0); + if (is_control) { + _learn_menuitem->show(); + _unlearn_menuitem->show(); } _enable_signal = true; -- cgit v1.2.1