mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-26 05:38:39 -05:00
Fix Spectrum mhz steps and frequencies not properly calculated w.r.t front scale factor
This commit is contained in:
parent
78cfe9c755
commit
324702e26b
@ -167,40 +167,42 @@ void SpectrumPanel::drawPanelContents() {
|
|||||||
std::stringstream label;
|
std::stringstream label;
|
||||||
label.precision(1);
|
label.precision(1);
|
||||||
|
|
||||||
if (mhzStep * 0.5 * viewWidth < 40) {
|
double fontScale = GLFont::getScaleFactor();
|
||||||
|
|
||||||
|
if (mhzStep * 0.5 * viewWidth < 40 * fontScale) {
|
||||||
mhzStep = (250000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
mhzStep = (250000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
||||||
mhzVisualStep = 0.25;
|
mhzVisualStep = 0.25;
|
||||||
|
|
||||||
if (mhzStep * 0.5 * viewWidth < 40) {
|
if (mhzStep * 0.5 * viewWidth < 40 * fontScale) {
|
||||||
mhzStep = (500000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
mhzStep = (500000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
||||||
mhzVisualStep = 0.5;
|
mhzVisualStep = 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mhzStep * 0.5 * viewWidth < 40) {
|
if (mhzStep * 0.5 * viewWidth < 40 * fontScale) {
|
||||||
mhzStep = (1000000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
mhzStep = (1000000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
||||||
mhzVisualStep = 1.0;
|
mhzVisualStep = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mhzStep * 0.5 * viewWidth < 40) {
|
if (mhzStep * 0.5 * viewWidth < 40 * fontScale) {
|
||||||
mhzStep = (2500000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
mhzStep = (2500000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
||||||
mhzVisualStep = 2.5;
|
mhzVisualStep = 2.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mhzStep * 0.5 * viewWidth < 40) {
|
if (mhzStep * 0.5 * viewWidth < 40 * fontScale) {
|
||||||
mhzStep = (5000000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
mhzStep = (5000000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
||||||
mhzVisualStep = 5.0;
|
mhzVisualStep = 5.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mhzStep * 0.5 * viewWidth < 40) {
|
if (mhzStep * 0.5 * viewWidth < 40 * fontScale) {
|
||||||
mhzStep = (10000000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
mhzStep = (10000000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
||||||
mhzVisualStep = 10.0;
|
mhzVisualStep = 10.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mhzStep * 0.5 * viewWidth < 40) {
|
if (mhzStep * 0.5 * viewWidth < 40 * fontScale) {
|
||||||
mhzStep = (50000000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
mhzStep = (50000000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
||||||
mhzVisualStep = 50.0;
|
mhzVisualStep = 50.0;
|
||||||
}
|
}
|
||||||
} else if (mhzStep * 0.5 * viewWidth > 350) {
|
} else if (mhzStep * 0.5 * viewWidth > 350 * fontScale) {
|
||||||
mhzStep = (10000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
mhzStep = (10000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
||||||
mhzVisualStep = 0.01;
|
mhzVisualStep = 0.01;
|
||||||
label.precision(2);
|
label.precision(2);
|
||||||
@ -211,7 +213,7 @@ void SpectrumPanel::drawPanelContents() {
|
|||||||
long double currentMhz = trunc(floor(firstMhz / (long double)1000000.0));
|
long double currentMhz = trunc(floor(firstMhz / (long double)1000000.0));
|
||||||
|
|
||||||
|
|
||||||
double hPos = 1.0 - (16.0 / viewHeight);
|
double hPos = 1.0 - (16.0 / viewHeight) * GLFont::getScaleFactor();
|
||||||
double lMhzPos = 1.0 - (5.0 / viewHeight);
|
double lMhzPos = 1.0 - (5.0 / viewHeight);
|
||||||
|
|
||||||
int fontSize = 12;
|
int fontSize = 12;
|
||||||
@ -219,7 +221,7 @@ void SpectrumPanel::drawPanelContents() {
|
|||||||
if (viewHeight > 135) {
|
if (viewHeight > 135) {
|
||||||
|
|
||||||
fontSize = 16;
|
fontSize = 16;
|
||||||
hPos = 1.0 - (18.0 / viewHeight);
|
hPos = 1.0 - (18.0 / viewHeight) * GLFont::getScaleFactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFont::Drawer refDrawingFont = GLFont::getFont(fontSize, GLFont::getScaleFactor());
|
GLFont::Drawer refDrawingFont = GLFont::getFont(fontSize, GLFont::getScaleFactor());
|
||||||
|
Loading…
Reference in New Issue
Block a user