mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-07-31 12:52:25 -04:00
Prototype frequency input dialog
This commit is contained in:
parent
e7d3e0c598
commit
04ee1534ad
@ -227,6 +227,7 @@ SET (cubicsdr_sources
|
|||||||
src/CubicSDR.cpp
|
src/CubicSDR.cpp
|
||||||
src/AppFrame.cpp
|
src/AppFrame.cpp
|
||||||
src/AppConfig.cpp
|
src/AppConfig.cpp
|
||||||
|
src/FrequencyDialog.cpp
|
||||||
src/sdr/SDRThread.cpp
|
src/sdr/SDRThread.cpp
|
||||||
src/sdr/SDRPostThread.cpp
|
src/sdr/SDRPostThread.cpp
|
||||||
src/demod/DemodulatorPreThread.cpp
|
src/demod/DemodulatorPreThread.cpp
|
||||||
@ -269,6 +270,7 @@ SET (cubicsdr_headers
|
|||||||
src/CubicSDR.h
|
src/CubicSDR.h
|
||||||
src/AppFrame.h
|
src/AppFrame.h
|
||||||
src/AppConfig.h
|
src/AppConfig.h
|
||||||
|
src/FrequencyDialog.h
|
||||||
src/sdr/SDRThread.h
|
src/sdr/SDRThread.h
|
||||||
src/sdr/SDRPostThread.h
|
src/sdr/SDRPostThread.h
|
||||||
src/demod/DemodulatorPreThread.h
|
src/demod/DemodulatorPreThread.h
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "CubicSDR.h"
|
#include "CubicSDR.h"
|
||||||
#include "AppFrame.h"
|
#include "FrequencyDialog.h"
|
||||||
|
|
||||||
#ifdef _OSX_APP_
|
#ifdef _OSX_APP_
|
||||||
#include "CoreFoundation/CoreFoundation.h"
|
#include "CoreFoundation/CoreFoundation.h"
|
||||||
@ -92,7 +92,7 @@ bool CubicSDR::OnInit() {
|
|||||||
t_PostSDR = new std::thread(&SDRPostThread::threadMain, sdrPostThread);
|
t_PostSDR = new std::thread(&SDRPostThread::threadMain, sdrPostThread);
|
||||||
t_SDR = new std::thread(&SDRThread::threadMain, sdrThread);
|
t_SDR = new std::thread(&SDRThread::threadMain, sdrThread);
|
||||||
|
|
||||||
AppFrame *appframe = new AppFrame();
|
appframe = new AppFrame();
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
int main_policy;
|
int main_policy;
|
||||||
@ -271,3 +271,11 @@ int CubicSDR::getPPM() {
|
|||||||
return ppm;
|
return ppm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CubicSDR::showFrequencyInput() {
|
||||||
|
FrequencyDialog fdialog(appframe, -1, _("Set Frequency"), wxPoint(-100,-100), wxSize(320, 75 ));
|
||||||
|
|
||||||
|
if ( fdialog.ShowModal() != wxID_OK ) {
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "AudioThread.h"
|
#include "AudioThread.h"
|
||||||
#include "DemodulatorMgr.h"
|
#include "DemodulatorMgr.h"
|
||||||
#include "AppConfig.h"
|
#include "AppConfig.h"
|
||||||
|
#include "AppFrame.h"
|
||||||
|
|
||||||
#define NUM_DEMODULATORS 1
|
#define NUM_DEMODULATORS 1
|
||||||
|
|
||||||
@ -56,7 +57,10 @@ public:
|
|||||||
void setPPM(int ppm_in);
|
void setPPM(int ppm_in);
|
||||||
int getPPM();
|
int getPPM();
|
||||||
|
|
||||||
|
void showFrequencyInput();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
AppFrame *appframe;
|
||||||
AppConfig config;
|
AppConfig config;
|
||||||
PrimaryGLContext *m_glContext;
|
PrimaryGLContext *m_glContext;
|
||||||
std::vector<SDRDeviceInfo *> devs;
|
std::vector<SDRDeviceInfo *> devs;
|
||||||
|
21
src/FrequencyDialog.cpp
Normal file
21
src/FrequencyDialog.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include "FrequencyDialog.h"
|
||||||
|
|
||||||
|
wxBEGIN_EVENT_TABLE(FrequencyDialog, wxDialog) wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
|
FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxString & title, const wxPoint & position, const wxSize & size, long style) :
|
||||||
|
wxDialog(parent, id, title, position, size, style) {
|
||||||
|
wxString freqStr = "105.7Mhz";
|
||||||
|
|
||||||
|
dialogText = new wxTextCtrl(this, -1, freqStr, wxPoint(6, 1), wxSize(size.GetWidth() - 20, size.GetHeight() - 70), wxTE_PROCESS_ENTER);
|
||||||
|
dialogText->SetFont(wxFont(20, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD));
|
||||||
|
Connect(wxEVT_TEXT_ENTER, wxCommandEventHandler(FrequencyDialog::OnEnter));
|
||||||
|
|
||||||
|
SetEscapeId(wxID_CANCEL);
|
||||||
|
|
||||||
|
Centre();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrequencyDialog::OnEnter(wxCommandEvent &event) {
|
||||||
|
std::cout << dialogText->GetValue().ToStdString() << std::endl;
|
||||||
|
Close();
|
||||||
|
}
|
25
src/FrequencyDialog.h
Normal file
25
src/FrequencyDialog.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "wx/dialog.h"
|
||||||
|
#include "wx/textctrl.h"
|
||||||
|
#include "wx/string.h"
|
||||||
|
#include "wx/button.h"
|
||||||
|
|
||||||
|
|
||||||
|
class FrequencyDialog: public wxDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
FrequencyDialog ( wxWindow * parent, wxWindowID id, const wxString & title,
|
||||||
|
const wxPoint & pos = wxDefaultPosition,
|
||||||
|
const wxSize & size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_DIALOG_STYLE );
|
||||||
|
|
||||||
|
wxTextCtrl * dialogText;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void OnEnter ( wxCommandEvent &event );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
@ -299,16 +299,6 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
|
|||||||
wxGetApp().getDemodMgr().deleteThread(activeDemod);
|
wxGetApp().getDemodMgr().deleteThread(activeDemod);
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
if (!activeDemod) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (activeDemod->isSquelchEnabled()) {
|
|
||||||
activeDemod->setSquelchEnabled(false);
|
|
||||||
} else {
|
|
||||||
activeDemod->squelchAuto();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WXK_SPACE:
|
|
||||||
if (!activeDemod) {
|
if (!activeDemod) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -318,6 +308,9 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
|
|||||||
activeDemod->setStereo(true);
|
activeDemod->setStereo(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case WXK_SPACE:
|
||||||
|
wxGetApp().showFrequencyInput();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
event.Skip();
|
event.Skip();
|
||||||
return;
|
return;
|
||||||
@ -720,14 +713,14 @@ void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {
|
|||||||
|
|
||||||
mouseTracker.setVertDragLock(true);
|
mouseTracker.setVertDragLock(true);
|
||||||
mouseTracker.setHorizDragLock(false);
|
mouseTracker.setHorizDragLock(false);
|
||||||
setStatusText("Click and drag to change demodulator bandwidth. D to delete, SPACE for stereo.");
|
setStatusText("Click and drag to change demodulator bandwidth. D to delete, S for stereo.");
|
||||||
} else {
|
} else {
|
||||||
SetCursor(wxCURSOR_SIZING);
|
SetCursor(wxCURSOR_SIZING);
|
||||||
nextDragState = WF_DRAG_FREQUENCY;
|
nextDragState = WF_DRAG_FREQUENCY;
|
||||||
|
|
||||||
mouseTracker.setVertDragLock(true);
|
mouseTracker.setVertDragLock(true);
|
||||||
mouseTracker.setHorizDragLock(false);
|
mouseTracker.setHorizDragLock(false);
|
||||||
setStatusText("Click and drag to change demodulator frequency. D to delete, SPACE for stereo.");
|
setStatusText("Click and drag to change demodulator frequency. D to delete, S for stereo.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SetCursor(wxCURSOR_CROSS);
|
SetCursor(wxCURSOR_CROSS);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user