Delete 27 invalid style settings and add LOGWARNING to inform future authors.
Unify the two IGUIObject::LoadStyle functions and remove CGUI argument that is always identical to the member. Differential Revision: https://code.wildfiregames.com/D2232 Tested on: gcc 9.1.0., clang 8.0.1, Jenkins This was SVN commit r22792.
This commit is contained in:
parent
0a6b650189
commit
be963ec9b7
@ -20,15 +20,9 @@
|
||||
/>
|
||||
<style name="ModernWindow"
|
||||
sprite="ModernWindow"
|
||||
buffer_zone="12"
|
||||
text_align="left"
|
||||
text_valign="top"
|
||||
/>
|
||||
<style name="ModernDialog"
|
||||
sprite="ModernDialog"
|
||||
buffer_zone="12"
|
||||
text_align="left"
|
||||
text_valign="top"
|
||||
/>
|
||||
<style name="ModernList"
|
||||
buffer_zone="5"
|
||||
@ -41,7 +35,6 @@
|
||||
textcolor="white"
|
||||
textcolor_selected="white"
|
||||
text_align="left"
|
||||
text_valign="center"
|
||||
sound_selected="audio/interface/ui/ui_button_click.ogg"
|
||||
/>
|
||||
<style name="ModernSortedList"
|
||||
@ -58,7 +51,6 @@
|
||||
textcolor="white"
|
||||
textcolor_selected="white"
|
||||
text_align="left"
|
||||
text_valign="center"
|
||||
sound_selected="audio/interface/ui/ui_button_click.ogg"
|
||||
/>
|
||||
<style name="ModernDropDown"
|
||||
|
@ -66,18 +66,10 @@
|
||||
|
||||
<style name="TranslucentPanelThinBorder"
|
||||
sprite="TranslucentPanelThinBorder"
|
||||
buffer_zone="10"
|
||||
font="sans-bold-stroke-14"
|
||||
textcolor="white"
|
||||
text_align="left"
|
||||
text_valign="top"
|
||||
/>
|
||||
|
||||
<style name="StonePanelThinBorder"
|
||||
sprite="StonePanelThinBorder"
|
||||
buffer_zone="10"
|
||||
text_align="left"
|
||||
text_valign="top"
|
||||
/>
|
||||
|
||||
<!--
|
||||
@ -129,7 +121,6 @@
|
||||
scrollbar_style="ModernScrollBar"
|
||||
scroll_bottom="true"
|
||||
textcolor="white"
|
||||
textcolor_selected="gold"
|
||||
text_align="left"
|
||||
text_valign="center"
|
||||
/>
|
||||
@ -141,7 +132,6 @@
|
||||
scrollbar_style="ModernScrollBar"
|
||||
scroll_bottom="true"
|
||||
textcolor="white"
|
||||
textcolor_selected="black"
|
||||
text_align="left"
|
||||
text_valign="center"
|
||||
sprite="ModernDarkBoxGold"
|
||||
|
@ -4,16 +4,10 @@
|
||||
|
||||
<style name="MainMenuPanel"
|
||||
sprite="MainMenuPanel"
|
||||
buffer_zone="10"
|
||||
text_align="left"
|
||||
text_valign="top"
|
||||
/>
|
||||
|
||||
<style name="SubmenuPanel"
|
||||
sprite="SubmenuPanel"
|
||||
buffer_zone="10"
|
||||
text_align="left"
|
||||
text_valign="top"
|
||||
/>
|
||||
|
||||
<style name="userReportPanel"
|
||||
|
@ -1,8 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<styles>
|
||||
<style name="TreeDisplay"
|
||||
scrollbar="true"
|
||||
scrollbar_style="ModernScrollBar"
|
||||
sprite="ModernDarkBoxGold"
|
||||
/>
|
||||
|
||||
|
@ -243,7 +243,6 @@
|
||||
buffer_zone="5"
|
||||
font="sans-bold-stroke-14"
|
||||
textcolor="white"
|
||||
textcolor_selected="white"
|
||||
text_align="left"
|
||||
text_valign="top"
|
||||
/>
|
||||
|
@ -621,14 +621,14 @@ void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec
|
||||
CStr argStyle(attributes.GetNamedItem(attr_style));
|
||||
|
||||
if (m_Styles.count("default") == 1)
|
||||
object->LoadStyle(*this, "default");
|
||||
object->LoadStyle("default");
|
||||
|
||||
if (!argStyle.empty())
|
||||
{
|
||||
if (m_Styles.count(argStyle) == 0)
|
||||
LOGERROR("GUI: Trying to use style '%s' that doesn't exist.", argStyle.c_str());
|
||||
else
|
||||
object->LoadStyle(*this, argStyle);
|
||||
object->LoadStyle(argStyle);
|
||||
}
|
||||
|
||||
bool NameSet = false;
|
||||
|
@ -259,28 +259,21 @@ void IGUIObject::UpdateCachedSize()
|
||||
}
|
||||
}
|
||||
|
||||
void IGUIObject::LoadStyle(CGUI& pGUI, const CStr& StyleName)
|
||||
void IGUIObject::LoadStyle(const CStr& StyleName)
|
||||
{
|
||||
if (pGUI.HasStyle(StyleName))
|
||||
LoadStyle(pGUI.GetStyle(StyleName));
|
||||
else
|
||||
if (!m_pGUI.HasStyle(StyleName))
|
||||
debug_warn(L"IGUIObject::LoadStyle failed");
|
||||
}
|
||||
|
||||
void IGUIObject::LoadStyle(const SGUIStyle& Style)
|
||||
{
|
||||
// Iterate settings, it won't be able to set them all probably, but that doesn't matter
|
||||
for (const std::pair<CStr, CStrW>& p : Style.m_SettingsDefaults)
|
||||
// The default style may specify settings for any GUI object.
|
||||
// Other styles are reported if they specify a Setting that does not exist,
|
||||
// so that the XML author is informed and can correct the style.
|
||||
|
||||
for (const std::pair<CStr, CStrW>& p : m_pGUI.GetStyle(StyleName).m_SettingsDefaults)
|
||||
{
|
||||
// Try set setting in object
|
||||
SetSetting(p.first, p.second);
|
||||
|
||||
// It doesn't matter if it fail, it's not suppose to be able to set every setting.
|
||||
// since it's generic.
|
||||
|
||||
// The beauty with styles is that it can contain more settings
|
||||
// than exists for the objects using it. So if the SetSetting
|
||||
// fails, don't care.
|
||||
if (SettingExists(p.first))
|
||||
SetSetting(p.first, p.second);
|
||||
else if (StyleName != "default")
|
||||
LOGWARNING("GUI object has no setting \"%s\", but the style \"%s\" defines it", p.first, StyleName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,18 +296,8 @@ protected:
|
||||
|
||||
/**
|
||||
* Loads a style.
|
||||
*
|
||||
* @param GUIinstance Reference to the GUI
|
||||
* @param StyleName Style by name
|
||||
*/
|
||||
void LoadStyle(CGUI& pGUI, const CStr& StyleName);
|
||||
|
||||
/**
|
||||
* Loads a style.
|
||||
*
|
||||
* @param Style The style object.
|
||||
*/
|
||||
void LoadStyle(const SGUIStyle& Style);
|
||||
void LoadStyle(const CStr& StyleName);
|
||||
|
||||
/**
|
||||
* Returns not the Z value, but the actual buffered Z value, i.e. if it's
|
||||
|
Loading…
Reference in New Issue
Block a user