Mercurial > wow > reaction
comparison modules/Totem.lua @ 163:ab5c37989986
- totem bar now stores which page was selected across sessions
- totem bar shouldn't be messed up if resized around on non-shaman toons now
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Sat, 22 Aug 2009 00:12:44 +0000 |
| parents | fc08372f0c7a |
| children | 363dd8130205 |
comparison
equal
deleted
inserted
replaced
| 162:fc08372f0c7a | 163:ab5c37989986 |
|---|---|
| 81 profile.buttons[name] = {} | 81 profile.buttons[name] = {} |
| 82 end | 82 end |
| 83 local btnCfg = profile.buttons[name] | 83 local btnCfg = profile.buttons[name] |
| 84 | 84 |
| 85 local r, c = bar:GetButtonGrid() | 85 local r, c = bar:GetButtonGrid() |
| 86 local n = r*c | 86 local n = min(r*c,6) |
| 87 n = min(n,Button.SetupBarHeader(bar)) | 87 Button.SetupBarHeader(bar) |
| 88 for i = 1, n do | 88 for i = 1, n do |
| 89 if btnCfg[i] == nil then | 89 if btnCfg[i] == nil then |
| 90 btnCfg[i] = {} | 90 btnCfg[i] = {} |
| 91 end | 91 end |
| 92 if btns[i] == nil then | 92 if btns[i] == nil then |
| 93 local success, r = pcall(Button.New,Button,i,btnCfg,bar) | 93 local success, r = pcall(Button.New,Button,i,btnCfg,bar) |
| 94 if success and r then | 94 if success then |
| 95 btns[i] = r | 95 btns[i] = r |
| 96 bar:AddButton(i,r) | 96 if r then |
| 97 bar:AddButton(i,r) | |
| 98 end | |
| 97 else | 99 else |
| 98 geterrorhandler()(r) | 100 geterrorhandler()(r) |
| 99 n = i - 1 | 101 n = i - 1 |
| 100 bar:ClipNButtons(n) | 102 bar:ClipNButtons(n) |
| 101 break | 103 break |
| 102 end | 104 end |
| 103 end | 105 end |
| 104 btns[i]:Refresh() | 106 if btns[i] then |
| 107 btns[i]:Refresh() | |
| 108 end | |
| 105 end | 109 end |
| 106 for i = n+1, #btns do | 110 for i = n+1, #btns do |
| 107 if btns[i] then | 111 if btns[i] then |
| 108 bar:RemoveButton(btns[i]) | 112 bar:RemoveButton(btns[i]) |
| 109 btns[i] = btns[i]:Destroy() | 113 btns[i] = btns[i]:Destroy() |
