/usr/lib/grass64/etc/dm/labels.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 | namespace eval DmLabels {
variable array opt # labels options
variable count 1
}
proc DmLabels::create { tree parent } {
variable opt
variable count
global dmpath
set node "labels:$count"
set frm [ frame .labelsicon$count]
set fon [font create -size 10]
set check [checkbutton $frm.check -font $fon \
-variable DmLabels::opt($count,_check) \
-height 1 -padx 0 -width 0]
image create photo labels_ico -file "$dmpath/labels.gif"
set ico [label $frm.ico -image labels_ico -bd 1 -relief raised]
pack $check $ico -side left
$tree insert end $parent $node \
-text "labels $count" \
-window $frm \
-drawcross auto
set opt($count,_check) 1
set opt($count,map) ""
set opt($count,minreg) ""
set opt($count,maxreg) ""
set opt($count,ignore_rot) 0
incr count
return $node
}
proc DmLabels::set_option { node key value } {
variable opt
set id [Dm::node_id $node]
set opt($id,$key) $value
}
proc DmLabels::select_map { id } {
set m [GSelect paint/labels]
if { $m != "" } {
set DmLabels::opt($id,map) $m
Dm::autoname $m
}
}
# display labels options
proc DmLabels::options { id frm } {
variable opt
global dmpath
global bgcolor
# labels name
set row [ frame $frm.name ]
Button $row.a -text [G_msg "Labels name:"] \
-command "DmLabels::select_map $id"
Entry $row.b -width 40 -text "$opt($id,map)" \
-textvariable DmLabels::opt($id,map) \
-background white
Button $row.c -text [G_msg "Help"] \
-image [image create photo -file "$dmpath/grass.gif"] \
-command "run g.manual d.labels" \
-background $bgcolor \
-helptext [G_msg "Help"]
pack $row.a $row.b $row.c -side left
pack $row -side top -fill both -expand yes
# display only in limited region size range
set row [ frame $frm.region ]
Label $row.a -text [G_msg "Display constraints:"]
LabelEntry $row.b -label "min" -textvariable DmLabels::opt($id,minreg) \
-width 8 -entrybg white
LabelEntry $row.c -label "max" -textvariable DmLabels::opt($id,maxreg) \
-width 8 -entrybg white
Label $row.d -text [G_msg "region size"]
pack $row.a $row.b $row.c $row.d -side left
pack $row -side top -fill both -expand yes
# ignore rotation
set row [ frame $frm.ignore_rot ]
checkbutton $row.a -text [G_msg " ignore rotation setting and draw horizontally"] -variable \
DmLabels::opt($id,ignore_rot)
pack $row.a -side left
pack $row -side top -fill both -expand yes
}
proc DmLabels::save { tree depth node } {
variable opt
set id [Dm::node_id $node]
foreach key { _check map minreg maxreg } {
Dm::rc_write $depth "$key $opt($id,$key)"
}
}
proc DmLabels::display { node } {
variable opt
puts "display labels"
set tree $Dm::tree
set id [Dm::node_id $node]
if { ! ( $opt($id,_check) ) } { return }
if { $opt($id,map) == "" } { return }
set cmd "d.labels labels=$opt($id,map)"
if { $opt($id,minreg) != "" } {
append cmd " minreg=$opt($id,minreg)"
}
if { $opt($id,maxreg) != "" } {
append cmd " maxreg=$opt($id,maxreg)"
}
run_panel $cmd
}
proc DmLabels::print { file node } {
variable opt
set tree $Dm::tree
set id [Dm::node_id $node]
if { ! ( $opt($id,_check) ) } { return }
if { $opt($id,map) == "" } { return }
puts $file "labels $opt($id,map)"
puts $file "end"
}
proc DmLabels::query { node } {
puts "Query not supported for Paint labels layer"
}
proc DmLabels::duplicate { tree parent node id } {
variable opt
variable count
global dmpath
set node "labels:$count"
set frm [ frame .labelsicon$count]
set fon [font create -size 10]
set check [checkbutton $frm.check -font $fon \
-variable DmLabels::opt($count,_check) \
-height 1 -padx 0 -width 0]
image create photo labels_ico -file "$dmpath/labels.gif"
set ico [label $frm.ico -image labels_ico -bd 1 -relief raised]
pack $check $ico -side left
if { $opt($id,map) == ""} {
$tree insert end $parent $node \
-text "labels $count" \
-window $frm \
-drawcross auto
} else {
$tree insert end $parent $node \
-text "$opt($id,map)" \
-window $frm \
-drawcross auto
}
set opt($count,_check) $opt($id,_check)
set opt($count,map) "$opt($id,map)"
set opt($count,minreg) "$opt($id,minreg)"
set opt($count,maxreg) "$opt($id,maxreg)"
incr count
return $node
}
|