Skip to content

Commit

Permalink
Polishing the background of many Details! window, they all now share …
Browse files Browse the repository at this point in the history
…the same color, the color can be set with Details:SetWindowColor(r, g, b, a)
  • Loading branch information
Tercioo committed Mar 6, 2024
1 parent a155ec5 commit 9c23a8a
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 89 deletions.
71 changes: 18 additions & 53 deletions core/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,6 @@
pluginContainerFrame:EnableMouse(true)
pluginContainerFrame:SetMovable(true)
pluginContainerFrame:SetPoint("center", UIParent, "center", 0, 0)
pluginContainerFrame:SetBackdrop(Details.PluginDefaults and Details.PluginDefaults.Backdrop or {bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
pluginContainerFrame:SetBackdropColor(0, 0, 0, 0.3)
pluginContainerFrame:SetBackdropBorderColor(0, 0, 0, 1)
table.insert(UISpecialFrames, "DetailsPluginContainerWindow")

pluginContainerFrame:Hide()
Expand Down Expand Up @@ -531,39 +528,36 @@
local scaleBar = DetailsFramework:CreateScaleBar(pluginContainerFrame, Details.options_window, true)
scaleBar:SetFrameStrata("fullscreen")
pluginContainerFrame:SetScale(Details.options_window.scale)
pluginContainerFrame.scaleBar = scaleBar

--left side bar menu
local optionsLeftSideBarMenu = CreateFrame("frame", "$parentMenuFrame", pluginContainerFrame, "BackdropTemplate")
DetailsFramework:ApplyStandardBackdrop(optionsLeftSideBarMenu)
detailsFramework:AddRoundedCornersToFrame(optionsLeftSideBarMenu, Details.PlayerBreakdown.RoundedCornerPreset)
optionsLeftSideBarMenu:SetPoint("topright", pluginContainerFrame, "topleft", -2, 0)
optionsLeftSideBarMenu:SetPoint("bottomright", pluginContainerFrame, "bottomleft", -2, 0)
optionsLeftSideBarMenu:SetWidth(pluginContainerFrame.MenuButtonWidth + 6)
pluginContainerFrame.optionsLeftSideBarMenu = optionsLeftSideBarMenu

--statusbar
local statusBar = CreateFrame("frame", nil, optionsLeftSideBarMenu, "BackdropTemplate")
statusBar:SetPoint("topleft", optionsLeftSideBarMenu, "bottomleft", 0, 1)
statusBar:SetPoint("topright", pluginContainerFrame, "bottomright", 0, 1)
statusBar:SetHeight(20)
statusBar:SetPoint("bottomleft", pluginContainerFrame, "bottomleft", 0, 5)
statusBar:SetPoint("bottomright", pluginContainerFrame, "bottomright", 0, 5)
statusBar:SetHeight(16)
statusBar:SetAlpha(1)

DetailsFramework:BuildStatusbarAuthorInfo(statusBar)
DetailsFramework:ApplyStandardBackdrop(statusBar)

local extraDarkTexture = statusBar:CreateTexture(nil, "background")
extraDarkTexture:SetAllPoints()
extraDarkTexture:SetColorTexture(.2, .2, .2, .8)

local rightClickToBackLabel = detailsFramework:CreateLabel(statusBar, "right click to close", 10, "gray")
rightClickToBackLabel:SetPoint("bottomright", statusBar, "bottomright", -1, 5)
rightClickToBackLabel:SetAlpha(.4)

optionsLeftSideBarMenu:SetPoint("topright", pluginContainerFrame, "topleft", -2, 0)
optionsLeftSideBarMenu:SetPoint("bottomright", pluginContainerFrame, "bottomleft", -2, 0)
optionsLeftSideBarMenu:SetWidth(pluginContainerFrame.MenuButtonWidth + 6)

local bigDogTexture = detailsFramework:NewImage(optionsLeftSideBarMenu, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 180*0.7, 200*0.7, "overlay", {0, 1, 0, 1}, "backgroundBigDog", "$parentBackgroundBigDog")
bigDogTexture:SetPoint("bottomleft", custom_window, "bottomleft", 0, 1)
bigDogTexture:SetAlpha(0)

local gradientBelowTheLine = DetailsFramework:CreateTexture(optionsLeftSideBarMenu, {gradient = "vertical", fromColor = {0, 0, 0, 0.45}, toColor = "transparent"}, 1, 95, "artwork", {0, 1, 0, 1}, "dogGradient")
gradientBelowTheLine:SetPoint("bottoms")
gradientBelowTheLine:Hide()

local bigDogRowTexture = optionsLeftSideBarMenu:CreateTexture(nil, "artwork")
bigDogRowTexture:SetPoint("bottomleft", optionsLeftSideBarMenu, "bottomleft", 1, 1)
Expand All @@ -572,28 +566,13 @@
bigDogRowTexture:SetColorTexture(.5, .5, .5, .1)
bigDogRowTexture:Hide()

--plugins menu title bar
local titleBarPlugins = CreateFrame("frame", "$parentPluginsHeader", optionsLeftSideBarMenu, "BackdropTemplate")
PixelUtil.SetPoint(titleBarPlugins, "topleft", optionsLeftSideBarMenu, "topleft", 2, -3)
PixelUtil.SetPoint(titleBarPlugins, "topright", optionsLeftSideBarMenu, "topright", -2, -3)
titleBarPlugins:SetHeight(pluginContainerFrame.TitleHeight)
titleBarPlugins:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true})
titleBarPlugins:SetBackdropColor(.5, .5, .5, 1)
titleBarPlugins:SetBackdropBorderColor(0, 0, 0, 1)

