diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-05-07 22:36:32 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-05-07 22:36:32 -0400 |
commit | 4c92de0159d5d4ed2a815a55d5756a56ff0326d0 (patch) | |
tree | 578e7abfda0df5dedec3d2cc8cbc46ca66d36305 /gtk2_ardour | |
parent | 318c919c41b2a1bc77e0e851dc3ada72606f67e6 (diff) |
extend save-as dialog to allow crude but functional save-as-to-empty-session
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/save_as_dialog.cc | 38 | ||||
-rw-r--r-- | gtk2_ardour/save_as_dialog.h | 3 |
3 files changed, 46 insertions, 3 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 71901437c2..941d0ac119 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -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. diff --git a/gtk2_ardour/save_as_dialog.cc b/gtk2_ardour/save_as_dialog.cc index b537f85c1a..f696d131eb 100644 --- a/gtk2_ardour/save_as_dialog.cc +++ b/gtk2_ardour/save_as_dialog.cc @@ -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,6 +82,8 @@ 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)); @@ -75,6 +91,18 @@ SaveAsDialog::SaveAsDialog () } 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 () { if (!new_name_entry.get_text().empty()) { @@ -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 (); +} diff --git a/gtk2_ardour/save_as_dialog.h b/gtk2_ardour/save_as_dialog.h index 5ba522b318..75751f8831 100644 --- a/gtk2_ardour/save_as_dialog.h +++ b/gtk2_ardour/save_as_dialog.h @@ -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__ */ |