summaryrefslogtreecommitdiff
path: root/libs/ardour/location.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-04-18 23:58:43 +0000
committerCarl Hetherington <carl@carlh.net>2010-04-18 23:58:43 +0000
commit0a40e0be86910a7a7d0eccb71f7b935a429ffa70 (patch)
tree699839cb23650aa6702995fc3153c7f8ce53c122 /libs/ardour/location.cc
parente4258dcaf90f514a68c6dd59067c9f623f08e973 (diff)
Load 2.X sessions correctly with newly-arranged session start/end markers.
git-svn-id: svn://localhost/ardour2/branches/3.0@6933 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/location.cc')
-rw-r--r--libs/ardour/location.cc43
1 files changed, 40 insertions, 3 deletions
diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc
index ec2059a41f..d3fc3b0d41 100644
--- a/libs/ardour/location.cc
+++ b/libs/ardour/location.cc
@@ -655,7 +655,7 @@ Locations::get_state ()
}
int
-Locations::set_state (const XMLNode& node, int /*version*/)
+Locations::set_state (const XMLNode& node, int version)
{
if (node.name() != "Locations") {
error << _("incorrect XML mode passed to Locations::set_state") << endmsg;
@@ -667,6 +667,12 @@ Locations::set_state (const XMLNode& node, int /*version*/)
locations.clear ();
current_location = 0;
+ Location* session_range_location = 0;
+ if (version < 3000) {
+ session_range_location = new Location (0, 0, _("session"), Location::IsSessionRange);
+ locations.push_back (session_range_location);
+ }
+
{
Glib::Mutex::Lock lm (lock);
@@ -676,7 +682,39 @@ Locations::set_state (const XMLNode& node, int /*version*/)
try {
Location *loc = new Location (**niter);
- locations.push_back (loc);
+
+ bool add = true;
+
+ if (version < 3000) {
+ /* look for old-style IsStart / IsEnd properties in this location;
+ if they are present, update the session_range_location accordingly
+ */
+ XMLProperty const * prop = (*niter)->property ("flags");
+ if (prop) {
+ string v = prop->value ();
+ while (1) {
+ string::size_type const c = v.find_first_of (',');
+ string const s = v.substr (0, c);
+ if (s == X_("IsStart")) {
+ session_range_location->set_start (loc->start());
+ add = false;
+ } else if (s == X_("IsEnd")) {
+ session_range_location->set_end (loc->start());
+ add = false;
+ }
+
+ if (c == string::npos) {
+ break;
+ }
+
+ v = v.substr (c + 1);
+ }
+ }
+ }
+
+ if (add) {
+ locations.push_back (loc);
+ }
}
catch (failed_constructor& err) {
@@ -685,7 +723,6 @@ Locations::set_state (const XMLNode& node, int /*version*/)
}
if (locations.size()) {
-
current_location = locations.front();
} else {
current_location = 0;