Added atonement update to all all players to see on their buff uptime

This commit is contained in:
Tercio Jose
2023-11-06 15:28:14 -03:00
parent d11f8a1ccd
commit 466c67aea4
13 changed files with 2215 additions and 1207 deletions
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -745,11 +745,11 @@ function ButtonMetaFunctions:SetTemplate(template)
end
if (template.width) then
self:SetWidth(template.width)
PixelUtil.SetWidth(self.button, template.width)
end
if (template.height) then
self:SetHeight(template.height)
PixelUtil.SetHeight(self.button, template.height)
end
if (template.backdrop) then
@@ -928,7 +928,7 @@ end
detailsFramework:Mixin(buttonObject.button, detailsFramework.WidgetFunctions)
createButtonWidgets(buttonObject.button)
buttonObject.button:SetSize(width or 100, height or 20)
PixelUtil.SetSize(buttonObject.button, width or 100, height or 20)
buttonObject.widget = buttonObject.button
buttonObject.button.MyObject = buttonObject
@@ -964,8 +964,8 @@ end
if (shortMethod == false) then --if is false, do not use auto resize
--do nothing
elseif (not shortMethod) then --if the value is omitted, use the default resize
local new_width = textWidth + 15
buttonObject.button:SetWidth(new_width)
local newWidth = textWidth + 15
PixelUtil.SetWidth(buttonObject.button, newWidth)
elseif (shortMethod == 1) then
local loop = true
+20 -7
View File
@@ -1,14 +1,16 @@
---@class df_table_functions
---@field find fun(tbl:table, value:any) : number? find the index of a value in a array
---@field addunique fun(tbl:table, value:any) : boolean add a value to an array if it doesn't exist yet
---@field reverse fun(tbl:table) reverse the order of an array
---@field append fun(tbl1:table, tbl2:table) append the array of table2 to table1
---@field duplicate fun(tblReceiving:table, tblGiving:table) copy the values from table2 to table1 overwriting existing values, ignores __index and __newindex, keys pointing to a UIObject are preserved
---@field copy fun(tblReceiving:table, tblGiving:table) copy the values from table2 to table1 overwriting existing values, ignores __index and __newindex, threat UIObjects as regular tables
---@field deploy fun(tblReceiving:table, tblGiving:table) copy keys/values that does exist on tblGiving but not in tblReceiving
---@field copytocompress fun(tblReceiving:table, tblGiving:table) copy the values from table2 to table1 overwriting existing values, ignores __index, functions and tables with a 'GetObjectType' key
---@field addunique fun(tbl:table, index:any, value:any) : boolean add a value to an array if it doesn't exist yet, if the index is omitted the value will be added to the end of the array
---@field reverse fun(tbl:table) : table reverse the order of an array
---@field append fun(tbl1:table, tbl2:table) : table append the array of table2 to table1
---@field duplicate fun(tblReceiving:table, tblGiving:table) : table copy the values from table2 to table1 overwriting existing values, ignores __index and __newindex, keys pointing to a UIObject are preserved
---@field copy fun(tblReceiving:table, tblGiving:table) : table copy the values from table2 to table1 overwriting existing values, ignores __index and __newindex, threat UIObjects as regular tables
---@field deploy fun(tblReceiving:table, tblGiving:table) : table copy keys/values that does exist on tblGiving but not in tblReceiving
---@field copytocompress fun(tblReceiving:table, tblGiving:table) : table copy the values from table2 to table1 overwriting existing values, ignores __index, functions and tables with a 'GetObjectType' key
---@field removeduplicate fun(tbl1:table, tbl2:table) remove the keys from table1 which also exists in table2 with the same value
---@field getfrompath fun(tbl:table, path:string) : any get a value from a table using a path, e.g. getfrompath(tbl, "a.b.c") is the same as tbl.a.b.c
---@field setfrompath fun(tbl:table, path:string, value:any) : boolean set the value of a table using a path, e.g. setfrompath(tbl, "a.b.c", 10) is the same as tbl.a.b.c = 10
---@field dump fun(tbl:table) : string dump a table to a string
---@class df_language : table
@@ -51,9 +53,12 @@
---@field Language df_language
---@field KeybindMixin df_keybindmixin
---@field ScriptHookMixin df_scripthookmixin
---@field EditorMixin df_editormixin
---@field ClassCache {ID:number, Name:string, FileString:string, Texture:string, TexCoord:number[]}[] only available after calling GetClassList()
---@field Math df_math
---@field FontOutlineFlags {key1:outline, key2:string}[]
---@field table df_table_functions
---@field AnchorPoints string[]
---@field ClassFileNameToIndex table<string, number> engClass -> classIndex
---@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
---@field UnloadSpellCache fun(self:table) wipe the table contents filled with LoadSpellCache()
@@ -83,8 +88,10 @@
---@field SetButtonTexture fun(self:table, button:button|df_button, texture:atlasname|texturepath|textureid)
---@field CreateFadeAnimation fun(self:table, UIObject:uiobject, fadeInTime:number?, fadeOutTime:number?, fadeInAlpha:number?, fadeOutAlpha:number?)
---@field SetFontSize fun(self:table, fontstring:fontstring, size:number)
---@field GetFontSize fun(self:table, fontstring:fontstring) : number return the font size of the fontstring
---@field SetFontColor fun(self:table, fontstring:fontstring, red:any, green:number?, blue:number?, alpha:number?)
---@field SetFontFace fun(self:table, fontstring:fontstring, font:string)
---@field GetFontFace fun(self:table, fontstring:fontstring) : string return the font face of the fontstring
---@field SetFontShadow fun(self:table, fontstring:fontstring, red:any, green:number?, blue:number?, alpha:number?, offsetX:number?, offsetY:number?)
---@field SetFontOutline fun(self:table, fontstring:fontstring, outline:fontflags)
---@field RemoveRealmName fun(self:table, name:string) : string, number remove the realm name from the player name, must be in the format of "name-realm"
@@ -101,6 +108,9 @@
---@field ApplyStandardBackdrop fun(self:table, frame:frame, bUseSolidColor:boolean?, alphaScale:number?)
---@field CreateLabel fun(self:table, parent:frame, text:string, size:number?, color:any?, font:string?, member:string?, name:string?, layer:drawlayer?) : df_label
---@field CreateDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown
---@field CreateFontDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown
---@field CreateColorDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown
---@field CreateFontListGenerator fun(self:table, callback:function) : function return a function which when called returns a table filled with all fonts available and ready to be used on dropdowns
---@field CreateTextEntry fun(self:table, parent:frame, textChangedCallback:function, width:number, height:number, member:string?, name:string?, labelText:string?, textentryTemplate:table?, labelTemplate:table?) : df_textentry
---@field ReskinSlider fun(self:table, slider:frame)
---@field GetAvailableSpells fun(self:table) : table<spellid, boolean>
@@ -121,6 +131,9 @@
---@field CreateScrollBox fun(self:table, parent:frame, name:string, refreshFunc:function, data:table, width:number, height:number, lineAmount:number, lineHeight:number, createLineFunc:function?, autoAmount:boolean?, noScroll:boolean?, noBackdrop:boolean?) : df_scrollbox
---@field CreateAuraScrollBox fun(self:table, parent:frame, name:string?, data:table?, onRemoveCallback:function?, options:table?) : df_aurascrollbox
---@field CreateGridScrollBox fun(self:table, parent:frame, name:string?, refreshFunc:function, data:table?, createColumnFrameFunc:function, options:table?) : df_gridscrollbox
---@field CreateCanvasScrollBox fun(self:table, parent:frame, child:frame?, name:string?, options:table?) : df_canvasscrollbox
---@field GetSizeFromPercent fun(self:table, uiObject:uiobject, percent:number) : number get the min size of a uiObject and multiply it by the percent passed
---@field BuildMenu fun(self:table, parent:frame, menuOptions:df_menu_table[], xOffset:number?, yOffset:number?, height:number?, useColon:boolean?, textTemplate:table?, dropdownTemplate:table?, switchTemplate:table?, switchIsCheckbox:boolean?, sliderTemplate:table?, buttonTemplate:table?, valueChangeHook:function?)
---@field BuildMenuVolatile fun(self:table, parent:frame, menuOptions:df_menu_table[], xOffset:number?, yOffset:number?, height:number?, useColon:boolean?, textTemplate:table?, dropdownTemplate:table?, switchTemplate:table?, switchIsCheckbox:boolean?, sliderTemplate:table?, buttonTemplate:table?, valueChangeHook:function?)
---@field
---@field
+116 -4
View File
@@ -989,6 +989,10 @@ end
function DF:BuildDropDownFontList(onClick, icon, iconTexcoord, iconSize)
local fontTable = {}
if (type(iconSize) ~= "table") then
iconSize = {iconSize or 16, iconSize or 16}
end
local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
for name, fontPath in pairs(SharedMedia:HashTable("font")) do
fontTable[#fontTable+1] = {value = name, label = name, onclick = onClick, icon = icon, iconsize = iconSize, texcoord = iconTexcoord, font = fontPath, descfont = "abcdefg ABCDEFG"}
@@ -1006,10 +1010,10 @@ function DropDownMetaFunctions:SetTemplate(template)
self.template = template
if (template.width) then
self:SetWidth(template.width)
PixelUtil.SetWidth(self.dropdown, template.width)
end
if (template.height) then
self:SetHeight(template.height)
PixelUtil.SetWidth(self.dropdown, template.height)
end
if (template.backdrop) then
@@ -1092,7 +1096,116 @@ end
---@field
---@field
---return a function which when called returns a table filled with all fonts available and ready to be used on dropdowns
---@param callback function
---@return function
function DF:CreateFontListGenerator(callback)
return function() return DF:BuildDropDownFontList(callback, [[Interface\AnimCreate\AnimCreateIcons]], {0, 32/128, 64/128, 96/128}, 16) end
end
local colorGeneratorStatusBarTexture = [[Interface\Tooltips\UI-Tooltip-Background]]
local colorGeneratorStatusBarColor = {.1, .1, .1, .8}
local colorGeneratorNoColor = {0, 0, 0, 0}
function DF:CreateColorListGenerator(callback)
local newGenerator = function()
local dropdownOptions = {}
for colorName, colorTable in pairs(DF:GetDefaultColorList()) do
table.insert(dropdownOptions, {
label = colorName,
value = colorTable,
color = colorTable,
statusbar = colorGeneratorStatusBarTexture,
statusbarcolor = colorGeneratorStatusBarColor,
onclick = callback
})
end
table.insert(dropdownOptions, 1, {
label = "no color",
value = "blank",
color = colorGeneratorNoColor,
statusbar = colorGeneratorStatusBarTexture,
statusbarcolor = colorGeneratorStatusBarColor,
onclick = callback
})
return dropdownOptions
end
return newGenerator
end
function DF:CreateOutlineListGenerator(callback)
local newGenerator = function()
local dropdownOptions = {}
for i, outlineInfo in ipairs(DF.FontOutlineFlags) do
local outlineName, outlineLoc = unpack(outlineInfo)
table.insert(dropdownOptions, {
label = outlineLoc,
value = outlineName,
onclick = callback
})
end
return dropdownOptions
end
return newGenerator
end
function DF:CreateAnchorPointListGenerator(callback)
local newGenerator = function()
local dropdownOptions = {}
for i, pointName in pairs(DF.AnchorPoints) do
table.insert(dropdownOptions, {
label = pointName,
value = i,
onclick = callback
})
end
return dropdownOptions
end
return newGenerator
end
---create a dropdown object with a list of fonts
---@param parent frame
---@param callback function
---@param default any
---@param width number?
---@param height number?
---@param member string?
---@param name string?
---@param template table?
function DF:CreateFontDropDown(parent, callback, default, width, height, member, name, template)
local func = DF:CreateFontListGenerator(callback)
local dropDownObject = DF:NewDropDown(parent, parent, name, member, width, height, func, default, template)
return dropDownObject
end
function DF:CreateColorDropDown(parent, callback, default, width, height, member, name, template)
local func = DF:CreateColorListGenerator(callback)
local dropDownObject = DF:NewDropDown(parent, parent, name, member, width, height, func, default, template)
return dropDownObject
end
function DF:CreateOutlineDropDown(parent, callback, default, width, height, member, name, template)
local func = DF:CreateOutlineListGenerator(callback)
local dropDownObject = DF:NewDropDown(parent, parent, name, member, width, height, func, default, template)
return dropDownObject
end
function DF:CreateAnchorPointDropDown(parent, callback, default, width, height, member, name, template)
local func = DF:CreateAnchorPointListGenerator(callback)
local dropDownObject = DF:NewDropDown(parent, parent, name, member, width, height, func, default, template)
return dropDownObject
end
---create a dropdown object
---@param parent frame
@@ -1144,8 +1257,7 @@ function DF:NewDropDown(parent, container, name, member, width, height, func, de
end
dropDownObject.dropdown = DF:CreateNewDropdownFrame(parent, name)
dropDownObject.dropdown:SetWidth(width)
dropDownObject.dropdown:SetHeight(height)
PixelUtil.SetSize(dropDownObject.dropdown, width, height)
dropDownObject.container = container
dropDownObject.widget = dropDownObject.dropdown
+362
View File
@@ -0,0 +1,362 @@
local detailsFramework = _G["DetailsFramework"]
if (not detailsFramework or not DetailsFrameworkCanLoad) then
return
end
---@cast detailsFramework detailsframework
local CreateFrame = CreateFrame
local unpack = unpack
local wipe = table.wipe
local _
--[=[
file description: this file has the code for the object editor
the object editor itself is a frame and has a scrollframe as canvas showing another frame where there's the options for the editing object
--]=]
--the editor doesn't know which key in the profileTable holds the current value for an attribute, so it uses a map table to find it.
--the mapTable is a table with the attribute name as a key, and the value is the profile key. For example, {["size"] = "text_size"} means profileTable["text_size"] = 10.
---@class df_editor_attribute
---@field name string
---@field label string
---@field widget string
---@field default any
---@field minvalue number?
---@field maxvalue number?
---@field step number?
---@field usedecimals boolean?
---@field subkey string?
--which object attributes are used to build the editor menu for each object type
local attributes = {
---@type df_editor_attribute[]
FontString = {
{
name = "text",
label = "Text",
widget = "textentry",
default = "font string text",
setter = function(widget, value) widget:SetText(value) end,
},
{
name = "size",
label = "Size",
widget = "range",
minvalue = 5,
maxvalue = 120,
setter = function(widget, value) widget:SetFont(widget:GetFont(), value, select(3, widget:GetFont())) end
},
{
name = "font",
label = "Font",
widget = "fontdropdown",
setter = function(widget, value) widget:SetFont(value, select(2, widget:GetFont())) end
},
{
name = "color",
label = "Color",
widget = "colordropdown",
setter = function(widget, value) widget:SetTextColor(unpack(value)) end
},
{
name = "alpha",
label = "Alpha",
widget = "range",
setter = function(widget, value) widget:SetAlpha(value) end
},
{
name = "shadow",
label = "Draw Shadow",
widget = "toggle",
setter = function(widget, value) widget:SetShadowColor(widget:GetShadowColor(), select(2, widget:GetShadowColor()), select(3, widget:GetShadowColor()), value and 0.5 or 0) end
},
{
name = "shadowcolor",
label = "Shadow Color",
widget = "colordropdown",
setter = function(widget, value) widget:SetShadowColor(unpack(value)) end
},
{
name = "shadowoffsetx",
label = "Shadow X Offset",
widget = "range",
minvalue = -10,
maxvalue = 10,
setter = function(widget, value) widget:SetShadowOffset(value, select(2, widget:GetShadowOffset())) end
},
{
name = "shadowoffsety",
label = "Shadow Y Offset",
widget = "range",
minvalue = -10,
maxvalue = 10,
setter = function(widget, value) widget:SetShadowOffset(widget:GetShadowOffset(), value) end
},
{
name = "outline",
label = "Outline",
widget = "outlinedropdown",
setter = function(widget, value) widget:SetFont(widget:GetFont(), select(2, widget:GetFont()), value) end
},
{
name = "anchor",
label = "Anchor",
widget = "anchordropdown",
setter = function(widget, value) detailsFramework:SetAnchor(widget, value, widget:GetParent()) end
},
{
name = "anchoroffsetx",
label = "Anchor X Offset",
widget = "range",
minvalue = -20,
maxvalue = 20,
setter = function(widget, value) detailsFramework:SetAnchor(widget, value, widget:GetParent()) end
},
{
name = "anchoroffsety",
label = "Anchor Y Offset",
widget = "range",
minvalue = -20,
maxvalue = 20,
setter = function(widget, value) detailsFramework:SetAnchor(widget, value, widget:GetParent()) end
},
{
name = "rotation",
label = "Rotation",
widget = "range",
usedecimals = true,
minvalue = 0,
maxvalue = math.pi*2,
setter = function(widget, value) widget:SetRotation(value) end
},
}
}
local profileTable = {
spellname_text_size = 10,
spellname_text_font = "Arial Narrow",
spellname_text_color = {1, 1, 1, 1},
spellname_text_outline = "NONE",
spellname_text_shadow_color = {0, 0, 0, 1},
spellname_text_shadow_color_offset = {1, -1},
spellname_text_anchor = {side = 9, x = 0, y = 0},
}
--create a map table for the profile table
local mapTable = {
text = "text test",
size = "spellname_text_size",
font = "spellname_text_font",
color = "spellname_text_color",
outline = "spellname_text_outline",
shadowcolor = "spellname_text_shadow_color",
shadowoffsetx = "spellname_text_shadow_color_offset[1]",
shadowoffsety = "spellname_text_shadow_color_offset[2]",
anchor = "spellname_text_anchor.side",
anchoroffsetx = "spellname_text_anchor.x",
anchoroffsety = "spellname_text_anchor.y",
}
local table_path = {
shadowWidth = "text_settings[1].width",
shadowHeight = "text_settings[1].height",
shadowEnabled = "text_settings.settings.enabled",
text = "text_settings.settings.text.current_text",
}
local text_settings = {
shadowWidth = {{width = 100}},
shadowHeight = {{height = 100}},
shadowEnabled = {settings = {enabled = true}},
text = {settings = {text = {current_text = "hellow world"}}},
}
---@class df_editormixin : table
---@field GetEditingObject fun(self:df_editor):uiobject
---@field GetEditingProfile fun(self:df_editor):table, table
---@field GetOnEditCallback fun(self:df_editor):function
---@field GetOptionsFrame fun(self:df_editor):frame
---@field GetCanvasScrollBox fun(self:df_editor):df_canvasscrollbox
---@field EditObject fun(self:df_editor, object:uiobject, profileTable:table, profileKeyMap:table, callback:function)
---@field PrepareObjectForEditing fun(self:df_editor)
detailsFramework.EditorMixin = {
---@param self df_editor
GetEditingObject = function(self)
return self.editingObject
end,
---@param self df_editor
---@return table, table
GetEditingProfile = function(self)
return self.editingProfileTable, self.editingProfileMap
end,
---@param self df_editor
---@return function
GetOnEditCallback = function(self)
return self.onEditCallback
end,
GetOptionsFrame = function(self)
return self.optionsFrame
end,
GetCanvasScrollBox = function(self)
return self.canvasScrollBox
end,
---@param self df_editor
---@param object uiobject
---@param profileTable table
---@param profileKeyMap table
---@param callback function calls when an attribute is changed with the payload: editingObject, optionName, newValue, profileTable, profileKey
EditObject = function(self, object, profileTable, profileKeyMap, callback)
assert(type(object) == "table", "EditObject(object) expects an UIObject on first parameter.")
assert(type(profileTable) == "table", "EditObject(object) expects a table on second parameter.")
assert(object.GetObjectType, "EditObject(object) expects an UIObject on first parameter.")
self.editingObject = object
self.editingProfileMap = profileKeyMap
self.editingProfileTable = profileTable
self.onEditCallback = callback
self:PrepareObjectForEditing()
end,
PrepareObjectForEditing = function(self)
--get the object and its profile table with the current values
local object = self:GetEditingObject()
local profileTable, profileMap = self:GetEditingProfile()
profileMap = profileMap or {}
if (not object or not profileTable) then
return
end
--get the object type
local objectType = object:GetObjectType()
local attributeList
if (objectType == "FontString") then
attributeList = attributes[objectType]
end
local menuOptions = {}
for i = 1, #attributeList do
local option = attributeList[i]
--get the key to be used on profile table
local profileKey = profileMap[option.name]
local value
--if the key contains a dot or a bracket, it means it's a table path, example: "text_settings[1].width"
if (profileKey and (profileKey:match("%.") or profileKey:match("%["))) then
value = detailsFramework.table.getfrompath(profileTable, profileKey)
else
value = profileTable[profileKey]
end
--if no value is found, attempt to get a default
value = value or option.default
if (value) then
menuOptions[#menuOptions+1] = {
type = option.widget,
name = option.label,
get = function() return value end,
set = function(widget, fixedValue, newValue)
if (profileKey and (profileKey:match("%.") or profileKey:match("%["))) then
detailsFramework.table.setfrompath(profileTable, profileKey, value)
else
profileTable[profileKey] = value
end
if (self:GetOnEditCallback()) then
self:GetOnEditCallback()(object, option.name, newValue, profileTable, profileKey)
end
if (option.name == "anchor" or option.name == "anchoroffsetx" or option.name == "anchoroffsety") then
local anchorTable = detailsFramework.table.getfrompath(profileTable, profileKey:gsub("%.[^.]*$", ""))
option.setter(object, anchorTable)
else
option.setter(object, newValue)
end
end,
min = option.minvalue,
max = option.maxvalue,
step = option.step,
usedecimals = option.usedecimals,
}
end
end
--at this point, the optionsTable is ready to be used on DF:BuildMenuVolatile()
menuOptions.align_as_pairs = true
menuOptions.align_as_pairs_length = 150
menuOptions.widget_width = 180
local optionsFrame = self:GetOptionsFrame()
local canvasScrollBox = self:GetCanvasScrollBox()
local bUseColon = true
local bSwitchIsCheckbox = true
local maxHeight = 5000
local amountOfOptions = #menuOptions
local optionsFrameHeight = amountOfOptions * 20
optionsFrame:SetHeight(optionsFrameHeight)
--templates
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")
detailsFramework:BuildMenu(optionsFrame, menuOptions, 0, -2, maxHeight, bUseColon, options_text_template, options_dropdown_template, options_switch_template, bSwitchIsCheckbox, options_slider_template, options_button_template)
end,
}
local editorDefaultOptions = {
width = 400,
height = 600,
}
---@class df_editor : frame, df_optionsmixin, df_editormixin
---@field options table
---@field editingObject uiobject
---@field editingProfileTable table
---@field editingProfileMap table
---@field onEditCallback function
---@field optionsFrame frame
---@field canvasScrollBox df_canvasscrollbox
function detailsFramework:CreateEditor(parent, name, options)
name = name or ("DetailsFrameworkEditor" .. math.random(100000, 10000000))
local editorFrame = CreateFrame("frame", name, parent, "BackdropTemplate")
detailsFramework:Mixin(editorFrame, detailsFramework.EditorMixin)
detailsFramework:Mixin(editorFrame, detailsFramework.OptionsFunctions)
editorFrame:BuildOptionsTable(editorDefaultOptions, options)
editorFrame:SetSize(editorFrame.options.width, editorFrame.options.height)
--options frame is the frame that holds the options for the editing object, it is used as the parent frame for BuildMenuVolatile()
local optionsFrame = CreateFrame("frame", name .. "OptionsFrame", editorFrame, "BackdropTemplate")
optionsFrame:SetSize(editorFrame.options.width, 5000)
local canvasFrame = detailsFramework:CreateCanvasScrollBox(editorFrame, optionsFrame, name .. "CanvasScrollBox")
canvasFrame:SetAllPoints()
editorFrame.optionsFrame = optionsFrame
editorFrame.canvasScrollBox = canvasFrame
return editorFrame
end
+83 -1183
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -284,6 +284,7 @@ detailsFramework:Mixin(LabelMetaFunctions, detailsFramework.ScriptHookMixin)
---@field shadow fontflags
---@field outline fontflags
---@field rotation number
---@field SetPoint fun(self: df_label, point: any, relativeTo: any, relativePoint: any, x: any, y: any) set the label position
---@field SetTemplate fun(self: df_label, template: table) set the fontstring visual by a template
---@field SetTextColor fun(self: df_label, red: any, green: number|nil, blue: number|nil, alpha: number|nil) set the button text color
---@field SetTextTruncated fun(self: df_label, text: string, maxWidth: width)
+2
View File
@@ -35,6 +35,7 @@
<Script file="scrollbox.lua"/>
<Include file="panel.xml"/>
<Script file="buildmenu.lua"/>
<Script file="loadconditions.lua"/>
<Include file="unitframe.lua"/>
<Script file="icon.lua"/>
@@ -42,5 +43,6 @@
<Script file="pictureedit.lua"/>
<Script file="auras.lua"/>
<Script file="tabcontainer.lua"/>
<Script file="editor.lua"/>
<Script file="keybind.lua"/>
</Ui>
+19 -3
View File
@@ -1,11 +1,11 @@
--documentation for scrollbox.lua
--exemples for world of warcraft library "Details Framework" file: scrollbox.lua
--a scrollbox is a frame with a scrollbar and lines, these lines can be used to show data or show more frames in the case of a grid frame
--a grid of frames if a frame with lines and columns, each line can have multiple columns, a column is a frame
--------Start of the Grid Scroll Box Example--------
--in world of warcraft, UIParent is the default parent, this frame is created by the game and is the base frame for all other frames
local parent = UIParent
local name = "GridScrollBoxExample"
@@ -69,4 +69,20 @@ local gridScrollBox = DetailsFramework:CreateGridScrollBox(parent, name, refresh
gridScrollBox:SetPoint("center", parent, "center", 0, 0)
gridScrollBox:Refresh()
--------End of the Grid Scroll Box Example--------
--------End of the Grid Scroll Box Example--------
--------Start of the Canvas Scroll Box Example--------
--display frame is the frame which will be shown within the canvas, this frame can have any size and if it is bigger than the canvas, it will be scrollable
local displayFrame = CreateFrame("frame", "CanvasScrollBoxDisplayFrameExample", nil, "BackdropTemplate")
displayFrame:SetSize(800, 1200)
displayFrame:SetBackdrop({bgFile = "Interface\\FrameGeneral\\UI-Background-Marble", tile = true, tileSize = 32})
--signature: CreateCanvasScrollBox(parentFrame, displayFrame, frameName)
--display frame is the frame which will be shown within the canvas
local canvasScrollFrame = DetailsFramework:CreateCanvasScrollBox(UIParent, displayFrame, "CanvasScrollBoxExample")
canvasScrollFrame:SetPoint("center", UIParent, "center", 0, 0)
canvasScrollFrame:SetSize(300, 500)
--------End of the Canvas Scroll Box Example--------
+49
View File
@@ -48,6 +48,8 @@ detailsFramework.ScrollBoxFunctions = {
--hide all frames that are not in use
for index, frame in ipairs(self.Frames) do
--the member _InUse is true when the line is used by the refresh function
--this member is set to true when the code calls scrollBox:GetLine(index)
if (not frame._InUse) then
frame:Hide()
else
@@ -681,3 +683,50 @@ function detailsFramework:CreateAuraScrollBox(parent, name, data, onAuraRemoveCa
return auraScrollBox
end
detailsFramework.CanvasScrollBoxMixin = {
}
local canvasScrollBoxDefaultOptions = {
width = 600,
height = 400,
reskin_slider = true,
}
---@class df_canvasscrollbox : scrollframe, df_optionsmixin
---@field child frame
---@param parent frame
---@param child frame?
---@param name string?
---@param options table?
---@return df_canvasscrollbox
function detailsFramework:CreateCanvasScrollBox(parent, child, name, options)
---@type df_canvasscrollbox
local canvasScrollBox = CreateFrame("scrollframe", name or ("DetailsFrameworkCanvasScroll" .. math.random(50000, 10000000)), parent, "BackdropTemplate, UIPanelScrollFrameTemplate")
detailsFramework:Mixin(canvasScrollBox, detailsFramework.CanvasScrollBoxMixin)
detailsFramework:Mixin(canvasScrollBox, detailsFramework.OptionsFunctions)
options = options or {}
canvasScrollBox:BuildOptionsTable(canvasScrollBoxDefaultOptions, options)
canvasScrollBox:SetSize(canvasScrollBox.options.width, canvasScrollBox.options.height)
if (not child) then
child = CreateFrame("frame", "$parentChild", canvasScrollBox)
end
canvasScrollBox:SetScrollChild(child)
canvasScrollBox:EnableMouseWheel(true)
canvasScrollBox.child = child
if (canvasScrollBox.options.reskin_slider) then
detailsFramework:ReskinSlider(canvasScrollBox)
end
return canvasScrollBox
end
+4 -5
View File
@@ -985,7 +985,7 @@ function DF:NewSwitch(parent, container, name, member, width, height, leftText,
if (with_label) then
local label = DF:CreateLabel(slider.widget, with_label, nil, nil, nil, "label", nil, "overlay")
label.text = with_label
slider.widget:SetPoint("left", label.widget, "right", 2, 0)
PixelUtil.SetPoint(slider.widget, "left", label.widget, "right", 2, 0)
with_label = label
if (label_template) then
@@ -999,10 +999,10 @@ end
function DFSliderMetaFunctions:SetTemplate(template)
--slider e switch
if (template.width) then
self:SetWidth(template.width)
PixelUtil.SetWidth(self.widget, template.width)
end
if (template.height) then
self:SetHeight(template.height)
PixelUtil.SetHeight(self.widget, template.height)
end
if (template.backdrop) then
@@ -1136,8 +1136,7 @@ function DF:NewSlider (parent, container, name, member, width, height, minValue,
end
SliderObject.slider.MyObject = SliderObject
SliderObject.slider:SetWidth(width)
SliderObject.slider:SetHeight(height)
PixelUtil.SetSize(SliderObject.slider, width, height)
SliderObject.slider:SetOrientation("horizontal")
SliderObject.slider:SetMinMaxValues(minValue, maxValue)
SliderObject.slider:SetValue(defaultValue)
+5
View File
@@ -107,6 +107,11 @@
---| "thickoutline"
---| "monochrome"
---@alias outline
---| "NONE"
---| "OUTLINE"
---| "THICKOUTLINE"
---@alias orientation
---| "HORIZONTAL"
---| "VERTICAL"
+2
View File
@@ -204,6 +204,7 @@
[395152] = true, --ebon might (evoker 10.1.5) 395296 = the evoker buff on it self
[410089] = true, --prescience (evoker 10.1.5)
[10060] = true, --power infusion
[81749] = true, --atonement uptime
}
--store all information about augmentation evokers ~roskash
@@ -2984,6 +2985,7 @@
end
end
--~refresh
function parser:buff_refresh(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, spellschool, tipo, amount)
if (not sourceName) then
sourceName = names_cache[spellName]