WoWInterface SVN RecapFu

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 2 to Rev 3
    Reverse comparison

Rev 2 → Rev 3

trunk/FuBar_RecapFu/changelog-r30568.txt File deleted
trunk/FuBar_RecapFu/Changelog-FuBar_RecapFu-r30568.xml File deleted
trunk/FuBar_RecapFu/RecapFu.lua
5,335 → 5,314
local crayon = AceLibrary("Crayon-2.0")
 
local TYPES = {
a = {var = "DPS", text = L["Your DPS"]},
b = {var = "DMG_IN", text = L["Your damage received"]},
c = {var = "DMG_OUT", text = L["Your damage dealt"]},
d = {var = "HEALING", text = L["Your healing"]},
e = {var = "OVERHEAL", text = L["Your over-healing percentage"]},
f = {var = "MAXHIT", text = L["Your max hit"]},
g = {var = "DPS_IN", text = L["Total DPS In"]},
h = {var = "DPS_OUT", text = L["Total DPS Out"]},
a = {var = "DPS", text = L["Your DPS"]},
b = {var = "DPS_IN", text = L["Total DPS In"]},
c = {var = "DPS_OUT", text = L["Total DPS Out"]},
d = {var = "HEALING", text = L["Your healing"]},
--b = {var = "DMG_IN", text = L["Your damage received"]},
--c = {var = "DMG_OUT", text = L["Your damage dealt"]},
--e = {var = "OVERHEAL", text = L["Your over-healing percentage"]},
--f = {var = "MAXHIT", text = L["Your max hit"]},
}
 
local recapFu_index = 1
 
local options = {
type = 'group',
args = {
pause = {
type = 'toggle',
order = 100,
name = L["Pause"],
desc = L["Pause/Resume Monitoring"],
get = function()
return recap.Opt.Paused.value
end,
set = function()
Recap_OnClick("Pause")
end,
},
display = {
type = 'group',
order = 102,
name = L["Display"],
desc = L["Toggle what is displayed on the panel"],
args = {
label = {
type = 'toggle',
order = 100,
name = L["Label"],
desc = L["Show/Hide the DPS label"],
get = function()
return RecapFu.db.profile.showlabel
end,
set = function()
RecapFu.db.profile.showlabel = not RecapFu.db.profile.showlabel
RecapFu:UpdateText()
end,
},
dps = {
type = 'toggle',
order = 110,
name = L["DPS"],
desc = L["Your DPS"],
get = function()
return RecapFu.db.profile.DPS
end,
set = function()
RecapFu.db.profile.DPS = not RecapFu.db.profile.DPS
RecapFu:UpdateText()
end,
},
dmgin = {
type = 'toggle',
order = 120,
name = L["Received"],
desc = L["Your damage received"],
get = function()
return RecapFu.db.profile.DMG_IN
end,
set = function()
RecapFu.db.profile.DMG_IN = not RecapFu.db.profile.DMG_IN
RecapFu:UpdateText()
end,
},
dmgout = {
type = 'toggle',
order = 130,
name = L["Dealt"],
desc = L["Your damage dealt"],
get = function()
return RecapFu.db.profile.DMG_OUT
end,
set = function()
RecapFu.db.profile.DMG_OUT = not RecapFu.db.profile.DMG_OUT
RecapFu:UpdateText()
end,
},
healing = {
type = 'toggle',
order = 140,
name = L["Healing"],
desc = L["Your healing"],
get = function()
return RecapFu.db.profile.HEALING
end,
set = function()
RecapFu.db.profile.HEALING = not RecapFu.db.profile.HEALING
RecapFu:UpdateText()
end,
},
overheal = {
type = 'toggle',
order = 150,
name = L["Overhealing"],
desc = L["Your over-healing percentage"],
get = function()
return RecapFu.db.profile.OVERHEAL
end,
set = function()
RecapFu.db.profile.OVERHEAL = not RecapFu.db.profile.OVERHEAL
RecapFu:UpdateText()
end,
},
maxhit = {
type = 'toggle',
order = 160,
name = L["Max"],
desc = L["Your max hit"],
get = function()
return RecapFu.db.profile.MAXHIT
end,
set = function()
RecapFu.db.profile.MAXHIT = not RecapFu.db.profile.MAXHIT
RecapFu:UpdateText()
end,
},
dpsin = {
type = 'toggle',
order = 170,
name = L["DPSin"],
desc = L["Total DPS In"],
get = function()
return RecapFu.db.profile.DPS_IN
end,
set = function()
RecapFu.db.profile.DPS_IN = not RecapFu.db.profile.DPS_IN
RecapFu:UpdateText()
end,
},
dpsout = {
type = 'toggle',
order = 180,
name = L["DPSout"],
desc = L["Total DPS Out"],
get = function()
return RecapFu.db.profile.DPS_OUT
end,
set = function()
RecapFu.db.profile.DPS_OUT = not RecapFu.db.profile.DPS_OUT
RecapFu:UpdateText()
end,
},
}
},
}
type = 'group',
args = {
pause = {
type = "toggle",
order = 100,
name = L["Pause"],
desc = L["Pause/Resume Monitoring"],
get = function()
return RecapFu.state and ("Stopped" == RecapFu.state);
end,
set = function()
Recap_OnClick("Pause")
end,
},
display = {
type = "group",
order = 102,
name = L["Display"],
desc = L["Toggle what is displayed on the panel"],
args = {
label = {
type = "toggle",
order = 100,
name = L["Label"],
desc = L["Show/Hide the DPS label"],
get = function()
return RecapFu.db.profile.showlabel
end,
set = function()
RecapFu.db.profile.showlabel = not RecapFu.db.profile.showlabel
RecapFu:UpdateText()
end,
},
dps = {
type = "toggle",
order = 110,
name = L["DPS"],
desc = L["Your DPS"],
get = function()
return RecapFu.db.profile.DPS
end,
set = function()
RecapFu.db.profile.DPS = not RecapFu.db.profile.DPS
RecapFu:UpdateText()
end,
},
-- dmgin = {
-- type = "toggle",
-- order = 120,
-- name = L["Received"],
-- desc = L["Your damage received"],
-- get = function()
-- return RecapFu.db.profile.DMG_IN
-- end,
-- set = function()
-- RecapFu.db.profile.DMG_IN = not RecapFu.db.profile.DMG_IN
-- RecapFu:UpdateText()
-- end,
-- },
-- dmgout = {
-- type = "toggle",
-- order = 130,
-- name = L["Dealt"],
-- desc = L["Your damage dealt"],
-- get = function()
-- return RecapFu.db.profile.DMG_OUT
-- end,
-- set = function()
-- RecapFu.db.profile.DMG_OUT = not RecapFu.db.profile.DMG_OUT
-- RecapFu:UpdateText()
-- end,
-- },
healing = {
type = "toggle",
order = 140,
name = L["Healing"],
desc = L["Your healing"],
get = function()
return RecapFu.db.profile.HEALING
end,
set = function()
RecapFu.db.profile.HEALING = not RecapFu.db.profile.HEALING
RecapFu:UpdateText()
end,
},
-- overheal = {
-- type = "toggle",
-- order = 150,
-- name = L["Overhealing"],
-- desc = L["Your over-healing percentage"],
-- get = function()
-- return RecapFu.db.profile.OVERHEAL
-- end,
-- set = function()
-- RecapFu.db.profile.OVERHEAL = not RecapFu.db.profile.OVERHEAL
-- RecapFu:UpdateText()
-- end,
-- },
-- maxhit = {
-- type = "toggle",
-- order = 160,
-- name = L["Max"],
-- desc = L["Your max hit"],
-- get = function()
-- return RecapFu.db.profile.MAXHIT
-- end,
-- set = function()
-- RecapFu.db.profile.MAXHIT = not RecapFu.db.profile.MAXHIT
-- RecapFu:UpdateText()
-- end,
-- },
dpsin = {
type = "toggle",
order = 170,
name = L["DPSin"],
desc = L["Total DPS In"],
get = function()
return RecapFu.db.profile.DPS_IN
end,
set = function()
RecapFu.db.profile.DPS_IN = not RecapFu.db.profile.DPS_IN
RecapFu:UpdateText()
end,
},
dpsout = {
type = "toggle",
order = 180,
name = L["DPSout"],
desc = L["Total DPS Out"],
get = function()
return RecapFu.db.profile.DPS_OUT
end,
set = function()
RecapFu.db.profile.DPS_OUT = not RecapFu.db.profile.DPS_OUT
RecapFu:UpdateText()
end,
},
}
},
}
}
 
RecapFu:RegisterDB("RecapFuDB")
RecapFu:RegisterDefaults('profile', {
showlabel = true,
DPS = true,
})
RecapFu.version = "2.0." .. string.sub("$Revision: 30568 $", 12, -3)
RecapFu.date = string.sub("$Date: 2007-03-19 22:48:32 -0400 (Mon, 19 Mar 2007) $", 8, 17)
RecapFu.hasIcon = "Interface\\AddOns\\Recap\\Recap-Status"
RecapFu.hasIcon = "Interface\\AddOns\\Recap\\Images\\Recap-Status"
RecapFu.hasNoColor = true
RecapFu.canHideText = true
RecapFu.clickableTooltip = true
RecapFu.independentProfile = true
RecapFu.cannotDetachTooltip = true
RecapFu.OnMenuRequest = options
RecapFu.defaultPosition = 'LEFT'
 
RecapFu:RegisterChatCommand({"/recapfu", "/fubar_recapfu"}, options)
 
RecapFu:RegisterDB("RecapFuDB")
RecapFu:RegisterDefaults('profile', {
showlabel = true,
DPS = true,
})
 
function RecapFu:OnInitialize()
self.state = "unknown"
self.viewtype = "unknown"
self.yourdps = 0
self.dpsin = 0
self.dpsout = 0
self.healing = 0
self.dmgin = 0
self.dmgout = 0
self.overheal = 0
self.maxhit = 0
end
 
function RecapFu:OnEnable()
self.text = {}
self.text = {}
end
 
function RecapFu:OnDisable()
self.text = nil
self.text = nil
end
 
function RecapFu:OnClick()
RecapFrame_Toggle()
RecapFrame_Toggle()
end
 
function RecapFu:UpdateData()
self:Debug("Update Data")
self:Debug(" Update Data ")
 
if recap.Opt then
if recap.Opt.State then
self.state = recap.Opt.State.value or "n/a"
else
self.state = "n/a"
end
if recap.Opt.View and recap_temp.LastAll then
self.viewtype = recap_temp.LastAll[recap.Opt.View.value] or "n/a"
else
self.viewtype = "n/a"
end
else
self.state = "n/a"
self.viewtype = "n/a"
end
 
local Player
if (recapFu_index < recap_temp.ListSize) and (recap_temp.List[recapFu_index].Name == recap_temp.Player) then
Player = recap_temp.List[recapFu_index]
else
local i
for i=1,(recap_temp.ListSize-1) do
if recap_temp.List[i].Name==recap_temp.Player then
recapFu_index = i
Player = recap_temp.List[i]
break
end
end
end
 
if Player == nil then
self.dmgin = 0
self.dmgout = 0
self.maxhit = 0
self.healing = 0
self.overheal = 0
self.dpsin = 0
self.dpsout = 0
else
self.dmgin = Player.DmgIn
self.dmgout = Player.DmgOut
self.maxhit = Player.MaxHit
self.healing = Player.Heal
self.overheal = Player.Over
end
 
if not self.yourdps then
self.yourdps = RecapMinYourDPS_Text:GetText()
end
if not self.dpsin then
self.dpsin = RecapMinDPSIn_Text:GetText()
end
if not self.dpsout then
self.dpsout = RecapMinDPSOut_Text:GetText()
end
 
self.text.DPS = crayon:White(self.yourdps)
self.text.DPS_IN = crayon:Red(self.dpsin)
self.text.DPS_OUT = crayon:Green(self.dpsout)
self.text.DMG_IN = crayon:Red(self.dmgin)
self.text.DMG_OUT = crayon:Green(self.dmgout)
self.text.HEALING = crayon:Colorize("00ffff", self.healing)
self.text.OVERHEAL = crayon:Colorize("00ffff", self.overheal.."%")
self.text.MAXHIT = crayon:Orange(self.maxhit)
self.text.DPS = crayon:White(self.yourdps)
self.text.DPS_IN = crayon:Red(self.dpsin)
self.text.DPS_OUT = crayon:Green(self.dpsout)
self.text.DMG_IN = crayon:Red(self.dmgin)
self.text.DMG_OUT = crayon:Green(self.dmgout)
self.text.HEALING = crayon:Colorize("00ffff", self.healing)
self.text.OVERHEAL = crayon:Colorize("00ffff", self.overheal) .. "%"
self.text.MAXHIT = crayon:Orange(self.maxhit)
end
 
function RecapFu:UpdateText()
self:Debug("Update Text")
-- format the colored status bubble
if (self:IsIconShown()) then
if self.state=="Idle" then
self.iconFrame:SetVertexColor(.5,.5,.5)
elseif self.state=="Active" then
self.iconFrame:SetVertexColor(0,1,0)
elseif self.state=="Stopped" then
self.iconFrame:SetVertexColor(1,0,0)
end
end
self:Debug(" Update Text")
-- format the colored status bubble
if (self:IsIconShown()) then
if self.state=="Idle" then
self.iconFrame:SetVertexColor(.5,.5,.5)
elseif self.state=="Active" then
self.iconFrame:SetVertexColor(0,1,0)
elseif self.state=="Stopped" then
self.iconFrame:SetVertexColor(1,0,0)
end
end
 
local t = {}
if self.db.profile.showlabel then
table.insert(t, L["DPS"]..": ")
end
local t = {}
if self.db.profile.showlabel then
table.insert(t, L["DPS"]..": ")
end
 
for i,e in self:pairsByKeys(TYPES) do
if self.db.profile[e.var] then
table.insert(t, self.text[e.var])
end
end
for i,e in self:pairsByKeys(TYPES) do
if self.db.profile[e.var] then
table.insert(t, self.text[e.var])
end
end
 
self:SetText(table.concat(t, " "))
self:SetText(table.concat(t, " "))
end
 
function RecapFu:OnTooltipUpdate()
self:Debug("Update Tooltip")
local cat = tablet:AddCategory(
'columns', 2,
'child_textR', 1,
'child_textG', 1,
'child_textB', 0,
'child_text2R', 1,
'child_text2G', 1,
'child_text2B', 1
)
cat:AddLine('text', L["State"], 'text2', self.state)
cat:AddLine('text', L["View Type"], 'text2', self.viewtype)
self:Debug(" Update Tooltip")
local cat = tablet:AddCategory(
'columns', 2,
'child_textR', 1,
'child_textG', 1,
'child_textB', 0,
'child_text2R', 1,
'child_text2G', 1,
'child_text2B', 1
)
cat:AddLine('text', L["State"],
'text2', self.state,
'func', function(self,ign) Recap_OnClick("Pause") end,
'arg1', self,
'arg2', 0
)
cat:AddLine('text', L["View Type"],
'text2', self.viewtype,
'func', function(self,ign) Recap_ToggleView() end,
'arg1', self,
'arg2', 0
)
 
local cat = tablet:AddCategory(
'columns', 2,
'child_textR', 1,
'child_textG', 1,
'child_textB', 0
)
for i,e in self:pairsByKeys(TYPES) do
cat:AddLine('text', e.text, 'text2', self.text[e.var])
end
tablet:SetHint(L["Left-click to toggle Recap window"])
local cat = tablet:AddCategory(
'columns', 2,
'child_textR', 1,
'child_textG', 1,
'child_textB', 0
)
for i,e in self:pairsByKeys(TYPES) do
cat:AddLine('text', e.text, 'text2', self.text[e.var])
end
tablet:SetHint(L["Left-click to toggle Recap window"])
end
 
function RecapFu:pairsByKeys (t, f)
--taken from an example in the Programming in Lua book
local a = {}
for n in pairs(t) do
table.insert(a, n)
end
table.sort(a, f)
local i = 0 -- iterator variable
local iter = function () -- iterator function
i = i + 1
if a[i] == nil then
return nil
else
return a[i], t[a[i]]
end
end
return iter
local a = {}
for n in pairs(t) do
table.insert(a, n)
end
table.sort(a, f)
local i = 0 -- iterator variable
local iter = function () -- iterator function
i = i + 1
if a[i] == nil then
return nil
else
return a[i], t[a[i]]
end
end
return iter
end
 
 
-- Simulate Titan Panel plugin
-- Necessary or updates to dps data on the plugin may not occur until after combat ends
function TitanPanelRecap_Update(state,yourdps,dpsin,dpsout)
RecapFu.state = state
RecapFu.yourdps = yourdps
RecapFu.dpsin = dpsin
RecapFu.dpsout = dpsout
RecapFu:Update()
end
\ No newline at end of file + RecapFu.state = state + RecapFu.viewtype = recap_user.View + RecapFu.yourdps = yourdps + RecapFu.dpsin = dpsin + RecapFu.dpsout = dpsout + if RecapFu.viewtype == "Last" then + RecapFu.healing = recap_temp.PlayerHPSLast + else + RecapFu.healing = recap_temp.PlayerHPSAll + end + + RecapFu:Update() +end
trunk/FuBar_RecapFu/FuBar_RecapFu.toc
1,11 → 1,11
## Interface: 20003
## Interface: 30200
## Title: FuBar - |cffffffffRecap|r|cff00ff00Fu|r
## Notes: FuBar plugin for Recap
## Author: Prandur
## X-Credits: Gello (for Recap), Darravis (enhancement ideas)
## Version: 2.0
## Author: Kitjan
## X-Credits: Hawksy (for Recap)
## Version: 2.1
## X-Category: Combat
## X-WoWIPortal: prandur
## X-WoWIPortal: Kitjan
 
## Dependencies: FuBar, Recap
## OptionalDeps: Ace2, FuBarPlugin-2.0, TabletLib, DewdropLib, CrayonLib
30,4 → 30,4
 
