mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-05 07:24:47 -04:00
Initial commit: working...
This commit is contained in:
@@ -62,7 +62,7 @@ PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContex
|
||||
//#endif
|
||||
}
|
||||
|
||||
void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGBA4f color, long long center_freq, long long srate, bool centerline) {
|
||||
void PrimaryGLContext::DrawDemodInfo(DemodulatorInstancePtr demod, RGBA4f color, long long center_freq, long long srate, bool centerline) {
|
||||
if (!demod) {
|
||||
return;
|
||||
}
|
||||
@@ -287,7 +287,7 @@ void PrimaryGLContext::DrawFreqBwInfo(long long freq, int bw, RGBA4f color, long
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBA4f color, long long center_freq, long long srate) {
|
||||
void PrimaryGLContext::DrawDemod(DemodulatorInstancePtr demod, RGBA4f color, long long center_freq, long long srate) {
|
||||
if (!demod) {
|
||||
return;
|
||||
}
|
||||
@@ -409,7 +409,8 @@ void PrimaryGLContext::drawSingleDemodLabel(const std::wstring& demodStr, float
|
||||
}
|
||||
|
||||
void PrimaryGLContext::DrawFreqSelector(float uxPos, RGBA4f color, float w, long long /* center_freq */, long long srate) {
|
||||
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
|
||||
DemodulatorInstancePtr demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
|
||||
long long bw = 0;
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ public:
|
||||
|
||||
void DrawFreqSelector(float uxPos, RGBA4f color, float w = 0, long long center_freq = -1, long long srate = 0);
|
||||
void DrawRangeSelector(float uxPos1, float uxPos2, RGBA4f color);
|
||||
void DrawDemod(DemodulatorInstance *demod, RGBA4f color, long long center_freq = -1, long long srate = 0);
|
||||
void DrawDemod(DemodulatorInstancePtr demod, RGBA4f color, long long center_freq = -1, long long srate = 0);
|
||||
|
||||
void DrawDemodInfo(DemodulatorInstance *demod, RGBA4f color, long long center_freq = -1, long long srate = 0, bool centerline = false);
|
||||
void DrawDemodInfo(DemodulatorInstancePtr demod, RGBA4f color, long long center_freq = -1, long long srate = 0, bool centerline = false);
|
||||
void DrawFreqBwInfo(long long freq, int bw, RGBA4f color, long long center_freq = - 1, long long srate = 0, bool stack = false, bool centerline = false);
|
||||
|
||||
void setHoverAlpha(float hoverAlpha);
|
||||
|
||||
@@ -90,9 +90,8 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
|
||||
glLoadIdentity();
|
||||
|
||||
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
|
||||
|
||||
DemodulatorInstance *activeDemodulator = wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||
auto demods = wxGetApp().getDemodMgr().getDemodulators();
|
||||
auto activeDemodulator = wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||
|
||||
for (int i = 0, iMax = demods.size(); i < iMax; i++) {
|
||||
if (!demods[i]->isActive()) {
|
||||
@@ -112,7 +111,7 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
freq = roundf((float)freq/(float)snap)*snap;
|
||||
}
|
||||
|
||||
DemodulatorInstance *lastActiveDemodulator = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
auto lastActiveDemodulator = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
|
||||
bool isNew = (((waterfallCanvas->isShiftDown() || (lastActiveDemodulator && !lastActiveDemodulator->isActive())) && lastActiveDemodulator) || (!lastActiveDemodulator));
|
||||
|
||||
|
||||
@@ -61,7 +61,8 @@ TuningCanvas::~TuningCanvas() {
|
||||
}
|
||||
|
||||
bool TuningCanvas::changed() {
|
||||
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
|
||||
auto activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
|
||||
long long current_freq = 0;
|
||||
if (activeDemod != NULL) {
|
||||
@@ -92,7 +93,7 @@ void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
|
||||
glContext->DrawBegin();
|
||||
|
||||
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
auto activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
|
||||
freq = 0;
|
||||
if (activeDemod != NULL) {
|
||||
@@ -170,7 +171,7 @@ void TuningCanvas::StepTuner(ActiveState state, int exponent, bool up) {
|
||||
amount *= 2;
|
||||
}
|
||||
|
||||
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
auto activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
if (state == TUNING_HOVER_FREQ && activeDemod) {
|
||||
long long freq = activeDemod->getFrequency();
|
||||
long long diff = abs(wxGetApp().getFrequency() - freq);
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include <wx/numformatter.h>
|
||||
|
||||
#include "DemodulatorThread.h"
|
||||
|
||||
wxBEGIN_EVENT_TABLE(WaterfallCanvas, wxGLCanvas)
|
||||
EVT_PAINT(WaterfallCanvas::OnPaint)
|
||||
EVT_IDLE(WaterfallCanvas::OnIdle)
|
||||
@@ -263,10 +265,10 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
waterfallPanel.calcTransform(CubicVR::mat4::identity());
|
||||
waterfallPanel.draw();
|
||||
|
||||
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
|
||||
auto demods = wxGetApp().getDemodMgr().getDemodulators();
|
||||
|
||||
DemodulatorInstance *activeDemodulator = wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||
DemodulatorInstance *lastActiveDemodulator = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
auto activeDemodulator = wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||
auto lastActiveDemodulator = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
|
||||
bool isNew = shiftDown
|
||||
|| (wxGetApp().getDemodMgr().getLastActiveDemodulator() && !wxGetApp().getDemodMgr().getLastActiveDemodulator()->isActive());
|
||||
@@ -390,7 +392,7 @@ void WaterfallCanvas::OnKeyUp(wxKeyEvent& event) {
|
||||
void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
|
||||
InteractiveCanvas::OnKeyDown(event);
|
||||
|
||||
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||
auto activeDemod = wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||
|
||||
long long originalFreq = getCenterFrequency();
|
||||
long long freq = originalFreq;
|
||||
@@ -490,9 +492,9 @@ void WaterfallCanvas::OnIdle(wxIdleEvent &event) {
|
||||
void WaterfallCanvas::updateHoverState() {
|
||||
long long freqPos = getFrequencyAt(mouseTracker.getMouseX());
|
||||
|
||||
std::vector<DemodulatorInstance *> demodsHover = wxGetApp().getDemodMgr().getDemodulatorsAt(freqPos, 15000);
|
||||
auto demodsHover = wxGetApp().getDemodMgr().getDemodulatorsAt(freqPos, 15000);
|
||||
|
||||
wxGetApp().getDemodMgr().setActiveDemodulator(NULL);
|
||||
wxGetApp().getDemodMgr().setActiveDemodulator(nullptr);
|
||||
|
||||
if (altDown) {
|
||||
nextDragState = WF_DRAG_RANGE;
|
||||
@@ -506,10 +508,10 @@ void WaterfallCanvas::updateHoverState() {
|
||||
} else if (demodsHover.size() && !shiftDown) {
|
||||
long near_dist = getBandwidth();
|
||||
|
||||
DemodulatorInstance *activeDemodulator = NULL;
|
||||
DemodulatorInstancePtr activeDemodulator = nullptr;
|
||||
|
||||
for (int i = 0, iMax = demodsHover.size(); i < iMax; i++) {
|
||||
DemodulatorInstance *demod = demodsHover[i];
|
||||
auto demod = demodsHover[i];
|
||||
long long freqDiff = demod->getFrequency() - freqPos;
|
||||
long halfBw = (demod->getBandwidth() / 2);
|
||||
long long currentBw = getBandwidth();
|
||||
@@ -588,7 +590,7 @@ void WaterfallCanvas::updateHoverState() {
|
||||
|
||||
void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
InteractiveCanvas::OnMouseMoved(event);
|
||||
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||
auto demod = wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||
|
||||
if (mouseTracker.mouseDown()) {
|
||||
if (demod == NULL) {
|
||||
@@ -650,7 +652,7 @@ void WaterfallCanvas::OnMouseDown(wxMouseEvent& event) {
|
||||
wxGetApp().getDemodMgr().updateLastState();
|
||||
|
||||
if (dragState && dragState != WF_DRAG_RANGE) {
|
||||
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||
auto demod = wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||
if (demod) {
|
||||
dragOfs = (long long) (mouseTracker.getMouseX() * (float) getBandwidth()) + getCenterFrequency() - (getBandwidth() / 2) - demod->getFrequency();
|
||||
dragBW = demod->getBandwidth();
|
||||
@@ -676,8 +678,8 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||
mouseTracker.setVertDragLock(false);
|
||||
mouseTracker.setHorizDragLock(false);
|
||||
|
||||
DemodulatorInstance *demod = isNew?NULL:wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
DemodulatorInstance *activeDemod = isNew?NULL:wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||
DemodulatorInstancePtr demod = isNew?nullptr:wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
DemodulatorInstancePtr activeDemod = isNew?nullptr:wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||
|
||||
DemodulatorMgr *mgr = &wxGetApp().getDemodMgr();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user