Loading...
Searching...
No Matches
CurvePalette.hpp
1#pragma once
2#include <Process/Tools/ToolPalette.hpp>
3
4#include <Curve/CurvePresenter.hpp>
5#include <Curve/CurveView.hpp>
6#include <Curve/Palette/CurveEditionSettings.hpp>
7#include <Curve/Palette/CurvePoint.hpp>
8#include <Curve/Palette/Tools/MoveTool.hpp>
9#include <Curve/Palette/Tools/SmartTool.hpp>
10
11#include <score/statemachine/GraphicsSceneToolPalette.hpp>
12
13#include <QPoint>
14
15#include <score_plugin_curve_export.h>
16namespace score
17{
18class CommandStackFacade;
19class ObjectLocker;
20} // namespace score
21namespace Process
22{
23struct LayerContext;
24}
25
26namespace Curve
27{
28class Model;
29class Presenter;
30class View;
31
32class SCORE_PLUGIN_CURVE_EXPORT ToolPalette : public GraphicsSceneToolPalette
33{
34public:
37 Presenter& presenter() const;
38
39 Curve::EditionSettings& editionSettings() const;
40
41 const Model& model() const;
42 void on_pressed(QPointF point);
43 void on_moved(QPointF point);
44 void on_released(QPointF point);
45
46 void on_cancel();
47
48 void activate(Curve::Tool);
49 void desactivate(Curve::Tool);
50
51 // From double-click :
52 void createPoint(QPointF);
53
54private:
55 Curve::Point ScenePointToCurvePoint(const QPointF& point)
56 {
57 const auto rect = m_presenter.rect();
58 return {point.x() / rect.width(), 1. - point.y() / rect.height()};
59 }
60
61 Presenter& m_presenter;
62
63 SmartTool m_selectTool;
64 CreateTool m_createTool;
65 SetSegmentTool m_setSegmentTool;
66 CreatePenTool m_createPenTool;
67};
68
69template <typename Context_T>
70struct ToolPalette_T final : public ToolPalette
71{
72 ToolPalette_T(const Context_T& ctx, Presenter& pres)
73 : ToolPalette{ctx.context, pres}
74 , m_inputDisp{pres.view(), *this, ctx}
75 {
76 }
77
79};
80}
Definition MoveTool.hpp:43
Definition MoveTool.hpp:25
Definition CurveEditionSettings.hpp:34
Definition CurveModel.hpp:25
Definition CurvePresenter.hpp:32
Definition MoveTool.hpp:34
Definition score-plugin-curve/Curve/Palette/Tools/SmartTool.hpp:16
Definition CurvePalette.hpp:33
Definition GraphicsSceneToolPalette.hpp:10
Definition ToolPalette.hpp:14
Utilities and base classes for 1D curves.
Definition FocusDispatcher.hpp:12
Base classes and tools to implement processes and layers.
Definition JSONVisitor.hpp:1324
Base toolkit upon which the software is built.
Definition Application.cpp:90
Definition CurvePalette.hpp:71
Definition DocumentContext.hpp:18