WoWInterface SVN Accountant

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/libs/AceConfig-3.0/AceConfigDialog-3.0
    from Rev 3 to Rev 9
    Reverse comparison

Rev 3 → Rev 9

AceConfigDialog-3.0.lua
1,38 → 1,40
--- 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 736 2009-02-14 11:13:43Z nevcairiel $
-- @release $Id: AceConfigDialog-3.0.lua 902 2009-12-12 14:56:14Z nevcairiel $
 
local LibStub = LibStub
local MAJOR, MINOR = "AceConfigDialog-3.0", 26
local lib = LibStub:NewLibrary(MAJOR, MINOR)
local MAJOR, MINOR = "AceConfigDialog-3.0", 43
local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
 
if not lib then return end
if not AceConfigDialog then return end
 
lib.OpenFrames = lib.OpenFrames or {}
lib.Status = lib.Status or {}
lib.frame = lib.frame or CreateFrame("Frame")
AceConfigDialog.OpenFrames = AceConfigDialog.OpenFrames or {}
AceConfigDialog.Status = AceConfigDialog.Status or {}
AceConfigDialog.frame = AceConfigDialog.frame or CreateFrame("Frame")
 
lib.frame.apps = lib.frame.apps or {}
lib.frame.closing = lib.frame.closing or {}
AceConfigDialog.frame.apps = AceConfigDialog.frame.apps or {}
AceConfigDialog.frame.closing = AceConfigDialog.frame.closing or {}
 
local gui = LibStub("AceGUI-3.0")
local reg = LibStub("AceConfigRegistry-3.0")
 
local select = select
local pairs = pairs
local type = type
local assert = assert
local tinsert = tinsert
local tremove = tremove
local error = error
local table = table
local unpack = unpack
local string = string
local next = next
local math = math
local _
-- Lua APIs
local tconcat, tinsert, tsort, tremove = table.concat, table.insert, table.sort, table.remove
local strmatch, format = string.match, string.format
local assert, loadstring, error = assert, loadstring, error
local pairs, next, select, type, unpack = pairs, next, select, type, unpack
local rawset, tostring = rawset, tostring
local math_min, math_max, math_floor = math.min, math.max, math.floor
 
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: NORMAL_FONT_COLOR, GameTooltip, StaticPopupDialogs, ACCEPT, CANCEL, StaticPopup_Show
-- GLOBALS: PlaySound, GameFontHighlight, GameFontHighlightSmall, GameFontHighlightLarge
-- GLOBALS: CloseSpecialWindows, InterfaceOptions_AddCategory, geterrorhandler
 
local emptyTbl = {}
 
--[[
xpcall safecall implementation
]]
60,7 → 62,7
 
local ARGS = {}
for i = 1, argCount do ARGS[i] = "arg"..i end
code = code:gsub("ARGS", table.concat(ARGS, ", "))
code = code:gsub("ARGS", tconcat(ARGS, ", "))
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(xpcall, errorhandler)
end
 
179,11 → 181,13
usage = true,
width = true,
image = true,
fontSize = true,
}
 
--Is Never a function or method
local allIsLiteral = {
type = true,
descStyle = true,
imageWidth = true,
imageHeight = true,
}
249,7 → 253,7
if handler and handler[member] then
a,b,c,d = handler[member](handler, info, ...)
else
error(string.format("Method %s doesn't exist in handler for type %s", member, membername))
error(format("Method %s doesn't exist in handler for type %s", member, membername))
end
end
del(info)
370,7 → 374,7
end
end
 
table.sort(keySort, compareOptions)
tsort(keySort, compareOptions)
 
del(tempOrders)
del(tempNames)
422,10 → 426,11
end
end
 
--[[
Gets a status table for the given appname and options path
]]
function lib:GetStatusTable(appName, path)
-- - Gets a status table for the given appname and options path.
-- @param appName The application name as given to `:RegisterOptionsTable()`
-- @param path The path to the options (a table with all group keys)
-- @return
function AceConfigDialog:GetStatusTable(appName, path)
local status = self.Status
 
