LibreCAD
|
: Abstract class for a Undoable operations All operations you wnt to beable to get place in the undo stack should inherit from Undoable and implement undo and redo. A provided text can be used to show within the undo stack what operation will be re-done or un-done. More...
#include <undoable.h>
Public Member Functions | |
Undoable (const std::string &text) | |
Name of this operartion. More... | |
virtual | ~Undoable () |
virtual void | undo () const =0 |
Undo a given operation. More... | |
virtual void | redo () const =0 |
Redo a given operation. More... | |
virtual std::string | text () |
Name of the operation. More... | |
Private Attributes | |
std::string | _text |
: Abstract class for a Undoable operations All operations you wnt to beable to get place in the undo stack should inherit from Undoable and implement undo and redo. A provided text can be used to show within the undo stack what operation will be re-done or un-done.
text |
Definition at line 18 of file undoable.h.
|
inline |
Name of this operartion.
Keep it as short as possible since it will be used in the UI
Definition at line 24 of file undoable.h.
|
inlinevirtual |
Definition at line 27 of file undoable.h.
|
pure virtual |
Redo a given operation.
This can get called if we want to redo a operation. Redo is usually called after an undo operation. If in the undo operation entities where removed, it needs to get added again. it doesn't have to do any re.calculation but just remember what entities have been added or removed.
Implemented in lc::operation::ReplaceLinePattern, lc::operation::ReplaceLayer, lc::operation::ReplaceBlock, lc::operation::RemoveLinePattern, lc::operation::EntityBuilder, lc::operation::RemoveLayer, lc::operation::RemoveBlock, lc::operation::Builder, lc::operation::AddLinePattern, lc::operation::AddLayer, and lc::operation::AddBlock.
|
inlinevirtual |
Name of the operation.
Return the name of the operation. For example when a operation started it can be given the name 'add lines' So in the UI you can say 'Undo add lines' or 'Redo add lines'
Definition at line 57 of file undoable.h.
|
pure virtual |
Undo a given operation.
For any operation that means for example when it added entities to the document it now needs to remove all created entities on the document. When the operation added a layer or block, it will call functions to remove that block
Implemented in lc::operation::ReplaceLinePattern, lc::operation::ReplaceLayer, lc::operation::ReplaceBlock, lc::operation::RemoveLinePattern, lc::operation::EntityBuilder, lc::operation::RemoveLayer, lc::operation::RemoveBlock, lc::operation::Builder, lc::operation::AddLinePattern, lc::operation::AddLayer, and lc::operation::AddBlock.
|
private |
Definition at line 62 of file undoable.h.