Overview.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  Sonic Visualiser
5  An audio file viewer and annotation editor.
6  Centre for Digital Music, Queen Mary, University of London.
7  This file copyright 2006 Chris Cannam and QMUL.
8 
9  This program is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of the
12  License, or (at your option) any later version. See the file
13  COPYING included with this distribution for more information.
14 */
15 
16 #ifndef SV_OVERVIEW_H
17 #define SV_OVERVIEW_H
18 
19 #include "View.h"
20 
21 #include <QPoint>
22 #include <QElapsedTimer>
23 
24 class QWidget;
25 class QPaintEvent;
26 class Layer;
27 class View;
28 
29 #include <map>
30 
31 class Overview : public View
32 {
33  Q_OBJECT
34 
35 public:
36  Overview(QWidget *parent = 0);
37 
38  void registerView(View *view);
39  void unregisterView(View *view);
40 
41  QString getPropertyContainerIconName() const override { return "panner"; }
42 
43 public slots:
44  void modelChangedWithin(ModelId, sv_frame_t startFrame, sv_frame_t endFrame) override;
45  void modelReplaced() override;
46 
47  void globalCentreFrameChanged(sv_frame_t) override;
48  void viewCentreFrameChanged(View *, sv_frame_t) override;
49  void viewZoomLevelChanged(View *, ZoomLevel, bool) override;
50  void viewManagerPlaybackFrameChanged(sv_frame_t) override;
51 
52  virtual void setBoxColour(QColor);
53 
54 protected:
55  void paintEvent(QPaintEvent *e) override;
56  void mousePressEvent(QMouseEvent *e) override;
57  void mouseReleaseEvent(QMouseEvent *e) override;
58  void mouseMoveEvent(QMouseEvent *e) override;
59  void mouseDoubleClickEvent(QMouseEvent *e) override;
60  void enterEvent(QEvent *) override;
61  void leaveEvent(QEvent *) override;
62  bool shouldLabelSelections() const override { return false; }
63 
64  QColor getFillWithin() const;
65  QColor getFillWithout() const;
66 
67  QPoint m_clickPos;
68  QPoint m_mousePos;
70  sv_frame_t m_dragCentreFrame;
71  QElapsedTimer m_modelTestTimer;
72  QColor m_boxColour;
73 
74  typedef std::set<View *> ViewSet;
75  ViewSet m_views;
76 };
77 
78 #endif
79 
QElapsedTimer m_modelTestTimer
Definition: Overview.h:71
sv_frame_t m_dragCentreFrame
Definition: Overview.h:70
QColor m_boxColour
Definition: Overview.h:72
void viewCentreFrameChanged(View *, sv_frame_t) override
Definition: Overview.cpp:112
The base class for visual representations of the data found in a Model.
Definition: Layer.h:54
QString getPropertyContainerIconName() const override
Definition: Overview.h:41
ViewSet m_views
Definition: Overview.h:75
QPoint m_clickPos
Definition: Overview.h:67
void mouseMoveEvent(QMouseEvent *e) override
Definition: Overview.cpp:311
void leaveEvent(QEvent *) override
Definition: Overview.cpp:370
void mouseReleaseEvent(QMouseEvent *e) override
Definition: Overview.cpp:302
void mousePressEvent(QMouseEvent *e) override
Definition: Overview.cpp:285
void enterEvent(QEvent *) override
Definition: Overview.cpp:364
void viewManagerPlaybackFrameChanged(sv_frame_t) override
Definition: Overview.cpp:136
void mouseDoubleClickEvent(QMouseEvent *e) override
Definition: Overview.cpp:351
std::set< View * > ViewSet
Definition: Overview.h:74
QColor getFillWithout() const
Definition: Overview.cpp:159
bool m_clickedInRange
Definition: Overview.h:69
void viewZoomLevelChanged(View *, ZoomLevel, bool) override
Definition: Overview.cpp:127
QColor getFillWithin() const
Definition: Overview.cpp:153
void globalCentreFrameChanged(sv_frame_t) override
Definition: Overview.cpp:99
Overview(QWidget *parent=0)
Definition: Overview.cpp:29
bool shouldLabelSelections() const override
Definition: Overview.h:62
void unregisterView(View *view)
Definition: Overview.cpp:92
View is the base class of widgets that display one or more overlaid views of data against a horizonta...
Definition: View.h:55
void paintEvent(QPaintEvent *e) override
Definition: Overview.cpp:173
void modelReplaced() override
Definition: Overview.cpp:78
void modelChangedWithin(ModelId, sv_frame_t startFrame, sv_frame_t endFrame) override
Definition: Overview.cpp:46
virtual void setBoxColour(QColor)
Definition: Overview.cpp:167
void registerView(View *view)
Definition: Overview.cpp:85
QPoint m_mousePos
Definition: Overview.h:68