summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-08-12 16:53:55 +0200
committerRobin Gareus <robin@gareus.org>2019-08-12 16:53:55 +0200
commitd67d64ea03c4e722b1c50b4019b989b09a8ff1de (patch)
tree4b88739b1bd29896a431294e70b429697cbc7967
parentf7a66619699ab2cd9361384bbc740418f411807a (diff)
Add Pref to write mixer-screenshot post-export
-rw-r--r--gtk2_ardour/export_dialog.cc38
-rw-r--r--gtk2_ardour/rc_option_editor.cc10
-rw-r--r--gtk2_ardour/ui_config_vars.h1
3 files changed, 47 insertions, 2 deletions
diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc
index e366af03d2..cc19965a9c 100644
--- a/gtk2_ardour/export_dialog.cc
+++ b/gtk2_ardour/export_dialog.cc
@@ -31,8 +31,12 @@
#include <gtkmm/messagedialog.h>
#include <gtkmm/stock.h>
+#include "pbd/gstdio_compat.h"
+#include "pbd/file_utils.h"
+
#include "ardour/audioregion.h"
#include "ardour/export_channel_configuration.h"
+#include "ardour/export_format_specification.h"
#include "ardour/export_status.h"
#include "ardour/export_handler.h"
#include "ardour/profile.h"
@@ -40,7 +44,9 @@
#include "export_dialog.h"
#include "export_report.h"
#include "gui_thread.h"
+#include "mixer_ui.h"
#include "nag.h"
+#include "ui_config.h"
#include "pbd/i18n.h"
@@ -52,7 +58,6 @@ ExportDialog::ExportDialog (PublicEditor & editor, std::string title, ARDOUR::Ex
: ArdourDialog (title)
, type (type)
, editor (editor)
-
, warn_label ("", Gtk::ALIGN_LEFT)
, list_files_label (_("<span color=\"#ffa755\">Some already existing files will be overwritten.</span>"), Gtk::ALIGN_RIGHT)
, list_files_button (_("List files"))
@@ -380,6 +385,37 @@ ExportDialog::show_progress ()
status->finish ();
+ if (!status->aborted() && UIConfiguration::instance().get_save_export_mixer_screenshot ()) {
+ ExportProfileManager::TimespanStateList const& timespans = profile_manager->get_timespans();
+ ExportProfileManager::FilenameStateList const& filenames = profile_manager->get_filenames ();
+
+ std::list<std::string> paths;
+ for (ExportProfileManager::FilenameStateList::const_iterator fi = filenames.begin(); fi != filenames.end(); ++fi) {
+ for (ExportProfileManager::TimespanStateList::const_iterator ti = timespans.begin(); ti != timespans.end(); ++ti) {
+ ExportProfileManager::TimespanListPtr tlp = (*ti)->timespans;
+ for (ExportProfileManager::TimespanList::const_iterator eti = tlp->begin(); eti != tlp->end(); ++eti) {
+ (*fi)->filename->set_timespan (*eti);
+ paths.push_back ((*fi)->filename->get_path (ExportFormatSpecPtr ()) + "-mixer.png");
+ }
+ }
+ }
+
+ if (paths.size() > 0) {
+ PBD::info << string_compose(_("Writing Mixer Screenshot: %1."), paths.front()) << endmsg;
+ Mixer_UI::instance()->screenshot (paths.front());
+
+ std::list<std::string>::const_iterator it = paths.begin ();
+ ++it;
+ for (; it != paths.end(); ++it) {
+ PBD::info << string_compose(_("Copying Mixer Screenshot: %1."), *it) << endmsg;
+ ::g_unlink (it->c_str());
+ if (!hard_link (paths.front(), *it)) {
+ copy_file (paths.front(), *it);
+ }
+ }
+ }
+ }
+
if (!status->aborted() && status->result_map.size() > 0) {
hide();
ExportReport er (_session, status);
diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc
index ca2d1c8d06..de2e24f7e3 100644
--- a/gtk2_ardour/rc_option_editor.cc
+++ b/gtk2_ardour/rc_option_editor.cc
@@ -3085,11 +3085,19 @@ RCOptionEditor::RCOptionEditor ()
add_option (S_("Preferences|Metering"),
new BoolOption (
"save-export-analysis-image",
- _("Save loudness analysis as image file"),
+ _("Save loudness analysis as image file after export"),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_save_export_analysis_image),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_save_export_analysis_image)
));
+ add_option (S_("Preferences|Metering"),
+ new BoolOption (
+ "save-export-mixer-screenshot",
+ _("Save Mixer screenshot after export"),
+ sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_save_export_mixer_screenshot),
+ sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_save_export_mixer_screenshot)
+ ));
+
/* TRANSPORT & Sync */
add_option (_("Transport"), new OptionEditorHeading (_("General")));
diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h
index a84241648d..70d332ab21 100644
--- a/gtk2_ardour/ui_config_vars.h
+++ b/gtk2_ardour/ui_config_vars.h
@@ -106,6 +106,7 @@ UI_CONFIG_VARIABLE (bool, cairo_image_surface, "cairo-image-surface", false)
UI_CONFIG_VARIABLE (uint64_t, waveform_cache_size, "waveform-cache-size", 100) /* units of megagbytes */
UI_CONFIG_VARIABLE (int32_t, recent_session_sort, "recent-session-sort", 0)
UI_CONFIG_VARIABLE (bool, save_export_analysis_image, "save-export-analysis-image", false)
+UI_CONFIG_VARIABLE (bool, save_export_mixer_screenshot, "save-export-mixer-screenshot", false)
UI_CONFIG_VARIABLE (bool, open_gui_after_adding_plugin, "open-gui-after-adding-plugin", true)
UI_CONFIG_VARIABLE (bool, show_inline_display_by_default, "show-inline-display-by-default", true)
UI_CONFIG_VARIABLE (bool, prefer_inline_over_gui, "prefer-inline-over-gui", true)