Mercurial > wow > reaction
diff ReAction.lua @ 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 |
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