changeset 18:91398d284a99

- stickyMode and hoverInput togglers with tooltips - remove keybinds via an interface button - turn off key input when receiving GAMEMENU key - ignore modifier keys - mask out key selections that are bound to core interface functions (todo: selectively free up combinations involving 1-6, F1-F12, etc.)
author Nenue
date Sat, 30 Jul 2016 03:33:09 -0400
parents 500f9b2bd9ac
children 67db6b712bf3
files SkeletonKey/BindingsUI.lua SkeletonKey/KeySlot.lua SkeletonKey/SkeletonKey.xml
diffstat 3 files changed, 98 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/SkeletonKey/BindingsUI.lua	Sat Jul 30 00:08:00 2016 -0400
+++ b/SkeletonKey/BindingsUI.lua	Sat Jul 30 03:33:09 2016 -0400
@@ -138,10 +138,17 @@
       kb.throttle = 0
       kb:SetScript('OnUpdate', KeyBinder_OnUpdate)
 
+      if kb.db.hoverInput and kb.saveTarget ~= self then
+        kb.ActivateSlot(self)
+        kb.ui()
+      end
+
     end
   else
     if self.active then
       self.active = nil
+      kb.DeactivateSlot(self)
+      kb.ui()
     end
   end
 end
@@ -170,6 +177,20 @@
   kb.ui(true)
 end
 
+local CheckButton_OnEnter = function(self)
+  if self.tooltip then
+    GameTooltip:SetOwner(self)
+    GameTooltip:SetText(self.tooltip)
+    GameTooltip:Show()
+  end
+end
+local CheckButton_OnLeave = function(self)
+  if self.tooltip and GameTooltip:GetOwner() == self then
+    GameTooltip:Hide()
+  end
+
+end
+
 local KeyBinder_OnHide = function()
   KeyBinderImportLog:Hide()
 end
@@ -271,17 +292,41 @@
     function() OpenAllBags() end,
     "Interface\\BUTTONS\\UI-MicroButtonCharacter-Up", {0, 1, .4, 1})
 
+  KeyBinderStickyMode.tooltip = 'Keep input active after receiving a key.'
   KeyBinderStickyMode:SetScript('OnClick', function(self)
-
-    kb.stickyMode = self:GetChecked()
-    if not kb.stickyMode then
+    kb.db.stickyMode = self:GetChecked()
+    if not kb.db.stickyMode then
       if kb.saveTarget then
         kb.DeactivateSlot(kb.saveTarget)
       end
     end
-
     kb.ui()
   end)
+  if kb.db.stickyMode then
+    KeyBinderStickyMode:SetChecked(true)
+  end
+
+  KeyBinderHoverInput.tooltip = 'Enable key input when the cursor is over a binding slot.'
+  KeyBinderHoverInput:SetScript('OnClick', function(self)
+    kb.db.hoverInput = self:GetChecked()
+    kb.ui()
+  end)
+  if kb.db.hoverInput then
+    KeyBinderHoverInput:SetChecked(true)
+  end
+
+
+  KeyBinderUnbindButton:SetScript('OnClick', function()
+    if kb.saveTarget then
+      kb.UnbindSlot(kb.saveTarget)
+    end
+    kb.ui()
+  end)
+
+  KeyBinderStickyMode:SetScript('OnEnter', CheckButton_OnEnter)
+  KeyBinderHoverInput:SetScript('OnEnter', CheckButton_OnEnter)
+  KeyBinderStickyMode:SetScript('OnLeave', CheckButton_OnLeave)
+  KeyBinderHoverInput:SetScript('OnLeave', CheckButton_OnLeave)
 
   kb.info:SetPoint('TOPLEFT', kb.UIPanels[1], 'BOTTOMLEFT', 0, -BUTTON_SPACING)
   HEADER_OFFSET = kb.UIPanels[1]:GetHeight() + BUTTON_PADDING
@@ -395,6 +440,8 @@
     KeyBinderUnbindButton:Hide()
   end
 
