From b7bffbe7a249356a93d25a41f7c472cc9dd8f27f Mon Sep 17 00:00:00 2001 From: Hans Fugal Date: Tue, 25 Jul 2006 01:50:20 +0000 Subject: 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 --- gtk2_ardour/editor_markers.cc | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'gtk2_ardour/editor_markers.cc') diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index a584561e42..5be9cc2747 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -290,9 +290,11 @@ Editor::mouse_add_new_marker (jack_nframes_t where) if (session) { Location *location = new Location (where, where, "mark", Location::IsMark); session->begin_reversible_command (_("add marker")); - session->add_undo (session->locations()->get_memento()); + XMLNode &before, &after; + before = session->locations()->get_state(); session->locations()->add (location, true); - session->add_redo_no_execute (session->locations()->get_memento()); + after = session->locations()->get_state(); + session->add_command (MementoCommand(*(session->locations()), before, after)); session->commit_reversible_command (); } } @@ -329,9 +331,11 @@ gint Editor::really_remove_marker (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(*(session->locations()), before, after)); session->commit_reversible_command (); return FALSE; } @@ -838,12 +842,13 @@ Editor::marker_menu_rename () } begin_reversible_command ( _("rename marker") ); - session->add_undo( session->locations()->get_memento() ); + XMLNode &before = session->locations()->get_state(); dialog.get_result(txt); loc->set_name (txt); - session->add_redo_no_execute( session->locations()->get_memento() ); + XMLNode &after = session->locations()->get_state(); + session->add_command (MementoCommand(*(session->locations()), before, after)); commit_reversible_command (); } @@ -868,10 +873,11 @@ Editor::new_transport_marker_menu_set_loop () if ((tll = transport_loop_location()) == 0) { Location* loc = new Location (temp_location->start(), temp_location->end(), _("Loop"), Location::IsAutoLoop); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); session->locations()->add (loc, true); session->set_auto_loop_location (loc); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command (MementoCommand(*(session->locations()), before, after)); } else { session->add_undo (retype_return(bind (mem_fun (*tll, &Location::set), tll->start(), tll->end()))); @@ -894,10 +900,11 @@ Editor::new_transport_marker_menu_set_punch () if ((tpl = transport_punch_location()) == 0) { tpl = new Location (temp_location->start(), temp_location->end(), _("Punch"), Location::IsAutoPunch); - session->add_undo (session->locations()->get_memento()); + XMLNode &before = session->locations()->get_state(); session->locations()->add (tpl, true); session->set_auto_punch_location (tpl); - session->add_redo_no_execute (session->locations()->get_memento()); + XMLNode &after = session->locations()->get_state(); + session->add_command (MementoCommand(*(session->locations()), before, after)); } else { session->add_undo (retype_return(bind (mem_fun (*tpl, &Location::set), tpl->start(), tpl->end()))); session->add_redo (retype_return(bind (mem_fun (*tpl, &Location::set), temp_location->start(), temp_location->end()))); -- cgit v1.2.3