mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 16:34:45 +00:00
@@ -32,14 +32,14 @@ function select(n, ...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if n == "#" then
|
if n == "#" then
|
||||||
return arg.n
|
return getn(arg)
|
||||||
elseif n == 1 then
|
elseif n == 1 then
|
||||||
return unpack(arg)
|
return unpack(arg)
|
||||||
end
|
end
|
||||||
|
|
||||||
local args = {}
|
local args = {}
|
||||||
|
|
||||||
for i = n, arg.n do
|
for i = n, getn(arg) do
|
||||||
args[i-n+1] = arg[i]
|
args[i-n+1] = arg[i]
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ function string.join(delimiter, ...)
|
|||||||
error(format("bad argument #1 to 'join' (string expected, got %s)", delimiter and type(delimiter) or "no value"), 2)
|
error(format("bad argument #1 to 'join' (string expected, got %s)", delimiter and type(delimiter) or "no value"), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
if arg.n == 0 then
|
if getn(arg) == 0 then
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -339,27 +339,27 @@ wipe = table.wipe
|
|||||||
|
|
||||||
local LOCAL_ToStringAllTemp = {}
|
local LOCAL_ToStringAllTemp = {}
|
||||||
function tostringall(...)
|
function tostringall(...)
|
||||||
local n = arg.n
|
local n = getn(arg)
|
||||||
-- Simple versions for common argument counts
|
-- Simple versions for common argument counts
|
||||||
if n == 1 then
|
if (n == 1) then
|
||||||
return tostring(arg[1])
|
return tostring(arg[1])
|
||||||
elseif n == 2 then
|
elseif (n == 2) then
|
||||||
return tostring(arg[1]), tostring(arg[2])
|
return tostring(arg[1]), tostring(arg[2])
|
||||||
elseif n == 3 then
|
elseif (n == 3) then
|
||||||
return tostring(arg[1]), tostring(arg[2]), tostring(arg[3])
|
return tostring(arg[1]), tostring(arg[2]), tostring(arg[3])
|
||||||
elseif n == 0 then
|
elseif (n == 0) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local needfix
|
local needfix
|
||||||
for i = 1, n do
|
for i = 1, n do
|
||||||
local v = arg[i]
|
local v = arg[i]
|
||||||
if type(v) ~= "string" then
|
if (type(v) ~= "string") then
|
||||||
needfix = i
|
needfix = i
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not needfix then return unpack(arg) end
|
if (not needfix) then return unpack(arg) end
|
||||||
|
|
||||||
wipe(LOCAL_ToStringAllTemp)
|
wipe(LOCAL_ToStringAllTemp)
|
||||||
for i = 1, needfix - 1 do
|
for i = 1, needfix - 1 do
|
||||||
@@ -377,7 +377,7 @@ local LOCAL_PrintHandler = function(...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function setprinthandler(func)
|
function setprinthandler(func)
|
||||||
if type(func) ~= "function" then
|
if (type(func) ~= "function") then
|
||||||
error("Invalid print handler")
|
error("Invalid print handler")
|
||||||
else
|
else
|
||||||
LOCAL_PrintHandler = func
|
LOCAL_PrintHandler = func
|
||||||
@@ -388,7 +388,7 @@ function getprinthandler() return LOCAL_PrintHandler end
|
|||||||
|
|
||||||
local function print_inner(...)
|
local function print_inner(...)
|
||||||
local ok, err = pcall(LOCAL_PrintHandler, unpack(arg))
|
local ok, err = pcall(LOCAL_PrintHandler, unpack(arg))
|
||||||
if not ok then
|
if (not ok) then
|
||||||
local func = geterrorhandler()
|
local func = geterrorhandler()
|
||||||
func(err)
|
func(err)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ function EventTraceFrame_OnEvent(self, event, ...)
|
|||||||
self.framesSinceLast[nextIndex] = 0
|
self.framesSinceLast[nextIndex] = 0
|
||||||
self.eventids[nextIndex] = GetCurrentEventID()
|
self.eventids[nextIndex] = GetCurrentEventID()
|
||||||
|
|
||||||
local numArgs = arg.n
|
local numArgs = getn(arg)
|
||||||
for i = 1, numArgs do
|
for i = 1, numArgs do
|
||||||
if not self.args[i] then
|
if not self.args[i] then
|
||||||
self.args[i] = {}
|
self.args[i] = {}
|
||||||
@@ -169,7 +169,7 @@ function EventTraceFrame_OnSizeChanged(self, width, height)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function EventTraceFrame_Update()
|
function EventTraceFrame_Update ()
|
||||||
local offset = 0
|
local offset = 0
|
||||||
|
|
||||||
local scrollBar = _G["EventTraceFrameScroll"]
|
local scrollBar = _G["EventTraceFrameScroll"]
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ local function CreateDispatcher(argCount)
|
|||||||
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler)
|
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler)
|
||||||
end
|
end
|
||||||
|
|
||||||
local Dispatchers = setmetatable({}, {__index = function(self, argCount)
|
local Dispatchers = setmetatable({}, {__index=function(self, argCount)
|
||||||
local dispatcher = CreateDispatcher(argCount)
|
local dispatcher = CreateDispatcher(argCount)
|
||||||
rawset(self, argCount, dispatcher)
|
rawset(self, argCount, dispatcher)
|
||||||
return dispatcher
|
return dispatcher
|
||||||
@@ -67,7 +67,7 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll
|
|||||||
|
|
||||||
RegisterName = RegisterName or "RegisterCallback"
|
RegisterName = RegisterName or "RegisterCallback"
|
||||||
UnregisterName = UnregisterName or "UnregisterCallback"
|
UnregisterName = UnregisterName or "UnregisterCallback"
|
||||||
if UnregisterAllName == nil then -- false is used to indicate "don't want this method"
|
if UnregisterAllName==nil then -- false is used to indicate "don't want this method"
|
||||||
UnregisterAllName = "UnregisterAllCallbacks"
|
UnregisterAllName = "UnregisterAllCallbacks"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll
|
|||||||
local oldrecurse = registry.recurse
|
local oldrecurse = registry.recurse
|
||||||
registry.recurse = oldrecurse + 1
|
registry.recurse = oldrecurse + 1
|
||||||
|
|
||||||
Dispatchers[arg.n + 1](events[eventname], eventname, unpack(arg))
|
Dispatchers[getn(arg) + 1](events[eventname], eventname, unpack(arg))
|
||||||
|
|
||||||
registry.recurse = oldrecurse
|
registry.recurse = oldrecurse
|
||||||
|
|
||||||
@@ -130,24 +130,24 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll
|
|||||||
-- self["method"] calling style
|
-- self["method"] calling style
|
||||||
if type(self) ~= "table" then
|
if type(self) ~= "table" then
|
||||||
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2)
|
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2)
|
||||||
elseif self == target then
|
elseif self==target then
|
||||||
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2)
|
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2)
|
||||||
elseif type(self[method]) ~= "function" then
|
elseif type(self[method]) ~= "function" then
|
||||||
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2)
|
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
if arg.n >= 1 then -- this is not the same as testing for arg==nil!
|
if getn(arg)>=1 then -- this is not the same as testing for arg==nil!
|
||||||
regfunc = function(...) self[method](self,arg1,unpack(arg)) end
|
regfunc = function(...) self[method](self,arg1,unpack(arg)) end
|
||||||
else
|
else
|
||||||
regfunc = function(...) self[method](self,unpack(arg)) end
|
regfunc = function(...) self[method](self,unpack(arg)) end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- function ref with self=object or self="addonId" or self=thread
|
-- function ref with self=object or self="addonId" or self=thread
|
||||||
if type(self) ~= "table" and type(self) ~= "string" and type(self) ~= "thread" then
|
if type(self)~="table" and type(self)~="string" and type(self)~="thread" then
|
||||||
error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string or thread expected.", 2)
|
error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string or thread expected.", 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
if arg.n >= 1 then -- this is not the same as testing for arg==nil!
|
if getn(arg)>=1 then -- this is not the same as testing for arg==nil!
|
||||||
regfunc = function(...) method(arg1,unpack(arg)) end
|
regfunc = function(...) method(arg1,unpack(arg)) end
|
||||||
else
|
else
|
||||||
regfunc = method
|
regfunc = method
|
||||||
@@ -173,7 +173,7 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll
|
|||||||
|
|
||||||
-- Unregister a callback
|
-- Unregister a callback
|
||||||
target[UnregisterName] = function(self, eventname)
|
target[UnregisterName] = function(self, eventname)
|
||||||
if not self or self == target then
|
if not self or self==target then
|
||||||
error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2)
|
error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2)
|
||||||
end
|
end
|
||||||
if type(eventname) ~= "string" then
|
if type(eventname) ~= "string" then
|
||||||
@@ -194,15 +194,15 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll
|
|||||||
-- OPTIONAL: Unregister all callbacks for given selfs/addonIds
|
-- OPTIONAL: Unregister all callbacks for given selfs/addonIds
|
||||||
if UnregisterAllName then
|
if UnregisterAllName then
|
||||||
target[UnregisterAllName] = function(...)
|
target[UnregisterAllName] = function(...)
|
||||||
if getn(arg) < 1 then
|
if getn(arg)<1 then
|
||||||
error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2)
|
error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2)
|
||||||
end
|
end
|
||||||
if getn(arg) == 1 and arg1==target then
|
if getn(arg)==1 and arg1==target then
|
||||||
error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2)
|
error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
for i = 1, arg.n do
|
for i=1,getn(arg) do
|
||||||
local self = arg[i]
|
local self = arg[i]
|
||||||
if registry.insertQueue then
|
if registry.insertQueue then
|
||||||
for eventname, callbacks in pairs(registry.insertQueue) do
|
for eventname, callbacks in pairs(registry.insertQueue) do
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ local function setCleanupTables(...)
|
|||||||
if not LibCompress.frame:IsShown() then
|
if not LibCompress.frame:IsShown() then
|
||||||
LibCompress.frame:Show()
|
LibCompress.frame:Show()
|
||||||
end
|
end
|
||||||
for i = 1, arg.n do
|
for i = 1, getn(arg) do
|
||||||
tables_to_clean[(select(i, unpack(arg)))] = true
|
tables_to_clean[(select(i, unpack(arg)))] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1011,7 +1011,7 @@ function LibCompress:GetChatEncodeTable(reservedChars, escapeChars, mapChars)
|
|||||||
-- Also, because drunken status is unknown for the received, strings used with SendChatMessage should be terminated with
|
-- Also, because drunken status is unknown for the received, strings used with SendChatMessage should be terminated with
|
||||||
-- an identifying byte value, after which the server MAY add "...hic!" or as much as it can fit(!).
|
-- an identifying byte value, after which the server MAY add "...hic!" or as much as it can fit(!).
|
||||||
-- Pass the identifying byte as a reserved character to this function to ensure the encoding doesn't contain that value.
|
-- Pass the identifying byte as a reserved character to this function to ensure the encoding doesn't contain that value.
|
||||||
-- or use this: local message, match = gsub(arg1, "^(.*)\029.-$", "%1")
|
-- or use this: local message, match = arg1:gsub("^(.*)\029.-$", "%1")
|
||||||
-- arg1 is message from channel, \029 is the string terminator, but may be used in the encoded datastream as well. :-)
|
-- arg1 is message from channel, \029 is the string terminator, but may be used in the encoded datastream as well. :-)
|
||||||
-- This encoding will expand data anywhere from:
|
-- This encoding will expand data anywhere from:
|
||||||
-- 0% (average with pure ascii text)
|
-- 0% (average with pure ascii text)
|
||||||
|
|||||||
+70
-69
@@ -41,29 +41,29 @@ local function updateActiveUnit(self, event, unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function iterateChildren(...)
|
local function iterateChildren(...)
|
||||||
for i = 1, arg.n do
|
for i = 1, getn(arg) do
|
||||||
local obj = arg[i]
|
local obj = arg[i]
|
||||||
|
|
||||||
if type(obj) == "table" and obj.isChild then
|
if(type(obj) == "table" and obj.isChild) then
|
||||||
updateActiveUnit(obj, "iterateChildren")
|
updateActiveUnit(obj, "iterateChildren")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function onAttributeChanged(self, name, value)
|
local function onAttributeChanged(self, name, value)
|
||||||
if name == "unit" and value then
|
if(name == "unit" and value) then
|
||||||
if self.hasChildren then
|
if(self.hasChildren) then
|
||||||
iterateChildren(self:GetChildren())
|
iterateChildren(self:GetChildren())
|
||||||
end
|
end
|
||||||
|
|
||||||
if not self.onlyProcessChildren then
|
if(not self.onlyProcessChildren) then
|
||||||
updateActiveUnit(self, "OnAttributeChanged")
|
updateActiveUnit(self, "OnAttributeChanged")
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.unit and self.unit == value then
|
if(self.unit and self.unit == value) then
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
if self.hasChildren then
|
if(self.hasChildren) then
|
||||||
iterateChildren(self:GetChildren())
|
iterateChildren(self:GetChildren())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -79,22 +79,22 @@ Private.frame_metatable = frame_metatable
|
|||||||
for k, v in next, {
|
for k, v in next, {
|
||||||
UpdateElement = function(self, name)
|
UpdateElement = function(self, name)
|
||||||
local unit = self.unit
|
local unit = self.unit
|
||||||
if not unit or not UnitExists(unit) then return end
|
if(not unit or not UnitExists(unit)) then return end
|
||||||
|
|
||||||
local element = elements[name]
|
local element = elements[name]
|
||||||
if not element or not self:IsElementEnabled(name) or not activeElements[self] then return end
|
if(not element or not self:IsElementEnabled(name) or not activeElements[self]) then return end
|
||||||
if element.update then
|
if(element.update) then
|
||||||
element.update(self, "OnShow", unit)
|
element.update(self, "OnShow", unit)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
UpdateElement = function(self, name)
|
UpdateElement = function(self, name)
|
||||||
local unit = self.unit
|
local unit = self.unit
|
||||||
if not unit or not UnitExists(unit) then return end
|
if(not unit or not UnitExists(unit)) then return end
|
||||||
|
|
||||||
local element = elements[name]
|
local element = elements[name]
|
||||||
if not element or not self:IsElementEnabled(name) or not activeElements[self] then return end
|
if(not element or not self:IsElementEnabled(name) or not activeElements[self]) then return end
|
||||||
if element.update then
|
if(element.update) then
|
||||||
element.update(self, "OnShow", unit)
|
element.update(self, "OnShow", unit)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@@ -114,12 +114,12 @@ for k, v in next, {
|
|||||||
argcheck(unit or self.unit, 3, "string", "nil")
|
argcheck(unit or self.unit, 3, "string", "nil")
|
||||||
|
|
||||||
local element = elements[name]
|
local element = elements[name]
|
||||||
if not element or self:IsElementEnabled(name) or not activeElements[self] then return end
|
if(not element or self:IsElementEnabled(name) or not activeElements[self]) then return end
|
||||||
|
|
||||||
if element.enable(self, unit or self.unit) then
|
if(element.enable(self, unit or self.unit)) then
|
||||||
activeElements[self][name] = true
|
activeElements[self][name] = true
|
||||||
|
|
||||||
if element.update then
|
if(element.update) then
|
||||||
insert(self.__elements, element.update)
|
insert(self.__elements, element.update)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -135,11 +135,11 @@ for k, v in next, {
|
|||||||
argcheck(name, 2, "string")
|
argcheck(name, 2, "string")
|
||||||
|
|
||||||
local enabled = self:IsElementEnabled(name)
|
local enabled = self:IsElementEnabled(name)
|
||||||
if not enabled then return end
|
if(not enabled) then return end
|
||||||
|
|
||||||
local update = elements[name].update
|
local update = elements[name].update
|
||||||
for k, func in next, self.__elements do
|
for k, func in next, self.__elements do
|
||||||
if func == update then
|
if(func == update) then
|
||||||
remove(self.__elements, k)
|
remove(self.__elements, k)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@@ -166,7 +166,7 @@ for k, v in next, {
|
|||||||
argcheck(name, 2, "string")
|
argcheck(name, 2, "string")
|
||||||
|
|
||||||
local element = elements[name]
|
local element = elements[name]
|
||||||
if not element then return end
|
if(not element) then return end
|
||||||
|
|
||||||
local active = activeElements[self]
|
local active = activeElements[self]
|
||||||
return active and active[name]
|
return active and active[name]
|
||||||
@@ -199,11 +199,11 @@ for k, v in next, {
|
|||||||
--]]
|
--]]
|
||||||
UpdateAllElements = function(self, event)
|
UpdateAllElements = function(self, event)
|
||||||
local unit = self.unit
|
local unit = self.unit
|
||||||
if not UnitExists(unit) then return end
|
if(not UnitExists(unit)) then return end
|
||||||
|
|
||||||
assert(type(event) == "string", "Invalid argument 'event' in UpdateAllElements.")
|
assert(type(event) == "string", "Invalid argument 'event' in UpdateAllElements.")
|
||||||
|
|
||||||
if self.PreUpdate then
|
if(self.PreUpdate) then
|
||||||
self:PreUpdate(event)
|
self:PreUpdate(event)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ for k, v in next, {
|
|||||||
func(self, event, unit)
|
func(self, event, unit)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.PostUpdate then
|
if(self.PostUpdate) then
|
||||||
self:PostUpdate(event)
|
self:PostUpdate(event)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@@ -228,34 +228,34 @@ end
|
|||||||
local secureDropdown
|
local secureDropdown
|
||||||
local function InitializeSecureMenu()
|
local function InitializeSecureMenu()
|
||||||
local unit = SecureTemplatesDropdown.unit
|
local unit = SecureTemplatesDropdown.unit
|
||||||
if not unit then return end
|
if(not unit) then return end
|
||||||
|
|
||||||
local unitType = match(unit, "^([a-z]+)[0-9]+$") or unit
|
local unitType = match(unit, "^([a-z]+)[0-9]+$") or unit
|
||||||
|
|
||||||
local menu
|
local menu
|
||||||
if unitType == "party" then
|
if(unitType == "party") then
|
||||||
menu = "PARTY"
|
menu = "PARTY"
|
||||||
elseif UnitIsUnit(unit, "player") then
|
elseif(UnitIsUnit(unit, "player")) then
|
||||||
menu = "SELF"
|
menu = "SELF"
|
||||||
elseif UnitIsUnit(unit, "pet") then
|
elseif(UnitIsUnit(unit, "pet")) then
|
||||||
menu = "PET"
|
menu = "PET"
|
||||||
elseif UnitIsPlayer(unit) then
|
elseif(UnitIsPlayer(unit)) then
|
||||||
if UnitInRaid(unit) or UnitInParty(unit) then
|
if(UnitInRaid(unit) or UnitInParty(unit)) then
|
||||||
menu = "PARTY"
|
menu = "PARTY"
|
||||||
else
|
else
|
||||||
menu = "PLAYER"
|
menu = "PLAYER"
|
||||||
end
|
end
|
||||||
elseif UnitIsUnit(unit, "target") then
|
elseif(UnitIsUnit(unit, "target")) then
|
||||||
menu = "RAID_TARGET_ICON"
|
menu = "RAID_TARGET_ICON"
|
||||||
end
|
end
|
||||||
|
|
||||||
if menu then
|
if(menu) then
|
||||||
UnitPopup_ShowMenu(SecureTemplatesDropdown, menu, unit)
|
UnitPopup_ShowMenu(SecureTemplatesDropdown, menu, unit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function togglemenu(self, unit)
|
local function togglemenu(self, unit)
|
||||||
if not secureDropdown then
|
if(not secureDropdown) then
|
||||||
secureDropdown = CreateFrame("Frame", "SecureTemplatesDropdown", nil, "UIDropDownMenuTemplate")
|
secureDropdown = CreateFrame("Frame", "SecureTemplatesDropdown", nil, "UIDropDownMenuTemplate")
|
||||||
secureDropdown:SetID(1)
|
secureDropdown:SetID(1)
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ local function togglemenu(self, unit)
|
|||||||
UIDropDownMenu_Initialize(secureDropdown, InitializeSecureMenu, "MENU")
|
UIDropDownMenu_Initialize(secureDropdown, InitializeSecureMenu, "MENU")
|
||||||
end
|
end
|
||||||
|
|
||||||
if secureDropdown.openedFor and secureDropdown.openedFor ~= self then
|
if(secureDropdown.openedFor and secureDropdown.openedFor ~= self) then
|
||||||
CloseDropDownMenus()
|
CloseDropDownMenus()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -278,7 +278,8 @@ local function onShow(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function initObject(unit, style, styleFunc, header, ...)
|
local function initObject(unit, style, styleFunc, header, ...)
|
||||||
for i = 1, arg.n do
|
local num = getn(arg)
|
||||||
|
for i = 1, num do
|
||||||
local object = arg[i]
|
local object = arg[i]
|
||||||
local objectUnit = object.guessUnit or unit
|
local objectUnit = object.guessUnit or unit
|
||||||
local suffix = objectUnit and match(objectUnit or unit, "%w+target")
|
local suffix = objectUnit and match(objectUnit or unit, "%w+target")
|
||||||
@@ -302,9 +303,9 @@ local function initObject(unit, style, styleFunc, header, ...)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if not header then
|
if(not header) then
|
||||||
-- Other target units are handled by :HandleUnit().
|
-- Other target units are handled by :HandleUnit().
|
||||||
if suffix == "target" then
|
if(suffix == "target") then
|
||||||
enableTargetUpdate(object)
|
enableTargetUpdate(object)
|
||||||
else
|
else
|
||||||
oUF:HandleUnit(object, unit)
|
oUF:HandleUnit(object, unit)
|
||||||
@@ -313,7 +314,7 @@ local function initObject(unit, style, styleFunc, header, ...)
|
|||||||
-- Used to update frames when they change position in a group.
|
-- Used to update frames when they change position in a group.
|
||||||
object:RegisterEvent("RAID_ROSTER_UPDATE", object.UpdateAllElements)
|
object:RegisterEvent("RAID_ROSTER_UPDATE", object.UpdateAllElements)
|
||||||
|
|
||||||
if arg.n > 1 then
|
if(num > 1) then
|
||||||
if(object:GetParent() == header) then
|
if(object:GetParent() == header) then
|
||||||
object.hasChildren = true
|
object.hasChildren = true
|
||||||
else
|
else
|
||||||
@@ -321,7 +322,7 @@ local function initObject(unit, style, styleFunc, header, ...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if suffix == "target" then
|
if(suffix == "target") then
|
||||||
enableTargetUpdate(object)
|
enableTargetUpdate(object)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -355,7 +356,7 @@ local function walkObject(object, unit)
|
|||||||
local header = parent.headerType and parent
|
local header = parent.headerType and parent
|
||||||
|
|
||||||
-- Check if we should leave the main frame blank.
|
-- Check if we should leave the main frame blank.
|
||||||
if object.onlyProcessChildren then
|
if(object.onlyProcessChildren) then
|
||||||
object.hasChildren = true
|
object.hasChildren = true
|
||||||
return initObject(unit, style, styleFunc, header, object:GetChildren())
|
return initObject(unit, style, styleFunc, header, object:GetChildren())
|
||||||
end
|
end
|
||||||
@@ -384,7 +385,7 @@ function oUF:RegisterMetaFunction(name, func)
|
|||||||
argcheck(name, 2, "string")
|
argcheck(name, 2, "string")
|
||||||
argcheck(func, 3, "function", "table")
|
argcheck(func, 3, "function", "table")
|
||||||
|
|
||||||
if frame_metatable.__index[name] then
|
if(frame_metatable.__index[name]) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -402,8 +403,8 @@ function oUF:RegisterStyle(name, func)
|
|||||||
argcheck(name, 2, "string")
|
argcheck(name, 2, "string")
|
||||||
argcheck(func, 3, "function", "table")
|
argcheck(func, 3, "function", "table")
|
||||||
|
|
||||||
if styles[name] then return error("Style [%s] already registered.", name) end
|
if(styles[name]) then return error("Style [%s] already registered.", name) end
|
||||||
if not style then style = name end
|
if(not style) then style = name end
|
||||||
|
|
||||||
styles[name] = func
|
styles[name] = func
|
||||||
end
|
end
|
||||||
@@ -416,7 +417,7 @@ Used to set the active style.
|
|||||||
--]]
|
--]]
|
||||||
function oUF:SetActiveStyle(name)
|
function oUF:SetActiveStyle(name)
|
||||||
argcheck(name, 2, "string")
|
argcheck(name, 2, "string")
|
||||||
if not styles[name] then return error("Style [%s] does not exist.", name) end
|
if(not styles[name]) then return error("Style [%s] does not exist.", name) end
|
||||||
|
|
||||||
style = name
|
style = name
|
||||||
end
|
end
|
||||||
@@ -451,11 +452,11 @@ do
|
|||||||
function getCondition(...)
|
function getCondition(...)
|
||||||
local cond = ""
|
local cond = ""
|
||||||
|
|
||||||
for i = 1, arg.n do
|
for i = 1, getn(arg) do
|
||||||
local short = select(i, unpack(arg))
|
local short = select(i, unpack(arg))
|
||||||
|
|
||||||
local condition = conditions[short]
|
local condition = conditions[short]
|
||||||
if condition then
|
if(condition) then
|
||||||
cond = cond .. condition
|
cond = cond .. condition
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -468,29 +469,29 @@ local function generateName(unit, ...)
|
|||||||
local name = "oUF_" .. gsub(style, gsub("^oUF_?", ""), gsub("[^%a%d_]+", ""))
|
local name = "oUF_" .. gsub(style, gsub("^oUF_?", ""), gsub("[^%a%d_]+", ""))
|
||||||
|
|
||||||
local raid, party, groupFilter
|
local raid, party, groupFilter
|
||||||
for i = 1, arg.n, 2 do
|
for i = 1, getn(arg), 2 do
|
||||||
local att, val = select(i, unpack(arg))
|
local att, val = select(i, unpack(arg))
|
||||||
if att == "showRaid" then
|
if(att == "showRaid") then
|
||||||
raid = true
|
raid = true
|
||||||
elseif att == "showParty" then
|
elseif(att == "showParty") then
|
||||||
party = true
|
party = true
|
||||||
elseif att == "groupFilter" then
|
elseif(att == "groupFilter") then
|
||||||
groupFilter = val
|
groupFilter = val
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local append
|
local append
|
||||||
if raid then
|
if(raid) then
|
||||||
if groupFilter then
|
if(groupFilter) then
|
||||||
if type(groupFilter) == "number" and groupFilter > 0 then
|
if(type(groupFilter) == "number" and groupFilter > 0) then
|
||||||
append = groupFilter
|
append = groupFilter
|
||||||
elseif match(groupFilter, "TANK") then
|
elseif(match(groupFilter, "TANK")) then
|
||||||
append = "MainTank"
|
append = "MainTank"
|
||||||
elseif match(groupFilter, "ASSIST") then
|
elseif(match(groupFilter, "ASSIST")) then
|
||||||
append = "MainAssist"
|
append = "MainAssist"
|
||||||
else
|
else
|
||||||
local _, count = gsub(groupFilter, ",", "")
|
local _, count = gsub(groupFilter, ",", "")
|
||||||
if count == 0 then
|
if(count == 0) then
|
||||||
append = "Raid" .. groupFilter
|
append = "Raid" .. groupFilter
|
||||||
else
|
else
|
||||||
append = "Raid"
|
append = "Raid"
|
||||||
@@ -499,19 +500,19 @@ local function generateName(unit, ...)
|
|||||||
else
|
else
|
||||||
append = "Raid"
|
append = "Raid"
|
||||||
end
|
end
|
||||||
elseif party then
|
elseif(party) then
|
||||||
append = "Party"
|
append = "Party"
|
||||||
elseif unit then
|
elseif(unit) then
|
||||||
append = gsub(unit, "^%l", upper)
|
append = gsub(unit, "^%l", upper)
|
||||||
end
|
end
|
||||||
|
|
||||||
if append then
|
if(append) then
|
||||||
name = name .. append
|
name = name .. append
|
||||||
end
|
end
|
||||||
|
|
||||||
local base = name
|
local base = name
|
||||||
local i = 2
|
local i = 2
|
||||||
while _G[name] do
|
while(_G[name]) do
|
||||||
name = base .. i
|
name = base .. i
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
@@ -529,12 +530,12 @@ do
|
|||||||
local header = self:GetParent()
|
local header = self:GetParent()
|
||||||
|
|
||||||
local unit
|
local unit
|
||||||
if not self.onlyProcessChildren then
|
if(not self.onlyProcessChildren) then
|
||||||
local groupFilter = header:GetAttribute("groupFilter")
|
local groupFilter = header:GetAttribute("groupFilter")
|
||||||
|
|
||||||
if header:GetAttribute("showRaid") then
|
if(header:GetAttribute("showRaid")) then
|
||||||
unit = "raid"
|
unit = "raid"
|
||||||
elseif header:GetAttribute("showParty") then
|
elseif(header:GetAttribute("showParty")) then
|
||||||
unit = "party"
|
unit = "party"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -581,7 +582,7 @@ do
|
|||||||
* oUF-onlyProcessChildren - can be used to force headers to only process children (boolean?)
|
* oUF-onlyProcessChildren - can be used to force headers to only process children (boolean?)
|
||||||
--]]
|
--]]
|
||||||
function oUF:SpawnHeader(overrideName, template, visibility, ...)
|
function oUF:SpawnHeader(overrideName, template, visibility, ...)
|
||||||
if not style then return error("Unable to create frame. No styles have been registered.") end
|
if(not style) then return error("Unable to create frame. No styles have been registered.") end
|
||||||
|
|
||||||
template = (template or "oUF_GroupHeaderTemplate")
|
template = (template or "oUF_GroupHeaderTemplate")
|
||||||
|
|
||||||
@@ -595,9 +596,9 @@ do
|
|||||||
header.GetAttribute = getAttribute
|
header.GetAttribute = getAttribute
|
||||||
|
|
||||||
--header:SetAttribute("template", "SecureUnitButtonTemplate")
|
--header:SetAttribute("template", "SecureUnitButtonTemplate")
|
||||||
for i = 1, arg.n, 2 do
|
for i = 1, getn(arg), 2 do
|
||||||
local att, val = select(i, unpack(arg))
|
local att, val = select(i, unpack(arg))
|
||||||
if not att then break end
|
if(not att) then break end
|
||||||
|
|
||||||
header:SetAttribute(att, val)
|
header:SetAttribute(att, val)
|
||||||
end
|
end
|
||||||
@@ -612,14 +613,14 @@ do
|
|||||||
header.initialConfigFunction = initialConfigFunction
|
header.initialConfigFunction = initialConfigFunction
|
||||||
header.headerType = isPetHeader and "pet" or "group"
|
header.headerType = isPetHeader and "pet" or "group"
|
||||||
|
|
||||||
if header:GetAttribute("showParty") then
|
if(header:GetAttribute("showParty")) then
|
||||||
self:DisableBlizzard("party")
|
self:DisableBlizzard("party")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if visibility then
|
if(visibility) then
|
||||||
local type, list = split(" ", visibility, 2)
|
local type, list = split(" ", visibility, 2)
|
||||||
if list and type == "custom" then
|
if(list and type == "custom") then
|
||||||
RegisterStateDriver(header, "visibility", list)
|
RegisterStateDriver(header, "visibility", list)
|
||||||
header.visibility = list
|
header.visibility = list
|
||||||
else
|
else
|
||||||
@@ -643,7 +644,7 @@ Used to create a single unit frame and apply the currently active style to it.
|
|||||||
--]]
|
--]]
|
||||||
function oUF:Spawn(unit, overrideName)
|
function oUF:Spawn(unit, overrideName)
|
||||||
argcheck(unit, 2, "string")
|
argcheck(unit, 2, "string")
|
||||||
if not style then return error("Unable to create frame. No styles have been registered.") end
|
if(not style) then return error("Unable to create frame. No styles have been registered.") end
|
||||||
|
|
||||||
unit = lower(unit)
|
unit = lower(unit)
|
||||||
|
|
||||||
@@ -676,7 +677,7 @@ function oUF:AddElement(name, update, enable, disable)
|
|||||||
argcheck(enable, 4, "function", "nil")
|
argcheck(enable, 4, "function", "nil")
|
||||||
argcheck(disable, 5, "function", "nil")
|
argcheck(disable, 5, "function", "nil")
|
||||||
|
|
||||||
if elements[name] then return error("Element [%s] is already registered.", name) end
|
if(elements[name]) then return error("Element [%s] is already registered.", name) end
|
||||||
elements[name] = {
|
elements[name] = {
|
||||||
update = update;
|
update = update;
|
||||||
enable = enable;
|
enable = enable;
|
||||||
|
|||||||
@@ -404,6 +404,16 @@ function S:HandleSliderFrame(frame)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[for i = 1, frame:GetNumRegions() do
|
||||||
|
local region = select(i, frame:GetRegions())
|
||||||
|
if region and region:GetObjectType() == "FontString" then
|
||||||
|
local point, anchor, anchorPoint, x, y = region:GetPoint()
|
||||||
|
if anchorPoint:find("BOTTOM") then
|
||||||
|
E:Point(region, point, anchor, anchorPoint, x, y - 4)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end]]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1926,7 +1926,7 @@ function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...)
|
|||||||
local BlizOptions = AceConfigDialog.BlizOptions
|
local BlizOptions = AceConfigDialog.BlizOptions
|
||||||
|
|
||||||
local key = appName
|
local key = appName
|
||||||
local l = arg.n
|
local l = tgetn(arg)
|
||||||
for n = 1, l do
|
for n = 1, l do
|
||||||
key = key .. "\001" .. arg[n]
|
key = key .. "\001" .. arg[n]
|
||||||
end
|
end
|
||||||
|
|||||||
+2
-2
@@ -23,7 +23,7 @@ if not AceConfigRegistry.callbacks then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Lua APIs
|
-- Lua APIs
|
||||||
local tinsert, tconcat = table.insert, table.concat
|
local tinsert, tconcat, tgetn = table.insert, table.concat, table.getn
|
||||||
local strfind = string.find
|
local strfind = string.find
|
||||||
local type, tostring, pairs = type, tostring, pairs
|
local type, tostring, pairs = type, tostring, pairs
|
||||||
local error, assert = error, assert
|
local error, assert = error, assert
|
||||||
@@ -41,7 +41,7 @@ AceConfigRegistry.validated = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local function err(msg, errlvl, ...)
|
local function err(msg, errlvl, ...)
|
||||||
local l = arg.n
|
local l = tgetn(arg)
|
||||||
local i,j = 1,l
|
local i,j = 1,l
|
||||||
while i < j do
|
while i < j do
|
||||||
arg[i], arg[j] = arg[j], arg[i]
|
arg[i], arg[j] = arg[j], arg[i]
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ local function FirstFrameUpdate()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function BuildUniqueValue(...)
|
local function BuildUniqueValue(...)
|
||||||
local n = arg.n
|
local n = tgetn(arg)
|
||||||
if n == 1 then
|
if n == 1 then
|
||||||
return arg[1]
|
return arg[1]
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user