Chris@0: /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ Chris@0: Chris@0: /* Chris@0: A waveform viewer and audio annotation editor. Chris@5: Chris Cannam, Queen Mary University of London, 2005-2006 Chris@0: Chris@0: This is experimental software. Not for distribution. Chris@0: */ Chris@0: Chris@0: #ifndef _PAN_WIDGET_H_ Chris@0: #define _PAN_WIDGET_H_ Chris@0: Chris@0: #include "base/View.h" Chris@0: Chris@0: #include Chris@0: Chris@0: class QWidget; Chris@0: class QPaintEvent; Chris@0: class Layer; Chris@0: class View; Chris@0: Chris@0: #include Chris@0: Chris@0: class Panner : public View Chris@0: { Chris@0: Q_OBJECT Chris@0: Chris@0: public: Chris@0: Panner(QWidget *parent = 0); Chris@0: Chris@0: void registerView(View *widget); Chris@0: void unregisterView(View *widget); Chris@0: Chris@0: virtual QString getPropertyContainerIconName() const { return "panner"; } Chris@0: Chris@0: public slots: Chris@0: virtual void modelChanged(size_t startFrame, size_t endFrame); Chris@0: virtual void modelReplaced(); Chris@0: Chris@0: virtual void viewManagerCentreFrameChanged(void *, unsigned long, bool); Chris@0: virtual void viewManagerZoomLevelChanged(void *, unsigned long, bool); Chris@0: virtual void viewManagerPlaybackFrameChanged(unsigned long); Chris@0: Chris@0: protected: Chris@0: virtual void paintEvent(QPaintEvent *e); Chris@0: virtual void mousePressEvent(QMouseEvent *e); Chris@0: virtual void mouseReleaseEvent(QMouseEvent *e); Chris@0: virtual void mouseMoveEvent(QMouseEvent *e); Chris@0: Chris@0: QPoint m_clickPos; Chris@0: QPoint m_mousePos; Chris@0: bool m_clickedInRange; Chris@0: size_t m_dragCentreFrame; Chris@0: Chris@0: typedef std::pair WidgetRec; // centre, zoom (-1 = invalid) Chris@0: typedef std::map WidgetMap; Chris@0: WidgetMap m_widgets; Chris@0: }; Chris@0: Chris@0: #endif Chris@0: