Loading...
Searching...
No Matches
Minimap.hpp
1#pragma once
2
3#include <Process/TimeValue.hpp>
4
5#include <QGraphicsItem>
6
7#include <score_plugin_scenario_export.h>
8
9#include <verdigris>
10class QGraphicsView;
11namespace Scenario
12{
13class SCORE_PLUGIN_SCENARIO_EXPORT Minimap final
14 : public QObject
15 , public QGraphicsItem
16{
17 W_OBJECT(Minimap)
18 Q_INTERFACES(QGraphicsItem)
19public:
20 Minimap(QGraphicsView* vp);
21 void setWidth(double);
22 double width() const { return m_width; }
23 double leftHandle() const { return m_leftHandle; }
24 double rightHandle() const { return m_rightHandle; }
25
26 // These do not send notification
27 void setMinDistance(double);
28 void setLeftHandle(double);
29 void setRightHandle(double);
30 void setHandles(double l, double r);
31
32 // This one sends visibleRectChanged
33 void modifyHandles(double l, double r);
34
35 // Used when reloading because we don't want clamping to apply
36 void restoreHandles(double l, double r);
37
38 void setLargeView();
39 void zoomIn();
40 void zoomOut();
41 void zoom(double z);
42
43public:
44 void rescale() W_SIGNAL(rescale);
45 void visibleRectChanged(double l, double r) W_SIGNAL(visibleRectChanged, l, r);
46
47private:
48 QRectF boundingRect() const override;
49 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
50 override;
51
52 void mousePressEvent(QGraphicsSceneMouseEvent*) override;
53 void mouseMoveEvent(QGraphicsSceneMouseEvent*) override;
54 void mouseReleaseEvent(QGraphicsSceneMouseEvent*) override;
55 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*) final override;
56
57 void hoverEnterEvent(QGraphicsSceneHoverEvent*) override;
58 void hoverMoveEvent(QGraphicsSceneHoverEvent*) override;
59 void hoverLeaveEvent(QGraphicsSceneHoverEvent*) override;
60
61 static const constexpr double m_height{20.};
62
63 QGraphicsView* m_viewport{};
64 double m_leftHandle{};
65 double m_rightHandle{};
66 double m_width{100.};
67 double m_minDist{10.};
68 QPointF m_startPos{};
69 double m_startY{};
70 double m_relativeStartX{};
71
72 bool m_gripLeft{false};
73 bool m_gripRight{false};
74 bool m_gripMid{false};
75 bool m_setCursor{false};
76};
77}
Definition Minimap.hpp:16
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13