Update general layout of WeakAurasOptions (#8)

* from retail

* (fix) improve pixel snapping by reapplying borders

* update spinbox texture

* add icons, loaded, standby, unloaded behavior from retail

* further use of ported inputbox and cleanup to ported frames

* move templates into WeakAuras and upversion
This commit is contained in:
NoM0Re
2025-01-04 19:33:14 +01:00
committed by GitHub
parent a62d8f352e
commit 86e98d6bcf
47 changed files with 1582 additions and 679 deletions
+24 -68
View File
@@ -151,17 +151,11 @@ end]=]
local function ConstructTextEditor(frame)
local group = AceGUI:Create("WeakAurasInlineGroup")
group.frame:SetParent(frame)
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -63);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 46);
group.frame:Hide()
group:SetLayout("flow")
local title = AceGUI:Create("Label")
title:SetFontObject(GameFontNormalHuge)
title:SetFullWidth(true)
title:SetText(L["Code Editor"])
group:AddChild(title)
local editor = AceGUI:Create("MultiLineEditBox")
editor:SetFullWidth(true)
editor:SetFullHeight(true)
@@ -224,28 +218,12 @@ local function ConstructTextEditor(frame)
settings_frame:RegisterForClicks("LeftButtonUp")
local helpButton = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate")
helpButton:SetPoint("BOTTOMLEFT", 12, -24)
helpButton:SetPoint("BOTTOMLEFT", 0, -24)
helpButton:SetFrameLevel(cancel:GetFrameLevel() + 1)
helpButton:SetHeight(20)
helpButton:SetWidth(100)
helpButton:SetText(L["Help"])
local urlText = CreateFrame("editbox", nil, group.frame)
urlText:SetFrameLevel(cancel:GetFrameLevel() + 1)
urlText:SetFont(STANDARD_TEXT_FONT, 12)
urlText:EnableMouse(true)
urlText:SetAutoFocus(false)
urlText:SetCountInvisibleLetters(false)
urlText:Hide()
local urlCopyLabel = urlText:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall")
urlCopyLabel:SetPoint("BOTTOMLEFT", group.frame, "BOTTOMLEFT", 12, -20)
urlCopyLabel:SetText(L["Press Ctrl+C to copy"])
urlCopyLabel:Hide()
urlText:SetPoint("TOPLEFT", urlCopyLabel, "TOPRIGHT", 12, 0)
urlText:SetPoint("RIGHT", settings_frame, "LEFT")
local dropdown = CreateFrame("Frame", "SettingsMenuFrame", settings_frame, "UIDropDownMenuTemplate")
local function settings_dropdown_initialize(frame, level, menu)
@@ -317,7 +295,7 @@ local function ConstructTextEditor(frame)
-- Make Snippets button (top right, near the line number)
local snippetsButton = CreateFrame("Button", "WASnippetsButton", group.frame, "UIPanelButtonTemplate")
snippetsButton:SetPoint("BOTTOMRIGHT", editor.frame, "TOPRIGHT", 0, -15)
snippetsButton:SetPoint("BOTTOMRIGHT", editor.frame, "TOPRIGHT", -20, -10)
snippetsButton:SetFrameLevel(group.frame:GetFrameLevel() + 2)
snippetsButton:SetHeight(20)
snippetsButton:SetWidth(100)
@@ -413,10 +391,12 @@ local function ConstructTextEditor(frame)
end
-- Make sidebar for snippets
local snippetsFrame = CreateFrame("FRAME", "WeakAurasSnippets", group.frame)
local snippetsFrame = CreateFrame("Frame", "WeakAurasSnippets", group.frame, "WA_PortraitFrameTemplate")
snippetsFrame:HidePortrait()
snippetsFrame:SetPoint("TOPLEFT", group.frame, "TOPRIGHT", 20, 0)
snippetsFrame:SetPoint("BOTTOMLEFT", group.frame, "BOTTOMRIGHT", 20, 0)
snippetsFrame:SetWidth(250)
--[[
snippetsFrame:SetBackdrop(
{
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
@@ -428,11 +408,11 @@ local function ConstructTextEditor(frame)
}
)
snippetsFrame:SetBackdropColor(0, 0, 0, 1)
]]
-- Add button to save new snippet
local AddSnippetButton = CreateFrame("Button", nil, snippetsFrame, "UIPanelButtonTemplate")
AddSnippetButton:SetPoint("TOPLEFT", snippetsFrame, "TOPLEFT", 13, -10)
AddSnippetButton:SetPoint("TOPRIGHT", snippetsFrame, "TOPRIGHT", -13, -10)
AddSnippetButton:SetPoint("TOPLEFT", snippetsFrame, "TOPLEFT", 13, -25)
AddSnippetButton:SetPoint("TOPRIGHT", snippetsFrame, "TOPRIGHT", -13, -25)
AddSnippetButton:SetHeight(20)
AddSnippetButton:SetText(L["Add Snippet"])
AddSnippetButton:RegisterForClicks("LeftButtonUp")
@@ -444,7 +424,7 @@ local function ConstructTextEditor(frame)
snippetsScrollContainer:SetFullHeight(true)
snippetsScrollContainer:SetLayout("Fill")
snippetsScrollContainer.frame:SetParent(snippetsFrame)
snippetsScrollContainer.frame:SetPoint("TOPLEFT", snippetsFrame, "TOPLEFT", 17, -35)
snippetsScrollContainer.frame:SetPoint("TOPLEFT", snippetsFrame, "TOPLEFT", 17, -50)
snippetsScrollContainer.frame:SetPoint("BOTTOMRIGHT", snippetsFrame, "BOTTOMRIGHT", -10, 10)
local snippetsScroll = AceGUI:Create("ScrollFrame")
snippetsScroll:SetLayout("List")
@@ -535,46 +515,26 @@ local function ConstructTextEditor(frame)
editorError:SetPoint("LEFT", helpButton, "RIGHT", 0, 4)
editorError:SetPoint("RIGHT", settings_frame, "LEFT")
local editorLine = CreateFrame("Editbox", nil, group.frame)
local editorLine = CreateFrame("EditBox", nil, group.frame, "WA_InputBoxTemplate")
-- Set script on enter pressed..
editorLine:SetPoint("BOTTOMRIGHT", editor.frame, "TOPRIGHT", -100, -15)
editorLine:SetPoint("RIGHT", snippetsButton, "LEFT", -10, 0)
editorLine:SetFont(STANDARD_TEXT_FONT, 10)
editorLine:SetJustifyH("RIGHT")
editorLine:SetWidth(80)
editorLine:SetWidth(30)
editorLine:SetHeight(20)
editorLine:SetNumeric(true)
editorLine:SetTextInsets(10, 10, 0, 0)
editorLine:SetTextInsets(0, 5, 0, 0)
editorLine:SetAutoFocus(false)
urlText:SetScript(
"OnChar",
function(self)
self:SetText(group.url)
self:HighlightText()
end
)
urlText:SetScript(
"OnEscapePressed",
function()
urlText:ClearFocus()
urlText:Hide()
urlCopyLabel:Hide()
helpButton:Show()
editor:SetFocus()
end
)
local editorLineText = group.frame:CreateFontString(nil, "OVERLAY")
editorLineText:SetFont(STANDARD_TEXT_FONT, 10)
editorLineText:SetTextColor(1, 1, 1)
editorLineText:SetText(L["Line"])
editorLineText:SetPoint("RIGHT", editorLine, "LEFT", -8, 0)
helpButton:SetScript(
"OnClick",
function()
urlText:Show()
urlText:SetFocus()
urlText:HighlightText()
urlCopyLabel:Show()
helpButton:Hide()
editorError:Hide()
end
)
helpButton:SetScript("OnClick", function()
OptionsPrivate.ToggleTip(helpButton, group.url, L["Help"], "")
end)
local oldOnCursorChanged = editor.editBox:GetScript("OnCursorChanged")
editor.editBox:SetScript(
@@ -616,9 +576,6 @@ local function ConstructTextEditor(frame)
self.reloadOptions = reloadOptions
self.setOnParent = setOnParent
self.url = url
urlText:SetText(url or "")
urlText:Hide()
urlCopyLabel:Hide()
if url then
helpButton:Show()
else
@@ -668,8 +625,6 @@ local function ConstructTextEditor(frame)
end
end
if errorString then
urlText:Hide()
urlCopyLabel:Hide()
if self.url then
helpButton:Show()
end
@@ -727,6 +682,7 @@ local function ConstructTextEditor(frame)
function group.CancelClose(self)
editor.editBox:SetScript("OnTextChanged", self.oldOnTextChanged)
editor:ClearFocus()
frame:HideTip()
frame.window = "default"
frame:UpdateFrameVisible()
end