move theming of title text from ScreenOptions to OptionRow
This commit is contained in:
@@ -8,6 +8,10 @@
|
|||||||
#include "FontManager.h"
|
#include "FontManager.h"
|
||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
#include "CommonMetrics.h"
|
#include "CommonMetrics.h"
|
||||||
|
#include "GameState.h"
|
||||||
|
#include "song.h"
|
||||||
|
#include "Course.h"
|
||||||
|
#include "Style.h"
|
||||||
|
|
||||||
static const CString SelectTypeNames[NUM_SELECT_TYPES] = {
|
static const CString SelectTypeNames[NUM_SELECT_TYPES] = {
|
||||||
"SelectOne",
|
"SelectOne",
|
||||||
@@ -29,6 +33,7 @@ StringToX( LayoutType );
|
|||||||
|
|
||||||
#define PREPARE_ITEM_TEXT( s ) if( s!= "" ) { if( THEME_ITEMS ) s = THEME_OPTION_ITEM( s, false ); if( CAPITALIZE_ALL_OPTION_NAMES ) s.MakeUpper(); }
|
#define PREPARE_ITEM_TEXT( s ) if( s!= "" ) { if( THEME_ITEMS ) s = THEME_OPTION_ITEM( s, false ); if( CAPITALIZE_ALL_OPTION_NAMES ) s.MakeUpper(); }
|
||||||
|
|
||||||
|
static CString OPTION_TITLE( CString s ) { return THEME->GetMetric("OptionTitles",s); }
|
||||||
|
|
||||||
const CString NEXT_ROW_NAME = "NextRow";
|
const CString NEXT_ROW_NAME = "NextRow";
|
||||||
|
|
||||||
@@ -106,6 +111,8 @@ void OptionRow::LoadMetrics( const CString &sType )
|
|||||||
SHOW_UNDERLINES .Load(m_sType,"ShowUnderlines");
|
SHOW_UNDERLINES .Load(m_sType,"ShowUnderlines");
|
||||||
TWEEN_SECONDS .Load(m_sType,"TweenSeconds");
|
TWEEN_SECONDS .Load(m_sType,"TweenSeconds");
|
||||||
THEME_ITEMS .Load(m_sType,"ThemeItems");
|
THEME_ITEMS .Load(m_sType,"ThemeItems");
|
||||||
|
THEME_ITEMS .Load(m_sType,"ThemeItems");
|
||||||
|
SHOW_BPM_IN_SPEED_TITLE .Load(m_sName,"ShowBpmInSpeedTitle");
|
||||||
|
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
m_OptionIcons[p].Load( m_sType );
|
m_OptionIcons[p].Load( m_sType );
|
||||||
@@ -144,10 +151,54 @@ void OptionRow::LoadNormal( const OptionRowDefinition &def, OptionRowHandler *pH
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionRow::AfterImportOptions(
|
CString OptionRow::GetRowTitle() const
|
||||||
const CString &sTitle,
|
{
|
||||||
float fY
|
CString sLineName = m_RowDef.name;
|
||||||
)
|
CString sTitle = THEME_TITLES ? OPTION_TITLE(sLineName) : sLineName;
|
||||||
|
|
||||||
|
// HACK: tack the BPM onto the name of the speed line
|
||||||
|
if( sLineName.CompareNoCase("speed")==0 )
|
||||||
|
{
|
||||||
|
bool bShowBpmInSpeedTitle = SHOW_BPM_IN_SPEED_TITLE;
|
||||||
|
|
||||||
|
if( GAMESTATE->m_pCurCourse )
|
||||||
|
{
|
||||||
|
Trail* pTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber];
|
||||||
|
const int iNumCourseEntries = pTrail->m_vEntries.size();
|
||||||
|
if( iNumCourseEntries > MAX_COURSE_ENTRIES_BEFORE_VARIOUS )
|
||||||
|
bShowBpmInSpeedTitle = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( bShowBpmInSpeedTitle )
|
||||||
|
{
|
||||||
|
DisplayBpms bpms;
|
||||||
|
if( GAMESTATE->m_pCurSong )
|
||||||
|
{
|
||||||
|
Song* pSong = GAMESTATE->m_pCurSong;
|
||||||
|
pSong->GetDisplayBpms( bpms );
|
||||||
|
}
|
||||||
|
else if( GAMESTATE->m_pCurCourse )
|
||||||
|
{
|
||||||
|
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||||
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
||||||
|
Trail* pTrail = pCourse->GetTrail( st );
|
||||||
|
ASSERT( pTrail );
|
||||||
|
pTrail->GetDisplayBpms( bpms );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( bpms.IsSecret() )
|
||||||
|
sTitle += ssprintf( " (??" "?)" ); /* split so gcc doesn't think this is a trigraph */
|
||||||
|
else if( bpms.BpmIsConstant() )
|
||||||
|
sTitle += ssprintf( " (%.0f)", bpms.GetMin() );
|
||||||
|
else
|
||||||
|
sTitle += ssprintf( " (%.0f-%.0f)", bpms.GetMin(), bpms.GetMax() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OptionRow::AfterImportOptions( float fY )
|
||||||
{
|
{
|
||||||
// Make all selections the same if bOneChoiceForAllPlayers
|
// Make all selections the same if bOneChoiceForAllPlayers
|
||||||
if( m_RowDef.bOneChoiceForAllPlayers )
|
if( m_RowDef.bOneChoiceForAllPlayers )
|
||||||
@@ -312,6 +363,7 @@ void OptionRow::AfterImportOptions(
|
|||||||
|
|
||||||
|
|
||||||
m_textTitle.LoadFromFont( THEME->GetPathF(m_sType,"title") );
|
m_textTitle.LoadFromFont( THEME->GetPathF(m_sType,"title") );
|
||||||
|
CString sTitle = GetRowTitle();
|
||||||
m_textTitle.SetText( sTitle );
|
m_textTitle.SetText( sTitle );
|
||||||
m_textTitle.SetXY( LABELS_X, fY );
|
m_textTitle.SetXY( LABELS_X, fY );
|
||||||
m_textTitle.RunCommands( LABELS_ON_COMMAND );
|
m_textTitle.RunCommands( LABELS_ON_COMMAND );
|
||||||
|
|||||||
@@ -86,13 +86,12 @@ public:
|
|||||||
void LoadExit();
|
void LoadExit();
|
||||||
void LoadOptionIcon( PlayerNumber pn, const CString &sText );
|
void LoadOptionIcon( PlayerNumber pn, const CString &sText );
|
||||||
|
|
||||||
|
CString GetRowTitle() const;
|
||||||
|
|
||||||
void ImportOptions( PlayerNumber pn );
|
void ImportOptions( PlayerNumber pn );
|
||||||
int ExportOptions( PlayerNumber pn );
|
int ExportOptions( PlayerNumber pn );
|
||||||
|
|
||||||
void AfterImportOptions(
|
void AfterImportOptions( float fY );
|
||||||
const CString &sTitle,
|
|
||||||
float fY
|
|
||||||
);
|
|
||||||
void DetachHandler();
|
void DetachHandler();
|
||||||
|
|
||||||
void PositionUnderlines( PlayerNumber pn );
|
void PositionUnderlines( PlayerNumber pn );
|
||||||
@@ -201,6 +200,8 @@ protected:
|
|||||||
ThemeMetric<bool> SHOW_UNDERLINES;
|
ThemeMetric<bool> SHOW_UNDERLINES;
|
||||||
ThemeMetric<float> TWEEN_SECONDS;
|
ThemeMetric<float> TWEEN_SECONDS;
|
||||||
ThemeMetric<bool> THEME_ITEMS;
|
ThemeMetric<bool> THEME_ITEMS;
|
||||||
|
ThemeMetric<bool> THEME_TITLES;
|
||||||
|
ThemeMetric<bool> SHOW_BPM_IN_SPEED_TITLE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,12 +10,8 @@
|
|||||||
#include "InputMapper.h"
|
#include "InputMapper.h"
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
#include "ProfileManager.h"
|
#include "ProfileManager.h"
|
||||||
#include "song.h"
|
|
||||||
#include "Course.h"
|
|
||||||
#include "Style.h"
|
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
#include "Command.h"
|
#include "Command.h"
|
||||||
#include "CommonMetrics.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -71,10 +67,6 @@ static CString EXPLANATION_X_NAME( size_t p ) { return ssprintf("ExplanationP%
|
|||||||
static CString EXPLANATION_Y_NAME( size_t p ) { return ssprintf("ExplanationP%dY",p+1); }
|
static CString EXPLANATION_Y_NAME( size_t p ) { return ssprintf("ExplanationP%dY",p+1); }
|
||||||
static CString EXPLANATION_ON_COMMAND_NAME( size_t p ) { return ssprintf("ExplanationP%dOnCommand",p+1); }
|
static CString EXPLANATION_ON_COMMAND_NAME( size_t p ) { return ssprintf("ExplanationP%dOnCommand",p+1); }
|
||||||
|
|
||||||
static CString OPTION_TITLE( CString s )
|
|
||||||
{
|
|
||||||
return THEME->GetMetric("OptionTitles",s);
|
|
||||||
}
|
|
||||||
static CString OPTION_EXPLANATION( CString s )
|
static CString OPTION_EXPLANATION( CString s )
|
||||||
{
|
{
|
||||||
return THEME->GetMetric("OptionExplanations",s);
|
return THEME->GetMetric("OptionExplanations",s);
|
||||||
@@ -97,14 +89,12 @@ ScreenOptions::ScreenOptions( CString sClassName ) : ScreenWithMenuElements(sCla
|
|||||||
SCROLL_BAR_HEIGHT (m_sName,"ScrollBarHeight"),
|
SCROLL_BAR_HEIGHT (m_sName,"ScrollBarHeight"),
|
||||||
SCROLL_BAR_TIME (m_sName,"ScrollBarTime"),
|
SCROLL_BAR_TIME (m_sName,"ScrollBarTime"),
|
||||||
EXPLANATION_ZOOM (m_sName,"ExplanationZoom"),
|
EXPLANATION_ZOOM (m_sName,"ExplanationZoom"),
|
||||||
SHOW_BPM_IN_SPEED_TITLE (m_sName,"ShowBpmInSpeedTitle"),
|
|
||||||
FRAME_ON_COMMAND (m_sName,"FrameOnCommand"),
|
FRAME_ON_COMMAND (m_sName,"FrameOnCommand"),
|
||||||
FRAME_OFF_COMMAND (m_sName,"FrameOffCommand"),
|
FRAME_OFF_COMMAND (m_sName,"FrameOffCommand"),
|
||||||
SHOW_EXIT_ROW (m_sName,"ShowExitRow"),
|
SHOW_EXIT_ROW (m_sName,"ShowExitRow"),
|
||||||
SEPARATE_EXIT_ROW (m_sName,"SeparateExitRow"),
|
SEPARATE_EXIT_ROW (m_sName,"SeparateExitRow"),
|
||||||
SEPARATE_EXIT_ROW_Y (m_sName,"SeparateExitRowY"),
|
SEPARATE_EXIT_ROW_Y (m_sName,"SeparateExitRowY"),
|
||||||
SHOW_EXPLANATIONS (m_sName,"ShowExplanations"),
|
SHOW_EXPLANATIONS (m_sName,"ShowExplanations")
|
||||||
THEME_TITLES (m_sName,"ThemeTitles")
|
|
||||||
{
|
{
|
||||||
m_fLockInputSecs = 0.0001f; // always lock for a tiny amount of time so that we throw away any queued inputs during the load.
|
m_fLockInputSecs = 0.0001f; // always lock for a tiny amount of time so that we throw away any queued inputs during the load.
|
||||||
|
|
||||||
@@ -173,10 +163,7 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
|
|||||||
CLAMP( pos, 0, NUM_ROWS_SHOWN-1 );
|
CLAMP( pos, 0, NUM_ROWS_SHOWN-1 );
|
||||||
const float fY = ROW_Y.GetValue( pos );
|
const float fY = ROW_Y.GetValue( pos );
|
||||||
|
|
||||||
row.AfterImportOptions(
|
row.AfterImportOptions( fY );
|
||||||
GetRowTitle( r ),
|
|
||||||
fY
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sprPage.Load( THEME->GetPathG(m_sName,"page") );
|
m_sprPage.Load( THEME->GetPathG(m_sName,"page") );
|
||||||
@@ -273,7 +260,6 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
|
|||||||
for( int r=0; r<(int)m_Rows.size(); r++ ) // foreach row
|
for( int r=0; r<(int)m_Rows.size(); r++ ) // foreach row
|
||||||
{
|
{
|
||||||
GetExplanationText( r );
|
GetExplanationText( r );
|
||||||
GetRowTitle( r );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// put focus on the first enabled row
|
// put focus on the first enabled row
|
||||||
@@ -334,55 +320,6 @@ CString ScreenOptions::GetExplanationText( int iRow ) const
|
|||||||
return SHOW_EXPLANATIONS ? OPTION_EXPLANATION(sLineName) : "";
|
return SHOW_EXPLANATIONS ? OPTION_EXPLANATION(sLineName) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
CString ScreenOptions::GetRowTitle( int iRow ) const
|
|
||||||
{
|
|
||||||
OptionRow &row = *m_Rows[iRow];
|
|
||||||
|
|
||||||
CString sLineName = row.GetRowDef().name;
|
|
||||||
CString sTitle = THEME_TITLES ? OPTION_TITLE(sLineName) : sLineName;
|
|
||||||
|
|
||||||
// HACK: tack the BPM onto the name of the speed line
|
|
||||||
if( sLineName.CompareNoCase("speed")==0 )
|
|
||||||
{
|
|
||||||
bool bShowBpmInSpeedTitle = SHOW_BPM_IN_SPEED_TITLE;
|
|
||||||
|
|
||||||
if( GAMESTATE->m_pCurCourse )
|
|
||||||
{
|
|
||||||
Trail* pTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber];
|
|
||||||
const int iNumCourseEntries = pTrail->m_vEntries.size();
|
|
||||||
if( iNumCourseEntries > MAX_COURSE_ENTRIES_BEFORE_VARIOUS )
|
|
||||||
bShowBpmInSpeedTitle = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( bShowBpmInSpeedTitle )
|
|
||||||
{
|
|
||||||
DisplayBpms bpms;
|
|
||||||
if( GAMESTATE->m_pCurSong )
|
|
||||||
{
|
|
||||||
Song* pSong = GAMESTATE->m_pCurSong;
|
|
||||||
pSong->GetDisplayBpms( bpms );
|
|
||||||
}
|
|
||||||
else if( GAMESTATE->m_pCurCourse )
|
|
||||||
{
|
|
||||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
|
||||||
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
|
||||||
Trail* pTrail = pCourse->GetTrail( st );
|
|
||||||
ASSERT( pTrail );
|
|
||||||
pTrail->GetDisplayBpms( bpms );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( bpms.IsSecret() )
|
|
||||||
sTitle += ssprintf( " (??" "?)" ); /* split so gcc doesn't think this is a trigraph */
|
|
||||||
else if( bpms.BpmIsConstant() )
|
|
||||||
sTitle += ssprintf( " (%.0f)", bpms.GetMin() );
|
|
||||||
else
|
|
||||||
sTitle += ssprintf( " (%.0f-%.0f)", bpms.GetMin(), bpms.GetMax() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
BitmapText &ScreenOptions::GetTextItemForRow( PlayerNumber pn, int iRow, int iChoiceOnRow )
|
BitmapText &ScreenOptions::GetTextItemForRow( PlayerNumber pn, int iRow, int iChoiceOnRow )
|
||||||
{
|
{
|
||||||
ASSERT_M( iRow < (int)m_Rows.size(), ssprintf("%i < %i", iRow, (int)m_Rows.size() ) );
|
ASSERT_M( iRow < (int)m_Rows.size(), ssprintf("%i < %i", iRow, (int)m_Rows.size() ) );
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ protected:
|
|||||||
void InitOptionsText();
|
void InitOptionsText();
|
||||||
void GetWidthXY( PlayerNumber pn, int iRow, int iChoiceOnRow, int &iWidthOut, int &iXOut, int &iYOut );
|
void GetWidthXY( PlayerNumber pn, int iRow, int iChoiceOnRow, int &iWidthOut, int &iXOut, int &iYOut );
|
||||||
CString GetExplanationText( int row ) const;
|
CString GetExplanationText( int row ) const;
|
||||||
CString GetRowTitle( int row ) const;
|
|
||||||
BitmapText &GetTextItemForRow( PlayerNumber pn, int iRow, int iChoiceOnRow );
|
BitmapText &GetTextItemForRow( PlayerNumber pn, int iRow, int iChoiceOnRow );
|
||||||
void PositionUnderlines( int row, PlayerNumber pn );
|
void PositionUnderlines( int row, PlayerNumber pn );
|
||||||
void PositionAllUnderlines();
|
void PositionAllUnderlines();
|
||||||
@@ -134,14 +133,12 @@ protected:
|
|||||||
ThemeMetric<float> SCROLL_BAR_HEIGHT;
|
ThemeMetric<float> SCROLL_BAR_HEIGHT;
|
||||||
ThemeMetric<float> SCROLL_BAR_TIME;
|
ThemeMetric<float> SCROLL_BAR_TIME;
|
||||||
ThemeMetric<float> EXPLANATION_ZOOM;
|
ThemeMetric<float> EXPLANATION_ZOOM;
|
||||||
ThemeMetric<bool> SHOW_BPM_IN_SPEED_TITLE;
|
|
||||||
ThemeMetric<apActorCommands> FRAME_ON_COMMAND;
|
ThemeMetric<apActorCommands> FRAME_ON_COMMAND;
|
||||||
ThemeMetric<apActorCommands> FRAME_OFF_COMMAND;
|
ThemeMetric<apActorCommands> FRAME_OFF_COMMAND;
|
||||||
ThemeMetric<bool> SHOW_EXIT_ROW;
|
ThemeMetric<bool> SHOW_EXIT_ROW;
|
||||||
ThemeMetric<bool> SEPARATE_EXIT_ROW;
|
ThemeMetric<bool> SEPARATE_EXIT_ROW;
|
||||||
ThemeMetric<float> SEPARATE_EXIT_ROW_Y;
|
ThemeMetric<float> SEPARATE_EXIT_ROW_Y;
|
||||||
ThemeMetric<bool> SHOW_EXPLANATIONS;
|
ThemeMetric<bool> SHOW_EXPLANATIONS;
|
||||||
ThemeMetric<bool> THEME_TITLES;
|
|
||||||
|
|
||||||
float m_fLockInputSecs;
|
float m_fLockInputSecs;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user