+  KeyBinderStickyMode.label:SetText(kb.db.stickyMode and 'Sticky' or 'Normal')
+  KeyBinderHoverInput.label:SetText(kb.db.hoverInput and 'MouseOver' or 'Manual')
 
   -- Reset this so talent cache can be rebuilt
   kb.talentsPushed = nil
--- a/SkeletonKey/KeySlot.lua	Sat Jul 30 00:08:00 2016 -0400
+++ b/SkeletonKey/KeySlot.lua	Sat Jul 30 03:33:09 2016 -0400
@@ -197,7 +197,7 @@
     SetBinding(key, nil)
     SaveBindings(GetCurrentBindingSet())
     if kb.currentProfile.bindings[key] then
-      kb:print(L('BINDING_REMOVED', self.actionName, kb.currentHeader))
+      --kb:print(L('BINDING_REMOVED', self.actionName, kb.currentHeader))
       kb.currentProfile.bindings[key] = nil
     end
     if kb.currentProfile.talents[self.actionName] then
--- a/SkeletonKey/SkeletonKey.xml	Sat Jul 30 00:08:00 2016 -0400
+++ b/SkeletonKey/SkeletonKey.xml	Sat Jul 30 03:33:09 2016 -0400
@@ -203,33 +203,68 @@
       </Button>
 
       <Button name="$parentUnbindButton" hidden="true">
-        <Size x="20" y="20" />
+        <Size x="50" y="20" />
         <NormalTexture>
           <Color a="1" r="1" g="0.4" b="0" />
+        </NormalTexture>
+        <HighlightTexture>
 
-        </NormalTexture>
+          <Color a="1" r="1" g="0.6" b=".1" />
+        </HighlightTexture>
         <NormalFont style="KTUIPanelFont" />
-        <ButtonText text="X" />
+        <Layers>
+          <Layer level="OVERLAY">
+            <FontString inherits="KTUIPanelFont" text="Unbind" />
+          </Layer>
+        </Layers>
       </Button>
 
-      <CheckButton name="$parentStickyMode">
+
+      <CheckButton name="KeyBinderStickyMode" text="Receiving">
         <Size  y="28" />
         <Anchors>
           <Anchor point="BOTTOMLEFT" x="0" y="12" />
           <Anchor point="RIGHT" relativeKey="$parent.sourcesbg" />
         </Anchors>
-        <ButtonText text="Receiving" inherits="KTUIPanelFont">
-          <Anchors>
-            <Anchor point="CENTER" />
-          </Anchors>
-        </ButtonText>
         <NormalTexture>
-          <Color a="1" r=".3" g=".3" b=".3" />
+          <Color a=".5" r=".3" g="0.5" b="0.2" />
         </NormalTexture>
         <CheckedTexture>
+          <Color a="1" r=".3" g="0.9" b=".2" />
+        </CheckedTexture>
+        <Layers>
+          <Layer level="OVERLAY">
+            <FontString parentKey="label" inherits="KTUIPanelFont" text="STICKY_MODE">
+              <Anchors>
+                <Anchor point="LEFT" x="4" />
+              </Anchors>
+            </FontString>
+          </Layer>
+        </Layers>
+      </CheckButton>
 
-          <Color a="1" r=".3" g="1" b=".2" />
+      <CheckButton name="KeyBinderHoverInput">
+        <Size  y="28" />
+        <Anchors>
+          <Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT" x="0" y="12" relativeTo="$parentStickyMode" />
+          <Anchor point="RIGHT" relativeKey="$parent.sourcesbg" />
+        </Anchors>
+        <NormalTexture>
+          <Color a=".7" r=".5" g=".15" b=".1" />
+        </NormalTexture>
+        <CheckedTexture>
+          <Color a="1" r="1" g=".3" b=".2" />
         </CheckedTexture>
+
+        <Layers>
+          <Layer level="OVERLAY">
+            <FontString parentKey="label" inherits="KTUIPanelFont" text="HOVER_INPUT">
+              <Anchors>
+                <Anchor point="LEFT" x="4" />
+              </Anchors>
+                </FontString>
+          </Layer>
+        </Layers>
       </CheckButton>
     </Frames>
   </Frame>