source /home/ventana/source/elem_prop.tcl


#--------------------------------------------------
# initialize and set variable for the window name
#--------------------------------------------------

set head .head_input_list
set alt_list .altitude_list

proc head_input_list { display } {

   #-------------------
   # Declare variable
   #-------------------
   global outh
   global head

   if [winfo exists $head] {
   	destroy $head
   }

   #-------------------------------------------------------
   # Create a new window that contains the serial list
   #-------------------------------------------------------
   global env
   set env(DISPLAY) :0
   toplevel $head
   set outh $display


   button $head.in1 -relief flat -text "FOG GYRO" -command { head_selected $outh  "FOG GYRO"}
   button $head.in2 -relief flat -text "BACKUP COMPASS" -command { head_selected $outh  "BACKUP COMPASS"}
   button $head.in3 -relief flat -text "DVL" -command { head_selected $outh  "DVL"}


   for {set i 1 } {$i <= 3 } {incr i} {

   	pack $head.in$i -side top

   }

  button $head.b -text Close -command {destroy $head}
  pack $head.b

  #---------------------
  # helper procedure
  #---------------------

  proc head_selected { display text } {

      global head

      $display configure -state normal
      $display delete 0 100
      $display insert 0 $text
      $display configure -state disabled


      # Close the output list after
      destroy $head

  # end proc head_selected
  }

#end of proc "head_input_list"
}


proc altitude_list { display } {

   #-------------------
   # Declare variable
   #-------------------
   global outa
   global alt_list

   if [winfo exists $alt_list] {
   	destroy $alt_list
   }

   #-------------------------------------------------------
   # Create a new window that contains the altitude list
   #-------------------------------------------------------
   global env
   set env(DISPLAY) :0
   toplevel $alt_list
   set outa $display


   button $alt_list.in1 -relief flat -text "Mesotech" -command {
altitude_selected $outa  "MESOTECH"}
   button $alt_list.in2 -relief flat -text "Tritech" -command {
altitude_selected $outa  "TRITECH" }
   button $alt_list.in3 -relief flat -text "DVL" -command {
altitude_selected $outa  "DVL" }

   for {set i 1 } {$i <= 3 } {incr i} {

   	pack $alt_list.in$i -side top

   }

  button $alt_list.b -text Close -command {destroy $alt_list}
  pack $alt_list.b

  #---------------------
  # helper procedure
  #---------------------

  proc altitude_selected { display text } {

      global alt_list

      $display configure -state normal
      $display delete 0 100
      $display insert 0 $text
      $display configure -state disabled


      # Close the output list after
      destroy $alt_list
      send_down_auto_pilot
  # end proc altitude_selected
  }

#end of proc "altitude_list"
}
