r191@gandalf: fugalh | 2006-07-24 19:50:10 -0600

All the obvious MementoCommand grunt work. Now there's some
 add_undo/add_redo_no_execute sprinkled around where one is separated from the
 other (e.g. in different callbacks) or perhaps even where there's only an undo
 and no redo. Also some sigc-based undo/redo pairs that probably need their own
 Command class.


git-svn-id: svn://localhost/ardour2/branches/undo@692 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Hans Fugal 2006-07-25 01:50:20 +00:00
parent 55159005b9
commit b7bffbe7a2
16 changed files with 191 additions and 125 deletions

View file

@ -654,9 +654,11 @@ gint LocationUI::do_location_remove (ARDOUR::Location *loc)
}
session->begin_reversible_command (_("remove marker"));
session->add_undo (session->locations()->get_memento());
XMLNode &before, &after;
before = session->locations()->get_state();
session->locations()->remove (loc);
session->add_redo_no_execute (session->locations()->get_memento());
after = session->locations()->get_state();
session->add_command(MementoCommand<Location>(*(session->locations()), before, after));
session->commit_reversible_command ();
return FALSE;
@ -772,9 +774,10 @@ LocationUI::add_new_location()
jack_nframes_t where = session->audible_frame();
Location *location = new Location (where, where, "mark", Location::IsMark);
session->begin_reversible_command (_("add marker"));
session->add_undo (session->locations()->get_memento());
XMLNode &before = session->locations()->get_state();
session->locations()->add (location, true);
session->add_redo_no_execute (session->locations()->get_memento());
XMLNode &after = session->locations()->get_state();
session->add_command (MementoCommand<Locations>(*(session->locations()), before, after));
session->commit_reversible_command ();
}
@ -788,9 +791,10 @@ LocationUI::add_new_range()
Location *location = new Location (where, where, "unnamed",
Location::IsRangeMarker);
session->begin_reversible_command (_("add range marker"));
session->add_undo (session->locations()->get_memento());
XMLNode &before = session->locations()->get_state();
session->locations()->add (location, true);
session->add_redo_no_execute (session->locations()->get_memento());
XMLNode &after = session->locations()->get_state();
session->add_command (MementoCommand<Locations>(*(session->locations()), before, after));
session->commit_reversible_command ();
}
}