summaryrefslogtreecommitdiff
path: root/libs/ardour/session_state.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-11-20 03:10:57 +0100
committerRobin Gareus <robin@gareus.org>2015-11-20 03:22:41 +0100
commitc4084932fab7ceb32a7a62ec5206fff18173dc1f (patch)
treed564582c25076547417c555ab8ae57340c21cbbc /libs/ardour/session_state.cc
parent489622bdb6346c81f75d03feaa3cf114d78ecf0b (diff)
remember in-use snapshot/session name in instant.xml
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r--libs/ardour/session_state.cc34
1 files changed, 29 insertions, 5 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 0cbb550d02..9e8f8dcf2d 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -807,8 +807,8 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot
if (snapshot_name.empty()) {
snapshot_name = _current_snapshot_name;
} else if (switch_to_snapshot) {
- _current_snapshot_name = snapshot_name;
- }
+ set_snapshot_name (snapshot_name);
+ }
assert (!snapshot_name.empty());
@@ -982,6 +982,8 @@ Session::load_state (string snapshot_name)
}
}
+ save_snapshot_name (snapshot_name);
+
return 0;
}
@@ -1459,6 +1461,7 @@ Session::set_state (const XMLNode& node, int version)
update_route_record_state ();
/* here beginneth the second phase ... */
+ set_snapshot_name (_current_snapshot_name);
StateReady (); /* EMIT SIGNAL */
@@ -3910,6 +3913,27 @@ Session::solo_cut_control() const
return _solo_cut_control;
}
+void
+Session::save_snapshot_name (const std::string & n)
+{
+ /* assure Stateful::_instant_xml is loaded
+ * add_instant_xml() only adds to existing data and defaults
+ * to use an empty Tree otherwise
+ */
+ instant_xml ("LastUsedSnapshot");
+
+ XMLNode* last_used_snapshot = new XMLNode ("LastUsedSnapshot");
+ last_used_snapshot->add_property ("name", string(n));
+ add_instant_xml (*last_used_snapshot, false);
+}
+
+void
+Session::set_snapshot_name (const std::string & n)
+{
+ _current_snapshot_name = n;
+ save_snapshot_name (n);
+}
+
int
Session::rename (const std::string& new_name)
{
@@ -4111,7 +4135,7 @@ Session::rename (const std::string& new_name)
}
}
- _current_snapshot_name = new_name;
+ set_snapshot_name (new_name);
_name = new_name;
set_dirty ();
@@ -4607,7 +4631,7 @@ Session::save_as (SaveAs& saveas)
_path = to_dir;
- _current_snapshot_name = saveas.new_name;
+ set_snapshot_name (saveas.new_name);
_name = saveas.new_name;
if (saveas.include_media && !saveas.copy_media) {
@@ -4650,7 +4674,7 @@ Session::save_as (SaveAs& saveas)
_path = old_path;
_name = old_name;
- _current_snapshot_name = old_snapshot;
+ set_snapshot_name (old_snapshot);
(*_session_dir) = old_sd;