PageRenderTime 64ms CodeModel.GetById 57ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/TelUI_AddonSkins/skins/Quartz.lua

http://github.com/Asphyxia/Tukui
Lua | 78 lines | 51 code | 9 blank | 18 comment | 4 complexity | 23b3cc20c6134987894e7736eee28b0a MD5 | raw file
 1local T, C, L = unpack(Tukui) -- Import: T - functions, constants, variables; C - config; L - locales
 2
 3--[[
 4    Quartz3 skin by Darth Android / Telroth-The Venture Co.
 5	
 6	Todo:
 7     + Remove useless options
 8    
 9	(C)2010 Darth Android / Telroth-The Venture Co.
10	File version v91.109
11]]
12
13if not Mod_AddonSkins or not IsAddOnLoaded("Quartz") then return end
14local Q3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3")
15if not Q3 then return end
16
17Mod_AddonSkins:RegisterSkin("Quartz",function(Skin, skin, Layout, layout, config)
18	-- Skin and Layout overrides
19	Skin.SkinQuartzBar = function(self, bar)
20		self:SkinFrame(bar)
21		-- Skin Icon
22		if not bar.IconBorder then
23			-- Can't skin a texture, so we create a frame for this
24			bar.IconBorder = CreateFrame("Frame",nil,bar)
25			self:SkinBackgroundFrame(bar.IconBorder)
26			bar.IconBorder:SetPoint("TOPLEFT",bar.Icon,"TOPLEFT",-config.borderWidth,config.borderWidth)
27			bar.IconBorder:SetPoint("BOTTOMRIGHT",bar.Icon,"BOTTOMRIGHT",config.borderWidth,-config.borderWidth)
28			bar.IconBorder:SetFrameStrata("LOW")
29		end
30		if bar.config.hideicon then
31			bar.IconBorder:Hide()
32		else
33			bar.IconBorder:Show()
34		end
35		-- Fonts
36		bar.Text:SetFont(C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
37		bar.TimeText:SetFont(C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
38		-- Bar Texture
39		bar.Bar:SetStatusBarTexture(C.media.normTex)
40	end
41	
42	Layout.PositionQuartzBar = dummy
43	
44	-- Hook Bar Template
45	local template = Q3.CastBarTemplate.template
46	
47	template.ApplySettings_ = template.ApplySettings
48	template.ApplySettings = function (self)
49		self:ApplySettings_()
50		self:SetWidth(self.config.w + config.borderWidth * 2)
51		self:SetHeight(self.config.h + config.borderWidth * 2)
52		
53		skin:SkinQuartzBar(self)
54		
55		self.Bar:SetFrameStrata("HIGH")
56		self:SetFrameStrata("HIGH")
57	end
58	
59	-- Hook spellcasts to reskin after the shield disrupts it.
60	template.UNIT_SPELLCAST_NOT_INTERRUPTIBLE_ = template.UNIT_SPELLCAST_NOT_INTERRUPTIBLE
61	template.UNIT_SPELLCAST_NOT_INTERRUPTIBLE = function(self, event, unit)
62		self:UNIT_SPELLCAST_NOT_INTERRUPTIBLE_(event, unit)
63		skin:SkinQuartzBar(self)
64	end
65	template.UNIT_SPELLCAST_START_ = template.UNIT_SPELLCAST_START
66	template.UNIT_SPELLCAST_START = function(self, event, unit)
67		self:UNIT_SPELLCAST_START_(event, unit)
68		skin:SkinQuartzBar(self)
69	end
70	-- Fix for uninterruptable channeled casts - Provided by Caulk on the TukUI forums.
71	template.UNIT_SPELLCAST_CHANNEL_START_ = template.UNIT_SPELLCAST_CHANNEL_START
72	template.UNIT_SPELLCAST_CHANNEL_START = function(self, event, unit)
73		self:UNIT_SPELLCAST_CHANNEL_START_(event, unit)
74		skin:SkinQuartzBar(self)
75	end
76	-- Force updates
77	Q3:ApplySettings()
78end)