summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-01-29 01:43:54 +0000
committerDavid Robillard <d@drobilla.net>2010-01-29 01:43:54 +0000
commitd5a514148bec58cd7e97d032259362b2e19c0e95 (patch)
tree64ea4dd182a8918b47a6d5f391e2cd097aebb526 /src/gui
parent36039b294ee823ceb2c239129defc5eafa110247 (diff)
downloadingen-d5a514148bec58cd7e97d032259362b2e19c0e95.tar.gz
ingen-d5a514148bec58cd7e97d032259362b2e19c0e95.tar.bz2
ingen-d5a514148bec58cd7e97d032259362b2e19c0e95.zip
Magic MIDI binding via special ingen_control port.
Always set lv2:minimum and lv2:maximum properties for control ports so they show up in properties dialog (and can be used for MIDI binding). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2391 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/NodeMenu.cpp10
-rw-r--r--src/gui/NodeMenu.hpp3
-rw-r--r--src/gui/ObjectMenu.cpp13
-rw-r--r--src/gui/ObjectMenu.hpp2
-rw-r--r--src/gui/Port.cpp6
-rw-r--r--src/gui/PortMenu.cpp3
-rw-r--r--src/gui/ingen_gui.glade18
7 files changed, 30 insertions, 25 deletions
diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp
index d667181a..f676ed79 100644
--- a/src/gui/NodeMenu.cpp
+++ b/src/gui/NodeMenu.cpp
@@ -37,13 +37,11 @@ NodeMenu::NodeMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml
{
Gtk::Menu* node_menu = NULL;
xml->get_widget("node_menu", node_menu);
- xml->get_widget("node_learn_menuitem", _learn_menuitem);
xml->get_widget("node_controls_menuitem", _controls_menuitem);
xml->get_widget("node_popup_gui_menuitem", _popup_gui_menuitem);
xml->get_widget("node_embed_gui_menuitem", _embed_gui_menuitem);
xml->get_widget("node_randomize_menuitem", _randomize_menuitem);
- node_menu->remove(*_learn_menuitem);
node_menu->remove(*_controls_menuitem);
node_menu->remove(*_popup_gui_menuitem);
node_menu->remove(*_embed_gui_menuitem);
@@ -54,7 +52,6 @@ NodeMenu::NodeMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml
insert(*_controls_menuitem, 0);
insert(*_popup_gui_menuitem, 0);
insert(*_embed_gui_menuitem, 0);
- insert(*_learn_menuitem, 0);
}
@@ -154,13 +151,6 @@ NodeMenu::on_menu_randomize()
void
-NodeMenu::on_menu_learn()
-{
- App::instance().engine()->midi_learn(_object->path());
-}
-
-
-void
NodeMenu::on_menu_disconnect()
{
App::instance().engine()->disconnect_all(_object->parent()->path(), _object->path());
diff --git a/src/gui/NodeMenu.hpp b/src/gui/NodeMenu.hpp
index 29abc603..dc9c2cfe 100644
--- a/src/gui/NodeMenu.hpp
+++ b/src/gui/NodeMenu.hpp
@@ -47,17 +47,14 @@ public:
sigc::signal<void, bool> signal_embed_gui;
protected:
-
virtual void enable_controls_menuitem();
virtual void disable_controls_menuitem();
void on_menu_disconnect();
- void on_menu_learn();
void on_menu_embed_gui();
void on_menu_randomize();
void on_preset_activated(const std::string uri);
- Gtk::MenuItem* _learn_menuitem;
Gtk::MenuItem* _controls_menuitem;
Gtk::MenuItem* _popup_gui_menuitem;
Gtk::CheckMenuItem* _embed_gui_menuitem;
diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp
index 261cbd44..781c4359 100644
--- a/src/gui/ObjectMenu.cpp
+++ b/src/gui/ObjectMenu.cpp
@@ -37,6 +37,7 @@ ObjectMenu::ObjectMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade:
, _destroy_menuitem(NULL)
, _properties_menuitem(NULL)
{
+ xml->get_widget("object_learn_menuitem", _learn_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);
@@ -57,6 +58,9 @@ ObjectMenu::init(SharedPtr<ObjectModel> object)
_polyphonic_menuitem->set_active(object->polyphonic());
+ _learn_menuitem->signal_activate().connect(
+ sigc::mem_fun(this, &ObjectMenu::on_menu_learn));
+
_disconnect_menuitem->signal_activate().connect(
sigc::mem_fun(this, &ObjectMenu::on_menu_disconnect));
@@ -72,11 +76,20 @@ ObjectMenu::init(SharedPtr<ObjectModel> object)
object->signal_property.connect(sigc::mem_fun(this, &ObjectMenu::property_changed));
+ _learn_menuitem->hide();
+
_enable_signal = true;
}
void
+ObjectMenu::on_menu_learn()
+{
+ App::instance().engine()->learn(_object->path());
+}
+
+
+void
ObjectMenu::on_menu_polyphonic()
{
if (_enable_signal)
diff --git a/src/gui/ObjectMenu.hpp b/src/gui/ObjectMenu.hpp
index 1a722581..a619c5e4 100644
--- a/src/gui/ObjectMenu.hpp
+++ b/src/gui/ObjectMenu.hpp
@@ -44,6 +44,7 @@ public:
void init(SharedPtr<ObjectModel> object);
protected:
+ void on_menu_learn();
virtual void on_menu_disconnect() = 0;
void on_menu_polyphonic();
void on_menu_destroy();
@@ -53,6 +54,7 @@ protected:
bool _enable_signal;
SharedPtr<ObjectModel> _object;
+ Gtk::MenuItem* _learn_menuitem;
Gtk::CheckMenuItem* _polyphonic_menuitem;
Gtk::MenuItem* _disconnect_menuitem;
Gtk::MenuItem* _rename_menuitem;
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index bbde8100..fafac68d 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -139,10 +139,12 @@ Port::on_event(GdkEvent* ev)
{
switch (ev->type) {
case GDK_BUTTON_PRESS:
- _pressed = true;
+ if (ev->button.button == 1)
+ _pressed = true;
break;
case GDK_BUTTON_RELEASE:
- _pressed = false;
+ if (ev->button.button == 1)
+ _pressed = false;
default:
break;
}
diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp
index a32eb662..3cb8c071 100644
--- a/src/gui/PortMenu.cpp
+++ b/src/gui/PortMenu.cpp
@@ -50,6 +50,9 @@ PortMenu::init(SharedPtr<PortModel> port, bool patch_port)
if (port->type() == PortType::EVENTS)
_polyphonic_menuitem->hide();
+ if (port->type() == PortType::CONTROL)
+ _learn_menuitem->show();
+
_enable_signal = true;
}
diff --git a/src/gui/ingen_gui.glade b/src/gui/ingen_gui.glade
index f294678b..ad84483f 100644
--- a/src/gui/ingen_gui.glade
+++ b/src/gui/ingen_gui.glade
@@ -2924,6 +2924,7 @@ Thank you for contributing.</property>
<widget class="GtkImageMenuItem" id="port_control_menu_properties">
<property name="label">gtk-properties</property>
<property name="visible">True</property>
+ <property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_port_control_menu_properties_activate"/>
</widget>
@@ -3064,6 +3065,13 @@ Thank you for contributing.</property>
</widget>
</child>
<child>
+ <widget class="GtkMenuItem" id="object_learn_menuitem">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Learn</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>
@@ -3113,16 +3121,6 @@ Thank you for contributing.</property>
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
- <widget class="GtkImageMenuItem" id="node_learn_menuitem">
- <property name="label">_Learn</property>
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="tooltip" translatable="yes">Learn from the next received event</property>
- <property name="use_underline">True</property>
- <property name="use_stock">False</property>
- </widget>
- </child>
- <child>
<widget class="GtkImageMenuItem" id="node_controls_menuitem">
<property name="label">Con_trols...</property>
<property name="visible">True</property>