Restore the state of the autoplay button in the import dialog
authorTim Mayberry <mojofunk@gmail.com>
Mon, 12 Jun 2017 13:59:11 +0000 (23:59 +1000)
committerTim Mayberry <mojofunk@gmail.com>
Mon, 12 Jun 2017 14:08:26 +0000 (00:08 +1000)
gtk2_ardour/sfdb_ui.cc
gtk2_ardour/sfdb_ui.h
gtk2_ardour/ui_config_vars.h

index 01fb044e63d4a42a5d2991cefcad4501c85f983d..e9000fa096eb455a12b65873b138d4048b9b7bcd 100644 (file)
@@ -237,6 +237,9 @@ SoundFileBox::SoundFileBox (bool /*persistent*/)
        play_btn.signal_clicked().connect (sigc::mem_fun (*this, &SoundFileBox::audition));
        stop_btn.signal_clicked().connect (sigc::mem_fun (*this, &SoundFileBox::stop_audition));
 
+       update_autoplay ();
+       autoplay_btn.signal_toggled().connect(sigc::mem_fun (*this, &SoundFileBox::autoplay_toggled));
+
        stop_btn.set_sensitive (false);
 
        channels_value.set_alignment (0.0f, 0.5f);
@@ -433,6 +436,22 @@ SoundFileBox::setup_labels (const string& filename)
        return true;
 }
 
+void
+SoundFileBox::update_autoplay ()
+{
+       const bool config_autoplay = UIConfiguration::instance().get_autoplay_files();
+
+       if (autoplay_btn.get_active() != config_autoplay) {
+               autoplay_btn.set_active (config_autoplay);
+       }
+}
+
+void
+SoundFileBox::autoplay_toggled()
+{
+       UIConfiguration::instance().set_autoplay_files(autoplay_btn.get_active());
+}
+
 bool
 SoundFileBox::autoplay() const
 {
index c0d7eb3aa0e4d0599f759f0f4d92b3b3cfc02600..d7eb80eccafe01e0e40b2741c85032c8295cb8f1 100644 (file)
@@ -115,6 +115,9 @@ class SoundFileBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr, public P
        void audition_active(bool);
        void audition_progress(ARDOUR::framecnt_t, ARDOUR::framecnt_t);
 
+       void update_autoplay ();
+       void autoplay_toggled ();
+
        bool tags_entry_left (GdkEventFocus* event);
        void tags_changed ();
        void save_tags (const std::vector<std::string>&);
index 1d2e5a1bb05df998c89565044388aeea2a848030..19147c305a3c1484b424e701718d50c217188766 100644 (file)
@@ -36,6 +36,7 @@ UI_CONFIG_VARIABLE (std::string, keyboard_layout, "keyboard-layout", "ansi")
 UI_CONFIG_VARIABLE (std::string, keyboard_layout_name, "keyboard-layout-name", "ansi")
 UI_CONFIG_VARIABLE (std::string, default_bindings, "default-bindings", "ardour")
 UI_CONFIG_VARIABLE (bool, only_copy_imported_files, "only-copy-imported-files", false)
+UI_CONFIG_VARIABLE (bool, autoplay_files, "autoplay-files", false)
 UI_CONFIG_VARIABLE (bool, default_narrow_ms, "default-narrow_ms", false)
 UI_CONFIG_VARIABLE (bool, name_new_markers, "name-new-markers", false)
 UI_CONFIG_VARIABLE (bool, rubberbanding_snaps_to_grid, "rubberbanding-snaps-to-grid", false)