Engauge Digitizer 2
Loading...
Searching...
No Matches
GuidelineStateDiscarded.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2019 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 "EngaugeAssert.h"
8#include "GuidelineAbstract.h"
9#include "GuidelineFormat.h"
10#include "GuidelineState.h"
13#include "Logger.h"
14#include <QPen>
15#include "ZValues.h"
16
21
25
27{
28 LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDiscarded::begin"
29 << " identifier=" << context().guideline().identifier().toLatin1().data();
30
31 GuidelineFormat guidelineFormat (context().color());
32
36 context().guideline().setGraphicsItemPen (guidelineFormat.colorHidden (),
37 guidelineFormat.lineWidthNonHover ());
38}
39
41{
42 LOG4CPP_ERROR_S ((*mainCat)) << "GuidelineStateDiscarded::convertGraphCoordinateToScreenPoint "
43 << "should not be called";
44
45 ENGAUGE_ASSERT (false);
46
47 return QPointF (0, 0); // No-harm value
48}
49
50double GuidelineStateDiscarded::convertScreenPointToGraphCoordinate (const QPointF & /* posScreen */) const
51{
52 LOG4CPP_ERROR_S ((*mainCat)) << "GuidelineStateDiscarded::convertScreenPointToGraphCoordinate";
53
54 ENGAUGE_ASSERT (false);
55
56 return 0.1; // No-harm value even if using log scale
57}
58
60{
61 return false;
62}
63
65{
66 LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateDiscarded::end";
67}
68
70{
71}
72
74 bool /* locked */)
75{
76}
77
79{
80 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandle::handleHoverEnterEvent";
81
82 // Noop. Never called since hover only works when visible
83}
84
86{
87 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandle::handleHoverEnterEvent";
88
89 // Noop. Never called since hover only works when visible
90}
91
92void GuidelineStateDiscarded::handleMousePress (const QPointF & /* posScene */)
93{
94 // Noop
95}
96
97void GuidelineStateDiscarded::handleMouseRelease (const QPointF & /* posScene */)
98{
99 // Noop
100}
101
103{
104 // Noop
105}
106
108{
109 // Noop
110}
111
112EllipseParameters GuidelineStateDiscarded::pointToEllipse (const QPointF & /* poscreen */) const
113{
114 return EllipseParameters();
115}
116
117QLineF GuidelineStateDiscarded::pointToLine (const QPointF & /* posGraph */) const
118{
119 return QLineF (0, 0, 0, 0);
120}
121
126
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.
QString guidelineStateAsString(GuidelineState state)
@ GUIDELINE_STATE_DISCARDED
log4cpp::Category * mainCat
Definition Logger.cpp:14
const int Z_VALUE_GUIDELINE_DISCARDED
Definition ZValues.cpp:13
Parameters that define an ellipse about the specified center, at the specified angle from alignment w...
virtual QString identifier() const =0
Unique identifier from QGraphicsItem.
virtual void setGraphicsItemVisible(bool visible)=0
Wrapper for QGraphicsItem::setVisible.
virtual void setGraphicsItemAcceptHoverEvents(bool accept)=0
Wrapper for QGraphicsItem::setAcceptHoverEvents.
virtual void setGraphicsItemZValue(double z)=0
Wrapper for QGraphicsItem::setZValue.
virtual void setGraphicsItemPen(const QColor &color, double lineWidth)=0
Wrapper for QGraphicsItem::setPen.
This class centralizes the formatting information (color, line width, alpha) for the Guidelines.
double lineWidthNonHover() const
Guideline line width for narrow lines.
QColor colorHidden() const
Color when object is transparent but still handling (probably hover) events.
GuidelineStateContext & context() const
Context in charge of the state classes.
GuidelineStateAbstractBase(GuidelineStateContext &context)
Single constructor.
Context class for state machine that belongs to the Guideline class.
GuidelineAbstract & guideline()
Guideline that owns this context class.
virtual void handleTimeout()
Handle timeout from Appearing state.
virtual QString stateName() const
Name of state as a string for debugging only.
virtual void handleHoverEnterEvent()
If transparent then make visible when hover starts.
GuidelineStateDiscarded(GuidelineStateContext &context)
Single constructor.
virtual void handleHoverLeaveEvent()
If previously transparent before hover enter then make transparent again.
virtual bool doPaint() const
Allow/skip painting of the owner Guideline.
virtual void handleGuidelineMode(bool visible, bool locked)
User toggled Guideline visibility and/or locked mode.
virtual QLineF pointToLine(const QPointF &posScreen) const
Return line parallel to an axis line, that passes through the specified point.
virtual void updateWithLatestTransformation()
Update given Transformation in GuidelineStateContext.
virtual void handleMouseRelease(const QPointF &posScene)
At the end of dragging, clone the Guideline that owns the state machine where these states live.
virtual double convertScreenPointToGraphCoordinate(const QPointF &posScreen) const
Convert screen point pair into single graph coordinate.
virtual EllipseParameters pointToEllipse(const QPointF &posScreen) const
Return ellipse representing constant range, that passes through the specified point.
virtual QPointF convertGraphCoordinateToScreenPoint(double valueGraph) const
Convert single graph coordinate into screen point pair.
virtual void handleMousePress(const QPointF &posScene)
At the start of dragging, convert the Guideline into an invisible handle and visible slaved deployed ...
virtual void handleActiveChange(bool active)
DigitizeState change so active status may (or may not) be toggled.
virtual void end()
Transition out of state.
virtual void begin()
Transition into state.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20
#define LOG4CPP_ERROR_S(logger)
Definition convenience.h:12