Skip to content

Commit

Permalink
updated ace3
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuller committed May 30, 2011
1 parent 5764cc2 commit 50901b5
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 39 deletions.
36 changes: 26 additions & 10 deletions libs/AceAddon-3.0/AceAddon-3.0.lua
Expand Up @@ -28,9 +28,9 @@
-- end
-- @class file
-- @name AceAddon-3.0.lua
-- @release $Id: AceAddon-3.0.lua 895 2009-12-06 16:28:55Z nevcairiel $
-- @release $Id: AceAddon-3.0.lua 980 2010-10-27 14:20:11Z nevcairiel $

local MAJOR, MINOR = "AceAddon-3.0", 5
local MAJOR, MINOR = "AceAddon-3.0", 10
local AceAddon, oldminor = LibStub:NewLibrary(MAJOR, MINOR)

if not AceAddon then return end -- No Upgrade needed.
Expand Down Expand Up @@ -153,6 +153,7 @@ function AceAddon:NewAddon(objectorname, ...)
setmetatable( object, addonmeta )
self.addons[name] = object
object.modules = {}
object.orderedModules = {}
object.defaultModuleLibraries = {}
Embed( object ) -- embed NewModule, GetModule methods
self:EmbedLibraries(object, select(i,...))
Expand Down Expand Up @@ -285,6 +286,7 @@ function NewModule(self, name, prototype, ...)

safecall(self.OnModuleCreated, self, module) -- Was in Ace2 and I think it could be a cool thing to have handy.
self.modules[name] = module
tinsert(self.orderedModules, module)

return module
end
Expand Down Expand Up @@ -489,12 +491,14 @@ local pmixins = {
-- target (object) - target object to embed aceaddon in
--
-- 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
target[k] = v
end
for k, v in pairs(pmixins) do
target[k] = target[k] or v
if not skipPMixins then
for k, v in pairs(pmixins) do
target[k] = target[k] or v
end
end
end

Expand Down Expand Up @@ -547,8 +551,9 @@ function AceAddon:EnableAddon(addon)
end

-- enable possible modules.
for name, module in pairs(addon.modules) do
self:EnableAddon(module)
local modules = addon.orderedModules
for i = 1, #modules do
self:EnableAddon(modules[i])
end
end
return self.statuses[addon.name] -- return true if we're disabled
Expand Down Expand Up @@ -580,8 +585,9 @@ function AceAddon:DisableAddon(addon)
if lib then safecall(lib.OnEmbedDisable, lib, addon) end
end
-- disable possible modules.
for name, module in pairs(addon.modules) do
self:DisableAddon(module)
local modules = addon.orderedModules
for i = 1, #modules do
self:DisableAddon(modules[i])
end
end

Expand Down Expand Up @@ -638,5 +644,15 @@ AceAddon.frame:SetScript("OnEvent", onEvent)

-- upgrade embeded
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
6 changes: 3 additions & 3 deletions libs/AceEvent-3.0/AceEvent-3.0.lua
Expand Up @@ -9,7 +9,7 @@
-- make into AceEvent.
-- @class file
-- @name AceEvent-3.0
-- @release $Id: AceEvent-3.0.lua 877 2009-11-02 15:56:50Z nevcairiel $
-- @release $Id: AceEvent-3.0.lua 975 2010-10-23 11:26:18Z nevcairiel $
local MAJOR, MINOR = "AceEvent-3.0", 3
local AceEvent = LibStub:NewLibrary(MAJOR, MINOR)

Expand Down Expand Up @@ -55,7 +55,7 @@ local mixins = {
}

--- Register for a Blizzard Event.
-- The callback will always be called with the event as the first argument, and if supplied, the `arg` as second argument.
-- The callback will be called with the optional `arg` as the first argument (if supplied), and the event name as the second (or first, if no arg was supplied)
-- Any arguments to the event will be passed on after that.
-- @name AceEvent:RegisterEvent
-- @class function
Expand All @@ -71,7 +71,7 @@ local mixins = {
-- @param event The event to unregister

--- Register for a custom AceEvent-internal message.
-- The callback will always be called with the event as the first argument, and if supplied, the `arg` as second argument.
-- The callback will be called with the optional `arg` as the first argument (if supplied), and the event name as the second (or first, if no arg was supplied)
-- Any arguments to the event will be passed on after that.
-- @name AceEvent:RegisterMessage
-- @class function
Expand Down
33 changes: 17 additions & 16 deletions libs/AceLocale-3.0/AceLocale-3.0.lua
@@ -1,8 +1,8 @@
--- **AceLocale-3.0** manages localization in addons, allowing for multiple locale to be registered with fallback to the base locale for untranslated strings.
-- @class file
-- @name AceLocale-3.0
-- @release $Id: AceLocale-3.0.lua 895 2009-12-06 16:28:55Z nevcairiel $
local MAJOR,MINOR = "AceLocale-3.0", 2
-- @release $Id: AceLocale-3.0.lua 1005 2011-01-29 14:19:43Z mikk $
local MAJOR,MINOR = "AceLocale-3.0", 5

local AceLocale, oldminor = LibStub:NewLibrary(MAJOR, MINOR)

Expand Down Expand Up @@ -79,7 +79,7 @@ local writedefaultproxy = setmetatable({}, {
-- @param application Unique name of addon / module
-- @param locale Name of the locale to register, e.g. "enUS", "deDE", etc.
-- @param isDefault If this is the default locale being registered (your addon is written in this language, generally enUS)
-- @param silent If true, the locale will not issue warnings for missing keys. Can only be set on the default locale.
-- @param silent If true, the locale will not issue warnings for missing keys. Must be set on the first locale registered. If set to "raw", nils will be returned for unknown keys (no metatable used).
-- @usage
-- -- enUS.lua
-- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "enUS", true)
Expand All @@ -92,28 +92,29 @@ local writedefaultproxy = setmetatable({}, {
-- @return Locale Table to add localizations to, or nil if the current locale is not required.
function AceLocale:NewLocale(application, locale, isDefault, silent)

if silent and not isDefault then
error("Usage: NewLocale(application, locale[, isDefault[, silent]]): 'silent' can only be specified for the default locale", 2)
end

-- GAME_LOCALE allows translators to test translations of addons without having that wow client installed
-- Ammo: I still think this is a bad idea, for instance an addon that checks for some ingame string will fail, just because some other addon
-- gives the user the illusion that they can run in a different locale? Ditch this whole thing or allow a setting per 'application'. I'm of the
-- opinion to remove this.
local gameLocale = GAME_LOCALE or gameLocale

if locale ~= gameLocale and not isDefault then
return -- nop, we don't need these translations
end

local app = AceLocale.apps[application]

if silent and app then
geterrorhandler()("Usage: NewLocale(application, locale[, isDefault[, silent]]): 'silent' must be specified for the first locale registered")
end

if not app then
app = setmetatable({}, silent and readmetasilent or readmeta)
if silent=="raw" then
app = {}
else
app = setmetatable({}, silent and readmetasilent or readmeta)
end
AceLocale.apps[application] = app
AceLocale.appnames[app] = application
end


if locale ~= gameLocale and not isDefault then
return -- nop, we don't need these translations
end

registering = app -- remember globally for writeproxy and writedefaultproxy

if isDefault then
Expand Down
1 change: 0 additions & 1 deletion libs/LibStub/.pkgmeta

This file was deleted.

9 changes: 0 additions & 9 deletions libs/LibStub/LibStub.toc

This file was deleted.

0 comments on commit 50901b5

Please sign in to comment.