|
|
|
@ -130,12 +130,14 @@ namespace MWGui
|
|
|
|
|
if (type == sliderType)
|
|
|
|
|
{
|
|
|
|
|
MyGUI::ScrollBar* scroll = current->castType<MyGUI::ScrollBar>();
|
|
|
|
|
std::string valueStr;
|
|
|
|
|
if (getSettingValueType(current) == "Float")
|
|
|
|
|
{
|
|
|
|
|
// TODO: ScrollBar isn't meant for this. should probably use a dedicated FloatSlider widget
|
|
|
|
|
float min,max;
|
|
|
|
|
getSettingMinMax(scroll, min, max);
|
|
|
|
|
float value = Settings::Manager::getFloat(getSettingName(current), getSettingCategory(current));
|
|
|
|
|
valueStr = MyGUI::utility::toString((int)value);
|
|
|
|
|
value = std::max(min, std::min(value, max));
|
|
|
|
|
value = (value-min)/(max-min);
|
|
|
|
|
|
|
|
|
@ -144,15 +146,30 @@ namespace MWGui
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int value = Settings::Manager::getInt(getSettingName(current), getSettingCategory(current));
|
|
|
|
|
valueStr = MyGUI::utility::toString(value);
|
|
|
|
|
scroll->setScrollPosition(value);
|
|
|
|
|
}
|
|
|
|
|
scroll->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
|
|
|
|
|
updateSliderLabel(scroll, valueStr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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() :
|
|
|
|
|
WindowBase("openmw_settings_window.layout"),
|
|
|
|
|
mKeyboardMode(true)
|
|
|
|
@ -167,17 +184,13 @@ namespace MWGui
|
|
|
|
|
getWidget(mFullscreenButton, "FullscreenButton");
|
|
|
|
|
getWidget(mVSyncButton, "VSyncButton");
|
|
|
|
|
getWidget(mWindowBorderButton, "WindowBorderButton");
|
|
|
|
|
getWidget(mFOVSlider, "FOVSlider");
|
|
|
|
|
getWidget(mAnisotropySlider, "AnisotropySlider");
|
|
|
|
|
getWidget(mTextureFilteringButton, "TextureFilteringButton");
|
|
|
|
|
getWidget(mAnisotropyLabel, "AnisotropyLabel");
|
|
|
|
|
getWidget(mAnisotropyBox, "AnisotropyBox");
|
|
|
|
|
getWidget(mShadersButton, "ShadersButton");
|
|
|
|
|
getWidget(mShadowsEnabledButton, "ShadowsEnabledButton");
|
|
|
|
|
getWidget(mShadowsTextureSize, "ShadowsTextureSize");
|
|
|
|
|
getWidget(mControlsBox, "ControlsBox");
|
|
|
|
|
getWidget(mResetControlsButton, "ResetControlsButton");
|
|
|
|
|
getWidget(mDifficultySlider, "DifficultySlider");
|
|
|
|
|
getWidget(mKeyboardSwitch, "KeyboardButton");
|
|
|
|
|
getWidget(mControllerSwitch, "ControllerButton");
|
|
|
|
|
getWidget(mWaterTextureSize, "WaterTextureSize");
|
|
|
|
@ -238,7 +251,6 @@ namespace MWGui
|
|
|
|
|
|
|
|
|
|
std::string tmip = Settings::Manager::getString("texture mipmap", "General");
|
|
|
|
|
mTextureFilteringButton->setCaption(textureMipmappingToStr(tmip));
|
|
|
|
|
mAnisotropyLabel->setCaption("Anisotropy (" + MyGUI::utility::toString(Settings::Manager::getInt("anisotropy", "General")) + ")");
|
|
|
|
|
|
|
|
|
|
int waterTextureSize = Settings::Manager::getInt ("rtt size", "Water");
|
|
|
|
|
if (waterTextureSize >= 512)
|
|
|
|
@ -255,15 +267,6 @@ namespace MWGui
|
|
|
|
|
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"));
|
|
|
|
|
|
|
|
|
|
mKeyboardSwitch->setStateSelected(true);
|
|
|
|
@ -439,6 +442,7 @@ namespace MWGui
|
|
|
|
|
{
|
|
|
|
|
if (getSettingType(scroller) == "Slider")
|
|
|
|
|
{
|
|
|
|
|
std::string valueStr;
|
|
|
|
|
if (getSettingValueType(scroller) == "Float")
|
|
|
|
|
{
|
|
|
|
|
float value = pos / float(scroller->getScrollRange()-1);
|
|
|
|
@ -447,28 +451,15 @@ namespace MWGui
|
|
|
|
|
getSettingMinMax(scroller, min, max);
|
|
|
|
|
value = min + (max-min) * value;
|
|
|
|
|
Settings::Manager::setFloat(getSettingName(scroller), getSettingCategory(scroller), 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)) + ")");
|
|
|
|
|
}
|
|
|
|
|
valueStr = MyGUI::utility::toString(int(value));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Settings::Manager::setInt(getSettingName(scroller), getSettingCategory(scroller), pos);
|
|
|
|
|
if (scroller == mAnisotropySlider)
|
|
|
|
|
{
|
|
|
|
|
mAnisotropyLabel->setCaption("Anisotropy (" + MyGUI::utility::toString(pos) + ")");
|
|
|
|
|
}
|
|
|
|
|
valueStr = MyGUI::utility::toString(pos);
|
|
|
|
|
}
|
|
|
|
|
updateSliderLabel(scroller, valueStr);
|
|
|
|
|
|
|
|
|
|
apply();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|