PageRenderTime 381ms CodeModel.GetById 302ms app.highlight 56ms RepoModel.GetById 14ms app.codeStats 1ms

/Tukui/core/launch.lua

http://github.com/Asphyxia/Tukui
Lua | 646 lines | 526 code | 90 blank | 30 comment | 39 complexity | 11a72ff24161824f059c99e38aaf9612 MD5 | raw file
  1------------------------------------------------------------------------
  2-- Launch Tukui Script
  3------------------------------------------------------------------------
  4local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
  5
  6local function chatsetup()
  7	-- setting chat frames if using Tukui chats.
  8	FCF_ResetChatWindows()
  9		FCF_SetLocked(ChatFrame1, 1)
 10		FCF_DockFrame(ChatFrame2)
 11		FCF_SetLocked(ChatFrame2, 1)
 12		FCF_OpenNewWindow(L.chat_general)
 13		FCF_SetLocked(ChatFrame3, 1)
 14		FCF_DockFrame(ChatFrame3)
 15
 16		FCF_OpenNewWindow(LOOT)
 17		FCF_UnDockFrame(ChatFrame4)
 18		FCF_SetLocked(ChatFrame4, 1)
 19		ChatFrame4:Show()
 20
 21		for i = 1, NUM_CHAT_WINDOWS do
 22			local chat = _G[format("ChatFrame%s", i)]
 23			local id = chat:GetID()
 24			local _, fontSize = FCF_GetChatWindowInfo(id)
 25					
 26			-- set default tukui font size
 27			FCF_SetChatWindowFontSize(nil, chat, fontSize)
 28			
 29			if i == 1 then
 30				chat:ClearAllPoints()
 31				chat:Point("TOPLEFT", TukuiTabsLeftBackground, "BOTTOMLEFT", 0, -4)
 32				chat:Point("BOTTOMRIGHT", TukuiInfoLeft, "TOPRIGHT", 0, 4)
 33				FCF_SavePositionAndDimensions(chat)
 34			elseif i == 4 then
 35				if not chat.isDocked then
 36					chat:ClearAllPoints()
 37					chat:Point("TOPLEFT", TukuiTabsRightBackground, "BOTTOMLEFT", 0, -4)
 38					chat:Point("BOTTOMRIGHT", TukuiInfoRight, "TOPRIGHT", 0, 4)
 39					FCF_SavePositionAndDimensions(chat)
 40					
 41					if C["chat"].justifyRight == true then
 42						chat:SetJustifyH("RIGHT") 
 43					end
 44				end
 45			end
 46			chat:SetHeight(0)
 47			chat:SetWidth(0)
 48
 49			-- rename windows general and combat log
 50			if i == 1 then FCF_SetWindowName(chat, "G, S, W") end
 51			if i == 2 then FCF_SetWindowName(chat, "Log") end
 52		end
 53	
 54	ChatFrame_RemoveAllMessageGroups(ChatFrame1)
 55		ChatFrame_RemoveChannel(ChatFrame1, L.chat_trade) -- erf, it seem we need to localize this now
 56		ChatFrame_RemoveChannel(ChatFrame1, L.chat_general) -- erf, it seem we need to localize this now
 57		ChatFrame_RemoveChannel(ChatFrame1, L.chat_defense) -- erf, it seem we need to localize this now
 58		ChatFrame_RemoveChannel(ChatFrame1, L.chat_recrutment) -- erf, it seem we need to localize this now
 59		ChatFrame_RemoveChannel(ChatFrame1, L.chat_lfg) -- erf, it seem we need to localize this now
 60		ChatFrame_AddMessageGroup(ChatFrame1, "SAY")
 61		ChatFrame_AddMessageGroup(ChatFrame1, "EMOTE")
 62		ChatFrame_AddMessageGroup(ChatFrame1, "YELL")
 63		ChatFrame_AddMessageGroup(ChatFrame1, "GUILD")
 64		ChatFrame_AddMessageGroup(ChatFrame1, "OFFICER")
 65		ChatFrame_AddMessageGroup(ChatFrame1, "GUILD_ACHIEVEMENT")
 66		ChatFrame_AddMessageGroup(ChatFrame1, "WHISPER")
 67		ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_SAY")
 68		ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_EMOTE")
 69		ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_YELL")
 70		ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_WHISPER")
 71		ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_BOSS_EMOTE")
 72		ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_BOSS_WHISPER")
 73		ChatFrame_AddMessageGroup(ChatFrame1, "PARTY")
 74		ChatFrame_AddMessageGroup(ChatFrame1, "PARTY_LEADER")
 75		ChatFrame_AddMessageGroup(ChatFrame1, "RAID")
 76		ChatFrame_AddMessageGroup(ChatFrame1, "RAID_LEADER")
 77		ChatFrame_AddMessageGroup(ChatFrame1, "RAID_WARNING")
 78		ChatFrame_AddMessageGroup(ChatFrame1, "BATTLEGROUND")
 79		ChatFrame_AddMessageGroup(ChatFrame1, "BATTLEGROUND_LEADER")
 80		ChatFrame_AddMessageGroup(ChatFrame1, "BG_HORDE")
 81		ChatFrame_AddMessageGroup(ChatFrame1, "BG_ALLIANCE")
 82		ChatFrame_AddMessageGroup(ChatFrame1, "BG_NEUTRAL")
 83		ChatFrame_AddMessageGroup(ChatFrame1, "SYSTEM")
 84		ChatFrame_AddMessageGroup(ChatFrame1, "ERRORS")
 85		ChatFrame_AddMessageGroup(ChatFrame1, "AFK")
 86		ChatFrame_AddMessageGroup(ChatFrame1, "DND")
 87		ChatFrame_AddMessageGroup(ChatFrame1, "IGNORED")
 88		ChatFrame_AddMessageGroup(ChatFrame1, "ACHIEVEMENT")
 89		ChatFrame_AddMessageGroup(ChatFrame1, "BN_WHISPER")
 90		ChatFrame_AddMessageGroup(ChatFrame1, "BN_CONVERSATION")
 91					
 92		-- Setup the spam chat frame
 93		ChatFrame_RemoveAllMessageGroups(ChatFrame3)
 94		ChatFrame_AddChannel(ChatFrame3, L.chat_trade) -- erf, it seem we need to localize this now
 95		ChatFrame_AddChannel(ChatFrame3, L.chat_general) -- erf, it seem we need to localize this now
 96		ChatFrame_AddChannel(ChatFrame3, L.chat_defense) -- erf, it seem we need to localize this now
 97		ChatFrame_AddChannel(ChatFrame3, L.chat_recrutment) -- erf, it seem we need to localize this now
 98		ChatFrame_AddChannel(ChatFrame3, L.chat_lfg) -- erf, it seem we need to localize this now
 99				
