WoWInterface SVN ReadySpells

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/ReadySpells/libs/AceConfig-3.0
    from Rev 23 to Rev 25
    Reverse comparison

Rev 23 → Rev 25

AceConfigDialog-3.0/AceConfigDialog-3.0.lua
1,13 → 1,13
--- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables.
-- @class file
-- @name AceConfigDialog-3.0
-- @release $Id: AceConfigDialog-3.0.lua 1212 2019-06-26 05:53:51Z nevcairiel $
-- @release $Id: AceConfigDialog-3.0.lua 1222 2019-07-26 22:14:43Z funkydude $
 
local LibStub = LibStub
local gui = LibStub("AceGUI-3.0")
local reg = LibStub("AceConfigRegistry-3.0")
 
local MAJOR, MINOR = "AceConfigDialog-3.0", 73
local MAJOR, MINOR = "AceConfigDialog-3.0", 77
local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
 
if not AceConfigDialog then return end
15,6 → 15,7
AceConfigDialog.OpenFrames = AceConfigDialog.OpenFrames or {}
AceConfigDialog.Status = AceConfigDialog.Status or {}
AceConfigDialog.frame = AceConfigDialog.frame or CreateFrame("Frame")
AceConfigDialog.tooltip = AceConfigDialog.tooltip or CreateFrame("GameTooltip", "AceConfigDialogTooltip", UIParent, "GameTooltipTemplate")
 
AceConfigDialog.frame.apps = AceConfigDialog.frame.apps or {}
AceConfigDialog.frame.closing = AceConfigDialog.frame.closing or {}
30,7 → 31,7
 
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: NORMAL_FONT_COLOR, GameTooltip, StaticPopupDialogs, ACCEPT, CANCEL, StaticPopup_Show
-- GLOBALS: NORMAL_FONT_COLOR, ACCEPT, CANCEL
-- GLOBALS: PlaySound, GameFontHighlight, GameFontHighlightSmall, GameFontHighlightLarge
-- GLOBALS: CloseSpecialWindows, InterfaceOptions_AddCategory, geterrorhandler
 
504,8 → 505,9
local options = user.options
local path = user.path
local appName = user.appName
local tooltip = AceConfigDialog.tooltip
 
GameTooltip:SetOwner(widget.frame, "ANCHOR_TOPRIGHT")
tooltip:SetOwner(widget.frame, "ANCHOR_TOPRIGHT")
local name = GetOptionsMemberValue("name", opt, options, path, appName)
local desc = GetOptionsMemberValue("desc", opt, options, path, appName)
local usage = GetOptionsMemberValue("usage", opt, options, path, appName)
513,23 → 515,23
 
if descStyle and descStyle ~= "tooltip" then return end
 
GameTooltip:SetText(name, 1, .82, 0, true)
tooltip:SetText(name, 1, .82, 0, true)
 
if opt.type == "multiselect" then
GameTooltip:AddLine(user.text, 0.5, 0.5, 0.8, true)
tooltip:AddLine(user.text, 0.5, 0.5, 0.8, true)
end
if type(desc) == "string" then
GameTooltip:AddLine(desc, 1, 1, 1, true)
tooltip:AddLine(desc, 1, 1, 1, true)
end
if type(usage) == "string" then
GameTooltip:AddLine("Usage: "..usage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, true)
tooltip:AddLine("Usage: "..usage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, true)
end
 
GameTooltip:Show()
tooltip:Show()
end
 
local function OptionOnMouseLeave(widget, event)
GameTooltip:Hide()
AceConfigDialog.tooltip:Hide()
end
 
local function GetFuncName(option)
540,71 → 542,112
return "set"
end
end
do
local frame = AceConfigDialog.popup
if not frame then
frame = CreateFrame("Frame", nil, UIParent)
AceConfigDialog.popup = frame
frame:Hide()
frame:SetPoint("CENTER", UIParent, "CENTER")
frame:SetSize(320, 72)
frame:SetFrameStrata("TOOLTIP")
frame:SetScript("OnKeyDown", function(self, key)
if key == "ESCAPE" then
self:SetPropagateKeyboardInput(false)
if self.cancel:IsShown() then
self.cancel:Click()
else -- Showing a validation error
self:Hide()
end
else
self:SetPropagateKeyboardInput(true)
end
end)
 
local border = CreateFrame("Frame", nil, frame, "DialogBorderDarkTemplate")
border:SetAllPoints(frame)
 
local text = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
text:SetSize(290, 0)
text:SetPoint("TOP", 0, -16)
frame.text = text
 
local function newButton(text)
local button = CreateFrame("Button", nil, frame)
button:SetSize(128, 21)
button:SetNormalFontObject(GameFontNormal)
button:SetHighlightFontObject(GameFontHighlight)
button:SetNormalTexture(130763) -- "Interface\\Buttons\\UI-DialogBox-Button-Up"
button:GetNormalTexture():SetTexCoord(0.0, 1.0, 0.0, 0.71875)
button:SetPushedTexture(130761) -- "Interface\\Buttons\\UI-DialogBox-Button-Down"
button:GetPushedTexture():SetTexCoord(0.0, 1.0, 0.0, 0.71875)
button:SetHighlightTexture(130762) -- "Interface\\Buttons\\UI-DialogBox-Button-Highlight"
button:GetHighlightTexture():SetTexCoord(0.0, 1.0, 0.0, 0.71875)
button:SetText(text)
return button
end
 