if not status[appName] then
451,10 → 456,11
return status.status
end
 
--[[
Sets the given path to be selected
]]
function lib:SelectGroup(appName, ...)
--- Selects the specified path in the options window.
-- The path specified has to match the keys of the groups in the table.
-- @param appName The application name as given to `:RegisterOptionsTable()`
-- @param ... The path to the key that should be selected
function AceConfigDialog:SelectGroup(appName, ...)
local path = new()
 
 
530,7 → 536,10
local name = GetOptionsMemberValue("name", opt, options, path, appName)
local desc = GetOptionsMemberValue("desc", opt, options, path, appName)
local usage = GetOptionsMemberValue("usage", opt, options, path, appName)
local descStyle = opt.descStyle
 
if descStyle and descStyle ~= "tooltip" then return end
 
GameTooltip:SetText(name, 1, .82, 0, 1)
 
if opt.type == 'multiselect' then
575,14 → 584,14
if dialog and oldstrata then
dialog:SetFrameStrata(oldstrata)
end
lib:Open(appName, rootframe, basepath and unpack(basepath))
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl))
del(info)
end
t.OnCancel = function()
if dialog and oldstrata then
dialog:SetFrameStrata(oldstrata)
end
lib:Open(appName, rootframe, basepath and unpack(basepath))
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl))
del(info)
end
for i = 1, select('#', ...) do
675,7 → 684,7
success, validated = safecall(handler[validate], handler, info, ...)
if not success then validated = false end
else
error(string.format("Method %s doesn't exist in handler for type execute", validate))
error(format("Method %s doesn't exist in handler for type execute", validate))
end
elseif type(validate) == "function" then
success, validated = safecall(validate, info, ...)
688,6 → 697,8
--validate function returned a message to display
if rootframe.SetStatusText then
rootframe:SetStatusText(validated)
else
-- TODO: do something else.
end
PlaySound("igPlayerInviteDecline")
del(info)
704,6 → 715,8
rootframe:SetStatusText(name..": Invalid Value")
end
end
else
-- TODO: do something else
end
PlaySound("igPlayerInviteDecline")
del(info)
722,7 → 735,7
confirm = false
end
else
error(string.format("Method %s doesn't exist in handler for type confirm", confirm))
error(format("Method %s doesn't exist in handler for type confirm", confirm))
end
elseif type(confirm) == "function" then
success, confirm = safecall(confirm, info, ...)
762,7 → 775,7
if handler and handler[func] then
confirmPopup(user.appName, rootframe, basepath, info, confirmText, handler[func], handler, info, ...)
else
error(string.format("Method %s doesn't exist in handler for type func", func))
error(format("Method %s doesn't exist in handler for type func", func))
end
elseif type(func) == "function" then
confirmPopup(user.appName, rootframe, basepath, info, confirmText, func, info, ...)
777,7 → 790,7
if handler and handler[func] then
safecall(handler[func],handler, info, ...)
else
error(string.format("Method %s doesn't exist in handler for type func", func))
error(format("Method %s doesn't exist in handler for type func", func))
end
elseif type(func) == "function" then
safecall(func,info, ...)
786,23 → 799,23
 
 
local iscustom = user.rootframe:GetUserData('iscustom')
local basepath = user.rootframe:GetUserData('basepath')
local basepath = user.rootframe:GetUserData('basepath') or emptyTbl
--full refresh of the frame, some controls dont cause this on all events
if option.type == "color" then
if event == "OnValueConfirmed" then
 
if iscustom then
lib:Open(user.appName, user.rootframe, basepath and unpack(basepath))
AceConfigDialog:Open(user.appName, user.rootframe, unpack(basepath))
else
lib:Open(user.appName, basepath and unpack(basepath))
AceConfigDialog:Open(user.appName, unpack(basepath))
end
end
elseif option.type == "range" then
if event == "OnMouseUp" then
if iscustom then
lib:Open(user.appName, user.rootframe, basepath and unpack(basepath))
AceConfigDialog:Open(user.appName, user.rootframe, unpack(basepath))
else
lib:Open(user.appName, basepath and unpack(basepath))
AceConfigDialog:Open(user.appName, unpack(basepath))
end
end
--multiselects don't cause a refresh on 'OnValueChanged' only 'OnClosed'
810,9 → 823,9
user.valuechanged = true
else
if iscustom then
lib:Open(user.appName, user.rootframe, basepath and unpack(basepath))
AceConfigDialog:Open(user.appName, user.rootframe, unpack(basepath))
else
lib:Open(user.appName, basepath and unpack(basepath))
AceConfigDialog:Open(user.appName, unpack(basepath))
end
end
 
