const fixes
This commit is contained in:
@@ -125,7 +125,7 @@ void ThemeManager::GetThemeNames( CStringArray& AddTo )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThemeManager::DoesThemeExist( CString sThemeName )
|
bool ThemeManager::DoesThemeExist( const CString &sThemeName )
|
||||||
{
|
{
|
||||||
CStringArray asThemeNames;
|
CStringArray asThemeNames;
|
||||||
GetThemeNames( asThemeNames );
|
GetThemeNames( asThemeNames );
|
||||||
@@ -153,7 +153,7 @@ void ThemeManager::GetLanguages( CStringArray& AddTo )
|
|||||||
AddTo.erase(it, AddTo.end());
|
AddTo.erase(it, AddTo.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThemeManager::DoesLanguageExist( CString sLanguage )
|
bool ThemeManager::DoesLanguageExist( const CString &sLanguage )
|
||||||
{
|
{
|
||||||
CStringArray asLanguages;
|
CStringArray asLanguages;
|
||||||
GetLanguages( asLanguages );
|
GetLanguages( asLanguages );
|
||||||
@@ -164,7 +164,7 @@ bool ThemeManager::DoesLanguageExist( CString sLanguage )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeManager::LoadThemeRecursive( deque<Theme> &theme, CString sThemeName )
|
void ThemeManager::LoadThemeRecursive( deque<Theme> &theme, const CString &sThemeName )
|
||||||
{
|
{
|
||||||
static int depth = 0;
|
static int depth = 0;
|
||||||
static bool loaded_base = false;
|
static bool loaded_base = false;
|
||||||
@@ -201,20 +201,22 @@ void ThemeManager::LoadThemeRecursive( deque<Theme> &theme, CString sThemeName )
|
|||||||
depth--;
|
depth--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeManager::SwitchThemeAndLanguage( CString sThemeName, CString sLanguage )
|
void ThemeManager::SwitchThemeAndLanguage( const CString &sThemeName, const CString &sLanguage )
|
||||||
{
|
{
|
||||||
if( !DoesThemeExist(sThemeName) )
|
CString sTheme = sThemeName;
|
||||||
sThemeName = BASE_THEME_NAME;
|
CString sLang = sLanguage;
|
||||||
if( !DoesLanguageExist(sLanguage) )
|
if( !DoesThemeExist(sTheme) )
|
||||||
sLanguage = BASE_LANGUAGE;
|
sTheme = BASE_THEME_NAME;
|
||||||
|
if( !DoesLanguageExist(sLang) )
|
||||||
|
sLang = BASE_LANGUAGE;
|
||||||
LOG->Trace("ThemeManager::SwitchThemeAndLanguage: \"%s\", \"%s\"",
|
LOG->Trace("ThemeManager::SwitchThemeAndLanguage: \"%s\", \"%s\"",
|
||||||
sThemeName.c_str(), m_sCurThemeName.c_str() );
|
sTheme.c_str(), sLang.c_str() );
|
||||||
|
|
||||||
if( sThemeName == m_sCurThemeName && sLanguage == m_sCurLanguage )
|
if( sTheme == m_sCurThemeName && sLang == m_sCurLanguage )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_sCurThemeName = sThemeName;
|
m_sCurThemeName = sTheme;
|
||||||
m_sCurLanguage = sLanguage;
|
m_sCurLanguage = sLang;
|
||||||
|
|
||||||
// clear theme path cache
|
// clear theme path cache
|
||||||
for( int i = 0; i < NUM_ELEMENT_CATEGORIES; ++i )
|
for( int i = 0; i < NUM_ELEMENT_CATEGORIES; ++i )
|
||||||
@@ -239,8 +241,8 @@ void ThemeManager::SwitchThemeAndLanguage( CString sThemeName, CString sLanguage
|
|||||||
g_vThemes.front().iniMetrics.SetValue( sBits[0], sBits[1], sBits[2] );
|
g_vThemes.front().iniMetrics.SetValue( sBits[0], sBits[1], sBits[2] );
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG->MapLog("theme", "Theme: %s", sThemeName.c_str());
|
LOG->MapLog("theme", "Theme: %s", sTheme.c_str());
|
||||||
LOG->MapLog("language", "Language: %s", sLanguage.c_str());
|
LOG->MapLog("language", "Language: %s", sLang.c_str());
|
||||||
|
|
||||||
// reload common sounds
|
// reload common sounds
|
||||||
if ( SCREENMAN != NULL )
|
if ( SCREENMAN != NULL )
|
||||||
@@ -257,34 +259,36 @@ CString ThemeManager::GetThemeDirFromName( const CString &sThemeName )
|
|||||||
return THEMES_DIR + sThemeName + "/";
|
return THEMES_DIR + sThemeName + "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
CString ThemeManager::GetPathToAndFallback( CString sThemeName, ElementCategory category, CString sClassName, CString sElement )
|
CString ThemeManager::GetPathToAndFallback( const CString &sThemeName, ElementCategory category, const CString &sClassName, const CString &sElement )
|
||||||
{
|
{
|
||||||
|
CString sClass = sClassName;
|
||||||
|
|
||||||
int n = 100;
|
int n = 100;
|
||||||
while( n-- )
|
while( n-- )
|
||||||
{
|
{
|
||||||
// search with requested name
|
// search with requested name
|
||||||
CString sRet = GetPathToRaw( sThemeName, category, sClassName, sElement );
|
CString sRet = GetPathToRaw( sThemeName, category, sClass, sElement );
|
||||||
if( !sRet.empty() )
|
if( !sRet.empty() )
|
||||||
return sRet;
|
return sRet;
|
||||||
|
|
||||||
// search fallback name (if any)
|
// search fallback name (if any)
|
||||||
CString sFallback;
|
CString sFallback;
|
||||||
GetMetricRaw( sClassName, "Fallback", sFallback );
|
GetMetricRaw( sClass, "Fallback", sFallback );
|
||||||
if( sFallback.empty() )
|
if( sFallback.empty() )
|
||||||
return "";
|
return "";
|
||||||
sClassName = sFallback;
|
sClass = sFallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
RageException::Throw("Infinite recursion looking up theme element from theme \"%s\", class \"%s\"",
|
RageException::Throw("Infinite recursion looking up theme element from theme \"%s\", class \"%s\"",
|
||||||
sThemeName.c_str(), sClassName.c_str() );
|
sThemeName.c_str(), sClass.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
CString ThemeManager::GetPathToRaw( CString sThemeName, ElementCategory category, CString sClassName, CString sElement )
|
CString ThemeManager::GetPathToRaw( const CString &sThemeName, ElementCategory category, const CString &sClassName, const CString &sElement )
|
||||||
{
|
{
|
||||||
try_element_again:
|
try_element_again:
|
||||||
|
|
||||||
const CString sThemeDir = GetThemeDirFromName( sThemeName );
|
const CString sThemeDir = GetThemeDirFromName( sThemeName );
|
||||||
const CString sCategory = ELEMENT_CATEGORY_STRING[category];
|
const CString &sCategory = ELEMENT_CATEGORY_STRING[category];
|
||||||
|
|
||||||
CStringArray asElementPaths;
|
CStringArray asElementPaths;
|
||||||
|
|
||||||
@@ -426,7 +430,7 @@ try_element_again:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CString ThemeManager::GetPath( ElementCategory category, CString sClassName, CString sElement, bool bOptional )
|
CString ThemeManager::GetPath( ElementCategory category, const CString &sClassName, const CString &sElement, bool bOptional )
|
||||||
{
|
{
|
||||||
CString sFileName = ClassAndElementToFileName( sClassName, sElement );
|
CString sFileName = ClassAndElementToFileName( sClassName, sElement );
|
||||||
|
|
||||||
@@ -460,7 +464,7 @@ try_element_again:
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
CString sCategory = ELEMENT_CATEGORY_STRING[category];
|
const CString &sCategory = ELEMENT_CATEGORY_STRING[category];
|
||||||
|
|
||||||
/* We can't fall back on _missing in Other: the file types are unknown. */
|
/* We can't fall back on _missing in Other: the file types are unknown. */
|
||||||
CString sMessage = "The theme element \"" + sCategory + "/" + sFileName +"\" is missing.";
|
CString sMessage = "The theme element \"" + sCategory + "/" + sFileName +"\" is missing.";
|
||||||
@@ -504,12 +508,12 @@ try_element_again:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CString ThemeManager::GetMetricsIniPath( CString sThemeName )
|
CString ThemeManager::GetMetricsIniPath( const CString &sThemeName )
|
||||||
{
|
{
|
||||||
return GetThemeDirFromName( sThemeName ) + METRICS_FILE;
|
return GetThemeDirFromName( sThemeName ) + METRICS_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThemeManager::HasMetric( CString sClassName, CString sValueName )
|
bool ThemeManager::HasMetric( const CString &sClassName, const CString &sValueName )
|
||||||
{
|
{
|
||||||
CString sThrowAway;
|
CString sThrowAway;
|
||||||
return GetMetricRaw( sClassName, sValueName, sThrowAway );
|
return GetMetricRaw( sClassName, sValueName, sThrowAway );
|
||||||
@@ -518,7 +522,8 @@ bool ThemeManager::HasMetric( CString sClassName, CString sValueName )
|
|||||||
void ThemeManager::ReloadMetrics()
|
void ThemeManager::ReloadMetrics()
|
||||||
{
|
{
|
||||||
// force a reload of the metrics cache
|
// force a reload of the metrics cache
|
||||||
const CString sThemeName = m_sCurThemeName, sCurLanguage = m_sCurLanguage;
|
const CString sThemeName = m_sCurThemeName;
|
||||||
|
const CString sCurLanguage = m_sCurLanguage;
|
||||||
m_sCurThemeName = "";
|
m_sCurThemeName = "";
|
||||||
m_sCurLanguage = "";
|
m_sCurLanguage = "";
|
||||||
|
|
||||||
@@ -534,7 +539,7 @@ void ThemeManager::ReloadMetrics()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ThemeManager::GetMetricRaw( CString sClassName, CString sValueName, CString &ret, int level )
|
bool ThemeManager::GetMetricRaw( const CString &sClassName, const CString &sValueName, CString &ret, int level )
|
||||||
{
|
{
|
||||||
if( level > 100 )
|
if( level > 100 )
|
||||||
RageException::Throw("Infinite recursion looking up theme metric \"%s::%s\"", sClassName.c_str(), sValueName.c_str() );
|
RageException::Throw("Infinite recursion looking up theme metric \"%s::%s\"", sClassName.c_str(), sValueName.c_str() );
|
||||||
@@ -557,7 +562,7 @@ bool ThemeManager::GetMetricRaw( CString sClassName, CString sValueName, CString
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CString ThemeManager::GetMetricRaw( CString sClassName, CString sValueName )
|
CString ThemeManager::GetMetricRaw( const CString &sClassName, const CString &sValueName )
|
||||||
{
|
{
|
||||||
try_metric_again:
|
try_metric_again:
|
||||||
|
|
||||||
@@ -593,7 +598,7 @@ try_metric_again:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get a string metric. */
|
/* Get a string metric. */
|
||||||
CString ThemeManager::GetMetric( CString sClassName, CString sValueName )
|
CString ThemeManager::GetMetric( const CString &sClassName, const CString &sValueName )
|
||||||
{
|
{
|
||||||
CString sValue = GetMetricRaw(sClassName,sValueName);
|
CString sValue = GetMetricRaw(sClassName,sValueName);
|
||||||
|
|
||||||
@@ -607,12 +612,12 @@ CString ThemeManager::GetMetric( CString sClassName, CString sValueName )
|
|||||||
return sValue;
|
return sValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ThemeManager::GetMetricI( CString sClassName, CString sValueName )
|
int ThemeManager::GetMetricI( const CString &sClassName, const CString &sValueName )
|
||||||
{
|
{
|
||||||
return atoi( GetMetricRaw(sClassName,sValueName) );
|
return atoi( GetMetricRaw(sClassName,sValueName) );
|
||||||
}
|
}
|
||||||
|
|
||||||
float ThemeManager::GetMetricF( CString sClassName, CString sValueName )
|
float ThemeManager::GetMetricF( const CString &sClassName, const CString &sValueName )
|
||||||
{
|
{
|
||||||
CString str = GetMetricRaw( sClassName,sValueName );
|
CString str = GetMetricRaw( sClassName,sValueName );
|
||||||
|
|
||||||
@@ -622,7 +627,7 @@ float ThemeManager::GetMetricF( CString sClassName, CString sValueName )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// #include "LuaHelpers.h"
|
// #include "LuaHelpers.h"
|
||||||
bool ThemeManager::GetMetricB( CString sClassName, CString sValueName )
|
bool ThemeManager::GetMetricB( const CString &sClassName, const CString &sValueName )
|
||||||
{
|
{
|
||||||
CString str = GetMetricRaw( sClassName,sValueName );
|
CString str = GetMetricRaw( sClassName,sValueName );
|
||||||
if( str == "0" )
|
if( str == "0" )
|
||||||
@@ -635,7 +640,7 @@ bool ThemeManager::GetMetricB( CString sClassName, CString sValueName )
|
|||||||
return Lua::RunExpressionB( str );
|
return Lua::RunExpressionB( str );
|
||||||
}
|
}
|
||||||
|
|
||||||
RageColor ThemeManager::GetMetricC( CString sClassName, CString sValueName )
|
RageColor ThemeManager::GetMetricC( const CString &sClassName, const CString &sValueName )
|
||||||
{
|
{
|
||||||
RageColor ret(1,1,1,1);
|
RageColor ret(1,1,1,1);
|
||||||
if( !ret.FromString( GetMetricRaw(sClassName,sValueName) ) )
|
if( !ret.FromString( GetMetricRaw(sClassName,sValueName) ) )
|
||||||
@@ -655,7 +660,7 @@ void ThemeManager::NextTheme()
|
|||||||
SwitchThemeAndLanguage( as[iNewIndex], m_sCurLanguage );
|
SwitchThemeAndLanguage( as[iNewIndex], m_sCurLanguage );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeManager::GetLanguagesForTheme( CString sThemeName, CStringArray& asLanguagesOut )
|
void ThemeManager::GetLanguagesForTheme( const CString &sThemeName, CStringArray& asLanguagesOut )
|
||||||
{
|
{
|
||||||
CString sLanguageDir = GetThemeDirFromName(sThemeName) + LANGUAGES_SUBDIR;
|
CString sLanguageDir = GetThemeDirFromName(sThemeName) + LANGUAGES_SUBDIR;
|
||||||
CStringArray as;
|
CStringArray as;
|
||||||
@@ -673,17 +678,17 @@ void ThemeManager::GetLanguagesForTheme( CString sThemeName, CStringArray& asLan
|
|||||||
asLanguagesOut = as;
|
asLanguagesOut = as;
|
||||||
}
|
}
|
||||||
|
|
||||||
CString ThemeManager::GetLanguageIniPath( CString sThemeName, CString sLanguage )
|
CString ThemeManager::GetLanguageIniPath( const CString &sThemeName, const CString &sLanguage )
|
||||||
{
|
{
|
||||||
return GetThemeDirFromName(sThemeName) + LANGUAGES_SUBDIR + sLanguage + ".ini";
|
return GetThemeDirFromName(sThemeName) + LANGUAGES_SUBDIR + sLanguage + ".ini";
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove these and update the places that use them
|
// TODO: remove these and update the places that use them
|
||||||
CString ThemeManager::GetPathToB( CString sFileName, bool bOptional ) { CString sClassName, sElement; FileNameToClassAndElement(sFileName,sClassName,sElement); return GetPathB(sClassName,sElement,bOptional); }
|
CString ThemeManager::GetPathToB( const CString &sFileName, bool bOptional ) { CString sClassName, sElement; FileNameToClassAndElement(sFileName,sClassName,sElement); return GetPathB(sClassName,sElement,bOptional); }
|
||||||
CString ThemeManager::GetPathToF( CString sFileName, bool bOptional ) { CString sClassName, sElement; FileNameToClassAndElement(sFileName,sClassName,sElement); return GetPathF(sClassName,sElement,bOptional); }
|
CString ThemeManager::GetPathToF( const CString &sFileName, bool bOptional ) { CString sClassName, sElement; FileNameToClassAndElement(sFileName,sClassName,sElement); return GetPathF(sClassName,sElement,bOptional); }
|
||||||
CString ThemeManager::GetPathToG( CString sFileName, bool bOptional ) { CString sClassName, sElement; FileNameToClassAndElement(sFileName,sClassName,sElement); return GetPathG(sClassName,sElement,bOptional); }
|
CString ThemeManager::GetPathToG( const CString &sFileName, bool bOptional ) { CString sClassName, sElement; FileNameToClassAndElement(sFileName,sClassName,sElement); return GetPathG(sClassName,sElement,bOptional); }
|
||||||
CString ThemeManager::GetPathToS( CString sFileName, bool bOptional ) { CString sClassName, sElement; FileNameToClassAndElement(sFileName,sClassName,sElement); return GetPathS(sClassName,sElement,bOptional); }
|
CString ThemeManager::GetPathToS( const CString &sFileName, bool bOptional ) { CString sClassName, sElement; FileNameToClassAndElement(sFileName,sClassName,sElement); return GetPathS(sClassName,sElement,bOptional); }
|
||||||
CString ThemeManager::GetPathToO( CString sFileName, bool bOptional ) { CString sClassName, sElement; FileNameToClassAndElement(sFileName,sClassName,sElement); return GetPathO(sClassName,sElement,bOptional); }
|
CString ThemeManager::GetPathToO( const CString &sFileName, bool bOptional ) { CString sClassName, sElement; FileNameToClassAndElement(sFileName,sClassName,sElement); return GetPathO(sClassName,sElement,bOptional); }
|
||||||
|
|
||||||
void ThemeManager::GetModifierNames( set<CString>& AddTo )
|
void ThemeManager::GetModifierNames( set<CString>& AddTo )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ public:
|
|||||||
~ThemeManager();
|
~ThemeManager();
|
||||||
|
|
||||||
void GetThemeNames( CStringArray& AddTo );
|
void GetThemeNames( CStringArray& AddTo );
|
||||||
bool DoesThemeExist( CString sThemeName );
|
bool DoesThemeExist( const CString &sThemeName );
|
||||||
void GetLanguages( CStringArray& AddTo );
|
void GetLanguages( CStringArray& AddTo );
|
||||||
bool DoesLanguageExist( CString sLanguage );
|
bool DoesLanguageExist( const CString &sLanguage );
|
||||||
void SwitchThemeAndLanguage( CString sThemeName, CString sLanguage );
|
void SwitchThemeAndLanguage( const CString &sThemeName, const CString &sLanguage );
|
||||||
CString GetCurThemeName() { return m_sCurThemeName; };
|
CString GetCurThemeName() { return m_sCurThemeName; };
|
||||||
CString GetCurLanguage() { return m_sCurLanguage; };
|
CString GetCurLanguage() { return m_sCurLanguage; };
|
||||||
CString GetCurThemeDir() { return GetThemeDirFromName(m_sCurThemeName); };
|
CString GetCurThemeDir() { return GetThemeDirFromName(m_sCurThemeName); };
|
||||||
@@ -36,33 +36,33 @@ public:
|
|||||||
/* I renamed these for two reasons. The overload conflicts with the ones below:
|
/* I renamed these for two reasons. The overload conflicts with the ones below:
|
||||||
* GetPathToB( str, str ) was matching the ones below instead of these. It's also
|
* GetPathToB( str, str ) was matching the ones below instead of these. It's also
|
||||||
* easier to search for uses of obsolete functions if they have a different name. */
|
* easier to search for uses of obsolete functions if they have a different name. */
|
||||||
CString GetPath( ElementCategory category, CString sClassName, CString sElement, bool bOptional=false );
|
CString GetPath( ElementCategory category, const CString &sClassName, const CString &sElement, bool bOptional=false );
|
||||||
CString GetPathB( CString sClassName, CString sElement, bool bOptional=false ) { return GetPath(BGAnimations,sClassName,sElement,bOptional); };
|
CString GetPathB( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(BGAnimations,sClassName,sElement,bOptional); };
|
||||||
CString GetPathF( CString sClassName, CString sElement, bool bOptional=false ) { return GetPath(Fonts,sClassName,sElement,bOptional); };
|
CString GetPathF( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(Fonts,sClassName,sElement,bOptional); };
|
||||||
CString GetPathG( CString sClassName, CString sElement, bool bOptional=false ) { return GetPath(Graphics,sClassName,sElement,bOptional); };
|
CString GetPathG( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(Graphics,sClassName,sElement,bOptional); };
|
||||||
CString GetPathS( CString sClassName, CString sElement, bool bOptional=false ) { return GetPath(Sounds,sClassName,sElement,bOptional); };
|
CString GetPathS( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(Sounds,sClassName,sElement,bOptional); };
|
||||||
CString GetPathO( CString sClassName, CString sElement, bool bOptional=false ) { return GetPath(Other,sClassName,sElement,bOptional); };
|
CString GetPathO( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(Other,sClassName,sElement,bOptional); };
|
||||||
|
|
||||||
// TODO: remove these and update the places that use them
|
// TODO: remove these and update the places that use them
|
||||||
CString GetPathToB( CString sFileName, bool bOptional=false );
|
CString GetPathToB( const CString &sFileName, bool bOptional=false );
|
||||||
CString GetPathToF( CString sFileName, bool bOptional=false );
|
CString GetPathToF( const CString &sFileName, bool bOptional=false );
|
||||||
CString GetPathToG( CString sFileName, bool bOptional=false );
|
CString GetPathToG( const CString &sFileName, bool bOptional=false );
|
||||||
CString GetPathToS( CString sFileName, bool bOptional=false );
|
CString GetPathToS( const CString &sFileName, bool bOptional=false );
|
||||||
CString GetPathToO( CString sFileName, bool bOptional=false );
|
CString GetPathToO( const CString &sFileName, bool bOptional=false );
|
||||||
|
|
||||||
|
|
||||||
bool HasMetric( CString sClassName, CString sValueName );
|
bool HasMetric( const CString &sClassName, const CString &sValueName );
|
||||||
CString GetMetricRaw( CString sClassName, CString sValueName );
|
CString GetMetricRaw( const CString &sClassName, const CString &sValueName );
|
||||||
CString GetMetric( CString sClassName, CString sValueName );
|
CString GetMetric( const CString &sClassName, const CString &sValueName );
|
||||||
int GetMetricI( CString sClassName, CString sValueName );
|
int GetMetricI( const CString &sClassName, const CString &sValueName );
|
||||||
float GetMetricF( CString sClassName, CString sValueName );
|
float GetMetricF( const CString &sClassName, const CString &sValueName );
|
||||||
bool GetMetricB( CString sClassName, CString sValueName );
|
bool GetMetricB( const CString &sClassName, const CString &sValueName );
|
||||||
RageColor GetMetricC( CString sClassName, CString sValueName );
|
RageColor GetMetricC( const CString &sClassName, const CString &sValueName );
|
||||||
void GetMetric( CString sClassName, CString sValueName, CString &valueOut ) { valueOut = GetMetric( sClassName, sValueName ); }
|
void GetMetric( const CString &sClassName, const CString &sValueName, CString &valueOut ) { valueOut = GetMetric( sClassName, sValueName ); }
|
||||||
void GetMetric( CString sClassName, CString sValueName, int &valueOut ) { valueOut = GetMetricI( sClassName, sValueName ); }
|
void GetMetric( const CString &sClassName, const CString &sValueName, int &valueOut ) { valueOut = GetMetricI( sClassName, sValueName ); }
|
||||||
void GetMetric( CString sClassName, CString sValueName, float &valueOut ) { valueOut = GetMetricF( sClassName, sValueName ); }
|
void GetMetric( const CString &sClassName, const CString &sValueName, float &valueOut ) { valueOut = GetMetricF( sClassName, sValueName ); }
|
||||||
void GetMetric( CString sClassName, CString sValueName, bool &valueOut ) { valueOut = GetMetricB( sClassName, sValueName ); }
|
void GetMetric( const CString &sClassName, const CString &sValueName, bool &valueOut ) { valueOut = GetMetricB( sClassName, sValueName ); }
|
||||||
void GetMetric( CString sClassName, CString sValueName, RageColor &valueOut ){ valueOut = GetMetricC( sClassName, sValueName ); }
|
void GetMetric( const CString &sClassName, const CString &sValueName, RageColor &valueOut ){ valueOut = GetMetricC( sClassName, sValueName ); }
|
||||||
|
|
||||||
//
|
//
|
||||||
// For self-registering metrics
|
// For self-registering metrics
|
||||||
@@ -71,15 +71,15 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void LoadThemeRecursive( deque<Theme> &theme, CString sThemeName );
|
void LoadThemeRecursive( deque<Theme> &theme, const CString &sThemeName );
|
||||||
bool GetMetricRaw( CString sClassName, CString sValueName, CString &ret, int level=0 );
|
bool GetMetricRaw( const CString &sClassName, const CString &sValueName, CString &ret, int level=0 );
|
||||||
CString GetPathToAndFallback( CString sThemeName, ElementCategory category, CString sClassName, CString sFile );
|
CString GetPathToAndFallback( const CString &sThemeName, ElementCategory category, const CString &sClassName, const CString &sFile );
|
||||||
CString GetPathToRaw( CString sThemeName, ElementCategory category, CString sClassName, CString sFile );
|
CString GetPathToRaw( const CString &sThemeName, ElementCategory category, const CString &sClassName, const CString &sFile );
|
||||||
static CString GetThemeDirFromName( const CString &sThemeName );
|
static CString GetThemeDirFromName( const CString &sThemeName );
|
||||||
CString GetElementDir( CString sThemeName );
|
CString GetElementDir( const CString &sThemeName );
|
||||||
static CString GetMetricsIniPath( CString sThemeName );
|
static CString GetMetricsIniPath( const CString &sThemeName );
|
||||||
static void GetLanguagesForTheme( CString sThemeName, CStringArray& asLanguagesOut );
|
static void GetLanguagesForTheme( const CString &sThemeName, CStringArray& asLanguagesOut );
|
||||||
static CString GetLanguageIniPath( CString sThemeName, CString sLanguage );
|
static CString GetLanguageIniPath( const CString &sThemeName, const CString &sLanguage );
|
||||||
|
|
||||||
CString m_sCurThemeName;
|
CString m_sCurThemeName;
|
||||||
CString m_sCurLanguage;
|
CString m_sCurLanguage;
|
||||||
@@ -99,7 +99,7 @@ protected:
|
|||||||
virtual void Update() { }
|
virtual void Update() { }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CachedThemeMetric( CString sClassName, CString sValueName ):
|
CachedThemeMetric( const CString &sClassName, const CString &sValueName ):
|
||||||
m_sClassName( sClassName ),
|
m_sClassName( sClassName ),
|
||||||
m_sValueName( sValueName ),
|
m_sValueName( sValueName ),
|
||||||
m_bInited( false )
|
m_bInited( false )
|
||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
}
|
}
|
||||||
virtual ~CachedThemeMetric() { }
|
virtual ~CachedThemeMetric() { }
|
||||||
|
|
||||||
void Refresh( CString sClassName = "" )
|
void Refresh( const CString &sClassName = "" )
|
||||||
{
|
{
|
||||||
m_sValue = THEME->GetMetric(sClassName==""? m_sClassName:sClassName,m_sValueName);
|
m_sValue = THEME->GetMetric(sClassName==""? m_sClassName:sClassName,m_sValueName);
|
||||||
Update();
|
Update();
|
||||||
@@ -122,7 +122,7 @@ class CachedThemeMetricF : public CachedThemeMetric
|
|||||||
float m_fValue;
|
float m_fValue;
|
||||||
public:
|
public:
|
||||||
void Update() { m_fValue = (float)atof( m_sValue ); }
|
void Update() { m_fValue = (float)atof( m_sValue ); }
|
||||||
CachedThemeMetricF( CString sClassName, CString sValueName ) : CachedThemeMetric( sClassName, sValueName ) {}
|
CachedThemeMetricF( const CString &sClassName, const CString &sValueName ) : CachedThemeMetric( sClassName, sValueName ) {}
|
||||||
operator const float () const { ASSERT(m_bInited); return m_fValue; };
|
operator const float () const { ASSERT(m_bInited); return m_fValue; };
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ class CachedThemeMetricI : public CachedThemeMetric
|
|||||||
int m_iValue;
|
int m_iValue;
|
||||||
public:
|
public:
|
||||||
void Update() { m_iValue = atoi( m_sValue ); }
|
void Update() { m_iValue = atoi( m_sValue ); }
|
||||||
CachedThemeMetricI( CString sClassName, CString sValueName ) : CachedThemeMetric( sClassName, sValueName ) {}
|
CachedThemeMetricI( const CString &sClassName, const CString &sValueName ) : CachedThemeMetric( sClassName, sValueName ) {}
|
||||||
operator const int () const { ASSERT(m_bInited); return m_iValue; };
|
operator const int () const { ASSERT(m_bInited); return m_iValue; };
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ class CachedThemeMetricB : public CachedThemeMetric
|
|||||||
bool m_bValue;
|
bool m_bValue;
|
||||||
public:
|
public:
|
||||||
void Update() { m_bValue = atoi( m_sValue ) != 0; }
|
void Update() { m_bValue = atoi( m_sValue ) != 0; }
|
||||||
CachedThemeMetricB( CString sClassName, CString sValueName ) : CachedThemeMetric( sClassName, sValueName ) {}
|
CachedThemeMetricB( const CString &sClassName, const CString &sValueName ) : CachedThemeMetric( sClassName, sValueName ) {}
|
||||||
operator const bool () const { ASSERT(m_bInited); return m_bValue; };
|
operator const bool () const { ASSERT(m_bInited); return m_bValue; };
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ public:
|
|||||||
m_cValue = RageColor(1,1,1,1);
|
m_cValue = RageColor(1,1,1,1);
|
||||||
sscanf( m_sValue, "%f,%f,%f,%f", &m_cValue.r, &m_cValue.g, &m_cValue.b, &m_cValue.a );
|
sscanf( m_sValue, "%f,%f,%f,%f", &m_cValue.r, &m_cValue.g, &m_cValue.b, &m_cValue.a );
|
||||||
}
|
}
|
||||||
CachedThemeMetricC( CString sClassName, CString sValueName ) : CachedThemeMetric( sClassName, sValueName ) {}
|
CachedThemeMetricC( const CString &sClassName, const CString &sValueName ) : CachedThemeMetric( sClassName, sValueName ) {}
|
||||||
operator const RageColor () const { ASSERT(m_bInited); return m_cValue; };
|
operator const RageColor () const { ASSERT(m_bInited); return m_cValue; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user