Mercurial > wow > reaction
changeset 91:c2504a8b996c
Bug fixes
- action buttons resetting to 6 pixels
- stray prints
- config panels for action buttons not showing all panels
- fixed multi-ID typo
- fixed autocast model on pet buttons
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Fri, 17 Oct 2008 03:59:55 +0000 |
parents | 7cabc8ac6c16 |
children | 5f1d7a81317c |
files | ReAction.lua State.lua modules/ReAction_Action/ReAction_Action.lua modules/ReAction_ConfigUI/ReAction_ConfigUI.lua modules/ReAction_PetAction/ReAction_PetAction.lua |
diffstat | 5 files changed, 45 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/ReAction.lua Wed Oct 15 16:29:41 2008 +0000 +++ b/ReAction.lua Fri Oct 17 03:59:55 2008 +0000 @@ -286,25 +286,31 @@ end -- usage: --- (1) ReAction:CreateBar(name, cfgTable) +-- (1) ReAction:CreateBar(name, [cfgTable]) -- (2) ReAction:CreateBar(name, "barType", [nRows], [nCols], [btnSize], [btnSpacing]) -function ReAction:CreateBar(name, ...) - local config = select(1,...) - if config and type(config) ~= "table" then - bartype = select(1,...) - if type(bartype) ~= "string" then - error("ReAction:CreateBar() - first argument must be a config table or a default config type string") - end - config = defaultBarConfig[bartype] +function ReAction:CreateBar(name, config, ...) + local profile = self.db.profile + + if not name then + local prefix = L["Bar "] + local i = 1 + repeat + name = prefix..i + i = i + 1 + until bars[name] == nil + end + + if type(config) == "string" then + config = defaultBarConfig[config] if not config then - error(("ReAction:CreateBar() - unknown bar type '%s'"):format(bartype)) + error(("ReAction:CreateBar() - unknown bar type '%s'"):format(tostring(select(1,...)))) end config = DeepCopy(config) - config.btnRows = select(2,...) or config.btnRows or 1 - config.btnColumns = select(3,...) or config.btnColumns or 12 - config.btnWidth = select(4,...) or config.btnWidth or 36 - config.btnHeight = select(4,...) or config.btnHeight or 36 - config.spacing = select(5,...) or config.spacing or 3 + config.btnRows = select(1,...) or config.btnRows or 1 + config.btnColumns = select(2,...) or config.btnColumns or 12 + config.btnWidth = select(3,...) or config.btnWidth or 36 + config.btnHeight = select(3,...) or config.btnHeight or 36 + config.spacing = select(4,...) or config.spacing or 3 config.width = config.width or config.btnColumns*(config.btnWidth + config.spacing) + 1 config.height = config.height or config.btnRows*(config.btnHeight + config.spacing) + 1 config.anchor = config.anchor or "UIParent" @@ -313,18 +319,10 @@ config.y = config.y or 200 config.x = config.x or 0 end - local profile = self.db.profile - config = config or DeepCopy(profile.defaultBar) - prefix = prefix or L["Bar "] - if not name then - i = 1 - repeat - name = prefix..i - i = i + 1 - until bars[name] == nil - end - profile.bars[name] = profile.bars[name] or config - local bar = self.Bar:New( name, profile.bars[name] ) -- ReAction.Bar defined in Bar.lua + config = config or profile.bars[name] or DeepCopy(profile.defaultBar) + + profile.bars[name] = config + local bar = self.Bar:New( name, config ) -- ReAction.Bar defined in Bar.lua bars[name] = bar callbacks:Fire("OnCreateBar", bar, name) if private.configMode then
--- a/State.lua Wed Oct 15 16:29:41 2008 +0000 +++ b/State.lua Fri Oct 17 03:59:55 2008 +0000 @@ -106,14 +106,12 @@ local onStateHandler = -- function _onstate-reaction( self, stateid, newstate ) [[ - print("received state",newstate,"on bar",self:GetName()) set_state = newstate or set_state local oldState = state state = state_override or set_state or state for i = 1, #propfuncs do - print("running state func",propfuncs[i]) control:RunAttribute("func-"..propfuncs[i]) end @@ -377,7 +375,6 @@ function RegisterProperty( propname, snippet ) properties[propname] = snippet or true - print("registered property",propname) for _, bar in ReAction:IterateBars() do local states = tfetch(module.db.profile.bars, bar:GetName(), "states") if states then
--- a/modules/ReAction_Action/ReAction_Action.lua Wed Oct 15 16:29:41 2008 +0000 +++ b/modules/ReAction_Action/ReAction_Action.lua Fri Oct 17 03:59:55 2008 +0000 @@ -58,7 +58,7 @@ ReAction:RegisterBarType(L["Action Bar"], { type = moduleID, - defaultButtonSize = 6, + defaultButtonSize = 36, defaultBarRows = 1, defaultBarCols = 12, defaultBarSpacing = 3 @@ -541,7 +541,7 @@ end function Handle:SetMultiID(info, value) - local p = ParseMultiID(#btns, self.config.nPages or 1, value) + local p = ParseMultiID(#self.btns, self.config.nPages or 1, value) for page, b in ipairs(p) do for button, id in ipairs(b) do self.btns[button]:SetActionID(id, page) @@ -893,7 +893,6 @@ action = "*action-"..page[state] end local value = self:GetAttribute(action) - print("setting action",value,"page[state]=",page and page[state]) self:SetAttribute("*action1",value) ]])
--- a/modules/ReAction_ConfigUI/ReAction_ConfigUI.lua Wed Oct 15 16:29:41 2008 +0000 +++ b/modules/ReAction_ConfigUI/ReAction_ConfigUI.lua Fri Oct 17 03:59:55 2008 +0000 @@ -425,7 +425,10 @@ end function editor:OnCreateBar(evt, bar) - self:CreateBarTree(bar) + if not tmp.creating then + -- a bit of hack to work around OnCreateBar event handler ordering + self:CreateBarTree(bar) + end end function editor:OnDestroyBar(evt, bar, name) @@ -473,9 +476,12 @@ function editor:CreateBar() if tmp.barName and tmp.barName ~= "" then - ReAction:CreateBar(tmp.barName, tmp.barType or ReAction:GetDefaultBarType(), tmp.barRows, tmp.barCols, tmp.barSize, tmp.barSpacing) + tmp.creating = true + local bar = ReAction:CreateBar(tmp.barName, tmp.barType or ReAction:GetDefaultBarType(), tmp.barRows, tmp.barCols, tmp.barSize, tmp.barSpacing) + self:CreateBarTree(bar) AceConfigDialog:SelectGroup(editorName, barOptMap[tmp.barName]) tmp.barName = nil + tmp.creating = false end end
--- a/modules/ReAction_PetAction/ReAction_PetAction.lua Wed Oct 15 16:29:41 2008 +0000 +++ b/modules/ReAction_PetAction/ReAction_PetAction.lua Fri Oct 17 03:59:55 2008 +0000 @@ -149,13 +149,14 @@ ---- Options ---- function module:GetBarOptions(bar) - return { - type = "group", - name = L["Pet Buttons"], - hidden = function() return bar.config.type ~= moduleID end, - args = { + if bar.config.type == moduleID then + return { + type = "group", + name = L["Pet Buttons"], + args = { + } } - } + end end @@ -326,13 +327,13 @@ end if autoCastEnabled then - self.acModel:Show(); + AutoCastShine_AutoCastStart(self.acModel) else - self.acModel:Hide(); + AutoCastShine_AutoCastStop(self.acModel) end if texture then - if GetPetActionsUsable() then + if GetPetActionSlotUsable(id) then SetDesaturation(self.icon,nil) else SetDesaturation(self.icon,1)