chore(libs): sync Ace3 to coa-ace3 (WoWUIDev master @ 52e5f2c)
Bring every embedded Ace3 / CallbackHandler / LibStub copy in line with the canonical Exiles/coa-ace3 bundle so LibStub resolution is predictable across all Exiles forks regardless of which addons are enabled. Libraries updated in this fork: AceAddon-3.0 13 (5 → 13) AceConfig-3.0 3 AceConfigCmd-3.0 14 AceConfigDialog-3.0 92 (78 → 92) AceConfigRegistry-3.0 22 (20 → 22) AceConsole-3.0 7 AceDB-3.0 33 (21 → 33) AceDBOptions-3.0 15 (12 → 15) AceEvent-3.0 4 AceGUI-3.0 41 AceTimer-3.0 17 (1017 → 17) CallbackHandler-1.0 8 (6 → 8) LibStub 2
This commit is contained in:
@@ -6,31 +6,31 @@
|
|||||||
-- * **OnEnable** which gets called during the PLAYER_LOGIN event, when most of the data provided by the game is already present.
|
-- * **OnEnable** which gets called during the PLAYER_LOGIN event, when most of the data provided by the game is already present.
|
||||||
-- * **OnDisable**, which is only called when your addon is manually being disabled.
|
-- * **OnDisable**, which is only called when your addon is manually being disabled.
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- A small (but complete) addon, that doesn't do anything,
|
-- -- A small (but complete) addon, that doesn't do anything,
|
||||||
-- -- but shows usage of the callbacks.
|
-- -- but shows usage of the callbacks.
|
||||||
-- local MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon")
|
-- local MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon")
|
||||||
--
|
--
|
||||||
-- function MyAddon:OnInitialize()
|
-- function MyAddon:OnInitialize()
|
||||||
-- -- do init tasks here, like loading the Saved Variables,
|
-- -- do init tasks here, like loading the Saved Variables,
|
||||||
-- -- or setting up slash commands.
|
-- -- or setting up slash commands.
|
||||||
-- end
|
-- end
|
||||||
--
|
--
|
||||||
-- function MyAddon:OnEnable()
|
-- function MyAddon:OnEnable()
|
||||||
-- -- Do more initialization here, that really enables the use of your addon.
|
-- -- Do more initialization here, that really enables the use of your addon.
|
||||||
-- -- Register Events, Hook functions, Create Frames, Get information from
|
-- -- Register Events, Hook functions, Create Frames, Get information from
|
||||||
-- -- the game that wasn't available in OnInitialize
|
-- -- the game that wasn't available in OnInitialize
|
||||||
-- end
|
-- end
|
||||||
--
|
--
|
||||||
-- function MyAddon:OnDisable()
|
-- function MyAddon:OnDisable()
|
||||||
-- -- Unhook, Unregister Events, Hide frames that you created.
|
-- -- Unhook, Unregister Events, Hide frames that you created.
|
||||||
-- -- You would probably only use an OnDisable if you want to
|
-- -- You would probably only use an OnDisable if you want to
|
||||||
-- -- build a "standby" mode, or be able to toggle modules on/off.
|
-- -- build a "standby" mode, or be able to toggle modules on/off.
|
||||||
-- end
|
-- end
|
||||||
-- @class file
|
-- @class file
|
||||||
-- @name AceAddon-3.0.lua
|
-- @name AceAddon-3.0.lua
|
||||||
-- @release $Id: AceAddon-3.0.lua 895 2009-12-06 16:28:55Z nevcairiel $
|
-- @release $Id$
|
||||||
|
|
||||||
local MAJOR, MINOR = "AceAddon-3.0", 5
|
local MAJOR, MINOR = "AceAddon-3.0", 13
|
||||||
local AceAddon, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
local AceAddon, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
||||||
|
|
||||||
if not AceAddon then return end -- No Upgrade needed.
|
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 loadstring, assert, error = loadstring, assert, error
|
||||||
local setmetatable, getmetatable, rawset, rawget = setmetatable, getmetatable, rawset, rawget
|
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
|
xpcall safecall implementation
|
||||||
]]
|
]]
|
||||||
@@ -62,43 +58,12 @@ local function errorhandler(err)
|
|||||||
return geterrorhandler()(err)
|
return geterrorhandler()(err)
|
||||||
end
|
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, ...)
|
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
|
-- 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
|
-- this safecall is used for optional functions like OnInitialize OnEnable etc. When they are not
|
||||||
-- present execution should continue without hinderance
|
-- present execution should continue without hinderance
|
||||||
if type(func) == "function" then
|
if type(func) == "function" then
|
||||||
return Dispatchers[select('#', ...)](func, ...)
|
return xpcall(func, errorhandler, ...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -106,17 +71,27 @@ end
|
|||||||
local Enable, Disable, EnableModule, DisableModule, Embed, NewModule, GetModule, GetName, SetDefaultModuleState, SetDefaultModuleLibraries, SetEnabledState, SetDefaultModulePrototype
|
local Enable, Disable, EnableModule, DisableModule, Embed, NewModule, GetModule, GetName, SetDefaultModuleState, SetDefaultModuleLibraries, SetEnabledState, SetDefaultModulePrototype
|
||||||
|
|
||||||
-- used in the addon metatable
|
-- used in the addon metatable
|
||||||
local function addontostring( self ) return self.name end
|
local function addontostring( self ) return self.name end
|
||||||
|
|
||||||
|
-- Check if the addon is queued for initialization
|
||||||
|
local function queuedForInitialization(addon)
|
||||||
|
for i = 1, #AceAddon.initializequeue do
|
||||||
|
if AceAddon.initializequeue[i] == addon then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
--- Create a new AceAddon-3.0 addon.
|
--- Create a new AceAddon-3.0 addon.
|
||||||
-- Any libraries you specified will be embeded, and the addon will be scheduled for
|
-- Any libraries you specified will be embeded, and the addon will be scheduled for
|
||||||
-- its OnInitialize and OnEnable callbacks.
|
-- its OnInitialize and OnEnable callbacks.
|
||||||
-- The final addon object, with all libraries embeded, will be returned.
|
-- The final addon object, with all libraries embeded, will be returned.
|
||||||
-- @paramsig [object ,]name[, lib, ...]
|
-- @paramsig [object ,]name[, lib, ...]
|
||||||
-- @param object Table to use as a base for the addon (optional)
|
-- @param object Table to use as a base for the addon (optional)
|
||||||
-- @param name Name of the addon object to create
|
-- @param name Name of the addon object to create
|
||||||
-- @param lib List of libraries to embed into the addon
|
-- @param lib List of libraries to embed into the addon
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Create a simple addon object
|
-- -- Create a simple addon object
|
||||||
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon", "AceEvent-3.0")
|
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon", "AceEvent-3.0")
|
||||||
--
|
--
|
||||||
@@ -136,10 +111,10 @@ function AceAddon:NewAddon(objectorname, ...)
|
|||||||
if type(name)~="string" then
|
if type(name)~="string" then
|
||||||
error(("Usage: NewAddon([object,] name, [lib, lib, lib, ...]): 'name' - string expected got '%s'."):format(type(name)), 2)
|
error(("Usage: NewAddon([object,] name, [lib, lib, lib, ...]): 'name' - string expected got '%s'."):format(type(name)), 2)
|
||||||
end
|
end
|
||||||
if self.addons[name] then
|
if self.addons[name] then
|
||||||
error(("Usage: NewAddon([object,] name, [lib, lib, lib, ...]): 'name' - Addon '%s' already exists."):format(name), 2)
|
error(("Usage: NewAddon([object,] name, [lib, lib, lib, ...]): 'name' - Addon '%s' already exists."):format(name), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
object = object or {}
|
object = object or {}
|
||||||
object.name = name
|
object.name = name
|
||||||
|
|
||||||
@@ -149,14 +124,15 @@ function AceAddon:NewAddon(objectorname, ...)
|
|||||||
for k, v in pairs(oldmeta) do addonmeta[k] = v end
|
for k, v in pairs(oldmeta) do addonmeta[k] = v end
|
||||||
end
|
end
|
||||||
addonmeta.__tostring = addontostring
|
addonmeta.__tostring = addontostring
|
||||||
|
|
||||||
setmetatable( object, addonmeta )
|
setmetatable( object, addonmeta )
|
||||||
self.addons[name] = object
|
self.addons[name] = object
|
||||||
object.modules = {}
|
object.modules = {}
|
||||||
|
object.orderedModules = {}
|
||||||
object.defaultModuleLibraries = {}
|
object.defaultModuleLibraries = {}
|
||||||
Embed( object ) -- embed NewModule, GetModule methods
|
Embed( object ) -- embed NewModule, GetModule methods
|
||||||
self:EmbedLibraries(object, select(i,...))
|
self:EmbedLibraries(object, select(i,...))
|
||||||
|
|
||||||
-- add to queue of addons to be initialized upon ADDON_LOADED
|
-- add to queue of addons to be initialized upon ADDON_LOADED
|
||||||
tinsert(self.initializequeue, object)
|
tinsert(self.initializequeue, object)
|
||||||
return object
|
return object
|
||||||
@@ -167,7 +143,7 @@ end
|
|||||||
-- Throws an error if the addon object cannot be found (except if silent is set).
|
-- Throws an error if the addon object cannot be found (except if silent is set).
|
||||||
-- @param name unique name of the addon object
|
-- @param name unique name of the addon object
|
||||||
-- @param silent if true, the addon is optional, silently return nil if its not found
|
-- @param silent if true, the addon is optional, silently return nil if its not found
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Get the Addon
|
-- -- Get the Addon
|
||||||
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon")
|
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon")
|
||||||
function AceAddon:GetAddon(name, silent)
|
function AceAddon:GetAddon(name, silent)
|
||||||
@@ -222,7 +198,7 @@ end
|
|||||||
-- @paramsig name[, silent]
|
-- @paramsig name[, silent]
|
||||||
-- @param name unique name of the module
|
-- @param name unique name of the module
|
||||||
-- @param silent if true, the module is optional, silently return nil if its not found (optional)
|
-- @param silent if true, the module is optional, silently return nil if its not found (optional)
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Get the Addon
|
-- -- Get the Addon
|
||||||
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon")
|
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon")
|
||||||
-- -- Get the Module
|
-- -- Get the Module
|
||||||
@@ -245,23 +221,23 @@ local function IsModuleTrue(self) return true end
|
|||||||
-- @param name unique name of the module
|
-- @param name unique name of the module
|
||||||
-- @param prototype object to derive this module from, methods and values from this table will be mixed into the module (optional)
|
-- @param prototype object to derive this module from, methods and values from this table will be mixed into the module (optional)
|
||||||
-- @param lib List of libraries to embed into the addon
|
-- @param lib List of libraries to embed into the addon
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Create a module with some embeded libraries
|
-- -- Create a module with some embeded libraries
|
||||||
-- MyModule = MyAddon:NewModule("MyModule", "AceEvent-3.0", "AceHook-3.0")
|
-- MyModule = MyAddon:NewModule("MyModule", "AceEvent-3.0", "AceHook-3.0")
|
||||||
--
|
--
|
||||||
-- -- Create a module with a prototype
|
-- -- Create a module with a prototype
|
||||||
-- local prototype = { OnEnable = function(self) print("OnEnable called!") end }
|
-- local prototype = { OnEnable = function(self) print("OnEnable called!") end }
|
||||||
-- MyModule = MyAddon:NewModule("MyModule", prototype, "AceEvent-3.0", "AceHook-3.0")
|
-- MyModule = MyAddon:NewModule("MyModule", prototype, "AceEvent-3.0", "AceHook-3.0")
|
||||||
function NewModule(self, name, prototype, ...)
|
function NewModule(self, name, prototype, ...)
|
||||||
if type(name) ~= "string" then error(("Usage: NewModule(name, [prototype, [lib, lib, lib, ...]): 'name' - string expected got '%s'."):format(type(name)), 2) end
|
if type(name) ~= "string" then error(("Usage: NewModule(name, [prototype, [lib, lib, lib, ...]): 'name' - string expected got '%s'."):format(type(name)), 2) end
|
||||||
if type(prototype) ~= "string" and type(prototype) ~= "table" and type(prototype) ~= "nil" then error(("Usage: NewModule(name, [prototype, [lib, lib, lib, ...]): 'prototype' - table (prototype), string (lib) or nil expected got '%s'."):format(type(prototype)), 2) end
|
if type(prototype) ~= "string" and type(prototype) ~= "table" and type(prototype) ~= "nil" then error(("Usage: NewModule(name, [prototype, [lib, lib, lib, ...]): 'prototype' - table (prototype), string (lib) or nil expected got '%s'."):format(type(prototype)), 2) end
|
||||||
|
|
||||||
if self.modules[name] then error(("Usage: NewModule(name, [prototype, [lib, lib, lib, ...]): 'name' - Module '%s' already exists."):format(name), 2) end
|
if self.modules[name] then error(("Usage: NewModule(name, [prototype, [lib, lib, lib, ...]): 'name' - Module '%s' already exists."):format(name), 2) end
|
||||||
|
|
||||||
-- modules are basically addons. We treat them as such. They will be added to the initializequeue properly as well.
|
-- modules are basically addons. We treat them as such. They will be added to the initializequeue properly as well.
|
||||||
-- NewModule can only be called after the parent addon is present thus the modules will be initialized after their parent is.
|
-- NewModule can only be called after the parent addon is present thus the modules will be initialized after their parent is.
|
||||||
local module = AceAddon:NewAddon(fmt("%s_%s", self.name or tostring(self), name))
|
local module = AceAddon:NewAddon(fmt("%s_%s", self.name or tostring(self), name))
|
||||||
|
|
||||||
module.IsModule = IsModuleTrue
|
module.IsModule = IsModuleTrue
|
||||||
module:SetEnabledState(self.defaultModuleState)
|
module:SetEnabledState(self.defaultModuleState)
|
||||||
module.moduleName = name
|
module.moduleName = name
|
||||||
@@ -276,23 +252,24 @@ function NewModule(self, name, prototype, ...)
|
|||||||
if not prototype or type(prototype) == "string" then
|
if not prototype or type(prototype) == "string" then
|
||||||
prototype = self.defaultModulePrototype or nil
|
prototype = self.defaultModulePrototype or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if type(prototype) == "table" then
|
if type(prototype) == "table" then
|
||||||
local mt = getmetatable(module)
|
local mt = getmetatable(module)
|
||||||
mt.__index = prototype
|
mt.__index = prototype
|
||||||
setmetatable(module, mt) -- More of a Base class type feel.
|
setmetatable(module, mt) -- More of a Base class type feel.
|
||||||
end
|
end
|
||||||
|
|
||||||
safecall(self.OnModuleCreated, self, module) -- Was in Ace2 and I think it could be a cool thing to have handy.
|
safecall(self.OnModuleCreated, self, module) -- Was in Ace2 and I think it could be a cool thing to have handy.
|
||||||
self.modules[name] = module
|
self.modules[name] = module
|
||||||
|
tinsert(self.orderedModules, module)
|
||||||
|
|
||||||
return module
|
return module
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the real name of the addon or module, without any prefix.
|
--- Returns the real name of the addon or module, without any prefix.
|
||||||
-- @name //addon//:GetName
|
-- @name //addon//:GetName
|
||||||
-- @paramsig
|
-- @paramsig
|
||||||
-- @usage
|
-- @usage
|
||||||
-- print(MyAddon:GetName())
|
-- print(MyAddon:GetName())
|
||||||
-- -- prints "MyAddon"
|
-- -- prints "MyAddon"
|
||||||
function GetName(self)
|
function GetName(self)
|
||||||
@@ -304,15 +281,20 @@ end
|
|||||||
-- and enabling all modules of the addon (unless explicitly disabled).\\
|
-- and enabling all modules of the addon (unless explicitly disabled).\\
|
||||||
-- :Enable() also sets the internal `enableState` variable to true
|
-- :Enable() also sets the internal `enableState` variable to true
|
||||||
-- @name //addon//:Enable
|
-- @name //addon//:Enable
|
||||||
-- @paramsig
|
-- @paramsig
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Enable MyModule
|
-- -- Enable MyModule
|
||||||
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon")
|
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon")
|
||||||
-- MyModule = MyAddon:GetModule("MyModule")
|
-- MyModule = MyAddon:GetModule("MyModule")
|
||||||
-- MyModule:Enable()
|
-- MyModule:Enable()
|
||||||
function Enable(self)
|
function Enable(self)
|
||||||
self:SetEnabledState(true)
|
self:SetEnabledState(true)
|
||||||
return AceAddon:EnableAddon(self)
|
|
||||||
|
-- nevcairiel 2013-04-27: don't enable an addon/module if its queued for init still
|
||||||
|
-- it'll be enabled after the init process
|
||||||
|
if not queuedForInitialization(self) then
|
||||||
|
return AceAddon:EnableAddon(self)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Disables the Addon, if possible, return true or false depending on success.
|
--- Disables the Addon, if possible, return true or false depending on success.
|
||||||
@@ -320,8 +302,8 @@ end
|
|||||||
-- and disabling all modules of the addon.\\
|
-- and disabling all modules of the addon.\\
|
||||||
-- :Disable() also sets the internal `enableState` variable to false
|
-- :Disable() also sets the internal `enableState` variable to false
|
||||||
-- @name //addon//:Disable
|
-- @name //addon//:Disable
|
||||||
-- @paramsig
|
-- @paramsig
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Disable MyAddon
|
-- -- Disable MyAddon
|
||||||
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon")
|
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon")
|
||||||
-- MyAddon:Disable()
|
-- MyAddon:Disable()
|
||||||
@@ -334,7 +316,7 @@ end
|
|||||||
-- Short-hand function that retrieves the module via `:GetModule` and calls `:Enable` on the module object.
|
-- Short-hand function that retrieves the module via `:GetModule` and calls `:Enable` on the module object.
|
||||||
-- @name //addon//:EnableModule
|
-- @name //addon//:EnableModule
|
||||||
-- @paramsig name
|
-- @paramsig name
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Enable MyModule using :GetModule
|
-- -- Enable MyModule using :GetModule
|
||||||
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon")
|
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon")
|
||||||
-- MyModule = MyAddon:GetModule("MyModule")
|
-- MyModule = MyAddon:GetModule("MyModule")
|
||||||
@@ -352,7 +334,7 @@ end
|
|||||||
-- Short-hand function that retrieves the module via `:GetModule` and calls `:Disable` on the module object.
|
-- Short-hand function that retrieves the module via `:GetModule` and calls `:Disable` on the module object.
|
||||||
-- @name //addon//:DisableModule
|
-- @name //addon//:DisableModule
|
||||||
-- @paramsig name
|
-- @paramsig name
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Disable MyModule using :GetModule
|
-- -- Disable MyModule using :GetModule
|
||||||
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon")
|
-- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon")
|
||||||
-- MyModule = MyAddon:GetModule("MyModule")
|
-- MyModule = MyAddon:GetModule("MyModule")
|
||||||
@@ -371,7 +353,7 @@ end
|
|||||||
-- @name //addon//:SetDefaultModuleLibraries
|
-- @name //addon//:SetDefaultModuleLibraries
|
||||||
-- @paramsig lib[, lib, ...]
|
-- @paramsig lib[, lib, ...]
|
||||||
-- @param lib List of libraries to embed into the addon
|
-- @param lib List of libraries to embed into the addon
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Create the addon object
|
-- -- Create the addon object
|
||||||
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon")
|
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon")
|
||||||
-- -- Configure default libraries for modules (all modules need AceEvent-3.0)
|
-- -- Configure default libraries for modules (all modules need AceEvent-3.0)
|
||||||
@@ -390,7 +372,7 @@ end
|
|||||||
-- @name //addon//:SetDefaultModuleState
|
-- @name //addon//:SetDefaultModuleState
|
||||||
-- @paramsig state
|
-- @paramsig state
|
||||||
-- @param state Default state for new modules, true for enabled, false for disabled
|
-- @param state Default state for new modules, true for enabled, false for disabled
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Create the addon object
|
-- -- Create the addon object
|
||||||
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon")
|
-- MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon")
|
||||||
-- -- Set the default state to "disabled"
|
-- -- Set the default state to "disabled"
|
||||||
@@ -410,7 +392,7 @@ end
|
|||||||
-- @name //addon//:SetDefaultModulePrototype
|
-- @name //addon//:SetDefaultModulePrototype
|
||||||
-- @paramsig prototype
|
-- @paramsig prototype
|
||||||
-- @param prototype Default prototype for the new modules (table)
|
-- @param prototype Default prototype for the new modules (table)
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Define a prototype
|
-- -- Define a prototype
|
||||||
-- local prototype = { OnEnable = function(self) print("OnEnable called!") end }
|
-- local prototype = { OnEnable = function(self) print("OnEnable called!") end }
|
||||||
-- -- Set the default prototype
|
-- -- Set the default prototype
|
||||||
@@ -442,8 +424,8 @@ end
|
|||||||
|
|
||||||
--- Return an iterator of all modules associated to the addon.
|
--- Return an iterator of all modules associated to the addon.
|
||||||
-- @name //addon//:IterateModules
|
-- @name //addon//:IterateModules
|
||||||
-- @paramsig
|
-- @paramsig
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Enable all modules
|
-- -- Enable all modules
|
||||||
-- for name, module in MyAddon:IterateModules() do
|
-- for name, module in MyAddon:IterateModules() do
|
||||||
-- module:Enable()
|
-- module:Enable()
|
||||||
@@ -452,13 +434,13 @@ local function IterateModules(self) return pairs(self.modules) end
|
|||||||
|
|
||||||
-- Returns an iterator of all embeds in the addon
|
-- Returns an iterator of all embeds in the addon
|
||||||
-- @name //addon//:IterateEmbeds
|
-- @name //addon//:IterateEmbeds
|
||||||
-- @paramsig
|
-- @paramsig
|
||||||
local function IterateEmbeds(self) return pairs(AceAddon.embeds[self]) end
|
local function IterateEmbeds(self) return pairs(AceAddon.embeds[self]) end
|
||||||
|
|
||||||
--- Query the enabledState of an addon.
|
--- Query the enabledState of an addon.
|
||||||
-- @name //addon//:IsEnabled
|
-- @name //addon//:IsEnabled
|
||||||
-- @paramsig
|
-- @paramsig
|
||||||
-- @usage
|
-- @usage
|
||||||
-- if MyAddon:IsEnabled() then
|
-- if MyAddon:IsEnabled() then
|
||||||
-- MyAddon:Disable()
|
-- MyAddon:Disable()
|
||||||
-- end
|
-- end
|
||||||
@@ -489,32 +471,34 @@ local pmixins = {
|
|||||||
-- target (object) - target object to embed aceaddon in
|
-- target (object) - target object to embed aceaddon in
|
||||||
--
|
--
|
||||||
-- this is a local function specifically since it's meant to be only called internally
|
-- this is a local function specifically since it's meant to be only called internally
|
||||||
function Embed(target)
|
function Embed(target, skipPMixins)
|
||||||
for k, v in pairs(mixins) do
|
for k, v in pairs(mixins) do
|
||||||
target[k] = v
|
target[k] = v
|
||||||
end
|
end
|
||||||
for k, v in pairs(pmixins) do
|
if not skipPMixins then
|
||||||
target[k] = target[k] or v
|
for k, v in pairs(pmixins) do
|
||||||
|
target[k] = target[k] or v
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- - Initialize the addon after creation.
|
-- - Initialize the addon after creation.
|
||||||
-- This function is only used internally during the ADDON_LOADED event
|
-- This function is only used internally during the ADDON_LOADED event
|
||||||
-- It will call the **OnInitialize** function on the addon object (if present),
|
-- It will call the **OnInitialize** function on the addon object (if present),
|
||||||
-- and the **OnEmbedInitialize** function on all embeded libraries.
|
-- and the **OnEmbedInitialize** function on all embeded libraries.
|
||||||
--
|
--
|
||||||
-- **Note:** Do not call this function manually, unless you're absolutely sure that you know what you are doing.
|
-- **Note:** Do not call this function manually, unless you're absolutely sure that you know what you are doing.
|
||||||
-- @param addon addon object to intialize
|
-- @param addon addon object to intialize
|
||||||
function AceAddon:InitializeAddon(addon)
|
function AceAddon:InitializeAddon(addon)
|
||||||
safecall(addon.OnInitialize, addon)
|
safecall(addon.OnInitialize, addon)
|
||||||
|
|
||||||
local embeds = self.embeds[addon]
|
local embeds = self.embeds[addon]
|
||||||
for i = 1, #embeds do
|
for i = 1, #embeds do
|
||||||
local lib = LibStub:GetLibrary(embeds[i], true)
|
local lib = LibStub:GetLibrary(embeds[i], true)
|
||||||
if lib then safecall(lib.OnEmbedInitialize, lib, addon) end
|
if lib then safecall(lib.OnEmbedInitialize, lib, addon) end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- we don't call InitializeAddon on modules specifically, this is handled
|
-- we don't call InitializeAddon on modules specifically, this is handled
|
||||||
-- from the event handler and only done _once_
|
-- from the event handler and only done _once_
|
||||||
end
|
end
|
||||||
@@ -522,7 +506,7 @@ end
|
|||||||
-- - Enable the addon after creation.
|
-- - Enable the addon after creation.
|
||||||
-- Note: This function is only used internally during the PLAYER_LOGIN event, or during ADDON_LOADED,
|
-- Note: This function is only used internally during the PLAYER_LOGIN event, or during ADDON_LOADED,
|
||||||
-- if IsLoggedIn() already returns true at that point, e.g. for LoD Addons.
|
-- if IsLoggedIn() already returns true at that point, e.g. for LoD Addons.
|
||||||
-- It will call the **OnEnable** function on the addon object (if present),
|
-- It will call the **OnEnable** function on the addon object (if present),
|
||||||
-- and the **OnEmbedEnable** function on all embeded libraries.\\
|
-- and the **OnEmbedEnable** function on all embeded libraries.\\
|
||||||
-- This function does not toggle the enable state of the addon itself, and will return early if the addon is disabled.
|
-- This function does not toggle the enable state of the addon itself, and will return early if the addon is disabled.
|
||||||
--
|
--
|
||||||
@@ -532,12 +516,12 @@ end
|
|||||||
function AceAddon:EnableAddon(addon)
|
function AceAddon:EnableAddon(addon)
|
||||||
if type(addon) == "string" then addon = AceAddon:GetAddon(addon) end
|
if type(addon) == "string" then addon = AceAddon:GetAddon(addon) end
|
||||||
if self.statuses[addon.name] or not addon.enabledState then return false end
|
if self.statuses[addon.name] or not addon.enabledState then return false end
|
||||||
|
|
||||||
-- set the statuses first, before calling the OnEnable. this allows for Disabling of the addon in OnEnable.
|
-- set the statuses first, before calling the OnEnable. this allows for Disabling of the addon in OnEnable.
|
||||||
self.statuses[addon.name] = true
|
self.statuses[addon.name] = true
|
||||||
|
|
||||||
safecall(addon.OnEnable, addon)
|
safecall(addon.OnEnable, addon)
|
||||||
|
|
||||||
-- make sure we're still enabled before continueing
|
-- make sure we're still enabled before continueing
|
||||||
if self.statuses[addon.name] then
|
if self.statuses[addon.name] then
|
||||||
local embeds = self.embeds[addon]
|
local embeds = self.embeds[addon]
|
||||||
@@ -545,10 +529,11 @@ function AceAddon:EnableAddon(addon)
|
|||||||
local lib = LibStub:GetLibrary(embeds[i], true)
|
local lib = LibStub:GetLibrary(embeds[i], true)
|
||||||
if lib then safecall(lib.OnEmbedEnable, lib, addon) end
|
if lib then safecall(lib.OnEmbedEnable, lib, addon) end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- enable possible modules.
|
-- enable possible modules.
|
||||||
for name, module in pairs(addon.modules) do
|
local modules = addon.orderedModules
|
||||||
self:EnableAddon(module)
|
for i = 1, #modules do
|
||||||
|
self:EnableAddon(modules[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self.statuses[addon.name] -- return true if we're disabled
|
return self.statuses[addon.name] -- return true if we're disabled
|
||||||
@@ -556,40 +541,41 @@ end
|
|||||||
|
|
||||||
-- - Disable the addon
|
-- - Disable the addon
|
||||||
-- Note: This function is only used internally.
|
-- Note: This function is only used internally.
|
||||||
-- It will call the **OnDisable** function on the addon object (if present),
|
-- It will call the **OnDisable** function on the addon object (if present),
|
||||||
-- and the **OnEmbedDisable** function on all embeded libraries.\\
|
-- and the **OnEmbedDisable** function on all embeded libraries.\\
|
||||||
-- This function does not toggle the enable state of the addon itself, and will return early if the addon is still enabled.
|
-- This function does not toggle the enable state of the addon itself, and will return early if the addon is still enabled.
|
||||||
--
|
--
|
||||||
-- **Note:** Do not call this function manually, unless you're absolutely sure that you know what you are doing.
|
-- **Note:** Do not call this function manually, unless you're absolutely sure that you know what you are doing.
|
||||||
-- Use :Disable on the addon itself instead.
|
-- Use :Disable on the addon itself instead.
|
||||||
-- @param addon addon object to enable
|
-- @param addon addon object to enable
|
||||||
function AceAddon:DisableAddon(addon)
|
function AceAddon:DisableAddon(addon)
|
||||||
if type(addon) == "string" then addon = AceAddon:GetAddon(addon) end
|
if type(addon) == "string" then addon = AceAddon:GetAddon(addon) end
|
||||||
if not self.statuses[addon.name] then return false end
|
if not self.statuses[addon.name] then return false end
|
||||||
|
|
||||||
-- set statuses first before calling OnDisable, this allows for aborting the disable in OnDisable.
|
-- set statuses first before calling OnDisable, this allows for aborting the disable in OnDisable.
|
||||||
self.statuses[addon.name] = false
|
self.statuses[addon.name] = false
|
||||||
|
|
||||||
safecall( addon.OnDisable, addon )
|
safecall( addon.OnDisable, addon )
|
||||||
|
|
||||||
-- make sure we're still disabling...
|
-- make sure we're still disabling...
|
||||||
if not self.statuses[addon.name] then
|
if not self.statuses[addon.name] then
|
||||||
local embeds = self.embeds[addon]
|
local embeds = self.embeds[addon]
|
||||||
for i = 1, #embeds do
|
for i = 1, #embeds do
|
||||||
local lib = LibStub:GetLibrary(embeds[i], true)
|
local lib = LibStub:GetLibrary(embeds[i], true)
|
||||||
if lib then safecall(lib.OnEmbedDisable, lib, addon) end
|
if lib then safecall(lib.OnEmbedDisable, lib, addon) end
|
||||||
end
|
end
|
||||||
-- disable possible modules.
|
-- disable possible modules.
|
||||||
for name, module in pairs(addon.modules) do
|
local modules = addon.orderedModules
|
||||||
self:DisableAddon(module)
|
for i = 1, #modules do
|
||||||
|
self:DisableAddon(modules[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return not self.statuses[addon.name] -- return true if we're disabled
|
return not self.statuses[addon.name] -- return true if we're disabled
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get an iterator over all registered addons.
|
--- Get an iterator over all registered addons.
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Print a list of all installed AceAddon's
|
-- -- Print a list of all installed AceAddon's
|
||||||
-- for name, addon in AceAddon:IterateAddons() do
|
-- for name, addon in AceAddon:IterateAddons() do
|
||||||
-- print("Addon: " .. name)
|
-- print("Addon: " .. name)
|
||||||
@@ -597,7 +583,7 @@ end
|
|||||||
function AceAddon:IterateAddons() return pairs(self.addons) end
|
function AceAddon:IterateAddons() return pairs(self.addons) end
|
||||||
|
|
||||||
--- Get an iterator over the internal status registry.
|
--- Get an iterator over the internal status registry.
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Print a list of all enabled addons
|
-- -- Print a list of all enabled addons
|
||||||
-- for name, status in AceAddon:IterateAddonStatus() do
|
-- for name, status in AceAddon:IterateAddonStatus() do
|
||||||
-- if status then
|
-- if status then
|
||||||
@@ -611,9 +597,20 @@ function AceAddon:IterateAddonStatus() return pairs(self.statuses) end
|
|||||||
function AceAddon:IterateEmbedsOnAddon(addon) return pairs(self.embeds[addon]) end
|
function AceAddon:IterateEmbedsOnAddon(addon) return pairs(self.embeds[addon]) end
|
||||||
function AceAddon:IterateModulesOfAddon(addon) return pairs(addon.modules) 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
|
-- Event Handling
|
||||||
local function onEvent(this, event, arg1)
|
local function onEvent(this, event, arg1)
|
||||||
if event == "ADDON_LOADED" 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
|
-- 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
|
while(#AceAddon.initializequeue > 0) do
|
||||||
local addon = tremove(AceAddon.initializequeue, 1)
|
local addon = tremove(AceAddon.initializequeue, 1)
|
||||||
@@ -622,7 +619,7 @@ local function onEvent(this, event, arg1)
|
|||||||
AceAddon:InitializeAddon(addon)
|
AceAddon:InitializeAddon(addon)
|
||||||
tinsert(AceAddon.enablequeue, addon)
|
tinsert(AceAddon.enablequeue, addon)
|
||||||
end
|
end
|
||||||
|
|
||||||
if IsLoggedIn() then
|
if IsLoggedIn() then
|
||||||
while(#AceAddon.enablequeue > 0) do
|
while(#AceAddon.enablequeue > 0) do
|
||||||
local addon = tremove(AceAddon.enablequeue, 1)
|
local addon = tremove(AceAddon.enablequeue, 1)
|
||||||
@@ -638,5 +635,15 @@ AceAddon.frame:SetScript("OnEvent", onEvent)
|
|||||||
|
|
||||||
-- upgrade embeded
|
-- upgrade embeded
|
||||||
for name, addon in pairs(AceAddon.addons) do
|
for name, addon in pairs(AceAddon.addons) do
|
||||||
Embed(addon)
|
Embed(addon, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 2010-10-27 nevcairiel - add new "orderedModules" table
|
||||||
|
if oldminor and oldminor < 10 then
|
||||||
|
for name, addon in pairs(AceAddon.addons) do
|
||||||
|
addon.orderedModules = {}
|
||||||
|
for module_name, module in pairs(addon.modules) do
|
||||||
|
tinsert(addon.orderedModules, module)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
-- as well as associate it with a slash command.
|
-- as well as associate it with a slash command.
|
||||||
-- @class file
|
-- @class file
|
||||||
-- @name AceConfig-3.0
|
-- @name AceConfig-3.0
|
||||||
-- @release $Id: AceConfig-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
|
-- @release $Id$
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
AceConfig-3.0
|
AceConfig-3.0
|
||||||
@@ -27,7 +27,7 @@ if not AceConfig then return end
|
|||||||
local pcall, error, type, pairs = pcall, error, type, pairs
|
local pcall, error, type, pairs = pcall, error, type, pairs
|
||||||
|
|
||||||
-- -------------------------------------------------------------------
|
-- -------------------------------------------------------------------
|
||||||
-- :RegisterOptionsTable(appName, options, slashcmd, persist)
|
-- :RegisterOptionsTable(appName, options, slashcmd)
|
||||||
--
|
--
|
||||||
-- - appName - (string) application name
|
-- - appName - (string) application name
|
||||||
-- - options - table or function ref, see AceConfigRegistry
|
-- - options - table or function ref, see AceConfigRegistry
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
--- AceConfigCmd-3.0 handles access to an options table through the "command line" interface via the ChatFrames.
|
--- AceConfigCmd-3.0 handles access to an options table through the "command line" interface via the ChatFrames.
|
||||||
-- @class file
|
-- @class file
|
||||||
-- @name AceConfigCmd-3.0
|
-- @name AceConfigCmd-3.0
|
||||||
-- @release $Id: AceConfigCmd-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
|
-- @release $Id$
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
AceConfigCmd-3.0
|
AceConfigCmd-3.0
|
||||||
@@ -37,17 +37,10 @@ local error, assert = error, assert
|
|||||||
-- WoW APIs
|
-- WoW APIs
|
||||||
local _G = _G
|
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
|
local L = setmetatable({}, { -- TODO: replace with proper locale
|
||||||
__index = function(self,k) return k end
|
__index = function(self,k) return k end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local function print(msg)
|
local function print(msg)
|
||||||
(SELECTED_CHAT_FRAME or DEFAULT_CHAT_FRAME):AddMessage(msg)
|
(SELECTED_CHAT_FRAME or DEFAULT_CHAT_FRAME):AddMessage(msg)
|
||||||
end
|
end
|
||||||
@@ -401,7 +394,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local str = strsub(info.input,inputpos);
|
local strInput = strsub(info.input,inputpos);
|
||||||
|
|
||||||
if tab.type=="execute" then
|
if tab.type=="execute" then
|
||||||
------------ execute --------------------------------------------
|
------------ execute --------------------------------------------
|
||||||
@@ -414,21 +407,21 @@ local function handle(info, inputpos, tab, depth, retfalse)
|
|||||||
|
|
||||||
local res = true
|
local res = true
|
||||||
if tab.pattern then
|
if tab.pattern then
|
||||||
if not(type(tab.pattern)=="string") then err(info, inputpos, "'pattern' - expected a string") end
|
if type(tab.pattern)~="string" then err(info, inputpos, "'pattern' - expected a string") end
|
||||||
if not strmatch(str, tab.pattern) then
|
if not strmatch(strInput, tab.pattern) then
|
||||||
usererr(info, inputpos, "'"..str.."' - " .. L["invalid input"])
|
usererr(info, inputpos, "'"..strInput.."' - " .. L["invalid input"])
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
do_final(info, inputpos, tab, "set", str)
|
do_final(info, inputpos, tab, "set", strInput)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
elseif tab.type=="toggle" then
|
elseif tab.type=="toggle" then
|
||||||
------------ toggle --------------------------------------------
|
------------ toggle --------------------------------------------
|
||||||
local b
|
local b
|
||||||
local str = strtrim(strlower(str))
|
local str = strtrim(strlower(strInput))
|
||||||
if str=="" then
|
if str=="" then
|
||||||
b = callmethod(info, inputpos, tab, "get")
|
b = callmethod(info, inputpos, tab, "get")
|
||||||
|
|
||||||
@@ -465,9 +458,9 @@ local function handle(info, inputpos, tab, depth, retfalse)
|
|||||||
|
|
||||||
elseif tab.type=="range" then
|
elseif tab.type=="range" then
|
||||||
------------ range --------------------------------------------
|
------------ range --------------------------------------------
|
||||||
local val = tonumber(str)
|
local val = tonumber(strInput)
|
||||||
if not val then
|
if not val then
|
||||||
usererr(info, inputpos, "'"..str.."' - "..L["expected number"])
|
usererr(info, inputpos, "'"..strInput.."' - "..L["expected number"])
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if type(info.step)=="number" then
|
if type(info.step)=="number" then
|
||||||
@@ -487,7 +480,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
|
|||||||
|
|
||||||
elseif tab.type=="select" then
|
elseif tab.type=="select" then
|
||||||
------------ select ------------------------------------
|
------------ select ------------------------------------
|
||||||
local str = strtrim(strlower(str))
|
local str = strtrim(strlower(strInput))
|
||||||
|
|
||||||
local values = tab.values
|
local values = tab.values
|
||||||
if type(values) == "function" or type(values) == "string" then
|
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
|
elseif tab.type=="multiselect" then
|
||||||
------------ multiselect -------------------------------------------
|
------------ multiselect -------------------------------------------
|
||||||
local str = strtrim(strlower(str))
|
local str = strtrim(strlower(strInput))
|
||||||
|
|
||||||
local values = tab.values
|
local values = tab.values
|
||||||
if type(values) == "function" or type(values) == "string" then
|
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
|
--check that the opt is valid
|
||||||
local ok
|
local ok
|
||||||
for k,v in pairs(values) do
|
for k in pairs(values) do
|
||||||
if strlower(k)==opt then
|
if strlower(k)==opt then
|
||||||
opt = k -- overwrite with key (in case of case mismatches)
|
opt = k -- overwrite with key (in case of case mismatches)
|
||||||
ok = true
|
ok = true
|
||||||
@@ -634,7 +627,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
|
|||||||
|
|
||||||
elseif tab.type=="color" then
|
elseif tab.type=="color" then
|
||||||
------------ color --------------------------------------------
|
------------ color --------------------------------------------
|
||||||
local str = strtrim(strlower(str))
|
local str = strtrim(strlower(strInput))
|
||||||
if str == "" then
|
if str == "" then
|
||||||
--TODO: Show current value
|
--TODO: Show current value
|
||||||
return
|
return
|
||||||
@@ -706,7 +699,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
|
|||||||
|
|
||||||
elseif tab.type=="keybinding" then
|
elseif tab.type=="keybinding" then
|
||||||
------------ keybinding --------------------------------------------
|
------------ keybinding --------------------------------------------
|
||||||
local str = strtrim(strlower(str))
|
local str = strtrim(strlower(strInput))
|
||||||
if str == "" then
|
if str == "" then
|
||||||
--TODO: Show current value
|
--TODO: Show current value
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
--- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables.
|
--- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables.
|
||||||
-- @class file
|
-- @class file
|
||||||
-- @name AceConfigDialog-3.0
|
-- @name AceConfigDialog-3.0
|
||||||
-- @release $Id: AceConfigDialog-3.0.lua 1225 2019-08-06 13:37:52Z nevcairiel $
|
-- @release $Id$
|
||||||
|
|
||||||
local LibStub = LibStub
|
local LibStub = LibStub
|
||||||
local gui = LibStub("AceGUI-3.0")
|
local gui = LibStub("AceGUI-3.0")
|
||||||
local reg = LibStub("AceConfigRegistry-3.0")
|
local reg = LibStub("AceConfigRegistry-3.0")
|
||||||
|
|
||||||
local MAJOR, MINOR = "AceConfigDialog-3.0", 78
|
local MAJOR, MINOR = "AceConfigDialog-3.0", 92
|
||||||
local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
||||||
|
|
||||||
if not AceConfigDialog then return end
|
if not AceConfigDialog then return end
|
||||||
@@ -15,25 +15,20 @@ if not AceConfigDialog then return end
|
|||||||
AceConfigDialog.OpenFrames = AceConfigDialog.OpenFrames or {}
|
AceConfigDialog.OpenFrames = AceConfigDialog.OpenFrames or {}
|
||||||
AceConfigDialog.Status = AceConfigDialog.Status or {}
|
AceConfigDialog.Status = AceConfigDialog.Status or {}
|
||||||
AceConfigDialog.frame = AceConfigDialog.frame or CreateFrame("Frame")
|
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.apps = AceConfigDialog.frame.apps or {}
|
||||||
AceConfigDialog.frame.closing = AceConfigDialog.frame.closing or {}
|
AceConfigDialog.frame.closing = AceConfigDialog.frame.closing or {}
|
||||||
AceConfigDialog.frame.closeAllOverride = AceConfigDialog.frame.closeAllOverride or {}
|
AceConfigDialog.frame.closeAllOverride = AceConfigDialog.frame.closeAllOverride or {}
|
||||||
|
|
||||||
-- Lua APIs
|
-- 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 strmatch, format = string.match, string.format
|
||||||
local assert, loadstring, error = assert, loadstring, error
|
local error = error
|
||||||
local pairs, next, select, type, unpack, wipe = pairs, next, select, type, unpack, wipe
|
local pairs, next, select, type, unpack, ipairs = pairs, next, select, type, unpack, ipairs
|
||||||
local rawset, tostring, tonumber = rawset, tostring, tonumber
|
local tostring, tonumber = tostring, tonumber
|
||||||
local math_min, math_max, math_floor = math.min, math.max, math.floor
|
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 = {}
|
local emptyTbl = {}
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
@@ -45,39 +40,10 @@ local function errorhandler(err)
|
|||||||
return geterrorhandler()(err)
|
return geterrorhandler()(err)
|
||||||
end
|
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, ...)
|
local function safecall(func, ...)
|
||||||
return Dispatchers[select("#", ...)](func, ...)
|
if func then
|
||||||
|
return xpcall(func, errorhandler, ...)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local width_multiplier = 170
|
local width_multiplier = 170
|
||||||
@@ -181,6 +147,7 @@ local stringIsLiteral = {
|
|||||||
width = true,
|
width = true,
|
||||||
image = true,
|
image = true,
|
||||||
fontSize = true,
|
fontSize = true,
|
||||||
|
tooltipHyperlink = true
|
||||||
}
|
}
|
||||||
|
|
||||||
--Is Never a function or method
|
--Is Never a function or method
|
||||||
@@ -222,9 +189,8 @@ local function GetOptionsMemberValue(membername, option, options, path, appName,
|
|||||||
--We have a function to call
|
--We have a function to call
|
||||||
local info = new()
|
local info = new()
|
||||||
--traverse the options table, picking up the handler and filling the info with the path
|
--traverse the options table, picking up the handler and filling the info with the path
|
||||||
local handler
|
|
||||||
local group = options
|
local group = options
|
||||||
handler = group.handler or handler
|
local handler = group.handler
|
||||||
|
|
||||||
for i = 1, #path do
|
for i = 1, #path do
|
||||||
group = GetSubOption(group, path[i])
|
group = GetSubOption(group, path[i])
|
||||||
@@ -533,107 +499,163 @@ local function OptionOnMouseOver(widget, event)
|
|||||||
local options = user.options
|
local options = user.options
|
||||||
local path = user.path
|
local path = user.path
|
||||||
local appName = user.appName
|
local appName = user.appName
|
||||||
|
local tooltip = AceConfigDialog.tooltip
|
||||||
|
|
||||||
|
tooltip:SetOwner(widget.frame, "ANCHOR_TOPRIGHT")
|
||||||
|
|
||||||
|
local tooltipHyperlink = GetOptionsMemberValue("tooltipHyperlink", opt, options, path, appName)
|
||||||
|
if tooltipHyperlink then
|
||||||
|
tooltip:SetHyperlink(tooltipHyperlink)
|
||||||
|
tooltip:Show()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
GameTooltip:SetOwner(widget.frame, "ANCHOR_TOPRIGHT")
|
|
||||||
local name = GetOptionsMemberValue("name", opt, options, path, appName)
|
local name = GetOptionsMemberValue("name", opt, options, path, appName)
|
||||||
local desc = GetOptionsMemberValue("desc", opt, options, path, appName)
|
local desc = GetOptionsMemberValue("desc", opt, options, path, appName)
|
||||||
local usage = GetOptionsMemberValue("usage", opt, options, path, appName)
|
local usage = GetOptionsMemberValue("usage", opt, options, path, appName)
|
||||||
local descStyle = opt.descStyle
|
local descStyle = opt.descStyle
|
||||||
|
|
||||||
if descStyle and descStyle ~= "tooltip" then return end
|
if descStyle and descStyle ~= "tooltip" then return end
|
||||||
|
|
||||||
GameTooltip:SetText(name, 1, .82, 0, 1)
|
tooltip:SetText(name, 1, .82, 0, 1, true)
|
||||||
|
|
||||||
if opt.type == "multiselect" then
|
if opt.type == "multiselect" then
|
||||||
GameTooltip:AddLine(user.text,0.5, 0.5, 0.8, 1)
|
tooltip:AddLine(user.text, 0.5, 0.5, 0.8, true)
|
||||||
end
|
end
|
||||||
if type(desc) == "string" then
|
if type(desc) == "string" then
|
||||||
GameTooltip:AddLine(desc, 1, 1, 1, 1)
|
tooltip:AddLine(desc, 1, 1, 1, true)
|
||||||
end
|
end
|
||||||
if type(usage) == "string" then
|
if type(usage) == "string" then
|
||||||
GameTooltip:AddLine("Usage: "..usage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1)
|
tooltip:AddLine(usage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
GameTooltip:Show()
|
tooltip:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function OptionOnMouseLeave(widget, event)
|
local function OptionOnMouseLeave(widget, event)
|
||||||
GameTooltip:Hide()
|
AceConfigDialog.tooltip:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function GetFuncName(option)
|
local function GetFuncName(option)
|
||||||
local type = option.type
|
if option.type == "execute" then
|
||||||
if type == "execute" then
|
|
||||||
return "func"
|
return "func"
|
||||||
else
|
else
|
||||||
return "set"
|
return "set"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function confirmPopup(appName, rootframe, basepath, info, message, func, ...)
|
do
|
||||||
if not StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"] then
|
local InCombatLockdown = InCombatLockdown
|
||||||
StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"] = {}
|
local frame = AceConfigDialog.popup
|
||||||
end
|
if not frame or oldminor < 81 then
|
||||||
local t = StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"]
|
frame = CreateFrame("Frame", nil, UIParent)
|
||||||
for k in pairs(t) do
|
AceConfigDialog.popup = frame
|
||||||
t[k] = nil
|
frame:Hide()
|
||||||
end
|
frame:SetPoint("CENTER", UIParent, "CENTER")
|
||||||
t.text = message
|
frame:SetSize(320, 72)
|
||||||
t.button1 = ACCEPT
|
frame:EnableMouse(true) -- Do not allow click-through on the frame
|
||||||
t.button2 = CANCEL
|
frame:SetFrameStrata("TOOLTIP")
|
||||||
t.preferredIndex = STATICPOPUP_NUMDIALOGS
|
frame:SetFrameLevel(100) -- Lots of room to draw under it
|
||||||
local dialog, oldstrata
|
frame:SetScript("OnKeyDown", function(self, key)
|
||||||
t.OnAccept = function()
|
if key == "ESCAPE" then
|
||||||
safecall(func, unpack(t))
|
if not InCombatLockdown() then
|
||||||
if dialog and oldstrata then
|
self:SetPropagateKeyboardInput(false)
|
||||||
dialog:SetFrameStrata(oldstrata)
|
end
|
||||||
end
|
if self.cancel:IsShown() then
|
||||||
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl))
|
self.cancel:Click()
|
||||||
del(info)
|
else -- Showing a validation error
|
||||||
end
|
self:Hide()
|
||||||
t.OnCancel = function()
|
end
|
||||||
if dialog and oldstrata then
|
elseif not InCombatLockdown() then
|
||||||
dialog:SetFrameStrata(oldstrata)
|
self:SetPropagateKeyboardInput(true)
|
||||||
end
|
end
|
||||||
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl))
|
end)
|
||||||
del(info)
|
|
||||||
end
|
|
||||||
for i = 1, select("#", ...) do
|
|
||||||
t[i] = select(i, ...) or false
|
|
||||||
end
|
|
||||||
t.timeout = 0
|
|
||||||
t.whileDead = 1
|
|
||||||
t.hideOnEscape = 1
|
|
||||||
|
|
||||||
dialog = StaticPopup_Show("ACECONFIGDIALOG30_CONFIRM_DIALOG")
|
local border = CreateFrame("Frame", nil, frame, "DialogBorderOpaqueTemplate")
|
||||||
if dialog then
|
border:SetAllPoints(frame)
|
||||||
oldstrata = dialog:GetFrameStrata()
|
frame:SetFixedFrameStrata(true)
|
||||||
dialog:SetFrameStrata("TOOLTIP")
|
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(130763) -- "Interface\\Buttons\\UI-DialogBox-Button-Up"
|
||||||
|
button:GetNormalTexture():SetTexCoord(0.0, 1.0, 0.0, 0.71875)
|
||||||
|
button:SetPushedTexture(130761) -- "Interface\\Buttons\\UI-DialogBox-Button-Down"
|
||||||
|
button:GetPushedTexture():SetTexCoord(0.0, 1.0, 0.0, 0.71875)
|
||||||
|
button:SetHighlightTexture(130762) -- "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
|
||||||
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)
|
local function validationErrorPopup(message)
|
||||||
if not StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"] then
|
local frame = AceConfigDialog.popup
|
||||||
StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"] = {}
|
frame:Show()
|
||||||
end
|
frame.text:SetText(message)
|
||||||
local t = StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"]
|
-- From StaticPopup.lua
|
||||||
t.text = message
|
-- local height = 32 + text:GetHeight() + 2;
|
||||||
t.button1 = OKAY
|
-- height = height + 6 + accept:GetHeight()
|
||||||
t.preferredIndex = STATICPOPUP_NUMDIALOGS
|
-- We add 32 + 2 + 6 + 21 (button height) == 61
|
||||||
local dialog, oldstrata
|
local height = 61 + frame.text:GetHeight()
|
||||||
t.OnAccept = function()
|
frame:SetHeight(height)
|
||||||
if dialog and oldstrata then
|
|
||||||
dialog:SetFrameStrata(oldstrata)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
t.timeout = 0
|
|
||||||
t.whileDead = 1
|
|
||||||
t.hideOnEscape = 1
|
|
||||||
|
|
||||||
dialog = StaticPopup_Show("ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG")
|
frame.accept:ClearAllPoints()
|
||||||
if dialog then
|
frame.accept:SetPoint("BOTTOM", frame, "BOTTOM", 0, 16)
|
||||||
oldstrata = dialog:GetFrameStrata()
|
frame.cancel:Hide()
|
||||||
dialog:SetFrameStrata("TOOLTIP")
|
|
||||||
end
|
frame.accept:SetScript("OnClick", function()
|
||||||
|
frame:Hide()
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function ActivateControl(widget, event, ...)
|
local function ActivateControl(widget, event, ...)
|
||||||
@@ -656,7 +678,7 @@ local function ActivateControl(widget, event, ...)
|
|||||||
if group[funcname] ~= nil then
|
if group[funcname] ~= nil then
|
||||||
func = group[funcname]
|
func = group[funcname]
|
||||||
end
|
end
|
||||||
handler = group.handler or handler
|
handler = group.handler
|
||||||
confirm = group.confirm
|
confirm = group.confirm
|
||||||
validate = group.validate
|
validate = group.validate
|
||||||
for i = 1, #path do
|
for i = 1, #path do
|
||||||
@@ -720,7 +742,6 @@ local function ActivateControl(widget, event, ...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local rootframe = user.rootframe
|
|
||||||
if not validated or type(validated) == "string" then
|
if not validated or type(validated) == "string" then
|
||||||
if not validated then
|
if not validated then
|
||||||
if usage then
|
if usage then
|
||||||
@@ -735,12 +756,12 @@ local function ActivateControl(widget, event, ...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- show validate message
|
-- show validate message
|
||||||
if rootframe.SetStatusText then
|
if user.rootframe.SetStatusText then
|
||||||
rootframe:SetStatusText(validated)
|
user.rootframe:SetStatusText(validated)
|
||||||
else
|
else
|
||||||
validationErrorPopup(validated)
|
validationErrorPopup(validated)
|
||||||
end
|
end
|
||||||
PlaySound("igPlayerInviteDecline")
|
PlaySound(882) -- SOUNDKIT.IG_PLAYER_INVITE_DECLINE || _DECLINE is actually missing from the table
|
||||||
del(info)
|
del(info)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
@@ -773,14 +794,14 @@ local function ActivateControl(widget, event, ...)
|
|||||||
if type(confirm) == "boolean" then
|
if type(confirm) == "boolean" then
|
||||||
if confirm then
|
if confirm then
|
||||||
if not confirmText then
|
if not confirmText then
|
||||||
local name, desc = option.name, option.desc
|
local option_name, desc = option.name, option.desc
|
||||||
if type(name) == "function" then
|
if type(option_name) == "function" then
|
||||||
name = name(info)
|
option_name = option_name(info)
|
||||||
end
|
end
|
||||||
if type(desc) == "function" then
|
if type(desc) == "function" then
|
||||||
desc = desc(info)
|
desc = desc(info)
|
||||||
end
|
end
|
||||||
confirmText = name
|
confirmText = option_name
|
||||||
if desc then
|
if desc then
|
||||||
confirmText = confirmText.." - "..desc
|
confirmText = confirmText.." - "..desc
|
||||||
end
|
end
|
||||||
@@ -886,7 +907,7 @@ end
|
|||||||
|
|
||||||
local function MultiControlOnClosed(widget, event, ...)
|
local function MultiControlOnClosed(widget, event, ...)
|
||||||
local user = widget:GetUserDataTable()
|
local user = widget:GetUserDataTable()
|
||||||
if user.valuechanged then
|
if user.valuechanged and not widget:IsReleasing() then
|
||||||
local iscustom = user.rootframe:GetUserData("iscustom")
|
local iscustom = user.rootframe:GetUserData("iscustom")
|
||||||
local basepath = user.rootframe:GetUserData("basepath") or emptyTbl
|
local basepath = user.rootframe:GetUserData("basepath") or emptyTbl
|
||||||
if iscustom then
|
if iscustom then
|
||||||
@@ -1062,6 +1083,11 @@ local function InjectInfo(control, options, option, path, rootframe, appName)
|
|||||||
control:SetCallback("OnRelease", CleanUserData)
|
control:SetCallback("OnRelease", CleanUserData)
|
||||||
control:SetCallback("OnLeave", OptionOnMouseLeave)
|
control:SetCallback("OnLeave", OptionOnMouseLeave)
|
||||||
control:SetCallback("OnEnter", OptionOnMouseOver)
|
control:SetCallback("OnEnter", OptionOnMouseOver)
|
||||||
|
|
||||||
|
-- forward custom arg data directly
|
||||||
|
if control.SetCustomData and option.arg then
|
||||||
|
safecall(control.SetCustomData, control, option.arg)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function CreateControl(userControlType, fallbackControlType)
|
local function CreateControl(userControlType, fallbackControlType)
|
||||||
@@ -1122,8 +1148,6 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
|||||||
--Control to feed
|
--Control to feed
|
||||||
local control
|
local control
|
||||||
|
|
||||||
local name = GetOptionsMemberValue("name", v, options, path, appName)
|
|
||||||
|
|
||||||
if v.type == "execute" then
|
if v.type == "execute" then
|
||||||
|
|
||||||
local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName)
|
local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName)
|
||||||
@@ -1226,7 +1250,7 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
|||||||
end
|
end
|
||||||
tsort(sorting, sortTblAsStrings)
|
tsort(sorting, sortTblAsStrings)
|
||||||
end
|
end
|
||||||
for k, value in ipairs(sorting) do
|
for _, value in ipairs(sorting) do
|
||||||
local text = values[value]
|
local text = values[value]
|
||||||
local radio = gui:Create("CheckBox")
|
local radio = gui:Create("CheckBox")
|
||||||
radio:SetLabel(text)
|
radio:SetLabel(text)
|
||||||
@@ -1308,8 +1332,8 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
|||||||
control:SetWidth(width_multiplier)
|
control:SetWidth(width_multiplier)
|
||||||
end
|
end
|
||||||
--check:SetTriState(v.tristate)
|
--check:SetTriState(v.tristate)
|
||||||
for i = 1, #valuesort do
|
for s = 1, #valuesort do
|
||||||
local key = valuesort[i]
|
local key = valuesort[s]
|
||||||
local value = GetOptionsMemberValue("get",v, options, path, appName, key)
|
local value = GetOptionsMemberValue("get",v, options, path, appName, key)
|
||||||
control:SetItemValue(key,value)
|
control:SetItemValue(key,value)
|
||||||
end
|
end
|
||||||
@@ -1321,8 +1345,8 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
|||||||
|
|
||||||
control:PauseLayout()
|
control:PauseLayout()
|
||||||
local width = GetOptionsMemberValue("width",v,options,path,appName)
|
local width = GetOptionsMemberValue("width",v,options,path,appName)
|
||||||
for i = 1, #valuesort do
|
for s = 1, #valuesort do
|
||||||
local value = valuesort[i]
|
local value = valuesort[s]
|
||||||
local text = values[value]
|
local text = values[value]
|
||||||
local check = gui:Create("CheckBox")
|
local check = gui:Create("CheckBox")
|
||||||
check:SetLabel(text)
|
check:SetLabel(text)
|
||||||
@@ -1388,8 +1412,8 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
|||||||
|
|
||||||
local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName)
|
local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName)
|
||||||
local image, width, height = GetOptionsMemberValue("image",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
|
if not width then
|
||||||
width = GetOptionsMemberValue("imageWidth",v, options, path, appName)
|
width = GetOptionsMemberValue("imageWidth",v, options, path, appName)
|
||||||
end
|
end
|
||||||
@@ -1409,20 +1433,23 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
|
|||||||
end
|
end
|
||||||
control:SetImageSize(width, height)
|
control:SetImageSize(width, height)
|
||||||
end
|
end
|
||||||
local width = GetOptionsMemberValue("width",v,options,path,appName)
|
local controlWidth = GetOptionsMemberValue("width",v,options,path,appName)
|
||||||
control.width = not width and "fill"
|
control.width = not controlWidth and "fill"
|
||||||
end
|
end
|
||||||
|
|
||||||
--Common Init
|
--Common Init
|
||||||
if control then
|
if control then
|
||||||
if control.width ~= "fill" then
|
if control.width ~= "fill" then
|
||||||
local width = GetOptionsMemberValue("width",v,options,path,appName)
|
local width = GetOptionsMemberValue("width",v,options,path,appName)
|
||||||
|
local relWidth = GetOptionsMemberValue("relWidth",v,options,path,appName)
|
||||||
if width == "double" then
|
if width == "double" then
|
||||||
control:SetWidth(width_multiplier * 2)
|
control:SetWidth(width_multiplier * 2)
|
||||||
elseif width == "half" then
|
elseif width == "half" then
|
||||||
control:SetWidth(width_multiplier / 2)
|
control:SetWidth(width_multiplier / 2)
|
||||||
elseif (type(width) == "number") then
|
elseif (type(width) == "number") then
|
||||||
control:SetWidth(width_multiplier * width)
|
control:SetWidth(width_multiplier * width)
|
||||||
|
elseif width == "relative" and relWidth then
|
||||||
|
control:SetRelativeWidth(relWidth)
|
||||||
elseif width == "full" then
|
elseif width == "full" then
|
||||||
control.width = "fill"
|
control.width = "fill"
|
||||||
else
|
else
|
||||||
@@ -1462,7 +1489,8 @@ local function TreeOnButtonEnter(widget, event, uniquevalue, button)
|
|||||||
local option = user.option
|
local option = user.option
|
||||||
local path = user.path
|
local path = user.path
|
||||||
local appName = user.appName
|
local appName = user.appName
|
||||||
|
local tooltip = AceConfigDialog.tooltip
|
||||||
|
|
||||||
local feedpath = new()
|
local feedpath = new()
|
||||||
for i = 1, #path do
|
for i = 1, #path do
|
||||||
feedpath[i] = path[i]
|
feedpath[i] = path[i]
|
||||||
@@ -1477,25 +1505,26 @@ local function TreeOnButtonEnter(widget, event, uniquevalue, button)
|
|||||||
|
|
||||||
local name = GetOptionsMemberValue("name", group, options, feedpath, appName)
|
local name = GetOptionsMemberValue("name", group, options, feedpath, appName)
|
||||||
local desc = GetOptionsMemberValue("desc", group, options, feedpath, appName)
|
local desc = GetOptionsMemberValue("desc", group, options, feedpath, appName)
|
||||||
|
|
||||||
GameTooltip:SetOwner(button, "ANCHOR_NONE")
|
tooltip:SetOwner(button, "ANCHOR_NONE")
|
||||||
|
tooltip:ClearAllPoints()
|
||||||
if widget.type == "TabGroup" then
|
if widget.type == "TabGroup" then
|
||||||
GameTooltip:SetPoint("BOTTOM",button,"TOP")
|
tooltip:SetPoint("BOTTOM",button,"TOP")
|
||||||
else
|
else
|
||||||
GameTooltip:SetPoint("LEFT",button,"RIGHT")
|
tooltip:SetPoint("LEFT",button,"RIGHT")
|
||||||
end
|
end
|
||||||
|
|
||||||
GameTooltip:SetText(name, 1, .82, 0, 1)
|
tooltip:SetText(name, 1, .82, 0, 1, true)
|
||||||
|
|
||||||
if type(desc) == "string" then
|
if type(desc) == "string" then
|
||||||
GameTooltip:AddLine(desc, 1, 1, 1, 1)
|
tooltip:AddLine(desc, 1, 1, 1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
GameTooltip:Show()
|
tooltip:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function TreeOnButtonLeave(widget, event, value, button)
|
local function TreeOnButtonLeave(widget, event, value, button)
|
||||||
GameTooltip:Hide()
|
AceConfigDialog.tooltip:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -1663,29 +1692,29 @@ function AceConfigDialog:FeedGroup(appName,options,container,rootframe,path, isR
|
|||||||
|
|
||||||
elseif grouptype == "select" then
|
elseif grouptype == "select" then
|
||||||
|
|
||||||
local select = gui:Create("DropdownGroup")
|
local selectGroup = gui:Create("DropdownGroup")
|
||||||
select:SetTitle(name)
|
selectGroup:SetTitle(name)
|
||||||
InjectInfo(select, options, group, path, rootframe, appName)
|
InjectInfo(selectGroup, options, group, path, rootframe, appName)
|
||||||
select:SetCallback("OnGroupSelected", GroupSelected)
|
selectGroup:SetCallback("OnGroupSelected", GroupSelected)
|
||||||
local status = AceConfigDialog:GetStatusTable(appName, path)
|
local status = AceConfigDialog:GetStatusTable(appName, path)
|
||||||
if not status.groups then
|
if not status.groups then
|
||||||
status.groups = {}
|
status.groups = {}
|
||||||
end
|
end
|
||||||
select:SetStatusTable(status.groups)
|
selectGroup:SetStatusTable(status.groups)
|
||||||
local grouplist, orderlist = BuildSelect(group, options, path, appName)
|
local grouplist, orderlist = BuildSelect(group, options, path, appName)
|
||||||
select:SetGroupList(grouplist, orderlist)
|
selectGroup:SetGroupList(grouplist, orderlist)
|
||||||
select:SetUserData("grouplist", grouplist)
|
selectGroup:SetUserData("grouplist", grouplist)
|
||||||
select:SetUserData("orderlist", orderlist)
|
selectGroup:SetUserData("orderlist", orderlist)
|
||||||
|
|
||||||
local firstgroup = orderlist[1]
|
local firstgroup = orderlist[1]
|
||||||
if firstgroup then
|
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
|
end
|
||||||
|
|
||||||
select.width = "fill"
|
selectGroup.width = "fill"
|
||||||
select.height = "fill"
|
selectGroup.height = "fill"
|
||||||
|
|
||||||
container:AddChild(select)
|
container:AddChild(selectGroup)
|
||||||
|
|
||||||
--assume tree group by default
|
--assume tree group by default
|
||||||
--if parenttype is tree then this group is already a node on that tree
|
--if parenttype is tree then this group is already a node on that tree
|
||||||
@@ -1913,17 +1942,19 @@ end
|
|||||||
-- convert pre-39 BlizOptions structure to the new format
|
-- convert pre-39 BlizOptions structure to the new format
|
||||||
if oldminor and oldminor < 39 and AceConfigDialog.BlizOptions then
|
if oldminor and oldminor < 39 and AceConfigDialog.BlizOptions then
|
||||||
local old = AceConfigDialog.BlizOptions
|
local old = AceConfigDialog.BlizOptions
|
||||||
local new = {}
|
local newOpt = {}
|
||||||
for key, widget in pairs(old) do
|
for key, widget in pairs(old) do
|
||||||
local appName = widget:GetUserData("appName")
|
local appName = widget:GetUserData("appName")
|
||||||
if not new[appName] then new[appName] = {} end
|
if not newOpt[appName] then newOpt[appName] = {} end
|
||||||
new[appName][key] = widget
|
newOpt[appName][key] = widget
|
||||||
end
|
end
|
||||||
AceConfigDialog.BlizOptions = new
|
AceConfigDialog.BlizOptions = newOpt
|
||||||
else
|
else
|
||||||
AceConfigDialog.BlizOptions = AceConfigDialog.BlizOptions or {}
|
AceConfigDialog.BlizOptions = AceConfigDialog.BlizOptions or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
AceConfigDialog.BlizOptionsIDMap = AceConfigDialog.BlizOptionsIDMap or {}
|
||||||
|
|
||||||
local function FeedToBlizPanel(widget, event)
|
local function FeedToBlizPanel(widget, event)
|
||||||
local path = widget:GetUserData("path")
|
local path = widget:GetUserData("path")
|
||||||
AceConfigDialog:Open(widget:GetUserData("appName"), widget, unpack(path or emptyTbl))
|
AceConfigDialog:Open(widget:GetUserData("appName"), widget, unpack(path or emptyTbl))
|
||||||
@@ -1945,15 +1976,17 @@ end
|
|||||||
-- has to be a head-level note.
|
-- has to be a head-level note.
|
||||||
--
|
--
|
||||||
-- This function returns a reference to the container frame registered with the Interface
|
-- 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
|
-- Options, as well as the registered ID. You can use the ID to open the options with
|
||||||
-- `InterfaceOptionsFrame_OpenToCategory`.
|
-- the API function `Settings.OpenToCategory`.
|
||||||
-- @param appName The application name as given to `:RegisterOptionsTable()`
|
-- @param appName The application name as given to `:RegisterOptionsTable()`
|
||||||
-- @param name A descriptive name to display in the options tree (defaults to appName)
|
-- @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 parent The parent to use in the interface options tree.
|
||||||
-- @param ... The path in the options table to feed into the interface options panel.
|
-- @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 reference to the frame registered into the Interface Options.
|
||||||
|
-- @return The category ID to pass to Settings.OpenToCategory
|
||||||
function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...)
|
function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...)
|
||||||
local BlizOptions = AceConfigDialog.BlizOptions
|
local BlizOptions = AceConfigDialog.BlizOptions
|
||||||
|
local BlizOptionsIDMap = AceConfigDialog.BlizOptionsIDMap
|
||||||
|
|
||||||
local key = appName
|
local key = appName
|
||||||
for n = 1, select("#", ...) do
|
for n = 1, select("#", ...) do
|
||||||
@@ -1967,7 +2000,6 @@ function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...)
|
|||||||
if not BlizOptions[appName][key] then
|
if not BlizOptions[appName][key] then
|
||||||
local group = gui:Create("BlizOptionsGroup")
|
local group = gui:Create("BlizOptionsGroup")
|
||||||
BlizOptions[appName][key] = group
|
BlizOptions[appName][key] = group
|
||||||
group:SetName(name or appName, parent)
|
|
||||||
|
|
||||||
group:SetTitle(name or appName)
|
group:SetTitle(name or appName)
|
||||||
group:SetUserData("appName", appName)
|
group:SetUserData("appName", appName)
|
||||||
@@ -1980,8 +2012,33 @@ function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...)
|
|||||||
end
|
end
|
||||||
group:SetCallback("OnShow", FeedToBlizPanel)
|
group:SetCallback("OnShow", FeedToBlizPanel)
|
||||||
group:SetCallback("OnHide", ClearBlizPanel)
|
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
|
else
|
||||||
error(("%s has already been added to the Blizzard Options Window with the given path"):format(appName), 2)
|
error(("%s has already been added to the Blizzard Options Window with the given path"):format(appName), 2)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
-- :IterateOptionsTables() (and :GetOptionsTable() if only given one argument) return a function reference that the requesting config handling addon must call with valid "uiType", "uiName".
|
-- :IterateOptionsTables() (and :GetOptionsTable() if only given one argument) return a function reference that the requesting config handling addon must call with valid "uiType", "uiName".
|
||||||
-- @class file
|
-- @class file
|
||||||
-- @name AceConfigRegistry-3.0
|
-- @name AceConfigRegistry-3.0
|
||||||
-- @release $Id: AceConfigRegistry-3.0.lua 1207 2019-06-23 12:08:33Z nevcairiel $
|
-- @release $Id$
|
||||||
local CallbackHandler = LibStub("CallbackHandler-1.0")
|
local CallbackHandler = LibStub("CallbackHandler-1.0")
|
||||||
|
|
||||||
local MAJOR, MINOR = "AceConfigRegistry-3.0", 20
|
local MAJOR, MINOR = "AceConfigRegistry-3.0", 22
|
||||||
local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR)
|
local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR)
|
||||||
|
|
||||||
if not AceConfigRegistry then return end
|
if not AceConfigRegistry then return end
|
||||||
@@ -83,6 +83,7 @@ local basekeys={
|
|||||||
dialogHidden=optmethodbool,
|
dialogHidden=optmethodbool,
|
||||||
dropdownHidden=optmethodbool,
|
dropdownHidden=optmethodbool,
|
||||||
cmdHidden=optmethodbool,
|
cmdHidden=optmethodbool,
|
||||||
|
tooltipHyperlink=optstringfunc,
|
||||||
icon=optstringnumberfunc,
|
icon=optstringnumberfunc,
|
||||||
iconCoords=optmethodtable,
|
iconCoords=optmethodtable,
|
||||||
handler=opttable,
|
handler=opttable,
|
||||||
@@ -91,6 +92,7 @@ local basekeys={
|
|||||||
func=optmethodfalse,
|
func=optmethodfalse,
|
||||||
arg={["*"]=true},
|
arg={["*"]=true},
|
||||||
width=optstringnumber,
|
width=optstringnumber,
|
||||||
|
relWidth=optnumber,
|
||||||
}
|
}
|
||||||
|
|
||||||
local typedkeys={
|
local typedkeys={
|
||||||
|
|||||||
@@ -29,10 +29,6 @@ local max = math.max
|
|||||||
-- WoW APIs
|
-- WoW APIs
|
||||||
local _G = _G
|
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 tmp={}
|
||||||
local function Print(self,frame,...)
|
local function Print(self,frame,...)
|
||||||
local n=0
|
local n=0
|
||||||
@@ -174,7 +170,7 @@ function AceConsole:GetArgs(str, numargs, startpos)
|
|||||||
|
|
||||||
while true do
|
while true do
|
||||||
-- find delimiter or hyperlink
|
-- find delimiter or hyperlink
|
||||||
local ch,_
|
local _
|
||||||
pos,_,ch = strfind(str, delim_or_pipe, pos)
|
pos,_,ch = strfind(str, delim_or_pipe, pos)
|
||||||
|
|
||||||
if not pos then break end
|
if not pos then break end
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
-- * **race** Race-specific data. All of the players characters of the same race share this database.
|
-- * **race** Race-specific data. All of the players characters of the same race share this database.
|
||||||
-- * **faction** Faction-specific data. All of the players characters of the same faction share this database.
|
-- * **faction** Faction-specific data. All of the players characters of the same faction share this database.
|
||||||
-- * **factionrealm** Faction and realm specific data. All of the players characters on the same realm and of the same faction share this database.
|
-- * **factionrealm** Faction and realm specific data. All of the players characters on the same realm and of the same faction share this database.
|
||||||
|
-- * **locale** Locale specific data, based on the locale of the players game client.
|
||||||
-- * **global** Global Data. All characters on the same account share this database.
|
-- * **global** Global Data. All characters on the same account share this database.
|
||||||
-- * **profile** Profile-specific data. All characters using the same profile share this database. The user can control which profile should be used.
|
-- * **profile** Profile-specific data. All characters using the same profile share this database. The user can control which profile should be used.
|
||||||
--
|
--
|
||||||
@@ -39,23 +40,19 @@
|
|||||||
-- end
|
-- end
|
||||||
-- @class file
|
-- @class file
|
||||||
-- @name AceDB-3.0.lua
|
-- @name AceDB-3.0.lua
|
||||||
-- @release $Id: AceDB-3.0.lua 940 2010-06-19 08:01:47Z nevcairiel $
|
-- @release $Id$
|
||||||
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 21
|
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 33
|
||||||
local AceDB, oldminor = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR)
|
local AceDB = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR)
|
||||||
|
|
||||||
if not AceDB then return end -- No upgrade needed
|
if not AceDB then return end -- No upgrade needed
|
||||||
|
|
||||||
-- Lua APIs
|
-- Lua APIs
|
||||||
local type, pairs, next, error = type, pairs, next, error
|
local type, pairs, next, error = type, pairs, next, error
|
||||||
local setmetatable, getmetatable, rawset, rawget = setmetatable, getmetatable, rawset, rawget
|
local setmetatable, rawset, rawget = setmetatable, rawset, rawget
|
||||||
|
|
||||||
-- WoW APIs
|
-- WoW APIs
|
||||||
local _G = _G
|
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.db_registry = AceDB.db_registry or {}
|
||||||
AceDB.frame = AceDB.frame or CreateFrame("Frame")
|
AceDB.frame = AceDB.frame or CreateFrame("Frame")
|
||||||
|
|
||||||
@@ -97,11 +94,11 @@ local function copyDefaults(dest, src)
|
|||||||
-- This is a metatable used for table defaults
|
-- This is a metatable used for table defaults
|
||||||
local mt = {
|
local mt = {
|
||||||
-- This handles the lookup and creation of new subtables
|
-- This handles the lookup and creation of new subtables
|
||||||
__index = function(t,k)
|
__index = function(t,k2)
|
||||||
if k == nil then return nil end
|
if k2 == nil then return nil end
|
||||||
local tbl = {}
|
local tbl = {}
|
||||||
copyDefaults(tbl, v)
|
copyDefaults(tbl, v)
|
||||||
rawset(t, k, tbl)
|
rawset(t, k2, tbl)
|
||||||
return tbl
|
return tbl
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
@@ -114,7 +111,7 @@ local function copyDefaults(dest, src)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- Values are not tables, so this is just a simple return
|
-- 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)
|
setmetatable(dest, mt)
|
||||||
end
|
end
|
||||||
elseif type(v) == "table" then
|
elseif type(v) == "table" then
|
||||||
@@ -260,6 +257,12 @@ local _, classKey = UnitClass("player")
|
|||||||
local _, raceKey = UnitRace("player")
|
local _, raceKey = UnitRace("player")
|
||||||
local factionKey = UnitFactionGroup("player")
|
local factionKey = UnitFactionGroup("player")
|
||||||
local factionrealmKey = factionKey .. " - " .. realmKey
|
local factionrealmKey = factionKey .. " - " .. realmKey
|
||||||
|
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
|
-- Actual database initialization function
|
||||||
local function initdb(sv, defaults, defaultProfile, olddb, parent)
|
local function initdb(sv, defaults, defaultProfile, olddb, parent)
|
||||||
-- Generate the database keys for each section
|
-- Generate the database keys for each section
|
||||||
@@ -295,7 +298,9 @@ local function initdb(sv, defaults, defaultProfile, olddb, parent)
|
|||||||
["race"] = raceKey,
|
["race"] = raceKey,
|
||||||
["faction"] = factionKey,
|
["faction"] = factionKey,
|
||||||
["factionrealm"] = factionrealmKey,
|
["factionrealm"] = factionrealmKey,
|
||||||
|
["factionrealmregion"] = factionrealmregionKey,
|
||||||
["profile"] = profileKey,
|
["profile"] = profileKey,
|
||||||
|
["locale"] = localeKey,
|
||||||
["global"] = true,
|
["global"] = true,
|
||||||
["profiles"] = true,
|
["profiles"] = true,
|
||||||
}
|
}
|
||||||
@@ -352,10 +357,10 @@ local function logoutHandler(frame, event)
|
|||||||
for db in pairs(AceDB.db_registry) do
|
for db in pairs(AceDB.db_registry) do
|
||||||
db.callbacks:Fire("OnDatabaseShutdown", db)
|
db.callbacks:Fire("OnDatabaseShutdown", db)
|
||||||
db:RegisterDefaults(nil)
|
db:RegisterDefaults(nil)
|
||||||
|
|
||||||
-- cleanup sections that are empty without defaults
|
-- cleanup sections that are empty without defaults
|
||||||
local sv = rawget(db, "sv")
|
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
|
if rawget(sv, section) then
|
||||||
-- global is special, all other sections have sub-entrys
|
-- global is special, all other sections have sub-entrys
|
||||||
-- also don't delete empty profiles on main dbs, only on namespaces
|
-- also don't delete empty profiles on main dbs, only on namespaces
|
||||||
@@ -372,6 +377,26 @@ local function logoutHandler(frame, event)
|
|||||||
end
|
end
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -388,7 +413,7 @@ AceDB.frame:SetScript("OnEvent", logoutHandler)
|
|||||||
-- @param defaults A table of defaults for this database
|
-- @param defaults A table of defaults for this database
|
||||||
function DBObjectLib:RegisterDefaults(defaults)
|
function DBObjectLib:RegisterDefaults(defaults)
|
||||||
if defaults and type(defaults) ~= "table" then
|
if defaults and type(defaults) ~= "table" then
|
||||||
error("Usage: AceDBObject:RegisterDefaults(defaults): 'defaults' - table or nil expected.", 2)
|
error(("Usage: AceDBObject:RegisterDefaults(defaults): 'defaults' - table or nil expected, got %q."):format(type(defaults)), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
validateDefaults(defaults, self.keys)
|
validateDefaults(defaults, self.keys)
|
||||||
@@ -420,7 +445,7 @@ end
|
|||||||
-- @param name The name of the profile to set as the current profile
|
-- @param name The name of the profile to set as the current profile
|
||||||
function DBObjectLib:SetProfile(name)
|
function DBObjectLib:SetProfile(name)
|
||||||
if type(name) ~= "string" then
|
if type(name) ~= "string" then
|
||||||
error("Usage: AceDBObject:SetProfile(name): 'name' - string expected.", 2)
|
error(("Usage: AceDBObject:SetProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- changing to the same profile, dont do anything
|
-- changing to the same profile, dont do anything
|
||||||
@@ -462,7 +487,7 @@ end
|
|||||||
-- @param tbl A table to store the profile names in (optional)
|
-- @param tbl A table to store the profile names in (optional)
|
||||||
function DBObjectLib:GetProfiles(tbl)
|
function DBObjectLib:GetProfiles(tbl)
|
||||||
if tbl and type(tbl) ~= "table" then
|
if tbl and type(tbl) ~= "table" then
|
||||||
error("Usage: AceDBObject:GetProfiles(tbl): 'tbl' - table or nil expected.", 2)
|
error(("Usage: AceDBObject:GetProfiles(tbl): 'tbl' - table or nil expected, got %q."):format(type(tbl)), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Clear the container table
|
-- Clear the container table
|
||||||
@@ -500,15 +525,15 @@ end
|
|||||||
-- @param silent If true, do not raise an error when the profile does not exist
|
-- @param silent If true, do not raise an error when the profile does not exist
|
||||||
function DBObjectLib:DeleteProfile(name, silent)
|
function DBObjectLib:DeleteProfile(name, silent)
|
||||||
if type(name) ~= "string" then
|
if type(name) ~= "string" then
|
||||||
error("Usage: AceDBObject:DeleteProfile(name): 'name' - string expected.", 2)
|
error(("Usage: AceDBObject:DeleteProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.keys.profile == name then
|
if self.keys.profile == name then
|
||||||
error("Cannot delete the active profile in an AceDBObject.", 2)
|
error(("Cannot delete the active profile (%q) in an AceDBObject."):format(name), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not rawget(self.profiles, name) and not silent then
|
if not rawget(self.profiles, name) and not silent then
|
||||||
error("Cannot delete profile '" .. name .. "'. It does not exist.", 2)
|
error(("Cannot delete profile %q as it does not exist."):format(name), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.profiles[name] = nil
|
self.profiles[name] = nil
|
||||||
@@ -520,6 +545,26 @@ function DBObjectLib:DeleteProfile(name, silent)
|
|||||||
end
|
end
|
||||||
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
|
||||||
|
if profile == name then
|
||||||
|
self.sv.profileKeys[key] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Callback: OnProfileDeleted, database, profileKey
|
-- Callback: OnProfileDeleted, database, profileKey
|
||||||
self.callbacks:Fire("OnProfileDeleted", self, name)
|
self.callbacks:Fire("OnProfileDeleted", self, name)
|
||||||
end
|
end
|
||||||
@@ -530,15 +575,15 @@ end
|
|||||||
-- @param silent If true, do not raise an error when the profile does not exist
|
-- @param silent If true, do not raise an error when the profile does not exist
|
||||||
function DBObjectLib:CopyProfile(name, silent)
|
function DBObjectLib:CopyProfile(name, silent)
|
||||||
if type(name) ~= "string" then
|
if type(name) ~= "string" then
|
||||||
error("Usage: AceDBObject:CopyProfile(name): 'name' - string expected.", 2)
|
error(("Usage: AceDBObject:CopyProfile(name): 'name' - string expected, got %q."):format(type(name)), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
if name == self.keys.profile then
|
if name == self.keys.profile then
|
||||||
error("Cannot have the same source and destination profiles.", 2)
|
error(("Cannot have the same source and destination profiles (%q)."):format(name), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not rawget(self.profiles, name) and not silent then
|
if not rawget(self.profiles, name) and not silent then
|
||||||
error("Cannot copy profile '" .. name .. "'. It does not exist.", 2)
|
error(("Cannot copy profile %q as it does not exist."):format(name), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Reset the profile before copying
|
-- Reset the profile before copying
|
||||||
@@ -556,6 +601,20 @@ function DBObjectLib:CopyProfile(name, silent)
|
|||||||
end
|
end
|
||||||
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
|
-- Callback: OnProfileCopied, database, sourceProfileKey
|
||||||
self.callbacks:Fire("OnProfileCopied", self, name)
|
self.callbacks:Fire("OnProfileCopied", self, name)
|
||||||
end
|
end
|
||||||
@@ -582,6 +641,18 @@ function DBObjectLib:ResetProfile(noChildren, noCallbacks)
|
|||||||
end
|
end
|
||||||
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
|
-- Callback: OnProfileReset, database
|
||||||
if not noCallbacks then
|
if not noCallbacks then
|
||||||
self.callbacks:Fire("OnProfileReset", self)
|
self.callbacks:Fire("OnProfileReset", self)
|
||||||
@@ -592,8 +663,8 @@ end
|
|||||||
-- profile.
|
-- profile.
|
||||||
-- @param defaultProfile The profile name to use as the default
|
-- @param defaultProfile The profile name to use as the default
|
||||||
function DBObjectLib:ResetDB(defaultProfile)
|
function DBObjectLib:ResetDB(defaultProfile)
|
||||||
if defaultProfile and type(defaultProfile) ~= "string" then
|
if defaultProfile and type(defaultProfile) ~= "string" and defaultProfile ~= true then
|
||||||
error("Usage: AceDBObject:ResetDB(defaultProfile): 'defaultProfile' - string or nil expected.", 2)
|
error(("Usage: AceDBObject:ResetDB(defaultProfile): 'defaultProfile' - string or true expected, got %q."):format(type(defaultProfile)), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local sv = self.sv
|
local sv = self.sv
|
||||||
@@ -601,8 +672,6 @@ function DBObjectLib:ResetDB(defaultProfile)
|
|||||||
sv[k] = nil
|
sv[k] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local parent = self.parent
|
|
||||||
|
|
||||||
initdb(sv, self.defaults, defaultProfile, self)
|
initdb(sv, self.defaults, defaultProfile, self)
|
||||||
|
|
||||||
-- fix the child namespaces
|
-- fix the child namespaces
|
||||||
@@ -629,13 +698,13 @@ end
|
|||||||
-- @param defaults A table of values to use as defaults
|
-- @param defaults A table of values to use as defaults
|
||||||
function DBObjectLib:RegisterNamespace(name, defaults)
|
function DBObjectLib:RegisterNamespace(name, defaults)
|
||||||
if type(name) ~= "string" then
|
if type(name) ~= "string" then
|
||||||
error("Usage: AceDBObject:RegisterNamespace(name, defaults): 'name' - string expected.", 2)
|
error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'name' - string expected, got %q."):format(type(name)), 2)
|
||||||
end
|
end
|
||||||
if defaults and type(defaults) ~= "table" then
|
if defaults and type(defaults) ~= "table" then
|
||||||
error("Usage: AceDBObject:RegisterNamespace(name, defaults): 'defaults' - table or nil expected.", 2)
|
error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'defaults' - table or nil expected, got %q."):format(type(defaults)), 2)
|
||||||
end
|
end
|
||||||
if self.children and self.children[name] then
|
if self.children and self.children[name] then
|
||||||
error ("Usage: AceDBObject:RegisterNamespace(name, defaults): 'name' - a namespace with that name already exists.", 2)
|
error(("Usage: AceDBObject:RegisterNamespace(name, defaults): 'name' - a namespace called %q already exists."):format(name), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local sv = self.sv
|
local sv = self.sv
|
||||||
@@ -659,10 +728,10 @@ end
|
|||||||
-- @return the namespace object if found
|
-- @return the namespace object if found
|
||||||
function DBObjectLib:GetNamespace(name, silent)
|
function DBObjectLib:GetNamespace(name, silent)
|
||||||
if type(name) ~= "string" then
|
if type(name) ~= "string" then
|
||||||
error("Usage: AceDBObject:GetNamespace(name): 'name' - string expected.", 2)
|
error(("Usage: AceDBObject:GetNamespace(name): 'name' - string expected, got %q."):format(type(name)), 2)
|
||||||
end
|
end
|
||||||
if not silent and not (self.children and self.children[name]) then
|
if not silent and not (self.children and self.children[name]) then
|
||||||
error ("Usage: AceDBObject:GetNamespace(name): 'name' - namespace does not exist.", 2)
|
error(("Usage: AceDBObject:GetNamespace(name): 'name' - namespace %q does not exist."):format(name), 2)
|
||||||
end
|
end
|
||||||
if not self.children then self.children = {} end
|
if not self.children then self.children = {} end
|
||||||
return self.children[name]
|
return self.children[name]
|
||||||
@@ -701,15 +770,15 @@ function AceDB:New(tbl, defaults, defaultProfile)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if type(tbl) ~= "table" then
|
if type(tbl) ~= "table" then
|
||||||
error("Usage: AceDB:New(tbl, defaults, defaultProfile): 'tbl' - table expected.", 2)
|
error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'tbl' - table expected, got %q."):format(type(tbl)), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
if defaults and type(defaults) ~= "table" then
|
if defaults and type(defaults) ~= "table" then
|
||||||
error("Usage: AceDB:New(tbl, defaults, defaultProfile): 'defaults' - table expected.", 2)
|
error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'defaults' - table expected, got %q."):format(type(defaults)), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
if defaultProfile and type(defaultProfile) ~= "string" and defaultProfile ~= true then
|
if defaultProfile and type(defaultProfile) ~= "string" and defaultProfile ~= true then
|
||||||
error("Usage: AceDB:New(tbl, defaults, defaultProfile): 'defaultProfile' - string or true expected.", 2)
|
error(("Usage: AceDB:New(tbl, defaults, defaultProfile): 'defaultProfile' - string or true expected, got %q."):format(type(defaultProfile)), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
return initdb(tbl, defaults, defaultProfile)
|
return initdb(tbl, defaults, defaultProfile)
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
--- AceDBOptions-3.0 provides a universal AceConfig options screen for managing AceDB-3.0 profiles.
|
--- AceDBOptions-3.0 provides a universal AceConfig options screen for managing AceDB-3.0 profiles.
|
||||||
-- @class file
|
-- @class file
|
||||||
-- @name AceDBOptions-3.0
|
-- @name AceDBOptions-3.0
|
||||||
-- @release $Id: AceDBOptions-3.0.lua 938 2010-06-13 07:21:38Z nevcairiel $
|
-- @release $Id$
|
||||||
local ACEDBO_MAJOR, ACEDBO_MINOR = "AceDBOptions-3.0", 12
|
local ACEDBO_MAJOR, ACEDBO_MINOR = "AceDBOptions-3.0", 15
|
||||||
local AceDBOptions, oldminor = LibStub:NewLibrary(ACEDBO_MAJOR, ACEDBO_MINOR)
|
local AceDBOptions = LibStub:NewLibrary(ACEDBO_MAJOR, ACEDBO_MINOR)
|
||||||
|
|
||||||
if not AceDBOptions then return end -- No upgrade needed
|
if not AceDBOptions then return end -- No upgrade needed
|
||||||
|
|
||||||
@@ -13,10 +13,6 @@ local pairs, next = pairs, next
|
|||||||
-- WoW APIs
|
-- WoW APIs
|
||||||
local UnitClass = UnitClass
|
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.optionTables = AceDBOptions.optionTables or {}
|
||||||
AceDBOptions.handlers = AceDBOptions.handlers or {}
|
AceDBOptions.handlers = AceDBOptions.handlers or {}
|
||||||
|
|
||||||
@@ -25,168 +21,208 @@ AceDBOptions.handlers = AceDBOptions.handlers or {}
|
|||||||
]]
|
]]
|
||||||
|
|
||||||
local L = {
|
local L = {
|
||||||
default = "Default",
|
choose = "Existing Profiles",
|
||||||
intro = "You can change the active database profile, so you can have different settings for every character.",
|
|
||||||
reset_desc = "Reset the current profile back to its default values, in case your configuration is broken, or you simply want to start over.",
|
|
||||||
reset = "Reset Profile",
|
|
||||||
reset_sub = "Reset the current profile to the default",
|
|
||||||
choose_desc = "You can either create a new profile by entering a name in the editbox, or choose one of the already existing profiles.",
|
choose_desc = "You can either create a new profile by entering a name in the editbox, or choose one of the already existing profiles.",
|
||||||
|
choose_sub = "Select one of your currently available profiles.",
|
||||||
|
copy = "Copy From",
|
||||||
|
copy_desc = "Copy the settings from one existing profile into the currently active profile.",
|
||||||
|
current = "Current Profile:",
|
||||||
|
default = "Default",
|
||||||
|
delete = "Delete a Profile",
|
||||||
|
delete_confirm = "Are you sure you want to delete the selected profile?",
|
||||||
|
delete_desc = "Delete existing and unused profiles from the database to save space, and cleanup the SavedVariables file.",
|
||||||
|
delete_sub = "Deletes a profile from the database.",
|
||||||
|
intro = "You can change the active database profile, so you can have different settings for every character.",
|
||||||
new = "New",
|
new = "New",
|
||||||
new_sub = "Create a new empty profile.",
|
new_sub = "Create a new empty profile.",
|
||||||
choose = "Existing Profiles",
|
|
||||||
choose_sub = "Select one of your currently available profiles.",
|
|
||||||
copy_desc = "Copy the settings from one existing profile into the currently active profile.",
|
|
||||||
copy = "Copy From",
|
|
||||||
delete_desc = "Delete existing and unused profiles from the database to save space, and cleanup the SavedVariables file.",
|
|
||||||
delete = "Delete a Profile",
|
|
||||||
delete_sub = "Deletes a profile from the database.",
|
|
||||||
delete_confirm = "Are you sure you want to delete the selected profile?",
|
|
||||||
profiles = "Profiles",
|
profiles = "Profiles",
|
||||||
profiles_sub = "Manage Profiles",
|
profiles_sub = "Manage Profiles",
|
||||||
current = "Current Profile:",
|
reset = "Reset Profile",
|
||||||
|
reset_desc = "Reset the current profile back to its default values, in case your configuration is broken, or you simply want to start over.",
|
||||||
|
reset_sub = "Reset the current profile to the default",
|
||||||
}
|
}
|
||||||
|
|
||||||
local LOCALE = GetLocale()
|
local LOCALE = GetLocale()
|
||||||
if LOCALE == "deDE" then
|
if LOCALE == "deDE" then
|
||||||
|
L["choose"] = "Vorhandene Profile"
|
||||||
|
L["choose_desc"] = "Du kannst ein neues Profil erstellen, indem du einen neuen Namen in der Eingabebox 'Neu' eingibst, oder wähle eines der vorhandenen Profile aus."
|
||||||
|
L["choose_sub"] = "Wählt ein bereits vorhandenes Profil aus."
|
||||||
|
L["copy"] = "Kopieren von..."
|
||||||
|
L["copy_desc"] = "Kopiere die Einstellungen von einem vorhandenen Profil in das aktive Profil."
|
||||||
|
L["current"] = "Aktuelles Profil:"
|
||||||
L["default"] = "Standard"
|
L["default"] = "Standard"
|
||||||
L["intro"] = "Hier kannst du das aktive Datenbankprofile \195\164ndern, damit du verschiedene Einstellungen f\195\188r jeden Charakter erstellen kannst, wodurch eine sehr flexible Konfiguration m\195\182glich wird."
|
L["delete"] = "Profil löschen"
|
||||||
L["reset_desc"] = "Setzt das momentane Profil auf Standardwerte zur\195\188ck, f\195\188r den Fall das mit der Konfiguration etwas schief lief oder weil du einfach neu starten willst."
|
L["delete_confirm"] = "Willst du das ausgewählte Profil wirklich löschen?"
|
||||||
L["reset"] = "Profil zur\195\188cksetzen"
|
L["delete_desc"] = "Lösche vorhandene oder unbenutzte Profile aus der Datenbank, um Platz zu sparen und die SavedVariables-Datei 'sauber' zu halten."
|
||||||
L["reset_sub"] = "Das aktuelle Profil auf Standard zur\195\188cksetzen."
|
L["delete_sub"] = "Löscht ein Profil aus der Datenbank."
|
||||||
L["choose_desc"] = "Du kannst ein neues Profil erstellen, indem du einen neuen Namen in der Eingabebox 'Neu' eingibst, oder w\195\164hle eines der vorhandenen Profile aus."
|
L["intro"] = "Hier kannst du das aktive Datenbankprofil ändern, damit du verschiedene Einstellungen für jeden Charakter erstellen kannst, wodurch eine sehr flexible Konfiguration möglich wird."
|
||||||
L["new"] = "Neu"
|
L["new"] = "Neu"
|
||||||
L["new_sub"] = "Ein neues Profil erstellen."
|
L["new_sub"] = "Ein neues Profil erstellen."
|
||||||
L["choose"] = "Vorhandene Profile"
|
|
||||||
L["choose_sub"] = "W\195\164hlt ein bereits vorhandenes Profil aus."
|
|
||||||
L["copy_desc"] = "Kopiere die Einstellungen von einem vorhandenen Profil in das aktive Profil."
|
|
||||||
L["copy"] = "Kopieren von..."
|
|
||||||
L["delete_desc"] = "L\195\182sche vorhandene oder unbenutzte Profile aus der Datenbank um Platz zu sparen und um die SavedVariables Datei 'sauber' zu halten."
|
|
||||||
L["delete"] = "Profil l\195\182schen"
|
|
||||||
L["delete_sub"] = "L\195\182scht ein Profil aus der Datenbank."
|
|
||||||
L["delete_confirm"] = "Willst du das ausgew\195\164hlte Profil wirklich l\195\182schen?"
|
|
||||||
L["profiles"] = "Profile"
|
L["profiles"] = "Profile"
|
||||||
L["profiles_sub"] = "Profile verwalten"
|
L["profiles_sub"] = "Profile verwalten"
|
||||||
--L["current"] = "Current Profile:"
|
L["reset"] = "Profil zurücksetzen"
|
||||||
|
L["reset_desc"] = "Setzt das momentane Profil auf Standardwerte zurück, für den Fall, dass mit der Konfiguration etwas schief lief oder weil du einfach neu starten willst."
|
||||||
|
L["reset_sub"] = "Das aktuelle Profil auf Standard zurücksetzen."
|
||||||
elseif LOCALE == "frFR" then
|
elseif LOCALE == "frFR" then
|
||||||
L["default"] = "D\195\169faut"
|
|
||||||
L["intro"] = "Vous pouvez changer le profil actuel afin d'avoir des param\195\168tres diff\195\169rents pour chaque personnage, permettant ainsi d'avoir une configuration tr\195\168s flexible."
|
|
||||||
L["reset_desc"] = "R\195\169initialise le profil actuel au cas o\195\185 votre configuration est corrompue ou si vous voulez tout simplement faire table rase."
|
|
||||||
L["reset"] = "R\195\169initialiser le profil"
|
|
||||||
L["reset_sub"] = "R\195\169initialise le profil actuel avec les param\195\168tres par d\195\169faut."
|
|
||||||
L["choose_desc"] = "Vous pouvez cr\195\169er un nouveau profil en entrant un nouveau nom dans la bo\195\174te de saisie, ou en choississant un des profils d\195\169j\195\160 existants."
|
|
||||||
L["new"] = "Nouveau"
|
|
||||||
L["new_sub"] = "Cr\195\169\195\169e un nouveau profil vierge."
|
|
||||||
L["choose"] = "Profils existants"
|
L["choose"] = "Profils existants"
|
||||||
L["choose_sub"] = "Permet de choisir un des profils d\195\169j\195\160 disponibles."
|
L["choose_desc"] = "Vous pouvez créer un nouveau profil en entrant un nouveau nom dans la boîte de saisie, ou en choississant un des profils déjà existants."
|
||||||
L["copy_desc"] = "Copie les param\195\168tres d'un profil d\195\169j\195\160 existant dans le profil actuellement actif."
|
L["choose_sub"] = "Permet de choisir un des profils déjà disponibles."
|
||||||
L["copy"] = "Copier \195\160 partir de"
|
L["copy"] = "Copier à partir de"
|
||||||
L["delete_desc"] = "Supprime les profils existants inutilis\195\169s de la base de donn\195\169es afin de gagner de la place et de nettoyer le fichier SavedVariables."
|
L["copy_desc"] = "Copie les paramètres d'un profil déjà existant dans le profil actuellement actif."
|
||||||
|
L["current"] = "Profil actuel :"
|
||||||
|
L["default"] = "Défaut"
|
||||||
L["delete"] = "Supprimer un profil"
|
L["delete"] = "Supprimer un profil"
|
||||||
L["delete_sub"] = "Supprime un profil de la base de donn\195\169es."
|
L["delete_confirm"] = "Etes-vous sûr de vouloir supprimer le profil sélectionné ?"
|
||||||
L["delete_confirm"] = "Etes-vous s\195\187r de vouloir supprimer le profil s\195\169lectionn\195\169 ?"
|
L["delete_desc"] = "Supprime les profils existants inutilisés de la base de données afin de gagner de la place et de nettoyer le fichier SavedVariables."
|
||||||
|
L["delete_sub"] = "Supprime un profil de la base de données."
|
||||||
|
L["intro"] = "Vous pouvez changer le profil actuel afin d'avoir des paramètres différents pour chaque personnage, permettant ainsi d'avoir une configuration très flexible."
|
||||||
|
L["new"] = "Nouveau"
|
||||||
|
L["new_sub"] = "Créée un nouveau profil vierge."
|
||||||
L["profiles"] = "Profils"
|
L["profiles"] = "Profils"
|
||||||
L["profiles_sub"] = "Gestion des profils"
|
L["profiles_sub"] = "Gestion des profils"
|
||||||
--L["current"] = "Current Profile:"
|
L["reset"] = "Réinitialiser le profil"
|
||||||
|
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
|
elseif LOCALE == "koKR" then
|
||||||
|
L["choose"] = "기존 프로필"
|
||||||
|
L["choose_desc"] = "편집 상자에 이름을 입력하여 새로운 프로필을 만들거나 이미 존재하는 프로필 중 하나를 선택할 수 있습니다."
|
||||||
|
L["choose_sub"] = "현재 이용할 수 있는 프로필 중 하나를 선택합니다."
|
||||||
|
L["copy"] = "복사해 올 프로필"
|
||||||
|
L["copy_desc"] = "기존 프로필의 설정을 현재 활성화된 프로필로 복사합니다."
|
||||||
|
L["current"] = "현재 프로필:"
|
||||||
L["default"] = "기본값"
|
L["default"] = "기본값"
|
||||||
L["intro"] = "모든 캐릭터의 다양한 설정과 사용중인 데이터베이스 프로필, 어느것이던지 매우 다루기 쉽게 바꿀수 있습니다."
|
|
||||||
L["reset_desc"] = "단순히 다시 새롭게 구성을 원하는 경우, 현재 프로필을 기본값으로 초기화 합니다."
|
|
||||||
L["reset"] = "프로필 초기화"
|
|
||||||
L["reset_sub"] = "현재의 프로필을 기본값으로 초기화 합니다"
|
|
||||||
L["choose_desc"] = "새로운 이름을 입력하거나, 이미 있는 프로필중 하나를 선택하여 새로운 프로필을 만들 수 있습니다."
|
|
||||||
L["new"] = "새로운 프로필"
|
|
||||||
L["new_sub"] = "새로운 프로필을 만듭니다."
|
|
||||||
L["choose"] = "프로필 선택"
|
|
||||||
L["choose_sub"] = "당신이 현재 이용할수 있는 프로필을 선택합니다."
|
|
||||||
L["copy_desc"] = "현재 사용중인 프로필에, 선택한 프로필의 설정을 복사합니다."
|
|
||||||
L["copy"] = "복사"
|
|
||||||
L["delete_desc"] = "데이터베이스에 사용중이거나 저장된 프로파일 삭제로 SavedVariables 파일의 정리와 공간 절약이 됩니다."
|
|
||||||
L["delete"] = "프로필 삭제"
|
L["delete"] = "프로필 삭제"
|
||||||
L["delete_sub"] = "데이터베이스의 프로필을 삭제합니다."
|
L["delete_confirm"] = "선택한 프로필을 삭제하시겠습니까?"
|
||||||
L["delete_confirm"] = "정말로 선택한 프로필의 삭제를 원하십니까?"
|
L["delete_desc"] = "데이터베이스에서 기존 프로필과 사용하지 않는 프로필을 삭제하여 공간을 절약하고 SavedVariables 파일을 정리합니다."
|
||||||
|
L["delete_sub"] = "데이터베이스에서 프로필을 삭제합니다."
|
||||||
|
L["intro"] = "활성 데이터베이스 프로필을 변경할 수 있으며, 모든 캐릭터마다 서로 다른 설정을 지정할 수 있습니다."
|
||||||
|
L["new"] = "새로운 프로필"
|
||||||
|
L["new_sub"] = "비어 있는 프로필을 새로 만듭니다."
|
||||||
L["profiles"] = "프로필"
|
L["profiles"] = "프로필"
|
||||||
L["profiles_sub"] = "프로필 설정"
|
L["profiles_sub"] = "프로필 관리"
|
||||||
--L["current"] = "Current Profile:"
|
L["reset"] = "프로필 재설정"
|
||||||
|
L["reset_desc"] = "구성이 손상되었거나 처음부터 다시 시작하고 싶은 경우 현재 프로필을 기본값으로 재설정하세요."
|
||||||
|
L["reset_sub"] = "현재 프로필을 기본값으로 재설정합니다"
|
||||||
elseif LOCALE == "esES" or LOCALE == "esMX" then
|
elseif LOCALE == "esES" or LOCALE == "esMX" then
|
||||||
L["default"] = "Por defecto"
|
L["choose"] = "Perfiles existentes"
|
||||||
L["intro"] = "Puedes cambiar el perfil activo de tal manera que cada personaje tenga diferentes configuraciones."
|
|
||||||
L["reset_desc"] = "Reinicia el perfil actual a los valores por defectos, en caso de que se haya estropeado la configuración o quieras volver a empezar de nuevo."
|
|
||||||
L["reset"] = "Reiniciar Perfil"
|
|
||||||
L["reset_sub"] = "Reinicar el perfil actual al de por defecto"
|
|
||||||
L["choose_desc"] = "Puedes crear un nuevo perfil introduciendo un nombre en el recuadro o puedes seleccionar un perfil de los ya existentes."
|
L["choose_desc"] = "Puedes crear un nuevo perfil introduciendo un nombre en el recuadro o puedes seleccionar un perfil de los ya existentes."
|
||||||
|
L["choose_sub"] = "Selecciona uno de los perfiles disponibles."
|
||||||
|
L["copy"] = "Copiar de"
|
||||||
|
L["copy_desc"] = "Copia los ajustes de un perfil existente al perfil actual."
|
||||||
|
L["current"] = "Perfil actual:"
|
||||||
|
L["default"] = "Por defecto"
|
||||||
|
L["delete"] = "Borrar un Perfil"
|
||||||
|
L["delete_confirm"] = "¿Estas seguro que quieres borrar el perfil seleccionado?"
|
||||||
|
L["delete_desc"] = "Borra los perfiles existentes y sin uso de la base de datos para ganar espacio y limpiar el archivo SavedVariables."
|
||||||
|
L["delete_sub"] = "Borra un perfil de la base de datos."
|
||||||
|
L["intro"] = "Puedes cambiar el perfil activo de tal manera que cada personaje tenga diferentes configuraciones."
|
||||||
L["new"] = "Nuevo"
|
L["new"] = "Nuevo"
|
||||||
L["new_sub"] = "Crear un nuevo perfil vacio."
|
L["new_sub"] = "Crear un nuevo perfil vacio."
|
||||||
L["choose"] = "Perfiles existentes"
|
|
||||||
L["choose_sub"] = "Selecciona uno de los perfiles disponibles."
|
|
||||||
L["copy_desc"] = "Copia los ajustes de un perfil existente al perfil actual."
|
|
||||||
L["copy"] = "Copiar de"
|
|
||||||
L["delete_desc"] = "Borra los perfiles existentes y sin uso de la base de datos para ganar espacio y limpiar el archivo SavedVariables."
|
|
||||||
L["delete"] = "Borrar un Perfil"
|
|
||||||
L["delete_sub"] = "Borra un perfil de la base de datos."
|
|
||||||
L["delete_confirm"] = "¿Estas seguro que quieres borrar el perfil seleccionado?"
|
|
||||||
L["profiles"] = "Perfiles"
|
L["profiles"] = "Perfiles"
|
||||||
L["profiles_sub"] = "Manejar Perfiles"
|
L["profiles_sub"] = "Manejar Perfiles"
|
||||||
--L["current"] = "Current Profile:"
|
L["reset"] = "Reiniciar Perfil"
|
||||||
|
L["reset_desc"] = "Reinicia el perfil actual a los valores por defectos, en caso de que se haya estropeado la configuración o quieras volver a empezar de nuevo."
|
||||||
|
L["reset_sub"] = "Reinicar el perfil actual al de por defecto"
|
||||||
elseif LOCALE == "zhTW" then
|
elseif LOCALE == "zhTW" then
|
||||||
|
L["choose"] = "現有的設定檔"
|
||||||
|
L["choose_desc"] = "您可以在文字方塊內輸入名字以建立新的設定檔,或是選擇一個現有的設定檔使用。"
|
||||||
|
L["choose_sub"] = "從當前可用的設定檔裡面選擇一個。"
|
||||||
|
L["copy"] = "複製自"
|
||||||
|
L["copy_desc"] = "從一個現有的設定檔,將設定複製到現在使用中的設定檔。"
|
||||||
|
L["current"] = "目前設定檔:"
|
||||||
L["default"] = "預設"
|
L["default"] = "預設"
|
||||||
L["intro"] = "你可以選擇一個活動的資料設定檔,這樣你的每個角色就可以擁有不同的設定值,可以給你的插件設定帶來極大的靈活性。"
|
L["delete"] = "刪除一個設定檔"
|
||||||
L["reset_desc"] = "將當前的設定檔恢復到它的預設值,用於你的設定檔損壞,或者你只是想重來的情況。"
|
L["delete_confirm"] = "確定要刪除所選擇的設定檔嗎?"
|
||||||
L["reset"] = "重置設定檔"
|
L["delete_desc"] = "從資料庫裡刪除不再使用的設定檔,以節省空間,並且清理 SavedVariables 檔案。"
|
||||||
L["reset_sub"] = "將當前的設定檔恢復為預設值"
|
L["delete_sub"] = "從資料庫裡刪除一個設定檔。"
|
||||||
L["choose_desc"] = "你可以通過在文本框內輸入一個名字創立一個新的設定檔,也可以選擇一個已經存在的設定檔。"
|
L["intro"] = "您可以從資料庫中選擇一個設定檔來使用,如此就可以讓每個角色使用不同的設定。"
|
||||||
L["new"] = "新建"
|
L["new"] = "新建"
|
||||||
L["new_sub"] = "新建一個空的設定檔。"
|
L["new_sub"] = "新建一個空的設定檔。"
|
||||||
L["choose"] = "現有的設定檔"
|
|
||||||
L["choose_sub"] = "從當前可用的設定檔裏面選擇一個。"
|
|
||||||
L["copy_desc"] = "從當前某個已保存的設定檔複製到當前正使用的設定檔。"
|
|
||||||
L["copy"] = "複製自"
|
|
||||||
L["delete_desc"] = "從資料庫裏刪除不再使用的設定檔,以節省空間,並且清理SavedVariables檔。"
|
|
||||||
L["delete"] = "刪除一個設定檔"
|
|
||||||
L["delete_sub"] = "從資料庫裏刪除一個設定檔。"
|
|
||||||
L["delete_confirm"] = "你確定要刪除所選擇的設定檔嗎?"
|
|
||||||
L["profiles"] = "設定檔"
|
L["profiles"] = "設定檔"
|
||||||
L["profiles_sub"] = "管理設定檔"
|
L["profiles_sub"] = "管理設定檔"
|
||||||
--L["current"] = "Current Profile:"
|
L["reset"] = "重置設定檔"
|
||||||
|
L["reset_desc"] = "將現用的設定檔重置為預設值;用於設定檔損壞,或者單純想要重來的情況。"
|
||||||
|
L["reset_sub"] = "將目前的設定檔重置為預設值"
|
||||||
elseif LOCALE == "zhCN" then
|
elseif LOCALE == "zhCN" then
|
||||||
L["default"] = "默认"
|
L["choose"] = "现有的配置文件"
|
||||||
L["intro"] = "你可以选择一个活动的数据配置文件,这样你的每个角色就可以拥有不同的设置值,可以给你的插件配置带来极大的灵活性。"
|
|
||||||
L["reset_desc"] = "将当前的配置文件恢复到它的默认值,用于你的配置文件损坏,或者你只是想重来的情况。"
|
|
||||||
L["reset"] = "重置配置文件"
|
|
||||||
L["reset_sub"] = "将当前的配置文件恢复为默认值"
|
|
||||||
L["choose_desc"] = "你可以通过在文本框内输入一个名字创立一个新的配置文件,也可以选择一个已经存在的配置文件。"
|
L["choose_desc"] = "你可以通过在文本框内输入一个名字创立一个新的配置文件,也可以选择一个已经存在的配置文件。"
|
||||||
|
L["choose_sub"] = "从当前可用的配置文件里面选择一个。"
|
||||||
|
L["copy"] = "复制自"
|
||||||
|
L["copy_desc"] = "从当前某个已保存的配置文件复制到当前正使用的配置文件。"
|
||||||
|
L["current"] = "当前配置文件:"
|
||||||
|
L["default"] = "默认"
|
||||||
|
L["delete"] = "删除一个配置文件"
|
||||||
|
L["delete_confirm"] = "你确定要删除所选择的配置文件么?"
|
||||||
|
L["delete_desc"] = "从数据库里删除不再使用的配置文件,以节省空间,并且清理SavedVariables文件。"
|
||||||
|
L["delete_sub"] = "从数据库里删除一个配置文件。"
|
||||||
|
L["intro"] = "你可以选择一个活动的数据配置文件,这样你的每个角色就可以拥有不同的设置值,可以给你的插件配置带来极大的灵活性。"
|
||||||
L["new"] = "新建"
|
L["new"] = "新建"
|
||||||
L["new_sub"] = "新建一个空的配置文件。"
|
L["new_sub"] = "新建一个空的配置文件。"
|
||||||
L["choose"] = "现有的配置文件"
|
|
||||||
L["choose_sub"] = "从当前可用的配置文件里面选择一个。"
|
|
||||||
L["copy_desc"] = "从当前某个已保存的配置文件复制到当前正使用的配置文件。"
|
|
||||||
L["copy"] = "复制自"
|
|
||||||
L["delete_desc"] = "从数据库里删除不再使用的配置文件,以节省空间,并且清理SavedVariables文件。"
|
|
||||||
L["delete"] = "删除一个配置文件"
|
|
||||||
L["delete_sub"] = "从数据库里删除一个配置文件。"
|
|
||||||
L["delete_confirm"] = "你确定要删除所选择的配置文件么?"
|
|
||||||
L["profiles"] = "配置文件"
|
L["profiles"] = "配置文件"
|
||||||
L["profiles_sub"] = "管理配置文件"
|
L["profiles_sub"] = "管理配置文件"
|
||||||
--L["current"] = "Current Profile:"
|
L["reset"] = "重置配置文件"
|
||||||
|
L["reset_desc"] = "将当前的配置文件恢复到它的默认值,用于你的配置文件损坏,或者你只是想重来的情况。"
|
||||||
|
L["reset_sub"] = "将当前的配置文件恢复为默认值"
|
||||||
elseif LOCALE == "ruRU" then
|
elseif LOCALE == "ruRU" then
|
||||||
L["default"] = "По умолчанию"
|
|
||||||
L["intro"] = "Изменяя активный профиль, вы можете задать различные настройки модификаций для каждого персонажа."
|
|
||||||
L["reset_desc"] = "Если ваша конфигурации испорчена или если вы хотите настроить всё заново - сбросьте текущий профиль на стандартные значения."
|
|
||||||
L["reset"] = "Сброс профиля"
|
|
||||||
L["reset_sub"] = "Сброс текущего профиля на стандартный"
|
|
||||||
L["choose_desc"] = "Вы можете создать новый профиль, введя название в поле ввода, или выбрать один из уже существующих профилей."
|
|
||||||
L["new"] = "Новый"
|
|
||||||
L["new_sub"] = "Создать новый чистый профиль"
|
|
||||||
L["choose"] = "Существующие профили"
|
L["choose"] = "Существующие профили"
|
||||||
L["choose_sub"] = "Выбор одиного из уже доступных профилей"
|
L["choose_desc"] = "Вы можете создать новый профиль, введя название в поле ввода, или выбрать один из уже существующих профилей."
|
||||||
L["copy_desc"] = "Скопировать настройки из выбранного профиля в активный."
|
L["choose_sub"] = "Выбор одного из уже доступных профилей."
|
||||||
L["copy"] = "Скопировать из"
|
L["copy"] = "Скопировать из"
|
||||||
L["delete_desc"] = "Удалить существующий и неиспользуемый профиль из БД для сохранения места, и очистить SavedVariables файл."
|
L["copy_desc"] = "Копирование настроек из выбранного профиля в активный."
|
||||||
|
L["current"] = "Текущий профиль:"
|
||||||
|
L["default"] = "По умолчанию"
|
||||||
L["delete"] = "Удалить профиль"
|
L["delete"] = "Удалить профиль"
|
||||||
L["delete_sub"] = "Удаление профиля из БД"
|
L["delete_confirm"] = "Вы уверены, что хотите удалить выбранный профиль?"
|
||||||
L["delete_confirm"] = "Вы уверены, что вы хотите удалить выбранный профиль?"
|
L["delete_desc"] = "Удаление существующего и неиспользуемого профиля из базы данных для сохранения места, и очистка файла SavedVariables."
|
||||||
|
L["delete_sub"] = "Удаление профиля из базы данных."
|
||||||
|
L["intro"] = "Изменяя активный профиль, Вы можете задать разные настройки для каждого персонажа."
|
||||||
|
L["new"] = "Новый"
|
||||||
|
L["new_sub"] = "Создание нового чистого профиля."
|
||||||
L["profiles"] = "Профили"
|
L["profiles"] = "Профили"
|
||||||
L["profiles_sub"] = "Управление профилями"
|
L["profiles_sub"] = "Управление профилями"
|
||||||
--L["current"] = "Current Profile:"
|
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["current"] = "Profilo Attivo:"
|
||||||
|
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."
|
||||||
|
L["delete_sub"] = "Cancella un profilo dal Database."
|
||||||
|
L["intro"] = "Puoi cambiare il profilo attivo, in modo da usare impostazioni diverse per ogni personaggio."
|
||||||
|
L["new"] = "Nuovo"
|
||||||
|
L["new_sub"] = "Crea un nuovo profilo vuoto."
|
||||||
|
L["profiles"] = "Profili"
|
||||||
|
L["profiles_sub"] = "Gestisci Profili"
|
||||||
|
L["reset"] = "Reimposta Profilo"
|
||||||
|
L["reset_desc"] = "Riporta il tuo profilo attivo alle sue impostazioni predefinite, nel caso in cui la tua configurazione si sia corrotta, o semplicemente tu voglia re-inizializzarla."
|
||||||
|
L["reset_sub"] = "Reimposta il profilo ai suoi valori predefiniti."
|
||||||
|
elseif LOCALE == "ptBR" then
|
||||||
|
L["choose"] = "Perfis Existentes"
|
||||||
|
L["choose_desc"] = "Você pode tanto criar um perfil novo tanto digitando um nome na caixa de texto, quanto escolher um dos perfis já existentes."
|
||||||
|
L["choose_sub"] = "Selecione um de seus perfis atualmente disponíveis."
|
||||||
|
L["copy"] = "Copiar De"
|
||||||
|
L["copy_desc"] = "Copia as definições de um perfil existente no perfil atualmente ativo."
|
||||||
|
L["current"] = "Perfil Autal:"
|
||||||
|
L["default"] = "Padrão"
|
||||||
|
L["delete"] = "Remover um Perfil"
|
||||||
|
L["delete_confirm"] = "Tem certeza que deseja remover o perfil selecionado?"
|
||||||
|
L["delete_desc"] = "Remove perfis existentes e inutilizados do banco de dados para economizar espaço, e limpar o arquivo SavedVariables."
|
||||||
|
L["delete_sub"] = "Remove um perfil do banco de dados."
|
||||||
|
L["intro"] = "Você pode alterar o perfil do banco de dados ativo, para que possa ter definições diferentes para cada personagem."
|
||||||
|
L["new"] = "Novo"
|
||||||
|
L["new_sub"] = "Cria um novo perfil vazio."
|
||||||
|
L["profiles"] = "Perfis"
|
||||||
|
L["profiles_sub"] = "Gerenciar Perfis"
|
||||||
|
L["reset"] = "Resetar Perfil"
|
||||||
|
L["reset_desc"] = "Reseta o perfil atual para os valores padrões, no caso de sua configuração estar quebrada, ou simplesmente se deseja começar novamente."
|
||||||
|
L["reset_sub"] = "Resetar o perfil atual ao padrão"
|
||||||
end
|
end
|
||||||
|
|
||||||
local defaultProfiles
|
local defaultProfiles
|
||||||
@@ -200,22 +236,22 @@ local tmpprofiles = {}
|
|||||||
-- @return Hashtable of all profiles with the internal name as keys and the display name as value.
|
-- @return Hashtable of all profiles with the internal name as keys and the display name as value.
|
||||||
local function getProfileList(db, common, nocurrent)
|
local function getProfileList(db, common, nocurrent)
|
||||||
local profiles = {}
|
local profiles = {}
|
||||||
|
|
||||||
-- copy existing profiles into the table
|
-- copy existing profiles into the table
|
||||||
local currentProfile = db:GetCurrentProfile()
|
local currentProfile = db:GetCurrentProfile()
|
||||||
for i,v in pairs(db:GetProfiles(tmpprofiles)) do
|
for i,v in pairs(db:GetProfiles(tmpprofiles)) do
|
||||||
if not (nocurrent and v == currentProfile) then
|
if not (nocurrent and v == currentProfile) then
|
||||||
profiles[v] = v
|
profiles[v] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- add our default profiles to choose from ( or rename existing profiles)
|
-- add our default profiles to choose from ( or rename existing profiles)
|
||||||
for k,v in pairs(defaultProfiles) do
|
for k,v in pairs(defaultProfiles) do
|
||||||
if (common or profiles[k]) and not (nocurrent and k == currentProfile) then
|
if (common or profiles[k]) and not (nocurrent and k == currentProfile) then
|
||||||
profiles[k] = v
|
profiles[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return profiles
|
return profiles
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -240,11 +276,11 @@ function OptionsHandlerPrototype:GetCurrentProfile()
|
|||||||
return self.db:GetCurrentProfile()
|
return self.db:GetCurrentProfile()
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
List all active profiles
|
List all active profiles
|
||||||
you can control the output with the .arg variable
|
you can control the output with the .arg variable
|
||||||
currently four modes are supported
|
currently four modes are supported
|
||||||
|
|
||||||
(empty) - return all available profiles
|
(empty) - return all available profiles
|
||||||
"nocurrent" - returns all available profiles except the currently active profile
|
"nocurrent" - returns all available profiles except the currently active profile
|
||||||
"common" - returns all avaialble profiles + some commonly used profiles ("char - realm", "realm", "class", "Default")
|
"common" - returns all avaialble profiles + some commonly used profiles ("char - realm", "realm", "class", "Default")
|
||||||
@@ -262,7 +298,7 @@ function OptionsHandlerPrototype:ListProfiles(info)
|
|||||||
else
|
else
|
||||||
profiles = getProfileList(self.db)
|
profiles = getProfileList(self.db)
|
||||||
end
|
end
|
||||||
|
|
||||||
return profiles
|
return profiles
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -296,19 +332,19 @@ local function getOptionsHandler(db, noDefaultProfiles)
|
|||||||
if not defaultProfiles then
|
if not defaultProfiles then
|
||||||
generateDefaultProfiles(db)
|
generateDefaultProfiles(db)
|
||||||
end
|
end
|
||||||
|
|
||||||
local handler = AceDBOptions.handlers[db] or { db = db, noDefaultProfiles = noDefaultProfiles }
|
local handler = AceDBOptions.handlers[db] or { db = db, noDefaultProfiles = noDefaultProfiles }
|
||||||
|
|
||||||
for k,v in pairs(OptionsHandlerPrototype) do
|
for k,v in pairs(OptionsHandlerPrototype) do
|
||||||
handler[k] = v
|
handler[k] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
AceDBOptions.handlers[db] = handler
|
AceDBOptions.handlers[db] = handler
|
||||||
return handler
|
return handler
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
the real options table
|
the real options table
|
||||||
]]
|
]]
|
||||||
local optionsTable = {
|
local optionsTable = {
|
||||||
desc = {
|
desc = {
|
||||||
@@ -396,7 +432,7 @@ local optionsTable = {
|
|||||||
--- Get/Create a option table that you can use in your addon to control the profiles of AceDB-3.0.
|
--- Get/Create a option table that you can use in your addon to control the profiles of AceDB-3.0.
|
||||||
-- @param db The database object to create the options table for.
|
-- @param db The database object to create the options table for.
|
||||||
-- @return The options table to be used in AceConfig-3.0
|
-- @return The options table to be used in AceConfig-3.0
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Assuming `options` is your top-level options table and `self.db` is your database:
|
-- -- Assuming `options` is your top-level options table and `self.db` is your database:
|
||||||
-- options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
|
-- options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
|
||||||
function AceDBOptions:GetOptionsTable(db, noDefaultProfiles)
|
function AceDBOptions:GetOptionsTable(db, noDefaultProfiles)
|
||||||
@@ -405,7 +441,7 @@ function AceDBOptions:GetOptionsTable(db, noDefaultProfiles)
|
|||||||
name = L["profiles"],
|
name = L["profiles"],
|
||||||
desc = L["profiles_sub"],
|
desc = L["profiles_sub"],
|
||||||
}
|
}
|
||||||
|
|
||||||
tbl.handler = getOptionsHandler(db, noDefaultProfiles)
|
tbl.handler = getOptionsHandler(db, noDefaultProfiles)
|
||||||
tbl.args = optionsTable
|
tbl.args = optionsTable
|
||||||
|
|
||||||
|
|||||||
@@ -31,26 +31,21 @@ local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR)
|
|||||||
if not AceGUI then return end -- No upgrade needed
|
if not AceGUI then return end -- No upgrade needed
|
||||||
|
|
||||||
-- Lua APIs
|
-- 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 select, pairs, next, type = select, pairs, next, type
|
||||||
local error, assert, loadstring = error, assert, loadstring
|
local error, assert = error, assert
|
||||||
local setmetatable, rawget, rawset = setmetatable, rawget, rawset
|
local setmetatable, rawget = setmetatable, rawget
|
||||||
local math_max = math.max
|
local math_max, math_min, math_ceil = math.max, math.min, math.ceil
|
||||||
|
|
||||||
-- WoW APIs
|
-- WoW APIs
|
||||||
local UIParent = UIParent
|
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.WidgetRegistry = AceGUI.WidgetRegistry or {}
|
||||||
AceGUI.LayoutRegistry = AceGUI.LayoutRegistry or {}
|
AceGUI.LayoutRegistry = AceGUI.LayoutRegistry or {}
|
||||||
AceGUI.WidgetBase = AceGUI.WidgetBase or {}
|
AceGUI.WidgetBase = AceGUI.WidgetBase or {}
|
||||||
AceGUI.WidgetContainerBase = AceGUI.WidgetContainerBase or {}
|
AceGUI.WidgetContainerBase = AceGUI.WidgetContainerBase or {}
|
||||||
AceGUI.WidgetVersions = AceGUI.WidgetVersions or {}
|
AceGUI.WidgetVersions = AceGUI.WidgetVersions or {}
|
||||||
|
AceGUI.tooltip = AceGUI.tooltip or CreateFrame("GameTooltip", "AceGUITooltip", UIParent, "GameTooltipTemplate")
|
||||||
|
|
||||||
-- local upvalues
|
-- local upvalues
|
||||||
local WidgetRegistry = AceGUI.WidgetRegistry
|
local WidgetRegistry = AceGUI.WidgetRegistry
|
||||||
@@ -66,39 +61,10 @@ local function errorhandler(err)
|
|||||||
return geterrorhandler()(err)
|
return geterrorhandler()(err)
|
||||||
end
|
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, ...)
|
local function safecall(func, ...)
|
||||||
return Dispatchers[select("#", ...)](func, ...)
|
if func then
|
||||||
|
return xpcall(func, errorhandler, ...)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Recycling functions
|
-- Recycling functions
|
||||||
@@ -122,38 +88,38 @@ do
|
|||||||
AceGUI.objPools = AceGUI.objPools or {}
|
AceGUI.objPools = AceGUI.objPools or {}
|
||||||
local objPools = AceGUI.objPools
|
local objPools = AceGUI.objPools
|
||||||
--Returns a new instance, if none are available either returns a new table or calls the given contructor
|
--Returns a new instance, if none are available either returns a new table or calls the given contructor
|
||||||
function newWidget(type)
|
function newWidget(widgetType)
|
||||||
if not WidgetRegistry[type] then
|
if not WidgetRegistry[widgetType] then
|
||||||
error("Attempt to instantiate unknown widget type", 2)
|
error("Attempt to instantiate unknown widget type", 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not objPools[type] then
|
if not objPools[widgetType] then
|
||||||
objPools[type] = {}
|
objPools[widgetType] = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local newObj = next(objPools[type])
|
local newObj = next(objPools[widgetType])
|
||||||
if not newObj then
|
if not newObj then
|
||||||
newObj = WidgetRegistry[type]()
|
newObj = WidgetRegistry[widgetType]()
|
||||||
newObj.AceGUIWidgetVersion = WidgetVersions[type]
|
newObj.AceGUIWidgetVersion = WidgetVersions[widgetType]
|
||||||
else
|
else
|
||||||
objPools[type][newObj] = nil
|
objPools[widgetType][newObj] = nil
|
||||||
-- if the widget is older then the latest, don't even try to reuse it
|
-- if the widget is older then the latest, don't even try to reuse it
|
||||||
-- just forget about it, and grab a new one.
|
-- just forget about it, and grab a new one.
|
||||||
if not newObj.AceGUIWidgetVersion or newObj.AceGUIWidgetVersion < WidgetVersions[type] then
|
if not newObj.AceGUIWidgetVersion or newObj.AceGUIWidgetVersion < WidgetVersions[widgetType] then
|
||||||
return newWidget(type)
|
return newWidget(widgetType)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return newObj
|
return newObj
|
||||||
end
|
end
|
||||||
-- Releases an instance to the Pool
|
-- Releases an instance to the Pool
|
||||||
function delWidget(obj,type)
|
function delWidget(obj,widgetType)
|
||||||
if not objPools[type] then
|
if not objPools[widgetType] then
|
||||||
objPools[type] = {}
|
objPools[widgetType] = {}
|
||||||
end
|
end
|
||||||
if objPools[type][obj] then
|
if objPools[widgetType][obj] then
|
||||||
error("Attempt to Release Widget that is already released", 2)
|
error("Attempt to Release Widget that is already released", 2)
|
||||||
end
|
end
|
||||||
objPools[type][obj] = true
|
objPools[widgetType][obj] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -169,9 +135,9 @@ end
|
|||||||
-- OnAcquire function on it, before returning.
|
-- OnAcquire function on it, before returning.
|
||||||
-- @param type The type of the widget.
|
-- @param type The type of the widget.
|
||||||
-- @return The newly created widget.
|
-- @return The newly created widget.
|
||||||
function AceGUI:Create(type)
|
function AceGUI:Create(widgetType)
|
||||||
if WidgetRegistry[type] then
|
if WidgetRegistry[widgetType] then
|
||||||
local widget = newWidget(type)
|
local widget = newWidget(widgetType)
|
||||||
|
|
||||||
if rawget(widget, "Acquire") then
|
if rawget(widget, "Acquire") then
|
||||||
widget.OnAcquire = widget.Acquire
|
widget.OnAcquire = widget.Acquire
|
||||||
@@ -189,7 +155,7 @@ function AceGUI:Create(type)
|
|||||||
if widget.OnAcquire then
|
if widget.OnAcquire then
|
||||||
widget:OnAcquire()
|
widget:OnAcquire()
|
||||||
else
|
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
|
end
|
||||||
-- Set the default Layout ("List")
|
-- Set the default Layout ("List")
|
||||||
safecall(widget.SetLayout, widget, "List")
|
safecall(widget.SetLayout, widget, "List")
|
||||||
@@ -240,6 +206,22 @@ function AceGUI:Release(widget)
|
|||||||
delWidget(widget, widget.type)
|
delWidget(widget, widget.type)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Check if a widget is currently in the process of being released
|
||||||
|
-- This function check if this widget, or any of its parents (in which case it'll be released shortly as well)
|
||||||
|
-- are currently being released. This allows addon to handle any callbacks accordingly.
|
||||||
|
-- @param widget The widget to check
|
||||||
|
function AceGUI:IsReleasing(widget)
|
||||||
|
if widget.isQueuedForRelease then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
if widget.parent and widget.parent.AceGUIWidgetVersion then
|
||||||
|
return AceGUI:IsReleasing(widget.parent)
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
-----------
|
-----------
|
||||||
-- Focus --
|
-- Focus --
|
||||||
-----------
|
-----------
|
||||||
@@ -366,6 +348,10 @@ do
|
|||||||
AceGUI:Release(self)
|
AceGUI:Release(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
WidgetBase.IsReleasing = function(self)
|
||||||
|
return AceGUI:IsReleasing(self)
|
||||||
|
end
|
||||||
|
|
||||||
WidgetBase.SetPoint = function(self, ...)
|
WidgetBase.SetPoint = function(self, ...)
|
||||||
return self.frame:SetPoint(...)
|
return self.frame:SetPoint(...)
|
||||||
end
|
end
|
||||||
@@ -496,14 +482,14 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function FrameResize(this, width, height)
|
local function FrameResize(this)
|
||||||
local self = this.obj
|
local self = this.obj
|
||||||
if this:GetWidth() and this:GetHeight() then
|
if this:GetWidth() and this:GetHeight() then
|
||||||
if self.OnWidthSet then
|
if self.OnWidthSet then
|
||||||
self:OnWidthSet(width or this:GetWidth())
|
self:OnWidthSet(this:GetWidth())
|
||||||
end
|
end
|
||||||
if self.OnHeightSet then
|
if self.OnHeightSet then
|
||||||
self:OnHeightSet(height or this:GetHeight())
|
self:OnHeightSet(this:GetHeight())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -597,25 +583,25 @@ AceGUI.counts = AceGUI.counts or {}
|
|||||||
-- This is used by widgets that require a named frame, e.g. when a Blizzard
|
-- This is used by widgets that require a named frame, e.g. when a Blizzard
|
||||||
-- Template requires it.
|
-- Template requires it.
|
||||||
-- @param type The widget type
|
-- @param type The widget type
|
||||||
function AceGUI:GetNextWidgetNum(type)
|
function AceGUI:GetNextWidgetNum(widgetType)
|
||||||
if not self.counts[type] then
|
if not self.counts[widgetType] then
|
||||||
self.counts[type] = 0
|
self.counts[widgetType] = 0
|
||||||
end
|
end
|
||||||
self.counts[type] = self.counts[type] + 1
|
self.counts[widgetType] = self.counts[widgetType] + 1
|
||||||
return self.counts[type]
|
return self.counts[widgetType]
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return the number of created widgets for this type.
|
--- Return the number of created widgets for this type.
|
||||||
-- In contrast to GetNextWidgetNum, the number is not incremented.
|
-- In contrast to GetNextWidgetNum, the number is not incremented.
|
||||||
-- @param type The widget type
|
-- @param widgetType The widget type
|
||||||
function AceGUI:GetWidgetCount(type)
|
function AceGUI:GetWidgetCount(widgetType)
|
||||||
return self.counts[type] or 0
|
return self.counts[widgetType] or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return the version of the currently registered widget type.
|
--- Return the version of the currently registered widget type.
|
||||||
-- @param type The widget type
|
-- @param widgetType The widget type
|
||||||
function AceGUI:GetWidgetVersion(type)
|
function AceGUI:GetWidgetVersion(widgetType)
|
||||||
return WidgetVersions[type]
|
return WidgetVersions[widgetType]
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------
|
-------------
|
||||||
@@ -778,7 +764,6 @@ AceGUI:RegisterLayout("Flow",
|
|||||||
|
|
||||||
usedwidth = 0
|
usedwidth = 0
|
||||||
rowstart = frame
|
rowstart = frame
|
||||||
rowstartoffset = frameoffset
|
|
||||||
|
|
||||||
if child.DoLayout then
|
if child.DoLayout then
|
||||||
child:DoLayout()
|
child:DoLayout()
|
||||||
@@ -821,7 +806,8 @@ local GetCellAlign = function (dir, tableObj, colObj, cellObj, cell, child)
|
|||||||
or colObj and (colObj["align" .. dir] or colObj.align)
|
or colObj and (colObj["align" .. dir] or colObj.align)
|
||||||
or tableObj["align" .. dir] or tableObj.align
|
or tableObj["align" .. dir] or tableObj.align
|
||||||
or "CENTERLEFT"
|
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
|
if type(fn) == "string" then
|
||||||
fn = fn:lower()
|
fn = fn:lower()
|
||||||
@@ -835,7 +821,7 @@ local GetCellAlign = function (dir, tableObj, colObj, cellObj, cell, child)
|
|||||||
val = fn
|
val = fn
|
||||||
end
|
end
|
||||||
|
|
||||||
return fn, max(0, min(val, cell))
|
return fn, math_max(0, math_min(val, cell))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get width or height for multiple cells combined
|
-- Get width or height for multiple cells combined
|
||||||
@@ -844,7 +830,7 @@ local GetCellDimension = function (dir, laneDim, from, to, space)
|
|||||||
for cell=from,to do
|
for cell=from,to do
|
||||||
dim = dim + (laneDim[cell] or 0)
|
dim = dim + (laneDim[cell] or 0)
|
||||||
end
|
end
|
||||||
return dim + max(0, to - from) * (space or 0)
|
return dim + math_max(0, to - from) * (space or 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[ Options
|
--[[ Options
|
||||||
@@ -890,7 +876,7 @@ AceGUI:RegisterLayout("Table",
|
|||||||
repeat
|
repeat
|
||||||
n = n + 1
|
n = n + 1
|
||||||
local col = (n - 1) % #cols + 1
|
local col = (n - 1) % #cols + 1
|
||||||
local row = ceil(n / #cols)
|
local row = math_ceil(n / #cols)
|
||||||
local rowspan = rowspans[col]
|
local rowspan = rowspans[col]
|
||||||
local cell = rowspan and rowspan.child or child
|
local cell = rowspan and rowspan.child or child
|
||||||
local cellObj = cell:GetUserData("cell")
|
local cellObj = cell:GetUserData("cell")
|
||||||
@@ -906,7 +892,7 @@ AceGUI:RegisterLayout("Table",
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Colspan
|
-- 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
|
n = n + colspan
|
||||||
|
|
||||||
-- Place the cell
|
-- Place the cell
|
||||||
@@ -923,7 +909,7 @@ AceGUI:RegisterLayout("Table",
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local rows = ceil(n / #cols)
|
local rows = math_ceil(n / #cols)
|
||||||
|
|
||||||
-- Determine fixed size cols and collect weights
|
-- Determine fixed size cols and collect weights
|
||||||
local extantH, totalWeight = totalH, 0
|
local extantH, totalWeight = totalH, 0
|
||||||
@@ -948,16 +934,16 @@ AceGUI:RegisterLayout("Table",
|
|||||||
f:ClearAllPoints()
|
f:ClearAllPoints()
|
||||||
local childH = f:GetWidth() or 0
|
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
|
||||||
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
|
else
|
||||||
-- Rel./Abs. width
|
-- Rel./Abs. width
|
||||||
laneH[col] = colObj.width < 1 and colObj.width * totalH or colObj.width
|
laneH[col] = colObj.width < 1 and colObj.width * totalH or colObj.width
|
||||||
end
|
end
|
||||||
extantH = max(0, extantH - laneH[col])
|
extantH = math_max(0, extantH - laneH[col])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -996,7 +982,7 @@ AceGUI:RegisterLayout("Table",
|
|||||||
child:DoLayout()
|
child:DoLayout()
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
BlizOptionsGroup Container
|
BlizOptionsGroup Container
|
||||||
Simple container widget for the integration of AceGUI into the Blizzard Interface Options
|
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)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ local methods = {
|
|||||||
Constructor
|
Constructor
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
local function Constructor()
|
local function Constructor()
|
||||||
local frame = CreateFrame("Frame")
|
local frame = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer)
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
|
|
||||||
-- support functions for the Blizzard Interface Options
|
-- support functions for the Blizzard Interface Options
|
||||||
@@ -108,6 +108,11 @@ local function Constructor()
|
|||||||
frame.default = default
|
frame.default = default
|
||||||
frame.refresh = refresh
|
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("OnHide", OnHide)
|
||||||
frame:SetScript("OnShow", OnShow)
|
frame:SetScript("OnShow", OnShow)
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
DropdownGroup Container
|
DropdownGroup Container
|
||||||
Container controlled by a dropdown on the top.
|
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)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ local function Constructor()
|
|||||||
dropdown.frame:Show()
|
dropdown.frame:Show()
|
||||||
dropdown:SetLabel("")
|
dropdown:SetLabel("")
|
||||||
|
|
||||||
local border = CreateFrame("Frame", nil, frame)
|
local border = CreateFrame("Frame", nil, frame, "BackdropTemplate")
|
||||||
border:SetPoint("TOPLEFT", 0, -26)
|
border:SetPoint("TOPLEFT", 0, -26)
|
||||||
border:SetPoint("BOTTOMRIGHT", 0, 3)
|
border:SetPoint("BOTTOMRIGHT", 0, 3)
|
||||||
border:SetBackdrop(PaneBackdrop)
|
border:SetBackdrop(PaneBackdrop)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
--[[-----------------------------------------------------------------------------
|
--[[-----------------------------------------------------------------------------
|
||||||
Frame Container
|
Frame Container
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
local Type, Version = "Frame", 25
|
local Type, Version = "Frame", 30
|
||||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
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 PlaySound = PlaySound
|
||||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
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
|
Scripts
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
local function Button_OnClick(frame)
|
local function Button_OnClick(frame)
|
||||||
PlaySound("gsTitleOptionExit")
|
PlaySound(799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT
|
||||||
frame.obj:Hide()
|
frame.obj:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -83,6 +79,7 @@ local methods = {
|
|||||||
["OnAcquire"] = function(self)
|
["OnAcquire"] = function(self)
|
||||||
self.frame:SetParent(UIParent)
|
self.frame:SetParent(UIParent)
|
||||||
self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||||
|
self.frame:SetFrameLevel(100) -- Lots of room to draw under it
|
||||||
self:SetTitle()
|
self:SetTitle()
|
||||||
self:SetStatusText()
|
self:SetStatusText()
|
||||||
self:ApplyStatus()
|
self:ApplyStatus()
|
||||||
@@ -179,16 +176,21 @@ local PaneBackdrop = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local function Constructor()
|
local function Constructor()
|
||||||
local frame = CreateFrame("Frame", nil, UIParent)
|
local frame = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
|
|
||||||
frame:EnableMouse(true)
|
frame:EnableMouse(true)
|
||||||
frame:SetMovable(true)
|
frame:SetMovable(true)
|
||||||
frame:SetResizable(true)
|
frame:SetResizable(true)
|
||||||
frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
||||||
|
frame:SetFrameLevel(100) -- Lots of room to draw under it
|
||||||
frame:SetBackdrop(FrameBackdrop)
|
frame:SetBackdrop(FrameBackdrop)
|
||||||
frame:SetBackdropColor(0, 0, 0, 1)
|
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:SetToplevel(true)
|
||||||
frame:SetScript("OnShow", Frame_OnShow)
|
frame:SetScript("OnShow", Frame_OnShow)
|
||||||
frame:SetScript("OnHide", Frame_OnClose)
|
frame:SetScript("OnHide", Frame_OnClose)
|
||||||
@@ -201,7 +203,7 @@ local function Constructor()
|
|||||||
closebutton:SetWidth(100)
|
closebutton:SetWidth(100)
|
||||||
closebutton:SetText(CLOSE)
|
closebutton:SetText(CLOSE)
|
||||||
|
|
||||||
local statusbg = CreateFrame("Button", nil, frame)
|
local statusbg = CreateFrame("Button", nil, frame, "BackdropTemplate")
|
||||||
statusbg:SetPoint("BOTTOMLEFT", 15, 15)
|
statusbg:SetPoint("BOTTOMLEFT", 15, 15)
|
||||||
statusbg:SetPoint("BOTTOMRIGHT", -132, 15)
|
statusbg:SetPoint("BOTTOMRIGHT", -132, 15)
|
||||||
statusbg:SetHeight(24)
|
statusbg:SetHeight(24)
|
||||||
@@ -219,7 +221,7 @@ local function Constructor()
|
|||||||
statustext:SetText("")
|
statustext:SetText("")
|
||||||
|
|
||||||
local titlebg = frame:CreateTexture(nil, "OVERLAY")
|
local titlebg = frame:CreateTexture(nil, "OVERLAY")
|
||||||
titlebg:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
|
titlebg:SetTexture(131080) -- Interface\\DialogFrame\\UI-DialogBox-Header
|
||||||
titlebg:SetTexCoord(0.31, 0.67, 0, 0.63)
|
titlebg:SetTexCoord(0.31, 0.67, 0, 0.63)
|
||||||
titlebg:SetPoint("TOP", 0, 12)
|
titlebg:SetPoint("TOP", 0, 12)
|
||||||
titlebg:SetWidth(100)
|
titlebg:SetWidth(100)
|
||||||
@@ -235,14 +237,14 @@ local function Constructor()
|
|||||||
titletext:SetPoint("TOP", titlebg, "TOP", 0, -14)
|
titletext:SetPoint("TOP", titlebg, "TOP", 0, -14)
|
||||||
|
|
||||||
local titlebg_l = frame:CreateTexture(nil, "OVERLAY")
|
local titlebg_l = frame:CreateTexture(nil, "OVERLAY")
|
||||||
titlebg_l:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
|
titlebg_l:SetTexture(131080) -- Interface\\DialogFrame\\UI-DialogBox-Header
|
||||||
titlebg_l:SetTexCoord(0.21, 0.31, 0, 0.63)
|
titlebg_l:SetTexCoord(0.21, 0.31, 0, 0.63)
|
||||||
titlebg_l:SetPoint("RIGHT", titlebg, "LEFT")
|
titlebg_l:SetPoint("RIGHT", titlebg, "LEFT")
|
||||||
titlebg_l:SetWidth(30)
|
titlebg_l:SetWidth(30)
|
||||||
titlebg_l:SetHeight(40)
|
titlebg_l:SetHeight(40)
|
||||||
|
|
||||||
local titlebg_r = frame:CreateTexture(nil, "OVERLAY")
|
local titlebg_r = frame:CreateTexture(nil, "OVERLAY")
|
||||||
titlebg_r:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
|
titlebg_r:SetTexture(131080) -- Interface\\DialogFrame\\UI-DialogBox-Header
|
||||||
titlebg_r:SetTexCoord(0.67, 0.77, 0, 0.63)
|
titlebg_r:SetTexCoord(0.67, 0.77, 0, 0.63)
|
||||||
titlebg_r:SetPoint("LEFT", titlebg, "RIGHT")
|
titlebg_r:SetPoint("LEFT", titlebg, "RIGHT")
|
||||||
titlebg_r:SetWidth(30)
|
titlebg_r:SetWidth(30)
|
||||||
@@ -260,7 +262,7 @@ local function Constructor()
|
|||||||
line1:SetWidth(14)
|
line1:SetWidth(14)
|
||||||
line1:SetHeight(14)
|
line1:SetHeight(14)
|
||||||
line1:SetPoint("BOTTOMRIGHT", -8, 8)
|
line1:SetPoint("BOTTOMRIGHT", -8, 8)
|
||||||
line1:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
|
line1:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
|
||||||
local x = 0.1 * 14/17
|
local x = 0.1 * 14/17
|
||||||
line1:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
|
line1:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
|
||||||
|
|
||||||
@@ -268,8 +270,8 @@ local function Constructor()
|
|||||||
line2:SetWidth(8)
|
line2:SetWidth(8)
|
||||||
line2:SetHeight(8)
|
line2:SetHeight(8)
|
||||||
line2:SetPoint("BOTTOMRIGHT", -8, 8)
|
line2:SetPoint("BOTTOMRIGHT", -8, 8)
|
||||||
line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
|
line2:SetTexture(137057) -- 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)
|
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)
|
local sizer_s = CreateFrame("Frame", nil, frame)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
InlineGroup Container
|
InlineGroup Container
|
||||||
Simple container widget that creates a visible "box" with an optional title.
|
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)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ local function Constructor()
|
|||||||
titletext:SetJustifyH("LEFT")
|
titletext:SetJustifyH("LEFT")
|
||||||
titletext:SetHeight(18)
|
titletext:SetHeight(18)
|
||||||
|
|
||||||
local border = CreateFrame("Frame", nil, frame)
|
local border = CreateFrame("Frame", nil, frame, "BackdropTemplate")
|
||||||
border:SetPoint("TOPLEFT", 0, -17)
|
border:SetPoint("TOPLEFT", 0, -17)
|
||||||
border:SetPoint("BOTTOMRIGHT", -1, 3)
|
border:SetPoint("BOTTOMRIGHT", -1, 3)
|
||||||
border:SetBackdrop(PaneBackdrop)
|
border:SetBackdrop(PaneBackdrop)
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ local function Constructor()
|
|||||||
|
|
||||||
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
|
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
|
||||||
scrollbg:SetAllPoints(scrollbar)
|
scrollbg:SetAllPoints(scrollbar)
|
||||||
scrollbg:SetTexture(0, 0, 0, 0.4)
|
scrollbg:SetColorTexture(0, 0, 0, 0.4)
|
||||||
|
|
||||||
--Container Support
|
--Container Support
|
||||||
local content = CreateFrame("Frame", nil, scrollframe)
|
local content = CreateFrame("Frame", nil, scrollframe)
|
||||||
|
|||||||
@@ -2,22 +2,18 @@
|
|||||||
TabGroup Container
|
TabGroup Container
|
||||||
Container that uses tabs on top to switch between groups.
|
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)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||||
|
|
||||||
-- Lua APIs
|
-- 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
|
-- WoW APIs
|
||||||
local PlaySound = PlaySound
|
local PlaySound = PlaySound
|
||||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||||
local _G = _G
|
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 upvalue storage used by BuildTabs
|
||||||
local widths = {}
|
local widths = {}
|
||||||
local rowwidths = {}
|
local rowwidths = {}
|
||||||
@@ -26,6 +22,143 @@ local rowends = {}
|
|||||||
--[[-----------------------------------------------------------------------------
|
--[[-----------------------------------------------------------------------------
|
||||||
Support functions
|
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)
|
local function UpdateTabLook(frame)
|
||||||
if frame.disabled then
|
if frame.disabled then
|
||||||
PanelTemplates_SetDisabledTabState(frame)
|
PanelTemplates_SetDisabledTabState(frame)
|
||||||
@@ -39,7 +172,7 @@ end
|
|||||||
local function Tab_SetText(frame, text)
|
local function Tab_SetText(frame, text)
|
||||||
frame:_SetText(text)
|
frame:_SetText(text)
|
||||||
local width = frame.obj.frame.width or frame.obj.frame:GetWidth() or 0
|
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
|
end
|
||||||
|
|
||||||
local function Tab_SetSelected(frame, selected)
|
local function Tab_SetSelected(frame, selected)
|
||||||
@@ -63,7 +196,7 @@ Scripts
|
|||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
local function Tab_OnClick(frame)
|
local function Tab_OnClick(frame)
|
||||||
if not (frame.selected or frame.disabled) then
|
if not (frame.selected or frame.disabled) then
|
||||||
PlaySound("igCharacterInfoTab")
|
PlaySound(841) -- SOUNDKIT.IG_CHARACTER_INFO_TAB
|
||||||
frame.obj:SelectTab(frame.value)
|
frame.obj:SelectTab(frame.value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -103,11 +236,64 @@ local methods = {
|
|||||||
|
|
||||||
["CreateTab"] = function(self, id)
|
["CreateTab"] = function(self, id)
|
||||||
local tabname = ("AceGUITabGroup%dTab%d"):format(self.num, 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.obj = self
|
||||||
tab.id = id
|
tab.id = id
|
||||||
|
|
||||||
tab.text = _G[tabname .. "Text"]
|
tab.text = tab.Text -- compat
|
||||||
tab.text:ClearAllPoints()
|
tab.text:ClearAllPoints()
|
||||||
tab.text:SetPoint("LEFT", 14, -3)
|
tab.text:SetPoint("LEFT", 14, -3)
|
||||||
tab.text:SetPoint("RIGHT", -12, -3)
|
tab.text:SetPoint("RIGHT", -12, -3)
|
||||||
@@ -255,7 +441,7 @@ local methods = {
|
|||||||
end
|
end
|
||||||
|
|
||||||
for i = starttab, endtab do
|
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
|
end
|
||||||
starttab = endtab + 1
|
starttab = endtab + 1
|
||||||
end
|
end
|
||||||
@@ -316,7 +502,7 @@ local function Constructor()
|
|||||||
titletext:SetHeight(18)
|
titletext:SetHeight(18)
|
||||||
titletext:SetText("")
|
titletext:SetText("")
|
||||||
|
|
||||||
local border = CreateFrame("Frame", nil, frame)
|
local border = CreateFrame("Frame", nil, frame, "BackdropTemplate")
|
||||||
border:SetPoint("TOPLEFT", 1, -27)
|
border:SetPoint("TOPLEFT", 1, -27)
|
||||||
border:SetPoint("BOTTOMRIGHT", -1, 3)
|
border:SetPoint("BOTTOMRIGHT", -1, 3)
|
||||||
border:SetBackdrop(PaneBackdrop)
|
border:SetBackdrop(PaneBackdrop)
|
||||||
|
|||||||
@@ -2,22 +2,18 @@
|
|||||||
TreeGroup Container
|
TreeGroup Container
|
||||||
Container that uses a tree control to switch between groups.
|
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)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||||
|
|
||||||
-- Lua APIs
|
-- Lua APIs
|
||||||
local next, pairs, ipairs, assert, type = next, pairs, ipairs, assert, type
|
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
|
local select, tremove, unpack, tconcat = select, table.remove, unpack, table.concat
|
||||||
|
|
||||||
-- WoW APIs
|
-- WoW APIs
|
||||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
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
|
-- Recycling functions
|
||||||
local new, del
|
local new, del
|
||||||
do
|
do
|
||||||
@@ -109,11 +105,11 @@ local function UpdateButton(button, treeline, selected, canExpand, isExpanded)
|
|||||||
|
|
||||||
if canExpand then
|
if canExpand then
|
||||||
if not isExpanded then
|
if not isExpanded then
|
||||||
toggle:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-UP")
|
toggle:SetNormalTexture(130838) -- Interface\\Buttons\\UI-PlusButton-UP
|
||||||
toggle:SetPushedTexture("Interface\\Buttons\\UI-PlusButton-DOWN")
|
toggle:SetPushedTexture(130836) -- Interface\\Buttons\\UI-PlusButton-DOWN
|
||||||
else
|
else
|
||||||
toggle:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-UP")
|
toggle:SetNormalTexture(130821) -- Interface\\Buttons\\UI-MinusButton-UP
|
||||||
toggle:SetPushedTexture("Interface\\Buttons\\UI-MinusButton-DOWN")
|
toggle:SetPushedTexture(130820) -- Interface\\Buttons\\UI-MinusButton-DOWN
|
||||||
end
|
end
|
||||||
toggle:Show()
|
toggle:Show()
|
||||||
else
|
else
|
||||||
@@ -159,7 +155,7 @@ end
|
|||||||
local function FirstFrameUpdate(frame)
|
local function FirstFrameUpdate(frame)
|
||||||
local self = frame.obj
|
local self = frame.obj
|
||||||
frame:SetScript("OnUpdate", nil)
|
frame:SetScript("OnUpdate", nil)
|
||||||
self:RefreshTree()
|
self:RefreshTree(nil, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function BuildUniqueValue(...)
|
local function BuildUniqueValue(...)
|
||||||
@@ -206,11 +202,13 @@ local function Button_OnEnter(frame)
|
|||||||
self:Fire("OnButtonEnter", frame.uniquevalue, frame)
|
self:Fire("OnButtonEnter", frame.uniquevalue, frame)
|
||||||
|
|
||||||
if self.enabletooltips then
|
if self.enabletooltips then
|
||||||
GameTooltip:SetOwner(frame, "ANCHOR_NONE")
|
local tooltip = AceGUI.tooltip
|
||||||
GameTooltip:SetPoint("LEFT",frame,"RIGHT")
|
tooltip:SetOwner(frame, "ANCHOR_NONE")
|
||||||
GameTooltip:SetText(frame.text:GetText() or "", 1, .82, 0, 1)
|
tooltip:ClearAllPoints()
|
||||||
|
tooltip:SetPoint("LEFT",frame,"RIGHT")
|
||||||
|
tooltip:SetText(frame.text:GetText() or "", 1, .82, 0, 1, true)
|
||||||
|
|
||||||
GameTooltip:Show()
|
tooltip:Show()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -219,7 +217,7 @@ local function Button_OnLeave(frame)
|
|||||||
self:Fire("OnButtonLeave", frame.uniquevalue, frame)
|
self:Fire("OnButtonLeave", frame.uniquevalue, frame)
|
||||||
|
|
||||||
if self.enabletooltips then
|
if self.enabletooltips then
|
||||||
GameTooltip:Hide()
|
AceGUI.tooltip:Hide()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -227,7 +225,7 @@ local function OnScrollValueChanged(frame, value)
|
|||||||
if frame.obj.noupdate then return end
|
if frame.obj.noupdate then return end
|
||||||
local self = frame.obj
|
local self = frame.obj
|
||||||
local status = self.status or self.localstatus
|
local status = self.status or self.localstatus
|
||||||
status.scrollvalue = value
|
status.scrollvalue = floor(value + 0.5)
|
||||||
self:RefreshTree()
|
self:RefreshTree()
|
||||||
AceGUI:ClearFocus()
|
AceGUI:ClearFocus()
|
||||||
end
|
end
|
||||||
@@ -292,10 +290,13 @@ local methods = {
|
|||||||
["OnAcquire"] = function(self)
|
["OnAcquire"] = function(self)
|
||||||
self:SetTreeWidth(DEFAULT_TREE_WIDTH, DEFAULT_TREE_SIZABLE)
|
self:SetTreeWidth(DEFAULT_TREE_WIDTH, DEFAULT_TREE_SIZABLE)
|
||||||
self:EnableButtonTooltips(true)
|
self:EnableButtonTooltips(true)
|
||||||
|
self.frame:SetScript("OnUpdate", FirstFrameUpdate)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
["OnRelease"] = function(self)
|
["OnRelease"] = function(self)
|
||||||
self.status = nil
|
self.status = nil
|
||||||
|
self.tree = nil
|
||||||
|
self.frame:SetScript("OnUpdate", nil)
|
||||||
for k, v in pairs(self.localstatus) do
|
for k, v in pairs(self.localstatus) do
|
||||||
if k == "groups" then
|
if k == "groups" then
|
||||||
for k2 in pairs(v) do
|
for k2 in pairs(v) do
|
||||||
@@ -383,13 +384,9 @@ local methods = {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
["RefreshTree"] = function(self,scrollToSelection)
|
["RefreshTree"] = function(self,scrollToSelection,fromOnUpdate)
|
||||||
local buttons = self.buttons
|
local buttons = self.buttons
|
||||||
local lines = self.lines
|
local lines = self.lines
|
||||||
|
|
||||||
for i, v in ipairs(buttons) do
|
|
||||||
v:Hide()
|
|
||||||
end
|
|
||||||
while lines[1] do
|
while lines[1] do
|
||||||
local t = tremove(lines)
|
local t = tremove(lines)
|
||||||
for k in pairs(t) do
|
for k in pairs(t) do
|
||||||
@@ -415,6 +412,11 @@ local methods = {
|
|||||||
local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18))
|
local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18))
|
||||||
if maxlines <= 0 then return end
|
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
|
local first, last
|
||||||
|
|
||||||
scrollToSelection = status.scrollToSelection
|
scrollToSelection = status.scrollToSelection
|
||||||
@@ -493,6 +495,10 @@ local methods = {
|
|||||||
buttonnum = buttonnum + 1
|
buttonnum = buttonnum + 1
|
||||||
end
|
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,
|
end,
|
||||||
|
|
||||||
["SetSelected"] = function(self, value)
|
["SetSelected"] = function(self, value)
|
||||||
@@ -557,7 +563,11 @@ local methods = {
|
|||||||
if maxtreewidth > 100 and status.treewidth > maxtreewidth then
|
if maxtreewidth > 100 and status.treewidth > maxtreewidth then
|
||||||
self:SetTreeWidth(maxtreewidth, status.treesizable)
|
self:SetTreeWidth(maxtreewidth, status.treesizable)
|
||||||
end
|
end
|
||||||
treeframe:SetMaxResize(maxtreewidth, 1600)
|
if treeframe.SetResizeBounds then
|
||||||
|
treeframe:SetResizeBounds(100, 1, maxtreewidth, 1600)
|
||||||
|
else
|
||||||
|
treeframe:SetMaxResize(maxtreewidth, 1600)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
["OnHeightSet"] = function(self, height)
|
["OnHeightSet"] = function(self, height)
|
||||||
@@ -619,7 +629,7 @@ local PaneBackdrop = {
|
|||||||
local DraggerBackdrop = {
|
local DraggerBackdrop = {
|
||||||
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||||
edgeFile = nil,
|
edgeFile = nil,
|
||||||
tile = true, tileSize = 16, edgeSize = 0,
|
tile = true, tileSize = 16, edgeSize = 1,
|
||||||
insets = { left = 3, right = 3, top = 7, bottom = 7 }
|
insets = { left = 3, right = 3, top = 7, bottom = 7 }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,7 +637,7 @@ local function Constructor()
|
|||||||
local num = AceGUI:GetNextWidgetNum(Type)
|
local num = AceGUI:GetNextWidgetNum(Type)
|
||||||
local frame = CreateFrame("Frame", nil, UIParent)
|
local frame = CreateFrame("Frame", nil, UIParent)
|
||||||
|
|
||||||
local treeframe = CreateFrame("Frame", nil, frame)
|
local treeframe = CreateFrame("Frame", nil, frame, "BackdropTemplate")
|
||||||
treeframe:SetPoint("TOPLEFT")
|
treeframe:SetPoint("TOPLEFT")
|
||||||
treeframe:SetPoint("BOTTOMLEFT")
|
treeframe:SetPoint("BOTTOMLEFT")
|
||||||
treeframe:SetWidth(DEFAULT_TREE_WIDTH)
|
treeframe:SetWidth(DEFAULT_TREE_WIDTH)
|
||||||
@@ -636,13 +646,17 @@ local function Constructor()
|
|||||||
treeframe:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
|
treeframe:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
|
||||||
treeframe:SetBackdropBorderColor(0.4, 0.4, 0.4)
|
treeframe:SetBackdropBorderColor(0.4, 0.4, 0.4)
|
||||||
treeframe:SetResizable(true)
|
treeframe:SetResizable(true)
|
||||||
treeframe:SetMinResize(100, 1)
|
if treeframe.SetResizeBounds then -- WoW 10.0
|
||||||
treeframe:SetMaxResize(400, 1600)
|
treeframe:SetResizeBounds(100, 1, 400, 1600)
|
||||||
|
else
|
||||||
|
treeframe:SetMinResize(100, 1)
|
||||||
|
treeframe:SetMaxResize(400, 1600)
|
||||||
|
end
|
||||||
treeframe:SetScript("OnUpdate", FirstFrameUpdate)
|
treeframe:SetScript("OnUpdate", FirstFrameUpdate)
|
||||||
treeframe:SetScript("OnSizeChanged", Tree_OnSizeChanged)
|
treeframe:SetScript("OnSizeChanged", Tree_OnSizeChanged)
|
||||||
treeframe:SetScript("OnMouseWheel", Tree_OnMouseWheel)
|
treeframe:SetScript("OnMouseWheel", Tree_OnMouseWheel)
|
||||||
|
|
||||||
local dragger = CreateFrame("Frame", nil, treeframe)
|
local dragger = CreateFrame("Frame", nil, treeframe, "BackdropTemplate")
|
||||||
dragger:SetWidth(8)
|
dragger:SetWidth(8)
|
||||||
dragger:SetPoint("TOP", treeframe, "TOPRIGHT")
|
dragger:SetPoint("TOP", treeframe, "TOPRIGHT")
|
||||||
dragger:SetPoint("BOTTOM", treeframe, "BOTTOMRIGHT")
|
dragger:SetPoint("BOTTOM", treeframe, "BOTTOMRIGHT")
|
||||||
@@ -665,9 +679,9 @@ local function Constructor()
|
|||||||
|
|
||||||
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
|
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
|
||||||
scrollbg:SetAllPoints(scrollbar)
|
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("TOPLEFT", treeframe, "TOPRIGHT")
|
||||||
border:SetPoint("BOTTOMRIGHT")
|
border:SetPoint("BOTTOMRIGHT")
|
||||||
border:SetBackdrop(PaneBackdrop)
|
border:SetBackdrop(PaneBackdrop)
|
||||||
|
|||||||
@@ -7,10 +7,6 @@ local pairs, assert, type = pairs, assert, type
|
|||||||
local PlaySound = PlaySound
|
local PlaySound = PlaySound
|
||||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
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 --
|
-- Main Frame --
|
||||||
----------------
|
----------------
|
||||||
@@ -21,7 +17,7 @@ local CreateFrame, UIParent = CreateFrame, UIParent
|
|||||||
]]
|
]]
|
||||||
do
|
do
|
||||||
local Type = "Window"
|
local Type = "Window"
|
||||||
local Version = 5
|
local Version = 8
|
||||||
|
|
||||||
local function frameOnShow(this)
|
local function frameOnShow(this)
|
||||||
this.obj:Fire("OnShow")
|
this.obj:Fire("OnShow")
|
||||||
@@ -32,7 +28,7 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function closeOnClick(this)
|
local function closeOnClick(this)
|
||||||
PlaySound("gsTitleOptionExit")
|
PlaySound(799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT
|
||||||
this.obj:Hide()
|
this.obj:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -186,71 +182,75 @@ do
|
|||||||
|
|
||||||
frame:SetScript("OnShow",frameOnShow)
|
frame:SetScript("OnShow",frameOnShow)
|
||||||
frame:SetScript("OnHide",frameOnClose)
|
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)
|
frame:SetToplevel(true)
|
||||||
|
|
||||||
local titlebg = frame:CreateTexture(nil, "BACKGROUND")
|
local titlebg = frame:CreateTexture(nil, "BACKGROUND")
|
||||||
titlebg:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Title-Background]])
|
titlebg:SetTexture(251966) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Title-Background
|
||||||
titlebg:SetPoint("TOPLEFT", 9, -6)
|
titlebg:SetPoint("TOPLEFT", 9, -6)
|
||||||
titlebg:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -28, -24)
|
titlebg:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -28, -24)
|
||||||
|
|
||||||
local dialogbg = frame:CreateTexture(nil, "BACKGROUND")
|
local dialogbg = frame:CreateTexture(nil, "BACKGROUND")
|
||||||
dialogbg:SetTexture([[Interface\Tooltips\UI-Tooltip-Background]])
|
dialogbg:SetTexture(137056) -- Interface\\Tooltips\\UI-Tooltip-Background
|
||||||
dialogbg:SetPoint("TOPLEFT", 8, -24)
|
dialogbg:SetPoint("TOPLEFT", 8, -24)
|
||||||
dialogbg:SetPoint("BOTTOMRIGHT", -6, 8)
|
dialogbg:SetPoint("BOTTOMRIGHT", -6, 8)
|
||||||
dialogbg:SetVertexColor(0, 0, 0, .75)
|
dialogbg:SetVertexColor(0, 0, 0, .75)
|
||||||
|
|
||||||
local topleft = frame:CreateTexture(nil, "BORDER")
|
local topleft = frame:CreateTexture(nil, "BORDER")
|
||||||
topleft:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
topleft:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||||
topleft:SetWidth(64)
|
topleft:SetWidth(64)
|
||||||
topleft:SetHeight(64)
|
topleft:SetHeight(64)
|
||||||
topleft:SetPoint("TOPLEFT")
|
topleft:SetPoint("TOPLEFT")
|
||||||
topleft:SetTexCoord(0.501953125, 0.625, 0, 1)
|
topleft:SetTexCoord(0.501953125, 0.625, 0, 1)
|
||||||
|
|
||||||
local topright = frame:CreateTexture(nil, "BORDER")
|
local topright = frame:CreateTexture(nil, "BORDER")
|
||||||
topright:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
topright:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||||
topright:SetWidth(64)
|
topright:SetWidth(64)
|
||||||
topright:SetHeight(64)
|
topright:SetHeight(64)
|
||||||
topright:SetPoint("TOPRIGHT")
|
topright:SetPoint("TOPRIGHT")
|
||||||
topright:SetTexCoord(0.625, 0.75, 0, 1)
|
topright:SetTexCoord(0.625, 0.75, 0, 1)
|
||||||
|
|
||||||
local top = frame:CreateTexture(nil, "BORDER")
|
local top = frame:CreateTexture(nil, "BORDER")
|
||||||
top:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
top:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||||
top:SetHeight(64)
|
top:SetHeight(64)
|
||||||
top:SetPoint("TOPLEFT", topleft, "TOPRIGHT")
|
top:SetPoint("TOPLEFT", topleft, "TOPRIGHT")
|
||||||
top:SetPoint("TOPRIGHT", topright, "TOPLEFT")
|
top:SetPoint("TOPRIGHT", topright, "TOPLEFT")
|
||||||
top:SetTexCoord(0.25, 0.369140625, 0, 1)
|
top:SetTexCoord(0.25, 0.369140625, 0, 1)
|
||||||
|
|
||||||
local bottomleft = frame:CreateTexture(nil, "BORDER")
|
local bottomleft = frame:CreateTexture(nil, "BORDER")
|
||||||
bottomleft:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
bottomleft:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||||
bottomleft:SetWidth(64)
|
bottomleft:SetWidth(64)
|
||||||
bottomleft:SetHeight(64)
|
bottomleft:SetHeight(64)
|
||||||
bottomleft:SetPoint("BOTTOMLEFT")
|
bottomleft:SetPoint("BOTTOMLEFT")
|
||||||
bottomleft:SetTexCoord(0.751953125, 0.875, 0, 1)
|
bottomleft:SetTexCoord(0.751953125, 0.875, 0, 1)
|
||||||
|
|
||||||
local bottomright = frame:CreateTexture(nil, "BORDER")
|
local bottomright = frame:CreateTexture(nil, "BORDER")
|
||||||
bottomright:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
bottomright:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||||
bottomright:SetWidth(64)
|
bottomright:SetWidth(64)
|
||||||
bottomright:SetHeight(64)
|
bottomright:SetHeight(64)
|
||||||
bottomright:SetPoint("BOTTOMRIGHT")
|
bottomright:SetPoint("BOTTOMRIGHT")
|
||||||
bottomright:SetTexCoord(0.875, 1, 0, 1)
|
bottomright:SetTexCoord(0.875, 1, 0, 1)
|
||||||
|
|
||||||
local bottom = frame:CreateTexture(nil, "BORDER")
|
local bottom = frame:CreateTexture(nil, "BORDER")
|
||||||
bottom:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
bottom:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||||
bottom:SetHeight(64)
|
bottom:SetHeight(64)
|
||||||
bottom:SetPoint("BOTTOMLEFT", bottomleft, "BOTTOMRIGHT")
|
bottom:SetPoint("BOTTOMLEFT", bottomleft, "BOTTOMRIGHT")
|
||||||
bottom:SetPoint("BOTTOMRIGHT", bottomright, "BOTTOMLEFT")
|
bottom:SetPoint("BOTTOMRIGHT", bottomright, "BOTTOMLEFT")
|
||||||
bottom:SetTexCoord(0.376953125, 0.498046875, 0, 1)
|
bottom:SetTexCoord(0.376953125, 0.498046875, 0, 1)
|
||||||
|
|
||||||
local left = frame:CreateTexture(nil, "BORDER")
|
local left = frame:CreateTexture(nil, "BORDER")
|
||||||
left:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
left:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||||
left:SetWidth(64)
|
left:SetWidth(64)
|
||||||
left:SetPoint("TOPLEFT", topleft, "BOTTOMLEFT")
|
left:SetPoint("TOPLEFT", topleft, "BOTTOMLEFT")
|
||||||
left:SetPoint("BOTTOMLEFT", bottomleft, "TOPLEFT")
|
left:SetPoint("BOTTOMLEFT", bottomleft, "TOPLEFT")
|
||||||
left:SetTexCoord(0.001953125, 0.125, 0, 1)
|
left:SetTexCoord(0.001953125, 0.125, 0, 1)
|
||||||
|
|
||||||
local right = frame:CreateTexture(nil, "BORDER")
|
local right = frame:CreateTexture(nil, "BORDER")
|
||||||
right:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
|
right:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border
|
||||||
right:SetWidth(64)
|
right:SetWidth(64)
|
||||||
right:SetPoint("TOPRIGHT", topright, "BOTTOMRIGHT")
|
right:SetPoint("TOPRIGHT", topright, "BOTTOMRIGHT")
|
||||||
right:SetPoint("BOTTOMRIGHT", bottomright, "TOPRIGHT")
|
right:SetPoint("BOTTOMRIGHT", bottomright, "TOPRIGHT")
|
||||||
@@ -290,7 +290,7 @@ do
|
|||||||
line1:SetWidth(14)
|
line1:SetWidth(14)
|
||||||
line1:SetHeight(14)
|
line1:SetHeight(14)
|
||||||
line1:SetPoint("BOTTOMRIGHT", -8, 8)
|
line1:SetPoint("BOTTOMRIGHT", -8, 8)
|
||||||
line1:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
|
line1:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
|
||||||
local x = 0.1 * 14/17
|
local x = 0.1 * 14/17
|
||||||
line1:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
|
line1:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
|
||||||
|
|
||||||
@@ -299,8 +299,8 @@ do
|
|||||||
line2:SetWidth(8)
|
line2:SetWidth(8)
|
||||||
line2:SetHeight(8)
|
line2:SetHeight(8)
|
||||||
line2:SetPoint("BOTTOMRIGHT", -8, 8)
|
line2:SetPoint("BOTTOMRIGHT", -8, 8)
|
||||||
line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
|
line2:SetTexture(137057) -- 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)
|
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)
|
local sizer_s = CreateFrame("Frame",nil,frame)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
Button Widget
|
Button Widget
|
||||||
Graphical Button.
|
Graphical Button.
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
local Type, Version = "Button", 23
|
local Type, Version = "Button", 24
|
||||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ Scripts
|
|||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
local function Button_OnClick(frame, ...)
|
local function Button_OnClick(frame, ...)
|
||||||
AceGUI:ClearFocus()
|
AceGUI:ClearFocus()
|
||||||
PlaySound("igMainMenuOption")
|
PlaySound(852) -- SOUNDKIT.IG_MAINMENU_OPTION
|
||||||
frame.obj:Fire("OnClick", ...)
|
frame.obj:Fire("OnClick", ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ Constructor
|
|||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
local function Constructor()
|
local function Constructor()
|
||||||
local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type)
|
local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type)
|
||||||
local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate2")
|
local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate")
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
|
|
||||||
frame:EnableMouse(true)
|
frame:EnableMouse(true)
|
||||||
|
|||||||
@@ -12,10 +12,6 @@ local select, pairs = select, pairs
|
|||||||
local PlaySound = PlaySound
|
local PlaySound = PlaySound
|
||||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
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
|
Support functions
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
@@ -60,9 +56,9 @@ local function CheckBox_OnMouseUp(frame)
|
|||||||
self:ToggleChecked()
|
self:ToggleChecked()
|
||||||
|
|
||||||
if self.checked then
|
if self.checked then
|
||||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
|
||||||
else -- for both nil and false (tristate)
|
else -- for both nil and false (tristate)
|
||||||
PlaySound("igMainMenuOptionCheckBoxOff")
|
PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF
|
||||||
end
|
end
|
||||||
|
|
||||||
self:Fire("OnValueChanged", self.checked)
|
self:Fire("OnValueChanged", self.checked)
|
||||||
@@ -155,21 +151,21 @@ local methods = {
|
|||||||
local size
|
local size
|
||||||
if type == "radio" then
|
if type == "radio" then
|
||||||
size = 16
|
size = 16
|
||||||
checkbg:SetTexture("Interface\\Buttons\\UI-RadioButton")
|
checkbg:SetTexture(130843) -- Interface\\Buttons\\UI-RadioButton
|
||||||
checkbg:SetTexCoord(0, 0.25, 0, 1)
|
checkbg:SetTexCoord(0, 0.25, 0, 1)
|
||||||
check:SetTexture("Interface\\Buttons\\UI-RadioButton")
|
check:SetTexture(130843) -- Interface\\Buttons\\UI-RadioButton
|
||||||
check:SetTexCoord(0.25, 0.5, 0, 1)
|
check:SetTexCoord(0.25, 0.5, 0, 1)
|
||||||
check:SetBlendMode("ADD")
|
check:SetBlendMode("ADD")
|
||||||
highlight:SetTexture("Interface\\Buttons\\UI-RadioButton")
|
highlight:SetTexture(130843) -- Interface\\Buttons\\UI-RadioButton
|
||||||
highlight:SetTexCoord(0.5, 0.75, 0, 1)
|
highlight:SetTexCoord(0.5, 0.75, 0, 1)
|
||||||
else
|
else
|
||||||
size = 24
|
size = 24
|
||||||
checkbg:SetTexture("Interface\\Buttons\\UI-CheckBox-Up")
|
checkbg:SetTexture(130755) -- Interface\\Buttons\\UI-CheckBox-Up
|
||||||
checkbg:SetTexCoord(0, 1, 0, 1)
|
checkbg:SetTexCoord(0, 1, 0, 1)
|
||||||
check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check")
|
check:SetTexture(130751) -- Interface\\Buttons\\UI-CheckBox-Check
|
||||||
check:SetTexCoord(0, 1, 0, 1)
|
check:SetTexCoord(0, 1, 0, 1)
|
||||||
check:SetBlendMode("BLEND")
|
check:SetBlendMode("BLEND")
|
||||||
highlight:SetTexture("Interface\\Buttons\\UI-CheckBox-Highlight")
|
highlight:SetTexture(130753) -- Interface\\Buttons\\UI-CheckBox-Highlight
|
||||||
highlight:SetTexCoord(0, 1, 0, 1)
|
highlight:SetTexCoord(0, 1, 0, 1)
|
||||||
end
|
end
|
||||||
checkbg:SetHeight(size)
|
checkbg:SetHeight(size)
|
||||||
@@ -199,14 +195,14 @@ local methods = {
|
|||||||
["SetDescription"] = function(self, desc)
|
["SetDescription"] = function(self, desc)
|
||||||
if desc then
|
if desc then
|
||||||
if not self.desc then
|
if not self.desc then
|
||||||
local desc = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
local f = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
||||||
desc:ClearAllPoints()
|
f:ClearAllPoints()
|
||||||
desc:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21)
|
f:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21)
|
||||||
desc:SetWidth(self.frame.width - 30)
|
f:SetWidth(self.frame.width - 30)
|
||||||
desc:SetPoint("RIGHT", self.frame, "RIGHT", -30, 0)
|
f:SetPoint("RIGHT", self.frame, "RIGHT", -30, 0)
|
||||||
desc:SetJustifyH("LEFT")
|
f:SetJustifyH("LEFT")
|
||||||
desc:SetJustifyV("TOP")
|
f:SetJustifyV("TOP")
|
||||||
self.desc = desc
|
self.desc = f
|
||||||
end
|
end
|
||||||
self.desc:Show()
|
self.desc:Show()
|
||||||
--self.text:SetFontObject(GameFontNormal)
|
--self.text:SetFontObject(GameFontNormal)
|
||||||
@@ -255,11 +251,11 @@ local function Constructor()
|
|||||||
checkbg:SetWidth(24)
|
checkbg:SetWidth(24)
|
||||||
checkbg:SetHeight(24)
|
checkbg:SetHeight(24)
|
||||||
checkbg:SetPoint("TOPLEFT")
|
checkbg:SetPoint("TOPLEFT")
|
||||||
checkbg:SetTexture("Interface\\Buttons\\UI-CheckBox-Up")
|
checkbg:SetTexture(130755) -- Interface\\Buttons\\UI-CheckBox-Up
|
||||||
|
|
||||||
local check = frame:CreateTexture(nil, "OVERLAY")
|
local check = frame:CreateTexture(nil, "OVERLAY")
|
||||||
check:SetAllPoints(checkbg)
|
check:SetAllPoints(checkbg)
|
||||||
check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check")
|
check:SetTexture(130751) -- Interface\\Buttons\\UI-CheckBox-Check
|
||||||
|
|
||||||
local text = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
|
local text = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
|
||||||
text:SetJustifyH("LEFT")
|
text:SetJustifyH("LEFT")
|
||||||
@@ -268,7 +264,7 @@ local function Constructor()
|
|||||||
text:SetPoint("RIGHT")
|
text:SetPoint("RIGHT")
|
||||||
|
|
||||||
local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
|
local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
|
||||||
highlight:SetTexture("Interface\\Buttons\\UI-CheckBox-Highlight")
|
highlight:SetTexture(130753) -- Interface\\Buttons\\UI-CheckBox-Highlight
|
||||||
highlight:SetBlendMode("ADD")
|
highlight:SetBlendMode("ADD")
|
||||||
highlight:SetAllPoints(checkbg)
|
highlight:SetAllPoints(checkbg)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
--[[-----------------------------------------------------------------------------
|
--[[-----------------------------------------------------------------------------
|
||||||
ColorPicker Widget
|
ColorPicker Widget
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
local Type, Version = "ColorPicker", 25
|
local Type, Version = "ColorPicker", 28
|
||||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||||
|
|
||||||
@@ -11,17 +11,24 @@ local pairs = pairs
|
|||||||
-- WoW APIs
|
-- WoW APIs
|
||||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||||
|
|
||||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
-- Unfortunately we have no way to realistically detect if a client uses inverted alpha
|
||||||
-- List them here for Mikk's FindGlobals script
|
-- as no API will tell you. Wrath uses the old colorpicker, era uses the new one, both are inverted
|
||||||
-- GLOBALS: ColorPickerFrame, OpacitySliderFrame
|
local INVERTED_ALPHA = (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE)
|
||||||
|
|
||||||
--[[-----------------------------------------------------------------------------
|
--[[-----------------------------------------------------------------------------
|
||||||
Support functions
|
Support functions
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
local function ColorCallback(self, r, g, b, a, isAlpha)
|
local function ColorCallback(self, r, g, b, a, isAlpha)
|
||||||
|
if INVERTED_ALPHA and a then
|
||||||
|
a = 1 - a
|
||||||
|
end
|
||||||
if not self.HasAlpha then
|
if not self.HasAlpha then
|
||||||
a = 1
|
a = 1
|
||||||
end
|
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)
|
self:SetColor(r, g, b, a)
|
||||||
if ColorPickerFrame:IsVisible() then
|
if ColorPickerFrame:IsVisible() then
|
||||||
--colorpicker is still open
|
--colorpicker is still open
|
||||||
@@ -54,30 +61,63 @@ local function ColorSwatch_OnClick(frame)
|
|||||||
ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10)
|
ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10)
|
||||||
ColorPickerFrame:SetClampedToScreen(true)
|
ColorPickerFrame:SetClampedToScreen(true)
|
||||||
|
|
||||||
ColorPickerFrame.func = function()
|
if ColorPickerFrame.SetupColorPickerAndShow then -- 10.2.5 color picker overhaul
|
||||||
local r, g, b = ColorPickerFrame:GetColorRGB()
|
local r2, g2, b2, a2 = self.r, self.g, self.b, (self.a or 1)
|
||||||
local a = 1 - OpacitySliderFrame:GetValue()
|
if INVERTED_ALPHA then
|
||||||
ColorCallback(self, r, g, b, a)
|
a2 = 1 - a2
|
||||||
end
|
end
|
||||||
|
|
||||||
ColorPickerFrame.hasOpacity = self.HasAlpha
|
local info = {
|
||||||
ColorPickerFrame.opacityFunc = function()
|
swatchFunc = function()
|
||||||
local r, g, b = ColorPickerFrame:GetColorRGB()
|
local r, g, b = ColorPickerFrame:GetColorRGB()
|
||||||
local a = 1 - OpacitySliderFrame:GetValue()
|
local a = ColorPickerFrame:GetColorAlpha()
|
||||||
ColorCallback(self, r, g, b, a, true)
|
ColorCallback(self, r, g, b, a)
|
||||||
end
|
end,
|
||||||
|
|
||||||
local r, g, b, a = self.r, self.g, self.b, self.a
|
hasOpacity = self.HasAlpha,
|
||||||
if self.HasAlpha then
|
opacityFunc = function()
|
||||||
ColorPickerFrame.opacity = 1 - (a or 0)
|
local r, g, b = ColorPickerFrame:GetColorRGB()
|
||||||
end
|
local a = ColorPickerFrame:GetColorAlpha()
|
||||||
ColorPickerFrame:SetColorRGB(r, g, b)
|
ColorCallback(self, r, g, b, a, true)
|
||||||
|
end,
|
||||||
|
opacity = a2,
|
||||||
|
|
||||||
ColorPickerFrame.cancelFunc = function()
|
cancelFunc = function()
|
||||||
ColorCallback(self, r, g, b, a, true)
|
ColorCallback(self, r2, g2, b2, a2, true)
|
||||||
end
|
end,
|
||||||
|
|
||||||
ColorPickerFrame:Show()
|
r = r2,
|
||||||
|
g = g2,
|
||||||
|
b = b2,
|
||||||
|
}
|
||||||
|
|
||||||
|
ColorPickerFrame:SetupColorPickerAndShow(info)
|
||||||
|
else
|
||||||
|
ColorPickerFrame.func = function()
|
||||||
|
local r, g, b = ColorPickerFrame:GetColorRGB()
|
||||||
|
local a = OpacitySliderFrame:GetValue()
|
||||||
|
ColorCallback(self, r, g, b, a)
|
||||||
|
end
|
||||||
|
|
||||||
|
ColorPickerFrame.hasOpacity = self.HasAlpha
|
||||||
|
ColorPickerFrame.opacityFunc = function()
|
||||||
|
local r, g, b = ColorPickerFrame:GetColorRGB()
|
||||||
|
local a = OpacitySliderFrame:GetValue()
|
||||||
|
ColorCallback(self, r, g, b, a, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
local r, g, b, a = self.r, self.g, self.b, 1 - (self.a or 1)
|
||||||
|
if self.HasAlpha then
|
||||||
|
ColorPickerFrame.opacity = a
|
||||||
|
end
|
||||||
|
ColorPickerFrame:SetColorRGB(r, g, b)
|
||||||
|
|
||||||
|
ColorPickerFrame.cancelFunc = function()
|
||||||
|
ColorCallback(self, r, g, b, a, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
ColorPickerFrame:Show()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
AceGUI:ClearFocus()
|
AceGUI:ClearFocus()
|
||||||
end
|
end
|
||||||
@@ -140,14 +180,14 @@ local function Constructor()
|
|||||||
local colorSwatch = frame:CreateTexture(nil, "OVERLAY")
|
local colorSwatch = frame:CreateTexture(nil, "OVERLAY")
|
||||||
colorSwatch:SetWidth(19)
|
colorSwatch:SetWidth(19)
|
||||||
colorSwatch:SetHeight(19)
|
colorSwatch:SetHeight(19)
|
||||||
colorSwatch:SetTexture("Interface\\ChatFrame\\ChatFrameColorSwatch")
|
colorSwatch:SetTexture(130939) -- Interface\\ChatFrame\\ChatFrameColorSwatch
|
||||||
colorSwatch:SetPoint("LEFT")
|
colorSwatch:SetPoint("LEFT")
|
||||||
|
|
||||||
local texture = frame:CreateTexture(nil, "BACKGROUND")
|
local texture = frame:CreateTexture(nil, "BACKGROUND")
|
||||||
colorSwatch.background = texture
|
colorSwatch.background = texture
|
||||||
texture:SetWidth(16)
|
texture:SetWidth(16)
|
||||||
texture:SetHeight(16)
|
texture:SetHeight(16)
|
||||||
texture:SetTexture(1, 1, 1)
|
texture:SetColorTexture(1, 1, 1)
|
||||||
texture:SetPoint("CENTER", colorSwatch)
|
texture:SetPoint("CENTER", colorSwatch)
|
||||||
texture:Show()
|
texture:Show()
|
||||||
|
|
||||||
@@ -155,7 +195,7 @@ local function Constructor()
|
|||||||
colorSwatch.checkers = checkers
|
colorSwatch.checkers = checkers
|
||||||
checkers:SetWidth(14)
|
checkers:SetWidth(14)
|
||||||
checkers:SetHeight(14)
|
checkers:SetHeight(14)
|
||||||
checkers:SetTexture("Tileset\\Generic\\Checkers")
|
checkers:SetTexture(188523) -- Tileset\\Generic\\Checkers
|
||||||
checkers:SetTexCoord(.25, 0, 0.5, .25)
|
checkers:SetTexCoord(.25, 0, 0.5, .25)
|
||||||
checkers:SetDesaturated(true)
|
checkers:SetDesaturated(true)
|
||||||
checkers:SetVertexColor(1, 1, 1, 0.75)
|
checkers:SetVertexColor(1, 1, 1, 0.75)
|
||||||
@@ -170,7 +210,7 @@ local function Constructor()
|
|||||||
text:SetPoint("RIGHT")
|
text:SetPoint("RIGHT")
|
||||||
|
|
||||||
--local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
|
--local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
|
||||||
--highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
|
--highlight:SetTexture(136810) -- Interface\\QuestFrame\\UI-QuestTitleHighlight
|
||||||
--highlight:SetBlendMode("ADD")
|
--highlight:SetBlendMode("ADD")
|
||||||
--highlight:SetAllPoints(frame)
|
--highlight:SetAllPoints(frame)
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ local ItemBase = {
|
|||||||
-- NOTE: The ItemBase version is added to each item's version number
|
-- NOTE: The ItemBase version is added to each item's version number
|
||||||
-- to ensure proper updates on ItemBase changes.
|
-- to ensure proper updates on ItemBase changes.
|
||||||
-- Use at least 1000er steps.
|
-- Use at least 1000er steps.
|
||||||
version = 1000,
|
version = 2000,
|
||||||
counter = 0,
|
counter = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ function ItemBase.Create(type)
|
|||||||
self.text = text
|
self.text = text
|
||||||
|
|
||||||
local highlight = frame:CreateTexture(nil, "OVERLAY")
|
local highlight = frame:CreateTexture(nil, "OVERLAY")
|
||||||
highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
|
highlight:SetTexture(136810) -- Interface\\QuestFrame\\UI-QuestTitleHighlight
|
||||||
highlight:SetBlendMode("ADD")
|
highlight:SetBlendMode("ADD")
|
||||||
highlight:SetHeight(14)
|
highlight:SetHeight(14)
|
||||||
highlight:ClearAllPoints()
|
highlight:ClearAllPoints()
|
||||||
@@ -178,19 +178,19 @@ function ItemBase.Create(type)
|
|||||||
highlight:Hide()
|
highlight:Hide()
|
||||||
self.highlight = highlight
|
self.highlight = highlight
|
||||||
|
|
||||||
local check = frame:CreateTexture("OVERLAY")
|
local check = frame:CreateTexture(nil, "OVERLAY")
|
||||||
check:SetWidth(16)
|
check:SetWidth(16)
|
||||||
check:SetHeight(16)
|
check:SetHeight(16)
|
||||||
check:SetPoint("LEFT",frame,"LEFT",3,-1)
|
check:SetPoint("LEFT",frame,"LEFT",3,-1)
|
||||||
check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check")
|
check:SetTexture(130751) -- Interface\\Buttons\\UI-CheckBox-Check
|
||||||
check:Hide()
|
check:Hide()
|
||||||
self.check = check
|
self.check = check
|
||||||
|
|
||||||
local sub = frame:CreateTexture("OVERLAY")
|
local sub = frame:CreateTexture(nil, "OVERLAY")
|
||||||
sub:SetWidth(16)
|
sub:SetWidth(16)
|
||||||
sub:SetHeight(16)
|
sub:SetHeight(16)
|
||||||
sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1)
|
sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1)
|
||||||
sub:SetTexture("Interface\\ChatFrame\\ChatFrameExpandArrow")
|
sub:SetTexture(130940) -- Interface\\ChatFrame\\ChatFrameExpandArrow
|
||||||
sub:Hide()
|
sub:Hide()
|
||||||
self.sub = sub
|
self.sub = sub
|
||||||
|
|
||||||
@@ -323,7 +323,7 @@ end
|
|||||||
-- Does not close the pullout on click.
|
-- Does not close the pullout on click.
|
||||||
do
|
do
|
||||||
local widgetType = "Dropdown-Item-Toggle"
|
local widgetType = "Dropdown-Item-Toggle"
|
||||||
local widgetVersion = 3
|
local widgetVersion = 4
|
||||||
|
|
||||||
local function UpdateToggle(self)
|
local function UpdateToggle(self)
|
||||||
if self.value then
|
if self.value then
|
||||||
@@ -343,9 +343,9 @@ do
|
|||||||
if self.disabled then return end
|
if self.disabled then return end
|
||||||
self.value = not self.value
|
self.value = not self.value
|
||||||
if self.value then
|
if self.value then
|
||||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
|
||||||
else
|
else
|
||||||
PlaySound("igMainMenuOptionCheckBoxOff")
|
PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF
|
||||||
end
|
end
|
||||||
UpdateToggle(self)
|
UpdateToggle(self)
|
||||||
self:Fire("OnValueChanged", self.value)
|
self:Fire("OnValueChanged", self.value)
|
||||||
@@ -440,7 +440,7 @@ end
|
|||||||
-- A single line to separate items
|
-- A single line to separate items
|
||||||
do
|
do
|
||||||
local widgetType = "Dropdown-Item-Separator"
|
local widgetType = "Dropdown-Item-Separator"
|
||||||
local widgetVersion = 1
|
local widgetVersion = 2
|
||||||
|
|
||||||
-- exported, override
|
-- exported, override
|
||||||
local function SetDisabled(self, disabled)
|
local function SetDisabled(self, disabled)
|
||||||
@@ -455,7 +455,7 @@ do
|
|||||||
|
|
||||||
local line = self.frame:CreateTexture(nil, "OVERLAY")
|
local line = self.frame:CreateTexture(nil, "OVERLAY")
|
||||||
line:SetHeight(1)
|
line:SetHeight(1)
|
||||||
line:SetTexture(.5, .5, .5)
|
line:SetColorTexture(.5, .5, .5)
|
||||||
line:SetPoint("LEFT", self.frame, "LEFT", 10, 0)
|
line:SetPoint("LEFT", self.frame, "LEFT", 10, 0)
|
||||||
line:SetPoint("RIGHT", self.frame, "RIGHT", -10, 0)
|
line:SetPoint("RIGHT", self.frame, "RIGHT", -10, 0)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--[[ $Id: AceGUIWidget-DropDown.lua 1209 2019-06-24 21:01:01Z nevcairiel $ ]]--
|
--[[ $Id$ ]]--
|
||||||
local AceGUI = LibStub("AceGUI-3.0")
|
local AceGUI = LibStub("AceGUI-3.0")
|
||||||
|
|
||||||
-- Lua APIs
|
-- Lua APIs
|
||||||
@@ -11,10 +11,6 @@ local PlaySound = PlaySound
|
|||||||
local UIParent, CreateFrame = UIParent, CreateFrame
|
local UIParent, CreateFrame = UIParent, CreateFrame
|
||||||
local _G = _G
|
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 function fixlevels(parent,...)
|
||||||
local i = 1
|
local i = 1
|
||||||
local child = select(i, ...)
|
local child = select(i, ...)
|
||||||
@@ -39,7 +35,7 @@ end
|
|||||||
|
|
||||||
do
|
do
|
||||||
local widgetType = "Dropdown-Pullout"
|
local widgetType = "Dropdown-Pullout"
|
||||||
local widgetVersion = 3
|
local widgetVersion = 5
|
||||||
|
|
||||||
--[[ Static data ]]--
|
--[[ Static data ]]--
|
||||||
|
|
||||||
@@ -193,12 +189,7 @@ do
|
|||||||
|
|
||||||
local height = 8
|
local height = 8
|
||||||
for i, item in pairs(items) do
|
for i, item in pairs(items) do
|
||||||
if i == 1 then
|
item:SetPoint("TOP", itemFrame, "TOP", 0, -2 + (i - 1) * -16)
|
||||||
item:SetPoint("TOP", itemFrame, "TOP", 0, -2)
|
|
||||||
else
|
|
||||||
item:SetPoint("TOP", items[i-1].frame, "BOTTOM", 0, 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
item:Show()
|
item:Show()
|
||||||
|
|
||||||
height = height + 16
|
height = height + 16
|
||||||
@@ -258,7 +249,7 @@ do
|
|||||||
|
|
||||||
local function Constructor()
|
local function Constructor()
|
||||||
local count = AceGUI:GetNextWidgetNum(widgetType)
|
local count = AceGUI:GetNextWidgetNum(widgetType)
|
||||||
local frame = CreateFrame("Frame", "AceGUI30Pullout"..count, UIParent)
|
local frame = CreateFrame("Frame", "AceGUI30Pullout"..count, UIParent, "BackdropTemplate")
|
||||||
local self = {}
|
local self = {}
|
||||||
self.count = count
|
self.count = count
|
||||||
self.type = widgetType
|
self.type = widgetType
|
||||||
@@ -309,7 +300,7 @@ do
|
|||||||
scrollFrame.obj = self
|
scrollFrame.obj = self
|
||||||
itemFrame.obj = self
|
itemFrame.obj = self
|
||||||
|
|
||||||
local slider = CreateFrame("Slider", "AceGUI30PulloutScrollbar"..count, scrollFrame)
|
local slider = CreateFrame("Slider", "AceGUI30PulloutScrollbar"..count, scrollFrame, "BackdropTemplate")
|
||||||
slider:SetOrientation("VERTICAL")
|
slider:SetOrientation("VERTICAL")
|
||||||
slider:SetHitRectInsets(0, 0, -10, 0)
|
slider:SetHitRectInsets(0, 0, -10, 0)
|
||||||
slider:SetBackdrop(sliderBackdrop)
|
slider:SetBackdrop(sliderBackdrop)
|
||||||
@@ -356,7 +347,7 @@ end
|
|||||||
|
|
||||||
do
|
do
|
||||||
local widgetType = "Dropdown"
|
local widgetType = "Dropdown"
|
||||||
local widgetVersion = 34
|
local widgetVersion = 36
|
||||||
|
|
||||||
--[[ Static data ]]--
|
--[[ Static data ]]--
|
||||||
|
|
||||||
@@ -381,7 +372,6 @@ do
|
|||||||
|
|
||||||
local function Dropdown_TogglePullout(this)
|
local function Dropdown_TogglePullout(this)
|
||||||
local self = this.obj
|
local self = this.obj
|
||||||
PlaySound("igMainMenuOptionCheckBoxOn") -- missleading name, but the Blizzard code uses this sound
|
|
||||||
if self.open then
|
if self.open then
|
||||||
self.open = nil
|
self.open = nil
|
||||||
self.pullout:Close()
|
self.pullout:Close()
|
||||||
@@ -465,6 +455,7 @@ do
|
|||||||
self:SetWidth(200)
|
self:SetWidth(200)
|
||||||
self:SetLabel()
|
self:SetLabel()
|
||||||
self:SetPulloutWidth(nil)
|
self:SetPulloutWidth(nil)
|
||||||
|
self.list = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- exported, AceGUI callback
|
-- exported, AceGUI callback
|
||||||
@@ -535,9 +526,7 @@ do
|
|||||||
|
|
||||||
-- exported
|
-- exported
|
||||||
local function SetValue(self, value)
|
local function SetValue(self, value)
|
||||||
if self.list then
|
self:SetText(self.list[value] or "")
|
||||||
self:SetText(self.list[value] or "")
|
|
||||||
end
|
|
||||||
self.value = value
|
self.value = value
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -601,7 +590,7 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function SetList(self, list, order, itemType)
|
local function SetList(self, list, order, itemType)
|
||||||
self.list = list
|
self.list = list or {}
|
||||||
self.pullout:Clear()
|
self.pullout:Clear()
|
||||||
self.hasClose = nil
|
self.hasClose = nil
|
||||||
if not list then return end
|
if not list then return end
|
||||||
@@ -629,10 +618,8 @@ do
|
|||||||
|
|
||||||
-- exported
|
-- exported
|
||||||
local function AddItem(self, value, text, itemType)
|
local function AddItem(self, value, text, itemType)
|
||||||
if self.list then
|
self.list[value] = text
|
||||||
self.list[value] = text
|
AddListItem(self, value, text, itemType)
|
||||||
AddListItem(self, value, text, itemType)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- exported
|
-- exported
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
--[[-----------------------------------------------------------------------------
|
--[[-----------------------------------------------------------------------------
|
||||||
EditBox Widget
|
EditBox Widget
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
local Type, Version = "EditBox", 28
|
local Type, Version = "EditBox", 29
|
||||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||||
|
|
||||||
@@ -10,20 +10,20 @@ local tostring, pairs = tostring, pairs
|
|||||||
|
|
||||||
-- WoW APIs
|
-- WoW APIs
|
||||||
local PlaySound = PlaySound
|
local PlaySound = PlaySound
|
||||||
local GetCursorInfo, ClearCursor, GetSpellInfo = GetCursorInfo, ClearCursor, GetSpellInfo
|
local GetCursorInfo, ClearCursor = GetCursorInfo, ClearCursor
|
||||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||||
local _G = _G
|
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
|
Support functions
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
if not AceGUIEditBoxInsertLink then
|
if not AceGUIEditBoxInsertLink then
|
||||||
-- upgradeable hook
|
-- 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
|
end
|
||||||
|
|
||||||
function _G.AceGUIEditBoxInsertLink(text)
|
function _G.AceGUIEditBoxInsertLink(text)
|
||||||
@@ -73,19 +73,23 @@ local function EditBox_OnEnterPressed(frame)
|
|||||||
local value = frame:GetText()
|
local value = frame:GetText()
|
||||||
local cancel = self:Fire("OnEnterPressed", value)
|
local cancel = self:Fire("OnEnterPressed", value)
|
||||||
if not cancel then
|
if not cancel then
|
||||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
|
||||||
HideButton(self)
|
HideButton(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function EditBox_OnReceiveDrag(frame)
|
local function EditBox_OnReceiveDrag(frame)
|
||||||
local self = frame.obj
|
local self = frame.obj
|
||||||
local type, id, info = GetCursorInfo()
|
local type, id, info, extra = GetCursorInfo()
|
||||||
local name
|
local name
|
||||||
if type == "item" then
|
if type == "item" then
|
||||||
name = info
|
name = info
|
||||||
elseif type == "spell" then
|
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
|
elseif type == "macro" then
|
||||||
name = GetMacroInfo(id)
|
name = GetMacroInfo(id)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -51,14 +51,14 @@ local function Constructor()
|
|||||||
left:SetHeight(8)
|
left:SetHeight(8)
|
||||||
left:SetPoint("LEFT", 3, 0)
|
left:SetPoint("LEFT", 3, 0)
|
||||||
left:SetPoint("RIGHT", label, "LEFT", -5, 0)
|
left:SetPoint("RIGHT", label, "LEFT", -5, 0)
|
||||||
left:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
|
left:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
|
||||||
left:SetTexCoord(0.81, 0.94, 0.5, 1)
|
left:SetTexCoord(0.81, 0.94, 0.5, 1)
|
||||||
|
|
||||||
local right = frame:CreateTexture(nil, "BACKGROUND")
|
local right = frame:CreateTexture(nil, "BACKGROUND")
|
||||||
right:SetHeight(8)
|
right:SetHeight(8)
|
||||||
right:SetPoint("RIGHT", -3, 0)
|
right:SetPoint("RIGHT", -3, 0)
|
||||||
right:SetPoint("LEFT", label, "RIGHT", 5, 0)
|
right:SetPoint("LEFT", label, "RIGHT", 5, 0)
|
||||||
right:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
|
right:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border
|
||||||
right:SetTexCoord(0.81, 0.94, 0.5, 1)
|
right:SetTexCoord(0.81, 0.94, 0.5, 1)
|
||||||
|
|
||||||
local widget = {
|
local widget = {
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ local function Constructor()
|
|||||||
|
|
||||||
local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
|
local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
|
||||||
highlight:SetAllPoints(image)
|
highlight:SetAllPoints(image)
|
||||||
highlight:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight")
|
highlight:SetTexture(136580) -- Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight
|
||||||
highlight:SetTexCoord(0, 1, 0.23, 0.77)
|
highlight:SetTexCoord(0, 1, 0.23, 0.77)
|
||||||
highlight:SetBlendMode("ADD")
|
highlight:SetBlendMode("ADD")
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ local function Constructor()
|
|||||||
widget[method] = func
|
widget[method] = func
|
||||||
end
|
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)
|
return AceGUI:RegisterAsWidget(widget)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
Keybinding Widget
|
Keybinding Widget
|
||||||
Set Keybindings in the Config UI.
|
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)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
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 IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown
|
||||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
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
|
Scripts
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
@@ -35,12 +31,14 @@ local function Keybinding_OnClick(frame, button)
|
|||||||
if self.waitingForKey then
|
if self.waitingForKey then
|
||||||
frame:EnableKeyboard(false)
|
frame:EnableKeyboard(false)
|
||||||
frame:EnableMouseWheel(false)
|
frame:EnableMouseWheel(false)
|
||||||
|
frame:EnableGamePadButton(false)
|
||||||
self.msgframe:Hide()
|
self.msgframe:Hide()
|
||||||
frame:UnlockHighlight()
|
frame:UnlockHighlight()
|
||||||
self.waitingForKey = nil
|
self.waitingForKey = nil
|
||||||
else
|
else
|
||||||
frame:EnableKeyboard(true)
|
frame:EnableKeyboard(true)
|
||||||
frame:EnableMouseWheel(true)
|
frame:EnableMouseWheel(true)
|
||||||
|
frame:EnableGamePadButton(true)
|
||||||
self.msgframe:Show()
|
self.msgframe:Show()
|
||||||
frame:LockHighlight()
|
frame:LockHighlight()
|
||||||
self.waitingForKey = true
|
self.waitingForKey = true
|
||||||
@@ -76,6 +74,7 @@ local function Keybinding_OnKeyDown(frame, key)
|
|||||||
|
|
||||||
frame:EnableKeyboard(false)
|
frame:EnableKeyboard(false)
|
||||||
frame:EnableMouseWheel(false)
|
frame:EnableMouseWheel(false)
|
||||||
|
frame:EnableGamePadButton(false)
|
||||||
self.msgframe:Hide()
|
self.msgframe:Hide()
|
||||||
frame:UnlockHighlight()
|
frame:UnlockHighlight()
|
||||||
self.waitingForKey = nil
|
self.waitingForKey = nil
|
||||||
@@ -123,6 +122,7 @@ local methods = {
|
|||||||
self:SetDisabled(false)
|
self:SetDisabled(false)
|
||||||
self.button:EnableKeyboard(false)
|
self.button:EnableKeyboard(false)
|
||||||
self.button:EnableMouseWheel(false)
|
self.button:EnableMouseWheel(false)
|
||||||
|
self.button:EnableGamePadButton(false)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- ["OnRelease"] = nil,
|
-- ["OnRelease"] = nil,
|
||||||
@@ -188,7 +188,7 @@ local function Constructor()
|
|||||||
local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type)
|
local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type)
|
||||||
|
|
||||||
local frame = CreateFrame("Frame", nil, UIParent)
|
local frame = CreateFrame("Frame", nil, UIParent)
|
||||||
local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate2")
|
local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate")
|
||||||
|
|
||||||
button:EnableMouse(true)
|
button:EnableMouse(true)
|
||||||
button:EnableMouseWheel(false)
|
button:EnableMouseWheel(false)
|
||||||
@@ -199,10 +199,12 @@ local function Constructor()
|
|||||||
button:SetScript("OnKeyDown", Keybinding_OnKeyDown)
|
button:SetScript("OnKeyDown", Keybinding_OnKeyDown)
|
||||||
button:SetScript("OnMouseDown", Keybinding_OnMouseDown)
|
button:SetScript("OnMouseDown", Keybinding_OnMouseDown)
|
||||||
button:SetScript("OnMouseWheel", Keybinding_OnMouseWheel)
|
button:SetScript("OnMouseWheel", Keybinding_OnMouseWheel)
|
||||||
|
button:SetScript("OnGamePadButtonDown", Keybinding_OnKeyDown)
|
||||||
button:SetPoint("BOTTOMLEFT")
|
button:SetPoint("BOTTOMLEFT")
|
||||||
button:SetPoint("BOTTOMRIGHT")
|
button:SetPoint("BOTTOMRIGHT")
|
||||||
button:SetHeight(24)
|
button:SetHeight(24)
|
||||||
button:EnableKeyboard(false)
|
button:EnableKeyboard(false)
|
||||||
|
button:EnableGamePadButton(false)
|
||||||
|
|
||||||
local text = button:GetFontString()
|
local text = button:GetFontString()
|
||||||
text:SetPoint("LEFT", 7, 0)
|
text:SetPoint("LEFT", 7, 0)
|
||||||
@@ -214,7 +216,7 @@ local function Constructor()
|
|||||||
label:SetJustifyH("CENTER")
|
label:SetJustifyH("CENTER")
|
||||||
label:SetHeight(18)
|
label:SetHeight(18)
|
||||||
|
|
||||||
local msgframe = CreateFrame("Frame", nil, UIParent)
|
local msgframe = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
|
||||||
msgframe:SetHeight(30)
|
msgframe:SetHeight(30)
|
||||||
msgframe:SetBackdrop(ControlBackdrop)
|
msgframe:SetBackdrop(ControlBackdrop)
|
||||||
msgframe:SetBackdropColor(0,0,0)
|
msgframe:SetBackdropColor(0,0,0)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
Label Widget
|
Label Widget
|
||||||
Displays text and optionally an icon.
|
Displays text and optionally an icon.
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
local Type, Version = "Label", 26
|
local Type, Version = "Label", 28
|
||||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
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
|
-- WoW APIs
|
||||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
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
|
Support functions
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
@@ -129,11 +125,16 @@ local methods = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
["SetFont"] = function(self, font, height, flags)
|
["SetFont"] = function(self, font, height, flags)
|
||||||
self.label:SetFont(font, height, flags)
|
if not self.fontObject then
|
||||||
|
self.fontObject = CreateFont("AceGUI30LabelFont" .. AceGUI:GetNextWidgetNum(Type))
|
||||||
|
end
|
||||||
|
self.fontObject:SetFont(font, height, flags)
|
||||||
|
self:SetFontObject(self.fontObject)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
["SetFontObject"] = function(self, font)
|
["SetFontObject"] = function(self, font)
|
||||||
self:SetFont((font or GameFontHighlightSmall):GetFont())
|
self.label:SetFontObject(font or GameFontHighlightSmall)
|
||||||
|
UpdateImageAnchor(self)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
["SetImageSize"] = function(self, width, height)
|
["SetImageSize"] = function(self, width, height)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
local Type, Version = "MultiLineEditBox", 28
|
local Type, Version = "MultiLineEditBox", 33
|
||||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
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
|
local pairs = pairs
|
||||||
|
|
||||||
-- WoW APIs
|
-- WoW APIs
|
||||||
local GetCursorInfo, GetSpellInfo, ClearCursor = GetCursorInfo, GetSpellInfo, ClearCursor
|
local GetCursorInfo, ClearCursor = GetCursorInfo, ClearCursor
|
||||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||||
local _G = _G
|
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
|
Support functions
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
|
|
||||||
if not AceGUIMultiLineEditBoxInsertLink then
|
if not AceGUIMultiLineEditBoxInsertLink then
|
||||||
-- upgradeable hook
|
-- 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
|
end
|
||||||
|
|
||||||
function _G.AceGUIMultiLineEditBoxInsertLink(text)
|
function _G.AceGUIMultiLineEditBoxInsertLink(text)
|
||||||
@@ -104,9 +104,13 @@ local function OnMouseUp(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function OnReceiveDrag(self) -- EditBox / ScrollFrame
|
local function OnReceiveDrag(self) -- EditBox / ScrollFrame
|
||||||
local type, id, info = GetCursorInfo()
|
local type, id, info, extra = GetCursorInfo()
|
||||||
if type == "spell" then
|
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
|
elseif type ~= "item" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -145,6 +149,14 @@ local function OnVerticalScroll(self, offset)
|
|||||||
editBox:SetHitRectInsets(0, 0, offset, editBox:GetHeight() - offset - self:GetHeight())
|
editBox:SetHitRectInsets(0, 0, offset, editBox:GetHeight() - offset - self:GetHeight())
|
||||||
end
|
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)
|
local function OnShowFocus(frame)
|
||||||
frame.obj.editBox:SetFocus()
|
frame.obj.editBox:SetFocus()
|
||||||
frame:SetScript("OnShow", nil)
|
frame:SetScript("OnShow", nil)
|
||||||
@@ -257,8 +269,6 @@ local methods = {
|
|||||||
["SetCursorPosition"] = function(self, ...)
|
["SetCursorPosition"] = function(self, ...)
|
||||||
return self.editBox:SetCursorPosition(...)
|
return self.editBox:SetCursorPosition(...)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--[[-----------------------------------------------------------------------------
|
--[[-----------------------------------------------------------------------------
|
||||||
@@ -283,7 +293,7 @@ local function Constructor()
|
|||||||
label:SetText(ACCEPT)
|
label:SetText(ACCEPT)
|
||||||
label:SetHeight(10)
|
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:SetPoint("BOTTOMLEFT", 0, 4)
|
||||||
button:SetHeight(22)
|
button:SetHeight(22)
|
||||||
button:SetWidth(label:GetStringWidth() + 24)
|
button:SetWidth(label:GetStringWidth() + 24)
|
||||||
@@ -297,7 +307,7 @@ local function Constructor()
|
|||||||
text:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -5, 1)
|
text:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -5, 1)
|
||||||
text:SetJustifyV("MIDDLE")
|
text:SetJustifyV("MIDDLE")
|
||||||
|
|
||||||
local scrollBG = CreateFrame("Frame", nil, frame)
|
local scrollBG = CreateFrame("Frame", nil, frame, "BackdropTemplate")
|
||||||
scrollBG:SetBackdrop(backdrop)
|
scrollBG:SetBackdrop(backdrop)
|
||||||
scrollBG:SetBackdropColor(0, 0, 0)
|
scrollBG:SetBackdropColor(0, 0, 0)
|
||||||
scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4)
|
scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4)
|
||||||
@@ -321,6 +331,7 @@ local function Constructor()
|
|||||||
scrollFrame:SetScript("OnReceiveDrag", OnReceiveDrag)
|
scrollFrame:SetScript("OnReceiveDrag", OnReceiveDrag)
|
||||||
scrollFrame:SetScript("OnSizeChanged", OnSizeChanged)
|
scrollFrame:SetScript("OnSizeChanged", OnSizeChanged)
|
||||||
scrollFrame:HookScript("OnVerticalScroll", OnVerticalScroll)
|
scrollFrame:HookScript("OnVerticalScroll", OnVerticalScroll)
|
||||||
|
scrollFrame:HookScript("OnScrollRangeChanged", OnScrollRangeChanged)
|
||||||
|
|
||||||
local editBox = CreateFrame("EditBox", ("%s%dEdit"):format(Type, widgetNum), scrollFrame)
|
local editBox = CreateFrame("EditBox", ("%s%dEdit"):format(Type, widgetNum), scrollFrame)
|
||||||
editBox:SetAllPoints()
|
editBox:SetAllPoints()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
Slider Widget
|
Slider Widget
|
||||||
Graphical Slider, like, for Range values.
|
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)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
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 PlaySound = PlaySound
|
||||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
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
|
Support functions
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
@@ -31,13 +27,13 @@ local function UpdateText(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function UpdateLabels(self)
|
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
|
if self.ispercent then
|
||||||
self.lowtext:SetFormattedText("%s%%", (min * 100))
|
self.lowtext:SetFormattedText("%s%%", (min_value * 100))
|
||||||
self.hightext:SetFormattedText("%s%%", (max * 100))
|
self.hightext:SetFormattedText("%s%%", (max_value * 100))
|
||||||
else
|
else
|
||||||
self.lowtext:SetText(min)
|
self.lowtext:SetText(min_value)
|
||||||
self.hightext:SetText(max)
|
self.hightext:SetText(max_value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -60,6 +56,10 @@ end
|
|||||||
local function Slider_OnValueChanged(frame, newvalue)
|
local function Slider_OnValueChanged(frame, newvalue)
|
||||||
local self = frame.obj
|
local self = frame.obj
|
||||||
if not frame.setup then
|
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
|
if newvalue ~= self.value and not self.disabled then
|
||||||
self.value = newvalue
|
self.value = newvalue
|
||||||
self:Fire("OnValueChanged", newvalue)
|
self:Fire("OnValueChanged", newvalue)
|
||||||
@@ -103,7 +103,7 @@ local function EditBox_OnEnterPressed(frame)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if value then
|
if value then
|
||||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
|
||||||
self.slider:SetValue(value)
|
self.slider:SetValue(value)
|
||||||
self:Fire("OnMouseUp", value)
|
self:Fire("OnMouseUp", value)
|
||||||
end
|
end
|
||||||
@@ -171,13 +171,13 @@ local methods = {
|
|||||||
self.label:SetText(text)
|
self.label:SetText(text)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
["SetSliderValues"] = function(self, min, max, step)
|
["SetSliderValues"] = function(self, min_value, max_value, step)
|
||||||
local frame = self.slider
|
local frame = self.slider
|
||||||
frame.setup = true
|
frame.setup = true
|
||||||
self.min = min
|
self.min = min_value
|
||||||
self.max = max
|
self.max = max_value
|
||||||
self.step = step
|
self.step = step
|
||||||
frame:SetMinMaxValues(min or 0,max or 100)
|
frame:SetMinMaxValues(min_value or 0,max_value or 100)
|
||||||
UpdateLabels(self)
|
UpdateLabels(self)
|
||||||
frame:SetValueStep(step or 1)
|
frame:SetValueStep(step or 1)
|
||||||
if self.value then
|
if self.value then
|
||||||
@@ -221,7 +221,7 @@ local function Constructor()
|
|||||||
label:SetJustifyH("CENTER")
|
label:SetJustifyH("CENTER")
|
||||||
label:SetHeight(15)
|
label:SetHeight(15)
|
||||||
|
|
||||||
local slider = CreateFrame("Slider", nil, frame)
|
local slider = CreateFrame("Slider", nil, frame, "BackdropTemplate")
|
||||||
slider:SetOrientation("HORIZONTAL")
|
slider:SetOrientation("HORIZONTAL")
|
||||||
slider:SetHeight(15)
|
slider:SetHeight(15)
|
||||||
slider:SetHitRectInsets(0, 0, -10, 0)
|
slider:SetHitRectInsets(0, 0, -10, 0)
|
||||||
@@ -243,7 +243,7 @@ local function Constructor()
|
|||||||
local hightext = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
|
local hightext = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
|
||||||
hightext:SetPoint("TOPRIGHT", slider, "BOTTOMRIGHT", -2, 3)
|
hightext:SetPoint("TOPRIGHT", slider, "BOTTOMRIGHT", -2, 3)
|
||||||
|
|
||||||
local editbox = CreateFrame("EditBox", nil, frame)
|
local editbox = CreateFrame("EditBox", nil, frame, "BackdropTemplate")
|
||||||
editbox:SetAutoFocus(false)
|
editbox:SetAutoFocus(false)
|
||||||
editbox:SetFontObject(GameFontHighlightSmall)
|
editbox:SetFontObject(GameFontHighlightSmall)
|
||||||
editbox:SetPoint("TOP", slider, "BOTTOM")
|
editbox:SetPoint("TOP", slider, "BOTTOM")
|
||||||
@@ -273,6 +273,7 @@ local function Constructor()
|
|||||||
widget[method] = func
|
widget[method] = func
|
||||||
end
|
end
|
||||||
slider.obj, editbox.obj = widget, widget
|
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)
|
return AceGUI:RegisterAsWidget(widget)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
-- AceTimer supports one-shot timers and repeating timers. All timers are stored in an efficient
|
-- 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
|
-- 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.\\
|
-- 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
|
-- 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.
|
-- need to cancel the timer you just registered.
|
||||||
@@ -16,67 +17,21 @@
|
|||||||
-- @name AceTimer-3.0
|
-- @name AceTimer-3.0
|
||||||
-- @release $Id$
|
-- @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)
|
local AceTimer, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
||||||
|
|
||||||
if not AceTimer then return end -- No upgrade needed
|
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
|
AceTimer.activeTimers = AceTimer.activeTimers or {} -- Active timer list
|
||||||
local activeTimers = AceTimer.activeTimers -- Upvalue our private data
|
local activeTimers = AceTimer.activeTimers -- Upvalue our private data
|
||||||
|
|
||||||
-- Lua APIs
|
-- Lua APIs
|
||||||
local assert, loadstring, rawset, tconcat = assert, loadstring, rawset, table.concat
|
|
||||||
local type, unpack, next, error, select = type, unpack, next, error, select
|
local type, unpack, next, error, select = type, unpack, next, error, select
|
||||||
-- WoW APIs
|
-- WoW APIs
|
||||||
local GetTime = GetTime
|
local GetTime, C_TimerAfter = GetTime, C_Timer.After
|
||||||
|
|
||||||
--[[
|
|
||||||
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 function new(self, loop, func, delay, ...)
|
local function new(self, loop, func, delay, ...)
|
||||||
if delay < 0.01 then
|
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
|
end
|
||||||
|
|
||||||
local timer = {
|
local timer = {
|
||||||
@@ -85,19 +40,45 @@ local function new(self, loop, func, delay, ...)
|
|||||||
looping = loop,
|
looping = loop,
|
||||||
argsCount = select("#", ...),
|
argsCount = select("#", ...),
|
||||||
delay = delay,
|
delay = delay,
|
||||||
timeleft = delay,
|
|
||||||
ends = GetTime() + delay,
|
ends = GetTime() + delay,
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
activeTimers[timer] = timer
|
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
|
return timer
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Schedule a new one-shot timer.
|
--- Schedule a new one-shot timer.
|
||||||
-- The timer will fire once in `delay` seconds, unless canceled before.
|
-- 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 delay Delay for the timer, in seconds.
|
||||||
-- @param ... An optional, unlimited amount of arguments to pass to the callback function.
|
-- @param ... An optional, unlimited amount of arguments to pass to the callback function.
|
||||||
-- @usage
|
-- @usage
|
||||||
@@ -126,7 +107,7 @@ end
|
|||||||
|
|
||||||
--- Schedule a repeating timer.
|
--- Schedule a repeating timer.
|
||||||
-- The timer will fire every `delay` seconds, until canceled.
|
-- 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 delay Delay for the timer, in seconds.
|
||||||
-- @param ... An optional, unlimited amount of arguments to pass to the callback function.
|
-- @param ... An optional, unlimited amount of arguments to pass to the callback function.
|
||||||
-- @usage
|
-- @usage
|
||||||
@@ -191,7 +172,7 @@ end
|
|||||||
function AceTimer:TimeLeft(id)
|
function AceTimer:TimeLeft(id)
|
||||||
local timer = activeTimers[id]
|
local timer = activeTimers[id]
|
||||||
if not timer then
|
if not timer then
|
||||||
return
|
return 0
|
||||||
else
|
else
|
||||||
return timer.ends - GetTime()
|
return timer.ends - GetTime()
|
||||||
end
|
end
|
||||||
@@ -230,6 +211,7 @@ if oldminor and oldminor < 10 then
|
|||||||
elseif oldminor and oldminor < 17 then
|
elseif oldminor and oldminor < 17 then
|
||||||
-- Upgrade from old animation based timers to C_Timer.After timers.
|
-- Upgrade from old animation based timers to C_Timer.After timers.
|
||||||
AceTimer.inactiveTimers = nil
|
AceTimer.inactiveTimers = nil
|
||||||
|
AceTimer.frame = nil
|
||||||
local oldTimers = AceTimer.activeTimers
|
local oldTimers = AceTimer.activeTimers
|
||||||
-- Clear old timer table and update upvalue
|
-- Clear old timer table and update upvalue
|
||||||
AceTimer.activeTimers = {}
|
AceTimer.activeTimers = {}
|
||||||
@@ -294,34 +276,3 @@ end
|
|||||||
for addon in next, AceTimer.embeds do
|
for addon in next, AceTimer.embeds do
|
||||||
AceTimer:Embed(addon)
|
AceTimer:Embed(addon)
|
||||||
end
|
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 $ ]]
|
--[[ $Id: CallbackHandler-1.0.lua 25 2022-12-12 15:02:36Z nevcairiel $ ]]
|
||||||
local MAJOR, MINOR = "CallbackHandler-1.0", 6
|
local MAJOR, MINOR = "CallbackHandler-1.0", 8
|
||||||
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
|
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
|
||||||
|
|
||||||
if not CallbackHandler then return end -- No upgrade needed
|
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}
|
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
|
||||||
|
|
||||||
-- Lua APIs
|
-- Lua APIs
|
||||||
local tconcat = table.concat
|
local securecallfunction, error = securecallfunction, error
|
||||||
local assert, error, loadstring = assert, error, loadstring
|
local setmetatable, rawget = setmetatable, rawget
|
||||||
local setmetatable, rawset, rawget = setmetatable, rawset, rawget
|
|
||||||
local next, select, pairs, type, tostring = next, select, pairs, type, tostring
|
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 Dispatch(handlers, ...)
|
||||||
|
local index, method = next(handlers)
|
||||||
local function errorhandler(err)
|
if not method then return end
|
||||||
return geterrorhandler()(err)
|
repeat
|
||||||
|
securecallfunction(method, ...)
|
||||||
|
index, method = next(handlers, index)
|
||||||
|
until not method
|
||||||
end
|
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
|
-- CallbackHandler:New
|
||||||
--
|
--
|
||||||
@@ -65,7 +29,7 @@ end})
|
|||||||
-- UnregisterName - name of the callback unregistration API, default "UnregisterCallback"
|
-- 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.
|
-- 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"
|
RegisterName = RegisterName or "RegisterCallback"
|
||||||
UnregisterName = UnregisterName or "UnregisterCallback"
|
UnregisterName = UnregisterName or "UnregisterCallback"
|
||||||
@@ -87,19 +51,19 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll
|
|||||||
local oldrecurse = registry.recurse
|
local oldrecurse = registry.recurse
|
||||||
registry.recurse = oldrecurse + 1
|
registry.recurse = oldrecurse + 1
|
||||||
|
|
||||||
Dispatchers[select('#', ...) + 1](events[eventname], eventname, ...)
|
Dispatch(events[eventname], eventname, ...)
|
||||||
|
|
||||||
registry.recurse = oldrecurse
|
registry.recurse = oldrecurse
|
||||||
|
|
||||||
if registry.insertQueue and oldrecurse==0 then
|
if registry.insertQueue and oldrecurse==0 then
|
||||||
-- Something in one of our callbacks wanted to register more callbacks; they got queued
|
-- Something in one of our callbacks wanted to register more callbacks; they got queued
|
||||||
for eventname,callbacks in pairs(registry.insertQueue) do
|
for event,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.
|
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 self,func in pairs(callbacks) do
|
for object,func in pairs(callbacks) do
|
||||||
events[eventname][self] = func
|
events[event][object] = func
|
||||||
-- fire OnUsed callback?
|
-- fire OnUsed callback?
|
||||||
if first and registry.OnUsed then
|
if first and registry.OnUsed then
|
||||||
registry.OnUsed(registry, target, eventname)
|
registry.OnUsed(registry, target, event)
|
||||||
first = nil
|
first = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -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/wiki/LibStub for more info
|
||||||
-- 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 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_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
|
||||||
local LibStub = _G[LIBSTUB_MAJOR]
|
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
|
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
|
||||||
LibStub = LibStub or {libs = {}, minors = {} }
|
LibStub = LibStub or {libs = {}, minors = {} }
|
||||||
_G[LIBSTUB_MAJOR] = LibStub
|
_G[LIBSTUB_MAJOR] = LibStub
|
||||||
LibStub.minor = LIBSTUB_MINOR
|
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)
|
function LibStub:NewLibrary(major, minor)
|
||||||
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
|
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]
|
local oldminor = self.minors[major]
|
||||||
if oldminor and oldminor >= minor then return nil end
|
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
|
return self.libs[major], oldminor
|
||||||
end
|
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)
|
function LibStub:GetLibrary(major, silent)
|
||||||
if not self.libs[major] and not silent then
|
if not self.libs[major] and not silent then
|
||||||
error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
|
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]
|
return self.libs[major], self.minors[major]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- LibStub:IterateLibraries()
|
function LibStub:IterateLibraries() return pairs(self.libs) end
|
||||||
--
|
|
||||||
-- Returns an iterator for the currently registered libraries
|
|
||||||
function LibStub:IterateLibraries()
|
|
||||||
return pairs(self.libs)
|
|
||||||
end
|
|
||||||
|
|
||||||
setmetatable(LibStub, { __call = LibStub.GetLibrary })
|
setmetatable(LibStub, { __call = LibStub.GetLibrary })
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
## Interface: 80000
|
|
||||||
## Title: Lib: LibStub
|
|
||||||
## Notes: Universal Library Stub
|
|
||||||
## Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel
|
|
||||||
## X-Website: http://www.wowace.com/addons/libstub/
|
|
||||||
## X-Category: Library
|
|
||||||
## X-License: Public Domain
|
|
||||||
|
|
||||||
LibStub.lua
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
debugstack = debug.traceback
|
|
||||||
strmatch = string.match
|
|
||||||
|
|
||||||
loadfile("../LibStub.lua")()
|
|
||||||
|
|
||||||
local lib, oldMinor = LibStub:NewLibrary("Pants", 1) -- make a new thingy
|
|
||||||
assert(lib) -- should return the library table
|
|
||||||
assert(not oldMinor) -- should not return the old minor, since it didn't exist
|
|
||||||
|
|
||||||
-- the following is to create data and then be able to check if the same data exists after the fact
|
|
||||||
function lib:MyMethod()
|
|
||||||
end
|
|
||||||
local MyMethod = lib.MyMethod
|
|
||||||
lib.MyTable = {}
|
|
||||||
local MyTable = lib.MyTable
|
|
||||||
|
|
||||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 1) -- try to register a library with the same version, should silently fail
|
|
||||||
assert(not newLib) -- should not return since out of date
|
|
||||||
|
|
||||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 0) -- try to register a library with a previous, should silently fail
|
|
||||||
assert(not newLib) -- should not return since out of date
|
|
||||||
|
|
||||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 2) -- register a new version
|
|
||||||
assert(newLib) -- library table
|
|
||||||
assert(rawequal(newLib, lib)) -- should be the same reference as the previous
|
|
||||||
assert(newOldMinor == 1) -- should return the minor version of the previous version
|
|
||||||
|
|
||||||
assert(rawequal(lib.MyMethod, MyMethod)) -- verify that values were saved
|
|
||||||
assert(rawequal(lib.MyTable, MyTable)) -- verify that values were saved
|
|
||||||
|
|
||||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", "Blah 3 Blah") -- register a new version with a string minor version (instead of a number)
|
|
||||||
assert(newLib) -- library table
|
|
||||||
assert(newOldMinor == 2) -- previous version was 2
|
|
||||||
|
|
||||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", "Blah 4 and please ignore 15 Blah") -- register a new version with a string minor version (instead of a number)
|
|
||||||
assert(newLib)
|
|
||||||
assert(newOldMinor == 3) -- previous version was 3 (even though it gave a string)
|
|
||||||
|
|
||||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 5) -- register a new library, using a normal number instead of a string
|
|
||||||
assert(newLib)
|
|
||||||
assert(newOldMinor == 4) -- previous version was 4 (even though it gave a string)
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
debugstack = debug.traceback
|
|
||||||
strmatch = string.match
|
|
||||||
|
|
||||||
loadfile("../LibStub.lua")()
|
|
||||||
|
|
||||||
for major, library in LibStub:IterateLibraries() do
|
|
||||||
-- check that MyLib doesn't exist yet, by iterating through all the libraries
|
|
||||||
assert(major ~= "MyLib")
|
|
||||||
end
|
|
||||||
|
|
||||||
assert(not LibStub:GetLibrary("MyLib", true)) -- check that MyLib doesn't exist yet by direct checking
|
|
||||||
assert(not pcall(LibStub.GetLibrary, LibStub, "MyLib")) -- don't silently fail, thus it should raise an error.
|
|
||||||
local lib = LibStub:NewLibrary("MyLib", 1) -- create the lib
|
|
||||||
assert(lib) -- check it exists
|
|
||||||
assert(rawequal(LibStub:GetLibrary("MyLib"), lib)) -- verify that :GetLibrary("MyLib") properly equals the lib reference
|
|
||||||
|
|
||||||
assert(LibStub:NewLibrary("MyLib", 2)) -- create a new version
|
|
||||||
|
|
||||||
local count=0
|
|
||||||
for major, library in LibStub:IterateLibraries() do
|
|
||||||
-- check that MyLib exists somewhere in the libraries, by iterating through all the libraries
|
|
||||||
if major == "MyLib" then -- we found it!
|
|
||||||
count = count +1
|
|
||||||
assert(rawequal(library, lib)) -- verify that the references are equal
|
|
||||||
end
|
|
||||||
end
|
|
||||||
assert(count == 1) -- verify that we actually found it, and only once
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
debugstack = debug.traceback
|
|
||||||
strmatch = string.match
|
|
||||||
|
|
||||||
loadfile("../LibStub.lua")()
|
|
||||||
|
|
||||||
local proxy = newproxy() -- non-string
|
|
||||||
|
|
||||||
assert(not pcall(LibStub.NewLibrary, LibStub, proxy, 1)) -- should error, proxy is not a string, it's userdata
|
|
||||||
local success, ret = pcall(LibStub.GetLibrary, proxy, true)
|
|
||||||
assert(not success or not ret) -- either error because proxy is not a string or because it's not actually registered.
|
|
||||||
|
|
||||||
assert(not pcall(LibStub.NewLibrary, LibStub, "Something", "No number in here")) -- should error, minor has no string in it.
|
|
||||||
|
|
||||||
assert(not LibStub:GetLibrary("Something", true)) -- shouldn't've created it from the above statement
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
debugstack = debug.traceback
|
|
||||||
strmatch = string.match
|
|
||||||
|
|
||||||
loadfile("../LibStub.lua")()
|
|
||||||
|
|
||||||
|
|
||||||
-- Pretend like loaded libstub is old and doesn't have :IterateLibraries
|
|
||||||
assert(LibStub.minor)
|
|
||||||
LibStub.minor = LibStub.minor - 0.0001
|
|
||||||
LibStub.IterateLibraries = nil
|
|
||||||
|
|
||||||
loadfile("../LibStub.lua")()
|
|
||||||
|
|
||||||
assert(type(LibStub.IterateLibraries)=="function")
|
|
||||||
|
|
||||||
|
|
||||||
-- Now pretend that we're the same version -- :IterateLibraries should NOT be re-created
|
|
||||||
LibStub.IterateLibraries = 123
|
|
||||||
|
|
||||||
loadfile("../LibStub.lua")()
|
|
||||||
|
|
||||||
assert(LibStub.IterateLibraries == 123)
|
|
||||||
|
|
||||||
|
|
||||||
-- Now pretend that a newer version is loaded -- :IterateLibraries should NOT be re-created
|
|
||||||
LibStub.minor = LibStub.minor + 0.0001
|
|
||||||
|
|
||||||
loadfile("../LibStub.lua")()
|
|
||||||
|
|
||||||
assert(LibStub.IterateLibraries == 123)
|
|
||||||
|
|
||||||
|
|
||||||
-- Again with a huge number
|
|
||||||
LibStub.minor = LibStub.minor + 1234567890
|
|
||||||
|
|
||||||
loadfile("../LibStub.lua")()
|
|
||||||
|
|
||||||
assert(LibStub.IterateLibraries == 123)
|
|
||||||
|
|
||||||
|
|
||||||
print("OK")
|
|
||||||
Reference in New Issue
Block a user