From 0c6cae0b0442c6317d13f961e5cbcf17e84c8185 Mon Sep 17 00:00:00 2001 From: Sumsebrum Date: Sat, 22 May 2021 13:41:31 +0200 Subject: [PATCH] highlight inset option added --- Frame.lua | 117 +++++++++++++++++++++++++++------------ Modules/BuffsDebuffs.lua | 18 +++--- Modules/Castbar.lua | 2 +- Modules/Classicon.lua | 2 +- Modules/Cooldowns.lua | 15 ++--- Modules/Diminishings.lua | 2 +- Modules/Healthbar.lua | 2 +- Modules/Highlight.lua | 75 +++++++++++++++++++------ Modules/Racial.lua | 8 +-- Modules/Trinket.lua | 2 +- 10 files changed, 166 insertions(+), 77 deletions(-) diff --git a/Frame.lua b/Frame.lua index 83eae02..0b65d81 100644 --- a/Frame.lua +++ b/Frame.lua @@ -30,6 +30,9 @@ Gladdy.BUTTON_DEFAULTS = { function Gladdy:CreateFrame() self.frame = CreateFrame("Frame", "GladdyFrame", UIParent) + --self.frame.texture = self.frame:CreateTexture(nil, "OVERLAY") + --self.frame.texture:SetAllPoints(self.frame) + --self.frame.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp") self.frame:SetClampedToScreen(true) self.frame:EnableMouse(false) @@ -109,48 +112,69 @@ function Gladdy:UpdateFrame() end local teamSize = self.curBracket or 0 - local iconSize = self.db.healthBarHeight - local margin = 0 - local width = self.db.barWidth + self.db.padding * 2 + 5 - local height = self.db.healthBarHeight * teamSize + margin * (teamSize - 1) + self.db.padding * 2 + 5 - local extraBarWidth = 0 - local extraBarHeight = 0 + local highlightBorderSize = (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2) + local leftSize = 0 + local rightSize = 0 + --Trinket + Racial + if self.db.trinketEnabled and self.db.trinketPos == "LEFT" then + leftSize = leftSize + self.db.trinketSize * self.db.trinketWidthFactor + self.db.padding + if self.db.racialEnabled and self.db.racialAnchor == "trinket" and self.db.racialPos == "LEFT" then + leftSize = leftSize + self.db.racialSize * self.db.racialWidthFactor + self.db.padding + end + end + if self.db.trinketEnabled and self.db.trinketPos == "RIGHT" then + rightSize = rightSize + self.db.trinketSize * self.db.trinketWidthFactor + self.db.padding + if self.db.racialEnabled and self.db.racialAnchor == "trinket" and self.db.racialPos == "RIGHT" then + rightSize = rightSize + self.db.racialSize * self.db.racialWidthFactor + self.db.padding + end + end + --ClassIcon + if self.db.classIconPos == "LEFT" then + leftSize = leftSize + self.db.classIconSize * self.db.classIconWidthFactor + self.db.padding + else + rightSize = rightSize + self.db.classIconSize * self.db.classIconWidthFactor + self.db.padding + end + --Highlight + if not self.db.highlightInset then + leftSize = leftSize + self.db.highlightBorderSize + rightSize = rightSize + self.db.highlightBorderSize + end - -- Powerbar - iconSize = iconSize + self.db.powerBarHeight - margin = margin + self.db.powerBarHeight - height = height + self.db.powerBarHeight * teamSize - extraBarHeight = extraBarHeight + self.db.powerBarHeight + local margin = self.db.powerBarHeight + 1 + local width = self.db.barWidth + leftSize + rightSize + local height = (self.db.healthBarHeight + self.db.powerBarHeight + 1) * teamSize + + (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2 * teamSize) + + self.db.bottomMargin * (teamSize - 1) - -- Cooldown - margin = margin + 1 + self.db.highlightBorderSize * 2 + 1 -- + 1 space between health and power bar - height = height + self.db.highlightBorderSize * teamSize + -- Highlight + margin = margin + highlightBorderSize if (self.db.cooldownYPos == "TOP" or self.db.cooldownYPos == "BOTTOM") and self.db.cooldown then margin = margin + self.db.cooldownSize - height = height + self.db.cooldownSize * teamSize + height = height + self.db.cooldownSize * (teamSize - 1) end if (self.db.buffsCooldownPos == "TOP" or self.db.buffsCooldownPos == "BOTTOM") and self.db.buffsEnabled then margin = margin + self.db.buffsIconSize - height = height + self.db.buffsIconSize * teamSize + height = height + self.db.buffsIconSize * (teamSize - 1) end if (self.db.buffsBuffsCooldownPos == "TOP" or self.db.buffsBuffsCooldownPos == "BOTTOM") and self.db.buffsEnabled then margin = margin + self.db.buffsBuffsIconSize - height = height + self.db.buffsBuffsIconSize * teamSize + height = height + self.db.buffsBuffsIconSize * (teamSize - 1) end if self.db.buffsCooldownPos == "TOP" and self.db.cooldownYPos == "TOP" and self.db.cooldown and self.db.buffsEnabled then margin = margin + 1 + height = height + (teamSize - 1) end if self.db.buffsCooldownPos == "BOTTOM" and self.db.cooldownYPos == "BOTTOM" and self.db.cooldown and self.db.buffsEnabled then margin = margin + 1 + height = height + (teamSize - 1) end - -- Classicon - width = width + iconSize - extraBarWidth = extraBarWidth + iconSize - - -- Trinket - width = width + iconSize + -- GrowDirection + if (self.db.growDirection == "LEFT" or self.db.growDirection == "RIGHT") then + width = self.db.barWidth * teamSize + (leftSize + rightSize) * teamSize + self.db.bottomMargin * (teamSize - 1) + height = self.db.healthBarHeight + self.db.powerBarHeight + 1 + end self.frame:SetScale(self.db.frameScale) self.frame:SetWidth(width) @@ -161,53 +185,71 @@ function Gladdy:UpdateFrame() self.frame:SetPoint("CENTER") else local scale = self.frame:GetEffectiveScale() - if (self.db.growUp) then + if (self.db.growDirection == "TOP") then self.frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", self.db.x / scale, self.db.y / scale) else self.frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", self.db.x / scale, self.db.y / scale) end end + --Anchor self.anchor:SetWidth(width) self.anchor:ClearAllPoints() - if (self.db.growUp) then + if (self.db.growDirection == "TOP") then self.anchor:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT") - else + elseif self.growDirection == "BOTTOM" or self.growDirection == "RIGHT" then self.anchor:SetPoint("BOTTOMLEFT", self.frame, "TOPLEFT") + else + self.anchor:SetPoint("BOTTOMRIGHT", self.frame, "TOPRIGHT") end if (self.db.locked) then self.anchor:Hide() - self.anchor:Hide() else self.anchor:Show() end for i = 1, teamSize do local button = self.buttons["arena" .. i] - button:SetWidth(self.db.barWidth + extraBarWidth) + button:SetWidth(self.db.barWidth) button:SetHeight(self.db.healthBarHeight) button.secure:SetWidth(self.db.barWidth) - button.secure:SetHeight(self.db.healthBarHeight + extraBarHeight) + button.secure:SetHeight(self.db.healthBarHeight + self.db.powerBarHeight + 1) button:ClearAllPoints() button.secure:ClearAllPoints() - if (self.db.growUp) then + if (self.db.growDirection == "TOP") then if (i == 1) then - button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", self.db.padding + 2, 0) - button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT") + button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", leftSize, self.db.powerBarHeight + 1) + button.secure:SetPoint("TOPLEFT", button.powerBar, "TOPLEFT") else button:SetPoint("BOTTOMLEFT", self.buttons["arena" .. (i - 1)], "TOPLEFT", 0, margin + self.db.bottomMargin) - button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT") + button.secure:SetPoint("TOPLEFT", button.powerBar, "TOPLEFT") end - else + elseif (self.db.growDirection == "BOTTOM") then if (i == 1) then - button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", self.db.padding + 2, 0) + button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", leftSize, 0) button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT") else button:SetPoint("TOPLEFT", self.buttons["arena" .. (i - 1)], "BOTTOMLEFT", 0, -margin - self.db.bottomMargin) button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT") end + elseif (self.db.growDirection == "LEFT") then + if (i == 1) then + button:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", -rightSize, 0) + button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT") + else + button:SetPoint("TOPRIGHT", self.buttons["arena" .. (i - 1)], "TOPLEFT", -rightSize - leftSize - self.db.bottomMargin, 0) + button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT") + end + elseif (self.db.growDirection == "RIGHT") then + if (i == 1) then + button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", leftSize, 0) + button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT") + else + button:SetPoint("TOPLEFT", self.buttons["arena" .. (i - 1)], "TOPRIGHT", leftSize + rightSize + self.db.bottomMargin, 0) + button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT") + end end @@ -258,7 +300,10 @@ function Gladdy:CreateButton(i) local button = CreateFrame("Frame", "GladdyButtonFrame" .. i, self.frame) button:EnableMouse(false) - button:SetAlpha(0) + --button:SetAlpha(0) + --button.texture = button:CreateTexture(nil, "OVERLAY") + --button.texture:SetAllPoints(button) + --button.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp") local secure = CreateFrame("Button", "GladdyButton" .. i, button, "SecureActionButtonTemplate") secure:RegisterForClicks("AnyUp") diff --git a/Modules/BuffsDebuffs.lua b/Modules/BuffsDebuffs.lua index 1d7047e..da0394e 100644 --- a/Modules/BuffsDebuffs.lua +++ b/Modules/BuffsDebuffs.lua @@ -226,15 +226,16 @@ end --------------------------- function BuffsDebuffs:CreateFrame(unit) + local verticalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding local debuffFrame = CreateFrame("Frame", "GladdyDebuffs" .. unit, Gladdy.buttons[unit]) debuffFrame:SetHeight(Gladdy.db.buffsIconSize) debuffFrame:SetWidth(1) - debuffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPLEFT", 0, Gladdy.db.highlightBorderSize + Gladdy.db.padding) + debuffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPLEFT", 0, verticalMargin) debuffFrame.unit = unit local buffFrame = CreateFrame("Frame", "GladdyBuffs" .. unit, Gladdy.buttons[unit]) buffFrame:SetHeight(Gladdy.db.buffsIconSize) buffFrame:SetWidth(1) - buffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPLEFT", 0, Gladdy.db.highlightBorderSize + Gladdy.db.padding) + buffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPLEFT", 0, verticalMargin) buffFrame.unit = unit self.frames[unit] = {} self.frames[unit].buffFrame = buffFrame @@ -277,7 +278,9 @@ end function BuffsDebuffs:UpdateFrame(unit) self.frames[unit].debuffFrame:SetHeight(Gladdy.db.buffsIconSize) self.frames[unit].debuffFrame:ClearAllPoints() - local horizontalMargin = Gladdy.db.highlightBorderSize + + --DEBUFFS + local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) local verticalMargin = -(Gladdy.db.powerBarHeight)/2 if Gladdy.db.buffsCooldownPos == "TOP" then verticalMargin = horizontalMargin + 1 @@ -300,7 +303,7 @@ function BuffsDebuffs:UpdateFrame(unit) self.frames[unit].debuffFrame:SetPoint("TOPRIGHT", Gladdy.buttons[unit].powerBar, "BOTTOMLEFT", Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset -verticalMargin) end elseif Gladdy.db.buffsCooldownPos == "LEFT" then - horizontalMargin = Gladdy.db.highlightBorderSize - 1 + Gladdy.db.padding + horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding local anchor = Gladdy:GetAnchor(unit, "LEFT") if anchor == Gladdy.buttons[unit].healthBar then self.frames[unit].debuffFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset) @@ -318,9 +321,10 @@ function BuffsDebuffs:UpdateFrame(unit) end end + --BUFFS self.frames[unit].buffFrame:SetHeight(Gladdy.db.buffsBuffsIconSize) self.frames[unit].buffFrame:ClearAllPoints() - horizontalMargin = Gladdy.db.highlightBorderSize + horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) verticalMargin = -(Gladdy.db.powerBarHeight)/2 if Gladdy.db.buffsBuffsCooldownPos == "TOP" then verticalMargin = horizontalMargin + 1 @@ -369,7 +373,7 @@ function BuffsDebuffs:UpdateFrame(unit) --self.frames[unit].buffFrame:SetPoint("RIGHT", Gladdy.buttons[unit].healthBar, "LEFT", -horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin) local anchor = Gladdy:GetAnchor(unit, "LEFT") - horizontalMargin = Gladdy.db.highlightBorderSize - 1 + Gladdy.db.padding + horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) - 1 + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then self.frames[unit].buffFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset) else @@ -403,7 +407,7 @@ function BuffsDebuffs:UpdateFrame(unit) --self.frames[unit].buffFrame:SetPoint("LEFT", Gladdy.buttons[unit].healthBar, "RIGHT", horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin) local anchor = Gladdy:GetAnchor(unit, "RIGHT") - horizontalMargin = Gladdy.db.highlightBorderSize - 1 + Gladdy.db.padding + horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) - 1 + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then self.frames[unit].buffFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset) else diff --git a/Modules/Castbar.lua b/Modules/Castbar.lua index 2a746f0..7f1c07c 100644 --- a/Modules/Castbar.lua +++ b/Modules/Castbar.lua @@ -165,7 +165,7 @@ function Castbar:UpdateFrame(unit) end castBar:ClearAllPoints() - local horizontalMargin = Gladdy.db.highlightBorderSize + Gladdy.db.padding + local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding if (Gladdy.db.castBarPos == "LEFT") then local anchor = Gladdy:GetAnchor(unit, "LEFT") if anchor == Gladdy.buttons[unit].healthBar then diff --git a/Modules/Classicon.lua b/Modules/Classicon.lua index 5474b40..480989a 100644 --- a/Modules/Classicon.lua +++ b/Modules/Classicon.lua @@ -120,7 +120,7 @@ function Classicon:UpdateFrame(unit) classIcon:SetHeight(Gladdy.db.classIconSize) classIcon:ClearAllPoints() - local margin = Gladdy.db.highlightBorderSize + Gladdy.db.padding + local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding if (Gladdy.db.classIconPos == "LEFT") then classIcon:SetPoint("TOPRIGHT", Gladdy.buttons[unit].healthBar, "TOPLEFT", -margin, 0) else diff --git a/Modules/Cooldowns.lua b/Modules/Cooldowns.lua index 9b587df..46406c9 100644 --- a/Modules/Cooldowns.lua +++ b/Modules/Cooldowns.lua @@ -135,29 +135,30 @@ function Cooldowns:UpdateFrame(unit) if (Gladdy.db.cooldown) then button.spellCooldownFrame:ClearAllPoints() local verticalMargin = -(Gladdy.db.powerBarHeight)/2 + local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) if Gladdy.db.cooldownYPos == "TOP" then if Gladdy.db.cooldownXPos == "RIGHT" then - button.spellCooldownFrame:SetPoint("BOTTOMRIGHT", button.healthBar, "TOPRIGHT", Gladdy.db.cooldownXOffset, Gladdy.db.highlightBorderSize + Gladdy.db.cooldownYOffset) -- needs to be properly anchored after trinket + button.spellCooldownFrame:SetPoint("BOTTOMRIGHT", button.healthBar, "TOPRIGHT", Gladdy.db.cooldownXOffset, horizontalMargin + Gladdy.db.cooldownYOffset) else - button.spellCooldownFrame:SetPoint("BOTTOMLEFT", button.healthBar, "TOPLEFT", Gladdy.db.cooldownXOffset, Gladdy.db.highlightBorderSize + Gladdy.db.cooldownYOffset) + button.spellCooldownFrame:SetPoint("BOTTOMLEFT", button.healthBar, "TOPLEFT", Gladdy.db.cooldownXOffset, horizontalMargin + Gladdy.db.cooldownYOffset) end elseif Gladdy.db.cooldownYPos == "BOTTOM" then if Gladdy.db.cooldownXPos == "RIGHT" then - button.spellCooldownFrame:SetPoint("TOPRIGHT", button.powerBar, "BOTTOMRIGHT", Gladdy.db.cooldownXOffset, -Gladdy.db.highlightBorderSize + Gladdy.db.cooldownYOffset) -- needs to be properly anchored after trinket + button.spellCooldownFrame:SetPoint("TOPRIGHT", button.powerBar, "BOTTOMRIGHT", Gladdy.db.cooldownXOffset, -horizontalMargin + Gladdy.db.cooldownYOffset) else - button.spellCooldownFrame:SetPoint("TOPLEFT", button.powerBar, "BOTTOMLEFT", Gladdy.db.cooldownXOffset, -Gladdy.db.highlightBorderSize + Gladdy.db.cooldownYOffset) + button.spellCooldownFrame:SetPoint("TOPLEFT", button.powerBar, "BOTTOMLEFT", Gladdy.db.cooldownXOffset, -horizontalMargin + Gladdy.db.cooldownYOffset) end elseif Gladdy.db.cooldownYPos == "LEFT" then local anchor = Gladdy:GetAnchor(unit, "LEFT") if anchor == Gladdy.buttons[unit].healthBar then - button.spellCooldownFrame:SetPoint("RIGHT", anchor, "LEFT", -(Gladdy.db.highlightBorderSize + Gladdy.db.padding) + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset) + button.spellCooldownFrame:SetPoint("RIGHT", anchor, "LEFT", -(horizontalMargin + Gladdy.db.padding) + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset) else button.spellCooldownFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset) end elseif Gladdy.db.cooldownYPos == "RIGHT" then local anchor = Gladdy:GetAnchor(unit, "RIGHT") if anchor == Gladdy.buttons[unit].healthBar then - button.spellCooldownFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.highlightBorderSize + Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset) + button.spellCooldownFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset) else button.spellCooldownFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset) end @@ -601,7 +602,7 @@ function Cooldowns:GetOptions() desc = L["Size of each cd icon"], order = 4, min = 5, - max = (Gladdy.db.healthBarHeight + Gladdy.db.castBarHeight + Gladdy.db.powerBarHeight + Gladdy.db.bottomMargin) / 2, + max = 50, }), cooldownWidthFactor = Gladdy:option({ type = "range", diff --git a/Modules/Diminishings.lua b/Modules/Diminishings.lua index 245e059..2cba67a 100644 --- a/Modules/Diminishings.lua +++ b/Modules/Diminishings.lua @@ -162,7 +162,7 @@ function Diminishings:UpdateFrame(unit) end drFrame:ClearAllPoints() - local horizontalMargin = Gladdy.db.highlightBorderSize + Gladdy.db.padding + local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding if (Gladdy.db.drCooldownPos == "LEFT") then local anchor = Gladdy:GetAnchor(unit, "LEFT") if anchor == Gladdy.buttons[unit].healthBar then diff --git a/Modules/Healthbar.lua b/Modules/Healthbar.lua index e6f739b..2418535 100644 --- a/Modules/Healthbar.lua +++ b/Modules/Healthbar.lua @@ -164,7 +164,7 @@ function Healthbar:UpdateFrame(unit) edgeSize = Gladdy.db.healthBarBorderSize }) healthBar:SetBackdropBorderColor(Gladdy.db.healthBarBorderColor.r, Gladdy.db.healthBarBorderColor.g, Gladdy.db.healthBarBorderColor.b, Gladdy.db.healthBarBorderColor.a) healthBar:ClearAllPoints() - healthBar:SetPoint("TOPLEFT", Gladdy.buttons[unit], "TOPLEFT", iconSize, 0) + healthBar:SetPoint("TOPLEFT", Gladdy.buttons[unit], "TOPLEFT", 0, 0) healthBar:SetPoint("BOTTOMRIGHT", Gladdy.buttons[unit], "BOTTOMRIGHT") healthBar.hp:SetStatusBarTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.healthBarTexture)) diff --git a/Modules/Highlight.lua b/Modules/Highlight.lua index 9513193..a543dab 100644 --- a/Modules/Highlight.lua +++ b/Modules/Highlight.lua @@ -3,10 +3,12 @@ local CreateFrame, UnitIsUnit = CreateFrame, UnitIsUnit local Gladdy = LibStub("Gladdy") local L = Gladdy.L local Highlight = Gladdy:NewModule("Highlight", nil, { - highlightBorderSize = 2, + highlightBorderSize = 1, + highlightInset = false, targetBorderColor = { r = 1, g = 0.8, b = 0, a = 1 }, focusBorderColor = { r = 1, g = 0, b = 0, a = 1 }, leaderBorderColor = { r = 0, g = 1, b = 0, a = 1 }, + highlightBorderStyle = "Square Full White", highlight = true, targetBorder = true, focusBorder = true, @@ -53,17 +55,17 @@ function Highlight:CreateFrame(unit) local healthBar = Gladdy.modules.Healthbar.frames[unit] local targetBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate") - targetBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = Gladdy.db.highlightBorderSize }) + targetBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = Gladdy.db.highlightBorderSize }) --targetBorder:SetFrameStrata("MEDIUM") targetBorder:Hide() local focusBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate") - focusBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = Gladdy.db.highlightBorderSize }) + focusBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = Gladdy.db.highlightBorderSize }) --focusBorder:SetFrameStrata("MEDIUM") focusBorder:Hide() local leaderBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate") - leaderBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = Gladdy.db.highlightBorderSize }) + leaderBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = Gladdy.db.highlightBorderSize }) --leaderBorder:SetFrameStrata("MEDIUM") leaderBorder:Hide() @@ -88,29 +90,48 @@ function Highlight:UpdateFrame(unit) end local borderSize = Gladdy.db.highlightBorderSize + local borderOffset = borderSize local iconSize = Gladdy.db.healthBarHeight + Gladdy.db.powerBarHeight + 1 - local width = Gladdy.db.barWidth + borderSize * 2 - local height = iconSize + borderSize * 2 + local width = Gladdy.db.barWidth + (Gladdy.db.highlightInset and 0 or borderSize * 2) + local height = iconSize + (Gladdy.db.highlightInset and 0 or borderSize * 2) button.targetBorder:SetWidth(width) button.targetBorder:SetHeight(height) button.targetBorder:ClearAllPoints() - button.targetBorder:SetPoint("TOP", button.healthBar, "TOP", 0, borderSize) - button.targetBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = borderSize }) + if Gladdy.db.highlightInset then + button.targetBorder:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", -(borderOffset/Gladdy.db.statusbarBorderOffset), (borderOffset/Gladdy.db.statusbarBorderOffset)) + button.targetBorder:SetPoint("BOTTOMRIGHT", button.powerBar, "BOTTOMRIGHT", (borderOffset/Gladdy.db.statusbarBorderOffset), -(borderOffset/Gladdy.db.statusbarBorderOffset)) + else + button.targetBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize)) + end + + button.targetBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize }) button.targetBorder:SetBackdropBorderColor(Gladdy.db.targetBorderColor.r, Gladdy.db.targetBorderColor.g, Gladdy.db.targetBorderColor.b, Gladdy.db.targetBorderColor.a) button.focusBorder:SetWidth(width) button.focusBorder:SetHeight(height) button.focusBorder:ClearAllPoints() - button.focusBorder:SetPoint("TOP", button.healthBar, "TOP", 0, borderSize) - button.focusBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = borderSize }) + if Gladdy.db.highlightInset then + button.focusBorder:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", -(borderOffset/Gladdy.db.statusbarBorderOffset), (borderOffset/Gladdy.db.statusbarBorderOffset)) + button.focusBorder:SetPoint("BOTTOMRIGHT", button.powerBar, "BOTTOMRIGHT", (borderOffset/Gladdy.db.statusbarBorderOffset), -(borderOffset/Gladdy.db.statusbarBorderOffset)) + else + button.focusBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize)) + end + + button.focusBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize }) button.focusBorder:SetBackdropBorderColor(Gladdy.db.focusBorderColor.r, Gladdy.db.focusBorderColor.g, Gladdy.db.focusBorderColor.b, Gladdy.db.focusBorderColor.a) button.leaderBorder:SetWidth(width) button.leaderBorder:SetHeight(height) button.leaderBorder:ClearAllPoints() - button.leaderBorder:SetPoint("TOP", button.healthBar, "TOP", 0, borderSize) - button.leaderBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = borderSize }) + if Gladdy.db.highlightInset then + button.leaderBorder:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", -(borderOffset/Gladdy.db.statusbarBorderOffset), (borderOffset/Gladdy.db.statusbarBorderOffset)) + button.leaderBorder:SetPoint("BOTTOMRIGHT", button.powerBar, "BOTTOMRIGHT", (borderOffset/Gladdy.db.statusbarBorderOffset), -(borderOffset/Gladdy.db.statusbarBorderOffset)) + else + button.leaderBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize)) + end + + button.leaderBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize }) button.leaderBorder:SetBackdropBorderColor(Gladdy.db.leaderBorderColor.r, Gladdy.db.leaderBorderColor.g, Gladdy.db.leaderBorderColor.b, Gladdy.db.leaderBorderColor.a) if Gladdy.frame.testing then Highlight:Test(unit) @@ -179,34 +200,52 @@ function Highlight:GetOptions() name = L["Highlight"], order = 2, }, - highlightBorderSize = { + highlightInset = Gladdy:option({ + type = "toggle", + name = L["Show Inside"], + desc = L["Show Highlight border inside of frame"], + order = 3, + }), + highlightBorderSize = Gladdy:option({ type = "range", name = L["Border size"], desc = L["Border size"], - order = 3, + order = 4, min = 1, - max = 10, + max = 20, step = 1, + }), + highlightBorderStyle = Gladdy:option({ + type = "select", + name = L["Border style"], + order = 5, + dialogControl = "LSM30_Border", + values = AceGUIWidgetLSMlists.border, + }), + headerColor = { + type = "header", + name = L["Colors"], + order = 6, }, targetBorderColor = Gladdy:colorOption({ type = "color", name = L["Target border color"], desc = L["Color of the selected targets border"], - order = 4, + order = 7, hasAlpha = true, }), focusBorderColor = Gladdy:colorOption({ type = "color", name = L["Focus border color"], desc = L["Color of the focus border"], - order = 5, + order = 8, hasAlpha = true, }), leaderBorderColor = Gladdy:colorOption({ type = "color", name = L["Raid leader border color"], desc = L["Color of the raid leader border"], - order = 6, + order = 9, hasAlpha = true, }), headerEnable = { diff --git a/Modules/Racial.lua b/Modules/Racial.lua index f2ea005..8fcc2a1 100644 --- a/Modules/Racial.lua +++ b/Modules/Racial.lua @@ -134,7 +134,7 @@ function Racial:UpdateFrame(unit) racial.texture.overlay:SetVertexColor(Gladdy.db.racialBorderColor.r, Gladdy.db.racialBorderColor.g, Gladdy.db.racialBorderColor.b, Gladdy.db.racialBorderColor.a) racial:ClearAllPoints() - local margin = Gladdy.db.highlightBorderSize + Gladdy.db.padding + local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding local parent = Gladdy.buttons[unit][Gladdy.db.racialAnchor] if (Gladdy.db.racialPos == "RIGHT") then racial:SetPoint(ANCHORS[Gladdy.db.racialPos], parent, Gladdy.db.racialPos, Gladdy.db.padding + Gladdy.db.racialXOffset, Gladdy.db.racialYOffset) @@ -237,7 +237,7 @@ function Racial:GetOptions() header = { type = "header", name = L["Size"], - order = 4, + order = 1, }, racialSize = Gladdy:option({ type = "range", @@ -245,7 +245,7 @@ function Racial:GetOptions() min = 5, max = 100, step = 1, - order = 4, + order = 2, }), racialWidthFactor = Gladdy:option({ type = "range", @@ -253,7 +253,7 @@ function Racial:GetOptions() min = 0.5, max = 2, step = 0.05, - order = 6, + order = 3, }), }, }, diff --git a/Modules/Trinket.lua b/Modules/Trinket.lua index 7fb96f5..b471fd6 100644 --- a/Modules/Trinket.lua +++ b/Modules/Trinket.lua @@ -130,7 +130,7 @@ function Trinket:UpdateFrame(unit) trinket.texture.overlay:SetVertexColor(Gladdy.db.trinketBorderColor.r, Gladdy.db.trinketBorderColor.g, Gladdy.db.trinketBorderColor.b, Gladdy.db.trinketBorderColor.a) trinket:ClearAllPoints() - local margin = Gladdy.db.highlightBorderSize + Gladdy.db.padding + local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding if (Gladdy.db.classIconPos == "LEFT") then if (Gladdy.db.trinketPos == "RIGHT") then trinket:SetPoint("TOPLEFT", Gladdy.buttons[unit].healthBar, "TOPRIGHT", margin, 0)