PenCommandObject.hpp
1 #pragma once
2 #include <Curve/Commands/UpdateCurve.hpp>
3 #include <Curve/Palette/CommandObjects/CurveCommandObjectBase.hpp>
4 #include <Curve/Segment/PointArray/PointArraySegment.hpp>
5 
6 #include <score/command/Dispatchers/SingleOngoingCommandDispatcher.hpp>
7 #include <score/tools/std/Optional.hpp>
8 
9 #include <QPoint>
10 
11 namespace Curve
12 {
13 class Model;
14 class Presenter;
15 class StateBase;
16 class SCORE_PLUGIN_CURVE_EXPORT PenCommandObject final : public CommandObjectBase
17 {
18 public:
20 
21  void setCurveState(Curve::StateBase* stateBase) { m_state = stateBase; }
22 
23  void on_press() override;
24 
25  void move();
26 
27  void release();
28 
29  void cancel();
30 
31 private:
32  using seg_tuple = std::tuple<
33  std::optional<SegmentData>, std::optional<SegmentData>, std::vector<SegmentData>>;
34  void release_n(seg_tuple&&);
35  seg_tuple filterSegments();
36  PointArraySegment m_segment;
37 
38  Curve::StateBase* m_state{};
39  QPointF m_originalPress;
40  QPointF m_minPress{}, m_maxPress{};
41 };
42 }
Definition: CurveCommandObjectBase.hpp:49
Definition: PenCommandObject.hpp:17
Definition: CurvePresenter.hpp:32
Definition: CurvePaletteBaseStates.hpp:20
A small abstraction layer over the score::CommandStack.
Definition: CommandStackFacade.hpp:20
Utilities and base classes for 1D curves.
Definition: FocusDispatcher.hpp:12