Mercurial > hg > svgui
diff widgets/LevelPanWidget.cpp @ 1249:8ef67917c301
Ctrl-click, and middle-button click, on level-pan widget reset to default (not implemented yet for level-pan tool button though)
author | Chris Cannam |
---|---|
date | Tue, 28 Feb 2017 14:20:56 +0000 |
parents | a68c25ba1153 |
children | c49a48fcc364 |
line wrap: on
line diff
--- a/widgets/LevelPanWidget.cpp Tue Feb 28 14:07:47 2017 +0000 +++ b/widgets/LevelPanWidget.cpp Tue Feb 28 14:20:56 2017 +0000 @@ -40,6 +40,7 @@ m_monitorLeft(-1), m_monitorRight(-1), m_editable(true), + m_editing(false), m_includeMute(true) { setToolTip(tr("Drag vertically to adjust level, horizontally to adjust pan")); @@ -51,6 +52,13 @@ { } +void +LevelPanWidget::setToDefault() +{ + setLevel(1.0); + setPan(0.0); +} + QSize LevelPanWidget::sizeHint() const { @@ -211,13 +219,28 @@ void LevelPanWidget::mousePressEvent(QMouseEvent *e) { + if (e->button() == Qt::MidButton || + ((e->button() == Qt::LeftButton) && + (e->modifiers() & Qt::ControlModifier))) { + setToDefault(); + } else if (e->button() == Qt::LeftButton) { + m_editing = true; + mouseMoveEvent(e); + } +} + +void +LevelPanWidget::mouseReleaseEvent(QMouseEvent *e) +{ mouseMoveEvent(e); + m_editing = false; } void LevelPanWidget::mouseMoveEvent(QMouseEvent *e) { if (!m_editable) return; + if (!m_editing) return; int level, pan; toCell(rect(), e->pos(), level, pan); @@ -236,12 +259,6 @@ } void -LevelPanWidget::mouseReleaseEvent(QMouseEvent *e) -{ - mouseMoveEvent(e); -} - -void LevelPanWidget::wheelEvent(QWheelEvent *e) { if (e->modifiers() & Qt::ControlModifier) {