Skip to content

Commit

Permalink
fix(Panels): Use updated child panel naming scheme to avoid naming co…
Browse files Browse the repository at this point in the history
…nflicts

- Change conceived by and mostly coded by worldygit via PR
  • Loading branch information
Cilraaz committed Sep 15, 2023
1 parent 5bb5fec commit 69b2036
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
26 changes: 13 additions & 13 deletions HeroLib/GUI/Panels.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ local function CreateCheckButton(Parent, Setting, Text, Tooltip, Optionals)
CheckButton.SavedVariablesTable, CheckButton.SavedVariablesKey = Parent.SavedVariablesTable, Setting

-- Frame init
if not LastOptionAttached[Parent.name] then
if not LastOptionAttached[Parent.usedName] then
CheckButton:SetPoint("TOPLEFT", 15, -10)
else
CheckButton:SetPoint("TOPLEFT", LastOptionAttached[Parent.name][1], "BOTTOMLEFT", LastOptionAttached[Parent.name][2], LastOptionAttached[Parent.name][3])
CheckButton:SetPoint("TOPLEFT", LastOptionAttached[Parent.usedName][1], "BOTTOMLEFT", LastOptionAttached[Parent.usedName][2], LastOptionAttached[Parent.usedName][3])
end
LastOptionAttached[Parent.name] = { CheckButton, 0, 0 }
LastOptionAttached[Parent.usedName] = { CheckButton, 0, 0 }

CheckButton:SetChecked(CheckButton.SettingTable[CheckButton.SettingKey])

Expand Down Expand Up @@ -120,12 +120,12 @@ local function CreateDropdown(Parent, Setting, Values, Text, Tooltip, Optionals)
end

-- Frame init
if not LastOptionAttached[Parent.name] then
if not LastOptionAttached[Parent.usedName] then
Dropdown:SetPoint("TOPLEFT", 0, -30)
else
Dropdown:SetPoint("TOPLEFT", LastOptionAttached[Parent.name][1], "BOTTOMLEFT", LastOptionAttached[Parent.name][2] - 15, LastOptionAttached[Parent.name][3] - 20)
Dropdown:SetPoint("TOPLEFT", LastOptionAttached[Parent.usedName][1], "BOTTOMLEFT", LastOptionAttached[Parent.usedName][2] - 15, LastOptionAttached[Parent.usedName][3] - 20)
end
LastOptionAttached[Parent.name] = { Dropdown, 15, 0 }
LastOptionAttached[Parent.usedName] = { Dropdown, 15, 0 }

