annotate widgets/Pane.h @ 44:ad214997dddb

* Refactor Layer classes so as no longer to store a single View pointer; instead they need to be able to draw themselves on any View on demand. Layers with caches (e.g. spectrogram) will need to be further refactored so as to maintain a per-View cache * Begin refactoring MainWindow by pulling out the document stuff (set of layers, models etc) into a Document class. Not yet in use. This revision is fairly unstable.
author Chris Cannam
date Thu, 02 Mar 2006 16:58:49 +0000
parents 1bdf285c4eac
children 01ab51f72e84
rev   line source
Chris@0 1
Chris@0 2 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 3
Chris@0 4 /*
Chris@0 5 A waveform viewer and audio annotation editor.
Chris@5 6 Chris Cannam, Queen Mary University of London, 2005-2006
Chris@0 7
Chris@0 8 This is experimental software. Not for distribution.
Chris@0 9 */
Chris@0 10
Chris@0 11 #ifndef _PANE_H_
Chris@0 12 #define _PANE_H_
Chris@0 13
Chris@0 14 #include <QFrame>
Chris@0 15 #include <QPoint>
Chris@0 16
Chris@0 17 #include "base/ZoomConstraint.h"
Chris@0 18 #include "base/View.h"
Chris@13 19 #include "base/Selection.h"
Chris@0 20
Chris@0 21 class QWidget;
Chris@0 22 class QPaintEvent;
Chris@0 23 class Layer;
Chris@0 24
Chris@0 25 class Pane : public View
Chris@0 26 {
Chris@0 27 Q_OBJECT
Chris@0 28
Chris@0 29 public:
Chris@0 30 Pane(QWidget *parent = 0);
Chris@34 31 virtual QString getPropertyContainerIconName() const { return "pane"; }
Chris@0 32
Chris@44 33 virtual bool shouldIlluminateLocalFeatures(const Layer *layer,
Chris@44 34 QPoint &pos) const;
Chris@42 35 virtual bool shouldIlluminateLocalSelection(QPoint &pos,
Chris@42 36 bool &closeToLeft,
Chris@44 37 bool &closeToRight) const;
Chris@0 38
Chris@0 39 void setCentreLineVisible(bool visible);
Chris@0 40 bool getCentreLineVisible() const { return m_centreLineVisible; }
Chris@0 41
Chris@8 42 virtual QString toXmlString(QString indent = "",
Chris@8 43 QString extraAttributes = "") const;
Chris@8 44
Chris@0 45 signals:
Chris@0 46 void paneInteractedWith();
Chris@0 47
Chris@13 48 public slots:
Chris@13 49 virtual void toolModeChanged();
Chris@13 50
Chris@0 51 protected:
Chris@0 52 virtual void paintEvent(QPaintEvent *e);
Chris@0 53 virtual void mousePressEvent(QMouseEvent *e);
Chris@0 54 virtual void mouseReleaseEvent(QMouseEvent *e);
Chris@0 55 virtual void mouseMoveEvent(QMouseEvent *e);
Chris@0 56 virtual void mouseDoubleClickEvent(QMouseEvent *e);
Chris@0 57 virtual void leaveEvent(QEvent *e);
Chris@0 58 virtual void wheelEvent(QWheelEvent *e);
Chris@0 59
Chris@44 60 Selection getSelectionAt(int x, bool &closeToLeft, bool &closeToRight) const;
Chris@17 61
Chris@42 62 bool editSelectionStart(QMouseEvent *e);
Chris@42 63 bool editSelectionDrag(QMouseEvent *e);
Chris@42 64 bool editSelectionEnd(QMouseEvent *e);
Chris@42 65 bool selectionIsBeingEdited() const;
Chris@42 66
Chris@0 67 bool m_identifyFeatures;
Chris@0 68 QPoint m_identifyPoint;
Chris@0 69 QPoint m_clickPos;
Chris@0 70 QPoint m_mousePos;
Chris@0 71 bool m_clickedInRange;
Chris@0 72 bool m_shiftPressed;
Chris@13 73 bool m_ctrlPressed;
Chris@17 74 bool m_navigating;
Chris@17 75 bool m_resizing;
Chris@0 76 size_t m_dragCentreFrame;
Chris@0 77 bool m_centreLineVisible;
Chris@13 78 size_t m_selectionStartFrame;
Chris@42 79 Selection m_editingSelection;
Chris@42 80 int m_editingSelectionEdge;
Chris@0 81 };
Chris@0 82
Chris@0 83 #endif
Chris@0 84