/usr/share/oce-0.8.0/src/StdResource/dftree.tcl is in liboce-foundation1 0.8.0-1.
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 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | ###########################
# #
# Version 1.3 #
# by FID & YAN #
# #
###########################
#
# 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 DFTREE_WINDOWS
global DFTREE_LabelStyle
global DFTREE_LabelStyle1
global DFTREE_AttributeStyle
global DFTREE_AttributeStyle1
global DFTREE_AttributeStyle2
global $DDF_Browser
## global $DDF_Browser
puts $DDF_Browser
package require Tix
#tixPref:InitFontSet:14Point
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
set top [frame $w.thu -bd 1 -relief raised -background Bisque3]
################
# Paned Window #
################
set p [tixPanedWindow $top.p -orient horizontal -height 400 -width 700]
pack $p -expand yes -fill both -padx 4 -pady 4
DFTREE:Tree:InitTreePanel $DDF_Browser $w $p
# DFTREE:Tree:InitTextPanel $DDF_Browser $w $p
tixForm $top -left 2 -top 2 -right %99 -bottom %99
return
}
###############################################################################
#
#
proc DFTREE:Tree:InitTreePanel { DDF_Browser w p } {
global DFTREE_WINDOWS
global $DDF_Browser
########
# Tree #
########
set p1 [$p add pane1 -expand 1 -size 700] ; $p1 config -relief flat
set tree [tixTree $p1.tree \
-opencmd [list DFTREE:Tree:Open $DDF_Browser $w] \
-options { \
hlist.separator "^" \
hlist.font 9x15bold \
hlist.background Bisque3 \
hlist.foreground Black \
} ]
pack $p1.tree -expand yes -fill both -padx 4 -pady 4
# -browsecmd DFTREE:Tree:BrowseCmd
# Cette option peut etre ajoutee a la commande tixTree,
# mais elle declanche l'appel a la procedure a chaque clic ,
# double-clic, voire a chaque appui puis relachement de souris!!!
# 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,NAV,tree) $tree
set DFTREE_WINDOWS($w,NAV,hlist) [$tree subwidget hlist]
$DFTREE_WINDOWS($w,NAV,hlist) add ^ \
-text $DDF_Browser \
-data [list $DDF_Browser DataFramework]
$DFTREE_WINDOWS($w,NAV,tree) setmode ^ open
}
###############################################################################
#
#
proc DFTREE:Tree:InitTextPanel { DDF_Browser w p } {
global DFTREE_WINDOWS
global $DDF_Browser
########
# Text #
########
set p2 [$p add pane2 -expand 4 -size 400] ; $p2 config -relief flat
tixScrolledText $p2.st
pack $p2.st -expand yes -fill both -padx 4 -pady 4
set DFTREE_WINDOWS($w,NAV,text) [$p2.st subwidget text]
$DFTREE_WINDOWS($w,NAV,text) insert end " Welcome to the QDF browser (Rev #.#)\n"
$DFTREE_WINDOWS($w,NAV,text) insert end "--------------------------------------\n\n"
$DFTREE_WINDOWS($w,NAV,text) insert end "This browser is an easy to use prototype made with Tix technology. We hope it will be usefull for understanding and debugging QDF.\n"
$DFTREE_WINDOWS($w,NAV,text) insert end "\t\t\t\tFID & YAN"
}
###############################################################################
#
#
proc DFTREE:Tree:BrowseCmd { dir } {
puts "Hello $dir !"
}
###############################################################################
# Se positionne sur l'entry pere et update les fenetres.
#
proc DFTREE:Tree:Up { w } {
global DFTREE_WINDOWS
global DFTREE_GLOBALS
#puts "DFTREE:Tree:Up"
if { [set here [$DFTREE_WINDOWS($w,NAV,hlist) info anchor]] != {} } {
if { [set up [$DFTREE_WINDOWS($w,NAV,hlist) info parent $here]] != {} } {
DFTREE:Tree:ShowUp $w $up
set DFTREE_GLOBALS(CWD) [lindex [$DFTREE_WINDOWS($w,NAV,hlist) info data $up] 0]
}
}
return
}
###############################################################################
# Se positionne sur l'entry up sans update (History)
#
proc DFTREE:Tree:ShowUp { w dir } {
global DFTREE_WINDOWS
#puts "DFTREE:Tree:ShowUp"
$DFTREE_WINDOWS($w,NAV,hlist) anchor clear
$DFTREE_WINDOWS($w,NAV,hlist) anchor set $dir
$DFTREE_WINDOWS($w,NAV,hlist) selection clear
$DFTREE_WINDOWS($w,NAV,hlist) selection set $dir
$DFTREE_WINDOWS($w,NAV,hlist) see $dir
return
}
###############################################################################
#
#
proc DFTREE:Tree:Open { DDF_Browser w dir} {
global DFTREE_WINDOWS
global $DDF_Browser
#puts "DFTREE:Tree:Open"
if {$dir == "^"} {
# This is root
if {[$DFTREE_WINDOWS($w,NAV,hlist) info children $dir] != {}} {
# The root branch already exists in hlist.
# Clear all its children to force the tree to be updated.
foreach kid [$DFTREE_WINDOWS($w,NAV,hlist) info children $dir] {
$DFTREE_WINDOWS($w,NAV,hlist) delete entry $kid
}
}
}
if {[$DFTREE_WINDOWS($w,NAV,hlist) info children $dir] != {}} {
# The branch exists in hlist.
foreach kid [$DFTREE_WINDOWS($w,NAV,hlist) info children $dir] {
$DFTREE_WINDOWS($w,NAV,hlist) show entry $kid
}
set data [$DFTREE_WINDOWS($w,NAV,hlist) info data $dir]
set loc [lindex $data 0]
} else {
# The branch is unknown.
tixBusy $w on
update
DFTREE:Tree:Fill $DDF_Browser $w $dir
tixBusy $w off
}
return
}
###############################################################################
#
#
proc DFTREE:Tree:Fill { DDF_Browser w dir } {
global DFTREE_WINDOWS
global DFTREE_GLOBALS
global $DDF_Browser
#puts "DFTREE:Tree:Fill"
set data [$DFTREE_WINDOWS($w,NAV,hlist) info data $dir]
set loc [lindex $data 0]
set type [lindex $data 1]
#puts "====================="
#puts "Type $type"
#puts "Window $w"
#puts "Loc $loc"
#puts "Dir $dir"
switch -glob $type {
DataFramework {
DFTREE:Tree:UpdateDataFramework $DDF_Browser $w $loc $dir
}
Label {
DFTREE:Tree:UpdateLabel $DDF_Browser $w $loc $dir
}
AttributeList {
set lab [lindex $data 2]
DFTREE:Tree:UpdateAttributeList $DDF_Browser $w $loc $dir $lab
}
Attribute {
DFTREE:Tree:UpdateAttribute $DDF_Browser $w $loc $dir
}
terminal {
DFTREE:Tree:terminal $DDF_Browser $w $loc $dir
}
default {
puts "type non reconnu"
}
}
return
}
###############################################################################
# ici dir = ^
#
proc DFTREE:Tree:UpdateDataFramework { DDF_Browser w loc dir } {
global DFTREE_WINDOWS
global $DDF_Browser
global DFTREE_LabelStyle
global DFTREE_LabelStyle1
set litm {}
foreach fullname [split [DFOpenLabel $DDF_Browser ""] "\\" ] {
FCTREE:Tree:DecodeLabelItem $DDF_Browser $w $loc $dir $fullname
}
return
}
###############################################################################
# $loc is a label entry, "1.3.2" for exemple.
#
proc DFTREE:Tree:UpdateLabel { DDF_Browser w loc dir } {
global DFTREE_WINDOWS
global $DDF_Browser
global DFTREE_LabelStyle
global DFTREE_LabelStyle1
global DFTREE_AttributeStyle
global DFTREE_AttributeStyle1
set litm {}
foreach fullname [split [DFOpenLabel $DDF_Browser $loc ] "\\" ] {
FCTREE:Tree:DecodeLabelItem $DDF_Browser $w $loc $dir $fullname
}
return
}
###############################################################################
#
#
proc DFTREE:Tree:UpdateAttributeList { DDF_Browser w loc dir lab} {
global DFTREE_WINDOWS
global $DDF_Browser
global DFTREE_AttributeStyle
global DFTREE_AttributeStyle1
set litm {}
set standardimage [tix getimage srcfile]
set otherimage [tix getimage file]
set xrefimage [tix getimage cross]
# abv: index attributes
set num 0
set attributes [split [DFOpenAttributeList $DDF_Browser $lab ] "\\" ]
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]
# Package analysis to determine the icon type.
set pk [lindex [split $name _] 0]
set image $otherimage
if {$pk == "TDataStd" || $pk == "TNaming"} {set image $standardimage}
if {$pk == "TXRef"} {set image $xrefimage}
# Name analysis to suppress the map address.
set shortlist [split $name "#"]
set shortname [lindex $shortlist 0]
set index [lindex $shortlist 1]
set textname "$shortname"
# if { [llength $tmplist] >5 } { set textname [lindex $tmplist 5] }
set textname "$textname [DFGetAttributeValue $DDF_Browser $lab [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"}
$DFTREE_WINDOWS($w,NAV,hlist) add ${dir}^${name} \
-itemtype imagetext \
-text $textname \
-image $image \
-style $locstyle \
-data [list ${index} Attribute]
if {$maybeopen == "1"} {
$DFTREE_WINDOWS($w,NAV,tree) setmode ${dir}^${name} open
}
lappend litm [list $name $image]
}
return
}
###############################################################################
# $loc is always the attribute index
#
proc DFTREE:Tree:UpdateAttribute { DDF_Browser w loc dir } {
global DFTREE_WINDOWS
global $DDF_Browser
global DFTREE_AttributeStyle
global DFTREE_AttributeStyle1
global DFTREE_AttributeStyle2
set litm {}
set image [tix getimage minimize]
set tmplist [split [DFOpenAttribute $DDF_Browser $loc ] "\\"]
# Failed or not?
if {[lindex $tmplist 0] == "Failed"} {
set locstyle $DFTREE_AttributeStyle2
} else {
set locstyle $DFTREE_AttributeStyle
}
foreach name $tmplist {
$DFTREE_WINDOWS($w,NAV,hlist) add ${dir}^${name} \
-itemtype imagetext \
-text $name \
-image $image \
-style $locstyle \
-data [list ${loc}:${name} terminal] \
-state disabled
#$DFTREE_WINDOWS($w,NAV,tree) setmode ${dir}^${name} open
lappend litm [list $name $image]
}
return
}
###############################################################################
# item:
# "Entry Name=LeNomSIlExiste Modified|NotModified 0|1"
proc FCTREE:Tree:DecodeLabelItem { DDF_Browser w loc dir labelItem} {
global DFTREE_WINDOWS
global $DDF_Browser
global DFTREE_LabelStyle
global DFTREE_LabelStyle1
global DFTREE_AttributeStyle
global DFTREE_AttributeStyle1
set image [tix getimage folder]
set tmplist [split $labelItem " " ]
set labentry [lindex $tmplist 0]
set name [lindex $tmplist 1]
set modified [lindex $tmplist 2]
set maybeopen [lindex $tmplist 3]
set textname "$labentry"
if {$labentry == "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 image [tix getimage textfile]
$DFTREE_WINDOWS($w,NAV,hlist) add ${dir}^$labentry \
-itemtype imagetext \
-text $textname \
-image $image \
-style $locstyle \
-data [list $labentry AttributeList $loc]
$DFTREE_WINDOWS($w,NAV,tree) setmode ${dir}^$labentry open
lappend litm [list $labentry $image]
set image [tix getimage folder]
} else {
# Sub-label(s)
# ------------
# 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 locstyle $DFTREE_LabelStyle1
} else {
set locstyle $DFTREE_LabelStyle
}
$DFTREE_WINDOWS($w,NAV,hlist) add ${dir}^$labentry \
-itemtype imagetext \
-text $textname \
-image $image \
-style $locstyle \
-data [list $labentry Label]
if {$maybeopen == "1"} {
$DFTREE_WINDOWS($w,NAV,tree) setmode ${dir}^$labentry open
}
lappend litm [list $labentry $image]
}
}
###############################################################################
#
#
proc DFTREE:Tree:terminal { DDF_Browser w loc dir } {
global DFTREE_WINDOWS
global $DDF_Browser
return
}
###############################################################################
# loc est une adresse de label?
#
proc DFTREE:Tree:DisplayAttribute { DDF_Browser w loc dir } {
global DFTREE_WINDOWS
global $DDF_Browser
return
}
###############################################################################
# imprime tout ce qu'il y a dans hli ( Hlist )
#
proc wokDBG { {root {}} } {
global DFTREE_GLOBALS
global DFTREE_WINDOWS
set w $DFTREE_GLOBALS(toplevel)
set hli $DFTREE_WINDOWS($w,NAV,hlist)
foreach c [$hli info children $root] {
puts "$c : data <[$hli info data $c]>"
wokDBG $c
}
return
}
proc DFGetAttributeValue {browser lab index} {
global $browser; # necessary for DRAW command to see the browser
#puts "$lab $index"
# set names [split $dir ^]
# set len [expr [llength $names] -1]
# set lab [lindex $names [expr $len - 2]]
# set num [lindex $names $len]
# regexp {browser_(.*)} $browser whole doc
# XSAttributeValue browser_D a b
if {[catch "XAttributeValue $browser $lab $index" ret]} {
return ""
}
if {"$ret" == ""} { return "" }
return "\[$ret\]"
}
|