@ -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
@ -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
@ -533,8 +505,9 @@ 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 )
@ -542,23 +515,23 @@ local function OptionOnMouseOver(widget, event)
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
local function confirmPopup ( appName , rootframe , basepath , info , message , func , ... )
do
if not StaticPopupDialogs [ " ACECONFIGDIALOG30_CONFIRM_DIALOG " ] then
local frame = AceConfigDialog.popup
StaticPopupDialogs [ " ACECONFIGDIALOG30_CONFIRM_DIALOG " ] = { }
if not frame or oldminor < 81 then
end
frame = CreateFrame ( " Frame " , nil , UIParent )
local t = StaticPopupDialogs [ " ACECONFIGDIALOG30_CONFIRM_DIALOG " ]
AceConfigDialog.popup = frame
for k in pairs ( t ) do
frame : Hide ( )
t [ k ] = nil
frame : SetPoint ( " CENTER " , UIParent , " CENTER " )
end
frame : SetSize ( 320 , 72 )
t.text = message
frame : EnableMouse ( true ) -- Do not allow click-through on the frame
t.button1 = ACCEPT
frame : SetFrameStrata ( " TOOLTIP " )
t.button2 = CANCEL
frame : SetFrameLevel ( 100 ) -- Lots of room to draw under it
t.preferredIndex = STATICPOPUP_NUMDIALOGS
frame : SetScript ( " OnKeyDown " , function ( self , key )
local dialog , oldstrata
if key == " ESCAPE " then
t.OnAccept = function ( )
self : SetPropagateKeyboardInput ( false )
safecall ( func , unpack ( t ) )
if self.cancel : IsShown ( ) then
if dialog and oldstrata then
self.cancel : Click ( )
dialog : SetFrameStrata ( oldstrata )
else -- Showing a validation error
end
self : Hide ( )
AceConfigDialog : Open ( appName , rootframe , unpack ( basepath or emptyTbl ) )
del ( info )
end
t.OnCancel = function ( )
if dialog and oldstrata then
dialog : SetFrameStrata ( oldstrata )
end
AceConfigDialog : Open ( appName , rootframe , unpack ( basepath or emptyTbl ) )
del ( info )
end
end
for i = 1 , select ( " # " , ... ) do
else
t [ i ] = select ( i , ... ) or false
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
end
t.timeout = 0
t.whileDead = 1
t.hideOnEscape = 1
dialog = StaticPopup_Show ( " ACECONFIGDIALOG30_CONFIRM_DIALOG " )
local text = frame : CreateFontString ( nil , " ARTWORK " , " GameFontHighlight " )
if dialog then
text : SetSize ( 290 , 0 )
oldstrata = dialog : GetFrameStrata ( )
text : SetPoint ( " TOP " , 0 , - 16 )
dialog : SetFrameStrata ( " TOOLTIP " )
frame.text = text
end
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
end
local function validationErrorPopup ( message )
local accept = newButton ( ACCEPT )
if not StaticPopupDialogs [ " ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG " ] then
accept : SetPoint ( " BOTTOMRIGHT " , frame , " BOTTOM " , - 6 , 16 )
StaticPopupDialogs [ " ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG " ] = { }
frame.accept = accept
local cancel = newButton ( CANCEL )
cancel : SetPoint ( " LEFT " , accept , " RIGHT " , 13 , 0 )
frame.cancel = cancel
end
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
local function confirmPopup ( appName , rootframe , basepath , info , message , func , ... )
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 )
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 )
end
end
t.timeout = 0
t.whileDead = 1
t.hideOnEscape = 1
dialog = StaticPopup_Show ( " ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG " )
local function validationErrorPopup ( message )
if dialog then
local frame = AceConfigDialog.popup
oldstrata = dialog : GetFrameStrata ( )
frame : Show ( )
dialog : SetFrameStrata ( " TOOLTIP " )
frame.text : SetText ( message )
end
-- 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 ( " BOTTOM " , frame , " BOTTOM " , 0 , 16 )
frame.cancel : Hide ( )
frame.accept : SetScript ( " OnClick " , function ( )
frame : Hide ( )
end )
end
end
local function ActivateControl ( widget , event , ... )
local function ActivateControl ( widget , event , ... )
@ -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
@ -1112,8 +1158,9 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
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,18 +1181,12 @@ 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 )
@ -1159,7 +1200,7 @@ 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 )
@ -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
sorting = { }
for value , text in pairs ( values ) do
for value , text in pairs ( values ) do
t [ # t + 1 ] = value
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
@ -1263,8 +1302,6 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
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
@ -1273,6 +1310,7 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
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
@ -1346,7 +1384,7 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
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,18 +1392,18 @@ 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 )
@ -1453,6 +1491,7 @@ 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
@ -1469,24 +1508,25 @@ 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
@ -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 )