From 9e256b044d3da4053782a8fa857ca68fd274464b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 25 Jul 2017 16:10:38 +0200 Subject: GUI support for Latch --- gtk2_ardour/automation_time_axis.cc | 27 ++++++++++++++++++++++++++- gtk2_ardour/automation_time_axis.h | 1 + gtk2_ardour/gain_meter.cc | 13 +++++++++---- gtk2_ardour/generic_pluginui.cc | 10 +++++++++- gtk2_ardour/panner_ui.cc | 6 ++++++ gtk2_ardour/plugin_ui.h | 2 ++ 6 files changed, 53 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 4ff48464f7..8e74774e79 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -138,6 +138,7 @@ AutomationTimeAxisView::AutomationTimeAxisView ( auto_off_item = 0; auto_touch_item = 0; + auto_latch_item = 0; auto_write_item = 0; auto_play_item = 0; mode_discrete_item = 0; @@ -170,6 +171,7 @@ AutomationTimeAxisView::AutomationTimeAxisView ( _parameter.type() <= MidiChannelPressureAutomation)) { auto_dropdown.AddMenuElem (MenuElem (_("Write"), sigc::bind (sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state), (AutoState) Write))); auto_dropdown.AddMenuElem (MenuElem (_("Touch"), sigc::bind (sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state), (AutoState) Touch))); + auto_dropdown.AddMenuElem (MenuElem (_("Latch"), sigc::bind (sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state), (AutoState) Latch))); } /* XXX translators: use a string here that will be at least as long @@ -369,7 +371,7 @@ AutomationTimeAxisView::automation_state_changed () state = ARDOUR::Off; } - switch (state & (ARDOUR::Off|Play|Touch|Write)) { + switch (state & (ARDOUR::Off|Play|Touch|Write|Latch)) { case ARDOUR::Off: auto_dropdown.set_text (automation_state_off_string()); ignore_state_request = true; @@ -379,6 +381,7 @@ AutomationTimeAxisView::automation_state_changed () } if (auto_touch_item) { auto_touch_item->set_active (false); + auto_latch_item->set_active (false); auto_write_item->set_active (false); } ignore_state_request = false; @@ -392,6 +395,7 @@ AutomationTimeAxisView::automation_state_changed () } if (auto_touch_item) { auto_touch_item->set_active (false); + auto_latch_item->set_active (false); auto_write_item->set_active (false); } ignore_state_request = false; @@ -406,6 +410,7 @@ AutomationTimeAxisView::automation_state_changed () if (auto_touch_item) { auto_write_item->set_active (true); auto_touch_item->set_active (false); + auto_latch_item->set_active (false); } ignore_state_request = false; break; @@ -419,6 +424,21 @@ AutomationTimeAxisView::automation_state_changed () if (auto_touch_item) { auto_touch_item->set_active (true); auto_write_item->set_active (false); + auto_latch_item->set_active (false); + } + ignore_state_request = false; + break; + case Latch: + auto_dropdown.set_text (_("Latch")); + ignore_state_request = true; + if (auto_off_item) { + auto_off_item->set_active (false); + auto_play_item->set_active (false); + } + if (auto_touch_item) { + auto_latch_item->set_active (true); + auto_touch_item->set_active (false); + auto_write_item->set_active (false); } ignore_state_request = false; break; @@ -622,6 +642,11 @@ AutomationTimeAxisView::build_display_menu () sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state), (AutoState) Touch))); auto_touch_item = dynamic_cast(&as_items.back()); + + as_items.push_back (CheckMenuElem (_("Latch"), sigc::bind ( + sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state), + (AutoState) Latch))); + auto_latch_item = dynamic_cast(&as_items.back()); } items.push_back (MenuElem (_("State"), *auto_state_menu)); diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index aae1ec5657..cabe532646 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -164,6 +164,7 @@ protected: Gtk::CheckMenuItem* auto_play_item; Gtk::CheckMenuItem* auto_touch_item; Gtk::CheckMenuItem* auto_write_item; + Gtk::CheckMenuItem* auto_latch_item; Gtk::CheckMenuItem* mode_discrete_item; Gtk::CheckMenuItem* mode_line_item; diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index 0b063ff886..02c3967f16 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -262,6 +262,8 @@ GainMeterBase::set_controls (boost::shared_ptr r, sigc::bind (sigc::mem_fun (*this, &GainMeterBase::set_gain_astate), (AutoState) ARDOUR::Write))); gain_astate_menu.items().push_back (MenuElem (_("Touch"), sigc::bind (sigc::mem_fun (*this, &GainMeterBase::set_gain_astate), (AutoState) ARDOUR::Touch))); + gain_astate_menu.items().push_back (MenuElem (_("Latch"), + sigc::bind (sigc::mem_fun (*this, &GainMeterBase::set_gain_astate), (AutoState) ARDOUR::Latch))); connections.push_back (gain_automation_state_button.signal_button_press_event().connect (sigc::mem_fun(*this, &GainMeterBase::gain_automation_state_button_event), false)); connections.push_back (ChangeGainAutomationState.connect (sigc::mem_fun(*this, &GainMeterBase::set_gain_astate))); @@ -782,16 +784,19 @@ GainMeterBase::_astate_string (AutoState state, bool shrt) switch (state) { case ARDOUR::Off: - sstr = (shrt ? "M" : _("M")); + sstr = (shrt ? "M" : S_("Manual|M")); break; case Play: - sstr = (shrt ? "P" : _("P")); + sstr = (shrt ? "P" : S_("Play|P")); break; case Touch: - sstr = (shrt ? "T" : _("T")); + sstr = (shrt ? "T" : S_("Trim|T")); + break; + case Latch: + sstr = (shrt ? "L" : S_("Latch|L")); break; case Write: - sstr = (shrt ? "W" : _("W")); + sstr = (shrt ? "W" : S_("Write|W")); break; } diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index 1e3e65d3e5..8be90cfa3f 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -120,6 +120,8 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr pi, bool scrol automation_write_all_button.set_name (X_("generic button")); automation_touch_all_button.set_text(_("Touch")); automation_touch_all_button.set_name (X_("generic button")); + automation_latch_all_button.set_text(_("Touch")); + automation_latch_all_button.set_name (X_("generic button")); constraint_hbox->set_spacing (5); constraint_hbox->set_homogeneous (false); @@ -407,6 +409,7 @@ GenericPluginUI::build () automation_play_all_button.signal_clicked.connect(sigc::bind (sigc::mem_fun (*this, &GenericPluginUI::set_all_automation), ARDOUR::Play)); automation_write_all_button.signal_clicked.connect(sigc::bind (sigc::mem_fun (*this, &GenericPluginUI::set_all_automation), ARDOUR::Write)); automation_touch_all_button.signal_clicked.connect(sigc::bind (sigc::mem_fun (*this, &GenericPluginUI::set_all_automation), ARDOUR::Touch)); + automation_latch_all_button.signal_clicked.connect(sigc::bind (sigc::mem_fun (*this, &GenericPluginUI::set_all_automation), ARDOUR::Latch)); /* XXX This is a workaround for AutomationControl not knowing about preset loads */ plugin->PresetLoaded.connect (*this, invalidator (*this), boost::bind (&GenericPluginUI::update_input_displays, this), gui_context ()); @@ -849,7 +852,7 @@ GenericPluginUI::automation_state_changed (ControlUI* cui) return; } - switch (state & (ARDOUR::Off|Play|Touch|Write)) { + switch (state & (ARDOUR::Off|Play|Touch|Write|Latch)) { case ARDOUR::Off: cui->automate_button.set_text (S_("Automation|Manual")); break; @@ -862,6 +865,9 @@ GenericPluginUI::automation_state_changed (ControlUI* cui) case Touch: cui->automate_button.set_text (_("Touch")); break; + case Latch: + cui->automate_button.set_text (_("Latch")); + break; default: cui->automate_button.set_text (_("???")); break; @@ -1223,6 +1229,8 @@ GenericPluginUI::astate_button_event (GdkEventButton* ev, ControlUI* cui) sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Write, cui))); items.push_back (MenuElem (_("Touch"), sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Touch, cui))); + items.push_back (MenuElem (_("Latch"), + sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Latch, cui))); anchored_menu_popup(automation_menu, &cui->automate_button, cui->automate_button.get_text(), 1, ev->time); diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc index a394932306..046e20a68a 100644 --- a/gtk2_ardour/panner_ui.cc +++ b/gtk2_ardour/panner_ui.cc @@ -154,6 +154,9 @@ PannerUI::build_astate_menu () pan_astate_menu->items().push_back (MenuElem (_("Touch"), sigc::bind ( sigc::mem_fun (_panner.get(), &Panner::set_automation_state), (AutoState) Touch))); + pan_astate_menu->items().push_back (MenuElem (_("Latch"), sigc::bind ( + sigc::mem_fun (_panner.get(), &Panner::set_automation_state), + (AutoState) Latch))); } @@ -569,6 +572,9 @@ PannerUI::_astate_string (AutoState state, bool shrt) case Touch: sstr = (shrt ? "T" : S_("Touch|T")); break; + case Latch: + sstr = (shrt ? "L" : S_("Latch|L")); + break; case Write: sstr = (shrt ? "W" : S_("Write|W")); break; diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index 370ceba600..b17ecc9296 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -148,6 +148,8 @@ protected: ArdourWidgets::ArdourButton automation_write_all_button; /** a button which sets all controls' automation setting to Touch */ ArdourWidgets::ArdourButton automation_touch_all_button; + /** a button which sets all controls' automation setting to Latch */ + ArdourWidgets::ArdourButton automation_latch_all_button; void set_latency_label (); -- cgit v1.2.3