PageRenderTime 57ms CodeModel.GetById 38ms app.highlight 15ms RepoModel.GetById 1ms app.codeStats 0ms

/Tukui/modules/skins/chat.lua

http://github.com/Asphyxia/Tukui
Lua | 244 lines | 210 code | 23 blank | 11 comment | 23 complexity | 9ee31fde964b26aff4243e3044ce9125 MD5 | raw file
  1local T, C, L = unpack(select(2, ...))
  2
  3local function LoadSkin()
  4	local frames = {
  5		"ChatConfigFrame",
  6		"ChatConfigCategoryFrame",
  7		"ChatConfigBackgroundFrame",
  8		"ChatConfigChatSettingsClassColorLegend",
  9		"ChatConfigChannelSettingsClassColorLegend",
 10		"ChatConfigCombatSettingsFilters",
 11		"ChatConfigCombatSettingsFiltersScrollFrame",
 12		"CombatConfigColorsHighlighting",
 13		"CombatConfigColorsColorizeUnitName",
 14		"CombatConfigColorsColorizeSpellNames",
 15		"CombatConfigColorsColorizeDamageNumber",
 16		"CombatConfigColorsColorizeDamageSchool",
 17		"CombatConfigColorsColorizeEntireLine",
 18		"ChatConfigChatSettingsLeft",
 19		"ChatConfigOtherSettingsCombat",
 20		"ChatConfigOtherSettingsPVP",
 21		"ChatConfigOtherSettingsSystem",
 22		"ChatConfigOtherSettingsCreature",
 23		"ChatConfigChannelSettingsLeft",
 24		"CombatConfigMessageSourcesDoneBy",
 25		"CombatConfigMessageSourcesDoneTo",
 26		"CombatConfigColorsUnitColors",
 27	}
 28	
 29	for i = 1, getn(frames) do
 30		local SkinFrames = _G[frames[i]]
 31		SkinFrames:StripTextures()
 32		SkinFrames:SetTemplate("Transparent")
 33	end
 34	
 35	local otherframe = {
 36		"CombatConfigColorsColorizeSpellNames",
 37		"CombatConfigColorsColorizeDamageNumber",
 38		"CombatConfigColorsColorizeDamageSchool",
 39		"CombatConfigColorsColorizeEntireLine",
 40	}
 41	
 42	for i = 1, getn(otherframe) do
 43		local SkinFrames = _G[otherframe[i]]
 44		SkinFrames:ClearAllPoints()
 45		if SkinFrames == CombatConfigColorsColorizeSpellNames then
 46			SkinFrames:Point("TOP",CombatConfigColorsColorizeUnitName,"BOTTOM",0,-2)
 47		else
 48			SkinFrames:Point("TOP",_G[otherframe[i-1]],"BOTTOM",0,-2)
 49		end
 50	end
 51	
 52	ChatConfigChannelSettingsLeft:RegisterEvent("PLAYER_ENTERING_WORLD")
 53	ChatConfigChannelSettingsLeft:SetScript("OnEvent", function(self, event)
 54		ChatConfigChannelSettingsLeft:UnregisterEvent("PLAYER_ENTERING_WORLD")
 55		for i = 1,#ChatConfigChannelSettingsLeft.checkBoxTable do
 56			_G["ChatConfigChannelSettingsLeftCheckBox"..i]:StripTextures()
 57			_G["ChatConfigChannelSettingsLeftCheckBox"..i]:CreateBackdrop()
 58			_G["ChatConfigChannelSettingsLeftCheckBox"..i].backdrop:Point("TOPLEFT",3,-1)
 59			_G["ChatConfigChannelSettingsLeftCheckBox"..i].backdrop:Point("BOTTOMRIGHT",-3,1)
 60			_G["ChatConfigChannelSettingsLeftCheckBox"..i]:SetHeight(ChatConfigOtherSettingsCombatCheckBox1:GetHeight())
 61			T.SkinCheckBox(_G["ChatConfigChannelSettingsLeftCheckBox"..i.."Check"])
 62			T.SkinCheckBox(_G["ChatConfigChannelSettingsLeftCheckBox"..i.."ColorClasses"])
 63			_G["ChatConfigChannelSettingsLeftCheckBox"..i.."ColorClasses"]:SetHeight(ChatConfigChatSettingsLeftCheckBox1Check:GetHeight())
 64		end
 65	end)
 66	
 67	--Makes the skin work, but only after /reload ui :o   (found in chatconfingframe.xml)
 68	CreateChatChannelList(self, GetChannelList())
 69	ChatConfig_CreateCheckboxes(ChatConfigChannelSettingsLeft, CHAT_CONFIG_CHANNEL_LIST, "ChatConfigCheckBoxWithSwatchAndClassColorTemplate", CHANNELS)
 70	ChatConfig_UpdateCheckboxes(ChatConfigChannelSettingsLeft)
 71	
 72	
 73	ChatConfigBackgroundFrame:SetScript("OnShow", function(self)
 74		-- >> Chat >> Chat Settings
 75		for i = 1,#CHAT_CONFIG_CHAT_LEFT do
 76			_G["ChatConfigChatSettingsLeftCheckBox"..i]:StripTextures()
 77			_G["ChatConfigChatSettingsLeftCheckBox"..i]:CreateBackdrop()
 78			_G["ChatConfigChatSettingsLeftCheckBox"..i].backdrop:Point("TOPLEFT",3,-1)
 79			_G["ChatConfigChatSettingsLeftCheckBox"..i].backdrop:Point("BOTTOMRIGHT",-3,1)
 80			_G["ChatConfigChatSettingsLeftCheckBox"..i]:SetHeight(ChatConfigOtherSettingsCombatCheckBox1:GetHeight())
 81			T.SkinCheckBox(_G["ChatConfigChatSettingsLeftCheckBox"..i.."Check"])
 82			T.SkinCheckBox(_G["ChatConfigChatSettingsLeftCheckBox"..i.."ColorClasses"])
 83			_G["ChatConfigChatSettingsLeftCheckBox"..i.."ColorClasses"]:SetHeight(ChatConfigChatSettingsLeftCheckBox1Check:GetHeight())
 84		end
 85	
 86		-- >> Other >> Combat
 87		for i = 1,#CHAT_CONFIG_OTHER_COMBAT do
 88			_G["ChatConfigOtherSettingsCombatCheckBox"..i]:StripTextures()
 89			_G["ChatConfigOtherSettingsCombatCheckBox"..i]:CreateBackdrop()
 90			_G["ChatConfigOtherSettingsCombatCheckBox"..i].backdrop:Point("TOPLEFT",3,-1)
 91			_G["ChatConfigOtherSettingsCombatCheckBox"..i].backdrop:Point("BOTTOMRIGHT",-3,1)
 92			T.SkinCheckBox(_G["ChatConfigOtherSettingsCombatCheckBox"..i.."Check"])
 93		end
 94			
 95		-- >> Other >> PvP
 96		for i = 1,#CHAT_CONFIG_OTHER_PVP do
 97			_G["ChatConfigOtherSettingsPVPCheckBox"..i]:StripTextures()
 98			_G["ChatConfigOtherSettingsPVPCheckBox"..i]:CreateBackdrop()
 99			_G["ChatConfigOtherSettingsPVPCheckBox"..i].backdrop:Point("TOPLEFT",3,-1)
100			_G["ChatConfigOtherSettingsPVPCheckBox"..i].backdrop:Point("BOTTOMRIGHT",-3,1)
101			T.SkinCheckBox(_G["ChatConfigOtherSettingsPVPCheckBox"..i.."Check"])
102		end
103	
104		-- >> Other >> System
105		for i = 1,#CHAT_CONFIG_OTHER_SYSTEM do
106			_G["ChatConfigOtherSettingsSystemCheckBox"..i]:StripTextures()
107			_G["ChatConfigOtherSettingsSystemCheckBox"..i]:CreateBackdrop()
108			_G["ChatConfigOtherSettingsSystemCheckBox"..i].backdrop:Point("TOPLEFT",3,-1)
109			_G["ChatConfigOtherSettingsSystemCheckBox"..i].backdrop:Point("BOTTOMRIGHT",-3,1)
110			T.SkinCheckBox(_G["ChatConfigOtherSettingsSystemCheckBox"..i.."Check"])
111		end
112	
113		-- >> Other >> Creatures
114		for i = 1,#CHAT_CONFIG_CHAT_CREATURE_LEFT do
115			_G["ChatConfigOtherSettingsCreatureCheckBox"..i]:StripTextures()
116			_G["ChatConfigOtherSettingsCreatureCheckBox"..i]:CreateBackdrop()
117			_G["ChatConfigOtherSettingsCreatureCheckBox"..i].backdrop:Point("TOPLEFT",3,-1)
118			_G["ChatConfigOtherSettingsCreatureCheckBox"..i].backdrop:Point("BOTTOMRIGHT",-3,1)
119			T.SkinCheckBox(_G["ChatConfigOtherSettingsCreatureCheckBox"..i.."Check"])
120		end
121	
122		-- >> Sources >> DoneBy
123		for i = 1,#COMBAT_CONFIG_MESSAGESOURCES_BY do
124			_G["CombatConfigMessageSourcesDoneByCheckBox"..i]:StripTextures()
125			_G["CombatConfigMessageSourcesDoneByCheckBox"..i]:CreateBackdrop()
126			_G["CombatConfigMessageSourcesDoneByCheckBox"..i].backdrop:Point("TOPLEFT",3,-1)
127			_G["CombatConfigMessageSourcesDoneByCheckBox"..i].backdrop:Point("BOTTOMRIGHT",-3,1)
128			T.SkinCheckBox(_G["CombatConfigMessageSourcesDoneByCheckBox"..i.."Check"])
129		end
130	
131		-- >> Sources >> DoneTo
132		for i = 1,#COMBAT_CONFIG_MESSAGESOURCES_TO do
133			_G["CombatConfigMessageSourcesDoneToCheckBox"..i]:StripTextures()
134			_G["CombatConfigMessageSourcesDoneToCheckBox"..i]:CreateBackdrop()
135			_G["CombatConfigMessageSourcesDoneToCheckBox"..i].backdrop:Point("TOPLEFT",3,-1)
136			_G["CombatConfigMessageSourcesDoneToCheckBox"..i].backdrop:Point("BOTTOMRIGHT",-3,1)
137			T.SkinCheckBox(_G["CombatConfigMessageSourcesDoneToCheckBox"..i.."Check"])
138		end
139	
140		-- >> Combat >> Colors >> Unit Colors
141		for i = 1,#COMBAT_CONFIG_UNIT_COLORS do
142			_G["CombatConfigColorsUnitColorsSwatch"..i]:StripTextures()
143			_G["CombatConfigColorsUnitColorsSwatch"..i]:CreateBackdrop()
144			_G["CombatConfigColorsUnitColorsSwatch"..i].backdrop:Point("TOPLEFT",3,-1)
145			_G["CombatConfigColorsUnitColorsSwatch"..i].backdrop:Point("BOTTOMRIGHT",-3,1)
146		end
147			
148		-- >> Combat >> Messages Types
149		for i=1,4 do
150			for j=1,4 do
151				if _G["CombatConfigMessageTypesLeftCheckBox"..i] and _G["CombatConfigMessageTypesLeftCheckBox"..i.."_"..j] then
152					T.SkinCheckBox(_G["CombatConfigMessageTypesLeftCheckBox"..i])
153					T.SkinCheckBox(_G["CombatConfigMessageTypesLeftCheckBox"..i.."_"..j])
154				end
155			end
156			for j=1,10 do
157				if _G["CombatConfigMessageTypesRightCheckBox"..i] and _G["CombatConfigMessageTypesRightCheckBox"..i.."_"..j] then
158					T.SkinCheckBox(_G["CombatConfigMessageTypesRightCheckBox"..i])
159					T.SkinCheckBox(_G["CombatConfigMessageTypesRightCheckBox"..i.."_"..j])
160				end
161			end
162			T.SkinCheckBox(_G["CombatConfigMessageTypesMiscCheckBox"..i])
163		end
164	end)
165			
166	-- >> Combat >> Tabs
167	for i = 1,#COMBAT_CONFIG_TABS do
168		local cctab = _G["CombatConfigTab"..i]
169		if cctab then
170			T.SkinTab(cctab)
171			cctab:SetHeight(cctab:GetHeight()-2)
172			cctab:SetWidth(math.ceil(cctab:GetWidth()+1.6))
173			_G["CombatConfigTab"..i.."Text"]:SetPoint("BOTTOM",0,10)
174		end
175	end
176	CombatConfigTab1:ClearAllPoints()
177	CombatConfigTab1:SetPoint("BOTTOMLEFT",ChatConfigBackgroundFrame,"TOPLEFT",6,-2)
178
179	local ccbuttons = {
180		"ChatConfigFrameOkayButton",
181		"ChatConfigFrameDefaultButton",
182		"CombatLogDefaultButton",
183		"ChatConfigCombatSettingsFiltersDeleteButton",
184		"ChatConfigCombatSettingsFiltersAddFilterButton",
185		"ChatConfigCombatSettingsFiltersCopyFilterButton",
186		"CombatConfigSettingsSaveButton",
187	}
188	for i = 1, getn(ccbuttons) do
189		local ccbtn = _G[ccbuttons[i]]
190		if ccbtn then
191			T.SkinButton(ccbtn)
192			ccbtn:ClearAllPoints()
193		end
194	end
195	ChatConfigFrameOkayButton:SetPoint("TOPRIGHT",ChatConfigBackgroundFrame,"BOTTOMRIGHT",-3,-5)
196	ChatConfigFrameDefaultButton:SetPoint("TOPLEFT",ChatConfigCategoryFrame,"BOTTOMLEFT",1,-5)
197	CombatLogDefaultButton:SetPoint("TOPLEFT",ChatConfigCategoryFrame,"BOTTOMLEFT",1,-5)
198	ChatConfigCombatSettingsFiltersDeleteButton:SetPoint("TOPRIGHT",ChatConfigCombatSettingsFilters,"BOTTOMRIGHT",-3,-1)
199	ChatConfigCombatSettingsFiltersCopyFilterButton:SetPoint("RIGHT",ChatConfigCombatSettingsFiltersDeleteButton,"LEFT",-2,0)
200	ChatConfigCombatSettingsFiltersAddFilterButton:SetPoint("RIGHT",ChatConfigCombatSettingsFiltersCopyFilterButton,"LEFT",-2,0)
201	
202	local cccheckbox = {
203		"CombatConfigColorsHighlightingLine",
204		"CombatConfigColorsHighlightingAbility",
205		"CombatConfigColorsHighlightingDamage",
206		"CombatConfigColorsHighlightingSchool",
207		"CombatConfigColorsColorizeUnitNameCheck",
208		"CombatConfigColorsColorizeSpellNamesCheck",
209		"CombatConfigColorsColorizeSpellNamesSchoolColoring",
210		"CombatConfigColorsColorizeDamageNumberCheck",
211		"CombatConfigColorsColorizeDamageNumberSchoolColoring",
212		"CombatConfigColorsColorizeDamageSchoolCheck",
213		"CombatConfigColorsColorizeEntireLineCheck",
214		"CombatConfigFormattingShowTimeStamp",
215		"CombatConfigFormattingShowBraces",
216		"CombatConfigFormattingUnitNames",
217		"CombatConfigFormattingSpellNames",
218		"CombatConfigFormattingItemNames",
219		"CombatConfigFormattingFullText",
220		"CombatConfigSettingsShowQuickButton",
221		"CombatConfigSettingsSolo",
222		"CombatConfigSettingsParty",
223		"CombatConfigSettingsRaid",
224	}
225	for i = 1, getn(cccheckbox) do
226	local ccbtn = _G[cccheckbox[i]]
227		T.SkinCheckBox(_G[cccheckbox[i]])
228	end
229	
230	T.SkinNextPrevButton(ChatConfigMoveFilterUpButton,true)
231	T.SkinNextPrevButton(ChatConfigMoveFilterDownButton,true)
232	ChatConfigMoveFilterUpButton:ClearAllPoints()
233	ChatConfigMoveFilterDownButton:ClearAllPoints()
234	ChatConfigMoveFilterUpButton:SetPoint("TOPLEFT",ChatConfigCombatSettingsFilters,"BOTTOMLEFT",3,0)
235	ChatConfigMoveFilterDownButton:SetPoint("LEFT",ChatConfigMoveFilterUpButton,24,0)
236	
237	T.SkinEditBox(CombatConfigSettingsNameEditBox)
238
239	ChatConfigFrame:Size(680,596)
240	ChatConfigFrameHeader:ClearAllPoints()
241	ChatConfigFrameHeader:SetPoint("TOP", ChatConfigFrame, 0, -5)
242end
243
244tinsert(T.SkinFuncs["Tukui"], LoadSkin)