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-02-10 05:30:12 +00:00
|
|
|
|
|
|
|
|
|
2003-11-03 18:29:46 +00:00
|
|
|
CachedThemeMetricF TITLE_X ("TextBanner","TitleHorizX");
|
|
|
|
|
CachedThemeMetricF SUB_TITLE_X ("TextBanner","SubTitleHorizX");
|
|
|
|
|
CachedThemeMetricF ARTIST_X ("TextBanner","ArtistHorizX");
|
2003-11-02 08:43:47 +00:00
|
|
|
CachedThemeMetricF MAX_TITLE_WIDTH ("TextBanner","MaxTitleWidth");
|
|
|
|
|
CachedThemeMetricF MAX_SUB_TITLE_WIDTH ("TextBanner","MaxSubTitleWidth");
|
|
|
|
|
CachedThemeMetricF MAX_ARTIST_WIDTH ("TextBanner","MaxArtistWidth");
|
|
|
|
|
CachedThemeMetricI TITLE_HORIZ_ALIGN ("TextBanner","TitleHorizAlign");
|
|
|
|
|
CachedThemeMetricI SUB_TITLE_HORIZ_ALIGN ("TextBanner","SubTitleHorizAlign");
|
|
|
|
|
CachedThemeMetricI ARTIST_HORIZ_ALIGN ("TextBanner","ArtistHorizAlign");
|
|
|
|
|
CachedThemeMetric ARTIST_PREPEND_STRING ("TextBanner","ArtistPrependString");
|
|
|
|
|
CachedThemeMetricF TWO_LINES_TITLE_ZOOM ("TextBanner","TwoLinesTitleZoom");
|
|
|
|
|
CachedThemeMetricF TWO_LINES_ARTIST_ZOOM ("TextBanner","TwoLinesArtistZoom");
|
|
|
|
|
CachedThemeMetricF THREE_LINES_TITLE_ZOOM ("TextBanner","ThreeLinesTitleZoom");
|
|
|
|
|
CachedThemeMetricF THREE_LINES_SUB_TITLE_ZOOM ("TextBanner","ThreeLinesSubTitleZoom");
|
|
|
|
|
CachedThemeMetricF THREE_LINES_ARTIST_ZOOM ("TextBanner","ThreeLinesArtistZoom");
|
|
|
|
|
CachedThemeMetricF TWO_LINES_TITLE_Y ("TextBanner","TwoLinesTitleY");
|
|
|
|
|
CachedThemeMetricF TWO_LINES_ARTIST_Y ("TextBanner","TwoLinesArtistY");
|
|
|
|
|
CachedThemeMetricF THREE_LINES_TITLE_Y ("TextBanner","ThreeLinesTitleY");
|
|
|
|
|
CachedThemeMetricF THREE_LINES_SUB_TITLE_Y ("TextBanner","ThreeLinesSubTitleY");
|
|
|
|
|
CachedThemeMetricF THREE_LINES_ARTIST_Y ("TextBanner","ThreeLinesArtistY");
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2001-12-11 11:25:37 +00:00
|
|
|
|
|
|
|
|
TextBanner::TextBanner()
|
|
|
|
|
{
|
2003-11-02 08:43:47 +00:00
|
|
|
TITLE_X.Refresh();
|
|
|
|
|
SUB_TITLE_X.Refresh();
|
|
|
|
|
ARTIST_X.Refresh();
|
|
|
|
|
MAX_TITLE_WIDTH.Refresh();
|
|
|
|
|
MAX_SUB_TITLE_WIDTH.Refresh();
|
|
|
|
|
MAX_ARTIST_WIDTH.Refresh();
|
|
|
|
|
TITLE_HORIZ_ALIGN.Refresh();
|
|
|
|
|
SUB_TITLE_HORIZ_ALIGN.Refresh();
|
|
|
|
|
ARTIST_HORIZ_ALIGN.Refresh();
|
|
|
|
|
ARTIST_PREPEND_STRING.Refresh();
|
|
|
|
|
TWO_LINES_TITLE_ZOOM.Refresh();
|
|
|
|
|
TWO_LINES_ARTIST_ZOOM.Refresh();
|
|
|
|
|
THREE_LINES_TITLE_ZOOM.Refresh();
|
|
|
|
|
THREE_LINES_SUB_TITLE_ZOOM.Refresh();
|
|
|
|
|
THREE_LINES_ARTIST_ZOOM.Refresh();
|
|
|
|
|
TWO_LINES_TITLE_Y.Refresh();
|
|
|
|
|
TWO_LINES_ARTIST_Y.Refresh();
|
|
|
|
|
THREE_LINES_TITLE_Y.Refresh();
|
|
|
|
|
THREE_LINES_SUB_TITLE_Y.Refresh();
|
|
|
|
|
THREE_LINES_ARTIST_Y.Refresh();
|
2003-02-10 05:30:12 +00:00
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_textTitle.LoadFromFont( THEME->GetPathToF("TextBanner") );
|
|
|
|
|
m_textSubTitle.LoadFromFont( THEME->GetPathToF("TextBanner") );
|
|
|
|
|
m_textArtist.LoadFromFont( THEME->GetPathToF("TextBanner") );
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2003-11-02 08:43:47 +00:00
|
|
|
m_textTitle.SetX( TITLE_X );
|
|
|
|
|
m_textSubTitle.SetX( SUB_TITLE_X );
|
|
|
|
|
m_textArtist.SetX( ARTIST_X );
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2003-11-02 08:43:47 +00:00
|
|
|
m_textTitle.SetHorizAlign( (Actor::HorizAlign)(int)TITLE_HORIZ_ALIGN );
|
|
|
|
|
m_textSubTitle.SetHorizAlign( (Actor::HorizAlign)(int)SUB_TITLE_HORIZ_ALIGN );
|
|
|
|
|
m_textArtist.SetHorizAlign( (Actor::HorizAlign)(int)ARTIST_HORIZ_ALIGN );
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2003-03-02 01:43:33 +00:00
|
|
|
m_textTitle.EnableShadow( false );
|
|
|
|
|
m_textSubTitle.EnableShadow( false );
|
|
|
|
|
m_textArtist.EnableShadow( false );
|
2002-05-01 19:14:55 +00:00
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
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(
|
|
|
|
|
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-11-02 08:43:47 +00:00
|
|
|
const float fTitleZoom = bTwoLines ? TWO_LINES_TITLE_ZOOM : THREE_LINES_TITLE_ZOOM;
|
2003-11-03 18:29:46 +00:00
|
|
|
const float fSubTitleZoom = bTwoLines ? 0.0f : THREE_LINES_SUB_TITLE_ZOOM;
|
2003-11-02 08:43:47 +00:00
|
|
|
const float fArtistZoom = bTwoLines ? TWO_LINES_ARTIST_ZOOM : THREE_LINES_ARTIST_ZOOM;
|
2001-12-11 11:25:37 +00:00
|
|
|
|
2003-05-20 04:14:53 +00:00
|
|
|
m_textTitle.SetZoom( fTitleZoom );
|
|
|
|
|
m_textSubTitle.SetZoom( fSubTitleZoom );
|
|
|
|
|
m_textArtist.SetZoom( fArtistZoom );
|
|
|
|
|
|
2003-11-02 08:43:47 +00:00
|
|
|
m_textTitle.SetTextMaxWidth( MAX_TITLE_WIDTH, sDisplayTitle, sTranslitTitle );
|
|
|
|
|
m_textSubTitle.SetTextMaxWidth( MAX_SUB_TITLE_WIDTH, sDisplaySubTitle, sTranslitSubTitle );
|
|
|
|
|
m_textArtist.SetTextMaxWidth( MAX_ARTIST_WIDTH, sDisplayArtist, sTranslitArtist );
|
2003-05-20 04:14:53 +00:00
|
|
|
|
2003-11-02 08:43:47 +00:00
|
|
|
const float fTitleY = bTwoLines ? TWO_LINES_TITLE_Y : THREE_LINES_TITLE_Y;
|
2003-11-03 18:29:46 +00:00
|
|
|
const float fSubTitleY = bTwoLines ? 0.0f : THREE_LINES_SUB_TITLE_Y;
|
2003-11-02 08:43:47 +00:00
|
|
|
const float fArtistY = bTwoLines ? TWO_LINES_ARTIST_Y : THREE_LINES_ARTIST_Y;
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2003-02-10 05:30:12 +00:00
|
|
|
m_textTitle.SetY( fTitleY );
|
|
|
|
|
m_textSubTitle.SetY( fSubTitleY );
|
|
|
|
|
m_textArtist.SetY( fArtistY );
|
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
|
|
|
|