Engauge Digitizer 2
Loading...
Searching...
No Matches
BackgroundStateContext.h
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"
11#include "BackgroundStateAbstractBase.h"
12#include <QVector>
13
16class GraphicsView;
17class MainWindow;
18class QGraphicsPixmapItem;
19class Transformation;
20
33{
34 public:
37
39 void close();
40
42 void fitInView (GraphicsView &view);
43
45 QImage imageForCurveState () const;
46
48 void requestStateTransition (BackgroundState backgroundState);
49
51 void setBackgroundImage (BackgroundImage backgroundImage);
52
55 void setCurveSelected (const Transformation &transformation,
56 const DocumentModelGridRemoval &modelGridRemoval,
57 const DocumentModelColorFilter &modelColorFilter,
58 const QString &curveSelected);
59
61 void setPixmap (const Transformation &transformation,
62 const DocumentModelGridRemoval &modelGridRemoval,
63 const DocumentModelColorFilter &modelColorFilter,
64 const QPixmap &pixmapOriginal);
65
67 void updateColorFilter (const Transformation &transformation,
68 const DocumentModelGridRemoval &modelGridRemoval,
69 const DocumentModelColorFilter &colorFilter);
70
71 private:
73
74 void completeRequestedStateTransitionIfExists ();
75
76 const MainWindow &m_mainWindow;
77
78 QVector<BackgroundStateAbstractBase*> m_states;
79 BackgroundState m_currentState;
80 BackgroundState m_requestedState; // Same as m_currentState until requestStateTransition is called
81};
82
83#endif // BACKGROUND_STATE_CONTEXT_H
Context class that manages the background image state machine.
void updateColorFilter(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter)
Apply color filter settings.
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 setCurveSelected(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QString &curveSelected)
Update the selected curve.
void close()
Open Document is being closed so remove the background.
void setPixmap(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QPixmap &pixmapOriginal)
Update the images of all states, rather than just the current state.
void requestStateTransition(BackgroundState backgroundState)
Initiate state transition to be performed later, when BackgroundState is off the stack.
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:78
Affine transformation between screen and graph coordinates, based on digitized axis points.