Compare commits

...

8 Commits

Author SHA1 Message Date
Robin Hüskes ea44aa9dc4 Update Libs 2022-12-15 20:41:07 +01:00
Robin Hüskes 2bc8eafd12 [zzAddOn] Fix copy&paste error, bumb lib version 2022-12-03 23:33:03 +01:00
Robin Hüskes 8ed23ca329 Update LibDBIcon 2022-12-03 17:20:17 +01:00
Robin Hüskes fdd8d7edc3 [zzAddOn] Fix to make sure ManagerFrameEvent is fired only once 2022-12-03 16:14:42 +01:00
Robin Hüskes 97302fda67 [zzAddOn] Cleanup RegisterOpen, RegisterClose 2022-12-02 16:13:11 +01:00
Robin Hüskes c021d7c922 [zzAddOn] Add RegisterOpen, RegisterClose 2022-12-02 15:59:37 +01:00
Robin Hüskes b8e50843bd Update Libs 2022-11-27 23:21:47 +01:00
Robin Hüskes 7c121fab3a Update Ace3 Libs r1297-alpha, zzLDB 5 2022-11-21 01:30:44 +01:00
7 changed files with 119 additions and 49 deletions

View File

@ -1,13 +1,13 @@
--- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables.
-- @class file
-- @name AceConfigDialog-3.0
-- @release $Id: AceConfigDialog-3.0.lua 1292 2022-09-29 08:00:11Z nevcairiel $
-- @release $Id: AceConfigDialog-3.0.lua 1296 2022-11-04 18:50:10Z nevcairiel $
local LibStub = LibStub
local gui = LibStub("AceGUI-3.0")
local reg = LibStub("AceConfigRegistry-3.0")
local MAJOR, MINOR = "AceConfigDialog-3.0", 85
local MAJOR, MINOR = "AceConfigDialog-3.0", 86
local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
if not AceConfigDialog then return end
@ -147,6 +147,7 @@ local stringIsLiteral = {
width = true,
image = true,
fontSize = true,
tooltipHyperlink = true
}
--Is Never a function or method
@ -501,6 +502,14 @@ local function OptionOnMouseOver(widget, event)
local tooltip = AceConfigDialog.tooltip
tooltip:SetOwner(widget.frame, "ANCHOR_TOPRIGHT")
local tooltipHyperlink = GetOptionsMemberValue("tooltipHyperlink", opt, options, path, appName)
if tooltipHyperlink then
tooltip:SetHyperlink(tooltipHyperlink)
tooltip:Show()
return
end
local name = GetOptionsMemberValue("name", opt, options, path, appName)
local desc = GetOptionsMemberValue("desc", opt, options, path, appName)
local usage = GetOptionsMemberValue("usage", opt, options, path, appName)

View File

