From fc66cf3bffdf1ce78a887ed5258c66161b02fc70 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 21 Jan 2004 09:37:17 +0000 Subject: [PATCH] use m_sName --- stepmania/src/TextBanner.cpp | 38 ++++++++++++++++++++++++------------ stepmania/src/TextBanner.h | 2 ++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/stepmania/src/TextBanner.cpp b/stepmania/src/TextBanner.cpp index db41b21646..376d075649 100644 --- a/stepmania/src/TextBanner.cpp +++ b/stepmania/src/TextBanner.cpp @@ -20,7 +20,7 @@ #include "ActorUtil.h" -CachedThemeMetric ARTIST_PREPEND_STRING ("TextBanner","ArtistPrependString"); +CachedThemeMetric ARTIST_PREPEND_STRING ("TextBanner","ArtistPrependString"); CachedThemeMetric TWO_LINES_TITLE_COMMAND ("TextBanner","TwoLinesTitleCommand"); CachedThemeMetric TWO_LINES_SUBTITLE_COMMAND ("TextBanner","TwoLinesSubtitleCommand"); CachedThemeMetric TWO_LINES_ARTIST_COMMAND ("TextBanner","TwoLinesArtistCommand"); @@ -28,38 +28,50 @@ CachedThemeMetric THREE_LINES_TITLE_COMMAND ("TextBanner","ThreeLinesTitleComma CachedThemeMetric THREE_LINES_SUBTITLE_COMMAND ("TextBanner","ThreeLinesSubtitleCommand"); CachedThemeMetric THREE_LINES_ARTIST_COMMAND ("TextBanner","ThreeLinesArtistCommand"); -TextBanner::TextBanner() +void TextBanner::Init() { - ARTIST_PREPEND_STRING.Refresh(); - TWO_LINES_TITLE_COMMAND.Refresh(); - TWO_LINES_SUBTITLE_COMMAND.Refresh(); - TWO_LINES_ARTIST_COMMAND.Refresh(); - THREE_LINES_TITLE_COMMAND.Refresh(); - THREE_LINES_SUBTITLE_COMMAND.Refresh(); - THREE_LINES_ARTIST_COMMAND.Refresh(); + if( m_bInitted ) + return; + m_bInitted = true; + + ASSERT( m_sName != "" ); + ARTIST_PREPEND_STRING.Refresh( m_sName ); + TWO_LINES_TITLE_COMMAND.Refresh( m_sName ); + TWO_LINES_SUBTITLE_COMMAND.Refresh( m_sName ); + TWO_LINES_ARTIST_COMMAND.Refresh( m_sName ); + THREE_LINES_TITLE_COMMAND.Refresh( m_sName ); + THREE_LINES_SUBTITLE_COMMAND.Refresh( m_sName ); + THREE_LINES_ARTIST_COMMAND.Refresh( m_sName ); m_textTitle.SetName( "Title" ); m_textTitle.LoadFromFont( THEME->GetPathToF("TextBanner") ); - UtilSetXYAndOnCommand( m_textTitle, "TextBanner" ); + SET_XY_AND_ON_COMMAND( m_textTitle ); this->AddChild( &m_textTitle ); m_textSubTitle.SetName( "Subtitle" ); m_textSubTitle.LoadFromFont( THEME->GetPathToF("TextBanner") ); - UtilSetXYAndOnCommand( m_textSubTitle, "TextBanner" ); + SET_XY_AND_ON_COMMAND( m_textSubTitle ); this->AddChild( &m_textSubTitle ); m_textArtist.SetName( "Artist" ); m_textArtist.LoadFromFont( THEME->GetPathToF("TextBanner") ); - UtilSetXYAndOnCommand( m_textArtist, "TextBanner" ); + SET_XY_AND_ON_COMMAND( m_textArtist ); this->AddChild( &m_textArtist ); } +TextBanner::TextBanner() +{ + m_bInitted = false; +} + void TextBanner::LoadFromString( CString sDisplayTitle, CString sTranslitTitle, CString sDisplaySubTitle, CString sTranslitSubTitle, CString sDisplayArtist, CString sTranslitArtist ) { + Init(); + bool bTwoLines = sDisplaySubTitle.size() == 0; if( bTwoLines ) @@ -82,6 +94,8 @@ void TextBanner::LoadFromString( void TextBanner::LoadFromSong( const Song* pSong ) { + Init(); + CString sDisplayTitle = pSong ? pSong->GetDisplayMainTitle() : ""; CString sTranslitTitle = pSong ? pSong->GetTranslitMainTitle() : ""; CString sDisplaySubTitle = pSong ? pSong->GetDisplaySubTitle() : ""; diff --git a/stepmania/src/TextBanner.h b/stepmania/src/TextBanner.h index 385805c483..5f277c7c1e 100644 --- a/stepmania/src/TextBanner.h +++ b/stepmania/src/TextBanner.h @@ -26,6 +26,8 @@ public: CString sDisplayArtist, CString sTranslitArtist ); private: + bool m_bInitted; + void Init(); BitmapText m_textTitle, m_textSubTitle, m_textArtist; };