diff modules/ReAction_Action/ReAction_Action.lua @ 92:5f1d7a81317c

- Various bugfixes - Switched action bar paging/mc fully to the _childupdate method
author Flick <flickerstreak@gmail.com>
date Fri, 17 Oct 2008 22:43:57 +0000
parents c2504a8b996c
children 567a885cdfad
line wrap: on
line diff
--- a/modules/ReAction_Action/ReAction_Action.lua	Fri Oct 17 03:59:55 2008 +0000
+++ b/modules/ReAction_Action/ReAction_Action.lua	Fri Oct 17 22:43:57 2008 +0000
@@ -14,6 +14,7 @@
 local _G = _G
 local CreateFrame = CreateFrame
 local format = string.format
+local wipe = wipe
 
 ReAction:UpdateRevision("$Revision$")
 
@@ -259,6 +260,7 @@
       self.config.buttons = { }
     end
     self:Refresh()
+    self:SetKeybindMode(ReAction:GetKeybindMode())
     return self
   end
 
@@ -324,9 +326,10 @@
     for _, b in pairs(self.btns) do
       if mode then
         -- set the border for all buttons to the keybind-enable color
-        local r,g,b,a = KB:GetColorKeyBoundMode()
-      	b.border:SetVertexColor(r,g,b,a)
+      	b.border:SetVertexColor(KB:GetColorKeyBoundMode())
         b.border:Show()
+      elseif IsEquippedAction(b:GetActionID()) then
+        b.border:SetVertexColor(0, 1.0, 0, 0.35) -- from ActionButton.lua
       else
         b.border:Hide()
       end
@@ -563,10 +566,10 @@
 do
   local pageOptions = {
     page = {
-      name  = L["Show Page #"],
-      order = 11,
-      type  = "select",
-      width = "half",
+      name     = L["Show Page #"],
+      order    = 11,
+      type     = "select",
+      width    = "half",
       disabled = "IsPageDisabled",
       hidden   = "IsPageHidden",
       values   = "GetPageValues",
@@ -594,19 +597,22 @@
   end
 
   function PropHandler:GetPageValues()
+    if not self._pagevalues then
+      self._pagevalues = { }
+    end
     local c = GetBarConfig(self.bar)
     if c then
       local n = c.nPages
+        -- cache the results
       if self._npages ~= n then
-        self._pagevalues = { }
         self._npages = n
-        -- cache the results
+        wipe(self._pagevalues)
         for i = 1, n do
           self._pagevalues["page"..i] = i
         end
       end
-      return self._pagevalues
     end
+    return self._pagevalues
   end
 
   function PropHandler:GetPage(info)
@@ -809,6 +815,10 @@
       buttonLookup[f] = button
       f:SetKey(button:GetConfig().hotkey)
       ReAction:RegisterKeybindFrame(f)
+      if ReAction:GetKeybindMode() then
+      	button.border:SetVertexColor(KB:GetColorKeyBoundMode())
+        button.border:Show()
+      end
     end
   end
 
@@ -866,23 +876,7 @@
       f:SetAttribute("*action-mc", 120 + self.idx)
     end
     
-    -- wrap the OnClick handler to use a pagemap from the header's context
-    parent:WrapScript(f, "OnClick", 
-      -- function OnClick(self, button, down)
-      [[
-        if doMindControl and GetBonusBarOffset() == 5 then
-          return "mc"
-        else
-          return state and page and page[state] or button
-        end
-      ]])
-
     -- set a _childupdate handler, called within the header's context
-    -- SetAttribute() is a brute-force way to trigger ActionButton_UpdateAction(). Setting "*action1"
-    -- will, in the absence of a useful replacement for SecureButton_GetEffectiveButton(), force
-    -- ActionButton_CalculateAction() to use the new action-id for display purposes. It also 
-    -- sort of obviates the OnClick handler, but hopefully this is only temporary until
-    -- SecureButton_GetEffectiveButton() gets fixed.
     f:SetAttribute("_childupdate", 
       -- function _childupdate(self, snippetid, message)
       [[
@@ -893,7 +887,7 @@
           action = "*action-"..page[state]
         end
         local value = self:GetAttribute(action)
-        self:SetAttribute("*action1",value)
+        self:SetAttribute("action",value)
       ]])
 
     self.frame = f