mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-04-18 09:28:29 -04:00
Start typing number to set center frequency
This commit is contained in:
parent
2295b47d69
commit
d7bb214d42
@ -1564,6 +1564,19 @@ int AppFrame::OnGlobalKeyDown(wxKeyEvent &event) {
|
||||
case 'L':
|
||||
case 'U':
|
||||
return 0;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
wxGetApp().showFrequencyInput(FrequencyDialog::FDIALOG_TARGET_DEFAULT, std::to_string(event.GetKeyCode() - '0'));
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -650,7 +650,7 @@ int CubicSDR::getPPM() {
|
||||
}
|
||||
|
||||
|
||||
void CubicSDR::showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetMode) {
|
||||
void CubicSDR::showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetMode, wxString initString) {
|
||||
const wxString demodTitle("Set Demodulator Frequency");
|
||||
const wxString freqTitle("Set Center Frequency");
|
||||
const wxString bwTitle("Set Demodulator Bandwidth");
|
||||
@ -668,7 +668,7 @@ void CubicSDR::showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetM
|
||||
break;
|
||||
}
|
||||
|
||||
FrequencyDialog fdialog(appframe, -1, title, demodMgr.getActiveDemodulator(), wxPoint(-100,-100), wxSize(320, 75 ), wxDEFAULT_DIALOG_STYLE, targetMode);
|
||||
FrequencyDialog fdialog(appframe, -1, title, demodMgr.getActiveDemodulator(), wxPoint(-100,-100), wxSize(320, 75 ), wxDEFAULT_DIALOG_STYLE, targetMode, initString);
|
||||
fdialog.ShowModal();
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
void setPPM(int ppm_in);
|
||||
int getPPM();
|
||||
|
||||
void showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetMode = FrequencyDialog::FDIALOG_TARGET_DEFAULT);
|
||||
void showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetMode = FrequencyDialog::FDIALOG_TARGET_DEFAULT, wxString initString = "");
|
||||
AppFrame *getAppFrame();
|
||||
|
||||
bool areDevicesReady();
|
||||
|
@ -9,7 +9,7 @@ EVT_CHAR_HOOK(FrequencyDialog::OnChar)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxString & title, DemodulatorInstance *demod, const wxPoint & position,
|
||||
const wxSize & size, long style, FrequencyDialogTarget targetMode) :
|
||||
const wxSize & size, long style, FrequencyDialogTarget targetMode, wxString initString) :
|
||||
wxDialog(parent, id, title, position, size, style) {
|
||||
wxString freqStr;
|
||||
activeDemod = demod;
|
||||
@ -38,7 +38,13 @@ FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxStrin
|
||||
|
||||
Centre();
|
||||
|
||||
dialogText->SetSelection(-1, -1);
|
||||
if (initString != "") {
|
||||
dialogText->SetValue(initString);
|
||||
dialogText->SetSelection(initString.length(), initString.length());
|
||||
dialogText->SetFocus();
|
||||
} else {
|
||||
dialogText->SetSelection(-1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,7 +17,8 @@ public:
|
||||
const wxPoint & pos = wxDefaultPosition,
|
||||
const wxSize & size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE,
|
||||
FrequencyDialogTarget targetMode = FDIALOG_TARGET_DEFAULT);
|
||||
FrequencyDialogTarget targetMode = FDIALOG_TARGET_DEFAULT,
|
||||
wxString initString = "");
|
||||
|
||||
wxTextCtrl * dialogText;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user