diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-05-07 22:35:35 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-05-07 22:35:35 -0400 |
commit | f082e45298b55f58f91c98d687edadd686def624 (patch) | |
tree | 3337610caaae21f47e9b13ed1916ab1b7c55320d /libs/ardour/session_state.cc | |
parent | 0038820f473664a9a4fb524537cd846a9e024661 (diff) |
extend save-as API to allow for new empty sessions based on current
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r-- | libs/ardour/session_state.cc | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index a4492f0223..a387f5d8c0 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -658,7 +658,7 @@ Session::remove_state (string snapshot_name) /** @param snapshot_name Name to save under, without .ardour / .pending prefix */ int -Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot) +Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot, bool template_only) { XMLTree tree; std::string xml_path(_session_dir->root_path()); @@ -696,7 +696,11 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot SessionSaveUnderway (); /* EMIT SIGNAL */ - tree.set_root (&get_state()); + if (template_only) { + tree.set_root (&get_template()); + } else { + tree.set_root (&get_state()); + } if (snapshot_name.empty()) { snapshot_name = _current_snapshot_name; @@ -4209,16 +4213,19 @@ Session::save_as (SaveAs& saveas) copy_files (old, newdir); } - if (saveas.copy_media) { - - /* only needed if we are copying media, since the - * analysis data refers to media data - */ - - old = analysis_dir (); - if (Glib::file_test (old, Glib::FILE_TEST_EXISTS)) { - string newdir = Glib::build_filename (to_dir, "analysis"); - copy_files (old, newdir); + if (saveas.include_media) { + + if (saveas.copy_media) { + + /* only needed if we are copying media, since the + * analysis data refers to media data + */ + + old = analysis_dir (); + if (Glib::file_test (old, Glib::FILE_TEST_EXISTS)) { + string newdir = Glib::build_filename (to_dir, "analysis"); + copy_files (old, newdir); + } } } @@ -4227,7 +4234,7 @@ Session::save_as (SaveAs& saveas) _current_snapshot_name = saveas.new_name; _name = saveas.new_name; - if (!saveas.copy_media) { + if (saveas.include_media && !saveas.copy_media) { /* reset search paths of the new session (which we're pretending to be right now) to include the original session search path, so we can still find all audio. @@ -4246,7 +4253,7 @@ Session::save_as (SaveAs& saveas) bool was_dirty = dirty (); - save_state ("", false, false); + save_state ("", false, false, !saveas.include_media); save_default_options (); if (saveas.copy_media && saveas.copy_external) { @@ -4255,6 +4262,8 @@ Session::save_as (SaveAs& saveas) } } + saveas.final_session_folder_name = _path; + if (!saveas.switch_to) { /* switch back to the way things were */ |