This file is indexed.

/usr/lib/grass64/etc/gm/maptext.tcl is in grass-gui 6.4.3-3.

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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
###############################################################
# maptext.tcl - TclTk canvas postscript text layer options file for GRASS GIS Manager
# February 2006 Michael Barton, Arizona State University
# COPYRIGHT:	(C) 1999 - 2006 by the GRASS Development Team
#
#		This program is free software under the GNU General Public
#		License (>=v2). Read the file COPYING that comes with GRASS
#		for details.
#
##########################################################################

namespace eval GmCtext {
    variable array opt ;# ctext options
    variable placement ;#entry widget for x,y coordinates
    variable count 1
    variable optlist
}

proc GmCtext::create { tree parent } {
    variable opt
    variable count
	variable dup
	variable optlist
    global iconpath
    global env

    set node "ctext:$count"

    set frm [ frame .ctexticon$count]
    set check [checkbutton $frm.check \
		-variable GmCtext::opt($count,1,_check) \
		-height 1 -padx 0 -width 0]

    image create photo ctico -file "$iconpath/gui-maptext.gif"
    set ico [label $frm.ico -image ctico -bd 1 -relief raised]

    bind $ico <ButtonPress-1> "GmTree::selectn $tree $node"

    pack $check $ico -side left
    
	#insert new layer
	if {[$tree selection get] != "" } {
		set sellayer [$tree index [$tree selection get]]
    } else { 
    	set sellayer "end" 
    }

    $tree insert $sellayer $parent $node \
	-text  "PS text layer $count"\
	-window    $frm \
	-drawcross auto  
        
    set opt($count,1,_check) 1 
	set opt($count,1,opacity) 1.0
    set opt($count,1,text) "" 
    set opt($count,1,at) "100,100"
    set opt($count,1,font) "times 12" 
    set opt($count,1,fill) \#000000 
    set opt($count,1,width)  100
    set opt($count,1,anchor) "center_left" 
    set opt($count,1,anchorlv) ""
    set opt($count,1,justify) "left"
    set opt($count,1,justifylv) ""
    set opt($count,1,coordinates) "pixels"
    set opt($count,1,coordinateslv) ""
    set opt($count,1,mouseset) 0
    
    set optlist { _check opacity text at font fill width anchor justify coordinates mouseset}
    
    foreach key $optlist {
		set opt($count,0,$key) $opt($count,1,$key)
    } 

    incr count
    return $node
}

###############################################################################
proc GmCtext::select_font { id frm } {
	global mon
	variable opt
    
    set fon [SelectFont $frm.fontset -type dialog -sampletext [G_msg "This is font sample text."] -title [G_msg "Select label font"] -font $opt($id,1,font) ]
	if { $fon != "" } {set opt($id,1,font) $fon}
}

###############################################################################
proc GmCtext::set_option { node key value } {
    variable opt
 
    set id [GmTree::node_id $node]
    set opt($id,1,$key) $value
}

###############################################################################

proc GmCtext::mouseset { id } {
	# use mouse to set scalebar placement coordinates
	global mon pctentry pixelentry geogentry
	variable placement
	if { $GmCtext::opt($id,1,mouseset) == 1} {
		if {$GmCtext::opt($id,1,coordinates) == "pixels"} {
			set pixelentry $GmCtext::placement
		} else {
			set pixelentry ""
		}
		if {$GmCtext::opt($id,1,coordinates) == "percent"} {
			set pctentry $GmCtext::placement
		} else {
			set pctentry ""
		}
		if {$GmCtext::opt($id,1,coordinates) == "geographic"} {
			set geogentry $GmCtext::placement
		} else {
			set geogentry ""
		}
	}
}
###############################################################################

