13
0

Refactor part of EngineControl::set_state into new set_current_state method

This commit is contained in:
Tim Mayberry 2015-08-09 09:39:01 +10:00
parent a9c149216d
commit f428cb4bf1
2 changed files with 31 additions and 23 deletions

View File

@ -1704,8 +1704,17 @@ EngineControl::set_state (const XMLNode& root)
for (StateList::const_iterator i = states.begin(); i != states.end(); ++i) { for (StateList::const_iterator i = states.begin(); i != states.end(); ++i) {
if ((*i)->active) { 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); 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 /* The driver popdown strings need to be populated now so that
* set_active_text will actually set a valid entry. Then * 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 * can also be set to valid entries and the state will be restored
* correctly. * correctly.
*/ */
if (!(*i)->driver.empty()) { if (!state->driver.empty()) {
set_driver_popdown_strings (); set_driver_popdown_strings ();
} }
driver_combo.set_active_text ((*i)->driver); driver_combo.set_active_text (state->driver);
backend_changed (); backend_changed ();
device_combo.set_active_text ((*i)->device); device_combo.set_active_text (state->device);
input_device_combo.set_active_text ((*i)->input_device); input_device_combo.set_active_text (state->input_device);
output_device_combo.set_active_text ((*i)->output_device); output_device_combo.set_active_text (state->output_device);
sample_rate_combo.set_active_text (rate_as_string ((*i)->sample_rate)); sample_rate_combo.set_active_text (rate_as_string (state->sample_rate));
set_active_text_if_present (buffer_size_combo, bufsize_as_string ((*i)->buffer_size)); set_active_text_if_present (buffer_size_combo, bufsize_as_string (state->buffer_size));
input_latency.set_value ((*i)->input_latency); input_latency.set_value (state->input_latency);
output_latency.set_value ((*i)->output_latency); output_latency.set_value (state->output_latency);
midi_option_combo.set_active_text ((*i)->midi_option); midi_option_combo.set_active_text (state->midi_option);
break;
}
}
} }
int int

View File

@ -235,6 +235,8 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
void store_state (State); void store_state (State);
bool equivalent_states (const State&, const State&); bool equivalent_states (const State&, const State&);
void set_current_state (const State& state);
bool _have_control; bool _have_control;
static bool print_channel_count (Gtk::SpinButton*); static bool print_channel_count (Gtk::SpinButton*);