source submenu/instrument_submenu.tcl
source but_small_popup.tcl

proc initialize_surface { } {


        ########################################################################		
	# Initialize the MPL buttons to be grey
	########################################################################
		
	# first initialize everything to "GREY" for the buttons
      	for {set i 1} {$i <= 64} {incr i} {
      	 	set but_name [get_button_name 1 $i]
      	 	# set the button database to be 0
      	 	set_button_state 1 $i 0
        	
        	
        	set vbut .ventana.editor.b$but_name
 	
        	if ![winfo exists $vbut] {
 			#puts ""
 		} else {
 	        		set bclr [lindex [get_button_color_type 1 $i] 0]
       				if { $bclr == "" || $bclr == " "  } { set bclr grey }
       				$vbut configure -bg $bclr
       				$vbut configure -activebackground $bclr
       		}
       		
       		
       		set vbut2 .ventana2.editor.b$but_name

 		if ![winfo exists $vbut2] {
 			#puts ""
 		} else {
       				set bclr [lindex [get_button_color_type 1 $i] 0]
       				if { $bclr == "" || $bclr == " "  } { set bclr grey }
       				$vbut2 configure -bg $bclr
       				$vbut2 configure -activebackground $bclr
       							
       			}	
       		
 	
        # end of mpl initialization for loop
        }




       	########################################################################		
	# Initialize the gesout buttons to be grey
	########################################################################
		

        for {set i 1} {$i <= 129} {incr i} {
      	 	set but_name [get_button_name 0 $i]
      	 	# set the button database to be 0
      	 	set_button_state 0 $i 0
        	
        	
        	set vbut .ventana.editor.b$but_name
 	
        	if ![winfo exists $vbut] {
 			#puts ""
 		} else {
 	        		set bclr [lindex [get_button_color_type 0 $i] 0]
       				if { $bclr == "" || $bclr == " "  } { set bclr grey }
       				$vbut configure -bg $bclr
       				$vbut configure -activebackground $bclr
       		}
       		
       		
       		set vbut2 .ventana2.editor.b$but_name

 		if ![winfo exists $vbut2] {
 			#puts ""
 		} else {
       				set bclr [lindex [get_button_color_type 0 $i] 0]
       				if { $bclr == "" || $bclr == " "  } { set bclr grey }
       				$vbut2 configure -bg $bclr
       				$vbut2 configure -activebackground $bclr
       							
       			}	
       		
 	
        # end of gesout initialization for loop
        }




       	########################################################################		
	# Update the MPL
	########################################################################
		
	# update the digital MPL buttons
        for {set i 1} {$i <= 64} {incr i} {
        	


        	# called the array of digitals from vehicle.cpp
        	set state [get_digital_status 1 $i]
        	set but_name [get_button_name 1 $i]
        	
        	#puts "initialize_surface.tcl : conn : MPL $i state $state"
        	
        	# update the button database
        	set_button_state 1 $i $state
        	set vbut .ventana.editor.b$but_name
 	
        	# update the button display on GUI
        	
 		if ![winfo exists $vbut] {
 			#puts "button does not exist on screen 1"
 			#puts ""
 		} else {
 	
 			set state [get_button_state 1 $i]
       			if {$state == 1} {
       				$vbut configure -bg white
       				$vbut configure -activebackground white
       			} else {
       				set bclr [lindex [get_button_color_type 1 $i] 0]
       				if { $bclr == "" || $bclr == " "  } { set bclr grey }
       				$vbut configure -bg $bclr
       				$vbut configure -activebackground $bclr
       				#$vbut configure -bg grey
       				#$vbut configure -activebackground grey
       			      			
       			}	
 	
       		}
       	
 		#---------------------------------------------#
 		# Look for the button from the second screen 			#
 		#---------------------------------------------#
 		set vbut2 .ventana2.editor.b$but_name

 	
 		if ![winfo exists $vbut2] {
 			#puts "button does not exist on screen 2"
 			#return
 			#puts ""
 		} else {
 	        	#puts "but_name on screen2 $but_name"
 			set state [get_button_state 1 $i]
 	      	
 	      	
 	      		if {$state == 1} {
 	      			$vbut2 configure -bg white
 	      			$vbut2 configure -activebackground white
 	      		} else {
 	      			set bclr [lindex [get_button_color_type 1 $i] 0]
 	      			if { $bclr == "" || $bclr == " " } { set bclr grey }
 	      			$vbut2 configure -bg $bclr
 	      			$vbut2 configure -activebackground $bclr
 	      			      		
       			}	
		}
       	
        	
		
		
		#-----------------------------------------------#
        	# Update the "Instrument" swithces too         	#
        	# Called from file "but_small_popup.tcl"       	#
        	#-----------------------------------------------#
        		
		update_switches 1 $i $state
        	update_lightisol_switches 0 $i $state	
		
        	
        # end of digital mpl for loop	
        }
	
	
		
		
		########################################################################		
		# Update the GESOUT
		########################################################################
		
		# update the digital Gesout buttons
        	for {set i 1} {$i <= 129} {incr i} {
        	


        		# called the array of digitals from vehicle.cpp
        		set state [get_digital_status 0 $i]
        		set but_name [get_button_name 0 $i]
        	
        		#puts "initialize_surface.tcl : conn : Gesout $i state $state"
        	
        		# update the button database
        		set_button_state 0 $i $state
        		set vbut .ventana.editor.b$but_name
 	
        		# update the button display on GUI
        	
 			if ![winfo exists $vbut] {
 				#puts "button does not exist on screen 1"
 			         #puts ""
 			} else {
 	
 				set state [get_button_state 0 $i]
       				if {$state == 1} {
       					$vbut configure -bg white
       					$vbut configure -activebackground white
       				} else {
       					set bclr [lindex [get_button_color_type 0 $i] 0]
       					if { $bclr == "" || $bclr == " "  } { set bclr grey }
       					$vbut configure -bg $bclr
       					$vbut configure -activebackground $bclr
       			  			
       				}	
 	
       			}
       	
 			#---------------------------------------------#
 			# Look for the button from the second screen 			#
 			#---------------------------------------------#
 			set vbut2 .ventana2.editor.b$but_name

 	
 			if ![winfo exists $vbut2] {
 				#puts ""
 			} else {
 	        		#puts "but_name on screen2 $but_name"
 				set state [get_button_state 0 $i]
 	      	
 	      	
 	      			if {$state == 1} {
 	      				$vbut2 configure -bg white
 	      				$vbut2 configure -activebackground white
 	      			} else {
 	      				set bclr [lindex [get_button_color_type 0 $i] 0]
 	      				if { $bclr == "" || $bclr == " " } { set bclr grey }
 	      				$vbut2 configure -bg $bclr
 	      				$vbut2 configure -activebackground $bclr
 	      				      		
       				}	
			}
       	
		#-----------------------------------------------#
        	# Update the "Instrument" swithces too         	#
        	# Called from file "but_small_popup.tcl"       	#
        	#-----------------------------------------------#
        	
        	update_switches 0 $i $state
                update_lightisol_switches 0 $i $state	
		
        	
		# end for loop for updating digital gesout buttons
		}	
		
	
}