Revert. I will probally revert further/manually undo some changes.
This commit is contained in:
@@ -367,24 +367,9 @@ void BitmapText::SetText( const CString& _sText, const CString& _sAlternateText,
|
|||||||
m_vColors.clear();
|
m_vColors.clear();
|
||||||
|
|
||||||
int i = m_sText.Find( "|c0", 0 );
|
int i = m_sText.Find( "|c0", 0 );
|
||||||
int last = 0, iNewlineCount = -3;
|
int last = 0;
|
||||||
|
|
||||||
while ( ( i > -1 ) && ( i < ( int( m_sText.length() ) - 9 ) ) )
|
while ( ( i > -1 ) && ( i < ( int( m_sText.length() ) - 9 ) ) )
|
||||||
{
|
{
|
||||||
int j = m_sText.Find( CString("\n"), last+1 );
|
|
||||||
//Count \n's from previous to now.
|
|
||||||
|
|
||||||
LOG->Info("M4");
|
|
||||||
|
|
||||||
while ( ( j < i ) && ( j >= 0 ) )
|
|
||||||
{
|
|
||||||
j = m_sText.Find( CString("\n"), j+1 );
|
|
||||||
iNewlineCount+=2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LOG->Info("M5");
|
|
||||||
|
|
||||||
sEndText += m_sText.substr( last, i-last );
|
sEndText += m_sText.substr( last, i-last );
|
||||||
ColorChange change;
|
ColorChange change;
|
||||||
int k;
|
int k;
|
||||||
@@ -392,7 +377,7 @@ void BitmapText::SetText( const CString& _sText, const CString& _sAlternateText,
|
|||||||
sscanf( m_sText.substr( i+5, 2 ).c_str(), "%x", &k ); change.c.g = float( k ) / 255.0f;
|
sscanf( m_sText.substr( i+5, 2 ).c_str(), "%x", &k ); change.c.g = float( k ) / 255.0f;
|
||||||
sscanf( m_sText.substr( i+7, 2 ).c_str(), "%x", &k ); change.c.b = float( k ) / 255.0f;
|
sscanf( m_sText.substr( i+7, 2 ).c_str(), "%x", &k ); change.c.b = float( k ) / 255.0f;
|
||||||
change.c.a = 1;
|
change.c.a = 1;
|
||||||
change.l = sEndText.length() - MAX( iNewlineCount, 0 );
|
change.l = sEndText.length();
|
||||||
m_vColors.push_back( change );
|
m_vColors.push_back( change );
|
||||||
last = i+9;
|
last = i+9;
|
||||||
if ( last < (int)m_sText.length() )
|
if ( last < (int)m_sText.length() )
|
||||||
@@ -598,42 +583,6 @@ 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( (int)m_wTextLines.size(), iNumLines );
|
|
||||||
if( iDirection == 0 )
|
|
||||||
{
|
|
||||||
// Crop all bottom lines
|
|
||||||
m_wTextLines.resize( iNumLines );
|
|
||||||
m_iLineWidths.resize( iNumLines );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Because colors are relative to the beginning, we have to crop them back
|
|
||||||
unsigned shift = 0;
|
|
||||||
|
|
||||||
LOG->Info("M1");
|
|
||||||
for ( unsigned i = 0; i < m_wTextLines.size() - iNumLines; i++ )
|
|
||||||
shift += m_wTextLines[i].length();
|
|
||||||
|
|
||||||
for ( unsigned i = 0; i < m_vColors.size(); i++ )
|
|
||||||
{
|
|
||||||
m_vColors[i].l -= shift;
|
|
||||||
if ( m_vColors[i].l < 0 )
|
|
||||||
{
|
|
||||||
m_vColors.erase( m_vColors.begin() + i );
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LOG->Info("M2");
|
|
||||||
|
|
||||||
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 );
|
||||||
|
|||||||
@@ -47,8 +47,6 @@ 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 );
|
||||||
|
|
||||||
virtual bool EarlyAbortDraw();
|
virtual bool EarlyAbortDraw();
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ void ScreenNetSelectBase::Init()
|
|||||||
this->AddChild( &m_textChatOutput );
|
this->AddChild( &m_textChatOutput );
|
||||||
|
|
||||||
m_textChatOutput.SetText( NSMAN->m_sChatText );
|
m_textChatOutput.SetText( NSMAN->m_sChatText );
|
||||||
m_textChatOutput.SetMaxLines( SHOW_CHAT_LINES, 1 );
|
|
||||||
|
|
||||||
//Users' Background
|
//Users' Background
|
||||||
|
|
||||||
@@ -192,7 +191,6 @@ void ScreenNetSelectBase::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
else if( SM == SM_AddToChat )
|
else if( SM == SM_AddToChat )
|
||||||
{
|
{
|
||||||
m_textChatOutput.SetText( NSMAN->m_sChatText );
|
m_textChatOutput.SetText( NSMAN->m_sChatText );
|
||||||
m_textChatOutput.SetMaxLines( SHOW_CHAT_LINES, 1 );
|
|
||||||
}
|
}
|
||||||
else if( SM == SM_UsersUpdate )
|
else if( SM == SM_UsersUpdate )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user