mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
* CTextBox: When using only digits to display:
- Use for calculating digit height font->getDigitHeight() / font->getDigitOffset()
This commit is contained in:
@@ -98,7 +98,7 @@ CTextBox::CTextBox(const char * text, Font* font_text, const int pmode,
|
|||||||
//TRACE(" CTextBox::m_cText: %d, m_nMode %d\t\r\n",m_cText.size(),m_nMode);
|
//TRACE(" CTextBox::m_cText: %d, m_nMode %d\t\r\n",m_cText.size(),m_nMode);
|
||||||
|
|
||||||
m_textBackgroundColor = textBackgroundColor;
|
m_textBackgroundColor = textBackgroundColor;
|
||||||
m_nFontTextHeight = m_pcFontText->getHeight();
|
m_nFontTextHeight = setFontTextHeight();
|
||||||
|
|
||||||
//TRACE("[CTextBox] %s Line %d\r\n", __FUNCTION__, __LINE__);
|
//TRACE("[CTextBox] %s Line %d\r\n", __FUNCTION__, __LINE__);
|
||||||
//TRACE(" CTextBox::m_nFontTextHeight: %d\t\r\n",m_nFontTextHeight);
|
//TRACE(" CTextBox::m_nFontTextHeight: %d\t\r\n",m_nFontTextHeight);
|
||||||
@@ -150,8 +150,9 @@ void CTextBox::initVar(void)
|
|||||||
m_cText = "";
|
m_cText = "";
|
||||||
m_nMode = SCROLL;
|
m_nMode = SCROLL;
|
||||||
|
|
||||||
|
m_FontUseDigitHeight = false;
|
||||||
m_pcFontText = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1];
|
m_pcFontText = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1];
|
||||||
m_nFontTextHeight = m_pcFontText->getHeight();
|
m_nFontTextHeight = setFontTextHeight();
|
||||||
m_nMaxTextWidth = 0;
|
m_nMaxTextWidth = 0;
|
||||||
|
|
||||||
m_nNrOfPages = 1;
|
m_nNrOfPages = 1;
|
||||||
@@ -190,11 +191,28 @@ void CTextBox::initFramesAndTextArray()
|
|||||||
refreshTextLineArray();
|
refreshTextLineArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CTextBox::setFontTextHeight()
|
||||||
|
{
|
||||||
|
if (m_FontUseDigitHeight)
|
||||||
|
return m_pcFontText->getDigitHeight() + (m_pcFontText->getDigitOffset() * 18) / 10;
|
||||||
|
else
|
||||||
|
return m_pcFontText->getHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTextBox::setFontUseDigitHeight(bool set/*=true*/)
|
||||||
|
{
|
||||||
|
if (m_FontUseDigitHeight != set) {
|
||||||
|
m_FontUseDigitHeight = set;
|
||||||
|
m_nFontTextHeight = setFontTextHeight();
|
||||||
|
initFramesAndTextArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CTextBox::setTextFont(Font* font_text)
|
void CTextBox::setTextFont(Font* font_text)
|
||||||
{
|
{
|
||||||
if ((m_pcFontText != font_text) && (font_text != NULL)) {
|
if ((m_pcFontText != font_text) && (font_text != NULL)) {
|
||||||
m_pcFontText = font_text;
|
m_pcFontText = font_text;
|
||||||
m_nFontTextHeight = m_pcFontText->getHeight();
|
m_nFontTextHeight = setFontTextHeight();
|
||||||
//Initialise the window frames first and than refresh text line array
|
//Initialise the window frames first and than refresh text line array
|
||||||
initFramesAndTextArray();
|
initFramesAndTextArray();
|
||||||
}
|
}
|
||||||
|
@@ -109,6 +109,7 @@ class CTextBox
|
|||||||
void refreshText(void);
|
void refreshText(void);
|
||||||
void reSizeMainFrameWidth(int maxTextWidth);
|
void reSizeMainFrameWidth(int maxTextWidth);
|
||||||
void reSizeMainFrameHeight(int maxTextHeight);
|
void reSizeMainFrameHeight(int maxTextHeight);
|
||||||
|
int setFontTextHeight();
|
||||||
|
|
||||||
/* Variables */
|
/* Variables */
|
||||||
std::string m_cText;
|
std::string m_cText;
|
||||||
@@ -150,6 +151,7 @@ class CTextBox
|
|||||||
/* int max_width;*/
|
/* int max_width;*/
|
||||||
|
|
||||||
int text_border_width;
|
int text_border_width;
|
||||||
|
bool m_FontUseDigitHeight;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
@@ -178,6 +180,7 @@ class CTextBox
|
|||||||
void setWindowPos(const CBox* position){m_cFrame = *position;};
|
void setWindowPos(const CBox* position){m_cFrame = *position;};
|
||||||
void setWindowMaxDimensions(const int width, const int height);
|
void setWindowMaxDimensions(const int width, const int height);
|
||||||
void setWindowMinDimensions(const int width, const int height);
|
void setWindowMinDimensions(const int width, const int height);
|
||||||
|
void setFontUseDigitHeight(bool set=true);
|
||||||
|
|
||||||
inline bool isPainted(void) {if( frameBuffer == NULL) return (false); else return (true);};
|
inline bool isPainted(void) {if( frameBuffer == NULL) return (false); else return (true);};
|
||||||
inline CBox getWindowsPos(void) {return(m_cFrame);};
|
inline CBox getWindowsPos(void) {return(m_cFrame);};
|
||||||
|
Reference in New Issue
Block a user