Manage B key correctly activated for spectrum, not waterfall. Add another independent B (dB) key for audio scope

This commit is contained in:
vsonnier
2017-01-27 21:38:48 +01:00
parent 532f34c608
commit 848d1bf0e3
8 changed files with 97 additions and 16 deletions
+23 -3
View File
@@ -45,7 +45,10 @@ ScopeCanvas::ScopeCanvas(wxWindow *parent, int *dispAttrs) : InteractiveCanvas(p
parentPanel.setFill(GLPanel::GLPANEL_FILL_NONE);
scopePanel.setSize(1.0,-1.0);
spectrumPanel.setSize(1.0,-1.0);
spectrumPanel.setShowDb(true);
showDb = true;
spectrumPanel.setShowDb(showDb);
//dB offset is a RF value, has no meaning in audio, disable it.
spectrumPanel.setUseDBOffset(false);
}
ScopeCanvas::~ScopeCanvas() {
@@ -89,8 +92,8 @@ bool ScopeCanvas::getPPMMode() {
return ppmMode;
}
void ScopeCanvas::setShowDb(bool showDb) {
this->showDb = showDb;
void ScopeCanvas::setShowDb(bool show) {
this->showDb = show;
}
bool ScopeCanvas::getShowDb() {
@@ -275,3 +278,20 @@ void ScopeCanvas::setHelpTip(std::string tip) {
helpTip = tip;
}
void ScopeCanvas::OnKeyDown(wxKeyEvent& event) {
InteractiveCanvas::OnKeyDown(event);
switch (event.GetKeyCode()) {
case 'B':
setShowDb(!getShowDb());
break;
default:
event.Skip();
}
}
void ScopeCanvas::OnKeyUp(wxKeyEvent& event) {
InteractiveCanvas::OnKeyUp(event);
}
+10
View File
@@ -20,6 +20,16 @@ public:
ScopeCanvas(wxWindow *parent, int *dispAttrs);
~ScopeCanvas();
//This is public because it is indeed forwarded from
//AppFrame::OnGlobalKeyDown, because global key handler intercepts
//calls in all windows.
void OnKeyDown(wxKeyEvent& event);
//This is public because it is indeed forwarded from
//AppFrame::OnGlobalKeyUp, because global key handler intercepts
//calls in all windows.
void OnKeyUp(wxKeyEvent& event);
void setDeviceName(std::string device_name);
void setPPMMode(bool ppmMode);
bool getPPMMode();
+17
View File
@@ -310,3 +310,20 @@ void SpectrumCanvas::OnMouseRightReleased(wxMouseEvent& event) {
}
mouseTracker.OnMouseRightReleased(event);
}
void SpectrumCanvas::OnKeyDown(wxKeyEvent& event) {
InteractiveCanvas::OnKeyDown(event);
switch (event.GetKeyCode()) {
case 'B':
setShowDb(!getShowDb());
break;
default:
event.Skip();
}
}
void SpectrumCanvas::OnKeyUp(wxKeyEvent& event) {
InteractiveCanvas::OnKeyUp(event);
}
+11
View File
@@ -19,6 +19,16 @@ public:
SpectrumCanvas(wxWindow *parent, int *dispAttrs);
~SpectrumCanvas();
//This is public because it is indeed forwarded from
//AppFrame::OnGlobalKeyDown, because global key handler intercepts
//calls in all windows.
void OnKeyDown(wxKeyEvent& event);
//This is public because it is indeed forwarded from
//AppFrame::OnGlobalKeyUp, because global key handler intercepts
//calls in all windows.
void OnKeyUp(wxKeyEvent& event);
void attachWaterfallCanvas(WaterfallCanvas *canvas_in);
void moveCenterFrequency(long long freqChange);
@@ -50,6 +60,7 @@ private:
void OnMouseRightDown(wxMouseEvent& event);
void OnMouseRightReleased(wxMouseEvent& event);
void updateScaleFactor(float factor);
PrimaryGLContext *glContext;
-5
View File
@@ -440,11 +440,6 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
wxGetApp().removeDemodulator(activeDemod);
wxGetApp().getDemodMgr().deleteThread(activeDemod);
break;
case 'B':
if (spectrumCanvas) {
spectrumCanvas->setShowDb(!spectrumCanvas->getShowDb());
}
break;
case WXK_SPACE:
wxGetApp().showFrequencyInput();
break;
+11
View File
@@ -36,10 +36,21 @@ public:
void setLinesPerSecond(int lps);
void setMinBandwidth(int min);
//This is public because it is indeed forwarded from
//AppFrame::OnGlobalKeyDown, because global key handler intercepts
//calls in all windows.
void OnKeyDown(wxKeyEvent& event);
//This is public because it is indeed forwarded from
//AppFrame::OnGlobalKeyUp, because global key handler intercepts
//calls in all windows.
void OnKeyUp(wxKeyEvent& event);
//public because called by SpectrumCanvas.
void OnMouseWheelMoved(wxMouseEvent& event);
private:
void OnPaint(wxPaintEvent& event);
void OnIdle(wxIdleEvent &event);