From 685e2e7412a7cf0cce1d6ac5d41fba1f5f8c0dbd Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 1 Sep 2006 04:54:15 +0000 Subject: [PATCH] Split part of OptionRow::GetThemedItemText into OptionRowHandler::GetThemedItemText. (OptionRowHandler handles low-level option sets, including row and option titles; OptionRow handles ScreenOption-specific parts, like "NextRow".) --- stepmania/src/OptionRow.cpp | 23 +++++------------------ stepmania/src/OptionRowHandler.cpp | 23 +++++++++++++++++++++++ stepmania/src/OptionRowHandler.h | 1 + 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/stepmania/src/OptionRow.cpp b/stepmania/src/OptionRow.cpp index 578c0ea839..61b198ab2b 100644 --- a/stepmania/src/OptionRow.cpp +++ b/stepmania/src/OptionRow.cpp @@ -16,27 +16,14 @@ const RString EXIT_NAME = "Exit"; RString OptionRow::GetThemedItemText( int iChoice ) const { - RString s = m_pHand->m_Def.m_vsChoices[iChoice]; - if( s == "" ) - return ""; - bool bTheme = false; + RString s = m_pHand->GetThemedItemText( iChoice ); // HACK: Always theme the NEXT_ROW and EXIT items. - if( s == NEXT_ROW_NAME ) bTheme = true; - if( s == EXIT_NAME ) bTheme = true; - if( m_pHand->m_Def.m_bAllowThemeItems ) bTheme = true; + if( m_bFirstItemGoesDown && iChoice == 0 ) + s = CommonMetrics::LocalizeOptionItem( NEXT_ROW_NAME, false ); + else if( m_RowType == OptionRow::RowType_Exit ) + s = CommonMetrics::LocalizeOptionItem( EXIT_NAME, false ); - // Items beginning with a pipe mean "don't theme". - // This allows us to disable theming on a per-choice basis for choice names that are just a number - // and don't need to be localized. - if( s[0] == '|' ) - { - s.erase( s.begin() ); - bTheme = false; - } - - if( bTheme ) - s = CommonMetrics::LocalizeOptionItem( s, false ); if( m_pParentType->CAPITALIZE_ALL_OPTION_NAMES ) s.MakeUpper(); return s; diff --git a/stepmania/src/OptionRowHandler.cpp b/stepmania/src/OptionRowHandler.cpp index 2ae5b2be57..ec59bb91ed 100644 --- a/stepmania/src/OptionRowHandler.cpp +++ b/stepmania/src/OptionRowHandler.cpp @@ -58,6 +58,29 @@ RString OptionRowHandler::OptionTitle() const return bTheme ? THEME->GetString("OptionTitles",s) : s; } +RString OptionRowHandler::GetThemedItemText( int iChoice ) const +{ + RString s = m_Def.m_vsChoices[iChoice]; + if( s == "" ) + return ""; + bool bTheme = false; + + if( m_Def.m_bAllowThemeItems ) bTheme = true; + + // Items beginning with a pipe mean "don't theme". + // This allows us to disable theming on a per-choice basis for choice names that are just a number + // and don't need to be localized. + if( s[0] == '|' ) + { + s.erase( s.begin() ); + bTheme = false; + } + + if( bTheme ) + s = CommonMetrics::LocalizeOptionItem( s, false ); + return s; +} + void OptionRowHandler::GetIconTextAndGameCommand( int iFirstSelection, RString &sIconTextOut, GameCommand &gcOut ) const { sIconTextOut = ""; diff --git a/stepmania/src/OptionRowHandler.h b/stepmania/src/OptionRowHandler.h index c6aed1dcb1..959a32c0cb 100644 --- a/stepmania/src/OptionRowHandler.h +++ b/stepmania/src/OptionRowHandler.h @@ -104,6 +104,7 @@ public: this->LoadInternal( cmds ); } RString OptionTitle() const; + RString GetThemedItemText( int iChoice ) const; virtual void LoadInternal( const Commands &cmds ) { }