chore(libs): sync Ace3 to coa-ace3 d422ad3
Aligns the unsuffixed Ace bundle with the rest of the Exiles forks (the -ElvUI namespaced copies are intentionally left alone to keep ElvUI's config UI isolated from any other addon's LibStub registrations). Per-library MINOR moves: CallbackHandler-1.0 6 → 8 AceAddon-3.0 12 → 13 AceTimer-3.0 1017 → 17 (canonical numbering — same C_Timer impl) AceHook-3.0 8 → 9 AceDB-3.0 27 → 33 AceDBOptions-3.0 15 → 15 (unchanged) AceComm-3.0 12 → 14 AceSerializer-3.0 3 → 5 Other Ace libs (Event, Config family, GUI, Locale, Console, Bucket) were already at the canonical target.
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
-- @name AceAddon-3.0.lua
|
||||
-- @release $Id$
|
||||
|
||||
local MAJOR, MINOR = "AceAddon-3.0", 12
|
||||
local MAJOR, MINOR = "AceAddon-3.0", 13
|
||||
local AceAddon, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceAddon then return end -- No Upgrade needed.
|
||||
@@ -49,10 +49,6 @@ local select, pairs, next, type, unpack = select, pairs, next, type, unpack
|
||||
local loadstring, assert, error = loadstring, assert, error
|
||||
local setmetatable, getmetatable, rawset, rawget = setmetatable, getmetatable, rawset, rawget
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: LibStub, IsLoggedIn, geterrorhandler
|
||||
|
||||
--[[
|
||||
xpcall safecall implementation
|
||||
]]
|
||||
@@ -62,43 +58,12 @@ local function errorhandler(err)
|
||||
return geterrorhandler()(err)
|
||||
end
|
||||
|
||||
local function CreateDispatcher(argCount)
|
||||
local code = [[
|
||||
local xpcall, eh = ...
|
||||
local method, ARGS
|
||||
local function call() return method(ARGS) end
|
||||
|
||||
local function dispatch(func, ...)
|
||||
method = func
|
||||
if not method then return end
|
||||
ARGS = ...
|
||||
return xpcall(call, eh)
|
||||
end
|
||||
|
||||
return dispatch
|
||||
]]
|
||||
|
||||
local ARGS = {}
|
||||
for i = 1, argCount do ARGS[i] = "arg"..i end
|
||||
code = code:gsub("ARGS", tconcat(ARGS, ", "))
|
||||
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(xpcall, errorhandler)
|
||||
end
|
||||
|
||||
local Dispatchers = setmetatable({}, {__index=function(self, argCount)
|
||||
local dispatcher = CreateDispatcher(argCount)
|
||||
rawset(self, argCount, dispatcher)
|
||||
return dispatcher
|
||||
end})
|
||||
Dispatchers[0] = function(func)
|
||||
return xpcall(func, errorhandler)
|
||||
end
|
||||
|
||||
local function safecall(func, ...)
|
||||
-- we check to see if the func is passed is actually a function here and don't error when it isn't
|
||||
-- this safecall is used for optional functions like OnInitialize OnEnable etc. When they are not
|
||||
-- present execution should continue without hinderance
|
||||
if type(func) == "function" then
|
||||
return Dispatchers[select('#', ...)](func, ...)
|
||||
return xpcall(func, errorhandler, ...)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -632,10 +597,20 @@ function AceAddon:IterateAddonStatus() return pairs(self.statuses) end
|
||||
function AceAddon:IterateEmbedsOnAddon(addon) return pairs(self.embeds[addon]) end
|
||||
function AceAddon:IterateModulesOfAddon(addon) return pairs(addon.modules) end
|
||||
|
||||
-- Blizzard AddOns which can load very early in the loading process and mess with Ace3 addon loading
|
||||
local BlizzardEarlyLoadAddons = {
|
||||
Blizzard_DebugTools = true,
|
||||
Blizzard_TimeManager = true,
|
||||
Blizzard_BattlefieldMap = true,
|
||||
Blizzard_MapCanvas = true,
|
||||
Blizzard_SharedMapDataProviders = true,
|
||||
Blizzard_CombatLog = true,
|
||||
}
|
||||
|
||||
-- Event Handling
|
||||
local function onEvent(this, event, arg1)
|
||||
-- 2011-08-17 nevcairiel - ignore the load event of Blizzard_DebugTools, so a potential startup error isn't swallowed up
|
||||
if (event == "ADDON_LOADED" and arg1 ~= "Blizzard_DebugTools") or event == "PLAYER_LOGIN" then
|
||||
-- 2020-08-28 nevcairiel - ignore the load event of Blizzard addons which occur early in the loading process
|
||||
if (event == "ADDON_LOADED" and (arg1 == nil or not BlizzardEarlyLoadAddons[arg1])) or event == "PLAYER_LOGIN" then
|
||||
-- if a addon loads another addon, recursion could happen here, so we need to validate the table on every iteration
|
||||
while(#AceAddon.initializequeue > 0) do
|
||||
local addon = tremove(AceAddon.initializequeue, 1)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
-- end
|
||||
-- @class file
|
||||
-- @name AceBucket-3.0.lua
|
||||
-- @release $Id: AceBucket-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
|
||||
-- @release $Id$
|
||||
|
||||
local MAJOR, MINOR = "AceBucket-3.0", 4
|
||||
local AceBucket, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
@@ -53,16 +53,12 @@ local type, next, pairs, select = type, next, pairs, select
|
||||
local tonumber, tostring, rawset = tonumber, tostring, rawset
|
||||
local assert, loadstring, error = assert, loadstring, error
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: LibStub, geterrorhandler
|
||||
|
||||
local bucketCache = setmetatable({}, {__mode='k'})
|
||||
|
||||
--[[
|
||||
pcall safecall implementation
|
||||
xpcall safecall implementation
|
||||
]]
|
||||
local pcall = pcall
|
||||
local xpcall = xpcall
|
||||
|
||||
local function errorhandler(err)
|
||||
return geterrorhandler()(err)
|
||||
@@ -70,13 +66,7 @@ end
|
||||
|
||||
local function safecall(func, ...)
|
||||
if func then
|
||||
local ok, err = pcall(func, ...)
|
||||
if ok then
|
||||
return true
|
||||
else
|
||||
errorhandler(err)
|
||||
return false
|
||||
end
|
||||
return xpcall(func, errorhandler, ...)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Script file="AceBucket-3.0.lua"/>
|
||||
</Ui>
|
||||
</Ui>
|
||||
@@ -20,7 +20,7 @@ TODO: Time out old data rotting around from dead senders? Not a HUGE deal since
|
||||
local CallbackHandler = LibStub("CallbackHandler-1.0")
|
||||
local CTL = assert(ChatThrottleLib, "AceComm-3.0 requires ChatThrottleLib")
|
||||
|
||||
local MAJOR, MINOR = "AceComm-3.0", 12
|
||||
local MAJOR, MINOR = "AceComm-3.0", 14
|
||||
local AceComm,oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceComm then return end
|
||||
@@ -28,12 +28,12 @@ if not AceComm then return end
|
||||
-- Lua APIs
|
||||
local type, next, pairs, tostring = type, next, pairs, tostring
|
||||
local strsub, strfind = string.sub, string.find
|
||||
local match = string.match
|
||||
local tinsert, tconcat = table.insert, table.concat
|
||||
local error, assert = error, assert
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: LibStub, DEFAULT_CHAT_FRAME, geterrorhandler
|
||||
-- WoW APIs
|
||||
local Ambiguate = Ambiguate
|
||||
|
||||
AceComm.embeds = AceComm.embeds or {}
|
||||
|
||||
@@ -41,21 +41,32 @@ AceComm.embeds = AceComm.embeds or {}
|
||||
local MSG_MULTI_FIRST = "\001"
|
||||
local MSG_MULTI_NEXT = "\002"
|
||||
local MSG_MULTI_LAST = "\003"
|
||||
local MSG_ESCAPE = "\004"
|
||||
|
||||
AceComm.multipart_origprefixes = AceComm.multipart_origprefixes or {} -- e.g. "Prefix\001"="Prefix", "Prefix\002"="Prefix"
|
||||
AceComm.multipart_reassemblers = AceComm.multipart_reassemblers or {} -- e.g. "Prefix\001"="OnReceiveMultipartFirst"
|
||||
-- remove old structures (pre WoW 4.0)
|
||||
AceComm.multipart_origprefixes = nil
|
||||
AceComm.multipart_reassemblers = nil
|
||||
|
||||
-- the multipart message spool: indexed by a combination of sender+distribution+
|
||||
AceComm.multipart_spool = AceComm.multipart_spool or {}
|
||||
|
||||
--- Register for Addon Traffic on a specified prefix
|
||||
-- @param prefix A printable character (\032-\255) classification of the message (typically AddonName or AddonNameEvent)
|
||||
-- @param prefix A printable character (\032-\255) classification of the message (typically AddonName or AddonNameEvent), max 16 characters
|
||||
-- @param method Callback to call on message reception: Function reference, or method name (string) to call on self. Defaults to "OnCommReceived"
|
||||
function AceComm:RegisterComm(prefix, method)
|
||||
if method == nil then
|
||||
method = "OnCommReceived"
|
||||
end
|
||||
|
||||
if #prefix > 16 then -- TODO: 15?
|
||||
error("AceComm:RegisterComm(prefix,method): prefix length is limited to 16 characters")
|
||||
end
|
||||
if C_ChatInfo then
|
||||
C_ChatInfo.RegisterAddonMessagePrefix(prefix)
|
||||
else
|
||||
RegisterAddonMessagePrefix(prefix)
|
||||
end
|
||||
|
||||
return AceComm._RegisterComm(self, prefix, method) -- created by CallbackHandler
|
||||
end
|
||||
|
||||
@@ -80,51 +91,49 @@ function AceComm:SendCommMessage(prefix, text, distribution, target, prio, callb
|
||||
error('Usage: SendCommMessage(addon, "prefix", "text", "distribution"[, "target"[, "prio"[, callbackFn, callbackarg]]])', 2)
|
||||
end
|
||||
|
||||
if strfind(prefix, "[\001-\009]") then
|
||||
if strfind(prefix, "[\001-\003]") then
|
||||
error("SendCommMessage: Characters \\001--\\003 in prefix are reserved for AceComm metadata", 2)
|
||||
elseif not warnedPrefix then
|
||||
-- I have some ideas about future extensions that require more control characters /mikk, 20090808
|
||||
geterrorhandler()("SendCommMessage: Heads-up developers: Characters \\004--\\009 in prefix are reserved for AceComm future extension")
|
||||
warnedPrefix = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local textlen = #text
|
||||
local maxtextlen = 254 - #prefix -- 254 is the max length of prefix + text that can be sent in one message
|
||||
local queueName = prefix..distribution..(target or "")
|
||||
local maxtextlen = 255 -- Yes, the max is 255 even if the dev post said 256. I tested. Char 256+ get silently truncated. /Mikk, 20110327
|
||||
local queueName = prefix
|
||||
|
||||
local ctlCallback = nil
|
||||
if callbackFn then
|
||||
ctlCallback = function(sent)
|
||||
return callbackFn(callbackArg, sent, textlen)
|
||||
ctlCallback = function(sent, sendResult)
|
||||
return callbackFn(callbackArg, sent, textlen, sendResult)
|
||||
end
|
||||
end
|
||||
|
||||
if textlen <= maxtextlen then
|
||||
local forceMultipart
|
||||
if match(text, "^[\001-\009]") then -- 4.1+: see if the first character is a control character
|
||||
-- we need to escape the first character with a \004
|
||||
if textlen+1 > maxtextlen then -- would we go over the size limit?
|
||||
forceMultipart = true -- just make it multipart, no escape problems then
|
||||
else
|
||||
text = "\004" .. text
|
||||
end
|
||||
end
|
||||
|
||||
if not forceMultipart and textlen <= maxtextlen then
|
||||
-- fits all in one message
|
||||
CTL:SendAddonMessage(prio, prefix, text, distribution, target, queueName, ctlCallback, textlen)
|
||||
else
|
||||
maxtextlen = maxtextlen - 1 -- 1 extra byte for part indicator in prefix
|
||||
maxtextlen = maxtextlen - 1 -- 1 extra byte for part indicator in prefix(4.0)/start of message(4.1)
|
||||
|
||||
-- first part
|
||||
local chunk = strsub(text, 1, maxtextlen)
|
||||
CTL:SendAddonMessage(prio, prefix..MSG_MULTI_FIRST, chunk, distribution, target, queueName, ctlCallback, maxtextlen)
|
||||
CTL:SendAddonMessage(prio, prefix, MSG_MULTI_FIRST..chunk, distribution, target, queueName, ctlCallback, maxtextlen)
|
||||
|
||||
-- continuation
|
||||
local pos = 1+maxtextlen
|
||||
local prefix2 = prefix..MSG_MULTI_NEXT
|
||||
|
||||
while pos+maxtextlen <= textlen do
|
||||
chunk = strsub(text, pos, pos+maxtextlen-1)
|
||||
CTL:SendAddonMessage(prio, prefix2, chunk, distribution, target, queueName, ctlCallback, pos+maxtextlen-1)
|
||||
CTL:SendAddonMessage(prio, prefix, MSG_MULTI_NEXT..chunk, distribution, target, queueName, ctlCallback, pos+maxtextlen-1)
|
||||
pos = pos + maxtextlen
|
||||
end
|
||||
|
||||
-- final part
|
||||
chunk = strsub(text, pos)
|
||||
CTL:SendAddonMessage(prio, prefix..MSG_MULTI_LAST, chunk, distribution, target, queueName, ctlCallback, textlen)
|
||||
CTL:SendAddonMessage(prio, prefix, MSG_MULTI_LAST..chunk, distribution, target, queueName, ctlCallback, textlen)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -221,47 +230,31 @@ end
|
||||
----------------------------------------
|
||||
|
||||
if not AceComm.callbacks then
|
||||
-- ensure that 'prefix to watch' table is consistent with registered
|
||||
-- callbacks
|
||||
AceComm.__prefixes = {}
|
||||
|
||||
AceComm.callbacks = CallbackHandler:New(AceComm,
|
||||
"_RegisterComm",
|
||||
"UnregisterComm",
|
||||
"UnregisterAllComm")
|
||||
end
|
||||
|
||||
function AceComm.callbacks:OnUsed(target, prefix)
|
||||
AceComm.multipart_origprefixes[prefix..MSG_MULTI_FIRST] = prefix
|
||||
AceComm.multipart_reassemblers[prefix..MSG_MULTI_FIRST] = "OnReceiveMultipartFirst"
|
||||
AceComm.callbacks.OnUsed = nil
|
||||
AceComm.callbacks.OnUnused = nil
|
||||
|
||||
AceComm.multipart_origprefixes[prefix..MSG_MULTI_NEXT] = prefix
|
||||
AceComm.multipart_reassemblers[prefix..MSG_MULTI_NEXT] = "OnReceiveMultipartNext"
|
||||
|
||||
AceComm.multipart_origprefixes[prefix..MSG_MULTI_LAST] = prefix
|
||||
AceComm.multipart_reassemblers[prefix..MSG_MULTI_LAST] = "OnReceiveMultipartLast"
|
||||
end
|
||||
|
||||
function AceComm.callbacks:OnUnused(target, prefix)
|
||||
AceComm.multipart_origprefixes[prefix..MSG_MULTI_FIRST] = nil
|
||||
AceComm.multipart_reassemblers[prefix..MSG_MULTI_FIRST] = nil
|
||||
|
||||
AceComm.multipart_origprefixes[prefix..MSG_MULTI_NEXT] = nil
|
||||
AceComm.multipart_reassemblers[prefix..MSG_MULTI_NEXT] = nil
|
||||
|
||||
AceComm.multipart_origprefixes[prefix..MSG_MULTI_LAST] = nil
|
||||
AceComm.multipart_reassemblers[prefix..MSG_MULTI_LAST] = nil
|
||||
end
|
||||
|
||||
local function OnEvent(this, event, ...)
|
||||
local function OnEvent(self, event, prefix, message, distribution, sender)
|
||||
if event == "CHAT_MSG_ADDON" then
|
||||
local prefix,message,distribution,sender = ...
|
||||
local reassemblername = AceComm.multipart_reassemblers[prefix]
|
||||
if reassemblername then
|
||||
-- multipart: reassemble
|
||||
local aceCommReassemblerFunc = AceComm[reassemblername]
|
||||
local origprefix = AceComm.multipart_origprefixes[prefix]
|
||||
aceCommReassemblerFunc(AceComm, origprefix, message, distribution, sender)
|
||||
sender = Ambiguate(sender, "none")
|
||||
local control, rest = match(message, "^([\001-\009])(.*)")
|
||||
if control then
|
||||
if control==MSG_MULTI_FIRST then
|
||||
AceComm:OnReceiveMultipartFirst(prefix, rest, distribution, sender)
|
||||
elseif control==MSG_MULTI_NEXT then
|
||||
AceComm:OnReceiveMultipartNext(prefix, rest, distribution, sender)
|
||||
elseif control==MSG_MULTI_LAST then
|
||||
AceComm:OnReceiveMultipartLast(prefix, rest, distribution, sender)
|
||||
elseif control==MSG_ESCAPE then
|
||||
AceComm.callbacks:Fire(prefix, rest, distribution, sender)
|
||||
else
|
||||
-- unknown control character, ignore SILENTLY (dont warn unnecessarily about future extensions!)
|
||||
end
|
||||
else
|
||||
-- single part: fire it off immediately and let CallbackHandler decide if it's registered or not
|
||||
AceComm.callbacks:Fire(prefix, message, distribution, sender)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
-- LICENSE: ChatThrottleLib is released into the Public Domain
|
||||
--
|
||||
|
||||
local CTL_VERSION = 24
|
||||
local CTL_VERSION = 31
|
||||
|
||||
local _G = _G
|
||||
|
||||
@@ -74,9 +74,7 @@ local math_max = math.max
|
||||
local next = next
|
||||
local strlen = string.len
|
||||
local GetFramerate = GetFramerate
|
||||
local strlower = string.lower
|
||||
local unpack,type,pairs,wipe = unpack,type,pairs,wipe
|
||||
local UnitInRaid,GetNumPartyMembers = UnitInRaid,GetNumPartyMembers
|
||||
local unpack,type,pairs,wipe = unpack,type,pairs,table.wipe
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
@@ -115,6 +113,23 @@ function Ring:Remove(obj)
|
||||
end
|
||||
end
|
||||
|
||||
-- Note that this is local because there's no upgrade logic for existing ring
|
||||
-- metatables, and this isn't present on rings created in versions older than
|
||||
-- v25.
|
||||
local function Ring_Link(self, other) -- Move and append all contents of another ring to this ring
|
||||
if not self.pos then
|
||||
-- This ring is empty, so just transfer ownership.
|
||||
self.pos = other.pos
|
||||
other.pos = nil
|
||||
elseif other.pos then
|
||||
-- Our tail should point to their head, and their tail to our head.
|
||||
self.pos.prev.next, other.pos.prev.next = other.pos, self.pos
|
||||
-- Our head should point to their tail, and their head to our tail.
|
||||
self.pos.prev, other.pos.prev = other.pos.prev, self.pos.prev
|
||||
other.pos = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
@@ -179,6 +194,13 @@ function ChatThrottleLib:Init()
|
||||
self.Prio["BULK"] = { ByName = {}, Ring = Ring:New(), avail = 0 }
|
||||
end
|
||||
|
||||
if not self.BlockedQueuesDelay then
|
||||
-- v25: Add blocked queues to rings to handle new client throttles.
|
||||
for _, Prio in pairs(self.Prio) do
|
||||
Prio.Blocked = Ring:New()
|
||||
end
|
||||
end
|
||||
|
||||
-- v4: total send counters per priority
|
||||
for _, Prio in pairs(self.Prio) do
|
||||
Prio.nTotalSent = Prio.nTotalSent or 0
|
||||
@@ -201,6 +223,7 @@ function ChatThrottleLib:Init()
|
||||
self.Frame:SetScript("OnEvent", self.OnEvent) -- v11: Monitor P_E_W so we can throttle hard for a few seconds
|
||||
self.Frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
self.OnUpdateDelay = 0
|
||||
self.BlockedQueuesDelay = 0
|
||||
self.LastAvailUpdate = GetTime()
|
||||
self.HardThrottlingBeginTime = GetTime() -- v11: Throttle hard for a few seconds after startup
|
||||
|
||||
@@ -209,14 +232,43 @@ function ChatThrottleLib:Init()
|
||||
-- Use secure hooks as of v16. Old regular hook support yanked out in v21.
|
||||
self.securelyHooked = true
|
||||
--SendChatMessage
|
||||
hooksecurefunc("SendChatMessage", function(...)
|
||||
return ChatThrottleLib.Hook_SendChatMessage(...)
|
||||
end)
|
||||
if _G.C_ChatInfo and _G.C_ChatInfo.SendChatMessage then
|
||||
hooksecurefunc(_G.C_ChatInfo, "SendChatMessage", function(...)
|
||||
return ChatThrottleLib.Hook_SendChatMessage(...)
|
||||
end)
|
||||
else
|
||||
hooksecurefunc("SendChatMessage", function(...)
|
||||
return ChatThrottleLib.Hook_SendChatMessage(...)
|
||||
end)
|
||||
end
|
||||
--SendAddonMessage
|
||||
hooksecurefunc("SendAddonMessage", function(...)
|
||||
hooksecurefunc(_G.C_ChatInfo, "SendAddonMessage", function(...)
|
||||
return ChatThrottleLib.Hook_SendAddonMessage(...)
|
||||
end)
|
||||
end
|
||||
|
||||
-- v26: Hook SendAddonMessageLogged for traffic logging
|
||||
if not self.securelyHookedLogged then
|
||||
self.securelyHookedLogged = true
|
||||
hooksecurefunc(_G.C_ChatInfo, "SendAddonMessageLogged", function(...)
|
||||
return ChatThrottleLib.Hook_SendAddonMessageLogged(...)
|
||||
end)
|
||||
end
|
||||
|
||||
-- v29: Hook BNSendGameData for traffic logging
|
||||
if not self.securelyHookedBNGameData then
|
||||
self.securelyHookedBNGameData = true
|
||||
if _G.C_BattleNet and _G.C_BattleNet.SendGameData then
|
||||
hooksecurefunc(_G.C_BattleNet, "SendGameData", function(...)
|
||||
return ChatThrottleLib.Hook_BNSendGameData(...)
|
||||
end)
|
||||
else
|
||||
hooksecurefunc("BNSendGameData", function(...)
|
||||
return ChatThrottleLib.Hook_BNSendGameData(...)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
self.nBypass = 0
|
||||
end
|
||||
|
||||
@@ -245,6 +297,12 @@ function ChatThrottleLib.Hook_SendAddonMessage(prefix, text, chattype, destinati
|
||||
self.avail = self.avail - size
|
||||
self.nBypass = self.nBypass + size -- just a statistic
|
||||
end
|
||||
function ChatThrottleLib.Hook_SendAddonMessageLogged(prefix, text, chattype, destination, ...)
|
||||
ChatThrottleLib.Hook_SendAddonMessage(prefix, text, chattype, destination, ...)
|
||||
end
|
||||
function ChatThrottleLib.Hook_BNSendGameData(destination, prefix, text)
|
||||
ChatThrottleLib.Hook_SendAddonMessage(prefix, text, "WHISPER", destination)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -262,7 +320,7 @@ function ChatThrottleLib:UpdateAvail()
|
||||
-- First 5 seconds after startup/zoning: VERY hard clamping to avoid irritating the server rate limiter, it seems very cranky then
|
||||
avail = math_min(avail + (newavail*0.1), MAX_CPS*0.5)
|
||||
self.bChoking = true
|
||||
elseif GetFramerate() < self.MIN_FPS then -- GetFramerate call takes ~0.002 secs
|
||||
elseif GetFramerate() < self.MIN_FPS then -- GetFrameRate call takes ~0.002 secs
|
||||
avail = math_min(MAX_CPS, avail + newavail*0.5)
|
||||
self.bChoking = true -- just a statistic
|
||||
else
|
||||
@@ -286,38 +344,89 @@ end
|
||||
-- - ... made up of N "Pipe"s (1 for each destination/pipename)
|
||||
-- - and each pipe contains messages
|
||||
|
||||
local SendAddonMessageResult = Enum.SendAddonMessageResult or {
|
||||
Success = 0,
|
||||
AddonMessageThrottle = 3,
|
||||
NotInGroup = 5,
|
||||
ChannelThrottle = 8,
|
||||
GeneralError = 9,
|
||||
}
|
||||
|
||||
local function MapToSendResult(ok, ...)
|
||||
local result
|
||||
|
||||
if not ok then
|
||||
-- The send function itself errored; don't look at anything else.
|
||||
result = SendAddonMessageResult.GeneralError
|
||||
else
|
||||
-- Grab the last return value from the send function and remap
|
||||
-- it from a boolean to an enum code. If there are no results,
|
||||
-- assume success (true).
|
||||
|
||||
result = select(-1, true, ...)
|
||||
|
||||
if result == true then
|
||||
result = SendAddonMessageResult.Success
|
||||
elseif result == false then
|
||||
result = SendAddonMessageResult.GeneralError
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
local function IsThrottledSendResult(result)
|
||||
return result == SendAddonMessageResult.AddonMessageThrottle
|
||||
end
|
||||
|
||||
-- A copy of this function exists in FrameXML, but for clarity it's here too.
|
||||
local function CallErrorHandler(...)
|
||||
return geterrorhandler()(...)
|
||||
end
|
||||
|
||||
local function PerformSend(sendFunction, ...)
|
||||
bMyTraffic = true
|
||||
local sendResult = MapToSendResult(xpcall(sendFunction, CallErrorHandler, ...))
|
||||
bMyTraffic = false
|
||||
return sendResult
|
||||
end
|
||||
|
||||
function ChatThrottleLib:Despool(Prio)
|
||||
local ring = Prio.Ring
|
||||
while ring.pos and Prio.avail > ring.pos[1].nSize do
|
||||
local msg = table_remove(ring.pos, 1)
|
||||
if not ring.pos[1] then -- did we remove last msg in this pipe?
|
||||
local pipe = Prio.Ring.pos
|
||||
local pipe = ring.pos
|
||||
local msg = pipe[1]
|
||||
local sendResult = PerformSend(msg.f, unpack(msg, 1, msg.n))
|
||||
|
||||
if IsThrottledSendResult(sendResult) then
|
||||
-- Message was throttled; move the pipe into the blocked ring.
|
||||
Prio.Ring:Remove(pipe)
|
||||
Prio.ByName[pipe.name] = nil
|
||||
DelPipe(pipe)
|
||||
Prio.Blocked:Add(pipe)
|
||||
else
|
||||
Prio.Ring.pos = Prio.Ring.pos.next
|
||||
end
|
||||
local didSend=false
|
||||
local lowerDest = strlower(msg[3] or "")
|
||||
if lowerDest == "raid" and not UnitInRaid("player") then
|
||||
-- do nothing
|
||||
elseif lowerDest == "party" and GetNumPartyMembers() == 0 then
|
||||
-- do nothing
|
||||
else
|
||||
Prio.avail = Prio.avail - msg.nSize
|
||||
bMyTraffic = true
|
||||
msg.f(unpack(msg, 1, msg.n))
|
||||
bMyTraffic = false
|
||||
Prio.nTotalSent = Prio.nTotalSent + msg.nSize
|
||||
-- Dequeue message after submission.
|
||||
table_remove(pipe, 1)
|
||||
DelMsg(msg)
|
||||
didSend = true
|
||||
|
||||
if not pipe[1] then -- did we remove last msg in this pipe?
|
||||
Prio.Ring:Remove(pipe)
|
||||
Prio.ByName[pipe.name] = nil
|
||||
DelPipe(pipe)
|
||||
else
|
||||
ring.pos = ring.pos.next
|
||||
end
|
||||
|
||||
-- Update bandwidth counters on successful sends.
|
||||
local didSend = (sendResult == SendAddonMessageResult.Success)
|
||||
if didSend then
|
||||
Prio.avail = Prio.avail - msg.nSize
|
||||
Prio.nTotalSent = Prio.nTotalSent + msg.nSize
|
||||
end
|
||||
|
||||
-- Notify caller of message submission.
|
||||
if msg.callbackFn then
|
||||
securecallfunction(msg.callbackFn, msg.callbackArg, didSend, sendResult)
|
||||
end
|
||||
end
|
||||
-- notify caller of delivery (even if we didn't send it)
|
||||
if msg.callbackFn then
|
||||
msg.callbackFn (msg.callbackArg, didSend)
|
||||
end
|
||||
-- USER CALLBACK MAY ERROR
|
||||
end
|
||||
end
|
||||
|
||||
@@ -336,6 +445,7 @@ function ChatThrottleLib.OnUpdate(this,delay)
|
||||
local self = ChatThrottleLib
|
||||
|
||||
self.OnUpdateDelay = self.OnUpdateDelay + delay
|
||||
self.BlockedQueuesDelay = self.BlockedQueuesDelay + delay
|
||||
if self.OnUpdateDelay < 0.08 then
|
||||
return
|
||||
end
|
||||
@@ -347,40 +457,60 @@ function ChatThrottleLib.OnUpdate(this,delay)
|
||||
return -- argh. some bastard is spewing stuff past the lib. just bail early to save cpu.
|
||||
end
|
||||
|
||||
-- See how many of our priorities have queued messages (we only have 3, don't worry about the loop)
|
||||
local n = 0
|
||||
for prioname,Prio in pairs(self.Prio) do
|
||||
if Prio.Ring.pos or Prio.avail < 0 then
|
||||
n = n + 1
|
||||
-- Integrate blocked queues back into their rings periodically.
|
||||
if self.BlockedQueuesDelay >= 0.35 then
|
||||
for _, Prio in pairs(self.Prio) do
|
||||
Ring_Link(Prio.Ring, Prio.Blocked)
|
||||
end
|
||||
|
||||
self.BlockedQueuesDelay = 0
|
||||
end
|
||||
|
||||
-- Anything queued still?
|
||||
if n<1 then
|
||||
-- Nope. Move spillover bandwidth to global availability gauge and clear self.bQueueing
|
||||
for prioname, Prio in pairs(self.Prio) do
|
||||
-- See how many of our priorities have queued messages. This is split
|
||||
-- into two counters because priorities that consist only of blocked
|
||||
-- queues must keep our OnUpdate alive, but shouldn't count toward
|
||||
-- bandwidth distribution.
|
||||
local nSendablePrios = 0
|
||||
local nBlockedPrios = 0
|
||||
|
||||
for prioname, Prio in pairs(self.Prio) do
|
||||
if Prio.Ring.pos then
|
||||
nSendablePrios = nSendablePrios + 1
|
||||
elseif Prio.Blocked.pos then
|
||||
nBlockedPrios = nBlockedPrios + 1
|
||||
end
|
||||
|
||||
-- Collect unused bandwidth from priorities with nothing to send.
|
||||
if not Prio.Ring.pos then
|
||||
self.avail = self.avail + Prio.avail
|
||||
Prio.avail = 0
|
||||
end
|
||||
self.bQueueing = false
|
||||
self.Frame:Hide()
|
||||
end
|
||||
|
||||
-- Bandwidth reclamation may take us back over the burst cap.
|
||||
self.avail = math_min(self.avail, self.BURST)
|
||||
|
||||
-- If we can't currently send on any priorities, stop processing early.
|
||||
if nSendablePrios == 0 then
|
||||
-- If we're completely out of data to send, disable queue processing.
|
||||
if nBlockedPrios == 0 then
|
||||
self.bQueueing = false
|
||||
self.Frame:Hide()
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
-- There's stuff queued. Hand out available bandwidth to priorities as needed and despool their queues
|
||||
local avail = self.avail/n
|
||||
local avail = self.avail / nSendablePrios
|
||||
self.avail = 0
|
||||
|
||||
for prioname, Prio in pairs(self.Prio) do
|
||||
if Prio.Ring.pos or Prio.avail < 0 then
|
||||
if Prio.Ring.pos then
|
||||
Prio.avail = Prio.avail + avail
|
||||
if Prio.Ring.pos and Prio.avail > Prio.Ring.pos[1].nSize then
|
||||
self:Despool(Prio)
|
||||
-- Note: We might not get here if the user-supplied callback function errors out! Take care!
|
||||
end
|
||||
self:Despool(Prio)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -423,21 +553,27 @@ function ChatThrottleLib:SendChatMessage(prio, prefix, text, chattype, languag
|
||||
|
||||
-- Check if there's room in the global available bandwidth gauge to send directly
|
||||
if not self.bQueueing and nSize < self:UpdateAvail() then
|
||||
self.avail = self.avail - nSize
|
||||
bMyTraffic = true
|
||||
_G.SendChatMessage(text, chattype, language, destination)
|
||||
bMyTraffic = false
|
||||
self.Prio[prio].nTotalSent = self.Prio[prio].nTotalSent + nSize
|
||||
if callbackFn then
|
||||
callbackFn (callbackArg, true)
|
||||
local sendResult = PerformSend(_G.C_ChatInfo.SendChatMessage or _G.SendChatMessage, text, chattype, language, destination)
|
||||
|
||||
if not IsThrottledSendResult(sendResult) then
|
||||
local didSend = (sendResult == SendAddonMessageResult.Success)
|
||||
|
||||
if didSend then
|
||||
self.avail = self.avail - nSize
|
||||
self.Prio[prio].nTotalSent = self.Prio[prio].nTotalSent + nSize
|
||||
end
|
||||
|
||||
if callbackFn then
|
||||
securecallfunction(callbackFn, callbackArg, didSend, sendResult)
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
-- USER CALLBACK MAY ERROR
|
||||
return
|
||||
end
|
||||
|
||||
-- Message needs to be queued
|
||||
local msg = NewMsg()
|
||||
msg.f = _G.SendChatMessage
|
||||
msg.f = _G.C_ChatInfo.SendChatMessage or _G.SendChatMessage
|
||||
msg[1] = text
|
||||
msg[2] = chattype or "SAY"
|
||||
msg[3] = language
|
||||
@@ -447,43 +583,36 @@ function ChatThrottleLib:SendChatMessage(prio, prefix, text, chattype, languag
|
||||
msg.callbackFn = callbackFn
|
||||
msg.callbackArg = callbackArg
|
||||
|
||||
self:Enqueue(prio, queueName or (prefix..(chattype or "SAY")..(destination or "")), msg)
|
||||
self:Enqueue(prio, queueName or prefix, msg)
|
||||
end
|
||||
|
||||
|
||||
function ChatThrottleLib:SendAddonMessage(prio, prefix, text, chattype, target, queueName, callbackFn, callbackArg)
|
||||
if not self or not prio or not prefix or not text or not chattype or not self.Prio[prio] then
|
||||
error('Usage: ChatThrottleLib:SendAddonMessage("{BULK||NORMAL||ALERT}", "prefix", "text", "chattype"[, "target"])', 2)
|
||||
end
|
||||
if callbackFn and type(callbackFn)~="function" then
|
||||
error('ChatThrottleLib:SendAddonMessage(): callbackFn: expected function, got '..type(callbackFn), 2)
|
||||
end
|
||||
|
||||
local nSize = prefix:len() + 1 + text:len();
|
||||
|
||||
if nSize>255 then
|
||||
error("ChatThrottleLib:SendAddonMessage(): prefix + message length cannot exceed 254 bytes", 2)
|
||||
end
|
||||
|
||||
nSize = nSize + self.MSG_OVERHEAD;
|
||||
local function SendAddonMessageInternal(self, sendFunction, prio, prefix, text, chattype, target, queueName, callbackFn, callbackArg)
|
||||
local nSize = #text + self.MSG_OVERHEAD
|
||||
|
||||
-- Check if there's room in the global available bandwidth gauge to send directly
|
||||
if not self.bQueueing and nSize < self:UpdateAvail() then
|
||||
self.avail = self.avail - nSize
|
||||
bMyTraffic = true
|
||||
_G.SendAddonMessage(prefix, text, chattype, target)
|
||||
bMyTraffic = false
|
||||
self.Prio[prio].nTotalSent = self.Prio[prio].nTotalSent + nSize
|
||||
if callbackFn then
|
||||
callbackFn (callbackArg, true)
|
||||
local sendResult = PerformSend(sendFunction, prefix, text, chattype, target)
|
||||
|
||||
if not IsThrottledSendResult(sendResult) then
|
||||
local didSend = (sendResult == SendAddonMessageResult.Success)
|
||||
|
||||
if didSend then
|
||||
self.avail = self.avail - nSize
|
||||
self.Prio[prio].nTotalSent = self.Prio[prio].nTotalSent + nSize
|
||||
end
|
||||
|
||||
if callbackFn then
|
||||
securecallfunction(callbackFn, callbackArg, didSend, sendResult)
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
-- USER CALLBACK MAY ERROR
|
||||
return
|
||||
end
|
||||
|
||||
-- Message needs to be queued
|
||||
local msg = NewMsg()
|
||||
msg.f = _G.SendAddonMessage
|
||||
msg.f = sendFunction
|
||||
msg[1] = prefix
|
||||
msg[2] = text
|
||||
msg[3] = chattype
|
||||
@@ -493,10 +622,65 @@ function ChatThrottleLib:SendAddonMessage(prio, prefix, text, chattype, target,
|
||||
msg.callbackFn = callbackFn
|
||||
msg.callbackArg = callbackArg
|
||||
|
||||
self:Enqueue(prio, queueName or (prefix..chattype..(target or "")), msg)
|
||||
self:Enqueue(prio, queueName or prefix, msg)
|
||||
end
|
||||
|
||||
|
||||
function ChatThrottleLib:SendAddonMessage(prio, prefix, text, chattype, target, queueName, callbackFn, callbackArg)
|
||||
if not self or not prio or not prefix or not text or not chattype or not self.Prio[prio] then
|
||||
error('Usage: ChatThrottleLib:SendAddonMessage("{BULK||NORMAL||ALERT}", "prefix", "text", "chattype"[, "target"])', 2)
|
||||
elseif callbackFn and type(callbackFn)~="function" then
|
||||
error('ChatThrottleLib:SendAddonMessage(): callbackFn: expected function, got '..type(callbackFn), 2)
|
||||
elseif #text>255 then
|
||||
error("ChatThrottleLib:SendAddonMessage(): message length cannot exceed 255 bytes", 2)
|
||||
end
|
||||
|
||||
local sendFunction = _G.C_ChatInfo.SendAddonMessage
|
||||
SendAddonMessageInternal(self, sendFunction, prio, prefix, text, chattype, target, queueName, callbackFn, callbackArg)
|
||||
end
|
||||
|
||||
|
||||
function ChatThrottleLib:SendAddonMessageLogged(prio, prefix, text, chattype, target, queueName, callbackFn, callbackArg)
|
||||
if not self or not prio or not prefix or not text or not chattype or not self.Prio[prio] then
|
||||
error('Usage: ChatThrottleLib:SendAddonMessageLogged("{BULK||NORMAL||ALERT}", "prefix", "text", "chattype"[, "target"])', 2)
|
||||
elseif callbackFn and type(callbackFn)~="function" then
|
||||
error('ChatThrottleLib:SendAddonMessageLogged(): callbackFn: expected function, got '..type(callbackFn), 2)
|
||||
elseif #text>255 then
|
||||
error("ChatThrottleLib:SendAddonMessageLogged(): message length cannot exceed 255 bytes", 2)
|
||||
end
|
||||
|
||||
local sendFunction = _G.C_ChatInfo.SendAddonMessageLogged
|
||||
SendAddonMessageInternal(self, sendFunction, prio, prefix, text, chattype, target, queueName, callbackFn, callbackArg)
|
||||
end
|
||||
|
||||
local function BNSendGameDataReordered(prefix, text, _, gameAccountID)
|
||||
local bnSendFunc = _G.C_BattleNet and _G.C_BattleNet.SendGameData or _G.BNSendGameData
|
||||
return bnSendFunc(gameAccountID, prefix, text)
|
||||
end
|
||||
|
||||
function ChatThrottleLib:BNSendGameData(prio, prefix, text, chattype, gameAccountID, queueName, callbackFn, callbackArg)
|
||||
-- Note that this API is intentionally limited to 255 bytes of data
|
||||
-- for reasons of traffic fairness, which is less than the 4078 bytes
|
||||
-- BNSendGameData natively supports. Additionally, a chat type is required
|
||||
-- but must always be set to 'WHISPER' to match what is exposed by the
|
||||
-- receipt event.
|
||||
--
|
||||
-- If splitting messages, callers must also be aware that message
|
||||
-- delivery over BNSendGameData is unordered.
|
||||
|
||||
if not self or not prio or not prefix or not text or not gameAccountID or not chattype or not self.Prio[prio] then
|
||||
error('Usage: ChatThrottleLib:BNSendGameData("{BULK||NORMAL||ALERT}", "prefix", "text", "chattype", gameAccountID)', 2)
|
||||
elseif callbackFn and type(callbackFn)~="function" then
|
||||
error('ChatThrottleLib:BNSendGameData(): callbackFn: expected function, got '..type(callbackFn), 2)
|
||||
elseif #text>255 then
|
||||
error("ChatThrottleLib:BNSendGameData(): message length cannot exceed 255 bytes", 2)
|
||||
elseif chattype ~= "WHISPER" then
|
||||
error("ChatThrottleLib:BNSendGameData(): chat type must be 'WHISPER'", 2)
|
||||
end
|
||||
|
||||
local sendFunction = BNSendGameDataReordered
|
||||
SendAddonMessageInternal(self, sendFunction, prio, prefix, text, chattype, gameAccountID, queueName, callbackFn, callbackArg)
|
||||
end
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
@@ -29,10 +29,6 @@ local max = math.max
|
||||
-- WoW APIs
|
||||
local _G = _G
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: DEFAULT_CHAT_FRAME, SlashCmdList, hash_SlashCmdList
|
||||
|
||||
local tmp={}
|
||||
local function Print(self,frame,...)
|
||||
local n=0
|
||||
@@ -174,7 +170,7 @@ function AceConsole:GetArgs(str, numargs, startpos)
|
||||
|
||||
while true do
|
||||
-- find delimiter or hyperlink
|
||||
local ch,_
|
||||
local _
|
||||
pos,_,ch = strfind(str, delim_or_pipe, pos)
|
||||
|
||||
if not pos then break end
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
-- @class file
|
||||
-- @name AceDB-3.0.lua
|
||||
-- @release $Id$
|
||||
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 27
|
||||
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 33
|
||||
local AceDB = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR)
|
||||
|
||||
if not AceDB then return end -- No upgrade needed
|
||||
@@ -53,10 +53,6 @@ local setmetatable, rawset, rawget = setmetatable, rawset, rawget
|
||||
-- WoW APIs
|
||||
local _G = _G
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: LibStub
|
||||
|
||||
AceDB.db_registry = AceDB.db_registry or {}
|
||||
AceDB.frame = AceDB.frame or CreateFrame("Frame")
|
||||
|
||||
@@ -98,11 +94,11 @@ local function copyDefaults(dest, src)
|
||||
-- This is a metatable used for table defaults
|
||||
local mt = {
|
||||
-- This handles the lookup and creation of new subtables
|
||||
__index = function(t,k)
|
||||
if k == nil then return nil end
|
||||
__index = function(t,k2)
|
||||
if k2 == nil then return nil end
|
||||
local tbl = {}
|
||||
copyDefaults(tbl, v)
|
||||
rawset(t, k, tbl)
|
||||
rawset(t, k2, tbl)
|
||||
return tbl
|
||||
end,
|
||||
}
|
||||
@@ -115,7 +111,7 @@ local function copyDefaults(dest, src)
|
||||
end
|
||||
else
|
||||
-- Values are not tables, so this is just a simple return
|
||||
local mt = {__index = function(t,k) return k~=nil and v or nil end}
|
||||
local mt = {__index = function(t,k2) return k2~=nil and v or nil end}
|
||||
setmetatable(dest, mt)
|
||||
end
|
||||
elseif type(v) == "table" then
|
||||
@@ -261,9 +257,12 @@ local _, classKey = UnitClass("player")
|
||||
local _, raceKey = UnitRace("player")
|
||||
local factionKey = UnitFactionGroup("player")
|
||||
local factionrealmKey = factionKey .. " - " .. realmKey
|
||||
local factionrealmregionKey = factionrealmKey .. " - " .. string.sub(GetCVar("realmList"), 1, 2):upper()
|
||||
local localeKey = GetLocale():lower()
|
||||
|
||||
local regionTable = { "US", "KR", "EU", "TW", "CN" }
|
||||
local regionKey = regionTable[GetCurrentRegion()] or GetCurrentRegionName() or "TR"
|
||||
local factionrealmregionKey = factionrealmKey .. " - " .. regionKey
|
||||
|
||||
-- Actual database initialization function
|
||||
local function initdb(sv, defaults, defaultProfile, olddb, parent)
|
||||
-- Generate the database keys for each section
|
||||
@@ -361,7 +360,7 @@ local function logoutHandler(frame, event)
|
||||
|
||||
-- cleanup sections that are empty without defaults
|
||||
local sv = rawget(db, "sv")
|
||||
for section in pairs(db.keys) do
|
||||
for section in pairs(rawget(db, "keys")) do
|
||||
if rawget(sv, section) then
|
||||
-- global is special, all other sections have sub-entrys
|
||||
-- also don't delete empty profiles on main dbs, only on namespaces
|
||||
@@ -378,6 +377,26 @@ local function logoutHandler(frame, event)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- second pass after everything else is cleaned up to remove empty namespaces
|
||||
-- can't be run in-loop above since there is no guaranteed order
|
||||
for db in pairs(AceDB.db_registry) do
|
||||
local sv = rawget(db, "sv")
|
||||
local namespaces = rawget(sv, "namespaces")
|
||||
if namespaces then
|
||||
for name in pairs(namespaces) do
|
||||
-- cleanout empty profiles table, if still present
|
||||
if namespaces[name].profiles and not next(namespaces[name].profiles) then
|
||||
namespaces[name].profiles = nil
|
||||
end
|
||||
|
||||
-- remove entire namespace, if needed
|
||||
if not next(namespaces[name]) then
|
||||
namespaces[name] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -526,6 +545,17 @@ function DBObjectLib:DeleteProfile(name, silent)
|
||||
end
|
||||
end
|
||||
|
||||
-- remove from unloaded namespaces
|
||||
if self.sv.namespaces then
|
||||
for nsname, data in pairs(self.sv.namespaces) do
|
||||
if self.children and self.children[nsname] then
|
||||
-- already a mapped namespace
|
||||
elseif data.profiles then
|
||||
data.profiles[name] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- switch all characters that use this profile back to the default
|
||||
if self.sv.profileKeys then
|
||||
for key, profile in pairs(self.sv.profileKeys) do
|
||||
@@ -571,6 +601,20 @@ function DBObjectLib:CopyProfile(name, silent)
|
||||
end
|
||||
end
|
||||
|
||||
-- copy unloaded namespaces
|
||||
if self.sv.namespaces then
|
||||
for nsname, data in pairs(self.sv.namespaces) do
|
||||
if self.children and self.children[nsname] then
|
||||
-- already a mapped namespace
|
||||
elseif data.profiles then
|
||||
-- reset the current profile
|
||||
data.profiles[self.keys.profile] = {}
|
||||
-- copy data
|
||||
copyTable(data.profiles[name], data.profiles[self.keys.profile])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Callback: OnProfileCopied, database, sourceProfileKey
|
||||
self.callbacks:Fire("OnProfileCopied", self, name)
|
||||
end
|
||||
@@ -597,6 +641,18 @@ function DBObjectLib:ResetProfile(noChildren, noCallbacks)
|
||||
end
|
||||
end
|
||||
|
||||
-- reset unloaded namespaces
|
||||
if self.sv.namespaces and not noChildren then
|
||||
for nsname, data in pairs(self.sv.namespaces) do
|
||||
if self.children and self.children[nsname] then
|
||||
-- already a mapped namespace
|
||||
elseif data.profiles then
|
||||
-- reset the current profile
|
||||
data.profiles[self.keys.profile] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Callback: OnProfileReset, database
|
||||
if not noCallbacks then
|
||||
self.callbacks:Fire("OnProfileReset", self)
|
||||
@@ -607,8 +663,8 @@ end
|
||||
-- profile.
|
||||
-- @param defaultProfile The profile name to use as the default
|
||||
function DBObjectLib:ResetDB(defaultProfile)
|
||||
if defaultProfile and type(defaultProfile) ~= "string" then
|
||||
error(("Usage: AceDBObject:ResetDB(defaultProfile): 'defaultProfile' - string or nil expected, got %q."):format(type(defaultProfile)), 2)
|
||||
if defaultProfile and type(defaultProfile) ~= "string" and defaultProfile ~= true then
|
||||
error(("Usage: AceDBObject:ResetDB(defaultProfile): 'defaultProfile' - string or true expected, got %q."):format(type(defaultProfile)), 2)
|
||||
end
|
||||
|
||||
local sv = self.sv
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
-- @class file
|
||||
-- @name AceHook-3.0
|
||||
-- @release $Id$
|
||||
local ACEHOOK_MAJOR, ACEHOOK_MINOR = "AceHook-3.0", 8
|
||||
local ACEHOOK_MAJOR, ACEHOOK_MINOR = "AceHook-3.0", 9
|
||||
local AceHook, oldminor = LibStub:NewLibrary(ACEHOOK_MAJOR, ACEHOOK_MINOR)
|
||||
|
||||
if not AceHook then return end -- No upgrade needed
|
||||
@@ -195,7 +195,6 @@ function hook(self, obj, method, handler, script, secure, raw, forceSecure, usag
|
||||
registry[self][method] = nil
|
||||
end
|
||||
handlers[uid], actives[uid], scripts[uid] = nil, nil, nil
|
||||
uid = nil
|
||||
end
|
||||
|
||||
local orig
|
||||
@@ -478,10 +477,10 @@ function AceHook:UnhookAll()
|
||||
for key, value in pairs(registry[self]) do
|
||||
if type(key) == "table" then
|
||||
for method in pairs(value) do
|
||||
self:Unhook(key, method)
|
||||
AceHook.Unhook(self, key, method)
|
||||
end
|
||||
else
|
||||
self:Unhook(key)
|
||||
AceHook.Unhook(self, key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
-- @class file
|
||||
-- @name AceLocale-3.0
|
||||
-- @release $Id$
|
||||
local MAJOR,MINOR = "AceLocale-3.0-ElvUI", 6
|
||||
local MAJOR,MINOR = "AceLocale-3.0", 6
|
||||
|
||||
local AceLocale, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
@@ -12,10 +12,6 @@ if not AceLocale then return end -- no upgrade needed
|
||||
local assert, tostring, error = assert, tostring, error
|
||||
local getmetatable, setmetatable, rawset, rawget = getmetatable, setmetatable, rawset, rawget
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: GAME_LOCALE, geterrorhandler
|
||||
|
||||
local gameLocale = GetLocale()
|
||||
if gameLocale == "enGB" then
|
||||
gameLocale = "enUS"
|
||||
@@ -91,6 +87,10 @@ local writedefaultproxy = setmetatable({}, {
|
||||
-- L["string1"] = "Zeichenkette1"
|
||||
-- @return Locale Table to add localizations to, or nil if the current locale is not required.
|
||||
function AceLocale:NewLocale(application, locale, isDefault, silent)
|
||||
|
||||
-- GAME_LOCALE allows translators to test translations of addons without having that wow client installed
|
||||
local activeGameLocale = GAME_LOCALE or gameLocale
|
||||
|
||||
local app = AceLocale.apps[application]
|
||||
|
||||
if silent and app and getmetatable(app) ~= readmetasilent then
|
||||
@@ -107,14 +107,11 @@ function AceLocale:NewLocale(application, locale, isDefault, silent)
|
||||
AceLocale.appnames[app] = application
|
||||
end
|
||||
|
||||
-- ElvUI block
|
||||
if (not app[locale]) or (app[locale] and type(app[locale]) ~= 'table') then
|
||||
-- app[locale] = setmetatable({}, silent and readmetasilent or readmeta) -- To find missing keys
|
||||
app[locale] = setmetatable({}, readmetasilent)
|
||||
if locale ~= activeGameLocale and not isDefault then
|
||||
return -- nop, we don't need these translations
|
||||
end
|
||||
|
||||
registering = app[locale] -- remember globally for writeproxy and writedefaultproxy
|
||||
-- end block
|
||||
registering = app -- remember globally for writeproxy and writedefaultproxy
|
||||
|
||||
if isDefault then
|
||||
return writedefaultproxy
|
||||
@@ -128,16 +125,9 @@ end
|
||||
-- @param application Unique name of addon / module
|
||||
-- @param silent If true, the locale is optional, silently return nil if it's not found (defaults to false, optional)
|
||||
-- @return The locale table for the current language.
|
||||
--- Modified by ElvUI to add `locale` as second arg
|
||||
function AceLocale:GetLocale(application, locale, silent)
|
||||
if type(locale) == "boolean" then
|
||||
silent = locale
|
||||
locale = gameLocale
|
||||
end
|
||||
|
||||
function AceLocale:GetLocale(application, silent)
|
||||
if not silent and not AceLocale.apps[application] then
|
||||
error("Usage: GetLocale(application[,locale[, silent]]): 'application' - No locales registered for '"..tostring(application).."'", 2)
|
||||
error("Usage: GetLocale(application[, silent]): 'application' - No locales registered for '"..tostring(application).."'", 2)
|
||||
end
|
||||
|
||||
return AceLocale.apps[application][locale] or AceLocale.apps[application][gameLocale] -- Just in case the table doesn't exist it reverts to default
|
||||
return AceLocale.apps[application]
|
||||
end
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
-- @class file
|
||||
-- @name AceSerializer-3.0
|
||||
-- @release $Id$
|
||||
local MAJOR,MINOR = "AceSerializer-3.0", 3
|
||||
local MAJOR,MINOR = "AceSerializer-3.0", 5
|
||||
local AceSerializer, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceSerializer then return end
|
||||
@@ -24,9 +24,11 @@ local pairs, select, frexp = pairs, select, math.frexp
|
||||
local tconcat = table.concat
|
||||
|
||||
-- quick copies of string representations of wonky numbers
|
||||
local serNaN = tostring(0/0)
|
||||
local serInf = tostring(1/0)
|
||||
local serNegInf = tostring(-1/0)
|
||||
local inf = math.huge
|
||||
|
||||
local serNaN -- can't do this in 4.3, see ace3 ticket 268
|
||||
local serInf, serInfMac = "1.#INF", "inf"
|
||||
local serNegInf, serNegInfMac = "-1.#INF", "-inf"
|
||||
|
||||
|
||||
-- Serialization functions
|
||||
@@ -60,11 +62,15 @@ local function SerializeValue(v, res, nres)
|
||||
|
||||
elseif t=="number" then -- ^N = number (just tostring()ed) or ^F (float components)
|
||||
local str = tostring(v)
|
||||
if tonumber(str)==v or str==serNaN or str==serInf or str==serNegInf then
|
||||
if tonumber(str)==v --[[not in 4.3 or str==serNaN]] then
|
||||
-- translates just fine, transmit as-is
|
||||
res[nres+1] = "^N"
|
||||
res[nres+2] = str
|
||||
nres=nres+2
|
||||
elseif v == inf or v == -inf then
|
||||
res[nres+1] = "^N"
|
||||
res[nres+2] = v == inf and serInf or serNegInf
|
||||
nres=nres+2
|
||||
else
|
||||
local m,e = frexp(v)
|
||||
res[nres+1] = "^F"
|
||||
@@ -77,9 +83,9 @@ local function SerializeValue(v, res, nres)
|
||||
elseif t=="table" then -- ^T...^t = table (list of key,value pairs)
|
||||
nres=nres+1
|
||||
res[nres] = "^T"
|
||||
for k,v in pairs(v) do
|
||||
nres = SerializeValue(k, res, nres)
|
||||
nres = SerializeValue(v, res, nres)
|
||||
for key,value in pairs(v) do
|
||||
nres = SerializeValue(key, res, nres)
|
||||
nres = SerializeValue(value, res, nres)
|
||||
end
|
||||
nres=nres+1
|
||||
res[nres] = "^t"
|
||||
@@ -143,12 +149,12 @@ local function DeserializeStringHelper(escape)
|
||||
end
|
||||
|
||||
local function DeserializeNumberHelper(number)
|
||||
if number == serNaN then
|
||||
--[[ not in 4.3 if number == serNaN then
|
||||
return 0/0
|
||||
elseif number == serNegInf then
|
||||
return -1/0
|
||||
elseif number == serInf then
|
||||
return 1/0
|
||||
else]]if number == serNegInf or number == serNegInfMac then
|
||||
return -inf
|
||||
elseif number == serInf or number == serInfMac then
|
||||
return inf
|
||||
else
|
||||
return tonumber(number)
|
||||
end
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
-- AceTimer supports one-shot timers and repeating timers. All timers are stored in an efficient
|
||||
-- data structure that allows easy dispatching and fast rescheduling. Timers can be registered
|
||||
-- or canceled at any time, even from within a running timer, without conflict or large overhead.\\
|
||||
-- AceTimer is currently limited to firing timers at a frequency of 0.01s.
|
||||
-- AceTimer is currently limited to firing timers at a frequency of 0.01s as this is what the WoW timer API
|
||||
-- restricts us to.
|
||||
--
|
||||
-- All `:Schedule` functions will return a handle to the current timer, which you will need to store if you
|
||||
-- need to cancel the timer you just registered.
|
||||
@@ -16,67 +17,21 @@
|
||||
-- @name AceTimer-3.0
|
||||
-- @release $Id$
|
||||
|
||||
local MAJOR, MINOR = "AceTimer-3.0", 1017 -- Bump minor on changes
|
||||
local MAJOR, MINOR = "AceTimer-3.0", 17 -- Bump minor on changes
|
||||
local AceTimer, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceTimer then return end -- No upgrade needed
|
||||
AceTimer.frame = AceTimer.frame or CreateFrame("Frame", "AceTimer30Frame")
|
||||
AceTimer.activeTimers = AceTimer.activeTimers or {} -- Active timer list
|
||||
local activeTimers = AceTimer.activeTimers -- Upvalue our private data
|
||||
|
||||
-- Lua APIs
|
||||
local assert, loadstring, rawset, tconcat = assert, loadstring, rawset, table.concat
|
||||
local type, unpack, next, error, select = type, unpack, next, error, select
|
||||
-- WoW APIs
|
||||
local GetTime = GetTime
|
||||
|
||||
--[[
|
||||
xpcall safecall implementation
|
||||
]]
|
||||
local xpcall = xpcall
|
||||
|
||||
local function errorhandler(err)
|
||||
return geterrorhandler()(err)
|
||||
end
|
||||
|
||||
local function CreateDispatcher(argCount)
|
||||
local code = [[
|
||||
local xpcall, eh = ...
|
||||
local method, ARGS
|
||||
local function call() return method(ARGS) end
|
||||
|
||||
local function dispatch(func, ...)
|
||||
method = func
|
||||
if not method then return end
|
||||
ARGS = ...
|
||||
return xpcall(call, eh)
|
||||
end
|
||||
|
||||
return dispatch
|
||||
]]
|
||||
|
||||
local ARGS = {}
|
||||
for i = 1, argCount do ARGS[i] = "arg"..i end
|
||||
code = code:gsub("ARGS", tconcat(ARGS, ", "))
|
||||
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(xpcall, errorhandler)
|
||||
end
|
||||
|
||||
local Dispatchers = setmetatable({}, {__index=function(self, argCount)
|
||||
local dispatcher = CreateDispatcher(argCount)
|
||||
rawset(self, argCount, dispatcher)
|
||||
return dispatcher
|
||||
end})
|
||||
Dispatchers[0] = function(func)
|
||||
return xpcall(func, errorhandler)
|
||||
end
|
||||
|
||||
local function safecall(func, ...)
|
||||
return Dispatchers[select("#", ...)](func, ...)
|
||||
end
|
||||
local GetTime, C_TimerAfter = GetTime, C_Timer.After
|
||||
|
||||
local function new(self, loop, func, delay, ...)
|
||||
if delay < 0.01 then
|
||||
delay = 0.01 -- Restrict to the lowest time
|
||||
delay = 0.01 -- Restrict to the lowest time that the C_Timer API allows us
|
||||
end
|
||||
|
||||
local timer = {
|
||||
@@ -85,19 +40,45 @@ local function new(self, loop, func, delay, ...)
|
||||
looping = loop,
|
||||
argsCount = select("#", ...),
|
||||
delay = delay,
|
||||
timeleft = delay,
|
||||
ends = GetTime() + delay,
|
||||
...
|
||||
}
|
||||
|
||||
activeTimers[timer] = timer
|
||||
|
||||
-- Create new timer closure to wrap the "timer" object
|
||||
timer.callback = function()
|
||||
if not timer.cancelled then
|
||||
if type(timer.func) == "string" then
|
||||
-- We manually set the unpack count to prevent issues with an arg set that contains nil and ends with nil
|
||||
-- e.g. local t = {1, 2, nil, 3, nil} print(#t) will result in 2, instead of 5. This fixes said issue.
|
||||
timer.object[timer.func](timer.object, unpack(timer, 1, timer.argsCount))
|
||||
else
|
||||
timer.func(unpack(timer, 1, timer.argsCount))
|
||||
end
|
||||
|
||||
if timer.looping and not timer.cancelled then
|
||||
-- Compensate delay to get a perfect average delay, even if individual times don't match up perfectly
|
||||
-- due to fps differences
|
||||
local time = GetTime()
|
||||
local ndelay = timer.delay - (time - timer.ends)
|
||||
-- Ensure the delay doesn't go below the threshold
|
||||
if ndelay < 0.01 then ndelay = 0.01 end
|
||||
C_TimerAfter(ndelay, timer.callback)
|
||||
timer.ends = time + ndelay
|
||||
else
|
||||
activeTimers[timer.handle or timer] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
C_TimerAfter(delay, timer.callback)
|
||||
return timer
|
||||
end
|
||||
|
||||
--- Schedule a new one-shot timer.
|
||||
-- The timer will fire once in `delay` seconds, unless canceled before.
|
||||
-- @param callback Callback function for the timer pulse (funcref or method name).
|
||||
-- @param func Callback function for the timer pulse (funcref or method name).
|
||||
-- @param delay Delay for the timer, in seconds.
|
||||
-- @param ... An optional, unlimited amount of arguments to pass to the callback function.
|
||||
-- @usage
|
||||
@@ -126,7 +107,7 @@ end
|
||||
|
||||
--- Schedule a repeating timer.
|
||||
-- The timer will fire every `delay` seconds, until canceled.
|
||||
-- @param callback Callback function for the timer pulse (funcref or method name).
|
||||
-- @param func Callback function for the timer pulse (funcref or method name).
|
||||
-- @param delay Delay for the timer, in seconds.
|
||||
-- @param ... An optional, unlimited amount of arguments to pass to the callback function.
|
||||
-- @usage
|
||||
@@ -230,6 +211,7 @@ if oldminor and oldminor < 10 then
|
||||
elseif oldminor and oldminor < 17 then
|
||||
-- Upgrade from old animation based timers to C_Timer.After timers.
|
||||
AceTimer.inactiveTimers = nil
|
||||
AceTimer.frame = nil
|
||||
local oldTimers = AceTimer.activeTimers
|
||||
-- Clear old timer table and update upvalue
|
||||
AceTimer.activeTimers = {}
|
||||
@@ -294,34 +276,3 @@ end
|
||||
for addon in next, AceTimer.embeds do
|
||||
AceTimer:Embed(addon)
|
||||
end
|
||||
|
||||
AceTimer.frame:SetScript("OnUpdate", function(self, elapsed)
|
||||
for _, timer in next, activeTimers do
|
||||
if not timer.cancelled then
|
||||
if timer.timeleft > elapsed then
|
||||
timer.timeleft = timer.timeleft - elapsed
|
||||
else
|
||||
if type(timer.func) == "string" then
|
||||
-- We manually set the unpack count to prevent issues with an arg set that contains nil and ends with nil
|
||||
-- e.g. local t = {1, 2, nil, 3, nil} print(#t) will result in 2, instead of 5. This fixes said issue.
|
||||
safecall(timer.object[timer.func], timer.object, unpack(timer, 1, timer.argsCount))
|
||||
else
|
||||
safecall(timer.func, unpack(timer, 1, timer.argsCount))
|
||||
end
|
||||
|
||||
if timer.looping and not timer.cancelled then
|
||||
-- Compensate delay to get a perfect average delay, even if individual times don't match up perfectly
|
||||
-- due to fps differences
|
||||
local time = GetTime()
|
||||
local delay = timer.delay - (time - timer.ends)
|
||||
-- Ensure the delay doesn't go below the threshold
|
||||
if delay < 0.01 then delay = 0.01 end
|
||||
timer.ends = time + delay
|
||||
timer.timeleft = timer.delay
|
||||
else
|
||||
activeTimers[timer.handle or timer] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -1,5 +1,5 @@
|
||||
--[[ $Id: CallbackHandler-1.0.lua 18 2014-10-16 02:52:20Z mikk $ ]]
|
||||
local MAJOR, MINOR = "CallbackHandler-1.0", 6
|
||||
--[[ $Id: CallbackHandler-1.0.lua 25 2022-12-12 15:02:36Z nevcairiel $ ]]
|
||||
local MAJOR, MINOR = "CallbackHandler-1.0", 8
|
||||
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not CallbackHandler then return end -- No upgrade needed
|
||||
@@ -7,56 +7,20 @@ 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)
|
||||
local function Dispatch(handlers, ...)
|
||||
local index, method = next(handlers)
|
||||
if not method then return end
|
||||
repeat
|
||||
securecallfunction(method, ...)
|
||||
index, method = next(handlers, index)
|
||||
until not method
|
||||
end
|
||||
|
||||
local function CreateDispatcher(argCount)
|
||||
local code = [[
|
||||
local next, xpcall, eh = ...
|
||||
|
||||
local method, ARGS
|
||||
local function call() method(ARGS) end
|
||||
|
||||
local function dispatch(handlers, ...)
|
||||
local index
|
||||
index, method = next(handlers)
|
||||
if not method then return end
|
||||
local OLD_ARGS = ARGS
|
||||
ARGS = ...
|
||||
repeat
|
||||
xpcall(call, eh)
|
||||
index, method = next(handlers, index)
|
||||
until not method
|
||||
ARGS = OLD_ARGS
|
||||
end
|
||||
|
||||
return dispatch
|
||||
]]
|
||||
|
||||
local ARGS, OLD_ARGS = {}, {}
|
||||
for i = 1, argCount do ARGS[i], OLD_ARGS[i] = "arg"..i, "old_arg"..i end
|
||||
code = code:gsub("OLD_ARGS", tconcat(OLD_ARGS, ", ")):gsub("ARGS", tconcat(ARGS, ", "))
|
||||
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler)
|
||||
end
|
||||
|
||||
local Dispatchers = setmetatable({}, {__index=function(self, argCount)
|
||||
local dispatcher = CreateDispatcher(argCount)
|
||||
rawset(self, argCount, dispatcher)
|
||||
return dispatcher
|
||||
end})
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
-- CallbackHandler:New
|
||||
--
|
||||
@@ -65,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"
|
||||
@@ -87,19 +51,19 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll
|
||||
local oldrecurse = registry.recurse
|
||||
registry.recurse = oldrecurse + 1
|
||||
|
||||
Dispatchers[select('#', ...) + 1](events[eventname], eventname, ...)
|
||||
Dispatch(events[eventname], eventname, ...)
|
||||
|
||||
registry.recurse = oldrecurse
|
||||
|
||||
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
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Script file="CallbackHandler-1.0.lua"/>
|
||||
</Ui>
|
||||
@@ -1,25 +1,16 @@
|
||||
-- $Id: LibStub.lua 103 2014-10-16 03:02:50Z mikk $
|
||||
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/addons/libstub/ for more info
|
||||
-- LibStub is hereby placed in the Public Domain
|
||||
-- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
|
||||
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info
|
||||
-- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
|
||||
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
|
||||
local LibStub = _G[LIBSTUB_MAJOR]
|
||||
|
||||
-- Check to see is this version of the stub is obsolete
|
||||
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
|
||||
LibStub = LibStub or {libs = {}, minors = {} }
|
||||
_G[LIBSTUB_MAJOR] = LibStub
|
||||
LibStub.minor = LIBSTUB_MINOR
|
||||
|
||||
-- LibStub:NewLibrary(major, minor)
|
||||
-- major (string) - the major version of the library
|
||||
-- minor (string or number ) - the minor version of the library
|
||||
--
|
||||
-- returns nil if a newer or same version of the lib is already present
|
||||
-- returns empty library object or old library object if upgrade is needed
|
||||
function LibStub:NewLibrary(major, minor)
|
||||
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
|
||||
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
|
||||
minor = assert(tonumber(string.match(minor, "%d+")), "Minor version must either be a number or contain a number.")
|
||||
|
||||
local oldminor = self.minors[major]
|
||||
if oldminor and oldminor >= minor then return nil end
|
||||
@@ -27,12 +18,6 @@ if not LibStub or LibStub.minor < LIBSTUB_MINOR then
|
||||
return self.libs[major], oldminor
|
||||
end
|
||||
|
||||
-- LibStub:GetLibrary(major, [silent])
|
||||
-- major (string) - the major version of the library
|
||||
-- silent (boolean) - if true, library is optional, silently return nil if its not found
|
||||
--
|
||||
-- throws an error if the library can not be found (except silent is set)
|
||||
-- returns the library object if found
|
||||
function LibStub:GetLibrary(major, silent)
|
||||
if not self.libs[major] and not silent then
|
||||
error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
|
||||
@@ -40,12 +25,6 @@ if not LibStub or LibStub.minor < LIBSTUB_MINOR then
|
||||
return self.libs[major], self.minors[major]
|
||||
end
|
||||
|
||||
-- LibStub:IterateLibraries()
|
||||
--
|
||||
-- Returns an iterator for the currently registered libraries
|
||||
function LibStub:IterateLibraries()
|
||||
return pairs(self.libs)
|
||||
end
|
||||
|
||||
function LibStub:IterateLibraries() return pairs(self.libs) end
|
||||
setmetatable(LibStub, { __call = LibStub.GetLibrary })
|
||||
end
|
||||
|
||||
@@ -12,10 +12,10 @@ Very light wrapper library that combines all the AceConfig subcomponents into on
|
||||
|
||||
]]
|
||||
|
||||
local cfgreg = LibStub("AceConfigRegistry-3.0-ElvUI")
|
||||
local cfgcmd = LibStub("AceConfigCmd-3.0-ElvUI")
|
||||
local cfgreg = LibStub("AceConfigRegistry-3.0")
|
||||
local cfgcmd = LibStub("AceConfigCmd-3.0")
|
||||
|
||||
local MAJOR, MINOR = "AceConfig-3.0-ElvUI", 3
|
||||
local MAJOR, MINOR = "AceConfig-3.0", 3
|
||||
local AceConfig = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceConfig then return end
|
||||
@@ -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
|
||||
|
||||
+15
-22
@@ -14,9 +14,9 @@ REQUIRES: AceConsole-3.0 for command registration (loaded on demand)
|
||||
|
||||
-- TODO: plugin args
|
||||
|
||||
local cfgreg = LibStub("AceConfigRegistry-3.0-ElvUI")
|
||||
local cfgreg = LibStub("AceConfigRegistry-3.0")
|
||||
|
||||
local MAJOR, MINOR = "AceConfigCmd-3.0-ElvUI", 14
|
||||
local MAJOR, MINOR = "AceConfigCmd-3.0", 14
|
||||
local AceConfigCmd = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceConfigCmd then return end
|
||||
@@ -37,17 +37,10 @@ local error, assert = error, assert
|
||||
-- WoW APIs
|
||||
local _G = _G
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: LibStub, SELECTED_CHAT_FRAME, DEFAULT_CHAT_FRAME
|
||||
|
||||
|
||||
local L = setmetatable({}, { -- TODO: replace with proper locale
|
||||
__index = function(self,k) return k end
|
||||
})
|
||||
|
||||
|
||||
|
||||
local function print(msg)
|
||||
(SELECTED_CHAT_FRAME or DEFAULT_CHAT_FRAME):AddMessage(msg)
|
||||
end
|
||||
@@ -401,7 +394,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
|
||||
return
|
||||
end
|
||||
|
||||
local str = strsub(info.input,inputpos);
|
||||
local strInput = strsub(info.input,inputpos);
|
||||
|
||||
if tab.type=="execute" then
|
||||
------------ execute --------------------------------------------
|
||||
@@ -414,21 +407,21 @@ local function handle(info, inputpos, tab, depth, retfalse)
|
||||
|
||||
local res = true
|
||||
if tab.pattern then
|
||||
if not(type(tab.pattern)=="string") then err(info, inputpos, "'pattern' - expected a string") end
|
||||
if not strmatch(str, tab.pattern) then
|
||||
usererr(info, inputpos, "'"..str.."' - " .. L["invalid input"])
|
||||
if type(tab.pattern)~="string" then err(info, inputpos, "'pattern' - expected a string") end
|
||||
if not strmatch(strInput, tab.pattern) then
|
||||
usererr(info, inputpos, "'"..strInput.."' - " .. L["invalid input"])
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
do_final(info, inputpos, tab, "set", str)
|
||||
do_final(info, inputpos, tab, "set", strInput)
|
||||
|
||||
|
||||
|
||||
elseif tab.type=="toggle" then
|
||||
------------ toggle --------------------------------------------
|
||||
local b
|
||||
local str = strtrim(strlower(str))
|
||||
local str = strtrim(strlower(strInput))
|
||||
if str=="" then
|
||||
b = callmethod(info, inputpos, tab, "get")
|
||||
|
||||
@@ -465,9 +458,9 @@ local function handle(info, inputpos, tab, depth, retfalse)
|
||||
|
||||
elseif tab.type=="range" then
|
||||
------------ range --------------------------------------------
|
||||
local val = tonumber(str)
|
||||
local val = tonumber(strInput)
|
||||
if not val then
|
||||
usererr(info, inputpos, "'"..str.."' - "..L["expected number"])
|
||||
usererr(info, inputpos, "'"..strInput.."' - "..L["expected number"])
|
||||
return
|
||||
end
|
||||
if type(info.step)=="number" then
|
||||
@@ -487,7 +480,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
|
||||
|
||||
elseif tab.type=="select" then
|
||||
------------ select ------------------------------------
|
||||
local str = strtrim(strlower(str))
|
||||
local str = strtrim(strlower(strInput))
|
||||
|
||||
local values = tab.values
|
||||
if type(values) == "function" or type(values) == "string" then
|
||||
@@ -528,7 +521,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
|
||||
|
||||
elseif tab.type=="multiselect" then
|
||||
------------ multiselect -------------------------------------------
|
||||
local str = strtrim(strlower(str))
|
||||
local str = strtrim(strlower(strInput))
|
||||
|
||||
local values = tab.values
|
||||
if type(values) == "function" or type(values) == "string" then
|
||||
@@ -565,7 +558,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
|
||||
|
||||
--check that the opt is valid
|
||||
local ok
|
||||
for k,v in pairs(values) do
|
||||
for k in pairs(values) do
|
||||
if strlower(k)==opt then
|
||||
opt = k -- overwrite with key (in case of case mismatches)
|
||||
ok = true
|
||||
@@ -634,7 +627,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
|
||||
|
||||
elseif tab.type=="color" then
|
||||
------------ color --------------------------------------------
|
||||
local str = strtrim(strlower(str))
|
||||
local str = strtrim(strlower(strInput))
|
||||
if str == "" then
|
||||
--TODO: Show current value
|
||||
return
|
||||
@@ -706,7 +699,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
|
||||
|
||||
elseif tab.type=="keybinding" then
|
||||
------------ keybinding --------------------------------------------
|
||||
local str = strtrim(strlower(str))
|
||||
local str = strtrim(strlower(strInput))
|
||||
if str == "" then
|
||||
--TODO: Show current value
|
||||
return
|
||||
|
||||
+272
-307
@@ -5,9 +5,9 @@
|
||||
|
||||
local LibStub = LibStub
|
||||
local gui = LibStub("AceGUI-3.0")
|
||||
local reg = LibStub("AceConfigRegistry-3.0-ElvUI")
|
||||
local reg = LibStub("AceConfigRegistry-3.0")
|
||||
|
||||
local MAJOR, MINOR = "AceConfigDialog-3.0-ElvUI", 79
|
||||
local MAJOR, MINOR = "AceConfigDialog-3.0", 92
|
||||
local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceConfigDialog then return end
|
||||
@@ -15,25 +15,20 @@ if not AceConfigDialog then return end
|
||||
AceConfigDialog.OpenFrames = AceConfigDialog.OpenFrames or {}
|
||||
AceConfigDialog.Status = AceConfigDialog.Status or {}
|
||||
AceConfigDialog.frame = AceConfigDialog.frame or CreateFrame("Frame")
|
||||
AceConfigDialog.tooltip = AceConfigDialog.tooltip or CreateFrame("GameTooltip", "AceConfigDialogTooltip", UIParent, "GameTooltipTemplate")
|
||||
|
||||
AceConfigDialog.frame.apps = AceConfigDialog.frame.apps or {}
|
||||
AceConfigDialog.frame.closing = AceConfigDialog.frame.closing or {}
|
||||
AceConfigDialog.frame.closeAllOverride = AceConfigDialog.frame.closeAllOverride or {}
|
||||
|
||||
-- Lua APIs
|
||||
local tconcat, tinsert, tsort, tremove = table.concat, table.insert, table.sort, table.remove
|
||||
local tinsert, tsort, tremove, wipe = table.insert, table.sort, table.remove, table.wipe
|
||||
local strmatch, format = string.match, string.format
|
||||
local assert, loadstring, error = assert, loadstring, error
|
||||
local pairs, next, select, type, unpack, wipe, ipairs = pairs, next, select, type, unpack, wipe, ipairs
|
||||
local rawset, tostring, tonumber = rawset, tostring, tonumber
|
||||
local error = error
|
||||
local pairs, next, select, type, unpack, ipairs = pairs, next, select, type, unpack, ipairs
|
||||
local tostring, tonumber = tostring, tonumber
|
||||
local math_min, math_max, math_floor = math.min, math.max, math.floor
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: NORMAL_FONT_COLOR, GameTooltip, StaticPopupDialogs, ACCEPT, CANCEL, StaticPopup_Show
|
||||
-- GLOBALS: PlaySound, GameFontHighlight, GameFontHighlightSmall, GameFontHighlightLarge
|
||||
-- GLOBALS: CloseSpecialWindows, InterfaceOptions_AddCategory, geterrorhandler
|
||||
|
||||
local emptyTbl = {}
|
||||
|
||||
--[[
|
||||
@@ -45,39 +40,10 @@ local function errorhandler(err)
|
||||
return geterrorhandler()(err)
|
||||
end
|
||||
|
||||
local function CreateDispatcher(argCount)
|
||||
local code = [[
|
||||
local xpcall, eh = ...
|
||||
local method, ARGS
|
||||
local function call() return method(ARGS) end
|
||||
|
||||
local function dispatch(func, ...)
|
||||
method = func
|
||||
if not method then return end
|
||||
ARGS = ...
|
||||
return xpcall(call, eh)
|
||||
end
|
||||
|
||||
return dispatch
|
||||
]]
|
||||
|
||||
local ARGS = {}
|
||||
for i = 1, argCount do ARGS[i] = "arg"..i end
|
||||
code = code:gsub("ARGS", tconcat(ARGS, ", "))
|
||||
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(xpcall, errorhandler)
|
||||
end
|
||||
|
||||
local Dispatchers = setmetatable({}, {__index=function(self, argCount)
|
||||
local dispatcher = CreateDispatcher(argCount)
|
||||
rawset(self, argCount, dispatcher)
|
||||
return dispatcher
|
||||
end})
|
||||
Dispatchers[0] = function(func)
|
||||
return xpcall(func, errorhandler)
|
||||
end
|
||||
|
||||
local function safecall(func, ...)
|
||||
return Dispatchers[select("#", ...)](func, ...)
|
||||
if func then
|
||||
return xpcall(func, errorhandler, ...)
|
||||
end
|
||||
end
|
||||
|
||||
local width_multiplier = 170
|
||||
@@ -181,6 +147,7 @@ local stringIsLiteral = {
|
||||
width = true,
|
||||
image = true,
|
||||
fontSize = true,
|
||||
tooltipHyperlink = true
|
||||
}
|
||||
|
||||
--Is Never a function or method
|
||||
@@ -222,9 +189,8 @@ local function GetOptionsMemberValue(membername, option, options, path, appName,
|
||||
--We have a function to call
|
||||
local info = new()
|
||||
--traverse the options table, picking up the handler and filling the info with the path
|
||||
local handler
|
||||
local group = options
|
||||
handler = group.handler or handler
|
||||
local handler = group.handler
|
||||
|
||||
for i = 1, #path do
|
||||
group = GetSubOption(group, path[i])
|
||||
@@ -242,21 +208,21 @@ local function GetOptionsMemberValue(membername, option, options, path, appName,
|
||||
info.uiType = "dialog"
|
||||
info.uiName = MAJOR
|
||||
|
||||
local a, b, c, d, e, f, g, h -- ElvUI adds e,f,g,h for default color
|
||||
local a, b, c ,d
|
||||
--using 4 returns for the get of a color type, increase if a type needs more
|
||||
if type(member) == "function" then
|
||||
--Call the function
|
||||
a,b,c,d,e,f,g,h = member(info, ...)
|
||||
a,b,c,d = member(info, ...)
|
||||
else
|
||||
--Call the method
|
||||
if handler and handler[member] then
|
||||
a,b,c,d,e,f,g,h = handler[member](handler, info, ...)
|
||||
a,b,c,d = handler[member](handler, info, ...)
|
||||
else
|
||||
error(format("Method %s doesn't exist in handler for type %s", member, membername))
|
||||
end
|
||||
end
|
||||
del(info)
|
||||
return a,b,c,d,e,f,g,h
|
||||
return a,b,c,d
|
||||
else
|
||||
--The value isnt a function to call, return it
|
||||
return member
|
||||
@@ -533,137 +499,163 @@ local function OptionOnMouseOver(widget, event)
|
||||
local options = user.options
|
||||
local path = user.path
|
||||
local appName = user.appName
|
||||
local tooltip = AceConfigDialog.tooltip
|
||||
|
||||
-- modified by ElvUI
|
||||
if opt.descStyle and opt.descStyle ~= "tooltip" then return end
|
||||
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)
|
||||
local descStyle = opt.descStyle
|
||||
|
||||
local descText = type(desc) == "string"
|
||||
local usageText = type(usage) == "string"
|
||||
local userText = opt.type == "multiselect"
|
||||
local softText = opt.softMin or opt.softMax
|
||||
local bigText = opt.bigStep
|
||||
local Min, Max, Step
|
||||
if descStyle and descStyle ~= "tooltip" then return end
|
||||
|
||||
if softText then
|
||||
Min = (opt.min and "|cFFCCCCCCMin:|r "..(opt.isPercent and (opt.min*100).."%" or opt.min)) or ""
|
||||
Max = (opt.max and "|cFFCCCCCCMax:|r "..(opt.isPercent and (opt.max*100).."%" or opt.max)) or ""
|
||||
softText = Min ~= "" or Max ~= ""
|
||||
tooltip:SetText(name, 1, .82, 0, 1, true)
|
||||
|
||||
if opt.type == "multiselect" then
|
||||
tooltip:AddLine(user.text, 0.5, 0.5, 0.8, true)
|
||||
end
|
||||
if bigText then
|
||||
local dec = opt.step and format("%f", opt.step):gsub('%.?0-$','')
|
||||
local num = dec and tonumber(dec)
|
||||
Step = (num and num > 0 and "|cFFCCCCCCStep:|r "..dec) or ""
|
||||
bigText = Step ~= ""
|
||||
if type(desc) == "string" then
|
||||
tooltip:AddLine(desc, 1, 1, 1, true)
|
||||
end
|
||||
if type(usage) == "string" then
|
||||
tooltip:AddLine(usage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, true)
|
||||
end
|
||||
|
||||
if descText or usageText or userText or softText or bigText then
|
||||
GameTooltip:SetOwner(widget.frame, "ANCHOR_TOPRIGHT")
|
||||
GameTooltip:SetText(name, 1, .82, 0, true)
|
||||
|
||||
if userText then
|
||||
GameTooltip:AddLine(user.text, 0.5, 0.5, 0.8, true)
|
||||
end
|
||||
if descText then
|
||||
GameTooltip:AddLine(desc, 1, 1, 1, true)
|
||||
end
|
||||
if usageText then
|
||||
GameTooltip:AddLine("Usage: "..usage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, true)
|
||||
end
|
||||
if bigText or softText then
|
||||
GameTooltip:AddLine(" ")
|
||||
end
|
||||
if bigText then
|
||||
GameTooltip:AddLine(Step, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, true)
|
||||
end
|
||||
if softText then
|
||||
GameTooltip:AddDoubleLine(Min, Max)
|
||||
end
|
||||
|
||||
GameTooltip:Show()
|
||||
end
|
||||
tooltip:Show()
|
||||
end
|
||||
|
||||
local function OptionOnMouseLeave(widget, event)
|
||||
GameTooltip:Hide()
|
||||
AceConfigDialog.tooltip:Hide()
|
||||
end
|
||||
|
||||
local function GetFuncName(option)
|
||||
local type = option.type
|
||||
if type == "execute" then
|
||||
if option.type == "execute" then
|
||||
return "func"
|
||||
else
|
||||
return "set"
|
||||
end
|
||||
end
|
||||
local function confirmPopup(appName, rootframe, basepath, info, message, func, ...)
|
||||
if not StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"] then
|
||||
StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"] = {}
|
||||
end
|
||||
local t = StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"]
|
||||
for k in pairs(t) do
|
||||
t[k] = nil
|
||||
end
|
||||
t.text = message
|
||||
t.button1 = ACCEPT
|
||||
t.button2 = CANCEL
|
||||
t.preferredIndex = STATICPOPUP_NUMDIALOGS
|
||||
local dialog, oldstrata
|
||||
t.OnAccept = function()
|
||||
safecall(func, unpack(t))
|
||||
if dialog and oldstrata then
|
||||
dialog:SetFrameStrata(oldstrata)
|
||||
end
|
||||
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl))
|
||||
del(info)
|
||||
end
|
||||
t.OnCancel = function()
|
||||
if dialog and oldstrata then
|
||||
dialog:SetFrameStrata(oldstrata)
|
||||
end
|
||||
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl))
|
||||
del(info)
|
||||
end
|
||||
for i = 1, select("#", ...) do
|
||||
t[i] = select(i, ...) or false
|
||||
end
|
||||
t.timeout = 0
|
||||
t.whileDead = 1
|
||||
t.hideOnEscape = 1
|
||||
do
|
||||
local InCombatLockdown = InCombatLockdown
|
||||
local frame = AceConfigDialog.popup
|
||||
if not frame or oldminor < 81 then
|
||||
frame = CreateFrame("Frame", nil, UIParent)
|
||||
AceConfigDialog.popup = frame
|
||||
frame:Hide()
|
||||
frame:SetPoint("CENTER", UIParent, "CENTER")
|
||||
frame:SetSize(320, 72)
|
||||
frame:EnableMouse(true) -- Do not allow click-through on the frame
|
||||
frame:SetFrameStrata("TOOLTIP")
|
||||
frame:SetFrameLevel(100) -- Lots of room to draw under it
|
||||
frame:SetScript("OnKeyDown", function(self, key)
|
||||
if key == "ESCAPE" then
|
||||
if not InCombatLockdown() then
|
||||
self:SetPropagateKeyboardInput(false)
|
||||
end
|
||||
if self.cancel:IsShown() then
|
||||
self.cancel:Click()
|
||||
else -- Showing a validation error
|
||||
self:Hide()
|
||||
end
|
||||
elseif not InCombatLockdown() then
|
||||
self:SetPropagateKeyboardInput(true)
|
||||
end
|
||||
end)
|
||||
|
||||
dialog = StaticPopup_Show("ACECONFIGDIALOG30_CONFIRM_DIALOG")
|
||||
if dialog then
|
||||
oldstrata = dialog:GetFrameStrata()
|
||||
dialog:SetFrameStrata("TOOLTIP")
|
||||
local border = CreateFrame("Frame", nil, frame, "DialogBorderOpaqueTemplate")
|
||||
border:SetAllPoints(frame)
|
||||
frame:SetFixedFrameStrata(true)
|
||||
frame:SetFixedFrameLevel(true)
|
||||
|
||||
local text = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
|
||||
text:SetSize(290, 0)
|
||||
text:SetPoint("TOP", 0, -16)
|
||||
frame.text = text
|
||||
|
||||
local function newButton(newText)
|
||||
local button = CreateFrame("Button", nil, frame)
|
||||
button:SetSize(128, 21)
|
||||
button:SetNormalFontObject(GameFontNormal)
|
||||
button:SetHighlightFontObject(GameFontHighlight)
|
||||
button:SetNormalTexture("Interface\\Buttons\\UI-DialogBox-Button-Up")
|
||||
button:GetNormalTexture():SetTexCoord(0.0, 1.0, 0.0, 0.71875)
|
||||
button:SetPushedTexture("Interface\\Buttons\\UI-DialogBox-Button-Down")
|
||||
button:GetPushedTexture():SetTexCoord(0.0, 1.0, 0.0, 0.71875)
|
||||
button:SetHighlightTexture("Interface\\Buttons\\UI-DialogBox-Button-Highlight")
|
||||
button:GetHighlightTexture():SetTexCoord(0.0, 1.0, 0.0, 0.71875)
|
||||
button:SetText(newText)
|
||||
return button
|
||||
end
|
||||
|
||||
local accept = newButton(ACCEPT)
|
||||
accept:SetPoint("BOTTOMRIGHT", frame, "BOTTOM", -6, 16)
|
||||
frame.accept = accept
|
||||
|
||||
local cancel = newButton(CANCEL)
|
||||
cancel:SetPoint("LEFT", accept, "RIGHT", 13, 0)
|
||||
frame.cancel = cancel
|
||||
end
|
||||
end
|
||||
local function confirmPopup(appName, rootframe, basepath, info, message, func, ...)
|
||||
local frame = AceConfigDialog.popup
|
||||
frame:Show()
|
||||
frame.text:SetText(message)
|
||||
-- From StaticPopup.lua
|
||||
-- local height = 32 + text:GetHeight() + 2;
|
||||
-- height = height + 6 + accept:GetHeight()
|
||||
-- We add 32 + 2 + 6 + 21 (button height) == 61
|
||||
local height = 61 + frame.text:GetHeight()
|
||||
frame:SetHeight(height)
|
||||
|
||||
frame.accept:ClearAllPoints()
|
||||
frame.accept:SetPoint("BOTTOMRIGHT", frame, "BOTTOM", -6, 16)
|
||||
frame.cancel:Show()
|
||||
|
||||
local t = {...}
|
||||
local tCount = select("#", ...)
|
||||
frame.accept:SetScript("OnClick", function(self)
|
||||
safecall(func, unpack(t, 1, tCount)) -- Manually set count as unpack() stops on nil (bug with #table)
|
||||
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl))
|
||||
frame:Hide()
|
||||
self:SetScript("OnClick", nil)
|
||||
frame.cancel:SetScript("OnClick", nil)
|
||||
del(info)
|
||||
end)
|
||||
frame.cancel:SetScript("OnClick", function(self)
|
||||
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl))
|
||||
frame:Hide()
|
||||
self:SetScript("OnClick", nil)
|
||||
frame.accept:SetScript("OnClick", nil)
|
||||
del(info)
|
||||
end)
|
||||
end
|
||||
|
||||
local function validationErrorPopup(message)
|
||||
if not StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"] then
|
||||
StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"] = {}
|
||||
end
|
||||
local t = StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"]
|
||||
t.text = message
|
||||
t.button1 = OKAY
|
||||
t.preferredIndex = STATICPOPUP_NUMDIALOGS
|
||||
local dialog, oldstrata
|
||||
t.OnAccept = function()
|
||||
if dialog and oldstrata then
|
||||
dialog:SetFrameStrata(oldstrata)
|
||||
end
|
||||
end
|
||||
t.timeout = 0
|
||||
t.whileDead = 1
|
||||
t.hideOnEscape = 1
|
||||
local frame = AceConfigDialog.popup
|
||||
frame:Show()
|
||||
frame.text:SetText(message)
|
||||
-- From StaticPopup.lua
|
||||
-- local height = 32 + text:GetHeight() + 2;
|
||||
-- height = height + 6 + accept:GetHeight()
|
||||
-- We add 32 + 2 + 6 + 21 (button height) == 61
|
||||
local height = 61 + frame.text:GetHeight()
|
||||
frame:SetHeight(height)
|
||||
|
||||
dialog = StaticPopup_Show("ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG")
|
||||
if dialog then
|
||||
oldstrata = dialog:GetFrameStrata()
|
||||
dialog:SetFrameStrata("TOOLTIP")
|
||||
end
|
||||
frame.accept:ClearAllPoints()
|
||||
frame.accept:SetPoint("BOTTOM", frame, "BOTTOM", 0, 16)
|
||||
frame.cancel:Hide()
|
||||
|
||||
frame.accept:SetScript("OnClick", function()
|
||||
frame:Hide()
|
||||
end)
|
||||
end
|
||||
|
||||
local function ActivateControl(widget, event, ...)
|
||||
@@ -686,7 +678,7 @@ local function ActivateControl(widget, event, ...)
|
||||
if group[funcname] ~= nil then
|
||||
func = group[funcname]
|
||||
end
|
||||
handler = group.handler or handler
|
||||
handler = group.handler
|
||||
confirm = group.confirm
|
||||
validate = group.validate
|
||||
for i = 1, #path do
|
||||
@@ -750,7 +742,6 @@ local function ActivateControl(widget, event, ...)
|
||||
end
|
||||
end
|
||||
|
||||
local rootframe = user.rootframe
|
||||
if not validated or type(validated) == "string" then
|
||||
if not validated then
|
||||
if usage then
|
||||
@@ -765,12 +756,12 @@ local function ActivateControl(widget, event, ...)
|
||||
end
|
||||
|
||||
-- show validate message
|
||||
if not group.validatePopup and rootframe.SetStatusText then
|
||||
rootframe:SetStatusText(validated)
|
||||
if user.rootframe.SetStatusText then
|
||||
user.rootframe:SetStatusText(validated)
|
||||
else
|
||||
validationErrorPopup(validated)
|
||||
end
|
||||
PlaySound("igPlayerInviteDecline")
|
||||
PlaySound(882) -- SOUNDKIT.IG_PLAYER_INVITE_DECLINE || _DECLINE is actually missing from the table
|
||||
del(info)
|
||||
return true
|
||||
else
|
||||
@@ -803,14 +794,14 @@ local function ActivateControl(widget, event, ...)
|
||||
if type(confirm) == "boolean" then
|
||||
if confirm then
|
||||
if not confirmText then
|
||||
local name, desc = option.name, option.desc
|
||||
if type(name) == "function" then
|
||||
name = name(info)
|
||||
local option_name, desc = option.name, option.desc
|
||||
if type(option_name) == "function" then
|
||||
option_name = option_name(info)
|
||||
end
|
||||
if type(desc) == "function" then
|
||||
desc = desc(info)
|
||||
end
|
||||
confirmText = name
|
||||
confirmText = option_name
|
||||
if desc then
|
||||
confirmText = confirmText.." - "..desc
|
||||
end
|
||||
@@ -888,11 +879,6 @@ end
|
||||
local function ActivateSlider(widget, event, value)
|
||||
local option = widget:GetUserData("option")
|
||||
local min, max, step = option.min or (not option.softMin and 0 or nil), option.max or (not option.softMax and 100 or nil), option.step
|
||||
|
||||
-- checks added by elvui
|
||||
if type(min) == 'function' then min = min() end
|
||||
if type(max) == 'function' then max = max() end
|
||||
|
||||
if min then
|
||||
if step then
|
||||
value = math_floor((value - min) / step + 0.5) * step + min
|
||||
@@ -1097,6 +1083,11 @@ local function InjectInfo(control, options, option, path, rootframe, appName)
|
||||
control:SetCallback("OnRelease", CleanUserData)
|
||||
control:SetCallback("OnLeave", OptionOnMouseLeave)
|
||||
control:SetCallback("OnEnter", OptionOnMouseOver)
|
||||
|
||||
-- forward custom arg data directly
|
||||
if control.SetCustomData and option.arg then
|
||||
safecall(control.SetCustomData, control, option.arg)
|
||||
end
|
||||
end
|
||||
|
||||
local function CreateControl(userControlType, fallbackControlType)
|
||||
@@ -1117,11 +1108,6 @@ local function sortTblAsStrings(x,y)
|
||||
return tostring(x) < tostring(y) -- Support numbers as keys
|
||||
end
|
||||
|
||||
-- added by ElvUI
|
||||
local function sortTblByValue(x,y)
|
||||
return x[2] < y[2]
|
||||
end
|
||||
|
||||
--[[
|
||||
options - root of the options table being fed
|
||||
container - widget that controls will be placed in
|
||||
@@ -1162,15 +1148,13 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
||||
--Control to feed
|
||||
local control
|
||||
|
||||
local name = GetOptionsMemberValue("name", v, options, path, appName)
|
||||
|
||||
if v.type == "execute" then
|
||||
|
||||
local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName)
|
||||
local image, width, height = GetOptionsMemberValue("image",v, options, path, appName)
|
||||
|
||||
local iconControl = type(image) == "string" or type(image) == "number"
|
||||
control = CreateControl(v.dialogControl or v.control, iconControl and "Icon" or "Button-ElvUI")
|
||||
control = CreateControl(v.dialogControl or v.control, iconControl and "Icon" or "Button")
|
||||
if iconControl then
|
||||
if not width then
|
||||
width = GetOptionsMemberValue("imageWidth",v, options, path, appName)
|
||||
@@ -1213,11 +1197,6 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
||||
elseif v.type == "toggle" then
|
||||
control = CreateControl(v.dialogControl or v.control, "CheckBox")
|
||||
control:SetLabel(name)
|
||||
control.textWidth = GetOptionsMemberValue("textWidth",v,options,path,appName)
|
||||
if control.textWidth and control.frame and control.text then
|
||||
local textWidth = control.text:GetWidth()+30
|
||||
control.customWidth = (textWidth>=width_multiplier and textWidth<=width_multiplier*1.5) and textWidth
|
||||
end
|
||||
control:SetTriState(v.tristate)
|
||||
local value = GetOptionsMemberValue("get",v, options, path, appName)
|
||||
control:SetValue(value)
|
||||
@@ -1231,7 +1210,7 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
||||
local image = GetOptionsMemberValue("image", v, options, path, appName)
|
||||
local imageCoords = GetOptionsMemberValue("imageCoords", v, options, path, appName)
|
||||
|
||||
if type(image) == "string" then
|
||||
if type(image) == "string" or type(image) == "number" then
|
||||
if type(imageCoords) == "table" then
|
||||
control:SetImage(image, unpack(imageCoords))
|
||||
else
|
||||
@@ -1271,7 +1250,7 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
||||
end
|
||||
tsort(sorting, sortTblAsStrings)
|
||||
end
|
||||
for k, value in ipairs(sorting) do
|
||||
for _, value in ipairs(sorting) do
|
||||
local text = values[value]
|
||||
local radio = gui:Create("CheckBox")
|
||||
radio:SetLabel(text)
|
||||
@@ -1299,15 +1278,13 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
||||
control:DoLayout()
|
||||
else
|
||||
control = CreateControl(v.dialogControl or v.control, "Dropdown")
|
||||
local sortByValue = GetOptionsMemberValue("sortByValue",v,options,path,appName)
|
||||
|
||||
local itemType = v.itemControl
|
||||
if itemType and not gui:GetWidgetVersion(itemType) then
|
||||
geterrorhandler()(("Invalid Custom Item Type - %s"):format(tostring(itemType)))
|
||||
itemType = nil
|
||||
end
|
||||
control:SetLabel(name)
|
||||
control:SetList(values, sorting, itemType, sortByValue)
|
||||
control:SetList(values, sorting, itemType)
|
||||
local value = GetOptionsMemberValue("get",v, options, path, appName)
|
||||
if not values[value] then
|
||||
value = nil
|
||||
@@ -1319,20 +1296,14 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
||||
elseif v.type == "multiselect" then
|
||||
local values = GetOptionsMemberValue("values", v, options, path, appName)
|
||||
local disabled = CheckOptionDisabled(v, options, path, appName)
|
||||
local sortByValue = GetOptionsMemberValue("sortByValue", v, options, path, appName)
|
||||
|
||||
local valuesort = new()
|
||||
if values then
|
||||
for value, text in pairs(values) do
|
||||
tinsert(valuesort, (sortByValue and {value, text}) or value)
|
||||
tinsert(valuesort, value)
|
||||
end
|
||||
end
|
||||
|
||||
if sortByValue then
|
||||
tsort(valuesort, sortTblByValue)
|
||||
else
|
||||
tsort(valuesort)
|
||||
end
|
||||
tsort(valuesort)
|
||||
|
||||
local controlType = v.dialogControl or v.control
|
||||
if controlType then
|
||||
@@ -1361,76 +1332,42 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
||||
control:SetWidth(width_multiplier)
|
||||
end
|
||||
--check:SetTriState(v.tristate)
|
||||
for i = 1, #valuesort do
|
||||
local key = (sortByValue and valuesort[i][1]) or valuesort[i]
|
||||
for s = 1, #valuesort do
|
||||
local key = valuesort[s]
|
||||
local value = GetOptionsMemberValue("get",v, options, path, appName, key)
|
||||
control:SetItemValue(key,value)
|
||||
end
|
||||
else
|
||||
local width = GetOptionsMemberValue("width",v,options,path,appName)
|
||||
local dragdrop = GetOptionsMemberValue("dragdrop",v,options,path,appName)
|
||||
|
||||
control = gui:Create("InlineGroup")
|
||||
control:SetLayout("Flow")
|
||||
control:SetTitle(name)
|
||||
control.width = "fill"
|
||||
|
||||
control:PauseLayout()
|
||||
|
||||
for i = 1, #valuesort do
|
||||
local value = (sortByValue and valuesort[i][1]) or valuesort[i]
|
||||
local width = GetOptionsMemberValue("width",v,options,path,appName)
|
||||
for s = 1, #valuesort do
|
||||
local value = valuesort[s]
|
||||
local text = values[value]
|
||||
if dragdrop then
|
||||
local button = gui:Create("Button-ElvUI")
|
||||
button:SetDisabled(disabled)
|
||||
button:SetUserData("value", value)
|
||||
button:SetUserData("text", text)
|
||||
local state = v.stateSwitchGetText and v.stateSwitchGetText(button, text, value)
|
||||
button:SetText(format("|cFF888888%d|r %s", i, state or text))
|
||||
button.stateSwitchOnClick = v.stateSwitchOnClick
|
||||
button.dragOnMouseDown = v.dragOnMouseDown
|
||||
button.dragOnMouseUp = v.dragOnMouseUp
|
||||
button.dragOnEnter = v.dragOnEnter
|
||||
button.dragOnLeave = v.dragOnLeave
|
||||
button.dragOnClick = v.dragOnClick
|
||||
button.dragdrop = true
|
||||
button.ActivateMultiControl = ActivateMultiControl
|
||||
button.value = GetOptionsMemberValue("get",v, options, path, appName, value)
|
||||
InjectInfo(button, options, v, path, rootframe, appName)
|
||||
control:AddChild(button)
|
||||
if width == "double" then
|
||||
button:SetWidth(width_multiplier * 2)
|
||||
elseif width == "half" then
|
||||
button:SetWidth(width_multiplier / 2)
|
||||
elseif (type(width) == "number") then
|
||||
control:SetWidth(width_multiplier * width)
|
||||
elseif width == "full" then
|
||||
button.width = "fill"
|
||||
else
|
||||
button:SetWidth(width_multiplier)
|
||||
end
|
||||
local check = gui:Create("CheckBox")
|
||||
check:SetLabel(text)
|
||||
check:SetUserData("value", value)
|
||||
check:SetUserData("text", text)
|
||||
check:SetDisabled(disabled)
|
||||
check:SetTriState(v.tristate)
|
||||
check:SetValue(GetOptionsMemberValue("get",v, options, path, appName, value))
|
||||
check:SetCallback("OnValueChanged",ActivateMultiControl)
|
||||
InjectInfo(check, options, v, path, rootframe, appName)
|
||||
control:AddChild(check)
|
||||
if width == "double" then
|
||||
check:SetWidth(width_multiplier * 2)
|
||||
elseif width == "half" then
|
||||
check:SetWidth(width_multiplier / 2)
|
||||
elseif (type(width) == "number") then
|
||||
check:SetWidth(width_multiplier * width)
|
||||
elseif width == "full" then
|
||||
check.width = "fill"
|
||||
else
|
||||
local check = gui:Create("CheckBox")
|
||||
check:SetLabel(text)
|
||||
check:SetUserData("value", value)
|
||||
check:SetUserData("text", text)
|
||||
check:SetDisabled(disabled)
|
||||
check:SetTriState(v.tristate)
|
||||
check:SetValue(GetOptionsMemberValue("get",v, options, path, appName, value))
|
||||
check:SetCallback("OnValueChanged",ActivateMultiControl)
|
||||
InjectInfo(check, options, v, path, rootframe, appName)
|
||||
control:AddChild(check)
|
||||
if width == "double" then
|
||||
check:SetWidth(width_multiplier * 2)
|
||||
elseif width == "half" then
|
||||
check:SetWidth(width_multiplier / 2)
|
||||
elseif (type(width) == "number") then
|
||||
control:SetWidth(width_multiplier * width)
|
||||
elseif width == "full" then
|
||||
check.width = "fill"
|
||||
else
|
||||
check:SetWidth(width_multiplier)
|
||||
end
|
||||
check:SetWidth(width_multiplier)
|
||||
end
|
||||
end
|
||||
control:ResumeLayout()
|
||||
@@ -1442,7 +1379,7 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
||||
del(valuesort)
|
||||
|
||||
elseif v.type == "color" then
|
||||
control = CreateControl(v.dialogControl or v.control, "ColorPicker-ElvUI")
|
||||
control = CreateControl(v.dialogControl or v.control, "ColorPicker")
|
||||
control:SetLabel(name)
|
||||
control:SetHasAlpha(GetOptionsMemberValue("hasAlpha",v, options, path, appName))
|
||||
control:SetColor(GetOptionsMemberValue("get",v, options, path, appName))
|
||||
@@ -1476,7 +1413,7 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
||||
local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName)
|
||||
local image, width, height = GetOptionsMemberValue("image",v, options, path, appName)
|
||||
|
||||
if type(image) == "string" then
|
||||
if type(image) == "string" or type(image) == "number" then
|
||||
if not width then
|
||||
width = GetOptionsMemberValue("imageWidth",v, options, path, appName)
|
||||
end
|
||||
@@ -1496,29 +1433,27 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
||||
end
|
||||
control:SetImageSize(width, height)
|
||||
end
|
||||
local width = GetOptionsMemberValue("width",v,options,path,appName)
|
||||
control.width = not width and "fill"
|
||||
local controlWidth = GetOptionsMemberValue("width",v,options,path,appName)
|
||||
control.width = not controlWidth and "fill"
|
||||
end
|
||||
|
||||
--Common Init
|
||||
if control then
|
||||
local customWidth = control.customWidth or GetOptionsMemberValue("customWidth",v,options,path,appName)
|
||||
if control.width ~= "fill" or customWidth then
|
||||
if customWidth then
|
||||
control:SetWidth(customWidth)
|
||||
if control.width ~= "fill" then
|
||||
local width = GetOptionsMemberValue("width",v,options,path,appName)
|
||||
local relWidth = GetOptionsMemberValue("relWidth",v,options,path,appName)
|
||||
if width == "double" then
|
||||
control:SetWidth(width_multiplier * 2)
|
||||
elseif width == "half" then
|
||||
control:SetWidth(width_multiplier / 2)
|
||||
elseif (type(width) == "number") then
|
||||
control:SetWidth(width_multiplier * width)
|
||||
elseif width == "relative" and relWidth then
|
||||
control:SetRelativeWidth(relWidth)
|
||||
elseif width == "full" then
|
||||
control.width = "fill"
|
||||
else
|
||||
local width = GetOptionsMemberValue("width",v,options,path,appName)
|
||||
if width == "double" then
|
||||
control:SetWidth(width_multiplier * 2)
|
||||
elseif width == "half" then
|
||||
control:SetWidth(width_multiplier / 2)
|
||||
elseif (type(width) == "number") then
|
||||
control:SetWidth(width_multiplier * width)
|
||||
elseif width == "full" then
|
||||
control.width = "fill"
|
||||
else
|
||||
control:SetWidth(width_multiplier)
|
||||
end
|
||||
control:SetWidth(width_multiplier)
|
||||
end
|
||||
end
|
||||
if control.SetDisabled then
|
||||
@@ -1554,6 +1489,7 @@ local function TreeOnButtonEnter(widget, event, uniquevalue, button)
|
||||
local option = user.option
|
||||
local path = user.path
|
||||
local appName = user.appName
|
||||
local tooltip = AceConfigDialog.tooltip
|
||||
|
||||
local feedpath = new()
|
||||
for i = 1, #path do
|
||||
@@ -1570,24 +1506,25 @@ local function TreeOnButtonEnter(widget, event, uniquevalue, button)
|
||||
local name = GetOptionsMemberValue("name", group, options, feedpath, appName)
|
||||
local desc = GetOptionsMemberValue("desc", group, options, feedpath, appName)
|
||||
|
||||
if type(desc) == "string" then
|
||||
GameTooltip:SetOwner(button, "ANCHOR_CURSOR")
|
||||
if widget.type == "TabGroup" then
|
||||
GameTooltip:SetPoint("BOTTOM",button,"TOP")
|
||||
else
|
||||
GameTooltip:SetPoint("LEFT",button,"RIGHT")
|
||||
end
|
||||
|
||||
GameTooltip:SetText(name, 1, .82, 0, 1)
|
||||
|
||||
GameTooltip:AddLine(desc, 1, 1, 1, 1)
|
||||
|
||||
GameTooltip:Show()
|
||||
tooltip:SetOwner(button, "ANCHOR_NONE")
|
||||
tooltip:ClearAllPoints()
|
||||
if widget.type == "TabGroup" then
|
||||
tooltip:SetPoint("BOTTOM",button,"TOP")
|
||||
else
|
||||
tooltip:SetPoint("LEFT",button,"RIGHT")
|
||||
end
|
||||
|
||||
tooltip:SetText(name, 1, .82, 0, 1, true)
|
||||
|
||||
if type(desc) == "string" then
|
||||
tooltip:AddLine(desc, 1, 1, 1, true)
|
||||
end
|
||||
|
||||
tooltip:Show()
|
||||
end
|
||||
|
||||
local function TreeOnButtonLeave(widget, event, value, button)
|
||||
GameTooltip:Hide()
|
||||
AceConfigDialog.tooltip:Hide()
|
||||
end
|
||||
|
||||
|
||||
@@ -1755,29 +1692,29 @@ function AceConfigDialog:FeedGroup(appName,options,container,rootframe,path, isR
|
||||
|
||||
elseif grouptype == "select" then
|
||||
|
||||
local select = gui:Create("DropdownGroup")
|
||||
select:SetTitle(name)
|
||||
InjectInfo(select, options, group, path, rootframe, appName)
|
||||
select:SetCallback("OnGroupSelected", GroupSelected)
|
||||
local selectGroup = gui:Create("DropdownGroup")
|
||||
selectGroup:SetTitle(name)
|
||||
InjectInfo(selectGroup, options, group, path, rootframe, appName)
|
||||
selectGroup:SetCallback("OnGroupSelected", GroupSelected)
|
||||
local status = AceConfigDialog:GetStatusTable(appName, path)
|
||||
if not status.groups then
|
||||
status.groups = {}
|
||||
end
|
||||
select:SetStatusTable(status.groups)
|
||||
selectGroup:SetStatusTable(status.groups)
|
||||
local grouplist, orderlist = BuildSelect(group, options, path, appName)
|
||||
select:SetGroupList(grouplist, orderlist)
|
||||
select:SetUserData("grouplist", grouplist)
|
||||
select:SetUserData("orderlist", orderlist)
|
||||
selectGroup:SetGroupList(grouplist, orderlist)
|
||||
selectGroup:SetUserData("grouplist", grouplist)
|
||||
selectGroup:SetUserData("orderlist", orderlist)
|
||||
|
||||
local firstgroup = orderlist[1]
|
||||
if firstgroup then
|
||||
select:SetGroup((GroupExists(appName, options, path,status.groups.selected) and status.groups.selected) or firstgroup)
|
||||
selectGroup:SetGroup((GroupExists(appName, options, path,status.groups.selected) and status.groups.selected) or firstgroup)
|
||||
end
|
||||
|
||||
select.width = "fill"
|
||||
select.height = "fill"
|
||||
selectGroup.width = "fill"
|
||||
selectGroup.height = "fill"
|
||||
|
||||
container:AddChild(select)
|
||||
container:AddChild(selectGroup)
|
||||
|
||||
--assume tree group by default
|
||||
--if parenttype is tree then this group is already a node on that tree
|
||||
@@ -2005,17 +1942,19 @@ end
|
||||
-- convert pre-39 BlizOptions structure to the new format
|
||||
if oldminor and oldminor < 39 and AceConfigDialog.BlizOptions then
|
||||
local old = AceConfigDialog.BlizOptions
|
||||
local new = {}
|
||||
local newOpt = {}
|
||||
for key, widget in pairs(old) do
|
||||
local appName = widget:GetUserData("appName")
|
||||
if not new[appName] then new[appName] = {} end
|
||||
new[appName][key] = widget
|
||||
if not newOpt[appName] then newOpt[appName] = {} end
|
||||
newOpt[appName][key] = widget
|
||||
end
|
||||
AceConfigDialog.BlizOptions = new
|
||||
AceConfigDialog.BlizOptions = newOpt
|
||||
else
|
||||
AceConfigDialog.BlizOptions = AceConfigDialog.BlizOptions or {}
|
||||
end
|
||||
|
||||
AceConfigDialog.BlizOptionsIDMap = AceConfigDialog.BlizOptionsIDMap or {}
|
||||
|
||||
local function FeedToBlizPanel(widget, event)
|
||||
local path = widget:GetUserData("path")
|
||||
AceConfigDialog:Open(widget:GetUserData("appName"), widget, unpack(path or emptyTbl))
|
||||
@@ -2037,15 +1976,17 @@ end
|
||||
-- has to be a head-level note.
|
||||
--
|
||||
-- This function returns a reference to the container frame registered with the Interface
|
||||
-- Options. You can use this reference to open the options with the API function
|
||||
-- `InterfaceOptionsFrame_OpenToCategory`.
|
||||
-- Options, as well as the registered ID. You can use the ID to open the options with
|
||||
-- the API function `Settings.OpenToCategory`.
|
||||
-- @param appName The application name as given to `:RegisterOptionsTable()`
|
||||
-- @param name A descriptive name to display in the options tree (defaults to appName)
|
||||
-- @param parent The parent to use in the interface options tree.
|
||||
-- @param ... The path in the options table to feed into the interface options panel.
|
||||
-- @return The reference to the frame registered into the Interface Options.
|
||||
-- @return The category ID to pass to Settings.OpenToCategory
|
||||
function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...)
|
||||
local BlizOptions = AceConfigDialog.BlizOptions
|
||||
local BlizOptionsIDMap = AceConfigDialog.BlizOptionsIDMap
|
||||
|
||||
local key = appName
|
||||
for n = 1, select("#", ...) do
|
||||
@@ -2059,7 +2000,6 @@ function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...)
|
||||
if not BlizOptions[appName][key] then
|
||||
local group = gui:Create("BlizOptionsGroup")
|
||||
BlizOptions[appName][key] = group
|
||||
group:SetName(name or appName, parent)
|
||||
|
||||
group:SetTitle(name or appName)
|
||||
group:SetUserData("appName", appName)
|
||||
@@ -2072,8 +2012,33 @@ function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...)
|
||||
end
|
||||
group:SetCallback("OnShow", FeedToBlizPanel)
|
||||
group:SetCallback("OnHide", ClearBlizPanel)
|
||||
InterfaceOptions_AddCategory(group.frame)
|
||||
return group.frame
|
||||
|
||||
local categoryName = name or appName
|
||||
if parent then
|
||||
local parentID = BlizOptionsIDMap[parent] or parent
|
||||
local category = Settings.GetCategory(parentID)
|
||||
if not category then
|
||||
error(("The parent category '%s' was not found"):format(parent), 2)
|
||||
end
|
||||
local subcategory = Settings.RegisterCanvasLayoutSubcategory(category, group.frame, categoryName)
|
||||
group:SetName(subcategory.ID, parentID)
|
||||
else
|
||||
if BlizOptionsIDMap[categoryName] then
|
||||
error(("%s has already been added to the Blizzard Options Window with the given name: %s"):format(appName, categoryName), 2)
|
||||
end
|
||||
|
||||
local category = Settings.RegisterCanvasLayoutCategory(group.frame, categoryName)
|
||||
if not (C_SettingsUtil and C_SettingsUtil.OpenSettingsPanel) then
|
||||
-- override the ID so the name can be used in Settings.OpenToCategory
|
||||
-- unfortunately with incoming API changes in 12.0 (and likely classic at some point) this override is no longer possible
|
||||
category.ID = categoryName
|
||||
end
|
||||
group:SetName(category.ID)
|
||||
BlizOptionsIDMap[categoryName] = category.ID
|
||||
Settings.RegisterAddOnCategory(category)
|
||||
end
|
||||
|
||||
return group.frame, group.frame.name
|
||||
else
|
||||
error(("%s has already been added to the Blizzard Options Window with the given path"):format(appName), 2)
|
||||
end
|
||||
|
||||
+13
-24
@@ -11,7 +11,7 @@
|
||||
-- @release $Id$
|
||||
local CallbackHandler = LibStub("CallbackHandler-1.0")
|
||||
|
||||
local MAJOR, MINOR = "AceConfigRegistry-3.0-ElvUI", 20
|
||||
local MAJOR, MINOR = "AceConfigRegistry-3.0", 22
|
||||
local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceConfigRegistry then return end
|
||||
@@ -57,8 +57,8 @@ local istable={["table"]=true, _="table"}
|
||||
local ismethodtable={["table"]=true,["string"]=true,["function"]=true, _="methodname, funcref or table"}
|
||||
local optstring={["nil"]=true,["string"]=true, _="string"}
|
||||
local optstringfunc={["nil"]=true,["string"]=true,["function"]=true, _="string or funcref"}
|
||||
local optstringnumberfunc={["nil"]=true,["string"]=true,["number"]=true,["function"]=true, _="string, number or funcref"}
|
||||
local optnumber={["nil"]=true,["number"]=true, _="number"}
|
||||
local optnumberfunc={["nil"]=true,["number"]=true,["function"]=true,_="number"} -- added by ElvUI for range
|
||||
local optmethodfalse={["nil"]=true,["string"]=true,["function"]=true,["boolean"]={[false]=true}, _="methodname, funcref or false"}
|
||||
local optmethodnumber={["nil"]=true,["string"]=true,["function"]=true,["number"]=true, _="methodname, funcref or number"}
|
||||
local optmethodtable={["nil"]=true,["string"]=true,["function"]=true,["table"]=true, _="methodname, funcref or table"}
|
||||
@@ -75,7 +75,6 @@ local basekeys={
|
||||
descStyle=optstring,
|
||||
order=optmethodnumber,
|
||||
validate=optmethodfalse,
|
||||
validatePopup=optbool, --ElvUI
|
||||
confirm=optmethodbool,
|
||||
confirmText=optstring,
|
||||
disabled=optmethodbool,
|
||||
@@ -84,7 +83,8 @@ local basekeys={
|
||||
dialogHidden=optmethodbool,
|
||||
dropdownHidden=optmethodbool,
|
||||
cmdHidden=optmethodbool,
|
||||
icon=optstringfunc,
|
||||
tooltipHyperlink=optstringfunc,
|
||||
icon=optstringnumberfunc,
|
||||
iconCoords=optmethodtable,
|
||||
handler=opttable,
|
||||
get=optmethodfalse,
|
||||
@@ -92,18 +92,7 @@ local basekeys={
|
||||
func=optmethodfalse,
|
||||
arg={["*"]=true},
|
||||
width=optstringnumber,
|
||||
-- below here were created by ElvUI --
|
||||
customWidth=optnumber,
|
||||
textWidth=optmethodbool,
|
||||
sortByValue=optmethodbool,
|
||||
dragdrop=optmethodbool,
|
||||
dragOnEnter=optmethodfalse,
|
||||
dragOnLeave=optmethodfalse,
|
||||
dragOnClick=optmethodfalse,
|
||||
dragOnMouseUp=optmethodfalse,
|
||||
dragOnMouseDown=optmethodfalse,
|
||||
stateSwitchOnClick=optmethodfalse,
|
||||
stateSwitchGetText=optmethodfalse,
|
||||
relWidth=optnumber,
|
||||
}
|
||||
|
||||
local typedkeys={
|
||||
@@ -113,7 +102,7 @@ local typedkeys={
|
||||
dropdownControl=optstring,
|
||||
},
|
||||
description={
|
||||
image=optstringfunc,
|
||||
image=optstringnumberfunc,
|
||||
imageCoords=optmethodtable,
|
||||
imageHeight=optnumber,
|
||||
imageWidth=optnumber,
|
||||
@@ -133,7 +122,7 @@ local typedkeys={
|
||||
childGroups=optstring,
|
||||
},
|
||||
execute={
|
||||
image=optstringfunc,
|
||||
image=optstringnumberfunc,
|
||||
imageCoords=optmethodtable,
|
||||
imageHeight=optnumber,
|
||||
imageWidth=optnumber,
|
||||
@@ -151,7 +140,7 @@ local typedkeys={
|
||||
},
|
||||
toggle={
|
||||
tristate=optbool,
|
||||
image=optstringfunc,
|
||||
image=optstringnumberfunc,
|
||||
imageCoords=optmethodtable,
|
||||
control=optstring,
|
||||
dialogControl=optstring,
|
||||
@@ -160,12 +149,12 @@ local typedkeys={
|
||||
tristate={
|
||||
},
|
||||
range={
|
||||
min=optnumberfunc, --ElvUI
|
||||
softMin=optnumberfunc, --ElvUI
|
||||
max=optnumberfunc, --ElvUI
|
||||
softMax=optnumberfunc, --ElvUI
|
||||
min=optnumber,
|
||||
softMin=optnumber,
|
||||
max=optnumber,
|
||||
softMax=optnumber,
|
||||
step=optnumber,
|
||||
bigStep=optnumberfunc, --ElvUI
|
||||
bigStep=optnumber,
|
||||
isPercent=optbool,
|
||||
control=optstring,
|
||||
dialogControl=optstring,
|
||||
|
||||
@@ -13,10 +13,6 @@ local pairs, next = pairs, next
|
||||
-- WoW APIs
|
||||
local UnitClass = UnitClass
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: NORMAL_FONT_COLOR_CODE, FONT_COLOR_CODE_CLOSE
|
||||
|
||||
AceDBOptions.optionTables = AceDBOptions.optionTables or {}
|
||||
AceDBOptions.handlers = AceDBOptions.handlers or {}
|
||||
|
||||
@@ -88,25 +84,25 @@ elseif LOCALE == "frFR" then
|
||||
L["reset_desc"] = "Réinitialise le profil actuel au cas où votre configuration est corrompue ou si vous voulez tout simplement faire table rase."
|
||||
L["reset_sub"] = "Réinitialise le profil actuel avec les paramètres par défaut."
|
||||
elseif LOCALE == "koKR" then
|
||||
L["choose"] = "저장 중인 프로필"
|
||||
L["choose_desc"] = "입력창에 새로운 이름을 입력하거나 저장 중인 프로필 중 하나를 선택하여 새로운 프로필을 만들 수 있습니다."
|
||||
L["choose"] = "기존 프로필"
|
||||
L["choose_desc"] = "편집 상자에 이름을 입력하여 새로운 프로필을 만들거나 이미 존재하는 프로필 중 하나를 선택할 수 있습니다."
|
||||
L["choose_sub"] = "현재 이용할 수 있는 프로필 중 하나를 선택합니다."
|
||||
L["copy"] = "복사해오기"
|
||||
L["copy_desc"] = "현재 사용 중인 프로필에 선택한 프로필의 설정을 복사합니다."
|
||||
L["copy"] = "복사해 올 프로필"
|
||||
L["copy_desc"] = "기존 프로필의 설정을 현재 활성화된 프로필로 복사합니다."
|
||||
L["current"] = "현재 프로필:"
|
||||
L["default"] = "기본값"
|
||||
L["delete"] = "프로필 삭제"
|
||||
L["delete_confirm"] = "정말로 선택한 프로필을 삭제할까요?"
|
||||
L["delete_desc"] = "저장 공간 절약과 SavedVariables 파일의 정리를 위해 데이터베이스에서 사용하지 않는 프로필을 삭제하세요."
|
||||
L["delete_sub"] = "데이터베이스의 프로필을 삭제합니다."
|
||||
L["intro"] = "활성 데이터베이스 프로필을 변경할 수 있고, 각 캐릭터 별로 다른 설정을 할 수 있습니다."
|
||||
L["delete_confirm"] = "선택한 프로필을 삭제하시겠습니까?"
|
||||
L["delete_desc"] = "데이터베이스에서 기존 프로필과 사용하지 않는 프로필을 삭제하여 공간을 절약하고 SavedVariables 파일을 정리합니다."
|
||||
L["delete_sub"] = "데이터베이스에서 프로필을 삭제합니다."
|
||||
L["intro"] = "활성 데이터베이스 프로필을 변경할 수 있으며, 모든 캐릭터마다 서로 다른 설정을 지정할 수 있습니다."
|
||||
L["new"] = "새로운 프로필"
|
||||
L["new_sub"] = "새로운 프로필을 만듭니다."
|
||||
L["new_sub"] = "비어 있는 프로필을 새로 만듭니다."
|
||||
L["profiles"] = "프로필"
|
||||
L["profiles_sub"] = "프로필 관리"
|
||||
L["reset"] = "프로필 초기화"
|
||||
L["reset_desc"] = "설정이 깨졌거나 처음부터 다시 설정을 원하는 경우, 현재 프로필을 기본값으로 초기화하세요."
|
||||
L["reset_sub"] = "현재 프로필을 기본값으로 초기화합니다"
|
||||
L["reset"] = "프로필 재설정"
|
||||
L["reset_desc"] = "구성이 손상되었거나 처음부터 다시 시작하고 싶은 경우 현재 프로필을 기본값으로 재설정하세요."
|
||||
L["reset_sub"] = "현재 프로필을 기본값으로 재설정합니다"
|
||||
elseif LOCALE == "esES" or LOCALE == "esMX" then
|
||||
L["choose"] = "Perfiles existentes"
|
||||
L["choose_desc"] = "Puedes crear un nuevo perfil introduciendo un nombre en el recuadro o puedes seleccionar un perfil de los ya existentes."
|
||||
@@ -170,31 +166,31 @@ elseif LOCALE == "zhCN" then
|
||||
elseif LOCALE == "ruRU" then
|
||||
L["choose"] = "Существующие профили"
|
||||
L["choose_desc"] = "Вы можете создать новый профиль, введя название в поле ввода, или выбрать один из уже существующих профилей."
|
||||
L["choose_sub"] = "Выбор одиного из уже доступных профилей"
|
||||
L["choose_sub"] = "Выбор одного из уже доступных профилей."
|
||||
L["copy"] = "Скопировать из"
|
||||
L["copy_desc"] = "Скопировать настройки из выбранного профиля в активный."
|
||||
L["copy_desc"] = "Копирование настроек из выбранного профиля в активный."
|
||||
L["current"] = "Текущий профиль:"
|
||||
L["default"] = "По умолчанию"
|
||||
L["delete"] = "Удалить профиль"
|
||||
L["delete_confirm"] = "Вы уверены, что вы хотите удалить выбранный профиль?"
|
||||
L["delete_desc"] = "Удалить существующий и неиспользуемый профиль из БД для сохранения места, и очистить SavedVariables файл."
|
||||
L["delete_sub"] = "Удаление профиля из БД"
|
||||
L["intro"] = "Изменяя активный профиль, вы можете задать различные настройки модификаций для каждого персонажа."
|
||||
L["delete_confirm"] = "Вы уверены, что хотите удалить выбранный профиль?"
|
||||
L["delete_desc"] = "Удаление существующего и неиспользуемого профиля из базы данных для сохранения места, и очистка файла SavedVariables."
|
||||
L["delete_sub"] = "Удаление профиля из базы данных."
|
||||
L["intro"] = "Изменяя активный профиль, Вы можете задать разные настройки для каждого персонажа."
|
||||
L["new"] = "Новый"
|
||||
L["new_sub"] = "Создать новый чистый профиль"
|
||||
L["new_sub"] = "Создание нового чистого профиля."
|
||||
L["profiles"] = "Профили"
|
||||
L["profiles_sub"] = "Управление профилями"
|
||||
L["reset"] = "Сброс профиля"
|
||||
L["reset_desc"] = "Сбросить текущий профиль к стандартным настройкам, если ваша конфигурация испорчена или вы хотите настроить всё заново."
|
||||
L["reset"] = "Сбросить профиль"
|
||||
L["reset_desc"] = "Сброс текущего профиля к стандартным настройкам, если Ваша конфигурация испорчена или Вы хотите настроить все заново."
|
||||
L["reset_sub"] = "Сброс текущего профиля на стандартный"
|
||||
elseif LOCALE == "itIT" then
|
||||
L["choose"] = "Profili Esistenti"
|
||||
L["choose_desc"] = "Puoi creare un nuovo profilo digitando il nome della casella di testo, oppure scegliendone uno tra i profili già esistenti."
|
||||
L["choose_sub"] = "Seleziona uno dei profili attualmente disponibili."
|
||||
L["copy"] = "Copia Da"
|
||||
L["copy_desc"] = "Copia le impostazioni da un profilo esistente, nel profilo attivo in questo momento."
|
||||
L["copy_desc"] = "Copia le impostazioni da un profilo esistente nel profilo attivo in questo momento."
|
||||
L["current"] = "Profilo Attivo:"
|
||||
L["default"] = "Standard"
|
||||
L["default"] = "Predefinito"
|
||||
L["delete"] = "Cancella un Profilo"
|
||||
L["delete_confirm"] = "Sei sicuro di voler cancellare il profilo selezionato?"
|
||||
L["delete_desc"] = "Cancella i profili non utilizzati dal database per risparmiare spazio e mantenere puliti i file di configurazione SavedVariables."
|
||||
|
||||
@@ -31,26 +31,21 @@ local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR)
|
||||
if not AceGUI then return end -- No upgrade needed
|
||||
|
||||
-- Lua APIs
|
||||
local tconcat, tinsert = table.concat, table.insert
|
||||
local tinsert, wipe = table.insert, table.wipe
|
||||
local select, pairs, next, type = select, pairs, next, type
|
||||
local error, assert, loadstring = error, assert, loadstring
|
||||
local setmetatable, rawget, rawset = setmetatable, rawget, rawset
|
||||
local math_max = math.max
|
||||
local error, assert = error, assert
|
||||
local setmetatable, rawget = setmetatable, rawget
|
||||
local math_max, math_min, math_ceil = math.max, math.min, math.ceil
|
||||
|
||||
-- WoW APIs
|
||||
local UIParent = UIParent
|
||||
|
||||
-- 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, LibStub
|
||||
|
||||
--local con = LibStub("AceConsole-3.0",true)
|
||||
|
||||
AceGUI.WidgetRegistry = AceGUI.WidgetRegistry or {}
|
||||
AceGUI.LayoutRegistry = AceGUI.LayoutRegistry or {}
|
||||
AceGUI.WidgetBase = AceGUI.WidgetBase or {}
|
||||
AceGUI.WidgetContainerBase = AceGUI.WidgetContainerBase or {}
|
||||
AceGUI.WidgetVersions = AceGUI.WidgetVersions or {}
|
||||
AceGUI.tooltip = AceGUI.tooltip or CreateFrame("GameTooltip", "AceGUITooltip", UIParent, "GameTooltipTemplate")
|
||||
|
||||
-- local upvalues
|
||||
local WidgetRegistry = AceGUI.WidgetRegistry
|
||||
@@ -66,39 +61,10 @@ local function errorhandler(err)
|
||||
return geterrorhandler()(err)
|
||||
end
|
||||
|
||||
local function CreateDispatcher(argCount)
|
||||
local code = [[
|
||||
local xpcall, eh = ...
|
||||
local method, ARGS
|
||||
local function call() return method(ARGS) end
|
||||
|
||||
local function dispatch(func, ...)
|
||||
method = func
|
||||
if not method then return end
|
||||
ARGS = ...
|
||||
return xpcall(call, eh)
|
||||
end
|
||||
|
||||
return dispatch
|
||||
]]
|
||||
|
||||
local ARGS = {}
|
||||
for i = 1, argCount do ARGS[i] = "arg"..i end
|
||||
code = code:gsub("ARGS", tconcat(ARGS, ", "))
|
||||
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(xpcall, errorhandler)
|
||||
end
|
||||
|
||||
local Dispatchers = setmetatable({}, {__index=function(self, argCount)
|
||||
local dispatcher = CreateDispatcher(argCount)
|
||||
rawset(self, argCount, dispatcher)
|
||||
return dispatcher
|
||||
end})
|
||||
Dispatchers[0] = function(func)
|
||||
return xpcall(func, errorhandler)
|
||||
end
|
||||
|
||||
local function safecall(func, ...)
|
||||
return Dispatchers[select("#", ...)](func, ...)
|
||||
if func then
|
||||
return xpcall(func, errorhandler, ...)
|
||||
end
|
||||
end
|
||||
|
||||
-- Recycling functions
|
||||
@@ -122,38 +88,38 @@ do
|
||||
AceGUI.objPools = AceGUI.objPools or {}
|
||||
local objPools = AceGUI.objPools
|
||||
--Returns a new instance, if none are available either returns a new table or calls the given contructor
|
||||
function newWidget(type)
|
||||
if not WidgetRegistry[type] then
|
||||
function newWidget(widgetType)
|
||||
if not WidgetRegistry[widgetType] then
|
||||
error("Attempt to instantiate unknown widget type", 2)
|
||||
end
|
||||
|
||||
if not objPools[type] then
|
||||
objPools[type] = {}
|
||||
if not objPools[widgetType] then
|
||||
objPools[widgetType] = {}
|
||||
end
|
||||
|
||||
local newObj = next(objPools[type])
|
||||
local newObj = next(objPools[widgetType])
|
||||
if not newObj then
|
||||
newObj = WidgetRegistry[type]()
|
||||
newObj.AceGUIWidgetVersion = WidgetVersions[type]
|
||||
newObj = WidgetRegistry[widgetType]()
|
||||
newObj.AceGUIWidgetVersion = WidgetVersions[widgetType]
|
||||
else
|
||||
objPools[type][newObj] = nil
|
||||
objPools[widgetType][newObj] = nil
|
||||
-- if the widget is older then the latest, don't even try to reuse it
|
||||
-- just forget about it, and grab a new one.
|
||||
if not newObj.AceGUIWidgetVersion or newObj.AceGUIWidgetVersion < WidgetVersions[type] then
|
||||
return newWidget(type)
|
||||
if not newObj.AceGUIWidgetVersion or newObj.AceGUIWidgetVersion < WidgetVersions[widgetType] then
|
||||
return newWidget(widgetType)
|
||||
end
|
||||
end
|
||||
return newObj
|
||||
end
|
||||
-- Releases an instance to the Pool
|
||||
function delWidget(obj,type)
|
||||
if not objPools[type] then
|
||||
objPools[type] = {}
|
||||
function delWidget(obj,widgetType)
|
||||
if not objPools[widgetType] then
|
||||
objPools[widgetType] = {}
|
||||
end
|
||||
if objPools[type][obj] then
|
||||
if objPools[widgetType][obj] then
|
||||
error("Attempt to Release Widget that is already released", 2)
|
||||
end
|
||||
objPools[type][obj] = true
|
||||
objPools[widgetType][obj] = true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -169,9 +135,9 @@ end
|
||||
-- OnAcquire function on it, before returning.
|
||||
-- @param type The type of the widget.
|
||||
-- @return The newly created widget.
|
||||
function AceGUI:Create(type)
|
||||
if WidgetRegistry[type] then
|
||||
local widget = newWidget(type)
|
||||
function AceGUI:Create(widgetType)
|
||||
if WidgetRegistry[widgetType] then
|
||||
local widget = newWidget(widgetType)
|
||||
|
||||
if rawget(widget, "Acquire") then
|
||||
widget.OnAcquire = widget.Acquire
|
||||
@@ -189,7 +155,7 @@ function AceGUI:Create(type)
|
||||
if widget.OnAcquire then
|
||||
widget:OnAcquire()
|
||||
else
|
||||
error(("Widget type %s doesn't supply an OnAcquire Function"):format(type))
|
||||
error(("Widget type %s doesn't supply an OnAcquire Function"):format(widgetType))
|
||||
end
|
||||
-- Set the default Layout ("List")
|
||||
safecall(widget.SetLayout, widget, "List")
|
||||
@@ -617,25 +583,25 @@ AceGUI.counts = AceGUI.counts or {}
|
||||
-- This is used by widgets that require a named frame, e.g. when a Blizzard
|
||||
-- Template requires it.
|
||||
-- @param type The widget type
|
||||
function AceGUI:GetNextWidgetNum(type)
|
||||
if not self.counts[type] then
|
||||
self.counts[type] = 0
|
||||
function AceGUI:GetNextWidgetNum(widgetType)
|
||||
if not self.counts[widgetType] then
|
||||
self.counts[widgetType] = 0
|
||||
end
|
||||
self.counts[type] = self.counts[type] + 1
|
||||
return self.counts[type]
|
||||
self.counts[widgetType] = self.counts[widgetType] + 1
|
||||
return self.counts[widgetType]
|
||||
end
|
||||
|
||||
--- Return the number of created widgets for this type.
|
||||
-- In contrast to GetNextWidgetNum, the number is not incremented.
|
||||
-- @param type The widget type
|
||||
function AceGUI:GetWidgetCount(type)
|
||||
return self.counts[type] or 0
|
||||
-- @param widgetType The widget type
|
||||
function AceGUI:GetWidgetCount(widgetType)
|
||||
return self.counts[widgetType] or 0
|
||||
end
|
||||
|
||||
--- Return the version of the currently registered widget type.
|
||||
-- @param type The widget type
|
||||
function AceGUI:GetWidgetVersion(type)
|
||||
return WidgetVersions[type]
|
||||
-- @param widgetType The widget type
|
||||
function AceGUI:GetWidgetVersion(widgetType)
|
||||
return WidgetVersions[widgetType]
|
||||
end
|
||||
|
||||
-------------
|
||||
@@ -798,7 +764,6 @@ AceGUI:RegisterLayout("Flow",
|
||||
|
||||
usedwidth = 0
|
||||
rowstart = frame
|
||||
rowstartoffset = frameoffset
|
||||
|
||||
if child.DoLayout then
|
||||
child:DoLayout()
|
||||
@@ -841,7 +806,8 @@ local GetCellAlign = function (dir, tableObj, colObj, cellObj, cell, child)
|
||||
or colObj and (colObj["align" .. dir] or colObj.align)
|
||||
or tableObj["align" .. dir] or tableObj.align
|
||||
or "CENTERLEFT"
|
||||
local child, cell, val = child or 0, cell or 0, nil
|
||||
local val
|
||||
child, cell = child or 0, cell or 0
|
||||
|
||||
if type(fn) == "string" then
|
||||
fn = fn:lower()
|
||||
@@ -855,7 +821,7 @@ local GetCellAlign = function (dir, tableObj, colObj, cellObj, cell, child)
|
||||
val = fn
|
||||
end
|
||||
|
||||
return fn, max(0, min(val, cell))
|
||||
return fn, math_max(0, math_min(val, cell))
|
||||
end
|
||||
|
||||
-- Get width or height for multiple cells combined
|
||||
@@ -864,7 +830,7 @@ local GetCellDimension = function (dir, laneDim, from, to, space)
|
||||
for cell=from,to do
|
||||
dim = dim + (laneDim[cell] or 0)
|
||||
end
|
||||
return dim + max(0, to - from) * (space or 0)
|
||||
return dim + math_max(0, to - from) * (space or 0)
|
||||
end
|
||||
|
||||
--[[ Options
|
||||
@@ -910,7 +876,7 @@ AceGUI:RegisterLayout("Table",
|
||||
repeat
|
||||
n = n + 1
|
||||
local col = (n - 1) % #cols + 1
|
||||
local row = ceil(n / #cols)
|
||||
local row = math_ceil(n / #cols)
|
||||
local rowspan = rowspans[col]
|
||||
local cell = rowspan and rowspan.child or child
|
||||
local cellObj = cell:GetUserData("cell")
|
||||
@@ -926,7 +892,7 @@ AceGUI:RegisterLayout("Table",
|
||||
end
|
||||
|
||||
-- Colspan
|
||||
local colspan = max(0, min((cellObj and cellObj.colspan or 1) - 1, #cols - col))
|
||||
local colspan = math_max(0, math_min((cellObj and cellObj.colspan or 1) - 1, #cols - col))
|
||||
n = n + colspan
|
||||
|
||||
-- Place the cell
|
||||
@@ -943,7 +909,7 @@ AceGUI:RegisterLayout("Table",
|
||||
end
|
||||
end
|
||||
|
||||
local rows = ceil(n / #cols)
|
||||
local rows = math_ceil(n / #cols)
|
||||
|
||||
-- Determine fixed size cols and collect weights
|
||||
local extantH, totalWeight = totalH, 0
|
||||
@@ -968,16 +934,16 @@ AceGUI:RegisterLayout("Table",
|
||||
f:ClearAllPoints()
|
||||
local childH = f:GetWidth() or 0
|
||||
|
||||
laneH[col] = max(laneH[col], childH - GetCellDimension("H", laneH, colStart[child], col - 1, spaceH))
|
||||
laneH[col] = math_max(laneH[col], childH - GetCellDimension("H", laneH, colStart[child], col - 1, spaceH))
|
||||
end
|
||||
end
|
||||
|
||||
laneH[col] = max(colObj.min or colObj[1] or 0, min(laneH[col], colObj.max or colObj[2] or laneH[col]))
|
||||
laneH[col] = math_max(colObj.min or colObj[1] or 0, math_min(laneH[col], colObj.max or colObj[2] or laneH[col]))
|
||||
else
|
||||
-- Rel./Abs. width
|
||||
laneH[col] = colObj.width < 1 and colObj.width * totalH or colObj.width
|
||||
end
|
||||
extantH = max(0, extantH - laneH[col])
|
||||
extantH = math_max(0, extantH - laneH[col])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1016,7 +982,7 @@ AceGUI:RegisterLayout("Table",
|
||||
child:DoLayout()
|
||||
end
|
||||
|
||||
rowV = max(rowV, (f:GetHeight() or 0) - GetCellDimension("V", laneV, rowStart[child], row - 1, spaceV))
|
||||
rowV = math_max(rowV, (f:GetHeight() or 0) - GetCellDimension("V", laneV, rowStart[child], row - 1, spaceV))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
<Script file="widgets\AceGUIContainer-Window.lua"/>
|
||||
<!-- Widgets -->
|
||||
<Script file="widgets\AceGUIWidget-Button.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-Button-ElvUI.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-CheckBox.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-ColorPicker.lua"/>
|
||||
<Script file="widgets\AceGUIWidget-DropDown.lua"/>
|
||||
|
||||
+7
-2
@@ -2,7 +2,7 @@
|
||||
BlizOptionsGroup Container
|
||||
Simple container widget for the integration of AceGUI into the Blizzard Interface Options
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "BlizOptionsGroup", 21
|
||||
local Type, Version = "BlizOptionsGroup", 26
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
@@ -99,7 +99,7 @@ local methods = {
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Frame")
|
||||
local frame = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer)
|
||||
frame:Hide()
|
||||
|
||||
-- support functions for the Blizzard Interface Options
|
||||
@@ -108,6 +108,11 @@ local function Constructor()
|
||||
frame.default = default
|
||||
frame.refresh = refresh
|
||||
|
||||
-- 10.0 support function aliases (cancel has been removed)
|
||||
frame.OnCommit = okay
|
||||
frame.OnDefault = default
|
||||
frame.OnRefresh = refresh
|
||||
|
||||
frame:SetScript("OnHide", OnHide)
|
||||
frame:SetScript("OnShow", OnShow)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
DropdownGroup Container
|
||||
Container controlled by a dropdown on the top.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "DropdownGroup", 21
|
||||
local Type, Version = "DropdownGroup", 22
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
@@ -125,7 +125,7 @@ local function Constructor()
|
||||
dropdown.frame:Show()
|
||||
dropdown:SetLabel("")
|
||||
|
||||
local border = CreateFrame("Frame", nil, frame)
|
||||
local border = CreateFrame("Frame", nil, frame, "BackdropTemplate")
|
||||
border:SetPoint("TOPLEFT", 0, -26)
|
||||
border:SetPoint("BOTTOMRIGHT", 0, 3)
|
||||
border:SetBackdrop(PaneBackdrop)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Frame Container
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "Frame", 25
|
||||
local Type, Version = "Frame", 30
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
@@ -13,15 +13,11 @@ local wipe = table.wipe
|
||||
local PlaySound = PlaySound
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: CLOSE
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Button_OnClick(frame)
|
||||
PlaySound("gsTitleOptionExit")
|
||||
PlaySound(799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT
|
||||
frame.obj:Hide()
|
||||
end
|
||||
|
||||
@@ -83,6 +79,7 @@ local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self.frame:SetParent(UIParent)
|
||||
self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
self.frame:SetFrameLevel(100) -- Lots of room to draw under it
|
||||
self:SetTitle()
|
||||
self:SetStatusText()
|
||||
self:ApplyStatus()
|
||||
@@ -179,16 +176,21 @@ local PaneBackdrop = {
|
||||
}
|
||||
|
||||
local function Constructor()
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
local frame = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
|
||||
frame:Hide()
|
||||
|
||||
frame:EnableMouse(true)
|
||||
frame:SetMovable(true)
|
||||
frame:SetResizable(true)
|
||||
frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||
frame:SetFrameLevel(100) -- Lots of room to draw under it
|
||||
frame:SetBackdrop(FrameBackdrop)
|
||||
frame:SetBackdropColor(0, 0, 0, 1)
|
||||
frame:SetMinResize(400, 200)
|
||||
if frame.SetResizeBounds then -- WoW 10.0
|
||||
frame:SetResizeBounds(400, 200)
|
||||
else
|
||||
frame:SetMinResize(400, 200)
|
||||
end
|
||||
frame:SetToplevel(true)
|
||||
frame:SetScript("OnShow", Frame_OnShow)
|
||||
frame:SetScript("OnHide", Frame_OnClose)
|
||||
@@ -201,7 +203,7 @@ local function Constructor()
|
||||
closebutton:SetWidth(100)
|
||||
closebutton:SetText(CLOSE)
|
||||
|
||||
local statusbg = CreateFrame("Button", nil, frame)
|
||||
local statusbg = CreateFrame("Button", nil, frame, "BackdropTemplate")
|
||||
statusbg:SetPoint("BOTTOMLEFT", 15, 15)
|
||||
statusbg:SetPoint("BOTTOMRIGHT", -132, 15)
|
||||
statusbg:SetHeight(24)
|
||||
@@ -269,7 +271,7 @@ local function Constructor()
|
||||
line2:SetHeight(8)
|
||||
line2:SetPoint("BOTTOMRIGHT", -8, 8)
|
||||
line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
|
||||
local x = 0.1 * 8/17
|
||||
x = 0.1 * 8/17
|
||||
line2:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
|
||||
|
||||
local sizer_s = CreateFrame("Frame", nil, frame)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
InlineGroup Container
|
||||
Simple container widget that creates a visible "box" with an optional title.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "InlineGroup", 21
|
||||
local Type, Version = "InlineGroup", 22
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
@@ -75,7 +75,7 @@ local function Constructor()
|
||||
titletext:SetJustifyH("LEFT")
|
||||
titletext:SetHeight(18)
|
||||
|
||||
local border = CreateFrame("Frame", nil, frame)
|
||||
local border = CreateFrame("Frame", nil, frame, "BackdropTemplate")
|
||||
border:SetPoint("TOPLEFT", 0, -17)
|
||||
border:SetPoint("BOTTOMRIGHT", -1, 3)
|
||||
border:SetBackdrop(PaneBackdrop)
|
||||
|
||||
@@ -187,7 +187,7 @@ local function Constructor()
|
||||
|
||||
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
|
||||
scrollbg:SetAllPoints(scrollbar)
|
||||
scrollbg:SetTexture(0, 0, 0, 0.4)
|
||||
scrollbg:SetColorTexture(0, 0, 0, 0.4)
|
||||
|
||||
--Container Support
|
||||
local content = CreateFrame("Frame", nil, scrollframe)
|
||||
|
||||
@@ -2,22 +2,18 @@
|
||||
TabGroup Container
|
||||
Container that uses tabs on top to switch between groups.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "TabGroup", 31
|
||||
local Type, Version = "TabGroup", 38
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs, ipairs, assert, type, wipe = pairs, ipairs, assert, type, wipe
|
||||
local pairs, ipairs, assert, type, wipe = pairs, ipairs, assert, type, table.wipe
|
||||
|
||||
-- WoW APIs
|
||||
local PlaySound = PlaySound
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
local _G = _G
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: PanelTemplates_TabResize, PanelTemplates_SetDisabledTabState, PanelTemplates_SelectTab, PanelTemplates_DeselectTab
|
||||
|
||||
-- local upvalue storage used by BuildTabs
|
||||
local widths = {}
|
||||
local rowwidths = {}
|
||||
@@ -26,6 +22,143 @@ local rowends = {}
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
|
||||
local function PanelTemplates_TabResize(tab, padding, absoluteSize, minWidth, maxWidth, absoluteTextSize)
|
||||
local tabName = tab:GetName();
|
||||
|
||||
local buttonMiddle = tab.Middle or tab.middleTexture or _G[tabName.."Middle"];
|
||||
local buttonMiddleDisabled = tab.MiddleDisabled or (tabName and _G[tabName.."MiddleDisabled"]);
|
||||
local left = tab.Left or tab.leftTexture or _G[tabName.."Left"];
|
||||
local sideWidths = 2 * left:GetWidth();
|
||||
local tabText = tab.Text or _G[tab:GetName().."Text"];
|
||||
local highlightTexture = tab.HighlightTexture or (tabName and _G[tabName.."HighlightTexture"]);
|
||||
|
||||
local width, tabWidth;
|
||||
local textWidth;
|
||||
if ( absoluteTextSize ) then
|
||||
textWidth = absoluteTextSize;
|
||||
else
|
||||
tabText:SetWidth(0);
|
||||
textWidth = tabText:GetWidth();
|
||||
end
|
||||
-- If there's an absolute size specified then use it
|
||||
if ( absoluteSize ) then
|
||||
if ( absoluteSize < sideWidths) then
|
||||
width = 1;
|
||||
tabWidth = sideWidths
|
||||
else
|
||||
width = absoluteSize - sideWidths;
|
||||
tabWidth = absoluteSize
|
||||
end
|
||||
tabText:SetWidth(width);
|
||||
else
|
||||
-- Otherwise try to use padding
|
||||
if ( padding ) then
|
||||
width = textWidth + padding;
|
||||
else
|
||||
width = textWidth + 24;
|
||||
end
|
||||
-- If greater than the maxWidth then cap it
|
||||
if ( maxWidth and width > maxWidth ) then
|
||||
if ( padding ) then
|
||||
width = maxWidth + padding;
|
||||
else
|
||||
width = maxWidth + 24;
|
||||
end
|
||||
tabText:SetWidth(width);
|
||||
else
|
||||
tabText:SetWidth(0);
|
||||
end
|
||||
if (minWidth and width < minWidth) then
|
||||
width = minWidth;
|
||||
end
|
||||
tabWidth = width + sideWidths;
|
||||
end
|
||||
|
||||
if ( buttonMiddle ) then
|
||||
buttonMiddle:SetWidth(width);
|
||||
end
|
||||
if ( buttonMiddleDisabled ) then
|
||||
buttonMiddleDisabled:SetWidth(width);
|
||||
end
|
||||
|
||||
tab:SetWidth(tabWidth);
|
||||
|
||||
if ( highlightTexture ) then
|
||||
highlightTexture:SetWidth(tabWidth);
|
||||
end
|
||||
end
|
||||
|
||||
local function PanelTemplates_DeselectTab(tab)
|
||||
local name = tab:GetName();
|
||||
|
||||
local left = tab.Left or _G[name.."Left"];
|
||||
local middle = tab.Middle or _G[name.."Middle"];
|
||||
local right = tab.Right or _G[name.."Right"];
|
||||
left:Show();
|
||||
middle:Show();
|
||||
right:Show();
|
||||
--tab:UnlockHighlight();
|
||||
tab:Enable();
|
||||
local text = tab.Text or _G[name.."Text"];
|
||||
text:SetPoint("CENTER", tab, "CENTER", (tab.deselectedTextX or 0), (tab.deselectedTextY or 2));
|
||||
|
||||
local leftDisabled = tab.LeftDisabled or _G[name.."LeftDisabled"];
|
||||
local middleDisabled = tab.MiddleDisabled or _G[name.."MiddleDisabled"];
|
||||
local rightDisabled = tab.RightDisabled or _G[name.."RightDisabled"];
|
||||
leftDisabled:Hide();
|
||||
middleDisabled:Hide();
|
||||
rightDisabled:Hide();
|
||||
end
|
||||
|
||||
local function PanelTemplates_SelectTab(tab)
|
||||
local name = tab:GetName();
|
||||
|
||||
local left = tab.Left or _G[name.."Left"];
|
||||
local middle = tab.Middle or _G[name.."Middle"];
|
||||
local right = tab.Right or _G[name.."Right"];
|
||||
left:Hide();
|
||||
middle:Hide();
|
||||
right:Hide();
|
||||
--tab:LockHighlight();
|
||||
tab:Disable();
|
||||
tab:SetDisabledFontObject(GameFontHighlightSmall);
|
||||
local text = tab.Text or _G[name.."Text"];
|
||||
text:SetPoint("CENTER", tab, "CENTER", (tab.selectedTextX or 0), (tab.selectedTextY or -3));
|
||||
|
||||
local leftDisabled = tab.LeftDisabled or _G[name.."LeftDisabled"];
|
||||
local middleDisabled = tab.MiddleDisabled or _G[name.."MiddleDisabled"];
|
||||
local rightDisabled = tab.RightDisabled or _G[name.."RightDisabled"];
|
||||
leftDisabled:Show();
|
||||
middleDisabled:Show();
|
||||
rightDisabled:Show();
|
||||
|
||||
if GameTooltip:IsOwned(tab) then
|
||||
GameTooltip:Hide();
|
||||
end
|
||||
end
|
||||
|
||||
local function PanelTemplates_SetDisabledTabState(tab)
|
||||
local name = tab:GetName();
|
||||
local left = tab.Left or _G[name.."Left"];
|
||||
local middle = tab.Middle or _G[name.."Middle"];
|
||||
local right = tab.Right or _G[name.."Right"];
|
||||
left:Show();
|
||||
middle:Show();
|
||||
right:Show();
|
||||
--tab:UnlockHighlight();
|
||||
tab:Disable();
|
||||
tab.text = tab:GetText();
|
||||
-- Gray out text
|
||||
tab:SetDisabledFontObject(GameFontDisableSmall);
|
||||
local leftDisabled = tab.LeftDisabled or _G[name.."LeftDisabled"];
|
||||
local middleDisabled = tab.MiddleDisabled or _G[name.."MiddleDisabled"];
|
||||
local rightDisabled = tab.RightDisabled or _G[name.."RightDisabled"];
|
||||
leftDisabled:Hide();
|
||||
middleDisabled:Hide();
|
||||
rightDisabled:Hide();
|
||||
end
|
||||
|
||||
local function UpdateTabLook(frame)
|
||||
if frame.disabled then
|
||||
PanelTemplates_SetDisabledTabState(frame)
|
||||
@@ -39,7 +172,7 @@ end
|
||||
local function Tab_SetText(frame, text)
|
||||
frame:_SetText(text)
|
||||
local width = frame.obj.frame.width or frame.obj.frame:GetWidth() or 0
|
||||
PanelTemplates_TabResize(frame, 0, nil, width)
|
||||
PanelTemplates_TabResize(frame, 0, nil, nil, width, frame:GetFontString():GetStringWidth())
|
||||
end
|
||||
|
||||
local function Tab_SetSelected(frame, selected)
|
||||
@@ -63,7 +196,7 @@ Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Tab_OnClick(frame)
|
||||
if not (frame.selected or frame.disabled) then
|
||||
PlaySound("igCharacterInfoTab")
|
||||
PlaySound(841) -- SOUNDKIT.IG_CHARACTER_INFO_TAB
|
||||
frame.obj:SelectTab(frame.value)
|
||||
end
|
||||
end
|
||||
@@ -103,11 +236,64 @@ local methods = {
|
||||
|
||||
["CreateTab"] = function(self, id)
|
||||
local tabname = ("AceGUITabGroup%dTab%d"):format(self.num, id)
|
||||
local tab = CreateFrame("Button", tabname, self.border, "OptionsFrameTabButtonTemplate")
|
||||
local tab = CreateFrame("Button", tabname, self.border)
|
||||
tab:SetSize(115, 24)
|
||||
tab.deselectedTextY = -3
|
||||
tab.selectedTextY = -2
|
||||
|
||||
tab.LeftDisabled = tab:CreateTexture(tabname .. "LeftDisabled", "BORDER")
|
||||
tab.LeftDisabled:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-ActiveTab")
|
||||
tab.LeftDisabled:SetSize(20, 24)
|
||||
tab.LeftDisabled:SetPoint("BOTTOMLEFT", 0, -3)
|
||||
tab.LeftDisabled:SetTexCoord(0, 0.15625, 0, 1.0)
|
||||
|
||||
tab.MiddleDisabled = tab:CreateTexture(tabname .. "MiddleDisabled", "BORDER")
|
||||
tab.MiddleDisabled:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-ActiveTab")
|
||||
tab.MiddleDisabled:SetSize(88, 24)
|
||||
tab.MiddleDisabled:SetPoint("LEFT", tab.LeftDisabled, "RIGHT")
|
||||
tab.MiddleDisabled:SetTexCoord(0.15625, 0.84375, 0, 1.0)
|
||||
|
||||
tab.RightDisabled = tab:CreateTexture(tabname .. "RightDisabled", "BORDER")
|
||||
tab.RightDisabled:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-ActiveTab")
|
||||
tab.RightDisabled:SetSize(20, 24)
|
||||
tab.RightDisabled:SetPoint("LEFT", tab.MiddleDisabled, "RIGHT")
|
||||
tab.RightDisabled:SetTexCoord(0.84375, 1.0, 0, 1.0)
|
||||
|
||||
tab.Left = tab:CreateTexture(tabname .. "Left", "BORDER")
|
||||
tab.Left:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-InActiveTab")
|
||||
tab.Left:SetSize(20, 24)
|
||||
tab.Left:SetPoint("TOPLEFT")
|
||||
tab.Left:SetTexCoord(0, 0.15625, 0, 1.0)
|
||||
|
||||
tab.Middle = tab:CreateTexture(tabname .. "Middle", "BORDER")
|
||||
tab.Middle:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-InActiveTab")
|
||||
tab.Middle:SetSize(88, 24)
|
||||
tab.Middle:SetPoint("LEFT", tab.Left, "RIGHT")
|
||||
tab.Middle:SetTexCoord(0.15625, 0.84375, 0, 1.0)
|
||||
|
||||
tab.Right = tab:CreateTexture(tabname .. "Right", "BORDER")
|
||||
tab.Right:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-InActiveTab")
|
||||
tab.Right:SetSize(20, 24)
|
||||
tab.Right:SetPoint("LEFT", tab.Middle, "RIGHT")
|
||||
tab.Right:SetTexCoord(0.84375, 1.0, 0, 1.0)
|
||||
|
||||
tab.Text = tab:CreateFontString(tabname .. "Text")
|
||||
tab:SetFontString(tab.Text)
|
||||
|
||||
tab:SetNormalFontObject(GameFontNormalSmall)
|
||||
tab:SetHighlightFontObject(GameFontHighlightSmall)
|
||||
tab:SetDisabledFontObject(GameFontHighlightSmall)
|
||||
tab:SetHighlightTexture("Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight", "ADD")
|
||||
tab.HighlightTexture = tab:GetHighlightTexture()
|
||||
tab.HighlightTexture:ClearAllPoints()
|
||||
tab.HighlightTexture:SetPoint("LEFT", tab, "LEFT", 10, -4)
|
||||
tab.HighlightTexture:SetPoint("RIGHT", tab, "RIGHT", -10, -4)
|
||||
_G[tabname .. "HighlightTexture"] = tab.HighlightTexture
|
||||
|
||||
tab.obj = self
|
||||
tab.id = id
|
||||
|
||||
tab.text = _G[tabname .. "Text"]
|
||||
tab.text = tab.Text -- compat
|
||||
tab.text:ClearAllPoints()
|
||||
tab.text:SetPoint("LEFT", 14, -3)
|
||||
tab.text:SetPoint("RIGHT", -12, -3)
|
||||
@@ -255,7 +441,7 @@ local methods = {
|
||||
end
|
||||
|
||||
for i = starttab, endtab do
|
||||
PanelTemplates_TabResize(tabs[i], padding + 4, nil, width)
|
||||
PanelTemplates_TabResize(tabs[i], padding + 4, nil, nil, width, tabs[i]:GetFontString():GetStringWidth())
|
||||
end
|
||||
starttab = endtab + 1
|
||||
end
|
||||
@@ -316,7 +502,7 @@ local function Constructor()
|
||||
titletext:SetHeight(18)
|
||||
titletext:SetText("")
|
||||
|
||||
local border = CreateFrame("Frame", nil, frame)
|
||||
local border = CreateFrame("Frame", nil, frame, "BackdropTemplate")
|
||||
border:SetPoint("TOPLEFT", 1, -27)
|
||||
border:SetPoint("BOTTOMRIGHT", -1, 3)
|
||||
border:SetBackdrop(PaneBackdrop)
|
||||
|
||||
@@ -2,22 +2,18 @@
|
||||
TreeGroup Container
|
||||
Container that uses a tree control to switch between groups.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "TreeGroup", 43
|
||||
local Type, Version = "TreeGroup", 49
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local next, pairs, ipairs, assert, type = next, pairs, ipairs, assert, type
|
||||
local math_min, math_max, floor = math.min, math.max, floor
|
||||
local math_min, math_max, floor = math.min, math.max, math.floor
|
||||
local select, tremove, unpack, tconcat = select, table.remove, unpack, table.concat
|
||||
|
||||
-- WoW APIs
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: GameTooltip, FONT_COLOR_CODE_CLOSE
|
||||
|
||||
-- Recycling functions
|
||||
local new, del
|
||||
do
|
||||
@@ -159,7 +155,7 @@ end
|
||||
local function FirstFrameUpdate(frame)
|
||||
local self = frame.obj
|
||||
frame:SetScript("OnUpdate", nil)
|
||||
self:RefreshTree()
|
||||
self:RefreshTree(nil, true)
|
||||
end
|
||||
|
||||
local function BuildUniqueValue(...)
|
||||
@@ -206,11 +202,13 @@ local function Button_OnEnter(frame)
|
||||
self:Fire("OnButtonEnter", frame.uniquevalue, frame)
|
||||
|
||||
if self.enabletooltips then
|
||||
GameTooltip:SetOwner(frame, "ANCHOR_NONE")
|
||||
GameTooltip:SetPoint("LEFT",frame,"RIGHT")
|
||||
GameTooltip:SetText(frame.text:GetText() or "", 1, .82, 0, 1)
|
||||
local tooltip = AceGUI.tooltip
|
||||
tooltip:SetOwner(frame, "ANCHOR_NONE")
|
||||
tooltip:ClearAllPoints()
|
||||
tooltip:SetPoint("LEFT",frame,"RIGHT")
|
||||
tooltip:SetText(frame.text:GetText() or "", 1, .82, 0, 1, true)
|
||||
|
||||
GameTooltip:Show()
|
||||
tooltip:Show()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -219,7 +217,7 @@ local function Button_OnLeave(frame)
|
||||
self:Fire("OnButtonLeave", frame.uniquevalue, frame)
|
||||
|
||||
if self.enabletooltips then
|
||||
GameTooltip:Hide()
|
||||
AceGUI.tooltip:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -227,7 +225,7 @@ local function OnScrollValueChanged(frame, value)
|
||||
if frame.obj.noupdate then return end
|
||||
local self = frame.obj
|
||||
local status = self.status or self.localstatus
|
||||
status.scrollvalue = value
|
||||
status.scrollvalue = floor(value + 0.5)
|
||||
self:RefreshTree()
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
@@ -292,10 +290,13 @@ local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
self:SetTreeWidth(DEFAULT_TREE_WIDTH, DEFAULT_TREE_SIZABLE)
|
||||
self:EnableButtonTooltips(true)
|
||||
self.frame:SetScript("OnUpdate", FirstFrameUpdate)
|
||||
end,
|
||||
|
||||
["OnRelease"] = function(self)
|
||||
self.status = nil
|
||||
self.tree = nil
|
||||
self.frame:SetScript("OnUpdate", nil)
|
||||
for k, v in pairs(self.localstatus) do
|
||||
if k == "groups" then
|
||||
for k2 in pairs(v) do
|
||||
@@ -383,13 +384,9 @@ local methods = {
|
||||
end
|
||||
end,
|
||||
|
||||
["RefreshTree"] = function(self,scrollToSelection)
|
||||
["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
|
||||
@@ -415,6 +412,11 @@ local methods = {
|
||||
local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18))
|
||||
if maxlines <= 0 then return end
|
||||
|
||||
if self.frame:GetParent() == UIParent and not fromOnUpdate then
|
||||
self.frame:SetScript("OnUpdate", FirstFrameUpdate)
|
||||
return
|
||||
end
|
||||
|
||||
local first, last
|
||||
|
||||
scrollToSelection = status.scrollToSelection
|
||||
@@ -493,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)
|
||||
@@ -557,7 +563,11 @@ local methods = {
|
||||
if maxtreewidth > 100 and status.treewidth > maxtreewidth then
|
||||
self:SetTreeWidth(maxtreewidth, status.treesizable)
|
||||
end
|
||||
treeframe:SetMaxResize(maxtreewidth, 1600)
|
||||
if treeframe.SetResizeBounds then
|
||||
treeframe:SetResizeBounds(100, 1, maxtreewidth, 1600)
|
||||
else
|
||||
treeframe:SetMaxResize(maxtreewidth, 1600)
|
||||
end
|
||||
end,
|
||||
|
||||
["OnHeightSet"] = function(self, height)
|
||||
@@ -619,7 +629,7 @@ local PaneBackdrop = {
|
||||
local DraggerBackdrop = {
|
||||
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||
edgeFile = nil,
|
||||
tile = true, tileSize = 16, edgeSize = 0,
|
||||
tile = true, tileSize = 16, edgeSize = 1,
|
||||
insets = { left = 3, right = 3, top = 7, bottom = 7 }
|
||||
}
|
||||
|
||||
@@ -627,7 +637,7 @@ local function Constructor()
|
||||
local num = AceGUI:GetNextWidgetNum(Type)
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
|
||||
local treeframe = CreateFrame("Frame", nil, frame)
|
||||
local treeframe = CreateFrame("Frame", nil, frame, "BackdropTemplate")
|
||||
treeframe:SetPoint("TOPLEFT")
|
||||
treeframe:SetPoint("BOTTOMLEFT")
|
||||
treeframe:SetWidth(DEFAULT_TREE_WIDTH)
|
||||
@@ -636,13 +646,17 @@ local function Constructor()
|
||||
treeframe:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
|
||||
treeframe:SetBackdropBorderColor(0.4, 0.4, 0.4)
|
||||
treeframe:SetResizable(true)
|
||||
treeframe:SetMinResize(100, 1)
|
||||
treeframe:SetMaxResize(400, 1600)
|
||||
if treeframe.SetResizeBounds then -- WoW 10.0
|
||||
treeframe:SetResizeBounds(100, 1, 400, 1600)
|
||||
else
|
||||
treeframe:SetMinResize(100, 1)
|
||||
treeframe:SetMaxResize(400, 1600)
|
||||
end
|
||||
treeframe:SetScript("OnUpdate", FirstFrameUpdate)
|
||||
treeframe:SetScript("OnSizeChanged", Tree_OnSizeChanged)
|
||||
treeframe:SetScript("OnMouseWheel", Tree_OnMouseWheel)
|
||||
|
||||
local dragger = CreateFrame("Frame", nil, treeframe)
|
||||
local dragger = CreateFrame("Frame", nil, treeframe, "BackdropTemplate")
|
||||
dragger:SetWidth(8)
|
||||
dragger:SetPoint("TOP", treeframe, "TOPRIGHT")
|
||||
dragger:SetPoint("BOTTOM", treeframe, "BOTTOMRIGHT")
|
||||
@@ -665,9 +679,9 @@ local function Constructor()
|
||||
|
||||
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
|
||||
scrollbg:SetAllPoints(scrollbar)
|
||||
scrollbg:SetTexture(0,0,0,0.4)
|
||||
scrollbg:SetColorTexture(0,0,0,0.4)
|
||||
|
||||
local border = CreateFrame("Frame",nil,frame)
|
||||
local border = CreateFrame("Frame", nil, frame, "BackdropTemplate")
|
||||
border:SetPoint("TOPLEFT", treeframe, "TOPRIGHT")
|
||||
border:SetPoint("BOTTOMRIGHT")
|
||||
border:SetBackdrop(PaneBackdrop)
|
||||
|
||||
@@ -7,10 +7,6 @@ local pairs, assert, type = pairs, assert, type
|
||||
local PlaySound = PlaySound
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: GameFontNormal
|
||||
|
||||
----------------
|
||||
-- Main Frame --
|
||||
----------------
|
||||
@@ -21,7 +17,7 @@ local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
]]
|
||||
do
|
||||
local Type = "Window"
|
||||
local Version = 5
|
||||
local Version = 8
|
||||
|
||||
local function frameOnShow(this)
|
||||
this.obj:Fire("OnShow")
|
||||
@@ -32,7 +28,7 @@ do
|
||||
end
|
||||
|
||||
local function closeOnClick(this)
|
||||
PlaySound("gsTitleOptionExit")
|
||||
PlaySound(799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT
|
||||
this.obj:Hide()
|
||||
end
|
||||
|
||||
@@ -186,71 +182,75 @@ do
|
||||
|
||||
frame:SetScript("OnShow",frameOnShow)
|
||||
frame:SetScript("OnHide",frameOnClose)
|
||||
frame:SetMinResize(240,240)
|
||||
if frame.SetResizeBounds then -- WoW 10.0
|
||||
frame:SetResizeBounds(240,240)
|
||||
else
|
||||
frame:SetMinResize(240,240)
|
||||
end
|
||||
frame:SetToplevel(true)
|
||||
|
||||
local titlebg = frame:CreateTexture(nil, "BACKGROUND")
|
||||
titlebg:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Title-Background]])
|
||||
titlebg:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Title-Background")
|
||||
titlebg:SetPoint("TOPLEFT", 9, -6)
|
||||
titlebg:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -28, -24)
|
||||
|
||||
local dialogbg = frame:CreateTexture(nil, "BACKGROUND")
|
||||
dialogbg:SetTexture([[Interface\Tooltips\UI-Tooltip-Background]])
|
||||
dialogbg:SetTexture("Interface\\Tooltips\\UI-Tooltip-Background")
|
||||
dialogbg:SetPoint("TOPLEFT", 8, -24)
|
||||
dialogbg:SetPoint("BOTTOMRIGHT", -6, 8)
|
||||
dialogbg:SetVertexColor(0, 0, 0, .75)
|
||||
|
||||
local topleft = frame:CreateTexture(nil, "BORDER")
|
||||
topleft:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
||||
topleft:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
|
||||
topleft:SetWidth(64)
|
||||
topleft:SetHeight(64)
|
||||
topleft:SetPoint("TOPLEFT")
|
||||
topleft:SetTexCoord(0.501953125, 0.625, 0, 1)
|
||||
|
||||
local topright = frame:CreateTexture(nil, "BORDER")
|
||||
topright:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
||||
topright:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
|
||||
topright:SetWidth(64)
|
||||
topright:SetHeight(64)
|
||||
topright:SetPoint("TOPRIGHT")
|
||||
topright:SetTexCoord(0.625, 0.75, 0, 1)
|
||||
|
||||
local top = frame:CreateTexture(nil, "BORDER")
|
||||
top:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
||||
top:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
|
||||
top:SetHeight(64)
|
||||
top:SetPoint("TOPLEFT", topleft, "TOPRIGHT")
|
||||
top:SetPoint("TOPRIGHT", topright, "TOPLEFT")
|
||||
top:SetTexCoord(0.25, 0.369140625, 0, 1)
|
||||
|
||||
local bottomleft = frame:CreateTexture(nil, "BORDER")
|
||||
bottomleft:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
||||
bottomleft:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
|
||||
bottomleft:SetWidth(64)
|
||||
bottomleft:SetHeight(64)
|
||||
bottomleft:SetPoint("BOTTOMLEFT")
|
||||
bottomleft:SetTexCoord(0.751953125, 0.875, 0, 1)
|
||||
|
||||
local bottomright = frame:CreateTexture(nil, "BORDER")
|
||||
bottomright:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
||||
bottomright:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
|
||||
bottomright:SetWidth(64)
|
||||
bottomright:SetHeight(64)
|
||||
bottomright:SetPoint("BOTTOMRIGHT")
|
||||
bottomright:SetTexCoord(0.875, 1, 0, 1)
|
||||
|
||||
local bottom = frame:CreateTexture(nil, "BORDER")
|
||||
bottom:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
||||
bottom:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
|
||||
bottom:SetHeight(64)
|
||||
bottom:SetPoint("BOTTOMLEFT", bottomleft, "BOTTOMRIGHT")
|
||||
bottom:SetPoint("BOTTOMRIGHT", bottomright, "BOTTOMLEFT")
|
||||
bottom:SetTexCoord(0.376953125, 0.498046875, 0, 1)
|
||||
|
||||
local left = frame:CreateTexture(nil, "BORDER")
|
||||
left:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
||||
left:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
|
||||
left:SetWidth(64)
|
||||
left:SetPoint("TOPLEFT", topleft, "BOTTOMLEFT")
|
||||
left:SetPoint("BOTTOMLEFT", bottomleft, "TOPLEFT")
|
||||
left:SetTexCoord(0.001953125, 0.125, 0, 1)
|
||||
|
||||
local right = frame:CreateTexture(nil, "BORDER")
|
||||
right:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
||||
right:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
|
||||
right:SetWidth(64)
|
||||
right:SetPoint("TOPRIGHT", topright, "BOTTOMRIGHT")
|
||||
right:SetPoint("BOTTOMRIGHT", bottomright, "TOPRIGHT")
|
||||
@@ -300,7 +300,7 @@ do
|
||||
line2:SetHeight(8)
|
||||
line2:SetPoint("BOTTOMRIGHT", -8, 8)
|
||||
line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
|
||||
local x = 0.1 * 8/17
|
||||
x = 0.1 * 8/17
|
||||
line2:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
|
||||
|
||||
local sizer_s = CreateFrame("Frame",nil,frame)
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Button Widget (Modified to change text color on SetDisabled method)
|
||||
Graphical Button.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "Button-ElvUI", 2
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
-- WoW APIs
|
||||
local _G = _G
|
||||
local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent
|
||||
local IsShiftKeyDown = IsShiftKeyDown
|
||||
-- GLOBALS: GameTooltip, ElvUI
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local dragdropButton
|
||||
local function lockTooltip()
|
||||
GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR")
|
||||
GameTooltip:SetText(" ")
|
||||
GameTooltip:Show()
|
||||
end
|
||||
local function dragdrop_OnMouseDown(frame, ...)
|
||||
if frame.obj.dragOnMouseDown then
|
||||
dragdropButton.mouseDownFrame = frame
|
||||
dragdropButton:SetText(frame.obj.value or "Unknown")
|
||||
dragdropButton:SetSize(frame:GetSize())
|
||||
frame.obj.dragOnMouseDown(frame, ...)
|
||||
end
|
||||
end
|
||||
local function dragdrop_OnMouseUp(frame, ...)
|
||||
if frame.obj.dragOnMouseUp then
|
||||
frame:SetAlpha(1)
|
||||
GameTooltip:Hide()
|
||||
dragdropButton:Hide()
|
||||
if dragdropButton.enteredFrame and dragdropButton.enteredFrame ~= frame and dragdropButton.enteredFrame:IsMouseOver() then
|
||||
frame.obj.dragOnMouseUp(frame, ...)
|
||||
frame.obj.ActivateMultiControl(frame.obj, ...)
|
||||
end
|
||||
dragdropButton.enteredFrame = nil
|
||||
dragdropButton.mouseDownFrame = nil
|
||||
end
|
||||
end
|
||||
local function dragdrop_OnLeave(frame, ...)
|
||||
if frame.obj.dragOnLeave then
|
||||
if dragdropButton.mouseDownFrame then
|
||||
lockTooltip()
|
||||
end
|
||||
if frame == dragdropButton.mouseDownFrame then
|
||||
frame:SetAlpha(0)
|
||||
dragdropButton:Show()
|
||||
frame.obj.dragOnLeave(frame, ...)
|
||||
end
|
||||
end
|
||||
end
|
||||
local function dragdrop_OnEnter(frame, ...)
|
||||
if frame.obj.dragOnEnter and dragdropButton:IsShown() then
|
||||
dragdropButton.enteredFrame = frame
|
||||
lockTooltip()
|
||||
frame.obj.dragOnEnter(frame, ...)
|
||||
end
|
||||
end
|
||||
local function dragdrop_OnClick(frame, ...)
|
||||
local button = ...
|
||||
if frame.obj.dragOnClick and button == "RightButton" then
|
||||
frame.obj.dragOnClick(frame, ...)
|
||||
frame.obj.ActivateMultiControl(frame.obj, ...)
|
||||
elseif frame.obj.stateSwitchOnClick and (button == "LeftButton") and IsShiftKeyDown() then
|
||||
frame.obj.stateSwitchOnClick(frame, ...)
|
||||
frame.obj.ActivateMultiControl(frame.obj, ...)
|
||||
end
|
||||
end
|
||||
|
||||
local function Button_OnClick(frame, ...)
|
||||
AceGUI:ClearFocus()
|
||||
PlaySound("igMainMenuOption")
|
||||
frame.obj:Fire("OnClick", ...)
|
||||
end
|
||||
|
||||
local function Control_OnEnter(frame)
|
||||
frame.obj:Fire("OnEnter")
|
||||
end
|
||||
|
||||
local function Control_OnLeave(frame)
|
||||
frame.obj:Fire("OnLeave")
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
-- restore default values
|
||||
self:SetHeight(24)
|
||||
self:SetWidth(200)
|
||||
self:SetDisabled(false)
|
||||
self:SetAutoWidth(false)
|
||||
self:SetText()
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["SetText"] = function(self, text)
|
||||
self.text:SetText(text)
|
||||
if self.autoWidth then
|
||||
self:SetWidth(self.text:GetStringWidth() + 30)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetAutoWidth"] = function(self, autoWidth)
|
||||
self.autoWidth = autoWidth
|
||||
if self.autoWidth then
|
||||
self:SetWidth(self.text:GetStringWidth() + 30)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetDisabled"] = function(self, disabled)
|
||||
self.disabled = disabled
|
||||
if disabled then
|
||||
self.frame:Disable()
|
||||
self.text:SetTextColor(0.4, 0.4, 0.4)
|
||||
else
|
||||
self.frame:Enable()
|
||||
self.text:SetTextColor(1, 0.82, 0)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type)
|
||||
local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate2")
|
||||
frame:Hide()
|
||||
frame:EnableMouse(true)
|
||||
frame:RegisterForClicks("AnyUp")
|
||||
frame:SetScript("OnClick", Button_OnClick)
|
||||
frame:SetScript("OnEnter", Control_OnEnter)
|
||||
frame:SetScript("OnLeave", Control_OnLeave)
|
||||
|
||||
-- dragdrop
|
||||
if not dragdropButton then
|
||||
dragdropButton = CreateFrame("Button", "ElvUIAceGUI30DragDropButton", UIParent, "UIPanelButtonTemplate")
|
||||
dragdropButton:SetFrameStrata("TOOLTIP")
|
||||
dragdropButton:SetFrameLevel(5)
|
||||
dragdropButton:SetPoint('BOTTOM', GameTooltip, "BOTTOM", 0, 10)
|
||||
dragdropButton:Hide()
|
||||
ElvUI[1]:GetModule('Skins'):HandleButton(dragdropButton)
|
||||
end
|
||||
frame:HookScript("OnClick", dragdrop_OnClick)
|
||||
frame:HookScript("OnEnter", dragdrop_OnEnter)
|
||||
frame:HookScript("OnLeave", dragdrop_OnLeave)
|
||||
frame:HookScript("OnMouseUp", dragdrop_OnMouseUp)
|
||||
frame:HookScript("OnMouseDown", dragdrop_OnMouseDown)
|
||||
|
||||
local text = frame:GetFontString()
|
||||
text:ClearAllPoints()
|
||||
text:SetPoint("TOPLEFT", 15, -1)
|
||||
text:SetPoint("BOTTOMRIGHT", -15, 1)
|
||||
text:SetJustifyV("MIDDLE")
|
||||
|
||||
local widget = {
|
||||
text = text,
|
||||
frame = frame,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
|
||||
return AceGUI:RegisterAsWidget(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
@@ -2,7 +2,7 @@
|
||||
Button Widget
|
||||
Graphical Button.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "Button", 23
|
||||
local Type, Version = "Button", 24
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
@@ -18,7 +18,7 @@ Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Button_OnClick(frame, ...)
|
||||
AceGUI:ClearFocus()
|
||||
PlaySound("igMainMenuOption")
|
||||
PlaySound(852) -- SOUNDKIT.IG_MAINMENU_OPTION
|
||||
frame.obj:Fire("OnClick", ...)
|
||||
end
|
||||
|
||||
@@ -74,7 +74,7 @@ Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type)
|
||||
local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate2")
|
||||
local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate")
|
||||
frame:Hide()
|
||||
|
||||
frame:EnableMouse(true)
|
||||
|
||||
@@ -12,10 +12,6 @@ local select, pairs = select, pairs
|
||||
local PlaySound = PlaySound
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: SetDesaturation, GameFontHighlight
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
@@ -60,9 +56,9 @@ local function CheckBox_OnMouseUp(frame)
|
||||
self:ToggleChecked()
|
||||
|
||||
if self.checked then
|
||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
||||
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
|
||||
else -- for both nil and false (tristate)
|
||||
PlaySound("igMainMenuOptionCheckBoxOff")
|
||||
PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF
|
||||
end
|
||||
|
||||
self:Fire("OnValueChanged", self.checked)
|
||||
@@ -199,13 +195,14 @@ local methods = {
|
||||
["SetDescription"] = function(self, desc)
|
||||
if desc then
|
||||
if not self.desc then
|
||||
local desc = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
||||
desc:ClearAllPoints()
|
||||
desc:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21)
|
||||
desc:SetWidth(self.frame.width - 30)
|
||||
desc:SetJustifyH("LEFT")
|
||||
desc:SetJustifyV("TOP")
|
||||
self.desc = desc
|
||||
local f = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
||||
f:ClearAllPoints()
|
||||
f:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21)
|
||||
f:SetWidth(self.frame.width - 30)
|
||||
f:SetPoint("RIGHT", self.frame, "RIGHT", -30, 0)
|
||||
f:SetJustifyH("LEFT")
|
||||
f:SetJustifyV("TOP")
|
||||
self.desc = f
|
||||
end
|
||||
self.desc:Show()
|
||||
--self.text:SetFontObject(GameFontNormal)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--[[-----------------------------------------------------------------------------
|
||||
ColorPicker Widget
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "ColorPicker-ElvUI", 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,21 +11,24 @@ local pairs = pairs
|
||||
-- WoW APIs
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: ColorPickerFrame, OpacitySliderFrame, ColorPPDefault
|
||||
-- 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)
|
||||
-- this will block an infinite loop from `E.GrabColorPickerValues`
|
||||
-- which is caused when we set values into the color picker again on `OnValueChanged`
|
||||
if ColorPickerFrame.noColorCallback then return end
|
||||
|
||||
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
|
||||
@@ -58,37 +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
|
||||
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
|
||||
|
||||
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 info = {
|
||||
swatchFunc = function()
|
||||
local r, g, b = ColorPickerFrame:GetColorRGB()
|
||||
local a = ColorPickerFrame:GetColorAlpha()
|
||||
ColorCallback(self, r, g, b, a)
|
||||
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)
|
||||
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,
|
||||
|
||||
if ColorPPDefault and self.dR and self.dG and self.dB then
|
||||
local alpha = 1
|
||||
if self.dA then alpha = 1 - self.dA end
|
||||
if not ColorPPDefault.colors then ColorPPDefault.colors = {} end
|
||||
ColorPPDefault.colors.r, ColorPPDefault.colors.g, ColorPPDefault.colors.b, ColorPPDefault.colors.a = self.dR, self.dG, self.dB, alpha
|
||||
end
|
||||
cancelFunc = function()
|
||||
ColorCallback(self, r2, g2, b2, a2, true)
|
||||
end,
|
||||
|
||||
ColorPickerFrame.cancelFunc = function()
|
||||
ColorCallback(self, r, g, b, a, true)
|
||||
end
|
||||
r = r2,
|
||||
g = g2,
|
||||
b = b2,
|
||||
}
|
||||
|
||||
ColorPickerFrame:Show()
|
||||
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
|
||||
end
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
@@ -112,15 +141,11 @@ local methods = {
|
||||
self.text:SetText(text)
|
||||
end,
|
||||
|
||||
["SetColor"] = function(self, r, g, b, a, defaultR, defaultG, defaultB, defaultA)
|
||||
["SetColor"] = function(self, r, g, b, a)
|
||||
self.r = r
|
||||
self.g = g
|
||||
self.b = b
|
||||
self.a = a or 1
|
||||
self.dR = defaultR or self.dR
|
||||
self.dG = defaultG or self.dG
|
||||
self.dB = defaultB or self.dB
|
||||
self.dA = defaultA or self.dA
|
||||
self.colorSwatch:SetVertexColor(r, g, b, a)
|
||||
end,
|
||||
|
||||
@@ -162,7 +187,7 @@ local function Constructor()
|
||||
colorSwatch.background = texture
|
||||
texture:SetWidth(16)
|
||||
texture:SetHeight(16)
|
||||
texture:SetTexture(1, 1, 1)
|
||||
texture:SetColorTexture(1, 1, 1)
|
||||
texture:SetPoint("CENTER", colorSwatch)
|
||||
texture:Show()
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ local ItemBase = {
|
||||
-- NOTE: The ItemBase version is added to each item's version number
|
||||
-- to ensure proper updates on ItemBase changes.
|
||||
-- Use at least 1000er steps.
|
||||
version = 1000,
|
||||
version = 2000,
|
||||
counter = 0,
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ function ItemBase.Create(type)
|
||||
highlight:Hide()
|
||||
self.highlight = highlight
|
||||
|
||||
local check = frame:CreateTexture("OVERLAY")
|
||||
local check = frame:CreateTexture(nil, "OVERLAY")
|
||||
check:SetWidth(16)
|
||||
check:SetHeight(16)
|
||||
check:SetPoint("LEFT",frame,"LEFT",3,-1)
|
||||
@@ -186,7 +186,7 @@ function ItemBase.Create(type)
|
||||
check:Hide()
|
||||
self.check = check
|
||||
|
||||
local sub = frame:CreateTexture("OVERLAY")
|
||||
local sub = frame:CreateTexture(nil, "OVERLAY")
|
||||
sub:SetWidth(16)
|
||||
sub:SetHeight(16)
|
||||
sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1)
|
||||
@@ -323,7 +323,7 @@ end
|
||||
-- Does not close the pullout on click.
|
||||
do
|
||||
local widgetType = "Dropdown-Item-Toggle"
|
||||
local widgetVersion = 3
|
||||
local widgetVersion = 4
|
||||
|
||||
local function UpdateToggle(self)
|
||||
if self.value then
|
||||
@@ -343,9 +343,9 @@ do
|
||||
if self.disabled then return end
|
||||
self.value = not self.value
|
||||
if self.value then
|
||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
||||
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
|
||||
else
|
||||
PlaySound("igMainMenuOptionCheckBoxOff")
|
||||
PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF
|
||||
end
|
||||
UpdateToggle(self)
|
||||
self:Fire("OnValueChanged", self.value)
|
||||
@@ -440,7 +440,7 @@ end
|
||||
-- A single line to separate items
|
||||
do
|
||||
local widgetType = "Dropdown-Item-Separator"
|
||||
local widgetVersion = 1
|
||||
local widgetVersion = 2
|
||||
|
||||
-- exported, override
|
||||
local function SetDisabled(self, disabled)
|
||||
@@ -455,7 +455,7 @@ do
|
||||
|
||||
local line = self.frame:CreateTexture(nil, "OVERLAY")
|
||||
line:SetHeight(1)
|
||||
line:SetTexture(.5, .5, .5)
|
||||
line:SetColorTexture(.5, .5, .5)
|
||||
line:SetPoint("LEFT", self.frame, "LEFT", 10, 0)
|
||||
line:SetPoint("RIGHT", self.frame, "RIGHT", -10, 0)
|
||||
|
||||
|
||||
@@ -4,17 +4,13 @@ local AceGUI = LibStub("AceGUI-3.0")
|
||||
-- Lua APIs
|
||||
local min, max, floor = math.min, math.max, math.floor
|
||||
local select, pairs, ipairs, type, tostring = select, pairs, ipairs, type, tostring
|
||||
local tsort, tonumber = table.sort, tonumber
|
||||
local tsort = table.sort
|
||||
|
||||
-- WoW APIs
|
||||
local PlaySound = PlaySound
|
||||
local UIParent, CreateFrame = UIParent, CreateFrame
|
||||
local _G = _G
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: CLOSE
|
||||
|
||||
local function fixlevels(parent,...)
|
||||
local i = 1
|
||||
local child = select(i, ...)
|
||||
@@ -39,7 +35,7 @@ end
|
||||
|
||||
do
|
||||
local widgetType = "Dropdown-Pullout"
|
||||
local widgetVersion = 3
|
||||
local widgetVersion = 5
|
||||
|
||||
--[[ Static data ]]--
|
||||
|
||||
@@ -193,12 +189,7 @@ do
|
||||
|
||||
local height = 8
|
||||
for i, item in pairs(items) do
|
||||
if i == 1 then
|
||||
item:SetPoint("TOP", itemFrame, "TOP", 0, -2)
|
||||
else
|
||||
item:SetPoint("TOP", items[i-1].frame, "BOTTOM", 0, 1)
|
||||
end
|
||||
|
||||
item:SetPoint("TOP", itemFrame, "TOP", 0, -2 + (i - 1) * -16)
|
||||
item:Show()
|
||||
|
||||
height = height + 16
|
||||
@@ -258,7 +249,7 @@ do
|
||||
|
||||
local function Constructor()
|
||||
local count = AceGUI:GetNextWidgetNum(widgetType)
|
||||
local frame = CreateFrame("Frame", "AceGUI30Pullout"..count, UIParent)
|
||||
local frame = CreateFrame("Frame", "AceGUI30Pullout"..count, UIParent, "BackdropTemplate")
|
||||
local self = {}
|
||||
self.count = count
|
||||
self.type = widgetType
|
||||
@@ -309,7 +300,7 @@ do
|
||||
scrollFrame.obj = self
|
||||
itemFrame.obj = self
|
||||
|
||||
local slider = CreateFrame("Slider", "AceGUI30PulloutScrollbar"..count, scrollFrame)
|
||||
local slider = CreateFrame("Slider", "AceGUI30PulloutScrollbar"..count, scrollFrame, "BackdropTemplate")
|
||||
slider:SetOrientation("VERTICAL")
|
||||
slider:SetHitRectInsets(0, 0, -10, 0)
|
||||
slider:SetBackdrop(sliderBackdrop)
|
||||
@@ -356,7 +347,7 @@ end
|
||||
|
||||
do
|
||||
local widgetType = "Dropdown"
|
||||
local widgetVersion = 35
|
||||
local widgetVersion = 36
|
||||
|
||||
--[[ Static data ]]--
|
||||
|
||||
@@ -381,7 +372,6 @@ do
|
||||
|
||||
local function Dropdown_TogglePullout(this)
|
||||
local self = this.obj
|
||||
PlaySound("igMainMenuOptionCheckBoxOn") -- missleading name, but the Blizzard code uses this sound
|
||||
if self.open then
|
||||
self.open = nil
|
||||
self.pullout:Close()
|
||||
@@ -599,47 +589,21 @@ do
|
||||
return tostring(x) < tostring(y)
|
||||
end
|
||||
end
|
||||
|
||||
-- these were added by ElvUI
|
||||
local sortStr1, sortStr2 = "%((%d+)%)", "%[(%d+)]"
|
||||
local sortValue = function(a,b)
|
||||
if a and b and (a[2] and b[2]) then
|
||||
local a2 = tonumber(a[2]:match(sortStr1) or a[2]:match(sortStr2))
|
||||
local b2 = tonumber(b[2]:match(sortStr1) or b[2]:match(sortStr2))
|
||||
if a2 and b2 and (a2 ~= b2) then
|
||||
return a2 < b2 -- try to sort by the number inside of brackets if we can
|
||||
end
|
||||
return a[2] < b[2]
|
||||
end
|
||||
end
|
||||
|
||||
local function SetList(self, list, order, itemType, sortByValue)
|
||||
local function SetList(self, list, order, itemType)
|
||||
self.list = list or {}
|
||||
self.pullout:Clear()
|
||||
self.hasClose = nil
|
||||
if not list then return end
|
||||
|
||||
if type(order) ~= "table" then
|
||||
if sortByValue then -- added by ElvUI
|
||||
for k, v in pairs(list) do
|
||||
sortlist[#sortlist + 1] = {k,v}
|
||||
end
|
||||
tsort(sortlist, sortValue)
|
||||
for v in pairs(list) do
|
||||
sortlist[#sortlist + 1] = v
|
||||
end
|
||||
tsort(sortlist, sortTbl)
|
||||
|
||||
for i, sortedList in ipairs(sortlist) do
|
||||
AddListItem(self, sortedList[1], sortedList[2], itemType)
|
||||
sortlist[i] = nil
|
||||
end
|
||||
else -- this is the default way (unchanged by ElvUI)
|
||||
for v in pairs(list) do
|
||||
sortlist[#sortlist + 1] = v
|
||||
end
|
||||
tsort(sortlist, sortTbl)
|
||||
|
||||
for i, key in ipairs(sortlist) do
|
||||
AddListItem(self, key, list[key], itemType)
|
||||
sortlist[i] = nil
|
||||
end
|
||||
for i, key in ipairs(sortlist) do
|
||||
AddListItem(self, key, list[key], itemType)
|
||||
sortlist[i] = nil
|
||||
end
|
||||
else
|
||||
for i, key in ipairs(order) do
|
||||
|
||||
@@ -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,20 +10,20 @@ 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
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: AceGUIEditBoxInsertLink, ChatFontNormal, OKAY
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
if not AceGUIEditBoxInsertLink then
|
||||
-- upgradeable hook
|
||||
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end)
|
||||
if ChatFrameUtil and ChatFrameUtil.InsertLink then
|
||||
hooksecurefunc(ChatFrameUtil, "InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end)
|
||||
elseif ChatEdit_InsertLink then
|
||||
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end)
|
||||
end
|
||||
end
|
||||
|
||||
function _G.AceGUIEditBoxInsertLink(text)
|
||||
@@ -73,19 +73,23 @@ local function EditBox_OnEnterPressed(frame)
|
||||
local value = frame:GetText()
|
||||
local cancel = self:Fire("OnEnterPressed", value)
|
||||
if not cancel then
|
||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
||||
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
|
||||
HideButton(self)
|
||||
end
|
||||
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
|
||||
|
||||
@@ -132,7 +132,7 @@ local function Constructor()
|
||||
widget[method] = func
|
||||
end
|
||||
|
||||
widget.SetText = widget.SetLabel
|
||||
widget.SetText = function(self, ...) print("AceGUI-3.0-Icon: SetText is deprecated! Use SetLabel instead!"); self:SetLabel(...) end
|
||||
|
||||
return AceGUI:RegisterAsWidget(widget)
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Keybinding Widget
|
||||
Set Keybindings in the Config UI.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "Keybinding", 25
|
||||
local Type, Version = "Keybinding", 27
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
@@ -13,10 +13,6 @@ local pairs = pairs
|
||||
local IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: NOT_BOUND
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
@@ -35,12 +31,14 @@ local function Keybinding_OnClick(frame, button)
|
||||
if self.waitingForKey then
|
||||
frame:EnableKeyboard(false)
|
||||
frame:EnableMouseWheel(false)
|
||||
frame:EnableGamePadButton(false)
|
||||
self.msgframe:Hide()
|
||||
frame:UnlockHighlight()
|
||||
self.waitingForKey = nil
|
||||
else
|
||||
frame:EnableKeyboard(true)
|
||||
frame:EnableMouseWheel(true)
|
||||
frame:EnableGamePadButton(true)
|
||||
self.msgframe:Show()
|
||||
frame:LockHighlight()
|
||||
self.waitingForKey = true
|
||||
@@ -76,6 +74,7 @@ local function Keybinding_OnKeyDown(frame, key)
|
||||
|
||||
frame:EnableKeyboard(false)
|
||||
frame:EnableMouseWheel(false)
|
||||
frame:EnableGamePadButton(false)
|
||||
self.msgframe:Hide()
|
||||
frame:UnlockHighlight()
|
||||
self.waitingForKey = nil
|
||||
@@ -123,6 +122,7 @@ local methods = {
|
||||
self:SetDisabled(false)
|
||||
self.button:EnableKeyboard(false)
|
||||
self.button:EnableMouseWheel(false)
|
||||
self.button:EnableGamePadButton(false)
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
@@ -188,7 +188,7 @@ local function Constructor()
|
||||
local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type)
|
||||
|
||||
local frame = CreateFrame("Frame", nil, UIParent)
|
||||
local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate2")
|
||||
local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate")
|
||||
|
||||
button:EnableMouse(true)
|
||||
button:EnableMouseWheel(false)
|
||||
@@ -199,10 +199,12 @@ local function Constructor()
|
||||
button:SetScript("OnKeyDown", Keybinding_OnKeyDown)
|
||||
button:SetScript("OnMouseDown", Keybinding_OnMouseDown)
|
||||
button:SetScript("OnMouseWheel", Keybinding_OnMouseWheel)
|
||||
button:SetScript("OnGamePadButtonDown", Keybinding_OnKeyDown)
|
||||
button:SetPoint("BOTTOMLEFT")
|
||||
button:SetPoint("BOTTOMRIGHT")
|
||||
button:SetHeight(24)
|
||||
button:EnableKeyboard(false)
|
||||
button:EnableGamePadButton(false)
|
||||
|
||||
local text = button:GetFontString()
|
||||
text:SetPoint("LEFT", 7, 0)
|
||||
@@ -214,7 +216,7 @@ local function Constructor()
|
||||
label:SetJustifyH("CENTER")
|
||||
label:SetHeight(18)
|
||||
|
||||
local msgframe = CreateFrame("Frame", nil, UIParent)
|
||||
local msgframe = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
|
||||
msgframe:SetHeight(30)
|
||||
msgframe:SetBackdrop(ControlBackdrop)
|
||||
msgframe:SetBackdropColor(0,0,0)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Label Widget
|
||||
Displays text and optionally an icon.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "Label", 27
|
||||
local Type, Version = "Label", 28
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
@@ -12,10 +12,6 @@ local max, select, pairs = math.max, select, pairs
|
||||
-- WoW APIs
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: GameFontHighlightSmall
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
@@ -129,12 +125,16 @@ local methods = {
|
||||
end,
|
||||
|
||||
["SetFont"] = function(self, font, height, flags)
|
||||
self.label:SetFont(font, height, flags)
|
||||
UpdateImageAnchor(self)
|
||||
if not self.fontObject then
|
||||
self.fontObject = CreateFont("AceGUI30LabelFont" .. AceGUI:GetNextWidgetNum(Type))
|
||||
end
|
||||
self.fontObject:SetFont(font, height, flags)
|
||||
self:SetFontObject(self.fontObject)
|
||||
end,
|
||||
|
||||
["SetFontObject"] = function(self, font)
|
||||
self:SetFont((font or GameFontHighlightSmall):GetFont())
|
||||
self.label:SetFontObject(font or GameFontHighlightSmall)
|
||||
UpdateImageAnchor(self)
|
||||
end,
|
||||
|
||||
["SetImageSize"] = function(self, width, height)
|
||||
|
||||
+24
-13
@@ -1,4 +1,4 @@
|
||||
local Type, Version = "MultiLineEditBox", 28
|
||||
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,21 +6,21 @@ 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
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: ACCEPT, ChatFontNormal
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
|
||||
if not AceGUIMultiLineEditBoxInsertLink then
|
||||
-- upgradeable hook
|
||||
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIMultiLineEditBoxInsertLink(...) end)
|
||||
if ChatFrameUtil and ChatFrameUtil.InsertLink then
|
||||
hooksecurefunc(ChatFrameUtil, "InsertLink", function(...) return _G.AceGUIMultiLineEditBoxInsertLink(...) end)
|
||||
elseif ChatEdit_InsertLink then
|
||||
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIMultiLineEditBoxInsertLink(...) end)
|
||||
end
|
||||
end
|
||||
|
||||
function _G.AceGUIMultiLineEditBoxInsertLink(text)
|
||||
@@ -104,9 +104,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
|
||||
@@ -145,6 +149,14 @@ local function OnVerticalScroll(self, offset)
|
||||
editBox:SetHitRectInsets(0, 0, offset, editBox:GetHeight() - offset - self:GetHeight())
|
||||
end
|
||||
|
||||
local function OnScrollRangeChanged(self, xrange, yrange)
|
||||
if yrange == 0 then
|
||||
self.obj.editBox:SetHitRectInsets(0, 0, 0, 0)
|
||||
else
|
||||
OnVerticalScroll(self, self:GetVerticalScroll())
|
||||
end
|
||||
end
|
||||
|
||||
local function OnShowFocus(frame)
|
||||
frame.obj.editBox:SetFocus()
|
||||
frame:SetScript("OnShow", nil)
|
||||
@@ -257,8 +269,6 @@ local methods = {
|
||||
["SetCursorPosition"] = function(self, ...)
|
||||
return self.editBox:SetCursorPosition(...)
|
||||
end,
|
||||
|
||||
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
@@ -283,7 +293,7 @@ local function Constructor()
|
||||
label:SetText(ACCEPT)
|
||||
label:SetHeight(10)
|
||||
|
||||
local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, "UIPanelButtonTemplate2")
|
||||
local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, "UIPanelButtonTemplate")
|
||||
button:SetPoint("BOTTOMLEFT", 0, 4)
|
||||
button:SetHeight(22)
|
||||
button:SetWidth(label:GetStringWidth() + 24)
|
||||
@@ -297,7 +307,7 @@ local function Constructor()
|
||||
text:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -5, 1)
|
||||
text:SetJustifyV("MIDDLE")
|
||||
|
||||
local scrollBG = CreateFrame("Frame", nil, frame)
|
||||
local scrollBG = CreateFrame("Frame", nil, frame, "BackdropTemplate")
|
||||
scrollBG:SetBackdrop(backdrop)
|
||||
scrollBG:SetBackdropColor(0, 0, 0)
|
||||
scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4)
|
||||
@@ -321,6 +331,7 @@ local function Constructor()
|
||||
scrollFrame:SetScript("OnReceiveDrag", OnReceiveDrag)
|
||||
scrollFrame:SetScript("OnSizeChanged", OnSizeChanged)
|
||||
scrollFrame:HookScript("OnVerticalScroll", OnVerticalScroll)
|
||||
scrollFrame:HookScript("OnScrollRangeChanged", OnScrollRangeChanged)
|
||||
|
||||
local editBox = CreateFrame("EditBox", ("%s%dEdit"):format(Type, widgetNum), scrollFrame)
|
||||
editBox:SetAllPoints()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Slider Widget
|
||||
Graphical Slider, like, for Range values.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "Slider", 20
|
||||
local Type, Version = "Slider", 24
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
@@ -14,10 +14,6 @@ local tonumber, pairs = tonumber, pairs
|
||||
local PlaySound = PlaySound
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: GameFontHighlightSmall
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Support functions
|
||||
-------------------------------------------------------------------------------]]
|
||||
@@ -31,13 +27,13 @@ local function UpdateText(self)
|
||||
end
|
||||
|
||||
local function UpdateLabels(self)
|
||||
local min, max = (self.min or 0), (self.max or 100)
|
||||
local min_value, max_value = (self.min or 0), (self.max or 100)
|
||||
if self.ispercent then
|
||||
self.lowtext:SetFormattedText("%s%%", (min * 100))
|
||||
self.hightext:SetFormattedText("%s%%", (max * 100))
|
||||
self.lowtext:SetFormattedText("%s%%", (min_value * 100))
|
||||
self.hightext:SetFormattedText("%s%%", (max_value * 100))
|
||||
else
|
||||
self.lowtext:SetText(min)
|
||||
self.hightext:SetText(max)
|
||||
self.lowtext:SetText(min_value)
|
||||
self.hightext:SetText(max_value)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -60,6 +56,10 @@ end
|
||||
local function Slider_OnValueChanged(frame, newvalue)
|
||||
local self = frame.obj
|
||||
if not frame.setup then
|
||||
if self.step and self.step > 0 then
|
||||
local min_value = self.min or 0
|
||||
newvalue = floor((newvalue - min_value) / self.step + 0.5) * self.step + min_value
|
||||
end
|
||||
if newvalue ~= self.value and not self.disabled then
|
||||
self.value = newvalue
|
||||
self:Fire("OnValueChanged", newvalue)
|
||||
@@ -103,7 +103,7 @@ local function EditBox_OnEnterPressed(frame)
|
||||
end
|
||||
|
||||
if value then
|
||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
||||
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
|
||||
self.slider:SetValue(value)
|
||||
self:Fire("OnMouseUp", value)
|
||||
end
|
||||
@@ -171,16 +171,13 @@ local methods = {
|
||||
self.label:SetText(text)
|
||||
end,
|
||||
|
||||
["SetSliderValues"] = function(self, min, max, step)
|
||||
if type(min) == 'function' then min = min() end -- ElvUI
|
||||
if type(max) == 'function' then max = max() end -- ElvUI
|
||||
|
||||
["SetSliderValues"] = function(self, min_value, max_value, step)
|
||||
local frame = self.slider
|
||||
frame.setup = true
|
||||
self.min = min
|
||||
self.max = max
|
||||
self.min = min_value
|
||||
self.max = max_value
|
||||
self.step = step
|
||||
frame:SetMinMaxValues(min or 0,max or 100)
|
||||
frame:SetMinMaxValues(min_value or 0,max_value or 100)
|
||||
UpdateLabels(self)
|
||||
frame:SetValueStep(step or 1)
|
||||
if self.value then
|
||||
@@ -224,7 +221,7 @@ local function Constructor()
|
||||
label:SetJustifyH("CENTER")
|
||||
label:SetHeight(15)
|
||||
|
||||
local slider = CreateFrame("Slider", nil, frame)
|
||||
local slider = CreateFrame("Slider", nil, frame, "BackdropTemplate")
|
||||
slider:SetOrientation("HORIZONTAL")
|
||||
slider:SetHeight(15)
|
||||
slider:SetHitRectInsets(0, 0, -10, 0)
|
||||
@@ -246,7 +243,7 @@ local function Constructor()
|
||||
local hightext = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
|
||||
hightext:SetPoint("TOPRIGHT", slider, "BOTTOMRIGHT", -2, 3)
|
||||
|
||||
local editbox = CreateFrame("EditBox", nil, frame)
|
||||
local editbox = CreateFrame("EditBox", nil, frame, "BackdropTemplate")
|
||||
editbox:SetAutoFocus(false)
|
||||
editbox:SetFontObject(GameFontHighlightSmall)
|
||||
editbox:SetPoint("TOP", slider, "BOTTOM")
|
||||
@@ -276,6 +273,7 @@ local function Constructor()
|
||||
widget[method] = func
|
||||
end
|
||||
slider.obj, editbox.obj = widget, widget
|
||||
C_Timer.After(0.3, function() editbox:SetText(" ") UpdateText(widget) end) -- Workaround for font loading issue, making the editboxes blank until the text is changed
|
||||
|
||||
return AceGUI:RegisterAsWidget(widget)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user