comparison Bar.lua @ 286:77609bfa804e stable

Merge 1.1 beta 8 to stable
author Flick
date Sat, 11 Jun 2011 10:57:00 -0700
parents f2ed8a8e2320
children d931fa418e17
comparison
equal deleted inserted replaced
272:71d1a5e47e72 286:77609bfa804e
1 local addonName, addonTable = ... 1 local _, ns = ...
2 local ReAction = addonTable.ReAction 2 local ReAction = ns.ReAction
3 local L = ReAction.L 3 local L = ReAction.L
4 local LKB = ReAction.LKB 4 local LKB = ReAction.LKB
5 local _G = _G 5 local _G = _G
6 local CreateFrame = CreateFrame 6 local CreateFrame = CreateFrame
7 local floor = math.floor 7 local floor = math.floor
8 local fmod = math.fmod 8 local fmod = math.fmod
9 local format = string.format 9 local format = string.format
10 local tfetch = addonTable.tfetch 10 local tfetch = ns.tfetch
11 local tbuild = addonTable.tbuild 11 local tbuild = ns.tbuild
12 local fieldsort = addonTable.fieldsort 12 local fieldsort = ns.fieldsort
13 13
14 local LSG = LibStub("ReAction-LibShowActionGrid-1.0") 14 local LSG = LibStub("ReAction-LibShowActionGrid-1.0")
15 15
16 ---- Secure snippets ---- 16 ---- Secure snippets ----
17 local _reaction_init = 17 local _reaction_init =
349 349
350 function Bar:SetButtonSize(w,h) 350 function Bar:SetButtonSize(w,h)
351 if w > 0 and h > 0 then 351 if w > 0 and h > 0 then
352 self.config.btnWidth = w 352 self.config.btnWidth = w
353 self.config.btnHeight = h 353 self.config.btnHeight = h
354 for _, b in pairs(self.buttons) do
355 b:Refresh()
356 end
354 end 357 end
355 end 358 end
356 359
357 function Bar:GetNumButtons() 360 function Bar:GetNumButtons()
358 local r,c = self:GetButtonGrid() 361 local r,c = self:GetButtonGrid()
366 local s = cfg.spacing or 4 369 local s = cfg.spacing or 4
367 return r,c,s 370 return r,c,s
368 end 371 end
369 372
370 function Bar:SetButtonGrid(r,c,s) 373 function Bar:SetButtonGrid(r,c,s)
374 local cfg = self.config
375 r = r or cfg.btnRows
376 c = c or cfg.btnColumns
377 s = s or cfg.spacing
371 if r > 0 and c > 0 and s > 0 then 378 if r > 0 and c > 0 and s > 0 then
372 local cfg = self.config
373 cfg.btnRows = r 379 cfg.btnRows = r
374 cfg.btnColumns = c 380 cfg.btnColumns = c
375 cfg.spacing = s 381 cfg.spacing = s
376 end 382 end
377 self.buttonClass:SetupBar(self) 383 self.buttonClass:SetupBar(self)
401 self:ShowControls(mode) 407 self:ShowControls(mode)
402 for idx, b in self:IterateButtons() do 408 for idx, b in self:IterateButtons() do
403 b:ShowGridTemp(mode) 409 b:ShowGridTemp(mode)
404 b:UpdateActionIDLabel(mode) 410 b:UpdateActionIDLabel(mode)
405 end 411 end
412 self.buttonClass:SetupBar(self) -- force a full refresh
406 end 413 end
407 414
408 function Bar:SetKeybindMode(mode) 415 function Bar:SetKeybindMode(mode)
409 self:SetSecureData("showAll",mode) 416 self:SetSecureData("showAll",mode)
410 for idx, b in self:IterateButtons() do 417 for idx, b in self:IterateButtons() do
665 if unit then 672 if unit then
666 f:SetAttribute("unit",unit) 673 f:SetAttribute("unit",unit)
667 end 674 end
668 if enable then 675 if enable then
669 if not self.unitwatch then 676 if not self.unitwatch then
670 RegisterUnitWatch(self:GetFrame(),true) 677 RegisterUnitWatch(f,true)
671 end 678 end
672 elseif self.unitwatch then 679 elseif self.unitwatch then
673 UnregisterUnitWatch(self:GetFrame()) 680 UnregisterUnitWatch(f)
674 end 681 end
675 self.unitwatch = enable 682 self.unitwatch = enable
676 self:RefreshSecureState() 683 self:RefreshSecureState()
677 end 684 end
678 685