*CTextBox: set text y position depends of lines count

If we have only one line, text will be painted horizontal centered,
otherwise text begins on top of frame.
This commit is contained in:
2012-09-22 21:50:27 +02:00
parent 07fa858d6c
commit c9472dc3f3

View File

@@ -506,8 +506,14 @@ void CTextBox::refreshText(void)
int i;
int x_center = 0;
// y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * std::min(m_nLinesPerPage, m_nNrOfLines)) >> 1) - text_border_width;
y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * m_nLinesPerPage) >> 1) - text_border_width;
// set text y position depends of lines count
if (m_nNrOfLines > 1)
// move to top of frame
y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * m_nLinesPerPage) >> 1) - text_border_width;
else
// fit into mid of frame space
y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * std::min(m_nLinesPerPage, m_nNrOfLines)) >> 1) - text_border_width;
for(i = m_nCurrentLine; i < m_nNrOfLines && i < m_nCurrentLine + m_nLinesPerPage; i++)
{