From 15347bd7914d8995d468c76a1317be324adc648f Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Thu, 15 Jan 2015 00:59:33 -0500 Subject: [PATCH] Theme updates --- src/visual/ColorTheme.cpp | 45 ++++++++++++++++++++---------- src/visual/ColorTheme.h | 4 +++ src/visual/MeterContext.cpp | 17 +++++++++-- src/visual/ModeSelectorContext.cpp | 3 ++ src/visual/PrimaryGLContext.cpp | 3 +- src/visual/PrimaryGLContext.h | 2 +- src/visual/ScopeContext.cpp | 20 +++++++++++-- src/visual/SpectrumCanvas.cpp | 2 +- src/visual/SpectrumContext.cpp | 11 ++++++++ src/visual/TuningContext.cpp | 1 + src/visual/WaterfallCanvas.cpp | 2 +- 11 files changed, 88 insertions(+), 22 deletions(-) diff --git a/src/visual/ColorTheme.cpp b/src/visual/ColorTheme.cpp index 7b93132..201b993 100644 --- a/src/visual/ColorTheme.cpp +++ b/src/visual/ColorTheme.cpp @@ -55,6 +55,10 @@ DefaultColorTheme::DefaultColorTheme() { freqLine = RGBColor(1, 1, 1); button = RGBColor(0.65, 0.65, 0.65); buttonHighlight = RGBColor(1, 1, 0); + + scopeBackground = RGBColor(0.1, 0.1, 0.1); + fftBackground = RGBColor(0.1, 0.1, 0.1); + generalBackground = RGBColor(0.1, 0.1, 0.1); } BlackAndWhiteColorTheme::BlackAndWhiteColorTheme() { @@ -63,20 +67,25 @@ BlackAndWhiteColorTheme::BlackAndWhiteColorTheme() { waterfallGradient.addColor(GradientColor(0.75, 0.75, 0.75)); waterfallGradient.addColor(GradientColor(1.0, 1.0, 1.0)); waterfallGradient.generate(256); - waterfallHighlight = RGBColor(1, 1, 1); + waterfallHighlight = RGBColor(1, 1, 0.9); waterfallNew = RGBColor(0, 1, 0); waterfallHover = RGBColor(1, 1, 0); waterfallDestroy = RGBColor(1, 0, 0); fftLine = RGBColor(0.9, 0.9, 0.9); - fftHighlight = RGBColor(1, 1, 1); + fftHighlight = RGBColor(1, 1, 0.9); scopeLine = RGBColor(0.9, 0.9, 0.9); - tuningBar = RGBColor(0.2, 0.2, 0.9); - meterLevel = RGBColor(0, 1, 0); - meterValue = RGBColor(1, 0, 0); + tuningBar = RGBColor(0.4, 0.4, 0.4); + meterLevel = RGBColor(0.5, 0.5, 0.5); + meterValue = RGBColor(0.5, 0.5, 0.5); text = RGBColor(1, 1, 1); freqLine = RGBColor(1, 1, 1); button = RGBColor(0.65, 0.65, 0.65); - buttonHighlight = RGBColor(1, 1, 0); + buttonHighlight = RGBColor(1, 1, 1); + + scopeBackground = RGBColor(0.1, 0.1, 0.1); + fftBackground = RGBColor(0.1, 0.1, 0.1); + generalBackground = RGBColor(0.1, 0.1, 0.1); + } SharpColorTheme::SharpColorTheme() { @@ -107,6 +116,10 @@ SharpColorTheme::SharpColorTheme() { freqLine = RGBColor(0.9, 0.9, 1); button = RGBColor(217.0/255.0,218.0/255.0,228.0/255.0); buttonHighlight= RGBColor(208.0/255.0,249.0/255.0,255.0/255.0); + + scopeBackground = RGBColor(0.05, 0.05, 0.15); + fftBackground = RGBColor(0.05, 0.05, 0.15); + generalBackground = RGBColor(0.05, 0.05, 0.15); } RadColorTheme::RadColorTheme() { @@ -198,15 +211,19 @@ RadarColorTheme::RadarColorTheme() { waterfallNew = RGBColor(0, 1, 0); waterfallHover = RGBColor(1, 1, 0); waterfallDestroy = RGBColor(1, 0, 0); - fftLine = RGBColor(0.9, 0.9, 0.9); + fftLine = RGBColor(0.8, 1.0, 0.8); fftHighlight = RGBColor(1, 1, 1); - scopeLine = RGBColor(0.9, 0.9, 0.9); - tuningBar = RGBColor(0.2, 0.2, 0.9); - meterLevel = RGBColor(0, 1, 0); - meterValue = RGBColor(1, 0, 0); - text = RGBColor(1, 1, 1); + scopeLine = RGBColor(0.8, 1.0, 0.8); + tuningBar = RGBColor(0.2, 0.9, 0.2); + meterLevel = RGBColor(0, 0.5, 0); + meterValue = RGBColor(0, 0.5, 0); + text = RGBColor(0.8, 1.0, 0.8); freqLine = RGBColor(1, 1, 1); - button = RGBColor(0.65, 0.65, 0.65); - buttonHighlight = RGBColor(1, 1, 0); + button = RGBColor(0.65, 0.75, 0.65); + buttonHighlight = RGBColor(0.65, 1.0, 0.65); + + scopeBackground = RGBColor(0.05, 0.1, 0.05); + fftBackground = RGBColor(0.05, 0.1, 0.05); + generalBackground = RGBColor(0.05, 0.1, 0.05); } diff --git a/src/visual/ColorTheme.h b/src/visual/ColorTheme.h index e12aecc..398dd3f 100644 --- a/src/visual/ColorTheme.h +++ b/src/visual/ColorTheme.h @@ -55,6 +55,10 @@ public: RGBColor button; RGBColor buttonHighlight; + RGBColor scopeBackground; + RGBColor fftBackground; + RGBColor generalBackground; + Gradient waterfallGradient; std::string name; diff --git a/src/visual/MeterContext.cpp b/src/visual/MeterContext.cpp index 40fe4fd..ec89d92 100644 --- a/src/visual/MeterContext.cpp +++ b/src/visual/MeterContext.cpp @@ -1,5 +1,6 @@ #include "MeterContext.h" #include "MeterCanvas.h" +#include "ColorTheme.h" MeterContext::MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext) : PrimaryGLContext(canvas, sharedContext) { @@ -11,6 +12,7 @@ MeterContext::MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext) : } void MeterContext::DrawBegin() { + glClearColor(ThemeMgr::mgr.currentTheme->generalBackground.r, ThemeMgr::mgr.currentTheme->generalBackground.g, ThemeMgr::mgr.currentTheme->generalBackground.b, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); @@ -22,12 +24,23 @@ void MeterContext::DrawBegin() { void MeterContext::Draw(float r, float g, float b, float a, float level) { glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); - glColor4f(r, g, b, a); glBegin(GL_QUADS); - glVertex2f(1.0, -1.0 + 2.0 * level); + glColor4f(r*0.65,g*0.65,b*0.65,a); glVertex2f(-1.0, -1.0 + 2.0 * level); glVertex2f(-1.0, -1.0); + + glColor4f(r,g,b,a); + glVertex2f(0.0, -1.0); + glVertex2f(0.0, -1.0 + 2.0 * level); + + glColor4f(r,g,b,a); + glVertex2f(0.0, -1.0 + 2.0 * level); + glVertex2f(0.0, -1.0); + + glColor4f(r*0.65,g*0.65,b*0.65,a*0.65); glVertex2f(1.0, -1.0); + glVertex2f(1.0, -1.0 + 2.0 * level); + glEnd(); glDisable(GL_BLEND); } diff --git a/src/visual/ModeSelectorContext.cpp b/src/visual/ModeSelectorContext.cpp index 7643f57..11d608c 100644 --- a/src/visual/ModeSelectorContext.cpp +++ b/src/visual/ModeSelectorContext.cpp @@ -1,5 +1,7 @@ #include "ModeSelectorContext.h" #include "ModeSelectorCanvas.h" +#include "ColorTheme.h" + ModeSelectorContext::ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext) : PrimaryGLContext(canvas, sharedContext) { @@ -11,6 +13,7 @@ ModeSelectorContext::ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext } void ModeSelectorContext::DrawBegin() { + glClearColor(ThemeMgr::mgr.currentTheme->generalBackground.r, ThemeMgr::mgr.currentTheme->generalBackground.g, ThemeMgr::mgr.currentTheme->generalBackground.b,1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); diff --git a/src/visual/PrimaryGLContext.cpp b/src/visual/PrimaryGLContext.cpp index 2189dcb..1b49a4a 100644 --- a/src/visual/PrimaryGLContext.cpp +++ b/src/visual/PrimaryGLContext.cpp @@ -312,7 +312,8 @@ void PrimaryGLContext::DrawFreqSelector(float uxPos, float r, float g, float b, } -void PrimaryGLContext::BeginDraw() { +void PrimaryGLContext::BeginDraw(float r, float g, float b) { + glClearColor(r,g,b, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); diff --git a/src/visual/PrimaryGLContext.h b/src/visual/PrimaryGLContext.h index 620ae2a..6959393 100644 --- a/src/visual/PrimaryGLContext.h +++ b/src/visual/PrimaryGLContext.h @@ -20,7 +20,7 @@ public: static wxString glGetwxString(GLenum name); static void CheckGLError(); - void BeginDraw(); + void BeginDraw(float r, float g, float b); void EndDraw(); void DrawFreqSelector(float uxPos, float r = 1, float g = 1, float b = 1, float w = 0, long long center_freq = -1, long long srate = 0); diff --git a/src/visual/ScopeContext.cpp b/src/visual/ScopeContext.cpp index 66eda44..972d7f5 100644 --- a/src/visual/ScopeContext.cpp +++ b/src/visual/ScopeContext.cpp @@ -13,6 +13,7 @@ ScopeContext::ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext) : } 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); glMatrixMode(GL_MODELVIEW); @@ -22,6 +23,21 @@ void ScopeContext::DrawBegin() { } void ScopeContext::Plot(std::vector &points, bool stereo) { + glBegin(GL_QUADS); + glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.g*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.b*2.0); + glVertex2f(1, 1); + glVertex2f(-1, 1); + glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g, ThemeMgr::mgr.currentTheme->scopeBackground.b); + glVertex2f(-1, 0); + glVertex2f(1, 0); + + glVertex2f(-1, 0); + glVertex2f(1, 0); + glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.g*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.b*2.0); + glVertex2f(1, -1); + glVertex2f(-1, -1); + glEnd(); + glColor3f(1.0, 1.0, 1.0); if (stereo) { @@ -30,7 +46,7 @@ void ScopeContext::Plot(std::vector &points, bool stereo) { glVertex2f(-1.0, 0.0); glVertex2f(1.0, 0.0); glEnd(); - glColor3f(0.3, 0.3, 0.3); + glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r*0.35, ThemeMgr::mgr.currentTheme->scopeLine.g*0.35, ThemeMgr::mgr.currentTheme->scopeLine.b*0.35); glBegin(GL_LINES); glVertex2f(-1.0, 0.5); glVertex2f(1.0, 0.5); @@ -38,7 +54,7 @@ void ScopeContext::Plot(std::vector &points, bool stereo) { glVertex2f(1.0, -0.5); glEnd(); } else { - glColor3f(0.3, 0.3, 0.3); + glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r*0.35, ThemeMgr::mgr.currentTheme->scopeLine.g*0.35, ThemeMgr::mgr.currentTheme->scopeLine.b*0.35); glBegin(GL_LINES); glVertex2f(-1.0, 0.0); glVertex2f(1.0, 0.0); diff --git a/src/visual/SpectrumCanvas.cpp b/src/visual/SpectrumCanvas.cpp index 2791bef..86f9873 100644 --- a/src/visual/SpectrumCanvas.cpp +++ b/src/visual/SpectrumCanvas.cpp @@ -72,7 +72,7 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { glContext->SetCurrent(*this); glViewport(0, 0, ClientSize.x, ClientSize.y); - glContext->BeginDraw(); + glContext->BeginDraw(ThemeMgr::mgr.currentTheme->fftBackground.r, ThemeMgr::mgr.currentTheme->fftBackground.g, ThemeMgr::mgr.currentTheme->fftBackground.b); glContext->Draw(spectrum_points, getCenterFrequency(), getBandwidth()); std::vector &demods = wxGetApp().getDemodMgr().getDemodulators(); diff --git a/src/visual/SpectrumContext.cpp b/src/visual/SpectrumContext.cpp index 45af5f7..58f1a72 100644 --- a/src/visual/SpectrumContext.cpp +++ b/src/visual/SpectrumContext.cpp @@ -18,6 +18,16 @@ SpectrumContext::SpectrumContext(SpectrumCanvas *canvas, wxGLContext *sharedCont void SpectrumContext::Draw(std::vector &points, long long freq, int bandwidth) { + glBegin(GL_QUADS); + glColor3f(ThemeMgr::mgr.currentTheme->fftBackground.r*2.0, ThemeMgr::mgr.currentTheme->fftBackground.g*2.0, ThemeMgr::mgr.currentTheme->fftBackground.b*2.0); + glVertex2f(1, 1); + glVertex2f(-1, 1); + glColor3f(ThemeMgr::mgr.currentTheme->fftBackground.r, ThemeMgr::mgr.currentTheme->fftBackground.g, ThemeMgr::mgr.currentTheme->fftBackground.b); + glVertex2f(-1, -0.5); + glVertex2f(1, -0.5); + glEnd(); + + glDisable(GL_TEXTURE_2D); glColor3f(ThemeMgr::mgr.currentTheme->fftLine.r, ThemeMgr::mgr.currentTheme->fftLine.g, ThemeMgr::mgr.currentTheme->fftLine.b); @@ -75,6 +85,7 @@ void SpectrumContext::Draw(std::vector &points, long long freq, int bandw glVertex2f(m, 1); glEnd(); + glColor4f(ThemeMgr::mgr.currentTheme->text.r, ThemeMgr::mgr.currentTheme->text.g, ThemeMgr::mgr.currentTheme->text.b,1.0); getFont(PrimaryGLContext::GLFONT_SIZE12).drawString(label.str(), m, hPos, 12, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER); label.str(std::string()); diff --git a/src/visual/TuningContext.cpp b/src/visual/TuningContext.cpp index 8123b68..74bcba5 100644 --- a/src/visual/TuningContext.cpp +++ b/src/visual/TuningContext.cpp @@ -28,6 +28,7 @@ TuningContext::TuningContext(TuningCanvas *canvas, wxGLContext *sharedContext) : } void TuningContext::DrawBegin() { + glClearColor(ThemeMgr::mgr.currentTheme->generalBackground.r, ThemeMgr::mgr.currentTheme->generalBackground.g, ThemeMgr::mgr.currentTheme->generalBackground.b, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); diff --git a/src/visual/WaterfallCanvas.cpp b/src/visual/WaterfallCanvas.cpp index 8558a1d..88879c7 100644 --- a/src/visual/WaterfallCanvas.cpp +++ b/src/visual/WaterfallCanvas.cpp @@ -95,7 +95,7 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { glContext->SetCurrent(*this); glViewport(0, 0, ClientSize.x, ClientSize.y); - glContext->BeginDraw(); + glContext->BeginDraw(0,0,0); glContext->Draw(spectrum_points); std::vector &demods = wxGetApp().getDemodMgr().getDemodulators();