summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorSampo Savolainen <v2@iki.fi>2006-03-21 18:40:17 +0000
committerSampo Savolainen <v2@iki.fi>2006-03-21 18:40:17 +0000
commitd63c0fa328429ff0d7917fe3f4458c97063ba450 (patch)
tree96518551baaaaf031eeffd3d409d3d8ce17e11ee /libs
parentff5f86778484538331a6c538cc0b4eff4cbc153d (diff)
Various marker undo fixes.
git-svn-id: svn://localhost/trunk/ardour2@413 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/tempo.cc28
1 files changed, 27 insertions, 1 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index 24c234552c..5d6365cff3 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -1250,7 +1250,16 @@ TempoMap::set_state (const XMLNode& node)
in_set_state = false;
}
+
+ /* This state needs to be saved. This string will never be a part of the
+ object's history though, because the allow_save flag is false during
+ session load. This state will eventually be tagged "initial state",
+ by a call to StateManager::allow_save from Session::set_state.
+ If this state is not saved, there is no way to reach it through undo actions.
+ */
+ save_state(_("load XML data"));
+
send_state_changed (Change (0));
return 0;
@@ -1287,7 +1296,24 @@ TempoMap::restore_state (StateManager::State& state)
TempoMapState* tmstate = dynamic_cast<TempoMapState*> (&state);
- metrics = tmstate->metrics;
+ /* We can't just set the metrics pointer to the address of the metrics list
+ stored in the state, cause this would ruin this state for restoring in
+ the future. If they have the same address, they are the same list.
+ Thus we need to copy all the elements from the state metrics list to the
+ current metrics list.
+ */
+ metrics->clear();
+ for (Metrics::iterator i = tmstate->metrics->begin(); i != tmstate->metrics->end(); ++i) {
+ TempoSection *ts;
+ MeterSection *ms;
+
+ if ((ts = dynamic_cast<TempoSection*>(*i)) != 0) {
+ metrics->push_back (new TempoSection (*ts));
+ } else if ((ms = dynamic_cast<MeterSection*>(*i)) != 0) {
+ metrics->push_back (new MeterSection (*ms));
+ }
+ }
+
last_bbt_valid = false;
return Change (0);