From 6912cf40be57c1a2637c9ff1e21ee2599d2bfa47 Mon Sep 17 00:00:00 2001 From: BreakBB Date: Thu, 12 Dec 2024 15:43:58 +0100 Subject: [PATCH] [fix] Update Ace Related to #327 --- Libs/AceConfig-3.0/AceConfig-3.0.lua | 4 +- .../AceConfigDialog-3.0.lua | 20 +++- .../AceConfigRegistry-3.0.lua | 5 +- .../widgets/AceGUIContainer-TreeGroup.lua | 10 +- .../widgets/AceGUIWidget-ColorPicker.lua | 92 ++++++++++++++----- .../widgets/AceGUIWidget-EditBox.lua | 12 ++- .../widgets/AceGUIWidget-MultiLineEditBox.lua | 12 ++- .../CallbackHandler-1.0.lua | 32 +++---- .../CallbackHandler-1.0.xml | 2 +- Libs/LibStub/LibStub.lua | 37 ++------ 10 files changed, 130 insertions(+), 96 deletions(-) diff --git a/Libs/AceConfig-3.0/AceConfig-3.0.lua b/Libs/AceConfig-3.0/AceConfig-3.0.lua index 5071cdc..ab91c9e 100755 --- a/Libs/AceConfig-3.0/AceConfig-3.0.lua +++ b/Libs/AceConfig-3.0/AceConfig-3.0.lua @@ -3,7 +3,7 @@ -- as well as associate it with a slash command. -- @class file -- @name AceConfig-3.0 --- @release $Id: AceConfig-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $ +-- @release $Id: AceConfig-3.0.lua 1335 2024-05-05 19:35:16Z nevcairiel $ --[[ AceConfig-3.0 @@ -27,7 +27,7 @@ if not AceConfig then return end local pcall, error, type, pairs = pcall, error, type, pairs -- ------------------------------------------------------------------- --- :RegisterOptionsTable(appName, options, slashcmd, persist) +-- :RegisterOptionsTable(appName, options, slashcmd) -- -- - appName - (string) application name -- - options - table or function ref, see AceConfigRegistry diff --git a/Libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua b/Libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua index 4649c73..9400465 100755 --- a/Libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua +++ b/Libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua @@ -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 1351 2024-07-24 18:23:24Z funkehdude $ 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", 87 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) @@ -535,6 +544,7 @@ local function GetFuncName(option) end end do + local InCombatLockdown = InCombatLockdown local frame = AceConfigDialog.popup if not frame or oldminor < 81 then frame = CreateFrame("Frame", nil, UIParent) @@ -547,13 +557,15 @@ do frame:SetFrameLevel(100) -- Lots of room to draw under it frame:SetScript("OnKeyDown", function(self, key) if key == "ESCAPE" then - self:SetPropagateKeyboardInput(false) + if not InCombatLockdown() then + self:SetPropagateKeyboardInput(false) + end if self.cancel:IsShown() then self.cancel:Click() else -- Showing a validation error self:Hide() end - else + elseif not InCombatLockdown() then self:SetPropagateKeyboardInput(true) end end) diff --git a/Libs/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua b/Libs/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua index f8d9225..e0f5962 100755 --- a/Libs/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua +++ b/Libs/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua @@ -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, diff --git a/Libs/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua b/Libs/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua index 89f387a..7900937 100755 --- a/Libs/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua +++ b/Libs/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua @@ -2,7 +2,7 @@ TreeGroup Container Container that uses a tree control to switch between groups. -------------------------------------------------------------------------------]] -local Type, Version = "TreeGroup", 47 +local Type, Version = "TreeGroup", 48 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -387,10 +387,6 @@ local methods = { ["RefreshTree"] = function(self,scrollToSelection,fromOnUpdate) local buttons = self.buttons local lines = self.lines - - for i, v in ipairs(buttons) do - v:Hide() - end while lines[1] do local t = tremove(lines) for k in pairs(t) do @@ -499,6 +495,10 @@ local methods = { buttonnum = buttonnum + 1 end + -- We hide the remaining buttons after updating others to avoid a blizzard bug that keeps them interactable even if hidden when hidden before updating the buttons. + for i = buttonnum, #buttons do + buttons[i]:Hide() + end end, ["SetSelected"] = function(self, value) diff --git a/Libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua b/Libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua index d57b008..ec811d0 100755 --- a/Libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua +++ b/Libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua @@ -1,7 +1,7 @@ --[[----------------------------------------------------------------------------- ColorPicker Widget -------------------------------------------------------------------------------]] -local Type, Version = "ColorPicker", 25 +local Type, Version = "ColorPicker", 28 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -11,13 +11,24 @@ local pairs = pairs -- WoW APIs local CreateFrame, UIParent = CreateFrame, UIParent +-- Unfortunately we have no way to realistically detect if a client uses inverted alpha +-- as no API will tell you. Wrath uses the old colorpicker, era uses the new one, both are inverted +local INVERTED_ALPHA = (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE) + --[[----------------------------------------------------------------------------- Support functions -------------------------------------------------------------------------------]] local function ColorCallback(self, r, g, b, a, isAlpha) + if INVERTED_ALPHA and a then + a = 1 - a + end if not self.HasAlpha then a = 1 end + -- no change, skip update + if r == self.r and g == self.g and b == self.b and a == self.a then + return + end self:SetColor(r, g, b, a) if ColorPickerFrame:IsVisible() then --colorpicker is still open @@ -50,30 +61,63 @@ local function ColorSwatch_OnClick(frame) ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10) ColorPickerFrame:SetClampedToScreen(true) - ColorPickerFrame.func = function() - local r, g, b = ColorPickerFrame:GetColorRGB() - local a = 1 - OpacitySliderFrame:GetValue() - ColorCallback(self, r, g, b, a) - end - - ColorPickerFrame.hasOpacity = self.HasAlpha - ColorPickerFrame.opacityFunc = function() - local r, g, b = ColorPickerFrame:GetColorRGB() - local a = 1 - OpacitySliderFrame:GetValue() - ColorCallback(self, r, g, b, a, true) - end - - local r, g, b, a = self.r, self.g, self.b, self.a - if self.HasAlpha then - ColorPickerFrame.opacity = 1 - (a or 0) - end - ColorPickerFrame:SetColorRGB(r, g, b) - - ColorPickerFrame.cancelFunc = function() - ColorCallback(self, r, g, b, a, true) + if ColorPickerFrame.SetupColorPickerAndShow then -- 10.2.5 color picker overhaul + local r2, g2, b2, a2 = self.r, self.g, self.b, (self.a or 1) + if INVERTED_ALPHA then + a2 = 1 - a2 + end + + local info = { + swatchFunc = function() + local r, g, b = ColorPickerFrame:GetColorRGB() + local a = ColorPickerFrame:GetColorAlpha() + ColorCallback(self, r, g, b, a) + end, + + hasOpacity = self.HasAlpha, + opacityFunc = function() + local r, g, b = ColorPickerFrame:GetColorRGB() + local a = ColorPickerFrame:GetColorAlpha() + ColorCallback(self, r, g, b, a, true) + end, + opacity = a2, + + cancelFunc = function() + ColorCallback(self, r2, g2, b2, a2, true) + end, + + r = r2, + g = g2, + b = b2, + } + + ColorPickerFrame:SetupColorPickerAndShow(info) + else + ColorPickerFrame.func = function() + local r, g, b = ColorPickerFrame:GetColorRGB() + local a = OpacitySliderFrame:GetValue() + ColorCallback(self, r, g, b, a) + end + + ColorPickerFrame.hasOpacity = self.HasAlpha + ColorPickerFrame.opacityFunc = function() + local r, g, b = ColorPickerFrame:GetColorRGB() + local a = OpacitySliderFrame:GetValue() + ColorCallback(self, r, g, b, a, true) + end + + local r, g, b, a = self.r, self.g, self.b, 1 - (self.a or 1) + if self.HasAlpha then + ColorPickerFrame.opacity = a + end + ColorPickerFrame:SetColorRGB(r, g, b) + + ColorPickerFrame.cancelFunc = function() + ColorCallback(self, r, g, b, a, true) + end + + ColorPickerFrame:Show() end - - ColorPickerFrame:Show() end AceGUI:ClearFocus() end diff --git a/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua b/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua index bb1e4fd..f2a238b 100755 --- a/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua +++ b/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua @@ -1,7 +1,7 @@ --[[----------------------------------------------------------------------------- EditBox Widget -------------------------------------------------------------------------------]] -local Type, Version = "EditBox", 28 +local Type, Version = "EditBox", 29 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -10,7 +10,7 @@ local tostring, pairs = tostring, pairs -- WoW APIs local PlaySound = PlaySound -local GetCursorInfo, ClearCursor, GetSpellInfo = GetCursorInfo, ClearCursor, GetSpellInfo +local GetCursorInfo, ClearCursor = GetCursorInfo, ClearCursor local CreateFrame, UIParent = CreateFrame, UIParent local _G = _G @@ -76,12 +76,16 @@ end local function EditBox_OnReceiveDrag(frame) local self = frame.obj - local type, id, info = GetCursorInfo() + local type, id, info, extra = GetCursorInfo() local name if type == "item" then name = info elseif type == "spell" then - name = GetSpellInfo(id, info) + if C_Spell and C_Spell.GetSpellName then + name = C_Spell.GetSpellName(extra) + else + name = GetSpellInfo(id, info) + end elseif type == "macro" then name = GetMacroInfo(id) end diff --git a/Libs/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua b/Libs/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua index bacb2be..f0095b5 100755 --- a/Libs/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua +++ b/Libs/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua @@ -1,4 +1,4 @@ -local Type, Version = "MultiLineEditBox", 32 +local Type, Version = "MultiLineEditBox", 33 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -6,7 +6,7 @@ if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end local pairs = pairs -- WoW APIs -local GetCursorInfo, GetSpellInfo, ClearCursor = GetCursorInfo, GetSpellInfo, ClearCursor +local GetCursorInfo, ClearCursor = GetCursorInfo, ClearCursor local CreateFrame, UIParent = CreateFrame, UIParent local _G = _G @@ -100,9 +100,13 @@ local function OnMouseUp(self) end local function OnReceiveDrag(self) -- EditBox / ScrollFrame - local type, id, info = GetCursorInfo() + local type, id, info, extra = GetCursorInfo() if type == "spell" then - info = GetSpellInfo(id, info) + if C_Spell and C_Spell.GetSpellName then + info = C_Spell.GetSpellName(extra) + else + info = GetSpellInfo(id, info) + end elseif type ~= "item" then return end diff --git a/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua b/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua index 39e265d..6b32193 100755 --- a/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua +++ b/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua @@ -1,5 +1,5 @@ ---[[ $Id: CallbackHandler-1.0.lua 22 2018-07-21 14:17:22Z nevcairiel $ ]] -local MAJOR, MINOR = "CallbackHandler-1.0", 7 +--[[ $Id: CallbackHandler-1.0.lua 1298 2022-12-12 15:10:10Z nevcairiel $ ]] +local MAJOR, MINOR = "CallbackHandler-1.0", 8 local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR) if not CallbackHandler then return end -- No upgrade needed @@ -7,26 +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 tconcat = table.concat -local assert, error, loadstring = assert, error, loadstring -local setmetatable, rawset, rawget = setmetatable, rawset, rawget +local securecallfunction, error = securecallfunction, error +local setmetatable, rawget = setmetatable, rawget local next, select, pairs, type, tostring = next, select, pairs, type, tostring --- Global vars/functions that we don't upvalue since they might get hooked, or upgraded --- List them here for Mikk's FindGlobals script --- GLOBALS: geterrorhandler - -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 @@ -39,7 +29,7 @@ end -- UnregisterName - name of the callback unregistration API, default "UnregisterCallback" -- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API. -function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName) +function CallbackHandler.New(_self, target, RegisterName, UnregisterName, UnregisterAllName) RegisterName = RegisterName or "RegisterCallback" UnregisterName = UnregisterName or "UnregisterCallback" @@ -67,13 +57,13 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll if registry.insertQueue and oldrecurse==0 then -- Something in one of our callbacks wanted to register more callbacks; they got queued - for eventname,callbacks in pairs(registry.insertQueue) do - local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten. - for self,func in pairs(callbacks) do - events[eventname][self] = func + for event,callbacks in pairs(registry.insertQueue) do + local first = not rawget(events, event) or not next(events[event]) -- test for empty before. not test for one member after. that one member may have been overwritten. + for object,func in pairs(callbacks) do + events[event][object] = func -- fire OnUsed callback? if first and registry.OnUsed then - registry.OnUsed(registry, target, eventname) + registry.OnUsed(registry, target, event) first = nil end end diff --git a/Libs/CallbackHandler-1.0/CallbackHandler-1.0.xml b/Libs/CallbackHandler-1.0/CallbackHandler-1.0.xml index 876df83..c107f88 100755 --- a/Libs/CallbackHandler-1.0/CallbackHandler-1.0.xml +++ b/Libs/CallbackHandler-1.0/CallbackHandler-1.0.xml @@ -1,4 +1,4 @@