/usr/share/oce-0.18/src/DrawResources/dftree.tcl is in oce-draw 0.18.2-2build1.
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 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | # Copyright (c) 1999-2014 OPEN CASCADE SAS
#
# This file is part of Open CASCADE Technology software library.
#
# This library is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License version 2.1 as published
# by the Free Software Foundation, with special exception defined in the file
# OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
# distribution for complete text of the license and disclaimer of any warranty.
#
# Alternatively, this file may be used under the terms of Open CASCADE
# commercial license or contractual agreement.
###########################
# #
# Version 1.4 #
# by SZV #
# #
###########################
#
# Open : double-clic or +
# Close : double-clic or -
# Refresh tree : close top level and re-open
#
# Attributes:
# white : interoperable
# white + c : non interoperable
# X : X Reference
# Red : not yet commited in transaction #0
#
#
proc __update { args } {
}
proc dftree { DDF_Browser } {
global env
global DFTREE_WINDOWS
global DFTREE_GLOBALS
global $DDF_Browser
puts $DDF_Browser
package require Tk
## Create images
set DFTREE_GLOBALS(ImageLabel) [DFOpenImage dfb_folder.gif]
set DFTREE_GLOBALS(ImageAttrOther) [DFOpenImage dfb_attribute.gif]
set DFTREE_GLOBALS(ImageAttrNS) [DFOpenImage dfb_attribns.gif]
## set DFTREE_LabelStyle [tixDisplayStyle imagetext \
## -font 9x15bold \
## -background Bisque3 \
## ]
## set DFTREE_LabelStyle1 [tixDisplayStyle imagetext \
## -font 9x15bold \
## -background Bisque3 \
## -foreground SeaGreen2 \
## ]
## set DFTREE_AttributeStyle [tixDisplayStyle imagetext \
## -font 9x15 \
## -background Bisque3 \
## ]
## set DFTREE_AttributeStyle1 [tixDisplayStyle imagetext \
## -font 9x15 \
## -background Bisque3 \
## -foreground DarkGreen \
## ]
## set DFTREE_AttributeStyle2 [tixDisplayStyle imagetext \
## -font 9x15 \
## -background Bisque3 \
## -foreground Red \
## ]
set w .$DDF_Browser
toplevel $w -height 400 -width 700 -background bisque3
########
# Tree #
########
set tree1 [ttk::treeview $w.tree -show tree]
$tree1 tag bind Label <<TreeviewOpen>> [list DFTREE:Tree:Open $DDF_Browser $w]
$tree1 tag configure Label -font 9x15bold -foreground DarkGreen
#$tree1 tag configure Attribute -font 9x15 -background bisque3
#$tree1 tag configure AttributeList -font 9x15 -background bisque3
pack $tree1 -expand yes -fill both -padx 4 -pady 4
# to see different fonts: /usr/openwin/lib/X11/fonts/misc or xlsfonts?
# 8x13 8x13bold 9x15 9x15bold
# hlist.font 8x13bold
# hlist.gap "15"
# hlist.indent "30"
set DFTREE_WINDOWS($w,tree) $tree1
set DFTREE_WINDOWS($w,root) [$tree1 insert {} end \
-text $DDF_Browser \
-values "" \
-tags Label]
# Here we need to open first node!
return
}
###############################################################################
#
#
proc DFTREE:Tree:Open { DDF_Browser w } {
global DFTREE_WINDOWS
global DFTREE_GLOBALS
global $DDF_Browser
set df_tree $DFTREE_WINDOWS($w,tree)
set df_node [$df_tree focus]
#if {$df_node == $DFTREE_WINDOWS($w,root)} {
# This is root
set chdlist [$df_tree children $df_node]
if {$chdlist != {}} {
# The root branch already exists in hlist.
# Clear all its children to force the tree to be updated.
$df_tree delete $chdlist
}
#}
#update
DFTREE:Tree:Fill $DDF_Browser $df_tree $df_node
return
}
###############################################################################
#
#
proc DFTREE:Tree:Fill { DDF_Browser df_tree df_node } {
global DFTREE_GLOBALS
global $DDF_Browser
set loc [lindex [$df_tree item $df_node -values] 0]
set type [lindex [$df_tree item $df_node -tags] 0]
switch -glob $type {
Label {
DFTREE:Tree:UpdateLabel $DDF_Browser $df_tree $df_node $loc
}
#AttributeList {
# DFTREE:Tree:UpdateAttributeList $DDF_Browser $df_tree $df_node $loc
#}
default {
}
}
return
}
###############################################################################
# $df_entry is a label entry, "1:3:2" for example, or "" for root.
#
proc DFTREE:Tree:UpdateLabel { DDF_Browser df_tree df_node df_entry } {
global DFTREE_GLOBALS
global $DDF_Browser
foreach fullname [split [DFOpenLabel $DDF_Browser $df_entry] "\\" ] {
FCTREE:Tree:DecodeLabelItem $DDF_Browser $df_tree $df_node $df_entry $fullname
}
return
}
###############################################################################
#
#
proc DFTREE:Tree:UpdateAttributeList { DDF_Browser df_tree df_node df_entry} {
global DFTREE_GLOBALS
global $DDF_Browser
set image_other $DFTREE_GLOBALS(ImageAttrOther)
set image_ns $DFTREE_GLOBALS(ImageAttrNS)
#set xrefimage $DFTREE_GLOBALS(ImageAttrOther)
# abv: index attributes
set num 0
set attributes [split [DFOpenAttributeList $DDF_Browser $df_entry ] "\\" ]
set iattributes {}
foreach fullname $attributes {
set num [expr $num + 1]
lappend fullname $num
lappend iattributes $fullname
}
foreach fullname [lsort $iattributes] {
# Information first split
set tmplist [split $fullname " "]
set name [lindex $tmplist 0]
set transaction [lindex $tmplist 1]
set valid [lindex $tmplist 2]
set forgotten [lindex $tmplist 3]
set backuped [lindex $tmplist 4]
set maybeopen [lindex $tmplist 5]
# Name analysis to suppress the map address.
set shortlist [split $name "#"]
set shortname [lindex $shortlist 0]
set index [lindex $shortlist 1]
# Package analysis to determine the icon type.
#set pk [lindex [split $name _] 0]
set node_img $image_other
#if {$pk == "TDataStd" || $pk == "TNaming"} {set node_img $standardimage}
#if {$pk == "TXRef"} {set node_img $xrefimage}
if {$shortname == "TNaming_NamedShape"} {set node_img $image_ns}
set textname "$shortname"
# if { [llength $tmplist] >5 } { set textname [lindex $tmplist 5] }
set textname "$textname [DFGetAttributeValue $DDF_Browser $df_entry [lindex $tmplist 6]]"
# Transaction analysis
if {$transaction == "0"} {
# set locstyle $DFTREE_AttributeStyle
} else {
# set textname "$textname T=$transaction"
# set locstyle $DFTREE_AttributeStyle1
}
# Valid?
if {$valid == "NotValid"} {set textname "$textname $valid"}
# Forgotten?
if {$forgotten == "Forgotten"} {set textname "$textname $forgotten"}
# Backuped?
if {$backuped == "Backuped"} {set textname "$textname $backuped"}
set df_new [$df_tree insert $df_node end \
-text $textname -image $node_img -tags Attribute]
if {$maybeopen == "1"} {
$df_tree item $df_new -open true
DFTREE:Tree:UpdateAttribute $DDF_Browser $df_tree $df_new $index
}
}
}
###############################################################################
# $loc is always the attribute index
#
proc DFTREE:Tree:UpdateAttribute { DDF_Browser df_tree df_node a_index } {
global DFTREE_GLOBALS
global $DDF_Browser
set tmplist [split [DFOpenAttribute $DDF_Browser $a_index ] "\\"]
# Failed or not?
if {[lindex $tmplist 0] == "Failed"} {
## set locstyle $DFTREE_AttributeStyle2
} else {
## set locstyle $DFTREE_AttributeStyle
}
foreach name $tmplist {
$df_tree insert $df_node end -text $name -tags Terminal
}
return
}
###############################################################################
# item:
# "Entry Name=TheNameIfExists Modified|NotModified 0|1"
proc FCTREE:Tree:DecodeLabelItem { DDF_Browser df_tree df_node df_entry labelItem} {
global DFTREE_GLOBALS
global $DDF_Browser
set tmplist [split $labelItem " " ]
set labname [lindex $tmplist 0]
set textname "$labname"
if {$labname == "AttributeList"} {
# Attribute List
# --------------
#set modified [lindex $tmplist 1]
# Modified or not?
#if {$modified == "Modified"} {
# set textname "$textname $modified"
## set locstyle $DFTREE_AttributeStyle1
#} else {
## set locstyle $DFTREE_AttributeStyle
#}
#set df_new [$df_tree insert $df_node end \
# -text $textname \
# -image $DFTREE_GLOBALS(ImageAttrList) \
# -tags AttributeList]
#$df_tree item $df_new -open true
DFTREE:Tree:UpdateAttributeList $DDF_Browser $df_tree $df_node $df_entry
} else {
# Sub-label(s)
# ------------
set name [lindex $tmplist 1]
set modified [lindex $tmplist 2]
set maybeopen [lindex $tmplist 3]
# Name?
set ll [expr [string length $name] -2]
if {$ll > 0} {
set textname "$textname [string range $name 1 $ll]"
}
# Modified or not?
if {$modified == "Modified"} {
set textname "$textname $modified"
}
set df_new [$df_tree insert $df_node end \
-text $textname \
-image $DFTREE_GLOBALS(ImageLabel) \
-values $labname \
-tags Label]
if {$maybeopen == "1"} {
$df_tree item $df_new -open true
}
DFTREE:Tree:UpdateLabel $DDF_Browser $df_tree $df_new $labname
}
}
###############################################################################
#
#
proc DFGetAttributeValue { DDF_Browser lab index } {
global $DDF_Browser; # necessary for DRAW command to see the browser
if {[catch "XAttributeValue $DDF_Browser $lab $index" ret]} {
return ""
}
if {"$ret" == ""} { return "" }
return "\[$ret\]"
}
###############################################################################
#
#
proc DFOpenImage { img } {
global env
if {[catch "image create photo -file $env(DRAWHOME)/$img" ret]} {
return ""
}
return $ret
}
|