mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-29 23:28:39 -05:00
Experimental shift key click to prevent carry for frequency tuner
This commit is contained in:
parent
3af564037c
commit
b74e0d0fad
@ -225,17 +225,20 @@ void TuningCanvas::OnMouseReleased(wxMouseEvent& event) {
|
|||||||
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||||
|
|
||||||
int hExponent = hoverIndex - 1;
|
int hExponent = hoverIndex - 1;
|
||||||
|
double exp = pow(10, hExponent);
|
||||||
|
long long amount = top?exp:-exp;
|
||||||
|
|
||||||
if (hoverState == TUNING_HOVER_FREQ && activeDemod) {
|
if (hoverState == TUNING_HOVER_FREQ && activeDemod) {
|
||||||
long long freq = activeDemod->getFrequency();
|
long long freq = activeDemod->getFrequency();
|
||||||
if (top) {
|
|
||||||
freq += pow(10, hExponent);
|
|
||||||
} else {
|
|
||||||
freq -= pow(10, hExponent);
|
|
||||||
}
|
|
||||||
|
|
||||||
long long diff = abs(wxGetApp().getFrequency() - freq);
|
long long diff = abs(wxGetApp().getFrequency() - freq);
|
||||||
|
|
||||||
|
if (shiftDown) {
|
||||||
|
bool carried = (long long)((freq) / (exp * 10)) != (long long)((freq + amount) / (exp * 10));
|
||||||
|
freq += carried?(9*-amount):amount;
|
||||||
|
} else {
|
||||||
|
freq += amount;
|
||||||
|
}
|
||||||
|
|
||||||
if (wxGetApp().getSampleRate() / 2 < diff) {
|
if (wxGetApp().getSampleRate() / 2 < diff) {
|
||||||
wxGetApp().setFrequency(freq);
|
wxGetApp().setFrequency(freq);
|
||||||
}
|
}
|
||||||
@ -245,15 +248,10 @@ void TuningCanvas::OnMouseReleased(wxMouseEvent& event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hoverState == TUNING_HOVER_BW) {
|
if (hoverState == TUNING_HOVER_BW) {
|
||||||
long bw = wxGetApp().getDemodMgr().getLastBandwidth();
|
long bw = wxGetApp().getDemodMgr().getLastBandwidth()+amount;
|
||||||
if (bw > wxGetApp().getSampleRate()) {
|
if (bw > wxGetApp().getSampleRate()) {
|
||||||
bw = wxGetApp().getSampleRate();
|
bw = wxGetApp().getSampleRate();
|
||||||
}
|
}
|
||||||
if (top) {
|
|
||||||
bw += pow(10, hExponent);
|
|
||||||
} else {
|
|
||||||
bw -= pow(10, hExponent);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxGetApp().getDemodMgr().setLastBandwidth(bw);
|
wxGetApp().getDemodMgr().setLastBandwidth(bw);
|
||||||
|
|
||||||
@ -263,11 +261,7 @@ void TuningCanvas::OnMouseReleased(wxMouseEvent& event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hoverState == TUNING_HOVER_CENTER) {
|
if (hoverState == TUNING_HOVER_CENTER) {
|
||||||
if (top) {
|
wxGetApp().setFrequency(wxGetApp().getFrequency() + amount);
|
||||||
wxGetApp().setFrequency(wxGetApp().getFrequency() + pow(10, hExponent));
|
|
||||||
} else {
|
|
||||||
wxGetApp().setFrequency(wxGetApp().getFrequency() - pow(10, hExponent));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCursor(wxCURSOR_ARROW);
|
SetCursor(wxCURSOR_ARROW);
|
||||||
|
Loading…
Reference in New Issue
Block a user