Skip to content

Commit f4df5e9

Browse files
committed
Update UI.lua
* Fixed Populating frames with hide/show completed
1 parent 17a5b2e commit f4df5e9

1 file changed

Lines changed: 76 additions & 37 deletions

File tree

UI.lua

Lines changed: 76 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3344,6 +3344,30 @@ function MR:RefreshUI()
33443344
end
33453345
end
33463346

3347+
local function ReleaseConfigWidgetTree(frame)
3348+
if not frame then
3349+
return
3350+
end
3351+
3352+
local children = { frame:GetChildren() }
3353+
for _, child in ipairs(children) do
3354+
ReleaseConfigWidgetTree(child)
3355+
end
3356+
3357+
if frame.GetObjectType and frame:GetObjectType() == "Button" then
3358+
frame:SetScript("OnClick", nil)
3359+
frame:SetScript("OnEnter", nil)
3360+
frame:SetScript("OnLeave", nil)
3361+
frame:SetScript("OnMouseDown", nil)
3362+
frame:SetScript("OnMouseUp", nil)
3363+
end
3364+
3365+
frame:SetScript("OnUpdate", nil)
3366+
frame:EnableMouse(false)
3367+
frame:Hide()
3368+
frame:SetParent(nil)
3369+
end
3370+
33473371
function MR:ApplySharedMediaSettings()
33483372
if ns.ApplySharedMedia then
33493373
ns.ApplySharedMedia(self.GetActiveMediaSettings and self:GetActiveMediaSettings() or (self.db and self.db.profile))
@@ -4129,28 +4153,7 @@ end
41294153

41304154
function MR:PopulateConfigFrame(f)
41314155
if f.body then
4132-
local children = { f.body:GetChildren() }
4133-
for _, child in ipairs(children) do
4134-
local grandchildren = { child:GetChildren() }
4135-
for _, gc in ipairs(grandchildren) do
4136-
if gc:GetObjectType() == "Button" then
4137-
gc:SetScript("OnClick", nil)
4138-
gc:SetScript("OnEnter", nil)
4139-
gc:SetScript("OnLeave", nil)
4140-
end
4141-
gc:EnableMouse(false)
4142-
gc:Hide()
4143-
end
4144-
if child:GetObjectType() == "Button" then
4145-
child:SetScript("OnClick", nil)
4146-
child:SetScript("OnEnter", nil)
4147-
child:SetScript("OnLeave", nil)
4148-
end
4149-
child:EnableMouse(false)
4150-
child:Hide()
4151-
end
4152-
f.body:Hide()
4153-
f.body:SetParent(UIParent)
4156+
ReleaseConfigWidgetTree(f.body)
41544157
f.body = nil
41554158
end
41564159

@@ -4921,6 +4924,23 @@ function MR:PopulateConfigFrame(f)
49214924

49224925
if not MR._cfgExpanded then MR._cfgExpanded = {} end
49234926