824,9 → 837,9
local option = widget:GetUserData('option')
local min, max, step = option.min or 0, option.max or 100, option.step
if step then
value = math.floor((value - min) / step + 0.5) * step + min
value = math_floor((value - min) / step + 0.5) * step + min
else
value = math.max(math.min(value,max),min)
value = math_max(math_min(value,max),min)
end
ActivateControl(widget,event,value)
end
837,11 → 850,11
ActivateControl(widget, event, widget:GetUserData('value'), ...)
local user = widget:GetUserDataTable()
local iscustom = user.rootframe:GetUserData('iscustom')
local basepath = user.rootframe:GetUserData('basepath')
local basepath = user.rootframe:GetUserData('basepath') or emptyTbl
if iscustom then
lib:Open(user.appName, user.rootframe, basepath and unpack(basepath))
AceConfigDialog:Open(user.appName, user.rootframe, unpack(basepath))
else
lib:Open(user.appName, basepath and unpack(basepath))
AceConfigDialog:Open(user.appName, unpack(basepath))
end
end
 
849,18 → 862,18
local user = widget:GetUserDataTable()
if user.valuechanged then
local iscustom = user.rootframe:GetUserData('iscustom')
local basepath = user.rootframe:GetUserData('basepath')
local basepath = user.rootframe:GetUserData('basepath') or emptyTbl
if iscustom then
lib:Open(user.appName, user.rootframe, basepath and unpack(basepath))
AceConfigDialog:Open(user.appName, user.rootframe, unpack(basepath))
else
lib:Open(user.appName, basepath and unpack(basepath))
AceConfigDialog:Open(user.appName, unpack(basepath))
end
end
end
 
local function FrameOnClose(widget, event)
local appName = widget:GetUserData('appName')
lib.OpenFrames[appName] = nil
AceConfigDialog.OpenFrames[appName] = nil
gui:Release(widget)
end
 
957,6 → 970,7
local entry = new()
entry.value = k
entry.text = GetOptionsMemberValue("name", v, options, path, appName)
entry.icon = GetOptionsMemberValue("icon", v, options, path, appName)
entry.disabled = CheckOptionDisabled(v, options, path, appName)
if not tree.children then tree.children = new() end
tinsert(tree.children,entry)
990,6 → 1004,7
local entry = new()
entry.value = k
entry.text = GetOptionsMemberValue("name", v, options, path, appName)
entry.icon = GetOptionsMemberValue("icon", v, options, path, appName)
entry.disabled = CheckOptionDisabled(v, options, path, appName)
tinsert(tree,entry)
if recurse and (v.childGroups or "tree") == "tree" then
1063,15 → 1078,43
local name = GetOptionsMemberValue("name", v, options, path, appName)
 
if v.type == "execute" then
control = gui:Create("Button")
control:SetText(name)
 
local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName)
local image, width, height = GetOptionsMemberValue("image",v, options, path, appName)
 
if type(image) == 'string' then
control = gui:Create("Icon")
if not width then
width = GetOptionsMemberValue("imageWidth",v, options, path, appName)
end
if not height then
height = GetOptionsMemberValue("imageHeight",v, options, path, appName)
end
if type(imageCoords) == 'table' then
control:SetImage(image, unpack(imageCoords))
else
control:SetImage(image)
end
if type(width) ~= "number" then
width = 32
end
if type(height) ~= "number" then
height = 32
end
control:SetImageSize(width, height)
control:SetLabel(name)
else
control = gui:Create("Button")
control:SetText(name)
end
control:SetCallback("OnClick",ActivateControl)
 
