1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-16 02:09:42 +00:00

Do not use deprecated MyGUI features for list boxes

This commit is contained in:
Andrei Kortunov 2023-08-08 09:06:05 +04:00
parent 370807281f
commit f3cf61627c
2 changed files with 44 additions and 30 deletions
components/fontloader
files/data/mygui

View file

@ -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);

View file

@ -123,39 +123,36 @@
</BasisSkin>
</Resource>
<Resource type="ResourceSkin" name="MW_List" size="516 516" align="Left Top">
<Property key="NeedKey" value="true"/>
<Property key="SkinLine" value="MW_ListLine"/>
<Child type="Widget" skin="MW_Box" offset="0 0 516 516" align="Stretch"/>
<Child type="ScrollBar" skin="MW_VScroll" offset="498 4 14 508" align="Right VStretch" name="VScroll"/>
<Child type="Widget" skin="" offset="3 4 493 508" align="Stretch" name="Client"/>
<Resource type="ResourceLayout" name="MW_List" size="516 516" align="Left Top">
<Widget type="Widget" position="0 0 516 516" name="Root">
<Property key="NeedKey" value="true"/>
<UserString key="SkinLine" value="MW_ListLine"/>
<Widget type="Widget" skin="MW_Box" position="0 0 516 516" align="Stretch" />
<Widget type="ScrollBar" skin="MW_VScroll" position="498 4 14 508" align="Right VStretch" name="VScroll" />
<Widget type="Widget" skin="" position="3 4 493 508" align="Stretch" name="Client" />
</Widget>
</Resource>
<Resource type="ResourceSkin" name="MW_PopupList" size="516 516" align="Left Top">
<Property key="NeedKey" value="true"/>
<Property key="SkinLine" value="MW_ListLine"/>
<Child type="Widget" skin="BlackBG" offset="0 0 516 516" align="Stretch"/>
<Child type="Widget" skin="MW_Box" offset="0 0 516 516" align="Stretch"/>
<Child type="ScrollBar" skin="MW_VScroll" offset="498 3 14 509" align="Right VStretch" name="VScroll"/>
<Child type="Widget" skin="" offset="3 3 493 509" align="Stretch" name="Client"/>
<Resource type="ResourceLayout" name="MW_PopupList" size="516 516" align="Left Top">
<Widget type="Widget" position="0 0 516 516" name="Root">
<Property key="NeedKey" value="true"/>
<UserString key="SkinLine" value="MW_ListLine"/>
<Widget type="Widget" skin="BlackBG" position="0 0 516 516" align="Stretch" />
<Widget type="Widget" skin="MW_Box" position="0 0 516 516" align="Stretch" />
<Widget type="ScrollBar" skin="MW_VScroll" position="498 3 14 509" align="Right VStretch" name="VScroll" />
<Widget type="Widget" skin="" position="3 3 493 509" align="Stretch" name="Client" />
</Widget>
</Resource>
<Resource type="ResourceSkin" name="MW_PopupListNoTransp" size="516 516" align="Left Top">
<Property key="NeedKey" value="true"/>
<Property key="SkinLine" value="MW_ListLine"/>
<Child type="Widget" skin="FullBlackBG" offset="0 0 516 516" align="Stretch"/>
<Child type="Widget" skin="MW_Box" offset="0 0 516 516" align="Stretch"/>
<Child type="ScrollBar" skin="MW_VScroll" offset="498 3 14 509" align="Right VStretch" name="VScroll"/>
<Child type="Widget" skin="" offset="3 3 493 509" align="Stretch" name="Client"/>
<Resource type="ResourceLayout" name="MW_PopupListNoTransp" size="516 516" align="Left Top">
<Widget type="Widget" position="0 0 516 516" name="Root">
<Property key="NeedKey" value="true"/>
<UserString key="SkinLine" value="MW_ListLine"/>
<Widget type="Widget" skin="FullBlackBG" position="0 0 516 516" align="Stretch" />
<Widget type="Widget" skin="MW_Box" position="0 0 516 516" align="Stretch" />
<Widget type="ScrollBar" skin="MW_VScroll" position="498 3 14 509" align="Right VStretch" name="VScroll" />
<Widget type="Widget" skin="" position="3 3 493 509" align="Stretch" name="Client" />
</Widget>
</Resource>
<Resource type="ResourceSkin" name="MW_ItemView" size="516 516" align="Left Top">