From 7d772bb6ca1a0a7627dc941947930e472e449413 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Thu, 15 Jul 2010 02:22:52 -0400 Subject: [PATCH] Moved text-dump code into core.lua from Panel.lua --- Interface/Panel.lua | 68 -------------------------------------------------- core.lua | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 68 deletions(-) diff --git a/Interface/Panel.lua b/Interface/Panel.lua index f550d37..61810e8 100644 --- a/Interface/Panel.lua +++ b/Interface/Panel.lua @@ -1021,71 +1021,3 @@ function private.InitializeFrame() private.InitializeFrame = nil end - --------------------------------------------------------------------------------- ----- Creates a new frame with the contents of a text dump so you can copy and paste ---- Code borrowed from Antiarc (Chatter) with permission ---- @name AckisRecipeList:DisplayTextDump ---- @param RecipeDB The database (array) which you wish read data from. ---- @param profession Which profession are you displaying data for ---- @param text The text to be dumped --------------------------------------------------------------------------------- -do - local copy_frame = CreateFrame("Frame", "ARLCopyFrame", UIParent) - copy_frame:SetBackdrop({ - bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], - edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], - tile = true, - tileSize = 16, - edgeSize = 16, - insets = { - left = 3, - right = 3, - top = 5, - bottom = 3 - } - }) - copy_frame:SetBackdropColor(0, 0, 0, 1) - copy_frame:SetWidth(750) - copy_frame:SetHeight(400) - copy_frame:SetPoint("CENTER", UIParent, "CENTER") - copy_frame:SetFrameStrata("DIALOG") - - table.insert(UISpecialFrames, "ARLCopyFrame") - - local scrollArea = CreateFrame("ScrollFrame", "ARLCopyScroll", copy_frame, "UIPanelScrollFrameTemplate") - scrollArea:SetPoint("TOPLEFT", copy_frame, "TOPLEFT", 8, -30) - scrollArea:SetPoint("BOTTOMRIGHT", copy_frame, "BOTTOMRIGHT", -30, 8) - - local edit_box = CreateFrame("EditBox", nil, copy_frame) - edit_box:SetMultiLine(true) - edit_box:SetMaxLetters(0) - edit_box:EnableMouse(true) - edit_box:SetAutoFocus(true) - edit_box:SetFontObject(ChatFontNormal) - edit_box:SetWidth(650) - edit_box:SetHeight(270) - edit_box:SetScript("OnEscapePressed", - function() - copy_frame:Hide() - end) - edit_box:HighlightText(0) - - scrollArea:SetScrollChild(edit_box) - - local close = CreateFrame("Button", nil, copy_frame, "UIPanelCloseButton") - close:SetPoint("TOPRIGHT", copy_frame, "TOPRIGHT") - - copy_frame:Hide() - - function addon:DisplayTextDump(RecipeDB, profession, text) - local text = (not RecipeDB and not profession) and text or self:GetTextDump(profession) - - if text ~= "" then - edit_box:SetText(text) - edit_box:HighlightText(0) - edit_box:SetCursorPosition(1) - copy_frame:Show() - end - end -end -- do diff --git a/core.lua b/core.lua index 5eeb8d2..fe10690 100644 --- a/core.lua +++ b/core.lua @@ -1718,6 +1718,75 @@ end ------------------------------------------------------------------------------- -- Text dumping functions ------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +---- Creates a new frame with the contents of a text dump so you can copy and paste +--- Code borrowed from Antiarc (Chatter) with permission +--- @name AckisRecipeList:DisplayTextDump +--- @param RecipeDB The database (array) which you wish read data from. +--- @param profession Which profession are you displaying data for +--- @param text The text to be dumped +-------------------------------------------------------------------------------- +do + local copy_frame = CreateFrame("Frame", "ARLCopyFrame", UIParent) + copy_frame:SetBackdrop({ + bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], + edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], + tile = true, + tileSize = 16, + edgeSize = 16, + insets = { + left = 3, + right = 3, + top = 5, + bottom = 3 + } + }) + copy_frame:SetBackdropColor(0, 0, 0, 1) + copy_frame:SetWidth(750) + copy_frame:SetHeight(400) + copy_frame:SetPoint("CENTER", UIParent, "CENTER") + copy_frame:SetFrameStrata("DIALOG") + + table.insert(UISpecialFrames, "ARLCopyFrame") + + local scrollArea = CreateFrame("ScrollFrame", "ARLCopyScroll", copy_frame, "UIPanelScrollFrameTemplate") + scrollArea:SetPoint("TOPLEFT", copy_frame, "TOPLEFT", 8, -30) + scrollArea:SetPoint("BOTTOMRIGHT", copy_frame, "BOTTOMRIGHT", -30, 8) + + local edit_box = CreateFrame("EditBox", nil, copy_frame) + edit_box:SetMultiLine(true) + edit_box:SetMaxLetters(0) + edit_box:EnableMouse(true) + edit_box:SetAutoFocus(true) + edit_box:SetFontObject(ChatFontNormal) + edit_box:SetWidth(650) + edit_box:SetHeight(270) + edit_box:SetScript("OnEscapePressed", + function() + copy_frame:Hide() + end) + edit_box:HighlightText(0) + + scrollArea:SetScrollChild(edit_box) + + local close = CreateFrame("Button", nil, copy_frame, "UIPanelCloseButton") + close:SetPoint("TOPRIGHT", copy_frame, "TOPRIGHT") + + copy_frame:Hide() + + function addon:DisplayTextDump(RecipeDB, profession, text) + local text = (not RecipeDB and not profession) and text or self:GetTextDump(profession) + + if text ~= "" then + edit_box:SetText(text) + edit_box:HighlightText(0) + edit_box:SetCursorPosition(1) + copy_frame:Show() + end + end +end -- do + do ------------------------------------------------------------------------------- -- Provides a string of comma separated values for all recipe information -- 1.7.9.5