Skip to content

Commit ffaf9e1

Browse files
committed
Highlight borders for changed config options in config tab
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 1b9efbd commit ffaf9e1

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
@@ -1763,7 +1763,7 @@ Huge sets the radius to 11.
17631763
end
17641764

17651765
modList:NewMod("BossSkillActive", "FLAG", true, "Config")
1766-
1766+
17671767
-- boss specific mods
17681768
if val == "Atziri Flameblast" and isUber then
17691769
enemyModList:NewMod("Damage", "INC", 60, "Alluring Abyss Map Mod")
@@ -1792,7 +1792,7 @@ Huge sets the radius to 11.
17921792

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

0 commit comments

Comments
 (0)