Merge pull request #633 from cjcliffe/vso_wxwidgets_v311_integration

This commit is contained in:
Vincent Sonnier 2018-03-17 09:02:36 +01:00 committed by GitHub
commit 876b477ae8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 233 additions and 57 deletions

View File

@ -88,10 +88,10 @@ AppFrame::AppFrame() :
wxBoxSizer *demodScopeTray = new wxBoxSizer(wxVERTICAL); wxBoxSizer *demodScopeTray = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *demodTunerTray = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *demodTunerTray = new wxBoxSizer(wxHORIZONTAL);
std::vector<int> attribList = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 }; // OpenGL settings:
//wxGLAttributes attribList; //deprecated format: std::vector<int> attribList = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
//attribList.PlatformDefaults().RGBA().DoubleBuffer().EndList(); wxGLAttributes attribList;
//attribList.PlatformDefaults().MinRGBA(8, 8, 8, 8).DoubleBuffer().Depth(16).EndList(); attribList.PlatformDefaults().RGBA().MinRGBA(8, 8, 8, 8).DoubleBuffer().EndList();
mainSplitter = new wxSplitterWindow( this, wxID_MAIN_SPLITTER, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH | wxSP_LIVE_UPDATE ); mainSplitter = new wxSplitterWindow( this, wxID_MAIN_SPLITTER, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH | wxSP_LIVE_UPDATE );
mainSplitter->SetSashGravity(10.0f / 37.0f); mainSplitter->SetSashGravity(10.0f / 37.0f);

View File

