summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-07-04 19:58:24 +0000
committerDavid Robillard <d@drobilla.net>2011-07-04 19:58:24 +0000
commit91feee6f690f22f0fc72690bf96f5ff19609f27e (patch)
tree438eee38f0ac71cf682b7f5878eb0f371eb41e91 /src
parent643f1a89bb82cfb5ee4c1fb4f5cd9e82fe77ab5e (diff)
downloadingen-91feee6f690f22f0fc72690bf96f5ff19609f27e.tar.gz
ingen-91feee6f690f22f0fc72690bf96f5ff19609f27e.tar.bz2
ingen-91feee6f690f22f0fc72690bf96f5ff19609f27e.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/gui/PatchPortModule.cpp6
-rw-r--r--src/gui/PatchPortModule.hpp1
-rw-r--r--src/gui/PortMenu.cpp26
3 files changed, 16 insertions, 17 deletions
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<const PortModel> _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<const PortModel> port, bool patch_port)
if ( ! PtrCast<PatchModel>(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;