summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-01-25 18:22:04 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-01-25 18:22:04 (GMT)
commit339966aea87195faf678c05a06895a0a2f9c65af (patch)
tree80bb0c008e169df663722d227f5f24bc18665bac
parentf59975d6eb39f7419c93e45392bab264f83ac352 (diff)
downloadtk-339966aea87195faf678c05a06895a0a2f9c65af.zip
tk-339966aea87195faf678c05a06895a0a2f9c65af.tar.gz
tk-339966aea87195faf678c05a06895a0a2f9c65af.tar.bz2
* library/bgerror.tcl: Updates to use Tcl 8.4 features. [Patch 1237759] * library/choosedir.tcl:
* library/comdlg.tcl: * library/console.tcl: * library/dialog.tcl: * library/focus.tcl: * library/msgbox.tcl: * library/palette.tcl: * library/tk.tcl: * library/tkfbox.tcl: * library/xmfbox.tcl:
-rw-r--r--ChangeLog14
-rw-r--r--library/bgerror.tcl17
-rw-r--r--library/choosedir.tcl17
-rw-r--r--library/comdlg.tcl15
-rw-r--r--library/console.tcl10
-rw-r--r--library/dialog.tcl17
-rw-r--r--library/focus.tcl6
-rw-r--r--library/msgbox.tcl15
-rw-r--r--library/palette.tcl22
-rw-r--r--library/tk.tcl12
-rw-r--r--library/tkfbox.tcl33
-rw-r--r--library/xmfbox.tcl15
12 files changed, 102 insertions, 91 deletions
diff --git a/ChangeLog b/ChangeLog
index 5aa2a08..552f5a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-01-25 Don Porter <dgp@users.sourceforge.net>
+
+ * library/bgerror.tcl: Updates to use Tcl 8.4 features. [Patch 1237759]
+ * library/choosedir.tcl:
+ * library/comdlg.tcl:
+ * library/console.tcl:
+ * library/dialog.tcl:
+ * library/focus.tcl:
+ * library/msgbox.tcl:
+ * library/palette.tcl:
+ * library/tk.tcl:
+ * library/tkfbox.tcl:
+ * library/xmfbox.tcl:
+
2006-01-23 Daniel Steffen <das@users.sourceforge.net>
* unix/configure: minor fix to Darwin specific code removing
diff --git a/library/bgerror.tcl b/library/bgerror.tcl
index a1837a2..05569c1 100644
--- a/library/bgerror.tcl
+++ b/library/bgerror.tcl
@@ -9,8 +9,8 @@
# Copyright (c) 1998-2000 by Ajuba Solutions.
# All rights reserved.
#
-# RCS: @(#) $Id: bgerror.tcl,v 1.29 2005/11/15 03:12:18 jenglish Exp $
-# $Id: bgerror.tcl,v 1.29 2005/11/15 03:12:18 jenglish Exp $
+# RCS: @(#) $Id: bgerror.tcl,v 1.30 2006/01/25 18:22:04 dgp Exp $
+# $Id: bgerror.tcl,v 1.30 2006/01/25 18:22:04 dgp Exp $
namespace eval ::tk::dialog::error {
namespace import -force ::tk::msgcat::*
@@ -88,7 +88,8 @@ proc ::tk::dialog::error::bgerror err {
# Ok the application's tkerror either failed or was not found
# we use the default dialog then :
- if {[tk windowingsystem] eq "aqua"} {
+ set windowingsystem [tk windowingsystem]
+ if {$windowingsystem eq "aqua"} {
set ok [mc Ok]
set messageFont system
set textRelief flat
@@ -130,20 +131,20 @@ proc ::tk::dialog::error::bgerror err {
# 1. Create the top-level window and divide it into top
# and bottom parts.
- catch {destroy .bgerrorDialog}
+ destroy .bgerrorDialog
toplevel .bgerrorDialog -class ErrorDialog
wm withdraw .bgerrorDialog
wm title .bgerrorDialog $title
wm iconname .bgerrorDialog ErrorDialog
wm protocol .bgerrorDialog WM_DELETE_WINDOW { }
- if {[tk windowingsystem] eq "aqua"} {
+ if {$windowingsystem eq "aqua"} {
::tk::unsupported::MacWindowStyle style .bgerrorDialog zoomDocProc
}
frame .bgerrorDialog.bot
frame .bgerrorDialog.top
- if {[tk windowingsystem] eq "x11"} {
+ if {$windowingsystem eq "x11"} {
.bgerrorDialog.bot configure -relief raised -bd 1
.bgerrorDialog.top configure -relief raised -bd 1
}
@@ -179,7 +180,7 @@ proc ::tk::dialog::error::bgerror err {
set wrapwidth [expr {$wrapwidth-60-[winfo pixels .bgerrorDialog 9m]}]
label .bgerrorDialog.msg -justify left -text $text -font $messageFont \
-wraplength $wrapwidth
- if {[tk windowingsystem] eq "aqua"} {
+ if {$windowingsystem eq "aqua"} {
# On the Macintosh, use the stop bitmap
label .bgerrorDialog.bitmap -bitmap stop
} else {
@@ -214,7 +215,7 @@ proc ::tk::dialog::error::bgerror err {
-padx 10
grid columnconfigure .bgerrorDialog.bot $i -weight 1
# We boost the size of some Mac buttons for l&f
- if {[tk windowingsystem] eq "aqua"} {
+ if {$windowingsystem eq "aqua"} {
if {($name eq "ok") || ($name eq "dismiss")} {
grid columnconfigure .bgerrorDialog.bot $i -minsize 79
}
diff --git a/library/choosedir.tcl b/library/choosedir.tcl
index 8403d97..d5165f6 100644
--- a/library/choosedir.tcl
+++ b/library/choosedir.tcl
@@ -5,7 +5,7 @@
# Copyright (c) 1998-2000 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: choosedir.tcl,v 1.18 2005/11/25 15:58:15 dkf Exp $
+# RCS: @(#) $Id: choosedir.tcl,v 1.19 2006/01/25 18:22:04 dgp Exp $
# Make sure the tk::dialog namespace, in which all dialogs should live, exists
namespace eval ::tk::dialog {}
@@ -71,7 +71,8 @@ proc ::tk::dialog::file::chooseDir:: {args} {
wm transient $w $data(-parent)
}
- trace variable data(selectPath) w [list ::tk::dialog::file::SetPath $w]
+ trace add variable data(selectPath) write \
+ [list ::tk::dialog::file::SetPath $w]
$data(dirMenuBtn) configure \
-textvariable ::tk::dialog::file::${dataName}(selectPath)
@@ -107,8 +108,8 @@ proc ::tk::dialog::file::chooseDir:: {args} {
# Cleanup traces on selectPath variable
#
- foreach trace [trace vinfo data(selectPath)] {
- trace vdelete data(selectPath) [lindex $trace 0] [lindex $trace 1]
+ foreach trace [trace info variable data(selectPath)] {
+ trace remove variable data(selectPath) [lindex $trace 0] [lindex $trace 1]
}
$data(dirMenuBtn) configure -textvariable {}
@@ -129,8 +130,8 @@ proc ::tk::dialog::file::chooseDir::Config {dataName argList} {
# last time the file dialog is used. The traces may cause troubles
# if the dialog is now used with a different -parent option.
#
- foreach trace [trace vinfo data(selectPath)] {
- trace vdelete data(selectPath) [lindex $trace 0] [lindex $trace 1]
+ foreach trace [trace info variable data(selectPath)] {
+ trace remove variable data(selectPath) [lindex $trace 0] [lindex $trace 1]
}
# 1: the configuration specs
@@ -153,7 +154,7 @@ proc ::tk::dialog::file::chooseDir::Config {dataName argList} {
#
tclParseConfigSpec ::tk::dialog::file::$dataName $specs "" $argList
- if {$data(-title) == ""} {
+ if {$data(-title) eq ""} {
set data(-title) "[mc "Choose Directory"]"
}
@@ -165,7 +166,7 @@ proc ::tk::dialog::file::chooseDir::Config {dataName argList} {
# 4: set the default directory and selection according to the -initial
# settings
#
- if {$data(-initialdir) != ""} {
+ if {$data(-initialdir) ne ""} {
# Ensure that initialdir is an absolute path name.
if {[file isdirectory $data(-initialdir)]} {
set old [pwd]
diff --git a/library/comdlg.tcl b/library/comdlg.tcl
index 0126ad4..dd8c599 100644
--- a/library/comdlg.tcl
+++ b/library/comdlg.tcl
@@ -3,7 +3,7 @@
# Some functions needed for the common dialog boxes. Probably need to go
# in a different file.
#
-# RCS: @(#) $Id: comdlg.tcl,v 1.12 2005/07/25 15:31:11 dgp Exp $
+# RCS: @(#) $Id: comdlg.tcl,v 1.13 2006/01/25 18:22:04 dgp Exp $
#
# Copyright (c) 1996 Sun Microsystems, Inc.
#
@@ -187,12 +187,7 @@ proc ::tk::FocusGroup_Destroy {t w} {
if {[info exists Priv(focus,$t)] && ($Priv(focus,$t) eq $w)} {
set Priv(focus,$t) ""
}
- catch {
- unset FocusIn($t,$w)
- }
- catch {
- unset FocusOut($t,$w)
- }
+ unset -nocomplain FocusIn($t,$w) FocusOut($t,$w)
}
}
@@ -285,7 +280,7 @@ proc ::tk::FDGetFileTypes {string} {
}
}
- set name "$label ("
+ set name "$label \("
set sep ""
set doAppend 1
foreach ext $fileTypes($label) {
@@ -305,9 +300,9 @@ proc ::tk::FDGetFileTypes {string} {
lappend exts $ext
set hasGotExt($label,$ext) 1
}
- set sep ,
+ set sep ","
}
- append name ")"
+ append name "\)"
lappend types [list $name $exts]
set hasDoneType($label) 1
diff --git a/library/console.tcl b/library/console.tcl
index 8035031..5ff9772 100644
--- a/library/console.tcl
+++ b/library/console.tcl
@@ -4,7 +4,7 @@
# can be used by non-unix systems that do not have built-in support
# for shells.
#
-# RCS: @(#) $Id: console.tcl,v 1.30 2005/11/30 01:24:48 hobbs Exp $
+# RCS: @(#) $Id: console.tcl,v 1.31 2006/01/25 18:22:04 dgp Exp $
#
# Copyright (c) 1995-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 Ajuba Solutions.
@@ -542,7 +542,7 @@ proc ::tk::ConsoleBind {w} {
}
bind PostConsole <KeyPress> {
- if {"%A" != ""} {
+ if {"%A" ne ""} {
::tk::console::TagProc %W
}
break
@@ -635,7 +635,7 @@ proc ::tk::console::TagProc w {
}
set exp "\[^\\\\\]\[\[ \t\n\r\;{}\"\$\]"
set i [$w search -backwards -regexp $exp insert-1c promptEnd-1c]
- if {$i == ""} {
+ if {$i eq ""} {
set i promptEnd
} else {
append i +2c
@@ -805,7 +805,7 @@ proc ::tk::console::ConstrainBuffer {w size} {
proc ::tk::console::Expand {w {type ""}} {
set exp "\[^\\\\\]\[\[ \t\n\r\\\{\"\\\\\$\]"
set tmp [$w search -backwards -regexp $exp insert-1c promptEnd-1c]
- if {$tmp == ""} {
+ if {$tmp eq ""} {
set tmp promptEnd
} else {
append tmp +2c
@@ -827,7 +827,7 @@ proc ::tk::console::Expand {w {type ""}} {
default {
set res {}
foreach t {Pathname Procname Variable} {
- if {![catch {Expand$t $str} res] && ($res != "")} {
+ if {![catch {Expand$t $str} res] && ($res ne "")} {
break
}
}
diff --git a/library/dialog.tcl b/library/dialog.tcl
index 92d9770..e4a1ec5 100644
--- a/library/dialog.tcl
+++ b/library/dialog.tcl
@@ -3,7 +3,7 @@
# This file defines the procedure tk_dialog, which creates a dialog
# box containing a bitmap, a message, and one or more buttons.
#
-# RCS: @(#) $Id: dialog.tcl,v 1.19 2005/10/05 04:14:10 hobbs Exp $
+# RCS: @(#) $Id: dialog.tcl,v 1.20 2006/01/25 18:22:04 dgp Exp $
#
# Copyright (c) 1992-1993 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
@@ -34,7 +34,7 @@ proc ::tk_dialog {w title text bitmap default args} {
variable ::tk::Priv
# Check that $default was properly given
- if {[string is int $default]} {
+ if {[string is integer -strict $default]} {
if {$default >= [llength $args]} {
return -code error "default button index greater than number of\
buttons specified for tk_dialog"
@@ -48,7 +48,7 @@ proc ::tk_dialog {w title text bitmap default args} {
# 1. Create the top-level window and divide it into top
# and bottom parts.
- catch {destroy $w}
+ destroy $w
toplevel $w -class Dialog
wm title $w $title
wm iconname $w Dialog
@@ -65,13 +65,14 @@ proc ::tk_dialog {w title text bitmap default args} {
wm transient $w [winfo toplevel [winfo parent $w]]
}
- if {[tk windowingsystem] eq "aqua"} {
+ set windowingsystem [tk windowingsystem]
+ if {$windowingsystem eq "aqua"} {
::tk::unsupported::MacWindowStyle style $w dBoxProc
}
frame $w.bot
frame $w.top
- if {[tk windowingsystem] eq "x11"} {
+ if {$windowingsystem eq "x11"} {
$w.bot configure -relief raised -bd 1
$w.top configure -relief raised -bd 1
}
@@ -84,7 +85,7 @@ proc ::tk_dialog {w title text bitmap default args} {
# overridden by the caller).
option add *Dialog.msg.wrapLength 3i widgetDefault
- if {[tk windowingsystem] eq "aqua"} {
+ if {$windowingsystem eq "aqua"} {
option add *Dialog.msg.font system widgetDefault
} else {
option add *Dialog.msg.font {Times 12} widgetDefault
@@ -93,7 +94,7 @@ proc ::tk_dialog {w title text bitmap default args} {
label $w.msg -justify left -text $text
pack $w.msg -in $w.top -side right -expand 1 -fill both -padx 3m -pady 3m
if {$bitmap ne ""} {
- if {[tk windowingsystem] eq "aqua" && $bitmap eq "error"} {
+ if {$windowingsystem eq "aqua" && $bitmap eq "error"} {
set bitmap "stop"
}
label $w.bitmap -bitmap $bitmap
@@ -114,7 +115,7 @@ proc ::tk_dialog {w title text bitmap default args} {
-padx 10 -pady 4
grid columnconfigure $w.bot $i
# We boost the size of some Mac buttons for l&f
- if {[tk windowingsystem] eq "aqua"} {
+ if {$windowingsystem eq "aqua"} {
set tmp [string tolower $but]
if {$tmp eq "ok" || $tmp eq "cancel"} {
grid columnconfigure $w.bot $i -minsize [expr {59 + 20}]
diff --git a/library/focus.tcl b/library/focus.tcl
index 5894e94..609a803 100644
--- a/library/focus.tcl
+++ b/library/focus.tcl
@@ -3,7 +3,7 @@
# This file defines several procedures for managing the input
# focus.
#
-# RCS: @(#) $Id: focus.tcl,v 1.10 2005/07/25 09:06:00 dkf Exp $
+# RCS: @(#) $Id: focus.tcl,v 1.11 2006/01/25 18:22:04 dgp Exp $
#
# Copyright (c) 1994-1995 Sun Microsystems, Inc.
#
@@ -130,14 +130,14 @@ proc ::tk_focusPrev w {
proc ::tk::FocusOK w {
set code [catch {$w cget -takefocus} value]
- if {($code == 0) && ($value != "")} {
+ if {($code == 0) && ($value ne "")} {
if {$value == 0} {
return 0
} elseif {$value == 1} {
return [winfo viewable $w]
} else {
set value [uplevel #0 $value [list $w]]
- if {$value != ""} {
+ if {$value ne ""} {
return $value
}
}
diff --git a/library/msgbox.tcl b/library/msgbox.tcl
index 365882d..3d8c62d 100644
--- a/library/msgbox.tcl
+++ b/library/msgbox.tcl
@@ -3,7 +3,7 @@
# Implements messageboxes for platforms that do not have native
# messagebox support.
#
-# RCS: @(#) $Id: msgbox.tcl,v 1.29 2004/08/05 10:04:36 dkf Exp $
+# RCS: @(#) $Id: msgbox.tcl,v 1.30 2006/01/25 18:22:04 dgp Exp $
#
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
#
@@ -158,7 +158,8 @@ proc ::tk::MessageBox {args} {
if {[lsearch -exact {info warning error question} $data(-icon)] == -1} {
error "bad -icon value \"$data(-icon)\": must be error, info, question, or warning"
}
- if {[tk windowingsystem] eq "aqua"} {
+ set windowingsystem [tk windowingsystem]
+ if {$windowingsystem eq "aqua"} {
switch -- $data(-icon) {
"error" {set data(-icon) "stop"}
"warning" {set data(-icon) "caution"}
@@ -216,7 +217,7 @@ proc ::tk::MessageBox {args} {
# If no default button was specified, the default default is the
# first button (Bug: 2218).
- if {$data(-default) == ""} {
+ if {$data(-default) eq ""} {
set data(-default) [lindex [lindex $buttons 0] 0]
}
@@ -262,7 +263,7 @@ proc ::tk::MessageBox {args} {
wm transient $w $data(-parent)
}
- if {[tk windowingsystem] eq "aqua"} {
+ if {$windowingsystem eq "aqua"} {
unsupported::MacWindowStyle style $w dBoxProc
}
@@ -271,7 +272,7 @@ proc ::tk::MessageBox {args} {
pack $w.bot -side bottom -fill both
frame $w.top -background $bg
pack $w.top -side top -fill both -expand 1
- if {[tk windowingsystem] ne "aqua"} {
+ if {$windowingsystem ne "aqua"} {
$w.bot configure -relief raised -bd 1
$w.top configure -relief raised -bd 1
}
@@ -282,7 +283,7 @@ proc ::tk::MessageBox {args} {
option add *Dialog.msg.wrapLength 3i widgetDefault
option add *Dialog.dtl.wrapLength 3i widgetDefault
- if {[tk windowingsystem] eq "aqua"} {
+ if {$windowingsystem eq "aqua"} {
option add *Dialog.msg.font system widgetDefault
option add *Dialog.dtl.font system widgetDefault
} else {
@@ -297,7 +298,7 @@ proc ::tk::MessageBox {args} {
-background $bg
}
if {$data(-icon) ne ""} {
- if {[tk windowingsystem] eq "aqua"
+ if {$windowingsystem eq "aqua"
|| ([winfo depth $w] < 4) || $tk_strictMotif} {
label $w.bitmap -bitmap $data(-icon) -background $bg
} else {
diff --git a/library/palette.tcl b/library/palette.tcl
index 0ec5b94..6e380d8 100644
--- a/library/palette.tcl
+++ b/library/palette.tcl
@@ -3,7 +3,7 @@
# This file contains procedures that change the color palette used
# by Tk.
#
-# RCS: @(#) $Id: palette.tcl,v 1.9 2005/07/25 09:06:00 dkf Exp $
+# RCS: @(#) $Id: palette.tcl,v 1.10 2006/01/25 18:22:04 dgp Exp $
#
# Copyright (c) 1995-1997 Sun Microsystems, Inc.
#
@@ -52,9 +52,11 @@ proc ::tk_setPalette {args} {
set new(foreground) white
}
}
- set fg [winfo rgb . $new(foreground)]
- set darkerBg [format #%02x%02x%02x [expr {(9*[lindex $bg 0])/2560}] \
- [expr {(9*[lindex $bg 1])/2560}] [expr {(9*[lindex $bg 2])/2560}]]
+ lassign [winfo rgb . $new(foreground)] fg_r fg_g fg_b
+ lassign $bg bg_r bg_g bg_b
+ set darkerBg [format #%02x%02x%02x [expr {(9*$bg_r)/2560}] \
+ [expr {(9*$bg_g)/2560}] [expr {(9*$bg_b)/2560}]]
+
foreach i {activeForeground insertBackground selectForeground \
highlightColor} {
if {![info exists new($i)]} {
@@ -63,9 +65,9 @@ proc ::tk_setPalette {args} {
}
if {![info exists new(disabledForeground)]} {
set new(disabledForeground) [format #%02x%02x%02x \
- [expr {(3*[lindex $bg 0] + [lindex $fg 0])/1024}] \
- [expr {(3*[lindex $bg 1] + [lindex $fg 1])/1024}] \
- [expr {(3*[lindex $bg 2] + [lindex $fg 2])/1024}]]
+ [expr {(3*$bg_r + $fg_r)/1024}] \
+ [expr {(3*$bg_g + $fg_g)/1024}] \
+ [expr {(3*$bg_b + $fg_b)/1024}]]
}
if {![info exists new(highlightBackground)]} {
set new(highlightBackground) $new(background)
@@ -76,8 +78,8 @@ proc ::tk_setPalette {args} {
# up by 15% or 1/3 of the way to full white, whichever is
# greater.
- foreach i {0 1 2} {
- set light($i) [expr {[lindex $bg $i]/256}]
+ foreach i {0 1 2} color $bg {
+ set light($i) [expr {$color/256}]
set inc1 [expr {($light($i)*15)/100}]
set inc2 [expr {(255-$light($i))/3}]
if {$inc1 > $inc2} {
@@ -128,7 +130,7 @@ proc ::tk_setPalette {args} {
eval [tk::RecolorTree . new]
- catch {destroy .___tk_set_palette}
+ destroy .___tk_set_palette
# Change the option database so that future windows will get the
# same colors.
diff --git a/library/tk.tcl b/library/tk.tcl
index a98fc82..ce3d937 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -3,7 +3,7 @@
# Initialization script normally executed in the interpreter for each
# Tk-based application. Arranges class bindings for widgets.
#
-# RCS: @(#) $Id: tk.tcl,v 1.55 2005/07/25 09:06:00 dkf Exp $
+# RCS: @(#) $Id: tk.tcl,v 1.56 2006/01/25 18:22:04 dgp Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
@@ -83,16 +83,16 @@ proc ::tk::PlaceWindow {w {place ""} {anchor ""}} {
set x [expr {([winfo screenwidth $w]-[winfo reqwidth $w])/2}]
set y [expr {([winfo screenheight $w]-[winfo reqheight $w])/2}]
set checkBounds 0
- } elseif {[string equal -len [string length $place] $place "pointer"]} {
+ } elseif {[string equal -length [string length $place] $place "pointer"]} {
## place at POINTER (centered if $anchor == center)
- if {[string equal -len [string length $anchor] $anchor "center"]} {
+ if {[string equal -length [string length $anchor] $anchor "center"]} {
set x [expr {[winfo pointerx $w]-[winfo reqwidth $w]/2}]
set y [expr {[winfo pointery $w]-[winfo reqheight $w]/2}]
} else {
set x [winfo pointerx $w]
set y [winfo pointery $w]
}
- } elseif {[string equal -len [string length $place] $place "widget"] && \
+ } elseif {[string equal -length [string length $place] $place "widget"] && \
[winfo exists $anchor] && [winfo ismapped $anchor]} {
## center about WIDGET $anchor, widget must be mapped
set x [expr {[winfo rootx $anchor] + \
@@ -363,7 +363,7 @@ switch -- [tk windowingsystem] {
# This seems to be correct on *some* HP systems.
catch { event add <<PrevWindow>> <hpBackTab> }
- trace variable ::tk_strictMotif w ::tk::EventMotifBindings
+ trace add variable ::tk_strictMotif write ::tk::EventMotifBindings
set ::tk_strictMotif $::tk_strictMotif
}
"win32" {
@@ -554,7 +554,7 @@ proc ::tk::FindAltKeyTarget {path char} {
#
proc ::tk::AltKeyInDialog {path key} {
set target [FindAltKeyTarget $path $key]
- if { $target == ""} return
+ if { $target eq ""} return
event generate $target <<AltUnderlined>>
}
diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl
index 83221ea..cbc63a1 100644
--- a/library/tkfbox.tcl
+++ b/library/tkfbox.tcl
@@ -11,7 +11,7 @@
# files by clicking on the file icons or by entering a filename
# in the "Filename:" entry.
#
-# RCS: @(#) $Id: tkfbox.tcl,v 1.54 2005/11/22 13:22:49 dkf Exp $
+# RCS: @(#) $Id: tkfbox.tcl,v 1.55 2006/01/25 18:22:04 dgp Exp $
#
# Copyright (c) 1994-1998 Sun Microsystems, Inc.
#
@@ -326,10 +326,7 @@ proc ::tk::IconList_DeleteAll {w} {
upvar ::tk::$w:itemList itemList
$data(canvas) delete all
- catch {unset data(selected)}
- catch {unset data(rect)}
- catch {unset data(list)}
- catch {unset itemList}
+ unset -nocomplain data(selected) data(rect) data(list) itemList
set data(maxIW) 1
set data(maxIH) 1
set data(maxTW) 1
@@ -478,7 +475,7 @@ proc ::tk::IconList_Arrange {w} {
proc ::tk::IconList_Invoke {w} {
upvar ::tk::$w data
- if {$data(-command) != "" && [llength $data(selection)]} {
+ if {$data(-command) ne "" && [llength $data(selection)]} {
uplevel #0 $data(-command)
}
}
@@ -529,7 +526,7 @@ proc ::tk::IconList_See {w rTag} {
set dispX $x1
}
- if {$oldDispX != $dispX} {
+ if {$oldDispX ne $dispX} {
set fraction [expr {double($dispX)/double($scrollW)}]
$data(canvas) xview moveto $fraction
}
@@ -775,7 +772,7 @@ proc ::tk::IconList_Goto {w text} {
proc ::tk::IconList_Reset {w} {
variable ::tk::Priv
- catch {unset Priv(ILAccel,$w)}
+ unset -nocomplain Priv(ILAccel,$w)
}
#----------------------------------------------------------------------
@@ -845,7 +842,7 @@ proc ::tk::dialog::file:: {type args} {
}
# Make sure subseqent uses of this dialog are independent [Bug 845189]
- catch {unset data(extUsed)}
+ unset -nocomplain data(extUsed)
# Dialog boxes should be transient with respect to their parent,
# so that they will always stay on top of their parent window. However,
@@ -861,7 +858,7 @@ proc ::tk::dialog::file:: {type args} {
# Add traces on the selectPath variable
#
- trace variable data(selectPath) w \
+ trace add variable data(selectPath) write \
[list ::tk::dialog::file::SetPath $w]
$data(dirMenuBtn) configure \
-textvariable ::tk::dialog::file::${dataName}(selectPath)
@@ -914,8 +911,8 @@ proc ::tk::dialog::file:: {type args} {
# Cleanup traces on selectPath variable
#
- foreach trace [trace vinfo data(selectPath)] {
- trace vdelete data(selectPath) [lindex $trace 0] [lindex $trace 1]
+ foreach trace [trace info variable data(selectPath)] {
+ trace remove variable data(selectPath) [lindex $trace 0] [lindex $trace 1]
}
$data(dirMenuBtn) configure -textvariable {}
@@ -935,8 +932,8 @@ proc ::tk::dialog::file::Config {dataName type argList} {
# last time the file dialog is used. The traces may cause troubles
# if the dialog is now used with a different -parent option.
- foreach trace [trace vinfo data(selectPath)] {
- trace vdelete data(selectPath) [lindex $trace 0] [lindex $trace 1]
+ foreach trace [trace info variable data(selectPath)] {
+ trace remove variable data(selectPath) [lindex $trace 0] [lindex $trace 1]
}
# 1: the configuration specs
@@ -979,7 +976,7 @@ proc ::tk::dialog::file::Config {dataName type argList} {
# 4: set the default directory and selection according to the -initial
# settings
#
- if {$data(-initialdir) != ""} {
+ if {$data(-initialdir) ne ""} {
# Ensure that initialdir is an absolute path name.
if {[file isdirectory $data(-initialdir)]} {
set old [pwd]
@@ -1240,7 +1237,7 @@ proc ::tk::dialog::file::Update {w} {
upvar ::tk::dialog::file::$dataName data
variable ::tk::Priv
global tk_library
- catch {unset data(updateId)}
+ unset -nocomplain data(updateId)
if {![info exists Priv(folderImage)]} {
set Priv(folderImage) [image create photo -data {
@@ -1356,9 +1353,9 @@ rSASvJTGhnhcV3EJlo3kh53ltF5nAhQAOw==}]
proc ::tk::dialog::file::SetPathSilently {w path} {
upvar ::tk::dialog::file::[winfo name $w] data
- trace vdelete data(selectPath) w [list ::tk::dialog::file::SetPath $w]
+ trace remove variable data(selectPath) write [list ::tk::dialog::file::SetPath $w]
set data(selectPath) $path
- trace variable data(selectPath) w [list ::tk::dialog::file::SetPath $w]
+ trace add variable data(selectPath) write [list ::tk::dialog::file::SetPath $w]
}
diff --git a/library/xmfbox.tcl b/library/xmfbox.tcl
index 7da9d82..472aeb7 100644
--- a/library/xmfbox.tcl
+++ b/library/xmfbox.tcl
@@ -4,7 +4,7 @@
# Unix platform. This implementation is used only if the
# "::tk_strictMotif" flag is set.
#
-# RCS: @(#) $Id: xmfbox.tcl,v 1.27 2005/07/25 09:05:59 dkf Exp $
+# RCS: @(#) $Id: xmfbox.tcl,v 1.28 2006/01/25 18:22:04 dgp Exp $
#
# Copyright (c) 1996 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 Scriptics Corporation
@@ -147,10 +147,10 @@ proc ::tk::MotifFDialog_FileTypes {w} {
upvar ::tk::dialog::file::[winfo name $w] data
set f $w.top.f3.types
- catch {destroy $f}
+ destroy $f
# No file types: use "*" as the filter and display no radio-buttons
- if {$data(-filetypes) == ""} {
+ if {$data(-filetypes) eq ""} {
set data(filter) *
return
}
@@ -168,7 +168,7 @@ proc ::tk::MotifFDialog_FileTypes {w} {
frame $f
set cnt 0
- if {$data(-filetypes) != {}} {
+ if {$data(-filetypes) ne {}} {
foreach type $data(-filetypes) {
set title [lindex [lindex $type 0] 0]
set filter [lindex $type 1]
@@ -887,8 +887,7 @@ proc ::tk::ListBoxKeyAccel_Unset {w} {
variable ::tk::Priv
catch {after cancel $Priv(lbAccel,$w,afterId)}
- catch {unset Priv(lbAccel,$w)}
- catch {unset Priv(lbAccel,$w,afterId)}
+ unset -nocomplain Priv(lbAccel,$w) Priv(lbAccel,$w,afterId)
}
# ::tk::ListBoxKeyAccel_Key--
@@ -908,7 +907,7 @@ proc ::tk::ListBoxKeyAccel_Unset {w} {
proc ::tk::ListBoxKeyAccel_Key {w key} {
variable ::tk::Priv
- if { $key == "" } {
+ if { $key eq "" } {
return
}
append Priv(lbAccel,$w) $key
@@ -950,7 +949,7 @@ proc ::tk::ListBoxKeyAccel_Goto {w string} {
proc ::tk::ListBoxKeyAccel_Reset {w} {
variable ::tk::Priv
- catch {unset Priv(lbAccel,$w)}
+ unset -nocomplain Priv(lbAccel,$w)
}
proc ::tk_getFileType {} {