From 7e042dc3ec8642a52b061b9fa09be5e38ebcec64 Mon Sep 17 00:00:00 2001 From: Parnic Date: Sun, 25 Jul 2010 20:25:17 +0000 Subject: [PATCH] - added optional scaling to spell icons on the cast bars, custom bars, and cooldown bars --- IceCastBar.lua | 28 ++++++++++++++++++++++++++-- modules/CustomBar.lua | 32 ++++++++++++++++++++++++++++++-- modules/CustomCDBar.lua | 32 ++++++++++++++++++++++++++++++-- 3 files changed, 86 insertions(+), 6 deletions(-) diff --git a/IceCastBar.lua b/IceCastBar.lua index 493f0db..7fe76cd 100644 --- a/IceCastBar.lua +++ b/IceCastBar.lua @@ -16,6 +16,8 @@ IceCastBar.prototype.actionMessage = nil IceCastBar.prototype.unit = nil IceCastBar.prototype.current = nil +local AuraIconWidth = 20 +local AuraIconHeight = 20 -- Constructor -- function IceCastBar.prototype:init(name) @@ -65,6 +67,7 @@ function IceCastBar.prototype:GetDefaultSettings() settings["displayAuraIcon"] = false settings["auraIconXOffset"] = 40 settings["auraIconYOffset"] = 0 + settings["auraIconScale"] = 1 settings["reverseChannel"] = true return settings @@ -178,6 +181,27 @@ function IceCastBar.prototype:GetOptions() usage = "", order = 53, } + + opts["auraIconScale"] = { + type = 'range', + min = 0.1, + max = 3.0, + step = 0.05, + name = 'Aura icon scale', + desc = 'Adjusts the size of the aura icon for this bar', + get = function() + return self.moduleSettings.auraIconScale + end, + set = function(v) + self.moduleSettings.auraIconScale = v + self:PositionIcons() + end, + disabled = function() + return not self.moduleSettings.enabled or not self.moduleSettings.displayAuraIcon + end, + usage = "", + order = 54, + } opts["reverseChannel"] = { type = 'toggle', @@ -212,8 +236,6 @@ function IceCastBar.prototype:CreateFrame() self.barFrame.icon = self.barFrame:CreateTexture(nil, "LOW") -- default texture so that 'config mode' can work without activating the bar first self.barFrame.icon:SetTexture("Interface\\Icons\\Spell_Frost_Frost") - self.barFrame.icon:SetWidth(20) - self.barFrame.icon:SetHeight(20) -- this cuts off the border around the buff icon self.barFrame.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) self.barFrame.icon:SetDrawLayer("OVERLAY") @@ -228,6 +250,8 @@ function IceCastBar.prototype:PositionIcons() self.barFrame.icon:ClearAllPoints() self.barFrame.icon:SetPoint("TOPLEFT", self.frame, "TOPLEFT", self.moduleSettings.auraIconXOffset, self.moduleSettings.auraIconYOffset) + self.barFrame.icon:SetWidth(AuraIconWidth * self.moduleSettings.auraIconScale) + self.barFrame.icon:SetHeight(AuraIconHeight * self.moduleSettings.auraIconScale) end diff --git a/modules/CustomBar.lua b/modules/CustomBar.lua index 43960d9..cc014d4 100644 --- a/modules/CustomBar.lua +++ b/modules/CustomBar.lua @@ -5,6 +5,8 @@ IceCustomBar = AceOO.Class(IceUnitBar) local validUnits = {"player", "target", "focus", "pet", "vehicle", "targettarget", "main hand weapon", "off hand weapon"} local buffOrDebuff = {"buff", "debuff"} local validBuffTimers = {"none", "seconds", "minutes:seconds", "minutes"} +local AuraIconWidth = 20 +local AuraIconHeight = 20 IceCustomBar.prototype.auraDuration = 0 IceCustomBar.prototype.auraEndTime = 0 @@ -25,6 +27,10 @@ function IceCustomBar.prototype:Enable(core) self:RegisterEvent("PLAYER_PET_CHANGED", "UpdateCustomBar") self:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateCustomBar") + if self.moduleSettings.auraIconScale == nil then + self.moduleSettings.auraIconScale = 1 + end + self:Show(true) self.unit = self.moduleSettings.myUnit @@ -79,6 +85,7 @@ function IceCustomBar.prototype:GetDefaultSettings() settings["displayAuraIcon"] = false settings["auraIconXOffset"] = 40 settings["auraIconYOffset"] = 0 + settings["auraIconScale"] = 1 settings["exactMatch"] = false return settings @@ -91,8 +98,6 @@ function IceCustomBar.prototype:CreateBar() self.barFrame.icon = self.barFrame:CreateTexture(nil, "LOW") -- default texture so that 'config mode' can work without activating the bar first self.barFrame.icon:SetTexture("Interface\\Icons\\Spell_Frost_Frost") - self.barFrame.icon:SetWidth(20) - self.barFrame.icon:SetHeight(20) -- this cuts off the border around the buff icon self.barFrame.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) self.barFrame.icon:SetDrawLayer("OVERLAY") @@ -108,6 +113,8 @@ function IceCustomBar.prototype:PositionIcons() self.barFrame.icon:ClearAllPoints() self.barFrame.icon:SetPoint("TOPLEFT", self.frame, "TOPLEFT", self.moduleSettings.auraIconXOffset, self.moduleSettings.auraIconYOffset) + self.barFrame.icon:SetWidth(AuraIconWidth * (self.moduleSettings.auraIconScale or 1)) + self.barFrame.icon:SetHeight(AuraIconHeight * (self.moduleSettings.auraIconScale or 1)) end function IceCustomBar.prototype:Redraw() @@ -405,6 +412,27 @@ function IceCustomBar.prototype:GetOptions() usage = "", order = 40.3, } + + opts["auraIconScale"] = { + type = 'range', + min = 0.1, + max = 3.0, + step = 0.05, + name = 'Aura icon scale', + desc = 'Adjusts the size of the aura icon for this bar', + get = function() + return self.moduleSettings.auraIconScale + end, + set = function(v) + self.moduleSettings.auraIconScale = v + self:PositionIcons() + end, + disabled = function() + return not self.moduleSettings.enabled or not self.moduleSettings.displayAuraIcon + end, + usage = "", + order = 40.4, + } return opts end diff --git a/modules/CustomCDBar.lua b/modules/CustomCDBar.lua index 3ea59bb..a789e4f 100644 --- a/modules/CustomCDBar.lua +++ b/modules/CustomCDBar.lua @@ -5,6 +5,8 @@ IceCustomCDBar = AceOO.Class(IceUnitBar) local validDisplayModes = {"Always", "When ready", "When cooling down"} local validBuffTimers = {"none", "seconds", "minutes:seconds", "minutes"} +local AuraIconWidth = 20 +local AuraIconHeight = 20 IceCustomCDBar.prototype.cooldownDuration = 0 IceCustomCDBar.prototype.cooldownEndTime = 0 @@ -28,6 +30,10 @@ function IceCustomCDBar.prototype:Enable(core) self:Show(true) + if self.moduleSettings.auraIconScale == nil then + self.moduleSettings.auraIconScale = 1 + end + self:UpdateCustomBar() self:UpdateIcon() self:EnableUpdates(false) @@ -82,6 +88,7 @@ function IceCustomCDBar.prototype:GetDefaultSettings() settings["displayAuraIcon"] = false settings["auraIconXOffset"] = 40 settings["auraIconYOffset"] = 0 + settings["auraIconScale"] = 1 return settings end @@ -93,8 +100,6 @@ function IceCustomCDBar.prototype:CreateBar() self.barFrame.icon = self.barFrame:CreateTexture(nil, "LOW") -- default texture so that 'config mode' can work without activating the bar first self.barFrame.icon:SetTexture("Interface\\Icons\\Spell_Frost_Frost") - self.barFrame.icon:SetWidth(20) - self.barFrame.icon:SetHeight(20) -- this cuts off the border around the buff icon self.barFrame.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) self.barFrame.icon:SetDrawLayer("OVERLAY") @@ -109,6 +114,8 @@ function IceCustomCDBar.prototype:PositionIcons() self.barFrame.icon:ClearAllPoints() self.barFrame.icon:SetPoint("TOPLEFT", self.frame, "TOPLEFT", self.moduleSettings.auraIconXOffset, self.moduleSettings.auraIconYOffset) + self.barFrame.icon:SetWidth(AuraIconWidth * (self.moduleSettings.auraIconScale or 1)) + self.barFrame.icon:SetHeight(AuraIconHeight * (self.moduleSettings.auraIconScale or 1)) end function IceCustomCDBar.prototype:Redraw() @@ -327,6 +334,27 @@ function IceCustomCDBar.prototype:GetOptions() order = 40.3, } + opts["auraIconScale"] = { + type = 'range', + min = 0.1, + max = 3.0, + step = 0.05, + name = 'Aura icon scale', + desc = 'Adjusts the size of the aura icon for this bar', + get = function() + return self.moduleSettings.auraIconScale + end, + set = function(v) + self.moduleSettings.auraIconScale = v + self:PositionIcons() + end, + disabled = function() + return not self.moduleSettings.enabled or not self.moduleSettings.displayAuraIcon + end, + usage = "", + order = 40.4, + } + return opts end