diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/ObjectMenu.cpp | 21 | ||||
-rw-r--r-- | src/gui/ObjectMenu.hpp | 2 | ||||
-rw-r--r-- | src/gui/PortMenu.cpp | 1 | ||||
-rw-r--r-- | src/gui/ingen_gui.glade | 7 |
4 files changed, 30 insertions, 1 deletions
diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index 5151fadc..41505e99 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -15,6 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <utility> #include <gtkmm.h> #include "interface/EngineInterface.hpp" #include "shared/LV2URIMap.hpp" @@ -39,6 +40,7 @@ ObjectMenu::ObjectMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade: , _properties_menuitem(NULL) { xml->get_widget("object_learn_menuitem", _learn_menuitem); + xml->get_widget("object_unlearn_menuitem", _unlearn_menuitem); xml->get_widget("object_polyphonic_menuitem", _polyphonic_menuitem); xml->get_widget("object_disconnect_menuitem", _disconnect_menuitem); xml->get_widget("object_rename_menuitem", _rename_menuitem); @@ -62,6 +64,9 @@ ObjectMenu::init(SharedPtr<ObjectModel> object) _learn_menuitem->signal_activate().connect( sigc::mem_fun(this, &ObjectMenu::on_menu_learn)); + _unlearn_menuitem->signal_activate().connect( + sigc::mem_fun(this, &ObjectMenu::on_menu_unlearn)); + _disconnect_menuitem->signal_activate().connect( sigc::mem_fun(this, &ObjectMenu::on_menu_disconnect)); @@ -78,6 +83,7 @@ ObjectMenu::init(SharedPtr<ObjectModel> object) object->signal_property.connect(sigc::mem_fun(this, &ObjectMenu::property_changed)); _learn_menuitem->hide(); + _unlearn_menuitem->hide(); _enable_signal = true; } @@ -86,7 +92,20 @@ ObjectMenu::init(SharedPtr<ObjectModel> object) void ObjectMenu::on_menu_learn() { - App::instance().engine()->learn(_object->path()); + App::instance().engine()->set_property(_object->path(), + App::instance().uris().ingen_controlBinding, + App::instance().uris().wildcard); +} + + +void +ObjectMenu::on_menu_unlearn() +{ + Resource::Properties remove; + remove.insert(std::make_pair( + App::instance().uris().ingen_controlBinding, + App::instance().uris().wildcard)); + App::instance().engine()->delta(_object->path(), remove, Resource::Properties()); } diff --git a/src/gui/ObjectMenu.hpp b/src/gui/ObjectMenu.hpp index 83857b2b..85160b2e 100644 --- a/src/gui/ObjectMenu.hpp +++ b/src/gui/ObjectMenu.hpp @@ -45,6 +45,7 @@ public: protected: void on_menu_learn(); + void on_menu_unlearn(); virtual void on_menu_disconnect() = 0; void on_menu_polyphonic(); void on_menu_destroy(); @@ -55,6 +56,7 @@ protected: bool _enable_signal; SharedPtr<ObjectModel> _object; Gtk::MenuItem* _learn_menuitem; + Gtk::MenuItem* _unlearn_menuitem; Gtk::CheckMenuItem* _polyphonic_menuitem; Gtk::MenuItem* _disconnect_menuitem; Gtk::MenuItem* _rename_menuitem; diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index d52500bc..b9c538e1 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -66,6 +66,7 @@ PortMenu::init(SharedPtr<PortModel> port, bool patch_port) if (port->type() == PortType::CONTROL) { _learn_menuitem->show(); + _unlearn_menuitem->show(); items().push_front(Gtk::Menu_Helpers::SeparatorElem()); diff --git a/src/gui/ingen_gui.glade b/src/gui/ingen_gui.glade index 1e297c12..85058105 100644 --- a/src/gui/ingen_gui.glade +++ b/src/gui/ingen_gui.glade @@ -3072,6 +3072,13 @@ Thank you for contributing.</property> </widget> </child> <child> + <widget class="GtkMenuItem" id="object_unlearn_menuitem"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Unlearn</property> + <property name="use_underline">True</property> + </widget> + </child> + <child> <widget class="GtkImageMenuItem" id="object_disconnect_menuitem"> <property name="label">Dis_connect</property> <property name="visible">True</property> |