This class represents a general command for implementing modifications to the applications document.
More...
#include "CommandPattern.hpp"
Inherited by CommandAddPrimT, CommandAlignT, CommandApplyMaterialT, CommandAssignGroupT, CommandCarveT, CommandChangePlantDescrT, CommandChangePlantSeedT, CommandChangeTerrainResT, CommandClipT, CommandDeleteGroupT, CommandDeleteT, CommandGroupSetPropT, CommandGroupSetVisibilityT, CommandMacroT, CommandMakeHollowT, CommandMirrorT, CommandModifyModelT, CommandModifyTerrainT, CommandNewEntityT, CommandNewGroupT, CommandReorderGroupsT, CommandReplaceMatT, CommandSelectT, CommandSetBPSubdivsT, CommandSetCompVarArrayT< T >, CommandSetCompVarT< T >, CommandTransformT, CommandUpdateSurfaceT, GuiEditor::CommandAddComponentT, GuiEditor::CommandChangeWindowHierarchyT, GuiEditor::CommandCreateT, GuiEditor::CommandDeleteComponentT, GuiEditor::CommandDeleteT, GuiEditor::CommandModifyGuiT, GuiEditor::CommandPasteT, GuiEditor::CommandSelectT, MapEditor::CommandAddComponentT, MapEditor::CommandChangeEntityHierarchyT, MapEditor::CommandDeleteComponentT, MapEditor::CommandReparentPrimitiveT, ModelEditor::CommandAddT, ModelEditor::CommandDeleteT, ModelEditor::CommandRenameT, ModelEditor::CommandSelectT, ModelEditor::CommandSetAnimFPST, ModelEditor::CommandSetAnimNextT, ModelEditor::CommandSetMaterialT, ModelEditor::CommandSetMeshShadowsT, ModelEditor::CommandSetMeshTSMethodT, ModelEditor::CommandTransformJointT, ModelEditor::CommandUpdateAnimT, ModelEditor::CommandUpdateChannelT, ModelEditor::CommandUpdateGuiFixtureT, ModelEditor::CommandUpdateTriangleT, and ModelEditor::CommandUpdateUVCoordsT.
|
| CommandT (bool ShowInHistory=true, bool SuggestsSave=true) |
| The constructor. More...
|
|
virtual | ~CommandT () |
| The virtual destructor. More...
|
|
virtual bool | Do ()=0 |
| This method executes the command. More...
|
|
virtual void | Undo ()=0 |
| This method un-does the command. More...
|
|
virtual wxString | GetName () const =0 |
| Returns the name (a description) of the command. More...
|
|
bool | ShowInHistory () const |
| Whether the command should be shown in the undo/redo history. More...
|
|
bool | SuggestsSave () const |
| Whether the command suggests to save the document when its closed and hasn't been saved between the command execution and the closing (selection changes for example don't suggest to save the document since no important changes have been made). More...
|
|
bool | IsDone () const |
| Whether the command has been executed. More...
|
|
unsigned long | GetID () const |
| Returns the commands unique ID. More...
|
|
This class represents a general command for implementing modifications to the applications document.
Commands are usually kept in an undo/redo history in order to provide the user with undo and redo.
The use of commands - especially with an undo/redo history - implies several inherent "rules and considerations" that must be followed and taken into account for a successful implementation.
- It is obvious that when undo/redo is desired, documents can ONLY be modified by a closed series of commands that can be played forth and back in its respective, proper order only.
- VERY IMPORTANT: The time between the constructor and calling Do() is problematic, and should be null: there should be NO code between the construction of a command and the related call to Do(). This is especially problematic when commands are (improperly) queued, e.g. while macro commands are being constructed. As keeping the ctor empty is usually quasi impossible (we normally want to use it to "configure" the command), this implies that we must make sure that the command is run and submitted to the undo/redo history IMMEDIATELY after construction. As a help, both macro commands and the undo/redo history are able to accept commands whose Do() has already been run by the caller.
CommandT::CommandT |
( |
bool |
ShowInHistory = true , |
|
|
bool |
SuggestsSave = true |
|
) |
| |
The constructor.
- Parameters
-
ShowInHistory | If the command should be visible in the history. |
SuggestsSave | If the command should suggest that the document has to be saved if it is closed and the command has been executed without a following save. |
virtual CommandT::~CommandT |
( |
| ) |
|
|
inlinevirtual |
virtual bool CommandT::Do |
( |
| ) |
|
|
pure virtual |
This method executes the command.
- Returns
- true if the command succeeded, false if it failed.
Implemented in CommandMacroT, CommandUpdateSurfaceTerrainT, CommandUpdateSurfaceBezierPatchT, CommandSetCompVarArrayT< T >, CommandReplaceMatT, CommandClipT, CommandGroupSetPropT, CommandUpdateSurfaceFaceT, CommandAddPrimT, CommandTransformT, CommandNewEntityT, CommandDeleteGroupT, CommandNewGroupT, CommandGroupSetVisibilityT, ModelEditor::CommandUpdateUVCoordsT, GuiEditor::CommandSelectT, CommandDeleteT, CommandSelectT, CommandModifyTerrainT, MapEditor::CommandReparentPrimitiveT, GuiEditor::CommandDeleteT, CommandAlignT, CommandCarveT, CommandAssignGroupT, CommandSetBPSubdivsT, CommandSetCompVarT< T >, CommandMakeHollowT, ModelEditor::CommandAddT, ModelEditor::CommandDeleteT, GuiEditor::CommandPasteT, CommandChangeTerrainResT, CommandMirrorT, GuiEditor::CommandAddComponentT, GuiEditor::CommandDeleteComponentT, GuiEditor::CommandModifyGuiT, CommandApplyMaterialT, MapEditor::CommandChangeEntityHierarchyT, ModelEditor::CommandSelectT, ModelEditor::CommandSetMaterialT, GuiEditor::CommandChangeWindowHierarchyT, GuiEditor::CommandCreateT, MapEditor::CommandAddComponentT, MapEditor::CommandDeleteComponentT, CommandReorderGroupsT, CommandModifyModelT, ModelEditor::CommandRenameT, ModelEditor::CommandSetMeshTSMethodT, ModelEditor::CommandTransformJointT, ModelEditor::CommandUpdateAnimT, ModelEditor::CommandUpdateChannelT, ModelEditor::CommandUpdateGuiFixtureT, CommandChangePlantDescrT, CommandChangePlantSeedT, ModelEditor::CommandSetAnimFPST, ModelEditor::CommandSetAnimNextT, ModelEditor::CommandSetMeshShadowsT, and ModelEditor::CommandUpdateTriangleT.
unsigned long CommandT::GetID |
( |
| ) |
const |
|
inline |
Returns the commands unique ID.
virtual wxString CommandT::GetName |
( |
| ) |
const |
|
pure virtual |
Returns the name (a description) of the command.
Implemented in CommandMacroT, CommandUpdateSurfaceTerrainT, CommandUpdateSurfaceBezierPatchT, CommandSetCompVarArrayT< T >, CommandReplaceMatT, CommandClipT, CommandGroupSetPropT, CommandUpdateSurfaceFaceT, CommandAddPrimT, CommandTransformT, CommandNewEntityT, CommandDeleteGroupT, CommandNewGroupT, CommandGroupSetVisibilityT, ModelEditor::CommandUpdateUVCoordsT, GuiEditor::CommandSelectT, CommandDeleteT, CommandSelectT, CommandModifyTerrainT, MapEditor::CommandReparentPrimitiveT, GuiEditor::CommandDeleteT, CommandAlignT, CommandCarveT, CommandAssignGroupT, CommandSetBPSubdivsT, CommandSetCompVarT< T >, CommandMakeHollowT, ModelEditor::CommandAddT, ModelEditor::CommandDeleteT, GuiEditor::CommandPasteT, CommandChangeTerrainResT, CommandMirrorT, GuiEditor::CommandAddComponentT, GuiEditor::CommandDeleteComponentT, GuiEditor::CommandModifyGuiT, CommandApplyMaterialT, MapEditor::CommandChangeEntityHierarchyT, ModelEditor::CommandSelectT, ModelEditor::CommandSetMaterialT, GuiEditor::CommandChangeWindowHierarchyT, GuiEditor::CommandCreateT, MapEditor::CommandAddComponentT, MapEditor::CommandDeleteComponentT, CommandReorderGroupsT, CommandModifyModelT, ModelEditor::CommandRenameT, ModelEditor::CommandSetMeshTSMethodT, ModelEditor::CommandTransformJointT, ModelEditor::CommandUpdateAnimT, ModelEditor::CommandUpdateChannelT, ModelEditor::CommandUpdateGuiFixtureT, CommandChangePlantDescrT, CommandChangePlantSeedT, ModelEditor::CommandSetAnimFPST, ModelEditor::CommandSetAnimNextT, ModelEditor::CommandSetMeshShadowsT, and ModelEditor::CommandUpdateTriangleT.
bool CommandT::IsDone |
( |
| ) |
const |
|
inline |
Whether the command has been executed.
bool CommandT::ShowInHistory |
( |
| ) |
const |
|
inline |
Whether the command should be shown in the undo/redo history.
Commands not shown are still part of the history but are not undoable/redoable by the user. Instead they are silently undone/redone when the preceding command is undone/redone.
bool CommandT::SuggestsSave |
( |
| ) |
const |
|
inline |
Whether the command suggests to save the document when its closed and hasn't been saved between the command execution and the closing (selection changes for example don't suggest to save the document since no important changes have been made).
virtual void CommandT::Undo |
( |
| ) |
|
|
pure virtual |
This method un-does the command.
Implemented in CommandMacroT, CommandUpdateSurfaceTerrainT, CommandUpdateSurfaceBezierPatchT, CommandSetCompVarArrayT< T >, CommandReplaceMatT, CommandClipT, CommandGroupSetPropT, CommandUpdateSurfaceFaceT, CommandAddPrimT, CommandTransformT, CommandNewEntityT, CommandDeleteGroupT, CommandNewGroupT, CommandGroupSetVisibilityT, ModelEditor::CommandUpdateUVCoordsT, GuiEditor::CommandSelectT, CommandDeleteT, CommandSelectT, CommandModifyTerrainT, MapEditor::CommandReparentPrimitiveT, GuiEditor::CommandDeleteT, CommandAlignT, CommandCarveT, CommandAssignGroupT, CommandSetBPSubdivsT, CommandSetCompVarT< T >, CommandMakeHollowT, ModelEditor::CommandAddT, ModelEditor::CommandDeleteT, GuiEditor::CommandPasteT, CommandChangeTerrainResT, CommandMirrorT, GuiEditor::CommandAddComponentT, GuiEditor::CommandDeleteComponentT, GuiEditor::CommandModifyGuiT, CommandApplyMaterialT, MapEditor::CommandChangeEntityHierarchyT, ModelEditor::CommandSelectT, ModelEditor::CommandSetMaterialT, GuiEditor::CommandChangeWindowHierarchyT, GuiEditor::CommandCreateT, MapEditor::CommandAddComponentT, MapEditor::CommandDeleteComponentT, CommandReorderGroupsT, CommandModifyModelT, ModelEditor::CommandRenameT, ModelEditor::CommandSetMeshTSMethodT, ModelEditor::CommandTransformJointT, ModelEditor::CommandUpdateAnimT, ModelEditor::CommandUpdateChannelT, ModelEditor::CommandUpdateGuiFixtureT, CommandChangePlantDescrT, CommandChangePlantSeedT, ModelEditor::CommandSetAnimFPST, ModelEditor::CommandSetAnimNextT, ModelEditor::CommandSetMeshShadowsT, and ModelEditor::CommandUpdateTriangleT.
Whether the command has been executed.
const unsigned long CommandT::m_ID |
|
protected |
const bool CommandT::m_ShowInHistory |
|
protected |
Whether the command should have an entry in the undo/redo history.
const bool CommandT::m_SuggestsSave |
|
protected |
Whether the command suggests saving of the document on close.
The documentation for this class was generated from the following files: