changeset 7:a2fc77fa4c73

- make sure key bindings honor the `ActionButtonUseKeyDown' CVar
author Nenue
date Thu, 28 Jul 2016 17:27:40 -0400
parents f6d1c192afc6
children 539fd88338f2
files LibKraken/LibKraken-1.0.lua SkeletonKey/KeyBinds.lua SkeletonKey/UI.lua
diffstat 3 files changed, 46 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/LibKraken/LibKraken-1.0.lua	Thu Jul 28 16:45:56 2016 -0400
+++ b/LibKraken/LibKraken-1.0.lua	Thu Jul 28 17:27:40 2016 -0400
@@ -190,16 +190,25 @@
   end
 end
 
-KT.register = function(addon, name, noGUI)
+KT.register = function(addon, nameOrModule, noGUI)
+  local name
   if registeredHandles[addon] then
-    name = name or debugstack(2,1,0):gsub("\\n.+", ""):gsub("^Interface\\AddOns\\", ""):gsub("%s+$", "")
+    if type(nameOrModule) == 'table' then
+      tinsert(addon.modules, nameOrModule)
+      name = debugstack(2,1,0):match(".+\\(%S+)%.lua")
+
+      print('auto-resolved module name', name, tostring(nameOrModule))
+    else
+      name = nameOrModule
+    end
   else
-    if not name then
+    if not nameOrModule then
       assert(type(addon) == 'table', 'Need a valid table.')
       if addon.GetName then
         name = addon:GetName()
       else
-        name = debugstack(2,1,0):gsub("\\n.+", ""):gsub("^Interface\\AddOns\\", ""):gsub("%s+$", "")
+        name = debugstack(2,1,0):match(".+AddOns\\(%S+)\\")
+        print('auto-resolved addon name', name, tostring(nameOrModule))
       end
       assert(type(name) == 'string', 'Unable to resolve a valid stub name.')
     end
--- a/SkeletonKey/KeyBinds.lua	Thu Jul 28 16:45:56 2016 -0400
+++ b/SkeletonKey/KeyBinds.lua	Thu Jul 28 17:27:40 2016 -0400
@@ -16,9 +16,9 @@
 
 local _
 local kb, print = LibStub("LibKraken").register(KeyBinder)
-local db
 local cprint = DEVIAN_WORKSPACE and function(...) _G.print('Cfg', ...) end or function() end
 
+
 --- Caps Lock literals
 local CLICK_KEYBINDER_MACRO = "CLICK KeyBinderMacro:"
 local CLICK_KEYBINDER_KEY = "CLICK KeyBinderKey:"
@@ -87,6 +87,8 @@
 kb.inactiveTalentBindings = {}
 -- placeholder for the StaticPopup used for confirmations
 local confirmation
+-- savedvars, pulled a lot here
+local db
 
 local protected = {
   ['OPENCHATSLASH'] = true,
@@ -178,16 +180,10 @@
   end
 end
 
-
-
-
 kb.DropToSlot = function(self)
-
   print(self:GetName(),'|cFF0088FFreceived|r')
   local actionType, actionID, subType, subData = GetCursorInfo()
   print('GetCursorInfo', GetCursorInfo())
-
-
   if actionType then
 
     if actionType == 'flyout' then
--- 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