From 94b2bde48adf3b3e4e29209057c3d70409f93b6d Mon Sep 17 00:00:00 2001 From: uramer Date: Thu, 16 Dec 2021 16:52:39 +0100 Subject: [PATCH 1/3] Raise required MyGUI version to 3.4.1 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 090e6c56e3..67a8f7c679 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -399,7 +399,7 @@ set(Boost_NO_BOOST_CMAKE ON) find_package(Boost 1.6.2 REQUIRED COMPONENTS ${BOOST_COMPONENTS} OPTIONAL_COMPONENTS ${BOOST_OPTIONAL_COMPONENTS}) if(OPENMW_USE_SYSTEM_MYGUI) - find_package(MyGUI 3.2.2 REQUIRED) + find_package(MyGUI 3.4.1 REQUIRED) endif() find_package(SDL2 2.0.9 REQUIRED) find_package(OpenAL REQUIRED) From 2bc81e47a6af08bef6008282621f7e36ec4da877 Mon Sep 17 00:00:00 2001 From: uramer Date: Thu, 16 Dec 2021 19:22:07 +0100 Subject: [PATCH 2/3] Remove all MyGUI version checks --- apps/openmw/mwgui/bookpage.cpp | 6 ----- apps/openmw/mwgui/keyboardnavigation.cpp | 27 ------------------- .../myguiplatform/myguirendermanager.cpp | 2 -- .../myguiplatform/myguirendermanager.hpp | 8 ------ components/myguiplatform/myguitexture.cpp | 2 -- components/myguiplatform/myguitexture.hpp | 23 +++++----------- 6 files changed, 7 insertions(+), 61 deletions(-) diff --git a/apps/openmw/mwgui/bookpage.cpp b/apps/openmw/mwgui/bookpage.cpp index b2d2c39fd6..acaee7de28 100644 --- a/apps/openmw/mwgui/bookpage.cpp +++ b/apps/openmw/mwgui/bookpage.cpp @@ -907,12 +907,6 @@ protected: return {}; MyGUI::IntPoint pos (left, top); -#if MYGUI_VERSION < MYGUI_DEFINE_VERSION(3,2,3) - // work around inconsistency in MyGUI where the mouse press coordinates aren't - // transformed by the current Layer (even though mouse *move* events are). - if(!move) - pos = mNode->getLayer()->getPosition(left, top); -#endif pos.left -= mCroppedParent->getAbsoluteLeft (); pos.top -= mCroppedParent->getAbsoluteTop (); pos.top += mViewTop; diff --git a/apps/openmw/mwgui/keyboardnavigation.cpp b/apps/openmw/mwgui/keyboardnavigation.cpp index b4437873c3..249e5d0240 100644 --- a/apps/openmw/mwgui/keyboardnavigation.cpp +++ b/apps/openmw/mwgui/keyboardnavigation.cpp @@ -93,19 +93,6 @@ void KeyboardNavigation::_unlinkWidget(MyGUI::Widget *widget) mCurrentFocus = nullptr; } -#if MYGUI_VERSION < MYGUI_DEFINE_VERSION(3,2,3) -void styleFocusedButton(MyGUI::Widget* w) -{ - if (w) - { - if (MyGUI::Button* b = w->castType(false)) - { - b->_setWidgetState("highlighted"); - } - } -} -#endif - bool isRootParent(MyGUI::Widget* widget, MyGUI::Widget* root) { while (widget && widget->getParent()) @@ -128,9 +115,6 @@ void KeyboardNavigation::onFrame() if (focus == mCurrentFocus) { -#if MYGUI_VERSION < MYGUI_DEFINE_VERSION(3,2,3) - styleFocusedButton(mCurrentFocus); -#endif return; } @@ -143,19 +127,8 @@ void KeyboardNavigation::onFrame() if (focus != mCurrentFocus) { -#if MYGUI_VERSION < MYGUI_DEFINE_VERSION(3,2,3) - if (mCurrentFocus) - { - if (MyGUI::Button* b = mCurrentFocus->castType(false)) - b->_setWidgetState("normal"); - } -#endif mCurrentFocus = focus; } - -#if MYGUI_VERSION < MYGUI_DEFINE_VERSION(3,2,3) - styleFocusedButton(mCurrentFocus); -#endif } void KeyboardNavigation::setDefaultFocus(MyGUI::Widget *window, MyGUI::Widget *defaultFocus) diff --git a/components/myguiplatform/myguirendermanager.cpp b/components/myguiplatform/myguirendermanager.cpp index 43b176c795..7fb82bbce5 100644 --- a/components/myguiplatform/myguirendermanager.cpp +++ b/components/myguiplatform/myguirendermanager.cpp @@ -586,7 +586,6 @@ bool RenderManager::checkTexture(MyGUI::ITexture* _texture) return true; } -#if MYGUI_VERSION > MYGUI_DEFINE_VERSION(3, 4, 0) void RenderManager::registerShader( const std::string& _shaderName, const std::string& _vertexProgramFile, @@ -594,6 +593,5 @@ void RenderManager::registerShader( { MYGUI_PLATFORM_LOG(Warning, "osgMyGUI::RenderManager::registerShader is not implemented"); } -#endif } diff --git a/components/myguiplatform/myguirendermanager.hpp b/components/myguiplatform/myguirendermanager.hpp index 8ef9691e4f..bfb3da605a 100644 --- a/components/myguiplatform/myguirendermanager.hpp +++ b/components/myguiplatform/myguirendermanager.hpp @@ -116,17 +116,9 @@ public: bool checkTexture(MyGUI::ITexture* _texture); - // setViewSize() is a part of MyGUI::RenderManager interface since 3.4.0 release -#if MYGUI_VERSION < MYGUI_DEFINE_VERSION(3, 4, 0) - void setViewSize(int width, int height); -#else void setViewSize(int width, int height) override; -#endif - // registerShader() is a part of MyGUI::RenderManager interface since 3.4.1 release -#if MYGUI_VERSION > MYGUI_DEFINE_VERSION(3, 4, 0) void registerShader(const std::string& _shaderName, const std::string& _vertexProgramFile, const std::string& _fragmentProgramFile) override; -#endif /*internal:*/ diff --git a/components/myguiplatform/myguitexture.cpp b/components/myguiplatform/myguitexture.cpp index d0e4e9a86e..d120cb52f3 100644 --- a/components/myguiplatform/myguitexture.cpp +++ b/components/myguiplatform/myguitexture.cpp @@ -165,8 +165,6 @@ namespace osgMyGUI return nullptr; } -#if MYGUI_VERSION > MYGUI_DEFINE_VERSION(3, 4, 0) void OSGTexture::setShader(const std::string& _shaderName) { Log(Debug::Warning) << "OSGTexture::setShader is not implemented"; } -#endif } diff --git a/components/myguiplatform/myguitexture.hpp b/components/myguiplatform/myguitexture.hpp index e8b49eab04..4f7ff8f116 100644 --- a/components/myguiplatform/myguitexture.hpp +++ b/components/myguiplatform/myguitexture.hpp @@ -5,12 +5,6 @@ #include -#if MYGUI_VERSION > MYGUI_DEFINE_VERSION(3, 4, 0) - #define OPENMW_MYGUI_CONST_GETTER_3_4_1 const -#else - #define OPENMW_MYGUI_CONST_GETTER_3_4_1 -#endif - namespace osg { class Image; @@ -57,21 +51,18 @@ namespace osgMyGUI void* lock(MyGUI::TextureUsage access) override; void unlock() override; - bool isLocked() OPENMW_MYGUI_CONST_GETTER_3_4_1 override { return mLockedImage.valid(); } + bool isLocked() const override { return mLockedImage.valid(); } - int getWidth() OPENMW_MYGUI_CONST_GETTER_3_4_1 override { return mWidth; } - int getHeight() OPENMW_MYGUI_CONST_GETTER_3_4_1 override { return mHeight; } + int getWidth() const override { return mWidth; } + int getHeight() const override { return mHeight; } - MyGUI::PixelFormat getFormat() OPENMW_MYGUI_CONST_GETTER_3_4_1 override { return mFormat; } - MyGUI::TextureUsage getUsage() OPENMW_MYGUI_CONST_GETTER_3_4_1 override { return mUsage; } - size_t getNumElemBytes() OPENMW_MYGUI_CONST_GETTER_3_4_1 override { return mNumElemBytes; } + MyGUI::PixelFormat getFormat() const override { return mFormat; } + MyGUI::TextureUsage getUsage() const override { return mUsage; } + size_t getNumElemBytes() const override { return mNumElemBytes; } MyGUI::IRenderTarget *getRenderTarget() override; - // setShader() is a part of MyGUI::RenderManager interface since 3.4.1 release -#if MYGUI_VERSION > MYGUI_DEFINE_VERSION(3, 4, 0) - void setShader(const std::string& _shaderName) override; -#endif + void setShader(const std::string& _shaderName) override; /*internal:*/ osg::Texture2D *getTexture() const { return mTexture.get(); } From 3f52ede9cbae3153bc0827c3b4e478135c71fa4f Mon Sep 17 00:00:00 2001 From: uramer Date: Thu, 16 Dec 2021 19:48:10 +0100 Subject: [PATCH 3/3] Remove unnecessary myguicompat --- components/myguiplatform/myguicompat.h | 12 ------------ components/myguiplatform/myguidatamanager.cpp | 8 ++++---- components/myguiplatform/myguidatamanager.hpp | 10 ++++------ components/myguiplatform/myguirendermanager.cpp | 5 ++--- components/myguiplatform/myguirendermanager.hpp | 6 ++---- components/myguiplatform/scalinglayer.cpp | 4 +--- 6 files changed, 13 insertions(+), 32 deletions(-) delete mode 100644 components/myguiplatform/myguicompat.h diff --git a/components/myguiplatform/myguicompat.h b/components/myguiplatform/myguicompat.h deleted file mode 100644 index 04ca11a79f..0000000000 --- a/components/myguiplatform/myguicompat.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUICOMPAT_H -#define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUICOMPAT_H - -#include - -#if MYGUI_VERSION > MYGUI_DEFINE_VERSION(3, 4, 0) - #define OPENMW_MYGUI_CONST_GETTER_3_4_1 const -#else - #define OPENMW_MYGUI_CONST_GETTER_3_4_1 -#endif - -#endif // OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUICOMPAT_H diff --git a/components/myguiplatform/myguidatamanager.cpp b/components/myguiplatform/myguidatamanager.cpp index 0310e996b9..fc5d2bf953 100644 --- a/components/myguiplatform/myguidatamanager.cpp +++ b/components/myguiplatform/myguidatamanager.cpp @@ -15,7 +15,7 @@ void DataManager::setResourcePath(const std::string &path) mResourcePath = path; } -MyGUI::IDataStream *DataManager::getData(const std::string &name) OPENMW_MYGUI_CONST_GETTER_3_4_1 +MyGUI::IDataStream *DataManager::getData(const std::string &name) const { std::string fullpath = getDataPath(name); std::unique_ptr stream; @@ -34,13 +34,13 @@ void DataManager::freeData(MyGUI::IDataStream *data) delete data; } -bool DataManager::isDataExist(const std::string &name) OPENMW_MYGUI_CONST_GETTER_3_4_1 +bool DataManager::isDataExist(const std::string &name) const { std::string fullpath = mResourcePath + "/" + name; return boost::filesystem::exists(fullpath); } -const MyGUI::VectorString &DataManager::getDataListNames(const std::string &pattern) OPENMW_MYGUI_CONST_GETTER_3_4_1 +const MyGUI::VectorString &DataManager::getDataListNames(const std::string &pattern) const { // TODO: pattern matching (unused?) static MyGUI::VectorString strings; @@ -49,7 +49,7 @@ const MyGUI::VectorString &DataManager::getDataListNames(const std::string &patt return strings; } -const std::string &DataManager::getDataPath(const std::string &name) OPENMW_MYGUI_CONST_GETTER_3_4_1 +const std::string &DataManager::getDataPath(const std::string &name) const { static std::string result; result.clear(); diff --git a/components/myguiplatform/myguidatamanager.hpp b/components/myguiplatform/myguidatamanager.hpp index ca2f94899c..da24763d7b 100644 --- a/components/myguiplatform/myguidatamanager.hpp +++ b/components/myguiplatform/myguidatamanager.hpp @@ -3,8 +3,6 @@ #include -#include "myguicompat.h" - namespace osgMyGUI { @@ -19,7 +17,7 @@ public: /** Get data stream from specified resource name. @param _name Resource name (usually file name). */ - MyGUI::IDataStream* getData(const std::string& _name) OPENMW_MYGUI_CONST_GETTER_3_4_1 override; + MyGUI::IDataStream* getData(const std::string& _name) const override; /** Free data stream. @param _data Data stream. @@ -29,18 +27,18 @@ public: /** Is data with specified name exist. @param _name Resource name. */ - bool isDataExist(const std::string& _name) OPENMW_MYGUI_CONST_GETTER_3_4_1 override; + bool isDataExist(const std::string& _name) const override; /** Get all data names with names that matches pattern. @param _pattern Pattern to match (for example "*.layout"). */ - const MyGUI::VectorString& getDataListNames(const std::string& _pattern) OPENMW_MYGUI_CONST_GETTER_3_4_1 override; + const MyGUI::VectorString& getDataListNames(const std::string& _pattern) const override; /** Get full path to data. @param _name Resource name. @return Return full path to specified data. */ - const std::string& getDataPath(const std::string& _name) OPENMW_MYGUI_CONST_GETTER_3_4_1 override; + const std::string& getDataPath(const std::string& _name) const override; private: std::string mResourcePath; diff --git a/components/myguiplatform/myguirendermanager.cpp b/components/myguiplatform/myguirendermanager.cpp index 7fb82bbce5..b8ca06a181 100644 --- a/components/myguiplatform/myguirendermanager.cpp +++ b/components/myguiplatform/myguirendermanager.cpp @@ -15,7 +15,6 @@ #include #include -#include "myguicompat.h" #include "myguitexture.hpp" #define MYGUI_PLATFORM_LOG_SECTION "Platform" @@ -276,7 +275,7 @@ public: osg::VertexBufferObject* getVertexBuffer(); void setVertexCount(size_t count) override; - size_t getVertexCount() OPENMW_MYGUI_CONST_GETTER_3_4_1 override; + size_t getVertexCount() const override; MyGUI::Vertex *lock() override; void unlock() override; @@ -303,7 +302,7 @@ void OSGVertexBuffer::setVertexCount(size_t count) mNeedVertexCount = count; } -size_t OSGVertexBuffer::getVertexCount() OPENMW_MYGUI_CONST_GETTER_3_4_1 +size_t OSGVertexBuffer::getVertexCount() const { return mNeedVertexCount; } diff --git a/components/myguiplatform/myguirendermanager.hpp b/components/myguiplatform/myguirendermanager.hpp index bfb3da605a..0d1ad4fb41 100644 --- a/components/myguiplatform/myguirendermanager.hpp +++ b/components/myguiplatform/myguirendermanager.hpp @@ -5,8 +5,6 @@ #include -#include "myguicompat.h" - namespace Resource { class ImageManager; @@ -79,7 +77,7 @@ public: const MyGUI::IntSize& getViewSize() const override { return mViewSize; } /** @see RenderManager::getVertexFormat */ - MyGUI::VertexColourType getVertexFormat() OPENMW_MYGUI_CONST_GETTER_3_4_1 override + MyGUI::VertexColourType getVertexFormat() const override { return mVertexFormat; } /** @see RenderManager::isFormatSupported */ @@ -112,7 +110,7 @@ public: void setInjectState(osg::StateSet* stateSet); /** @see IRenderTarget::getInfo */ - const MyGUI::RenderTargetInfo& getInfo() OPENMW_MYGUI_CONST_GETTER_3_4_1 override { return mInfo; } + const MyGUI::RenderTargetInfo& getInfo() const override { return mInfo; } bool checkTexture(MyGUI::ITexture* _texture); diff --git a/components/myguiplatform/scalinglayer.cpp b/components/myguiplatform/scalinglayer.cpp index 51c148253f..75a149c810 100644 --- a/components/myguiplatform/scalinglayer.cpp +++ b/components/myguiplatform/scalinglayer.cpp @@ -3,8 +3,6 @@ #include #include -#include "myguicompat.h" - namespace osgMyGUI { @@ -39,7 +37,7 @@ namespace osgMyGUI mTarget->doRender(_buffer, _texture, _count); } - const MyGUI::RenderTargetInfo& getInfo() OPENMW_MYGUI_CONST_GETTER_3_4_1 override + const MyGUI::RenderTargetInfo& getInfo() const override { mInfo = mTarget->getInfo(); mInfo.hOffset = mHOffset;