Add use-these-engine-settings-from-now-on checkbox

Functional, but this needs a layout fix, still.
This commit is contained in:
Robin Gareus 2019-09-26 21:12:37 +02:00
parent 55e03e5c68
commit 9d65350600
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 38 additions and 0 deletions

View file

@ -42,6 +42,8 @@
#include <gtkmm/notebook.h> #include <gtkmm/notebook.h>
#include <gtkmm2ext/utils.h> #include <gtkmm2ext/utils.h>
#include "widgets/tooltips.h"
#include "ardour/audio_backend.h" #include "ardour/audio_backend.h"
#include "ardour/audioengine.h" #include "ardour/audioengine.h"
#include "ardour/mtdm.h" #include "ardour/mtdm.h"
@ -98,6 +100,7 @@ EngineControl::EngineControl ()
, start_stop_button (_("Stop")) , start_stop_button (_("Stop"))
, update_devices_button (_("Refresh Devices")) , update_devices_button (_("Refresh Devices"))
, use_buffered_io_button (_("Use Buffered I/O"), ArdourButton::led_default_elements) , use_buffered_io_button (_("Use Buffered I/O"), ArdourButton::led_default_elements)
, try_autostart_button (_("Autostart"), ArdourButton::led_default_elements)
, lm_measure_label (_("Measure")) , lm_measure_label (_("Measure"))
, lm_use_button (_("Use results")) , lm_use_button (_("Use results"))
, lm_back_button (_("Back to settings ... (ignore results)")) , lm_back_button (_("Back to settings ... (ignore results)"))
@ -307,6 +310,15 @@ EngineControl::EngineControl ()
use_buffered_io_button.set_name ("generic button"); use_buffered_io_button.set_name ("generic button");
use_buffered_io_button.set_can_focus(true); use_buffered_io_button.set_can_focus(true);
try_autostart_button.signal_clicked.connect (mem_fun (*this, &EngineControl::try_autostart_button_clicked));
try_autostart_button.set_name ("generic button");
try_autostart_button.set_can_focus(true);
config_parameter_changed ("try-autostart-engine");
set_tooltip (try_autostart_button,
string_compose (_("Always try these settings when starting %1, if the same device is available"), PROGRAM_NAME));
ARDOUR::Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&EngineControl::config_parameter_changed, this, _1), gui_context());
/* Pick up any existing audio setup configuration, if appropriate */ /* Pick up any existing audio setup configuration, if appropriate */
XMLNode* audio_setup = ARDOUR::Config->extra_xml ("AudioMIDISetup"); XMLNode* audio_setup = ARDOUR::Config->extra_xml ("AudioMIDISetup");
@ -453,6 +465,14 @@ EngineControl::on_map ()
ArdourDialog::on_map (); ArdourDialog::on_map ();
} }
void
EngineControl::config_parameter_changed (std::string const & p)
{
if (p == "try-autostart-engine") {
try_autostart_button.set_active (ARDOUR::Config->get_try_autostart_engine ());
}
}
bool bool
EngineControl::try_autostart () EngineControl::try_autostart ()
{ {
@ -662,6 +682,14 @@ EngineControl::build_full_control_notebook ()
basic_packer.attach (midi_option_combo, 1, 2, row, row + 1, SHRINK, (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); basic_packer.attach (midi_devices_button, 3, 4, row, row+1, xopt, xopt);
row++; row++;
/* TODO: This button needs some better layout, position (!)
* ideally just below the "start" button.
* but that place is next to "Driver" and occupied by update_devices_button (Windows, Portaudio Only)
* next line after "Device" is the use_buffered_io_button (also Windows only).
* crap.
*/
basic_packer.attach (try_autostart_button, 3, 4, row, row+1, xopt, xopt);
} }
void void
@ -2763,6 +2791,13 @@ EngineControl::update_devices_button_clicked ()
} }
} }
void
EngineControl::try_autostart_button_clicked ()
{
ARDOUR::Config->set_try_autostart_engine (!try_autostart_button.get_active ());
try_autostart_button.set_active (ARDOUR::Config->get_try_autostart_engine ());
}
void void
EngineControl::use_buffered_io_button_clicked () EngineControl::use_buffered_io_button_clicked ()
{ {

View file

@ -95,6 +95,7 @@ private:
ArdourWidgets::ArdourButton start_stop_button; ArdourWidgets::ArdourButton start_stop_button;
ArdourWidgets::ArdourButton update_devices_button; ArdourWidgets::ArdourButton update_devices_button;
ArdourWidgets::ArdourButton use_buffered_io_button; ArdourWidgets::ArdourButton use_buffered_io_button;
ArdourWidgets::ArdourButton try_autostart_button;
Gtk::Button connect_disconnect_button; Gtk::Button connect_disconnect_button;
@ -328,10 +329,12 @@ private:
void on_show (); void on_show ();
void on_map (); void on_map ();
void config_parameter_changed (std::string const&);
void control_app_button_clicked (); void control_app_button_clicked ();
void start_stop_button_clicked (); void start_stop_button_clicked ();
void update_devices_button_clicked (); void update_devices_button_clicked ();
void use_buffered_io_button_clicked (); void use_buffered_io_button_clicked ();
void try_autostart_button_clicked ();
void use_latency_button_clicked (); void use_latency_button_clicked ();
void manage_control_app_sensitivity (); void manage_control_app_sensitivity ();
int push_state_to_backend (bool start); int push_state_to_backend (bool start);