From: Paul Davis Date: Mon, 20 Apr 2015 19:10:41 +0000 (-0400) Subject: Merge branch 'master' into saveas X-Git-Tag: 4.1~439 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=ced4378d0914bcfb926267772c45d1d23f3bed38;p=ardour.git Merge branch 'master' into saveas Conflicts: gtk2_ardour/ardour.menus.in libs/ardour/session_state.cc --- ced4378d0914bcfb926267772c45d1d23f3bed38 diff --cc gtk2_ardour/ardour.menus.in index 09e870632b,b081b58342..3364557000 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@@ -8,9 -8,10 +8,11 @@@ + #ifndef WINDOWS // can't move open files. + + + #endif - diff --cc gtk2_ardour/ardour_ui.h index f5e8972a70,e80761cf32..6cce503511 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@@ -609,10 -612,8 +616,10 @@@ class ARDOUR_UI : public Gtkmm2ext::UI guint32 last_key_press_time; void snapshot_session (bool switch_to_it); + bool save_as_progress_update (float fraction, int64_t cnt, int64_t total, Gtk::Label* label, Gtk::ProgressBar* bar); + void save_session_as (); void rename_session (); - void setup_order_hint (); + void setup_order_hint (AddRouteDialog::InsertAt); int create_mixer (); int create_editor (); diff --cc gtk2_ardour/ardour_ui_ed.cc index 875d1b4d31,ccd048d69d..7c3db7a7e3 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@@ -138,10 -138,10 +138,10 @@@ ARDOUR_UI::install_actions ( 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); diff --cc libs/ardour/session_state.cc index fd4fe0a89f,3f1fd7bf7c..3ab6ff09b5 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@@ -3635,42 -3649,40 +3662,44 @@@ Session::rename (const std::string& new * already exist ... */ - vector new_session_dirs; - - for (vector::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) { - vector 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::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::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) { + first = false; + + for (vector::iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) { ++ vector v; oldstr = (*i).path; @@@ -3684,45 -3696,31 +3713,46 @@@ 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); @@@ -3769,12 -3767,23 +3799,24 @@@ } } - /* update file source paths */ - - for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) { - boost::shared_ptr fs = boost::dynamic_pointer_cast (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 fs = boost::dynamic_pointer_cast (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;