|
|
@ -130,12 +130,14 @@ namespace MWGui
|
|
|
|
if (type == sliderType)
|
|
|
|
if (type == sliderType)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MyGUI::ScrollBar* scroll = current->castType<MyGUI::ScrollBar>();
|
|
|
|
MyGUI::ScrollBar* scroll = current->castType<MyGUI::ScrollBar>();
|
|
|
|
|
|
|
|
std::string valueStr;
|
|
|
|
if (getSettingValueType(current) == "Float")
|
|
|
|
if (getSettingValueType(current) == "Float")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 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);
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
@ -144,15 +146,30 @@ namespace MWGui
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int value = Settings::Manager::getInt(getSettingName(current), getSettingCategory(current));
|
|
|
|
int value = Settings::Manager::getInt(getSettingName(current), getSettingCategory(current));
|
|
|
|
|
|
|
|
valueStr = MyGUI::utility::toString(value);
|
|
|
|
scroll->setScrollPosition(value);
|
|
|
|
scroll->setScrollPosition(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
scroll->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
|
|
|
|
scroll->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
|
|
|
|
|
|
|
|
updateSliderLabel(scroll, valueStr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
configureWidgets(current);
|
|
|
|
configureWidgets(current);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SettingsWindow::updateSliderLabel(MyGUI::ScrollBar *scroller, const std::string& value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::string labelWidgetName = scroller->getUserString("SettingLabelWidget");
|
|
|
|
|
|
|
|
if (!labelWidgetName.empty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MyGUI::TextBox* textBox;
|
|
|
|
|
|
|
|
getWidget(textBox, labelWidgetName);
|
|
|
|
|
|
|
|
std::string labelCaption = scroller->getUserString("SettingLabelCaption");
|
|
|
|
|
|
|
|
boost::algorithm::replace_all(labelCaption, "%s", value);
|
|
|
|
|
|
|
|
textBox->setCaptionWithReplacing(labelCaption);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SettingsWindow::SettingsWindow() :
|
|
|
|
SettingsWindow::SettingsWindow() :
|
|
|
|
WindowBase("openmw_settings_window.layout"),
|
|
|
|
WindowBase("openmw_settings_window.layout"),
|
|
|
|
mKeyboardMode(true)
|
|
|
|
mKeyboardMode(true)
|
|
|
@ -167,17 +184,13 @@ namespace MWGui
|
|
|
|
getWidget(mFullscreenButton, "FullscreenButton");
|
|
|
|
getWidget(mFullscreenButton, "FullscreenButton");
|
|
|
|
getWidget(mVSyncButton, "VSyncButton");
|
|
|
|
getWidget(mVSyncButton, "VSyncButton");
|
|
|
|
getWidget(mWindowBorderButton, "WindowBorderButton");
|
|
|
|
getWidget(mWindowBorderButton, "WindowBorderButton");
|
|
|
|
getWidget(mFOVSlider, "FOVSlider");
|
|
|
|
|
|
|
|
getWidget(mAnisotropySlider, "AnisotropySlider");
|
|
|
|
|
|
|
|
getWidget(mTextureFilteringButton, "TextureFilteringButton");
|
|
|
|
getWidget(mTextureFilteringButton, "TextureFilteringButton");
|
|
|
|
getWidget(mAnisotropyLabel, "AnisotropyLabel");
|
|
|
|
|
|
|
|
getWidget(mAnisotropyBox, "AnisotropyBox");
|
|
|
|
getWidget(mAnisotropyBox, "AnisotropyBox");
|
|
|
|
getWidget(mShadersButton, "ShadersButton");
|
|
|
|
getWidget(mShadersButton, "ShadersButton");
|
|
|
|
getWidget(mShadowsEnabledButton, "ShadowsEnabledButton");
|
|
|
|
getWidget(mShadowsEnabledButton, "ShadowsEnabledButton");
|
|
|
|
getWidget(mShadowsTextureSize, "ShadowsTextureSize");
|
|
|
|
getWidget(mShadowsTextureSize, "ShadowsTextureSize");
|
|
|
|
getWidget(mControlsBox, "ControlsBox");
|
|
|
|
getWidget(mControlsBox, "ControlsBox");
|
|
|
|
getWidget(mResetControlsButton, "ResetControlsButton");
|
|
|
|
getWidget(mResetControlsButton, "ResetControlsButton");
|
|
|
|
getWidget(mDifficultySlider, "DifficultySlider");
|
|
|
|
|
|
|
|
getWidget(mKeyboardSwitch, "KeyboardButton");
|
|
|
|
getWidget(mKeyboardSwitch, "KeyboardButton");
|
|
|
|
getWidget(mControllerSwitch, "ControllerButton");
|
|
|
|
getWidget(mControllerSwitch, "ControllerButton");
|
|
|
|
getWidget(mWaterTextureSize, "WaterTextureSize");
|
|
|
|
getWidget(mWaterTextureSize, "WaterTextureSize");
|
|
|
@ -238,7 +251,6 @@ namespace MWGui
|
|
|
|
|
|
|
|
|
|
|
|
std::string tmip = Settings::Manager::getString("texture mipmap", "General");
|
|
|
|
std::string tmip = Settings::Manager::getString("texture mipmap", "General");
|
|
|
|
mTextureFilteringButton->setCaption(textureMipmappingToStr(tmip));
|
|
|
|
mTextureFilteringButton->setCaption(textureMipmappingToStr(tmip));
|
|
|
|
mAnisotropyLabel->setCaption("Anisotropy (" + MyGUI::utility::toString(Settings::Manager::getInt("anisotropy", "General")) + ")");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int waterTextureSize = Settings::Manager::getInt ("rtt size", "Water");
|
|
|
|
int waterTextureSize = Settings::Manager::getInt ("rtt size", "Water");
|
|
|
|
if (waterTextureSize >= 512)
|
|
|
|
if (waterTextureSize >= 512)
|
|
|
@ -255,15 +267,6 @@ namespace MWGui
|
|
|
|
mShadowsEnabledButton->setEnabled(false);
|
|
|
|
mShadowsEnabledButton->setEnabled(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MyGUI::TextBox* fovText;
|
|
|
|
|
|
|
|
getWidget(fovText, "FovText");
|
|
|
|
|
|
|
|
fovText->setCaption("Field of View (" + MyGUI::utility::toString(int(Settings::Manager::getInt("field of view", "Camera"))) + ")");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MyGUI::TextBox* diffText;
|
|
|
|
|
|
|
|
getWidget(diffText, "DifficultyText");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diffText->setCaptionWithReplacing("#{sDifficulty} (" + MyGUI::utility::toString(int(Settings::Manager::getInt("difficulty", "Game"))) + ")");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mWindowBorderButton->setEnabled(!Settings::Manager::getBool("fullscreen", "Video"));
|
|
|
|
mWindowBorderButton->setEnabled(!Settings::Manager::getBool("fullscreen", "Video"));
|
|
|
|
|
|
|
|
|
|
|
|
mKeyboardSwitch->setStateSelected(true);
|
|
|
|
mKeyboardSwitch->setStateSelected(true);
|
|
|
@ -439,6 +442,7 @@ namespace MWGui
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (getSettingType(scroller) == "Slider")
|
|
|
|
if (getSettingType(scroller) == "Slider")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
std::string valueStr;
|
|
|
|
if (getSettingValueType(scroller) == "Float")
|
|
|
|
if (getSettingValueType(scroller) == "Float")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
float value = pos / float(scroller->getScrollRange()-1);
|
|
|
|
float value = pos / float(scroller->getScrollRange()-1);
|
|
|
@ -447,28 +451,15 @@ namespace MWGui
|
|
|
|
getSettingMinMax(scroller, min, max);
|
|
|
|
getSettingMinMax(scroller, min, max);
|
|
|
|
value = min + (max-min) * value;
|
|
|
|
value = min + (max-min) * value;
|
|
|
|
Settings::Manager::setFloat(getSettingName(scroller), getSettingCategory(scroller), value);
|
|
|
|
Settings::Manager::setFloat(getSettingName(scroller), getSettingCategory(scroller), value);
|
|
|
|
|
|
|
|
valueStr = MyGUI::utility::toString(int(value));
|
|
|
|
if (scroller == mFOVSlider)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MyGUI::TextBox* fovText;
|
|
|
|
|
|
|
|
getWidget(fovText, "FovText");
|
|
|
|
|
|
|
|
fovText->setCaption("Field of View (" + MyGUI::utility::toString(int(value)) + ")");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (scroller == mDifficultySlider)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MyGUI::TextBox* diffText;
|
|
|
|
|
|
|
|
getWidget(diffText, "DifficultyText");
|
|
|
|
|
|
|
|
diffText->setCaptionWithReplacing("#{sDifficulty} (" + MyGUI::utility::toString(int(value)) + ")");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Settings::Manager::setInt(getSettingName(scroller), getSettingCategory(scroller), pos);
|
|
|
|
Settings::Manager::setInt(getSettingName(scroller), getSettingCategory(scroller), pos);
|
|
|
|
if (scroller == mAnisotropySlider)
|
|
|
|
valueStr = MyGUI::utility::toString(pos);
|
|
|
|
{
|
|
|
|
|
|
|
|
mAnisotropyLabel->setCaption("Anisotropy (" + MyGUI::utility::toString(pos) + ")");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
updateSliderLabel(scroller, valueStr);
|
|
|
|
|
|
|
|
|
|
|
|
apply();
|
|
|
|
apply();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|