2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
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-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"
|
2004-11-06 20:36:04 +00:00
|
|
|
#include "ThemeMetric.h"
|
2003-02-10 05:30:12 +00:00
|
|
|
|
2001-12-11 11:25:37 +00:00
|
|
|
|
2006-01-22 01:00:06 +00:00
|
|
|
void TextBanner::Load( RString sType )
|
2001-12-11 11:25:37 +00:00
|
|
|
{
|
2004-01-21 09:37:17 +00:00
|
|
|
m_bInitted = true;
|
|
|
|
|
|
2005-03-02 03:41:04 +00:00
|
|
|
m_textTitle.SetName( "Title" );
|
2005-03-18 01:55:33 +00:00
|
|
|
m_textTitle.LoadFromFont( THEME->GetPathF(sType,"text") );
|
2005-03-02 03:41:04 +00:00
|
|
|
this->AddChild( &m_textTitle );
|
|
|
|
|
|
|
|
|
|
m_textSubTitle.SetName( "Subtitle" );
|
2005-03-18 01:55:33 +00:00
|
|
|
m_textSubTitle.LoadFromFont( THEME->GetPathF(sType,"text") );
|
2005-03-02 03:41:04 +00:00
|
|
|
this->AddChild( &m_textSubTitle );
|
|
|
|
|
|
|
|
|
|
m_textArtist.SetName( "Artist" );
|
2005-03-18 01:55:33 +00:00
|
|
|
m_textArtist.LoadFromFont( THEME->GetPathF(sType,"text") );
|
2005-03-02 03:41:04 +00:00
|
|
|
this->AddChild( &m_textArtist );
|
|
|
|
|
|
2005-03-18 01:55:33 +00:00
|
|
|
ARTIST_PREPEND_STRING .Load(sType,"ArtistPrependString");
|
|
|
|
|
TWO_LINES_TITLE_COMMAND .Load(sType,"TwoLinesTitleCommand");
|
|
|
|
|
TWO_LINES_SUBTITLE_COMMAND .Load(sType,"TwoLinesSubtitleCommand");
|
|
|
|
|
TWO_LINES_ARTIST_COMMAND .Load(sType,"TwoLinesArtistCommand");
|
|
|
|
|
THREE_LINES_TITLE_COMMAND .Load(sType,"ThreeLinesTitleCommand");
|
|
|
|
|
THREE_LINES_SUBTITLE_COMMAND .Load(sType,"ThreeLinesSubtitleCommand");
|
|
|
|
|
THREE_LINES_ARTIST_COMMAND .Load(sType,"ThreeLinesArtistCommand");
|
|
|
|
|
|
|
|
|
|
ActorUtil::SetXYAndOnCommand( m_textTitle, sType );
|
|
|
|
|
ActorUtil::SetXYAndOnCommand( m_textSubTitle, sType );
|
|
|
|
|
ActorUtil::SetXYAndOnCommand( m_textArtist, sType );
|
2005-03-01 23:33:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextBanner::TextBanner()
|
|
|
|
|
{
|
2004-01-21 09:37:17 +00:00
|
|
|
m_bInitted = false;
|
|
|
|
|
}
|
|
|
|
|
|
2005-09-09 02:44:26 +00:00
|
|
|
TextBanner::TextBanner( const TextBanner &cpy ):
|
|
|
|
|
ActorFrame( cpy ),
|
|
|
|
|
m_bInitted( cpy.m_bInitted ),
|
|
|
|
|
m_textTitle( cpy.m_textTitle ),
|
|
|
|
|
m_textSubTitle( cpy.m_textSubTitle ),
|
|
|
|
|
m_textArtist( cpy.m_textArtist ),
|
|
|
|
|
ARTIST_PREPEND_STRING( cpy.ARTIST_PREPEND_STRING ),
|
|
|
|
|
TWO_LINES_TITLE_COMMAND( cpy.TWO_LINES_TITLE_COMMAND ),
|
|
|
|
|
TWO_LINES_SUBTITLE_COMMAND( cpy.TWO_LINES_SUBTITLE_COMMAND ),
|
|
|
|
|
TWO_LINES_ARTIST_COMMAND( cpy.TWO_LINES_ARTIST_COMMAND ),
|
|
|
|
|
THREE_LINES_TITLE_COMMAND( cpy.THREE_LINES_TITLE_COMMAND ),
|
|
|
|
|
THREE_LINES_SUBTITLE_COMMAND( cpy.THREE_LINES_SUBTITLE_COMMAND ),
|
|
|
|
|
THREE_LINES_ARTIST_COMMAND( cpy.THREE_LINES_ARTIST_COMMAND )
|
|
|
|
|
{
|
|
|
|
|
this->AddChild( &m_textTitle );
|
|
|
|
|
this->AddChild( &m_textSubTitle );
|
|
|
|
|
this->AddChild( &m_textArtist );
|
|
|
|
|
}
|
2001-12-11 11:25:37 +00:00
|
|
|
|
2003-02-16 10:12:03 +00:00
|
|
|
void TextBanner::LoadFromString(
|
2006-01-22 01:00:06 +00:00
|
|
|
const RString &sDisplayTitle, const RString &sTranslitTitle,
|
|
|
|
|
const RString &sDisplaySubTitle, const RString &sTranslitSubTitle,
|
|
|
|
|
const RString &sDisplayArtist, const RString &sTranslitArtist )
|
2001-12-11 11:25:37 +00:00
|
|
|
{
|
2005-03-18 01:55:33 +00:00
|
|
|
ASSERT( m_bInitted );
|
2004-01-21 09:37:17 +00:00
|
|
|
|
2005-03-01 21:55:23 +00:00
|
|
|
m_textTitle.SetText( sDisplayTitle, sTranslitTitle );
|
|
|
|
|
m_textSubTitle.SetText( sDisplaySubTitle, sTranslitSubTitle );
|
|
|
|
|
m_textArtist.SetText( sDisplayArtist, sTranslitArtist );
|
|
|
|
|
|
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 )
|
|
|
|
|
{
|
2006-08-15 19:16:39 +00:00
|
|
|
m_textTitle.RunCommands( TWO_LINES_TITLE_COMMAND );
|
|
|
|
|
m_textSubTitle.RunCommands( TWO_LINES_SUBTITLE_COMMAND );
|
|
|
|
|
m_textArtist.RunCommands( TWO_LINES_ARTIST_COMMAND );
|
2003-12-22 06:22:06 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2006-08-15 19:16:39 +00:00
|
|
|
m_textTitle.RunCommands( THREE_LINES_TITLE_COMMAND );
|
|
|
|
|
m_textSubTitle.RunCommands( THREE_LINES_SUBTITLE_COMMAND );
|
|
|
|
|
m_textArtist.RunCommands( THREE_LINES_ARTIST_COMMAND );
|
2003-12-22 06:22:06 +00:00
|
|
|
}
|
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 )
|
|
|
|
|
{
|
2005-03-18 01:55:33 +00:00
|
|
|
ASSERT( m_bInitted );
|
2004-01-21 09:37:17 +00:00
|
|
|
|
2006-01-22 01:00:06 +00:00
|
|
|
RString sDisplayTitle = pSong ? pSong->GetDisplayMainTitle() : RString("");
|
|
|
|
|
RString sTranslitTitle = pSong ? pSong->GetTranslitMainTitle() : RString("");
|
|
|
|
|
RString sDisplaySubTitle = pSong ? pSong->GetDisplaySubTitle() : RString("");
|
|
|
|
|
RString sTranslitSubTitle = pSong ? pSong->GetTranslitSubTitle() : RString("");
|
|
|
|
|
RString sDisplayArtist = pSong ? (RString)ARTIST_PREPEND_STRING + pSong->GetDisplayArtist() : RString("");
|
|
|
|
|
RString sTranslitArtist = pSong ? (RString)ARTIST_PREPEND_STRING + pSong->GetTranslitArtist() : RString("");
|
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
|
|
|
|
2004-06-07 21:14:03 +00:00
|
|
|
/*
|
|
|
|
|
* (c) 2001-2004 Chris Danford
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
|
|
|
* whom the Software is furnished to do so, provided that the above
|
|
|
|
|
* copyright notice(s) and this permission notice appear in all copies of
|
|
|
|
|
* the Software and that both the above copyright notice(s) and this
|
|
|
|
|
* permission notice appear in supporting documentation.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
|
|
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
|
|
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
|
|
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
|
|
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|