Merge branch 'master' into osx-app-build

This commit is contained in:
Charles J. Cliffe
2015-02-21 23:33:05 -05:00
13 changed files with 230 additions and 140 deletions
+88 -39
View File
@@ -95,7 +95,7 @@ GLFont &PrimaryGLContext::getFont(GLFontSize esize) {
return fonts[esize];
}
void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, float r, float g, float b, long long center_freq, long long srate) {
void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGBColor color, long long center_freq, long long srate) {
if (!demod) {
return;
}
@@ -120,10 +120,10 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, float r, float
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(r, g, b, 0.6);
glColor4f(color.r, color.g, color.b, 0.6);
float ofs = ((float) demod->getBandwidth()) / (float) srate;
float ofsLeft = (demod->getDemodulatorType()!=DEMOD_TYPE_USB)?ofs:0, ofsRight = (demod->getDemodulatorType()!=DEMOD_TYPE_LSB)?ofs:0;
float labelHeight = 20.0 / viewHeight;
float hPos = -1.0 + labelHeight;
@@ -132,48 +132,53 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, float r, float
glColor4f(0, 0, 0, 0.35);
glBegin(GL_QUADS);
glVertex3f(uxPos - ofs, hPos + labelHeight, 0.0);
glVertex3f(uxPos - ofs, -1.0, 0.0);
glVertex3f(uxPos - ofsLeft, hPos + labelHeight, 0.0);
glVertex3f(uxPos - ofsLeft, -1.0, 0.0);
glVertex3f(uxPos + ofs, -1.0, 0.0);
glVertex3f(uxPos + ofs, hPos + labelHeight, 0.0);
glVertex3f(uxPos + ofsRight, -1.0, 0.0);
glVertex3f(uxPos + ofsRight, hPos + labelHeight, 0.0);
glEnd();
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glColor4f(r, g, b, 0.2);
glColor4f(color.r, color.g, color.b, 0.2);
glBegin(GL_QUADS);
glVertex3f(uxPos - ofs, 1.0, 0.0);
glVertex3f(uxPos - ofs, -1.0, 0.0);
glVertex3f(uxPos - ofsLeft, 1.0, 0.0);
glVertex3f(uxPos - ofsLeft, -1.0, 0.0);
glVertex3f(uxPos + ofs, -1.0, 0.0);
glVertex3f(uxPos + ofs, 1.0, 0.0);
glVertex3f(uxPos + ofsRight, -1.0, 0.0);
glVertex3f(uxPos + ofsRight, 1.0, 0.0);
glEnd();
if (ofs * 2.0 < 16.0 / viewWidth) {
ofs = 16.0 / viewWidth;
glColor4f(r, g, b, 0.2);
glColor4f(color.r, color.g, color.b, 0.2);
glBegin(GL_QUADS);
glVertex3f(uxPos - ofs, hPos + labelHeight, 0.0);
glVertex3f(uxPos - ofs, -1.0, 0.0);
glVertex3f(uxPos - ofsLeft, hPos + labelHeight, 0.0);
glVertex3f(uxPos - ofsLeft, -1.0, 0.0);
glVertex3f(uxPos + ofs, -1.0, 0.0);
glVertex3f(uxPos + ofs, hPos + labelHeight, 0.0);
glVertex3f(uxPos + ofsRight, -1.0, 0.0);
glVertex3f(uxPos + ofsRight, hPos + labelHeight, 0.0);
glEnd();
}
glColor4f(1.0, 1.0, 1.0, 0.8);
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
if (demod->getDemodulatorType() == DEMOD_TYPE_USB) {
getFont(PrimaryGLContext::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);
} else {
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demod->getLabel(), uxPos, hPos, 16, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
}
glDisable(GL_BLEND);
}
void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, float r, float g, float b, long long center_freq, long long srate) {
void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBColor color, long long center_freq, long long srate) {
if (!demod) {
return;
}
@@ -191,30 +196,31 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, float r, float g, f
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glColor4f(r, g, b, 0.6);
glColor4f(color.r, color.g, color.b, 0.6);
float ofs = ((float) demod->getBandwidth()) / (float) srate;
float ofsLeft = (demod->getDemodulatorType()!=DEMOD_TYPE_USB)?ofs:0, ofsRight = (demod->getDemodulatorType()!=DEMOD_TYPE_LSB)?ofs:0;
glBegin(GL_LINES);
glVertex3f((uxPos - 0.5) * 2.0, 1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0, -1.0, 0.0);
float ofs = ((float) demod->getBandwidth()) / (float) srate;
glVertex3f((uxPos - 0.5) * 2.0 - ofsLeft, 1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 - ofsLeft, -1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 - ofs, 1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 - ofs, -1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 + ofs, 1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 + ofs, -1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 + ofsRight, 1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 + ofsRight, -1.0, 0.0);
glEnd();
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glColor4f(r, g, b, 0.2);
glColor4f(color.r, color.g, color.b, 0.2);
glBegin(GL_QUADS);
glVertex3f((uxPos - 0.5) * 2.0 - ofs, 1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 - ofs, -1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 - ofsLeft, 1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 - ofsLeft, -1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 + ofs, -1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 + ofs, 1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 + ofsRight, -1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 + ofsRight, 1.0, 0.0);
glEnd();
GLint vp[4];
@@ -250,10 +256,12 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, float r, float g, f
case DEMOD_TYPE_LSB:
demodStr = "LSB";
demodAlign = GLFont::GLFONT_ALIGN_RIGHT;
uxPos -= xOfs;
break;
case DEMOD_TYPE_USB:
demodStr = "USB";
demodAlign = GLFont::GLFONT_ALIGN_LEFT;
uxPos += xOfs;
break;
}
@@ -267,11 +275,13 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, float r, float g, f
}
void PrimaryGLContext::DrawFreqSelector(float uxPos, float r, float g, float b, float w, long long center_freq, long long srate) {
void PrimaryGLContext::DrawFreqSelector(float uxPos, RGBColor color, float w, long long center_freq, long long srate) {
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
long long bw = 0;
int last_type = wxGetApp().getDemodMgr().getLastDemodulatorType();
if (!demod) {
bw = wxGetApp().getDemodMgr().getLastBandwidth();
} else {
@@ -286,9 +296,10 @@ void PrimaryGLContext::DrawFreqSelector(float uxPos, float r, float g, float b,
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glColor4f(r, g, b, 0.6);
glColor4f(color.r, color.g, color.b, 0.6);
glBegin(GL_LINES);
glVertex3f((uxPos - 0.5) * 2.0, 1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0, -1.0, 0.0);
@@ -300,17 +311,55 @@ void PrimaryGLContext::DrawFreqSelector(float uxPos, float r, float g, float b,
ofs = ((float) bw) / (float) srate;
}
glVertex3f((uxPos - 0.5) * 2.0 - ofs, 1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 - ofs, -1.0, 0.0);
if (last_type != DEMOD_TYPE_USB) {
glVertex3f((uxPos - 0.5) * 2.0 - ofs, 1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 - ofs, -1.0, 0.0);
}
glVertex3f((uxPos - 0.5) * 2.0 + ofs, 1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 + ofs, -1.0, 0.0);
if (last_type != DEMOD_TYPE_LSB) {
glVertex3f((uxPos - 0.5) * 2.0 + ofs, 1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 + ofs, -1.0, 0.0);
}
glEnd();
glDisable(GL_BLEND);
}
void PrimaryGLContext::DrawRangeSelector(float uxPos1, float uxPos2, RGBColor color) {
if (uxPos2 < uxPos1) {
float temp = uxPos2;
uxPos2=uxPos1;
uxPos1=temp;
}
int last_type = wxGetApp().getDemodMgr().getLastDemodulatorType();
glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glColor4f(color.r, color.g, color.b, 0.6);
glLineWidth((last_type == DEMOD_TYPE_USB)?2.0:1.0);
glBegin(GL_LINES);
glVertex3f((uxPos1 - 0.5) * 2.0, 1.0, 0.0);
glVertex3f((uxPos1 - 0.5) * 2.0, -1.0, 0.0);
glEnd();
glLineWidth((last_type == DEMOD_TYPE_LSB)?2.0:1.0);
glBegin(GL_LINES);
glVertex3f((uxPos2 - 0.5) * 2.0, 1.0, 0.0);
glVertex3f((uxPos2 - 0.5) * 2.0, -1.0, 0.0);
glEnd();
glLineWidth(1.0);
glDisable(GL_BLEND);
}
void PrimaryGLContext::BeginDraw(float r, float g, float b) {
glClearColor(r,g,b, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);