From 67cbdc6cf2dd03303a9a257096da7708aad085cb Mon Sep 17 00:00:00 2001 From: "Julien \"_FrnchFrgg_\" RIVAUD" Date: Fri, 29 Jul 2016 02:06:55 +0200 Subject: [PATCH] GenericUI: Update all input controls on preset load The existing code relies on AutomationControls for getting parameter changes and update the UI accordingly. One case where this doesn't yet work is preset loading, where ARDOUR::Plugin is responsible for actually loading the preset but doesn't notify the changes to AutomationControls. Since the input_controls vector now contains all ControlUI's that rely on AutomationControls to get updates, just listen to Plugin::PresetLoaded() and trigger an update of all elements in input_controls. This is temporary until a better solution is devised to make AutomationControls aware of preset loading. --- gtk2_ardour/generic_pluginui.cc | 17 +++++++++++++++++ gtk2_ardour/plugin_ui.h | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index d8ce68e4b4..0caf475afa 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -315,6 +315,9 @@ 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)); + + /* 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 ()); } @@ -847,6 +850,8 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param, automation_state_changed (control_ui); + /* Add to the list of CUIs that need manual update to workaround + * AutomationControl not knowing about preset loads */ input_controls.push_back (control_ui); } else { @@ -1013,6 +1018,18 @@ GenericPluginUI::update_control_display (ControlUI* cui) }*/ } +void +GenericPluginUI::update_input_displays () +{ + /* XXX This is a workaround for AutomationControl not knowing about preset loads */ + for (vector::iterator i = input_controls.begin(); + i != input_controls.end(); + ++i) { + update_control_display(*i); + } + return; +} + void GenericPluginUI::control_combo_changed (ControlUI* cui, float value) { diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index 001054bae9..d534a99d70 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -260,7 +260,7 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox int x0, x1, y0, y1; }; - std::vector input_controls; + std::vector input_controls; // workaround for preset load std::vector input_controls_with_automation; std::vector output_controls; @@ -281,6 +281,7 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox void ui_parameter_changed (ControlUI* cui); void update_control_display (ControlUI* cui); + void update_input_displays (); // workaround for preset load void control_combo_changed (ControlUI* cui, float value); void astate_clicked (ControlUI*); -- 2.30.2