CTextBox: fix text position calculation

This commit is contained in:
Stefan Seyfried
2015-02-01 19:59:15 +01:00
committed by Jacek Jendrzej
parent 1eb652688a
commit a85878db2f

View File

@@ -613,17 +613,19 @@ void CTextBox::refreshText(void)
int i;
int x_center = 0;
int lines = std::min(m_nLinesPerPage, m_nNrOfLines);
// set text y position
if (m_nMode & TOP)
// move to top of frame
y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * m_nLinesPerPage) >> 1);
else if (m_nMode & BOTTOM)
// move to bottom of frame
y += m_cFrameTextRel.iHeight - (m_nNrOfLines > 1 ? (m_nNrOfLines-1)*m_nFontTextHeight : 0) - text_Vborder_width;
y += m_cFrameTextRel.iHeight - (lines > 1 ? (lines - 1)*m_nFontTextHeight : 0) - text_Vborder_width;
//m_nFontTextHeight + text_Vborder_width /*- ((m_cFrameTextRel.iHeight + m_nFontTextHeight*/ * m_nLinesPerPage/*) >> 1)*/;
else
// fit into mid of frame space
y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * std::min(m_nLinesPerPage, m_nNrOfLines)) >> 1);
y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * lines) >> 1);
for(i = m_nCurrentLine; i < m_nNrOfLines && i < m_nCurrentLine + m_nLinesPerPage; i++)
{