--Mini explorador

limit1=1
limit2=12
function tipe(number,number2)
if workDir[number].directory then 
	this="Carpeta"
elseif files.ext(workDir[number].name)!="satd" then 
	this="Archivo" 
else 
	this="Acceso Directo" 
end
if number2==1 then
screen.print(350,number*17+63-limit1*17,this,0.6,negro,0)
else
screen.print(350,number*17+63-limit1*17,this,0.6,blanco,0)
end
end


	
function mini_explorador(peticion)
workDir=files.list("ms0:/")
posicion=1
liberar(5)
limit1=1
limit2=12

while true do
controls.read()
img_escritorio[fondo_escritorio]:blend(0,0,220)
fondo2:blit(0,0)
if #workDir>=limit2 then
	for i=limit1,limit2 do
		if posicion==i then 
			draw.fillrect(9,i*17+63-limit1*17,463,12,azul)
			screen.print(15,i*17+66-limit1*17,files.nopath(workDir[i].name),0.6,negro,0)
			tipe(i,1)
		else
			screen.print(15,i*17+66-limit1*17,files.nopath(workDir[i].name),0.6,blanco,0)
			tipe(i,2)
		end
	end
else
	for i=1,#workDir do
		if posicion==i then 
			draw.fillrect(9,i*17+63-17,463,12,azul)
			screen.print(15,i*17+66-17,files.nopath(workDir[i].name),0.6,negro,0)
			tipe(i,1)
		else
			screen.print(15,i*17+66-17,files.nopath(workDir[i].name),0.6,blanco,0)
			tipe(i,2)
		end
	end
end

if controls.square() then
	if controls.press("down") and posicion<#workDir then
		posicion=posicion+1
		if posicion>12 then
			limit1=limit1+1
			limit2=limit2+1
		end
	end
	if controls.press("up") and posicion>1 then
	posicion=posicion-1
		if limit2>12 then
		limit1=limit1-1
		limit2=limit2-1
		end
	end
	if controls.press("left") then 
		workDir=files.list(files.nofile(files.nofile(workDir[posicion].name)))
		limit1=1
		limit2=12
	end
	if controls.press("right") then
		if workDir[posicion].directory then 
			adelante(true) limit1=1 limit2=12
		elseif files.ext(workDir[posicion].name)=="zip" then
			explorador_zip(true)
		end
	end
end
if controls.press("cross") then
	if peticion=="PlutuX" then 
		if files.ext(workDir[posicion].name)=="png" then 
			new_corutina("PlutuX") 
			imgini=image.load(workDir[posicion].name)
			trabajo=files.nofile(workDir[posicion].name)
			plutuX() 
		end
	end
	if peticion=="PowerPoint" then 
		if files.ext(workDir[posicion].name)=="png" then di[diapo].i1.i=image.load(workDir[posicion].name) files.copy(workDir[posicion].name,"a"..diapo..".png",true) insertar_img=false moving=true powerpoint(true) end
	end
end
if controls.press("triangle") then
	if peticion=="PowerPoint" then 
		if files.ext(workDir[posicion].name)=="png" then di[diapo].i2.i=image.load(workDir[posicion].name) files.copy(img[workDir[posicion].name].name,"b"..diapo..".png",true) insertar_img=false moving=true powerpoint(true) end
	end
end
if controls.press("circle") then
	if peticion=="PowerPoint" then 
		if files.ext(workDir[posicion].name)=="mp3" or files.ext(workDir[posicion].name)=="wav" then
			files.copy(workDir[posicion].name,"snd."..files.ext(workDir[posicion].name)) 
			snd_fondo=sound.load(workDir[posicion].name) 
			insertar_snd=false 
			powerpoint(true)
		end
	end
end
if controls.start() then sistema() end

if not controls.square() then
	puntero()
end
screen.flip()
end
end

