diff options
author | Harshit Maurya <hmaurya999@gmail.com> | 2020-05-14 04:36:42 +0530 |
---|---|---|
committer | Harshit Maurya <hmaurya999@gmail.com> | 2020-05-16 02:17:43 +0530 |
commit | 58c88a68095fde74e0b1f47b8c1ea894b62462a2 (patch) | |
tree | 77acf92455aec4e6b5682c3010af22b70e28cdbb | |
parent | 99aa12e06eaa07db65026519d5875ee24f33da20 (diff) |
wwaveformviewer: disable cue menu when playing
-rw-r--r-- | src/widget/wwaveformviewer.cpp | 10 | ||||
-rw-r--r-- | src/widget/wwaveformviewer.h | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/widget/wwaveformviewer.cpp b/src/widget/wwaveformviewer.cpp index 4cae01b9ea..5b167a4b37 100644 --- a/src/widget/wwaveformviewer.cpp +++ b/src/widget/wwaveformviewer.cpp @@ -27,7 +27,6 @@ WWaveformViewer::WWaveformViewer(const char* group, UserSettingsPointer pConfig, m_waveformWidget(nullptr) { setMouseTracking(true); setAcceptDrops(true); - m_pZoom = new ControlProxy(group, "waveform_zoom", this); m_pZoom->connectValueChanged(this, &WWaveformViewer::onZoomChange); @@ -37,6 +36,7 @@ WWaveformViewer::WWaveformViewer(const char* group, UserSettingsPointer pConfig, group, "scratch_position", this); m_pWheel = new ControlProxy( group, "wheel", this); + m_pPlayEnabled = new ControlProxy(group, "play", this); setAttribute(Qt::WA_OpaquePaintEvent); } @@ -80,7 +80,7 @@ void WWaveformViewer::mousePressEvent(QMouseEvent* event) { m_pScratchPositionEnable->slotSet(1.0); } else if (event->button() == Qt::RightButton) { const auto currentTrack = m_waveformWidget->getTrackInfo(); - if (m_pHoveredMark) { + if (!isPlaying() && m_pHoveredMark) { auto cueAtClickPos = getCuePointerFromCueMark(m_pHoveredMark); if (cueAtClickPos) { m_pCueMenuPopup->setTrackAndCue(currentTrack, cueAtClickPos); @@ -133,7 +133,7 @@ void WWaveformViewer::mouseMoveEvent(QMouseEvent* event) { // clamp to [0.0, 1.0] v = math_clamp(v, 0.0, 1.0); m_pWheel->setParameter(v); - } else { + } else if (!isPlaying()) { WaveformMarkPointer pMark; pMark = m_waveformWidget->getCueMarkAtPoint(event->pos()); if (pMark) { @@ -279,3 +279,7 @@ void WWaveformViewer::unhighlightMark(WaveformMarkPointer pMark) { QColor originalColor = mixxx::RgbColor::toQColor(getCuePointerFromCueMark(pMark)->getColor()); pMark->setBaseColor(originalColor); } + +bool WWaveformViewer::isPlaying() { + return m_pPlayEnabled->get(); +} diff --git a/src/widget/wwaveformviewer.h b/src/widget/wwaveformviewer.h index c02333285f..6dafef0f4e 100644 --- a/src/widget/wwaveformviewer.h +++ b/src/widget/wwaveformviewer.h @@ -72,6 +72,7 @@ private: ControlProxy* m_pScratchPositionEnable; ControlProxy* m_pScratchPosition; ControlProxy* m_pWheel; + ControlProxy* m_pPlayEnabled; bool m_bScratching; bool m_bBending; QPoint m_mouseAnchor; @@ -85,6 +86,7 @@ private: CuePointer getCuePointerFromCueMark(WaveformMarkPointer pMark); void highlightMark(WaveformMarkPointer pMark); void unhighlightMark(WaveformMarkPointer pMark); + bool isPlaying(); }; #endif |