Mouse wheel support for tuning bar digits

This commit is contained in:
Charles J. Cliffe 2015-04-08 18:37:40 -04:00
parent 2dada587d1
commit 4f2b9d93c3
2 changed files with 16 additions and 1 deletions

View File

@ -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();
}

View File

@ -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) {