Chris@127: Chris@127: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@127: Chris@127: /* Chris@127: Sonic Visualiser Chris@127: An audio file viewer and annotation editor. Chris@127: Centre for Digital Music, Queen Mary, University of London. Chris@127: This file copyright 2006 Chris Cannam. Chris@127: Chris@127: This program is free software; you can redistribute it and/or Chris@127: modify it under the terms of the GNU General Public License as Chris@127: published by the Free Software Foundation; either version 2 of the Chris@127: License, or (at your option) any later version. See the file Chris@127: COPYING included with this distribution for more information. Chris@127: */ Chris@127: Chris@127: #ifndef _PANE_H_ Chris@127: #define _PANE_H_ Chris@127: Chris@127: #include Chris@127: #include Chris@127: Chris@127: #include "base/ZoomConstraint.h" Chris@128: #include "View.h" Chris@127: #include "base/Selection.h" Chris@127: Chris@127: class QWidget; Chris@127: class QPaintEvent; Chris@127: class Layer; Chris@133: class Thumbwheel; Chris@127: Chris@127: class Pane : public View Chris@127: { Chris@127: Q_OBJECT Chris@127: Chris@127: public: Chris@127: Pane(QWidget *parent = 0); Chris@127: virtual QString getPropertyContainerIconName() const { return "pane"; } Chris@127: Chris@127: virtual bool shouldIlluminateLocalFeatures(const Layer *layer, Chris@127: QPoint &pos) const; Chris@127: virtual bool shouldIlluminateLocalSelection(QPoint &pos, Chris@127: bool &closeToLeft, Chris@127: bool &closeToRight) const; Chris@127: Chris@127: void setCentreLineVisible(bool visible); Chris@127: bool getCentreLineVisible() const { return m_centreLineVisible; } Chris@127: Chris@127: virtual QString toXmlString(QString indent = "", Chris@127: QString extraAttributes = "") const; Chris@127: Chris@127: signals: Chris@127: void paneInteractedWith(); Chris@127: void rightButtonMenuRequested(QPoint position); Chris@127: Chris@127: public slots: Chris@127: virtual void toolModeChanged(); Chris@133: virtual void zoomWheelsEnabledChanged(); Chris@133: virtual void zoomLevelChanged(); Chris@127: Chris@132: virtual void horizontalThumbwheelMoved(int value); Chris@132: virtual void verticalThumbwheelMoved(int value); Chris@133: virtual void verticalZoomChanged(); Chris@133: Chris@133: virtual void propertyContainerSelected(View *, PropertyContainer *pc); Chris@132: Chris@127: protected: Chris@127: virtual void paintEvent(QPaintEvent *e); Chris@127: virtual void mousePressEvent(QMouseEvent *e); Chris@127: virtual void mouseReleaseEvent(QMouseEvent *e); Chris@127: virtual void mouseMoveEvent(QMouseEvent *e); Chris@127: virtual void mouseDoubleClickEvent(QMouseEvent *e); Chris@127: virtual void leaveEvent(QEvent *e); Chris@127: virtual void wheelEvent(QWheelEvent *e); Chris@133: virtual void resizeEvent(QResizeEvent *e); Chris@127: Chris@127: Selection getSelectionAt(int x, bool &closeToLeft, bool &closeToRight) const; Chris@127: Chris@127: bool editSelectionStart(QMouseEvent *e); Chris@127: bool editSelectionDrag(QMouseEvent *e); Chris@127: bool editSelectionEnd(QMouseEvent *e); Chris@127: bool selectionIsBeingEdited() const; Chris@127: Chris@133: void updateHeadsUpDisplay(); Chris@133: Chris@127: bool m_identifyFeatures; Chris@127: QPoint m_identifyPoint; Chris@127: QPoint m_clickPos; Chris@127: QPoint m_mousePos; Chris@127: bool m_clickedInRange; Chris@127: bool m_shiftPressed; Chris@127: bool m_ctrlPressed; Chris@127: bool m_navigating; Chris@127: bool m_resizing; Chris@127: size_t m_dragCentreFrame; Chris@136: float m_dragStartMinValue; Chris@127: bool m_centreLineVisible; Chris@127: size_t m_selectionStartFrame; Chris@127: Selection m_editingSelection; Chris@127: int m_editingSelectionEdge; Chris@133: Chris@150: enum DragMode { Chris@150: UnresolvedDrag, Chris@150: VerticalDrag, Chris@150: HorizontalDrag, Chris@150: FreeDrag Chris@150: }; Chris@150: DragMode m_dragMode; Chris@150: Chris@133: QWidget *m_headsUpDisplay; Chris@133: Thumbwheel *m_hthumb; Chris@133: Thumbwheel *m_vthumb; Chris@127: }; Chris@127: Chris@127: #endif Chris@127: