From 305bb9eaf51e375b864d5dfde7f2bc211a2d0759 Mon Sep 17 00:00:00 2001 From: OldManAlpha <60587722+OldManAlpha@users.noreply.github.com> Date: Tue, 12 Aug 2025 12:01:35 -0700 Subject: [PATCH] Improve look of Customize & add frame lock in it --- PTUnitFrameGroup.lua | 1 - PuppeteerSettings.lua | 6 ++++++ gui/Settings.lua | 43 +++++++++++++++++++++++++++++++++---------- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/PTUnitFrameGroup.lua b/PTUnitFrameGroup.lua index df21807..542b4ec 100644 --- a/PTUnitFrameGroup.lua +++ b/PTUnitFrameGroup.lua @@ -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) diff --git a/PuppeteerSettings.lua b/PuppeteerSettings.lua index cb61c9f..f60d545 100644 --- a/PuppeteerSettings.lua +++ b/PuppeteerSettings.lua @@ -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 \ No newline at end of file diff --git a/gui/Settings.lua b/gui/Settings.lua index 29cb070..85e39df 100644 --- a/gui/Settings.lua +++ b/gui/Settings.lua @@ -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