function widget:GetInfo()
  return {
	name="UI DevTool",
	desc="Static UI dev. tool.",
	author="Argh",
	date="April 22nd, 2009",
	license="Public Domain, or the least-restrictive rights in your country of residence",
	layer=-5,
	enabled=false
	}
end

local glGetViewSizes = gl.GetViewSizes
local topcornerX, topcornerY, botcornerX, botcornerY = 0,0,0,0
local name, myName
local viewX, viewY

function widget:ShutDown()
	widgetHandler:RemoveWidget()
end

function widget:AddConsoleLine(msg,priority)
	name = tostring(msg)
	if myName == nil then myName = name end
	if string.find(name,"name") then 
		myName = name
	end

	if string.find(name,"clear") then 
		topcornerX, topcornerY, botcornerX, botcornerY = 0,0,0,0
		Spring.Echo("Erasing corner points")
	end
end


function widget:MousePress(x, y, button)
	viewX,viewY = glGetViewSizes()
	if topcornerX == 0 and topcornerY == 0 then
		topcornerX = x / viewX
		topcornerY = y / viewY
		Spring.Echo("First point recorded.")
	else
		if botcornerX == 0 and botcornerY == 0 then
			botcornerX = x / viewX
			botcornerY = y / viewY
			Spring.Echo("Second point recorded.")
		end
	end

	if topcornerX ~= 0 and topcornerY ~= 0 and botcornerX ~= 0 and botcornerY ~= 0 then
		Spring.Echo("box for "..myName.." is (xMin1 = "..topcornerX.."* viewX","yMin1 = "..topcornerY.."* viewY","xMax1 = "..botcornerX.."* viewX","yMax1 = "..botcornerY.."* viewY)")
		
	end
end

function widget:DrawScreenEffects()
	if topcornerX ~= 0 and topcornerY ~= 0 and botcornerX ~= 0 and botcornerY ~= 0 then
		gl.Color(1,1,0,0.5)
		gl.Rect(topcornerX * viewX, topcornerY * viewY, botcornerX * viewX, botcornerY * viewY)
	end
end