* Added a backdrop option. No configuration, just on or off.
James Whitehead II [01-02-07 - 00:41]
* Added a backdrop option. No configuration, just on or off.
diff --git a/PerfectRaid_Hacks.lua b/PerfectRaid_Hacks.lua
index 93f0675..c894818 100644
--- a/PerfectRaid_Hacks.lua
+++ b/PerfectRaid_Hacks.lua
@@ -34,21 +34,14 @@ local frames
function Hacks:Initialize()
PerfectRaid.defaults.profile.HacksScale = 1.0
+ PerfectRaid.defaults.profile.HacksBackdrop = false
frames = PerfectRaid.frames
end
-function Hacks:Enable()
-end
-
-function Hacks:Disable()
-end
-
-function Hacks:DONGLE_PROFILE_CHANGED(event, addon, svname, name)
-end
-
function Hacks:ShowButton(button)
self:UpdateScale()
+ self:UpdateBackdrop()
end
local options
@@ -68,6 +61,10 @@ function Hacks:CreateOptions(opt)
slider:SetValueStep(0.05)
table.insert(options.widgets, slider)
+ local check = CreateFrame("CheckButton", "PRHacks_Backdrop", options, "PRCheckTemplate")
+ check.Label:SetText("Put a backdrop behind PerfectRaid")
+ table.insert(options.widgets, check)
+
slider:SetScript("OnValueChanged", function(frame)
frame.Current:SetText(string.format("%0.2f", frame:GetValue()))
self:UpdateScale(frame:GetValue())
@@ -99,15 +96,39 @@ function Hacks:OnShow()
local profile = PerfectRaid.db.profile
PRHacks_Scale:SetValue(profile.HacksScale)
+ PRHacks_Backdrop:SetChecked(profile.HacksBackdrop)
self:UpdateScale()
+ self:UpdateBackdrop()
end
function Hacks:SaveOptions()
local profile = PerfectRaid.db.profile
profile.HacksScale = PRHacks_Scale:GetValue()
+ profile.HacksBackdrop = PRHacks_Backdrop:GetChecked()
self:UpdateScale()
self:SavePositions()
+ self:UpdateBackdrop()
+end
+
+function Hacks:UpdateBackdrop()
+ if not PRHeader1 or not PRHeader8 or not PRHeader4 or not PRHeader8:GetRect() then return end
+ if not self.backdrop then
+ self.backdrop = PRHeader1:CreateTexture(nil, "BACKGROUND")
+ self.backdrop:SetPoint("TOPLEFT", PRHeader1, "TOPLEFT", -5 , 15)
+ self.backdrop:SetPoint("RIGHT", PRHeader8, "RIGHT", 3, 0)
+ if PRHeader4:GetBottom() < PRHeader8:GetBottom() then
+ self.backdrop:SetPoint("BOTTOM", PRHeader4, "BOTTOM", 0, -10)
+ else
+ self.backdrop:SetPoint("BOTTOM", PRHeader8, "BOTTOM", 0, -10)
+ end
+ self.backdrop:SetTexture(0,0,0,1)
+ end
+ if PerfectRaid.db.profile.HacksBackdrop then
+ self.backdrop:Show()
+ else
+ self.backdrop:Hide()
+ end
end
function Hacks:UpdateScale(val)