# interface generated by SpecTcl version 1.0 from pref_general.ui
#   root     is the parent window for this user interface

proc pref_import_ui {root args} {
    global ChangeVarInfo
	# this treats "." as a special case

	if {$root == "."} {
	    set base ""
	} else {
	    set base $root
	}
    
	frame $base.frame#1 \
		-borderwidth 2 \
		-relief ridge

	frame $base.frame#2\
		-borderwidth 2 \
		-relief ridge

	frame $base.frame#3 \
		-borderwidth 2 \
		-relief ridge
	frame $base.frame#4

	checkbutton $base.checkbutton#1 \
		-disabledforeground grey60 \
        	-text [_ "Automatic collapse after import"] \
		-variable ChangeVarInfo(AutoCollapseAfterImport) \
		-justify left

        GidHelp $base.checkbutton#1 [_ "If this option is set, after reading one\
	        IGES, DXF, VDA, Parasolid or ACIS file, one global collapse is made."]

	checkbutton $base.checkbutton#4 \
		-disabledforeground grey60 \
        	-text [_ "Automatic import tolerance value"] \
		-variable ChangeVarInfo(AutoImportTolerance) \
		-justify left

	GidHelp $base.checkbutton#4 [_ "If this option is set, the value of Import tolerance\
	        is assigned automatically according to the size of the model."]

	label $base.label#2 \
        	-text [_ "Import tolerance:"]

	entry $base.entry#9 \
		-borderwidth 1 \
		-insertborderwidth 1 \
		-textvariable ChangeVarInfo(ImportTolerance) \
		-width 8

	GidHelp "$base.label#2 $base.entry#9" [_ "When importing a file or\
		collapsing, the points closer than this distance are considered\
		to be unique. Lines and surfaces can also be collapsed."]

	label $base.label#3 \
        	-text [_ "Collapse"]:

	radiobutton $base.radiobutton#2 \
        	-text [_ "Ignoring layers"] \
		-variable ChangeVarInfo(CollapseIgnoringLayers) -value 1

	radiobutton $base.radiobutton#1 \
	        -text [_ "Each layer separately"] \
		-variable ChangeVarInfo(CollapseIgnoringLayers) -value 0

	GidHelp "$base.frame#3 $base.label#3  $base.radiobutton#2 \
	        $base.radiobutton#1" [_ "if set to 'Ignoring Layers' entities\
		are collapsed also if they belong to different layers. If set\
		to 'Each layer separately' entities in different layers are not\
		collapsed. (Entities belonging to frozen layers are never\
		considered)."]

	checkbutton $base.checkbutton#3 \
		-disabledforeground grey60 \
         	-text [_ "IGES: ignore invisible entities"] \
		-variable ChangeVarInfo(IGESIgnoreInvisible)

	GidHelp $base.checkbutton#3 [_ "If this option is set, entities with\
		'invisible' flag in an IGES file are ignored. If it is not set,\
        	all these entities are sent to a layer with name: 'Invisible'."]

	checkbutton $base.checkbutton#5 \
		-disabledforeground grey60 \
        	-text [_ "IGES: Curve on surface from 3D"] \
		-variable ChangeVarInfo(IGESCurveOnSurfaceFrom3D)

	GidHelp $base.checkbutton#5 [_ "If this option is set, the IGES curve on surface\
                entities, are created from the direct 3D space definition (recommended),\
		else are created from the surface space parameter definition."]

	# Geometry management

	grid $base.frame#1 -in $root	-row 1 -column 1 -sticky nsew -padx 6 -pady 3
	grid $base.frame#2 -in $root	-row 2 -column 1  -sticky nsew -padx 6 -pady 3

	grid $base.checkbutton#1 -in $base.frame#1 -row 1 -column 1  \
		-sticky w

	grid $base.checkbutton#4 -in $base.frame#1 -row 2 -column 1  \
		-sticky w

	grid $base.frame#4 -in $base.frame#1 -row 3 -column 1 -sticky w -padx 0 -pady 0

	grid $base.label#2 -in $base.frame#4 -row 1 -column 1  \
		-sticky w
	grid $base.entry#9 -in $base.frame#4 -row 1 -column 2  \
		-sticky w -padx 3

	grid $base.frame#3 -in $base.frame#1 -row 4 -column 1 -sticky nsew -padx 6 -pady 3

	grid $base.label#3 -in $base.frame#3 -row 1 -column 1  \
		-sticky w -padx 3
	grid $base.radiobutton#2 -in $base.frame#3 -row 2 -column 1  \
		-sticky w
	grid $base.radiobutton#1 -in $base.frame#3 -row 3 -column 1  \
		-sticky w
	grid $base.checkbutton#3 -in $base.frame#2 -row 1 -column 1  \
		-sticky w
	grid $base.checkbutton#5 -in $base.frame#2 -row 2 -column 1  \
		-sticky w


	# Resize behavior management

	grid rowconfigure $root 1 -weight 1 -minsize 2
	grid rowconfigure $root 2 -weight 1 -minsize 2
	grid rowconfigure $root 3 -weight 1 -minsize 2
	grid rowconfigure $root 4 -weight 1 -minsize 2
	grid rowconfigure $root 5 -weight 1 -minsize 2
	grid rowconfigure $root 6 -weight 1 -minsize 2
	grid columnconfigure $root 1 -weight 1 -minsize 200

	grid rowconfigure $base.frame#1 1 -weight 1 -minsize 2
	grid columnconfigure $base.frame#1 1 -weight 1 -minsize 2

	grid rowconfigure $base.frame#2 1 -weight 1 -minsize 2
	grid columnconfigure $base.frame#2 1 -weight 1 -minsize 2

	grid rowconfigure $base.frame#3 1 -weight 1 -minsize 2
	grid columnconfigure $base.frame#3 1 -weight 1 -minsize 2
	grid columnconfigure $base.frame#3 2 -weight 1 -minsize 2

	grid rowconfigure $base.frame#4 1 -weight 1 -minsize 2
	grid columnconfigure $base.frame#4 1 -weight 1 -minsize 2
	grid columnconfigure $base.frame#4 2 -weight 1 -minsize 2

# additional interface code
global ChangeVarInfo
set ChangeVarInfo(basei) $base

proc AutoCollapseAfterImportProc {} {
    global ChangeVarInfo
    if { $ChangeVarInfo(AutoImportTolerance) == 1 } {
      set ChangeVarInfo(ImportTolerance) [.central.s info AutomaticTolerance]
	$ChangeVarInfo(basei).entry#9 conf -state disabled
	$ChangeVarInfo(basei).entry#9 conf -fg grey60
    } else {
	set ChangeVarInfo(ImportTolerance) [.central.s info variable ImportTolerance]
	$ChangeVarInfo(basei).entry#9 conf -state normal
	$ChangeVarInfo(basei).entry#9 conf -fg black
    }
}

trace variable ChangeVarInfo(AutoImportTolerance) w \
	"AutoCollapseAfterImportProc ;#"

# end additional interface code

}


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

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