|
|
@ -11,9 +11,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include <SDL_video.h>
|
|
|
|
#include <SDL_video.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <iomanip>
|
|
|
|
|
|
|
|
|
|
|
|
#include <components/debug/debuglog.hpp>
|
|
|
|
#include <components/debug/debuglog.hpp>
|
|
|
|
#include <components/misc/stringops.hpp>
|
|
|
|
#include <components/misc/stringops.hpp>
|
|
|
|
#include <components/misc/gcd.hpp>
|
|
|
|
#include <components/misc/gcd.hpp>
|
|
|
|
|
|
|
|
#include <components/misc/constants.hpp>
|
|
|
|
#include <components/widgets/sharedstatebutton.hpp>
|
|
|
|
#include <components/widgets/sharedstatebutton.hpp>
|
|
|
|
#include <components/settings/settings.hpp>
|
|
|
|
#include <components/settings/settings.hpp>
|
|
|
|
|
|
|
|
|
|
|
@ -127,13 +130,22 @@ namespace MWGui
|
|
|
|
MyGUI::ScrollBar* scroll = current->castType<MyGUI::ScrollBar>();
|
|
|
|
MyGUI::ScrollBar* scroll = current->castType<MyGUI::ScrollBar>();
|
|
|
|
std::string valueStr;
|
|
|
|
std::string valueStr;
|
|
|
|
std::string valueType = getSettingValueType(current);
|
|
|
|
std::string valueType = getSettingValueType(current);
|
|
|
|
if (valueType == "Float" || valueType == "Integer")
|
|
|
|
if (valueType == "Float" || valueType == "Integer" || valueType == "Cell")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// TODO: ScrollBar isn't meant for this. should probably use a dedicated FloatSlider widget
|
|
|
|
// TODO: ScrollBar isn't meant for this. should probably use a dedicated FloatSlider widget
|
|
|
|
float min,max;
|
|
|
|
float min,max;
|
|
|
|
getSettingMinMax(scroll, min, max);
|
|
|
|
getSettingMinMax(scroll, min, max);
|
|
|
|
float value = Settings::Manager::getFloat(getSettingName(current), getSettingCategory(current));
|
|
|
|
float value = Settings::Manager::getFloat(getSettingName(current), getSettingCategory(current));
|
|
|
|
valueStr = MyGUI::utility::toString((int)value);
|
|
|
|
|
|
|
|
|
|
|
|
if (valueType == "Cell")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
|
|
|
ss << std::fixed << std::setprecision(2) << value/Constants::CellSizeInUnits;
|
|
|
|
|
|
|
|
valueStr = ss.str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
valueStr = MyGUI::utility::toString(int(value));
|
|
|
|
|
|
|
|
|
|
|
|
value = std::max(min, std::min(value, max));
|
|
|
|
value = std::max(min, std::min(value, max));
|
|
|
|
value = (value-min)/(max-min);
|
|
|
|
value = (value-min)/(max-min);
|
|
|
|
|
|
|
|
|
|
|
@ -146,7 +158,8 @@ namespace MWGui
|
|
|
|
scroll->setScrollPosition(value);
|
|
|
|
scroll->setScrollPosition(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
scroll->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
|
|
|
|
scroll->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
|
|
|
|
updateSliderLabel(scroll, valueStr);
|
|
|
|
if (scroll->getVisible())
|
|
|
|
|
|
|
|
updateSliderLabel(scroll, valueStr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
configureWidgets(current);
|
|
|
|
configureWidgets(current);
|
|
|
@ -170,6 +183,12 @@ namespace MWGui
|
|
|
|
WindowBase("openmw_settings_window.layout"),
|
|
|
|
WindowBase("openmw_settings_window.layout"),
|
|
|
|
mKeyboardMode(true)
|
|
|
|
mKeyboardMode(true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
bool terrain = Settings::Manager::getBool("distant terrain", "Terrain");
|
|
|
|
|
|
|
|
const std::string widgetName = terrain ? "RenderingDistanceSlider" : "LargeRenderingDistanceSlider";
|
|
|
|
|
|
|
|
MyGUI::Widget* unusedSlider;
|
|
|
|
|
|
|
|
getWidget(unusedSlider, widgetName);
|
|
|
|
|
|
|
|
unusedSlider->setVisible(false);
|
|
|
|
|
|
|
|
|
|
|
|
configureWidgets(mMainWidget);
|
|
|
|
configureWidgets(mMainWidget);
|
|
|
|
|
|
|
|
|
|
|
|
setTitle("#{sOptions}");
|
|
|
|
setTitle("#{sOptions}");
|
|
|
@ -425,7 +444,7 @@ namespace MWGui
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string valueStr;
|
|
|
|
std::string valueStr;
|
|
|
|
std::string valueType = getSettingValueType(scroller);
|
|
|
|
std::string valueType = getSettingValueType(scroller);
|
|
|
|
if (valueType == "Float" || valueType == "Integer")
|
|
|
|
if (valueType == "Float" || valueType == "Integer" || valueType == "Cell")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
float value = pos / float(scroller->getScrollRange()-1);
|
|
|
|
float value = pos / float(scroller->getScrollRange()-1);
|
|
|
|
|
|
|
|
|
|
|
@ -436,7 +455,15 @@ namespace MWGui
|
|
|
|
Settings::Manager::setFloat(getSettingName(scroller), getSettingCategory(scroller), value);
|
|
|
|
Settings::Manager::setFloat(getSettingName(scroller), getSettingCategory(scroller), value);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
Settings::Manager::setInt(getSettingName(scroller), getSettingCategory(scroller), (int)value);
|
|
|
|
Settings::Manager::setInt(getSettingName(scroller), getSettingCategory(scroller), (int)value);
|
|
|
|
valueStr = MyGUI::utility::toString(int(value));
|
|
|
|
|
|
|
|
|
|
|
|
if (valueType == "Cell")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
|
|
|
ss << std::fixed << std::setprecision(2) << value/Constants::CellSizeInUnits;
|
|
|
|
|
|
|
|
valueStr = ss.str();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
valueStr = MyGUI::utility::toString(int(value));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|