Abstract out frame registration
James Whitehead II [10-03-10 - 19:50]
Abstract out frame registration
diff --git a/BlizzardFrames.lua b/BlizzardFrames.lua
index 47b0e8f..866f6f0 100644
--- a/BlizzardFrames.lua
+++ b/BlizzardFrames.lua
@@ -1,11 +1,15 @@
local addonName, addon = ...
+local function enable(frame)
+ ClickCastFrames[frame] = true
+end
+
function addon:Enable_BlizzRaidPullouts()
hooksecurefunc("CreateFrame", function(type, name, parent, template)
if template == "RaidPulloutButtonTemplate" then
local frame = _G[tostring(name) .. "ClearButton"]
if frame then
- ClickCastFrames[frame] = true
+ enable(frame)
end
end
end)
@@ -13,7 +17,7 @@ end
function addon:Enable_BlizzCompactUnitFrames()
hooksecurefunc("CompactUnitFrame_SetUpFrame", function(frame, ...)
- ClickCastFrames[frame] = true
+ enable(frame)
end)
end
@@ -26,7 +30,7 @@ function addon:Enable_BlizzArenaFrames()
ArenaEnemyFrame5,
}
for idx, frame in ipairs(frames) do
- ClickCastFrames[frame] = true
+ enable(frame)
end
end
@@ -40,7 +44,7 @@ function addon:Enable_BlizzSelfFrames()
FocusFrameToT,
}
for idx, frame in ipairs(frames) do
- ClickCastFrames[frame] = true
+ enable(frame)
end
end
@@ -58,7 +62,7 @@ function addon:Enable_BlizzPartyFrames()
PartyMemberFrame5PetFrame,
}
for idx, frame in ipairs(frames) do
- ClickCastFrames[frame] = true
+ enable(frame)
end
end
@@ -108,7 +112,7 @@ function addon:Enable_BlizzCompactParty()
CompactPartyFrameMember5Debuff3,
}
for idx, frame in ipairs(frames) do
- ClickCastFrames[frame] = true
+ enable(frame)
end
end
@@ -120,7 +124,7 @@ function addon:Enable_BlizzBossFrames()
Boss4TargetFrame,
}
for idx, frame in ipairs(frames) do
- ClickCastFrames[frame] = true
+ enable(frame)
end
end
diff --git a/Clique.lua b/Clique.lua
index 67ded71..7746d6b 100755
--- a/Clique.lua
+++ b/Clique.lua
@@ -96,7 +96,6 @@ function addon:Initialize()
end
function addon:RegisterFrame(button)
- print("Registered frame: " .. tostring(button:GetName()))
self.ccframes[button] = true
button:RegisterForClicks("AnyDown")