Chris@127
|
1
|
Chris@127
|
2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@127
|
3
|
Chris@127
|
4 /*
|
Chris@127
|
5 Sonic Visualiser
|
Chris@127
|
6 An audio file viewer and annotation editor.
|
Chris@127
|
7 Centre for Digital Music, Queen Mary, University of London.
|
Chris@182
|
8 This file copyright 2006 Chris Cannam and QMUL.
|
Chris@127
|
9
|
Chris@127
|
10 This program is free software; you can redistribute it and/or
|
Chris@127
|
11 modify it under the terms of the GNU General Public License as
|
Chris@127
|
12 published by the Free Software Foundation; either version 2 of the
|
Chris@127
|
13 License, or (at your option) any later version. See the file
|
Chris@127
|
14 COPYING included with this distribution for more information.
|
Chris@127
|
15 */
|
Chris@127
|
16
|
Chris@127
|
17 #ifndef _PANE_H_
|
Chris@127
|
18 #define _PANE_H_
|
Chris@127
|
19
|
Chris@127
|
20 #include <QFrame>
|
Chris@127
|
21 #include <QPoint>
|
Chris@127
|
22
|
Chris@127
|
23 #include "base/ZoomConstraint.h"
|
Chris@128
|
24 #include "View.h"
|
Chris@127
|
25 #include "base/Selection.h"
|
Chris@127
|
26
|
Chris@127
|
27 class QWidget;
|
Chris@127
|
28 class QPaintEvent;
|
Chris@127
|
29 class Layer;
|
Chris@133
|
30 class Thumbwheel;
|
Chris@172
|
31 class Panner;
|
Chris@127
|
32
|
Chris@127
|
33 class Pane : public View
|
Chris@127
|
34 {
|
Chris@127
|
35 Q_OBJECT
|
Chris@127
|
36
|
Chris@127
|
37 public:
|
Chris@127
|
38 Pane(QWidget *parent = 0);
|
Chris@127
|
39 virtual QString getPropertyContainerIconName() const { return "pane"; }
|
Chris@127
|
40
|
Chris@127
|
41 virtual bool shouldIlluminateLocalFeatures(const Layer *layer,
|
Chris@127
|
42 QPoint &pos) const;
|
Chris@127
|
43 virtual bool shouldIlluminateLocalSelection(QPoint &pos,
|
Chris@127
|
44 bool &closeToLeft,
|
Chris@127
|
45 bool &closeToRight) const;
|
Chris@127
|
46
|
Chris@127
|
47 void setCentreLineVisible(bool visible);
|
Chris@127
|
48 bool getCentreLineVisible() const { return m_centreLineVisible; }
|
Chris@127
|
49
|
Chris@127
|
50 virtual QString toXmlString(QString indent = "",
|
Chris@127
|
51 QString extraAttributes = "") const;
|
Chris@127
|
52
|
Chris@127
|
53 signals:
|
Chris@127
|
54 void paneInteractedWith();
|
Chris@127
|
55 void rightButtonMenuRequested(QPoint position);
|
Chris@127
|
56
|
Chris@127
|
57 public slots:
|
Chris@127
|
58 virtual void toolModeChanged();
|
Chris@133
|
59 virtual void zoomWheelsEnabledChanged();
|
Chris@133
|
60 virtual void zoomLevelChanged();
|
Chris@127
|
61
|
Chris@132
|
62 virtual void horizontalThumbwheelMoved(int value);
|
Chris@132
|
63 virtual void verticalThumbwheelMoved(int value);
|
Chris@133
|
64 virtual void verticalZoomChanged();
|
Chris@174
|
65 virtual void verticalPannerMoved(float x, float y, float w, float h);
|
Chris@188
|
66 virtual void editVerticalPannerExtents();
|
Chris@133
|
67
|
Chris@133
|
68 virtual void propertyContainerSelected(View *, PropertyContainer *pc);
|
Chris@132
|
69
|
Chris@127
|
70 protected:
|
Chris@127
|
71 virtual void paintEvent(QPaintEvent *e);
|
Chris@127
|
72 virtual void mousePressEvent(QMouseEvent *e);
|
Chris@127
|
73 virtual void mouseReleaseEvent(QMouseEvent *e);
|
Chris@127
|
74 virtual void mouseMoveEvent(QMouseEvent *e);
|
Chris@127
|
75 virtual void mouseDoubleClickEvent(QMouseEvent *e);
|
Chris@127
|
76 virtual void leaveEvent(QEvent *e);
|
Chris@127
|
77 virtual void wheelEvent(QWheelEvent *e);
|
Chris@133
|
78 virtual void resizeEvent(QResizeEvent *e);
|
Chris@127
|
79
|
Chris@127
|
80 Selection getSelectionAt(int x, bool &closeToLeft, bool &closeToRight) const;
|
Chris@127
|
81
|
Chris@127
|
82 bool editSelectionStart(QMouseEvent *e);
|
Chris@127
|
83 bool editSelectionDrag(QMouseEvent *e);
|
Chris@127
|
84 bool editSelectionEnd(QMouseEvent *e);
|
Chris@127
|
85 bool selectionIsBeingEdited() const;
|
Chris@127
|
86
|
Chris@133
|
87 void updateHeadsUpDisplay();
|
Chris@174
|
88 void updateVerticalPanner();
|
Chris@174
|
89
|
Chris@174
|
90 bool canTopLayerMoveVertical();
|
Chris@174
|
91 bool getTopLayerDisplayExtents(float &valueMin, float &valueMax,
|
Chris@188
|
92 float &displayMin, float &displayMax,
|
Chris@188
|
93 QString *unit = 0);
|
Chris@174
|
94 bool setTopLayerDisplayExtents(float displayMin, float displayMax);
|
Chris@174
|
95
|
Chris@174
|
96 void dragTopLayer(QMouseEvent *e);
|
Chris@174
|
97 void dragExtendSelection(QMouseEvent *e);
|
Chris@174
|
98 void zoomToRegion(int x0, int y0, int x1, int y1);
|
Chris@133
|
99
|
Chris@127
|
100 bool m_identifyFeatures;
|
Chris@127
|
101 QPoint m_identifyPoint;
|
Chris@127
|
102 QPoint m_clickPos;
|
Chris@127
|
103 QPoint m_mousePos;
|
Chris@127
|
104 bool m_clickedInRange;
|
Chris@127
|
105 bool m_shiftPressed;
|
Chris@127
|
106 bool m_ctrlPressed;
|
Chris@127
|
107 bool m_navigating;
|
Chris@127
|
108 bool m_resizing;
|
Chris@127
|
109 size_t m_dragCentreFrame;
|
Chris@136
|
110 float m_dragStartMinValue;
|
Chris@127
|
111 bool m_centreLineVisible;
|
Chris@127
|
112 size_t m_selectionStartFrame;
|
Chris@127
|
113 Selection m_editingSelection;
|
Chris@127
|
114 int m_editingSelectionEdge;
|
Chris@133
|
115
|
Chris@150
|
116 enum DragMode {
|
Chris@150
|
117 UnresolvedDrag,
|
Chris@150
|
118 VerticalDrag,
|
Chris@150
|
119 HorizontalDrag,
|
Chris@150
|
120 FreeDrag
|
Chris@150
|
121 };
|
Chris@150
|
122 DragMode m_dragMode;
|
Chris@150
|
123
|
Chris@133
|
124 QWidget *m_headsUpDisplay;
|
Chris@172
|
125 Panner *m_vpan;
|
Chris@133
|
126 Thumbwheel *m_hthumb;
|
Chris@133
|
127 Thumbwheel *m_vthumb;
|
Chris@127
|
128 };
|
Chris@127
|
129
|
Chris@127
|
130 #endif
|
Chris@127
|
131
|