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 _PAN_WIDGET_H_
Chris@127: #define _PAN_WIDGET_H_
Chris@127: 
Chris@128: #include "View.h"
Chris@127: 
Chris@127: #include <QPoint>
Chris@127: 
Chris@127: class QWidget;
Chris@127: class QPaintEvent;
Chris@127: class Layer;
Chris@127: class View;
Chris@127: 
Chris@127: #include <map>
Chris@127: 
Chris@127: class Panner : public View
Chris@127: {
Chris@127:     Q_OBJECT
Chris@127: 
Chris@127: public:
Chris@127:     Panner(QWidget *parent = 0);
Chris@127: 
Chris@127:     void registerView(View *widget);
Chris@127:     void unregisterView(View *widget);
Chris@127: 
Chris@127:     virtual QString getPropertyContainerIconName() const { return "panner"; }
Chris@127: 
Chris@127: public slots:
Chris@127:     virtual void modelChanged(size_t startFrame, size_t endFrame);
Chris@127:     virtual void modelReplaced();
Chris@127: 
Chris@127:     virtual void viewManagerCentreFrameChanged(void *, unsigned long, bool);
Chris@127:     virtual void viewManagerZoomLevelChanged(void *, unsigned long, bool);
Chris@127:     virtual void viewManagerPlaybackFrameChanged(unsigned long);
Chris@127: 
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 bool shouldLabelSelections() const { return false; }
Chris@127: 
Chris@127:     QPoint m_clickPos;
Chris@127:     QPoint m_mousePos;
Chris@127:     bool m_clickedInRange;
Chris@127:     size_t m_dragCentreFrame;
Chris@127:     
Chris@127:     typedef std::set<void *> WidgetSet;
Chris@127:     WidgetSet m_widgets;
Chris@127: };
Chris@127: 
Chris@127: #endif
Chris@127: