Skip to content

Commit 606790a

Browse files
authored
Highlight borders for changed config options in config tab (#5717)
This highlights borders for controls for changed config options when they are in non-default state. Useful for quickly checking what options user configured and prevents forgetting about some config set by accident (dropdowns in non-default state are especially hard to spot) Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
1 parent 0ffb658 commit 606790a

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

src/Classes/CheckBoxControl.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ function CheckBoxClass:Draw(viewPort, noTooltip)
3838
SetDrawColor(0.33, 0.33, 0.33)
3939
elseif mOver then
4040
SetDrawColor(1, 1, 1)
41+
elseif self.borderFunc then
42+
r, g, b = self.borderFunc()
43+
SetDrawColor(r, g, b)
4144
else
4245
SetDrawColor(0.5, 0.5, 0.5)
4346
end

src/Classes/ConfigTab.lua

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,23 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont
453453
end
454454
end
455455

456+
local innerShown = control.shown
457+
if not varData.doNotHighlight then
458+
control.borderFunc = function()
459+
local shown = type(innerShown) == "boolean" and innerShown or innerShown()
460+
local cur = self.input[varData.var]
461+
local def = self:GetDefaultState(varData.var, type(cur))
462+
if cur ~= nil and cur ~= def then
463+
if not shown then
464+
return 0.753, 0.502, 0.502
465+
end
466+
return 0.451, 0.576, 0.702
467+
end
468+
return 0.5, 0.5, 0.5
469+
end
470+
end
471+
456472
if not varData.hideIfInvalid then
457-
local innerShown = control.shown
458473
control.shown = function()
459474
local shown = type(innerShown) == "boolean" and innerShown or innerShown()
460475
local cur = self.input[varData.var]

src/Classes/DropDownControl.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ function DropDownClass:Draw(viewPort, noTooltip)
235235
SetDrawColor(0.33, 0.33, 0.33)
236236
elseif mOver or self.dropped then
237237
SetDrawColor(1, 1, 1)
238+
elseif self.borderFunc then
239+
r, g, b = self.borderFunc()
240+
SetDrawColor(r, g, b)
238241
else
239242
SetDrawColor(0.5, 0.5, 0.5)
240243
end

src/Classes/EditControl.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ function EditClass:Draw(viewPort, noTooltip)
241241
SetDrawColor(0.33, 0.33, 0.33)
242242
elseif mOver then
243243
SetDrawColor(1, 1, 1)
244+
elseif self.borderFunc then
245+
r, g, b = self.borderFunc()
246+
SetDrawColor(r, g, b)
244247
else
245248
SetDrawColor(0.5, 0.5, 0.5)
246249
end

src/Modules/ConfigOptions.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,7 @@ Huge sets the radius to 11.
18001800
end
18011801

18021802
modList:NewMod("BossSkillActive", "FLAG", true, "Config")
1803-
1803+
18041804
-- boss specific mods
18051805
if val == "Atziri Flameblast" and isUber then
18061806
enemyModList:NewMod("Damage", "INC", 60, "Alluring Abyss Map Mod")
@@ -1829,7 +1829,7 @@ Huge sets the radius to 11.
18291829

18301830
-- Section: Custom mods
18311831
{ section = "Custom Modifiers", col = 1 },
1832-
{ var = "customMods", type = "text", label = "",
1832+
{ var = "customMods", type = "text", label = "", doNotHighlight = true,
18331833
apply = function(val, modList, enemyModList, build)
18341834
for line in val:gmatch("([^\n]*)\n?") do
18351835
local strippedLine = StripEscapes(line):gsub("^[%s?]+", ""):gsub("[%s?]+$", "")

0 commit comments

Comments
 (0)