elseif v.type == "input" then
local controlType = v.dialogControl or v.control or (v.multiline and "MultiLineEditBox") or "EditBox"
control = gui:Create(controlType)
if not control then
error(("Invalid Custom Control Type - %s"):format(tostring(controlType)))
geterrorhandler()(("Invalid Custom Control Type - %s"):format(tostring(controlType)))
control = gui:Create(v.multiline and "MultiLineEditBox" or "EditBox")
end
 
if v.multiline then
1096,7 → 1139,22
local value = GetOptionsMemberValue("get",v, options, path, appName)
control:SetValue(value)
control:SetCallback("OnValueChanged",ActivateControl)
 
 
if v.descStyle == "inline" then
local desc = GetOptionsMemberValue("desc", v, options, path, appName)
control:SetDescription(desc)
end
 
local image = GetOptionsMemberValue("image", v, options, path, appName)
local imageCoords = GetOptionsMemberValue("imageCoords", v, options, path, appName)
 
if type(image) == 'string' then
if type(imageCoords) == 'table' then
control:SetImage(image, unpack(imageCoords))
else
control:SetImage(image)
end
end
elseif v.type == "range" then
control = gui:Create("Slider")
control:SetLabel(name)
1115,7 → 1173,8
local controlType = v.dialogControl or v.control or "Dropdown"
control = gui:Create(controlType)
if not control then
error(("Invalid Custom Control Type - %s"):format(tostring(controlType)))
geterrorhandler()(("Invalid Custom Control Type - %s"):format(tostring(controlType)))
control = gui:Create("Dropdown")
end
control:SetLabel(name)
control:SetList(values)
1138,13 → 1197,15
tinsert(valuesort, value)
end
end
table.sort(valuesort)
 
tsort(valuesort)
 
if controlType then
control = gui:Create(controlType)
if not control then
error(("Invalid Custom Control Type - %s"):format(tostring(controlType)))
geterrorhandler()(("Invalid Custom Control Type - %s"):format(tostring(controlType)))
end
end
if control then
control:SetMultiselect(true)
control:SetLabel(name)
control:SetList(values)
1228,6 → 1289,16
elseif v.type == "description" then
control = gui:Create("Label")
control:SetText(name)
 
local fontSize = GetOptionsMemberValue("fontSize",v, options, path, appName)
if fontSize == "medium" then
control:SetFontObject(GameFontHighlight)
elseif fontSize == "large" then
control:SetFontObject(GameFontHighlightLarge)
else -- small or invalid
control:SetFontObject(GameFontHighlightSmall)
end
 
local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName)
local image, width, height = GetOptionsMemberValue("image",v, options, path, appName)
 
1308,7 → 1379,7
feedpath[i] = path[i]
end
 
BuildPath(feedpath, string.split("\001", uniquevalue))
BuildPath(feedpath, ("\001"):split(uniquevalue))
local group = options
for i = 1, #feedpath do
if not group then return end
1320,9 → 1391,9
 
GameTooltip:SetOwner(button, "ANCHOR_NONE")
if widget.type == "TabGroup" then
GameTooltip:SetPoint("BOTTOM",button,"TOP")
GameTooltip:SetPoint("BOTTOM",button,"TOP")
else
GameTooltip:SetPoint("LEFT",button,"RIGHT")
GameTooltip:SetPoint("LEFT",button,"RIGHT")
end
 
GameTooltip:SetText(name, 1, .82, 0, 1)
1348,7 → 1419,7
feedpath[i] = path[i]
end
 
BuildPath(feedpath, string.split("\001", uniquevalue))
BuildPath(feedpath, ("\001"):split(uniquevalue))
 
local group = options
for i = 1, #feedpath do
1381,13 → 1452,13
feedpath[i] = path[i]
end
 