@ -206,6 +206,14 @@ CubicSDR::CubicSDR() : frequency(0), offset(0), ppm(0), snap(1), sampleRate(DEFA
shuttingDown.store(false); shuttingDown.store(false);
fdlgTarget = FrequencyDialog::FDIALOG_TARGET_DEFAULT; fdlgTarget = FrequencyDialog::FDIALOG_TARGET_DEFAULT;
stoppedDev = nullptr; stoppedDev = nullptr;
//set OpenGL configuration:
m_glContextAttributes = new wxGLContextAttrs();
wxGLContextAttrs glSettings;
glSettings.PlatformDefaults().EndList();
*m_glContextAttributes = glSettings;
} }
bool CubicSDR::OnInit() { bool CubicSDR::OnInit() {
@ -495,13 +503,18 @@ int CubicSDR::OnExit() {
PrimaryGLContext& CubicSDR::GetContext(wxGLCanvas *canvas) { PrimaryGLContext& CubicSDR::GetContext(wxGLCanvas *canvas) {
PrimaryGLContext *glContext; PrimaryGLContext *glContext;
if (!m_glContext) { if (!m_glContext) {
m_glContext = new PrimaryGLContext(canvas, NULL); m_glContext = new PrimaryGLContext(canvas, NULL, GetContextAttributes());
} }
glContext = m_glContext; glContext = m_glContext;
return *glContext; return *glContext;
} }
wxGLContextAttrs* CubicSDR::GetContextAttributes() {
return m_glContextAttributes;
}
void CubicSDR::OnInitCmdLine(wxCmdLineParser& parser) { void CubicSDR::OnInitCmdLine(wxCmdLineParser& parser) {
parser.SetDesc (commandLineInfo); parser.SetDesc (commandLineInfo);
parser.SetSwitchChars (wxT("-")); parser.SetSwitchChars (wxT("-"));

View File

@ -71,6 +71,7 @@ public:
CubicSDR(); CubicSDR();
PrimaryGLContext &GetContext(wxGLCanvas *canvas); PrimaryGLContext &GetContext(wxGLCanvas *canvas);
wxGLContextAttrs* GetContextAttributes();
virtual bool OnInit(); virtual bool OnInit();
virtual int OnExit(); virtual int OnExit();
@ -94,9 +95,7 @@ public:
void setAntennaName(const std::string& name); void setAntennaName(const std::string& name);
const std::string& getAntennaName(); const std::string& getAntennaName();
void setDBOffset(int ofs);
int getDBOffset();
void setSampleRate(long long rate_in); void setSampleRate(long long rate_in);
long long getSampleRate(); long long getSampleRate();
@ -186,6 +185,8 @@ private:
AppFrame *appframe = nullptr; AppFrame *appframe = nullptr;
AppConfig config; AppConfig config;
PrimaryGLContext *m_glContext = nullptr; PrimaryGLContext *m_glContext = nullptr;
wxGLContextAttrs *m_glContextAttributes = nullptr;
std::vector<SDRDeviceInfo *> *devs = nullptr; std::vector<SDRDeviceInfo *> *devs = nullptr;
DemodulatorMgr demodMgr; DemodulatorMgr demodMgr;

View File

@ -190,6 +190,10 @@ void BookmarkView::onUpdateTimer( wxTimerEvent& /* event */ ) {
} }
} }
bool BookmarkView::skipUserEvents() {
return !this->IsShown() || doUpdateActive || doUpdateBookmarks;
}
void BookmarkView::updateTheme() { void BookmarkView::updateTheme() {
wxColour bgColor(ThemeMgr::mgr.currentTheme->generalBackground); wxColour bgColor(ThemeMgr::mgr.currentTheme->generalBackground);
@ -513,6 +517,10 @@ void BookmarkView::doUpdateActiveList() {
void BookmarkView::onTreeActivate( wxTreeEvent& event ) { void BookmarkView::onTreeActivate( wxTreeEvent& event ) {
if (skipUserEvents()) {
return;
}
wxTreeItemId itm = event.GetItem(); wxTreeItemId itm = event.GetItem();
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(itm)); TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(itm));
@ -538,6 +546,11 @@ void BookmarkView::onTreeActivate( wxTreeEvent& event ) {
void BookmarkView::onTreeCollapse( wxTreeEvent& event ) { void BookmarkView::onTreeCollapse( wxTreeEvent& event ) {
if (skipUserEvents()) {
return;
}
bool searchState = (searchKeywords.size() != 0); bool searchState = (searchKeywords.size() != 0);
if (searchState) { if (searchState) {
@ -567,6 +580,11 @@ void BookmarkView::onTreeCollapse( wxTreeEvent& event ) {
void BookmarkView::onTreeExpanded( wxTreeEvent& event ) { void BookmarkView::onTreeExpanded( wxTreeEvent& event ) {
if (skipUserEvents()) {
return;
}
bool searchState = (searchKeywords.size() != 0); bool searchState = (searchKeywords.size() != 0);
if (searchState) { if (searchState) {
@ -596,6 +614,11 @@ void BookmarkView::onTreeExpanded( wxTreeEvent& event ) {
void BookmarkView::onTreeItemMenu( wxTreeEvent& /* event */ ) { void BookmarkView::onTreeItemMenu( wxTreeEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
if (m_treeView->GetSelection() == bookmarkBranch) { if (m_treeView->GetSelection() == bookmarkBranch) {
wxMenu menu; wxMenu menu;
menu.Append(wxCONTEXT_ADD_GROUP_ID, BOOKMARK_VIEW_STR_ADD_GROUP); menu.Append(wxCONTEXT_ADD_GROUP_ID, BOOKMARK_VIEW_STR_ADD_GROUP);
@ -606,6 +629,11 @@ void BookmarkView::onTreeItemMenu( wxTreeEvent& /* event */ ) {
void BookmarkView::onMenuItem(wxCommandEvent& event) { void BookmarkView::onMenuItem(wxCommandEvent& event) {
if (skipUserEvents()) {
return;
}
if (event.GetId() == wxCONTEXT_ADD_GROUP_ID) { if (event.GetId() == wxCONTEXT_ADD_GROUP_ID) {
onAddGroup(event); onAddGroup(event);
} }
@ -762,6 +790,10 @@ void BookmarkView::addBookmarkChoice(wxWindow *parent) {
void BookmarkView::onBookmarkChoice( wxCommandEvent & /* event */ ) { void BookmarkView::onBookmarkChoice( wxCommandEvent & /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *tvi = itemToTVI(m_treeView->GetSelection()); TreeViewItem *tvi = itemToTVI(m_treeView->GetSelection());
@ -1053,6 +1085,11 @@ void BookmarkView::activeBranchSelection() {
void BookmarkView::onTreeSelect( wxTreeEvent& event ) { void BookmarkView::onTreeSelect( wxTreeEvent& event ) {
if (skipUserEvents()) {
return;
}
wxTreeItemId itm = event.GetItem(); wxTreeItemId itm = event.GetItem();
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(itm)); TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(itm));
@ -1097,11 +1134,21 @@ void BookmarkView::onTreeSelect( wxTreeEvent& event ) {
void BookmarkView::onTreeSelectChanging( wxTreeEvent& event ) { void BookmarkView::onTreeSelectChanging( wxTreeEvent& event ) {
if (skipUserEvents()) {
return;
}
event.Skip(); event.Skip();
} }
void BookmarkView::onLabelText( wxCommandEvent& /* event */ ) { void BookmarkView::onLabelText( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
std::wstring newLabel = m_labelText->GetValue().ToStdWstring(); std::wstring newLabel = m_labelText->GetValue().ToStdWstring();
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
@ -1135,6 +1182,10 @@ void BookmarkView::onLabelText( wxCommandEvent& /* event */ ) {
void BookmarkView::onDoubleClickFreq( wxMouseEvent& /* event */ ) { void BookmarkView::onDoubleClickFreq( wxMouseEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) { if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
@ -1146,6 +1197,11 @@ void BookmarkView::onDoubleClickFreq( wxMouseEvent& /* event */ ) {
void BookmarkView::onDoubleClickBandwidth( wxMouseEvent& /* event */ ) { void BookmarkView::onDoubleClickBandwidth( wxMouseEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) { if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
@ -1157,6 +1213,11 @@ void BookmarkView::onDoubleClickBandwidth( wxMouseEvent& /* event */ ) {
void BookmarkView::onRemoveActive( wxCommandEvent& /* event */ ) { void BookmarkView::onRemoveActive( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) { if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
@ -1168,6 +1229,11 @@ void BookmarkView::onRemoveActive( wxCommandEvent& /* event */ ) {
} }
void BookmarkView::onStartRecording( wxCommandEvent& /* event */ ) { void BookmarkView::onStartRecording( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) { if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
@ -1180,6 +1246,11 @@ void BookmarkView::onStartRecording( wxCommandEvent& /* event */ ) {
void BookmarkView::onStopRecording( wxCommandEvent& /* event */ ) { void BookmarkView::onStopRecording( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) { if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
@ -1193,6 +1264,11 @@ void BookmarkView::onStopRecording( wxCommandEvent& /* event */ ) {
void BookmarkView::onRemoveBookmark( wxCommandEvent& /* event */ ) { void BookmarkView::onRemoveBookmark( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
if (editingLabel) { if (editingLabel) {
return; return;
} }
@ -1206,6 +1282,11 @@ void BookmarkView::onRemoveBookmark( wxCommandEvent& /* event */ ) {
void BookmarkView::onActivateBookmark( wxCommandEvent& /* event */ ) { void BookmarkView::onActivateBookmark( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) { if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) {
@ -1215,6 +1296,11 @@ void BookmarkView::onActivateBookmark( wxCommandEvent& /* event */ ) {
void BookmarkView::onActivateRecent( wxCommandEvent& /* event */ ) { void BookmarkView::onActivateRecent( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) { if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) {
@ -1230,6 +1316,11 @@ void BookmarkView::onActivateRecent( wxCommandEvent& /* event */ ) {
void BookmarkView::onRemoveRecent ( wxCommandEvent& /* event */ ) { void BookmarkView::onRemoveRecent ( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
if (editingLabel) { if (editingLabel) {
return; return;
} }
@ -1247,6 +1338,11 @@ void BookmarkView::onRemoveRecent ( wxCommandEvent& /* event */ ) {
} }
void BookmarkView::onClearRecents ( wxCommandEvent& /* event */ ) { void BookmarkView::onClearRecents ( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
if (editingLabel) { if (editingLabel) {
return; return;
} }
@ -1255,6 +1351,11 @@ void BookmarkView::onClearRecents ( wxCommandEvent& /* event */ ) {
void BookmarkView::onAddGroup( wxCommandEvent& /* event */ ) { void BookmarkView::onAddGroup( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
wxString stringVal = wxGetTextFromUser(BOOKMARK_VIEW_STR_ADD_GROUP_DESC, BOOKMARK_VIEW_STR_ADD_GROUP, ""); wxString stringVal = wxGetTextFromUser(BOOKMARK_VIEW_STR_ADD_GROUP_DESC, BOOKMARK_VIEW_STR_ADD_GROUP, "");
if (stringVal.ToStdString() != "") { if (stringVal.ToStdString() != "") {
wxGetApp().getBookmarkMgr().addGroup(stringVal.ToStdString()); wxGetApp().getBookmarkMgr().addGroup(stringVal.ToStdString());
@ -1264,6 +1365,11 @@ void BookmarkView::onAddGroup( wxCommandEvent& /* event */ ) {
void BookmarkView::onRemoveGroup( wxCommandEvent& /* event */ ) { void BookmarkView::onRemoveGroup( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
if (editingLabel) { if (editingLabel) {
return; return;
} }
@ -1277,6 +1383,10 @@ void BookmarkView::onRemoveGroup( wxCommandEvent& /* event */ ) {
void BookmarkView::onAddRange( wxCommandEvent& /* event */ ) { void BookmarkView::onAddRange( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
BookmarkRangeEntryPtr re = BookmarkView::makeActiveRangeEntry(); BookmarkRangeEntryPtr re = BookmarkView::makeActiveRangeEntry();
@ -1288,6 +1398,11 @@ void BookmarkView::onAddRange( wxCommandEvent& /* event */ ) {
void BookmarkView::onRemoveRange( wxCommandEvent& /* event */ ) { void BookmarkView::onRemoveRange( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
if (editingLabel) { if (editingLabel) {
return; return;
} }
@ -1301,6 +1416,11 @@ void BookmarkView::onRemoveRange( wxCommandEvent& /* event */ ) {
void BookmarkView::onRenameRange( wxCommandEvent& /* event */ ) { void BookmarkView::onRenameRange( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (!curSel || curSel->type != TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP) { if (!curSel || curSel->type != TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP) {
@ -1319,6 +1439,11 @@ void BookmarkView::onRenameRange( wxCommandEvent& /* event */ ) {
} }
void BookmarkView::onActivateRange( wxCommandEvent& /* event */ ) { void BookmarkView::onActivateRange( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RANGE) { if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RANGE) {
@ -1327,6 +1452,11 @@ void BookmarkView::onActivateRange( wxCommandEvent& /* event */ ) {
} }
void BookmarkView::onUpdateRange( wxCommandEvent& /* event */ ) { void BookmarkView::onUpdateRange( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RANGE) { if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RANGE) {
@ -1335,6 +1465,11 @@ void BookmarkView::onUpdateRange( wxCommandEvent& /* event */ ) {
} }
void BookmarkView::onTreeBeginDrag( wxTreeEvent& event ) { void BookmarkView::onTreeBeginDrag( wxTreeEvent& event ) {
if (skipUserEvents()) {
return;
}
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(event.GetItem())); TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(event.GetItem()));
dragItem = nullptr; dragItem = nullptr;
@ -1379,6 +1514,10 @@ void BookmarkView::onTreeBeginDrag( wxTreeEvent& event ) {
void BookmarkView::onTreeEndDrag( wxTreeEvent& event ) { void BookmarkView::onTreeEndDrag( wxTreeEvent& event ) {
if (skipUserEvents()) {
return;
}
wxColour bgColor(ThemeMgr::mgr.currentTheme->generalBackground); wxColour bgColor(ThemeMgr::mgr.currentTheme->generalBackground);
wxColour textColor(ThemeMgr::mgr.currentTheme->text); wxColour textColor(ThemeMgr::mgr.currentTheme->text);
@ -1439,6 +1578,10 @@ void BookmarkView::onTreeEndDrag( wxTreeEvent& event ) {
void BookmarkView::onTreeItemGetTooltip( wxTreeEvent& event ) { void BookmarkView::onTreeItemGetTooltip( wxTreeEvent& event ) {
if (skipUserEvents()) {
return;
}
event.Skip(); event.Skip();
} }
@ -1491,6 +1634,11 @@ TreeViewItem *BookmarkView::itemToTVI(wxTreeItemId item) {
} }
void BookmarkView::onSearchTextFocus( wxMouseEvent& event ) { void BookmarkView::onSearchTextFocus( wxMouseEvent& event ) {
if (skipUserEvents()) {
return;
}
mouseTracker.OnMouseMoved(event); mouseTracker.OnMouseMoved(event);
//apparently needed ??? //apparently needed ???
@ -1515,6 +1663,11 @@ void BookmarkView::onSearchTextFocus( wxMouseEvent& event ) {
void BookmarkView::onSearchText( wxCommandEvent& event ) { void BookmarkView::onSearchText( wxCommandEvent& event ) {
if (skipUserEvents()) {
return;
}
std::wstring searchText = m_searchText->GetValue().Trim().Lower().ToStdWstring(); std::wstring searchText = m_searchText->GetValue().Trim().Lower().ToStdWstring();
searchKeywords.clear(); searchKeywords.clear();
@ -1545,6 +1698,11 @@ void BookmarkView::onSearchText( wxCommandEvent& event ) {
void BookmarkView::onClearSearch( wxCommandEvent& /* event */ ) { void BookmarkView::onClearSearch( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
m_clearSearchButton->Hide(); m_clearSearchButton->Hide();
m_searchText->SetValue(L"Search.."); m_searchText->SetValue(L"Search..");
m_treeView->SetFocus(); m_treeView->SetFocus();

View File

@ -161,6 +161,8 @@ protected:
void onRenameRange( wxCommandEvent& event ); void onRenameRange( wxCommandEvent& event );
void onActivateRange( wxCommandEvent& event ); void onActivateRange( wxCommandEvent& event );
void onUpdateRange( wxCommandEvent& event ); void onUpdateRange( wxCommandEvent& event );
bool skipUserEvents();
TreeViewItem *itemToTVI(wxTreeItemId item); TreeViewItem *itemToTVI(wxTreeItemId item);

View File

@ -27,10 +27,10 @@ EVT_LEAVE_WINDOW(UITestCanvas::OnMouseLeftWindow)
EVT_ENTER_WINDOW(UITestCanvas::OnMouseEnterWindow) EVT_ENTER_WINDOW(UITestCanvas::OnMouseEnterWindow)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
UITestCanvas::UITestCanvas(wxWindow *parent, std::vector<int> dispAttrs) : UITestCanvas::UITestCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
InteractiveCanvas(parent, dispAttrs) { InteractiveCanvas(parent, dispAttrs) {
glContext = new UITestContext(this, &wxGetApp().GetContext(this)); glContext = new UITestContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
} }
UITestCanvas::~UITestCanvas() { UITestCanvas::~UITestCanvas() {

View File

@ -17,7 +17,7 @@
class UITestCanvas: public InteractiveCanvas { class UITestCanvas: public InteractiveCanvas {
public: public:
UITestCanvas(wxWindow *parent, std::vector<int> dispAttrs); UITestCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
~UITestCanvas(); ~UITestCanvas();
private: private:

View File

@ -5,8 +5,8 @@
#include "UITestCanvas.h" #include "UITestCanvas.h"
#include "ColorTheme.h" #include "ColorTheme.h"
UITestContext::UITestContext(UITestCanvas *canvas, wxGLContext *sharedContext) : UITestContext::UITestContext(UITestCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) :
PrimaryGLContext(canvas, sharedContext), testMeter("TEST",0,100,50) { PrimaryGLContext(canvas, sharedContext, ctxAttrs), testMeter("TEST",0,100,50) {
testPanel.setPosition(0.0, 0.0); testPanel.setPosition(0.0, 0.0);
testPanel.setSize(1.0, 1.0); testPanel.setSize(1.0, 1.0);

View File

@ -11,7 +11,7 @@ class UITestCanvas;
class UITestContext: public PrimaryGLContext { class UITestContext: public PrimaryGLContext {
public: public:
UITestContext(UITestCanvas *canvas, wxGLContext *sharedContext); UITestContext(UITestCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs);
void DrawBegin(); void DrawBegin();
void Draw(); void Draw();

View File

@ -46,7 +46,8 @@ void initGLExtensions() {
#ifdef _WIN32 #ifdef _WIN32
if (GLExtSupported("WGL_EXT_swap_control")) { if (GLExtSupported("WGL_EXT_swap_control")) {
std::cout << "Initializing WGL swap control extensions.." << std::endl; std::cout << "Initializing WGL swap control extensions.." << std::endl << std::flush;
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress("wglSwapIntervalEXT"); wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress("wglSwapIntervalEXT");
wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC) wglGetProcAddress("wglGetSwapIntervalEXT"); wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC) wglGetProcAddress("wglGetSwapIntervalEXT");

View File

@ -29,10 +29,10 @@ EVT_ENTER_WINDOW(GainCanvas::OnMouseEnterWindow)
EVT_MOUSEWHEEL(GainCanvas::OnMouseWheelMoved) EVT_MOUSEWHEEL(GainCanvas::OnMouseWheelMoved)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
GainCanvas::GainCanvas(wxWindow *parent, std::vector<int> dispAttrs) : GainCanvas::GainCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
InteractiveCanvas(parent, dispAttrs) { InteractiveCanvas(parent, dispAttrs) {
glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this)); glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
bgPanel.setCoordinateSystem(GLPanel::GLPANEL_Y_UP); bgPanel.setCoordinateSystem(GLPanel::GLPANEL_Y_UP);
bgPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_X); bgPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_X);

View File

@ -21,7 +21,7 @@
class GainCanvas: public InteractiveCanvas { class GainCanvas: public InteractiveCanvas {
public: public:
GainCanvas(wxWindow *parent, std::vector<int> dispAttrs); GainCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
~GainCanvas(); ~GainCanvas();
void setHelpTip(std::string tip); void setHelpTip(std::string tip);

View File

@ -20,9 +20,9 @@
#include <wx/numformatter.h> #include <wx/numformatter.h>
InteractiveCanvas::InteractiveCanvas(wxWindow *parent, std::vector<int> dispAttrs) : InteractiveCanvas::InteractiveCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
wxGLCanvas(parent, wxID_ANY, dispAttrs.data(), wxDefaultPosition, wxDefaultSize, wxGLCanvas(parent, dispAttrs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE),
wxFULL_REPAINT_ON_RESIZE), parent(parent), shiftDown(false), altDown(false), ctrlDown(false), centerFreq(0), bandwidth(0), lastBandwidth(0), isView( parent(parent), shiftDown(false), altDown(false), ctrlDown(false), centerFreq(0), bandwidth(0), lastBandwidth(0), isView(
false) { false) {
mouseTracker.setTarget(this); mouseTracker.setTarget(this);
} }

View File

@ -12,7 +12,7 @@
class InteractiveCanvas: public wxGLCanvas { class InteractiveCanvas: public wxGLCanvas {
public: public:
InteractiveCanvas(wxWindow *parent, std::vector<int> dispAttrs); InteractiveCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
virtual ~InteractiveCanvas(); virtual ~InteractiveCanvas();
long long getFrequencyAt(float x); long long getFrequencyAt(float x);

View File

@ -30,10 +30,10 @@ EVT_LEAVE_WINDOW(MeterCanvas::OnMouseLeftWindow)
EVT_ENTER_WINDOW(MeterCanvas::OnMouseEnterWindow) EVT_ENTER_WINDOW(MeterCanvas::OnMouseEnterWindow)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
MeterCanvas::MeterCanvas(wxWindow *parent, std::vector<int> dispAttrs) : MeterCanvas::MeterCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
InteractiveCanvas(parent, dispAttrs), level(0), level_min(0), level_max(1), inputValue(0), userInputValue(0), showUserInput(true) { InteractiveCanvas(parent, dispAttrs), level(0), level_min(0), level_max(1), inputValue(0), userInputValue(0), showUserInput(true) {
glContext = new MeterContext(this, &wxGetApp().GetContext(this)); glContext = new MeterContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
} }
MeterCanvas::~MeterCanvas() { MeterCanvas::~MeterCanvas() {

View File

@ -17,7 +17,7 @@
class MeterCanvas: public InteractiveCanvas { class MeterCanvas: public InteractiveCanvas {
public: public:
MeterCanvas(wxWindow *parent, std::vector<int> dispAttrs); MeterCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
~MeterCanvas(); ~MeterCanvas();
void setLevel(float level_in); void setLevel(float level_in);

View File

@ -5,8 +5,8 @@
#include "MeterCanvas.h" #include "MeterCanvas.h"
#include "ColorTheme.h" #include "ColorTheme.h"
MeterContext::MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext) : MeterContext::MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) :
PrimaryGLContext(canvas, sharedContext) { PrimaryGLContext(canvas, sharedContext, ctxAttrs) {
} }
void MeterContext::DrawBegin() { void MeterContext::DrawBegin() {

View File

@ -12,7 +12,7 @@ class MeterCanvas;
class MeterContext: public PrimaryGLContext { class MeterContext: public PrimaryGLContext {
public: public:
MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext); MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs);
void DrawBegin(); void DrawBegin();
void Draw(float r, float g, float b, float a, float level); void Draw(float r, float g, float b, float a, float level);

View File

@ -27,10 +27,10 @@ EVT_LEAVE_WINDOW(ModeSelectorCanvas::OnMouseLeftWindow)
EVT_ENTER_WINDOW(ModeSelectorCanvas::OnMouseEnterWindow) EVT_ENTER_WINDOW(ModeSelectorCanvas::OnMouseEnterWindow)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
ModeSelectorCanvas::ModeSelectorCanvas(wxWindow *parent, std::vector<int> dispAttrs) : ModeSelectorCanvas::ModeSelectorCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
InteractiveCanvas(parent, dispAttrs), numChoices(0), currentSelection(-1), toggleMode(false), inputChanged(false), padX(4.0), padY(4.0), highlightOverride(false) { InteractiveCanvas(parent, dispAttrs), numChoices(0), currentSelection(-1), toggleMode(false), inputChanged(false), padX(4.0), padY(4.0), highlightOverride(false) {
glContext = new ModeSelectorContext(this, &wxGetApp().GetContext(this)); glContext = new ModeSelectorContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
highlightColor = RGBA4f(1.0,1.0,1.0,1.0); highlightColor = RGBA4f(1.0,1.0,1.0,1.0);
} }

View File

@ -27,7 +27,7 @@ public:
class ModeSelectorCanvas: public InteractiveCanvas { class ModeSelectorCanvas: public InteractiveCanvas {
public: public:
ModeSelectorCanvas(wxWindow *parent, std::vector<int> dispAttrs); ModeSelectorCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
~ModeSelectorCanvas(); ~ModeSelectorCanvas();
int getHoveredSelection(); int getHoveredSelection();

View File

@ -6,8 +6,8 @@
#include "ColorTheme.h" #include "ColorTheme.h"
ModeSelectorContext::ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext) : ModeSelectorContext::ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) :
PrimaryGLContext(canvas, sharedContext) { PrimaryGLContext(canvas, sharedContext, ctxAttrs) {
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);

View File

@ -12,7 +12,7 @@ class ModeSelectorCanvas;
class ModeSelectorContext: public PrimaryGLContext { class ModeSelectorContext: public PrimaryGLContext {
public: public:
ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext); ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs);
void DrawBegin(); void DrawBegin();
void DrawSelector(std::string label, int c, int cMax, bool on, float r, float g, float b, float a, float padx, float pady); void DrawSelector(std::string label, int c, int cMax, bool on, float r, float g, float b, float a, float padx, float pady);

View File

@ -50,8 +50,11 @@ void PrimaryGLContext::CheckGLError() {
} }
} }
PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext) : PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs* ctxAttrs) :
wxGLContext(canvas, sharedContext), hoverAlpha(1.0) { wxGLContext(canvas, sharedContext, (const wxGLContextAttrs*) ctxAttrs), hoverAlpha(1.0) {
//#ifndef __linux__ //#ifndef __linux__
// SetCurrent(*canvas); // SetCurrent(*canvas);
// // Pre-load fonts // // Pre-load fonts

View File

@ -16,7 +16,7 @@
class PrimaryGLContext: public wxGLContext { class PrimaryGLContext: public wxGLContext {
public: public:
PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext); PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs* ctxAttrs);
static wxString glGetwxString(GLenum name); static wxString glGetwxString(GLenum name);
static void CheckGLError(); static void CheckGLError();

View File

@ -31,9 +31,9 @@ EVT_LEAVE_WINDOW(ScopeCanvas::OnMouseLeftWindow)
EVT_ENTER_WINDOW(ScopeCanvas::OnMouseEnterWindow) EVT_ENTER_WINDOW(ScopeCanvas::OnMouseEnterWindow)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
ScopeCanvas::ScopeCanvas(wxWindow *parent, std::vector<int> dispAttrs) : InteractiveCanvas(parent, dispAttrs), ppmMode(false), ctr(0), ctrTarget(0), dragAccel(0), helpTip("") { ScopeCanvas::ScopeCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) : InteractiveCanvas(parent, dispAttrs), ppmMode(false), ctr(0), ctrTarget(0), dragAccel(0), helpTip("") {
glContext = new ScopeContext(this, &wxGetApp().GetContext(this)); glContext = new ScopeContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
inputData->set_max_num_items(2); inputData->set_max_num_items(2);
bgPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_Y); bgPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_Y);
bgPanel.setSize(1.0, 0.5f); bgPanel.setSize(1.0, 0.5f);

View File

@ -18,7 +18,7 @@
class ScopeCanvas: public InteractiveCanvas { class ScopeCanvas: public InteractiveCanvas {
public: public:
ScopeCanvas(wxWindow *parent, std::vector<int> dispAttrs); ScopeCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
~ScopeCanvas(); ~ScopeCanvas();
//This is public because it is indeed forwarded from //This is public because it is indeed forwarded from

View File

@ -6,8 +6,8 @@
#include "ScopeCanvas.h" #include "ScopeCanvas.h"
#include "ColorTheme.h" #include "ColorTheme.h"
ScopeContext::ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext) : ScopeContext::ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) :
PrimaryGLContext(canvas, sharedContext) { PrimaryGLContext(canvas, sharedContext, ctxAttrs) {
glDisable (GL_CULL_FACE); glDisable (GL_CULL_FACE);
glDisable (GL_DEPTH_TEST); glDisable (GL_DEPTH_TEST);

View File

@ -12,7 +12,7 @@ class ScopeCanvas;
class ScopeContext: public PrimaryGLContext { class ScopeContext: public PrimaryGLContext {
public: public:
ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext); ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs);
void DrawBegin(bool clear=true); void DrawBegin(bool clear=true);
void DrawTunerTitles(bool ppmMode=false); void DrawTunerTitles(bool ppmMode=false);

View File

@ -32,10 +32,10 @@ EVT_RIGHT_DOWN(SpectrumCanvas::OnMouseRightDown)
EVT_RIGHT_UP(SpectrumCanvas::OnMouseRightReleased) EVT_RIGHT_UP(SpectrumCanvas::OnMouseRightReleased)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
SpectrumCanvas::SpectrumCanvas(wxWindow *parent, std::vector<int> dispAttrs) : SpectrumCanvas::SpectrumCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
InteractiveCanvas(parent, dispAttrs), waterfallCanvas(NULL) { InteractiveCanvas(parent, dispAttrs), waterfallCanvas(NULL) {
glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this)); glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
visualDataQueue->set_max_num_items(1); visualDataQueue->set_max_num_items(1);

View File

@ -17,7 +17,7 @@ class WaterfallCanvas;
class SpectrumCanvas: public InteractiveCanvas { class SpectrumCanvas: public InteractiveCanvas {
public: public:
SpectrumCanvas(wxWindow *parent, std::vector<int> dispAttrs); SpectrumCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
~SpectrumCanvas(); ~SpectrumCanvas();
//This is public because it is indeed forwarded from //This is public because it is indeed forwarded from

View File

@ -33,10 +33,10 @@ EVT_MOUSEWHEEL(TuningCanvas::OnMouseWheelMoved)
//EVT_KEY_UP(TuningCanvas::OnKeyUp) //EVT_KEY_UP(TuningCanvas::OnKeyUp)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
TuningCanvas::TuningCanvas(wxWindow *parent, std::vector<int> dispAttrs) : TuningCanvas::TuningCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
InteractiveCanvas(parent, dispAttrs), dragAccum(0), uxDown(0), top(false), bottom(false), freq(-1), bw(-1), center(-1), halfBand(false) { InteractiveCanvas(parent, dispAttrs), dragAccum(0), uxDown(0), top(false), bottom(false), freq(-1), bw(-1), center(-1), halfBand(false) {
glContext = new TuningContext(this, &wxGetApp().GetContext(this)); glContext = new TuningContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
hoverIndex = 0; hoverIndex = 0;
downIndex = 0; downIndex = 0;
@ -272,7 +272,6 @@ void TuningCanvas::OnIdle(wxIdleEvent &event) {
if (mouseTracker.mouseInView() || changed()) { if (mouseTracker.mouseInView() || changed()) {
Refresh(); Refresh();
} }
event.RequestMore();
} }
void TuningCanvas::OnMouseMoved(wxMouseEvent& event) { void TuningCanvas::OnMouseMoved(wxMouseEvent& event) {

View File

@ -20,7 +20,7 @@ public:
enum ActiveState { enum ActiveState {
TUNING_HOVER_NONE, TUNING_HOVER_FREQ, TUNING_HOVER_BW, TUNING_HOVER_PPM, TUNING_HOVER_CENTER TUNING_HOVER_NONE, TUNING_HOVER_FREQ, TUNING_HOVER_BW, TUNING_HOVER_PPM, TUNING_HOVER_CENTER
}; };
TuningCanvas(wxWindow *parent, std::vector<int> dispAttrs); TuningCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
~TuningCanvas(); ~TuningCanvas();
void setHelpTip(std::string tip); void setHelpTip(std::string tip);

View File

@ -18,8 +18,8 @@ protected:
} }
}; };
TuningContext::TuningContext(TuningCanvas *canvas, wxGLContext *sharedContext) : TuningContext::TuningContext(TuningCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) :
PrimaryGLContext(canvas, sharedContext) { PrimaryGLContext(canvas, sharedContext, ctxAttrs) {
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);

View File

@ -12,7 +12,7 @@ class TuningCanvas;
class TuningContext: public PrimaryGLContext { class TuningContext: public PrimaryGLContext {
public: public:
TuningContext(TuningCanvas *canvas, wxGLContext *sharedContext); TuningContext(TuningCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs);
void DrawBegin(); void DrawBegin();
void Draw(float r, float g, float b, float a, float p1, float p2); void Draw(float r, float g, float b, float a, float p1, float p2);

View File

@ -39,11 +39,11 @@ EVT_ENTER_WINDOW(WaterfallCanvas::OnMouseEnterWindow)
EVT_MOUSEWHEEL(WaterfallCanvas::OnMouseWheelMoved) EVT_MOUSEWHEEL(WaterfallCanvas::OnMouseWheelMoved)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
WaterfallCanvas::WaterfallCanvas(wxWindow *parent, std::vector<int> dispAttrs) : WaterfallCanvas::WaterfallCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
InteractiveCanvas(parent, dispAttrs), dragState(WF_DRAG_NONE), nextDragState(WF_DRAG_NONE), fft_size(0), new_fft_size(0), waterfall_lines(0), InteractiveCanvas(parent, dispAttrs), dragState(WF_DRAG_NONE), nextDragState(WF_DRAG_NONE), fft_size(0), new_fft_size(0), waterfall_lines(0),
dragOfs(0), mouseZoom(1), zoom(1), freqMoving(false), freqMove(0.0), hoverAlpha(1.0) { dragOfs(0), mouseZoom(1), zoom(1), freqMoving(false), freqMove(0.0), hoverAlpha(1.0) {
glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this)); glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
linesPerSecond = DEFAULT_WATERFALL_LPS; linesPerSecond = DEFAULT_WATERFALL_LPS;
lpsIndex = 0; lpsIndex = 0;
preBuf = false; preBuf = false;
@ -486,7 +486,6 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
void WaterfallCanvas::OnIdle(wxIdleEvent &event) { void WaterfallCanvas::OnIdle(wxIdleEvent &event) {
processInputQueue(); processInputQueue();
Refresh(); Refresh();
event.RequestMore();
} }
void WaterfallCanvas::updateHoverState() { void WaterfallCanvas::updateHoverState() {

View File

@ -21,7 +21,7 @@ public:
WF_DRAG_NONE, WF_DRAG_BANDWIDTH_LEFT, WF_DRAG_BANDWIDTH_RIGHT, WF_DRAG_FREQUENCY, WF_DRAG_RANGE WF_DRAG_NONE, WF_DRAG_BANDWIDTH_LEFT, WF_DRAG_BANDWIDTH_RIGHT, WF_DRAG_FREQUENCY, WF_DRAG_RANGE
}; };
WaterfallCanvas(wxWindow *parent, std::vector<int> dispAttrs); WaterfallCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
void setup(unsigned int fft_size_in, int waterfall_lines_in); void setup(unsigned int fft_size_in, int waterfall_lines_in);
void setFFTSize(unsigned int fft_size_in); void setFFTSize(unsigned int fft_size_in);
~WaterfallCanvas(); ~WaterfallCanvas();