Skip to content

Commit

Permalink
Release: Framework, OpenRaid updates + changes from the last 2 weeks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Dec 4, 2024
1 parent 45fc53a commit c9a1096
Show file tree
Hide file tree
Showing 16 changed files with 848 additions and 567 deletions.
4 changes: 2 additions & 2 deletions Details.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 110005
## Interface-Cata: 40400
## Interface-Cata: 40401
## Title: Details! Damage Meter
## Notes: Essential tool to impress that chick in your raid.
## Notes-ruRU: Незаменимый инструмент, чтобы произвести впечатление на цыпочку в вашем рейде.
Expand All @@ -10,7 +10,7 @@
## IconTexture: Interface\AddOns\Details\images\minimap

## X-Curse-Project-ID: 61284
## X-Wago-ID: 25NRDlK3
## X-Wago-ID: qv63A7Gb

#@no-lib-strip@
Libs\libs.xml
Expand Down
4 changes: 2 additions & 2 deletions Details_Cata.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 40400
## Interface: 40401
## Title: Details! Damage Meter
## Notes: Essential tool to impress that chick in your raid.
## Notes-ruRU: Незаменимый инструмент, чтобы произвести впечатление на цыпочку в вашем рейде.
Expand All @@ -9,7 +9,7 @@
## IconTexture: Interface\AddOns\Details\images\minimap

## X-Curse-Project-ID: 61284
## X-Wago-ID: 25NRDlK3
## X-Wago-ID: qv63A7Gb

#@no-lib-strip@
Libs\libs.xml
Expand Down
63 changes: 63 additions & 0 deletions Libs/DF/buildmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,36 @@ local setExecuteProperties = function(parent, widget, widgetTable, currentXOffse
return maxColumnWidth, maxWidgetWidth, latestInlineWidget
end

local setImageProperties = function(parent, widget, widgetTable, currentXOffset, currentYOffset)
--.texture .width .height .filterType .texcoord
if (type(widgetTable.texture) == "table") then
local r, g, b, a = detailsFramework:ParseColors(widgetTable.texture)
widget:SetColorTexture(r, g, b, a)
else
widget:SetTexture(widgetTable.texture, "CLAMP", "CLAMP", widgetTable.filterType)
end

widget:SetSize(widgetTable.width, widgetTable.height)

local left, right, top, bottom = 0, 1, 0, 1
if (widgetTable.texcoord) then
left, right, top, bottom = unpack(widgetTable.texcoord)
end
widget:SetTexCoord(left, right, top, bottom)

if (widgetTable.vertexcolor) then
local r, g, b, a = detailsFramework:ParseColors(widgetTable.vertexcolor)
widget:SetVertexColor(r, g, b, a)
else
widget:SetVertexColor(1, 1, 1, 1)
end

setWidgetId(parent, widgetTable, widget)

widget:ClearAllPoints()
widget:SetPoint("topleft", parent, "topleft", currentXOffset, currentYOffset)
end

local setTextEntryProperties = function(parent, widget, widgetTable, currentXOffset, currentYOffset, template, widgetWidth, widgetHeight, bAlignAsPairs, nAlignAsPairsLength, valueChangeHook, maxColumnWidth, maxWidgetWidth, textTemplate, latestInlineWidget)
widget._get = widgetTable.get
widget.text = widgetTable.get()
Expand Down Expand Up @@ -889,6 +919,7 @@ function detailsFramework:SetAsOptionsPanel(frame)
["button"] = {}, -- "execute"
["textentry"] = {}, --
["label"] = {}, --"text"
["image"] = {},
}
frame.widgetids = {}
frame.GetWidgetById = getFrameById
Expand Down Expand Up @@ -997,6 +1028,15 @@ local getMenuWidgetVolative = function(parent, widgetType, indexTable)
widgetObject:ClearHooks()
end
indexTable[widgetType] = indexTable[widgetType] + 1

