mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
additional cleanup
This commit is contained in:
parent
1df448f59b
commit
e97b07b6a4
14 changed files with 19 additions and 89 deletions
|
@ -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})
|
find_package(Boost 1.6.2 REQUIRED COMPONENTS ${BOOST_COMPONENTS} OPTIONAL_COMPONENTS ${BOOST_OPTIONAL_COMPONENTS})
|
||||||
|
|
||||||
if(OPENMW_USE_SYSTEM_MYGUI)
|
if(OPENMW_USE_SYSTEM_MYGUI)
|
||||||
find_package(MyGUI 3.4.2 REQUIRED)
|
find_package(MyGUI 3.4.3 REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
find_package(SDL2 2.0.9 REQUIRED)
|
find_package(SDL2 2.0.9 REQUIRED)
|
||||||
find_package(OpenAL REQUIRED)
|
find_package(OpenAL REQUIRED)
|
||||||
|
|
|
@ -475,7 +475,7 @@ namespace MWGui::Formatting
|
||||||
: GraphicElement(parent, pag, blockStyle)
|
: GraphicElement(parent, pag, blockStyle)
|
||||||
, mTextStyle(textStyle)
|
, 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,
|
MyGUI::IntCoord(0, pag.getCurrentTop(), pag.getPageWidth(), 0), MyGUI::Align::Left | MyGUI::Align::Top,
|
||||||
parent->getName() + MyGUI::utility::toString(parent->getChildCount()));
|
parent->getName() + MyGUI::utility::toString(parent->getChildCount()));
|
||||||
box->setEditStatic(true);
|
box->setEditStatic(true);
|
||||||
|
|
|
@ -161,7 +161,7 @@ namespace MWGui
|
||||||
private:
|
private:
|
||||||
int currentFontHeight() const;
|
int currentFontHeight() const;
|
||||||
TextStyle mTextStyle;
|
TextStyle mTextStyle;
|
||||||
Gui::EditBox* mEditBox;
|
MyGUI::EditBox* mEditBox;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ImageElement : public GraphicElement
|
class ImageElement : public GraphicElement
|
||||||
|
|
|
@ -238,7 +238,7 @@ namespace MWGui
|
||||||
mLines.emplace_back(separator, (MyGUI::Widget*)nullptr, NoSpellIndex);
|
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);
|
MyGUI::IntCoord(0, 0, mScrollView->getWidth(), 24), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||||
groupWidget->setCaptionWithReplacing(label);
|
groupWidget->setCaptionWithReplacing(label);
|
||||||
groupWidget->setTextAlign(MyGUI::Align::Left);
|
groupWidget->setTextAlign(MyGUI::Align::Left);
|
||||||
|
@ -246,7 +246,7 @@ namespace MWGui
|
||||||
|
|
||||||
if (!label2.empty())
|
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);
|
MyGUI::IntCoord(0, 0, mScrollView->getWidth(), 24), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||||
groupWidget2->setCaptionWithReplacing(label2);
|
groupWidget2->setCaptionWithReplacing(label2);
|
||||||
groupWidget2->setTextAlign(MyGUI::Align::Right);
|
groupWidget2->setTextAlign(MyGUI::Align::Right);
|
||||||
|
|
|
@ -443,7 +443,7 @@ namespace MWGui
|
||||||
const std::string realImage
|
const std::string realImage
|
||||||
= Misc::ResourceHelpers::correctIconPath(image, MWBase::Environment::get().getResourceSystem()->getVFS());
|
= 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");
|
"NormalText", MyGUI::IntCoord(0, 0, 300, 300), MyGUI::Align::Left | MyGUI::Align::Top, "ToolTipCaption");
|
||||||
captionWidget->setEditStatic(true);
|
captionWidget->setEditStatic(true);
|
||||||
captionWidget->setNeedKeyFocus(false);
|
captionWidget->setNeedKeyFocus(false);
|
||||||
|
@ -452,7 +452,7 @@ namespace MWGui
|
||||||
|
|
||||||
int captionHeight = std::max(!caption.empty() ? captionSize.height : 0, imageSize);
|
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::IntCoord(0, captionHeight + imageCaptionVPadding, 300, 300 - captionHeight - imageCaptionVPadding),
|
||||||
MyGUI::Align::Stretch, "ToolTipText");
|
MyGUI::Align::Stretch, "ToolTipText");
|
||||||
textWidget->setEditStatic(true);
|
textWidget->setEditStatic(true);
|
||||||
|
@ -474,7 +474,7 @@ namespace MWGui
|
||||||
MyGUI::ImageBox* icon = mDynamicToolTipBox->createWidget<MyGUI::ImageBox>("MarkerButton",
|
MyGUI::ImageBox* icon = mDynamicToolTipBox->createWidget<MyGUI::ImageBox>("MarkerButton",
|
||||||
MyGUI::IntCoord(padding.left, totalSize.height + padding.top, 8, 8), MyGUI::Align::Default);
|
MyGUI::IntCoord(padding.left, totalSize.height + padding.top, 8, 8), MyGUI::Align::Default);
|
||||||
icon->setColour(MyGUI::Colour(1.0f, 0.3f, 0.3f));
|
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,
|
MyGUI::IntCoord(padding.left + 8 + 4, totalSize.height + padding.top, 300 - padding.left - 8 - 4,
|
||||||
300 - totalSize.height),
|
300 - totalSize.height),
|
||||||
MyGUI::Align::Default);
|
MyGUI::Align::Default);
|
||||||
|
|
|
@ -73,11 +73,7 @@ namespace LuaUi
|
||||||
w->eventMouseButtonPressed.clear();
|
w->eventMouseButtonPressed.clear();
|
||||||
w->eventMouseButtonReleased.clear();
|
w->eventMouseButtonReleased.clear();
|
||||||
w->eventMouseMove.clear();
|
w->eventMouseMove.clear();
|
||||||
#if MYGUI_VERSION <= MYGUI_DEFINE_VERSION(3, 4, 2)
|
|
||||||
w->eventMouseDrag.m_event.clear();
|
|
||||||
#else
|
|
||||||
w->eventMouseDrag.clear();
|
w->eventMouseDrag.clear();
|
||||||
#endif
|
|
||||||
|
|
||||||
w->eventMouseSetFocus.clear();
|
w->eventMouseSetFocus.clear();
|
||||||
w->eventMouseLostFocus.clear();
|
w->eventMouseLostFocus.clear();
|
||||||
|
|
|
@ -16,11 +16,7 @@ namespace LuaUi
|
||||||
for (auto& [w, _] : mActionWidgets)
|
for (auto& [w, _] : mActionWidgets)
|
||||||
{
|
{
|
||||||
w->eventMouseButtonPressed.clear();
|
w->eventMouseButtonPressed.clear();
|
||||||
#if MYGUI_VERSION <= MYGUI_DEFINE_VERSION(3, 4, 2)
|
|
||||||
w->eventMouseDrag.m_event.clear();
|
|
||||||
#else
|
|
||||||
w->eventMouseDrag.clear();
|
w->eventMouseDrag.clear();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
mActionWidgets.clear();
|
mActionWidgets.clear();
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace Gui
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Gui::TextBox::setPropertyOverride(_key, _value);
|
TextBox::setPropertyOverride(_key, _value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ namespace Gui
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Gui::EditBox::setPropertyOverride(_key, _value);
|
EditBox::setPropertyOverride(_key, _value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ namespace Gui
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Gui::Button::setPropertyOverride(_key, _value);
|
Button::setPropertyOverride(_key, _value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,25 +7,9 @@
|
||||||
#include <MyGUI_TextBox.h>
|
#include <MyGUI_TextBox.h>
|
||||||
#include <MyGUI_Widget.h>
|
#include <MyGUI_Widget.h>
|
||||||
|
|
||||||
#include "fontwrapper.hpp"
|
|
||||||
|
|
||||||
namespace Gui
|
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
|
class AutoSizedWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -44,7 +28,7 @@ namespace Gui
|
||||||
MyGUI::Align mExpandDirection;
|
MyGUI::Align mExpandDirection;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AutoSizedTextBox : public AutoSizedWidget, public TextBox
|
class AutoSizedTextBox : public AutoSizedWidget, public MyGUI::TextBox
|
||||||
{
|
{
|
||||||
MYGUI_RTTI_DERIVED(AutoSizedTextBox)
|
MYGUI_RTTI_DERIVED(AutoSizedTextBox)
|
||||||
|
|
||||||
|
@ -57,7 +41,7 @@ namespace Gui
|
||||||
std::string mFontSize;
|
std::string mFontSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AutoSizedEditBox : public AutoSizedWidget, public EditBox
|
class AutoSizedEditBox : public AutoSizedWidget, public MyGUI::EditBox
|
||||||
{
|
{
|
||||||
MYGUI_RTTI_DERIVED(AutoSizedEditBox)
|
MYGUI_RTTI_DERIVED(AutoSizedEditBox)
|
||||||
|
|
||||||
|
@ -76,7 +60,7 @@ namespace Gui
|
||||||
int mMaxWidth = 0;
|
int mMaxWidth = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AutoSizedButton : public AutoSizedWidget, public Button
|
class AutoSizedButton : public AutoSizedWidget, public MyGUI::Button
|
||||||
{
|
{
|
||||||
MYGUI_RTTI_DERIVED(AutoSizedButton)
|
MYGUI_RTTI_DERIVED(AutoSizedButton)
|
||||||
|
|
||||||
|
@ -156,7 +140,7 @@ namespace Gui
|
||||||
void align() override;
|
void align() override;
|
||||||
MyGUI::IntSize getRequestedSize() override;
|
MyGUI::IntSize getRequestedSize() override;
|
||||||
|
|
||||||
void setPropertyOverride(std::string_view _key, std::string_view _value);
|
void setPropertyOverride(std::string_view _key, std::string_view _value) override;
|
||||||
|
|
||||||
void onWidgetCreated(MyGUI::Widget* _widget) 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
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include <MyGUI_EditBox.h>
|
#include <MyGUI_EditBox.h>
|
||||||
|
|
||||||
#include "fontwrapper.hpp"
|
|
||||||
|
|
||||||
namespace Gui
|
namespace Gui
|
||||||
{
|
{
|
||||||
|
@ -11,7 +10,7 @@ namespace Gui
|
||||||
/**
|
/**
|
||||||
* @brief A variant of the EditBox that only allows integer inputs
|
* @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)
|
MYGUI_RTTI_DERIVED(NumericEditBox)
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
#include <MyGUI_Button.h>
|
#include <MyGUI_Button.h>
|
||||||
|
|
||||||
#include "fontwrapper.hpp"
|
|
||||||
|
|
||||||
namespace Gui
|
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
|
/// @brief A button that applies its own state changes to other widgets, to do this you define it as part of a
|
||||||
/// ButtonGroup.
|
/// ButtonGroup.
|
||||||
class SharedStateButton final : public FontWrapper<MyGUI::Button>
|
class SharedStateButton final : public MyGUI::Button
|
||||||
{
|
{
|
||||||
MYGUI_RTTI_DERIVED(SharedStateButton)
|
MYGUI_RTTI_DERIVED(SharedStateButton)
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,9 @@ namespace Gui
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::HBox>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<Gui::HBox>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::Spacer>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<Gui::Spacer>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::VBox>("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::AutoSizedTextBox>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::AutoSizedEditBox>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<Gui::AutoSizedEditBox>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::AutoSizedButton>("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::ImageButton>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::NumericEditBox>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<Gui::NumericEditBox>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<Gui::SharedStateButton>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<Gui::SharedStateButton>("Widget");
|
||||||
|
|
4
extern/CMakeLists.txt
vendored
4
extern/CMakeLists.txt
vendored
|
@ -77,8 +77,8 @@ if(NOT OPENMW_USE_SYSTEM_MYGUI)
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
FetchContent_Declare(mygui
|
FetchContent_Declare(mygui
|
||||||
URL https://github.com/MyGUI/mygui/archive/refs/tags/MyGUI3.4.2.zip
|
URL https://github.com/MyGUI/mygui/archive/refs/tags/MyGUI3.4.3.zip
|
||||||
URL_HASH SHA512=d15de716102237ca55b952c2ab52f84b91766332a0357a50b17c20cf2f168666ddaab52d088d7bb8f713ad0fc27e19d74e6ae2673f310a8f60a3b5754f0a0ba7
|
URL_HASH SHA512=c804ef665e786076582367f171082cd2181fdbd214300ddcca4a4245c5a0f45e62e72778ee2d96ec46b393e22477dd729f9bb3006e6eecbf536674e34a057721
|
||||||
SOURCE_DIR fetched/mygui
|
SOURCE_DIR fetched/mygui
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailableExcludeFromAll(mygui)
|
FetchContent_MakeAvailableExcludeFromAll(mygui)
|
||||||
|
|
Loading…
Reference in a new issue