WoWInterface SVN KeyboardAccess

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 3 to Rev 4
    Reverse comparison

Rev 3 → Rev 4

core.lua
41,18 → 41,40
KA.handleT = {}
local events = {}
 
 
local function toboolean(x)
if x==1 then
return true
else
return false
end
end
 
function events:MODIFIER_STATE_CHANGED(modi,state) --required for still opening chat or config
if modi=='LSHIFT' or modi=='RSHIFT' then
KA.MODShift=state
KA.MODShift=toboolean(state)
if KA.MODShift then
KA.handler:EnableKeyboard(0)
else
if #KA.handleT>0 then
KA.handler:EnableKeyboard(1)
else
KA.handler:EnableKeyboard(0)
end
end
end
end
 
function events:READY_CHECK(...) --ReadyCheck PopUp
--print('READY_CHECK')
tinsert(KA.handleT,'ReadyCheckFrame')
KA.handler:EnableKeyboard(1)
end
 
function events:LFG_PROPOSAL_SHOW(...) --LFD Tool PopUp
--print('LFG_PROPOSAL_SHOW')
tinsert(KA.handleT,'LFDDungeonReadyDialog')
KA.handler:EnableKeyboard(1)
end
 
KA.handler = CreateFrame('Frame',KA.name.."_Handler")
72,6 → 94,36
StaticPopup3, --for enchants
StaticPopup4 --buying items
}
local buttonT = {
["LFDRoleCheckPopup"] = {
"AcceptButton",
"DeclineButton",
},
["StaticPopup1"] = {
"Button1",
"Button2",
},
["StaticPopup2"] = {
"Button1",
"Button2",
},
["StaticPopup3"] = {
"Button1",
"Button2",
},
["StaticPopup4"] = {
"Button1",
"Button2",
},
["LFDDungeonReadyDialog"] = {
"EnterDungeonButton",
"LeaveQueueButton",
},
["ReadyCheckFrame"] = {
"YesButton",
"NoButton",
}
}
KA.oldShow = { }
--storing old shows & creating new ones
for _,k in ipairs(popups) do
79,8 → 131,23
KA.oldShow[name] = k:GetScript('OnShow')
k:SetScript('OnShow',function(...)
tinsert(KA.handleT,name)
KA.handler:EnableKeyboard(1)
KA.oldShow[name](...)
end)
end
 
--KeyPressing handling
KA.handler:SetScript('OnKeyUp',function(self,key)
if key=='ENTER' then
_G[KA.handleT[1]..buttonT[KA.handleT[1]][1]]:Click()
tremove(KA.handleT,1)
elseif key=='ESCAPE' then
_G[KA.handleT[1]..buttonT[KA.handleT[1]][2]]:Click()
tremove(KA.handleT,1)
end
if #KA.handleT==0 then
self:EnableKeyboard(0)
end
end)