Merge pull request #164 from kyzentun/get_metric_group
Added THEME:GetMetricNamesInGroup and THEME:GetStringNamesInGroup.
This commit is contained in:
@@ -1596,6 +1596,7 @@
|
|||||||
<Function name='GetCurThemeName'/>
|
<Function name='GetCurThemeName'/>
|
||||||
<Function name='GetCurrentThemeDirectory'/>
|
<Function name='GetCurrentThemeDirectory'/>
|
||||||
<Function name='GetMetric'/>
|
<Function name='GetMetric'/>
|
||||||
|
<Function name='GetMetricNamesInGroup'/>
|
||||||
<Function name='GetNumSelectableThemes'/>
|
<Function name='GetNumSelectableThemes'/>
|
||||||
<Function name='GetPathB'/>
|
<Function name='GetPathB'/>
|
||||||
<Function name='GetPathF'/>
|
<Function name='GetPathF'/>
|
||||||
@@ -1605,6 +1606,7 @@
|
|||||||
<Function name='GetPathS'/>
|
<Function name='GetPathS'/>
|
||||||
<Function name='GetSelectableThemeNames'/>
|
<Function name='GetSelectableThemeNames'/>
|
||||||
<Function name='GetString'/>
|
<Function name='GetString'/>
|
||||||
|
<Function name='GetStringNamesInGroup'/>
|
||||||
<Function name='GetThemeAuthor'/>
|
<Function name='GetThemeAuthor'/>
|
||||||
<Function name='GetThemeDisplayName'/>
|
<Function name='GetThemeDisplayName'/>
|
||||||
<Function name='HasMetric'/>
|
<Function name='HasMetric'/>
|
||||||
|
|||||||
@@ -4424,6 +4424,9 @@ save yourself some time, copy this for undocumented things:
|
|||||||
<Function name='GetMetric' return='string' arguments='string ClassName, string Element'>
|
<Function name='GetMetric' return='string' arguments='string ClassName, string Element'>
|
||||||
Returns the value of <code>Element</code> in <code>Class</code> from metrics.ini.
|
Returns the value of <code>Element</code> in <code>Class</code> from metrics.ini.
|
||||||
</Function>
|
</Function>
|
||||||
|
<Function name='GetMetricNamesInGroup' return='{string}' arguments='string ClassName'>
|
||||||
|
Returns the names of all elements in <code>Class</code> from metrics.ini.
|
||||||
|
</Function>
|
||||||
<Function name='GetNumSelectableThemes' return='int' arguments=''>
|
<Function name='GetNumSelectableThemes' return='int' arguments=''>
|
||||||
Returns the number of selectable themes.
|
Returns the number of selectable themes.
|
||||||
</Function>
|
</Function>
|
||||||
@@ -4451,6 +4454,9 @@ save yourself some time, copy this for undocumented things:
|
|||||||
<Function name='GetString' return='string' arguments='string ClassName, string Element'>
|
<Function name='GetString' return='string' arguments='string ClassName, string Element'>
|
||||||
Returns the value of <code>Element</code> in <code>Class</code> for the currently loaded language.
|
Returns the value of <code>Element</code> in <code>Class</code> for the currently loaded language.
|
||||||
</Function>
|
</Function>
|
||||||
|
<Function name='GetStringNamesInGroup' return='{string}' arguments='string ClassName'>
|
||||||
|
Returns the names of all elements in <code>Class</code> for the currently loaded language.
|
||||||
|
</Function>
|
||||||
<Function name='GetThemeAuthor' return='string' arguments=''>
|
<Function name='GetThemeAuthor' return='string' arguments=''>
|
||||||
Returns the author of the current theme or "[unknown author]".
|
Returns the author of the current theme or "[unknown author]".
|
||||||
</Function>
|
</Function>
|
||||||
|
|||||||
@@ -1298,6 +1298,40 @@ public:
|
|||||||
DEFINE_METHOD( DoesLanguageExist, DoesLanguageExist(SArg(1)) );
|
DEFINE_METHOD( DoesLanguageExist, DoesLanguageExist(SArg(1)) );
|
||||||
DEFINE_METHOD( GetCurThemeName, GetCurThemeName() );
|
DEFINE_METHOD( GetCurThemeName, GetCurThemeName() );
|
||||||
|
|
||||||
|
static void PushMetricNamesInGroup(IniFile const& ini, lua_State* L)
|
||||||
|
{
|
||||||
|
RString group_name= SArg(1);
|
||||||
|
const XNode* metric_node= ini.GetChild(group_name);
|
||||||
|
if(metric_node != NULL)
|
||||||
|
{
|
||||||
|
// Placed in a table indexed by number, so the order is always the same.
|
||||||
|
lua_createtable(L, metric_node->m_attrs.size(), 0);
|
||||||
|
int next_index= 1;
|
||||||
|
for(XAttrs::const_iterator n= metric_node->m_attrs.begin(); n != metric_node->m_attrs.end(); ++n)
|
||||||
|
{
|
||||||
|
LuaHelpers::Push(L, n->first);
|
||||||
|
lua_rawseti(L, -2, next_index);
|
||||||
|
++next_index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lua_pushnil(L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GetMetricNamesInGroup(T* p, lua_State* L)
|
||||||
|
{
|
||||||
|
PushMetricNamesInGroup(g_pLoadedThemeData->iniMetrics, L);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GetStringNamesInGroup(T* p, lua_State* L)
|
||||||
|
{
|
||||||
|
PushMetricNamesInGroup(g_pLoadedThemeData->iniStrings, L);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
LunaThemeManager()
|
LunaThemeManager()
|
||||||
{
|
{
|
||||||
ADD_METHOD( ReloadMetrics );
|
ADD_METHOD( ReloadMetrics );
|
||||||
@@ -1322,6 +1356,8 @@ public:
|
|||||||
ADD_METHOD( GetCurThemeName );
|
ADD_METHOD( GetCurThemeName );
|
||||||
ADD_METHOD( HasMetric );
|
ADD_METHOD( HasMetric );
|
||||||
ADD_METHOD( HasString );
|
ADD_METHOD( HasString );
|
||||||
|
ADD_METHOD( GetMetricNamesInGroup );
|
||||||
|
ADD_METHOD( GetStringNamesInGroup );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user