# Copyright (c) 2003, 2009 Oscar Garcia
# MIT OSI License.  See License.txt file.

# interface generated by SpecTcl version 1.1 from C:/EasySDE/Plot.ui
#   root     is the parent window for this user interface

proc Plot_ui {root args} {

	# this treats "." as a special case

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

	frame $base.frame#8 \
		-borderwidth 2 \
		-relief groove

	frame $base.frame#9 \
		-borderwidth 2 \
		-relief groove

	frame $base.frame#10 \
		-borderwidth 2 \
		-relief groove

	frame $base.frame#11 \
		-borderwidth 2 \
		-relief groove

	frame $base.frame#12

	frame $base.frame#14

	frame $base.frame#24 \
		-borderwidth 2 \
		-relief groove

	frame $base.frame#27 \
		-borderwidth 2 \
		-relief groove

	frame $base.frame#16 \
		-borderwidth 2 \
		-relief groove

	label $base.label#18 \
		-text Title:

	entry $base.titleEntry \
		-cursor {} \
		-textvariable glob(title)

	label $base.dataFileLabel \
		-text {Data file:}

	entry $base.dataFileEntry \
		-cursor {} \
		-textvariable glob(dataFile)

	button $base.dataFileButton \
		-command DataFile \
		-text Browse

	label $base.scalingLabel \
		-text Scaling:

	label $base.ageLabel \
		-text Age

	entry $base.ageScaleEntry \
		-cursor {} \
		-textvariable glob(ageScale) \
		-width 6

	label $base.heightLabel \
		-text Height

	entry $base.heightScaleEntry \
		-cursor {} \
		-textvariable glob(htScale) \
		-width 6

	label $base.headerLabel \
		-bitmap @parms.xbm \
		-padx 22
	catch {
		$base.headerLabel configure \
			-font {-*-Courier New-Medium-R-Normal-*-*-120-*-*-*-*-*-*}
	}

	label $base.modelLabel \
		-text Model:

	menubutton $base.modelMenubutton \
		-activebackground white \
		-background white \
		-menu "$base.modelMenubutton.m" \
		-padx 22 \
		-relief sunken \
		-textvariable buttlabel
	catch {
		$base.modelMenubutton configure \
			-font -*-Courier-New-Medium-R-Normal-*-*-120-*-*-*-*-*-*
	}

	label $base.label#29 \
		-text Parameters

	label $base.aLabel \
		-text a

	entry $base.aEntry \
		-cursor {} \
		-textvariable glob(a) \
		-width 14

	label $base.bLabel \
		-text b

	entry $base.bEntry \
		-cursor {} \
		-textvariable glob(b) \
		-width 14

	label $base.cLabel \
		-text c

	entry $base.cEntry \
		-cursor {} \
		-textvariable glob(c) \
		-width 14

	label $base.t0Label \
		-text t0

	entry $base.t0Entry \
		-cursor {} \
		-textvariable glob(t0) \
		-width 14

	label $base.h0cLabel \
		-text H0c

	entry $base.h0cEntry \
		-cursor {} \
		-textvariable glob(h0c) \
		-width 14

	button $base.eqnButton \
		-command ShowEquation \
		-text {Show
equation}

	label $base.eqnLabel \
		-textvariable glob(equation)

	label $base.label#58 \
		-text {Age axis}

	label $base.label#37 \
		-text {Height axis}

	label $base.label#66 \
		-text {Site index}

	label $base.label#57 \
		-text Label

	entry $base.ageLabelEntry \
		-textvariable glob(ageLabel) \
		-width 16

	label $base.label#36 \
		-text Label

	entry $base.htLabelEntry \
		-textvariable glob(htLabel) \
		-width 16

	label $base.label#65 \
		-text From

	entry $base.entry#56 \
		-textvariable glob(siteFrom) \
		-width 3

	label $base.label#64 \
		-text To

	entry $base.entry#55 \
		-cursor {} \
		-textvariable glob(siteTo) \
		-width 3

	label $base.label#63 \
		-text By

	entry $base.entry#57 \
		-textvariable glob(siteBy) \
		-width 3

	label $base.label#56 \
		-text From

	entry $base.entry#48 \
		-textvariable glob(ageFrom) \
		-width 3

	label $base.label#55 \
		-text To

	entry $base.entry#47 \
		-textvariable glob(ageTo) \
		-width 3

	label $base.label#35 \
		-text From

	entry $base.entry#32 \
		-textvariable glob(htFrom) \
		-width 3

	label $base.label#34 \
		-text To

	entry $base.entry#31 \
		-textvariable glob(htTo) \
		-width 3

	label $base.label#67 \
		-text {Index age}

	entry $base.indexAgeEntry \
		-textvariable glob(indexAge) \
		-width 5

	checkbutton $base.checkbutton#2 \
		-text Grid \
		-variable glob(grid)

	label $base.label#42 \
		-text {Curves line type}

	entry $base.entry#59 \
		-textvariable glob(lineType) \
		-width 2

	button $base.helpButton \
		-command Help \
		-padx 8 \
		-pady 3 \
		-text Help
	catch {
		$base.helpButton configure \
			-font {-*-MS Sans Serif-Bold-R-Normal-*-*-120-*-*-*-*-*-*}
	}

	button $base.quitButton \
		-command {exit 1} \
		-padx 8 \
		-pady 3 \
		-text Quit
	catch {
		$base.quitButton configure \
			-font {-*-MS Sans Serif-Bold-R-Normal-*-*-120-*-*-*-*-*-*}
	}

	button $base.nextButton \
		-command OK \
		-padx 8 \
		-pady 3 \
		-text OK
	catch {
		$base.nextButton configure \
			-font {-*-MS Sans Serif-Bold-R-Normal-*-*-120-*-*-*-*-*-*}
	}


	# Geometry management

	grid $base.frame#23 -in $root	-row 5 -column 1  \
		-sticky ew
	grid $base.frame#8 -in $root	-row 2 -column 1  \
		-sticky ew
	grid $base.frame#9 -in $root	-row 3 -column 1  \
		-sticky ew
	grid $base.frame#10 -in $root	-row 4 -column 1  \
		-sticky ew
	grid $base.frame#11 -in $root	-row 1 -column 1  \
		-sticky ew
	grid $base.frame#12 -in $root	-row 7 -column 1  \
		-sticky ew
	grid $base.frame#14 -in $root	-row 6 -column 1  \
		-sticky ew
	grid $base.frame#24 -in $base.frame#14	-row 1 -column 1 
	grid $base.frame#27 -in $base.frame#14	-row 1 -column 3  \
		-columnspan 3
	grid $base.frame#16 -in $base.frame#14	-row 1 -column 2 
	grid $base.label#18 -in $base.frame#11	-row 1 -column 1 
	grid $base.titleEntry -in $base.frame#11	-row 1 -column 2  \
		-sticky ew
	grid $base.dataFileLabel -in $base.frame#8	-row 1 -column 1 
	grid $base.dataFileEntry -in $base.frame#8	-row 1 -column 2  \
		-columnspan 7 \
		-sticky ew
	grid $base.dataFileButton -in $base.frame#8	-row 1 -column 9  \
		-sticky w
	grid $base.scalingLabel -in $base.frame#8	-row 2 -column 1 
	grid $base.ageLabel -in $base.frame#8	-row 2 -column 3  \
		-sticky e
	grid $base.ageScaleEntry -in $base.frame#8	-row 2 -column 4  \
		-sticky w
	grid $base.heightLabel -in $base.frame#8	-row 2 -column 6  \
		-sticky e
	grid $base.heightScaleEntry -in $base.frame#8	-row 2 -column 7  \
		-sticky w
	grid $base.headerLabel -in $base.frame#9	-row 1 -column 2  \
		-ipadx 60 \
		-sticky w
	grid $base.modelLabel -in $base.frame#9	-row 2 -column 1 
	grid $base.modelMenubutton -in $base.frame#9	-row 2 -column 2  \
		-sticky w
	grid $base.label#29 -in $base.frame#10	-row 1 -column 1  \
		-columnspan 6
	grid $base.aLabel -in $base.frame#10	-row 2 -column 1 
	grid $base.aEntry -in $base.frame#10	-row 2 -column 2  \
		-sticky w
	grid $base.bLabel -in $base.frame#10	-row 2 -column 3 
	grid $base.bEntry -in $base.frame#10	-row 2 -column 4  \
		-sticky w
	grid $base.cLabel -in $base.frame#10	-row 2 -column 5 
	grid $base.cEntry -in $base.frame#10	-row 2 -column 6  \
		-sticky w
	grid $base.t0Label -in $base.frame#10	-row 3 -column 1 
	grid $base.t0Entry -in $base.frame#10	-row 3 -column 2  \
		-sticky w
	grid $base.h0cLabel -in $base.frame#10	-row 3 -column 3 
	grid $base.h0cEntry -in $base.frame#10	-row 3 -column 4  \
		-sticky w
	grid $base.eqnButton -in $base.frame#23	-row 1 -column 1 
	grid $base.eqnLabel -in $base.frame#23	-row 1 -column 2 
	grid $base.label#58 -in $base.frame#24	-row 1 -column 1  \
		-columnspan 4
	grid $base.label#37 -in $base.frame#16	-row 1 -column 1  \
		-columnspan 4
	grid $base.label#66 -in $base.frame#27	-row 1 -column 1  \
		-columnspan 6
	grid $base.label#57 -in $base.frame#24	-row 2 -column 1  \
		-sticky e
	grid $base.ageLabelEntry -in $base.frame#24	-row 2 -column 2  \
		-columnspan 3 \
		-sticky w
	grid $base.label#36 -in $base.frame#16	-row 2 -column 1  \
		-sticky e
	grid $base.htLabelEntry -in $base.frame#16	-row 2 -column 2  \
		-columnspan 3 \
		-sticky w
	grid $base.label#65 -in $base.frame#27	-row 2 -column 1  \
		-sticky e
	grid $base.entry#56 -in $base.frame#27	-row 2 -column 2  \
		-sticky w
	grid $base.label#64 -in $base.frame#27	-row 2 -column 3  \
		-sticky e
	grid $base.entry#55 -in $base.frame#27	-row 2 -column 4  \
		-sticky w
	grid $base.label#63 -in $base.frame#27	-row 2 -column 5  \
		-sticky e
	grid $base.entry#57 -in $base.frame#27	-row 2 -column 6  \
		-sticky w
	grid $base.label#56 -in $base.frame#24	-row 3 -column 1  \
		-sticky e
	grid $base.entry#48 -in $base.frame#24	-row 3 -column 2  \
		-sticky w
	grid $base.label#55 -in $base.frame#24	-row 3 -column 3  \
		-sticky e
	grid $base.entry#47 -in $base.frame#24	-row 3 -column 4  \
		-sticky w
	grid $base.label#35 -in $base.frame#16	-row 3 -column 1  \
		-sticky e
	grid $base.entry#32 -in $base.frame#16	-row 3 -column 2  \
		-sticky w
	grid $base.label#34 -in $base.frame#16	-row 3 -column 3  \
		-sticky e
	grid $base.entry#31 -in $base.frame#16	-row 3 -column 4  \
		-sticky w
	grid $base.label#67 -in $base.frame#27	-row 3 -column 1  \
		-columnspan 3 \
		-sticky e
	grid $base.indexAgeEntry -in $base.frame#27	-row 3 -column 4  \
		-columnspan 3 \
		-sticky w
	grid $base.checkbutton#2 -in $base.frame#12	-row 1 -column 1 
	grid $base.label#42 -in $base.frame#12	-row 1 -column 3  \
		-sticky e
	grid $base.entry#59 -in $base.frame#12	-row 1 -column 4  \
		-sticky w
	grid $base.helpButton -in $base.frame#12	-row 1 -column 6 
	grid $base.quitButton -in $base.frame#12	-row 1 -column 7 
	grid $base.nextButton -in $base.frame#12	-row 1 -column 8 

	# Resize behavior management

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

	grid rowconfigure $base.frame#24 1 -weight 0 -minsize 30
	grid rowconfigure $base.frame#24 2 -weight 0 -minsize 30
	grid rowconfigure $base.frame#24 3 -weight 0 -minsize 30
	grid columnconfigure $base.frame#24 1 -weight 0 -minsize 30
	grid columnconfigure $base.frame#24 2 -weight 1 -minsize 30
	grid columnconfigure $base.frame#24 3 -weight 0 -minsize 30
	grid columnconfigure $base.frame#24 4 -weight 1 -minsize 30

	grid rowconfigure $base.frame#16 1 -weight 0 -minsize 30
	grid rowconfigure $base.frame#16 2 -weight 0 -minsize 30
	grid rowconfigure $base.frame#16 3 -weight 0 -minsize 30
	grid columnconfigure $base.frame#16 1 -weight 0 -minsize 30
	grid columnconfigure $base.frame#16 2 -weight 1 -minsize 30
	grid columnconfigure $base.frame#16 3 -weight 0 -minsize 30
	grid columnconfigure $base.frame#16 4 -weight 1 -minsize 30

	grid rowconfigure $base.frame#12 1 -weight 0 -minsize 30
	grid columnconfigure $base.frame#12 1 -weight 0 -minsize 30
	grid columnconfigure $base.frame#12 2 -weight 0 -minsize 30
	grid columnconfigure $base.frame#12 3 -weight 0 -minsize 30
	grid columnconfigure $base.frame#12 4 -weight 0 -minsize 30
	grid columnconfigure $base.frame#12 5 -weight 1 -minsize 30
	grid columnconfigure $base.frame#12 6 -weight 0 -minsize 30
	grid columnconfigure $base.frame#12 7 -weight 0 -minsize 30
	grid columnconfigure $base.frame#12 8 -weight 0 -minsize 30

	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 1 -minsize 30
	grid columnconfigure $root 1 -weight 1 -minsize 30

	grid rowconfigure $base.frame#8 1 -weight 0 -minsize 30
	grid rowconfigure $base.frame#8 2 -weight 0 -minsize 30
	grid columnconfigure $base.frame#8 1 -weight 0 -minsize 30
	grid columnconfigure $base.frame#8 2 -weight 1 -minsize 30
	grid columnconfigure $base.frame#8 3 -weight 0 -minsize 30
	grid columnconfigure $base.frame#8 4 -weight 0 -minsize 30
	grid columnconfigure $base.frame#8 5 -weight 1 -minsize 30
	grid columnconfigure $base.frame#8 6 -weight 0 -minsize 30
	grid columnconfigure $base.frame#8 7 -weight 0 -minsize 30
	grid columnconfigure $base.frame#8 8 -weight 1 -minsize 30
	grid columnconfigure $base.frame#8 9 -weight 0 -minsize 56

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

	grid rowconfigure $base.frame#27 1 -weight 0 -minsize 30
	grid rowconfigure $base.frame#27 2 -weight 1 -minsize 30
	grid rowconfigure $base.frame#27 3 -weight 0 -minsize 30
	grid columnconfigure $base.frame#27 1 -weight 1 -minsize 30
	grid columnconfigure $base.frame#27 2 -weight 0 -minsize 30
	grid columnconfigure $base.frame#27 3 -weight 0 -minsize 30
	grid columnconfigure $base.frame#27 4 -weight 0 -minsize 30
	grid columnconfigure $base.frame#27 5 -weight 0 -minsize 30
	grid columnconfigure $base.frame#27 6 -weight 0 -minsize 30

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

	grid rowconfigure $base.frame#10 1 -weight 0 -minsize 30
	grid rowconfigure $base.frame#10 2 -weight 0 -minsize 30
	grid rowconfigure $base.frame#10 3 -weight 0 -minsize 30
	grid columnconfigure $base.frame#10 1 -weight 0 -minsize 30
	grid columnconfigure $base.frame#10 2 -weight 1 -minsize 30
	grid columnconfigure $base.frame#10 3 -weight 0 -minsize 30
	grid columnconfigure $base.frame#10 4 -weight 1 -minsize 30
	grid columnconfigure $base.frame#10 5 -weight 0 -minsize 30
	grid columnconfigure $base.frame#10 6 -weight 1 -minsize 30

	grid rowconfigure $base.frame#23 1 -weight 0 -minsize 30
	grid columnconfigure $base.frame#23 1 -weight 0 -minsize 30
	grid columnconfigure $base.frame#23 2 -weight 1 -minsize 30
# additional interface code
# Interface code for Plot

global models glob

#set header 	"     ID        a     b   c  S0   S  Sm  t0  H0c" 
set models {
	{ 0 0 0 "    None  (data only)                         "}    
	{ 1 4 1 " 1. ALOCAL    L1    G1  G2   0  G3  G4   0   0"}
	{ 2 5 1 " 2. A-T0      L1    G1  G2   0  G3  G4  G5   0"}
	{ 3 5 1 " 3. A-H0      L1    G1  G2   0  G3  G4   0  G5"}
	{ 4 5 1 " 4. A-S0      L1    G1  G2  G3  G4  G5   0   0"}
	{ 5 6 1 " 5. A-T0S0    L1    G1  G2  G3  G4  G5  G6   0"}
	{ 6 4 1 "14. ALOCBH    L1    G1  G2   0  G3  G4  bt bh^c"}
	{ 7 4 1 " 6. BLOCAL    G1    L1  G2   0  G3  G4   0   0"}
	{ 8 5 1 " 7. B-T0      G1    L1  G2   0  G3  G4  G5   0"}
	{ 9 5 1 " 8. B-H0      G1    L1  G2   0  G3  G4   0  G5"}
	{10 5 1 " 9. B-S0      G1    L1  G2  G3  G4  G5   0   0"}
	{11 6 1 "10. B-T0S0    G1    L1  G2  G3  G4  G5  G6   0"}
	{12 4 1 "15. BLOCBH    G1    L1  G2   0  G3  G4  bt bh^c"}
}

proc SetModel {n} {
	global glob models base
	set modlist [lindex $models $n]
	set glob(model) [lindex $modlist 0]
	if {$glob(model) == 0} {
		foreach p {a b c t0 h0c} {
			set pp(0) $p
			set glob($p) {}
			.$pp(0)Entry configure -state disabled
		}
		return
	}
	set pars [lindex $modlist 3]
	array set idx [list a 2 b 3 c 4 t0 8 h0c 9]
	foreach p "[array names idx]" {
		if {[regexp G [lindex $pars $idx($p)]]} {
			.${p}Entry configure -state normal
			set glob($p) {}
		} elseif {[regexp L [lindex $pars $idx($p)]]} {
			.${p}Entry configure -state disabled
			set glob($p) local
		} else {
			.${p}Entry configure -state disabled
			set glob($p) [lindex $pars $idx($p)]
		}
	}
} 


proc DataFile {} {
	global glob
	set types {
		{{Data Files} {.dat}}
		{{Text Files} {.txt}}
		{{All Files} * }
	}
	set glob(dataFile) [tk_getOpenFile -filetypes $types -initialdir Work]
}

proc OK {} {
	global nextFlag
	set nextFlag 1
}

menu $base.modelMenubutton.m -tearoff 0 -background white -relief sunken \
	-font {-*-Courier New-Medium-R-Normal-*-*-120-*-*-*-*-*-*}
for {set i 0} {$i < [llength $models]} {incr i} {
	$base.modelMenubutton.m add radio -variable buttlabel -value ""  \
		-label [lindex [lindex $models $i] 3] -command "SetModel $i"
}

$base.modelMenubutton.m invoke 0




















































# end additional interface code

}


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

catch {
    if [info exists embed_args] {
	# we are running in the plugin
	Plot_ui .
    } else {
	# we are running in stand-alone mode
	if {$argv0 == [info script]} {
	    wm title . "Testing Plot_ui"
	    Plot_ui .
	}
    }
}
