This file is indexed.

/usr/share/saods9/src/plotscatter.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
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
#  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 PlotScatterTool {} {
    global iap
    PlotScatter $iap(tt) [msgcat::mc {Scatter Plot Tool}] {} {} {} 2 {}
}

proc PlotScatter {tt wtt title xaxis yaxis dim data} {
    global iap

    # make the window name unique
    set ii [lsearch $iap(windows) $tt]
    if {$ii>=0} {
	append tt $iap(unique)
	incr iap(unique)
    }

    # set the window title if none
    if {$wtt == {}} {
	set wtt $tt
    }

    set varname $tt
    upvar #0 $varname var
    global $varname

    PlotScatterProc $varname
    PlotDialog $varname $wtt $title $xaxis $yaxis
    PlotDialogScatter $varname

    PlotDataSet $varname $dim $data
    $var(proc,updategraph) $varname
    PlotStats $varname
    PlotList $varname
}

proc PlotScatterDialog {varname wtt title xaxis yaxis} {
    upvar #0 $varname var
    global $varname

    PlotScatterProc $varname
    PlotDialog $varname $wtt $title $xaxis $yaxis
    PlotDialogScatter $varname
}

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

    set var(proc,updategraph) PlotScatterUpdateGraph
    set var(proc,createelement) PlotScatterCreateElement
    set var(proc,updateelement) PlotScatterUpdateElement
    set var(proc,highlite) PlotScatterHighliteElement
    set var(proc,button) PlotScatterButton
}

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

    global pap

    set var(seq) 0
    set var(discrete) 1
    set var(linear) 0
    set var(step) 0
    set var(quadratic) 0
    set var(error) $pap(error)
    set var(bar) 0

    # element
    $var(mb).element add cascade -label [msgcat::mc {Discrete}] \
	-menu $var(mb).element.discrete
    $var(mb).element add cascade -label [msgcat::mc {Error}] \
	-menu $var(mb).element.error

    # discrete
    menu $var(mb).element.discrete
    $var(mb).element.discrete add checkbutton -label [msgcat::mc {Show}] \
	-variable ${varname}(discrete) \
	-command [list $var(proc,updateelement) $varname]
    $var(mb).element.discrete add separator
    $var(mb).element.discrete add cascade -label [msgcat::mc {Color}] \
	-menu $var(mb).element.discrete.color
    $var(mb).element.discrete add cascade -label [msgcat::mc {Shape}] \
	-menu $var(mb).element.discrete.shape

    ColorMenu $var(mb).element.discrete.color $varname discrete,color \
	[list PlotUpdateElementDiscrete $varname]
    menu $var(mb).element.discrete.shape
    $var(mb).element.discrete.shape add radiobutton \
	-label [msgcat::mc {Circle}] \
	-variable ${varname}(discrete,symbol) -value circle \
	-command [list PlotUpdateElementDiscrete $varname]
    $var(mb).element.discrete.shape add radiobutton \
	-label [msgcat::mc {Diamond}] \
	-variable ${varname}(discrete,symbol) -value diamond \
	-command [list PlotUpdateElementDiscrete $varname]
    $var(mb).element.discrete.shape add radiobutton \
	-label [msgcat::mc {Plus}] \
	-variable ${varname}(discrete,symbol) -value plus \
	-command [list PlotUpdateElementDiscrete $varname]
    $var(mb).element.discrete.shape add radiobutton \
	-label [msgcat::mc {Cross}] \
	-variable ${varname}(discrete,symbol) -value cross \
	-command [list PlotUpdateElementDiscrete $varname]
    $var(mb).element.discrete.shape add separator
    $var(mb).element.discrete.shape add checkbutton \
	-label [msgcat::mc {Fill}] \
	-variable ${varname}(discrete,fill) \
	-command [list PlotUpdateElementDiscrete $varname]

    # error
    menu $var(mb).element.error
    $var(mb).element.error add checkbutton \
	-label [msgcat::mc {Show}] \
	-variable ${varname}(error) \
	-command [list $var(proc,updateelement) $varname]
    $var(mb).element.error add separator
    $var(mb).element.error add cascade \
	-label [msgcat::mc {Color}] \
	-menu $var(mb).element.error.color
    $var(mb).element.error add cascade \
	-label [msgcat::mc {Line}] \
	-menu $var(mb).element.error.line

    ColorMenu $var(mb).element.error.color $varname error,color \
	[list PlotUpdateElementError $varname]
    WidthDashMenu $var(mb).element.error.line $varname error,width {} \
	[list PlotUpdateElementError $varname] {}

    # graph
    set var(graph) [blt::graph $var(top).scatter \
			-width 600 -height 500 \
			-plotrelief groove \
			-plotborderwidth 2 \
		       ]
    $var(graph) legend configure -hide yes

    pack $var(graph) -expand yes -fill both
    PlotChangeMode $varname
}

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

    if {$var(graph,x,auto)} {
	set xmin {}
	set xmax {}
    } else {
	set xmin $var(graph,x,min)
	set xmax $var(graph,x,max)
    }

    if {$var(graph,y,auto)} {
	set ymin {}
	set ymax {}
    } else {
	set ymin $var(graph,y,min)
	set ymax $var(graph,y,max)
    }

    $var(graph) xaxis configure -min $xmin -max $xmax \
	-descending $var(graph,x,flip)
    $var(graph) yaxis configure -min $ymin -max $ymax \
	-descending $var(graph,y,flip)

    PlotUpdateGraph $varname
}

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

    # warning: uses current vars
    if {$var(data,total) == 0} {
	return
    }

    # delete current elements
    set nn $var(data,current)
    foreach el [$var(graph) element names] {
	set f [split $el -]
	if {[lindex $f 1] == $nn} {
	    $var(graph) element delete $el
	}
    }

    if {$var(discrete,fill)} {
	set clr $var(discrete,color)
    } else {
	set clr {}
    }
    $var(graph) element create "d-${nn}" \
	-xdata $var(xdata) -ydata $var(ydata) \
	-linewidth 0 -pixels 5 \
	-symbol $var(discrete,symbol) \
	-fill $clr \
	-outline $var(discrete,color) \
	-color $var(discrete,color)

    # error
    if {$var(xedata) != {}} {
	if {[$var(xedata) length] != 0} {
	    PlotCreateErrorX $varname
	}
    }
    if {$var(yedata) != {}} {
	if {[$var(yedata) length] != 0} {
	    PlotCreateErrorY $varname
	}
    }

    # do this to force an update in case of no visible elements
    $var(graph) legend configure -hide yes
}

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

    set nn $var(data,current)
    set var($nn,discrete) $var(discrete)
    set var($nn,error) $var(error)

    $var(graph) element configure "d-${nn}" -hide [expr !$var(discrete)]

    foreach mk [$var(graph) marker names "m-${nn}*"] {
	$var(graph) marker configure $mk -hide [expr !$var(error)]
    }
}

proc PlotScatterButton {varname x y} {
    upvar #0 $varname var
    global $varname

    if {$var(data,total) == 0} {
	return
    }

    if {$var(callback) == {}} {
	return
    }

    # warning: uses d-1
    set rr [$var(graph) element closest $x $y]
    set el [lindex $rr 1]
    set row [lindex $rr 3]

    if {$row != {}} {
	if {$el == {d-1}} {
	    $var(graph) element deactivate d-1
	    $var(graph) element activate d-1 $row
	    # rows start at 1
	    eval "$var(callback) [expr $row+1]"
	}
    } else {
	$var(graph) element deactivate d-1
	eval "$var(callback) {}"
    }
}

proc PlotScatterHighliteElement {varname rowlist} {
    upvar #0 $varname var
    global $varname

    # warning: uses d-1
    if {$var(data,total) == 0} {
	return
    }

    if {$var(discrete)} {
	$var(graph) element deactivate d-1
	if {$rowlist != {}} {
	    # can have multiple rows
	    eval "$var(graph) element activate d-1 $rowlist"
	}
    }
}