UI: left-side nav with grouped sections + Reload UI button
Replaces the cramped two-row button strip with a proper sidebar layout: Character Markdown Catalog Scrolls Tools - All - MD Gear - Skills - Scan - Reload UI - Talents - MD Enchants - Talents - Status - Debug - Gear - MD Full - All - Help - Enchants Section headers in gold; full-width buttons stacked vertically. The new "Reload UI" button calls ReloadUI() so guildies can flush a catalog dump to disk without leaving the export window. Debug and Help buttons route through SlashCmdList["COAE"] so the UI and slash share one code path. Frame is 720x500 (was 700x520); the right-side copy-out edit box keeps its existing CoaExporter_ShowExportFrame() entry point so Core.lua is unchanged.
This commit is contained in:
+125
-81
@@ -1,10 +1,92 @@
|
||||
-- CoaExporter - Export UI
|
||||
--
|
||||
-- Layout: title bar on top, left-side nav with grouped buttons, large
|
||||
-- copy-out edit box on the right. Nav sections wrap the existing slash
|
||||
-- dispatcher so the button paths and the slash paths run the same code.
|
||||
|
||||
local SIDEBAR_W = 160
|
||||
local BUTTON_H = 22
|
||||
local SECTION_GAP = 8
|
||||
|
||||
local function ce()
|
||||
return _G.CoaExporter
|
||||
end
|
||||
|
||||
local function showExport(text, title)
|
||||
if _G.CoaExporter_ShowExportFrame then
|
||||
_G.CoaExporter_ShowExportFrame(text, title)
|
||||
end
|
||||
end
|
||||
|
||||
local function runSlash(args)
|
||||
local fn = SlashCmdList and SlashCmdList["COAE"]
|
||||
if fn then fn(args) end
|
||||
end
|
||||
|
||||
local function buildSections()
|
||||
return {
|
||||
{ title = "Character", items = {
|
||||
{ "All", function() local ae = ce(); if ae then ae:Export("all") end end },
|
||||
{ "Talents", function() local ae = ce(); if ae then ae:Export("talents") end end },
|
||||
{ "Gear", function() local ae = ce(); if ae then ae:Export("gear") end end },
|
||||
{ "Enchants", function() local ae = ce(); if ae then ae:Export("enchants") end end },
|
||||
}},
|
||||
{ title = "Markdown (Wiki)", items = {
|
||||
{ "MD Gear", function()
|
||||
local ae = ce()
|
||||
if ae and ae.GenerateMarkdownGear then
|
||||
showExport(ae:GenerateMarkdownGear() or "", "CoaExporter - Markdown Gear (Ctrl+C)")
|
||||
end
|
||||
end },
|
||||
{ "MD Enchants", function()
|
||||
local ae = ce()
|
||||
if ae and ae.GenerateMarkdownEnchants then
|
||||
showExport(ae:GenerateMarkdownEnchants() or "", "CoaExporter - Markdown Enchants (Ctrl+C)")
|
||||
end
|
||||
end },
|
||||
{ "MD Full", function()
|
||||
local ae = ce()
|
||||
if ae and ae.GenerateMarkdownFull then
|
||||
showExport(ae:GenerateMarkdownFull() or "", "CoaExporter - Wiki Markdown (Ctrl+C)")
|
||||
end
|
||||
end },
|
||||
}},
|
||||
{ title = "Catalog", items = {
|
||||
{ "Skills", function()
|
||||
if CoaExporter and CoaExporter.Catalog then CoaExporter.Catalog.Run("skills") end
|
||||
end },
|
||||
{ "Talents", function()
|
||||
if CoaExporter and CoaExporter.Catalog then CoaExporter.Catalog.Run("talents") end
|
||||
end },
|
||||
{ "All", function()
|
||||
if CoaExporter and CoaExporter.Catalog then CoaExporter.Catalog.Run("all") end
|
||||
end },
|
||||
}},
|
||||
{ title = "Scrolls", items = {
|
||||
{ "Scan", function()
|
||||
if CoaExporter and CoaExporter.ScrollsStartScan then
|
||||
CoaExporter.ScrollsStartScan(function(stats)
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format(
|
||||
"CoaExporter scrolls: scan complete - %d resolved, %d unresolved",
|
||||
stats.total - stats.unresolved, stats.unresolved))
|
||||
end)
|
||||
end
|
||||
end },
|
||||
{ "Status", function() runSlash("scrolls status") end },
|
||||
}},
|
||||
{ title = "Tools", items = {
|
||||
{ "Reload UI", function() ReloadUI() end },
|
||||
{ "Debug", function() runSlash("debug") end },
|
||||
{ "Help", function() runSlash("help") end },
|
||||
}},
|
||||
}
|
||||
end
|
||||
|
||||
local function CreateOrGetFrame()
|
||||
if CoaExporterFrame then return CoaExporterFrame end
|
||||
|
||||
local frame = CreateFrame("Frame", "CoaExporterFrame", UIParent, "DialogBoxFrame")
|
||||
frame:SetSize(700, 520)
|
||||
frame:SetSize(720, 500)
|
||||
frame:SetPoint("CENTER")
|
||||
frame:SetMovable(true)
|
||||
frame:EnableMouse(true)
|
||||
@@ -12,95 +94,60 @@ local function CreateOrGetFrame()
|
||||
frame:SetScript("OnDragStart", frame.StartMoving)
|
||||
frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
|
||||
|
||||
-- Title
|
||||
local title = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
|
||||
title:SetPoint("TOP", 0, -8)
|
||||
frame.title = title
|
||||
|
||||
-- Two rows of buttons: per-character on top, catalog on bottom.
|
||||
local function makeBtn(label, x, y, width, click)
|
||||
local btn = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
|
||||
btn:SetSize(width or 90, 22)
|
||||
btn:SetPoint("TOPLEFT", 16 + x, y)
|
||||
btn:SetText(label)
|
||||
btn:SetScript("OnClick", click)
|
||||
return btn
|
||||
-- Close button (top-right)
|
||||
local close = CreateFrame("Button", nil, frame, "UIPanelCloseButton")
|
||||
close:SetPoint("TOPRIGHT", -4, -4)
|
||||
|
||||
-- Sidebar background (subtle backdrop so the nav reads as a panel)
|
||||
local nav = CreateFrame("Frame", nil, frame)
|
||||
nav:SetPoint("TOPLEFT", 12, -32)
|
||||
nav:SetPoint("BOTTOMLEFT", 12, 16)
|
||||
nav:SetWidth(SIDEBAR_W)
|
||||
nav:SetBackdrop({
|
||||
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
tile = true, tileSize = 16, edgeSize = 12,
|
||||
insets = { left = 3, right = 3, top = 3, bottom = 3 },
|
||||
})
|
||||
if nav.SetBackdropColor then nav:SetBackdropColor(0, 0, 0, 0.5) end
|
||||
|
||||
-- Build nav contents
|
||||
local sections = buildSections()
|
||||
local y = -10
|
||||
for _, sec in ipairs(sections) do
|
||||
local hdr = nav:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
|
||||
hdr:SetPoint("TOPLEFT", nav, "TOPLEFT", 10, y)
|
||||
hdr:SetText(sec.title)
|
||||
hdr:SetTextColor(1, 0.82, 0)
|
||||
y = y - 16
|
||||
|
||||
for _, item in ipairs(sec.items) do
|
||||
local label, click = item[1], item[2]
|
||||
local btn = CreateFrame("Button", nil, nav, "UIPanelButtonTemplate")
|
||||
btn:SetSize(SIDEBAR_W - 16, BUTTON_H)
|
||||
btn:SetPoint("TOPLEFT", nav, "TOPLEFT", 8, y)
|
||||
btn:SetText(label)
|
||||
btn:SetScript("OnClick", click)
|
||||
y = y - (BUTTON_H + 2)
|
||||
end
|
||||
y = y - SECTION_GAP
|
||||
end
|
||||
|
||||
local function ce()
|
||||
return _G.CoaExporter
|
||||
end
|
||||
|
||||
-- Row 1: character export
|
||||
local x = 0
|
||||
makeBtn("All", x, -32, 60, function() if ce() then ce():Export("all") end end)
|
||||
x = x + 65
|
||||
makeBtn("Talents", x, -32, 70, function() if ce() then ce():Export("talents") end end)
|
||||
x = x + 75
|
||||
makeBtn("Gear", x, -32, 60, function() if ce() then ce():Export("gear") end end)
|
||||
x = x + 65
|
||||
makeBtn("Enchants", x, -32, 80, function() if ce() then ce():Export("enchants") end end)
|
||||
x = x + 85
|
||||
makeBtn("MD Gear", x, -32, 75, function()
|
||||
local ae = ce()
|
||||
if ae and ae.GenerateMarkdownGear then
|
||||
ae:ShowExport(ae:GenerateMarkdownGear() or "", "CoaExporter - Markdown Gear (Ctrl+C)")
|
||||
end
|
||||
end)
|
||||
x = x + 80
|
||||
makeBtn("MD Enchants", x, -32, 90, function()
|
||||
local ae = ce()
|
||||
if ae and ae.GenerateMarkdownEnchants then
|
||||
ae:ShowExport(ae:GenerateMarkdownEnchants() or "", "CoaExporter - Markdown Enchants (Ctrl+C)")
|
||||
end
|
||||
end)
|
||||
x = x + 95
|
||||
makeBtn("MD Full", x, -32, 75, function()
|
||||
local ae = ce()
|
||||
if ae and ae.GenerateMarkdownFull then
|
||||
ae:ShowExport(ae:GenerateMarkdownFull() or "", "CoaExporter - Wiki Markdown (Ctrl+C)")
|
||||
end
|
||||
end)
|
||||
|
||||
-- Row 2: catalog (game data) export
|
||||
x = 0
|
||||
makeBtn("Catalog: Skills", x, -58, 110, function()
|
||||
if CoaExporter and CoaExporter.Catalog then
|
||||
CoaExporter.Catalog.Run("skills")
|
||||
end
|
||||
end)
|
||||
x = x + 115
|
||||
makeBtn("Catalog: Talents", x, -58, 120, function()
|
||||
if CoaExporter and CoaExporter.Catalog then
|
||||
CoaExporter.Catalog.Run("talents")
|
||||
end
|
||||
end)
|
||||
x = x + 125
|
||||
makeBtn("Catalog: All", x, -58, 100, function()
|
||||
if CoaExporter and CoaExporter.Catalog then
|
||||
CoaExporter.Catalog.Run("all")
|
||||
end
|
||||
end)
|
||||
x = x + 105
|
||||
makeBtn("Scrolls: Scan", x, -58, 100, function()
|
||||
if CoaExporter and CoaExporter.ScrollsStartScan then
|
||||
CoaExporter.ScrollsStartScan(function(stats)
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format(
|
||||
"CoaExporter scrolls: scan complete - %d resolved, %d unresolved",
|
||||
stats.total - stats.unresolved, stats.unresolved))
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
-- ScrollFrame + EditBox
|
||||
-- Right pane: scrollable copy-out edit box
|
||||
local scrollFrame = CreateFrame("ScrollFrame", "CoaExporterScrollFrame", frame, "UIPanelScrollFrameTemplate")
|
||||
scrollFrame:SetPoint("TOPLEFT", 16, -88)
|
||||
scrollFrame:SetPoint("BOTTOMRIGHT", -32, 16)
|
||||
scrollFrame:SetPoint("TOPLEFT", frame, "TOPLEFT", 12 + SIDEBAR_W + 12, -32)
|
||||
scrollFrame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -32, 16)
|
||||
|
||||
local editBox = CreateFrame("EditBox", "CoaExporterEditBox", scrollFrame)
|
||||
editBox:SetMultiLine(true)
|
||||
editBox:SetAutoFocus(true)
|
||||
editBox:SetFontObject(ChatFontNormal)
|
||||
editBox:SetWidth(640)
|
||||
editBox:SetWidth(720 - (12 + SIDEBAR_W + 12) - 32 - 20)
|
||||
editBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
|
||||
editBox:SetScript("OnEditFocusGained", function(self) self:HighlightText() end)
|
||||
scrollFrame:SetScrollChild(editBox)
|
||||
@@ -108,9 +155,6 @@ local function CreateOrGetFrame()
|
||||
frame.scrollFrame = scrollFrame
|
||||
frame.editBox = editBox
|
||||
|
||||
local close = CreateFrame("Button", nil, frame, "UIPanelCloseButton")
|
||||
close:SetPoint("TOPRIGHT", -4, -4)
|
||||
|
||||
CoaExporterFrame = frame
|
||||
return frame
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user