PageRenderTime 91ms CodeModel.GetById 14ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 60ms

/Tukui/modules/skins/options.lua

http://github.com/Asphyxia/Tukui
Lua | 354 lines | 304 code | 12 blank | 38 comment | 17 complexity | 33a7a5da5cc5e4fba20a29e1544aef3c MD5 | raw file
  1local T, C, L = unpack(select(2, ...))
  2
  3local function LoadSkin()
  4    local frames = {
  5			"VideoOptionsFrameCategoryFrame",
  6			"VideoOptionsFramePanelContainer",
  7			"InterfaceOptionsFrameCategories",
  8			"InterfaceOptionsFramePanelContainer",
  9			"InterfaceOptionsFrameAddOns",
 10			"AudioOptionsSoundPanelPlayback",
 11			"AudioOptionsSoundPanelVolume",
 12			"AudioOptionsSoundPanelHardware",
 13			"AudioOptionsVoicePanelTalking",
 14			"AudioOptionsVoicePanelBinding",
 15			"AudioOptionsVoicePanelListening",
 16			}
 17			for i = 1, getn(frames) do
 18				local SkinFrames = _G[frames[i]]
 19				if SkinFrames then
 20					SkinFrames:StripTextures()
 21					SkinFrames:CreateBackdrop("Transparent")
 22					if SkinFrames ~= _G["VideoOptionsFramePanelContainer"] and SkinFrames ~= _G["InterfaceOptionsFramePanelContainer"] then
 23						SkinFrames.backdrop:Point("TOPLEFT",-1,0)
 24						SkinFrames.backdrop:Point("BOTTOMRIGHT",0,1)
 25					else
 26						SkinFrames.backdrop:Point("TOPLEFT", 0, 0)
 27						SkinFrames.backdrop:Point("BOTTOMRIGHT", 0, 0)
 28					end
 29				end
 30			end
 31
 32			local interfacetab = {
 33			"InterfaceOptionsFrameTab1",
 34			"InterfaceOptionsFrameTab2",
 35			}
 36			for i = 1, getn(interfacetab) do
 37				local itab = _G[interfacetab[i]]
 38				if itab then
 39					itab:StripTextures()
 40					T.SkinTab(itab)
 41				end
 42			end
 43			InterfaceOptionsFrameTab1:ClearAllPoints()
 44			InterfaceOptionsFrameTab1:SetPoint("BOTTOMLEFT",InterfaceOptionsFrameCategories,"TOPLEFT",-11,-2)
 45
 46			VideoOptionsFrameDefaults:ClearAllPoints()
 47			InterfaceOptionsFrameDefaults:ClearAllPoints()
 48			InterfaceOptionsFrameCancel:ClearAllPoints()
 49			VideoOptionsFrameDefaults:SetPoint("TOPLEFT",VideoOptionsFrameCategoryFrame,"BOTTOMLEFT",-1,-5)
 50			InterfaceOptionsFrameDefaults:SetPoint("TOPLEFT",InterfaceOptionsFrameCategories,"BOTTOMLEFT",-1,-5)
 51			InterfaceOptionsFrameCancel:SetPoint("TOPRIGHT",InterfaceOptionsFramePanelContainer,"BOTTOMRIGHT",0,-6)
 52			
 53			local interfacecheckbox = {
 54			-- Controls
 55			"ControlsPanelStickyTargeting",
 56			"ControlsPanelAutoDismount",
 57			"ControlsPanelAutoClearAFK",
 58			"ControlsPanelBlockTrades",
 59			"ControlsPanelBlockGuildInvites",
 60			"ControlsPanelLootAtMouse",
 61			"ControlsPanelAutoLootCorpse",
 62			-- Combat
 63			"CombatPanelAttackOnAssist",
 64			"CombatPanelStopAutoAttack",
 65			"CombatPanelNameplateClassColors",
 66			"CombatPanelTargetOfTarget",
 67			"CombatPanelShowSpellAlerts",
 68			"CombatPanelReducedLagTolerance",
 69			"CombatPanelActionButtonUseKeyDown",
 70			"CombatPanelEnemyCastBarsOnPortrait",
 71			"CombatPanelEnemyCastBarsOnNameplates",
 72			-- Display
 73			"DisplayPanelShowCloak",
 74			"DisplayPanelShowHelm",
 75			"DisplayPanelShowAggroPercentage",
 76			"DisplayPanelPlayAggroSounds",
 77			"DisplayPanelDetailedLootInfo",
 78			"DisplayPanelShowSpellPointsAvg",
 79			"DisplayPanelemphasizeMySpellEffects",
 80			"DisplayPanelShowFreeBagSpace",
 81			"DisplayPanelColorblindMode", -- Delete when 4.2 is out
 82			"DisplayPanelCinematicSubtitles",
 83			"DisplayPanelRotateMinimap",
 84			"DisplayPanelScreenEdgeFlash",
 85			--Objectives
 86			"ObjectivesPanelAutoQuestTracking",
 87			"ObjectivesPanelAutoQuestProgress",
 88			"ObjectivesPanelMapQuestDifficulty",
 89			"ObjectivesPanelAdvancedWorldMap",
 90			"ObjectivesPanelWatchFrameWidth",
 91			-- Social
 92			"SocialPanelProfanityFilter",
 93			"SocialPanelSpamFilter",
 94			"SocialPanelChatBubbles",
 95			"SocialPanelPartyChat",
 96			"SocialPanelChatHoverDelay",
 97			"SocialPanelGuildMemberAlert",
 98			"SocialPanelChatMouseScroll",
 99			-- Action bars
100			"ActionBarsPanelLockActionBars",
101			"ActionBarsPanelSecureAbilityToggle",
102			-- Names
103			"NamesPanelMyName",
104			"NamesPanelFriendlyPlayerNames",
105			"NamesPanelFriendlyPets",
106			"NamesPanelFriendlyGuardians",
107			"NamesPanelFriendlyTotems",
108			"NamesPanelUnitNameplatesFriends",
109			"NamesPanelUnitNameplatesFriendlyGuardians",
110			"NamesPanelUnitNameplatesFriendlyPets",
111			"NamesPanelUnitNameplatesFriendlyTotems",
112			"NamesPanelGuilds",
113			"NamesPanelGuildTitles",
114			"NamesPanelTitles",
115			"NamesPanelNonCombatCreature",
116			"NamesPanelEnemyPlayerNames",
117			"NamesPanelEnemyPets",
118			"NamesPanelEnemyGuardians",
119			"NamesPanelEnemyTotems",
120			"NamesPanelUnitNameplatesEnemyPets",
121			"NamesPanelUnitNameplatesEnemies",
122			"NamesPanelUnitNameplatesEnemyGuardians",
123			"NamesPanelUnitNameplatesEnemyTotems",
124			-- Combat Text
125			"CombatTextPanelTargetDamage",
126			"CombatTextPanelPeriodicDamage",
127			"CombatTextPanelPetDamage",
128			"CombatTextPanelHealing",
129			"CombatTextPanelTargetEffects",
130			"CombatTextPanelOtherTargetEffects",
131			"CombatTextPanelEnableFCT",
132			"CombatTextPanelDodgeParryMiss",
133			"CombatTextPanelDamageReduction",
134			"CombatTextPanelRepChanges",
135			"CombatTextPanelReactiveAbilities",
136			"CombatTextPanelFriendlyHealerNames",
137			"CombatTextPanelCombatState",
138			"CombatTextPanelComboPoints",
139			"CombatTextPanelLowManaHealth",
140			"CombatTextPanelEnergyGains",
141			"CombatTextPanelPeriodicEnergyGains",
142			"CombatTextPanelHonorGains",
143			"CombatTextPanelAuras",
144			"CombatTextPanelAutoSelfCast",
145			-- Buffs & Debuffs
146			"BuffsPanelBuffDurations",
147			"BuffsPanelDispellableDebuffs",
148			"BuffsPanelCastableBuffs",
149			"BuffsPanelShowCastableDebuffs",
150			-- Camera
151			"CameraPanelFollowTerrain",
152			"CameraPanelHeadBob",
153			"CameraPanelWaterCollision",
154			"CameraPanelSmartPivot",
155			-- Mouse
156			"MousePanelInvertMouse",
157			"MousePanelClickToMove",
158			"MousePanelWoWMouse",
159			-- Help
160			"HelpPanelShowTutorials",
161			"HelpPanelLoadingScreenTips",
162			"HelpPanelEnhancedTooltips",
163			"HelpPanelBeginnerTooltips",
164			"HelpPanelShowLuaErrors",
165			"HelpPanelColorblindMode",
166			"HelpPanelMovePad",
167			"BattlenetPanelOnlineFriends",
168			"BattlenetPanelOfflineFriends",
169			"BattlenetPanelOnlineFriendsBroadcasts",
170			"BattlenetPanelOnlineFriendsFriendRequests",
171			"BattlenetPanelOnlineFriendsConversations",
172			"BattlenetPanelOnlineFriendsShowToastWindow",
173			}
174			for i = 1, getn(interfacecheckbox) do
175				local icheckbox = _G["InterfaceOptions"..interfacecheckbox[i]]
176				if icheckbox then
177					T.SkinCheckBox(icheckbox)
178				end
179			end
180			
181			local interfacedropdown ={
182			-- Controls
183			"ControlsPanelAutoLootKeyDropDown",
184			-- Combat
185			"CombatPanelTOTDropDown",
186			"CombatPanelFocusCastKeyDropDown",
187			"CombatPanelSelfCastKeyDropDown",
188			-- Display
189			"DisplayPanelAggroWarningDisplay",
190			"DisplayPanelWorldPVPObjectiveDisplay",
191			-- Social
192			"SocialPanelChatStyle",
193			"SocialPanelWhisperMode",
194			"SocialPanelTimestamps",
195			"SocialPanelBnWhisperMode",
196			-- Action bars
197			"ActionBarsPanelPickupActionKeyDropDown",
198			-- Names
199			"NamesPanelNPCNamesDropDown",
200			"NamesPanelUnitNameplatesMotionDropDown",
201			-- Combat Text
202			"CombatTextPanelFCTDropDown",
203			-- Camera
204			"CameraPanelStyleDropDown",
205			-- Mouse
206			"MousePanelClickMoveStyleDropDown",
207			"LanguagesPanelLocaleDropDown",
208			}
209			for i = 1, getn(interfacedropdown) do
210				local idropdown = _G["InterfaceOptions"..interfacedropdown[i]]
211				if idropdown then
212					T.SkinDropDownBox(idropdown)
213					DropDownList1:SetTemplate("Transparent")
214				end
215			end
216			T.SkinButton(InterfaceOptionsHelpPanelResetTutorials)
217			
218			local optioncheckbox = {
219			-- Advanced
220			"Advanced_MaxFPSCheckBox",
221			"Advanced_MaxFPSBKCheckBox",
222			-- Audio
223			"AudioOptionsSoundPanelEnableSound",
224			"AudioOptionsSoundPanelSoundEffects",
225			"AudioOptionsSoundPanelErrorSpeech",
226			"AudioOptionsSoundPanelEmoteSounds",
227			"AudioOptionsSoundPanelPetSounds",
228			"AudioOptionsSoundPanelMusic",
229			"AudioOptionsSoundPanelLoopMusic",
230			"AudioOptionsSoundPanelAmbientSounds",
231			"AudioOptionsSoundPanelSoundInBG",
232			"AudioOptionsSoundPanelReverb",
233			"AudioOptionsSoundPanelHRTF",
234			"AudioOptionsSoundPanelEnableDSPs",
235			"AudioOptionsSoundPanelUseHardware",
236			"AudioOptionsVoicePanelEnableVoice",
237			"AudioOptionsVoicePanelEnableMicrophone",
238			"AudioOptionsVoicePanelPushToTalkSound",
239			-- Network
240			"NetworkOptionsPanelOptimizeSpeed",
241			"NetworkOptionsPanelUseIPv6",
242			}
243			for i = 1, getn(optioncheckbox) do
244				local ocheckbox = _G[optioncheckbox[i]]
245				if ocheckbox then
246					T.SkinCheckBox(ocheckbox)
247				end
248			end
249
250			local optiondropdown = {
251			-- Graphics
252			"Graphics_DisplayModeDropDown",
253			"Graphics_ResolutionDropDown",
254			"Graphics_RefreshDropDown",
255			"Graphics_PrimaryMonitorDropDown",
256			"Graphics_MultiSampleDropDown",
257			"Graphics_VerticalSyncDropDown",
258			"Graphics_TextureResolutionDropDown",
259			"Graphics_FilteringDropDown",
260			"Graphics_ProjectedTexturesDropDown",
261			"Graphics_ViewDistanceDropDown",
262			"Graphics_EnvironmentalDetailDropDown",
263			"Graphics_GroundClutterDropDown",
264			"Graphics_ShadowsDropDown",
265			"Graphics_LiquidDetailDropDown",
266			"Graphics_SunshaftsDropDown",
267			"Graphics_ParticleDensityDropDown",
268			-- Advanced
269			"Advanced_BufferingDropDown",
270			"Advanced_LagDropDown",
271			"Advanced_HardwareCursorDropDown",
272			"Advanced_GraphicsAPIDropDown",
273			-- Audio
274			"AudioOptionsSoundPanelHardwareDropDown",
275			"AudioOptionsSoundPanelSoundChannelsDropDown",
276			"AudioOptionsVoicePanelInputDeviceDropDown",
277			"AudioOptionsVoicePanelChatModeDropDown",
278			"AudioOptionsVoicePanelOutputDeviceDropDown",
279			}
280			for i = 1, getn(optiondropdown) do
281				local odropdown = _G[optiondropdown[i]]
282				if odropdown then
283					T.SkinDropDownBox(odropdown,165)
284					DropDownList1:SetTemplate("Transparent")
285				end
286			end
287	local buttons = {
288	    "RecordLoopbackSoundButton",
289	    "PlayLoopbackSoundButton",
290	    "AudioOptionsVoicePanelChatMode1KeyBindingButton",
291	}
292
293	for _, button in pairs(buttons) do
294		T.SkinButton(_G[button])
295	end	
296		
297	AudioOptionsVoicePanelChatMode1KeyBindingButton:ClearAllPoints()
298	AudioOptionsVoicePanelChatMode1KeyBindingButton:Point("CENTER", AudioOptionsVoicePanelBinding, "CENTER", 0, -10)
299	
300	local slides = {
301	-------- >> Interface
302	-- Combat
303	"InterfaceOptionsCombatPanelSpellAlertOpacitySlider",
304	"InterfaceOptionsCombatPanelMaxSpellStartRecoveryOffset",
305	-- Battle.net
306	"InterfaceOptionsBattlenetPanelToastDurationSlider",
307	-- Camera
308	"InterfaceOptionsCameraPanelMaxDistanceSlider",
309	"InterfaceOptionsCameraPanelFollowSpeedSlider",
310	-- Mouse
311	"InterfaceOptionsMousePanelMouseSensitivitySlider",
312	"InterfaceOptionsMousePanelMouseLookSpeedSlider",
313	--------- >> Options
314	-- Advanced
315	"Advanced_MaxFPSSlider",
316	"Advanced_MaxFPSBKSlider",
317	-- Audio
318	"AudioOptionsSoundPanelSoundQuality",
319	"AudioOptionsSoundPanelMasterVolume",
320	"AudioOptionsSoundPanelSoundVolume",
321	"AudioOptionsSoundPanelMusicVolume",
322	"AudioOptionsSoundPanelAmbienceVolume",
323	-- Voice
324	"AudioOptionsVoicePanelMicrophoneVolume",
325	"AudioOptionsVoicePanelSpeakerVolume",
326	"AudioOptionsVoicePanelSoundFade",
327	"AudioOptionsVoicePanelMusicFade",
328	"AudioOptionsVoicePanelAmbienceFade",
329    }
330	
331	for i = 1, getn(slides) do
332	    if _G[slides[i]] then
333		    if _G[slides[i]] ~= AudioOptionsSoundPanelSoundVolume then
334			    T.SkinSlideBar(_G[slides[i]],8,true)
335		    else
336			    T.SkinSlideBar(_G[slides[i]],8)
337		    end
338	    end
339    end
340	-- Graphics_Quality is not like the other sliders
341	Graphics_Quality:SetScript("OnUpdate", function(self)
342	    T.SkinSlideBar(Graphics_Quality,11)
343    end)
344	Graphics_RightQuality:SetAlpha(0) -- Graphics Quality Slide background =O
345	-- Graphics_Quality Values
346	Graphics_QualityLow2:Point("BOTTOM",0,-20)
347	Graphics_QualityFair:Point("BOTTOM",0,-20)
348	Graphics_RightQualityLabel:Point("TOP",0,16)
349	Graphics_QualityMed:Point("BOTTOM",0,-20)
350	Graphics_QualityHigh2:Point("BOTTOM",0,-20)
351	Graphics_QualityUltra:Point("BOTTOM",0,-20)
352end
353
354tinsert(T.SkinFuncs["Tukui"], LoadSkin)