13
0

GUI support for Latch

This commit is contained in:
Robin Gareus 2017-07-25 16:10:38 +02:00 committed by Paul Davis
parent 1d587592ca
commit 9e256b044d
6 changed files with 53 additions and 6 deletions

View File

@ -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<Gtk::CheckMenuItem*>(&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<Gtk::CheckMenuItem*>(&as_items.back());
}
items.push_back (MenuElem (_("State"), *auto_state_menu));

View File

@ -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;

View File

@ -262,6 +262,8 @@ GainMeterBase::set_controls (boost::shared_ptr<Route> 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;
}

View File

@ -120,6 +120,8 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> 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);

View File

@ -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;

View File

@ -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 ();