mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-26 21:58:37 -05:00
Simple tuner half-band display patch
This commit is contained in:
parent
571ccd3f48
commit
904db013c7
@ -874,6 +874,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||
#endif
|
||||
demodMuteButton->setSelection(demod->isMuted()?1:-1);
|
||||
modemPropertiesUpdated.store(true);
|
||||
demodTuner->setHalfBand(dType=="USB" || dType=="LSB");
|
||||
}
|
||||
if (demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) {
|
||||
long long centerFreq = demod->getFrequency();
|
||||
@ -907,17 +908,20 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||
// basic demodulators
|
||||
if (dSelection != "" && dSelection != demod->getDemodulatorType()) {
|
||||
demod->setDemodulatorType(dSelection);
|
||||
demodTuner->setHalfBand(dSelection=="USB" || dSelection=="LSB");
|
||||
demodModeSelectorAdv->setSelection(-1);
|
||||
}
|
||||
// advanced demodulators
|
||||
else if (dSelectionadv != "" && dSelectionadv != demod->getDemodulatorType()) {
|
||||
demod->setDemodulatorType(dSelectionadv);
|
||||
demodTuner->setHalfBand(false);
|
||||
demodModeSelector->setSelection(-1);
|
||||
}
|
||||
#else
|
||||
// basic demodulators
|
||||
if (dSelection != "" && dSelection != demod->getDemodulatorType()) {
|
||||
demod->setDemodulatorType(dSelection);
|
||||
demodTuner->setHalfBand(dSelection=="USB" || dSelection=="LSB");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -31,7 +31,7 @@ EVT_KEY_UP(TuningCanvas::OnKeyUp)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
TuningCanvas::TuningCanvas(wxWindow *parent, int *attribList) :
|
||||
InteractiveCanvas(parent, attribList), dragAccum(0), uxDown(0), top(false), bottom(false), freq(-1), bw(-1), center(-1) {
|
||||
InteractiveCanvas(parent, attribList), dragAccum(0), uxDown(0), top(false), bottom(false), freq(-1), bw(-1), center(-1), halfBand(false) {
|
||||
|
||||
glContext = new TuningContext(this, &wxGetApp().GetContext(this));
|
||||
|
||||
@ -74,6 +74,10 @@ bool TuningCanvas::changed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void TuningCanvas::setHalfBand(bool hb) {
|
||||
halfBand = hb;
|
||||
}
|
||||
|
||||
void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
@ -146,7 +150,7 @@ void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
glContext->DrawTunerDigitBox((int)log10(snap), 11, freqDP, freqW, RGBA4f(1.0,0.0,0.0));
|
||||
}
|
||||
}
|
||||
glContext->DrawTuner(bw, 7, bwDP, bwW);
|
||||
glContext->DrawTuner(halfBand?(bw/2):bw, 7, bwDP, bwW);
|
||||
glContext->DrawTuner(center, 11, centerDP, centerW);
|
||||
|
||||
glContext->DrawEnd();
|
||||
@ -158,6 +162,10 @@ void TuningCanvas::StepTuner(ActiveState state, int exponent, bool up) {
|
||||
double exp = pow(10, exponent);
|
||||
long long amount = up?exp:-exp;
|
||||
|
||||
if (halfBand && exp == 1) {
|
||||
amount *= 2;
|
||||
}
|
||||
|
||||
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
if (state == TUNING_HOVER_FREQ && activeDemod) {
|
||||
long long freq = activeDemod->getFrequency();
|
||||
|
@ -24,6 +24,8 @@ public:
|
||||
void setHelpTip(std::string tip);
|
||||
bool changed();
|
||||
|
||||
void setHalfBand(bool hb);
|
||||
|
||||
private:
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnIdle(wxIdleEvent &event);
|
||||
@ -68,6 +70,7 @@ private:
|
||||
int lastPPM;
|
||||
|
||||
long long freq, bw, center;
|
||||
bool halfBand;
|
||||
//
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user