update digital_lab

This commit is contained in:
Charles J. Cliffe
2015-08-26 20:32:53 -04:00
42 changed files with 1200 additions and 396 deletions
+140 -140
View File
@@ -41,27 +41,27 @@ DefaultColorTheme::DefaultColorTheme() {
waterfallGradient.addColor(GradientColor(1.0, 1.0, 0));
waterfallGradient.addColor(GradientColor(1.0, 0.2, 0.0));
waterfallGradient.generate(256);
waterfallHighlight = RGB3f(1, 1, 1);
waterfallNew = RGB3f(0, 1, 0);
waterfallHover = RGB3f(1, 1, 0);
waterfallDestroy = RGB3f(1, 0, 0);
fftLine = RGB3f(0.9, 0.9, 0.9);
fftHighlight = RGB3f(1, 1, 1);
scopeLine = RGB3f(0.9, 0.9, 0.9);
tuningBarLight = RGB3f(0.2, 0.2, 0.9);
tuningBarDark = RGB3f(0.0, 0.0, 0.35);
tuningBarUp = RGB3f(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGB3f(148.0/255.0, 148.0/255.0, 1.0);
meterLevel = RGB3f(0.1, 0.75, 0.1);
meterValue = RGB3f(0.75, 0.1, 0.1);
text = RGB3f(1, 1, 1);
freqLine = RGB3f(1, 1, 1);
button = RGB3f(0.65, 0.65, 0.65);
buttonHighlight = RGB3f(1, 1, 0);
waterfallHighlight = RGBA4f(1, 1, 1);
waterfallNew = RGBA4f(0, 1, 0);
waterfallHover = RGBA4f(1, 1, 0);
waterfallDestroy = RGBA4f(1, 0, 0);
fftLine = RGBA4f(0.9, 0.9, 0.9);
fftHighlight = RGBA4f(1, 1, 1);
scopeLine = RGBA4f(0.9, 0.9, 0.9);
tuningBarLight = RGBA4f(0.2, 0.2, 0.9);
tuningBarDark = RGBA4f(0.0, 0.0, 0.35);
tuningBarUp = RGBA4f(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGBA4f(148.0/255.0, 148.0/255.0, 1.0);
meterLevel = RGBA4f(0.1, 0.75, 0.1);
meterValue = RGBA4f(0.75, 0.1, 0.1);
text = RGBA4f(1, 1, 1);
freqLine = RGBA4f(1, 1, 1);
button = RGBA4f(0.65, 0.65, 0.65);
buttonHighlight = RGBA4f(1, 1, 0);
scopeBackground = RGB3f(0.1, 0.1, 0.1);
fftBackground = RGB3f(0.1, 0.1, 0.1);
generalBackground = RGB3f(0.1, 0.1, 0.1);
scopeBackground = RGBA4f(0.1, 0.1, 0.1);
fftBackground = RGBA4f(0.1, 0.1, 0.1);
generalBackground = RGBA4f(0.1, 0.1, 0.1);
}
@@ -72,27 +72,27 @@ RadarColorTheme::RadarColorTheme() {
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 = RGB3f(1, 1, 1);
waterfallNew = RGB3f(0, 1, 0);
waterfallHover = RGB3f(1, 1, 0);
waterfallDestroy = RGB3f(1, 0, 0);
fftLine = RGB3f(0.8, 1.0, 0.8);
fftHighlight = RGB3f(1, 1, 1);
scopeLine = RGB3f(0.8, 1.0, 0.8);
tuningBarLight = RGB3f(0.0, 0.45, 0.0);
tuningBarDark = RGB3f(0.0, 0.1, 0.0);
tuningBarUp = RGB3f(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGB3f(148.0/255.0, 0.0, 0.0);
meterLevel = RGB3f(0, 0.5, 0);
meterValue = RGB3f(0, 0.5, 0);
text = RGB3f(0.8, 1.0, 0.8);
freqLine = RGB3f(1, 1, 1);
button = RGB3f(0.65, 0.75, 0.65);
buttonHighlight = RGB3f(0.65, 1.0, 0.65);
waterfallHighlight = RGBA4f(1, 1, 1);
waterfallNew = RGBA4f(0, 1, 0);
waterfallHover = RGBA4f(1, 1, 0);
waterfallDestroy = RGBA4f(1, 0, 0);
fftLine = RGBA4f(0.8, 1.0, 0.8);
fftHighlight = RGBA4f(1, 1, 1);
scopeLine = RGBA4f(0.8, 1.0, 0.8);
tuningBarLight = RGBA4f(0.0, 0.45, 0.0);
tuningBarDark = RGBA4f(0.0, 0.1, 0.0);
tuningBarUp = RGBA4f(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGBA4f(148.0/255.0, 0.0, 0.0);
meterLevel = RGBA4f(0, 0.5, 0);
meterValue = RGBA4f(0, 0.5, 0);
text = RGBA4f(0.8, 1.0, 0.8);
freqLine = RGBA4f(1, 1, 1);
button = RGBA4f(0.65, 0.75, 0.65);
buttonHighlight = RGBA4f(0.65, 1.0, 0.65);
scopeBackground = RGB3f(0.05, 0.1, 0.05);
fftBackground = RGB3f(0.05, 0.1, 0.05);
generalBackground = RGB3f(0.05, 0.1, 0.05);
scopeBackground = RGBA4f(0.05, 0.1, 0.05);
fftBackground = RGBA4f(0.05, 0.1, 0.05);
generalBackground = RGBA4f(0.05, 0.1, 0.05);
}
BlackAndWhiteColorTheme::BlackAndWhiteColorTheme() {
@@ -101,27 +101,27 @@ BlackAndWhiteColorTheme::BlackAndWhiteColorTheme() {
waterfallGradient.addColor(GradientColor(0.75, 0.75, 0.75));
waterfallGradient.addColor(GradientColor(1.0, 1.0, 1.0));
waterfallGradient.generate(256);
waterfallHighlight = RGB3f(1, 1, 0.9);
waterfallNew = RGB3f(0, 1, 0);
waterfallHover = RGB3f(1, 1, 0);
waterfallDestroy = RGB3f(1, 0, 0);
fftLine = RGB3f(0.9, 0.9, 0.9);
fftHighlight = RGB3f(1, 1, 0.9);
scopeLine = RGB3f(0.9, 0.9, 0.9);
tuningBarLight = RGB3f(0.4, 0.4, 0.4);
tuningBarDark = RGB3f(0.1, 0.1, 0.1);
tuningBarUp = RGB3f(0.8, 0.8, 0.8);
tuningBarDown = RGB3f(0.4, 0.4, 0.4);
meterLevel = RGB3f(0.5, 0.5, 0.5);
meterValue = RGB3f(0.5, 0.5, 0.5);
text = RGB3f(1, 1, 1);
freqLine = RGB3f(1, 1, 1);
button = RGB3f(0.65, 0.65, 0.65);
buttonHighlight = RGB3f(1, 1, 1);
waterfallHighlight = RGBA4f(1, 1, 0.9);
waterfallNew = RGBA4f(0, 1, 0);
waterfallHover = RGBA4f(1, 1, 0);
waterfallDestroy = RGBA4f(1, 0, 0);
fftLine = RGBA4f(0.9, 0.9, 0.9);
fftHighlight = RGBA4f(1, 1, 0.9);
scopeLine = RGBA4f(0.9, 0.9, 0.9);
tuningBarLight = RGBA4f(0.4, 0.4, 0.4);
tuningBarDark = RGBA4f(0.1, 0.1, 0.1);
tuningBarUp = RGBA4f(0.8, 0.8, 0.8);
tuningBarDown = RGBA4f(0.4, 0.4, 0.4);
meterLevel = RGBA4f(0.5, 0.5, 0.5);
meterValue = RGBA4f(0.5, 0.5, 0.5);
text = RGBA4f(1, 1, 1);
freqLine = RGBA4f(1, 1, 1);
button = RGBA4f(0.65, 0.65, 0.65);
buttonHighlight = RGBA4f(1, 1, 1);
scopeBackground = RGB3f(0.1, 0.1, 0.1);
fftBackground = RGB3f(0.1, 0.1, 0.1);
generalBackground = RGB3f(0.1, 0.1, 0.1);
scopeBackground = RGBA4f(0.1, 0.1, 0.1);
fftBackground = RGBA4f(0.1, 0.1, 0.1);
generalBackground = RGBA4f(0.1, 0.1, 0.1);
}
@@ -139,27 +139,27 @@ SharpColorTheme::SharpColorTheme() {
waterfallGradient.addColor(GradientColor(1.0, 0.25, 0.0));
waterfallGradient.addColor(GradientColor(0.5, 0.1, 0.0));
waterfallGradient.generate(256);
waterfallHighlight = RGB3f(0.9, 0.9, 1.0);
waterfallNew = RGB3f(0, 1, 0);
waterfallHover = RGB3f(1, 1, 0);
waterfallDestroy = RGB3f(1, 0, 0);
fftLine = RGB3f(0.9, 0.9, 1.0);
fftHighlight = RGB3f(0.9, 0.9, 1.0);
scopeLine = RGB3f(0.85, 0.85, 1.0);
tuningBarLight = RGB3f(28.0 / 255.0, 106.0 / 255.0, 179.0 / 255.0);
tuningBarDark = RGB3f(14.0 / 255.0, 53.0 / 255.0, 89.5 / 255.0);
tuningBarUp = RGB3f(0.7, 0.7, 0.7);
tuningBarDown = RGB3f(1.0, 0.0, 0.0);
meterLevel = RGB3f(28.0 / 255.0, 106.0 / 255.0, 179.0 / 255.0);
meterValue = RGB3f(190.0 / 255.0, 190.0 / 255.0, 60.0 / 255.0);
text = RGB3f(0.9, 0.9, 1);
freqLine = RGB3f(0.85, 0.85, 1.0);
button = RGB3f(217.0 / 255.0, 218.0 / 255.0, 228.0 / 255.0);
buttonHighlight = RGB3f(208.0 / 255.0, 249.0 / 255.0, 255.0 / 255.0);
waterfallHighlight = RGBA4f(0.9, 0.9, 1.0);
waterfallNew = RGBA4f(0, 1, 0);
waterfallHover = RGBA4f(1, 1, 0);
waterfallDestroy = RGBA4f(1, 0, 0);
fftLine = RGBA4f(0.9, 0.9, 1.0);
fftHighlight = RGBA4f(0.9, 0.9, 1.0);
scopeLine = RGBA4f(0.85, 0.85, 1.0);
tuningBarLight = RGBA4f(28.0 / 255.0, 106.0 / 255.0, 179.0 / 255.0);
tuningBarDark = RGBA4f(14.0 / 255.0, 53.0 / 255.0, 89.5 / 255.0);
tuningBarUp = RGBA4f(0.7, 0.7, 0.7);
tuningBarDown = RGBA4f(1.0, 0.0, 0.0);
meterLevel = RGBA4f(28.0 / 255.0, 106.0 / 255.0, 179.0 / 255.0);
meterValue = RGBA4f(190.0 / 255.0, 190.0 / 255.0, 60.0 / 255.0);
text = RGBA4f(0.9, 0.9, 1);
freqLine = RGBA4f(0.85, 0.85, 1.0);
button = RGBA4f(217.0 / 255.0, 218.0 / 255.0, 228.0 / 255.0);
buttonHighlight = RGBA4f(208.0 / 255.0, 249.0 / 255.0, 255.0 / 255.0);
scopeBackground = RGB3f(0.05, 0.05, 0.15);
fftBackground = RGB3f(0.05, 0.05, 0.15);
generalBackground = RGB3f(0.05, 0.05, 0.15);
scopeBackground = RGBA4f(0.05, 0.05, 0.15);
fftBackground = RGBA4f(0.05, 0.05, 0.15);
generalBackground = RGBA4f(0.05, 0.05, 0.15);
}
RadColorTheme::RadColorTheme() {
@@ -170,27 +170,27 @@ RadColorTheme::RadColorTheme() {
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 = RGB3f(1, 1, 1);
waterfallNew = RGB3f(0, 1, 0);
waterfallHover = RGB3f(1, 1, 0);
waterfallDestroy = RGB3f(1, 0, 0);
fftLine = RGB3f(1.0, 0.9, 0.9);
fftHighlight = RGB3f(1, 1, 1);
scopeLine = RGB3f(1.0, 0.9, 0.9);
tuningBarLight = RGB3f(0.0, 0.45, 0.0);
tuningBarDark = RGB3f(0.0, 0.1, 0.0);
tuningBarUp = RGB3f(1.0, 0.0, 0.0);
tuningBarDown = RGB3f(0.0, 0.5, 1.0);
meterLevel = RGB3f(0, 0.5, 0);
meterValue = RGB3f(0.5, 0, 0);
text = RGB3f(1, 1, 1);
freqLine = RGB3f(1, 1, 1);
button = RGB3f(0.65, 0.65, 0.65);
buttonHighlight = RGB3f(0.76, 0.65, 0);
waterfallHighlight = RGBA4f(1, 1, 1);
waterfallNew = RGBA4f(0, 1, 0);
waterfallHover = RGBA4f(1, 1, 0);
waterfallDestroy = RGBA4f(1, 0, 0);
fftLine = RGBA4f(1.0, 0.9, 0.9);
fftHighlight = RGBA4f(1, 1, 1);
scopeLine = RGBA4f(1.0, 0.9, 0.9);
tuningBarLight = RGBA4f(0.0, 0.45, 0.0);
tuningBarDark = RGBA4f(0.0, 0.1, 0.0);
tuningBarUp = RGBA4f(1.0, 0.0, 0.0);
tuningBarDown = RGBA4f(0.0, 0.5, 1.0);
meterLevel = RGBA4f(0, 0.5, 0);
meterValue = RGBA4f(0.5, 0, 0);
text = RGBA4f(1, 1, 1);
freqLine = RGBA4f(1, 1, 1);
button = RGBA4f(0.65, 0.65, 0.65);
buttonHighlight = RGBA4f(0.76, 0.65, 0);
scopeBackground = RGB3f(13.0 / 255.0, 47.0 / 255.0, 9.0 / 255.0);
fftBackground = RGB3f(0, 0, 50.0 / 255.0);
generalBackground = RGB3f(13.0 / 255.0, 47.0 / 255.0, 9.0 / 255.0);
scopeBackground = RGBA4f(13.0 / 255.0, 47.0 / 255.0, 9.0 / 255.0);
fftBackground = RGBA4f(0, 0, 50.0 / 255.0);
generalBackground = RGBA4f(13.0 / 255.0, 47.0 / 255.0, 9.0 / 255.0);
}
TouchColorTheme::TouchColorTheme() {
@@ -204,27 +204,27 @@ TouchColorTheme::TouchColorTheme() {
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 = RGB3f(1, 1, 1);
waterfallNew = RGB3f(0, 1, 0);
waterfallHover = RGB3f(1, 1, 0);
waterfallDestroy = RGB3f(1, 0, 0);
fftLine = RGB3f(234.0 / 255.0, 232.0 / 255.0, 247.0 / 255.0);
fftHighlight = RGB3f(1.0, 1.0, 1.0);
scopeLine = RGB3f(234.0 / 255.0, 232.0 / 255.0, 247.0 / 255.0);
tuningBarLight = RGB3f(0.2, 0.2, 0.7);
tuningBarDark = RGB3f(0.1, 0.1, 0.45);
tuningBarUp = RGB3f(0.5, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGB3f(0.6, 108.0/255.0, 1.0);
meterLevel = RGB3f(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
meterValue = RGB3f(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
text = RGB3f(1, 1, 1);
freqLine = RGB3f(1, 1, 1);
button = RGB3f(1.0, 1.0, 1.0);
buttonHighlight = RGB3f(208.0 / 255.0, 202.0 / 255.0, 247.0 / 255.0);
waterfallHighlight = RGBA4f(1, 1, 1);
waterfallNew = RGBA4f(0, 1, 0);
waterfallHover = RGBA4f(1, 1, 0);
waterfallDestroy = RGBA4f(1, 0, 0);
fftLine = RGBA4f(234.0 / 255.0, 232.0 / 255.0, 247.0 / 255.0);
fftHighlight = RGBA4f(1.0, 1.0, 1.0);
scopeLine = RGBA4f(234.0 / 255.0, 232.0 / 255.0, 247.0 / 255.0);
tuningBarLight = RGBA4f(0.2, 0.2, 0.7);
tuningBarDark = RGBA4f(0.1, 0.1, 0.45);
tuningBarUp = RGBA4f(0.5, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGBA4f(0.6, 108.0/255.0, 1.0);
meterLevel = RGBA4f(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
meterValue = RGBA4f(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
text = RGBA4f(1, 1, 1);
freqLine = RGBA4f(1, 1, 1);
button = RGBA4f(1.0, 1.0, 1.0);
buttonHighlight = RGBA4f(208.0 / 255.0, 202.0 / 255.0, 247.0 / 255.0);
scopeBackground = RGB3f(39.0 / 255.0, 36.0 / 255.0, 56.0 / 255.0);
fftBackground = RGB3f(39.0 / 255.0, 36.0 / 255.0, 56.0 / 255.0);
generalBackground = RGB3f(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
scopeBackground = RGBA4f(39.0 / 255.0, 36.0 / 255.0, 56.0 / 255.0);
fftBackground = RGBA4f(39.0 / 255.0, 36.0 / 255.0, 56.0 / 255.0);
generalBackground = RGBA4f(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
}
@@ -239,27 +239,27 @@ HDColorTheme::HDColorTheme() {
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 = RGB3f(1, 1, 1);
waterfallNew = RGB3f(0, 1, 0);
waterfallHover = RGB3f(1, 1, 0);
waterfallDestroy = RGB3f(1, 0, 0);
fftLine = RGB3f(0.9, 0.9, 0.9);
fftHighlight = RGB3f(1, 1, 1);
scopeLine = RGB3f(0.9, 0.9, 0.9);
tuningBarLight = RGB3f(0.4, 0.4, 1.0);
tuningBarDark = RGB3f(0.1, 0.1, 0.45);
tuningBarUp = RGB3f(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGB3f(148.0/255.0, 148.0/255.0, 1.0);
meterLevel = RGB3f(0, 0.5, 0);
meterValue = RGB3f(0.0, 0.0, 1.0);
text = RGB3f(1, 1, 1);
freqLine = RGB3f(1, 1, 1);
button = RGB3f(0, 0.7, 0.7);
buttonHighlight = RGB3f(1, 1, 1);
waterfallHighlight = RGBA4f(1, 1, 1);
waterfallNew = RGBA4f(0, 1, 0);
waterfallHover = RGBA4f(1, 1, 0);
waterfallDestroy = RGBA4f(1, 0, 0);
fftLine = RGBA4f(0.9, 0.9, 0.9);
fftHighlight = RGBA4f(1, 1, 1);
scopeLine = RGBA4f(0.9, 0.9, 0.9);
tuningBarLight = RGBA4f(0.4, 0.4, 1.0);
tuningBarDark = RGBA4f(0.1, 0.1, 0.45);
tuningBarUp = RGBA4f(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGBA4f(148.0/255.0, 148.0/255.0, 1.0);
meterLevel = RGBA4f(0, 0.5, 0);
meterValue = RGBA4f(0.0, 0.0, 1.0);
text = RGBA4f(1, 1, 1);
freqLine = RGBA4f(1, 1, 1);
button = RGBA4f(0, 0.7, 0.7);
buttonHighlight = RGBA4f(1, 1, 1);
scopeBackground = RGB3f(0.0, 0.0, 48.0 / 255.0);
fftBackground = RGB3f(0.0, 0.0, 48.0 / 255.0);
generalBackground = RGB3f(0.0, 0.0, 0.0);
scopeBackground = RGBA4f(0.0, 0.0, 48.0 / 255.0);
fftBackground = RGBA4f(0.0, 0.0, 48.0 / 255.0);
generalBackground = RGBA4f(0.0, 0.0, 0.0);
}
+31 -30
View File
@@ -15,55 +15,56 @@
#define COLOR_THEME_RADAR 6
#define COLOR_THEME_MAX 7
class RGB3f {
class RGBA4f {
public:
float r, g, b;
RGB3f(float r, float g, float b) :
r(r), g(g), b(b) {
float r, g, b, a;
RGBA4f(float r, float g, float b, float a = 1.0) :
r(r), g(g), b(b), a(a) {
}
RGB3f() :
RGB3f(0, 0, 0) {
RGBA4f() :
RGBA4f(0, 0, 0) {
}
~RGB3f() {
~RGBA4f() {
}
RGB3f & operator=(const RGB3f &other) {
RGBA4f & operator=(const RGBA4f &other) {
r = other.r;
g = other.g;
b = other.b;
a = other.a;
return *this;
}
RGB3f operator*(float v) { return RGB3f(r*v, g*v, b*v); }
RGBA4f operator*(float v) { return RGBA4f(r*v, g*v, b*v); }
};
class ColorTheme {
public:
RGB3f waterfallHighlight;
RGB3f waterfallNew;
RGB3f wfHighlight;
RGB3f waterfallHover;
RGB3f waterfallDestroy;
RGB3f fftLine;
RGB3f fftHighlight;
RGB3f scopeLine;
RGB3f tuningBarLight;
RGB3f tuningBarDark;
RGB3f tuningBarUp;
RGB3f tuningBarDown;
RGB3f meterLevel;
RGB3f meterValue;
RGB3f text;
RGB3f freqLine;
RGB3f button;
RGB3f buttonHighlight;
RGBA4f waterfallHighlight;
RGBA4f waterfallNew;
RGBA4f wfHighlight;
RGBA4f waterfallHover;
RGBA4f waterfallDestroy;
RGBA4f fftLine;
RGBA4f fftHighlight;
RGBA4f scopeLine;
RGBA4f tuningBarLight;
RGBA4f tuningBarDark;
RGBA4f tuningBarUp;
RGBA4f tuningBarDown;
RGBA4f meterLevel;
RGBA4f meterValue;
RGBA4f text;
RGBA4f freqLine;
RGBA4f button;
RGBA4f buttonHighlight;
RGB3f scopeBackground;
RGB3f fftBackground;
RGB3f generalBackground;
RGBA4f scopeBackground;
RGBA4f fftBackground;
RGBA4f generalBackground;
Gradient waterfallGradient;
+45 -7
View File
@@ -25,9 +25,11 @@ EVT_ENTER_WINDOW(ModeSelectorCanvas::OnMouseEnterWindow)
wxEND_EVENT_TABLE()
ModeSelectorCanvas::ModeSelectorCanvas(wxWindow *parent, int *attribList) :
InteractiveCanvas(parent, attribList), numChoices(0), currentSelection(-1) {
InteractiveCanvas(parent, attribList), numChoices(0), currentSelection(-1), toggleMode(false), inputChanged(false), padX(4.0), padY(4.0), highlightOverride(false) {
glContext = new ModeSelectorContext(this, &wxGetApp().GetContext(this));
highlightColor = RGBA4f(1.0,1.0,1.0,1.0);
}
ModeSelectorCanvas::~ModeSelectorCanvas() {
@@ -59,10 +61,15 @@ void ModeSelectorCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
int yval = getHoveredSelection();
for (int i = 0; i < numChoices; i++) {
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);
if (yval == i && !highlightOverride) {
RGBA4f hc = ThemeMgr::mgr.currentTheme->buttonHighlight;
glContext->DrawSelector(selections[i].label, i, numChoices, true, hc.r, hc.g, hc.b, 1.0, padX, padY);
} 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);
RGBA4f hc = ThemeMgr::mgr.currentTheme->button;
if (highlightOverride) {
hc = highlightColor;
}
glContext->DrawSelector(selections[i].label, i, numChoices, i == currentSelection, hc.r, hc.g, hc.b, 1.0, padX, padY);
}
}
@@ -97,11 +104,22 @@ void ModeSelectorCanvas::OnMouseReleased(wxMouseEvent& event) {
const wxSize ClientSize = GetClientSize();
int selectedButton = currentSelection;
if (mouseTracker.getOriginDeltaMouseX() < 2.0 / ClientSize.y) {
currentSelection = getHoveredSelection();
selectedButton = getHoveredSelection();
}
SetCursor (wxCURSOR_ARROW);
if (toggleMode && (currentSelection == selectedButton)) {
selectedButton = -1;
}
if (currentSelection != selectedButton) {
inputChanged = true;
}
currentSelection = selectedButton;
SetCursor (wxCURSOR_HAND);
}
void ModeSelectorCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
@@ -112,7 +130,7 @@ void ModeSelectorCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
void ModeSelectorCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
InteractiveCanvas::mouseTracker.OnMouseEnterWindow(event);
SetCursor (wxCURSOR_ARROW);
SetCursor (wxCURSOR_HAND);
if (!helpTip.empty()) {
setStatusText(helpTip);
}
@@ -148,4 +166,24 @@ int ModeSelectorCanvas::getSelection() {
return selections[currentSelection].value;
}
void ModeSelectorCanvas::setToggleMode(bool toggleMode) {
this->toggleMode = toggleMode;
}
bool ModeSelectorCanvas::modeChanged() {
return inputChanged;
}
void ModeSelectorCanvas::clearModeChanged() {
inputChanged = false;
}
void ModeSelectorCanvas::setPadding(float padX, float padY) {
this->padX = padX;
this->padY = padY;
}
void ModeSelectorCanvas::setHighlightColor(RGBA4f hc) {
this->highlightColor = hc;
this->highlightOverride = true;
}
+13
View File
@@ -35,6 +35,14 @@ public:
void setSelection(int value);
int getSelection();
void setToggleMode(bool toggleMode);
bool modeChanged();
void clearModeChanged();
void setPadding(float padX, float padY);
void setHighlightColor(RGBA4f hc);
private:
void setNumChoices(int numChoices_in);
@@ -53,7 +61,12 @@ private:
std::string helpTip;
int numChoices;
int currentSelection;
bool toggleMode;
bool inputChanged;
std::vector<ModeSelectorMode> selections;
float padX, padY;
RGBA4f highlightColor;
bool highlightOverride;
//
wxDECLARE_EVENT_TABLE();
};
+9 -3
View File
@@ -22,7 +22,7 @@ void ModeSelectorContext::DrawBegin() {
glDisable(GL_TEXTURE_2D);
}
void ModeSelectorContext::DrawSelector(std::string label, int c, int cMax, bool on, float r, float g, float b, float a) {
void ModeSelectorContext::DrawSelector(std::string label, int c, int cMax, bool on, float r, float g, float b, float a, float px, float py) {
GLint vp[4];
glGetIntegerv( GL_VIEWPORT, vp);
@@ -42,15 +42,21 @@ void ModeSelectorContext::DrawSelector(std::string label, int c, int cMax, bool
float y = 1.0 - ((float) (c+1) / (float) cMax * 2.0);
float height = (2.0 / (float) cMax);
float padX = (4.0 / viewWidth);
float padY = (4.0 / viewHeight);
float padX = (px / viewWidth);
float padY = (py / viewHeight);
if (a < 1.0) {
glEnable(GL_BLEND);
}
glBegin(on?GL_QUADS:GL_LINE_LOOP);
glVertex2f(-1.0 + padX, y + padY);
glVertex2f(1.0 - padX, y + padY);
glVertex2f(1.0 - padX, y + height - padY);
glVertex2f(-1.0 + padX, y + height - padY);
glEnd();
if (a < 1.0) {
glDisable(GL_BLEND);
}
if (on) {
glColor4f(0, 0, 0, a);
+1 -1
View File
@@ -12,6 +12,6 @@ public:
ModeSelectorContext(ModeSelectorCanvas *canvas, wxGLContext *sharedContext);
void DrawBegin();
void DrawSelector(std::string label, int c, int cMax, bool on, float r, float g, float b, float a);
void DrawSelector(std::string label, int c, int cMax, bool on, float r, float g, float b, float a, float padx, float pady);
void DrawEnd();
};
+20 -9
View File
@@ -59,7 +59,7 @@ PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContex
//#endif
}
void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGB3f color, long long center_freq, long long srate) {
void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGBA4f color, long long center_freq, long long srate) {
if (!demod) {
return;
}
@@ -94,7 +94,12 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGB3f color, lo
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0, 0, 0, 0.35);
if (demod->isMuted()) {
glColor4f(0.8, 0, 0, 0.35);
} else {
glColor4f(0, 0, 0, 0.35);
}
glBegin(GL_QUADS);
glVertex3f(uxPos - ofsLeft, hPos + labelHeight, 0.0);
glVertex3f(uxPos - ofsLeft, -1.0, 0.0);
@@ -128,19 +133,25 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGB3f color, lo
glColor4f(1.0, 1.0, 1.0, 0.8);
std::string demodLabel = demod->getLabel();
if (demod->isMuted()) {
demodLabel = std::string("[M] ") + demodLabel;
}
if (demod->getDemodulatorType() == DEMOD_TYPE_USB) {
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_LEFT, GLFont::GLFONT_ALIGN_CENTER);
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodLabel, uxPos, hPos, 16, GLFont::GLFONT_ALIGN_LEFT, GLFont::GLFONT_ALIGN_CENTER);
} else if (demod->getDemodulatorType() == DEMOD_TYPE_LSB) {
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodLabel, uxPos, hPos, 16, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
} else {
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodLabel, uxPos, hPos, 16, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
}
glDisable(GL_BLEND);
}
void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGB3f color, long long center_freq, long long srate) {
void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBA4f color, long long center_freq, long long srate) {
if (!demod) {
return;
}
@@ -283,14 +294,14 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGB3f color, long l
glColor3f(0, 0, 0);
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5) + xOfs, -1.0 + hPos - yOfs, 16, demodAlign,
GLFont::GLFONT_ALIGN_CENTER);
glColor3f(0.8, 0.8, 0.8);
glColor3f(1, 1, 1);
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5), -1.0 + hPos, 16, demodAlign, GLFont::GLFONT_ALIGN_CENTER);
glDisable(GL_BLEND);
}
void PrimaryGLContext::DrawFreqSelector(float uxPos, RGB3f color, float w, long long center_freq, long long srate) {
void PrimaryGLContext::DrawFreqSelector(float uxPos, RGBA4f color, float w, long long center_freq, long long srate) {
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
long long bw = 0;
@@ -341,7 +352,7 @@ void PrimaryGLContext::DrawFreqSelector(float uxPos, RGB3f color, float w, long
}
void PrimaryGLContext::DrawRangeSelector(float uxPos1, float uxPos2, RGB3f color) {
void PrimaryGLContext::DrawRangeSelector(float uxPos1, float uxPos2, RGBA4f color) {
if (uxPos2 < uxPos1) {
float temp = uxPos2;
uxPos2=uxPos1;
+4 -4
View File
@@ -21,10 +21,10 @@ public:
void BeginDraw(float r, float g, float b);
void EndDraw();
void DrawFreqSelector(float uxPos, RGB3f color, float w = 0, long long center_freq = -1, long long srate = 0);
void DrawRangeSelector(float uxPos1, float uxPos2, RGB3f color);
void DrawDemod(DemodulatorInstance *demod, RGB3f color, long long center_freq = -1, long long srate = 0);
void DrawDemodInfo(DemodulatorInstance *demod, RGB3f color, 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 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 setHoverAlpha(float hoverAlpha);
+187 -11
View File
@@ -14,24 +14,65 @@
#include "CubicSDRDefs.h"
#include "AppFrame.h"
#include <algorithm>
#include <cmath>
wxBEGIN_EVENT_TABLE(ScopeCanvas, wxGLCanvas) EVT_PAINT(ScopeCanvas::OnPaint)
EVT_IDLE(ScopeCanvas::OnIdle)
EVT_MOTION(ScopeCanvas::OnMouseMoved)
EVT_LEFT_DOWN(ScopeCanvas::OnMouseDown)
EVT_LEFT_UP(ScopeCanvas::OnMouseReleased)
EVT_RIGHT_DOWN(ScopeCanvas::OnMouseRightDown)
EVT_RIGHT_UP(ScopeCanvas::OnMouseRightReleased)
EVT_LEAVE_WINDOW(ScopeCanvas::OnMouseLeftWindow)
EVT_ENTER_WINDOW(ScopeCanvas::OnMouseEnterWindow)
wxEND_EVENT_TABLE()
ScopeCanvas::ScopeCanvas(wxWindow *parent, int *attribList) :
wxGLCanvas(parent, wxID_ANY, attribList, wxDefaultPosition, wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE), stereo(false), ppmMode(false) {
ScopeCanvas::ScopeCanvas(wxWindow *parent, int *attribList) : InteractiveCanvas(parent, attribList), stereo(false), ppmMode(false), ctr(0), ctrTarget(0), dragAccel(0), helpTip("") {
glContext = new ScopeContext(this, &wxGetApp().GetContext(this));
inputData.set_max_num_items(1);
inputData.set_max_num_items(2);
bgPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_Y);
bgPanel.setSize(1.0, 0.5);
bgPanel.setPosition(0.0, -0.5);
panelSpacing = 0.4;
parentPanel.addChild(&scopePanel);
parentPanel.addChild(&spectrumPanel);
parentPanel.setFill(GLPanel::GLPANEL_FILL_NONE);
scopePanel.setSize(1.0,-1.0);
spectrumPanel.setSize(1.0,-1.0);
spectrumPanel.setShowDb(true);
}
ScopeCanvas::~ScopeCanvas() {
}
bool ScopeCanvas::scopeVisible() {
float panelInterval = (2.0 + panelSpacing);
ctrTarget = abs(round(ctr / panelInterval));
if (ctrTarget == 0 || dragAccel || (ctr != ctrTarget)) {
return true;
}
return false;
}
bool ScopeCanvas::spectrumVisible() {
float panelInterval = (2.0 + panelSpacing);
ctrTarget = abs(round(ctr / panelInterval));
if (ctrTarget == 1 || dragAccel || (ctr != ctrTarget)) {
return true;
}
return false;
}
void ScopeCanvas::setStereo(bool state) {
stereo = state;
}
@@ -49,20 +90,40 @@ bool ScopeCanvas::getPPMMode() {
return ppmMode;
}
void ScopeCanvas::setShowDb(bool showDb) {
this->showDb = showDb;
}
bool ScopeCanvas::getShowDb() {
return showDb;
}
void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
wxPaintDC dc(this);
const wxSize ClientSize = GetClientSize();
if (!inputData.empty()) {
while (!inputData.empty()) {
ScopeRenderData *avData;
inputData.pop(avData);
if (avData) {
if (!avData->spectrum) {
if (avData->waveform_points.size()) {
scopePanel.setPoints(avData->waveform_points);
setStereo(avData->channels == 2);
}
avData->decRefCount();
} else {
if (avData->waveform_points.size()) {
spectrumPanel.setPoints(avData->waveform_points);
spectrumPanel.setFloorValue(avData->fft_floor);
spectrumPanel.setCeilValue(avData->fft_ceil);
spectrumPanel.setBandwidth((avData->sampleRate/2)*1000);
spectrumPanel.setFreq((avData->sampleRate/4)*1000);
spectrumPanel.setFFTSize(avData->fft_size);
spectrumPanel.setShowDb(showDb);
}
avData->decRefCount();
}
}
@@ -71,21 +132,95 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
initGLExtensions();
glViewport(0, 0, ClientSize.x, ClientSize.y);
glContext->DrawBegin();
bgPanel.setFillColor(ThemeMgr::mgr.currentTheme->scopeBackground * 3.0, RGBA4f(0,0,0,0));
bgPanel.calcTransform(CubicVR::mat4::identity());
bgPanel.draw();
scopePanel.setMode(stereo?ScopePanel::SCOPE_MODE_2Y:ScopePanel::SCOPE_MODE_Y);
scopePanel.calcTransform(CubicVR::mat4::identity());
scopePanel.draw();
glContext->DrawTunerTitles(ppmMode);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glLoadMatrixf(CubicVR::mat4::perspective(45.0, 1.0, 1.0, 1000.0));
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
CubicVR::mat4 modelView = CubicVR::mat4::lookat(0, 0, -1.205, 0, 0, 0, 0, -1, 0);
float panelWidth = 1.0;
float panelInterval = (panelWidth * 2.0 + panelSpacing);
if (!mouseTracker.mouseDown()) {
ctrTarget = round(ctr / panelInterval);
if (ctrTarget < -1.0) {
ctrTarget = -1.0;
} else if (ctrTarget > 0.0) {
ctrTarget = 0.0;
}
ctrTarget *= panelInterval;
if (!dragAccel) {
if (ctr != ctrTarget) {
ctr += (ctrTarget-ctr)*0.2;
}
if (abs(ctr - ctrTarget) < 0.001) {
ctr=ctrTarget;
}
} else {
dragAccel -= dragAccel * 0.1;
if ((abs(dragAccel) < 0.2) || (ctr < (ctrTarget-panelInterval/2.0)) || (ctr > (ctrTarget+panelInterval/2.0)) ) {
dragAccel = 0;
} else {
ctr += dragAccel;
}
}
}
float roty = 0;
scopePanel.setPosition(ctr, 0);
if (scopeVisible()) {
scopePanel.contentsVisible = true;
roty = atan2(scopePanel.pos[0],1.2);
scopePanel.rot[1] = -(roty * (180.0 / M_PI));
} else {
scopePanel.contentsVisible = false;
}
spectrumPanel.setPosition(panelInterval+ctr, 0);
if (spectrumVisible()) {
spectrumPanel.setFillColor(ThemeMgr::mgr.currentTheme->scopeBackground * 2.0, RGBA4f(0,0,0,0));
spectrumPanel.contentsVisible = true;
roty = atan2(spectrumPanel.pos[0],1.2);
spectrumPanel.rot[1] = -(roty * (180.0 / M_PI));
} else {
spectrumPanel.contentsVisible = false;
}
parentPanel.calcTransform(modelView);
parentPanel.draw();
if (spectrumVisible()) {
spectrumPanel.drawChildren();
}
glLoadMatrixf(scopePanel.transform);
if (!deviceName.empty()) {
glContext->DrawDeviceName(deviceName);
}
glContext->DrawEnd();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glContext->DrawTunerTitles(ppmMode);
glContext->DrawEnd();
SwapBuffers();
}
void ScopeCanvas::OnIdle(wxIdleEvent &event) {
Refresh();
event.RequestMore();
@@ -94,3 +229,44 @@ void ScopeCanvas::OnIdle(wxIdleEvent &event) {
ScopeRenderDataQueue *ScopeCanvas::getInputQueue() {
return &inputData;
}
void ScopeCanvas::OnMouseMoved(wxMouseEvent& event) {
InteractiveCanvas::OnMouseMoved(event);
if (mouseTracker.mouseDown()) {
dragAccel = 4.0*mouseTracker.getDeltaMouseX();
ctr += dragAccel;
}
}
void ScopeCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
}
void ScopeCanvas::OnMouseDown(wxMouseEvent& event) {
InteractiveCanvas::OnMouseDown(event);
}
void ScopeCanvas::OnMouseReleased(wxMouseEvent& event) {
InteractiveCanvas::OnMouseReleased(event);
}
void ScopeCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
InteractiveCanvas::OnMouseEnterWindow(event);
if (!helpTip.empty()) {
setStatusText(helpTip);
}
SetCursor(wxCURSOR_SIZEWE);
}
void ScopeCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
InteractiveCanvas::OnMouseLeftWindow(event);
}
void ScopeCanvas::setHelpTip(std::string tip) {
helpTip = tip;
}
+26 -1
View File
@@ -9,9 +9,11 @@
#include "ScopeContext.h"
#include "ScopeVisualProcessor.h"
#include "ScopePanel.h"
#include "SpectrumPanel.h"
#include "fftw3.h"
#include "InteractiveCanvas.h"
class ScopeCanvas: public wxGLCanvas {
class ScopeCanvas: public InteractiveCanvas {
public:
ScopeCanvas(wxWindow *parent, int *attribList = NULL);
~ScopeCanvas();
@@ -21,18 +23,41 @@ public:
void setPPMMode(bool ppmMode);
bool getPPMMode();
void setShowDb(bool showDb);
bool getShowDb();
bool scopeVisible();
bool spectrumVisible();
void setHelpTip(std::string tip);
ScopeRenderDataQueue *getInputQueue();
private:
void OnPaint(wxPaintEvent& event);
void OnIdle(wxIdleEvent &event);
void OnMouseMoved(wxMouseEvent& event);
void OnMouseWheelMoved(wxMouseEvent& event);
void OnMouseDown(wxMouseEvent& event);
void OnMouseReleased(wxMouseEvent& event);
void OnMouseEnterWindow(wxMouseEvent& event);
void OnMouseLeftWindow(wxMouseEvent& event);
ScopeRenderDataQueue inputData;
ScopePanel scopePanel;
GLPanel parentPanel;
SpectrumPanel spectrumPanel;
GLPanel bgPanel;
ScopeContext *glContext;
std::string deviceName;
bool stereo;
bool ppmMode;
bool showDb;
float panelSpacing;
float ctr;
float ctrTarget;
float dragAccel;
std::string helpTip;
// event table
wxDECLARE_EVENT_TABLE();
};
+14 -2
View File
@@ -73,6 +73,8 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
spectrumPanel.calcTransform(CubicVR::mat4::identity());
spectrumPanel.draw();
glLoadIdentity();
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
for (int i = 0, iMax = demods.size(); i < iMax; i++) {
@@ -81,6 +83,8 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
glContext->EndDraw();
spectrumPanel.drawChildren();
SwapBuffers();
}
@@ -122,10 +126,18 @@ void SpectrumCanvas::moveCenterFrequency(long long freqChange) {
freq -= freqChange;
}
wxGetApp().setFrequency(freq);
setStatusText("Set center frequency: %s", freq);
}
}
void SpectrumCanvas::setShowDb(bool showDb) {
spectrumPanel.setShowDb(showDb);
}
bool SpectrumCanvas::getShowDb() {
return spectrumPanel.getShowDb();
}
void SpectrumCanvas::OnMouseMoved(wxMouseEvent& event) {
InteractiveCanvas::OnMouseMoved(event);
if (mouseTracker.mouseDown()) {
@@ -135,7 +147,7 @@ void SpectrumCanvas::OnMouseMoved(wxMouseEvent& event) {
moveCenterFrequency(freqChange);
}
} else {
setStatusText("Click and drag to adjust center frequency.");
setStatusText("Click and drag to adjust center frequency. 'B' to toggle decibels display.");
}
}
+3
View File
@@ -19,6 +19,9 @@ public:
void attachWaterfallCanvas(WaterfallCanvas *canvas_in);
void moveCenterFrequency(long long freqChange);
void setShowDb(bool showDb);
bool getShowDb();
SpectrumVisualDataQueue *getVisualDataQueue();
private:
+4 -4
View File
@@ -98,10 +98,10 @@ void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
0.75, mouseTracker.getOriginMouseX(), mouseTracker.getMouseX());
}
RGB3f clr = top ? ThemeMgr::mgr.currentTheme->tuningBarUp : ThemeMgr::mgr.currentTheme->tuningBarDown;
RGBA4f clr = top ? ThemeMgr::mgr.currentTheme->tuningBarUp : ThemeMgr::mgr.currentTheme->tuningBarDown;
RGB3f clrDark = ThemeMgr::mgr.currentTheme->tuningBarDark;
RGB3f clrMid = ThemeMgr::mgr.currentTheme->tuningBarLight;
RGBA4f clrDark = ThemeMgr::mgr.currentTheme->tuningBarDark;
RGBA4f clrMid = ThemeMgr::mgr.currentTheme->tuningBarLight;
glContext->DrawTunerBarIndexed(1, 3, 11, freqDP, freqW, clrMid, 0.25, true, true); // freq
glContext->DrawTunerBarIndexed(4, 6, 11, freqDP, freqW, clrDark, 0.25, true, true);
@@ -143,7 +143,7 @@ void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
glContext->DrawTuner(freq, 11, freqDP, freqW);
int snap = wxGetApp().getFrequencySnap();
if (snap != 1) {
glContext->DrawTunerDigitBox((int)log10(snap), 11, freqDP, freqW, RGB3f(1.0,0.0,0.0));
glContext->DrawTunerDigitBox((int)log10(snap), 11, freqDP, freqW, RGBA4f(1.0,0.0,0.0));
}
}
glContext->DrawTuner(bw, 7, bwDP, bwW);
+2 -2
View File
@@ -112,7 +112,7 @@ void TuningContext::DrawTuner(long long freq, int count, float displayPos, float
}
void TuningContext::DrawTunerDigitBox(int index, int count, float displayPos, float displayWidth, RGB3f c) {
void TuningContext::DrawTunerDigitBox(int index, int count, float displayPos, float displayWidth, RGBA4f c) {
GLint vp[4];
glGetIntegerv( GL_VIEWPORT, vp);
@@ -152,7 +152,7 @@ int TuningContext::GetTunerDigitIndex(float mPos, int count, float displayPos, f
return count - index;
}
void TuningContext::DrawTunerBarIndexed(int start, int end, int count, float displayPos, float displayWidth, RGB3f color, float alpha, bool top,
void TuningContext::DrawTunerBarIndexed(int start, int end, int count, float displayPos, float displayWidth, RGBA4f color, float alpha, bool top,
bool bottom) {
float ofs = (displayWidth / (float) count);
float p2 = displayPos + ofs * (float) (count - start + 1);
+2 -2
View File
@@ -14,9 +14,9 @@ public:
void DrawBegin();
void Draw(float r, float g, float b, float a, float p1, float p2);
void DrawTuner(long long freq, int count, float displayPos, float displayWidth);
void DrawTunerDigitBox(int index, int count, float displayPos, float displayWidth, RGB3f c);
void DrawTunerDigitBox(int index, int count, float displayPos, float displayWidth, RGBA4f c);
int GetTunerDigitIndex(float mPos, int count, float displayPos, float displayWidth);
void DrawTunerBarIndexed(int start, int end, int count, float displayPos, float displayWidth, RGB3f color, float alpha, bool top, bool bottom);
void DrawTunerBarIndexed(int start, int end, int count, float displayPos, float displayWidth, RGBA4f color, float alpha, bool top, bool bottom);
void DrawDemodFreqBw(long long freq, unsigned int bw, long long center);
void DrawEnd();
+77 -38
View File
@@ -36,7 +36,7 @@ wxEND_EVENT_TABLE()
WaterfallCanvas::WaterfallCanvas(wxWindow *parent, int *attribList) :
InteractiveCanvas(parent, attribList), dragState(WF_DRAG_NONE), nextDragState(WF_DRAG_NONE), fft_size(0), waterfall_lines(0),
dragOfs(0), mouseZoom(1), zoom(1), hoverAlpha(1.0) {
dragOfs(0), mouseZoom(1), zoom(1), freqMove(0.0), freqMoving(false), hoverAlpha(1.0) {
glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this));
@@ -102,6 +102,19 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
}
}
if (freqMove != 0.0) {
long long newFreq = getCenterFrequency() + (long long)((long double)getBandwidth()*freqMove) * 0.01;
updateCenterFrequency(newFreq);
if (!freqMoving) {
freqMove -= (freqMove * 0.2);
if (fabs(freqMove) < 0.01) {
freqMove = 0.0;
}
}
}
long long bw;
if (currentZoom != 1) {
long long freq = wxGetApp().getFrequency();
@@ -161,7 +174,13 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
if (spectrumCanvas) {
if ((spectrumCanvas->getCenterFrequency() != centerFreq) || (spectrumCanvas->getBandwidth() != bw)) {
spectrumCanvas->setView(centerFreq,bw);
if (getViewState()) {
spectrumCanvas->setView(centerFreq,bw);
} else {
spectrumCanvas->disableView();
spectrumCanvas->setCenterFrequency(centerFreq);
spectrumCanvas->setBandwidth(bw);
}
}
}
}
@@ -274,6 +293,12 @@ void WaterfallCanvas::OnKeyUp(wxKeyEvent& event) {
zoom = 1.0;
mouseZoom = 1.05;
break;
case WXK_LEFT:
case WXK_NUMPAD_LEFT:
case WXK_RIGHT:
case WXK_NUMPAD_RIGHT:
freqMoving = false;
break;
}
}
@@ -300,18 +325,20 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
break;
case WXK_RIGHT:
case WXK_NUMPAD_RIGHT:
if (shiftDown) {
freq += getBandwidth() * 10;
if (isView) {
freqMove = shiftDown?5.0:1.0;
freqMoving = true;
} else {
freq += getBandwidth() / 2;
freq += shiftDown?(getBandwidth() * 10):(getBandwidth() / 2);
}
break;
case WXK_LEFT:
case WXK_NUMPAD_LEFT:
if (shiftDown) {
freq -= getBandwidth() * 10;
if (isView) {
freqMove = shiftDown?-5.0:-1.0;
freqMoving = true;
} else {
freq -= getBandwidth() / 2;
freq -= shiftDown?(getBandwidth() * 10):(getBandwidth() / 2);
}
break;
case 'D':
@@ -322,6 +349,12 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
wxGetApp().removeDemodulator(activeDemod);
wxGetApp().getDemodMgr().deleteThread(activeDemod);
break;
case 'M':
if (!activeDemod) {
break;
}
activeDemod->setMuted(!activeDemod->isMuted());
break;
case 'S':
if (!activeDemod) {
break;
@@ -332,6 +365,11 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
activeDemod->setStereo(true);
}
break;
case 'B':
if (spectrumCanvas) {
spectrumCanvas->setShowDb(!spectrumCanvas->getShowDb());
}
break;
case WXK_SPACE:
wxGetApp().showFrequencyInput();
break;
@@ -346,30 +384,7 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
}
if (freq != originalFreq) {
if (isView) {
setView(freq, getBandwidth());
if (spectrumCanvas) {
spectrumCanvas->setView(freq, getBandwidth());
}
long long minFreq = wxGetApp().getFrequency()-(wxGetApp().getSampleRate()/2);
long long maxFreq = wxGetApp().getFrequency()+(wxGetApp().getSampleRate()/2);
if (freq < minFreq) {
wxGetApp().setFrequency(freq+(wxGetApp().getSampleRate()/2));
setStatusText("Set center frequency: %s", freq);
}
if (freq > maxFreq) {
wxGetApp().setFrequency(freq-(wxGetApp().getSampleRate()/2));
setStatusText("Set center frequency: %s", freq);
}
} else {
if (spectrumCanvas) {
spectrumCanvas->setCenterFrequency(freq);
}
wxGetApp().setFrequency(freq);
setStatusText("Set center frequency: %s", freq);
}
updateCenterFrequency(freq);
}
}
@@ -406,7 +421,6 @@ void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {
}
demod->setBandwidth(currentBW);
setStatusText("Set demodulator bandwidth: %s", demod->getBandwidth());
}
if (dragState == WF_DRAG_FREQUENCY) {
@@ -424,8 +438,6 @@ void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {
currentFreq = demod->getFrequency();
demod->updateLabel(currentFreq);
}
setStatusText("Set demodulator frequency: %s", demod->getFrequency());
}
} else if (mouseTracker.mouseRightDown()) {
mouseZoom = mouseZoom + ((1.0 - (mouseTracker.getDeltaMouseY() * 4.0)) - mouseZoom) * 0.1;
@@ -505,14 +517,14 @@ void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {
mouseTracker.setVertDragLock(true);
mouseTracker.setHorizDragLock(false);
setStatusText("Click and drag to change demodulator bandwidth. SPACE for direct frequency input. D to delete, S for stereo.");
setStatusText("Click and drag to change demodulator bandwidth. SPACE for direct frequency input. M for mute, D to delete, S for stereo.");
} else {
SetCursor(wxCURSOR_SIZING);
nextDragState = WF_DRAG_FREQUENCY;
mouseTracker.setVertDragLock(true);
mouseTracker.setHorizDragLock(false);
setStatusText("Click and drag to change demodulator frequency; SPACE for direct input. D to delete, S for stereo.");
setStatusText("Click and drag to change demodulator frequency; SPACE for direct input. M for mute, D to delete, S for stereo.");
}
} else {
SetCursor(wxCURSOR_CROSS);
@@ -521,7 +533,7 @@ void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {
setStatusText("Click to create a new demodulator or hold ALT to drag range, SPACE for direct center frequency input.");
} else {
setStatusText(
"Click to move active demodulator frequency or hold ALT to drag range; hold SHIFT to create new. Right drag or A / Z to Zoom. Arrow keys (+SHIFT) to move center frequency; SPACE for direct input.");
"Click to move active demodulator frequency or hold ALT to drag range; hold SHIFT to create new. Right drag or wheel to Zoom. Arrow keys to navigate/zoom.");
}
}
@@ -600,6 +612,7 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
demod->setSquelchEnabled(mgr->isLastSquelchEnabled());
demod->setStereo(mgr->isLastStereo());
demod->setGain(mgr->getLastGain());
demod->setMuted(mgr->isLastMuted());
demod->run();
@@ -740,3 +753,29 @@ void WaterfallCanvas::OnMouseRightReleased(wxMouseEvent& event) {
SpectrumVisualDataQueue *WaterfallCanvas::getVisualDataQueue() {
return &visualDataQueue;
}
void WaterfallCanvas::updateCenterFrequency(long long freq) {
if (isView) {
setView(freq, getBandwidth());
if (spectrumCanvas) {
spectrumCanvas->setView(freq, getBandwidth());
}
long long minFreq = wxGetApp().getFrequency()-(wxGetApp().getSampleRate()/2);
long long maxFreq = wxGetApp().getFrequency()+(wxGetApp().getSampleRate()/2);
if (freq < minFreq) {
wxGetApp().setFrequency(freq+(wxGetApp().getSampleRate()/2));
}
if (freq > maxFreq) {
wxGetApp().setFrequency(freq-(wxGetApp().getSampleRate()/2));
}
} else {
if (spectrumCanvas) {
spectrumCanvas->setCenterFrequency(freq);
}
wxGetApp().setFrequency(freq);
}
}
+4
View File
@@ -45,6 +45,8 @@ private:
void OnMouseEnterWindow(wxMouseEvent& event);
void OnMouseLeftWindow(wxMouseEvent& event);
void updateCenterFrequency(long long freq);
std::vector<float> spectrum_points;
SpectrumCanvas *spectrumCanvas;
@@ -59,6 +61,8 @@ private:
int dragOfs;
float mouseZoom, zoom;
bool freqMoving;
long double freqMove;
float hoverAlpha;
SpectrumVisualDataQueue visualDataQueue;