changeset 288:d931fa418e17

Merge LBF fix to default
author Flick
date Fri, 01 Jul 2011 14:32:17 -0700
parents 0ea325e616ab (current diff) 855521204ae9 (diff)
children d913dd4878af
files Bar.lua
diffstat 7 files changed, 96 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Jul 01 14:31:41 2011 -0700
+++ b/.hgtags	Fri Jul 01 14:32:17 2011 -0700
@@ -5,3 +5,4 @@
 455ef506f9695045737410a6529c9c6eb7d33022 1.1 beta 5
 b2e401183d36cd1283df64eef68a92a9ce08cc46 1.1 beta 6
 28f91ed1560ff659d92f3dd3d3042dd818d1d198 1.1 beta 7
+499ca4edf033da3ec4fc52fd1058bf27b2679bbe 1.1 beta 8
--- a/Bar.lua	Fri Jul 01 14:31:41 2011 -0700
+++ b/Bar.lua	Fri Jul 01 14:32:17 2011 -0700
@@ -374,8 +374,11 @@
 end
 
 function Bar:SetButtonGrid(r,c,s)
+  local cfg = self.config
+  r = r or cfg.btnRows
+  c = c or cfg.btnColumns
+  s = s or cfg.spacing
   if r > 0 and c > 0 and s > 0 then
-    local cfg = self.config
     cfg.btnRows = r
     cfg.btnColumns = c
     cfg.spacing = s
--- a/Button.lua	Fri Jul 01 14:31:41 2011 -0700
+++ b/Button.lua	Fri Jul 01 14:32:17 2011 -0700
@@ -237,7 +237,7 @@
       end
       if id == nil then
         if unique then
