Mercurial > wow > reaction
changeset 286:77609bfa804e stable
Merge 1.1 beta 8 to stable
author | Flick |
---|---|
date | Sat, 11 Jun 2011 10:57:00 -0700 |
parents | 71d1a5e47e72 (current diff) 855521204ae9 (diff) |
children | 54d7865baae9 |
files | .hgtags |
diffstat | 16 files changed, 292 insertions(+), 217 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Wed May 11 09:53:48 2011 -0700 +++ b/.hgtags Sat Jun 11 10:57:00 2011 -0700 @@ -4,6 +4,5 @@ 47818b3938c912c19018419cb5738d4013107167 1.1 beta 4 455ef506f9695045737410a6529c9c6eb7d33022 1.1 beta 5 b2e401183d36cd1283df64eef68a92a9ce08cc46 1.1 beta 6 -8fde9da2165208725cc960d54d4656e5a7d74aec 1.1 beta 7 -8fde9da2165208725cc960d54d4656e5a7d74aec 1.1 beta 7 28f91ed1560ff659d92f3dd3d3042dd818d1d198 1.1 beta 7 +499ca4edf033da3ec4fc52fd1058bf27b2679bbe 1.1 beta 8
--- a/ActionButton.lua Wed May 11 09:53:48 2011 -0700 +++ b/ActionButton.lua Sat Jun 11 10:57:00 2011 -0700 @@ -1,5 +1,5 @@ -local addonName, addonTable = ... -local ReAction = addonTable.ReAction +local _, ns = ... +local ReAction = ns.ReAction local L = ReAction.L local _G = _G local CreateFrame = CreateFrame @@ -194,9 +194,7 @@ ReAction:RegisterBarType(Action, true) function Action:New( config, bar, idx, idHint ) - local name = format("ReAction_%s_Action_%d",bar:GetName(),idx) - - self = Super.New(self, name, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) + self = Super.New(self, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) self.barConfig = bar:GetConfig() local f = self:GetFrame()
--- a/BagButton.lua Wed May 11 09:53:48 2011 -0700 +++ b/BagButton.lua Sat Jun 11 10:57:00 2011 -0700 @@ -1,5 +1,5 @@ -local addonName, addonTable = ... -local ReAction = addonTable.ReAction +local _, ns = ... +local ReAction = ns.ReAction local L = ReAction.L local _G = _G local CreateFrame = CreateFrame @@ -49,8 +49,6 @@ -- function BagBase:New( btnCfg, bar, idx, idHint ) - local name = format("ReAction_%s_Bag_%d",bar:GetName(),idx) - -- use a variable private leaf implementation class -- unlike traditional OO programming, we can initialize the leaf -- class before initializing its parent @@ -60,7 +58,7 @@ elseif idx == 6 then class = Keyring end - self = class:New(name, btnCfg, bar, idx) + self = class:New(btnCfg, bar, idx) local f = self:GetFrame() local config = self:GetConfig()
--- a/Bar.lua Wed May 11 09:53:48 2011 -0700 +++ b/Bar.lua Sat Jun 11 10:57:00 2011 -0700 @@ -1,5 +1,5 @@ -local addonName, addonTable = ... -local ReAction = addonTable.ReAction +local _, ns = ... +local ReAction = ns.ReAction local L = ReAction.L local LKB = ReAction.LKB local _G = _G @@ -7,9 +7,9 @@ local floor = math.floor local fmod = math.fmod local format = string.format -local tfetch = addonTable.tfetch -local tbuild = addonTable.tbuild -local fieldsort = addonTable.fieldsort +local tfetch = ns.tfetch +local tbuild = ns.tbuild +local fieldsort = ns.fieldsort local LSG = LibStub("ReAction-LibShowActionGrid-1.0") @@ -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 @@ -368,8 +371,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 @@ -403,6 +409,7 @@ b:ShowGridTemp(mode) b:UpdateActionIDLabel(mode) end + self.buttonClass:SetupBar(self) -- force a full refresh end function Bar:SetKeybindMode(mode) @@ -667,10 +674,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 09:53:48 2011 -0700 +++ b/Button.lua Sat Jun 11 10:57:00 2011 -0700 @@ -1,10 +1,5 @@ ---[[ - ReAction Button base class ---]] - --- local imports -local addonName, addonTable = ... -local ReAction = addonTable.ReAction +local _, ns = ... +local ReAction = ns.ReAction local L = ReAction.L local LKB = ReAction.LKB local _G = _G @@ -32,14 +27,17 @@ btnColumns = 12, spacing = 3 }, - barType = L["Button Bar"] + -- barType = L["Button Bar"], -- derived classes must declare + -- buttonTypeID = "Button" -- derived classes must declare } ReAction.Button = Button -- export to ReAction -function Button:New( name, config, bar, idx, inherits, buttonType ) +function Button:New( config, bar, idx, inherits, buttonType ) buttonType = buttonType or "CheckButton" + local name = format("ReAction_%s_%s_%d",bar:GetName(), self.buttonTypeID, idx) + -- create new self self = setmetatable( { @@ -190,7 +188,9 @@ if not success then bar:ClipNButtons(n) cfgN = n - geterrorhandler()(r) + if r then + geterrorhandler()(r) + end end end end @@ -237,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(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 end
--- a/Editor.lua Wed May 11 09:53:48 2011 -0700 +++ b/Editor.lua Sat Jun 11 10:57:00 2011 -0700 @@ -1,12 +1,12 @@ -local addonName, addonTable = ... -local ReAction = addonTable.ReAction +local _, ns = ... +local ReAction = ns.ReAction local L = ReAction.L local _G = _G local wipe = wipe local format = string.format local InCombatLockdown = InCombatLockdown -local tfetch = addonTable.tfetch -local tbuild = addonTable.tbuild +local tfetch = ns.tfetch +local tbuild = ns.tbuild local AceConfigReg = LibStub("AceConfigRegistry-3.0") local AceConfigDialog = LibStub("AceConfigDialog-3.0") @@ -131,7 +131,7 @@ name = L["Rows"], get = function() return self.tmp.barRows or 1 end, set = function(info, val) self.tmp.barRows = val end, - width = "full", + width = "double", min = 1, max = 32, step = 1, @@ -142,7 +142,7 @@ name = L["Columns"], get = function() return self.tmp.barCols or 12 end, set = function(info, val) self.tmp.barCols = val end, - width = "full", + width = "double", min = 1, max = 32, step = 1, @@ -153,7 +153,7 @@ name = L["Size"], get = function() return self.tmp.barSize or 36 end, set = function(info, val) self.tmp.barSize = val end, - width = "full", + width = "double", min = 10, max = 72, step = 1, @@ -164,7 +164,7 @@ name = L["Spacing"], get = function() return self.tmp.barSpacing or 3 end, set = function(info, val) self.tmp.barSpacing = val end, - width = "full", + width = "double", min = 0, max = 24, step = 1, @@ -255,19 +255,89 @@ func = function() ReAction:EraseBar(bar) end, order = 2 }, + optionsHdr = { + type = "header", + name = "", + order = 3, + }, clickDown = { type = "toggle", name = L["Activate on Down"], desc = L["Activate the button when the key or mouse button is pressed down instead of when it is released"], - order = 3, + order = 4, + width = "full", set = function(info, value) bar:GetConfig().clickDown = value; ReAction:RebuildAll() end, get = function() return bar:GetConfig().clickDown end, }, + alpha = { + type = "range", + name = L["Transparency"], + get = function() return bar:GetAlpha() end, + set = function(info, val) bar:SetAlpha(val) end, + min = 0, + max = 1, + isPercent = true, + step = 0.01, + 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 = 4, + order = 7, args = { frame = { type = "input", @@ -331,18 +401,6 @@ }, }, }, - alpha = { - type = "range", - name = L["Transparency"], - get = function() return bar:GetAlpha() end, - set = function(info, val) bar:SetAlpha(val) end, - min = 0, - max = 1, - isPercent = true, - step = 0.01, - bigStep = 0.05, - order = 4, - }, }, }, buttonOpts = self:CreateButtonOptions(bar), @@ -424,35 +482,10 @@ local ActionHandler = { buttonClass = ReAction.Button.Action, options = { - hideEmpty = { - name = L["Hide Empty Buttons"], - order = 1, - type = "toggle", - width = "double", - get = "GetHideEmpty", - set = "SetHideEmpty", - }, - lockButtons = { - name = L["Lock Buttons"], - desc = L["Prevents picking up/dragging actions (use SHIFT to override this behavior)"], - order = 2, - type = "toggle", - get = "GetLockButtons", - set = "SetLockButtons", - }, - lockOnlyCombat = { - name = L["Only in Combat"], - desc = L["Only lock the buttons when in combat"], - order = 3, - type = "toggle", - disabled = "LockButtonsCombatDisabled", - get = "GetLockButtonsCombat", - set = "SetLockButtonsCombat", - }, pages = { name = L["# Pages"], desc = L["Use the Dynamic State tab to specify page transitions"], - order = 4, + order = 1, type = "range", min = 1, max = 10, @@ -463,21 +496,46 @@ mindcontrol = { name = L["Mind Control Support"], desc = L["When possessing a target (e.g. via Mind Control), map the first 12 buttons of this bar to the possessed target's actions."], - order = 5, + order = 2, type = "toggle", - width = "double", set = "SetMindControl", get = "GetMindControl", }, vehicle = { name = L["Vehicle Support"], desc = L["When on a vehicle, map the first 6 buttons of this bar to the vehicle actions. The vehicle-exit button is mapped to the 7th button. Pitch controls are not supported."], - order = 6, + order = 3, type = "toggle", - width = "double", get = "GetVehicle", set = "SetVehicle", }, + hideEmpty = { + name = L["Hide Empty Buttons"], + order = 4, + type = "toggle", + width = "full", + get = "GetHideEmpty", + set = "SetHideEmpty", + }, + lockButtons = { + name = L["Lock Buttons"], + desc = L["Prevents picking up/dragging actions (use SHIFT to override this behavior)"], + order = 5, + width = "full", + type = "toggle", + get = "GetLockButtons", + set = "SetLockButtons", + }, + lockOnlyCombat = { + name = L["Only in Combat"], + desc = L["Only lock the buttons when in combat"], + order = 6, + width = "full", + type = "toggle", + disabled = "LockButtonsCombatDisabled", + get = "GetLockButtonsCombat", + set = "SetLockButtonsCombat", + }, actions = { name = L["Edit Action IDs"], order = 7, @@ -488,7 +546,7 @@ name = L["Assign"], order = 1, type = "select", - width = "double", + width = "full", values = { [0] = L["Choose Method..."], [1] = L["Individually"], [2] = L["All at Once"], }, @@ -1006,12 +1064,6 @@ order = 1, type = "group", args = { - delete = { - name = L["Delete this State"], - order = -1, - type = "execute", - func = "DeleteState", - }, rename = { name = L["Name"], order = 1, @@ -1021,10 +1073,17 @@ pattern = "^%w*$", usage = L["State names must be alphanumeric without spaces"], }, + delete = { + name = L["Delete this State"], + order = 2, + type = "execute", + func = "DeleteState", + confirm = true, + }, ordering = { name = L["Evaluation Order"], desc = L["State transitions are evaluated in the order listed: Move a state up or down to change the order"], - order = 2, + order = 3, type = "group", inline = true, args = { @@ -1070,6 +1129,7 @@ hide = { name = L["Hide Bar"], order = 90, + width = "full", type = "toggle", set = "SetProp", get = "GetProp", @@ -1083,51 +1143,57 @@ set = "SetProp", get = "GetProp", }, ]] - position = { + + anchorEnable = { + name = L["Reposition"], + order = 111, + type = "toggle", + set = "SetProp", + get = "GetProp", + }, + anchorGroup = { name = L["Position"], - order = 92, + order = 112, type = "group", inline = true, + disabled = "GetAnchorDisabled", args = { - anchorEnable = { - name = L["Reposition"], - order = 1, - type = "toggle", - set = "SetProp", - get = "GetProp", - }, anchorFrame = { name = L["Anchor Frame"], - order = 2, + order = 1, type = "select", values = "GetAnchorFrames", set = "SetAnchorFrame", get = "GetAnchorFrame", - disabled = "GetAnchorDisabled", - hidden = "GetAnchorDisabled", }, anchorPoint = { name = L["Point"], + order = 2, + type = "select", + values = pointTable, + set = "SetAnchorPointProp", + get = "GetAnchorPointProp", + }, + anchorRelPoint = { + name = L["Relative Point"], order = 3, type = "select", values = pointTable, set = "SetAnchorPointProp", get = "GetAnchorPointProp", - disabled = "GetAnchorDisabled", - hidden = "GetAnchorDisabled", - }, - anchorRelPoint = { - name = L["Relative Point"], - order = 4, - type = "select", - values = pointTable, - set = "SetAnchorPointProp", - get = "GetAnchorPointProp", - disabled = "GetAnchorDisabled", - hidden = "GetAnchorDisabled", }, anchorX = { name = L["X Offset"], + order = 4, + type = "range", + min = -100, + max = 100, + step = 1, + set = "SetProp", + get = "GetProp", + }, + anchorY = { + name = L["Y Offset"], order = 5, type = "range", min = -100, @@ -1135,39 +1201,27 @@ step = 1, set = "SetProp", get = "GetProp", - disabled = "GetAnchorDisabled", - hidden = "GetAnchorDisabled", - }, - anchorY = { - name = L["Y Offset"], - order = 6, - type = "range", - min = -100, - max = 100, - step = 1, - set = "SetProp", - get = "GetProp", - disabled = "GetAnchorDisabled", - hidden = "GetAnchorDisabled", }, }, }, - scale = { + + enableScale = { + name = L["Set New Scale"], + order = 121, + type = "toggle", + set = "SetProp", + get = "GetProp", + }, + scaleGroup = { name = L["Scale"], - order = 93, + order = 122, type = "group", inline = true, + disabled = "GetScaleDisabled", args = { - enableScale = { - name = L["Set New Scale"], - order = 1, - type = "toggle", - set = "SetProp", - get = "GetProp", - }, scale = { name = L["Scale"], - order = 2, + order = 1, type = "range", min = 0.25, max = 2.5, @@ -1175,27 +1229,27 @@ isPercent = true, set = "SetProp", get = "GetScale", - disabled = "GetScaleDisabled", - hidden = "GetScaleDisabled", }, }, }, - alpha = { + + enableAlpha = { + name = L["Set Transparency"], + order = 131, + type = "toggle", + set = "SetProp", + get = "GetProp", + }, + alphaGroup = { name = L["Transparency"], - order = 94, + order = 132, type = "group", inline = true, + disabled = "GetAlphaDisabled", args = { - enableAlpha = { - name = L["Set Transparency"], - order = 1, - type = "toggle", - set = "SetProp", - get = "GetProp", - }, alpha = { name = L["Transparency"], - order = 2, + order = 1, type = "range", min = 0, max = 1, @@ -1204,8 +1258,6 @@ isPercent = true, set = "SetProp", get = "GetAlpha", - disabled = "GetAlphaDisabled", - hidden = "GetAlphaDisabled", }, }, }, @@ -1221,7 +1273,7 @@ name = L["Select this state"], order = 2, type = "select", - style = "radio", + style = "dropdown", values = { default = L["by default"], any = L["when ANY of these"], @@ -1681,7 +1733,7 @@ -- TODO: select default state options and pass as final argument states[name] = { } optionMap[bar].args[name] = CreateStateOptions(bar,name) - ReAction:ShowEditor(bar, moduleID, name) + ReAction:ShowEditor(bar, "stateOpts", name) private.newstatename = "" end end,
--- a/MultiCastButton.lua Wed May 11 09:53:48 2011 -0700 +++ b/MultiCastButton.lua Sat Jun 11 10:57:00 2011 -0700 @@ -1,5 +1,5 @@ -local addonName, addonTable = ... -local ReAction = addonTable.ReAction +local _, ns = ... +local ReAction = ns.ReAction local L = ReAction.L local _G = _G local CreateFrame = CreateFrame @@ -21,6 +21,7 @@ local GetActionTexture = GetActionTexture local GetMultiCastTotemSpells = GetMultiCastTotemSpells +--@do-not-package@ --[[ Blizzard Constants: - NUM_MULTI_CAST_BUTTONS_PER_PAGE = 4 @@ -90,7 +91,7 @@ ]]-- - +--@end-do-not-package@ -- -- Secure snippets @@ -324,26 +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 + 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 - if not bar.hasMulticast or idx > maxIndex then - return false + 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 - if idx < 1 then - error("invalid index") - end - - local name = format("ReAction_%s_Totem_%d",bar:GetName(),idx) - - self = Super.New(self, name, btnConfig, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) - local barFrame = bar:GetFrame() local f = self:GetFrame() @@ -450,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 ) @@ -612,8 +613,6 @@ end function MultiCast:SetupBar( bar ) - Super.SetupBar(self,bar) - local slot = 0 local nTotemSlots = 0 local summonSlot = nil @@ -642,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() @@ -772,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/Options.lua Wed May 11 09:53:48 2011 -0700 +++ b/Options.lua Sat Jun 11 10:57:00 2011 -0700 @@ -1,5 +1,5 @@ -local addonName, addonTable = ... -local ReAction = addonTable.ReAction +local _, ns = ... +local ReAction = ns.ReAction local L = ReAction.L local InCombatLockdown = InCombatLockdown
--- a/Overlay.lua Wed May 11 09:53:48 2011 -0700 +++ b/Overlay.lua Sat Jun 11 10:57:00 2011 -0700 @@ -1,5 +1,5 @@ -local addonName, addonTable = ... -local ReAction = addonTable.ReAction +local _, ns = ... +local ReAction = ns.ReAction local L = ReAction.L local LKB = ReAction.LKB local CreateFrame = CreateFrame @@ -723,8 +723,10 @@ -- export methods to the Bar prototype Bar.Overlay = { } +local proto = {__index = Bar.Overlay} + function Bar.Overlay:New( bar ) - return setmetatable( {frame = CreateControls(bar)}, {__index=self} ) + return setmetatable( {frame = CreateControls(bar)}, proto ) end function Bar.Overlay:SetLabel(name)
--- a/PetActionButton.lua Wed May 11 09:53:48 2011 -0700 +++ b/PetActionButton.lua Sat Jun 11 10:57:00 2011 -0700 @@ -1,5 +1,5 @@ -local addonName, addonTable = ... -local ReAction = addonTable.ReAction +local _, ns = ... +local ReAction = ns.ReAction local L = ReAction.L local _G = _G local CreateFrame = CreateFrame @@ -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") ]] -- @@ -79,9 +80,9 @@ ReAction:RegisterBarType(Pet) function Pet:New( config, bar, idx, idHint ) - local name = format("ReAction_%s_PetAction_%d",bar:GetName(),idx) - - self = Super.New(self, name, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) + self = Super.New(self, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) + + local name = self:GetFrame():GetName() local f = self:GetFrame() if not f.autoCastTexture then @@ -162,7 +163,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/Profile.lua Wed May 11 09:53:48 2011 -0700 +++ b/Profile.lua Sat Jun 11 10:57:00 2011 -0700 @@ -1,5 +1,5 @@ -local _, addonTable = ... -local ReAction = addonTable.ReAction +local _, ns = ... +local ReAction = ns.ReAction ReAction.PROFILEVERSION_LATEST = 2
--- a/ReAction.lua Wed May 11 09:53:48 2011 -0700 +++ b/ReAction.lua Sat Jun 11 10:57:00 2011 -0700 @@ -1,8 +1,9 @@ -local addonName, addonTable = ... +local _, ns = ... local pcall = pcall 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 @@ -58,16 +59,16 @@ end -- store in the addon table -addonTable.tcopy = tcopy -addonTable.tfetch = tfetch -addonTable.tbuild = tbuild -addonTable.fieldsort = fieldsort +ns.tcopy = tcopy +ns.tfetch = tfetch +ns.tbuild = tbuild +ns.fieldsort = fieldsort ------ Core ------ local ReAction = LibStub("AceAddon-3.0"):NewAddon( "ReAction", "AceEvent-3.0" ) -addonTable.ReAction = ReAction +ns.ReAction = ReAction ReAction.version = GetAddOnMetadata("ReAction","Version") ReAction.L = L ReAction.LKB = LKB @@ -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/ReAction.toc Wed May 11 09:53:48 2011 -0700 +++ b/ReAction.toc Sat Jun 11 10:57:00 2011 -0700 @@ -4,7 +4,7 @@ ## DefaultState: enabled ## LoadOnDemand: 0 ## Author: Flick -## Version: 1.1 beta 7 +## Version: @project-version@ ## SavedVariables: ReAction_DB ## X-Embeds: Ace3, LibKeyBound-1.0 ## X-Category: Action Bars
--- a/StanceButton.lua Wed May 11 09:53:48 2011 -0700 +++ b/StanceButton.lua Sat Jun 11 10:57:00 2011 -0700 @@ -1,5 +1,5 @@ -local addonName, addonTable = ... -local ReAction = addonTable.ReAction +local _, ns = ... +local ReAction = ns.ReAction local L = ReAction.L local _G = _G local CreateFrame = CreateFrame @@ -53,9 +53,7 @@ ReAction:RegisterBarType(Stance) function Stance:New( config, bar, idx, idHint ) - local name = format("ReAction_%s_Stance_%d",bar:GetName(),idx) - - self = Super.New(self, name, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) + self = Super.New(self, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) local f = self:GetFrame() local barFrame = bar:GetFrame() @@ -113,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 09:53:48 2011 -0700 +++ b/VehicleExitButton.lua Sat Jun 11 10:57:00 2011 -0700 @@ -1,5 +1,5 @@ -local addonName, addonTable = ... -local ReAction = addonTable.ReAction +local _, ns = ... +local ReAction = ns.ReAction local L = ReAction.L local format = string.format @@ -29,9 +29,7 @@ ReAction:RegisterBarType(VExitButton) function VExitButton:New( config, bar, idx ) - local name = format("ReAction_%s_VehicleExit_%d",bar:GetName(),idx) - - self = Super.New(self, name, config, bar, idx, "SecureFrameTemplate, ActionButtonTemplate", "Button") + self = Super.New(self, config, bar, idx, "SecureFrameTemplate, ActionButtonTemplate", "Button") -- frame setup local f = self:GetFrame() @@ -96,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
--- a/locale/enUS.lua Wed May 11 09:53:48 2011 -0700 +++ b/locale/enUS.lua Sat Jun 11 10:57:00 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",