diff SkeletonKey/UI.lua @ 7:a2fc77fa4c73

- make sure key bindings honor the `ActionButtonUseKeyDown' CVar
author Nenue
date Thu, 28 Jul 2016 17:27:40 -0400
parents f6d1c192afc6
children e7977b336bf7
line wrap: on
line diff
--- a/SkeletonKey/UI.lua	Thu Jul 28 16:45:56 2016 -0400
+++ b/SkeletonKey/UI.lua	Thu Jul 28 17:27:40 2016 -0400
@@ -390,41 +390,43 @@
 end
 
 --- Retrieves button at index; creates said button and instates any stored parameters
-local leftSlot, upSlot
-local buttonsDepth = 0
-kb.GetSlot = function(index)
+do
+  local leftSlot, upSlot
+  local buttonsDepth = 0
+  kb.GetSlot = function(index)
 
-  local slot  = index + kb.scrollOffset
+    local slot  = index + kb.scrollOffset
 
-  if not kb.buttons[index] then
-    local button = CreateFrame('CheckButton', 'KeyBinderSlot'..index, kb, 'KeyButton')
-    button:SetScript('OnClick', KeyButton_OnClick)
-    button:SetScript('OnUpdate', KeyButton_OnUpdate)
-    button:SetScript('OnDragStart', KeyButton_OnDragStart)
-    button:SetScript('OnReceiveDrag', KeyButton_OnReceiveDrag)
-    button:RegisterForClicks('AnyUp')
+    if not kb.buttons[index] then
+      local button = CreateFrame('CheckButton', 'KeyBinderSlot'..index, kb, 'KeyButton')
+      button:SetScript('OnClick', KeyButton_OnClick)
+      button:SetScript('OnUpdate', KeyButton_OnUpdate)
+      button:SetScript('OnDragStart', KeyButton_OnDragStart)
+      button:SetScript('OnReceiveDrag', KeyButton_OnReceiveDrag)
+      button:RegisterForClicks('AnyUp')
 
 
-    local newRow = (mod(index, BINDS_PER_ROW) == 1)
+      local newRow = (mod(index, BINDS_PER_ROW) == 1)
 
-    if index == 1 then
-      button:SetPoint('TOPLEFT', kb.bg, 'TOPLEFT', BUTTON_PADDING, - BUTTON_PADDING)
-      upSlot = button
-      buttonsDepth = KEY_BUTTON_SIZE + BUTTON_PADDING * 2
-    elseif newRow then
-      button:SetPoint('TOPLEFT', upSlot, 'BOTTOMLEFT', 0, -BUTTON_SPACING)
-      upSlot = button
-      buttonsDepth = buttonsDepth + KEY_BUTTON_SIZE + BUTTON_SPACING
-    else
-      button:SetPoint('TOPLEFT', leftSlot, 'TOPRIGHT', BUTTON_HSPACING, 0)
+      if index == 1 then
+        button:SetPoint('TOPLEFT', kb.bg, 'TOPLEFT', BUTTON_PADDING, - BUTTON_PADDING)
+        upSlot = button
+        buttonsDepth = KEY_BUTTON_SIZE + BUTTON_PADDING * 2
+      elseif newRow then
+        button:SetPoint('TOPLEFT', upSlot, 'BOTTOMLEFT', 0, -BUTTON_SPACING)
+        upSlot = button
+        buttonsDepth = buttonsDepth + KEY_BUTTON_SIZE + BUTTON_SPACING
+      else
+        button:SetPoint('TOPLEFT', leftSlot, 'TOPRIGHT', BUTTON_HSPACING, 0)
+      end
+
+      button:SetSize(KEY_BUTTON_SIZE, KEY_BUTTON_SIZE)
+      button:Show()
+      kb.buttons[index] = button
+      leftSlot = button
     end
-
-    button:SetSize(KEY_BUTTON_SIZE, KEY_BUTTON_SIZE)
-    button:Show()
-    kb.buttons[index] = button
-    leftSlot = button
+    return kb.buttons[index]
   end
-  return kb.buttons[index]
 end
 
 --- Updates profile assignment and button contents