Differences From Artifact [0b8b18566d]:

To Artifact [13b6fd0e28]:


30
31
32
33
34
35
36


















37
38
39
40

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69


70
71
72
73


74
75
76
77
78
79
80







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+




+










-
-




-
-







.menubar.file.menu add command -label "Open  (Gnuplot plot file)"    -command open_plotfile
.menubar.file.menu add command -label "Save  (Gnuplot plot file)"    -command save_plotfile
.menubar.file.menu add separator
.menubar.file.menu add command -label "Print (PostScript file)"	     -command print_postscript
.menubar.file.menu add separator
.menubar.file.menu add command -label "Quit"			     -command exit

menubutton .menubar.edit -text "Edit" -menu .menubar.edit.menu
menu .menubar.edit.menu
.menubar.edit.menu add cascade -label "Axes" -menu .menubar.edit.menu.axes
.menubar.edit.menu add cascade -label "Grid" -menu .menubar.edit.menu.grid
.menubar.edit.menu add cascade -label "Key"  -menu .menubar.edit.menu.key

menu .menubar.edit.menu.axes
.menubar.edit.menu.axes add command -label "Cartesian" -command { puts "set nopolar ; replot" }
.menubar.edit.menu.axes add command -label "Polar"     -command { puts "set   polar ; replot" }

menu .menubar.edit.menu.grid
.menubar.edit.menu.grid add command -label "Show Grid" -command { puts "set   grid ; replot" }
.menubar.edit.menu.grid add command -label "Hide Grid" -command { puts "set nogrid ; replot" }

menu .menubar.edit.menu.key
.menubar.edit.menu.key add command -label "Show Key"   -command { puts "set   key ; replot" }
.menubar.edit.menu.key add command -label "Hide Key"   -command { puts "set nokey ; replot" }

button .menubar.xmtt  -text "xMTT" -relief flat		 -command { exec xmtt }
button .menubar.quit  -text "Quit" -relief flat		 -command exit 

pack .menubar.file    -expand false -fill x -side left
pack .menubar.edit    -expand false -fill x -side left
pack .menubar.xmtt    -expand false -fill x -side left
pack .menubar.quit    -expand false -fill x -side right

# status bar
canvas .statusbar

radiobutton .statusbar.states  -text "States"      -value states  -variable view      -relief solid -command { raise .cx }
radiobutton .statusbar.outputs -text "Outputs"     -value outputs -variable view      -relief solid -command { raise .cy }

tk_optionMenu .statusbar.plot  plottype "Single Plot" "Multi Plot" "New Window"
tk_optionMenu .statusbar.grid  grid     "Grid On" "Grid Off"
tk_optionMenu .statusbar.coord coord	"Cartesian" "Polar"

pack .statusbar.states  -expand false -fill x -side left
pack .statusbar.outputs -expand false -fill x -side left
pack .statusbar.plot    -expand false -fill x -side right
pack .statusbar.coord   -expand false -fill x -side right
pack .statusbar.grid    -expand false -fill x -side right

## states canvas
canvas		.cx
listbox		.cx.l
scrollbar	.cx.sy	-orient v
checkbutton    	.cx.t	-text		"States"	-relief flat

164
165
166
167
168
169
170
171
172





173
174
175
176
177
178
179
180
181
182
183











184
185
186


187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
179
180
181
182
183
184
185

186
187
188
189
190
191











192
193
194
195
196
197
198
199
200
201
202



203
204













205
206
207
208
209
210
211







-

+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-







' Title=\$title Ny=${Ny} ${struc} >> ${out}


cat <<EOF >> ${out}

## call gnuplot
proc "plot_var" "title column" {
    set_plot_options
    puts "set term X11"
    global first_plot
    if {"\$first_plot" == 1} {
        set first_plot 0
        set plot "plot"
    } else {
    global plottype
    if {"\$plottype" == "Multi Plot"} {
	set plot "replot"
    } elseif {"\$plottype" == "New Window"} {
	global windownum
	set windownum [ expr \$windownum + 1 ]
	puts "set terminal x11 \$windownum"
	set plot "plot"
    } else {
	set plot "plot"
    }
	global plottype
	if {"\$plottype" == "Multi Plot"} {
	    set plot "replot"
	} elseif {"\$plottype" == "New Window"} {
	    global windownum
	    set windownum [ expr \$windownum + 1 ]
	    puts "set terminal x11 \$windownum"
	    set plot "plot"
	} else {
	    set plot "plot"
	}
    puts "\$plot '${dat2}' using 1:\$column title '\$title' with lines"
}

    }
    puts "\$plot '${dat2}' using 1:\$column title '\$title' with lines"
proc "set_plot_options" "" {
    global coord;			# "Cartesian", "Polar"
    global grid;			# "Grid On", "Grid Off"
    if {"\$coord" == "Cartesian"} {
	puts "set nopolar"
    } else {
	puts "set polar"
    }
    if {"\$grid" == "Grid On"} {
	puts "set grid"
    } else {
	puts "set nogrid"
    }
}

## open gnuplot plot file
proc "open_plotfile" "" {
    global parameter
    if {"\$parameter"==""} {
	set name "${sys}.plt"
259
260
261
262
263
264
265






266
267
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278







+
+
+
+
+
+


	    puts "set output '\$filename'"
	    puts "replot"
	    tk_dialog ".printed" "Graph Printed!" "PostScript saved as \$filename" "" "0" "Close"
	}
    }
}

# Defaults
puts "set key"
puts "set grid"
puts "set nopolar"
set first_plot 1

EOF
chmod +x ${out}

MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]