Refactor part of EngineControl::set_state into new set_current_state method
This commit is contained in:
parent
a9c149216d
commit
f428cb4bf1
@ -1704,8 +1704,17 @@ EngineControl::set_state (const XMLNode& root)
|
||||
for (StateList::const_iterator i = states.begin(); i != states.end(); ++i) {
|
||||
|
||||
if ((*i)->active) {
|
||||
set_current_state (*i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EngineControl::set_current_state (const State& state)
|
||||
{
|
||||
PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
|
||||
backend_combo.set_active_text ((*i)->backend);
|
||||
backend_combo.set_active_text (state->backend);
|
||||
|
||||
/* The driver popdown strings need to be populated now so that
|
||||
* set_active_text will actually set a valid entry. Then
|
||||
@ -1713,23 +1722,20 @@ EngineControl::set_state (const XMLNode& root)
|
||||
* can also be set to valid entries and the state will be restored
|
||||
* correctly.
|
||||
*/
|
||||
if (!(*i)->driver.empty()) {
|
||||
if (!state->driver.empty()) {
|
||||
set_driver_popdown_strings ();
|
||||
}
|
||||
driver_combo.set_active_text ((*i)->driver);
|
||||
driver_combo.set_active_text (state->driver);
|
||||
backend_changed ();
|
||||
|
||||
device_combo.set_active_text ((*i)->device);
|
||||
input_device_combo.set_active_text ((*i)->input_device);
|
||||
output_device_combo.set_active_text ((*i)->output_device);
|
||||
sample_rate_combo.set_active_text (rate_as_string ((*i)->sample_rate));
|
||||
set_active_text_if_present (buffer_size_combo, bufsize_as_string ((*i)->buffer_size));
|
||||
input_latency.set_value ((*i)->input_latency);
|
||||
output_latency.set_value ((*i)->output_latency);
|
||||
midi_option_combo.set_active_text ((*i)->midi_option);
|
||||
break;
|
||||
}
|
||||
}
|
||||
device_combo.set_active_text (state->device);
|
||||
input_device_combo.set_active_text (state->input_device);
|
||||
output_device_combo.set_active_text (state->output_device);
|
||||
sample_rate_combo.set_active_text (rate_as_string (state->sample_rate));
|
||||
set_active_text_if_present (buffer_size_combo, bufsize_as_string (state->buffer_size));
|
||||
input_latency.set_value (state->input_latency);
|
||||
output_latency.set_value (state->output_latency);
|
||||
midi_option_combo.set_active_text (state->midi_option);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -235,6 +235,8 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
|
||||
void store_state (State);
|
||||
bool equivalent_states (const State&, const State&);
|
||||
|
||||
void set_current_state (const State& state);
|
||||
|
||||
bool _have_control;
|
||||
|
||||
static bool print_channel_count (Gtk::SpinButton*);
|
||||
|
Loading…
Reference in New Issue
Block a user