comparison view/Pane.h @ 127:89c625dda204

* Reorganising code base. This revision will not compile.
author Chris Cannam
date Mon, 31 Jul 2006 11:44:37 +0000
parents
children 33929e0c3c6b
comparison
equal deleted inserted replaced
126:0e95c127bb53 127:89c625dda204
1
2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
3
4 /*
5 Sonic Visualiser
6 An audio file viewer and annotation editor.
7 Centre for Digital Music, Queen Mary, University of London.
8 This file copyright 2006 Chris Cannam.
9
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2 of the
13 License, or (at your option) any later version. See the file
14 COPYING included with this distribution for more information.
15 */
16
17 #ifndef _PANE_H_
18 #define _PANE_H_
19
20 #include <QFrame>
21 #include <QPoint>
22
23 #include "base/ZoomConstraint.h"
24 #include "base/View.h"
25 #include "base/Selection.h"
26
27 class QWidget;
28 class QPaintEvent;
29 class Layer;
30
31 class Pane : public View
32 {
33 Q_OBJECT
34
35 public:
36 Pane(QWidget *parent = 0);
37 virtual QString getPropertyContainerIconName() const { return "pane"; }
38
39 virtual bool shouldIlluminateLocalFeatures(const Layer *layer,
40 QPoint &pos) const;
41 virtual bool shouldIlluminateLocalSelection(QPoint &pos,
42 bool &closeToLeft,
43 bool &closeToRight) const;
44
45 void setCentreLineVisible(bool visible);
46 bool getCentreLineVisible() const { return m_centreLineVisible; }
47
48 virtual QString toXmlString(QString indent = "",
49 QString extraAttributes = "") const;
50
51 signals:
52 void paneInteractedWith();
53 void rightButtonMenuRequested(QPoint position);
54
55 public slots:
56 virtual void toolModeChanged();
57
58 protected:
59 virtual void paintEvent(QPaintEvent *e);
60 virtual void mousePressEvent(QMouseEvent *e);
61 virtual void mouseReleaseEvent(QMouseEvent *e);
62 virtual void mouseMoveEvent(QMouseEvent *e);
63 virtual void mouseDoubleClickEvent(QMouseEvent *e);
64 virtual void leaveEvent(QEvent *e);
65 virtual void wheelEvent(QWheelEvent *e);
66
67 Selection getSelectionAt(int x, bool &closeToLeft, bool &closeToRight) const;
68
69 bool editSelectionStart(QMouseEvent *e);
70 bool editSelectionDrag(QMouseEvent *e);
71 bool editSelectionEnd(QMouseEvent *e);
72 bool selectionIsBeingEdited() const;
73
74 bool m_identifyFeatures;
75 QPoint m_identifyPoint;
76 QPoint m_clickPos;
77 QPoint m_mousePos;
78 bool m_clickedInRange;
79 bool m_shiftPressed;
80 bool m_ctrlPressed;
81 bool m_navigating;
82 bool m_resizing;
83 size_t m_dragCentreFrame;
84 bool m_centreLineVisible;
85 size_t m_selectionStartFrame;
86 Selection m_editingSelection;
87 int m_editingSelectionEdge;
88 };
89
90 #endif
91