# HG changeset patch # User Flick # Date 1287519779 0 # Node ID fe0c7be6f6efd9429a609e71282c72f1517e1f06 # Parent 0030201b5fc2425cd17b2c0315f3c32959202cbc Convert GridProxy to LibShowGrid diff -r 0030201b5fc2 -r fe0c7be6f6ef classes/Bar.lua --- a/classes/Bar.lua Tue Oct 19 20:07:55 2010 +0000 +++ b/classes/Bar.lua Tue Oct 19 20:22:59 2010 +0000 @@ -6,7 +6,8 @@ local fmod = math.fmod local format = string.format -local KB = LibStub("LibKeyBound-1.0") +local LKB = LibStub("LibKeyBound-1.0") +local LSG = LibStub("LibShowGrid-1.0") ---- Secure snippets ---- local _reaction_init = @@ -221,7 +222,7 @@ f:Show() f:EnableMouse(false) f:SetClampedToScreen(true) - ReAction.gridProxy:AddFrame(f) + LSG:AddFrame(f) -- secure handlers f:Execute(_reaction_init) @@ -245,9 +246,9 @@ self:SetKeybindMode(ReAction:GetKeybindMode()) ReAction.RegisterCallback(self, "OnConfigModeChanged") - KB.RegisterCallback(self, "LIBKEYBOUND_ENABLED") - KB.RegisterCallback(self, "LIBKEYBOUND_DISABLED") - KB.RegisterCallback(self, "LIBKEYBOUND_MODE_COLOR_CHANGED","LIBKEYBOUND_ENABLED") + LKB.RegisterCallback(self, "LIBKEYBOUND_ENABLED") + LKB.RegisterCallback(self, "LIBKEYBOUND_DISABLED") + LKB.RegisterCallback(self, "LIBKEYBOUND_MODE_COLOR_CHANGED","LIBKEYBOUND_ENABLED") return self end @@ -257,8 +258,8 @@ f:UnregisterAllEvents() self:ShowControls(false) ReAction.UnregisterAllCallbacks(self) - KB.UnregisterAllCallbacks(self) - ReAction.gridProxy:RemoveFrame(f) + LKB.UnregisterAllCallbacks(self) + LSG:RemoveFrame(f) f:SetParent(UIParent) f:ClearAllPoints() f:Hide() diff -r 0030201b5fc2 -r fe0c7be6f6ef classes/GridProxy.lua --- a/classes/GridProxy.lua Tue Oct 19 20:07:55 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ --- --- A hack for a ShowGrid secure handler, using a bastardized Blizzard ActionBarButton. --- -local gridProxy = { } -ReAction.gridProxy = gridProxy - -local f = CreateFrame("CheckButton","ReActionShowGridProxy",UIParent,"ActionBarButtonTemplate, SecureHandlerAttributeTemplate") - -- SecureHandlerAttributeTemplate overwrites the onAttributeChanged handler, as it's last in the list -f:UnregisterAllEvents() -f:SetScript("OnEnter",nil) -f:SetScript("OnLeave",nil) -f:SetScript("PostClick",nil) -f:SetScript("OnDragStart",nil) -f:SetScript("OnReceiveDrag",nil) -f:SetScript("OnUpdate",nil) -f:SetAttribute("showgrid",0) -f:SetAttribute("action",0) -f.action = 0 -f:EnableMouse(false) -for _, child in ipairs({f:GetChildren()}) do - child:Hide() -end -for _, region in ipairs({f:GetRegions()}) do - region:Hide() -end -f:SetPoint("TOPLEFT") -f:Hide() - --- The existing onEvent handler will set the 'showgrid' attribute --- on this frame. Re-register for those events, but don't touch the --- onEvent handler, to keep it secure. -f:RegisterEvent("ACTIONBAR_SHOWGRID"); -f:RegisterEvent("ACTIONBAR_HIDEGRID"); - -f:Execute( - [[ - frames = newtable() - ]]) - --- shuttle 'showgrid' to the registered frames via state-showgrid attribute -f:SetAttribute("_onattributechanged", - -- function _onattributechanged(self,name,value) - [[ - if name == "showgrid" then - for _, f in pairs(frames) do - f:SetAttribute("state-showgrid",value) - end - end - ]]) - -function gridProxy:AddFrame(frame) - f:SetFrameRef("add",frame) - f:SetAttribute("frame-add-id",frame:GetName()) - f:Execute( - [[ - frames[self:GetAttribute("frame-add-id")] = self:GetFrameRef("add") - ]]) -end - -function gridProxy:RemoveFrame(frame) - f:SetAttribute("frame-remove-id",frame:GetName()) - f:Execute( - [[ - frames[self:GetAttribute("frame-remove-id")] = nil - ]]) -end - - diff -r 0030201b5fc2 -r fe0c7be6f6ef classes/classes.xml --- a/classes/classes.xml Tue Oct 19 20:07:55 2010 +0000 +++ b/classes/classes.xml Tue Oct 19 20:22:59 2010 +0000 @@ -2,7 +2,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> -