mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
*CTextBox: style, reworked statements for better readability
This commit is contained in:
@@ -212,8 +212,11 @@ void CTextBox::reSizeMainFrameWidth(int textWidth)
|
|||||||
|
|
||||||
int iNewWindowWidth = textWidth + m_cFrameScrollRel.iWidth + 2*text_border_width;
|
int iNewWindowWidth = textWidth + m_cFrameScrollRel.iWidth + 2*text_border_width;
|
||||||
|
|
||||||
if( iNewWindowWidth > m_nMaxWidth) iNewWindowWidth = m_nMaxWidth;
|
if( iNewWindowWidth > m_nMaxWidth)
|
||||||
if( iNewWindowWidth < MIN_WINDOW_WIDTH) iNewWindowWidth = MIN_WINDOW_WIDTH;
|
iNewWindowWidth = m_nMaxWidth;
|
||||||
|
|
||||||
|
if( iNewWindowWidth < MIN_WINDOW_WIDTH)
|
||||||
|
iNewWindowWidth = MIN_WINDOW_WIDTH;
|
||||||
|
|
||||||
m_cFrame.iWidth = iNewWindowWidth;
|
m_cFrame.iWidth = iNewWindowWidth;
|
||||||
|
|
||||||
@@ -227,8 +230,11 @@ void CTextBox::reSizeMainFrameHeight(int textHeight)
|
|||||||
|
|
||||||
int iNewWindowHeight = textHeight + 2*text_border_width;
|
int iNewWindowHeight = textHeight + 2*text_border_width;
|
||||||
|
|
||||||
if( iNewWindowHeight > m_nMaxHeight) iNewWindowHeight = m_nMaxHeight;
|
if( iNewWindowHeight > m_nMaxHeight)
|
||||||
if( iNewWindowHeight < MIN_WINDOW_HEIGHT) iNewWindowHeight = MIN_WINDOW_HEIGHT;
|
iNewWindowHeight = m_nMaxHeight;
|
||||||
|
|
||||||
|
if( iNewWindowHeight < MIN_WINDOW_HEIGHT)
|
||||||
|
iNewWindowHeight = MIN_WINDOW_HEIGHT;
|
||||||
|
|
||||||
m_cFrame.iHeight = iNewWindowHeight;
|
m_cFrame.iHeight = iNewWindowHeight;
|
||||||
|
|
||||||
@@ -356,12 +362,15 @@ void CTextBox::refreshTextLineArray(void)
|
|||||||
aktLine = "";
|
aktLine = "";
|
||||||
aktWidth = 0;
|
aktWidth = 0;
|
||||||
|
|
||||||
if(pos_prev >= TextChars) loop = false;
|
if(pos_prev >= TextChars)
|
||||||
|
loop = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
aktLine += aktWord;
|
aktLine += aktWord;
|
||||||
aktWidth += aktWordWidth;
|
aktWidth += aktWordWidth;
|
||||||
if (aktWidth > maxTextWidth) maxTextWidth = aktWidth;
|
|
||||||
|
if (aktWidth > maxTextWidth)
|
||||||
|
maxTextWidth = aktWidth;
|
||||||
//TRACE_1(" aktLine : %s\r\n",aktLine.c_str());
|
//TRACE_1(" aktLine : %s\r\n",aktLine.c_str());
|
||||||
//TRACE_1(" aktWidth: %d aktWordWidth:%d\r\n",aktWidth,aktWordWidth);
|
//TRACE_1(" aktWidth: %d aktWordWidth:%d\r\n",aktWidth,aktWordWidth);
|
||||||
|
|
||||||
@@ -376,7 +385,9 @@ void CTextBox::refreshTextLineArray(void)
|
|||||||
aktLine = "";
|
aktLine = "";
|
||||||
aktWidth = 0;
|
aktWidth = 0;
|
||||||
m_nNrOfNewLine++;
|
m_nNrOfNewLine++;
|
||||||
if(pos_prev >= TextChars) loop = false;
|
|
||||||
|
if(pos_prev >= TextChars)
|
||||||
|
loop = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -424,8 +435,11 @@ void CTextBox::refreshTextLineArray(void)
|
|||||||
|
|
||||||
void CTextBox::refreshScroll(void)
|
void CTextBox::refreshScroll(void)
|
||||||
{
|
{
|
||||||
if( !(m_nMode & SCROLL)) return;
|
if(!(m_nMode & SCROLL))
|
||||||
if( frameBuffer == NULL) return;
|
return;
|
||||||
|
|
||||||
|
if( frameBuffer == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (m_nNrOfPages > 1)
|
if (m_nNrOfPages > 1)
|
||||||
{
|
{
|
||||||
@@ -448,14 +462,21 @@ void CTextBox::refreshScroll(void)
|
|||||||
|
|
||||||
void CTextBox::refreshText(void)
|
void CTextBox::refreshText(void)
|
||||||
{
|
{
|
||||||
if( frameBuffer == NULL) return;
|
//TRACE("[CTextBox] %s Line %d\r\n", __FUNCTION__, __LINE__);
|
||||||
//TRACE(" CTextBox::refreshText: %d,%s\r\n",m_nCurrentLine,m_cLineArray[m_nCurrentLine].c_str());
|
|
||||||
|
if( frameBuffer == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//TRACE("[CTextBox] m_nCurrentLine: %d, m_cLineArray[m_nCurrentLine]: %s\r\n",m_nCurrentLine, m_cLineArray[m_nCurrentLine].c_str());
|
||||||
|
|
||||||
//Paint Text Background
|
//Paint Text Background
|
||||||
if (m_nPaintBackground)
|
if (m_nPaintBackground)
|
||||||
frameBuffer->paintBoxRel(m_cFrameTextRel.iX+m_cFrame.iX, /*m_cFrameTextRel.iY+*/m_cFrame.iY,
|
frameBuffer->paintBoxRel(m_cFrameTextRel.iX+m_cFrame.iX, /*m_cFrameTextRel.iY+*/m_cFrame.iY,
|
||||||
m_cFrameTextRel.iWidth, m_cFrameTextRel.iHeight, m_textBackgroundColor, m_nBgRadius, m_nBgRadiusType);
|
m_cFrameTextRel.iWidth, m_cFrameTextRel.iHeight, m_textBackgroundColor, m_nBgRadius, m_nBgRadiusType);
|
||||||
|
|
||||||
if( m_nNrOfLines <= 0) return;
|
if( m_nNrOfLines <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
int y = m_cFrameTextRel.iY + text_border_width;
|
int y = m_cFrameTextRel.iY + text_border_width;
|
||||||
int i;
|
int i;
|
||||||
int x_center = 0;
|
int x_center = 0;
|
||||||
@@ -478,10 +499,12 @@ void CTextBox::refreshText(void)
|
|||||||
|
|
||||||
void CTextBox::scrollPageDown(const int pages)
|
void CTextBox::scrollPageDown(const int pages)
|
||||||
{
|
{
|
||||||
if( !(m_nMode & SCROLL)) return;
|
//TRACE("[CTextBox] %s Line %d\r\n", __FUNCTION__, __LINE__);
|
||||||
if( m_nNrOfLines <= 0) return;
|
if( !(m_nMode & SCROLL))
|
||||||
TRACE("[CTextBox]->ScrollPageDown \r\n");
|
return;
|
||||||
|
|
||||||
|
if( m_nNrOfLines <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if(m_nCurrentPage + pages < m_nNrOfPages)
|
if(m_nCurrentPage + pages < m_nNrOfPages)
|
||||||
{
|
{
|
||||||
@@ -497,10 +520,12 @@ void CTextBox::scrollPageDown(const int pages)
|
|||||||
|
|
||||||
void CTextBox::scrollPageUp(const int pages)
|
void CTextBox::scrollPageUp(const int pages)
|
||||||
{
|
{
|
||||||
if( !(m_nMode & SCROLL)) return;
|
//TRACE("[CTextBox] %s Line %d\r\n", __FUNCTION__, __LINE__);
|
||||||
if( m_nNrOfLines <= 0) return;
|
if( !(m_nMode & SCROLL))
|
||||||
TRACE("[CTextBox]->ScrollPageUp \r\n");
|
return;
|
||||||
|
|
||||||
|
if( m_nNrOfLines <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if(m_nCurrentPage - pages > 0)
|
if(m_nCurrentPage - pages > 0)
|
||||||
{
|
{
|
||||||
@@ -516,9 +541,9 @@ void CTextBox::scrollPageUp(const int pages)
|
|||||||
|
|
||||||
void CTextBox::refresh(void)
|
void CTextBox::refresh(void)
|
||||||
{
|
{
|
||||||
if( frameBuffer == NULL) return;
|
//TRACE("[CTextBox] %s Line %d\r\n", __FUNCTION__, __LINE__);
|
||||||
//TRACE("[CTextBox]->Refresh\r\n");
|
if( frameBuffer == NULL)
|
||||||
//printf("setText::refresh!\n");
|
return;
|
||||||
|
|
||||||
//Paint text
|
//Paint text
|
||||||
refreshScroll();
|
refreshScroll();
|
||||||
@@ -544,16 +569,20 @@ bool CTextBox::setText(const std::string* newText, int _max_width)
|
|||||||
|
|
||||||
void CTextBox::paint (void)
|
void CTextBox::paint (void)
|
||||||
{
|
{
|
||||||
if(frameBuffer != NULL) return;
|
//TRACE("[CTextBox] %s Line %d\r\n", __FUNCTION__, __LINE__);
|
||||||
//TRACE("[CTextBox]->paint \r\n");
|
if(frameBuffer != NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
frameBuffer = CFrameBuffer::getInstance();
|
frameBuffer = CFrameBuffer::getInstance();
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTextBox::hide (void)
|
void CTextBox::hide (void)
|
||||||
{
|
{
|
||||||
if(frameBuffer == NULL) return;
|
//TRACE("[CTextBox] %s Line %d\r\n", __FUNCTION__, __LINE__);
|
||||||
//TRACE("[CTextBox]->hide \r\n");
|
if(frameBuffer == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
frameBuffer->paintBackgroundBoxRel(m_cFrame.iX, m_cFrame.iY, m_cFrame.iWidth, m_cFrame.iHeight);
|
frameBuffer->paintBackgroundBoxRel(m_cFrame.iX, m_cFrame.iY, m_cFrame.iWidth, m_cFrame.iHeight);
|
||||||
frameBuffer = NULL;
|
frameBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user