13
0
livetrax/libs
Hans Fugal 0bd3b0b670 r168@gandalf: fugalh | 2006-07-11 16:29:22 -0600
I just had an epiphany. I tried so many ways to make saving function name and
 args work, it never occured to me that you could just as easily save undo
 information as a pair of mementos, even in the Command-based structure we
 agreed on.
 
 Since many (read: almost all) existing undo commands take this form:
 
     begin_reversible_command (_("change fade in length"));
     session->add_undo (arv->region.get_memento());
     arv->region.set_fade_in_length (fade_length);
     session->add_redo_no_execute (arv->region.get_memento());
     commit_reversible_command ();
 
 We are already doing the save a memento before and after work. All we need to
 do is instantiate an appropriate instance of MementoCommand. So the above
 becomes:
 
 
     begin_reversible_command (_("change fade in length"));
     MementoCommand<arv_region_t, arv_region_memento_t>  before, after;
     before = arv->region.get_memento();
     arv->region.set_fade_in_length (fade_length);
     after = arv->region.get_memento();
     session->add_command(arv->region, before, after);
     commit_reversible_command ();
 
 (With apologies for being too lazy to go look up what arv_region_t and
 arv_region_memento_t are)
 
 Note that the true command approach is still possible, and encouraged (both by
 dictate and design). 
 


git-svn-id: svn://localhost/ardour2/branches/undo@680 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-07-11 22:29:39 +00:00
..
ardour merging trunk 2006-06-29 14:19:37 +00:00
flowcanvas Install ardour as a binary, a script and a set of shared 2006-04-26 00:45:27 +00:00
fst Merging from trunk 2006-06-22 23:40:55 +00:00
glibmm2 Run autogen.sh based on the existence of configure instead of the existence of 2006-06-02 03:33:38 +00:00
gtkmm2 Install ardour as a binary, a script and a set of shared 2006-04-26 00:45:27 +00:00
gtkmm2ext Merging from trunk 2006-06-22 23:40:55 +00:00
libglademm Install ardour as a binary, a script and a set of shared 2006-04-26 00:45:27 +00:00
libgnomecanvasmm Install ardour as a binary, a script and a set of shared 2006-04-26 00:45:27 +00:00
libsndfile merging trunk 2006-06-29 14:19:37 +00:00
midi++2 Merging from trunk 2006-06-22 23:40:55 +00:00
pbd3 r168@gandalf: fugalh | 2006-07-11 16:29:22 -0600 2006-07-11 22:29:39 +00:00
sigc++2 Run autogen.sh based on the existence of configure instead of the existence of 2006-06-02 03:33:38 +00:00
soundtouch Install ardour as a binary, a script and a set of shared 2006-04-26 00:45:27 +00:00
surfaces Merging from trunk 2006-06-22 23:40:55 +00:00
.cvsignore