summaryrefslogtreecommitdiff
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
parentff5f86778484538331a6c538cc0b4eff4cbc153d (diff)
Various marker undo fixes.
git-svn-id: svn://localhost/trunk/ardour2@413 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/editor_markers.cc6
-rw-r--r--gtk2_ardour/editor_mouse.cc10
-rw-r--r--libs/ardour/tempo.cc28
3 files changed, 43 insertions, 1 deletions
diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc
index d933357685..e611b72d3f 100644
--- a/gtk2_ardour/editor_markers.cc
+++ b/gtk2_ardour/editor_markers.cc
@@ -810,7 +810,13 @@ Editor::marker_menu_rename ()
return;
}
+ begin_reversible_command ( _("rename marker") );
+ session->add_undo( session->locations()->get_memento() );
+
loc->set_name (entry.get_text());
+
+ session->add_redo_no_execute( session->locations()->get_memento() );
+ commit_reversible_command ();
}
gint
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 8c0b5229bf..6b38b904e1 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -2112,10 +2112,20 @@ Editor::marker_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
Marker* marker = (Marker *) drag_info.data;
bool is_start;
+
+
+
+ begin_reversible_command ( _("move marker") );
+ session->add_undo( session->locations()->get_memento() );
+
Location * location = find_location_from_marker (marker, is_start);
+
if (location) {
location->set (drag_info.copied_location->start(), drag_info.copied_location->end());
}
+
+ session->add_redo_no_execute( session->locations()->get_memento() );
+ commit_reversible_command ();
marker_drag_line->hide();
range_marker_drag_rect->hide();
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);