CMotorControl: fix fonthandling in motorsetup

Usage of static font size ensures a safe and reasonable
display of text lines.
This commit is contained in:
2014-09-20 18:09:15 +02:00
committed by [CST] Focus
parent 617eece227
commit 9f642c973d
2 changed files with 13 additions and 13 deletions

View File

@@ -42,7 +42,7 @@
#include <gui/widget/messagebox.h> #include <gui/widget/messagebox.h>
#include <system/settings.h> #include <system/settings.h>
#include <driver/screen_max.h> #include <driver/screen_max.h>
#include <driver/neutrinofonts.h>
#include <zapit/satconfig.h> #include <zapit/satconfig.h>
#include <zapit/zapit.h> #include <zapit/zapit.h>
#include <zapit/scannit.h> #include <zapit/scannit.h>
@@ -71,12 +71,12 @@ void CMotorControl::Init(void)
{ {
frameBuffer = CFrameBuffer::getInstance(); frameBuffer = CFrameBuffer::getInstance();
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); mheight = 30;
satfindpid = -1; satfindpid = -1;
width = w_max(720, 0); width = w_max(720, 0);
mheight = mheight - 2; m_font = *CNeutrinoFonts::getInstance()->getDynFont(width, mheight);
height = hheight + (24 * mheight) - 5; height = hheight + (24 * mheight) - 5;
height = h_max(height, 0); height = h_max(height, 0);
@@ -365,19 +365,19 @@ void CMotorControl::paintLine(int px, int *py, int pwidth, const char *txt)
{ {
frameBuffer->paintBoxRel(px, *py, pwidth, mheight, COL_MENUCONTENT_PLUS_0); frameBuffer->paintBoxRel(px, *py, pwidth, mheight, COL_MENUCONTENT_PLUS_0);
*py += mheight; *py += mheight;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(px, *py, pwidth, txt, COL_MENUCONTENT_TEXT); m_font->RenderString(px, *py, pwidth, txt, COL_MENUCONTENT_TEXT);
} }
void CMotorControl::paintLine(int px, int py, int pwidth, const char *txt) void CMotorControl::paintLine(int px, int py, int pwidth, const char *txt)
{ {
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(px, py, pwidth, txt, COL_MENUCONTENT_TEXT); m_font->RenderString(px, py, pwidth, txt, COL_MENUCONTENT_TEXT);
} }
void CMotorControl::paintLine(int ix, int tx, int *py, int pwidth, const char *icon, const char *txt) void CMotorControl::paintLine(int ix, int tx, int *py, int pwidth, const char *icon, const char *txt)
{ {
frameBuffer->paintIcon(icon, ix, *py, mheight); frameBuffer->paintIcon(icon, ix, *py, mheight);
*py += mheight; *py += mheight;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(tx, *py, pwidth, txt, COL_MENUCONTENT_TEXT); m_font->RenderString(tx, *py, pwidth, txt, COL_MENUCONTENT_TEXT);
} }
void CMotorControl::paintSeparator(int xpos, int *pypos, int pwidth, const char * /*txt*/) void CMotorControl::paintSeparator(int xpos, int *pypos, int pwidth, const char * /*txt*/)
@@ -389,11 +389,11 @@ void CMotorControl::paintSeparator(int xpos, int *pypos, int pwidth, const char
frameBuffer->paintHLineRel(xpos, pwidth - 20, *pypos - (th >> 1) + 1, COL_MENUCONTENT_PLUS_1); frameBuffer->paintHLineRel(xpos, pwidth - 20, *pypos - (th >> 1) + 1, COL_MENUCONTENT_PLUS_1);
#if 0 #if 0
int stringwidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(txt); int stringwidth = m_font->getRenderWidth(txt);
int stringstartposX = 0; int stringstartposX = 0;
stringstartposX = (xpos + (pwidth >> 1)) - (stringwidth >> 1); stringstartposX = (xpos + (pwidth >> 1)) - (stringwidth >> 1);
frameBuffer->paintBoxRel(stringstartposX - 5, *pypos - mheight, stringwidth + 10, mheight, COL_MENUCONTENT_PLUS_0); frameBuffer->paintBoxRel(stringstartposX - 5, *pypos - mheight, stringwidth + 10, mheight, COL_MENUCONTENT_PLUS_0);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposX, *pypos, stringwidth, txt, COL_MENUCONTENT_TEXT); m_font->RenderString(stringstartposX, *pypos, stringwidth, txt, COL_MENUCONTENT_TEXT);
#endif #endif
} }
@@ -403,7 +403,7 @@ void CMotorControl::paintStatus()
char buf2[256]; char buf2[256];
int xpos1 = x + 10; int xpos1 = x + 10;
int xpos2 = xpos1 + 10 + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(g_Locale->getText(LOCALE_MOTORCONTROL_MOTOR_POS)); int xpos2 = xpos1 + 10 + m_font->getRenderWidth(g_Locale->getText(LOCALE_MOTORCONTROL_MOTOR_POS));
int width2 = width - (xpos2 - xpos1) - 10; int width2 = width - (xpos2 - xpos1) - 10;
int width1 = width - 10; int width1 = width - 10;
@@ -466,7 +466,7 @@ void CMotorControl::paintMenu()
ypos = y + hheight + (mheight >> 1) - 10; ypos = y + hheight + (mheight >> 1) - 10;
int xpos1 = x + 10; int xpos1 = x + 10;
int xpos2 = xpos1 + 10 + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("(7/yellow)"); int xpos2 = xpos1 + 10 + m_font->getRenderWidth("(7/yellow)");
int width2 = width - (xpos2 - xpos1) - 10; int width2 = width - (xpos2 - xpos1) - 10;
#if 1 #if 1
@@ -589,8 +589,8 @@ void CMotorControl::showSNR ()
{ {
if (signalbox == NULL){ if (signalbox == NULL){
int xpos1 = x + 10; int xpos1 = x + 10;
//signalbox = new CSignalBox(xpos1, y + height - mheight - 5, width - 2*(xpos1-x), g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(), frontend, false); //signalbox = new CSignalBox(xpos1, y + height - mheight - 5, width - 2*(xpos1-x), m_font->getHeight(), frontend, false);
signalbox = new CSignalBox(xpos1, y + height - (mheight*2*3)/2 - 5, width - 2*(xpos1-x), (g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()*2*3)/2, frontend, true); signalbox = new CSignalBox(xpos1, y + height - (mheight*2*3)/2 - 5, width - 2*(xpos1-x), (m_font->getHeight()*2*3)/2, frontend, true);
signalbox->setColorBody(COL_MENUCONTENT_PLUS_0); signalbox->setColorBody(COL_MENUCONTENT_PLUS_0);
signalbox->setTextColor(COL_MENUCONTENT_TEXT); signalbox->setTextColor(COL_MENUCONTENT_TEXT);
signalbox->doPaintBg(true); signalbox->doPaintBg(true);

View File

@@ -59,7 +59,7 @@ class CMotorControl : public CMenuTarget
int ypos; int ypos;
int ypos_status; int ypos_status;
int ypos_menue; int ypos_menue;
Font* m_font;
int8_t stepSize; int8_t stepSize;
int32_t stepDelay; int32_t stepDelay;
int stepMode; int stepMode;