Engauge Digitizer 2
Loading...
Searching...
No Matches
BackgroundStateContext.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 BACKGROUND_STATE_CONTEXT_H
8#define BACKGROUND_STATE_CONTEXT_H
9
10#include "BackgroundImage.h"
12#include <QVector>
13
16class GraphicsView;
17class MainWindow;
18class QGraphicsPixmapItem;
19class Transformation;
20
33{
34 public:
37
40
42 void close();
43
45 void fitInView (GraphicsView &view);
46
48 QImage imageForCurveState () const;
49
51 void requestStateTransition (BackgroundState backgroundState);
52
54 void setBackgroundImage (BackgroundImage backgroundImage);
55
58 void setCurveSelected (bool isGnuplot,
59 const Transformation &transformation,
60 const DocumentModelGridRemoval &modelGridRemoval,
61 const DocumentModelColorFilter &modelColorFilter,
62 const QString &curveSelected);
63
65 void setPixmap (bool isGnuplot,
66 const Transformation &transformation,
67 const DocumentModelGridRemoval &modelGridRemoval,
68 const DocumentModelColorFilter &modelColorFilter,
69 const QPixmap &pixmapOriginal,
70 const QString &curveSelected);
71
73 void updateColorFilter (bool isGnuplot,
74 const Transformation &transformation,
75 const DocumentModelGridRemoval &modelGridRemoval,
76 const DocumentModelColorFilter &colorFilter,
77 const QString &curveSelected);
78
79 private:
81
82 void completeRequestedStateTransitionIfExists ();
83
84 const MainWindow &m_mainWindow;
85
86 QVector<BackgroundStateAbstractBase*> m_states;
87 BackgroundState m_currentState;
88 BackgroundState m_requestedState; // Same as m_currentState until requestStateTransition is called
89};
90
91#endif // BACKGROUND_STATE_CONTEXT_H
BackgroundImage
Background selection.
BackgroundState
Set of possible states of background image.
Context class that manages the background image state machine.
void setPixmap(bool isGnuplot, const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QPixmap &pixmapOriginal, const QString &curveSelected)
Update the images of all states, rather than just the current state.
void setBackgroundImage(BackgroundImage backgroundImage)
Transition to the specified state. This method is used by classes outside of the state machine to tri...
QImage imageForCurveState() const
Image for the Curve state, even if the current state is different.
void fitInView(GraphicsView &view)
Zoom so background fills the window.
void updateColorFilter(bool isGnuplot, const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter, const QString &curveSelected)
Apply color filter settings.
void close()
Open Document is being closed so remove the background.
void requestStateTransition(BackgroundState backgroundState)
Initiate state transition to be performed later, when BackgroundState is off the stack.
~BackgroundStateContext()
Destructor deallocates memory.
void setCurveSelected(bool isGnuplot, const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QString &curveSelected)
Update the selected curve.
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
QGraphicsView class with event handling added. Typically the events are sent to the active digitizing...
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:92
Affine transformation between screen and graph coordinates, based on digitized axis points.