local function Initialize(Self, Level)
local Info = UIDropDownMenu_CreateInfo()
Expand Down Expand Up @@ -161,12 +161,12 @@ local function CreateSlider(Parent, Setting, Values, Text, Tooltip, Action, Opti
Slider.SavedVariablesTable, Slider.SavedVariablesKey = Parent.SavedVariablesTable, Setting

-- Frame init
if not LastOptionAttached[Parent.name] then
if not LastOptionAttached[Parent.usedName] then
Slider:SetPoint("TOPLEFT", 20, -25)
else
Slider:SetPoint("TOPLEFT", LastOptionAttached[Parent.name][1], "BOTTOMLEFT", LastOptionAttached[Parent.name][2] + 5, LastOptionAttached[Parent.name][3] - 20)
Slider:SetPoint("TOPLEFT", LastOptionAttached[Parent.usedName][1], "BOTTOMLEFT", LastOptionAttached[Parent.usedName][2] + 5, LastOptionAttached[Parent.usedName][3] - 20)
end
LastOptionAttached[Parent.name] = { Slider, -5, -20 }
LastOptionAttached[Parent.usedName] = { Slider, -5, -20 }

Slider:SetMinMaxValues(Values[1], Values[2])
Slider.minValue, Slider.maxValue = Slider:GetMinMaxValues()
Expand Down Expand Up @@ -233,12 +233,12 @@ local function CreateButton(Parent, Setting, Text, Tooltip, Action, Width, Heigh
end

-- Frame init
if not LastOptionAttached[Parent.name] then
if not LastOptionAttached[Parent.usedName] then
Button:SetPoint("TOPLEFT", 15, -10)
else
Button:SetPoint("TOPLEFT", LastOptionAttached[Parent.name][1], "BOTTOMLEFT", LastOptionAttached[Parent.name][2], LastOptionAttached[Parent.name][3])
Button:SetPoint("TOPLEFT", LastOptionAttached[Parent.usedName][1], "BOTTOMLEFT", LastOptionAttached[Parent.usedName][2], LastOptionAttached[Parent.usedName][3])
end
LastOptionAttached[Parent.name] = { Button, 0, 0 }
LastOptionAttached[Parent.usedName] = { Button, 0, 0 }

_G[Button:GetName() .. "Text"]:SetText("|c00dfb802" .. Text .. "|r")

Expand Down Expand Up @@ -284,7 +284,7 @@ function GUI.CreateChildPanel(Parent, CName)
CP.SavedVariablesTable = Parent.SavedVariablesTable
CP.name = CName
CP.parent = Parent.name
CP.usedName = CName:gsub(" ", "")
CP.usedName = ParentName .. "_ChildPanel_" .. CName:gsub(" ", "")
local category = Settings.RegisterCanvasLayoutSubcategory(Parent.category, CP, CName)
Settings.RegisterAddOnCategory(category)
CP.category = category
Expand Down
8 changes: 4 additions & 4 deletions HeroLib/Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ function HL.GUI.CorePanelSettingsInit()
-- GUI
local HLPanel = CreatePanel(HL.GUI, "HeroLib", "PanelFrame", HL.GUISettings, HeroLibDB.GUISettings)
-- Child Panel
local CP_HLGeneral = CreateChildPanel(HLPanel, "HLGeneral")
local CP_General = CreateChildPanel(HLPanel, "General")
-- Debug
CreatePanelOption("CheckButton", CP_HLGeneral, "General.DebugMode", "Enable Debug Mode", "Enable if you want HeroLib to output debug messages.")
CreatePanelOption("CheckButton", CP_General, "General.DebugMode", "Enable Debug Mode", "Enable if you want HeroLib to output debug messages.")
-- ReduceCPULoad
CreatePanelOption("CheckButton", CP_HLGeneral, "General.ReduceCPULoad", "Reduce CPU Load", "Enable if you would like to increase the cycle time of the addon, causing HeroLib and HeroRotation to use less CPU by running through its cycles on a longer delay.")
CreatePanelOption("Slider", CP_HLGeneral, "General.ReduceCPULoadOffset", {0, 1000, 1}, "Reduce CPU Load Offset (|cffff0000WARNING|r)", "Set this value to tell the addon how many more milliseconds to add to HeroLib and HeroRotation's cycle time when the above 'Reduce CPU Load' option is checked. |cffff0000WARNING|r: High values are NOT recommended, as this will cause HeroRotation's suggestions to appear latent. By default, the addon will cycle 15 times per second (its built-in 66ms delay). When 'Reduce CPU Load' is checked, this value will be added to that 66ms. If this value is set to 434, for example, that will add 434ms. This would make HeroRotation only cycle twice per second.")
CreatePanelOption("CheckButton", CP_General, "General.ReduceCPULoad", "Reduce CPU Load", "Enable if you would like to increase the cycle time of the addon, causing HeroLib and HeroRotation to use less CPU by running through its cycles on a longer delay.")
CreatePanelOption("Slider", CP_General, "General.ReduceCPULoadOffset", {0, 1000, 1}, "Reduce CPU Load Offset (|cffff0000WARNING|r)", "Set this value to tell the addon how many more milliseconds to add to HeroLib and HeroRotation's cycle time when the above 'Reduce CPU Load' option is checked. |cffff0000WARNING|r: High values are NOT recommended, as this will cause HeroRotation's suggestions to appear latent. By default, the addon will cycle 15 times per second (its built-in 66ms delay). When 'Reduce CPU Load' is checked, this value will be added to that 66ms. If this value is set to 434, for example, that will add 434ms. This would make HeroRotation only cycle twice per second.")
end

0 comments on commit 69b2036

Please sign in to comment.