Engauge Digitizer 2
Loading...
Searching...
No Matches
DigitizeStateAbstractBase.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 DIGITIZE_STATE_ABSTRACT_BASE_H
8#define DIGITIZE_STATE_ABSTRACT_BASE_H
9
10#include "DigitizeState.h"
11#include "PointStyle.h"
12#include <QCursor>
13#include <QPointF>
14
15class CmdMediator;
19class QSize;
20class QString;
21class Transformation;
22
25{
26public:
30
32 virtual QString activeCurve () const = 0;
33
36 virtual void begin(CmdMediator *cmdMediator,
37 DigitizeState previousState) = 0;
38
40 virtual bool canPaste (const Transformation &transformation,
41 const QSize &viewSize) const = 0;
42
45
47 const DigitizeStateContext &context() const;
48
50 virtual void end() = 0;
51
53 virtual bool guidelinesAreSelectable () const = 0;
54
56 virtual void handleContextMenuEventAxis (CmdMediator *cmdMediator,
57 const QString &pointIdentifier) = 0;
58
60 virtual void handleContextMenuEventGraph (CmdMediator *cmdMediator,
61 const QStringList &pointIdentifiers) = 0;
62
64 virtual void handleCurveChange (CmdMediator *cmdMediator) = 0;
65
67 virtual void handleKeyPress (CmdMediator *cmdMediator,
68 Qt::Key key,
69 bool atLeastOneSelectedItem) = 0;
70
72 virtual void handleMouseMove (CmdMediator *cmdMediator,
73 QPointF posScreen) = 0;
74
76 virtual void handleMousePress (CmdMediator *cmdMediator,
77 QPointF pos) = 0;
78
80 virtual void handleMouseRelease (CmdMediator *cmdMediator,
81 QPointF pos) = 0;
82
84 void setCursor(CmdMediator *cmdMediator);
85
87 virtual QString state() const = 0;
88
90 virtual void updateAfterPointAddition () = 0;
91
93 virtual void updateModelDigitizeCurve (CmdMediator *cmdMediator,
94 const DocumentModelDigitizeCurve &modelDigitizeCurve) = 0;
95
97 virtual void updateModelSegments(const DocumentModelSegments &modelSegments) = 0;
98
99protected:
101 bool canPasteProtected (const Transformation &transformation,
102 const QSize &viewSize) const;
103
105 virtual QCursor cursor (CmdMediator *cmdMediator) const = 0;
106
108 virtual void handleKeyPressArrow (CmdMediator *cmdMediator,
109 Qt::Key key,
110 bool atLeastOneSelectedItem);
111
113 QString moveTextDown () const;
114
116 QString moveTextLeft () const;
117
119 QString moveTextRight () const;
120
122 QString moveTextUp () const;
123
124private:
126
127 void keyPressArrow (CmdMediator *cmdMediator,
128 Qt::Key key);
129 double zoomedToUnzoomedScreenX () const;
130 double zoomedToUnzoomedScreenY () const;
131
132 DigitizeStateContext &m_context;
133
134};
135
136#endif // DIGITIZE_STATE_ABSTRACT_BASE_H
DigitizeState
Set of possible states of Digitize toolbar.
Command queue stack.
Definition CmdMediator.h:24
virtual void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)=0
Handle a right click, on an axis point, that was intercepted earlier.
QString moveTextUp() const
Display text for up arrow.
QString moveTextDown() const
Display text for down arrow.
QString moveTextLeft() const
Display text for left arrow.
virtual void end()=0
Method that is called at the exact moment a state is exited. Typically called just before begin for t...
virtual void updateModelSegments(const DocumentModelSegments &modelSegments)=0
Update the segments given the new settings.
virtual void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)=0
Handle a right click, on a graph point, that was intercepted earlier.
virtual void handleKeyPressArrow(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
If the key is an arrow (left, right, up, down) then move currently selected items.
virtual bool canPaste(const Transformation &transformation, const QSize &viewSize) const =0
Return true if there is good data in the clipboard for pasting, and that is compatible with the curre...
virtual void handleCurveChange(CmdMediator *cmdMediator)=0
Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Se...
DigitizeStateAbstractBase(DigitizeStateContext &context)
Single constructor.
virtual QString activeCurve() const =0
Name of the active Curve. This can include AXIS_CURVE_NAME.
QString moveTextRight() const
Display text for right arrow.
virtual void handleMousePress(CmdMediator *cmdMediator, QPointF pos)=0
Handle a mouse press that was intercepted earlier.
virtual void begin(CmdMediator *cmdMediator, DigitizeState previousState)=0
Method that is called at the exact moment a state is entered.
virtual void handleMouseMove(CmdMediator *cmdMediator, QPointF posScreen)=0
Handle a mouse move. This is part of an experiment to see if augmenting the cursor in Point Match mod...
virtual QCursor cursor(CmdMediator *cmdMediator) const =0
Returns the state-specific cursor shape.
bool canPasteProtected(const Transformation &transformation, const QSize &viewSize) const
Protected version of canPaste method. Some, but not all, leaf classes use this method.
virtual bool guidelinesAreSelectable() const =0
Enable/disable guidelines according to state.
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses,...
virtual void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)=0
Update the digitize curve settings.
virtual void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)=0
Handle a key press that was intercepted earlier.
void setCursor(CmdMediator *cmdMediator)
Update the cursor according to the current state.
virtual void updateAfterPointAddition()=0
Update graphics attributes after possible new points. This is useful for highlight opacity.
virtual void handleMouseRelease(CmdMediator *cmdMediator, QPointF pos)=0
Handle a mouse release that was intercepted earlier.
virtual QString state() const =0
State name for debugging.
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Model for DlgSettingsSegments and CmdSettingsSegments.
Affine transformation between screen and graph coordinates, based on digitized axis points.