Mercurial > wow > reaction
diff ReAction.lua @ 116:fb48811a8736
Convert to standard keybindings
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Fri, 23 Jan 2009 23:44:55 +0000 |
parents | d39cfbdde301 |
children | a2d2f23137c8 |
line wrap: on
line diff
--- a/ReAction.lua Fri Jan 23 23:40:13 2009 +0000 +++ b/ReAction.lua Fri Jan 23 23:44:55 2009 +0000 @@ -57,10 +57,7 @@ ------ PRIVATE ------ local weak = {__mode="k"} -local private = { - allKB = setmetatable({}, weak), - kbHooked = setmetatable({}, weak), -} +local private = { } local bars = {} local defaultBarConfig = {} local barOptionGenerators = { } @@ -86,9 +83,19 @@ handler = ReAction, get = "GetConfigMode", set = function(info, value) ReAction:SetConfigMode(value) end, + width = "double", disabled = InCombatLockdown, order = 1 }, + skipProfileWarning = { + type = "toggle", + name = L["Skip profile keybind warning"], + desc = L["Don't show a warning about updating keybinds when switching profiles"], + get = function() return ReAction.db.global.skipKeybindWarning end, + set = function(info, value) ReAction.db.global.skipKeybindWarning = value end, + width = "double", + order = 2, + }, }, plugins = { }, order = 2, @@ -107,19 +114,24 @@ } ReAction.options = options -local SelectBar, DestroyBar, InitializeBars, TearDownBars, DeepCopy, CallModuleMethod, SlashHandler, KBAttach + -- insert an entry into the WoW static popup dialogs list +StaticPopupDialogs["REACTION_KB_WARN"] = { + text = L["ReAction profile changed: check your keybinds, they may need to be updated."], + button1 = L["OK"], + hideOnEscape = true, + enterClicksFirstButton = true, + timeout = 0, + showAlert = true, + whileDead = true, +} + +local SelectBar, DestroyBar, InitializeBars, TearDownBars, DeepCopy, CallModuleMethod, SlashHandler do local pcall = pcall local geterrorhandler = geterrorhandler local self = ReAction local inited = false - local function kb_onEnter( self ) - if ReAction:GetKeybindMode() then - KB:Set(self) - end - end - function SelectBar(x) local bar, name if type(x) == "string" then @@ -215,15 +227,6 @@ end end - function KBAttach( frame ) - if not private.kbHooked[frame] then - -- avoid taint, particularly with SecureAnchorEnterTemplate - -- don't hook scripts multiple times, there isn't any unhook! - frame:HookScript("OnEnter",kb_onEnter) - private.kbHooked[frame] = true - end - end - end @@ -263,6 +266,7 @@ function ReAction:OnProfileChanged() TearDownBars() InitializeBars() + self:PopKeybindWarning() end function ReAction:PLAYER_REGEN_DISABLED() @@ -501,9 +505,6 @@ function ReAction:SetKeybindMode( mode ) if mode ~= private.kbMode then if mode then - for f in pairs(private.allKB) do - KBAttach(f) - end KB:Activate() else KB:Deactivate() @@ -516,27 +517,8 @@ return private.kbMode end -function ReAction:RegisterKeybindFrame( f ) - private.allKB[f] = true - if private.kbMode then - KBAttach(f) +function ReAction:PopKeybindWarning() + if not self.db.global.skipKeybindWarning then + StaticPopup_Show("REACTION_KB_WARN") end end - -function ReAction:FreeOverrideHotkey( key ) - for f in pairs(private.allKB) do - if f.GetBindings then - for i = 1, select('#', f:GetBindings()) do - if select(i, f:GetBindings()) == key then - if f.FreeKey then - return f:FreeKey(key) - else - local action = f.GetActionName and f:GetActionName() or f:GetName() - SetOverrideBinding(f, false, key, nil) - return action - end - end - end - end - end -end