Engauge Digitizer  2
DigitizeStateAbstractBase.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 "CmdMediator.h"
8 #include "DigitizeStateAbstractBase.h"
9 #include "DigitizeStateContext.h"
10 #include "Document.h"
11 #include "Logger.h"
12 #include "MainWindow.h"
13 #include "MainWindowModel.h"
14 #include "MimePointsDetector.h"
15 #include <QCursor>
16 #include <QGraphicsScene>
17 #include <QImage>
18 #include <QSize>
19 #include <QTimer>
20 #include "QtToString.h"
21 #include "Transformation.h"
22 
24  m_context (context)
25 {
26 }
27 
28 DigitizeStateAbstractBase::~DigitizeStateAbstractBase()
29 {
30 }
31 
33  const QSize &viewSize) const
34 {
35  MimePointsDetector mimePointsDetector;
36 
37  return mimePointsDetector.isMimePointsData (transformation,
38  viewSize);
39 }
40 
42 {
43  return m_context;
44 }
45 
47 {
48  return m_context;
49 }
50 
52 {
53  LOG4CPP_DEBUG_S ((*mainCat)) << "DigitizeStateAbstractBase::setCursor";
54 
55  // Note that we are setting the QGraphicsView cursor and NOT the QApplication override cursor
56  m_context.view ().setCursor (cursor (cmdMediator));
57 }
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.
bool isMimePointsData(const Transformation &transforation, const QSize &screenSize) const
Returns true if text is acceptable mime data.
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses...
Detect if text is acceptable for ingestion by MimePoints.
Affine transformation between screen and graph coordinates, based on digitized axis points...
void setCursor(CmdMediator *cmdMediator)
Update the cursor according to the current state.
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
Command queue stack.
Definition: CmdMediator.h:23
QGraphicsView & view()
QGraphicsView for use by DigitizeStateAbstractBase subclasses.
DigitizeStateAbstractBase(DigitizeStateContext &context)
Single constructor.