sigc::mem_fun (*this, &ARDOUR_UI::remove_video));
act->set_sensitive (false);
act = ActionManager::register_action (main_actions, X_("ExportVideo"), _("Export To Video File"),
- hide_return (sigc::bind (sigc::mem_fun(*editor, &PublicEditor::export_video), false)));
+ hide_return (sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::export_video), false)));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (main_actions, X_("Snapshot"), _("Snapshot..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::snapshot_session), false));
+ act = ActionManager::register_action (main_actions, X_("SnapshotStay"), _("Snapshot (& keep working on current version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::snapshot_session), false));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::write_sensitive_actions.push_back (act);
* already exist ...
*/
- vector<space_and_path> new_session_dirs;
-
- for (vector<space_and_path>::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) {
- vector<string> v;
-
- oldstr = (*i).path;
-
- /* this is a stupid hack because Glib::path_get_dirname() is
- * lexical-only, and so passing it /a/b/c/ gives a different
- * result than passing it /a/b/c ...
- */
+ if (!after_copy) {
+
- if (oldstr[oldstr.length()-1] == G_DIR_SEPARATOR) {
- oldstr = oldstr.substr (0, oldstr.length() - 1);
- }
-
- string base = Glib::path_get_dirname (oldstr);
- string p = Glib::path_get_basename (oldstr);
+ for (vector<space_and_path>::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) {
+
+ if (first) {
+ /* primary session directory */
+ newstr = _path;
+ first = false;
+ } else {
+ oldstr = (*i).path;
+
+ /* this is a stupid hack because Glib::path_get_dirname() is
+ * lexical-only, and so passing it /a/b/c/ gives a different
+ * result than passing it /a/b/c ...
+ */
+
+ if (oldstr[oldstr.length()-1] == G_DIR_SEPARATOR) {
+ oldstr = oldstr.substr (0, oldstr.length() - 1);
+ }
- newstr = Glib::build_filename (base, legal_name);
-
- if (Glib::file_test (newstr, Glib::FILE_TEST_EXISTS)) {
- return -1;
+ string base = Glib::path_get_dirname (oldstr);
+ string p = Glib::path_get_basename (oldstr);
+
+ newstr = Glib::build_filename (base, legal_name);
+ }
+
+ if (Glib::file_test (newstr, Glib::FILE_TEST_EXISTS)) {
+ return -1;
+ }
}
-
- space_and_path sp;
- sp.path = newstr;
- sp.blocks = 0; // not needed
- new_session_dirs.push_back(sp);
}
/* Session dirs */
- for (vector<space_and_path>::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) {
+ first = false;
+
+ for (vector<space_and_path>::iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) {
++
vector<string> v;
oldstr = (*i).path;
oldstr = oldstr.substr (0, oldstr.length() - 1);
}
- string base = Glib::path_get_dirname (oldstr);
- string p = Glib::path_get_basename (oldstr);
-
- newstr = Glib::build_filename (base, legal_name);
-
- cerr << "Rename " << oldstr << " => " << newstr << endl;
+ if (first) {
+ newstr = _path;
+ } else {
+ string base = Glib::path_get_dirname (oldstr);
+ newstr = Glib::build_filename (base, legal_name);
+ }
- if (::g_rename (oldstr.c_str(), newstr.c_str()) != 0) {
- error << string_compose (_("renaming %1 as %2 failed (%3)"), oldstr, newstr, g_strerror (errno)) << endmsg;
- return 1;
+ if (!after_copy) {
+ cerr << "Rename " << oldstr << " => " << newstr << endl;
+ if (::g_rename (oldstr.c_str(), newstr.c_str()) != 0) {
+ error << string_compose (_("renaming %s as %2 failed (%3)"), oldstr, newstr, g_strerror (errno)) << endmsg;
+ return 1;
+ }
}
-
+ /* Reset path in "session dirs" */
+
+ (*i).path = newstr;
++ (*i).blocks = 0;
++
+ /* reset primary SessionDirectory object */
+
if (first) {
(*_session_dir) = newstr;
- newpath = newstr;
- first = 1;
+ new_path = newstr;
+ first = false;
}
- /* directory below interchange */
+ /* now rename directory below session_dir/interchange */
- v.push_back (newstr);
+ string old_interchange_dir;
+ string new_interchange_dir;
+
+ /* use newstr here because we renamed the path that used to be oldstr to newstr above */
-
++
+ v.push_back (newstr);
v.push_back (interchange_dir_name);
- v.push_back (p);
+ v.push_back (Glib::path_get_basename (oldstr));
- oldstr = Glib::build_filename (v);
+ old_interchange_dir = Glib::build_filename (v);
v.clear ();
v.push_back (newstr);
}
}
- /* update file source paths */
-
- for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) {
- boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource> (i->second);
- if (fs) {
- string p = fs->path ();
- boost::replace_all (p, old_sources_root, _session_dir->sources_root());
- fs->set_path (p);
- SourceFactory::setup_peakfile(i->second, true);
+ if (!after_copy) {
+ /* remove old name from recent sessions */
+ remove_recent_sessions (_path);
+ _path = new_path;
++
++ /* update file source paths */
++
++ for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) {
++ boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource> (i->second);
++ if (fs) {
++ string p = fs->path ();
++ boost::replace_all (p, old_sources_root, _session_dir->sources_root());
++ fs->set_path (p);
++ SourceFactory::setup_peakfile(i->second, true);
++ }
+ }
}
- /* remove old name from recent sessions */
-
- remove_recent_sessions (_path);
-
- _path = newpath;
_current_snapshot_name = new_name;
_name = new_name;