From 395d4480668a890920822f28c4de3a67b0208f9b Mon Sep 17 00:00:00 2001 From: NoM0Re Date: Tue, 7 Jan 2025 16:12:17 +0100 Subject: [PATCH] from retail --- WeakAuras/BuffTrigger2.lua | 8 ++-- WeakAuras/Conditions.lua | 2 +- WeakAuras/GenericTrigger.lua | 42 +++++++++---------- WeakAuras/Profiling.lua | 10 +++++ WeakAuras/RegionTypes/DynamicGroup.lua | 4 +- WeakAuras/RegionTypes/StopMotion.lua | 2 +- WeakAuras/Transmission.lua | 10 ++--- WeakAuras/Types.lua | 4 +- WeakAuras/WeakAuras.lua | 6 +-- WeakAurasOptions/AuthorOptions.lua | 29 ++++++++++--- .../OptionsFrames/OptionsFrame.lua | 2 +- WeakAurasOptions/OptionsFrames/TextEditor.lua | 2 +- WeakAurasOptions/OptionsFrames/Update.lua | 25 ++++++----- WeakAurasOptions/WeakAurasOptions.lua | 6 +-- 14 files changed, 92 insertions(+), 60 deletions(-) diff --git a/WeakAuras/BuffTrigger2.lua b/WeakAuras/BuffTrigger2.lua index 23f18dd..68416b4 100644 --- a/WeakAuras/BuffTrigger2.lua +++ b/WeakAuras/BuffTrigger2.lua @@ -1746,7 +1746,7 @@ local function EventHandler(frame, event, arg1, arg2, ...) elseif event == "UNIT_PET" then local pet = WeakAuras.unitToPetUnit[arg1] if pet then - ScanGroupUnit(time, matchDataChanged, nil, pet) + ScanGroupUnit(time, matchDataChanged, "group", pet) RecheckActiveForUnitType("group", pet, deactivatedTriggerInfos) if not UnitExistsFixed(pet) then tinsert(unitsToRemove, pet) @@ -2472,7 +2472,7 @@ function BuffTrigger.Add(data) useAffected = unit == "group" and trigger.useAffected, isMulti = trigger.unit == "multi", nameChecker = effectiveNameCheck and WeakAuras.ParseNameCheck(trigger.unitName), - includePets = trigger.use_includePets and trigger.includePets, + includePets = trigger.use_includePets and trigger.includePets or nil, npcId = effectiveNpcId } triggerInfos[id] = triggerInfos[id] or {} @@ -3353,7 +3353,7 @@ end function BuffTrigger.GetTriggerDescription(data, triggernum, namestable) local trigger = data.triggers[triggernum].trigger - if trigger.auranames then + if trigger.useName and trigger.auranames then for index, name in pairs(trigger.auranames) do local left = " " if(index == 1) then @@ -3377,7 +3377,7 @@ function BuffTrigger.GetTriggerDescription(data, triggernum, namestable) end end - if trigger.auraspellids then + if trigger.useExactSpellId and trigger.auraspellids then for index, spellId in pairs(trigger.auraspellids) do local left = " " if index == 1 then diff --git a/WeakAuras/Conditions.lua b/WeakAuras/Conditions.lua index 73fd986..0250c26 100644 --- a/WeakAuras/Conditions.lua +++ b/WeakAuras/Conditions.lua @@ -321,7 +321,7 @@ local function CreateTestForCondition(uid, input, allConditionsTemplate, usedSta -- If adding a new condition type, don't forget to adjust the validator in the options code if (cType == "timer" and value) then - recheckCode = " nextTime = state[" .. trigger .. "] and state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " and (state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " -" .. value .. ")\n"; + recheckCode = " nextTime = state[" .. trigger .. "] and state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " and (state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " - " .. value .. ")\n"; recheckCode = recheckCode .. " if (nextTime and (not recheckTime or nextTime < recheckTime) and nextTime >= now) then\n" recheckCode = recheckCode .. " recheckTime = nextTime\n"; recheckCode = recheckCode .. " end\n" diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 482cfaa..798ab56 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -457,7 +457,7 @@ function Private.EndEvent(id, triggernum, force, state) end end -local function RunOverlayFuncs(event, state, id) +local function RunOverlayFuncs(event, state, id, errorHandler) state.additionalProgress = state.additionalProgress or {}; local changed = false; for i, overlayFunc in ipairs(event.overlayFuncs) do @@ -465,7 +465,7 @@ local function RunOverlayFuncs(event, state, id) local additionalProgress = state.additionalProgress[i]; local ok, a, b, c = pcall(overlayFunc, event.trigger, state); if (not ok) then - Private.GetErrorHandlerId(id, L["Overlay %s"]:format(i)) + (errorHandler or Private.GetErrorHandlerId(id, L["Overlay %s"]:format(i)))(a) additionalProgress.min = nil; additionalProgress.max = nil; additionalProgress.direction = nil; @@ -522,7 +522,7 @@ local function callFunctionForActivateEvent(func, trigger, fallback, errorHandle end end -function Private.ActivateEvent(id, triggernum, data, state) +function Private.ActivateEvent(id, triggernum, data, state, errorHandler) local changed = state.changed or false; if (state.show ~= true) then state.show = true; @@ -553,7 +553,7 @@ function Private.ActivateEvent(id, triggernum, data, state) elseif (data.durationFunc) then local ok, arg1, arg2, arg3, inverse = pcall(data.durationFunc, data.trigger); if not ok then - Private.GetErrorHandlerId(id, L["Duration Function"]) + (errorHandler or Private.GetErrorHandlerId(id, L["Duration Function"]))(arg1) arg1 = 0; arg2 = 0; else @@ -619,10 +619,10 @@ function Private.ActivateEvent(id, triggernum, data, state) end end - local name = callFunctionForActivateEvent(data.nameFunc, data.trigger, state.name, Private.GetErrorHandlerId(id, L["Name Function"])) - local icon = callFunctionForActivateEvent(data.iconFunc, data.trigger, state.icon, Private.GetErrorHandlerId(id, L["Icon Function"])) - local texture = callFunctionForActivateEvent(data.textureFunc, data.trigger, state.texture, Private.GetErrorHandlerId(id, L["Texture Function"])) - local stacks = callFunctionForActivateEvent(data.stacksFunc, data.trigger, state.stacks, Private.GetErrorHandlerId(id, L["Stacks Function"])) + local name = callFunctionForActivateEvent(data.nameFunc, data.trigger, state.name, errorHandler or Private.GetErrorHandlerId(id, L["Name Function"])) + local icon = callFunctionForActivateEvent(data.iconFunc, data.trigger, state.icon, errorHandler or Private.GetErrorHandlerId(id, L["Icon Function"])) + local texture = callFunctionForActivateEvent(data.textureFunc, data.trigger, state.texture, errorHandler or Private.GetErrorHandlerId(id, L["Texture Function"])) + local stacks = callFunctionForActivateEvent(data.stacksFunc, data.trigger, state.stacks, errorHandler or Private.GetErrorHandlerId(id, L["Stacks Function"])) if (state.name ~= name) then state.name = name; @@ -642,7 +642,7 @@ function Private.ActivateEvent(id, triggernum, data, state) end if (data.overlayFuncs) then - RunOverlayFuncs(data, state, id); + RunOverlayFuncs(data, state, id, errorHandler); else state.additionalProgress = nil; end @@ -735,7 +735,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2 if not ok then errorHandler(returnValue) elseif (ok and returnValue) or optionsEvent then - if(Private.ActivateEvent(id, triggernum, data, state)) then + if(Private.ActivateEvent(id, triggernum, data, state, (optionsEvent and data.ignoreOptionsEventErrors) and ignoreErrorHandler or nil)) then updateTriggerState = true; end else @@ -748,7 +748,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2 elseif (ok and returnValue) or optionsEvent then allStates[""] = allStates[""] or {}; local state = allStates[""]; - if(Private.ActivateEvent(id, triggernum, data, state)) then + if(Private.ActivateEvent(id, triggernum, data, state, (optionsEvent and data.ignoreOptionsEventErrors) and ignoreErrorHandler or nil)) then updateTriggerState = true; end else @@ -756,6 +756,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2 end end if (untriggerCheck and not optionsEvent) then + errorHandler = (optionsEvent and data.ignoreOptionsEventErrors) and ignoreErrorHandler or Private.GetErrorHandlerId(id, L["Untrigger %s"]:format(triggernum)) if (data.statesParameter == "all") then if data.untriggerFunc then local ok, returnValue = pcall(data.untriggerFunc, allStates, event, arg1, arg2, ...); @@ -3271,6 +3272,7 @@ do if not(tenchFrame) then tenchFrame = CreateFrame("Frame"); tenchFrame:RegisterEvent("UNIT_INVENTORY_CHANGED"); + tenchFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); tenchTip = WeakAuras.GetHiddenTooltip(); @@ -3323,11 +3325,9 @@ do Private.StopProfileSystem("generictrigger"); end - tenchFrame:SetScript("OnEvent", function(self, event, arg1) + tenchFrame:SetScript("OnEvent", function() Private.StartProfileSystem("generictrigger"); - if (event == "UNIT_INVENTORY_CHANGED" and arg1 == "player") then - timer:ScheduleTimer(tenchUpdate, 0.1); - end + timer:ScheduleTimer(tenchUpdate, 0.1); Private.StopProfileSystem("generictrigger"); end); @@ -4094,9 +4094,9 @@ function GenericTrigger.CreateFallbackState(data, triggernum, state) local event = events[data.id][triggernum]; Private.ActivateAuraEnvironment(data.id, "", state); - local firstTrigger = data.triggers[1].trigger + local trigger = data.triggers[triggernum].trigger if (event.nameFunc) then - local ok, name = pcall(event.nameFunc, firstTrigger); + local ok, name = pcall(event.nameFunc, trigger); if not ok then Private.GetErrorHandlerUid(data.uid, L["Name Function (fallback state)"]) state.name = nil @@ -4105,7 +4105,7 @@ function GenericTrigger.CreateFallbackState(data, triggernum, state) end end if (event.iconFunc) then - local ok, icon = pcall(event.iconFunc, firstTrigger); + local ok, icon = pcall(event.iconFunc, trigger); if not ok then Private.GetErrorHandlerUid(data.uid, L["Icon Function (fallback state)"]) state.icon = nil @@ -4115,7 +4115,7 @@ function GenericTrigger.CreateFallbackState(data, triggernum, state) end if (event.textureFunc ) then - local ok, texture = pcall(event.textureFunc, firstTrigger); + local ok, texture = pcall(event.textureFunc, trigger); if not ok then Private.GetErrorHandlerUid(data.uid, L["Texture Function (fallback state)"]) state.texture = nil @@ -4125,7 +4125,7 @@ function GenericTrigger.CreateFallbackState(data, triggernum, state) end if (event.stacksFunc) then - local ok, stacks = pcall(event.stacksFunc, firstTrigger); + local ok, stacks = pcall(event.stacksFunc, trigger); if not ok then Private.GetErrorHandlerUid(data.uid, L["Stacks Function (fallback state)"]) state.stacks = nil @@ -4135,7 +4135,7 @@ function GenericTrigger.CreateFallbackState(data, triggernum, state) end if (event.durationFunc) then - local ok, arg1, arg2, arg3, inverse = pcall(event.durationFunc, firstTrigger); + local ok, arg1, arg2, arg3, inverse = pcall(event.durationFunc, trigger); if not ok then Private.GetErrorHandlerUid(data.uid, L["Duration Function (fallback state)"]) state.progressType = "timed"; diff --git a/WeakAuras/Profiling.lua b/WeakAuras/Profiling.lua index c924eb7..224f46a 100644 --- a/WeakAuras/Profiling.lua +++ b/WeakAuras/Profiling.lua @@ -4,6 +4,7 @@ local AddonName, Private = ... local WeakAuras = WeakAuras local L = WeakAuras.L local prettyPrint = WeakAuras.prettyPrint +-- local LGF = LibStub("LibGetFrame-1.0") local profileData = {} profileData.systems = {} @@ -335,6 +336,7 @@ function WeakAuras.StartProfile(startType) Private.StopProfileSystem = StopProfileSystem Private.StopProfileAura = StopProfileAura Private.StopProfileUID = StopProfileUID + -- LGF.StartProfile() end local function doNothing() @@ -357,6 +359,7 @@ function WeakAuras.StopProfile() Private.StopProfileSystem = doNothing Private.StopProfileAura = doNothing Private.StopProfileUID = doNothing + -- LGF.StopProfile() currentProfileState = nil RealTimeProfilingWindow:UnregisterAllEvents() @@ -466,6 +469,13 @@ function WeakAuras.PrintProfile() PrintOneProfile(popup, k, profileData.systems[k], profileData.systems.wa.elapsed) end end + + -- popup:AddText("") + -- popup:AddText("|cff9900ffLibGetFrame:|r") + -- for id, map in pairs(LGF.GetProfileData()) do + -- PrintOneProfile(popup, id, map) + -- end + popup:Show() end diff --git a/WeakAuras/RegionTypes/DynamicGroup.lua b/WeakAuras/RegionTypes/DynamicGroup.lua index 3f6c294..bb2ed19 100644 --- a/WeakAuras/RegionTypes/DynamicGroup.lua +++ b/WeakAuras/RegionTypes/DynamicGroup.lua @@ -770,7 +770,7 @@ local growers = { local ok, ret = pcall(growFunc, newPositions, activeRegions) Private.ActivateAuraEnvironment() if not ok then - Private.GetErrorHandlerId(data.id, L["Custom Sort"]) + Private.GetErrorHandlerId(data.id, L["Custom Grow"]) wipe(newPositions) end end @@ -833,7 +833,7 @@ local function modify(parent, region, data) end function region:Resume() - -- Allows group to reindex and reposition. + -- Allows group to re-index and reposition. -- TriggersSortUpdatedChildren and PositionChildren to happen if self.suspended > 0 then self.suspended = self.suspended - 1 diff --git a/WeakAuras/RegionTypes/StopMotion.lua b/WeakAuras/RegionTypes/StopMotion.lua index 028a818..aa51c66 100644 --- a/WeakAuras/RegionTypes/StopMotion.lua +++ b/WeakAuras/RegionTypes/StopMotion.lua @@ -98,7 +98,7 @@ local function create(parent) frame.background = background; background:SetAllPoints(frame); - local foreground = frame:CreateTexture(nil, "ART"); + local foreground = frame:CreateTexture(nil, "ARTWORK"); frame.foreground = foreground; foreground:SetAllPoints(frame); diff --git a/WeakAuras/Transmission.lua b/WeakAuras/Transmission.lua index 0981c98..5c84bec 100644 --- a/WeakAuras/Transmission.lua +++ b/WeakAuras/Transmission.lua @@ -434,14 +434,14 @@ end local delayedImport = CreateFrame("FRAME") -local function ImportNow(data, children, target, sender) +local function ImportNow(data, children, target, sender, callbackFunc) if InCombatLockdown() then WeakAuras.prettyPrint(L["Importing will start after combat ends."]) delayedImport:RegisterEvent("PLAYER_REGEN_ENABLED") delayedImport:SetScript("OnEvent", function() delayedImport:UnregisterEvent("PLAYER_REGEN_ENABLED") - ImportNow(data, children, target, sender) + ImportNow(data, children, target, sender, callbackFunc) end) return end @@ -450,11 +450,11 @@ local function ImportNow(data, children, target, sender) if not WeakAuras.IsOptionsOpen() then WeakAuras.OpenOptions() end - Private.OpenUpdate(data, children, target, sender) + Private.OpenUpdate(data, children, target, sender, callbackFunc) end end -function WeakAuras.Import(inData, target) +function WeakAuras.Import(inData, target, callbackFunc) local data, children, version if type(inData) == 'string' then -- encoded data @@ -508,7 +508,7 @@ function WeakAuras.Import(inData, target) end tooltipLoading = nil; - return ImportNow(data, children, target) + return ImportNow(data, children, target, nil, callbackFunc) end local function crossRealmSendCommMessage(prefix, text, target, queueName, callbackFn, callbackArg) diff --git a/WeakAuras/Types.lua b/WeakAuras/Types.lua index 2eba5bd..083f9a5 100644 --- a/WeakAuras/Types.lua +++ b/WeakAuras/Types.lua @@ -1691,7 +1691,7 @@ Private.texture_types["PowerAuras Separated"] = { [PowerAurasPath.."Aura104"] = "Shield Center", [PowerAurasPath.."Aura105"] = "Shield Full", [PowerAurasPath.."Aura106"] = "Shield Top Right", - [PowerAurasPath.."Aura107"] = "Shiled Top Left", + [PowerAurasPath.."Aura107"] = "Shield Top Left", [PowerAurasPath.."Aura108"] = "Shield Bottom Right", [PowerAurasPath.."Aura109"] = "Shield Bottom Left", [PowerAurasPath.."Aura121"] = "Vine Top Right Leaf", @@ -2330,7 +2330,7 @@ Private.bool_types = { Private.update_categories = { { name = "anchor", - -- Note, these are special cased for child auras and considered arrangment + -- Note, these are special cased for child auras and considered arrangement fields = { "xOffset", "yOffset", diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 49c1452..a60f7b6 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -31,7 +31,7 @@ LibStub("AceTimer-3.0"):Embed(WeakAurasTimers) Private.watched_trigger_events = {} -- The worlds simplest callback system. --- That supports 1:N, but no deregistration and breaks if registrating in a callback +-- That supports 1:N, but no de-registration and breaks if registering in a callback Private.callbacks = {} Private.callbacks.events = {} @@ -882,7 +882,7 @@ local function AddLegacyCompanionData() end function Private.PostAddCompanion() - -- add data from older verion of companion addons + -- add data from older version of companion addons AddLegacyCompanionData() -- nag if updates local count = Private.CountWagoUpdates() @@ -5418,7 +5418,7 @@ do return coroutine.wrap(TraverseLeafs), data end - -- The root if it is a non-group, otherwise non-group childrens + -- The root if it is a non-group, otherwise non-group children function Private.TraverseLeafsOrAura(data) return coroutine.wrap(TraverseLeafsOrAura), data end diff --git a/WeakAurasOptions/AuthorOptions.lua b/WeakAurasOptions/AuthorOptions.lua index 42c4018..cc340f7 100644 --- a/WeakAurasOptions/AuthorOptions.lua +++ b/WeakAurasOptions/AuthorOptions.lua @@ -677,8 +677,18 @@ typeControlAdders = { bigStep = option.bigStep min = option.min max = option.max - if max and min then - max = math.max(min, max) + local effectiveMin = softMin or min or 0 + local effectiveMax = softMax or max or 100 + if (effectiveMin > effectiveMax) then + -- This will cause a error inside the slider + -- Fix up either softMax or max, depending on which one is the effective one + if softMax then + softMax = effectiveMin + elseif max then + max = effectiveMin + else + softMax = effectiveMin + end end step = option.step args[prefix .. "default"] = { @@ -967,7 +977,6 @@ typeControlAdders = { end, multiselect = function(options, args, data, order, prefix, i) local option = options[i] - args[prefix .. "width"] = nil local values = getValues(option) local defaultValues = {} for i, v in ipairs(values) do @@ -2234,8 +2243,18 @@ local function addUserModeOption(options, args, data, order, prefix, i) userOption.bigStep = option.bigStep userOption.min = option.min userOption.max = option.max - if userOption.max and userOption.min then - userOption.max = max(userOption.min, userOption.max) + local effectiveMin = userOption.softMin or userOption.min or 0 + local effectiveMax = userOption.softMax or userOption.max or 100 + if (effectiveMin > effectiveMax) then + -- This will cause a error inside the slider + -- Fix up either softMax or max, depending on which one is the effective one + if userOption.softMax then + userOption.softMax = effectiveMin + elseif userOption.max then + userOption.max = effectiveMin + else + userOption.softMax = effectiveMin + end end userOption.step = option.step elseif optionType == "color" then diff --git a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua index e76c8fc..936c83b 100644 --- a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua +++ b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua @@ -1184,7 +1184,7 @@ function OptionsPrivate.CreateFrame() tinsert(regionTypesSorted, regionType) end - -- Sort group + dynamic group first, then the others alphabeticaly + -- Sort group + dynamic group first, then the others alphabetically table.sort(regionTypesSorted, function(a, b) if (a == "group") then return true diff --git a/WeakAurasOptions/OptionsFrames/TextEditor.lua b/WeakAurasOptions/OptionsFrames/TextEditor.lua index cf84a36..884d554 100644 --- a/WeakAurasOptions/OptionsFrames/TextEditor.lua +++ b/WeakAurasOptions/OptionsFrames/TextEditor.lua @@ -624,7 +624,7 @@ local function ConstructTextEditor(frame) editor.editBox:SetScript( "OnEscapePressed", function() - group:CancelClose() + -- catch it so that escape doesn't default to losing focus (after which another escape would close config) end ) self.oldOnTextChanged = editor.editBox:GetScript("OnTextChanged") diff --git a/WeakAurasOptions/OptionsFrames/Update.lua b/WeakAurasOptions/OptionsFrames/Update.lua index 30090d1..ef73763 100644 --- a/WeakAurasOptions/OptionsFrames/Update.lua +++ b/WeakAurasOptions/OptionsFrames/Update.lua @@ -12,7 +12,7 @@ local function notEmptyString(str) end local function addCode(codes, text, code, ...) - -- The 4th paramter is a "check" if the code is active + -- The 4th parameter is a "check" if the code is active -- The following line let's distinguish between addCode(a, b, c, nil) and addCode(a, b, c) -- If the 4th parameter is nil, then we want to return if (select("#", ...) > 0) then @@ -182,7 +182,7 @@ local function recurseUpdate(data, chunk) end end -local ignoredForDiffChecking -- Needs to be created lazyly +local ignoredForDiffChecking -- Needs to be created lazily local function RecurseDiff(ours, theirs) local diff, seen, same = {}, {}, true for key, ourVal in pairs(ours) do @@ -315,7 +315,7 @@ local function BuildUidMap(data, children, type) idToUid[data.id] = data.uid for i, child in ipairs(children) do if idToUid[child.id] then - error("Diplicated id in import data") + error("Duplicate id in import data: "..child.id) end idToUid[child.id] = child.uid end @@ -381,7 +381,7 @@ local function BuildUidMap(data, children, type) self.idToUid[data.id] = data.uid self.totalCount = self.totalCount + 1 - -- clean up children/sortHybird + -- clean up children/sortHybrid -- The Update code first inserts children before it inserts us -- But not every child might be inserted, since empty groups aren't inserted -- so clean that up here @@ -1242,7 +1242,7 @@ local function AddAuraList(container, uidMap, list, expandText) end local methods = { - Open = function(self, data, children, target, sender) + Open = function(self, data, children, target, sender, callbackFunc) if(self.optionsWindow.window == "importexport") then self.optionsWindow.importexport:Close(); elseif(self.optionsWindow.window == "texture") then @@ -1264,6 +1264,7 @@ local methods = { self.userChoices = { } + self.callbackFunc = callbackFunc self:ReleaseChildren() self:AddBasicInformationWidgets(data, sender) @@ -1513,7 +1514,7 @@ local methods = { local onePhaseProgress = matchInfo.oldUidMap:GetTotalCount() + matchInfo.newUidMap:GetTotalCount() local IncProgress = function() self:IncProgress() end - -- The progress is more for appereance than anything resembling real calculation + -- The progress is more for appearances than anything resembling real calculation -- The estimate for the total work is wonky, as is how the code compensates for that -- But then again, lying progress bar is a industry standard pratice self:InitializeProgress(onePhaseProgress * 26) @@ -1543,7 +1544,7 @@ local methods = { local GetPhase1Data -- Getting the right data is a bit tricky, and depends on the mode local GetPhase2Data if userChoices.activeCategories.arrangement then - -- new arragement + -- new arrangement structureUidMap = matchInfo.newUidMap if not userChoices.activeCategories.oldchildren then -- Keep old children @@ -1641,8 +1642,7 @@ local methods = { self.closeButton:Enable() OptionsPrivate.Private.callbacks:Fire("Import") - self:Close() - + self:Close(true, pendingPickData.id) if pendingPickData then OptionsPrivate.ClearPicks() @@ -1942,9 +1942,12 @@ local methods = { self.progress = self.total self.progressBar:SetProgress(self.progress, self.total) end, - Close = function(self) + Close = function(self, success, id) self.optionsWindow.window = "default"; self.optionsWindow:UpdateFrameVisible() + if self.callbackFunc then + self.callbackFunc(success, id) + end end, AddBasicInformationWidgets = function(self, data, sender) local title = AceGUI:Create("Label") @@ -2025,7 +2028,7 @@ local function ConstructUpdateFrame(frame) importButton:SetText(L["Import"]) local closeButton = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); - closeButton:SetScript("OnClick", function() group:Close() end); + closeButton:SetScript("OnClick", function() group:Close(false) end); closeButton:SetPoint("BOTTOMRIGHT", -20, -24); closeButton:SetFrameLevel(closeButton:GetFrameLevel() + 1) closeButton:SetHeight(20); diff --git a/WeakAurasOptions/WeakAurasOptions.lua b/WeakAurasOptions/WeakAurasOptions.lua index 15bf849..ab35b25 100644 --- a/WeakAurasOptions/WeakAurasOptions.lua +++ b/WeakAurasOptions/WeakAurasOptions.lua @@ -896,8 +896,8 @@ function OptionsPrivate.OpenDebugLog(text) frame.debugLog:Open(text) end -function OptionsPrivate.OpenUpdate(data, children, target, sender) - return frame.update:Open(data, children, target, sender) +function OptionsPrivate.OpenUpdate(data, children, target, sender, callbackFunc) + return frame.update:Open(data, children, target, sender, callbackFunc) end function OptionsPrivate.ConvertDisplay(data, newType) @@ -1931,7 +1931,7 @@ function OptionsPrivate.AddTextFormatOption(input, withHeader, get, addOption, h headerOption = { type = "execute", control = "WeakAurasExpandSmall", - name = L["|cFFffcc00Format Options|r"], + name = L["|cffffcc00Format Options|r"], width = WeakAuras.doubleWidth, func = function(info, button) setHidden(not hidden())