@ -8,10 +8,10 @@
-- :IterateOptionsTables() (and :GetOptionsTable() if only given one argument) return a function reference that the requesting config handling addon must call with valid "uiType", "uiName".
-- @class file
-- @name AceConfigRegistry-3.0
-- @release $Id: AceConfigRegistry-3.0.lua 1207 2019-06-23 12:08:33Z nevcairiel $
-- @release $Id: AceConfigRegistry-3.0.lua 1296 2022-11-04 18:50:10Z nevcairiel $
local CallbackHandler = LibStub("CallbackHandler-1.0")
local MAJOR, MINOR = "AceConfigRegistry-3.0", 20
local MAJOR, MINOR = "AceConfigRegistry-3.0", 21
local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR)
if not AceConfigRegistry then return end
@ -83,6 +83,7 @@ local basekeys={
dialogHidden=optmethodbool,
dropdownHidden=optmethodbool,
cmdHidden=optmethodbool,
tooltipHyperlink=optstringfunc,
icon=optstringnumberfunc,
iconCoords=optmethodtable,
handler=opttable,

View File

@ -1,5 +1,5 @@
--[[ $Id: CallbackHandler-1.0.lua 1284 2022-09-25 09:15:30Z nevcairiel $ ]]
local MAJOR, MINOR = "CallbackHandler-1.0", 7
--[[ $Id: CallbackHandler-1.0.lua 26 2022-12-12 15:09:39Z nevcairiel $ ]]
local MAJOR, MINOR = "CallbackHandler-1.0", 8
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
if not CallbackHandler then return end -- No upgrade needed
@ -7,21 +7,16 @@ if not CallbackHandler then return end -- No upgrade needed
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
-- Lua APIs
local error = error
local securecallfunction, error = securecallfunction, error
local setmetatable, rawget = setmetatable, rawget
local next, select, pairs, type, tostring = next, select, pairs, type, tostring
local xpcall = xpcall
local function errorhandler(err)
return geterrorhandler()(err)
end
local function Dispatch(handlers, ...)
local index, method = next(handlers)
if not method then return end
repeat
xpcall(method, errorhandler, ...)
securecallfunction(method, ...)
index, method = next(handlers, index)
until not method
end

View File

@ -1,4 +1,4 @@
--@curseforge-project-slug: libdbicon-1-0@
-----------------------------------------------------------------------
-- LibDBIcon-1.0
--
@ -6,7 +6,7 @@
--
local DBICON10 = "LibDBIcon-1.0"
local DBICON10_MINOR = 44 -- Bump on changes
local DBICON10_MINOR = 45 -- Bump on changes
if not LibStub then error(DBICON10 .. " requires LibStub.") end
local ldb = LibStub("LibDataBroker-1.1", true)
if not ldb then error(DBICON10 .. " requires LibDataBroker-1.1.") end
@ -218,37 +218,49 @@ local function createButton(name, object, db)
button.dataObject = object
button.db = db
button:SetFrameStrata("MEDIUM")
if button.SetFixedFrameStrata then -- Classic support
button:SetFixedFrameStrata(true)
end
button:SetFixedFrameStrata(true)
button:SetFrameLevel(8)
if button.SetFixedFrameLevel then -- Classic support
button:SetFixedFrameLevel(true)
end
button:SetFixedFrameLevel(true)
button:SetSize(31, 31)
button:RegisterForClicks("anyUp")
button:RegisterForDrag("LeftButton")
button:SetHighlightTexture(136477) --"Interface\\Minimap\\UI-Minimap-ZoomButton-Highlight"
local overlay = button:CreateTexture(nil, "OVERLAY")
overlay:SetSize(53, 53)
overlay:SetTexture(136430) --"Interface\\Minimap\\MiniMap-TrackingBorder"
overlay:SetPoint("TOPLEFT")
local background = button:CreateTexture(nil, "BACKGROUND")
background:SetSize(20, 20)
background:SetTexture(136467) --"Interface\\Minimap\\UI-Minimap-Background"
background:SetPoint("TOPLEFT", 7, -5)
local icon = button:CreateTexture(nil, "ARTWORK")
icon:SetSize(17, 17)
icon:SetTexture(object.icon)
icon:SetPoint("TOPLEFT", 7, -6)
button.icon = icon
if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then
local overlay = button:CreateTexture(nil, "OVERLAY")
overlay:SetSize(50, 50)
overlay:SetTexture(136430) --"Interface\\Minimap\\MiniMap-TrackingBorder"
overlay:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0)
local background = button:CreateTexture(nil, "BACKGROUND")
background:SetSize(24, 24)
background:SetTexture(136467) --"Interface\\Minimap\\UI-Minimap-Background"
background:SetPoint("CENTER", button, "CENTER", 0, 1)
local icon = button:CreateTexture(nil, "ARTWORK")
icon:SetSize(18, 18)
icon:SetTexture(object.icon)
icon:SetPoint("CENTER", button, "CENTER", 0, 1)
button.icon = icon
else
local overlay = button:CreateTexture(nil, "OVERLAY")
overlay:SetSize(53, 53)
overlay:SetTexture(136430) --"Interface\\Minimap\\MiniMap-TrackingBorder"
overlay:SetPoint("TOPLEFT")
local background = button:CreateTexture(nil, "BACKGROUND")
background:SetSize(20, 20)
background:SetTexture(136467) --"Interface\\Minimap\\UI-Minimap-Background"
background:SetPoint("TOPLEFT", 7, -5)
local icon = button:CreateTexture(nil, "ARTWORK")
icon:SetSize(17, 17)
icon:SetTexture(object.icon)
icon:SetPoint("TOPLEFT", 7, -6)
button.icon = icon
end
button.isMouseDown = false
local r, g, b = button.icon:GetVertexColor()
button.icon:SetVertexColor(object.iconR or r, object.iconG or g, object.iconB or b)
local r, g, b = icon:GetVertexColor()
icon:SetVertexColor(object.iconR or r, object.iconG or g, object.iconB or b)
icon.UpdateCoord = updateCoord
icon:UpdateCoord()
button.icon.UpdateCoord = updateCoord
button.icon:UpdateCoord()
button:SetScript("OnEnter", onEnter)
button:SetScript("OnLeave", onLeave)

View File

