From aca39c919fce6d788407603344bdc8c099b1e7fe Mon Sep 17 00:00:00 2001 From: Kagernac Date: Wed, 5 Jun 2024 20:26:45 -0700 Subject: [PATCH] Changed the tagname to match the values in settings.cfg Changed the values from int to float in settings.cfg. This is consistent with the older format. The prefix is no longer referenced and hardcoded. There were four original values in the old color format, the parsing had to be modified to account for floats and four values. --- components/widgets/tags.cpp | 17 ++++++++--------- files/data/mygui/openmw_list.skin.xml | 12 ++++++------ files/settings-default.cfg | 12 ++++++------ 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/components/widgets/tags.cpp b/components/widgets/tags.cpp index ae55e4b76d..1477470024 100644 --- a/components/widgets/tags.cpp +++ b/components/widgets/tags.cpp @@ -61,25 +61,24 @@ namespace Gui } else if (tag.starts_with(fontcolouroptional)) { - std::string settingprefix = "color topic "; std::string_view category = "GUI"; - settingprefix += tag.substr(fontcolouroptional.length()); - std::replace(settingprefix.begin(), settingprefix.end(), '_', ' '); - std::string str = Settings::Manager::getString(settingprefix, category); + 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: " + settingprefix); + throw std::runtime_error("Unable to map setting to value: " + colortag); - std::string ret[3]; + std::string ret[4]; unsigned int j = 0; for (unsigned int i = 0; i < str.length(); ++i) { - if (str[i] == ',') + if (str[i] == ' ') j++; else if (str[i] != ' ') ret[j] += str[i]; } - MyGUI::Colour col(MyGUI::utility::parseInt(ret[0]) / 255.f, MyGUI::utility::parseInt(ret[1]) / 255.f, - MyGUI::utility::parseInt(ret[2]) / 255.f); + 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(); return true; } diff --git a/files/data/mygui/openmw_list.skin.xml b/files/data/mygui/openmw_list.skin.xml index 0e57f44992..45551429ed 100644 --- a/files/data/mygui/openmw_list.skin.xml +++ b/files/data/mygui/openmw_list.skin.xml @@ -129,9 +129,9 @@ - - - + + + @@ -140,9 +140,9 @@ - - - + + + diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 9a262260e7..1efcec8db4 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -220,17 +220,17 @@ color topic enable = false # The color of dialogue topic keywords that gives unique actor responses # Format (R,G,B) (255,255,255) or empty for no special formatting # Default to blue -color topic specific = 112,126,207 -color topic specific over = 143,155,218 -color topic specific pressed = 175,184,228 +color topic specific = 0.45 0.5 0.8 1 +color topic specific over = 0.58 0.62 0.85 1 +color topic specific pressed = 0.29 0.36 0.75 1 # The color of dialogue topic keywords that gives already read responses # Format (R,G,B) (255,255,255) or empty for no special formatting # Default to grey -color topic exhausted = 103,103,111 -color topic exhausted over = 170,170,188 -color topic exhausted pressed= 69,69,85 +color topic exhausted = 0.3 0.3 0.3 1 +color topic exhausted over = 0.56 0.56 0.56 1 +color topic exhausted pressed= 0.44 0.44 0.44 1 [HUD]