Clean up WeakAuras table and remove members that no one should touch
This commit is contained in:
+106
-107
@@ -112,7 +112,7 @@ function Private.LoadOptions(msg)
|
||||
-- inform the user and queue ooc
|
||||
prettyPrint(L["Options will finish loading after combat ends."])
|
||||
queueshowooc = msg or "";
|
||||
WeakAuras.frames["Addon Initialization Handler"]:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||
Private.frames["Addon Initialization Handler"]:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||
return false;
|
||||
else
|
||||
local loaded, reason = LoadAddOn("WeakAurasOptions");
|
||||
@@ -216,29 +216,30 @@ local loadFuncsForOptions = {};
|
||||
local loadEvents = {}
|
||||
|
||||
-- All regions keyed on id, has properties: region, regionType, also see clones
|
||||
WeakAuras.regions = {};
|
||||
Private.regions = {};
|
||||
local regions = Private.regions;
|
||||
|
||||
-- keyed on id, contains bool indicating whether the aura is loaded
|
||||
Private.loaded = {};
|
||||
local loaded = Private.loaded;
|
||||
|
||||
-- contains regions for clones
|
||||
WeakAuras.clones = {};
|
||||
local clones = WeakAuras.clones;
|
||||
Private.clones = {};
|
||||
local clones = Private.clones;
|
||||
|
||||
-- Unused regions that are kept around for clones
|
||||
local clonePool = {}
|
||||
|
||||
-- One table per regionType, see RegisterRegionType, notable properties: create, modify and default
|
||||
WeakAuras.regionTypes = {};
|
||||
local regionTypes = WeakAuras.regionTypes;
|
||||
Private.regionTypes = {};
|
||||
local regionTypes = Private.regionTypes;
|
||||
|
||||
Private.subRegionTypes = {}
|
||||
local subRegionTypes = Private.subRegionTypes
|
||||
|
||||
-- One table per regionType, see RegisterRegionOptions
|
||||
WeakAuras.regionOptions = {};
|
||||
local regionOptions = WeakAuras.regionOptions;
|
||||
Private.regionOptions = {};
|
||||
local regionOptions = Private.regionOptions;
|
||||
|
||||
Private.subRegionOptions = {}
|
||||
local subRegionOptions = Private.subRegionOptions
|
||||
@@ -282,7 +283,6 @@ local fallbacksStates = {};
|
||||
local triggerSystems = {}
|
||||
|
||||
local timers = {}; -- Timers for autohiding, keyed on id, triggernum, cloneid
|
||||
WeakAuras.timers = timers;
|
||||
|
||||
WeakAuras.raidUnits = {};
|
||||
WeakAuras.raidpetUnits = {};
|
||||
@@ -319,13 +319,13 @@ local playerLevel = UnitLevel("player");
|
||||
Private.customActionsFunctions = {};
|
||||
|
||||
-- Custom Functions used in conditions, keyed on id, condition number, "changes", property number
|
||||
WeakAuras.customConditionsFunctions = {};
|
||||
Private.ExecEnv.customConditionsFunctions = {};
|
||||
-- Text format functions for chat messages, keyed on id, condition number, changes, property number
|
||||
WeakAuras.conditionTextFormatters = {}
|
||||
Private.ExecEnv.conditionTextFormatters = {}
|
||||
|
||||
-- Helpers for conditions, that is custom run functions and preamble objects for built in checks
|
||||
-- keyed on UID not on id!
|
||||
WeakAuras.conditionHelpers = {}
|
||||
Private.ExecEnv.conditionHelpers = {}
|
||||
|
||||
local load_prototype = Private.load_prototype;
|
||||
|
||||
@@ -336,7 +336,7 @@ local levelColors = {
|
||||
[3] = "|cFFFF4040"
|
||||
};
|
||||
|
||||
function WeakAuras.validate(input, default)
|
||||
function Private.validate(input, default)
|
||||
for field, defaultValue in pairs(default) do
|
||||
if(type(defaultValue) == "table" and type(input[field]) ~= "table") then
|
||||
input[field] = {};
|
||||
@@ -344,7 +344,7 @@ function WeakAuras.validate(input, default)
|
||||
input[field] = defaultValue;
|
||||
end
|
||||
if(type(input[field]) == "table") then
|
||||
WeakAuras.validate(input[field], defaultValue);
|
||||
Private.validate(input[field], defaultValue);
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -948,7 +948,7 @@ local function tooltip_draw()
|
||||
end
|
||||
|
||||
local colorFrame = CreateFrame("Frame");
|
||||
WeakAuras.frames["LDB Icon Recoloring"] = colorFrame;
|
||||
Private.frames["LDB Icon Recoloring"] = colorFrame;
|
||||
|
||||
local colorElapsed = 0;
|
||||
local colorDelay = 2;
|
||||
@@ -956,7 +956,7 @@ local r, g, b = 0.8, 0, 1;
|
||||
local r2, g2, b2 = random(2)-1, random(2)-1, random(2)-1;
|
||||
|
||||
local tooltip_update_frame = CreateFrame("Frame");
|
||||
WeakAuras.frames["LDB Tooltip Updater"] = tooltip_update_frame;
|
||||
Private.frames["LDB Tooltip Updater"] = tooltip_update_frame;
|
||||
|
||||
-- function copied from LibDBIcon-1.0.lua
|
||||
local function getAnchors(frame)
|
||||
@@ -1087,7 +1087,7 @@ function Private.Login(initialTime, takeNewSnapshots)
|
||||
end
|
||||
coroutine.yield();
|
||||
|
||||
WeakAuras.AddMany(toAdd, takeNewSnapshots);
|
||||
Private.AddMany(toAdd, takeNewSnapshots);
|
||||
coroutine.yield();
|
||||
|
||||
Private.RegisterLoadEvents();
|
||||
@@ -1108,7 +1108,7 @@ function Private.Login(initialTime, takeNewSnapshots)
|
||||
|
||||
loginFinished = true
|
||||
-- Tell Dynamic Groups that we are done with login
|
||||
for _, region in pairs(WeakAuras.regions) do
|
||||
for _, region in pairs(Private.regions) do
|
||||
if (region.region.RunDelayedActions) then
|
||||
region.region:RunDelayedActions();
|
||||
end
|
||||
@@ -1138,12 +1138,12 @@ function Private.Login(initialTime, takeNewSnapshots)
|
||||
end
|
||||
|
||||
local WeakAurasFrame = CreateFrame("Frame", "WeakAurasFrame", UIParent);
|
||||
WeakAuras.frames["WeakAuras Main Frame"] = WeakAurasFrame;
|
||||
Private.frames["WeakAuras Main Frame"] = WeakAurasFrame;
|
||||
WeakAurasFrame:SetAllPoints(UIParent);
|
||||
WeakAurasFrame:SetFrameStrata("BACKGROUND");
|
||||
|
||||
local loadedFrame = CreateFrame("Frame");
|
||||
WeakAuras.frames["Addon Initialization Handler"] = loadedFrame;
|
||||
Private.frames["Addon Initialization Handler"] = loadedFrame;
|
||||
loadedFrame:RegisterEvent("ADDON_LOADED");
|
||||
loadedFrame:RegisterEvent("PLAYER_LOGIN");
|
||||
loadedFrame:RegisterEvent("PLAYER_LOGOUT");
|
||||
@@ -1223,7 +1223,7 @@ loadedFrame:SetScript("OnEvent", function(self, event, addon)
|
||||
if (queueshowooc) then
|
||||
WeakAuras.OpenOptions(queueshowooc)
|
||||
queueshowooc = nil
|
||||
WeakAuras.frames["Addon Initialization Handler"]:UnregisterEvent("PLAYER_REGEN_ENABLED")
|
||||
Private.frames["Addon Initialization Handler"]:UnregisterEvent("PLAYER_REGEN_ENABLED")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1275,7 +1275,7 @@ end
|
||||
|
||||
function Private.PauseAllDynamicGroups()
|
||||
local suspended = {}
|
||||
for id, region in pairs(WeakAuras.regions) do
|
||||
for id, region in pairs(Private.regions) do
|
||||
if (region.region.Suspend) then
|
||||
region.region:Suspend();
|
||||
tinsert(suspended, id)
|
||||
@@ -1302,7 +1302,7 @@ function Private.IsOptionsProcessingPaused()
|
||||
return pausedOptionsProcessing;
|
||||
end
|
||||
|
||||
function WeakAuras.GroupType()
|
||||
function Private.ExecEnv.GroupType()
|
||||
if (IsInRaid()) then
|
||||
return "raid";
|
||||
end
|
||||
@@ -1398,7 +1398,7 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...)
|
||||
end
|
||||
|
||||
local size, difficulty, instanceType = GetInstanceTypeAndSize()
|
||||
local group = WeakAuras.GroupType()
|
||||
local group = Private.ExecEnv.GroupType()
|
||||
|
||||
local changed = 0;
|
||||
local shouldBeLoaded, couldBeLoaded;
|
||||
@@ -1487,8 +1487,7 @@ function Private.ScanForLoads(toCheck, event, arg1, ...)
|
||||
end
|
||||
|
||||
local loadFrame = CreateFrame("Frame");
|
||||
WeakAuras.loadFrame = loadFrame;
|
||||
WeakAuras.frames["Display Load Handling"] = loadFrame;
|
||||
Private.frames["Display Load Handling"] = loadFrame;
|
||||
|
||||
loadFrame:RegisterEvent("PLAYER_TALENT_UPDATE");
|
||||
loadFrame:RegisterEvent("SPELL_UPDATE_USABLE");
|
||||
@@ -1514,8 +1513,7 @@ loadFrame:RegisterEvent("PLAYER_FLAGS_CHANGED")
|
||||
loadFrame:RegisterEvent("PARTY_LEADER_CHANGED")
|
||||
|
||||
local unitLoadFrame = CreateFrame("Frame");
|
||||
WeakAuras.unitLoadFrame = unitLoadFrame;
|
||||
WeakAuras.frames["Display Load Handling 2"] = unitLoadFrame;
|
||||
Private.frames["Display Load Handling 2"] = unitLoadFrame;
|
||||
|
||||
unitLoadFrame:RegisterEvent("UNIT_FLAGS");
|
||||
unitLoadFrame:RegisterEvent("UNIT_ENTERED_VEHICLE");
|
||||
@@ -1541,8 +1539,8 @@ end
|
||||
local function UnloadAll()
|
||||
-- Even though auras are collapsed, their finish animation can be running
|
||||
for id in pairs(loaded) do
|
||||
if WeakAuras.regions[id] and WeakAuras.regions[id].region then
|
||||
Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true)
|
||||
if Private.regions[id] and Private.regions[id].region then
|
||||
Private.CancelAnimation(Private.regions[id].region, true, true, true, true, true, true)
|
||||
end
|
||||
if clones[id] then
|
||||
for _, region in pairs(clones[id]) do
|
||||
@@ -1583,7 +1581,7 @@ function Private.Resume()
|
||||
|
||||
local suspended = Private.PauseAllDynamicGroups()
|
||||
|
||||
for id, region in pairs(WeakAuras.regions) do
|
||||
for id, region in pairs(Private.regions) do
|
||||
region.region:Collapse();
|
||||
end
|
||||
|
||||
@@ -1651,11 +1649,11 @@ function Private.UnloadDisplays(toUnload, ...)
|
||||
local uid = WeakAuras.GetData(id).uid
|
||||
Private.UnloadConditions(uid)
|
||||
|
||||
WeakAuras.regions[id].region:Collapse();
|
||||
Private.regions[id].region:Collapse();
|
||||
Private.CollapseAllClones(id);
|
||||
|
||||
-- Even though auras are collapsed, their finish animation can be running
|
||||
Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true)
|
||||
Private.CancelAnimation(Private.regions[id].region, true, true, true, true, true, true)
|
||||
if clones[id] then
|
||||
for cloneId, region in pairs(clones[id]) do
|
||||
Private.CancelAnimation(region, true, true, true, true, true, true)
|
||||
@@ -1720,11 +1718,11 @@ function WeakAuras.Delete(data)
|
||||
end
|
||||
end
|
||||
|
||||
if WeakAuras.regions[id] then
|
||||
WeakAuras.regions[id].region:Collapse()
|
||||
Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true)
|
||||
WeakAuras.regions[id].region = nil
|
||||
WeakAuras.regions[id] = nil
|
||||
if Private.regions[id] then
|
||||
Private.regions[id].region:Collapse()
|
||||
Private.CancelAnimation(Private.regions[id].region, true, true, true, true, true, true)
|
||||
Private.regions[id].region = nil
|
||||
Private.regions[id] = nil
|
||||
end
|
||||
|
||||
if clones[id] then
|
||||
@@ -1762,10 +1760,10 @@ function WeakAuras.Delete(data)
|
||||
end
|
||||
|
||||
Private.customActionsFunctions[id] = nil;
|
||||
WeakAuras.customConditionsFunctions[id] = nil;
|
||||
WeakAuras.conditionTextFormatters[id] = nil
|
||||
Private.ExecEnv.customConditionsFunctions[id] = nil;
|
||||
Private.ExecEnv.conditionTextFormatters[id] = nil
|
||||
Private.frameLevels[id] = nil;
|
||||
WeakAuras.conditionHelpers[data.uid] = nil
|
||||
Private.ExecEnv.conditionHelpers[data.uid] = nil
|
||||
|
||||
Private.RemoveHistory(data.uid)
|
||||
|
||||
@@ -1795,10 +1793,10 @@ function WeakAuras.Rename(data, newid)
|
||||
end
|
||||
|
||||
UIDtoID[data.uid] = newid
|
||||
WeakAuras.regions[newid] = WeakAuras.regions[oldid];
|
||||
WeakAuras.regions[oldid] = nil;
|
||||
if WeakAuras.regions[newid] then
|
||||
WeakAuras.regions[newid].region.id = newid
|
||||
Private.regions[newid] = Private.regions[oldid];
|
||||
Private.regions[oldid] = nil;
|
||||
if Private.regions[newid] then
|
||||
Private.regions[newid].region.id = newid
|
||||
end
|
||||
if(clones[oldid]) then
|
||||
clones[newid] = clones[oldid]
|
||||
@@ -1858,11 +1856,11 @@ function WeakAuras.Rename(data, newid)
|
||||
Private.customActionsFunctions[newid] = Private.customActionsFunctions[oldid];
|
||||
Private.customActionsFunctions[oldid] = nil;
|
||||
|
||||
WeakAuras.customConditionsFunctions[newid] = WeakAuras.customConditionsFunctions[oldid];
|
||||
WeakAuras.customConditionsFunctions[oldid] = nil;
|
||||
Private.ExecEnv.customConditionsFunctions[newid] = Private.ExecEnv.customConditionsFunctions[oldid];
|
||||
Private.ExecEnv.customConditionsFunctions[oldid] = nil;
|
||||
|
||||
WeakAuras.conditionTextFormatters[newid] = WeakAuras.conditionTextFormatters[oldid]
|
||||
WeakAuras.conditionTextFormatters[oldid] = nil
|
||||
Private.ExecEnv.conditionTextFormatters[newid] = Private.ExecEnv.conditionTextFormatters[oldid]
|
||||
Private.ExecEnv.conditionTextFormatters[oldid] = nil
|
||||
|
||||
Private.frameLevels[newid] = Private.frameLevels[oldid];
|
||||
Private.frameLevels[oldid] = nil;
|
||||
@@ -1880,9 +1878,9 @@ function Private.Convert(data, newType)
|
||||
|
||||
Private.FakeStatesFor(id, false)
|
||||
|
||||
if WeakAuras.regions[id] then
|
||||
WeakAuras.regions[id].region = nil
|
||||
WeakAuras.regions[id] = nil
|
||||
if Private.regions[id] then
|
||||
Private.regions[id].region = nil
|
||||
Private.regions[id] = nil
|
||||
end
|
||||
|
||||
data.regionType = newType;
|
||||
@@ -2150,7 +2148,7 @@ local function loadOrder(tbl, idtable)
|
||||
end
|
||||
coroutine.yield()
|
||||
end
|
||||
error("Circular dependency in WeakAuras.AddMany between "..table.concat(depends, ", "));
|
||||
error("Circular dependency in Private.AddMany between "..table.concat(depends, ", "));
|
||||
else
|
||||
if not(loaded[data.parent]) then
|
||||
local dependsOut = CopyTable(depends)
|
||||
@@ -2178,7 +2176,7 @@ local function loadOrder(tbl, idtable)
|
||||
return order
|
||||
end
|
||||
|
||||
function WeakAuras.AddMany(tbl, takeSnapshots)
|
||||
function Private.AddMany(tbl, takeSnapshots)
|
||||
local idtable = {};
|
||||
for _, data in ipairs(tbl) do
|
||||
-- There was an unfortunate bug in update.lua in 2022 that resulted
|
||||
@@ -2203,8 +2201,8 @@ function WeakAuras.AddMany(tbl, takeSnapshots)
|
||||
end
|
||||
for data in pairs(groups) do
|
||||
if data.type == "dynamicgroup" then
|
||||
if WeakAuras.regions[data.id] then
|
||||
WeakAuras.regions[data.id].region:ReloadControlledChildren()
|
||||
if Private.regions[data.id] then
|
||||
Private.regions[data.id].region:ReloadControlledChildren()
|
||||
end
|
||||
else
|
||||
WeakAuras.Add(data)
|
||||
@@ -2554,23 +2552,23 @@ end
|
||||
function WeakAuras.PreAdd(data)
|
||||
-- Readd what Compress removed before version 8
|
||||
if (not data.internalVersion or data.internalVersion < 7) then
|
||||
WeakAuras.validate(data, oldDataStub)
|
||||
Private.validate(data, oldDataStub)
|
||||
elseif (data.internalVersion < 8) then
|
||||
WeakAuras.validate(data, oldDataStub2)
|
||||
Private.validate(data, oldDataStub2)
|
||||
end
|
||||
|
||||
local default = data.regionType and WeakAuras.regionTypes[data.regionType] and WeakAuras.regionTypes[data.regionType].default
|
||||
local default = data.regionType and Private.regionTypes[data.regionType] and Private.regionTypes[data.regionType].default
|
||||
if default then
|
||||
WeakAuras.validate(data, default)
|
||||
Private.validate(data, default)
|
||||
end
|
||||
|
||||
local regionValidate = data.regionType and WeakAuras.regionTypes[data.regionType] and WeakAuras.regionTypes[data.regionType].validate
|
||||
local regionValidate = data.regionType and Private.regionTypes[data.regionType] and Private.regionTypes[data.regionType].validate
|
||||
if regionValidate then
|
||||
regionValidate(data)
|
||||
end
|
||||
|
||||
Private.Modernize(data);
|
||||
WeakAuras.validate(data, WeakAuras.data_stub);
|
||||
Private.validate(data, Private.data_stub);
|
||||
if data.subRegions then
|
||||
for _, subRegionData in ipairs(data.subRegions) do
|
||||
local subType = subRegionData.type
|
||||
@@ -2581,7 +2579,7 @@ function WeakAuras.PreAdd(data)
|
||||
default = default(data.regionType)
|
||||
end
|
||||
if default then
|
||||
WeakAuras.validate(subRegionData, default)
|
||||
Private.validate(subRegionData, default)
|
||||
end
|
||||
else
|
||||
WeakAuras.prettyPrint(L["ERROR in '%s' unknown or incompatible sub element type '%s'"]:format(data.id, subType))
|
||||
@@ -2626,11 +2624,11 @@ local function pAdd(data, simpleChange)
|
||||
if simpleChange then
|
||||
db.displays[id] = data
|
||||
if WeakAuras.GetRegion(data.id) then
|
||||
WeakAuras.SetRegion(data)
|
||||
Private.SetRegion(data)
|
||||
end
|
||||
if clones[id] then
|
||||
for cloneId, region in pairs(clones[id]) do
|
||||
WeakAuras.SetRegion(data, cloneId)
|
||||
Private.SetRegion(data, cloneId)
|
||||
end
|
||||
end
|
||||
Private.UpdatedTriggerState(id)
|
||||
@@ -2644,7 +2642,7 @@ local function pAdd(data, simpleChange)
|
||||
end
|
||||
db.displays[id] = data;
|
||||
if WeakAuras.GetRegion(data.id) then
|
||||
WeakAuras.SetRegion(data)
|
||||
Private.SetRegion(data)
|
||||
end
|
||||
Private.ScanForLoadsGroup({[id] = true});
|
||||
loadEvents["GROUP"] = loadEvents["GROUP"] or {}
|
||||
@@ -2654,8 +2652,8 @@ local function pAdd(data, simpleChange)
|
||||
if (WeakAuras.IsOptionsOpen()) then
|
||||
visible = Private.FakeStatesFor(id, false)
|
||||
else
|
||||
if (WeakAuras.regions[id] and WeakAuras.regions[id].region) then
|
||||
WeakAuras.regions[id].region:Collapse()
|
||||
if (Private.regions[id] and Private.regions[id].region) then
|
||||
Private.regions[id].region:Collapse()
|
||||
else
|
||||
Private.CollapseAllClones(id)
|
||||
end
|
||||
@@ -2688,8 +2686,8 @@ local function pAdd(data, simpleChange)
|
||||
loadEvents["SCAN_ALL"][id] = true
|
||||
|
||||
local loadForOptionsFuncStr = ConstructFunction(load_prototype, data.load, true);
|
||||
local loadFunc = WeakAuras.LoadFunction(loadFuncStr);
|
||||
local loadForOptionsFunc = WeakAuras.LoadFunction(loadForOptionsFuncStr);
|
||||
local loadFunc = Private.LoadFunction(loadFuncStr);
|
||||
local loadForOptionsFunc = Private.LoadFunction(loadForOptionsFuncStr);
|
||||
local triggerLogicFunc;
|
||||
if data.triggers.disjunctive == "custom" then
|
||||
triggerLogicFunc = WeakAuras.LoadFunction("return "..(data.triggers.customTriggerLogic or ""));
|
||||
@@ -2715,7 +2713,7 @@ local function pAdd(data, simpleChange)
|
||||
end
|
||||
|
||||
if WeakAuras.GetRegion(data.id) then
|
||||
WeakAuras.SetRegion(data)
|
||||
Private.SetRegion(data)
|
||||
end
|
||||
|
||||
triggerState[id] = {
|
||||
@@ -2766,10 +2764,10 @@ function Private.AddParents(data)
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.SetRegion(data, cloneId)
|
||||
function Private.SetRegion(data, cloneId)
|
||||
local regionType = data.regionType;
|
||||
if not(regionType) then
|
||||
error("Improper arguments to WeakAuras.SetRegion - regionType not defined");
|
||||
error("Improper arguments to Private.SetRegion - regionType not defined");
|
||||
else
|
||||
if(not regionTypes[regionType]) then
|
||||
regionType = "fallback";
|
||||
@@ -2778,7 +2776,7 @@ function WeakAuras.SetRegion(data, cloneId)
|
||||
|
||||
local id = data.id;
|
||||
if not(id) then
|
||||
error("Improper arguments to WeakAuras.SetRegion - id not defined");
|
||||
error("Improper arguments to Private.SetRegion - id not defined");
|
||||
else
|
||||
local region;
|
||||
if(cloneId) then
|
||||
@@ -2800,9 +2798,9 @@ function WeakAuras.SetRegion(data, cloneId)
|
||||
region = clones[id][cloneId];
|
||||
end
|
||||
else
|
||||
if((not WeakAuras.regions[id]) or (not WeakAuras.regions[id].region) or WeakAuras.regions[id].regionType ~= regionType) then
|
||||
if((not regions[id]) or (not regions[id].region) or regions[id].regionType ~= regionType) then
|
||||
region = regionTypes[regionType].create(WeakAurasFrame, data);
|
||||
WeakAuras.regions[id] = {
|
||||
regions[id] = {
|
||||
regionType = regionType,
|
||||
region = region
|
||||
};
|
||||
@@ -2813,12 +2811,12 @@ function WeakAuras.SetRegion(data, cloneId)
|
||||
region.toShow = true
|
||||
end
|
||||
else
|
||||
region = WeakAuras.regions[id].region
|
||||
region = regions[id].region
|
||||
end
|
||||
end
|
||||
region.id = id;
|
||||
region.cloneId = cloneId or "";
|
||||
WeakAuras.validate(data, regionTypes[regionType].default);
|
||||
Private.validate(data, regionTypes[regionType].default);
|
||||
|
||||
local parent = WeakAurasFrame;
|
||||
if(data.parent) then
|
||||
@@ -2864,7 +2862,7 @@ local function EnsureClone(id, cloneId)
|
||||
clones[id] = clones[id] or {}
|
||||
if not(clones[id][cloneId]) then
|
||||
local data = WeakAuras.GetData(id)
|
||||
WeakAuras.SetRegion(data, cloneId)
|
||||
Private.SetRegion(data, cloneId)
|
||||
end
|
||||
return clones[id][cloneId]
|
||||
end
|
||||
@@ -2875,8 +2873,8 @@ function Private.CreatingRegions()
|
||||
end
|
||||
--- Ensures that a region exists
|
||||
local function EnsureRegion(id)
|
||||
if not WeakAuras.regions[id] or not WeakAuras.regions[id].region then
|
||||
WeakAuras.regions[id] = WeakAuras.regions[id] or {}
|
||||
if not Private.regions[id] or not Private.regions[id].region then
|
||||
Private.regions[id] = Private.regions[id] or {}
|
||||
-- The region doesn't yet exist
|
||||
-- But we must also ensure that our parents exists
|
||||
-- and as an additional wrinkle, for dynamic groups, all children must exist!
|
||||
@@ -2902,20 +2900,20 @@ local function EnsureRegion(id)
|
||||
end
|
||||
for _, toCreateId in ipairs_reverse(aurasToCreate) do
|
||||
local data = WeakAuras.GetData(toCreateId)
|
||||
WeakAuras.SetRegion(data)
|
||||
Private.SetRegion(data)
|
||||
if (data.regionType == "dynamicgroup") then
|
||||
for child in Private.TraverseAllChildren(data) do
|
||||
WeakAuras.SetRegion(child)
|
||||
Private.SetRegion(child)
|
||||
end
|
||||
end
|
||||
end
|
||||
creatingRegions = false
|
||||
for _, dynamicGroupId in ipairs_reverse(dynamicGroups) do
|
||||
local dgRegion = WeakAuras.regions[dynamicGroupId].region
|
||||
local dgRegion = Private.regions[dynamicGroupId].region
|
||||
dgRegion:ReloadControlledChildren()
|
||||
end
|
||||
end
|
||||
return WeakAuras.regions[id] and WeakAuras.regions[id].region
|
||||
return Private.regions[id] and Private.regions[id].region
|
||||
end
|
||||
--- Ensures that a region/clone exists and returns it
|
||||
-- Even if we are asked to only create a clone, we create the default region too.
|
||||
@@ -2932,7 +2930,7 @@ function WeakAuras.GetRegion(id, cloneId)
|
||||
if(cloneId and cloneId ~= "") then
|
||||
return clones[id] and clones[id][cloneId]
|
||||
end
|
||||
return WeakAuras.regions[id] and WeakAuras.regions[id].region
|
||||
return Private.regions[id] and Private.regions[id].region
|
||||
end
|
||||
|
||||
-- Note, does not create a clone!
|
||||
@@ -2941,7 +2939,7 @@ function Private.GetRegionByUID(uid, cloneId)
|
||||
if(cloneId and cloneId ~= "") then
|
||||
return id and clones[id] and clones[id][cloneId];
|
||||
end
|
||||
return id and WeakAuras.regions[id] and WeakAuras.regions[id].region
|
||||
return id and Private.regions[id] and Private.regions[id].region
|
||||
end
|
||||
|
||||
function Private.CollapseAllClones(id, triggernum)
|
||||
@@ -3168,8 +3166,8 @@ function Private.HandleGlowAction(actions, region)
|
||||
if WeakAuras.GetData(frame_name) then
|
||||
Private.EnsureRegion(frame_name)
|
||||
end
|
||||
if WeakAuras.regions[frame_name] then
|
||||
glow_frame = WeakAuras.regions[frame_name].region
|
||||
if Private.regions[frame_name] then
|
||||
glow_frame = Private.regions[frame_name].region
|
||||
should_glow_frame = true
|
||||
end
|
||||
else
|
||||
@@ -3355,6 +3353,7 @@ Private.CanHaveDuration = wrapTriggerSystemFunction("CanHaveDuration", "firstVal
|
||||
Private.CanHaveClones = wrapTriggerSystemFunction("CanHaveClones", "or");
|
||||
Private.CanHaveTooltip = wrapTriggerSystemFunction("CanHaveTooltip", "or");
|
||||
-- This has to be in WeakAuras for now, because GetNameAndIcon can be called from the options
|
||||
-- before the Options has access to Private
|
||||
WeakAuras.GetNameAndIcon = wrapTriggerSystemFunction("GetNameAndIcon", "nameAndIcon");
|
||||
Private.GetTriggerDescription = wrapTriggerSystemFunction("GetTriggerDescription", "call");
|
||||
|
||||
@@ -3543,7 +3542,7 @@ end
|
||||
local FrameTimes = {};
|
||||
function WeakAuras.ProfileFrames(all)
|
||||
UpdateAddOnCPUUsage();
|
||||
for name, frame in pairs(WeakAuras.frames) do
|
||||
for name, frame in pairs(Private.frames) do
|
||||
local FrameTime = GetFrameCPUUsage(frame);
|
||||
FrameTimes[name] = FrameTimes[name] or 0;
|
||||
if(all or FrameTime > FrameTimes[name]) then
|
||||
@@ -3556,7 +3555,7 @@ end
|
||||
local DisplayTimes = {};
|
||||
function WeakAuras.ProfileDisplays(all)
|
||||
UpdateAddOnCPUUsage();
|
||||
for id, regionData in pairs(WeakAuras.regions) do
|
||||
for id, regionData in pairs(Private.regions) do
|
||||
local DisplayTime = GetFrameCPUUsage(regionData.region, true);
|
||||
DisplayTimes[id] = DisplayTimes[id] or 0;
|
||||
if(all or DisplayTime > DisplayTimes[id]) then
|
||||
@@ -3603,8 +3602,8 @@ local function SetFrameLevel(id, frameLevel)
|
||||
if (Private.frameLevels[id] == frameLevel) then
|
||||
return;
|
||||
end
|
||||
if (WeakAuras.regions[id] and WeakAuras.regions[id].region) then
|
||||
Private.ApplyFrameLevel(WeakAuras.regions[id].region, frameLevel)
|
||||
if (Private.regions[id] and Private.regions[id].region) then
|
||||
Private.ApplyFrameLevel(Private.regions[id].region, frameLevel)
|
||||
end
|
||||
if (clones[id]) then
|
||||
for i,v in pairs(clones[id]) do
|
||||
@@ -4093,8 +4092,8 @@ function Private.UpdatedTriggerState(id)
|
||||
for _, clone in pairs(clones[id]) do
|
||||
clone:Collapse()
|
||||
end
|
||||
if WeakAuras.regions[id] then
|
||||
WeakAuras.regions[id].region:Collapse()
|
||||
if Private.regions[id] then
|
||||
Private.regions[id].region:Collapse()
|
||||
end
|
||||
elseif (show and oldShow) then -- Already shown, update regions
|
||||
-- Hide old clones
|
||||
@@ -4104,8 +4103,8 @@ function Private.UpdatedTriggerState(id)
|
||||
end
|
||||
end
|
||||
if (not activeTriggerState[""] or not activeTriggerState[""].show) then
|
||||
if WeakAuras.regions[id] then
|
||||
WeakAuras.regions[id].region:Collapse()
|
||||
if Private.regions[id] then
|
||||
Private.regions[id].region:Collapse()
|
||||
end
|
||||
end
|
||||
-- Show new states
|
||||
@@ -4541,7 +4540,7 @@ end
|
||||
|
||||
local function xPositionNextToOptions()
|
||||
local xOffset;
|
||||
local optionsFrame = WeakAuras.OptionsFrame();
|
||||
local optionsFrame = Private.OptionsFrame();
|
||||
local centerX = (optionsFrame:GetLeft() + optionsFrame:GetRight()) / 2;
|
||||
if (centerX > GetScreenWidth() / 2) then
|
||||
if (optionsFrame:GetLeft() > 400) then
|
||||
@@ -4615,7 +4614,7 @@ local function ensureMouseFrame()
|
||||
mouseFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", db.mousePointerFrame.xOffset, db.mousePointerFrame.yOffset);
|
||||
else
|
||||
-- Fnd a suitable position
|
||||
local optionsFrame = WeakAuras.OptionsFrame();
|
||||
local optionsFrame = Private.OptionsFrame();
|
||||
local yOffset = (optionsFrame:GetTop() + optionsFrame:GetBottom()) / 2;
|
||||
local xOffset = xPositionNextToOptions();
|
||||
-- We use the top right, because the main frame uses the top right as the reference too
|
||||
@@ -4784,7 +4783,7 @@ function Private.ensurePRDFrame()
|
||||
end
|
||||
|
||||
if (not xOffset or not yOffset) then
|
||||
local optionsFrame = WeakAuras.OptionsFrame();
|
||||
local optionsFrame = Private.OptionsFrame();
|
||||
yOffset = optionsFrame:GetBottom() + prdHeight - GetScreenHeight();
|
||||
xOffset = xPositionNextToOptions() + prdWidth / 2 - GetScreenWidth();
|
||||
end
|
||||
@@ -4871,7 +4870,7 @@ local function tryAnchorAgain()
|
||||
if (data and region) then
|
||||
local parent = WeakAurasFrame;
|
||||
if (data.parent and WeakAuras.GetData(data.parent) and Private.EnsureRegion(data.parent)) then
|
||||
parent = WeakAuras.regions[data.parent].region;
|
||||
parent = Private.regions[data.parent].region;
|
||||
end
|
||||
Private.AnchorFrame(data, region, parent);
|
||||
end
|
||||
@@ -4948,8 +4947,8 @@ local function GetAnchorFrame(data, region, parent)
|
||||
if (frame_name == id) then
|
||||
return parent;
|
||||
end
|
||||
if(WeakAuras.regions[frame_name]) then
|
||||
return WeakAuras.regions[frame_name].region;
|
||||
if(Private.regions[frame_name]) then
|
||||
return Private.regions[frame_name].region;
|
||||
end
|
||||
postponeAnchor(id);
|
||||
else
|
||||
@@ -5030,7 +5029,7 @@ function Private.AnchorFrame(data, region, parent, force)
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.FindUnusedId(prefix)
|
||||
function Private.FindUnusedId(prefix)
|
||||
prefix = prefix or "New"
|
||||
local num = 2;
|
||||
local id = prefix
|
||||
@@ -5183,7 +5182,7 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.ParseNameCheck(name)
|
||||
function Private.ExecEnv.ParseNameCheck(name)
|
||||
local matches = {
|
||||
name = {},
|
||||
realm = {},
|
||||
@@ -5264,7 +5263,7 @@ function WeakAuras.ParseNameCheck(name)
|
||||
return matches
|
||||
end
|
||||
|
||||
function WeakAuras.ParseZoneCheck(input)
|
||||
function Private.ExecEnv.ParseZoneCheck(input)
|
||||
if not input then return end
|
||||
|
||||
local matcher = {
|
||||
@@ -5284,7 +5283,7 @@ function WeakAuras.ParseZoneCheck(input)
|
||||
return matcher
|
||||
end
|
||||
|
||||
function WeakAuras.ParseStringCheck(input)
|
||||
function Private.ExecEnv.ParseStringCheck(input)
|
||||
if not input then return end
|
||||
local matcher = {
|
||||
zones = {},
|
||||
|
||||
Reference in New Issue
Block a user