mirror of
https://github.com/OldManAlpha/Puppeteer.git
synced 2025-11-28 23:48:35 +00:00
Improve look of Customize & add frame lock in it
This commit is contained in:
parent
2a5ed7006b
commit
305bb9eaf5
@ -29,7 +29,6 @@ ContextMenu:SetDynamicOptions(function(addOption, level, args)
|
||||
addOption("text", "Lock Position",
|
||||
"func", function(self, gui)
|
||||
PuppeteerSettings.SetFrameLocked(gui.FrameGroup.name, not self.checked)
|
||||
gui.FrameGroup:UpdateHeaderColor()
|
||||
end,
|
||||
"initFunc", function(self, gui)
|
||||
self.checked = PuppeteerSettings.IsFrameLocked(gui.FrameGroup.name)
|
||||
|
||||
@ -465,6 +465,7 @@ function SetFrameHidden(frameName, hidden)
|
||||
PTOptions.FrameOptions[frameName] = {}
|
||||
end
|
||||
PTOptions.FrameOptions[frameName].Hidden = hidden
|
||||
PTSettingsGui.UpdateFrameOptions()
|
||||
end
|
||||
|
||||
function IsFrameLocked(frameName)
|
||||
@ -476,4 +477,9 @@ function SetFrameLocked(frameName, locked)
|
||||
PTOptions.FrameOptions[frameName] = {}
|
||||
end
|
||||
PTOptions.FrameOptions[frameName].Locked = locked
|
||||
local group = Puppeteer.UnitFrameGroups[frameName]
|
||||
if group then
|
||||
group:UpdateHeaderColor()
|
||||
end
|
||||
PTSettingsGui.UpdateFrameOptions()
|
||||
end
|
||||
@ -649,10 +649,20 @@ end
|
||||
|
||||
function CreateTab_Customize()
|
||||
local container = TabFrame:CreateTab("Customize")
|
||||
local layout = NewLabeledColumnLayout(container, {100, 340}, -40, 10)
|
||||
|
||||
local frameStyleContainer = PTGuiLib.Get("container", container)
|
||||
:SetSimpleBackground()
|
||||
:SetPoint("TOPLEFT", container, "TOPLEFT", 5, -26)
|
||||
:SetPoint("BOTTOMRIGHT", container, "TOPRIGHT", -5, -120)
|
||||
local layout = NewLabeledColumnLayout(frameStyleContainer, {100, 340}, -35, 10)
|
||||
|
||||
local frameSettingsText = CreateLabel(frameStyleContainer, "Frame Group Settings")
|
||||
:SetPoint("TOP", frameStyleContainer, "TOP", 0, -5)
|
||||
:SetFontSize(14)
|
||||
|
||||
|
||||
local preferredFrameOrder = {"Party", "Pets", "Raid", "Raid Pets", "Target", "Focus"}
|
||||
local frameDropdown = CreateLabeledDropdown(container, "Select Frame", "The frame to edit the style of")
|
||||
local frameDropdown = CreateLabeledDropdown(frameStyleContainer, "Select Frame", "The frame to edit the attributes of")
|
||||
:SetWidth(150)
|
||||
:SetDynamicOptions(function(addOption, level, args)
|
||||
for _, name in ipairs(preferredFrameOrder) do
|
||||
@ -677,14 +687,14 @@ function CreateTab_Customize()
|
||||
end,
|
||||
func = function(self, gui)
|
||||
StyleDropdown:UpdateText()
|
||||
HideFrameCheckbox:SetChecked(PuppeteerSettings.IsFrameHidden(self.text))
|
||||
UpdateFrameOptions()
|
||||
end
|
||||
})
|
||||
:SetText("Party")
|
||||
FrameDropdown = frameDropdown
|
||||
layout:layoutComponent(frameDropdown)
|
||||
local GetSelectedProfileName = PuppeteerSettings.GetSelectedProfileName
|
||||
local styleDropdown = CreateLabeledDropdown(container, "Choose Style", "The style of the frame")
|
||||
local styleDropdown = CreateLabeledDropdown(frameStyleContainer, "Choose Style", "The style of the frame")
|
||||
:SetWidth(150)
|
||||
:SetDynamicOptions(function(addOption, level, args)
|
||||
local profiles = PTProfileManager.GetProfileNames()
|
||||
@ -738,20 +748,28 @@ function CreateTab_Customize()
|
||||
StyleDropdown = styleDropdown
|
||||
layout:offset(0, 10):layoutComponent(styleDropdown)
|
||||
|
||||
local hideFrameCheckbox = CreateLabeledCheckbox(container, "Hide Frame", "If checked, this frame will not be visible")
|
||||
local lockFrameCheckbox = CreateLabeledCheckbox(frameStyleContainer, "Lock Frame", {"If checked, this frame will not be movable",
|
||||
"Note: This setting is also accessible by right-clicking the group title bar"})
|
||||
:OnClick(function(self)
|
||||
local frameName = frameDropdown:GetText()
|
||||
PuppeteerSettings.SetFrameLocked(frameName, self:GetChecked() == 1)
|
||||
end)
|
||||
layout:column(2):layoutComponent(lockFrameCheckbox)
|
||||
LockFrameCheckbox = lockFrameCheckbox
|
||||
|
||||
local hideFrameCheckbox = CreateLabeledCheckbox(frameStyleContainer, "Hide Frame", "If checked, this frame will not be visible")
|
||||
:OnClick(function(self)
|
||||
local frameName = frameDropdown:GetText()
|
||||
if not PTOptions.FrameOptions[frameName] then
|
||||
PTOptions.FrameOptions[frameName] = {}
|
||||
end
|
||||
PuppeteerSettings.SetFrameHidden(frameName, self:GetChecked() == 1)
|
||||
Puppeteer.CheckGroup()
|
||||
end)
|
||||
layout:column(2):levelAt(1):layoutComponent(hideFrameCheckbox)
|
||||
layout:layoutComponent(hideFrameCheckbox)
|
||||
HideFrameCheckbox = hideFrameCheckbox
|
||||
|
||||
UpdateFrameOptions()
|
||||
|
||||
local overrideContainer = PTGuiLib.Get("scroll_frame", container)
|
||||
:SetPoint("TOPLEFT", container, "TOPLEFT", 5, -100)
|
||||
:SetPoint("TOPLEFT", frameStyleContainer, "BOTTOMLEFT", 0, -5)
|
||||
:SetPoint("BOTTOMRIGHT", container, "BOTTOMRIGHT", -5, 5)
|
||||
:SetSimpleBackground()
|
||||
StyleOverrideContainer = overrideContainer
|
||||
@ -825,6 +843,11 @@ function CreateTab_Customize()
|
||||
add(createDropdown("Vertical Spacing", "The number of pixels between units", "VerticalSpacing", {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}))
|
||||
end
|
||||
|
||||
function UpdateFrameOptions()
|
||||
LockFrameCheckbox:SetChecked(PuppeteerSettings.IsFrameLocked(FrameDropdown:GetText()))
|
||||
HideFrameCheckbox:SetChecked(PuppeteerSettings.IsFrameHidden(FrameDropdown:GetText()))
|
||||
end
|
||||
|
||||
StyleOverrideComponents = {}
|
||||
|
||||
CurrentStyleOverride = nil
|
||||
|
||||
Loading…
Reference in New Issue
Block a user