#!/bin/sh
dialog \
--title "Select monitor class" \
--menu "Please choose the appropriate monitor class.\n(current: $1)" \
21 60 10 \
\
"monosync"         "monitor (calculated modes)" \
"multisync"        "monitor (calculated modes)" \
"timelist"         "monitor (preset modes)" \
"generic"          "monitor (runtime selectable)" \
"add"              "add a monitor to the database" \
\
2> /tmp/.monclass 

MON_CLASS=$1
MON_TYPE=$2

NEW_MON_CLASS=`cat /tmp/.monclass`

if [ "$NEW_MON_CLASS" != "" ]; then
  case "$NEW_MON_CLASS" in 
       $MON_CLASS)
               monitor/$NEW_MON_CLASS/.configure $2
               ;;
       generic)
               echo "generic" > /tmp/.montype
	       ;;
       add)
               monitor/.new-monitor
               ;;
       *)
               monitor/$NEW_MON_CLASS/.configure
  esac
  NEW_MON_TYPE=`cat /tmp/.montype`
  if [ "$NEW_MON_TYPE" != "" ]; then
    MON_CLASS=$NEW_MON_CLASS
    MON_TYPE=$NEW_MON_TYPE
  fi
fi

echo $MON_CLASS>/tmp/.monclass
echo $MON_TYPE>/tmp/.montype
