diff --git a/Definitions.lua b/Definitions.lua index 9eeb1708..4b1a8b17 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -27,6 +27,7 @@ ---@class alternatepowertable : {last: number, total: number} ---@class combat : table +---@field __destroyedBy string ---@field amountCasts {[string]: table} ---@field instance_type string "raid" or "party" or "pvp" or "arena" or "none" ---@field end_time number @@ -285,6 +286,7 @@ ---@field BreakdownTabsFrame frame where the tab buttons are located (parent frame) ---@field RegisteredPluginButtons button[] table which contains plugins buttons that are registered to the breakdown window ---@field RegisterPluginButton fun(button: button) register a plugin button to the breakdown window +---@field GetShownPluginObject fun() : table get the plugin object that is currently shown in the breakdown window ---@class breakdownscrolldata : table diff --git a/Libs/DF/button.lua b/Libs/DF/button.lua index bdc67dcd..ee0ffb93 100644 --- a/Libs/DF/button.lua +++ b/Libs/DF/button.lua @@ -1319,18 +1319,25 @@ detailsFramework.CloseButtonMixin = { ---@return df_closebutton function detailsFramework:CreateCloseButton(parent, frameName) ---@type df_closebutton - local closeButton = CreateFrame("button", frameName, parent) + local closeButton = CreateFrame("button", frameName, parent, "UIPanelCloseButton") closeButton:SetFrameLevel(parent:GetFrameLevel() + 1) closeButton:SetSize(16, 16) detailsFramework:Mixin(closeButton, detailsFramework.CloseButtonMixin) - closeButton:SetNormalTexture([[Interface\GLUES\LOGIN\Glues-CheckBox-Check]]) - closeButton:SetHighlightTexture([[Interface\GLUES\LOGIN\Glues-CheckBox-Check]]) - closeButton:SetPushedTexture([[Interface\GLUES\LOGIN\Glues-CheckBox-Check]]) - closeButton:GetNormalTexture():SetDesaturated(true) - closeButton:GetHighlightTexture():SetDesaturated(true) - closeButton:GetPushedTexture():SetDesaturated(true) + local normalTexture = closeButton:GetNormalTexture() + local pushedTexture = closeButton:GetPushedTexture() + local highlightTexture = closeButton:GetHighlightTexture() + local disabledTexture = closeButton:GetDisabledTexture() + + normalTexture:SetAtlas("RedButton-Exit") + highlightTexture:SetAtlas("RedButton-Highlight") + pushedTexture:SetAtlas("RedButton-exit-pressed") + disabledTexture:SetAtlas("RedButton-Exit-Disabled") + + normalTexture:SetDesaturated(true) + highlightTexture:SetDesaturated(true) + pushedTexture:SetDesaturated(true) closeButton:SetAlpha(0.7) closeButton:SetScript("OnClick", closeButton.OnClick) diff --git a/Libs/DF/charts.lua b/Libs/DF/charts.lua index 744991c0..1c511a4f 100644 --- a/Libs/DF/charts.lua +++ b/Libs/DF/charts.lua @@ -6,7 +6,34 @@ end local _ +---@class df_chart: frame, data +---@field _dataInfo data +---@field nextLine number +---@field minValue number +---@field maxValue number +---@field lineThickness number +---@field data table +---@field lines table +---@field ChartFrameConstructor fun(self: df_chart) set the default values for the chart frame +---@field GetLine fun(self: df_chart) : line return a line and also internally handle next line +---@field GetLines fun(self: df_chart) : line[] return a table with all lines already created +---@field GetLineWidth fun(self: df_chart) : number calculate the width of each drawn line +---@field SetLineWidth fun(self: df_chart, width: number) set the line width to a fixed value +---@field Plot fun(self: df_chart) draw the graphic using lines and following the data set by SetData() +---@field GetAmountLines fun(self: df_chart) : number return the amount of lines in use +---@field OnSizeChanged fun(self: df_chart) +---@field HideLines fun(self: df_chart) hide all lines already created +---@field Reset fun(self: df_chart) hide all lines and reset the next line to 1 +---@field SetLineThickness fun(self: df_chart, thickness: number) set the line thickness +---@field CalcYAxisPointForValue fun(self: df_chart, value: number) +---@field UpdateFrameSizeCache fun(self: df_chart) + + + + local ChartFrameMixin = { + ---set the default values for the chart frame + ---@param self df_chart ChartFrameConstructor = function(self) self.nextLine = 1 self.minValue = 0 @@ -19,7 +46,8 @@ local ChartFrameMixin = { self:SetScript("OnSizeChanged", self.OnSizeChanged) end, - --internally handle next line + ---internally handle next line + ---@param self df_chart GetLine = function(self) local line = self.lines[self.nextLine] if (not line) then @@ -31,14 +59,22 @@ local ChartFrameMixin = { return line end, + ---return all lines created for this chart + ---@param self df_chart + ---@return line[] GetLines = function(self) return self.lines end, + ---return the amount of lines in use + ---@param self df_chart + ---@return number GetAmountLines = function(self) return self.nextLine - 1 end, + ---hide all lines already created + ---@param self df_chart HideLines = function(self) local allLines = self:GetLines() for i = 1, #allLines do @@ -47,17 +83,22 @@ local ChartFrameMixin = { end end, + ---hide all lines and reset the next line to 1 + ---@param self df_chart Reset = function(self) self:HideLines() self.nextLine = 1 end, + ---@param self df_chart + ---@param value number SetLineThickness = function(self, value) assert(type(value) == "number", "number expected on :SetLineThickness(number)") self.lineThickness = value end, - --calculate the width of each drawn line + ---calculate the width of each drawn line + ---@param self df_chart GetLineWidth = function(self) --self:SetLineWidth(nil) to erase the fixed value if (self.fixedLineWidth) then @@ -69,24 +110,32 @@ local ChartFrameMixin = { end end, + ---set the line width to a fixed value + ---@param self df_chart + ---@param width number SetLineWidth = function(self, width) assert(type(width) == "number", "number expected on :SetLineWidth(number)") self.fixedLineWidth = width end, + ---@param self df_chart + ---@param value number CalcYAxisPointForValue = function(self, value) return value / self.maxValue * self.height end, + ---@param self df_chart UpdateFrameSizeCache = function(self) self.width = self:GetWidth() self.height = self:GetHeight() end, + ---@param self df_chart OnSizeChanged = function(self) self:UpdateFrameSizeCache() end, + ---@param self df_chart Plot = function(self) --debug --self:SetData({38, 26, 12, 63, 100, 96, 42, 94, 25, 75, 61, 54, 71, 40, 34, 100, 66, 90, 39, 13, 99, 18, 72, 18, 83, 45, 56, 24, 33, 85, 95, 71, 15, 66, 19, 58, 52, 9, 83, 99, 100, 4, 3, 56, 6, 80, 94, 7, 40, 55, 98, 92, 20, 9, 35, 89, 72, 7, 13, 81, 29, 78, 55, 70, 12, 33, 39, 3, 84, 31, 10, 53, 51, 69, 66, 58, 71, 60, 31, 71, 27, 76, 21, 75, 15, 89, 2, 81, 72, 78, 74, 80, 97, 10, 59, 0, 31, 5, 1, 82, 71, 89, 78, 94, 74, 20, 65, 72, 56, 40, 92, 91, 40, 79, 4, 56, 18, 88, 88, 20, 20, 10, 47, 26, 80, 26, 75, 21, 57, 10, 67, 66, 84, 83, 14, 47, 83, 9, 7, 73, 63, 32, 64, 20, 40, 3, 46, 54, 17, 37, 82, 66, 65, 22, 12, 1, 100, 41, 1, 72, 38, 41, 71, 69, 88, 34, 10, 50, 9, 25, 19, 27, 3, 13, 40, 75, 3, 11, 93, 58, 81, 80, 93, 25, 74, 68, 91, 87, 79, 48, 66, 53, 64, 18, 51, 19, 32, 4, 21, 43}) @@ -128,31 +177,36 @@ local ChartFrameMixin = { end, } - +---create a chart frame object +---@param parent frame +---@param name string|nil +---@return df_chart local createChartFrame = function(parent, name) - local f = CreateFrame("frame", name, parent, "BackdropTemplate") + ---@type df_chart + local chartFrame = CreateFrame("frame", name, parent, "BackdropTemplate") - DF:Mixin(f, DF.DataMixin) - DF:Mixin(f, DF.ValueMixin) - DF:Mixin(f, ChartFrameMixin) + DF:Mixin(chartFrame, DF.DataMixin) + DF:Mixin(chartFrame, DF.ValueMixin) + DF:Mixin(chartFrame, ChartFrameMixin) - f:DataConstructor() - f:ValueConstructor() - f:ChartFrameConstructor() + chartFrame:DataConstructor() + chartFrame:ValueConstructor() + chartFrame:ChartFrameConstructor() --when a new data is set, update the min and max values local onSetDataCallback = function() - local minValue, maxValue = f:GetDataMinMaxValues() - f:SetMinMaxValues(minValue, maxValue) + local minValue, maxValue = chartFrame:GetDataMinMaxValues() + chartFrame:SetMinMaxValues(minValue, maxValue) --clear the lines - f:HideLines() + chartFrame:HideLines() end - f:AddDataChangeCallback(onSetDataCallback) + chartFrame:AddDataChangeCallback(onSetDataCallback) - return f + return chartFrame end function DF:CreateGraphicLineFrame(parent, name) + ---@type df_chart local newGraphicFrame = createChartFrame(parent, name) return newGraphicFrame end @@ -244,16 +298,20 @@ local MultiChartFrameMixin = { end, } +---create a chart frame object with support to multi lines +---@param parent frame +---@param name string|nil +---@return df_chart function DF:CreateGraphicMultiLineFrame(parent, name) name = name or ("DetailsMultiChartFrameID" .. math.random(1, 10000000)) - local f = CreateFrame("frame", name, parent, "BackdropTemplate") + local chartFrame = CreateFrame("frame", name, parent, "BackdropTemplate") - DF:Mixin(f, DF.ValueMixin) - DF:Mixin(f, MultiChartFrameMixin) + DF:Mixin(chartFrame, DF.ValueMixin) + DF:Mixin(chartFrame, MultiChartFrameMixin) - f:ValueConstructor() - f:MultiChartFrameConstructor() + chartFrame:ValueConstructor() + chartFrame:MultiChartFrameConstructor() - return f + return chartFrame end \ No newline at end of file diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 9b7d195a..757d6991 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 436 +local dversion = 438 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) diff --git a/Libs/DF/mixins.lua b/Libs/DF/mixins.lua index 0710a651..123e6c5a 100644 --- a/Libs/DF/mixins.lua +++ b/Libs/DF/mixins.lua @@ -375,14 +375,14 @@ detailsFramework.ScriptHookMixin = { local isRemoval = false for i = #self.HookList[hookType], 1, -1 do if (self.HookList[hookType][i] == func) then - tremove(self.HookList[hookType], i) + table.remove(self.HookList[hookType], i) isRemoval = true break end end if (not isRemoval) then - tinsert(self.HookList[hookType], func) + table.insert(self.HookList[hookType], func) end else if (detailsFramework.debug) then @@ -717,6 +717,19 @@ detailsFramework.SortFunctions = { end } +---@class data : table +---@field data table +---@field dataCurrentIndex number +---@field callbacks table +---@field DataConstructor fun(self: data) +---@field AddDataChangeCallback fun(self: data, callback: function, ...: any) +---@field RemoveDataChangeCallback fun(self: data, callback: function) +---@field GetData fun(self: data) +---@field SetData fun(self: data, data: table) +---@field GetDataNextValue fun(self: data) : any +---@field ResetDataIndex fun(self: data) + + ---mixin to use with DetailsFramework:Mixin(table, detailsFramework.DataMixin) ---add 'data' to a table, this table can be used to store data for the object ---@class DetailsFramework.DataMixin @@ -781,6 +794,7 @@ detailsFramework.DataMixin = { end, ---reset the data index, making GetDataNextValue() return the first value again + ---@param self table ResetDataIndex = function(self) self._dataInfo.dataCurrentIndex = 1 end, diff --git a/Libs/DF/textentry.lua b/Libs/DF/textentry.lua index dee00abc..f487bf50 100644 --- a/Libs/DF/textentry.lua +++ b/Libs/DF/textentry.lua @@ -1,6 +1,6 @@ -local DF = _G["DetailsFramework"] -if (not DF or not DetailsFrameworkCanLoad) then +local detailsFramework = _G["DetailsFramework"] +if (not detailsFramework or not DetailsFrameworkCanLoad) then return end @@ -10,15 +10,15 @@ local APITextEntryFunctions = false do local metaPrototype = { WidgetType = "textentry", - dversion = DF.dversion, + dversion = detailsFramework.dversion, } --check if there's a metaPrototype already existing - if (_G[DF.GlobalWidgetControlNames["textentry"]]) then + if (_G[detailsFramework.GlobalWidgetControlNames["textentry"]]) then --get the already existing metaPrototype - local oldMetaPrototype = _G[DF.GlobalWidgetControlNames["textentry"]] + local oldMetaPrototype = _G[detailsFramework.GlobalWidgetControlNames["textentry"]] --check if is older - if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then + if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < detailsFramework.dversion) ) then --the version is older them the currently loading one --copy the new values into the old metatable for funcName, _ in pairs(metaPrototype) do @@ -27,18 +27,18 @@ do end else --first time loading the framework - _G[DF.GlobalWidgetControlNames["textentry"]] = metaPrototype + _G[detailsFramework.GlobalWidgetControlNames["textentry"]] = metaPrototype end end -local TextEntryMetaFunctions = _G[DF.GlobalWidgetControlNames["textentry"]] +local TextEntryMetaFunctions = _G[detailsFramework.GlobalWidgetControlNames["textentry"]] -DF:Mixin(TextEntryMetaFunctions, DF.SetPointMixin) -DF:Mixin(TextEntryMetaFunctions, DF.FrameMixin) -DF:Mixin(TextEntryMetaFunctions, DF.TooltipHandlerMixin) -DF:Mixin(TextEntryMetaFunctions, DF.ScriptHookMixin) +detailsFramework:Mixin(TextEntryMetaFunctions, detailsFramework.SetPointMixin) +detailsFramework:Mixin(TextEntryMetaFunctions, detailsFramework.FrameMixin) +detailsFramework:Mixin(TextEntryMetaFunctions, detailsFramework.TooltipHandlerMixin) +detailsFramework:Mixin(TextEntryMetaFunctions, detailsFramework.ScriptHookMixin) -DF.TextEntryCounter = DF.TextEntryCounter or 1 +detailsFramework.TextEntryCounter = detailsFramework.TextEntryCounter or 1 ------------------------------------------------------------------------------------------------------------ --metatables @@ -231,7 +231,7 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 self.editbox:SetBackdropColor(unpack(self.enabled_backdrop_color)) self.editbox:SetTextColor(unpack(self.enabled_text_color)) if (self.editbox.borderframe) then - local r, g, b, a = DF:ParseColors(unpack(self.editbox.borderframe.onleave_backdrop)) + local r, g, b, a = detailsFramework:ParseColors(unpack(self.editbox.borderframe.onleave_backdrop)) self.editbox.borderframe:SetBackdropColor(r, g, b, a) end end @@ -320,7 +320,7 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 local OnEnterPressed = function(textentry, byScript) local object = textentry.MyObject if (object.ignoreNextCallback) then - DF.Schedules.RunNextTick(function() object.ignoreNextCallback = nil end) + detailsFramework.Schedules.RunNextTick(function() object.ignoreNextCallback = nil end) return end @@ -329,7 +329,7 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 return end - local text = DF:Trim(textentry:GetText()) + local text = detailsFramework:Trim(textentry:GetText()) if (string.len(text) > 0) then textentry.text = text if (textentry.MyObject.func) then @@ -372,7 +372,7 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 local OnEditFocusLost = function(textEntry) local object = textEntry.MyObject if (object.ignoreNextCallback) then - DF.Schedules.RunNextTick(function() object.ignoreNextCallback = nil end) + detailsFramework.Schedules.RunNextTick(function() object.ignoreNextCallback = nil end) return end @@ -383,7 +383,7 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 end if (not textEntry.focuslost) then - local text = DF:Trim(textEntry:GetText()) + local text = detailsFramework:Trim(textEntry:GetText()) if (string.len(text) > 0) then textEntry.MyObject.currenttext = text if (textEntry.MyObject.func) then @@ -447,6 +447,57 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 OnEnterPressed(self.editbox, byScript) end + function TextEntryMetaFunctions:SetAsSearchBox() + if (self.__bIsSearchBox) then + return + end + + self:SetJustifyH("left") + self:SetJustifyV("center") + self:SetTextInsets(18, 14, 0, 0) + + local magnifyingGlassTexture = self:CreateTexture(nil, "OVERLAY") + magnifyingGlassTexture:SetAtlas("common-search-magnifyingglass") + magnifyingGlassTexture:SetPoint("left", self.widget, "left", 4, 0) + magnifyingGlassTexture:SetSize(self:GetHeight()-10, self:GetHeight()-10) + magnifyingGlassTexture:SetAlpha(0.5) + + local searchFontString = self:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") + searchFontString:SetText("search") + searchFontString:SetAlpha(0.3) + searchFontString:SetPoint("left", magnifyingGlassTexture, "right", 2, 0) + detailsFramework:SetFontSize(searchFontString, 10) + + local clearSearchButton = CreateFrame("button", nil, self.widget, "UIPanelCloseButton") + clearSearchButton:SetPoint("right", self.widget, "right", -3, 0) + clearSearchButton:SetSize(10, 10) + clearSearchButton:SetAlpha(0.3) + clearSearchButton:GetNormalTexture():SetAtlas("common-search-clearbutton") + clearSearchButton:GetHighlightTexture():SetAtlas("common-search-clearbutton") + clearSearchButton:GetPushedTexture():SetAtlas("common-search-clearbutton") + clearSearchButton:Hide() + + clearSearchButton:SetScript("OnClick", function() + self:SetText("") + local bByScript = true + self:PressEnter(bByScript) + self:ClearFocus() + end) + + self:SetHook("OnEditFocusGained", function() + clearSearchButton:Show() + searchFontString:Hide() + end) + + self:SetHook("OnEditFocusLost", function() + if (self:GetText() == "") then + searchFontString:Show() + clearSearchButton:Hide() + end + end) + + self.__bIsSearchBox = true + end ------------------------------------------------------------------------------------------------------------ function TextEntryMetaFunctions:SetTemplate(template) @@ -461,12 +512,12 @@ function TextEntryMetaFunctions:SetTemplate(template) self.editbox:SetBackdrop(template.backdrop) end if (template.backdropcolor) then - local r, g, b, a = DF:ParseColors(template.backdropcolor) + local r, g, b, a = detailsFramework:ParseColors(template.backdropcolor) self.editbox:SetBackdropColor(r, g, b, a) self.onleave_backdrop = {r, g, b, a} end if (template.backdropbordercolor) then - local r, g, b, a = DF:ParseColors(template.backdropbordercolor) + local r, g, b, a = detailsFramework:ParseColors(template.backdropbordercolor) self.editbox:SetBackdropBorderColor(r, g, b, a) self.editbox.current_bordercolor[1] = r self.editbox.current_bordercolor[2] = g @@ -479,14 +530,14 @@ end ------------------------------------------------------------------------------------------------------------ --object constructor -function DF:CreateTextEntry(parent, func, w, h, member, name, with_label, entry_template, label_template) - return DF:NewTextEntry(parent, parent, name, member, w, h, func, nil, nil, nil, with_label, entry_template, label_template) +function detailsFramework:CreateTextEntry(parent, func, w, h, member, name, with_label, entry_template, label_template) + return detailsFramework:NewTextEntry(parent, parent, name, member, w, h, func, nil, nil, nil, with_label, entry_template, label_template) end -function DF:NewTextEntry(parent, container, name, member, width, height, func, param1, param2, space, withLabel, entryTemplate, labelTemplate) +function detailsFramework:NewTextEntry(parent, container, name, member, width, height, func, param1, param2, space, withLabel, entryTemplate, labelTemplate) if (not name) then - name = "DetailsFrameworkTextEntryNumber" .. DF.TextEntryCounter - DF.TextEntryCounter = DF.TextEntryCounter + 1 + name = "DetailsFrameworkTextEntryNumber" .. detailsFramework.TextEntryCounter + detailsFramework.TextEntryCounter = detailsFramework.TextEntryCounter + 1 elseif (not parent) then return error("Details! FrameWork: parent not found.", 2) @@ -497,7 +548,7 @@ function DF:NewTextEntry(parent, container, name, member, width, height, func, p end if (name:find("$parent")) then - local parentName = DF.GetParentName(parent) + local parentName = detailsFramework.GetParentName(parent) name = name:gsub("$parent", parentName) end @@ -607,7 +658,7 @@ function DF:NewTextEntry(parent, container, name, member, width, height, func, p setmetatable(newTextEntryObject, TextEntryMetaFunctions) if (withLabel) then - local label = DF:CreateLabel(newTextEntryObject.editbox, withLabel, nil, nil, nil, "label", nil, "overlay") + local label = detailsFramework:CreateLabel(newTextEntryObject.editbox, withLabel, nil, nil, nil, "label", nil, "overlay") label.text = withLabel newTextEntryObject.editbox:SetPoint("left", label.widget, "right", 2, 0) if (labelTemplate) then @@ -623,8 +674,8 @@ function DF:NewTextEntry(parent, container, name, member, width, height, func, p return newTextEntryObject, withLabel end -function DF:NewSpellEntry(parent, func, width, height, param1, param2, member, name) - local editbox = DF:NewTextEntry(parent, parent, name, member, width, height, func, param1, param2) +function detailsFramework:NewSpellEntry(parent, func, width, height, param1, param2, member, name) + local editbox = detailsFramework:NewTextEntry(parent, parent, name, member, width, height, func, param1, param2) return editbox end @@ -890,9 +941,9 @@ local set_speciallua_editor_font_size = function(borderFrame, newSize) borderFrame.editboxlines:SetFont(file, newSize, flags) end -function DF:NewSpecialLuaEditorEntry(parent, width, height, member, name, nointent, showLineNumbers) +function detailsFramework:NewSpecialLuaEditorEntry(parent, width, height, member, name, nointent, showLineNumbers) if (name:find("$parent")) then - local parentName = DF.GetParentName(parent) + local parentName = detailsFramework.GetParentName(parent) name = name:gsub("$parent", parentName) end @@ -976,7 +1027,7 @@ function DF:NewSpecialLuaEditorEntry(parent, width, height, member, name, nointe scrollframeNumberLines.editbox:SetSize(scrollframe.editbox:GetSize()) local text = scrollframe.editbox:GetText() - local textInArray = DF:SplitTextInLines(text) + local textInArray = detailsFramework:SplitTextInLines(text) local maxStringWidth = scrollframe.editbox:GetWidth() scrollframeNumberLines.editbox:SetWidth(maxStringWidth) diff --git a/Libs/LibLuaServer/LuaServerDefinitions.lua b/Libs/LibLuaServer/LuaServerDefinitions.lua index bb389bd2..026ad499 100644 --- a/Libs/LibLuaServer/LuaServerDefinitions.lua +++ b/Libs/LibLuaServer/LuaServerDefinitions.lua @@ -195,7 +195,13 @@ ---@field SetSmoothing fun(self: animation, smoothing: string) ---@field Stop fun(self: animation) +---@class line : uiobject +---@field SetStartPoint fun(self: line, point: anchorpoint, relativeFrame: uiobject, relativePoint: anchorpoint, xOffset: number, yOffset: number) +---@field SetEndPoint fun(self: line, point: anchorpoint, relativeFrame: uiobject, relativePoint: anchorpoint, xOffset: number, yOffset: number) +---@field SetColorTexture fun(self: line, red: number, green: number, blue: number, alpha: number) + ---@class frame : uiobject +---@field CreateLine fun(self: frame, name: string|nil, drawLayer: drawlayer, templateName: string|nil, subLevel: number|nil) : line ---@field SetID fun(self: frame, id: number) set an ID for the frame ---@field SetAttribute fun(self: frame, name: string, value: any) ---@field SetScript fun(self: frame, event: string, handler: function|nil) @@ -237,11 +243,11 @@ ---@class button : frame ---@field Click fun(self: button) ----@field SetNormalTexture fun(self: button, texture: texture) ----@field SetPushedTexture fun(self: button, texture: texture) ----@field SetHighlightTexture fun(self: button, texture: texture) ----@field SetDisabledTexture fun(self: button, texture: texture) ----@field SetCheckedTexture fun(self: button, texture: texture) +---@field SetNormalTexture fun(self: button, texture: textureid|texturepath) +---@field SetPushedTexture fun(self: button, texture: textureid|texturepath) +---@field SetHighlightTexture fun(self: button, texture: textureid|texturepath) +---@field SetDisabledTexture fun(self: button, texture: textureid|texturepath) +---@field SetCheckedTexture fun(self: button, texture: textureid|texturepath) ---@field SetNormalFontObject fun(self: button, fontString: fontstring) ---@field SetHighlightFontObject fun(self: button, fontString: fontstring) ---@field SetDisabledFontObject fun(self: button, fontString: fontstring) diff --git a/classes/class_instance.lua b/classes/class_instance.lua index 38e68c63..d0b8f2f0 100644 --- a/classes/class_instance.lua +++ b/classes/class_instance.lua @@ -97,9 +97,10 @@ end ---@param func function ---@vararg any function Details:InstanciaCallFunction(func, ...) - for index, instancia in ipairs(Details.tabela_instancias) do - if (instancia:IsAtiva()) then - func(_, instancia, ...) + for index, instance in ipairs(Details.tabela_instancias) do + ---@cast instance instance + if (instance:IsEnabled()) then + func(_, instance, ...) end end end @@ -2300,7 +2301,7 @@ function _detalhes:InstanceReset(instance) end Details.FadeHandler.Fader(self, "in", nil, "barras") - self:AtualizaSegmentos(self) + self:UpdateCombatObjectInUse(self) self:AtualizaSoloMode_AfertReset() self:ResetaGump() @@ -2481,18 +2482,20 @@ function _detalhes:UnFreeze(instancia) end end -function _detalhes:AtualizaSegmentos (instancia) - if (instancia.iniciada) then - if (instancia.segmento == -1) then - --instancia.baseframe.rodape.segmento:SetText(segmentos.overall) --localiza-me - instancia.showing = _detalhes.tabela_overall - elseif (instancia.segmento == 0) then - --instancia.baseframe.rodape.segmento:SetText(segmentos.current) --localiza-me - instancia.showing = _detalhes.tabela_vigente - --print("==> Changing the Segment now! - classe_instancia.lua 1922") +--handle internal details! events +local eventListener = Details:CreateEventListener() +eventListener:RegisterEvent("DETAILS_DATA_SEGMENTREMOVED", function() + Details:InstanciaCallFunction(Details.UpdateCombatObjectInUse) +end) + +function Details:UpdateCombatObjectInUse(instance) + if (instance.iniciada) then + if (instance.segmento == -1) then + instance.showing = Details.tabela_overall + elseif (instance.segmento == 0) then + instance.showing = Details.tabela_vigente else - instancia.showing = _detalhes.tabela_historico.tabelas [instancia.segmento] - --instancia.baseframe.rodape.segmento:SetText(segmentos.past..instancia.segmento) --localiza-me + instance.showing = Details.tabela_historico.tabelas[instance.segmento] end end end diff --git a/classes/container_segments.lua b/classes/container_segments.lua index 3834e7dd..34a4dc76 100644 --- a/classes/container_segments.lua +++ b/classes/container_segments.lua @@ -336,7 +336,7 @@ function segmentClass:AddCombat(combatObject) --remove local combatObjectRemoved = table.remove(segmentTable, 3) if (combatObjectRemoved) then - Details:DestroyCombat(thirdCombat) + Details:DestroyCombat(combatObjectRemoved) Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED") end end @@ -511,8 +511,9 @@ function segmentClass:ResetAllCombatData() Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED") end - Details:DestroyCombat(Details.tabela_overall) + Details:DestroyCombat(Details.tabela_overall) --not creating a new one immediatelly Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED") + Details:Destroy(Details.spellcache) if (Details.schedule_add_to_overall) then --deprecated @@ -533,6 +534,17 @@ function segmentClass:ResetAllCombatData() -- cria nova tabela do combate atual Details.tabela_vigente = combatClass:NovaTabela(nil, Details.tabela_overall) + ---@type instance[] + local allInstances = Details:GetAllInstances() + + for i = 1, #allInstances do + ---@type instance + local instance = allInstances[i] + if (instance:IsEnabled()) then + Details:UpdateCombatObjectInUse(instance) + end + end + --marca o addon como fora de combate Details.in_combat = false --zera o contador de combates @@ -561,7 +573,7 @@ function segmentClass:ResetAllCombatData() Details.schedule_hard_garbage_collect = true end - Details:InstanciaCallFunction(Details.AtualizaSegmentos) -- atualiza o instancia.showing para as novas tabelas criadas + Details:InstanciaCallFunction(Details.UpdateCombatObjectInUse) -- atualiza o instancia.showing para as novas tabelas criadas Details:InstanciaCallFunction(Details.AtualizaSoloMode_AfertReset) -- verifica se precisa zerar as tabela da janela solo mode Details:InstanciaCallFunction(Details.ResetaGump) --_detalhes:ResetaGump("de todas as instancias") Details:InstanciaCallFunction(Details.FadeHandler.Fader, "IN", nil, "barras") diff --git a/core/control.lua b/core/control.lua index e29c8cea..d73e21fe 100644 --- a/core/control.lua +++ b/core/control.lua @@ -328,7 +328,7 @@ Details:InstanciaCallFunction(Details.ResetaGump, nil, -1) --reseta scrollbar, iterators, rodap�, etc Details:InstanciaCallFunction(Details.InstanciaFadeBarras, -1) --esconde todas as barras - Details:InstanciaCallFunction(Details.AtualizaSegmentos) --atualiza o showing + Details:InstanciaCallFunction(Details.UpdateCombatObjectInUse) --atualiza o showing end --re-lock nos tempos da tabela passada -- lock again last table times diff --git a/core/meta.lua b/core/meta.lua index 76da1911..f8b7e142 100644 --- a/core/meta.lua +++ b/core/meta.lua @@ -725,6 +725,12 @@ local classTypeUtility = Details.atributos.misc return amountCleaned end + if (combatObject.__destroyed) then + Details:Msg("a deleted combat object was found on g2.collector, please report this bug on discord:") + Details:Msg("combat destroyed by:", combatObject.__destroyedBy) + return 0 + end + ---@type number local _tempo = _time() diff --git a/core/plugins.lua b/core/plugins.lua index ccf3999a..b9c93866 100644 --- a/core/plugins.lua +++ b/core/plugins.lua @@ -7,6 +7,7 @@ local detailsFramework = DetailsFramework local UIParent = UIParent local UISpecialFrames = UISpecialFrames + local breakdownWindowFrame = Details.BreakdownWindowFrame DETAILSPLUGIN_ALWAYSENABLED = 0x1 --[[GLOBAL]] @@ -527,6 +528,12 @@ LibWindow.SavePosition(pluginContainerFrame) Details:Msg("detected options panel out of screen, position has reset") end + + local scaleFactor = pluginContainerFrame:GetScale() + if (scaleFactor < 0.65) then + pluginContainerFrame:SetScale(0.65) + Details:Msg("detected options panel scale issue, scale has reset, please reload the UI") + end end) end) @@ -564,11 +571,32 @@ end local hideOtherPluginFrames = function(pluginObject) + local bIsShowingAPlugin = Details222.BreakdownWindow.IsPluginShown() + local pluginShownInBreakdownWindow = breakdownWindowFrame.GetShownPluginObject() + for index, thisPluginObject in ipairs(pluginContainerFrame.EmbedPlugins) do if (thisPluginObject ~= pluginObject) then - --hide this plugin - if (thisPluginObject.Frame:IsShown()) then - thisPluginObject.Frame:Hide() + if (thisPluginObject.__isUtility) then + --hide this plugin + if (thisPluginObject.Frame:IsShown()) then + thisPluginObject.Frame:Hide() + end + else + if (bIsShowingAPlugin) then + if (pluginShownInBreakdownWindow == thisPluginObject) then + --do nothing yet + else + --hide this plugin + if (thisPluginObject.Frame:IsShown()) then + thisPluginObject.Frame:Hide() + end + end + else + --hide this plugin + if (thisPluginObject.Frame:IsShown()) then + thisPluginObject.Frame:Hide() + end + end end end end @@ -686,6 +714,7 @@ newButton.PluginAbsName = pluginObject.real_name newButton.PluginName = pluginObject.__name newButton.IsUtility = bIsUtility + pluginObject.__isUtility = bIsUtility newButton:SetTemplate(detailsFramework:GetTemplate("button", "DETAILS_PLUGINPANEL_BUTTON_TEMPLATE")) newButton:SetText(pluginObject.__name) diff --git a/frames/window_breakdown/window_playerbreakdown.lua b/frames/window_breakdown/window_playerbreakdown.lua index 114339eb..b0ba118d 100644 --- a/frames/window_breakdown/window_playerbreakdown.lua +++ b/frames/window_breakdown/window_playerbreakdown.lua @@ -59,12 +59,26 @@ local summaryWidgets = {} local currentTab = "Summary" local subAttributes = Details.sub_atributos +---return true if the breakdown window is shown and showing a plugin +---@return boolean +function Details222.BreakdownWindow.IsPluginShown() + if (breakdownWindowFrame:IsShown()) then + return breakdownWindowFrame.shownPluginObject ~= nil + end + return false +end + +function breakdownWindowFrame.GetShownPluginObject() + return breakdownWindowFrame.shownPluginObject +end + function Details222.BreakdownWindow.OnShowPluginFrame(pluginObject) --need to selected the selected tab and hide its content for index = 1, #Details.player_details_tabs do local tabButton = Details.player_details_tabs[index] tabButton.frame:Hide() end + breakdownWindowFrame.BreakdownTabsFrame:Hide() breakdownWindowFrame.shownPluginObject = pluginObject @@ -575,7 +589,7 @@ function Details:CreateBreakdownWindow() breakdownWindowFrame:EnableMouse(true) breakdownWindowFrame:SetResizable(true) breakdownWindowFrame:SetMovable(true) - breakdownWindowFrame:SetClampedToScreen(true) + --breakdownWindowFrame:SetClampedToScreen(true) --make the window movable if (not breakdownWindowFrame.registeredLibWindow) then diff --git a/frames/window_options2.lua b/frames/window_options2.lua index ec79d199..f2a6a25b 100644 --- a/frames/window_options2.lua +++ b/frames/window_options2.lua @@ -3,7 +3,7 @@ if (true) then end local Details = _G.Details -local DF = _G.DetailsFramework +local detailsFramework = _G.DetailsFramework local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details") --options panel namespace @@ -18,12 +18,12 @@ local preset_version = 3 Details.preset_version = preset_version --templates -local options_text_template = DF:GetTemplate("font", "OPTIONS_FONT_TEMPLATE") -local options_dropdown_template = DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") -local options_switch_template = DF:GetTemplate("switch", "OPTIONS_CHECKBOX_TEMPLATE") -local options_slider_template = DF:GetTemplate("slider", "OPTIONS_SLIDER_TEMPLATE") -local options_button_template = DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE") -local options_button_template_selected = DF.table.copy({}, DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) +local options_text_template = detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE") +local options_dropdown_template = detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") +local options_switch_template = detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_TEMPLATE") +local options_slider_template = detailsFramework:GetTemplate("slider", "OPTIONS_SLIDER_TEMPLATE") +local options_button_template = detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE") +local options_button_template_selected = detailsFramework.table.copy({}, detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) options_button_template_selected.backdropbordercolor = {1, .8, .2} --options @@ -36,25 +36,25 @@ function Details:InitializeOptionsWindow(instance) end function Details.options.InitializeOptionsWindow(instance) - local DetailsOptionsWindow = DF:NewPanel(UIParent, _, "DetailsOptionsWindow", _, 897, 592) - local f = DetailsOptionsWindow.frame + local DetailsOptionsWindow = detailsFramework:NewPanel(UIParent, _, "DetailsOptionsWindow", _, 897, 592) + local optionsFrame = DetailsOptionsWindow.frame - f.Frame = f - f.__name = "Options" - f.real_name = "DETAILS_OPTIONS" - f.__icon = [[Interface\Scenarios\ScenarioIcon-Interact]] - _G.DetailsPluginContainerWindow.EmbedPlugin(f, f, true) + optionsFrame.Frame = optionsFrame + optionsFrame.__name = "Options" + optionsFrame.real_name = "DETAILS_OPTIONS" + optionsFrame.__icon = [[Interface\Scenarios\ScenarioIcon-Interact]] + _G.DetailsPluginContainerWindow.EmbedPlugin(optionsFrame, optionsFrame, true) - f.sectionFramesContainer = {} + optionsFrame.sectionFramesContainer = {} - DF:ApplyStandardBackdrop(f) - local titleBar = DF:CreateTitleBar(f, "Options Panel") + detailsFramework:ApplyStandardBackdrop(optionsFrame) + local titleBar = detailsFramework:CreateTitleBar(optionsFrame, "Options Panel") titleBar.Text:Hide() - local titleText = DF:NewLabel(titleBar, nil, "$parentTitleLabel", "title", "Details! " .. Loc ["STRING_OPTIONS_WINDOW"], "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) + local titleText = detailsFramework:NewLabel(titleBar, nil, "$parentTitleLabel", "title", "Details! " .. Loc ["STRING_OPTIONS_WINDOW"], "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) titleText:SetPoint("center", titleBar, "center") - f:Hide() + optionsFrame:Hide() local formatFooterText = function(object) object.fontface = "GameFontNormal" @@ -63,80 +63,82 @@ function Details.options.InitializeOptionsWindow(instance) end --create a floating frame to hold footer frames - local footerFrame = CreateFrame("frame", "$parentFooterFrame", f, "BackdropTemplate") - footerFrame:SetPoint("bottomleft", f, "bottomleft", 0, 0) - footerFrame:SetPoint("bottomright", f, "bottomright", 0, 0) + local footerFrame = CreateFrame("frame", "$parentFooterFrame", optionsFrame, "BackdropTemplate") + footerFrame:SetPoint("bottomleft", optionsFrame, "bottomleft", 0, 0) + footerFrame:SetPoint("bottomright", optionsFrame, "bottomright", 0, 0) footerFrame:SetHeight(50) - footerFrame:SetFrameLevel(f:GetFrameLevel() + 10) - DF:ApplyStandardBackdrop(footerFrame) + footerFrame:SetFrameLevel(optionsFrame:GetFrameLevel() + 10) + detailsFramework:ApplyStandardBackdrop(footerFrame) local gradientBelowTheLine = DetailsFramework:CreateTexture(footerFrame, {gradient = "vertical", fromColor = {0, 0, 0, 0.25}, toColor = "transparent"}, 1, 90, "artwork", {0, 1, 0, 1}, "dogGradient") gradientBelowTheLine:SetPoint("bottoms") --select the instance to edit local onSelectInstance = function(_, _, instanceId) - local instance = Details.tabela_instancias[instanceId] - if (not instance:IsEnabled() or not instance:IsStarted()) then - Details.CriarInstancia (_, _, instance.meu_id) + ---@type instance + local instanceObject = Details.tabela_instancias[instanceId] + if (not instanceObject:IsEnabled() or not instanceObject:IsStarted()) then + Details.CriarInstancia (_, _, instanceObject.meu_id) end - Details.options.SetCurrentInstanceAndRefresh(instance) - f.updateMicroFrames() + + Details.options.SetCurrentInstanceAndRefresh(instanceObject) + optionsFrame.updateMicroFrames() end local buildInstanceMenu = function() local instanceList = {} for index = 1, math.min (#Details.tabela_instancias, Details.instances_amount) do - local instance = Details.tabela_instancias[index] + local instanceObject = Details.tabela_instancias[index] --what the window is showing - local atributo = instance.atributo - local sub_atributo = instance.sub_atributo + local atributo = instanceObject.atributo + local sub_atributo = instanceObject.sub_atributo if (atributo == 5) then --custom - local CustomObject = Details.custom [sub_atributo] + local CustomObject = Details.custom[sub_atributo] if (not CustomObject) then - instance:ResetAttribute() - atributo = instance.atributo - sub_atributo = instance.sub_atributo - instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. Details.atributos.lista [atributo] .. " - " .. Details.sub_atributos [atributo].lista [sub_atributo], onclick = onSelectInstance, icon = Details.sub_atributos [atributo].icones[sub_atributo] [1], texcoord = Details.sub_atributos [atributo].icones[sub_atributo] [2]} + instanceObject:ResetAttribute() + atributo = instanceObject.atributo + sub_atributo = instanceObject.sub_atributo + instanceList[#instanceList+1] = {value = index, label = "#".. index .. " " .. Details.atributos.lista[atributo] .. " - " .. Details.sub_atributos[atributo].lista[sub_atributo], onclick = onSelectInstance, icon = Details.sub_atributos[atributo].icones[sub_atributo][1], texcoord = Details.sub_atributos[atributo].icones[sub_atributo][2]} else - instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. CustomObject.name, onclick = onSelectInstance, icon = CustomObject.icon} + instanceList[#instanceList+1] = {value = index, label = "#".. index .. " " .. CustomObject.name, onclick = onSelectInstance, icon = CustomObject.icon} end else - local modo = instance.modo + local modo = instanceObject.modo if (modo == 1) then --solo plugin atributo = Details.SoloTables.Mode or 1 - local SoloInfo = Details.SoloTables.Menu [atributo] + local SoloInfo = Details.SoloTables.Menu[atributo] if (SoloInfo) then - instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. SoloInfo [1], onclick = onSelectInstance, icon = SoloInfo [2]} + instanceList[#instanceList+1] = {value = index, label = "#".. index .. " " .. SoloInfo[1], onclick = onSelectInstance, icon = SoloInfo [2]} else - instanceList [#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""} + instanceList[#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""} end elseif (modo == 4) then --raid plugin - local plugin_name = instance.current_raid_plugin or instance.last_raid_plugin + local plugin_name = instanceObject.current_raid_plugin or instanceObject.last_raid_plugin if (plugin_name) then - local plugin_object = Details:GetPlugin (plugin_name) + local plugin_object = Details:GetPlugin(plugin_name) if (plugin_object) then - instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. plugin_object.__name, onclick = onSelectInstance, icon = plugin_object.__icon} + instanceList[#instanceList+1] = {value = index, label = "#".. index .. " " .. plugin_object.__name, onclick = onSelectInstance, icon = plugin_object.__icon} else - instanceList [#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""} + instanceList[#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""} end else - instanceList [#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""} + instanceList[#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""} end else - instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. Details.atributos.lista [atributo] .. " - " .. Details.sub_atributos [atributo].lista [sub_atributo], onclick = onSelectInstance, icon = Details.sub_atributos [atributo].icones[sub_atributo] [1], texcoord = Details.sub_atributos [atributo].icones[sub_atributo] [2]} + instanceList[#instanceList+1] = {value = index, label = "#".. index .. " " .. Details.atributos.lista[atributo] .. " - " .. Details.sub_atributos [atributo].lista [sub_atributo], onclick = onSelectInstance, icon = Details.sub_atributos [atributo].icones[sub_atributo] [1], texcoord = Details.sub_atributos [atributo].icones[sub_atributo] [2]} end end end return instanceList end - local instanceSelection = DF:NewDropDown (footerFrame, _, "$parentInstanceSelectDropdown", "instanceDropdown", 200, 18, buildInstanceMenu) --, nil, options_dropdown_template - f.instanceDropdown = instanceSelection - instanceSelection:SetPoint("bottomright", f, "bottomright", -7, 09) + local instanceSelection = detailsFramework:NewDropDown(footerFrame, _, "$parentInstanceSelectDropdown", "instanceDropdown", 200, 18, buildInstanceMenu) --, nil, options_dropdown_template + optionsFrame.instanceDropdown = instanceSelection + instanceSelection:SetPoint("bottomright", optionsFrame, "bottomright", -7, 09) instanceSelection:SetTemplate(options_dropdown_template) instanceSelection:SetHook("OnEnter", function() GameCooltip:Reset() @@ -148,11 +150,11 @@ function Details.options.InitializeOptionsWindow(instance) GameCooltip:Hide() end) - local instances_string = DF:NewLabel(footerFrame, nil, "$parentInstanceDropdownLabel", "instancetext", Loc ["STRING_OPTIONS_EDITINSTANCE"], "GameFontNormal", 12) + local instances_string = detailsFramework:NewLabel(footerFrame, nil, "$parentInstanceDropdownLabel", "instancetext", Loc ["STRING_OPTIONS_EDITINSTANCE"], "GameFontNormal", 12) instances_string:SetPoint("right", instanceSelection, "left", -2, 1) formatFooterText(instances_string) - local bigdogImage = DF:NewImage(footerFrame, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 180*0.9, 200*0.9, nil, {1, 0, 0, 1}, "backgroundBigDog", "$parentBackgroundBigDog") + local bigdogImage = detailsFramework:NewImage(footerFrame, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 180*0.9, 200*0.9, nil, {1, 0, 0, 1}, "backgroundBigDog", "$parentBackgroundBigDog") bigdogImage:SetPoint("bottomright", footerFrame, "topright", 0, 0) bigdogImage:SetAlpha(.25) @@ -160,17 +162,17 @@ function Details.options.InitializeOptionsWindow(instance) local onToggleEditingGroup = function(self, fixparam, value) Details.options_group_edit = value end - local editingGroupCheckBox = DF:CreateSwitch(footerFrame, onToggleEditingGroup, Details.options_group_edit, _, _, _, _, _, "$parentEditGroupCheckbox", _, _, _, _, DF:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE")) + local editingGroupCheckBox = detailsFramework:CreateSwitch(footerFrame, onToggleEditingGroup, Details.options_group_edit, _, _, _, _, _, "$parentEditGroupCheckbox", _, _, _, _, detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE")) editingGroupCheckBox:SetAsCheckBox() editingGroupCheckBox.tooltip = Loc ["STRING_MINITUTORIAL_OPTIONS_PANEL2"] - local editingGroupLabel = DF:NewLabel(footerFrame, nil, "$parentEditingGroupLabel", "editingGroupLabel", "Editing Group:", "GameFontNormal", 12) --localize-me + local editingGroupLabel = detailsFramework:NewLabel(footerFrame, nil, "$parentEditingGroupLabel", "editingGroupLabel", "Editing Group:", "GameFontNormal", 12) --localize-me editingGroupLabel:SetPoint("bottomleft", instances_string, "topleft", 0, 5) editingGroupCheckBox:SetPoint("left", editingGroupLabel, "right", 2, 0) formatFooterText(editingGroupLabel) --create test bars - DF:NewColor("C_OptionsButtonOrange", 0.9999, 0.8196, 0, 1) + detailsFramework:NewColor("C_OptionsButtonOrange", 0.9999, 0.8196, 0, 1) local create_test_bars_func = function() Details.CreateTestBars() if (not Details.test_bar_update) then @@ -179,33 +181,33 @@ function Details.options.InitializeOptionsWindow(instance) Details:StopTestBarUpdate() end end - local fillbars = DF:NewButton(footerFrame, _, "$parentCreateExampleBarsButton", nil, 140, 20, create_test_bars_func, nil, nil, nil, Loc ["STRING_OPTIONS_TESTBARS"], 1) - fillbars:SetPoint("bottomleft", f.widget, "bottomleft", 10, 10) + local fillbars = detailsFramework:NewButton(footerFrame, _, "$parentCreateExampleBarsButton", nil, 140, 20, create_test_bars_func, nil, nil, nil, Loc ["STRING_OPTIONS_TESTBARS"], 1) + fillbars:SetPoint("bottomleft", optionsFrame.widget, "bottomleft", 10, 10) fillbars:SetTemplate(options_button_template) fillbars:SetIcon ("Interface\\AddOns\\Details\\images\\icons", nil, nil, nil, {323/512, 365/512, 42/512, 78/512}, {1, 1, 1, 0.6}, 4, 2) --change log - local changelog = DF:NewButton(footerFrame, _, "$parentOpenChangeLogButton", nil, 140, 20, Details.OpenNewsWindow, "change_log", nil, nil, Loc ["STRING_OPTIONS_CHANGELOG"], 1) + local changelog = detailsFramework:NewButton(footerFrame, _, "$parentOpenChangeLogButton", nil, 140, 20, Details.OpenNewsWindow, "change_log", nil, nil, Loc ["STRING_OPTIONS_CHANGELOG"], 1) changelog:SetPoint("left", fillbars, "right", 10, 0) changelog:SetTemplate(options_button_template) changelog:SetIcon ("Interface\\AddOns\\Details\\images\\icons", nil, nil, nil, {367/512, 399/512, 43/512, 76/512}, {1, 1, 1, 0.8}, 4, 2) --search field - local searchBox = DF:CreateTextEntry(footerFrame, function()end, 140, 20, _, _, _, options_dropdown_template) + local searchBox = detailsFramework:CreateTextEntry(footerFrame, function()end, 140, 20, _, _, _, options_dropdown_template) searchBox:SetPoint("left", changelog, "right", 10, 0) - local searchLabel = DF:CreateLabel(footerFrame, "Search:") --localize-me + local searchLabel = detailsFramework:CreateLabel(footerFrame, "Search:") --localize-me searchLabel:SetPoint("bottomleft", searchBox, "topleft", 0, 2) formatFooterText(searchLabel) searchBox:SetHook("OnChar", function() if (searchBox.text ~= "") then - local searchSection = f.sectionFramesContainer[19] + local searchSection = optionsFrame.sectionFramesContainer[19] searchSection.sectionButton:Enable() searchSection.sectionButton:Click() local searchingFor = searchBox.text - local allSectionFrames = f.sectionFramesContainer + local allSectionFrames = optionsFrame.sectionFramesContainer local allSectionNames = {} local allSectionOptions = {} @@ -249,9 +251,9 @@ function Details.options.InitializeOptionsWindow(instance) if (optionName:find(searchingText)) then if optionData.header ~= lastTab then if lastTab ~= nil then - options[#options+1] = {type = "label", get = function() return "" end, text_template = DF:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")} -- blank + options[#options+1] = {type = "label", get = function() return "" end, text_template = detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")} -- blank end - options[#options+1] = {type = "label", get = function() return optionData.header end, text_template = {color = "silver", size = 14, font = DF:GetBestFontForLanguage()}} + options[#options+1] = {type = "label", get = function() return optionData.header end, text_template = {color = "silver", size = 14, font = detailsFramework:GetBestFontForLanguage()}} lastTab = optionData.header lastLabel = nil end @@ -266,10 +268,10 @@ function Details.options.InitializeOptionsWindow(instance) local startX = 200 local startY = -60 - DF:BuildMenuVolatile(searchSection, options, startX, startY, 560, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template, globalCallback) + detailsFramework:BuildMenuVolatile(searchSection, options, startX, startY, 560, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template, globalCallback) else - f.sectionFramesContainer[19].sectionButton:Disable() + optionsFrame.sectionFramesContainer[19].sectionButton:Disable() end end) @@ -314,17 +316,17 @@ function Details.options.InitializeOptionsWindow(instance) function Details.options.SelectOptionsSection(sectionId) for i = 1, maxSectionIds do - f.sectionFramesContainer[i]:Hide() - if (f.sectionFramesContainer[i].sectionButton) then - f.sectionFramesContainer[i].sectionButton:SetTemplate(options_button_template) - f.sectionFramesContainer[i].sectionButton:SetIcon({.4, .4, .4}, 4, section_menu_button_height -4, "overlay") + optionsFrame.sectionFramesContainer[i]:Hide() + if (optionsFrame.sectionFramesContainer[i].sectionButton) then + optionsFrame.sectionFramesContainer[i].sectionButton:SetTemplate(options_button_template) + optionsFrame.sectionFramesContainer[i].sectionButton:SetIcon({.4, .4, .4}, 4, section_menu_button_height -4, "overlay") end end - f.sectionFramesContainer[sectionId]:Show() + optionsFrame.sectionFramesContainer[sectionId]:Show() --hightlight the option button - f.sectionFramesContainer[sectionId].sectionButton:SetTemplate(options_button_template_selected) - f.sectionFramesContainer[sectionId].sectionButton:SetIcon({1, 1, 0}, 4, section_menu_button_height -4, "overlay") + optionsFrame.sectionFramesContainer[sectionId].sectionButton:SetTemplate(options_button_template_selected) + optionsFrame.sectionFramesContainer[sectionId].sectionButton:SetIcon({1, 1, 0}, 4, section_menu_button_height -4, "overlay") end Details.options.SetCurrentInstance(instance) @@ -332,17 +334,17 @@ function Details.options.InitializeOptionsWindow(instance) --create frames for sections for index, sectionId in ipairs(optionsSectionsOrder) do if (type(sectionId) == "number") then - local sectionFrame = CreateFrame("frame", "$parentTab" .. sectionId, f, "BackdropTemplate") - sectionFrame:SetPoint("topleft", f, "topleft", -40, 22) - sectionFrame:SetSize(f:GetSize()) + local sectionFrame = CreateFrame("frame", "$parentTab" .. sectionId, optionsFrame, "BackdropTemplate") + sectionFrame:SetPoint("topleft", optionsFrame, "topleft", -40, 22) + sectionFrame:SetSize(optionsFrame:GetSize()) sectionFrame:EnableMouse(false) - local realBackdropAreaFrame = CreateFrame("frame", "$parentTab" .. sectionId .. "BackdropArea", f, "BackdropTemplate") - realBackdropAreaFrame:SetFrameLevel(f:GetFrameLevel()-1) + local realBackdropAreaFrame = CreateFrame("frame", "$parentTab" .. sectionId .. "BackdropArea", optionsFrame, "BackdropTemplate") + realBackdropAreaFrame:SetFrameLevel(optionsFrame:GetFrameLevel()-1) realBackdropAreaFrame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) realBackdropAreaFrame:SetBackdropColor(0.1215, 0.1176, 0.1294, .1) realBackdropAreaFrame:SetBackdropBorderColor(0.2, 0.2, 0.2, .05) - realBackdropAreaFrame:SetPoint("topleft", f, "topleft", 150, -27) + realBackdropAreaFrame:SetPoint("topleft", optionsFrame, "topleft", 150, -27) realBackdropAreaFrame:SetSize(775, 570) local leftGradient = DetailsFramework:CreateTexture(sectionFrame, {gradient = "horizontal", fromColor = {0, 0, 0, 0}, toColor = {0, 0, 0, 0.3}}, 10, 1, "artwork", {0, 1, 0, 1}, "leftGradient") @@ -357,7 +359,7 @@ function Details.options.InitializeOptionsWindow(instance) bottomGradient:SetPoint("bottoms") sectionFrame.name = sectionsName[sectionId] - f.sectionFramesContainer[sectionId] = sectionFrame + optionsFrame.sectionFramesContainer[sectionId] = sectionFrame local buildOptionSectionFunc = Details.optionsSection[sectionId] if (buildOptionSectionFunc) then @@ -365,9 +367,9 @@ function Details.options.InitializeOptionsWindow(instance) buildOptionSectionFunc(sectionFrame) --create a button for the section - local sectionButton = DF:CreateButton(f, function() Details.options.SelectOptionsSection(sectionId) end, section_menu_button_width, section_menu_button_height, sectionsName[sectionId], sectionId, nil, nil, nil, "$parentButtonSection" .. sectionId, nil, options_button_template, options_text_template) + local sectionButton = detailsFramework:CreateButton(optionsFrame, function() Details.options.SelectOptionsSection(sectionId) end, section_menu_button_width, section_menu_button_height, sectionsName[sectionId], sectionId, nil, nil, nil, "$parentButtonSection" .. sectionId, nil, options_button_template, options_text_template) sectionButton:SetIcon({.4, .4, .4}, 4, section_menu_button_height -4, "overlay") - sectionButton:SetPoint("topleft", f, "topleft", 10, buttonYPosition) + sectionButton:SetPoint("topleft", optionsFrame, "topleft", 10, buttonYPosition) buttonYPosition = buttonYPosition - (section_menu_button_height + 1) sectionFrame.sectionButton = sectionButton @@ -384,10 +386,10 @@ function Details.options.InitializeOptionsWindow(instance) end function Details.options.GetOptionsSection(sectionId) - return f.sectionFramesContainer[sectionId] + return optionsFrame.sectionFramesContainer[sectionId] end - function f.RefreshWindow() + function optionsFrame.RefreshWindow() if (not _G.DetailsOptionsWindow.instance) then local lowerInstance = Details:GetLowerInstanceNumber() if (not lowerInstance) then @@ -406,12 +408,16 @@ function Details.options.InitializeOptionsWindow(instance) end -- ~options -function Details:OpenOptionsWindow(instance, no_reopen, section) +---open the options window +---@param instance instance +---@param bNoReopen boolean|nil +---@param section any +function Details:OpenOptionsWindow(instance, bNoReopen, section) if (not instance.GetId or not instance:GetId()) then - instance, no_reopen, section = unpack(instance) + instance, bNoReopen, section = unpack(instance) end - if (not no_reopen and not instance:IsEnabled() or not instance:IsStarted()) then + if (not bNoReopen and not instance:IsEnabled() or not instance:IsStarted()) then Details:CreateInstance(instance:GetId()) end diff --git a/functions/mythicdungeon.lua b/functions/mythicdungeon.lua index 2c3859a6..ba810828 100644 --- a/functions/mythicdungeon.lua +++ b/functions/mythicdungeon.lua @@ -159,7 +159,7 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --update all windows Details:InstanciaCallFunction(Details.FadeHandler.Fader, "IN", nil, "barras") - Details:InstanciaCallFunction(Details.AtualizaSegmentos) + Details:InstanciaCallFunction(Details.UpdateCombatObjectInUse) Details:InstanciaCallFunction(Details.AtualizaSoloMode_AfertReset) Details:InstanciaCallFunction(Details.ResetaGump) Details:RefreshMainWindow(-1, true) @@ -272,7 +272,7 @@ function DetailsMythicPlusFrame.MergeTrashCleanup (isFromSchedule) --update all windows Details:InstanciaCallFunction(Details.FadeHandler.Fader, "IN", nil, "barras") - Details:InstanciaCallFunction(Details.AtualizaSegmentos) + Details:InstanciaCallFunction(Details.UpdateCombatObjectInUse) Details:InstanciaCallFunction(Details.AtualizaSoloMode_AfertReset) Details:InstanciaCallFunction(Details.ResetaGump) Details:RefreshMainWindow(-1, true) @@ -374,7 +374,7 @@ function DetailsMythicPlusFrame.MergeRemainingTrashAfterAllBossesDone() --update all windows Details:InstanciaCallFunction(Details.FadeHandler.Fader, "IN", nil, "barras") - Details:InstanciaCallFunction(Details.AtualizaSegmentos) + Details:InstanciaCallFunction(Details.UpdateCombatObjectInUse) Details:InstanciaCallFunction(Details.AtualizaSoloMode_AfertReset) Details:InstanciaCallFunction(Details.ResetaGump) Details:RefreshMainWindow(-1, true) diff --git a/functions/slash.lua b/functions/slash.lua index 64e00490..736cb414 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -1373,7 +1373,7 @@ function SlashCmdList.DETAILS (msg, editbox) collectgarbage() Details:InstanciaCallFunction(Details.FadeHandler.Fader, "in", nil, "barras") - Details:InstanciaCallFunction(Details.AtualizaSegmentos) + Details:InstanciaCallFunction(Details.UpdateCombatObjectInUse) Details:InstanciaCallFunction(Details.AtualizaSoloMode_AfertReset) Details:InstanciaCallFunction(Details.ResetaGump) Details:RefreshMainWindow(-1, true)