diff SkeletonKey/BindingsFrame.lua @ 34:daff39af0c6d

changeset logjam
author Nenue
date Tue, 16 Aug 2016 10:24:55 -0400
parents b0e4d04d428a
children 9a9d7f2a7c07
line wrap: on
line diff
--- a/SkeletonKey/BindingsFrame.lua	Tue Aug 16 10:22:48 2016 -0400
+++ b/SkeletonKey/BindingsFrame.lua	Tue Aug 16 10:24:55 2016 -0400
@@ -32,6 +32,26 @@
   [BINDING_TYPE_GLOBAL] = {0, 1, 1}
 }
 
+--[=[
+  -- some useful texture paths
+  [[Interface\PaperDollInfoFrame\UI-GearManager-Undo]]
+  [[Interface\PetPaperDollFrame\UI-PetHappiness]]
+  [[Interface\RAIDFRAME\ReadyCheck-Waiting]]
+  [[Interface\RAIDFRAME\ReadyCheck-Read]]
+  [[Interface\RAIDFRAME\ReadyCheck-NotReady]]
+  [[Interface\TradeSkillFrame\UI-TradeSkill-LinkButton]]
+  [[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]]
+  [[Interface\UI-TutorialFrame-QuestGiver\UI-TutorialFrame-QuestGray]]
+--]=]
+local lastFolder
+local addT = function(frame, key, folder, name)
+  folder = folder or lastFolder
+  frame[key] = frame:CreateTexture()
+  frame[key]:SetTexture('Interface\\' .. folder .. '\\' .. name)
+  frame[key]:SetPoint('TOPLEFT')
+  lastFolder = folder
+end
+
 local restingAlpha = 0.7
 local fadeTime, fadeDelay = .30, 0.15
 local saveButton
@@ -82,6 +102,7 @@
     end
   elseif click == 'RightButton' then
     kb.ReleaseSlot(self)
+    kb.ui()
   end
 end
 
@@ -181,12 +202,14 @@
   kb.ui(true)
 end
 
-local KeyBinder_CheckButton = function(frame ,enableText, disableText, dbKey, tooltipText, callback)
+local frameCount = 0
+local lastCheckFrame
+local KeyBinder_CheckButton = function(frame ,enableText, disableText, dbKey, tooltipText, callback, header)
   if kb.db[dbKey] then
     frame:SetChecked(true)
   end
-  frame.label:SetText(kb.db[dbKey] and enableText or disableText)
-  frame:SetWidth(frame.label:GetStringWidth()+8)
+
+  frame.header:SetText(header)
 
   frame:SetScript('OnClick', function(self)
     if callback then
@@ -198,8 +221,6 @@
         kb.DeactivateSlot(kb.saveTarget)
       end
     end
-    self.label:SetText(kb.db[dbKey] and enableText or disableText)
-    self:SetWidth(self.label:GetStringWidth()+8)
     kb.ui()
   end)
 
@@ -216,6 +237,25 @@
       GameTooltip:Hide()
     end
   end)
+
+  if frame:GetID() == 0 then
+    frameCount = frameCount + 1
+    frame:SetID(frameCount)
+    print('checkbutton #', frameCount)
+    if frameCount == 1 then
+      frame:ClearAllPoints()
+      frame:SetPoint('TOP', KeyBinderInventoryButton, 'BOTTOM', 0, -22)
+      frame:SetPoint('LEFT', kb.sourcesbg, 'LEFT', 2, 0)
+    else
+      frame:ClearAllPoints()
+      frame:SetPoint('TOPLEFT', lastCheckFrame, 'BOTTOMLEFT', 0, -2)
+    end
+
+    frame.header:ClearAllPoints()
+    frame.header:SetPoint('LEFT', frame, 'RIGHT', 2, 0)
+
+    lastCheckFrame = frame
+  end
 end
 
 local KeyBinder_OnHide = function()
@@ -319,8 +359,9 @@
     function() OpenAllBags() end,
     "Interface\\BUTTONS\\UI-MicroButtonCharacter-Up", {0, 1, .4, 1})
 
-  KeyBinder_CheckButton(KeyBinderStickyMode, 'Enabled', 'Disabled', 'stickyMode', 'Keep input active after receiving a key.')
-  KeyBinder_CheckButton(KeyBinderHoverInput, 'MouseOver', 'Click', 'hoverInput', 'Enable key input when the cursor is over a binding slot.')
+  KeyBinder_CheckButton(KeyBinderStickyMode, 'Enabled', 'Disabled', 'stickyMode', 'Keep input active after receiving a key.', nil, 'Sticky:')
+  KeyBinder_CheckButton(KeyBinderHoverInput, 'MouseOver', 'Click', 'hoverInput', 'Enable key input when the cursor is over a binding slot.', nil, 'Bind by:')
+  KeyBinder_CheckButton(KeyBinderProtectBindings, 'Block', 'Allow', 'protectBlizKeys', 'Allow overwriting Blizzard UI bindings.', nil, 'Safety:')
 
 
   KeyBinderUnbindButton:SetScript('OnClick', function()