@ -1,13 +1,14 @@
local lib = LibStub:NewLibrary("zzAddOn", 10)
local lib = LibStub:NewLibrary("zzAddOn", 12)
if not lib then return end
local config = LibStub:GetLibrary("zzConfig")
lib['callbacks'] = lib['callbacks'] or LibStub:GetLibrary("CallbackHandler-1.0"):New(lib)
lib['addons'] = lib['addons'] or {}
lib['managerframe'] = lib['managerframe'] or CreateFrame("FRAME")
lib['events'] = lib['events'] or CreateFrame("FRAME")
local function errormsg(err)
print(format("|cffff0000Error:|r %s",err))
end
local mixins = {'NewAddOn', 'GetAddOn', 'AddChild', 'HasChild', 'IsChild', 'HasParent', 'GetParent', 'GetOptions', 'RegisterEvent','UnregisterEvent','IsClassic','IsBCC','IsRetail', 'GetSpecs', 'Fire'}
local mixins = {'NewAddOn', 'GetAddOn', 'AddChild', 'HasChild', 'IsChild', 'HasParent', 'GetParent', 'GetOptions', 'RegisterEvent','UnregisterEvent','IsClassic','IsBCC','IsRetail', 'GetSpecs', 'Fire', 'RegisterOpen', 'RegisterClose'}
function lib:Fire(...)
lib['callbacks']:Fire(...)
end
@ -103,6 +104,44 @@ end
function lib:IsRetail()
return WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
end
local function handleManagerFrame(self, event, num)
if(event == "PLAYER_INTERACTION_MANAGER_FRAME_SHOW") then
lib['callbacks']:Fire(format("show-%i", num))
else
lib['callbacks']:Fire(format("hide-%i", num))
end
end
local function addManagerFrame(self, mode, num, globalfunc)
if(type(num) == 'table') then
for k, v in pairs(num) do
local n = k
local func = v
if(type(v) == 'number') then
n = v
func = globalfunc
end
addManagerFrame(self, mode, n, func)
end
elseif(type(num) == 'number') then
lib.RegisterCallback(self, format("%s-%i", mode, num), globalfunc)
end
end
function lib:RegisterOpen(num, func)
if(not num) then return end
if(not lib['managerframe']:IsEventRegistered("PLAYER_INTERACTION_MANAGER_FRAME_SHOW")) then
lib['managerframe']:RegisterEvent("PLAYER_INTERACTION_MANAGER_FRAME_SHOW")
lib['managerframe']:SetScript("OnEvent", handleManagerFrame)
end
addManagerFrame(self, 'show', num, func)
end
function lib:RegisterClose(num, func)
if(not num) then return end
if(not lib['managerframe']:IsEventRegistered("PLAYER_INTERACTION_MANAGER_FRAME_HIDE")) then
lib['managerframe']:RegisterEvent("PLAYER_INTERACTION_MANAGER_FRAME_HIDE")
lib['managerframe']:SetScript("OnEvent", handleManagerFrame)
end
addManagerFrame(self, 'hide', num, func)
end
function lib:NewAddOn(addonName, addonTable)
local specs = self['specs']
local childName = specs['name']

View File

@ -1,4 +1,4 @@
local lib = LibStub:NewLibrary("zzHelper", 3)
local lib = LibStub:NewLibrary("zzHelper", 4)
if not lib then return end
lib['targets'] = lib['targets'] or {}
local mixins = {'colorize', 'round', 'sortArray', 'IsTwink', 'classcolor', 'MoneyString', 'MoneyStringSetString', 'MoneyStringSetSize'}
@ -34,7 +34,7 @@ function lib:MoneyStringSetSize(size)
iconSize = size
end
end
function lib:MoneyString(money, color, abrevK, abrevM, noicon, noiconcolor, size)
function lib:MoneyString(money, color, abrevK, abrevM, noicon, noiconcolor, size, seperate)
local iconSize = size or iconSize
local goldicon = noicon and (noiconcolor and moneyText['goldColor'] or moneyText['gold']) or format(iconbase, 'Gold', iconSize, iconSize)
local silvericon = noicon and (noiconcolor and moneyText['silverColor'] or moneyText['silver']) or format(iconbase, 'Silver', iconSize, iconSize)
@ -66,6 +66,9 @@ function lib:MoneyString(money, color, abrevK, abrevM, noicon, noiconcolor, size
end
if(money > 0) then
if(g>0) then
if(seperate) then
g = BreakUpLargeNumbers(g)
end
moneystring = format("%s%s%s", color and lib:colorize(g, neg and "ff0000" or "44dd44") or g,abrev, goldicon)
end
if(s>0) then

View File

@ -1,4 +1,4 @@
local lib = LibStub:NewLibrary("zzLDB", 4)
local lib = LibStub:NewLibrary("zzLDB", 6)
if not lib then return end
local ldb = LibStub:GetLibrary("LibDataBroker-1.1")
local ldbicon = LibStub:GetLibrary("LibDBIcon-1.0")
@ -22,11 +22,22 @@ function lib:DefaultOnClick(_, button, addon, childName)
end
end
else
if(InterfaceOptionsFrame:IsVisible() and not InCombatLockdown()) then
InterfaceOptionsFrame:Hide()
else
InterfaceOptionsFrame_OpenToCategory(childName)
InterfaceOptionsFrame_OpenToCategory(childName) -- Twice because of a bug in InterfaceOptionsFrame_OpenToCategory
if(not InCombatLockdown()) then
if(SettingsPanel) then
if(SettingsPanel:IsVisible()) then
HideUIPanel(SettingsPanel)
HideUIPanel(GameMenuFrame)
else
Settings.OpenToCategory(childName)
end
elseif(InterfaceOptionsFrame) then
if(InterfaceOptionsFrame:IsVisible()) then
InterfaceOptionsFrame:Hide()
else
InterfaceOptionsFrame_OpenToCategory(childName)
InterfaceOptionsFrame_OpenToCategory(childName) -- Twice because of a bug in InterfaceOptionsFrame_OpenToCategory
end
end
end
end
end