Skip to content

Commit

Permalink
Merge branch 'mygui343_fix' into 'master'
Browse files Browse the repository at this point in the history
Fix MyGUI 3.4.3 issues [#7528]

See merge request OpenMW/openmw!3319
  • Loading branch information
psi29a committed Oct 25, 2023
2 parents f3931c8 + 1bd4860 commit 6a87ba8
Show file tree
Hide file tree
Showing 38 changed files with 94 additions and 179 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ macOS13_Xcode14_arm64:
- Get-Volume
- Copy-Item C:\ProgramData\chocolatey\logs\chocolatey.log
cache:
key: ninja-v7
key: ninja-v8
paths:
- ccache
- deps
Expand Down Expand Up @@ -710,7 +710,7 @@ macOS13_Xcode14_arm64:
- Get-Volume
- Copy-Item C:\ProgramData\chocolatey\logs\chocolatey.log
cache:
key: msbuild-v7
key: msbuild-v8
paths:
- ccache
- deps
Expand Down
2 changes: 1 addition & 1 deletion CI/before_install.osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ qmake --version
if [[ "${MACOS_AMD64}" ]]; then
curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/macos/openmw-deps-20221113.zip -o ~/openmw-deps.zip
else
curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/macos/openmw-deps-20230920_arm64.zip -o ~/openmw-deps.zip
curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/macos/openmw-deps-20231022_arm64.zip -o ~/openmw-deps.zip
fi

unzip -o ~/openmw-deps.zip -d /tmp > /dev/null
Expand Down
20 changes: 10 additions & 10 deletions CI/before_script.msvc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -597,14 +597,14 @@ if [ -z $SKIP_DOWNLOAD ]; then
"ffmpeg-${FFMPEG_VER}-dev-win${BITS}.zip"

# MyGUI
download "MyGUI 3.4.2" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/MyGUI-3.4.2-msvc${MYGUI_MSVC_YEAR}-win${BITS}.7z" \
"MyGUI-3.4.2-msvc${MYGUI_MSVC_YEAR}-win${BITS}.7z"
download "MyGUI 3.4.3" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/MyGUI-3.4.3-msvc${MYGUI_MSVC_YEAR}-win${BITS}.7z" \
"MyGUI-3.4.3-msvc${MYGUI_MSVC_YEAR}-win${BITS}.7z"

if [ -n "$PDBS" ]; then
download "MyGUI symbols" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/MyGUI-3.4.2-msvc${MYGUI_MSVC_YEAR}-win${BITS}-sym.7z" \
"MyGUI-3.4.2-msvc${MYGUI_MSVC_YEAR}-win${BITS}-sym.7z"
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/MyGUI-3.4.3-msvc${MYGUI_MSVC_YEAR}-win${BITS}-sym.7z" \
"MyGUI-3.4.3-msvc${MYGUI_MSVC_YEAR}-win${BITS}-sym.7z"
fi

# OpenAL
Expand Down Expand Up @@ -768,20 +768,20 @@ printf "FFmpeg ${FFMPEG_VER}... "
}
cd $DEPS
echo
printf "MyGUI 3.4.2... "
printf "MyGUI 3.4.3... "
{
cd $DEPS_INSTALL
if [ -d MyGUI ] && \
grep "MYGUI_VERSION_MAJOR 3" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null && \
grep "MYGUI_VERSION_MINOR 4" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null && \
grep "MYGUI_VERSION_PATCH 2" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null
grep "MYGUI_VERSION_PATCH 3" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null
then
printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then
rm -rf MyGUI
eval 7z x -y "${DEPS}/MyGUI-3.4.2-msvc${MYGUI_MSVC_YEAR}-win${BITS}.7z" $STRIP
[ -n "$PDBS" ] && eval 7z x -y "${DEPS}/MyGUI-3.4.2-msvc${MYGUI_MSVC_YEAR}-win${BITS}-sym.7z" $STRIP
mv "MyGUI-3.4.2-msvc${MYGUI_MSVC_YEAR}-win${BITS}" MyGUI
eval 7z x -y "${DEPS}/MyGUI-3.4.3-msvc${MYGUI_MSVC_YEAR}-win${BITS}.7z" $STRIP
[ -n "$PDBS" ] && eval 7z x -y "${DEPS}/MyGUI-3.4.3-msvc${MYGUI_MSVC_YEAR}-win${BITS}-sym.7z" $STRIP
mv "MyGUI-3.4.3-msvc${MYGUI_MSVC_YEAR}-win${BITS}" MyGUI
fi
export MYGUI_HOME="$(real_pwd)/MyGUI"
for CONFIGURATION in ${CONFIGURATIONS[@]}; do
Expand Down
2 changes: 2 additions & 0 deletions CI/install_debian_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,6 @@ mkdir -pv "$APT_CACHE_DIR"
apt-get update -yqq
apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" install -y --no-install-recommends software-properties-common gnupg >/dev/null
add-apt-repository -y ppa:openmw/openmw
add-apt-repository -y ppa:openmw/openmw-daily
add-apt-repository -y ppa:openmw/staging
apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" install -y --no-install-recommends "${deps[@]}" >/dev/null
4 changes: 2 additions & 2 deletions CI/org.openmw.OpenMW.devel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ modules:
- "-DMYGUI_BUILD_PLUGINS=0"
sources:
- type: archive
url: https://github.com/MyGUI/mygui/archive/refs/tags/MyGUI3.4.2.tar.gz
sha256: 1cc45fb96c9438e3476778449af0378443d84794a458978a29c75306e45dd45a
url: https://github.com/MyGUI/mygui/archive/refs/tags/MyGUI3.4.3.tar.gz
sha256: 33c91b531993047e77cace36d6fea73634b8c17bd0ed193d4cd12ac7c6328abd

- name: libunshield
buildsystem: cmake-ninja
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ set(Boost_NO_WARN_NEW_VERSIONS ON) # ignore warnings about new releases of boos
find_package(Boost 1.6.2 REQUIRED COMPONENTS ${BOOST_COMPONENTS} OPTIONAL_COMPONENTS ${BOOST_OPTIONAL_COMPONENTS})

if(OPENMW_USE_SYSTEM_MYGUI)
find_package(MyGUI 3.4.2 REQUIRED)
find_package(MyGUI 3.4.3 REQUIRED)
endif()
find_package(SDL2 2.0.9 REQUIRED)
find_package(OpenAL REQUIRED)
Expand Down
2 changes: 2 additions & 0 deletions apps/openmw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ if (MSVC)
)
endif()

