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

Command for moving one Y/R Guideline value. More...

#include <CmdGuidelineMoveYR.h>

Inheritance diagram for CmdGuidelineMoveYR:
Inheritance graph
Collaboration diagram for CmdGuidelineMoveYR:
Collaboration graph

Public Member Functions

 CmdGuidelineMoveYR (MainWindow &mainWindow, Document &document, const QString &identifier, double valueBefore, double valueAfter)
 Constructor for normal creation.
 CmdGuidelineMoveYR (MainWindow &mainWindow, Document &document, const QString &cmdDescription, QXmlStreamReader &reader)
 Constructor for parsing error report file xml.
virtual ~CmdGuidelineMoveYR ()
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
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.
MainWindowmainWindow ()
 Return the MainWindow so it can be updated by this command as a last step.
void resetSelection (const PointIdentifiers &pointIdentifiersToSelect)
 Since the set of selected points has probably changed, changed that set back to the specified set.
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.

Detailed Description

Command for moving one Y/R Guideline value.

Definition at line 16 of file CmdGuidelineMoveYR.h.

Constructor & Destructor Documentation

◆ CmdGuidelineMoveYR() [1/2]

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

Constructor for normal creation.

Definition at line 16 of file CmdGuidelineMoveYR.cpp.

20 :
24 m_identifier (identifier),
25 m_valueBefore (valueBefore),
26 m_valueAfter (valueAfter)
27{
28 LOG4CPP_INFO_S ((*mainCat)) << "CmdGuidelineMoveYR::CmdGuidelineMoveYR";
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

◆ CmdGuidelineMoveYR() [2/2]

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

Constructor for parsing error report file xml.

Definition at line 31 of file CmdGuidelineMoveYR.cpp.

34 :
37 cmdDescription)
38{
39 LOG4CPP_INFO_S ((*mainCat)) << "CmdGuidelineMoveYR::CmdGuidelineMoveYR";
40
41 QXmlStreamAttributes attributes = reader.attributes();
42
43 if (!attributes.hasAttribute(DOCUMENT_SERIALIZE_IDENTIFIER) ||
44 !attributes.hasAttribute(DOCUMENT_SERIALIZE_GRAPH_BEFORE) ||
45 !attributes.hasAttribute(DOCUMENT_SERIALIZE_GRAPH_AFTER)) {
46 xmlExitWithError (reader,
47 QString ("%1 %2 %3 %4 %5 %6")
48 .arg (QObject::tr ("Missing attribute(s)"))
50 .arg (QObject::tr (","))
52 .arg (QObject::tr ("and/or"))
54 }
55
56 m_identifier = attributes.value(DOCUMENT_SERIALIZE_IDENTIFIER).toString();
57 m_valueBefore = attributes.value(DOCUMENT_SERIALIZE_GRAPH_BEFORE).toDouble();
58 m_valueAfter = attributes.value(DOCUMENT_SERIALIZE_GRAPH_AFTER).toDouble();
59}
const QString DOCUMENT_SERIALIZE_IDENTIFIER
const QString DOCUMENT_SERIALIZE_GRAPH_AFTER
const QString DOCUMENT_SERIALIZE_GRAPH_BEFORE
void xmlExitWithError(QXmlStreamReader &reader, const QString &message)
Show specified message for an error while reading xml, then quit.
Definition Xml.cpp:25

◆ ~CmdGuidelineMoveYR()

CmdGuidelineMoveYR::~CmdGuidelineMoveYR ( )
virtual

Definition at line 61 of file CmdGuidelineMoveYR.cpp.

62{
63}

Member Function Documentation

◆ cmdRedo()

void CmdGuidelineMoveYR::cmdRedo ( )
virtual

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

Implements CmdAbstract.

Definition at line 65 of file CmdGuidelineMoveYR.cpp.

66{
67 LOG4CPP_INFO_S ((*mainCat)) << "CmdGuidelineMoveYR::cmdRedo"
68 << " identifier=" << m_identifier.toLatin1().data()
69 << " value=" << m_valueAfter;
70
71 mainWindow().guidelineMoveYR (m_identifier,
72 m_valueAfter);
73}
void guidelineMoveYR(const QString &identifier, double yRAfter)
Move a Y/R Guideline.

◆ cmdUndo()

void CmdGuidelineMoveYR::cmdUndo ( )
virtual

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

Implements CmdAbstract.

Definition at line 75 of file CmdGuidelineMoveYR.cpp.

76{
77 LOG4CPP_INFO_S ((*mainCat)) << "CmdGuidelineMoveYR::cmdUndo"
78 << " identifier=" << m_identifier.toLatin1().data()
79 << " value=" << m_valueBefore;
80
81 mainWindow().guidelineMoveYR (m_identifier,
82 m_valueBefore);
83}

◆ saveXml()

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

Save commands as xml for later uploading.

Implements CmdAbstract.

Definition at line 85 of file CmdGuidelineMoveYR.cpp.

86{
87 writer.writeStartElement(DOCUMENT_SERIALIZE_CMD);
89 writer.writeAttribute(DOCUMENT_SERIALIZE_CMD_DESCRIPTION, QUndoCommand::text ());
90 writer.writeAttribute(DOCUMENT_SERIALIZE_IDENTIFIER, m_identifier);
91 writer.writeAttribute(DOCUMENT_SERIALIZE_GRAPH_BEFORE, QString::number (m_valueBefore));
92 writer.writeAttribute(DOCUMENT_SERIALIZE_GRAPH_AFTER, QString::number (m_valueAfter));
93 writer.writeEndElement();
94}
const QString DOCUMENT_SERIALIZE_CMD_GUIDELINE_MOVE_Y_R
const QString DOCUMENT_SERIALIZE_CMD
const QString DOCUMENT_SERIALIZE_CMD_TYPE
const QString DOCUMENT_SERIALIZE_CMD_DESCRIPTION

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