Mercurial > wow > hansgar_and_franzok_assist
diff Libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua @ 51:dbf04157d63e v7.3.0.051
- ToC Update.
| author | Tercio |
|---|---|
| date | Sat, 02 Sep 2017 12:42:52 -0300 |
| parents | 52973d00a183 |
| children | 0682d738499b |
line wrap: on
line diff
--- a/Libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua Wed Jul 05 15:20:31 2017 -0300 +++ b/Libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua Sat Sep 02 12:42:52 2017 -0300 @@ -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 1126 2014-11-10 06:38:01Z nevcairiel $ +-- @release $Id: AceConfigDialog-3.0.lua 1167 2017-08-29 22:08:48Z funkydude $ local LibStub = LibStub -local MAJOR, MINOR = "AceConfigDialog-3.0", 60 +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 @@ -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
