2 #include <Process/Focus/FocusDispatcher.hpp>
3 #include <Process/LayerPresenter.hpp>
4 #include <Process/LayerView.hpp>
6 #include <Curve/CurveModel.hpp>
7 #include <Curve/CurvePresenter.hpp>
8 #include <Curve/CurveView.hpp>
9 #include <Curve/Palette/CurvePalette.hpp>
10 #include <Curve/Process/CurveProcessModel.hpp>
11 #include <Curve/Segment/CurveSegmentList.hpp>
13 #include <score/command/Dispatchers/CommandDispatcher.hpp>
14 #include <score/document/DocumentInterface.hpp>
15 #include <score/graphics/GraphicsItem.hpp>
16 #include <score/tools/Bind.hpp>
18 #include <score_plugin_curve_export.h>
22 class CurveProcessView;
26 template <
typename Model_T,
typename LayerView_T>
31 const Curve::Style& style,
const Model_T& lm, LayerView_T* view,
33 : LayerPresenter{lm, view, ctx, parent}
34 , m_view{
static_cast<LayerView_T*
>(view)}
35 , m_curve{ctx, style, lm.curve(),
new View{m_view},
this}
36 , m_commandDispatcher{ctx.commandStack}
37 , m_sm{m_context, m_curve}
39 con(lm, &CurveProcessModel::curveChanged,
this,
40 &CurveProcessPresenter::parentGeometryChanged);
42 con(m_curve, &Presenter::contextMenuRequested,
this,
43 &LayerPresenter::contextMenuRequested);
45 connect(&m_curve.view(), &View::doubleClick,
this, [
this](QPointF pt) {
49 parentGeometryChanged();
50 m_view->setCurveView(&m_curve.view());
55 void on_focusChanged()
final override
62 m_curve.enableActions(b);
64 m_curve.editionSettings().setTool(Curve::Tool::Select);
67 void setWidth(qreal width, qreal defaultWidth)
final override
69 m_view->setWidth(width);
70 m_curve.view().setRect(m_view->boundingRect());
71 m_curve.view().setDefaultWidth(defaultWidth);
74 void setHeight(qreal height)
final override
76 m_view->setHeight(height);
77 m_curve.view().setRect(m_view->boundingRect());
80 void putToFront()
final override
86 void putBehind()
final override
92 void on_zoomRatioChanged(ZoomRatio val)
final override
95 parentGeometryChanged();
98 void parentGeometryChanged()
override
101 QRectF rect = m_view->boundingRect();
102 m_curve.view().setRect(rect);
104 const auto dw = m_process.duration().toPixels(m_zoomRatio);
105 m_curve.view().setDefaultWidth(dw);
107 m_curve.setRect(rect);
110 void fillContextMenu(
111 QMenu& menu, QPoint pos, QPointF scenepos,
114 m_curve.fillContextMenu(menu, pos, scenepos);
117 LayerView_T* view() {
return m_view.impl; }
118 const Model_T& model()
const {
return static_cast<const Model_T&
>(m_process); }
127 ZoomRatio m_zoomRatio{};
The CommandDispatcher class.
Definition: CommandDispatcher.hpp:13
Definition: CurveProcessPresenter.hpp:28
Definition: CurvePresenter.hpp:32
Definition: CurveView.hpp:25
Definition: LayerPresenter.hpp:34
Utilities and base classes for 1D curves.
Definition: FocusDispatcher.hpp:12
Definition: CurveStyle.hpp:13
Definition: ProcessContext.hpp:12