BuildPath(feedpath, string.split("\001", uniquevalue))
BuildPath(feedpath, ("\001"):split(uniquevalue))
local group = options
for i = 1, #feedpath do
group = GetSubOption(group, feedpath[i])
end
widget:ReleaseChildren()
lib:FeedGroup(user.appName,options,widget,rootframe,feedpath)
AceConfigDialog:FeedGroup(user.appName,options,widget,rootframe,feedpath)
 
del(feedpath)
end
1395,6 → 1466,7
 
 
--[[
-- INTERNAL --
This function will feed one group, and any inline child groups into the given container
Select Groups will only have the selection control (tree, tabs, dropdown) fed in
and have a group selected, this event will trigger the feeding of child groups
1409,7 → 1481,7
if its parent is a tree group, its already a node on a tree
--]]
 
function lib:FeedGroup(appName,options,container,rootframe,path, isRoot)
function AceConfigDialog:FeedGroup(appName,options,container,rootframe,path, isRoot)
local group = options
--follow the path to get to the curent group
local inline
1435,14 → 1507,14
--check if the group has child groups
local hasChildGroups
for k, v in pairs(group.args) do
if v.type == "group" and not pickfirstset(v.dialogInline,v.guiInline,v.inline, false) then
if v.type == "group" and not pickfirstset(v.dialogInline,v.guiInline,v.inline, false) and not CheckOptionHidden(v, options, path, appName) then
hasChildGroups = true
end
end
if group.plugins then
for plugin, t in pairs(group.plugins) do
for k, v in pairs(t) do
if v.type == "group" and not pickfirstset(v.dialogInline,v.guiInline,v.inline, false) then
if v.type == "group" and not pickfirstset(v.dialogInline,v.guiInline,v.inline, false) and not CheckOptionHidden(v, options, path, appName) then
hasChildGroups = true
end
end
1454,7 → 1526,7
 
--Add a scrollframe if we are not going to add a group control, this is the inverse of the conditions for that later on
if (not (hasChildGroups and not inline)) or (grouptype ~= "tab" and grouptype ~= "select" and (parenttype == "tree" and not isRoot)) then
if container.type ~= "InlineGroup" then
if container.type ~= "InlineGroup" and container.type ~= "SimpleGroup" then
scroll = gui:Create("ScrollFrame")
scroll:SetLayout("flow")
scroll.width = "fill"
1477,7 → 1549,7
end
 
if hasChildGroups and not inline then
 
local name = GetOptionsMemberValue("name", group, options, path, appName)
if grouptype == "tab" then
 
local tab = gui:Create("TabGroup")
1486,7 → 1558,7
tab:SetCallback("OnTabEnter", TreeOnButtonEnter)
tab:SetCallback("OnTabLeave", TreeOnButtonLeave)
 
local status = lib:GetStatusTable(appName, path)
local status = AceConfigDialog:GetStatusTable(appName, path)
if not status.groups then
status.groups = {}
end
1511,9 → 1583,10
elseif grouptype == "select" then
 
local select = gui:Create("DropdownGroup")
select:SetTitle(name)
InjectInfo(select, options, group, path, rootframe, appName)
select:SetCallback("OnGroupSelected", GroupSelected)
local status = lib:GetStatusTable(appName, path)
local status = AceConfigDialog:GetStatusTable(appName, path)
if not status.groups then
status.groups = {}
end
1529,7 → 1602,7
end
 
if firstgroup then
select:SetGroup( (GroupExists(appName, options, path,status.groups.selected) and status.groups.selected) or firstgroup)
select:SetGroup((GroupExists(appName, options, path,status.groups.selected) and status.groups.selected) or firstgroup)
end
 
select.width = "fill"
1551,7 → 1624,7
tree:SetCallback("OnButtonEnter", TreeOnButtonEnter)
tree:SetCallback("OnButtonLeave", TreeOnButtonLeave)
 
local status = lib:GetStatusTable(appName, path)
local status = AceConfigDialog:GetStatusTable(appName, path)
if not status.groups then
status.groups = {}
end
1579,29 → 1652,37
 