# Core addon
RecapFu_Locale_enUS.lua
RecapFu.lua
\ No newline at end of file +RecapFu.lua
trunk/FuBar_RecapFu/libs/Changelog-Tablet-2.0-r30695.xml File deleted
trunk/FuBar_RecapFu/libs/Changelog-AceLocale-2.2-r27198.xml File deleted
trunk/FuBar_RecapFu/libs/Changelog-AceOO-2.0-r25921.xml File deleted
trunk/FuBar_RecapFu/libs/Changelog-FuBarPlugin-2.0-r29795.xml File deleted
trunk/FuBar_RecapFu/libs/Changelog-Crayon-2.0-r25921.xml File deleted
trunk/FuBar_RecapFu/libs/Changelog-AceLibrary-r29796.xml File deleted
trunk/FuBar_RecapFu/libs/Changelog-AceDebug-2.0-r25921.xml File deleted
trunk/FuBar_RecapFu/libs/Changelog-AceDB-2.0-r29174.xml File deleted
trunk/FuBar_RecapFu/libs/Changelog-Dewdrop-2.0-r30385.xml File deleted
trunk/FuBar_RecapFu/libs/Changelog-AceAddon-2.0-r28672.xml File deleted
trunk/FuBar_RecapFu/libs/Changelog-AceConsole-2.0-r30624.xml File deleted
trunk/FuBar_RecapFu/libs/Dewdrop-2.0/Dewdrop-2.0.lua
1,6 → 1,6
--[[
--[[
Name: Dewdrop-2.0
Revision: $Rev: 30385 $
Revision: $Rev: 320 $
Author(s): ckknight (ckknight@gmail.com)
Website: http://ckknight.wowinterface.com/
Documentation: http://wiki.wowace.com/index.php/Dewdrop-2.0
11,17 → 11,20
]]
 
local MAJOR_VERSION = "Dewdrop-2.0"
local MINOR_VERSION = "$Revision: 30385 $"
local MINOR_VERSION = tonumber(strmatch("$Revision: 320 $", "%d+")) + 90000
 
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
 
local Dewdrop = {}
 
local SharedMedia
 
local CLOSE = "Close"
local CLOSE_DESC = "Close the menu."
local VALIDATION_ERROR = "Validation error."
local USAGE_TOOLTIP = "Usage: %s."
local RANGE_TOOLTIP = "Note that you can scroll your mouse wheel while over the slider to step by one."
local RESET_KEYBINDING_DESC = "Hit escape to clear the keybinding."
local KEY_BUTTON1 = "Left Mouse"
local KEY_BUTTON2 = "Right Mouse"
32,23 → 35,79
CLOSE = "Schlie\195\159en"
CLOSE_DESC = "Men\195\188 schlie\195\159en."
VALIDATION_ERROR = "Validierungsfehler."
USAGE_TOOLTIP = "Benutzung: %s."
RANGE_TOOLTIP = "Beachte das du mit dem Mausrad scrollen kannst solange du mit dem Mauszeiger \195\188ber dem Schieberegler bist, um feinere Spr\195\188nge zu machen."
RESET_KEYBINDING_DESC = "Escape dr\195\188cken, um die Tastenbelegung zu l\195\182schen."
KEY_BUTTON1 = "Linke Maustaste"
KEY_BUTTON2 = "Rechte Maustaste"
DISABLED = "Deaktiviert"
DEFAULT_CONFIRM_MESSAGE = "Bist du sicher das du `%s' machen willst?"
elseif GetLocale() == "koKR" then
CLOSE = "닫기"
CLOSE_DESC = "메뉴를 닫습니다."
VALIDATION_ERROR = "오류 확인."
USAGE_TOOLTIP = "사용법: %s."
RANGE_TOOLTIP = "알림 : 슬라이더 위에서 마우스 휠을 사용하면 한단계씩 조절할 수 있습니다."
RESET_KEYBINDING_DESC = "단축키를 해제하려면 ESC키를 누르세요."
KEY_BUTTON1 = "왼쪽 마우스"
KEY_BUTTON2 = "오른쪽 마우스"
DISABLED = "비활성화됨"
DEFAULT_CONFIRM_MESSAGE = "정말로 `%s' 실행을 하시겠습니까 ?"
elseif GetLocale() == "frFR" then
CLOSE = "Fermer"
CLOSE_DESC = "Ferme le menu."
VALIDATION_ERROR = "Erreur de validation."
USAGE_TOOLTIP = "Utilisation : %s."
RANGE_TOOLTIP = "Vous pouvez aussi utiliser la molette de la souris pour pour modifier progressivement."
RESET_KEYBINDING_DESC = "Appuyez sur la touche Echappement pour effacer le raccourci."
KEY_BUTTON1 = "Clic gauche"
KEY_BUTTON2 = "Clic droit"
DISABLED = "D\195\169sactiv\195\169"
DEFAULT_CONFIRM_MESSAGE = "\195\138tes-vous s\195\187r de vouloir effectuer '%s' ?"
elseif GetLocale() == "esES" then
CLOSE = "Cerrar"
CLOSE_DESC = "Cierra el men\195\186."
VALIDATION_ERROR = "Error de validaci\195\179n"
RESET_KEYBINDING_DESC = "Pulsa Escape para limpiar la asignaci\195\179n de tecla."
CLOSE_DESC = "Cierra el menú."
VALIDATION_ERROR = "Error de validación."
USAGE_TOOLTIP = "Uso: %s."
RANGE_TOOLTIP = "Puedes desplazarte verticalmente con la rueda del ratón sobre el desplazador."
RESET_KEYBINDING_DESC = "Pulsa Escape para borrar la asignación de tecla."
KEY_BUTTON1 = "Clic Izquierdo"
KEY_BUTTON2 = "Clic Derecho"
DISABLED = "Desactivado"
DEFAULT_CONFIRM_MESSAGE = "¿Estás seguro de querer realizar `%s'?"
elseif GetLocale() == "zhTW" then
CLOSE = "關閉"
CLOSE_DESC = "關閉選單。"
VALIDATION_ERROR = "驗證錯誤。"
USAGE_TOOLTIP = "用法: %s。"
RANGE_TOOLTIP = "你可以在捲動條上使用滑鼠滾輪來捲動。"
RESET_KEYBINDING_DESC = "按Esc鍵清除快捷鍵。"
KEY_BUTTON1 = "滑鼠左鍵"
KEY_BUTTON2 = "滑鼠右鍵"
DISABLED = "停用"
DEFAULT_CONFIRM_MESSAGE = "是否執行「%s」?"
elseif GetLocale() == "zhCN" then
CLOSE = "关闭"
CLOSE_DESC = "关闭菜单"
VALIDATION_ERROR = "验证错误."
USAGE_TOOLTIP = "用法: %s."
RANGE_TOOLTIP = "你可以在滚动条上使用鼠标滚轮来翻页."
RESET_KEYBINDING_DESC = "按ESC键清除按键绑定"
KEY_BUTTON1 = "鼠标左键"
KEY_BUTTON2 = "鼠标右键"
DISABLED = "禁用"
DEFAULT_CONFIRM_MESSAGE = "是否执行'%s'?"
elseif GetLocale() == "ruRU" then
CLOSE = "Закрыть"
CLOSE_DESC = "Закрыть меню."
VALIDATION_ERROR = "Ошибка проверки данных."
USAGE_TOOLTIP = "Используйте: %s."
RANGE_TOOLTIP = "Используйте колесо мыши для прокрутки ползунка."
RESET_KEYBINDING_DESC = "Нажмите клавишу Escape для очистки клавиши."
KEY_BUTTON1 = "ЛКМ"
KEY_BUTTON2 = "ПКМ"
DISABLED = "Отключено"
DEFAULT_CONFIRM_MESSAGE = "Вы уверены что вы хотите выполнять `%s'?"
end
 
Dewdrop.KEY_BUTTON1 = KEY_BUTTON1
106,6 → 165,125
local levels
local buttons
 
 
-- Secure frame handling:
-- Rather than using secure buttons in the menu (has problems), we have one
-- master secureframe that we pop onto menu items on mouseover. This requires
-- some dark magic with OnLeave etc, but it's not too bad.
 
local secureFrame = CreateFrame("Button", nil, nil, "SecureActionButtonTemplate")
secureFrame:Hide()
 
local function secureFrame_Show(self)
local owner = self.owner
 
if self.secure then -- Leftovers from previos owner, clean up! ("Shouldn't" happen but does..)
for k,v in pairs(self.secure) do
self:SetAttribute(k, nil)
end
end
self.secure = owner.secure; -- Grab hold of new secure data
 
local scale = owner:GetEffectiveScale()
 
self:SetPoint("TOPLEFT", nil, "BOTTOMLEFT", owner:GetLeft() * scale, owner:GetTop() * scale)
self:SetPoint("BOTTOMRIGHT", nil, "BOTTOMLEFT", owner:GetRight() * scale, owner:GetBottom() * scale)
self:EnableMouse(true)
for k,v in pairs(self.secure) do
self:SetAttribute(k, v)
end
 
secureFrame:SetFrameStrata(owner:GetFrameStrata())
secureFrame:SetFrameLevel(owner:GetFrameLevel()+1)
 
self:Show()
end
 
local function secureFrame_Hide(self)
self:Hide()
if self.secure then
for k,v in pairs(self.secure) do
self:SetAttribute(k, nil)
end
end
self.secure = nil
end
 
secureFrame:SetScript("OnEvent",
function()
if event=="PLAYER_REGEN_ENABLED" then
this.combat = false
if not this:IsShown() and this.owner then
secureFrame_Show(this)
end
elseif event=="PLAYER_REGEN_DISABLED" then
this.combat = true
if this:IsShown() then
secureFrame_Hide(this)
end
end
end
)
secureFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
secureFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
 
secureFrame:SetScript("OnLeave",
function()
local owner=this.owner
this:Deactivate()
owner:GetScript("OnLeave")()
end
)
 
secureFrame:HookScript("OnClick",
function()
local realthis = this
this = this.owner
this:GetScript("OnClick")()
end
)
 
function secureFrame:IsOwnedBy(frame)
return self.owner == frame
end
 
function secureFrame:Activate(owner)
if self.owner then -- "Shouldn't" happen but apparently it does and I cba to troubleshoot...
if not self.combat then
secureFrame_Hide(self)
end
end
self.owner = owner
if not self.combat then
secureFrame_Show(self)
end
end
 
function secureFrame:Deactivate()
if not self.combat then
secureFrame_Hide(self)
end
self.owner = nil
end
 
-- END secure frame utilities
 
 
-- Underline on mouseover - use a single global underline that we move around, no point in creating lots of copies
local underlineFrame = CreateFrame("Frame", nil)
underlineFrame.tx = underlineFrame:CreateTexture()
underlineFrame.tx:SetTexture(1,1,0.5,0.75)
underlineFrame:SetScript("OnHide", function(this) this:Hide(); end)
underlineFrame:SetScript("OnShow", function(this) -- change sizing on the fly to catch runtime uiscale changes
underlineFrame.tx:SetPoint("TOPLEFT", -1, -2/this:GetEffectiveScale())
underlineFrame.tx:SetPoint("RIGHT", 1,0)
underlineFrame.tx:SetHeight(0.6 / this:GetEffectiveScale());
end)
underlineFrame:SetHeight(1)
 
-- END underline on mouseover
 
 
local function GetScaledCursorPosition()
local x, y = GetCursorPosition()
local scale = UIParent:GetEffectiveScale()
183,17 → 361,21
level:SetWidth(width + 20)
if level:GetLeft() and level:GetRight() and level:GetTop() and level:GetBottom() and (level:GetLeft() < 0 or level:GetRight() > GetScreenWidth() or level:GetTop() > GetScreenHeight() or level:GetBottom() < 0) then
level:ClearAllPoints()
local parent = level.parent or level:GetParent()
if type(parent) ~= "table" then
parent = UIParent
end
if level.lastDirection == "RIGHT" then
if level.lastVDirection == "DOWN" then
level:SetPoint("TOPLEFT", level.parent or level:GetParent(), "TOPRIGHT", 5, 10)
level:SetPoint("TOPLEFT", parent, "TOPRIGHT", 5, 10)
else
level:SetPoint("BOTTOMLEFT", level.parent or level:GetParent(), "BOTTOMRIGHT", 5, -10)
level:SetPoint("BOTTOMLEFT", parent, "BOTTOMRIGHT", 5, -10)
end
else
if level.lastVDirection == "DOWN" then
level:SetPoint("TOPRIGHT", level.parent or level:GetParent(), "TOPLEFT", -5, 10)
level:SetPoint("TOPRIGHT", parent, "TOPLEFT", -5, 10)
else
level:SetPoint("BOTTOMRIGHT", level.parent or level:GetParent(), "BOTTOMLEFT", -5, -10)
level:SetPoint("BOTTOMRIGHT", parent, "BOTTOMLEFT", -5, -10)
end
end
end
218,17 → 400,21
end
if dirty then
level:ClearAllPoints()
local parent = level.parent or level:GetParent()
if type(parent) ~= "table" then
parent = UIParent
end
if level.lastDirection == "RIGHT" then
if level.lastVDirection == "DOWN" then
level:SetPoint("TOPLEFT", level.parent or level:GetParent(), "TOPRIGHT", 5, 10)
level:SetPoint("TOPLEFT", parent, "TOPRIGHT", 5, 10)
else
level:SetPoint("BOTTOMLEFT", level.parent or level:GetParent(), "BOTTOMRIGHT", 5, -10)
level:SetPoint("BOTTOMLEFT", parent, "BOTTOMRIGHT", 5, -10)
end
else
if level.lastVDirection == "DOWN" then
level:SetPoint("TOPRIGHT", level.parent or level:GetParent(), "TOPLEFT", -5, 10)
level:SetPoint("TOPRIGHT", parent, "TOPLEFT", -5, 10)
else
level:SetPoint("BOTTOMRIGHT", level.parent or level:GetParent(), "BOTTOMLEFT", -5, -10)
level:SetPoint("BOTTOMRIGHT", parent, "BOTTOMLEFT", -5, -10)
end
end
end
313,17 → 499,34
local sliderFrame
local editBoxFrame
 
local normalFont
local lastSetFont
local justSetFont = false
local regionTmp = {}
local function fillRegionTmp(...)
for i = 1, select('#', ...) do
regionTmp[i] = select(i, ...)
end
end
 
local function showGameTooltip(this)
if this.tooltipTitle or this.tooltipText then
GameTooltip_SetDefaultAnchor(GameTooltip, this)
local disabled = not this.isTitle and this.disabled
local font
if this.tooltipTitle then
if SharedMedia and SharedMedia:IsValid("font", this.tooltipTitle) then
font = SharedMedia:Fetch("font", this.tooltipTitle)
end
if disabled then
GameTooltip:SetText(this.tooltipTitle, 0.5, 0.5, 0.5, 1)
else
GameTooltip:SetText(this.tooltipTitle, 1, 1, 1, 1)
end
if this.tooltipText then
if not font and SharedMedia and SharedMedia:IsValid("font", this.tooltipText) then
font = SharedMedia:Fetch("font", this.tooltipText)
end
if disabled then
GameTooltip:AddLine(this.tooltipText, (NORMAL_FONT_COLOR.r + 0.5) / 2, (NORMAL_FONT_COLOR.g + 0.5) / 2, (NORMAL_FONT_COLOR.b + 0.5) / 2, 1)
else
331,12 → 534,38
end
end
else
if SharedMedia and SharedMedia:IsValid("font", this.tooltipText) then
font = SharedMedia:Fetch("font", this.tooltipText)
end
if disabled then
GameTooltip:SetText(this.tooltipText, 0.5, 0.5, 0.5, 1)
else
GameTooltip:SetText(this.tooltipText, 1, 1, 1, 1)
end
end
if font then
fillRegionTmp(GameTooltip:GetRegions())
lastSetFont = font
justSetFont = true
for i,v in ipairs(regionTmp) do
if v.SetFont then
local norm,size,outline = v:GetFont()
v:SetFont(font, size, outline)
if not normalFont then
normalFont = norm
end
end
regionTmp[i] = nil
end
elseif not normalFont then
fillRegionTmp(GameTooltip:GetRegions())
for i,v in ipairs(regionTmp) do
if v.GetFont and not normalFont then
normalFont = v:GetFont()
end
regionTmp[i] = nil
end
end
GameTooltip:Show()
end
if this.tooltipFunc then
391,7 → 620,9
end
self:Close(this.level.num + 1)
if not this.disabled then
if this.hasSlider then
if this.secure then
secureFrame:Activate(this)
elseif this.hasSlider then
OpenSlider(self, this)
elseif this.hasEditBox then
OpenEditBox(self, this)
408,10 → 639,25
if this.isRadio then
button.radioHighlight:Show()
end
if this.mouseoverUnderline then
underlineFrame:SetParent(this)
underlineFrame:SetPoint("BOTTOMLEFT",this.text,0,0)
underlineFrame:SetWidth(this.text:GetWidth())
underlineFrame:Show()
end
end
showGameTooltip(this)
end)
button:SetScript("OnHide", function()
if this.secure and secureFrame:IsOwnedBy(this) then
secureFrame:Deactivate()
end
end)
button:SetScript("OnLeave", function()
if this.secure and secureFrame:IsShown() then
return; -- it's ok, we didn't actually mouse out of the button, only onto the secure frame on top of it
end
underlineFrame:Hide()
if not this.selected then
highlight:Hide()
end
505,7 → 751,7
Dewdrop:Close(i+1)
end
value = levels[i].value
end
end
end
elseif this.closeWhenClicked then
self:Close()
532,14 → 778,14
arrow:SetWidth(16)
arrow:SetHeight(16)
arrow:SetTexture("Interface\\ChatFrame\\ChatFrameExpandArrow")
local colorSwatch = button:CreateTexture(nil, "OVERLAY")
local colorSwatch = button:CreateTexture(nil, "ARTWORK")
button.colorSwatch = colorSwatch
colorSwatch:SetWidth(20)
colorSwatch:SetHeight(20)
colorSwatch:SetTexture("Interface\\ChatFrame\\ChatFrameColorSwatch")
local texture = button:CreateTexture(nil, "OVERLAY")
colorSwatch.texture = texture
texture:SetTexture(1, 1, 1)
texture:SetTexture("Interface\\Buttons\\WHITE8X8")
texture:SetWidth(11.5)
texture:SetHeight(11.5)
texture:Show()
567,10 → 813,10
level.parented = true
level:ClearAllPoints()
if level.num == 1 then
if level.parent ~= UIParent then
if level.parent ~= UIParent and type(level.parent) == "table" then
level:SetPoint("TOPRIGHT", level.parent, "TOPLEFT")
else
level:SetPoint("CENTER", level.parent, "CENTER")
level:SetPoint("CENTER", UIParent, "CENTER")
end
else
if level.lastDirection == "RIGHT" then
668,7 → 914,7
end
end
end
local fullscreenFrame = GetFullScreenFrame()
local fullscreenFrame = GetUIPanel("fullscreen")
local l = levels[level]
local strata, framelevel = l:GetFrameStrata(), l:GetFrameLevel()
if fullscreenFrame then
692,8 → 938,8
local kind = options.type
if type(kind) ~= "string" then
return '"type" must be a string.', position
elseif kind ~= "group" and kind ~= "range" and kind ~= "text" and kind ~= "execute" and kind ~= "toggle" and kind ~= "color" and kind ~= "header" then
return '"type" must either be "range", "text", "group", "toggle", "execute", "color", or "header".', position
elseif kind ~= "group" and kind ~= "range" and kind ~= "text" and kind ~= "execute" and kind ~= "toggle" and kind ~= "color" and kind ~= "dragLink" and kind ~= "header" then
return '"type" must either be "range", "text", "group", "toggle", "execute", "color", "dragLink", or "header".', position
end
if options.aliases then
if type(options.aliases) ~= "table" and type(options.aliases) ~= "string" then
728,10 → 974,6
return '"func" must be a string or function', position
end
end
else
if kind == "group" then
return 'cannot have "type" = "group" as a subgroup of a passing group', position
end
end
if options ~= baseOptions then
if kind == "header" then
863,6 → 1105,13
return '"step" must be nonnegative', position
end
end
if options.bigStep then
if type(options.bigStep) ~= "number" then
return '"bigStep" must be a number', position
elseif options.bigStep < 0 then
return '"bigStep" must be nonnegative', position
end
end
if options.isPercent and options.isPercent ~= true then
return '"isPercent" must either be nil, true, or false', position
end
959,11 → 1208,78
t.timeout = 0
t.whileDead = 1
t.hideOnEscape = 1
 
 
Dewdrop:Close()
StaticPopup_Show("DEWDROP20_CONFIRM_DIALOG")
end
 
 
local function getMethod(settingname, handler, v, methodName, ...) -- "..." is simply returned straight out cause you can't do "a,b,c = 111,f(),222"
assert(v and type(v)=="table")
assert(methodName and type(methodName)=="string")
 
local method = v[methodName]
if type(method)=="function" then
return method, ...
elseif type(method)=="string" then
if not handler then
Dewdrop:error("[%s] 'handler' is required if providing a method name: %q", tostring(settingname), method)
elseif not handler[method] then
Dewdrop:error("[%s] 'handler' method %q not defined", tostring(settingname), method)
end
return handler[method], handler, ...
end
 
Dewdrop:error("[%s] Missing %q directive", tostring(settingname), methodName)
end
 
local function callMethod(settingname, handler, v, methodName, ...)
assert(v and type(v)=="table")
assert(methodName and type(methodName)=="string")
 
local method = v[methodName]
if type(method)=="function" then
local success, ret,ret2,ret3,ret4 = pcall(v[methodName], ...)
if not success then
geterrorhandler()(ret)
return nil
end
return ret,ret2,ret3,ret4
 
elseif type(method)=="string" then
 
local neg = method:match("^~(.-)$")
if neg then
method = neg
end
if not handler then
Dewdrop:error("[%s] 'handler' is required if providing a method name: %q", tostring(settingname), method)
elseif not handler[method] then
Dewdrop:error("[%s] 'handler' (%q) method %q not defined", tostring(settingname), handler.name or "(unnamed)", method)
end
local success, ret,ret2,ret3,ret4 = pcall(handler[method], handler, ...)
if not success then
geterrorhandler()(ret)
return nil
end
if neg then
return not ret
end
return ret,ret2,ret3,ret4
elseif method == false then
return nil
end
 
Dewdrop:error("[%s] Missing %q directive in %q", tostring(settingname), methodName, v.name or "(unnamed)")
end
 
local function skip1Nil(...)
if select(1,...)==nil then
return select(2,...)
end
return ...
end
 
function Dewdrop:FeedAceOptionsTable(options, difference)
self:argCheck(options, 2, "table")
self:argCheck(difference, 3, "nil", "number")
1002,7 → 1318,7
end
 
local current = level
while current do
while current do -- this traverses from higher level numbers to lower, building "values" with leaf nodes first and trunk nodes later
if current.num == difference + 1 then
break
end
1014,8 → 1330,16
local handler = options.handler
local passTable
local passValue
while #values > 0 do
passTable = options.pass and options or nil
while #values > 0 do -- This loop traverses values from the END (trunk nodes first, then onto leaf nodes)
if options.pass then
if options.get and options.set then
passTable = options
elseif not passTable then
passTable = options
end
else
passTable = nil
end
local value = table.remove(values)
options = options.args and options.args[value]
if not options then
1026,40 → 1350,16
end
 
if options.type == "group" then
local hidden, disabled = options.hidden
if hidden then
if type(hidden) == "function" then
hidden = hidden()
elseif type(hidden) == "string" then
local f = hidden
local neg = f:match("^~(.-)$")
if neg then
f = neg
end
hidden = handler[f](handler)
if neg then
hidden = not hidden
end
end
local hidden = options.hidden
if type(hidden) == "function" or type(hidden) == "string" then
hidden = callMethod(options.name or "(options root)", handler, options, "hidden", options.passValue) or false
end
if hidden then
return
end
local disabled = options.disabled
if disabled then
if type(disabled) == "function" then
disabled = disabled()
elseif type(disabled) == "string" then
local f = disabled
local neg = f:match("^~(.-)$")
if neg then
f = neg
end
hidden = handler[f](handler)
if neg then
disabled = not disabled
end
end
if type(disabled) == "function" or type(disabled) == "string" then
disabled = callMethod(options.name or "(options root)", handler, options, "disabled", options.passValue) or false
end
if disabled then
self:AddLine(
1071,7 → 1371,15
for k in pairs(options.args) do
table.insert(values, k)
end
passTable = options.pass and options or nil
if options.pass then
if options.get and options.set then
passTable = options
elseif not passTable then
passTable = options
end
else
passTable = nil
end
if not mysort then
mysort = function(a, b)
local alpha, bravo = mysort_args[a], mysort_args[b]
1081,7 → 1389,7
local bravo_name = bravo.guiName or bravo.name
if alpha_order == bravo_order then
if not alpha_name then
return true
return bravo_name
elseif not bravo_name then
return false
else
1114,55 → 1422,16
self:AddLine()
end
local hidden, disabled = v.guiHidden or v.hidden, v.disabled
if type(hidden) == "function" then
local success
success, hidden = pcall(hidden)
if not success then
geterrorhandler()(hidden)
hidden = false
end
elseif type(hidden) == "string" then
local f = hidden
local neg = f:match("^~(.-)$")
if neg then
f = neg
end
local success
success, hidden = pcall(handler[f], handler)
if not success then
geterrorhandler()(hidden)
hidden = false
end
if neg then
hidden = not hidden
end
 
if type(hidden) == "function" or type(hidden) == "string" then
hidden = callMethod(k, handler, v, "hidden", v.passValue) or false
end
if not hidden then
if type(disabled) == "function" then
local success
success, disabled = pcall(disabled)
if not success then
geterrorhandler()(disabled)
disabled = false
end
elseif type(disabled) == "string" then
local f = disabled
local neg = f:match("^~(.-)$")
if neg then
f = neg
end
local success
success, disabled = pcall(handler[f], handler)
if not success then
geterrorhandler()(disabled)
disabled = false
end
if neg then
disabled = not disabled
end
if type(disabled) == "function" or type(disabled) == "string" then
disabled = callMethod(k, handler, v, "disabled", v.passValue) or false
end
local name = (v.guiIconOnly and v.icon) and "" or (v.guiName or v.name)
local desc = v.desc
local desc = v.guiDesc or v.desc
local iconHeight = v.iconHeight or 16
local iconWidth = v.iconWidth or 16
local iconCoordLeft = v.iconCoordLeft
1181,63 → 1450,18
tooltipText = USAGE_TOOLTIP:format(v.usage)
end
end
local v_p = passTable or v
local passValue = passTable and k or nil
local v_p = passTable
if not v_p or (v.type ~= "execute" and v.get and v.set) or (v.type == "execute" and v.func) then
v_p = v
end
local passValue = v.passValue or (v_p~=v and k) or nil
if v.type == "toggle" then
local checked
local checked_arg
if type(v_p.get) == "function" then
local success, ret = pcall(v_p.get, passValue)
if success then
checked = ret
else
geterrorhandler()(ret)
checked = false
end
checked_arg = checked
else
local f = v_p.get
local neg = f:match("^~(.-)$")
if neg then
f = neg
end
if not handler[f] then
Dewdrop:error("Handler %q not available", f)
end
local success, ret = pcall(handler[f], handler, passValue)
if success then
checked = ret
else
geterrorhandler()(ret)
checked = false
end
checked_arg = checked
if neg then
checked = not checked
end
local checked = callMethod(name, handler, v_p, "get", passValue) or false
local checked_arg = checked
if type(v_p.get)=="string" and v_p.get:match("^~") then
checked_arg = not checked
end
local func, arg1, arg2, arg3
if type(v_p.set) == "function" then
func = v_p.set
if passValue then
arg1 = passValue
arg2 = not checked_arg
else
arg1 = not checked_arg
end
else
if not handler[v_p.set] then
Dewdrop:error("Handler %q not available", v_p.set)
end
func = handler[v_p.set]
arg1 = handler
if passValue then
arg2 = passValue
arg3 = not checked_arg
else
arg2 = not checked_arg
end
end
local func, arg1, arg2, arg3 = getMethod(name, handler, v_p, "set", skip1Nil(passValue, not checked_arg))
if v.guiNameIsMap then
checked = checked and true or false
name = tostring(v.map and v.map[checked]):gsub("|c%x%x%x%x%x%x%x%x(.-)|r", "%1")
1261,32 → 1485,11
local confirm = v.confirm
if confirm == true then
confirm = DEFAULT_CONFIRM_MESSAGE:format(tooltipText or tooltipTitle)
end
if type(v_p.func) == "function" then
if confirm then
func = confirmPopup
arg1 = confirm
arg2 = v_p.func
arg3 = passValue
else
func = v_p.func
arg1 = passValue
end
func,arg1,arg2,arg3,arg4 = confirmPopup, confirm, getMethod(name, handler, v_p, "func", passValue)
elseif type(confirm) == "string" then
func,arg1,arg2,arg3,arg4 = confirmPopup, confirm, getMethod(name, handler, v_p, "func", passValue)
else
if not handler[v_p.func] then
Dewdrop:error("Handler %q not available", v_p.func)
end
if confirm then
func = confirmPopup
arg1 = confirm
arg2 = handler[v_p.func]
arg3 = handler
arg4 = passValue
else
func = handler[v_p.func]
arg1 = handler
arg2 = passValue
end
func,arg1,arg2 = getMethod(name, handler, v_p, "func", passValue)
end
self:AddLine(
'text', name,
1309,38 → 1512,13
)
elseif v.type == "range" then
local sliderValue
if type(v_p.get) == "function" then
local success, ret = pcall(v_p.get, passValue)
if success then
sliderValue = ret
else
geterrorhandler()(ret)
sliderValue = 0
end
sliderValue = callMethod(name, handler, v_p, "get", passValue) or 0
local sliderFunc, sliderArg1, sliderArg2 = getMethod(name, handler, v_p, "set", passValue)
if tooltipText then
tooltipText = format("%s\n\n%s", tooltipText, RANGE_TOOLTIP)
else
if not handler[v_p.get] then
Dewdrop:error("Handler %q not available", v_p.get)
end
local success, ret = pcall(handler[v_p.get], handler, passValue)
if success then
sliderValue = ret
else
geterrorhandler()(ret)
sliderValue = 0
end
tooltipText = RANGE_TOOLTIP
end
local sliderFunc, sliderArg1, sliderArg2
if type(v_p.set) == "function" then
sliderFunc = v_p.set
sliderArg1 = passValue
else
if not handler[v_p.set] then
Dewdrop:error("Handler %q not available", v_p.set)
end
sliderFunc = handler[v_p.set]
sliderArg1 = handler
sliderArg2 = passValue
end
self:AddLine(
'text', name,
'hasArrow', true,
1348,11 → 1526,13
'sliderMin', v.min or 0,
'sliderMax', v.max or 1,
'sliderStep', v.step or 0,
'sliderBigStep', v.bigStep or nil,
'sliderIsPercent', v.isPercent or false,
'sliderValue', sliderValue,
'sliderFunc', sliderFunc,
'sliderArg1', sliderArg1,
'sliderArg2', sliderArg2,
'fromAceOptions', true,
'disabled', disabled,
'tooltipTitle', tooltipTitle,
'tooltipText', tooltipText,
1365,37 → 1545,11
'iconCoordBottom', iconCoordBottom
)
elseif v.type == "color" then
local r,g,b,a
if type(v_p.get) == "function" then
local success
success, r, g, b, a = pcall(v_p.get, passValue)
if not success then
geterrorhandler()(r)
r, g, b, a = 0, 0, 0, 0
end
else
if not handler[v_p.get] then
Dewdrop:error("Handler %q not available", v_p.get)
end
local success
success, r, g, b, a = pcall(handler[v_p.get], handler, passValue)
if not success then
geterrorhandler()(r)
r, g, b, a = 0, 0, 0, 0
end
local r,g,b,a = callMethod(name, handler, v_p, "get", passValue)
if not r then
r,g,b,a = 0,0,0,0
end
local colorFunc, colorArg1, colorArg2
if type(v_p.set) == "function" then
colorFunc = v_p.set
colorArg1 = passValue
else
if not handler[v_p.set] then
Dewdrop:error("Handler %q not available", v_p.set)
end
colorFunc = handler[v_p.set]
colorArg1 = handler
colorArg2 = passValue
end
local colorFunc, colorArg1, colorArg2 = getMethod(name, handler, v_p, "set", passValue)
self:AddLine(
'text', name,
'hasArrow', true,
1413,12 → 1567,25
'tooltipText', tooltipText
)
elseif v.type == "text" then
if type(v.validate) == "table" then
if type(v.validate) == "table" then
local func,arg1,arg2
if v.onClick then
func,arg1,arg2 = getMethod(name, handler, v, "onClick", passValue)
end
local checked
if v.isChecked then
checked = callMethod(name, handler, v, "isChecked", passValue) or false
end
self:AddLine(
'text', name,
'hasArrow', true,
'value', k,
'func', func,
'arg1', arg1,
'arg2', arg2,
'mouseoverUnderline', func and true or nil,
'disabled', disabled,
'checked', checked,
'tooltipTitle', tooltipTitle,
'tooltipText', tooltipText,
'icon', v.icon,
1431,61 → 1598,23
)
else
local editBoxText
if type(v_p.get) == "function" then
local success, ret = pcall(v_p.get, passValue)
if success then
editBoxText = ret
else
geterrorhandler()(ret)
editBoxText = ""
end
elseif v_p.get == false then
editBoxText = nil
else
if not handler[v_p.get] then
Dewdrop:error("Handler %q not available", v_p.get)
end
local success, ret = pcall(handler[v_p.get], handler, passValue)
if success then
editBoxText = ret
else
geterrorhandler()(ret)
editBoxText = ""
end
end
local editBoxFunc, editBoxArg1, editBoxArg2
if type(v_p.set) == "function" then
editBoxFunc = v_p.set
editBoxArg1 = passValue
else
if not handler[v_p.set] then
Dewdrop:error("Handler %q not available", v_p.set)
end
editBoxFunc = handler[v_p.set]
editBoxArg1 = handler
editBoxArg2 = passValue
end
 
editBoxText = callMethod(name, handler, v_p, "get", passValue) or ""
local editBoxFunc, editBoxArg1, editBoxArg2 = getMethod(name, handler, v_p, "set", passValue)
 
local editBoxValidateFunc, editBoxValidateArg1
 
if v.validate and v.validate ~= "keybinding" then
if type(v.validate) == "function" then
editBoxValidateFunc = v.validate
else
if not handler[v.validate] then
Dewdrop:error("Handler %q not available", v.validate)
if v.validate == "keybinding" then
if tooltipText then
tooltipText = format("%s\n\n%s", tooltipText, RESET_KEYBINDING_DESC)
else
tooltipText = RESET_KEYBINDING_DESC
end
editBoxValidateFunc = handler[v.validate]
editBoxValidateArg1 = handler
end
elseif v.validate then
if tooltipText then
tooltipText = tooltipText .. "\n\n" .. RESET_KEYBINDING_DESC
else
tooltipText = RESET_KEYBINDING_DESC
editBoxValidateFunc, editBoxValidateArg1 = getMethod(name, handler, v, "validate") -- no passvalue!
end
end
 
 
self:AddLine(
'text', name,
'hasArrow', true,
1512,11 → 1641,24
)
end
elseif v.type == "group" then
local func,arg1,arg2
if v.onClick then
func,arg1,arg2 = getMethod(name, handler, v, "onClick", passValue)
end
local checked
if v.isChecked then
checked = callMethod(name, handler, v, "isChecked", passValue) or false
end
self:AddLine(
'text', name,
'hasArrow', true,
'value', k,
'func', func,
'arg1', arg1,
'arg2', arg2,
'mouseoverUnderline', func and true or nil,
'disabled', disabled,
'checked', checked,
'tooltipTitle', tooltipTitle,
'tooltipText', tooltipText,
'icon', v.icon,
1558,17 → 1700,16
end
elseif options.type == "text" and type(options.validate) == "table" then
local current
local options_p = passTable or options
local multiToggle = options_p.multiToggle
local options_p = passTable
if not options_p or (options.get and options.set) then
options_p = options
passTable = nil
passValue = nil
end
local multiToggle = options.multiToggle
local passValue = options.passValue or passValue
if not multiToggle then
if type(options_p.get) == "function" then
current = options_p.get(passValue)
elseif options_p.get ~= false then
if not handler[options_p.get] then
Dewdrop:error("Handler %q not available", options_p.get)
end
current = handler[options_p.get](handler, passValue)
end
current = callMethod(k, handler, options_p, "get", passValue)
end
local indexed = true
for k,v in pairs(options.validate) do
1592,46 → 1733,10
if type(k) == "number" then
k = v
end
local func, arg1, arg2, arg3, arg4
if type(options_p.set) == "function" then
func = options_p.set
if passValue then
arg1 = passValue
arg2 = k
else
arg1 = k
end
else
if not handler[options_p.set] then
Dewdrop:error("Handler %q not available", options_p.set)
end
func = handler[options_p.set]
arg1 = handler
if passValue then
arg2 = passValue
arg3 = k
else
arg2 = k
end
end
local func, arg1, arg2, arg3, arg4 = getMethod(k, handler, options_p, "set", skip1Nil(passValue, k))
local checked
if multiToggle then
if type(options_p.get) == "function" then
if passValue == nil then
checked = options_p.get(k)
else
checked = options_p.get(passValue, k)
end
elseif options_p.get ~= false then
if not handler[options_p.get] then
Dewdrop:error("Handler %q not available", options_p.get)
end
if passValue == nil then
checked = handler[options_p.get](handler, k)
else
checked = handler[options_p.get](handler, passValue, k)
end
end
checked = callMethod(k, handler, options_p, "get", skip1Nil(passValue, k)) or false
if arg2 == nil then
arg2 = not checked
elseif arg3 == nil then
1645,6 → 1750,15
func, arg1, arg2, arg3, arg4 = nil, nil, nil, nil, nil
end
end
local tooltipTitle
local tooltipText
if options.validateDesc then
tooltipTitle = v
tooltipText = options.validateDesc[k]
else
tooltipTitle = options.guiName or options.name
tooltipText = v
end
self:AddLine(
'text', v,
'func', func,
1654,8 → 1768,8
'arg4', arg4,
'isRadio', not multiToggle,
'checked', checked,
'tooltipTitle', options.guiName or options.name,
'tooltipText', v
'tooltipTitle', tooltipTitle,
'tooltipText', tooltipText
)
end
for k in pairs(values) do
1667,6 → 1781,65
return true
end
 
function Dewdrop:FeedTable(s, difference)
self:argCheck(s, 2, "table")
self:argCheck(difference, 3, "nil", "number")
if not currentLevel then
self:error("Cannot call `FeedTable' outside of a Dewdrop declaration")
end
if not difference then
difference = 0
end
local level = levels[currentLevel]
if not level then
self:error("Improper level given")
end
if not values then
values = {}
else
for k,v in pairs(values) do
values[k] = nil
end
end
local t = s.subMenu and s or {subMenu = s}
local current = level
while current do
if current.num == difference + 1 then
break
end
table.insert(values, current.value)
current = levels[current.num - 1]
end
 
while #values > 0 do
local value = table.remove(values)
t = t.subMenu and t.subMenu[value]
if not t then
return
end
end
 
if t.subMenu or current.num == 1 then
for k in pairs(t.subMenu) do
table.insert(values, k)
end
table.sort(values)
for _,k in ipairs(values) do
local argTable = {"value", k}
for key, val in pairs(t.subMenu[k]) do
table.insert(argTable, key)
table.insert(argTable, val)
end
self:AddLine(unpack(argTable))
end
for k in pairs(values) do
values[k] = nil
end
return false
end
return true
end
 
function Refresh(self, level)
if type(level) == "number" then
level = levels[level]
1726,14 → 1899,20
end
 
function Dewdrop:Refresh(level)
self:argCheck(level, 2, "number")
Refresh(self, levels[level])
self:argCheck(level, 2, "number", "nil")
if not level then
for k,v in pairs(levels) do
Refresh(self, v)
end
else
Refresh(self, levels[level])
end
end
 
function OpenSlider(self, parent)
if not sliderFrame then
sliderFrame = CreateFrame("Frame", nil, nil)
sliderFrame:SetWidth(80)
sliderFrame:SetWidth(100)
sliderFrame:SetHeight(170)
sliderFrame:SetScale(UIParent:GetScale())
sliderFrame:SetBackdrop(tmp(
1756,13 → 1935,14
sliderFrame:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b)
sliderFrame:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b)
sliderFrame:EnableMouse(true)
sliderFrame:EnableMouseWheel(true)
sliderFrame:Hide()
sliderFrame:SetPoint("CENTER", UIParent, "CENTER")
local slider = CreateFrame("Slider", nil, sliderFrame)
sliderFrame.slider = slider
slider:SetOrientation("VERTICAL")
slider:SetMinMaxValues(0, 1)
slider:SetValueStep(0.01)
slider:SetValueStep(0.000000001)
slider:SetValue(0.5)
slider:SetWidth(16)
slider:SetHeight(128)
1792,13 → 1972,29
text:SetFontObject(GameFontGreenSmall)
text:SetText("0%")
text:SetPoint("TOP", slider, "BOTTOM")
local text = slider:CreateFontString(nil, "ARTWORK")
sliderFrame.currentText = text
text:SetFontObject(GameFontHighlightSmall)
text:SetText("50%")
text:SetPoint("LEFT", slider, "RIGHT")
text:SetPoint("RIGHT", sliderFrame, "RIGHT", -6, 0)
text:SetJustifyH("CENTER")
local editBox = CreateFrame("EditBox", nil, sliderFrame)
sliderFrame.currentText = editBox
editBox:SetFontObject(ChatFontNormal)
editBox:SetHeight(13)
editBox:SetPoint("RIGHT", sliderFrame, "RIGHT", -16, 0)
editBox:SetPoint("LEFT", slider, "RIGHT", 12, 0)
editBox:SetText("50%")
editBox:SetJustifyH("CENTER")
 
local width = editBox:GetWidth()/2 + 10
local left = editBox:CreateTexture(nil, "BACKGROUND")
left:SetTexture("Interface\\ChatFrame\\UI-ChatInputBorder-Left")
left:SetTexCoord(0, width / 256, 0, 1)
left:SetWidth(width)
left:SetHeight(32)
left:SetPoint("LEFT", editBox, "LEFT", -10, 0)
local right = editBox:CreateTexture(nil, "BACKGROUND")
right:SetTexture("Interface\\ChatFrame\\UI-ChatInputBorder-Right")
right:SetTexCoord(1 - width / 256, 1, 0, 1)
right:SetWidth(width)
right:SetHeight(32)
right:SetPoint("RIGHT", editBox, "RIGHT", 10, 0)
 
local changed = false
local inside = false
slider:SetScript("OnValueChanged", function()
1810,7 → 2006,12
if sliderFrame.parent and sliderFrame.parent.sliderFunc then
local min = sliderFrame.parent.sliderMin or 0
local max = sliderFrame.parent.sliderMax or 1
local step = sliderFrame.parent.sliderStep or (max - min) / 100
local step
if sliderFrame.fineStep then
step = sliderFrame.parent.sliderStep or (max - min) / 100
else
step = sliderFrame.parent.sliderBigStep or sliderFrame.parent.sliderStep or (max - min) / 100
end
local value = (1 - slider:GetValue()) * (max - min) + min
if step > 0 then
value = math.floor((value - min) / step + 0.5) * step + min
1825,7 → 2026,9
end
sliderFrame.lastValue = value
local text = sliderFrame.parent.sliderFunc(getArgs(sliderFrame.parent, 'sliderArg', 1, value))
if text then
if sliderFrame.parent.fromAceOptions then
text = nil
elseif type(text) == "string" or type(text) == "number" then
sliderFrame.currentText:SetText(text)
done = true
end
1833,7 → 2036,12
if not done then
local min = sliderFrame.parent.sliderMin or 0
local max = sliderFrame.parent.sliderMax or 1
local step = sliderFrame.parent.sliderStep or (max - min) / 100
local step
if sliderFrame.fineStep then
step = sliderFrame.parent.sliderStep or (max - min) / 100
else
step = sliderFrame.parent.sliderBigStep or sliderFrame.parent.sliderStep or (max - min) / 100
end
local value = (1 - slider:GetValue()) * (max - min) + min
if step > 0 then
value = math.floor((value - min) / step + 0.5) * step + min
1856,14 → 2064,38
end
end
end)
sliderFrame:SetScript("OnEnter", function()
local function onEnter()
StopCounting(self, sliderFrame.level)
showGameTooltip(sliderFrame.parent)
end)
end
local function onLeave()
GameTooltip:Hide()
end
sliderFrame:SetScript("OnEnter", onEnter)
sliderFrame:SetScript("OnLeave", function()
StartCounting(self, sliderFrame.level)
GameTooltip:Hide()
if changed then
local parent = sliderFrame.parent
local sliderFunc = parent.sliderFunc
for i = 1, sliderFrame.level - 1 do
Refresh(self, levels[i])
end
local newParent
for _,button in ipairs(levels[sliderFrame.level-1].buttons) do
if button.sliderFunc == sliderFunc then
newParent = button
break
end
end
if newParent then
OpenSlider(self, newParent)
else
sliderFrame:Hide()
end
end
end)
editBox:SetScript("OnEnter", onEnter)
editBox:SetScript("OnLeave", onLeave)
slider:SetScript("OnMouseDown", function()
sliderFrame.mouseDown = true
GameTooltip:Hide()
1900,7 → 2132,6
end)
slider:SetScript("OnLeave", function()
inside = false
StartCounting(self, sliderFrame.level)
GameTooltip:Hide()
if changed and not sliderFrame.mouseDown then
local parent = sliderFrame.parent
1920,14 → 2151,79
else
sliderFrame:Hide()
end
 
changed = false
end
end)
sliderFrame:SetScript("OnMouseWheel", function(t, a1)
local arg1 = a1 or arg1
local up = arg1 > 0
 
local min = sliderFrame.parent.sliderMin or 0
local max = sliderFrame.parent.sliderMax or 1
local step = sliderFrame.parent.sliderStep or (max - min) / 100
if step <= 0 then
step = (max - min) / 100
end
 
local value = (1 - slider:GetValue()) * (max - min) + min
if up then
value = value + step
else
value = value - step
end
if value > max then
value = max
elseif value < min then
value = min
end
sliderFrame.fineStep = true
if max<=min then
slider:SetValue(0)
else
slider:SetValue(1 - (value - min) / (max - min))
end
sliderFrame.fineStep = nil
end)
slider:SetScript("OnMouseWheel", sliderFrame:GetScript("OnMouseWheel"))
editBox:SetScript("OnEnterPressed", function(t, a1)
local value = editBox:GetNumber()
 
if sliderFrame.parent.sliderIsPercent then
value = value / 100
end
 
local min = sliderFrame.parent.sliderMin or 0
local max = sliderFrame.parent.sliderMax or 1
 
if value > max then
value = max
elseif value < min then
value = min
end
sliderFrame.fineStep = true
if max <= min then
slider:SetValue(0)
else
slider:SetValue(1 - (value - min) / (max - min))
end
sliderFrame.fineStep = nil
 
StartCounting(self, sliderFrame.level)
end)
editBox:SetScript("OnEscapePressed", function()
self:Close(sliderFrame.level)
StartCounting(self, sliderFrame.level)
end)
editBox:SetAutoFocus(false)
end
sliderFrame.parent = parent
sliderFrame.level = parent.level.num + 1
sliderFrame.parentValue = parent.level.value
sliderFrame:SetFrameLevel(parent.level:GetFrameLevel() + 3)
sliderFrame.slider:SetFrameLevel(sliderFrame:GetFrameLevel() + 1)
sliderFrame.currentText:SetFrameLevel(sliderFrame:GetFrameLevel() + 1)
sliderFrame.currentText:ClearFocus()
sliderFrame.changing = true
if not parent.sliderMin or not parent.sliderMax then
return
1945,24 → 2241,35
if not parent.sliderValue then
parent.sliderValue = (parent.sliderMin + parent.sliderMax) / 2
end
sliderFrame.slider:SetValue(1 - (parent.sliderValue - parent.sliderMin) / (parent.sliderMax - parent.sliderMin))
if parent.sliderMax <= parent.sliderMin then
sliderFrame.slider:SetValue(0)
else
sliderFrame.slider:SetValue(1 - (parent.sliderValue - parent.sliderMin) / (parent.sliderMax - parent.sliderMin))
end
sliderFrame.changing = false
sliderFrame.bottomText:SetText(parent.sliderMinText or "0")
sliderFrame.topText:SetText(parent.sliderMaxText or "1")
local text
if parent.sliderFunc then
if parent.sliderFunc and not parent.fromAceOptions then
text = parent.sliderFunc(getArgs(parent, 'sliderArg', 1, parent.sliderValue))
end
if text then
if type(text) == "number" or type(text) == "string" then
sliderFrame.currentText:SetText(text)
elseif parent.sliderIsPercent then
sliderFrame.currentText:SetText(string.format("%.0f%%", parent.sliderValue * 100))
else
sliderFrame.currentText:SetText(parent.sliderValue)
if parent.sliderStep < 0.1 then
sliderFrame.currentText:SetText(string.format("%.2f", parent.sliderValue))
elseif parent.sliderStep < 1 then
sliderFrame.currentText:SetText(string.format("%.1f", parent.sliderValue))
else
sliderFrame.currentText:SetText(string.format("%.0f", parent.sliderValue))
end
end
 
 
sliderFrame.lastValue = parent.sliderValue
 
 
local level = parent.level
sliderFrame:Show()
sliderFrame:ClearAllPoints()
2074,7 → 2381,7
right:SetWidth(100)
right:SetHeight(32)
right:SetPoint("RIGHT", editBox, "RIGHT", 10, 0)
 
 
editBox:SetScript("OnEnterPressed", function()
if editBoxFrame.parent and editBoxFrame.parent.editBoxValidateFunc then
local t = editBox.realText or editBox:GetText() or ""
2127,7 → 2434,7
end
if text ~= oldText then
changing = true
self:SetText(text)
self:SetText(tostring(text))
changing = false
skipNext = true
end
2171,7 → 2478,7
Screenshot()
return
end
 
 
if arg1 == "LeftButton" then
arg1 = "BUTTON1"
elseif arg1 == "RightButton" then
2256,7 → 2563,7
editBoxFrame.editBox:SetFrameLevel(editBoxFrame:GetFrameLevel() + 1)
editBoxFrame.editBox.realText = nil
editBoxFrame:SetClampedToScreen(false)
 
 
editBoxFrame.editBox:SpecialSetText("")
if parent.editBoxIsKeybinding then
local s = parent.editBoxText
2282,7 → 2589,7
else
editBoxFrame.editBox:SpecialSetText(parent.editBoxText)
end
 
 
editBoxFrame.editBox.keybinding = parent.editBoxIsKeybinding
editBoxFrame.editBox.keybindingOnly = parent.editBoxKeybindingOnly
editBoxFrame.editBox.keybindingExcept = parent.editBoxKeybindingExcept
2420,7 → 2727,7
end
 
function Dewdrop:IsOpen(parent)
self:argCheck(parent, 2, "table", "nil")
self:argCheck(parent, 2, "table", "string", "nil")
return levels[1] and levels[1]:IsShown() and (not parent or parent == levels[1].parent or parent == levels[1]:GetParent())
end
 
2437,7 → 2744,9
DewdropLib:GetInstance('1.0'):Close()
end
end
parent:GetCenter()
if type(parent) == "table" then
parent:GetCenter()
end
local frame = AcquireLevel(self, level)
if level == 1 then
frame.lastDirection = "RIGHT"
2459,7 → 2768,7
-- levels[level].parentTooltipTitle = parent.tooltipTitle
-- levels[level].parentTooltipText = parent.tooltipText
-- levels[level].parentTooltipFunc = parent.tooltipFunc
if parent.arrow then
if type(parent) == "table" and parent.arrow then
-- parent.arrow:SetVertexColor(0.2, 0.6, 0)
-- parent.arrow:SetHeight(24)
-- parent.arrow:SetWidth(24)
2483,7 → 2792,7
point, relativePoint = point .. "RIGHT", relativePoint .. "LEFT"
end
end
frame:SetPoint(point, parent, relativePoint)
frame:SetPoint(point, type(parent) == "table" and parent or UIParent, relativePoint)
if cursorX and cursorY then
local left = frame:GetLeft()
local width = frame:GetWidth()
2512,7 → 2821,7
if curX > GetScreenWidth() / 2 then
xOffset = -width
end
frame:SetPoint(point, parent, relativePoint, curX - left + xOffset, curY - bottom + yOffset)
frame:SetPoint(point, type(parent) == "table" and parent or UIParent, relativePoint, curX - left + xOffset, curY - bottom + yOffset)
if level == 1 then
frame.lastDirection = "RIGHT"
end
2535,7 → 2844,7
point = "RIGHT"
end
end
frame:SetPoint(point, parent, relativePoint, curX - left - width / 2, 0)
frame:SetPoint(point, type(parent) == "table" and parent or UIParent, relativePoint, curX - left - width / 2, 0)
if level == 1 then
frame.lastDirection = "RIGHT"
end
2558,7 → 2867,7
point = "TOP"
end
end
frame:SetPoint(point, parent, relativePoint, 0, curY - bottom - height / 2)
frame:SetPoint(point, type(parent) == "table" and parent or UIParent, relativePoint, 0, curY - bottom - height / 2)
if level == 1 then
frame.lastDirection = "DOWN"
end
2590,19 → 2899,19
end
 
function Dewdrop:IsRegistered(parent)
self:argCheck(parent, 2, "table")
self:argCheck(parent, 2, "table", "string")
return not not self.registry[parent]
end
 
function Dewdrop:Register(parent, ...)
self:argCheck(parent, 2, "table")
self:argCheck(parent, 2, "table", "string")
if self.registry[parent] then
self:Unregister(parent)
end
local info = new(...)
if type(info.children) == "table" then
local err, position = validateOptions(info.children)
 
 
if err then
if position then
Dewdrop:error(position .. ": " .. err)
2612,12 → 2921,12
end
end
self.registry[parent] = info
if not info.dontHook and not self.onceRegistered[parent] then
if not info.dontHook and not self.onceRegistered[parent] and type(parent) == "table" then
if parent:HasScript("OnMouseUp") then
local script = parent:GetScript("OnMouseUp")
parent:SetScript("OnMouseUp", function()
parent:SetScript("OnMouseUp", function(this, ...)
if script then
script()
script(this, ...)
end
if arg1 == "RightButton" and self.registry[parent] then
if self:IsOpen(parent) then
2630,9 → 2939,9
end
if parent:HasScript("OnMouseDown") then
local script = parent:GetScript("OnMouseDown")
parent:SetScript("OnMouseDown", function()
parent:SetScript("OnMouseDown", function(this, ...)
if script then
script()
script(this, ...)
end
if self.registry[parent] then
self:Close()
2644,18 → 2953,20
end
 
function Dewdrop:Unregister(parent)
self:argCheck(parent, 2, "table")
self:argCheck(parent, 2, "table", "string")
self.registry[parent] = nil
end
 
function Dewdrop:Open(parent, ...)
self:argCheck(parent, 2, "table")
self:argCheck(parent, 2, "table", "string")
local info
local k1 = ...
if type(k1) == "table" and k1[0] and k1.IsFrameType and self.registry[k1] then
info = tmp()
info = tmp(select(2, ...))
for k,v in pairs(self.registry[k1]) do
info[k] = v
if info[k] == nil then
info[k] = v
end
end
else
info = tmp(...)
2737,6 → 3048,19
end
end
 
function Dewdrop:AddSeparator(level)
level = levels[level or currentLevel]
if not level or not level.buttons then return; end
 
local prevbutton = level.buttons[#level.buttons]
if not prevbutton then return; end
 
if prevbutton.disabled and prevbutton.text:GetText() == "" then
return
end
self:AddLine("text", "", "disabled", true)
end
 
function Dewdrop:AddLine(...)
local info = tmp(...)
local level = info.level or currentLevel
2745,7 → 3069,7
if not next(info) then
info.disabled = true
end
button.disabled = info.isTitle or info.notClickable or info.disabled
button.disabled = info.isTitle or info.notClickable or info.disabled or (self.combat and info.secure)
button.isTitle = info.isTitle
button.notClickable = info.notClickable
if button.isTitle then
2775,6 → 3099,7
button.notCheckable = info.notCheckable
button.text:SetPoint("LEFT", button, "LEFT", button.notCheckable and 0 or 24, 0)
button.checked = not info.notCheckable and info.checked
button.mouseoverUnderline = info.mouseoverUnderline
button.isRadio = not info.notCheckable and info.isRadio
if info.isRadio then
button.check:Show()
2831,6 → 3156,7
end
if not button.disabled then
button.func = info.func
button.secure = info.secure
end
button.hasColorSwatch = info.hasColorSwatch
if button.hasColorSwatch then
2839,7 → 3165,7
button.r = info.r or 1
button.g = info.g or 1
button.b = info.b or 1
button.colorSwatch.texture:SetTexture(button.r, button.g, button.b)
button.colorSwatch.texture:SetVertexColor(button.r, button.g, button.b)
button.checked = false
button.func = nil
button.colorFunc = info.colorFunc
2867,11 → 3193,16
button.sliderMin = info.sliderMin or 0
button.sliderMax = info.sliderMax or 1
button.sliderStep = info.sliderStep or 0
button.sliderBigStep = info.sliderBigStep or button.sliderStep
if button.sliderBigStep < button.sliderStep then
button.sliderBigStep = button.sliderStep
end
button.sliderIsPercent = info.sliderIsPercent and true or false
button.sliderMinText = info.sliderMinText or button.sliderIsPercent and string.format("%.0f%%", button.sliderMin * 100) or button.sliderMin
button.sliderMaxText = info.sliderMaxText or button.sliderIsPercent and string.format("%.0f%%", button.sliderMax * 100) or button.sliderMax
button.sliderFunc = info.sliderFunc
button.sliderValue = info.sliderValue
button.fromAceOptions = info.fromAceOptions
local i = 1
while true do
local k = "sliderArg" .. i
2990,23 → 3321,9
options.handler = handler
local class = handler.class
if not AceLibrary:HasInstance("AceOO-2.0") or not class then
self:error("Cannot retrieve AceOptions tables from a non-object argument #2")
end
while class and class ~= AceLibrary("AceOO-2.0").Class do
if type(class.GetAceOptionsDataTable) == "function" then
local t = class:GetAceOptionsDataTable(handler)
for k,v in pairs(t) do
if type(options.args) ~= "table" then
options.args = {}
end
if options.args[k] == nil then
options.args[k] = v
end
end
end
local mixins = class.mixins
if mixins then
for mixin in pairs(mixins) do
if Rock then
-- possible Rock object
for mixin in Rock:IterateObjectMixins(handler) do
if type(mixin.GetAceOptionsDataTable) == "function" then
local t = mixin:GetAceOptionsDataTable(handler)
for k,v in pairs(t) do
3020,11 → 3337,62
end
end
end
class = class.super
else
-- Ace2 object
while class and class ~= AceLibrary("AceOO-2.0").Class do
if type(class.GetAceOptionsDataTable) == "function" then
local t = class:GetAceOptionsDataTable(handler)
for k,v in pairs(t) do
if type(options.args) ~= "table" then
options.args = {}
end
if options.args[k] == nil then
options.args[k] = v
end
end
end
local mixins = class.mixins
if mixins then
for mixin in pairs(mixins) do
if type(mixin.GetAceOptionsDataTable) == "function" then
local t = mixin:GetAceOptionsDataTable(handler)
for k,v in pairs(t) do
if type(options.args) ~= "table" then
options.args = {}
end
if options.args[k] == nil then
options.args[k] = v
end
end
end
end
end
class = class.super
end
end
return options
end
 
function Dewdrop:OnTooltipHide()
if lastSetFont then
if lastSetFont == normalFont then
lastSetFont = nil
return
end
fillRegionTmp(GameTooltip:GetRegions())
for i,v in ipairs(regionTmp) do
if v.GetFont then
local font,size,outline = v:GetFont()
if font == lastSetFont then
v:SetFont(normalFont, size, outline)
end
end
regionTmp[i] = nil
end
lastSetFont = nil
end
end
 
local function activate(self, oldLib, oldDeactivate)
Dewdrop = self
if oldLib and oldLib.registry then
3037,20 → 3405,20
local WorldFrame_OnMouseDown = WorldFrame:GetScript("OnMouseDown")
local WorldFrame_OnMouseUp = WorldFrame:GetScript("OnMouseUp")
local oldX, oldY, clickTime
WorldFrame:SetScript("OnMouseDown", function()
WorldFrame:SetScript("OnMouseDown", function(this, ...)
oldX,oldY = GetCursorPosition()
clickTime = GetTime()
if WorldFrame_OnMouseDown then
WorldFrame_OnMouseDown()
WorldFrame_OnMouseDown(this, ...)
end
end)
 
WorldFrame:SetScript("OnMouseUp", function()
WorldFrame:SetScript("OnMouseUp", function(this, ...)
local x,y = GetCursorPosition()
if not oldX or not oldY or not x or not y or not clickTime then
self:Close()
if WorldFrame_OnMouseUp then
WorldFrame_OnMouseUp()
WorldFrame_OnMouseUp(this, ...)
end
return
end
3059,7 → 3427,7
self:Close()
end
if WorldFrame_OnMouseUp then
WorldFrame_OnMouseUp()
WorldFrame_OnMouseUp(this, ...)
end
end)
 
3068,13 → 3436,13
self:Close()
end
end)
 
 
hooksecurefunc("HideDropDownMenu", function()
if levels[1] and levels[1]:IsVisible() then
self:Close()
end
end)
 
 
hooksecurefunc("CloseDropDownMenus", function()
if levels[1] and levels[1]:IsVisible() then
local stack = debugstack()
3091,11 → 3459,28
self.frame:Hide()
self.frame:SetScript("OnEvent", function(this, event)
this:Show()
if event=="PLAYER_REGEN_ENABLED" then -- track combat state for secure frame operations
self.combat = false
elseif event=="PLAYER_REGEN_DISABLED" then
self.combat = true
end
end)
self.frame:SetScript("OnUpdate", function(this)
this:Hide()
self:Refresh(1)
end)
self.hookedTooltip = true
if not oldLib or not oldLib.hookedTooltip then
local OnTooltipHide = GameTooltip:GetScript("OnHide")
GameTooltip:SetScript("OnHide", function(this, ...)
if OnTooltipHide then
OnTooltipHide(this, ...)
end
if type(self.OnTooltipHide) == "function" then
self:OnTooltipHide()
end
end)
end
levels = {}
buttons = {}
 
3104,4 → 3489,10
end
end
 
AceLibrary:Register(Dewdrop, MAJOR_VERSION, MINOR_VERSION, activate)
local function external(lib, major, instance)
if major == "LibSharedMedia-3.0" then
SharedMedia = instance
end
end
 
AceLibrary:Register(Dewdrop, MAJOR_VERSION, MINOR_VERSION, activate, nil, external)
trunk/FuBar_RecapFu/libs/AceOO-2.0/AceOO-2.0.toc New file
0,0 → 1,16
## 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: AceOO-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.lua
Property changes : Added: svn:eol-style + native
trunk/FuBar_RecapFu/libs/AceOO-2.0/AceOO-2.0.lua
1,18 → 1,18
--[[
Name: AceOO-2.0
Revision: $Rev: 25921 $
Revision: $Rev: 1091 $
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/
Documentation: http://www.wowace.com/index.php/AceOO-2.0
SVN: http://svn.wowace.com/root/trunk/Ace2/AceOO-2.0
SVN: http://svn.wowace.com/wowace/trunk/Ace2/AceOO-2.0
Description: Library to provide an object-orientation framework.
Dependencies: AceLibrary
License: MIT
]]
 
local MAJOR_VERSION = "AceOO-2.0"
local MINOR_VERSION = "$Revision: 25921 $"
local MINOR_VERSION = 90000 + tonumber(("$Revision: 1091 $"):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
27,20 → 27,14
-- @brief Obtain a unique string identifier for the object in question.
-- @param t The object to obtain the uid for.
-- @return The uid string.
local function pad(cap)
return ("0"):rep(8 - cap:len()) .. cap
end
local function getuid(t)
local mt = getmetatable(t)
setmetatable(t, nil)
local str = tostring(t)
setmetatable(t, mt)
local cap = str:match("[^:]*: 0x(.*)$")
if not cap then
cap = str:match("[^:]*: (.*)$")
end
local cap = str:match("[^:]*: 0x(.*)$") or str:match("[^:]*: (.*)$")
if cap then
return pad(cap)
return ("0"):rep(8 - #cap) .. cap
end
end
 
trunk/FuBar_RecapFu/libs/AceLocale-2.2/AceLocale-2.2.lua
1,11 → 1,11
--[[
Name: AceLocale-2.2
Revision: $Rev: 27198 $
Revision: $Rev: 1094 $
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/
Documentation: http://www.wowace.com/index.php/AceLocale-2.2
SVN: http://svn.wowace.com/root/trunk/Ace2/AceLocale-2.2
SVN: http://svn.wowace.com/wowace/trunk/Ace2/AceLocale-2.2
Description: Localization library for addons to use to handle proper
localization and internationalization.
Dependencies: AceLibrary
13,32 → 13,54
]]
 
local MAJOR_VERSION = "AceLocale-2.2"
local MINOR_VERSION = "$Revision: 27198 $"
local MINOR_VERSION = 90000 + tonumber(("$Revision: 1094 $"):match("(%d+)"))
 
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary.") end
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
 
local AceLocale = {}
AceLocale.prototype = { class = AceLocale }
 
local DEFAULT_LOCALE = "enUS"
local _G = getfenv(0)
 
local BASE_TRANSLATIONS, DEBUGGING, TRANSLATIONS, BASE_LOCALE, TRANSLATION_TABLES, REVERSE_TRANSLATIONS, STRICTNESS, DYNAMIC_LOCALES, CURRENT_LOCALE, NAME
 
local _G = _G
local rawget = rawget
local rawset = rawset
local type = type
local pairs = pairs
local next = next
local getmetatable = getmetatable
local setmetatable = setmetatable
local GetTime = GetTime
local geterrorhandler = geterrorhandler
local pcall = pcall
local ipairs = ipairs
local GetLocale = GetLocale
 
local newRegistries = {}
local scheduleClear
 
local lastSelf
local __index = function(self, key)
local strict__index = function(self, key)
lastSelf = self
local value = (rawget(self, TRANSLATIONS) or AceLocale.prototype)[key]
rawset(self, key, value)
return value
end
local nonstrict__index = function(self, key)
lastSelf = self
local t = rawget(self, TRANSLATIONS)
if t then
local value = rawget(t, key)
if value then
rawset(self, key, value)
return value
end
end
local value = (rawget(self, BASE_TRANSLATIONS) or AceLocale.prototype)[key]
rawset(self, key, value)
return value
end
 
local __newindex = function(self, k, v)
if type(v) ~= "function" and type(k) ~= "table" then
56,6 → 78,11
end
 
local function clearCache(self)
for k, v in pairs(AceLocale.prototype) do
if type(v) == "function" and type(rawget(self, k)) == "function" then
self[k] = nil
end
end
if not rawget(self, BASE_TRANSLATIONS) then
return
end
72,6 → 99,9
self.tmp = nil
end
 
local strict_instance_mt, nonstrict_instance_mt
local baseTranslations_mt
 
local function refixInstance(instance)
if getmetatable(instance) then
setmetatable(instance, nil)
86,36 → 116,16
setmetatable(baseTranslations, nil)
end
if translations == baseTranslations or instance[STRICTNESS] then
setmetatable(instance, {
__index = __index,
__newindex = __newindex,
__tostring = __tostring
})
setmetatable(instance, strict_instance_mt)
 
setmetatable(translations, {
__index = AceLocale.prototype
})
setmetatable(translations, baseTranslations_mt)
else
setmetatable(instance, {
__index = __index,
__newindex = __newindex,
__tostring = __tostring
})
setmetatable(instance, nonstrict_instance_mt)
 
setmetatable(translations, {
__index = baseTranslations,
})
 
setmetatable(baseTranslations, {
__index = AceLocale.prototype,
})
setmetatable(baseTranslations, baseTranslations_mt)
end
else
setmetatable(instance, {
__index = __index,
__newindex = __newindex,
__tostring = __tostring,
})
setmetatable(instance, strict_instance_mt)
end
clearCache(instance)
newRegistries[instance] = true
138,8 → 148,6
return AceLocale.registry[name]
end
 
AceLocale.prototype = { class = AceLocale }
 
function AceLocale.prototype:EnableDebugging()
if rawget(self, BASE_TRANSLATIONS) then
AceLocale.error(self, "Cannot enable debugging after a translation has been registered.")
335,7 → 343,9
end
local value = rawget(x, text)
if value == nil then
AceLocale.error(self, "Translation %q does not exist for locale %s", text, self[CURRENT_LOCALE])
local _, ret = pcall(AceLocale.error, self, "Translation %q does not exist for locale %s", text, self[CURRENT_LOCALE])
geterrorhandler()(ret)
return text
end
return value
end
351,7 → 361,9
end
local translation = x[text]
if not translation then
AceLocale.error(self, "Reverse translation for %q does not exist", text)
local _, ret = pcall(AceLocale.error, self, "Reverse translation for %q does not exist", text)
geterrorhandler()(ret)
return text
end
return translation
end
411,7 → 423,7
return
end
local words = {}
local locales = {"enUS", "deDE", "frFR", "koKR", "zhCN", "zhTW", "esES"}
local locales = {"enUS", "deDE", "frFR", "koKR", "zhCN", "zhTW", "esES", "ruRU"}
local localizations = {}
DEFAULT_CHAT_FRAME:AddMessage("--- AceLocale Debug ---")
for _,locale in ipairs(locales) do
472,7 → 484,9
setmetatable(AceLocale.prototype, {
__index = function(self, k)
if type(k) ~= "table" and k ~= 0 and k ~= "GetLibraryVersion" and k ~= "error" and k ~= "assert" and k ~= "argCheck" and k ~= "pcall" then -- HACK: remove "GetLibraryVersion" and such later.
AceLocale.error(lastSelf or self, "Translation %q does not exist.", k)
local _, ret = pcall(AceLocale.error, lastSelf or self, "Translation %q does not exist.", k)
geterrorhandler()(ret)
return k
end
return nil
end
506,6 → 520,21
DYNAMIC_LOCALES = self.DYNAMIC_LOCALES
CURRENT_LOCALE = self.CURRENT_LOCALE
 
strict_instance_mt = {
__index = strict__index,
__newindex = __newindex,
__tostring = __tostring
}
 
nonstrict_instance_mt = {
__index = nonstrict__index,
__newindex = __newindex,
__tostring = __tostring
}
 
baseTranslations_mt = {
__index = AceLocale.prototype
}
 
local GetTime = GetTime
local timeUntilClear = GetTime() + 5
516,25 → 545,20
end
end
 
if not self.registry then
self.registry = {}
else
for name, instance in pairs(self.registry) do
local name = name
local mt = getmetatable(instance)
setmetatable(instance, nil)
instance[NAME] = name
local strict
if instance[STRICTNESS] ~= nil then
strict = instance[STRICTNESS]
elseif instance[TRANSLATIONS] ~= instance[BASE_TRANSLATIONS] then
if getmetatable(instance[TRANSLATIONS]).__index == oldLib.prototype then
strict = true
end
for name, instance in pairs(self.registry) do
local name = name
setmetatable(instance, nil)
instance[NAME] = name
local strict
if instance[STRICTNESS] ~= nil then
strict = instance[STRICTNESS]
elseif instance[TRANSLATIONS] ~= instance[BASE_TRANSLATIONS] then
if getmetatable(instance[TRANSLATIONS]).__index == oldLib.prototype then
strict = true
end
instance[STRICTNESS] = strict and true or false
refixInstance(instance)
end
instance[STRICTNESS] = strict and true or false
refixInstance(instance)
end
 
self.frame:SetScript("OnEvent", scheduleClear)
559,3 → 583,87
end
 
AceLibrary:Register(AceLocale, MAJOR_VERSION, MINOR_VERSION, activate)
--[[
if true then -- debug
local L = AceLocale:new(MINOR_VERSION ~= 100000 and "AceLocale_DEBUG" or "AceLocale_DEBUG3")
L:RegisterTranslations("enUS", function() return {
Monkey = true,
House = true,
} end)
 
L:RegisterTranslations("deDE", function() return {
Monkey = "Affe"
} end)
 
L = AceLocale:new(MINOR_VERSION ~= 100000 and "AceLocale_DEBUG" or "AceLocale_DEBUG3")
assert(L.Monkey == "Monkey")
assert(L.House == "House")
if not L.Debug then
local pants = L.Pants
assert(not pants)
end
assert(L.Debug)
assert(L.Debug == AceLocale.prototype.Debug)
 
if MINOR_VERSION == 100000 then
L = AceLocale:new("AceLocale_DEBUG")
assert(L.Monkey == "Monkey")
assert(L.House == "House")
assert(L.Debug)
assert(type(L.Debug) == "function")
assert(AceLocale.prototype.Debug)
assert(type(AceLocale.prototype.Debug) == "function")
assert(L.Debug == AceLocale.prototype.Debug)
end
 
local L = AceLocale:new(MINOR_VERSION ~= 100000 and "AceLocale_DEBUG2" or "AceLocale_DEBUG4")
L:RegisterTranslations("deDE", function() return {
Affe = true,
Haus = true,
} end)
 
L:RegisterTranslations("enUS", function() return {
Affe = "Monkey"
} end)
 
L = AceLocale:new(MINOR_VERSION ~= 100000 and "AceLocale_DEBUG2" or "AceLocale_DEBUG4")
assert(L.Affe == "Monkey")
assert(L.Haus == "Haus")
assert(L.Debug)
assert(L.Debug == AceLocale.prototype.Debug)
 
if MINOR_VERSION == 100000 then
L = AceLocale:new("AceLocale_DEBUG2")
assert(L.Affe == "Monkey")
assert(L.Haus == "Haus")
assert(L.Debug)
assert(L.Debug == AceLocale.prototype.Debug)
end
 
local L = AceLocale:new(MINOR_VERSION ~= 100000 and "AceLocale_DEBUG5" or "AceLocale_DEBUG6")
L:RegisterTranslations("deDE", function() return {
Affe = true,
Haus = true,
} end)
 
L:RegisterTranslations("enUS", function() return {
Affe = "Monkey"
} end)
 
L:SetStrictness(true)
 
L = AceLocale:new(MINOR_VERSION ~= 100000 and "AceLocale_DEBUG5" or "AceLocale_DEBUG6")
assert(L.Affe == "Monkey")
assert(L.Haus == "Haus")
assert(L.Debug)
assert(L.Debug == AceLocale.prototype.Debug)
 
if MINOR_VERSION == 100000 then
L = AceLocale:new("AceLocale_DEBUG5")
assert(L.Affe == "Monkey")
assert(L.Haus == "Haus")
assert(L.Debug)
assert(L.Debug == AceLocale.prototype.Debug)
end
end
]]
trunk/FuBar_RecapFu/libs/AceLocale-2.2/AceLocale-2.2.toc New file
0,0 → 1,16
## 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: AceLocale-2.2
## 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
 
AceLocale-2.2.lua
Property changes : Added: svn:eol-style + native
trunk/FuBar_RecapFu/libs/AceConsole-2.0/AceConsole-2.0.lua
1,6 → 1,6
--[[
--[[
Name: AceConsole-2.0
Revision: $Rev: 30624 $
Revision: $Rev: 1094 $
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/
14,13 → 14,17
]]
 
local MAJOR_VERSION = "AceConsole-2.0"
local MINOR_VERSION = "$Revision: 30624 $"
local MINOR_VERSION = 90000 + tonumber(("$Revision: 1094 $"):match("(%d+)"))
 
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary.") end
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
 
if not AceLibrary:HasInstance("AceOO-2.0") then error(MAJOR_VERSION .. " requires AceOO-2.0.") end
 
local WotLK = select(4,GetBuildInfo()) >= 30000
 
-- #AUTODOC_NAMESPACE AceConsole
 
local MAP_ONOFF, USAGE, IS_CURRENTLY_SET_TO, IS_NOW_SET_TO, IS_NOT_A_VALID_OPTION_FOR, IS_NOT_A_VALID_VALUE_FOR, NO_OPTIONS_AVAILABLE, OPTION_HANDLER_NOT_FOUND, OPTION_HANDLER_NOT_VALID, OPTION_IS_DISABLED, KEYBINDING_USAGE, DEFAULT_CONFIRM_MESSAGE
if GetLocale() == "deDE" then
MAP_ONOFF = { [false] = "|cffff0000Aus|r", [true] = "|cff00ff00An|r" }
51,16 → 55,16
elseif GetLocale() == "koKR" then
MAP_ONOFF = { [false] = "|cffff0000끔|r", [true] = "|cff00ff00켬|r" }
USAGE = "사용법"
IS_CURRENTLY_SET_TO = "|cffffff7f%s|r|1은;는; 현재 상태는 |cffffff7f[|r%s|cffffff7f]|r|1으로;로; 설정되어 있습니다"
IS_NOW_SET_TO = "|cffffff7f%s|r|1을;를; |cffffff7f[|r%s|cffffff7f]|r 상태로 변경합니다"
IS_NOT_A_VALID_OPTION_FOR = "[|cffffff7f%s|r]|1은;는; |cffffff7f%s|r에서 사용불가능한 설정입니다"
IS_NOT_A_VALID_VALUE_FOR = "[|cffffff7f%s|r]|1은;는; |cffffff7f%s|r에서 사용불가능한 설정값입니다"
NO_OPTIONS_AVAILABLE = "가능한 설정이 없습니다"
OPTION_HANDLER_NOT_FOUND = "설정 조정값인 |cffffff7f%q|r|1을;를; 찾지 못했습니다."
OPTION_HANDLER_NOT_VALID = "설정 조정값이 올바르지 않습니다."
IS_CURRENTLY_SET_TO = "|cffffff7f%s|r|1은;는; 현재 상태는 |cffffff7f[|r%s|cffffff7f]|r|1으로;로; 설정되어 있습니다."
IS_NOW_SET_TO = "|cffffff7f%s|r|1을;를; |cffffff7f[|r%s|cffffff7f]|r 상태로 변경합니다."
IS_NOT_A_VALID_OPTION_FOR = "[|cffffff7f%s|r]|1은;는; |cffffff7f%s|r에서 사용 불가능한 설정입니다."
IS_NOT_A_VALID_VALUE_FOR = "[|cffffff7f%s|r]|1은;는; |cffffff7f%s|r에서 사용 불가능한 설정 값입니다."
NO_OPTIONS_AVAILABLE = "가능한 설정이 없습니다."
OPTION_HANDLER_NOT_FOUND = "설정 조정 값인 |cffffff7f%q|r|1을;를; 찾지 못했습니다."
OPTION_HANDLER_NOT_VALID = "설정 조정 값이 올바르지 않습니다."
OPTION_IS_DISABLED = "|cffffff7f%s|r 설정은 사용할 수 없습니다."
KEYBINDING_USAGE = "<ALT-CTRL-SHIFT-KEY>" -- fix
DEFAULT_CONFIRM_MESSAGE = "Are you sure you want to perform `%s'?" -- fix
KEYBINDING_USAGE = "<ALT-CTRL-SHIFT-KEY>"
DEFAULT_CONFIRM_MESSAGE = "정말 당신은 `%s'|1을;를; 하시겠습니까?"
elseif GetLocale() == "zhCN" then
MAP_ONOFF = { [false] = "|cffff0000\229\133\179\233\151\173|r", [true] = "|cff00ff00\229\188\128\229\144\175|r" }
USAGE = "\231\148\168\230\179\149"
77,16 → 81,16
elseif GetLocale() == "zhTW" then
MAP_ONOFF = { [false] = "|cffff0000關閉|r", [true] = "|cff00ff00開啟|r" }
USAGE = "用法"
IS_CURRENTLY_SET_TO = "|cffffff7f%s|r 目前的設定為 |cffffff7f[|r%s|cffffff7f]|r"
IS_NOW_SET_TO = "|cffffff7f%s|r 現在被設定為 |cffffff7f[|r%s|cffffff7f]|r"
IS_NOT_A_VALID_OPTION_FOR = "[|cffffff7f%s|r] 是一個不符合規定的選項,對 |cffffff7f%s|r"
IS_NOT_A_VALID_VALUE_FOR = "[|cffffff7f%s|r] 是一個不符合規定的數值,對 |cffffff7f%s|r"
NO_OPTIONS_AVAILABLE = "沒有可用的選項處理器。"
OPTION_HANDLER_NOT_FOUND = "找不到 |cffffff7f%q|r 選項處理器。"
IS_CURRENTLY_SET_TO = "|cffffff7f%s|r目前的設定為|cffffff7f[|r%s|cffffff7f]|r"
IS_NOW_SET_TO = "|cffffff7f%s|r現在被設定為|cffffff7f[|r%s|cffffff7f]|r"
IS_NOT_A_VALID_OPTION_FOR = "對於|cffffff7f%2$s|r,[|cffffff7f%1$s|r]是一個不符合規定的選項"
IS_NOT_A_VALID_VALUE_FOR = "對於|cffffff7f%2$s|r,[|cffffff7f%1$s|r]是一個不符合規定的數值"
NO_OPTIONS_AVAILABLE = "沒有可用的選項"
OPTION_HANDLER_NOT_FOUND = "找不到|cffffff7f%q|r選項處理器。"
OPTION_HANDLER_NOT_VALID = "選項處理器不符合規定。"
OPTION_IS_DISABLED = "|cffffff7f%s|r 已被停用。"
KEYBINDING_USAGE = "<ALT-CTRL-SHIFT-KEY>" -- fix
DEFAULT_CONFIRM_MESSAGE = "Are you sure you want to perform `%s'?" -- fix
OPTION_IS_DISABLED = "|cffffff7f%s|r已被停用。"
KEYBINDING_USAGE = "<Alt-Ctrl-Shift-鍵>"
DEFAULT_CONFIRM_MESSAGE = "是否執行「%s」?"
elseif GetLocale() == "esES" then
MAP_ONOFF = { [false] = "|cffff0000Desactivado|r", [true] = "|cff00ff00Activado|r" }
USAGE = "Uso"
100,6 → 104,19
OPTION_IS_DISABLED = "La opci\195\179n |cffffff7f%s|r est\195\161 desactivada."
KEYBINDING_USAGE = "<ALT-CTRL-SHIFT-KEY>"
DEFAULT_CONFIRM_MESSAGE = "Are you sure you want to perform `%s'?" -- fix
elseif GetLocale() == "ruRU" then
MAP_ONOFF = { [false] = "|cffff0000Off|r", [true] = "|cff00ff00On|r" }
USAGE = "Использование"
IS_CURRENTLY_SET_TO = "|cffffff7f%s|r в настоящее время установлен на |cffffff7f[|r%s|cffffff7f]|r"
IS_NOW_SET_TO = "|cffffff7f%s|r теперь установлен |cffffff7f[|r%s|cffffff7f]|r"
IS_NOT_A_VALID_OPTION_FOR = "[|cffffff7f%s|r] - недействительная опция для |cffffff7f%s|r"
IS_NOT_A_VALID_VALUE_FOR = "[|cffffff7f%s|r] - недействительное значение для |cffffff7f%s|r"
NO_OPTIONS_AVAILABLE = "Нет доступных опций"
OPTION_HANDLER_NOT_FOUND = "Оператор опции |cffffff7f%q|r не найден."
OPTION_HANDLER_NOT_VALID = "Оператор опции недействителен."
OPTION_IS_DISABLED = "Опция |cffffff7f%s|r отключена."
KEYBINDING_USAGE = "<ALT-CTRL-SHIFT-КЛАВИША>"
DEFAULT_CONFIRM_MESSAGE = "Вы уверены, что хотите выполнить `%s'?"
else -- enUS
MAP_ONOFF = { [false] = "|cffff0000Off|r", [true] = "|cff00ff00On|r" }
USAGE = "Usage"
197,7 → 214,7
return {}
end
end
 
 
function del(t)
for k in pairs(t) do
t[k] = nil
241,7 → 258,7
 
local function literal_tostring_prime(t, depth)
if type(t) == "string" then
return ("|cff00ff00%q|r"):format((t:gsub("|", "||"))):gsub("[\001-\012\014-\031\128-\255]", escapeChar)
return ("|cff00ff00%q|r"):format((t:gsub("|", "||"))):gsub("[%z\001-\009\011-\031\127-\255]", escapeChar)
elseif type(t) == "table" then
if t == _G then
return "|cffffea00_G|r"
249,6 → 266,12
if type(rawget(t, 0)) == "userdata" and type(t.GetObjectType) == "function" then
return ("|cffffea00<%s:%s>|r"):format(t:GetObjectType(), t:GetName() or "(anon)")
end
if next(t) == nil then
local mt = getmetatable(t)
if type(mt) == "table" and type(mt.__raw) == "table" then
t = mt.__raw
end
end
if recurse[t] then
local g = findGlobal[t]
if g then
506,17 → 529,20
table.insert(work, token)
end
end
 
 
local path = chat
for i = 1, index - 1 do
path = path .. " " .. tostring(work[i])
end
 
 
local passValue = options.passValue or (passTable and work[index-1])
passTable = passTable or options
 
if type(options.args) == "table" then
local disabled, hidden = options.disabled, options.cmdHidden or options.hidden
if hidden then
if type(hidden) == "function" then
hidden = hidden()
hidden = hidden(passValue)
elseif type(hidden) == "string" then
local handler = options.handler or self
local f = hidden
527,7 → 553,7
if type(handler[f]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(f)))
end
hidden = handler[f](handler)
hidden = handler[f](handler, passValue)
if neg then
hidden = not hidden
end
537,7 → 563,7
disabled = true
elseif disabled then
if type(disabled) == "function" then
disabled = disabled()
disabled = disabled(passValue)
elseif type(disabled) == "string" then
local handler = options.handler or self
local f = disabled
548,7 → 574,7
if type(handler[f]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(f)))
end
disabled = handler[f](handler)
disabled = handler[f](handler, passValue)
if neg then
disabled = not disabled
end
575,7 → 601,16
good = true
end
if good then
return findTableLevel(options.handler or self, v, chat, text, index + 1, options.pass and options or nil)
work[index] = k -- revert it back to its original form as supplied in args
if options.pass then
passTable = passTable or options
if options.get and options.set then
passTable = options
end
else
passTable = nil
end
return findTableLevel(options.handler or self, v, chat, text, index + 1, passTable)
end
end
end
584,7 → 619,7
for i = index, #work do
table.insert(argwork, work[i])
end
return options, path, argwork, options.handler or self, passTable, passTable and work[index - 1]
return options, path, argwork, options.handler or self, passTable, passValue
end
 
local function validateOptionsMethods(self, options, position)
723,10 → 758,6
return '"func" must be a string or function', position
end
end
else
if kind == "group" then
return 'cannot have "type" = "group" as a subgroup of a passing group', position
end
end
if options ~= baseOptions then
if kind == "header" then
831,7 → 862,7
return '"multiToggle" must be a boolean or nil if "validate" is a table', position
end
elseif options.validate == "keybinding" then
 
 
else
if type(options.usage) ~= "string" then
return '"usage" must be a string', position
989,14 → 1020,14
end
 
local tmp = {}
local function printUsage(self, handler, realOptions, options, path, args, quiet, filter)
local function printUsage(self, handler, realOptions, options, path, args, passValue, quiet, filter)
if filter then
filter = "^" .. filter:gsub("([%(%)%.%*%+%-%[%]%?%^%$%%])", "%%%1")
end
local hidden, disabled = options.cmdHidden or options.hidden, options.disabled
if hidden then
if type(hidden) == "function" then
hidden = hidden()
hidden = hidden(options.passValue)
elseif type(hidden) == "string" then
local f = hidden
local neg = f:match("^~(.-)$")
1006,7 → 1037,7
if type(handler[f]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(f)))
end
hidden = handler[f](handler)
hidden = handler[f](handler, options.passValue)
if neg then
hidden = not hidden
end
1016,7 → 1047,7
disabled = true
elseif disabled then
if type(disabled) == "function" then
disabled = disabled()
disabled = disabled(options.passValue)
elseif type(disabled) == "string" then
local f = disabled
local neg = f:match("^~(.-)$")
1026,7 → 1057,7
if type(handler[f]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(f)))
end
disabled = handler[f](handler)
disabled = handler[f](handler, options.passValue)
if neg then
disabled = not disabled
end
1051,7 → 1082,11
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
var[val] = passTable.get(passValue, val) or nil
if passValue == nil then
var[val] = passTable.get(val) or nil
else
var[val] = passTable.get(passValue, val) or nil
end
end
end
else
1066,7 → 1101,11
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
var[val] = handler[passTable.get](handler, passValue, val) or nil
if passValue == nil then
var[val] = handler[passTable.get](handler, val) or nil
else
var[val] = handler[passTable.get](handler, passValue, val) or nil
end
end
end
end
1075,12 → 1114,16
if not options.get then
elseif type(options.get) == "function" then
if not multiToggle then
var = options.get()
var = options.get(passValue)
else
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
var[val] = options.get(val) or nil
if passValue == nil then
var[val] = options.get(val) or nil
else
var[val] = options.get(passValue, val) or nil
end
end
end
else
1089,17 → 1132,21
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options.get)))
end
if not multiToggle then
var = handler[options.get](handler)
var = handler[options.get](handler, passValue)
else
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
var[val] = handler[options.get](handler, val) or nil
if passValue == nil then
var[val] = handler[options.get](handler, val) or nil
else
var[val] = handler[options.get](handler, passValue, val) or nil
end
end
end
end
end
 
 
local usage
if type(options.validate) == "table" then
if filter then
1182,16 → 1229,16
end
else
if type(options.get) == "function" then
var = options.get()
var = options.get(passValue)
else
local handler = options.handler or handler
if type(handler[options.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options.get)))
end
var = handler[options.get](handler)
var = handler[options.get](handler, passValue)
end
end
 
 
local usage
local min = options.min or 0
local max = options.max or 1
1306,16 → 1353,23
end
local passTable = options.pass and options or nil
for _,k in ipairs(order) do
local passValue = passTable and k
local passValue = passTable and k or nil
local real_k = k
local v = options.args[k]
if v then
local v_p = passTable or v
local k = k:gsub("%s", "-")
if v.get and v.set then
v_p = v
passValue = nil
end
if v.passValue then
passValue = v.passValue
end
local k = tostring(k):gsub("%s", "-")
local disabled = v.disabled
if disabled then
if type(disabled) == "function" then
disabled = disabled()
disabled = disabled(passValue)
elseif type(disabled) == "string" then
local f = disabled
local neg = f:match("^~(.-)$")
1325,7 → 1379,7
if type(handler[f]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(f)))
end
disabled = handler[f](handler)
disabled = handler[f](handler, passValue)
if neg then
disabled = not disabled
end
1503,7 → 1557,7
t.timeout = 0
t.whileDead = 1
t.hideOnEscape = 1
 
 
StaticPopup_Show("ACECONSOLE20_CONFIRM_DIALOG")
end
 
1514,14 → 1568,24
msg = msg:gsub("^%s*(.-)%s*$", "%1")
msg = msg:gsub("%s+", " ")
end
 
 
local realOptions = options
local options, path, args, handler, passTable, passValue = findTableLevel(self, options, chat, msg)
 
if options.type == "execute" then
if options.func then
passTable = nil
end
else
if options.get and options.set then
passTable = nil
end
end
passValue = options.passValue or passTable and passValue
 
local hidden, disabled = options.cmdHidden or options.hidden, options.disabled
if hidden then
if type(hidden) == "function" then
hidden = hidden()
hidden = hidden(passValue)
elseif type(hidden) == "string" then
local f = hidden
local neg = f:match("^~(.-)$")
1531,7 → 1595,7
if type(handler[f]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(f)))
end
hidden = handler[f](handler)
hidden = handler[f](handler, passValue)
if neg then
hidden = not hidden
end
1541,7 → 1605,7
disabled = true
elseif disabled then
if type(disabled) == "function" then
disabled = disabled()
disabled = disabled(passValue)
elseif type(disabled) == "string" then
local f = disabled
local neg = f:match("^~(.-)$")
1551,14 → 1615,14
if type(handler[f]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(f)))
end
disabled = handler[f](handler)
disabled = handler[f](handler, passValue)
if neg then
disabled = not disabled
end
end
end
local _G_this = this
local kind = (options.type or "group"):lower()
local options_p = passTable or options
if disabled then
print(OPTION_IS_DISABLED:format(path), realOptions.cmdName or realOptions.name or self)
elseif kind == "text" then
1627,68 → 1691,47
return
end
end
 
 
local var
local multiToggle
for k in pairs(tmp) do
tmp[k] = nil
end
if passTable then
multiToggle = passTable.multiToggle
if not passTable.get then
elseif type(passTable.get) == "function" then
if multiToggle then
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
var[val] = passTable.get(passValue, val)
multiToggle = options_p.multiToggle
if not options_p.get then
elseif type(options_p.get) == "function" then
if multiToggle then
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
if passValue then
var[val] = options_p.get(passValue, val) or nil
else
var[val] = options_p.get(val) or nil
end
else
var = passTable.get(passValue)
end
else
if type(handler[passTable.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(passTable.get)))
end
if multiToggle then
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
var[val] = handler[passTable.get](handler, passValue, val)
end
else
var = handler[passTable.get](handler, passValue)
end
var = options_p.get(passValue)
end
else
multiToggle = options.multiToggle
if not options.get then
elseif type(options.get) == "function" then
if multiToggle then
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
var[val] = options.get(val)
if type(handler[options_p.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options_p.get)))
end
if multiToggle then
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
if passValue then
var[val] = handler[options_p.get](handler, passValue, val) or nil
else
var[val] = handler[options_p.get](handler, val) or nil
end
else
var = options.get()
end
else
if type(handler[options.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options.get)))
end
if multiToggle then
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
var[val] = handler[options.get](handler, val)
end
else
var = handler[options.get](handler)
end
var = handler[options_p.get](handler, passValue)
end
end
 
 
if multiToggle or var ~= args[1] then
if multiToggle then
local current = var[args[1]]
1702,87 → 1745,63
end
args[2] = not current
end
if passTable then
if type(passTable.set) == "function" then
passTable.set(passValue, unpack(args))
if type(options_p.set) == "function" then
if passValue then
options_p.set(passValue, unpack(args))
else
if type(handler[passTable.set]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(passTable.set)))
end
handler[passTable.set](handler, passTable.set, unpack(args))
options_p.set(unpack(args))
end
else
if type(options.set) == "function" then
options.set(unpack(args))
if type(handler[options_p.set]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options_p.set)))
end
if passValue then
handler[options_p.set](handler, passValue, unpack(args))
else
if type(handler[options.set]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options.set)))
end
handler[options.set](handler, unpack(args))
handler[options_p.set](handler, unpack(args))
end
end
end
end
 
 
if #args > 0 then
local var
local multiToggle
for k in pairs(tmp) do
tmp[k] = nil
end
if passTable then
multiToggle = passTable.multiToggle
if not passTable.get then
elseif type(passTable.get) == "function" then
if multiToggle then
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
var[val] = passTable.get(passValue, val)
multiToggle = options_p.multiToggle
if not options_p.get then
elseif type(options_p.get) == "function" then
if multiToggle then
var = tmp
for k,v in pairs(options_p.validate) do
local val = type(k) ~= "number" and k or v
if passValue then
var[val] = options_p.get(passValue, val) or nil
else
var[val] = options_p.get(val) or nil
end
else
var = passTable.get(passValue)
end
else
if type(handler[passTable.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(passTable.get)))
end
if multiToggle then
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
var[val] = handler[passTable.get](handler, passValue, val)
end
else
var = handler[passTable.get](handler, passValue)
end
var = options_p.get(passValue)
end
else
multiToggle = options.multiToggle
if not options.get then
elseif type(options.get) == "function" then
if multiToggle then
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
var[val] = options.get(val)
if type(handler[options_p.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options_p.get)))
end
if multiToggle then
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
if passValue then
var[val] = handler[options_p.get](handler, passValue, val) or nil
else
var[val] = handler[options_p.get](handler, val) or nil
end
else
var = options.get()
end
else
if type(handler[options.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options.get)))
end
if multiToggle then
var = tmp
for k,v in pairs(options.validate) do
local val = type(k) ~= "number" and k or v
var[val] = handler[options.get](handler, val)
end
else
var = handler[options.get](handler)
end
var = handler[options_p.get](handler, passValue)
end
end
if multiToggle then
1813,14 → 1832,14
elseif type(options.validate) == "table" then
var = options.validate[var] or var
end
if (passTable and passTable.get) or options.get then
if options_p.get then
print((options.message or IS_NOW_SET_TO):format(tostring(options.cmdName or options.name), tostring(var or NONE)), realOptions.cmdName or realOptions.name or self)
end
if var == args[1] then
return
end
else
printUsage(self, handler, realOptions, options, path, args)
printUsage(self, handler, realOptions, options, path, args, passValue)
return
end
elseif kind == "execute" then
1828,124 → 1847,70
if confirm == true then
confirm = DEFAULT_CONFIRM_MESSAGE:format(options.desc or options.name or UNKNOWN or "Unknown")
end
if passTable then
if type(passTable.func) == "function" then
if confirm then
confirmPopup(confirm, set, passValue)
else
passTable.func(passValue)
end
if type(options_p.func) == "function" then
if confirm then
confirmPopup(confirm, options_p.func, passValue)
else
if type(handler[passTable.func]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(passTable.func)))
end
if confirm then
confirmPopup(confirm, handler[passTable.func], handler, passValue)
else
handler[passTable.func](handler, passValue)
end
options_p.func(passValue)
end
else
local ret, msg
if type(options.func) == "function" then
if confirm then
confirmPopup(confirm, options.func)
else
options.func()
end
if type(handler[options_p.func]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options_p.func)))
end
if confirm then
confirmPopup(confirm, handler[options_p.func], handler, passValue)
else
local handler = options.handler or self
if type(handler[options.func]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options.func)))
end
if confirm then
confirmPopup(confirm, handler[options.func], handler)
else
handler[options.func](handler)
end
handler[options_p.func](handler, passValue)
end
end
elseif kind == "toggle" then
local var
if passTable then
if type(passTable.get) == "function" then
var = passTable.get(passValue)
else
local f = passTable.get
local neg = f:match("^~(.-)$")
if neg then
f = neg
end
if type(handler[f]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(f)))
end
var = handler[f](handler, passValue)
if neg then
var = not var
end
if type(options_p.get) == "function" then
var = options_p.get(passValue)
else
local f = options_p.get
local neg = f:match("^~(.-)$")
if neg then
f = neg
end
if type(passTable.set) == "function" then
passTable.set(passValue, not var)
else
if type(handler[passTable.set]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(passTable.set)))
end
handler[passTable.set](handler, passValue, not var)
if type(handler[f]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(f)))
end
if type(passTable.get) == "function" then
var = passTable.get(passValue)
var = handler[f](handler, passValue)
if neg then
var = not var
end
end
if type(options_p.set) == "function" then
if passValue then
options_p.set(passValue, not var)
else
local f = passTable.get
local neg = f:match("^~(.-)$")
if neg then
f = neg
end
var = handler[f](handler, passValue)
if neg then
var = not var
end
options_p.set(not var)
end
else
local handler = options.handler or self
if type(options.get) == "function" then
var = options.get()
else
local f = options.get
local neg = f:match("^~(.-)$")
if neg then
f = neg
end
if type(handler[f]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(f)))
end
var = handler[f](handler)
if neg then
var = not var
end
if type(handler[options_p.set]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options_p.set)))
end
if type(options.set) == "function" then
options.set(not var)
if passValue then
handler[options_p.set](handler, passValue, not var)
else
if type(handler[options.set]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options.set)))
end
handler[options.set](handler, not var)
handler[options_p.set](handler, not var)
end
if type(options.get) == "function" then
var = options.get()
else
local f = options.get
local neg = f:match("^~(.-)$")
if neg then
f = neg
end
var = handler[f](handler)
if neg then
var = not var
end
end
if type(options_p.get) == "function" then
var = options_p.get(passValue)
else
local f = options_p.get
local neg = f:match("^~(.-)$")
if neg then
f = neg
end
var = handler[f](handler, passValue)
if neg then
var = not var
end
end
 
 
print((options.message or IS_NOW_SET_TO):format(tostring(options.cmdName or options.name), (options.map or MAP_ONOFF)[var and true or false] or NONE), realOptions.cmdName or realOptions.name or self)
elseif kind == "range" then
local arg
1967,7 → 1932,7
if arg >= min and arg <= max then
good = true
end
 
 
if good and type(options.step) == "number" and options.step > 0 then
local step = options.step
arg = math.floor((arg - min) / step + 0.5) * step + min
1994,76 → 1959,48
print(("|cffffff7f%s:|r %s %s"):format(USAGE, path, usage))
return
end
 
 
local var
if passTable then
if type(passTable.get) == "function" then
var = passTable.get(passValue)
else
if type(handler[passTable.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(passTable.get)))
end
var = handler[passTable.get](handler, passValue)
end
if type(options_p.get) == "function" then
var = options_p.get(passValue)
else
if type(options.get) == "function" then
var = options.get()
else
local handler = options.handler or self
if type(handler[options.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options.get)))
end
var = handler[options.get](handler)
if type(handler[options_p.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options_p.get)))
end
var = handler[options_p.get](handler, passValue)
end
 
 
if var ~= arg then
if passTable then
if type(passTable.set) == "function" then
passTable.set(passValue, arg)
if type(options_p.set) == "function" then
if passValue then
options_p.set(passValue, arg)
else
if type(handler[passTable.set]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(passTable.set)))
end
handler[passTable.set](handler, passValue, arg)
options_p.set(arg)
end
else
if type(options.set) == "function" then
options.set(arg)
if type(handler[options_p.set]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options_p.set)))
end
if passValue then
handler[options_p.set](handler, passValue, arg)
else
local handler = options.handler or self
if type(handler[options.set]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options.set)))
end
handler[options.set](handler, arg)
handler[options_p.set](handler, arg)
end
end
end
end
 
 
if arg then
local var
if passTable then
if type(passTable.get) == "function" then
var = passTable.get(passValue)
else
if type(handler[passTable.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(passTable.get)))
end
var = handler[passTable.get](handler, passValue)
end
if type(options_p.get) == "function" then
var = options_p.get(passValue)
else
if type(options.get) == "function" then
var = options.get()
else
local handler = options.handler or self
if type(handler[options.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options.get)))
end
var = handler[options.get](handler)
if type(handler[options_p.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options_p.get)))
end
var = handler[options_p.get](handler, passValue)
end
 
 
if var and options.isPercent then
var = tostring(var * 100) .. "%"
end
2072,7 → 2009,7
return
end
else
printUsage(self, handler, realOptions, options, path, args)
printUsage(self, handler, realOptions, options, path, args, passValue)
return
end
elseif kind == "color" then
2109,47 → 2046,34
print(("|cffffff7f%s:|r %s {0-1} {0-1} {0-1}%s"):format(USAGE, path, options.hasAlpha and " {0-1}" or ""))
return
end
if passTable then
if type(passTable.set) == "function" then
passTable.set(passValue, r,g,b,a)
 