elseif (widgetType == "image") then
widgetObject = parent.widget_list_by_type[widgetType][indexTable[widgetType]]
if (not widgetObject) then
widgetObject = parent:CreateTexture("$parentWidget" .. widgetType .. indexTable[widgetType], "overlay")
table.insert(parent.widget_list, widgetObject)
table.insert(parent.widget_list_by_type[widgetType], widgetObject)
end
indexTable[widgetType] = indexTable[widgetType] + 1
end

--if the widget is inside the no combat table, remove it
Expand Down Expand Up @@ -1251,6 +1291,15 @@ function detailsFramework:BuildMenuVolatile(parent, menuOptions, xOffset, yOffse

maxColumnWidth, maxWidgetWidth = setTextEntryProperties(parent, textentry, widgetTable, currentXOffset, currentYOffset, buttonTemplate, widgetWidth, widgetHeight, bAlignAsPairs, nAlignAsPairsLength, valueChangeHook, maxColumnWidth, maxWidgetWidth, textTemplate)
amountLineWidgetAdded = amountLineWidgetAdded + 1

--image
elseif (widgetTable.type == "image") then
local image = getMenuWidgetVolative(parent, "image", widgetIndexes)
widgetCreated = image

setImageProperties(parent, image, widgetTable, currentXOffset, currentYOffset)

amountLineWidgetAdded = amountLineWidgetAdded + 1
end --end loop

if (widgetTable.nocombat) then
Expand Down Expand Up @@ -1565,6 +1614,20 @@ function detailsFramework:BuildMenu(parent, menuOptions, xOffset, yOffset, heigh

widgetCreated = textentry
amountLineWidgetAdded = amountLineWidgetAdded + 1

elseif (widgetTable.type == "image") then
local image = parent:CreateTexture("$parentMenuImage" .. index, "overlay")

setImageProperties(parent, image, widgetTable, currentXOffset, currentYOffset)

currentYOffset = currentYOffset - widgetTable.height + 10

--store the widget created into the overall table and the widget by type
table.insert(parent.widget_list, image)
table.insert(parent.widget_list_by_type.textentry, image)

widgetCreated = image
amountLineWidgetAdded = amountLineWidgetAdded + 1
end

if (widgetTable.nocombat) then
Expand Down
26 changes: 25 additions & 1 deletion Libs/DF/cooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ end

--api locals
local PixelUtil = PixelUtil or DFPixelUtil
local version = 28
local version = 29

local CONST_MENU_TYPE_MAINMENU = "main"
local CONST_MENU_TYPE_SUBMENU = "sub"
Expand Down Expand Up @@ -1053,6 +1053,16 @@ function DF:CreateCoolTip()

if (gameCooltip.OptionsTable.TextSize and not leftTextSettings[6]) then
DF:SetFontSize(menuButton.leftText, gameCooltip.OptionsTable.TextSize)
elseif (leftTextSettings[6]) then
DF:SetFontSize(menuButton.leftText, leftTextSettings[6])
else
DF:SetFontSize(menuButton.leftText, 10)
end

if (leftTextSettings[8]) then
DF:SetFontOutline(menuButton.leftText, leftTextSettings[8])
else
DF:SetFontOutline(menuButton.leftText, "NONE")
end

if (gameCooltip.OptionsTable.LeftTextWidth) then
Expand Down Expand Up @@ -1160,6 +1170,20 @@ function DF:CreateCoolTip()
DF:SetFontSize(menuButton.rightText, gameCooltip.OptionsTable.TextSize)
end

if (gameCooltip.OptionsTable.TextSize and not rightTextSettings[6]) then
DF:SetFontSize(menuButton.rightText, gameCooltip.OptionsTable.TextSize)
elseif (rightTextSettings[6]) then
DF:SetFontSize(menuButton.rightText, rightTextSettings[6])
else
DF:SetFontSize(menuButton.rightText, 10)
end

if (rightTextSettings[8]) then
DF:SetFontOutline(menuButton.rightText, rightTextSettings[8])
else
DF:SetFontOutline(menuButton.rightText, "NONE")
end

if (gameCooltip.OptionsTable.RightTextWidth) then
menuButton.rightText:SetWidth(gameCooltip.OptionsTable.RightTextWidth)
else
Expand Down
11 changes: 9 additions & 2 deletions Libs/DF/definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
---@field Color any?
---@field Texture any

GameCooltipFrame1 = {}
GameCooltipFrame2 = {}

---df version of an atlasinfo from the game API, it include color and desaturation information
---a df atlas can be created using DetailsFramework:CreateAtlas() and then used with DetailsFramework:SetAtlas()
---@class df_atlasinfo : atlasinfo
Expand Down Expand Up @@ -142,6 +145,9 @@
---@field RoundedCornerPanelMixin df_roundedcornermixin
---@field Schedules df_schedule
---@field HeaderFunctions df_headerfunctions
---@field TimeLine_LineMixin df_timeline_line_mixin
---@field TimeLineMixin df_timeline_mixin
---@field NameplateBorderMixin df_nameplate_border_mixin
---@field RoleTypes roleinfo[]
---@field Language df_language
---@field Ejc df_ejc
Expand Down Expand Up @@ -199,7 +205,7 @@
---@field IsDragonflightWow fun():boolean
---@field IsWarWow fun():boolean
---@field IsTWWWow fun():boolean
---@field CreateFullBorder fun(self:table, name:string, parent:frame) : frame
---@field CreateFullBorder fun(self:table, name:string, parent:frame) : border_frame
---@field CreateButton fun(self:table, parent:frame, func:function, width:number, height:number, text:any, param1:any, param2:any, texture:atlasname|texturepath|textureid|nil, member:string?, name:string?, shortMethod:any, buttonTemplate:table?, textTemplate:table?) : df_button callback function(blizzButton, clickType, param1, param2) end
---@field CreateCloseButton fun(self:table, parent:frame, frameName:string?) : df_closebutton
---@field CreateTabButton fun(self:table, parent:frame, frameName:string?) : df_tabbutton
Expand Down Expand Up @@ -268,9 +274,10 @@
---@field CreateSimplePanel fun(self:table, parent:frame, width:number?, height:number?, title:string?, frameName:string?, panelOptions:table?, savedVariableTable:table?) : simplepanel
---@field CreateNewAddOn fun(self:table, addonName:string, globalSavedVariablesName:string, savedVarsTemplate:table) : table
---@field CreateBossScrollSelectorForInstance fun(self:table, instanceId:any, parent:uiobject, name:string?, options:df_bossscrollselector_options?, callback:function?, ...) : df_bossscrollselector
---@field CreateTimeLineFrame fun(self:table, parent:frame, name:string, timelineOptions:df_timeline_options, elapsedtimeOptions:df_elapsedtime_options) : df_timeline
---@field CreateTimeLineFrame fun(self:table, parent:frame, name:string, timelineOptions:df_timeline_options, elapsedtimeOptions:df_elapsedtime_options) : df_timeline, df_timeline_header?, df_timeline_header_body? create a timeline frame, header and headerBody is nil if the timelineOptions has no header_detached set to true
---@field CreateTitleBar fun(self:table, parent:frame, titleText:string) : df_titlebar
---@field CreateElapsedTimeFrame fun(self:table, parent:frame, name:string?, options:df_elapsedtime_options?) : df_elapsedtime
---@field CreateIconRow fun(self:table, parent:frame, name:string?, options:table?) : df_iconrow
---@field ConvertAnchorPointToInside fun(self:table, anchorPoint:anchorid) : anchorid
---@field ExpansionHasAugEvoker fun():boolean
---@field LoadSpellCache fun(self:table, hashMap:table, indexTable:table, allSpellsSameName:table) : hashMap:table, indexTable:table, allSpellsSameName:table load all spells in the game and add them into the passed tables
Expand Down
86 changes: 52 additions & 34 deletions Libs/DF/dropdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,41 @@
]=]

