Engauge Digitizer 2
Loading...
Searching...
No Matches
CmdAbstract.h
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#ifndef CMD_ABSTRACT_H
8#define CMD_ABSTRACT_H
9
10#include "PointIdentifiers.h"
11#include <QUndoCommand>
12
13class Document;
14class MainWindow;
15class QXmlStreamWriter;
16
18class CmdAbstract : public QUndoCommand
19{
20public:
24 const QString &cmdDescription);
25
26 virtual ~CmdAbstract();
27
29 virtual void cmdRedo () = 0;
30
32 virtual void cmdUndo () = 0;
33
35 virtual void saveXml (QXmlStreamWriter &writer) const = 0;
36
37protected:
40
42 const Document &document() const;
43
46
49 void resetSelection(const PointIdentifiers &pointIdentifiersToSelect);
50
51private:
53
54 virtual void redo (); // Calls cmdRedo
55 virtual void undo (); // Calls cmdUndo
56
57 MainWindow &m_mainWindow;
58 Document &m_document;
59
60 // Snapshots of GraphicsPointAbstractBase::identifierIndex before and after redo
61 bool m_isFirstRedo;
62 unsigned int m_identifierIndexBeforeRedo;
63 unsigned int m_identifierIndexAfterRedo;
64};
65
66#endif // CMD_ABSTRACT_H
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand.
Definition CmdAbstract.h:19
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.
virtual void cmdUndo()=0
Undo method that is called when QUndoStack is moved one command backward.
void resetSelection(const PointIdentifiers &pointIdentifiersToSelect)
Since the set of selected points has probably changed, changed that set back to the specified set.
virtual void saveXml(QXmlStreamWriter &writer) const =0
Save commands as xml for later uploading.
virtual void cmdRedo()=0
Redo method that is called when QUndoStack is moved one command forward.
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
Hash table class that tracks point identifiers as the key, with a corresponding boolean value.