2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2001-12-11 11:25:37 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
2002-08-13 23:26:46 +00:00
|
|
|
Class: TextBanner
|
2001-12-11 11:25:37 +00:00
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
Desc: See header.
|
2001-12-11 11:25:37 +00:00
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-08-13 23:26:46 +00:00
|
|
|
Chris Danford
|
2001-12-11 11:25:37 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "TextBanner.h"
|
2002-08-13 23:26:46 +00:00
|
|
|
#include "RageUtil.h"
|
2003-02-16 04:28:17 +00:00
|
|
|
#include "song.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "PrefsManager.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
2003-02-10 05:30:12 +00:00
|
|
|
#include "SongManager.h"
|
2003-06-05 22:18:42 +00:00
|
|
|
#include "RageTextureManager.h"
|
2003-12-22 06:22:06 +00:00
|
|
|
#include "ActorUtil.h"
|
2003-02-10 05:30:12 +00:00
|
|
|
|
|
|
|
|
|
2003-11-02 08:43:47 +00:00
|
|
|
CachedThemeMetric ARTIST_PREPEND_STRING ("TextBanner","ArtistPrependString");
|
2003-12-22 06:22:06 +00:00
|
|
|
CachedThemeMetric TWO_LINES_TITLE_COMMAND ("TextBanner","TwoLinesTitleCommand");
|
|
|
|
|
CachedThemeMetric TWO_LINES_SUBTITLE_COMMAND ("TextBanner","TwoLinesSubtitleCommand");
|
|
|
|
|
CachedThemeMetric TWO_LINES_ARTIST_COMMAND ("TextBanner","TwoLinesArtistCommand");
|
|
|
|
|
CachedThemeMetric THREE_LINES_TITLE_COMMAND ("TextBanner","ThreeLinesTitleCommand");
|
|
|
|
|
CachedThemeMetric THREE_LINES_SUBTITLE_COMMAND ("TextBanner","ThreeLinesSubtitleCommand");
|
|
|
|
|
CachedThemeMetric THREE_LINES_ARTIST_COMMAND ("TextBanner","ThreeLinesArtistCommand");
|
2001-12-11 11:25:37 +00:00
|
|
|
|
|
|
|
|
TextBanner::TextBanner()
|
|
|
|
|
{
|
2003-11-02 08:43:47 +00:00
|
|
|
ARTIST_PREPEND_STRING.Refresh();
|
2003-12-22 06:22:06 +00:00
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
m_textTitle.SetName( "Title" );
|
2003-04-12 17:39:27 +00:00
|
|
|
m_textTitle.LoadFromFont( THEME->GetPathToF("TextBanner") );
|
2003-12-22 06:22:06 +00:00
|
|
|
UtilSetXYAndOnCommand( m_textTitle, "TextBanner" );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_textTitle );
|
2003-12-22 06:22:06 +00:00
|
|
|
|
|
|
|
|
m_textSubTitle.SetName( "Subtitle" );
|
|
|
|
|
m_textSubTitle.LoadFromFont( THEME->GetPathToF("TextBanner") );
|
|
|
|
|
UtilSetXYAndOnCommand( m_textSubTitle, "TextBanner" );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_textSubTitle );
|
2003-12-22 06:22:06 +00:00
|
|
|
|
|
|
|
|
m_textArtist.SetName( "Artist" );
|
|
|
|
|
m_textArtist.LoadFromFont( THEME->GetPathToF("TextBanner") );
|
|
|
|
|
UtilSetXYAndOnCommand( m_textArtist, "TextBanner" );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_textArtist );
|
2001-12-11 11:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-02-16 10:12:03 +00:00
|
|
|
void TextBanner::LoadFromString(
|
|
|
|
|
CString sDisplayTitle, CString sTranslitTitle,
|
|
|
|
|
CString sDisplaySubTitle, CString sTranslitSubTitle,
|
|
|
|
|
CString sDisplayArtist, CString sTranslitArtist )
|
2001-12-11 11:25:37 +00:00
|
|
|
{
|
2003-05-20 04:14:53 +00:00
|
|
|
bool bTwoLines = sDisplaySubTitle.size() == 0;
|
2001-12-11 11:25:37 +00:00
|
|
|
|
2003-12-22 06:22:06 +00:00
|
|
|
if( bTwoLines )
|
|
|
|
|
{
|
|
|
|
|
m_textTitle.Command( TWO_LINES_TITLE_COMMAND );
|
|
|
|
|
m_textSubTitle.Command( TWO_LINES_SUBTITLE_COMMAND );
|
|
|
|
|
m_textArtist.Command( TWO_LINES_ARTIST_COMMAND );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_textTitle.Command( THREE_LINES_TITLE_COMMAND );
|
|
|
|
|
m_textSubTitle.Command( THREE_LINES_SUBTITLE_COMMAND );
|
|
|
|
|
m_textArtist.Command( THREE_LINES_ARTIST_COMMAND );
|
|
|
|
|
}
|
2003-12-17 09:53:00 +00:00
|
|
|
|
|
|
|
|
m_textTitle.SetText( sDisplayTitle, sTranslitTitle );
|
|
|
|
|
m_textSubTitle.SetText( sDisplaySubTitle, sTranslitSubTitle );
|
|
|
|
|
m_textArtist.SetText( sDisplayArtist, sTranslitArtist );
|
2003-02-16 10:12:03 +00:00
|
|
|
}
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2003-02-16 10:12:03 +00:00
|
|
|
void TextBanner::LoadFromSong( const Song* pSong )
|
|
|
|
|
{
|
|
|
|
|
CString sDisplayTitle = pSong ? pSong->GetDisplayMainTitle() : "";
|
|
|
|
|
CString sTranslitTitle = pSong ? pSong->GetTranslitMainTitle() : "";
|
|
|
|
|
CString sDisplaySubTitle = pSong ? pSong->GetDisplaySubTitle() : "";
|
|
|
|
|
CString sTranslitSubTitle = pSong ? pSong->GetTranslitSubTitle() : "";
|
2003-11-02 08:43:47 +00:00
|
|
|
CString sDisplayArtist = pSong ? (CString)ARTIST_PREPEND_STRING + pSong->GetDisplayArtist() : "";
|
|
|
|
|
CString sTranslitArtist = pSong ? (CString)ARTIST_PREPEND_STRING + pSong->GetTranslitArtist() : "";
|
2003-02-16 10:12:03 +00:00
|
|
|
|
|
|
|
|
LoadFromString(
|
|
|
|
|
sDisplayTitle, sTranslitTitle,
|
|
|
|
|
sDisplaySubTitle, sTranslitSubTitle,
|
|
|
|
|
sDisplayArtist, sTranslitArtist );
|
2001-12-11 11:25:37 +00:00
|
|
|
}
|
2003-02-16 10:12:03 +00:00
|
|
|
|