mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:53:53 +00:00
Merge branch 'settings_values_gui' into 'master'
Use settings values for GUI settings (#6876) See merge request OpenMW/openmw!3238
This commit is contained in:
commit
baa67893b6
34 changed files with 98 additions and 134 deletions
|
@ -225,12 +225,10 @@ namespace MWBase
|
||||||
virtual const MWWorld::Ptr& getSelectedEnchantItem() const = 0;
|
virtual const MWWorld::Ptr& getSelectedEnchantItem() const = 0;
|
||||||
virtual void setSelectedWeapon(const MWWorld::Ptr& item) = 0;
|
virtual void setSelectedWeapon(const MWWorld::Ptr& item) = 0;
|
||||||
virtual const MWWorld::Ptr& getSelectedWeapon() const = 0;
|
virtual const MWWorld::Ptr& getSelectedWeapon() const = 0;
|
||||||
virtual int getFontHeight() const = 0;
|
|
||||||
virtual void unsetSelectedSpell() = 0;
|
virtual void unsetSelectedSpell() = 0;
|
||||||
virtual void unsetSelectedWeapon() = 0;
|
virtual void unsetSelectedWeapon() = 0;
|
||||||
|
|
||||||
virtual void showCrosshair(bool show) = 0;
|
virtual void showCrosshair(bool show) = 0;
|
||||||
virtual bool getSubtitlesEnabled() = 0;
|
|
||||||
virtual bool toggleHud() = 0;
|
virtual bool toggleHud() = 0;
|
||||||
|
|
||||||
virtual void disallowMouse() = 0;
|
virtual void disallowMouse() = 0;
|
||||||
|
|
|
@ -647,7 +647,7 @@ namespace MWDialogue
|
||||||
if (info != nullptr)
|
if (info != nullptr)
|
||||||
{
|
{
|
||||||
MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
|
MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
|
||||||
if (winMgr->getSubtitlesEnabled())
|
if (Settings::gui().mSubtitles)
|
||||||
winMgr->messageBox(info->mResponse);
|
winMgr->messageBox(info->mResponse);
|
||||||
if (!info->mSound.empty())
|
if (!info->mSound.empty())
|
||||||
sndMgr->say(actor, info->mSound);
|
sndMgr->say(actor, info->mSound);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <components/esm3/loadspel.hpp>
|
#include <components/esm3/loadspel.hpp>
|
||||||
#include <components/misc/resourcehelpers.hpp>
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
#include <components/resource/resourcesystem.hpp>
|
#include <components/resource/resourcesystem.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
@ -188,7 +189,7 @@ namespace MWGui
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Widgets::MWSpellPtr spellWidget;
|
Widgets::MWSpellPtr spellWidget;
|
||||||
const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), lineHeight);
|
MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), lineHeight);
|
||||||
|
|
||||||
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
|
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include <components/misc/utf8stream.hpp>
|
#include <components/misc/utf8stream.hpp>
|
||||||
#include <components/sceneutil/depth.hpp>
|
#include <components/sceneutil/depth.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
@ -551,7 +552,7 @@ namespace MWGui
|
||||||
if (mPartialWhitespace.empty() && mPartialWord.empty())
|
if (mPartialWhitespace.empty() && mPartialWord.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int fontHeight = MWBase::Environment::get().getWindowManager()->getFontHeight();
|
const int fontHeight = Settings::gui().mFontSize;
|
||||||
int space_width = 0;
|
int space_width = 0;
|
||||||
int word_width = 0;
|
int word_width = 0;
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,7 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
|
||||||
#include "../mwbase/windowmanager.hpp"
|
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
@ -50,12 +47,10 @@ namespace MWGui
|
||||||
|
|
||||||
GlyphInfo(MyGUI::IFont* font, MyGUI::Char ch)
|
GlyphInfo(MyGUI::IFont* font, MyGUI::Char ch)
|
||||||
{
|
{
|
||||||
static const int fontHeight = MWBase::Environment::get().getWindowManager()->getFontHeight();
|
|
||||||
|
|
||||||
const MyGUI::GlyphInfo* gi = font->getGlyphInfo(ch);
|
const MyGUI::GlyphInfo* gi = font->getGlyphInfo(ch);
|
||||||
if (gi)
|
if (gi)
|
||||||
{
|
{
|
||||||
const float scale = font->getDefaultHeight() / (float)fontHeight;
|
const float scale = font->getDefaultHeight() / static_cast<float>(Settings::gui().mFontSize);
|
||||||
|
|
||||||
codePoint = gi->codePoint;
|
codePoint = gi->codePoint;
|
||||||
bearingX = (int)gi->bearingX / scale;
|
bearingX = (int)gi->bearingX / scale;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
#include <components/esm3/loadcrea.hpp>
|
#include <components/esm3/loadcrea.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
#include <components/translation/translation.hpp>
|
#include <components/translation/translation.hpp>
|
||||||
#include <components/widgets/box.hpp>
|
#include <components/widgets/box.hpp>
|
||||||
#include <components/widgets/list.hpp>
|
#include <components/widgets/list.hpp>
|
||||||
|
@ -88,7 +89,7 @@ namespace MWGui
|
||||||
|
|
||||||
void PersuasionDialog::adjustAction(MyGUI::Widget* action, int& totalHeight)
|
void PersuasionDialog::adjustAction(MyGUI::Widget* action, int& totalHeight)
|
||||||
{
|
{
|
||||||
const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
auto currentCoords = action->getCoord();
|
auto currentCoords = action->getCoord();
|
||||||
action->setCoord(currentCoords.left, totalHeight, currentCoords.width, lineHeight);
|
action->setCoord(currentCoords.left, totalHeight, currentCoords.width, lineHeight);
|
||||||
totalHeight += lineHeight;
|
totalHeight += lineHeight;
|
||||||
|
@ -782,21 +783,21 @@ namespace MWGui
|
||||||
|
|
||||||
void DialogueWindow::updateTopicFormat()
|
void DialogueWindow::updateTopicFormat()
|
||||||
{
|
{
|
||||||
if (!Settings::Manager::getBool("color topic enable", "GUI"))
|
if (!Settings::gui().mColorTopicEnable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const std::string& specialColour = Settings::Manager::getString("color topic specific", "GUI");
|
const MyGUI::Colour& specialColour = Settings::gui().mColorTopicSpecific;
|
||||||
const std::string& oldColour = Settings::Manager::getString("color topic exhausted", "GUI");
|
const MyGUI::Colour& oldColour = Settings::gui().mColorTopicExhausted;
|
||||||
|
|
||||||
for (const std::string& keyword : mKeywords)
|
for (const std::string& keyword : mKeywords)
|
||||||
{
|
{
|
||||||
int flag = MWBase::Environment::get().getDialogueManager()->getTopicFlag(ESM::RefId::stringRefId(keyword));
|
int flag = MWBase::Environment::get().getDialogueManager()->getTopicFlag(ESM::RefId::stringRefId(keyword));
|
||||||
MyGUI::Button* button = mTopicsList->getItemWidget(keyword);
|
MyGUI::Button* button = mTopicsList->getItemWidget(keyword);
|
||||||
|
|
||||||
if (!specialColour.empty() && flag & MWBase::DialogueManager::TopicType::Specific)
|
if (flag & MWBase::DialogueManager::TopicType::Specific)
|
||||||
button->getSubWidgetText()->setTextColour(MyGUI::Colour::parse(specialColour));
|
button->getSubWidgetText()->setTextColour(specialColour);
|
||||||
else if (!oldColour.empty() && flag & MWBase::DialogueManager::TopicType::Exhausted)
|
else if (flag & MWBase::DialogueManager::TopicType::Exhausted)
|
||||||
button->getSubWidgetText()->setTextColour(MyGUI::Colour::parse(oldColour));
|
button->getSubWidgetText()->setTextColour(oldColour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <components/misc/resourcehelpers.hpp>
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
#include <components/misc/strings/algorithm.hpp>
|
#include <components/misc/strings/algorithm.hpp>
|
||||||
#include <components/resource/resourcesystem.hpp>
|
#include <components/resource/resourcesystem.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
#include <components/vfs/manager.hpp>
|
#include <components/vfs/manager.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
|
||||||
#include "../mwscript/interpretercontext.hpp"
|
#include "../mwscript/interpretercontext.hpp"
|
||||||
|
|
||||||
namespace MWGui::Formatting
|
namespace MWGui::Formatting
|
||||||
|
@ -452,7 +452,7 @@ namespace MWGui::Formatting
|
||||||
int TextElement::pageSplit()
|
int TextElement::pageSplit()
|
||||||
{
|
{
|
||||||
// split lines
|
// split lines
|
||||||
const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight();
|
const int lineHeight = Settings::gui().mFontSize;
|
||||||
unsigned int lastLine = (mPaginator.getStartTop() + mPaginator.getPageHeight() - mPaginator.getCurrentTop());
|
unsigned int lastLine = (mPaginator.getStartTop() + mPaginator.getPageHeight() - mPaginator.getCurrentTop());
|
||||||
if (lineHeight > 0)
|
if (lineHeight > 0)
|
||||||
lastLine /= lineHeight;
|
lastLine /= lineHeight;
|
||||||
|
|
|
@ -6,13 +6,12 @@
|
||||||
#include <MyGUI_TextBox.h>
|
#include <MyGUI_TextBox.h>
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
// correctIconPath
|
|
||||||
#include <components/misc/resourcehelpers.hpp>
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
#include <components/resource/resourcesystem.hpp>
|
#include <components/resource/resourcesystem.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
#include <components/vfs/manager.hpp>
|
#include <components/vfs/manager.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
|
@ -20,13 +19,11 @@ namespace
|
||||||
{
|
{
|
||||||
std::string getCountString(int count)
|
std::string getCountString(int count)
|
||||||
{
|
{
|
||||||
static const int fontHeight = MWBase::Environment::get().getWindowManager()->getFontHeight();
|
|
||||||
|
|
||||||
if (count == 1)
|
if (count == 1)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
// With small text size we can use up to 4 characters, while with large ones - only up to 3.
|
// With small text size we can use up to 4 characters, while with large ones - only up to 3.
|
||||||
if (fontHeight > 16)
|
if (Settings::gui().mFontSize > 16)
|
||||||
{
|
{
|
||||||
if (count > 999999999)
|
if (count > 999999999)
|
||||||
return MyGUI::utility::toString(count / 1000000000) + "b";
|
return MyGUI::utility::toString(count / 1000000000) + "b";
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
#include <components/misc/utf8stream.hpp>
|
#include <components/misc/utf8stream.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include "textcolours.hpp"
|
#include "textcolours.hpp"
|
||||||
|
|
||||||
|
@ -274,13 +275,11 @@ namespace MWGui
|
||||||
|
|
||||||
BookTypesetter::Style* body = typesetter->createStyle({}, MyGUI::Colour::Black);
|
BookTypesetter::Style* body = typesetter->createStyle({}, MyGUI::Colour::Black);
|
||||||
|
|
||||||
int fontHeight = MWBase::Environment::get().getWindowManager()->getFontHeight();
|
|
||||||
|
|
||||||
// for small font size split alphabet to two columns (2x15 characers), for big font size split it to three
|
// for small font size split alphabet to two columns (2x15 characers), for big font size split it to three
|
||||||
// colums (3x10 characters).
|
// colums (3x10 characters).
|
||||||
int sectionBreak = 10;
|
int sectionBreak = 10;
|
||||||
mIndexPagesCount = 3;
|
mIndexPagesCount = 3;
|
||||||
if (fontHeight < 18)
|
if (Settings::gui().mFontSize < 18)
|
||||||
{
|
{
|
||||||
sectionBreak = 15;
|
sectionBreak = 15;
|
||||||
mIndexPagesCount = 2;
|
mIndexPagesCount = 2;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include <components/misc/rng.hpp>
|
#include <components/misc/rng.hpp>
|
||||||
#include <components/myguiplatform/myguitexture.hpp>
|
#include <components/myguiplatform/myguitexture.hpp>
|
||||||
#include <components/resource/resourcesystem.hpp>
|
#include <components/resource/resourcesystem.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/values.hpp>
|
||||||
#include <components/vfs/manager.hpp>
|
#include <components/vfs/manager.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
@ -222,9 +222,8 @@ namespace MWGui
|
||||||
// TODO: add option (filename pattern?) to use image aspect ratio instead of 4:3
|
// TODO: add option (filename pattern?) to use image aspect ratio instead of 4:3
|
||||||
// we can't do this by default, because the Morrowind splash screens are 1024x1024, but should be displayed
|
// we can't do this by default, because the Morrowind splash screens are 1024x1024, but should be displayed
|
||||||
// as 4:3
|
// as 4:3
|
||||||
bool stretch = Settings::Manager::getBool("stretch menu background", "GUI");
|
|
||||||
mSplashImage->setVisible(true);
|
mSplashImage->setVisible(true);
|
||||||
mSplashImage->setBackgroundImage(randomSplash, true, stretch);
|
mSplashImage->setBackgroundImage(randomSplash, true, Settings::gui().mStretchMenuBackground);
|
||||||
}
|
}
|
||||||
mSceneImage->setBackgroundImage({});
|
mSceneImage->setBackgroundImage({});
|
||||||
mSceneImage->setVisible(false);
|
mSceneImage->setVisible(false);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <MyGUI_RenderManager.h>
|
#include <MyGUI_RenderManager.h>
|
||||||
#include <MyGUI_TextBox.h>
|
#include <MyGUI_TextBox.h>
|
||||||
|
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/values.hpp>
|
||||||
#include <components/vfs/manager.hpp>
|
#include <components/vfs/manager.hpp>
|
||||||
#include <components/widgets/imagebutton.hpp>
|
#include <components/widgets/imagebutton.hpp>
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ namespace MWGui
|
||||||
if (!show)
|
if (!show)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool stretch = Settings::Manager::getBool("stretch menu background", "GUI");
|
const bool stretch = Settings::gui().mStretchMenuBackground;
|
||||||
|
|
||||||
if (mHasAnimatedMenu)
|
if (mHasAnimatedMenu)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "merchantrepair.hpp"
|
#include "merchantrepair.hpp"
|
||||||
|
|
||||||
#include <components/esm3/loadgmst.hpp>
|
#include <components/esm3/loadgmst.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include <MyGUI_Button.h>
|
#include <MyGUI_Button.h>
|
||||||
#include <MyGUI_Gui.h>
|
#include <MyGUI_Gui.h>
|
||||||
|
@ -36,7 +37,7 @@ namespace MWGui
|
||||||
while (mList->getChildCount())
|
while (mList->getChildCount())
|
||||||
MyGUI::Gui::getInstance().destroyWidget(mList->getChildAt(0));
|
MyGUI::Gui::getInstance().destroyWidget(mList->getChildAt(0));
|
||||||
|
|
||||||
int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
int currentY = 0;
|
int currentY = 0;
|
||||||
|
|
||||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
#include <osg/Texture2D>
|
#include <osg/Texture2D>
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
#include <components/myguiplatform/myguitexture.hpp>
|
|
||||||
|
|
||||||
#include <components/esm3/loadbody.hpp>
|
#include <components/esm3/loadbody.hpp>
|
||||||
#include <components/esm3/loadrace.hpp>
|
#include <components/esm3/loadrace.hpp>
|
||||||
|
#include <components/myguiplatform/myguitexture.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
@ -406,7 +406,7 @@ namespace MWGui
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Widgets::MWSkillPtr skillWidget;
|
Widgets::MWSkillPtr skillWidget;
|
||||||
const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
MyGUI::IntCoord coord1(0, 0, mSkillList->getWidth(), 18);
|
MyGUI::IntCoord coord1(0, 0, mSkillList->getWidth(), 18);
|
||||||
|
|
||||||
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
|
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
|
||||||
|
@ -439,7 +439,7 @@ namespace MWGui
|
||||||
if (mCurrentRaceId.empty())
|
if (mCurrentRaceId.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), lineHeight);
|
MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), lineHeight);
|
||||||
|
|
||||||
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
|
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <components/esm3/loadbsgn.hpp>
|
#include <components/esm3/loadbsgn.hpp>
|
||||||
#include <components/esm3/loadrace.hpp>
|
#include <components/esm3/loadrace.hpp>
|
||||||
#include <components/esm3/loadspel.hpp>
|
#include <components/esm3/loadspel.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
@ -274,7 +275,7 @@ namespace MWGui
|
||||||
groupWidget->setCaption(toUString(label));
|
groupWidget->setCaption(toUString(label));
|
||||||
mSkillWidgets.push_back(groupWidget);
|
mSkillWidgets.push_back(groupWidget);
|
||||||
|
|
||||||
int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
coord1.top += lineHeight;
|
coord1.top += lineHeight;
|
||||||
coord2.top += lineHeight;
|
coord2.top += lineHeight;
|
||||||
}
|
}
|
||||||
|
@ -297,7 +298,7 @@ namespace MWGui
|
||||||
mSkillWidgets.push_back(skillNameWidget);
|
mSkillWidgets.push_back(skillNameWidget);
|
||||||
mSkillWidgets.push_back(skillValueWidget);
|
mSkillWidgets.push_back(skillValueWidget);
|
||||||
|
|
||||||
int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
coord1.top += lineHeight;
|
coord1.top += lineHeight;
|
||||||
coord2.top += lineHeight;
|
coord2.top += lineHeight;
|
||||||
|
|
||||||
|
@ -315,7 +316,7 @@ namespace MWGui
|
||||||
|
|
||||||
mSkillWidgets.push_back(skillNameWidget);
|
mSkillWidgets.push_back(skillNameWidget);
|
||||||
|
|
||||||
int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
coord1.top += lineHeight;
|
coord1.top += lineHeight;
|
||||||
coord2.top += lineHeight;
|
coord2.top += lineHeight;
|
||||||
}
|
}
|
||||||
|
@ -331,7 +332,7 @@ namespace MWGui
|
||||||
|
|
||||||
mSkillWidgets.push_back(widget);
|
mSkillWidgets.push_back(widget);
|
||||||
|
|
||||||
int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
coord1.top += lineHeight;
|
coord1.top += lineHeight;
|
||||||
coord2.top += lineHeight;
|
coord2.top += lineHeight;
|
||||||
}
|
}
|
||||||
|
|
|
@ -909,7 +909,7 @@ namespace MWGui
|
||||||
|
|
||||||
void SettingsWindow::layoutControlsBox()
|
void SettingsWindow::layoutControlsBox()
|
||||||
{
|
{
|
||||||
const int h = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int h = Settings::gui().mFontSize + 2;
|
||||||
const int w = mControlsBox->getWidth() - 28;
|
const int w = mControlsBox->getWidth() - 28;
|
||||||
const int noWidgetsInRow = 2;
|
const int noWidgetsInRow = 2;
|
||||||
const int totalH = mControlsBox->getChildCount() / noWidgetsInRow * h;
|
const int totalH = mControlsBox->getChildCount() / noWidgetsInRow * h;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <components/esm3/loadgmst.hpp>
|
#include <components/esm3/loadgmst.hpp>
|
||||||
#include <components/esm3/loadrace.hpp>
|
#include <components/esm3/loadrace.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
|
@ -51,7 +52,7 @@ namespace MWGui
|
||||||
|
|
||||||
// TODO: refactor to use MyGUI::ListBox
|
// TODO: refactor to use MyGUI::ListBox
|
||||||
|
|
||||||
int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
|
|
||||||
MyGUI::Button* toAdd = mSpellsView->createWidget<MyGUI::Button>(price <= playerGold
|
MyGUI::Button* toAdd = mSpellsView->createWidget<MyGUI::Button>(price <= playerGold
|
||||||
? "SandTextButton"
|
? "SandTextButton"
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
#include <MyGUI_ImageBox.h>
|
#include <MyGUI_ImageBox.h>
|
||||||
#include <MyGUI_ScrollView.h>
|
#include <MyGUI_ScrollView.h>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include <components/settings/values.hpp>
|
||||||
#include "../mwbase/windowmanager.hpp"
|
|
||||||
|
|
||||||
#include <components/widgets/box.hpp>
|
#include <components/widgets/box.hpp>
|
||||||
#include <components/widgets/sharedstatebutton.hpp>
|
#include <components/widgets/sharedstatebutton.hpp>
|
||||||
|
|
||||||
|
@ -87,7 +85,7 @@ namespace MWGui
|
||||||
|
|
||||||
int curType = -1;
|
int curType = -1;
|
||||||
|
|
||||||
const int spellHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int spellHeight = Settings::gui().mFontSize + 2;
|
||||||
|
|
||||||
mLines.clear();
|
mLines.clear();
|
||||||
|
|
||||||
|
|
|
@ -419,7 +419,7 @@ namespace MWGui
|
||||||
groupWidget->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel);
|
groupWidget->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel);
|
||||||
mSkillWidgets.push_back(groupWidget);
|
mSkillWidgets.push_back(groupWidget);
|
||||||
|
|
||||||
int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
coord1.top += lineHeight;
|
coord1.top += lineHeight;
|
||||||
coord2.top += lineHeight;
|
coord2.top += lineHeight;
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,7 @@ namespace MWGui
|
||||||
mSkillWidgets.push_back(skillNameWidget);
|
mSkillWidgets.push_back(skillNameWidget);
|
||||||
mSkillWidgets.push_back(skillValueWidget);
|
mSkillWidgets.push_back(skillValueWidget);
|
||||||
|
|
||||||
int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
coord1.top += lineHeight;
|
coord1.top += lineHeight;
|
||||||
coord2.top += lineHeight;
|
coord2.top += lineHeight;
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ namespace MWGui
|
||||||
|
|
||||||
mSkillWidgets.push_back(skillNameWidget);
|
mSkillWidgets.push_back(skillNameWidget);
|
||||||
|
|
||||||
int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
coord1.top += lineHeight;
|
coord1.top += lineHeight;
|
||||||
coord2.top += lineHeight;
|
coord2.top += lineHeight;
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,7 @@ namespace MWGui
|
||||||
, mFocusToolTipX(0.0)
|
, mFocusToolTipX(0.0)
|
||||||
, mFocusToolTipY(0.0)
|
, mFocusToolTipY(0.0)
|
||||||
, mHorizontalScrollIndex(0)
|
, mHorizontalScrollIndex(0)
|
||||||
, mDelay(0.0)
|
, mRemainingDelay(Settings::gui().mTooltipDelay)
|
||||||
, mRemainingDelay(0.0)
|
|
||||||
, mLastMouseX(0)
|
, mLastMouseX(0)
|
||||||
, mLastMouseY(0)
|
, mLastMouseY(0)
|
||||||
, mEnabled(true)
|
, mEnabled(true)
|
||||||
|
@ -52,9 +51,6 @@ namespace MWGui
|
||||||
mDynamicToolTipBox->setNeedMouseFocus(false);
|
mDynamicToolTipBox->setNeedMouseFocus(false);
|
||||||
mMainWidget->setNeedMouseFocus(false);
|
mMainWidget->setNeedMouseFocus(false);
|
||||||
|
|
||||||
mDelay = Settings::Manager::getFloat("tooltip delay", "GUI");
|
|
||||||
mRemainingDelay = mDelay;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < mMainWidget->getChildCount(); ++i)
|
for (unsigned int i = 0; i < mMainWidget->getChildCount(); ++i)
|
||||||
{
|
{
|
||||||
mMainWidget->getChildAt(i)->setVisible(false);
|
mMainWidget->getChildAt(i)->setVisible(false);
|
||||||
|
@ -140,7 +136,7 @@ namespace MWGui
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mHorizontalScrollIndex = 0;
|
mHorizontalScrollIndex = 0;
|
||||||
mRemainingDelay = mDelay;
|
mRemainingDelay = Settings::gui().mTooltipDelay;
|
||||||
}
|
}
|
||||||
mLastMouseX = mousePos.left;
|
mLastMouseX = mousePos.left;
|
||||||
mLastMouseY = mousePos.top;
|
mLastMouseY = mousePos.top;
|
||||||
|
@ -960,11 +956,4 @@ namespace MWGui
|
||||||
.asUTF8());
|
.asUTF8());
|
||||||
widget->setUserString("ImageTexture_MagicEffectImage", icon);
|
widget->setUserString("ImageTexture_MagicEffectImage", icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolTips::setDelay(float delay)
|
|
||||||
{
|
|
||||||
mDelay = delay;
|
|
||||||
mRemainingDelay = mDelay;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,6 @@ namespace MWGui
|
||||||
bool toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
bool toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
||||||
bool getFullHelp() const;
|
bool getFullHelp() const;
|
||||||
|
|
||||||
void setDelay(float delay);
|
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
void setFocusObject(const MWWorld::Ptr& focus);
|
void setFocusObject(const MWWorld::Ptr& focus);
|
||||||
|
@ -124,7 +122,6 @@ namespace MWGui
|
||||||
|
|
||||||
int mHorizontalScrollIndex;
|
int mHorizontalScrollIndex;
|
||||||
|
|
||||||
float mDelay;
|
|
||||||
float mRemainingDelay; // remaining time until tooltip will show
|
float mRemainingDelay; // remaining time until tooltip will show
|
||||||
|
|
||||||
int mLastMouseX;
|
int mLastMouseX;
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace MWGui
|
||||||
|
|
||||||
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats(player);
|
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats(player);
|
||||||
|
|
||||||
const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <components/esm3/loadcrea.hpp>
|
#include <components/esm3/loadcrea.hpp>
|
||||||
#include <components/esm3/loadgmst.hpp>
|
#include <components/esm3/loadgmst.hpp>
|
||||||
#include <components/misc/strings/conversion.hpp>
|
#include <components/misc/strings/conversion.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
|
@ -79,7 +80,7 @@ namespace MWGui
|
||||||
// Apply followers cost, unlike vanilla the first follower doesn't travel for free
|
// Apply followers cost, unlike vanilla the first follower doesn't travel for free
|
||||||
price *= 1 + static_cast<int>(followers.size());
|
price *= 1 + static_cast<int>(followers.size());
|
||||||
|
|
||||||
int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||||
|
|
||||||
MyGUI::Button* toAdd = mDestinationsView->createWidget<MyGUI::Button>(
|
MyGUI::Button* toAdd = mDestinationsView->createWidget<MyGUI::Button>(
|
||||||
"SandTextButton", 0, mCurrentY, 200, lineHeight, MyGUI::Align::Default);
|
"SandTextButton", 0, mCurrentY, 200, lineHeight, MyGUI::Align::Default);
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
|
|
||||||
#include <components/settings/values.hpp>
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/inputmanager.hpp"
|
#include "../mwbase/inputmanager.hpp"
|
||||||
#include "../mwbase/luamanager.hpp"
|
#include "../mwbase/luamanager.hpp"
|
||||||
#include "../mwbase/soundmanager.hpp"
|
#include "../mwbase/soundmanager.hpp"
|
||||||
|
@ -183,9 +184,6 @@ namespace MWGui
|
||||||
, mTranslationDataStorage(translationDataStorage)
|
, mTranslationDataStorage(translationDataStorage)
|
||||||
, mInputBlocker(nullptr)
|
, mInputBlocker(nullptr)
|
||||||
, mCrosshairEnabled(Settings::Manager::getBool("crosshair", "HUD"))
|
, mCrosshairEnabled(Settings::Manager::getBool("crosshair", "HUD"))
|
||||||
, mSubtitlesEnabled(Settings::Manager::getBool("subtitles", "GUI"))
|
|
||||||
, mHitFaderEnabled(Settings::Manager::getBool("hit fader", "GUI"))
|
|
||||||
, mWerewolfOverlayEnabled(Settings::Manager::getBool("werewolf overlay", "GUI"))
|
|
||||||
, mHudEnabled(true)
|
, mHudEnabled(true)
|
||||||
, mCursorVisible(true)
|
, mCursorVisible(true)
|
||||||
, mCursorActive(true)
|
, mCursorActive(true)
|
||||||
|
@ -206,7 +204,7 @@ namespace MWGui
|
||||||
int dw, dh;
|
int dw, dh;
|
||||||
SDL_GL_GetDrawableSize(window, &dw, &dh);
|
SDL_GL_GetDrawableSize(window, &dw, &dh);
|
||||||
|
|
||||||
mScalingFactor = std::clamp(Settings::Manager::getFloat("scaling factor", "GUI"), 0.5f, 8.f) * (dw / w);
|
mScalingFactor = Settings::gui().mScalingFactor * (dw / w);
|
||||||
mGuiPlatform = std::make_unique<osgMyGUI::Platform>(viewer, guiRoot, resourceSystem->getImageManager(),
|
mGuiPlatform = std::make_unique<osgMyGUI::Platform>(viewer, guiRoot, resourceSystem->getImageManager(),
|
||||||
resourceSystem->getVFS(), mScalingFactor, "mygui", logpath / "MyGUI.log");
|
resourceSystem->getVFS(), mScalingFactor, "mygui", logpath / "MyGUI.log");
|
||||||
|
|
||||||
|
@ -249,7 +247,7 @@ namespace MWGui
|
||||||
"Resource", "AutoSizedResourceSkin");
|
"Resource", "AutoSizedResourceSkin");
|
||||||
MyGUI::ResourceManager::getInstance().load("core.xml");
|
MyGUI::ResourceManager::getInstance().load("core.xml");
|
||||||
|
|
||||||
bool keyboardNav = Settings::Manager::getBool("keyboard navigation", "GUI");
|
const bool keyboardNav = Settings::gui().mKeyboardNavigation;
|
||||||
mKeyboardNavigation = std::make_unique<KeyboardNavigation>();
|
mKeyboardNavigation = std::make_unique<KeyboardNavigation>();
|
||||||
mKeyboardNavigation->setEnabled(keyboardNav);
|
mKeyboardNavigation->setEnabled(keyboardNav);
|
||||||
Gui::ImageButton::setDefaultNeedKeyFocus(keyboardNav);
|
Gui::ImageButton::setDefaultNeedKeyFocus(keyboardNav);
|
||||||
|
@ -530,11 +528,6 @@ namespace MWGui
|
||||||
mStatsWatcher->addListener(mCharGen.get());
|
mStatsWatcher->addListener(mCharGen.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
int WindowManager::getFontHeight() const
|
|
||||||
{
|
|
||||||
return mFontLoader->getFontHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
void WindowManager::setNewGame(bool newgame)
|
void WindowManager::setNewGame(bool newgame)
|
||||||
{
|
{
|
||||||
if (newgame)
|
if (newgame)
|
||||||
|
@ -1152,17 +1145,13 @@ namespace MWGui
|
||||||
|
|
||||||
void WindowManager::processChangedSettings(const Settings::CategorySettingVector& changed)
|
void WindowManager::processChangedSettings(const Settings::CategorySettingVector& changed)
|
||||||
{
|
{
|
||||||
mToolTips->setDelay(Settings::Manager::getFloat("tooltip delay", "GUI"));
|
|
||||||
|
|
||||||
bool changeRes = false;
|
bool changeRes = false;
|
||||||
for (const auto& setting : changed)
|
for (const auto& setting : changed)
|
||||||
{
|
{
|
||||||
if (setting.first == "HUD" && setting.second == "crosshair")
|
if (setting.first == "HUD" && setting.second == "crosshair")
|
||||||
mCrosshairEnabled = Settings::Manager::getBool("crosshair", "HUD");
|
mCrosshairEnabled = Settings::Manager::getBool("crosshair", "HUD");
|
||||||
else if (setting.first == "GUI" && setting.second == "subtitles")
|
|
||||||
mSubtitlesEnabled = Settings::Manager::getBool("subtitles", "GUI");
|
|
||||||
else if (setting.first == "GUI" && setting.second == "menu transparency")
|
else if (setting.first == "GUI" && setting.second == "menu transparency")
|
||||||
setMenuTransparency(Settings::Manager::getFloat("menu transparency", "GUI"));
|
setMenuTransparency(Settings::gui().mMenuTransparency);
|
||||||
else if (setting.first == "Video"
|
else if (setting.first == "Video"
|
||||||
&& (setting.second == "resolution x" || setting.second == "resolution y"
|
&& (setting.second == "resolution x" || setting.second == "resolution y"
|
||||||
|| setting.second == "window mode" || setting.second == "window border"))
|
|| setting.second == "window mode" || setting.second == "window border"))
|
||||||
|
@ -1604,11 +1593,6 @@ namespace MWGui
|
||||||
mQuickKeysMenu->activateQuickKey(index);
|
mQuickKeysMenu->activateQuickKey(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WindowManager::getSubtitlesEnabled()
|
|
||||||
{
|
|
||||||
return mSubtitlesEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WindowManager::toggleHud()
|
bool WindowManager::toggleHud()
|
||||||
{
|
{
|
||||||
mHudEnabled = !mHudEnabled;
|
mHudEnabled = !mHudEnabled;
|
||||||
|
@ -1923,9 +1907,8 @@ namespace MWGui
|
||||||
void WindowManager::sizeVideo(int screenWidth, int screenHeight)
|
void WindowManager::sizeVideo(int screenWidth, int screenHeight)
|
||||||
{
|
{
|
||||||
// Use black bars to correct aspect ratio
|
// Use black bars to correct aspect ratio
|
||||||
bool stretch = Settings::Manager::getBool("stretch menu background", "GUI");
|
|
||||||
mVideoBackground->setSize(screenWidth, screenHeight);
|
mVideoBackground->setSize(screenWidth, screenHeight);
|
||||||
mVideoWidget->autoResize(stretch);
|
mVideoWidget->autoResize(Settings::gui().mStretchMenuBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::exitCurrentModal()
|
void WindowManager::exitCurrentModal()
|
||||||
|
@ -2054,7 +2037,7 @@ namespace MWGui
|
||||||
|
|
||||||
void WindowManager::activateHitOverlay(bool interrupt)
|
void WindowManager::activateHitOverlay(bool interrupt)
|
||||||
{
|
{
|
||||||
if (!mHitFaderEnabled)
|
if (!Settings::gui().mHitFader)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!interrupt && !mHitFader->isEmpty())
|
if (!interrupt && !mHitFader->isEmpty())
|
||||||
|
@ -2067,7 +2050,7 @@ namespace MWGui
|
||||||
|
|
||||||
void WindowManager::setWerewolfOverlay(bool set)
|
void WindowManager::setWerewolfOverlay(bool set)
|
||||||
{
|
{
|
||||||
if (!mWerewolfOverlayEnabled)
|
if (!Settings::gui().mWerewolfOverlay)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mWerewolfFader)
|
if (mWerewolfFader)
|
||||||
|
@ -2240,7 +2223,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
MyGUI::ITexture* tex = MyGUI::RenderManager::getInstance().createTexture("transparent");
|
MyGUI::ITexture* tex = MyGUI::RenderManager::getInstance().createTexture("transparent");
|
||||||
tex->createManual(8, 8, MyGUI::TextureUsage::Write, MyGUI::PixelFormat::R8G8B8A8);
|
tex->createManual(8, 8, MyGUI::TextureUsage::Write, MyGUI::PixelFormat::R8G8B8A8);
|
||||||
setMenuTransparency(Settings::Manager::getFloat("menu transparency", "GUI"));
|
setMenuTransparency(Settings::gui().mMenuTransparency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -239,14 +239,12 @@ namespace MWGui
|
||||||
const MWWorld::Ptr& getSelectedEnchantItem() const override;
|
const MWWorld::Ptr& getSelectedEnchantItem() const override;
|
||||||
void setSelectedWeapon(const MWWorld::Ptr& item) override;
|
void setSelectedWeapon(const MWWorld::Ptr& item) override;
|
||||||
const MWWorld::Ptr& getSelectedWeapon() const override;
|
const MWWorld::Ptr& getSelectedWeapon() const override;
|
||||||
int getFontHeight() const override;
|
|
||||||
void unsetSelectedSpell() override;
|
void unsetSelectedSpell() override;
|
||||||
void unsetSelectedWeapon() override;
|
void unsetSelectedWeapon() override;
|
||||||
|
|
||||||
void updateConsoleObjectPtr(const MWWorld::Ptr& currentPtr, const MWWorld::Ptr& newPtr) override;
|
void updateConsoleObjectPtr(const MWWorld::Ptr& currentPtr, const MWWorld::Ptr& newPtr) override;
|
||||||
|
|
||||||
void showCrosshair(bool show) override;
|
void showCrosshair(bool show) override;
|
||||||
bool getSubtitlesEnabled() override;
|
|
||||||
|
|
||||||
/// Turn visibility of HUD on or off
|
/// Turn visibility of HUD on or off
|
||||||
bool toggleHud() override;
|
bool toggleHud() override;
|
||||||
|
@ -460,9 +458,6 @@ namespace MWGui
|
||||||
MyGUI::Widget* mInputBlocker;
|
MyGUI::Widget* mInputBlocker;
|
||||||
|
|
||||||
bool mCrosshairEnabled;
|
bool mCrosshairEnabled;
|
||||||
bool mSubtitlesEnabled;
|
|
||||||
bool mHitFaderEnabled;
|
|
||||||
bool mWerewolfOverlayEnabled;
|
|
||||||
bool mHudEnabled;
|
bool mHudEnabled;
|
||||||
bool mCursorVisible;
|
bool mCursorVisible;
|
||||||
bool mCursorActive;
|
bool mCursorActive;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <components/lua_ui/util.hpp>
|
#include <components/lua_ui/util.hpp>
|
||||||
|
|
||||||
#include <components/misc/strings/format.hpp>
|
#include <components/misc/strings/format.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include "context.hpp"
|
#include "context.hpp"
|
||||||
#include "luamanagerimp.hpp"
|
#include "luamanagerimp.hpp"
|
||||||
|
@ -103,7 +103,7 @@ namespace MWLua
|
||||||
context.mLuaManager->addAction(
|
context.mLuaManager->addAction(
|
||||||
[]() { LuaUi::Element::forEach([](LuaUi::Element* e) { e->update(); }); }, "Update all UI elements");
|
[]() { LuaUi::Element::forEach([](LuaUi::Element* e) { e->update(); }); }, "Update all UI elements");
|
||||||
};
|
};
|
||||||
api["_getMenuTransparency"] = []() { return Settings::Manager::getFloat("menu transparency", "GUI"); };
|
api["_getMenuTransparency"] = []() -> float { return Settings::gui().mMenuTransparency; };
|
||||||
|
|
||||||
auto uiLayer = context.mLua->sol().new_usertype<LuaUi::Layer>("UiLayer");
|
auto uiLayer = context.mLua->sol().new_usertype<LuaUi::Layer>("UiLayer");
|
||||||
uiLayer["name"] = sol::property([](LuaUi::Layer& self) { return self.name(); });
|
uiLayer["name"] = sol::property([](LuaUi::Layer& self) { return self.name(); });
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
#include <components/interpreter/interpreter.hpp>
|
#include <components/interpreter/interpreter.hpp>
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/soundmanager.hpp"
|
#include "../mwbase/soundmanager.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
@ -40,7 +40,7 @@ namespace MWScript
|
||||||
|
|
||||||
MWBase::Environment::get().getSoundManager()->say(ptr, file);
|
MWBase::Environment::get().getSoundManager()->say(ptr, file);
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getSubtitlesEnabled())
|
if (Settings::gui().mSubtitles)
|
||||||
context.messageBox(text);
|
context.messageBox(text);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -3683,7 +3683,7 @@ namespace MWWorld
|
||||||
|
|
||||||
void World::spawnBloodEffect(const Ptr& ptr, const osg::Vec3f& worldPosition)
|
void World::spawnBloodEffect(const Ptr& ptr, const osg::Vec3f& worldPosition)
|
||||||
{
|
{
|
||||||
if (ptr == getPlayerPtr() && Settings::Manager::getBool("hit fader", "GUI"))
|
if (ptr == getPlayerPtr() && Settings::gui().mHitFader)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string_view texture
|
std::string_view texture
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <components/myguiplatform/scalinglayer.hpp>
|
#include <components/myguiplatform/scalinglayer.hpp>
|
||||||
|
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -229,7 +229,6 @@ namespace Gui
|
||||||
|
|
||||||
FontLoader::FontLoader(ToUTF8::FromType encoding, const VFS::Manager* vfs, float scalingFactor)
|
FontLoader::FontLoader(ToUTF8::FromType encoding, const VFS::Manager* vfs, float scalingFactor)
|
||||||
: mVFS(vfs)
|
: mVFS(vfs)
|
||||||
, mFontHeight(std::clamp(Settings::Manager::getInt("font size", "GUI"), 12, 18))
|
|
||||||
, mScalingFactor(scalingFactor)
|
, mScalingFactor(scalingFactor)
|
||||||
{
|
{
|
||||||
if (encoding == ToUTF8::WINDOWS_1252)
|
if (encoding == ToUTF8::WINDOWS_1252)
|
||||||
|
@ -325,7 +324,7 @@ namespace Gui
|
||||||
|
|
||||||
MyGUI::xml::ElementPtr sizeNode = resourceNode->createChild("Property");
|
MyGUI::xml::ElementPtr sizeNode = resourceNode->createChild("Property");
|
||||||
sizeNode->addAttribute("key", "Size");
|
sizeNode->addAttribute("key", "Size");
|
||||||
sizeNode->addAttribute("value", std::to_string(mFontHeight));
|
sizeNode->addAttribute("value", std::to_string(Settings::gui().mFontSize));
|
||||||
|
|
||||||
MyGUI::ResourceTrueTypeFont* font = static_cast<MyGUI::ResourceTrueTypeFont*>(
|
MyGUI::ResourceTrueTypeFont* font = static_cast<MyGUI::ResourceTrueTypeFont*>(
|
||||||
MyGUI::FactoryManager::getInstance().createObject("Resource", "ResourceTrueTypeFont"));
|
MyGUI::FactoryManager::getInstance().createObject("Resource", "ResourceTrueTypeFont"));
|
||||||
|
@ -623,18 +622,13 @@ namespace Gui
|
||||||
// We should adjust line height for MyGUI widgets depending on font size
|
// We should adjust line height for MyGUI widgets depending on font size
|
||||||
MyGUI::xml::ElementPtr heightNode = resourceNode->createChild("Property");
|
MyGUI::xml::ElementPtr heightNode = resourceNode->createChild("Property");
|
||||||
heightNode->addAttribute("key", "HeightLine");
|
heightNode->addAttribute("key", "HeightLine");
|
||||||
heightNode->addAttribute("value", std::to_string(mFontHeight + 2));
|
heightNode->addAttribute("value", std::to_string(Settings::gui().mFontSize + 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::ResourceManager::getInstance().loadFromXmlNode(_node, _file, _version);
|
MyGUI::ResourceManager::getInstance().loadFromXmlNode(_node, _file, _version);
|
||||||
}
|
}
|
||||||
|
|
||||||
int FontLoader::getFontHeight()
|
|
||||||
{
|
|
||||||
return mFontHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string_view FontLoader::getFontForFace(std::string_view face)
|
std::string_view FontLoader::getFontForFace(std::string_view face)
|
||||||
{
|
{
|
||||||
if (Misc::StringUtils::ciEqual(face, "daedric"))
|
if (Misc::StringUtils::ciEqual(face, "daedric"))
|
||||||
|
|
|
@ -29,14 +29,11 @@ namespace Gui
|
||||||
|
|
||||||
void overrideLineHeight(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version);
|
void overrideLineHeight(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version);
|
||||||
|
|
||||||
int getFontHeight();
|
|
||||||
|
|
||||||
static std::string_view getFontForFace(std::string_view face);
|
static std::string_view getFontForFace(std::string_view face);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ToUTF8::FromType mEncoding;
|
ToUTF8::FromType mEncoding;
|
||||||
const VFS::Manager* mVFS;
|
const VFS::Manager* mVFS;
|
||||||
int mFontHeight;
|
|
||||||
float mScalingFactor;
|
float mScalingFactor;
|
||||||
|
|
||||||
void loadFonts();
|
void loadFonts();
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include <osg/Vec2f>
|
#include <osg/Vec2f>
|
||||||
#include <osg/Vec3f>
|
#include <osg/Vec3f>
|
||||||
|
|
||||||
|
#include <MyGUI_Colour.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
@ -32,9 +34,8 @@ namespace Settings
|
||||||
makeClampSanitizerFloat(0, 1) };
|
makeClampSanitizerFloat(0, 1) };
|
||||||
SettingValue<bool> mKeyboardNavigation{ mIndex, "GUI", "keyboard navigation" };
|
SettingValue<bool> mKeyboardNavigation{ mIndex, "GUI", "keyboard navigation" };
|
||||||
SettingValue<bool> mColorTopicEnable{ mIndex, "GUI", "color topic enable" };
|
SettingValue<bool> mColorTopicEnable{ mIndex, "GUI", "color topic enable" };
|
||||||
SettingValue<float> mColorTopicSpecific{ mIndex, "GUI", "color topic specific", makeClampSanitizerFloat(0, 1) };
|
SettingValue<MyGUI::Colour> mColorTopicSpecific{ mIndex, "GUI", "color topic specific" };
|
||||||
SettingValue<float> mColorTopicExhausted{ mIndex, "GUI", "color topic exhausted",
|
SettingValue<MyGUI::Colour> mColorTopicExhausted{ mIndex, "GUI", "color topic exhausted" };
|
||||||
makeClampSanitizerFloat(0, 1) };
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -454,6 +454,11 @@ namespace Settings
|
||||||
setStringArray(setting, category, value);
|
setStringArray(setting, category, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Manager::set(std::string_view setting, std::string_view category, const MyGUI::Colour& value)
|
||||||
|
{
|
||||||
|
setString(setting, category, value.print());
|
||||||
|
}
|
||||||
|
|
||||||
void Manager::recordInit(std::string_view setting, std::string_view category)
|
void Manager::recordInit(std::string_view setting, std::string_view category)
|
||||||
{
|
{
|
||||||
sInitialized.emplace(category, setting);
|
sInitialized.emplace(category, setting);
|
||||||
|
|
|
@ -5,15 +5,17 @@
|
||||||
|
|
||||||
#include "components/detournavigator/collisionshapetype.hpp"
|
#include "components/detournavigator/collisionshapetype.hpp"
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <filesystem>
|
|
||||||
#include <osg/Vec2f>
|
#include <osg/Vec2f>
|
||||||
#include <osg/Vec3f>
|
#include <osg/Vec3f>
|
||||||
|
|
||||||
|
#include <MyGUI_Colour.h>
|
||||||
|
|
||||||
namespace Files
|
namespace Files
|
||||||
{
|
{
|
||||||
struct ConfigurationManager;
|
struct ConfigurationManager;
|
||||||
|
@ -105,6 +107,7 @@ namespace Settings
|
||||||
static void set(std::string_view setting, std::string_view category, const osg::Vec3f& value);
|
static void set(std::string_view setting, std::string_view category, const osg::Vec3f& value);
|
||||||
static void set(std::string_view setting, std::string_view category, DetourNavigator::CollisionShapeType value);
|
static void set(std::string_view setting, std::string_view category, DetourNavigator::CollisionShapeType value);
|
||||||
static void set(std::string_view setting, std::string_view category, const std::vector<std::string>& value);
|
static void set(std::string_view setting, std::string_view category, const std::vector<std::string>& value);
|
||||||
|
static void set(std::string_view setting, std::string_view category, const MyGUI::Colour& value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::set<std::pair<std::string_view, std::string_view>> sInitialized;
|
static std::set<std::pair<std::string_view, std::string_view>> sInitialized;
|
||||||
|
@ -188,6 +191,12 @@ namespace Settings
|
||||||
{
|
{
|
||||||
return getStringArray(setting, category);
|
return getStringArray(setting, category);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline MyGUI::Colour Manager::getImpl<MyGUI::Colour>(std::string_view setting, std::string_view category)
|
||||||
|
{
|
||||||
|
return MyGUI::Colour::parse(getString(setting, category));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // COMPONENTS_SETTINGS_H
|
#endif // COMPONENTS_SETTINGS_H
|
||||||
|
|
|
@ -35,6 +35,7 @@ namespace Settings
|
||||||
Vec3f,
|
Vec3f,
|
||||||
CollisionShapeType,
|
CollisionShapeType,
|
||||||
StringArray,
|
StringArray,
|
||||||
|
MyGuiColour,
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -124,6 +125,12 @@ namespace Settings
|
||||||
return SettingValueType::StringArray;
|
return SettingValueType::StringArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline constexpr SettingValueType getSettingValueType<MyGUI::Colour>()
|
||||||
|
{
|
||||||
|
return SettingValueType::MyGuiColour;
|
||||||
|
}
|
||||||
|
|
||||||
inline constexpr std::string_view getSettingValueTypeName(SettingValueType type)
|
inline constexpr std::string_view getSettingValueTypeName(SettingValueType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -156,6 +163,8 @@ namespace Settings
|
||||||
return "collision shape type";
|
return "collision shape type";
|
||||||
case SettingValueType::StringArray:
|
case SettingValueType::StringArray:
|
||||||
return "string array";
|
return "string array";
|
||||||
|
case SettingValueType::MyGuiColour:
|
||||||
|
return "colour";
|
||||||
}
|
}
|
||||||
return "unsupported";
|
return "unsupported";
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
#define OPENMW_WIDGETS_WRAPPER_H
|
#define OPENMW_WIDGETS_WRAPPER_H
|
||||||
|
|
||||||
#include <MyGUI_Prerequest.h>
|
#include <MyGUI_Prerequest.h>
|
||||||
#include <components/settings/settings.hpp>
|
|
||||||
|
#include "components/settings/values.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ namespace Gui
|
||||||
void setFontName(const std::string& name) override
|
void setFontName(const std::string& name) override
|
||||||
{
|
{
|
||||||
T::setFontName(name);
|
T::setFontName(name);
|
||||||
T::setPropertyOverride("FontHeight", getFontSize());
|
T::setPropertyOverride("FontHeight", std::to_string(Settings::gui().mFontSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -29,18 +30,9 @@ namespace Gui
|
||||||
// We should restore it.
|
// We should restore it.
|
||||||
if (_key == "FontName")
|
if (_key == "FontName")
|
||||||
{
|
{
|
||||||
T::setPropertyOverride("FontHeight", getFontSize());
|
T::setPropertyOverride("FontHeight", std::to_string(Settings::gui().mFontSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
const std::string& getFontSize()
|
|
||||||
{
|
|
||||||
// Note: we can not use the FontLoader here, so there is a code duplication a bit.
|
|
||||||
static const std::string fontSize
|
|
||||||
= std::to_string(std::clamp(Settings::Manager::getInt("font size", "GUI"), 12, 18));
|
|
||||||
return fontSize;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue