Re: Undo framework


On Fri, 2007-09-21 at 17:51 +0100, Iain * wrote:

> The basic concepts are that there is an UndoManager object. When you
> start an operation that can be undone you call
> undo_manger_context_begin and this returns a UndoContext. Each part of
> your operation then creates an Undoable setting the functions that
> undo, redo and destroy it and set some userdata which contains enough
> information to undo/redo it. These Undoables are then added to the
> UndoContext. When the operation is finished you call
> undo_manager_context_end which adds the operation to the undo/redo
> stack.

This sounds similar to the undo system that we use in GIMP. I haven't
looked at your code, but it appears to me that your system is somewhat
less flexible. Do you allow nested undo groups? This is rather important
if you want to compose actions from smaller actions and still allow
scripts or other higher levels to combine these into a single undo step.
We make heavy use of nested undo groups in GIMP.

I am not trying to argue that the GIMP undo system would be suitable for
use anywhere outside GIMP. But we might want to adopt a more general
undo framework if it is provided by GLib/GTK+ and allows us to implement
everything that our current undo system allows us to do.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]