Add center line for hovered/new/move state modems

This commit is contained in:
Charles J. Cliffe 2016-03-07 19:25:12 -05:00
parent b250825595
commit 29d411cead
4 changed files with 31 additions and 8 deletions

View File

@ -59,7 +59,7 @@ PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContex
//#endif //#endif
} }
void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGBA4f color, long long center_freq, long long srate) { void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGBA4f color, long long center_freq, long long srate, bool centerline) {
if (!demod) { if (!demod) {
return; return;
} }
@ -143,6 +143,13 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGBA4f color, l
glEnd(); glEnd();
} }
if (centerline) {
glColor4f(color.r, color.g, color.b, 0.5);
glBegin(GL_LINES);
glVertex3f(uxPos, 1.0, 0.0);
glVertex3f(uxPos, -1.0, 0.0);
glEnd();
}
glColor4f(1.0, 1.0, 1.0, 0.8); glColor4f(1.0, 1.0, 1.0, 0.8);
@ -170,7 +177,7 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGBA4f color, l
} }
void PrimaryGLContext::DrawFreqBwInfo(long long freq, int bw, RGBA4f color, long long center_freq, long long srate, bool stack) { void PrimaryGLContext::DrawFreqBwInfo(long long freq, int bw, RGBA4f color, long long center_freq, long long srate, bool stack, bool centerline) {
if (!srate) { if (!srate) {
srate = wxGetApp().getSampleRate(); srate = wxGetApp().getSampleRate();
} }
@ -232,6 +239,14 @@ void PrimaryGLContext::DrawFreqBwInfo(long long freq, int bw, RGBA4f color, long
glEnd(); glEnd();
} }
if (centerline) {
glColor4f(color.r, color.g, color.b, 0.5);
glBegin(GL_LINES);
glVertex3f(uxPos, 1.0, 0.0);
glVertex3f(uxPos, -1.0, 0.0);
glEnd();
}
glColor4f(1.0, 1.0, 1.0, 0.8); glColor4f(1.0, 1.0, 1.0, 0.8);
std::string demodLabel = std::to_string((double)freq/1000000.0); std::string demodLabel = std::to_string((double)freq/1000000.0);

View File

@ -24,8 +24,8 @@ public:
void DrawFreqSelector(float uxPos, RGBA4f color, float w = 0, long long center_freq = -1, long long srate = 0); 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 DrawRangeSelector(float uxPos1, float uxPos2, RGBA4f color);
void DrawDemod(DemodulatorInstance *demod, RGBA4f color, long long center_freq = -1, long long srate = 0); void DrawDemod(DemodulatorInstance *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); void DrawDemodInfo(DemodulatorInstance *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); 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); void setHoverAlpha(float hoverAlpha);

View File

@ -92,13 +92,18 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators(); std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
DemodulatorInstance *activeDemodulator = wxGetApp().getDemodMgr().getActiveDemodulator();
for (int i = 0, iMax = demods.size(); i < iMax; i++) { for (int i = 0, iMax = demods.size(); i < iMax; i++) {
glContext->DrawDemodInfo(demods[i], ThemeMgr::mgr.currentTheme->fftHighlight, getCenterFrequency(), getBandwidth()); if (!demods[i]->isActive()) {
continue;
}
glContext->DrawDemodInfo(demods[i], ThemeMgr::mgr.currentTheme->fftHighlight, getCenterFrequency(), getBandwidth(), activeDemodulator==demods[i]);
} }
if (waterfallCanvas) { if (waterfallCanvas && !activeDemodulator) {
MouseTracker *wfmt = waterfallCanvas->getMouseTracker(); MouseTracker *wfmt = waterfallCanvas->getMouseTracker();
if (wfmt->mouseInView() && !wxGetApp().getDemodMgr().getActiveDemodulator()) { if (wfmt->mouseInView()) {
int snap = wxGetApp().getFrequencySnap(); int snap = wxGetApp().getFrequencySnap();
long long freq = getFrequencyAt(wfmt->getMouseX()); long long freq = getFrequencyAt(wfmt->getMouseX());
@ -111,7 +116,7 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
bool isNew = (((waterfallCanvas->isShiftDown() || (lastActiveDemodulator && !lastActiveDemodulator->isActive())) && lastActiveDemodulator) || (!lastActiveDemodulator)); bool isNew = (((waterfallCanvas->isShiftDown() || (lastActiveDemodulator && !lastActiveDemodulator->isActive())) && lastActiveDemodulator) || (!lastActiveDemodulator));
glContext->DrawFreqBwInfo(freq, wxGetApp().getDemodMgr().getLastBandwidth(), isNew?ThemeMgr::mgr.currentTheme->waterfallNew:ThemeMgr::mgr.currentTheme->waterfallHover, getCenterFrequency(), getBandwidth(), true); glContext->DrawFreqBwInfo(freq, wxGetApp().getDemodMgr().getLastBandwidth(), isNew?ThemeMgr::mgr.currentTheme->waterfallNew:ThemeMgr::mgr.currentTheme->waterfallHover, getCenterFrequency(), getBandwidth(), true, true);
} }
} }

View File

@ -329,6 +329,9 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
glContext->setHoverAlpha(0); glContext->setHoverAlpha(0);
for (int i = 0, iMax = demods.size(); i < iMax; i++) { for (int i = 0, iMax = demods.size(); i < iMax; i++) {
if (!demods[i]->isActive()) {
continue;
}
if (activeDemodulator == demods[i] || lastActiveDemodulator == demods[i]) { if (activeDemodulator == demods[i] || lastActiveDemodulator == demods[i]) {
continue; continue;
} }