From 4635ea4e5fca15ce620c46ff0bda44d9393fe596 Mon Sep 17 00:00:00 2001 From: William Joye Date: Fri, 31 May 2019 14:55:16 -0400 Subject: add multiple plot support --- ds9/library/plot.tcl | 66 ++++++++++--------------- ds9/library/plotconfig.tcl | 110 +++++++++++++++++++---------------------- ds9/library/plotdata.tcl | 15 ++---- ds9/library/plotdialog.tcl | 72 +++++++++++++-------------- ds9/library/plotprocess.tcl | 12 ++--- ds9/library/plotstate.tcl | 89 ++++++++++++++++++++++++++------- ds9/parsers/plotparser.tac | 44 ++++++++--------- ds9/parsers/plotparser.tcl | 44 ++++++++--------- ds9/parsers/plotsendparser.tac | 18 +++---- ds9/parsers/plotsendparser.tcl | 18 +++---- 10 files changed, 256 insertions(+), 232 deletions(-) diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl index a98b865..a482f7e 100644 --- a/ds9/library/plot.tcl +++ b/ds9/library/plot.tcl @@ -187,15 +187,15 @@ proc PlotDeleteData {varname} { set var(graph$cc,yedata) {} # reset other variables - set var(axis,x,auto) 1 - set var(axis,x,min) {} - set var(axis,x,max) {} - set var(axis,x,format) {} - - set var(axis,y,auto) 1 - set var(axis,y,min) {} - set var(axis,y,max) {} - set var(axis,y,format) {} + 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) {} $var(mb).graph.select delete $ds9(menu,start) end @@ -253,7 +253,7 @@ proc PlotAxisFormat {varname axis w nn} { upvar #0 $varname var global $varname - return [format $var(axis,$axis,format) $nn] + return [format $var(graph,axis,$axis,format) $nn] } proc PlotChangeMode {varname} { @@ -436,20 +436,6 @@ proc PlotListDestroyCB {varname} { set var(list) 0 } -proc PlotNextColor {which} { - switch -- $which { - black {return red} - red {return green} - green {return blue} - blue {return cyan} - cyan {return magenta} - magenta {return yellow} - yellow {return black} - white {return white} - default {return red} - } -} - proc PlotPing {varname} { upvar #0 $varname var global $varname @@ -547,35 +533,35 @@ proc PlotUpdateGraph {varname} { global ds9 - if {$var(axis,x,auto)} { + if {$var(graph,axis,x,auto)} { set xmin {} set xmax {} } else { - set xmin $var(axis,x,min) - set xmax $var(axis,x,max) + set xmin $var(graph,axis,x,min) + set xmax $var(graph,axis,x,max) } - if {$var(axis,y,auto)} { + if {$var(graph,axis,y,auto)} { set ymin {} set ymax {} } else { - set ymin $var(axis,y,min) - set ymax $var(axis,y,max) + set ymin $var(graph,axis,y,min) + set ymax $var(graph,axis,y,max) } $var(graph$cc) xaxis configure -min $xmin -max $xmax \ - -descending $var(axis,x,flip) + -descending $var(graph,axis,x,flip) $var(graph$cc) yaxis configure -min $ymin -max $ymax \ - -descending $var(axis,y,flip) + -descending $var(graph,axis,y,flip) if {$var(graph,format)} { - if {$var(axis,x,format) != {}} { + if {$var(graph,axis,x,format) != {}} { $var(graph$cc) xaxis configure \ -command [list PlotAxisFormat $varname x] } else { $var(graph$cc) xaxis configure -command {} } - if {$var(axis,y,format) != {}} { + if {$var(graph,axis,y,format) != {}} { $var(graph$cc) yaxis configure \ -command [list PlotAxisFormat $varname y] } else { @@ -613,15 +599,15 @@ proc PlotUpdateGraph {varname} { $var(graph$cc) xaxis configure \ -bg $var(graph,bg) \ - -grid $var(axis,x,grid) -logscale $var(axis,x,log) \ - -title $var(axis,x,title) \ + -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)" $var(graph$cc) yaxis configure \ -bg $var(graph,bg) \ - -grid $var(axis,y,grid) -logscale $var(axis,y,log) \ - -title $var(axis,y,title) \ + -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)" @@ -680,8 +666,8 @@ proc PlotTitle {varname title xaxis yaxis} { set cc $var(graph,current) set var(graph,title) "$title" - set var(axis,x,title) "$xaxis" - set var(axis,y,title) "$yaxis" + set var(graph,axis,x,title) "$xaxis" + set var(graph,axis,y,title) "$yaxis" } proc PlotBackup {ch dir} { diff --git a/ds9/library/plotconfig.tcl b/ds9/library/plotconfig.tcl index 9cfcbd4..59431e0 100644 --- a/ds9/library/plotconfig.tcl +++ b/ds9/library/plotconfig.tcl @@ -28,8 +28,6 @@ proc PlotLoadConfigFile {varname filename} { set var(graph,bg) $analysisplot(graph,bg) set var(bar,mode) $analysisplot(bar,mode) - - set var(graph,title) $analysisplot(graph,title) set var(graph,title,family) $analysisplot(graph,title,family) set var(graph,title,size) $analysisplot(graph,title,size) set var(graph,title,weight) $analysisplot(graph,title,weight) @@ -44,24 +42,6 @@ proc PlotLoadConfigFile {varname filename} { set var(legend,font,weight) $analysisplot(legend,font,weight) set var(legend,font,slant) $analysisplot(legend,font,slant) - set var(axis,x,title) $analysisplot(axis,x,title) - set var(axis,x,grid) $analysisplot(axis,x,grid) - set var(axis,x,log) $analysisplot(axis,x,log) - set var(axis,x,flip) $analysisplot(axis,x,flip) - set var(axis,x,auto) $analysisplot(axis,x,auto) - set var(axis,x,min) $analysisplot(axis,x,min) - set var(axis,x,max) $analysisplot(axis,x,max) - set var(axis,x,format) $analysisplot(axis,x,format) - - set var(axis,y,title) $analysisplot(axis,y,title) - set var(axis,y,grid) $analysisplot(axis,y,grid) - set var(axis,y,log) $analysisplot(axis,y,log) - set var(axis,y,flip) $analysisplot(axis,y,flip) - set var(axis,y,auto) $analysisplot(axis,y,auto) - set var(axis,y,min) $analysisplot(axis,y,min) - set var(axis,y,max) $analysisplot(axis,y,max) - set var(axis,y,format) $analysisplot(axis,y,format) - set var(axis,title,family) $analysisplot(axis,title,family) set var(axis,title,size) $analysisplot(axis,title,size) set var(axis,title,weight) $analysisplot(axis,title,weight) @@ -73,10 +53,30 @@ proc PlotLoadConfigFile {varname filename} { set var(axis,font,slant) $analysisplot(axis,font,slant) # per Graph + set var(graph,title) $analysisplot(graph,title) + set var(graph,legend) $analysisplot(legend) set var(graph,legend,title) $analysisplot(legend,title) set var(graph,legend,position) $analysisplot(legend,position) + set var(graph,axis,x,title) $analysisplot(axis,x,title) + set var(graph,axis,x,grid) $analysisplot(axis,x,grid) + set var(graph,axis,x,log) $analysisplot(axis,x,log) + set var(graph,axis,x,flip) $analysisplot(axis,x,flip) + set var(graph,axis,x,auto) $analysisplot(axis,x,auto) + set var(graph,axis,x,min) $analysisplot(axis,x,min) + set var(graph,axis,x,max) $analysisplot(axis,x,max) + set var(graph,axis,x,format) $analysisplot(axis,x,format) + + set var(graph,axis,y,title) $analysisplot(axis,y,title) + set var(graph,axis,y,grid) $analysisplot(axis,y,grid) + set var(graph,axis,y,log) $analysisplot(axis,y,log) + set var(graph,axis,y,flip) $analysisplot(axis,y,flip) + set var(graph,axis,y,auto) $analysisplot(axis,y,auto) + set var(graph,axis,y,min) $analysisplot(axis,y,min) + set var(graph,axis,y,max) $analysisplot(axis,y,max) + set var(graph,axis,y,format) $analysisplot(axis,y,format) + # per Dataset # set var(graph,ds,name) {} set var(graph,ds,show) $analysisplot(show) @@ -101,13 +101,6 @@ proc PlotLoadConfigFile {varname filename} { unset analysisplot # backward compatibility - FixVar ${varname}(axis,x,grid) ${varname}(graph,x,grid) - FixVar ${varname}(axis,x,log) ${varname}(graph,x,log) - FixVar ${varname}(axis,x,flip) ${varname}(graph,x,flip) - FixVar ${varname}(axis,y,grid) ${varname}(graph,y,grid) - FixVar ${varname}(axis,y,log) ${varname}(graph,y,log) - FixVar ${varname}(axis,y,flip) ${varname}(graph,y,flip) - FixVar ${varname}(graph,title,family) ${varname}(titleFont) FixVar ${varname}(graph,title,size) ${varname}(titleSize) FixVar ${varname}(graph,title,weight) ${varname}(titleWeight) @@ -159,14 +152,14 @@ proc PlotLoadConfigFile {varname filename} { FixVarRm ${varname}(step,width) if {[info exists var(grid)]} { - set var(axis,x,grid) $var(grid) - set var(axis,y,grid) $var(grid) + set var(graph,axis,x,grid) $var(grid) + set var(graph,axis,y,grid) $var(grid) unset var(grid) } if {[info exists var(format)]} { set var(graph,format) $var(format) - set var(axis,x,format) $var(format,x) - set var(axis,y,format) $var(format,y) + set var(graph,axis,x,format) $var(format,x) + set var(graph,axis,y,format) $var(format,y) unset var(format) unset var(format,x) unset var(format,y) @@ -175,20 +168,20 @@ proc PlotLoadConfigFile {varname filename} { if {[info exists var(grid,log)]} { switch $var(grid,log) { linearlinear { - set var(axis,x,log) 0 - set var(axis,y,log) 0 + set var(graph,axis,x,log) 0 + set var(graph,axis,y,log) 0 } linearlog { - set var(axis,x,log) 0 - set var(axis,y,log) 1 + set var(graph,axis,x,log) 0 + set var(graph,axis,y,log) 1 } loglinear { - set var(axis,x,log) 1 - set var(axis,y,log) 0 + set var(graph,axis,x,log) 1 + set var(graph,axis,y,log) 0 } loglog { - set var(axis,x,log) 1 - set var(axis,y,log) 1 + set var(graph,axis,x,log) 1 + set var(graph,axis,y,log) 1 } } unset var(grid,log) @@ -220,7 +213,6 @@ proc PlotSaveConfigFile {varname filename} { set analysisplot(graph,bg) $var(graph,bg) set analysisplot(bar,mode) $var(bar,mode) - set analysisplot(graph,title) $var(graph,title) 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) @@ -235,24 +227,6 @@ proc PlotSaveConfigFile {varname filename} { set analysisplot(legend,font,weight) $var(legend,font,weight) set analysisplot(legend,font,slant) $var(legend,font,slant) - set analysisplot(axis,x,title) $var(axis,x,title) - set analysisplot(axis,x,grid) $var(axis,x,grid) - set analysisplot(axis,x,log) $var(axis,x,log) - set analysisplot(axis,x,flip) $var(axis,x,flip) - set analysisplot(axis,x,auto) $var(axis,x,auto) - set analysisplot(axis,x,min) $var(axis,x,min) - set analysisplot(axis,x,max) $var(axis,x,max) - set analysisplot(axis,x,format) $var(axis,x,format) - - set analysisplot(axis,y,title) $var(axis,y,title) - set analysisplot(axis,y,grid) $var(axis,y,grid) - set analysisplot(axis,y,log) $var(axis,y,log) - set analysisplot(axis,y,flip) $var(axis,y,flip) - set analysisplot(axis,y,auto) $var(axis,y,auto) - set analysisplot(axis,y,min) $var(axis,y,min) - set analysisplot(axis,y,max) $var(axis,y,max) - set analysisplot(axis,y,format) $var(axis,y,format) - set analysisplot(axis,title,family) $var(axis,title,family) set analysisplot(axis,title,size) $var(axis,title,size) set analysisplot(axis,title,weight) $var(axis,title,weight) @@ -264,10 +238,30 @@ proc PlotSaveConfigFile {varname filename} { set analysisplot(axis,font,slant) $var(axis,font,slant) # per Graph + set analysisplot(graph,title) $var(graph,title) + set analysisplot(legend) $var(graph,legend) set analysisplot(legend,title) $var(graph,legend,title) set analysisplot(legend,position) $var(graph,legend,position) + set analysisplot(axis,x,title) $var(graph,axis,x,title) + set analysisplot(axis,x,grid) $var(graph,axis,x,grid) + set analysisplot(axis,x,log) $var(graph,axis,x,log) + set analysisplot(axis,x,flip) $var(graph,axis,x,flip) + set analysisplot(axis,x,auto) $var(graph,axis,x,auto) + set analysisplot(axis,x,min) $var(graph,axis,x,min) + set analysisplot(axis,x,max) $var(graph,axis,x,max) + set analysisplot(axis,x,format) $var(graph,axis,x,format) + + set analysisplot(axis,y,title) $var(graph,axis,y,title) + set analysisplot(axis,y,grid) $var(graph,axis,y,grid) + set analysisplot(axis,y,log) $var(graph,axis,y,log) + set analysisplot(axis,y,flip) $var(graph,axis,y,flip) + set analysisplot(axis,y,auto) $var(graph,axis,y,auto) + set analysisplot(axis,y,min) $var(graph,axis,y,min) + set analysisplot(axis,y,max) $var(graph,axis,y,max) + set analysisplot(axis,y,format) $var(graph,axis,y,format) + # per Dataset # set analysisplot(name) {} set analysisplot(show) $var(graph,ds,show) diff --git a/ds9/library/plotdata.tcl b/ds9/library/plotdata.tcl index d07dc75..800deef 100644 --- a/ds9/library/plotdata.tcl +++ b/ds9/library/plotdata.tcl @@ -113,24 +113,18 @@ proc PlotDataSet {varname dim data} { # first data set PlotDataSetOne $varname "4.1" $data - # set color - set col [PlotNextColor $var(graph,ds,color)] - # second data set PlotDataSetOne $varname "4.2" $data - set var(graph,ds,color) $col + $var(proc,updateelement) $varname } 5 { # first data set PlotDataSetOne $varname "5.1" $data - # set color - set col [PlotNextColor $var(graph,ds,color)] - # second data set PlotDataSetOne $varname "5.2" $data - set var(graph,ds,color) $col + $var(proc,updateelement) $varname } default {PlotDataSetOne $varname $dim $data} @@ -390,10 +384,9 @@ proc PlotDupData {varname mm} { 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) [PlotNextColor $var(graph$cc,$mm,color)] + 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) \ - [PlotNextColor $var(graph$cc,$mm,fill,color)] + 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) diff --git a/ds9/library/plotdialog.tcl b/ds9/library/plotdialog.tcl index 555986d..17bf187 100644 --- a/ds9/library/plotdialog.tcl +++ b/ds9/library/plotdialog.tcl @@ -178,23 +178,23 @@ proc PlotDialog {varname wtt title xaxis yaxis} { menu $var(mb).graph.axes $var(mb).graph.axes add checkbutton -label [msgcat::mc {X Grid}] \ - -variable ${varname}(axis,x,grid) \ + -variable ${varname}(graph,axis,x,grid) \ -command [list $var(proc,updategraph) $varname] $var(mb).graph.axes add checkbutton -label [msgcat::mc {Log}] \ - -variable ${varname}(axis,x,log) \ + -variable ${varname}(graph,axis,x,log) \ -command [list $var(proc,updategraph) $varname] $var(mb).graph.axes add checkbutton -label [msgcat::mc {Flip}] \ - -variable ${varname}(axis,x,flip) \ + -variable ${varname}(graph,axis,x,flip) \ -command [list $var(proc,updategraph) $varname] $var(mb).graph.axes add separator $var(mb).graph.axes add checkbutton -label [msgcat::mc {Y Grid}] \ - -variable ${varname}(axis,y,grid) \ + -variable ${varname}(graph,axis,y,grid) \ -command [list $var(proc,updategraph) $varname] $var(mb).graph.axes add checkbutton -label [msgcat::mc {Log}] \ - -variable ${varname}(axis,y,log) \ + -variable ${varname}(graph,axis,y,log) \ -command [list $var(proc,updategraph) $varname] $var(mb).graph.axes add checkbutton -label [msgcat::mc {Flip}] \ - -variable ${varname}(axis,y,flip) \ + -variable ${varname}(graph,axis,y,flip) \ -command [list $var(proc,updategraph) $varname] $var(mb).graph.axes add separator $var(mb).graph.axes add command -label "[msgcat::mc {Range}]..." \ @@ -289,15 +289,15 @@ proc PlotRangeDialog {varname} { set ed(ok) 0 - set ed(x,auto) $var(axis,x,auto) - set ed(x,min) $var(axis,x,min) - set ed(x,max) $var(axis,x,max) - set ed(x,format) $var(axis,x,format) + set ed(graph,axis,x,auto) $var(graph,axis,x,auto) + set ed(graph,axis,x,min) $var(graph,axis,x,min) + set ed(graph,axis,x,max) $var(graph,axis,x,max) + set ed(graph,axis,x,format) $var(graph,axis,x,format) - set ed(y,auto) $var(axis,y,auto) - set ed(y,min) $var(axis,y,min) - set ed(y,max) $var(axis,y,max) - set ed(y,format) $var(axis,y,format) + set ed(graph,axis,y,auto) $var(graph,axis,y,auto) + set ed(graph,axis,y,min) $var(graph,axis,y,min) + set ed(graph,axis,y,max) $var(graph,axis,y,max) + set ed(graph,axis,y,format) $var(graph,axis,y,format) DialogCreate $w [msgcat::mc {Range}] ed(ok) @@ -310,16 +310,16 @@ proc PlotRangeDialog {varname} { ttk::label $f.tauto -text [msgcat::mc {Automatic}] ttk::label $f.x -text [msgcat::mc {X}] - ttk::entry $f.xmin -textvariable ed(x,min) -width 12 - ttk::entry $f.xmax -textvariable ed(x,max) -width 12 - ttk::entry $f.xformat -textvariable ed(x,format) -width 8 - ttk::checkbutton $f.xauto -variable ed(x,auto) + ttk::entry $f.xmin -textvariable ed(graph,axis,x,min) -width 12 + ttk::entry $f.xmax -textvariable ed(graph,axis,x,max) -width 12 + ttk::entry $f.xformat -textvariable ed(graph,axis,x,format) -width 8 + ttk::checkbutton $f.xauto -variable ed(graph,axis,x,auto) ttk::label $f.y -text [msgcat::mc {Y}] - ttk::entry $f.ymin -textvariable ed(y,min) -width 12 - ttk::entry $f.ymax -textvariable ed(y,max) -width 12 - ttk::entry $f.yformat -textvariable ed(y,format) -width 8 - ttk::checkbutton $f.yauto -variable ed(y,auto) + ttk::entry $f.ymin -textvariable ed(graph,axis,y,min) -width 12 + ttk::entry $f.ymax -textvariable ed(graph,axis,y,max) -width 12 + ttk::entry $f.yformat -textvariable ed(graph,axis,y,format) -width 8 + ttk::checkbutton $f.yauto -variable ed(graph,axis,y,auto) grid $f.t $f.tfrom $f.tto $f.tformat $f.tauto -padx 2 -pady 2 -sticky w grid $f.x $f.xmin $f.xmax $f.xformat $f.xauto -padx 2 -pady 2 -sticky w @@ -344,15 +344,15 @@ proc PlotRangeDialog {varname} { DialogDismiss $w if {$ed(ok)} { - set var(axis,x,auto) $ed(x,auto) - set var(axis,x,min) $ed(x,min) - set var(axis,x,max) $ed(x,max) - set var(axis,x,format) $ed(x,format) + set var(graph,axis,x,auto) $ed(graph,axis,x,auto) + set var(graph,axis,x,min) $ed(graph,axis,x,min) + set var(graph,axis,x,max) $ed(graph,axis,x,max) + set var(graph,axis,x,format) $ed(graph,axis,x,format) - set var(axis,y,auto) $ed(y,auto) - set var(axis,y,min) $ed(y,min) - set var(axis,y,max) $ed(y,max) - set var(axis,y,format) $ed(y,format) + set var(graph,axis,y,auto) $ed(graph,axis,y,auto) + set var(graph,axis,y,min) $ed(graph,axis,y,min) + set var(graph,axis,y,max) $ed(graph,axis,y,max) + set var(graph,axis,y,format) $ed(graph,axis,y,format) $var(proc,updategraph) $varname } @@ -371,8 +371,8 @@ proc PlotGraphTitleDialog {varname} { set ed(ok) 0 set ed(graph,title) $var(graph,title) - set ed(axis,x,title) $var(axis,x,title) - set ed(axis,y,title) $var(axis,y,title) + set ed(graph,axis,x,title) $var(graph,axis,x,title) + set ed(graph,axis,y,title) $var(graph,axis,y,title) set ed(graph,legend,title) $var(graph,legend,title) DialogCreate $w [msgcat::mc {Title}] ed(ok) @@ -382,9 +382,9 @@ proc PlotGraphTitleDialog {varname} { ttk::label $f.label -text [msgcat::mc {Title}] ttk::entry $f.title -textvariable ed(graph,title) -width 30 ttk::label $f.xlabel -text [msgcat::mc {X Axis Title}] - ttk::entry $f.xtitle -textvariable ed(axis,x,title) -width 30 + ttk::entry $f.xtitle -textvariable ed(graph,axis,x,title) -width 30 ttk::label $f.ylabel -text [msgcat::mc {Y Axis Title}] - ttk::entry $f.ytitle -textvariable ed(axis,y,title) -width 30 + ttk::entry $f.ytitle -textvariable ed(graph,axis,y,title) -width 30 ttk::label $f.legendlabel -text [msgcat::mc {Legend Title}] ttk::entry $f.legendtitle -textvariable ed(graph,legend,title) -width 30 @@ -414,8 +414,8 @@ proc PlotGraphTitleDialog {varname} { if {$ed(ok)} { set var(graph,title) $ed(graph,title) - set var(axis,x,title) $ed(axis,x,title) - set var(axis,y,title) $ed(axis,y,title) + set var(graph,axis,x,title) $ed(graph,axis,x,title) + set var(graph,axis,y,title) $ed(graph,axis,y,title) set var(graph,legend,title) $ed(graph,legend,title) $var(proc,updategraph) $varname diff --git a/ds9/library/plotprocess.tcl b/ds9/library/plotprocess.tcl index 69c6633..d0ec4dd 100644 --- a/ds9/library/plotprocess.tcl +++ b/ds9/library/plotprocess.tcl @@ -30,18 +30,18 @@ proc PrefsDialogPlot {} { set f [ttk::labelframe $w.plot.axis -text [msgcat::mc {Axis}]] ttk::label $f.xtitle -text [msgcat::mc {X}] - ttk::checkbutton $f.x -text [msgcat::mc {Grid}] -variable pap(axis,x,grid) + ttk::checkbutton $f.x -text [msgcat::mc {Grid}] -variable pap(graph,axis,x,grid) ttk::radiobutton $f.xlinear -text [msgcat::mc {Linear}] \ - -variable pap(axis,x,log) -value 0 + -variable pap(graph,axis,x,log) -value 0 ttk::radiobutton $f.xlog -text [msgcat::mc {Log}] \ - -variable pap(axis,x,log) -value 1 + -variable pap(graph,axis,x,log) -value 1 ttk::label $f.ytitle -text [msgcat::mc {Y}] - ttk::checkbutton $f.y -text [msgcat::mc {Grid}] -variable pap(axis,y,grid) + ttk::checkbutton $f.y -text [msgcat::mc {Grid}] -variable pap(graph,axis,y,grid) ttk::radiobutton $f.ylinear -text [msgcat::mc {Linear}] \ - -variable pap(axis,y,log) -value 0 + -variable pap(graph,axis,y,log) -value 0 ttk::radiobutton $f.ylog -text [msgcat::mc {Log}] \ - -variable pap(axis,y,log) -value 1 + -variable pap(graph,axis,y,log) -value 1 ttk::label $f.ttextlab -text [msgcat::mc {Axis Title}] FontMenuButton $f.textlab pap axis,title,family axis,title,size axis,title,weight axis,title,slant {} diff --git a/ds9/library/plotstate.tcl b/ds9/library/plotstate.tcl index 7e029c8..749ddce 100644 --- a/ds9/library/plotstate.tcl +++ b/ds9/library/plotstate.tcl @@ -36,31 +36,31 @@ proc PlotDefState {} { set pap(axis,font,weight) normal set pap(axis,font,slant) roman - set pap(axis,x,title) {} - set pap(axis,x,grid) 1 - set pap(axis,x,log) 0 - set pap(axis,x,flip) 0 - set pap(axis,x,auto) 1 - set pap(axis,x,min) {} - set pap(axis,x,max) {} - set pap(axis,x,format) {} - - set pap(axis,y,title) {} - set pap(axis,y,grid) 1 - set pap(axis,y,log) 0 - set pap(axis,y,flip) 0 - set pap(axis,y,auto) 1 - set pap(axis,y,min) {} - set pap(axis,y,max) {} - set pap(axis,y,format) {} - + # per Graph set pap(graph,title) {} - # per Graph set pap(graph,legend) 0 set pap(graph,legend,title) Legend set pap(graph,legend,position) right + set pap(graph,axis,x,title) {} + set pap(graph,axis,x,grid) 1 + set pap(graph,axis,x,log) 0 + set pap(graph,axis,x,flip) 0 + set pap(graph,axis,x,auto) 1 + set pap(graph,axis,x,min) {} + set pap(graph,axis,x,max) {} + set pap(graph,axis,x,format) {} + + set pap(graph,axis,y,title) {} + set pap(graph,axis,y,grid) 1 + set pap(graph,axis,y,log) 0 + set pap(graph,axis,y,flip) 0 + set pap(graph,axis,y,auto) 1 + set pap(graph,axis,y,min) {} + set pap(graph,axis,y,max) {} + set pap(graph,axis,y,format) {} + # per DataSet set pap(graph,ds,name) {} set pap(graph,ds,show) 1 @@ -95,10 +95,30 @@ proc PlotInitState {varname} { 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) @@ -129,10 +149,30 @@ proc PlotSaveState {varname} { set nn $var(graph$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) + # per DataSet set var(graph$cc,$nn,name) $var(graph,ds,name) set var(graph$cc,$nn,show) $var(graph,ds,show) @@ -163,10 +203,21 @@ proc PlotRestoreState {varname nn} { set nn $var(graph$cc,data,current) # per Graph + set var(graph,title) $var(graph$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,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) + # per DataSet set var(graph,ds,name) $var(graph$cc,$nn,name) set var(graph,ds,show) $var(graph$cc,$nn,show) diff --git a/ds9/parsers/plotparser.tac b/ds9/parsers/plotparser.tac index d29fab6..5bb7203 100644 --- a/ds9/parsers/plotparser.tac +++ b/ds9/parsers/plotparser.tac @@ -344,13 +344,13 @@ mode : POINTER_ {set _ pointer} | ZOOM_ {set _ zoom} ; -axis : xy GRID_ yesno {PlotCmdUpdateGraph "axis,$1,grid" $3} - | xy LOG_ yesno {PlotCmdUpdateGraph "axis,$1,log" $3} - | xy FLIP_ yesno {PlotCmdUpdateGraph "axis,$1,flip" $3} - | xy AUTO_ yesno {PlotCmdUpdateGraph "axis,$1,auto" $3} - | xy MIN_ numeric {PlotCmdUpdateGraph "axis,$1,min" $3} - | xy MAX_ numeric {PlotCmdUpdateGraph "axis,$1,max" $3} - | xy FORMAT_ STRING_ {PlotCmdUpdateGraph "axis,$1,format" $3} +axis : xy GRID_ yesno {PlotCmdUpdateGraph "graph,axis,$1,grid" $3} + | xy LOG_ yesno {PlotCmdUpdateGraph "graph,axis,$1,log" $3} + | xy FLIP_ yesno {PlotCmdUpdateGraph "graph,axis,$1,flip" $3} + | xy AUTO_ yesno {PlotCmdUpdateGraph "graph,axis,$1,auto" $3} + | xy MIN_ numeric {PlotCmdUpdateGraph "graph,axis,$1,min" $3} + | xy MAX_ numeric {PlotCmdUpdateGraph "graph,axis,$1,max" $3} + | xy FORMAT_ STRING_ {PlotCmdUpdateGraph "graph,axis,$1,format" $3} ; legend : yesno {PlotCmdUpdateGraph graph,legend $1} @@ -389,8 +389,8 @@ fontType : TITLE_ {set _ graph,title} ; title : STRING_ {PlotCmdUpdateGraph graph,title $1} - | xy STRING_ {PlotCmdUpdateGraph "axis,$1,title" $2} - | xyaxis STRING_ {PlotCmdUpdateGraph "axis,$1,title" $2} + | xy STRING_ {PlotCmdUpdateGraph "graph,axis,$1,title" $2} + | xyaxis STRING_ {PlotCmdUpdateGraph "graph,axis,$1,title" $2} | LEGEND_ STRING_ {PlotCmdUpdateGraph graph,legend,title $2} ; @@ -454,26 +454,26 @@ smooth : STEP_ {set _ step} # backward compatibility oldGraph : GRID_ oldGraphGrid - | LOG_ xy yesno {PlotCmdUpdateGraph "axis,$2,log" $3} - | FLIP_ xy yesno {PlotCmdUpdateGraph "axis,$2,flip" $3} - | FORMAT_ xy STRING_ {PlotCmdUpdateGraph "axis,$3,format" $3} + | LOG_ xy yesno {PlotCmdUpdateGraph "graph,axis,$2,log" $3} + | FLIP_ xy yesno {PlotCmdUpdateGraph "graph,axis,$2,flip" $3} + | FORMAT_ xy STRING_ {PlotCmdUpdateGraph "graph,axis,$3,format" $3} | RANGE_ oldGraphRange | LABELS_ oldGraphLabels | TYPE_ oldGraphType | SCALE_ oldGraphScale ; -oldGraphGrid : xy yesno {PlotCmdUpdateGraph "axis,$1,grid" $2} - | yesno {PlotCmdUpdateGraph "axis,x,grid" $1; PlotCmdUpdateGraph "axis,y,grid" $1} +oldGraphGrid : xy yesno {PlotCmdUpdateGraph "graph,axis,$1,grid" $2} + | yesno {PlotCmdUpdateGraph "graph,axis,x,grid" $1; PlotCmdUpdateGraph "graph,axis,y,grid" $1} ; -oldGraphRange : xy AUTO_ yesno {PlotCmdUpdateGraph "axis,$1,auto" $3} - | xy MIN_ numeric {PlotCmdUpdateGraph "axis,$1,min" $3} - | xy MAX_ numeric {PlotCmdUpdateGraph "axis,$1,max" $3} +oldGraphRange : xy AUTO_ yesno {PlotCmdUpdateGraph "graph,axis,$1,auto" $3} + | xy MIN_ numeric {PlotCmdUpdateGraph "graph,axis,$1,min" $3} + | xy MAX_ numeric {PlotCmdUpdateGraph "graph,axis,$1,max" $3} ; oldGraphLabels : TITLE_ STRING_ {PlotCmdUpdateGraph graph,title $2} - | xyaxis STRING_ {PlotCmdUpdateGraph "axis,$1,title" $2} + | xyaxis STRING_ {PlotCmdUpdateGraph "graph,axis,$1,title" $2} | LEGEND_ STRING_ {PlotCmdUpdateGraph graph,legend,title $2} ; @@ -481,10 +481,10 @@ oldGraphType : LINE_ | BAR_ ; -oldGraphScale : LINEARLINEAR_ {PlotCmdUpdateGraph "axis,x,log" 0; PlotCmdUpdateGraph "axis,y,log" 0} - | LINEARLOG_ {PlotCmdUpdateGraph "axis,x,log" 0; PlotCmdUpdateGraph "axis,y,log" 1} - | LOGLINEAR_ {PlotCmdUpdateGraph "axis,x,log" 1; PlotCmdUpdateGraph "axis,y,log" 0} - | LOGLOG_ {PlotCmdUpdateGraph "axis,x,log" 1; PlotCmdUpdateGraph "axis,y,log" 1} +oldGraphScale : LINEARLINEAR_ {PlotCmdUpdateGraph "graph,axis,x,log" 0; PlotCmdUpdateGraph "graph,axis,y,log" 0} + | LINEARLOG_ {PlotCmdUpdateGraph "graph,axis,x,log" 0; PlotCmdUpdateGraph "graph,axis,y,log" 1} + | LOGLINEAR_ {PlotCmdUpdateGraph "graph,axis,x,log" 1; PlotCmdUpdateGraph "graph,axis,y,log" 0} + | LOGLOG_ {PlotCmdUpdateGraph "graph,axis,x,log" 1; PlotCmdUpdateGraph "graph,axis,y,log" 1} ; # backward compatibility diff --git a/ds9/parsers/plotparser.tcl b/ds9/parsers/plotparser.tcl index 082822a..87ecd64 100644 --- a/ds9/parsers/plotparser.tcl +++ b/ds9/parsers/plotparser.tcl @@ -5480,13 +5480,13 @@ proc plot::yyparse {} { 139 { set _ gray } 140 { set _ pointer } 141 { set _ zoom } - 142 { PlotCmdUpdateGraph "axis,$1,grid" $3 } - 143 { PlotCmdUpdateGraph "axis,$1,log" $3 } - 144 { PlotCmdUpdateGraph "axis,$1,flip" $3 } - 145 { PlotCmdUpdateGraph "axis,$1,auto" $3 } - 146 { PlotCmdUpdateGraph "axis,$1,min" $3 } - 147 { PlotCmdUpdateGraph "axis,$1,max" $3 } - 148 { PlotCmdUpdateGraph "axis,$1,format" $3 } + 142 { PlotCmdUpdateGraph "graph,axis,$1,grid" $3 } + 143 { PlotCmdUpdateGraph "graph,axis,$1,log" $3 } + 144 { PlotCmdUpdateGraph "graph,axis,$1,flip" $3 } + 145 { PlotCmdUpdateGraph "graph,axis,$1,auto" $3 } + 146 { PlotCmdUpdateGraph "graph,axis,$1,min" $3 } + 147 { PlotCmdUpdateGraph "graph,axis,$1,max" $3 } + 148 { PlotCmdUpdateGraph "graph,axis,$1,format" $3 } 149 { PlotCmdUpdateGraph graph,legend $1 } 150 { PlotCmdUpdateGraph graph,legend,position $2 } 151 { set _ right } @@ -5511,8 +5511,8 @@ proc plot::yyparse {} { 170 { set _ legend,font } 171 { set _ legend,title } 172 { PlotCmdUpdateGraph graph,title $1 } - 173 { PlotCmdUpdateGraph "axis,$1,title" $2 } - 174 { PlotCmdUpdateGraph "axis,$1,title" $2 } + 173 { PlotCmdUpdateGraph "graph,axis,$1,title" $2 } + 174 { PlotCmdUpdateGraph "graph,axis,$1,title" $2 } 175 { PlotCmdUpdateGraph graph,legend,title $2 } 176 { set _ normal } 177 { set _ stacked } @@ -5547,21 +5547,21 @@ proc plot::yyparse {} { 213 { set _ cubic } 214 { set _ quadratic } 215 { set _ catrom } - 217 { PlotCmdUpdateGraph "axis,$2,log" $3 } - 218 { PlotCmdUpdateGraph "axis,$2,flip" $3 } - 219 { PlotCmdUpdateGraph "axis,$3,format" $3 } - 224 { PlotCmdUpdateGraph "axis,$1,grid" $2 } - 225 { PlotCmdUpdateGraph "axis,x,grid" $1; PlotCmdUpdateGraph "axis,y,grid" $1 } - 226 { PlotCmdUpdateGraph "axis,$1,auto" $3 } - 227 { PlotCmdUpdateGraph "axis,$1,min" $3 } - 228 { PlotCmdUpdateGraph "axis,$1,max" $3 } + 217 { PlotCmdUpdateGraph "graph,axis,$2,log" $3 } + 218 { PlotCmdUpdateGraph "graph,axis,$2,flip" $3 } + 219 { PlotCmdUpdateGraph "graph,axis,$3,format" $3 } + 224 { PlotCmdUpdateGraph "graph,axis,$1,grid" $2 } + 225 { PlotCmdUpdateGraph "graph,axis,x,grid" $1; PlotCmdUpdateGraph "graph,axis,y,grid" $1 } + 226 { PlotCmdUpdateGraph "graph,axis,$1,auto" $3 } + 227 { PlotCmdUpdateGraph "graph,axis,$1,min" $3 } + 228 { PlotCmdUpdateGraph "graph,axis,$1,max" $3 } 229 { PlotCmdUpdateGraph graph,title $2 } - 230 { PlotCmdUpdateGraph "axis,$1,title" $2 } + 230 { PlotCmdUpdateGraph "graph,axis,$1,title" $2 } 231 { PlotCmdUpdateGraph graph,legend,title $2 } - 234 { PlotCmdUpdateGraph "axis,x,log" 0; PlotCmdUpdateGraph "axis,y,log" 0 } - 235 { PlotCmdUpdateGraph "axis,x,log" 0; PlotCmdUpdateGraph "axis,y,log" 1 } - 236 { PlotCmdUpdateGraph "axis,x,log" 1; PlotCmdUpdateGraph "axis,y,log" 0 } - 237 { PlotCmdUpdateGraph "axis,x,log" 1; PlotCmdUpdateGraph "axis,y,log" 1 } + 234 { PlotCmdUpdateGraph "graph,axis,x,log" 0; PlotCmdUpdateGraph "graph,axis,y,log" 0 } + 235 { PlotCmdUpdateGraph "graph,axis,x,log" 0; PlotCmdUpdateGraph "graph,axis,y,log" 1 } + 236 { PlotCmdUpdateGraph "graph,axis,x,log" 1; PlotCmdUpdateGraph "graph,axis,y,log" 0 } + 237 { PlotCmdUpdateGraph "graph,axis,x,log" 1; PlotCmdUpdateGraph "graph,axis,y,log" 1 } 238 { PlotCmdUpdateElement graph,ds,shape,symbol $2 } 239 { PlotCmdUpdateElement graph,ds,width $3 } 240 { PlotCmdUpdateElement graph,ds,dash $3 } diff --git a/ds9/parsers/plotsendparser.tac b/ds9/parsers/plotsendparser.tac index 8c7cbe2..44f3127 100644 --- a/ds9/parsers/plotsendparser.tac +++ b/ds9/parsers/plotsendparser.tac @@ -99,13 +99,13 @@ plotCmd : STATS_ {ProcessSendCmdCVAR PlotStatsGenerate} | DATASET_ {PlotSendCmdCVARGet data,current} ; -axis : xy GRID_ {ProcessSendCmdCVARYesNo "axis,$1,grid"} - | xy LOG_ {ProcessSendCmdCVARYesNo "axis,$1,log"} - | xy FLIP_ {ProcessSendCmdCVARYesNo "axis,$1,flip"} - | xy AUTO_ {ProcessSendCmdCVARYesNo "axis,$1,auto"} - | xy MIN_ {ProcessSendCmdCVARGet "axis,$1,min"} - | xy MAX_ {ProcessSendCmdCVARGet "axis,$1,max"} - | xy FORMAT_ {ProcessSendCmdCVARGet "axis,$1,format"} +axis : xy GRID_ {ProcessSendCmdCVARYesNo "graph,axis,$1,grid"} + | xy LOG_ {ProcessSendCmdCVARYesNo "graph,axis,$1,log"} + | xy FLIP_ {ProcessSendCmdCVARYesNo "graph,axis,$1,flip"} + | xy AUTO_ {ProcessSendCmdCVARYesNo "graph,axis,$1,auto"} + | xy MIN_ {ProcessSendCmdCVARGet "graph,axis,$1,min"} + | xy MAX_ {ProcessSendCmdCVARGet "graph,axis,$1,max"} + | xy FORMAT_ {ProcessSendCmdCVARGet "graph,axis,$1,format"} ; legend : {ProcessSendCmdCVARYesNo graph,legend} @@ -138,8 +138,8 @@ fontType : TITLE_ {set _ graph,title} ; title : {ProcessSendCmdCVARGet graph,title} - | xy {ProcessSendCmdCVARGet "axis,$1,title"} - | xyaxis {ProcessSendCmdCVARGet "axis,$1,title"} + | xy {ProcessSendCmdCVARGet "graph,axis,$1,title"} + | xyaxis {ProcessSendCmdCVARGet "graph,axis,$1,title"} | LEGEND_ {ProcessSendCmdCVARGet graph,legend,title} ; diff --git a/ds9/parsers/plotsendparser.tcl b/ds9/parsers/plotsendparser.tcl index 0eff675..71daaeb 100644 --- a/ds9/parsers/plotsendparser.tcl +++ b/ds9/parsers/plotsendparser.tcl @@ -1502,13 +1502,13 @@ proc plotsend::yyparse {} { 33 { ProcessSendCmdCVARYesNo graph,ds,dash } 34 { PlotSendCmdCVARGet data,current } 35 { PlotSendCmdCVARGet data,current } - 36 { ProcessSendCmdCVARYesNo "axis,$1,grid" } - 37 { ProcessSendCmdCVARYesNo "axis,$1,log" } - 38 { ProcessSendCmdCVARYesNo "axis,$1,flip" } - 39 { ProcessSendCmdCVARYesNo "axis,$1,auto" } - 40 { ProcessSendCmdCVARGet "axis,$1,min" } - 41 { ProcessSendCmdCVARGet "axis,$1,max" } - 42 { ProcessSendCmdCVARGet "axis,$1,format" } + 36 { ProcessSendCmdCVARYesNo "graph,axis,$1,grid" } + 37 { ProcessSendCmdCVARYesNo "graph,axis,$1,log" } + 38 { ProcessSendCmdCVARYesNo "graph,axis,$1,flip" } + 39 { ProcessSendCmdCVARYesNo "graph,axis,$1,auto" } + 40 { ProcessSendCmdCVARGet "graph,axis,$1,min" } + 41 { ProcessSendCmdCVARGet "graph,axis,$1,max" } + 42 { ProcessSendCmdCVARGet "graph,axis,$1,format" } 43 { ProcessSendCmdCVARYesNo graph,legend } 44 { ProcessSendCmdCVARGet graph,legend,position } 45 { ProcessSendCmdCVARGet "$1,family" } @@ -1529,8 +1529,8 @@ proc plotsend::yyparse {} { 60 { set _ legend,font } 61 { set _ legend,title } 62 { ProcessSendCmdCVARGet graph,title } - 63 { ProcessSendCmdCVARGet "axis,$1,title" } - 64 { ProcessSendCmdCVARGet "axis,$1,title" } + 63 { ProcessSendCmdCVARGet "graph,axis,$1,title" } + 64 { ProcessSendCmdCVARGet "graph,axis,$1,title" } 65 { ProcessSendCmdCVARGet graph,legend,title } 66 { ProcessSendCmdCVARYesNo graph,ds,error } 67 { ProcessSendCmdCVARYesNo graph,ds,error,cap } -- cgit v0.12