@ -1,13 +1,13 @@
--- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables.
--- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables.
-- @class file
-- @class file
-- @name AceConfigDialog-3.0
-- @name AceConfigDialog-3.0
-- @release $Id: AceConfigDialog-3.0.lua 1 169 2018-02-27 16:18:28Z nevcairiel $
-- @release $Id: AceConfigDialog-3.0.lua 1 248 2021-02-05 14:27:49Z funkehdude $
local LibStub = LibStub
local LibStub = LibStub
local gui = LibStub ( " AceGUI-3.0 " )
local gui = LibStub ( " AceGUI-3.0 " )
local reg = LibStub ( " AceConfigRegistry-3.0 " )
local reg = LibStub ( " AceConfigRegistry-3.0 " )
local MAJOR , MINOR = " AceConfigDialog-3.0 " , 66
local MAJOR , MINOR = " AceConfigDialog-3.0 " , 81
local AceConfigDialog , oldminor = LibStub : NewLibrary ( MAJOR , MINOR )
local AceConfigDialog , oldminor = LibStub : NewLibrary ( MAJOR , MINOR )
if not AceConfigDialog then return end
if not AceConfigDialog then return end
@ -15,22 +15,23 @@ if not AceConfigDialog then return end
AceConfigDialog.OpenFrames = AceConfigDialog.OpenFrames or { }
AceConfigDialog.OpenFrames = AceConfigDialog.OpenFrames or { }
AceConfigDialog.Status = AceConfigDialog.Status or { }
AceConfigDialog.Status = AceConfigDialog.Status or { }
AceConfigDialog.frame = AceConfigDialog.frame or CreateFrame ( " Frame " )
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 . apps = AceConfigDialog.frame . apps or { }
AceConfigDialog.frame . closing = AceConfigDialog.frame . closing or { }
AceConfigDialog.frame . closing = AceConfigDialog.frame . closing or { }
AceConfigDialog.frame . closeAllOverride = AceConfigDialog.frame . closeAllOverride or { }
AceConfigDialog.frame . closeAllOverride = AceConfigDialog.frame . closeAllOverride or { }
-- Lua APIs
-- Lua APIs
local t concat, t insert, tsort , tremove , tsort = table.concat , table.insert , table.sort , table.remove , table.sort
local t insert, tsort , tremove , wipe = table.insert , table.sort , table.remove , table.wipe
local strmatch , format = string.match , string.format
local strmatch , format = string.match , string.format
local assert, loadstring , error = assert , loadstring , error
local error = error
local pairs , next , select , type , unpack , wipe, ipairs = pairs , next , select , type , unpack , wipe , ipairs
local pairs , next , select , type , unpack , ipairs = pairs , next , select , type , unpack , ipairs
local rawset, tostring, tonumber = rawset , tostring , tonumber
local tostring, tonumber = tostring , tonumber
local math_min , math_max , math_floor = math.min , math.max , math.floor
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
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- 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: PlaySound, GameFontHighlight, GameFontHighlightSmall, GameFontHighlightLarge
-- GLOBALS: CloseSpecialWindows, InterfaceOptions_AddCategory, geterrorhandler
-- GLOBALS: CloseSpecialWindows, InterfaceOptions_AddCategory, geterrorhandler
@ -45,39 +46,10 @@ local function errorhandler(err)
return geterrorhandler ( ) ( err )
return geterrorhandler ( ) ( err )
end
end
local function CreateDispatcher ( argCount )
local code = [ [
local xpcall , eh = ...
local method , ARGS
local function call ( ) return method ( ARGS ) end
local function dispatch ( func , ... )
method = func
if not method then return end
ARGS = ...
return xpcall ( call , eh )
end
return dispatch
] ]
local ARGS = { }
for i = 1 , argCount do ARGS [ i ] = " arg " .. i end
code = code : gsub ( " ARGS " , tconcat ( ARGS , " , " ) )
return assert ( loadstring ( code , " safecall Dispatcher[ " .. argCount .. " ] " ) ) ( xpcall , errorhandler )
end
local Dispatchers = setmetatable ( { } , { __index = function ( self , argCount )
local dispatcher = CreateDispatcher ( argCount )
rawset ( self , argCount , dispatcher )
return dispatcher
end } )
Dispatchers [ 0 ] = function ( func )
return xpcall ( func , errorhandler )
end
local function safecall ( func , ... )
local function safecall ( func , ... )
return Dispatchers [ select ( " # " , ... ) ] ( func , ... )
if func then
return xpcall ( func , errorhandler , ... )
end
end
end
local width_multiplier = 170
local width_multiplier = 170
@ -85,18 +57,18 @@ local width_multiplier = 170
--[[
--[[
Group Types
Group Types
Tree - All Descendant Groups will all become nodes on the tree , direct child options will appear above the tree
Tree - All Descendant Groups will all become nodes on the tree , direct child options will appear above the tree
- Descendant Groups with inline = true and thier children will not become nodes
- Descendant Groups with inline = true and thier children will not become nodes
Tab - Direct Child Groups will become tabs , direct child options will appear above the tab control
Tab - Direct Child Groups will become tabs , direct child options will appear above the tab control
- Grandchild groups will default to inline unless specified otherwise
- Grandchild groups will default to inline unless specified otherwise
Select - Same as Tab but with entries in a dropdown rather than tabs
Select - Same as Tab but with entries in a dropdown rather than tabs
Inline Groups
Inline Groups
- Will not become nodes of a select group , they will be effectivly part of thier parent group seperated by a border
- Will not become nodes of a select group , they will be effectivly part of thier parent group seperated by a border
- If declared on a direct child of a root node of a select group , they will appear above the group container control
- If declared on a direct child of a root node of a select group , they will appear above the group container control
- When a group is displayed inline , all descendants will also be inline members of the group
- When a group is displayed inline , all descendants will also be inline members of the group
] ]
] ]
@ -197,11 +169,11 @@ local allIsLiteral = {
local function GetOptionsMemberValue ( membername , option , options , path , appName , ... )
local function GetOptionsMemberValue ( membername , option , options , path , appName , ... )
--get definition for the member
--get definition for the member
local inherits = isInherited [ membername ]
local inherits = isInherited [ membername ]
--get the member of the option, traversing the tree if it can be inherited
--get the member of the option, traversing the tree if it can be inherited
local member
local member
if inherits then
if inherits then
local group = options
local group = options
if group [ membername ] ~= nil then
if group [ membername ] ~= nil then
@ -216,7 +188,7 @@ local function GetOptionsMemberValue(membername, option, options, path, appName,
else
else
member = option [ membername ]
member = option [ membername ]
end
end
--check if we need to call a functon, or if we have a literal value
--check if we need to call a functon, or if we have a literal value
if ( not allIsLiteral [ membername ] ) and ( type ( member ) == " function " or ( ( not stringIsLiteral [ membername ] ) and type ( member ) == " string " ) ) then
if ( not allIsLiteral [ membername ] ) and ( type ( member ) == " function " or ( ( not stringIsLiteral [ membername ] ) and type ( member ) == " string " ) ) then
--We have a function to call
--We have a function to call
@ -225,13 +197,13 @@ local function GetOptionsMemberValue(membername, option, options, path, appName,
local handler
local handler
local group = options
local group = options
handler = group.handler or handler
handler = group.handler or handler
for i = 1 , # path do
for i = 1 , # path do
group = GetSubOption ( group , path [ i ] )
group = GetSubOption ( group , path [ i ] )
info [ i ] = path [ i ]
info [ i ] = path [ i ]
handler = group.handler or handler
handler = group.handler or handler
end
end
info.options = options
info.options = options
info.appName = appName
info.appName = appName
info [ 0 ] = appName
info [ 0 ] = appName
@ -241,8 +213,8 @@ local function GetOptionsMemberValue(membername, option, options, path, appName,
info.type = option.type
info.type = option.type
info.uiType = " dialog "
info.uiType = " dialog "
info.uiName = MAJOR
info.uiName = MAJOR
local a , b , c , d
local a , b , c , d
--using 4 returns for the get of a color type, increase if a type needs more
--using 4 returns for the get of a color type, increase if a type needs more
if type ( member ) == " function " then
if type ( member ) == " function " then
--Call the function
--Call the function
@ -259,8 +231,8 @@ local function GetOptionsMemberValue(membername, option, options, path, appName,
return a , b , c , d
return a , b , c , d
else
else
--The value isnt a function to call, return it
--The value isnt a function to call, return it
return member
return member
end
end
end
end
--[[calls an options function that could be inherited, method name or function ref
--[[calls an options function that could be inherited, method name or function ref
@ -325,7 +297,7 @@ local function compareOptions(a,b)
return NameA : upper ( ) < NameB : upper ( )
return NameA : upper ( ) < NameB : upper ( )
end
end
if OrderA < 0 then
if OrderA < 0 then
if OrderB > 0 then
if OrderB > = 0 then
return false
return false
end
end
else
else
@ -344,7 +316,7 @@ end
local function BuildSortedOptionsTable ( group , keySort , opts , options , path , appName )
local function BuildSortedOptionsTable ( group , keySort , opts , options , path , appName )
tempOrders = new ( )
tempOrders = new ( )
tempNames = new ( )
tempNames = new ( )
if group.plugins then
if group.plugins then
for plugin , t in pairs ( group.plugins ) do
for plugin , t in pairs ( group.plugins ) do
for k , v in pairs ( t ) do
for k , v in pairs ( t ) do
@ -360,7 +332,7 @@ local function BuildSortedOptionsTable(group, keySort, opts, options, path, appN
end
end
end
end
end
end
for k , v in pairs ( group.args ) do
for k , v in pairs ( group.args ) do
if not opts [ k ] then
if not opts [ k ] then
tinsert ( keySort , k )
tinsert ( keySort , k )
@ -391,7 +363,7 @@ local function DelTree(tree)
end
end
local function CleanUserData ( widget , event )
local function CleanUserData ( widget , event )
local user = widget : GetUserDataTable ( )
local user = widget : GetUserDataTable ( )
if user.path then
if user.path then
@ -431,7 +403,7 @@ end
-- - Gets a status table for the given appname and options path.
-- - Gets a status table for the given appname and options path.
-- @param appName The application name as given to `:RegisterOptionsTable()`
-- @param appName The application name as given to `:RegisterOptionsTable()`
-- @param path The path to the options (a table with all group keys)
-- @param path The path to the options (a table with all group keys)
-- @return
-- @return
function AceConfigDialog : GetStatusTable ( appName , path )
function AceConfigDialog : GetStatusTable ( appName , path )
local status = self.Status
local status = self.Status
@ -465,7 +437,7 @@ end
function AceConfigDialog : SelectGroup ( appName , ... )
function AceConfigDialog : SelectGroup ( appName , ... )
local path = new ( )
local path = new ( )
local app = reg : GetOptionsTable ( appName )
local app = reg : GetOptionsTable ( appName )
if not app then
if not app then
error ( ( " %s isn't registed with AceConfigRegistry, unable to open config " ) : format ( appName ) , 2 )
error ( ( " %s isn't registed with AceConfigRegistry, unable to open config " ) : format ( appName ) , 2 )
@ -477,9 +449,9 @@ function AceConfigDialog:SelectGroup(appName, ...)
status.groups = { }
status.groups = { }
end
end
status = status.groups
status = status.groups
local treevalue
local treevalue
local treestatus
local treestatus
for n = 1 , select ( " # " , ... ) do
for n = 1 , select ( " # " , ... ) do
local key = select ( n , ... )
local key = select ( n , ... )
@ -506,12 +478,12 @@ function AceConfigDialog:SelectGroup(appName, ...)
--the selected group will be overwritten if a child is the final target but still needs to be open
--the selected group will be overwritten if a child is the final target but still needs to be open
treestatus.selected = treevalue
treestatus.selected = treevalue
treestatus.groups [ treevalue ] = true
treestatus.groups [ treevalue ] = true
end
end
--move to the next group in the path
--move to the next group in the path
group = GetSubOption ( group , key )
group = GetSubOption ( group , key )
if not group then
if not group then
break
break
end
end
tinsert ( path , key )
tinsert ( path , key )
@ -521,10 +493,10 @@ function AceConfigDialog:SelectGroup(appName, ...)
end
end
status = status.groups
status = status.groups
end
end
del ( path )
del ( path )
reg : NotifyChange ( appName )
reg : NotifyChange ( appName )
end
end
local function OptionOnMouseOver ( widget , event )
local function OptionOnMouseOver ( widget , event )
--show a tooltip/set the status bar to the desc text
--show a tooltip/set the status bar to the desc text
@ -533,32 +505,33 @@ local function OptionOnMouseOver(widget, event)
local options = user.options
local options = user.options
local path = user.path
local path = user.path
local appName = user.appName
local appName = user.appName
local tooltip = AceConfigDialog.tooltip
GameT ooltip: SetOwner ( widget.frame , " ANCHOR_TOPRIGHT " )
t ooltip: SetOwner ( widget.frame , " ANCHOR_TOPRIGHT " )
local name = GetOptionsMemberValue ( " name " , opt , options , path , appName )
local name = GetOptionsMemberValue ( " name " , opt , options , path , appName )
local desc = GetOptionsMemberValue ( " desc " , opt , options , path , appName )
local desc = GetOptionsMemberValue ( " desc " , opt , options , path , appName )
local usage = GetOptionsMemberValue ( " usage " , opt , options , path , appName )
local usage = GetOptionsMemberValue ( " usage " , opt , options , path , appName )
local descStyle = opt.descStyle
local descStyle = opt.descStyle
if descStyle and descStyle ~= " tooltip " then return end
if descStyle and descStyle ~= " tooltip " then return end
GameT ooltip: SetText ( name , 1 , .82 , 0 , true )
t ooltip: SetText ( name , 1 , .82 , 0 , true )
if opt.type == " multiselect " then
if opt.type == " multiselect " then
GameT ooltip: AddLine ( user.text , 0.5 , 0.5 , 0.8 , true )
t ooltip: AddLine ( user.text , 0.5 , 0.5 , 0.8 , true )
end
end
if type ( desc ) == " string " then
if type ( desc ) == " string " then
GameT ooltip: AddLine ( desc , 1 , 1 , 1 , true )
t ooltip: AddLine ( desc , 1 , 1 , 1 , true )
end
end
if type ( usage ) == " string " then
if type ( usage ) == " string " then
GameT ooltip: AddLine ( " Usage: " .. usage , NORMAL_FONT_COLOR.r , NORMAL_FONT_COLOR.g , NORMAL_FONT_COLOR.b , true )
t ooltip: AddLine ( " Usage: " .. usage , NORMAL_FONT_COLOR.r , NORMAL_FONT_COLOR.g , NORMAL_FONT_COLOR.b , true )
end
end
GameT ooltip: Show ( )
t ooltip: Show ( )
end
end
local function OptionOnMouseLeave ( widget , event )
local function OptionOnMouseLeave ( widget , event )
GameT ooltip: Hide ( )
AceConfigDialog.t ooltip: Hide ( )
end
end
local function GetFuncName ( option )
local function GetFuncName ( option )
@ -569,71 +542,127 @@ local function GetFuncName(option)
return " set "
return " set "
end
end
end
end
do
local frame = AceConfigDialog.popup
if not frame or oldminor < 81 then
frame = CreateFrame ( " Frame " , nil , UIParent )
AceConfigDialog.popup = frame
frame : Hide ( )
frame : SetPoint ( " CENTER " , UIParent , " CENTER " )
frame : SetSize ( 320 , 72 )
frame : EnableMouse ( true ) -- Do not allow click-through on the frame
frame : SetFrameStrata ( " TOOLTIP " )
frame : SetFrameLevel ( 100 ) -- Lots of room to draw under it
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 )
if not frame.SetFixedFrameStrata then -- API capability check (classic check)
frame : SetBackdrop ( {
bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]] ,
edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]] ,
tile = true ,
tileSize = 32 ,
edgeSize = 32 ,
insets = { left = 11 , right = 11 , top = 11 , bottom = 11 } ,
} )
else
local border = CreateFrame ( " Frame " , nil , frame , " DialogBorderOpaqueTemplate " )
border : SetAllPoints ( frame )
frame : SetFixedFrameStrata ( true )
frame : SetFixedFrameLevel ( true )
end
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 , ... )
local function confirmPopup ( appName , rootframe , basepath , info , message , func , ... )
if not StaticPopupDialogs [ " ACECONFIGDIALOG30_CONFIRM_DIALOG " ] then
local frame = AceConfigDialog.popup
StaticPopupDialogs [ " ACECONFIGDIALOG30_CONFIRM_DIALOG " ] = { }
frame : Show ( )
end
frame.text : SetText ( message )
local t = StaticPopupDialogs [ " ACECONFIGDIALOG30_CONFIRM_DIALOG " ]
-- From StaticPopup.lua
for k in pairs ( t ) do
-- local height = 32 + text:GetHeight() + 2;
t [ k ] = nil
-- height = height + 6 + accept:GetHeight()
end
-- We add 32 + 2 + 6 + 21 (button height) == 61
t.text = message
local height = 61 + frame.text : GetHeight ( )
t.button1 = ACCEPT
frame : SetHeight ( height )
t.button2 = CANCEL
t.preferredIndex = STATICPOPUP_NUMDIALOGS
frame.accept : ClearAllPoints ( )
local dialog , oldstrata
frame.accept : SetPoint ( " BOTTOMRIGHT " , frame , " BOTTOM " , - 6 , 16 )
t.OnAccept = function ( )
frame.cancel : Show ( )
safecall ( func , unpack ( t ) )
if dialog and oldstrata then
local t = { ... }
dialog : SetFrameStrata ( oldstrata )
local tCount = select ( " # " , ... )
end
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 ) )
AceConfigDialog : Open ( appName , rootframe , unpack ( basepath or emptyTbl ) )
frame : Hide ( )
self : SetScript ( " OnClick " , nil )
frame.cancel : SetScript ( " OnClick " , nil )
del ( info )
del ( info )
end
end )
t.OnCancel = function ( )
frame.cancel : SetScript ( " OnClick " , function ( self )
if dialog and oldstrata then
dialog : SetFrameStrata ( oldstrata )
end
AceConfigDialog : Open ( appName , rootframe , unpack ( basepath or emptyTbl ) )
AceConfigDialog : Open ( appName , rootframe , unpack ( basepath or emptyTbl ) )
frame : Hide ( )
self : SetScript ( " OnClick " , nil )
frame.accept : SetScript ( " OnClick " , nil )
del ( info )
del ( info )
end
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 )
local function validationErrorPopup ( message )
if not StaticPopupDialogs [ " ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG " ] then
local frame = AceConfigDialog.popup
StaticPopupDialogs [ " ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG " ] = { }
frame : Show ( )
end
frame.text : SetText ( message )
local t = StaticPopupDialogs [ " ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG " ]
-- From StaticPopup.lua
t.text = message
-- local height = 32 + text:GetHeight() + 2;
t.button1 = OKAY
-- height = height + 6 + accept:GetHeight()
t.preferredIndex = STATICPOPUP_NUMDIALOGS
-- We add 32 + 2 + 6 + 21 (button height) == 61
local dialog , oldstrata
local height = 61 + frame.text : GetHeight ( )
t.OnAccept = function ( )
frame : SetHeight ( height )
if dialog and oldstrata then
dialog : SetFrameStrata ( oldstrata )
frame.accept : ClearAllPoints ( )
end
frame.accept : SetPoint ( " BOTTOM " , frame , " BOTTOM " , 0 , 16 )
end
frame.cancel : Hide ( )
t.timeout = 0
t.whileDead = 1
frame.accept : SetScript ( " OnClick " , function ( )
t.hideOnEscape = 1
frame : Hide ( )
end )
dialog = StaticPopup_Show ( " ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG " )
if dialog then
oldstrata = dialog : GetFrameStrata ( )
dialog : SetFrameStrata ( " TOOLTIP " )
end
end
end
local function ActivateControl ( widget , event , ... )
local function ActivateControl ( widget , event , ... )
@ -704,7 +733,7 @@ local function ActivateControl(widget, event, ...)
end
end
end
end
end
end
local success
local success
if validated and option.type ~= " execute " then
if validated and option.type ~= " execute " then
if type ( validate ) == " string " then
if type ( validate ) == " string " then
@ -719,7 +748,7 @@ local function ActivateControl(widget, event, ...)
if not success then validated = false end
if not success then validated = false end
end
end
end
end
local rootframe = user.rootframe
local rootframe = user.rootframe
if not validated or type ( validated ) == " string " then
if not validated or type ( validated ) == " string " then
if not validated then
if not validated then
@ -744,7 +773,7 @@ local function ActivateControl(widget, event, ...)
del ( info )
del ( info )
return true
return true
else
else
local confirmText = option.confirmText
local confirmText = option.confirmText
--call confirm func/method
--call confirm func/method
if type ( confirm ) == " string " then
if type ( confirm ) == " string " then
@ -785,10 +814,10 @@ local function ActivateControl(widget, event, ...)
confirmText = confirmText .. " - " .. desc
confirmText = confirmText .. " - " .. desc
end
end
end
end
local iscustom = user.rootframe : GetUserData ( " iscustom " )
local iscustom = user.rootframe : GetUserData ( " iscustom " )
local rootframe
local rootframe
if iscustom then
if iscustom then
rootframe = user.rootframe
rootframe = user.rootframe
end
end
@ -825,7 +854,7 @@ local function ActivateControl(widget, event, ...)
--full refresh of the frame, some controls dont cause this on all events
--full refresh of the frame, some controls dont cause this on all events
if option.type == " color " then
if option.type == " color " then
if event == " OnValueConfirmed " then
if event == " OnValueConfirmed " then
if iscustom then
if iscustom then
AceConfigDialog : Open ( user.appName , user.rootframe , unpack ( basepath ) )
AceConfigDialog : Open ( user.appName , user.rootframe , unpack ( basepath ) )
else
else
@ -886,7 +915,7 @@ end
local function MultiControlOnClosed ( widget , event , ... )
local function MultiControlOnClosed ( widget , event , ... )
local user = widget : GetUserDataTable ( )
local user = widget : GetUserDataTable ( )
if user.valuechanged then
if user.valuechanged and not widget : IsReleasing ( ) then
local iscustom = user.rootframe : GetUserData ( " iscustom " )
local iscustom = user.rootframe : GetUserData ( " iscustom " )
local basepath = user.rootframe : GetUserData ( " basepath " ) or emptyTbl
local basepath = user.rootframe : GetUserData ( " basepath " ) or emptyTbl
if iscustom then
if iscustom then
@ -1064,6 +1093,23 @@ local function InjectInfo(control, options, option, path, rootframe, appName)
control : SetCallback ( " OnEnter " , OptionOnMouseOver )
control : SetCallback ( " OnEnter " , OptionOnMouseOver )
end
end
local function CreateControl ( userControlType , fallbackControlType )
local control
if userControlType then
control = gui : Create ( userControlType )
if not control then
geterrorhandler ( ) ( ( " Invalid Custom Control Type - %s " ) : format ( tostring ( userControlType ) ) )
end
end
if not control then
control = gui : Create ( fallbackControlType )
end
return control
end
local function sortTblAsStrings ( x , y )
return tostring ( x ) < tostring ( y ) -- Support numbers as keys
end
--[[
--[[
options - root of the options table being fed
options - root of the options table being fed
@ -1095,7 +1141,7 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
else
else
GroupContainer = gui : Create ( " SimpleGroup " )
GroupContainer = gui : Create ( " SimpleGroup " )
end
end
GroupContainer.width = " fill "
GroupContainer.width = " fill "
GroupContainer : SetLayout ( " flow " )
GroupContainer : SetLayout ( " flow " )
container : AddChild ( GroupContainer )
container : AddChild ( GroupContainer )
@ -1104,16 +1150,17 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
else
else
--Control to feed
--Control to feed
local control
local control
local name = GetOptionsMemberValue ( " name " , v , options , path , appName )
local name = GetOptionsMemberValue ( " name " , v , options , path , appName )
if v.type == " execute " then
if v.type == " execute " then
local imageCoords = GetOptionsMemberValue ( " imageCoords " , v , options , path , appName )
local imageCoords = GetOptionsMemberValue ( " imageCoords " , v , options , path , appName )
local image , width , height = GetOptionsMemberValue ( " image " , v , options , path , appName )
local image , width , height = GetOptionsMemberValue ( " image " , v , options , path , appName )
if type ( image ) == " string " or type ( image ) == " number " then
local iconControl = type ( image ) == " string " or type ( image ) == " number "
control = gui : Create ( " Icon " )
control = CreateControl ( v.dialogControl or v.control , iconControl and " Icon " or " Button " )
if iconControl then
if not width then
if not width then
width = GetOptionsMemberValue ( " imageWidth " , v , options , path , appName )
width = GetOptionsMemberValue ( " imageWidth " , v , options , path , appName )
end
end
@ -1134,19 +1181,13 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
control : SetImageSize ( width , height )
control : SetImageSize ( width , height )
control : SetLabel ( name )
control : SetLabel ( name )
else
else
control = gui : Create ( " Button " )
control : SetText ( name )
control : SetText ( name )
end
end
control : SetCallback ( " OnClick " , ActivateControl )
control : SetCallback ( " OnClick " , ActivateControl )
elseif v.type == " input " then
elseif v.type == " input " then
local controlType = v.dialogControl or v.control or ( v.multiline and " MultiLineEditBox " ) or " EditBox "
control = CreateControl ( v.dialogControl or v.control , v.multiline and " MultiLineEditBox " or " EditBox " )
control = gui : Create ( controlType )
if not control then
geterrorhandler ( ) ( ( " Invalid Custom Control Type - %s " ) : format ( tostring ( controlType ) ) )
control = gui : Create ( v.multiline and " MultiLineEditBox " or " EditBox " )
end
if v.multiline and control.SetNumLines then
if v.multiline and control.SetNumLines then
control : SetNumLines ( tonumber ( v.multiline ) or 4 )
control : SetNumLines ( tonumber ( v.multiline ) or 4 )
end
end
@ -1159,21 +1200,21 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
control : SetText ( text )
control : SetText ( text )
elseif v.type == " toggle " then
elseif v.type == " toggle " then
control = gui: Create ( " CheckBox " )
control = CreateControl( v.dialogControl or v.control , " CheckBox " )
control : SetLabel ( name )
control : SetLabel ( name )
control : SetTriState ( v.tristate )
control : SetTriState ( v.tristate )
local value = GetOptionsMemberValue ( " get " , v , options , path , appName )
local value = GetOptionsMemberValue ( " get " , v , options , path , appName )
control : SetValue ( value )
control : SetValue ( value )
control : SetCallback ( " OnValueChanged " , ActivateControl )
control : SetCallback ( " OnValueChanged " , ActivateControl )
if v.descStyle == " inline " then
if v.descStyle == " inline " then
local desc = GetOptionsMemberValue ( " desc " , v , options , path , appName )
local desc = GetOptionsMemberValue ( " desc " , v , options , path , appName )
control : SetDescription ( desc )
control : SetDescription ( desc )
end
end
local image = GetOptionsMemberValue ( " image " , v , options , path , appName )
local image = GetOptionsMemberValue ( " image " , v , options , path , appName )
local imageCoords = GetOptionsMemberValue ( " imageCoords " , v , options , path , appName )
local imageCoords = GetOptionsMemberValue ( " imageCoords " , v , options , path , appName )
if type ( image ) == " string " or type ( image ) == " number " then
if type ( image ) == " string " or type ( image ) == " number " then
if type ( imageCoords ) == " table " then
if type ( imageCoords ) == " table " then
control : SetImage ( image , unpack ( imageCoords ) )
control : SetImage ( image , unpack ( imageCoords ) )
@ -1182,7 +1223,7 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
end
end
end
end
elseif v.type == " range " then
elseif v.type == " range " then
control = gui: Create ( " Slider " )
control = CreateControl( v.dialogControl or v.control , " Slider " )
control : SetLabel ( name )
control : SetLabel ( name )
control : SetSliderValues ( v.softMin or v.min or 0 , v.softMax or v.max or 100 , v.bigStep or v.step or 0 )
control : SetSliderValues ( v.softMin or v.min or 0 , v.softMax or v.max or 100 , v.bigStep or v.step or 0 )
control : SetIsPercent ( v.isPercent )
control : SetIsPercent ( v.isPercent )
@ -1196,6 +1237,7 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
elseif v.type == " select " then
elseif v.type == " select " then
local values = GetOptionsMemberValue ( " values " , v , options , path , appName )
local values = GetOptionsMemberValue ( " values " , v , options , path , appName )
local sorting = GetOptionsMemberValue ( " sorting " , v , options , path , appName )
if v.style == " radio " then
if v.style == " radio " then
local disabled = CheckOptionDisabled ( v , options , path , appName )
local disabled = CheckOptionDisabled ( v , options , path , appName )
local width = GetOptionsMemberValue ( " width " , v , options , path , appName )
local width = GetOptionsMemberValue ( " width " , v , options , path , appName )
@ -1206,12 +1248,14 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
control : PauseLayout ( )
control : PauseLayout ( )
local optionValue = GetOptionsMemberValue ( " get " , v , options , path , appName )
local optionValue = GetOptionsMemberValue ( " get " , v , options , path , appName )
local t = { }
if not sorting then
for value , text in pairs ( values ) do
sorting = { }
t [ # t + 1 ] = value
for value , text in pairs ( values ) do
sorting [ # sorting + 1 ] = value
end
tsort ( sorting , sortTblAsStrings )
end
end
tsort ( t )
for k , value in ipairs ( sorting ) do
for k , value in ipairs ( t ) do
local text = values [ value ]
local text = values [ value ]
local radio = gui : Create ( " CheckBox " )
local radio = gui : Create ( " CheckBox " )
radio : SetLabel ( text )
radio : SetLabel ( text )
@ -1238,19 +1282,14 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
control : ResumeLayout ( )
control : ResumeLayout ( )
control : DoLayout ( )
control : DoLayout ( )
else
else
local controlType = v.dialogControl or v.control or " Dropdown "
control = CreateControl ( v.dialogControl or v.control , " Dropdown " )
control = gui : Create ( controlType )
if not control then
geterrorhandler ( ) ( ( " Invalid Custom Control Type - %s " ) : format ( tostring ( controlType ) ) )
control = gui : Create ( " Dropdown " )
end
local itemType = v.itemControl
local itemType = v.itemControl
if itemType and not gui : GetWidgetVersion ( itemType ) then
if itemType and not gui : GetWidgetVersion ( itemType ) then
geterrorhandler ( ) ( ( " Invalid Custom Item Type - %s " ) : format ( tostring ( itemType ) ) )
geterrorhandler ( ) ( ( " Invalid Custom Item Type - %s " ) : format ( tostring ( itemType ) ) )
itemType = nil
itemType = nil
end
end
control : SetLabel ( name )
control : SetLabel ( name )
control : SetList ( values , nil , itemType )
control : SetList ( values , sorting , itemType )
local value = GetOptionsMemberValue ( " get " , v , options , path , appName )
local value = GetOptionsMemberValue ( " get " , v , options , path , appName )
if not values [ value ] then
if not values [ value ] then
value = nil
value = nil
@ -1262,9 +1301,7 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
elseif v.type == " multiselect " then
elseif v.type == " multiselect " then
local values = GetOptionsMemberValue ( " values " , v , options , path , appName )
local values = GetOptionsMemberValue ( " values " , v , options , path , appName )
local disabled = CheckOptionDisabled ( v , options , path , appName )
local disabled = CheckOptionDisabled ( v , options , path , appName )
local controlType = v.dialogControl or v.control
local valuesort = new ( )
local valuesort = new ( )
if values then
if values then
for value , text in pairs ( values ) do
for value , text in pairs ( values ) do
@ -1272,7 +1309,8 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
end
end
end
end
tsort ( valuesort )
tsort ( valuesort )
local controlType = v.dialogControl or v.control
if controlType then
if controlType then
control = gui : Create ( controlType )
control = gui : Create ( controlType )
if not control then
if not control then
@ -1340,13 +1378,13 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
control : ResumeLayout ( )
control : ResumeLayout ( )
control : DoLayout ( )
control : DoLayout ( )
end
end
del ( valuesort )
del ( valuesort )
elseif v.type == " color " then
elseif v.type == " color " then
control = gui: Create ( " ColorPicker " )
control = CreateControl( v.dialogControl or v.control , " ColorPicker " )
control : SetLabel ( name )
control : SetLabel ( name )
control : SetHasAlpha ( GetOptionsMemberValue ( " hasAlpha " , v , options , path , appName ) )
control : SetHasAlpha ( GetOptionsMemberValue ( " hasAlpha " , v , options , path , appName ) )
control : SetColor ( GetOptionsMemberValue ( " get " , v , options , path , appName ) )
control : SetColor ( GetOptionsMemberValue ( " get " , v , options , path , appName ) )
@ -1354,20 +1392,20 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
control : SetCallback ( " OnValueConfirmed " , ActivateControl )
control : SetCallback ( " OnValueConfirmed " , ActivateControl )
elseif v.type == " keybinding " then
elseif v.type == " keybinding " then
control = gui: Create ( " Keybinding " )
control = CreateControl( v.dialogControl or v.control , " Keybinding " )
control : SetLabel ( name )
control : SetLabel ( name )
control : SetKey ( GetOptionsMemberValue ( " get " , v , options , path , appName ) )
control : SetKey ( GetOptionsMemberValue ( " get " , v , options , path , appName ) )
control : SetCallback ( " OnKeyChanged " , ActivateControl )
control : SetCallback ( " OnKeyChanged " , ActivateControl )
elseif v.type == " header " then
elseif v.type == " header " then
control = gui: Create ( " Heading " )
control = CreateControl( v.dialogControl or v.control , " Heading " )
control : SetText ( name )
control : SetText ( name )
control.width = " fill "
control.width = " fill "
elseif v.type == " description " then
elseif v.type == " description " then
control = gui: Create ( " Label " )
control = CreateControl( v.dialogControl or v.control , " Label " )
control : SetText ( name )
control : SetText ( name )
local fontSize = GetOptionsMemberValue ( " fontSize " , v , options , path , appName )
local fontSize = GetOptionsMemberValue ( " fontSize " , v , options , path , appName )
if fontSize == " medium " then
if fontSize == " medium " then
control : SetFontObject ( GameFontHighlight )
control : SetFontObject ( GameFontHighlight )
@ -1376,10 +1414,10 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
else -- small or invalid
else -- small or invalid
control : SetFontObject ( GameFontHighlightSmall )
control : SetFontObject ( GameFontHighlightSmall )
end
end
local imageCoords = GetOptionsMemberValue ( " imageCoords " , v , options , path , appName )
local imageCoords = GetOptionsMemberValue ( " imageCoords " , v , options , path , appName )
local image , width , height = GetOptionsMemberValue ( " image " , v , options , path , appName )
local image , width , height = GetOptionsMemberValue ( " image " , v , options , path , appName )
if type ( image ) == " string " or type ( image ) == " number " then
if type ( image ) == " string " or type ( image ) == " number " then
if not width then
if not width then
width = GetOptionsMemberValue ( " imageWidth " , v , options , path , appName )
width = GetOptionsMemberValue ( " imageWidth " , v , options , path , appName )
@ -1428,7 +1466,7 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
InjectInfo ( control , options , v , path , rootframe , appName )
InjectInfo ( control , options , v , path , rootframe , appName )
container : AddChild ( control )
container : AddChild ( control )
end
end
end
end
end
end
tremove ( path )
tremove ( path )
@ -1453,7 +1491,8 @@ local function TreeOnButtonEnter(widget, event, uniquevalue, button)
local option = user.option
local option = user.option
local path = user.path
local path = user.path
local appName = user.appName
local appName = user.appName
local tooltip = AceConfigDialog.tooltip
local feedpath = new ( )
local feedpath = new ( )
for i = 1 , # path do
for i = 1 , # path do
feedpath [ i ] = path [ i ]
feedpath [ i ] = path [ i ]
@ -1468,49 +1507,50 @@ local function TreeOnButtonEnter(widget, event, uniquevalue, button)
local name = GetOptionsMemberValue ( " name " , group , options , feedpath , appName )
local name = GetOptionsMemberValue ( " name " , group , options , feedpath , appName )
local desc = GetOptionsMemberValue ( " desc " , group , options , feedpath , appName )
local desc = GetOptionsMemberValue ( " desc " , group , options , feedpath , appName )
GameTooltip : SetOwner ( button , " ANCHOR_NONE " )
tooltip : SetOwner ( button , " ANCHOR_NONE " )
tooltip : ClearAllPoints ( )
if widget.type == " TabGroup " then
if widget.type == " TabGroup " then
GameT ooltip: SetPoint ( " BOTTOM " , button , " TOP " )
t ooltip: SetPoint ( " BOTTOM " , button , " TOP " )
else
else
GameT ooltip: SetPoint ( " LEFT " , button , " RIGHT " )
t ooltip: SetPoint ( " LEFT " , button , " RIGHT " )
end
end
GameT ooltip: SetText ( name , 1 , .82 , 0 , true )
t ooltip: SetText ( name , 1 , .82 , 0 , true )
if type ( desc ) == " string " then
if type ( desc ) == " string " then
GameT ooltip: AddLine ( desc , 1 , 1 , 1 , true )
t ooltip: AddLine ( desc , 1 , 1 , 1 , true )
end
end
GameT ooltip: Show ( )
t ooltip: Show ( )
end
end
local function TreeOnButtonLeave ( widget , event , value , button )
local function TreeOnButtonLeave ( widget , event , value , button )
GameT ooltip: Hide ( )
AceConfigDialog.t ooltip: Hide ( )
end
end
local function GroupExists ( appName , options , path , uniquevalue )
local function GroupExists ( appName , options , path , uniquevalue )
if not uniquevalue then return false end
if not uniquevalue then return false end
local feedpath = new ( )
local feedpath = new ( )
local temppath = new ( )
local temppath = new ( )
for i = 1 , # path do
for i = 1 , # path do
feedpath [ i ] = path [ i ]
feedpath [ i ] = path [ i ]
end
end
BuildPath ( feedpath , ( " \001 " ) : split ( uniquevalue ) )
BuildPath ( feedpath , ( " \001 " ) : split ( uniquevalue ) )
local group = options
local group = options
for i = 1 , # feedpath do
for i = 1 , # feedpath do
local v = feedpath [ i ]
local v = feedpath [ i ]
temppath [ i ] = v
temppath [ i ] = v
group = GetSubOption ( group , v )
group = GetSubOption ( group , v )
if not group or group.type ~= " group " or CheckOptionHidden ( group , options , temppath , appName ) then
if not group or group.type ~= " group " or CheckOptionHidden ( group , options , temppath , appName ) then
del ( feedpath )
del ( feedpath )
del ( temppath )
del ( temppath )
return false
return false
end
end
end
end
del ( feedpath )
del ( feedpath )
@ -1533,10 +1573,6 @@ local function GroupSelected(widget, event, uniquevalue)
end
end
BuildPath ( feedpath , ( " \001 " ) : split ( uniquevalue ) )
BuildPath ( feedpath , ( " \001 " ) : split ( uniquevalue ) )
local group = options
for i = 1 , # feedpath do
group = GetSubOption ( group , feedpath [ i ] )
end
widget : ReleaseChildren ( )
widget : ReleaseChildren ( )
AceConfigDialog : FeedGroup ( user.appName , options , widget , rootframe , feedpath )
AceConfigDialog : FeedGroup ( user.appName , options , widget , rootframe , feedpath )
@ -1633,7 +1669,7 @@ function AceConfigDialog:FeedGroup(appName,options,container,rootframe,path, isR
tab : SetCallback ( " OnGroupSelected " , GroupSelected )
tab : SetCallback ( " OnGroupSelected " , GroupSelected )
tab : SetCallback ( " OnTabEnter " , TreeOnButtonEnter )
tab : SetCallback ( " OnTabEnter " , TreeOnButtonEnter )
tab : SetCallback ( " OnTabLeave " , TreeOnButtonLeave )
tab : SetCallback ( " OnTabLeave " , TreeOnButtonLeave )
local status = AceConfigDialog : GetStatusTable ( appName , path )
local status = AceConfigDialog : GetStatusTable ( appName , path )
if not status.groups then
if not status.groups then
status.groups = { }
status.groups = { }
@ -1653,7 +1689,7 @@ function AceConfigDialog:FeedGroup(appName,options,container,rootframe,path, isR
break
break
end
end
end
end
container : AddChild ( tab )
container : AddChild ( tab )
elseif grouptype == " select " then
elseif grouptype == " select " then
@ -1676,7 +1712,7 @@ function AceConfigDialog:FeedGroup(appName,options,container,rootframe,path, isR
if firstgroup then
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
end
select.width = " fill "
select.width = " fill "
select.height = " fill "
select.height = " fill "
@ -1688,14 +1724,14 @@ function AceConfigDialog:FeedGroup(appName,options,container,rootframe,path, isR
local tree = gui : Create ( " TreeGroup " )
local tree = gui : Create ( " TreeGroup " )
InjectInfo ( tree , options , group , path , rootframe , appName )
InjectInfo ( tree , options , group , path , rootframe , appName )
tree : EnableButtonTooltips ( false )
tree : EnableButtonTooltips ( false )
tree.width = " fill "
tree.width = " fill "
tree.height = " fill "
tree.height = " fill "
tree : SetCallback ( " OnGroupSelected " , GroupSelected )
tree : SetCallback ( " OnGroupSelected " , GroupSelected )
tree : SetCallback ( " OnButtonEnter " , TreeOnButtonEnter )
tree : SetCallback ( " OnButtonEnter " , TreeOnButtonEnter )
tree : SetCallback ( " OnButtonLeave " , TreeOnButtonLeave )
tree : SetCallback ( " OnButtonLeave " , TreeOnButtonLeave )
local status = AceConfigDialog : GetStatusTable ( appName , path )
local status = AceConfigDialog : GetStatusTable ( appName , path )
if not status.groups then
if not status.groups then
status.groups = { }
status.groups = { }
@ -1736,7 +1772,7 @@ local function RefreshOnUpdate(this)
end
end
this.closing [ appName ] = nil
this.closing [ appName ] = nil
end
end
if this.closeAll then
if this.closeAll then
for k , v in pairs ( AceConfigDialog.OpenFrames ) do
for k , v in pairs ( AceConfigDialog.OpenFrames ) do
if not this.closeAllOverride [ k ] then
if not this.closeAllOverride [ k ] then
@ -1746,7 +1782,7 @@ local function RefreshOnUpdate(this)
this.closeAll = nil
this.closeAll = nil
wipe ( this.closeAllOverride )
wipe ( this.closeAllOverride )
end
end
for appName in pairs ( this.apps ) do
for appName in pairs ( this.apps ) do
if AceConfigDialog.OpenFrames [ appName ] then
if AceConfigDialog.OpenFrames [ appName ] then
local user = AceConfigDialog.OpenFrames [ appName ] : GetUserDataTable ( )
local user = AceConfigDialog.OpenFrames [ appName ] : GetUserDataTable ( )
@ -1831,10 +1867,10 @@ function AceConfigDialog:Open(appName, container, ...)
local options = app ( " dialog " , MAJOR )
local options = app ( " dialog " , MAJOR )
local f
local f
local path = new ( )
local path = new ( )
local name = GetOptionsMemberValue ( " name " , options , options , path , appName )
local name = GetOptionsMemberValue ( " name " , options , options , path , appName )
--If an optional path is specified add it to the path table before feeding the options
--If an optional path is specified add it to the path table before feeding the options
--as container is optional as well it may contain the first element of the path
--as container is optional as well it may contain the first element of the path
if type ( container ) == " string " then
if type ( container ) == " string " then
@ -1844,7 +1880,7 @@ function AceConfigDialog:Open(appName, container, ...)
for n = 1 , select ( " # " , ... ) do
for n = 1 , select ( " # " , ... ) do
tinsert ( path , ( select ( n , ... ) ) )
tinsert ( path , ( select ( n , ... ) ) )
end
end
local option = options
local option = options
if type ( container ) == " table " and container.type == " BlizOptionsGroup " and # path > 0 then
if type ( container ) == " table " and container.type == " BlizOptionsGroup " and # path > 0 then
for i = 1 , # path do
for i = 1 , # path do
@ -1852,7 +1888,7 @@ function AceConfigDialog:Open(appName, container, ...)
end
end
name = format ( " %s - %s " , name , GetOptionsMemberValue ( " name " , option , options , path , appName ) )
name = format ( " %s - %s " , name , GetOptionsMemberValue ( " name " , option , options , path , appName ) )
end
end
--if a container is given feed into that
--if a container is given feed into that
if container then
if container then
f = container
f = container
@ -1946,19 +1982,19 @@ end
-- @param name A descriptive name to display in the options tree (defaults to appName)
-- @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 parent The parent to use in the interface options tree.
-- @param ... The path in the options table to feed into the interface options panel.
-- @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.
-- @return The reference to the frame registered into the Interface Options.
function AceConfigDialog : AddToBlizOptions ( appName , name , parent , ... )
function AceConfigDialog : AddToBlizOptions ( appName , name , parent , ... )
local BlizOptions = AceConfigDialog.BlizOptions
local BlizOptions = AceConfigDialog.BlizOptions
local key = appName
local key = appName
for n = 1 , select ( " # " , ... ) do
for n = 1 , select ( " # " , ... ) do
key = key .. " \001 " .. select ( n , ... )
key = key .. " \001 " .. select ( n , ... )
end
end
if not BlizOptions [ appName ] then
if not BlizOptions [ appName ] then
BlizOptions [ appName ] = { }
BlizOptions [ appName ] = { }
end
end
if not BlizOptions [ appName ] [ key ] then
if not BlizOptions [ appName ] [ key ] then
local group = gui : Create ( " BlizOptionsGroup " )
local group = gui : Create ( " BlizOptionsGroup " )
BlizOptions [ appName ] [ key ] = group
BlizOptions [ appName ] [ key ] = group