diff options
author | David Robillard <d@drobilla.net> | 2014-11-03 16:37:19 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-11-03 16:37:19 -0500 |
commit | 35672fb80a2258b01da60ba9514266b94c1493ff (patch) | |
tree | 34bc78495a708078321696cf7acb11b89d470a94 /gtk2_ardour/automation_controller.cc | |
parent | 7204702c3ffbd3a1c6747511104d9c6af1b9c93d (diff) |
Note selector dialog for note controls.
Diffstat (limited to 'gtk2_ardour/automation_controller.cc')
-rw-r--r-- | gtk2_ardour/automation_controller.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gtk2_ardour/automation_controller.cc b/gtk2_ardour/automation_controller.cc index c4cc93386f..4fa7f67ccd 100644 --- a/gtk2_ardour/automation_controller.cc +++ b/gtk2_ardour/automation_controller.cc @@ -30,6 +30,7 @@ #include "ardour_ui.h" #include "automation_controller.h" #include "gui_thread.h" +#include "note_select_dialog.h" #include "i18n.h" @@ -52,6 +53,9 @@ AutomationController::AutomationController(boost::shared_ptr<Automatable> StartGesture.connect (sigc::mem_fun(*this, &AutomationController::start_touch)); StopGesture.connect (sigc::mem_fun(*this, &AutomationController::end_touch)); + signal_button_release_event().connect( + sigc::mem_fun(*this, &AutomationController::on_button_release)); + _adjustment->signal_value_changed().connect ( sigc::mem_fun(*this, &AutomationController::value_adjusted)); @@ -145,6 +149,32 @@ AutomationController::end_touch () } void +AutomationController::run_note_select_dialog() +{ + NoteSelectDialog* dialog = new NoteSelectDialog(); + if (dialog->run() == Gtk::RESPONSE_ACCEPT) { + _controllable->set_value(dialog->note_number()); + } + delete dialog; +} + +bool +AutomationController::on_button_release(GdkEventButton* ev) +{ + using namespace Gtk::Menu_Helpers; + + if (ev->button == 3 && _controllable->desc().unit == ARDOUR::ParameterDescriptor::MIDI_NOTE) { + Gtk::Menu* menu = manage(new Menu()); + MenuList& items = menu->items(); + items.push_back(MenuElem(_("Select Note..."), + sigc::mem_fun(*this, &AutomationController::run_note_select_dialog))); + menu->popup(1, ev->time); + return true; + } + return false; +} + +void AutomationController::value_changed () { Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&AutomationController::display_effective_value, this)); |