Merge pull request #380 from vsonnier/text_zones_adjustments

Fix for large dB values displayed with truncation on the left if > Normal zoom level, and misc.
This commit is contained in:
Charles J. Cliffe 2016-06-24 18:10:44 -04:00 committed by GitHub
commit f2f8b311ef
4 changed files with 29 additions and 15 deletions

View File

@ -103,8 +103,8 @@ AppFrame::AppFrame() :
demodModeSelectorAdv->addChoice("QAM"); demodModeSelectorAdv->addChoice("QAM");
demodModeSelectorAdv->addChoice("QPSK"); demodModeSelectorAdv->addChoice("QPSK");
demodModeSelectorAdv->setHelpTip("Choose advanced modulation types."); demodModeSelectorAdv->setHelpTip("Choose advanced modulation types.");
demodModeSelectorAdv->SetMinSize(wxSize(44,-1)); demodModeSelectorAdv->SetMinSize(wxSize(50,-1));
demodModeSelectorAdv->SetMaxSize(wxSize(44,-1)); demodModeSelectorAdv->SetMaxSize(wxSize(50,-1));
demodTray->Add(demodModeSelectorAdv, 3, wxEXPAND | wxALL, 0); demodTray->Add(demodModeSelectorAdv, 3, wxEXPAND | wxALL, 0);
#endif #endif

View File

@ -267,7 +267,7 @@ void SpectrumPanel::drawPanelContents() {
glLineWidth(1.0); glLineWidth(1.0);
if (showDb) { if (showDb) {
float dbPanelWidth = (1.0 / viewWidth)*75.0 * GLFont::getScaleFactor(); float dbPanelWidth = (1.0 / viewWidth)*88.0 * GLFont::getScaleFactor();
float dbPanelHeight = (1.0/viewHeight)*14.0 * GLFont::getScaleFactor(); float dbPanelHeight = (1.0/viewHeight)*14.0 * GLFont::getScaleFactor();
@ -282,7 +282,7 @@ void SpectrumPanel::drawPanelContents() {
ssLabel.str(""); ssLabel.str("");
if (getCeilValue() != getFloorValue() && fftSize) { if (getCeilValue() != getFloorValue() && fftSize) {
ssLabel << (20.0 * log10(2.0*(getFloorValue())/(double)fftSize)) << "dB"; ssLabel << (20.0 * log10(2.0*(getFloorValue())/(double)fftSize)) << "dB";
} }
dbPanelFloor.setText(ssLabel.str(), GLFont::GLFONT_ALIGN_RIGHT); dbPanelFloor.setText(ssLabel.str(), GLFont::GLFONT_ALIGN_RIGHT);

View File

@ -404,16 +404,29 @@ void GLTextPanel::drawPanelContents() {
//pdimy is considered un-scaled //pdimy is considered un-scaled
pdimy = round(pdimy / appliedScaleFactor); pdimy = round(pdimy / appliedScaleFactor);
//target font size: a bit smaller than pdimy: int size = 12;
int sz = 12;
if (pdimy > 14) { if (pdimy <= 16) {
//make the font a little smaller that the TextPanel
sz = pdimy - 2; size = 12;
} else if (pdimy <= 18) {
size = 16;
} else if(pdimy <= 24) {
size = 18;
} else if(pdimy <= 32) {
size = 24;
} else if(pdimy <= 48) {
size = 32;
} else {
size = 48;
}
} GLFont::getFont(size, appliedScaleFactor).drawString(textVal, mid, mid, horizAlign, vertAlign, (int)pdim.x, (int)pdim.y);
GLFont::getFont(sz, appliedScaleFactor).drawString(textVal, mid, mid, horizAlign, vertAlign, (int)pdim.x, (int)pdim.y);
} }
void GLTextPanel::setText(std::string text, GLFont::Align hAlign, GLFont::Align vAlign, bool useNative) { void GLTextPanel::setText(std::string text, GLFont::Align hAlign, GLFont::Align vAlign, bool useNative) {

View File

@ -851,7 +851,8 @@ GLFont::Drawer::Drawer(int basicFontSize, double scaleFactor) {
//final font size of basicFontSize* scaleFactor: //final font size of basicFontSize* scaleFactor:
renderingFontIndex = 0; renderingFontIndex = 0;
double targetSize = basicFontSize * scaleFactor; //try to align on an integer pixel size if the targetSize font is available
int targetSize = round(basicFontSize * scaleFactor);
fonts[0].loadFontOnce(); fonts[0].loadFontOnce();
@ -869,10 +870,10 @@ GLFont::Drawer::Drawer(int basicFontSize, double scaleFactor) {
} //end for } //end for
// //
double rawSize = fonts[renderingFontIndex].pixHeight; int rawSize = fonts[renderingFontIndex].pixHeight;
//targetSize may not be reached yet, so the effective rendering font: fonts[renderingFontIndex] must be scaled up a bit. //targetSize may not be reached yet, so the effective rendering font: fonts[renderingFontIndex] must be scaled up a bit.
renderingFontScaleFactor = targetSize / rawSize; renderingFontScaleFactor = (double) targetSize / rawSize;
} }
void GLFont::Drawer::drawString(const std::wstring& str, float xpos, float ypos, Align hAlign, Align vAlign, int vpx, int vpy, bool cacheable) { void GLFont::Drawer::drawString(const std::wstring& str, float xpos, float ypos, Align hAlign, Align vAlign, int vpx, int vpy, bool cacheable) {