Cleanup, we should not have two text boxes and be moving stuff around between them in order to limit the number of lines
This commit is contained in:
@@ -583,6 +583,24 @@ bool BitmapText::StringWillUseAlternate( const CString& sText, const CString& sA
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BitmapText::SetMaxLines( int iNumLines, int iDirection )
|
||||||
|
{
|
||||||
|
iNumLines = MAX( 0, iNumLines );
|
||||||
|
iNumLines = MIN( m_wTextLines.size(), iNumLines );
|
||||||
|
if ( iDirection == 0 )
|
||||||
|
{
|
||||||
|
//Crop all bottom lines
|
||||||
|
m_wTextLines.resize( iNumLines );
|
||||||
|
m_iLineWidths.resize( iNumLines );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_wTextLines.erase( m_wTextLines.begin(), m_wTextLines.end() - iNumLines );
|
||||||
|
m_iLineWidths.erase( m_iLineWidths.begin(), m_iLineWidths.end() - iNumLines );
|
||||||
|
}
|
||||||
|
BuildChars();
|
||||||
|
}
|
||||||
|
|
||||||
void BitmapText::CropToWidth( int iMaxWidthInSourcePixels )
|
void BitmapText::CropToWidth( int iMaxWidthInSourcePixels )
|
||||||
{
|
{
|
||||||
iMaxWidthInSourcePixels = max( 0, iMaxWidthInSourcePixels );
|
iMaxWidthInSourcePixels = max( 0, iMaxWidthInSourcePixels );
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public:
|
|||||||
void SetMaxWidth( float fMaxWidth );
|
void SetMaxWidth( float fMaxWidth );
|
||||||
void SetMaxHeight( float fMaxHeight );
|
void SetMaxHeight( float fMaxHeight );
|
||||||
void SetWrapWidthPixels( int iWrapWidthPixels );
|
void SetWrapWidthPixels( int iWrapWidthPixels );
|
||||||
|
void SetMaxLines( int iNumLines, int iDirection = 0 ); //Direction: 0 for crop bottom, 1 for crop top
|
||||||
|
|
||||||
void CropToWidth( int iWidthInSourcePixels );
|
void CropToWidth( int iWidthInSourcePixels );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user