4927+
local function ApplyToggleButtonState(btn, fs, active)
4928+
if not (btn and fs) then
4929+
return
4930+
end
4931+
4932+
btn:SetBackdropColor(0.05, 0.10, 0.18, 1)
4933+
btn:SetBackdropBorderColor(
4934+
active and 0.15 or 0.35,
4935+
active and 0.32 or 0.12,
4936+
active and 0.38 or 0.12, 1)
4937+
fs:SetText(active and "H" or "S")
4938+
fs:SetTextColor(
4939+
active and 0.45 or 0.55,
4940+
active and 0.75 or 0.25,
4941+
active and 0.70 or 0.25)
4942+
end
4943+
49244944
local function BuildHideCompleteBtn(parent, key, anchorRight)
49254945
local hideActive = MR:IsModuleHideComplete(key)
49264946
local btn = CreateFrame("Button", nil, parent, "BackdropTemplate")
@@ -4939,11 +4959,11 @@ function MR:PopulateConfigFrame(f)
49394959
local fs = btn:CreateFontString(nil, "OVERLAY")
49404960
fs:SetFont(FONT_ROWS, 8, GetFontFlags())
49414961
fs:SetPoint("CENTER", btn, "CENTER", 0, 0)
4942-
fs:SetText(hideActive and "H" or "S")
4943-
fs:SetTextColor(hideActive and 0.45 or 0.55, hideActive and 0.75 or 0.25, hideActive and 0.70 or 0.25)
4962+
ApplyToggleButtonState(btn, fs, hideActive)
49444963
btn:SetScript("OnClick", function()
4945-
MR:SetModuleHideComplete(key, not MR:IsModuleHideComplete(key))
4946-
MR:PopulateConfigFrame(f)
4964+
local active = not MR:IsModuleHideComplete(key)
4965+
MR:SetModuleHideComplete(key, active)
4966+
ApplyToggleButtonState(btn, fs, active)
49474967
end)
49484968
btn:SetScript("OnEnter", function()
49494969
btn:SetBackdropColor(0.08, 0.22, 0.32, 1)
@@ -5385,10 +5405,37 @@ function MR:PopulateConfigFrame(f)
53855405
enabled and 0.85 or 0.25,
53865406
enabled and 0.70 or 0.25)
53875407

5408+
local function ApplyRowToggleState(isEnabled)
5409+
rdot:SetAlpha(isEnabled and 0.8 or 0.25)
5410+
if not isEnabled then
5411+
rlbl:SetTextColor(0.35, 0.35, 0.35)
5412+
else
5413+
local rRowCustom = MR:GetRowColor(key, rkey)
5414+
local rHeaderCustom = MR.db.profile.headerColors and MR.db.profile.headerColors[key]
5415+
local rEffective = rRowCustom or rHeaderCustom
5416+
if rEffective then
5417+
rlbl:SetTextColor(hex(rEffective))
5418+
else
5419+
rlbl:SetTextColor(0.80, 0.80, 0.80)
5420+
end
5421+
end
5422+
eyeBtn:SetBackdropColor(0.05, 0.10, 0.18, 1)
5423+
eyeBtn:SetBackdropBorderColor(
5424+
isEnabled and 0.15 or 0.35,
5425+
isEnabled and 0.32 or 0.12,
5426+
isEnabled and 0.38 or 0.12, 1)
5427+
eyeLbl:SetText(isEnabled and "o" or "-")
5428+
eyeLbl:SetTextColor(
5429+
isEnabled and 0.25 or 0.55,
5430+
isEnabled and 0.85 or 0.25,
5431+
isEnabled and 0.70 or 0.25)
5432+
end
5433+
53885434
eyeBtn:SetScript("OnClick", function()
5389-
MR:SetRowEnabled(key, rkey, not MR:IsRowEnabled(key, rkey))
5435+
enabled = not MR:IsRowEnabled(key, rkey)
5436+
MR:SetRowEnabled(key, rkey, enabled)
53905437
MR:RefreshUI()
5391-
MR:PopulateConfigFrame(f)
5438+
ApplyRowToggleState(enabled)
53925439
end)
53935440
eyeBtn:SetScript("OnEnter", function()
53945441
eyeBtn:SetBackdropColor(0.08, 0.22, 0.32, 1)
@@ -5399,15 +5446,7 @@ function MR:PopulateConfigFrame(f)
53995446
GameTooltip:Show()
54005447
end)
54015448
eyeBtn:SetScript("OnLeave", function()
5402-
eyeBtn:SetBackdropColor(0.05, 0.10, 0.18, 1)
5403-
eyeBtn:SetBackdropBorderColor(
5404-
enabled and 0.15 or 0.35,
5405-
enabled and 0.32 or 0.12,
5406-
enabled and 0.38 or 0.12, 1)
5407-
eyeLbl:SetTextColor(
5408-
enabled and 0.25 or 0.55,
5409-
enabled and 0.85 or 0.25,
5410-
enabled and 0.70 or 0.25)
5449+
ApplyRowToggleState(enabled)
54115450
GameTooltip:Hide()
54125451
end)
54135452

0 commit comments

Comments
 (0)