Engauge Digitizer 2
Loading...
Searching...
No Matches
DigitizeStateSelect.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 DIGITIZE_STATE_SELECT_H
8#define DIGITIZE_STATE_SELECT_H
9
11
12class MainWindow;
13
22{
23public:
26 virtual ~DigitizeStateSelect();
27
28 virtual QString activeCurve () const;
29 virtual void begin(CmdMediator *cmdMediator,
30 DigitizeState previousState);
31 virtual bool canPaste (const Transformation &transformation,
32 const QSize &viewSize) const;
33 virtual QCursor cursor (CmdMediator *cmdMediator) const;
34 virtual void end();
35 virtual bool guidelinesAreSelectable () const;
36 virtual void handleContextMenuEventAxis (CmdMediator *cmdMediator,
37 const QString &pointIdentifier);
38 virtual void handleContextMenuEventGraph (CmdMediator *cmdMediator,
39 const QStringList &pointIdentifiers);
40 virtual void handleCurveChange(CmdMediator *cmdMediator);
41 virtual void handleKeyPress (CmdMediator *cmdMediator,
42 Qt::Key key,
43 bool atLeastOneSelectedItem);
44 virtual void handleMouseMove (CmdMediator *cmdMediator,
45 QPointF posScreen);
46 virtual void handleMousePress (CmdMediator *cmdMediator,
47 QPointF posScreen);
48 virtual void handleMouseRelease (CmdMediator *cmdMediator,
49 QPointF posScreen);
50 virtual QString state() const;
51 virtual void updateAfterPointAddition ();
52 virtual void updateModelDigitizeCurve (CmdMediator *cmdMediator,
53 const DocumentModelDigitizeCurve &modelDigitizeCurve);
54 virtual void updateModelSegments(const DocumentModelSegments &modelSegments);
55
56private:
58
59 void addHoverHighlighting();
60 void handleContextMenuEventAxis2 (CmdMediator *cmdMediator);
61 void handleContextMenuEventAxis34 (CmdMediator *cmdMediator,
62 const QString &pointIdentifier);
63 QString moveTextFromDeltaScreen (const QPointF &deltaScreen);
64 void removeHoverHighlighting();
65 double scaleBarLength (CmdMediator *cmdMediator) const;
66 QString scaleBarPointIdentifier (CmdMediator *cmdMediator) const;
67 void setHoverHighlighting(const MainWindowModel &modelMainWindow);
68 void showCoordinatesIfSinglePointIsSelected ();
69
70 // Click and drag cases are:
71 // 1) rubber band selection
72 // Result = selection of any items inside the rubber band but no movement
73 // 2) selection and moving with no initially selected items.
74 // Result = selection and movement of item under cursor
75 // 3) selection and moving with only item under cursor initially selected
76 // Result = same result as case #2
77 // 4) selection and moving with item under cursor not initially selected but other item(s) selected
78 // Result = other items get unselected so the result is the same as case #2 but with some items now unselected
79 // 5) selection and moving with item under cursor initially selected along with other selected items
80 // Result = all selected items get moved
81 // Originally, determining if any object was under the cursor during mousePressEvent was done with various hit tests, but
82 // none were 100% consistent with the internal hit test done by the QGraphicsView. The solution was to simply:
83 // 1) Mark all items as unmoved when the mousePressEvent occurs
84 // 2) Mark items that undergo QGraphicsItem::ItemScaleHasChanged as having moved
85 // 3) Harvest the results when the mouseReleaseEvent occurs
86 // All moved items then have the currentCursorPosition - m_movingStart translation applied to them
87 QPointF m_movingStart;
88};
89
90#endif // DIGITIZE_STATE_SELECT_H
DigitizeState
Set of possible states of Digitize toolbar.
Command queue stack.
Definition CmdMediator.h:24
DigitizeStateAbstractBase(DigitizeStateContext &context)
Single constructor.
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses,...
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
virtual void begin(CmdMediator *cmdMediator, DigitizeState previousState)
Method that is called at the exact moment a state is entered.
virtual QCursor cursor(CmdMediator *cmdMediator) const
Returns the state-specific cursor shape.
virtual bool canPaste(const Transformation &transformation, const QSize &viewSize) const
Return true if there is good data in the clipboard for pasting, and that is compatible with the curre...
virtual void updateAfterPointAddition()
Update graphics attributes after possible new points. This is useful for highlight opacity.
virtual void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
virtual void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.
virtual void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
Handle a right click, on a graph point, that was intercepted earlier.
virtual bool guidelinesAreSelectable() const
Enable/disable guidelines according to state.
virtual void handleMouseRelease(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse release that was intercepted earlier.
virtual void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
Handle a key press that was intercepted earlier.
virtual void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)
Handle a right click, on an axis point, that was intercepted earlier.
virtual void handleMousePress(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse press that was intercepted earlier.
virtual void handleMouseMove(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse move. This is part of an experiment to see if augmenting the cursor in Point Match mod...
virtual void handleCurveChange(CmdMediator *cmdMediator)
Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Se...
DigitizeStateSelect(DigitizeStateContext &context)
Single constructor.
virtual QString state() const
State name for debugging.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Model for DlgSettingsSegments and CmdSettingsSegments.
Model for DlgSettingsMainWindow.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:95
Affine transformation between screen and graph coordinates, based on digitized axis points.