Mercurial > wow > reaction
comparison Buttons.lua @ 10:f3a7bfebc283
Version 0.33
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Tue, 20 Mar 2007 21:37:38 +0000 |
| parents | c05fd3e18b4f |
| children | 2735edcf9ab7 |
comparison
equal
deleted
inserted
replaced
| 9:650f75d08952 | 10:f3a7bfebc283 |
|---|---|
| 2 -- | 2 -- |
| 3 -- Defines button types for use with the ReAction AddOn | 3 -- Defines button types for use with the ReAction AddOn |
| 4 -- | 4 -- |
| 5 | 5 |
| 6 local AceOO = AceLibrary("AceOO-2.0") | 6 local AceOO = AceLibrary("AceOO-2.0") |
| 7 local ReBound = AceLibrary("ReBound-1.0") | |
| 7 | 8 |
| 8 local Action = AceOO.Class( | 9 local Action = AceOO.Class( |
| 9 ReAction, | 10 ReAction, |
| 10 ReAction.ActionType, | 11 ReAction.ActionType, |
| 11 ReAction.ActionDisplay, | 12 ReAction.ActionDisplay, |
| 18 ReAction.PetActionDisplay, | 19 ReAction.PetActionDisplay, |
| 19 ReAction.DefaultColorScheme | 20 ReAction.DefaultColorScheme |
| 20 ) | 21 ) |
| 21 | 22 |
| 22 | 23 |
| 23 ReAction:AddButtonType( "Action", Action, 120 ) | 24 ReAction:AddButtonType( "Action", Action, 120 ) |
| 24 ReAction:AddButtonType( "Pet Action", PetAction, 10 ) | 25 ReAction:AddButtonType( "Pet Action", PetAction, 10 ) |
| 25 | 26 |
| 26 | 27 |
| 27 | 28 |
| 28 ----------------------- | 29 ----------------------- |
| 32 type = "ReAction", | 33 type = "ReAction", |
| 33 subtype = "Action", | 34 subtype = "Action", |
| 34 ids = { }, | 35 ids = { }, |
| 35 selfcast = nil, | 36 selfcast = nil, |
| 36 keyBindLoc = "TOPRIGHT", | 37 keyBindLoc = "TOPRIGHT", |
| 38 keyBindRightLoc = "RIGHT", | |
| 37 stackCountLoc = "BOTTOMRIGHT", | 39 stackCountLoc = "BOTTOMRIGHT", |
| 38 showKeyBind = true, | 40 showKeyBind = true, |
| 41 showKeyBindRight = false, | |
| 39 showStackCount = true, | 42 showStackCount = true, |
| 40 showMacroText = true, | 43 showMacroText = true, |
| 41 showBorder = true, | 44 showBorder = true, |
| 42 keyBindColorCode = false, | 45 keyBindColorCode = false, |
| 43 hideCooldown = false, | 46 hideCooldown = false, |
| 121 for _, b in pairs(buttonListFunc()) do | 124 for _, b in pairs(buttonListFunc()) do |
| 122 b:UpdateSelfcast() | 125 b:UpdateSelfcast() |
| 123 end | 126 end |
| 124 end, | 127 end, |
| 125 validate = { "default", "none", "alt", "ctrl", "shift", "right-click" }, | 128 validate = { "default", "none", "alt", "ctrl", "shift", "right-click" }, |
| 129 order = 101 | |
| 126 }, | 130 }, |
| 127 | 131 |
| 128 opacity = { | 132 opacity = { |
| 129 type = "group", | 133 type = "group", |
| 130 name = "Opacity", | 134 name = "Opacity", |
| 204 set = function() config.hideEmptySlots = not config.hideEmptySlots ; refresh() end, | 208 set = function() config.hideEmptySlots = not config.hideEmptySlots ; refresh() end, |
| 205 order = 6, | 209 order = 6, |
| 206 }, | 210 }, |
| 207 | 211 |
| 208 }, | 212 }, |
| 213 order = 102, | |
| 214 }, | |
| 215 | |
| 216 displaysep = { | |
| 217 type = "header", | |
| 218 name = " ", | |
| 219 desc = " ", | |
| 220 order = 103, | |
| 221 }, | |
| 222 | |
| 223 showkeybind = { | |
| 224 type = "toggle", | |
| 225 name = "Show Hotkey", | |
| 226 desc = "Toggle show/hide hot key labels", | |
| 227 get = function() return config.showKeyBind end, | |
| 228 set = function() config.showKeyBind = not config.showKeyBind ; refresh() end, | |
| 229 order = 104, | |
| 209 }, | 230 }, |
| 210 | 231 |
| 211 keyloc = { | 232 keyloc = { |
| 212 type = "text", | 233 type = "text", |
| 213 name = "Hotkey Location", | 234 name = "Hotkey Location", |
| 214 desc = "Sets hotkey location", | 235 desc = "Sets hotkey location", |
| 215 get = function() return config.keyBindLoc end, | 236 get = function() return config.keyBindLoc end, |
| 216 set = function(loc) config.keyBindLoc = loc ; refresh() end, | 237 set = function(loc) config.keyBindLoc = loc ; refresh() end, |
| 238 hidden = function() return not config.showKeyBind end, | |
| 217 validate = labelPlacementOptions, | 239 validate = labelPlacementOptions, |
| 240 order = 105, | |
| 218 }, | 241 }, |
| 219 | 242 |
| 243 showKeyBindRight = { | |
| 244 type = "toggle", | |
| 245 name = "Show Right-click Hotkey", | |
| 246 desc = "Toggle show/hide right-click hot key labels", | |
| 247 get = function() return config.showKeyBindRight end, | |
| 248 set = function() config.showKeyBindRight = not config.showKeyBindRight ; refresh() end, | |
| 249 order = 106, | |
| 250 }, | |
| 251 | |
| 252 rightkeyloc = { | |
| 253 type = "text", | |
| 254 name = "Right-click Hotkey Location", | |
| 255 desc = "Sets right-click hotkey location", | |
| 256 get = function() return config.keyBindRightLoc end, | |
| 257 set = function(loc) config.keyBindRightLoc = loc ; refresh() end, | |
| 258 hidden = function() return not config.showKeyBindRight end, | |
| 259 validate = labelPlacementOptions, | |
| 260 order = 107, | |
| 261 }, | |
| 262 | |
| 263 colorhotkeys = { | |
| 264 type = "toggle", | |
| 265 name = "Colorize Hotkeys", | |
| 266 desc = "Toggles coloring hotkeys based on the modifier key. Out-of-range coloring is always enabled.", | |
| 267 get = function() return config.keyBindColorCode end, | |
| 268 set = function() config.keyBindColorCode = not config.keyBindColorCode ; refresh() end, | |
| 269 hidden = function() return not config.showKeyBind and not config.showKeyBindRight end, | |
| 270 order = 109, | |
| 271 }, | |
| 272 | |
| 273 showstackcount = { | |
| 274 type = "toggle", | |
| 275 name = "Show Stack Count", | |
| 276 desc = "Toggle show/hide stack count labels", | |
| 277 get = function() return config.showStackCount end, | |
| 278 set = function() config.showStackCount = not config.showStackCount ; refresh() end, | |
| 279 order = 110, | |
| 280 }, | |
| 281 | |
| 220 stackloc = { | 282 stackloc = { |
| 221 type = "text", | 283 type = "text", |
| 222 name = "Stack Count Location", | 284 name = "Stack Count Location", |
| 223 desc = "Sets stack count location", | 285 desc = "Sets stack count location", |
| 224 get = function() return config.stackCountLoc end, | 286 get = function() return config.stackCountLoc end, |
| 225 set = function(loc) config.stackCountLoc = loc ; refresh() end, | 287 set = function(loc) config.stackCountLoc = loc ; refresh() end, |
| 288 hidden = function() return not config.showStackCount end, | |
| 226 validate = labelPlacementOptions, | 289 validate = labelPlacementOptions, |
| 227 }, | 290 order = 111, |
| 228 | |
| 229 showkeybind = { | |
| 230 type = "toggle", | |
| 231 name = "Show Hotkey", | |
| 232 desc = "Toggle show/hide hot key labels", | |
| 233 get = function() return config.showKeyBind end, | |
| 234 set = function() config.showKeyBind = not config.showKeyBind ; refresh() end, | |
| 235 }, | |
| 236 | |
| 237 showstackcount = { | |
| 238 type = "toggle", | |
| 239 name = "Show Stack Count", | |
| 240 desc = "Toggle show/hide stack count labels", | |
| 241 get = function() return config.showStackCount end, | |
| 242 set = function() config.showStackCount = not config.showStackCount ; refresh() end, | |
| 243 }, | 291 }, |
| 244 | 292 |
| 245 showmacrotext = { | 293 showmacrotext = { |
| 246 type = "toggle", | 294 type = "toggle", |
| 247 name = "Show Macro Names", | 295 name = "Show Macro Names", |
| 248 desc = "Toggle show/hide macro name labels", | 296 desc = "Toggle show/hide macro name labels", |
| 249 get = function() return config.showMacroText end, | 297 get = function() return config.showMacroText end, |
| 250 set = function() config.showMacroText = not config.showMacroText ; refresh() end, | 298 set = function() config.showMacroText = not config.showMacroText ; refresh() end, |
| 299 order = 112, | |
| 251 }, | 300 }, |
| 252 | 301 |
| 253 hidecooldown = { | 302 hidecooldown = { |
| 254 type = "toggle", | 303 type = "toggle", |
| 255 name = "Hide Cooldowns", | 304 name = "Hide Cooldowns", |
| 256 desc = "Hides all cooldown displays on buttons. Toggling this on does not hide currently running cooldowns.", | 305 desc = "Hides all cooldown displays on buttons. Toggling this on does not hide currently running cooldowns.", |
| 257 get = function() return config.hideCooldown end, | 306 get = function() return config.hideCooldown end, |
| 258 set = function() config.hideCooldown = not config.hideCooldown ; refresh() end, | 307 set = function() config.hideCooldown = not config.hideCooldown ; refresh() end, |
| 308 order = 114, | |
| 259 }, | 309 }, |
| 260 | 310 |
| 261 hideglobalcooldown = { | 311 hideglobalcooldown = { |
| 262 type = "toggle", | 312 type = "toggle", |
| 263 name = "Hide Global Cooldown", | 313 name = "Hide Global Cooldown", |
| 264 desc = "Disables the global cooldown from being displayed on buttons.", | 314 desc = "Disables the global cooldown from being displayed on buttons.", |
| 265 get = function() return config.hideGlobalCooldown end, | 315 get = function() return config.hideGlobalCooldown end, |
| 266 set = function() config.hideGlobalCooldown = not config.hideGlobalCooldown ; refresh() end, | 316 set = function() config.hideGlobalCooldown = not config.hideGlobalCooldown ; refresh() end, |
| 267 }, | 317 hidden = function() return not config.hideCooldown end, |
| 268 | 318 order = 115, |
| 269 colorhotkeys = { | |
| 270 type = "toggle", | |
| 271 name = "Colorize Hotkeys", | |
| 272 desc = "Toggles coloring hotkeys based on the modifier key. Out-of-range coloring is always enabled.", | |
| 273 get = function() return config.keyBindColorCode end, | |
| 274 set = function() config.keyBindColorCode = not config.keyBindColorCode ; refresh() end, | |
| 275 }, | 319 }, |
| 276 | 320 |
| 277 --[[ | 321 --[[ |
| 278 hideborder = { | 322 hideborder = { |
| 279 type = "toggle", | 323 type = "toggle", |
| 353 function Action.prototype:init( id ) | 397 function Action.prototype:init( id ) |
| 354 Action.super.prototype.init(self) | 398 Action.super.prototype.init(self) |
| 355 | 399 |
| 356 self:SetupDisplay("ReActionButton"..id) | 400 self:SetupDisplay("ReActionButton"..id) |
| 357 self:SetupAction() | 401 self:SetupAction() |
| 358 | 402 ReBound:Register(self:GetActionFrame()) |
| 359 -- register button with ReBound for keybinding | |
| 360 if ReBound then | |
| 361 ReBound:AddKeybindTarget(self:GetActionFrame()) | |
| 362 end | |
| 363 end | 403 end |
| 364 | 404 |
| 365 function PetAction.prototype:init( id ) | 405 function PetAction.prototype:init( id ) |
| 366 Action.super.prototype.init(self) | 406 Action.super.prototype.init(self) |
| 367 | 407 |
| 368 self:SetupDisplay("ReActionPetButton"..id) | 408 self:SetupDisplay("ReActionPetButton"..id) |
| 369 self:SetupAction() | 409 self:SetupAction() |
| 370 | 410 ReBound:Register(self:GetActionFrame()) |
| 371 -- register button with ReBound for keybinding | 411 end |
| 372 if ReBound then | 412 |
| 373 ReBound:AddKeybindTarget(self:GetActionFrame()) | |
| 374 end | |
| 375 end | |
| 376 |
