annotate widgets/LevelPanToolButton.h @ 1620:dc0e47f234a2 tip

Fix some erroneous uses of reference frame where we intended "above"-view frame
author Chris Cannam
date Tue, 18 Aug 2020 16:39:26 +0100
parents 27ea5d61b402
children
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@1589 21 class QMenu;
Chris@929 22
Chris@929 23 class LevelPanToolButton : public QToolButton
Chris@929 24 {
Chris@929 25 Q_OBJECT
Chris@929 26
Chris@929 27 public:
Chris@929 28 LevelPanToolButton(QWidget *parent = 0);
Chris@929 29 ~LevelPanToolButton();
Chris@929 30
Chris@929 31 /// Return level as a gain value in the range [0,1]
Chris@929 32 float getLevel() const;
Chris@929 33
Chris@929 34 /// Return pan as a value in the range [-1,1]
Chris@929 35 float getPan() const;
Chris@929 36
Chris@940 37 /// Discover whether the level range includes muting or not
Chris@940 38 bool includesMute() const;
Chris@940 39
Chris@929 40 void setImageSize(int pixels);
Chris@1589 41
Chris@1589 42 /// Specify whether a right-click context menu is provided
Chris@1589 43 void setProvideContextMenu(bool);
Chris@1266 44
Chris@942 45 void setBigImageSize(int pixels);
Chris@1266 46
Chris@929 47 public slots:
Chris@929 48 /// Set level in the range [0,1] -- will be rounded
Chris@929 49 void setLevel(float);
Chris@929 50
Chris@929 51 /// Set pan in the range [-1,1] -- will be rounded
Chris@929 52 void setPan(float);
Chris@929 53
Chris@1187 54 /// Set left and right peak monitoring levels in the range [0,1]
Chris@1187 55 void setMonitoringLevels(float, float);
Chris@1187 56
Chris@940 57 /// Specify whether the level range should include muting or not
Chris@940 58 void setIncludeMute(bool);
Chris@940 59
Chris@933 60 void setEnabled(bool enabled);
Chris@940 61
Chris@1589 62 protected slots:
Chris@1589 63 void contextMenuRequested(const QPoint &);
Chris@1589 64
Chris@929 65 signals:
Chris@929 66 void levelChanged(float);
Chris@929 67 void panChanged(float);
Chris@929 68
Chris@1180 69 void mouseEntered();
Chris@1180 70 void mouseLeft();
Chris@1180 71
Chris@930 72 private slots:
Chris@930 73 void selfLevelChanged(float);
Chris@930 74 void selfClicked();
Chris@930 75
Chris@929 76 protected:
Chris@1406 77 void paintEvent(QPaintEvent *) override;
Chris@1406 78 void enterEvent(QEvent *) override;
Chris@1406 79 void leaveEvent(QEvent *) override;
Chris@1406 80 void mousePressEvent(QMouseEvent *) override;
Chris@1406 81 void wheelEvent(QWheelEvent *e) override;
Chris@932 82
Chris@929 83 LevelPanWidget *m_lpw;
Chris@929 84 int m_pixels;
Chris@942 85 int m_pixelsBig;
Chris@930 86 bool m_muted;
Chris@930 87 float m_savedLevel;
Chris@1589 88 bool m_provideContextMenu;
Chris@1589 89 QMenu *m_lastContextMenu;
Chris@929 90 };
Chris@929 91
Chris@929 92 #endif