Skip to content

Commit c3c8618

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 46a2bc9 commit c3c8618

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
@@ -1788,7 +1788,7 @@ Huge sets the radius to 11.
17881788
end
17891789

17901790
modList:NewMod("BossSkillActive", "FLAG", true, "Config")
1791-
1791+
17921792
-- boss specific mods
17931793
if val == "Atziri Flameblast" and isUber then
17941794
enemyModList:NewMod("Damage", "INC", 60, "Alluring Abyss Map Mod")
@@ -1817,7 +1817,7 @@ Huge sets the radius to 11.
18171817

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

0 commit comments

Comments
 (0)