Migration to wxWidgets v3.11:

- Seen on Windows: Bookmarkview slow update because the controls are self-reacting to the rebuild control events, so fix nullify them during control rebuilding.
- Update OpenGL initialization using v3.1 level context and canvas attributes instead of the deprecated calls.
This commit is contained in:
vsonnier
2018-03-10 08:34:39 +01:00
parent 8e52f232cf
commit e46d7f9735
36 changed files with 233 additions and 57 deletions
+2 -2
View File
@@ -29,10 +29,10 @@ EVT_ENTER_WINDOW(GainCanvas::OnMouseEnterWindow)
EVT_MOUSEWHEEL(GainCanvas::OnMouseWheelMoved)
wxEND_EVENT_TABLE()
GainCanvas::GainCanvas(wxWindow *parent, std::vector<int> dispAttrs) :
GainCanvas::GainCanvas(wxWindow *parent, const wxGLAttributes& 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.setFill(GLPanel::GLPANEL_FILL_GRAD_X);
+1 -1
View File
@@ -21,7 +21,7 @@
class GainCanvas: public InteractiveCanvas {
public:
GainCanvas(wxWindow *parent, std::vector<int> dispAttrs);
GainCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
~GainCanvas();
void setHelpTip(std::string tip);
+3 -3
View File
@@ -20,9 +20,9 @@
#include <wx/numformatter.h>
InteractiveCanvas::InteractiveCanvas(wxWindow *parent, std::vector<int> dispAttrs) :
wxGLCanvas(parent, wxID_ANY, dispAttrs.data(), wxDefaultPosition, wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE), parent(parent), shiftDown(false), altDown(false), ctrlDown(false), centerFreq(0), bandwidth(0), lastBandwidth(0), isView(
InteractiveCanvas::InteractiveCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
wxGLCanvas(parent, dispAttrs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE),
parent(parent), shiftDown(false), altDown(false), ctrlDown(false), centerFreq(0), bandwidth(0), lastBandwidth(0), isView(
false) {
mouseTracker.setTarget(this);
}
+1 -1
View File
@@ -12,7 +12,7 @@
class InteractiveCanvas: public wxGLCanvas {
public:
InteractiveCanvas(wxWindow *parent, std::vector<int> dispAttrs);
InteractiveCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
virtual ~InteractiveCanvas();
long long getFrequencyAt(float x);
+2 -2
View File
@@ -30,10 +30,10 @@ EVT_LEAVE_WINDOW(MeterCanvas::OnMouseLeftWindow)
EVT_ENTER_WINDOW(MeterCanvas::OnMouseEnterWindow)
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) {
glContext = new MeterContext(this, &wxGetApp().GetContext(this));
glContext = new MeterContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
}
MeterCanvas::~MeterCanvas() {
+1 -1
View File
@@ -17,7 +17,7 @@
class MeterCanvas: public InteractiveCanvas {
public:
MeterCanvas(wxWindow *parent, std::vector<int> dispAttrs);
MeterCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
~MeterCanvas();
void setLevel(float level_in);
+2 -2
View File
@@ -5,8 +5,8 @@
#include "MeterCanvas.h"
#include "ColorTheme.h"
MeterContext::MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext) :
PrimaryGLContext(canvas, sharedContext) {
MeterContext::MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) :
PrimaryGLContext(canvas, sharedContext, ctxAttrs) {
}
void MeterContext::DrawBegin() {
+1 -1
View File
@@ -12,7 +12,7 @@ class MeterCanvas;
class MeterContext: public PrimaryGLContext {
public:
MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext);
MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs);
void DrawBegin();
void Draw(float r, float g, float b, float a, float level);
+2 -2
View File
@@ -27,10 +27,10 @@ EVT_LEAVE_WINDOW(ModeSelectorCanvas::OnMouseLeftWindow)
EVT_ENTER_WINDOW(ModeSelectorCanvas::OnMouseEnterWindow)
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) {
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);
}
+1 -1
View File
@@ -27,7 +27,7 @@ public:
class ModeSelectorCanvas: public InteractiveCanvas {
public:
ModeSelectorCanvas(wxWindow *parent, std::vector<int> dispAttrs);
ModeSelectorCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
~ModeSelectorCanvas();
int getHoveredSelection();
+2 -2
View File
@@ -6,8 +6,8 @@
#include "ColorTheme.h"
ModeSelectorContext::ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext) :
PrimaryGLContext(canvas, sharedContext) {
ModeSelectorContext::ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) :
PrimaryGLContext(canvas, sharedContext, ctxAttrs) {
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
+1 -1
View File
@@ -12,7 +12,7 @@ class ModeSelectorCanvas;
class ModeSelectorContext: public PrimaryGLContext {
public:
ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext);
ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs);
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);
+5 -2
View File
@@ -50,8 +50,11 @@ void PrimaryGLContext::CheckGLError() {
}
}
PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext) :
wxGLContext(canvas, sharedContext), hoverAlpha(1.0) {
PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs* ctxAttrs) :
wxGLContext(canvas, sharedContext, (const wxGLContextAttrs*) ctxAttrs), hoverAlpha(1.0) {
//#ifndef __linux__
// SetCurrent(*canvas);
// // Pre-load fonts
+1 -1
View File
@@ -16,7 +16,7 @@
class PrimaryGLContext: public wxGLContext {
public:
PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext);
PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs* ctxAttrs);
static wxString glGetwxString(GLenum name);
static void CheckGLError();
+2 -2
View File
@@ -31,9 +31,9 @@ EVT_LEAVE_WINDOW(ScopeCanvas::OnMouseLeftWindow)
EVT_ENTER_WINDOW(ScopeCanvas::OnMouseEnterWindow)
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);
bgPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_Y);
bgPanel.setSize(1.0, 0.5f);
+1 -1
View File
@@ -18,7 +18,7 @@
class ScopeCanvas: public InteractiveCanvas {
public:
ScopeCanvas(wxWindow *parent, std::vector<int> dispAttrs);
ScopeCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
~ScopeCanvas();
//This is public because it is indeed forwarded from
+2 -2
View File
@@ -6,8 +6,8 @@
#include "ScopeCanvas.h"
#include "ColorTheme.h"
ScopeContext::ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext) :
PrimaryGLContext(canvas, sharedContext) {
ScopeContext::ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) :
PrimaryGLContext(canvas, sharedContext, ctxAttrs) {
glDisable (GL_CULL_FACE);
glDisable (GL_DEPTH_TEST);
+1 -1
View File
@@ -12,7 +12,7 @@ class ScopeCanvas;
class ScopeContext: public PrimaryGLContext {
public:
ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext);
ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs);
void DrawBegin(bool clear=true);
void DrawTunerTitles(bool ppmMode=false);
+2 -2
View File
@@ -32,10 +32,10 @@ EVT_RIGHT_DOWN(SpectrumCanvas::OnMouseRightDown)
EVT_RIGHT_UP(SpectrumCanvas::OnMouseRightReleased)
wxEND_EVENT_TABLE()
SpectrumCanvas::SpectrumCanvas(wxWindow *parent, std::vector<int> dispAttrs) :
SpectrumCanvas::SpectrumCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs) :
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);
+1 -1
View File
@@ -17,7 +17,7 @@ class WaterfallCanvas;
class SpectrumCanvas: public InteractiveCanvas {
public:
SpectrumCanvas(wxWindow *parent, std::vector<int> dispAttrs);
SpectrumCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
~SpectrumCanvas();
//This is public because it is indeed forwarded from
+2 -3
View File
@@ -33,10 +33,10 @@ EVT_MOUSEWHEEL(TuningCanvas::OnMouseWheelMoved)
//EVT_KEY_UP(TuningCanvas::OnKeyUp)
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) {
glContext = new TuningContext(this, &wxGetApp().GetContext(this));
glContext = new TuningContext(this, &wxGetApp().GetContext(this), wxGetApp().GetContextAttributes());
hoverIndex = 0;
downIndex = 0;
@@ -272,7 +272,6 @@ void TuningCanvas::OnIdle(wxIdleEvent &event) {
if (mouseTracker.mouseInView() || changed()) {
Refresh();
}
event.RequestMore();
}
void TuningCanvas::OnMouseMoved(wxMouseEvent& event) {
+1 -1
View File
@@ -20,7 +20,7 @@ public:
enum ActiveState {
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();
void setHelpTip(std::string tip);
+2 -2
View File
@@ -18,8 +18,8 @@ protected:
}
};
TuningContext::TuningContext(TuningCanvas *canvas, wxGLContext *sharedContext) :
PrimaryGLContext(canvas, sharedContext) {
TuningContext::TuningContext(TuningCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs) :
PrimaryGLContext(canvas, sharedContext, ctxAttrs) {
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
+1 -1
View File
@@ -12,7 +12,7 @@ class TuningCanvas;
class TuningContext: public PrimaryGLContext {
public:
TuningContext(TuningCanvas *canvas, wxGLContext *sharedContext);
TuningContext(TuningCanvas *canvas, wxGLContext *sharedContext, wxGLContextAttrs *ctxAttrs);
void DrawBegin();
void Draw(float r, float g, float b, float a, float p1, float p2);
+2 -3
View File
@@ -39,11 +39,11 @@ EVT_ENTER_WINDOW(WaterfallCanvas::OnMouseEnterWindow)
EVT_MOUSEWHEEL(WaterfallCanvas::OnMouseWheelMoved)
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),
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;
lpsIndex = 0;
preBuf = false;
@@ -486,7 +486,6 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
void WaterfallCanvas::OnIdle(wxIdleEvent &event) {
processInputQueue();
Refresh();
event.RequestMore();
}
void WaterfallCanvas::updateHoverState() {
+1 -1
View File
@@ -21,7 +21,7 @@ public:
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 setFFTSize(unsigned int fft_size_in);
~WaterfallCanvas();