---@class df_dropdown : table, frame, df_widgets
---@field func function
---@field SetTemplate fun(self:df_dropdown, template:table|string)
---@field SetFixedParameter fun(self:df_dropdown, value:any) is sent as 2nd argument to the callback function, the value is the same no matter which option is selected
---@field BuildDropDownFontList fun(self:df_dropdown, onClick:function, icon:any, iconTexcoord:table?, iconSize:table?):table make a dropdown list with all fonts available, on select a font, call the function onClick
---@field SetFunction fun(self:df_dropdown, func:function)
---@field SetEmptyTextAndIcon fun(self:df_dropdown, text:string, icon:any)
---@field Select fun(self:df_dropdown, optionName:string|number, byOptionNumber:boolean?, bOnlyShown:boolean?, runCallback:boolean?):boolean
---@field SelectDelayed fun(self:df_dropdown, optionName:string|number, byOptionNumber:boolean?, bOnlyShown:boolean?, runCallback:boolean?) --call Select() after a random delay
---@field Open fun(self:df_dropdown)
---@field Close fun(self:df_dropdown)
---@field Refresh fun(self:df_dropdown)
---@field GetValue fun(self:df_dropdown):any
---@field GetFunction fun(self:df_dropdown):function
---@field GetMenuSize fun(self:df_dropdown):number, number
---@field SetMenuSize fun(self:df_dropdown, width:number, height:number)
---@field Disable fun(self:df_dropdown)
---@field Enable fun(self:df_dropdown)

