diff --git a/Client/core/CSettings.cpp b/Client/core/CSettings.cpp index 676a85c966..0eb9a9e58e 100644 --- a/Client/core/CSettings.cpp +++ b/Client/core/CSettings.cpp @@ -240,23 +240,21 @@ void CSettings::ResetGuiPointers() m_pBrightness = NULL; m_pBrightnessValueLabel = NULL; m_pBorderlessGammaToggle = NULL; - m_pBorderlessGammaLabel = NULL; m_pBorderlessGamma = NULL; m_pBorderlessGammaValueLabel = NULL; m_pBorderlessBrightnessToggle = NULL; - m_pBorderlessBrightnessLabel = NULL; m_pBorderlessBrightness = NULL; m_pBorderlessBrightnessValueLabel = NULL; m_pBorderlessContrastToggle = NULL; - m_pBorderlessContrastLabel = NULL; m_pBorderlessContrast = NULL; m_pBorderlessContrastValueLabel = NULL; m_pBorderlessSaturationToggle = NULL; - m_pBorderlessSaturationLabel = NULL; m_pBorderlessSaturation = NULL; m_pBorderlessSaturationValueLabel = NULL; m_pCheckBoxApplyBorderless = NULL; m_pCheckBoxApplyFullscreen = NULL; + m_pPostFXDefButton = NULL; + m_pAnisotropicLabel = NULL; m_pAnisotropic = NULL; m_pAnisotropicValueLabel = NULL; @@ -1434,14 +1432,10 @@ void CSettings::CreateGUI() const float postFxSliderWidth = ComputeSliderWidth(tabPanelSize.fX, postFxSliderColumnX, 220.0f, postFxValueColumnReserve); const float postFxValueColumnX = postFxSliderColumnX + postFxSliderWidth + postFxValueColumnPadding; - m_pBorderlessGammaToggle = reinterpret_cast(pManager->CreateCheckBox(m_pTabPostFX, "")); + m_pBorderlessGammaToggle = reinterpret_cast(pManager->CreateCheckBox(m_pTabPostFX, _("Gamma:"))); m_pBorderlessGammaToggle->SetPosition(CVector2D(postFxCheckboxColumnX, postFxPos.fY)); m_pBorderlessGammaToggle->AutoSize(nullptr, 20.0f); - m_pBorderlessGammaLabel = reinterpret_cast(pManager->CreateLabel(m_pTabPostFX, _("Gamma:"))); - m_pBorderlessGammaLabel->SetPosition(CVector2D(postFxLabelColumnX, postFxPos.fY + 2.0f)); - m_pBorderlessGammaLabel->AutoSize(); - m_pBorderlessGamma = reinterpret_cast(pManager->CreateScrollBar(true, m_pTabPostFX)); m_pBorderlessGamma->SetPosition(CVector2D(postFxSliderColumnX, postFxPos.fY)); m_pBorderlessGamma->SetSize(CVector2D(postFxSliderWidth, 20.0f)); @@ -1449,19 +1443,15 @@ void CSettings::CreateGUI() m_pBorderlessGammaValueLabel = reinterpret_cast(pManager->CreateLabel(m_pTabPostFX, "")); m_pBorderlessGammaValueLabel->SetPosition(CVector2D(postFxValueColumnX, postFxPos.fY + 2.0f)); - m_pBorderlessGammaValueLabel->AutoSize("2.00"); - FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessGamma, m_pBorderlessGammaValueLabel, 220.0f, kSliderLabelSpacing, m_pBorderlessGammaLabel); + m_pBorderlessGammaValueLabel->AutoSize("2.00x"); + FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessGamma, m_pBorderlessGammaValueLabel, 220.0f, kSliderLabelSpacing); postFxPos.fY += postFxRowHeight; - m_pBorderlessBrightnessToggle = reinterpret_cast(pManager->CreateCheckBox(m_pTabPostFX, "")); + m_pBorderlessBrightnessToggle = reinterpret_cast(pManager->CreateCheckBox(m_pTabPostFX, _("Brightness:"))); m_pBorderlessBrightnessToggle->SetPosition(CVector2D(postFxCheckboxColumnX, postFxPos.fY)); m_pBorderlessBrightnessToggle->AutoSize(nullptr, 20.0f); - m_pBorderlessBrightnessLabel = reinterpret_cast(pManager->CreateLabel(m_pTabPostFX, _("Brightness:"))); - m_pBorderlessBrightnessLabel->SetPosition(CVector2D(postFxLabelColumnX, postFxPos.fY + 2.0f)); - m_pBorderlessBrightnessLabel->AutoSize(); - m_pBorderlessBrightness = reinterpret_cast(pManager->CreateScrollBar(true, m_pTabPostFX)); m_pBorderlessBrightness->SetPosition(CVector2D(postFxSliderColumnX, postFxPos.fY)); m_pBorderlessBrightness->SetSize(CVector2D(postFxSliderWidth, 20.0f)); @@ -1470,18 +1460,14 @@ void CSettings::CreateGUI() m_pBorderlessBrightnessValueLabel = reinterpret_cast(pManager->CreateLabel(m_pTabPostFX, "")); m_pBorderlessBrightnessValueLabel->SetPosition(CVector2D(postFxValueColumnX, postFxPos.fY + 2.0f)); m_pBorderlessBrightnessValueLabel->AutoSize("2.00x"); - FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessBrightness, m_pBorderlessBrightnessValueLabel, 220.0f, kSliderLabelSpacing, m_pBorderlessBrightnessLabel); + FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessBrightness, m_pBorderlessBrightnessValueLabel, 220.0f, kSliderLabelSpacing); postFxPos.fY += postFxRowHeight; - m_pBorderlessContrastToggle = reinterpret_cast(pManager->CreateCheckBox(m_pTabPostFX, "")); + m_pBorderlessContrastToggle = reinterpret_cast(pManager->CreateCheckBox(m_pTabPostFX, _("Contrast:"))); m_pBorderlessContrastToggle->SetPosition(CVector2D(postFxCheckboxColumnX, postFxPos.fY)); m_pBorderlessContrastToggle->AutoSize(nullptr, 20.0f); - m_pBorderlessContrastLabel = reinterpret_cast(pManager->CreateLabel(m_pTabPostFX, _("Contrast:"))); - m_pBorderlessContrastLabel->SetPosition(CVector2D(postFxLabelColumnX, postFxPos.fY + 2.0f)); - m_pBorderlessContrastLabel->AutoSize(); - m_pBorderlessContrast = reinterpret_cast(pManager->CreateScrollBar(true, m_pTabPostFX)); m_pBorderlessContrast->SetPosition(CVector2D(postFxSliderColumnX, postFxPos.fY)); m_pBorderlessContrast->SetSize(CVector2D(postFxSliderWidth, 20.0f)); @@ -1490,18 +1476,14 @@ void CSettings::CreateGUI() m_pBorderlessContrastValueLabel = reinterpret_cast(pManager->CreateLabel(m_pTabPostFX, "")); m_pBorderlessContrastValueLabel->SetPosition(CVector2D(postFxValueColumnX, postFxPos.fY + 2.0f)); m_pBorderlessContrastValueLabel->AutoSize("2.00x"); - FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessContrast, m_pBorderlessContrastValueLabel, 220.0f, kSliderLabelSpacing, m_pBorderlessContrastLabel); + FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessContrast, m_pBorderlessContrastValueLabel, 220.0f, kSliderLabelSpacing); postFxPos.fY += postFxRowHeight; - m_pBorderlessSaturationToggle = reinterpret_cast(pManager->CreateCheckBox(m_pTabPostFX, "")); + m_pBorderlessSaturationToggle = reinterpret_cast(pManager->CreateCheckBox(m_pTabPostFX, _("Saturation:"))); m_pBorderlessSaturationToggle->SetPosition(CVector2D(postFxCheckboxColumnX, postFxPos.fY)); m_pBorderlessSaturationToggle->AutoSize(nullptr, 20.0f); - m_pBorderlessSaturationLabel = reinterpret_cast(pManager->CreateLabel(m_pTabPostFX, _("Saturation:"))); - m_pBorderlessSaturationLabel->SetPosition(CVector2D(postFxLabelColumnX, postFxPos.fY + 2.0f)); - m_pBorderlessSaturationLabel->AutoSize(); - m_pBorderlessSaturation = reinterpret_cast(pManager->CreateScrollBar(true, m_pTabPostFX)); m_pBorderlessSaturation->SetPosition(CVector2D(postFxSliderColumnX, postFxPos.fY)); m_pBorderlessSaturation->SetSize(CVector2D(postFxSliderWidth, 20.0f)); @@ -1510,11 +1492,11 @@ void CSettings::CreateGUI() m_pBorderlessSaturationValueLabel = reinterpret_cast(pManager->CreateLabel(m_pTabPostFX, "")); m_pBorderlessSaturationValueLabel->SetPosition(CVector2D(postFxValueColumnX, postFxPos.fY + 2.0f)); m_pBorderlessSaturationValueLabel->AutoSize("2.00x"); - FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessSaturation, m_pBorderlessSaturationValueLabel, 220.0f, kSliderLabelSpacing, m_pBorderlessSaturationLabel); + FinalizeSliderRow(tabPanelSize.fX, m_pBorderlessSaturation, m_pBorderlessSaturationValueLabel, 220.0f, kSliderLabelSpacing); postFxPos.fY += postFxRowHeight + 8.0f; - m_pCheckBoxApplyBorderless = reinterpret_cast(pManager->CreateCheckBox(m_pTabPostFX, _("Apply adjustments in windowed mode"))); + m_pCheckBoxApplyBorderless = reinterpret_cast(pManager->CreateCheckBox(m_pTabPostFX, _("Apply adjustments in windowed/borderless mode"))); m_pCheckBoxApplyBorderless->SetPosition(CVector2D(postFxCheckboxColumnX, postFxPos.fY)); m_pCheckBoxApplyBorderless->AutoSize(nullptr, 20.0f); @@ -1524,6 +1506,13 @@ void CSettings::CreateGUI() m_pCheckBoxApplyFullscreen->SetPosition(CVector2D(postFxCheckboxColumnX, postFxPos.fY)); m_pCheckBoxApplyFullscreen->AutoSize(nullptr, 20.0f); + m_pPostFXDefButton = reinterpret_cast(pManager->CreateButton(m_pTabPostFX, _("Load defaults"))); + m_pPostFXDefButton->SetClickHandler(GUI_CALLBACK(&CSettings::OnPostFXDefaultClick, this)); + m_pPostFXDefButton->AutoSize(NULL, 20.0f, 8.0f); + m_pPostFXDefButton->GetSize(vecSize); + placeBottomRightButton(m_pPostFXDefButton); + m_pPostFXDefButton->SetZOrderingEnabled(false); + /** * Interface/chat Tab **/ @@ -2531,7 +2520,7 @@ void CSettings::UpdatePostFxTab() if (m_pBorderlessGamma) m_pBorderlessGamma->SetScrollPosition(NormalizeSliderValue(gammaValue, kBorderlessGammaMin, kBorderlessGammaMax)); if (m_pBorderlessGammaValueLabel) - m_pBorderlessGammaValueLabel->SetText(SString("%.2f", gammaValue).c_str()); + m_pBorderlessGammaValueLabel->SetText(SString("%.2fx", gammaValue).c_str()); if (m_pBorderlessBrightness) m_pBorderlessBrightness->SetScrollPosition(NormalizeSliderValue(brightnessValue, kBorderlessBrightnessMin, kBorderlessBrightnessMax)); @@ -2729,31 +2718,28 @@ void CSettings::UpdateBorderlessAdjustmentControls() if (m_pBorderlessGamma) m_pBorderlessGamma->SetEnabled(gammaEnabled); - if (m_pBorderlessGammaLabel) - m_pBorderlessGammaLabel->SetEnabled(gammaEnabled); if (m_pBorderlessGammaValueLabel) m_pBorderlessGammaValueLabel->SetEnabled(gammaEnabled); if (m_pBorderlessBrightness) m_pBorderlessBrightness->SetEnabled(brightnessEnabled); - if (m_pBorderlessBrightnessLabel) - m_pBorderlessBrightnessLabel->SetEnabled(brightnessEnabled); if (m_pBorderlessBrightnessValueLabel) m_pBorderlessBrightnessValueLabel->SetEnabled(brightnessEnabled); if (m_pBorderlessContrast) m_pBorderlessContrast->SetEnabled(contrastEnabled); - if (m_pBorderlessContrastLabel) - m_pBorderlessContrastLabel->SetEnabled(contrastEnabled); if (m_pBorderlessContrastValueLabel) m_pBorderlessContrastValueLabel->SetEnabled(contrastEnabled); if (m_pBorderlessSaturation) m_pBorderlessSaturation->SetEnabled(saturationEnabled); - if (m_pBorderlessSaturationLabel) - m_pBorderlessSaturationLabel->SetEnabled(saturationEnabled); if (m_pBorderlessSaturationValueLabel) m_pBorderlessSaturationValueLabel->SetEnabled(saturationEnabled); + + m_pBorderlessGammaToggle->SetEnabled(applyAdjustments); + m_pBorderlessBrightnessToggle->SetEnabled(applyAdjustments); + m_pBorderlessContrastToggle->SetEnabled(applyAdjustments); + m_pBorderlessSaturationToggle->SetEnabled(applyAdjustments); } void CSettings::ResetGTAVolume() @@ -5275,7 +5261,7 @@ bool CSettings::OnBrightnessChanged(CGUIElement* pElement) bool CSettings::OnBorderlessGammaChanged(CGUIElement* pElement) { const float gammaValue = DenormalizeSliderValue(m_pBorderlessGamma->GetScrollPosition(), kBorderlessGammaMin, kBorderlessGammaMax); - m_pBorderlessGammaValueLabel->SetText(SString("%.2f", gammaValue).c_str()); + m_pBorderlessGammaValueLabel->SetText(SString("%.2fx", gammaValue).c_str()); CVARS_SET("borderless_gamma_power", gammaValue); RefreshBorderlessDisplayCalibration(); return true; @@ -5364,6 +5350,25 @@ bool CSettings::OnBorderlessApplyFullscreenClicked(CGUIElement* pElement) return true; } +bool CSettings::OnPostFXDefaultClick(CGUIElement* pElement) +{ + CVARS_SET("borderless_gamma_power", 1.0f); + CVARS_SET("borderless_brightness_scale", 1.0f); + CVARS_SET("borderless_contrast_scale", 1.0f); + CVARS_SET("borderless_saturation_scale", 1.0f); + + CVARS_SET("borderless_gamma_enabled", false); + CVARS_SET("borderless_brightness_enabled", false); + CVARS_SET("borderless_contrast_enabled", false); + CVARS_SET("borderless_saturation_enabled", false); + + CVARS_SET("borderless_apply_windowed", false); + CVARS_SET("borderless_apply_fullscreen", false); + + UpdatePostFxTab(); + return true; +} + bool CSettings::OnAnisotropicChanged(CGUIElement* pElement) { int iAnisotropic = std::min(m_iMaxAnisotropic, (m_pAnisotropic->GetScrollPosition()) * (m_iMaxAnisotropic + 1)); diff --git a/Client/core/CSettings.h b/Client/core/CSettings.h index 075fa761e6..a35cb14f43 100644 --- a/Client/core/CSettings.h +++ b/Client/core/CSettings.h @@ -186,23 +186,20 @@ class CSettings CGUIScrollBar* m_pBrightness; CGUILabel* m_pBrightnessValueLabel; CGUICheckBox* m_pBorderlessGammaToggle; - CGUILabel* m_pBorderlessGammaLabel; CGUIScrollBar* m_pBorderlessGamma; CGUILabel* m_pBorderlessGammaValueLabel; CGUICheckBox* m_pBorderlessBrightnessToggle; - CGUILabel* m_pBorderlessBrightnessLabel; CGUIScrollBar* m_pBorderlessBrightness; CGUILabel* m_pBorderlessBrightnessValueLabel; CGUICheckBox* m_pBorderlessContrastToggle; - CGUILabel* m_pBorderlessContrastLabel; CGUIScrollBar* m_pBorderlessContrast; CGUILabel* m_pBorderlessContrastValueLabel; CGUICheckBox* m_pBorderlessSaturationToggle; - CGUILabel* m_pBorderlessSaturationLabel; CGUIScrollBar* m_pBorderlessSaturation; CGUILabel* m_pBorderlessSaturationValueLabel; CGUICheckBox* m_pCheckBoxApplyBorderless; CGUICheckBox* m_pCheckBoxApplyFullscreen; + CGUIButton* m_pPostFXDefButton; CGUILabel* m_pAnisotropicLabel; CGUIScrollBar* m_pAnisotropic; CGUILabel* m_pAnisotropicValueLabel; @@ -401,6 +398,7 @@ class CSettings bool OnBorderlessSaturationToggleClicked(CGUIElement* pElement); bool OnBorderlessApplyBorderlessClicked(CGUIElement* pElement); bool OnBorderlessApplyFullscreenClicked(CGUIElement* pElement); + bool OnPostFXDefaultClick(CGUIElement* pElement); bool OnAnisotropicChanged(CGUIElement* pElement); bool OnMapAlphaChanged(CGUIElement* pElement); bool OnMasterVolumeChanged(CGUIElement* pElement);