--import config.lua
--import utils.lua
--import uiLib.lua
--import textEditor.lua

--import userConfig.lua

DebugLog = {}

function start()
	DebugLog.textEditor = TextEditor:new()
	
	DebugLog.textEditor:init(TextEditor.LOG_MODE)
	DebugLog.textEditor.wrapLines = true

	DebugLog.textEditor:setDepth(UILib.uiDepth_overViews)

	invokeProgram(MAIN_PROGRAMID, "registerShortcut", {desc = "copy text to clipboard", key = KEY_C, modifier = KEY_LEFT_CONTROL, callback = "ctrlCPressed", programId = 8})

	local programId = getProgramId()
	invokeProgram(MAIN_PROGRAMID, "setViewTitle", programId, "debug log")
end

function ctrlCPressed()
	local selectedText = DebugLog.textEditor:getSelectedText()
	
	setClipboardText(selectedText)
end

function sendText(text)
	DebugLog.textEditor:setText(text)
end

function logMessage(text)
	DebugLog.textEditor:addText(text)
end

function update()
	DebugLog.textEditor:update()
end