local function RefreshOnUpdate(this)
for appName in pairs(this.closing) do
if lib.OpenFrames[appName] then
lib.OpenFrames[appName]:Hide()
if AceConfigDialog.OpenFrames[appName] then
AceConfigDialog.OpenFrames[appName]:Hide()
end
if AceConfigDialog.BlizOptions and AceConfigDialog.BlizOptions[appName] then
for key, widget in pairs(AceConfigDialog.BlizOptions[appName]) do
if not widget:IsVisible() then
widget:ReleaseChildren()
end
end
end
this.closing[appName] = nil
end
 
if this.closeAll then
for k, v in pairs(lib.OpenFrames) do
for k, v in pairs(AceConfigDialog.OpenFrames) do
v:Hide()
end
this.closeAll = nil
end
 
for appName in pairs(this.apps) do
if lib.OpenFrames[appName] then
local user = lib.OpenFrames[appName]:GetUserDataTable()
lib:Open(appName, user.basepath and unpack(user.basepath))
if AceConfigDialog.OpenFrames[appName] then
local user = AceConfigDialog.OpenFrames[appName]:GetUserDataTable()
AceConfigDialog:Open(appName, unpack(user.basepath or emptyTbl))
end
if lib.BlizOptions and lib.BlizOptions[appName] then
local widget = lib.BlizOptions[appName]
local user = widget:GetUserDataTable()
if widget:IsVisible() then
lib:Open(widget:GetUserData('appName'), widget, user.basepath and unpack(user.basepath))
if AceConfigDialog.BlizOptions and AceConfigDialog.BlizOptions[appName] then
for key, widget in pairs(AceConfigDialog.BlizOptions[appName]) do
local user = widget:GetUserDataTable()
if widget:IsVisible() then
AceConfigDialog:Open(widget:GetUserData('appName'), widget, unpack(user.basepath or emptyTbl))
end
end
end
this.apps[appName] = nil
1609,39 → 1690,58
this:SetScript("OnUpdate", nil)
end
 
function lib:CloseAll()
lib.frame.closeAll = true
lib.frame:SetScript("OnUpdate", RefreshOnUpdate)
-- Upgrade the OnUpdate script as well, if needed.
if AceConfigDialog.frame:GetScript("OnUpdate") then
AceConfigDialog.frame:SetScript("OnUpdate", RefreshOnUpdate)
end
 
--- Close all open options windows
function AceConfigDialog:CloseAll()
AceConfigDialog.frame.closeAll = true
AceConfigDialog.frame:SetScript("OnUpdate", RefreshOnUpdate)
if next(self.OpenFrames) then
return true
end
end
 
function lib:Close(appName)
--- Close a specific options window.
-- @param appName The application name as given to `:RegisterOptionsTable()`
function AceConfigDialog:Close(appName)
if self.OpenFrames[appName] then
lib.frame.closing[appName] = true
lib.frame:SetScript("OnUpdate", RefreshOnUpdate)
AceConfigDialog.frame.closing[appName] = true
AceConfigDialog.frame:SetScript("OnUpdate", RefreshOnUpdate)
return true
end
end
 
function lib:ConfigTableChanged(event, appName)
lib.frame.apps[appName] = true
lib.frame:SetScript("OnUpdate", RefreshOnUpdate)
-- Internal -- Called by AceConfigRegistry
function AceConfigDialog:ConfigTableChanged(event, appName)
AceConfigDialog.frame.apps[appName] = true
AceConfigDialog.frame:SetScript("OnUpdate", RefreshOnUpdate)
end
 
reg.RegisterCallback(lib, "ConfigTableChange", "ConfigTableChanged")
reg.RegisterCallback(AceConfigDialog, "ConfigTableChange", "ConfigTableChanged")
 
function lib:SetDefaultSize(appName, width, height)
local status = lib:GetStatusTable(appName)
--- Sets the default size of the options window for a specific application.
-- @param appName The application name as given to `:RegisterOptionsTable()`
-- @param width The default width
-- @param height The default height
function AceConfigDialog:SetDefaultSize(appName, width, height)
local status = AceConfigDialog:GetStatusTable(appName)
if type(width) == "number" and type(height) == "number" then
status.width = width
status.height = height
end
end
 
