Keep only the LUT addition

This commit is contained in:
Giovanni Cocco 2024-09-26 19:15:17 +02:00
parent bff850dadd
commit 931eafd565
6 changed files with 4 additions and 26 deletions

View File

@ -10,7 +10,6 @@
#include "Common/Data/Text/I18n.h"
#include "Common/System/System.h"
#include "Common/System/Request.h"
#include "Core/ConfigSettings.h"
namespace UI {
@ -200,14 +199,6 @@ void PopupSliderChoiceFloat::SetFormat(std::string_view fmt) {
}
}
bool PopupSliderChoiceFloat::perGame() const {
return ConfigSetting::perGame(value_);
}
bool PopupSliderChoice::perGame() const {
return ConfigSetting::perGame(value_);
}
EventReturn PopupSliderChoice::HandleClick(EventParams &e) {
restoreFocus_ = HasFocus();
@ -653,13 +644,7 @@ void AbstractChoiceWithValueDisplay::Draw(UIContext &dc) {
dc.MeasureTextRect(dc.theme->uiFont, scale, scale, valueText, availBounds, &w, &h, ALIGN_RIGHT | ALIGN_VCENTER | FLAG_WRAP_TEXT);
textPadding_.right = w + paddingX;
if (perGame()) {
textPadding_.left = 30;
}
Choice::Draw(dc);
if (perGame()) {
dc.Draw()->DrawImage(ImageID("I_GEAR"), bounds_.x + 22, bounds_.centerY(), 1.0f, style.fgColor, ALIGN_CENTER);
}
int imagePadding = 0;
if (rightIconImage_.isValid()) {
imagePadding = bounds_.h;

View File

@ -297,7 +297,6 @@ public:
protected:
std::string ValueText() const override;
bool perGame() const override;
private:
EventReturn HandleClick(EventParams &e);
@ -336,7 +335,6 @@ public:
protected:
std::string ValueText() const override;
bool perGame() const override;
private:
EventReturn HandleClick(EventParams &e);

View File

@ -18,7 +18,6 @@
#include "Common/TimeUtil.h"
#include "Common/StringUtils.h"
#include "Common/Log.h"
#include "Core/ConfigSettings.h"
namespace UI {
@ -799,10 +798,6 @@ void CheckBox::Draw(UIContext &dc) {
if (!text_.empty()) {
Bounds textBounds(bounds_.x + paddingX, bounds_.y, availWidth, bounds_.h);
if (ConfigSetting::perGame(toggle_)) {
dc.Draw()->DrawImage(ImageID("I_GEAR"), bounds_.x + 22, bounds_.centerY(), 1.0f, style.fgColor, ALIGN_CENTER);
textBounds.x += 30;
}
dc.DrawTextRectSqueeze(text_, textBounds, style.fgColor, ALIGN_VCENTER | FLAG_WRAP_TEXT);
}
dc.Draw()->DrawImage(image, bounds_.x2() - paddingX, bounds_.centerY(), 1.0f, style.fgColor, ALIGN_RIGHT | ALIGN_VCENTER);

View File

@ -829,7 +829,6 @@ public:
}
protected:
virtual std::string ValueText() const = 0;
virtual bool perGame() const { return false; }
float CalculateValueScale(const UIContext &dc, std::string_view valueText, float availWidth) const;

View File

@ -11,8 +11,8 @@ std::unordered_map<void*, ConfigSetting*>& ConfigSetting::getPtrLUT() {
return lut;
}
bool ConfigSetting::perGame(void* ptr) {
return g_Config.bGameSpecific && ConfigSetting::getPtrLUT().count(ptr) > 0 && ConfigSetting::getPtrLUT()[ptr]->PerGame();
bool ConfigSetting::perGame(void *ptr) {
return g_Config.bGameSpecific && getPtrLUT().count(ptr) > 0 && getPtrLUT()[ptr]->PerGame();
}
bool ConfigSetting::Get(const Section *section) const {

View File

@ -227,7 +227,8 @@ struct ConfigSetting {
const Type type_;
static bool perGame(void* ptr);
// Returns false if per-game settings are not currently used
static bool perGame(void *ptr);
private:
CfgFlag flags_;