You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
7.0 KiB

4 years ago
local Details = _G.Details
local DF = _G.DetailsFramework
local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details")
3 years ago
--config bookmarks
4 years ago
function Details:OpenBookmarkConfig()
if (not _G.DetailsBookmarkManager) then
3 years ago
DF:CreateSimplePanel(UIParent, 465, 460, Loc ["STRING_OPTIONS_MANAGE_BOOKMARKS"], "DetailsBookmarkManager")
4 years ago
local panel = _G.DetailsBookmarkManager
DF:ApplyStandardBackdrop(panel)
panel:SetBackdropColor(.1, .1, .1, .9)
panel.blocks = {}
3 years ago
local clear_func = function(self, button, id)
4 years ago
if (Details.switch.table [id]) then
Details.switch.table [id].atributo = nil
Details.switch.table [id].sub_atributo = nil
panel:Refresh()
Details.switch:Update()
end
end
3 years ago
local select_attribute = function(_, _, _, attribute, sub_atribute)
4 years ago
if (not sub_atribute) then
return
end
Details.switch.table [panel.selecting_slot].atributo = attribute
Details.switch.table [panel.selecting_slot].sub_atributo = sub_atribute
panel:Refresh()
Details.switch:Update()
end
local cooltip_color = {.1, .1, .1, .3}
3 years ago
local set_att = function(self, button, id)
4 years ago
panel.selecting_slot = id
GameCooltip:Reset()
GameCooltip:SetType (3)
3 years ago
GameCooltip:SetOwner(self)
4 years ago
Details:MontaAtributosOption (Details:GetInstance(1), select_attribute)
GameCooltip:SetColor (1, cooltip_color)
GameCooltip:SetColor (2, cooltip_color)
3 years ago
GameCooltip:SetOption("HeightAnchorMod", -7)
GameCooltip:SetOption("TextSize", Details.font_sizes.menus)
GameCooltip:SetBackdrop(1, Details.tooltip_backdrop, nil, Details.tooltip_border_color)
GameCooltip:SetBackdrop(2, Details.tooltip_backdrop, nil, Details.tooltip_border_color)
4 years ago
GameCooltip:ShowCooltip()
end
local button_backdrop = {bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 64, insets = {left=0, right=0, top=0, bottom=0}}
3 years ago
local set_onenter = function(self, capsule)
self:SetBackdropColor(1, 1, 1, 0.9)
capsule.icon:SetBlendMode("ADD")
4 years ago
end
3 years ago
local set_onleave = function(self, capsule)
self:SetBackdropColor(0, 0, 0, 0.5)
capsule.icon:SetBlendMode("BLEND")
4 years ago
end
for i = 1, 40 do
3 years ago
local clear = DF:CreateButton(panel, clear_func, 16, 16, nil, i, nil, [[Interface\Glues\LOGIN\Glues-CheckBox-Check]])
4 years ago
if (i%2 ~= 0) then
--impar
3 years ago
clear:SetPoint(15, (( i*10 ) * -1) - 35) --left
4 years ago
else
--par
local o = i-1
3 years ago
clear:SetPoint(250, (( o*10 ) * -1) - 35) --right
4 years ago
end
3 years ago
local set = DF:CreateButton(panel, set_att, 16, 16, nil, i)
set:SetPoint("left", clear, "right")
set:SetPoint("right", clear, "right", 180, 0)
set:SetBackdrop(button_backdrop)
set:SetBackdropColor(0, 0, 0, 0.5)
set:SetHook("OnEnter", set_onenter)
set:SetHook("OnLeave", set_onleave)
4 years ago
--set:InstallCustomTexture (nil, nil, nil, nil, true)
3 years ago
set:SetTemplate(DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
4 years ago
3 years ago
local bg_texture = DF:CreateImage(set, [[Interface\AddOns\Details\images\bar_skyline]], 135, 30, "background")
4 years ago
bg_texture:SetAllPoints()
set.bg = bg_texture
3 years ago
local icon = DF:CreateImage(set, nil, 16, 16, nil, nil, "icon")
icon:SetPoint("left", clear, "right", 4, 0)
4 years ago
3 years ago
local label = DF:CreateLabel(set, "")
label:SetPoint("left", icon, "right", 2, 0)
4 years ago
table.insert(panel.blocks, {icon = icon, label = label, bg = set.bg, button = set})
4 years ago
end
local normal_coords = {0, 1, 0, 1}
local unknown_coords = {157/512, 206/512, 39/512, 89/512}
function panel:Refresh()
local bookmarks = Details.switch.table
for i = 1, 40 do
local bookmark = bookmarks [i]
local this_block = panel.blocks [i]
if (bookmark and bookmark.atributo and bookmark.sub_atributo) then
3 years ago
if (bookmark.atributo == 5) then --custom
4 years ago
local CustomObject = Details.custom [bookmark.sub_atributo]
3 years ago
if (not CustomObject) then --ele j� foi deletado
4 years ago
this_block.label.text = "-- x -- x --"
this_block.icon.texture = "Interface\\ICONS\\Ability_DualWield"
this_block.icon.texcoord = normal_coords
3 years ago
this_block.bg:SetVertexColor(.4, .1, .1, .12)
4 years ago
else
this_block.label.text = CustomObject.name
this_block.icon.texture = CustomObject.icon
this_block.icon.texcoord = normal_coords
3 years ago
this_block.bg:SetVertexColor(.4, .4, .4, .6)
4 years ago
end
else
bookmark.atributo = bookmark.atributo or 1
bookmark.sub_atributo = bookmark.sub_atributo or 1
this_block.label.text = Details.sub_atributos [bookmark.atributo] and Details.sub_atributos [bookmark.atributo].lista [bookmark.sub_atributo]
this_block.icon.texture = Details.sub_atributos [bookmark.atributo] and Details.sub_atributos [bookmark.atributo].icones [bookmark.sub_atributo] [1]
this_block.icon.texcoord = Details.sub_atributos [bookmark.atributo] and Details.sub_atributos [bookmark.atributo].icones [bookmark.sub_atributo] [2]
3 years ago
this_block.bg:SetVertexColor(.4, .4, .4, .6)
4 years ago
end
3 years ago
this_block.button:SetAlpha(1)
4 years ago
else
this_block.label.text = "-- x -- x --"
this_block.icon.texture = [[Interface\AddOns\Details\images\icons]]
this_block.icon.texcoord = unknown_coords
3 years ago
this_block.bg:SetVertexColor(.1, .1, .1, .12)
this_block.button:SetAlpha(0.3)
4 years ago
end
end
end
end
local bookmarkFrame = _G.DetailsBookmarkManager
bookmarkFrame:Show()
bookmarkFrame:Refresh()
local optionsFrame = _G.DetailsOptionsWindow
if (optionsFrame) then
--parent is the plugin container
local currentOptionsScale = optionsFrame:GetParent():GetScale()
bookmarkFrame:SetScale(currentOptionsScale)
end
end