13
0

Various marker undo fixes.

git-svn-id: svn://localhost/trunk/ardour2@413 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Sampo Savolainen 2006-03-21 18:40:17 +00:00
parent ff5f867784
commit d63c0fa328
3 changed files with 43 additions and 1 deletions

View File

@ -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

View File

@ -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();

View File

@ -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);