diff options
author | David Robillard <d@drobilla.net> | 2007-07-04 02:37:09 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-07-04 02:37:09 +0000 |
commit | bdce4a436529b55cfd57e669e42541c32f7037fc (patch) | |
tree | 7ba14a9a17fb81885c56dc16a3f730c973d83439 /src/libs/gui | |
parent | 7c7e747f79d5073890ce37b761c3945ae97b8f18 (diff) | |
download | ingen-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/libs/gui')
-rw-r--r-- | src/libs/gui/PatchWindow.cpp | 47 | ||||
-rw-r--r-- | src/libs/gui/PatchWindow.h | 7 |
2 files changed, 46 insertions, 8 deletions
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; |