Updated LibOpenRaid and DetailsFramework
This commit is contained in:
+60
-60
@@ -6,53 +6,53 @@
|
||||
local _
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> local pointers
|
||||
--local pointers
|
||||
-- none
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> details api functions
|
||||
--details api functions
|
||||
|
||||
--> create a button which will be displayed on tooltip
|
||||
--create a button which will be displayed on tooltip
|
||||
function _detalhes.ToolBar:NewPluginToolbarButton (func, icon, pluginname, tooltip, w, h, framename, menu_function)
|
||||
|
||||
--> random name if nameless
|
||||
--random name if nameless
|
||||
if (not framename) then
|
||||
framename = "DetailsToolbarButton" .. math.random (1, 100000)
|
||||
end
|
||||
|
||||
--> create button from template
|
||||
local button = CreateFrame ("button", framename, _detalhes.listener, "DetailsToolbarButton")
|
||||
--create button from template
|
||||
local button = CreateFrame("button", framename, _detalhes.listener, "DetailsToolbarButton")
|
||||
|
||||
--> sizes
|
||||
--sizes
|
||||
if (w) then
|
||||
button:SetWidth (w)
|
||||
button:SetWidth(w)
|
||||
end
|
||||
if (h) then
|
||||
button:SetHeight (h)
|
||||
button:SetHeight(h)
|
||||
end
|
||||
|
||||
button.x = 0
|
||||
button.y = 0
|
||||
|
||||
--> tooltip and function on click
|
||||
--tooltip and function on click
|
||||
button.tooltip = tooltip
|
||||
button.menu = menu_function
|
||||
button:SetScript ("OnClick", func)
|
||||
button:SetScript("OnClick", func)
|
||||
|
||||
--> textures
|
||||
button:SetNormalTexture (icon)
|
||||
button:SetPushedTexture (icon)
|
||||
--textures
|
||||
button:SetNormalTexture(icon)
|
||||
button:SetPushedTexture(icon)
|
||||
button:SetDisabledTexture (icon)
|
||||
button:SetHighlightTexture (icon, "ADD")
|
||||
button:SetHighlightTexture(icon, "ADD")
|
||||
button.__icon = icon
|
||||
button.__name = pluginname
|
||||
|
||||
--> blizzard built-in animation
|
||||
--local FourCornerAnimeFrame = CreateFrame ("frame", framename.."Blink", button) --, "IconIntroAnimTemplate" --stop using 'IconIntroAnimTemplate' as older versions of the game doesn't have it
|
||||
--FourCornerAnimeFrame:SetPoint ("center", button)
|
||||
--FourCornerAnimeFrame:SetWidth (w or 14)
|
||||
--FourCornerAnimeFrame:SetHeight (w or 14)
|
||||
--FourCornerAnimeFrame.glow:SetScript ("OnFinished", nil)
|
||||
--blizzard built-in animation
|
||||
--local FourCornerAnimeFrame = CreateFrame("frame", framename.."Blink", button) --, "IconIntroAnimTemplate" --stop using 'IconIntroAnimTemplate' as older versions of the game doesn't have it
|
||||
--FourCornerAnimeFrame:SetPoint("center", button)
|
||||
--FourCornerAnimeFrame:SetWidth(w or 14)
|
||||
--FourCornerAnimeFrame:SetHeight(w or 14)
|
||||
--FourCornerAnimeFrame.glow:SetScript("OnFinished", nil)
|
||||
--button.blink = FourCornerAnimeFrame
|
||||
|
||||
_detalhes.ToolBar.AllButtons [#_detalhes.ToolBar.AllButtons+1] = button
|
||||
@@ -60,12 +60,12 @@
|
||||
return button
|
||||
end
|
||||
|
||||
--> show your plugin icon on tooltip
|
||||
--show your plugin icon on tooltip
|
||||
function _detalhes:ShowToolbarIcon (Button, Effect)
|
||||
|
||||
local LastIcon
|
||||
|
||||
--> get the lower number instance
|
||||
--get the lower number instance
|
||||
local lower_instance = _detalhes:GetLowerInstanceNumber()
|
||||
if (not lower_instance) then
|
||||
return
|
||||
@@ -74,7 +74,7 @@
|
||||
local instance = _detalhes:GetInstance (lower_instance)
|
||||
|
||||
if (#_detalhes.ToolBar.Shown > 0) then
|
||||
--> already shown
|
||||
--already shown
|
||||
if (_detalhes:tableIN (_detalhes.ToolBar.Shown, Button)) then
|
||||
return
|
||||
end
|
||||
@@ -84,7 +84,7 @@
|
||||
end
|
||||
|
||||
_detalhes.ToolBar.Shown [#_detalhes.ToolBar.Shown+1] = Button
|
||||
Button:SetPoint ("left", LastIcon.widget or LastIcon, "right", Button.x, Button.y)
|
||||
Button:SetPoint("left", LastIcon.widget or LastIcon, "right", Button.x, Button.y)
|
||||
|
||||
Button:Show()
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
end
|
||||
|
||||
if (Effect) then
|
||||
if (type (Effect) == "string") then
|
||||
if (type(Effect) == "string") then
|
||||
if (Effect == "blink") then
|
||||
--Button.blink.glow:Play() --.blink and .glow doesn't exists anymore due to removal of the template 'IconIntroAnimTemplate'
|
||||
elseif (Effect == "star") then
|
||||
@@ -111,46 +111,46 @@
|
||||
return true
|
||||
end
|
||||
|
||||
--> hide your plugin icon from toolbar
|
||||
--hide your plugin icon from toolbar
|
||||
function _detalhes:HideToolbarIcon (Button)
|
||||
|
||||
local index = _detalhes:tableIN (_detalhes.ToolBar.Shown, Button)
|
||||
|
||||
if (not index) then
|
||||
--> current not shown
|
||||
--current not shown
|
||||
return
|
||||
end
|
||||
|
||||
Button:Hide()
|
||||
table.remove (_detalhes.ToolBar.Shown, index)
|
||||
|
||||
--> reorganize icons
|
||||
--reorganize icons
|
||||
_detalhes.ToolBar:ReorganizeIcons (true)
|
||||
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> internal functions
|
||||
--internal functions
|
||||
do
|
||||
local PluginDescPanel = CreateFrame ("frame", "DetailsPluginDescPanel", UIParent)
|
||||
local PluginDescPanel = CreateFrame("frame", "DetailsPluginDescPanel", UIParent)
|
||||
PluginDescPanel:SetFrameStrata ("tooltip")
|
||||
PluginDescPanel:Hide()
|
||||
PluginDescPanel:SetWidth (205)
|
||||
PluginDescPanel:SetWidth(205)
|
||||
PluginDescPanel.BackdropTable = {}
|
||||
|
||||
local background = PluginDescPanel:CreateTexture (nil, "artwork")
|
||||
background:SetPoint ("topleft", 0, 0)
|
||||
background:SetPoint ("bottomright", 0, 0)
|
||||
local background = PluginDescPanel:CreateTexture(nil, "artwork")
|
||||
background:SetPoint("topleft", 0, 0)
|
||||
background:SetPoint("bottomright", 0, 0)
|
||||
PluginDescPanel.background = background
|
||||
|
||||
local icon, title, desc = PluginDescPanel:CreateTexture (nil, "overlay"), PluginDescPanel:CreateFontString (nil, "overlay", "GameFontNormal"), PluginDescPanel:CreateFontString (nil, "overlay", "GameFontNormal")
|
||||
icon:SetPoint ("topleft", 10, -10)
|
||||
icon:SetSize (16, 16)
|
||||
title:SetPoint ("left", icon, "right", 2, 0)
|
||||
desc:SetPoint ("topleft", 13, -30)
|
||||
desc:SetWidth (180)
|
||||
desc:SetJustifyH ("left")
|
||||
_detalhes:SetFontColor (desc, "white")
|
||||
local icon, title, desc = PluginDescPanel:CreateTexture(nil, "overlay"), PluginDescPanel:CreateFontString (nil, "overlay", "GameFontNormal"), PluginDescPanel:CreateFontString (nil, "overlay", "GameFontNormal")
|
||||
icon:SetPoint("topleft", 10, -10)
|
||||
icon:SetSize(16, 16)
|
||||
title:SetPoint("left", icon, "right", 2, 0)
|
||||
desc:SetPoint("topleft", 13, -30)
|
||||
desc:SetWidth(180)
|
||||
desc:SetJustifyH("left")
|
||||
_detalhes:SetFontColor(desc, "white")
|
||||
|
||||
PluginDescPanel.icon = icon
|
||||
PluginDescPanel.title = title
|
||||
@@ -161,7 +161,7 @@ end
|
||||
|
||||
local lower_instance = _detalhes:GetLowerInstanceNumber()
|
||||
if (lower_instance) then
|
||||
_detalhes.OnEnterMainWindow (_detalhes:GetInstance (lower_instance), button, 3)
|
||||
_detalhes.OnEnterMainWindow(_detalhes:GetInstance (lower_instance), button, 3)
|
||||
end
|
||||
|
||||
if (button.tooltip) then
|
||||
@@ -171,13 +171,13 @@ end
|
||||
local next_check = 0.8
|
||||
|
||||
--check if the mouse is still interacting with the menu or with the button
|
||||
button:SetScript ("OnUpdate", function(self, elapsed)
|
||||
button:SetScript("OnUpdate", function(self, elapsed)
|
||||
next_check = next_check - elapsed
|
||||
|
||||
if (next_check < 0) then
|
||||
if (not GameCooltipFrame1:IsMouseOver() and not button:IsMouseOver()) then
|
||||
GameCooltip2:Hide()
|
||||
button:SetScript ("OnUpdate", nil)
|
||||
button:SetScript("OnUpdate", nil)
|
||||
return
|
||||
end
|
||||
next_check = 0.8
|
||||
@@ -186,7 +186,7 @@ end
|
||||
|
||||
--disable the hider menu if the cooltip is required in another place
|
||||
hooksecurefunc (GameCooltip2, "ShowCooltip", function()
|
||||
button:SetScript ("OnUpdate", nil)
|
||||
button:SetScript("OnUpdate", nil)
|
||||
end)
|
||||
|
||||
return
|
||||
@@ -196,13 +196,13 @@ end
|
||||
local plugin_object = _detalhes:GetPlugin (button.__name)
|
||||
|
||||
local f = DetailsPluginDescPanel
|
||||
f.icon:SetTexture (button.__icon)
|
||||
f.title:SetText (button.__name)
|
||||
f.desc:SetText (plugin_object:GetPluginDescription())
|
||||
f.icon:SetTexture(button.__icon)
|
||||
f.title:SetText(button.__name)
|
||||
f.desc:SetText(plugin_object:GetPluginDescription())
|
||||
_detalhes:SetFontSize (f.desc, _detalhes.font_sizes.menus)
|
||||
_detalhes:SetFontFace (f.desc, _detalhes.font_faces.menus)
|
||||
|
||||
--f.background:SetTexture (_detalhes.tooltip.menus_bg_texture)
|
||||
--f.background:SetTexture(_detalhes.tooltip.menus_bg_texture)
|
||||
f.background:SetTexCoord (unpack (_detalhes.tooltip.menus_bg_coords))
|
||||
f.background:SetVertexColor (unpack (_detalhes.tooltip.menus_bg_color))
|
||||
--f.background:SetDesaturated (true)
|
||||
@@ -213,12 +213,12 @@ end
|
||||
f.BackdropTable.edgeSize = 1 --_detalhes.tooltip_backdrop.edgeSize
|
||||
f.BackdropTable.tileSize = _detalhes.tooltip_backdrop.tileSize
|
||||
|
||||
f:SetBackdrop (f.BackdropTable)
|
||||
local r, g, b, a = _detalhes.gump:ParseColors (_detalhes.tooltip_border_color)
|
||||
f:SetBackdropBorderColor (r, g, b, a)
|
||||
f:SetBackdrop(f.BackdropTable)
|
||||
local r, g, b, a = _detalhes.gump:ParseColors(_detalhes.tooltip_border_color)
|
||||
f:SetBackdropBorderColor(r, g, b, a)
|
||||
|
||||
f:SetHeight (40 + f.desc:GetStringHeight())
|
||||
f:SetPoint ("bottom", button, "top", 0, 10)
|
||||
f:SetHeight(40 + f.desc:GetStringHeight())
|
||||
f:SetPoint("bottom", button, "top", 0, 10)
|
||||
f:Show()
|
||||
--SharedMedia:Fetch ("font", "Friz Quadrata TT")
|
||||
|
||||
@@ -229,7 +229,7 @@ end
|
||||
|
||||
local lower_instance = _detalhes:GetLowerInstanceNumber()
|
||||
if (lower_instance) then
|
||||
_detalhes.OnLeaveMainWindow (_detalhes:GetInstance (lower_instance), button, 3)
|
||||
_detalhes.OnLeaveMainWindow(_detalhes:GetInstance (lower_instance), button, 3)
|
||||
end
|
||||
|
||||
if (button.tooltip) then
|
||||
@@ -239,7 +239,7 @@ end
|
||||
|
||||
_detalhes:RegisterEvent (_detalhes.ToolBar, "DETAILS_INSTANCE_OPEN", "OnInstanceOpen")
|
||||
_detalhes:RegisterEvent (_detalhes.ToolBar, "DETAILS_INSTANCE_CLOSE", "OnInstanceClose")
|
||||
_detalhes.ToolBar.Enabled = true --> must have this member or wont receive the event
|
||||
_detalhes.ToolBar.Enabled = true --must have this member or wont receive the event
|
||||
_detalhes.ToolBar.__enabled = true
|
||||
|
||||
function _detalhes.ToolBar:OnInstanceOpen()
|
||||
@@ -250,11 +250,11 @@ end
|
||||
end
|
||||
|
||||
function _detalhes.ToolBar:ReorganizeIcons (just_refresh)
|
||||
--> get the lower number instance
|
||||
--get the lower number instance
|
||||
local lower_instance = _detalhes:GetLowerInstanceNumber()
|
||||
|
||||
if (not lower_instance) then
|
||||
for _, ThisButton in ipairs (_detalhes.ToolBar.Shown) do
|
||||
for _, ThisButton in ipairs(_detalhes.ToolBar.Shown) do
|
||||
ThisButton:Hide()
|
||||
end
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user