Engauge Digitizer 2
|
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand. More...
#include <CmdAbstract.h>
Public Member Functions | |
CmdAbstract (MainWindow &mainWindow, Document &document, const QString &cmdDescription) | |
Single constructor. | |
virtual | ~CmdAbstract () |
virtual void | cmdRedo ()=0 |
Redo method that is called when QUndoStack is moved one command forward. | |
virtual void | cmdUndo ()=0 |
Undo method that is called when QUndoStack is moved one command backward. | |
virtual void | saveXml (QXmlStreamWriter &writer) const =0 |
Save commands as xml for later uploading. |
Protected Member Functions | |
void | baseAttributes (QXmlStreamWriter &writer) const |
After writing leaf class attributes, this writes the base class atributes. | |
Document & | document () |
Return the Document that this command will modify during redo and undo. | |
const Document & | document () const |
Return a const copy of the Document for non redo/undo interaction. | |
void | leafAttributes (const QXmlStreamAttributes &attributes, const QStringList &requiredAttributesLeaf, QXmlStreamReader &reader) |
Same as often-used leafAndBaseAttributes, except this is used in the special case where a class inherits from another class (e.g. | |
void | leafAndBaseAttributes (const QXmlStreamAttributes &attributes, const QStringList &requiredAttributesLeaf, QXmlStreamReader &reader) |
Before reading leaf class attributes, check all required attributes from leaf and this base class are included, then extract the parent class attributes. | |
MainWindow & | mainWindow () |
Return the MainWindow so it can be updated by this command as a last step. | |
void | resetSelection (const PointIdentifiers &pointIdentifiersToSelect) |
Call this (for consistency) after writing leaf class attributes, to write the base class attributes. | |
void | restoreState () |
Before any other operations associated with a Cmd class are performed, this method is called to restore original states to all relevant state machines. | |
void | saveOrCheckPostCommandDocumentStateHash (const Document &document) |
Save, when called the first time, a hash value representing the state of the Document. | |
void | saveOrCheckPreCommandDocumentStateHash (const Document &document) |
Save, when called the first time, a hash value representing the state of the Document. | |
void | selectAddedPointForMoving (const QString &pointAdded) |
Select point that was just added so it can be moved by the user next for convenience. | |
void | selectAddedPointsForMoving (const QStringList &pointsAdded) |
Select points that were just added so they can be moved by the user next for convenience. |
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand.
Definition at line 23 of file CmdAbstract.h.
CmdAbstract::CmdAbstract | ( | MainWindow & | mainWindow, |
Document & | document, | ||
const QString & | cmdDescription ) |
Single constructor.
Definition at line 26 of file CmdAbstract.cpp.
|
virtual |
Definition at line 38 of file CmdAbstract.cpp.
|
protected |
After writing leaf class attributes, this writes the base class atributes.
Definition at line 42 of file CmdAbstract.cpp.
|
pure virtual |
Redo method that is called when QUndoStack is moved one command forward.
Implemented in CmdAddPointAxis, CmdAddPointGraph, CmdAddPointsGraph, CmdAddScale, CmdCopy, CmdCut, CmdDelete, CmdEditPointAxis, CmdEditPointGraph, CmdGong, CmdGuidelineAddXT, CmdGuidelineAddYR, CmdGuidelineMoveXT, CmdGuidelineMoveYR, CmdGuidelineRemoveXT, CmdGuidelineRemoveYR, CmdMoveBy, CmdRedoForTest, CmdSelectCoordSystem, CmdSettingsAxesChecker, CmdSettingsColorFilter, CmdSettingsCoords, CmdSettingsCurveList, CmdSettingsCurveProperties, CmdSettingsDigitizeCurve, CmdSettingsExportFormat, CmdSettingsGeneral, CmdSettingsGridDisplay, CmdSettingsGridRemoval, CmdSettingsGuideline, CmdSettingsPointMatch, CmdSettingsSegments, and CmdUndoForTest.
|
pure virtual |
Undo method that is called when QUndoStack is moved one command backward.
Implemented in CmdAddPointAxis, CmdAddPointGraph, CmdAddPointsGraph, CmdAddScale, CmdCopy, CmdCut, CmdDelete, CmdEditPointAxis, CmdEditPointGraph, CmdGong, CmdGuidelineAddXT, CmdGuidelineAddYR, CmdGuidelineMoveXT, CmdGuidelineMoveYR, CmdGuidelineRemoveXT, CmdGuidelineRemoveYR, CmdMoveBy, CmdRedoForTest, CmdSelectCoordSystem, CmdSettingsAxesChecker, CmdSettingsColorFilter, CmdSettingsCoords, CmdSettingsCurveList, CmdSettingsCurveProperties, CmdSettingsDigitizeCurve, CmdSettingsExportFormat, CmdSettingsGeneral, CmdSettingsGridDisplay, CmdSettingsGridRemoval, CmdSettingsGuideline, CmdSettingsPointMatch, CmdSettingsSegments, and CmdUndoForTest.
|
protected |
Return the Document that this command will modify during redo and undo.
Definition at line 48 of file CmdAbstract.cpp.
|
protected |
Return a const copy of the Document for non redo/undo interaction.
Definition at line 53 of file CmdAbstract.cpp.
|
protected |
Before reading leaf class attributes, check all required attributes from leaf and this base class are included, then extract the parent class attributes.
Definition at line 79 of file CmdAbstract.cpp.
|
protected |
Same as often-used leafAndBaseAttributes, except this is used in the special case where a class inherits from another class (e.g.
CmdPointChangeBase) that inherits from the base class. In the three level case, the lowest class calls this method and the midlevel class calls leafAndBaseAttributes
Definition at line 58 of file CmdAbstract.cpp.
|
protected |
Return the MainWindow so it can be updated by this command as a last step.
Definition at line 96 of file CmdAbstract.cpp.
|
protected |
Call this (for consistency) after writing leaf class attributes, to write the base class attributes.
Since the set of selected points has probably changed, changed that set back to the specified set. This lets the user move selected point(s) repeatedly using arrow keys. Also provides expected behavior when pasting
Definition at line 132 of file CmdAbstract.cpp.
|
protected |
Before any other operations associated with a Cmd class are performed, this method is called to restore original states to all relevant state machines.
Definition at line 153 of file CmdAbstract.cpp.
|
protected |
Save, when called the first time, a hash value representing the state of the Document.
Then on succeeding calls the hash is recomputed and compared to the original value to check for consistency. This "post" method is called immediately after the redo method of the subclass has done its processing. See also saveOrCheckPreCommandDocumentState
Definition at line 160 of file CmdAbstract.cpp.
|
protected |
Save, when called the first time, a hash value representing the state of the Document.
Then on succeeding calls the hash is recomputed and compared to the original value to check for consistency. This "pre" method is called immediately after the redo method of the subclass has done its processing. See also saveOrCheckPostCommandDocumentState
Definition at line 183 of file CmdAbstract.cpp.
|
pure virtual |
Save commands as xml for later uploading.
Implemented in CmdAddPointAxis, CmdAddPointGraph, CmdAddPointsGraph, CmdAddScale, CmdCopy, CmdCut, CmdDelete, CmdEditPointAxis, CmdEditPointGraph, CmdGong, CmdGuidelineAddXT, CmdGuidelineAddYR, CmdGuidelineMoveXT, CmdGuidelineMoveYR, CmdGuidelineRemoveXT, CmdGuidelineRemoveYR, CmdMoveBy, CmdRedoForTest, CmdSelectCoordSystem, CmdSettingsAxesChecker, CmdSettingsColorFilter, CmdSettingsCoords, CmdSettingsCurveList, CmdSettingsCurveProperties, CmdSettingsDigitizeCurve, CmdSettingsExportFormat, CmdSettingsGeneral, CmdSettingsGridDisplay, CmdSettingsGridRemoval, CmdSettingsGuideline, CmdSettingsPointMatch, CmdSettingsSegments, and CmdUndoForTest.
|
protected |
Select point that was just added so it can be moved by the user next for convenience.
Definition at line 206 of file CmdAbstract.cpp.
|
protected |
Select points that were just added so they can be moved by the user next for convenience.
Definition at line 214 of file CmdAbstract.cpp.