# ctext options
proc GmCtext::options { id frm } {
    variable opt
	variable placement
    global iconpath

    # Panel heading
    set row [ frame $frm.heading ]
    Label $row.a -text [G_msg "Create postscript text object (for postscript eps, pdf, and print output only)"] \
    	-fg MediumBlue
    pack $row.a -side left
    pack $row -side top -fill both -expand yes

    # text
    set row [ frame $frm.text ]
    Label $row.a -text [G_msg "Text to display:"]
    LabelEntry $row.b -textvariable GmCtext::opt($id,1,text) -width 45 
    pack $row.a $row.b -side left
    pack $row -side top -fill both -expand yes
    
    # coordinates1
    set row [ frame $frm.east_north ]
    set placement [LabelEntry $row.a -label [G_msg "Text placement: x,y coordinates (from upper left) "] \
    	-textvariable GmCtext::opt($id,1,at) -width 24]
    pack $row.a -side left
    pack $row -side top -fill both -expand yes
        
    # coordinates2
    set row [ frame $frm.textcoord2 ]
    Label $row.a -text [G_msg "     coordinate type for text placement "] 
    ComboBox $row.b -padx 2 -width 10 -textvariable GmCtext::opt($id,1,coordinates) \
    	-values {"pixels" "percent" "geographic" } -modifycmd "GmCtext::mouseset $id" \
    	-labels [list [G_msg "pixels"] [G_msg "percent"] [G_msg "geographic"]] -labelsvariable GmCtext::opt($id,1,coordinateslv)
    checkbutton $row.c -text [G_msg "place with mouse"] \
    	-variable GmCtext::opt($id,1,mouseset) \
    	-command "GmCtext::mouseset $id"
    pack $row.a $row.b $row.c -side left
    pack $row -side top -fill both -expand yes
        
    # text options1
    set row [ frame $frm.textopt1 ]
    Label $row.a -text [G_msg "     align text with coordinate point  "] 
    ComboBox $row.b -padx 2 -width 16 -textvariable GmCtext::opt($id,1,anchor) \
		-values {"lower_left" "bottom_center" "lower_right" "center_left" "center" 
		"center_right" "upper_left" "top_center" "upper_right" } \
		-labels [list [G_msg "lower left"] [G_msg "bottom center"] [G_msg "lower right"] [G_msg "center left"] [G_msg "center"] [G_msg "center right"] [G_msg "upper left"] [G_msg "top center"] [G_msg "upper right"]] -labelsvariable GmCtext::opt($id,1,anchorlv)
    pack $row.a $row.b -side left
    pack $row -side top -fill both -expand yes

    # text options2
    set row [ frame $frm.textopt2 ]
    Label $row.a -text [G_msg "     justification"] 
    ComboBox $row.b -padx 2 -width 10 -textvariable GmCtext::opt($id,1,justify) \
		-values {"left" "center" "right"} \
		-labels [list [G_msg "left"] [G_msg "center"] [G_msg "right"]] -labelsvariable GmCtext::opt($id,1,justifylv)
    Label $row.c -text [G_msg "  line width"]
    LabelEntry $row.d -textvariable GmCtext::opt($id,1,width) -width 5 
    pack $row.a $row.b $row.c $row.d -side left
    pack $row -side top -fill both -expand yes
        
    # select font
    set row [ frame $frm.font ]
    Label $row.a -text [G_msg "Font:"] 
    Button $row.b -image [image create photo -file "$iconpath/gui-font.gif"] \
        -highlightthickness 0 -takefocus 0 -relief raised -borderwidth 1  \
        -helptext [G_msg "select font for text"] \
	    -command "GmCtext::select_font $id $frm"
    Entry $row.c -width 15 -text "$opt($id,1,font)" \
	    -textvariable GmCtext::opt($id,1,font) 
    Label $row.d -text [G_msg "  color"] 
    SelectColor $row.e -type menubutton -variable GmCtext::opt($id,1,fill)
    pack $row.a $row.b $row.c $row.d $row.e -side left
    pack $row -side top -fill both -expand yes


}

