Fix thinkos in cubasish theme
[ardour.git] / gtk2_ardour / export_file_notebook.cc
index 8e37356d0d7be6fbe112aeeacba60d690251ed0c..f53421d032798dafcc63d400dc28dbce1be63d3a 100644 (file)
@@ -1,22 +1,25 @@
 /*
-    Copyright (C) 2008 Paul Davis
-    Author: Sakari Bergen
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2008-2012 Sakari Bergen <sakari.bergen@beatwaves.net>
+ * Copyright (C) 2009-2016 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2009 David Robillard <d@drobilla.net>
+ * Copyright (C) 2012-2016 Tim Mayberry <mojofunk@gmail.com>
+ * Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2014 Colin Fletcher <colin.m.fletcher@googlemail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 
 #include "export_file_notebook.h"
 
@@ -116,6 +119,13 @@ void
 ExportFileNotebook::FilePage::analysis_changed ()
 {
        format_state->format->set_analyse (analysis_button.get_active ());
+       profile_manager->save_format_to_disk (format_state->format);
+}
+
+void
+ExportFileNotebook::FilePage::update_analysis_button ()
+{
+       analysis_button.set_active (format_state->format->analyse());
 }
 
 void
@@ -191,15 +201,15 @@ ExportFileNotebook::handle_page_change (GtkNotebookPage*, uint32_t page)
 ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager, ExportFileNotebook * parent, uint32_t number,
                                         ExportProfileManager::FormatStatePtr format_state,
                                         ExportProfileManager::FilenameStatePtr filename_state) :
-  format_state (format_state),
-  filename_state (filename_state),
-  profile_manager (profile_manager),
-
-  format_label (_("Format"), Gtk::ALIGN_LEFT),
-  filename_label (_("Location"), Gtk::ALIGN_LEFT),
-  soundcloud_upload_button (_("Upload to Soundcloud")),
-  analysis_button (_("Analyze Exported Audio")),
-  tab_number (number)
+       format_state (format_state),
+       filename_state (filename_state),
+       profile_manager (profile_manager),
+
+       format_label (_("Format"), Gtk::ALIGN_LEFT),
+       filename_label (_("Location"), Gtk::ALIGN_LEFT),
+       soundcloud_upload_button (_("Upload to Soundcloud")),
+       analysis_button (_("Analyze Exported Audio")),
+       tab_number (number)
 {
        set_border_width (12);
 
@@ -210,7 +220,9 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager,
 
        Gtk::HBox *hbox = Gtk::manage (new Gtk::HBox());
        hbox->set_spacing (6);
+#ifndef NDEBUG // SoundCloud upload is currently b0rked, needs debugging
        hbox->pack_start (soundcloud_upload_button, false, false, 0);
+#endif
        hbox->pack_start (analysis_button, false, false, 0);
        pack_start (*hbox, false, false, 0);
 
@@ -232,6 +244,7 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager,
        format_selector.set_state (format_state, s);
        filename_selector.set_state (filename_state, s);
        analysis_button.set_active (format_state->format->analyse());
+       soundcloud_upload_button.set_active (format_state->format->soundcloud_upload());
 
        /* Signals */
 
@@ -242,6 +255,7 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager,
        format_selector.FormatEdited.connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::save_format_to_manager));
        format_selector.FormatRemoved.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::remove_format_profile));
        format_selector.NewFormat.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::get_new_format));
+       format_selector.FormatReverted.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::revert_format_profile));
 
        format_selector.CriticalSelectionChanged.connect (
                sigc::mem_fun (*this, &ExportFileNotebook::FilePage::critical_selection_changed));
@@ -249,7 +263,8 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager,
                sigc::mem_fun (*this, &ExportFileNotebook::FilePage::critical_selection_changed));
 
        soundcloud_upload_button.signal_toggled().connect (sigc::mem_fun (*parent, &ExportFileNotebook::update_soundcloud_upload));
-       analysis_button.signal_toggled().connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::analysis_changed));
+       soundcloud_button_connection = soundcloud_upload_button.signal_toggled().connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::soundcloud_upload_changed));
+       analysis_button_connection = analysis_button.signal_toggled().connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::analysis_changed));
        /* Tab widget */
 
        tab_close_button.add (*Gtk::manage (new Gtk::Image (::get_icon("close"))));
@@ -289,9 +304,24 @@ ExportFileNotebook::FilePage::get_format_name () const
 bool
 ExportFileNotebook::FilePage::get_soundcloud_upload () const
 {
+#ifdef NDEBUG // SoundCloud upload is currently b0rked, needs debugging
+       return false;
+#endif
        return soundcloud_upload_button.get_active ();
 }
 
+void
+ExportFileNotebook::FilePage::soundcloud_upload_changed ()
+{
+       profile_manager->save_format_to_disk (format_state->format);
+}
+
+void
+ExportFileNotebook::FilePage::update_soundcloud_upload_button ()
+{
+       soundcloud_upload_button.set_active (format_state->format->soundcloud_upload());
+}
+
 void
 ExportFileNotebook::FilePage::save_format_to_manager (FormatPtr format)
 {
@@ -334,5 +364,15 @@ ExportFileNotebook::FilePage::critical_selection_changed ()
 {
        update_tab_label();
        update_example_filename();
+
+       soundcloud_button_connection.block ();
+       analysis_button_connection.block ();
+
+       update_analysis_button();
+       update_soundcloud_upload_button();
+
+       analysis_button_connection.unblock ();
+       soundcloud_button_connection.unblock ();
+
        CriticalSelectionChanged();
 }