From f3cf61627c4a218890c0f5dda9a24da77bb2d4b7 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 8 Aug 2023 09:06:05 +0400 Subject: [PATCH] Do not use deprecated MyGUI features for list boxes --- components/fontloader/fontloader.cpp | 19 ++++++++- files/data/mygui/openmw_list.skin.xml | 55 +++++++++++++-------------- 2 files changed, 44 insertions(+), 30 deletions(-) diff --git a/components/fontloader/fontloader.cpp b/components/fontloader/fontloader.cpp index fcee1bcd28..5a94e1aeed 100644 --- a/components/fontloader/fontloader.cpp +++ b/components/fontloader/fontloader.cpp @@ -610,6 +610,7 @@ namespace Gui void FontLoader::overrideLineHeight(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version) { + // We should adjust line height for MyGUI widgets depending on font size MyGUI::xml::ElementEnumerator resourceNode = _node->getElementEnumerator(); while (resourceNode.next("Resource")) { @@ -618,11 +619,27 @@ namespace Gui if (Misc::StringUtils::ciEqual(type, "ResourceSkin") || Misc::StringUtils::ciEqual(type, "AutoSizedResourceSkin")) { - // We should adjust line height for MyGUI widgets depending on font size + MyGUI::xml::ElementPtr heightNode = resourceNode->createChild("Property"); heightNode->addAttribute("key", "HeightLine"); heightNode->addAttribute("value", std::to_string(Settings::gui().mFontSize + 2)); } + + if (Misc::StringUtils::ciEqual(type, "ResourceLayout")) + { + MyGUI::xml::ElementEnumerator resourceRootNode = resourceNode->getElementEnumerator(); + while (resourceRootNode.next("Widget")) + { + if (resourceRootNode->findAttribute("name") != "Root") + continue; + + MyGUI::xml::ElementPtr heightNode = resourceRootNode->createChild("UserString"); + heightNode->addAttribute("key", "HeightLine"); + heightNode->addAttribute("value", std::to_string(Settings::gui().mFontSize + 2)); + + break; + } + } } MyGUI::ResourceManager::getInstance().loadFromXmlNode(_node, _file, _version); diff --git a/files/data/mygui/openmw_list.skin.xml b/files/data/mygui/openmw_list.skin.xml index 9a54a10683..9ec1a9326a 100644 --- a/files/data/mygui/openmw_list.skin.xml +++ b/files/data/mygui/openmw_list.skin.xml @@ -123,39 +123,36 @@ - - - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + +