Loading...
Searching...
No Matches
ScenarioDocumentPresenter.hpp
1#pragma once
2#include <Process/DocumentPlugin.hpp>
3#include <Process/Focus/FocusDispatcher.hpp>
4#include <Process/ProcessContext.hpp>
5#include <Process/ZoomHelper.hpp>
6
7#include <Scenario/Document/DisplayedElements/DisplayedElementsModel.hpp>
8#include <Scenario/Document/ScenarioDocument/CentralIntervalDisplay.hpp>
9#include <Scenario/Document/ScenarioDocument/CentralNodalDisplay.hpp>
10#include <Scenario/Document/ScenarioDocument/ProcessFocusManager.hpp>
11#include <Scenario/Palette/Tools/PlayToolState.hpp>
12
13#include <score/plugins/documentdelegate/DocumentDelegatePresenter.hpp>
14#include <score/selection/Selection.hpp>
15#include <score/selection/SelectionDispatcher.hpp>
16
17#include <ossia/detail/variant.hpp>
18
19#include <QPoint>
20#include <QRect>
21
22#include <memory>
23#include <verdigris>
24
25class QAction;
26class ObjectPath;
27class QSize;
28namespace score
29{
30class DocumentDelegateModel;
31class DocumentDelegateView;
32class DocumentPresenter;
33} // namespace score
34
35namespace Process
36{
37class MiniLayer;
38}
39namespace Scenario
40{
41class DisplayedElementsPresenter;
42class IntervalModel;
43class ScenarioDocumentModel;
44class ScenarioDocumentPresenter;
45class ScenarioDocumentView;
46class TimeRulerPresenter;
47
48using CentralDisplay
49 = ossia::slow_variant<ossia::monostate, CentralIntervalDisplay, CentralNodalDisplay>;
56class SCORE_PLUGIN_SCENARIO_EXPORT ScenarioDocumentPresenter final
58 , public Nano::Observer
59{
61 friend class DisplayedElementsPresenter;
62 friend class CentralIntervalDisplay;
63 friend class CentralNodalDisplay;
64
65public:
67 const score::DocumentContext& ctx, score::DocumentPresenter* parent_presenter,
70
71 IntervalModel& displayedInterval() const noexcept;
72 IntervalPresenter* displayedIntervalPresenter() const noexcept;
73 const CentralDisplay& display() const noexcept;
74 const ScenarioDocumentModel& model() const noexcept;
75 ScenarioDocumentView& view() const noexcept;
76 const Process::Context& context() const noexcept;
77 Process::ProcessFocusManager& focusManager() const noexcept;
78
79 // The height in pixels of the displayed interval with its rack.
80 // double height() const;
81 ZoomRatio zoomRatio() const noexcept;
82
83 void selectAll();
84 void deselectAll();
85 void selectTop();
86
87 void setZoomRatio(ZoomRatio newFactor);
88 void updateRect(const QRectF& rect);
89
90 void setNewSelection(const Selection& old, const Selection& s) override;
91
92 void setDisplayedInterval(Scenario::IntervalModel* interval);
93
94 void on_viewModelDefocused(const Process::ProcessModel* vm);
95 void on_viewModelFocused(const Process::ProcessModel* vm);
96
97 void on_dropInEmptyFullView(QPoint viewPos, const QMimeData* data);
98 void focusFrontProcess();
99 void goUpALevel();
100
101 DisplayedElementsModel displayedElements;
102
103 void setLargeView();
104
105 void startTimeBar();
106 void stopTimeBar();
107
108 bool isNodal() const noexcept;
109 // Switch between temporal and dataflow (nodal) mode, keeping the toolbar
110 // action in sync. Exposed for JS view automation.
111 void setNodalMode(bool nodal);
112 // Recenter the view (nodal mode). Exposed for JS view automation.
113 void recenter();
114
115 void setAutoScroll(bool);
116
117public:
118 void pressed(QPointF arg_1) E_SIGNAL(SCORE_PLUGIN_SCENARIO_EXPORT, pressed, arg_1)
119 void moved(QPointF arg_1) E_SIGNAL(SCORE_PLUGIN_SCENARIO_EXPORT, moved, arg_1)
120 void released(QPointF arg_1) E_SIGNAL(SCORE_PLUGIN_SCENARIO_EXPORT, released, arg_1)
121 void escPressed() E_SIGNAL(SCORE_PLUGIN_SCENARIO_EXPORT, escPressed)
122
123 void setFocusedPresenter(QPointer<Process::LayerPresenter> arg_1)
124 E_SIGNAL(SCORE_PLUGIN_SCENARIO_EXPORT, setFocusedPresenter, arg_1)
125
126private:
127 void on_windowSizeChanged(QSize);
128 W_SLOT(on_windowSizeChanged);
129 void on_viewReady();
130 W_SLOT(on_viewReady);
131
132private:
133 void updateTimeBar();
134 void updateMinimap();
135 double computeReverseZoom(ZoomRatio r);
136 void switchMode(bool nodal);
137 void recenterNodal();
138 void restoreZoom();
139 void autoScroll();
140
141 void on_cableAdded(Process::Cable& c);
142
143 void on_cableRemoving(const Process::Cable& c);
144
145 void on_timeRulerChanged();
146 void on_horizontalZoom(QPointF, QPointF);
147 void on_verticalZoom(QPointF, QPointF);
148 void on_timeRulerDragEvent(QPointF, QPointF);
149 void on_timeRulerScrubPressEvent(QPointF, QPointF);
150 void on_timeRulerScrubMoveEvent(QPointF, QPointF);
151 void on_timeRulerScrubReleaseEvent(QPointF, QPointF);
152 void on_visibleRectChanged(const QRectF& c);
153 void on_horizontalPositionChanged(int dx);
154 void on_minimapChanged(double l, double r);
155 void on_executionTimer();
156 void on_timelineModeSwitch(bool b);
157 void on_requestTransport(QPointF pt);
158 ZoomRatio computeZoom(double l, double r);
159
160 void on_addProcessFromLibrary(const Library::ProcessData& dat);
161 void on_addPresetFromLibrary(const Process::Preset& dat);
162
163 void on_cableItemCreated(Dataflow::CableItem* item);
164 void on_dropOnCable(const QPointF& pos, const QMimeData& mime);
165 void on_dropFinished();
166
167 TimeVal timeRulerClickTime(QPointF scenePos) const noexcept;
168
169 Process::DataflowManager m_dataflow;
170 CentralDisplay m_centralDisplay;
171 score::SelectionDispatcher m_selectionDispatcher;
172 FocusDispatcher m_focusDispatcher;
173 mutable Process::ProcessFocusManager m_focusManager;
174 QPointer<IntervalModel> m_focusedInterval{};
175
176 Process::Context m_context;
177
178 ZoomRatio m_zoomRatio{-1};
179 QMetaObject::Connection m_intervalConnection, m_durationConnection;
180 Process::MiniLayer* m_miniLayer{};
181
182 QAction* m_timelineAction{};
183 QAction* m_musicalAction{};
184
185 std::vector<QMetaObject::Connection> m_processSelectionConnections;
186
187 ScrubHandler m_scrubHandler;
188
189 bool m_zooming{false};
190 bool m_updatingMinimap{false};
191 bool m_reloadingMinimap{false};
192 bool m_updatingView{false};
193 bool m_autoScroll{false};
194};
195
196SCORE_PLUGIN_SCENARIO_EXPORT
197Process::ProcessModel* closestParentProcessBeforeInterval(const QObject* obj);
198
199}
Definition CableItem.hpp:37
Definition FocusDispatcher.hpp:17
The ObjectPath class.
Definition ObjectPath.hpp:37
Definition Cable.hpp:38
Definition plugins/score-lib-process/Process/DocumentPlugin.hpp:13
Definition LayerView.hpp:95
Definition ProcessFocusManager.hpp:33
The Process class.
Definition score-lib-process/Process/Process.hpp:62
Definition CentralIntervalDisplay.hpp:15
Definition CentralNodalDisplay.hpp:14
Definition DisplayedElementsModel.hpp:16
Definition DisplayedElementsPresenter.hpp:25
Definition IntervalModel.hpp:50
Definition IntervalPresenter.hpp:30
Definition ScenarioDocumentModel.hpp:29
The ScenarioDocumentPresenter class.
Definition ScenarioDocumentPresenter.hpp:59
Definition ScenarioDocumentView.hpp:139
Definition PlayToolState.hpp:18
Definition Selection.hpp:12
Definition DocumentDelegateModel.hpp:11
Definition DocumentDelegatePresenter.hpp:16
Definition DocumentDelegateView.hpp:10
Interface between the DocumentModel and the DocumentView.
Definition DocumentPresenter.hpp:20
The SelectionDispatcher class.
Definition SelectionDispatcher.hpp:15
Base classes and tools to implement processes and layers.
Definition JSONVisitor.hpp:1115
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Base toolkit upon which the software is built.
Definition Application.cpp:113
Definition ProcessesItemModel.hpp:33
Definition ProcessContext.hpp:12
Definition Preset.hpp:32
Definition TimeValue.hpp:21
Definition DocumentContext.hpp:18