Index: mttroot/mtt/bin/trans/struc2gnuplot_txt2wish ================================================================== --- mttroot/mtt/bin/trans/struc2gnuplot_txt2wish +++ mttroot/mtt/bin/trans/struc2gnuplot_txt2wish @@ -19,11 +19,19 @@ exec wish "\$0" "\$@" ## main window wm title . "MTT Viewer: ${sys}" -button .print -text "Print" -command print +set parameter "" +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 @@ -41,12 +49,12 @@ .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 <> { plot [ .cx.l get anchor ] } -bind .cy.l <> { plot [ .cy.l get anchor ] } +bind .cx.l <> { set parameter [ .cx.l get anchor ] ; plot \$parameter } +bind .cy.l <> { 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] @@ -146,15 +154,26 @@ 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}