if type(options_p.set) == "function" then
if passValue then
options_p.set(passValue, r,g,b,a)
else
if type(handler[passTable.set]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(passTable.set)))
end
handler[passTable.set](handler, passValue, r,g,b,a)
options_p.set(r,g,b,a)
end
else
if type(options.set) == "function" then
options.set(r,g,b,a)
if type(handler[options_p.set]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options_p.set)))
end
if passValue then
handler[options_p.set](handler, passValue, r,g,b,a)
else
if type(handler[options.set]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options.set)))
end
handler[options.set](handler, r,g,b,a)
handler[options_p.set](handler, r,g,b,a)
end
end
 
 
local r,g,b,a
if passTable then
if type(passTable.get) == "function" then
r,g,b,a = passTable.get(passValue)
else
if type(handler[passTable.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(passTable.get)))
end
r,g,b,a = handler[passTable.get](handler, passValue)
end
if type(options_p.get) == "function" then
r,g,b,a = options_p.get(passValue)
else
if type(options.get) == "function" then
r,g,b,a = options.get()
else
if type(handler[options.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options.get)))
end
r,g,b,a = handler[options.get](handler)
if type(handler[options_p.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options_p.get)))
end
r,g,b,a = handler[options_p.get](handler, passValue)
end
 
 
local s
if type(r) == "number" and type(g) == "number" and type(b) == "number" then
if options.hasAlpha and type(a) == "number" then
2163,30 → 2087,19
print((options.message or IS_NOW_SET_TO):format(tostring(options.cmdName or options.name), s), realOptions.cmdName or realOptions.name or self)
else
local r,g,b,a
if passTable then
if type(passTable.get) == "function" then
r,g,b,a = passTable.get(passValue)
else
if type(handler[passTable.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(passTable.get)))
end
r,g,b,a = handler[passTable.get](handler, passValue)
end
if type(options_p.get) == "function" then
r,g,b,a = options_p.get(passValue)
else
if type(options.get) == "function" then
r,g,b,a = options.get()
else
if type(handler[options.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options.get)))
end
r,g,b,a = handler[options.get](handler)
if type(handler[options_p.get]) ~= "function" then
AceConsole:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(options_p.get)))
end
r,g,b,a = handler[options_p.get](handler, passValue)
end
 
 
if not colorTable then
colorTable = {}
local t = colorTable
 
 
if ColorPickerOkayButton then
local ColorPickerOkayButton_OnClick = ColorPickerOkayButton:GetScript("OnClick")
ColorPickerOkayButton:SetScript("OnClick", function()
2241,7 → 2154,7
colorTable[k] = nil
end
end
 
 
if type(r) ~= "number" or type(g) ~= "number" or type(b) ~= "number" then
r,g,b = 1, 1, 1
end
2258,13 → 2171,13
t.realOptions = realOptions
t.hasAlpha = options.hasAlpha
t.handler = handler
t.set = passTable and passTable.set or options.set
t.get = passTable and passTable.get or options.get
t.set = options_p.set
t.get = options_p.get
t.name = options.cmdName or options.name
t.message = options.message or IS_NOW_SET_TO
t.passValue = passValue
t.active = true
 
 
if not colorFunc then
colorFunc = function()
local r,g,b = ColorPickerFrame:GetColorRGB()
2306,7 → 2219,7
end
end
end
 
 
ColorPickerFrame.func = colorFunc
ColorPickerFrame.hasOpacity = options.hasAlpha
if options.hasAlpha then
2314,7 → 2227,7
ColorPickerFrame.opacity = 1 - a
end
ColorPickerFrame:SetColorRGB(r,g,b)
 
 
if not colorCancelFunc then
colorCancelFunc = function()
if t.hasAlpha then
2360,33 → 2273,52
ColorPickerFrame.opacityFunc = nil
end
end
 
 
ColorPickerFrame.cancelFunc = colorCancelFunc
 
 
ShowUIPanel(ColorPickerFrame)
end
return
elseif kind == "group" then
if #args == 0 then
printUsage(self, handler, realOptions, options, path, args)
printUsage(self, handler, realOptions, options, path, args, passValue)
else
-- invalid argument
print((options.error or IS_NOT_A_VALID_OPTION_FOR):format(args[1], path), realOptions.cmdName or realOptions.name or self)
end
return
end
this = _G_this
if Dewdrop then
Dewdrop:Refresh(1)
Dewdrop:Refresh(2)
Dewdrop:Refresh(3)
Dewdrop:Refresh(4)
Dewdrop:Refresh(5)
Dewdrop:Refresh()
end
end
 
local external
function AceConsole:RegisterChatCommand(slashCommands, options, name)
local tmp
function AceConsole:RegisterChatCommand(...) -- slashCommands, options, name
local slashCommands, options, name
if type((...)) == "string" then
if not tmp then
tmp = {}
else
for i in ipairs(tmp) do
tmp[i] = nil
end
end
for i = 1, select('#', ...)+1 do
local v = select(i, ...)
if type(v) == "string" then
tmp[#tmp+1] = v
else
slashCommands = tmp
options = v
name = select(i+1, ...)
break
end
end
else
slashCommands, options, name = ...
end
if type(slashCommands) ~= "table" and slashCommands ~= false then
AceConsole:error("Bad argument #2 to `RegisterChatCommand' (expected table, got %s)", type(slashCommands))
end
2407,7 → 2339,7
if #slashCommands == 0 then
AceConsole:error("Argument #2 to `RegisterChatCommand' must include at least one string")
end
 
 
for k,v in pairs(slashCommands) do
if type(k) ~= "number" then
AceConsole:error("All keys in argument #2 to `RegisterChatCommand' must be numbers")
2419,7 → 2351,7
end
end
end
 
 
if not options then
options = {
type = 'group',
2427,7 → 2359,7
handler = self
}
end
 
 
if type(options) == "table" then
local err, position = validateOptions(options)
if err then
2437,40 → 2369,40
AceConsole:error(err)
end
end
 
 
if not options.handler then
options.handler = self
end
 
 
if options.handler == self and options.type:lower() == "group" and self.class then
AceConsole:InjectAceOptionsTable(self, options)
end
end
 
 
local chat
if slashCommands then
chat = slashCommands[1]
else
chat = _G["SLASH_"..name..1]
end
 
 
local handler
if type(options) == "function" then
handler = options
for k,v in pairs(_G) do
if handler == v then
local k = k
handler = function(msg)
return _G[k](msg)
handler = function(msg, chatFrame)
return _G[k](msg, chatFrame)
end
break
end
end
else
function handler(msg)
function handler(msg, chatFrame)
handlerFunc(self, chat, msg, options)
end
end
 
 
if not _G.SlashCmdList then
_G.SlashCmdList = {}
end
2485,7 → 2417,7
name = string.char(math.random(26) + A - 1) .. string.char(math.random(26) + A - 1) .. string.char(math.random(26) + A - 1) .. string.char(math.random(26) + A - 1) .. string.char(math.random(26) + A - 1) .. string.char(math.random(26) + A - 1) .. string.char(math.random(26) + A - 1) .. string.char(math.random(26) + A - 1)
until not _G.SlashCmdList[name]
end
 
 
if slashCommands then
if _G.SlashCmdList[name] then
local i = 0
2498,34 → 2430,14
end
end
end
 
 
local i = 0
for _,command in ipairs(slashCommands) do
local good = true
for k in pairs(_G.SlashCmdList) do
local j = 0
while true do
j = j + 1
local cmd = _G["SLASH_" .. k .. j]
if not cmd then
break
end
if command:lower() == cmd:lower() then
good = false
break
end
end
if not good then
break
end
end
if good then
i = i + 1
_G["SLASH_"..name..i] = command
if command:lower() ~= command then
i = i + 1
_G["SLASH_"..name..i] = command
if command:lower() ~= command then
i = i + 1
_G["SLASH_"..name..i] = command:lower()
end
_G["SLASH_"..name..i] = command:lower()
end
end
end
2533,7 → 2445,7
if self ~= AceConsole and self.slashCommand == nil then
self.slashCommand = chat
end
 
 
if not AceEvent and AceLibrary:HasInstance("AceEvent-2.0") then
external(AceConsole, "AceEvent-2.0", AceLibrary("AceEvent-2.0"))
end
2548,8 → 2460,14
end
end
end
 
 
AceConsole.registry[name] = options
 
if slashCommands == tmp then
for i in ipairs(tmp) do
tmp[i] = nil
end
end
end
 
function AceConsole:InjectAceOptionsTable(handler, options)
2563,24 → 2481,10
end
options.handler = handler
local class = handler.class
if not class then
self:error("Cannot retrieve AceOptions tables from a non-object argument #2")
end
while class and class ~= AceOO.Class do
if type(class.GetAceOptionsDataTable) == "function" then
local t = class:GetAceOptionsDataTable(handler)
for k,v in pairs(t) do
if type(options.args) ~= "table" then
options.args = {}
end
if options.args[k] == nil then
options.args[k] = v
end
end
end
local mixins = class.mixins
if mixins then
for mixin in pairs(mixins) do
if not AceLibrary:HasInstance("AceOO-2.0") or not class then
if Rock then
-- possible Rock object
for mixin in Rock:IterateObjectMixins(handler) do
if type(mixin.GetAceOptionsDataTable) == "function" then
local t = mixin:GetAceOptionsDataTable(handler)
for k,v in pairs(t) do
2594,8 → 2498,40
end
end
end
class = class.super
else
-- Ace2 object
while class and class ~= AceLibrary("AceOO-2.0").Class do
if type(class.GetAceOptionsDataTable) == "function" then
local t = class:GetAceOptionsDataTable(handler)
for k,v in pairs(t) do
if type(options.args) ~= "table" then
options.args = {}
end
if options.args[k] == nil then
options.args[k] = v
end
end
end
local mixins = class.mixins
if mixins then
for mixin in pairs(mixins) do
if type(mixin.GetAceOptionsDataTable) == "function" then
local t = mixin:GetAceOptionsDataTable(handler)
for k,v in pairs(t) do
if type(options.args) ~= "table" then
options.args = {}
end
if options.args[k] == nil then
options.args[k] = v
end
end
end
end
end
class = class.super
end
end
 
return options
end
 
2639,7 → 2575,7
if major == "AceEvent-2.0" then
if not AceEvent then
AceEvent = instance
 
 
AceEvent:embed(self)
end
elseif major == "AceTab-2.0" then
2656,7 → 2592,7
local handler = v.handler or handler
if hidden then
if type(hidden) == "function" then
hidden = hidden()
hidden = hidden(v.passValue)
elseif type(hidden) == "string" then
local f = hidden
local neg = f:match("^~(.-)$")
2666,7 → 2602,7
if type(handler[f]) ~= "function" then
self:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(f)))
end
hidden = handler[f](handler)
hidden = handler[f](handler, v.passValue)
if neg then
hidden = not hidden
end
2675,7 → 2611,7
local disabled = hidden or v.disabled
if disabled then
if type(disabled) == "function" then
disabled = disabled()
disabled = disabled(v.passValue)
elseif type(disabled) == "string" then
local f = disabled
local neg = f:match("^~(.-)$")
2685,7 → 2621,7
if type(handler[f]) ~= "function" then
self:error("%s: %s", handler, OPTION_HANDLER_NOT_FOUND:format(tostring(f)))
end
disabled = handler[f](handler)
disabled = handler[f](handler, v.passValue)
if neg then
disabled = not disabled
end
2701,7 → 2637,7
local name, cmd, path = self:TabCompleteInfo(cmdpath)
if self.registry[name] then
local validArgs, path2, argwork, handler = findTableLevel(self, self.registry[name], cmd, path)
printUsage(self, validArgs.handler or handler, self.registry[name], validArgs, path2, argwork, not gcs or gcs ~= "", gcs)
printUsage(self, validArgs.handler or handler, self.registry[name], validArgs, path2, argwork, argwork[#argwork], not gcs or gcs ~= "", gcs)
end
end)
elseif major == "Dewdrop-2.0" then
2711,12 → 2647,12
 
local function activate(self, oldLib, oldDeactivate)
AceConsole = self
 
 
if oldLib then
self.registry = oldLib.registry
self.nextAddon = oldLib.nextAddon
end
 
 
if not self.registry then
self.registry = {}
else
2724,9 → 2660,9
self:RegisterChatCommand(false, options, name)
end
end
 
self:RegisterChatCommand({ "/reload", "/rl", "/reloadui" }, function() ReloadUI() end, "RELOAD")
self:RegisterChatCommand({ "/gm" }, function() ToggleHelpFrame() end, "GM")
 
self:RegisterChatCommand("/reload", "/rl", "/reloadui", ReloadUI, "RELOAD")
self:RegisterChatCommand("/gm", ToggleHelpFrame, "GM")
local t = { "/print", "/echo" }
local _,_,_,enabled,loadable = GetAddOnInfo("DevTools")
if not enabled and not loadable then
2741,9 → 2677,9
f()
end
end, "PRINT")
 
 
self:activate(oldLib, oldDeactivate)
 
 
if oldDeactivate then
oldDeactivate(oldLib)
end
trunk/FuBar_RecapFu/libs/AceConsole-2.0/AceConsole-2.0.toc New file
0,0 → 1,16
## 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: AceConsole-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, AceEvent-2.0, AceOO-2.0
 
