comparison CombatLog.lua @ 159:a3507735dfd9 v75

Fixed a rendering issue with auto-logging checkboxes.
author yellowfive
date Wed, 24 Apr 2019 18:00:42 -0700
parents 6dc0e8e9f960
children 21a69c63fee8
comparison
equal deleted inserted replaced
158:a338b9299e7a 159:a3507735dfd9
6 local _btnToggle = nil 6 local _btnToggle = nil
7 local _panelUndoWipe = nil 7 local _panelUndoWipe = nil
8 local _chkAutoAll = nil 8 local _chkAutoAll = nil
9 local _autoChecks = nil 9 local _autoChecks = nil
10 10
11 local function createDifficultyCheckBox(instanceId, difficultyId) 11 local function createDifficultyCheckBox(instanceId, difficultyId, container)
12 local chk = AceGUI:Create("AmrUiCheckBox") 12 local chk = AceGUI:Create("AmrUiCheckBox")
13 container:AddChild(chk)
13 chk:SetText(L.DifficultyNames[difficultyId]) 14 chk:SetText(L.DifficultyNames[difficultyId])
14 chk:SetCallback("OnClick", function(widget) 15 chk:SetCallback("OnClick", function(widget)
15 Amr:ToggleAutoLog(instanceId, difficultyId) 16 Amr:ToggleAutoLog(instanceId, difficultyId)
16 end) 17 end)
17 18
42 line:SetHeight(1) 43 line:SetHeight(1)
43 line:SetBackgroundColor(Amr.Colors.White) 44 line:SetBackgroundColor(Amr.Colors.White)
44 line:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 1, -7) 45 line:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 1, -7)
45 line:SetPoint("TOPRIGHT", lbl.frame, "BOTTOMRIGHT", 0, -7) 46 line:SetPoint("TOPRIGHT", lbl.frame, "BOTTOMRIGHT", 0, -7)
46 47
47 local chkMythic = createDifficultyCheckBox(instanceId, Amr.Difficulties.Mythic) 48 local chkMythic = createDifficultyCheckBox(instanceId, Amr.Difficulties.Mythic, container)
48 container:AddChild(chkMythic)
49 chkMythic:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", 0, -8) 49 chkMythic:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", 0, -8)
50 50
51 local chkNormal = createDifficultyCheckBox(instanceId, Amr.Difficulties.Normal) 51 local chkNormal = createDifficultyCheckBox(instanceId, Amr.Difficulties.Normal, container)
52 container:AddChild(chkNormal)
53 chkNormal:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", 0, -30) 52 chkNormal:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", 0, -30)
54 53
55 -- find the widest of mythic/normal 54 -- find the widest of mythic/normal
56 local w = math.max(chkMythic:GetWidth(), chkNormal:GetWidth()) 55 local w = math.max(chkMythic:GetWidth(), chkNormal:GetWidth())
57 56
58 local chkHeroic = createDifficultyCheckBox(instanceId, Amr.Difficulties.Heroic) 57 local chkHeroic = createDifficultyCheckBox(instanceId, Amr.Difficulties.Heroic, container)
59 container:AddChild(chkHeroic)
60 chkHeroic:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", w + 20, -8) 58 chkHeroic:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", w + 20, -8)
61 59
62 local chkLfr = createDifficultyCheckBox(instanceId, Amr.Difficulties.Lfr) 60 local chkLfr = createDifficultyCheckBox(instanceId, Amr.Difficulties.Lfr, container)
63 container:AddChild(chkLfr)
64 chkLfr:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", w + 20, -30) 61 chkLfr:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", w + 20, -30)
65 62
66 return lbl, chkNormal 63 return lbl, chkNormal
67 end 64 end
68 65
69 -- renders the main UI for the Combat Log tab 66 -- renders the main UI for the Combat Log tab
70 function Amr:RenderTabLog(container) 67 function Amr:RenderTabLog(container)
71 68
72 -- main commands 69 -- main commands
73 _btnToggle = AceGUI:Create("AmrUiButton") 70 _btnToggle = AceGUI:Create("AmrUiButton")
71 container:AddChild(_btnToggle)
74 _btnToggle:SetText(L.LogButtonStartText) 72 _btnToggle:SetText(L.LogButtonStartText)
75 _btnToggle:SetBackgroundColor(Amr.Colors.Green) 73 _btnToggle:SetBackgroundColor(Amr.Colors.Green)
76 _btnToggle:SetFont(Amr.CreateFont("Bold", 16, Amr.Colors.White)) 74 _btnToggle:SetFont(Amr.CreateFont("Bold", 16, Amr.Colors.White))
77 _btnToggle:SetWidth(200) 75 _btnToggle:SetWidth(200)
78 _btnToggle:SetHeight(26) 76 _btnToggle:SetHeight(26)
79 _btnToggle:SetCallback("OnClick", function() Amr:ToggleLogging() end) 77 _btnToggle:SetCallback("OnClick", function() Amr:ToggleLogging() end)
80 container:AddChild(_btnToggle)
81 _btnToggle:SetPoint("TOPLEFT", container.content, "TOPLEFT", 0, -40) 78 _btnToggle:SetPoint("TOPLEFT", container.content, "TOPLEFT", 0, -40)
82 79
83 _lblLogging = AceGUI:Create("AmrUiLabel") 80 _lblLogging = AceGUI:Create("AmrUiLabel")
84 container:AddChild(_lblLogging) 81 container:AddChild(_lblLogging)
85 _lblLogging:SetText(L.LogNote) 82 _lblLogging:SetText(L.LogNote)
87 _lblLogging:SetFont(Amr.CreateFont("Italic", 14, Amr.Colors.BrightGreen)) 84 _lblLogging:SetFont(Amr.CreateFont("Italic", 14, Amr.Colors.BrightGreen))
88 _lblLogging:SetJustifyH("MIDDLE") 85 _lblLogging:SetJustifyH("MIDDLE")
89 _lblLogging:SetPoint("TOP", _btnToggle.frame, "BOTTOM", 0, -5) 86 _lblLogging:SetPoint("TOP", _btnToggle.frame, "BOTTOM", 0, -5)
90 87
91 local btnReload = AceGUI:Create("AmrUiButton") 88 local btnReload = AceGUI:Create("AmrUiButton")
89 container:AddChild(btnReload)
92 btnReload:SetText(L.LogButtonReloadText) 90 btnReload:SetText(L.LogButtonReloadText)
93 btnReload:SetBackgroundColor(Amr.Colors.Blue) 91 btnReload:SetBackgroundColor(Amr.Colors.Blue)
94 btnReload:SetFont(Amr.CreateFont("Bold", 16, Amr.Colors.White)) 92 btnReload:SetFont(Amr.CreateFont("Bold", 16, Amr.Colors.White))
95 btnReload:SetWidth(200) 93 btnReload:SetWidth(200)
96 btnReload:SetHeight(26) 94 btnReload:SetHeight(26)
97 btnReload:SetCallback("OnClick", ReloadUI) 95 btnReload:SetCallback("OnClick", ReloadUI)
98 container:AddChild(btnReload)
99 btnReload:SetPoint("TOPLEFT", _btnToggle.frame, "TOPRIGHT", 40, 0) 96 btnReload:SetPoint("TOPLEFT", _btnToggle.frame, "TOPRIGHT", 40, 0)
100 97
101 --[[ 98 --[[
102 local lbl = AceGUI:Create("AmrUiLabel") 99 local lbl = AceGUI:Create("AmrUiLabel")
103 lbl:SetText(L.LogReloadNote) 100 lbl:SetText(L.LogReloadNote)
174 lbl:SetText(L.LogAutoTitle) 171 lbl:SetText(L.LogAutoTitle)
175 lbl:SetFont(Amr.CreateFont("Bold", 24, Amr.Colors.TextHeaderActive)) 172 lbl:SetFont(Amr.CreateFont("Bold", 24, Amr.Colors.TextHeaderActive))
176 lbl:SetPoint("TOPLEFT", _btnToggle.frame, "BOTTOMLEFT", 0, -40) 173 lbl:SetPoint("TOPLEFT", _btnToggle.frame, "BOTTOMLEFT", 0, -40)
177 174
178 _chkAutoAll = AceGUI:Create("AmrUiCheckBox") 175 _chkAutoAll = AceGUI:Create("AmrUiCheckBox")
176 container:AddChild(_chkAutoAll)
179 _chkAutoAll:SetText(L.LogAutoAllText) 177 _chkAutoAll:SetText(L.LogAutoAllText)
180 _chkAutoAll:SetCallback("OnClick", function(widget) Amr:ToggleAllAutoLog() end) 178 _chkAutoAll:SetCallback("OnClick", function(widget) Amr:ToggleAllAutoLog() end)
181 container:AddChild(_chkAutoAll)
182 _chkAutoAll:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 1, -15) 179 _chkAutoAll:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 1, -15)
183 180
184 _autoChecks = {} 181 _autoChecks = {}
185 182
186 -- go through all supported instances, rendering in a left->right pattern, 2 per row 183 -- go through all supported instances, rendering in a left->right pattern, 2 per row