Files
ascension-char-exporter/AscensionExporter/UI/ExportFrame.lua
T
florian.berthold ccbc4f825c Remove AscensionTalentMapper.lua and related mappings
- Deleted `AscensionTalentMapper.lua` as its functionality is no longer required.
- Removed the auto-generated mapping table and associated resources for all supported classes.
2025-12-08 19:59:07 +01:00

103 lines
3.7 KiB
Lua

-- AscensionExporter - Export UI
local function CreateOrGetFrame()
if AscensionExporterFrame then return AscensionExporterFrame end
local frame = CreateFrame("Frame", "AscensionExporterFrame", UIParent, "DialogBoxFrame")
frame:SetSize(700, 500)
frame:SetPoint("CENTER")
frame:SetMovable(true)
frame:EnableMouse(true)
frame:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", frame.StartMoving)
frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
-- Title text
local title = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
title:SetPoint("TOP", 0, -8)
frame.title = title
-- Action buttons row
local function makeBtn(label, x, click)
local btn = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
btn:SetSize(90, 22)
btn:SetPoint("TOPLEFT", 16 + x, -36)
btn:SetText(label)
btn:SetScript("OnClick", click)
return btn
end
local x = 0
makeBtn("All", x, function()
if AscensionExporter then AscensionExporter:Export("all") end
end)
x = x + 95
makeBtn("Talents", x, function()
if AscensionExporter then AscensionExporter:Export("talents") end
end)
x = x + 95
makeBtn("Gear", x, function()
if AscensionExporter then AscensionExporter:Export("gear") end
end)
x = x + 95
makeBtn("Enchants", x, function()
if AscensionExporter then AscensionExporter:Export("enchants") end
end)
x = x + 95
makeBtn("MD Gear", x, function()
if AscensionExporter and AscensionExporter.GenerateMarkdownGear then
local md = AscensionExporter:GenerateMarkdownGear() or ""
if AscensionExporter.ShowExport then
AscensionExporter:ShowExport(md, "Ascension Export - Markdown Gear - Copy All (Ctrl+C)")
else
AscensionExporter_ShowExportFrame(md, "Ascension Export - Markdown Gear - Copy All (Ctrl+C)")
end
end
end)
x = x + 95
makeBtn("MD Enchants", x, function()
if AscensionExporter and AscensionExporter.GenerateMarkdownEnchants then
local md = AscensionExporter:GenerateMarkdownEnchants() or ""
if AscensionExporter.ShowExport then
AscensionExporter:ShowExport(md, "Ascension Export - Markdown Enchants - Copy All (Ctrl+C)")
else
AscensionExporter_ShowExportFrame(md, "Ascension Export - Markdown Enchants - Copy All (Ctrl+C)")
end
end
end)
-- ScrollFrame + EditBox
local scrollFrame = CreateFrame("ScrollFrame", "AscensionExporterScrollFrame", frame, "UIPanelScrollFrameTemplate")
scrollFrame:SetPoint("TOPLEFT", 16, -64)
scrollFrame:SetPoint("BOTTOMRIGHT", -32, 16)
local editBox = CreateFrame("EditBox", "AscensionExporterEditBox", scrollFrame)
editBox:SetMultiLine(true)
editBox:SetAutoFocus(true)
editBox:SetFontObject(ChatFontNormal)
editBox:SetWidth(640)
editBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
editBox:SetScript("OnEditFocusGained", function(self) self:HighlightText() end)
scrollFrame:SetScrollChild(editBox)
frame.scrollFrame = scrollFrame
frame.editBox = editBox
-- Close button
local close = CreateFrame("Button", nil, frame, "UIPanelCloseButton")
close:SetPoint("TOPRIGHT", -4, -4)
AscensionExporterFrame = frame
return frame
end
function AscensionExporter_ShowExportFrame(text, titleText)
local f = CreateOrGetFrame()
f:Show()
f.editBox:SetText(text or "")
f.title:SetText(titleText or "Ascension Export - Copy All (Ctrl+C)")
f.editBox:HighlightText()
f.editBox:SetFocus()
end