From 88a71decb0cfc46d4e8c7bc2f0a12b07e15162f6 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sun, 9 Nov 2008 13:22:09 +0100 Subject: [PATCH] Hotkeys work properly again --- ActionButton.lua | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/ActionButton.lua b/ActionButton.lua index 439be91..25c4ff1 100644 --- a/ActionButton.lua +++ b/ActionButton.lua @@ -26,6 +26,7 @@ local KeyBound = LibStub("LibKeyBound-1.0") Bartender4.Button = {} Bartender4.Button.prototype = Button +Button.BT4init = true function Bartender4.Button:Create(id, parent) local absid = (parent.id - 1) * 12 + id local name = ("BT4Button%d"):format(absid) @@ -41,18 +42,6 @@ function Bartender4.Button:Create(id, parent) button.stateactions = {} button:SetFrameStrata("MEDIUM") - button:SetNormalTexture("") - - local NormalTexture = button:GetNormalTexture() - NormalTexture:SetWidth(66) - NormalTexture:SetHeight(66) - NormalTexture:ClearAllPoints() - NormalTexture:SetPoint("CENTER", 0, -1) - NormalTexture:Show() - - button.normalTexture = NormalTexture - button.pushedTexture = button:GetPushedTexture() - button.highlightTexture = button:GetHighlightTexture() -- overwrite some scripts with out customized versions button:SetScript("OnEnter", onEnter) @@ -121,14 +110,13 @@ function Bartender4.Button:Create(id, parent) button:SetAttribute("special-" .. tostring(k), v.script) end - --button:RegisterButtonEvents() - if LBF and parent.LBFGroup then local group = parent.LBFGroup group:AddButton(button) end - --ActionButton_UpdateAction(button) + --self:UpdateAction(true) + button:UpdateHotkeys() return button end @@ -153,7 +141,7 @@ end function onEnter(self) if not (Bartender4.db.profile.tooltip == "nocombat" and InCombatLockdown()) and Bartender4.db.profile.tooltip ~= "disabled" then - ActionButton_SetTooltip(self) + self:SetTooltip(self) end KeyBound:Set(self) end @@ -262,6 +250,19 @@ function Button:UpdateAction(force) ActionButton_UpdateAction(self) end +local orig_ActionButton_UpdateHotkeys = ActionButton_UpdateHotkeys + +ActionButton_UpdateHotkeys = function(self, ...) + local name = self:GetName() + if name and name:find("^BT4Button") then + if self.BT4init then + self:UpdateHotkeys() + end + else + orig_ActionButton_UpdateHotkeys(self, ...) + end +end + function Button:UpdateHotkeys() local key = self:GetHotkey() or "" local hotkey = self.hotkey