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

proc CopyMain_ui {root args} {
    global CopyMoveInfo GidPriv
    # this treats "." as a special case

	if { [catch { set whatuse [lindex [.central.s info Project] 4] }] } {
	    set whatuse GEOMETRYUSE
	}

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

if { ( $whatuse == "GEOMETRYUSE") || ( $whatuse == "MESHUSE") } {
	label $base.label#1 \
		-text [_ "Entities type"]:

	menubutton $base.menubutton#1 \
		-disabledforeground grey60 \
		-text menubutton \
		-width 7

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

	menubutton $base.menubutton#2 \
		-disabledforeground grey60 \
		-text menubutton \
		-width 9
} else {
	label $base.label#1 \
		-text [_ "Transformation type"]:

	menubutton $base.menubutton#2 \
		-disabledforeground grey60 \
		-text menubutton \
		-width 12
}

        set sw [ScrolledWindow $base.ew -relief sunken -borderwidth 0]
        set canvas [canvas $sw.canvas#1 \
		-height 0 \
		-highlightthickness 0 \
		-width 0 -bd 0]
        $sw setwidget $canvas


# 	canvas $base.canvas#1 \
# 		-height 0 \
# 		-highlightthickness 0 \
# 		-width 0 \
# 		-xscrollcommand "$base.scrollbar#2 set" \
# 		-yscrollcommand "$base.scrollbar#1 set"

# 	scrollbar $base.scrollbar#1 \
# 		-command "$base.canvas#1 yview" \
# 		-orient v -bd 1 -elementborderwidth 1

# 	scrollbar $base.scrollbar#2 \
# 		-command "$base.canvas#1 xview" \
# 		-orient h -bd 1 -elementborderwidth 1

if { ( $whatuse == "GEOMETRYUSE") || ( $whatuse == "MESHUSE") } {
	checkbutton $base.checkbutton#1 \
		-disabledforeground grey60 \
		-highlightthickness 0 \
		-takefocus 0 \
		-text [_ "Duplicate entities"] \
		-variable GidPriv(DuplicateEntities)

	label $base.doextrudel -text [_ "Do extrude"]:

	menubutton $base.doextrude \
		-disabledforeground grey60 \
		-text menubutton \
		-width 7
} else {
        #label $base.duplicatel -text [_ "Transformation"]
	radiobutton $base.checkbutton#1 \
		-disabledforeground grey60 \
		-highlightthickness 0 \
		-takefocus 0 \
		-text [_ "View"] \
		-variable GidPriv(PostDuplicateEntities) -value 0

	radiobutton $base.checkbutton#11 \
		-disabledforeground grey60 \
		-highlightthickness 0 \
		-takefocus 0 \
		-text [_ "Create"] \
		-variable GidPriv(PostDuplicateEntities) -value 1

# 	label $base.doextrudel -text [_ "Transformation"]

# 	menubutton $base.doextrude \
# 		-disabledforeground grey60 \
# 		-text menubutton \
# 		-width 4
}

	checkbutton $base.createcontact \
		-disabledforeground grey60 \
		-highlightthickness 0 \
		-takefocus 0 \
		-text [_ "Create contacts"] \
		-variable GidPriv(CopyMoveCreateContacts)


	checkbutton $base.maintainlayers \
		-disabledforeground grey60 \
		-highlightthickness 0 \
		-takefocus 0 \
		-text [_ "Maintain layers"] \
		-variable GidPriv(CopyMoveMaintainLayers)

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

	entry $base.mcopy \
		-borderwidth 1 \
		-insertborderwidth 1 \
		-textvariable GidPriv(CopyMoveMCopies) \
		-width 7

if { ( $whatuse != "GEOMETRYUSE") && ( $whatuse != "MESHUSE") } {
	frame $base.fopt -relief ridge -bd 2


	label $base.doextrudel -text [_ "Transform"]

	menubutton $base.doextrude \
		-disabledforeground grey60 \
		-text menubutton \
		-width 5

	button $base.fopt.bdellast -text [_ "Undo"] -command {
	    .central.s process utilities transformation dellasttransf
	} -bd 1

	button $base.fopt.bclearall -text [_ "Clear"] -command {
	    .central.s process utilities transformation cleartransfs
	} -bd 1

	# button $base.fopt.bredocopies -text [_ "ReCopy"] -command {
	#     .central.s process utilities transformation repeatlasttr $GidPriv(CopyMoveMCopies)
	# } -bd 1

	# grid $base.fopt.bdellast $base.fopt.bclearall $base.fopt.bredocopies \
	# 	-pady 1 -ipady 1 -padx 2 -ipadx 2 -sticky we
	grid $base.doextrude -in $base.fopt -row 0 -column 0  \
		-sticky e -pady 1 -padx 0 -ipady 1
	grid $base.doextrudel -in $base.fopt -row 0 -column 1  \
		-sticky w -pady 1 -padx 0 -ipady 1

	grid $base.fopt.bdellast $base.fopt.bclearall \
		-pady 1 -ipady 1 -padx 2 -ipadx 2 
#-sticky we
	grid rowconfigure $base.fopt 0 -weight 1
	grid rowconfigure $base.fopt 1 -weight 1
	grid columnconfigure $base.fopt 0 -weight 1
	grid columnconfigure $base.fopt 1 -weight 1
	# grid columnconfigure $base.fopt 2 -weight 1
    }

	# Geometry management

	grid $base.frame#1 -in $root	-row 3 -column 1  \
		-columnspan 2 \
		-sticky nesw -padx 2 -pady 1 -ipady 1

if { ( $whatuse == "GEOMETRYUSE") || ( $whatuse == "MESHUSE") } {
	grid $base.label#1 -in $root	-row 1 -column 1  \
		-sticky e -pady 1 -padx 2 -ipady 1
	grid $base.menubutton#1 -in $root	-row 1 -column 2  \
		-sticky w -pady 1 -padx 2 -ipady 1
	grid $base.label#2 -in $root	-row 2 -column 1  \
		-sticky e -pady 1 -padx 2 -ipady 1
	grid $base.menubutton#2 -in $root	-row 2 -column 2  \
		-sticky w -pady 1 -padx 2 -ipady 1
} else {
	grid $base.label#1 -in $root	-row 1 -column 1  \
		-columnspan 2 -sticky w -pady 1 -padx 2 -ipady 1
	grid $base.menubutton#2 -in $root	-row 2 -column 1  \
		-columnspan 2 -sticky e -pady 1 -padx 2 -ipady 1
}

         grid $sw -in $base.frame#1	-row 1 -column 1  -columnspan 2 -rowspan 2\
		-sticky nesw -pady 0 -padx 0 -ipady 0 -ipadx 0

# 	grid $base.canvas#1 -in $base.frame#1	-row 1 -column 1  \
# 		-sticky nesw -pady 0 -padx 0 -ipady 0 -ipadx 0
# 	grid $base.scrollbar#1 -in $base.frame#1	-row 1 -column 2  \
# 		-sticky ns -pady 1 -padx 2 -ipady 1
# 	grid $base.scrollbar#2 -in $base.frame#1	-row 2 -column 1  \
# 		-sticky ew -pady 1 -padx 2 -ipady 1

if { ( $whatuse == "GEOMETRYUSE") || ( $whatuse == "MESHUSE") } {
	grid $base.checkbutton#1 -in $root	-row 4 -column 1  \
		-columnspan 2 \
		-sticky w -pady 1 -padx 2 -ipady 1
	grid $base.doextrudel -in $root	-row 5 -column 1  \
		-sticky e -pady 1 -padx 2 -ipady 1
	grid $base.doextrude -in $root	-row 5 -column 2  \
		-sticky w -pady 1 -padx 2 -ipady 1
	grid $base.createcontact -in $root	-row 6 -column 1  \
		-columnspan 2 \
		-sticky w -pady 1 -padx 2 -ipady 1
	grid $base.maintainlayers -in $root	-row 7 -column 1  \
		-columnspan 2 \
		-sticky w -pady 1 -padx 2 -ipady 1
	grid $base.label#3 -in $root	-row 8 -column 1  \
		-sticky e -pady 1 -padx 2 -ipady 1
	grid $base.mcopy -in $root	-row 8 -column 2  \
		-sticky w -pady 1 -padx 2 -ipady 1
} else {
        $base.label#3 conf -text [_ "Copies"]:
	grid $base.label#3 -in $root	-row 4 -column 1  \
		-sticky e -pady 1 -padx 2 -ipady 1 -sticky e
	grid $base.mcopy -in $root	-row 4 -column 2  \
		-sticky w -pady 1 -padx 2 -ipady 1 -sticky w

# 	grid $base.checkbutton#1 -in $root -row 5 -column 1  \
# 		-columnspan 2 \
# 		-sticky w -pady 1 -padx 2 -ipady 1
	grid $base.checkbutton#1 -in $root -row 5 -column 1  \
		-sticky we -pady 0 -padx 0 -ipady 0
	grid $base.checkbutton#11 -in $root -row 5 -column 2  \
		-sticky we -pady 0 -padx 0 -ipady 0

# 	grid $base.doextrude -in $root	-row 6 -column 1  \
# 		-sticky e -pady 1 -padx 0 -ipady 1
# 	grid $base.doextrudel -in $root	-row 6 -column 2  \
# 		-sticky w -pady 1 -padx 0 -ipady 1
	grid $base.fopt -in $root	-row 6 -column 1  \
		-columnspan 2 -rowspan 2 \
		-sticky we -pady 1 -padx 2 -ipady 0
}
	# Resize behavior management

	grid rowconfigure $root 1 -weight 0 -minsize 30
	grid rowconfigure $root 2 -weight 0 -minsize 30
	grid rowconfigure $root 3 -weight 1 -minsize 156
	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 columnconfigure $root 1 -weight 1 -minsize 30
	grid columnconfigure $root 2 -weight 1 -minsize 30

	grid rowconfigure $base.frame#1 1 -weight 1 -minsize 30
	grid rowconfigure $base.frame#1 2 -weight 0
	grid columnconfigure $base.frame#1 1 -weight 1 -minsize 118
	grid columnconfigure $base.frame#1 2 -weight 0
# additional interface code

	switch $whatuse {
	    "GEOMETRYUSE" {
		set m [ tk_optionMenuRAM $base.menubutton#1 CopyMoveInfo(EntitiesType) \
			[list [_ "Points"] [_ "Lines"] [_ "Surfaces"] [_ "Volumes"] [_ "All Types"]] \
			{Points Lines Surfaces Volumes AllTypes} ]
	    }
	    "MESHUSE" {
		set m [ tk_optionMenuRAM $base.menubutton#1 CopyMoveInfo(EntitiesType) \
			[list [_ "Nodes"] [_ "Elements"] [_ "All Types"]] \
			{Nodes Elements AllTypes} ]
	    }
	    default {
		set m [ tk_optionMenuRAM $base.menubutton#1 CopyMoveInfo(EntitiesType) \
			[list [_ "All"]] \
			{All} ]
	    }
	}

$base.menubutton#1 conf -bd 1 -highlightthickness 1
$m conf -bd 1 -activeborderwidth 1



if { ( $whatuse == "GEOMETRYUSE") || ( $whatuse == "MESHUSE") } {
    if { ( $whatuse == "MESHUSE") || ( $CopyMoveInfo(whatwhat)!= "Copy") } {
	set menu [ tk_optionMenuRAM $base.menubutton#2 CopyMoveInfo(Transformation) \
		[list [_ "Translation"] [_ "Rotation"] [_ "Mirror"] [_ "Scale"] [_ "Offset"] [_ "Align"]] \
		{Translation Rotation Mirror Scale Offset Align} ]
    } else {
	set menu [ tk_optionMenuRAM $base.menubutton#2 CopyMoveInfo(Transformation) \
		[list [_ "Translation"] [_ "Rotation"] [_ "Mirror"] [_ "Scale"] [_ "Offset"] [_ "Sweep"] [_ "Align"]] \
		{Translation Rotation Mirror Scale Offset Sweep Align} ]		
    }
} else {
    set menu [ tk_optionMenuRAM $base.menubutton#2 CopyMoveInfo(Transformation) \
		[list [_ "Translation"] [_ "Rotation"] [_ "Mirror"]] \
		{Translation Rotation Mirror} ]
}

$base.menubutton#2 conf -bd 1 -highlightthickness 1
$menu conf -bd 1 -activeborderwidth 1

if { ( $whatuse == "GEOMETRYUSE") || ( $whatuse == "MESHUSE") } {
    set menu [ tk_optionMenuRAM $base.doextrude GidPriv(CopyMoveDoExtrude) \
	    [list [_ "No"] [_ "Lines"] [_ "Surfaces"] [_ "Volumes"]] \
	    {No Lines Surfaces Volumes} ]

    $base.doextrude conf -bd 1 -highlightthickness 1
    $menu conf -bd 1 -activeborderwidth 1
} else {
    #$base.checkbutton#1 conf -state disabled
    #$base.doextrudel conf -foreground grey60
    set menu [ tk_optionMenuRAM $base.doextrude GidPriv(CopyMoveDoExtrude) \
	    [list [_ "Show"] [_ "Hide"]] \
	    {Show Hide} ]
    $base.doextrude conf -bd 1 -highlightthickness 1
    $menu conf -bd 1 -activeborderwidth 1
}

return $canvas
#return $base.canvas#1
# end additional interface code

}


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

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