Chris@127
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@127
|
2
|
Chris@127
|
3 /*
|
Chris@127
|
4 Sonic Visualiser
|
Chris@127
|
5 An audio file viewer and annotation editor.
|
Chris@127
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@127
|
7 This file copyright 2006 Chris Cannam.
|
Chris@127
|
8
|
Chris@127
|
9 This program is free software; you can redistribute it and/or
|
Chris@127
|
10 modify it under the terms of the GNU General Public License as
|
Chris@127
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@127
|
12 License, or (at your option) any later version. See the file
|
Chris@127
|
13 COPYING included with this distribution for more information.
|
Chris@127
|
14 */
|
Chris@127
|
15
|
Chris@127
|
16 #ifndef _PAN_WIDGET_H_
|
Chris@127
|
17 #define _PAN_WIDGET_H_
|
Chris@127
|
18
|
Chris@128
|
19 #include "View.h"
|
Chris@127
|
20
|
Chris@127
|
21 #include <QPoint>
|
Chris@127
|
22
|
Chris@127
|
23 class QWidget;
|
Chris@127
|
24 class QPaintEvent;
|
Chris@127
|
25 class Layer;
|
Chris@127
|
26 class View;
|
Chris@127
|
27
|
Chris@127
|
28 #include <map>
|
Chris@127
|
29
|
Chris@127
|
30 class Panner : public View
|
Chris@127
|
31 {
|
Chris@127
|
32 Q_OBJECT
|
Chris@127
|
33
|
Chris@127
|
34 public:
|
Chris@127
|
35 Panner(QWidget *parent = 0);
|
Chris@127
|
36
|
Chris@127
|
37 void registerView(View *widget);
|
Chris@127
|
38 void unregisterView(View *widget);
|
Chris@127
|
39
|
Chris@127
|
40 virtual QString getPropertyContainerIconName() const { return "panner"; }
|
Chris@127
|
41
|
Chris@127
|
42 public slots:
|
Chris@127
|
43 virtual void modelChanged(size_t startFrame, size_t endFrame);
|
Chris@127
|
44 virtual void modelReplaced();
|
Chris@127
|
45
|
Chris@127
|
46 virtual void viewManagerCentreFrameChanged(void *, unsigned long, bool);
|
Chris@127
|
47 virtual void viewManagerZoomLevelChanged(void *, unsigned long, bool);
|
Chris@127
|
48 virtual void viewManagerPlaybackFrameChanged(unsigned long);
|
Chris@127
|
49
|
Chris@127
|
50 protected:
|
Chris@127
|
51 virtual void paintEvent(QPaintEvent *e);
|
Chris@127
|
52 virtual void mousePressEvent(QMouseEvent *e);
|
Chris@127
|
53 virtual void mouseReleaseEvent(QMouseEvent *e);
|
Chris@127
|
54 virtual void mouseMoveEvent(QMouseEvent *e);
|
Chris@127
|
55 virtual bool shouldLabelSelections() const { return false; }
|
Chris@127
|
56
|
Chris@127
|
57 QPoint m_clickPos;
|
Chris@127
|
58 QPoint m_mousePos;
|
Chris@127
|
59 bool m_clickedInRange;
|
Chris@127
|
60 size_t m_dragCentreFrame;
|
Chris@127
|
61
|
Chris@127
|
62 typedef std::set<void *> WidgetSet;
|
Chris@127
|
63 WidgetSet m_widgets;
|
Chris@127
|
64 };
|
Chris@127
|
65
|
Chris@127
|
66 #endif
|
Chris@127
|
67
|