summaryrefslogtreecommitdiffstats
path: root/ds9/library
diff options
context:
space:
mode:
Diffstat (limited to 'ds9/library')
-rw-r--r--ds9/library/plot.tcl160
-rw-r--r--ds9/library/plotbar.tcl4
-rw-r--r--ds9/library/plotconfig.tcl4
-rw-r--r--ds9/library/plotdata.tcl11
-rw-r--r--ds9/library/plotdialog.tcl4
-rw-r--r--ds9/library/plotline.tcl4
-rw-r--r--ds9/library/plotscatter.tcl4
-rw-r--r--ds9/library/plotstate.tcl174
8 files changed, 200 insertions, 165 deletions
diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl
index 8c512c9..d372189 100644
--- a/ds9/library/plot.tcl
+++ b/ds9/library/plot.tcl
@@ -16,78 +16,7 @@ proc PlotDef {} {
set iap(tiff,compress) none
set iap(error) [msgcat::mc {An error has occurred while creating the image. Please be sure that the plot window is in the upper left corner of the default screen and the entire window is visible.}]
- # per Canvas
- set pap(graph,bg) white
- set pap(graph,title,family) helvetica
- set pap(graph,title,size) 12
- set pap(graph,title,weight) normal
- set pap(graph,title,slant) roman
-
- set pap(legend,title,family) helvetica
- set pap(legend,title,size) 10
- set pap(legend,title,weight) normal
- set pap(legend,title,slant) roman
- set pap(legend,font,family) helvetica
- set pap(legend,font,size) 9
- set pap(legend,font,weight) normal
- set pap(legend,font,slant) roman
-
- set pap(axis,title,family) helvetica
- set pap(axis,title,size) 9
- set pap(axis,title,weight) normal
- set pap(axis,title,slant) roman
-
- set pap(axis,font,family) helvetica
- set pap(axis,font,size) 9
- set pap(axis,font,weight) normal
- set pap(axis,font,slant) roman
-
- # per Graph
- set pap(graph,title) {}
-
- set pap(legend) 0
- set pap(legend,title) Legend
- set pap(legend,position) right
-
- 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) {}
-
- set pap(bar,mode) normal
-
- # per DataSet
- set pap(show) 1
- set pap(smooth) linear
- set pap(color) black
- set pap(fill) 0
- set pap(fill,color) black
- set pap(width) 1
- set pap(dash) 0
-
- set pap(shape,symbol) none
- set pap(shape,fill) 1
- set pap(shape,color) red
-
- set pap(error) 1
- set pap(error,cap) 0
- set pap(error,color) red
- set pap(error,width) 1
-
- set pap(bar,relief) raised
+ PlotDefState
}
# Canvas
@@ -115,6 +44,8 @@ proc PlotAddGraph {varname} {
global ds9
global pap
+ PlotSaveState $varname
+
incr ${varname}(graph,total)
incr ${varname}(graph,current)
@@ -132,28 +63,7 @@ proc PlotAddGraph {varname} {
array set $varname [array get pap]
- # per Canvas
- # per Graph
- set var(graph$cc,bar,mode) $pap(bar,mode)
-
- # per DataSet
- set var(graph$cc,show) $pap(show)
- set var(graph$cc,shape,symbol) $pap(shape,symbol)
- set var(graph$cc,shape,fill) $pap(shape,fill)
- set var(graph$cc,shape,color) $pap(shape,color)
- set var(graph$cc,smooth) $pap(smooth)
- set var(graph$cc,color) $pap(color)
- set var(graph$cc,fill) $pap(fill)
- set var(graph$cc,fill,color) $pap(fill,color)
- set var(graph$cc,width) $pap(width)
- set var(graph$cc,dash) $pap(dash)
-
- set var(graph$cc,error) $pap(error)
- set var(graph$cc,error,cap) $pap(error,cap)
- 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)
+ PlotInitState $varname
$var(proc,addgraph) $varname
@@ -333,7 +243,7 @@ proc PlotCurrentData {varname} {
set var(graph$cc,xedata) $var(graph$cc,$nn,xedata)
set var(graph$cc,yedata) $var(graph$cc,$nn,yedata)
- PlotSetVar $varname $nn
+ PlotRestoreState $varname $nn
}
PlotStats $varname
@@ -450,7 +360,7 @@ proc PlotExternal {varname} {
set var(graph$cc,$nn,xedata) $var(graph$cc,xedata)
set var(graph$cc,$nn,yedata) $var(graph$cc,yedata)
- PlotGetVar $varname $nn
+ PlotSaveState $varname
# update data set menu
$var(mb).graph.select add radiobutton \
@@ -754,64 +664,6 @@ proc PlotColorMenu {w varname color cmd} {
-command [list ColorMenuOther $varname $color $cmd]
}
-proc PlotSetVar {varname nn} {
- upvar #0 $varname var
- global $varname
-
- set tt $var(graph,total)
- set cc $var(graph,current)
-
- # per DataSet
- set var(graph$cc,name) $var(graph$cc,$nn,name)
- set var(graph$cc,show) $var(graph$cc,$nn,show)
- set var(graph$cc,smooth) $var(graph$cc,$nn,smooth)
- set var(graph$cc,color) $var(graph$cc,$nn,color)
- set var(graph$cc,fill) $var(graph$cc,$nn,fill)
- set var(graph$cc,fill,color) $var(graph$cc,$nn,fill,color)
- set var(graph$cc,width) $var(graph$cc,$nn,width)
- set var(graph$cc,dash) $var(graph$cc,$nn,dash)
-
- set var(graph$cc,shape,symbol) $var(graph$cc,$nn,shape,symbol)
- set var(graph$cc,shape,fill) $var(graph$cc,$nn,shape,fill)
- set var(graph$cc,shape,color) $var(graph$cc,$nn,shape,color)
-
- set var(graph$cc,error) $var(graph$cc,$nn,error)
- set var(graph$cc,error,cap) $var(graph$cc,$nn,error,cap)
- 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(graph$cc,bar,relief) $var(graph$cc,$nn,bar,relief)
-}
-
-proc PlotGetVar {varname nn} {
- upvar #0 $varname var
- global $varname
-
- set tt $var(graph,total)
- set cc $var(graph,current)
-
- # per DataSet
- set var(graph$cc,$nn,name) $var(graph$cc,name)
- set var(graph$cc,$nn,show) $var(graph$cc,show)
- set var(graph$cc,$nn,smooth) $var(graph$cc,smooth)
- set var(graph$cc,$nn,color) $var(graph$cc,color)
- set var(graph$cc,$nn,fill) $var(graph$cc,fill)
- set var(graph$cc,$nn,fill,color) $var(graph$cc,fill,color)
- set var(graph$cc,$nn,width) $var(graph$cc,width)
- set var(graph$cc,$nn,dash) $var(graph$cc,dash)
-
- set var(graph$cc,$nn,shape,symbol) $var(graph$cc,shape,symbol)
- set var(graph$cc,$nn,shape,fill) $var(graph$cc,shape,fill)
- set var(graph$cc,$nn,shape,color) $var(graph$cc,shape,color)
-
- set var(graph$cc,$nn,error) $var(graph$cc,error)
- set var(graph$cc,$nn,error,cap) $var(graph$cc,error,cap)
- 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(graph$cc,$nn,bar,relief) $var(graph$cc,bar,relief)
-}
-
proc PlotBackup {ch dir} {
global iap
diff --git a/ds9/library/plotbar.tcl b/ds9/library/plotbar.tcl
index d9d12ae..e9a3795 100644
--- a/ds9/library/plotbar.tcl
+++ b/ds9/library/plotbar.tcl
@@ -173,8 +173,7 @@ proc PlotBarUpdateElement {varname} {
return
}
- set nn $var(graph$cc,data,current)
- PlotGetVar $varname $nn
+ PlotSaveState $varname
if {$var(graph$cc,error)} {
set show both
@@ -188,6 +187,7 @@ proc PlotBarUpdateElement {varname} {
set cap 0
}
+ set nn $var(graph$cc,data,current)
$var(graph$cc) element configure "d-${nn}" \
-label $var(graph$cc,name) -hide [expr !$var(graph$cc,show)] \
-relief $var(graph$cc,bar,relief) -color $var(graph$cc,color) \
diff --git a/ds9/library/plotconfig.tcl b/ds9/library/plotconfig.tcl
index 085faaa..0a94498 100644
--- a/ds9/library/plotconfig.tcl
+++ b/ds9/library/plotconfig.tcl
@@ -16,7 +16,6 @@ proc PlotLoadConfigFile {varname filename} {
upvar #0 $varname var
global $varname
- set tt $var(graph,total)
set cc $var(graph,current)
if {$filename == {}} {
@@ -74,6 +73,7 @@ proc PlotLoadConfigFile {varname filename} {
set var(axis,font,weight) $analysisplot(axis,font,weight)
set var(axis,font,slant) $analysisplot(axis,font,slant)
+# set var(graph$cc,name) {}
set var(graph$cc,show) $analysisplot(show)
set var(graph$cc,smooth) $analysisplot(smooth)
set var(graph$cc,color) $analysisplot(color)
@@ -204,7 +204,6 @@ proc PlotSaveConfigFile {varname filename} {
upvar #0 $varname var
global $varname
- set tt $var(graph,total)
set cc $var(graph,current)
if {$filename == {}} {
@@ -261,6 +260,7 @@ proc PlotSaveConfigFile {varname filename} {
set analysisplot(axis,font,weight) $var(axis,font,weight)
set analysisplot(axis,font,slant) $var(axis,font,slant)
+# set analysisplot(name) {}
set analysisplot(show) $var(graph$cc,show)
set analysisplot(smooth) $var(graph$cc,smooth)
set analysisplot(color) $var(graph$cc,color)
diff --git a/ds9/library/plotdata.tcl b/ds9/library/plotdata.tcl
index 025447e..179ff8e 100644
--- a/ds9/library/plotdata.tcl
+++ b/ds9/library/plotdata.tcl
@@ -141,6 +141,9 @@ proc PlotDataSetOne {varname dim data} {
upvar #0 $varname var
global $varname
+ # save current state
+ PlotSaveState $varname
+
set tt $var(graph,total)
set cc $var(graph,current)
@@ -157,6 +160,9 @@ proc PlotDataSetOne {varname dim data} {
set nn $var(graph$cc,data,total)
set var(graph$cc,data,current) $nn
+ # init new state
+ PlotInitState $varname
+
# new vector names
set xdata ap${varname}xx${nn}
set ydata ap${varname}yy${nn}
@@ -328,7 +334,7 @@ proc PlotDataSetOne {varname dim data} {
set var(graph$cc,$nn,xedata) $var(graph$cc,xedata)
set var(graph$cc,$nn,yedata) $var(graph$cc,yedata)
- PlotGetVar $varname $nn
+ PlotSaveState $varname
# update data set menu
$var(mb).graph.select add radiobutton -label "$var(graph$cc,name)" \
@@ -417,7 +423,7 @@ proc PlotDupData {varname mm} {
set var(graph$cc,xedata) $var(graph$cc,$nn,xedata)
set var(graph$cc,yedata) $var(graph$cc,$nn,yedata)
- PlotSetVar $varname $nn
+ PlotRestoreState $varname $nn
PlotAddData $varname
$var(proc,updateelement) $varname
@@ -425,4 +431,3 @@ proc PlotDupData {varname mm} {
PlotStats $varname
PlotList $varname
}
-
diff --git a/ds9/library/plotdialog.tcl b/ds9/library/plotdialog.tcl
index c4383e6..38ce1b1 100644
--- a/ds9/library/plotdialog.tcl
+++ b/ds9/library/plotdialog.tcl
@@ -29,6 +29,10 @@ proc PlotDialog {varname wtt title xaxis yaxis} {
set var(graph,total) 0
set var(graph,current) 0
+ set var(graph0,data,total) 0
+ set var(graph0,data,current) 0
+
+ PlotInitState $varname
PlotTitle $varname $title $xaxis $yaxis
diff --git a/ds9/library/plotline.tcl b/ds9/library/plotline.tcl
index 5f21f07..3c2a003 100644
--- a/ds9/library/plotline.tcl
+++ b/ds9/library/plotline.tcl
@@ -170,8 +170,7 @@ proc PlotLineUpdateElement {varname} {
return
}
- set nn $var(graph$cc,data,current)
- PlotGetVar $varname $nn
+ PlotSaveState $varname
if {$var(graph$cc,fill)} {
set fillClr $var(graph$cc,fill,color)
@@ -203,6 +202,7 @@ proc PlotLineUpdateElement {varname} {
set cap 0
}
+ set nn $var(graph$cc,data,current)
$var(graph$cc) element configure "d-${nn}" \
-label $var(graph$cc,name) -hide [expr !$var(graph$cc,show)] \
-symbol $var(graph$cc,shape,symbol) -fill $clr -scalesymbols no \
diff --git a/ds9/library/plotscatter.tcl b/ds9/library/plotscatter.tcl
index 342a04e..4bd19f4 100644
--- a/ds9/library/plotscatter.tcl
+++ b/ds9/library/plotscatter.tcl
@@ -100,8 +100,7 @@ proc PlotScatterUpdateElement {varname} {
return
}
- set nn $var(graph$cc,data,current)
- PlotGetVar $varname $nn
+ PlotSaveState $varname
if {$var(graph$cc,shape,symbol) == "none"} {
set var(graph$cc,shape,symbol) circle
@@ -125,6 +124,7 @@ proc PlotScatterUpdateElement {varname} {
set cap 0
}
+ set nn $var(graph$cc,data,current)
$var(graph$cc) element configure "d-${nn}" \
-label $var(graph$cc,name) -hide [expr !$var(graph$cc,show)] \
-symbol $var(graph$cc,shape,symbol) -fill $clr -scalesymbols no \
diff --git a/ds9/library/plotstate.tcl b/ds9/library/plotstate.tcl
new file mode 100644
index 0000000..7c41bbd
--- /dev/null
+++ b/ds9/library/plotstate.tcl
@@ -0,0 +1,174 @@
+# Copyright (C) 1999-2018
+# Smithsonian Astrophysical Observatory, Cambridge, MA, USA
+# For conditions of distribution and use, see copyright notice in "copyright"
+
+package provide DS9 1.0
+
+# Plot State
+proc PlotDefState {} {
+ global pap
+
+ # per Canvas
+ set pap(graph,bg) white
+ set pap(graph,title,family) helvetica
+ set pap(graph,title,size) 12
+ set pap(graph,title,weight) normal
+ set pap(graph,title,slant) roman
+
+ set pap(legend,title,family) helvetica
+ set pap(legend,title,size) 10
+ set pap(legend,title,weight) normal
+ set pap(legend,title,slant) roman
+ set pap(legend,font,family) helvetica
+ set pap(legend,font,size) 9
+ set pap(legend,font,weight) normal
+ set pap(legend,font,slant) roman
+
+ set pap(axis,title,family) helvetica
+ set pap(axis,title,size) 9
+ set pap(axis,title,weight) normal
+ set pap(axis,title,slant) roman
+
+ set pap(axis,font,family) helvetica
+ set pap(axis,font,size) 9
+ set pap(axis,font,weight) normal
+ set pap(axis,font,slant) roman
+
+ # per Graph
+ set pap(graph,title) {}
+
+ set pap(legend) 0
+ set pap(legend,title) Legend
+ set pap(legend,position) right
+
+ 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) {}
+
+ set pap(bar,mode) normal
+
+ # per DataSet
+ set pap(name) {}
+ set pap(show) 1
+ set pap(smooth) linear
+ set pap(color) black
+ set pap(fill) 0
+ set pap(fill,color) black
+ set pap(width) 1
+ set pap(dash) 0
+
+ set pap(shape,symbol) none
+ set pap(shape,fill) 1
+ set pap(shape,color) red
+
+ set pap(error) 1
+ set pap(error,cap) 0
+ set pap(error,color) red
+ set pap(error,width) 1
+
+ set pap(bar,relief) raised
+}
+
+proc PlotInitState {varname} {
+ upvar #0 $varname var
+ global $varname
+
+ global pap
+
+ set cc $var(graph,current)
+
+ # per Graph
+ set var(graph$cc,bar,mode) $pap(bar,mode)
+
+ # per DataSet
+ set var(graph$cc,name) $pap(name)
+ set var(graph$cc,show) $pap(show)
+ set var(graph$cc,shape,symbol) $pap(shape,symbol)
+ set var(graph$cc,shape,fill) $pap(shape,fill)
+ set var(graph$cc,shape,color) $pap(shape,color)
+ set var(graph$cc,smooth) $pap(smooth)
+ set var(graph$cc,color) $pap(color)
+ set var(graph$cc,fill) $pap(fill)
+ set var(graph$cc,fill,color) $pap(fill,color)
+ set var(graph$cc,width) $pap(width)
+ set var(graph$cc,dash) $pap(dash)
+
+ set var(graph$cc,error) $pap(error)
+ set var(graph$cc,error,cap) $pap(error,cap)
+ 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)
+}
+
+proc PlotSaveState {varname} {
+ upvar #0 $varname var
+ global $varname
+
+ set cc $var(graph,current)
+ set nn $var(graph$cc,data,current)
+
+ # per DataSet
+ set var(graph$cc,$nn,name) $var(graph$cc,name)
+ set var(graph$cc,$nn,show) $var(graph$cc,show)
+ set var(graph$cc,$nn,smooth) $var(graph$cc,smooth)
+ set var(graph$cc,$nn,color) $var(graph$cc,color)
+ set var(graph$cc,$nn,fill) $var(graph$cc,fill)
+ set var(graph$cc,$nn,fill,color) $var(graph$cc,fill,color)
+ set var(graph$cc,$nn,width) $var(graph$cc,width)
+ set var(graph$cc,$nn,dash) $var(graph$cc,dash)
+
+ set var(graph$cc,$nn,shape,symbol) $var(graph$cc,shape,symbol)
+ set var(graph$cc,$nn,shape,fill) $var(graph$cc,shape,fill)
+ set var(graph$cc,$nn,shape,color) $var(graph$cc,shape,color)
+
+ set var(graph$cc,$nn,error) $var(graph$cc,error)
+ set var(graph$cc,$nn,error,cap) $var(graph$cc,error,cap)
+ 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(graph$cc,$nn,bar,relief) $var(graph$cc,bar,relief)
+}
+
+proc PlotRestoreState {varname nn} {
+ upvar #0 $varname var
+ global $varname
+
+ set cc $var(graph,current)
+ set nn $var(graph$cc,data,current)
+
+ # per DataSet
+ set var(graph$cc,name) $var(graph$cc,$nn,name)
+ set var(graph$cc,show) $var(graph$cc,$nn,show)
+ set var(graph$cc,smooth) $var(graph$cc,$nn,smooth)
+ set var(graph$cc,color) $var(graph$cc,$nn,color)
+ set var(graph$cc,fill) $var(graph$cc,$nn,fill)
+ set var(graph$cc,fill,color) $var(graph$cc,$nn,fill,color)
+ set var(graph$cc,width) $var(graph$cc,$nn,width)
+ set var(graph$cc,dash) $var(graph$cc,$nn,dash)
+
+ set var(graph$cc,shape,symbol) $var(graph$cc,$nn,shape,symbol)
+ set var(graph$cc,shape,fill) $var(graph$cc,$nn,shape,fill)
+ set var(graph$cc,shape,color) $var(graph$cc,$nn,shape,color)
+
+ set var(graph$cc,error) $var(graph$cc,$nn,error)
+ set var(graph$cc,error,cap) $var(graph$cc,$nn,error,cap)
+ 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(graph$cc,bar,relief) $var(graph$cc,$nn,bar,relief)
+}