/trunk/FuBar_RecapFu/libs/AceAddon-2.0
## Interface: 30000 |
## X-Curse-Packaged-Version: r1096 |
## X-Curse-Project-Name: Ace2 |
## X-Curse-Project-ID: ace2 |
## X-Curse-Repository-ID: wow/ace2/mainline |
## Title: Lib: AceAddon-2.0 |
## Notes: AddOn development framework |
## Author: Ace Development Team |
## LoadOnDemand: 1 |
## X-Website: http://www.wowace.com |
## X-Category: Library |
## X-License: LGPL v2.1 + MIT for AceOO-2.0 |
## Dependencies: AceLibrary, AceOO-2.0 |
AceAddon-2.0.lua |
--[[ |
--[[ |
Name: AceAddon-2.0 |
Revision: $Rev: 28672 $ |
Revision: $Rev: 1096 $ |
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team) |
Inspired By: Ace 1.x by Turan (turan@gryphon.com) |
Website: http://www.wowace.com/ |
]] |
local MAJOR_VERSION = "AceAddon-2.0" |
local MINOR_VERSION = "$Revision: 28672 $" |
local MINOR_VERSION = 90000 + tonumber(("$Revision: 1096 $"):match("(%d+)")) |
-- This ensures the code is only executed if the libary doesn't already exist, or is a newer version |
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary.") end |
if not success then geterrorhandler()(err:find("%.lua:%d+:") and err or (debugstack():match("\n(.-: )in.-\n") or "") .. err) end |
end |
-- Localization |
local STANDBY, TITLE, NOTES, VERSION, AUTHOR, DATE, CATEGORY, EMAIL, CREDITS, WEBSITE, CATEGORIES, ABOUT, LICENSE, PRINT_ADDON_INFO |
local STANDBY, TITLE, NOTES, VERSION, AUTHOR, DATE, CATEGORY, EMAIL, CREDITS, WEBSITE, CATEGORIES, ABOUT, LICENSE, PRINT_ADDON_INFO, DONATE, DONATE_DESC, HOWTO_DONATE_WINDOWS, HOWTO_DONATE_MAC |
if GetLocale() == "deDE" then |
STANDBY = "|cffff5050(Standby)|r" -- capitalized |
ABOUT = "Ãber" |
PRINT_ADDON_INFO = "Gibt Addondaten aus" |
DONATE = "Donate" -- fix |
DONATE_DESC = "Give a much-needed donation to the author of this addon." -- fix |
HOWTO_DONATE_WINDOWS = "Press Ctrl-A to select the link, then Ctrl-C to copy, then Alt-Tab out of the game, open your favorite web browser, and paste the link into the address bar." -- fix |
HOWTO_DONATE_MAC = "Press Cmd-A to select the link, then Cmd-C to copy, then Cmd-Tab out of the game, open your favorite web browser, and paste the link into the address bar." -- fix |
CATEGORIES = { |
["Action Bars"] = "Aktionsleisten", |
} |
elseif GetLocale() == "frFR" then |
STANDBY = "|cffff5050(attente)|r" |
TITLE = "Titre" |
NOTES = "Notes" |
VERSION = "Version" |
WEBSITE = "Site web" |
CREDITS = "Credits" -- fix |
LICENSE = "License" -- fix |
ABOUT = "A propos" |
PRINT_ADDON_INFO = "Afficher les informations sur l'addon" |
DONATE = "Donate" -- fix |
DONATE_DESC = "Give a much-needed donation to the author of this addon." -- fix |
HOWTO_DONATE_WINDOWS = "Press Ctrl-A to select the link, then Ctrl-C to copy, then Alt-Tab out of the game, open your favorite web browser, and paste the link into the address bar." -- fix |
HOWTO_DONATE_MAC = "Press Cmd-A to select the link, then Cmd-C to copy, then Cmd-Tab out of the game, open your favorite web browser, and paste the link into the address bar." -- fix |
CATEGORIES = { |
["Action Bars"] = "Barres d'action", |
["Auction"] = "Hôtel des ventes", |
} |
elseif GetLocale() == "koKR" then |
STANDBY = "|cffff5050(ì¬ì©ê°ë¥)|r" |
TITLE = "ì 목" |
NOTES = "ë ¸í¸" |
VERSION = "ë²ì " |
AUTHOR = "ì ìì" |
DATE = "ë ì§" |
CATEGORY = "ë¶ë¥" |
EMAIL = "E-mail" |
WEBSITE = "ì¹ì¬ì´í¸" |
CREDITS = "Credits" -- fix |
LICENSE = "License" -- fix |
EMAIL = "ì ì ì°í¸" |
WEBSITE = "ì¹ ì¬ì´í¸" |
CREDITS = "ê³µë¡ì" |
LICENSE = "ë¼ì´ì¼ì¤" |
ABOUT = "ì ë³´" |
PRINT_ADDON_INFO = "ì ëì¨ ì ë³´ ì¶ë ¥" |
PRINT_ADDON_INFO = "ì ëì¨ì ëí ì 보를 ì¶ë ¥í©ëë¤." |
DONATE = "기ë¶" |
DONATE_DESC = "ì´ ì ëì¨ì ì ìììê² ê¸°ë¶ë¥¼ í©ëë¤." |
HOWTO_DONATE_WINDOWS = "Ctrl-A를 ëë ¤ ë§í¬ë¥¼ ì íí, Ctrl-Cë¡ ë³µì¬í©ëë¤. Alt-Tab ëë ¤ ê²ìì¼ë¡ ë¶í° ëê°í ì¹ ë¸ë¼ì°ì 를 ì½ëë¤. ë³µì¬ë ë§í¬ë¥¼ 주ì ì°½ì ë¶ì¬ë£ê¸° í©ëë¤." |
HOWTO_DONATE_MAC = "Cmd-A를 ëë ¤ ë§í¬ë¥¼ ì íí, Cmd-Cë¡ ë³µì¬í©ëë¤. Cmd-Tab ëë ¤ ê²ìì¼ë¡ ë¶í° ëê°í ì¹ ë¸ë¼ì°ì 를 ì½ëë¤. ë³µì¬ë ë§í¬ë¥¼ 주ì ì°½ì ë¶ì¬ë£ê¸° í©ëë¤." |
CATEGORIES = { |
["Action Bars"] = "ì¡ì ë°", |
["Auction"] = "경매", |
} |
elseif GetLocale() == "zhTW" then |
STANDBY = "|cffff5050(å¾ å½)|r" |
TITLE = "æ¨é¡" |
NOTES = "註è¨" |
VERSION = "çæ¬" |
AUTHOR = "ä½è " |
DATE = "æ¥æ" |
CATEGORY = "é¡å¥" |
EMAIL = "E-mail" |
EMAIL = "é»åéµä»¶" |
WEBSITE = "網ç«" |
CREDITS = "Credits" -- fix |
LICENSE = "License" -- fix |
CREDITS = "ç¹å¥æè¬" |
LICENSE = "çæ¬" |
ABOUT = "éæ¼" |
PRINT_ADDON_INFO = "顯示æ件è³è¨" |
PRINT_ADDON_INFO = "顯示æ件è³è¨ã" |
DONATE = "æè´" |
DONATE_DESC = "æè´éé¢çµ¦æ件ä½è ã" |
HOWTO_DONATE_WINDOWS = "è«æCtrl-Aé¸æ網ç«é£çµï¼Ctrl-Cè¤è£½ç¶²åï¼Alt-Tabåæå°é»è ¦æ¡é¢ï¼æéç覽å¨ï¼å¨ç¶²ååè²¼ä¸ç¶²åã" |
HOWTO_DONATE_MAC = "è«æCmd-Aé¸æ網ç«é£çµï¼Cmd-Cè¤è£½ç¶²åï¼Cmd-Tabåæå°é»è ¦æ¡é¢ï¼æéç覽å¨ï¼å¨ç¶²ååè²¼ä¸ç¶²åã" |
CATEGORIES = { |
["Action Bars"] = "åä½å", |
["Action Bars"] = "åä½æ¢", |
["Auction"] = "æè³£", |
["Audio"] = "é³æ¨", |
["Audio"] = "é³æ", |
["Battlegrounds/PvP"] = "æ°å ´/PvP", |
["Buffs"] = "å¢ç", |
["Chat/Communication"] = "è天/éè¨", |
["Tank"] = "å¦å ", |
["Caster"] = "æ½æ³è ", |
["Combat"] = "æ°é¬¥", |
["Compilations"] = "編輯", |
["Compilations"] = "æ´å", |
["Data Export"] = "è³æå¯åº", |
["Development Tools"] = "éç¼å·¥å ·", |
["Guild"] = "å ¬æ", |
["Frame Modification"] = "æ¡æ¶ä¿®æ¹", |
["Interface Enhancements"] = "ä»é¢å¢å¼·", |
["Inventory"] = "èå ", |
["Library"] = "è³æ庫", |
["Inventory"] = "庫å", |
["Library"] = "ç¨å¼åº«", |
["Map"] = "å°å", |
["Mail"] = "éµä»¶", |
["Miscellaneous"] = "ç¶å", |
["Miscellaneous"] = "éé ", |
["Quest"] = "ä»»å", |
["Raid"] = "åé", |
["Tradeskill"] = "åæ¥æè½", |
["Tradeskill"] = "交ææè½", |
["UnitFrame"] = "å®ä½æ¡æ¶", |
} |
elseif GetLocale() == "zhCN" then |
STANDBY = "|cffff5050(ææ)|r" |
TITLE = "æ é¢" |
NOTES = "é注" |
VERSION = "çæ¬" |
WEBSITE = "ç½ç«" |
CREDITS = "Credits" -- fix |
LICENSE = "License" -- fix |
ABOUT = "å ³äº" |
PRINT_ADDON_INFO = "å°ååºæ件信æ¯" |
DONATE = "Donate" -- fix |
DONATE_DESC = "Give a much-needed donation to the author of this addon." -- fix |
HOWTO_DONATE_WINDOWS = "Press Ctrl-A to select the link, then Ctrl-C to copy, then Alt-Tab out of the game, open your favorite web browser, and paste the link into the address bar." -- fix |
HOWTO_DONATE_MAC = "Press Cmd-A to select the link, then Cmd-C to copy, then Cmd-Tab out of the game, open your favorite web browser, and paste the link into the address bar." -- fix |
CATEGORIES = { |
["Action Bars"] = "å¨ä½æ¡", |
["Auction"] = "æå", |
["Shaman"] = "è¨æ»¡ç¥å¸", |
["Warlock"] = "æ¯å£«", |
["Warrior"] = "æ士", |
-- ["Healer"] = "æ²»çä¿é", |
-- ["Tank"] = "è¿ææ§å¶", |
-- ["Caster"] = "è¿ç¨è¾åº", |
["Healer"] = "Healer", |
["Tank"] = "Tank", |
["Caster"] = "Caster", |
["Combat"] = "ææ", |
["Compilations"] = "ç¼è¯", |
["Data Export"] = "æ°æ®å¯¼åº", |
} |
elseif GetLocale() == "esES" then |
STANDBY = "|cffff5050(espera)|r" |
TITLE = "TÃtulo" |
NOTES = "Notas" |
VERSION = "Versión" |
WEBSITE = "Web" |
CREDITS = "Créditos" |
LICENSE = "License" -- fix |
ABOUT = "Acerca de" |
PRINT_ADDON_INFO = "Muestra información acerca del accesorio." |
DONATE = "Donate" -- fix |
DONATE_DESC = "Give a much-needed donation to the author of this addon." -- fix |
HOWTO_DONATE_WINDOWS = "Press Ctrl-A to select the link, then Ctrl-C to copy, then Alt-Tab out of the game, open your favorite web browser, and paste the link into the address bar." -- fix |
HOWTO_DONATE_MAC = "Press Cmd-A to select the link, then Cmd-C to copy, then Cmd-Tab out of the game, open your favorite web browser, and paste the link into the address bar." -- fix |
CATEGORIES = { |
["Action Bars"] = "Barras de Acción", |
["Auction"] = "Subasta", |
["Tradeskill"] = "Habilidad de Comercio", |
["UnitFrame"] = "Marco de Unidades", |
} |
elseif GetLocale() == "ruRU" then |
STANDBY = "|cffff5050(в Ñежиме ожиданиÑ)|r" |
TITLE = "Ðазвание" |
NOTES = "ÐпиÑание" |
VERSION = "ÐеÑÑиÑ" |
AUTHOR = "ÐвÑоÑ" |
DATE = "ÐаÑа" |
CATEGORY = "ÐаÑегоÑиÑ" |
EMAIL = "E-mail" |
WEBSITE = "СайÑ" |
CREDITS = "ТиÑÑÑ" |
LICENSE = "ÐиÑензиÑ" |
ABOUT = "Ðб аддоне" |
PRINT_ADDON_INFO = "ÐоказаÑÑ Ð¸Ð½ÑоÑмаÑÐ¸Ñ Ð¾Ð± аддоне." |
DONATE = "ÐожеÑÑвоваÑÑ" |
DONATE_DESC = "ÐÑблагодаÑиÑÑ Ð°Ð²ÑоÑа за ÑазÑабоÑÐºÑ Ð°Ð´Ð´Ð¾Ð½Ð°." |
HOWTO_DONATE_WINDOWS = "ÐÐ»Ñ Ð²ÑÐ´ÐµÐ»ÐµÐ½Ð¸Ñ Ð²Ñей ÑÑÑлки нажмиÑе Ctrl-A, поÑом Ð´Ð»Ñ ÐµÑ ÐºÐ¾Ð¿Ð¸ÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ctrl-C, ÑÑÐ¾Ð±Ñ ÑвеÑнÑÑÑ Ð¸Ð³ÑÑ - Alt-Tab, оÑкÑойÑе Ð²Ð°Ñ Ð±ÑаÑÐ·ÐµÑ Ð¸ вÑÑавÑÑе ÑÑÑÐ»ÐºÑ Ð² адÑеÑнÑÑ ÑÑÑÐ¾ÐºÑ - Ctrl-V" |
HOWTO_DONATE_MAC = "ÐÐ»Ñ Ð²ÑÐ´ÐµÐ»ÐµÐ½Ð¸Ñ Ð²Ñей ÑÑÑлки нажмиÑе Cmd-A, поÑом Ð´Ð»Ñ ÐµÑ ÐºÐ¾Ð¿Ð¸ÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ctrl-C, ÑÑÐ¾Ð±Ñ ÑвеÑнÑÑÑ Ð¸Ð³ÑÑ - Cmd-Tab, оÑкÑойÑе Ð²Ð°Ñ Ð±ÑаÑÐ·ÐµÑ Ð¸ вÑÑавÑÑе ÑÑÑÐ»ÐºÑ Ð² адÑеÑнÑÑ ÑÑÑÐ¾ÐºÑ Cmd-V" |
CATEGORIES = { |
["Action Bars"] = "Ðанели команд", |
["Auction"] = "ÐÑкÑион", |
["Audio"] = "ÐÑдио", |
["Battlegrounds/PvP"] = "ÐÐ¾Ð»Ñ ÑÑажений/PvP", |
["Buffs"] = "ÐаÑÑÑ", |
["Chat/Communication"] = "ЧаÑ/ÐоммÑникаÑиÑ", |
["Druid"] = "ÐÑÑид", |
["Hunter"] = "ÐÑ Ð¾Ñник", |
["Mage"] = "Ðаг", |
["Paladin"] = "Ðаладин", |
["Priest"] = "ÐÑеÑ", |
["Rogue"] = "Разбойник", |
["Shaman"] = "Шаман", |
["Warlock"] = "ЧеÑнокнижник", |
["Warrior"] = "Ðоин", |
["Healer"] = "ÐекаÑÑ", |
["Tank"] = "Танк", |
["Caster"] = "ÐаÑÑеÑ", |
["Combat"] = "СÑажениÑ", |
["Compilations"] = "ÐомпилÑÑиÑ", |
["Data Export"] = "ÐкÑпоÑÑ Ð´Ð°Ð½Ð½ÑÑ ", |
["Development Tools"] = "ÐнÑÑÑÑменÑÑ ÑазÑабоÑÑика", |
["Guild"] = "ÐилÑдиÑ", |
["Frame Modification"] = "ÐодиÑикаÑÐ¸Ñ ÑÑеймов", |
["Interface Enhancements"] = "УлÑÑÑение инÑеÑÑейÑа", |
["Inventory"] = "ÐнвенÑаÑÑ", |
["Library"] = "ÐиблиоÑеки", |
["Map"] = "ÐаÑÑа", |
["Mail"] = "ÐоÑÑа", |
["Miscellaneous"] = "Разное", |
["Quest"] = "ÐаданиÑ", |
["Raid"] = "Рейд", |
["Tradeskill"] = "УмениÑ", |
["UnitFrame"] = "ФÑÐµÐ¹Ð¼Ñ Ð¿ÐµÑÑонажей", |
} |
else -- enUS |
STANDBY = "|cffff5050(standby)|r" |
TITLE = "Title" |
NOTES = "Notes" |
VERSION = "Version" |
WEBSITE = "Website" |
CREDITS = "Credits" |
LICENSE = "License" |
ABOUT = "About" |
PRINT_ADDON_INFO = "Show information about the addon." |
DONATE = "Donate" |
DONATE_DESC = "Give a much-needed donation to the author of this addon." |
HOWTO_DONATE_WINDOWS = "Press Ctrl-A to select the link, then Ctrl-C to copy, then Alt-Tab out of the game, open your favorite web browser, and paste the link into the address bar." |
HOWTO_DONATE_MAC = "Press Cmd-A to select the link, then Cmd-C to copy, then Cmd-Tab out of the game, open your favorite web browser, and paste the link into the address bar." |
CATEGORIES = { |
["Action Bars"] = "Action Bars", |
["Auction"] = "Auction", |
local lowerKey = key:lower() |
for k,v in pairs(CATEGORIES) do |
if k:lower() == lowerKey then |
self[lowerKey] = v |
return v |
end |
end |
if AceAddon.playerLoginFired then |
AceAddon.addonsStarted[self] = true |
if (type(self.IsActive) ~= "function" or self:IsActive()) and (not AceModuleCore or not AceModuleCore:IsModule(self) or AceModuleCore:IsModuleActive(self)) then |
AceAddon.addonsEnabled[self] = true |
local current = self.class |
while true do |
if current == AceOO.Class or not current then |
break |
end |
if current.mixins then |
for mixin in pairs(current.mixins) do |
if type(mixin.OnEmbedEnable) == "function" then |
safecall(mixin.OnEmbedEnable,mixin,self,true) |
end |
end |
end |
current = current.super |
end |
if type(self.OnEnable) == "function" then |
safecall(self.OnEnable,self,true) |
end |
if AceEvent then |
AceEvent:TriggerEvent("Ace2_AddonEnabled", self, true) |
end |
AceAddon:ManualEnable(self) |
end |
else |
if not AceAddon.addonsToOnEnable then |
end |
if addon.version == nil then |
addon.version = GetAddOnMetadata(name, "Version") |
end |
end |
if type(addon.version) == "string" then |
if addon.version:find("%$Revision: (%d+) %$") then |
addon.version = addon.version:gsub("%$Revision: (%d+) %$", "%1") |
if type(addon.credits) == "string" then |
addon.credits = addon.credits:trim() |
end |
if addon.donate == nil then |
addon.donate = GetAddOnMetadata(name, "X-Donate") |
end |
if type(addon.donate) == "string" then |
addon.donate = addon.donate:trim() |
end |
if addon.date == nil then |
addon.date = GetAddOnMetadata(name, "X-Date") or GetAddOnMetadata(name, "X-ReleaseDate") |
end |
current = current.super |
end |
local n = AceAddon.addonsToOnEnable and #AceAddon.addonsToOnEnable or 0 |
if type(addon.OnInitialize) == "function" then |
safecall(addon.OnInitialize, addon, name) |
end |
end |
end |
local aboutFrame |
local function createAboutFrame() |
aboutFrame = CreateFrame("Frame", "AceAddon20AboutFrame", UIParent, "DialogBoxFrame") |
aboutFrame:SetWidth(500) |
aboutFrame:SetHeight(400) |
aboutFrame:SetPoint("CENTER") |
aboutFrame:SetBackdrop({ |
bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], |
edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], |
tile = true, tileSize = 16, edgeSize = 16, |
insets = { left = 5, right = 5, top = 5, bottom = 5 } |
}) |
aboutFrame:SetBackdropColor(0,0,0,1) |
local donateButton = CreateFrame("Button", "AceAddon20AboutFrameDonateButton", aboutFrame, "UIPanelButtonTemplate2") |
aboutFrame.donateButton = donateButton |
donateButton:SetPoint("BOTTOMRIGHT", -20, 20) |
_G.AceAddon20AboutFrameDonateButtonText:SetText(DONATE) |
donateButton:SetWidth(_G.AceAddon20AboutFrameDonateButtonText:GetWidth()+20) |
donateButton:SetScript("OnClick", function() |
aboutFrame.currentAddon:OpenDonationFrame() |
end) |
local text = aboutFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge") |
aboutFrame.title = text |
text:SetPoint("TOP", 0, -5) |
aboutFrame:Hide() |
aboutFrame.lefts = {} |
aboutFrame.rights = {} |
aboutFrame.textLefts = {} |
aboutFrame.textRights = {} |
function aboutFrame:Clear() |
self.title:SetText("") |
for i = 1, #self.lefts do |
self.lefts[i] = nil |
self.rights[i] = nil |
end |
end |
function aboutFrame:AddLine(left, right) |
aboutFrame.lefts[#aboutFrame.lefts+1] = left |
aboutFrame.rights[#aboutFrame.rights+1] = right |
end |
local aboutFrame_Show = aboutFrame.Show |
function aboutFrame:Show(...) |
local maxLeftWidth = 0 |
local maxRightWidth = 0 |
local textHeight = 0 |
for i = 1, #self.lefts do |
if not self.textLefts[i] then |
local left = aboutFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal") |
self.textLefts[i] = left |
local right = aboutFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight") |
self.textRights[i] = right |
if i == 1 then |
left:SetPoint("TOPRIGHT", aboutFrame, "TOPLEFT", 75, -35) |
else |
left:SetPoint("TOPRIGHT", self.textLefts[i-1], "BOTTOMRIGHT", 0, -5) |
end |
right:SetPoint("LEFT", left, "RIGHT", 5, 0) |
end |
self.textLefts[i]:SetText(self.lefts[i] .. ":") |
self.textRights[i]:SetText(self.rights[i]) |
local leftWidth = self.textLefts[i]:GetWidth() |
local rightWidth = self.textRights[i]:GetWidth() |
textHeight = self.textLefts[i]:GetHeight() |
if maxLeftWidth < leftWidth then |
maxLeftWidth = leftWidth |
end |
if maxRightWidth < rightWidth then |
maxRightWidth = rightWidth |
end |
end |
for i = #self.lefts+1, #self.textLefts do |
self.textLefts[i]:SetText('') |
self.textRights[i]:SetText('') |
end |
aboutFrame:SetWidth(75 + maxRightWidth + 20) |
aboutFrame:SetHeight(#self.lefts * (textHeight + 5) + 100) |
aboutFrame_Show(self, ...) |
end |
aboutFrame:Hide() |
createAboutFrame = nil |
end |
local donateFrame |
local function unobfuscateEmail(email) |
return email:gsub(" AT ", "@"):gsub(" DOT ", ".") |
end |
local function isGoodVariable(var) |
return type(var) == "string" or type(var) == "number" |
end |
function AceAddon.prototype:PrintAddonInfo() |
if createAboutFrame then |
createAboutFrame() |
end |
aboutFrame:Clear() |
local x |
if isGoodVariable(self.title) then |
x = "|cffffff7f" .. tostring(self.title) .. "|r" |
x = tostring(self.title) |
elseif isGoodVariable(self.name) then |
x = "|cffffff7f" .. tostring(self.name) .. "|r" |
x = tostring(self.name) |
else |
x = "|cffffff7f<" .. tostring(self.class) .. " instance>|r" |
x = "<" .. tostring(self.class) .. " instance>" |
end |
if type(self.IsActive) == "function" then |
if not self:IsActive() then |
x = x .. " " .. STANDBY |
end |
end |
aboutFrame.title:SetText(x) |
if isGoodVariable(self.version) then |
x = x .. " - |cffffff7f" .. tostring(self.version) .. "|r" |
aboutFrame:AddLine(VERSION, tostring(self.version)) |
end |
if isGoodVariable(self.notes) then |
x = x .. " - " .. tostring(self.notes) |
aboutFrame:AddLine(NOTES, tostring(self.notes)) |
end |
print(x) |
if isGoodVariable(self.author) then |
print(" - |cffffff7f" .. AUTHOR .. ":|r " .. tostring(self.author)) |
aboutFrame:AddLine(AUTHOR, tostring(self.author)) |
end |
if isGoodVariable(self.credits) then |
print(" - |cffffff7f" .. CREDITS .. ":|r " .. tostring(self.credits)) |
aboutFrame:AddLine(CREDITS, tostring(self.credits)) |
end |
if isGoodVariable(self.date) then |
print(" - |cffffff7f" .. DATE .. ":|r " .. tostring(self.date)) |
aboutFrame:AddLine(DATE, tostring(self.date)) |
end |
if self.category then |
if isGoodVariable(self.category) then |
local category = CATEGORIES[self.category] |
if category then |
print(" - |cffffff7f" .. CATEGORY .. ":|r " .. category) |
end |
aboutFrame:AddLine(CATEGORY, category or tostring(self.category)) |
end |
if isGoodVariable(self.email) then |
print(" - |cffffff7f" .. EMAIL .. ":|r " .. tostring(self.email)) |
aboutFrame:AddLine(EMAIL, unobfuscateEmail(tostring(self.email))) |
end |
if isGoodVariable(self.website) then |
print(" - |cffffff7f" .. WEBSITE .. ":|r " .. tostring(self.website)) |
aboutFrame:AddLine(WEBSITE, tostring(self.website)) |
end |
if isGoodVariable(self.license) then |
print(" - |cffffff7f" .. LICENSE .. ":|r " .. tostring(self.license)) |
aboutFrame:AddLine(LICENSE, tostring(self.license)) |
end |
if donateFrame and donateFrame:IsShown() then |
donateFrame:Hide() |
end |
aboutFrame.currentAddon = self |
aboutFrame:Show() |
if self.donate then |
aboutFrame.donateButton:Show() |
else |
aboutFrame.donateButton:Hide() |
end |
end |
local function createDonateFrame() |
donateFrame = CreateFrame("Frame", "AceAddon20Frame", UIParent, "DialogBoxFrame") |
donateFrame:SetWidth(500) |
donateFrame:SetHeight(200) |
donateFrame:SetPoint("CENTER") |
donateFrame:SetBackdrop({ |
bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], |
edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], |
tile = true, tileSize = 16, edgeSize = 16, |
insets = { left = 5, right = 5, top = 5, bottom = 5 } |
}) |
donateFrame:SetBackdropColor(0,0,0,1) |
local text = donateFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge") |
text:SetPoint("TOP", 0, -5) |
text:SetText(DONATE) |
local howto = donateFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight") |
howto:SetPoint("TOP", text, "BOTTOM", 0, -5) |
howto:SetPoint("LEFT", 16, 0) |
howto:SetPoint("RIGHT", -16, 0) |
if not IsMacClient() then |
-- Windows or Linux |
howto:SetText(HOWTO_DONATE_WINDOWS) |
else |
howto:SetText(HOWTO_DONATE_MAC) |
end |
local scrollFrame = CreateFrame("ScrollFrame", "AceAddon20FrameScrollFrame", donateFrame, "UIPanelScrollFrameTemplate") |
scrollFrame:SetToplevel(true) |
scrollFrame:SetPoint("TOP", -10, -76) |
scrollFrame:SetWidth(455) |
scrollFrame:SetHeight(70) |
howto:SetPoint("BOTTOM", scrollFrame, "TOP") |
local editBox = CreateFrame("EditBox", nil, scrollFrame) |
donateFrame.editBox = editBox |
scrollFrame:SetScrollChild(editBox) |
editBox:SetFontObject(ChatFontNormal) |
editBox:SetMultiLine(true) |
editBox:SetMaxLetters(99999) |
editBox:SetWidth(450) |
editBox:SetHeight(54) |
editBox:SetPoint("BOTTOM", 5, 0) |
editBox:SetJustifyH("LEFT") |
editBox:SetJustifyV("TOP") |
editBox:SetAutoFocus(false) |
editBox:SetScript("OnTextChanged", function(this) |
if this:GetText() ~= this.text then |
this:SetText(this.text) |
end |
end) |
editBox:SetScript("OnEscapePressed", function(this) |
this:ClearFocus() |
end) |
createDonateFrame = nil |
end |
local function fix(char) |
return ("%%%02x"):format(char:byte()) |
end |
local function urlencode(text) |
return text:gsub("[^0-9A-Za-z]", fix) |
end |
function AceAddon.prototype:OpenDonationFrame() |
if createDonateFrame then |
createDonateFrame() |
end |
local donate = self.donate |
if type(donate) ~= "string" then |
donate = "Wowace" |
end |
local style, data = (":"):split(donate, 2) |
style = style:lower() |
if style ~= "website" and style ~= "paypal" then |
style = "wowace" |
end |
if style == "wowace" then |
donateFrame.editBox.text = "http://www.wowace.com/wiki/Donations" |
elseif style == "website" then |
donateFrame.editBox.text = data |
else -- PayPal |
local text = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=" .. urlencode(unobfuscateEmail(data)) |
local name |
if type(self.title) == "string" then |
name = self.title |
elseif type(self.name) == "string" then |
name = self.name |
end |
if name then |
name = name:gsub("|c%x%x%x%x%x%x%x%x", ""):gsub("|r", "") |
text = text .. "&item_name=" .. urlencode(name) |
end |
donateFrame.editBox.text = text |
end |
donateFrame.editBox:SetText(donateFrame.editBox.text) |
if aboutFrame and aboutFrame:IsShown() then |
aboutFrame:Hide() |
end |
donateFrame:Show() |
donateFrame.editBox:SetFocus() |
end |
local options |
function AceAddon:GetAceOptionsDataTable(target) |
if not options then |
options = { |
about = { |
name = ABOUT, |
desc = PRINT_ADDON_INFO, |
type = "execute", |
func = "PrintAddonInfo", |
order = -1, |
} |
return { |
about = { |
name = ABOUT, |
desc = PRINT_ADDON_INFO, |
type = "execute", |
func = "PrintAddonInfo", |
order = -1, |
}, |
donate = { |
name = DONATE, |
desc = DONATE_DESC, |
type = "execute", |
func = "OpenDonationFrame", |
order = -1, |
hidden = function() |
return not target.donate |
end |
} |
end |
return options |
} |
end |
function AceAddon:PLAYER_LOGIN() |
local addon = table.remove(self.addonsToOnEnable, 1) |
self.addonsStarted[addon] = true |
if (type(addon.IsActive) ~= "function" or addon:IsActive()) and (not AceModuleCore or not AceModuleCore:IsModule(addon) or AceModuleCore:IsModuleActive(addon)) then |
self.addonsEnabled[addon] = true |
local current = addon.class |
while true do |
if current == AceOO.Class or not current then |
break |
end |
if current.mixins then |
for mixin in pairs(current.mixins) do |
if type(mixin.OnEmbedEnable) == "function" then |
safecall(mixin.OnEmbedEnable, mixin, addon, true) |
end |
end |
end |
current = current.super |
end |
if type(addon.OnEnable) == "function" then |
safecall(addon.OnEnable, addon, true) |
end |
if AceEvent then |
AceEvent:TriggerEvent("Ace2_AddonEnabled", addon, true) |
end |
AceAddon:ManualEnable(addon) |
end |
end |
self.addonsToOnEnable = nil |
return class:new() |
end |
function AceAddon:ManualEnable(addon) |
AceAddon:argCheck(addon, 2, "table") |
local first = nil |
if AceOO.inherits(addon, "AceAddon-2.0") then |
if AceAddon.addonsEnabled and not AceAddon.addonsEnabled[addon] then |
first = true |
AceAddon.addonsEnabled[addon] = true |
end |
end |
local current = addon.class |
while current and current ~= AceOO.Class do |
if current.mixins then |
for mixin in pairs(current.mixins) do |
if type(mixin.OnEmbedEnable) == "function" then |
safecall(mixin.OnEmbedEnable, mixin, addon, first) |
end |
end |
end |
current = current.super |
end |
if type(addon.OnEnable) == "function" then |
safecall(addon.OnEnable, addon, first) |
end |
if AceEvent then |
AceEvent:TriggerEvent("Ace2_AddonEnabled", addon, first) |
end |
end |
function AceAddon:ManualDisable(addon) |
AceAddon:argCheck(addon, 2, "table") |
local current = addon.class |
while current and current ~= AceOO.Class do |
if current.mixins then |
for mixin in pairs(current.mixins) do |
if type(mixin.OnEmbedDisable) == "function" then |
safecall(mixin.OnEmbedDisable, mixin, addon) |
end |
end |
end |
current = current.super |
end |
if type(module.OnDisable) == "function" then |
safecall(module.OnDisable, addon) |
end |
if AceEvent then |
AceEvent:TriggerEvent("Ace2_AddonDisabled", addon) |
end |
end |
local function external(self, major, instance) |
if major == "AceEvent-2.0" then |
AceEvent = instance |
AceEvent:embed(self) |
self:RegisterEvent("PLAYER_LOGIN", "PLAYER_LOGIN", true) |
elseif major == "AceConsole-2.0" then |
AceConsole = instance |
local slashCommands = { "/ace2" } |
local _,_,_,enabled,loadable = GetAddOnInfo("Ace") |
if not enabled or not loadable then |
if not depth then |
depth = 0 |
end |
local s = (" "):rep(depth) .. " - " .. tostring(addon) |
if rawget(addon, 'version') then |
s = s .. " - |cffffff7f" .. tostring(addon.version) .. "|r" |
local function activate(self, oldLib, oldDeactivate) |
AceAddon = self |
self.playerLoginFired = oldLib and oldLib.playerLoginFired or DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.defaultLanguage |
self.addonsToOnEnable = oldLib and oldLib.addonsToOnEnable |
self.addons = oldLib and oldLib.addons or {} |
self.skipAddon = oldLib and oldLib.skipAddon or {} |
self.addonsStarted = oldLib and oldLib.addonsStarted or {} |
self.addonsEnabled = oldLib and oldLib.addonsEnabled or {} |
if oldDeactivate then |
oldDeactivate(oldLib) |
end |