###############################################################################
proc GmCtext::save { tree depth node } {
    variable opt
    variable optlist
    
    set id [GmTree::node_id $node]

    foreach key $optlist {
        GmTree::rc_write $depth "$key $opt($id,1,$key)"
    } 
}

###############################################################################
proc GmCtext::display { node } {
    variable opt
    variable tree
    variable can
    global mon

    set tree($mon) $GmTree::tree($mon)
    set id [GmTree::node_id $node]
    set canvas_w($mon) $MapCanvas::canvas_w($mon)
    set canvas_h($mon) $MapCanvas::canvas_h($mon)
    

    set can($mon) $MapCanvas::can($mon)
    
    
    if {$opt($id,1,_check) == 0 } { return } 

    if { $opt($id,1,text) == "" } { return } 
        
    switch $opt($id,1,anchor) {
    	"lower_left" 	{ set anchor "sw"}
    	"bottom_center" { set anchor "s" }
    	"lower_right" 	{ set anchor "se"}
    	"center_left" 	{ set anchor "w" }
    	"center" 		{ set anchor "center" }
    	"center_right" 	{ set anchor "e" }
    	"upper_left" 	{ set anchor "nw"}
    	"top_center" 	{ set anchor "n" }
    	"upper_right" 	{ set anchor "ne"}
    }
     
    set xcoord [lindex [split $opt($id,1,at) ","] 0]
    set ycoord [lindex [split $opt($id,1,at) ","] 1]	
    
    if {$opt($id,1,coordinates) == "geographic"} {
		set xcoord [MapCanvas::mape2scrx $mon $xcoord]
		set ycoord [MapCanvas::mapn2scry $mon $ycoord]
		$can($mon) create text $xcoord $ycoord \
			-anchor $anchor \
			-justify $opt($id,1,justify) \
			-width $opt($id,1,width) \
			-fill $opt($id,1,fill) \
			-font $opt($id,1,font) \
			-text $opt($id,1,text)
    } elseif {$opt($id,1,coordinates) == "percent"} {
		set xpct [expr ($xcoord/100.0) * $canvas_w($mon)]
		set ypct [expr ($ycoord/100.0) * $canvas_h($mon)]
		$can($mon) create text $xpct $ypct \
			-anchor $anchor \
			-justify $opt($id,1,justify) \
			-width $opt($id,1,width) \
			-fill $opt($id,1,fill) \
			-font $opt($id,1,font) \
			-text $opt($id,1,text)
    } else {
		$can($mon) create text $xcoord $ycoord \
			-anchor $anchor \
			-justify $opt($id,1,justify) \
			-width $opt($id,1,width) \
			-fill $opt($id,1,fill) \
			-font $opt($id,1,font) \
			-text $opt($id,1,text)
	}
}
###############################################################################

proc GmCtext::duplicate { tree parent node id } {
    variable opt
    variable count
	variable dup
	variable optlist
    global iconpath

    set node "ctext:$count"

    set frm [ frame .ctexticon$count]
    set check [checkbutton $frm.check \
		-variable GmCtext::opt($count,1,_check) \
		-height 1 -padx 0 -width 0]

    image create photo ctico -file "$iconpath/gui-maptext.gif"
    set ico [label $frm.ico -image ctico -bd 1 -relief raised]

    bind $ico <ButtonPress-1> "GmTree::selectn $tree $node"

    pack $check $ico -side left
    
	#insert new layer
	if {[$tree selection get] != "" } {
		set sellayer [$tree index [$tree selection get]]
    } else { 
    	set sellayer "end" 
    }

    $tree insert $sellayer $parent $node \
	-text  "PS text layer $count"\
	-window    $frm \
	-drawcross auto  
        
	set opt($count,1,opacity) $opt($id,1,opacity)
    set first 1
    
    foreach key $optlist {
    	set opt($count,1,$key) $opt($id,1,$key)
		set opt($count,0,$key) $opt($count,1,$key)
    } 
	

    incr count
    return $node
}