mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-09-27 15:56:48 -04:00
Update frequency dialog to support bandwidth entry
This commit is contained in:
parent
8dc2e6cacc
commit
8c7d2576ad
@ -13,7 +13,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "CubicSDR.h"
|
#include "CubicSDR.h"
|
||||||
#include "FrequencyDialog.h"
|
|
||||||
|
|
||||||
#ifdef _OSX_APP_
|
#ifdef _OSX_APP_
|
||||||
#include "CoreFoundation/CoreFoundation.h"
|
#include "CoreFoundation/CoreFoundation.h"
|
||||||
@ -389,8 +388,25 @@ int CubicSDR::getPPM() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CubicSDR::showFrequencyInput() {
|
void CubicSDR::showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetMode) {
|
||||||
FrequencyDialog fdialog(appframe, -1, demodMgr.getActiveDemodulator()?_("Set Demodulator Frequency"):_("Set Center Frequency"), demodMgr.getActiveDemodulator(), wxPoint(-100,-100), wxSize(320, 75 ));
|
const wxString demodTitle("Set Demodulator Frequency");
|
||||||
|
const wxString freqTitle("Set Center Frequency");
|
||||||
|
const wxString bwTitle("Set Demodulator Bandwidth");
|
||||||
|
|
||||||
|
wxString title;
|
||||||
|
|
||||||
|
switch (targetMode) {
|
||||||
|
case FrequencyDialog::FDIALOG_TARGET_DEFAULT:
|
||||||
|
title = demodMgr.getActiveDemodulator()?demodTitle:freqTitle;
|
||||||
|
break;
|
||||||
|
case FrequencyDialog::FDIALOG_TARGET_BANDWIDTH:
|
||||||
|
title = bwTitle;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
FrequencyDialog fdialog(appframe, -1, title, demodMgr.getActiveDemodulator(), wxPoint(-100,-100), wxSize(320, 75 ), wxDEFAULT_DIALOG_STYLE, targetMode);
|
||||||
fdialog.ShowModal();
|
fdialog.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "DemodulatorMgr.h"
|
#include "DemodulatorMgr.h"
|
||||||
#include "AppConfig.h"
|
#include "AppConfig.h"
|
||||||
#include "AppFrame.h"
|
#include "AppFrame.h"
|
||||||
|
#include "FrequencyDialog.h"
|
||||||
|
|
||||||
#include "ScopeVisualProcessor.h"
|
#include "ScopeVisualProcessor.h"
|
||||||
#include "SpectrumVisualProcessor.h"
|
#include "SpectrumVisualProcessor.h"
|
||||||
@ -77,7 +78,7 @@ public:
|
|||||||
void setPPM(int ppm_in);
|
void setPPM(int ppm_in);
|
||||||
int getPPM();
|
int getPPM();
|
||||||
|
|
||||||
void showFrequencyInput();
|
void showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetMode = FrequencyDialog::FDIALOG_TARGET_DEFAULT);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AppFrame *appframe;
|
AppFrame *appframe;
|
||||||
|
@ -10,15 +10,22 @@ EVT_CHAR_HOOK(FrequencyDialog::OnChar)
|
|||||||
wxEND_EVENT_TABLE()
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxString & title, DemodulatorInstance *demod, const wxPoint & position,
|
FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxString & title, DemodulatorInstance *demod, const wxPoint & position,
|
||||||
const wxSize & size, long style) :
|
const wxSize & size, long style, FrequencyDialogTarget targetMode) :
|
||||||
wxDialog(parent, id, title, position, size, style) {
|
wxDialog(parent, id, title, position, size, style) {
|
||||||
wxString freqStr;
|
wxString freqStr;
|
||||||
activeDemod = demod;
|
activeDemod = demod;
|
||||||
|
this->targetMode = targetMode;
|
||||||
|
|
||||||
if (activeDemod) {
|
if (targetMode == FDIALOG_TARGET_DEFAULT) {
|
||||||
freqStr = frequencyToStr(activeDemod->getFrequency());
|
if (activeDemod) {
|
||||||
} else {
|
freqStr = frequencyToStr(activeDemod->getFrequency());
|
||||||
freqStr = frequencyToStr(wxGetApp().getFrequency());
|
} else {
|
||||||
|
freqStr = frequencyToStr(wxGetApp().getFrequency());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (targetMode == FDIALOG_TARGET_BANDWIDTH) {
|
||||||
|
freqStr = frequencyToStr(wxGetApp().getDemodMgr().getLastBandwidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogText = new wxTextCtrl(this, wxID_FREQ_INPUT, freqStr, wxPoint(6, 1), wxSize(size.GetWidth() - 20, size.GetHeight() - 70),
|
dialogText = new wxTextCtrl(this, wxID_FREQ_INPUT, freqStr, wxPoint(6, 1), wxSize(size.GetWidth() - 20, size.GetHeight() - 70),
|
||||||
@ -109,14 +116,23 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
|
|||||||
case WXK_NUMPAD_ENTER:
|
case WXK_NUMPAD_ENTER:
|
||||||
// Do Stuff
|
// Do Stuff
|
||||||
freq = strToFrequency(dialogText->GetValue().ToStdString());
|
freq = strToFrequency(dialogText->GetValue().ToStdString());
|
||||||
if (activeDemod) {
|
if (targetMode == FDIALOG_TARGET_DEFAULT) {
|
||||||
activeDemod->setTracking(true);
|
if (activeDemod) {
|
||||||
activeDemod->setFollow(true);
|
activeDemod->setTracking(true);
|
||||||
activeDemod->setFrequency(freq);
|
activeDemod->setFollow(true);
|
||||||
activeDemod->updateLabel(freq);
|
activeDemod->setFrequency(freq);
|
||||||
} else {
|
activeDemod->updateLabel(freq);
|
||||||
wxGetApp().setFrequency(freq);
|
} else {
|
||||||
}
|
wxGetApp().setFrequency(freq);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (targetMode == FDIALOG_TARGET_BANDWIDTH) {
|
||||||
|
if (activeDemod) {
|
||||||
|
activeDemod->setBandwidth(freq);
|
||||||
|
} else {
|
||||||
|
wxGetApp().getDemodMgr().setLastBandwidth(freq);
|
||||||
|
}
|
||||||
|
}
|
||||||
Close();
|
Close();
|
||||||
break;
|
break;
|
||||||
case WXK_ESCAPE:
|
case WXK_ESCAPE:
|
||||||
|
@ -11,12 +11,13 @@
|
|||||||
class FrequencyDialog: public wxDialog
|
class FrequencyDialog: public wxDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
typedef enum FrequencyDialogTarget { FDIALOG_TARGET_DEFAULT, FDIALOG_TARGET_CENTERFREQ, FDIALOG_TARGET_FREQ, FDIALOG_TARGET_BANDWIDTH } FrequencyDialogTarget;
|
||||||
FrequencyDialog ( wxWindow * parent, wxWindowID id, const wxString & title,
|
FrequencyDialog ( wxWindow * parent, wxWindowID id, const wxString & title,
|
||||||
DemodulatorInstance *demod = NULL,
|
DemodulatorInstance *demod = NULL,
|
||||||
const wxPoint & pos = wxDefaultPosition,
|
const wxPoint & pos = wxDefaultPosition,
|
||||||
const wxSize & size = wxDefaultSize,
|
const wxSize & size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_DIALOG_STYLE );
|
long style = wxDEFAULT_DIALOG_STYLE,
|
||||||
|
FrequencyDialogTarget targetMode = FDIALOG_TARGET_DEFAULT);
|
||||||
|
|
||||||
wxTextCtrl * dialogText;
|
wxTextCtrl * dialogText;
|
||||||
|
|
||||||
@ -28,5 +29,6 @@ private:
|
|||||||
void OnEnter ( wxCommandEvent &event );
|
void OnEnter ( wxCommandEvent &event );
|
||||||
void OnChar ( wxKeyEvent &event );
|
void OnChar ( wxKeyEvent &event );
|
||||||
std::string& filterChars(std::string& s, const std::string& allowed);
|
std::string& filterChars(std::string& s, const std::string& allowed);
|
||||||
|
FrequencyDialogTarget targetMode;
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@ -407,8 +407,12 @@ void TuningCanvas::setHelpTip(std::string tip) {
|
|||||||
void TuningCanvas::OnKeyDown(wxKeyEvent& event) {
|
void TuningCanvas::OnKeyDown(wxKeyEvent& event) {
|
||||||
InteractiveCanvas::OnKeyDown(event);
|
InteractiveCanvas::OnKeyDown(event);
|
||||||
|
|
||||||
if (event.GetKeyCode() == WXK_SPACE && (hoverState == TUNING_HOVER_CENTER || hoverState == TUNING_HOVER_FREQ)) {
|
if (event.GetKeyCode() == WXK_SPACE) {
|
||||||
wxGetApp().showFrequencyInput();
|
if (hoverState == TUNING_HOVER_CENTER || hoverState == TUNING_HOVER_FREQ) {
|
||||||
|
wxGetApp().showFrequencyInput(FrequencyDialog::FDIALOG_TARGET_DEFAULT);
|
||||||
|
} else if (hoverState == TUNING_HOVER_BW) {
|
||||||
|
wxGetApp().showFrequencyInput(FrequencyDialog::FDIALOG_TARGET_BANDWIDTH);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user