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