Framework and Lib OpenRaid updates.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
---@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 getfrompath fun(tbl:table, path:string, subOffset:number?) : 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; if subOffset is passed, return the subOffset'th value of the path
|
||||
---@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
|
||||
|
||||
|
||||
+37
-15
@@ -381,7 +381,7 @@ detailsFramework.EditorMixin = {
|
||||
|
||||
local anchorSettings
|
||||
|
||||
--table to use on DF:BuildMenu()
|
||||
--table to use on DF:BuildMenuVolatile()
|
||||
local menuOptions = {}
|
||||
for i = 1, #attributeList do
|
||||
local option = attributeList[i]
|
||||
@@ -418,11 +418,7 @@ detailsFramework.EditorMixin = {
|
||||
maxValue = object:GetParent():GetHeight()/2
|
||||
end
|
||||
|
||||
if (option.name == "classcolor") then print("", value) end
|
||||
|
||||
if (bHasValue) then
|
||||
if (option.name == "classcolor") then print("HERE", value) end
|
||||
|
||||
local parentTable = getParentTable(profileTable, profileKey)
|
||||
|
||||
if (option.name == "anchor" or option.name == "anchoroffsetx" or option.name == "anchoroffsety") then
|
||||
@@ -435,7 +431,12 @@ detailsFramework.EditorMixin = {
|
||||
get = function() return value end,
|
||||
set = function(widget, fixedValue, newValue, ...)
|
||||
--color is a table with 4 indexes for each color plus alpha
|
||||
if (option.widget == "color") then
|
||||
if (option.widget == "range" or option.widget == "slider") then
|
||||
if (not option.usedecimals) then
|
||||
newValue = math.floor(newValue)
|
||||
end
|
||||
|
||||
elseif (option.widget == "color") then
|
||||
--calor callback sends the red color in the fixedParameter slot
|
||||
local r, g, b, alpha = fixedValue, newValue, ...
|
||||
--need to use the same table from the profile table
|
||||
@@ -488,6 +489,7 @@ detailsFramework.EditorMixin = {
|
||||
menuOptions.align_as_pairs = true
|
||||
menuOptions.align_as_pairs_length = 150
|
||||
menuOptions.widget_width = 180
|
||||
menuOptions.slider_buttons_to_left = true
|
||||
|
||||
local optionsFrame = self:GetOptionsFrame()
|
||||
local canvasScrollBox = self:GetCanvasScrollBox()
|
||||
@@ -814,11 +816,16 @@ detailsFramework.EditorMixin = {
|
||||
|
||||
return selectObjectScrollBox
|
||||
end,
|
||||
|
||||
OnHide = function(self)
|
||||
self:StopObjectMovement()
|
||||
end,
|
||||
}
|
||||
|
||||
---@class df_editor_defaultoptions : table
|
||||
---@field width number
|
||||
---@field height number
|
||||
---@field options_width number
|
||||
---@field create_object_list boolean
|
||||
---@field object_list_width number
|
||||
---@field object_list_height number
|
||||
@@ -828,7 +835,8 @@ detailsFramework.EditorMixin = {
|
||||
---@class df_editor_defaultoptions
|
||||
local editorDefaultOptions = {
|
||||
width = 400,
|
||||
height = 600,
|
||||
height = 548,
|
||||
options_width = 340,
|
||||
create_object_list = true,
|
||||
object_list_width = 200,
|
||||
object_list_height = 420,
|
||||
@@ -871,6 +879,8 @@ function detailsFramework:CreateEditor(parent, name, options)
|
||||
detailsFramework:Mixin(editorFrame, detailsFramework.EditorMixin)
|
||||
detailsFramework:Mixin(editorFrame, detailsFramework.OptionsFunctions)
|
||||
|
||||
editorFrame:SetScript("OnHide", editorFrame.OnHide)
|
||||
|
||||
editorFrame.registeredObjects = {}
|
||||
editorFrame.registeredObjectsByID = {}
|
||||
|
||||
@@ -878,6 +888,17 @@ function detailsFramework:CreateEditor(parent, name, options)
|
||||
|
||||
editorFrame:SetSize(editorFrame.options.width, editorFrame.options.height)
|
||||
|
||||
--The options frame holds the options for the object being edited. It is used as the parent frame for the BuildMenuVolatile() function.
|
||||
local optionsFrame = CreateFrame("frame", name .. "OptionsFrame", editorFrame, "BackdropTemplate")
|
||||
optionsFrame:SetSize(editorFrame.options.options_width, 5000)
|
||||
|
||||
local canvasScrollBoxOptions = {
|
||||
width = editorFrame.options.options_width,
|
||||
height = 400,
|
||||
reskin_slider = true,
|
||||
}
|
||||
local canvasFrame = detailsFramework:CreateCanvasScrollBox(editorFrame, optionsFrame, name .. "CanvasScrollBox", canvasScrollBoxOptions)
|
||||
|
||||
if (editorFrame.options.create_object_list) then
|
||||
local scrollWidth = editorFrame.options.object_list_width
|
||||
local scrollHeight = editorFrame.options.object_list_height
|
||||
@@ -885,18 +906,19 @@ function detailsFramework:CreateEditor(parent, name, options)
|
||||
local scrollLineHeight = editorFrame.options.object_list_line_height
|
||||
|
||||
local objectSelector = editorFrame:CreateObjectSelectionList(scrollWidth, scrollHeight, scrollLinesAmount, scrollLineHeight)
|
||||
objectSelector:SetPoint("topleft", editorFrame, "topright", 2, 0)
|
||||
objectSelector:SetPoint("topleft", editorFrame, "topleft", 0, -2)
|
||||
objectSelector:SetBackdropBorderColor(0, 0, 0, 0)
|
||||
editorFrame.objectSelector = objectSelector
|
||||
objectSelector:RefreshMe()
|
||||
|
||||
local nScrollBarWidth = 30
|
||||
canvasFrame:SetPoint("topleft", objectSelector, "topright", nScrollBarWidth, 0)
|
||||
canvasFrame:SetPoint("bottomleft", objectSelector, "bottomright", -nScrollBarWidth, 0)
|
||||
else
|
||||
canvasFrame:SetPoint("topleft", editorFrame, "topleft", 2, -2)
|
||||
canvasFrame:SetPoint("bottomleft", editorFrame, "bottomleft", 2, 0)
|
||||
end
|
||||
|
||||
--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()
|
||||
|
||||
--over the top frame is a frame that is always on top of everything else
|
||||
local OTTFrame = CreateFrame("frame", "$parentOTTFrame", UIParent)
|
||||
OTTFrame:SetFrameStrata("TOOLTIP")
|
||||
|
||||
+9
-2
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
local dversion = 491
|
||||
local dversion = 492
|
||||
local major, minor = "DetailsFramework-1.0", dversion
|
||||
local DF, oldminor = LibStub:NewLibrary(major, minor)
|
||||
|
||||
@@ -526,10 +526,12 @@ end
|
||||
---get a value from a table using a path, e.g. getfrompath(tbl, "a.b.c") is the same as tbl.a.b.c
|
||||
---@param t table
|
||||
---@param path string
|
||||
---@param subOffset number?
|
||||
---@return any
|
||||
function DF.table.getfrompath(t, path)
|
||||
function DF.table.getfrompath(t, path, subOffset)
|
||||
if (path:match("%.") or path:match("%[")) then
|
||||
local value
|
||||
local offset = 0
|
||||
|
||||
for key in path:gmatch("[%w_]+") do
|
||||
value = t[key] or t[tonumber(key)]
|
||||
@@ -541,6 +543,11 @@ function DF.table.getfrompath(t, path)
|
||||
|
||||
--update t for the next iteration
|
||||
t = value
|
||||
offset = offset + 1
|
||||
|
||||
if (subOffset == offset) then
|
||||
return value
|
||||
end
|
||||
end
|
||||
|
||||
return value
|
||||
|
||||
@@ -53,11 +53,13 @@ local cornerNames = {"TopLeft", "TopRight", "BottomLeft", "BottomRight"}
|
||||
---@field border_color any
|
||||
---@field corner_texture any
|
||||
---@field horizontal_border_size_offset number?
|
||||
---@field titlebar_height number?
|
||||
|
||||
---@class df_roundedpanel_preset : table, df_roundedpanel_options
|
||||
---@field border_color any
|
||||
---@field color any
|
||||
---@field roundness number?
|
||||
---@field titlebar_height number?
|
||||
|
||||
---@class df_roundedcornermixin : table
|
||||
---@field RoundedCornerConstructor fun(self:df_roundedpanel) --called from CreateRoundedPanel
|
||||
@@ -239,9 +241,9 @@ detailsFramework.RoundedCornerPanelMixin = {
|
||||
---create a frame placed at the top side of the rounded panel, this frame has a member called 'Text' which is a fontstring for the title
|
||||
---@param self df_roundedpanel
|
||||
---@return df_roundedpanel
|
||||
CreateTitleBar = function(self)
|
||||
CreateTitleBar = function(self, optionsTable)
|
||||
---@type df_roundedpanel
|
||||
local titleBar = detailsFramework:CreateRoundedPanel(self, "$parentTitleBar", {width = self.options.width - 6, height = 16})
|
||||
local titleBar = detailsFramework:CreateRoundedPanel(self, "$parentTitleBar", {width = self.options.width - 6, height = self.options.titlebar_height})
|
||||
titleBar:SetPoint("top", self, "top", 0, -4)
|
||||
titleBar:SetRoundness(5)
|
||||
titleBar:SetFrameLevel(9500)
|
||||
@@ -512,19 +514,20 @@ local defaultOptions = {
|
||||
color = {.1, .1, .1, 1},
|
||||
border_color = {.2, .2, .2, .5},
|
||||
corner_texture = [[Interface\CHARACTERFRAME\TempPortraitAlphaMaskSmall]],
|
||||
titlebar_height = 26,
|
||||
}
|
||||
|
||||
local defaultPreset = {
|
||||
color = {.1, .1, .1, 1},
|
||||
border_color = {.2, .2, .2, .5},
|
||||
roundness = 3,
|
||||
titlebar_height = 16,
|
||||
}
|
||||
|
||||
---create a regular panel with rounded corner
|
||||
---@param parent frame
|
||||
---@param name string|nil
|
||||
---@param optionsTable table|nil
|
||||
---@return df_roundedpanel
|
||||
function detailsFramework:CreateRoundedPanel(parent, name, optionsTable)
|
||||
---@type df_roundedpanel
|
||||
local newRoundedPanel = CreateFrame("frame", name, parent, "BackdropTemplate")
|
||||
@@ -540,7 +543,7 @@ function detailsFramework:CreateRoundedPanel(parent, name, optionsTable)
|
||||
|
||||
if (newRoundedPanel.options.use_titlebar) then
|
||||
---@type df_roundedpanel
|
||||
local titleBar = detailsFramework:CreateRoundedPanel(newRoundedPanel, "$parentTitleBar", {height = 26})
|
||||
local titleBar = detailsFramework:CreateRoundedPanel(newRoundedPanel, "$parentTitleBar", {height = newRoundedPanel.options.titlebar_height})
|
||||
titleBar:SetColor(unpack(titleBarColor))
|
||||
titleBar:SetPoint("top", newRoundedPanel, "top", 0, -7)
|
||||
|
||||
@@ -579,7 +582,8 @@ local applyPreset = function(frame, preset)
|
||||
end
|
||||
|
||||
if (preset.use_titlebar) then
|
||||
frame:CreateTitleBar()
|
||||
frame:CreateTitleBar(preset)
|
||||
frame.TitleBar.Text:SetText(preset.title)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -623,6 +627,7 @@ function detailsFramework:AddRoundedCornersToFrame(frame, preset)
|
||||
--handle preset
|
||||
if (preset and type(preset) == "table") then
|
||||
frame.options.horizontal_border_size_offset = preset.horizontal_border_size_offset
|
||||
frame.options.titlebar_height = preset.titlebar_height
|
||||
applyPreset(frame, preset)
|
||||
else
|
||||
applyPreset(frame, defaultPreset)
|
||||
|
||||
Reference in New Issue
Block a user