summaryrefslogtreecommitdiffstats
path: root/ds9/library/plotstate.tcl
blob: 58e74046fe10a35c67595e7abf6b911dc5b3d31b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
#  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(layout) grid
    set pap(layout,strip,weight) 50
    set pap(layout,axis,x,title) {}
    set pap(layout,axis,x,min) 0
    set pap(layout,axis,x,max) 0
    set pap(layout,axis,x,grid) 0
    set pap(layout,axis,x,log) 0
    set pap(layout,axis,x,flip) 0

    set pap(background) white
    set pap(bar,mode) normal

    set pap(graph,format) 1
    set pap(graph,title) {}
    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) 0
    set pap(legend,position) right
    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,legend,title) Legend

    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,show) 1
    set pap(graph,ds,smooth) linear
    set pap(graph,ds,color) black
    set pap(graph,ds,fill) 0
    set pap(graph,ds,fill,color) black
    set pap(graph,ds,width) 1
    set pap(graph,ds,dash) 0

    set pap(graph,ds,shape,symbol) none
    set pap(graph,ds,shape,fill) 1
    set pap(graph,ds,shape,color) red

    set pap(graph,ds,error) 1
    set pap(graph,ds,error,cap) 0
    set pap(graph,ds,error,color) red
    set pap(graph,ds,error,width) 1

    set pap(graph,ds,bar,relief) raised
}

proc PlotInitGraph {varname} {
    upvar #0 $varname var
    global $varname

    global pap

    # per Graph
    set cc $var(graph,current)
    set var(graph,ds,current) {}

    set var(canvas) [ttk::frame $var(top).fr$cc]
    set var(graph) $var(canvas).gr$cc

    set var(graph,type) {}
    set var(graph,proc,updateelement) {}
    set var(graph,proc,hightlite) {}
    set var(graph,proc,button) {}
    
    set var(graph,name) "Graph $var(seq)"
    set var(graph,format) $pap(graph,format)
    set var(graph,title) $pap(graph,title)

    set var(graph,seq) 0
    set var(graph,dss) {}

    set var(graph,legend,title) $pap(graph,legend,title)

    set var(graph,axis,x,manage) 1
    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) {}
    set var(graph,ds,dim) xy
    set var(graph,ds,manage) 1

    set var(graph,ds,xdata) {}
    set var(graph,ds,ydata) {}
    set var(graph,ds,xedata) {}
    set var(graph,ds,yedata) {}

    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

    # per Graph
    set cc $var(graph,current)
    set nn $var(graph,ds,current)

    set var($cc,canvas) $var(canvas)
    set var($cc,graph) $var(graph)

    set var($cc,type) $var(graph,type)
    set var($cc,proc,updateelement) $var(graph,proc,updateelement)
    set var($cc,proc,highlite) $var(graph,proc,highlite)
    set var($cc,proc,button) $var(graph,proc,button)

    set var($cc,name) $var(graph,name)
    set var($cc,format) $var(graph,format)
    set var($cc,title) $var(graph,title)

    set var($cc,seq) $var(graph,seq)
    set var($cc,dss) $var(graph,dss)

    set var($cc,legend,title) $var(graph,legend,title)

    set var($cc,axis,x,manage) $var(graph,axis,x,manage)
    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($cc,$nn,name) $var(graph,ds,name)
    set var($cc,$nn,dim) $var(graph,ds,dim)
    set var($cc,$nn,manage) $var(graph,ds,manage)

    set var($cc,$nn,xdata) $var(graph,ds,xdata)
    set var($cc,$nn,ydata) $var(graph,ds,ydata)
    set var($cc,$nn,xedata) $var(graph,ds,xedata)
    set var($cc,$nn,yedata) $var(graph,ds,yedata)

    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} {
    upvar #0 $varname var
    global $varname

    # per Graph
    set cc $var(graph,current)
    set nn $var(graph,ds,current)

    set var(canvas) $var($cc,canvas)
    set var(graph) $var($cc,graph)

    set var(graph,type) $var($cc,type)
    set var(graph,proc,updateelement) $var($cc,proc,updateelement)
    set var(graph,proc,highlite) $var($cc,proc,highlite)
    set var(graph,proc,button) $var($cc,proc,button)
    
    set var(graph,name) $var($cc,name)
    set var(graph,format) $var($cc,format)
    set var(graph,title) $var($cc,title)

    set var(graph,seq) $var($cc,seq)
    set var(graph,dss) $var($cc,dss) 

    set var(graph,legend,title) $var($cc,legend,title)

    set var(graph,axis,x,manage) $var($cc,axis,x,manage)
    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)

    set var(graph,axis,y,title) $var($cc,axis,y,title)
    set var(graph,axis,y,grid) $var($cc,axis,y,grid)
    set var(graph,axis,y,log) $var($cc,axis,y,log)
    set var(graph,axis,y,flip) $var($cc,axis,y,flip)
    set var(graph,axis,y,auto) $var($cc,axis,y,auto)
    set var(graph,axis,y,min) $var($cc,axis,y,min)
    set var(graph,axis,y,max) $var($cc,axis,y,max)
    set var(graph,axis,y,format) $var($cc,axis,y,format)

    # per DataSet
    set var(graph,ds,name) $var($cc,$nn,name)
    set var(graph,ds,dim) $var($cc,$nn,dim)
    set var(graph,ds,manage) $var($cc,$nn,manage)

    set var(graph,ds,xdata) $var($cc,$nn,xdata)
    set var(graph,ds,ydata) $var($cc,$nn,ydata)
    set var(graph,ds,xedata) $var($cc,$nn,xedata)
    set var(graph,ds,yedata) $var($cc,$nn,yedata)

    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) 
}