Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Make it optional whether to hide the default cast bar #46

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Data/Defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ Defaults.Widgets = {
---@field widgets WidgetTables
---@field tooltipPosition TooltipPosition
---@field sameSizeAsPlayer boolean?
---@field hideBlizzardCastBar boolean?

---@alias UnitLayoutTable table<Unit, UnitLayout>
---@type UnitLayoutTable
Expand All @@ -468,6 +469,7 @@ Defaults.Layouts = {
position = { 800, 500 },
widgets = Defaults.Widgets,
tooltipPosition = { "BOTTOMLEFT", "BOTTOMLEFT", -3, 0, },
hideBlizzardCastBar = false,
},
target = {
enabled = false,
Expand Down
3 changes: 3 additions & 0 deletions Locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ L.CreatedAutomaticBackup = "New version detected. Created backups for:"
L.CreatedManualBackup = "Created manual backups for:"
L.Backup_manual = "Manual Backup"
L.Backup_automatic = "Automatic Backup"
L.HideDefaultCastBar = "Hide Default Cast Bar"
L.HideDefaultCastBarTooltip = [[Hides the default cast bar.
Reload to show it again after disabling this option.]]

-- Custom Formats
L.ValidTags = "Valid Tags"
Expand Down
10 changes: 10 additions & 0 deletions UnitFrames/MenuOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ local function AddLoadPageDB(unitPage)
-- same as player
if not isPlayerPage then
unitPage.sameSizeAsPlayerCB:SetChecked(isSameSizeAsPlayer)
else
unitPage.hideBlizzardCastBarCB:SetChecked(pageDB.hideBlizzardCastBar)
end

if isPlayerPage then
Expand Down Expand Up @@ -130,6 +132,14 @@ local function AddUnitsToMenu()
end
end)
unitPage.sameSizeAsPlayerCB:SetPoint("TOPLEFT", unitPage.enabledCB, "TOPRIGHT", 200, 0)
else
-- Disable blizzard cast bar
unitPage.hideBlizzardCastBarCB = Cell:CreateCheckButton(unitPage.frame, L.HideDefaultCastBar,
function(checked)
CUF.DB.SelectedLayoutTable()[unit].hideBlizzardCastBar = checked
CUF:Fire("UpdateVisibility", unit)
end, L.HideDefaultCastBarTooltip)
unitPage.hideBlizzardCastBarCB:SetPoint("TOPLEFT", unitPage.enabledCB, "TOPRIGHT", 200, 0)
end

---@type CellSlider
Expand Down
7 changes: 6 additions & 1 deletion Util/HideBlizzard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ end
function CUF:HideBlizzardUnitFrame(unit)
if unit == "player" and _G.PlayerFrame then
HideFrame(_G.PlayerFrame)
PlayerCastingBarFrame:UnregisterAllEvents()

if CUF.DB.CurrentLayoutTable()[unit].hideBlizzardCastBar then
if _G.PlayerCastingBarFrame then
HideFrame(_G.PlayerCastingBarFrame)
end
end
elseif unit == "target" and _G.TargetFrame then
HideFrame(_G.TargetFrame)
elseif unit == "focus" and _G.FocusFrame then
Expand Down