From 4679ebe1a2df783577e73958c4f420a23fbfbaf3 Mon Sep 17 00:00:00 2001 From: William Joye Date: Tue, 28 May 2019 12:09:38 -0400 Subject: add multiple plot support --- ds9/library/plot.tcl | 215 ++--------------------------------------- ds9/parsers/plotsendparser.tac | 4 +- ds9/parsers/plotsendparser.tcl | 4 +- 3 files changed, 10 insertions(+), 213 deletions(-) diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl index bac0ba8..9c261e1 100644 --- a/ds9/library/plot.tcl +++ b/ds9/library/plot.tcl @@ -141,6 +141,9 @@ proc PlotAddGraph {varname} { set var(graph$cc,error,color) $pap(error,color) set var(graph$cc,error,width) $pap(error,width) + set var(graph$cc,bar,relief) $pap(bar,relief) + set var(graph$cc,bar,mode) $pap(bar,mode) + $var(proc,addgraph) $varname # set up zoom stack, assuming mode is zoom @@ -652,7 +655,7 @@ proc PlotDupData {varname mm} { 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($nn,bar,relief) $var($mm,bar,relief) + set var(graph$cc,$nn,bar,relief) $var(graph$cc,$mm,bar,relief) # update data set menu $var(mb).graph.select add radiobutton -label "$var(graph$cc,$nn,name)" \ @@ -838,120 +841,6 @@ proc PlotListDestroyCB {varname} { set var(list) 0 } -proc PlotLoadConfig {varname} { - upvar #0 $varname var - global $varname - - PlotLoadConfigFile $varname [OpenFileDialog apconfigfbox] -} - -# used by backup -proc PlotLoadConfigFile {varname filename} { - upvar #0 $varname var - global $varname - - if {$filename != {}} { - source $filename - array set $varname [array get analysisplot] - 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) - FixVar ${varname}(graph,title,slant) ${varname}(titleSlant) - - FixVar ${varname}(axis,title,family) ${varname}(textlabFont) - FixVar ${varname}(axis,title,size) ${varname}(textlabSize) - FixVar ${varname}(axis,title,weight) ${varname}(textlabWeight) - FixVar ${varname}(axis,title,slant) ${varname}(textlabSlant) - - FixVar ${varname}(axis,font,family) ${varname}(numlabFont) - FixVar ${varname}(axis,font,size) ${varname}(numlabSize) - FixVar ${varname}(axis,font,weight) ${varname}(numlabWeight) - FixVar ${varname}(axis,font,slant) ${varname}(numlabSlant) - - FixVar ${varname}(show) ${varname}(linear) - FixVar ${varname}(shape,color) ${varname}(discrete,color) - FixVar ${varname}(shape,fill) ${varname}(discrete,fill) - FixVar ${varname}(width) ${varname}(linear,width) - FixVar ${varname}(color) ${varname}(linear,color) - if {[info exists ${varname}(linear,dash)]} { - set var(linear,dash) [FromYesNo $var(linear,dash)] - } - FixVar ${varname}(dash) ${varname}(linear,dash) - - if {[info exists ${varname}(discrete)]} { - if {$var(discrete)} { - FixVar ${varname}(shape,symbol) ${varname}(discrete,symbol) - } else { - FixVarRm ${varname}(discrete,symbol) - } - } - - FixVarRm ${varname}(bar) - FixVarRm ${varname}(bar,color) - - FixVarRm ${varname}(discrete) - - FixVarRm ${varname}(quadratic) - FixVarRm ${varname}(quadratic,width) - FixVarRm ${varname}(quadratic,color) - FixVarRm ${varname}(quadratic,dash) - - FixVarRm ${varname}(step) - FixVarRm ${varname}(step,color) - FixVarRm ${varname}(step,dash) - FixVarRm ${varname}(step,width) - - if {[info exists var(grid)]} { - set var(axis,x,grid) $var(grid) - set var(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) - unset var(format) - unset var(format,x) - unset var(format,y) - } - - if {[info exists var(grid,log)]} { - switch $var(grid,log) { - linearlinear { - set var(axis,x,log) 0 - set var(axis,y,log) 0 - } - linearlog { - set var(axis,x,log) 0 - set var(axis,y,log) 1 - } - loglinear { - set var(axis,x,log) 1 - set var(axis,y,log) 0 - } - loglog { - set var(axis,x,log) 1 - set var(axis,y,log) 1 - } - } - unset var(grid,log) - } - - $var(proc,updategraph) $varname - $var(proc,updateelement) $varname - } -} - proc PlotLoadData {varname} { upvar #0 $varname var global $varname @@ -1019,98 +908,6 @@ proc PlotRaise {varname} { return 0 } -proc PlotSaveConfig {varname} { - upvar #0 $varname var - global $varname - - PlotSaveConfigFile $varname [SaveFileDialog apconfigfbox] -} - -proc PlotSaveConfigFile {varname filename} { - upvar #0 $varname var - global $varname - - set tt $var(graph,total) - set cc $var(graph,current) - - if {$filename == {}} { - return - } - - set ch [open $filename w] - - set analysisplot(graph,bg) $var(graph,bg) - - 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) - set analysisplot(graph,title,slant) $var(graph,title,slant) - - set analysisplot(legend) $var(legend) - set analysisplot(legend,title) $var(legend,title) - set analysisplot(legend,position) $var(legend,position) - set analysisplot(legend,title,family) $var(legend,title,family) - set analysisplot(legend,title,size) $var(legend,title,size) - set analysisplot(legend,title,weight) $var(legend,title,weight) - set analysisplot(legend,title,slant) $var(legend,title,slant) - set analysisplot(legend,font,family) $var(legend,font,family) - set analysisplot(legend,font,size) $var(legend,font,size) - 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) - set analysisplot(axis,title,slant) $var(axis,title,slant) - - set analysisplot(axis,font,family) $var(axis,font,family) - set analysisplot(axis,font,size) $var(axis,font,size) - set analysisplot(axis,font,weight) $var(axis,font,weight) - set analysisplot(axis,font,slant) $var(axis,font,slant) - - set analysisplot(show) $var(graph$cc,show) - set analysisplot(smooth) $var(graph$cc,smooth) - set analysisplot(color) $var(graph$cc,color) - set analysisplot(fill) $var(graph$cc,fill) - set analysisplot(fill,color) $var(graph$cc,fill,color) - set analysisplot(width) $var(graph$cc,width) - set analysisplot(dash) $var(graph$cc,dash) - - set analysisplot(shape,symbol) $var(graph$cc,shape,symbol) - set analysisplot(shape,fill) $var(graph$cc,shape,fill) - set analysisplot(shape,color) $var(graph$cc,shape,color) - - set analysisplot(error) $var(graph$cc,error) - set analysisplot(error,cap) $var(graph$cc,error,cap) - set analysisplot(error,color) $var(graph$cc,error,color) - set analysisplot(error,width) $var(graph$cc,error,width) - - set analysisplot(bar,relief) $var(bar,relief) - set analysisplot(bar,mode) $var(bar,mode) - - puts $ch "array set analysisplot \{ [array get analysisplot] \}" - close $ch -} - proc PlotSaveData {varname} { upvar #0 $varname var global $varname @@ -1393,7 +1190,7 @@ proc PlotSetVar {varname nn} { set var(graph$cc,error,color) $var(graph$cc,$nn,error,color) set var(graph$cc,error,width) $var(graph$cc,$nn,error,width) - set var(bar,relief) $var($nn,bar,relief) + set var(graph$cc,bar,relief) $var(graph$cc,$nn,bar,relief) } proc PlotGetVar {varname nn} { @@ -1421,7 +1218,7 @@ proc PlotGetVar {varname nn} { set var(graph$cc,$nn,error,color) $var(graph$cc,error,color) set var(graph$cc,$nn,error,width) $var(graph$cc,error,width) - set var($nn,bar,relief) $var(bar,relief) + set var(graph$cc,$nn,bar,relief) $var(graph$cc,bar,relief) } proc PlotBackup {ch dir} { diff --git a/ds9/parsers/plotsendparser.tac b/ds9/parsers/plotsendparser.tac index 551a8be..379fe28 100644 --- a/ds9/parsers/plotsendparser.tac +++ b/ds9/parsers/plotsendparser.tac @@ -80,7 +80,7 @@ plotCmd : STATS_ {ProcessSendCmdCVAR PlotStatsGenerate} | LEGEND_ legend | FONT_ fontt | TITLE_ title - | BARMODE_ {ProcessSendCmdCVARGet bar,mode} + | BARMODE_ {PlotSendCmdCVARGet bar,mode} | SHOW_ {PlotSendCmdCVARYesNo show} | COLOR_ {PlotSendCmdCVARGet color} | FILL_ {PlotSendCmdCVARGet fill} @@ -90,7 +90,7 @@ plotCmd : STATS_ {ProcessSendCmdCVAR PlotStatsGenerate} | ERRORBAR_ errorr | NAME_ {PlotSendCmdCVARGet name} | SHAPE_ shape - | RELIEF_ {ProcessSendCmdCVARGet bar,relief} + | RELIEF_ {PlotSendCmdCVARGet bar,relief} | SMOOTH_ {PlotSendCmdCVARGet smooth} | WIDTH_ {PlotSendCmdCVARGet width} | DASH_ {PlotSendCmdCVARYesNo dash} diff --git a/ds9/parsers/plotsendparser.tcl b/ds9/parsers/plotsendparser.tcl index d20d8c6..ce58ec1 100644 --- a/ds9/parsers/plotsendparser.tcl +++ b/ds9/parsers/plotsendparser.tcl @@ -1490,13 +1490,13 @@ proc plotsend::yyparse {} { 14 { ProcessSendCmdCVAR PlotListGenerate } 15 { ProcessSendCmdCVARGet mode } 17 { ProcessSendCmdCVARGet graph,bg } - 21 { ProcessSendCmdCVARGet bar,mode } + 21 { PlotSendCmdCVARGet bar,mode } 22 { PlotSendCmdCVARYesNo show } 23 { PlotSendCmdCVARGet color } 24 { PlotSendCmdCVARGet fill } 25 { PlotSendCmdCVARGet fill,color } 28 { PlotSendCmdCVARGet name } - 30 { ProcessSendCmdCVARGet bar,relief } + 30 { PlotSendCmdCVARGet bar,relief } 31 { PlotSendCmdCVARGet smooth } 32 { PlotSendCmdCVARGet width } 33 { PlotSendCmdCVARYesNo dash } -- cgit v0.12