lbajardsilogic@0: lbajardsilogic@0: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ lbajardsilogic@0: lbajardsilogic@0: /* lbajardsilogic@0: Sonic Visualiser lbajardsilogic@0: An audio file viewer and annotation editor. lbajardsilogic@0: Centre for Digital Music, Queen Mary, University of London. lbajardsilogic@0: This file copyright 2006 Chris Cannam and QMUL. lbajardsilogic@0: lbajardsilogic@0: This program is free software; you can redistribute it and/or lbajardsilogic@0: modify it under the terms of the GNU General Public License as lbajardsilogic@0: published by the Free Software Foundation; either version 2 of the lbajardsilogic@0: License, or (at your option) any later version. See the file lbajardsilogic@0: COPYING included with this distribution for more information. lbajardsilogic@0: */ lbajardsilogic@0: lbajardsilogic@0: #ifndef _PANE_H_ lbajardsilogic@0: #define _PANE_H_ lbajardsilogic@0: lbajardsilogic@0: #include lbajardsilogic@0: #include lbajardsilogic@0: lbajardsilogic@0: #include "base/ZoomConstraint.h" lbajardsilogic@0: #include "View.h" lbajardsilogic@0: #include "base/Selection.h" lbajardsilogic@0: lbajardsilogic@0: class QWidget; lbajardsilogic@0: class QPaintEvent; lbajardsilogic@0: class Layer; lbajardsilogic@0: class Thumbwheel; lbajardsilogic@0: class Panner; lbajardsilogic@0: class NotifyingPushButton; lbajardsilogic@0: lbajardsilogic@0: class Pane : public View lbajardsilogic@0: { lbajardsilogic@0: Q_OBJECT lbajardsilogic@0: lbajardsilogic@0: public: lbajardsilogic@0: Pane(QWidget *parent = 0); lbajardsilogic@0: virtual QString getPropertyContainerIconName() const { return "pane"; } lbajardsilogic@0: lbajardsilogic@0: virtual bool shouldIlluminateLocalFeatures(const Layer *layer, lbajardsilogic@0: QPoint &pos) const; lbajardsilogic@0: virtual bool shouldIlluminateLocalSelection(QPoint &pos, lbajardsilogic@0: bool &closeToLeft, lbajardsilogic@0: bool &closeToRight) const; lbajardsilogic@0: lbajardsilogic@0: void setCentreLineVisible(bool visible); lbajardsilogic@0: bool getCentreLineVisible() const { return m_centreLineVisible; } lbajardsilogic@0: lbajardsilogic@0: virtual size_t getFirstVisibleFrame() const; lbajardsilogic@0: lbajardsilogic@0: virtual QImage *toNewImage(size_t f0, size_t f1); lbajardsilogic@0: virtual QImage *toNewImage() { return View::toNewImage(); } lbajardsilogic@0: virtual QSize getImageSize(size_t f0, size_t f1); lbajardsilogic@0: virtual QSize getImageSize() { return View::getImageSize(); } lbajardsilogic@0: lbajardsilogic@0: virtual QString toXmlString(QString indent = "", lbajardsilogic@0: QString extraAttributes = "") const; lbajardsilogic@0: lbajardsilogic@23: virtual QString toEasaierXmlString(QString indent = "", lbajardsilogic@23: QString extraAttributes = "") const; lbajardsilogic@23: lbajardsilogic@253: virtual int getIntervalModulo() {m_intervalModulo = (m_intervalModulo+1)%4; return m_intervalModulo;} lbajardsilogic@0: signals: lbajardsilogic@0: void paneInteractedWith(); lbajardsilogic@0: void rightButtonMenuRequested(QPoint position); lbajardsilogic@0: lbajardsilogic@0: public slots: lbajardsilogic@0: virtual void toolModeChanged(); lbajardsilogic@0: virtual void zoomWheelsEnabledChanged(); lbajardsilogic@0: virtual void viewZoomLevelChanged(View *v, unsigned long z, bool locked); lbajardsilogic@0: lbajardsilogic@0: virtual void horizontalThumbwheelMoved(int value); lbajardsilogic@0: virtual void verticalThumbwheelMoved(int value); lbajardsilogic@0: virtual void verticalZoomChanged(); lbajardsilogic@0: virtual void verticalPannerMoved(float x, float y, float w, float h); lbajardsilogic@0: virtual void editVerticalPannerExtents(); lbajardsilogic@0: lbajardsilogic@0: virtual void propertyContainerSelected(View *, PropertyContainer *pc); lbajardsilogic@0: lbajardsilogic@0: void mouseEnteredWidget(); lbajardsilogic@0: void mouseLeftWidget(); lbajardsilogic@0: lbajardsilogic@0: protected: lbajardsilogic@0: virtual void paintEvent(QPaintEvent *e); lbajardsilogic@0: virtual void mousePressEvent(QMouseEvent *e); lbajardsilogic@0: virtual void mouseReleaseEvent(QMouseEvent *e); lbajardsilogic@0: virtual void mouseMoveEvent(QMouseEvent *e); lbajardsilogic@0: virtual void mouseDoubleClickEvent(QMouseEvent *e); lbajardsilogic@0: virtual void leaveEvent(QEvent *e); lbajardsilogic@0: virtual void wheelEvent(QWheelEvent *e); lbajardsilogic@0: virtual void resizeEvent(QResizeEvent *e); lbajardsilogic@0: lbajardsilogic@0: virtual bool render(QPainter &paint, int x0, size_t f0, size_t f1); lbajardsilogic@0: lbajardsilogic@0: Selection getSelectionAt(int x, bool &closeToLeft, bool &closeToRight) const; lbajardsilogic@0: lbajardsilogic@0: bool editSelectionStart(QMouseEvent *e); lbajardsilogic@0: bool editSelectionDrag(QMouseEvent *e); lbajardsilogic@0: bool editSelectionEnd(QMouseEvent *e); lbajardsilogic@0: bool selectionIsBeingEdited() const; lbajardsilogic@0: lbajardsilogic@0: void updateHeadsUpDisplay(); lbajardsilogic@0: void updateVerticalPanner(); lbajardsilogic@0: lbajardsilogic@0: bool canTopLayerMoveVertical(); lbajardsilogic@0: bool getTopLayerDisplayExtents(float &valueMin, float &valueMax, lbajardsilogic@0: float &displayMin, float &displayMax, lbajardsilogic@0: QString *unit = 0); lbajardsilogic@0: bool setTopLayerDisplayExtents(float displayMin, float displayMax); lbajardsilogic@0: lbajardsilogic@0: void dragTopLayer(QMouseEvent *e); lbajardsilogic@0: void dragExtendSelection(QMouseEvent *e); lbajardsilogic@0: void zoomToRegion(int x0, int y0, int x1, int y1); lbajardsilogic@0: void updateContextHelp(const QPoint *pos); lbajardsilogic@0: lbajardsilogic@0: bool m_identifyFeatures; lbajardsilogic@0: QPoint m_identifyPoint; lbajardsilogic@0: QPoint m_clickPos; lbajardsilogic@0: QPoint m_mousePos; lbajardsilogic@0: bool m_clickedInRange; lbajardsilogic@0: bool m_shiftPressed; lbajardsilogic@0: bool m_ctrlPressed; lbajardsilogic@0: bool m_navigating; lbajardsilogic@0: bool m_resizing; lbajardsilogic@0: size_t m_dragCentreFrame; lbajardsilogic@0: float m_dragStartMinValue; lbajardsilogic@0: bool m_centreLineVisible; lbajardsilogic@0: size_t m_selectionStartFrame; lbajardsilogic@0: Selection m_editingSelection; lbajardsilogic@0: int m_editingSelectionEdge; lbajardsilogic@0: mutable int m_scaleWidth; lbajardsilogic@0: lbajardsilogic@0: enum DragMode { lbajardsilogic@0: UnresolvedDrag, lbajardsilogic@0: VerticalDrag, lbajardsilogic@0: HorizontalDrag, lbajardsilogic@0: FreeDrag lbajardsilogic@0: }; lbajardsilogic@0: DragMode m_dragMode; lbajardsilogic@0: lbajardsilogic@0: QWidget *m_headsUpDisplay; lbajardsilogic@0: Panner *m_vpan; lbajardsilogic@0: Thumbwheel *m_hthumb; lbajardsilogic@0: Thumbwheel *m_vthumb; lbajardsilogic@0: NotifyingPushButton *m_reset; lbajardsilogic@253: lbajardsilogic@253: int m_intervalModulo; lbajardsilogic@0: }; lbajardsilogic@0: lbajardsilogic@0: #endif lbajardsilogic@0: