From 4f2b9d93c34ac54361f168fbb86d83a0745a7e72 Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Wed, 8 Apr 2015 18:37:40 -0400 Subject: [PATCH] Mouse wheel support for tuning bar digits --- src/AppFrame.cpp | 6 +++++- src/visual/TuningCanvas.cpp | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/AppFrame.cpp b/src/AppFrame.cpp index e163bcc..26ce8ff 100644 --- a/src/AppFrame.cpp +++ b/src/AppFrame.cpp @@ -518,7 +518,11 @@ void AppFrame::OnIdle(wxIdleEvent& event) { } } - if (!waterfallCanvas->HasFocus()) { + if (demodTuner->getMouseTracker()->mouseInView()) { + if (!demodTuner->HasFocus()) { + demodTuner->SetFocus(); + } + } else if (!waterfallCanvas->HasFocus()) { waterfallCanvas->SetFocus(); } diff --git a/src/visual/TuningCanvas.cpp b/src/visual/TuningCanvas.cpp index b3f950a..30e8479 100644 --- a/src/visual/TuningCanvas.cpp +++ b/src/visual/TuningCanvas.cpp @@ -22,6 +22,7 @@ EVT_LEFT_DOWN(TuningCanvas::OnMouseDown) EVT_LEFT_UP(TuningCanvas::OnMouseReleased) EVT_LEAVE_WINDOW(TuningCanvas::OnMouseLeftWindow) EVT_ENTER_WINDOW(TuningCanvas::OnMouseEnterWindow) +EVT_MOUSEWHEEL(TuningCanvas::OnMouseWheelMoved) wxEND_EVENT_TABLE() TuningCanvas::TuningCanvas(wxWindow *parent, int *attribList) : @@ -266,6 +267,16 @@ void TuningCanvas::OnMouseDown(wxMouseEvent& event) { void TuningCanvas::OnMouseWheelMoved(wxMouseEvent& event) { InteractiveCanvas::OnMouseWheelMoved(event); + + int hExponent = hoverIndex - 1; + + if (hoverState != TUNING_HOVER_NONE && !mouseTracker.mouseDown() && hoverIndex) { + if (event.m_wheelAxis == wxMOUSE_WHEEL_VERTICAL) { + StepTuner(hoverState, hExponent, (event.m_wheelRotation > 0)?true:false); + } else { + StepTuner(hoverState, hExponent, (event.m_wheelRotation < 0)?true:false); + } + } } void TuningCanvas::OnMouseReleased(wxMouseEvent& event) {