diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 28266d5..e0291f7 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -111,7 +111,6 @@ do currentErrorHandlerContext = context return waErrorHandler end - function Private.GetErrorHandlerUid(uid, context) currentErrorHandlerUid = uid currentErrorHandlerId = nil @@ -164,14 +163,13 @@ end SLASH_WEAKAURAS1, SLASH_WEAKAURAS2 = "/weakauras", "/wa"; function SlashCmdList.WEAKAURAS(input) - local args, msg = {}, nil for v in string.gmatch(input, "%S+") do if not msg then - msg = v + msg = v:lower() else - insert(args, v) + insert(args, v:lower()) end end @@ -1150,7 +1148,7 @@ local loadedFrame = CreateFrame("Frame"); Private.frames["Addon Initialization Handler"] = loadedFrame; loadedFrame:RegisterEvent("ADDON_LOADED"); loadedFrame:RegisterEvent("PLAYER_LOGIN"); -loadedFrame:RegisterEvent("PLAYER_LOGOUT"); +loadedFrame:RegisterEvent("PLAYER_LOGOUT") loadedFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); loadedFrame:SetScript("OnEvent", function(self, event, addon) if(event == "ADDON_LOADED") then @@ -2950,15 +2948,19 @@ local function EnsureClone(id, cloneId) end local creatingRegions = false + function Private.CreatingRegions() return creatingRegions end + --- Ensures that a region exists local function EnsureRegion(id) 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 + -- So we go up the list of parents and collect auras that must be created -- If we find a parent already exists, we can stop @@ -3676,7 +3678,7 @@ function Private.HideTooltip() GameTooltip:SetPoint("RIGHT", UIParent, "LEFT"); GameTooltip:SetClampedToScreen(true) - GameTooltip:Hide(); + GameTooltip:Hide() end do diff --git a/WeakAurasOptions/OptionsFrames/FrameChooser.lua b/WeakAurasOptions/OptionsFrames/FrameChooser.lua index f9037ad..f81dfc9 100644 --- a/WeakAurasOptions/OptionsFrames/FrameChooser.lua +++ b/WeakAurasOptions/OptionsFrames/FrameChooser.lua @@ -1,5 +1,8 @@ if not WeakAuras.IsLibsOK() then return end -local AddonName, OptionsPrivate = ... +---@type string +local AddonName = ... +---@class OptionsPrivate +local OptionsPrivate = select(2, ...) -- Lua APIs local pairs = pairs @@ -8,6 +11,7 @@ local pairs = pairs local CreateFrame, IsMouseButtonDown, SetCursor, GetMouseFocus, MouseIsOver, ResetCursor = CreateFrame, IsMouseButtonDown, SetCursor, GetMouseFocus, MouseIsOver, ResetCursor +---@class WeakAuras local WeakAuras = WeakAuras local L = WeakAuras.L @@ -37,7 +41,7 @@ function OptionsPrivate.StartFrameChooser(data, path) local frame = OptionsPrivate.Private.OptionsFrame(); if not(frameChooserFrame) then frameChooserFrame = CreateFrame("Frame"); - frameChooserBox = CreateFrame("Frame", nil, frameChooserFrame); + frameChooserBox = CreateFrame("Frame", nil, frameChooserFrame, "BackdropTemplate"); frameChooserBox:SetFrameStrata("TOOLTIP"); frameChooserBox:SetBackdrop({ edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", @@ -59,7 +63,13 @@ function OptionsPrivate.StartFrameChooser(data, path) else SetCursor("CAST_CURSOR"); - local focus = GetMouseFocus(); + local focus + if GetMouseFocus then + focus = GetMouseFocus() + elseif GetMouseFoci then + local foci = GetMouseFoci() + focus = foci[1] or nil + end local focusName; if(focus) then diff --git a/WeakAurasOptions/OptionsFrames/IconPicker.lua b/WeakAurasOptions/OptionsFrames/IconPicker.lua index 23aeed1..d30a6ea 100644 --- a/WeakAurasOptions/OptionsFrames/IconPicker.lua +++ b/WeakAurasOptions/OptionsFrames/IconPicker.lua @@ -61,6 +61,8 @@ local function ConstructIconPicker(frame) subname = subname:lower(); end + + local num = 0; if(subname and subname ~= "") then for name, icons in pairs(spellCache.Get()) do diff --git a/WeakAurasOptions/OptionsFrames/ImportExport.lua b/WeakAurasOptions/OptionsFrames/ImportExport.lua index 5ba1329..767c51d 100644 --- a/WeakAurasOptions/OptionsFrames/ImportExport.lua +++ b/WeakAurasOptions/OptionsFrames/ImportExport.lua @@ -61,10 +61,16 @@ local function ConstructImportExport(frame) elseif(mode == "table") then displayStr = OptionsPrivate.Private.DataToString(id, true); end - input.editBox:SetMaxBytes(nil); - input.editBox:SetScript("OnEscapePressed", function() group:Close(); end); - input.editBox:SetScript("OnTextChanged", function() input:SetText(displayStr); input.editBox:HighlightText(); end); - input.editBox:SetScript("OnMouseUp", function() input.editBox:HighlightText(); end); + input.editBox:SetMaxBytes(nil); -- Dragonflight doesn't accept nil + input.editBox:SetScript("OnEscapePressed", function() + group:Close(); + end); + input.editBox:SetScript("OnTextChanged", function() + input:SetText(displayStr); input.editBox:HighlightText(); + end); + input.editBox:SetScript("OnMouseUp", function() + input.editBox:HighlightText(); + end); input:SetLabel(id.." - "..#displayStr); input.button:Hide(); input:SetText(displayStr); diff --git a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua index 65c8807..9acd5c8 100644 --- a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua +++ b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua @@ -554,7 +554,6 @@ function OptionsPrivate.CreateFrame() container.content:SetPoint("TOPLEFT", 0, -28) container.content:SetPoint("BOTTOMRIGHT", 0, 0) frame.container = container - frame.moversizer, frame.mover = OptionsPrivate.MoverSizer(frame) -- filter line diff --git a/WeakAurasOptions/OptionsFrames/Update.lua b/WeakAurasOptions/OptionsFrames/Update.lua index 2963afa..ff9b9f4 100644 --- a/WeakAurasOptions/OptionsFrames/Update.lua +++ b/WeakAurasOptions/OptionsFrames/Update.lua @@ -342,16 +342,17 @@ local function BuildUidMap(data, children, type) -- Handle anchorFrameFrame if data.anchorFrameType == "SELECTFRAME" - and data.anchorFrameFrame - and data.anchorFrameFrame:sub(1, 10) == "WeakAuras:" - then - local target = data.anchorFrameFrame:sub(11) - if idToUid[target] then - uidMap.map[data.uid].anchorFrameFrame = idToUid[target] - end + and data.anchorFrameFrame + and data.anchorFrameFrame:sub(1, 10) == "WeakAuras:" + then + local target = data.anchorFrameFrame:sub(11) + if idToUid[target] then + uidMap.map[data.uid].anchorFrameFrame = idToUid[target] end end + end + local function handleSortHybridTable(data) if data.regionType == "dynamicgroup" then local sortHybridTableByUid = {} @@ -1564,7 +1565,7 @@ local methods = { local flavorWarning = AceGUI:Create("Label") flavorWarning:SetFontObject(GameFontHighlight) flavorWarning:SetFullWidth(true) - flavorWarning:SetText(L["This aura was created with a different version (%s) of World of Warcraft.\nIt might not work correctly!"]:format(OptionsPrivate.Private.TocToExpansion[importBuild])) + flavorWarning:SetText(L["This aura was created with a different version (%s) of World of Warcraft.\nIt might not work correctly!"]:format(OptionsPrivate.Private.TocToExpansion[importBuild] or L["Unknown"])) flavorWarning:SetColor(1, 0, 0) self:AddChild(flavorWarning) end @@ -1939,12 +1940,14 @@ local methods = { error("Can't remove root") end - if (uidMap:GetGroupRegionType(uid) and removeGroups) - or (uidMap:GetGroupRegionType(uid) == nil and removeAuras) - then + if (uidMap:GetGroupRegionType(uid) and removeGroups) + or (uidMap:GetGroupRegionType(uid) == nil and removeAuras) + then + for index, childUid in ipairs_reverse(children) do uidMap:UnsetParent(childUid) end + local data = OptionsPrivate.Private.GetDataByUID(uid) if not data then error("Can't find data") @@ -1983,9 +1986,11 @@ local methods = { if (uidMap:GetGroupRegionType(uid) and removeGroups) or (uidMap:GetGroupRegionType(uid) == nil and removeAuras) then + for index, childUid in ipairs_reverse(children) do uidMap:UnsetParent(childUid) end + uidMap:Remove(uid) self:IncProgress() coroutine.yield()