Merge branch 'master' into saveas
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 20 Apr 2015 19:10:41 +0000 (15:10 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 20 Apr 2015 19:10:41 +0000 (15:10 -0400)
Conflicts:
gtk2_ardour/ardour.menus.in
libs/ardour/session_state.cc

1  2 
gtk2_ardour/ardour.menus.in
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui_ed.cc
libs/ardour/ardour/session.h
libs/ardour/session_state.cc

index 09e870632b37f3a89317e4106ddd2fb4c9f5c557,b081b58342f388582324ed35badfc348aa6e9874..33645570004f58b25522f04fe7873b45f91c9ee0
@@@ -8,9 -8,10 +8,11 @@@
        <separator/>
        <menuitem action='Save'/>
        <menuitem action='SaveAs'/>
+ #ifndef WINDOWS // can't move open files.
        <menuitem action='Rename'/>
 -      <menuitem action='Snapshot'/>
 +      <menuitem action='SnapshotStay'/>
 +      <menuitem action='SnapshotSwitch'/>
+ #endif
        <menuitem action='SaveTemplate'/>
        <menu name='Metadata' action='Metadata'>
          <menuitem action='EditMetadata'/>
Simple merge
index f5e8972a7080d5685befdff6f301561d7af66e3f,e80761cf32d98b78141b11b07a0b7f09ab29fe98..6cce503511a92a9a4398c31bf20f29da59b506f7
@@@ -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 ();
index 875d1b4d31972e9e26a392da6aec9fa3b6d979eb,ccd048d69d69286f12e343a322d0967c9c49db9c..7c3db7a7e3d6bab572dc6bf46c497e8dd250cb4e
@@@ -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);
  
Simple merge
index fd4fe0a89f655838353635072288a42350319680,3f1fd7bf7c5141b11df3dd7965cdc4d1f183a801..3ab6ff09b579fc0089188981bc79c7eb004bb4c8
@@@ -3635,42 -3649,40 +3662,44 @@@ Session::rename (const std::string& new
         * 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;