TextBanner cleanup

This commit is contained in:
Glenn Maynard
2003-12-22 06:22:06 +00:00
parent 011afc3362
commit cafc30e6b5
2 changed files with 53 additions and 93 deletions
+17 -19
View File
@@ -3746,26 +3746,24 @@ Line14=list,Reload Songs/Courses
Line15=list,Test Input Line15=list,Test Input
[TextBanner] [TextBanner]
TitleHorizX=-90 TitleX=-90
SubTitleHorizX=-90 TitleY=0
ArtistHorizX=-90 TitleOnCommand=shadowlength,0;horizalign,left
MaxTitleWidth=180 SubtitleX=-90
MaxSubTitleWidth=180 SubtitleY=0
MaxArtistWidth=180 SubtitleOnCommand=shadowlength,0;horizalign,left
TitleHorizAlign=0 ArtistX=-90
SubTitleHorizAlign=0 ArtistY=0
ArtistHorizAlign=0 ArtistOnCommand=shadowlength,0;horizalign,left
ArtistPrependString=/ ArtistPrependString=/
TwoLinesTitleZoom=1.0
TwoLinesArtistZoom=0.6 TwoLinesTitleCommand=zoom,1;maxwidth,180;y,-8
ThreeLinesTitleZoom=1.0 TwoLinesSubtitleCommand=hidden,1
ThreeLinesSubTitleZoom=0.5 TwoLinesArtistCommand=zoom,0.6;maxwidth,266;y,8
ThreeLinesArtistZoom=0.6 ThreeLinesTitleCommand=zoom,1;maxwidth,180;y,-10
TwoLinesTitleY=-8 ThreeLinesSubtitleCommand=hidden,0;zoom,.5;maxwidth,360
TwoLinesArtistY=8 ThreeLinesArtistCommand=zoom,0.6;maxwidth,266;y,10
ThreeLinesTitleY=-10
ThreeLinesSubTitleY=0
ThreeLinesArtistY=10
[CourseEntryDisplay] [CourseEntryDisplay]
BarX=0 BarX=0
+35 -73
View File
@@ -17,71 +17,40 @@
#include "ThemeManager.h" #include "ThemeManager.h"
#include "SongManager.h" #include "SongManager.h"
#include "RageTextureManager.h" #include "RageTextureManager.h"
#include "ActorUtil.h"
CachedThemeMetricF TITLE_X ("TextBanner","TitleHorizX");
CachedThemeMetricF SUB_TITLE_X ("TextBanner","SubTitleHorizX");
CachedThemeMetricF ARTIST_X ("TextBanner","ArtistHorizX");
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"); CachedThemeMetric ARTIST_PREPEND_STRING ("TextBanner","ArtistPrependString");
CachedThemeMetricF TWO_LINES_TITLE_ZOOM ("TextBanner","TwoLinesTitleZoom"); CachedThemeMetric TWO_LINES_TITLE_COMMAND ("TextBanner","TwoLinesTitleCommand");
CachedThemeMetricF TWO_LINES_ARTIST_ZOOM ("TextBanner","TwoLinesArtistZoom"); CachedThemeMetric TWO_LINES_SUBTITLE_COMMAND ("TextBanner","TwoLinesSubtitleCommand");
CachedThemeMetricF THREE_LINES_TITLE_ZOOM ("TextBanner","ThreeLinesTitleZoom"); CachedThemeMetric TWO_LINES_ARTIST_COMMAND ("TextBanner","TwoLinesArtistCommand");
CachedThemeMetricF THREE_LINES_SUB_TITLE_ZOOM ("TextBanner","ThreeLinesSubTitleZoom"); CachedThemeMetric THREE_LINES_TITLE_COMMAND ("TextBanner","ThreeLinesTitleCommand");
CachedThemeMetricF THREE_LINES_ARTIST_ZOOM ("TextBanner","ThreeLinesArtistZoom"); CachedThemeMetric THREE_LINES_SUBTITLE_COMMAND ("TextBanner","ThreeLinesSubtitleCommand");
CachedThemeMetricF TWO_LINES_TITLE_Y ("TextBanner","TwoLinesTitleY"); CachedThemeMetric THREE_LINES_ARTIST_COMMAND ("TextBanner","ThreeLinesArtistCommand");
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");
TextBanner::TextBanner() TextBanner::TextBanner()
{ {
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(); ARTIST_PREPEND_STRING.Refresh();
TWO_LINES_TITLE_ZOOM.Refresh(); TWO_LINES_TITLE_COMMAND.Refresh();
TWO_LINES_ARTIST_ZOOM.Refresh(); TWO_LINES_SUBTITLE_COMMAND.Refresh();
THREE_LINES_TITLE_ZOOM.Refresh(); TWO_LINES_ARTIST_COMMAND.Refresh();
THREE_LINES_SUB_TITLE_ZOOM.Refresh(); THREE_LINES_TITLE_COMMAND.Refresh();
THREE_LINES_ARTIST_ZOOM.Refresh(); THREE_LINES_SUBTITLE_COMMAND.Refresh();
TWO_LINES_TITLE_Y.Refresh(); THREE_LINES_ARTIST_COMMAND.Refresh();
TWO_LINES_ARTIST_Y.Refresh();
THREE_LINES_TITLE_Y.Refresh();
THREE_LINES_SUB_TITLE_Y.Refresh();
THREE_LINES_ARTIST_Y.Refresh();
m_textTitle.SetName( "Title" );
m_textTitle.LoadFromFont( THEME->GetPathToF("TextBanner") ); m_textTitle.LoadFromFont( THEME->GetPathToF("TextBanner") );
m_textSubTitle.LoadFromFont( THEME->GetPathToF("TextBanner") ); UtilSetXYAndOnCommand( m_textTitle, "TextBanner" );
m_textArtist.LoadFromFont( THEME->GetPathToF("TextBanner") );
m_textTitle.SetX( TITLE_X );
m_textSubTitle.SetX( SUB_TITLE_X );
m_textArtist.SetX( ARTIST_X );
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 );
m_textTitle.EnableShadow( false );
m_textSubTitle.EnableShadow( false );
m_textArtist.EnableShadow( false );
this->AddChild( &m_textTitle ); this->AddChild( &m_textTitle );
m_textSubTitle.SetName( "Subtitle" );
m_textSubTitle.LoadFromFont( THEME->GetPathToF("TextBanner") );
UtilSetXYAndOnCommand( m_textSubTitle, "TextBanner" );
this->AddChild( &m_textSubTitle ); this->AddChild( &m_textSubTitle );
m_textArtist.SetName( "Artist" );
m_textArtist.LoadFromFont( THEME->GetPathToF("TextBanner") );
UtilSetXYAndOnCommand( m_textArtist, "TextBanner" );
this->AddChild( &m_textArtist ); this->AddChild( &m_textArtist );
} }
@@ -93,29 +62,22 @@ void TextBanner::LoadFromString(
{ {
bool bTwoLines = sDisplaySubTitle.size() == 0; bool bTwoLines = sDisplaySubTitle.size() == 0;
const float fTitleZoom = bTwoLines ? TWO_LINES_TITLE_ZOOM : THREE_LINES_TITLE_ZOOM; if( bTwoLines )
const float fSubTitleZoom = bTwoLines ? 0.0f : THREE_LINES_SUB_TITLE_ZOOM; {
const float fArtistZoom = bTwoLines ? TWO_LINES_ARTIST_ZOOM : THREE_LINES_ARTIST_ZOOM; m_textTitle.Command( TWO_LINES_TITLE_COMMAND );
m_textSubTitle.Command( TWO_LINES_SUBTITLE_COMMAND );
m_textTitle.SetZoom( fTitleZoom ); m_textArtist.Command( TWO_LINES_ARTIST_COMMAND );
m_textSubTitle.SetZoom( fSubTitleZoom ); }
m_textArtist.SetZoom( fArtistZoom ); else
{
m_textTitle.SetMaxWidth( MAX_TITLE_WIDTH ); m_textTitle.Command( THREE_LINES_TITLE_COMMAND );
m_textSubTitle.SetMaxWidth( MAX_SUB_TITLE_WIDTH ); m_textSubTitle.Command( THREE_LINES_SUBTITLE_COMMAND );
m_textArtist.SetMaxWidth( MAX_ARTIST_WIDTH ); m_textArtist.Command( THREE_LINES_ARTIST_COMMAND );
}
m_textTitle.SetText( sDisplayTitle, sTranslitTitle ); m_textTitle.SetText( sDisplayTitle, sTranslitTitle );
m_textSubTitle.SetText( sDisplaySubTitle, sTranslitSubTitle ); m_textSubTitle.SetText( sDisplaySubTitle, sTranslitSubTitle );
m_textArtist.SetText( sDisplayArtist, sTranslitArtist ); m_textArtist.SetText( sDisplayArtist, sTranslitArtist );
const float fTitleY = bTwoLines ? TWO_LINES_TITLE_Y : THREE_LINES_TITLE_Y;
const float fSubTitleY = bTwoLines ? 0.0f : THREE_LINES_SUB_TITLE_Y;
const float fArtistY = bTwoLines ? TWO_LINES_ARTIST_Y : THREE_LINES_ARTIST_Y;
m_textTitle.SetY( fTitleY );
m_textSubTitle.SetY( fSubTitleY );
m_textArtist.SetY( fArtistY );
} }
void TextBanner::LoadFromSong( const Song* pSong ) void TextBanner::LoadFromSong( const Song* pSong )