Skip to content

Commit

Permalink
framework update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Sep 26, 2022
1 parent a430220 commit dd8da2d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 9 deletions.
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 = 364
local dversion = 366
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)

Expand Down Expand Up @@ -1484,6 +1484,24 @@ end
height = abs ((height or parent:GetHeight()) - abs (y_offset) + 20)
height = height*-1

--normalize format types
for index, widgetTable in ipairs(menu) do
if (widgetTable.type == "space") then
widgetTable.type = "blank"
elseif (widgetTable.type == "dropdown") then
widgetTable.type = "select"
elseif (widgetTable.type == "switch") then
widgetTable.type = "toggle"
elseif (widgetTable.type == "slider") then
widgetTable.type = "range"
elseif (widgetTable.type == "button") then
widgetTable.type = "execute"
end
end

--catch some options added in the hash part of the menu table
local useBoxFirstOnAllWidgets = menu.always_boxfirst

for index, widget_table in ipairs(menu) do
if (not widget_table.hidden) then

Expand Down Expand Up @@ -1611,7 +1629,7 @@ end
switch:ClearAllPoints()
switch.hasLabel:ClearAllPoints()

if (widget_table.boxfirst) then
if (widget_table.boxfirst or useBoxFirstOnAllWidgets) then
switch:SetPoint (cur_x, cur_y)
switch.hasLabel:SetPoint ("left", switch, "right", 2)
else
Expand Down Expand Up @@ -1720,7 +1738,7 @@ end
label.text = widget_table.name .. (use_two_points and ": " or "")
label:SetTemplate(widget_table.text_template or text_template)

if (widget_table.boxfirst) then
if (widget_table.boxfirst or useBoxFirstOnAllWidgets) then
label:SetPoint("left", colorpick, "right", 2)
colorpick:SetPoint(cur_x, cur_y)
extraPaddingY = 1
Expand Down Expand Up @@ -1895,6 +1913,9 @@ end
end
end

--catch some options added in the hash part of the menu table
local useBoxFirstOnAllWidgets = menu.always_boxfirst

for index, widget_table in ipairs (menu) do
if (not widget_table.hidden) then

Expand Down Expand Up @@ -1996,7 +2017,7 @@ end
end

local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
if (widget_table.boxfirst) then
if (widget_table.boxfirst or useBoxFirstOnAllWidgets) then
switch:SetPoint (cur_x, cur_y)
label:SetPoint ("left", switch, "right", 2)

Expand Down Expand Up @@ -2100,7 +2121,7 @@ end
end

local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
if (widget_table.boxfirst) then
if (widget_table.boxfirst or useBoxFirstOnAllWidgets) then
label:SetPoint("left", colorpick, "right", 2)
colorpick:SetPoint(cur_x, cur_y)
extraPaddingY = 1
Expand Down
1 change: 1 addition & 0 deletions Libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3952,6 +3952,7 @@ function DF:CreateTabContainer (parent, title, frame_name, frameList, options_ta

local title = DF:CreateLabel (f, frame.title, 16, "silver")
title:SetPoint ("topleft", mainTitle, "bottomleft", 0, 0)
f.titleText = title

local tabButton = DF:CreateButton (mainFrame, DF.TabContainerFunctions.SelectIndex, buttonWidth, buttonHeight, frame.title, i, nil, nil, nil, "$parentTabButton" .. frame.name, false, button_tab_template)
PixelUtil.SetSize (tabButton, buttonWidth, buttonHeight)
Expand Down
15 changes: 11 additions & 4 deletions Libs/DF/picture.lua
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,17 @@ DF:Mixin(ImageMetaFunctions, DF.SetPointMixin)
if (texture) then
if (type(texture) == "table") then
if (texture.gradient) then
ImageObject.image:SetColorTexture(1, 1, 1, 1)
local fromColor = DF:FormatColor("tablemembers", texture.fromColor)
local toColor = DF:FormatColor("tablemembers", texture.toColor)
ImageObject.image:SetGradient(texture.gradient, fromColor, toColor)
if (DF.IsDragonflight()) then
ImageObject.image:SetColorTexture(1, 1, 1, 1)
local fromColor = DF:FormatColor("tablemembers", texture.fromColor)
local toColor = DF:FormatColor("tablemembers", texture.toColor)
ImageObject.image:SetGradient(texture.gradient, fromColor, toColor)
else
local fromR, fromG, fromB, fromA = DF:ParseColors(texture.fromColor)
local toR, toG, toB, toA = DF:ParseColors(texture.toColor)
ImageObject.image:SetColorTexture(1, 1, 1, 1)
ImageObject.image:SetGradientAlpha(texture.gradient, fromR, fromG, fromB, fromA, toR, toG, toB, toA)
end
else
local r, g, b, a = DF:ParseColors(texture)
ImageObject.image:SetColorTexture(r, g, b, a)
Expand Down

0 comments on commit dd8da2d

Please sign in to comment.