Wednesday, July 5, 2017

Abiathar API - Undo/redo

A very important feature of Abiathar is the undo/redo history. This allows the user to reverse any mistakes they made without discarding all uncommitted changes. Extensions that alter levels, tileinfo, or project configuration must consider the undo history.

After making any change, extensions must either clear the undo history (ClearUndoStack on the state manager) or add the action to the undo stack with PushUndoStack. If these methods are not used, the undo stack may become corrupted, leading to inconsistencies and crashes. An undoable action object must implement IUndoableAction, which has these members:

  • Undo undoes the action.
  • Redo redoes the action.
  • Description gets a one-line description of the action for display in the Time Machine.
For your convenience, there is a SimpleUndoableAction class that combines Undo and Redo into one Perform method that takes a Boolean indicating whether to redo.

No comments:

Post a Comment