Engauge Digitizer 2
Loading...
Searching...
No Matches
CmdGuidelineMoveXT Class Reference

Command for moving one X/T Guideline value. More...

#include <CmdGuidelineMoveXT.h>

Inheritance diagram for CmdGuidelineMoveXT:
Inheritance graph
Collaboration diagram for CmdGuidelineMoveXT:
Collaboration graph

Public Member Functions

 CmdGuidelineMoveXT (MainWindow &mainWindow, Document &document, const QString &identifier, double valueBefore, double valueAfter)
 Constructor for normal creation.
 CmdGuidelineMoveXT (MainWindow &mainWindow, Document &document, const QString &cmdDescription, QXmlStreamReader &reader)
 Constructor for parsing error report file xml.
virtual ~CmdGuidelineMoveXT ()
virtual void cmdRedo ()
 Redo method that is called when QUndoStack is moved one command forward.
virtual void cmdUndo ()
 Undo method that is called when QUndoStack is moved one command backward.
virtual void saveXml (QXmlStreamWriter &writer) const
 Save commands as xml for later uploading.
Public Member Functions inherited from CmdAbstract
 CmdAbstract (MainWindow &mainWindow, Document &document, const QString &cmdDescription)
 Single constructor.
virtual ~CmdAbstract ()

Additional Inherited Members

Protected Member Functions inherited from CmdAbstract
void baseAttributes (QXmlStreamWriter &writer) const
 After writing leaf class attributes, this writes the base class atributes.
Documentdocument ()
 Return the Document that this command will modify during redo and undo.
const Documentdocument () 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.
MainWindowmainWindow ()
 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.

Detailed Description

Command for moving one X/T Guideline value.

Definition at line 16 of file CmdGuidelineMoveXT.h.

Constructor & Destructor Documentation

◆ CmdGuidelineMoveXT() [1/2]

CmdGuidelineMoveXT::CmdGuidelineMoveXT ( MainWindow & mainWindow,
Document & document,
const QString & identifier,
double valueBefore,
double valueAfter )

Constructor for normal creation.

Definition at line 16 of file CmdGuidelineMoveXT.cpp.

20 :
24 m_identifier (identifier),
25 m_valueBefore (valueBefore),
26 m_valueAfter (valueAfter)
27{
28 LOG4CPP_INFO_S ((*mainCat)) << "CmdGuidelineMoveXT::CmdGuidelineMoveXT";
29}
const QString CMD_DESCRIPTION("Add axis point")
log4cpp::Category * mainCat
Definition Logger.cpp:14
Document & document()
Return the Document that this command will modify during redo and undo.
MainWindow & mainWindow()
Return the MainWindow so it can be updated by this command as a last step.
CmdAbstract(MainWindow &mainWindow, Document &document, const QString &cmdDescription)
Single constructor.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ CmdGuidelineMoveXT() [2/2]

CmdGuidelineMoveXT::CmdGuidelineMoveXT ( MainWindow & mainWindow,
Document & document,
const QString & cmdDescription,
QXmlStreamReader & reader )

Constructor for parsing error report file xml.

Definition at line 31 of file CmdGuidelineMoveXT.cpp.

34 :
37 cmdDescription)
38{
39 LOG4CPP_INFO_S ((*mainCat)) << "CmdGuidelineMoveXT::CmdGuidelineMoveXT";
40
41 QXmlStreamAttributes attributes = reader.attributes();
42
43 QStringList requiredAttributesLeaf;
44 requiredAttributesLeaf << DOCUMENT_SERIALIZE_IDENTIFIER
47 leafAndBaseAttributes (attributes,
48 requiredAttributesLeaf,
49 reader);
50
51 m_identifier = attributes.value(DOCUMENT_SERIALIZE_IDENTIFIER).toString();
52 m_valueBefore = attributes.value(DOCUMENT_SERIALIZE_GRAPH_BEFORE).toDouble();
53 m_valueAfter = attributes.value(DOCUMENT_SERIALIZE_GRAPH_AFTER).toDouble();
54}
const QString DOCUMENT_SERIALIZE_IDENTIFIER
const QString DOCUMENT_SERIALIZE_GRAPH_AFTER
const QString DOCUMENT_SERIALIZE_GRAPH_BEFORE
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...

◆ ~CmdGuidelineMoveXT()

CmdGuidelineMoveXT::~CmdGuidelineMoveXT ( )
virtual

Definition at line 56 of file CmdGuidelineMoveXT.cpp.

57{
58}

Member Function Documentation

◆ cmdRedo()

void CmdGuidelineMoveXT::cmdRedo ( )
virtual

Redo method that is called when QUndoStack is moved one command forward.

Implements CmdAbstract.

Definition at line 60 of file CmdGuidelineMoveXT.cpp.

61{
62 LOG4CPP_INFO_S ((*mainCat)) << "CmdGuidelineMoveXT::cmdRedo"
63 << " identifier=" << m_identifier.toLatin1().data()
64 << " value=" << m_valueAfter;
65
66 restoreState ();
67 mainWindow().guidelineMoveXT (m_identifier,
68 m_valueAfter);
69}
void restoreState()
Before any other operations associated with a Cmd class are performed, this method is called to resto...
void guidelineMoveXT(const QString &identifier, double xTAfter)
Move a X/T Guideline.

◆ cmdUndo()

void CmdGuidelineMoveXT::cmdUndo ( )
virtual

Undo method that is called when QUndoStack is moved one command backward.

Implements CmdAbstract.

Definition at line 71 of file CmdGuidelineMoveXT.cpp.

72{
73 LOG4CPP_INFO_S ((*mainCat)) << "CmdGuidelineMoveXT::cmdUndo"
74 << " identifier=" << m_identifier.toLatin1().data()
75 << " value=" << m_valueBefore;
76
77 restoreState ();
78 mainWindow().guidelineMoveXT (m_identifier,
79 m_valueBefore);
80}

◆ saveXml()

void CmdGuidelineMoveXT::saveXml ( QXmlStreamWriter & writer) const
virtual

Save commands as xml for later uploading.

Implements CmdAbstract.

Definition at line 82 of file CmdGuidelineMoveXT.cpp.

83{
84 writer.writeStartElement(DOCUMENT_SERIALIZE_CMD);
86 writer.writeAttribute(DOCUMENT_SERIALIZE_CMD_DESCRIPTION, QUndoCommand::text ());
87 writer.writeAttribute(DOCUMENT_SERIALIZE_IDENTIFIER, m_identifier);
88 writer.writeAttribute(DOCUMENT_SERIALIZE_GRAPH_BEFORE, QString::number (m_valueBefore));
89 writer.writeAttribute(DOCUMENT_SERIALIZE_GRAPH_AFTER, QString::number (m_valueAfter));
90 baseAttributes (writer);
91 writer.writeEndElement();
92}
const QString DOCUMENT_SERIALIZE_CMD_GUIDELINE_MOVE_X_T
const QString DOCUMENT_SERIALIZE_CMD
const QString DOCUMENT_SERIALIZE_CMD_TYPE
const QString DOCUMENT_SERIALIZE_CMD_DESCRIPTION
void baseAttributes(QXmlStreamWriter &writer) const
After writing leaf class attributes, this writes the base class atributes.

The documentation for this class was generated from the following files: