/usr/share/tcltk/tcl8.5/Tix8.4.3/Variable.tcl is in tix 8.4.3-4ubuntu1.
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 | # -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: Variable.tcl,v 1.4 2001/12/09 05:04:02 idiscovery Exp $
#
# Variable.tcl --
#
# Routines in this file are used to set up and operate variables
# for classes that support the -variable option
#
# Copyright (c) 1993-1999 Ioi Kim Lam.
# Copyright (c) 2000-2001 Tix Project Group.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# tixVariable:ConfigVariable --
#
# Set up the -variable option for the object $w
#
# Side effects:
#
# data(-variable) is changed to the name of the global variable
# if the global variable exists, data(-value) takes the value of this
# variable.
# if the global variable does not exist, it is created with the
# current data(-value)
#
# Return value:
#
# true is data(-value) is changed, indicating that data(-command)
# should be invoked.
#
proc tixVariable:ConfigVariable {w arg} {
upvar #0 $w data
set changed 0
if {$data(-variable) != ""} {
uplevel #0 \
[list trace vdelete $data(-variable) w "tixVariable:TraceProc $w"]
}
if {$arg != ""} {
if {[uplevel #0 info exists [list $arg]]} {
# This global variable exists, we use its value
#
set data(-value) [uplevel #0 set [list $arg]]
set changed 1
} else {
# This global variable does not exist; let's set it
#
uplevel #0 [list set $arg $data(-value)]
}
uplevel #0 \
[list trace variable $arg w "tixVariable:TraceProc $w"]
}
return $changed
}
proc tixVariable:UpdateVariable {w} {
upvar #0 $w data
if {$data(-variable) != ""} {
uplevel #0 \
[list trace vdelete $data(-variable) w "tixVariable:TraceProc $w"]
uplevel #0 \
[list set $data(-variable) $data(-value)]
uplevel #0 \
[list trace variable $data(-variable) w "tixVariable:TraceProc $w"]
# just in case someone has another trace and restricted my change
#
set data(-value) [uplevel #0 set [list $data(-variable)]]
}
}
proc tixVariable:TraceProc {w name1 name2 op} {
upvar #0 $w data
set varname $data(-variable)
if {[catch {$w config -value [uplevel #0 [list set $varname]]} err]} {
uplevel #0 [list set $varname [list [$w cget -value]]]
error $err
}
return
}
proc tixVariable:DeleteVariable {w} {
upvar #0 $w data
# Must delete the trace command of the -variable
#
if {$data(-variable) != ""} {
uplevel #0 \
[list trace vdelete $data(-variable) w "tixVariable:TraceProc $w"]
}
}
|