[#7528] Fix MyGUI 3.4.3 issues

macos_ci_fix
Bret Curtis 1 year ago
parent b9c986b0b8
commit 43a931d3c4

@ -23,8 +23,8 @@ namespace MWGui
MyGUI::xml::ElementEnumerator info = _node->getElementEnumerator(); MyGUI::xml::ElementEnumerator info = _node->getElementEnumerator();
while (info.next("Property")) while (info.next("Property"))
{ {
const std::string& key = info->findAttribute("key"); auto key = info->findAttribute("key");
const std::string& value = info->findAttribute("value"); auto value = info->findAttribute("value");
if (key == "Point") if (key == "Point")
mPoint = MyGUI::IntPoint::parse(value); mPoint = MyGUI::IntPoint::parse(value);

@ -9,15 +9,15 @@ namespace MWGui
void resizeSkin(MyGUI::xml::ElementPtr _node) void resizeSkin(MyGUI::xml::ElementPtr _node)
{ {
_node->setAttribute("type", "ResourceSkin"); _node->setAttribute("type", "ResourceSkin");
const std::string size = _node->findAttribute("size"); auto size = _node->findAttribute("size");
if (!size.empty()) if (!size.empty())
return; return;
const std::string textureName = _node->findAttribute("texture"); auto textureName = _node->findAttribute("texture");
if (textureName.empty()) if (textureName.empty())
return; return;
MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture(textureName); MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture(std::string(textureName));
if (!texture) if (!texture)
return; return;
@ -30,7 +30,7 @@ namespace MWGui
if (basis->getName() != "BasisSkin") if (basis->getName() != "BasisSkin")
continue; continue;
const std::string basisSkinType = basis->findAttribute("type"); auto basisSkinType = basis->findAttribute("type");
if (Misc::StringUtils::ciEqual(basisSkinType, "SimpleText")) if (Misc::StringUtils::ciEqual(basisSkinType, "SimpleText"))
continue; continue;
bool isTileRect = Misc::StringUtils::ciEqual(basisSkinType, "TileRect"); bool isTileRect = Misc::StringUtils::ciEqual(basisSkinType, "TileRect");

@ -242,13 +242,13 @@ namespace MWGui
void SettingsWindow::updateSliderLabel(MyGUI::ScrollBar* scroller, const std::string& value) void SettingsWindow::updateSliderLabel(MyGUI::ScrollBar* scroller, const std::string& value)
{ {
std::string labelWidgetName = scroller->getUserString("SettingLabelWidget"); auto labelWidgetName = scroller->getUserString("SettingLabelWidget");
if (!labelWidgetName.empty()) if (!labelWidgetName.empty())
{ {
MyGUI::TextBox* textBox; MyGUI::TextBox* textBox;
getWidget(textBox, labelWidgetName); getWidget(textBox, labelWidgetName);
std::string labelCaption = scroller->getUserString("SettingLabelCaption"); auto labelCaption = scroller->getUserString("SettingLabelCaption");
labelCaption = Misc::StringUtils::format(labelCaption, value); labelCaption = Misc::StringUtils::format(std::string(labelCaption), value);
textBox->setCaptionWithReplacing(labelCaption); textBox->setCaptionWithReplacing(labelCaption);
} }
} }

@ -244,7 +244,7 @@ namespace MWGui
= store->get<ESM::Skill>().find(MWMechanics::getSpellSchool(spell, player))->mSchool; = store->get<ESM::Skill>().find(MWMechanics::getSpellSchool(spell, player))->mSchool;
info.text = "#{sSchool}: " + MyGUI::TextIterator::toTagsString(school->mName).asUTF8(); info.text = "#{sSchool}: " + MyGUI::TextIterator::toTagsString(school->mName).asUTF8();
} }
const std::string& cost = focus->getUserString("SpellCost"); auto cost = focus->getUserString("SpellCost");
if (!cost.empty() && cost != "0") if (!cost.empty() && cost != "0")
info.text info.text
+= MWGui::ToolTips::getValueString(MWMechanics::calcSpellCost(*spell), "#{sCastCost}"); += MWGui::ToolTips::getValueString(MWMechanics::calcSpellCost(*spell), "#{sCastCost}");

@ -2186,7 +2186,7 @@ namespace MWGui
ResourceImageSetPointerFix* imgSetPointer = resource->castType<ResourceImageSetPointerFix>(false); ResourceImageSetPointerFix* imgSetPointer = resource->castType<ResourceImageSetPointerFix>(false);
if (!imgSetPointer) if (!imgSetPointer)
continue; continue;
std::string tex_name = imgSetPointer->getImageSet()->getIndexInfo(0, 0).texture; auto tex_name = imgSetPointer->getImageSet()->getIndexInfo(0, 0).texture;
osg::ref_ptr<osg::Image> image = mResourceSystem->getImageManager()->getImage(tex_name); osg::ref_ptr<osg::Image> image = mResourceSystem->getImageManager()->getImage(tex_name);

@ -58,7 +58,7 @@ namespace
MyGUI::xml::ElementPtr sizeProperty = getProperty(layersIterator.current(), "Size"); MyGUI::xml::ElementPtr sizeProperty = getProperty(layersIterator.current(), "Size");
if (sizeProperty != nullptr) if (sizeProperty != nullptr)
{ {
std::string sizeValue = sizeProperty->findAttribute("value"); auto sizeValue = sizeProperty->findAttribute("value");
if (!sizeValue.empty()) if (!sizeValue.empty())
return MyGUI::IntSize::parse(sizeValue); return MyGUI::IntSize::parse(sizeValue);
} }
@ -614,7 +614,7 @@ namespace Gui
MyGUI::xml::ElementEnumerator resourceNode = _node->getElementEnumerator(); MyGUI::xml::ElementEnumerator resourceNode = _node->getElementEnumerator();
while (resourceNode.next("Resource")) while (resourceNode.next("Resource"))
{ {
std::string type = resourceNode->findAttribute("type"); auto type = resourceNode->findAttribute("type");
if (Misc::StringUtils::ciEqual(type, "ResourceLayout")) if (Misc::StringUtils::ciEqual(type, "ResourceLayout"))
{ {

@ -58,7 +58,7 @@ namespace osgMyGUI
throw std::runtime_error("DataManager::getDataListNames is not implemented - VFS is used"); throw std::runtime_error("DataManager::getDataListNames is not implemented - VFS is used");
} }
const std::string& DataManager::getDataPath(const std::string& name) const std::string DataManager::getDataPath(const std::string& name) const
{ {
static std::string result; static std::string result;
result.clear(); result.clear();

@ -45,7 +45,7 @@ namespace osgMyGUI
@param _name Resource name. @param _name Resource name.
@return Return full path to specified data. @return Return full path to specified data.
*/ */
const std::string& getDataPath(const std::string& _name) const override; std::string getDataPath(const std::string& _name) const override;
private: private:
std::filesystem::path mResourcePath; std::filesystem::path mResourcePath;

@ -31,7 +31,7 @@ namespace osgMyGUI
void flush() override; void flush() override;
void log(const std::string& _section, MyGUI::LogLevel _level, const struct tm* _time, void log(const std::string& _section, MyGUI::LogLevel _level, const struct tm* _time,
const std::string& _message, const char* _file, int _line) override; const std::string& _message, const char* _file, int _line);
private: private:
std::ofstream mStream; std::ofstream mStream;

@ -123,8 +123,8 @@ namespace osgMyGUI
{ {
if (info->getName() == "Property") if (info->getName() == "Property")
{ {
const std::string& key = info->findAttribute("key"); auto key = info->findAttribute("key");
const std::string& value = info->findAttribute("value"); auto value = info->findAttribute("value");
if (key == "Size") if (key == "Size")
{ {

@ -40,7 +40,7 @@ namespace Gui
notifySizeChange(this); notifySizeChange(this);
} }
void AutoSizedTextBox::setPropertyOverride(const std::string& _key, const std::string& _value) void AutoSizedTextBox::setPropertyOverride(std::string_view _key, const std::string_view _value)
{ {
if (_key == "ExpandDirection") if (_key == "ExpandDirection")
{ {
@ -103,7 +103,7 @@ namespace Gui
setEditStatic(true); setEditStatic(true);
} }
void AutoSizedEditBox::setPropertyOverride(const std::string& _key, const std::string& _value) void AutoSizedEditBox::setPropertyOverride(std::string_view _key, const std::string_view _value)
{ {
if (_key == "ExpandDirection") if (_key == "ExpandDirection")
{ {
@ -136,7 +136,7 @@ namespace Gui
notifySizeChange(this); notifySizeChange(this);
} }
void AutoSizedButton::setPropertyOverride(const std::string& _key, const std::string& _value) void AutoSizedButton::setPropertyOverride(std::string_view _key, const std::string_view _value)
{ {
if (_key == "ExpandDirection") if (_key == "ExpandDirection")
{ {
@ -147,6 +147,7 @@ namespace Gui
Gui::Button::setPropertyOverride(_key, _value); Gui::Button::setPropertyOverride(_key, _value);
} }
} }
Box::Box() Box::Box()
: mSpacing(4) : mSpacing(4)
, mPadding(0) , mPadding(0)
@ -159,7 +160,7 @@ namespace Gui
align(); align();
} }
bool Box::_setPropertyImpl(const std::string& _key, const std::string& _value) bool Box::_setPropertyImpl(std::string_view _key, const std::string_view _value)
{ {
if (_key == "Spacing") if (_key == "Spacing")
mSpacing = MyGUI::utility::parseValue<int>(_value); mSpacing = MyGUI::utility::parseValue<int>(_value);
@ -260,7 +261,7 @@ namespace Gui
} }
} }
void HBox::setPropertyOverride(const std::string& _key, const std::string& _value) void HBox::setPropertyOverride(std::string_view _key, const std::string_view _value)
{ {
if (!Box::_setPropertyImpl(_key, _value)) if (!Box::_setPropertyImpl(_key, _value))
MyGUI::Widget::setPropertyOverride(_key, _value); MyGUI::Widget::setPropertyOverride(_key, _value);
@ -415,7 +416,7 @@ namespace Gui
} }
} }
void VBox::setPropertyOverride(const std::string& _key, const std::string& _value) void VBox::setPropertyOverride(std::string_view _key, const std::string_view _value)
{ {
if (!Box::_setPropertyImpl(_key, _value)) if (!Box::_setPropertyImpl(_key, _value))
MyGUI::Widget::setPropertyOverride(_key, _value); MyGUI::Widget::setPropertyOverride(_key, _value);

@ -53,7 +53,7 @@ namespace Gui
void setCaption(const MyGUI::UString& _value) override; void setCaption(const MyGUI::UString& _value) override;
protected: protected:
void setPropertyOverride(const std::string& _key, const std::string& _value) override; void setPropertyOverride(std::string_view _key, std::string_view _value) override;
std::string mFontSize; std::string mFontSize;
}; };
@ -68,7 +68,7 @@ namespace Gui
void initialiseOverride() override; void initialiseOverride() override;
protected: protected:
void setPropertyOverride(const std::string& _key, const std::string& _value) override; void setPropertyOverride(std::string_view _key, const std::string_view _value) override;
int getWidth(); int getWidth();
std::string mFontSize; std::string mFontSize;
bool mShrink = false; bool mShrink = false;
@ -85,7 +85,7 @@ namespace Gui
void setCaption(const MyGUI::UString& _value) override; void setCaption(const MyGUI::UString& _value) override;
protected: protected:
void setPropertyOverride(const std::string& _key, const std::string& _value) override; void setPropertyOverride(std::string_view _key, const std::string_view _value) override;
std::string mFontSize; std::string mFontSize;
}; };
@ -105,7 +105,7 @@ namespace Gui
protected: protected:
virtual void align() = 0; virtual void align() = 0;
virtual bool _setPropertyImpl(const std::string& _key, const std::string& _value); virtual bool _setPropertyImpl(std::string_view _key, std::string_view _value);
int mSpacing; // how much space to put between elements int mSpacing; // how much space to put between elements
@ -137,7 +137,7 @@ namespace Gui
void align() override; void align() override;
MyGUI::IntSize getRequestedSize() override; MyGUI::IntSize getRequestedSize() override;
void setPropertyOverride(const std::string& _key, const std::string& _value) override; void setPropertyOverride(std::string_view _key, std::string_view _value) override;
void onWidgetCreated(MyGUI::Widget* _widget) override; void onWidgetCreated(MyGUI::Widget* _widget) override;
}; };
@ -156,7 +156,7 @@ namespace Gui
void align() override; void align() override;
MyGUI::IntSize getRequestedSize() override; MyGUI::IntSize getRequestedSize() override;
void setPropertyOverride(const std::string& _key, const std::string& _value) override; void setPropertyOverride(std::string_view _key, std::string_view _value);
void onWidgetCreated(MyGUI::Widget* _widget) override; void onWidgetCreated(MyGUI::Widget* _widget) override;
}; };

@ -34,7 +34,7 @@ namespace Gui
updateImage(); updateImage();
} }
void ImageButton::setPropertyOverride(const std::string& _key, const std::string& _value) void ImageButton::setPropertyOverride(std::string_view _key, const std::string_view _value)
{ {
if (_key == "ImageHighlighted") if (_key == "ImageHighlighted")
mImageHighlighted = _value; mImageHighlighted = _value;
@ -56,6 +56,7 @@ namespace Gui
else else
ImageBox::setPropertyOverride(_key, _value); ImageBox::setPropertyOverride(_key, _value);
} }
void ImageButton::onMouseSetFocus(Widget* _old) void ImageButton::onMouseSetFocus(Widget* _old)
{ {
mMouseFocus = true; mMouseFocus = true;

@ -32,7 +32,7 @@ namespace Gui
static bool sDefaultNeedKeyFocus; static bool sDefaultNeedKeyFocus;
protected: protected:
void setPropertyOverride(const std::string& _key, const std::string& _value) override; void setPropertyOverride(std::string_view _key, std::string_view _value) override;
void onMouseLostFocus(MyGUI::Widget* _new) override; void onMouseLostFocus(MyGUI::Widget* _new) override;
void onMouseSetFocus(MyGUI::Widget* _old) override; void onMouseSetFocus(MyGUI::Widget* _old) override;
void onMouseButtonPressed(int _left, int _top, MyGUI::MouseButton _id) override; void onMouseButtonPressed(int _left, int _top, MyGUI::MouseButton _id) override;

@ -107,7 +107,7 @@ namespace Gui
mScrollView->setViewOffset(MyGUI::IntPoint(0, -viewPosition)); mScrollView->setViewOffset(MyGUI::IntPoint(0, -viewPosition));
} }
void MWList::setPropertyOverride(const std::string& _key, const std::string& _value) void MWList::setPropertyOverride(std::string_view _key, const std::string_view _value)
{ {
if (_key == "ListItemSkin") if (_key == "ListItemSkin")
mListItemSkin = _value; mListItemSkin = _value;

@ -49,7 +49,7 @@ namespace Gui
void scrollToTop(); void scrollToTop();
void setPropertyOverride(const std::string& _key, const std::string& _value) override; void setPropertyOverride(std::string_view _key, std::string_view _value) override;
protected: protected:
void initialiseOverride() override; void initialiseOverride() override;

Loading…
Cancel
Save