diff --git a/WeakAuras/Init.lua b/WeakAuras/Init.lua index af72783..6a46ecd 100644 --- a/WeakAuras/Init.lua +++ b/WeakAuras/Init.lua @@ -93,10 +93,10 @@ if not WeakAuras.IsLibsOK() then end -- These function stubs are defined here to reduce the number of errors that occur if WeakAuras.lua fails to compile -function WeakAuras.RegisterRegionType(_, _, _ ,_) +function Private.RegisterRegionType(_, _, _ ,_) end -function WeakAuras.RegisterRegionOptions(_, _ , _ ,_) +function Private.RegisterRegionOptions(_, _ , _ ,_) end function Private.StartProfileSystem(_) diff --git a/WeakAuras/RegionTypes/AuraBar.lua b/WeakAuras/RegionTypes/AuraBar.lua index 6a240bc..eb464a5 100644 --- a/WeakAuras/RegionTypes/AuraBar.lua +++ b/WeakAuras/RegionTypes/AuraBar.lua @@ -1372,4 +1372,4 @@ local function validate(data) end -- Register new region type with WeakAuras -WeakAuras.RegisterRegionType("aurabar", create, modify, default, GetProperties, validate); +Private.RegisterRegionType("aurabar", create, modify, default, GetProperties, validate); diff --git a/WeakAuras/RegionTypes/DynamicGroup.lua b/WeakAuras/RegionTypes/DynamicGroup.lua index 0f0242b..8ab7bde 100644 --- a/WeakAuras/RegionTypes/DynamicGroup.lua +++ b/WeakAuras/RegionTypes/DynamicGroup.lua @@ -1566,4 +1566,4 @@ local function modify(parent, region, data) Private.regionPrototype.modifyFinish(parent, region, data) end -WeakAuras.RegisterRegionType("dynamicgroup", create, modify, default) +Private.RegisterRegionType("dynamicgroup", create, modify, default) diff --git a/WeakAuras/RegionTypes/Group.lua b/WeakAuras/RegionTypes/Group.lua index eab0d7c..2fc0738 100644 --- a/WeakAuras/RegionTypes/Group.lua +++ b/WeakAuras/RegionTypes/Group.lua @@ -183,4 +183,4 @@ local function modify(parent, region, data) end -- Register new region type with WeakAuras -WeakAuras.RegisterRegionType("group", create, modify, default); +Private.RegisterRegionType("group", create, modify, default); diff --git a/WeakAuras/RegionTypes/Icon.lua b/WeakAuras/RegionTypes/Icon.lua index 78b4bf3..567c47c 100644 --- a/WeakAuras/RegionTypes/Icon.lua +++ b/WeakAuras/RegionTypes/Icon.lua @@ -687,4 +687,4 @@ local function validate(data) Private.EnforceSubregionExists(data, "subbackground") end -WeakAuras.RegisterRegionType("icon", create, modify, default, GetProperties, validate) +Private.RegisterRegionType("icon", create, modify, default, GetProperties, validate) diff --git a/WeakAuras/RegionTypes/Model.lua b/WeakAuras/RegionTypes/Model.lua index b476f09..ef304ec 100644 --- a/WeakAuras/RegionTypes/Model.lua +++ b/WeakAuras/RegionTypes/Model.lua @@ -301,4 +301,4 @@ local function validate(data) end -- Register new region type with WeakAuras -WeakAuras.RegisterRegionType("model", create, modify, default, GetProperties, validate); +Private.RegisterRegionType("model", create, modify, default, GetProperties, validate); diff --git a/WeakAuras/RegionTypes/ProgressTexture.lua b/WeakAuras/RegionTypes/ProgressTexture.lua index 4feea79..8fc2176 100644 --- a/WeakAuras/RegionTypes/ProgressTexture.lua +++ b/WeakAuras/RegionTypes/ProgressTexture.lua @@ -1036,4 +1036,4 @@ local function validate(data) Private.EnforceSubregionExists(data, "subbackground") end -WeakAuras.RegisterRegionType("progresstexture", create, modify, default, GetProperties, validate); +Private.RegisterRegionType("progresstexture", create, modify, default, GetProperties, validate); diff --git a/WeakAuras/RegionTypes/StopMotion.lua b/WeakAuras/RegionTypes/StopMotion.lua index 575b738..6b70798 100644 --- a/WeakAuras/RegionTypes/StopMotion.lua +++ b/WeakAuras/RegionTypes/StopMotion.lua @@ -488,4 +488,4 @@ local function validate(data) Private.EnforceSubregionExists(data, "subbackground") end -WeakAuras.RegisterRegionType("stopmotion", create, modify, default, properties, validate); +Private.RegisterRegionType("stopmotion", create, modify, default, properties, validate); diff --git a/WeakAuras/RegionTypes/Text.lua b/WeakAuras/RegionTypes/Text.lua index d1b3f5d..1361e78 100644 --- a/WeakAuras/RegionTypes/Text.lua +++ b/WeakAuras/RegionTypes/Text.lua @@ -341,7 +341,7 @@ local function validate(data) Private.EnforceSubregionExists(data, "subbackground") end -WeakAuras.RegisterRegionType("text", create, modify, default, GetProperties, validate); +Private.RegisterRegionType("text", create, modify, default, GetProperties, validate); -- Fallback region type @@ -366,4 +366,4 @@ local function fallbackmodify(parent, region, data) Private.regionPrototype.modifyFinish(parent, region, data); end -WeakAuras.RegisterRegionType("fallback", create, fallbackmodify, default); +Private.RegisterRegionType("fallback", create, fallbackmodify, default); diff --git a/WeakAuras/RegionTypes/Texture.lua b/WeakAuras/RegionTypes/Texture.lua index 1736793..264d155 100644 --- a/WeakAuras/RegionTypes/Texture.lua +++ b/WeakAuras/RegionTypes/Texture.lua @@ -237,4 +237,4 @@ local function validate(data) Private.EnforceSubregionExists(data, "subbackground") end -WeakAuras.RegisterRegionType("texture", create, modify, default, properties, validate); +Private.RegisterRegionType("texture", create, modify, default, properties, validate); diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 22e0ff0..28fdd65 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -349,27 +349,27 @@ function Private.validate(input, default) end end -function WeakAuras.RegisterRegionType(name, createFunction, modifyFunction, default, properties, validate) +function Private.RegisterRegionType(name, createFunction, modifyFunction, default, properties, validate) if not(name) then - error("Improper arguments to WeakAuras.RegisterRegionType - name is not defined", 2); + error("Improper arguments to Private.RegisterRegionType - name is not defined", 2); elseif(type(name) ~= "string") then - error("Improper arguments to WeakAuras.RegisterRegionType - name is not a string", 2); + error("Improper arguments to Private.RegisterRegionType - name is not a string", 2); elseif not(createFunction) then - error("Improper arguments to WeakAuras.RegisterRegionType - creation function is not defined", 2); + error("Improper arguments to Private.RegisterRegionType - creation function is not defined", 2); elseif(type(createFunction) ~= "function") then - error("Improper arguments to WeakAuras.RegisterRegionType - creation function is not a function", 2); + error("Improper arguments to Private.RegisterRegionType - creation function is not a function", 2); elseif not(modifyFunction) then - error("Improper arguments to WeakAuras.RegisterRegionType - modification function is not defined", 2); + error("Improper arguments to Private.RegisterRegionType - modification function is not defined", 2); elseif(type(modifyFunction) ~= "function") then - error("Improper arguments to WeakAuras.RegisterRegionType - modification function is not a function", 2) + error("Improper arguments to Private.RegisterRegionType - modification function is not a function", 2) elseif not(default) then - error("Improper arguments to WeakAuras.RegisterRegionType - default options are not defined", 2); + error("Improper arguments to Private.RegisterRegionType - default options are not defined", 2); elseif(type(default) ~= "table") then - error("Improper arguments to WeakAuras.RegisterRegionType - default options are not a table", 2); + error("Improper arguments to Private.RegisterRegionType - default options are not a table", 2); elseif(type(default) ~= "table" and type(default) ~= "nil") then - error("Improper arguments to WeakAuras.RegisterRegionType - properties options are not a table", 2); + error("Improper arguments to Private.RegisterRegionType - properties options are not a table", 2); elseif(regionTypes[name]) then - error("Improper arguments to WeakAuras.RegisterRegionType - region type \""..name.."\" already defined", 2); + error("Improper arguments to Private.RegisterRegionType - region type \""..name.."\" already defined", 2); else regionTypes[name] = { create = createFunction, @@ -443,27 +443,27 @@ function WeakAuras.RegisterSubRegionType(name, displayName, supportFunction, cre end end -function WeakAuras.RegisterRegionOptions(name, createFunction, icon, displayName, createThumbnail, modifyThumbnail, description, templates, getAnchors) +function Private.RegisterRegionOptions(name, createFunction, icon, displayName, createThumbnail, modifyThumbnail, description, templates, getAnchors) if not(name) then - error("Improper arguments to WeakAuras.RegisterRegionOptions - name is not defined", 2); + error("Improper arguments to Private.RegisterRegionOptions - name is not defined", 2); elseif(type(name) ~= "string") then - error("Improper arguments to WeakAuras.RegisterRegionOptions - name is not a string", 2); + error("Improper arguments to Private.RegisterRegionOptions - name is not a string", 2); elseif not(createFunction) then - error("Improper arguments to WeakAuras.RegisterRegionOptions - creation function is not defined", 2); + error("Improper arguments to Private.RegisterRegionOptions - creation function is not defined", 2); elseif(type(createFunction) ~= "function") then - error("Improper arguments to WeakAuras.RegisterRegionOptions - creation function is not a function", 2); + error("Improper arguments to Private.RegisterRegionOptions - creation function is not a function", 2); elseif not(icon) then - error("Improper arguments to WeakAuras.RegisterRegionOptions - icon is not defined", 2); + error("Improper arguments to Private.RegisterRegionOptions - icon is not defined", 2); elseif not(type(icon) == "string" or type(icon) == "function") then - error("Improper arguments to WeakAuras.RegisterRegionOptions - icon is not a string or a function", 2) + error("Improper arguments to Private.RegisterRegionOptions - icon is not a string or a function", 2) elseif not(displayName) then - error("Improper arguments to WeakAuras.RegisterRegionOptions - display name is not defined".." "..name, 2); + error("Improper arguments to Private.RegisterRegionOptions - display name is not defined".." "..name, 2); elseif(type(displayName) ~= "string") then - error("Improper arguments to WeakAuras.RegisterRegionOptions - display name is not a string", 2); + error("Improper arguments to Private.RegisterRegionOptions - display name is not a string", 2); elseif (getAnchors and type(getAnchors) ~= "function") then - error("Improper arguments to WeakAuras.RegisterRegionOptions - anchors is not a function", 2); + error("Improper arguments to Private.RegisterRegionOptions - anchors is not a function", 2); elseif(regionOptions[name]) then - error("Improper arguments to WeakAuras.RegisterRegionOptions - region type \""..name.."\" already defined", 2); + error("Improper arguments to Private.RegisterRegionOptions - region type \""..name.."\" already defined", 2); else local templateIcon if (type(icon) == "function") then diff --git a/WeakAurasOptions/RegionOptions/AuraBar.lua b/WeakAurasOptions/RegionOptions/AuraBar.lua index e56f894..9d9bdb0 100644 --- a/WeakAurasOptions/RegionOptions/AuraBar.lua +++ b/WeakAurasOptions/RegionOptions/AuraBar.lua @@ -794,4 +794,7 @@ local function GetAnchors(data) end -- Register new region type options with WeakAuras -WeakAuras.RegisterRegionOptions("aurabar", createOptions, createIcon, L["Progress Bar"], createThumbnail, modifyThumbnail, L["Shows a progress bar with name, timer, and icon"], templates, GetAnchors); +OptionsPrivate.registerRegions = OptionsPrivate.registerRegions or {} +table.insert(OptionsPrivate.registerRegions, function() + OptionsPrivate.Private.RegisterRegionOptions("aurabar", createOptions, createIcon, L["Progress Bar"], createThumbnail, modifyThumbnail, L["Shows a progress bar with name, timer, and icon"], templates, GetAnchors); +end) \ No newline at end of file diff --git a/WeakAurasOptions/RegionOptions/DynamicGroup.lua b/WeakAurasOptions/RegionOptions/DynamicGroup.lua index a396a90..7bbad45 100644 --- a/WeakAurasOptions/RegionOptions/DynamicGroup.lua +++ b/WeakAurasOptions/RegionOptions/DynamicGroup.lua @@ -639,4 +639,7 @@ local function createIcon() return thumbnail end -WeakAuras.RegisterRegionOptions("dynamicgroup", createOptions, createIcon, L["Dynamic Group"], createThumbnail, modifyThumbnail, L["A group that dynamically controls the positioning of its children"]); +OptionsPrivate.registerRegions = OptionsPrivate.registerRegions or {} +table.insert(OptionsPrivate.registerRegions, function() + OptionsPrivate.Private.RegisterRegionOptions("dynamicgroup", createOptions, createIcon, L["Dynamic Group"], createThumbnail, modifyThumbnail, L["A group that dynamically controls the positioning of its children"]); +end) diff --git a/WeakAurasOptions/RegionOptions/Group.lua b/WeakAurasOptions/RegionOptions/Group.lua index be6f75f..525f88b 100644 --- a/WeakAurasOptions/RegionOptions/Group.lua +++ b/WeakAurasOptions/RegionOptions/Group.lua @@ -704,5 +704,8 @@ local function createIcon() end -- Register new region type options with WeakAuras -WeakAuras.RegisterRegionOptions("group", createOptions, createIcon, L["Group"], createThumbnail, modifyThumbnail, - L["Controls the positioning and configuration of multiple displays at the same time"]) +OptionsPrivate.registerRegions = OptionsPrivate.registerRegions or {} +table.insert(OptionsPrivate.registerRegions, function() + OptionsPrivate.Private.RegisterRegionOptions("group", createOptions, createIcon, L["Group"], createThumbnail, modifyThumbnail, + L["Controls the positioning and configuration of multiple displays at the same time"]) +end) diff --git a/WeakAurasOptions/RegionOptions/Icon.lua b/WeakAurasOptions/RegionOptions/Icon.lua index 7709aad..ced05d2 100644 --- a/WeakAurasOptions/RegionOptions/Icon.lua +++ b/WeakAurasOptions/RegionOptions/Icon.lua @@ -488,4 +488,10 @@ local function GetAnchors(data) return anchorPoints; end -WeakAuras.RegisterRegionOptions("icon", createOptions, "interface\\icons\\spell_holy_sealofsalvation.blp", L["Icon"], createThumbnail, modifyThumbnail, L["Shows a spell icon with an optional cooldown overlay"], templates, GetAnchors); +OptionsPrivate.registerRegions = OptionsPrivate.registerRegions or {} +table.insert(OptionsPrivate.registerRegions, function() + OptionsPrivate.Private.RegisterRegionOptions("icon", createOptions, "interface\\icons\\spell_holy_sealofsalvation.blp", L["Icon"], + createThumbnail, modifyThumbnail, + L["Shows a spell icon with an optional cooldown overlay"], + templates, GetAnchors); +end) diff --git a/WeakAurasOptions/RegionOptions/Model.lua b/WeakAurasOptions/RegionOptions/Model.lua index fd718ed..01fe2c7 100644 --- a/WeakAurasOptions/RegionOptions/Model.lua +++ b/WeakAurasOptions/RegionOptions/Model.lua @@ -297,5 +297,8 @@ local templates = { }, } -WeakAuras.RegisterRegionOptions("model", createOptions, createIcon, L["Model"], createThumbnail, modifyThumbnail, - L["Shows a 3D model from the game files"], templates) +OptionsPrivate.registerRegions = OptionsPrivate.registerRegions or {} +table.insert(OptionsPrivate.registerRegions, function() + OptionsPrivate.Private.RegisterRegionOptions("model", createOptions, createIcon, L["Model"], createThumbnail, modifyThumbnail, + L["Shows a 3D model from the game files"], templates); +end) diff --git a/WeakAurasOptions/RegionOptions/ProgressTexture.lua b/WeakAurasOptions/RegionOptions/ProgressTexture.lua index 3238ada..442a456 100644 --- a/WeakAurasOptions/RegionOptions/ProgressTexture.lua +++ b/WeakAurasOptions/RegionOptions/ProgressTexture.lua @@ -797,4 +797,7 @@ local templates = { }, } -WeakAuras.RegisterRegionOptions("progresstexture", createOptions, createIcon, L["Progress Texture"], createThumbnail, modifyThumbnail, L["Shows a texture that changes based on duration"], templates); +OptionsPrivate.registerRegions = OptionsPrivate.registerRegions or {} +table.insert(OptionsPrivate.registerRegions, function() + OptionsPrivate.Private.RegisterRegionOptions("progresstexture", createOptions, createIcon, L["Progress Texture"], createThumbnail, modifyThumbnail, L["Shows a texture that changes based on duration"], templates); +end) diff --git a/WeakAurasOptions/RegionOptions/StopMotion.lua b/WeakAurasOptions/RegionOptions/StopMotion.lua index 3239918..b232cf3 100644 --- a/WeakAurasOptions/RegionOptions/StopMotion.lua +++ b/WeakAurasOptions/RegionOptions/StopMotion.lua @@ -706,4 +706,8 @@ local function createIcon() return thumbnail; end -WeakAuras.RegisterRegionOptions("stopmotion", createOptions, createIcon, L["Stop Motion"], createThumbnail, modifyThumbnail, L["Shows a stop motion texture"]); +OptionsPrivate.registerRegions = OptionsPrivate.registerRegions or {} +table.insert(OptionsPrivate.registerRegions, function() + OptionsPrivate.Private.RegisterRegionOptions("stopmotion", createOptions, createIcon, L["Stop Motion"], + createThumbnail, modifyThumbnail, L["Shows a stop motion texture"]); +end) diff --git a/WeakAurasOptions/RegionOptions/Text.lua b/WeakAurasOptions/RegionOptions/Text.lua index bd34bf7..9f17306 100644 --- a/WeakAurasOptions/RegionOptions/Text.lua +++ b/WeakAurasOptions/RegionOptions/Text.lua @@ -473,4 +473,7 @@ local templates = { } } -WeakAuras.RegisterRegionOptions("text", createOptions, createIcon, L["Text"], createThumbnail, modifyThumbnail, L["Shows one or more lines of text, which can include dynamic information such as progress or stacks"], templates); +OptionsPrivate.registerRegions = OptionsPrivate.registerRegions or {} +table.insert(OptionsPrivate.registerRegions, function() + OptionsPrivate.Private.RegisterRegionOptions("text", createOptions, createIcon, L["Text"], createThumbnail, modifyThumbnail, L["Shows one or more lines of text, which can include dynamic information such as progress or stacks"], templates); +end) diff --git a/WeakAurasOptions/RegionOptions/Texture.lua b/WeakAurasOptions/RegionOptions/Texture.lua index e07ce47..8130d17 100644 --- a/WeakAurasOptions/RegionOptions/Texture.lua +++ b/WeakAurasOptions/RegionOptions/Texture.lua @@ -244,4 +244,8 @@ local templates = { }, } -WeakAuras.RegisterRegionOptions("texture", createOptions, createIcon, L["Texture"], createThumbnail, modifyThumbnail, L["Shows a custom texture"], templates); +OptionsPrivate.registerRegions = OptionsPrivate.registerRegions or {} +table.insert(OptionsPrivate.registerRegions, function() + OptionsPrivate.Private.RegisterRegionOptions("texture", createOptions, createIcon, L["Texture"], createThumbnail, modifyThumbnail, + L["Shows a custom texture"], templates); +end) diff --git a/WeakAurasOptions/WeakAurasOptions.lua b/WeakAurasOptions/WeakAurasOptions.lua index 4a6d2e9..aac6bd8 100644 --- a/WeakAurasOptions/WeakAurasOptions.lua +++ b/WeakAurasOptions/WeakAurasOptions.lua @@ -574,6 +574,10 @@ function WeakAuras.ToggleOptions(msg, Private) if not OptionsPrivate.Private then OptionsPrivate.Private = Private Private.OptionsFrame = OptionsFrame + for _, fn in ipairs(OptionsPrivate.registerRegions) do + fn() + end + OptionsPrivate.Private.callbacks:RegisterCallback("AuraWarningsUpdated", function(event, uid) local id = OptionsPrivate.Private.UIDtoID(uid) if displayButtons[id] then