summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-07-04 02:37:09 +0000
committerDavid Robillard <d@drobilla.net>2007-07-04 02:37:09 +0000
commitbdce4a436529b55cfd57e669e42541c32f7037fc (patch)
tree7ba14a9a17fb81885c56dc16a3f730c973d83439 /src
parent7c7e747f79d5073890ce37b761c3945ae97b8f18 (diff)
downloadingen-bdce4a436529b55cfd57e669e42541c32f7037fc.tar.gz
ingen-bdce4a436529b55cfd57e669e42541c32f7037fc.tar.bz2
ingen-bdce4a436529b55cfd57e669e42541c32f7037fc.zip
Remove MIDI event debug messages (from MIDI control node).
Properly maintain View->Patch Controls sensitivity state (by monitoring NodeModel signals). git-svn-id: http://svn.drobilla.net/lad/ingen@569 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/libs/engine/MidiControlNode.cpp7
-rw-r--r--src/libs/gui/PatchWindow.cpp47
-rw-r--r--src/libs/gui/PatchWindow.h7
3 files changed, 46 insertions, 15 deletions
diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp
index cca43549..6b83e335 100644
--- a/src/libs/engine/MidiControlNode.cpp
+++ b/src/libs/engine/MidiControlNode.cpp
@@ -76,13 +76,6 @@ MidiControlNode::process(SampleCount nframes, FrameTime start, FrameTime end)
while (midi_in->get_event(&timestamp, &size, &buffer) < nframes) {
- printf("EVENT: ");
- for (size_t i=0; i < size; ++i)
- printf("%X ", (int)buffer[i]);
- printf("\n");
-
- //const FrameTime time = start + (FrameTime)timestamp;
-
if (size >= 3 && (buffer[0] & 0xF0) == MIDI_CMD_CONTROL)
control(buffer[1], buffer[2], (SampleCount)timestamp);
diff --git a/src/libs/gui/PatchWindow.cpp b/src/libs/gui/PatchWindow.cpp
index ff2a6a4a..048416df 100644
--- a/src/libs/gui/PatchWindow.cpp
+++ b/src/libs/gui/PatchWindow.cpp
@@ -168,6 +168,9 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view)
return;
_enable_signal = false;
+
+ new_port_connection.disconnect();
+ removed_port_connection.disconnect();
_patch = patch;
@@ -203,7 +206,7 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view)
for (PortModelList::const_iterator p = patch->ports().begin();
p != patch->ports().end(); ++p) {
- if ((*p)->is_control()) {
+ if ((*p)->is_control() && (*p)->is_input()) {
_menu_view_control_window->property_sensitive() = true;
break;
}
@@ -223,7 +226,9 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view)
_menu_destroy_patch->set_sensitive(false);
else
_menu_destroy_patch->set_sensitive(true);
-
+
+ new_port_connection = patch->new_port_sig.connect(sigc::mem_fun(this, &PatchWindow::patch_port_added));
+ removed_port_connection = patch->removed_port_sig.connect(sigc::mem_fun(this, &PatchWindow::patch_port_removed));
show_all();
_enable_signal = true;
@@ -231,6 +236,35 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view)
void
+PatchWindow::patch_port_added(SharedPtr<PortModel> port)
+{
+ if (port->is_control() && port->is_input()) {
+ _menu_view_control_window->property_sensitive() = true;
+ }
+}
+
+
+void
+PatchWindow::patch_port_removed(SharedPtr<PortModel> port)
+{
+ if (port->is_control() && port->is_input()) {
+
+ bool found_control = false;
+
+ for (PortModelList::const_iterator i = _patch->ports().begin(); i != _patch->ports().end(); ++i) {
+ if ((*i)->is_control() && (*i)->is_input()) {
+ found_control = true;
+ break;
+ }
+ }
+
+ _menu_view_control_window->property_sensitive() = found_control;
+ }
+}
+
+
+
+void
PatchWindow::event_show_engine()
{
if (_patch)
@@ -384,12 +418,9 @@ bool
PatchWindow::on_key_press_event(GdkEventKey* event)
{
if (event->keyval == GDK_Delete) {
- cerr << "FIXME: delete key\n";
- /*
- if (_patch && _patch->get_view()) {
- assert(_patch->get_view()->canvas());
- _patch->get_view()->canvas()->destroy_selected();
- }*/
+ if (_view) {
+ _view->canvas()->destroy_selection();
+ }
return true;
} else {
return Gtk::Window::on_key_press_event(event);
diff --git a/src/libs/gui/PatchWindow.h b/src/libs/gui/PatchWindow.h
index 6e95c3d8..daa4af08 100644
--- a/src/libs/gui/PatchWindow.h
+++ b/src/libs/gui/PatchWindow.h
@@ -79,6 +79,10 @@ protected:
bool on_key_press_event(GdkEventKey* event);
private:
+
+ void patch_port_added(SharedPtr<PortModel> port);
+ void patch_port_removed(SharedPtr<PortModel> port);
+
void event_import();
void event_import_location();
void event_save();
@@ -98,6 +102,9 @@ private:
SharedPtr<PatchModel> _patch;
SharedPtr<PatchView> _view;
+ sigc::connection new_port_connection;
+ sigc::connection removed_port_connection;
+
bool _enable_signal;
bool _position_stored;
int _x;