-- CoaExporter - Export UI local function CreateOrGetFrame() if CoaExporterFrame then return CoaExporterFrame end local frame = CreateFrame("Frame", "CoaExporterFrame", UIParent, "DialogBoxFrame") frame:SetSize(700, 520) frame:SetPoint("CENTER") frame:SetMovable(true) frame:EnableMouse(true) frame:RegisterForDrag("LeftButton") frame:SetScript("OnDragStart", frame.StartMoving) frame:SetScript("OnDragStop", frame.StopMovingOrSizing) 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 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 local scrollFrame = CreateFrame("ScrollFrame", "CoaExporterScrollFrame", frame, "UIPanelScrollFrameTemplate") scrollFrame:SetPoint("TOPLEFT", 16, -88) scrollFrame:SetPoint("BOTTOMRIGHT", -32, 16) local editBox = CreateFrame("EditBox", "CoaExporterEditBox", 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 local close = CreateFrame("Button", nil, frame, "UIPanelCloseButton") close:SetPoint("TOPRIGHT", -4, -4) CoaExporterFrame = frame return frame end function CoaExporter_ShowExportFrame(text, titleText) local f = CreateOrGetFrame() f:Show() f.editBox:SetText(text or "") f.title:SetText(titleText or "CoaExporter (Ctrl+C)") f.editBox:HighlightText() f.editBox:SetFocus() end