Engauge Digitizer 2
Loading...
Searching...
No Matches
CmdSelectCoordSystem.cpp
1/******************************************************************************************************
2 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#include "CmdSelectCoordSystem.h"
8#include "DataKey.h"
9#include "Document.h"
10#include "DocumentSerialize.h"
11#include "EngaugeAssert.h"
12#include "Logger.h"
13#include "MainWindow.h"
14#include "MimePoints.h"
15#include <QApplication>
16#include <QClipboard>
17#include <QTextStream>
18#include "QtToString.h"
19#include <QXmlStreamReader>
20
21const QString CMD_DESCRIPTION ("Select Coordinate System");
22
24 Document &document,
25 CoordSystemIndex coordSystemIndex) :
26 CmdAbstract(mainWindow,
27 document,
28 CMD_DESCRIPTION),
29 m_coordSystemIndexBefore (document.coordSystemIndex()),
30 m_coordSystemIndexAfter (coordSystemIndex)
31{
32 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::CmdSelectCoordSystem";
33}
34
36 Document &document,
37 const QString &cmdDescription,
38 QXmlStreamReader & /* reader */) :
39 CmdAbstract (mainWindow,
40 document,
41 cmdDescription)
42{
43 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::CmdSelectCoordSystem";
44}
45
46CmdSelectCoordSystem::~CmdSelectCoordSystem ()
47{
48}
49
51{
52 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::cmdRedo"
53 << " index=" << m_coordSystemIndexBefore << "->" << m_coordSystemIndexAfter;
54
55 mainWindow().updateCoordSystem (m_coordSystemIndexAfter);
56}
57
59{
60 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::cmdUndo"
61 << " index=" << m_coordSystemIndexAfter << "->" << m_coordSystemIndexBefore;
62
63 mainWindow().updateCoordSystem (m_coordSystemIndexBefore);
64}
65
66void CmdSelectCoordSystem::saveXml (QXmlStreamWriter &writer) const
67{
68 writer.writeStartElement(DOCUMENT_SERIALIZE_CMD);
69 writer.writeEndElement();
70}
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand.
Definition CmdAbstract.h:19
MainWindow & mainWindow()
Return the MainWindow so it can be updated by this command as a last step.
CmdSelectCoordSystem(MainWindow &mainWindow, Document &document, CoordSystemIndex coordSystem)
Constructor for normal creation.
virtual void cmdUndo()
Undo method that is called when QUndoStack is moved one command backward.
virtual void cmdRedo()
Redo method that is called when QUndoStack is moved one command forward.
virtual void saveXml(QXmlStreamWriter &writer) const
Save commands as xml for later uploading.
Storage of one imported image and the data attached to that image.
Definition Document.h:41
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:78
void updateCoordSystem(CoordSystemIndex coordSystemIndex)
Select a different CoordSystem.