--title label
local titleBarPlugins_TitleLabel = detailsFramework:NewLabel(titleBarPlugins, titleBarPlugins, nil, "titulo", "Plugins", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255})
PixelUtil.SetPoint(titleBarPlugins_TitleLabel, "center", titleBarPlugins , "center", 0, 0)
PixelUtil.SetPoint(titleBarPlugins_TitleLabel, "top", titleBarPlugins , "top", 0, -5)

--tools menu title bar
--tools title bar
local titleBarTools = CreateFrame("frame", "$parentToolsHeader", optionsLeftSideBarMenu, "BackdropTemplate")
PixelUtil.SetPoint(titleBarTools, "topleft", optionsLeftSideBarMenu, "topleft", 2, -3)
PixelUtil.SetPoint(titleBarTools, "topright", optionsLeftSideBarMenu, "topright", -2, -3)
titleBarTools:SetHeight(pluginContainerFrame.TitleHeight)
titleBarTools:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true})
titleBarTools:SetBackdropColor(.5, .5, .5, 1)
titleBarTools:SetBackdropBorderColor(0, 0, 0, 1)

--title label
--tools title label
local titleBarTools_TitleLabel = detailsFramework:NewLabel(titleBarTools, titleBarTools, nil, "titulo", "Tools", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255})
PixelUtil.SetPoint(titleBarTools_TitleLabel, "center", titleBarTools , "center", 0, 0)
PixelUtil.SetPoint(titleBarTools_TitleLabel, "top", titleBarTools , "top", 0, -5)
Expand All @@ -617,8 +596,7 @@
end)
end)

pluginContainerFrame:SetScript("OnHide", function()
end)
pluginContainerFrame:SetScript("OnHide", function() end)

pluginContainerFrame:SetScript("OnMouseDown", function(self, button)
if (button == "RightButton") then
Expand Down Expand Up @@ -745,7 +723,7 @@
newButton.IsUtility = bIsUtility
pluginObject.__isUtility = bIsUtility

newButton:SetTemplate(detailsFramework:GetTemplate("button", "DETAILS_PLUGINPANEL_BUTTON_TEMPLATE"))
newButton:SetTemplate("STANDARD_GRAY")
newButton:SetText(pluginObject.__name)
newButton.textsize = 10
newButton:SetIcon(pluginObject.__icon, nil, nil, nil, pluginObject.__iconcoords, pluginObject.__iconcolor, 4)
Expand Down Expand Up @@ -809,24 +787,11 @@
end)

