annotate widgets/LevelPanToolButton.h @ 1454:4a6ca97ce783 single-point

Remove margin from inner frame
author Chris Cannam
date Fri, 10 May 2019 08:44:32 +0100
parents a18e78b9c78b
children 27ea5d61b402
rev   line source
Chris@929 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@929 2
Chris@929 3 /*
Chris@929 4 Sonic Visualiser
Chris@929 5 An audio file viewer and annotation editor.
Chris@929 6 Centre for Digital Music, Queen Mary, University of London.
Chris@929 7
Chris@929 8 This program is free software; you can redistribute it and/or
Chris@929 9 modify it under the terms of the GNU General Public License as
Chris@929 10 published by the Free Software Foundation; either version 2 of the
Chris@929 11 License, or (at your option) any later version. See the file
Chris@929 12 COPYING included with this distribution for more information.
Chris@929 13 */
Chris@929 14
Chris@929 15 #ifndef LEVEL_PAN_TOOLBUTTON_H
Chris@929 16 #define LEVEL_PAN_TOOLBUTTON_H
Chris@929 17
Chris@929 18 #include <QToolButton>
Chris@929 19
Chris@929 20 class LevelPanWidget;
Chris@929 21
Chris@929 22 class LevelPanToolButton : public QToolButton
Chris@929 23 {
Chris@929 24 Q_OBJECT
Chris@929 25
Chris@929 26 public:
Chris@929 27 LevelPanToolButton(QWidget *parent = 0);
Chris@929 28 ~LevelPanToolButton();
Chris@929 29
Chris@929 30 /// Return level as a gain value in the range [0,1]
Chris@929 31 float getLevel() const;
Chris@929 32
Chris@929 33 /// Return pan as a value in the range [-1,1]
Chris@929 34 float getPan() const;
Chris@929 35
Chris@940 36 /// Discover whether the level range includes muting or not
Chris@940 37 bool includesMute() const;
Chris@940 38
Chris@929 39 void setImageSize(int pixels);
Chris@1266 40
Chris@942 41 void setBigImageSize(int pixels);
Chris@1266 42
Chris@929 43 public slots:
Chris@929 44 /// Set level in the range [0,1] -- will be rounded
Chris@929 45 void setLevel(float);
Chris@929 46
Chris@929 47 /// Set pan in the range [-1,1] -- will be rounded
Chris@929 48 void setPan(float);
Chris@929 49
Chris@1187 50 /// Set left and right peak monitoring levels in the range [0,1]
Chris@1187 51 void setMonitoringLevels(float, float);
Chris@1187 52
Chris@940 53 /// Specify whether the level range should include muting or not
Chris@940 54 void setIncludeMute(bool);
Chris@940 55
Chris@933 56 void setEnabled(bool enabled);
Chris@940 57
Chris@929 58 signals:
Chris@929 59 void levelChanged(float);
Chris@929 60 void panChanged(float);
Chris@929 61
Chris@1180 62 void mouseEntered();
Chris@1180 63 void mouseLeft();
Chris@1180 64
Chris@930 65 private slots:
Chris@930 66 void selfLevelChanged(float);
Chris@930 67 void selfClicked();
Chris@930 68
Chris@929 69 protected:
Chris@1406 70 void paintEvent(QPaintEvent *) override;
Chris@1406 71 void enterEvent(QEvent *) override;
Chris@1406 72 void leaveEvent(QEvent *) override;
Chris@1406 73 void mousePressEvent(QMouseEvent *) override;
Chris@1406 74 void wheelEvent(QWheelEvent *e) override;
Chris@932 75
Chris@929 76 LevelPanWidget *m_lpw;
Chris@929 77 int m_pixels;
Chris@942 78 int m_pixelsBig;
Chris@930 79 bool m_muted;
Chris@930 80 float m_savedLevel;
Chris@929 81 };
Chris@929 82
Chris@929 83 #endif