Chris@929: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
Chris@929: 
Chris@929: /*
Chris@929:     Sonic Visualiser
Chris@929:     An audio file viewer and annotation editor.
Chris@929:     Centre for Digital Music, Queen Mary, University of London.
Chris@929:     
Chris@929:     This program is free software; you can redistribute it and/or
Chris@929:     modify it under the terms of the GNU General Public License as
Chris@929:     published by the Free Software Foundation; either version 2 of the
Chris@929:     License, or (at your option) any later version.  See the file
Chris@929:     COPYING included with this distribution for more information.
Chris@929: */
Chris@929: 
Chris@929: #ifndef LEVEL_PAN_TOOLBUTTON_H
Chris@929: #define LEVEL_PAN_TOOLBUTTON_H
Chris@929: 
Chris@929: #include <QToolButton>
Chris@929: 
Chris@929: class LevelPanWidget;
Chris@929: 
Chris@929: class LevelPanToolButton : public QToolButton
Chris@929: {
Chris@929:     Q_OBJECT
Chris@929: 
Chris@929: public:
Chris@929:     LevelPanToolButton(QWidget *parent = 0);
Chris@929:     ~LevelPanToolButton();
Chris@929:     
Chris@929:     /// Return level as a gain value in the range [0,1]
Chris@929:     float getLevel() const; 
Chris@929:     
Chris@929:     /// Return pan as a value in the range [-1,1]
Chris@929:     float getPan() const;
Chris@929: 
Chris@940:     /// Discover whether the level range includes muting or not
Chris@940:     bool includesMute() const;
Chris@940: 
Chris@929:     void setImageSize(int pixels);
Chris@1266:                         
Chris@942:     void setBigImageSize(int pixels);
Chris@1266:                         
Chris@929: public slots:
Chris@929:     /// Set level in the range [0,1] -- will be rounded
Chris@929:     void setLevel(float);
Chris@929: 
Chris@929:     /// Set pan in the range [-1,1] -- will be rounded
Chris@929:     void setPan(float);
Chris@929: 
Chris@1187:     /// Set left and right peak monitoring levels in the range [0,1]
Chris@1187:     void setMonitoringLevels(float, float);
Chris@1187:     
Chris@940:     /// Specify whether the level range should include muting or not
Chris@940:     void setIncludeMute(bool);
Chris@940: 
Chris@933:     void setEnabled(bool enabled);
Chris@940:     
Chris@929: signals:
Chris@929:     void levelChanged(float);
Chris@929:     void panChanged(float);
Chris@929: 
Chris@1180:     void mouseEntered();
Chris@1180:     void mouseLeft();
Chris@1180: 
Chris@930: private slots:
Chris@930:     void selfLevelChanged(float);
Chris@930:     void selfClicked();
Chris@930:     
Chris@929: protected:
Chris@1180:     virtual void paintEvent(QPaintEvent *);
Chris@1180:     virtual void enterEvent(QEvent *);
Chris@1180:     virtual void leaveEvent(QEvent *);
Chris@1300:     virtual void mousePressEvent(QMouseEvent *);
Chris@1200:     virtual void wheelEvent(QWheelEvent *e);
Chris@932:     
Chris@929:     LevelPanWidget *m_lpw;
Chris@929:     int m_pixels;
Chris@942:     int m_pixelsBig;
Chris@930:     bool m_muted;
Chris@930:     float m_savedLevel;
Chris@929: };
Chris@929: 
Chris@929: #endif