blob: 22c6f6a3ecdd969c95e1b7431c942b7eff83c02a (
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
|
# 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 MarkerAnalysisStatsDialog {varname} {
upvar #0 $varname var
global $varname
global imarker
set frame $var(frame)
set id $var(id)
set vvarname ${imarker(prefix,stats)}${id}${frame}
upvar #0 $vvarname vvar
global $vvarname
set var(stats) [info exists ${vvarname}(top)]
$var(mb).analysis add checkbutton \
-label [msgcat::mc {Statistics}] \
-variable ${varname}(stats) \
-command "MarkerAnalysisStatsCmd $varname"
}
proc MarkerAnalysisStatsCmd {varname} {
upvar #0 $varname var
global $varname
MarkerAnalysisStats $var(frame) $var(id) $var(stats)
}
proc MarkerAnalysisStats {frame id stats} {
$frame marker $id analysis stats $stats
if {$stats} {
MarkerAnalysisStatsCB $frame $id
} else {
MarkerAnalysisStatsDeleteCB $frame $id
}
}
proc MarkerAnalysisStatsSystem {varname} {
upvar #0 $varname var
global $varname
if {[info exists var(stats)]} {
if {$var(stats)} {
MarkerAnalysisStatsCB $var(frame) $var(id)
}
}
}
# hardcoded marker.C
proc MarkerAnalysisStatsCB {frame id} {
global imarker
set varname ${imarker(prefix,dialog)}${id}${frame}
global $varname
upvar #0 $varname var
set vvarname ${imarker(prefix,stats)}${id}${frame}
upvar #0 $vvarname vvar
global $vvarname
if {[info exists var(system)]} {
set vvar(system) $var(system)
set sys $var(system)
} elseif {[info exists vvar(system)]} {
set sys $vvar(system)
} else {
global wcs
set sys $wcs(system)
}
if {[info exists var(sky)]} {
set vvar(sky) $var(sky)
set sky $var(sky)
} elseif {[info exists vvar(sky)]} {
set sky $vvar(sky)
} else {
global wcs
set sky $wcs(sky)
}
set tt [string totitle [$frame get marker $id type]]
set rr [$frame get marker $id analysis stats $sys $sky]
SimpleTextDialog $vvarname $tt 80 20 insert top $rr
}
proc MarkerAnalysisStatsDeleteCB {frame id} {
global imarker
set vvarname ${imarker(prefix,stats)}${id}${frame}
upvar #0 $vvarname vvar
global $vvarname
if {[info exists $vvarname]} {
SimpleTextDestroy $vvarname
}
}
|