extend save-as dialog to allow crude but functional save-as-to-empty-session
This commit is contained in:
parent
318c919c41
commit
4c92de0159
@ -2445,7 +2445,8 @@ ARDOUR_UI::save_session_as ()
|
||||
sa.switch_to = save_as_dialog->switch_to();
|
||||
sa.copy_media = save_as_dialog->copy_media();
|
||||
sa.copy_external = save_as_dialog->copy_external();
|
||||
|
||||
sa.include_media = save_as_dialog->include_media ();
|
||||
|
||||
/* this signal will be emitted from within this, the calling thread,
|
||||
* after every file is copied. It provides information on percentage
|
||||
* complete (in terms of total data to copy), the number of files
|
||||
@ -2464,6 +2465,11 @@ ARDOUR_UI::save_session_as ()
|
||||
MessageDialog msg (string_compose (_("Save As failed: %1"), sa.failure_message));
|
||||
msg.run ();
|
||||
}
|
||||
|
||||
if (!sa.include_media) {
|
||||
unload_session (false);
|
||||
load_session (sa.final_session_folder_name, sa.new_name);
|
||||
}
|
||||
}
|
||||
|
||||
/** Ask the user for the name of a new snapshot and then take it.
|
||||
|
@ -34,6 +34,7 @@ SaveAsDialog::SaveAsDialog ()
|
||||
, switch_to_button (_("Switch to newly-saved version"))
|
||||
, copy_media_button (_("Copy media to new session"))
|
||||
, copy_external_button (_("Copy external media into new session"))
|
||||
, no_include_media_button (_("Newly-saved session should be empty"))
|
||||
{
|
||||
VBox* vbox = get_vbox();
|
||||
|
||||
@ -57,9 +58,22 @@ SaveAsDialog::SaveAsDialog ()
|
||||
vbox->pack_start (*hbox, false, false);
|
||||
|
||||
vbox->pack_start (switch_to_button, false, false);
|
||||
vbox->pack_start (copy_media_button, false, false);
|
||||
vbox->pack_start (copy_external_button, false, false);
|
||||
|
||||
VBox* sub_vbox = manage (new VBox);
|
||||
HBox* sub_hbox = manage (new HBox);
|
||||
HBox* empty = manage (new HBox);
|
||||
|
||||
sub_vbox->pack_start (copy_media_button, false, false);
|
||||
sub_vbox->pack_start (copy_external_button, false, false);
|
||||
|
||||
/* indent the two media-related buttons by some amount */
|
||||
sub_hbox->set_spacing (24);
|
||||
sub_hbox->pack_start (*empty, false, false);
|
||||
sub_hbox->pack_start (*sub_vbox, false, false);
|
||||
|
||||
vbox->pack_start (no_include_media_button, false, false);
|
||||
vbox->pack_start (*sub_hbox, false, false);
|
||||
|
||||
switch_to_button.set_active (true);
|
||||
copy_media_button.set_active (true);
|
||||
|
||||
@ -68,12 +82,26 @@ SaveAsDialog::SaveAsDialog ()
|
||||
add_button (Stock::CANCEL, RESPONSE_CANCEL);
|
||||
add_button (Stock::OK, RESPONSE_OK);
|
||||
|
||||
no_include_media_button.signal_toggled ().connect (sigc::mem_fun (*this, &SaveAsDialog::no_include_toggled));
|
||||
|
||||
new_parent_folder_selector.set_action (FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
||||
new_parent_folder_selector.set_current_folder (Glib::get_home_dir());
|
||||
new_name_entry.signal_changed().connect (sigc::mem_fun (*this, &SaveAsDialog::name_entry_changed));
|
||||
set_response_sensitive (RESPONSE_OK, false);
|
||||
}
|
||||
|
||||
void
|
||||
SaveAsDialog::no_include_toggled ()
|
||||
{
|
||||
if (no_include_media_button.get_active()) {
|
||||
copy_media_button.set_sensitive (false);
|
||||
copy_external_button.set_sensitive (false);
|
||||
} else {
|
||||
copy_media_button.set_sensitive (true);
|
||||
copy_external_button.set_sensitive (true);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SaveAsDialog::name_entry_changed ()
|
||||
{
|
||||
@ -118,3 +146,9 @@ SaveAsDialog::clear_name ()
|
||||
new_name_entry.set_text ("");
|
||||
set_response_sensitive (RESPONSE_OK, false);
|
||||
}
|
||||
|
||||
bool
|
||||
SaveAsDialog::include_media () const
|
||||
{
|
||||
return !no_include_media_button.get_active ();
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
std::string new_name () const;
|
||||
|
||||
bool switch_to () const;
|
||||
bool include_media () const;
|
||||
bool copy_media () const;
|
||||
bool copy_external () const;
|
||||
|
||||
@ -44,10 +45,12 @@ private:
|
||||
Gtk::CheckButton switch_to_button;
|
||||
Gtk::CheckButton copy_media_button;
|
||||
Gtk::CheckButton copy_external_button;
|
||||
Gtk::CheckButton no_include_media_button;
|
||||
Gtk::FileChooserButton new_parent_folder_selector;
|
||||
Gtk::Entry new_name_entry;
|
||||
|
||||
void name_entry_changed ();
|
||||
void no_include_toggled ();
|
||||
};
|
||||
|
||||
#endif /* __ardour_gtk_tempo_dialog_h__ */
|
||||
|
Loading…
Reference in New Issue
Block a user