mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-04-04 18:48:38 -04:00
Merge with updated datatree
This commit is contained in:
commit
7c68f142ed
@ -7,6 +7,7 @@
|
||||
#endif
|
||||
|
||||
#include "wx/numdlg.h"
|
||||
#include "wx/filedlg.h"
|
||||
|
||||
#if !wxUSE_GLCANVAS
|
||||
#error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
|
||||
@ -27,13 +28,12 @@ wxBEGIN_EVENT_TABLE(AppFrame, wxFrame)
|
||||
//EVT_MENU(wxID_NEW, AppFrame::OnNewWindow)
|
||||
EVT_MENU(wxID_CLOSE, AppFrame::OnClose)
|
||||
EVT_MENU(wxID_ANY, AppFrame::OnMenu)
|
||||
|
||||
EVT_COMMAND(wxID_ANY, wxEVT_THREAD, AppFrame::OnThread)
|
||||
EVT_IDLE(AppFrame::OnIdle)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
AppFrame::AppFrame() :
|
||||
wxFrame(NULL, wxID_ANY, wxT("CubicSDR " CUBICSDR_VERSION " by Charles J. Cliffe (@ccliffe)")), activeDemodulator(NULL) {
|
||||
wxFrame(NULL, wxID_ANY, wxT("CubicSDR " CUBICSDR_VERSION " by Charles J. Cliffe (@ccliffe)")), activeDemodulator(NULL) {
|
||||
|
||||
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *demodOpts = new wxBoxSizer(wxVERTICAL);
|
||||
@ -41,7 +41,6 @@ AppFrame::AppFrame() :
|
||||
wxBoxSizer *demodTray = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer *demodScopeTray = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
|
||||
demodModeSelector = new ModeSelectorCanvas(this, NULL);
|
||||
demodModeSelector->addChoice(DEMOD_TYPE_FM,"FM");
|
||||
demodModeSelector->addChoice(DEMOD_TYPE_AM,"AM");
|
||||
@ -112,6 +111,9 @@ AppFrame::AppFrame() :
|
||||
wxMenu *menu = new wxMenu;
|
||||
// menu->Append(wxID_NEW);
|
||||
menu->Append(wxID_SET_FREQ_OFFSET, "Set Frequency Offset");
|
||||
menu->Append(wxID_OPEN, "&Open Session");
|
||||
menu->Append(wxID_SAVE, "&Save Session");
|
||||
menu->Append(wxID_SAVEAS, "Save Session &As..");
|
||||
menu->AppendSeparator();
|
||||
menu->Append(wxID_CLOSE);
|
||||
|
||||
@ -173,15 +175,31 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
|
||||
activeDemodulator = NULL;
|
||||
}
|
||||
} else if (event.GetId() == wxID_SET_FREQ_OFFSET) {
|
||||
long ofs = wxGetNumberFromUser ("Shift the displayed frequency by this amount.\ni.e. -125000000 for -125 MHz", "Frequency (Hz)", "Frequency Offset", wxGetApp().getOffset(), -2000000000, 2000000000, this);
|
||||
long ofs = wxGetNumberFromUser("Shift the displayed frequency by this amount.\ni.e. -125000000 for -125 MHz", "Frequency (Hz)",
|
||||
"Frequency Offset", wxGetApp().getOffset(), -2000000000, 2000000000, this);
|
||||
if (ofs != -1) {
|
||||
wxGetApp().setOffset(ofs);
|
||||
}
|
||||
} else if (event.GetId() == wxID_SAVE) {
|
||||
wxFileDialog saveFileDialog(this, _("Save XML Session file"), "", "", "XML files (*.xml)|*.xml", wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
||||
if (saveFileDialog.ShowModal() == wxID_CANCEL) {
|
||||
return;
|
||||
}
|
||||
// saveFileDialog.GetPath();
|
||||
} else if (event.GetId() == wxID_OPEN) {
|
||||
wxFileDialog openFileDialog(this, _("Open XML Session file"), "", "","XML files (*.xml)|*.xml", wxFD_OPEN|wxFD_FILE_MUST_EXIST);
|
||||
if (openFileDialog.ShowModal() == wxID_CANCEL) {
|
||||
return;
|
||||
}
|
||||
// openFileDialog.GetPath();
|
||||
} else if (event.GetId() == wxID_SAVEAS) {
|
||||
} else if (event.GetId() == wxID_EXIT) {
|
||||
Close(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AppFrame::OnClose(wxCommandEvent& WXUNUSED(event)) {
|
||||
Close(true);
|
||||
Close(false);
|
||||
}
|
||||
|
||||
void AppFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event)) {
|
||||
|
@ -66,7 +66,7 @@ int DataElement::getUnitSize() {
|
||||
|
||||
#define DataElementSetNumericDef(enumtype, datatype) void DataElement::set(const datatype& val_in) { \
|
||||
data_type = enumtype; \
|
||||
unit_size = sizeof(char); \
|
||||
unit_size = sizeof(datatype); \
|
||||
data_init(unit_size); \
|
||||
memcpy(data_val, &val_in, data_size); \
|
||||
}
|
||||
@ -140,7 +140,7 @@ void DataElement::set(std::set<string> &strset_in) {
|
||||
|
||||
#define DataElementSetNumericVectorDef(enumtype, datatype) void DataElement::set(vector<datatype>& val_in) { \
|
||||
data_type = enumtype; \
|
||||
unit_size = sizeof(char); \
|
||||
unit_size = sizeof(datatype); \
|
||||
data_init(unit_size * val_in.size()); \
|
||||
memcpy(data_val, &val_in[0], data_size); \
|
||||
}
|
||||
|
@ -261,28 +261,49 @@ public:
|
||||
void findAll(const char *name_in, vector<DataNode *> &node_list_out);
|
||||
|
||||
operator string () { string s; element().get(s); return s; }
|
||||
operator char () { char v; element().get(v); return v; }
|
||||
operator unsigned char () { unsigned char v; element().get(v); return v; }
|
||||
operator int () { int v; element().get(v); return v; }
|
||||
operator unsigned int () { unsigned int v; element().get(v); return v; }
|
||||
operator long () { long v; element().get(v); return v; }
|
||||
operator unsigned long () { unsigned long v; element().get(v); return v; }
|
||||
operator long long () { long long v; element().get(v); return v; }
|
||||
operator float () { float v; element().get(v); return v; }
|
||||
operator double () { double v; element().get(v); return v; }
|
||||
operator long double () { long double v; element().get(v); return v; }
|
||||
|
||||
operator vector<char> () { vector<char> v; element().get(v); return v; }
|
||||
operator vector<unsigned char> () { vector<unsigned char> v; element().get(v); return v; }
|
||||
operator vector<int> () { vector<int> v; element().get(v); return v; }
|
||||
operator vector<unsigned int> () { vector<unsigned int> v; element().get(v); return v; }
|
||||
operator vector<long> () { vector<long> v; element().get(v); return v; }
|
||||
operator vector<unsigned long> () { vector<unsigned long> v; element().get(v); return v; }
|
||||
operator vector<float> () { vector<float> v; element().get(v); return v; }
|
||||
operator vector<double> () { vector<double> v; element().get(v); return v; }
|
||||
operator vector<long double> () { vector<long double> v; element().get(v); return v; }
|
||||
|
||||
const string &operator= (const string &s) { element().set(s); return s; }
|
||||
|
||||
char operator= (char i) { element().set(i); return i; }
|
||||
unsigned char operator= (unsigned char i) { element().set(i); return i; }
|
||||
int operator= (int i) { element().set(i); return i; }
|
||||
unsigned int operator= (unsigned int i) { element().set(i); return i; }
|
||||
long operator= (long i) { element().set(i); return i; }
|
||||
unsigned long operator= (unsigned long i) { element().set(i); return i; }
|
||||
long long operator= (long long i) { element().set(i); return i; }
|
||||
float operator= (float i) { element().set(i); return i; }
|
||||
double operator= (double i) { element().set(i); return i; }
|
||||
|
||||
long double operator= (long double i) { element().set(i); return i; }
|
||||
|
||||
vector<char> &operator= (vector<char> &v) { element().set(v); return v; }
|
||||
vector<unsigned char> &operator= (vector<unsigned char> &v) { element().set(v); return v; }
|
||||
vector<int> &operator= (vector<int> &v) { element().set(v); return v; }
|
||||
vector<unsigned int> &operator= (vector<unsigned int> &v) { element().set(v); return v; }
|
||||
vector<long> &operator= (vector<long> &v) { element().set(v); return v; }
|
||||
vector<unsigned long> &operator= (vector<unsigned long> &v) { element().set(v); return v; }
|
||||
vector<float> &operator= (vector<float> &v) { element().set(v); return v; }
|
||||
vector<double> &operator= (vector<double> &v) { element().set(v); return v; }
|
||||
vector<long double> &operator= (vector<long double> &v) { element().set(v); return v; }
|
||||
|
||||
DataNode &operator[] (const char *name_in) { return getNext(name_in); }
|
||||
DataNode &operator[] (int idx) { return child(idx); }
|
||||
|
Loading…
Reference in New Issue
Block a user