Engine: remember state only on “Apply” and “OK”

filed under “another scary engine dialog change”
This commit is contained in:
Robin Gareus
2015-03-22 01:28:33 +01:00
parent 7e2f8bd872
commit 675444c7dd

View File

@@ -285,14 +285,11 @@ EngineControl::EngineControl ()
} }
if (backend_combo.get_active_text().empty()) { if (backend_combo.get_active_text().empty()) {
PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
backend_combo.set_active_text (backend_names.front()); backend_combo.set_active_text (backend_names.front());
} }
{ backend_changed ();
/* ignore: don't save state */
PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
backend_changed ();
}
/* in case the setting the backend failed, e.g. stale config, from set_state(), try again */ /* in case the setting the backend failed, e.g. stale config, from set_state(), try again */
if (0 == ARDOUR::AudioEngine::instance()->current_backend()) { if (0 == ARDOUR::AudioEngine::instance()->current_backend()) {
@@ -1051,9 +1048,6 @@ EngineControl::sample_rate_changed ()
*/ */
show_buffer_duration (); show_buffer_duration ();
if (!ignore_changes) {
save_state ();
}
} }
@@ -1061,9 +1055,6 @@ void
EngineControl::buffer_size_changed () EngineControl::buffer_size_changed ()
{ {
show_buffer_duration (); show_buffer_duration ();
if (!ignore_changes) {
save_state ();
}
} }
void void
@@ -1137,18 +1128,11 @@ EngineControl::midi_option_changed ()
} else { } else {
midi_devices_button.set_sensitive (true); midi_devices_button.set_sensitive (true);
} }
if (!ignore_changes) {
save_state ();
}
} }
void void
EngineControl::parameter_changed () EngineControl::parameter_changed ()
{ {
if (!ignore_changes) {
save_state ();
}
} }
EngineControl::State EngineControl::State
@@ -1460,7 +1444,7 @@ 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) {
ignore_changes++; PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
backend_combo.set_active_text ((*i)->backend); backend_combo.set_active_text ((*i)->backend);
driver_combo.set_active_text ((*i)->driver); driver_combo.set_active_text ((*i)->driver);
device_combo.set_active_text ((*i)->device); device_combo.set_active_text ((*i)->device);
@@ -1469,7 +1453,6 @@ EngineControl::set_state (const XMLNode& root)
input_latency.set_value ((*i)->input_latency); input_latency.set_value ((*i)->input_latency);
output_latency.set_value ((*i)->output_latency); output_latency.set_value ((*i)->output_latency);
midi_option_combo.set_active_text ((*i)->midi_option); midi_option_combo.set_active_text ((*i)->midi_option);
ignore_changes--;
break; break;
} }
} }
@@ -1740,6 +1723,8 @@ EngineControl::post_push ()
if (!state) { if (!state) {
state = save_state (); state = save_state ();
assert (state); assert (state);
} else {
store_state(state);
} }
/* all off */ /* all off */
@@ -2208,7 +2193,7 @@ EngineControl::engine_stopped ()
void void
EngineControl::device_list_changed () EngineControl::device_list_changed ()
{ {
PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1); PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1); // ??
list_devices (); list_devices ();
midi_option_changed(); midi_option_changed();
} }