#include <CommandHistory.h>
Inheritance diagram for TSE3::Cmd::CommandHistory:
Public Member Functions | |
CommandHistory (int limit=defaultLimit) | |
void | add (Command *command) |
bool | undos () const |
void | undo () |
Command * | undoCommand (size_t pos) |
bool | redos () const |
void | redo () |
Command * | redoCommand (size_t pos) |
int | limit () const |
void | setLimit (int limit) |
void | clear () |
void | clearUndos () |
void | clearRedos () |
Static Public Attributes | |
const int | defaultLimit = 20 |
The history of which Command objects have been executed. Once a Command has been executed, it should be placed into the CommandHistory so that an undo/redo mechanism can be operated by the user.
In the TSE3 system there could be be one CommandHistroy object per TSE3::Song or one global CommandHistory.
When the availablity of either undos or redos changes, a notification is sent.
The CommandHistory class has a size limit facility. When either the undo or redo list goes over a certain threshold (see limit) will be deleted. This can be set to 'infinite'.
|
Create a CommandHistory with the given limit size. This limit defaults to the value of defaultLimit.
|
|
Adds a Command to the CommandHistory. The Command must have been executed. Placing it in the CommandHistory ties it's lifetime to that of the CommandHistory object. Adding a Command will wipe any redos that may have been possible.
|
|
Returns whether there are any Command objects that can be undone. When this information changes a notification will be sent.
|
|
Undoes the last Command, and places it on the redo list. |
|
Returns the command
If there is no command to be undone at this
|
|
Returns whether there are any Command objects that can be redone. When this information changes a notification will be sent.
|
|
Redoes the last undone Command. |
|
Returns the command
If there is no command to be redone at this
|
|
Returns the value of the history size limit. This is the number of Command objects that are stored. If the value is -1 then the number of undos is unlimited. Clearly, if the value is 0 then undo is effectively 'off'.
|
|
Sets the CommandHistory limit value. If there are more Command objects than the new limit currently in the CommandHistory, they will be removed.
|
|
Clears all undo and redo actions in the CommandHistory.
|
|
Clears all undo actions in the CommandHistory.
|
|
Clears all redo actions in the CommandHistory.
|
|
The default CommandHistory limit size. |