17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
+
-
+
+
+
+
+
+
+
+
|
#!/bin/sh
# Next line replaces shell with wish\\
exec wish "\$0" "\$@"
## main window
wm title . "MTT Viewer: ${sys}"
set parameter ""
button .print -text "Print" -command print
button .print -text "Print" -command {
global parameter;
if {"\$parameter"==""} {
tk_dialog ".mtt_Print_Error" "Print Error" "Select a parameter!" "" "0" "Try Again"
} else {
print \$parameter
}
}
button .quit -text "Quit" -command exit
## states canvas
canvas .cx
listbox .cx.l
scrollbar .cx.sy -orient v
checkbutton .cx.t -text "States"
|
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
-
-
+
+
|
## configure scrollbars
.cx.sy configure -command ".cx.l yview"
.cy.sy configure -command ".cy.l yview"
.cx.l configure -yscrollcommand ".cx.sy set"
.cy.l configure -yscrollcommand ".cy.sy set"
## bind lists
bind .cx.l <<ListboxSelect>> { plot [ .cx.l get anchor ] }
bind .cy.l <<ListboxSelect>> { plot [ .cy.l get anchor ] }
bind .cx.l <<ListboxSelect>> { set parameter [ .cx.l get anchor ] ; plot \$parameter }
bind .cy.l <<ListboxSelect>> { set parameter [ .cy.l get anchor ] ; plot \$parameter }
proc "reverse_name" "name" {
set delim "_"
set split_name [split \$name \$delim]
set reversed_name [lindex \$split_name 0]
for {set i 1} {\$i<[llength \$split_name]} {incr i} {
set reversed_name [lindex \$split_name \$i]\$delim\$reversed_name
|
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
proc "plot_var" "title column" {
exec echo plot \"${dat2}\" using 1:\$column title \"\$title\" with lines > ${tmp}
exec echo pause -1 >> ${tmp}
exec gnuplot -title "\$title" ${tmp} &
}
## print output
proc "print" "" {
exec echo set term postscript > ${tmp}.print
exec echo set output \"../${sys}_gnuplot.ps\" >> ${tmp}.print
exec grep -v pause ${tmp} >> ${tmp}.print
exec gnuplot ${tmp}.print
puts "Graph printed to ${sys}_gnuplot.ps"
proc "print" "parameter" {
set filename [tk_getSaveFile\
-initialdir ".."\
-initialfile "\$parameter.ps"\
-defaultextension ".ps"\
-filetypes {
{{Postscript} {.ps}}
{{All files} {*}}
}
]
if {\$filename != ""} {
exec echo set term postscript > ${tmp}.print
exec echo set output \"\$filename\" >> ${tmp}.print
exec grep -v pause ${tmp} >> ${tmp}.print
exec gnuplot ${tmp}.print
puts "Graph printed to \$filename"
}
}
EOF
chmod +x ${out}
|