#!/bin/bash
# Copyright 2005 Marcos Guglielmetti 
# Released under GNU GPL 2 or later



export USAR_NLS=si
export TEXTDOMAIN=gmma.sh
export TEXTDOMAINDIR="/etc/musix/locales"


#Contenido de config/encabezado :
. /etc/musix/funciones-i18n
[ -e /etc/musix/funciones ] && . /etc/musix/funciones

# esto deja el nombre del archivo sin extensión, para luego
# poder tratarlo como MIDI
#ls $1 | cut -f1 -d"."

NOMBRE=`ls $1 | cut -f1 -d"."`

#puede ser -nearmouse o -center (o nada)

pos="-nearmouse"
_n "
Deseas editar $1 o convertirlo en archivo MIDI 
para escucharlo con Timidity?

Do you want to edit or convert $1 file to a MIDI 
file and play it with Timidity?


" | gmessage -title 'ghostess' -geometry 500x200 -file - $pos -buttons $(_n "Convert:0,Edit:1,Exit:2,Tutorial-es:3,Tutorial-pt:4" ) 

RESULTADO=$?

if [ $RESULTADO -eq 0 ] 
then
echo Convirtiendo... $NOMBRE		
mma $1
echo Listo...
echo Reproduciendo $NOMBRE.mid
timidity -ia $NOMBRE.mid
fi

if [ $RESULTADO -eq 1 ] 
then		
echo Abriendo editor para $1
leafpad $1
echo volviendo sobre lo mismo...
gmma.sh $1
exit
fi


if [ $RESULTADO -eq 2 ] 
then		
exit
fi

if [ $RESULTADO -eq 3 ] 
then		
dillo /usr/share/doc/tutorial-mma/tutorialMMAes.html
dillo /usr/share/doc/tutorial-mma/tutorialMMA-portuguese.html
fi

if [ $RESULTADO -eq 4 ] 
then		
dillo /usr/share/doc/tutorial-mma/tutorialMMA-portuguese.html
fi
