mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-04 06:54:41 -04:00
Basic X/Y scope plot while in digital mode
This commit is contained in:
+19
-17
@@ -28,7 +28,7 @@ EVT_LEAVE_WINDOW(ScopeCanvas::OnMouseLeftWindow)
|
||||
EVT_ENTER_WINDOW(ScopeCanvas::OnMouseEnterWindow)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
ScopeCanvas::ScopeCanvas(wxWindow *parent, int *attribList) : InteractiveCanvas(parent, attribList), stereo(false), ppmMode(false), ctr(0), ctrTarget(0), dragAccel(0), helpTip("") {
|
||||
ScopeCanvas::ScopeCanvas(wxWindow *parent, int *attribList) : InteractiveCanvas(parent, attribList), ppmMode(false), ctr(0), ctrTarget(0), dragAccel(0), helpTip("") {
|
||||
|
||||
glContext = new ScopeContext(this, &wxGetApp().GetContext(this));
|
||||
inputData.set_max_num_items(2);
|
||||
@@ -65,7 +65,7 @@ bool ScopeCanvas::spectrumVisible() {
|
||||
float panelInterval = (2.0 + panelSpacing);
|
||||
|
||||
ctrTarget = abs(round(ctr / panelInterval));
|
||||
|
||||
|
||||
if (ctrTarget == 1 || dragAccel || (ctr != ctrTarget)) {
|
||||
return true;
|
||||
}
|
||||
@@ -73,10 +73,6 @@ bool ScopeCanvas::spectrumVisible() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void ScopeCanvas::setStereo(bool state) {
|
||||
stereo = state;
|
||||
}
|
||||
|
||||
void ScopeCanvas::setDeviceName(std::string device_name) {
|
||||
deviceName = device_name;
|
||||
deviceName.append(" ");
|
||||
@@ -106,12 +102,12 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
ScopeRenderData *avData;
|
||||
inputData.pop(avData);
|
||||
|
||||
|
||||
if (!avData->spectrum) {
|
||||
scopePanel.setMode(avData->mode);
|
||||
if (avData->waveform_points.size()) {
|
||||
scopePanel.setPoints(avData->waveform_points);
|
||||
setStereo(avData->channels == 2);
|
||||
}
|
||||
|
||||
avData->decRefCount();
|
||||
} else {
|
||||
if (avData->waveform_points.size()) {
|
||||
@@ -133,14 +129,18 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
|
||||
glViewport(0, 0, ClientSize.x, ClientSize.y);
|
||||
|
||||
glContext->DrawBegin();
|
||||
if (scopePanel.getMode() == ScopePanel::SCOPE_MODE_XY && !spectrumVisible()) {
|
||||
glDrawBuffer(GL_FRONT);
|
||||
glContext->DrawBegin(false);
|
||||
} else {
|
||||
glDrawBuffer(GL_BACK);
|
||||
glContext->DrawBegin();
|
||||
|
||||
bgPanel.setFillColor(ThemeMgr::mgr.currentTheme->scopeBackground * 3.0, RGBA4f(0,0,0,1));
|
||||
bgPanel.calcTransform(CubicVR::mat4::identity());
|
||||
bgPanel.draw();
|
||||
}
|
||||
|
||||
bgPanel.setFillColor(ThemeMgr::mgr.currentTheme->scopeBackground * 3.0, RGBA4f(0,0,0,0));
|
||||
bgPanel.calcTransform(CubicVR::mat4::identity());
|
||||
bgPanel.draw();
|
||||
|
||||
scopePanel.setMode(stereo?ScopePanel::SCOPE_MODE_2Y:ScopePanel::SCOPE_MODE_Y);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glLoadMatrixf(CubicVR::mat4::perspective(45.0, 1.0, 1.0, 1000.0));
|
||||
@@ -190,7 +190,7 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
|
||||
spectrumPanel.setPosition(panelInterval+ctr, 0);
|
||||
if (spectrumVisible()) {
|
||||
spectrumPanel.setFillColor(ThemeMgr::mgr.currentTheme->scopeBackground * 2.0, RGBA4f(0,0,0,0));
|
||||
spectrumPanel.setFillColor(ThemeMgr::mgr.currentTheme->scopeBackground * 2.0, RGBA4f(0,0,0,1));
|
||||
spectrumPanel.contentsVisible = true;
|
||||
roty = atan2(spectrumPanel.pos[0],1.2);
|
||||
spectrumPanel.rot[1] = -(roty * (180.0 / M_PI));
|
||||
@@ -217,7 +217,9 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
glContext->DrawTunerTitles(ppmMode);
|
||||
glContext->DrawEnd();
|
||||
|
||||
SwapBuffers();
|
||||
if (scopePanel.getMode() != ScopePanel::SCOPE_MODE_XY || spectrumVisible()) {
|
||||
SwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ public:
|
||||
ScopeCanvas(wxWindow *parent, int *attribList = NULL);
|
||||
~ScopeCanvas();
|
||||
|
||||
void setStereo(bool state);
|
||||
void setDeviceName(std::string device_name);
|
||||
void setPPMMode(bool ppmMode);
|
||||
bool getPPMMode();
|
||||
@@ -50,7 +49,6 @@ private:
|
||||
GLPanel bgPanel;
|
||||
ScopeContext *glContext;
|
||||
std::string deviceName;
|
||||
bool stereo;
|
||||
bool ppmMode;
|
||||
bool showDb;
|
||||
float panelSpacing;
|
||||
|
||||
@@ -12,10 +12,12 @@ ScopeContext::ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext) :
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
void ScopeContext::DrawBegin() {
|
||||
glClearColor(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g,
|
||||
ThemeMgr::mgr.currentTheme->scopeBackground.b, 1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
void ScopeContext::DrawBegin(bool clear) {
|
||||
if (clear) {
|
||||
glClearColor(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g,
|
||||
ThemeMgr::mgr.currentTheme->scopeBackground.b, 1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
@@ -11,7 +11,7 @@ class ScopeContext: public PrimaryGLContext {
|
||||
public:
|
||||
ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext);
|
||||
|
||||
void DrawBegin();
|
||||
void DrawBegin(bool clear=true);
|
||||
void DrawTunerTitles(bool ppmMode=false);
|
||||
void DrawDeviceName(std::string deviceName);
|
||||
void DrawDivider();
|
||||
|
||||
Reference in New Issue
Block a user