100		-- Setup the right chat
101		ChatFrame_RemoveAllMessageGroups(ChatFrame4)
102		ChatFrame_AddMessageGroup(ChatFrame4, "COMBAT_XP_GAIN")
103		ChatFrame_AddMessageGroup(ChatFrame4, "COMBAT_HONOR_GAIN")
104		ChatFrame_AddMessageGroup(ChatFrame4, "COMBAT_FACTION_CHANGE")
105		ChatFrame_AddMessageGroup(ChatFrame4, "LOOT")
106		ChatFrame_AddMessageGroup(ChatFrame4, "MONEY")
107		ChatFrame_AddMessageGroup(ChatFrame4, "CURRENCY")
108		ChatFrame_AddMessageGroup(ChatFrame4, "COMBAT_GUILD_XP_GAIN")
109		ChatFrame_AddMessageGroup(ChatFrame4, "SKILL")
110				
111		-- enable classcolor automatically on login and on each character without doing /configure each time.
112		ToggleChatColorNamesByClassGroup(true, "SAY")
113		ToggleChatColorNamesByClassGroup(true, "EMOTE")
114		ToggleChatColorNamesByClassGroup(true, "YELL")
115		ToggleChatColorNamesByClassGroup(true, "GUILD")
116		ToggleChatColorNamesByClassGroup(true, "OFFICER")
117		ToggleChatColorNamesByClassGroup(true, "GUILD_ACHIEVEMENT")
118		ToggleChatColorNamesByClassGroup(true, "ACHIEVEMENT")
119		ToggleChatColorNamesByClassGroup(true, "WHISPER")
120		ToggleChatColorNamesByClassGroup(true, "PARTY")
121		ToggleChatColorNamesByClassGroup(true, "PARTY_LEADER")
122		ToggleChatColorNamesByClassGroup(true, "RAID")
123		ToggleChatColorNamesByClassGroup(true, "RAID_LEADER")
124		ToggleChatColorNamesByClassGroup(true, "RAID_WARNING")
125		ToggleChatColorNamesByClassGroup(true, "BATTLEGROUND")
126		ToggleChatColorNamesByClassGroup(true, "BATTLEGROUND_LEADER")	
127		ToggleChatColorNamesByClassGroup(true, "CHANNEL1")
128		ToggleChatColorNamesByClassGroup(true, "CHANNEL2")
129		ToggleChatColorNamesByClassGroup(true, "CHANNEL3")
130		ToggleChatColorNamesByClassGroup(true, "CHANNEL4")
131		ToggleChatColorNamesByClassGroup(true, "CHANNEL5")
132	end	
133	
134local function cvarsetup()
135	SetCVar("buffDurations", 1)
136	SetCVar("mapQuestDifficulty", 1)
137	SetCVar("scriptErrors", 1)
138	SetCVar("ShowClassColorInNameplate", 1)
139	SetCVar("screenshotQuality", 10)
140	SetCVar("chatMouseScroll", 1)
141	SetCVar("chatStyle", "im")
142	SetCVar("WholeChatWindowClickable", 0)
143	SetCVar("ConversationMode", "inline")
144	SetCVar("showTutorials", 0)
145	SetCVar("showNewbieTips", 0)
146	SetCVar("autoDismountFlying", 0)
147	SetCVar("autoQuestWatch", 1)
148	SetCVar("autoQuestProgress", 1)
149	SetCVar("UberTooltips", 1)
150	SetCVar("removeChatDelay", 1)
151	SetCVar("showVKeyCastbar", 1)
152	SetCVar("bloatthreat", 0)
153	SetCVar("bloattest", 0)
154	SetCVar("showArenaEnemyFrames", 0)
155end
156
157local function positionsetup()
158	-- reset saved variables on char
159	TukuiDataPerChar = {}
160	
161	-- reset movable stuff into original position
162	for i = 1, getn(T.MoverFrames) do
163		if T.MoverFrames[i] then T.MoverFrames[i]:SetUserPlaced(false) end
164	end
165end
166
167-- Version Frame
168local v = CreateFrame("Button", "TukuiVersionFrame", UIParent)
169v:SetSize(210, 34)
170v:SetPoint("CENTER", UIParent, "CENTER", 0, 188)
171v:SetTemplate("Transparent")
172v:CreateShadow("Default")
173v:FontString("Text", C.media.font, 12)
174v.Text:SetPoint("CENTER")
175v.Text:SetText("|cffFF6347AsphyxiaUI - version:|r 3.2  www.tukui.org")
176v:SetScript("OnClick", function()
177	v:Hide()
178end)
179v:Hide()
180
181--Help Frame
182local ahelp = CreateFrame("Button", "TukuiAsphyxiaHelpFrame", UIParent)
183ahelp:SetSize(550, 335)
184ahelp:SetPoint("CENTER")
185ahelp:SetTemplate("Transparent")
186ahelp:CreateShadow("Default")
187ahelp:FontString("Text", C.media.font, 13)
188ahelp.Text:SetPoint("CENTER")
189ahelp.Text:SetText(L.core_uihelp20..L.core_uihelp21..L.core_uihelp22..L.core_uihelp23..L.core_uihelp24..L.core_uihelp25..L.core_uihelp26..L.core_uihelp27..L.core_uihelp28..L.core_uihelp29..L.core_uihelp30)
190ahelp:SetScript("OnClick", function()
191	ahelp:Hide()
192end)
193ahelp:Hide()
194
195local f = CreateFrame("Frame", "AsphyxiaUIInstallFrame", UIParent)
196f:SetSize(400, 400)
197f:SetPoint("CENTER")
198f:SetTemplate("Transparent")
199f:CreateShadow("Default")
200f:Hide()
201
202local icon1 = CreateFrame("Frame", "AsphyxiaTest", f)
203icon1:CreatePanel(nil, 58, 58, "BOTTOMRIGHT", f, "TOPRIGHT", 0, 3)
204icon1:SetFrameStrata("HIGH")
205
206icon1.bg = icon1:CreateTexture(nil, "ARTWORK")
207icon1.bg:Point("TOPLEFT", 2, -2)
208icon1.bg:Point("BOTTOMRIGHT", -2, 2)
209icon1.bg:SetTexture([[Interface\AddOns\Tukui\medias\textures\asphyxia]])
210
211local icon2 = CreateFrame("Frame", "AsphyxiaTest", f)
212icon2:CreatePanel(nil, 58, 58, "BOTTOMLEFT", f, "TOPLEFT", 0, 3)
213icon2:SetFrameStrata("HIGH")
214
215icon2.bg = icon2:CreateTexture(nil, "ARTWORK")
216icon2.bg:Point("TOPLEFT", 2, -2)
217icon2.bg:Point("BOTTOMRIGHT", -2, 2)
218icon2.bg:SetTexture([[Interface\AddOns\Tukui\medias\textures\asphyxia]])
219
220local title = CreateFrame("Frame", "TukuiInstallTitle", f)
221title:CreatePanel(nil, f:GetWidth() - 122, 30, "BOTTOM", f, "TOP", 0, 3)
222title:SetFrameStrata("HIGH")
223
224local name = title:CreateFontString(nil, "OVERLAY")
225name:SetFont(C.media.font, 16)
226name:SetPoint("CENTER", title, 0, 0)
227name:SetText("|cff00AAFFAsphyxiaUI|r")
228
229local sb = CreateFrame("StatusBar", nil, f)
230sb:SetStatusBarTexture(C.media.normTex)
231sb:SetPoint("BOTTOM", f, "BOTTOM", 0, 60)
232sb:SetHeight(20)
233sb:SetWidth(f:GetWidth()-44)
234sb:SetFrameStrata("HIGH")
235sb:SetFrameLevel(6)
236sb:Hide()
237
238local sbd = CreateFrame("Frame", nil, sb)
239sbd:SetTemplate("Default")
240sbd:SetPoint("TOPLEFT", sb, -2, 2)
241sbd:SetPoint("BOTTOMRIGHT", sb, 2, -2)
242sbd:SetFrameStrata("HIGH")
243sbd:SetFrameLevel(5)
244
245local header = f:CreateFontString(nil, "OVERLAY")
246header:SetFont(C.media.font, 16, "THINOUTLINE")
247header:SetPoint("TOP", f, "TOP", 0, -20)
248
249local text1 = f:CreateFontString(nil, "OVERLAY")
250text1:SetJustifyH("LEFT")
251text1:SetFont(C.media.font, 12)
252text1:SetWidth(f:GetWidth()-40)
253text1:SetPoint("TOPLEFT", f, "TOPLEFT", 20, -60)
254
255local text2 = f:CreateFontString(nil, "OVERLAY")
256text2:SetJustifyH("LEFT")
257text2:SetFont(C.media.font, 12)
258text2:SetWidth(f:GetWidth()-40)
259text2:SetPoint("TOPLEFT", text1, "BOTTOMLEFT", 0, -20)
260
261local text3 = f:CreateFontString(nil, "OVERLAY")
262text3:SetJustifyH("LEFT")
263text3:SetFont(C.media.font, 12)
264text3:SetWidth(f:GetWidth()-40)
265text3:SetPoint("TOPLEFT", text2, "BOTTOMLEFT", 0, -20)
266
267local text4 = f:CreateFontString(nil, "OVERLAY")
268text4:SetJustifyH("LEFT")
269text4:SetFont(C.media.font, 12)
270text4:SetWidth(f:GetWidth()-40)
271text4:SetPoint("TOPLEFT", text3, "BOTTOMLEFT", 0, -20)
272
273local credits = f:CreateFontString(nil, "OVERLAY")
274credits:SetFont(C.media.font, 12, "THINOUTLINE")
275credits:SetText("")
276credits:SetPoint("BOTTOM", f, "BOTTOM", 0, 4)
277
278local sbt = sb:CreateFontString(nil, "OVERLAY")
279sbt:SetFont(C.media.font, 13, "THINOUTLINE")
280sbt:SetPoint("CENTER", sb)
281
282local option1 = CreateFrame("Button", "TukuiInstallOption1", f)
283option1:SetPoint("BOTTOMLEFT", f, "BOTTOMLEFT", 20, 20)
284option1:SetSize(128, 25)
285option1:SetTemplate("Default")
286option1:FontString("Text", C.media.font, 12)
287option1.Text:SetPoint("CENTER")
288
289local option2 = CreateFrame("Button", "TukuiInstallOption2", f)
290option2:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", -20, 20)
291option2:SetSize(128, 25)
292option2:SetTemplate("Default")
293option2:FontString("Text", C.media.font, 12)
294option2.Text:SetPoint("CENTER")
295
296local close = CreateFrame("Button", "TukuiInstallCloseButton", f, "UIPanelCloseButton")
297close:SetPoint("TOPRIGHT", f, "TOPRIGHT")
298close:SetScript("OnClick", function()
299	f:Hide()
300end)
301
302local step4 = function()
303-- tell savedvariable that we installed Tukui perfectly
304	TukuiDataPerChar.install = true
305
306	-- we can reset this shit here :)
307	TukuiSaved = {} -- make sure we clear the table first, don't want any unnecessary values
308	TukuiSaved = {
309		["bottomrows"] = 1,
310		["rightbars"] = 1,
311		["splitbars"] = false,
312		["actionbarsLocked"] = false,
313	}
314	
315	sb:SetValue(4)
316	PlaySoundFile("Sound\\interface\\LevelUp.wav")
317	header:SetText(L.install_header_11)
318	text1:SetText(L.install_step_4_line_1)
319	text2:SetText(L.install_step_4_line_2)
320	text3:SetText(L.install_step_4_line_3)
321	text4:SetText(L.install_step_4_line_4)
322	sbt:SetText("4/4")
323	option1:Hide()
324	option2.Text:SetText(L.install_button_finish)
325	option2:SetScript("OnClick", function()
326		ReloadUI()
327	end)
328end
329
330local step3 = function()
331	if not option2:IsShown() then option2:Show() end	
332	sb:SetValue(3)
333	header:SetText(L.install_header_10)
334	text1:SetText(L.install_step_3_line_1)
335	text2:SetText(L.install_step_3_line_2)
336	text3:SetText(L.install_step_3_line_3)
337	text4:SetText(L.install_step_3_line_4)
338	sbt:SetText("3/4")
339	option1:SetScript("OnClick", step4)
340	option2:SetScript("OnClick", function()
341		positionsetup()
342		step4()
343	end)
344end
345
346local step2 = function()
347	sb:SetValue(2)
348	header:SetText(L.install_header_9)
349	sbt:SetText("2/4")
350	if IsAddOnLoaded("Prat") or IsAddOnLoaded("Chatter") then 
351		text1:SetText(L.install_step_2_line_0)
352		text2:SetText("")
353		text3:SetText("")
354		text4:SetText("")
355		option2:Hide()
356	else
357		text1:SetText(L.install_step_2_line_1)
358		text2:SetText(L.install_step_2_line_2)
359		text3:SetText(L.install_step_2_line_3)
360		text4:SetText(L.install_step_2_line_4)
361		option2:SetScript("OnClick", function()
362			chatsetup()
363			step3()
364		end)
365	end	
366	option1:SetScript("OnClick", step3)
367end
368
369local step1 = function()
370	close:Hide()
371	sb:SetMinMaxValues(0, 4)
372	sb:Show()
373	sb:SetValue(1)
374	sb:SetStatusBarColor(0.26, 1, 0.22)
375	header:SetText(L.install_header_8)
376	text1:SetText(L.install_step_1_line_1)
377	text2:SetText(L.install_step_1_line_2)
378	text3:SetText(L.install_step_1_line_3)
379	text4:SetText(L.install_step_1_line_4)
380	sbt:SetText("1/4")
381
382	option1:Show()
383
384	option1.Text:SetText(L.install_button_skip)
385	option2.Text:SetText(L.install_button_continue)
386
387	option1:SetScript("OnClick", step2)
388	option2:SetScript("OnClick", function()
389		cvarsetup()
390		step2()
391	end)
392
393	-- this is really essential, whatever if skipped or not
394	SetActionBarToggles(1, 1, 1, 1, 0)
395	SetCVar("alwaysShowActionBars", 0)
396end
397
398local tut6 = function()
399	sb:SetValue(6)
400	header:SetText(L.install_header_7)
401	text1:SetText(L.tutorial_step_6_line_1)
402	text2:SetText(L.tutorial_step_6_line_2)
403	text3:SetText(L.tutorial_step_6_line_3)
404	text4:SetText(L.tutorial_step_6_line_4)
405
406	sbt:SetText("6/6")
407
408	option1:Show()
409
410	option1.Text:SetText(L.install_button_close)
411	option2.Text:SetText(L.install_button_install)
412
413	option1:SetScript("OnClick", function()
414		f:Hide()
415	end)
416	option2:SetScript("OnClick", step1)
417end
418
419local tut5 = function()
420	sb:SetValue(5)
421	header:SetText(L.install_header_6)
422	text1:SetText(L.tutorial_step_5_line_1)
423	text2:SetText(L.tutorial_step_5_line_2)
424	text3:SetText(L.tutorial_step_5_line_3)
425	text4:SetText(L.tutorial_step_5_line_4)
426
427	sbt:SetText("5/6")
428
429	option2:SetScript("OnClick", tut6)
430end
431
432local tut4 = function()
433	sb:SetValue(4)
434	header:SetText(L.install_header_5)
435	text1:SetText(L.tutorial_step_4_line_1)
436	text2:SetText(L.tutorial_step_4_line_2)
437	text3:SetText(L.tutorial_step_4_line_3)
438	text4:SetText(L.tutorial_step_4_line_4)
439
440	sbt:SetText("4/6")
441
442	option2:SetScript("OnClick", tut5)
443end
444
445local tut3 = function()
446	sb:SetValue(3)
447	header:SetText(L.install_header_4)
448	text1:SetText(L.tutorial_step_3_line_1)
449	text2:SetText(L.tutorial_step_3_line_2)
450	text3:SetText(L.tutorial_step_3_line_3)
451	text4:SetText(L.tutorial_step_3_line_4)
452
453	sbt:SetText("3/6")
454
455	option2:SetScript("OnClick", tut4)
456end
457
458local tut2 = function()
459	sb:SetValue(2)
460	header:SetText(L.install_header_3)
461	text1:SetText(L.tutorial_step_2_line_1)
462	text2:SetText(L.tutorial_step_2_line_2)
463	text3:SetText(L.tutorial_step_2_line_3)
464	text4:SetText(L.tutorial_step_2_line_4)
465
466	sbt:SetText("2/6")
467
468	option2:SetScript("OnClick", tut3)
469end
470
471local tut1 = function()
472	sb:SetMinMaxValues(0, 6)
473	sb:Show()
474	close:Show()
475	sb:SetValue(1)
476	sb:SetStatusBarColor(0, 0.76, 1)
477	header:SetText(L.install_header_2)
478	text1:SetText(L.tutorial_step_1_line_1)
479	text2:SetText(L.tutorial_step_1_line_2)
480	text3:SetText(L.tutorial_step_1_line_3)
481	text4:SetText(L.tutorial_step_1_line_4)
482	sbt:SetText("1/6")
483	option1:Hide()
484	option2.Text:SetText(L.install_button_next)
485	option2:SetScript("OnClick", tut2)
486end
487
488local function DisableTukui()
489	DisableAddOn("Tukui")
490	ReloadUI()
491end
492
493-- this install Tukui with default settings.
494local function install()
495	f:Show()
496	sb:Hide()
497	option1:Show()
498	option2:Show()
499	close:Show()
500	header:SetText(L.install_header_1)
501	text1:SetText(L.install_init_line_1)
502	text2:SetText(L.install_init_line_2)
503	text3:SetText(L.install_init_line_3)
504	text4:SetText(L.install_init_line_4)
505
506	option1.Text:SetText(L.install_button_tutorial)
507	option2.Text:SetText(L.install_button_install)
508
509	option1:SetScript("OnClick", tut1)
510	option2:SetScript("OnClick", step1)			
511end
512
513------------------------------------------------------------------------
514--	Popups
515------------------------------------------------------------------------
516
517StaticPopupDialogs["TUKUIDISABLE_UI"] = {
518	text = L.popup_disableui,
519	button1 = ACCEPT,
520	button2 = CANCEL,
521	OnAccept = DisableTukui,
522	timeout = 0,
523	whileDead = 1,
524	preferredIndex = 3,
525}
526
527StaticPopupDialogs["TUKUIDISABLE_RAID"] = {
528	text = L.popup_2raidactive,
529	button1 = "DPS - TANK",
530	button2 = "HEAL",
531	OnAccept = function() DisableAddOn("Tukui_Raid_Healing") EnableAddOn("Tukui_Raid") ReloadUI() end,
532	OnCancel = function() EnableAddOn("Tukui_Raid_Healing") DisableAddOn("Tukui_Raid") ReloadUI() end,
533	timeout = 0,
534	whileDead = 1,
535	preferredIndex = 3
536}
537
538StaticPopupDialogs["TUKUIDISBAND_RAID"] = {
539	text = L.disband,
540	button1 = ACCEPT,
541	button2 = CANCEL,
542	OnAccept = function()
543		if InCombatLockdown() then return end -- Prevent user error in combat
544		
545		SendChatMessage(ERR_GROUP_DISBANDED, "RAID" or "PARTY")
546		if UnitInRaid("player") then
547			for i = 1, GetNumRaidMembers() do
548				local name, _, _, _, _, _, _, online = GetRaidRosterInfo(i)
549				if online and name ~= T.myname then
550					UninviteUnit(name)
551				end
552			end
553		else
554			for i = MAX_PARTY_MEMBERS, 1, -1 do
555				if GetPartyMember(i) then
556					UninviteUnit(UnitName("party"..i))
557				end
558			end
559		end
560		LeaveParty()	
561	end,
562	timeout = 0,
563	whileDead = 1,
564	preferredIndex = 3,
565}
566
567------------------------------------------------------------------------
568--	On login function, look for some infos!
569------------------------------------------------------------------------
570
571local TukuiOnLogon = CreateFrame("Frame")
572TukuiOnLogon:RegisterEvent("PLAYER_ENTERING_WORLD")
573TukuiOnLogon:SetScript("OnEvent", function(self, event)
574	self:UnregisterEvent("PLAYER_ENTERING_WORLD")
575	
576	-- create empty saved vars if they doesn't exist.
577	if (TukuiData == nil) then TukuiData = {} end
578	if (TukuiDataPerChar == nil) then TukuiDataPerChar = {} end
579
580	if T.getscreenwidth < 1200 then
581			SetCVar("useUiScale", 0)
582			StaticPopup_Show("TUKUIDISABLE_UI")
583	else
584		SetCVar("useUiScale", 1)
585		if C["general"].multisampleprotect == true then
586			SetMultisampleFormat(1)
587		end
588		if C["general"].uiscale > 1 then C["general"].uiscale = 1 end
589		if C["general"].uiscale < 0.64 then C["general"].uiscale = 0.64 end
590
591		-- set our uiscale
592		SetCVar("uiScale", C["general"].uiscale)
593		
594		-- we adjust UIParent to screen #1 if Eyefinity is found
595		if T.eyefinity then
596			local width = T.eyefinity
597			local height = T.getscreenheight
598			
599			-- if autoscale is off, find a new width value of UIParent for screen #1.
600			if not C.general.autoscale or height > 1200 then
601				local h = UIParent:GetHeight()
602				local ratio = T.getscreenheight / h
603				local w = T.eyefinity / ratio
604				
605				width = w
606				height = h			
607			end
608			
609			UIParent:SetSize(width, height)
610			UIParent:ClearAllPoints()
611			UIParent:SetPoint("CENTER")		
612		end
613		
614		-- install default if we never ran Tukui on this character.
615		if not TukuiDataPerChar.install then			
616			install()
617		end
618	end
619	
620	if (IsAddOnLoaded("Tukui_Raid") and IsAddOnLoaded("Tukui_Raid_Healing")) then
621		StaticPopup_Show("TUKUIDISABLE_RAID")
622	end
623	
624	local playerName = UnitName("player")
625	print("Whats up, |cff00AAFF"..playerName.."!|r Thank you for using |cffFF6347AsphyxiaUI|r |cff00AAFF(A heavily modified version of Tukui).")
626	print("For detailed Information |cff00FFFFvisit www.tukui.org or https://github.com/Asphyxia")
627end)
628
629SLASH_TUTORIAL1 = "/uihelp"
630SLASH_TUTORIAL2 = "/tutorial"
631SlashCmdList.TUTORIAL = function() f:Show() tut1() end
632
633SLASH_VERSION1 = "/version"
634SlashCmdList.VERSION = function() if v:IsShown() then v:Hide() else v:Show() end end
635
636SLASH_CONFIGURE1 = "/install"
637SlashCmdList.CONFIGURE = install
638
639SLASH_RESETUI1 = "/resetui"
640SlashCmdList.RESETUI = function() f:Show() step1() end
641
642SLASH_AHELP1 = "/ahelp"
643SlashCmdList.AHELP = function() if ahelp:IsShown() then ahelp:Hide() else ahelp:Show() end end
644
645--[[local r, g, b = unpack(C["media"].datacolor)
646T.datacolor = ("|cff%.2x%.2x%.2x"):format(r * 255, g * 255, b * 255)--]]