---@class dropdownoption : table
---@field value any
---@field label string text shown in the dropdown option
---@field onclick fun(dropdownObject:table, fixedValue:any, value:any)? function to call when the option is selected
---@field icon string|number? texture
---@field color any any color format
---@field font string?
---@field texcoord number[]? left, right, top, bottom
---@field iconcolor any any color format
---@field iconsize number[]? width, height
---@field languageId string?
---@field rightbutton function? function to call on right click
---@field statusbar string|number? statusbar texture
---@field statusbarcolor any any color format
---@field rightTexture string|number? texture
---@field centerTexture string|number? texture

---@type detailsframework
local DF = _G ["DetailsFramework"]
Expand Down Expand Up @@ -393,6 +428,12 @@ local canRunCallbackFunctionForOption = function(canRunCallback, optionTable, dr
end
end

function DropDownMetaFunctions:SelectDelayed(optionName, byOptionNumber, bOnlyShown, runCallback)
DF.Schedules.After(DF.Math.RandomFraction(0.016, 0.3), function()
self:Select(optionName, byOptionNumber, bOnlyShown, runCallback)
end)
end

---if bOnlyShown is true it'll first create a table with visible options that has .shown and then select in this table the index passed (if byOptionNumber)
---@param optionName string value or string shown in the name of the option
---@param byOptionNumber number the option name is considered a number and selects the index of the menu
Expand Down Expand Up @@ -522,10 +563,20 @@ function DropDownMetaFunctions:Selected(thisOption)
end
end

---@type fontstring
local thisLabel = self.label

local parentWidth = self:GetWidth()

if (addonId and phraseId) then
self.label:SetText(DF.Language.GetText(addonId, phraseId))
else
self.label:SetText(thisOption.label)
thisLabel:SetText(thisOption.label)
thisLabel:SetWordWrap(false)
thisLabel:SetIndentedWordWrap(false)
thisLabel:SetWidth(parentWidth + 30)
DF:TruncateText(thisLabel, parentWidth-30)
thisLabel:Show()
end

self.icon:SetTexture(thisOption.icon)
Expand Down Expand Up @@ -702,22 +753,6 @@ function DetailsFrameworkDropDownOptionOnLeave(frame)
frame:GetParent().mouseover:Hide()
end

---@class dropdownoption : table
---@field value any
---@field label string text shown in the dropdown option
---@field onclick fun(dropdownObject:table, fixedValue:any, value:any)? function to call when the option is selected
---@field icon string|number? texture
---@field color any any color format
---@field font string?
---@field texcoord number[]? left, right, top, bottom
---@field iconcolor any any color format
---@field iconsize number[]? width, height
---@field languageId string?
---@field rightbutton function? function to call on right click
---@field statusbar string|number? statusbar texture
---@field statusbarcolor any any color format
---@field rightTexture string|number? texture
---@field centerTexture string|number? texture

--@button is the raw button frame, object is the button capsule
--click on the main dropdown frame (not the menu options popup)
Expand Down Expand Up @@ -1145,23 +1180,6 @@ end
------------------------------------------------------------------------------------------------------------
--object constructor

---@class df_dropdown : table, frame, df_widgets
---@field func function
---@field SetTemplate fun(self:df_dropdown, template:table|string)
---@field SetFixedParameter fun(self:df_dropdown, value:any) is sent as 2nd argument to the callback function, the value is the same no matter which option is selected
---@field BuildDropDownFontList fun(self:df_dropdown, onClick:function, icon:any, iconTexcoord:table?, iconSize:table?):table make a dropdown list with all fonts available, on select a font, call the function onClick
---@field SetFunction fun(self:df_dropdown, func:function)
---@field SetEmptyTextAndIcon fun(self:df_dropdown, text:string, icon:any)
---@field Select fun(self:df_dropdown, optionName:string|number, byOptionNumber:boolean?, bOnlyShown:boolean?, runCallback:boolean?):boolean
---@field Open fun(self:df_dropdown)
---@field Close fun(self:df_dropdown)
---@field Refresh fun(self:df_dropdown)
---@field GetValue fun(self:df_dropdown):any
---@field GetFunction fun(self:df_dropdown):function
---@field GetMenuSize fun(self:df_dropdown):number, number
---@field SetMenuSize fun(self:df_dropdown, width:number, height:number)
---@field Disable fun(self:df_dropdown)
---@field Enable fun(self:df_dropdown)

---return a function which when called returns a table filled with all fonts available and ready to be used on dropdowns
---@param callback function
Expand Down
31 changes: 26 additions & 5 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 582
local dversion = 585
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)