AceConsole-2.0.lua
Property changes : Added: svn:eol-style + native
trunk/FuBar_RecapFu/libs/Crayon-2.0/Crayon-2.0.lua
1,6 → 1,6
--[[
Name: Crayon-2.0
Revision: $Rev: 25921 $
Revision: $Rev: 52899 $
Author(s): ckknight (ckknight@gmail.com)
Website: http://ckknight.wowinterface.com/
Documentation: http://wiki.wowace.com/index.php/Crayon-2.0
12,7 → 12,7
--Theondry (theondry@gmail.com) added the purple. yell at me if it's wrong, please
 
local MAJOR_VERSION = "Crayon-2.0"
local MINOR_VERSION = "$Revision: 25921 $"
local MINOR_VERSION = "$Revision: 52899 $"
 
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
28,6 → 28,8
Crayon.COLOR_HEX_SILVER = "c7c7cf"
Crayon.COLOR_HEX_GOLD = "ffd700"
Crayon.COLOR_HEX_PURPLE = "9980CC"
Crayon.COLOR_HEX_BLUE = "0000ff"
Crayon.COLOR_HEX_BLACK = "000000"
 
function Crayon:Colorize(hexColor, text)
return "|cff" .. tostring(hexColor or 'ffffff') .. tostring(text) .. "|r"
41,6 → 43,8
function Crayon:Silver(text) return self:Colorize(self.COLOR_HEX_SILVER, text) end
function Crayon:Gold(text) return self:Colorize(self.COLOR_HEX_GOLD, text) end
function Crayon:Purple(text) return self:Colorize(self.COLOR_HEX_PURPLE, text) end
function Crayon:Blue(text) return self:Colorize(self.COLOR_HEX_BLUE, text) end
function Crayon:Black(text) return self:Colorize(self.COLOR_HEX_BLACK, text) end
 
local inf = 1/0
 
trunk/FuBar_RecapFu/libs/Tablet-2.0/Tablet-2.0.lua
1,6 → 1,6
--[[
Name: Tablet-2.0
Revision: $Rev: 30695 $
Revision: $Rev: 216 $
Author(s): ckknight (ckknight@gmail.com)
Website: http://ckknight.wowinterface.com/
Documentation: http://www.wowace.com/index.php/Tablet-2.0
11,7 → 11,7
]]
 
local MAJOR_VERSION = "Tablet-2.0"
local MINOR_VERSION = tonumber(("$Revision: 30695 $"):sub(12, -3))
local MINOR_VERSION = 90000 + tonumber(("$Revision: 216 $"):match("(%d+)"))
 
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
75,19 → 75,19
LOCK = "锁定"
LOCK_DESC = "锁定菜单当前位置. alt+右键 将显示选项, alt+拖动 可以移动已锁定的菜单."
elseif GetLocale() == "zhTW" then
SCROLL_UP = "向上翻轉"
SCROLL_DOWN = "向上翻轉"
SCROLL_UP = "向上翻捲"
SCROLL_DOWN = "向上翻捲"
HINT = "提示"
DETACH = "分離"
DETACH_DESC = "分離選單為獨立提示。"
SIZE = "尺寸"
SIZE_DESC = "縮放選單顯示尺寸。"
CLOSE_MENU = "關閉選單"
CLOSE_MENU_DESC = "關閉選單"
CLOSE_MENU_DESC = "關閉選單。"
COLOR = "背景顏色"
COLOR_DESC = "設置選單背景顏色。"
COLOR_DESC = "設定選單背景顏色。"
LOCK = "鎖定"
LOCK_DESC = "鎖定選單目前位置. Alt+右鍵 將顯示選項,Alt+拖動 可以移動已鎖定的選單。"
LOCK_DESC = "鎖定選單目前位置設定。Alt-右鍵將顯示選項,Alt-拖動可以移動已鎖定的選單。"
elseif GetLocale() == "frFR" then
SCROLL_UP = "Parcourir vers le haut"
SCROLL_DOWN = "Parcourir vers le bas"
116,6 → 116,20
COLOR_DESC = "Establece el color de fondo"
LOCK = "Bloquear"
LOCK_DESC = "Bloquea el tooltip en su posici\195\179n actual. Clic+Alt para el men\195\186 y arrastra+Alt para arrastrarlo cuando est\195\161 bloqueado"
elseif GetLocale() == "ruRU" then
SCROLL_UP = "Прокрутка вверх"
SCROLL_DOWN = "Прокрутка вниз"
HINT = "Совет"
DETACH = "Отделить"
DETACH_DESC = "Отделить планшет от его источника."
SIZE = "Размер"
SIZE_DESC = "Масштаб планшета."
CLOSE_MENU = "Закрыть меню"
CLOSE_MENU_DESC = "Закрыть меню."
COLOR = "Цвет фона"
COLOR_DESC = "Установить цвет фона."
LOCK = "Зафиксировать"
LOCK_DESC = "Зафиксировать планшет в его текущем позиции. Alt+ПКМ для меню или Alt+перетаскивание для перетаскивания когда планшет зафиксирован."
end
 
local start = GetTime()
168,12 → 182,13
if UIParent:IsShown() then
return UIParent
end
local f = GetFullScreenFrame()
local f = GetUIPanel("fullscreen")
if f and f:IsShown() then
return f
end
return nil
end
GetMainFrame = wrap(GetMainFrame, "GetMainFrame")
 
local MIN_TOOLTIP_SIZE = 200
local TESTSTRING_EXTRA_WIDTH = 8
183,20 → 198,23
local pool = {}
 
local function del(t)
if t then
for k in pairs(t) do
t[k] = nil
end
setmetatable(t, nil)
pool[t] = true
setmetatable(t, nil)
for k in pairs(t) do
t[k] = nil
end
t[''] = true
t[''] = nil
pool[t] = true
return nil
end
 
local new
 
local function copy(parent)
local t = next(pool) or {}
pool[t] = nil
local t = next(pool)
if not t then
t = {}
else
pool[t] = nil
end
if parent then
for k,v in pairs(parent) do
t[k] = v
206,9 → 224,13
return t
end
 
function new(...)
local t = next(pool) or {}
pool[t] = nil
local function new(...)
local t = next(pool)
if not t then
t = {}
else
pool[t] = nil
end
 
for i = 1, select('#', ...), 2 do
local k = select(i, ...)
243,12 → 265,12
 
local headerSize, normalSize
if GameTooltipHeaderText then
_,headerSize = GameTooltipHeaderText:GetFont()
headerSize = select(2,GameTooltipHeaderText:GetFont())
else
headerSize = 14
end
if GameTooltipText then
_,normalSize = GameTooltipText:GetFont()
normalSize = select(2,GameTooltipText:GetFont())
else
normalSize = 12
end
268,6 → 290,7
testString:SetText(text)
return testString:GetStringWidth()-- + TESTSTRING_EXTRA_WIDTH
end
getTestWidth = wrap(getTestWidth, "getTestWidth")
do
local TabletData_mt = { __index = TabletData }
function TabletData:new(tablet)
282,6 → 305,7
setmetatable(self, TabletData_mt)
return self
end
TabletData.new = wrap(TabletData.new, "TabletData:new")
 
function TabletData:checkMinWidth()
local min = self.minWidth or MIN_TOOLTIP_SIZE
290,6 → 314,7
self.width = width
end
end
TabletData.checkMinWidth = wrap(TabletData.checkMinWidth, "TabletData:checkMinWidth")
 
function TabletData:del()
for k, v in ipairs(self.categories) do
298,6 → 323,7
del(self.categories)
del(self)
end
TabletData.del = wrap(TabletData.del, "TabletData:del")
 
function TabletData:Display()
if self.title and (self.tablet == tooltip or self.tablet.registration.showTitleWhenDetached) then
381,6 → 407,7
self.tablet.tmpHidden = nil
end
end
TabletData.Display = wrap(TabletData.Display, "TabletData:Display")
 
function TabletData:AddCategory(info, index)
local made = false
399,20 → 426,24
end
return cat
end
TabletData.AddCategory = wrap(TabletData.AddCategory, "TabletData:AddCategory")
 
function TabletData:SetHint(hint)
self.hint = hint
end
TabletData.SetHint = wrap(TabletData.SetHint, "TabletData:SetHint")
 
function TabletData:SetTitle(title)
self.title = title or "Title"
end
TabletData.SetTitle = wrap(TabletData.SetTitle, "TabletData:SetTitle")
 
function TabletData:SetTitleColor(r, g, b)
self.titleR = r
self.titleG = g
self.titleB = b
end
TabletData.SetTitleColor = wrap(TabletData.SetTitleColor, "TabletData:SetTitleColor")
end
do
local Category_mt = { __index = Category }
421,7 → 452,7
if superCategory and not self.noInherit then
self.superCategory = superCategory.superCategory
for k, v in pairs(superCategory) do
if string.find(k, "^child_") then
if k:find("^child_") then
local k = strsub(k, 7)
if self[k] == nil then
self[k] = v
520,7 → 551,7
x['size' .. i] = self['size' .. i]
x['justify' .. i] = self['justify' .. i]
end
if self.checkIcon and string.find(self.checkIcon, "^Interface\\Icons\\") then
if self.checkIcon and self.checkIcon:find("^Interface\\Icons\\") then
x.checkCoordLeft = self.checkCoordLeft or 0.05
x.checkCoordRight = self.checkCoordRight or 0.95
x.checkCoordTop = self.checkCoordTop or 0.05
540,6 → 571,7
end
return self
end
Category.new = wrap(Category.new, "Category:new")
 
function Category:del()
local prev = garbageLine
549,6 → 581,7
del(self.lines)
del(self)
end
Category.del = wrap(Category.del, "Category:del")
 
function Category:AddLine(...)
self.lastWasTitle = nil
563,6 → 596,7
info = del(info)
end
end
Category.AddLine = wrap(Category.AddLine, "Category:AddLine")
 
function Category:AddCategory(...)
local lastWasTitle = self.lastWasTitle
584,6 → 618,7
end
return cat
end
Category.AddCategory = wrap(Category.AddCategory, "Category:AddCategory")
 
function Category:HasChildren()
local hasChildren = false
599,6 → 634,7
end
return false
end
Category.HasChildren = wrap(Category.HasChildren, "Category:HasChildren")
 
local lastWasTitle = false
function Category:Display(tablet)
608,7 → 644,8
if not self.hideBlankLine and not lastWasTitle then
local info = new(
'blank', true,
'fakeChild', true
'fakeChild', true,
'noInherit', true
)
self:AddLine(info, 1)
del(info)
626,6 → 663,7
lastWasTitle = self.isTitle
return good
end
Category.Display = wrap(Category.Display, "Category:Display")
end
do
local Line_mt = { __index = Line }
633,7 → 671,7
local self = copy(info)
if not info.noInherit then
for k, v in pairs(category) do
if string.find(k, "^child_") then
if k:find("^child_") then
local k = strsub(k, 7)
if self[k] == nil then
self[k] = v
703,14 → 741,14
end
end
if not self.size then
_,self.size = self.font:GetFont()
self.size = select(2,self.font:GetFont())
end
for i = 2, columns do
if not self['size' .. i] then
_,self['size' .. i] = self['font' .. i]:GetFont()
self['size' .. i] = select(2,self['font' .. i]:GetFont())
end
end
if self.checkIcon and string.find(self.checkIcon, "^Interface\\Icons\\") then
if self.checkIcon and self.checkIcon:find("^Interface\\Icons\\") then
if not self.checkCoordLeft then
self.checkCoordLeft = 0.05
end
827,15 → 865,18
end
return self
end
Line.new = wrap(Line.new, "Line:new")
 
function Line:del()
del(self)
end
Line.del = wrap(Line.del, "Line:del")
 
function Line:Display(tablet)
tablet:AddLine(self)
return true
end
Line.Display = wrap(Line.Display, "Line:Display")
end
 
local fake_ipairs
856,6 → 897,7
end
return iter, tmp, 0
end
fake_ipairs = wrap(fake_ipairs, "fake_ipairs")
end
 
local function argunpack(t, key, i)
867,7 → 909,8
if v then
return v, argunpack(t, key, i+1)
end
end
end
argunpack = wrap(argunpack, "argunpack")
 
 
local delstring, newstring
881,6 → 924,7
t:SetParent(UIParent)
return nil
end
delstring = wrap(delstring, "delstring")
function newstring(parent)
if #cache ~= 0 then
local t = cache[#cache]
892,6 → 936,7
local t = parent:CreateFontString(nil, "ARTWORK")
return t
end
newstring = wrap(newstring, "newstring")
end
 
local function button_OnEnter(this, ...)
905,7 → 950,8
geterrorhandler()(ret)
end
end
end
end
button_OnEnter = wrap(button_OnEnter, "button_OnEnter")
 
local function button_OnLeave(this, ...)
if type(this.self:GetScript("OnLeave")) == "function" then
919,6 → 965,7
end
end
end
button_OnLeave = wrap(button_OnLeave, "button_OnLeave")
local lastMouseDown
local function button_OnClick(this, arg1, ...)
if this.self:HasScript("OnClick") and type(this.self:GetScript("OnClick")) == "function" then
945,6 → 992,7
end
end
end
button_OnClick = wrap(button_OnClick, "button_OnClick")
local function button_OnMouseUp(this, arg1, ...)
if this.self:HasScript("OnMouseUp") and type(this.self:GetScript("OnMouseUp")) == "function" then
this.self:GetScript("OnMouseUp")(this.self, arg1, ...)
957,6 → 1005,7
end
end
end
button_OnMouseUp = wrap(button_OnMouseUp, "button_OnMouseUp")
local function button_OnMouseDown(this, arg1, ...)
if this.self:HasScript("OnMouseDown") and type(this.self:GetScript("OnMouseDown")) == "function" then
this.self:GetScript("OnMouseDown")(this.self, arg1, ...)
968,18 → 1017,21
this.clicked = true
end
end
button_OnMouseDown = wrap(button_OnMouseDown, "button_OnMouseDown")
local function button_OnDragStart(this, ...)
local parent = this:GetParent() and this:GetParent().tablet
if parent:GetScript("OnDragStart") then
return parent:GetScript("OnDragStart")(parent, ...)
end
end
button_OnDragStart = wrap(button_OnDragStart, "button_OnDragStart")
local function button_OnDragStop(this, ...)
local parent = this:GetParent() and this:GetParent().tablet
if parent:GetScript("OnDragStop") then
return parent:GetScript("OnDragStop")(parent, ...)
end
end
button_OnDragStop = wrap(button_OnDragStop, "button_OnDragStop")
 
local num_buttons = 0
local function NewLine(self)
1018,7 → 1070,7
check.shown = false
check:SetPoint("TOPLEFT", button, "TOPLEFT")
col1:SetPoint("TOPLEFT", check, "TOPLEFT")
local _,size = GameTooltipText:GetFont()
local size = select(2,GameTooltipText:GetFont())
check:SetHeight(size * 1.5)
check:SetWidth(size * 1.5)
check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check")
1051,7 → 1103,7
elseif c:find("^BOTTOM") then
top = b:GetBottom()
else
_,top = b:GetCenter()
top = select(2,b:GetCenter())
end
if top then
top = top + e
1062,7 → 1114,7
elseif c:find("^BOTTOM") then
bottom = b:GetBottom()
else
_,bottom = b:GetCenter()
bottom = select(2,b:GetCenter())
end
if bottom then
bottom = bottom + e
1075,6 → 1127,7
end
end
end
RecalculateTabletHeight = wrap(RecalculateTabletHeight, "RecalculateTabletHeight")
 
local function GetTooltipHeight(self)
RecalculateTabletHeight(self)
1362,7 → 1415,7
info.font = GameTooltipText
end
if not info.size then
_,info.size = info.font:GetFont()
info.size = select(2,info.font:GetFont())
end
local catStart = false
local columns = category and category.columns or 1
1534,6 → 1587,7
button.func = nil
button.onEnterFunc = nil
button.onLeaveFunc = nil
button:SetFrameLevel(12) -- hack suggested on forum. Added 06/17/2007. (hC)
if not self.locked or IsAltKeyDown() then
local func = info.func
if func then
1846,7 → 1900,7
if not frame then
frame = CreateFrame("Frame")
frame:SetScript("OnEvent", function(this, _, modifier)
if modifier == "ALT" then
if modifier == "LALT" or modifier == "RALT" then
this.func()
end
end)
1854,11 → 1908,13
frame:RegisterEvent("MODIFIER_STATE_CHANGED")
frame.func = func
end
StartCheckingAlt = wrap(StartCheckingAlt, "StartCheckingAlt")
function StopCheckingAlt()
if frame then
frame:UnregisterEvent("MODIFIER_STATE_CHANGED")
end
end
StopCheckingAlt = wrap(StopCheckingAlt, "StopCheckingAlt")
end
 
function AcquireDetachedFrame(self, registration, data, detachedData)
1957,7 → 2013,7
detached.r = 0
detached.g = 0
detached.b = 0
detached:SetFrameStrata(registration.strata or "BACKGROUND")
detached:SetFrameStrata(registration and registration.strata or "BACKGROUND")
detached:SetBackdrop(tmp.a(
'bgFile', "Interface\\Buttons\\WHITE8X8",
'edgeFile', "Interface\\Tooltips\\UI-Tooltip-Border",
1976,7 → 2032,7
 
local width = GetScreenWidth()
local height = GetScreenHeight()
if registration.movable == false then
if registration and registration.movable == false then
detached:RegisterForDrag()
else
detached:RegisterForDrag("LeftButton")
1989,6 → 2045,8
detached:SetScript("OnDragStop", function(this)
detached:StopMovingOrSizing()
detached.moving = nil
detached:SetClampedToScreen(1)
detached:SetClampedToScreen(nil)
local anchor
local offsetx
local offsety
2076,7 → 2134,11
return
end
if detached.menu then
detached.menu(level, value)
if type(detached.menu) == "function" then
detached.menu(level, value)
else
Dewdrop:FeedAceOptionsTable(detached.menu)
end
if level == 1 then
Dewdrop:AddLine()
end
2238,7 → 2300,9
function detached:Lock()
self:EnableMouse(self.locked)
self.locked = not self.locked
self.detachedData.locked = self.locked or nil
if self.detachedData then
self.detachedData.locked = self.locked or nil
end
self:children()
end
 
2285,17 → 2349,35
local detachedData = info.detachedData
if detachedData and detachedData.detached then
ReleaseDetachedFrame(self, data, detachedData)
elseif tooltip.data == data then
elseif tooltip and tooltip.data == data then
tooltip:Hide()
if tooltip.registration then
tooltip.registration.tooltip = nil
tooltip.registration = nil
end
end
tooltip.enteredFrame = false
if tooltip then tooltip.enteredFrame = false end
end
Tablet.Close = wrap(Tablet.Close, "Tablet:Close")
 
local function frame_children(self)
if not self.preventRefresh and self:GetParent() and self:GetParent():IsShown() then
Tablet.currentFrame = self
Tablet.currentTabletData = TabletData:new(self)
Tablet.currentTabletData.minWidth = self.minWidth
self:ClearLines()
if self.runChildren then
self.runChildren()
end
Tablet.currentTabletData:Display(Tablet.currentFrame)
self:Show(Tablet.currentTabletData)
Tablet.currentTabletData:del()
Tablet.currentTabletData = nil
Tablet.currentFrame = nil
end
end
frame_children = wrap(frame_children, "frame_children")
 
function Tablet:Open(fakeParent, parent)
self:argCheck(fakeParent, 2, "table", "string")
self:argCheck(parent, 3, "nil", "table", "string")
2326,22 → 2408,7
frame.minWidth = info.minWidth
if not frame.children or not frame.childrenVer or frame.childrenVer < MINOR_VERSION then
frame.childrenVer = MINOR_VERSION
function frame:children()
if not self.preventRefresh and self:GetParent():IsShown() then
Tablet.currentFrame = self
Tablet.currentTabletData = TabletData:new(self)
Tablet.currentTabletData.minWidth = self.minWidth
self:ClearLines()
if self.runChildren then
self.runChildren()
end
Tablet.currentTabletData:Display(Tablet.currentFrame)
self:Show(Tablet.currentTabletData)
Tablet.currentTabletData:del()
Tablet.currentTabletData = nil
Tablet.currentFrame = nil
end
end
frame.children = frame_children
end
frame:SetOwner(fakeParent)
frame:children()
2369,6 → 2436,8
end
local offsetx = 0
local offsety = 0
frame:SetClampedToScreen(1)
frame:SetClampedToScreen(nil)
if frame:GetBottom() and frame:GetLeft() then
if frame:GetRight() > GetScreenWidth() then
offsetx = frame:GetRight() - GetScreenWidth()
2461,7 → 2530,7
info = new(...)
end
self.registry[parent] = info
info.data = info.data or info.detachedData or {}
info.data = info.data or info.detachedData or new()
info.detachedData = info.detachedData or info.data
local data = info.data
local detachedData = info.detachedData
2536,6 → 2605,7
end
_id = 0
end
CleanCategoryPool = wrap(CleanCategoryPool, "CleanCategoryPool")
 
function Tablet:AddCategory(...)
if not self.currentFrame then
2578,18 → 2648,22
function Tablet:GetNormalFontSize()
return normalSize
end
Tablet.GetNormalFontSize = wrap(Tablet.GetNormalFontSize, "Tablet:GetNormalFontSize")
 
function Tablet:GetHeaderFontSize()
return headerSize
end
Tablet.GetHeaderFontSize = wrap(Tablet.GetHeaderFontSize, "Tablet:GetHeaderFontSize")
 
function Tablet:GetNormalFontObject()
return GameTooltipText
end
Tablet.GetNormalFontObject = wrap(Tablet.GetNormalFontObject, "Tablet:GetNormalFontObject")
 
function Tablet:GetHeaderFontObject()
return GameTooltipHeaderText
end
Tablet.GetHeaderFontObject = wrap(Tablet.GetHeaderFontObject, "Tablet:GetHeaderFontObject")
 
function Tablet:SetFontSizePercent(parent, percent)
self:argCheck(parent, 2, "table", "string")
2732,7 → 2806,7
if not info.detachedData then
self:error("You cannot detach tablet without a data field.")
end
if info.tooltip and info.tooltip == tooltip then
if info.tooltip and info.tooltip == tooltip and tooltip.registration then
tooltip:Detach()
else
info.detachedData.detached = true
2743,22 → 2817,7
detached.minWidth = info.minWidth
if not detached.children or not detached.childrenVer or detached.childrenVer < MINOR_VERSION then
detached.childrenVer = MINOR_VERSION
function detached:children()
if not self.preventRefresh then
Tablet.currentFrame = self
Tablet.currentTabletData = TabletData:new(self)
Tablet.currentTabletData.minWidth = self.minWidth
self:ClearLines()
if self.runChildren then
self.runChildren()
end
Tablet.currentTabletData:Display(Tablet.currentFrame)
self:Show(Tablet.currentTabletData)
Tablet.currentTabletData:del()
Tablet.currentTabletData = nil
Tablet.currentFrame = nil
end
end
detached.children = frame_children
end
detached:SetOwner(parent)
detached:children()
2883,7 → 2942,7
SLASH_TABLET1 = "/tablet"
SLASH_TABLET2 = "/tabletlib"
SlashCmdList["TABLET"] = function(msg)
TabletLib:GetInstance(MAJOR_VERSION):ListProfileInfo()
AceLibrary(MAJOR_VERSION):ListProfileInfo()
end
end
 
trunk/FuBar_RecapFu/libs/AceAddon-2.0/AceAddon-2.0.lua
1,6 → 1,6
--[[
--[[
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/
12,7 → 12,7
]]
 
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
25,7 → 25,7
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
 
42,6 → 42,10
 
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",
81,7 → 85,7
}
elseif GetLocale() == "frFR" then
STANDBY = "|cffff5050(attente)|r"
 
 
TITLE = "Titre"
NOTES = "Notes"
VERSION = "Version"
92,10 → 96,14
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",
134,21 → 142,25
}
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"] = "경매",
187,25 → 199,29
}
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"] = "聊天/通訊",
222,25 → 238,25
["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 = "版本"
251,10 → 267,14
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"] = "拍卖",
271,9 → 291,9
["Shaman"] = "萨满祭司",
["Warlock"] = "术士",
["Warrior"] = "战士",
-- ["Healer"] = "治疗保障",
-- ["Tank"] = "近战控制",
-- ["Caster"] = "远程输出",
["Healer"] = "Healer",
["Tank"] = "Tank",
["Caster"] = "Caster",
["Combat"] = "战斗",
["Compilations"] = "编译",
["Data Export"] = "数据导出",
293,7 → 313,7
}
elseif GetLocale() == "esES" then
STANDBY = "|cffff5050(espera)|r"
 
 
TITLE = "Título"
NOTES = "Notas"
VERSION = "Versión"
304,10 → 324,14
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",
344,9 → 368,66
["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"
357,10 → 438,14
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",
403,6 → 488,7
local lowerKey = key:lower()
for k,v in pairs(CATEGORIES) do
if k:lower() == lowerKey then
self[lowerKey] = v
return v
end
end
463,27 → 549,7
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
517,7 → 583,7
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")
540,6 → 606,12
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
592,6 → 664,7
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
606,70 → 679,298
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()
679,27 → 980,7
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
750,16 → 1031,65
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
769,7 → 1099,7
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"
1103,7 → 1433,7
 
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 {}
1111,7 → 1441,7
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
trunk/FuBar_RecapFu/libs/AceAddon-2.0/AceAddon-2.0.toc New file
0,0 → 1,16
## 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
Property changes : Added: svn:eol-style + native
trunk/FuBar_RecapFu/libs/AceDB-2.0/AceDB-2.0.lua
1,11 → 1,11
--[[
--[[
Name: AceDB-2.0
Revision: $Rev: 29174 $
Revision: $Rev: 1094 $
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/
Documentation: http://www.wowace.com/index.php/AceDB-2.0
SVN: http://svn.wowace.com/root/trunk/Ace2/AceDB-2.0
SVN: http://svn.wowace.com/wowace/trunk/Ace2/AceDB-2.0
Description: Mixin to allow for fast, clean, and featureful saved variable
access.
Dependencies: AceLibrary, AceOO-2.0, AceEvent-2.0
13,7 → 13,7
]]
 
local MAJOR_VERSION = "AceDB-2.0"
local MINOR_VERSION = "$Revision: 29174 $"
local MINOR_VERSION = 90000 + tonumber(("$Revision: 1094 $"):match("(%d+)"))
 
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
27,7 → 27,16
 
local ACTIVE, ENABLED, STATE, TOGGLE_ACTIVE, MAP_ACTIVESUSPENDED, SET_PROFILE, SET_PROFILE_USAGE, PROFILE, PLAYER_OF_REALM, CHOOSE_PROFILE_DESC, CHOOSE_PROFILE_GUI, COPY_PROFILE_DESC, COPY_PROFILE_GUI, OTHER_PROFILE_DESC, OTHER_PROFILE_GUI, OTHER_PROFILE_USAGE, RESET_PROFILE, RESET_PROFILE_DESC, CHARACTER_COLON, REALM_COLON, CLASS_COLON, DEFAULT, ALTERNATIVE
 
-- Move these into "enUS" when they've been translated in all other locales
local DELETE_PROFILE = "Delete"
local DELETE_PROFILE_DESC = "Deletes a profile. Note that no check is made whether this profile is in use by other characters or not."
local DELETE_PROFILE_USAGE = "<profile name>"
 
if GetLocale() == "deDE" then
DELETE_PROFILE = "L\195\182schen"
DELETE_PROFILE_DESC = "L\195\182scht ein Profil. Beachte das nicht \195\188berpr\195\188ft wird ob das zu l\195\182schende Profil von anderen Charakteren genutzt wird oder nicht."
DELETE_PROFILE_USAGE = "<profil name>"
 
ACTIVE = "Aktiv"
ENABLED = "Aktiviert"
STATE = "Status"
44,15 → 53,15
OTHER_PROFILE_DESC = "W\195\164hle ein anderes Profil."
OTHER_PROFILE_GUI = "Anderes"
OTHER_PROFILE_USAGE = "<Profilname>"
RESET_PROFILE = "Reset profile" -- fix
RESET_PROFILE_DESC = "Clear all settings of the current profile." -- fix
RESET_PROFILE = "Resette das Profil"
RESET_PROFILE_DESC = "Entfernt alle Einstellungen des gegenw\195\164rtigen Profils."
 
CHARACTER_COLON = "Charakter: "
REALM_COLON = "Realm: "
CLASS_COLON = "Klasse: "
 
DEFAULT = "Default" -- fix
ALTERNATIVE = "Alternative" -- fix
 
DEFAULT = "Vorgabe"
ALTERNATIVE = "Alternativ"
elseif GetLocale() == "frFR" then
ACTIVE = "Actif"
ENABLED = "Activ\195\169"
76,61 → 85,69
CHARACTER_COLON = "Personnage: "
REALM_COLON = "Royaume: "
CLASS_COLON = "Classe: "
 
 
DEFAULT = "Default" -- fix
ALTERNATIVE = "Alternative" -- fix
elseif GetLocale() == "koKR" then
ACTIVE = "활성화"
ENABLED = "활성화"
DELETE_PROFILE = "삭제"
DELETE_PROFILE_DESC = "프로필을 삭제합니다."
DELETE_PROFILE_USAGE = "<프로필명>"
 
ACTIVE = "사용"
ENABLED = "사용"
STATE = "상태"
TOGGLE_ACTIVE = "이 애드온 중지/계속 실행"
MAP_ACTIVESUSPENDED = { [true] = "|cff00ff00활성화|r", [false] = "|cffff0000중지됨|r" }
TOGGLE_ACTIVE = "이 애드온 중지/다시 시작"
MAP_ACTIVESUSPENDED = { [true] = "|cff00ff00사용|r", [false] = "|cffff0000중지|r" }
SET_PROFILE = "이 애드온에 프로필 설정"
SET_PROFILE_USAGE = "{캐릭터명 || 직업 || 서버명 || <프로필명>}"
PROFILE = "프로필"
PLAYER_OF_REALM = "%s (%s 서버)"
CHOOSE_PROFILE_DESC = "프로파일을 선택합니다."
CHOOSE_PROFILE_DESC = "프로필을 선택합니다."
CHOOSE_PROFILE_GUI = "선택"
COPY_PROFILE_DESC = "다른 프로파일에서 설정을 복사합니다."
COPY_PROFILE_DESC = "다른 프로필 설정을 복사합니다."
COPY_PROFILE_GUI = "복사"
OTHER_PROFILE_DESC = "다른 프로파일을 선택합니다."
OTHER_PROFILE_DESC = "다른 프로필을 선택합니다."
OTHER_PROFILE_GUI = "기타"
OTHER_PROFILE_USAGE = "<프로파일명>"
RESET_PROFILE = "Reset profile" -- fix
RESET_PROFILE_DESC = "Clear all settings of the current profile." -- fix
OTHER_PROFILE_USAGE = "<프로필명>"
RESET_PROFILE = "프로필 초기화"
RESET_PROFILE_DESC = "모든 세팅에서 현재 프로필을 초기화 합니다."
 
CHARACTER_COLON = "캐릭터: "
REALM_COLON = "서버: "
CLASS_COLON = "직업: "
 
DEFAULT = "Default" -- fix
ALTERNATIVE = "Alternative" -- fix
 
DEFAULT = "기본값"
ALTERNATIVE = "대체"
elseif GetLocale() == "zhTW" then
DELETE_PROFILE = "刪除"
DELETE_PROFILE_DESC = "刪除記錄檔。注意,有可能別的角色也使用這個記錄檔。"
DELETE_PROFILE_USAGE = "<記錄檔名稱>"
 
ACTIVE = "啟動"
ENABLED = "啟用"
STATE = "狀態"
TOGGLE_ACTIVE = "暫停/重啟這個插件。"
TOGGLE_ACTIVE = "暫停/繼續使用這個插件。"
MAP_ACTIVESUSPENDED = { [true] = "|cff00ff00啟動|r", [false] = "|cffff0000已暫停|r" }
SET_PROFILE = "設定這插件的記錄檔。"
SET_PROFILE_USAGE = "{角色 || 聯業 || 伺服器 || <記錄檔名稱>}"
SET_PROFILE_USAGE = "{角色 || 職業 || 伺服器 || <記錄檔名稱>}"
PROFILE = "記錄檔"
PLAYER_OF_REALM = "%s 於 %s"
CHOOSE_PROFILE_DESC = "選擇一個記錄檔"
PLAYER_OF_REALM = "%s - %s"
CHOOSE_PROFILE_DESC = "選擇一個記錄檔。"
CHOOSE_PROFILE_GUI = "選擇"
COPY_PROFILE_DESC = "由其他記錄檔複製設定。"
COPY_PROFILE_GUI = "複製由"
COPY_PROFILE_GUI = "複製自"
OTHER_PROFILE_DESC = "選擇其他記錄檔。"
OTHER_PROFILE_GUI = "其他"
OTHER_PROFILE_USAGE = "<記錄檔名稱>"
RESET_PROFILE = "Reset profile" -- fix
RESET_PROFILE_DESC = "Clear all settings of the current profile." -- fix
RESET_PROFILE = "重設記錄檔"
RESET_PROFILE_DESC = "清除目前的記錄檔上的所有設定。"
 
CHARACTER_COLON = "角色:"
REALM_COLON = "伺服器:"
CLASS_COLON = "聯業:"
 
DEFAULT = "Default" -- fix
ALTERNATIVE = "Alternative" -- fix
CHARACTER_COLON = "角色: "
REALM_COLON = "伺服器: "
CLASS_COLON = "職業: "
 
DEFAULT = "預設"
ALTERNATIVE = "替代"
elseif GetLocale() == "zhCN" then
ACTIVE = "\230\156\137\230\149\136"
ENABLED = "\229\144\175\231\148\168"
154,7 → 171,7
CHARACTER_COLON = "\229\173\151\231\172\166: "
REALM_COLON = "\229\159\159: "
CLASS_COLON = "\233\128\137\228\187\182\231\177\187: "
 
 
DEFAULT = "Default" -- fix
ALTERNATIVE = "Alternative" -- fix
elseif GetLocale() == "esES" then
180,9 → 197,39
CHARACTER_COLON = "Personaje: "
REALM_COLON = "Reino: "
CLASS_COLON = "Clase: "
 
 
DEFAULT = "Por defecto"
ALTERNATIVE = "Alternativo"
elseif GetLocale() == "ruRU" then
DELETE_PROFILE = "Удалить"
DELETE_PROFILE_DESC = "Удалить профиль. Изначально проверьте не используется ли этот профиль другими персонажами, чтобы не натворить себе неудобств."
DELETE_PROFILE_USAGE = "<название профиля>"
 
ACTIVE = "Активный"
ENABLED = "Включён"
STATE = "Состояние"
TOGGLE_ACTIVE = "Отключить/Запустить аддон."
MAP_ACTIVESUSPENDED = { [true] = "|cff00ff00Активный|r", [false] = "|cffff0000Suspended|r" }
SET_PROFILE = "Установить профиль для этого аддона."
SET_PROFILE_USAGE = "{чар || класс || сервер || <название профиля>}"
PROFILE = "Профиль"
PLAYER_OF_REALM = "%s из %s"
CHOOSE_PROFILE_DESC = "Выберите профиль."
CHOOSE_PROFILE_GUI = "Выбор"
COPY_PROFILE_DESC = "Скопировать настройки из другого профиля."
COPY_PROFILE_GUI = "Скопировать из"
OTHER_PROFILE_DESC = "Выбрать другой профиль."
OTHER_PROFILE_GUI = "Другое"
OTHER_PROFILE_USAGE = "<название профиля>"
RESET_PROFILE = "Сброс профиля"
RESET_PROFILE_DESC = "Очистить все настройки для текущего профиля."
 
CHARACTER_COLON = "Персонаж: "
REALM_COLON = "Сервер: "
CLASS_COLON = "Класс: "
 
DEFAULT = "По-умолчанию"
ALTERNATIVE = "Альтернатива"
else -- enUS
ACTIVE = "Active"
ENABLED = "Enabled"
206,7 → 253,7
CHARACTER_COLON = "Character: "
REALM_COLON = "Realm: "
CLASS_COLON = "Class: "
 
 
DEFAULT = "Default"
ALTERNATIVE = "Alternative"
end
232,6 → 279,7
"SetProfile",
"GetProfile",
"CopyProfileFrom",
"DeleteProfile",
"ToggleActive",
"IsActive",
"AcquireDBNamespace",
245,7 → 293,7
return t
end
for k,v in pairs(defaults) do
if k == "*" then
if k == "*" or k == "**" then
local v = v
if type(v) == "table" then
setmetatable(t, {
270,17 → 318,20
} )
end
for key in pairs(t) do
if (defaults[key] == nil or key == "*") and type(t[key]) == "table" then
if (defaults[key] == nil or key == k) and type(t[key]) == "table" then
inheritDefaults(t[key], v)
end
end
else
if type(v) == "table" then
if type(t[k]) ~= "table" then
if type(rawget(t, k)) ~= "table" then
t[k] = {}
end
inheritDefaults(t[k], v)
elseif t[k] == nil then
if defaults["**"] then
inheritDefaults(t[k], defaults["**"])
end
elseif rawget(t, k) == nil then
t[k] = v
end
end
320,7 → 371,7
return {}
end
end
 
 
function del(t)
setmetatable(t, nil)
for k in pairs(t) do
825,26 → 876,30
local tmp = {}
function AceDB:InitializeDB(addonName)
local db = self.db
 
 
if not db then
if addonName then
AceDB.addonsLoaded[addonName] = true
end
return
end
 
 
if db.raw then
-- someone manually initialized
return
end
 
 
if type(_G[db.name]) ~= "table" then
_G[db.name] = {}
else
CrawlForDeserialization(_G[db.name])
end
if type(_G[db.charName]) == "table" then
CrawlForDeserialization(_G[db.charName])
if db.charName then
if type(_G[db.charName]) ~= "table" then
_G[db.charName] = {}
else
CrawlForDeserialization(_G[db.charName])
end
end
rawset(db, 'raw', _G[db.name])
if not db.raw.currentProfile then
999,7 → 1054,7
name, kind = kind, a2
AceDB:argCheck(name, 2, "nil", "string")
AceDB:argCheck(kind, 3, "nil", "string")
else
else
AceDB:argCheck(kind, 2, "nil", "string")
if kind ~= "char" and kind ~= "class" and kind ~= "profile" and kind ~= "account" and kind ~= "realm" and kind ~= "faction" and kind ~= "server" then
name, kind = kind, nil
1031,7 → 1086,7
else
if db.raw.namespaces then
db.raw.namespaces[name] = nil
end
end
if db.namespaces then
local v = db.namespaces[name]
if v then
1131,7 → 1186,7
rawset(v, 'realm', nil)
end
end
else
else
if db.raw.namespaces then
local v = db.raw.namespaces[name]
if v and v.realms then
1241,7 → 1296,7
end
end
end
elseif kind == "profile" then
elseif kind == "profile" then
local id = db.raw.currentProfile and db.raw.currentProfile[charID] or AceDB.registry[self] or "Default"
if id == "char" then
id = "char/" .. charID
1250,7 → 1305,7
elseif id == "realm" then
id = "realm/" .. realmID
end
 
 
local current = self.class
while current and current ~= AceOO.Class do
if current.mixins then
1266,7 → 1321,7
safecall(self.OnProfileDisable, self, id)
end
local active = self:IsActive()
 
 
if not name then
if db.raw.profiles then
db.raw.profiles[id] = nil
1298,7 → 1353,7
end
end
end
 
 
local current = self.class
while current and current ~= AceOO.Class do
if current.mixins then
1315,17 → 1370,18
end
local newactive = self:IsActive()
if active ~= newactive then
local first = nil
if AceOO.inherits(self, "AceAddon-2.0") then
local AceAddon = AceLibrary("AceAddon-2.0")
if not AceAddon.addonsStarted[self] then
return
if newactive then
local first = nil
if AceOO.inherits(self, "AceAddon-2.0") then
local AceAddon = AceLibrary("AceAddon-2.0")
if not AceAddon.addonsStarted[self] then
return
end
if AceAddon.addonsEnabled and not AceAddon.addonsEnabled[self] then
AceAddon.addonsEnabled[self] = true
first = true
end
end
if AceAddon.addonsEnabled and not AceAddon.addonsEnabled[self] then
first = true
end
end
if newactive then
local current = self.class
while current and current ~= AceOO.Class do
if current.mixins then
1363,42 → 1419,43
end
end
end
else
return -- skip event
end
if AceEvent then
AceEvent:TriggerEvent("AceDB20_ResetDB", self, self.db.name, kind)
end
end
 
local function cleanDefaults(t, defaults)
local function cleanDefaults(t, defaults, blocker)
if defaults then
for k,v in pairs(defaults) do
if k == "*" then
if type(v) == "table" then
for k in pairs(t) do
if (defaults[k] == nil or k == "*") and type(t[k]) == "table" then
if cleanDefaults(t[k], v) then
for k,v in pairs(t) do
if (not blocker or (blocker[k] == nil and blocker['*'] == nil and blocker['**'] == nil)) and (defaults[k] ~= nil or defaults['*'] ~= nil or defaults['**'] ~= nil) then
local u = defaults[k]
if u == nil then
u = defaults['*']
if u == nil then
u = defaults['**']
end
end
if v == u then
t[k] = nil
elseif type(v) == "table" and type(u) == "table" then
if cleanDefaults(v, u) then
t[k] = nil
else
local w = defaults['**']
if w ~= u then
if cleanDefaults(v, w, u) then
t[k] = nil
end
end
end
else
for k in pairs(t) do
if (defaults[k] == nil or k == "*") and t[k] == v then
t[k] = nil
end
end
end
else
if type(v) == "table" then
if type(t[k]) == "table" then
if cleanDefaults(t[k], v) then
t[k] = nil
end
end
elseif t[k] == v then
t[k] = nil
end
end
end
end
return t and not next(t)
return t and next(t) == nil
end
 
function AceDB:GetProfile()
1564,11 → 1621,7
RecalculateAceDBCopyFromList(self)
end
if Dewdrop then
Dewdrop:Refresh(1)
Dewdrop:Refresh(2)
Dewdrop:Refresh(3)
Dewdrop:Refresh(4)
Dewdrop:Refresh(5)
Dewdrop:Refresh()
end
end
 
1698,14 → 1751,72
RecalculateAceDBCopyFromList(self)
end
if Dewdrop then
Dewdrop:Refresh(1)
Dewdrop:Refresh(2)
Dewdrop:Refresh(3)
Dewdrop:Refresh(4)
Dewdrop:Refresh(5)
Dewdrop:Refresh()
end
end
 
function AceDB:DeleteProfile(profile, noconfirm)
AceDB:argCheck(profile , 2, "string")
if not self.db or not self.db.raw then
AceDB:error("Cannot call \"DeleteProfile\" before \"RegisterDB\" has been called and before \"ADDON_LOADED\" has been fired.")
end
local db = self.db
 
local currentProfile = db.raw.currentProfile[charID]
if currentProfile:lower() == profile:lower() then
AceDB:error("Cannot delete profile %q, it is currently in use.", profile)
end
 
if not (noconfirm or IsShiftKeyDown()) then
if not StaticPopupDialogs["ACEDB20_CONFIRM_DELETE_DIALOG"] then
StaticPopupDialogs["ACEDB20_CONFIRM_DELETE_DIALOG"] = {}
end
local t = StaticPopupDialogs["ACEDB20_CONFIRM_DELETE_DIALOG"]
t.text = format("%s: %s?", DELETE_PROFILE, profile)
t.button1 = DELETE_PROFILE
t.button2 = CANCEL or "Cancel"
t.OnAccept = function()
self:DeleteProfile(profile, true)
end
t.timeout = 0
t.whileDead = 1
t.hideOnEscape = 1
 
StaticPopup_Show("ACEDB20_CONFIRM_DELETE_DIALOG")
return;
end
 
local good = false
if db.raw.profiles and db.raw.profiles[profile] then
good = true;
db.raw.profiles[profile] = nil;
end
 
if db.raw.namespaces then
for _,n in pairs(db.raw.namespaces) do
if n.profiles and n.profiles[profile] then
n.profiles[profile] = nil;
good = true
end
end
end
 
if not good then
AceDB:error("Cannot delete profile %q, it does not exist.", profile)
end
 
if self['acedb-profile-list'] then
RecalculateAceDBProfileList(self)
end
if self['acedb-profile-copylist'] then
RecalculateAceDBCopyFromList(self)
end
 
if Dewdrop then
Dewdrop:Refresh()
end
end
 
function AceDB:IsActive()
return not self.db or not self.db.raw or not self.db.raw.disabled or not self.db.raw.disabled[self.db.raw.currentProfile[charID]]
end
1797,6 → 1908,9
for addon, defaultProfile in pairs(AceDB.registry) do
local db = addon.db
if db then
if type(addon.OnDatabaseCleanup) == "function" then
safecall(addon.OnDatabaseCleanup, addon)
end
setmetatable(db, nil)
CrawlForSerialization(db.raw)
if type(_G[db.charName]) == "table" then
2031,6 → 2145,18
get = "GetProfile",
set = "SetProfile",
},
delete = {
name = DELETE_PROFILE,
desc = DELETE_PROFILE_DESC,
usage = DELETE_PROFILE_USAGE,
type = 'text',
set = "DeleteProfile",
get = false,
validate = target['acedb-profile-copylist'],
disabled = function()
return not next(target['acedb-profile-copylist'])
end,
},
reset = {
name = RESET_PROFILE,
desc = RESET_PROFILE_DESC,
2048,7 → 2174,7
local function activate(self, oldLib, oldDeactivate)
AceDB = self
AceEvent = AceLibrary:HasInstance("AceEvent-2.0") and AceLibrary("AceEvent-2.0")
 
 
self.addonsToBeInitialized = oldLib and oldLib.addonsToBeInitialized or {}
self.addonsLoaded = oldLib and oldLib.addonsLoaded or {}
self.registry = oldLib and oldLib.registry or {}
2057,9 → 2183,9
self.registry[k] = "Default"
end
end
 
 
self:activate(oldLib, oldDeactivate)
 
 
for t in pairs(self.embedList) do
if t.db then
rawset(t.db, 'char', nil)
2072,7 → 2198,7
setmetatable(t.db, db_mt)
end
end
 
 
if oldLib then
oldDeactivate(oldLib)
end
2081,9 → 2207,9
local function external(self, major, instance)
if major == "AceEvent-2.0" then
AceEvent = instance
 
 
AceEvent:embed(self)
 
 
self:RegisterEvent("ADDON_LOADED")
self:RegisterEvent("PLAYER_LOGOUT")
elseif major == "Dewdrop-2.0" then
trunk/FuBar_RecapFu/libs/AceDB-2.0/AceDB-2.0.toc New file
0,0 → 1,16
## 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: AceDB-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, AceEvent-2.0, AceOO-2.0
 
AceDB-2.0.lua
Property changes : Added: svn:eol-style + native
trunk/FuBar_RecapFu/libs/FuBarPlugin-2.0/FuBarPlugin-2.0.lua
1,18 → 1,20
--[[
--[[
Name: FuBarPlugin-2.0
Revision: $Rev: 29795 $
Revision: $Rev: 9 $
Author: Cameron Kenneth Knight (ckknight@gmail.com)
Website: http://wiki.wowace.com/index.php/FuBarPlugin-2.0
Documentation: http://wiki.wowace.com/index.php/FuBarPlugin-2.0
SVN: svn://svn.wowace.com/root/branches/FuBar/FuBarPlugin-2.0/FuBarPlugin-2.0/
SVN: svn://svn.wowace.com/wowace/trunk/FuBarPlugin-2.0/FuBarPlugin-2.0/
Description: Plugin for FuBar.
Dependencies: AceLibrary, AceOO-2.0, AceEvent-2.0, Tablet-2.0, Dewdrop-2.0
Dependencies: AceLibrary, AceOO-2.0, AceEvent-2.0, (optional) Tablet-2.0, Dewdrop-2.0
License: LGPL v2.1
 
Notes: When embeding this library, FuBar should be set as an optional dependency.
]]
 
local MAJOR_VERSION = "FuBarPlugin-2.0"
local MINIMAPCONTAINER_MAJOR_VERSION = "FuBarPlugin-MinimapContainer-2.0"
local MINOR_VERSION = "$Revision: 29795 $"
local MINOR_VERSION = 90000 + tonumber(("$Revision: 9 $"):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
23,6 → 25,7
local AceEvent = AceLibrary:HasInstance("AceEvent-2.0") and AceLibrary("AceEvent-2.0")
local Tablet = AceLibrary:HasInstance("Tablet-2.0") and AceLibrary("Tablet-2.0")
local Dewdrop = AceLibrary:HasInstance("Dewdrop-2.0") and AceLibrary("Dewdrop-2.0")
local AceAddon
 
local epsilon = 1e-5
local _G = getfenv(0)
124,36 → 127,39
CLOSE_DESC = "Ferme le menu."
elseif GetLocale() == "zhCN" then
SHOW_ICON = "显示图标"
SHOW_ICON_DESC = "在面板上显示插件图标."
SHOW_ICON_DESC = "在面板上显示插件图标。"
SHOW_TEXT = "显示文字"
SHOW_TEXT_DESC = "在面板上显示文字标题."
SHOW_TEXT_DESC = "在面板上显示文字标题。"
SHOW_COLORED_TEXT = "显示彩色文字"
SHOW_COLORED_TEXT_DESC = "允许插件显示彩色文字."
SHOW_COLORED_TEXT_DESC = "允许插件显示彩色文字。"
DETACH_TOOLTIP = "独立提示信息"
DETACH_TOOLTIP_DESC = "从面板上独立提示信息."
DETACH_TOOLTIP_DESC = "从面板上独立提示信息。"
LOCK_TOOLTIP = "锁定提示信息"
LOCK_TOOLTIP_DESC = "锁定提示信息位置."
LOCK_TOOLTIP_DESC = "锁定提示信息位置。"
POSITION = "位置"
POSITION_DESC = "插件在面板上的位置."
POSITION_DESC = "插件在面板上的位置。"
POSITION_LEFT = "居左"
POSITION_RIGHT = "居右"
POSITION_CENTER = "居中"
ATTACH_TO_MINIMAP = "依附在小地图"
ATTACH_TO_MINIMAP_DESC = "插件图标依附在小地图而不显示在面板上."
HIDE_FUBAR_PLUGIN = "隐藏FuBar插件"
HIDE_FUBAR_PLUGIN_CMD = "Hidden"
HIDE_FUBAR_PLUGIN_DESC = "在面板上隐藏该插件."
ATTACH_TO_MINIMAP_DESC = "插件图标依附在小地图而不显示在面板上。"
HIDE_FUBAR_PLUGIN = "隐藏 FuBar 插件"
HIDE_FUBAR_PLUGIN_CMD = "隐藏"
HIDE_FUBAR_PLUGIN_DESC = "在面板上隐藏该插件。"
OTHER = "其他"
CLOSE = "关闭"
CLOSE_DESC = "关闭菜单"
elseif GetLocale() == "zhTW" then
SHOW_ICON = "顯示圖示"
SHOW_ICON_DESC = "在面板上顯示插件圖示。"
SHOW_TEXT = "顯示文字"
SHOW_TEXT_DESC = "在面板上顯示文字標題。"
SHOW_COLORED_TEXT = "顯示彩色文字"
SHOW_COLORED_TEXT_DESC = "允許插件顯示彩色文字。"
SHOW_TEXT_DESC = "在面板上顯示插件文字。"
SHOW_COLORED_TEXT = "允許彩色文字"
SHOW_COLORED_TEXT_DESC = "允許插件在面板上使用彩色文字。"
DETACH_TOOLTIP = "獨立提示訊息"
DETACH_TOOLTIP_DESC = "從面板上獨立提示訊息。"
LOCK_TOOLTIP = "鎖定提示訊息"
LOCK_TOOLTIP_DESC = "鎖定提示訊息位置。"
LOCK_TOOLTIP_DESC = "鎖定提示訊息位置。當提示訊息鎖定時,需要用Alt鍵使用提示訊息的功能。"
POSITION = "位置"
POSITION_DESC = "插件在面板上的位置。"
POSITION_LEFT = "靠左"
161,9 → 167,12
POSITION_CENTER = "置中"
ATTACH_TO_MINIMAP = "依附在小地圖"
ATTACH_TO_MINIMAP_DESC = "插件圖標依附在小地圖而不顯示在面板上。"
HIDE_FUBAR_PLUGIN = "隱藏FuBar插件"
HIDE_FUBAR_PLUGIN_CMD = "Hidden"
HIDE_FUBAR_PLUGIN_DESC = "在面板上隱藏該插件."
HIDE_FUBAR_PLUGIN = "隱藏插件"
HIDE_FUBAR_PLUGIN_CMD = "隱藏"
HIDE_FUBAR_PLUGIN_DESC = "在面板或小地圖上隱藏該插件,但保持執行狀態。"
OTHER = "其他"
CLOSE = "關閉"
CLOSE_DESC = "關閉選單。"
elseif GetLocale() == "esES" then
SHOW_ICON = "Mostrar icono"
SHOW_ICON_DESC = "Muestra el icono del plugin en el panel"
188,53 → 197,78
OTHER = "Otros"
CLOSE = "Cerrar"
CLOSE_DESC = "Cierra el men\195\186."
elseif GetLocale() == "ruRU" then
SHOW_ICON = "Показывать иконку"
SHOW_ICON_DESC = "Показывать иконку плагина на панели."
SHOW_TEXT = "Показывать текст"
SHOW_TEXT_DESC = "Показывать текст плагина на панели."
SHOW_COLORED_TEXT = "Показывать цветной текст"
SHOW_COLORED_TEXT_DESC = "Позволить плагину использовать его цвета в тексте."
DETACH_TOOLTIP = "Отделить подсказку"
DETACH_TOOLTIP_DESC = "Отделить всплывающую подсказку от панели."
LOCK_TOOLTIP = "Закрепить подсказку"
LOCK_TOOLTIP_DESC = "Закрепить позицию всплывающей подсказки. Когда всплывающая подсказка закреплена, используйте Alt для отображения ее у мыши."
POSITION = "Позиция"
POSITION_DESC = "Позиция плагина на панели."
POSITION_LEFT = "Слева"
POSITION_RIGHT = "Справа"
POSITION_CENTER = "По центру"
ATTACH_TO_MINIMAP = "Закрепить у мини-карты"
ATTACH_TO_MINIMAP_DESC = "Закрепить плагин у мини-карты, вместо панели."
HIDE_FUBAR_PLUGIN = "Скрыть плагин"
HIDE_FUBAR_PLUGIN_CMD = "Скрыть"
HIDE_FUBAR_PLUGIN_DESC = "Скрыть плагин с панели или мини-карты, но оставить аддон в рабочем состоянии."
OTHER = "Другое"
CLOSE = "Закрыть"
CLOSE_DESC = "Закрыть меню."
end
 
local AceOO = AceLibrary("AceOO-2.0")
local FuBarPlugin = AceOO.Mixin {
"GetTitle",
"GetName",
"GetCategory",
"SetFontSize",
"GetFrame",
"Show",
"Hide",
"GetPanel",
"IsTextColored",
"ToggleTextColored",
"IsMinimapAttached",
"ToggleMinimapAttached",
"Update",
"UpdateDisplay",
"UpdateData",
"UpdateText",
"UpdateTooltip",
"SetIcon",
"GetIcon",
"CheckWidth",
"SetText",
"GetText",
"IsIconShown",
"ToggleIconShown",
"ShowIcon",
"HideIcon",
"IsTextShown",
"ToggleTextShown",
"ShowText",
"HideText",
"IsTooltipDetached",
"ToggleTooltipDetached",
"DetachTooltip",
"ReattachTooltip",
"GetDefaultPosition",
"SetPanel",
"IsLoadOnDemand",
"IsDisabled",
"CreateBasicPluginFrame",
"CreatePluginChildFrame",
"OpenMenu",
"AddImpliedMenuOptions",
}
"GetTitle",
"GetName",
"GetCategory",
"SetFontSize",
"GetFrame",
"Show",
"Hide",
"GetPanel",
"IsTextColored",
"ToggleTextColored",
"IsMinimapAttached",
"ToggleMinimapAttached",
"Update",
"UpdateDisplay",
"UpdateData",
"UpdateText",
"UpdateTooltip",
"SetIcon",
"GetIcon",
"CheckWidth",
"SetText",
"GetText",
"IsIconShown",
"ToggleIconShown",
"ShowIcon",
"HideIcon",
"IsTextShown",
"ToggleTextShown",
"ShowText",
"HideText",
"IsTooltipDetached",
"ToggleTooltipDetached",
"DetachTooltip",
"ReattachTooltip",
"GetDefaultPosition",
"SetPanel",
"IsLoadOnDemand",
"IsDisabled",
"CreateBasicPluginFrame",
"CreatePluginChildFrame",
"OpenMenu",
"AddImpliedMenuOptions",
}
local MinimapContainer
 
local good = nil
local function CheckFuBar()
291,12 → 325,16
if self.panel then
self.panel:RemovePlugin(self)
end
FuBar:GetPanel(1):AddPlugin(self, nil, self.defaultPosition)
if self.defaultPosition == "MINIMAP" then
FuBar:GetPanel(1):AddPlugin(self, nil, "LEFT")
else
FuBar:GetPanel(1):AddPlugin(self, nil, self.defaultPosition)
end
else
if self.panel then
self.panel:RemovePlugin(self)
end
AceLibrary(MINIMAPCONTAINER_MAJOR_VERSION):AddPlugin(self)
MinimapContainer:AddPlugin(self)
end
end
Dewdrop:Close()
306,7 → 344,7
if not CheckFuBar() then
return true
end
return self.panel == AceLibrary(MINIMAPCONTAINER_MAJOR_VERSION)
return self.panel == MinimapContainer
end
 
function FuBarPlugin:Update()
339,6 → 377,10
end
 
function FuBarPlugin:RegisterTablet()
if self.blizzardTooltip or self.overrideTooltip or not Tablet then
return
end
 
if not Tablet:IsRegistered(self.frame) then
if self.db and self.db.profile and not self.db.profile.detachedTooltip then
self.db.profile.detachedTooltip = {}
396,12 → 438,18
'hideWhenEmpty', self.tooltipHiddenWhenEmpty
)
local func = self.frame:GetScript("OnEnter")
local function newFunc(...)
func(...)
 
local function newFunc(this, ...)
func(this, ...)
 
if FuBar and FuBar.IsHidingTooltipsInCombat and FuBar:IsHidingTooltipsInCombat() and InCombatLockdown() then
local frame = this.self.frame
if Tablet:IsAttached(frame) then
if self.blizzardTooltip then
if GameTooltip:IsOwned(self:IsMinimapAttached() and self.minimapFrame or self.frame) then
GameTooltip:Hide()
end
elseif self.overrideTooltip and type(self.CloseTooltip) == "function" then
self:CloseTooltip()
elseif not self.overrideTooltip and Tablet and Tablet:IsAttached(frame) then
Tablet:Close(frame)
end
end
411,6 → 459,42
end
 
function FuBarPlugin:UpdateTooltip()
if self.blizzardTooltip then
if GameTooltip:IsOwned(self:IsMinimapAttached() and self.minimapFrame or self.frame) then
GameTooltip:Hide()
 
local frame = self:IsMinimapAttached() and self.minimapFrame or self.frame
local anchor
if frame:GetTop() > GetScreenHeight() / 2 then
local x = frame:GetCenter()
if x < GetScreenWidth() / 2 then
anchor = "ANCHOR_BOTTOMRIGHT"
else
anchor = "ANCHOR_BOTTOMLEFT"
end
else
local x = frame:GetCenter()
if x < GetScreenWidth() / 2 then
anchor = "ANCHOR_TOPLEFT"
else
anchor = "ANCHOR_TOPRIGHT"
end
end
GameTooltip:SetOwner(frame, anchor)
if type(self.OnTooltipUpdate) == "function" and not self:IsDisabled() then
self:OnTooltipUpdate()
end
GameTooltip:Show()
end
return
elseif self.overrideTooltip then
if type(self.OnTooltipUpdate) == "function" and not self:IsDisabled() then
self:OnTooltipUpdate()
end
return
end
if not Tablet then return end
 
FuBarPlugin.RegisterTablet(self)
if self:IsMinimapAttached() and not self:IsTooltipDetached() and self.minimapFrame then
Tablet:Refresh(self.minimapFrame)
441,7 → 525,7
end
elseif not self.db or not self.db.profile.hidden then
if panelId == 0 or not CheckFuBar() then
AceLibrary(MINIMAPCONTAINER_MAJOR_VERSION):AddPlugin(self)
MinimapContainer:AddPlugin(self)
else
FuBar:ShowPlugin(self, panelId or self.panelIdTmp)
end
457,7 → 541,9
end
end
if AceOO.inherits(self, "AceAddon-2.0") then
local AceAddon = AceLibrary("AceAddon-2.0")
if not AceAddon then
AceAddon = AceLibrary("AceAddon-2.0")
end
if AceAddon.addonsEnabled and not AceAddon.addonsEnabled[self] then
return
end
474,7 → 560,7
self.db.profile.hidden = true
end
if not self.hideWithoutStandby then
if self.db and not self.overrideTooltip and not self.cannotDetachTooltip and self:IsTooltipDetached() and self.db.profile.detachedTooltip and self.db.profile.detachedTooltip.detached then
if self.db and not self.overrideTooltip and not self.blizzardTooltip and not self.cannotDetachTooltip and self:IsTooltipDetached() and self.db.profile.detachedTooltip and self.db.profile.detachedTooltip.detached then
self:ReattachTooltip()
self.db.profile.detachedTooltip.detached = true
end
728,11 → 814,15
end
 
function FuBarPlugin:IsTooltipDetached()
if self.blizzardTooltip or self.overrideTooltip or not Tablet then return end
 
FuBarPlugin.RegisterTablet(self)
return not Tablet:IsAttached(self.frame)
end
 
function FuBarPlugin:ToggleTooltipDetached()
if self.blizzardTooltip or self.overrideTooltip or not Tablet then return end
 
FuBarPlugin.RegisterTablet(self)
if self:IsTooltipDetached() then
Tablet:Attach(self.frame)
743,11 → 833,15
end
 
function FuBarPlugin:DetachTooltip()
if self.blizzardTooltip or self.overrideTooltip or not Tablet then return end
 
FuBarPlugin.RegisterTablet(self)
Tablet:Detach(self.frame)
end
 
function FuBarPlugin:ReattachTooltip()
if self.blizzardTooltip or self.overrideTooltip or not Tablet then return end
 
FuBarPlugin.RegisterTablet(self)
Tablet:Attach(self.frame)
end
806,7 → 900,11
end
 
function FuBarPlugin:IsLoadOnDemand()
return IsAddOnLoadOnDemand(FuBarPlugin.folderNames[self] or self.folderName)
local addon = FuBarPlugin.folderNames[self] or self.folderName
if not addon then
return
end
return IsAddOnLoadOnDemand(addon)
end
 
function FuBarPlugin:IsDisabled()
816,20 → 914,24
function FuBarPlugin:OnInstanceInit(target)
if not AceEvent then
self:error(MAJOR_VERSION .. " requires AceEvent-2.0.")
elseif not Tablet then
self:error(MAJOR_VERSION .. " requires Tablet-2.0.")
elseif not Dewdrop then
self:error(MAJOR_VERSION .. " requires Dewdrop-2.0.")
end
self.registry[target] = true
 
local folderName = select(3, debugstack(6, 1, 0):find("\\AddOns\\(.*)\\"))
local folderName
for i = 6, 3, -1 do
folderName = debugstack(i, 1, 0):match("\\AddOns\\(.*)\\")
if folderName then
break
end
end
target.folderName = folderName
self.folderNames[target] = folderName
end
FuBarPlugin.OnManualEmbed = FuBarPlugin.OnInstanceInit
 
local frame_OnClick, frame_OnDoubleClick, frame_OnMouseDown, frame_OnMouseUp, frame_OnReceiveDrag, frame_OnEnter, frame_OnLeave
 
function FuBarPlugin:CreateBasicPluginFrame(name)
local frame = CreateFrame("Button", name, UIParent)
frame:SetFrameStrata("HIGH")
842,63 → 944,73
frame:SetPoint("CENTER", UIParent, "CENTER")
frame.self = self
if not frame_OnEnter then
function frame_OnEnter()
if type(this.self.OnEnter) == "function" then
this.self:OnEnter()
function frame_OnEnter(this, ...)
local self = this.self
if self.blizzardTooltip then
GameTooltip:SetOwner(self:IsMinimapAttached() and self.minimapFrame or self.frame, "ANCHOR_CURSOR")
self:UpdateTooltip()
end
if type(self.OnEnter) == "function" then
self:OnEnter(...)
end
end
end
frame:SetScript("OnEnter", frame_OnEnter)
if not frame_OnLeave then
function frame_OnLeave()
if type(this.self.OnLeave) == "function" then
this.self:OnLeave()
function frame_OnLeave(this, ...)
local self = this.self
if type(self.OnLeave) == "function" then
self:OnLeave(...)
end
if self.blizzardTooltip and GameTooltip:IsOwned(self:IsMinimapAttached() and self.minimapFrame or self.frame) then
GameTooltip:Hide()
end
end
end
frame:SetScript("OnLeave", frame_OnLeave)
if not frame_OnClick then
function frame_OnClick()
function frame_OnClick(this, ...)
if this.self:IsMinimapAttached() and this.dragged then return end
if type(this.self.OnClick) == "function" then
this.self:OnClick(arg1)
this.self:OnClick(...)
end
end
end
frame:SetScript("OnClick", frame_OnClick)
if not frame_OnDoubleClick then
function frame_OnDoubleClick()
function frame_OnDoubleClick(this, ...)
if type(this.self.OnDoubleClick) == "function" then
this.self:OnDoubleClick(arg1)
this.self:OnDoubleClick(...)
end
end
end
frame:SetScript("OnDoubleClick", frame_OnDoubleClick)
if not frame_OnMouseDown then
function frame_OnMouseDown()
if arg1 == "RightButton" and not IsShiftKeyDown() and not IsControlKeyDown() and not IsAltKeyDown() then
function frame_OnMouseDown(this, ...)
if (...) == "RightButton" and not IsModifierKeyDown() then
this.self:OpenMenu()
return
else
HideDropDownMenu(1)
if type(this.self.OnMouseDown) == "function" then
this.self:OnMouseDown(arg1)
this.self:OnMouseDown(...)
end
end
end
end
frame:SetScript("OnMouseDown", frame_OnMouseDown)
if not frame_OnMouseUp then
function frame_OnMouseUp()
function frame_OnMouseUp(this, ...)
if type(this.self.OnMouseUp) == "function" then
this.self:OnMouseUp(arg1)
this.self:OnMouseUp(...)
end
end
end
frame:SetScript("OnMouseUp", frame_OnMouseUp)
if not frame_OnReceiveDrag then
function frame_OnReceiveDrag()
if type(this.self.OnReceiveDrag) == "function" then
this.self:OnReceiveDrag()
function frame_OnReceiveDrag(this, ...)
if (this.self:IsMinimapAttached() and not this.dragged) and type(this.self.OnReceiveDrag) == "function" then
this.self:OnReceiveDrag(...)
end
end
end
918,26 → 1030,26
end
child.self = self
if not child_OnEnter then
function child_OnEnter(...)
function child_OnEnter(this, ...)
if this.self.frame:GetScript("OnEnter") then
this.self.frame:GetScript("OnEnter")(...)
this.self.frame:GetScript("OnEnter")(this, ...)
end
end
end
child:SetScript("OnEnter", child_OnEnter)
if not child_OnLeave then
function child_OnLeave(...)
function child_OnLeave(this, ...)
if this.self.frame:GetScript("OnLeave") then
this.self.frame:GetScript("OnLeave")(...)
this.self.frame:GetScript("OnLeave")(this, ...)
end
end
end
child:SetScript("OnLeave", child_OnLeave)
if child:HasScript("OnClick") then
if not child_OnClick then
function child_OnClick(...)
function child_OnClick(this, ...)
if this.self.frame:HasScript("OnClick") and this.self.frame:GetScript("OnClick") then
this.self.frame:GetScript("OnClick")(...)
this.self.frame:GetScript("OnClick")(this, ...)
end
end
end
945,34 → 1057,34
end
if child:HasScript("OnDoubleClick") then
if not child_OnDoubleClick then
function child_OnDoubleClick(...)
function child_OnDoubleClick(this, ...)
if this.self.frame:HasScript("OnDoubleClick") and this.self.frame:GetScript("OnDoubleClick") then
this.self.frame:GetScript("OnDoubleClick")(...)
this.self.frame:GetScript("OnDoubleClick")(this, ...)
end
end
end
child:SetScript("OnDoubleClick", child_OnDoubleClick)
end
if not child_OnMouseDown then
function child_OnMouseDown(...)
function child_OnMouseDown(this, ...)
if this.self.frame:HasScript("OnMouseDown") and this.self.frame:GetScript("OnMouseDown") then
this.self.frame:GetScript("OnMouseDown")(...)
this.self.frame:GetScript("OnMouseDown")(this, ...)
end
end
end
child:SetScript("OnMouseDown", child_OnMouseDown)
if not child_OnMouseUp then
function child_OnMouseUp(...)
function child_OnMouseUp(this, ...)
if this.self.frame:HasScript("OnMouseUp") and this.self.frame:GetScript("OnMouseUp") then
this.self.frame:GetScript("OnMouseUp")(...)
this.self.frame:GetScript("OnMouseUp")(this, ...)
end
end
end
child:SetScript("OnMouseUp", child_OnMouseUp)
if not child_OnReceiveDrag then
function child_OnReceiveDrag(this)
function child_OnReceiveDrag(this, ...)
if this.self.frame:HasScript("OnReceiveDrag") and this.self.frame:GetScript("OnReceiveDrag") then
this.self.frame:GetScript("OnReceiveDrag")()
this.self.frame:GetScript("OnReceiveDrag")(this, ...)
end
end
end
982,13 → 1094,24
 
function FuBarPlugin:OpenMenu(frame)
if not frame then
frame = self:GetFrame()
frame = self:IsMinimapAttached() and self.minimapFrame or self.frame
end
if not frame:IsVisible() then
frame = UIParent
end
if not frame or not self:GetFrame() or Dewdrop:IsOpen(frame) then
Dewdrop:Close()
return
end
Tablet:Close()
if self.blizzardTooltip then
if GameTooltip:IsOwned(frame) then
GameTooltip:Hide()
end
elseif self.overrideTooltip and type(self.CloseTooltip) == "function" then
self:CloseTooltip()
elseif not self.overrideTooltip and Tablet then
Tablet:Close()
end
 
if not Dewdrop:IsRegistered(self:GetFrame()) then
if type(self.OnMenuRequest) == "table" and (not self.OnMenuRequest.handler or self.OnMenuRequest.handler == self) and self.OnMenuRequest.type == "group" then
1054,8 → 1177,10
end
if frame == self:GetFrame() then
Dewdrop:Open(self:GetFrame())
elseif frame ~= UIParent then
Dewdrop:Open(frame, self:GetFrame())
else
Dewdrop:Open(frame, self:GetFrame())
Dewdrop:Open(frame, self:GetFrame(), 'cursorX', true, 'cursorY', true)
end
end
 
1122,6 → 1247,7
end
 
local recheckPlugins
local AceConsole
function FuBarPlugin.OnEmbedEnable(FuBarPlugin, self)
if not self.userDefinedFrame then
if self:IsIconShown() then
1136,13 → 1262,13
if FuBarPlugin.enabledPlugins[self] then
CheckShow(self, self.panelIdTmp)
else
FuBarPlugin:ScheduleEvent(CheckShow, 0, self, self.panelIdTmp)
FuBarPlugin:ScheduleEvent("FuBarPlugin-CheckShow-" .. tostring(self), CheckShow, 0, self, self.panelIdTmp)
end
end
FuBarPlugin.enabledPlugins[self] = true
 
if not self.overrideTooltip and not self.cannotDetachTooltip and self.db and self.db.profile.detachedTooltip and self.db.profile.detachedTooltip.detached then
FuBarPlugin:ScheduleEvent(self.DetachTooltip, 0, self)
if not self.blizzardTooltip and not self.overrideTooltip and not self.cannotDetachTooltip and self.db and self.db.profile.detachedTooltip and self.db.profile.detachedTooltip.detached then
FuBarPlugin:ScheduleEvent("FuBarPlugin-DetachTooltip-" .. tostring(self), self.DetachTooltip, 0, self)
end
 
if self:IsLoadOnDemand() and CheckFuBar() then
1157,9 → 1283,10
 
if CheckFuBar() and AceLibrary:HasInstance("AceConsole-2.0") then
if not recheckPlugins then
local AceConsole = AceLibrary("AceConsole-2.0")
local AceOO = AceLibrary("AceOO-2.0")
function recheckPlugins()
if not AceConsole then
AceConsole = AceLibrary("AceConsole-2.0")
end
recheckPlugins = function()
for k,v in pairs(AceConsole.registry) do
if type(v) == "table" and v.args and AceOO.inherits(v.handler, FuBarPlugin) and not v.handler.independentProfile then
v.args.profile = nil
1167,7 → 1294,7
end
end
end
FuBarPlugin:ScheduleEvent(recheckPlugins, 0)
FuBarPlugin:ScheduleEvent("FuBarPlugin-recheckPlugins", recheckPlugins, 0)
end
end
 
1191,14 → 1318,15
if not self.db.profile.detachedTooltip then
self.db.profile.detachedTooltip = {}
end
if Tablet.registry[self.frame] then
Tablet:UpdateDetachedData(self.frame, self.db.profile.detachedTooltip)
else
FuBarPlugin.RegisterTablet(self)
if not self.blizzardTooltip and not self.overrideTooltip and Tablet then
if Tablet.registry[self.frame] then
Tablet:UpdateDetachedData(self.frame, self.db.profile.detachedTooltip)
else
FuBarPlugin.RegisterTablet(self)
end
end
local MinimapContainer = AceLibrary(MINIMAPCONTAINER_MAJOR_VERSION)
if MinimapContainer:HasPlugin(self) then
AceLibrary(MINIMAPCONTAINER_MAJOR_VERSION):ReadjustLocation(self)
MinimapContainer:ReadjustLocation(self)
end
end
end
1248,7 → 1376,7
get = "IsTooltipDetached",
set = "ToggleTooltipDetached",
hidden = function()
return self.overrideTooltip or self.cannotDetachTooltip or self:IsDisabled()
return not Tablet or self.blizzardTooltip or self.overrideTooltip or self.cannotDetachTooltip or self:IsDisabled()
end,
order = -13.4,
handler = self,
1267,7 → 1395,7
return not self:IsTooltipDetached()
end,
hidden = function()
return self.overrideTooltip or self.cannotDetachTooltip or self:IsDisabled()
return not Tablet or self.blizzardTooltip or self.overrideTooltip or self.cannotDetachTooltip or self:IsDisabled()
end,
order = -13.3,
handler = self,
1360,7 → 1488,6
local function external(self, major, instance)
if major == "AceEvent-2.0" then
AceEvent = instance
 
AceEvent:embed(self)
elseif major == "Tablet-2.0" then
Tablet = instance
1371,8 → 1498,9
 
AceLibrary:Register(FuBarPlugin, MAJOR_VERSION, MINOR_VERSION, activate, nil, external)
 
local MinimapContainer = {}
MinimapContainer = {}
 
local minimap_OnMouseDown, minimap_OnMouseUp
function MinimapContainer:AddPlugin(plugin)
if CheckFuBar() and FuBar:IsChangingProfile() then
return
1384,8 → 1512,6
if not plugin.minimapFrame then
local frame = CreateFrame("Button", plugin.frame:GetName() .. "MinimapButton", Minimap)
plugin.minimapFrame = frame
AceLibrary(MAJOR_VERSION).RegisterTablet(plugin)
Tablet:Register(frame, plugin.frame)
frame.plugin = plugin
frame:SetWidth(31)
frame:SetHeight(31)
1405,68 → 1531,99
icon:SetHeight(20)
icon:SetPoint("TOPLEFT", frame, "TOPLEFT", 7, -5)
local overlay = frame:CreateTexture(frame:GetName() .. "Overlay","OVERLAY")
overlay:SetTexture("Interface\\Minimap\\MiniMap-TrackingBorder")
overlay:SetTexture("Interface\\Minimap\\MiniMap-TrackingBorder")
overlay:SetWidth(53)
overlay:SetHeight(53)
overlay:SetPoint("TOPLEFT",frame,"TOPLEFT")
frame:EnableMouse(true)
frame:RegisterForClicks("LeftButtonUp")
frame.plugin = plugin
frame:SetScript("OnClick", function()
if type(plugin.OnClick) == "function" then
if not this.dragged then
plugin:OnClick(arg1)
 
frame.self = plugin
if not frame_OnEnter then
function frame_OnEnter(this, ...)
if type(this.self.OnEnter) == "function" then
this.self:OnEnter(...)
end
end
end)
frame:SetScript("OnDoubleClick", function()
if type(plugin.OnDoubleClick) == "function" then
plugin:OnDoubleClick(arg1)
end
frame:SetScript("OnEnter", frame_OnEnter)
if not frame_OnLeave then
function frame_OnLeave(this, ...)
if type(this.self.OnLeave) == "function" then
this.self:OnLeave(...)
end
end
end)
frame:SetScript("OnReceiveDrag", function()
if type(plugin.OnReceiveDrag) == "function" then
if not this.dragged then
plugin:OnReceiveDrag()
end
frame:SetScript("OnLeave", frame_OnLeave)
if not frame_OnClick then
function frame_OnClick(this, ...)
if this.self:IsMinimapAttached() and this.dragged then return end
if type(this.self.OnClick) == "function" then
this.self:OnClick(...)
end
end
end)
frame:SetScript("OnMouseDown", function()
this.dragged = false
if arg1 == "LeftButton" and not IsShiftKeyDown() and not IsControlKeyDown() and not IsAltKeyDown() then
HideDropDownMenu(1)
if type(plugin.OnMouseDown) == "function" then
plugin:OnMouseDown(arg1)
end
frame:SetScript("OnClick", frame_OnClick)
if not frame_OnDoubleClick then
function frame_OnDoubleClick(this, ...)
if type(this.self.OnDoubleClick) == "function" then
this.self:OnDoubleClick(...)
end
elseif arg1 == "RightButton" and not IsShiftKeyDown() and not IsControlKeyDown() and not IsAltKeyDown() then
plugin:OpenMenu(frame)
else
HideDropDownMenu(1)
if type(plugin.OnMouseDown) == "function" then
plugin:OnMouseDown(arg1)
end
end
frame:SetScript("OnDoubleClick", frame_OnDoubleClick)
if not frame_OnReceiveDrag then
function frame_OnReceiveDrag(this, ...)
if (this.self:IsMinimapAttached() and not this.dragged) and type(this.self.OnReceiveDrag) == "function" then
this.self:OnReceiveDrag(...)
end
end
if plugin.OnClick or plugin.OnMouseDown or plugin.OnMouseUp or plugin.OnDoubleClick then
if this.plugin.minimapIcon:GetTexture():sub(1, 16) == "Interface\\Icons\\" then
plugin.minimapIcon:SetTexCoord(0.14, 0.86, 0.14, 0.86)
end
frame:SetScript("OnReceiveDrag", frame_OnReceiveDrag)
if not minimap_OnMouseDown then
function minimap_OnMouseDown(this, ...)
this.dragged = false
if (...) == "RightButton" and not IsModifierKeyDown() then
this.self:OpenMenu(this)
else
plugin.minimapIcon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
HideDropDownMenu(1)
if type(this.self.OnMouseDown) == "function" then
this.self:OnMouseDown(...)
end
end
if this.self.OnClick or this.self.OnMouseDown or this.self.OnMouseUp or this.self.OnDoubleClick then
if this.self.minimapIcon:GetTexture():sub(1, 16) == "Interface\\Icons\\" then
this.self.minimapIcon:SetTexCoord(0.14, 0.86, 0.14, 0.86)
else
this.self.minimapIcon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
end
end
end
end)
frame:SetScript("OnMouseUp", function()
if not this.dragged and type(plugin.OnMouseUp) == "function" then
plugin:OnMouseUp(arg1)
end
frame:SetScript("OnMouseDown", minimap_OnMouseDown)
if not minimap_OnMouseUp then
function minimap_OnMouseUp(this, ...)
if not this.dragged and type(this.self.OnMouseUp) == "function" then
this.self:OnMouseUp(...)
end
if this.self.minimapIcon:GetTexture():sub(1, 16) == "Interface\\Icons\\" then
this.self.minimapIcon:SetTexCoord(0.05, 0.95, 0.05, 0.95)
else
this.self.minimapIcon:SetTexCoord(0, 1, 0, 1)
end
end
if this.plugin.minimapIcon:GetTexture():sub(1, 16) == "Interface\\Icons\\" then
plugin.minimapIcon:SetTexCoord(0.05, 0.95, 0.05, 0.95)
else
plugin.minimapIcon:SetTexCoord(0, 1, 0, 1)
end
end)
end
frame:SetScript("OnMouseUp", minimap_OnMouseUp)
frame:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", self.OnDragStart)
frame:SetScript("OnDragStop", self.OnDragStop)
 
if not plugin.blizzardTooltip and not plugin.overrideTooltip and Tablet then
-- Note that we have to do this after :SetScript("OnEnter"), etc,
-- so that Tablet-2.0 can override it properly.
FuBarPlugin.RegisterTablet(plugin)
Tablet:Register(frame, plugin.frame)
end
end
plugin.frame:Hide()
plugin.minimapFrame:Show()
1543,39 → 1700,47
round = false
end
elseif minimapShape == "SIDE-TOP" then
if sin > 0 then
if sin < 0 then
round = false
end
elseif minimapShape == "SIDE-BOTTOM" then
if sin < 0 then
if sin > 0 then
round = false
end
elseif minimapShape == "TRICORNER-TOPRIGHT" then
if cos < 0 and sin > 0 then
if cos < 0 and sin < 0 then
round = false
end
elseif minimapShape == "TRICORNER-TOPLEFT" then
if cos > 0 and sin > 0 then
if cos > 0 and sin < 0 then
round = false
end
elseif minimapShape == "TRICORNER-BOTTOMRIGHT" then
if cos < 0 and sin < 0 then
if cos < 0 and sin > 0 then
round = false
end
elseif minimapShape == "TRICORNER-BOTTOMLEFT" then
if cos > 0 and sin < 0 then
if cos > 0 and sin > 0 then
round = false
end
end
 
 
if round then
x = cos * 80
y = sin * 80
else
x = 110 * cos
y = 110 * sin
x = math.max(-82, math.min(x, 84))
y = math.max(-86, math.min(y, 82))
x = 80 * 2^0.5 * cos
y = 80 * 2^0.5 * sin
if x < -80 then
x = -80
elseif x > 80 then
x = 80
end
if y < -80 then
y = -80
elseif y > 80 then
y = 80
end
end
frame:SetPoint("CENTER", Minimap, "CENTER", x, y)
end
1586,7 → 1751,7
end
 
function MinimapContainer:GetNumPlugins()
return table.getn(self.plugins)
return #self.plugins
end
 
function MinimapContainer:IndexOfPlugin(plugin)
1607,23 → 1772,23
return "MINIMAP"
end
 
function MinimapContainer.OnDragStart()
function MinimapContainer.OnDragStart(this)
this.dragged = true
this:LockHighlight()
this:SetScript("OnUpdate", MinimapContainer.OnUpdate)
if this.plugin.minimapIcon:GetTexture():sub(1, 16) == "Interface\\Icons\\" then
this.plugin.minimapIcon:SetTexCoord(0.05, 0.95, 0.05, 0.95)
if this.self.minimapIcon:GetTexture():sub(1, 16) == "Interface\\Icons\\" then
this.self.minimapIcon:SetTexCoord(0.05, 0.95, 0.05, 0.95)
else
this.plugin.minimapIcon:SetTexCoord(0, 1, 0, 1)
this.self.minimapIcon:SetTexCoord(0, 1, 0, 1)
end
end
 
function MinimapContainer.OnDragStop()
function MinimapContainer.OnDragStop(this)
this:SetScript("OnUpdate", nil)
this:UnlockHighlight()
end
 
function MinimapContainer.OnUpdate()
function MinimapContainer.OnUpdate(this)
if not IsAltKeyDown() then
local mx, my = Minimap:GetCenter()
local px, py = GetCursorPosition()
1635,34 → 1800,34
elseif position > 360 then
position = position - 360
end
if this.plugin.db then
this.plugin.db.profile.minimapPosition = position
this.plugin.db.profile.minimapPositionX = nil
this.plugin.db.profile.minimapPositionY = nil
this.plugin.db.profile.minimapPositionWild = nil
if this.self.db then
this.self.db.profile.minimapPosition = position
this.self.db.profile.minimapPositionX = nil
this.self.db.profile.minimapPositionY = nil
this.self.db.profile.minimapPositionWild = nil
else
this.plugin.minimapPosition = position
this.plugin.minimapPositionX = nil
this.plugin.minimapPositionY = nil
this.plugin.minimapPositionWild = nil
this.self.minimapPosition = position
this.self.minimapPositionX = nil
this.self.minimapPositionY = nil
this.self.minimapPositionWild = nil
end
else
local px, py = GetCursorPosition()
local scale = UIParent:GetEffectiveScale()
px, py = px / scale, py / scale
if this.plugin.db then
this.plugin.db.profile.minimapPositionX = px
this.plugin.db.profile.minimapPositionY = py
this.plugin.db.profile.minimapPosition = nil
this.plugin.db.profile.minimapPositionWild = true
if this.self.db then
this.self.db.profile.minimapPositionX = px
this.self.db.profile.minimapPositionY = py
this.self.db.profile.minimapPosition = nil
this.self.db.profile.minimapPositionWild = true
else
this.plugin.minimapPositionX = px
this.plugin.minimapPositionY = py
this.plugin.minimapPosition = nil
this.plugin.minimapPositionWild = true
this.self.minimapPositionX = px
this.self.minimapPositionY = py
this.self.minimapPosition = nil
this.self.minimapPositionWild = true
end
end
MinimapContainer:ReadjustLocation(this.plugin)
MinimapContainer:ReadjustLocation(this.self)
end
 
local function activate(self, oldLib, oldDeactivate)
trunk/FuBar_RecapFu/libs/AceDebug-2.0/AceDebug-2.0.lua
1,18 → 1,18
--[[
--[[
Name: AceDebug-2.0
Revision: $Rev: 25921 $
Revision: $Rev: 1091 $
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/
Documentation: http://www.wowace.com/index.php/AceDebug-2.0
SVN: http://svn.wowace.com/root/trunk/Ace2/AceDebug-2.0
SVN: http://svn.wowace.com/wowace/trunk/Ace2/AceDebug-2.0
Description: Mixin to allow for simple debugging capabilities.
Dependencies: AceLibrary, AceOO-2.0
License: LGPL v2.1
]]
 
local MAJOR_VERSION = "AceDebug-2.0"
local MINOR_VERSION = "$Revision: 25921 $"
local MINOR_VERSION = 90000 + tonumber(("$Revision: 1091 $"):match("(%d+)"))
 
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
24,6 → 24,7
if not success then geterrorhandler()(err:find("%.lua:%d+:") and err or (debugstack():match("\n(.-: )in.-\n") or "") .. err) end
end
 
local DEBUGGING, TOGGLE_DEBUGGING
if GetLocale() == "frFR" then
DEBUGGING = "D\195\169boguage"
TOGGLE_DEBUGGING = "Activer/d\195\169sactiver le d\195\169boguage"
35,20 → 36,33
TOGGLE_DEBUGGING = "디버깅 기능 사용함/사용안함"
elseif GetLocale() == "zhTW" then
DEBUGGING = "除錯"
TOGGLE_DEBUGGING = "啟用/停用除錯功能"
TOGGLE_DEBUGGING = "啟用/停用除錯功能。"
elseif GetLocale() == "zhCN" then
DEBUGGING = "\232\176\131\232\175\149"
TOGGLE_DEBUGGING = "\229\144\175\231\148\168/\231\166\129\231\148\168 \232\176\131\232\175\149."
elseif GetLocale() == "esES" then
DEBUGGING = "Debugging"
TOGGLE_DEBUGGING = "Activar/desactivar Debugging."
elseif GetLocale() == "ruRU" then
DEBUGGING = "Отладка"
TOGGLE_DEBUGGING = "Вкл/Выкл отладку для этого аддона."
else -- enUS
DEBUGGING = "Debugging"
TOGGLE_DEBUGGING = "Toggle debugging for this addon."
end
 
local AceOO = AceLibrary:GetInstance("AceOO-2.0")
local AceDebug = AceOO.Mixin {"Debug", "CustomDebug", "IsDebugging", "SetDebugging", "SetDebugLevel", "LevelDebug", "CustomLevelDebug", "GetDebugLevel"}
local AceDebug = AceOO.Mixin {
"Debug",
"CustomDebug",
"IsDebugging",
"SetDebugging",
"SetDebugLevel",
"LevelDebug",
"CustomLevelDebug",
"GetDebugLevel",
"GetDebugPrefix",
}
 
local function print(text, r, g, b, frame, delay)
(frame or DEFAULT_CHAT_FRAME):AddMessage(text, r, g, b, 1, delay or 5)
61,7 → 75,7
return
end
 
local output = ("|cff7fff7f(DEBUG) %s:[%s.%3d]|r"):format(tostring(self), date("%H:%M:%S"), (GetTime() % 1) * 1000)
local output = self:GetDebugPrefix()
 
a1 = tostring(a1)
if a1:find("%%") and select('#', ...) >= 1 then
129,6 → 143,10
self.debuglevel = level
end
 
function AceDebug:GetDebugPrefix()
return ("|cff7fff7f(DEBUG) %s:[%s.%3d]|r"):format( tostring(self), date("%H:%M:%S"), (GetTime() % 1) * 1000)
end
 
function AceDebug:GetDebugLevel()
return self.debuglevel
end
141,7 → 159,7
end
if level > self.debuglevel then return end
 
local output = ("|cff7fff7f(DEBUG) %s:[%s.%3d]|r"):format( tostring(self), date("%H:%M:%S"), (GetTime() % 1) * 1000)
local output = self:GetDebugPrefix()
 
a1 = tostring(a1)
if a1:find("%%") and select('#', ...) >= 1 then
trunk/FuBar_RecapFu/libs/AceDebug-2.0/AceDebug-2.0.toc New file
0,0 → 1,16
## 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: AceDebug-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
 
AceDebug-2.0.lua
Property changes : Added: svn:eol-style + native
trunk/FuBar_RecapFu/libs/AceLibrary/AceLibrary.toc New file
0,0 → 1,14
## 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: AceLibrary
## Notes: AddOn development framework
## Author: Ace Development Team
## X-Website: http://www.wowace.com
## X-Category: Library
## X-License: LGPL v2.1 + MIT for AceOO-2.0
 
AceLibrary.lua
Property changes : Added: svn:eol-style + native
trunk/FuBar_RecapFu/libs/AceLibrary/AceLibrary.lua
1,13 → 1,13
--[[
Name: AceLibrary
Revision: $Rev: 29796 $
Revision: $Rev: 1091 $
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
Inspired By: Iriel (iriel@vigilance-committee.org)
Tekkub (tekkub@gmail.com)
Revision: $Rev: 29796 $
Revision: $Rev: 1091 $
Website: http://www.wowace.com/
Documentation: http://www.wowace.com/index.php/AceLibrary
SVN: http://svn.wowace.com/root/trunk/Ace2/AceLibrary
SVN: http://svn.wowace.com/wowace/trunk/Ace2/AceLibrary
Description: Versioning library to handle other library instances, upgrading,
and proper access.
It also provides a base for libraries to work off of, providing
18,28 → 18,54
]]
 
local ACELIBRARY_MAJOR = "AceLibrary"
local ACELIBRARY_MINOR = "$Revision: 29796 $"
local ACELIBRARY_MINOR = 90000 + tonumber(("$Revision: 1091 $"):match("(%d+)"))
 
local _G = getfenv(0)
local previous = _G[ACELIBRARY_MAJOR]
if previous and not previous:IsNewVersion(ACELIBRARY_MAJOR, ACELIBRARY_MINOR) then return end
 
do
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info
-- LibStub is hereby placed in the Public Domain -- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
local LibStub = _G[LIBSTUB_MAJOR]
 
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
LibStub = LibStub or {libs = {}, minors = {} }
_G[LIBSTUB_MAJOR] = LibStub
LibStub.minor = LIBSTUB_MINOR
 
function LibStub:NewLibrary(major, minor)
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
local oldminor = self.minors[major]
if oldminor and oldminor >= minor then return nil end
self.minors[major], self.libs[major] = minor, self.libs[major] or {}
return self.libs[major], oldminor
end
 
function LibStub:GetLibrary(major, silent)
if not self.libs[major] and not silent then
error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
end
return self.libs[major], self.minors[major]
end
 
function LibStub:IterateLibraries() return pairs(self.libs) end
setmetatable(LibStub, { __call = LibStub.GetLibrary })
end
end
local LibStub = _G.LibStub
 
-- If you don't want AceLibrary to enable libraries that are LoadOnDemand but
-- disabled in the addon screen, set this to true.
local DONT_ENABLE_LIBRARIES = nil
 
local function safecall(func,...)
local success, err = pcall(func,...)
if not success then geterrorhandler()(err:find("%.lua:%d+:") and err or (debugstack():match("\n(.-: )in.-\n") or "") .. err) end
end
 
local WoW22 = false
if type(GetBuildInfo) == "function" then
local success, buildinfo = pcall(GetBuildInfo)
if success and type(buildinfo) == "string" then
local num = tonumber(buildinfo:match("^(%d+%.%d+)"))
if num and num >= 2.2 then
WoW22 = true
end
end
end
 
-- @table AceLibrary
-- @brief System to handle all versioning of libraries.
local AceLibrary = {}
53,7 → 79,7
 
local stack = debugstack()
if not message then
local _,_,second = stack:find("\n(.-)\n")
local second = stack:match("\n(.-)\n")
message = "error raised! " .. second
else
local arg = { ... } -- not worried about table creation, as errors don't happen often
99,34 → 125,19
return _G.error(message, 2)
end
 
local assert
if not WoW22 then
function assert(self, condition, message, ...)
if not condition then
if not message then
local stack = debugstack()
local _,_,second = stack:find("\n(.-)\n")
message = "assertion failed! " .. second
end
return error(self, message, ...)
end
return condition
end
end
 
local type = type
local function argCheck(self, arg, num, kind, kind2, kind3, kind4, kind5)
if type(num) ~= "number" then
return error(self, "Bad argument #3 to `argCheck' (number expected, got %s)", type(num))
elseif type(kind) ~= "string" then
return error(self, "Bad argument #4 to `argCheck' (string expected, got %s)", type(kind))
end
local errored = false
arg = type(arg)
if arg ~= kind and arg ~= kind2 and arg ~= kind3 and arg ~= kind4 and arg ~= kind5 then
local stack = debugstack()
local _,_,func = stack:find("`argCheck'.-([`<].-['>])")
local func = stack:match("`argCheck'.-([`<].-['>])")
if not func then
_,_,func = stack:find("([`<].-['>])")
func = stack:match("([`<].-['>])")
end
if kind5 then
return error(self, "Bad argument #%s to %s (%s, %s, %s, %s, or %s expected, got %s)", tonumber(num) or 0/0, func, kind, kind2, kind3, kind4, kind5, arg)
180,16 → 191,17
end
 
local function svnRevisionToNumber(text)
if type(text) == "string" then
local kind = type(text)
if kind == "number" or tonumber(text) then
return tonumber(text)
elseif kind == "string" then
if text:find("^%$Revision: (%d+) %$$") then
return tonumber((text:gsub("^%$Revision: (%d+) %$$", "%1")))
return tonumber((text:match("^%$Revision: (%d+) %$$")))
elseif text:find("^%$Rev: (%d+) %$$") then
return tonumber((text:gsub("^%$Rev: (%d+) %$$", "%1")))
return tonumber((text:match("^%$Rev: (%d+) %$$")))
elseif text:find("^%$LastChangedRevision: (%d+) %$$") then
return tonumber((text:gsub("^%$LastChangedRevision: (%d+) %$$", "%1")))
return tonumber((text:match("^%$LastChangedRevision: (%d+) %$$")))
end
elseif type(text) == "number" then
return text
end
return nil
end
256,8 → 268,10
-- @brief Create a shallow copy of a table and return it.
-- @param from The table to copy from
-- @return A shallow copy of the table
local function copyTable(from)
local to = {}
local function copyTable(from, to)
if not to then
to = {}
end
for k,v in pairs(from) do
to[k] = v
end
341,10 → 355,25
end
end
 
local function TryToEnable(addon)
if DONT_ENABLE_LIBRARIES then return end
local isondemand = IsAddOnLoadOnDemand(addon)
if isondemand then
local _, _, _, enabled = GetAddOnInfo(addon)
EnableAddOn(addon)
local _, _, _, _, loadable = GetAddOnInfo(addon)
if not loadable and not enabled then
DisableAddOn(addon)
end
 
return loadable
end
end
 
-- @method TryToLoadStandalone
-- @brief Attempt to find and load a standalone version of the requested library
-- @param major A string representing the major version
-- @return If library is found, return values from the call to LoadAddOn are returned
-- @return If library is found and loaded, true is return. If not loadable, false is returned.
-- If the library has been requested previously, nil is returned.
local function TryToLoadStandalone(major)
if not AceLibrary.scannedlibs then AceLibrary.scannedlibs = {} end
353,18 → 382,28
AceLibrary.scannedlibs[major] = true
 
local name, _, _, enabled, loadable = GetAddOnInfo(major)
 
loadable = (enabled and loadable) or TryToEnable(name)
 
local loaded = false
if loadable then
return LoadAddOn(name)
loaded = true
LoadAddOn(name)
end
 
for i=1,GetNumAddOns() do
if GetAddOnMetadata(i, "X-AceLibrary-"..major) then
local name, _, _, enabled, loadable = GetAddOnInfo(i)
 
local field = "X-AceLibrary-" .. major
for i = 1, GetNumAddOns() do
if GetAddOnMetadata(i, field) then
name, _, _, enabled, loadable = GetAddOnInfo(i)
 
loadable = (enabled and loadable) or TryToEnable(name)
if loadable then
return LoadAddOn(name)
loaded = true
LoadAddOn(name)
end
end
end
return loaded
end
 
-- @method IsNewVersion
388,6 → 427,10
end
end
argCheck(self, minor, 3, "number")
local lib, oldMinor = LibStub:GetLibrary(major, true)
if lib then
return oldMinor < minor
end
local data = self.libs[major]
if not data then
return true
405,7 → 448,11
if minor ~= false then
TryToLoadStandalone(major)
end
 
 
local lib, ver = LibStub:GetLibrary(major, true)
if not lib and self.libs[major] then
lib, ver = self.libs[major].instance, self.libs[major].minor
end
if minor then
if type(minor) == "string" then
local m = svnRevisionToNumber(minor)
416,12 → 463,12
end
end
argCheck(self, minor, 3, "number")
if not self.libs[major] then
return
if not lib then
return false
end
return self.libs[major].minor == minor
return ver == minor
end
return self.libs[major] and true
return not not lib
end
 
-- @method GetInstance
431,12 → 478,18
-- @return The library with the given major/minor version.
function AceLibrary:GetInstance(major, minor)
argCheck(self, major, 2, "string")
TryToLoadStandalone(major)
if minor ~= false then
TryToLoadStandalone(major)
end
 
local data = self.libs[major]
local data, ver = LibStub:GetLibrary(major, true)
if not data then
_G.error(("Cannot find a library instance of %s."):format(major), 2)
return
if self.libs[major] then
data, ver = self.libs[major].instance, self.libs[major].minor
else
_G.error(("Cannot find a library instance of %s."):format(major), 2)
return
end
end
if minor then
if type(minor) == "string" then
448,11 → 501,11
end
end
argCheck(self, minor, 2, "number")
if data.minor ~= minor then
if ver ~= minor then
_G.error(("Cannot find a library instance of %s, minor version %d."):format(major, minor), 2)
end
end
return data.instance
return data
end
 
-- Syntax sugar. AceLibrary("FooBar-1.0")
462,6 → 515,8
 
local AceEvent
 
local tmp = {}
 
-- @method Register
-- @brief Registers a new version of a given library.
-- @param newInstance the library to register
510,7 → 565,11
local data = self.libs[major]
if not data then
-- This is new
local instance = copyTable(newInstance)
if LibStub:GetLibrary(major, true) then
error(self, "Cannot register library %q. It is already registered with LibStub.", major)
end
local instance = LibStub:NewLibrary(major, minor)
copyTable(newInstance, instance)
crawlReplace(instance, instance, newInstance)
destroyTable(newInstance)
if AceLibrary == newInstance then
529,9 → 588,6
if not rawget(instance, 'error') then
rawset(instance, 'error', error)
end
if not WoW22 and not rawget(instance, 'assert') then
rawset(instance, 'assert', assert)
end
if not rawget(instance, 'argCheck') then
rawset(instance, 'argCheck', argCheck)
end
541,25 → 597,24
addToPositions(instance, major)
if activateFunc then
safecall(activateFunc, instance, nil, nil) -- no old version, so explicit nil
 
--[[ if major ~= ACELIBRARY_MAJOR then
for k,v in pairs(_G) do
if v == instance then
geterrorhandler()((debugstack():match("(.-: )in.-\n") or "") .. ("Cannot register library %q. It is part of the global table in _G[%q]."):format(major, k))
end
end
end]]
end
 
if externalFunc then
for k,data in pairs(self.libs) do
for k, data_instance in LibStub:IterateLibraries() do -- all libraries
tmp[k] = data_instance
end
for k, data in pairs(self.libs) do -- Ace libraries which may not have been registered with LibStub
tmp[k] = data.instance
end
for k, data_instance in pairs(tmp) do
if k ~= major then
safecall(externalFunc, instance, k, data.instance)
safecall(externalFunc, instance, k, data_instance)
end
tmp[k] = nil
end
end
 
for k,data in pairs(self.libs) do
for k,data in pairs(self.libs) do -- only Ace libraries
if k ~= major and data.externalFunc then
safecall(data.externalFunc, data.instance, major, instance)
end
573,33 → 628,36
 
return instance
end
local instance = data.instance
if minor <= data.minor then
-- This one is already obsolete, raise an error.
_G.error(("Obsolete library registered. %s is already registered at version %d. You are trying to register version %d. Hint: if not AceLibrary:IsNewVersion(%q, %d) then return end"):format(major, data.minor, minor, major, minor), 2)
return
end
local instance = data.instance
-- This is an update
local oldInstance = {}
 
local libStubInstance = LibStub:GetLibrary(major, true)
if not libStubInstance then -- non-LibStub AceLibrary registered the library
-- pass
elseif libStubInstance ~= instance then
error(self, "Cannot register library %q. It is already registered with LibStub.", major)
else
LibStub:NewLibrary(major, minor) -- upgrade the minor version
end
 
addToPositions(newInstance, major)
local isAceLibrary = (AceLibrary == newInstance)
local old_error, old_assert, old_argCheck, old_pcall
local old_error, old_argCheck, old_pcall
if isAceLibrary then
self = instance
AceLibrary = instance
 
old_error = instance.error
if not WoW22 then
old_assert = instance.assert
end
old_argCheck = instance.argCheck
old_pcall = instance.pcall
 
self.error = error
if not WoW22 then
self.assert = assert
end
self.argCheck = argCheck
self.pcall = pcall
end
609,15 → 667,12
data.minor = minor
data.deactivateFunc = deactivateFunc
data.externalFunc = externalFunc
rawset(instance, 'GetLibraryVersion', function(self)
rawset(instance, 'GetLibraryVersion', function()
return major, minor
end)
if not rawget(instance, 'error') then
rawset(instance, 'error', error)
end
if not WoW22 and not rawget(instance, 'assert') then
rawset(instance, 'assert', assert)
end
if not rawget(instance, 'argCheck') then
rawset(instance, 'argCheck', argCheck)
end
631,9 → 686,6
if not rawget(i, 'error') or i.error == old_error then
rawset(i, 'error', error)
end
if not WoW22 and (not rawget(i, 'assert') or i.assert == old_assert) then
rawset(i, 'assert', assert)
end
if not rawget(i, 'argCheck') or i.argCheck == old_argCheck then
rawset(i, 'argCheck', argCheck)
end
644,44 → 696,57
end
end
if activateFunc then
safecall(activateFunc, instance, oldInstance, oldDeactivateFunc)
 
--[[ if major ~= ACELIBRARY_MAJOR then
for k,v in pairs(_G) do
if v == instance then
geterrorhandler()((debugstack():match("(.-: )in.-\n") or "") .. ("Cannot register library %q. It is part of the global table in _G[%q]."):format(major, k))
end
end
end]]
safecall(activateFunc, instance, oldInstance, oldDeactivateFunc)
else
safecall(oldDeactivateFunc, oldInstance)
end
oldInstance = nil
 
if externalFunc then
for k,data in pairs(self.libs) do
for k, data_instance in LibStub:IterateLibraries() do -- all libraries
tmp[k] = data_instance
end
for k, data in pairs(self.libs) do -- Ace libraries which may not have been registered with LibStub
tmp[k] = data.instance
end
for k, data_instance in pairs(tmp) do
if k ~= major then
safecall(externalFunc, instance, k, data.instance)
safecall(externalFunc, instance, k, data_instance)
end
tmp[k] = nil
end
end
 
return instance
end
 
local iter
function AceLibrary:IterateLibraries()
if not iter then
local function iter(t, k)
k = next(t, k)
if not k then
return nil
else
return k, t[k].instance
end
local t = {}
for major, instance in LibStub:IterateLibraries() do
t[major] = instance
end
for major, data in pairs(self.libs) do
t[major] = data.instance
end
return pairs(t)
end
 
local function manuallyFinalize(major, instance)
if AceLibrary.libs[major] then
-- don't work on Ace libraries
return
end
local finalizedExternalLibs = AceLibrary.finalizedExternalLibs
if finalizedExternalLibs[major] then
return
end
finalizedExternalLibs[major] = true
 
for k,data in pairs(AceLibrary.libs) do -- only Ace libraries
if k ~= major and data.externalFunc then
safecall(data.externalFunc, data.instance, major, instance)
end
end
return iter, self.libs, nil
end
 
-- @function Activate
699,6 → 764,18
if not self.positions then
self.positions = oldLib and oldLib.positions or setmetatable({}, { __mode = "k" })
end
self.finalizedExternalLibs = oldLib and oldLib.finalizedExternalLibs or {}
self.frame = oldLib and oldLib.frame or CreateFrame("Frame")
self.frame:UnregisterAllEvents()
self.frame:RegisterEvent("ADDON_LOADED")
self.frame:SetScript("OnEvent", function()
for major, instance in LibStub:IterateLibraries() do
manuallyFinalize(major, instance)
end
end)
for major, instance in LibStub:IterateLibraries() do
manuallyFinalize(major, instance)
end
 
-- Expose the library in the global environment
_G[ACELIBRARY_MAJOR] = self
719,4 → 796,4
previous.positions = setmetatable({}, { __mode = "k" })
end
AceLibrary.positions = previous.positions
AceLibrary:Register(AceLibrary, ACELIBRARY_MAJOR, ACELIBRARY_MINOR, activate)
AceLibrary:Register(AceLibrary, ACELIBRARY_MAJOR, ACELIBRARY_MINOR, activate, nil)