-          ReAction:UserError(("All action IDs for bars of type '%s' are in use, cannot create any more buttons"):format(self.barType))
+          ReAction:UserError(L["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
--- a/Editor.lua	Fri Jul 01 14:31:41 2011 -0700
+++ b/Editor.lua	Fri Jul 01 14:32:17 2011 -0700
@@ -281,11 +281,63 @@
               bigStep = 0.05,
               order = 5,
             },
+            grid = {
+              type = "group",
+              name = L["Button Grid"],
+              inline = true,
+              order = 6,
+              args = {
+                rows = {
+                  type = "range",
+                  name = L["Rows"],
+                  get  = function() return select(1,bar:GetButtonGrid()) end,
+                  set  = function(info, val) bar:SetButtonGrid(val) end,
+                  width = "double",
+                  min = 1,
+                  max = 32,
+                  step = 1,
+                  order = 2,
+                },
+                cols = {
+                  type = "range",
+                  name = L["Columns"],
+                  get  = function() return select(2,bar:GetButtonGrid()) end,
+                  set  = function(info, val) bar:SetButtonGrid(nil,val) end,
+                  width = "double",
+                  min = 1, 
+                  max = 32,
+                  step = 1,
+                  order = 3,
+                },
+                sz = {
+                  type = "range",
+                  name = L["Size"],
+                  get  = function() return select(1,bar:GetButtonSize()) end,
+                  set  = function(info, val) bar:SetButtonSize(val,val) end,
+                  width = "double",
+                  min = 10,
+                  max = 72,
+                  step = 1,
+                  order = 4,
+                },
+                spacing = {
+                  type = "range",
+                  name = L["Spacing"],
+                  get  = function() return select(3,bar:GetButtonGrid()) end,
+                  set  = function(info, val) bar:SetButtonGrid(nil,nil,val) end,
+                  width = "double",
+                  min = 0,
+                  max = 24,
+                  step = 1,
+                  order = 5,
+                }
+              }
+            },
             anchor = {
               type = "group",
               name = L["Anchor"],
               inline = true,
-              order = 6,
+              order = 7,
               args = {
                 frame = {
                   type = "input",
--- a/MultiCastButton.lua	Fri Jul 01 14:31:41 2011 -0700
+++ b/MultiCastButton.lua	Fri Jul 01 14:32:17 2011 -0700
@@ -325,24 +325,19 @@
 ReAction:RegisterBarType(MultiCast)
 
 function MultiCast:New( btnConfig, bar, idx )
-  local maxIndex = bar.nTotemSlots or 0
-  if bar.summonSlot then
-    maxIndex = maxIndex + 1
-  end
-  if bar.recallSlot then
-    maxIndex = maxIndex + 1
-  end
-
-  if not bar.hasMulticast or idx > maxIndex then
-    return false
-  end
-
-  if idx < 1 then
-    error("invalid index")
+  if idx < 1 or idx > NUM_MULTI_CAST_BUTTONS_PER_PAGE + 2 then
+    ReAction:UserError(L["All %s buttons are in use for this bar, cannot create any more buttons"]:format(self.barType))
+    error(nil)
   end
 
   self = Super.New(self, btnConfig, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" )
 
+  if not bar.hasMulticast or idx > bar.maxIndex then
+    -- Not enough multicast capability to use this button
+    self:Refresh()
+    return self
+  end
+
   local barFrame = bar:GetFrame()
   local f = self:GetFrame()
 
@@ -449,6 +444,13 @@
 function MultiCast:Refresh()
   Super.Refresh(self)
   self:UpdateAction()
+
+  local bar = self.bar
+  if bar.hasMulticast == true and self.idx <= bar.maxIndex or ReAction:GetConfigMode() then
+    self:GetFrame():Show()
+  else
+    self:GetFrame():Hide()
+  end
 end
 
 function MultiCast:ShowGrid( show )
@@ -611,8 +613,6 @@
 end
 
 function MultiCast:SetupBar( bar )
-  Super.SetupBar(self,bar)
-
   local slot = 0
   local nTotemSlots = 0
   local summonSlot = nil
@@ -641,16 +641,24 @@
     end
 	end
 
-  if nTotemSlots == 0 then
-    bar.hasMulticast = false -- no multicast capability
-    return
+  local maxIndex = nTotemSlots
+  if summonSlot then
+    maxIndex = maxIndex + 1
+  end
+  if recallSlot then
+    maxIndex = maxIndex + 1
   end
 
-  bar.hasMulticast = true
+  bar.hasMulticast = nTotemSlots > 0
   bar.summonSlot   = summonSlot
   bar.recallSlot   = recallSlot
   bar.nTotemSlots  = nTotemSlots
+  bar.maxIndex     = maxIndex
 
+  if bar.hasMulticast == false then
+    Super.SetupBar(self,bar)
+    return -- no multicast capability
+  end
 
   local f = bar:GetFrame()
 
@@ -771,7 +779,8 @@
     f.events_registered = true
   end
 
+  f:Execute(_bar_init)
 
-  f:Execute(_bar_init)
+  Super.SetupBar(self,bar) -- create buttons after this is done
 end
 
--- a/PetActionButton.lua	Fri Jul 01 14:31:41 2011 -0700
+++ b/PetActionButton.lua	Fri Jul 01 14:32:17 2011 -0700
@@ -31,10 +31,11 @@
 
 local _onReceiveDrag = -- function(self, button, kind, value, ...)
 [[
-  if kind then -- pet spells on the cursor return nil from GetCursorInfo(), which is very strange
+  if kind == "petaction" then
+    return "petaction", self:GetAttribute("action")
+  else
     return kind, value, ...
   end
-  return "petaction", self:GetAttribute("action")
 ]]
 
 --
@@ -81,6 +82,8 @@
 function Pet:New( config, bar, idx, idHint )
   self = Super.New(self, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" )
 
+  local name = self:GetFrame():GetName()
+
   local f = self:GetFrame()
   if not f.autoCastTexture then
     -- store autocast stuff with the frame for recycling
--- a/locale/enUS.lua	Fri Jul 01 14:31:41 2011 -0700
+++ b/locale/enUS.lua	Fri Jul 01 14:32:17 2011 -0700
@@ -215,6 +215,7 @@
 
 -- Button.lua --
 "Button Bar",
+"All action IDs for bars of type '%s' are in use, cannot create any more buttons",
 
 -- Overlay.lua
 "Hold Shift",
@@ -234,6 +235,7 @@
 
 -- MultiCastButton.lua
 "Totem Bar",
+"All %s buttons are in use for this bar, cannot create any more buttons",
 
 -- PetActionButton.lua
 "Pet Action Bar",