ardour/libs/pbd3/pbd
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
..
.cvsignore Initial revision 2005-05-13 20:47:18 +00:00
.DS_Store Initial revision 2005-05-13 20:47:18 +00:00
abstract_ui.cc pulling trunk 2006-06-14 18:37:57 +00:00
abstract_ui.h pulling trunk 2006-06-14 18:37:57 +00:00
base_ui.h add missing file, remove unnecessary qualifier 2006-04-25 11:10:52 +00:00
basename.h pulling trunk 2006-06-14 18:37:57 +00:00
command.h r154@gandalf: fugalh | 2006-06-30 11:16:27 -0600 2006-06-30 17:23:12 +00:00
compose.h fix compose mess, and a number of 64 bit printf specs 2005-10-06 19:10:57 +00:00
convert.h All included libraries now link dynamically instead of statically. 2006-04-25 20:23:50 +00:00
error.h Merging from trunk 2006-06-22 23:40:55 +00:00
failed_constructor.h Initial revision 2005-05-13 20:47:18 +00:00
fastlog.h Synced fastlog.h with ardour1 updates. 2005-08-11 19:45:29 +00:00
forkexec.h Initial revision 2005-05-13 20:47:18 +00:00
mathfix.h added mathfix.h from ardour1 2005-11-29 07:04:42 +00:00
memento_command.h r168@gandalf: fugalh | 2006-07-11 16:29:22 -0600 2006-07-11 22:29:39 +00:00
mountpoint.h Initial revision 2005-05-13 20:47:18 +00:00
pathscanner.h Initial revision 2005-05-13 20:47:18 +00:00
pool.h pulling trunk 2006-06-14 18:37:57 +00:00
pthread_utils.h fixed missing include need for compile on gcc 3.3.x 2006-02-16 03:25:23 +00:00
receiver.h a) completely refactor abstract UI code 2006-04-24 22:45:19 +00:00
restartable_rw.h Initial revision 2005-05-13 20:47:18 +00:00
ringbuffer.h pulling trunk 2006-06-14 18:37:57 +00:00
ringbufferNPT.h pulling trunk 2006-06-14 18:37:57 +00:00
selectable.h Initial revision 2005-05-13 20:47:18 +00:00
serializable.h r132@gandalf: fugalh | 2006-06-29 12:45:16 -0600 2006-06-29 18:49:03 +00:00
stacktrace.h new stacktrace function in libpbd3; variable size GUI request thread queues 2006-02-15 15:55:48 +00:00
stl_delete.h Initial revision 2005-05-13 20:47:18 +00:00
stl_functors.h Initial revision 2005-05-13 20:47:18 +00:00
strsplit.h Initial revision 2005-05-13 20:47:18 +00:00
textreceiver.h Initial revision 2005-05-13 20:47:18 +00:00
thrown_error.h Initial revision 2005-05-13 20:47:18 +00:00
touchable.h Initial revision 2005-05-13 20:47:18 +00:00
transmitter.h Merging from trunk 2006-06-22 23:40:55 +00:00
undo.h r132@gandalf: fugalh | 2006-06-29 12:45:16 -0600 2006-06-29 18:49:03 +00:00
whitespace.h Moved strip_whitespace_edges() to pbd/whitespace.h 2006-01-13 19:48:55 +00:00
xml++.h fixed memory leak in xmltree 2006-02-01 00:19:44 +00:00