Mercurial > wow > reaction
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 90:7cabc8ac6c16 | 91:c2504a8b996c |
|---|---|
| 284 -- any user errors should be flashed to the UIErrorsFrame | 284 -- any user errors should be flashed to the UIErrorsFrame |
| 285 UIErrorsFrame:AddMessage(msg) | 285 UIErrorsFrame:AddMessage(msg) |
| 286 end | 286 end |
| 287 | 287 |
| 288 -- usage: | 288 -- usage: |
| 289 -- (1) ReAction:CreateBar(name, cfgTable) | 289 -- (1) ReAction:CreateBar(name, [cfgTable]) |
| 290 -- (2) ReAction:CreateBar(name, "barType", [nRows], [nCols], [btnSize], [btnSpacing]) | 290 -- (2) ReAction:CreateBar(name, "barType", [nRows], [nCols], [btnSize], [btnSpacing]) |
| 291 function ReAction:CreateBar(name, ...) | 291 function ReAction:CreateBar(name, config, ...) |
| 292 local config = select(1,...) | 292 local profile = self.db.profile |
| 293 if config and type(config) ~= "table" then | 293 |
| 294 bartype = select(1,...) | 294 if not name then |
| 295 if type(bartype) ~= "string" then | 295 local prefix = L["Bar "] |
| 296 error("ReAction:CreateBar() - first argument must be a config table or a default config type string") | 296 local i = 1 |
| 297 end | 297 repeat |
| 298 config = defaultBarConfig[bartype] | 298 name = prefix..i |
| 299 i = i + 1 | |
| 300 until bars[name] == nil | |
| 301 end | |
| 302 | |
| 303 if type(config) == "string" then | |
| 304 config = defaultBarConfig[config] | |
| 299 if not config then | 305 if not config then |
| 300 error(("ReAction:CreateBar() - unknown bar type '%s'"):format(bartype)) | 306 error(("ReAction:CreateBar() - unknown bar type '%s'"):format(tostring(select(1,...)))) |
| 301 end | 307 end |
| 302 config = DeepCopy(config) | 308 config = DeepCopy(config) |
| 303 config.btnRows = select(2,...) or config.btnRows or 1 | 309 config.btnRows = select(1,...) or config.btnRows or 1 |
| 304 config.btnColumns = select(3,...) or config.btnColumns or 12 | 310 config.btnColumns = select(2,...) or config.btnColumns or 12 |
| 305 config.btnWidth = select(4,...) or config.btnWidth or 36 | 311 config.btnWidth = select(3,...) or config.btnWidth or 36 |
| 306 config.btnHeight = select(4,...) or config.btnHeight or 36 | 312 config.btnHeight = select(3,...) or config.btnHeight or 36 |
| 307 config.spacing = select(5,...) or config.spacing or 3 | 313 config.spacing = select(4,...) or config.spacing or 3 |
| 308 config.width = config.width or config.btnColumns*(config.btnWidth + config.spacing) + 1 | 314 config.width = config.width or config.btnColumns*(config.btnWidth + config.spacing) + 1 |
| 309 config.height = config.height or config.btnRows*(config.btnHeight + config.spacing) + 1 | 315 config.height = config.height or config.btnRows*(config.btnHeight + config.spacing) + 1 |
| 310 config.anchor = config.anchor or "UIParent" | 316 config.anchor = config.anchor or "UIParent" |
| 311 config.point = config.point or "BOTTOM" | 317 config.point = config.point or "BOTTOM" |
| 312 config.relpoint = config.relpoint or "BOTTOM" | 318 config.relpoint = config.relpoint or "BOTTOM" |
| 313 config.y = config.y or 200 | 319 config.y = config.y or 200 |
| 314 config.x = config.x or 0 | 320 config.x = config.x or 0 |
| 315 end | 321 end |
| 316 local profile = self.db.profile | 322 config = config or profile.bars[name] or DeepCopy(profile.defaultBar) |
| 317 config = config or DeepCopy(profile.defaultBar) | 323 |
| 318 prefix = prefix or L["Bar "] | 324 profile.bars[name] = config |
| 319 if not name then | 325 local bar = self.Bar:New( name, config ) -- ReAction.Bar defined in Bar.lua |
| 320 i = 1 | |
| 321 repeat | |
| 322 name = prefix..i | |
| 323 i = i + 1 | |
| 324 until bars[name] == nil | |
| 325 end | |
| 326 profile.bars[name] = profile.bars[name] or config | |
| 327 local bar = self.Bar:New( name, profile.bars[name] ) -- ReAction.Bar defined in Bar.lua | |
| 328 bars[name] = bar | 326 bars[name] = bar |
| 329 callbacks:Fire("OnCreateBar", bar, name) | 327 callbacks:Fire("OnCreateBar", bar, name) |
| 330 if private.configMode then | 328 if private.configMode then |
| 331 bar:ShowControls(true) | 329 bar:ShowControls(true) |
| 332 end | 330 end |
