From eea857b01891eeaf5d8a8d876b07cfc04a0cafdb Mon Sep 17 00:00:00 2001 From: William Joye Date: Fri, 31 May 2019 17:12:06 -0400 Subject: add multiple plot support --- ds9/library/markeranalysishist.tcl | 9 +- ds9/library/markeranalysisplot2d.tcl | 9 +- ds9/library/markeranalysisplot3d.tcl | 9 +- ds9/library/markeranalysisradial.tcl | 11 +- ds9/library/plot.tcl | 342 ++++++++++++++++------------------- ds9/library/plotbar.tcl | 32 ++-- ds9/library/plotconfig.tcl | 9 - ds9/library/plotdata.tcl | 289 +++++++++++++++-------------- ds9/library/plotdialog.tcl | 43 ++--- ds9/library/plotline.tcl | 25 +-- ds9/library/plotprint.tcl | 25 ++- ds9/library/plotprocess.tcl | 13 +- ds9/library/plotscatter.tcl | 41 ++--- ds9/library/plotstate.tcl | 210 ++++++++------------- ds9/parsers/plotparser.tac | 2 +- ds9/parsers/plotparser.tcl | 2 +- ds9/parsers/plotsendparser.tac | 2 +- ds9/parsers/plotsendparser.tcl | 2 +- 18 files changed, 483 insertions(+), 592 deletions(-) diff --git a/ds9/library/markeranalysishist.tcl b/ds9/library/markeranalysishist.tcl index a3f7f2a..cd1a926 100644 --- a/ds9/library/markeranalysishist.tcl +++ b/ds9/library/markeranalysishist.tcl @@ -80,13 +80,12 @@ proc MarkerAnalysisHistogramCB {frame id} { } PlotLineDialog $vvarname $tt Histogram $bunit Counts - set tt $vvar(graph,total) set cc $vvar(graph,current) - set vvar(graph$cc,manage) 0 - set vvar(graph$cc,dim) xy - set vvar(graph$cc,xdata) $xdata - set vvar(graph$cc,ydata) $ydata + set vvar($cc,manage) 0 + set vvar($cc,dim) xy + set vvar($cc,xdata) $xdata + set vvar($cc,ydata) $ydata blt::vector create $xdata $ydata } diff --git a/ds9/library/markeranalysisplot2d.tcl b/ds9/library/markeranalysisplot2d.tcl index 87b02f3..0fffe24 100644 --- a/ds9/library/markeranalysisplot2d.tcl +++ b/ds9/library/markeranalysisplot2d.tcl @@ -169,13 +169,12 @@ proc MarkerAnalysisPlot2dCB {frame id} { $vvar(graph) xaxis configure \ -command "MarkerAnalysisPlot2dXAxis $vvarname" - set tt $vvar(graph,total) set cc $vvar(graph,current) - set vvar(graph$cc,manage) 0 - set vvar(graph$cc,dim) xy - set vvar(graph$cc,xdata) $xdata - set vvar(graph$cc,ydata) $ydata + set vvar($cc,manage) 0 + set vvar($cc,dim) xy + set vvar($cc,xdata) $xdata + set vvar($cc,ydata) $ydata blt::vector create $xdata $ydata $xcdata $ycdata } diff --git a/ds9/library/markeranalysisplot3d.tcl b/ds9/library/markeranalysisplot3d.tcl index 4591d22..3546fba 100644 --- a/ds9/library/markeranalysisplot3d.tcl +++ b/ds9/library/markeranalysisplot3d.tcl @@ -174,13 +174,12 @@ proc MarkerAnalysisPlot3dCB {frame id} { set vvar(mode) pointer PlotChangeMode $vvarname - set tt $vvar(graph,total) set cc $vvar(graph,current) - set vvar(graph$cc,manage) 0 - set vvar(graph$cc,dim) xy - set vvar(graph$cc,xdata) $xdata - set vvar(graph$cc,ydata) $ydata + set vvar($cc,manage) 0 + set vvar($cc,dim) xy + set vvar($cc,xdata) $xdata + set vvar($cc,ydata) $ydata blt::vector create $xdata $ydata } diff --git a/ds9/library/markeranalysisradial.tcl b/ds9/library/markeranalysisradial.tcl index 81f9db9..aea882a 100644 --- a/ds9/library/markeranalysisradial.tcl +++ b/ds9/library/markeranalysisradial.tcl @@ -107,14 +107,13 @@ proc MarkerAnalysisRadialCB {frame id} { PlotLineDialog $vvarname $tt "Radial Profile" $sys {} MarkerAnalysisRadialAxisTitle $vvarname - set tt $vvar(graph,total) set cc $vvar(graph,current) - set vvar(graph$cc,manage) 0 - set vvar(graph$cc,dim) xyey - set vvar(graph$cc,xdata) $xdata - set vvar(graph$cc,ydata) $ydata - set vvar(graph$cc,yedata) $yedata + set vvar($cc,manage) 0 + set vvar($cc,dim) xyey + set vvar($cc,xdata) $xdata + set vvar($cc,ydata) $ydata + set vvar($cc,yedata) $yedata blt::vector create $xdata $ydata $yedata } diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl index a482f7e..e26bfb2 100644 --- a/ds9/library/plot.tcl +++ b/ds9/library/plot.tcl @@ -24,15 +24,12 @@ proc PlotLayoutCanvas {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) - set cc $var(graph,current) - - for {set ii 1} {$ii<=$tt} {incr ii} { - pack forget $var(graph$ii) + foreach cc $var(graphs) { + pack forget $var($cc) } - for {set ii 1} {$ii<=$tt} {incr ii} { - pack $var(graph$ii) -side top -expand yes -fill both + foreach cc $var(graphs) { + pack $var($cc) -side top -expand yes -fill both } } @@ -44,35 +41,33 @@ proc PlotAddGraph {varname} { global ds9 global pap - PlotSaveState $varname + if {$var(graphs) != {}} { + PlotSaveState $varname + } - incr ${varname}(graph,total) - incr ${varname}(graph,current) + incr ${varname}(seq) + set cc "graph$var(seq)" + lappend var(graphs) $cc + set var(graph,current) $cc - set tt $var(graph,total) - set cc $var(graph,current) + set var($cc,data,total) 0 + set var($cc,data,current) 0 - set var(graph$cc,data,total) 0 - set var(graph$cc,data,current) 0 - - set var(graph$cc,xdata) {} - set var(graph$cc,ydata) {} - set var(graph$cc,xedata) {} - set var(graph$cc,yedata) {} + set var($cc,xdata) {} + set var($cc,ydata) {} + set var($cc,xedata) {} + set var($cc,yedata) {} array set $varname [array get pap] - PlotInitState $varname - $var(proc,addgraph) $varname # set up zoom stack, assuming mode is zoom global ds9 switch $ds9(wm) { x11 - - win32 {Blt_ZoomStack $var(graph$cc) -mode release} - aqua {Blt_ZoomStack $var(graph$cc) -mode release \ - -button "ButtonPress-2"} + win32 {Blt_ZoomStack $var($cc) -mode release} + aqua {Blt_ZoomStack $var($cc) -mode release -button "ButtonPress-2"} } PlotLayoutCanvas $varname @@ -83,11 +78,9 @@ proc PlotDeleteGraph {varname} { global $varname set cc $var(graph,current) - if {$cc>1} { - destroy $var(graph$cc) - - incr ${varname}(graph,total) -1 - incr ${varname}(graph,current) -1 + if {$cc != {}} { + destroy $var($cc) + list replace ${varname}(graphs) $cc {} } } @@ -96,36 +89,35 @@ proc PlotAddData {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) # warning: uses current vars - if {$var(graph$cc,data,total) == 0} { + if {$var($cc,data,total) == 0} { return } # delete current elements - set nn $var(graph$cc,data,current) - foreach el [$var(graph$cc) element names] { + set nn $var($cc,data,current) + foreach el [$var($cc) element names] { set f [split $el -] if {[lindex $f 1] == $nn} { - $var(graph$cc) element delete $el + $var($cc) element delete $el } } - global $var(graph$cc,xdata) $var(graph$cc,ydata) - $var(graph$cc) element create "d-${nn}" \ - -xdata $var(graph$cc,xdata) -ydata $var(graph$cc,ydata) - if {$var(graph$cc,xedata) != {}} { - if {[$var(graph$cc,xedata) length] != 0} { - $var(graph$cc) element configure "d-${nn}" \ - -xerror $var(graph$cc,xedata) + global $var($cc,xdata) $var($cc,ydata) + $var($cc) element create "d-${nn}" \ + -xdata $var($cc,xdata) -ydata $var($cc,ydata) + if {$var($cc,xedata) != {}} { + if {[$var($cc,xedata) length] != 0} { + $var($cc) element configure "d-${nn}" \ + -xerror $var($cc,xedata) } } - if {$var(graph$cc,yedata) != {}} { - if {[$var(graph$cc,yedata) length] != 0} { - $var(graph$cc) element configure "d-${nn}" \ - -yerror $var(graph$cc,yedata) + if {$var($cc,yedata) != {}} { + if {[$var($cc,yedata) length] != 0} { + $var($cc) element configure "d-${nn}" \ + -yerror $var($cc,yedata) } } } @@ -136,35 +128,34 @@ proc PlotDeleteData {varname} { global ds9 - set tt $var(graph,total) set cc $var(graph,current) - if {$var(graph$cc,data,total) == 0} { + if {$var($cc,data,total) == 0} { return } # first set can be external - set clear $var(graph$cc,1,manage) + set clear $var($cc,1,manage) - for {set nn 1} {$nn<=$var(graph$cc,data,total)} {incr nn} { - if {$var(graph$cc,$nn,manage)} { + for {set nn 1} {$nn<=$var($cc,data,total)} {incr nn} { + if {$var($cc,$nn,manage)} { # delete elements - foreach el [$var(graph$cc) element names] { + foreach el [$var($cc) element names] { set f [split $el -] if {[lindex $f 1] == $nn} { - $var(graph$cc) element delete $el + $var($cc) element delete $el } } # destroy vectors blt::vector destroy \ - $var(graph$cc,$nn,xdata) $var(graph$cc,$nn,ydata) - switch $var(graph$cc,$nn,dim) { + $var($cc,$nn,xdata) $var($cc,$nn,ydata) + switch $var($cc,$nn,dim) { xy {} - xyex {blt::vector destroy $var(graph$cc,$nn,xedata)} - xyey {blt::vector destroy $var(graph$cc,$nn,yedata)} + xyex {blt::vector destroy $var($cc,$nn,xedata)} + xyey {blt::vector destroy $var($cc,$nn,yedata)} xyexey {blt::vector destroy \ - $var(graph$cc,$nn,xedata) $var(graph$cc,$nn,yedata)} + $var($cc,$nn,xedata) $var($cc,$nn,yedata)} } foreach x [array names $varname] { @@ -177,25 +168,25 @@ proc PlotDeleteData {varname} { } if {$clear} { - set var(graph$cc,data,total) 0 - set var(graph$cc,data,current) 0 + set var($cc,data,total) 0 + set var($cc,data,current) 0 set var(graph,ds,name) {} - set var(graph$cc,xdata) {} - set var(graph$cc,ydata) {} - set var(graph$cc,xedata) {} - set var(graph$cc,yedata) {} + set var($cc,xdata) {} + set var($cc,ydata) {} + set var($cc,xedata) {} + set var($cc,yedata) {} # reset other variables - set var(graph$cc,axis,x,auto) 1 - set var(graph$cc,axis,x,min) {} - set var(graph$cc,axis,x,max) {} - set var(graph$cc,axis,x,format) {} - - set var(graph$cc,axis,y,auto) 1 - set var(graph$cc,axis,y,min) {} - set var(graph$cc,axis,y,max) {} - set var(graph$cc,axis,y,format) {} + set var($cc,axis,x,auto) 1 + set var($cc,axis,x,min) {} + set var($cc,axis,x,max) {} + set var($cc,axis,x,format) {} + + set var($cc,axis,y,auto) 1 + set var($cc,axis,y,min) {} + set var($cc,axis,y,max) {} + set var($cc,axis,y,format) {} $var(mb).graph.select delete $ds9(menu,start) end @@ -203,8 +194,8 @@ proc PlotDeleteData {varname} { PlotStats $varname PlotList $varname } else { - set var(graph$cc,data,total) 1 - set var(graph$cc,data,current) 1 + set var($cc,data,total) 1 + set var($cc,data,current) 1 $var(mb).graph.select delete [expr $ds9(menu,start)+1] end PlotCurrentData $varname @@ -216,10 +207,9 @@ proc PlotCurrentGraph {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) - if {$tt > 0} { + if {$cc != {}} { PlotCurrentData $varname } } @@ -228,19 +218,18 @@ proc PlotCurrentData {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) - if {$var(graph$cc,data,total) > 0} { - set nn $var(graph$cc,data,current) + if {$var($cc,data,total) > 0} { + set nn $var($cc,data,current) - set var(graph$cc,manage) $var(graph$cc,$nn,manage) - set var(graph$cc,dim) $var(graph$cc,$nn,dim) + set var($cc,manage) $var($cc,$nn,manage) + set var($cc,dim) $var($cc,$nn,dim) - set var(graph$cc,xdata) $var(graph$cc,$nn,xdata) - set var(graph$cc,ydata) $var(graph$cc,$nn,ydata) - set var(graph$cc,xedata) $var(graph$cc,$nn,xedata) - set var(graph$cc,yedata) $var(graph$cc,$nn,yedata) + set var($cc,xdata) $var($cc,$nn,xdata) + set var($cc,ydata) $var($cc,$nn,ydata) + set var($cc,xedata) $var($cc,$nn,xedata) + set var($cc,yedata) $var($cc,$nn,yedata) PlotRestoreState $varname $nn } @@ -260,18 +249,15 @@ proc PlotChangeMode {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) - set cc $var(graph,current) - - for {set ii 1} {$ii<=$tt} {incr ii} { + foreach cc $var(graphs) { switch $var(mode) { pointer { - blt::RemoveBindTag $var(graph$ii) zoom-$var(graph$ii) - bind $var(graph$ii) <1> [list PlotButton $varname %x %y] + blt::RemoveBindTag $var($cc) zoom-$var($cc) + bind $var($cc) <1> [list PlotButton $varname %x %y] } zoom { - bind $var(graph$ii) <1> {} - blt::AddBindTag $var(graph$ii) zoom-$var(graph$ii) + bind $var($cc) <1> {} + blt::AddBindTag $var($cc) zoom-$var($cc) } } } @@ -283,7 +269,6 @@ proc PlotDestroy {varname} { global iap - set tt $var(graph,total) set cc $var(graph,current) # see if it still is around @@ -291,26 +276,26 @@ proc PlotDestroy {varname} { return } - for {set nn 1} {$nn<=$var(graph$cc,data,total)} {incr nn} { - switch $var(graph$cc,$nn,dim) { + for {set nn 1} {$nn<=$var($cc,data,total)} {incr nn} { + switch $var($cc,$nn,dim) { xy { blt::vector destroy \ - $var(graph$cc,$nn,xdata) $var(graph$cc,$nn,ydata) + $var($cc,$nn,xdata) $var($cc,$nn,ydata) } xyex { blt::vector destroy \ - $var(graph$cc,$nn,xdata) $var(graph$cc,$nn,ydata) \ - $var(graph$cc,$nn,xedata) + $var($cc,$nn,xdata) $var($cc,$nn,ydata) \ + $var($cc,$nn,xedata) } xyey { blt::vector destroy \ - $var(graph$cc,$nn,xdata) $var(graph$cc,$nn,ydata) \ - $var(graph$cc,$nn,yedata) + $var($cc,$nn,xdata) $var($cc,$nn,ydata) \ + $var($cc,$nn,yedata) } xyexey { blt::vector destroy \ - $var(graph$cc,$nn,xdata) $var(graph$cc,$nn,ydata) \ - $var(graph$cc,$nn,xedata) $var(graph$cc,$nn,yedata) + $var($cc,$nn,xdata) $var($cc,$nn,ydata) \ + $var($cc,$nn,xedata) $var($cc,$nn,yedata) } } } @@ -341,30 +326,29 @@ proc PlotExternal {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) # incr count - incr ${varname}(graph$cc,data,total) - set nn $var(graph$cc,data,total) - set var(graph$cc,data,current) $nn + incr ${varname}($cc,data,total) + set nn $var($cc,data,total) + set var($cc,data,current) $nn set var(graph,ds,name) "Dataset $nn" - set var(graph$cc,$nn,manage) $var(graph$cc,manage) - set var(graph$cc,$nn,dim) $var(graph$cc,dim) + set var($cc,$nn,manage) $var($cc,manage) + set var($cc,$nn,dim) $var($cc,dim) - set var(graph$cc,$nn,xdata) $var(graph$cc,xdata) - set var(graph$cc,$nn,ydata) $var(graph$cc,ydata) - set var(graph$cc,$nn,xedata) $var(graph$cc,xedata) - set var(graph$cc,$nn,yedata) $var(graph$cc,yedata) + set var($cc,$nn,xdata) $var($cc,xdata) + set var($cc,$nn,ydata) $var($cc,ydata) + set var($cc,$nn,xedata) $var($cc,xedata) + set var($cc,$nn,yedata) $var($cc,yedata) PlotSaveState $varname # update data set menu $var(mb).graph.select add radiobutton \ -label "[msgcat::mc {Dataset}] $nn" \ - -variable ${varname}(graph$cc,data,current) -value $nn \ + -variable ${varname}($cc,data,current) -value $nn \ -command "PlotCurrentData $varname" PlotAddData $varname @@ -387,38 +371,37 @@ proc PlotListGenerate {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) set rr {} - if {$var(graph$cc,xdata) != {}} { - global $var(graph$cc,xdata) $var(graph$cc,ydata) \ - $var(graph$cc,xedata) $var(graph$cc,yedata) - set ll [$var(graph$cc,xdata) length] - set xx [$var(graph$cc,xdata) range] - set yy [$var(graph$cc,ydata) range] - - switch $var(graph$cc,dim) { + if {$var($cc,xdata) != {}} { + global $var($cc,xdata) $var($cc,ydata) \ + $var($cc,xedata) $var($cc,yedata) + set ll [$var($cc,xdata) length] + set xx [$var($cc,xdata) range] + set yy [$var($cc,ydata) range] + + switch $var($cc,dim) { xy { for {set ii 0} {$ii<$ll} {incr ii} { append rr "[lindex $xx $ii] [lindex $yy $ii]\n" } } xyex { - set xe [$var(graph$cc,xedata) range] + set xe [$var($cc,xedata) range] for {set ii 0} {$ii<$ll} {incr ii} { append rr "[lindex $xx $ii] [lindex $yy $ii] [lindex $xe $ii]\n" } } xyey { - set ye [$var(graph$cc,yedata) range] + set ye [$var($cc,yedata) range] for {set ii 0} {$ii<$ll} {incr ii} { append rr "[lindex $xx $ii] [lindex $yy $ii] [lindex $ye $ii]\n" } } xyexey { - set xe [$var(graph$cc,xedata) range] - set ye [$var(graph$cc,yedata) range] + set xe [$var($cc,xedata) range] + set ye [$var($cc,yedata) range] for {set ii 0} {$ii<$ll} {incr ii} { append rr "[lindex $xx $ii] [lindex $yy $ii] [lindex $xe $ii] [lindex $ye $ii]\n" } @@ -476,7 +459,6 @@ proc PlotStatsGenerate {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) set min {} @@ -486,14 +468,14 @@ proc PlotStatsGenerate {varname} { set varr {} set sdev {} - if {$var(graph$cc,ydata) != {}} { - if {[$var(graph$cc,ydata) length] > 0} { - set min [format "%6.3f" [blt::vector expr min($var(graph$cc,ydata))]] - set max [format "%6.3f" [blt::vector expr max($var(graph$cc,ydata))]] - set mean [format "%6.3f" [blt::vector expr mean($var(graph$cc,ydata))]] - set median [format "%6.3f" [blt::vector expr median($var(graph$cc,ydata))]] - set varr [format "%6.3f" [expr [blt::vector expr var($var(graph$cc,ydata))]]] - set sdev [format "%6.3f" [expr [blt::vector expr sdev($var(graph$cc,ydata))]]] + if {$var($cc,ydata) != {}} { + if {[$var($cc,ydata) length] > 0} { + set min [format "%6.3f" [blt::vector expr min($var($cc,ydata))]] + set max [format "%6.3f" [blt::vector expr max($var($cc,ydata))]] + set mean [format "%6.3f" [blt::vector expr mean($var($cc,ydata))]] + set median [format "%6.3f" [blt::vector expr median($var($cc,ydata))]] + set varr [format "%6.3f" [expr [blt::vector expr var($var($cc,ydata))]]] + set sdev [format "%6.3f" [expr [blt::vector expr sdev($var($cc,ydata))]]] } } @@ -518,9 +500,27 @@ proc PlotStatsDestroyCB {varname} { proc PlotUpdateCanvas {varname} { upvar #0 $varname var global $varname + global ds9 - set tt $var(graph,total) - for {set ii 1} {$ii<=$tt} {incr ii} { + foreach cc $var(graphs) { + $var($cc) configure -plotpadx 0 -plotpady 0 \ + -font "{$ds9($var(graph,title,family))} $var(graph,title,size) $var(graph,title,weight) $var(graph,title,slant)" \ + -bg $var(background) -plotbackground $var(background) + + $var($cc) xaxis configure \ + -bg $var(background) \ + -tickfont "{$ds9($var(axis,font,family))} $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \ + -titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)" + + $var($cc) yaxis configure \ + -bg $var(background) \ + -tickfont "{$ds9($var(axis,font,family))} $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \ + -titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)" + + $var($cc) legend configure \ + -bg $var(background) \ + -font "{$ds9($var(legend,font,family))} $var(legend,font,size) $var(legend,font,weight) $var(legend,font,slant)" \ + -titlefont "{$ds9($var(legend,title,family))} $var(legend,title,size) $var(legend,title,weight) $var(legend,title,slant)" } } @@ -528,11 +528,8 @@ proc PlotUpdateGraph {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) - global ds9 - if {$var(graph,axis,x,auto)} { set xmin {} set xmax {} @@ -549,34 +546,34 @@ proc PlotUpdateGraph {varname} { set ymax $var(graph,axis,y,max) } - $var(graph$cc) xaxis configure -min $xmin -max $xmax \ + $var($cc) xaxis configure -min $xmin -max $xmax \ -descending $var(graph,axis,x,flip) - $var(graph$cc) yaxis configure -min $ymin -max $ymax \ + $var($cc) yaxis configure -min $ymin -max $ymax \ -descending $var(graph,axis,y,flip) if {$var(graph,format)} { if {$var(graph,axis,x,format) != {}} { - $var(graph$cc) xaxis configure \ + $var($cc) xaxis configure \ -command [list PlotAxisFormat $varname x] } else { - $var(graph$cc) xaxis configure -command {} + $var($cc) xaxis configure -command {} } if {$var(graph,axis,y,format) != {}} { - $var(graph$cc) yaxis configure \ + $var($cc) yaxis configure \ -command [list PlotAxisFormat $varname y] } else { - $var(graph$cc) yaxis configure -command {} + $var($cc) yaxis configure -command {} } } # Menus - if {$var(graph$cc,xdata) != {}} { + if {$var($cc,xdata) != {}} { $var(mb).file entryconfig "[msgcat::mc {Save Data}]..." -state normal $var(mb).file entryconfig [msgcat::mc {Clear Data}] -state normal $var(mb).file entryconfig [msgcat::mc {Statistics}] -state normal $var(mb).file entryconfig [msgcat::mc {List Data}] -state normal - if {$var(graph$cc,1,manage)} { + if {$var($cc,1,manage)} { $var(mb).file entryconfig [msgcat::mc {Duplicate Data}] \ -state normal } else { @@ -592,30 +589,18 @@ proc PlotUpdateGraph {varname} { } # Graph - $var(graph$cc) configure -plotpadx 0 -plotpady 0 \ - -title $var(graph,title) \ - -font "{$ds9($var(graph,title,family))} $var(graph,title,size) $var(graph,title,weight) $var(graph,title,slant)" \ - -bg $var(graph,bg) -plotbackground $var(graph,bg) + $var($cc) configure -plotpadx 0 -plotpady 0 -title $var(graph,title) - $var(graph$cc) xaxis configure \ - -bg $var(graph,bg) \ + $var($cc) xaxis configure \ -grid $var(graph,axis,x,grid) -logscale $var(graph,axis,x,log) \ - -title $var(graph,axis,x,title) \ - -tickfont "{$ds9($var(axis,font,family))} $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \ - -titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)" + -title $var(graph,axis,x,title) - $var(graph$cc) yaxis configure \ - -bg $var(graph,bg) \ + $var($cc) yaxis configure \ -grid $var(graph,axis,y,grid) -logscale $var(graph,axis,y,log) \ - -title $var(graph,axis,y,title) \ - -tickfont "{$ds9($var(axis,font,family))} $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \ - -titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)" - - $var(graph$cc) legend configure -hide [expr !$var(graph,legend)] \ - -bg $var(graph,bg) \ - -position $var(graph,legend,position) -title $var(graph,legend,title) \ - -font "{$ds9($var(legend,font,family))} $var(legend,font,size) $var(legend,font,weight) $var(legend,font,slant)" \ - -titlefont "{$ds9($var(legend,title,family))} $var(legend,title,size) $var(legend,title,weight) $var(legend,title,slant)" + -title $var(graph,axis,y,title) + + $var($cc) legend configure -hide [expr !$var(graph,legend)] \ + -position $var(graph,legend,position) -title $var(graph,legend,title) } proc PlotButton {varname x y} { @@ -633,9 +618,6 @@ proc PlotColorMenu {w varname color cmd} { upvar #0 $varname var global $varname - set tt $var(graph,total) - set cc $var(graph,current) - menu $w $w add radiobutton -label [msgcat::mc {Black}] \ -variable ${varname}($color) -value black -command $cmd @@ -662,9 +644,6 @@ proc PlotTitle {varname title xaxis yaxis} { upvar #0 $varname var global $varname - set tt $var(graph,total) - set cc $var(graph,current) - set var(graph,title) "$title" set var(graph,axis,x,title) "$xaxis" set var(graph,axis,y,title) "$yaxis" @@ -684,7 +663,6 @@ proc PlotBackup {ch dir} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) # create dir if needed @@ -695,25 +673,25 @@ proc PlotBackup {ch dir} { } } - switch $var(graph$cc,type) { + switch $var($cc,type) { line {puts $ch "PlotLineTool"} bar {puts $ch "PlotBarTool"} scatter {puts $ch "PlotScatterTool"} strip {puts $ch "PlotStripTool"} } - set save $var(graph$cc,data,current) - for {set ii 1} {$ii<=$var(graph$cc,data,total)} {incr ii} { - set ${varname}(graph$cc,data,current) $ii + set save $var($cc,data,current) + for {set ii 1} {$ii<=$var($cc,data,total)} {incr ii} { + set ${varname}($cc,data,current) $ii PlotCurrentData $varname PlotSaveDataFile $varname "$fdir/plot$ii.dat" PlotSaveConfigFile $varname "$fdir/plot$ii.plt" - puts $ch "PlotLoadDataFile $varname $fdir/plot$ii.dat $var(graph$cc,dim)" + puts $ch "PlotLoadDataFile $varname $fdir/plot$ii.dat $var($cc,dim)" puts $ch "PlotLoadConfigFile $varname $fdir/plot$ii.plt" } - set ${varname}(graph$cc,data,current) $save + set ${varname}($cc,data,current) $save PlotCurrentData $varname } } diff --git a/ds9/library/plotbar.tcl b/ds9/library/plotbar.tcl index 358899f..f0af93b 100644 --- a/ds9/library/plotbar.tcl +++ b/ds9/library/plotbar.tcl @@ -52,9 +52,6 @@ proc PlotBarDialog {varname wtt title xaxis yaxis} { PlotDialog $varname $wtt $title $xaxis $yaxis PlotAddGraph $varname - set tt $var(graph,total) - set cc $var(graph,current) - # Graph $var(mb).graph add separator $var(mb).graph add cascade -label "[msgcat::mc {Mode}]..." \ @@ -90,7 +87,7 @@ proc PlotBarDialog {varname wtt title xaxis yaxis} { $var(mb).data add command -label "[msgcat::mc {Name}]..." \ -command [list DatasetNameDialog $varname] - PlotColorMenu $var(mb).data.color $varname graph$cc,color \ + PlotColorMenu $var(mb).data.color $varname graph,color \ [list PlotBarUpdateElement $varname] # Relief @@ -129,6 +126,8 @@ proc PlotBarDialog {varname wtt title xaxis yaxis} { [list PlotBarUpdateElement $varname] WidthDashMenu $var(mb).data.error.width $varname graph,ds,error,width {} \ [list PlotBarUpdateElement $varname] {} + + $var(proc,updatecanvas) $varname } proc PlotBarAddGraph {varname} { @@ -137,15 +136,12 @@ proc PlotBarAddGraph {varname} { set cc $var(graph,current) - set var(type$cc) bar - set var(graph$cc) [blt::barchart $var(canvas).gr$cc \ - -width 600 \ - -height 500 \ - -highlightthickness 0 \ - ] + set var($cc,type) bar + set var($cc) [blt::barchart $var(canvas).$cc -width 600 -height 500 \ + -highlightthickness 0] - $var(graph$cc) xaxis configure -grid no -stepsize 0 - $var(graph$cc) yaxis configure -grid yes + $var($cc) xaxis configure -grid no -stepsize 0 + $var($cc) yaxis configure -grid yes } proc PlotBarUpdateCanvas {varname} { @@ -154,9 +150,8 @@ proc PlotBarUpdateCanvas {varname} { PlotUpdateCanvas $varname - set tt $var(graph,total) - for {set ii 1} {$ii<=$tt} {incr ii} { - $var(graph$ii) configure -barmode $var(bar,mode) + foreach cc $var(graphs) { + $var($cc) configure -barmode $var(bar,mode) } } @@ -164,11 +159,10 @@ proc PlotBarUpdateElement {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) # warning: uses current vars - if {$var(graph$cc,data,total) == 0} { + if {$var($cc,data,total) == 0} { return } @@ -186,8 +180,8 @@ proc PlotBarUpdateElement {varname} { set cap 0 } - set nn $var(graph$cc,data,current) - $var(graph$cc) element configure "d-${nn}" \ + set nn $var($cc,data,current) + $var($cc) element configure "d-${nn}" \ -label $var(graph,ds,name) -hide [expr !$var(graph,ds,show)] \ -relief $var(graph,ds,bar,relief) -color $var(graph,ds,color) \ -showerrorbars $show -errorbarcolor $var(graph,ds,error,color) \ diff --git a/ds9/library/plotconfig.tcl b/ds9/library/plotconfig.tcl index 59431e0..4755d93 100644 --- a/ds9/library/plotconfig.tcl +++ b/ds9/library/plotconfig.tcl @@ -23,10 +23,6 @@ proc PlotLoadConfigFile {varname filename} { } source $filename - # array set $varname [array get analysisplot] - - set var(graph,bg) $analysisplot(graph,bg) - set var(bar,mode) $analysisplot(bar,mode) set var(graph,title,family) $analysisplot(graph,title,family) set var(graph,title,size) $analysisplot(graph,title,size) @@ -78,7 +74,6 @@ proc PlotLoadConfigFile {varname filename} { set var(graph,axis,y,format) $analysisplot(axis,y,format) # per Dataset - # set var(graph,ds,name) {} set var(graph,ds,show) $analysisplot(show) set var(graph,ds,smooth) $analysisplot(smooth) set var(graph,ds,color) $analysisplot(color) @@ -210,9 +205,6 @@ proc PlotSaveConfigFile {varname filename} { set ch [open $filename w] - set analysisplot(graph,bg) $var(graph,bg) - set analysisplot(bar,mode) $var(bar,mode) - set analysisplot(graph,title,family) $var(graph,title,family) set analysisplot(graph,title,size) $var(graph,title,size) set analysisplot(graph,title,weight) $var(graph,title,weight) @@ -263,7 +255,6 @@ proc PlotSaveConfigFile {varname filename} { set analysisplot(axis,y,format) $var(graph,axis,y,format) # per Dataset -# set analysisplot(name) {} set analysisplot(show) $var(graph,ds,show) set analysisplot(smooth) $var(graph,ds,smooth) set analysisplot(color) $var(graph,ds,color) diff --git a/ds9/library/plotdata.tcl b/ds9/library/plotdata.tcl index 800deef..4d0f516 100644 --- a/ds9/library/plotdata.tcl +++ b/ds9/library/plotdata.tcl @@ -38,10 +38,9 @@ proc PlotSaveData {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) - if {$var(graph$cc,xdata) == {}} { + if {$var($cc,xdata) == {}} { return } @@ -52,10 +51,9 @@ proc PlotSaveDataFile {varname filename} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) - if {$var(graph$cc,xdata) == {}} { + if {$var($cc,xdata) == {}} { return } @@ -63,34 +61,34 @@ proc PlotSaveDataFile {varname filename} { return } - global $var(graph$cc,xdata) $var(graph$cc,ydata) \ - $var(graph$cc,xedata) $var(graph$cc,yedata) - set ll [$var(graph$cc,xdata) length] - set xx [$var(graph$cc,xdata) range] - set yy [$var(graph$cc,ydata) range] + global $var($cc,xdata) $var($cc,ydata) \ + $var($cc,xedata) $var($cc,yedata) + set ll [$var($cc,xdata) length] + set xx [$var($cc,xdata) range] + set yy [$var($cc,ydata) range] set ch [open $filename w] - switch $var(graph$cc,dim) { + switch $var($cc,dim) { xy { for {set ii 0} {$ii<$ll} {incr ii} { puts $ch "[lindex $xx $ii] [lindex $yy $ii]" } } xyex { - set xe [$var(graph$cc,xedata) range] + set xe [$var($cc,xedata) range] for {set ii 0} {$ii<$ll} {incr ii} { puts $ch "[lindex $xx $ii] [lindex $yy $ii] [lindex $xe $ii]" } } xyey { - set ye [$var(graph$cc,yedata) range] + set ye [$var($cc,yedata) range] for {set ii 0} {$ii<$ll} {incr ii} { puts $ch "[lindex $xx $ii] [lindex $yy $ii] [lindex $ye $ii]" } } xyexey { - set xe [$var(graph$cc,xedata) range] - set ye [$var(graph$cc,yedata) range] + set xe [$var($cc,xedata) range] + set ye [$var($cc,yedata) range] for {set ii 0} {$ii<$ll} {incr ii} { puts $ch "[lindex $xx $ii] [lindex $yy $ii] [lindex $xe $ii] [lindex $ye $ii]" } @@ -105,7 +103,6 @@ proc PlotDataSet {varname dim data} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) switch -- $dim { @@ -138,7 +135,6 @@ proc PlotDataSetOne {varname dim data} { # save current state PlotSaveState $varname - set tt $var(graph,total) set cc $var(graph,current) # look for no data @@ -150,12 +146,30 @@ proc PlotDataSetOne {varname dim data} { set ll [llength $data] # incr count - incr ${varname}(graph$cc,data,total) - set nn $var(graph$cc,data,total) - set var(graph$cc,data,current) $nn + incr ${varname}($cc,data,total) + set nn $var($cc,data,total) + set var($cc,data,current) $nn # init new state - PlotInitState $varname + global pap + set var(graph,ds,show) $pap(graph,ds,show) + set var(graph,ds,smooth) $pap(graph,ds,smooth) + set var(graph,ds,color) $pap(graph,ds,color) + set var(graph,ds,fill) $pap(graph,ds,fill) + set var(graph,ds,fill,color) $pap(graph,ds,fill,color) + set var(graph,ds,width) $pap(graph,ds,width) + set var(graph,ds,dash) $pap(graph,ds,dash) + + set var(graph,ds,shape,symbol) $pap(graph,ds,shape,symbol) + set var(graph,ds,shape,fill) $pap(graph,ds,shape,fill) + set var(graph,ds,shape,color) $pap(graph,ds,shape,color) + + set var(graph,ds,error) $pap(graph,ds,error) + set var(graph,ds,error,cap) $pap(graph,ds,error,cap) + set var(graph,ds,error,color) $pap(graph,ds,error,color) + set var(graph,ds,error,width) $pap(graph,ds,error,width) + + set var(graph,ds,bar,relief) $pap(graph,ds,bar,relief) # new vector names set xdata ap${varname}xx${nn} @@ -164,12 +178,12 @@ proc PlotDataSetOne {varname dim data} { set yedata ap${varname}ye${nn} # basics xy - set var(graph$cc,manage) 1 + set var($cc,manage) 1 set var(graph,ds,name) "Dataset $nn" - set var(graph$cc,xdata) $xdata - set var(graph$cc,ydata) $ydata - global $var(graph$cc,xdata) $var(graph$cc,ydata) - blt::vector create $var(graph$cc,xdata) $var(graph$cc,ydata) + set var($cc,xdata) $xdata + set var($cc,ydata) $ydata + global $var($cc,xdata) $var($cc,ydata) + blt::vector create $var($cc,xdata) $var($cc,ydata) # substitute all separtors regsub -all {[\n\r\t, ]+} $data { } data @@ -183,62 +197,62 @@ proc PlotDataSetOne {varname dim data} { switch -- $dim { 2 - xy { - set var(graph$cc,dim) xy - set var(graph$cc,xedata) {} - set var(graph$cc,yedata) {} + set var($cc,dim) xy + set var($cc,xedata) {} + set var($cc,yedata) {} for {set ii 0} {$ii<$ll} {incr ii 2} { lappend x [lindex $data $ii] lappend y [lindex $data [expr $ii+1]] } - $var(graph$cc,xdata) set $x - $var(graph$cc,ydata) set $y + $var($cc,xdata) set $x + $var($cc,ydata) set $y } xyex { - set var(graph$cc,dim) xyex - set var(graph$cc,xedata) $xedata - set var(graph$cc,yedata) {} + set var($cc,dim) xyex + set var($cc,xedata) $xedata + set var($cc,yedata) {} - global $var(graph$cc,xedata) - blt::vector create $var(graph$cc,xedata) + global $var($cc,xedata) + blt::vector create $var($cc,xedata) for {set ii 0} {$ii<$ll} {incr ii 3} { lappend x [lindex $data $ii] lappend y [lindex $data [expr $ii+1]] lappend xe [lindex $data [expr $ii+2]] } - $var(graph$cc,xdata) set $x - $var(graph$cc,ydata) set $y - $var(graph$cc,xedata) set $xe + $var($cc,xdata) set $x + $var($cc,ydata) set $y + $var($cc,xedata) set $xe } 3 - xyey { - set var(graph$cc,dim) xyey - set var(graph$cc,xedata) {} - set var(graph$cc,yedata) $yedata + set var($cc,dim) xyey + set var($cc,xedata) {} + set var($cc,yedata) $yedata - global $var(graph$cc,yedata) - blt::vector create $var(graph$cc,yedata) + global $var($cc,yedata) + blt::vector create $var($cc,yedata) for {set ii 0} {$ii<$ll} {incr ii 3} { lappend x [lindex $data $ii] lappend y [lindex $data [expr $ii+1]] lappend ye [lindex $data [expr $ii+2]] } - $var(graph$cc,xdata) set $x - $var(graph$cc,ydata) set $y - $var(graph$cc,yedata) set $ye + $var($cc,xdata) set $x + $var($cc,ydata) set $y + $var($cc,yedata) set $ye } xyexey { - set var(graph$cc,dim) xyexey - set var(graph$cc,xedata) $xedata - set var(graph$cc,yedata) $yedata + set var($cc,dim) xyexey + set var($cc,xedata) $xedata + set var($cc,yedata) $yedata - global $var(graph$cc,xedata) $var(graph$cc,yedata) - blt::vector create $var(graph$cc,xedata) $var(graph$cc,yedata) + global $var($cc,xedata) $var($cc,yedata) + blt::vector create $var($cc,xedata) $var($cc,yedata) for {set ii 0} {$ii<$ll} {incr ii 4} { lappend x [lindex $data $ii] @@ -246,93 +260,93 @@ proc PlotDataSetOne {varname dim data} { lappend xe [lindex $data [expr $ii+2]] lappend ye [lindex $data [expr $ii+3]] } - $var(graph$cc,xdata) set $x - $var(graph$cc,ydata) set $y - $var(graph$cc,xedata) set $xe - $var(graph$cc,yedata) set $ye + $var($cc,xdata) set $x + $var($cc,ydata) set $y + $var($cc,xedata) set $xe + $var($cc,yedata) set $ye } 4.1 { - set var(graph$cc,dim) xyey - set var(graph$cc,xedata) {} - set var(graph$cc,yedata) $yedata + set var($cc,dim) xyey + set var($cc,xedata) {} + set var($cc,yedata) $yedata - global $var(graph$cc,yedata) - blt::vector create $var(graph$cc,yedata) + global $var($cc,yedata) + blt::vector create $var($cc,yedata) for {set ii 0} {$ii<$ll} {incr ii 4} { lappend x [lindex $data $ii] lappend y [lindex $data [expr $ii+1]] lappend ye [lindex $data [expr $ii+2]] } - $var(graph$cc,xdata) set $x - $var(graph$cc,ydata) set $y - $var(graph$cc,yedata) set $ye + $var($cc,xdata) set $x + $var($cc,ydata) set $y + $var($cc,yedata) set $ye } 4.2 { - set var(graph$cc,dim) xy - set var(graph$cc,xedata) {} - set var(graph$cc,yedata) {} + set var($cc,dim) xy + set var($cc,xedata) {} + set var($cc,yedata) {} for {set ii 0} {$ii<$ll} {incr ii 4} { lappend x [lindex $data $ii] lappend y [lindex $data [expr $ii+3]] } - $var(graph$cc,xdata) set $x - $var(graph$cc,ydata) set $y + $var($cc,xdata) set $x + $var($cc,ydata) set $y } 5.1 { - set var(graph$cc,dim) xyey - set var(graph$cc,xedata) {} - set var(graph$cc,yedata) $yedata + set var($cc,dim) xyey + set var($cc,xedata) {} + set var($cc,yedata) $yedata - global $var(graph$cc,yedata) - blt::vector create $var(graph$cc,yedata) + global $var($cc,yedata) + blt::vector create $var($cc,yedata) for {set ii 0} {$ii<$ll} {incr ii 5} { lappend x [lindex $data $ii] lappend y [lindex $data [expr $ii+1]] lappend ye [lindex $data [expr $ii+2]] } - $var(graph$cc,xdata) set $x - $var(graph$cc,ydata) set $y - $var(graph$cc,yedata) set $ye + $var($cc,xdata) set $x + $var($cc,ydata) set $y + $var($cc,yedata) set $ye } 5.2 { - set var(graph$cc,dim) xyey - set var(graph$cc,xedata) {} - set var(graph$cc,yedata) $yedata + set var($cc,dim) xyey + set var($cc,xedata) {} + set var($cc,yedata) $yedata - global $var(graph$cc,yedata) - blt::vector create $var(graph$cc,yedata) + global $var($cc,yedata) + blt::vector create $var($cc,yedata) for {set ii 0} {$ii<$ll} {incr ii 5} { lappend x [lindex $data $ii] lappend y [lindex $data [expr $ii+3]] lappend ye [lindex $data [expr $ii+4]] } - $var(graph$cc,xdata) set $x - $var(graph$cc,ydata) set $y - $var(graph$cc,yedata) set $ye + $var($cc,xdata) set $x + $var($cc,ydata) set $y + $var($cc,yedata) set $ye } } - set var(graph$cc,$nn,manage) 1 - set var(graph$cc,$nn,dim) $var(graph$cc,dim) + set var($cc,$nn,manage) 1 + set var($cc,$nn,dim) $var($cc,dim) - set var(graph$cc,$nn,xdata) $var(graph$cc,xdata) - set var(graph$cc,$nn,ydata) $var(graph$cc,ydata) - set var(graph$cc,$nn,xedata) $var(graph$cc,xedata) - set var(graph$cc,$nn,yedata) $var(graph$cc,yedata) + set var($cc,$nn,xdata) $var($cc,xdata) + set var($cc,$nn,ydata) $var($cc,ydata) + set var($cc,$nn,xedata) $var($cc,xedata) + set var($cc,$nn,yedata) $var($cc,yedata) PlotSaveState $varname # update data set menu $var(mb).graph.select add radiobutton -label "$var(graph,ds,name)" \ - -variable ${varname}(graph$cc,data,current) -value $nn \ + -variable ${varname}($cc,data,current) -value $nn \ -command [list PlotCurrentData $varname] PlotAddData $varname @@ -343,79 +357,78 @@ proc PlotDupData {varname mm} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) - if {$var(graph$cc,data,total) == 0} { + if {$var($cc,data,total) == 0} { return } # incr count - incr ${varname}(graph$cc,data,total) - set nn $var(graph$cc,data,total) + incr ${varname}($cc,data,total) + set nn $var($cc,data,total) set pp [expr $nn-1] # new vector names - set var(graph$cc,$nn,name) "Dataset $nn" - set var(graph$cc,$nn,xdata) ap${varname}xx${nn} - set var(graph$cc,$nn,ydata) ap${varname}yy${nn} - set var(graph$cc,$nn,xedata) ap${varname}xe${nn} - set var(graph$cc,$nn,yedata) ap${varname}ye${nn} - global $var(graph$cc,$mm,xdata) $var(graph$cc,$mm,ydata) \ - $var(graph$cc,$mm,xedata) $var(graph$cc,$mm,yedata) - global $var(graph$cc,$nn,xdata) $var(graph$cc,$nn,ydata) \ - $var(graph$cc,$nn,xedata) $var(graph$cc,$nn,yedata) + set var($cc,$nn,name) "Dataset $nn" + set var($cc,$nn,xdata) ap${varname}xx${nn} + set var($cc,$nn,ydata) ap${varname}yy${nn} + set var($cc,$nn,xedata) ap${varname}xe${nn} + set var($cc,$nn,yedata) ap${varname}ye${nn} + global $var($cc,$mm,xdata) $var($cc,$mm,ydata) \ + $var($cc,$mm,xedata) $var($cc,$mm,yedata) + global $var($cc,$nn,xdata) $var($cc,$nn,ydata) \ + $var($cc,$nn,xedata) $var($cc,$nn,yedata) - $var(graph$cc,$mm,xdata) dup $var(graph$cc,$nn,xdata) - $var(graph$cc,$mm,ydata) dup $var(graph$cc,$nn,ydata) - if {$var(graph$cc,$mm,xedata) != {}} { - $var(graph$cc,$mm,xedata) dup $var(graph$cc,$nn,xedata) + $var($cc,$mm,xdata) dup $var($cc,$nn,xdata) + $var($cc,$mm,ydata) dup $var($cc,$nn,ydata) + if {$var($cc,$mm,xedata) != {}} { + $var($cc,$mm,xedata) dup $var($cc,$nn,xedata) } else { - set var(graph$cc,$nn,xedata) {} + set var($cc,$nn,xedata) {} } - if {$var(graph$cc,$mm,yedata) != {}} { - $var(graph$cc,$mm,yedata) dup $var(graph$cc,$nn,yedata) + if {$var($cc,$mm,yedata) != {}} { + $var($cc,$mm,yedata) dup $var($cc,$nn,yedata) } else { - set var(graph$cc,$nn,yedata) {} + set var($cc,$nn,yedata) {} } - set var(graph$cc,$nn,manage) 1 - set var(graph$cc,$nn,dim) $var(graph$cc,$mm,dim) + set var($cc,$nn,manage) 1 + set var($cc,$nn,dim) $var($cc,$mm,dim) - set var(graph$cc,$nn,show) $var(graph$cc,$mm,show) - set var(graph$cc,$nn,smooth) $var(graph$cc,$mm,smooth) - set var(graph$cc,$nn,color) $var(graph$cc,$mm,color) - set var(graph$cc,$nn,fill) $var(graph$cc,$mm,fill) - set var(graph$cc,$nn,fill,color) $var(graph$cc,$mm,fill,color) - set var(graph$cc,$nn,width) $var(graph$cc,$mm,width) - set var(graph$cc,$nn,dash) $var(graph$cc,$mm,dash) + set var($cc,$nn,show) $var($cc,$mm,show) + set var($cc,$nn,smooth) $var($cc,$mm,smooth) + set var($cc,$nn,color) $var($cc,$mm,color) + set var($cc,$nn,fill) $var($cc,$mm,fill) + set var($cc,$nn,fill,color) $var($cc,$mm,fill,color) + set var($cc,$nn,width) $var($cc,$mm,width) + set var($cc,$nn,dash) $var($cc,$mm,dash) - set var(graph$cc,$nn,shape,symbol) $var(graph$cc,$mm,shape,symbol) - set var(graph$cc,$nn,shape,fill) $var(graph$cc,$mm,shape,fill) - set var(graph$cc,$nn,shape,color) $var(graph$cc,$mm,shape,color) + set var($cc,$nn,shape,symbol) $var($cc,$mm,shape,symbol) + set var($cc,$nn,shape,fill) $var($cc,$mm,shape,fill) + set var($cc,$nn,shape,color) $var($cc,$mm,shape,color) - set var(graph$cc,$nn,error) $var(graph$cc,$mm,error) - set var(graph$cc,$nn,error,cap) $var(graph$cc,$mm,error,cap) - set var(graph$cc,$nn,error,color) $var(graph$cc,$mm,error,color) - set var(graph$cc,$nn,error,width) $var(graph$cc,$mm,error,width) + set var($cc,$nn,error) $var($cc,$mm,error) + set var($cc,$nn,error,cap) $var($cc,$mm,error,cap) + set var($cc,$nn,error,color) $var($cc,$mm,error,color) + set var($cc,$nn,error,width) $var($cc,$mm,error,width) - set var(graph$cc,$nn,bar,relief) $var(graph$cc,$mm,bar,relief) + set var($cc,$nn,bar,relief) $var($cc,$mm,bar,relief) # update data set menu - $var(mb).graph.select add radiobutton -label "$var(graph$cc,$nn,name)" \ - -variable ${varname}(graph$cc,data,current) -value $nn \ + $var(mb).graph.select add radiobutton -label "$var($cc,$nn,name)" \ + -variable ${varname}($cc,data,current) -value $nn \ -command [list PlotCurrentData $varname] # make current - set var(graph$cc,data,current) $nn + set var($cc,data,current) $nn - set var(graph$cc,manage) $var(graph$cc,$nn,manage) - set var(graph$cc,dim) $var(graph$cc,$nn,dim) + set var($cc,manage) $var($cc,$nn,manage) + set var($cc,dim) $var($cc,$nn,dim) - set var(graph$cc,xdata) $var(graph$cc,$nn,xdata) - set var(graph$cc,ydata) $var(graph$cc,$nn,ydata) - set var(graph$cc,xedata) $var(graph$cc,$nn,xedata) - set var(graph$cc,yedata) $var(graph$cc,$nn,yedata) + set var($cc,xdata) $var($cc,$nn,xdata) + set var($cc,ydata) $var($cc,$nn,ydata) + set var($cc,xedata) $var($cc,$nn,xedata) + set var($cc,yedata) $var($cc,$nn,yedata) PlotRestoreState $varname $nn diff --git a/ds9/library/plotdialog.tcl b/ds9/library/plotdialog.tcl index 17bf187..64abdb9 100644 --- a/ds9/library/plotdialog.tcl +++ b/ds9/library/plotdialog.tcl @@ -27,12 +27,8 @@ proc PlotDialog {varname wtt title xaxis yaxis} { set var(mode) zoom set var(callback) {} - set var(graph,total) 0 - set var(graph,current) 0 - set var(graph0,data,total) 0 - set var(graph0,data,current) 0 - - PlotInitState $varname + set var(graphs) {} + set var(seq) 0 PlotTitle $varname $title $xaxis $yaxis @@ -151,14 +147,24 @@ proc PlotDialog {varname wtt title xaxis yaxis} { $var(mb).canvas.font add cascade -label [msgcat::mc {Legend}] \ -menu $var(mb).canvas.font.legend - FontMenu $var(mb).canvas.font.title $varname graph,title,family graph,title,size graph,title,weight graph,title,slant [list $var(proc,updategraph) $varname] - FontMenu $var(mb).canvas.font.textlab $varname axis,title,family axis,title,size axis,title,weight axis,title,slant [list $var(proc,updategraph) $varname] - FontMenu $var(mb).canvas.font.numlab $varname axis,font,family axis,font,size axis,font,weight axis,font,slant [list $var(proc,updategraph) $varname] - FontMenu $var(mb).canvas.font.legendtitle $varname legend,title,family legend,title,size legend,title,weight legend,title,slant [list $var(proc,updategraph) $varname] - FontMenu $var(mb).canvas.font.legend $varname legend,font,family legend,font,size legend,font,weight legend,font,slant [list $var(proc,updategraph) $varname] - - PlotColorMenu $var(mb).canvas.bg $varname graph,bg \ - [list $var(proc,updategraph) $varname] + FontMenu $var(mb).canvas.font.title \ + $varname graph,title,family graph,title,size graph,title,weight \ + graph,title,slant [list $var(proc,updatecanvas) $varname] + FontMenu $var(mb).canvas.font.textlab \ + $varname axis,title,family axis,title,size axis,title,weight \ + axis,title,slant [list $var(proc,updatecanvas) $varname] + FontMenu $var(mb).canvas.font.numlab \ + $varname axis,font,family axis,font,size axis,font,weight \ + axis,font,slant [list $var(proc,updatecanvas) $varname] + FontMenu $var(mb).canvas.font.legendtitle \ + $varname legend,title,family legend,title,size legend,title,weight \ + legend,title,slant [list $var(proc,updatecanvas) $varname] + FontMenu $var(mb).canvas.font.legend \ + $varname legend,font,family legend,font,size legend,font,weight \ + legend,font,slant [list $var(proc,updatecanvas) $varname] + + PlotColorMenu $var(mb).canvas.bg $varname background \ + [list $var(proc,updatecanvas) $varname] # Graph menu $var(mb).graph @@ -431,9 +437,6 @@ proc DatasetNameDialog {varname} { global $varname global ed - set tt $var(graph,total) - set cc $var(graph,current) - set w {.aptitle} set ed(ok) 0 @@ -514,9 +517,6 @@ proc PlotShapeMenu {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) - set cc $var(graph,current) - # Shape menu $var(mb).data.shape $var(mb).data.shape add radiobutton \ @@ -575,9 +575,6 @@ proc PlotErrorMenu {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) - set cc $var(graph,current) - menu $var(mb).data.error $var(mb).data.error add checkbutton -label [msgcat::mc {Show}] \ -variable ${varname}(graph,ds,error) \ diff --git a/ds9/library/plotline.tcl b/ds9/library/plotline.tcl index 6cc2b6d..cf43d38 100644 --- a/ds9/library/plotline.tcl +++ b/ds9/library/plotline.tcl @@ -52,9 +52,6 @@ proc PlotLineDialog {varname wtt title xaxis yaxis} { PlotDialog $varname $wtt $title $xaxis $yaxis PlotAddGraph $varname - set tt $var(graph,total) - set cc $var(graph,current) - # Data $var(mb).data add checkbutton -label [msgcat::mc {Show}] \ -variable ${varname}(graph,ds,show) \ @@ -138,36 +135,34 @@ proc PlotLineDialog {varname wtt title xaxis yaxis} { $var(mb).data.fill add cascade -label [msgcat::mc {Color}] \ -menu $var(mb).data.fill.color - PlotColorMenu $var(mb).data.fill.color $varname graph$cc,fill,color \ + PlotColorMenu $var(mb).data.fill.color $varname graph,fill,color \ [list PlotLineUpdateElement $varname] # Error PlotErrorMenu $varname + + $var(proc,updatecanvas) $varname } proc PlotLineAddGraph {varname} { upvar #0 $varname var global $varname - set cc $var(graph,current) + set cc $var(graph,current) - set var(type$cc) line - set var(graph$cc) [blt::graph $var(canvas).gr$cc \ - -width 600 \ - -height 500 \ - -highlightthickness 0 \ - ] + set var($cc,type) line + set var($cc) [blt::graph $var(canvas).$cc -width 600 -height 500 \ + -highlightthickness 0] } proc PlotLineUpdateElement {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) # warning: uses current vars - if {$var(graph$cc,data,total) == 0} { + if {$var($cc,data,total) == 0} { return } @@ -203,8 +198,8 @@ proc PlotLineUpdateElement {varname} { set cap 0 } - set nn $var(graph$cc,data,current) - $var(graph$cc) element configure "d-${nn}" \ + set nn $var($cc,data,current) + $var($cc) element configure "d-${nn}" \ -label $var(graph,ds,name) -hide [expr !$var(graph,ds,show)] \ -symbol $var(graph,ds,shape,symbol) -fill $clr -scalesymbols no \ -pixels 5 -outline $var(graph,ds,shape,color) \ diff --git a/ds9/library/plotprint.tcl b/ds9/library/plotprint.tcl index 1407c6a..fbf6ad6 100644 --- a/ds9/library/plotprint.tcl +++ b/ds9/library/plotprint.tcl @@ -19,26 +19,23 @@ proc PlotPostScript {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) - set cc $var(graph,current) - global ps global ds9 - for {set ii 1} {$ii<=$tt} {incr ii} { + foreach cc $var(graphs) { # set postscript fonts - $var(graph$ii) configure \ + $var($cc) configure \ -font "$var(graph,title,family) $var(graph,title,size) $var(graph,title,weight) $var(graph,title,slant)" - $var(graph$ii) xaxis configure \ + $var($cc) xaxis configure \ -tickfont "$var(axis,font,family) $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \ -titlefont "$var(axis,title,family) $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)" - $var(graph$ii) yaxis configure \ + $var($cc) yaxis configure \ -tickfont "$var(axis,font,family) $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \ -titlefont "$var(axis,title,family) $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)" - $var(graph$ii) legend configure \ + $var($cc) legend configure \ -font "$var(legend,font,family) $var(legend,font,size) $var(legend,font,weight) $var(legend,font,slant)" \ -titlefont "$var(legend,title,family) $var(legend,title,size) $var(legend,title,weight) $var(legend,title,slant)" @@ -98,26 +95,26 @@ proc PlotPostScript {varname} { } if {$ps(dest) == "file" && $ps(filename) != {}} { - eval $var(graph$ii) postscript output $ps(filename) $options + eval $var($cc) postscript output $ps(filename) $options } else { set ch [open "| $ps(cmd)" w] - puts $ch [eval $var(graph$ii) postscript output $options] + puts $ch [eval $var($cc) postscript output $options] close $ch } # reset fonts - $var(graph$ii) configure \ + $var($cc) configure \ -font "{$ds9($var(graph,title,family))} $var(graph,title,size) $var(graph,title,weight) $var(graph,title,slant)" - $var(graph$ii) xaxis configure \ + $var($cc) xaxis configure \ -tickfont "{$ds9($var(axis,font,family))} $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \ -titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)" - $var(graph$ii) yaxis configure \ + $var($cc) yaxis configure \ -tickfont "{$ds9($var(axis,font,family))} $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \ -titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)" - $var(graph$ii) legend configure \ + $var($cc) legend configure \ -font "{$ds9($var(legend,font,family))} $var(legend,font,size) $var(legend,font,weight) $var(legend,font,slant)" \ -titlefont "{$ds9($var(legend,title,family))} $var(legend,title,size) $var(legend,title,weight) $var(legend,title,slant)" } diff --git a/ds9/library/plotprocess.tcl b/ds9/library/plotprocess.tcl index d0ec4dd..e4af856 100644 --- a/ds9/library/plotprocess.tcl +++ b/ds9/library/plotprocess.tcl @@ -15,7 +15,7 @@ proc PrefsDialogPlot {} { # Graph set f [ttk::labelframe $w.plot.graph -text [msgcat::mc {Graph}]] ttk::label $f.tbg -text [msgcat::mc {Background}] - ColorMenuButton $f.bg pap graph,bg {} + ColorMenuButton $f.bg pap background {} grid $f.tbg $f.bg -padx 2 -pady 2 -sticky w @@ -341,11 +341,8 @@ proc PlotCmdSelectData {which} { global cvarname upvar #0 $cvarname cvar - set tt $cvar(graph,total) set cc $cvar(graph,current) - - set cvar(graph$cc,data,current) $which - + set cvar($cc,data,current) $which PlotCurrentData $cvarname } @@ -369,21 +366,19 @@ proc PlotSendCmdCVARGet {key} { global cvarname upvar #0 $cvarname cvar - set tt $cvar(graph,total) set cc $cvar(graph,current) global parse - $parse(proc) $parse(id) "$cvar(graph$cc,$key)\n" + $parse(proc) $parse(id) "$cvar($cc,$key)\n" } proc PlotSendCmdCVARYesNo {key} { global cvarname upvar #0 $cvarname cvar - set tt $cvar(graph,total) set cc $cvar(graph,current) global parse - $parse(proc) $parse(id) [ToYesNo $cvar(graph$cc,$key)] + $parse(proc) $parse(id) [ToYesNo $cvar($cc,$key)] } diff --git a/ds9/library/plotscatter.tcl b/ds9/library/plotscatter.tcl index 1f89ecb..02b9753 100644 --- a/ds9/library/plotscatter.tcl +++ b/ds9/library/plotscatter.tcl @@ -52,9 +52,6 @@ proc PlotScatterDialog {varname wtt title xaxis yaxis} { PlotDialog $varname $wtt $title $xaxis $yaxis PlotAddGraph $varname - set tt $var(graph,total) - set cc $var(graph,current) - # Data $var(mb).data add checkbutton -label [msgcat::mc {Show}] \ -variable ${varname}(graph,ds,show) \ @@ -73,6 +70,8 @@ proc PlotScatterDialog {varname wtt title xaxis yaxis} { # Error PlotErrorMenu $varname + + $var(proc,updatecanvas) $varname } proc PlotScatterAddGraph {varname} { @@ -81,23 +80,19 @@ proc PlotScatterAddGraph {varname} { set cc $var(graph,current) - set var(type$cc) scatter - set var(graph$cc) [blt::graph $var(canvas).gr$cc \ - -width 600 \ - -height 500 \ - -highlightthickness 0 \ - ] + set var($cc,type) scatter + set var($cc) [blt::graph $var(canvas).$cc -width 600 -height 500 \ + -highlightthickness 0] } proc PlotScatterUpdateElement {varname} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) # warning: uses current vars - if {$var(graph$cc,data,total) == 0} { + if {$var($cc,data,total) == 0} { return } @@ -125,8 +120,8 @@ proc PlotScatterUpdateElement {varname} { set cap 0 } - set nn $var(graph$cc,data,current) - $var(graph$cc) element configure "d-${nn}" \ + set nn $var($cc,data,current) + $var($cc) element configure "d-${nn}" \ -label $var(graph,ds,name) -hide [expr !$var(graph,ds,show)] \ -symbol $var(graph,ds,shape,symbol) -fill $clr -scalesymbols no \ -outline $var(graph,ds,shape,color) \ @@ -134,7 +129,7 @@ proc PlotScatterUpdateElement {varname} { -showerrorbars $show -errorbarcolor $var(graph,ds,error,color) \ -errorbarwidth $var(graph,ds,error,width) -errorbarcap $cap - $var(graph$cc) pen configure active -color blue \ + $var($cc) pen configure active -color blue \ -symbol $var(graph,ds,shape,symbol) \ -linewidth 0 -pixels 5 \ -showerrorbars $show -errorbarcolor $var(graph,ds,error,color) \ @@ -145,10 +140,9 @@ proc PlotScatterButton {varname x y} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) - if {$var(graph$cc,data,total) == 0} { + if {$var($cc,data,total) == 0} { return } @@ -156,18 +150,18 @@ proc PlotScatterButton {varname x y} { return } - set rr [$var(graph$cc) element closest $x $y] + set rr [$var($cc) element closest $x $y] set elem [lindex $rr 1] set row [lindex $rr 3] if {$elem != {}} { if {$row != {}} { - $var(graph$cc) element deactivate $elem - $var(graph$cc) element activate $elem $row + $var($cc) element deactivate $elem + $var($cc) element activate $elem $row # rows start at 1 eval "$var(callback) [expr $row+1]" } else { - $var(graph$cc) element deactivate $elem + $var($cc) element deactivate $elem eval "$var(callback) {}" } } @@ -177,18 +171,17 @@ proc PlotScatterHighliteElement {varname rowlist} { upvar #0 $varname var global $varname - set tt $var(graph,total) set cc $var(graph,current) - if {$var(graph$cc,data,total) == 0} { + if {$var($cc,data,total) == 0} { return } if {$var(graph,ds,show)} { - $var(graph$cc) element deactivate d-1 + $var($cc) element deactivate d-1 if {$rowlist != {}} { # can have multiple rows - eval "$var(graph$cc) element activate d-1 $rowlist" + eval "$var($cc) element activate d-1 $rowlist" } } } diff --git a/ds9/library/plotstate.tcl b/ds9/library/plotstate.tcl index 749ddce..07f5cf9 100644 --- a/ds9/library/plotstate.tcl +++ b/ds9/library/plotstate.tcl @@ -9,7 +9,7 @@ proc PlotDefState {} { global pap # per Canvas - set pap(graph,bg) white + set pap(background) white set pap(bar,mode) normal set pap(graph,title,family) helvetica @@ -83,116 +83,58 @@ proc PlotDefState {} { set pap(graph,ds,bar,relief) raised } -proc PlotInitState {varname} { - upvar #0 $varname var - global $varname - - global pap - - set cc $var(graph,current) - - # per Canvas - set var(bar,mode) $pap(bar,mode) - - # per Graph - set var(graph,title) $pap(graph,title) - - set var(graph,legend) $pap(graph,legend) - set var(graph,legend,title) $pap(graph,legend,title) - set var(graph,legend,position) $pap(graph,legend,position) - - set var(graph,axis,x,title) $pap(graph,axis,x,title) - set var(graph,axis,x,grid) $pap(graph,axis,x,grid) - set var(graph,axis,x,log) $pap(graph,axis,x,log) - set var(graph,axis,x,flip) $pap(graph,axis,x,flip) - set var(graph,axis,x,auto) $pap(graph,axis,x,auto) - set var(graph,axis,x,min) $pap(graph,axis,x,min) - set var(graph,axis,x,max) $pap(graph,axis,x,max) - set var(graph,axis,x,format) $pap(graph,axis,x,format) - - set var(graph,axis,y,title) $pap(graph,axis,y,title) - set var(graph,axis,y,grid) $pap(graph,axis,y,grid) - set var(graph,axis,y,log) $pap(graph,axis,y,log) - set var(graph,axis,y,flip) $pap(graph,axis,y,flip) - set var(graph,axis,y,auto) $pap(graph,axis,y,auto) - set var(graph,axis,y,min) $pap(graph,axis,y,min) - set var(graph,axis,y,max) $pap(graph,axis,y,max) - set var(graph,axis,y,format) $pap(graph,axis,y,format) - - # per DataSet - set var(graph,ds,name) $pap(graph,ds,name) - set var(graph,ds,show) $pap(graph,ds,show) - set var(graph,ds,smooth) $pap(graph,ds,smooth) - set var(graph,ds,color) $pap(graph,ds,color) - set var(graph,ds,fill) $pap(graph,ds,fill) - set var(graph,ds,fill,color) $pap(graph,ds,fill,color) - set var(graph,ds,width) $pap(graph,ds,width) - set var(graph,ds,dash) $pap(graph,ds,dash) - - set var(graph,ds,shape,symbol) $pap(graph,ds,shape,symbol) - set var(graph,ds,shape,fill) $pap(graph,ds,shape,fill) - set var(graph,ds,shape,color) $pap(graph,ds,shape,color) - - set var(graph,ds,error) $pap(graph,ds,error) - set var(graph,ds,error,cap) $pap(graph,ds,error,cap) - set var(graph,ds,error,color) $pap(graph,ds,error,color) - set var(graph,ds,error,width) $pap(graph,ds,error,width) - - set var(graph,ds,bar,relief) $pap(graph,ds,bar,relief) -} - proc PlotSaveState {varname} { upvar #0 $varname var global $varname set cc $var(graph,current) - set nn $var(graph$cc,data,current) + set nn $var($cc,data,current) # per Graph - set var(graph$cc,title) $var(graph,title) - - set var(graph$cc,legend) $var(graph,legend) - set var(graph$cc,legend,title) $var(graph,legend,title) - set var(graph$cc,legend,position) $var(graph,legend,position) - - set var(graph$cc,axis,x,title) $var(graph,axis,x,title) - set var(graph$cc,axis,x,grid) $var(graph,axis,x,grid) - set var(graph$cc,axis,x,log) $var(graph,axis,x,log) - set var(graph$cc,axis,x,flip) $var(graph,axis,x,flip) - set var(graph$cc,axis,x,auto) $var(graph,axis,x,auto) - set var(graph$cc,axis,x,min) $var(graph,axis,x,min) - set var(graph$cc,axis,x,max) $var(graph,axis,x,max) - set var(graph$cc,axis,x,format) $var(graph,axis,x,format) - - set var(graph$cc,axis,y,title) $var(graph,axis,y,title) - set var(graph$cc,axis,y,grid) $var(graph,axis,y,grid) - set var(graph$cc,axis,y,log) $var(graph,axis,y,log) - set var(graph$cc,axis,y,flip) $var(graph,axis,y,flip) - set var(graph$cc,axis,y,auto) $var(graph,axis,y,auto) - set var(graph$cc,axis,y,min) $var(graph,axis,y,min) - set var(graph$cc,axis,y,max) $var(graph,axis,y,max) - set var(graph$cc,axis,y,format) $var(graph,axis,y,format) + set var($cc,title) $var(graph,title) + + set var($cc,legend) $var(graph,legend) + set var($cc,legend,title) $var(graph,legend,title) + set var($cc,legend,position) $var(graph,legend,position) + + set var($cc,axis,x,title) $var(graph,axis,x,title) + set var($cc,axis,x,grid) $var(graph,axis,x,grid) + set var($cc,axis,x,log) $var(graph,axis,x,log) + set var($cc,axis,x,flip) $var(graph,axis,x,flip) + set var($cc,axis,x,auto) $var(graph,axis,x,auto) + set var($cc,axis,x,min) $var(graph,axis,x,min) + set var($cc,axis,x,max) $var(graph,axis,x,max) + set var($cc,axis,x,format) $var(graph,axis,x,format) + + set var($cc,axis,y,title) $var(graph,axis,y,title) + set var($cc,axis,y,grid) $var(graph,axis,y,grid) + set var($cc,axis,y,log) $var(graph,axis,y,log) + set var($cc,axis,y,flip) $var(graph,axis,y,flip) + set var($cc,axis,y,auto) $var(graph,axis,y,auto) + set var($cc,axis,y,min) $var(graph,axis,y,min) + set var($cc,axis,y,max) $var(graph,axis,y,max) + set var($cc,axis,y,format) $var(graph,axis,y,format) # per DataSet - set var(graph$cc,$nn,name) $var(graph,ds,name) - set var(graph$cc,$nn,show) $var(graph,ds,show) - set var(graph$cc,$nn,smooth) $var(graph,ds,smooth) - set var(graph$cc,$nn,color) $var(graph,ds,color) - set var(graph$cc,$nn,fill) $var(graph,ds,fill) - set var(graph$cc,$nn,fill,color) $var(graph,ds,fill,color) - set var(graph$cc,$nn,width) $var(graph,ds,width) - set var(graph$cc,$nn,dash) $var(graph,ds,dash) - - set var(graph$cc,$nn,shape,symbol) $var(graph,ds,shape,symbol) - set var(graph$cc,$nn,shape,fill) $var(graph,ds,shape,fill) - set var(graph$cc,$nn,shape,color) $var(graph,ds,shape,color) - - set var(graph$cc,$nn,error) $var(graph,ds,error) - set var(graph$cc,$nn,error,cap) $var(graph,ds,error,cap) - set var(graph$cc,$nn,error,color) $var(graph,ds,error,color) - set var(graph$cc,$nn,error,width) $var(graph,ds,error,width) - - set var(graph$cc,$nn,bar,relief) $var(graph,ds,bar,relief) + set var($cc,$nn,name) $var(graph,ds,name) + set var($cc,$nn,show) $var(graph,ds,show) + set var($cc,$nn,smooth) $var(graph,ds,smooth) + set var($cc,$nn,color) $var(graph,ds,color) + set var($cc,$nn,fill) $var(graph,ds,fill) + set var($cc,$nn,fill,color) $var(graph,ds,fill,color) + set var($cc,$nn,width) $var(graph,ds,width) + set var($cc,$nn,dash) $var(graph,ds,dash) + + set var($cc,$nn,shape,symbol) $var(graph,ds,shape,symbol) + set var($cc,$nn,shape,fill) $var(graph,ds,shape,fill) + set var($cc,$nn,shape,color) $var(graph,ds,shape,color) + + set var($cc,$nn,error) $var(graph,ds,error) + set var($cc,$nn,error,cap) $var(graph,ds,error,cap) + set var($cc,$nn,error,color) $var(graph,ds,error,color) + set var($cc,$nn,error,width) $var(graph,ds,error,width) + + set var($cc,$nn,bar,relief) $var(graph,ds,bar,relief) } proc PlotRestoreState {varname nn} { @@ -200,42 +142,42 @@ proc PlotRestoreState {varname nn} { global $varname set cc $var(graph,current) - set nn $var(graph$cc,data,current) + set nn $var($cc,data,current) # per Graph - set var(graph,title) $var(graph$cc,title) + set var(graph,title) $var($cc,title) - set var(graph,legend) $var(graph$cc,legend) - set var(graph,legend,title) $var(graph$cc,legend,title) - set var(graph,legend,position) $var(graph$cc,legend,position) + set var(graph,legend) $var($cc,legend) + set var(graph,legend,title) $var($cc,legend,title) + set var(graph,legend,position) $var($cc,legend,position) - set var(graph,axis,x,title) $var(graph$cc,axis,x,title) - set var(graph,axis,x,grid) $var(graph$cc,axis,x,grid) - set var(graph,axis,x,log) $var(graph$cc,axis,x,log) - set var(graph,axis,x,flip) $var(graph$cc,axis,x,flip) - set var(graph,axis,x,auto) $var(graph$cc,axis,x,auto) - set var(graph,axis,x,min) $var(graph$cc,axis,x,min) - set var(graph,axis,x,max) $var(graph$cc,axis,x,max) - set var(graph,axis,x,format) $var(graph$cc,axis,x,format) + set var(graph,axis,x,title) $var($cc,axis,x,title) + set var(graph,axis,x,grid) $var($cc,axis,x,grid) + set var(graph,axis,x,log) $var($cc,axis,x,log) + set var(graph,axis,x,flip) $var($cc,axis,x,flip) + set var(graph,axis,x,auto) $var($cc,axis,x,auto) + set var(graph,axis,x,min) $var($cc,axis,x,min) + set var(graph,axis,x,max) $var($cc,axis,x,max) + set var(graph,axis,x,format) $var($cc,axis,x,format) # per DataSet - set var(graph,ds,name) $var(graph$cc,$nn,name) - set var(graph,ds,show) $var(graph$cc,$nn,show) - set var(graph,ds,smooth) $var(graph$cc,$nn,smooth) - set var(graph,ds,color) $var(graph$cc,$nn,color) - set var(graph,ds,fill) $var(graph$cc,$nn,fill) - set var(graph,ds,fill,color) $var(graph$cc,$nn,fill,color) - set var(graph,ds,width) $var(graph$cc,$nn,width) - set var(graph,ds,dash) $var(graph$cc,$nn,dash) - - set var(graph,ds,shape,symbol) $var(graph$cc,$nn,shape,symbol) - set var(graph,ds,shape,fill) $var(graph$cc,$nn,shape,fill) - set var(graph,ds,shape,color) $var(graph$cc,$nn,shape,color) - - set var(graph,ds,error) $var(graph$cc,$nn,error) - set var(graph,ds,error,cap) $var(graph$cc,$nn,error,cap) - set var(graph,ds,error,color) $var(graph$cc,$nn,error,color) - set var(graph,ds,error,width) $var(graph$cc,$nn,error,width) - - set var(graph,ds,bar,relief) $var(graph$cc,$nn,bar,relief) + set var(graph,ds,name) $var($cc,$nn,name) + set var(graph,ds,show) $var($cc,$nn,show) + set var(graph,ds,smooth) $var($cc,$nn,smooth) + set var(graph,ds,color) $var($cc,$nn,color) + set var(graph,ds,fill) $var($cc,$nn,fill) + set var(graph,ds,fill,color) $var($cc,$nn,fill,color) + set var(graph,ds,width) $var($cc,$nn,width) + set var(graph,ds,dash) $var($cc,$nn,dash) + + set var(graph,ds,shape,symbol) $var($cc,$nn,shape,symbol) + set var(graph,ds,shape,fill) $var($cc,$nn,shape,fill) + set var(graph,ds,shape,color) $var($cc,$nn,shape,color) + + set var(graph,ds,error) $var($cc,$nn,error) + set var(graph,ds,error,cap) $var($cc,$nn,error,cap) + set var(graph,ds,error,color) $var($cc,$nn,error,color) + set var(graph,ds,error,width) $var($cc,$nn,error,width) + + set var(graph,ds,bar,relief) $var($cc,$nn,bar,relief) } diff --git a/ds9/parsers/plotparser.tac b/ds9/parsers/plotparser.tac index 5bb7203..a2afe27 100644 --- a/ds9/parsers/plotparser.tac +++ b/ds9/parsers/plotparser.tac @@ -250,7 +250,7 @@ plotCmd : LOAD_ load | MODE_ mode {ProcessCmdCVAR mode $2 PlotChangeMode} | AXIS_ axis - | BACKGROUND_ STRING_ {PlotCmdUpdateGraph graph,bg $2} + | BACKGROUND_ STRING_ {PlotCmdUpdateGraph bg $2} | LEGEND_ legend | FONT_ fontt | TITLE_ title diff --git a/ds9/parsers/plotparser.tcl b/ds9/parsers/plotparser.tcl index 87ecd64..1f028d7 100644 --- a/ds9/parsers/plotparser.tcl +++ b/ds9/parsers/plotparser.tcl @@ -5428,7 +5428,7 @@ proc plot::yyparse {} { 74 { PlotCmdSaveConfig $2 } 78 { ProcessCmdCVAR0 PlotDestroy } 79 { ProcessCmdCVAR mode $2 PlotChangeMode } - 81 { PlotCmdUpdateGraph graph,bg $2 } + 81 { PlotCmdUpdateGraph bg $2 } 85 { PlotCmdUpdateCanvas bar,mode $2 } 86 { PlotCmdUpdateElement graph,ds,show $2 } 88 { PlotCmdUpdateElement graph,ds,fill $2 } diff --git a/ds9/parsers/plotsendparser.tac b/ds9/parsers/plotsendparser.tac index 44f3127..a5444ba 100644 --- a/ds9/parsers/plotsendparser.tac +++ b/ds9/parsers/plotsendparser.tac @@ -76,7 +76,7 @@ plotCmd : STATS_ {ProcessSendCmdCVAR PlotStatsGenerate} | LIST_ {ProcessSendCmdCVAR PlotListGenerate} | MODE_ {ProcessSendCmdCVARGet mode} | AXIS_ axis - | BACKGROUND_ {ProcessSendCmdCVARGet graph,bg} + | BACKGROUND_ {ProcessSendCmdCVARGet bg} | LEGEND_ legend | FONT_ fontt | TITLE_ title diff --git a/ds9/parsers/plotsendparser.tcl b/ds9/parsers/plotsendparser.tcl index 71daaeb..d5fad69 100644 --- a/ds9/parsers/plotsendparser.tcl +++ b/ds9/parsers/plotsendparser.tcl @@ -1489,7 +1489,7 @@ proc plotsend::yyparse {} { 13 { ProcessSendCmdCVAR PlotStatsGenerate } 14 { ProcessSendCmdCVAR PlotListGenerate } 15 { ProcessSendCmdCVARGet mode } - 17 { ProcessSendCmdCVARGet graph,bg } + 17 { ProcessSendCmdCVARGet bg } 21 { ProcessSendCmdCVARGet bar,mode } 22 { ProcessSendCmdCVARYesNo graph,ds,show } 23 { ProcessSendCmdCVARGet graph,ds,color } -- cgit v0.12