![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
The Undo List class manages a list of undoable commands. More...
#include <FXUndoList.h>
Public Types | |
enum | { ID_CLEAR =FXWindow::ID_LAST, ID_REVERT, ID_UNDO, ID_REDO, ID_UNDO_ALL, ID_REDO_ALL, ID_UNDO_COUNT, ID_REDO_COUNT, ID_LAST } |
Public Member Functions | |
long | onCmdUndo (FXObject *, FXSelector, void *) |
long | onUpdUndo (FXObject *, FXSelector, void *) |
long | onCmdRedo (FXObject *, FXSelector, void *) |
long | onUpdRedo (FXObject *, FXSelector, void *) |
long | onCmdClear (FXObject *, FXSelector, void *) |
long | onUpdClear (FXObject *, FXSelector, void *) |
long | onCmdRevert (FXObject *, FXSelector, void *) |
long | onUpdRevert (FXObject *, FXSelector, void *) |
long | onCmdUndoAll (FXObject *, FXSelector, void *) |
long | onCmdRedoAll (FXObject *, FXSelector, void *) |
long | onUpdUndoCount (FXObject *, FXSelector, void *) |
long | onUpdRedoCount (FXObject *, FXSelector, void *) |
FXUndoList () | |
Make new empty undo list, initially unmarked. | |
void | cut () |
Cut the redo list. More... | |
void | add (FXCommand *command, FXbool doit=false, FXbool merge=true) |
Add new command, executing it if desired. More... | |
void | begin (FXCommandGroup *command) |
Begin undo command sub-group. More... | |
void | end () |
End undo command sub-group. More... | |
void | abort () |
Abort the current command sub-group being compiled. More... | |
virtual void | undo () |
Undo last command. More... | |
virtual void | redo () |
Redo next command. More... | |
void | undoAll () |
Undo all commands. | |
void | redoAll () |
Redo all commands. | |
void | revert () |
Revert to marked. | |
FXbool | canUndo () const |
Can we undo more commands. | |
FXbool | canRedo () const |
Can we redo more commands. | |
FXbool | canRevert () const |
Can revert to marked. | |
FXbool | busy () const |
Return true if currently inside undo or redo operation; this is useful to avoid generating another undo command while inside an undo operation. | |
FXCommand * | current () const |
Current top level undo command. | |
virtual FXString | undoName () const |
Return name of the first undo command available; if no undo command available this will return the empty string. | |
virtual FXString | redoName () const |
Return name of the first redo command available; if no Redo command available this will return the empty string. | |
FXint | undoCount () const |
Number of undo records. | |
FXint | redoCount () const |
Number of redo records. | |
virtual FXuint | size () const |
Size of undo information. | |
void | clear () |
Clear list, and unmark all states. More... | |
void | trimCount (FXint nc) |
Trim undo list down to at most nc commands. More... | |
void | trimSize (FXuint sz) |
Trim undo list down to at most size sz. More... | |
void | mark () |
Mark the current state of the undo list, which is initially unmarked. More... | |
void | unmark () |
Unmark all states in the undo list. | |
FXbool | marked () const |
Check if the current state was marked, if the application has returned to the previously marked state. | |
![]() | |
FXCommandGroup () | |
Construct initially empty undo command group. | |
FXbool | empty () |
Return true if empty. | |
virtual | ~FXCommandGroup () |
Delete undo command and sub-commands. | |
![]() | |
virtual FXbool | canMerge () const |
Return true if this command can be merged with previous undo commands. More... | |
virtual FXbool | mergeWith (FXCommand *command) |
Called by the undo system to try and merge the new incoming command with this command; should return true if merging was possible. More... | |
virtual | ~FXCommand () |
Delete undo command. | |
![]() | |
const FXchar * | getClassName () const |
Get class name of some object. | |
FXbool | isMemberOf (const FXMetaClass *metaclass) const |
Check if object is member of metaclass. | |
virtual long | tryHandle (FXObject *sender, FXSelector sel, void *ptr) |
Try handle message safely, catching certain exceptions. | |
virtual long | onDefault (FXObject *, FXSelector, void *) |
Called for unhandled messages. | |
virtual void | save (FXStream &store) const |
Save object to stream. | |
virtual void | load (FXStream &store) |
Load object from stream. | |
virtual | ~FXObject () |
Virtual destructor. | |
The Undo List class manages a list of undoable commands.
void FX::FXUndoList::abort | ( | ) |
Abort the current command sub-group being compiled.
All commands already added to the sub-groups undo list will be discarded. Intermediate command groups will be left intact.
void FX::FXUndoList::add | ( | FXCommand * | command, |
FXbool | doit = false , |
||
FXbool | merge = true |
||
) |
Add new command, executing it if desired.
The new command will be merged with the previous command if merge is true and we're not at a marked position and the commands are mergeable. Otherwise the new command will be appended after the last undo command in the currently active undo group. If the new command is successfully merged, it will be deleted. Furthermore, all redo commands will be deleted since it is no longer possible to redo from this point.
void FX::FXUndoList::begin | ( | FXCommandGroup * | command | ) |
void FX::FXUndoList::clear | ( | ) |
Clear list, and unmark all states.
All undo and redo information will be destroyed.
void FX::FXUndoList::cut | ( | ) |
Cut the redo list.
This is automatically invoked when a new undo command is added.
void FX::FXUndoList::end | ( | ) |
End undo command sub-group.
If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
void FX::FXUndoList::mark | ( | ) |
Mark the current state of the undo list, which is initially unmarked.
There can be only one active mark at any time. Call mark() at any time when you know the document to be "clean"; for example when you save the document to disk.
|
virtual |
Redo next command.
This will move the command back to the undo list.
Reimplemented from FX::FXCommandGroup.
void FX::FXUndoList::trimCount | ( | FXint | nc | ) |
Trim undo list down to at most nc commands.
Call this periodically to prevent the undo-list from growing beyond a certain number of records.
void FX::FXUndoList::trimSize | ( | FXuint | sz | ) |
Trim undo list down to at most size sz.
Call this periodically to prevent the undo-list from growing beyond a certain amount of memory.
|
virtual |
Undo last command.
This will move the command to the redo list.
Reimplemented from FX::FXCommandGroup.
![]() |