diff --git a/WeakAuras/Animations.lua b/WeakAuras/Animations.lua index 11bdc74..871c59a 100644 --- a/WeakAuras/Animations.lua +++ b/WeakAuras/Animations.lua @@ -322,7 +322,7 @@ function Private.Animate(namespace, uid, type, anim, region, inverse, onFinished if(namespace == "display" and type == "main" and not onFinished and not anim.duration_type == "relative") then local data = Private.GetDataByUID(uid); if(data and data.parent) then - local parentRegion = WeakAuras.regions[data.parent].region; + local parentRegion = WeakAuras.GetRegion(data.parent) if(parentRegion and parentRegion.controlledRegions) then for index, regionData in pairs(parentRegion.controlledRegions) do local childRegion = regionData.region; diff --git a/WeakAuras/AuraEnvironment.lua b/WeakAuras/AuraEnvironment.lua index 23919f0..4efb70e 100644 --- a/WeakAuras/AuraEnvironment.lua +++ b/WeakAuras/AuraEnvironment.lua @@ -192,8 +192,8 @@ function Private.ActivateAuraEnvironmentForRegion(region, onlyConfig) end function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig) - local data = WeakAuras.GetData(id) - local region = WeakAuras.GetRegion(id, cloneId) + local data = id and WeakAuras.GetData(id) + local region = id and Private.EnsureRegion(id, cloneId) if not data then -- Pop the last aura_env from the stack, and update current_aura_env appropriately. tremove(aura_env_stack) diff --git a/WeakAuras/AuraWarnings.lua b/WeakAuras/AuraWarnings.lua index 12aec28..f58185c 100644 --- a/WeakAuras/AuraWarnings.lua +++ b/WeakAuras/AuraWarnings.lua @@ -50,10 +50,10 @@ local severityLevel = { } local icons = { - info = [[Interface/friendsframe/informationicon.blp]], - sound = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\voicechat", - warning = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\alert", - error = [[Interface/DialogFrame/UI-Dialog-Icon-AlertNew]] + info = { path = [[Interface\friendsframe\informationicon]] }, + sound = { path = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\ChatFrame", texCoords = {0.757812, 0.871094, 0.0078125, 0.234375} }, + warning = { path = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\ServicesAtlas", texCoords = {0.000976562, 0.0419922, 0.961914, 0.998047} }, + error = { path = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\HelpIcon-Bug" }, } local titles = { @@ -72,7 +72,13 @@ local function AddMessages(result, messages, icon, mixedSeverity) result = result .. "\n\n" end if mixedSeverity then - result = result .. "|T" .. icon .. ":12:12:0:0:64:64:4:60:4:60|t" + local iconPath = icon.path + local texCoords = icon.texCoords + if texCoords then + result = result .. string.format("|T%s:12:12:0:0:64:64:%d:%d:%d:%d|t", iconPath, texCoords[1] * 64, texCoords[2] * 64, texCoords[3] * 64, texCoords[4] * 64) + else + result = result .. string.format("|T%s:12:12:0:0:64:64:4:60:4:60|t", iconPath) + end end result = result .. message end @@ -113,6 +119,48 @@ local function FormatWarnings(uid) return icons[maxSeverity], titles[maxSeverity], result end +local function GetAllWarnings(uid) + local results = {} + local thisWarnings + local data = Private.GetDataByUID(uid) + if data.regionType == "group" or data.regionType == "dynamicgroup" then + thisWarnings = {} + for child in Private.TraverseLeafs(data) do + local childWarnings = warnings[child.uid] + if childWarnings then + for key, warning in pairs(childWarnings) do + if not thisWarnings[key] then + thisWarnings[key] = { + severity = warning.severity, + message = warning.message, + auraId = child.id + } + end + end + end + end + else + thisWarnings = CopyTable(warnings[uid]) + local auraId = Private.UIDtoID(uid) + for key in pairs(thisWarnings) do + thisWarnings[key].auraId = auraId + end + end + -- Order them by severity, keeping just one per severity + for key, warning in pairs(thisWarnings) do + results[warning.severity] = { + icon = icons[warning.severity], + prio = 5 + severityLevel[warning.severity], + title = titles[warning.severity] or warning.severity, + message = warning.message, + auraId = warning.auraId, + key = key + } + end + return results +end + Private.AuraWarnings = {} Private.AuraWarnings.UpdateWarning = UpdateWarning Private.AuraWarnings.FormatWarnings = FormatWarnings +Private.AuraWarnings.GetAllWarnings = GetAllWarnings diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 25b95da..dec3a4f 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -100,7 +100,7 @@ end function WeakAuras.split(input) input = input or ""; local ret = {}; - local split, element = true; + local split, element = nil, nil; split = input:find("[,%s]"); while(split) do element, input = input:sub(1, split-1), input:sub(split+1); @@ -115,6 +115,36 @@ function WeakAuras.split(input) return ret; end +local function findFirstOf(input, words, start, plain) + local startPos, endPos + for _, w in ipairs(words) do + local s, e = input:find(w, start, plain) + if s and (not startPos or startPos > s) then + startPos, endPos = s, e + end + end + return startPos, endPos +end + +function Private.splitAtOr(input) + input = input or "" + local ret = {} + local splitStart, splitEnd, element = nil, nil, nil + local separators = { "|", " or "} + splitStart, splitEnd = findFirstOf(input, separators, 1, true); + while(splitStart) do + element, input = input:sub(1, splitStart -1 ), input:sub(splitEnd + 1) + if(element ~= "") then + tinsert(ret, element) + end + splitStart, splitEnd = findFirstOf(input, separators, 1, true); + end + if(input ~= "") then + tinsert(ret, input) + end + return ret; +end + function TestForTriState(trigger, arg) local name = arg.name; local test; @@ -1315,6 +1345,8 @@ function GenericTrigger.Add(data, region) events[id] = nil; watched_trigger_events[id] = nil + local warnAboutCLEUEvents = false + for triggernum, triggerData in ipairs(data.triggers) do local trigger, untrigger = triggerData.trigger, triggerData.untrigger local triggerType; @@ -1474,6 +1506,9 @@ function GenericTrigger.Add(data, region) local isCLEU = false local isUnitEvent = false local isTrigger = false + if event == "CLEU" or event == "COMBAT_LOG_EVENT_UNFILTERED" then + warnAboutCLEUEvents = true + end for i in event:gmatch("[^:]+") do if not trueEvent then trueEvent = string.upper(i) @@ -1574,7 +1609,13 @@ function GenericTrigger.Add(data, region) end end - + if warnAboutCLEUEvents then + Private.AuraWarnings.UpdateWarning(data.uid, "spamy_event_warning", "warning", + L["COMBAT_LOG_EVENT_UNFILTERED with no filter can trigger frame drops in raid environment. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Deprecated-CLEU"], + true) + else + Private.AuraWarnings.UpdateWarning(data.uid, "spamy_event_warning") + end end do diff --git a/WeakAuras/Init.lua b/WeakAuras/Init.lua index a5e7d7f..bbceab9 100644 --- a/WeakAuras/Init.lua +++ b/WeakAuras/Init.lua @@ -8,7 +8,7 @@ WeakAuras.halfWidth = WeakAuras.normalWidth / 2 WeakAuras.doubleWidth = WeakAuras.normalWidth * 2 local versionStringFromToc = GetAddOnMetadata("WeakAuras", "Version") -local versionString = "4.1.1" +local versionString = "4.1.2" local buildTime = "20240701180000" local isAwesomeEnabled = C_NamePlate and C_NamePlate.GetNamePlateForUnit or false diff --git a/WeakAuras/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua b/WeakAuras/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua index 49b483c..9e87fc2 100644 --- a/WeakAuras/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua +++ b/WeakAuras/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua @@ -213,7 +213,7 @@ local function Constructor() local frame = CreateFrame("Frame", nil, UIParent) frame:Hide() - local editbox = CreateFrame("EditBox", "AceGUI-3.0EditBox"..num, frame, "InputBoxTemplate") + local editbox = CreateFrame("EditBox", "AceGUI-3.0EditBox"..num, frame, "WA_InputBoxTemplate") editbox:SetAutoFocus(false) editbox:SetFontObject(ChatFontNormal) editbox:SetScript("OnEnter", Control_OnEnter) diff --git a/WeakAuras/Media/Textures/ChatFrame.blp b/WeakAuras/Media/Textures/ChatFrame.blp new file mode 100644 index 0000000..3965108 Binary files /dev/null and b/WeakAuras/Media/Textures/ChatFrame.blp differ diff --git a/WeakAuras/Media/Textures/CommonSearch.blp b/WeakAuras/Media/Textures/CommonSearch.blp new file mode 100644 index 0000000..5e5d2a4 Binary files /dev/null and b/WeakAuras/Media/Textures/CommonSearch.blp differ diff --git a/WeakAuras/Media/Textures/HelpIcon-Bug.blp b/WeakAuras/Media/Textures/HelpIcon-Bug.blp new file mode 100644 index 0000000..9cc2c57 Binary files /dev/null and b/WeakAuras/Media/Textures/HelpIcon-Bug.blp differ diff --git a/WeakAuras/Media/Textures/ServicesAtlas.blp b/WeakAuras/Media/Textures/ServicesAtlas.blp new file mode 100644 index 0000000..ea8c207 Binary files /dev/null and b/WeakAuras/Media/Textures/ServicesAtlas.blp differ diff --git a/WeakAuras/Media/Textures/UI-Background-Rock.blp b/WeakAuras/Media/Textures/UI-Background-Rock.blp new file mode 100644 index 0000000..7d953d8 Binary files /dev/null and b/WeakAuras/Media/Textures/UI-Background-Rock.blp differ diff --git a/WeakAuras/Media/Textures/UIFrameHorizontal.BLP b/WeakAuras/Media/Textures/UIFrameHorizontal.BLP new file mode 100644 index 0000000..8a26b19 Binary files /dev/null and b/WeakAuras/Media/Textures/UIFrameHorizontal.BLP differ diff --git a/WeakAuras/Media/Textures/UIFrameMetal2x.BLP b/WeakAuras/Media/Textures/UIFrameMetal2x.BLP new file mode 100644 index 0000000..44c2f12 Binary files /dev/null and b/WeakAuras/Media/Textures/UIFrameMetal2x.BLP differ diff --git a/WeakAuras/Media/Textures/UIFrameMetalHorizontal2x.BLP b/WeakAuras/Media/Textures/UIFrameMetalHorizontal2x.BLP new file mode 100644 index 0000000..86d76fc Binary files /dev/null and b/WeakAuras/Media/Textures/UIFrameMetalHorizontal2x.BLP differ diff --git a/WeakAuras/Media/Textures/UIFrameMetalVertical2x.BLP b/WeakAuras/Media/Textures/UIFrameMetalVertical2x.BLP new file mode 100644 index 0000000..837ea8c Binary files /dev/null and b/WeakAuras/Media/Textures/UIFrameMetalVertical2x.BLP differ diff --git a/WeakAuras/Media/Textures/loaded.tga b/WeakAuras/Media/Textures/loaded.tga new file mode 100644 index 0000000..dd9acb8 Binary files /dev/null and b/WeakAuras/Media/Textures/loaded.tga differ diff --git a/WeakAuras/Media/Textures/logo_256_round.tga b/WeakAuras/Media/Textures/logo_256_round.tga new file mode 100644 index 0000000..b48b60e Binary files /dev/null and b/WeakAuras/Media/Textures/logo_256_round.tga differ diff --git a/WeakAuras/Media/Textures/redbutton2x.BLP b/WeakAuras/Media/Textures/redbutton2x.BLP new file mode 100644 index 0000000..21111c8 Binary files /dev/null and b/WeakAuras/Media/Textures/redbutton2x.BLP differ diff --git a/WeakAuras/Media/Textures/wago.tga b/WeakAuras/Media/Textures/wago.tga new file mode 100644 index 0000000..f3e1789 Binary files /dev/null and b/WeakAuras/Media/Textures/wago.tga differ diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index d8a2b61..8477517 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -994,6 +994,7 @@ Private.load_prototype = { init = "arg", values = "group_types", events = {"PARTY_MEMBERS_CHANGED", "RAID_ROSTER_UPDATE"}, + optional = true, }, { name = "group_leader", @@ -1003,6 +1004,7 @@ Private.load_prototype = { events = {"PARTY_LEADER_CHANGED", "RAID_ROSTER_UPDATE"}, values = "group_member_types", test = "WeakAuras.CheckGroupMemberType(%s, group_leader)", + optional = true, }, { name ="locationTitle", @@ -1021,6 +1023,7 @@ Private.load_prototype = { desc = function() return ("\n|cffffd200%s|r%s\n\n%s"):format(L["Current Zone\n"], GetRealZoneText(), L["Supports multiple entries, separated by commas"]) end, + optional = true, }, { name = "zoneId", @@ -1033,6 +1036,7 @@ Private.load_prototype = { desc = function() return ("\n|cffffd200%s|r%s: %d\n\n%s"):format(L["Current Zone\n"], GetRealZoneText(), GetCurrentMapAreaID(), L["Supports multiple entries, separated by commas"]) end, + optional = true, }, { name = "subzone", @@ -1046,6 +1050,7 @@ Private.load_prototype = { desc = function() return ("\n|cffffd200%s|r%s\n\n%s"):format(L["Current Zone\n"], GetMinimapZoneText(), L["Supports multiple entries, separated by commas"]) end, + optional = true, }, { name = "size", @@ -1055,6 +1060,7 @@ Private.load_prototype = { sorted = true, init = "arg", events = {"ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA", "WA_DELAYED_PLAYER_ENTERING_WORLD" }, + optional = true, }, { name = "difficulty", @@ -1064,6 +1070,7 @@ Private.load_prototype = { sorted = true, init = "arg", events = {"PLAYER_DIFFICULTY_CHANGED", "ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA", "WA_DELAYED_PLAYER_ENTERING_WORLD" }, + optional = true, }, { name ="equipmentTitle", diff --git a/WeakAuras/RegionTypes/DynamicGroup.lua b/WeakAuras/RegionTypes/DynamicGroup.lua index 1aa3d37..7aed002 100644 --- a/WeakAuras/RegionTypes/DynamicGroup.lua +++ b/WeakAuras/RegionTypes/DynamicGroup.lua @@ -837,6 +837,10 @@ local function modify(parent, region, data) if self.suspended > 0 then self.suspended = self.suspended - 1 end + region:RunDelayedActions() + end + + function region:RunDelayedActions() if not self:IsSuspended() then if self.needToReload then self:ReloadControlledChildren() diff --git a/WeakAuras/RegionTypes/Text.lua b/WeakAuras/RegionTypes/Text.lua index 779be35..e676fea 100644 --- a/WeakAuras/RegionTypes/Text.lua +++ b/WeakAuras/RegionTypes/Text.lua @@ -140,8 +140,11 @@ local function modify(parent, region, data) if(region.height ~= height) then region.height = height region:SetHeight(height) - if(data.parent and WeakAuras.regions[data.parent].region.PositionChildren) then - WeakAuras.regions[data.parent].region:PositionChildren(); + if data.parent then + Private.EnsureRegion(data.parent) + if WeakAuras.regions[data.parent].region.PositionChildren then + WeakAuras.regions[data.parent].region:PositionChildren() + end end end end diff --git a/WeakAuras/Templates.lua b/WeakAuras/Templates.lua new file mode 100644 index 0000000..240d2de --- /dev/null +++ b/WeakAuras/Templates.lua @@ -0,0 +1,129 @@ + +function WA_MaximizeMinimizeButtonFrame_Mixin(frame) + if frame and frame.init then return end + frame.init = true + frame.isMinimized = false + frame.maximizedCallback = nil + frame.minimizedCallback = nil + + local methods = { + OnShow = function(self) + if self.isMinimized then + self:SetMaximizedLook() + else + self:SetMinimizedLook() + end + end, + IsMinimized = function(self) + return self.isMinimized + end, + SetOnMaximizedCallback = function(self, callback) + self.maximizedCallback = callback + end, + SetOnMinimizedCallback = function(self, callback) + self.minimizedCallback = callback + end, + Maximize = function(self, skipCallback) + if self.maximizedCallback and not skipCallback then + self:maximizedCallback() + end + self.isMinimized = false + self:SetMinimizedLook() + end, + Minimize = function(self, skipCallback) + if self.minimizedCallback and not skipCallback then + self:minimizedCallback() + end + self.isMinimized = true + self:SetMaximizedLook() + end, + SetMinimizedLook = function(self) + self.MaximizeButton:Hide() + self.MinimizeButton:Show() + end, + SetMaximizedLook = function(self) + self.MaximizeButton:Show() + self.MinimizeButton:Hide() + end, + } + + for name, func in pairs(methods) do + frame[name] = func + end +end + +function WA_PortraitFrameTemplate_Mixin(frame) + if frame and frame.init then return end + frame.init = true + frame.Bg:SetVertexColor(0.5882, 0.6275, 0.6706, 0.8) -- approx. PANEL_BACKGROUND_COLOR #ff1f1e21 + frame.layoutType = "PortraitMode" + + local methods = { + ShowPortrait = function(self) + self.PortraitContainer:Show(); + self.NineSlice.TopLeftCorner:Show(); + self.NineSlice.TopLeftCornerNoPortrait:Hide(); + self.layoutType = "PortraitMode" + end, + HidePortrait = function(self) + self.PortraitContainer:Hide(); + self.NineSlice.TopLeftCorner:Hide(); + self.NineSlice.TopLeftCornerNoPortrait:Show(); + self.layoutType = "NoPortraitMode" + end, + GetFrameLayoutType = function(self) + return self.layoutType or self:GetParent().layoutType; + end + } + + for name, func in pairs(methods) do + frame[name] = func + end +end + +local function setCorner(corner, point, relativeTo, x, y, width, height) + corner:ClearAllPoints() + corner:SetPoint(point, relativeTo, x, y) + corner:SetSize(width, height) +end + +local function setEdge(edge, point1, relativeTo1, point2, relativeTo2, width, height) + edge:ClearAllPoints() + edge:SetSize(width, height) + edge:SetPoint(point1, relativeTo1, point2, 0, 0) + edge:SetPoint(point2, relativeTo2, point1, 0, 0) +end + +function WA_UpdateNineSliceBorders(frame) + local NineSlice = frame.NineSlice + if not NineSlice then return end + local PortaitMode = frame:GetFrameLayoutType() == "PortraitMode" + + local topLeftCorner = PortaitMode and NineSlice.TopLeftCorner or NineSlice.TopLeftCornerNoPortrait + local topEdgeRelativeTo = PortaitMode and NineSlice.TopLeftCorner or NineSlice.TopLeftCornerNoPortrait + local leftEdgeRelativeTo = PortaitMode and NineSlice.TopLeftCorner or NineSlice.TopLeftCornerNoPortrait + + -- Top Left Corner + setCorner(topLeftCorner, "TOPLEFT", NineSlice, -13, 16, 75, 75) + + -- Top Right Corner + setCorner(NineSlice.TopRightCorner, "TOPRIGHT", NineSlice, 4, 16, 75, 75) + + -- Bottom Left Corner + setCorner(NineSlice.BottomLeftCorner, "BOTTOMLEFT", NineSlice, -13, -3, 32, 32) + + -- Bottom Right Corner + setCorner(NineSlice.BottomRightCorner, "BOTTOMRIGHT", NineSlice, 4, -3, 32, 32) + + -- Top Edge + setEdge(NineSlice.TopEdge, "TOPLEFT", topEdgeRelativeTo, "TOPRIGHT", NineSlice.TopRightCorner, 32, 75) + + -- Bottom Edge + setEdge(NineSlice.BottomEdge, "BOTTOMLEFT", NineSlice.BottomLeftCorner, "BOTTOMRIGHT", NineSlice.BottomRightCorner, 32, 32) + + -- Left Edge + setEdge(NineSlice.LeftEdge, "TOPLEFT", leftEdgeRelativeTo, "BOTTOMLEFT", NineSlice.BottomLeftCorner, 75, 8) + + -- Right Edge + setEdge(NineSlice.RightEdge, "TOPLEFT", NineSlice.TopRightCorner, "BOTTOMLEFT", NineSlice.BottomRightCorner, 75, 8) +end diff --git a/WeakAuras/Templates.xml b/WeakAuras/Templates.xml new file mode 100644 index 0000000..6c1943d --- /dev/null +++ b/WeakAuras/Templates.xml @@ -0,0 +1,342 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WA_PortraitFrameTemplate_Mixin(self); + + + WA_UpdateNineSliceBorders(self); + + + + + + + + + + + + + + + WA_MaximizeMinimizeButtonFrame_Mixin(self); + + + self:OnShow(); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EditBox_ClearFocus(self); + + + EditBox_ClearHighlight(self); + + + EditBox_HighlightText(self); + + + + + diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index cd3911d..0b9630d 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -181,7 +181,6 @@ local loadEvents = {} -- All regions keyed on id, has properties: region, regionType, also see clones WeakAuras.regions = {}; -local regions = WeakAuras.regions; -- keyed on id, contains bool indicating whether the aura is loaded Private.loaded = {}; @@ -1073,7 +1072,12 @@ function Private.Login(initialTime, takeNewSnapshots) end loginFinished = true - Private.ResumeAllDynamicGroups(); + -- Tell Dynamic Groups that we are done with login + for _, region in pairs(WeakAuras.regions) do + if (region.region.RunDelayedActions) then + region.region:RunDelayedActions(); + end + end end) if initialTime then @@ -1098,10 +1102,10 @@ function Private.Login(initialTime, takeNewSnapshots) end end -local frame = CreateFrame("FRAME", "WeakAurasFrame", UIParent); -WeakAuras.frames["WeakAuras Main Frame"] = frame; -frame:SetAllPoints(UIParent); -frame:SetFrameStrata("BACKGROUND"); +local WeakAurasFrame = CreateFrame("FRAME", "WeakAurasFrame", UIParent); +WeakAuras.frames["WeakAuras Main Frame"] = WeakAurasFrame; +WeakAurasFrame:SetAllPoints(UIParent); +WeakAurasFrame:SetFrameStrata("BACKGROUND"); local loadedFrame = CreateFrame("FRAME"); WeakAuras.frames["Addon Initialization Handler"] = loadedFrame; @@ -1230,17 +1234,21 @@ function Private.SquelchingActions() end function Private.PauseAllDynamicGroups() - for id, region in pairs(regions) do + local suspended = {} + for id, region in pairs(WeakAuras.regions) do if (region.region.Suspend) then region.region:Suspend(); + tinsert(suspended, id) end end + return suspended end -function Private.ResumeAllDynamicGroups() - for id, region in pairs(regions) do - if (region.region.Resume) then - region.region:Resume(); +function Private.ResumeAllDynamicGroups(suspended) + for _, id in ipairs(suspended) do + local region = WeakAuras.GetRegion(id) + if (region and region.Resume) then + region:Resume(); end end end @@ -1369,6 +1377,7 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) if(shouldBeLoaded and not loaded[id]) then changed = changed + 1; toLoad[id] = true; + Private.EnsureRegion(id) for parent in Private.TraverseParents(data) do parentsToCheck[parent.id] = true end @@ -1418,8 +1427,12 @@ function Private.ScanForLoadsGroup(toCheck) any_loaded = nil end end + if any_loaded then + Private.EnsureRegion(id) + end loaded[id] = any_loaded; else + Private.EnsureRegion(id) loaded[id] = true; end end @@ -1488,7 +1501,9 @@ end local function UnloadAll() -- Even though auras are collapsed, their finish animation can be running for id in pairs(loaded) do - Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true) + if WeakAuras.regions[id] and WeakAuras.regions[id].region then + Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true) + end if clones[id] then for cloneId, region in pairs(clones[id]) do Private.CancelAnimation(region, true, true, true, true, true, true) @@ -1526,9 +1541,9 @@ end function Private.Resume() paused = false; - Private.PauseAllDynamicGroups(); + local suspended = Private.PauseAllDynamicGroups() - for id, region in pairs(regions) do + for id, region in pairs(WeakAuras.regions) do region.region:Collapse(); end @@ -1545,7 +1560,7 @@ function Private.Resume() Private.ScanForLoadsGroup(loadEvents["GROUP"]) end - Private.ResumeAllDynamicGroups(); + Private.ResumeAllDynamicGroups(suspended) end function Private.LoadDisplays(toLoad, ...) @@ -1661,30 +1676,27 @@ function WeakAuras.Delete(data) end end - regions[id].region:Collapse() - Private.CollapseAllClones(id); - - Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true) + 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 + end if clones[id] then for cloneId, region in pairs(clones[id]) do - Private.CancelAnimation(region, true, true, true, true, true, true) + region:Collapse(); + Private.CancelAnimation(region, true, true, true, true, true, true) end + clones[id] = nil end - regions[id].region:SetScript("OnUpdate", nil); - regions[id].region:SetScript("OnShow", nil); - regions[id].region:SetScript("OnHide", nil); - regions[id].region:Hide(); - db.registered[id] = nil; for _, triggerSystem in pairs(triggerSystems) do triggerSystem.Delete(id); end - regions[id].region = nil; - regions[id] = nil; loaded[id] = nil; loadFuncs[id] = nil; loadFuncsForOptions[id] = nil; @@ -1739,9 +1751,18 @@ function WeakAuras.Rename(data, newid) end UIDtoID[data.uid] = newid - regions[newid] = regions[oldid]; - regions[oldid] = nil; - regions[newid].region.id = newid; + WeakAuras.regions[newid] = WeakAuras.regions[oldid]; + WeakAuras.regions[oldid] = nil; + if WeakAuras.regions[newid] then + WeakAuras.regions[newid].region.id = newid + end + if(clones[oldid]) then + clones[newid] = clones[oldid] + clones[oldid] = nil + for cloneid, clone in pairs(clones[newid]) do + clone.id = newid + end + end for _, triggerSystem in pairs(triggerSystems) do triggerSystem.Rename(oldid, newid); @@ -1771,14 +1792,6 @@ function WeakAuras.Rename(data, newid) db.displays[newid] = db.displays[oldid]; db.displays[oldid] = nil; - if(clones[oldid]) then - clones[newid] = clones[oldid]; - clones[oldid] = nil; - for cloneid, clone in pairs(clones[newid]) do - clone.id = newid; - end - end - db.displays[newid].id = newid; if(data.controlledChildren) then @@ -1788,9 +1801,6 @@ function WeakAuras.Rename(data, newid) childData.parent = data.id; end end - if regions[newid].ReloadControlledChildren then - regions[newid]:ReloadControlledChildren() - end end if (Private.personalRessourceDisplayFrame) then @@ -1823,14 +1833,13 @@ end function Private.Convert(data, newType) local id = data.id; - regions[id].region:SetScript("OnUpdate", nil); - regions[id].region:Hide(); - Private.EndEvent(id, 0, true); Private.FakeStatesFor(id, false) - regions[id].region = nil; - regions[id] = nil; + if WeakAuras.regions[id] then + WeakAuras.regions[id].region = nil + WeakAuras.regions[id] = nil + end data.regionType = newType; @@ -2113,7 +2122,9 @@ function WeakAuras.AddMany(table, takeSnapshots) end for data in pairs(groups) do if data.type == "dynamicgroup" then - regions[data.id].region:ReloadControlledChildren() + if WeakAuras.regions[data.id] then + WeakAuras.regions[data.id].region:ReloadControlledChildren() + end else WeakAuras.Add(data) end @@ -2418,6 +2429,36 @@ function Private.UpdateSoundIcon(data) end +function Private.ClearSounds(uid) + local data = Private.GetDataByUID(uid) + for child in Private.TraverseLeafsOrAura(data) do + local changed = false + -- Conditions + if child.conditions then + for _, condition in ipairs(child.conditions) do + for changeIndex = #condition.changes, 1, -1 do + local change = condition.changes[changeIndex] + if change.property == "sound" then + tremove(condition.changes, changeIndex) + changed = true + end + end + end + end + -- Actions + if child.actions.start.do_sound or child.actions.finish.do_sound then + child.actions.start.do_sound = false + child.actions.finish.do_sound = false + changed = true + end + if changed then + WeakAuras.Add(child) + end + end + WeakAuras.ClearAndUpdateOptions(data.id, true) + WeakAuras.FillOptions() +end + function WeakAuras.PreAdd(data) -- Readd what Compress removed before version 8 if (not data.internalVersion or data.internalVersion < 7) then @@ -2489,7 +2530,9 @@ local function pAdd(data, simpleChange) if simpleChange then db.displays[id] = data - WeakAuras.SetRegion(data) + if WeakAuras.GetRegion(data.id) then + WeakAuras.SetRegion(data) + end if clones[id] then for cloneId, region in pairs(clones[id]) do WeakAuras.SetRegion(data, cloneId) @@ -2503,7 +2546,9 @@ local function pAdd(data, simpleChange) Private.ClearAuraEnvironment(parent.id); end db.displays[id] = data; - WeakAuras.SetRegion(data); + if WeakAuras.GetRegion(data.id) then + WeakAuras.SetRegion(data) + end Private.ScanForLoadsGroup({[id] = true}); loadEvents["GROUP"] = loadEvents["GROUP"] or {} loadEvents["GROUP"][id] = true @@ -2572,7 +2617,9 @@ local function pAdd(data, simpleChange) timers[id] = nil; end - local region = WeakAuras.SetRegion(data); + if WeakAuras.GetRegion(data.id) then + WeakAuras.SetRegion(data) + end triggerState[id] = { disjunctive = data.triggers.disjunctive or "all", @@ -2648,7 +2695,7 @@ function WeakAuras.SetRegion(data, cloneId) if(clonePool[data.regionType] and clonePool[data.regionType][1]) then clones[id][cloneId] = tremove(clonePool[data.regionType]); else - local clone = regionTypes[data.regionType].create(frame, data); + local clone = regionTypes[data.regionType].create(WeakAurasFrame, data); clone.regionType = data.regionType; clone:Hide(); clones[id][cloneId] = clone; @@ -2656,9 +2703,9 @@ function WeakAuras.SetRegion(data, cloneId) region = clones[id][cloneId]; end else - if((not regions[id]) or (not regions[id].region) or regions[id].regionType ~= regionType) then - region = regionTypes[regionType].create(frame, data); - regions[id] = { + if((not WeakAuras.regions[id]) or (not WeakAuras.regions[id].region) or WeakAuras.regions[id].regionType ~= regionType) then + region = regionTypes[regionType].create(WeakAurasFrame, data); + WeakAuras.regions[id] = { regionType = regionType, region = region }; @@ -2669,17 +2716,17 @@ function WeakAuras.SetRegion(data, cloneId) region.toShow = true end else - region = regions[id].region; + region = WeakAuras.regions[id].region end end region.id = id; region.cloneId = cloneId or ""; WeakAuras.validate(data, regionTypes[regionType].default); - local parent = frame; + local parent = WeakAurasFrame; if(data.parent) then - if(regions[data.parent]) then - parent = regions[data.parent].region; + if WeakAuras.GetData(data.parent) then + parent = Private.EnsureRegion(data.parent) else data.parent = nil; end @@ -2717,19 +2764,78 @@ function WeakAuras.SetRegion(data, cloneId) end local function EnsureClone(id, cloneId) - clones[id] = clones[id] or {}; + clones[id] = clones[id] or {} if not(clones[id][cloneId]) then - local data = WeakAuras.GetData(id); - WeakAuras.SetRegion(data, cloneId); + local data = WeakAuras.GetData(id) + WeakAuras.SetRegion(data, cloneId) end - return clones[id][cloneId]; + return clones[id][cloneId] end -function WeakAuras.GetRegion(id, cloneId) +local creatingRegions = false +function Private.CreatingRegions() + return 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 {} + -- 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! + -- and we have to call ReloadControlledChildren at the end + -- 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 + -- And dynamic groups require creating all children, thus we don't need + -- to care which path we came to them + + local aurasToCreate = {} + local dynamicGroups = {} + creatingRegions = true + while(id) do + local data = WeakAuras.GetData(id) + if (data.regionType == "dynamicgroup") then + wipe(aurasToCreate) + tinsert(aurasToCreate, data.id) + tinsert(dynamicGroups, data.id) + else + tinsert(aurasToCreate, data.id) + end + id = data.parent + end + for _, toCreateId in ipairs_reverse(aurasToCreate) do + local data = WeakAuras.GetData(toCreateId) + WeakAuras.SetRegion(data) + if (data.regionType == "dynamicgroup") then + for child in Private.TraverseAllChildren(data) do + WeakAuras.SetRegion(child) + end + end + end + creatingRegions = false + for _, dynamicGroupId in ipairs_reverse(dynamicGroups) do + local dgRegion = WeakAuras.regions[dynamicGroupId].region + dgRegion:ReloadControlledChildren() + end + end + return WeakAuras.regions[id] and WeakAuras.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. +function Private.EnsureRegion(id, cloneId) + EnsureRegion(id) if(cloneId and cloneId ~= "") then return EnsureClone(id, cloneId); end - return WeakAuras.regions[id] and WeakAuras.regions[id].region; + return WeakAuras.GetRegion(id) +end + +---returns the region, if it exists +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 end -- Note, does not create a clone! @@ -2960,8 +3066,11 @@ function Private.HandleGlowAction(actions, region) if actions.glow_frame_type == "FRAMESELECTOR" then if actions.glow_frame:sub(1, 10) == "WeakAuras:" then local frame_name = actions.glow_frame:sub(11) - if regions[frame_name] then - glow_frame = regions[frame_name].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 end else glow_frame = Private.GetSanitizedGlobal(actions.glow_frame) @@ -3534,7 +3643,7 @@ do local UpdateFakeTimesHandle local function UpdateFakeTimers() - Private.PauseAllDynamicGroups() + local suspended = Private.PauseAllDynamicGroups() local t = GetTime() for id, triggers in pairs(triggerState) do local changed = false @@ -3551,7 +3660,7 @@ do Private.UpdatedTriggerState(id) end end - Private.ResumeAllDynamicGroups() + Private.ResumeAllDynamicGroups(suspended) end function Private.SetFakeStates() @@ -3738,14 +3847,14 @@ local function ApplyStatesToRegions(id, activeTrigger, states) local data = WeakAuras.GetData(id) local parent if data and data.parent then - parent = WeakAuras.GetRegion(data.parent) + parent = Private.EnsureRegion(data.parent) end if parent and parent.Suspend then parent:Suspend() end for cloneId, state in pairs(states) do if (state.show) then - local region = WeakAuras.GetRegion(id, cloneId); + local region = Private.EnsureRegion(id, cloneId); local applyChanges = not region.toShow or state.changed or region.state ~= state region.state = state region.states = region.states or {} @@ -3876,7 +3985,9 @@ function Private.UpdatedTriggerState(id) for cloneId, clone in pairs(clones[id]) do clone:Collapse() end - WeakAuras.regions[id].region:Collapse() + if WeakAuras.regions[id] then + WeakAuras.regions[id].region:Collapse() + end elseif (show and oldShow) then -- Already shown, update regions -- Hide old clones for cloneId, clone in pairs(clones[id]) do @@ -3885,7 +3996,9 @@ function Private.UpdatedTriggerState(id) end end if (not activeTriggerState[""] or not activeTriggerState[""].show) then - WeakAuras.regions[id].region:Collapse() + if WeakAuras.regions[id] then + WeakAuras.regions[id].region:Collapse() + end end -- Show new states ApplyStatesToRegions(id, newActiveTrigger, activeTriggerState); @@ -4649,9 +4762,9 @@ local function tryAnchorAgain() local data = WeakAuras.GetData(id); local region = WeakAuras.GetRegion(id); if (data and region) then - local parent = frame; - if (data.parent and regions[data.parent]) then - parent = regions[data.parent].region; + local parent = WeakAurasFrame; + if (data.parent and WeakAuras.GetData(data.parent) and Private.EnsureRegion(data.parent)) then + parent = WeakAuras.regions[data.parent].region; end Private.AnchorFrame(data, region, parent); end @@ -4728,8 +4841,8 @@ local function GetAnchorFrame(data, region, parent) if (frame_name == id) then return parent; end - if(regions[frame_name]) then - return regions[frame_name].region; + if(WeakAuras.regions[frame_name]) then + return WeakAuras.regions[frame_name].region; end postponeAnchor(id); else @@ -4786,7 +4899,7 @@ function Private.AnchorFrame(data, region, parent, force) errorhandler(ret) end else - region:SetParent(parent or frame); + region:SetParent(parent or WeakAurasFrame); end local anchorPoint = data.anchorPoint @@ -5273,6 +5386,11 @@ do function Private.TraverseParents(data) return coroutine.wrap(TraverseParents), data end + + -- Returns whether the data is a group or dynamicgroup + function Private.IsGroupType(data) + return data.regionType == "group" or data.regionType == "dynamicgroup" + end end diff --git a/WeakAuras/WeakAuras.toc b/WeakAuras/WeakAuras.toc index a51b178..cb98cff 100644 --- a/WeakAuras/WeakAuras.toc +++ b/WeakAuras/WeakAuras.toc @@ -1,7 +1,7 @@ ## Interface: 30300 ## Title: WeakAuras ## Author: The WeakAuras Team -## Version: 4.1.1 +## Version: 4.1.2 ## Notes: A powerful, comprehensive utility for displaying graphics and information based on buffs, debuffs, and other triggers. ## Notes-esES: Potente y completa aplicación que te permitirá mostrar por pantalla múltiples diseños, basados en beneficios, perjuicios y otros activadores. ## Notes-deDE: Ein leistungsfähiges, umfassendes Addon zur grafischen Darstellung von Informationen von Auren, Cooldowns, Timern und vielem mehr. @@ -17,6 +17,8 @@ ## SavedVariables: WeakAurasSaved ## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibClassicDurations, LibClassicCasterino, LibGetFrame-1.0 +Templates.lua +Templates.xml compat.lua Pools.lua diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua index 3f60286..b99ed4e 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua @@ -5,7 +5,7 @@ local tinsert, tconcat, tremove, wipe = table.insert, table.concat, table.remove local select, pairs, next, type, unpack = select, pairs, next, type, unpack local tostring, error = tostring, error -local Type, Version = "WeakAurasDisplayButton", 57 +local Type, Version = "WeakAurasDisplayButton", 59 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -236,6 +236,7 @@ end local function Show_Tooltip(owner, line1, line2) GameTooltip:SetOwner(owner, "ANCHOR_NONE"); + GameTooltip:ClearAllPoints() GameTooltip:SetPoint("LEFT", owner, "RIGHT"); GameTooltip:ClearLines(); GameTooltip:AddLine(line1); @@ -245,6 +246,7 @@ end local function Show_Long_Tooltip(owner, description) GameTooltip:SetOwner(owner, "ANCHOR_NONE"); + GameTooltip:ClearAllPoints() GameTooltip:SetPoint("LEFT", owner, "RIGHT"); GameTooltip:ClearLines(); local line = 1; @@ -272,6 +274,8 @@ local function ensure(t, k, v) return t and k and v and t[k] == v end +local statusIconPool = CreateFramePool("Button") + --[[ Actions ]]-- local Actions = { @@ -303,19 +307,17 @@ local Actions = { WeakAuras.UpdateGroupOrders(group.data) WeakAuras.ClearAndUpdateOptions(group.data.id) WeakAuras.ClearAndUpdateOptions(source.data.id) - WeakAuras.FillOptions() group.callbacks.UpdateExpandButton(); + group:UpdateParentWarning() group:ReloadTooltip() else WeakAuras.Add(source.data) WeakAuras.ClearAndUpdateOptions(source.data.id) - WeakAuras.FillOptions() end else -- move source into the top-level list WeakAuras.Add(source.data) WeakAuras.ClearAndUpdateOptions(source.data.id) - WeakAuras.FillOptions() end else error("Calling 'Group' with invalid source. Reload your UI to fix the display list.") @@ -337,6 +339,7 @@ local Actions = { WeakAuras.ClearAndUpdateOptions(parent.id); local group = WeakAuras.GetDisplayButton(parent.id) group.callbacks.UpdateExpandButton(); + group:UpdateParentWarning() group:ReloadTooltip() else error("Display thinks it is a member of a group which does not control it") @@ -425,6 +428,12 @@ local function IsParentRecursive(needle, parent) end end +local tabsForWarning = { + sound_condition = "conditions", + sound_action = "action", + spammy_event_warning = "trigger" +} + --[[----------------------------------------------------------------------------- Methods -------------------------------------------------------------------------------]] @@ -474,7 +483,11 @@ local methods = { UpdateClipboardMenuEntry(self.data); EasyMenu(self.menu, WeakAuras_DropDownMenu, self.frame, 0, 0, "MENU"); if not(OptionsPrivate.IsDisplayPicked(self.data.id)) then - WeakAuras.PickDisplay(self.data.id); + if self.data.controlledChildren then + WeakAuras.PickDisplay(self.data.id, "group") + else + WeakAuras.PickDisplay(self.data.id); + end end end else @@ -531,6 +544,7 @@ local methods = { WeakAuras.Add(self.data); OptionsPrivate.Private.AddParents(self.data) self.callbacks.UpdateExpandButton(); + self:UpdateParentWarning(); OptionsPrivate.StopGrouping(); OptionsPrivate.ClearOptions(self.data.id); WeakAuras.FillOptions(); @@ -600,22 +614,24 @@ local methods = { -- This builds the group skeleton DuplicateGroups(self.data, newGroup, mapping) -- Do this after duplicating all groups - OptionsPrivate.Private.PauseAllDynamicGroups() + local suspended = OptionsPrivate.Private.PauseAllDynamicGroups() -- And this fills in the leafs DuplicateAuras(self.data, newGroup, mapping) local button = WeakAuras.GetDisplayButton(newGroup.id) button.callbacks.UpdateExpandButton() + button:UpdateParentWarning() for old, new in pairs(mapping) do local button = WeakAuras.GetDisplayButton(new.id) button.callbacks.UpdateExpandButton() + button:UpdateParentWarning() end OptionsPrivate.SortDisplayButtons(nil, true) OptionsPrivate.PickAndEditDisplay(newGroup.id) - OptionsPrivate.Private.ResumeAllDynamicGroups() + OptionsPrivate.Private.ResumeAllDynamicGroups(suspended) else local new = OptionsPrivate.DuplicateAura(self.data) OptionsPrivate.SortDisplayButtons(nil, true) @@ -627,7 +643,6 @@ local methods = { if (WeakAuras.IsImporting()) then return end; local toDelete = {} if(self.data.controlledChildren) then - local region = WeakAuras.regions[self.data.id]; for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do tinsert(toDelete, child); end @@ -721,7 +736,7 @@ local methods = { end function self.callbacks.OnViewClick() - OptionsPrivate.Private.PauseAllDynamicGroups(); + local suspended = OptionsPrivate.Private.PauseAllDynamicGroups() if(self.view.visibility == 2) then for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do WeakAuras.GetDisplayButton(child.id):PriorityHide(2); @@ -734,7 +749,7 @@ local methods = { self:PriorityShow(2) end self:RecheckParentVisibility() - OptionsPrivate.Private.ResumeAllDynamicGroups(); + OptionsPrivate.Private.ResumeAllDynamicGroups(suspended) end function self.callbacks.OnRenameClick() @@ -755,6 +770,7 @@ local methods = { if not(newid == oldid) then WeakAuras.Rename(self.data, newid); end + self:UpdateParentWarning() end function self.callbacks.OnDragStart() @@ -889,13 +905,10 @@ local methods = { func = function() WeakAuras_DropDownMenu:Hide() end }); if(self.data.controlledChildren) then - self.loaded:Hide(); self.expand:Show(); self.callbacks.UpdateExpandButton(); self:SetOnExpandCollapse(function() OptionsPrivate.SortDisplayButtons(nil, true) end); else - self:SetViewRegion(WeakAuras.regions[self.data.id].region); - self.loaded:Show(); self.expand:Hide(); end self.group:Show(); @@ -945,6 +958,9 @@ local methods = { for index, childId in pairs(data.controlledChildren) do tinsert(namestable, indent .. childId); local childData = WeakAuras.GetData(childId) + if not childData then + return + end if (childData.controlledChildren) then addChildrenNames(childData, indent .. " ") end @@ -1011,13 +1027,13 @@ local methods = { Show_Long_Tooltip(self.frame, self.frame.description); end end, - ["StartGrouping"] = function(self, groupingData, selected, groupingGroup, childOfGrouing) + ["StartGrouping"] = function(self, groupingData, selected, groupingGroup, childOfGrouping) self.grouping = groupingData; self:UpdateIconsVisible() if(selected) then self.frame:SetScript("OnClick", self.callbacks.OnClickGroupingSelf); self:SetDescription(L["Cancel"], L["Do not group this display"]); - elseif (childOfGrouing) then + elseif (childOfGrouping) then self:Disable(); else if(self.data.regionType == "dynamicgroup" and groupingGroup) then @@ -1031,11 +1047,13 @@ local methods = { end end, ["StopGrouping"] = function(self) - self.grouping = nil; - self:UpdateIconsVisible() - self:SetNormalTooltip(); - self.frame:SetScript("OnClick", self.callbacks.OnClickNormal); - self:Enable(); + if self.grouping then + self.grouping = nil + self:UpdateIconsVisible() + self:SetNormalTooltip() + self.frame:SetScript("OnClick", self.callbacks.OnClickNormal) + self:Enable() + end end, ["Ungroup"] = function(self) if (WeakAuras.IsImporting()) then return end; @@ -1073,10 +1091,11 @@ local methods = { end WeakAuras.ClearAndUpdateOptions(self.data.id); WeakAuras.UpdateGroupOrders(parentData); + local parentButton = WeakAuras.GetDisplayButton(parentData.id) if(#parentData.controlledChildren == 0) then - local parentButton = WeakAuras.GetDisplayButton(parentData.id) parentButton:DisableExpand() end + parentButton:UpdateParentWarning() for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do local button = WeakAuras.GetDisplayButton(child.id) @@ -1108,7 +1127,7 @@ local methods = { self.frame:SetScript("OnClick", nil) self.view:Hide() self.expand:Hide() - self.loaded:Hide() + self.statusIcons:Hide() Hide_Tooltip() if picked then self.frame:EnableKeyboard(true) @@ -1152,7 +1171,6 @@ local methods = { Show_DropIndicator(id) end self:UpdateIconsVisible() - OptionsPrivate.UpdateButtonsScroll() else -- Are we a valid target? -- Top level auras that aren't groups aren't @@ -1201,10 +1219,9 @@ local methods = { self.frame:SetScript("OnClick", self.callbacks.OnClickNormal) self.frame:EnableKeyboard(false); -- disables self.callbacks.OnKeyDown self.view:Show() + self.statusIcons:Show() if self.data.controlledChildren then self.expand:Show() - else - self.loaded:Show() end self:Enable() @@ -1255,9 +1272,6 @@ local methods = { ["SetDescription"] = function(self, ...) self.frame.description = {...}; end, - ["SetViewRegion"] = function(self, region) - self.view.region = region; - end, ["SetRenameAction"] = function(self, func) self.renamebox.func = function() func(self.renamebox:GetText()); @@ -1329,12 +1343,18 @@ local methods = { return not OptionsPrivate.IsCollapsed(self.data.id, "displayButton", "", true) end, ["DisableExpand"] = function(self) + if self.expand.disabled then + return + end self.expand:Disable(); self.expand.disabled = true; self.expand.expanded = false; self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp"); end, ["EnableExpand"] = function(self) + if not self.expand.disabled then + return + end self.expand.disabled = false; if(self:GetExpanded()) then self:Expand(); @@ -1342,23 +1362,119 @@ local methods = { self:Collapse(); end end, - ["UpdateWarning"] = function(self) - local icon, title, warningText = OptionsPrivate.Private.AuraWarnings.FormatWarnings(self.data.uid) - if warningText then - self.warning:Show() - self.warning:SetNormalTexture(icon) - self.warning:SetScript("OnEnter", function() + ["UpdateStatusIcon"] = function(self, key, prio, icon, title, tooltip, onClick, color) + local iconButton + for _, button in ipairs(self.statusIcons.buttons) do + if button.key == key then + iconButton = button + break + end + end + if not iconButton then + iconButton = statusIconPool:Acquire() + iconButton:RegisterForClicks("LeftButtonUp", "RightButtonUp") + tinsert(self.statusIcons.buttons, iconButton) + iconButton:SetParent(self.statusIcons) + iconButton.key = key + iconButton:SetSize(16, 16) + end + iconButton.prio = prio + iconButton:SetNormalTexture(icon.path) + if icon.texCoords then + iconButton:GetNormalTexture():SetTexCoord(unpack(icon.texCoords)) + end + if title then + iconButton:SetScript("OnEnter", function() Show_Tooltip( self.frame, title, - warningText + tooltip ) end) - self.warning:SetScript("OnClick", function() - WeakAuras.PickDisplay(self.data.id, "information") - end) + iconButton:SetScript("OnLeave", Hide_Tooltip) else - self.warning:Hide() + iconButton:SetScript("OnEnter", nil) + end + if color then + iconButton:GetNormalTexture():SetVertexColor(unpack(color)) + else + iconButton:GetNormalTexture():SetVertexColor(1, 1, 1, 1) + end + iconButton:SetScript("OnClick", onClick) + iconButton:Show() + end, + ["ClearStatusIcon"] = function(self, key) + for index, button in ipairs(self.statusIcons.buttons) do + if button.key == key then + statusIconPool:Release(button) + table.remove(self.statusIcons.buttons, index) + return + end + end + end, + ["SortStatusIcons"] = function(self) + table.sort(self.statusIcons.buttons, function(a, b) + return a.prio < b.prio + end) + local lastAnchor = self.statusIcons + if self:IsGroup() then + self.statusIcons:SetWidth(17) + else + self.statusIcons:SetWidth(1) + end + for _, button in ipairs(self.statusIcons.buttons) do + button:ClearAllPoints() + button:SetPoint("BOTTOMLEFT", lastAnchor, "BOTTOMRIGHT", 4, 0) + lastAnchor = button + end + end, + ["UpdateWarning"] = function(self) + local warnings = OptionsPrivate.Private.AuraWarnings.GetAllWarnings(self.data.uid) + local warningTypes = {"info", "sound", "warning", "error"} + for _, key in ipairs(warningTypes) do + self:ClearStatusIcon(key) + end + if warnings then + for severity, warning in pairs(warnings) do + local onClick + if severity == "sound" then + local soundText = L["Show Sound Setting"] + local removeText = L["Remove All Sounds"] + onClick = function() + local menu = { + { + text = soundText, + func = function() + WeakAuras.PickDisplay(warning.auraId, tabsForWarning[warning.key] or "information") + end + }, + { + text = removeText, + func = function() + OptionsPrivate.Private.ClearSounds(self.data.uid) + end + } + } + EasyMenu(menu, WeakAuras_DropDownMenu, "cursor", 0, 0, "MENU"); + end + else + onClick = function() + WeakAuras.PickDisplay(warning.auraId, tabsForWarning[warning.key] or "information") + end + end + + self:UpdateStatusIcon(severity, warning.prio, warning.icon, warning.title, warning.message, onClick) + end + end + self:SortStatusIcons() + end, + ["UpdateParentWarning"] = function(self) + self:UpdateWarning() + for parent in OptionsPrivate.Private.TraverseParents(self.data) do + local parentButton = WeakAuras.GetDisplayButton(parent.id) + if parentButton then + parentButton:UpdateWarning() + end end end, ["SetGroupOrder"] = function(self, order, max) @@ -1387,15 +1503,22 @@ local methods = { ["GetGroupOrder"] = function(self) return self.frame.dgrouporder; end, - ["DisableLoaded"] = function(self) - self.loaded.title = L["Not Loaded"]; - self.loaded.desc = L["This display is not currently loaded"]; - self.loaded:SetNormalTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Disabled.blp"); + ["ClearLoaded"] = function(self) + self:ClearStatusIcon("load") + self:SortStatusIcons() end, - ["EnableLoaded"] = function(self) - self.loaded.title = L["Loaded"]; - self.loaded.desc = L["This display is currently loaded"]; - self.loaded:SetNormalTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Up.blp"); + ["SetLoaded"] = function(self, prio, color, title, description) + self:UpdateStatusIcon("load", prio, {path="Interface\\AddOns\\WeakAuras\\Media\\Textures\\loaded"}, title, description, nil, color) + self:SortStatusIcons() + end, + ["IsLoaded"] = function(self) + return OptionsPrivate.Private.loaded[self.data.id] == true + end, + ["IsStandby"] = function(self) + return OptionsPrivate.Private.loaded[self.data.id] == false + end, + ["IsUnloaded"] = function(self) + return OptionsPrivate.Private.loaded[self.data.id] == nil end, ["Pick"] = function(self) self.frame:LockHighlight(); @@ -1414,24 +1537,25 @@ local methods = { return; end if self.view.visibility >= 1 then - if(self.view.region and self.view.region.Expand) then - OptionsPrivate.Private.FakeStatesFor(self.view.region.id, true) - --if (OptionsPrivate.Private.personalRessourceDisplayFrame) then - --OptionsPrivate.Private.personalRessourceDisplayFrame:expand(self.view.region.id); - --end - if (OptionsPrivate.Private.mouseFrame) then - OptionsPrivate.Private.mouseFrame:expand(self.view.region.id); - end + + if not OptionsPrivate.Private.IsGroupType(self.data) then + OptionsPrivate.Private.FakeStatesFor(self.data.id, true) + end + --if (OptionsPrivate.Private.personalRessourceDisplayFrame) then + --OptionsPrivate.Private.personalRessourceDisplayFrame:expand(self.data.id); + --end + if (OptionsPrivate.Private.mouseFrame) then + OptionsPrivate.Private.mouseFrame:expand(self.data.id); end else - if(self.view.region and self.view.region.Collapse) then - OptionsPrivate.Private.FakeStatesFor(self.view.region.id, false) - if (OptionsPrivate.Private.personalRessourceDisplayFrame) then - OptionsPrivate.Private.personalRessourceDisplayFrame:collapse(self.view.region.id); - end - if (OptionsPrivate.Private.mouseFrame) then - OptionsPrivate.Private.mouseFrame:collapse(self.view.region.id); - end + if not OptionsPrivate.Private.IsGroupType(self.data) then + OptionsPrivate.Private.FakeStatesFor(self.data.id, false) + end + if (OptionsPrivate.Private.personalRessourceDisplayFrame) then + OptionsPrivate.Private.personalRessourceDisplayFrame:collapse(self.data.id); + end + if (OptionsPrivate.Private.mouseFrame) then + OptionsPrivate.Private.mouseFrame:collapse(self.data.id); end end end, @@ -1444,8 +1568,9 @@ local methods = { self:SyncVisibility() self:UpdateViewTexture() end - if self.view.region and self.view.region.ClickToPick then - self.view.region:ClickToPick(); + local region = OptionsPrivate.Private.EnsureRegion(self.data.id) + if region and region.ClickToPick then + region:ClickToPick(); end end, ["PriorityHide"] = function(self, priority) @@ -1495,12 +1620,6 @@ local methods = { self:RecheckParentVisibility() end end, - ["SetVisibilityDirectly"] = function(self, visibility) - if self.data.parent and visibility ~= self.view.visibility then - self.view.visibility = visibility - self:UpdateViewTexture() - end - end, ["UpdateViewTexture"] = function(self) local visibility = self.view.visibility if(visibility == 2) then @@ -1520,8 +1639,10 @@ local methods = { self.view:Disable(); self.group:Disable(); self.ungroup:Disable(); - self.loaded:Disable(); self.expand:Disable(); + for _, button in ipairs(self.statusIcons.buttons) do + button:Disable(); + end self:UpdateUpDownButtons() end, ["Enable"] = function(self) @@ -1530,7 +1651,9 @@ local methods = { self.view:Enable(); self.group:Enable(); self.ungroup:Enable(); - self.loaded:Enable(); + for _, button in ipairs(self.statusIcons.buttons) do + button:Enable(); + end self:UpdateUpDownButtons() if not(self.expand.disabled) then self.expand:Enable(); @@ -1541,7 +1664,6 @@ local methods = { end, ["OnRelease"] = function(self) self:ReleaseThumbnail() - self:SetViewRegion(); self:Enable(); self:SetGroup(); self.renamebox:Hide(); @@ -1555,6 +1677,10 @@ local methods = { --self.frame:EnableMouse(false); self.frame:ClearAllPoints(); self.frame:Hide(); + for _, button in ipairs(self.statusIcons.buttons) do + statusIconPool:Release(button) + end + wipe(self.statusIcons.buttons) self.frame = nil; self.data = nil; end, @@ -1644,7 +1770,8 @@ Constructor local function Constructor() local name = "WeakAurasDisplayButton"..AceGUI:GetNextWidgetNum(Type); - local button = CreateFrame("BUTTON", name, UIParent, "OptionsListButtonTemplate"); + ---@class Button + local button = CreateFrame("Button", name, UIParent, "OptionsListButtonTemplate"); button:SetHeight(32); button:SetWidth(1000); button.dgroup = nil; @@ -1683,7 +1810,8 @@ local function Constructor() button.description = {}; - local view = CreateFrame("BUTTON", nil, button); + ---@class Button + local view = CreateFrame("Button", nil, button); button.view = view; view:SetWidth(16); view:SetHeight(16); @@ -1700,21 +1828,7 @@ local function Constructor() view.visibility = 0; - local loaded = CreateFrame("BUTTON", nil, button); - button.loaded = loaded; - loaded:SetWidth(16); - loaded:SetHeight(16); - loaded:SetPoint("BOTTOM", button, "BOTTOM"); - loaded:SetPoint("LEFT", icon, "RIGHT", 0, 0); - loaded:SetNormalTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Up.blp"); - loaded:SetDisabledTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Disabled.blp"); - --loaded:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp"); - loaded.title = L["Loaded"]; - loaded.desc = L["This display is currently loaded"]; - loaded:SetScript("OnEnter", function() Show_Tooltip(button, loaded.title, loaded.desc) end); - loaded:SetScript("OnLeave", Hide_Tooltip); - - local renamebox = CreateFrame("EDITBOX", nil, button, "InputBoxTemplate"); + local renamebox = CreateFrame("EditBox", nil, button, "WA_InputBoxTemplate"); renamebox:SetHeight(14); renamebox:SetPoint("TOP", button, "TOP"); renamebox:SetPoint("LEFT", icon, "RIGHT", 6, 0); @@ -1821,13 +1935,12 @@ local function Constructor() expand:SetScript("OnEnter", function() Show_Tooltip(button, expand.title, expand.desc) end); expand:SetScript("OnLeave", Hide_Tooltip); - local warning = CreateFrame("BUTTON", nil, button); - button.warning = warning - warning:SetWidth(16) - warning:SetHeight(16) - warning:SetPoint("RIGHT", button, "RIGHT", -60, 0) - warning:SetScript("OnLeave", Hide_Tooltip) - warning:Hide() + local statusIcons = CreateFrame("Frame", nil, button); + button.statusIcons = statusIcons + statusIcons:SetPoint("BOTTOM", button, "BOTTOM", 0, 1); + statusIcons:SetPoint("LEFT", icon, "RIGHT"); + statusIcons:SetSize(1,1) + statusIcons.buttons = {} local widget = { frame = button, @@ -1839,10 +1952,9 @@ local function Constructor() ungroup = ungroup, upgroup = upgroup, downgroup = downgroup, - loaded = loaded, background = background, expand = expand, - warning = warning, + statusIcons = statusIcons, type = Type, offset = offset } diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasLoadedHeaderButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasLoadedHeaderButton.lua index 9584878..a99a6dc 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasLoadedHeaderButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasLoadedHeaderButton.lua @@ -1,6 +1,6 @@ if not WeakAuras.IsCorrectVersion() then return end -local Type, Version = "WeakAurasLoadedHeaderButton", 20 +local Type, Version = "WeakAurasLoadedHeaderButton", 22 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -151,7 +151,7 @@ local function Constructor() button.background = background; background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp"); background:SetBlendMode("ADD"); - background:SetVertexColor(0.5, 0.5, 0.5, 0.25); + background:SetVertexColor(0.5, 0.5, 0.5, 0.6); background:SetAllPoints(button); local expand = CreateFrame("BUTTON", nil, button); @@ -179,7 +179,7 @@ local function Constructor() view:SetPoint("RIGHT", button, "RIGHT", -16, 0); local viewTexture = view:CreateTexture() view.texture = viewTexture; - viewTexture:SetTexture("Interface\\LFGFrame\\BattlenetWorking1.blp"); + viewTexture:SetTexture("Interface\\LFGFrame\\BattlenetWorking4.blp"); viewTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9); viewTexture:SetAllPoints(view); view:SetNormalTexture(viewTexture); diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasMultiLineEditBoxWithEnter.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasMultiLineEditBoxWithEnter.lua index 5714a10..eacbd81 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasMultiLineEditBoxWithEnter.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasMultiLineEditBoxWithEnter.lua @@ -84,6 +84,7 @@ end local function OnEditFocusLost(self) -- EditBox self:HighlightText(0, 0) self.obj:Fire("OnEditFocusLost") + self.obj.scrollFrame:EnableMouseWheel(false); end local function OnEnter(self) -- EditBox / ScrollFrame @@ -166,6 +167,7 @@ end local function OnEditFocusGained(frame) AceGUI:SetFocus(frame.obj) frame.obj:Fire("OnEditFocusGained") + frame.obj.scrollFrame:EnableMouseWheel(true); end --[[----------------------------------------------------------------------------- @@ -314,6 +316,7 @@ local function Constructor() scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4) local scrollFrame = CreateFrame("ScrollFrame", ("%s%dScrollFrame"):format(Type, widgetNum), frame, "UIPanelScrollFrameTemplate") + scrollFrame:EnableMouseWheel(false); local scrollBar = _G[scrollFrame:GetName() .. "ScrollBar"] scrollBar:ClearAllPoints() diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSnippetButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSnippetButton.lua index 74ae0cb..6d8564c 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSnippetButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSnippetButton.lua @@ -189,7 +189,7 @@ local function Constructor() deleteButton:SetPushedTexture(delPushed) button.deleteHighlight = delHighlight - local renameEditBox = CreateFrame("EditBox", nil, button, "InputBoxTemplate") + local renameEditBox = CreateFrame("EditBox", nil, button, "WA_InputBoxTemplate") renameEditBox:SetHeight(14) renameEditBox:SetPoint("TOPLEFT", title, "TOPLEFT") renameEditBox:SetPoint("BOTTOMRIGHT", title, "BOTTOMRIGHT") diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSpinBox.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSpinBox.lua index 28f2153..7864a06 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSpinBox.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasSpinBox.lua @@ -277,7 +277,7 @@ local methods = { Constructor -------------------------------------------------------------------------------]] local function Constructor() - local widgetName = ("%s%d"):format(Type, AceGUI:GetNextWidgetNum(Type)) -- Needs a name for 3.3.5 (InputBoxTemplate ($parent)) + local widgetName = ("%s%d"):format(Type, AceGUI:GetNextWidgetNum(Type)) local frame = CreateFrame("Frame", widgetName, UIParent) frame:SetScript("OnEnter", Frame_OnEnter) @@ -304,7 +304,7 @@ local function Constructor() rightbutton:SetDisabledTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\spinboxrightp") rightbutton:SetScript("OnClick", SpinBox_OnValueUp) - local editbox = CreateFrame("EditBox", nil, frame, "InputBoxTemplate") + local editbox = CreateFrame("EditBox", nil, frame, "WA_InputBoxTemplate") editbox:SetAutoFocus(false) editbox:SetFontObject(ChatFontNormal) editbox:SetHeight(19) diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTextureButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTextureButton.lua index 81e6b68..5db65ad 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTextureButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasTextureButton.lua @@ -1,6 +1,6 @@ if not WeakAuras.IsCorrectVersion() then return end -local Type, Version = "WeakAurasTextureButton", 23 +local Type, Version = "WeakAurasTextureButton", 25 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -96,7 +96,7 @@ local function Constructor() tile = true, tileSize = 16, edgeSize = 16, insets = { left = 4, right = 4, top = 4, bottom = 4 } }); - button:SetBackdropColor(0.1,0.1,0.1); + button:SetBackdropColor(0.1,0.1,0.1,0.2); button:SetBackdropBorderColor(0.4,0.4,0.4); local highlighttexture = button:CreateTexture(nil, "OVERLAY"); diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasToolbarButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasToolbarButton.lua index 5adf881..745ccc2 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasToolbarButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasToolbarButton.lua @@ -2,7 +2,7 @@ ToolbarButton Widget, based on AceGUI Button Graphical Button. -------------------------------------------------------------------------------]] -local Type, Version = "WeakAurasToolbarButton", 4 +local Type, Version = "WeakAurasToolbarButton", 6 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -23,10 +23,18 @@ local function Button_OnClick(frame, ...) end local function Control_OnEnter(frame) + if frame.tooltip then + GameTooltip:ClearLines() + GameTooltip:SetOwner(frame, "ANCHOR_NONE"); + GameTooltip:SetPoint("BOTTOM", frame, "TOP", 0, 5); + GameTooltip:AddLine(frame.tooltip) + GameTooltip:Show() + end frame.obj:Fire("OnEnter") end local function Control_OnLeave(frame) + GameTooltip:Hide() frame.obj:Fire("OnLeave") end @@ -54,6 +62,10 @@ local methods = { end end, + ["SetTooltip"] = function(self, text) + self.frame.tooltip = text + end, + ["SetDisabled"] = function(self, disabled) self.disabled = disabled if disabled then diff --git a/WeakAurasOptions/AnimationOptions.lua b/WeakAurasOptions/AnimationOptions.lua index d1f8a7c..89806d6 100644 --- a/WeakAurasOptions/AnimationOptions.lua +++ b/WeakAurasOptions/AnimationOptions.lua @@ -16,6 +16,7 @@ local setAll = OptionsPrivate.commonOptions.CreateSetAll("animation", getAll) local function filterAnimPresetTypes(intable, id) local ret = {}; + OptionsPrivate.Private.EnsureRegion(id) local region = WeakAuras.regions[id] and WeakAuras.regions[id].region; local regionType = WeakAuras.regions[id] and WeakAuras.regions[id].regionType; local data = WeakAuras.GetData(id); @@ -79,7 +80,8 @@ function OptionsPrivate.GetAnimationOptions(data) data.animation[field] = data.animation[field] or {}; data.animation[field][value] = v; if(field == "main") then - OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true); + local region = OptionsPrivate.Private.EnsureRegion(id) + OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, region, false, nil, true); if(WeakAuras.clones[id]) then for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId); @@ -148,7 +150,9 @@ function OptionsPrivate.GetAnimationOptions(data) order = 33, values = duration_types_no_choice, disabled = true, - hidden = function() return data.animation.start.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data) end, + hidden = function() + return data.animation.start.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data) + end, get = function() return "seconds" end }, start_duration_type = { @@ -157,7 +161,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Time in"], order = 33, values = duration_types, - hidden = function() return data.animation.start.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data) end + hidden = function() + return data.animation.start.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data) + end }, start_duration = { type = "input", @@ -275,7 +281,7 @@ function OptionsPrivate.GetAnimationOptions(data) hidden = function() return ( data.animation.start.type ~= "custom" - or not WeakAuras.regions[id].region.Scale + or not OptionsPrivate.Private.EnsureRegion(id).Scale ) end }, start_scaleType = { @@ -284,7 +290,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 43, values = anim_scale_types, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale) + end }, -- texteditor added below start_scalex = { @@ -297,7 +305,9 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 5, step = 0.01, bigStep = 0.1, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale) + end }, start_scaley = { type = "range", @@ -309,14 +319,18 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 5, step = 0.01, bigStep = 0.1, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale) + end }, start_use_rotate = { type = "toggle", width = WeakAuras.normalWidth, name = L["Rotate In"], order = 46, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate) + end }, start_rotateType = { type = "select", @@ -324,7 +338,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 47, values = anim_rotate_types, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate) + end }, -- texteditor added below start_rotate = { @@ -336,14 +352,18 @@ function OptionsPrivate.GetAnimationOptions(data) softMin = 0, softMax = 360, bigStep = 3, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate) + end }, start_use_color = { type = "toggle", width = WeakAuras.normalWidth, name = L["Color"], order = 48.2, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Color) end + hidden = function() + return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color) + end }, start_colorType = { type = "select", @@ -351,7 +371,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 48.5, values = anim_color_types, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Color) end + hidden = function() + return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color) + end }, -- texteditor added below start_color = { @@ -359,7 +381,9 @@ function OptionsPrivate.GetAnimationOptions(data) width = WeakAuras.doubleWidth, name = L["Color"], order = 49.5, - hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Color) end, + hidden = function() + return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color) + end, get = function() return data.animation.start.colorR, data.animation.start.colorG, @@ -401,7 +425,9 @@ function OptionsPrivate.GetAnimationOptions(data) order = 53, values = duration_types_no_choice, disabled = true, - hidden = function() return data.animation.main.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data) end, + hidden = function() + return data.animation.main.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data) + end, get = function() return "seconds" end }, main_duration_type = { @@ -410,7 +436,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Time in"], order = 53, values = duration_types, - hidden = function() return data.animation.main.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data) end + hidden = function() + return data.animation.main.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data) + end }, main_duration = { type = "input", @@ -528,7 +556,9 @@ function OptionsPrivate.GetAnimationOptions(data) width = WeakAuras.normalWidth, name = L["Zoom"], order = 62, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale) + end }, main_scaleType = { type = "select", @@ -536,7 +566,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 63, values = anim_scale_types, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale) + end }, -- texteditor added below main_scalex = { @@ -549,7 +581,9 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 5, step = 0.01, bigStep = 0.1, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale) + end }, main_scaley = { type = "range", @@ -561,14 +595,18 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 5, step = 0.01, bigStep = 0.1, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale) + end }, main_use_rotate = { type = "toggle", width = WeakAuras.normalWidth, name = L["Rotate"], order = 66, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate) + end }, main_rotateType = { type = "select", @@ -576,7 +614,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 67, values = anim_rotate_types, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate) + end }, -- text editor added below main_rotate = { @@ -588,14 +628,18 @@ function OptionsPrivate.GetAnimationOptions(data) softMin = 0, softMax = 360, bigStep = 3, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate) + end }, main_use_color = { type = "toggle", width = WeakAuras.normalWidth, name = L["Color"], order = 68.2, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Color) end + hidden = function() + return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color) + end }, main_colorType = { type = "select", @@ -603,7 +647,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 68.5, values = anim_color_types, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Color) end + hidden = function() + return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color) + end }, -- texteditor added below main_color = { @@ -611,7 +657,9 @@ function OptionsPrivate.GetAnimationOptions(data) width = WeakAuras.doubleWidth, name = L["Color"], order = 69.5, - hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Color) end, + hidden = function() + return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color) + end, get = function() return data.animation.main.colorR, data.animation.main.colorG, @@ -757,7 +805,9 @@ function OptionsPrivate.GetAnimationOptions(data) width = WeakAuras.normalWidth, name = L["Zoom Out"], order = 82, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale) + end }, finish_scaleType = { type = "select", @@ -765,7 +815,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 83, values = anim_scale_types, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale) + end }, -- texteditor added below finish_scalex = { @@ -778,7 +830,9 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 5, step = 0.01, bigStep = 0.1, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale) + end }, finish_scaley = { type = "range", @@ -790,14 +844,18 @@ function OptionsPrivate.GetAnimationOptions(data) softMax = 5, step = 0.01, bigStep = 0.1, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale) + end }, finish_use_rotate = { type = "toggle", width = WeakAuras.normalWidth, name = L["Rotate Out"], order = 86, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate) + end }, finish_rotateType = { type = "select", @@ -805,7 +863,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 87, values = anim_rotate_types, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate) + end }, -- texteditor added below finish_rotate = { @@ -817,14 +877,18 @@ function OptionsPrivate.GetAnimationOptions(data) softMin = 0, softMax = 360, bigStep = 3, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate) + end }, finish_use_color = { type = "toggle", width = WeakAuras.normalWidth, name = L["Color"], order = 88.2, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Color) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color) + end }, finish_colorType = { type = "select", @@ -832,7 +896,9 @@ function OptionsPrivate.GetAnimationOptions(data) name = L["Type"], order = 88.5, values = anim_color_types, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Color) end + hidden = function() + return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color) + end }, -- texteditor added below finish_color = { @@ -840,7 +906,9 @@ function OptionsPrivate.GetAnimationOptions(data) width = WeakAuras.doubleWidth, name = L["Color"], order = 89.5, - hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Color) end, + hidden = function() + return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color) + end, get = function() return data.animation.finish.colorR, data.animation.finish.colorG, @@ -858,106 +926,153 @@ function OptionsPrivate.GetAnimationOptions(data) } local function extraSetFunction() - OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true); + OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, + OptionsPrivate.Private.EnsureRegion(id), false, nil, true) if(WeakAuras.clones[id]) then for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do - OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId); + OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, + cloneRegion, false, nil, true, cloneId) end end end -- Text Editors for "start" local function hideStartAlphaFunc() - return data.animation.start.type ~= "custom" or data.animation.start.alphaType ~= "custom" or not data.animation.start.use_alpha + return data.animation.start.type ~= "custom" + or data.animation.start.alphaType ~= "custom" + or not data.animation.start.use_alpha end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_alphaFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", 35.3, hideStartAlphaFunc, {"animation", "start", "alphaFunc"}, false); local function hideStartTranslate() - return data.animation.start.type ~= "custom" or data.animation.start.translateType ~= "custom" or not data.animation.start.use_translate + return data.animation.start.type ~= "custom" + or data.animation.start.translateType ~= "custom" + or not data.animation.start.use_translate end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_translateFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", 39.3, hideStartTranslate, {"animation", "start", "translateFunc"}, false); local function hideStartScale() - return data.animation.start.type ~= "custom" or data.animation.start.scaleType ~= "custom" or not (data.animation.start.use_scale and WeakAuras.regions[id].region.Scale) + return data.animation.start.type ~= "custom" + or data.animation.start.scaleType ~= "custom" + or not (data.animation.start.use_scale and OptionsPrivate.Private.EnsureRegion(id).Scale) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_scaleFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size", 43.3, hideStartScale, {"animation", "start", "scaleFunc"}, false); local function hideStartRotateFunc() - return data.animation.start.type ~= "custom" or data.animation.start.rotateType ~= "custom" or not (data.animation.start.use_rotate and WeakAuras.regions[id].region.Rotate) + return data.animation.start.type ~= "custom" + or data.animation.start.rotateType ~= "custom" + or not (data.animation.start.use_rotate and OptionsPrivate.Private.EnsureRegion(id).Rotate) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_rotateFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", 47.3, hideStartRotateFunc, {"animation", "start", "rotateFunc"}, false); local function hideStartColorFunc() - return data.animation.start.type ~= "custom" or data.animation.start.colorType ~= "custom" or not (data.animation.start.use_color and WeakAuras.regions[id].region.Color) + return data.animation.start.type ~= "custom" + or data.animation.start.colorType ~= "custom" + or not (data.animation.start.use_color and OptionsPrivate.Private.EnsureRegion(id).Color) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_colorFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", 48.7, hideStartColorFunc, {"animation", "start", "colorFunc"}, false); -- Text Editors for "main" local function hideMainAlphaFunc() - return data.animation.main.type ~= "custom" or data.animation.main.alphaType ~= "custom" or not data.animation.main.use_alpha + return data.animation.main.type ~= "custom" + or data.animation.main.alphaType ~= "custom" + or not data.animation.main.use_alpha end local mainCodeOptions = { extraSetFunction = extraSetFunction } - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_alphaFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", 55.3, hideMainAlphaFunc, {"animation", "main", "alphaFunc"}, false, mainCodeOptions); local function hideMainTranslate() - return data.animation.main.type ~= "custom" or data.animation.main.translateType ~= "custom" or not data.animation.main.use_translate + return data.animation.main.type ~= "custom" + or data.animation.main.translateType ~= "custom" + or not data.animation.main.use_translate end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_translateFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", 59.3, hideMainTranslate, {"animation", "main", "translateFunc"}, false, mainCodeOptions); local function hideMainScale() - return data.animation.main.type ~= "custom" or data.animation.main.scaleType ~= "custom" or not (data.animation.main.use_scale and WeakAuras.regions[id].region.Scale) + return data.animation.main.type ~= "custom" + or data.animation.main.scaleType ~= "custom" + or not (data.animation.main.use_scale and OptionsPrivate.Private.EnsureRegion(id).Scale) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-sizes", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_scaleFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-sizes", 63.3, hideMainScale, {"animation", "main", "scaleFunc"}, false, mainCodeOptions); local function hideMainRotateFunc() - return data.animation.main.type ~= "custom" or data.animation.main.rotateType ~= "custom" or not (data.animation.main.use_rotate and WeakAuras.regions[id].region.Rotate) + return data.animation.main.type ~= "custom" + or data.animation.main.rotateType ~= "custom" + or not (data.animation.main.use_rotate and OptionsPrivate.Private.EnsureRegion(id).Rotate) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_rotateFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", 67.3, hideMainRotateFunc, {"animation", "main", "rotateFunc"}, false, mainCodeOptions); local function hideMainColorFunc() - return data.animation.main.type ~= "custom" or data.animation.main.colorType ~= "custom" or not (data.animation.main.use_color and WeakAuras.regions[id].region.Color) + return data.animation.main.type ~= "custom" + or data.animation.main.colorType ~= "custom" + or not (data.animation.main.use_color and OptionsPrivate.Private.EnsureRegion(id).Color) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_colorFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", 68.7, hideMainColorFunc, {"animation", "main", "colorFunc"}, false, mainCodeOptions); -- Text Editors for "finish" local function hideFinishAlphaFunc() - return data.animation.finish.type ~= "custom" or data.animation.finish.alphaType ~= "custom" or not data.animation.finish.use_alpha + return data.animation.finish.type ~= "custom" + or data.animation.finish.alphaType ~= "custom" + or not data.animation.finish.use_alpha end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_alphaFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", 75.3, hideFinishAlphaFunc, {"animation", "finish", "alphaFunc"}, false); local function hideFinishTranslate() - return data.animation.finish.type ~= "custom" or data.animation.finish.translateType ~= "custom" or not data.animation.finish.use_translate + return data.animation.finish.type ~= "custom" + or data.animation.finish.translateType ~= "custom" + or not data.animation.finish.use_translate end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_translateFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", 79.3, hideFinishTranslate, {"animation", "finish", "translateFunc"}, false); local function hideFinishScale() - return data.animation.finish.type ~= "custom" or data.animation.finish.scaleType ~= "custom" or not (data.animation.finish.use_scale and WeakAuras.regions[id].region.Scale) + return data.animation.finish.type ~= "custom" + or data.animation.finish.scaleType ~= "custom" + or not (data.animation.finish.use_scale and OptionsPrivate.Private.EnsureRegion(id).Scale) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_scaleFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size", 83.3, hideFinishScale, {"animation", "finish", "scaleFunc"}, false); local function hideFinishRotateFunc() - return data.animation.finish.type ~= "custom" or data.animation.finish.rotateType ~= "custom" or not (data.animation.finish.use_rotate and WeakAuras.regions[id].region.Rotate) + return data.animation.finish.type ~= "custom" + or data.animation.finish.rotateType ~= "custom" + or not (data.animation.finish.use_rotate and OptionsPrivate.Private.EnsureRegion(id).Rotate) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_rotateFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", 87.3, hideFinishRotateFunc, {"animation", "finish", "rotateFunc"}, false); local function hideFinishColorFunc() - return data.animation.finish.type ~= "custom" or data.animation.finish.colorType ~= "custom" or not (data.animation.finish.use_color and WeakAuras.regions[id].region.Color) + return data.animation.finish.type ~= "custom" + or data.animation.finish.colorType ~= "custom" + or not (data.animation.finish.use_color and OptionsPrivate.Private.EnsureRegion(id).Color) end - OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", + OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_colorFunc", + "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", 88.7, hideFinishColorFunc, {"animation", "finish", "colorFunc"}, false); if(data.controlledChildren) then diff --git a/WeakAurasOptions/CommonOptions.lua b/WeakAurasOptions/CommonOptions.lua index b662690..15fa934 100644 --- a/WeakAurasOptions/CommonOptions.lua +++ b/WeakAurasOptions/CommonOptions.lua @@ -936,7 +936,7 @@ end local function CreateSetAll(subOption, getAll) return function(data, info, ...) OptionsPrivate.Private.pauseOptionsProcessing(true); - OptionsPrivate.Private.PauseAllDynamicGroups() + local suspended = OptionsPrivate.Private.PauseAllDynamicGroups() local before = getAll(data, info, ...) for child in OptionsPrivate.Private.TraverseLeafs(data) do local childOptions = OptionsPrivate.EnsureOptions(child, subOption) @@ -974,7 +974,7 @@ local function CreateSetAll(subOption, getAll) end end - OptionsPrivate.Private.ResumeAllDynamicGroups() + OptionsPrivate.Private.ResumeAllDynamicGroups(suspended) OptionsPrivate.Private.pauseOptionsProcessing(false); OptionsPrivate.Private.ScanForLoads(); OptionsPrivate.SortDisplayButtons(nil, true); diff --git a/WeakAurasOptions/GenericTrigger.lua b/WeakAurasOptions/GenericTrigger.lua index a713b44..0731789 100644 --- a/WeakAurasOptions/GenericTrigger.lua +++ b/WeakAurasOptions/GenericTrigger.lua @@ -44,7 +44,7 @@ local function GetCustomTriggerOptions(data, triggernum) check = { type = "select", name = L["Check On..."], - width = WeakAuras.doubleWidth / 3, + width = WeakAuras.doubleWidth, order = 8, values = OptionsPrivate.Private.check_types, hidden = function() return not (trigger.type == "custom" @@ -75,7 +75,9 @@ local function GetCustomTriggerOptions(data, triggernum) }, events = { type = "input", - width = WeakAuras.doubleWidth * 2 / 3, + multiline = true, + control = "WeakAuras-MultiLineEditBoxWithEnter", + width = WeakAuras.doubleWidth, name = L["Event(s)"], desc = L["Custom trigger status tooltip"], order = 8.1, @@ -90,6 +92,8 @@ local function GetCustomTriggerOptions(data, triggernum) }, events2 = { type = "input", + multiline = true, + control = "WeakAuras-MultiLineEditBoxWithEnter", name = L["Event(s)"], desc = L["Custom trigger event tooltip"], width = WeakAuras.doubleWidth, @@ -105,6 +109,7 @@ local function GetCustomTriggerOptions(data, triggernum) type = "description", name = function() local events = trigger.custom_type == "event" and trigger.events2 or trigger.events + -- Check for errors for index, event in pairs(WeakAuras.split(events)) do local trueEvent for i in event:gmatch("[^:]+") do @@ -132,6 +137,13 @@ local function GetCustomTriggerOptions(data, triggernum) end end end + + -- Check for warnings + for _, event in pairs(WeakAuras.split(events)) do + if event == "CLEU" or event == "COMBAT_LOG_EVENT_UNFILTERED" then + return "|cFFFF0000"..L["COMBAT_LOG_EVENT_UNFILTERED with no filter can trigger frame drops in raid environment."] + end + end return "" end, width = WeakAuras.doubleWidth, @@ -146,6 +158,7 @@ local function GetCustomTriggerOptions(data, triggernum) return true end local events = trigger.custom_type == "event" and trigger.events2 or trigger.events + -- Check for errors for index, event in pairs(WeakAuras.split(events)) do local trueEvent for i in event:gmatch("[^:]+") do @@ -172,6 +185,12 @@ local function GetCustomTriggerOptions(data, triggernum) end end end + -- Check for warnings + for _, event in pairs(WeakAuras.split(events)) do + if event == "CLEU" or event == "COMBAT_LOG_EVENT_UNFILTERED" then + return false + end + end return true end }, diff --git a/WeakAurasOptions/OptionsFrames/CodeReview.lua b/WeakAurasOptions/OptionsFrames/CodeReview.lua index 3deedcd..d8a3a13 100644 --- a/WeakAurasOptions/OptionsFrames/CodeReview.lua +++ b/WeakAurasOptions/OptionsFrames/CodeReview.lua @@ -58,17 +58,11 @@ local colorScheme = { local function ConstructCodeReview(frame) local group = AceGUI:Create("WeakAurasInlineGroup"); group.frame:SetParent(frame); - group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16); - group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46); + group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -63); + group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 46); group.frame:Hide(); group:SetLayout("flow"); - local title = AceGUI:Create("Label") - title:SetFontObject(GameFontNormalHuge) - title:SetFullWidth(true) - title:SetText(L["Custom Code Viewer"]) - group:AddChild(title) - local codeTree = AceGUI:Create("TreeGroup"); codeTree:SetTreeWidth(300, false) codeTree:SetFullWidth(true) diff --git a/WeakAurasOptions/OptionsFrames/IconPicker.lua b/WeakAurasOptions/OptionsFrames/IconPicker.lua index e428b09..d7f7170 100644 --- a/WeakAurasOptions/OptionsFrames/IconPicker.lua +++ b/WeakAurasOptions/OptionsFrames/IconPicker.lua @@ -20,7 +20,7 @@ local spellCache = WeakAuras.spellCache local function ConstructIconPicker(frame) local group = AceGUI:Create("InlineGroup"); group.frame:SetParent(frame); - group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 30); -- 12 + group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 46); group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -50); group.frame:Hide(); group:SetLayout("fill"); @@ -95,23 +95,21 @@ local function ConstructIconPicker(frame) end end - local input = CreateFrame("EDITBOX", "WeakAurasIconFilterInput", group.frame, "InputBoxTemplate"); + local input = CreateFrame("Editbox", "WeakAurasIconFilterInput", group.frame, "WA_InputBoxTemplate"); input:SetScript("OnTextChanged", function(...) iconPickerFill(input:GetText(), false); end); input:SetScript("OnEnterPressed", function(...) iconPickerFill(input:GetText(), true); end); input:SetScript("OnEscapePressed", function(...) input:SetText(""); iconPickerFill(input:GetText(), true); end); - input:SetWidth(170); + input:SetWidth(200); input:SetHeight(15); - input:SetPoint("BOTTOMRIGHT", group.frame, "TOPRIGHT", -12, -5); - - local inputLabel = input:CreateFontString(nil, "OVERLAY", "GameFontNormal"); - inputLabel:SetText(L["Search"]); - inputLabel:SetJustifyH("RIGHT"); - inputLabel:SetPoint("BOTTOMLEFT", input, "TOPLEFT", 0, 5); + input:SetFont(STANDARD_TEXT_FONT, 10) + input:SetPoint("BOTTOMRIGHT", group.frame, "TOPRIGHT", -3, -10); local icon = AceGUI:Create("WeakAurasIconButton"); icon.frame:Disable(); icon.frame:SetParent(group.frame); - icon.frame:SetPoint("BOTTOMLEFT", group.frame, "TOPLEFT", 15, -15); + icon.frame:SetPoint("BOTTOMLEFT", group.frame, "TOPLEFT", 44, -15); + icon:SetHeight(36) + icon:SetWidth(36) local iconLabel = input:CreateFontString(nil, "OVERLAY", "GameFontNormalHuge"); iconLabel:SetNonSpaceWrap("true"); @@ -194,7 +192,7 @@ local function ConstructIconPicker(frame) local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); cancel:SetScript("OnClick", group.CancelClose); - cancel:SetPoint("bottomright", frame, "bottomright", -27, 11); + cancel:SetPoint("BOTTOMRIGHT", -20, -24) cancel:SetHeight(20); cancel:SetWidth(100); cancel:SetText(L["Cancel"]); diff --git a/WeakAurasOptions/OptionsFrames/ImportExport.lua b/WeakAurasOptions/OptionsFrames/ImportExport.lua index f04d74c..319923e 100644 --- a/WeakAurasOptions/OptionsFrames/ImportExport.lua +++ b/WeakAurasOptions/OptionsFrames/ImportExport.lua @@ -17,16 +17,11 @@ local importexport local function ConstructImportExport(frame) local group = AceGUI:Create("WeakAurasInlineGroup"); group.frame:SetParent(frame); - group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16); + group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -63); group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46); group.frame:Hide(); group:SetLayout("flow"); - local title = AceGUI:Create("Label") - title:SetFontObject(GameFontNormalHuge) - title:SetFullWidth(true) - group:AddChild(title) - local input = AceGUI:Create("MultiLineEditBox"); input:DisableButton(true) input:SetFullWidth(true) @@ -52,7 +47,7 @@ local function ConstructImportExport(frame) frame.window = "importexport"; frame:UpdateFrameVisible() if(mode == "export" or mode == "table") then - title:SetText(L["Exporting"]) + OptionsPrivate.SetTitle(L["Exporting"]) if(id) then local displayStr; if(mode == "export") then @@ -71,7 +66,7 @@ local function ConstructImportExport(frame) input:SetFocus(); end elseif(mode == "import") then - title:SetText(L["Importing"]) + OptionsPrivate.SetTitle(L["Importing"]) input.editBox:SetScript("OnTextChanged", function(self) local pasted = self:GetText() pasted = pasted:match("^%s*(.-)%s*$") diff --git a/WeakAurasOptions/OptionsFrames/ModelPicker.lua b/WeakAurasOptions/OptionsFrames/ModelPicker.lua index 5f56eb9..066c744 100644 --- a/WeakAurasOptions/OptionsFrames/ModelPicker.lua +++ b/WeakAurasOptions/OptionsFrames/ModelPicker.lua @@ -2,7 +2,7 @@ if not WeakAuras.IsCorrectVersion() then return end local AddonName, OptionsPrivate = ... -- Lua APIs -local pairs, rad = pairs, rad +local rad = rad -- WoW APIs local CreateFrame = CreateFrame @@ -50,14 +50,14 @@ local function ConstructModelPicker(frame) end end - local group = AceGUI:Create("InlineGroup"); + local group = AceGUI:Create("SimpleGroup"); group.frame:SetParent(frame); group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 87); - group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -15); + group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -63); group.frame:Hide(); group:SetLayout("flow"); - local filterInput = CreateFrame("editbox", "WeakAurasModelFilterInput", group.frame, "InputBoxTemplate") + local filterInput = CreateFrame("editbox", "WeakAurasModelFilterInput", group.frame, "WA_InputBoxTemplate") filterInput:SetAutoFocus(false) filterInput:SetTextInsets(16, 20, 0, 0) @@ -123,8 +123,7 @@ local function ConstructModelPicker(frame) group.modelTree:RefreshTree() end) filterInput:SetHeight(15) - filterInput:SetPoint("TOP", group.frame, "TOP", 0, 1) - filterInput:SetPoint("LEFT", group.frame, "LEFT", 7, 0) + filterInput:SetPoint("BOTTOMRIGHT", group.frame, "TOPRIGHT", -3, 5) filterInput:SetWidth(200) filterInput:SetFont(STANDARD_TEXT_FONT, 10) group.frame.filterInput = filterInput @@ -355,7 +354,7 @@ local function ConstructModelPicker(frame) local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); cancel:SetScript("OnClick", group.CancelClose); - cancel:SetPoint("bottomright", frame, "bottomright", -27, 16); + cancel:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -27, 20); cancel:SetHeight(20); cancel:SetWidth(100); cancel:SetText(L["Cancel"]); diff --git a/WeakAurasOptions/OptionsFrames/MoverSizer.lua b/WeakAurasOptions/OptionsFrames/MoverSizer.lua index a550770..25e4855 100644 --- a/WeakAurasOptions/OptionsFrames/MoverSizer.lua +++ b/WeakAurasOptions/OptionsFrames/MoverSizer.lua @@ -383,7 +383,7 @@ local function BuildAlignLines(mover) end for k, v in pairs(WeakAuras.displayButtons) do - local region = v.view.region + local region = WeakAuras.GetRegion(v.data.id) if not skipIds[k] and v.view.visibility ~= 0 and region then local scale = region:GetEffectiveScale() / UIParent:GetEffectiveScale() if not IsControlKeyDown() then @@ -652,7 +652,8 @@ local function ConstructMoverSizer(parent) end OptionsPrivate.Private.AddParents(data) WeakAuras.FillOptions() - OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true) + OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, + OptionsPrivate.Private.EnsureRegion(data.id), false, nil, true) -- hide alignment lines frame.lineY:Hide() frame.lineX:Hide() @@ -776,7 +777,8 @@ local function ConstructMoverSizer(parent) frame.text:Hide() frame:SetScript("OnUpdate", nil) WeakAuras.FillOptions() - OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true) + OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, + OptionsPrivate.Private.EnsureRegion(data.id), false, nil, true) -- hide alignment lines frame.lineY:Hide() frame.lineX:Hide() diff --git a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua index 29af502..1bb0e19 100644 --- a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua +++ b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua @@ -11,8 +11,8 @@ local GetScreenWidth, GetScreenHeight, CreateFrame, GetAddOnInfo, PlaySound, IsA = GetScreenWidth, GetScreenHeight, CreateFrame, GetAddOnInfo, PlaySound, IsAddOnLoaded, LoadAddOn, UnitName local AceGUI = LibStub("AceGUI-3.0") -local AceConfig = LibStub("AceConfig-3.0") local AceConfigDialog = LibStub("AceConfigDialog-3.0") +local AceConfigRegistry = LibStub("AceConfigRegistry-3.0") local WeakAuras = WeakAuras local L = WeakAuras.L @@ -22,71 +22,26 @@ local regionOptions = WeakAuras.regionOptions local tempGroup = OptionsPrivate.tempGroup local aceOptions = {} -local function CreateDecoration(frame) - local deco = CreateFrame("Frame", nil, frame) - deco:SetSize(17, 40) - - local bg1 = deco:CreateTexture(nil, "BACKGROUND") - bg1:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header") - bg1:SetTexCoord(0.31, 0.67, 0, 0.63) - bg1:SetAllPoints(deco) - - local bg2 = deco:CreateTexture(nil, "BACKGROUND") - bg2:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header") - bg2:SetTexCoord(0.235, 0.275, 0, 0.63) - bg2:SetPoint("RIGHT", bg1, "LEFT") - bg2:SetSize(10, 40) - - local bg3 = deco:CreateTexture(nil, "BACKGROUND") - bg3:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header") - bg3:SetTexCoord(0.72, 0.76, 0, 0.63) - bg3:SetPoint("LEFT", bg1, "RIGHT") - bg3:SetSize(10, 40) - - return deco -end - -local function CreateDecorationWide(frame, width) - local deco1 = frame:CreateTexture(nil, "OVERLAY") - deco1:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header") - deco1:SetTexCoord(0.31, 0.67, 0, 0.63) - deco1:SetSize(width, 40) - - local deco2 = frame:CreateTexture(nil, "OVERLAY") - deco2:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header") - deco2:SetTexCoord(0.21, 0.31, 0, 0.63) - deco2:SetPoint("RIGHT", deco1, "LEFT") - deco2:SetSize(30, 40) - - local deco3 = frame:CreateTexture(nil, "OVERLAY") - deco3:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header") - deco3:SetTexCoord(0.67, 0.77, 0, 0.63) - deco3:SetPoint("LEFT", deco1, "RIGHT") - deco3:SetSize(30, 40) - - return deco1 -end - local function CreateFrameSizer(frame, callback, position) callback = callback or (function() end) local left, right, top, bottom, xOffset1, yOffset1, xOffset2, yOffset2 if position == "BOTTOMLEFT" then left, right, top, bottom = 1, 0, 0, 1 - xOffset1, yOffset1 = 6, 6 + xOffset1, yOffset1 = 1, 1 xOffset2, yOffset2 = 0, 0 elseif position == "BOTTOMRIGHT" then left, right, top, bottom = 0, 1, 0, 1 - xOffset1, yOffset1 = 0, 6 - xOffset2, yOffset2 = -6, 0 + xOffset1, yOffset1 = 0, 1 + xOffset2, yOffset2 = -1, 0 elseif position == "TOPLEFT" then left, right, top, bottom = 1, 0, 1, 0 - xOffset1, yOffset1 = 6, 0 - xOffset2, yOffset2 = 0, -6 + xOffset1, yOffset1 = 1, 0 + xOffset2, yOffset2 = 0, -1 elseif position == "TOPRIGHT" then left, right, top, bottom = 0, 1, 1, 0 xOffset1, yOffset1 = 0, 0 - xOffset2, yOffset2 = -6, -6 + xOffset2, yOffset2 = -1, -1 end local handle = CreateFrame("BUTTON", nil, frame) @@ -133,45 +88,52 @@ local minWidth = 750 local minHeight = 240 function OptionsPrivate.CreateFrame() - local WeakAuras_DropDownMenu = CreateFrame("frame", "WeakAuras_DropDownMenu", nil, "UIDropDownMenuTemplate") + CreateFrame("frame", "WeakAuras_DropDownMenu", nil, "UIDropDownMenuTemplate") local frame local db = OptionsPrivate.savedVars.db local odb = OptionsPrivate.savedVars.odb - -------- Mostly Copied from AceGUIContainer-Frame-------- - frame = CreateFrame("FRAME", "WeakAurasOptions", UIParent) + + frame = CreateFrame("Frame", "WeakAurasOptions", UIParent, "WA_PortraitFrameTemplate") + + function OptionsPrivate.SetTitle(title) + local text = "WeakAuras " .. WeakAuras.versionString + if title and title ~= "" then + text = ("%s - %s"):format(text, title) + end + WeakAurasOptionsTitleText:SetText(text) + end tinsert(UISpecialFrames, frame:GetName()) - frame:SetBackdrop({ - bgFile = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_FullWhite", - edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", - tile = true, - tileSize = 32, - edgeSize = 32, - insets = { left = 8, right = 8, top = 8, bottom = 8 } - }) - frame:SetBackdropColor(0.1, 0.1, 0.1, 0.85) frame:EnableMouse(true) frame:SetMovable(true) frame:SetResizable(true) frame:SetMinResize(minWidth, minHeight) frame:SetFrameStrata("DIALOG") + frame.PortraitContainer.portrait:SetTexture([[Interface\AddOns\WeakAuras\Media\Textures\logo_256_round.tga]]) frame.window = "default" local xOffset, yOffset + if db.frame then - xOffset, yOffset = db.frame.xOffset, db.frame.yOffset + -- Convert from old settings to new + odb.frame = db.frame + if odb.frame.xOffset and odb.frame.yOffset then + odb.frame.xOffset = odb.frame.xOffset + GetScreenWidth() - (odb.frame.width or defaultWidth) / 2 + odb.frame.yOffset = odb.frame.yOffset + GetScreenHeight() + end + db.frame = nil end if not (xOffset and yOffset) then - xOffset = (defaultWidth - GetScreenWidth()) / 2 - yOffset = (defaultHeight - GetScreenHeight()) / 2 + xOffset = GetScreenWidth() / 2 + yOffset = GetScreenHeight() - defaultHeight / 2 end - frame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", xOffset, yOffset) + frame:SetPoint("TOP", UIParent, "BOTTOMLEFT", xOffset, yOffset) frame:Hide() frame:SetScript("OnHide", function() - OptionsPrivate.Private.PauseAllDynamicGroups() + local suspended = OptionsPrivate.Private.PauseAllDynamicGroups() OptionsPrivate.Private.ClearFakeStates() @@ -187,7 +149,7 @@ function OptionsPrivate.CreateFrame() end end - OptionsPrivate.Private.ResumeAllDynamicGroups() + OptionsPrivate.Private.ResumeAllDynamicGroups(suspended) OptionsPrivate.Private.Resume() if OptionsPrivate.Private.mouseFrame then @@ -201,8 +163,8 @@ function OptionsPrivate.CreateFrame() local width, height - if db.frame then - width, height = db.frame.width, db.frame.height + if odb.frame then + width, height = odb.frame.width, odb.frame.height end if not (width and height) then @@ -214,65 +176,34 @@ function OptionsPrivate.CreateFrame() frame:SetWidth(width) frame:SetHeight(height) - local close = CreateDecoration(frame) - close:SetPoint("TOPRIGHT", -30, 12) - - local closebutton = CreateFrame("BUTTON", nil, close, "UIPanelCloseButton") - closebutton:SetPoint("CENTER", close, "CENTER", 1, -1) - closebutton:SetScript("OnClick", WeakAuras.HideOptions) - - local title = CreateFrame("Frame", nil, frame) - - local titleText = title:CreateFontString(nil, "OVERLAY", "GameFontNormal") - - titleText:SetText("WeakAuras " .. WeakAuras.versionString) - - local titleBG = CreateDecorationWide(frame, max(120, titleText:GetWidth())) - titleBG:SetPoint("TOP", 0, 24) - titleText:SetPoint("TOP", titleBG, "TOP", 0, -14) - + OptionsPrivate.SetTitle() local function commitWindowChanges() - local xOffset = frame:GetRight() - GetScreenWidth() - local yOffset = frame:GetTop() - GetScreenHeight() - if title:GetRight() > GetScreenWidth() then - xOffset = xOffset + (GetScreenWidth() - title:GetRight()) - elseif title:GetLeft() < 0 then - xOffset = xOffset + (0 - title:GetLeft()) - end - if title:GetTop() > GetScreenHeight() then - yOffset = yOffset + (GetScreenHeight() - title:GetTop()) - elseif title:GetBottom() < 0 then - yOffset = yOffset + (0 - title:GetBottom()) - end - db.frame = db.frame or {} - db.frame.xOffset = xOffset - db.frame.yOffset = yOffset if not frame.minimized then - db.frame.width = frame:GetWidth() - db.frame.height = frame:GetHeight() + local xOffset = frame:GetRight()-(frame:GetWidth()/2) + local yOffset = frame:GetTop() + odb.frame = odb.frame or {} + odb.frame.xOffset = xOffset + odb.frame.yOffset = yOffset + odb.frame.width = frame:GetWidth() + odb.frame.height = frame:GetHeight() end - frame:ClearAllPoints() - frame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", xOffset, yOffset) end - title:EnableMouse(true) - title:SetScript("OnMouseDown", function() frame:StartMoving() end) - title:SetScript("OnMouseUp", function() + frame:SetScript("OnMouseDown", function() + frame:StartMoving() + end) + frame:SetScript("OnMouseUp", function() frame:StopMovingOrSizing() commitWindowChanges() end) - title:SetPoint("BOTTOMLEFT", titleBG, "BOTTOMLEFT", -25, 0) - title:SetPoint("TOPRIGHT", titleBG, "TOPRIGHT", 25, 0) - frame.bottomLeftResizer = CreateFrameSizer(frame, commitWindowChanges, "BOTTOMLEFT") frame.bottomRightResizer = CreateFrameSizer(frame, commitWindowChanges, "BOTTOMRIGHT") - local minimize = CreateDecoration(frame) - minimize:SetPoint("TOPRIGHT", -65, 12) - frame.UpdateFrameVisible = function(self) + self.tipPopup:Hide() if self.minimized then + WeakAurasOptionsTitleText:Hide() self.buttonsContainer.frame:Hide() self.texturePicker.frame:Hide() self.iconPicker.frame:Hide() @@ -287,64 +218,68 @@ function OptionsPrivate.CreateFrame() self.container.frame:Hide() self.loadProgress:Hide() - self.toolbarContainer.frame:Hide() + self.toolbarContainer:Hide() self.filterInput:Hide(); - self.tipFrame.frame:Hide() - self.bottomLeftResizer:Hide() + self.tipFrame:Hide() + self:HideTip() self.bottomRightResizer:Hide() else - self.bottomLeftResizer:Show() + WeakAurasOptionsTitleText:Show() self.bottomRightResizer:Show() if self.window == "default" then + OptionsPrivate.SetTitle() self.buttonsContainer.frame:Show() self.container.frame:Show() - if self.tipFrameIsVisible then - self.tipFrame.frame:Show() - else - self.tipFrame.frame:Hide() - end + self:ShowTip() else self.buttonsContainer.frame:Hide() self.container.frame:Hide() - self.tipFrame.frame:Hide() + self:HideTip() end if self.window == "texture" then + OptionsPrivate.SetTitle(L["Texture Picker"]) self.texturePicker.frame:Show() else self.texturePicker.frame:Hide() end if self.window == "icon" then + OptionsPrivate.SetTitle(L["Icon Picker"]) self.iconPicker.frame:Show() else self.iconPicker.frame:Hide() end if self.window == "model" then + OptionsPrivate.SetTitle(L["Model Picker"]) self.modelPicker.frame:Show() else self.modelPicker.frame:Hide() end if self.window == "importexport" then + OptionsPrivate.SetTitle(L["Import / Export"]) self.importexport.frame:Show() else self.importexport.frame:Hide() end if self.window == "texteditor" then + OptionsPrivate.SetTitle(L["Code Editor"]) self.texteditor.frame:Show() else self.texteditor.frame:Hide() end if self.window == "codereview" then + OptionsPrivate.SetTitle(L["Custom Code Viewer"]) self.codereview.frame:Show() else self.codereview.frame:Hide() end if self.window == "newView" then + OptionsPrivate.SetTitle(L["New Template"]) self.newView.frame:Show() else if self.newView then @@ -352,6 +287,7 @@ function OptionsPrivate.CreateFrame() end end if self.window == "update" then + OptionsPrivate.SetTitle(L["Update"]) self.update.frame:Show() else self.update.frame:Hide() @@ -359,60 +295,52 @@ function OptionsPrivate.CreateFrame() if self.window == "default" then if self.loadProgessVisible then self.loadProgress:Show() - self.toolbarContainer.frame:Hide() + self.toolbarContainer:Hide() self.filterInput:Hide(); else self.loadProgress:Hide() - self.toolbarContainer.frame:Show() + self.toolbarContainer:Show() self.filterInput:Show(); --self.filterInputClear:Show(); end else self.loadProgress:Hide() - self.toolbarContainer.frame:Hide() + self.toolbarContainer:Hide() self.filterInput:Hide(); end end end - local minimizebutton = CreateFrame("BUTTON", nil, minimize) - minimizebutton:SetWidth(30) - minimizebutton:SetHeight(30) - minimizebutton:SetPoint("CENTER", minimize, "CENTER", 1, -1) - minimizebutton:SetNormalTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Up.blp") - minimizebutton:SetPushedTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Down.blp") - minimizebutton:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp") - minimizebutton:SetScript("OnClick", function() - if frame.minimized then - frame.minimized = nil - if db.frame then - if not db.frame.height or db.frame.height < 240 then - db.frame.height = 500 - end - end - frame:SetHeight(db.frame and db.frame.height or 500) - minimizebutton:SetNormalTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Up.blp") - minimizebutton:SetPushedTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Down.blp") - - frame.buttonsScroll:DoLayout() - else - frame.minimized = true - frame:SetHeight(40) - minimizebutton:SetNormalTexture("Interface\\BUTTONS\\UI-Panel-ExpandButton-Up.blp") - minimizebutton:SetPushedTexture("Interface\\BUTTONS\\UI-Panel-ExpandButton-Down.blp") - end + local minimizebutton = CreateFrame("Button", nil, frame, "WA_MaximizeMinimizeButtonFrameTemplate") + minimizebutton:SetPoint("RIGHT", frame.CloseButton, "LEFT", 0, 0) + minimizebutton:SetOnMaximizedCallback(function() + frame.minimized = false + local right, top = frame:GetRight(), frame:GetTop() + frame:ClearAllPoints() + frame:SetPoint("TOPRIGHT", UIParent, "BOTTOMLEFT", right, top) + frame:SetHeight(odb.frame and odb.frame.height or defaultHeight) + frame:SetWidth(odb.frame and odb.frame.width or defaultWidth) + frame.buttonsScroll:DoLayout() + frame:UpdateFrameVisible() + end) + minimizebutton:SetOnMinimizedCallback(function() + commitWindowChanges() + frame.minimized = true + local right, top = frame:GetRight(), frame:GetTop() + frame:ClearAllPoints() + frame:SetPoint("TOPRIGHT", UIParent, "BOTTOMLEFT", right, top) + frame:SetHeight(75) + frame:SetWidth(160) frame:UpdateFrameVisible() end) - local tipFrame = AceGUI:Create("SimpleGroup") - tipFrame.frame:SetParent(frame) - tipFrame:SetLayout("Flow") - tipFrame.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 22, 15) - tipFrame.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 15) - tipFrame.frame:Hide() + local tipFrame = CreateFrame("Frame", nil, frame) + tipFrame:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", 17, 30) + tipFrame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10) + tipFrame:Hide() frame.tipFrame = tipFrame - local tipPopup = CreateFrame("Frame", nil, frame) + local tipPopup = CreateFrame("Frame", "WeakAuras_TipPopup", frame) tipPopup:SetFrameStrata("FULLSCREEN") tipPopup:SetBackdrop({ bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", @@ -425,6 +353,7 @@ function OptionsPrivate.CreateFrame() tipPopup:SetBackdropColor(0, 0, 0, 0.8) --tipPopup:SetHeight(100) tipPopup:Hide() + frame.tipPopup = tipPopup local tipPopupTitle = tipPopup:CreateFontString(nil, "BACKGROUND", "GameFontNormalLarge") tipPopupTitle:SetPoint("TOPLEFT", tipPopup, "TOPLEFT", 10, -10) @@ -438,7 +367,7 @@ function OptionsPrivate.CreateFrame() tipPopupLabel:SetJustifyH("LEFT") tipPopupLabel:SetJustifyV("TOP") - local urlWidget = CreateFrame("EDITBOX", nil, tipPopup, "InputBoxTemplate") + local urlWidget = CreateFrame("EDITBOX", nil, tipPopup, "WA_InputBoxTemplate") urlWidget:SetFont(STANDARD_TEXT_FONT, 12) urlWidget:SetPoint("TOPLEFT", tipPopupLabel, "BOTTOMLEFT", 6, 0) urlWidget:SetPoint("TOPRIGHT", tipPopupLabel, "BOTTOMRIGHT", 0, 0) @@ -454,7 +383,7 @@ function OptionsPrivate.CreateFrame() tipPopupCtrlC:SetJustifyV("TOP") tipPopupCtrlC:SetText(L["Press Ctrl+C to copy the URL"]) - local function ToggleTip(referenceWidget, url, title, description) + local function ToggleTip(referenceWidget, url, title, description, rightAligned) if tipPopup:IsVisible() and urlWidget.text == url then tipPopup:Hide() return @@ -468,60 +397,71 @@ function OptionsPrivate.CreateFrame() tipPopup:SetWidth(400) tipPopup:SetHeight(26 + tipPopupTitle:GetHeight() + tipPopupLabel:GetHeight() + urlWidget:GetHeight() + tipPopupCtrlC:GetHeight()) - tipPopup:SetPoint("BOTTOMLEFT", referenceWidget.frame, "TOPLEFT", -6, 4) + tipPopup:ClearAllPoints(); + if rightAligned then + tipPopup:SetPoint("BOTTOMRIGHT", referenceWidget, "TOPRIGHT", 6, 4) + else + tipPopup:SetPoint("BOTTOMLEFT", referenceWidget, "TOPLEFT", -6, 4) + end tipPopup:Show() end + OptionsPrivate.ToggleTip = ToggleTip - local addFooter = function(title, texture, url, description) + local addFooter = function(title, texture, url, description, rightAligned) local button = AceGUI:Create("WeakAurasToolbarButton") button:SetText(title) button:SetTexture(texture) button:SetCallback("OnClick", function() - ToggleTip(button, url, title, description) + ToggleTip(button.frame, url, title, description, rightAligned) end) - tipFrame:AddChild(button) + button.frame:Show() + return button.frame end - addFooter(L["Get Help"], [[Interface\AddOns\WeakAuras\Media\Textures\discord.tga]], "https://discord.gg/UXSc7nt", + local discordButton = addFooter(L["Join Discord"], [[Interface\AddOns\WeakAuras\Media\Textures\discord.tga]], "https://discord.gg/UXSc7nt", L["Chat with WeakAuras experts on our Discord server."]) + discordButton:SetParent(tipFrame) + discordButton:SetPoint("LEFT", tipFrame, "LEFT") - addFooter(L["Documentation"], [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/WeakAuras/WeakAuras2/wiki", + local documentationButton = addFooter(L["Documentation"], [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/WeakAuras/WeakAuras2/wiki", L["Check out our wiki for a large collection of examples and snippets."]) + documentationButton:SetParent(tipFrame) + documentationButton:SetPoint("LEFT", discordButton, "RIGHT", 10, 0) + local awesomeWotlkButton if not WeakAuras.isAwesomeEnabled() then - addFooter("Awesome WotLK", [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/FrostAtom/awesome_wotlk", + awesomeWotlkButton = addFooter("Awesome WotLK", [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/FrostAtom/awesome_wotlk", L["Unlock Nameplate units in WeakAuras with awesome_wotlk binary patch!"]) + awesomeWotlkButton:SetParent(tipFrame) + awesomeWotlkButton:SetPoint("LEFT", documentationButton, "RIGHT", 10, 0) end - addFooter(L["Find Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_logo.tga]], "https://wago.io", - L["Browse Wago, the largest collection of auras."]) + local reportbugButton = addFooter(L["Found a Bug?"], [[Interface\AddOns\WeakAuras\Media\Textures\bug_report.tga]], "https://github.com/Bunny67/WeakAuras-WotLK/issues/new?assignees=&labels=bug&template=bug_report.md&title=", + L["Report bugs on our issue tracker."], true) + reportbugButton:SetParent(tipFrame) + reportbugButton:SetPoint("RIGHT", tipFrame, "RIGHT") + local wagoButton = addFooter(L["Find Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wago.tga]], "https://wago.io", + L["Browse Wago, the largest collection of auras."], true) + wagoButton:SetParent(tipFrame) + wagoButton:SetPoint("RIGHT", reportbugButton, "LEFT", -10, 0) + + local companionButton if not OptionsPrivate.Private.CompanionData.slugs then - addFooter(L["Update Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_refresh.tga]], "https://weakauras.wtf", + companionButton = addFooter(L["Update Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_refresh.tga]], "https://weakauras.wtf", L["Keep your Wago imports up to date with the Companion App."]) + companionButton:SetParent(tipFrame) + companionButton:SetPoint("RIGHT", wagoButton, "LEFT", -10, 0) end - addFooter(L["Found a Bug?"], [[Interface\AddOns\WeakAuras\Media\Textures\bug_report.tga]], "https://github.com/Bunny67/WeakAuras-WotLK/issues/new?assignees=&labels=bug&template=bug_report.md&title=", - L["Report bugs on our issue tracker."]) - - -- Disable for now - --local closeTipButton = CreateFrame("Button", nil, tipFrame.frame, "UIPanelCloseButton") - --closeTipButton:SetScript("OnClick", function() - -- frame:HideTip() - --end) - --closeTipButton:SetPoint("TOPRIGHT", tipFrame.frame, "TOPRIGHT", 0, 6) - --closeTipButton:Show() - frame.ShowTip = function(self) - self.tipFrameIsVisible = true - self.tipFrame.frame:Show() + self.tipFrame:Show() self.buttonsContainer.frame:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 17, 30) self.container.frame:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -17, 28) end frame.HideTip = function(self) - self.tipFrameIsVisible = false - self.tipFrame.frame:Hide() + self.tipFrame:Hide() self.buttonsContainer.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 17, 12) self.container.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10) end @@ -530,12 +470,12 @@ function OptionsPrivate.CreateFrame() local container = AceGUI:Create("InlineGroup") container.frame:SetParent(frame) container.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10) - container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -14) + container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, 0) container.frame:Show() container.titletext:Hide() -- Hide the border container.content:GetParent():SetBackdrop(nil) - container.content:SetPoint("TOPLEFT", 0, 0) + container.content:SetPoint("TOPLEFT", 0, -28) container.content:SetPoint("BOTTOMRIGHT", 0, 0) frame.container = container @@ -550,7 +490,7 @@ function OptionsPrivate.CreateFrame() frame.moversizer, frame.mover = OptionsPrivate.MoverSizer(frame) -- filter line - local filterInput = CreateFrame("editbox", "WeakAurasFilterInput", frame, "InputBoxTemplate") + local filterInput = CreateFrame("editbox", "WeakAurasFilterInput", frame, "WA_InputBoxTemplate") filterInput:SetAutoFocus(false) filterInput:SetTextInsets(16, 20, 0, 0) @@ -613,9 +553,9 @@ function OptionsPrivate.CreateFrame() OptionsPrivate.SortDisplayButtons(filterInput:GetText()) end) filterInput:SetHeight(15) - filterInput:SetPoint("TOP", frame, "TOP", 0, -44) + filterInput:SetPoint("TOP", frame, "TOP", 0, -65) filterInput:SetPoint("LEFT", frame, "LEFT", 24, 0) - filterInput:SetPoint("RIGHT", container.frame, "LEFT", -5, 0) + filterInput:SetPoint("RIGHT", container.frame, "LEFT", -2, 0) filterInput:SetFont(STANDARD_TEXT_FONT, 10) frame.filterInput = filterInput filterInput:Hide() @@ -625,53 +565,36 @@ function OptionsPrivate.CreateFrame() buttonsContainer:SetWidth(170) buttonsContainer.frame:SetParent(frame) buttonsContainer.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 17, 12) - buttonsContainer.frame:SetPoint("TOP", frame, "TOP", 0, -46) + buttonsContainer.frame:SetPoint("TOP", frame, "TOP", 0, -67) buttonsContainer.frame:SetPoint("RIGHT", container.frame, "LEFT", -17) buttonsContainer.frame:Show() frame.buttonsContainer = buttonsContainer -- Toolbar - local toolbarContainer = AceGUI:Create("SimpleGroup") - toolbarContainer.frame:SetParent(buttonsContainer.frame) - toolbarContainer.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 20, -16) - toolbarContainer.frame:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -17, -16) - toolbarContainer.frame:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 20, -38) - toolbarContainer:SetLayout("Flow") - - local newButton = AceGUI:Create("WeakAurasToolbarButton") - newButton:SetText(L["New Aura"]) - newButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\newaura") - toolbarContainer:AddChild(newButton) - frame.toolbarContainer = toolbarContainer - - newButton:SetCallback("OnClick", function() - frame:NewAura() - end) + local toolbarContainer = CreateFrame("Frame", nil, buttonsContainer.frame) + toolbarContainer:SetParent(buttonsContainer.frame) + toolbarContainer:Hide() local importButton = AceGUI:Create("WeakAurasToolbarButton") importButton:SetText(L["Import"]) importButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\importsmall") importButton:SetCallback("OnClick", OptionsPrivate.ImportFromString) - toolbarContainer:AddChild(importButton) + importButton.frame:SetParent(toolbarContainer) + importButton.frame:Show() + importButton:SetPoint("RIGHT", filterInput, "RIGHT") + importButton:SetPoint("BOTTOM", frame, "TOP", 0, -55) - local lockButton = AceGUI:Create("WeakAurasToolbarButton") - lockButton:SetText(L["Lock Positions"]) - lockButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\lockPosition") - lockButton:SetCallback("OnClick", function(self) - if WeakAurasOptionsSaved.lockPositions then - lockButton:SetStrongHighlight(false) - lockButton:UnlockHighlight() - WeakAurasOptionsSaved.lockPositions = false - else - lockButton:SetStrongHighlight(true) - lockButton:LockHighlight() - WeakAurasOptionsSaved.lockPositions = true - end + local newButton = AceGUI:Create("WeakAurasToolbarButton") + newButton:SetText(L["New Aura"]) + newButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\newaura") + newButton.frame:SetParent(toolbarContainer) + newButton.frame:Show() + newButton:SetPoint("RIGHT", importButton.frame, "LEFT", -10, 0) + frame.toolbarContainer = toolbarContainer + + newButton:SetCallback("OnClick", function() + frame:NewAura() end) - if WeakAurasOptionsSaved.lockPositions then - lockButton:LockHighlight() - end - toolbarContainer:AddChild(lockButton) local magnetButton = AceGUI:Create("WeakAurasToolbarButton") magnetButton:SetText(L["Magnetically Align"]) @@ -691,7 +614,30 @@ function OptionsPrivate.CreateFrame() if WeakAurasOptionsSaved.magnetAlign then magnetButton:LockHighlight() end - toolbarContainer:AddChild(magnetButton) + magnetButton.frame:SetParent(toolbarContainer) + magnetButton.frame:Show() + magnetButton:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -17, -55) + + local lockButton = AceGUI:Create("WeakAurasToolbarButton") + lockButton:SetText(L["Lock Positions"]) + lockButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\lockPosition") + lockButton:SetCallback("OnClick", function(self) + if WeakAurasOptionsSaved.lockPositions then + lockButton:SetStrongHighlight(false) + lockButton:UnlockHighlight() + WeakAurasOptionsSaved.lockPositions = false + else + lockButton:SetStrongHighlight(true) + lockButton:LockHighlight() + WeakAurasOptionsSaved.lockPositions = true + end + end) + if WeakAurasOptionsSaved.lockPositions then + lockButton:LockHighlight() + end + lockButton.frame:SetParent(toolbarContainer) + lockButton.frame:Show() + lockButton:SetPoint("RIGHT", magnetButton.frame, "LEFT", -10, 0) local loadProgress = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal") loadProgress:SetPoint("TOP", buttonsContainer.frame, "TOP", 0, -4) @@ -703,7 +649,6 @@ function OptionsPrivate.CreateFrame() self:UpdateFrameVisible() end - local buttonsScroll = AceGUI:Create("ScrollFrame") buttonsScroll:SetLayout("ButtonsScrollLayout") buttonsScroll.width = "fill" @@ -806,7 +751,7 @@ function OptionsPrivate.CreateFrame() -- Loaded section local loadedButton = AceGUI:Create("WeakAurasLoadedHeaderButton") - loadedButton:SetText(L["Loaded"]) + loadedButton:SetText(L["Loaded/Standby"]) loadedButton:Disable() loadedButton:EnableExpand() if odb.loadedCollapse then @@ -825,34 +770,33 @@ function OptionsPrivate.CreateFrame() loadedButton:SetExpandDescription(L["Expand all loaded displays"]) loadedButton:SetCollapseDescription(L["Collapse all loaded displays"]) loadedButton:SetViewClick(function() - OptionsPrivate.Private.PauseAllDynamicGroups() + local suspended = OptionsPrivate.Private.PauseAllDynamicGroups() + if loadedButton.view.visibility == 2 then - for id, child in pairs(displayButtons) do - if OptionsPrivate.Private.loaded[id] ~= nil then + for _, child in ipairs(loadedButton.childButtons) do + if child:IsLoaded() then child:PriorityHide(2) end end loadedButton:PriorityHide(2) else - for id, child in pairs(displayButtons) do - if OptionsPrivate.Private.loaded[id] ~= nil then + for _, child in ipairs(loadedButton.childButtons) do + if child:IsLoaded() then child:PriorityShow(2) end end loadedButton:PriorityShow(2) end - OptionsPrivate.Private.ResumeAllDynamicGroups() + OptionsPrivate.Private.ResumeAllDynamicGroups(suspended) end) loadedButton.RecheckVisibility = function(self) local none, all = true, true - for id, child in pairs(displayButtons) do - if OptionsPrivate.Private.loaded[id] ~= nil then - if child:GetVisibility() ~= 2 then - all = false - end - if child:GetVisibility() ~= 0 then - none = false - end + for _, child in ipairs(loadedButton.childButtons) do + if child:GetVisibility() ~= 2 then + all = false + end + if child:GetVisibility() ~= 0 then + none = false end end local newVisibility @@ -869,6 +813,7 @@ function OptionsPrivate.CreateFrame() end end loadedButton:SetViewDescription(L["Toggle the visibility of all loaded displays"]) + loadedButton.childButtons = {} frame.loadedButton = loadedButton -- Not Loaded section @@ -892,34 +837,28 @@ function OptionsPrivate.CreateFrame() unloadedButton:SetExpandDescription(L["Expand all non-loaded displays"]) unloadedButton:SetCollapseDescription(L["Collapse all non-loaded displays"]) unloadedButton:SetViewClick(function() - OptionsPrivate.Private.PauseAllDynamicGroups() + local suspended = OptionsPrivate.Private.PauseAllDynamicGroups() if unloadedButton.view.visibility == 2 then - for id, child in pairs(displayButtons) do - if OptionsPrivate.Private.loaded[id] == nil then - child:PriorityHide(2) - end + for _, child in ipairs(unloadedButton.childButtons) do + child:PriorityHide(2) end unloadedButton:PriorityHide(2) else - for id, child in pairs(displayButtons) do - if OptionsPrivate.Private.loaded[id] == nil then - child:PriorityShow(2) - end + for _, child in ipairs(unloadedButton.childButtons) do + child:PriorityShow(2) end unloadedButton:PriorityShow(2) end - OptionsPrivate.Private.ResumeAllDynamicGroups() + OptionsPrivate.Private.ResumeAllDynamicGroups(suspended) end) unloadedButton.RecheckVisibility = function(self) local none, all = true, true - for id, child in pairs(displayButtons) do - if OptionsPrivate.Private.loaded[id] == nil then - if child:GetVisibility() ~= 2 then - all = false - end - if child:GetVisibility() ~= 0 then - none = false - end + for _, child in ipairs(unloadedButton.childButtons) do + if child:GetVisibility() ~= 2 then + all = false + end + if child:GetVisibility() ~= 0 then + none = false end end local newVisibility @@ -936,6 +875,7 @@ function OptionsPrivate.CreateFrame() end end unloadedButton:SetViewDescription(L["Toggle the visibility of all non-loaded displays"]) + unloadedButton.childButtons = {} frame.unloadedButton = unloadedButton @@ -998,7 +938,7 @@ function OptionsPrivate.CreateFrame() local optionTable = self:EnsureOptions(data, self.selectedTab) if optionTable then - AceConfig:RegisterOptionsTable("WeakAuras", optionTable) + AceConfigRegistry:RegisterOptionsTable("WeakAuras", optionTable, true) end end @@ -1049,7 +989,7 @@ function OptionsPrivate.CreateFrame() local tabsWidget - container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -14) + container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -10) container:ReleaseChildren() container:SetLayout("Fill") tabsWidget = AceGUI:Create("TabGroup") @@ -1122,12 +1062,18 @@ function OptionsPrivate.CreateFrame() end frame.ClearPicks = function(self, noHide) - OptionsPrivate.Private.PauseAllDynamicGroups() + local suspended = OptionsPrivate.Private.PauseAllDynamicGroups() for id, button in pairs(displayButtons) do button:ClearPick(true) if not noHide then button:PriorityHide(1) - button:SetVisibilityDirectly(0) + end + end + if not noHide then + for id, button in pairs(displayButtons) do + if button.data.controlledChildren then + button:RecheckVisibility() + end end end @@ -1139,7 +1085,7 @@ function OptionsPrivate.CreateFrame() container:ReleaseChildren() self.moversizer:Hide() - OptionsPrivate.Private.ResumeAllDynamicGroups() + OptionsPrivate.Private.ResumeAllDynamicGroups(suspended) -- Clear trigger expand state OptionsPrivate.ClearTriggerExpandState() @@ -1185,7 +1131,7 @@ function OptionsPrivate.CreateFrame() self.pickedOption = "New" container:ReleaseChildren() - container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -8) + container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, 0) container:SetLayout("fill") local border = AceGUI:Create("InlineGroup") border:SetLayout("Fill") @@ -1349,11 +1295,11 @@ function OptionsPrivate.CreateFrame() end end - if self.pickedDisplay == id then + if self.pickedDisplay == id and (self.pickedDisplay == tab or tab == nil) then return end - OptionsPrivate.Private.PauseAllDynamicGroups() + local suspended = OptionsPrivate.Private.PauseAllDynamicGroups() self:ClearPicks(noHide) @@ -1380,7 +1326,7 @@ function OptionsPrivate.CreateFrame() end displayButtons[data.id]:RecheckParentVisibility() - OptionsPrivate.Private.ResumeAllDynamicGroups() + OptionsPrivate.Private.ResumeAllDynamicGroups(suspended) end frame.CenterOnPicked = function(self) diff --git a/WeakAurasOptions/OptionsFrames/TextEditor.lua b/WeakAurasOptions/OptionsFrames/TextEditor.lua index e43717b..1b340d7 100644 --- a/WeakAurasOptions/OptionsFrames/TextEditor.lua +++ b/WeakAurasOptions/OptionsFrames/TextEditor.lua @@ -151,17 +151,11 @@ end]=] local function ConstructTextEditor(frame) local group = AceGUI:Create("WeakAurasInlineGroup") group.frame:SetParent(frame) - group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16); - group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46); + group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -63); + group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 46); group.frame:Hide() group:SetLayout("flow") - local title = AceGUI:Create("Label") - title:SetFontObject(GameFontNormalHuge) - title:SetFullWidth(true) - title:SetText(L["Code Editor"]) - group:AddChild(title) - local editor = AceGUI:Create("MultiLineEditBox") editor:SetFullWidth(true) editor:SetFullHeight(true) @@ -224,28 +218,12 @@ local function ConstructTextEditor(frame) settings_frame:RegisterForClicks("LeftButtonUp") local helpButton = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") - helpButton:SetPoint("BOTTOMLEFT", 12, -24) + helpButton:SetPoint("BOTTOMLEFT", 0, -24) helpButton:SetFrameLevel(cancel:GetFrameLevel() + 1) helpButton:SetHeight(20) helpButton:SetWidth(100) helpButton:SetText(L["Help"]) - local urlText = CreateFrame("editbox", nil, group.frame) - urlText:SetFrameLevel(cancel:GetFrameLevel() + 1) - urlText:SetFont(STANDARD_TEXT_FONT, 12) - urlText:EnableMouse(true) - urlText:SetAutoFocus(false) - urlText:SetCountInvisibleLetters(false) - urlText:Hide() - - local urlCopyLabel = urlText:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall") - urlCopyLabel:SetPoint("BOTTOMLEFT", group.frame, "BOTTOMLEFT", 12, -20) - urlCopyLabel:SetText(L["Press Ctrl+C to copy"]) - urlCopyLabel:Hide() - - urlText:SetPoint("TOPLEFT", urlCopyLabel, "TOPRIGHT", 12, 0) - urlText:SetPoint("RIGHT", settings_frame, "LEFT") - local dropdown = CreateFrame("Frame", "SettingsMenuFrame", settings_frame, "UIDropDownMenuTemplate") local function settings_dropdown_initialize(frame, level, menu) @@ -317,7 +295,7 @@ local function ConstructTextEditor(frame) -- Make Snippets button (top right, near the line number) local snippetsButton = CreateFrame("Button", "WASnippetsButton", group.frame, "UIPanelButtonTemplate") - snippetsButton:SetPoint("BOTTOMRIGHT", editor.frame, "TOPRIGHT", 0, -15) + snippetsButton:SetPoint("BOTTOMRIGHT", editor.frame, "TOPRIGHT", -20, -10) snippetsButton:SetFrameLevel(group.frame:GetFrameLevel() + 2) snippetsButton:SetHeight(20) snippetsButton:SetWidth(100) @@ -413,10 +391,12 @@ local function ConstructTextEditor(frame) end -- Make sidebar for snippets - local snippetsFrame = CreateFrame("FRAME", "WeakAurasSnippets", group.frame) + local snippetsFrame = CreateFrame("Frame", "WeakAurasSnippets", group.frame, "WA_PortraitFrameTemplate") + snippetsFrame:HidePortrait() snippetsFrame:SetPoint("TOPLEFT", group.frame, "TOPRIGHT", 20, 0) snippetsFrame:SetPoint("BOTTOMLEFT", group.frame, "BOTTOMRIGHT", 20, 0) snippetsFrame:SetWidth(250) + --[[ snippetsFrame:SetBackdrop( { bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", @@ -428,11 +408,11 @@ local function ConstructTextEditor(frame) } ) snippetsFrame:SetBackdropColor(0, 0, 0, 1) - + ]] -- Add button to save new snippet local AddSnippetButton = CreateFrame("Button", nil, snippetsFrame, "UIPanelButtonTemplate") - AddSnippetButton:SetPoint("TOPLEFT", snippetsFrame, "TOPLEFT", 13, -10) - AddSnippetButton:SetPoint("TOPRIGHT", snippetsFrame, "TOPRIGHT", -13, -10) + AddSnippetButton:SetPoint("TOPLEFT", snippetsFrame, "TOPLEFT", 13, -25) + AddSnippetButton:SetPoint("TOPRIGHT", snippetsFrame, "TOPRIGHT", -13, -25) AddSnippetButton:SetHeight(20) AddSnippetButton:SetText(L["Add Snippet"]) AddSnippetButton:RegisterForClicks("LeftButtonUp") @@ -444,7 +424,7 @@ local function ConstructTextEditor(frame) snippetsScrollContainer:SetFullHeight(true) snippetsScrollContainer:SetLayout("Fill") snippetsScrollContainer.frame:SetParent(snippetsFrame) - snippetsScrollContainer.frame:SetPoint("TOPLEFT", snippetsFrame, "TOPLEFT", 17, -35) + snippetsScrollContainer.frame:SetPoint("TOPLEFT", snippetsFrame, "TOPLEFT", 17, -50) snippetsScrollContainer.frame:SetPoint("BOTTOMRIGHT", snippetsFrame, "BOTTOMRIGHT", -10, 10) local snippetsScroll = AceGUI:Create("ScrollFrame") snippetsScroll:SetLayout("List") @@ -535,46 +515,26 @@ local function ConstructTextEditor(frame) editorError:SetPoint("LEFT", helpButton, "RIGHT", 0, 4) editorError:SetPoint("RIGHT", settings_frame, "LEFT") - local editorLine = CreateFrame("Editbox", nil, group.frame) + local editorLine = CreateFrame("EditBox", nil, group.frame, "WA_InputBoxTemplate") -- Set script on enter pressed.. - editorLine:SetPoint("BOTTOMRIGHT", editor.frame, "TOPRIGHT", -100, -15) + editorLine:SetPoint("RIGHT", snippetsButton, "LEFT", -10, 0) editorLine:SetFont(STANDARD_TEXT_FONT, 10) editorLine:SetJustifyH("RIGHT") - editorLine:SetWidth(80) + editorLine:SetWidth(30) editorLine:SetHeight(20) editorLine:SetNumeric(true) - editorLine:SetTextInsets(10, 10, 0, 0) + editorLine:SetTextInsets(0, 5, 0, 0) editorLine:SetAutoFocus(false) - urlText:SetScript( - "OnChar", - function(self) - self:SetText(group.url) - self:HighlightText() - end - ) - urlText:SetScript( - "OnEscapePressed", - function() - urlText:ClearFocus() - urlText:Hide() - urlCopyLabel:Hide() - helpButton:Show() - editor:SetFocus() - end - ) + local editorLineText = group.frame:CreateFontString(nil, "OVERLAY") + editorLineText:SetFont(STANDARD_TEXT_FONT, 10) + editorLineText:SetTextColor(1, 1, 1) + editorLineText:SetText(L["Line"]) + editorLineText:SetPoint("RIGHT", editorLine, "LEFT", -8, 0) - helpButton:SetScript( - "OnClick", - function() - urlText:Show() - urlText:SetFocus() - urlText:HighlightText() - urlCopyLabel:Show() - helpButton:Hide() - editorError:Hide() - end - ) + helpButton:SetScript("OnClick", function() + OptionsPrivate.ToggleTip(helpButton, group.url, L["Help"], "") + end) local oldOnCursorChanged = editor.editBox:GetScript("OnCursorChanged") editor.editBox:SetScript( @@ -616,9 +576,6 @@ local function ConstructTextEditor(frame) self.reloadOptions = reloadOptions self.setOnParent = setOnParent self.url = url - urlText:SetText(url or "") - urlText:Hide() - urlCopyLabel:Hide() if url then helpButton:Show() else @@ -668,8 +625,6 @@ local function ConstructTextEditor(frame) end end if errorString then - urlText:Hide() - urlCopyLabel:Hide() if self.url then helpButton:Show() end @@ -727,6 +682,7 @@ local function ConstructTextEditor(frame) function group.CancelClose(self) editor.editBox:SetScript("OnTextChanged", self.oldOnTextChanged) editor:ClearFocus() + frame:HideTip() frame.window = "default" frame:UpdateFrameVisible() end diff --git a/WeakAurasOptions/OptionsFrames/TexturePicker.lua b/WeakAurasOptions/OptionsFrames/TexturePicker.lua index c549657..4dfad2f 100644 --- a/WeakAurasOptions/OptionsFrames/TexturePicker.lua +++ b/WeakAurasOptions/OptionsFrames/TexturePicker.lua @@ -76,10 +76,10 @@ end local texturePicker local function ConstructTexturePicker(frame) - local group = AceGUI:Create("InlineGroup"); + local group = AceGUI:Create("SimpleGroup"); group.frame:SetParent(frame); - group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 42); - group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -10); + group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 46); + group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -50); group.frame:Hide(); group.children = {}; group.categories = {}; @@ -247,7 +247,7 @@ local function ConstructTexturePicker(frame) local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") cancel:SetScript("OnClick", group.CancelClose) - cancel:SetPoint("BOTTOMRIGHT", -27, -23) + cancel:SetPoint("BOTTOMRIGHT", -20, -24) cancel:SetSize(100, 20) cancel:SetText(L["Cancel"]) diff --git a/WeakAurasOptions/OptionsFrames/Update.lua b/WeakAurasOptions/OptionsFrames/Update.lua index 613b73d..c6352a7 100644 --- a/WeakAurasOptions/OptionsFrames/Update.lua +++ b/WeakAurasOptions/OptionsFrames/Update.lua @@ -1835,6 +1835,7 @@ local methods = { button:SetGroupOrder(nil, nil) end button.callbacks.UpdateExpandButton() + button:UpdateParentWarning() WeakAuras.UpdateGroupOrders(data) WeakAuras.UpdateThumbnail(data) WeakAuras.ClearAndUpdateOptions(data.id) @@ -1896,6 +1897,7 @@ local methods = { button:SetGroupOrder(nil, nil) end button.callbacks.UpdateExpandButton() + button:UpdateParentWarning() WeakAuras.UpdateGroupOrders(data) WeakAuras.UpdateThumbnail(data) WeakAuras.ClearAndUpdateOptions(data.id) @@ -1998,7 +2000,7 @@ local updateFrame local function ConstructUpdateFrame(frame) local group = AceGUI:Create("ScrollFrame"); group.frame:SetParent(frame); - group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16); + group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -63); group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46); group.frame:Hide(); group:SetLayout("flow"); diff --git a/WeakAurasOptions/WeakAurasOptions.lua b/WeakAurasOptions/WeakAurasOptions.lua index 6396b80..a8e7c74 100644 --- a/WeakAurasOptions/WeakAurasOptions.lua +++ b/WeakAurasOptions/WeakAurasOptions.lua @@ -101,6 +101,7 @@ function OptionsPrivate.DuplicateAura(data, newParent, massEdit, targetIndex) if not massEdit then local button = WeakAuras.GetDisplayButton(parentData.id) button.callbacks.UpdateExpandButton() + button:UpdateParentWarning() end OptionsPrivate.ClearOptions(parentData.id) end @@ -286,6 +287,7 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions) parentButton.callbacks.UpdateExpandButton(); parentButton:Expand(); parentButton:ReloadTooltip(); + parentButton:UpdateParentWarning(); else WeakAuras.Add(data); WeakAuras.NewDisplayButton(data); @@ -309,6 +311,7 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions) local oldParentButton = WeakAuras.GetDisplayButton(oldParent) oldParentButton.callbacks.UpdateExpandButton(); oldParentButton:ReloadTooltip() + oldParentButton:UpdateParentWarning() end tinsert(data.controlledChildren, childId); @@ -327,6 +330,7 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions) local button = WeakAuras.GetDisplayButton(data.id); button.callbacks.UpdateExpandButton(); + button:UpdateParentWarning() OptionsPrivate.SortDisplayButtons(); button:Expand(); @@ -441,7 +445,7 @@ StaticPopupDialogs["WEAKAURAS_CONFIRM_DELETE"] = { button2 = L["Cancel"], OnAccept = function(self) if self.data then - OptionsPrivate.Private.PauseAllDynamicGroups() + local suspended = OptionsPrivate.Private.PauseAllDynamicGroups() OptionsPrivate.massDelete = true for _, auraData in pairs(self.data.toDelete) do WeakAuras.Delete(auraData) @@ -461,9 +465,10 @@ StaticPopupDialogs["WEAKAURAS_CONFIRM_DELETE"] = { parentButton:SetNormalTooltip() WeakAuras.Add(parentData) WeakAuras.ClearAndUpdateOptions(parentData.id) + parentButton:UpdateParentWarning() end end - OptionsPrivate.Private.ResumeAllDynamicGroups() + OptionsPrivate.Private.ResumeAllDynamicGroups(suspended) OptionsPrivate.SortDisplayButtons(nil, true) end end, @@ -609,6 +614,13 @@ function WeakAuras.ToggleOptions(msg, Private) -- The button does not yet exists if a new aura is created displayButtons[id]:UpdateWarning() end + local data = Private.GetDataByUID(uid) + if data and data.parent then + local button = WeakAuras.GetDisplayButton(data.parent); + if button then + button:UpdateParentWarning() + end + end end) OptionsPrivate.Private.callbacks:RegisterCallback("ScanForLoads", AfterScanForLoads) @@ -735,16 +747,16 @@ local function LayoutDisplayButtons(msg) frame.buttonsScroll:PerformLayout() OptionsPrivate.SortDisplayButtons(msg); - OptionsPrivate.Private.PauseAllDynamicGroups(); + local suspended = OptionsPrivate.Private.PauseAllDynamicGroups() if (WeakAuras.IsOptionsOpen()) then for id, button in pairs(displayButtons) do - if(OptionsPrivate.Private.loaded[id] ~= nil) then + if OptionsPrivate.Private.loaded[id] then button:PriorityShow(1); end end WeakAuras.OptionsFrame().loadedButton:RecheckVisibility() end - OptionsPrivate.Private.ResumeAllDynamicGroups(); + OptionsPrivate.Private.ResumeAllDynamicGroups(suspended) frame:SetLoadProgressVisible(false) end @@ -823,11 +835,11 @@ function WeakAuras.ShowOptions(msg) if not(firstLoad) then -- Show what was last shown - OptionsPrivate.Private.PauseAllDynamicGroups(); + local suspended = OptionsPrivate.Private.PauseAllDynamicGroups() for id, button in pairs(displayButtons) do button:SyncVisibility() end - OptionsPrivate.Private.ResumeAllDynamicGroups(); + OptionsPrivate.Private.ResumeAllDynamicGroups(suspended) end if (frame.pickedDisplay) then @@ -902,11 +914,12 @@ function OptionsPrivate.ConvertDisplay(data, newType) local visibility = displayButtons[id]:GetVisibility(); displayButtons[id]:PriorityHide(2); - WeakAuras.regions[id].region:Collapse(); + if WeakAuras.regions[id] then + WeakAuras.regions[id].region:Collapse() + end OptionsPrivate.Private.CollapseAllClones(id); OptionsPrivate.Private.Convert(data, newType); - displayButtons[id]:SetViewRegion(WeakAuras.regions[id].region); displayButtons[id]:Initialize(); displayButtons[id]:PriorityShow(visibility); frame:ClearOptions(id) @@ -1096,23 +1109,51 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id) tinsert(frame.buttonsScroll.children, frame.loadedButton); local aurasMatchingFilter = {} - local useTextFilter = filter and filter ~= "" + local useTextFilter = filter ~= "" + local filterTable = OptionsPrivate.Private.splitAtOr(filter) local topLevelLoadedAuras = {} local topLevelUnloadedAuras = {} local visible = {} for id, child in pairs(displayButtons) do - if(OptionsPrivate.Private.loaded[id]) then - child:EnableLoaded(); + if child.data.controlledChildren then + local hasLoaded, hasStandBy, hasNotLoaded = 0, 0, 0 + for leaf in OptionsPrivate.Private.TraverseLeafs(child.data) do + local id = leaf.id + if OptionsPrivate.Private.loaded[id] == true then + hasLoaded = hasLoaded + 1 + elseif OptionsPrivate.Private.loaded[id] == false then + hasStandBy = hasStandBy + 1 + else + hasNotLoaded = hasNotLoaded + 1 + end + end + if hasLoaded > 0 then + child:SetLoaded(1, {0, 0.68, 0.30, 1}, L["Loaded"], L["%d displays loaded"]:format(hasLoaded)) + elseif hasStandBy > 0 then + child:SetLoaded(2, {0.96, 0.82, 0.16, 1}, L["Standby"], L["%d displays on standby"]:format(hasStandBy)) + elseif hasNotLoaded > 0 then + child:SetLoaded(3, {0.6, 0.6, 0.6, 1}, L["Not Loaded"], L["%d displays not loaded"]:format(hasNotLoaded)) + else + child:ClearLoaded() + end else - child:DisableLoaded(); + if OptionsPrivate.Private.loaded[id] == true then + child:SetLoaded(1, {0, 0.68, 0.30, 1}, L["Loaded"], L["This display is currently loaded"]) + elseif OptionsPrivate.Private.loaded[id] == false then + child:SetLoaded(2, {0.96, 0.82, 0.16, 1}, L["Standby"], L["This display is on standby, it will be loaded when needed."]) + else + child:SetLoaded(3, {0.6, 0.6, 0.6, 1}, L["Not Loaded"], L["This display is not currently loaded"]) + end end if useTextFilter then - if(id:lower():find(filter, 1, true)) then - aurasMatchingFilter[id] = true - for parent in OptionsPrivate.Private.TraverseParents(child.data) do - aurasMatchingFilter[parent.id] = true + for _, word in ipairs(filterTable) do + if(id:lower():find(word, 1, true)) then + aurasMatchingFilter[id] = true + for parent in OptionsPrivate.Private.TraverseParents(child.data) do + aurasMatchingFilter[parent.id] = true + end end end else @@ -1121,7 +1162,7 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id) if not child:GetGroup() then -- Top Level aura - if OptionsPrivate.Private.loaded[child.data.id] ~= nil then + if OptionsPrivate.Private.loaded[id] ~= nil then tinsert(topLevelLoadedAuras, id) else tinsert(topLevelUnloadedAuras, id) @@ -1129,6 +1170,7 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id) end end + wipe(frame.loadedButton.childButtons) if frame.loadedButton:GetExpanded() then table.sort(topLevelLoadedAuras) for _, id in ipairs(topLevelLoadedAuras) do @@ -1138,8 +1180,15 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id) end end + for _, id in ipairs(topLevelLoadedAuras) do + for child in OptionsPrivate.Private.TraverseLeafsOrAura(WeakAuras.GetData(id)) do + tinsert(frame.loadedButton.childButtons, displayButtons[child.id]) + end + end + tinsert(frame.buttonsScroll.children, frame.unloadedButton); + wipe(frame.unloadedButton.childButtons) if frame.unloadedButton:GetExpanded() then table.sort(topLevelUnloadedAuras) for _, id in ipairs(topLevelUnloadedAuras) do @@ -1149,6 +1198,12 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id) end end + for _, id in ipairs(topLevelUnloadedAuras) do + for child in OptionsPrivate.Private.TraverseLeafsOrAura(WeakAuras.GetData(id)) do + tinsert(frame.unloadedButton.childButtons, displayButtons[child.id]) + end + end + for id, child in pairs(displayButtons) do if(not visible[child]) then child.frame:Hide(); @@ -1290,9 +1345,6 @@ function OptionsPrivate.AddDisplayButton(data) EnsureDisplayButton(data); WeakAuras.UpdateThumbnail(data); frame.buttonsScroll:AddChild(displayButtons[data.id]); - if(WeakAuras.regions[data.id] and WeakAuras.regions[data.id].region.SetStacks) then - WeakAuras.regions[data.id].region:SetStacks(1); - end end function OptionsPrivate.StartGrouping(data) @@ -1462,6 +1514,7 @@ function OptionsPrivate.Drop(mainAura, target, action, area) OptionsPrivate.SortDisplayButtons() OptionsPrivate.UpdateButtonsScroll() + WeakAuras.FillOptions() end function OptionsPrivate.StartDrag(mainAura) @@ -1506,6 +1559,7 @@ function OptionsPrivate.StartDrag(mainAura) end end end + OptionsPrivate.UpdateButtonsScroll() end function OptionsPrivate.DropIndicator() @@ -1619,6 +1673,7 @@ function OptionsPrivate.ResetMoverSizer() end function WeakAuras.SetMoverSizer(id) + OptionsPrivate.Private.EnsureRegion(id) if WeakAuras.regions[id].region.toShow then frame.moversizer:SetToRegion(WeakAuras.regions[id].region, db.displays[id]) else @@ -1692,6 +1747,7 @@ function WeakAuras.NewAura(sourceData, regionType, targetId) WeakAuras.UpdateGroupOrders(group.data); OptionsPrivate.ClearOptions(group.data.id); group.callbacks.UpdateExpandButton(); + group:UpdateParentWarning(); group:Expand(); group:ReloadTooltip(); OptionsPrivate.PickAndEditDisplay(data.id); diff --git a/WeakAurasOptions/WeakAurasOptions.toc b/WeakAurasOptions/WeakAurasOptions.toc index 7eecc59..0357c7a 100644 --- a/WeakAurasOptions/WeakAurasOptions.toc +++ b/WeakAurasOptions/WeakAurasOptions.toc @@ -1,7 +1,7 @@ ## Interface: 30300 ## Title: WeakAuras Options ## Author: The WeakAuras Team -## Version: 4.1.1 +## Version: 4.1.2 ## Notes: Options for WeakAuras ## Notes-esES: Opciones para WeakAuras ## Notes-deDE: Optionen für WeakAuras