summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2020-01-23 17:05:36 -0600
committerBen Loftis <ben@harrisonconsoles.com>2020-01-23 17:16:41 -0600
commit6f4f28928d7fbe6cf65a175fab5632c36824ce04 (patch)
treec992955be91f2e305d9b2a0c443d1b2471393b5b
parent1c97cdb33d724dd3273881ad305f6e38c32827c3 (diff)
Export Dialog: catch major changes, and mark the session dirty. Otherwise changes can be silently lost.
-rw-r--r--gtk2_ardour/export_dialog.cc22
-rw-r--r--gtk2_ardour/export_dialog.h4
2 files changed, 26 insertions, 0 deletions
diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc
index 8e197060b0..4a266d9f2f 100644
--- a/gtk2_ardour/export_dialog.cc
+++ b/gtk2_ardour/export_dialog.cc
@@ -62,6 +62,7 @@ ExportDialog::ExportDialog (PublicEditor & editor, std::string title, ARDOUR::Ex
, list_files_label (_("<span color=\"#ffa755\">Some already existing files will be overwritten.</span>"), Gtk::ALIGN_RIGHT)
, list_files_button (_("List files"))
, previous_progress (0)
+ , _initialized (false)
{ }
ExportDialog::~ExportDialog ()
@@ -114,9 +115,19 @@ ExportDialog::set_session (ARDOUR::Session* s)
channel_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_realtime_selection));
file_notebook->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings_and_example_filename));
+ /* Catch major selection changes, and set the session dirty */
+
+ preset_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::maybe_set_session_dirty));
+ timespan_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::maybe_set_session_dirty));
+ channel_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::maybe_set_session_dirty));
+ channel_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::maybe_set_session_dirty));
+ file_notebook->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::maybe_set_session_dirty));
+
update_warnings_and_example_filename ();
update_realtime_selection ();
+ _initialized = true;
+
_session->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&ExportDialog::parameter_changed, this, _1), gui_context());
}
@@ -227,6 +238,17 @@ ExportDialog::sync_with_manager ()
update_realtime_selection ();
}
+
+void
+ExportDialog::maybe_set_session_dirty ()
+{
+ /* Presumably after all initialization is finished, sync_with_manager means that something important changed. */
+ /* Let's prompt the user to save the session; otherwise these Export settings changes would be lost on re-open */
+ if (_initialized) {
+ _session->set_dirty();
+ }
+}
+
void
ExportDialog::update_warnings_and_example_filename ()
{
diff --git a/gtk2_ardour/export_dialog.h b/gtk2_ardour/export_dialog.h
index e15a21395e..d2cc5ec719 100644
--- a/gtk2_ardour/export_dialog.h
+++ b/gtk2_ardour/export_dialog.h
@@ -114,6 +114,8 @@ private:
void do_export ();
+ void maybe_set_session_dirty ();
+
void update_realtime_selection ();
void parameter_changed (std::string const&);
@@ -148,6 +150,8 @@ private:
float previous_progress; // Needed for gtk bug workaround
+ bool _initialized;
+
void soundcloud_upload_progress(double total, double now, std::string title);
/* Buttons */