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"
|
<style name="ModernWindow"
|
||||||
sprite="ModernWindow"
|
sprite="ModernWindow"
|
||||||
buffer_zone="12"
|
|
||||||
text_align="left"
|
|
||||||
text_valign="top"
|
|
||||||
/>
|
/>
|
||||||
<style name="ModernDialog"
|
<style name="ModernDialog"
|
||||||
sprite="ModernDialog"
|
sprite="ModernDialog"
|
||||||
buffer_zone="12"
|
|
||||||
text_align="left"
|
|
||||||
text_valign="top"
|
|
||||||
/>
|
/>
|
||||||
<style name="ModernList"
|
<style name="ModernList"
|
||||||
buffer_zone="5"
|
buffer_zone="5"
|
||||||
@ -41,7 +35,6 @@
|
|||||||
textcolor="white"
|
textcolor="white"
|
||||||
textcolor_selected="white"
|
textcolor_selected="white"
|
||||||
text_align="left"
|
text_align="left"
|
||||||
text_valign="center"
|
|
||||||
sound_selected="audio/interface/ui/ui_button_click.ogg"
|
sound_selected="audio/interface/ui/ui_button_click.ogg"
|
||||||
/>
|
/>
|
||||||
<style name="ModernSortedList"
|
<style name="ModernSortedList"
|
||||||
@ -58,7 +51,6 @@
|
|||||||
textcolor="white"
|
textcolor="white"
|
||||||
textcolor_selected="white"
|
textcolor_selected="white"
|
||||||
text_align="left"
|
text_align="left"
|
||||||
text_valign="center"
|
|
||||||
sound_selected="audio/interface/ui/ui_button_click.ogg"
|
sound_selected="audio/interface/ui/ui_button_click.ogg"
|
||||||
/>
|
/>
|
||||||
<style name="ModernDropDown"
|
<style name="ModernDropDown"
|
||||||
|
@ -66,18 +66,10 @@
|
|||||||
|
|
||||||
<style name="TranslucentPanelThinBorder"
|
<style name="TranslucentPanelThinBorder"
|
||||||
sprite="TranslucentPanelThinBorder"
|
sprite="TranslucentPanelThinBorder"
|
||||||
buffer_zone="10"
|
|
||||||
font="sans-bold-stroke-14"
|
|
||||||
textcolor="white"
|
|
||||||
text_align="left"
|
|
||||||
text_valign="top"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<style name="StonePanelThinBorder"
|
<style name="StonePanelThinBorder"
|
||||||
sprite="StonePanelThinBorder"
|
sprite="StonePanelThinBorder"
|
||||||
buffer_zone="10"
|
|
||||||
text_align="left"
|
|
||||||
text_valign="top"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
@ -129,7 +121,6 @@
|
|||||||
scrollbar_style="ModernScrollBar"
|
scrollbar_style="ModernScrollBar"
|
||||||
scroll_bottom="true"
|
scroll_bottom="true"
|
||||||
textcolor="white"
|
textcolor="white"
|
||||||
textcolor_selected="gold"
|
|
||||||
text_align="left"
|
text_align="left"
|
||||||
text_valign="center"
|
text_valign="center"
|
||||||
/>
|
/>
|
||||||
@ -141,7 +132,6 @@
|
|||||||
scrollbar_style="ModernScrollBar"
|
scrollbar_style="ModernScrollBar"
|
||||||
scroll_bottom="true"
|
scroll_bottom="true"
|
||||||
textcolor="white"
|
textcolor="white"
|
||||||
textcolor_selected="black"
|
|
||||||
text_align="left"
|
text_align="left"
|
||||||
text_valign="center"
|
text_valign="center"
|
||||||
sprite="ModernDarkBoxGold"
|
sprite="ModernDarkBoxGold"
|
||||||
|
@ -4,16 +4,10 @@
|
|||||||
|
|
||||||
<style name="MainMenuPanel"
|
<style name="MainMenuPanel"
|
||||||
sprite="MainMenuPanel"
|
sprite="MainMenuPanel"
|
||||||
buffer_zone="10"
|
|
||||||
text_align="left"
|
|
||||||
text_valign="top"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<style name="SubmenuPanel"
|
<style name="SubmenuPanel"
|
||||||
sprite="SubmenuPanel"
|
sprite="SubmenuPanel"
|
||||||
buffer_zone="10"
|
|
||||||
text_align="left"
|
|
||||||
text_valign="top"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<style name="userReportPanel"
|
<style name="userReportPanel"
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<styles>
|
<styles>
|
||||||
<style name="TreeDisplay"
|
<style name="TreeDisplay"
|
||||||
scrollbar="true"
|
|
||||||
scrollbar_style="ModernScrollBar"
|
|
||||||
sprite="ModernDarkBoxGold"
|
sprite="ModernDarkBoxGold"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -243,7 +243,6 @@
|
|||||||
buffer_zone="5"
|
buffer_zone="5"
|
||||||
font="sans-bold-stroke-14"
|
font="sans-bold-stroke-14"
|
||||||
textcolor="white"
|
textcolor="white"
|
||||||
textcolor_selected="white"
|
|
||||||
text_align="left"
|
text_align="left"
|
||||||
text_valign="top"
|
text_valign="top"
|
||||||
/>
|
/>
|
||||||
|
@ -621,14 +621,14 @@ void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec
|
|||||||
CStr argStyle(attributes.GetNamedItem(attr_style));
|
CStr argStyle(attributes.GetNamedItem(attr_style));
|
||||||
|
|
||||||
if (m_Styles.count("default") == 1)
|
if (m_Styles.count("default") == 1)
|
||||||
object->LoadStyle(*this, "default");
|
object->LoadStyle("default");
|
||||||
|
|
||||||
if (!argStyle.empty())
|
if (!argStyle.empty())
|
||||||
{
|
{
|
||||||
if (m_Styles.count(argStyle) == 0)
|
if (m_Styles.count(argStyle) == 0)
|
||||||
LOGERROR("GUI: Trying to use style '%s' that doesn't exist.", argStyle.c_str());
|
LOGERROR("GUI: Trying to use style '%s' that doesn't exist.", argStyle.c_str());
|
||||||
else
|
else
|
||||||
object->LoadStyle(*this, argStyle);
|
object->LoadStyle(argStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NameSet = false;
|
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))
|
if (!m_pGUI.HasStyle(StyleName))
|
||||||
LoadStyle(pGUI.GetStyle(StyleName));
|
|
||||||
else
|
|
||||||
debug_warn(L"IGUIObject::LoadStyle failed");
|
debug_warn(L"IGUIObject::LoadStyle failed");
|
||||||
}
|
|
||||||
|
|
||||||
void IGUIObject::LoadStyle(const SGUIStyle& Style)
|
// The default style may specify settings for any GUI object.
|
||||||
{
|
// Other styles are reported if they specify a Setting that does not exist,
|
||||||
// Iterate settings, it won't be able to set them all probably, but that doesn't matter
|
// so that the XML author is informed and can correct the style.
|
||||||
for (const std::pair<CStr, CStrW>& p : Style.m_SettingsDefaults)
|
|
||||||
|
for (const std::pair<CStr, CStrW>& p : m_pGUI.GetStyle(StyleName).m_SettingsDefaults)
|
||||||
{
|
{
|
||||||
// Try set setting in object
|
if (SettingExists(p.first))
|
||||||
SetSetting(p.first, p.second);
|
SetSetting(p.first, p.second);
|
||||||
|
else if (StyleName != "default")
|
||||||
// It doesn't matter if it fail, it's not suppose to be able to set every setting.
|
LOGWARNING("GUI object has no setting \"%s\", but the style \"%s\" defines it", p.first, StyleName.c_str());
|
||||||
// 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.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,18 +296,8 @@ protected:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a style.
|
* Loads a style.
|
||||||
*
|
|
||||||
* @param GUIinstance Reference to the GUI
|
|
||||||
* @param StyleName Style by name
|
|
||||||
*/
|
*/
|
||||||
void LoadStyle(CGUI& pGUI, const CStr& StyleName);
|
void LoadStyle(const CStr& StyleName);
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads a style.
|
|
||||||
*
|
|
||||||
* @param Style The style object.
|
|
||||||
*/
|
|
||||||
void LoadStyle(const SGUIStyle& Style);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns not the Z value, but the actual buffered Z value, i.e. if it's
|
* Returns not the Z value, but the actual buffered Z value, i.e. if it's
|
||||||
|
Loading…
Reference in New Issue
Block a user