-- :Open(appName, [container], [path ...])
function lib:Open(appName, container, ...)
--- Open an option window at the specified path (if any).
-- This function can optionally feed the group into a pre-created container
-- instead of creating a new container frame.
-- @paramsig appName [, container][, ...]
-- @param appName The application name as given to `:RegisterOptionsTable()`
-- @param container An optional container frame to feed the options into
-- @param ... The path to open after creating the options window (see `:SelectGroup` for details)
function AceConfigDialog:Open(appName, container, ...)
if not old_CloseSpecialWindows then
old_CloseSpecialWindows = CloseSpecialWindows
CloseSpecialWindows = function()
1679,7 → 1779,7
if #path > 0 then
f:SetUserData('basepath', copy(path))
end
local status = lib:GetStatusTable(appName)
local status = AceConfigDialog:GetStatusTable(appName)
if not status.width then
status.width = 700
end
1689,6 → 1789,9
if f.SetStatusTable then
f:SetStatusTable(status)
end
if f.SetTitle then
f:SetTitle(name or "")
end
else
if not self.OpenFrames[appName] then
f = gui:Create("Frame")
1703,7 → 1806,7
f:SetUserData('basepath', copy(path))
end
f:SetTitle(name or "")
local status = lib:GetStatusTable(appName)
local status = AceConfigDialog:GetStatusTable(appName)
f:SetStatusTable(status)
end
 
1714,28 → 1817,63
del(path)
end
 
lib.BlizOptions = lib.BlizOptions or {}
-- convert pre-39 BlizOptions structure to the new format
if oldminor and oldminor < 39 and AceConfigDialog.BlizOptions then
local old = AceConfigDialog.BlizOptions
local new = {}
for key, widget in pairs(old) do
local appName = widget:GetUserData('appName')
if not new[appName] then new[appName] = {} end
new[appName][key] = widget
end
AceConfigDialog.BlizOptions = new
else
AceConfigDialog.BlizOptions = AceConfigDialog.BlizOptions or {}
end
 
local function FeedToBlizPanel(widget, event)
local path = widget:GetUserData('path')
lib:Open(widget:GetUserData('appName'), widget, path and unpack(path))
AceConfigDialog:Open(widget:GetUserData('appName'), widget, unpack(path or emptyTbl))
end
 
local function ClearBlizPanel(widget, event)
widget:ReleaseChildren()
local appName = widget:GetUserData('appName')
AceConfigDialog.frame.closing[appName] = true
AceConfigDialog.frame:SetScript("OnUpdate", RefreshOnUpdate)
end
 
function lib:AddToBlizOptions(appName, name, parent, ...)
local BlizOptions = lib.BlizOptions
--- Add an option table into the Blizzard Interface Options panel.
-- You can optionally supply a descriptive name to use and a parent frame to use,
-- as well as a path in the options table.\\
-- If no name is specified, the appName will be used instead.
--
-- If you specify a proper `parent` (by name), the interface options will generate a
-- tree layout. Note that only one level of children is supported, so the parent always
-- has to be a head-level note.
--
-- This function returns a reference to the container frame registered with the Interface
-- Options. You can use this reference to open the options with the API function
-- `InterfaceOptionsFrame_OpenToCategory`.
-- @param appName The application name as given to `:RegisterOptionsTable()`
-- @param name A descriptive name to display in the options tree (defaults to appName)
-- @param parent The parent to use in the interface options tree.
-- @param ... The path in the options table to feed into the interface options panel.
-- @return The reference to the frame registered into the Interface Options.
function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...)
local BlizOptions = AceConfigDialog.BlizOptions
 
local key = appName
for n = 1, select('#', ...) do
key = key..'\001'..select(n, ...)
end
 
if not BlizOptions[key] then
if not BlizOptions[appName] then
BlizOptions[appName] = {}
end
 
if not BlizOptions[appName][key] then
local group = gui:Create("BlizOptionsGroup")
BlizOptions[key] = group
BlizOptions[appName][key] = group
group:SetName(name or appName, parent)
 
group:SetTitle(name or appName)