Engauge Digitizer
2
Loading...
Searching...
No Matches
Cmd
CmdAbstract.h
Go to the documentation of this file.
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 "
DocumentHash.h
"
11
#include "
PointIdentifiers.h
"
12
#include <QUndoCommand>
13
14
class
Document
;
15
class
MainWindow
;
16
class
QXmlStreamWriter;
17
19
class
CmdAbstract
:
public
QUndoCommand
20
{
21
public
:
23
CmdAbstract
(
MainWindow
&
mainWindow
,
24
Document
&
document
,
25
const
QString &cmdDescription);
26
27
virtual
~CmdAbstract
();
28
30
virtual
void
cmdRedo
() = 0;
31
33
virtual
void
cmdUndo
() = 0;
34
36
virtual
void
saveXml
(QXmlStreamWriter &writer)
const
= 0;
37
38
protected
:
40
Document
&
document
();
41
43
const
Document
&
document
()
const
;
44
46
MainWindow
&
mainWindow
();
47
50
void
resetSelection
(
const
PointIdentifiers
&pointIdentifiersToSelect);
51
55
void
saveOrCheckPostCommandDocumentStateHash
(
const
Document
&
document
);
56
60
void
saveOrCheckPreCommandDocumentStateHash
(
const
Document
&
document
);
61
62
private
:
63
CmdAbstract
();
64
65
virtual
void
redo ();
// Calls cmdRedo
66
virtual
void
undo ();
// Calls cmdUndo
67
68
MainWindow
&m_mainWindow;
69
Document
&m_document;
70
71
// Snapshots of GraphicsPointAbstractBase::identifierIndex before and after redo
72
bool
m_isFirstRedo;
73
unsigned
int
m_identifierIndexBeforeRedo;
74
unsigned
int
m_identifierIndexAfterRedo;
75
76
// Hash value that represents Document state before and after CmdAbstract::redo
77
DocumentHash
m_documentHashPost;
78
DocumentHash
m_documentHashPre;
79
};
80
81
#endif
// CMD_ABSTRACT_H
DocumentHash.h
DocumentHash
QByteArray DocumentHash
Definition
DocumentHash.h:12
PointIdentifiers.h
CmdAbstract
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand.
Definition
CmdAbstract.h:20
CmdAbstract::document
Document & document()
Return the Document that this command will modify during redo and undo.
Definition
CmdAbstract.cpp:35
CmdAbstract::mainWindow
MainWindow & mainWindow()
Return the MainWindow so it can be updated by this command as a last step.
Definition
CmdAbstract.cpp:45
CmdAbstract::cmdUndo
virtual void cmdUndo()=0
Undo method that is called when QUndoStack is moved one command backward.
CmdAbstract::saveOrCheckPostCommandDocumentStateHash
void saveOrCheckPostCommandDocumentStateHash(const Document &document)
Save, when called the first time, a hash value representing the state of the Document.
Definition
CmdAbstract.cpp:102
CmdAbstract::saveOrCheckPreCommandDocumentStateHash
void saveOrCheckPreCommandDocumentStateHash(const Document &document)
Save, when called the first time, a hash value representing the state of the Document.
Definition
CmdAbstract.cpp:125
CmdAbstract::resetSelection
void resetSelection(const PointIdentifiers &pointIdentifiersToSelect)
Since the set of selected points has probably changed, changed that set back to the specified set.
Definition
CmdAbstract.cpp:81
CmdAbstract::saveXml
virtual void saveXml(QXmlStreamWriter &writer) const =0
Save commands as xml for later uploading.
CmdAbstract::~CmdAbstract
virtual ~CmdAbstract()
Definition
CmdAbstract.cpp:31
CmdAbstract::cmdRedo
virtual void cmdRedo()=0
Redo method that is called when QUndoStack is moved one command forward.
Document
Storage of one imported image and the data attached to that image.
Definition
Document.h:42
MainWindow
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition
MainWindow.h:92
PointIdentifiers
Hash table class that tracks point identifiers as the key, with a corresponding boolean value.
Definition
PointIdentifiers.h:20
Generated on Wed Aug 3 2022 00:00:00 for Engauge Digitizer by
1.10.0