mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-14 01:19:59 +00:00
Cleaner implementation
Retrieved the Colours straight from Settings Made tagname clearer in openmw_list.skin.xml Fixed minor formatting issue in validate.cpp, textcolours.cpp Updated skin variables to be const and string_view
This commit is contained in:
parent
aca39c919f
commit
7d403089ec
@ -794,8 +794,8 @@ namespace MWGui
|
||||
if (!Settings::gui().mColorTopicEnable)
|
||||
return;
|
||||
|
||||
std::string specificSkin = "MW_ListLine_Specific";
|
||||
std::string exhaustedSkin = "MW_ListLine_Exhausted";
|
||||
const std::string_view specificSkin = "MW_ListLine_Specific";
|
||||
const std::string_view exhaustedSkin = "MW_ListLine_Exhausted";
|
||||
|
||||
for (const std::string& keyword : mKeywords)
|
||||
{
|
||||
|
@ -11,7 +11,6 @@ namespace MWGui
|
||||
return MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=" + type + "}"));
|
||||
}
|
||||
|
||||
|
||||
void TextColours::loadColours()
|
||||
{
|
||||
header = getTextColour("header");
|
||||
@ -33,6 +32,5 @@ namespace MWGui
|
||||
journalTopic = getTextColour("journal_topic");
|
||||
journalTopicOver = getTextColour("journal_topic_over");
|
||||
journalTopicPressed = getTextColour("journal_topic_pressed");
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -109,8 +109,7 @@ static const std::set<std::string_view> allowedKeysNonNumeric = { "Blood_Model_0
|
||||
"FontColor_color_link", "FontColor_color_link_over", "FontColor_color_link_pressed", "FontColor_color_magic",
|
||||
"FontColor_color_magic_fill", "FontColor_color_misc", "FontColor_color_negative", "FontColor_color_normal",
|
||||
"FontColor_color_normal_over", "FontColor_color_normal_pressed", "FontColor_color_notify",
|
||||
"FontColor_color_positive", "FontColor_color_weapon_fill",
|
||||
"Fonts_Font_0", "Fonts_Font_1", "Fonts_Font_2",
|
||||
"FontColor_color_positive", "FontColor_color_weapon_fill", "Fonts_Font_0", "Fonts_Font_1", "Fonts_Font_2",
|
||||
"Level_Up_Default", "Moons_Script_Color", "Movies_Company_Logo", "Movies_Morrowind_Logo", "Movies_New_Game",
|
||||
"Question_10_AnswerOne", "Question_10_AnswerThree", "Question_10_AnswerTwo", "Question_10_Question",
|
||||
"Question_10_Sound", "Question_1_AnswerOne", "Question_1_AnswerThree", "Question_1_AnswerTwo",
|
||||
|
@ -12,7 +12,7 @@ namespace Gui
|
||||
{
|
||||
std::string_view fontcolour = "fontcolour=";
|
||||
std::string_view fontcolourhtml = "fontcolourhtml=";
|
||||
std::string_view fontcolouroptional = "fontcolouroptional=";
|
||||
std::string_view fontcolouroptional = "fontcoloursetting=";
|
||||
|
||||
if (tag.starts_with(fontcolour))
|
||||
{
|
||||
@ -61,25 +61,9 @@ namespace Gui
|
||||
}
|
||||
else if (tag.starts_with(fontcolouroptional))
|
||||
{
|
||||
std::string_view category = "GUI";
|
||||
std::string colortag = "";
|
||||
colortag += tag.substr(fontcolouroptional.length());
|
||||
std::string str = Settings::Manager::getString(colortag, category);
|
||||
if (str.empty())
|
||||
throw std::runtime_error("Unable to map setting to value: " + colortag);
|
||||
|
||||
std::string ret[4];
|
||||
unsigned int j = 0;
|
||||
for (unsigned int i = 0; i < str.length(); ++i)
|
||||
{
|
||||
if (str[i] == ' ')
|
||||
j++;
|
||||
else if (str[i] != ' ')
|
||||
ret[j] += str[i];
|
||||
}
|
||||
MyGUI::Colour col(MyGUI::utility::parseFloat(ret[0]), MyGUI::utility::parseFloat(ret[1]),
|
||||
MyGUI::utility::parseFloat(ret[2]), MyGUI::utility::parseFloat(ret[3]));
|
||||
out = col.print();
|
||||
std::string_view colortag = tag.substr(fontcolouroptional.length());
|
||||
const MyGUI::Colour& customColour = Settings::get<MyGUI::Colour>("GUI", colortag).get();
|
||||
out = customColour.print();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -129,9 +129,9 @@
|
||||
<Property key="TextAlign" value="Left VCenter"/>
|
||||
|
||||
<BasisSkin type="SimpleText" offset="2 0 1 5" align="Stretch">
|
||||
<State name="normal" colour="#{fontcolouroptional=color topic specific}"/>
|
||||
<State name="highlighted" colour="#{fontcolouroptional=color topic specific over}"/>
|
||||
<State name="pushed" colour="#{fontcolouroptional=color topic specific pressed}"/>
|
||||
<State name="normal" colour="#{fontcoloursetting=color topic specific}"/>
|
||||
<State name="highlighted" colour="#{fontcoloursetting=color topic specific over}"/>
|
||||
<State name="pushed" colour="#{fontcoloursetting=color topic specific pressed}"/>
|
||||
</BasisSkin>
|
||||
</Resource>
|
||||
|
||||
@ -140,9 +140,9 @@
|
||||
<Property key="TextAlign" value="Left VCenter"/>
|
||||
|
||||
<BasisSkin type="SimpleText" offset="2 0 1 5" align="Stretch">
|
||||
<State name="normal" colour="#{fontcolouroptional=color topic exhausted}"/>
|
||||
<State name="highlighted" colour="#{fontcolouroptional=color topic exhausted over}"/>
|
||||
<State name="pushed" colour="#{fontcolouroptional=color topic exhausted pressed}"/>
|
||||
<State name="normal" colour="#{fontcoloursetting=color topic exhausted}"/>
|
||||
<State name="highlighted" colour="#{fontcoloursetting=color topic exhausted over}"/>
|
||||
<State name="pushed" colour="#{fontcoloursetting=color topic exhausted pressed}"/>
|
||||
</BasisSkin>
|
||||
</Resource>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user