13
0

Add Pref to write mixer-screenshot post-export

This commit is contained in:
Robin Gareus 2019-08-12 16:53:55 +02:00
parent f7a6661969
commit d67d64ea03
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 47 additions and 2 deletions

View File

@ -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);

View File

@ -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")));

View File

@ -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)