PageRenderTime 194ms CodeModel.GetById 100ms app.highlight 11ms RepoModel.GetById 80ms app.codeStats 0ms

/Tukui/modules/skins/others.lua

http://github.com/Asphyxia/Tukui
Lua | 200 lines | 173 code | 17 blank | 10 comment | 19 complexity | 2dc0848f32366e269b07c9604b4a6364 MD5 | raw file
  1local T, C, L = unpack(select(2, ...))
  2
  3local function LoadSkin()
  4	-- Others Blizzard frame we want to reskin
  5	local skins = {
  6		"StaticPopup1",
  7		"StaticPopup2",
  8		"StaticPopup3",
  9		"StaticPopup4",
 10		"GameMenuFrame",
 11		"InterfaceOptionsFrame",
 12		"VideoOptionsFrame",
 13		"AudioOptionsFrame",
 14		"LFDDungeonReadyStatus",
 15		"BNToastFrame",
 16		"TicketStatusFrameButton",
 17		"LFDSearchStatus",
 18		"AutoCompleteBox",
 19		"ConsolidatedBuffsTooltip",
 20		"ReadyCheckFrame",
 21		"StackSplitFrame",
 22		"CharacterFrame",
 23	}
 24
 25	for i = 1, getn(skins) do
 26		_G[skins[i]]:SetTemplate("Transparent")
 27		if _G[skins[i]] ~= _G["AutoCompleteBox"] then -- frame to blacklist from create shadow function
 28			_G[skins[i]]:CreateShadow("Transparent")
 29		end
 30	end
 31
 32	-- Skin all DropDownList[i]
 33	local function SkinDropDownList(level, index)
 34		for i = 1, UIDROPDOWNMENU_MAXLEVELS do
 35			local menubackdrop = _G["DropDownList"..i.."MenuBackdrop"]
 36			local backdrop = _G["DropDownList"..i.."Backdrop"]
 37			if not backdrop.isSkinned then
 38				menubackdrop:SetTemplate("Transparent")
 39				backdrop:SetTemplate("Transparent")
 40				backdrop.isSkinned = true
 41			end
 42		end
 43	end
 44	hooksecurefunc("UIDropDownMenu_CreateFrames", SkinDropDownList)
 45
 46	local ChatMenus = {
 47		"ChatMenu",
 48		"EmoteMenu",
 49		"LanguageMenu",
 50		"VoiceMacroMenu",		
 51	}
 52	--
 53	for i = 1, getn(ChatMenus) do
 54		if _G[ChatMenus[i]] == _G["ChatMenu"] then
 55			_G[ChatMenus[i]]:HookScript("OnShow", function(self) self:SetTemplate("Transparent", true) self:SetBackdropColor(unpack(C["media"].backdropcolor)) self:ClearAllPoints() self:SetPoint("BOTTOMLEFT", ChatFrame1, "TOPLEFT", 0, T.Scale(30)) end)
 56		else
 57			_G[ChatMenus[i]]:HookScript("OnShow", function(self) self:SetTemplate("Transparent", true) self:SetBackdropColor(unpack(C["media"].backdropcolor)) end)
 58		end
 59	end
 60
 61	--LFD Role Picker frame
 62	LFDRoleCheckPopup:StripTextures()
 63	LFDRoleCheckPopup:SetTemplate("Transparent")
 64	T.SkinButton(LFDRoleCheckPopupAcceptButton)
 65	T.SkinButton(LFDRoleCheckPopupDeclineButton)
 66	T.SkinCheckBox(LFDRoleCheckPopupRoleButtonTank:GetChildren())
 67	T.SkinCheckBox(LFDRoleCheckPopupRoleButtonDPS:GetChildren())
 68	T.SkinCheckBox(LFDRoleCheckPopupRoleButtonHealer:GetChildren())
 69	LFDRoleCheckPopupRoleButtonTank:GetChildren():SetFrameLevel(LFDRoleCheckPopupRoleButtonTank:GetChildren():GetFrameLevel() + 1)
 70	LFDRoleCheckPopupRoleButtonDPS:GetChildren():SetFrameLevel(LFDRoleCheckPopupRoleButtonDPS:GetChildren():GetFrameLevel() + 1)
 71	LFDRoleCheckPopupRoleButtonHealer:GetChildren():SetFrameLevel(LFDRoleCheckPopupRoleButtonHealer:GetChildren():GetFrameLevel() + 1)
 72
 73	-- reskin popup buttons
 74	for i = 1, 4 do
 75		for j = 1, 3 do
 76			T.SkinButton(_G["StaticPopup"..i.."Button"..j])
 77			T.SkinEditBox(_G["StaticPopup"..i.."EditBox"])
 78			T.SkinEditBox(_G["StaticPopup"..i.."MoneyInputFrameGold"])
 79			T.SkinEditBox(_G["StaticPopup"..i.."MoneyInputFrameSilver"])
 80			T.SkinEditBox(_G["StaticPopup"..i.."MoneyInputFrameCopper"])
 81			_G["StaticPopup"..i.."EditBox"].backdrop:Point("TOPLEFT", -2, -4)
 82			_G["StaticPopup"..i.."EditBox"].backdrop:Point("BOTTOMRIGHT", 2, 4)
 83			_G["StaticPopup"..i.."ItemFrameNameFrame"]:Kill()
 84			_G["StaticPopup"..i.."ItemFrame"]:GetNormalTexture():Kill()
 85			_G["StaticPopup"..i.."ItemFrame"]:SetTemplate("Transparent")
 86			_G["StaticPopup"..i.."ItemFrame"]:StyleButton()
 87			_G["StaticPopup"..i.."ItemFrameIconTexture"]:SetTexCoord(.08, .92, .08, .92)
 88			_G["StaticPopup"..i.."ItemFrameIconTexture"]:ClearAllPoints()
 89			_G["StaticPopup"..i.."ItemFrameIconTexture"]:Point("TOPLEFT", 2, -2)
 90			_G["StaticPopup"..i.."ItemFrameIconTexture"]:Point("BOTTOMRIGHT", -2, 2)
 91		end
 92	end
 93
 94	-- reskin all esc/menu buttons
 95	local BlizzardMenuButtons = {
 96		"Options", 
 97		"SoundOptions", 
 98		"UIOptions", 
 99		"Keybindings", 
100		"Macros",
101		"Ratings",
102		"AddOns", 
103		"Logout", 
104		"Quit", 
105		"Continue", 
106		"MacOptions",
107		"Help"
108	}
109
110	for i = 1, getn(BlizzardMenuButtons) do
111		local ElvuiMenuButtons = _G["GameMenuButton"..BlizzardMenuButtons[i]]
112		if ElvuiMenuButtons then
113			T.SkinButton(ElvuiMenuButtons)
114		end
115	end
116
117	if IsAddOnLoaded("OptionHouse") then
118		T.SkinButton(GameMenuButtonOptionHouse)
119	end
120
121	-- hide header textures and move text/buttons.
122	local BlizzardHeader = {
123		"GameMenuFrame", 
124		"InterfaceOptionsFrame", 
125		"AudioOptionsFrame", 
126		"VideoOptionsFrame",
127	}
128
129	for i = 1, getn(BlizzardHeader) do
130		local title = _G[BlizzardHeader[i].."Header"]			
131		if title then
132			title:SetTexture("")
133			title:ClearAllPoints()
134			if title == _G["GameMenuFrameHeader"] then
135				title:SetPoint("TOP", GameMenuFrame, 0, 7)
136			else
137				title:SetPoint("TOP", BlizzardHeader[i], 0, 0)
138			end
139		end
140	end
141
142	-- here we reskin all "normal" buttons
143	local BlizzardButtons = {
144		"VideoOptionsFrameOkay", 
145		"VideoOptionsFrameCancel", 
146		"VideoOptionsFrameDefaults", 
147		"VideoOptionsFrameApply", 
148		"AudioOptionsFrameOkay", 
149		"AudioOptionsFrameCancel", 
150		"AudioOptionsFrameDefaults", 
151		"InterfaceOptionsFrameDefaults", 
152		"InterfaceOptionsFrameOkay", 
153		"InterfaceOptionsFrameCancel",
154		"ReadyCheckFrameYesButton",
155		"ReadyCheckFrameNoButton",
156		"StackSplitOkayButton",
157		"StackSplitCancelButton",
158		"RolePollPopupAcceptButton"
159	}
160
161	for i = 1, getn(BlizzardButtons) do
162		local ElvuiButtons = _G[BlizzardButtons[i]]
163		if ElvuiButtons then
164			T.SkinButton(ElvuiButtons)
165		end
166	end
167
168	-- if a button position is not really where we want, we move it here
169	_G["VideoOptionsFrameCancel"]:ClearAllPoints()
170	_G["VideoOptionsFrameCancel"]:SetPoint("RIGHT",_G["VideoOptionsFrameApply"],"LEFT",-4,0)		 
171	_G["VideoOptionsFrameOkay"]:ClearAllPoints()
172	_G["VideoOptionsFrameOkay"]:SetPoint("RIGHT",_G["VideoOptionsFrameCancel"],"LEFT",-4,0)	
173	_G["AudioOptionsFrameOkay"]:ClearAllPoints()
174	_G["AudioOptionsFrameOkay"]:SetPoint("RIGHT",_G["AudioOptionsFrameCancel"],"LEFT",-4,0)
175	_G["InterfaceOptionsFrameOkay"]:ClearAllPoints()
176	_G["InterfaceOptionsFrameOkay"]:SetPoint("RIGHT",_G["InterfaceOptionsFrameCancel"],"LEFT", -4,0)
177	_G["ReadyCheckFrameYesButton"]:SetParent(_G["ReadyCheckFrame"])
178	_G["ReadyCheckFrameNoButton"]:SetParent(_G["ReadyCheckFrame"])
179	_G["ReadyCheckFrameYesButton"]:ClearAllPoints()
180	_G["ReadyCheckFrameNoButton"]:ClearAllPoints()
181	_G["ReadyCheckFrameYesButton"]:SetPoint("RIGHT", _G["ReadyCheckFrame"], "CENTER", -2, -20)
182	_G["ReadyCheckFrameNoButton"]:SetPoint("LEFT", _G["ReadyCheckFrameYesButton"], "RIGHT", 3, 0)
183	_G["ReadyCheckFrameText"]:SetParent(_G["ReadyCheckFrame"])	
184	_G["ReadyCheckFrameText"]:ClearAllPoints()
185	_G["ReadyCheckFrameText"]:SetPoint("TOP", 0, -12)
186
187	-- others
188	_G["ReadyCheckListenerFrame"]:SetAlpha(0)
189	_G["ReadyCheckFrame"]:HookScript("OnShow", function(self) if UnitIsUnit("player", self.initiator) then self:Hide() end end) -- bug fix, don't show it if initiator
190	_G["StackSplitFrame"]:GetRegions():Hide()
191
192	RolePollPopup:SetTemplate("Transparent")
193	RolePollPopup:CreateShadow("Transparent")
194	LFDDungeonReadyDialog:SetTemplate("Transparent")
195	LFDDungeonReadyDialog:CreateShadow("Transparent")
196	T.SkinButton(LFDDungeonReadyDialogEnterDungeonButton)
197	T.SkinButton(LFDDungeonReadyDialogLeaveQueueButton)
198end
199
200tinsert(T.SkinFuncs["Tukui"], LoadSkin)