/usr/share/saods9/src/header.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 | # 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 DisplayHeaderMenu {} {
global current
set last {}
set prim {}
set cnt [$current(frame) get fits count]
if {$cnt > 0} {
set slb(count) 0
for {set ii 1} {$ii <= $cnt} {incr ii} {
set fn [$current(frame) get fits file name $ii]
set xten [string trim [$current(frame) get fits header $ii keyword {XTENSION}]]
if {$xten != {}} {
set b [string first {[} $fn]
set pn [string range $fn 0 [expr $b-1]]
if {$b > 0 && $pn != $prim} {
incr slb(count)
set slb($slb(count),item) $pn
set slb($slb(count),value) "-$ii"
set prim $pn
}
}
if {$fn != $last && $fn != $prim} {
incr slb(count)
set slb($slb(count),item) $fn
set slb($slb(count),value) $ii
set last $fn
}
}
if {$slb(count) == 1} {
DisplayHeader $current(frame) 1 $fn
} else {
if [SLBDialog slb {Select Header} 40] {
DisplayHeader $current(frame) $slb(value) $slb(item)
}
}
}
}
proc DisplayHeader {frame which title} {
global current
set varname "hd[string range $frame end end]-$which"
upvar #0 $varname var
global $varname
SimpleTextDialog $varname $title 80 40 insert top \
[$current(frame) get fits header $which]
# create a special text tag for keywords
$var(text) tag configure keyword -foreground blue
# color tag keywords
set stop [$var(text) index end]
for {set ii 1.0} {$ii<$stop} {set ii [expr $ii+1]} {
$var(text) tag add keyword $ii "$ii +8 chars"
}
}
proc DestroyHeader {frame} {
global st
set ttt "hd[string range $frame end end]"
foreach x [array names st] {
set f [split $x ,]
if {[lindex $f 1] == "top"} {
set varname [lindex $f 0]
upvar #0 $varname var
global $varname
set fff [split $tt :]
if {[lindex $fff 0] == $ttt} {
if {[info exists $varname] && [winfo exists ${varname}(top)]} {
SimpleTextDestroy $varname
}
}
}
}
}
proc ProcessHeaderCmd {varname iname} {
upvar $varname var
upvar $iname i
set item [string tolower [lindex $var $i]]
switch -- $item {
close -
save {incr i}
}
if {[lindex $var $i] != {} && [string is integer [lindex $var $i]]} {
set jj [lindex $var $i]
incr i
} else {
set jj 1
}
global current
if {$current(frame) != {}} {
switch -- $item {
close {
set vvarname "hd[string range $current(frame) end end]-$jj"
upvar #0 $vvarname vvar
global $vvarname
if {[info exists vvar(top)]} {
SimpleTextDestroy $vvarname
}
incr i -1
}
save {
set fn [lindex $var $i]
if {$fn != {}} {
if {[catch {set ch [open "| cat > \"$fn\"" w]}]} {
Error [msgcat::mc {An error has occurred while saving}]
return
}
puts -nonewline $ch [$current(frame) get fits header $jj]
close $ch
}
}
default {
catch {DisplayHeader $current(frame) $jj \
[$current(frame) get fits file name $jj]}
incr i -1
}
}
}
}
|