5 # Set path to gnuplot on windows, if required
6 if { $tcl_platform(platform
) eq
"windows"} {
7 # If gnuplot isn't in the path, then guess location and add to path
8 if { [auto_execok gnuplot
] eq
"" } {
9 # Path to mgnuplot executable
10 set mypath
[file dirname $argv0]
11 # gnuplot.exe location relative to mgnuplot.exe in windows installer
12 set gnuplotpath
[file normalize
"${mypath}/../../../../gnuplot/bin"]
13 set ::env
(PATH
) "$::env(PATH);$gnuplotpath"
17 #set gnuPlotstream [open {| gnuplot /d19/staff/wfs/tmp/jo } w]
18 set gnuPlotstream
[open
{| gnuplot
} r
+]
23 puts stdout
$com ; flush stdout
24 puts
$gnuPlotstream $com ; flush
$gnuPlotstream
29 switch
-exact "X[lindex $argv $ii]" {
31 sendgnu
"set parametric\n"
32 sendgnu
"set data style lines\n"
33 sendgnu
"set hidden\n"
34 set ii
[expr {$ii + 1}]
35 sendgnu
"splot '[lindex $argv $ii]'\n" }
37 set ii
[expr {$ii + 1}]
38 sendgnu
"set data style lines"
39 sendgnu
"plot '[lindex $argv $ii]'\n"
42 set ii
[expr {$ii + 1}]
43 sendgnu
"set title '[lindex $argv $ii]'\n" }
46 set ii
[expr {$ii +1}]
54 .text configure
-height 4 -width 40
57 # unlink gnu-optionsxx
59 file delete
-force $tmp
60 sendgnu
"save '$tmp'\n"
61 # 50 ms delay in loop is arbitrary, was "exec sleep 0"
62 while {[file exists
$tmp] <= 0} {after
50}
63 set at [.fra.options nearest
0]
64 set f
[ open gnu-optionsxx
]
65 .fra.options delete
0 end
66 while { [gets
$f line
] >= 0 } {
67 .fra.options insert end
[lrange
$line 0 end
]}
68 .fra.options yview
$at
72 label .fra.label
-text "Current Set Options"
73 scrollbar .fra.scroll
-command ".fra.options yview"
74 listbox .fra.options
-yscrollcommand ".fra.scroll set" -relief sunken
-bd 2
76 pack .fra.options
-side left
77 pack .fra.scroll
-side right
-fill y
78 bind .fra.options
<Double-1
> "set selected_option \[lindex \[selection get\] 0\]"
82 sendgnu
[format
"%s\n\nreplot\n" [expr $
$a]] ;
86 proc mkOption_edit
{a b
} {
88 label
$a.label
-text "Edit: "
89 entry
$a.entry
-width 20 -relief sunken
-bd 2 -textvariable $b
90 bind $a.entry
<Return
> "msg $b"
91 pack
$a.label
$a.entry
-side left
-padx 1m
-pady 2m
94 mkOption_edit .option_edit selected_option
99 button .
exit -text "Exit" -command {
104 button .save
-text "save gnuplot.out" -command {
105 sendgnu
"save 'gnuplot.out'\n"
108 scale .rotxscale
-label "xrotation" \
109 -orient horizontal
-length 200 -from 0 -to 180 \
110 -command gnuPlotsetview
-tickinterval 60
111 scale .rotzscale
-label "zrotation" \
112 -orient horizontal
-length 200 -from 0 -to 360 \
113 -command gnuPlotsetview
-tickinterval 120
119 proc gnuPlotsetview value
{
121 if { $initted < 2 } { set initted
[expr {$initted + 1}]} \
123 {sendgnu
[format
"set view %d,%d\nreplot\n" [.rotxscale get
] [.rotzscale get
]]}}
125 pack .
exit .rotxscale .rotzscale .fra .option_edit .save