From 4a5754480e3a6f9b011efd55dbdd7779e96f6a3a Mon Sep 17 00:00:00 2001 From: Tek Hudson Date: Mon, 6 Jan 2020 03:30:38 -0800 Subject: [PATCH] Rename a couple functiuons for readability and add comments --- Options.lua | 42 +++++++++++++++++++++++++++--------------- Options.xml | 8 ++++---- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/Options.lua b/Options.lua index 9b213a1..2704d92 100644 --- a/Options.lua +++ b/Options.lua @@ -2,16 +2,18 @@ function DRUIDBAROptions_OnLoad() UIPanelWindows['DRUIDBAROptionsFrame'] = {area = 'center', pushable = 0}; end +-- Toggles the visibility of the DruidBar options frame function DRUIDBAROptionsFrame_Toggle() if(DRUIDBAROptionsFrame:IsVisible()) then DRUIDBAROptionsFrame:Hide(); else - DRUIDBAR_FrameSet(); DRUIDBAROptionsFrame:Show(); end + renderOptionsFrame(); end -function DRUIDBAROptions_CheckWidth(self) +-- Updates options related to Width +function DRUIDBAROptions_Width(self) if ( DRUIDBAROptionsWidthEditBox:GetText() < "1" ) then DRUIDBAROptionsWidthEditBox:SetText("170"); DruidBarKey.xvar = self:GetNumber(); @@ -26,7 +28,8 @@ function DRUIDBAROptions_CheckWidth(self) end end -function DRUIDBAROptions_CheckHeight(self) +-- Updates options related to Height +function DRUIDBAROptions_Height(self) if ( DRUIDBAROptionsHeightEditBox:GetText() < "1" ) then DRUIDBAROptionsHeightEditBox:SetText("18"); DruidBarKey.yvar = self:GetNumber(); @@ -41,6 +44,7 @@ function DRUIDBAROptions_CheckHeight(self) end end +-- Updates options related to Enabled state of addon function DRUIDBAROptions_Toggle() if(DruidBarKey.Enabled) then DruidBarKey.Enabled = false; @@ -50,53 +54,59 @@ function DRUIDBAROptions_Toggle() -- Incase no other event triggers the redraw, we do this now if not DruidBarUpdateFrame:IsVisible() then DruidBarUpdateFrame:Show(); end end - DRUIDBAR_FrameSet(); + renderOptionsFrame(); end -function DRUIDBAROptions_Vis() +-- Updates options related to Graphics +function DRUIDBAROptions_Graphics() if(DruidBarKey.Graphics) then DruidBarKey.Graphics = false; else DruidBarKey.Graphics = true; end - DRUIDBAR_FrameSet(); + renderOptionsFrame(); end +-- Updates options related to Minimap Button function DRUIDBAROptions_Minimap() if(DruidBarKey.Minimap) then DruidBarKey.Minimap = false; else DruidBarKey.Minimap = true; end - DRUIDBAR_FrameSet(); + renderOptionsFrame(); end +-- Updates options related to Hid in Caster function DRUIDBAROptions_HideInCaster() if(DruidBarKey.HideInCaster) then DruidBarKey.HideInCaster = false; else DruidBarKey.HideInCaster = true; end - DRUIDBAR_FrameSet(); + renderOptionsFrame(); end -function DRUIDBAROptions_Full() +-- Updates options related to +function DRUIDBAROptions_HideWhenFull() if(DruidBarKey.HideWhenFull) then DruidBarKey.HideWhenFull = false; else DruidBarKey.HideWhenFull = true; end - DRUIDBAR_FrameSet(); + renderOptionsFrame(); end +-- Updates options related to display location where we replace the default manabar function DRUIDBAROptions_Replace() DruidBarKey.Replace = true; DruidBarKey.Player = false; DruidBarKey.Custom = false; DruidBarKey.Lock = true; - DRUIDBAR_FrameSet(); + renderOptionsFrame(); end +-- Updates options related to display location where we attach to bottom of player frame function DRUIDBAROptions_Player() DruidBarKey.Replace = false; DruidBarKey.Player = true; @@ -105,9 +115,10 @@ function DRUIDBAROptions_Player() DruidBarKey.xvar = 125; DruidBarKey.yvar = 18; DruidBarKey.Lock = true; - DRUIDBAR_FrameSet(); + renderOptionsFrame(); end +-- Updates options related to display location when bar is customaizable function DRUIDBAROptions_Custom() DruidBarKey.Custom = true; DruidBarKey.Replace = false; @@ -115,16 +126,17 @@ function DRUIDBAROptions_Custom() DruidBarKey.Lock = false; DruidBarKey.xvar = DruidBarKey.tempW; DruidBarKey.yvar = DruidBarKey.tempH; - DRUIDBAR_FrameSet(); + renderOptionsFrame(); end +-- Updates options related to locking bar in place function DRUIDBAROptions_Lock() if(DruidBarKey.Lock) then DruidBarKey.Lock = false; else DruidBarKey.Lock = true; end - DRUIDBAR_FrameSet(); + renderOptionsFrame(); end function DRUIDBAROptions_Text_Initialize() @@ -204,7 +216,7 @@ function DRUIDBAROptions_Percent_OnClick(self) end end -function DRUIDBAR_FrameSet() +function renderOptionsFrame() -- DruidBarKey is not set, get out if not DruidBarKey then return end diff --git a/Options.xml b/Options.xml index deac170..fe0e52d 100644 --- a/Options.xml +++ b/Options.xml @@ -143,7 +143,7 @@ getglobal(self:GetName().."Text"):SetText(DRUIDBAR_OPTIONS_Vis); - DRUIDBAROptions_Vis(); + DRUIDBAROptions_Graphics(); GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); @@ -216,7 +216,7 @@ - DRUIDBAROptions_Full(); + DRUIDBAROptions_HideWhenFull(); @@ -386,7 +386,7 @@ - DRUIDBAROptions_CheckWidth(self); + DRUIDBAROptions_Width(self); @@ -439,7 +439,7 @@ - DRUIDBAROptions_CheckHeight(self); + DRUIDBAROptions_Height(self); -- 1.7.9.5