local accept = newButton(ACCEPT)
accept:SetPoint("BOTTOMRIGHT", frame, "BOTTOM", -6, 16)
frame.accept = accept
 
local cancel = newButton(CANCEL)
cancel:SetPoint("LEFT", accept, "RIGHT", 13, 0)
frame.cancel = cancel
end
end
local function confirmPopup(appName, rootframe, basepath, info, message, func, ...)
if not StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"] then
StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"] = {}
end
local t = StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"]
for k in pairs(t) do
t[k] = nil
end
t.text = message
t.button1 = ACCEPT
t.button2 = CANCEL
t.preferredIndex = STATICPOPUP_NUMDIALOGS
local dialog, oldstrata
t.OnAccept = function()
safecall(func, unpack(t))
if dialog and oldstrata then
dialog:SetFrameStrata(oldstrata)
end
local frame = AceConfigDialog.popup
frame:Show()
frame.text:SetText(message)
-- From StaticPopup.lua
-- local height = 32 + text:GetHeight() + 2;
-- height = height + 6 + accept:GetHeight()
-- We add 32 + 2 + 6 + 21 (button height) == 61
local height = 61 + frame.text:GetHeight()
frame:SetHeight(height)
 
frame.accept:ClearAllPoints()
frame.accept:SetPoint("BOTTOMRIGHT", frame, "BOTTOM", -6, 16)
frame.cancel:Show()
 
local t = {...}
local tCount = select("#", ...)
frame.accept:SetScript("OnClick", function(self)
safecall(func, unpack(t, 1, tCount)) -- Manually set count as unpack() stops on nil (bug with #table)
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl))
frame:Hide()
self:SetScript("OnClick", nil)
frame.cancel:SetScript("OnClick", nil)
del(info)
end
t.OnCancel = function()
if dialog and oldstrata then
dialog:SetFrameStrata(oldstrata)
end
end)
frame.cancel:SetScript("OnClick", function(self)
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl))
frame:Hide()
self:SetScript("OnClick", nil)
frame.accept:SetScript("OnClick", nil)
del(info)
end
for i = 1, select("#", ...) do
t[i] = select(i, ...) or false
end
t.timeout = 0
t.whileDead = 1
t.hideOnEscape = 1
 
dialog = StaticPopup_Show("ACECONFIGDIALOG30_CONFIRM_DIALOG")
if dialog then
oldstrata = dialog:GetFrameStrata()
dialog:SetFrameStrata("TOOLTIP")
end
end)
end
 
local function validationErrorPopup(message)
if not StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"] then
StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"] = {}
end
local t = StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"]
t.text = message
t.button1 = OKAY
t.preferredIndex = STATICPOPUP_NUMDIALOGS
local dialog, oldstrata
t.OnAccept = function()
if dialog and oldstrata then
dialog:SetFrameStrata(oldstrata)
end
end
t.timeout = 0
t.whileDead = 1
t.hideOnEscape = 1
local frame = AceConfigDialog.popup
frame:Show()
frame.text:SetText(message)
-- From StaticPopup.lua
-- local height = 32 + text:GetHeight() + 2;
-- height = height + 6 + accept:GetHeight()
-- We add 32 + 2 + 6 + 21 (button height) == 61
local height = 61 + frame.text:GetHeight()
frame:SetHeight(height)
 
dialog = StaticPopup_Show("ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG")
if dialog then
oldstrata = dialog:GetFrameStrata()
dialog:SetFrameStrata("TOOLTIP")
end
frame.accept:ClearAllPoints()
frame.accept:SetPoint("BOTTOM", frame, "BOTTOM", 0, 16)
frame.cancel:Hide()
 
frame.accept:SetScript("OnClick", function()
frame:Hide()
end)
end
 
local function ActivateControl(widget, event, ...)
1433,6 → 1476,7
local option = user.option
local path = user.path
local appName = user.appName
local tooltip = AceConfigDialog.tooltip
 
local feedpath = new()
for i = 1, #path do
1449,25 → 1493,25
local name = GetOptionsMemberValue("name", group, options, feedpath, appName)
local desc = GetOptionsMemberValue("desc", group, options, feedpath, appName)
 
GameTooltip:SetOwner(button, "ANCHOR_NONE")
GameTooltip:ClearAllPoints()
tooltip:SetOwner(button, "ANCHOR_NONE")
tooltip:ClearAllPoints()
if widget.type == "TabGroup" then
GameTooltip:SetPoint("BOTTOM",button,"TOP")
tooltip:SetPoint("BOTTOM",button,"TOP")
else
GameTooltip:SetPoint("LEFT",button,"RIGHT")
tooltip:SetPoint("LEFT",button,"RIGHT")
end
 
GameTooltip:SetText(name, 1, .82, 0, true)
tooltip:SetText(name, 1, .82, 0, true)
 
if type(desc) == "string" then
GameTooltip:AddLine(desc, 1, 1, 1, true)
tooltip:AddLine(desc, 1, 1, 1, true)
end
 
GameTooltip:Show()
tooltip:Show()
end
 
local function TreeOnButtonLeave(widget, event, value, button)
GameTooltip:Hide()
AceConfigDialog.tooltip:Hide()
end