forked from Tercioo/Details-Damage-Meter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindow_profiler.lua
86 lines (70 loc) · 3.24 KB
/
window_profiler.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
local Details = _G.Details
local L = _G.LibStub("AceLocale-3.0"):GetLocale( "Details" )
function Details:OpenProfiler()
--isn't first run, so just quit
if (not Details.character_first_run) then
return
elseif (Details.is_first_run) then
return
elseif (Details.always_use_profile) then
return
else
--check is this is the first run of the addon (after being installed)
local amount = 0
for name, profile in pairs(_detalhes_global.__profiles) do
amount = amount + 1
end
if (amount == 1) then
return
end
end
local f = Details:CreateWelcomePanel (nil, nil, 250, 300, true)
f:SetPoint("right", UIParent, "right", -5, 0)
local logo = f:CreateTexture(nil, "artwork")
logo:SetTexture([[Interface\AddOns\Details\images\logotipo]])
logo:SetSize(256*0.8, 128*0.8)
logo:SetPoint("center", f, "center", 0, 0)
logo:SetPoint("top", f, "top", 20, 20)
local string_profiler = f:CreateFontString(nil, "artwork", "GameFontNormal")
string_profiler:SetPoint("top", logo, "bottom", -20, 10)
string_profiler:SetText("Profiler!")
local string_profiler = f:CreateFontString(nil, "artwork", "GameFontNormal")
string_profiler:SetPoint("topleft", f, "topleft", 10, -130)
string_profiler:SetText(L["STRING_OPTIONS_PROFILE_SELECTEXISTING"])
string_profiler:SetWidth(230)
Details:SetFontSize(string_profiler, 11)
Details:SetFontColor(string_profiler, "white")
--get the new profile name
local current_profile = Details:GetCurrentProfileName()
local on_select_profile = function(_, _, profilename)
if (profilename ~= Details:GetCurrentProfileName()) then
Details:ApplyProfile (profilename)
if (_G.DetailsOptionsWindow and _G.DetailsOptionsWindow:IsShown()) then
Details:OpenOptionsWindow (_G.DetailsOptionsWindow.instance)
end
end
end
local texcoord = {5/32, 30/32, 4/32, 28/32}
local fill_dropdown = function()
local t = {
{value = current_profile, label = L["STRING_OPTIONS_PROFILE_USENEW"], onclick = on_select_profile, icon = [[Interface\FriendsFrame\UI-Toast-FriendRequestIcon]], texcoord = {4/32, 30/32, 4/32, 28/32}, iconcolor = "orange"}
}
for _, profilename in ipairs(Details:GetProfileList()) do
if (profilename ~= current_profile) then
t[#t+1] = {value = profilename, label = profilename, onclick = on_select_profile, icon = [[Interface\FriendsFrame\UI-Toast-FriendOnlineIcon]], texcoord = texcoord, iconcolor = "yellow"}
end
end
return t
end
local dropdown = Details.gump:NewDropDown (f, f, "DetailsProfilerProfileSelectorDropdown", "dropdown", 220, 20, fill_dropdown, 1)
dropdown:SetPoint(15, -190)
local confirm_func = function()
if (current_profile ~= Details:GetCurrentProfileName()) then
Details:EraseProfile (current_profile)
end
f:Hide()
end
local confirm = Details.gump:NewButton(f, f, "DetailsProfilerProfileConfirmButton", "button", 150, 20, confirm_func, nil, nil, nil, "Okey!")
confirm:SetPoint(50, -250)
confirm:InstallCustomTexture()
end