Skip to content

Commit

Permalink
more options for cooldowns padding and added some new things in the d…
Browse files Browse the repository at this point in the history
…efault profile
  • Loading branch information
Cortes-Jeremy committed Mar 2, 2021
1 parent e32d4ef commit de7c7ff
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 59 deletions.
43 changes: 31 additions & 12 deletions Gladius/frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ local function CastUpdate(self, elapsed)
end
end

local function StyleActionButton(f)
local function StyleActionButton(f, hideBorder, iconPadding)
local name = f:GetName()
local button = _G[name]
local icon = _G[name.."Icon"]
Expand All @@ -56,9 +56,21 @@ local function StyleActionButton(f)

button:SetNormalTexture("Interface\\AddOns\\Gladius\\images\\clean")

if hideBorder then
normalTex:SetAlpha(0)
else
normalTex:SetAlpha(1)
end

icon:SetTexCoord(0.1,0.9,0.1,0.9)
icon:SetPoint("TOPLEFT", button, "TOPLEFT", 2, -2)
icon:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 2)

if iconPadding then
icon:SetPoint("TOPLEFT", button, "TOPLEFT", iconPadding, -iconPadding)
icon:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -iconPadding, iconPadding)
else
icon:SetPoint("TOPLEFT", button, "TOPLEFT", 2, -2)
icon:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 2)
end

--normalTex:SetVertexColor(1,1,1,1)
end
Expand Down Expand Up @@ -333,9 +345,6 @@ function Gladius:CreateButton(i)
for x=1, 14 do
local icon = CreateFrame("CheckButton", "Gladius"..i.."SpellCooldownFrame"..x, spellCooldownFrame, "ActionButtonTemplate")
icon:EnableMouse(false)
if( db.hideCooldownBorder ) then
icon:GetNormalTexture():SetTexCoord(1,1,1,1) -- force removal of ugly black square
end
icon.texture = _G[icon:GetName().."Icon"]
icon.cooldown = _G[icon:GetName().."Cooldown"]
icon.cooldown:SetReverse(false)
Expand Down Expand Up @@ -1227,7 +1236,13 @@ function Gladius:UpdateFrame()
button.spellCooldownFrame:SetHeight(db.barHeight+extraBarHeight)
button.spellCooldownFrame:SetWidth(db.barHeight+extraBarHeight)

-- Update each cooldown icon
-- Update each cooldown icon
local iconPadding = 0
if db.cooldownIconPadding then
iconPadding = db.cooldownIconPadding
else
iconPadding = 2 -- default
end
for i=1,14 do
local icon = button.spellCooldownFrame["icon"..i]
icon:SetHeight(button.spellCooldownFrame:GetHeight()/2)
Expand All @@ -1238,17 +1253,17 @@ function Gladius:UpdateFrame()
if(i==1) then
icon:SetPoint("TOPLEFT",button.spellCooldownFrame)
elseif(i==2) then
icon:SetPoint("TOP",button.spellCooldownFrame["icon"..i-1],"BOTTOM",0,-1)
icon:SetPoint("TOP",button.spellCooldownFrame["icon"..i-1],"BOTTOM",0,-iconPadding)
elseif(i>=3) then
icon:SetPoint("LEFT",button.spellCooldownFrame["icon"..i-2],"RIGHT",1,0)
icon:SetPoint("LEFT",button.spellCooldownFrame["icon"..i-2],"RIGHT",iconPadding,0)
end
else
if(i==1) then
icon:SetPoint("TOPRIGHT",button.spellCooldownFrame)
elseif(i==2) then
icon:SetPoint("TOP",button.spellCooldownFrame["icon"..i-1],"BOTTOM",0,-1)
icon:SetPoint("TOP",button.spellCooldownFrame["icon"..i-1],"BOTTOM",0,-iconPadding)
elseif(i>=3) then
icon:SetPoint("RIGHT",button.spellCooldownFrame["icon"..i-2],"LEFT",-1,0)
icon:SetPoint("RIGHT",button.spellCooldownFrame["icon"..i-2],"LEFT",-iconPadding,0)
end
end

