Engauge Digitizer 2
|
Base class for CmdBase leaf subclasses that involve point additions, deletions and/or modifications. More...
#include <CmdPointChangeBase.h>
Public Member Functions | |
CmdPointChangeBase (MainWindow &mainWindow, Document &document, const QString &cmdDescription) | |
Single constructor. | |
virtual | ~CmdPointChangeBase () |
Public Member Functions inherited from CmdAbstract | |
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 | restoreDocumentState (Document &document) const |
Restore the document previously saved by saveDocumentState. | |
void | saveDocumentState (const Document &document) |
Save the document state for restoration by restoreDocumentState. | |
Protected Member Functions inherited from CmdAbstract | |
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. |
Base class for CmdBase leaf subclasses that involve point additions, deletions and/or modifications.
This class uses a strategy of taking a snapshot of all points before the redo, and then applying that snapshot to the Document to (later) perform the undo. Before this strategy, the strategy was to just do the opposite steps of the redo, but that strategy was too fragile since it implicity assumed no point changes occurred after the redo of this command and before the redo of the next command. However, point updates like "ordinal maintenance" do occur during that time period
Definition at line 22 of file CmdPointChangeBase.h.
CmdPointChangeBase::CmdPointChangeBase | ( | MainWindow & | mainWindow, |
Document & | document, | ||
const QString & | cmdDescription ) |
Single constructor.
Definition at line 14 of file CmdPointChangeBase.cpp.
|
virtual |
Definition at line 26 of file CmdPointChangeBase.cpp.
|
protected |
Restore the document previously saved by saveDocumentState.
Definition at line 30 of file CmdPointChangeBase.cpp.
|
protected |
Save the document state for restoration by restoreDocumentState.
Definition at line 41 of file CmdPointChangeBase.cpp.