diff --git a/README.md b/README.md index bfd20fbae..87c603865 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,7 @@ The following people and organisations have contributed to gqrx: * Darin Franklin * Davide Gerhard * Dominic Chen +* Doug Hammond * Elias Önal * Federico Fuga * Frank Brickle, AB2KT diff --git a/resources/news.txt b/resources/news.txt index df335b2de..5a10d9a93 100644 --- a/resources/news.txt +++ b/resources/news.txt @@ -3,6 +3,7 @@ FIXED: DSP stops when device is changed. FIXED: USB error when device settings are changed. + FIXED: Changing frequency using the keyboard doesn't work on MacOS. 2.15: Released December 15, 2021 diff --git a/src/qtgui/freqctrl.cpp b/src/qtgui/freqctrl.cpp index 37cd7ceeb..68f0ade7a 100644 --- a/src/qtgui/freqctrl.cpp +++ b/src/qtgui/freqctrl.cpp @@ -95,6 +95,33 @@ bool CFreqCtrl::inRect(QRect &rect, QPoint &point) return false; } +void CFreqCtrl::setActiveDigit(int idx) +{ + for (int i = m_DigStart; i < m_NumDigits; i++) + { + if (i == idx) + { + if (!m_DigitInfo[i].editmode) + { + m_DigitInfo[i].editmode = true; + m_ActiveEditDigit = i; + } + } + else + { + // un-highlight the previous digit if moved off it + if (m_DigitInfo[i].editmode) + { + m_DigitInfo[i].editmode = false; + m_DigitInfo[i].modified = true; + } + } + } + + updateCtrl(false); + +} + static int fmax_to_numdigits(qint64 fmax) { if (fmax < 10e6) @@ -401,24 +428,9 @@ void CFreqCtrl::mouseMoveEvent(QMouseEvent *event) { if (inRect(m_DigitInfo[i].dQRect, pt)) { - if (!m_DigitInfo[i].editmode) - { - m_DigitInfo[i].editmode = true; - m_ActiveEditDigit = i; - } - } - else - { - // un-highlight the previous digit if moved off it - if (m_DigitInfo[i].editmode) - { - m_DigitInfo[i].editmode = false; - m_DigitInfo[i].modified = true; - } + setActiveDigit(i); } } - - updateCtrl(false); } } @@ -822,8 +834,7 @@ void CFreqCtrl::moveCursorLeft() { if ((m_ActiveEditDigit >= 0) && (m_ActiveEditDigit < m_NumDigits - 1)) { - cursor().setPos(mapToGlobal(m_DigitInfo[++m_ActiveEditDigit].dQRect. - center())); + setActiveDigit(m_ActiveEditDigit + 1); } } @@ -831,8 +842,7 @@ void CFreqCtrl::moveCursorRight() { if (m_ActiveEditDigit > m_FirstEditableDigit) { - cursor().setPos(mapToGlobal(m_DigitInfo[--m_ActiveEditDigit].dQRect. - center())); + setActiveDigit(m_ActiveEditDigit - 1); } } @@ -840,8 +850,7 @@ void CFreqCtrl::cursorHome() { if (m_ActiveEditDigit >= 0) { - cursor().setPos(mapToGlobal( - m_DigitInfo[m_NumDigits - 1].dQRect.center())); + setActiveDigit(m_NumDigits - 1); } } @@ -849,8 +858,7 @@ void CFreqCtrl::cursorEnd() { if (m_ActiveEditDigit > 0) { - cursor().setPos(mapToGlobal(m_DigitInfo[m_FirstEditableDigit].dQRect. - center())); + setActiveDigit(m_FirstEditableDigit); } } diff --git a/src/qtgui/freqctrl.h b/src/qtgui/freqctrl.h index ff30397e6..56e7737d7 100644 --- a/src/qtgui/freqctrl.h +++ b/src/qtgui/freqctrl.h @@ -86,6 +86,7 @@ public slots: void moveCursorLeft(); void moveCursorRight(); bool inRect(QRect &rect, QPoint &point); + void setActiveDigit(int idx); bool m_UpdateAll; bool m_ExternalKeyActive;