Mercurial > wow > pvpscan
diff Libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua @ 18:a0dcdcaec1ea v7.3.0.018
- toc update.
- libs update.
| author | Tercio |
|---|---|
| date | Tue, 17 Oct 2017 10:02:01 -0200 |
| parents | ce416064d8a1 |
| children | fedcd7c21db9 |
line wrap: on
line diff
--- a/Libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua Thu Jun 01 11:19:42 2017 -0300 +++ b/Libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua Tue Oct 17 10:02:01 2017 -0200 @@ -1,10 +1,13 @@ --- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables. -- @class file -- @name AceConfigDialog-3.0 --- @release $Id: AceConfigDialog-3.0.lua 1089 2013-09-13 14:32:35Z nevcairiel $ +-- @release $Id: AceConfigDialog-3.0.lua 1167 2017-08-29 22:08:48Z funkydude $ 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 @@ -17,9 +20,6 @@ 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 @@ -542,16 +542,16 @@ 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() @@ -611,6 +611,31 @@ 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 @@ -696,32 +721,26 @@ end local rootframe = user.rootframe - if type(validated) == "string" then - --validate function returned a message to display + if not validated or type(validated) == "string" then + if not validated then + if usage then + validated = name..": "..usage + else + if pattern then + validated = name..": Expected "..pattern + else + 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") - del(info) - return true - elseif not validated then - --validate returned false - if rootframe.SetStatusText then - if usage then - rootframe:SetStatusText(name..": "..usage) - else - if pattern then - rootframe:SetStatusText(name..": Expected "..pattern) - else - rootframe:SetStatusText(name..": Invalid Value") - end - end - else - -- TODO: do something else - end - PlaySound("igPlayerInviteDecline") + PlaySound(882) -- SOUNDKIT.IG_PLAYER_INVITE_DECLINE || _DECLINE is actually missing from the table del(info) return true else @@ -1092,7 +1111,7 @@ 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) @@ -1154,7 +1173,7 @@ 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 @@ -1354,7 +1373,7 @@ 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 @@ -1448,10 +1467,10 @@ 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() @@ -1817,6 +1836,14 @@ 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
