Enable clearing frequency digit through right-click.

Right click on a frrequency digit will clear the digit as well as the
digits below. For example, if frequncy is 123.456789 MHz and user right
clicks on 5, the new frequency becomes 123.400000 MHz.
This commit is contained in:
Alexandru Csete 2015-11-16 21:51:40 +01:00
parent d144fa1412
commit ede3c3a11c
3 changed files with 29 additions and 5 deletions

View File

@ -19,6 +19,7 @@
IMPROVED: Fractional PPM correction.
IMPROVED: AGC peformance.
IMPROVED: FFT performance.
IMPROVED: Right click on frequency digit to clear digits.
2.3.2 Released November 28, 2014

View File

@ -12,7 +12,9 @@
//==========================================================================================
// + + + This Software is released under the "Simplified BSD License" + + +
//Copyright 2010 Moe Wheatley. All rights reserved.
// Copyright 2010 Moe Wheatley.
// Copyright 2012 Alexandru Csete
// All rights reserved.
//
//Redistribution and use in source and binary forms, with or without modification, are
//permitted provided that the following conditions are met:
@ -501,10 +503,7 @@ void CFreqCtrl::mousePressEvent(QMouseEvent * event)
}
else
{
if (pt.y() < m_DigitInfo[i].dQRect.bottom()/2) //top half?
incFreq();//IncDigit();
else
decFreq();//DecDigit(); //botom half
clearFreq();
}
}
}
@ -806,6 +805,7 @@ void CFreqCtrl::decDigit()
}
}
}
//////////////////////////////////////////////////////////////////////////////
// Decrement the frequency by this digit active in edit mode
//////////////////////////////////////////////////////////////////////////////
@ -828,6 +828,28 @@ void CFreqCtrl::decFreq()
}
}
//////////////////////////////////////////////////////////////////////////////
// Clear the selected digit and the digits below (i.e. set them to 0)
//////////////////////////////////////////////////////////////////////////////
void CFreqCtrl::clearFreq()
{
if (m_ActiveEditDigit >= 0)
{
if (m_DigitInfo[m_ActiveEditDigit].editmode)
{
m_freq -= m_DigitInfo[m_ActiveEditDigit].val *
m_DigitInfo[m_ActiveEditDigit].incval;
/* digits below the active one are reset to 0 */
m_freq -= m_freq % m_DigitInfo[m_ActiveEditDigit].weight;
setFrequency(m_freq);
m_LastEditDigit = m_ActiveEditDigit;
}
}
}
/////////////////////////////////////////////////////////////////////
// Cursor move routines for arrow key editing
/////////////////////////////////////////////////////////////////////

View File

@ -82,6 +82,7 @@ private:
void decDigit();
void incFreq();
void decFreq();
void clearFreq();
void cursorHome();
void cursorEnd();
void moveCursorLeft();