mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-09-16 21:47:51 -04:00
Move waterfall color themes to general theme classes, convert hard-coded colors
This commit is contained in:
parent
1afcd9ff3b
commit
4213b47c99
@ -136,6 +136,7 @@ SET (cubicsdr_sources
|
|||||||
src/util/MouseTracker.cpp
|
src/util/MouseTracker.cpp
|
||||||
src/util/GLFont.cpp
|
src/util/GLFont.cpp
|
||||||
src/util/DataTree.cpp
|
src/util/DataTree.cpp
|
||||||
|
src/visual/ColorTheme.cpp
|
||||||
src/visual/PrimaryGLContext.cpp
|
src/visual/PrimaryGLContext.cpp
|
||||||
src/visual/InteractiveCanvas.cpp
|
src/visual/InteractiveCanvas.cpp
|
||||||
src/visual/MeterCanvas.cpp
|
src/visual/MeterCanvas.cpp
|
||||||
@ -177,6 +178,7 @@ SET (cubicsdr_headers
|
|||||||
src/util/MouseTracker.h
|
src/util/MouseTracker.h
|
||||||
src/util/GLFont.h
|
src/util/GLFont.h
|
||||||
src/util/DataTree.h
|
src/util/DataTree.h
|
||||||
|
src/visual/ColorTheme.h
|
||||||
src/visual/PrimaryGLContext.h
|
src/visual/PrimaryGLContext.h
|
||||||
src/visual/InteractiveCanvas.h
|
src/visual/InteractiveCanvas.h
|
||||||
src/visual/MeterCanvas.h
|
src/visual/MeterCanvas.h
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "AudioThread.h"
|
#include "AudioThread.h"
|
||||||
#include "CubicSDR.h"
|
#include "CubicSDR.h"
|
||||||
#include "DataTree.h"
|
#include "DataTree.h"
|
||||||
|
#include "ColorTheme.h"
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
@ -67,19 +68,19 @@ AppFrame::AppFrame() :
|
|||||||
|
|
||||||
demodTray->Add(demodVisuals, 30, wxEXPAND | wxALL, 0);
|
demodTray->Add(demodVisuals, 30, wxEXPAND | wxALL, 0);
|
||||||
|
|
||||||
demodTray->AddSpacer(2);
|
demodTray->AddSpacer(1);
|
||||||
|
|
||||||
demodSignalMeter = new MeterCanvas(this, NULL);
|
demodSignalMeter = new MeterCanvas(this, NULL);
|
||||||
demodSignalMeter->setMax(0.5);
|
demodSignalMeter->setMax(0.5);
|
||||||
demodSignalMeter->setHelpTip("Current Signal Level. Click / Drag to set Squelch level.");
|
demodSignalMeter->setHelpTip("Current Signal Level. Click / Drag to set Squelch level.");
|
||||||
demodTray->Add(demodSignalMeter, 1, wxEXPAND | wxALL, 0);
|
demodTray->Add(demodSignalMeter, 1, wxEXPAND | wxALL, 0);
|
||||||
|
|
||||||
demodTray->AddSpacer(2);
|
demodTray->AddSpacer(1);
|
||||||
|
|
||||||
scopeCanvas = new ScopeCanvas(this, NULL);
|
scopeCanvas = new ScopeCanvas(this, NULL);
|
||||||
demodScopeTray->Add(scopeCanvas, 8, wxEXPAND | wxALL, 0);
|
demodScopeTray->Add(scopeCanvas, 8, wxEXPAND | wxALL, 0);
|
||||||
|
|
||||||
demodScopeTray->AddSpacer(2);
|
demodScopeTray->AddSpacer(1);
|
||||||
|
|
||||||
demodTuner = new TuningCanvas(this, NULL);
|
demodTuner = new TuningCanvas(this, NULL);
|
||||||
demodTuner->setHelpTip("Testing tuner");
|
demodTuner->setHelpTip("Testing tuner");
|
||||||
@ -87,7 +88,7 @@ AppFrame::AppFrame() :
|
|||||||
|
|
||||||
demodTray->Add(demodScopeTray, 30, wxEXPAND | wxALL, 0);
|
demodTray->Add(demodScopeTray, 30, wxEXPAND | wxALL, 0);
|
||||||
|
|
||||||
demodTray->AddSpacer(2);
|
demodTray->AddSpacer(1);
|
||||||
|
|
||||||
demodGainMeter = new MeterCanvas(this, NULL);
|
demodGainMeter = new MeterCanvas(this, NULL);
|
||||||
demodGainMeter->setMax(2.0);
|
demodGainMeter->setMax(2.0);
|
||||||
@ -95,11 +96,11 @@ AppFrame::AppFrame() :
|
|||||||
demodTray->Add(demodGainMeter, 1, wxEXPAND | wxALL, 0);
|
demodTray->Add(demodGainMeter, 1, wxEXPAND | wxALL, 0);
|
||||||
|
|
||||||
vbox->Add(demodTray, 12, wxEXPAND | wxALL, 0);
|
vbox->Add(demodTray, 12, wxEXPAND | wxALL, 0);
|
||||||
vbox->AddSpacer(2);
|
vbox->AddSpacer(1);
|
||||||
spectrumCanvas = new SpectrumCanvas(this, NULL);
|
spectrumCanvas = new SpectrumCanvas(this, NULL);
|
||||||
spectrumCanvas->setup(2048);
|
spectrumCanvas->setup(2048);
|
||||||
vbox->Add(spectrumCanvas, 5, wxEXPAND | wxALL, 0);
|
vbox->Add(spectrumCanvas, 5, wxEXPAND | wxALL, 0);
|
||||||
vbox->AddSpacer(2);
|
vbox->AddSpacer(1);
|
||||||
waterfallCanvas = new WaterfallCanvas(this, NULL);
|
waterfallCanvas = new WaterfallCanvas(this, NULL);
|
||||||
waterfallCanvas->setup(2048, 512);
|
waterfallCanvas->setup(2048, 512);
|
||||||
waterfallCanvas->attachSpectrumCanvas(spectrumCanvas);
|
waterfallCanvas->attachSpectrumCanvas(spectrumCanvas);
|
||||||
@ -283,26 +284,19 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
|
|||||||
} else if (event.GetId() == wxID_EXIT) {
|
} else if (event.GetId() == wxID_EXIT) {
|
||||||
Close(false);
|
Close(false);
|
||||||
} else if (event.GetId() == wxID_THEME_DEFAULT) {
|
} else if (event.GetId() == wxID_THEME_DEFAULT) {
|
||||||
waterfallCanvas->setTheme(COLOR_THEME_DEFAULT);
|
ThemeMgr::mgr.setTheme(COLOR_THEME_DEFAULT);
|
||||||
demodWaterfallCanvas->setTheme(COLOR_THEME_DEFAULT);
|
|
||||||
} else if (event.GetId() == wxID_THEME_SHARP) {
|
} else if (event.GetId() == wxID_THEME_SHARP) {
|
||||||
waterfallCanvas->setTheme(COLOR_THEME_SHARP);
|
ThemeMgr::mgr.setTheme(COLOR_THEME_SHARP);
|
||||||
demodWaterfallCanvas->setTheme(COLOR_THEME_SHARP);
|
|
||||||
} else if (event.GetId() == wxID_THEME_BW) {
|
} else if (event.GetId() == wxID_THEME_BW) {
|
||||||
waterfallCanvas->setTheme(COLOR_THEME_BW);
|
ThemeMgr::mgr.setTheme(COLOR_THEME_BW);
|
||||||
demodWaterfallCanvas->setTheme(COLOR_THEME_BW);
|
|
||||||
} else if (event.GetId() == wxID_THEME_RAD) {
|
} else if (event.GetId() == wxID_THEME_RAD) {
|
||||||
waterfallCanvas->setTheme(COLOR_THEME_RAD);
|
ThemeMgr::mgr.setTheme(COLOR_THEME_RAD);
|
||||||
demodWaterfallCanvas->setTheme(COLOR_THEME_RAD);
|
|
||||||
} else if (event.GetId() == wxID_THEME_TOUCH) {
|
} else if (event.GetId() == wxID_THEME_TOUCH) {
|
||||||
waterfallCanvas->setTheme(COLOR_THEME_TOUCH);
|
ThemeMgr::mgr.setTheme(COLOR_THEME_TOUCH);
|
||||||
demodWaterfallCanvas->setTheme(COLOR_THEME_TOUCH);
|
|
||||||
} else if (event.GetId() == wxID_THEME_HD) {
|
} else if (event.GetId() == wxID_THEME_HD) {
|
||||||
waterfallCanvas->setTheme(COLOR_THEME_HD);
|
ThemeMgr::mgr.setTheme(COLOR_THEME_HD);
|
||||||
demodWaterfallCanvas->setTheme(COLOR_THEME_HD);
|
|
||||||
} else if (event.GetId() == wxID_THEME_RADAR) {
|
} else if (event.GetId() == wxID_THEME_RADAR) {
|
||||||
waterfallCanvas->setTheme(COLOR_THEME_RADAR);
|
ThemeMgr::mgr.setTheme(COLOR_THEME_RADAR);
|
||||||
demodWaterfallCanvas->setTheme(COLOR_THEME_RADAR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (event.GetId()) {
|
switch (event.GetId()) {
|
||||||
|
@ -126,14 +126,14 @@ bool DemodulatorInstance::isTerminated() {
|
|||||||
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_AUDIO_TERMINATED:
|
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_AUDIO_TERMINATED:
|
||||||
t_Audio->join();
|
t_Audio->join();
|
||||||
audioTerminated = true;
|
audioTerminated = true;
|
||||||
delete t_Audio;
|
// delete t_Audio;
|
||||||
break;
|
break;
|
||||||
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED:
|
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED:
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
pthread_join(t_Demod, NULL);
|
pthread_join(t_Demod, NULL);
|
||||||
#else
|
#else
|
||||||
t_Demod->join();
|
t_Demod->join();
|
||||||
delete t_Demod;
|
// delete t_Demod;
|
||||||
#endif
|
#endif
|
||||||
demodTerminated = true;
|
demodTerminated = true;
|
||||||
break;
|
break;
|
||||||
@ -142,7 +142,7 @@ bool DemodulatorInstance::isTerminated() {
|
|||||||
pthread_join(t_PreDemod, NULL);
|
pthread_join(t_PreDemod, NULL);
|
||||||
#else
|
#else
|
||||||
t_PreDemod->join();
|
t_PreDemod->join();
|
||||||
delete t_PreDemod;
|
// delete t_PreDemod;
|
||||||
#endif
|
#endif
|
||||||
preDemodTerminated = true;
|
preDemodTerminated = true;
|
||||||
break;
|
break;
|
||||||
|
@ -212,14 +212,15 @@ void SDRThread::threadMain() {
|
|||||||
rtlsdr_reset_buffer(dev);
|
rtlsdr_reset_buffer(dev);
|
||||||
}
|
}
|
||||||
if (offset_changed && !freq_changed) {
|
if (offset_changed && !freq_changed) {
|
||||||
new_freq = frequency;
|
|
||||||
freq_changed = true;
|
freq_changed = true;
|
||||||
|
new_freq = frequency;
|
||||||
offset = new_offset;
|
offset = new_offset;
|
||||||
}
|
}
|
||||||
if (rate_changed) {
|
if (rate_changed) {
|
||||||
sampleRate = new_rate;
|
sampleRate = new_rate;
|
||||||
rtlsdr_set_sample_rate(dev, new_rate);
|
rtlsdr_set_sample_rate(dev, new_rate);
|
||||||
} else if (freq_changed) {
|
}
|
||||||
|
if (freq_changed) {
|
||||||
frequency = new_freq;
|
frequency = new_freq;
|
||||||
rtlsdr_set_center_freq(dev, frequency - offset);
|
rtlsdr_set_center_freq(dev, frequency - offset);
|
||||||
}
|
}
|
||||||
|
212
src/visual/ColorTheme.cpp
Normal file
212
src/visual/ColorTheme.cpp
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
#include "ColorTheme.h"
|
||||||
|
#include "CubicSDR.h"
|
||||||
|
#include "CubicSDRDefs.h"
|
||||||
|
|
||||||
|
ThemeMgr ThemeMgr::mgr;
|
||||||
|
|
||||||
|
void ThemeMgr::setTheme(int themeId) {
|
||||||
|
currentTheme = themes[themeId];
|
||||||
|
this->themeId = themeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ThemeMgr::getTheme() {
|
||||||
|
return themeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
ThemeMgr::ThemeMgr() {
|
||||||
|
themes[COLOR_THEME_DEFAULT] = new DefaultColorTheme;
|
||||||
|
themes[COLOR_THEME_BW] = new BlackAndWhiteColorTheme;
|
||||||
|
themes[COLOR_THEME_SHARP] = new SharpColorTheme;
|
||||||
|
themes[COLOR_THEME_RAD] = new RadColorTheme;
|
||||||
|
themes[COLOR_THEME_TOUCH] = new TouchColorTheme;
|
||||||
|
themes[COLOR_THEME_HD] = new HDColorTheme;
|
||||||
|
themes[COLOR_THEME_RADAR] = new RadarColorTheme;
|
||||||
|
|
||||||
|
currentTheme = themes[COLOR_THEME_DEFAULT];
|
||||||
|
themeId = COLOR_THEME_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
ThemeMgr::~ThemeMgr() {
|
||||||
|
std::map<int, ColorTheme *>::iterator i;
|
||||||
|
for (i = themes.begin(); i != themes.end(); i++) {
|
||||||
|
delete i->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DefaultColorTheme::DefaultColorTheme() {
|
||||||
|
name = "Default";
|
||||||
|
waterfallGradient.addColor(GradientColor(0, 0, 0));
|
||||||
|
waterfallGradient.addColor(GradientColor(0, 0, 1.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(0, 1.0, 0));
|
||||||
|
waterfallGradient.addColor(GradientColor(1.0, 1.0, 0));
|
||||||
|
waterfallGradient.addColor(GradientColor(1.0, 0.2, 0.0));
|
||||||
|
waterfallGradient.generate(256);
|
||||||
|
waterfallHighlight = RGBColor(1, 1, 1);
|
||||||
|
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);
|
||||||
|
scopeLine = RGBColor(0.9, 0.9, 0.9);
|
||||||
|
tuningBar = RGBColor(0.2, 0.2, 0.9);
|
||||||
|
meterLevel = RGBColor(0.1, 0.75, 0.1);
|
||||||
|
meterValue = RGBColor(0.75, 0.1, 0.1);
|
||||||
|
text = RGBColor(1, 1, 1);
|
||||||
|
freqLine = RGBColor(1, 1, 1);
|
||||||
|
button = RGBColor(0.65, 0.65, 0.65);
|
||||||
|
buttonHighlight = RGBColor(1, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
BlackAndWhiteColorTheme::BlackAndWhiteColorTheme() {
|
||||||
|
name = "Black & White";
|
||||||
|
waterfallGradient.addColor(GradientColor(0, 0, 0));
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
freqLine = RGBColor(1, 1, 1);
|
||||||
|
button = RGBColor(0.65, 0.65, 0.65);
|
||||||
|
buttonHighlight = RGBColor(1, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
SharpColorTheme::SharpColorTheme() {
|
||||||
|
name = "Sharp";
|
||||||
|
waterfallGradient.addColor(GradientColor(0, 0, 0));
|
||||||
|
waterfallGradient.addColor(GradientColor(0.0, 0, 0.5));
|
||||||
|
waterfallGradient.addColor(GradientColor(0.0, 0.0, 1.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(65.0 / 255.0, 161.0 / 255.0, 1.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(1.0, 1.0, 1.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(1.0, 1.0, 1.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(1.0, 1.0, 0.5));
|
||||||
|
waterfallGradient.addColor(GradientColor(1.0, 1.0, 0.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(1.0, 0.5, 0.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(1.0, 0.25, 0.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(0.5, 0.1, 0.0));
|
||||||
|
waterfallGradient.generate(256);
|
||||||
|
waterfallHighlight = RGBColor(1, 1, 1);
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
freqLine = RGBColor(1, 1, 1);
|
||||||
|
button = RGBColor(0.65, 0.65, 0.65);
|
||||||
|
buttonHighlight = RGBColor(1, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
RadColorTheme::RadColorTheme() {
|
||||||
|
name = "Rad";
|
||||||
|
waterfallGradient.addColor(GradientColor(0, 0, 0.5));
|
||||||
|
waterfallGradient.addColor(GradientColor(25.0 / 255.0, 154.0 / 255.0, 0.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(201.0 / 255.0, 115.0 / 255.0, 0.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(1.0, 40.0 / 255.0, 40.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(1.0, 1.0, 1.0));
|
||||||
|
waterfallGradient.generate(256);
|
||||||
|
waterfallHighlight = RGBColor(1, 1, 1);
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
freqLine = RGBColor(1, 1, 1);
|
||||||
|
button = RGBColor(0.65, 0.65, 0.65);
|
||||||
|
buttonHighlight = RGBColor(1, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TouchColorTheme::TouchColorTheme() {
|
||||||
|
name = "Touch";
|
||||||
|
waterfallGradient.addColor(GradientColor(0, 0, 0));
|
||||||
|
waterfallGradient.addColor(GradientColor(55.0 / 255.0, 40.0 / 255.0, 55.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(60.0 / 255.0, 60.0 / 255.0, 90.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(10.0 / 255.0, 255.0 / 255.0, 85.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(255.0 / 255.0, 255.0 / 255.0, 75.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(255.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0));
|
||||||
|
waterfallGradient.generate(256);
|
||||||
|
waterfallHighlight = RGBColor(1, 1, 1);
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
freqLine = RGBColor(1, 1, 1);
|
||||||
|
button = RGBColor(0.65, 0.65, 0.65);
|
||||||
|
buttonHighlight = RGBColor(1, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
HDColorTheme::HDColorTheme() {
|
||||||
|
name = "HD";
|
||||||
|
waterfallGradient.addColor(GradientColor(5.0 / 255.0, 5.0 / 255.0, 60.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(5.0 / 255.0, 20.0 / 255.0, 120.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(50.0 / 255.0, 100.0 / 255.0, 200.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(75.0 / 255.0, 190.0 / 255.0, 100.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(240.0 / 255.0, 55.0 / 255.0, 5.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(255.0 / 255.0, 55.0 / 255.0, 100.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(255.0 / 255.0, 235.0 / 255.0, 100.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(250.0 / 255.0, 250.0 / 255.0, 250.0 / 255.0));
|
||||||
|
waterfallGradient.generate(256);
|
||||||
|
waterfallHighlight = RGBColor(1, 1, 1);
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
freqLine = RGBColor(1, 1, 1);
|
||||||
|
button = RGBColor(0.65, 0.65, 0.65);
|
||||||
|
buttonHighlight = RGBColor(1, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
RadarColorTheme::RadarColorTheme() {
|
||||||
|
name = "Rad";
|
||||||
|
waterfallGradient.addColor(GradientColor(5.0 / 255.0, 45.0 / 255.0, 10.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(30.0 / 255.0, 150.0 / 255.0, 40.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(40.0 / 255.0, 240.0 / 255.0, 60.0 / 255.0));
|
||||||
|
waterfallGradient.addColor(GradientColor(250.0 / 255.0, 250.0 / 255.0, 250.0 / 255.0));
|
||||||
|
waterfallGradient.generate(256);
|
||||||
|
waterfallHighlight = RGBColor(1, 1, 1);
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
freqLine = RGBColor(1, 1, 1);
|
||||||
|
button = RGBColor(0.65, 0.65, 0.65);
|
||||||
|
buttonHighlight = RGBColor(1, 1, 0);
|
||||||
|
}
|
||||||
|
|
110
src/visual/ColorTheme.h
Normal file
110
src/visual/ColorTheme.h
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Gradient.h"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#define COLOR_THEME_DEFAULT 0
|
||||||
|
#define COLOR_THEME_BW 1
|
||||||
|
#define COLOR_THEME_SHARP 2
|
||||||
|
#define COLOR_THEME_RAD 3
|
||||||
|
#define COLOR_THEME_TOUCH 4
|
||||||
|
#define COLOR_THEME_HD 5
|
||||||
|
#define COLOR_THEME_RADAR 6
|
||||||
|
#define COLOR_THEME_MAX 7
|
||||||
|
|
||||||
|
class RGBColor {
|
||||||
|
public:
|
||||||
|
float r, g, b;
|
||||||
|
RGBColor(float r, float g, float b) :
|
||||||
|
r(r), g(g), b(b) {
|
||||||
|
}
|
||||||
|
|
||||||
|
RGBColor() :
|
||||||
|
RGBColor(0, 0, 0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
~RGBColor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
RGBColor & operator=(const RGBColor &other) {
|
||||||
|
r = other.r;
|
||||||
|
g = other.g;
|
||||||
|
b = other.b;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class ColorTheme {
|
||||||
|
public:
|
||||||
|
RGBColor waterfallHighlight;
|
||||||
|
RGBColor waterfallNew;
|
||||||
|
RGBColor wfHighlight;
|
||||||
|
RGBColor waterfallHover;
|
||||||
|
RGBColor waterfallDestroy;
|
||||||
|
RGBColor fftLine;
|
||||||
|
RGBColor fftHighlight;
|
||||||
|
RGBColor scopeLine;
|
||||||
|
RGBColor tuningBar;
|
||||||
|
RGBColor meterLevel;
|
||||||
|
RGBColor meterValue;
|
||||||
|
RGBColor text;
|
||||||
|
RGBColor freqLine;
|
||||||
|
RGBColor button;
|
||||||
|
RGBColor buttonHighlight;
|
||||||
|
|
||||||
|
Gradient waterfallGradient;
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ThemeMgr {
|
||||||
|
public:
|
||||||
|
ThemeMgr();
|
||||||
|
~ThemeMgr();
|
||||||
|
ColorTheme *currentTheme;
|
||||||
|
std::map<int, ColorTheme *> themes;
|
||||||
|
void setTheme(int themeId);
|
||||||
|
int getTheme();
|
||||||
|
int themeId;
|
||||||
|
|
||||||
|
static ThemeMgr mgr;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DefaultColorTheme: public ColorTheme {
|
||||||
|
public:
|
||||||
|
DefaultColorTheme();
|
||||||
|
};
|
||||||
|
|
||||||
|
class BlackAndWhiteColorTheme: public ColorTheme {
|
||||||
|
public:
|
||||||
|
BlackAndWhiteColorTheme();
|
||||||
|
};
|
||||||
|
|
||||||
|
class SharpColorTheme: public ColorTheme {
|
||||||
|
public:
|
||||||
|
SharpColorTheme();
|
||||||
|
};
|
||||||
|
|
||||||
|
class RadColorTheme: public ColorTheme {
|
||||||
|
public:
|
||||||
|
RadColorTheme();
|
||||||
|
};
|
||||||
|
|
||||||
|
class TouchColorTheme: public ColorTheme {
|
||||||
|
public:
|
||||||
|
TouchColorTheme();
|
||||||
|
};
|
||||||
|
|
||||||
|
class HDColorTheme: public ColorTheme {
|
||||||
|
public:
|
||||||
|
HDColorTheme();
|
||||||
|
};
|
||||||
|
|
||||||
|
class RadarColorTheme: public ColorTheme {
|
||||||
|
public:
|
||||||
|
RadarColorTheme();
|
||||||
|
};
|
||||||
|
|
@ -69,11 +69,8 @@ void MeterCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
|||||||
if (mouseTracker.mouseInView()) {
|
if (mouseTracker.mouseInView()) {
|
||||||
glContext->Draw(0.4, 0.4, 0.4, 0.5, mouseTracker.getMouseY());
|
glContext->Draw(0.4, 0.4, 0.4, 0.5, mouseTracker.getMouseY());
|
||||||
}
|
}
|
||||||
|
glContext->Draw(ThemeMgr::mgr.currentTheme->meterLevel.r, ThemeMgr::mgr.currentTheme->meterLevel.g, ThemeMgr::mgr.currentTheme->meterLevel.b, 0.5, level / level_max);
|
||||||
glContext->Draw(0.1, 0.75, 0.1, 0.5, level / level_max);
|
glContext->Draw(ThemeMgr::mgr.currentTheme->meterValue.r, ThemeMgr::mgr.currentTheme->meterValue.g, ThemeMgr::mgr.currentTheme->meterValue.b, 0.5, userInputValue / level_max);
|
||||||
|
|
||||||
glContext->Draw(0.75, 0.1, 0.1, 0.5, userInputValue / level_max);
|
|
||||||
|
|
||||||
glContext->DrawEnd();
|
glContext->DrawEnd();
|
||||||
|
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
|
@ -64,7 +64,11 @@ void ModeSelectorCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
|||||||
int yval = getHoveredSelection();
|
int yval = getHoveredSelection();
|
||||||
|
|
||||||
for (int i = 0; i < numChoices; i++) {
|
for (int i = 0; i < numChoices; i++) {
|
||||||
glContext->DrawSelector(selections[i].label, i, numChoices, i == currentSelection || yval == i, (yval == i)?0.9:0.75, (yval == i)?0.9:0.75, (yval == i)?0.2:0.75, 1.0);
|
if (yval == i) {
|
||||||
|
glContext->DrawSelector(selections[i].label, i, numChoices, true, ThemeMgr::mgr.currentTheme->buttonHighlight.r, ThemeMgr::mgr.currentTheme->buttonHighlight.g, ThemeMgr::mgr.currentTheme->buttonHighlight.b, 1.0);
|
||||||
|
} else {
|
||||||
|
glContext->DrawSelector(selections[i].label, i, numChoices, i == currentSelection, ThemeMgr::mgr.currentTheme->button.r, ThemeMgr::mgr.currentTheme->button.g, ThemeMgr::mgr.currentTheme->button.b, 1.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glContext->DrawEnd();
|
glContext->DrawEnd();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "ScopeContext.h"
|
#include "ScopeContext.h"
|
||||||
|
|
||||||
#include "ScopeCanvas.h"
|
#include "ScopeCanvas.h"
|
||||||
|
#include "ColorTheme.h"
|
||||||
|
|
||||||
ScopeContext::ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext) :
|
ScopeContext::ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext) :
|
||||||
PrimaryGLContext(canvas, sharedContext) {
|
PrimaryGLContext(canvas, sharedContext) {
|
||||||
@ -24,7 +25,7 @@ void ScopeContext::Plot(std::vector<float> &points, bool stereo) {
|
|||||||
glColor3f(1.0, 1.0, 1.0);
|
glColor3f(1.0, 1.0, 1.0);
|
||||||
|
|
||||||
if (stereo) {
|
if (stereo) {
|
||||||
glColor3f(0.7, 0.7, 0.7);
|
glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r, ThemeMgr::mgr.currentTheme->scopeLine.g, ThemeMgr::mgr.currentTheme->scopeLine.b);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glVertex2f(-1.0, 0.0);
|
glVertex2f(-1.0, 0.0);
|
||||||
glVertex2f(1.0, 0.0);
|
glVertex2f(1.0, 0.0);
|
||||||
@ -44,7 +45,7 @@ void ScopeContext::Plot(std::vector<float> &points, bool stereo) {
|
|||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
glColor3f(0.9, 0.9, 0.9);
|
glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r, ThemeMgr::mgr.currentTheme->scopeLine.g, ThemeMgr::mgr.currentTheme->scopeLine.b);
|
||||||
if (points.size()) {
|
if (points.size()) {
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
glVertexPointer(2, GL_FLOAT, 0, &points[0]);
|
glVertexPointer(2, GL_FLOAT, 0, &points[0]);
|
||||||
|
@ -78,7 +78,7 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
|||||||
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
|
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
|
||||||
|
|
||||||
for (int i = 0, iMax = demods.size(); i < iMax; i++) {
|
for (int i = 0, iMax = demods.size(); i < iMax; i++) {
|
||||||
glContext->DrawDemodInfo(demods[i], 1, 1, 1, getCenterFrequency(), getBandwidth());
|
glContext->DrawDemodInfo(demods[i], ThemeMgr::mgr.currentTheme->fftHighlight.r, ThemeMgr::mgr.currentTheme->fftHighlight.g, ThemeMgr::mgr.currentTheme->fftHighlight.b, getCenterFrequency(), getBandwidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
glContext->EndDraw();
|
glContext->EndDraw();
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "CubicSDR.h"
|
#include "CubicSDR.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include "ColorTheme.h"
|
||||||
|
|
||||||
SpectrumContext::SpectrumContext(SpectrumCanvas *canvas, wxGLContext *sharedContext) :
|
SpectrumContext::SpectrumContext(SpectrumCanvas *canvas, wxGLContext *sharedContext) :
|
||||||
PrimaryGLContext(canvas, sharedContext), fft_size(0) {
|
PrimaryGLContext(canvas, sharedContext), fft_size(0) {
|
||||||
@ -18,7 +19,7 @@ SpectrumContext::SpectrumContext(SpectrumCanvas *canvas, wxGLContext *sharedCont
|
|||||||
void SpectrumContext::Draw(std::vector<float> &points, long long freq, int bandwidth) {
|
void SpectrumContext::Draw(std::vector<float> &points, long long freq, int bandwidth) {
|
||||||
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
glColor3f(1.0, 1.0, 1.0);
|
glColor3f(ThemeMgr::mgr.currentTheme->fftLine.r, ThemeMgr::mgr.currentTheme->fftLine.g, ThemeMgr::mgr.currentTheme->fftLine.b);
|
||||||
|
|
||||||
if (points.size()) {
|
if (points.size()) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
@ -41,8 +42,8 @@ void SpectrumContext::Draw(std::vector<float> &points, long long freq, int bandw
|
|||||||
long long rightFreq = leftFreq + (float) bandwidth;
|
long long rightFreq = leftFreq + (float) bandwidth;
|
||||||
|
|
||||||
long long firstMhz = (leftFreq / 1000000) * 1000000;
|
long long firstMhz = (leftFreq / 1000000) * 1000000;
|
||||||
long double mhzStart = ((long double)(firstMhz - leftFreq) / (long double)(rightFreq - leftFreq)) * 2.0;
|
long double mhzStart = ((long double) (firstMhz - leftFreq) / (long double) (rightFreq - leftFreq)) * 2.0;
|
||||||
long double mhzStep = (100000.0 / (long double)(rightFreq - leftFreq)) * 2.0;
|
long double mhzStep = (100000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
||||||
|
|
||||||
long double currentMhz = trunc(floor(firstMhz / 1000000.0));
|
long double currentMhz = trunc(floor(firstMhz / 1000000.0));
|
||||||
|
|
||||||
@ -61,10 +62,11 @@ void SpectrumContext::Draw(std::vector<float> &points, long long freq, int bandw
|
|||||||
|
|
||||||
if (fractpart < 0.001) {
|
if (fractpart < 0.001) {
|
||||||
glLineWidth(4.0);
|
glLineWidth(4.0);
|
||||||
glColor3f(1.0, 1.0, 1.0);
|
glColor3f(ThemeMgr::mgr.currentTheme->freqLine.r, ThemeMgr::mgr.currentTheme->freqLine.g, ThemeMgr::mgr.currentTheme->freqLine.b);
|
||||||
} else {
|
} else {
|
||||||
glLineWidth(1.0);
|
glLineWidth(1.0);
|
||||||
glColor3f(0.55, 0.55, 0.55);
|
glColor3f(ThemeMgr::mgr.currentTheme->freqLine.r * 0.65, ThemeMgr::mgr.currentTheme->freqLine.g * 0.65,
|
||||||
|
ThemeMgr::mgr.currentTheme->freqLine.b * 0.65);
|
||||||
}
|
}
|
||||||
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
@ -25,7 +25,7 @@ EVT_ENTER_WINDOW(TuningCanvas::OnMouseEnterWindow)
|
|||||||
wxEND_EVENT_TABLE()
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
TuningCanvas::TuningCanvas(wxWindow *parent, int *attribList) :
|
TuningCanvas::TuningCanvas(wxWindow *parent, int *attribList) :
|
||||||
InteractiveCanvas(parent, attribList), dragAccum(0) {
|
InteractiveCanvas(parent, attribList), dragAccum(0) {
|
||||||
|
|
||||||
glContext = new TuningContext(this, &wxGetApp().GetContext(this));
|
glContext = new TuningContext(this, &wxGetApp().GetContext(this));
|
||||||
}
|
}
|
||||||
@ -52,7 +52,8 @@ void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mouseTracker.mouseDown()) {
|
if (mouseTracker.mouseDown()) {
|
||||||
glContext->Draw(0.2, 0.2, 0.9, 0.6, mouseTracker.getOriginMouseX(), mouseTracker.getMouseX());
|
glContext->Draw(ThemeMgr::mgr.currentTheme->tuningBar.r, ThemeMgr::mgr.currentTheme->tuningBar.g, ThemeMgr::mgr.currentTheme->tuningBar.b,
|
||||||
|
0.6, mouseTracker.getOriginMouseX(), mouseTracker.getMouseX());
|
||||||
}
|
}
|
||||||
|
|
||||||
glContext->DrawEnd();
|
glContext->DrawEnd();
|
||||||
@ -64,23 +65,28 @@ void TuningCanvas::OnIdle(wxIdleEvent &event) {
|
|||||||
if (mouseTracker.mouseDown()) {
|
if (mouseTracker.mouseDown()) {
|
||||||
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||||
|
|
||||||
dragAccum += mouseTracker.getMouseX() - mouseTracker.getOriginMouseX();
|
float dragDelta = mouseTracker.getMouseX() - mouseTracker.getOriginMouseX();
|
||||||
|
|
||||||
|
dragAccum += dragDelta;
|
||||||
|
|
||||||
|
float moveVal = dragAccum * 10.0;
|
||||||
|
|
||||||
if (uxDown > 0.275) {
|
if (uxDown > 0.275) {
|
||||||
wxGetApp().setFrequency(wxGetApp().getFrequency() + (int) (mouseTracker.getOriginDeltaMouseX() * (float)wxGetApp().getSampleRate() * 15.0));
|
wxGetApp().setFrequency(
|
||||||
|
wxGetApp().getFrequency()
|
||||||
|
+ (int) (dragAccum * fabs(dragAccum * 10.0) * fabs(dragAccum * 10.0) * (float) wxGetApp().getSampleRate()));
|
||||||
|
} else if (fabs(moveVal) >= 1.0) {
|
||||||
|
if (uxDown < -0.275 && activeDemod != NULL) {
|
||||||
|
activeDemod->setFrequency(activeDemod->getFrequency() + (int) (moveVal * fabs(moveVal) * fabs(moveVal) * fabs(moveVal)));
|
||||||
|
} else if (activeDemod != NULL) {
|
||||||
|
activeDemod->setBandwidth(activeDemod->getBandwidth() + (int) (moveVal * fabs(moveVal) * fabs(moveVal) * fabs(moveVal)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abs(dragAccum * 10.0) >= 1) {
|
while (fabs(dragAccum * 10.0) >= 1.0) {
|
||||||
if (uxDown < -0.275 && activeDemod != NULL) {
|
if (dragAccum > 0) {
|
||||||
activeDemod->setFrequency(activeDemod->getFrequency() + (int) (dragAccum * 10.0));
|
|
||||||
} else if (activeDemod != NULL) {
|
|
||||||
activeDemod->setBandwidth(activeDemod->getBandwidth() + (int) (dragAccum * 10.0));
|
|
||||||
}
|
|
||||||
|
|
||||||
while (dragAccum * 10.0 >= 1.0) {
|
|
||||||
dragAccum -= 1.0 / 10.0;
|
dragAccum -= 1.0 / 10.0;
|
||||||
}
|
} else {
|
||||||
while (dragAccum * -10.0 <= -1.0) {
|
|
||||||
dragAccum += 1.0 / 10.0;
|
dragAccum += 1.0 / 10.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,7 +106,7 @@ void TuningCanvas::OnMouseDown(wxMouseEvent& event) {
|
|||||||
uxDown = 2.0 * (mouseTracker.getMouseX() - 0.5);
|
uxDown = 2.0 * (mouseTracker.getMouseX() - 0.5);
|
||||||
|
|
||||||
dragAccum = 0;
|
dragAccum = 0;
|
||||||
SetCursor (wxCURSOR_IBEAM);
|
SetCursor(wxCURSOR_IBEAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TuningCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
|
void TuningCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
|
||||||
@ -110,17 +116,17 @@ void TuningCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
|
|||||||
void TuningCanvas::OnMouseReleased(wxMouseEvent& event) {
|
void TuningCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::OnMouseReleased(event);
|
InteractiveCanvas::OnMouseReleased(event);
|
||||||
mouseTracker.setVertDragLock(false);
|
mouseTracker.setVertDragLock(false);
|
||||||
SetCursor (wxCURSOR_SIZEWE);
|
SetCursor(wxCURSOR_SIZEWE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TuningCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
void TuningCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::OnMouseLeftWindow(event);
|
InteractiveCanvas::OnMouseLeftWindow(event);
|
||||||
SetCursor (wxCURSOR_CROSS);
|
SetCursor(wxCURSOR_CROSS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TuningCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
void TuningCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::mouseTracker.OnMouseEnterWindow(event);
|
InteractiveCanvas::mouseTracker.OnMouseEnterWindow(event);
|
||||||
SetCursor (wxCURSOR_SIZEWE);
|
SetCursor(wxCURSOR_SIZEWE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TuningCanvas::setHelpTip(std::string tip) {
|
void TuningCanvas::setHelpTip(std::string tip) {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "TuningContext.h"
|
#include "TuningContext.h"
|
||||||
#include "TuningCanvas.h"
|
#include "TuningCanvas.h"
|
||||||
|
|
||||||
|
#include "ColorTheme.h"
|
||||||
|
|
||||||
// http://stackoverflow.com/questions/7276826/c-format-number-with-commas
|
// http://stackoverflow.com/questions/7276826/c-format-number-with-commas
|
||||||
class comma_numpunct: public std::numpunct<char> {
|
class comma_numpunct: public std::numpunct<char> {
|
||||||
protected:
|
protected:
|
||||||
@ -69,7 +71,7 @@ void TuningContext::DrawDemodFreqBw(long long freq, unsigned int bw, long long c
|
|||||||
fontHeight = 12;
|
fontHeight = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
glColor3f(0.85, 0.85, 0.85);
|
glColor3f(ThemeMgr::mgr.currentTheme->text.r, ThemeMgr::mgr.currentTheme->text.g, ThemeMgr::mgr.currentTheme->text.b);
|
||||||
|
|
||||||
getFont(fontSize).drawString("Freq: ", -0.75, 0, fontHeight, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
|
getFont(fontSize).drawString("Freq: ", -0.75, 0, fontHeight, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
|
||||||
if (bw) {
|
if (bw) {
|
||||||
|
@ -36,7 +36,7 @@ wxEND_EVENT_TABLE()
|
|||||||
WaterfallCanvas::WaterfallCanvas(wxWindow *parent, int *attribList) :
|
WaterfallCanvas::WaterfallCanvas(wxWindow *parent, int *attribList) :
|
||||||
InteractiveCanvas(parent, attribList), spectrumCanvas(NULL), dragState(WF_DRAG_NONE), nextDragState(WF_DRAG_NONE), fft_size(0), waterfall_lines(
|
InteractiveCanvas(parent, attribList), spectrumCanvas(NULL), dragState(WF_DRAG_NONE), nextDragState(WF_DRAG_NONE), fft_size(0), waterfall_lines(
|
||||||
0), plan(
|
0), plan(
|
||||||
NULL), in(NULL), out(NULL), resampler(NULL), resamplerRatio(0), lastInputBandwidth(0), zoom(1), mouseZoom(1), theme(0) {
|
NULL), in(NULL), out(NULL), resampler(NULL), resamplerRatio(0), lastInputBandwidth(0), zoom(1), mouseZoom(1) {
|
||||||
|
|
||||||
glContext = new WaterfallContext(this, &wxGetApp().GetContext(this));
|
glContext = new WaterfallContext(this, &wxGetApp().GetContext(this));
|
||||||
|
|
||||||
@ -95,11 +95,6 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
|||||||
glContext->SetCurrent(*this);
|
glContext->SetCurrent(*this);
|
||||||
glViewport(0, 0, ClientSize.x, ClientSize.y);
|
glViewport(0, 0, ClientSize.x, ClientSize.y);
|
||||||
|
|
||||||
if (theme != glContext->getTheme()) {
|
|
||||||
glContext->setTheme(theme);
|
|
||||||
theme = glContext->getTheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
glContext->BeginDraw();
|
glContext->BeginDraw();
|
||||||
glContext->Draw(spectrum_points);
|
glContext->Draw(spectrum_points);
|
||||||
|
|
||||||
@ -121,49 +116,49 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
|||||||
float centerPos = mouseTracker.getOriginMouseX() + width / 2.0;
|
float centerPos = mouseTracker.getOriginMouseX() + width / 2.0;
|
||||||
|
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
glContext->DrawDemod(lastActiveDemodulator, 1, 1, 1, currentCenterFreq, currentBandwidth);
|
glContext->DrawDemod(lastActiveDemodulator, ThemeMgr::mgr.currentTheme->waterfallHighlight.r, ThemeMgr::mgr.currentTheme->waterfallHighlight.g, ThemeMgr::mgr.currentTheme->waterfallHighlight.b, currentCenterFreq, currentBandwidth);
|
||||||
glContext->DrawFreqSelector(centerPos, 0, 1, 0, width ? width : (1.0 / (float) ClientSize.x), currentCenterFreq,
|
glContext->DrawFreqSelector(centerPos, ThemeMgr::mgr.currentTheme->waterfallNew.r, ThemeMgr::mgr.currentTheme->waterfallNew.g, ThemeMgr::mgr.currentTheme->waterfallNew.b, width ? width : (1.0 / (float) ClientSize.x), currentCenterFreq,
|
||||||
currentBandwidth);
|
currentBandwidth);
|
||||||
} else {
|
} else {
|
||||||
glContext->DrawDemod(lastActiveDemodulator, 1, 0, 0, currentCenterFreq, currentBandwidth);
|
glContext->DrawDemod(lastActiveDemodulator, ThemeMgr::mgr.currentTheme->waterfallDestroy.r, ThemeMgr::mgr.currentTheme->waterfallDestroy.g, ThemeMgr::mgr.currentTheme->waterfallDestroy.b, currentCenterFreq, currentBandwidth);
|
||||||
glContext->DrawFreqSelector(centerPos, 1, 1, 0, width ? width : (1.0 / (float) ClientSize.x), currentCenterFreq,
|
glContext->DrawFreqSelector(centerPos, ThemeMgr::mgr.currentTheme->waterfallHover.r, ThemeMgr::mgr.currentTheme->waterfallHover.g, ThemeMgr::mgr.currentTheme->waterfallHover.b, width ? width : (1.0 / (float) ClientSize.x), currentCenterFreq,
|
||||||
currentBandwidth);
|
currentBandwidth);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
glContext->DrawDemod(lastActiveDemodulator, 1, 1, 1, currentCenterFreq, currentBandwidth);
|
glContext->DrawDemod(lastActiveDemodulator, ThemeMgr::mgr.currentTheme->waterfallHighlight.r, ThemeMgr::mgr.currentTheme->waterfallHighlight.g, ThemeMgr::mgr.currentTheme->waterfallHighlight.b, currentCenterFreq, currentBandwidth);
|
||||||
glContext->DrawFreqSelector(mouseTracker.getMouseX(), 0, 1, 0, 1.0 / (float) ClientSize.x, currentCenterFreq, currentBandwidth);
|
glContext->DrawFreqSelector(mouseTracker.getMouseX(), ThemeMgr::mgr.currentTheme->waterfallNew.r, ThemeMgr::mgr.currentTheme->waterfallNew.g, ThemeMgr::mgr.currentTheme->waterfallNew.b, 1.0 / (float) ClientSize.x, currentCenterFreq, currentBandwidth);
|
||||||
} else {
|
} else {
|
||||||
glContext->DrawDemod(lastActiveDemodulator, 1, 0, 0, currentCenterFreq, currentBandwidth);
|
glContext->DrawDemod(lastActiveDemodulator,ThemeMgr::mgr.currentTheme->waterfallDestroy.r, ThemeMgr::mgr.currentTheme->waterfallDestroy.g, ThemeMgr::mgr.currentTheme->waterfallDestroy.b, currentCenterFreq, currentBandwidth);
|
||||||
glContext->DrawFreqSelector(mouseTracker.getMouseX(), 1, 1, 0, 1.0 / (float) ClientSize.x, currentCenterFreq, currentBandwidth);
|
glContext->DrawFreqSelector(mouseTracker.getMouseX(), ThemeMgr::mgr.currentTheme->waterfallHover.r, ThemeMgr::mgr.currentTheme->waterfallHover.g, ThemeMgr::mgr.currentTheme->waterfallHover.b, 1.0 / (float) ClientSize.x, currentCenterFreq, currentBandwidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (activeDemodulator == NULL) {
|
if (activeDemodulator == NULL) {
|
||||||
if (lastActiveDemodulator) {
|
if (lastActiveDemodulator) {
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
glContext->DrawDemod(lastActiveDemodulator, 1, 1, 1, currentCenterFreq, currentBandwidth);
|
glContext->DrawDemod(lastActiveDemodulator, ThemeMgr::mgr.currentTheme->waterfallHighlight.r, ThemeMgr::mgr.currentTheme->waterfallHighlight.g, ThemeMgr::mgr.currentTheme->waterfallHighlight.b, currentCenterFreq, currentBandwidth);
|
||||||
glContext->DrawFreqSelector(mouseTracker.getMouseX(), 0, 1, 0, 0, currentCenterFreq, currentBandwidth);
|
glContext->DrawFreqSelector(mouseTracker.getMouseX(), ThemeMgr::mgr.currentTheme->waterfallNew.r, ThemeMgr::mgr.currentTheme->waterfallNew.g, ThemeMgr::mgr.currentTheme->waterfallNew.b, 0, currentCenterFreq, currentBandwidth);
|
||||||
} else {
|
} else {
|
||||||
glContext->DrawDemod(lastActiveDemodulator, 1, 0, 0, currentCenterFreq, currentBandwidth);
|
glContext->DrawDemod(lastActiveDemodulator, ThemeMgr::mgr.currentTheme->waterfallDestroy.r, ThemeMgr::mgr.currentTheme->waterfallDestroy.g, ThemeMgr::mgr.currentTheme->waterfallDestroy.b, currentCenterFreq, currentBandwidth);
|
||||||
glContext->DrawFreqSelector(mouseTracker.getMouseX(), 1, 1, 0, 0, currentCenterFreq, currentBandwidth);
|
glContext->DrawFreqSelector(mouseTracker.getMouseX(), ThemeMgr::mgr.currentTheme->waterfallHover.r, ThemeMgr::mgr.currentTheme->waterfallHover.g, ThemeMgr::mgr.currentTheme->waterfallHover.b, 0, currentCenterFreq, currentBandwidth);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
glContext->DrawFreqSelector(mouseTracker.getMouseX(), 1, 1, 0, 0, currentCenterFreq, currentBandwidth);
|
glContext->DrawFreqSelector(mouseTracker.getMouseX(), ThemeMgr::mgr.currentTheme->waterfallNew.r, ThemeMgr::mgr.currentTheme->waterfallNew.g, ThemeMgr::mgr.currentTheme->waterfallNew.b, 0, currentCenterFreq, currentBandwidth);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (lastActiveDemodulator) {
|
if (lastActiveDemodulator) {
|
||||||
glContext->DrawDemod(lastActiveDemodulator, 1, 1, 1, currentCenterFreq, currentBandwidth);
|
glContext->DrawDemod(lastActiveDemodulator, ThemeMgr::mgr.currentTheme->waterfallHighlight.r, ThemeMgr::mgr.currentTheme->waterfallHighlight.g, ThemeMgr::mgr.currentTheme->waterfallHighlight.b, currentCenterFreq, currentBandwidth);
|
||||||
}
|
}
|
||||||
glContext->DrawDemod(activeDemodulator, 1, 1, 0, currentCenterFreq, currentBandwidth);
|
glContext->DrawDemod(activeDemodulator, ThemeMgr::mgr.currentTheme->waterfallHover.r, ThemeMgr::mgr.currentTheme->waterfallHover.g, ThemeMgr::mgr.currentTheme->waterfallHover.b, currentCenterFreq, currentBandwidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (activeDemodulator) {
|
if (activeDemodulator) {
|
||||||
glContext->DrawDemod(activeDemodulator, 1, 1, 1, currentCenterFreq, currentBandwidth);
|
glContext->DrawDemod(activeDemodulator, ThemeMgr::mgr.currentTheme->waterfallHighlight.r, ThemeMgr::mgr.currentTheme->waterfallHighlight.g, ThemeMgr::mgr.currentTheme->waterfallHighlight.b, currentCenterFreq, currentBandwidth);
|
||||||
}
|
}
|
||||||
if (lastActiveDemodulator) {
|
if (lastActiveDemodulator) {
|
||||||
glContext->DrawDemod(lastActiveDemodulator, 1, 1, 1, currentCenterFreq, currentBandwidth);
|
glContext->DrawDemod(lastActiveDemodulator, ThemeMgr::mgr.currentTheme->waterfallHighlight.r, ThemeMgr::mgr.currentTheme->waterfallHighlight.g, ThemeMgr::mgr.currentTheme->waterfallHighlight.b, currentCenterFreq, currentBandwidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +166,7 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
|||||||
if (activeDemodulator == demods[i] || lastActiveDemodulator == demods[i]) {
|
if (activeDemodulator == demods[i] || lastActiveDemodulator == demods[i]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
glContext->DrawDemod(demods[i], 1, 1, 1, currentCenterFreq, currentBandwidth);
|
glContext->DrawDemod(demods[i], ThemeMgr::mgr.currentTheme->waterfallHighlight.r, ThemeMgr::mgr.currentTheme->waterfallHighlight.g, ThemeMgr::mgr.currentTheme->waterfallHighlight.b, currentCenterFreq, currentBandwidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
glContext->EndDraw();
|
glContext->EndDraw();
|
||||||
@ -829,11 +824,3 @@ void WaterfallCanvas::OnMouseRightReleased(wxMouseEvent& event) {
|
|||||||
mouseTracker.setHorizDragLock(false);
|
mouseTracker.setHorizDragLock(false);
|
||||||
mouseZoom = 1.0;
|
mouseZoom = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaterfallCanvas::setTheme(int theme_id) {
|
|
||||||
theme = theme_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
int WaterfallCanvas::getTheme() {
|
|
||||||
return glContext->getTheme();
|
|
||||||
}
|
|
||||||
|
@ -29,8 +29,6 @@ public:
|
|||||||
DragState getNextDragState();
|
DragState getNextDragState();
|
||||||
|
|
||||||
void attachSpectrumCanvas(SpectrumCanvas *canvas_in);
|
void attachSpectrumCanvas(SpectrumCanvas *canvas_in);
|
||||||
void setTheme(int theme_id);
|
|
||||||
int getTheme();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
@ -77,8 +75,6 @@ private:
|
|||||||
int lastInputBandwidth;
|
int lastInputBandwidth;
|
||||||
float mouseZoom, zoom;
|
float mouseZoom, zoom;
|
||||||
|
|
||||||
int theme;
|
|
||||||
|
|
||||||
std::vector<liquid_float_complex> shiftBuffer;
|
std::vector<liquid_float_complex> shiftBuffer;
|
||||||
std::vector<liquid_float_complex> resampleBuffer;
|
std::vector<liquid_float_complex> resampleBuffer;
|
||||||
// event table
|
// event table
|
||||||
|
@ -3,83 +3,7 @@
|
|||||||
#include "CubicSDR.h"
|
#include "CubicSDR.h"
|
||||||
|
|
||||||
WaterfallContext::WaterfallContext(WaterfallCanvas *canvas, wxGLContext *sharedContext) :
|
WaterfallContext::WaterfallContext(WaterfallCanvas *canvas, wxGLContext *sharedContext) :
|
||||||
PrimaryGLContext(canvas, sharedContext), waterfall(0), waterfall_tex(NULL), waterfall_lines(0), fft_size(0), theme(COLOR_THEME_DEFAULT) {
|
PrimaryGLContext(canvas, sharedContext), waterfall(0), waterfall_tex(NULL), waterfall_lines(0), fft_size(0), activeTheme(NULL) {
|
||||||
Gradient *grad = new Gradient();
|
|
||||||
grad->addColor(GradientColor(0, 0, 0));
|
|
||||||
grad->addColor(GradientColor(0, 0, 1.0));
|
|
||||||
grad->addColor(GradientColor(0, 1.0, 0));
|
|
||||||
grad->addColor(GradientColor(1.0, 1.0, 0));
|
|
||||||
grad->addColor(GradientColor(1.0, 0.2, 0.0));
|
|
||||||
grad->generate(256);
|
|
||||||
gradients[COLOR_THEME_DEFAULT] = grad;
|
|
||||||
|
|
||||||
grad = new Gradient();
|
|
||||||
grad->addColor(GradientColor(0, 0, 0));
|
|
||||||
grad->addColor(GradientColor(0.0, 0, 0.5));
|
|
||||||
grad->addColor(GradientColor(0.0, 0.0, 1.0));
|
|
||||||
grad->addColor(GradientColor(65.0 / 255.0, 161.0 / 255.0, 1.0));
|
|
||||||
grad->addColor(GradientColor(1.0, 1.0, 1.0));
|
|
||||||
grad->addColor(GradientColor(1.0, 1.0, 1.0));
|
|
||||||
grad->addColor(GradientColor(1.0, 1.0, 0.5));
|
|
||||||
grad->addColor(GradientColor(1.0, 1.0, 0.0));
|
|
||||||
grad->addColor(GradientColor(1.0, 0.5, 0.0));
|
|
||||||
grad->addColor(GradientColor(1.0, 0.25, 0.0));
|
|
||||||
grad->addColor(GradientColor(0.5, 0.1, 0.0));
|
|
||||||
grad->generate(256);
|
|
||||||
gradients[COLOR_THEME_SHARP] = grad;
|
|
||||||
|
|
||||||
grad = new Gradient();
|
|
||||||
grad->addColor(GradientColor(0, 0, 0));
|
|
||||||
grad->addColor(GradientColor(0.75, 0.75, 0.75));
|
|
||||||
grad->addColor(GradientColor(1.0, 1.0, 1.0));
|
|
||||||
grad->generate(256);
|
|
||||||
gradients[COLOR_THEME_BW] = grad;
|
|
||||||
|
|
||||||
grad = new Gradient();
|
|
||||||
grad->addColor(GradientColor(0, 0, 0.5));
|
|
||||||
grad->addColor(GradientColor(25.0/255.0, 154.0/255.0, 0.0));
|
|
||||||
grad->addColor(GradientColor(201.0/255.0, 115.0/255.0, 0.0));
|
|
||||||
grad->addColor(GradientColor(1.0, 40.0/255.0, 40.0/255.0));
|
|
||||||
grad->addColor(GradientColor(1.0, 1.0, 1.0));
|
|
||||||
grad->generate(256);
|
|
||||||
gradients[COLOR_THEME_RAD] = grad;
|
|
||||||
|
|
||||||
|
|
||||||
grad = new Gradient();
|
|
||||||
grad->addColor(GradientColor(0, 0, 0));
|
|
||||||
grad->addColor(GradientColor(55.0/255.0, 40.0/255.0, 55.0/255.0));
|
|
||||||
grad->addColor(GradientColor(60.0/255.0, 60.0/255.0, 90.0/255.0));
|
|
||||||
grad->addColor(GradientColor(0.0/255.0, 255.0/255.0, 255.0/255.0));
|
|
||||||
grad->addColor(GradientColor(10.0/255.0, 255.0/255.0, 85.0/255.0));
|
|
||||||
grad->addColor(GradientColor(255.0/255.0, 255.0/255.0, 75.0/255.0));
|
|
||||||
grad->addColor(GradientColor(255.0/255.0, 0.0/255.0, 0.0/255.0));
|
|
||||||
grad->addColor(GradientColor(255.0/255.0, 255.0/255.0, 255.0/255.0));
|
|
||||||
grad->generate(256);
|
|
||||||
gradients[COLOR_THEME_TOUCH] = grad;
|
|
||||||
|
|
||||||
|
|
||||||
grad = new Gradient();
|
|
||||||
grad->addColor(GradientColor(5.0/255.0, 5.0/255.0, 60.0/255.0));
|
|
||||||
grad->addColor(GradientColor(5.0/255.0, 20.0/255.0, 120.0/255.0));
|
|
||||||
grad->addColor(GradientColor(50.0/255.0, 100.0/255.0, 200.0/255.0));
|
|
||||||
grad->addColor(GradientColor(75.0/255.0, 190.0/255.0, 100.0/255.0));
|
|
||||||
grad->addColor(GradientColor(240.0/255.0, 55.0/255.0, 5.0/255.0));
|
|
||||||
grad->addColor(GradientColor(255.0/255.0, 55.0/255.0, 100.0/255.0));
|
|
||||||
grad->addColor(GradientColor(255.0/255.0, 235.0/255.0, 100.0/255.0));
|
|
||||||
grad->addColor(GradientColor(250.0/255.0, 250.0/255.0, 250.0/255.0));
|
|
||||||
grad->generate(256);
|
|
||||||
gradients[COLOR_THEME_HD] = grad;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
grad = new Gradient();
|
|
||||||
grad->addColor(GradientColor(5.0/255.0, 45.0/255.0, 10.0/255.0));
|
|
||||||
grad->addColor(GradientColor(30.0/255.0, 150.0/255.0, 40.0/255.0));
|
|
||||||
grad->addColor(GradientColor(40.0/255.0, 240.0/255.0, 60.0/255.0));
|
|
||||||
grad->addColor(GradientColor(250.0/255.0, 250.0/255.0, 250.0/255.0));
|
|
||||||
grad->generate(256);
|
|
||||||
gradients[COLOR_THEME_RADAR] = grad;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaterfallContext::Setup(int fft_size_in, int num_waterfall_lines_in) {
|
void WaterfallContext::Setup(int fft_size_in, int num_waterfall_lines_in) {
|
||||||
@ -113,34 +37,25 @@ void WaterfallContext::Setup(int fft_size_in, int num_waterfall_lines_in) {
|
|||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
glPixelTransferi(GL_MAP_COLOR, GL_TRUE);
|
|
||||||
glPixelMapfv(GL_PIXEL_MAP_I_TO_R, 256, &(gradients[theme]->getRed())[0]);
|
|
||||||
glPixelMapfv(GL_PIXEL_MAP_I_TO_G, 256, &(gradients[theme]->getGreen())[0]);
|
|
||||||
glPixelMapfv(GL_PIXEL_MAP_I_TO_B, 256, &(gradients[theme]->getBlue())[0]);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaterfallContext::setTheme(int theme_id) {
|
void WaterfallContext::refreshTheme() {
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glBindTexture(GL_TEXTURE_2D, waterfall);
|
glBindTexture(GL_TEXTURE_2D, waterfall);
|
||||||
|
|
||||||
if (theme >= COLOR_THEME_MAX) {
|
|
||||||
theme = COLOR_THEME_MAX - 1;
|
|
||||||
}
|
|
||||||
if (theme < 0) {
|
|
||||||
theme = 0;
|
|
||||||
}
|
|
||||||
theme = theme_id;
|
|
||||||
|
|
||||||
glPixelTransferi(GL_MAP_COLOR, GL_TRUE);
|
glPixelTransferi(GL_MAP_COLOR, GL_TRUE);
|
||||||
glPixelMapfv(GL_PIXEL_MAP_I_TO_R, 256, &(gradients[theme]->getRed())[0]);
|
glPixelMapfv(GL_PIXEL_MAP_I_TO_R, 256, &(ThemeMgr::mgr.currentTheme->waterfallGradient.getRed())[0]);
|
||||||
glPixelMapfv(GL_PIXEL_MAP_I_TO_G, 256, &(gradients[theme]->getGreen())[0]);
|
glPixelMapfv(GL_PIXEL_MAP_I_TO_G, 256, &(ThemeMgr::mgr.currentTheme->waterfallGradient.getGreen())[0]);
|
||||||
glPixelMapfv(GL_PIXEL_MAP_I_TO_B, 256, &(gradients[theme]->getBlue())[0]);
|
glPixelMapfv(GL_PIXEL_MAP_I_TO_B, 256, &(ThemeMgr::mgr.currentTheme->waterfallGradient.getBlue())[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaterfallContext::Draw(std::vector<float> &points) {
|
void WaterfallContext::Draw(std::vector<float> &points) {
|
||||||
|
|
||||||
|
if (activeTheme != ThemeMgr::mgr.currentTheme) {
|
||||||
|
refreshTheme();
|
||||||
|
activeTheme = ThemeMgr::mgr.currentTheme;
|
||||||
|
}
|
||||||
|
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
||||||
|
|
||||||
if (points.size()) {
|
if (points.size()) {
|
||||||
@ -180,7 +95,3 @@ void WaterfallContext::Draw(std::vector<float> &points) {
|
|||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int WaterfallContext::getTheme() {
|
|
||||||
return theme;
|
|
||||||
}
|
|
||||||
|
@ -2,16 +2,7 @@
|
|||||||
|
|
||||||
#include "PrimaryGLContext.h"
|
#include "PrimaryGLContext.h"
|
||||||
#include "Gradient.h"
|
#include "Gradient.h"
|
||||||
|
#include "ColorTheme.h"
|
||||||
|
|
||||||
#define COLOR_THEME_DEFAULT 0
|
|
||||||
#define COLOR_THEME_BW 1
|
|
||||||
#define COLOR_THEME_SHARP 2
|
|
||||||
#define COLOR_THEME_RAD 3
|
|
||||||
#define COLOR_THEME_TOUCH 4
|
|
||||||
#define COLOR_THEME_HD 5
|
|
||||||
#define COLOR_THEME_RADAR 6
|
|
||||||
#define COLOR_THEME_MAX 7
|
|
||||||
|
|
||||||
class WaterfallCanvas;
|
class WaterfallCanvas;
|
||||||
|
|
||||||
@ -21,14 +12,13 @@ public:
|
|||||||
|
|
||||||
void Draw(std::vector<float> &points);
|
void Draw(std::vector<float> &points);
|
||||||
void Setup(int fft_size_in, int num_waterfall_lines_in);
|
void Setup(int fft_size_in, int num_waterfall_lines_in);
|
||||||
void setTheme(int theme_id);
|
void refreshTheme();
|
||||||
int getTheme();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Gradient *gradients[COLOR_THEME_MAX];
|
|
||||||
GLuint waterfall;
|
GLuint waterfall;
|
||||||
int theme;
|
|
||||||
unsigned char *waterfall_tex;
|
unsigned char *waterfall_tex;
|
||||||
int fft_size;
|
int fft_size;
|
||||||
int waterfall_lines;
|
int waterfall_lines;
|
||||||
|
|
||||||
|
ColorTheme *activeTheme;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user