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

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

proc RunLog_ui {root args} {

	# this treats "." as a special case

	if {$root == "."} {
	    set base ""
	} else {
	    set base $root
	}
    
	frame $base.frame#1

	text $base.logText \
		-height 26 \
		-width 82 \
		-wrap word \
		-yscrollcommand "$base.scrollbar#1 set"
	catch {
		$base.logText configure \
			-font -*-Courier-Medium-R-Normal-*-*-120-*-*-*-*-*-*
	}

	scrollbar $base.scrollbar#1 \
		-command "$base.logText yview"

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

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

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

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


	# Geometry management

	grid $base.frame#1 -in $root	-row 2 -column 1  \
		-columnspan 2 \
		-sticky ew
	grid $base.logText -in $root	-row 1 -column 1  \
		-sticky nesw
	grid $base.scrollbar#1 -in $root	-row 1 -column 2  \
		-sticky nsw
	grid $base.saveButton -in $base.frame#1	-row 1 -column 1  \
		-sticky w
	grid $base.button#6 -in $base.frame#1	-row 1 -column 3 
	grid $base.quitButton -in $base.frame#1	-row 1 -column 4 
	grid $base.nextButton -in $base.frame#1	-row 1 -column 5 

	# Resize behavior management

	grid rowconfigure $root 1 -weight 1 -minsize 30
	grid rowconfigure $root 2 -weight 0 -minsize 30
	grid columnconfigure $root 1 -weight 1 -minsize 30
	grid columnconfigure $root 2 -weight 0 -minsize 17

	grid rowconfigure $base.frame#1 1 -weight 0 -minsize 30
	grid columnconfigure $base.frame#1 1 -weight 0 -minsize 30
	grid columnconfigure $base.frame#1 2 -weight 1 -minsize 30
	grid columnconfigure $base.frame#1 3 -weight 0 -minsize 30
	grid columnconfigure $base.frame#1 4 -weight 0 -minsize 30
	grid columnconfigure $base.frame#1 5 -weight 0 -minsize 30
# additional interface code
proc Next {} {
	global nextFlag
	set nextFlag 1
}

proc Save {base} {
	global globinfo
	if {[string length $globinfo(ext)]} {
		set t "[string toupper $globinfo(ext)] Files"
		set t [list $t .$globinfo(ext)]
		set t [list $t {{All Files} * }]
		set logFile [tk_getSaveFile -title "Saving" -defaultextension .$globinfo(ext) -filetypes $t -initialdir Work]
	} else {
		set logFile [tk_getSaveFile -title "Saving"]
	}
	if {$logFile == {}} return
	if {[catch {set logFile [open $logFile w]} err]} {
		 tk_messageBox -type ok -message $err -icon error
	} else {
		puts $logFile [$base.logText get 0.0 end]
		flush $logFile
		close $logFile
		set globinfo(saved) 1
	}
}
















# 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
	RunLog_ui .
    } else {
	# we are running in stand-alone mode
	if {$argv0 == [info script]} {
	    wm title . "Testing RunLog_ui"
	    RunLog_ui .
	}
    }
}
