NodalIntervalView.hpp
1 #pragma once
2 #include <Process/Dataflow/NodeItem.hpp>
3 
4 #include <Scenario/Application/Drops/ScenarioDropHandler.hpp>
5 #include <Scenario/Document/Interval/IntervalModel.hpp>
6 #include <Scenario/Document/Interval/IntervalPresenter.hpp>
7 
8 #include <score/graphics/RectItem.hpp>
9 #include <score/tools/Bind.hpp>
10 
11 #include <ossia/detail/math.hpp>
12 
13 #include <nano_observer.hpp>
14 
15 namespace Scenario
16 {
17 class NodalIntervalView final
18  : public score::EmptyRectItem
19  , public Nano::Observer
20 {
21 public:
22  enum ItemsToShow
23  {
24  AllItems,
25  OnlyEffects
26  };
28  ItemsToShow sh, const IntervalModel& model, const Process::Context& ctx,
29  QGraphicsItem* parent);
30 
32 
33  void on_drop(QPointF pos, const QMimeData* data);
34  void on_playPercentageChanged(double t, TimeVal parent_dur);
35 
36  void recenter();
37  void rescale();
38  QRectF enclosingRect() const noexcept;
39 
40  QGraphicsItem& nodeContainer() const noexcept { return *m_container; }
41 
42 private:
43  void on_processAdded(const Process::ProcessModel& proc);
44  void on_processRemoving(const Process::ProcessModel& model);
45  void on_zoomRatioChanged(ZoomRatio ratio);
46 
47  void dragEnterEvent(QGraphicsSceneDragDropEvent* event) override;
48  void dragLeaveEvent(QGraphicsSceneDragDropEvent* event) override;
49  void dragMoveEvent(QGraphicsSceneDragDropEvent* event) override;
50  void dropEvent(QGraphicsSceneDragDropEvent* event) override;
51 
52  void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
53  void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
54  void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
55  void contextMenuEvent(QGraphicsSceneContextMenuEvent* event) override;
56 
57  const IntervalModel& m_model;
58  const Process::Context& m_context;
59  ItemsToShow m_itemsToShow{};
60  std::vector<Process::NodeItem*> m_nodeItems;
61  QGraphicsItem* m_container{};
62  QPointF m_pressedPos{};
63 };
64 
65 }
The Process class.
Definition: score-lib-process/Process/Process.hpp:61
Definition: IntervalModel.hpp:50
Definition: NodalIntervalView.hpp:20
Definition: RectItem.hpp:64
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Definition: ProcessContext.hpp:12
Definition: TimeValue.hpp:21