|
Boost Users : |
From: ajb_at_[hidden]
Date: 2006-10-08 21:53:47
G'day all.
Quoting Benjamin Lau <blwy10v_at_[hidden]>:
> Yay! That's nice to note. I'm actually in the midst of designing an
> undo/redo framework and was thinking of submitting it to Boost once it
> is done. It's fairly simple in design and only needs 1 source file!
I'm also interested, but my needs are a bit more sophisticated.
Imagine, for a moment, an application with a soft scripting layer.
User interface components (e.g. menu items) can activate scripts written
by the user.
When the user tries to "undo", what they would expect is for all
"primitive" operations to be undone. The same applies to "redo".
I therefore think that any Boost.Undo would need to be able to handle
this. And what I'd like to write is something along these lines:
boost::undo::undo_manager s_undoManager;
void
activate_script()
{
boost::undo::transaction ut(s_undoManager);
run_script();
}
While the boost::undo::transaction object is alive, the undo_manager
should treat all operations as a unit. Then when I call
s_undoManager.undo() (or whatever it's called), it will undo all of
the primitive operations done by the script in one go.
Other desirable features:
- The ability to name transactions/operations.
- The ability to iterate through the undo/redo stacks and
undo/redo up to an iterator.
- The ability to create undo/redo "checkpoints" which only
invalidate if the point truly no longer exists (e.g. if you
undo past the checkpoint and subsequently "do" a new operation).
Cheers,
Andrew Bromage
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net