add_definitions(-DMYGUI_DONT_USE_OBSOLETE=ON)

if (ANDROID)
target_link_libraries(openmw EGL android log z)
endif (ANDROID)
Expand Down
4 changes: 2 additions & 2 deletions apps/openmw/mwgui/cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace MWGui
MyGUI::xml::ElementEnumerator info = _node->getElementEnumerator();
while (info.next("Property"))
{
const std::string& key = info->findAttribute("key");
const std::string& value = info->findAttribute("value");
auto key = info->findAttribute("key");
auto value = info->findAttribute("value");

if (key == "Point")
mPoint = MyGUI::IntPoint::parse(value);
Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/mwgui/formatting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ namespace MWGui::Formatting
: GraphicElement(parent, pag, blockStyle)
, mTextStyle(textStyle)
{
Gui::EditBox* box = parent->createWidget<Gui::EditBox>("NormalText",
MyGUI::EditBox* box = parent->createWidget<MyGUI::EditBox>("NormalText",
MyGUI::IntCoord(0, pag.getCurrentTop(), pag.getPageWidth(), 0), MyGUI::Align::Left | MyGUI::Align::Top,
parent->getName() + MyGUI::utility::toString(parent->getChildCount()));
box->setEditStatic(true);
Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/mwgui/formatting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ namespace MWGui
private:
int currentFontHeight() const;
TextStyle mTextStyle;
Gui::EditBox* mEditBox;
MyGUI::EditBox* mEditBox;
};

class ImageElement : public GraphicElement
Expand Down
9 changes: 4 additions & 5 deletions apps/openmw/mwgui/resourceskin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ namespace MWGui
void resizeSkin(MyGUI::xml::ElementPtr _node)
{
_node->setAttribute("type", "ResourceSkin");
const std::string size = _node->findAttribute("size");
if (!size.empty())
if (!_node->findAttribute("size").empty())
return;

const std::string textureName = _node->findAttribute("texture");
auto textureName = _node->findAttribute("texture");
if (textureName.empty())
return;

MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture(textureName);
MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture(std::string{ textureName });
if (!texture)
return;

Expand All @@ -30,7 +29,7 @@ namespace MWGui
if (basis->getName() != "BasisSkin")
continue;

const std::string basisSkinType = basis->findAttribute("type");
auto basisSkinType = basis->findAttribute("type");
if (Misc::StringUtils::ciEqual(basisSkinType, "SimpleText"))
continue;
bool isTileRect = Misc::StringUtils::ciEqual(basisSkinType, "TileRect");
Expand Down
6 changes: 3 additions & 3 deletions apps/openmw/mwgui/settingswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ namespace MWGui
std::string_view type = getSettingType(current);
if (type == checkButtonType)
{
const std::string initialValue
std::string_view initialValue
= Settings::get<bool>(getSettingCategory(current), getSettingName(current)) ? "#{Interface:On}"
: "#{Interface:Off}";
current->castType<MyGUI::Button>()->setCaptionWithReplacing(initialValue);
Expand Down Expand Up @@ -242,12 +242,12 @@ namespace MWGui

void SettingsWindow::updateSliderLabel(MyGUI::ScrollBar* scroller, const std::string& value)
{
std::string labelWidgetName = scroller->getUserString("SettingLabelWidget");
auto labelWidgetName = scroller->getUserString("SettingLabelWidget");
if (!labelWidgetName.empty())
{
MyGUI::TextBox* textBox;
getWidget(textBox, labelWidgetName);
std::string labelCaption = scroller->getUserString("SettingLabelCaption");
std::string labelCaption{ scroller->getUserString("SettingLabelCaption") };
labelCaption = Misc::StringUtils::format(labelCaption, value);
textBox->setCaptionWithReplacing(labelCaption);
}
Expand Down
4 changes: 2 additions & 2 deletions apps/openmw/mwgui/spellview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,15 @@ namespace MWGui
mLines.emplace_back(separator, (MyGUI::Widget*)nullptr, NoSpellIndex);
}

MyGUI::TextBox* groupWidget = mScrollView->createWidget<Gui::TextBox>("SandBrightText",
MyGUI::TextBox* groupWidget = mScrollView->createWidget<MyGUI::TextBox>("SandBrightText",
MyGUI::IntCoord(0, 0, mScrollView->getWidth(), 24), MyGUI::Align::Left | MyGUI::Align::Top);
groupWidget->setCaptionWithReplacing(label);
groupWidget->setTextAlign(MyGUI::Align::Left);
groupWidget->setNeedMouseFocus(false);

if (!label2.empty())
{
MyGUI::TextBox* groupWidget2 = mScrollView->createWidget<Gui::TextBox>("SandBrightText",
MyGUI::TextBox* groupWidget2 = mScrollView->createWidget<MyGUI::TextBox>("SandBrightText",
MyGUI::IntCoord(0, 0, mScrollView->getWidth(), 24), MyGUI::Align::Left | MyGUI::Align::Top);
groupWidget2->setCaptionWithReplacing(label2);
groupWidget2->setTextAlign(MyGUI::Align::Right);
Expand Down
8 changes: 4 additions & 4 deletions apps/openmw/mwgui/tooltips.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ namespace MWGui
= store->get<ESM::Skill>().find(MWMechanics::getSpellSchool(spell, player))->mSchool;
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")
info.text
+= MWGui::ToolTips::getValueString(MWMechanics::calcSpellCost(*spell), "#{sCastCost}");
Expand Down Expand Up @@ -443,7 +443,7 @@ namespace MWGui
const std::string realImage
= Misc::ResourceHelpers::correctIconPath(image, MWBase::Environment::get().getResourceSystem()->getVFS());

Gui::EditBox* captionWidget = mDynamicToolTipBox->createWidget<Gui::EditBox>(
MyGUI::EditBox* captionWidget = mDynamicToolTipBox->createWidget<MyGUI::EditBox>(
"NormalText", MyGUI::IntCoord(0, 0, 300, 300), MyGUI::Align::Left | MyGUI::Align::Top, "ToolTipCaption");
captionWidget->setEditStatic(true);
captionWidget->setNeedKeyFocus(false);
Expand All @@ -452,7 +452,7 @@ namespace MWGui

int captionHeight = std::max(!caption.empty() ? captionSize.height : 0, imageSize);

Gui::EditBox* textWidget = mDynamicToolTipBox->createWidget<Gui::EditBox>("SandText",
MyGUI::EditBox* textWidget = mDynamicToolTipBox->createWidget<MyGUI::EditBox>("SandText",
MyGUI::IntCoord(0, captionHeight + imageCaptionVPadding, 300, 300 - captionHeight - imageCaptionVPadding),
MyGUI::Align::Stretch, "ToolTipText");
textWidget->setEditStatic(true);
Expand All @@ -474,7 +474,7 @@ namespace MWGui
MyGUI::ImageBox* icon = mDynamicToolTipBox->createWidget<MyGUI::ImageBox>("MarkerButton",
MyGUI::IntCoord(padding.left, totalSize.height + padding.top, 8, 8), MyGUI::Align::Default);
icon->setColour(MyGUI::Colour(1.0f, 0.3f, 0.3f));
Gui::EditBox* edit = mDynamicToolTipBox->createWidget<Gui::EditBox>("SandText",
MyGUI::EditBox* edit = mDynamicToolTipBox->createWidget<MyGUI::EditBox>("SandText",
MyGUI::IntCoord(padding.left + 8 + 4, totalSize.height + padding.top, 300 - padding.left - 8 - 4,
300 - totalSize.height),
MyGUI::Align::Default);
Expand Down
8 changes: 4 additions & 4 deletions apps/openmw/mwgui/windowmanagerimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ namespace MWGui
MWBase::Environment::get().getStateManager()->requestQuit();
}

void WindowManager::onCursorChange(const std::string& name)
void WindowManager::onCursorChange(std::string_view name)
{
mCursorManager->cursorChanged(name);
}
Expand Down Expand Up @@ -2072,13 +2072,13 @@ namespace MWGui
mWerewolfFader->notifyAlphaChanged(set ? 1.0f : 0.0f);
}

void WindowManager::onClipboardChanged(const std::string& _type, const std::string& _data)
void WindowManager::onClipboardChanged(std::string_view _type, std::string_view _data)
{
if (_type == "Text")
SDL_SetClipboardText(MyGUI::TextIterator::getOnlyText(MyGUI::UString(_data)).asUTF8().c_str());
}

void WindowManager::onClipboardRequested(const std::string& _type, std::string& _data)
void WindowManager::onClipboardRequested(std::string_view _type, std::string& _data)
{
if (_type != "Text")
return;
Expand Down Expand Up @@ -2187,7 +2187,7 @@ namespace MWGui
ResourceImageSetPointerFix* imgSetPointer = resource->castType<ResourceImageSetPointerFix>(false);
if (!imgSetPointer)
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);

Expand Down
6 changes: 3 additions & 3 deletions apps/openmw/mwgui/windowmanagerimp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,16 +561,16 @@ namespace MWGui
*/
void onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result);

void onCursorChange(const std::string& name);
void onCursorChange(std::string_view name);
void onKeyFocusChanged(MyGUI::Widget* widget);

// Key pressed while playing a video
void onVideoKeyPressed(MyGUI::Widget* _sender, MyGUI::KeyCode _key, MyGUI::Char _char);

void sizeVideo(int screenWidth, int screenHeight);

void onClipboardChanged(const std::string& _type, const std::string& _data);
void onClipboardRequested(const std::string& _type, std::string& _data);
void onClipboardChanged(std::string_view _type, std::string_view _data);
void onClipboardRequested(std::string_view _type, std::string& _data);

void createTextures();
void createCursors();
Expand Down
1 change: 1 addition & 0 deletions components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ add_component_dir (debug
debugging debuglog gldebug debugdraw writeflags
)

add_definitions(-DMYGUI_DONT_USE_OBSOLETE=ON)
IF(NOT WIN32 AND NOT APPLE)
add_definitions(-DGLOBAL_DATA_PATH="${GLOBAL_DATA_PATH}")
add_definitions(-DGLOBAL_CONFIG_PATH="${GLOBAL_CONFIG_PATH}")
Expand Down
6 changes: 3 additions & 3 deletions components/fontloader/fontloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace
MyGUI::xml::ElementPtr sizeProperty = getProperty(layersIterator.current(), "Size");
if (sizeProperty != nullptr)
{
std::string sizeValue = sizeProperty->findAttribute("value");
auto sizeValue = sizeProperty->findAttribute("value");
if (!sizeValue.empty())
return MyGUI::IntSize::parse(sizeValue);
}
Expand Down Expand Up @@ -608,13 +608,13 @@ namespace Gui
MyGUI::ResourceManager::getInstance().addResource(bookFont);
}

void FontLoader::overrideLineHeight(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version)
void FontLoader::overrideLineHeight(MyGUI::xml::ElementPtr _node, std::string_view _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"))
{
std::string type = resourceNode->findAttribute("type");
auto type = resourceNode->findAttribute("type");

if (Misc::StringUtils::ciEqual(type, "ResourceLayout"))
{
Expand Down
2 changes: 1 addition & 1 deletion components/fontloader/fontloader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Gui
public:
FontLoader(ToUTF8::FromType encoding, const VFS::Manager* vfs, float scalingFactor);

void overrideLineHeight(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version);
void overrideLineHeight(MyGUI::xml::ElementPtr _node, std::string_view _file, MyGUI::Version _version);

static std::string_view getFontForFace(std::string_view face);

Expand Down
4 changes: 0 additions & 4 deletions components/lua_ui/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@ namespace LuaUi
w->eventMouseButtonPressed.clear();
w->eventMouseButtonReleased.clear();
w->eventMouseMove.clear();
#if MYGUI_VERSION <= MYGUI_DEFINE_VERSION(3, 4, 2)
w->eventMouseDrag.m_event.clear();
#else
w->eventMouseDrag.clear();
#endif

w->eventMouseSetFocus.clear();
w->eventMouseLostFocus.clear();
Expand Down
4 changes: 0 additions & 4 deletions components/lua_ui/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ namespace LuaUi
for (auto& [w, _] : mActionWidgets)
{
w->eventMouseButtonPressed.clear();
#if MYGUI_VERSION <= MYGUI_DEFINE_VERSION(3, 4, 2)
w->eventMouseDrag.m_event.clear();
#else
w->eventMouseDrag.clear();
#endif
}
mActionWidgets.clear();

Expand Down
13 changes: 4 additions & 9 deletions components/myguiplatform/myguidatamanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,17 @@ namespace osgMyGUI
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;
result.clear();

if (name.empty())
{
result = Files::pathToUnicodeString(mResourcePath);
return result;
return Files::pathToUnicodeString(mResourcePath);
}

if (!isDataExist(name))
return result;
return {};

result = Files::pathToUnicodeString(mResourcePath / name);
return result;
return Files::pathToUnicodeString(mResourcePath / name);
}

}
2 changes: 1 addition & 1 deletion components/myguiplatform/myguidatamanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace osgMyGUI
@param _name Resource name.
@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:
std::filesystem::path mResourcePath;
Expand Down
Loading

0 comments on commit 6a87ba8

Please sign in to comment.