MISC: Position labels better according to font scale

This commit is contained in:
vsonnier 2017-02-12 22:26:40 +01:00
parent d3db510643
commit 2b0a2822a7
2 changed files with 23 additions and 5 deletions

View File

@ -391,16 +391,26 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBA4f color, long
// demodStr = demodStr + " UnLock"; // demodStr = demodStr + " UnLock";
// } // }
//Shift the user label from the modem label more for the bigger
//font sizes so they do not step on each other...
double heightShiftFactor = 1.3;
if (GLFont::getScale() == GLFont::GLFONT_SCALE_MEDIUM) {
heightShiftFactor = 1.7;
} else if (GLFont::getScale() == GLFont::GLFONT_SCALE_LARGE) {
heightShiftFactor = 2.3;
}
//demodulator user label if present: type is displayed above the label, which is at the bottom of the screen. //demodulator user label if present: type is displayed above the label, which is at the bottom of the screen.
if (!demod->getDemodulatorUserLabel().empty()) { if (!demod->getDemodulatorUserLabel().empty()) {
hPos += 1.3 * labelHeight; hPos += heightShiftFactor * labelHeight;
} }
drawSingleDemodLabel(demodStr.ToStdWstring(), uxPos, hPos, xOfs, yOfs, GLFont::GLFONT_ALIGN_CENTER); drawSingleDemodLabel(demodStr.ToStdWstring(), uxPos, hPos, xOfs, yOfs, GLFont::GLFONT_ALIGN_CENTER);
//revert... //revert...
if (!demod->getDemodulatorUserLabel().empty()) { if (!demod->getDemodulatorUserLabel().empty()) {
hPos -= 1.3 * labelHeight; hPos -= heightShiftFactor * labelHeight;
drawSingleDemodLabel(demod->getDemodulatorUserLabel(), uxPos, hPos, xOfs, yOfs, GLFont::GLFONT_ALIGN_CENTER); drawSingleDemodLabel(demod->getDemodulatorUserLabel(), uxPos, hPos, xOfs, yOfs, GLFont::GLFONT_ALIGN_CENTER);
} }

View File

@ -40,9 +40,17 @@ void ScopeContext::DrawTunerTitles(bool ppmMode) {
GLFont::Drawer refDrawingFont = GLFont::getFont(12, GLFont::getScaleFactor()); GLFont::Drawer refDrawingFont = GLFont::getFont(12, GLFont::getScaleFactor());
refDrawingFont.drawString(ppmMode?"Device PPM":"Frequency", -0.66f, -1.0+hPos, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true); //better position frequency/bandwith labels according to font scale
refDrawingFont.drawString("Bandwidth", 0.0, -1.0+hPos, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true); double shiftFactor = 1.0;
refDrawingFont.drawString("Center Frequency", 0.66f, -1.0+hPos, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true); if (GLFont::getScaleFactor() == GLFont::GLFONT_SCALE_MEDIUM) {
shiftFactor = 1.5;
} else if (GLFont::getScaleFactor() == GLFont::GLFONT_SCALE_LARGE) {
shiftFactor = 2.0;
}
refDrawingFont.drawString(ppmMode?"Device PPM":"Frequency", -0.66f, -1.0 +hPos*shiftFactor, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
refDrawingFont.drawString("Bandwidth", 0.0, -1.0 +hPos*shiftFactor, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
refDrawingFont.drawString("Center Frequency", 0.66f, -1.0 +hPos*shiftFactor, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
} }
void ScopeContext::DrawDeviceName(std::string deviceName) { void ScopeContext::DrawDeviceName(std::string deviceName) {