You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
5.8 KiB

4 years ago
local Details = _G.Details
local DetailsFramework = _G.DetailsFramework
local C_Timer = _G.C_Timer
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--dump table frame
4 years ago
function Details:DumpTable (t)
return Details:Dump (t)
end
function Details:DumpInline(t)
for key, value in pairs(t) do
print(key, value)
end
end
3 years ago
function Details:Dump (...)
4 years ago
if (not DetailsDumpFrame) then
3 years ago
DetailsDumpFrame = DetailsFramework:CreateSimplePanel(_G.UIParent)
DetailsDumpFrame:SetSize(700, 600)
DetailsDumpFrame:SetTitle("Details! Dump Table [|cFFFF3333Ready Only|r]")
4 years ago
local text_editor = DetailsFramework:NewSpecialLuaEditorEntry(DetailsDumpFrame, 680, 560, "Editbox", "$parentEntry", true)
3 years ago
text_editor:SetPoint("topleft", DetailsDumpFrame, "topleft", 10, -30)
4 years ago
3 years ago
text_editor.scroll:SetBackdrop(nil)
text_editor.editbox:SetBackdrop(nil)
text_editor:SetBackdrop(nil)
4 years ago
3 years ago
DetailsFramework:ReskinSlider(text_editor.scroll)
4 years ago
if (not text_editor.__background) then
3 years ago
text_editor.__background = text_editor:CreateTexture(nil, "background")
4 years ago
end
3 years ago
text_editor:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
text_editor:SetBackdropBorderColor(0, 0, 0, 1)
4 years ago
3 years ago
text_editor.__background:SetColorTexture(0.2317647, 0.2317647, 0.2317647)
text_editor.__background:SetVertexColor(0.27, 0.27, 0.27)
text_editor.__background:SetAlpha(0.8)
text_editor.__background:SetVertTile(true)
text_editor.__background:SetHorizTile(true)
4 years ago
text_editor.__background:SetAllPoints()
end
3 years ago
local t = select(1, ...)
if (not t) then
Details:Msg("nothing to show on Dump.")
return
else
if (type(t) == "table") then
local s = DetailsFramework.table.dump(t)
3 years ago
DetailsDumpFrame.Editbox:SetText(s)
else
t = {...}
local s = DetailsFramework.table.dump(t)
DetailsDumpFrame.Editbox:SetText(s)
3 years ago
end
end
4 years ago
DetailsDumpFrame:Show()
end
---------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--import export window
4 years ago
--show a window with a big text editor and 2 buttons: okay and cancel.
--cancel button always closes the window and okay calls the comfirm function passed in the argument
--default text is the text shown show the window is show()
function _detalhes:DumpString (text)
_detalhes:ShowImportWindow (text)
end
function _detalhes:ShowImportWindow (defaultText, confirmFunc, titleText)
if (not _G.DetailsExportWindow) then
3 years ago
local importWindow = DetailsFramework:CreateSimplePanel(_G.UIParent, 800, 610, "Details! Dump String", "DetailsExportWindow")
importWindow:SetFrameStrata("FULLSCREEN")
importWindow:SetPoint("center")
DetailsFramework:ApplyStandardBackdrop(importWindow, false, 1.2)
4 years ago
local importTextEditor = DetailsFramework:NewSpecialLuaEditorEntry(importWindow, 780, 540, "ImportEditor", "$parentEditor", true)
3 years ago
importTextEditor:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
importTextEditor:SetBackdropColor(.2, .2, .2, .5)
importTextEditor:SetBackdropBorderColor(0, 0, 0, 1)
importTextEditor:SetPoint("topleft", importWindow, "topleft", 10, -30)
4 years ago
3 years ago
importTextEditor.scroll:SetBackdrop(nil)
importTextEditor.editbox:SetBackdrop(nil)
importTextEditor:SetBackdrop(nil)
4 years ago
3 years ago
DetailsFramework:ReskinSlider(importTextEditor.scroll)
4 years ago
if (not importTextEditor.__background) then
3 years ago
importTextEditor.__background = importTextEditor:CreateTexture(nil, "background")
4 years ago
end
3 years ago
importTextEditor:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
importTextEditor:SetBackdropBorderColor(0, 0, 0, 1)
4 years ago
3 years ago
importTextEditor.__background:SetColorTexture(0.2317647, 0.2317647, 0.2317647)
importTextEditor.__background:SetVertexColor(0.27, 0.27, 0.27)
importTextEditor.__background:SetAlpha(0.8)
importTextEditor.__background:SetVertTile(true)
importTextEditor.__background:SetHorizTile(true)
4 years ago
importTextEditor.__background:SetAllPoints()
--import button
local onClickImportButton = function()
if (_G.DetailsExportWindow.ConfirmFunction) then
DetailsFramework:Dispatch (_G.DetailsExportWindow.ConfirmFunction, importTextEditor:GetText())
end
importWindow:Hide()
end
3 years ago
local okayButton = DetailsFramework:CreateButton(importTextEditor, onClickImportButton, 120, 20, "Okay", -1, nil, nil, nil, nil, nil, _detalhes.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"), _detalhes.gump:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) --localize-me
4 years ago
okayButton:SetIcon ([[Interface\BUTTONS\UI-Panel-BiggerButton-Up]], 20, 20, "overlay", {0.1, .9, 0.1, .9})
importTextEditor.OkayButton = okayButton
--cancel button
3 years ago
local cancelButton = DetailsFramework:CreateButton(importTextEditor, function() importWindow:Hide() end, 120, 20, "Cancel", -1, nil, nil, nil, nil, nil, _detalhes.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"), _detalhes.gump:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) --localize-me
4 years ago
cancelButton:SetIcon ([[Interface\BUTTONS\UI-Panel-MinimizeButton-Up]], 20, 20, "overlay", {0.1, .9, 0.1, .9})
3 years ago
okayButton:SetPoint("topright", importTextEditor, "bottomright", 0, -10)
cancelButton:SetPoint("right", okayButton, "left", -20, 0)
4 years ago
end
_G.DetailsExportWindow.ConfirmFunction = confirmFunc
3 years ago
_G.DetailsExportWindow.ImportEditor:SetText(defaultText or "")
4 years ago
_G.DetailsExportWindow:Show()
titleText = titleText or "Details! Dump String"
3 years ago
_G.DetailsExportWindow.Title:SetText(titleText)
4 years ago
3 years ago
C_Timer.After(.2, function()
_G.DetailsExportWindow.ImportEditor:SetFocus(true)
4 years ago
_G.DetailsExportWindow.ImportEditor.editbox:HighlightText (0)
end)
end