--reset the buttons points
local addingTools = false
for index, button in ipairs(pluginContainerFrame.MenuButtons) do
button:ClearAllPoints()
PixelUtil.SetPoint(button, "center", optionsLeftSideBarMenu, "center", 0, 0)

if (button.IsUtility) then
if (not addingTools) then
--add the header
addingTools = true
--add -20 to add a gap between plugins and utilities
PixelUtil.SetPoint(titleBarTools, "topleft", optionsLeftSideBarMenu, "topleft", 2, pluginContainerFrame.MenuY +((index-1) * -pluginContainerFrame.MenuButtonHeight ) - index - 20)
PixelUtil.SetPoint(titleBarTools, "topright", optionsLeftSideBarMenu, "topright", -2, pluginContainerFrame.MenuY +((index-1) * -pluginContainerFrame.MenuButtonHeight ) - index - 20)
end

PixelUtil.SetPoint(button, "top", optionsLeftSideBarMenu, "top", 0, pluginContainerFrame.MenuY +((index-1) * -pluginContainerFrame.MenuButtonHeight ) - index - 40)
else
PixelUtil.SetPoint(button, "top", optionsLeftSideBarMenu, "top", 0, pluginContainerFrame.MenuY +((index-1) * -pluginContainerFrame.MenuButtonHeight ) - index)
end
PixelUtil.SetPoint(button, "top", optionsLeftSideBarMenu, "top", 0, pluginContainerFrame.MenuY +((index-1) * -pluginContainerFrame.MenuButtonHeight ) - index)
detailsFramework:SetTemplate(button, "STANDARD_GRAY")
end

--format the plugin main frame
Expand Down
22 changes: 18 additions & 4 deletions frames/window_breakdown/window_playerbreakdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,27 @@ end
Details.PlayerBreakdown.RoundedCornerPreset = {
roundness = 6,
color = {.1, .1, .1, 0.834},
--border_color = {.05, .05, .05, 0.834},
}

function Details:SetBreakdownWindowColor(r, g, b, a)
--setcolor implemented by rounded corners
function Details:SetWindowColor(r, g, b, a)
--SetColor implemented by rounded corners, does not save the color, by apply
breakdownWindowFrame:SetColor(r, g, b, a)
breakdownSideMenu:SetColor(r, g, b, a)

if (DetailsOptionsWindow) then
DetailsOptionsWindow:SetColor(r, g, b, a)
DetailsPluginContainerWindowMenuFrame:SetColor(r, g, b, a)
end

if (DetailsReportWindow) then
DetailsReportWindow:SetColor(r, g, b, a)
end

local colorTable = Details.frame_background_color
colorTable[1] = r
colorTable[2] = g
colorTable[3] = b
colorTable[4] = a
end

---open the breakdown window
Expand All @@ -289,7 +303,7 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute
detailsFramework:AddRoundedCornersToFrame(breakdownSideMenu, Details.PlayerBreakdown.RoundedCornerPreset)
end

Details:SetBreakdownWindowColor(unpack(Details.frame_background_color))
Details:SetWindowColor(unpack(Details.frame_background_color))

if (not Details.row_singleclick_overwrite[mainAttribute] or not Details.row_singleclick_overwrite[mainAttribute][subAttribute]) then
Details:CloseBreakdownWindow()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ local createOptionsPanel = function()
colorTable[2] = normalizedGreen
colorTable[3] = normalizedBlue
colorTable[4] = normalizedAlpha
Details:SetBreakdownWindowColor(normalizedRed, normalizedGreen, normalizedBlue, normalizedAlpha)
Details:SetWindowColor(normalizedRed, normalizedGreen, normalizedBlue, normalizedAlpha)
end,
name = "Background Color",
desc = "Background Color",
Expand Down
61 changes: 30 additions & 31 deletions frames/window_options2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,46 +45,38 @@ end
function Details222.OptionsPanel.InitializeOptionsWindow(instance)
local DetailsOptionsWindow = detailsFramework:NewPanel(UIParent, _, "DetailsOptionsWindow", _, 897, 592)
local optionsFrame = DetailsOptionsWindow.frame
optionsFrame:Hide()

