Index: mttroot/mtt/bin/trans/struc2gnuplot_txt2wish ================================================================== --- mttroot/mtt/bin/trans/struc2gnuplot_txt2wish +++ mttroot/mtt/bin/trans/struc2gnuplot_txt2wish @@ -77,11 +77,10 @@ } return \$list } proc "sort_list" "list sortorder" { - puts "sortorder: \$sortorder" if ("\$sortorder"=="normal") { return [lsort -ascii \$list] } if ("\$sortorder"=="reverse") { return [reverse_sort \$list] @@ -116,18 +115,25 @@ pack .cy.l -expand true -fill both -side left pack .cx -expand true -fill both place .cy -in .cx -relx 0 -rely 0 -relwidth 1 -relheight 1 -anchor nw -bordermode outside -radiobutton .states -text "States" -value states -variable view -command { raise .cx } -relief solid -radiobutton .outputs -text "Outputs" -value outputs -variable view -command { raise .cy } -relief solid +radiobutton .states -text "States" -value states -variable view -relief solid -command { raise .cx } +radiobutton .outputs -text "Outputs" -value outputs -variable view -relief solid -command { raise .cy } + +#menubutton .plottype -text "Plot type" -menu .plottype.plottype + +#menu .plottype.plottype +tk_optionMenu .plottype plottype "Single Plot"\ + "Multi Plot "\ + "New Window " pack .states .outputs -side left pack .quit -expand false -fill x -side right pack .print -expand false -fill x -side right - +pack .plottype -expand false -fill x -side top ## map names to column numbers EOF gawk ' @@ -148,14 +154,20 @@ cat <> ${out} ## call gnuplot proc "plot_var" "title column" { - exec echo set grid\; > ${tmp} - exec echo plot \"${dat2}\" using 1:\$column title \"\$title\" with lines\; >> ${tmp} - exec echo exit\; >> ${tmp} - exec gnuplot -geometry 400x300 -persist -title "\$title" ${tmp} & + puts "set grid" + puts "set term X11" + global plottype + if {"\$plottype" == "Multi Plot "} { + puts "replot '${dat2}' using 1:\$column title '\$title' with lines" + } elseif {"\$plottype" == "New Window "} { + puts "! echo \"plot '${dat2}' using 1:\$column title '\$title' with lines\" | gnuplot -geometry 400x300 -persist" + } else { + puts "plot '${dat2}' using 1:\$column title '\$title' with lines" + } } ## print output proc "print" "parameter" { set filename [tk_getSaveFile\ @@ -166,15 +178,14 @@ {{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" + puts "set term postscript" + puts "set output \"\$filename\"" + puts "replot" + tk_dialog ".printed" "Graph Printed!" "PostScript saved as \$filename" "" "0" "Close" } } EOF chmod +x ${out} Index: mttroot/mtt/lib/rep/gnuplot_rep.make ================================================================== --- mttroot/mtt/lib/rep/gnuplot_rep.make +++ mttroot/mtt/lib/rep/gnuplot_rep.make @@ -4,11 +4,11 @@ MTTFLAGS = $(OPTS) all: $(SYS)_gnuplot.$(LANG) $(SYS)_gnuplot.view: $(SYS)_gnuplot.wish $(SYS)_odes.dat2 - sh $(SYS)_gnuplot.wish + sh $(SYS)_gnuplot.wish | gnuplot -geometry 400x300 $(SYS)_gnuplot.wish: $(SYS)_struc.txt $(MTTPATH)/trans/struc2gnuplot_txt2wish $(SYS) $(SYS)_gnuplot.txt: $(SYS)_struc.txt $(MTTPATH)/trans/struc2gnuplot_txt.exe