Engauge Digitizer 2
|
Context class that manages the background image state machine. More...
#include <BackgroundStateContext.h>
Public Member Functions | |
BackgroundStateContext (MainWindow &mainWindow) | |
Single constructor. | |
~BackgroundStateContext () | |
Destructor deallocates memory. | |
void | close () |
Open Document is being closed so remove the background. | |
void | fitInView (GraphicsView &view) |
Zoom so background fills the window. | |
QImage | imageForCurveState () const |
Image for the Curve state, even if the current state is different. | |
void | requestStateTransition (BackgroundState backgroundState) |
Initiate state transition to be performed later, when BackgroundState is off the stack. | |
void | setBackgroundImage (BackgroundImage backgroundImage) |
Transition to the specified state. This method is used by classes outside of the state machine to trigger transitions. | |
void | setCurveSelected (bool isGnuplot, const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QString &curveSelected) |
Update the selected curve. | |
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 | updateColorFilter (bool isGnuplot, const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter, const QString &curveSelected) |
Apply color filter settings. | |
Context class that manages the background image state machine.
Overall strategy is that changing the currently selected curve should not affect the background image if the original image is being shown, or no image is being shown. However, if the curve-specific color filter image is being shown, then it should be replaced by the filtered image specific to the new curve.
Other considerations are that the processing should be robust in terms of ordering of the following incoming events:
Definition at line 32 of file BackgroundStateContext.h.
BackgroundStateContext::BackgroundStateContext | ( | MainWindow & | mainWindow | ) |
Single constructor.
Definition at line 21 of file BackgroundStateContext.cpp.
BackgroundStateContext::~BackgroundStateContext | ( | ) |
Destructor deallocates memory.
Definition at line 38 of file BackgroundStateContext.cpp.
void BackgroundStateContext::close | ( | ) |
Open Document is being closed so remove the background.
Definition at line 43 of file BackgroundStateContext.cpp.
void BackgroundStateContext::fitInView | ( | GraphicsView & | view | ) |
Zoom so background fills the window.
Definition at line 72 of file BackgroundStateContext.cpp.
QImage BackgroundStateContext::imageForCurveState | ( | ) | const |
Image for the Curve state, even if the current state is different.
Definition at line 93 of file BackgroundStateContext.cpp.
void BackgroundStateContext::requestStateTransition | ( | BackgroundState | backgroundState | ) |
Initiate state transition to be performed later, when BackgroundState is off the stack.
Definition at line 98 of file BackgroundStateContext.cpp.
void BackgroundStateContext::setBackgroundImage | ( | BackgroundImage | backgroundImage | ) |
Transition to the specified state. This method is used by classes outside of the state machine to trigger transitions.
Definition at line 105 of file BackgroundStateContext.cpp.
void BackgroundStateContext::setCurveSelected | ( | bool | isGnuplot, |
const Transformation & | transformation, | ||
const DocumentModelGridRemoval & | modelGridRemoval, | ||
const DocumentModelColorFilter & | modelColorFilter, | ||
const QString & | curveSelected ) |
Update the selected curve.
Although this probably affects only the BACKGROUND_STATE_CURVE state, we will forward it to all states (consistent with setPixmap)
Definition at line 131 of file BackgroundStateContext.cpp.
void BackgroundStateContext::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.
Definition at line 150 of file BackgroundStateContext.cpp.
void BackgroundStateContext::updateColorFilter | ( | bool | isGnuplot, |
const Transformation & | transformation, | ||
const DocumentModelGridRemoval & | modelGridRemoval, | ||
const DocumentModelColorFilter & | colorFilter, | ||
const QString & | curveSelected ) |
Apply color filter settings.
Definition at line 172 of file BackgroundStateContext.cpp.