--[[
	console/console.lua
	fangli :d | (STEAM_0:0:19962914)
	===DStream===
]]

print("fuck")


local pnlConsole = vgui.RegisterFile( "console_console.lua" )

local PANEL = {}



function PANEL:Init()

	self:SetTitle( "Console 2.0" )
	self:SetSizable( true )
	self:SetDeleteOnClose( false )
	
	local tabs = self:Add( "DPropertySheet" )
	tabs:Dock( FILL )
	
	self.Console = tabs:Add( pnlConsole )
	tabs:AddSheet( "Console", self.Console )
	
	self:SetSize( ScrW() * 0.6, ScrH() * 0.7 )
	self:SetPos( ScrW() * 0.4 - 50, 50 )
	
	self:SetKeyboardInputEnabled( true );
	self:SetMouseInputEnabled( true );

end

function PANEL:OnVisible()
	self:MakePopup()
	self.Console:OnVisible()
end

function PANEL:Print( str, r, g, b, a )
	self.Console:Print( str, r, g, b, a )
end

function PANEL:Clear()
	self.Console:Clear()
end

function PANEL:OnLuaError( realm, err, stck )
	self.Console:OnLuaError( realm, err, stck)
end


vgui.Register( "ConsoleAdv", PANEL, "DFrame" )

Console = vgui.Create( "ConsoleAdv" );
Console:SetVisible( false )

function ConsolePrint( msg, r, g, b, a )
	Console:Print( msg, r, g, b, a )
end


function ShowConsole( b )

	CloseDermaMenus()

	Console:SetVisible( b )
	if ( b ) then
		Console:OnVisible()
	end	
	
end

function ConsoleVisible()
	return Console:IsVisible()
end

function ConsoleClear()
	return Console:Clear()
end

function LuaError( realm, err, stck )
	return Console:OnLuaError( realm, err, stck )
end

function GameUI_Hidden()
	CloseDermaMenus();
end

function GameUI_Activated()
	CloseDermaMenus();
end