/usr/share/saods9/src/nameres.tcl is in saods9-data 7.2+dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | # Copyright (C) 1999-2012
# Smithsonian Astrophysical Observatory, Cambridge, MA, USA
# For conditions of distribution and use, see copyright notice in "copyright"
package provide DS9 1.0
proc NRESDef {} {
global nres
global inres
global pnres
set inres(top) .nres
set inres(mb) .nresmb
# set via wcs()
set nres(system) wcs
set nres(sky) fk5
set nres(skyformat) degrees
# prefs only
set pnres(server) simbad-cds
}
proc NRESApply {varname sync} {
upvar #0 $varname var
global $varname
set var(sync) $sync
ARApply $varname
if {$var(name)!={}} {
NSVRServer $varname
} else {
ARStatus $varname "Please specify an Object Name"
ARReset $varname
}
}
proc NRESDialog {} {
global nres
global inres
global ds9
global pds9
if [winfo exists $inres(top)] {
raise $inres(top)
return
}
set varname dnres
upvar #0 $varname var
global $varname
# AR variables
ARInit $varname {}
# Variables
set var(top) $inres(top)
set var(mb) $inres(mb)
set var(system) $nres(system)
set var(sky) $nres(sky)
set var(skyformat) $nres(skyformat)
# create the window
set w $var(top)
set mb $var(mb)
Toplevel $w $mb 6 [msgcat::mc {Name Resolution}] "ARDestroy $varname"
# file
$mb add cascade -label File -menu $mb.file
menu $mb.file
$mb.file add command -label [msgcat::mc {Retrieve}] \
-command "NRESApply $varname 0"
$mb.file add command -label [msgcat::mc {Cancel}] \
-command "ARCancel $varname"
$mb.file add separator
$mb.file add command -label [msgcat::mc {Pan To}] \
-command "NRESPan $varname"
$mb.file add command -label [msgcat::mc {Crosshair To}] \
-command "NRESCrosshair $varname"
$mb.file add separator
$mb.file add command -label [msgcat::mc {Close}] \
-command "ARDestroy $varname"
# edit
AREditMenu $varname
# name server
NSVRServerMenu $varname
# Param
set f [ttk::frame $w.param]
ttk::label $f.nametitle -text [msgcat::mc {Object}]
ttk::entry $f.name -textvariable ${varname}(name) -width 48
ttk::label $f.sky -textvariable ${varname}(sky) -anchor w
set var(xname) [ttk::label $f.xtitle -text {} -width 1]
ttk::label $f.x -textvariable ${varname}(x) -width 14 -relief groove
set var(yname) [ttk::label $f.ytitle -text {} -width 1]
ttk::label $f.y -textvariable ${varname}(y) -width 14 -relief groove
ARSkyFormat $f.skyformat $varname
grid $f.nametitle x $f.name - - - - -padx 2 -pady 2 -sticky w
grid $f.sky $f.xtitle $f.x $f.ytitle $f.y $f.skyformat \
-padx 2 -pady 2 -sticky w
# Status
set f [ttk::frame $w.status]
ttk::label $f.tstatus -text [msgcat::mc {Status}]
ttk::label $f.status -textvariable ${varname}(status)
grid $f.tstatus $f.status -padx 2 -pady 2 -sticky w
# Buttons
set f [ttk::frame $w.buttons]
set var(apply) [ttk::button $f.apply -text [msgcat::mc {Retrieve}] \
-command "NRESApply $varname 0"]
set var(cancel) [ttk::button $f.cancel -text [msgcat::mc {Cancel}] \
-command "ARCancel $varname" -state disabled]
ttk::button $f.close -text [msgcat::mc {Close}] \
-command "ARDestroy $varname"
pack $f.apply $f.cancel $f.close -side left -expand true -padx 2 -pady 4
# Fini
ttk::separator $w.sep -orient horizontal
ttk::separator $w.sep2 -orient horizontal
pack $w.buttons $w.sep $w.status $w.sep2 -side bottom -fill x
pack $w.param -side top -fill both -expand true
ARCoord $varname
ARStatus $varname {}
}
proc NRESPan {varname} {
upvar #0 $varname var
global $varname
if {($var(x) != {}) && ($var(y) != {})} {
PanTo $var(x) $var(y) $var(system) $var(sky)
}
}
proc NRESCrosshair {varname} {
upvar #0 $varname var
global $varname
global current
if {($current(frame) != {})} {
if {[$current(frame) has wcs equatorial $var(system)]} {
if {($var(x) != {}) && ($var(y) != {})} {
set current(mode) crosshair
ChangeMode
$current(frame) crosshair \
$var(system) $var(sky) $var(x) $var(y)
}
}
}
}
# Prefs
proc PrefsDialogNRES {} {
global dprefs
set w $dprefs(tab)
$dprefs(list) insert end [msgcat::mc {Name Server}]
lappend dprefs(tabs) [ttk::frame $w.namesvr]
set f [ttk::labelframe $w.namesvr.params -text [msgcat::mc {Name Server}]]
ttk::label $f.tsvr -text [msgcat::mc {Default}]
ttk::menubutton $f.svr -textvariable pnres(server) -menu $f.svr.menu
menu $f.svr.menu
NSVRServerMenuItems $f.svr.menu
grid $f.tsvr $f.svr -padx 2 -pady 2 -sticky w
pack $f -side top -fill both -expand true
}
# Process Cmds
proc ProcessNRESCmd {varname iname} {
upvar $varname var
upvar $iname i
set vvarname dnres
upvar #0 $vvarname vvar
global $vvarname
global nres
global pnres
NRESDialog
switch -- [string tolower [lindex $var $i]] {
{} -
open {}
close {ARDestroy $vvarname}
server {
incr i
set pnres(server) [lindex $var $i]
}
pan {NRESPan $vvarname}
crosshair {NRESCrosshair $vvarname}
format -
skyformat {
incr i
switch -- [string tolower [lindex $var $i]] {
deg -
degree -
degrees {
set vvar(skyformat) degrees
set vvar(skyformat,msg) $vvar(skyformat)
}
default {
set vvar(skyformat) [string tolower [lindex $var $i]]
set vvar(skyformat,msg) $vvar(skyformat)
}
}
}
name {
incr i
set vvar(name) [lindex $var $i]
NRESApply $vvarname 1
}
default {
set vvar(name) [lindex $var $i]
NRESApply $vvarname 1
}
}
}
proc ProcessSendNRESCmd {proc id param} {
global nres
global pnres
global dnres
NRESDialog
switch -- [string tolower [lindex $param 0]] {
server {$proc $id "$pnres(server)\n"}
format -
skyformat {$proc $id "$dnres(skyformat)\n"}
name -
{} {$proc $id "$dnres(name)\n"}
default {
set dnres(name) [lindex $param 0]
NRESApply dnres 1
$proc $id "$dnres(x) $dnres(y)\n"
}
}
}
|