From 975e47eb5157d86bf1bd4c8251350b66ff16ae87 Mon Sep 17 00:00:00 2001 From: Tukz Date: Thu, 17 Dec 2009 07:17:20 -0500 Subject: [PATCH] disabling and moving focus script to !tukui_config --- Interface/AddOns/Tukui/!Tukui_config.lua | 5 ++ Interface/AddOns/Tukui/Tukui.toc | 2 +- Interface/AddOns/Tukui/mods/arena_focus.lua | 58 ++++++++++----------- 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/Interface/AddOns/Tukui/!Tukui_config.lua b/Interface/AddOns/Tukui/!Tukui_config.lua index c01f623..2be84f5 100644 --- a/Interface/AddOns/Tukui/!Tukui_config.lua +++ b/Interface/AddOns/Tukui/!Tukui_config.lua @@ -84,6 +84,11 @@ t_arena = true ArenaX = 252 -- position X (left/right) on UI ArenaY = 260 -- position Y (up/down) on UI +-- enable a keybind as a set focus key on arena frame or unit mouseover +focuskey = false +arenamodifier = "shift" -- shift, alt or ctrl +arenamouseButton = "3" -- 1 = left, 2 = right, 3 = middle, 4 and 5 = thumb buttons if there are any + ---------------------------------------------------------------------------------------- -- Panels config (you can't have more than 6 active panels) ---------------------------------------------------------------------------------------- diff --git a/Interface/AddOns/Tukui/Tukui.toc b/Interface/AddOns/Tukui/Tukui.toc index 61ae80a..e58a18e 100644 --- a/Interface/AddOns/Tukui/Tukui.toc +++ b/Interface/AddOns/Tukui/Tukui.toc @@ -1,6 +1,6 @@ ## Interface: 30300 ## Author: Tukz -## Version: 8.05 +## Version: 8.06 ## Title: |cffC495DDTukui|r ## Notes: UI of awesomeness! ## SavedVariables: tCooldownTracker_Saved diff --git a/Interface/AddOns/Tukui/mods/arena_focus.lua b/Interface/AddOns/Tukui/mods/arena_focus.lua index 3e2a08c..2bb2bcf 100644 --- a/Interface/AddOns/Tukui/mods/arena_focus.lua +++ b/Interface/AddOns/Tukui/mods/arena_focus.lua @@ -3,36 +3,36 @@ -- default key to set focus on arena frame or mousever unit is "shift + mouse button 2 (right one)" -local modifier = "shift" -- shift, alt or ctrl -local mouseButton = "3" -- 1 = left, 2 = right, 3 = middle, 4 and 5 = thumb buttons if there are any +if focuskey == true then -local function SetFocusHotkey(frame) - frame:SetAttribute(modifier.."-type"..mouseButton,"focus") -end + local function SetFocusHotkey(frame) + frame:SetAttribute(arenamodifier.."-type"..arenamouseButton,"focus") + end + + local function CreateFrame_Hook(type, name, parent, template) + if template == "SecureUnitButtonTemplate" then + SetFocusHotkey(_G[name]) + end + end -local function CreateFrame_Hook(type, name, parent, template) - if template == "SecureUnitButtonTemplate" then - SetFocusHotkey(_G[name]) + hooksecurefunc("CreateFrame", CreateFrame_Hook) + + -- Keybinding override so that models can be shift/alt/ctrl+clicked + local f = CreateFrame("CheckButton", "FocuserButton", UIParent, "SecureActionButtonTemplate") + f:SetAttribute("type1","macro") + f:SetAttribute("macrotext","/focus mouseover") + SetOverrideBindingClick(FocuserButton,true,arenamodifier.."-BUTTON"..arenamouseButton,"FocuserButton") + + -- Set the keybindings on the default unit frames since we won't get any CreateFrame notification about them + local duf = { + oUF_Arena1, + oUF_Arena2, + oUF_Arena3, + oUF_Arena4, + oUF_Arena5, + } + + for i,frame in pairs(duf) do + SetFocusHotkey(frame) end -end - -hooksecurefunc("CreateFrame", CreateFrame_Hook) - --- Keybinding override so that models can be shift/alt/ctrl+clicked -local f = CreateFrame("CheckButton", "FocuserButton", UIParent, "SecureActionButtonTemplate") -f:SetAttribute("type1","macro") -f:SetAttribute("macrotext","/focus mouseover") -SetOverrideBindingClick(FocuserButton,true,modifier.."-BUTTON"..mouseButton,"FocuserButton") - --- Set the keybindings on the default unit frames since we won't get any CreateFrame notification about them -local duf = { - oUF_Arena1, - oUF_Arena2, - oUF_Arena3, - oUF_Arena4, - oUF_Arena5, -} - -for i,frame in pairs(duf) do - SetFocusHotkey(frame) end \ No newline at end of file