Expand Down Expand Up @@ -4289,7 +4289,24 @@ function DF:CreateBorder(parent, alpha1, alpha2, alpha3)
end

--DFNamePlateBorder as copy from "NameplateFullBorderTemplate" -> DF:CreateFullBorder (name, parent)
local DFNamePlateBorderTemplateMixin = {};
---@class df_nameplate_border_mixin : table
---@field SetVertexColor fun(self:border_frame, r:number, g:number, b:number, a:number)
---@field GetVertexColor fun(self:border_frame):number, number, number r, g, b
---@field SetBorderSizes fun(self:border_frame, borderSize:number, borderSizeMinPixels:number, upwardExtendHeightPixels:number, upwardExtendHeightMinPixels:number)
---@field UpdateSizes fun(self:border_frame)
---@field Left texture
---@field Right texture
---@field Bottom texture
---@field Top texture
---@field Textures texture[]
---@field borderSize number
---@field borderSizeMinPixels number
---@field upwardExtendHeightPixels number
---@field upwardExtendHeightMinPixels number

local DFNamePlateBorderTemplateMixin = {}

DF.NameplateBorderMixin = DFNamePlateBorderTemplateMixin

function DFNamePlateBorderTemplateMixin:SetVertexColor(r, g, b, a)
for i, texture in ipairs(self.Textures) do
Expand Down Expand Up @@ -4336,7 +4353,9 @@ function DFNamePlateBorderTemplateMixin:UpdateSizes()
end
end

function DF:CreateFullBorder (name, parent)
---@class border_frame : frame, df_nameplate_border_mixin

function DF:CreateFullBorder(name, parent)
local border = CreateFrame("Frame", name, parent)
border:SetAllPoints()
border:SetIgnoreParentScale(true)
Expand Down Expand Up @@ -5559,8 +5578,10 @@ DF.DebugMixin = {
end,

CheckStack = function(self)
local stack = debugstack()
Details:Dump (stack)
if (Details) then
local stack = debugstack()
Details:Dump (stack)
end
end,

}
Expand Down
Loading

0 comments on commit c9a1096

Please sign in to comment.