mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-07-19 01:55:17 -04:00
Improve SSB UI visuals and interactivity
This commit is contained in:
parent
6b120cff95
commit
24fe742f8e
@ -369,22 +369,35 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
|||||||
demodModeSelector->setSelection(dType);
|
demodModeSelector->setSelection(dType);
|
||||||
}
|
}
|
||||||
if (demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) {
|
if (demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) {
|
||||||
if (demod->getFrequency() != demodWaterfallCanvas->getCenterFrequency()) {
|
long long centerFreq = demod->getFrequency();
|
||||||
demodWaterfallCanvas->setCenterFrequency(demod->getFrequency());
|
unsigned int demodBw = (unsigned int) ceil((float) demod->getBandwidth() * 2.5);
|
||||||
demodSpectrumCanvas->setCenterFrequency(demod->getFrequency());
|
|
||||||
}
|
if (demod->getDemodulatorType() == DEMOD_TYPE_USB) {
|
||||||
int dSelection = demodModeSelector->getSelection();
|
demodBw /= 2;
|
||||||
if (dSelection != -1 && dSelection != demod->getDemodulatorType()) {
|
centerFreq += demod->getBandwidth()/4;
|
||||||
demod->setDemodulatorType(dSelection);
|
}
|
||||||
|
|
||||||
|
if (demod->getDemodulatorType() == DEMOD_TYPE_LSB) {
|
||||||
|
demodBw /= 2;
|
||||||
|
centerFreq -= demod->getBandwidth()/4;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int demodBw = (unsigned int) ceil((float) demod->getBandwidth() * 2.5);
|
|
||||||
if (demodBw > wxGetApp().getSampleRate() / 2) {
|
if (demodBw > wxGetApp().getSampleRate() / 2) {
|
||||||
demodBw = wxGetApp().getSampleRate() / 2;
|
demodBw = wxGetApp().getSampleRate() / 2;
|
||||||
}
|
}
|
||||||
if (demodBw < 30000) {
|
if (demodBw < 30000) {
|
||||||
demodBw = 30000;
|
demodBw = 30000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (centerFreq != demodWaterfallCanvas->getCenterFrequency()) {
|
||||||
|
demodWaterfallCanvas->setCenterFrequency(centerFreq);
|
||||||
|
demodSpectrumCanvas->setCenterFrequency(centerFreq);
|
||||||
|
}
|
||||||
|
int dSelection = demodModeSelector->getSelection();
|
||||||
|
if (dSelection != -1 && dSelection != demod->getDemodulatorType()) {
|
||||||
|
demod->setDemodulatorType(dSelection);
|
||||||
|
}
|
||||||
|
|
||||||
demodWaterfallCanvas->setBandwidth(demodBw);
|
demodWaterfallCanvas->setBandwidth(demodBw);
|
||||||
demodSpectrumCanvas->setBandwidth(demodBw);
|
demodSpectrumCanvas->setBandwidth(demodBw);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ std::vector<DemodulatorInstance *> *DemodulatorMgr::getDemodulatorsAt(long long
|
|||||||
|
|
||||||
long long halfBuffer = bandwidth / 2;
|
long long halfBuffer = bandwidth / 2;
|
||||||
|
|
||||||
if ((freq <= (freqTest + halfBandwidthTest + halfBuffer)) && (freq >= (freqTest - halfBandwidthTest - halfBuffer))) {
|
if ((freq <= (freqTest + ((testDemod->getDemodulatorType() != DEMOD_TYPE_LSB)?halfBandwidthTest:0) + halfBuffer)) && (freq >= (freqTest - ((testDemod->getDemodulatorType() != DEMOD_TYPE_USB)?halfBandwidthTest:0) - halfBuffer))) {
|
||||||
foundDemods->push_back(testDemod);
|
foundDemods->push_back(testDemod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, float r, float
|
|||||||
glColor4f(r, g, b, 0.6);
|
glColor4f(r, g, b, 0.6);
|
||||||
|
|
||||||
float ofs = ((float) demod->getBandwidth()) / (float) srate;
|
float ofs = ((float) demod->getBandwidth()) / (float) srate;
|
||||||
|
float ofsLeft = (demod->getDemodulatorType()!=DEMOD_TYPE_USB)?ofs:0, ofsRight = (demod->getDemodulatorType()!=DEMOD_TYPE_LSB)?ofs:0;
|
||||||
|
|
||||||
float labelHeight = 20.0 / viewHeight;
|
float labelHeight = 20.0 / viewHeight;
|
||||||
float hPos = -1.0 + labelHeight;
|
float hPos = -1.0 + labelHeight;
|
||||||
@ -134,42 +134,47 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, float r, float
|
|||||||
|
|
||||||
glColor4f(0, 0, 0, 0.35);
|
glColor4f(0, 0, 0, 0.35);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glVertex3f(uxPos - ofs, hPos + labelHeight, 0.0);
|
glVertex3f(uxPos - ofsLeft, hPos + labelHeight, 0.0);
|
||||||
glVertex3f(uxPos - ofs, -1.0, 0.0);
|
glVertex3f(uxPos - ofsLeft, -1.0, 0.0);
|
||||||
|
|
||||||
glVertex3f(uxPos + ofs, -1.0, 0.0);
|
glVertex3f(uxPos + ofsRight, -1.0, 0.0);
|
||||||
glVertex3f(uxPos + ofs, hPos + labelHeight, 0.0);
|
glVertex3f(uxPos + ofsRight, hPos + labelHeight, 0.0);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
|
|
||||||
glColor4f(r, g, b, 0.2);
|
glColor4f(r, g, b, 0.2);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glVertex3f(uxPos - ofs, 1.0, 0.0);
|
glVertex3f(uxPos - ofsLeft, 1.0, 0.0);
|
||||||
glVertex3f(uxPos - ofs, -1.0, 0.0);
|
glVertex3f(uxPos - ofsLeft, -1.0, 0.0);
|
||||||
|
|
||||||
glVertex3f(uxPos + ofs, -1.0, 0.0);
|
glVertex3f(uxPos + ofsRight, -1.0, 0.0);
|
||||||
glVertex3f(uxPos + ofs, 1.0, 0.0);
|
glVertex3f(uxPos + ofsRight, 1.0, 0.0);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ofs * 2.0 < 16.0 / viewWidth) {
|
if (ofs * 2.0 < 16.0 / viewWidth) {
|
||||||
ofs = 16.0 / viewWidth;
|
ofs = 16.0 / viewWidth;
|
||||||
|
|
||||||
glColor4f(r, g, b, 0.2);
|
glColor4f(r, g, b, 0.2);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glVertex3f(uxPos - ofs, hPos + labelHeight, 0.0);
|
glVertex3f(uxPos - ofsLeft, hPos + labelHeight, 0.0);
|
||||||
glVertex3f(uxPos - ofs, -1.0, 0.0);
|
glVertex3f(uxPos - ofsLeft, -1.0, 0.0);
|
||||||
|
|
||||||
glVertex3f(uxPos + ofs, -1.0, 0.0);
|
glVertex3f(uxPos + ofsRight, -1.0, 0.0);
|
||||||
glVertex3f(uxPos + ofs, hPos + labelHeight, 0.0);
|
glVertex3f(uxPos + ofsRight, hPos + labelHeight, 0.0);
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glColor4f(1.0, 1.0, 1.0, 0.8);
|
glColor4f(1.0, 1.0, 1.0, 0.8);
|
||||||
|
|
||||||
|
if (demod->getDemodulatorType() == DEMOD_TYPE_USB) {
|
||||||
|
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_LEFT, GLFont::GLFONT_ALIGN_CENTER);
|
||||||
|
} else if (demod->getDemodulatorType() == DEMOD_TYPE_LSB) {
|
||||||
|
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
|
||||||
|
} else {
|
||||||
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
|
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
|
||||||
|
}
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
@ -195,28 +200,29 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, float r, float g, f
|
|||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
glColor4f(r, g, b, 0.6);
|
glColor4f(r, g, b, 0.6);
|
||||||
|
|
||||||
|
float ofs = ((float) demod->getBandwidth()) / (float) srate;
|
||||||
|
float ofsLeft = (demod->getDemodulatorType()!=DEMOD_TYPE_USB)?ofs:0, ofsRight = (demod->getDemodulatorType()!=DEMOD_TYPE_LSB)?ofs:0;
|
||||||
|
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glVertex3f((uxPos - 0.5) * 2.0, 1.0, 0.0);
|
glVertex3f((uxPos - 0.5) * 2.0, 1.0, 0.0);
|
||||||
glVertex3f((uxPos - 0.5) * 2.0, -1.0, 0.0);
|
glVertex3f((uxPos - 0.5) * 2.0, -1.0, 0.0);
|
||||||
|
|
||||||
float ofs = ((float) demod->getBandwidth()) / (float) srate;
|
glVertex3f((uxPos - 0.5) * 2.0 - ofsLeft, 1.0, 0.0);
|
||||||
|
glVertex3f((uxPos - 0.5) * 2.0 - ofsLeft, -1.0, 0.0);
|
||||||
|
|
||||||
glVertex3f((uxPos - 0.5) * 2.0 - ofs, 1.0, 0.0);
|
glVertex3f((uxPos - 0.5) * 2.0 + ofsRight, 1.0, 0.0);
|
||||||
glVertex3f((uxPos - 0.5) * 2.0 - ofs, -1.0, 0.0);
|
glVertex3f((uxPos - 0.5) * 2.0 + ofsRight, -1.0, 0.0);
|
||||||
|
|
||||||
glVertex3f((uxPos - 0.5) * 2.0 + ofs, 1.0, 0.0);
|
|
||||||
glVertex3f((uxPos - 0.5) * 2.0 + ofs, -1.0, 0.0);
|
|
||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
glColor4f(r, g, b, 0.2);
|
glColor4f(r, g, b, 0.2);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glVertex3f((uxPos - 0.5) * 2.0 - ofs, 1.0, 0.0);
|
glVertex3f((uxPos - 0.5) * 2.0 - ofsLeft, 1.0, 0.0);
|
||||||
glVertex3f((uxPos - 0.5) * 2.0 - ofs, -1.0, 0.0);
|
glVertex3f((uxPos - 0.5) * 2.0 - ofsLeft, -1.0, 0.0);
|
||||||
|
|
||||||
glVertex3f((uxPos - 0.5) * 2.0 + ofs, -1.0, 0.0);
|
glVertex3f((uxPos - 0.5) * 2.0 + ofsRight, -1.0, 0.0);
|
||||||
glVertex3f((uxPos - 0.5) * 2.0 + ofs, 1.0, 0.0);
|
glVertex3f((uxPos - 0.5) * 2.0 + ofsRight, 1.0, 0.0);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
GLint vp[4];
|
GLint vp[4];
|
||||||
@ -252,10 +258,12 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, float r, float g, f
|
|||||||
case DEMOD_TYPE_LSB:
|
case DEMOD_TYPE_LSB:
|
||||||
demodStr = "LSB";
|
demodStr = "LSB";
|
||||||
demodAlign = GLFont::GLFONT_ALIGN_RIGHT;
|
demodAlign = GLFont::GLFONT_ALIGN_RIGHT;
|
||||||
|
uxPos -= xOfs;
|
||||||
break;
|
break;
|
||||||
case DEMOD_TYPE_USB:
|
case DEMOD_TYPE_USB:
|
||||||
demodStr = "USB";
|
demodStr = "USB";
|
||||||
demodAlign = GLFont::GLFONT_ALIGN_LEFT;
|
demodAlign = GLFont::GLFONT_ALIGN_LEFT;
|
||||||
|
uxPos += xOfs;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user