Merge ui panel code and refactoring

This commit is contained in:
Charles J. Cliffe
2015-07-30 21:53:29 -04:00
70 changed files with 3520 additions and 693 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 = 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);
tuningBarLight = RGBColor(0.2, 0.2, 0.9);
tuningBarDark = RGBColor(0.0, 0.0, 0.35);
tuningBarUp = RGBColor(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGBColor(148.0/255.0, 148.0/255.0, 1.0);
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);
waterfallHighlight = RGB(1, 1, 1);
waterfallNew = RGB(0, 1, 0);
waterfallHover = RGB(1, 1, 0);
waterfallDestroy = RGB(1, 0, 0);
fftLine = RGB(0.9, 0.9, 0.9);
fftHighlight = RGB(1, 1, 1);
scopeLine = RGB(0.9, 0.9, 0.9);
tuningBarLight = RGB(0.2, 0.2, 0.9);
tuningBarDark = RGB(0.0, 0.0, 0.35);
tuningBarUp = RGB(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGB(148.0/255.0, 148.0/255.0, 1.0);
meterLevel = RGB(0.1, 0.75, 0.1);
meterValue = RGB(0.75, 0.1, 0.1);
text = RGB(1, 1, 1);
freqLine = RGB(1, 1, 1);
button = RGB(0.65, 0.65, 0.65);
buttonHighlight = RGB(1, 1, 0);
scopeBackground = RGBColor(0.1, 0.1, 0.1);
fftBackground = RGBColor(0.1, 0.1, 0.1);
generalBackground = RGBColor(0.1, 0.1, 0.1);
scopeBackground = RGB(0.1, 0.1, 0.1);
fftBackground = RGB(0.1, 0.1, 0.1);
generalBackground = RGB(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 = RGBColor(1, 1, 1);
waterfallNew = RGBColor(0, 1, 0);
waterfallHover = RGBColor(1, 1, 0);
waterfallDestroy = RGBColor(1, 0, 0);
fftLine = RGBColor(0.8, 1.0, 0.8);
fftHighlight = RGBColor(1, 1, 1);
scopeLine = RGBColor(0.8, 1.0, 0.8);
tuningBarLight = RGBColor(0.0, 0.45, 0.0);
tuningBarDark = RGBColor(0.0, 0.1, 0.0);
tuningBarUp = RGBColor(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGBColor(148.0/255.0, 0.0, 0.0);
meterLevel = RGBColor(0, 0.5, 0);
meterValue = RGBColor(0, 0.5, 0);
text = RGBColor(0.8, 1.0, 0.8);
freqLine = RGBColor(1, 1, 1);
button = RGBColor(0.65, 0.75, 0.65);
buttonHighlight = RGBColor(0.65, 1.0, 0.65);
waterfallHighlight = RGB(1, 1, 1);
waterfallNew = RGB(0, 1, 0);
waterfallHover = RGB(1, 1, 0);
waterfallDestroy = RGB(1, 0, 0);
fftLine = RGB(0.8, 1.0, 0.8);
fftHighlight = RGB(1, 1, 1);
scopeLine = RGB(0.8, 1.0, 0.8);
tuningBarLight = RGB(0.0, 0.45, 0.0);
tuningBarDark = RGB(0.0, 0.1, 0.0);
tuningBarUp = RGB(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGB(148.0/255.0, 0.0, 0.0);
meterLevel = RGB(0, 0.5, 0);
meterValue = RGB(0, 0.5, 0);
text = RGB(0.8, 1.0, 0.8);
freqLine = RGB(1, 1, 1);
button = RGB(0.65, 0.75, 0.65);
buttonHighlight = RGB(0.65, 1.0, 0.65);
scopeBackground = RGBColor(0.05, 0.1, 0.05);
fftBackground = RGBColor(0.05, 0.1, 0.05);
generalBackground = RGBColor(0.05, 0.1, 0.05);
scopeBackground = RGB(0.05, 0.1, 0.05);
fftBackground = RGB(0.05, 0.1, 0.05);
generalBackground = RGB(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 = RGBColor(1, 1, 0.9);
waterfallNew = RGBColor(0, 1, 0);
waterfallHover = RGBColor(1, 1, 0);
waterfallDestroy = RGBColor(1, 0, 0);
fftLine = RGBColor(0.9, 0.9, 0.9);
fftHighlight = RGBColor(1, 1, 0.9);
scopeLine = RGBColor(0.9, 0.9, 0.9);
tuningBarLight = RGBColor(0.4, 0.4, 0.4);
tuningBarDark = RGBColor(0.1, 0.1, 0.1);
tuningBarUp = RGBColor(0.8, 0.8, 0.8);
tuningBarDown = RGBColor(0.4, 0.4, 0.4);
meterLevel = RGBColor(0.5, 0.5, 0.5);
meterValue = RGBColor(0.5, 0.5, 0.5);
text = RGBColor(1, 1, 1);
freqLine = RGBColor(1, 1, 1);
button = RGBColor(0.65, 0.65, 0.65);
buttonHighlight = RGBColor(1, 1, 1);
waterfallHighlight = RGB(1, 1, 0.9);
waterfallNew = RGB(0, 1, 0);
waterfallHover = RGB(1, 1, 0);
waterfallDestroy = RGB(1, 0, 0);
fftLine = RGB(0.9, 0.9, 0.9);
fftHighlight = RGB(1, 1, 0.9);
scopeLine = RGB(0.9, 0.9, 0.9);
tuningBarLight = RGB(0.4, 0.4, 0.4);
tuningBarDark = RGB(0.1, 0.1, 0.1);
tuningBarUp = RGB(0.8, 0.8, 0.8);
tuningBarDown = RGB(0.4, 0.4, 0.4);
meterLevel = RGB(0.5, 0.5, 0.5);
meterValue = RGB(0.5, 0.5, 0.5);
text = RGB(1, 1, 1);
freqLine = RGB(1, 1, 1);
button = RGB(0.65, 0.65, 0.65);
buttonHighlight = RGB(1, 1, 1);
scopeBackground = RGBColor(0.1, 0.1, 0.1);
fftBackground = RGBColor(0.1, 0.1, 0.1);
generalBackground = RGBColor(0.1, 0.1, 0.1);
scopeBackground = RGB(0.1, 0.1, 0.1);
fftBackground = RGB(0.1, 0.1, 0.1);
generalBackground = RGB(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 = RGBColor(0.9, 0.9, 1.0);
waterfallNew = RGBColor(0, 1, 0);
waterfallHover = RGBColor(1, 1, 0);
waterfallDestroy = RGBColor(1, 0, 0);
fftLine = RGBColor(0.9, 0.9, 1.0);
fftHighlight = RGBColor(0.9, 0.9, 1.0);
scopeLine = RGBColor(0.85, 0.85, 1.0);
tuningBarLight = RGBColor(28.0 / 255.0, 106.0 / 255.0, 179.0 / 255.0);
tuningBarDark = RGBColor(14.0 / 255.0, 53.0 / 255.0, 89.5 / 255.0);
tuningBarUp = RGBColor(0.7, 0.7, 0.7);
tuningBarDown = RGBColor(1.0, 0.0, 0.0);
meterLevel = RGBColor(28.0 / 255.0, 106.0 / 255.0, 179.0 / 255.0);
meterValue = RGBColor(190.0 / 255.0, 190.0 / 255.0, 60.0 / 255.0);
text = RGBColor(0.9, 0.9, 1);
freqLine = RGBColor(0.85, 0.85, 1.0);
button = RGBColor(217.0 / 255.0, 218.0 / 255.0, 228.0 / 255.0);
buttonHighlight = RGBColor(208.0 / 255.0, 249.0 / 255.0, 255.0 / 255.0);
waterfallHighlight = RGB(0.9, 0.9, 1.0);
waterfallNew = RGB(0, 1, 0);
waterfallHover = RGB(1, 1, 0);
waterfallDestroy = RGB(1, 0, 0);
fftLine = RGB(0.9, 0.9, 1.0);
fftHighlight = RGB(0.9, 0.9, 1.0);
scopeLine = RGB(0.85, 0.85, 1.0);
tuningBarLight = RGB(28.0 / 255.0, 106.0 / 255.0, 179.0 / 255.0);
tuningBarDark = RGB(14.0 / 255.0, 53.0 / 255.0, 89.5 / 255.0);
tuningBarUp = RGB(0.7, 0.7, 0.7);
tuningBarDown = RGB(1.0, 0.0, 0.0);
meterLevel = RGB(28.0 / 255.0, 106.0 / 255.0, 179.0 / 255.0);
meterValue = RGB(190.0 / 255.0, 190.0 / 255.0, 60.0 / 255.0);
text = RGB(0.9, 0.9, 1);
freqLine = RGB(0.85, 0.85, 1.0);
button = RGB(217.0 / 255.0, 218.0 / 255.0, 228.0 / 255.0);
buttonHighlight = RGB(208.0 / 255.0, 249.0 / 255.0, 255.0 / 255.0);
scopeBackground = RGBColor(0.05, 0.05, 0.15);
fftBackground = RGBColor(0.05, 0.05, 0.15);
generalBackground = RGBColor(0.05, 0.05, 0.15);
scopeBackground = RGB(0.05, 0.05, 0.15);
fftBackground = RGB(0.05, 0.05, 0.15);
generalBackground = RGB(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 = RGBColor(1, 1, 1);
waterfallNew = RGBColor(0, 1, 0);
waterfallHover = RGBColor(1, 1, 0);
waterfallDestroy = RGBColor(1, 0, 0);
fftLine = RGBColor(1.0, 0.9, 0.9);
fftHighlight = RGBColor(1, 1, 1);
scopeLine = RGBColor(1.0, 0.9, 0.9);
tuningBarLight = RGBColor(0.0, 0.45, 0.0);
tuningBarDark = RGBColor(0.0, 0.1, 0.0);
tuningBarUp = RGBColor(1.0, 0.0, 0.0);
tuningBarDown = RGBColor(0.0, 0.5, 1.0);
meterLevel = RGBColor(0, 0.5, 0);
meterValue = RGBColor(0.5, 0, 0);
text = RGBColor(1, 1, 1);
freqLine = RGBColor(1, 1, 1);
button = RGBColor(0.65, 0.65, 0.65);
buttonHighlight = RGBColor(0.76, 0.65, 0);
waterfallHighlight = RGB(1, 1, 1);
waterfallNew = RGB(0, 1, 0);
waterfallHover = RGB(1, 1, 0);
waterfallDestroy = RGB(1, 0, 0);
fftLine = RGB(1.0, 0.9, 0.9);
fftHighlight = RGB(1, 1, 1);
scopeLine = RGB(1.0, 0.9, 0.9);
tuningBarLight = RGB(0.0, 0.45, 0.0);
tuningBarDark = RGB(0.0, 0.1, 0.0);
tuningBarUp = RGB(1.0, 0.0, 0.0);
tuningBarDown = RGB(0.0, 0.5, 1.0);
meterLevel = RGB(0, 0.5, 0);
meterValue = RGB(0.5, 0, 0);
text = RGB(1, 1, 1);
freqLine = RGB(1, 1, 1);
button = RGB(0.65, 0.65, 0.65);
buttonHighlight = RGB(0.76, 0.65, 0);
scopeBackground = RGBColor(13.0 / 255.0, 47.0 / 255.0, 9.0 / 255.0);
fftBackground = RGBColor(0, 0, 50.0 / 255.0);
generalBackground = RGBColor(13.0 / 255.0, 47.0 / 255.0, 9.0 / 255.0);
scopeBackground = RGB(13.0 / 255.0, 47.0 / 255.0, 9.0 / 255.0);
fftBackground = RGB(0, 0, 50.0 / 255.0);
generalBackground = RGB(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 = RGBColor(1, 1, 1);
waterfallNew = RGBColor(0, 1, 0);
waterfallHover = RGBColor(1, 1, 0);
waterfallDestroy = RGBColor(1, 0, 0);
fftLine = RGBColor(234.0 / 255.0, 232.0 / 255.0, 247.0 / 255.0);
fftHighlight = RGBColor(1.0, 1.0, 1.0);
scopeLine = RGBColor(234.0 / 255.0, 232.0 / 255.0, 247.0 / 255.0);
tuningBarLight = RGBColor(0.2, 0.2, 0.7);
tuningBarDark = RGBColor(0.1, 0.1, 0.45);
tuningBarUp = RGBColor(0.5, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGBColor(0.6, 108.0/255.0, 1.0);
meterLevel = RGBColor(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
meterValue = RGBColor(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
text = RGBColor(1, 1, 1);
freqLine = RGBColor(1, 1, 1);
button = RGBColor(1.0, 1.0, 1.0);
buttonHighlight = RGBColor(208.0 / 255.0, 202.0 / 255.0, 247.0 / 255.0);
waterfallHighlight = RGB(1, 1, 1);
waterfallNew = RGB(0, 1, 0);
waterfallHover = RGB(1, 1, 0);
waterfallDestroy = RGB(1, 0, 0);
fftLine = RGB(234.0 / 255.0, 232.0 / 255.0, 247.0 / 255.0);
fftHighlight = RGB(1.0, 1.0, 1.0);
scopeLine = RGB(234.0 / 255.0, 232.0 / 255.0, 247.0 / 255.0);
tuningBarLight = RGB(0.2, 0.2, 0.7);
tuningBarDark = RGB(0.1, 0.1, 0.45);
tuningBarUp = RGB(0.5, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGB(0.6, 108.0/255.0, 1.0);
meterLevel = RGB(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
meterValue = RGB(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
text = RGB(1, 1, 1);
freqLine = RGB(1, 1, 1);
button = RGB(1.0, 1.0, 1.0);
buttonHighlight = RGB(208.0 / 255.0, 202.0 / 255.0, 247.0 / 255.0);
scopeBackground = RGBColor(39.0 / 255.0, 36.0 / 255.0, 56.0 / 255.0);
fftBackground = RGBColor(39.0 / 255.0, 36.0 / 255.0, 56.0 / 255.0);
generalBackground = RGBColor(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
scopeBackground = RGB(39.0 / 255.0, 36.0 / 255.0, 56.0 / 255.0);
fftBackground = RGB(39.0 / 255.0, 36.0 / 255.0, 56.0 / 255.0);
generalBackground = RGB(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 = 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);
tuningBarLight = RGBColor(0.4, 0.4, 1.0);
tuningBarDark = RGBColor(0.1, 0.1, 0.45);
tuningBarUp = RGBColor(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGBColor(148.0/255.0, 148.0/255.0, 1.0);
meterLevel = RGBColor(0, 0.5, 0);
meterValue = RGBColor(0.0, 0.0, 1.0);
text = RGBColor(1, 1, 1);
freqLine = RGBColor(1, 1, 1);
button = RGBColor(0, 0.7, 0.7);
buttonHighlight = RGBColor(1, 1, 1);
waterfallHighlight = RGB(1, 1, 1);
waterfallNew = RGB(0, 1, 0);
waterfallHover = RGB(1, 1, 0);
waterfallDestroy = RGB(1, 0, 0);
fftLine = RGB(0.9, 0.9, 0.9);
fftHighlight = RGB(1, 1, 1);
scopeLine = RGB(0.9, 0.9, 0.9);
tuningBarLight = RGB(0.4, 0.4, 1.0);
tuningBarDark = RGB(0.1, 0.1, 0.45);
tuningBarUp = RGB(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGB(148.0/255.0, 148.0/255.0, 1.0);
meterLevel = RGB(0, 0.5, 0);
meterValue = RGB(0.0, 0.0, 1.0);
text = RGB(1, 1, 1);
freqLine = RGB(1, 1, 1);
button = RGB(0, 0.7, 0.7);
buttonHighlight = RGB(1, 1, 1);
scopeBackground = RGBColor(0.0, 0.0, 48.0 / 255.0);
fftBackground = RGBColor(0.0, 0.0, 48.0 / 255.0);
generalBackground = RGBColor(0.0, 0.0, 0.0);
scopeBackground = RGB(0.0, 0.0, 48.0 / 255.0);
fftBackground = RGB(0.0, 0.0, 48.0 / 255.0);
generalBackground = RGB(0.0, 0.0, 0.0);
}
+27 -27
View File
@@ -15,21 +15,21 @@
#define COLOR_THEME_RADAR 6
#define COLOR_THEME_MAX 7
class RGBColor {
class RGB {
public:
float r, g, b;
RGBColor(float r, float g, float b) :
RGB(float r, float g, float b) :
r(r), g(g), b(b) {
}
RGBColor() :
RGBColor(0, 0, 0) {
RGB() :
RGB(0, 0, 0) {
}
~RGBColor() {
~RGB() {
}
RGBColor & operator=(const RGBColor &other) {
RGB & operator=(const RGB &other) {
r = other.r;
g = other.g;
b = other.b;
@@ -39,28 +39,28 @@ public:
class ColorTheme {
public:
RGBColor waterfallHighlight;
RGBColor waterfallNew;
RGBColor wfHighlight;
RGBColor waterfallHover;
RGBColor waterfallDestroy;
RGBColor fftLine;
RGBColor fftHighlight;
RGBColor scopeLine;
RGBColor tuningBarLight;
RGBColor tuningBarDark;
RGBColor tuningBarUp;
RGBColor tuningBarDown;
RGBColor meterLevel;
RGBColor meterValue;
RGBColor text;
RGBColor freqLine;
RGBColor button;
RGBColor buttonHighlight;
RGB waterfallHighlight;
RGB waterfallNew;
RGB wfHighlight;
RGB waterfallHover;
RGB waterfallDestroy;
RGB fftLine;
RGB fftHighlight;
RGB scopeLine;
RGB tuningBarLight;
RGB tuningBarDark;
RGB tuningBarUp;
RGB tuningBarDown;
RGB meterLevel;
RGB meterValue;
RGB text;
RGB freqLine;
RGB button;
RGB buttonHighlight;
RGBColor scopeBackground;
RGBColor fftBackground;
RGBColor generalBackground;
RGB scopeBackground;
RGB fftBackground;
RGB generalBackground;
Gradient waterfallGradient;
+1 -1
View File
@@ -25,7 +25,7 @@ EVT_ENTER_WINDOW(ModeSelectorCanvas::OnMouseEnterWindow)
wxEND_EVENT_TABLE()
ModeSelectorCanvas::ModeSelectorCanvas(wxWindow *parent, int *attribList) :
InteractiveCanvas(parent, attribList), currentSelection(-1), numChoices(0) {
InteractiveCanvas(parent, attribList), numChoices(0), currentSelection(-1) {
glContext = new ModeSelectorContext(this, &wxGetApp().GetContext(this));
}
+3 -3
View File
@@ -29,12 +29,12 @@ void ModeSelectorContext::DrawSelector(std::string label, int c, int cMax, bool
float viewHeight = (float) vp[3];
float viewWidth = (float) vp[2];
PrimaryGLContext::GLFontSize fontSize = GLFONT_SIZE16;
GLFont::GLFontSize fontSize = GLFont::GLFONT_SIZE16;
int fontHeight = 16;
if (viewWidth < 30) {
fontSize = GLFONT_SIZE12;
fontSize = GLFont::GLFONT_SIZE12;
fontHeight = 12;
}
@@ -56,7 +56,7 @@ void ModeSelectorContext::DrawSelector(std::string label, int c, int cMax, bool
glColor4f(0, 0, 0, a);
}
getFont(fontSize).drawString(label, 0.0, y + height / 2.0, fontHeight, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
GLFont::getFont(fontSize).drawString(label, 0.0, y + height / 2.0, fontHeight, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
}
void ModeSelectorContext::DrawEnd() {
+9 -45
View File
@@ -15,8 +15,6 @@
#include "AppFrame.h"
#include <algorithm>
GLFont PrimaryGLContext::fonts[GLFONT_MAX];
wxString PrimaryGLContext::glGetwxString(GLenum name) {
const GLubyte *v = glGetString(name);
if (v == 0) {
@@ -61,41 +59,7 @@ PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContex
//#endif
}
GLFont &PrimaryGLContext::getFont(GLFontSize esize) {
if (!fonts[esize].isLoaded()) {
std::string fontName;
switch (esize) {
case GLFONT_SIZE12:
fontName = "vera_sans_mono12.fnt";
break;
case GLFONT_SIZE16:
fontName = "vera_sans_mono16.fnt";
break;
case GLFONT_SIZE18:
fontName = "vera_sans_mono18.fnt";
break;
case GLFONT_SIZE24:
fontName = "vera_sans_mono24.fnt";
break;
case GLFONT_SIZE32:
fontName = "vera_sans_mono32.fnt";
break;
case GLFONT_SIZE48:
fontName = "vera_sans_mono48.fnt";
break;
default:
fontName = "vera_sans_mono12.fnt";
break;
}
fonts[esize].loadFont(fontName);
}
return fonts[esize];
}
void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGBColor color, long long center_freq, long long srate) {
void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGB color, long long center_freq, long long srate) {
if (!demod) {
return;
}
@@ -165,18 +129,18 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGBColor color,
glColor4f(1.0, 1.0, 1.0, 0.8);
if (demod->getDemodulatorType() == DEMOD_TYPE_USB) {
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_LEFT, GLFont::GLFONT_ALIGN_CENTER);
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_LEFT, GLFont::GLFONT_ALIGN_CENTER);
} else if (demod->getDemodulatorType() == DEMOD_TYPE_LSB) {
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
} else {
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
GLFont::getFont(GLFont::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
}
glDisable(GL_BLEND);
}
void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBColor color, long long center_freq, long long srate) {
void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGB color, long long center_freq, long long srate) {
if (!demod) {
return;
}
@@ -317,16 +281,16 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBColor color, lon
// }
glColor3f(0, 0, 0);
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5) + xOfs, -1.0 + hPos - yOfs, 16, demodAlign,
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);
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5), -1.0 + hPos, 16, demodAlign, GLFont::GLFONT_ALIGN_CENTER);
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, RGBColor color, float w, long long center_freq, long long srate) {
void PrimaryGLContext::DrawFreqSelector(float uxPos, RGB color, float w, long long center_freq, long long srate) {
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
long long bw = 0;
@@ -377,7 +341,7 @@ void PrimaryGLContext::DrawFreqSelector(float uxPos, RGBColor color, float w, lo
}
void PrimaryGLContext::DrawRangeSelector(float uxPos1, float uxPos2, RGBColor color) {
void PrimaryGLContext::DrawRangeSelector(float uxPos1, float uxPos2, RGB color) {
if (uxPos2 < uxPos1) {
float temp = uxPos2;
uxPos2=uxPos1;
+4 -10
View File
@@ -13,9 +13,6 @@
class PrimaryGLContext: public wxGLContext {
public:
enum GLFontSize {
GLFONT_SIZE12, GLFONT_SIZE16, GLFONT_SIZE18, GLFONT_SIZE24, GLFONT_SIZE32, GLFONT_SIZE48, GLFONT_MAX
};
PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext);
static wxString glGetwxString(GLenum name);
@@ -24,17 +21,14 @@ public:
void BeginDraw(float r, float g, float b);
void EndDraw();
void DrawFreqSelector(float uxPos, RGBColor color, float w = 0, long long center_freq = -1, long long srate = 0);
void DrawRangeSelector(float uxPos1, float uxPos2, RGBColor color);
void DrawDemod(DemodulatorInstance *demod, RGBColor color, long long center_freq = -1, long long srate = 0);
void DrawDemodInfo(DemodulatorInstance *demod, RGBColor color, long long center_freq = -1, long long srate = 0);
static GLFont &getFont(GLFontSize esize);
void DrawFreqSelector(float uxPos, RGB color, float w = 0, long long center_freq = -1, long long srate = 0);
void DrawRangeSelector(float uxPos1, float uxPos2, RGB color);
void DrawDemod(DemodulatorInstance *demod, RGB color, long long center_freq = -1, long long srate = 0);
void DrawDemodInfo(DemodulatorInstance *demod, RGB color, long long center_freq = -1, long long srate = 0);
void setHoverAlpha(float hoverAlpha);
private:
static GLFont fonts[GLFONT_MAX];
DemodulatorThreadParameters defaultDemodParams;
float hoverAlpha;
};
+4 -4
View File
@@ -81,9 +81,9 @@ void ScopeContext::Plot(std::vector<float> &points, bool stereo, bool ppmMode) {
glColor3f(0.65, 0.65, 0.65);
getFont(PrimaryGLContext::GLFONT_SIZE12).drawString(ppmMode?"Device PPM":"Frequency", -0.66, -1.0+hPos, 12, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
getFont(PrimaryGLContext::GLFONT_SIZE12).drawString("Bandwidth", 0.0, -1.0+hPos, 12, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
getFont(PrimaryGLContext::GLFONT_SIZE12).drawString("Center Frequency", 0.66, -1.0+hPos, 12, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
GLFont::getFont(GLFont::GLFONT_SIZE12).drawString(ppmMode?"Device PPM":"Frequency", -0.66, -1.0+hPos, 12, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
GLFont::getFont(GLFont::GLFONT_SIZE12).drawString("Bandwidth", 0.0, -1.0+hPos, 12, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
GLFont::getFont(GLFont::GLFONT_SIZE12).drawString("Center Frequency", 0.66, -1.0+hPos, 12, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
if (stereo) {
@@ -151,7 +151,7 @@ void ScopeContext::DrawDeviceName(std::string deviceName) {
float hPos = (float) (viewHeight - 20) / viewHeight;
glColor3f(0.65, 0.65, 0.65);
getFont(PrimaryGLContext::GLFONT_SIZE12).drawString(deviceName.c_str(), 1.0, hPos, 12, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
GLFont::getFont(GLFont::GLFONT_SIZE12).drawString(deviceName.c_str(), 1.0, hPos, 12, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
}
void ScopeContext::DrawEnd() {
+1 -1
View File
@@ -147,7 +147,7 @@ void SpectrumContext::Draw(std::vector<float> &points, long long freq, int bandw
glEnd();
glColor4f(ThemeMgr::mgr.currentTheme->text.r, ThemeMgr::mgr.currentTheme->text.g, ThemeMgr::mgr.currentTheme->text.b,1.0);
getFont(PrimaryGLContext::GLFONT_SIZE12).drawString(label.str(), m, hPos, 12, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
GLFont::getFont(GLFont::GLFONT_SIZE12).drawString(label.str(), m, hPos, 12, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
label.str(std::string());
+4 -4
View File
@@ -84,10 +84,10 @@ void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
0.75, mouseTracker.getOriginMouseX(), mouseTracker.getMouseX());
}
RGBColor clr = top ? ThemeMgr::mgr.currentTheme->tuningBarUp : ThemeMgr::mgr.currentTheme->tuningBarDown;
RGB clr = top ? ThemeMgr::mgr.currentTheme->tuningBarUp : ThemeMgr::mgr.currentTheme->tuningBarDown;
RGBColor clrDark = ThemeMgr::mgr.currentTheme->tuningBarDark;
RGBColor clrMid = ThemeMgr::mgr.currentTheme->tuningBarLight;
RGB clrDark = ThemeMgr::mgr.currentTheme->tuningBarDark;
RGB 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);
@@ -129,7 +129,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, RGBColor(1.0,0.0,0.0));
glContext->DrawTunerDigitBox((int)log10(snap), 11, freqDP, freqW, RGB(1.0,0.0,0.0));
}
}
glContext->DrawTuner(bw, 7, bwDP, bwW);
+7 -7
View File
@@ -74,19 +74,19 @@ void TuningContext::DrawTuner(long long freq, int count, float displayPos, float
freqStr << freq;
std::string freqChars = freqStr.str();
PrimaryGLContext::GLFontSize fontSize = GLFONT_SIZE24;
GLFont::GLFontSize fontSize = GLFont::GLFONT_SIZE24;
int fontHeight = 24;
if (viewHeight < 28) {
fontSize = GLFONT_SIZE18;
fontSize = GLFont::GLFONT_SIZE18;
fontHeight = 18;
}
if (viewHeight < 24) {
fontSize = GLFONT_SIZE16;
fontSize = GLFont::GLFONT_SIZE16;
fontHeight = 16;
}
if (viewHeight < 18) {
fontSize = GLFONT_SIZE12;
fontSize = GLFont::GLFONT_SIZE12;
fontHeight = 12;
}
@@ -95,7 +95,7 @@ void TuningContext::DrawTuner(long long freq, int count, float displayPos, float
int ofs = count - numChars;
for (int i = ofs; i < count; i++) {
float xpos = displayPos + (displayWidth / (float) count) * (float) i + ((displayWidth / 2.0) / (float) count);
getFont(fontSize).drawString(freqStr.str().substr(i - ofs, 1), xpos, 0, fontHeight, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
GLFont::getFont(fontSize).drawString(freqStr.str().substr(i - ofs, 1), xpos, 0, fontHeight, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
}
glColor4f(0.65, 0.65, 0.65, 0.25);
@@ -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, RGBColor c) {
void TuningContext::DrawTunerDigitBox(int index, int count, float displayPos, float displayWidth, RGB 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, RGBColor color, float alpha, bool top,
void TuningContext::DrawTunerBarIndexed(int start, int end, int count, float displayPos, float displayWidth, RGB 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, RGBColor c);
void DrawTunerDigitBox(int index, int count, float displayPos, float displayWidth, RGB c);
int GetTunerDigitIndex(float mPos, int count, float displayPos, float displayWidth);
void DrawTunerBarIndexed(int start, int end, int count, float displayPos, float displayWidth, RGBColor color, float alpha, bool top, bool bottom);
void DrawTunerBarIndexed(int start, int end, int count, float displayPos, float displayWidth, RGB color, float alpha, bool top, bool bottom);
void DrawDemodFreqBw(long long freq, unsigned int bw, long long center);
void DrawEnd();