/usr/lib/grass64/etc/dm/dtext.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 | # 1 Sept 2005
# panel for d.text
# Michael Barton, Arizona State University
namespace eval DmDtext {
variable array opt # dtext options
variable count 1
}
proc DmDtext::create { tree parent } {
variable opt
variable count
global dmpath
set node "dtext:$count"
set frm [ frame .dtexticon$count]
set fon [font create -size 10]
set check [checkbutton $frm.check -font $fon \
-variable DmDtext::opt($count,_check) \
-height 1 -padx 0 -width 0]
image create photo dtxtico -file "$dmpath/dtext.gif"
set ico [label $frm.ico -image dtxtico -bd 1 -relief raised]
pack $check $ico -side left
$tree insert end $parent $node \
-text "text $count"\
-window $frm \
-drawcross auto
set opt($count,_check) 1
set opt($count,text) ""
set opt($count,at) ""
set opt($count,line) ""
set opt($count,color) \#000000
set opt($count,size) 5
set opt($count,bold) 0
incr count
return $node
}
proc DmDtext::set_option { node key value } {
variable opt
set id [Dm::node_id $node]
set opt($id,$key) $value
}
proc DmDtext::select_file { id } {
variable tree
variable node
set m [GSelect file]
if { $m != "" } {
set DmDtext::opt($id,path) $m
}
}
# dtext options
proc DmDtext::options { id frm } {
variable opt
global dmpath
global bgcolor
# text
set row [ frame $frm.text ]
Label $row.a -text "Text to display:"
LabelEntry $row.b -textvariable DmDtext::opt($id,text) -width 51 \
-entrybg white
Button $row.c -text [G_msg "Help"] \
-image [image create photo -file "$dmpath/grass.gif"] \
-command "run g.manual d.text" \
-background $bgcolor \
-helptext [G_msg "Help"]
pack $row.a $row.b $row.c -side left
pack $row -side top -fill both -expand yes
# placement1
set row [ frame $frm.at ]
Label $row.a -text "Text placement: as % of display from lower left (x,y)"
LabelEntry $row.b -textvariable DmDtext::opt($id,at) -width 10 \
-entrybg white
pack $row.a $row.b -side left
pack $row -side top -fill both -expand yes
# placement2
set row [ frame $frm.line ]
Label $row.a -text " by line number from top (1-1000)"
LabelEntry $row.b -textvariable DmDtext::opt($id,line) -width 10 \
-entrybg white
pack $row.a $row.b -side left
pack $row -side top -fill both -expand yes
# font options
set row [ frame $frm.fontopt ]
Label $row.a -text [G_msg "Text options: color"]
SelectColor $row.b -type menubutton -variable DmDtext::opt($id,color)
Label $row.c -text " text height (% of display)"
SpinBox $row.d -range {1 100 1} -textvariable DmDtext::opt($id,size) \
-entrybg white -width 3
checkbutton $row.e -padx 10 -text [G_msg "bold text"] -variable \
DmDtext::opt($id,bold)
pack $row.a $row.b $row.c $row.d $row.e -side left
pack $row -side top -fill both -expand yes
}
proc DmDtext::save { tree depth node } {
variable opt
set id [Dm::node_id $node]
foreach key { _check text at line color size bold } {
Dm::rc_write $depth "$key $opt($id,$key)"
}
}
proc DmDtext::display { node } {
variable opt
set line ""
set input ""
global dmpath
set cmd ""
set tree $Dm::tree
set id [Dm::node_id $node]
# set hex colors to rgb
set color [Dm::color $opt($id,color)]
if { ! ( $opt($id,_check) ) } { return }
if { $opt($id,text) == "" } { return }
set cmd "echo $opt($id,text) | d.text color=$color size=$opt($id,size) "
# at
if { $opt($id,at) != "" } {
append cmd " {at=$opt($id,at)}"
}
# line
if { $opt($id,line) != "" } {
append cmd " line=$opt($id,line)"
}
# bold text
if { $opt($id,bold) != 0 } {
append cmd " -b"
}
# eval "exec echo $opt($id,text) | $cmd"
run_panel $cmd
}
proc DmDtext::print { file node } {
variable opt
set tree $Dm::tree
set id [Dm::node_id $node]
if { ! ( $opt($id,_check) ) } { return }
if { $opt($id,text) == "" } { return }
puts $file "dtext $opt($id,dtext)"
}
proc DmDtext::duplicate { tree parent node id } {
variable opt
variable count
global dmpath
set node "dtext:$count"
set frm [ frame .dtexticon$count]
set fon [font create -size 10]
set check [checkbutton $frm.check -font $fon \
-variable DmDtext::opt($count,_check) \
-height 1 -padx 0 -width 0]
image create photo dtxtico -file "$dmpath/dtext.gif"
set ico [label $frm.ico -image dtxtico -bd 1 -relief raised]
pack $check $ico -side left
if { $opt($id,text) == ""} {
$tree insert end $parent $node \
-text "text $count" \
-window $frm \
-drawcross auto
}
set opt($count,_check) $opt($id,_check)
set opt($count,text) $opt($id,text)
set opt($count,at) $opt($id,at)
set opt($count,line) $opt($id,line)
set opt($count,color) $opt($id,color)
set opt($count,size) $opt($id,size)
set opt($count,bold) $opt($id,bold)
incr count
return $node
}
|