DetailsOptionsWindow:SetBackdrop({})
detailsFramework:AddRoundedCornersToFrame(optionsFrame, Details.PlayerBreakdown.RoundedCornerPreset)
optionsFrame:SetColor(unpack(Details.frame_background_color))

optionsFrame.Frame = optionsFrame
optionsFrame.__name = "Options"
optionsFrame.real_name = "DETAILS_OPTIONS"
optionsFrame.__icon = [[Interface\Scenarios\ScenarioIcon-Interact]]
_G.DetailsPluginContainerWindow.EmbedPlugin(optionsFrame, optionsFrame, true)

optionsFrame.sectionFramesContainer = {}

detailsFramework:ApplyStandardBackdrop(optionsFrame)
local titleBar = detailsFramework:CreateTitleBar(optionsFrame, "Options Panel")
titleBar.Text:Hide()

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")

optionsFrame:Hide()
local closeButton = detailsFramework:CreateCloseButton(optionsFrame, "$parentCloseButton")
closeButton:SetScript("OnClick", function()
DetailsPluginContainerWindow:Hide()
end)
closeButton:SetPoint("topright", optionsFrame, "topright", -5, -5)

local formatFooterText = function(object)
object.fontface = "GameFontNormal"
object.fontsize = 10
object.fontcolor = {1, 0.82, 0}
end
local titleText = detailsFramework:NewLabel(optionsFrame, nil, "$parentTitleLabel", "title", "Details! " .. Loc ["STRING_OPTIONS_WINDOW"], "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255})
titleText:SetPoint("top", optionsFrame, "top", 0, -5)

--create a floating frame to hold footer frames
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(optionsFrame:GetFrameLevel() + 10)
detailsFramework:ApplyStandardBackdrop(footerFrame)
footerFrame:Hide() --at the moment of this change (2023.11.14), I don't know if the footer will have further use
--[=[
local gradientBelowTheLine = DetailsFramework:CreateTexture(optionsFrame, {gradient = "vertical", fromColor = {0, 0, 0, 0.25}, toColor = "transparent"}, 1, 90, "artwork", {0, 1, 0, 1}, "dogGradient")
gradientBelowTheLine:SetPoint("bottoms")
gradientBelowTheLine:Hide()
local OTTFrame = CreateFrame("frame", "$parentOverTheTopFrame", optionsFrame)
OTTFrame:SetSize(1, 1)
OTTFrame:SetFrameLevel(999)
OTTFrame:SetPoint("topleft", optionsFrame, "topleft", 0, 0)

local gradientBelowTheLine = DetailsFramework:CreateTexture(optionsFrame, {gradient = "vertical", fromColor = {0, 0, 0, 0.25}, toColor = "transparent"}, 1, 90, "artwork", {0, 1, 0, 1}, "dogGradient")
gradientBelowTheLine:SetPoint("bottoms")
OTTFrame:Hide()
--divisor shown above the tab options area
local frameBackgroundTextureTopLine = OTTFrame:CreateTexture("$parentHeaderDivisorTopLine", "artwork")
Expand All @@ -93,21 +85,24 @@ function Details222.OptionsPanel.InitializeOptionsWindow(instance)
frameBackgroundTextureTopLine:SetPoint("topright", optionsFrame, "topright", -1, divisorYPosition)
frameBackgroundTextureTopLine:SetHeight(1)
frameBackgroundTextureTopLine:SetColorTexture(0.1215, 0.1176, 0.1294)
frameBackgroundTextureTopLine:Hide()
--divisor shown in the left side of the tab options area
local frameBackgroundTextureLeftLine = OTTFrame:CreateTexture("$parentHeaderDivisorLeftLine", "artwork")
local divisorYPosition = -60
frameBackgroundTextureLeftLine:SetPoint("topleft", frameBackgroundTextureTopLine, "topleft", 0, 0)
frameBackgroundTextureLeftLine:SetPoint("bottomleft", optionsFrame, "bottomleft", startX-9, 1)
frameBackgroundTextureLeftLine:SetHeight(1)
frameBackgroundTextureLeftLine:SetColorTexture(0.1215, 0.1176, 0.1294)
frameBackgroundTextureLeftLine:Hide()
local frameBackgroundTexture = optionsFrame:CreateTexture(nil, "artwork")
frameBackgroundTexture:SetPoint("topleft", optionsFrame, "topleft", startX-9, divisorYPosition-1)
frameBackgroundTexture:SetPoint("bottomright", optionsFrame, "bottomright", -1, 0)
frameBackgroundTexture:SetColorTexture (0.2317647, 0.2317647, 0.2317647)
frameBackgroundTexture:SetVertexColor (0.27, 0.27, 0.27)
frameBackgroundTexture:SetAlpha (0.3)
frameBackgroundTexture:Hide()
--]=]

--select the instance to edit
local onSelectInstance = function(_, _, instanceId)
Expand Down Expand Up @@ -186,6 +181,12 @@ function Details222.OptionsPanel.InitializeOptionsWindow(instance)
GameCooltip:Hide()
end)

