ELEMENT_CATEGORY_ -> EC_
This commit is contained in:
@@ -32,7 +32,7 @@ static const CString ElementCategoryNames[] = {
|
|||||||
"Sounds",
|
"Sounds",
|
||||||
"Other"
|
"Other"
|
||||||
};
|
};
|
||||||
XToString( ElementCategory, NUM_ELEMENT_CATEGORIES );
|
XToString( ElementCategory, NUM_ElementCategory );
|
||||||
StringToX( ElementCategory );
|
StringToX( ElementCategory );
|
||||||
static void LuaElementCategory(lua_State* L)
|
static void LuaElementCategory(lua_State* L)
|
||||||
{
|
{
|
||||||
@@ -40,7 +40,7 @@ static void LuaElementCategory(lua_State* L)
|
|||||||
{
|
{
|
||||||
CString s = ElementCategoryNames[ec];
|
CString s = ElementCategoryNames[ec];
|
||||||
s.MakeUpper();
|
s.MakeUpper();
|
||||||
LUA->SetGlobal( "ELEMENT_CATEGORY_"+s, ec );
|
LUA->SetGlobal( "EC_"+s, ec );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
REGISTER_WITH_LUA_FUNCTION( LuaElementCategory );
|
REGISTER_WITH_LUA_FUNCTION( LuaElementCategory );
|
||||||
@@ -89,10 +89,10 @@ void ThemeManager::Unsubscribe( IThemeMetric *p )
|
|||||||
|
|
||||||
|
|
||||||
/* We spend a lot of time doing redundant theme path lookups. Cache results. */
|
/* We spend a lot of time doing redundant theme path lookups. Cache results. */
|
||||||
static map<CString, CString> g_ThemePathCache[NUM_ELEMENT_CATEGORIES];
|
static map<CString, CString> g_ThemePathCache[NUM_ElementCategory];
|
||||||
void ThemeManager::ClearThemePathCache()
|
void ThemeManager::ClearThemePathCache()
|
||||||
{
|
{
|
||||||
for( int i = 0; i < NUM_ELEMENT_CATEGORIES; ++i )
|
for( int i = 0; i < NUM_ElementCategory; ++i )
|
||||||
g_ThemePathCache[i].clear();
|
g_ThemePathCache[i].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ void ThemeManager::SwitchThemeAndLanguage( const CString &sThemeName, const CStr
|
|||||||
m_sCurLanguage = sLang;
|
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_ElementCategory; ++i )
|
||||||
g_ThemePathCache[i].clear();
|
g_ThemePathCache[i].clear();
|
||||||
|
|
||||||
g_vThemes.clear();
|
g_vThemes.clear();
|
||||||
@@ -391,7 +391,7 @@ try_element_again:
|
|||||||
|
|
||||||
for( unsigned p = 0; p < asPaths.size(); ++p )
|
for( unsigned p = 0; p < asPaths.size(); ++p )
|
||||||
{
|
{
|
||||||
static const char *masks[NUM_ELEMENT_CATEGORIES][13] = {
|
static const char *masks[NUM_ElementCategory][13] = {
|
||||||
{ "", "actor", "xml", NULL },
|
{ "", "actor", "xml", NULL },
|
||||||
{ "ini", NULL },
|
{ "ini", NULL },
|
||||||
{ "xml", "actor", "sprite", "png", "jpg", "bmp", "gif","avi", "mpg", "mpeg", "txt", "", NULL},
|
{ "xml", "actor", "sprite", "png", "jpg", "bmp", "gif","avi", "mpg", "mpeg", "txt", "", NULL},
|
||||||
@@ -420,7 +420,7 @@ try_element_again:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( category == ELEMENT_CATEGORY_FONTS )
|
if( category == EC_FONTS )
|
||||||
Font::WeedFontNames(asElementPaths, ClassAndElementToFileName(sClassName,sElement));
|
Font::WeedFontNames(asElementPaths, ClassAndElementToFileName(sClassName,sElement));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,8 +428,8 @@ try_element_again:
|
|||||||
if( asElementPaths.size() == 0 )
|
if( asElementPaths.size() == 0 )
|
||||||
{
|
{
|
||||||
// HACK: have Fonts fall back to Numbers. Eventually Numbers will be removed.
|
// HACK: have Fonts fall back to Numbers. Eventually Numbers will be removed.
|
||||||
if( category == ELEMENT_CATEGORY_FONTS )
|
if( category == EC_FONTS )
|
||||||
return GetPathToRaw( sThemeName, ELEMENT_CATEGORY_NUMBERS, sClassName, sElement ) ;
|
return GetPathToRaw( sThemeName, EC_NUMBERS, sClassName, sElement ) ;
|
||||||
return ""; // This isn't fatal.
|
return ""; // This isn't fatal.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,7 +474,7 @@ try_element_again:
|
|||||||
FileNameToClassAndElement(sNewFileName, sNewClassName, sNewFile);
|
FileNameToClassAndElement(sNewFileName, sNewClassName, sNewFile);
|
||||||
|
|
||||||
/* backwards-compatibility hack */
|
/* backwards-compatibility hack */
|
||||||
if( category == ELEMENT_CATEGORY_FONTS )
|
if( category == EC_FONTS )
|
||||||
sNewFileName.Replace(" 16x16.png", "");
|
sNewFileName.Replace(" 16x16.png", "");
|
||||||
|
|
||||||
/* Search again. For example, themes/default/Fonts/foo might redir
|
/* Search again. For example, themes/default/Fonts/foo might redir
|
||||||
@@ -554,7 +554,7 @@ try_element_again:
|
|||||||
/* 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.";
|
||||||
Dialog::Result res;
|
Dialog::Result res;
|
||||||
if( category != ELEMENT_CATEGORY_OTHER )
|
if( category != EC_OTHER )
|
||||||
res = Dialog::AbortRetryIgnore(sMessage, "MissingThemeElement");
|
res = Dialog::AbortRetryIgnore(sMessage, "MissingThemeElement");
|
||||||
else
|
else
|
||||||
res = Dialog::AbortRetry(sMessage, "MissingThemeElement");
|
res = Dialog::AbortRetry(sMessage, "MissingThemeElement");
|
||||||
@@ -617,7 +617,7 @@ void ThemeManager::ReloadMetrics()
|
|||||||
//
|
//
|
||||||
// clear theme path cache
|
// clear theme path cache
|
||||||
//
|
//
|
||||||
for( int i = 0; i < NUM_ELEMENT_CATEGORIES; ++i )
|
for( int i = 0; i < NUM_ElementCategory; ++i )
|
||||||
g_ThemePathCache[i].clear();
|
g_ThemePathCache[i].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -905,6 +905,11 @@ void ThemeManager::LoadPreferencesFromSection( const CString &sClassName )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CString ThemeManager::GetBlankGraphicPath()
|
||||||
|
{
|
||||||
|
return THEMES_DIR + BASE_THEME_NAME + "/" + ElementCategoryToString(EC_GRAPHICS) + "/_blank";
|
||||||
|
}
|
||||||
|
|
||||||
// lua start
|
// lua start
|
||||||
#include "LuaBinding.h"
|
#include "LuaBinding.h"
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,15 @@ struct lua_State;
|
|||||||
|
|
||||||
enum ElementCategory
|
enum ElementCategory
|
||||||
{
|
{
|
||||||
ELEMENT_CATEGORY_BGANIMATIONS,
|
EC_BGANIMATIONS,
|
||||||
ELEMENT_CATEGORY_FONTS,
|
EC_FONTS,
|
||||||
ELEMENT_CATEGORY_GRAPHICS,
|
EC_GRAPHICS,
|
||||||
ELEMENT_CATEGORY_NUMBERS,
|
EC_NUMBERS,
|
||||||
ELEMENT_CATEGORY_SOUNDS,
|
EC_SOUNDS,
|
||||||
ELEMENT_CATEGORY_OTHER,
|
EC_OTHER,
|
||||||
NUM_ELEMENT_CATEGORIES
|
NUM_ElementCategory
|
||||||
};
|
};
|
||||||
#define FOREACH_ElementCategory( ec ) FOREACH_ENUM( ElementCategory, NUM_ELEMENT_CATEGORIES, ec )
|
#define FOREACH_ElementCategory( ec ) FOREACH_ENUM( ElementCategory, NUM_ElementCategory, ec )
|
||||||
const CString& ElementCategoryToString( ElementCategory ec );
|
const CString& ElementCategoryToString( ElementCategory ec );
|
||||||
ElementCategory StringToElementCategory( const CString& s );
|
ElementCategory StringToElementCategory( const CString& s );
|
||||||
|
|
||||||
@@ -56,11 +56,11 @@ public:
|
|||||||
* 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, const CString &sClassName, const CString &sElement, bool bOptional=false );
|
CString GetPath( ElementCategory category, const CString &sClassName, const CString &sElement, bool bOptional=false );
|
||||||
CString GetPathB( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(ELEMENT_CATEGORY_BGANIMATIONS,sClassName,sElement,bOptional); };
|
CString GetPathB( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(EC_BGANIMATIONS,sClassName,sElement,bOptional); };
|
||||||
CString GetPathF( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(ELEMENT_CATEGORY_FONTS,sClassName,sElement,bOptional); };
|
CString GetPathF( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(EC_FONTS,sClassName,sElement,bOptional); };
|
||||||
CString GetPathG( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(ELEMENT_CATEGORY_GRAPHICS,sClassName,sElement,bOptional); };
|
CString GetPathG( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(EC_GRAPHICS,sClassName,sElement,bOptional); };
|
||||||
CString GetPathS( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(ELEMENT_CATEGORY_SOUNDS,sClassName,sElement,bOptional); };
|
CString GetPathS( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(EC_SOUNDS,sClassName,sElement,bOptional); };
|
||||||
CString GetPathO( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(ELEMENT_CATEGORY_OTHER,sClassName,sElement,bOptional); };
|
CString GetPathO( const CString &sClassName, const CString &sElement, bool bOptional=false ) { return GetPath(EC_OTHER,sClassName,sElement,bOptional); };
|
||||||
void ClearThemePathCache();
|
void ClearThemePathCache();
|
||||||
|
|
||||||
// TODO: remove these and update the places that use them
|
// TODO: remove these and update the places that use them
|
||||||
@@ -93,6 +93,8 @@ public:
|
|||||||
void GetMetricsThatBeginWith( const CString &sClassName, const CString &sValueName, set<CString> &vsValueNamesOut );
|
void GetMetricsThatBeginWith( const CString &sClassName, const CString &sValueName, set<CString> &vsValueNamesOut );
|
||||||
void LoadPreferencesFromSection( const CString &sClassName );
|
void LoadPreferencesFromSection( const CString &sClassName );
|
||||||
|
|
||||||
|
static CString GetBlankGraphicPath();
|
||||||
|
|
||||||
//
|
//
|
||||||
// For self-registering metrics
|
// For self-registering metrics
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user