mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Apply clang-format to code base
This commit is contained in:
parent
f37d0be806
commit
ddb0522bbf
2199 changed files with 118692 additions and 114392 deletions
|
@ -5,7 +5,8 @@
|
|||
namespace
|
||||
{
|
||||
template <class T, class WidgetT>
|
||||
void createVectorWidget(const std::shared_ptr<fx::Types::UniformBase>& uniform, MyGUI::Widget* client, fx::Widgets::UniformBase* base)
|
||||
void createVectorWidget(
|
||||
const std::shared_ptr<fx::Types::UniformBase>& uniform, MyGUI::Widget* client, fx::Widgets::UniformBase* base)
|
||||
{
|
||||
int height = client->getHeight();
|
||||
base->setSize(base->getSize().width, (base->getSize().height - height) + (height * T::num_components));
|
||||
|
@ -13,7 +14,8 @@ namespace
|
|||
|
||||
for (int i = 0; i < T::num_components; ++i)
|
||||
{
|
||||
auto* widget = client->createWidget<WidgetT>("MW_ValueEditNumber", {0, height * i, client->getWidth(), height}, MyGUI::Align::Default);
|
||||
auto* widget = client->createWidget<WidgetT>(
|
||||
"MW_ValueEditNumber", { 0, height * i, client->getWidth(), height }, MyGUI::Align::Default);
|
||||
widget->setData(uniform, static_cast<fx::Widgets::Index>(i));
|
||||
base->addItem(widget);
|
||||
}
|
||||
|
@ -67,7 +69,6 @@ namespace fx
|
|||
mCheckbutton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditBool::notifyMouseButtonClick);
|
||||
}
|
||||
|
||||
|
||||
void EditBool::notifyMouseButtonClick(MyGUI::Widget* sender)
|
||||
{
|
||||
auto uniform = mUniform.lock();
|
||||
|
@ -96,46 +97,50 @@ namespace fx
|
|||
mLabel->setUserString("Caption_Text", uniform->mDescription);
|
||||
}
|
||||
|
||||
std::visit([this, &uniform](auto&& arg) {
|
||||
using T = typename std::decay_t<decltype(arg)>::value_type;
|
||||
std::visit(
|
||||
[this, &uniform](auto&& arg) {
|
||||
using T = typename std::decay_t<decltype(arg)>::value_type;
|
||||
|
||||
if constexpr (std::is_same_v<osg::Vec4f, T>)
|
||||
{
|
||||
createVectorWidget<T, EditNumberFloat4>(uniform, mClient, this);
|
||||
}
|
||||
else if constexpr (std::is_same_v<osg::Vec3f, T>)
|
||||
{
|
||||
createVectorWidget<T, EditNumberFloat3>(uniform, mClient, this);
|
||||
}
|
||||
else if constexpr (std::is_same_v<osg::Vec2f, T>)
|
||||
{
|
||||
createVectorWidget<T, EditNumberFloat2>(uniform, mClient, this);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, float>)
|
||||
{
|
||||
auto* widget = mClient->createWidget<EditNumberFloat>("MW_ValueEditNumber", {0, 0, mClient->getWidth(), mClient->getHeight()}, MyGUI::Align::Stretch);
|
||||
widget->setData(uniform);
|
||||
mBases.emplace_back(widget);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, int>)
|
||||
{
|
||||
auto* widget = mClient->createWidget<EditNumberInt>("MW_ValueEditNumber", {0, 0, mClient->getWidth(), mClient->getHeight()}, MyGUI::Align::Stretch);
|
||||
widget->setData(uniform);
|
||||
mBases.emplace_back(widget);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, bool>)
|
||||
{
|
||||
auto* widget = mClient->createWidget<EditBool>("MW_ValueEditBool", {0, 0, mClient->getWidth(), mClient->getHeight()}, MyGUI::Align::Stretch);
|
||||
widget->setData(uniform);
|
||||
mBases.emplace_back(widget);
|
||||
}
|
||||
if constexpr (std::is_same_v<osg::Vec4f, T>)
|
||||
{
|
||||
createVectorWidget<T, EditNumberFloat4>(uniform, mClient, this);
|
||||
}
|
||||
else if constexpr (std::is_same_v<osg::Vec3f, T>)
|
||||
{
|
||||
createVectorWidget<T, EditNumberFloat3>(uniform, mClient, this);
|
||||
}
|
||||
else if constexpr (std::is_same_v<osg::Vec2f, T>)
|
||||
{
|
||||
createVectorWidget<T, EditNumberFloat2>(uniform, mClient, this);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, float>)
|
||||
{
|
||||
auto* widget = mClient->createWidget<EditNumberFloat>("MW_ValueEditNumber",
|
||||
{ 0, 0, mClient->getWidth(), mClient->getHeight() }, MyGUI::Align::Stretch);
|
||||
widget->setData(uniform);
|
||||
mBases.emplace_back(widget);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, int>)
|
||||
{
|
||||
auto* widget = mClient->createWidget<EditNumberInt>("MW_ValueEditNumber",
|
||||
{ 0, 0, mClient->getWidth(), mClient->getHeight() }, MyGUI::Align::Stretch);
|
||||
widget->setData(uniform);
|
||||
mBases.emplace_back(widget);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, bool>)
|
||||
{
|
||||
auto* widget = mClient->createWidget<EditBool>("MW_ValueEditBool",
|
||||
{ 0, 0, mClient->getWidth(), mClient->getHeight() }, MyGUI::Align::Stretch);
|
||||
widget->setData(uniform);
|
||||
mBases.emplace_back(widget);
|
||||
}
|
||||
|
||||
mReset->eventMouseButtonClick += MyGUI::newDelegate(this, &UniformBase::notifyResetClicked);
|
||||
mReset->eventMouseButtonClick += MyGUI::newDelegate(this, &UniformBase::notifyResetClicked);
|
||||
|
||||
for (EditBase* base : mBases)
|
||||
base->setValueFromUniform();
|
||||
|
||||
}, uniform->mData);
|
||||
for (EditBase* base : mBases)
|
||||
base->setValueFromUniform();
|
||||
},
|
||||
uniform->mData);
|
||||
}
|
||||
|
||||
void UniformBase::addItem(EditBase* item)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue