comparison SkeletonKey/BindingsFrame.lua @ 50:1aba8a6fd4a9

- fix kb.bindings content and define a generic function for constructing its keystrings - handle hotkey text for actions placed in multiple slots -- hotkey.actionbar generates a cache table for use during binding changes
author Nenue
date Fri, 19 Aug 2016 01:12:56 -0400
parents 9a9d7f2a7c07
children 81a7c71c4483
comparison
equal deleted inserted replaced
49:9a9d7f2a7c07 50:1aba8a6fd4a9
58 58
59 local KeyButton_OnKeyDown = function(self, key) 59 local KeyButton_OnKeyDown = function(self, key)
60 kb.saveTarget.border:SetColorTexture(1,1,1,1) 60 kb.saveTarget.border:SetColorTexture(1,1,1,1)
61 end 61 end
62 local KeyButton_OnKeyUp = function(self, key) 62 local KeyButton_OnKeyUp = function(self, key)
63
64 kb.UpdateSlot(kb.saveTarget) 63 kb.UpdateSlot(kb.saveTarget)
65 if key == 'ESCAPE' then 64 if key == 'ESCAPE' then
66 kb.DeactivateSlot(kb.saveTarget) 65 kb.DeactivateSlot(kb.saveTarget)
67 kb.ui() 66 kb.ui()
68 return 67 return
69 end 68 end
70
71 if key:match('[RL]SHIFT') or key:match('[RL]ALT') or key:match('[RL]CTRL') then 69 if key:match('[RL]SHIFT') or key:match('[RL]ALT') or key:match('[RL]CTRL') then
72 return 70 return
73 elseif kb.saveTarget then 71 elseif kb.saveTarget then
74
75 if kb.SaveSlot(kb.saveTarget, key) then 72 if kb.SaveSlot(kb.saveTarget, key) then
76 if not (kb.db.stickyMode or kb.db.hoverInput) then 73 if not (kb.db.stickyMode or kb.db.hoverInput) then
77
78 kb.DeactivateSlot(kb.saveTarget) 74 kb.DeactivateSlot(kb.saveTarget)
79 end 75 end
80 kb.ui() 76 kb.ui()
81 end 77 end
82 end 78 end
83
84
85 end 79 end
86 80
87 local KeyButton_OnClick = function(self, click) 81 local KeyButton_OnClick = function(self, click)
88 print(self:GetName(), 'OnMouseDown', click) 82 print(self:GetName(), 'OnMouseDown', click)
89 local cursorType = GetCursorInfo() 83 local cursorType = GetCursorInfo()
94 if self.command and self.isAvailable then 88 if self.command and self.isAvailable then
95 if IsShiftKeyDown() then 89 if IsShiftKeyDown() then
96 kb.db.stickyMode = true 90 kb.db.stickyMode = true
97 KeyBinderStickyMode:SetChecked(true) 91 KeyBinderStickyMode:SetChecked(true)
98 end 92 end
99
100 kb.ActivateSlot(self) 93 kb.ActivateSlot(self)
101 kb.ui() 94 kb.ui()
102 end 95 end
103
104 end 96 end
105 elseif click == 'RightButton' then 97 elseif click == 'RightButton' then
106 kb.ReleaseSlot(self) 98 kb.ReleaseSlot(self)
107 kb.ui() 99 kb.ui()
108 elseif kb.saveTarget then 100 elseif kb.saveTarget then
109
110 if kb.SaveSlot(kb.saveTarget, string.upper(click)) then 101 if kb.SaveSlot(kb.saveTarget, string.upper(click)) then
111 if not (kb.db.stickyMode or kb.db.hoverInput) then 102 if not (kb.db.stickyMode or kb.db.hoverInput) then
112
113 kb.DeactivateSlot(kb.saveTarget) 103 kb.DeactivateSlot(kb.saveTarget)
114 end 104 end
115 kb.ui() 105 kb.ui()
116 end 106 end
117 end 107 end