ardour/libs/pbd3
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
..
pbd r168@gandalf: fugalh | 2006-07-11 16:29:22 -0600 2006-07-11 22:29:39 +00:00
.cvsignore All included libraries now link dynamically instead of statically. 2006-04-25 20:23:50 +00:00
AUTHORS Initial revision 2005-05-13 20:47:18 +00:00
base_ui.cc Merging from trunk 2006-06-22 23:40:55 +00:00
basename.cc pulling trunk 2006-06-14 18:37:57 +00:00
ChangeLog incremented to 3.1. 2005-12-02 22:11:35 +00:00
convert.cc added std:: to atoi and atof to fix namespace problem in convert.cc 2006-04-26 00:18:06 +00:00
COPYING Initial revision 2005-05-13 20:47:18 +00:00
dmalloc.cc Initial revision 2005-05-13 20:47:18 +00:00
error.cc Merging from trunk 2006-06-22 23:40:55 +00:00
gettext.h add missing file, remove unnecessary qualifier 2006-04-25 11:10:52 +00:00
i18n.h add missing file 2006-04-25 01:21:22 +00:00
libpbd.pc.in Initial revision 2005-05-13 20:47:18 +00:00
libpbd.spec.in Initial revision 2005-05-13 20:47:18 +00:00
mountpoint.cc Initial revision 2005-05-13 20:47:18 +00:00
NEWS Initial revision 2005-05-13 20:47:18 +00:00
pathscanner.cc Merging from trunk 2006-06-22 23:40:55 +00:00
pool.cc Merging from trunk 2006-06-22 23:40:55 +00:00
pthread_utils.cc significant extensions to tranzport support 2006-04-06 01:52:45 +00:00
README Initial revision 2005-05-13 20:47:18 +00:00
receiver.cc Initial revision 2005-05-13 20:47:18 +00:00
SConscript Merging from trunk 2006-06-22 23:40:55 +00:00
stacktrace.cc new stacktrace function in libpbd3; variable size GUI request thread queues 2006-02-15 15:55:48 +00:00
strsplit.cc Initial revision 2005-05-13 20:47:18 +00:00
textreceiver.cc Initial revision 2005-05-13 20:47:18 +00:00
transmitter.cc Merging from trunk 2006-06-22 23:40:55 +00:00
undo.cc r132@gandalf: fugalh | 2006-06-29 12:45:16 -0600 2006-06-29 18:49:03 +00:00
whitespace.cc Moved strip_whitespace_edges() to pbd/whitespace.h 2006-01-13 19:48:55 +00:00
xml++.cc change foo(string bar) to foo(const char * bar) for foo()s only being called with C-string args. 2005-12-22 13:01:39 +00:00