diff -r 9aa865195c24 -r 2bdd3f8b7864 gamma.tk --- a/gamma.tk Sun Oct 22 22:56:16 2006 +0200 +++ b/gamma.tk Mon Oct 23 00:35:20 2006 +0200 @@ -1,4 +1,4 @@ -#!/bin/wish +#!/usr/bin/wish set wheight 400 set wwidth 800 @@ -58,6 +58,7 @@ set mFile [menu .mb.mFile] .mb add cascade -label File -menu .mb.mFile +$mFile add command -label New -command new_points $mFile add command -label Load -command load_file $mFile add command -label Save -command save_file $mFile add separator @@ -225,16 +226,18 @@ return } set fd [open $file w] - puts "# plot for gnuplot" - puts "# plot 'data' index 0 title 'vermell', 'data' index 1 title 'verd', 'data' index 2 title 'blau'" + puts $fd "# plot for gnuplot" + puts $fd "# plot 'data' index 0 title 'vermell', 'data' index 1 title 'verd', 'data' index 2 title 'blau'" foreach t { rpoints gpoints bpoints } { + puts $fd "# $t" foreach i [set $t] { puts -nonewline $fd [join $i " "] puts $fd "" } if { $t != "bpoints"} { puts $fd "" + puts $fd "" } } @@ -267,7 +270,7 @@ } } } else { - if { [string index $line] != "#" } { + if { [string index $line 0] != "#" } { lappend ${type}points [split $line " "] } } @@ -283,5 +286,16 @@ prepare_colors_newpoint } +proc new_points { } { + global rpoints gpoints bpoints + + set rpoints {{0 0.} {65535 1.}} + set gpoints {{0 0.} {65535 1.}} + set bpoints {{0 0.} {65535 1.}} + + prepare_colors_newpoint +} + + # Prepare the colors for the user, for the first time! prepare_colors_newpoint