changeset 279:5b9c0164a491

Fixed a number of problems with drag corners in config mode - Fixed button resizing via dragging not updating until a reload - Fixed pet/stance/vehicle buttons not always displaying in config mode - Fixed error spam when making too many pet/bag buttons
author Flick
date Wed, 11 May 2011 16:19:17 -0700
parents 4e325f1ea6e1
children 2098dba4baf5 0ea325e616ab
files Bar.lua Button.lua PetActionButton.lua ReAction.lua StanceButton.lua VehicleExitButton.lua
diffstat 6 files changed, 27 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/Bar.lua	Wed May 11 11:27:36 2011 -0700
+++ b/Bar.lua	Wed May 11 16:19:17 2011 -0700
@@ -351,6 +351,9 @@
   if w > 0 and h > 0 then
     self.config.btnWidth = w
     self.config.btnHeight = h
+    for _, b in pairs(self.buttons) do
+      b:Refresh()
+    end
   end
 end
 
@@ -403,6 +406,7 @@
     b:ShowGridTemp(mode)
     b:UpdateActionIDLabel(mode)
   end
+  self.buttonClass:SetupBar(self) -- force a full refresh
 end
 
 function Bar:SetKeybindMode(mode)
@@ -667,10 +671,10 @@
   end
   if enable then
     if not self.unitwatch then
-      RegisterUnitWatch(self:GetFrame(),true)
+      RegisterUnitWatch(f,true)
     end
   elseif self.unitwatch then
-    UnregisterUnitWatch(self:GetFrame())
+    UnregisterUnitWatch(f)
   end
   self.unitwatch = enable
   self:RefreshSecureState()
--- a/Button.lua	Wed May 11 11:27:36 2011 -0700
+++ b/Button.lua	Wed May 11 16:19:17 2011 -0700
@@ -188,7 +188,9 @@
         if not success then
           bar:ClipNButtons(n)
           cfgN = n
-          geterrorhandler()(r)
+          if r then
+            geterrorhandler()(r)
+          end
         end
       end
     end
@@ -235,7 +237,8 @@
       end
       if id == nil then
         if unique then
-          error(("All action IDs for bars of type '%s' are in use, cannot create any more buttons"):format(self.config.barType))
+          ReAction:UserError(("All action IDs for bars of type '%s' are in use, cannot create any more buttons"):format(self.barType))
+          error(nil) -- no error message, user has already been notified, so don't put in Lua error handler
         end
         pool.nWraps = nWraps + 1
       end
--- a/PetActionButton.lua	Wed May 11 11:27:36 2011 -0700
+++ b/PetActionButton.lua	Wed May 11 16:19:17 2011 -0700
@@ -160,7 +160,7 @@
   Super.SetupBar(self,bar)
 
   -- auto show/hide when pet exists
-  bar:RegisterUnitWatch("pet",true)
+  bar:RegisterUnitWatch("pet",not ReAction:GetConfigMode())
 
   self:UpdateButtonLock(bar)
 end
--- a/ReAction.lua	Wed May 11 11:27:36 2011 -0700
+++ b/ReAction.lua	Wed May 11 16:19:17 2011 -0700
@@ -3,6 +3,7 @@
 local pairs = pairs
 local type = type
 local geterrorhandler = geterrorhandler
+local GetTime = GetTime
 local L = LibStub("AceLocale-3.0"):GetLocale("ReAction")
 local LKB = LibStub("LibKeyBound-1.0",true)
 if not LKB then
@@ -171,8 +172,17 @@
 
 ------ Methods ------
 
-function ReAction:UserError(msg)
-  UIErrorsFrame:AddMessage(msg)
+do
+  local lastErrorMessage
+  local lastErrorTime
+  function ReAction:UserError(msg)
+    local t = GetTime()
+    if msg ~= lastErrorMessage or lastErrorTime == nil or (t - lastErrorTime > 10) then -- prevent spam
+      UIErrorsFrame:AddMessage(msg)
+      lastErrorMessage = msg
+      lastErrorTime = t
+    end
+  end
 end
 
 function ReAction:GetBar(arg)
--- a/StanceButton.lua	Wed May 11 11:27:36 2011 -0700
+++ b/StanceButton.lua	Wed May 11 16:19:17 2011 -0700
@@ -111,7 +111,7 @@
     self.updatePending = false
     local idx = self:GetActionID()
     local f = self:GetFrame()
-    if idx > GetNumShapeshiftForms() then
+    if idx > GetNumShapeshiftForms() and not ReAction:GetConfigMode() then
       f:Hide()
     else
       f:SetAttribute("spell", select(2,GetShapeshiftFormInfo(idx)))
--- a/VehicleExitButton.lua	Wed May 11 11:27:36 2011 -0700
+++ b/VehicleExitButton.lua	Wed May 11 16:19:17 2011 -0700
@@ -94,12 +94,12 @@
   -- auto show/hide when on a vehicle
   local config = bar:GetConfig()
   local f = bar:GetFrame()
-  if config.withControls then
+  if config.withControls or ReAction:GetConfigMode() then
     if bar.vehicleExitStateRegistered then
       UnregisterStateDriver(f, "unitexists")
       bar.vehicleExitStateRegistered = false
     end
-    bar:RegisterUnitWatch("vehicle",true)
+    bar:RegisterUnitWatch("vehicle",not ReAction:GetConfigMode())
   else
     bar:RegisterUnitWatch("vehicle",false)
     if not bar.vehicleExitStateRegistered then