2008-09-17 08:56:00 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2008-2012 Sakari Bergen <sakari.bergen@beatwaves.net>
|
|
|
|
* Copyright (C) 2008-2016 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2015-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2008-09-17 08:56:00 -04:00
|
|
|
|
2017-07-16 21:48:18 -04:00
|
|
|
#include <gtkmm/filechooserdialog.h>
|
2011-12-06 22:22:35 -05:00
|
|
|
#include <gtkmm/messagedialog.h>
|
2017-07-16 21:48:18 -04:00
|
|
|
#include <gtkmm/stock.h>
|
2011-12-06 22:22:35 -05:00
|
|
|
|
2016-06-01 17:54:54 -04:00
|
|
|
#include "pbd/openuri.h"
|
2019-01-02 11:37:03 -05:00
|
|
|
|
|
|
|
#include "gtkmm2ext/utils.h"
|
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
#include "export_filename_selector.h"
|
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2008-09-17 08:56:00 -04:00
|
|
|
|
|
|
|
using namespace ARDOUR;
|
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
ExportFilenameSelector::ExportFilenameSelector ()
|
|
|
|
: include_label ("", Gtk::ALIGN_LEFT)
|
|
|
|
, label_label (_("Label:"), Gtk::ALIGN_LEFT)
|
|
|
|
, timespan_checkbox (_("Timespan Name"))
|
|
|
|
, revision_checkbox (_("Revision:"))
|
|
|
|
, path_label (_("Folder:"), Gtk::ALIGN_LEFT)
|
|
|
|
, browse_button (_("Browse"))
|
|
|
|
, open_button (_("Open Folder"))
|
|
|
|
, example_filename_label ("", Gtk::ALIGN_LEFT)
|
|
|
|
, _require_timespan (false)
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
2016-02-12 07:17:46 -05:00
|
|
|
include_label.set_markup (_("Build filename(s) from these components:"));
|
2012-07-24 20:23:12 -04:00
|
|
|
|
2017-02-02 06:44:08 -05:00
|
|
|
session_snap_name.append_text (_("No Name"));
|
|
|
|
session_snap_name.append_text (_("Session Name"));
|
|
|
|
session_snap_name.append_text (_("Snapshot Name"));
|
|
|
|
session_snap_name.set_active (0);
|
|
|
|
|
2012-07-24 20:23:12 -04:00
|
|
|
pack_start (path_hbox, false, false, 12);
|
2008-09-17 08:56:00 -04:00
|
|
|
pack_start (include_label, false, false, 6);
|
|
|
|
pack_start (include_hbox, false, false, 0);
|
2012-07-24 20:23:12 -04:00
|
|
|
pack_start (example_filename_label, false, false, 12);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2017-02-02 06:44:08 -05:00
|
|
|
include_hbox.pack_start (session_snap_name, false, false, 3);
|
2008-09-17 08:56:00 -04:00
|
|
|
include_hbox.pack_start (label_label, false, false, 3);
|
|
|
|
include_hbox.pack_start (label_entry, false, false, 3);
|
|
|
|
include_hbox.pack_start (revision_checkbox, false, false, 3);
|
|
|
|
include_hbox.pack_start (revision_spinbutton, false, false, 3);
|
2016-02-12 14:19:31 -05:00
|
|
|
include_hbox.pack_start (timespan_checkbox, false, false, 3);
|
2016-02-11 14:53:32 -05:00
|
|
|
include_hbox.pack_start (date_format_combo, false, false, 3);
|
|
|
|
include_hbox.pack_start (time_format_combo, false, false, 3);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-02-15 20:08:25 -05:00
|
|
|
label_entry.set_activates_default ();
|
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
path_hbox.pack_start (path_label, false, false, 3);
|
|
|
|
path_hbox.pack_start (path_entry, true, true, 3);
|
|
|
|
path_hbox.pack_start (browse_button, false, false, 3);
|
2016-06-01 17:54:54 -04:00
|
|
|
path_hbox.pack_start (open_button, false, false, 3); // maybe Mixbus only ?
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-02-15 20:08:25 -05:00
|
|
|
path_entry.set_activates_default ();
|
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
label_sizegroup = Gtk::SizeGroup::create (Gtk::SIZE_GROUP_HORIZONTAL);
|
|
|
|
label_sizegroup->add_widget (label_label);
|
|
|
|
label_sizegroup->add_widget (path_label);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Date */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
date_format_list = Gtk::ListStore::create (date_format_cols);
|
|
|
|
date_format_combo.set_model (date_format_list);
|
|
|
|
date_format_combo.pack_start (date_format_cols.label);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
date_format_combo.signal_changed ().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_date_format));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Time */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
time_format_list = Gtk::ListStore::create (time_format_cols);
|
|
|
|
time_format_combo.set_model (time_format_list);
|
|
|
|
time_format_combo.pack_start (time_format_cols.label);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
time_format_combo.signal_changed ().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_time_format));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Revision */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
revision_spinbutton.set_digits (0);
|
|
|
|
revision_spinbutton.set_increments (1, 10);
|
|
|
|
revision_spinbutton.set_range (1, 1000);
|
|
|
|
revision_spinbutton.set_sensitive (false);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Signals */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
label_entry.signal_changed ().connect (sigc::mem_fun (*this, &ExportFilenameSelector::update_label));
|
|
|
|
path_entry.signal_changed ().connect (sigc::mem_fun (*this, &ExportFilenameSelector::update_folder));
|
|
|
|
path_entry.signal_activate ().connect (sigc::mem_fun (*this, &ExportFilenameSelector::check_folder), false);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
session_snap_name.signal_changed ().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_session_selection));
|
|
|
|
timespan_checkbox.signal_toggled ().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_timespan_selection));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
revision_checkbox.signal_toggled ().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_revision_selection));
|
|
|
|
revision_spinbutton.signal_value_changed ().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_revision_value));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
browse_button.signal_clicked ().connect (sigc::mem_fun (*this, &ExportFilenameSelector::open_browse_dialog));
|
|
|
|
open_button.signal_clicked ().connect (sigc::mem_fun (*this, &ExportFilenameSelector::open_folder));
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
ExportFilenameSelector::~ExportFilenameSelector ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ExportFilenameSelector::load_state ()
|
|
|
|
{
|
|
|
|
if (!filename) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
label_entry.set_text (filename->include_label ? filename->get_label () : "");
|
2017-02-02 06:44:08 -05:00
|
|
|
if (filename->include_session) {
|
|
|
|
if (filename->use_session_snapshot_name) {
|
|
|
|
session_snap_name.set_active (2);
|
|
|
|
} else {
|
|
|
|
session_snap_name.set_active (1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
session_snap_name.set_active (0);
|
|
|
|
}
|
2016-02-11 14:53:32 -05:00
|
|
|
timespan_checkbox.set_active (filename->include_timespan);
|
2008-09-17 08:56:00 -04:00
|
|
|
revision_checkbox.set_active (filename->include_revision);
|
2021-04-07 21:17:45 -04:00
|
|
|
revision_spinbutton.set_value (filename->get_revision ());
|
|
|
|
path_entry.set_text (filename->get_folder ());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Gtk::TreeModel::Children::iterator it;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
for (it = date_format_list->children ().begin (); it != date_format_list->children ().end (); ++it) {
|
|
|
|
if (it->get_value (date_format_cols.format) == filename->get_date_format ()) {
|
2008-09-17 08:56:00 -04:00
|
|
|
date_format_combo.set_active (it);
|
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
for (it = time_format_list->children ().begin (); it != time_format_list->children ().end (); ++it) {
|
|
|
|
if (it->get_value (time_format_cols.format) == filename->get_time_format ()) {
|
2008-09-17 08:56:00 -04:00
|
|
|
time_format_combo.set_active (it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-04-07 21:17:45 -04:00
|
|
|
ExportFilenameSelector::set_state (ARDOUR::ExportProfileManager::FilenameStatePtr state_, ARDOUR::Session* session_)
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
SessionHandlePtr::set_session (session_);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
filename = state_->filename;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Fill combo boxes */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Gtk::TreeModel::iterator iter;
|
2021-04-07 21:17:45 -04:00
|
|
|
Gtk::TreeModel::Row row;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Dates */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
date_format_list->clear ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
iter = date_format_list->append ();
|
|
|
|
row = *iter;
|
2008-09-17 08:56:00 -04:00
|
|
|
row[date_format_cols.format] = ExportFilename::D_None;
|
2021-04-07 21:17:45 -04:00
|
|
|
row[date_format_cols.label] = filename->get_date_format_str (ExportFilename::D_None);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
iter = date_format_list->append ();
|
|
|
|
row = *iter;
|
2008-09-17 08:56:00 -04:00
|
|
|
row[date_format_cols.format] = ExportFilename::D_ISO;
|
2021-04-07 21:17:45 -04:00
|
|
|
row[date_format_cols.label] = filename->get_date_format_str (ExportFilename::D_ISO);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
iter = date_format_list->append ();
|
|
|
|
row = *iter;
|
2008-09-17 08:56:00 -04:00
|
|
|
row[date_format_cols.format] = ExportFilename::D_ISOShortY;
|
2021-04-07 21:17:45 -04:00
|
|
|
row[date_format_cols.label] = filename->get_date_format_str (ExportFilename::D_ISOShortY);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
iter = date_format_list->append ();
|
|
|
|
row = *iter;
|
2008-09-17 08:56:00 -04:00
|
|
|
row[date_format_cols.format] = ExportFilename::D_BE;
|
2021-04-07 21:17:45 -04:00
|
|
|
row[date_format_cols.label] = filename->get_date_format_str (ExportFilename::D_BE);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
iter = date_format_list->append ();
|
|
|
|
row = *iter;
|
2008-09-17 08:56:00 -04:00
|
|
|
row[date_format_cols.format] = ExportFilename::D_BEShortY;
|
2021-04-07 21:17:45 -04:00
|
|
|
row[date_format_cols.label] = filename->get_date_format_str (ExportFilename::D_BEShortY);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Times */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
time_format_list->clear ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
iter = time_format_list->append ();
|
|
|
|
row = *iter;
|
2008-09-17 08:56:00 -04:00
|
|
|
row[time_format_cols.format] = ExportFilename::T_None;
|
2021-04-07 21:17:45 -04:00
|
|
|
row[time_format_cols.label] = filename->get_time_format_str (ExportFilename::T_None);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
iter = time_format_list->append ();
|
|
|
|
row = *iter;
|
2008-09-17 08:56:00 -04:00
|
|
|
row[time_format_cols.format] = ExportFilename::T_NoDelim;
|
2021-04-07 21:17:45 -04:00
|
|
|
row[time_format_cols.label] = filename->get_time_format_str (ExportFilename::T_NoDelim);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
iter = time_format_list->append ();
|
|
|
|
row = *iter;
|
2008-09-17 08:56:00 -04:00
|
|
|
row[time_format_cols.format] = ExportFilename::T_Delim;
|
2021-04-07 21:17:45 -04:00
|
|
|
row[time_format_cols.label] = filename->get_time_format_str (ExportFilename::T_Delim);
|
2008-09-17 08:56:00 -04:00
|
|
|
|
|
|
|
/* Load state */
|
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
load_state ();
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
|
2012-01-29 15:55:44 -05:00
|
|
|
void
|
|
|
|
ExportFilenameSelector::set_example_filename (std::string filename)
|
|
|
|
{
|
|
|
|
if (filename == "") {
|
2012-07-24 20:23:12 -04:00
|
|
|
example_filename_label.set_markup (_("<small><i>Sorry, no example filename can be shown at the moment</i></small>"));
|
2012-01-29 15:55:44 -05:00
|
|
|
} else {
|
2021-04-07 21:17:45 -04:00
|
|
|
example_filename_label.set_markup (string_compose (_("<i>Current (approximate) filename</i>: \"%1\""), filename));
|
2012-01-29 15:55:44 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
void
|
|
|
|
ExportFilenameSelector::update_label ()
|
|
|
|
{
|
|
|
|
if (!filename) {
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
filename->set_label (label_entry.get_text ());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
filename->include_label = !label_entry.get_text ().empty ();
|
|
|
|
CriticalSelectionChanged ();
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ExportFilenameSelector::update_folder ()
|
|
|
|
{
|
|
|
|
if (!filename) {
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
filename->set_folder (path_entry.get_text ());
|
|
|
|
CriticalSelectionChanged ();
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
|
2011-12-06 22:22:35 -05:00
|
|
|
void
|
|
|
|
ExportFilenameSelector::check_folder ()
|
|
|
|
{
|
|
|
|
if (!filename) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
if (!Glib::file_test (path_entry.get_text (), Glib::FILE_TEST_IS_DIR | Glib::FILE_TEST_EXISTS)) {
|
|
|
|
Gtk::MessageDialog msg (string_compose (_("%1: this is only the directory/folder name, not the filename.\n"
|
|
|
|
"The filename will be chosen from the information just above the folder selector."),
|
|
|
|
path_entry.get_text ()));
|
2011-12-06 22:22:35 -05:00
|
|
|
msg.run ();
|
2021-04-07 21:17:45 -04:00
|
|
|
path_entry.set_text (Glib::path_get_dirname (path_entry.get_text ()));
|
|
|
|
filename->set_folder (path_entry.get_text ());
|
|
|
|
CriticalSelectionChanged ();
|
2011-12-06 22:22:35 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
void
|
|
|
|
ExportFilenameSelector::change_date_format ()
|
|
|
|
{
|
|
|
|
if (!filename) {
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
DateFormat format = date_format_combo.get_active ()->get_value (date_format_cols.format);
|
2008-09-17 08:56:00 -04:00
|
|
|
filename->set_date_format (format);
|
2021-04-07 21:17:45 -04:00
|
|
|
CriticalSelectionChanged ();
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ExportFilenameSelector::change_time_format ()
|
|
|
|
{
|
|
|
|
if (!filename) {
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
TimeFormat format = time_format_combo.get_active ()->get_value (time_format_cols.format);
|
2008-09-17 08:56:00 -04:00
|
|
|
filename->set_time_format (format);
|
2021-04-07 21:17:45 -04:00
|
|
|
CriticalSelectionChanged ();
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
|
2016-02-11 14:53:32 -05:00
|
|
|
void
|
|
|
|
ExportFilenameSelector::require_timespan (bool r)
|
|
|
|
{
|
|
|
|
_require_timespan = r;
|
|
|
|
update_timespan_sensitivity ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ExportFilenameSelector::update_timespan_sensitivity ()
|
|
|
|
{
|
|
|
|
bool implicit = _require_timespan;
|
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
if (!implicit && !filename->include_session && !filename->include_label && !filename->include_revision && !filename->include_channel_config && !filename->include_channel && !filename->include_date && !filename->include_format_name) {
|
2016-02-11 14:53:32 -05:00
|
|
|
implicit = true;
|
|
|
|
}
|
2016-02-12 14:19:31 -05:00
|
|
|
|
|
|
|
// remember prev state, force enable if implicit active.
|
2021-04-07 21:17:45 -04:00
|
|
|
if (implicit && !timespan_checkbox.get_inconsistent ()) {
|
2016-02-12 14:19:31 -05:00
|
|
|
timespan_checkbox.set_inconsistent (true);
|
|
|
|
filename->include_timespan = true;
|
2021-04-07 21:17:45 -04:00
|
|
|
} else if (!implicit && timespan_checkbox.get_inconsistent ()) {
|
|
|
|
filename->include_timespan = timespan_checkbox.get_active ();
|
2016-02-12 14:19:31 -05:00
|
|
|
timespan_checkbox.set_inconsistent (false);
|
|
|
|
}
|
2016-02-11 14:53:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ExportFilenameSelector::change_timespan_selection ()
|
|
|
|
{
|
|
|
|
if (!filename) {
|
|
|
|
return;
|
|
|
|
}
|
2021-04-07 21:17:45 -04:00
|
|
|
if (timespan_checkbox.get_inconsistent ()) {
|
2016-02-12 14:19:31 -05:00
|
|
|
return;
|
|
|
|
}
|
2016-02-11 14:53:32 -05:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
filename->include_timespan = timespan_checkbox.get_active ();
|
|
|
|
CriticalSelectionChanged ();
|
2016-02-11 14:53:32 -05:00
|
|
|
}
|
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
void
|
|
|
|
ExportFilenameSelector::change_session_selection ()
|
|
|
|
{
|
|
|
|
if (!filename) {
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2017-02-02 06:44:08 -05:00
|
|
|
switch (session_snap_name.get_active_row_number ()) {
|
|
|
|
case 1:
|
2021-04-07 21:17:45 -04:00
|
|
|
filename->include_session = true;
|
2017-02-02 06:44:08 -05:00
|
|
|
filename->use_session_snapshot_name = false;
|
|
|
|
break;
|
|
|
|
case 2:
|
2021-04-07 21:17:45 -04:00
|
|
|
filename->include_session = true;
|
2017-02-02 06:44:08 -05:00
|
|
|
filename->use_session_snapshot_name = true;
|
|
|
|
break;
|
|
|
|
default:
|
2021-04-07 21:17:45 -04:00
|
|
|
filename->include_session = false;
|
2017-02-02 06:44:08 -05:00
|
|
|
filename->use_session_snapshot_name = false;
|
|
|
|
break;
|
|
|
|
}
|
2021-04-07 21:17:45 -04:00
|
|
|
CriticalSelectionChanged ();
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ExportFilenameSelector::change_revision_selection ()
|
|
|
|
{
|
|
|
|
if (!filename) {
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
bool selected = revision_checkbox.get_active ();
|
2008-09-17 08:56:00 -04:00
|
|
|
filename->include_revision = selected;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
revision_spinbutton.set_sensitive (selected);
|
2021-04-07 21:17:45 -04:00
|
|
|
CriticalSelectionChanged ();
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ExportFilenameSelector::change_revision_value ()
|
|
|
|
{
|
|
|
|
if (!filename) {
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
filename->set_revision ((uint32_t)revision_spinbutton.get_value_as_int ());
|
|
|
|
CriticalSelectionChanged ();
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
|
2016-06-01 17:54:54 -04:00
|
|
|
void
|
|
|
|
ExportFilenameSelector::open_folder ()
|
|
|
|
{
|
2021-04-07 21:17:45 -04:00
|
|
|
const std::string& dir (path_entry.get_text ());
|
|
|
|
if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR | Glib::FILE_TEST_EXISTS)) {
|
2016-06-01 17:54:54 -04:00
|
|
|
Gtk::MessageDialog msg (string_compose (_("%1: this is not a valid directory/folder."), dir));
|
|
|
|
msg.run ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
PBD::open_folder (dir);
|
|
|
|
}
|
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
void
|
|
|
|
ExportFilenameSelector::open_browse_dialog ()
|
|
|
|
{
|
2021-04-07 21:17:45 -04:00
|
|
|
Gtk::FileChooserDialog dialog (_("Choose export folder"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
2019-01-02 11:37:03 -05:00
|
|
|
Gtkmm2ext::add_volume_shortcuts (dialog);
|
2008-09-17 08:56:00 -04:00
|
|
|
//dialog.set_transient_for(*this);
|
2021-04-07 21:17:45 -04:00
|
|
|
dialog.set_filename (path_entry.get_text ());
|
2008-09-17 08:56:00 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
dialog.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
|
|
|
dialog.add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK);
|
2008-09-17 08:56:00 -04:00
|
|
|
|
2011-12-06 22:22:35 -05:00
|
|
|
while (true) {
|
2021-04-07 21:17:45 -04:00
|
|
|
int result = dialog.run ();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-12-06 22:22:35 -05:00
|
|
|
if (result == Gtk::RESPONSE_OK) {
|
2021-04-07 21:17:45 -04:00
|
|
|
std::string filename = dialog.get_filename ();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
if (!Glib::file_test (filename, Glib::FILE_TEST_IS_DIR | Glib::FILE_TEST_EXISTS)) {
|
|
|
|
Gtk::MessageDialog msg (string_compose (_("%1: this is only the directory/folder name, not the filename.\n"
|
|
|
|
"The filename will be chosen from the information just above the folder selector."),
|
|
|
|
filename));
|
2011-12-06 22:22:35 -05:00
|
|
|
msg.run ();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
if (filename.length ()) {
|
2011-12-06 22:22:35 -05:00
|
|
|
path_entry.set_text (filename);
|
|
|
|
break;
|
|
|
|
}
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
2015-09-27 07:55:20 -04:00
|
|
|
break;
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2021-04-07 21:17:45 -04:00
|
|
|
CriticalSelectionChanged ();
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|