Expand All @@ -1261,7 +1276,11 @@ function Gladius:UpdateFrame()
icon.spellId = nil
icon:SetAlpha(1)
icon.texture:SetTexture("Interface\\Icons\\Spell_Holy_PainSupression")
StyleActionButton(icon)
if db.hideCooldownBorder then
StyleActionButton(icon, true, iconPadding)
else
StyleActionButton(icon, false, iconPadding)
end

if (not self.frame.testing) then
icon:Hide()
Expand Down
1 change: 1 addition & 0 deletions Gladius/localization/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ L["Show cooldown icons"] = "Show cooldown icons"
L["Cooldown list"] = "Cooldown list"
L["Show cooldown"] = "Show cooldown"
L["Hide Cooldown border"] = "Hide Cooldown border"
L["Cooldown icon padding"] = "Cooldown icon padding"
L["Glow when cooldown is active"] = "Glow when cooldown is active"
L["Desaturate used cooldown"] = "Desature used cooldown"
L["Used cooldown opacity"] = "Used cooldown opacity"
Expand Down
111 changes: 64 additions & 47 deletions Gladius/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local spellCache

local defaults = {
profile = {
x=0,
x=0,
y=0,
frameScale = 1,
barWidth=150,
Expand Down Expand Up @@ -119,7 +119,18 @@ local defaults = {
debuffFontSize = 13,
debuffPos = "RIGHT",
debuffs = {},
castBarSpark = true,
castBarOnCast = true,
hideSpellRank = true,
absorbBar = false,
cutawayBar = false,
cooldown = false,
cooldownIconPadding = 2,
hideCooldownBorder = false,
cooldownAuraGlow = true,
cooldownDesaturate = true,
cooldownOpacity = false,
cooldownOpacityValue = 0.5,
cooldownPos = "RIGHT",
cooldownAnnounce = false,
cooldownAnnounceList = {},
Expand Down Expand Up @@ -1713,52 +1724,58 @@ function Gladius:SetupOptions()
order = 10,
name = L["Cooldowns"],
args = {
cooldown = {
type="toggle",
name=L["Show cooldown icons"],
order=0,
},
cooldownPos = {
type="select",
name=L["Cooldown position"],
desc=L["Position of the cooldown icons"],
values = {
["RIGHT"] = L["Right"],
["LEFT"] = L["Left"],
},
order=1,
},
hideCooldownBorder = {
type="toggle",
name=L["Hide Cooldown border"],
order=5,
},
cooldownAuraGlow = {
type="toggle",
name=L["Glow when cooldown is active"],
order=9,
},
cooldownDesaturate = {
type="toggle",
name=L["Desaturate used cooldown"],
order=10,
},
cooldownOpacity = {
type="toggle",
name=L["Cooldown used Opacity"],
order=15,
},
cooldownOpacityValue = {
type="range",
name=L["Used cooldown opacity"],
min=0,
max=1,
step=.01,
order=16,
disabled = function() return not self.db.profile.cooldownOpacity end,
},


cooldown = {
type="toggle",
name=L["Show cooldown icons"],
order=0,
},
cooldownPos = {
type="select",
name=L["Cooldown position"],
desc=L["Position of the cooldown icons"],
values = {
["RIGHT"] = L["Right"],
["LEFT"] = L["Left"],
},
order=1,
},
hideCooldownBorder = {
type="toggle",
name=L["Hide Cooldown border"],
order=5,
},
cooldownIconPadding = {
type="range",
name=L["Cooldown icon padding"],
min=0,
max=5,
step=0.1,
order=6,
},
cooldownAuraGlow = {
type="toggle",
name=L["Glow when cooldown is active"],
order=9,
},
cooldownDesaturate = {
type="toggle",
name=L["Desaturate used cooldown"],
order=10,
},
cooldownOpacity = {
type="toggle",
name=L["Cooldown used Opacity"],
order=15,
},
cooldownOpacityValue = {
type="range",
name=L["Used cooldown opacity"],
min=0,
max=1,
step=.01,
order=16,
disabled = function() return not self.db.profile.cooldownOpacity end,
},
},
}

Expand Down

0 comments on commit de7c7ff

Please sign in to comment.