mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-09-20 04:16:44 -04:00
71 lines
1.6 KiB
C++
71 lines
1.6 KiB
C++
#include "AppFrame.h"
|
|
|
|
#include "wx/wxprec.h"
|
|
|
|
#ifndef WX_PRECOMP
|
|
#include "wx/wx.h"
|
|
#endif
|
|
|
|
#if !wxUSE_GLCANVAS
|
|
#error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
|
|
#endif
|
|
|
|
#include <vector>
|
|
#include "SDRThread.h"
|
|
|
|
wxBEGIN_EVENT_TABLE(AppFrame, wxFrame)
|
|
//EVT_MENU(wxID_NEW, AppFrame::OnNewWindow)
|
|
EVT_MENU(wxID_CLOSE, AppFrame::OnClose)
|
|
EVT_THREAD(EVENT_SDR_INPUT, AppFrame::OnEventInput)
|
|
EVT_IDLE(AppFrame::OnIdle)
|
|
wxEND_EVENT_TABLE()
|
|
|
|
AppFrame::AppFrame() :
|
|
wxFrame(NULL, wxID_ANY, wxT("CubicSDR")) {
|
|
|
|
new TestGLCanvas(this, NULL);
|
|
|
|
// SetIcon(wxICON(sample));
|
|
|
|
// Make a menubar
|
|
wxMenu *menu = new wxMenu;
|
|
// menu->Append(wxID_NEW);
|
|
// menu->AppendSeparator();
|
|
menu->Append(wxID_CLOSE);
|
|
wxMenuBar *menuBar = new wxMenuBar;
|
|
menuBar->Append(menu, wxT("&File"));
|
|
|
|
SetMenuBar(menuBar);
|
|
|
|
CreateStatusBar();
|
|
|
|
SetClientSize(400, 400);
|
|
Show();
|
|
|
|
// static const int attribs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
|
|
// wxLogStatus("Double-buffered display %s supported", wxGLCanvas::IsDisplaySupported(attribs) ? "is" : "not");
|
|
// ShowFullScreen(true);
|
|
}
|
|
|
|
void AppFrame::OnClose(wxCommandEvent& WXUNUSED(event)) {
|
|
// true is to force the frame to close
|
|
Close(true);
|
|
}
|
|
|
|
void AppFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event)) {
|
|
new AppFrame();
|
|
}
|
|
|
|
void AppFrame::OnEventInput(wxThreadEvent& event) {
|
|
std::vector<unsigned char> *new_buffer = event.GetPayload<std::vector<unsigned char> *>();
|
|
|
|
std::cout << "Got IQ buffer, length: " << new_buffer->size() << std::endl;
|
|
|
|
delete new_buffer;
|
|
}
|
|
|
|
void AppFrame::OnIdle(wxIdleEvent& event) {
|
|
|
|
event.Skip();
|
|
}
|