CombineAddonButtons & LibCompat

CombineAddonButtons - Disabled not working code & First attempt to combine them - not successful.
LibCompat - Disable BackdropTemplate due to conflict with Immersion addon. Thank you to @s0h2x

Co-Authored-By: s0high <33549022+s0h2x@users.noreply.github.com>
This commit is contained in:
Sattva
2023-06-03 15:41:44 +03:00
parent 605d45bfa3
commit 626b1fb1c0
3 changed files with 100 additions and 77 deletions
+2
View File
@@ -38,6 +38,8 @@ Accept Ress - Will it ever accept ressurection if ressurecter in combat ?
-- Stuff to-do:
--------------------------------------------------------------------------------
HideMiniButtons - Make a copy edit box with a link to "guide" for Frame Stack
MinimapEnhance - MinimapNoScale and MinimapSize options needs fixing. For now moved them 10000px out of the GUI.
Minimap - Hide Minimap POI Arrow option.
+97 -76
View File
@@ -4040,88 +4040,109 @@ function LeaPlusLC:FriendCheck(name)
LeaPlusLC:LockItem(LeaPlusCB["HideMiniAddonButtons"], true)
LeaPlusCB["HideMiniAddonButtons"].tiptext = LeaPlusCB["HideMiniAddonButtons"].tiptext .. "|n|n|cff00AAFF" .. L["Cannot be used with Combine addon buttons."]
-- Create button frame (parenting to cluster ensures bFrame scales correctly)
local bFrame = CreateFrame("FRAME", nil, MinimapCluster)
bFrame:ClearAllPoints()
bFrame:SetPoint("TOPLEFT", Minimap, "TOPRIGHT", 4, 4)
bFrame:Hide()
bFrame:SetFrameLevel(8)
LeaPlusLC.bFrame = bFrame -- Used in LibDBIcon callback
_G["LeaPlusGlobalMinimapCombinedButtonFrame"] = bFrame -- For third party addons
local LDB = LibStub("LibDataBroker-1.1")
-- Hide button frame automatically
local ButtonFrameTicker
bFrame:HookScript("OnShow", function()
if ButtonFrameTicker then ButtonFrameTicker:Cancel() end
ButtonFrameTicker = LibCompat.NewTicker(2, function()
if ItemRackMenuFrame and ItemRackMenuFrame:IsShown() and ItemRackMenuFrame:IsMouseOver() then return end
if not bFrame:IsMouseOver() and not Minimap:IsMouseOver() then
bFrame:Hide()
if ButtonFrameTicker then ButtonFrameTicker:Cancel() end
end
end, 15)
end)
-- Create a frame to hold the buttons
local buttonFrame = CreateFrame("Frame", nil, UIParent)
buttonFrame:SetSize(30, 30)
buttonFrame:SetPoint("TOPLEFT", Minimap, "TOPRIGHT", 5, 0)
-- Match scale with minimap
if LeaPlusLC["SquareMinimap"] == "On" then
bFrame:SetScale(LeaPlusLC["MinimapScale"] * 0.75)
else
bFrame:SetScale(LeaPlusLC["MinimapScale"])
end
LeaPlusCB["MinimapScale"]:HookScript("OnValueChanged", function()
if LeaPlusLC["SquareMinimap"] == "On" then
bFrame:SetScale(LeaPlusLC["MinimapScale"] * 0.75)
else
bFrame:SetScale(LeaPlusLC["MinimapScale"])
end
end)
-- Position LibDBIcon tooltips when shown
LibDBIconTooltip:HookScript("OnShow", function()
GameTooltip:Hide()
LibDBIconTooltip:ClearAllPoints()
if bFrame:GetPoint() == "BOTTOMLEFT" then
LibDBIconTooltip:SetPoint("TOPLEFT", Minimap, "BOTTOMLEFT", 0, -6)
else
LibDBIconTooltip:SetPoint("TOPRIGHT", Minimap, "BOTTOMRIGHT", 0, -6)
end
end)
-- Function to position GameTooltip below the minimap
local function SetButtonTooltip()
GameTooltip:ClearAllPoints()
if bFrame:GetPoint() == "BOTTOMLEFT" then
GameTooltip:SetPoint("TOPLEFT", Minimap, "BOTTOMLEFT", 0, -6)
else
GameTooltip:SetPoint("TOPRIGHT", Minimap, "BOTTOMRIGHT", 0, -6)
end
end
LeaPlusLC.SetButtonTooltip = SetButtonTooltip -- Used in LibDBIcon callback
-- Loop through all LDB objects and add buttons to the frame if their names match
for name, obj in LDB:DataObjectIterator() do
if name:match("^LibDBIcon10_") then
print(name)
local button = obj.icon
button:SetParent(buttonFrame)
button:SetSize(30, 30)
button:SetFrameLevel(4) -- Set the frame level to be above the minimap and other frames
end
end
-- Hide existing LibDBIcon icons
local buttons = LibDBIconStub:GetButtonList()
for i = 1, #buttons do
local button = LibDBIconStub:GetMinimapButton(buttons[i])
local buttonName = strlower(buttons[i])
if not strfind(strlower(LeaPlusDB["MiniExcludeList"]), buttonName) then
button:Hide()
button:SetScript("OnShow", function() if not bFrame:IsShown() then button:Hide() end end)
-- Create background texture
local bFrameBg = button:CreateTexture(nil, "BACKGROUND")
bFrameBg:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
bFrameBg:SetPoint("CENTER")
bFrameBg:SetSize(30, 30)
bFrameBg:SetVertexColor(0, 0, 0, 0.5)
elseif strfind(strlower(LeaPlusDB["MiniExcludeList"]), buttonName) and LeaPlusLC["SquareMinimap"] == "On" then
button:SetScale(0.75)
end
-- Move GameTooltip to below the minimap in case the button uses it
button:HookScript("OnEnter", SetButtonTooltip)
end
-- -- Create button frame (parenting to cluster ensures bFrame scales correctly)
-- local bFrame = CreateFrame("FRAME", nil, MinimapCluster)
-- bFrame:ClearAllPoints()
-- bFrame:SetPoint("TOPLEFT", Minimap, "TOPRIGHT", 4, 4)
-- bFrame:Hide()
-- bFrame:SetFrameLevel(8)
-- LeaPlusLC.bFrame = bFrame -- Used in LibDBIcon callback
-- _G["LeaPlusGlobalMinimapCombinedButtonFrame"] = bFrame -- For third party addons
-- -- Hide button frame automatically
-- local ButtonFrameTicker
-- bFrame:HookScript("OnShow", function()
-- if ButtonFrameTicker then ButtonFrameTicker:Cancel() end
-- ButtonFrameTicker = LibCompat.NewTicker(2, function()
-- if ItemRackMenuFrame and ItemRackMenuFrame:IsShown() and ItemRackMenuFrame:IsMouseOver() then return end
-- if not bFrame:IsMouseOver() and not Minimap:IsMouseOver() then
-- bFrame:Hide()
-- if ButtonFrameTicker then ButtonFrameTicker:Cancel() end
-- end
-- end, 15)
-- end)
-- -- Match scale with minimap
-- if LeaPlusLC["SquareMinimap"] == "On" then
-- bFrame:SetScale(LeaPlusLC["MinimapScale"] * 0.75)
-- else
-- bFrame:SetScale(LeaPlusLC["MinimapScale"])
-- end
-- LeaPlusCB["MinimapScale"]:HookScript("OnValueChanged", function()
-- if LeaPlusLC["SquareMinimap"] == "On" then
-- bFrame:SetScale(LeaPlusLC["MinimapScale"] * 0.75)
-- else
-- bFrame:SetScale(LeaPlusLC["MinimapScale"])
-- end
-- end)
-- -- Position LibDBIcon tooltips when shown
-- LibDBIconTooltip:HookScript("OnShow", function()
-- GameTooltip:Hide()
-- LibDBIconTooltip:ClearAllPoints()
-- if bFrame:GetPoint() == "BOTTOMLEFT" then
-- LibDBIconTooltip:SetPoint("TOPLEFT", Minimap, "BOTTOMLEFT", 0, -6)
-- else
-- LibDBIconTooltip:SetPoint("TOPRIGHT", Minimap, "BOTTOMRIGHT", 0, -6)
-- end
-- end)
-- -- Function to position GameTooltip below the minimap
-- local function SetButtonTooltip()
-- GameTooltip:ClearAllPoints()
-- if bFrame:GetPoint() == "BOTTOMLEFT" then
-- GameTooltip:SetPoint("TOPLEFT", Minimap, "BOTTOMLEFT", 0, -6)
-- else
-- GameTooltip:SetPoint("TOPRIGHT", Minimap, "BOTTOMRIGHT", 0, -6)
-- end
-- end
-- LeaPlusLC.SetButtonTooltip = SetButtonTooltip -- Used in LibDBIcon callback
-- -- Hide existing LibDBIcon icons
-- local buttons = LibDBIconStub:GetButtonList()
-- for i = 1, #buttons do
-- local button = LibDBIconStub:GetMinimapButton(buttons[i])
-- local buttonName = strlower(buttons[i])
-- if not strfind(strlower(LeaPlusDB["MiniExcludeList"]), buttonName) then
-- button:Hide()
-- button:SetScript("OnShow", function() if not bFrame:IsShown() then button:Hide() end end)
-- -- Create background texture
-- local bFrameBg = button:CreateTexture(nil, "BACKGROUND")
-- bFrameBg:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
-- bFrameBg:SetPoint("CENTER")
-- bFrameBg:SetSize(30, 30)
-- bFrameBg:SetVertexColor(0, 0, 0, 0.5)
-- elseif strfind(strlower(LeaPlusDB["MiniExcludeList"]), buttonName) and LeaPlusLC["SquareMinimap"] == "On" then
-- button:SetScale(0.75)
-- end
-- -- Move GameTooltip to below the minimap in case the button uses it
-- button:HookScript("OnEnter", SetButtonTooltip)
-- end
-- Hide new LibDBIcon icons
-- LibDBIcon_IconCreated: Done in LibDBIcon callback function
+1 -1
View File
@@ -5,7 +5,7 @@
<Script file="Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua"/>
<!--@end-no-lib-strip@-->
<Include file="Libs\LibGroupTalents-1.0\lib.xml"/>
<Include file="Backdrop\Backdrop.xml"/>
<!-- <Include file="Backdrop\Backdrop.xml"/> -->
<Include file="Templates.xml"/>
<Script file="LibCompat-1.0.lua"/>
</Ui>