when building context menu for click on mixer strip, ensure clicked-on strip sets...
[ardour.git] / gtk2_ardour / engine_dialog.cc
index 742dce03f88272f6fff84b7aec06caaceb611d74..c88c836dfe72ab2b9087caa4bc0092c02004b29e 100644 (file)
@@ -285,14 +285,11 @@ EngineControl::EngineControl ()
        }
 
        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());
        }
 
-       {
-               /* ignore: don't save state */
-               PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
-               backend_changed ();
-       }
+       backend_changed ();
 
        /* in case the setting the backend failed, e.g. stale config, from set_state(), try again */
        if (0 == ARDOUR::AudioEngine::instance()->current_backend()) {
@@ -327,6 +324,10 @@ void
 EngineControl::on_show ()
 {
        ArdourDialog::on_show ();
+       if (!ARDOUR::AudioEngine::instance()->current_backend() || !ARDOUR::AudioEngine::instance()->running()) {
+               // re-check _have_control (jackd running) see #6041
+               backend_changed ();
+       }
        device_changed ();
        ok_button->grab_focus();
 }
@@ -493,7 +494,7 @@ EngineControl::build_full_control_notebook ()
        basic_packer.attach (lm_button_audio, 3, 4, row-1, row+1, xopt, xopt);
        ++row;
 
-       label = manage (left_aligned_label (_("MIDI System")));
+       label = manage (left_aligned_label (_("MIDI System:")));
        basic_packer.attach (*label, 0, 1, row, row + 1, xopt, (AttachOptions) 0);
        basic_packer.attach (midi_option_combo, 1, 2, row, row + 1, SHRINK, (AttachOptions) 0);
        basic_packer.attach (midi_devices_button, 3, 4, row, row+1, xopt, xopt);
@@ -1038,8 +1039,8 @@ EngineControl::bufsize_as_string (uint32_t sz)
        /* Translators: "samples" is always plural here, so no
           need for plural+singular forms.
         */
-       char buf[32];
-       snprintf (buf, sizeof (buf), _("%u samples"), sz);
+       char buf[64];
+       snprintf (buf, sizeof (buf), "%u %s", sz, P_("sample", "samples", sz));
        return buf;
 }
 
@@ -1051,9 +1052,6 @@ EngineControl::sample_rate_changed ()
         */
 
        show_buffer_duration ();
-       if (!ignore_changes) {
-               save_state ();
-       }
 
 }
 
@@ -1061,9 +1059,6 @@ void
 EngineControl::buffer_size_changed ()
 {
        show_buffer_duration ();
-       if (!ignore_changes) {
-               save_state ();
-       }
 }
 
 void
@@ -1137,18 +1132,11 @@ EngineControl::midi_option_changed ()
        } else {
                midi_devices_button.set_sensitive (true);
        }
-
-       if (!ignore_changes) {
-               save_state ();
-       }
 }
 
 void
 EngineControl::parameter_changed ()
 {
-       if (!ignore_changes) {
-               save_state ();
-       }
 }
 
 EngineControl::State
@@ -1460,7 +1448,7 @@ EngineControl::set_state (const XMLNode& root)
        for (StateList::const_iterator i = states.begin(); i != states.end(); ++i) {
 
                if ((*i)->active) {
-                       ignore_changes++;
+                       PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
                        backend_combo.set_active_text ((*i)->backend);
                        driver_combo.set_active_text ((*i)->driver);
                        device_combo.set_active_text ((*i)->device);
@@ -1469,7 +1457,6 @@ EngineControl::set_state (const XMLNode& root)
                        input_latency.set_value ((*i)->input_latency);
                        output_latency.set_value ((*i)->output_latency);
                        midi_option_combo.set_active_text ((*i)->midi_option);
-                       ignore_changes--;
                        break;
                }
        }
@@ -1740,6 +1727,8 @@ EngineControl::post_push ()
        if (!state) {
                state = save_state ();
                assert (state);
+       } else {
+               store_state(state);
        }
 
        /* all off */
@@ -2208,7 +2197,7 @@ EngineControl::engine_stopped ()
 void
 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 ();
        midi_option_changed();
 }