changeset 21:90bf38d48efd

committing changes to obsolete 0.4 series
author Flick <flickerstreak@gmail.com>
date Fri, 07 Mar 2008 21:54:26 +0000
parents 2f3e45fcb9e2
children 1b9323256a1b
files Buttons.lua Defaults.lua classes/ReAction.lua main.lua
diffstat 4 files changed, 32 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/Buttons.lua	Tue May 22 16:39:02 2007 +0000
+++ b/Buttons.lua	Fri Mar 07 21:54:26 2008 +0000
@@ -32,7 +32,7 @@
 Action.defaultProfile = {
   type = "ReAction",
   subtype = "Action",
-  ids = { },
+  buttons = { },
   selfcast = nil,
   keyBindLoc = "TOPRIGHT",
   keyBindRightLoc = "RIGHT",
@@ -50,7 +50,7 @@
 PetAction.defaultProfile = {
   type = "ReAction",
   subtype = "Pet Action",
-  ids = { },
+  buttons = { },
   keyBindLoc = "TOPRIGHT",
   showKeyBind = false,
   showGrid = false,
--- a/Defaults.lua	Tue May 22 16:39:02 2007 +0000
+++ b/Defaults.lua	Fri Mar 07 21:54:26 2008 +0000
@@ -120,18 +120,21 @@
 local bars = ReAction_DefaultBlizzardBars
 
 for i = 1, 12 do
-  bars[1].btnConfig.ids[i] = {
-    i, 
-    72+i, 
-    84+i,
-    96+i,
-    108+i,
-    12+i
+  bars[1].btnConfig.buttons[i] = {
+    id = i,
+    actions = {
+      i, 
+      72+i, 
+      84+i,
+      96+i,
+      108+i,
+      12+i
+    }
   }
 end
 
 for i = 1, 10 do
-  bars[10].btnConfig.ids[i] = { i }
+  bars[10].btnConfig.buttons[i] = { id = i }
 end
 
 
--- a/classes/ReAction.lua	Tue May 22 16:39:02 2007 +0000
+++ b/classes/ReAction.lua	Fri Mar 07 21:54:26 2008 +0000
@@ -22,7 +22,10 @@
 -- config = {
 --   type = "ReAction", -- static string (used by ReBar)
 --   subtype = "string", -- ReAction implementation identifier (index into ReAction.buttonTypes)
---   ids = { {paged list}, {paged list}, ... } -- indexed by self.barIdx
+--   buttons = {
+--     id = n, -- global button ID number
+--     actions = { {paged list}, {paged list}, ... } -- indexed by self.barIdx
+--   }
 -- }
 --
 
@@ -168,7 +171,7 @@
   local primary = nil
 
   for i = 1, pages do
-    local hint = config.ids[barIdx] and config.ids[barIdx][i]
+    local hint = config.buttons and config.buttons.actions[barIdx]
     if hint == nil and i > 1 and ids[i-1] then
       hint = ids[i-1] + (buttonsPerPage or 0)
     end
@@ -187,7 +190,7 @@
       primary.button = btnType:new(ids[1])
     end
     if primary.button then
-      config.ids[barIdx] = ids
+      config.buttons.actions[barIdx] = ids
       primary.button:Configure(config,barIdx)
     end
   end
@@ -197,7 +200,7 @@
 
 function ReAction:Release( b )
   if b then
-    for i = 1, #b.config.ids[b.barIdx] do
+    for i = 1, #b.config.buttons.actions[b.barIdx] do
       local id = b:GetID(i)
       if id then
         b.class._idTbl[id].inUse = false
@@ -267,12 +270,12 @@
 
 function ReAction.prototype:SetPages( n )
   n = tonumber(n)
-  local ids = self.config.ids[self.barIdx]
+  local ids = self.config.buttons.actions[self.barIdx]
   if n and n >= 1 then
     -- note that as long as n >= 1 then id[1] will never be modified, which is what we want
     -- because then the button frame ID would be out of sync with the static button name
     while #ids < n do
-      local id = ReAction:GetAvailableID(self.config.subtype, ids[#ids] + #self.config.ids)
+      local id = ReAction:GetAvailableID(self.config.subtype, ids[#ids] + #self.config.buttons.actions)
       if id == nil then
         break
       end
@@ -312,7 +315,7 @@
   self.config   = config
   self.barIdx   = barIdx
 
-  local ids = config.ids[barIdx]
+  local ids = config.buttons.actions[barIdx]
   self:SetID(ids[1]) -- default id
   for i = 1, #ids do
     self:SetID(ids[i], i) -- paged ids
--- a/main.lua	Tue May 22 16:39:02 2007 +0000
+++ b/main.lua	Fri Mar 07 21:54:26 2008 +0000
@@ -122,6 +122,15 @@
 end
 
 function main:UpgradeProfile()
+  for _, bar in pairs(self.db.profile.bars) do
+    if bar.btnConfig and bar.btnConfig.ids then
+      bar.btnConfig.buttons = { }
+      for i, ids in ipairs(bar.btnConfig.ids) do
+        bar.btnConfig.buttons[i] = { id = ids[1], actions = ids }
+      end
+      bar.btnConfig.ids = nil
+    end
+  end
 end