--- 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 1089 2013-09-13 14:32:35Z nevcairiel $
+-- @release $Id: AceConfigDialog-3.0.lua 1163 2017-08-14 14:04:39Z nevcairiel $
local LibStub = LibStub
-local MAJOR, MINOR = "AceConfigDialog-3.0", 58
+local gui = LibStub("AceGUI-3.0")
+local reg = LibStub("AceConfigRegistry-3.0")
+
+local MAJOR, MINOR = "AceConfigDialog-3.0", 64
local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
if not AceConfigDialog then return end
AceConfigDialog.frame.closing = AceConfigDialog.frame.closing or {}
AceConfigDialog.frame.closeAllOverride = AceConfigDialog.frame.closeAllOverride or {}
-local gui = LibStub("AceGUI-3.0")
-local reg = LibStub("AceConfigRegistry-3.0")
-
-- Lua APIs
local tconcat, tinsert, tsort, tremove, tsort = table.concat, table.insert, table.sort, table.remove, table.sort
local strmatch, format = string.match, string.format
if descStyle and descStyle ~= "tooltip" then return end
- GameTooltip:SetText(name, 1, .82, 0, 1)
+ GameTooltip:SetText(name, 1, .82, 0, true)
if opt.type == "multiselect" then
- GameTooltip:AddLine(user.text,0.5, 0.5, 0.8, 1)
+ GameTooltip:AddLine(user.text, 0.5, 0.5, 0.8, true)
end
if type(desc) == "string" then
- GameTooltip:AddLine(desc, 1, 1, 1, 1)
+ GameTooltip:AddLine(desc, 1, 1, 1, true)
end
if type(usage) == "string" then
- GameTooltip:AddLine("Usage: "..usage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1)
+ GameTooltip:AddLine("Usage: "..usage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, true)
end
GameTooltip:Show()
end
end
+local function validationErrorPopup(message)
+ if not StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"] then
+ StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"] = {}
+ end
+ local t = StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"]
+ t.text = message
+ t.button1 = OKAY
+ t.preferredIndex = STATICPOPUP_NUMDIALOGS
+ local dialog, oldstrata
+ t.OnAccept = function()
+ if dialog and oldstrata then
+ dialog:SetFrameStrata(oldstrata)
+ end
+ end
+ t.timeout = 0
+ t.whileDead = 1
+ t.hideOnEscape = 1
+
+ dialog = StaticPopup_Show("ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG")
+ if dialog then
+ oldstrata = dialog:GetFrameStrata()
+ dialog:SetFrameStrata("TOOLTIP")
+ end
+end
+
local function ActivateControl(widget, event, ...)
--This function will call the set / execute handler for the widget
--widget:GetUserDataTable() contains the needed info
end
local rootframe = user.rootframe
- if type(validated) == "string" then
- --validate function returned a message to display
- if rootframe.SetStatusText then
- rootframe:SetStatusText(validated)
- else
- -- TODO: do something else.
- end
- PlaySound("igPlayerInviteDecline")
- del(info)
- return true
- elseif not validated then
- --validate returned false
- if rootframe.SetStatusText then
+ if not validated or type(validated) == "string" then
+ if not validated then
if usage then
- rootframe:SetStatusText(name..": "..usage)
+ validated = name..": "..usage
else
if pattern then
- rootframe:SetStatusText(name..": Expected "..pattern)
+ validated = name..": Expected "..pattern
else
- rootframe:SetStatusText(name..": Invalid Value")
+ validated = name..": Invalid Value"
end
end
+ end
+
+ -- show validate message
+ if rootframe.SetStatusText then
+ rootframe:SetStatusText(validated)
else
- -- TODO: do something else
+ validationErrorPopup(validated)
end
- PlaySound("igPlayerInviteDecline")
+ PlaySound(PlaySoundKitID and "igPlayerInviteDecline" or 882) -- SOUNDKIT.IG_PLAYER_INVITE_DECLINE || XXX _DECLINE is actually missing from the table
del(info)
return true
else
local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName)
local image, width, height = GetOptionsMemberValue("image",v, options, path, appName)
- if type(image) == "string" then
+ if type(image) == "string" or type(image) == "number" then
control = gui:Create("Icon")
if not width then
width = GetOptionsMemberValue("imageWidth",v, options, path, appName)
local image = GetOptionsMemberValue("image", v, options, path, appName)
local imageCoords = GetOptionsMemberValue("imageCoords", v, options, path, appName)
- if type(image) == "string" then
+ if type(image) == "string" or type(image) == "number" then
if type(imageCoords) == "table" then
control:SetImage(image, unpack(imageCoords))
else
local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName)
local image, width, height = GetOptionsMemberValue("image",v, options, path, appName)
- if type(image) == "string" then
+ if type(image) == "string" or type(image) == "number" then
if not width then
width = GetOptionsMemberValue("imageWidth",v, options, path, appName)
end
GameTooltip:SetPoint("LEFT",button,"RIGHT")
end
- GameTooltip:SetText(name, 1, .82, 0, 1)
+ GameTooltip:SetText(name, 1, .82, 0, true)
if type(desc) == "string" then
- GameTooltip:AddLine(desc, 1, 1, 1, 1)
+ GameTooltip:AddLine(desc, 1, 1, 1, true)
end
GameTooltip:Show()
tinsert(path, (select(n, ...)))
end
+ local option = options
+ if type(container) == "table" and container.type == "BlizOptionsGroup" and #path > 0 then
+ for i = 1, #path do
+ option = options.args[path[i]]
+ end
+ name = format("%s - %s", name, GetOptionsMemberValue("name", option, options, path, appName))
+ end
+
--if a container is given feed into that
if container then
f = container