Skip to content

Commit

Permalink
move Edit Mode button to Unit Frames tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Krealle committed Sep 9, 2024
1 parent f46f4e4 commit 7afe13a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
1 change: 1 addition & 0 deletions Core/SlashCommands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function SlashCmdList.CUF(msg, editbox)
CUF:Print("Available commands:" .. "\n" ..
"/cuf test - toggle test mode" .. "\n" ..
"/cuf dev - toggle debug mode" .. "\n" ..
"/cuf edit - toggle edit mode" .. "\n" ..
"/cuf restore <automatic|manual> - restore a backup"
)
end
Expand Down
3 changes: 3 additions & 0 deletions Locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ L.SameSizeAsHealthBar = "Same Size As Health Bar"
L.EditingLayout = "Editing Layout"
L.MirrorPlayer = "Mirror Player"
L.Positioning = "Positioning"
L.EditMode = "Edit Mode"
L.ToggleEditMode = "Toggle Edit Mode"
L.EditModeButtonTooltip = "Edit mode allows you to position the Unit Frames."

-- Custom Formats
L.ValidTags = "Valid Tags"
Expand Down
29 changes: 18 additions & 11 deletions Menu/Menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ end
function menu:ShowLayoutTitle()
self.layoutTitleFrame:Show()
self:SetLayoutTitle()
self.editModeButton:Show()
end

function menu:HideLayoutTitle()
self.layoutTitleFrame:Hide()
self.editModeButton:Hide()
end

-------------------------------------------------
Expand Down Expand Up @@ -210,7 +212,7 @@ function menu:CreateMenu()

---@class CellCombatFrame
self.window = CUF:CreateFrame("CUF_Menu", optionsFrame, self.baseWidth, 300)
self.window:SetPoint("TOPRIGHT", CellLayoutsPreviewButton, "BOTTOMRIGHT", 0, -self.inset - 20)
self.window:SetPoint("TOPRIGHT", CellLayoutsPreviewButton, "BOTTOMRIGHT", 0, -self.inset)

-- mask
F:ApplyCombatProtectionToFrame(self.window)
Expand All @@ -230,16 +232,6 @@ function menu:CreateMenu()
titleFrame:SetHeight(title:GetStringHeight() + pad * 2)
titleFrame:SetWidth(title:GetStringWidth() + pad * 2)

local previewModeButton = Cell:CreateButton(titleFrame, L["Edit Mode"], "accent",
{ 80, 20 })
previewModeButton:SetPoint("BOTTOMLEFT", titleFrame, "BOTTOMRIGHT", -1, 0)
previewModeButton:SetScript("OnClick", function()
CUF.uFuncs:EditMode()
end)
previewModeButton:SetScript("OnHide", function()
CUF.uFuncs:EditMode(false)
end)

-- Title
local layoutTitleFrame = CUF:CreateFrame(nil, titleFrame, 160, 10, false, true)
layoutTitleFrame:SetPoint("BOTTOMLEFT", titleFrame, "TOPLEFT", 0, -1)
Expand Down Expand Up @@ -267,6 +259,21 @@ function menu:CreateMenu()

self:InitTabs()

local editModeButton = Cell:CreateButton(self.tabPane, L.EditMode, "accent",
{ 100, 25 })
editModeButton:SetPoint("TOPLEFT", self.tabPane, "BOTTOMLEFT", 0, 0)
CUF:SetTooltips(editModeButton, "ANCHOR_TOPLEFT", 0, 3, L.ToggleEditMode,
L.EditModeButtonTooltip)

editModeButton:SetScript("OnClick", function()
CUF.uFuncs:EditMode()
end)
editModeButton:SetScript("OnHide", function()
CUF.uFuncs:EditMode(false)
end)
self.editModeButton = editModeButton
self.editModeButton:Hide()

hooksecurefunc(optionsFrame, "Hide", function()
self:HideMenu()
end)
Expand Down

0 comments on commit 7afe13a

Please sign in to comment.