Engauge Digitizer  2
DigitizeStateEmpty.cpp
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 #include "DigitizeStateEmpty.h"
8 #include "DigitizeStateContext.h"
9 #include "Logger.h"
10 #include "MainWindow.h"
11 #include <QCursor>
12 #include <QSize>
13 #include "Transformation.h"
14 
17 {
18 }
19 
21 {
22 }
23 
24 QString DigitizeStateEmpty::activeCurve () const
25 {
26  return "";
27 }
28 
29 void DigitizeStateEmpty::begin (CmdMediator *cmdMediator,
30  DigitizeState /* previousState */)
31 {
32  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateEmpty::begin";
33 
34  setCursor(cmdMediator);
36 }
37 
38 bool DigitizeStateEmpty::canPaste (const Transformation & /* transformation */,
39  const QSize & /* size */) const
40 {
41  return false;
42 }
43 
44 QCursor DigitizeStateEmpty::cursor(CmdMediator * /* cmdMediator */) const
45 {
46  LOG4CPP_DEBUG_S ((*mainCat)) << "DigitizeStateEmpty::cursor";
47 
48  return QCursor (Qt::ArrowCursor);
49 }
50 
52 {
53  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateEmpty::end";
54 }
55 
57  const QString &pointIdentifier)
58 {
59  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateEmpty::handleContextMenuEventAxis "
60  << " point=" << pointIdentifier.toLatin1 ().data ();
61 }
62 
64  const QStringList &pointIdentifiers)
65 {
66  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateEmpty ::handleContextMenuEventGraph "
67  << "points=" << pointIdentifiers.join(",").toLatin1 ().data ();
68 }
69 
70 void DigitizeStateEmpty::handleCurveChange(CmdMediator * /* cmdMediator */)
71 {
72  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateEmpty::handleCurveChange";
73 }
74 
75 void DigitizeStateEmpty::handleKeyPress (CmdMediator * /* cmdMediator */,
76  Qt::Key key,
77  bool /* atLeastOneSelectedItem */)
78 {
79  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateEmpty::handleKeyPress"
80  << " key=" << QKeySequence (key).toString ().toLatin1 ().data ();
81 }
82 
83 void DigitizeStateEmpty::handleMouseMove (CmdMediator * /* cmdMediator */,
84  QPointF /* posScreen */)
85 {
86 // LOG4CPP_DEBUG_S ((*mainCat)) << "DigitizeStateEmpty::handleMouseMove";
87 }
88 
89 void DigitizeStateEmpty::handleMousePress (CmdMediator * /* cmdMediator */,
90  QPointF /* posScreen */)
91 {
92  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateEmpty::handleMousePress";
93 }
94 
95 void DigitizeStateEmpty::handleMouseRelease (CmdMediator * /* cmdMediator */,
96  QPointF /* posScreen */)
97 {
98  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateEmpty::handleMouseRelease";
99 }
100 
101 QString DigitizeStateEmpty::state() const
102 {
103  return "DigitizeStateEmpty";
104 }
105 
107 {
108  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateEmpty::updateAfterPointAddition";
109 }
110 
112  const DocumentModelDigitizeCurve & /*modelDigitizeCurve */)
113 {
114  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateEmpty::updateModelDigitizeCurve";
115 }
116 
117 void DigitizeStateEmpty::updateModelSegments(const DocumentModelSegments & /* modelSegments */)
118 {
119  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateEmpty::updateModelSegments";
120 }
DigitizeStateEmpty::handleCurveChange
virtual void handleCurveChange(CmdMediator *cmdMediator)
Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Se...
Definition: DigitizeStateEmpty.cpp:69
DigitizeStateEmpty::canPaste
virtual bool canPaste(const Transformation &transformation, const QSize &viewSize) const
Return true if there is good data in the clipboard for pasting, and that is compatible with the curre...
Definition: DigitizeStateEmpty.cpp:37
DigitizeStateContext
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
Definition: DigitizeStateContext.h:26
DigitizeStateAbstractBase::context
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses,...
Definition: DigitizeStateAbstractBase.cpp:41
DigitizeStateEmpty::handleMouseRelease
virtual void handleMouseRelease(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse release that was intercepted earlier.
Definition: DigitizeStateEmpty.cpp:94
DigitizeStateEmpty::DigitizeStateEmpty
DigitizeStateEmpty(DigitizeStateContext &context)
Single constructor.
Definition: DigitizeStateEmpty.cpp:14
DigitizeStateEmpty::activeCurve
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.
Definition: DigitizeStateEmpty.cpp:23
DigitizeStateContext::mainWindow
MainWindow & mainWindow()
Reference to the MainWindow, without const.
Definition: DigitizeStateContext.cpp:168
DigitizeStateEmpty::handleContextMenuEventGraph
virtual void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
Handle a right click, on a graph point, that was intercepted earlier.
Definition: DigitizeStateEmpty.cpp:62
Transformation
Affine transformation between screen and graph coordinates, based on digitized axis points.
Definition: Transformation.h:30
DigitizeStateContext.h
DigitizeStateEmpty::end
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...
Definition: DigitizeStateEmpty.cpp:50
DigitizeStateEmpty::updateModelSegments
virtual void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
Definition: DigitizeStateEmpty.cpp:116
DigitizeStateEmpty::begin
virtual void begin(CmdMediator *cmdMediator, DigitizeState previousState)
Method that is called at the exact moment a state is entered.
Definition: DigitizeStateEmpty.cpp:28
DigitizeStateEmpty::updateModelDigitizeCurve
virtual void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
Definition: DigitizeStateEmpty.cpp:110
DigitizeStateEmpty::updateAfterPointAddition
virtual void updateAfterPointAddition()
Update graphics attributes after possible new points. This is useful for highlight opacity.
Definition: DigitizeStateEmpty.cpp:105
DigitizeStateEmpty::handleKeyPress
virtual void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
Handle a key press that was intercepted earlier.
Definition: DigitizeStateEmpty.cpp:74
Transformation.h
Logger.h
DigitizeState
DigitizeState
Set of possible states of Digitize toolbar.
Definition: DigitizeStateAbstractBase.h:23
DigitizeStateEmpty::handleMouseMove
virtual void handleMouseMove(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse move. This is part of an experiment to see if augmenting the cursor in Point Match mod...
Definition: DigitizeStateEmpty.cpp:82
LOG4CPP_INFO_S
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
DigitizeStateEmpty::~DigitizeStateEmpty
virtual ~DigitizeStateEmpty()
Definition: DigitizeStateEmpty.cpp:19
DigitizeStateEmpty::cursor
virtual QCursor cursor(CmdMediator *cmdMediator) const
Returns the state-specific cursor shape.
Definition: DigitizeStateEmpty.cpp:43
DigitizeStateEmpty.h
DocumentModelSegments
Model for DlgSettingsSegments and CmdSettingsSegments.
Definition: DocumentModelSegments.h:16
DigitizeStateAbstractBase::setCursor
void setCursor(CmdMediator *cmdMediator)
Update the cursor according to the current state.
Definition: DigitizeStateAbstractBase.cpp:51
mainCat
log4cpp::Category * mainCat
Definition: Logger.cpp:14
MainWindow.h
DocumentModelDigitizeCurve
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Definition: DocumentModelDigitizeCurve.h:17
CmdMediator
Command queue stack.
Definition: CmdMediator.h:22
DigitizeStateEmpty::handleContextMenuEventAxis
virtual void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)
Handle a right click, on an axis point, that was intercepted earlier.
Definition: DigitizeStateEmpty.cpp:55
LOG4CPP_DEBUG_S
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20
DigitizeStateAbstractBase
Base class for all digitizing states. This serves as an interface to DigitizeStateContext.
Definition: DigitizeStateAbstractBase.h:36
DigitizeStateEmpty::handleMousePress
virtual void handleMousePress(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse press that was intercepted earlier.
Definition: DigitizeStateEmpty.cpp:88
DigitizeStateEmpty::state
virtual QString state() const
State name for debugging.
Definition: DigitizeStateEmpty.cpp:100
MainWindow::updateViewsOfSettings
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...
Definition: MainWindow.cpp:3797