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
|
# 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
proc ARInit {varname next} {
upvar #0 $varname var
global $varname
set var(sync) 0
set var(proc,next) $next
set var(name) {}
set var(x) {}
set var(y) {}
set var(status) {}
}
proc ARApply {varname} {
upvar #0 $varname var
global $varname
ARStatus $varname {}
$var(mb).file entryconfig [msgcat::mc {Retrieve}] -state disabled
$var(mb).file entryconfig [msgcat::mc {Cancel}] -state normal
$var(apply) configure -state disabled
$var(cancel) configure -state normal
}
proc ARCancel {varname} {
upvar #0 $varname var
global $varname
# set state to 0 so that we don't process the finish proc
set var(active) 0
if {[info exists var(token)]} {
http::reset $var(token)
}
}
proc ARDestroy {varname} {
upvar #0 $varname var
global $varname
ARCancel $varname
if {[winfo exists $var(top)]} {
destroy $var(top)
destroy $var(mb)
}
unset $varname
}
proc ARReset {varname} {
upvar #0 $varname var
global $varname
set var(active) 0
if {[info exists var(token)]} {
http::cleanup $var(token)
unset var(token)
}
$var(mb).file entryconfig [msgcat::mc {Retrieve}] -state normal
$var(mb).file entryconfig [msgcat::mc {Cancel}] -state disabled
$var(apply) configure -state normal
$var(cancel) configure -state disabled
}
proc ARDone {varname} {
upvar #0 $varname var
global $varname
set var(status) [msgcat::mc {Done}]
ARReset $varname
}
proc ARCancelled {varname} {
upvar #0 $varname var
global $varname
set var(status) [msgcat::mc {Cancelled}]
ARReset $varname
}
proc ARError {varname message} {
upvar #0 $varname var
global $varname
set var(status) [string range $message 0 80]
ARReset $varname
}
proc ARStatus {varname message} {
upvar #0 $varname var
global $varname
set var(status) [string range $message 0 80]
}
proc ARClear {varname} {
upvar #0 $varname var
global $varname
set var(name) {}
set var(x) {}
set var(y) {}
set var(status) {}
}
proc ARCoord {varname} {
upvar #0 $varname var
global $varname
global ds9
global pds9
switch -- $var(sky) {
fk4 -
fk5 -
icrs {
$var(xname) configure -text "\u03b1" \
-font "$ds9(times) $pds9(font,size)"
$var(yname) configure -text "\u03b4" \
-font "$ds9(times) $pds9(font,size)"
}
galactic {
$var(xname) configure -text {l} \
-font "{$ds9(times)} $pds9(font,size) normal italic"
$var(yname) configure -text {b} \
-font "{$ds9(times)} $pds9(font,size) normal italic"
}
ecliptic {
$var(xname) configure -text "\u03bb" \
-font "$ds9(times) $pds9(font,size)"
$var(yname) configure -text "\u03b2" \
-font "$ds9(times) $pds9(font,size)"
}
}
}
proc AREditMenu {varname} {
upvar #0 $varname var
global $varname
global ds9
$var(mb) add cascade -label [msgcat::mc {Edit}] -menu $var(mb).edit
EditMenu $var(mb) $varname
$var(mb).edit add separator
$var(mb).edit add command -label [msgcat::mc {Clear}] \
-command "ARClear $varname"
}
proc ARSkyFormat {w varname} {
upvar #0 $varname var
global $varname
set ${varname}(skyformat,msg) [msgcat::mc $var(skyformat)]
ttk::menubutton $w -textvariable ${varname}(skyformat,msg) -menu $w.menu
menu $w.menu
$w.menu add radiobutton -label [msgcat::mc {Degrees}] \
-variable ${varname}(skyformat) -value degrees \
-command "ARSkyFormatMenu $varname"
$w.menu add radiobutton -label {Sexagesimal} \
-variable ${varname}(skyformat) -value sexagesimal \
-command "ARSkyFormatMenu $varname"
}
proc ARSkyFormatMenu {varname} {
upvar #0 $varname var
global $varname
set ${varname}(skyformat,msg) $var(skyformat)
}
proc ARRFormat {w varname} {
upvar #0 $varname var
global $varname
set ${varname}(rformat,msg) [msgcat::mc $var(rformat)]
ttk::menubutton $w -textvariable ${varname}(rformat,msg) -menu $w.menu
menu $w.menu
$w.menu add radiobutton -label [msgcat::mc {Degrees}] \
-variable ${varname}(rformat) -value degrees \
-command "ARRFormatMenu $varname"
$w.menu add radiobutton -label [msgcat::mc {ArcMin}] \
-variable ${varname}(rformat) -value arcmin \
-command "ARRFormatMenu $varname"
$w.menu add radiobutton -label [msgcat::mc {ArcSec}] \
-variable ${varname}(rformat) -value arcsec \
-command "ARRFormatMenu $varname"
}
proc ARRFormatMenu {varname} {
upvar #0 $varname var
global $varname
set ${varname}(rformat,msg) $var(rformat)
}
|