changeset 70:2c12e2b1752e

Fixed unbinding a keystate toggle
author Flick <flickerstreak@gmail.com>
date Tue, 03 Jun 2008 23:24:03 +0000
parents a785d6708388
children 3d2cef5dc459
files Bar.lua State.lua locale/enUS.lua
diffstat 3 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Bar.lua	Tue Jun 03 23:05:16 2008 +0000
+++ b/Bar.lua	Tue Jun 03 23:24:03 2008 +0000
@@ -182,11 +182,11 @@
   SecureStateHeader_Refresh(self.frame)
 end
 
-function Bar:SetStateKeybind(keybind, state, defaultstate)
+function Bar:SetStateKeybind(key, state, defaultstate)
   -- use a tiny offscreen button to get around making the bar itself a clickable button
   local f = self.statebuttonframe
   local off = ("%s_off"):format(state)
-  if keybind then
+  if key then
     if not f then
       f = CreateFrame("Button",self:GetName().."_statebutton",UIParent,"SecureActionButtonTemplate")
       f:SetPoint("BOTTOMRIGHT",UIParent,"TOPLEFT")
@@ -204,10 +204,15 @@
     f:SetAttribute(("type-%s"):format(off),"attribute")
     f:SetAttribute(("attribute-value-%s"):format(state), state)
     f:SetAttribute(("attribute-value-%s"):format(off), defaultstate)
-    SetBindingClick(keybind, f:GetName(), state)
+    SetBindingClick(key, f:GetName(), state)
   elseif f then
     f:SetAttribute(("type-%s"):format(state),ATTRIBUTE_NOOP)
     f:SetAttribute(("type-%s"):format(off),ATTRIBUTE_NOOP)
+    local action = ("CLICK %s:%s"):format(f:GetName(),state)
+    key = GetBindingKey(action)
+    if key then
+      SetBinding(key,nil)
+    end
   end
 end
 
--- a/State.lua	Tue Jun 03 23:05:16 2008 +0000
+++ b/State.lua	Tue Jun 03 23:24:03 2008 +0000
@@ -700,7 +700,7 @@
         },
       },
       rules = {
-        name   = L["Selection Rule"],
+        name   = L["Rule"],
         order  = 3,
         type   = "group",
         args   = {
@@ -825,6 +825,9 @@
                 order = 2,
                 type = "keybinding",
                 set  = function(info, value)
+                         if value and #value == 0 then
+                           value = nil
+                         end
                          setrule("keybind",value)
                          update()
                        end,
--- a/locale/enUS.lua	Tue Jun 03 23:05:16 2008 +0000
+++ b/locale/enUS.lua	Tue Jun 03 23:24:03 2008 +0000
@@ -86,7 +86,7 @@
 "Y Offset",
 "Scale",
 "Set New Scale",
-"Selection Rule",
+"Rule",
 "Select this state",
 "by default",
 "when ANY of these",