mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-02-03 09:44:26 -05:00
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:
commit
f2f8b311ef
@ -103,8 +103,8 @@ AppFrame::AppFrame() :
|
||||
demodModeSelectorAdv->addChoice("QAM");
|
||||
demodModeSelectorAdv->addChoice("QPSK");
|
||||
demodModeSelectorAdv->setHelpTip("Choose advanced modulation types.");
|
||||
demodModeSelectorAdv->SetMinSize(wxSize(44,-1));
|
||||
demodModeSelectorAdv->SetMaxSize(wxSize(44,-1));
|
||||
demodModeSelectorAdv->SetMinSize(wxSize(50,-1));
|
||||
demodModeSelectorAdv->SetMaxSize(wxSize(50,-1));
|
||||
demodTray->Add(demodModeSelectorAdv, 3, wxEXPAND | wxALL, 0);
|
||||
#endif
|
||||
|
||||
|
@ -267,7 +267,7 @@ void SpectrumPanel::drawPanelContents() {
|
||||
glLineWidth(1.0);
|
||||
|
||||
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();
|
||||
|
||||
|
||||
@ -282,7 +282,7 @@ void SpectrumPanel::drawPanelContents() {
|
||||
|
||||
ssLabel.str("");
|
||||
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);
|
||||
|
@ -404,16 +404,29 @@ void GLTextPanel::drawPanelContents() {
|
||||
//pdimy is considered un-scaled
|
||||
pdimy = round(pdimy / appliedScaleFactor);
|
||||
|
||||
//target font size: a bit smaller than pdimy:
|
||||
int sz = 12;
|
||||
int size = 12;
|
||||
|
||||
if (pdimy > 14) {
|
||||
//make the font a little smaller that the TextPanel
|
||||
sz = pdimy - 2;
|
||||
if (pdimy <= 16) {
|
||||
|
||||
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(sz, appliedScaleFactor).drawString(textVal, mid, mid, horizAlign, vertAlign, (int)pdim.x, (int)pdim.y);
|
||||
GLFont::getFont(size, 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) {
|
||||
|
@ -851,7 +851,8 @@ GLFont::Drawer::Drawer(int basicFontSize, double scaleFactor) {
|
||||
//final font size of basicFontSize* scaleFactor:
|
||||
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();
|
||||
|
||||
@ -869,10 +870,10 @@ GLFont::Drawer::Drawer(int basicFontSize, double scaleFactor) {
|
||||
} //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.
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user