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
12#include <score/plugins/documentdelegate/DocumentDelegatePresenter.hpp>
13#include <score/selection/Selection.hpp>
14#include <score/selection/SelectionDispatcher.hpp>
15
16#include <ossia/detail/variant.hpp>
17
18#include <QPoint>
19#include <QRect>
20
21#include <memory>
22#include <verdigris>
23
24class QAction;
25class ObjectPath;
26class QSize;
27namespace score
28{
29class DocumentDelegateModel;
30class DocumentDelegateView;
31class DocumentPresenter;
32} // namespace score
33
34namespace Process
35{
36class MiniLayer;
37}
38namespace Scenario
39{
40class DisplayedElementsPresenter;
41class IntervalModel;
42class ScenarioDocumentModel;
43class ScenarioDocumentPresenter;
44class ScenarioDocumentView;
45class TimeRulerPresenter;
46
47using CentralDisplay
48 = ossia::slow_variant<ossia::monostate, CentralIntervalDisplay, CentralNodalDisplay>;
55class SCORE_PLUGIN_SCENARIO_EXPORT ScenarioDocumentPresenter final
57 , public Nano::Observer
58{
60 friend class DisplayedElementsPresenter;
61 friend class CentralIntervalDisplay;
62 friend class CentralNodalDisplay;
63
64public:
66 const score::DocumentContext& ctx, score::DocumentPresenter* parent_presenter,
69
70 IntervalModel& displayedInterval() const noexcept;
71 IntervalPresenter* displayedIntervalPresenter() const noexcept;
72 const CentralDisplay& display() const noexcept;
73 const ScenarioDocumentModel& model() const noexcept;
74 ScenarioDocumentView& view() const noexcept;
75 const Process::Context& context() const noexcept;
76 Process::ProcessFocusManager& focusManager() const noexcept;
77
78 // The height in pixels of the displayed interval with its rack.
79 // double height() const;
80 ZoomRatio zoomRatio() const noexcept;
81
82 void selectAll();
83 void deselectAll();
84 void selectTop();
85
86 void setZoomRatio(ZoomRatio newFactor);
87 void updateRect(const QRectF& rect);
88
89 void setNewSelection(const Selection& old, const Selection& s) override;
90
91 void setDisplayedInterval(Scenario::IntervalModel* interval);
92
93 void on_viewModelDefocused(const Process::ProcessModel* vm);
94 void on_viewModelFocused(const Process::ProcessModel* vm);
95
96 void focusFrontProcess();
97 void goUpALevel();
98
99 DisplayedElementsModel displayedElements;
100
101 void setLargeView();
102
103 void startTimeBar();
104 void stopTimeBar();
105
106 bool isNodal() const noexcept;
107
108 void setAutoScroll(bool);
109
110public:
111 void pressed(QPointF arg_1) E_SIGNAL(SCORE_PLUGIN_SCENARIO_EXPORT, pressed, arg_1)
112 void moved(QPointF arg_1) E_SIGNAL(SCORE_PLUGIN_SCENARIO_EXPORT, moved, arg_1)
113 void released(QPointF arg_1) E_SIGNAL(SCORE_PLUGIN_SCENARIO_EXPORT, released, arg_1)
114 void escPressed() E_SIGNAL(SCORE_PLUGIN_SCENARIO_EXPORT, escPressed)
115
116 void setFocusedPresenter(QPointer<Process::LayerPresenter> arg_1)
117 E_SIGNAL(SCORE_PLUGIN_SCENARIO_EXPORT, setFocusedPresenter, arg_1)
118
119private:
120 void on_windowSizeChanged(QSize);
121 W_SLOT(on_windowSizeChanged);
122 void on_viewReady();
123 W_SLOT(on_viewReady);
124
125private:
126 void updateTimeBar();
127 void updateMinimap();
128 double computeReverseZoom(ZoomRatio r);
129 void switchMode(bool nodal);
130 void recenterNodal();
131 void restoreZoom();
132 void autoScroll();
133
134 void on_cableAdded(Process::Cable& c);
135
136 void on_cableRemoving(const Process::Cable& c);
137
138 void on_timeRulerChanged();
139 void on_horizontalZoom(QPointF, QPointF);
140 void on_verticalZoom(QPointF, QPointF);
141 void on_timeRulerScrollEvent(QPointF, QPointF);
142 void on_visibleRectChanged(const QRectF& c);
143 void on_horizontalPositionChanged(int dx);
144 void on_minimapChanged(double l, double r);
145 void on_executionTimer();
146 void on_timelineModeSwitch(bool b);
147 ZoomRatio computeZoom(double l, double r);
148
149 void on_addProcessFromLibrary(const Library::ProcessData& dat);
150 void on_addPresetFromLibrary(const Process::Preset& dat);
151
152 Process::DataflowManager m_dataflow;
153 CentralDisplay m_centralDisplay;
154 score::SelectionDispatcher m_selectionDispatcher;
155 FocusDispatcher m_focusDispatcher;
156 mutable Process::ProcessFocusManager m_focusManager;
157 QPointer<IntervalModel> m_focusedInterval{};
158
159 Process::Context m_context;
160
161 ZoomRatio m_zoomRatio{-1};
162 QMetaObject::Connection m_intervalConnection, m_durationConnection;
163 Process::MiniLayer* m_miniLayer{};
164
165 QAction* m_timelineAction{};
166 QAction* m_musicalAction{};
167
168 std::vector<QMetaObject::Connection> m_processSelectionConnections;
169
170 int m_nonGLTimebarTimer{-1};
171
172 bool m_zooming{false};
173 bool m_updatingMinimap{false};
174 bool m_reloadingMinimap{false};
175 bool m_updatingView{false};
176 bool m_autoScroll{false};
177};
178
179Process::ProcessModel* closestParentProcessBeforeInterval(const QObject* obj);
180
181}
Definition FocusDispatcher.hpp:17
The ObjectPath class.
Definition ObjectPath.hpp:37
Definition Cable.hpp:38
Definition plugins/score-lib-process/Process/DocumentPlugin.hpp:12
Definition LayerView.hpp:95
Definition ProcessFocusManager.hpp:33
The Process class.
Definition score-lib-process/Process/Process.hpp:61
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:58
Definition ScenarioDocumentView.hpp:115
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:1324
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Base toolkit upon which the software is built.
Definition Application.cpp:90
Definition ProcessesItemModel.hpp:32
Definition ProcessContext.hpp:12
Definition Preset.hpp:32
Definition DocumentContext.hpp:18