# interface generated by SpecTcl version 1.0 from /usr/people/ramsan/tmp/pref_postprocess.ui
#   root     is the parent window for this user interface

proc pref_postprocess_ui {root args} {
        global ChangeVarInfo

	# this treats "." as a special case

	if {$root == "."} {
	    set base ""
	} else {
	    set base $root
	}

	frame $base.fg -bd 2 -relief groove
        label $base.fg.lContNumCol -text [_ "Number of colors:"]
	entry $base.fg.eContNumCol -textvariable ChangeVarInfo(NumColors) -bd 1 -width 5

        label $base.fg.lContWidth -text [_ "Fix interval width:"]
	entry $base.fg.eContWidth -textvariable ChangeVarInfo(IntvWidth) -bd 1 -width 5

	grid $base.fg.lContNumCol -sticky e -padx 2 -pady 2
	grid $base.fg.eContNumCol -sticky w -padx 2 -pady 2 -row 0 -column 1
	grid $base.fg.lContWidth -sticky e -padx 2 -pady 2
	grid $base.fg.eContWidth -sticky w -padx 2 -pady 2 -row 1 -column 1

	grid rowconfigure $base.fg 0 -weight 1
	grid rowconfigure $base.fg 1 -weight 1
	grid columnconfigure $base.fg 1 -weight 1

	frame $base.fl -bd 2 -relief groove
        label $base.fl.lContLimits -text [_ "Contour limits options:"]

        label $base.fl.lContOutMaxCol -text [_ "Color above max. limit:"]
	set menu [ tk_optionMenuRAM $base.fl.mbContOutMaxCol ChangeVarInfo(ContourMaxType) \
		[list [_ "Black"] [_ "MaxColor"] [_ "Transparent"] [_ "Material"]] \
		{Black MaxColor Transparent Material}]
	$base.fl.mbContOutMaxCol conf -bd 1 -highlightthickness 1 -width 9
	$menu conf -bd 1 -activeborderwidth 1

	frame $base.fl.mx -bd 0
        label $base.fl.mx.lContMaxCol -text [_ "Max."]
        label $base.fl.mx.lContMaxCol2 -text [_ "Color"]:
	button $base.fl.mx.bContMaxCol -bd 1
        label $base.fl.mx.lContMaxVal -text [_ "value:"]
	entry $base.fl.mx.eContMaxVal -textvariable ChangeVarInfo(ContourLimMax) -bd 1 -width 8
	grid $base.fl.mx.lContMaxCol -sticky w -padx 2 -pady 2
	grid $base.fl.mx.lContMaxCol2 -sticky e -column 1 -row 0 -padx 2 -pady 2
	grid $base.fl.mx.bContMaxCol -sticky w -column 2 -row 0 -padx 2 -pady 2
	grid $base.fl.mx.lContMaxVal -sticky e -column 3 -row 0 -padx 2 -pady 2
	grid $base.fl.mx.eContMaxVal -sticky w -column 4 -row 0 -padx 2 -pady 2
	grid rowconfigure $base.fl.mx 0 -weight 1
	grid columnconfigure $base.fl.mx 0 -weight 1

	frame $base.fl.cs -bd 0
        label $base.fl.cs.lContScale -text [_ "Color Scale"]:
	set menu [ tk_optionMenuRAM $base.fl.cs.mbContColorScale ChangeVarInfo(ContourColorScale) \
		[list [_ "Standard"] [_ "InvStandard"] [_ "TerrainMap"] [_ "Black&White"] [_ "User"]] \
		{Standard InvStandard TerrainMap BlackWhite User}]
	$base.fl.cs.mbContColorScale conf -bd 1 -highlightthickness 1 -width 8
	$menu conf -bd 1 -activeborderwidth 1
        label $base.fl.cs.lContScale2 -text [_ "Type:"]
	frame $base.fl.cs.t
        radiobutton $base.fl.cs.t.rbContColorScale -text [_ "RGB"] -value RGB -textvariable ChangeVarInfo(ContourColorScaleType)
        radiobutton $base.fl.cs.t.rbContColorScale2 -text [_ "HSV"] -value HSV -textvariable ChangeVarInfo(ContourColorScaleType)
	grid $base.fl.cs.t.rbContColorScale $base.fl.cs.t.rbContColorScale2 -padx 2 -pady 2
	grid $base.fl.cs.lContScale -sticky we -padx 2 -pady 2
	grid $base.fl.cs.mbContColorScale -sticky w -row 0 -column 1 -padx 2 -pady 2
	#grid $base.fl.cs.lContScale2 -sticky e -row 0 -column 2 -padx 2 -pady 2
	grid $base.fl.cs.t -sticky w -row 0 -column 2
	
	

	frame $base.fl.mn -bd 0
        label $base.fl.mn.lContMinCol -text [_ "Min."]
        label $base.fl.mn.lContMinCol2 -text [_ "color:"]
	button $base.fl.mn.bContMinCol -bd 1
        label $base.fl.mn.lContMinVal -text [_ "value:"]
	entry $base.fl.mn.eContMinVal -textvariable ChangeVarInfo(ContourLimMin) -bd 1 -width 8
	grid $base.fl.mn.lContMinCol -sticky w -padx 2 -pady 2
	grid $base.fl.mn.lContMinCol2 -sticky e -column 1 -row 0 -padx 2 -pady 2
	grid $base.fl.mn.bContMinCol -sticky w -column 2 -row 0 -padx 2 -pady 2
	grid $base.fl.mn.lContMinVal -sticky e -column 3 -row 0 -padx 2 -pady 2
	grid $base.fl.mn.eContMinVal -sticky w -column 4 -row 0 -padx 2 -pady 2
	grid rowconfigure $base.fl.mn 0 -weight 1
	grid columnconfigure $base.fl.mn 0 -weight 1

        label $base.fl.lContOutMinCol -text [_ "Color below min. limit:"]
	set menu [ tk_optionMenuRAM $base.fl.mbContOutMinCol ChangeVarInfo(ContourMinType) \
		[list [_ "Black"] [_ "MinColor"] [_ "Transparent"] [_ "Material"]] \
		{Black MinColor Transparent Material}]
	$base.fl.mbContOutMinCol conf -bd 1 -highlightthickness 1 -width 9
	$menu conf -bd 1 -activeborderwidth 1

	grid $base.fl.lContLimits -columnspan 2 -sticky w -padx 2 -pady 2
	grid $base.fl.lContOutMaxCol -sticky e -padx 2 -pady 2
	grid $base.fl.mbContOutMaxCol -sticky w -column 1 -row 1 -padx 2 -pady 2
	grid $base.fl.mx -padx 0 -pady 0 -sticky we -columnspan 2
	grid $base.fl.cs -padx 0 -pady 0 -sticky we -columnspan 2
	grid $base.fl.mn -padx 0 -pady 0 -sticky we -columnspan 2
	grid $base.fl.lContOutMinCol -sticky e -padx 2 -pady 2
	grid $base.fl.mbContOutMinCol -sticky w  -column 1 -row 5 -padx 2 -pady 2

	grid rowconfigure $base.fl 2 -weight 1
	grid rowconfigure $base.fl 4 -weight 1
	grid columnconfigure $base.fl 0 -weight 1


# 	  label $base.label#7 \
# 		  -text {Vector offset:}
# 
# 	  entry $base.entry#5 \
# 		  -textvariable ChangeVarInfo(VectorOffset)
# 
# 	  label $base.label#8 \
# 		  -text {Vector color:}
# 
# 	  menubutton $base.menubutton#2 \
# 		  -text menubutton
# 	  
# 	  label $base.label#81 \
# 		  -text {N. of Vector colors:} -width 20
# 
# 	  entry $base.entry#81 \
# 		  -textvariable ChangeVarInfo(VectNumColors)
# 	  
# 	  label $base.label#9 \
# 		  -text {Border Angle:} -width 20
# 
# 	  entry $base.entry#6 \
# 		  -textvariable ChangeVarInfo(BordeAngle)


	# Geometry management

#	 grid $base.label#1 -in $root	-row 1 -column 1  \
#		 -sticky e
#	 grid $base.entry#1 -in $root	-row 1 -column 2 
#	 grid $base.label#2 -in $root	-row 2 -column 1  \
#		 -sticky e
#	 grid $base.entry#2 -in $root	-row 2 -column 2 
#	 grid $base.label#3 -in $root	-row 3 -column 1  \
#		 -sticky e
#	 grid $base.label#4 -in $root	-row 4 -column 1  \
#		 -sticky e
#	 grid $base.entry#3 -in $root	-row 4 -column 2 
#	 grid $base.label#5 -in $root	-row 5 -column 1  \
#		 -sticky e
#	 grid $base.entry#4 -in $root	-row 5 -column 2 
#	 grid $base.label#6 -in $root	-row 6 -column 1  \
#		 -sticky e
#	 grid $base.menubutton#1 -in $root	-row 6 -column 2 
#	 grid $base.label#7 -in $root	-row 7 -column 1  \
#		 -sticky e
#	 grid $base.entry#5 -in $root	-row 7 -column 2 
#	 grid $base.label#8 -in $root	-row 8 -column 1  \
#		 -sticky e
#	 grid $base.menubutton#2 -in $root	-row 8 -column 2 
#	 grid $base.label#81 -in $root	-row 9 -column 1  \
#		 -sticky e
#	 grid $base.entry#81 -in $root	-row 9 -column 2 
#	 grid $base.label#9 -in $root	-row 10 -column 1  \
#		 -sticky e
#	 grid $base.entry#6 -in $root	-row 10 -column 2 
#
#	 # Resize behavior management
#
#	 grid rowconfigure $root 1 -weight 0 -minsize 30
#	 grid rowconfigure $root 2 -weight 0 -minsize 30
#	 grid rowconfigure $root 3 -weight 0 -minsize 30
#	 grid rowconfigure $root 4 -weight 0 -minsize 30
#	 grid rowconfigure $root 5 -weight 0 -minsize 30
#	 grid rowconfigure $root 6 -weight 0 -minsize 30
#	 grid rowconfigure $root 7 -weight 0 -minsize 30
#	 grid rowconfigure $root 8 -weight 0 -minsize 30
#	 grid rowconfigure $root 9 -weight 0 -minsize 30
#	 grid rowconfigure $root 10 -weight 0 -minsize 30
#	 grid columnconfigure $root 1 -weight 0 -minsize 30
#	 grid columnconfigure $root 2 -weight 0 -minsize 30
## additional interface code

        grid $base.fg -in $root -padx 8 -pady 8 -sticky news
        grid $base.fl -in $root -padx 8 -pady 8 -sticky news
        grid rowconfigure $root 0 -weight 1
        grid rowconfigure $root 1 -weight 1
        grid columnconfigure $root 0 -weight 1

	set ChangeVarInfo(BasePostWin) $base

proc ChangeOnlyColors {name1 name2 op} {
    global ChangeVarInfo

    set base $ChangeVarInfo(BasePostWin) 
    if { [ expr 0$ChangeVarInfo(NumColors)] != 0 } {
#	if { $ChangeVarInfo(NumColors) > $ChangeVarInfo(MaxColors) } {
#	    $base.entry#1 del 0 end
#	    $base.entry#1 ins end $ChangeVarInfo(MaxColors)
#	}
	if { $ChangeVarInfo(NumColors) < $ChangeVarInfo(MinColors) } {
	    $base.fg.eContNumCol del 0 end
	    $base.fg.eContNumCol ins end $ChangeVarInfo(MinColors)
	}
	set ChangeVarInfo(IntvWidth) 0
    }
}

proc ChangeOnlyVectColors {name1 name2 op} {
    global ChangeVarInfo

    set base $ChangeVarInfo(BasePostWin) 
    if { [ expr 0$ChangeVarInfo(VectNumColors)] != 0 } {
#	if { $ChangeVarInfo(VectNumColors) > $ChangeVarInfo(VectMaxColors) } {
#	    $base.entry#81 del 0 end
#	    $base.entry#81 ins end $ChangeVarInfo(VectMaxColors)
#	}
	if { $ChangeVarInfo(VectNumColors) < $ChangeVarInfo(VectMinColors) } {
	    $base.entry#81 del 0 end
	    $base.entry#81 ins end $ChangeVarInfo(VectMinColors)
	}
    }
}

proc ChangeOnlyIntervals {name1 name2 op} {
    global ChangeVarInfo
    
    set base $ChangeVarInfo(BasePostWin) 
    if { [ expr 0$ChangeVarInfo(IntvWidth)] != 0 } {
	if { $ChangeVarInfo(IntvWidth) < 0 } {
	    $base.fg.eContWidth del 0 end
	    $base.fg.eContWidth ins end "1"
	}
	set ChangeVarInfo(NumColors) 0
    }
}

proc ChangeOnlyBordeAngle {name1 name2 op} {
    global ChangeVarInfo
    
    set base $ChangeVarInfo(BasePostWin) 
    if { [ expr 0$ChangeVarInfo(BordeAngle)] != 0 } {
	if { $ChangeVarInfo(BordeAngle) > $ChangeVarInfo(BordeAngleMax) } {
	    $base.entry#6 del 0 end
	    $base.entry#6 ins end $ChangeVarInfo(BordeAngleMax)
	}
	if { $ChangeVarInfo(BordeAngle) < $ChangeVarInfo(BordeAngleMin) } {
	    $base.entry#6 del 0 end
	    $base.entry#6 ins end $ChangeVarInfo(BordeAngleMin)
	}
    }
}

trace variable ChangeVarInfo(NumColors) w ChangeOnlyColors
trace variable ChangeVarInfo(IntvWidth) w ChangeOnlyIntervals
# trace variable ChangeVarInfo(BardeAngle) w ChangeOnlyBordeAngle
# trace variable ChangeVarInfo(VectNumColors) w ChangeOnlyVectColors


# end additional interface code

}


# Allow interface to be run "stand-alone" for testing

catch {
    if {$argv0 == [info script]} {
	wm title . [_ "Testing pref_postprocess"]
	pref_postprocess_ui .
    }
}
