From 2bc81e47a6af08bef6008282621f7e36ec4da877 Mon Sep 17 00:00:00 2001 From: uramer Date: Thu, 16 Dec 2021 19:22:07 +0100 Subject: [PATCH] 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(); }