mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-21 09:39:56 +00:00
Merge branch 'mygui343_fix' into 'master'
Fix MyGUI 3.4.3 issues [#7528] See merge request OpenMW/openmw!3319
This commit is contained in:
commit
6a87ba8f33
@ -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
|
||||
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -161,7 +161,7 @@ namespace MWGui
|
||||
private:
|
||||
int currentFontHeight() const;
|
||||
TextStyle mTextStyle;
|
||||
Gui::EditBox* mEditBox;
|
||||
MyGUI::EditBox* mEditBox;
|
||||
};
|
||||
|
||||
class ImageElement : public GraphicElement
|
||||
|
@ -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;
|
||||
|
||||
@ -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");
|
||||
|
@ -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);
|
||||
@ -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);
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ 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);
|
||||
@ -246,7 +246,7 @@ namespace MWGui
|
||||
|
||||
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);
|
||||
|
@ -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}");
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
@ -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;
|
||||
@ -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);
|
||||
|
||||
|
@ -561,7 +561,7 @@ 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
|
||||
@ -569,8 +569,8 @@ namespace MWGui
|
||||
|
||||
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();
|
||||
|
@ -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}")
|
||||
|
@ -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);
|
||||
}
|
||||
@ -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"))
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -25,12 +25,12 @@ namespace osgMyGUI
|
||||
mStream.flush();
|
||||
}
|
||||
|
||||
void CustomLogListener::log(const std::string& _section, MyGUI::LogLevel _level, const struct tm* _time,
|
||||
const std::string& _message, const char* _file, int _line)
|
||||
void CustomLogListener::log(std::string_view _section, MyGUI::LogLevel _level, const struct tm* _time,
|
||||
std::string_view _message, std::string_view _file, int _line)
|
||||
{
|
||||
if (mStream.is_open())
|
||||
{
|
||||
const char* separator = " | ";
|
||||
std::string_view separator = " | ";
|
||||
mStream << std::setw(2) << std::setfill('0') << _time->tm_hour << ":" << std::setw(2) << std::setfill('0')
|
||||
<< _time->tm_min << ":" << std::setw(2) << std::setfill('0') << _time->tm_sec << separator
|
||||
<< _section << separator << _level.print() << separator << _message << separator << _file
|
||||
|
@ -30,8 +30,8 @@ namespace osgMyGUI
|
||||
void close() override;
|
||||
void flush() override;
|
||||
|
||||
void log(const std::string& _section, MyGUI::LogLevel _level, const struct tm* _time,
|
||||
const std::string& _message, const char* _file, int _line) override;
|
||||
void log(std::string_view _section, MyGUI::LogLevel _level, const struct tm* _time, std::string_view _message,
|
||||
std::string_view _file, int _line) override;
|
||||
|
||||
private:
|
||||
std::ofstream mStream;
|
||||
|
@ -66,31 +66,19 @@ namespace osgMyGUI
|
||||
|
||||
void enableShaders(Shader::ShaderManager& shaderManager);
|
||||
|
||||
void setScalingFactor(float factor);
|
||||
|
||||
static RenderManager& getInstance() { return *getInstancePtr(); }
|
||||
static RenderManager* getInstancePtr()
|
||||
{
|
||||
return static_cast<RenderManager*>(MyGUI::RenderManager::getInstancePtr());
|
||||
}
|
||||
|
||||
bool checkTexture(MyGUI::ITexture* _texture)
|
||||
#if MYGUI_DEBUG_MODE == 1 /* needed workaround for MyGUI 3.4.2 */
|
||||
override
|
||||
#endif
|
||||
;
|
||||
bool checkTexture(MyGUI::ITexture* _texture) override;
|
||||
|
||||
/** @see RenderManager::getViewSize */
|
||||
const MyGUI::IntSize& getViewSize() const override
|
||||
{
|
||||
return mViewSize;
|
||||
}
|
||||
const MyGUI::IntSize& getViewSize() const override { return mViewSize; }
|
||||
|
||||
/** @see RenderManager::getVertexFormat */
|
||||
MyGUI::VertexColourType getVertexFormat() const override
|
||||
{
|
||||
return mVertexFormat;
|
||||
}
|
||||
MyGUI::VertexColourType getVertexFormat() const override { return mVertexFormat; }
|
||||
|
||||
/** @see RenderManager::isFormatSupported */
|
||||
bool isFormatSupported(MyGUI::PixelFormat format, MyGUI::TextureUsage usage) override;
|
||||
@ -123,10 +111,7 @@ namespace osgMyGUI
|
||||
void setInjectState(osg::StateSet* stateSet);
|
||||
|
||||
/** @see IRenderTarget::getInfo */
|
||||
const MyGUI::RenderTargetInfo& getInfo() const override
|
||||
{
|
||||
return mInfo;
|
||||
}
|
||||
const MyGUI::RenderTargetInfo& getInfo() const override { return mInfo; }
|
||||
|
||||
void setViewSize(int width, int height) override;
|
||||
|
||||
|
@ -123,8 +123,8 @@ namespace osgMyGUI
|
||||
{
|
||||
if (info->getName() == "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 == "Size")
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ namespace Gui
|
||||
notifySizeChange(this);
|
||||
}
|
||||
|
||||
void AutoSizedTextBox::setPropertyOverride(const std::string& _key, const std::string& _value)
|
||||
void AutoSizedTextBox::setPropertyOverride(std::string_view _key, std::string_view _value)
|
||||
{
|
||||
if (_key == "ExpandDirection")
|
||||
{
|
||||
@ -48,7 +48,7 @@ namespace Gui
|
||||
}
|
||||
else
|
||||
{
|
||||
Gui::TextBox::setPropertyOverride(_key, _value);
|
||||
TextBox::setPropertyOverride(_key, _value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ namespace Gui
|
||||
setEditStatic(true);
|
||||
}
|
||||
|
||||
void AutoSizedEditBox::setPropertyOverride(const std::string& _key, const std::string& _value)
|
||||
void AutoSizedEditBox::setPropertyOverride(std::string_view _key, std::string_view _value)
|
||||
{
|
||||
if (_key == "ExpandDirection")
|
||||
{
|
||||
@ -115,7 +115,7 @@ namespace Gui
|
||||
}
|
||||
else
|
||||
{
|
||||
Gui::EditBox::setPropertyOverride(_key, _value);
|
||||
EditBox::setPropertyOverride(_key, _value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ namespace Gui
|
||||
notifySizeChange(this);
|
||||
}
|
||||
|
||||
void AutoSizedButton::setPropertyOverride(const std::string& _key, const std::string& _value)
|
||||
void AutoSizedButton::setPropertyOverride(std::string_view _key, std::string_view _value)
|
||||
{
|
||||
if (_key == "ExpandDirection")
|
||||
{
|
||||
@ -144,9 +144,10 @@ namespace Gui
|
||||
}
|
||||
else
|
||||
{
|
||||
Gui::Button::setPropertyOverride(_key, _value);
|
||||
Button::setPropertyOverride(_key, _value);
|
||||
}
|
||||
}
|
||||
|
||||
Box::Box()
|
||||
: mSpacing(4)
|
||||
, mPadding(0)
|
||||
@ -159,7 +160,7 @@ namespace Gui
|
||||
align();
|
||||
}
|
||||
|
||||
bool Box::_setPropertyImpl(const std::string& _key, const std::string& _value)
|
||||
bool Box::_setPropertyImpl(std::string_view _key, std::string_view _value)
|
||||
{
|
||||
if (_key == "Spacing")
|
||||
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, std::string_view _value)
|
||||
{
|
||||
if (!Box::_setPropertyImpl(_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, std::string_view _value)
|
||||
{
|
||||
if (!Box::_setPropertyImpl(_key, _value))
|
||||
MyGUI::Widget::setPropertyOverride(_key, _value);
|
||||
|
@ -7,25 +7,8 @@
|
||||
#include <MyGUI_TextBox.h>
|
||||
#include <MyGUI_Widget.h>
|
||||
|
||||
#include "fontwrapper.hpp"
|
||||
|
||||
namespace Gui
|
||||
{
|
||||
class Button : public FontWrapper<MyGUI::Button>
|
||||
{
|
||||
MYGUI_RTTI_DERIVED(Button)
|
||||
};
|
||||
|
||||
class TextBox : public FontWrapper<MyGUI::TextBox>
|
||||
{
|
||||
MYGUI_RTTI_DERIVED(TextBox)
|
||||
};
|
||||
|
||||
class EditBox : public FontWrapper<MyGUI::EditBox>
|
||||
{
|
||||
MYGUI_RTTI_DERIVED(EditBox)
|
||||
};
|
||||
|
||||
class AutoSizedWidget
|
||||
{
|
||||
public:
|
||||
@ -44,7 +27,7 @@ namespace Gui
|
||||
MyGUI::Align mExpandDirection;
|
||||
};
|
||||
|
||||
class AutoSizedTextBox : public AutoSizedWidget, public TextBox
|
||||
class AutoSizedTextBox : public AutoSizedWidget, public MyGUI::TextBox
|
||||
{
|
||||
MYGUI_RTTI_DERIVED(AutoSizedTextBox)
|
||||
|
||||
@ -53,11 +36,11 @@ namespace Gui
|
||||
void setCaption(const MyGUI::UString& _value) override;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
class AutoSizedEditBox : public AutoSizedWidget, public EditBox
|
||||
class AutoSizedEditBox : public AutoSizedWidget, public MyGUI::EditBox
|
||||
{
|
||||
MYGUI_RTTI_DERIVED(AutoSizedEditBox)
|
||||
|
||||
@ -68,7 +51,7 @@ namespace Gui
|
||||
void initialiseOverride() override;
|
||||
|
||||
protected:
|
||||
void setPropertyOverride(const std::string& _key, const std::string& _value) override;
|
||||
void setPropertyOverride(std::string_view _key, std::string_view _value) override;
|
||||
int getWidth();
|
||||
std::string mFontSize;
|
||||
bool mShrink = false;
|
||||
@ -76,7 +59,7 @@ namespace Gui
|
||||
int mMaxWidth = 0;
|
||||
};
|
||||
|
||||
class AutoSizedButton : public AutoSizedWidget, public Button
|
||||
class AutoSizedButton : public AutoSizedWidget, public MyGUI::Button
|
||||
{
|
||||
MYGUI_RTTI_DERIVED(AutoSizedButton)
|
||||
|
||||
@ -85,7 +68,7 @@ namespace Gui
|
||||
void setCaption(const MyGUI::UString& _value) override;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
@ -105,7 +88,7 @@ namespace Gui
|
||||
protected:
|
||||
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
|
||||
|
||||
@ -137,7 +120,7 @@ namespace Gui
|
||||
void align() 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;
|
||||
};
|
||||
@ -156,7 +139,7 @@ namespace Gui
|
||||
void align() 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;
|
||||
};
|
||||
|
@ -1,40 +0,0 @@
|
||||
#ifndef OPENMW_WIDGETS_WRAPPER_H
|
||||
#define OPENMW_WIDGETS_WRAPPER_H
|
||||
|
||||
#include <MyGUI_Prerequest.h>
|
||||
|
||||
#include "components/settings/values.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace Gui
|
||||
{
|
||||
template <class T>
|
||||
class FontWrapper : public T
|
||||
{
|
||||
#if MYGUI_VERSION <= MYGUI_DEFINE_VERSION(3, 4, 2)
|
||||
public:
|
||||
void setFontName(const std::string& name) override
|
||||
{
|
||||
T::setFontName(name);
|
||||
T::setPropertyOverride("FontHeight", std::to_string(Settings::gui().mFontSize));
|
||||
}
|
||||
|
||||
protected:
|
||||
void setPropertyOverride(const std::string& _key, const std::string& _value) override
|
||||
{
|
||||
T::setPropertyOverride(_key, _value);
|
||||
|
||||
// https://github.com/MyGUI/mygui/issues/113
|
||||
// There is a bug in MyGUI: when it initializes the FontName property, it reset the font height.
|
||||
// We should restore it.
|
||||
if (_key == "FontName")
|
||||
{
|
||||
T::setPropertyOverride("FontHeight", std::to_string(Settings::gui().mFontSize));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -34,7 +34,7 @@ namespace Gui
|
||||
updateImage();
|
||||
}
|
||||
|
||||
void ImageButton::setPropertyOverride(const std::string& _key, const std::string& _value)
|
||||
void ImageButton::setPropertyOverride(std::string_view _key, std::string_view _value)
|
||||
{
|
||||
if (_key == "ImageHighlighted")
|
||||
mImageHighlighted = _value;
|
||||
@ -56,6 +56,7 @@ namespace Gui
|
||||
else
|
||||
ImageBox::setPropertyOverride(_key, _value);
|
||||
}
|
||||
|
||||
void ImageButton::onMouseSetFocus(Widget* _old)
|
||||
{
|
||||
mMouseFocus = true;
|
||||
|
@ -32,7 +32,7 @@ namespace Gui
|
||||
static bool sDefaultNeedKeyFocus;
|
||||
|
||||
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 onMouseSetFocus(MyGUI::Widget* _old) override;
|
||||
void onMouseButtonPressed(int _left, int _top, MyGUI::MouseButton _id) override;
|
||||
|
@ -107,7 +107,7 @@ namespace Gui
|
||||
mScrollView->setViewOffset(MyGUI::IntPoint(0, -viewPosition));
|
||||
}
|
||||
|
||||
void MWList::setPropertyOverride(const std::string& _key, const std::string& _value)
|
||||
void MWList::setPropertyOverride(std::string_view _key, std::string_view _value)
|
||||
{
|
||||
if (_key == "ListItemSkin")
|
||||
mListItemSkin = _value;
|
||||
|
@ -49,7 +49,7 @@ namespace Gui
|
||||
|
||||
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:
|
||||
void initialiseOverride() override;
|
||||
|
@ -3,15 +3,13 @@
|
||||
|
||||
#include <MyGUI_EditBox.h>
|
||||
|
||||
#include "fontwrapper.hpp"
|
||||
|
||||
namespace Gui
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief A variant of the EditBox that only allows integer inputs
|
||||
*/
|
||||
class NumericEditBox final : public FontWrapper<MyGUI::EditBox>
|
||||
class NumericEditBox final : public MyGUI::EditBox
|
||||
{
|
||||
MYGUI_RTTI_DERIVED(NumericEditBox)
|
||||
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
#include <MyGUI_Button.h>
|
||||
|
||||
#include "fontwrapper.hpp"
|
||||
|
||||
namespace Gui
|
||||
{
|
||||
|
||||
@ -14,7 +12,7 @@ namespace Gui
|
||||
|
||||
/// @brief A button that applies its own state changes to other widgets, to do this you define it as part of a
|
||||
/// ButtonGroup.
|
||||
class SharedStateButton final : public FontWrapper<MyGUI::Button>
|
||||
class SharedStateButton final : public MyGUI::Button
|
||||
{
|
||||
MYGUI_RTTI_DERIVED(SharedStateButton)
|
||||
|
||||
|
@ -18,12 +18,9 @@ namespace Gui
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::HBox>("Widget");
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::Spacer>("Widget");
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::VBox>("Widget");
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::EditBox>("Widget");
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::TextBox>("Widget");
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::AutoSizedTextBox>("Widget");
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::AutoSizedEditBox>("Widget");
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::AutoSizedButton>("Widget");
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::Button>("Widget");
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::ImageButton>("Widget");
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::NumericEditBox>("Widget");
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::SharedStateButton>("Widget");
|
||||
|
5
extern/CMakeLists.txt
vendored
5
extern/CMakeLists.txt
vendored
@ -68,6 +68,7 @@ if(NOT OPENMW_USE_SYSTEM_MYGUI)
|
||||
set(MYGUI_BUILD_DEMOS OFF CACHE BOOL "")
|
||||
set(MYGUI_BUILD_PLUGINS OFF CACHE BOOL "")
|
||||
set(MYGUI_BUILD_TOOLS OFF CACHE BOOL "")
|
||||
set(MYGUI_DONT_USE_OBSOLETE ON CACHE BOOL "")
|
||||
|
||||
if(MYGUI_STATIC)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
||||
@ -77,8 +78,8 @@ if(NOT OPENMW_USE_SYSTEM_MYGUI)
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(mygui
|
||||
URL https://github.com/MyGUI/mygui/archive/refs/tags/MyGUI3.4.2.zip
|
||||
URL_HASH SHA512=d15de716102237ca55b952c2ab52f84b91766332a0357a50b17c20cf2f168666ddaab52d088d7bb8f713ad0fc27e19d74e6ae2673f310a8f60a3b5754f0a0ba7
|
||||
URL https://github.com/MyGUI/mygui/archive/refs/tags/MyGUI3.4.3.zip
|
||||
URL_HASH SHA512=c804ef665e786076582367f171082cd2181fdbd214300ddcca4a4245c5a0f45e62e72778ee2d96ec46b393e22477dd729f9bb3006e6eecbf536674e34a057721
|
||||
SOURCE_DIR fetched/mygui
|
||||
)
|
||||
FetchContent_MakeAvailableExcludeFromAll(mygui)
|
||||
|
Loading…
x
Reference in New Issue
Block a user