Undo/Redo Action Framework
DescriptionIn order to facilitate the undo and redo functionality of an editor we need to be able to track and reverse changes we make to the project data.
in order to do this we need a Framework that can wrap the functionality.
the framework should consist of two parts
1) A manager:
- The manager should contains two stacks of action objects. actions that have been done and can be undone, and actions that have been undone and can be redone.
- The manager should properly track history changes and keep data safe. ie if a action is undo and then a new action is done. the redo stack should be cleared as the first action can't safely be redone.
- In the facilitation of a future "history" feature like you would find in Photoshop methods should be made that can do batch calls to undo or redo several actions at once going forward or backward in the history.
- The ability to configurable limit the number of actions in the stacks should also be available as this system has the potential to eat up a lot of memory.
2) An Action template:
- The idea is that when we want to modify project data we create an action object of the type we need, fill in the necessary data, and then call some sort of commit method on the action object. the Action should add itself to the top of the undo stack and record any data it needs to undo it's changes and then make it's changes.
- When an undo call is made the the manager it pulls the action on the top of the stack calls a reverse method on it. the reverse method should record any data it needs to redo itself, and then undo it's past changes. the action then be moved to the top of the redo stack.
- When a redo call to the manger pulls the action on the top of the redo stack and should call the commit method again and move it to the top of the undo stack.
- This class should be a template that real action objects subclass.
PriorityHigh
PrerequisitesNone
AssignedNone
Everything elseThis system should be included in the Core library in it's own module name "Actions". Don't worry about doing the house keeping code to register the system to the Kernel, I'll take care of that.