Fix missing LibDBIcon

This commit is contained in:
rilgamon 2021-03-23 11:04:22 +01:00
parent 3ac7392591
commit 8dde1f86d0
1 changed files with 38 additions and 3 deletions

View File

@ -5,6 +5,7 @@ local db
local zzLDB = LibStub:GetLibrary("zzLDB")
local folder = addonName ~= childName and format("Interface\\AddOns\\%s\\%s", addonName, childName) or format("Interface\\AddOns\\%s", childName)
local L = LibStub("AceLocale-3.0"):GetLocale(childName, true)
local ldbicon = LibStub:GetLibrary("LibDBIcon-1.0")
local GetNumAddOns = GetNumAddOns
local GetAddOnInfo = GetAddOnInfo
local GetAddOnMemoryUsage = GetAddOnMemoryUsage
@ -40,9 +41,6 @@ local C_CVar = C_CVar or {
local GameTimeFrame_OnClick = GameTimeFrame_OnClick or function(self) TimeManagerClockButton:Click() end
-- End of Fix Classic
local function OnClick(self, button)
zzLDB:DefaultOnClick(self, button, addon, childName)
end
local function updateainfo()
child['ainfo'] = child['ainfo'] or {}
local ainfo = child['ainfo']
@ -65,6 +63,43 @@ local function updateainfo()
end
end
end
local function OnClick(self, button)
if(button == 'RightButton') then
if(InterfaceOptionsFrame:IsVisible() and not InCombatLockdown()) then
InterfaceOptionsFrame:Hide()
else
InterfaceOptionsFrame_OpenToCategory(childName)
InterfaceOptionsFrame_OpenToCategory(childName) -- Twice because of a bug in InterfaceOptionsFrame_OpenToCategory
end
elseif(button == 'MiddleButton') then
local pCPU = C_CVar.GetCVarBool("scriptProfile")
if(pCPU) then
pCPU = 0
else
pCPU = 1
end
C_CVar.SetCVar("scriptProfile", pCPU)
print(L["CPU setting changed. Please Reload UI."])
updateainfo()
else
if(IsShiftKeyDown()) then
local db = addon['db']['global']['ldbicons']
db[childName]['hide'] = not db[childName]['hide']
if(ldbicon) then
if(db[childName]['hide']) then
ldbicon:Hide(childName)
else
ldbicon:Show(childName)
end
end
elseif(IsControlKeyDown()) then
print(L["garbagecollected"])
collectgarbage("collect")
else
GameTimeFrame_OnClick(_G["GameTimeFrame"])
end
end
end
local function toggleColor(col,col1,col2)
return col == col1 and col2 or col1
end