local formatFooterText = function(object)
object.fontface = "GameFontNormal"
object.fontsize = 10
object.fontcolor = {1, 0.82, 0}
end

local instancesFontString = detailsFramework:NewLabel(optionsFrame, nil, "$parentInstanceDropdownLabel", "instancetext", Loc ["STRING_OPTIONS_EDITINSTANCE"], "GameFontNormal", 12)
instancesFontString:SetPoint("right", instanceSelection, "left", -2, 1)
formatFooterText(instancesFontString)
Expand Down Expand Up @@ -217,6 +218,7 @@ function Details222.OptionsPanel.InitializeOptionsWindow(instance)
Details:StopTestBarUpdate()
end
end

local fillbars = detailsFramework:NewButton(optionsFrame, _, "$parentCreateExampleBarsButton", nil, 140, 20, create_test_bars_func, nil, nil, nil, Loc ["STRING_OPTIONS_TESTBARS"], 1)
PixelUtil.SetPoint(fillbars, "topleft", optionsFrame.widget, "topleft", startX-8, -30)
fillbars:SetTemplate(options_button_template)
Expand Down Expand Up @@ -375,11 +377,6 @@ function Details222.OptionsPanel.InitializeOptionsWindow(instance)
sectionFrame:SetSize(optionsFrame:GetSize())
sectionFrame:EnableMouse(false)

local realBackdropAreaFrame = CreateFrame("frame", "$parentTab" .. sectionId .. "BackdropArea", optionsFrame, "BackdropTemplate")
realBackdropAreaFrame:SetFrameLevel(optionsFrame:GetFrameLevel()-1)
realBackdropAreaFrame:SetPoint("topleft", optionsFrame, "topleft", 150, -27)
realBackdropAreaFrame:SetSize(775, 570)

sectionFrame.name = sectionsName[sectionId]
optionsFrame.sectionFramesContainer[sectionId] = sectionFrame

Expand Down Expand Up @@ -462,6 +459,8 @@ function Details:OpenOptionsWindow(instance, bNoReopen, section)
window.instanceDropdown:Select(instance:GetId())

window.updateMicroFrames()

DetailsPluginContainerWindowMenuFrame:SetColor(unpack(Details.frame_background_color))
end

function Details:OpenOptionsPanel(instance, bNoReopen, section) --alias
Expand Down

0 comments on commit 9c23a8a

Please sign in to comment.