/Lib/xml/

rel='shortcut icon' href='/favicon.ico'/>
summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2001-08-01 16:21:11 (GMT)
committerdgp <dgp@users.sourceforge.net>2001-08-01 16:21:11 (GMT)
commit98ea3cb2214b51432f38f6ea50c1c429397281cc (patch)
tree38846cbe94cc8aac068898282ced4624f130770e /library
parent7e9aececf720b6f0e20157366f8e977ad2378ddd (diff)
downloadtk-98ea3cb2214b51432f38f6ea50c1c429397281cc.zip
tk-98ea3cb2214b51432f38f6ea50c1c429397281cc.tar.gz
tk-98ea3cb2214b51432f38f6ea50c1c429397281cc.tar.bz2
Merged changes from feature branch dgp-privates-into-namespace,
implementing TIP 44. All Tk commands and variables matching tk[A-Z]* are now in the ::tk namespace.
Diffstat (limited to 'library')
-rw-r--r--library/bgerror.tcl10
-rw-r--r--library/button.tcl290
-rw-r--r--library/choosedir.tcl26
-rw-r--r--library/clrpick.tcl260
-rw-r--r--library/comdlg.tcl110
-rw-r--r--library/console.tcl124
-rw-r--r--library/dialog.tcl21
-rw-r--r--library/entry.tcl230
-rw-r--r--library/focus.tcl24
-rw-r--r--library/listbox.tcl156
-rw-r--r--library/menu.tcl474
-rw-r--r--library/msgbox.tcl21
-rw-r--r--library/optMenu.tcl6
-rw-r--r--library/palette.tcl31
-rw-r--r--library/scale.tcl122
-rw-r--r--library/scrlbar.tcl204
-rw-r--r--library/spinbox.tcl147
-rw-r--r--library/tclIndex447
-rw-r--r--library/tearoff.tcl14
-rw-r--r--library/text.tcl335
-rw-r--r--library/tk.tcl116
-rw-r--r--library/tkfbox.tcl404
-rw-r--r--library/unsupported.tcl286
-rw-r--r--library/xmfbox.tcl235
24 files changed, 2207 insertions, 1886 deletions
diff --git a/library/bgerror.tcl b/library/bgerror.tcl
index 9586518..13b0389 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.15 2001/06/14 10:56:58 dkf Exp $
-# $Id: bgerror.tcl,v 1.15 2001/06/14 10:56:58 dkf Exp $
+# RCS: @(#) $Id: bgerror.tcl,v 1.16 2001/08/01 16:21:11 dgp Exp $
+# $Id: bgerror.tcl,v 1.16 2001/08/01 16:21:11 dgp Exp $
option add *ErrorDialog.function.text [::msgcat::mc "Save To Log"] \
widgetDefault
@@ -73,7 +73,7 @@ proc ::tk::dialog::error::Destroy {w} {
}
}
-# bgerror --
+# ::bgerror --
# This is the default version of bgerror.
# It tries to execute tkerror, if that fails it posts a dialog box containing
# the error message and gives the user a chance to ask to see a stack
@@ -81,7 +81,7 @@ proc ::tk::dialog::error::Destroy {w} {
# Arguments:
# err - The error message.
-proc bgerror err {
+proc ::bgerror err {
global errorInfo tcl_platform
set butvar ::tk::dialog::error::button
@@ -262,7 +262,7 @@ proc bgerror err {
# may take the focus away so we can't redirect it. Finally,
# restore any grab that was in effect.
- tkwait variable $butvar
+ vwait $butvar
set button $::tk::dialog::error::button; # Save a copy...
catch {focus $oldFocus}
catch {destroy .bgerrorDialog}
diff --git a/library/button.tcl b/library/button.tcl
index 457b545..763c67e 100644
--- a/library/button.tcl
+++ b/library/button.tcl
@@ -4,7 +4,7 @@
# checkbutton, and radiobutton widgets and provides procedures
# that help in implementing those bindings.
#
-# RCS: @(#) $Id: button.tcl,v 1.10 2000/05/25 17:19:57 ericm Exp $
+# RCS: @(#) $Id: button.tcl,v 1.11 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
@@ -19,111 +19,111 @@
if {[string match "macintosh" $tcl_platform(platform)]} {
bind Radiobutton <Enter> {
- tkButtonEnter %W
+ tk::ButtonEnter %W
}
bind Radiobutton <1> {
- tkButtonDown %W
+ tk::ButtonDown %W
}
bind Radiobutton <ButtonRelease-1> {
- tkButtonUp %W
+ tk::ButtonUp %W
}
bind Checkbutton <Enter> {
- tkButtonEnter %W
+ tk::ButtonEnter %W
}
bind Checkbutton <1> {
- tkButtonDown %W
+ tk::ButtonDown %W
}
bind Checkbutton <ButtonRelease-1> {
- tkButtonUp %W
+ tk::ButtonUp %W
}
}
if {[string match "windows" $tcl_platform(platform)]} {
bind Checkbutton <equal> {
- tkCheckRadioInvoke %W select
+ tk::CheckRadioInvoke %W select
}
bind Checkbutton <plus> {
- tkCheckRadioInvoke %W select
+ tk::CheckRadioInvoke %W select
}
bind Checkbutton <minus> {
- tkCheckRadioInvoke %W deselect
+ tk::CheckRadioInvoke %W deselect
}
bind Checkbutton <1> {
- tkCheckRadioDown %W
+ tk::CheckRadioDown %W
}
bind Checkbutton <ButtonRelease-1> {
- tkButtonUp %W
+ tk::ButtonUp %W
}
bind Checkbutton <Enter> {
- tkCheckRadioEnter %W
+ tk::CheckRadioEnter %W
}
bind Radiobutton <1> {
- tkCheckRadioDown %W
+ tk::CheckRadioDown %W
}
bind Radiobutton <ButtonRelease-1> {
- tkButtonUp %W
+ tk::ButtonUp %W
}
bind Radiobutton <Enter> {
- tkCheckRadioEnter %W
+ tk::CheckRadioEnter %W
}
}
if {[string match "unix" $tcl_platform(platform)]} {
bind Checkbutton <Return> {
if {!$tk_strictMotif} {
- tkCheckRadioInvoke %W
+ tk::CheckRadioInvoke %W
}
}
bind Radiobutton <Return> {
if {!$tk_strictMotif} {
- tkCheckRadioInvoke %W
+ tk::CheckRadioInvoke %W
}
}
bind Checkbutton <1> {
- tkCheckRadioInvoke %W
+ tk::CheckRadioInvoke %W
}
bind Radiobutton <1> {
- tkCheckRadioInvoke %W
+ tk::CheckRadioInvoke %W
}
bind Checkbutton <Enter> {
- tkButtonEnter %W
+ tk::ButtonEnter %W
}
bind Radiobutton <Enter> {
- tkButtonEnter %W
+ tk::ButtonEnter %W
}
}
bind Button <space> {
- tkButtonInvoke %W
+ tk::ButtonInvoke %W
}
bind Checkbutton <space> {
- tkCheckRadioInvoke %W
+ tk::CheckRadioInvoke %W
}
bind Radiobutton <space> {
- tkCheckRadioInvoke %W
+ tk::CheckRadioInvoke %W
}
bind Button <FocusIn> {}
bind Button <Enter> {
- tkButtonEnter %W
+ tk::ButtonEnter %W
}
bind Button <Leave> {
- tkButtonLeave %W
+ tk::ButtonLeave %W
}
bind Button <1> {
- tkButtonDown %W
+ tk::ButtonDown %W
}
bind Button <ButtonRelease-1> {
- tkButtonUp %W
+ tk::ButtonUp %W
}
bind Checkbutton <FocusIn> {}
bind Checkbutton <Leave> {
- tkButtonLeave %W
+ tk::ButtonLeave %W
}
bind Radiobutton <FocusIn> {}
bind Radiobutton <Leave> {
- tkButtonLeave %W
+ tk::ButtonLeave %W
}
if {[string match "windows" $tcl_platform(platform)]} {
@@ -132,7 +132,7 @@ if {[string match "windows" $tcl_platform(platform)]} {
# Windows implementation
#########################
-# tkButtonEnter --
+# ::tk::ButtonEnter --
# The procedure below is invoked when the mouse pointer enters a
# button widget. It records the button we're in and changes the
# state of the button to active unless the button is disabled.
@@ -140,35 +140,35 @@ if {[string match "windows" $tcl_platform(platform)]} {
# Arguments:
# w - The name of the widget.
-proc tkButtonEnter w {
- global tkPriv
+proc ::tk::ButtonEnter w {
+ variable ::tk::Priv
if {[string compare [$w cget -state] "disabled"] } {
# If the mouse button is down, set the relief to sunken on entry.
# Overwise, if there's an -overrelief value, set the relief to that.
- if {[string equal $tkPriv(buttonWindow) $w]} {
+ if {[string equal $Priv(buttonWindow) $w]} {
$w configure -state active -relief sunken
} elseif { [string compare [$w cget -overrelief] ""] } {
- set tkPriv(relief) [$w cget -relief]
+ set Priv(relief) [$w cget -relief]
$w configure -relief [$w cget -overrelief]
}
}
- set tkPriv(window) $w
+ set Priv(window) $w
}
-# tkButtonLeave --
+# ::tk::ButtonLeave --
# The procedure below is invoked when the mouse pointer leaves a
# button widget. It changes the state of the button back to
# inactive. If we're leaving the button window with a mouse button
-# pressed (tkPriv(buttonWindow) == $w), restore the relief of the
+# pressed (Priv(buttonWindow) == $w), restore the relief of the
# button too.
#
# Arguments:
# w - The name of the widget.
-proc tkButtonLeave w {
- global tkPriv
+proc ::tk::ButtonLeave w {
+ variable ::tk::Priv
if {[string compare [$w cget -state] "disabled"]} {
$w configure -state normal
}
@@ -176,15 +176,15 @@ proc tkButtonLeave w {
# Restore the original button relief if the mouse button is down
# or there is an -overrelief value.
- if {[string equal $tkPriv(buttonWindow) $w] || \
+ if {[string equal $Priv(buttonWindow) $w] || \
[string compare [$w cget -overrelief] ""] } {
- $w configure -relief $tkPriv(relief)
+ $w configure -relief $Priv(relief)
}
- set tkPriv(window) ""
+ set Priv(window) ""
}
-# tkCheckRadioEnter --
+# ::tk::CheckRadioEnter --
# The procedure below is invoked when the mouse pointer enters a
# checkbutton or radiobutton widget. It records the button we're in
# and changes the state of the button to active unless the button is
@@ -193,21 +193,21 @@ proc tkButtonLeave w {
# Arguments:
# w - The name of the widget.
-proc tkCheckRadioEnter w {
- global tkPriv
+proc ::tk::CheckRadioEnter w {
+ variable ::tk::Priv
if {[string compare [$w cget -state] "disabled"]} {
- if {[string equal $tkPriv(buttonWindow) $w]} {
+ if {[string equal $Priv(buttonWindow) $w]} {
$w configure -state active
}
if { [string compare [$w cget -overrelief] ""] } {
- set tkPriv(relief) [$w cget -relief]
+ set Priv(relief) [$w cget -relief]
$w configure -relief [$w cget -overrelief]
}
}
- set tkPriv(window) $w
+ set Priv(window) $w
}
-# tkButtonDown --
+# ::tk::ButtonDown --
# The procedure below is invoked when the mouse button is pressed in
# a button widget. It records the fact that the mouse is in the button,
# saves the button's relief so it can be restored later, and changes
@@ -216,31 +216,31 @@ proc tkCheckRadioEnter w {
# Arguments:
# w - The name of the widget.
-proc tkButtonDown w {
- global tkPriv
+proc ::tk::ButtonDown w {
+ variable ::tk::Priv
# Only save the button's relief if it has no -overrelief value. If there
- # is an overrelief setting, tkPriv(relief) will already have been set, and
+ # is an overrelief setting, Priv(relief) will already have been set, and
# the current value of the -relief option will be incorrect.
if { [string equal [$w cget -overrelief] ""] } {
- set tkPriv(relief) [$w cget -relief]
+ set Priv(relief) [$w cget -relief]
}
if {[string compare [$w cget -state] "disabled"]} {
- set tkPriv(buttonWindow) $w
+ set Priv(buttonWindow) $w
$w configure -relief sunken -state active
# If this button has a repeatdelay set up, get it going with an after
- after cancel $tkPriv(afterId)
+ after cancel $Priv(afterId)
set delay [$w cget -repeatdelay]
- set tkPriv(repeated) 0
+ set Priv(repeated) 0
if {$delay > 0} {
- set tkPriv(afterId) [after $delay [list tkButtonAutoInvoke $w]]
+ set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
}
}
}
-# tkCheckRadioDown --
+# ::tk::CheckRadioDown --
# The procedure below is invoked when the mouse button is pressed in
# a button widget. It records the fact that the mouse is in the button,
# saves the button's relief so it can be restored later, and changes
@@ -249,19 +249,19 @@ proc tkButtonDown w {
# Arguments:
# w - The name of the widget.
-proc tkCheckRadioDown w {
- global tkPriv
+proc ::tk::CheckRadioDown w {
+ variable ::tk::Priv
if { [string equal [$w cget -overrelief] ""] } {
- set tkPriv(relief) [$w cget -relief]
+ set Priv(relief) [$w cget -relief]
}
if {[string compare [$w cget -state] "disabled"]} {
- set tkPriv(buttonWindow) $w
- set tkPriv(repeated) 0
+ set Priv(buttonWindow) $w
+ set Priv(repeated) 0
$w configure -state active
}
}
-# tkButtonUp --
+# ::tk::ButtonUp --
# The procedure below is invoked when the mouse button is released
# in a button widget. It restores the button's relief and invokes
# the command as long as the mouse hasn't left the button.
@@ -269,10 +269,10 @@ proc tkCheckRadioDown w {
# Arguments:
# w - The name of the widget.
-proc tkButtonUp w {
- global tkPriv
- if {[string equal $tkPriv(buttonWindow) $w]} {
- set tkPriv(buttonWindow) ""
+proc ::tk::ButtonUp w {
+ variable ::tk::Priv
+ if {[string equal $Priv(buttonWindow) $w]} {
+ set Priv(buttonWindow) ""
# Restore the button's relief. If there is no overrelief, the
# button relief goes back to its original value. If there is an
# overrelief, the relief goes to the overrelief (since the cursor is
@@ -280,21 +280,21 @@ proc tkButtonUp w {
set relief [$w cget -overrelief]
if { [string equal $relief ""] } {
- set relief $tkPriv(relief)
+ set relief $Priv(relief)
}
$w configure -relief $relief
# Clean up the after event from the auto-repeater
- after cancel $tkPriv(afterId)
+ after cancel $Priv(afterId)
- if {[string equal $tkPriv(window) $w]
+ if {[string equal $Priv(window) $w]
&& [string compare [$w cget -state] "disabled"]} {
$w configure -state normal
# Only invoke the command if it wasn't already invoked by the
# auto-repeater functionality
- if { $tkPriv(repeated) == 0 } {
+ if { $Priv(repeated) == 0 } {
uplevel #0 [list $w invoke]
}
}
@@ -309,7 +309,7 @@ if {[string match "unix" $tcl_platform(platform)]} {
# Unix implementation
#####################
-# tkButtonEnter --
+# ::tk::ButtonEnter --
# The procedure below is invoked when the mouse pointer enters a
# button widget. It records the button we're in and changes the
# state of the button to active unless the button is disabled.
@@ -317,37 +317,37 @@ if {[string match "unix" $tcl_platform(platform)]} {
# Arguments:
# w - The name of the widget.
-proc tkButtonEnter {w} {
- global tkPriv
+proc ::tk::ButtonEnter {w} {
+ variable ::tk::Priv
if {[string compare [$w cget -state] "disabled"]} {
$w configure -state active
# If the mouse button is down, set the relief to sunken on entry.
# Overwise, if there's an -overrelief value, set the relief to that.
- if {[string equal $tkPriv(buttonWindow) $w]} {
+ if {[string equal $Priv(buttonWindow) $w]} {
$w configure -state active -relief sunken
} elseif { [string compare [$w cget -overrelief] ""] } {
- set tkPriv(relief) [$w cget -relief]
+ set Priv(relief) [$w cget -relief]
$w configure -relief [$w cget -overrelief]
}
}
- set tkPriv(window) $w
+ set Priv(window) $w
}
-# tkButtonLeave --
+# ::tk::ButtonLeave --
# The procedure below is invoked when the mouse pointer leaves a
# button widget. It changes the state of the button back to
# inactive. If we're leaving the button window with a mouse button
-# pressed (tkPriv(buttonWindow) == $w), restore the relief of the
+# pressed (Priv(buttonWindow) == $w), restore the relief of the
# button too.
#
# Arguments:
# w - The name of the widget.
-proc tkButtonLeave w {
- global tkPriv
+proc ::tk::ButtonLeave w {
+ variable ::tk::Priv
if {[string compare [$w cget -state] "disabled"]} {
$w configure -state normal
}
@@ -355,15 +355,15 @@ proc tkButtonLeave w {
# Restore the original button relief if the mouse button is down
# or there is an -overrelief value.
- if {[string equal $tkPriv(buttonWindow) $w] || \
+ if {[string equal $Priv(buttonWindow) $w] || \
[string compare [$w cget -overrelief] ""] } {
- $w configure -relief $tkPriv(relief)
+ $w configure -relief $Priv(relief)
}
- set tkPriv(window) ""
+ set Priv(window) ""
}
-# tkButtonDown --
+# ::tk::ButtonDown --
# The procedure below is invoked when the mouse button is pressed in
# a button widget. It records the fact that the mouse is in the button,
# saves the button's relief so it can be restored later, and changes
@@ -372,32 +372,32 @@ proc tkButtonLeave w {
# Arguments:
# w - The name of the widget.
-proc tkButtonDown w {
- global tkPriv
+proc ::tk::ButtonDown w {
+ variable ::tk::Priv
# Only save the button's relief if it has no -overrelief value. If there
- # is an overrelief setting, tkPriv(relief) will already have been set, and
+ # is an overrelief setting, Priv(relief) will already have been set, and
# the current value of the -relief option will be incorrect.
if { [string equal [$w cget -overrelief] ""] } {
- set tkPriv(relief) [$w cget -relief]
+ set Priv(relief) [$w cget -relief]
}
if {[string compare [$w cget -state] "disabled"]} {
- set tkPriv(buttonWindow) $w
+ set Priv(buttonWindow) $w
$w configure -relief sunken
# If this button has a repeatdelay set up, get it going with an after
- after cancel $tkPriv(afterId)
+ after cancel $Priv(afterId)
set delay [$w cget -repeatdelay]
- set tkPriv(repeated) 0
+ set Priv(repeated) 0
if {$delay > 0} {
- set tkPriv(afterId) [after $delay [list tkButtonAutoInvoke $w]]
+ set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
}
}
}
-# tkButtonUp --
+# ::tk::ButtonUp --
# The procedure below is invoked when the mouse button is released
# in a button widget. It restores the button's relief and invokes
# the command as long as the mouse hasn't left the button.
@@ -405,10 +405,10 @@ proc tkButtonDown w {
# Arguments:
# w - The name of the widget.
-proc tkButtonUp w {
- global tkPriv
- if {[string equal $w $tkPriv(buttonWindow)]} {
- set tkPriv(buttonWindow) ""
+proc ::tk::ButtonUp w {
+ variable ::tk::Priv
+ if {[string equal $w $Priv(buttonWindow)]} {
+ set Priv(buttonWindow) ""
# Restore the button's relief. If there is no overrelief, the
# button relief goes back to its original value. If there is an
@@ -417,19 +417,19 @@ proc tkButtonUp w {
set relief [$w cget -overrelief]
if { [string equal $relief ""] } {
- set relief $tkPriv(relief)
+ set relief $Priv(relief)
}
$w configure -relief $relief
# Clean up the after event from the auto-repeater
- after cancel $tkPriv(afterId)
+ after cancel $Priv(afterId)
- if {[string equal $w $tkPriv(window)] \
+ if {[string equal $w $Priv(window)] \
&& [string compare [$w cget -state] "disabled"]} {
# Only invoke the command if it wasn't already invoked by the
# auto-repeater functionality
- if { $tkPriv(repeated) == 0 } {
+ if { $Priv(repeated) == 0 } {
uplevel #0 [list $w invoke]
}
}
@@ -444,7 +444,7 @@ if {[string match "macintosh" $tcl_platform(platform)]} {
# Mac implementation
####################
-# tkButtonEnter --
+# ::tk::ButtonEnter --
# The procedure below is invoked when the mouse pointer enters a
# button widget. It records the button we're in and changes the
# state of the button to active unless the button is disabled.
@@ -452,41 +452,41 @@ if {[string match "macintosh" $tcl_platform(platform)]} {
# Arguments:
# w - The name of the widget.
-proc tkButtonEnter {w} {
- global tkPriv
+proc ::tk::ButtonEnter {w} {
+ variable ::tk::Priv
if {[string compare [$w cget -state] "disabled"]} {
- if {[string equal $w $tkPriv(buttonWindow)]} {
+ if {[string equal $w $Priv(buttonWindow)]} {
$w configure -state active
} elseif { [string compare [$w cget -overrelief] ""] } {
- set tkPriv(relief) [$w cget -relief]
+ set Priv(relief) [$w cget -relief]
$w configure -relief [$w cget -overrelief]
}
}
- set tkPriv(window) $w
+ set Priv(window) $w
}
-# tkButtonLeave --
+# ::tk::ButtonLeave --
# The procedure below is invoked when the mouse pointer leaves a
# button widget. It changes the state of the button back to
# inactive. If we're leaving the button window with a mouse button
-# pressed (tkPriv(buttonWindow) == $w), restore the relief of the
+# pressed (Priv(buttonWindow) == $w), restore the relief of the
# button too.
#
# Arguments:
# w - The name of the widget.
-proc tkButtonLeave w {
- global tkPriv
- if {[string equal $w $tkPriv(buttonWindow)]} {
+proc ::tk::ButtonLeave w {
+ variable ::tk::Priv
+ if {[string equal $w $Priv(buttonWindow)]} {
$w configure -state normal
}
if { [string compare [$w cget -overrelief] ""] } {
- $w configure -relief $tkPriv(relief)
+ $w configure -relief $Priv(relief)
}
- set tkPriv(window) ""
+ set Priv(window) ""
}
-# tkButtonDown --
+# ::tk::ButtonDown --
# The procedure below is invoked when the mouse button is pressed in
# a button widget. It records the fact that the mouse is in the button,
# saves the button's relief so it can be restored later, and changes
@@ -495,26 +495,26 @@ proc tkButtonLeave w {
# Arguments:
# w - The name of the widget.
-proc tkButtonDown w {
- global tkPriv
+proc ::tk::ButtonDown w {
+ variable ::tk::Priv
if {[string compare [$w cget -state] "disabled"]} {
- set tkPriv(buttonWindow) $w
+ set Priv(buttonWindow) $w
$w configure -state active
# If this button has a repeatdelay set up, get it going with an after
- after cancel $tkPriv(afterId)
+ after cancel $Priv(afterId)
if { ![catch {$w cget -repeatdelay} delay] } {
set delay [$w cget -repeatdelay]
- set tkPriv(repeated) 0
+ set Priv(repeated) 0
if {$delay > 0} {
- set tkPriv(afterId) [after $delay [list tkButtonAutoInvoke $w]]
+ set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
}
}
}
}
-# tkButtonUp --
+# ::tk::ButtonUp --
# The procedure below is invoked when the mouse button is released
# in a button widget. It restores the button's relief and invokes
# the command as long as the mouse hasn't left the button.
@@ -522,24 +522,24 @@ proc tkButtonDown w {
# Arguments:
# w - The name of the widget.
-proc tkButtonUp w {
- global tkPriv
- if {[string equal $w $tkPriv(buttonWindow)]} {
+proc ::tk::ButtonUp w {
+ variable ::tk::Priv
+ if {[string equal $w $Priv(buttonWindow)]} {
$w configure -state normal
- set tkPriv(buttonWindow) ""
+ set Priv(buttonWindow) ""
if { [string compare [$w cget -overrelief] ""] } {
$w configure -relief [$w cget -overrelief]
}
# Clean up the after event from the auto-repeater
- after cancel $tkPriv(afterId)
+ after cancel $Priv(afterId)
- if {[string equal $w $tkPriv(window)]
+ if {[string equal $w $Priv(window)]
&& [string compare [$w cget -state] "disabled"]} {
# Only invoke the command if it wasn't already invoked by the
# auto-repeater functionality
- if { $tkPriv(repeated) == 0 } {
+ if { $Priv(repeated) == 0 } {
uplevel #0 [list $w invoke]
}
}
@@ -552,14 +552,14 @@ proc tkButtonUp w {
# Shared routines
##################
-# tkButtonInvoke --
+# ::tk::ButtonInvoke --
# The procedure below is called when a button is invoked through
# the keyboard. It simulate a press of the button via the mouse.
#
# Arguments:
# w - The name of the widget.
-proc tkButtonInvoke w {
+proc ::tk::ButtonInvoke w {
if {[string compare [$w cget -state] "disabled"]} {
set oldRelief [$w cget -relief]
set oldState [$w cget -state]
@@ -571,7 +571,7 @@ proc tkButtonInvoke w {
}
}
-# tkButtonAutoInvoke --
+# ::tk::ButtonAutoInvoke --
#
# Invoke an auto-repeating button, and set it up to continue to repeat.
#
@@ -582,22 +582,22 @@ proc tkButtonInvoke w {
# None.
#
# Side effects:
-# May create an after event to call tkButtonAutoInvoke.
+# May create an after event to call ::tk::ButtonAutoInvoke.
-proc tkButtonAutoInvoke {w} {
- global tkPriv
- after cancel $tkPriv(afterId)
+proc ::tk::ButtonAutoInvoke {w} {
+ variable ::tk::Priv
+ after cancel $Priv(afterId)
set delay [$w cget -repeatinterval]
- if { [string equal $tkPriv(window) $w] } {
- incr tkPriv(repeated)
+ if { [string equal $Priv(window) $w] } {
+ incr Priv(repeated)
uplevel #0 [list $w invoke]
}
if {$delay > 0} {
- set tkPriv(afterId) [after $delay [list tkButtonAutoInvoke $w]]
+ set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
}
}
-# tkCheckRadioInvoke --
+# ::tk::CheckRadioInvoke --
# The procedure below is invoked when the mouse button is pressed in
# a checkbutton or radiobutton widget, or when the widget is invoked
# through the keyboard. It invokes the widget if it
@@ -607,7 +607,7 @@ proc tkButtonAutoInvoke {w} {
# w - The name of the widget.
# cmd - The subcommand to invoke (one of invoke, select, or deselect).
-proc tkCheckRadioInvoke {w {cmd invoke}} {
+proc ::tk::CheckRadioInvoke {w {cmd invoke}} {
if {[string compare [$w cget -state] "disabled"]} {
uplevel #0 [list $w $cmd]
}
diff --git a/library/choosedir.tcl b/library/choosedir.tcl
index d9aa79d..ee4dfb1 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.9 2000/06/30 06:38:38 ericm Exp $
+# RCS: @(#) $Id: choosedir.tcl,v 1.10 2001/08/01 16:21:11 dgp Exp $
# Make sure the tk::dialog namespace, in which all dialogs should live, exists
namespace eval ::tk::dialog {}
@@ -15,15 +15,15 @@ namespace eval ::tk::dialog::file {}
namespace eval ::tk::dialog::file::chooseDir {
}
-# ::tk::dialog::file::tkChooseDirectory --
+# ::tk::dialog::file::chooseDir:: --
#
# Implements the TK directory selection dialog.
#
# Arguments:
# args Options parsed by the procedure.
#
-proc ::tk::dialog::file::chooseDir::tkChooseDirectory {args} {
- global tkPriv
+proc ::tk::dialog::file::chooseDir:: {args} {
+ variable ::tk::Priv
set dataName __tk_choosedir
upvar ::tk::dialog::file::$dataName data
::tk::dialog::file::chooseDir::Config $dataName $args
@@ -81,7 +81,7 @@ proc ::tk::dialog::file::chooseDir::tkChooseDirectory {args} {
# may take the focus away so we can't redirect it. Finally,
# restore any grab that was in effect.
- tkwait variable tkPriv(selectFilePath)
+ vwait ::tk::Priv(selectFilePath)
::tk::RestoreFocusGrab $w $data(ent) withdraw
@@ -96,7 +96,7 @@ proc ::tk::dialog::file::chooseDir::tkChooseDirectory {args} {
# Return value to user
#
- return $tkPriv(selectFilePath)
+ return $Priv(selectFilePath)
}
# ::tk::dialog::file::chooseDir::Config --
@@ -182,9 +182,9 @@ proc ::tk::dialog::file::chooseDir::OkCmd {w} {
# 4b. If the value is different from the current directory, change to
# that directory.
- set selection [tkIconList_Curselection $data(icons)]
+ set selection [tk::IconList_Curselection $data(icons)]
if { [llength $selection] != 0 } {
- set iconText [tkIconList_Get $data(icons) [lindex $selection 0]]
+ set iconText [tk::IconList_Get $data(icons) [lindex $selection 0]]
set iconText [file join $data(selectPath) $iconText]
::tk::dialog::file::chooseDir::Done $w $iconText
} else {
@@ -220,9 +220,9 @@ proc ::tk::dialog::file::chooseDir::OkCmd {w} {
proc ::tk::dialog::file::chooseDir::DblClick {w} {
upvar ::tk::dialog::file::[winfo name $w] data
- set selection [tkIconList_Curselection $data(icons)]
+ set selection [tk::IconList_Curselection $data(icons)]
if { [llength $selection] != 0 } {
- set text [tkIconList_Get $data(icons) [lindex $selection 0]]
+ set text [tk::IconList_Get $data(icons) [lindex $selection 0]]
set file $data(selectPath)
if {[file isdirectory $file]} {
::tk::dialog::file::ListInvoke $w $text
@@ -250,13 +250,13 @@ proc ::tk::dialog::file::chooseDir::ListBrowse {w text} {
#
# Gets called when user has input a valid filename. Pops up a
# dialog box to confirm selection when necessary. Sets the
-# tkPriv(selectFilePath) variable, which will break the "tkwait"
+# Priv(selectFilePath) variable, which will break the "vwait"
# loop in tk_chooseDirectory and return the selected filename to the
# script that calls tk_getOpenFile or tk_getSaveFile
#
proc ::tk::dialog::file::chooseDir::Done {w {selectFilePath ""}} {
upvar ::tk::dialog::file::[winfo name $w] data
- global tkPriv
+ variable ::tk::Priv
if {[string equal $selectFilePath ""]} {
set selectFilePath $data(selectPath)
@@ -267,5 +267,5 @@ proc ::tk::dialog::file::chooseDir::Done {w {selectFilePath ""}} {
return
}
}
- set tkPriv(selectFilePath) $selectFilePath
+ set Priv(selectFilePath) $selectFilePath
}
diff --git a/library/clrpick.tcl b/library/clrpick.tcl
index 2cc74f1..bb3d6b2 100644
--- a/library/clrpick.tcl
+++ b/library/clrpick.tcl
@@ -3,7 +3,7 @@
# Color selection dialog for platforms that do not support a
# standard color selection dialog.
#
-# RCS: @(#) $Id: clrpick.tcl,v 1.12 2001/06/14 10:56:58 dkf Exp $
+# RCS: @(#) $Id: clrpick.tcl,v 1.13 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1996 Sun Microsystems, Inc.
#
@@ -17,16 +17,22 @@
# (2): Implement HSV color selection.
#
-# tkColorDialog --
+# Make sure namespaces exist
+namespace eval ::tk {}
+namespace eval ::tk::dialog {}
+namespace eval ::tk::dialog::color {}
+
+# ::tk::dialog::color:: --
#
# Create a color dialog and let the user choose a color. This function
# should not be called directly. It is called by the tk_chooseColor
# function when a native color selector widget does not exist
#
-proc tkColorDialog {args} {
- global tkPriv
- set w .__tk__color
- upvar #0 $w data
+proc ::tk::dialog::color:: {args} {
+ variable ::tk::Priv
+ set dataName __tk__color
+ upvar ::tk::dialog::color::$dataName data
+ set w .$dataName
# The lines variables track the start and end indices of the line
# elements in the colorbar canvases.
@@ -56,8 +62,8 @@ proc tkColorDialog {args} {
# selection rectangle at the bottom of the color bar. No restrictions.
set data(PLGN_WIDTH) 10
- tkColorDialog_Config $w $args
- tkColorDialog_InitValues $w
+ Config $dataName $args
+ InitValues $dataName
set sc [winfo screen $data(-parent)]
set winExists [winfo exists $w]
@@ -65,8 +71,8 @@ proc tkColorDialog {args} {
if {$winExists} {
destroy $w
}
- toplevel $w -class tkColorDialog -screen $sc
- tkColorDialog_BuildDialog $w
+ toplevel $w -class TkColorDialog -screen $sc
+ BuildDialog $w
}
wm transient $w $data(-parent)
@@ -88,19 +94,19 @@ proc tkColorDialog {args} {
# may take the focus away so we can't redirect it. Finally,
# restore any grab that was in effect.
- vwait tkPriv(selectColor)
+ vwait ::tk::Priv(selectColor)
::tk::RestoreFocusGrab $w $data(okBtn)
unset data
- return $tkPriv(selectColor)
+ return $Priv(selectColor)
}
-# tkColorDialog_InitValues --
+# ::tk::dialog::color::InitValues --
#
# Get called during initialization or when user resets NUM_COLORBARS
#
-proc tkColorDialog_InitValues {w} {
- upvar #0 $w data
+proc ::tk::dialog::color::InitValues {dataName} {
+ upvar ::tk::dialog::color::$dataName data
# IntensityIncr is the difference in color intensity between a colorbar
# and its neighbors.
@@ -144,19 +150,19 @@ proc tkColorDialog_InitValues {w} {
set data(blue,intensity) [expr {[lindex $rgb 2]/0x100}]
}
-# tkColorDialog_Config --
+# ::tk::dialog::color::Config --
#
# Parses the command line arguments to tk_chooseColor
#
-proc tkColorDialog_Config {w argList} {
- global tkPriv
- upvar #0 $w data
+proc ::tk::dialog::color::Config {dataName argList} {
+ variable ::tk::Priv
+ upvar ::tk::dialog::color::$dataName data
# 1: the configuration specs
#
- if {[info exists tkPriv(selectColor)] && \
- [string compare $tkPriv(selectColor) ""]} {
- set defaultColor $tkPriv(selectColor)
+ if {[info exists Priv(selectColor)] && \
+ [string compare $Priv(selectColor) ""]} {
+ set defaultColor $Priv(selectColor)
} else {
set defaultColor [. cget -background]
}
@@ -169,7 +175,7 @@ proc tkColorDialog_Config {w argList} {
# 2: parse the arguments
#
- tclParseConfigSpec $w $specs "" $argList
+ tclParseConfigSpec ::tk::dialog::color::$dataName $specs "" $argList
if {[string equal $data(-title) ""]} {
set data(-title) " "
@@ -183,12 +189,12 @@ proc tkColorDialog_Config {w argList} {
}
}
-# tkColorDialog_BuildDialog --
+# ::tk::dialog::color::BuildDialog --
#
# Build the dialog.
#
-proc tkColorDialog_BuildDialog {w} {
- upvar #0 $w data
+proc ::tk::dialog::color::BuildDialog {w} {
+ upvar ::tk::dialog::color::[winfo name $w] data
# TopFrame contains the color strips and the color selection
#
@@ -212,8 +218,9 @@ proc tkColorDialog_BuildDialog {w} {
set box [frame $f.box]
label $box.label -text $l: -width $maxWidth -under 0 -anchor ne
- entry $box.entry -textvariable [format %s $w]($color,intensity) \
- -width 4
+ entry $box.entry -textvariable \
+ ::tk::dialog::color::[winfo name $w]($color,intensity) \
+ -width 4
pack $box.label -side left -fill y -padx 2 -pady 3
pack $box.entry -side left -anchor n -pady 0
pack $box -side left -fill both
@@ -236,18 +243,18 @@ proc tkColorDialog_BuildDialog {w} {
set data($color,sel) $f.sel
bind $data($color,col) <Configure> \
- [list tkColorDialog_DrawColorScale $w $color 1]
+ [list tk::dialog::color::DrawColorScale $w $color 1]
bind $data($color,col) <Enter> \
- [list tkColorDialog_EnterColorBar $w $color]
+ [list tk::dialog::color::EnterColorBar $w $color]
bind $data($color,col) <Leave> \
- [list tkColorDialog_LeaveColorBar $w $color]
+ [list tk::dialog::color::LeaveColorBar $w $color]
bind $data($color,sel) <Enter> \
- [list tkColorDialog_EnterColorBar $w $color]
+ [list tk::dialog::color::EnterColorBar $w $color]
bind $data($color,sel) <Leave> \
- [list tkColorDialog_LeaveColorBar $w $color]
+ [list tk::dialog::color::LeaveColorBar $w $color]
- bind $box.entry <Return> [list tkColorDialog_HandleRGBEntry $w]
+ bind $box.entry <Return> [list tk::dialog::color::HandleRGBEntry $w]
}
pack $stripsFrame -side left -fill both -padx 4 -pady 10
@@ -258,7 +265,8 @@ proc tkColorDialog_BuildDialog {w} {
set selFrame [frame $topFrame.sel]
set lab [label $selFrame.lab -text [::msgcat::mc "Selection:"] \
-under 0 -anchor sw]
- set ent [entry $selFrame.ent -textvariable [format %s $w](selection) \
+ set ent [entry $selFrame.ent \
+ -textvariable ::tk::dialog::color::[winfo name $w](selection) \
-width 16]
set f1 [frame $selFrame.f1 -relief sunken -bd 2]
set data(finalCanvas) [frame $f1.demo -bd 0 -width 100 -height 70]
@@ -267,7 +275,7 @@ proc tkColorDialog_BuildDialog {w} {
pack $f1 -expand yes -anchor nw -fill both -padx 6 -pady 10
pack $data(finalCanvas) -expand yes -fill both
- bind $ent <Return> [list tkColorDialog_HandleSelEntry $w]
+ bind $ent <Return> [list tk::dialog::color::HandleSelEntry $w]
pack $selFrame -side left -fill none -anchor nw
pack $topFrame -side top -expand yes -fill both -anchor nw
@@ -279,10 +287,10 @@ proc tkColorDialog_BuildDialog {w} {
set maxWidth [expr {$maxWidth<8?8:$maxWidth}]
button $botFrame.ok -text [::msgcat::mc "OK"] \
-width $maxWidth -under 0 \
- -command [list tkColorDialog_OkCmd $w]
+ -command [list tk::dialog::color::OkCmd $w]
button $botFrame.cancel -text [::msgcat::mc "Cancel"] \
-width $maxWidth -under 0 \
- -command [list tkColorDialog_CancelCmd $w]
+ -command [list tk::dialog::color::CancelCmd $w]
set data(okBtn) $botFrame.ok
set data(cancelBtn) $botFrame.cancel
@@ -298,62 +306,61 @@ proc tkColorDialog_BuildDialog {w} {
bind $w <Alt-g> [list focus $data(green,entry)]
bind $w <Alt-b> [list focus $data(blue,entry)]
bind $w <Alt-s> [list focus $ent]
- bind $w <KeyPress-Escape> [list tkButtonInvoke $data(cancelBtn)]
- bind $w <Alt-c> [list tkButtonInvoke $data(cancelBtn)]
- bind $w <Alt-o> [list tkButtonInvoke $data(okBtn)]
+ bind $w <KeyPress-Escape> [list tk::ButtonInvoke $data(cancelBtn)]
+ bind $w <Alt-c> [list tk::ButtonInvoke $data(cancelBtn)]
+ bind $w <Alt-o> [list tk::ButtonInvoke $data(okBtn)]
- wm protocol $w WM_DELETE_WINDOW [list tkColorDialog_CancelCmd $w]
+ wm protocol $w WM_DELETE_WINDOW [list tk::dialog::color::CancelCmd $w]
}
-# tkColorDialog_SetRGBValue --
+# ::tk::dialog::color::SetRGBValue --
#
# Sets the current selection of the dialog box
#
-proc tkColorDialog_SetRGBValue {w color} {
- upvar #0 $w data
+proc ::tk::dialog::color::SetRGBValue {w color} {
+ upvar ::tk::dialog::color::[winfo name $w] data
set data(red,intensity) [lindex $color 0]
set data(green,intensity) [lindex $color 1]
set data(blue,intensity) [lindex $color 2]
- tkColorDialog_RedrawColorBars $w all
+ RedrawColorBars $w all
# Now compute the new x value of each colorbars pointer polygon
foreach color [list red green blue ] {
- set x [tkColorDialog_RgbToX $w $data($color,intensity)]
- tkColorDialog_MoveSelector $w $data($color,sel) $color $x 0
+ set x [RgbToX $w $data($color,intensity)]
+ MoveSelector $w $data($color,sel) $color $x 0
}
}
-# tkColorDialog_XToRgb --
+# ::tk::dialog::color::XToRgb --
#
# Converts a screen coordinate to intensity
#
-proc tkColorDialog_XToRgb {w x} {
- upvar #0 $w data
+proc ::tk::dialog::color::XToRgb {w x} {
+ upvar ::tk::dialog::color::[winfo name $w] data
return [expr {($x * $data(intensityIncr))/ $data(colorbarWidth)}]
}
-# tkColorDialog_RgbToX
+# ::tk::dialog::color::RgbToX
#
# Converts an intensity to screen coordinate.
#
-proc tkColorDialog_RgbToX {w color} {
- upvar #0 $w data
+proc ::tk::dialog::color::RgbToX {w color} {
+ upvar ::tk::dialog::color::[winfo name $w] data
return [expr {($color * $data(colorbarWidth)/ $data(intensityIncr))}]
}
-# tkColorDialog_DrawColorScale --
+# ::tk::dialog::color::DrawColorScale --
#
# Draw color scale is called whenever the size of one of the color
# scale canvases is changed.
#
-proc tkColorDialog_DrawColorScale {w c {create 0}} {
- global lines
- upvar #0 $w data
+proc ::tk::dialog::color::DrawColorScale {w c {create 0}} {
+ upvar ::tk::dialog::color::[winfo name $w] data
# col: color bar canvas
# sel: selector canvas
@@ -375,13 +382,13 @@ proc tkColorDialog_DrawColorScale {w c {create 0}} {
}
# Draw the selection polygons
- tkColorDialog_CreateSelector $w $sel $c
+ CreateSelector $w $sel $c
$sel bind $data($c,index) <ButtonPress-1> \
- [list tkColorDialog_StartMove $w $sel $c %x $data(selPad) 1]
+ [list tk::dialog::color::StartMove $w $sel $c %x $data(selPad) 1]
$sel bind $data($c,index) <B1-Motion> \
- [list tkColorDialog_MoveSelector $w $sel $c %x $data(selPad)]
+ [list tk::dialog::color::MoveSelector $w $sel $c %x $data(selPad)]
$sel bind $data($c,index) <ButtonRelease-1> \
- [list tkColorDialog_ReleaseMouse $w $sel $c %x $data(selPad)]
+ [list tk::dialog::color::ReleaseMouse $w $sel $c %x $data(selPad)]
set height [winfo height $col]
# Create an invisible region under the colorstrip to catch mouse clicks
@@ -390,18 +397,18 @@ proc tkColorDialog_DrawColorScale {w c {create 0}} {
$data(canvasWidth) $height -fill {} -outline {}]
bind $col <ButtonPress-1> \
- [list tkColorDialog_StartMove $w $sel $c %x $data(colorPad)]
+ [list tk::dialog::color::StartMove $w $sel $c %x $data(colorPad)]
bind $col <B1-Motion> \
- [list tkColorDialog_MoveSelector $w $sel $c %x $data(colorPad)]
+ [list tk::dialog::color::MoveSelector $w $sel $c %x $data(colorPad)]
bind $col <ButtonRelease-1> \
- [list tkColorDialog_ReleaseMouse $w $sel $c %x $data(colorPad)]
+ [list tk::dialog::color::ReleaseMouse $w $sel $c %x $data(colorPad)]
$sel bind $data($c,clickRegion) <ButtonPress-1> \
- [list tkColorDialog_StartMove $w $sel $c %x $data(selPad)]
+ [list tk::dialog::color::StartMove $w $sel $c %x $data(selPad)]
$sel bind $data($c,clickRegion) <B1-Motion> \
- [list tkColorDialog_MoveSelector $w $sel $c %x $data(selPad)]
+ [list tk::dialog::color::MoveSelector $w $sel $c %x $data(selPad)]
$sel bind $data($c,clickRegion) <ButtonRelease-1> \
- [list tkColorDialog_ReleaseMouse $w $sel $c %x $data(selPad)]
+ [list tk::dialog::color::ReleaseMouse $w $sel $c %x $data(selPad)]
} else {
# l is the canvas index of the first colorbar.
set l $data(lines,$c,start)
@@ -446,30 +453,30 @@ proc tkColorDialog_DrawColorScale {w c {create 0}} {
set data(lines,$c,start) [expr {$index - $data(NUM_COLORBARS) + 1}]
}
- tkColorDialog_RedrawFinalColor $w
+ RedrawFinalColor $w
}
-# tkColorDialog_CreateSelector --
+# ::tk::dialog::color::CreateSelector --
#
# Creates and draws the selector polygon at the position
# $data($c,intensity).
#
-proc tkColorDialog_CreateSelector {w sel c } {
- upvar #0 $w data
+proc ::tk::dialog::color::CreateSelector {w sel c } {
+ upvar ::tk::dialog::color::[winfo name $w] data
set data($c,index) [$sel create polygon \
0 $data(PLGN_HEIGHT) \
$data(PLGN_WIDTH) $data(PLGN_HEIGHT) \
$data(indent) 0]
- set data($c,x) [tkColorDialog_RgbToX $w $data($c,intensity)]
+ set data($c,x) [RgbToX $w $data($c,intensity)]
$sel move $data($c,index) $data($c,x) 0
}
-# tkColorDialog_RedrawFinalColor
+# ::tk::dialog::color::RedrawFinalColor
#
# Combines the intensities of the three colors into the final color
#
-proc tkColorDialog_RedrawFinalColor {w} {
- upvar #0 $w data
+proc ::tk::dialog::color::RedrawFinalColor {w} {
+ upvar ::tk::dialog::color::[winfo name $w] data
set color [format "#%02x%02x%02x" $data(red,intensity) \
$data(green,intensity) $data(blue,intensity)]
@@ -483,42 +490,42 @@ proc tkColorDialog_RedrawFinalColor {w} {
$data(blue,intensity)]
}
-# tkColorDialog_RedrawColorBars --
+# ::tk::dialog::color::RedrawColorBars --
#
# Only redraws the colors on the color strips that were not manipulated.
# Params: color of colorstrip that changed. If color is not [red|green|blue]
# Then all colorstrips will be updated
#
-proc tkColorDialog_RedrawColorBars {w colorChanged} {
- upvar #0 $w data
+proc ::tk::dialog::color::RedrawColorBars {w colorChanged} {
+ upvar ::tk::dialog::color::[winfo name $w] data
switch $colorChanged {
red {
- tkColorDialog_DrawColorScale $w green
- tkColorDialog_DrawColorScale $w blue
+ DrawColorScale $w green
+ DrawColorScale $w blue
}
green {
- tkColorDialog_DrawColorScale $w red
- tkColorDialog_DrawColorScale $w blue
+ DrawColorScale $w red
+ DrawColorScale $w blue
}
blue {
- tkColorDialog_DrawColorScale $w red
- tkColorDialog_DrawColorScale $w green
+ DrawColorScale $w red
+ DrawColorScale $w green
}
default {
- tkColorDialog_DrawColorScale $w red
- tkColorDialog_DrawColorScale $w green
- tkColorDialog_DrawColorScale $w blue
+ DrawColorScale $w red
+ DrawColorScale $w green
+ DrawColorScale $w blue
}
}
- tkColorDialog_RedrawFinalColor $w
+ RedrawFinalColor $w
}
#----------------------------------------------------------------------
# Event handlers
#----------------------------------------------------------------------
-# tkColorDialog_StartMove --
+# ::tk::dialog::color::StartMove --
#
# Handles a mousedown button event over the selector polygon.
# Adds the bindings for moving the mouse while the button is
@@ -526,15 +533,15 @@ proc tkColorDialog_RedrawColorBars {w colorChanged} {
#
# Params: sel is the selector canvas window, color is the color of the strip.
#
-proc tkColorDialog_StartMove {w sel color x delta {dontMove 0}} {
- upvar #0 $w data
+proc ::tk::dialog::color::StartMove {w sel color x delta {dontMove 0}} {
+ upvar ::tk::dialog::color::[winfo name $w] data
if {!$dontMove} {
- tkColorDialog_MoveSelector $w $sel $color $x $delta
+ MoveSelector $w $sel $color $x $delta
}
}
-# tkColorDialog_MoveSelector --
+# ::tk::dialog::color::MoveSelector --
#
# Moves the polygon selector so that its middle point has the same
# x value as the specified x. If x is outside the bounds [0,255],
@@ -543,8 +550,8 @@ proc tkColorDialog_StartMove {w sel color x delta {dontMove 0}} {
# Params: sel is the selector canvas, c is [red|green|blue]
# x is a x-coordinate.
#
-proc tkColorDialog_MoveSelector {w sel color x delta} {
- upvar #0 $w data
+proc ::tk::dialog::color::MoveSelector {w sel color x delta} {
+ upvar ::tk::dialog::color::[winfo name $w] data
incr x -$delta
@@ -561,49 +568,49 @@ proc tkColorDialog_MoveSelector {w sel color x delta} {
return $x
}
-# tkColorDialog_ReleaseMouse
+# ::tk::dialog::color::ReleaseMouse
#
# Removes mouse tracking bindings, updates the colorbars.
#
# Params: sel is the selector canvas, color is the color of the strip,
# x is the x-coord of the mouse.
#
-proc tkColorDialog_ReleaseMouse {w sel color x delta} {
- upvar #0 $w data
+proc ::tk::dialog::color::ReleaseMouse {w sel color x delta} {
+ upvar ::tk::dialog::color::[winfo name $w] data
- set x [tkColorDialog_MoveSelector $w $sel $color $x $delta]
+ set x [MoveSelector $w $sel $color $x $delta]
# Determine exactly what color we are looking at.
- set data($color,intensity) [tkColorDialog_XToRgb $w $x]
+ set data($color,intensity) [XToRgb $w $x]
- tkColorDialog_RedrawColorBars $w $color
+ RedrawColorBars $w $color
}
-# tkColorDialog_ResizeColorbars --
+# ::tk::dialog::color::ResizeColorbars --
#
# Completely redraws the colorbars, including resizing the
# colorstrips
#
-proc tkColorDialog_ResizeColorBars {w} {
- upvar #0 $w data
+proc ::tk::dialog::color::ResizeColorBars {w} {
+ upvar ::tk::dialog::color::[winfo name $w] data
if { ($data(BARS_WIDTH) < $data(NUM_COLORBARS)) ||
(($data(BARS_WIDTH) % $data(NUM_COLORBARS)) != 0)} {
set data(BARS_WIDTH) $data(NUM_COLORBARS)
}
- tkColorDialog_InitValues $w
+ InitValues [winfo name $w]
foreach color [list red green blue ] {
$data($color,col) configure -width $data(canvasWidth)
- tkColorDialog_DrawColorScale $w $color 1
+ DrawColorScale $w $color 1
}
}
-# tkColorDialog_HandleSelEntry --
+# ::tk::dialog::color::HandleSelEntry --
#
# Handles the return keypress event in the "Selection:" entry
#
-proc tkColorDialog_HandleSelEntry {w} {
- upvar #0 $w data
+proc ::tk::dialog::color::HandleSelEntry {w} {
+ upvar ::tk::dialog::color::[winfo name $w] data
set text [string trim $data(selection)]
# Check to make sure that the color is valid
@@ -616,16 +623,16 @@ proc tkColorDialog_HandleSelEntry {w} {
set G [expr {[lindex $color 1]/0x100}]
set B [expr {[lindex $color 2]/0x100}]
- tkColorDialog_SetRGBValue $w "$R $G $B"
+ SetRGBValue $w "$R $G $B"
set data(selection) $text
}
-# tkColorDialog_HandleRGBEntry --
+# ::tk::dialog::color::HandleRGBEntry --
#
# Handles the return keypress event in the R, G or B entry
#
-proc tkColorDialog_HandleRGBEntry {w} {
- upvar #0 $w data
+proc ::tk::dialog::color::HandleRGBEntry {w} {
+ upvar ::tk::dialog::color::[winfo name $w] data
foreach c [list red green blue] {
if {[catch {
@@ -642,40 +649,39 @@ proc tkColorDialog_HandleRGBEntry {w} {
}
}
- tkColorDialog_SetRGBValue $w "$data(red,intensity) \
+ SetRGBValue $w "$data(red,intensity) \
$data(green,intensity) $data(blue,intensity)"
}
# mouse cursor enters a color bar
#
-proc tkColorDialog_EnterColorBar {w color} {
- upvar #0 $w data
+proc ::tk::dialog::color::EnterColorBar {w color} {
+ upvar ::tk::dialog::color::[winfo name $w] data
$data($color,sel) itemconfig $data($color,index) -fill red
}
# mouse leaves enters a color bar
#
-proc tkColorDialog_LeaveColorBar {w color} {
- upvar #0 $w data
+proc ::tk::dialog::color::LeaveColorBar {w color} {
+ upvar ::tk::dialog::color::[winfo name $w] data
$data($color,sel) itemconfig $data($color,index) -fill black
}
# user hits OK button
#
-proc tkColorDialog_OkCmd {w} {
- global tkPriv
- upvar #0 $w data
+proc ::tk::dialog::color::OkCmd {w} {
+ variable ::tk::Priv
+ upvar ::tk::dialog::color::[winfo name $w] data
- set tkPriv(selectColor) $data(finalColor)
+ set Priv(selectColor) $data(finalColor)
}
# user hits Cancel button
#
-proc tkColorDialog_CancelCmd {w} {
- global tkPriv
-
- set tkPriv(selectColor) ""
+proc ::tk::dialog::color::CancelCmd {w} {
+ variable ::tk::Priv
+ set Priv(selectColor) ""
}
diff --git a/library/comdlg.tcl b/library/comdlg.tcl
index 1ba0769..cb2af18 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.7 2000/04/08 06:59:28 hobbs Exp $
+# RCS: @(#) $Id: comdlg.tcl,v 1.8 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1996 Sun Microsystems, Inc.
#
@@ -112,94 +112,99 @@ proc tclListValidFlags {v} {
#----------------------------------------------------------------------
-# tkFocusGroup_Create --
+# ::tk::FocusGroup_Create --
#
# Create a focus group. All the widgets in a focus group must be
# within the same focus toplevel. Each toplevel can have only
# one focus group, which is identified by the name of the
# toplevel widget.
#
-proc tkFocusGroup_Create {t} {
- global tkPriv
+proc ::tk::FocusGroup_Create {t} {
+ variable ::tk::Priv
if {[string compare [winfo toplevel $t] $t]} {
error "$t is not a toplevel window"
}
- if {![info exists tkPriv(fg,$t)]} {
- set tkPriv(fg,$t) 1
- set tkPriv(focus,$t) ""
- bind $t <FocusIn> [list tkFocusGroup_In $t %W %d]
- bind $t <FocusOut> [list tkFocusGroup_Out $t %W %d]
- bind $t <Destroy> [list tkFocusGroup_Destroy $t %W]
+ if {![info exists Priv(fg,$t)]} {
+ set Priv(fg,$t) 1
+ set Priv(focus,$t) ""
+ bind $t <FocusIn> [list tk::FocusGroup_In $t %W %d]
+ bind $t <FocusOut> [list tk::FocusGroup_Out $t %W %d]
+ bind $t <Destroy> [list tk::FocusGroup_Destroy $t %W]
}
}
-# tkFocusGroup_BindIn --
+# ::tk::FocusGroup_BindIn --
#
# Add a widget into the "FocusIn" list of the focus group. The $cmd will be
# called when the widget is focused on by the user.
#
-proc tkFocusGroup_BindIn {t w cmd} {
- global tkFocusIn tkPriv
- if {![info exists tkPriv(fg,$t)]} {
+proc ::tk::FocusGroup_BindIn {t w cmd} {
+ variable FocusIn
+ variable ::tk::Priv
+ if {![info exists Priv(fg,$t)]} {
error "focus group \"$t\" doesn't exist"
}
- set tkFocusIn($t,$w) $cmd
+ set FocusIn($t,$w) $cmd
}
-# tkFocusGroup_BindOut --
+# ::tk::FocusGroup_BindOut --
#
# Add a widget into the "FocusOut" list of the focus group. The
# $cmd will be called when the widget loses the focus (User
# types Tab or click on another widget).
#
-proc tkFocusGroup_BindOut {t w cmd} {
- global tkFocusOut tkPriv
- if {![info exists tkPriv(fg,$t)]} {
+proc ::tk::FocusGroup_BindOut {t w cmd} {
+ variable FocusOut
+ variable ::tk::Priv
+ if {![info exists Priv(fg,$t)]} {
error "focus group \"$t\" doesn't exist"
}
- set tkFocusOut($t,$w) $cmd
+ set FocusOut($t,$w) $cmd
}
-# tkFocusGroup_Destroy --
+# ::tk::FocusGroup_Destroy --
#
# Cleans up when members of the focus group is deleted, or when the
# toplevel itself gets deleted.
#
-proc tkFocusGroup_Destroy {t w} {
- global tkPriv tkFocusIn tkFocusOut
+proc ::tk::FocusGroup_Destroy {t w} {
+ variable FocusIn
+ variable FocusOut
+ variable ::tk::Priv
if {[string equal $t $w]} {
- unset tkPriv(fg,$t)
- unset tkPriv(focus,$t)
+ unset Priv(fg,$t)
+ unset Priv(focus,$t)
- foreach name [array names tkFocusIn $t,*] {
- unset tkFocusIn($name)
+ foreach name [array names FocusIn $t,*] {
+ unset FocusIn($name)
}
- foreach name [array names tkFocusOut $t,*] {
- unset tkFocusOut($name)
+ foreach name [array names FocusOut $t,*] {
+ unset FocusOut($name)
}
} else {
- if {[info exists tkPriv(focus,$t)] && \
- [string equal $tkPriv(focus,$t) $w]} {
- set tkPriv(focus,$t) ""
+ if {[info exists Priv(focus,$t)] && \
+ [string equal $Priv(focus,$t) $w]} {
+ set Priv(focus,$t) ""
}
catch {
- unset tkFocusIn($t,$w)
+ unset FocusIn($t,$w)
}
catch {
- unset tkFocusOut($t,$w)
+ unset FocusOut($t,$w)
}
}
}
-# tkFocusGroup_In --
+# ::tk::FocusGroup_In --
#
# Handles the <FocusIn> event. Calls the FocusIn command for the newly
# focused widget in the focus group.
#
-proc tkFocusGroup_In {t w detail} {
- global tkPriv tkFocusIn
+proc ::tk::FocusGroup_In {t w detail} {
+ variable FocusIn
+ variable ::tk::Priv
if {[string compare $detail NotifyNonlinear] && \
[string compare $detail NotifyNonlinearVirtual]} {
@@ -207,56 +212,57 @@ proc tkFocusGroup_In {t w detail} {
# ordinary keypresses some window managers (ie: CDE [Bug: 2960]).
return
}
- if {![info exists tkFocusIn($t,$w)]} {
- set tkFocusIn($t,$w) ""
+ if {![info exists FocusIn($t,$w)]} {
+ set FocusIn($t,$w) ""
return
}
- if {![info exists tkPriv(focus,$t)]} {
+ if {![info exists Priv(focus,$t)]} {
return
}
- if {[string equal $tkPriv(focus,$t) $w]} {
+ if {[string equal $Priv(focus,$t) $w]} {
# This is already in focus
#
return
} else {
- set tkPriv(focus,$t) $w
- eval $tkFocusIn($t,$w)
+ set Priv(focus,$t) $w
+ eval $FocusIn($t,$w)
}
}
-# tkFocusGroup_Out --
+# ::tk::FocusGroup_Out --
#
# Handles the <FocusOut> event. Checks if this is really a lose
# focus event, not one generated by the mouse moving out of the
# toplevel window. Calls the FocusOut command for the widget
# who loses its focus.
#
-proc tkFocusGroup_Out {t w detail} {
- global tkPriv tkFocusOut
+proc ::tk::FocusGroup_Out {t w detail} {
+ variable FocusOut
+ variable ::tk::Priv
if {[string compare $detail NotifyNonlinear] && \
[string compare $detail NotifyNonlinearVirtual]} {
# This is caused by mouse moving out of the window
return
}
- if {![info exists tkPriv(focus,$t)]} {
+ if {![info exists Priv(focus,$t)]} {
return
}
- if {![info exists tkFocusOut($t,$w)]} {
+ if {![info exists FocusOut($t,$w)]} {
return
} else {
- eval $tkFocusOut($t,$w)
- set tkPriv(focus,$t) ""
+ eval $FocusOut($t,$w)
+ set Priv(focus,$t) ""
}
}
-# tkFDGetFileTypes --
+# ::tk::FDGetFileTypes --
#
# Process the string given by the -filetypes option of the file
# dialogs. Similar to the C function TkGetFileFilters() on the Mac
# and Windows platform.
#
-proc tkFDGetFileTypes {string} {
+proc ::tk::FDGetFileTypes {string} {
foreach t $string {
if {[llength $t] < 2 || [llength $t] > 3} {
error "bad file type \"$t\", should be \"typeName {extension ?extensions ...?} ?{macType ?macTypes ...?}?\""
diff --git a/library/console.tcl b/library/console.tcl
index e996ea5..170d898 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.11 2001/07/03 01:03:16 hobbs Exp $
+# RCS: @(#) $Id: console.tcl,v 1.12 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1995-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 Ajuba Solutions.
@@ -15,13 +15,13 @@
# TODO: history - remember partially written command
-# tkConsoleInit --
+# ::tk::ConsoleInit --
# This procedure constructs and configures the console windows.
#
# Arguments:
# None.
-proc tkConsoleInit {} {
+proc ::tk::ConsoleInit {} {
global tcl_platform
if {![consoleinterp eval {set tcl_interactive}]} {
@@ -40,7 +40,7 @@ proc tkConsoleInit {} {
menu .menubar.file -tearoff 0
.menubar.file add command -label [::msgcat::mc "Source..."] \
- -underline 0 -command tkConsoleSource
+ -underline 0 -command tk::ConsoleSource
.menubar.file add command -label [::msgcat::mc "Hide Console"] \
-underline 0 -command {wm withdraw .}
if {[string compare $tcl_platform(platform) "macintosh"]} {
@@ -69,7 +69,7 @@ proc tkConsoleInit {} {
.menubar add cascade -label Help -menu .menubar.help -underline 0
menu .menubar.help -tearoff 0
.menubar.help add command -label [::msgcat::mc "About..."] \
- -underline 0 -command tkConsoleAbout
+ -underline 0 -command tk::ConsoleAbout
}
. configure -menu .menubar
@@ -87,7 +87,7 @@ proc tkConsoleInit {} {
}
}
- tkConsoleBind .console
+ ConsoleBind .console
.console tag configure stderr -foreground red
.console tag configure stdin -foreground blue
@@ -98,19 +98,19 @@ proc tkConsoleInit {} {
wm title . [::msgcat::mc "Console"]
flush stdout
.console mark set output [.console index "end - 1 char"]
- tkTextSetCursor .console end
+ tk::TextSetCursor .console end
.console mark set promptEnd insert
.console mark gravity promptEnd left
}
-# tkConsoleSource --
+# ::tk::ConsoleSource --
#
# Prompts the user for a file to source in the main interpreter.
#
# Arguments:
# None.
-proc tkConsoleSource {} {
+proc ::tk::ConsoleSource {} {
set filename [tk_getOpenFile -defaultextension .tcl -parent . \
-title [::msgcat::mc "Select a file to source"] \
-filetypes [list \
@@ -119,12 +119,12 @@ proc tkConsoleSource {} {
if {[string compare $filename ""]} {
set cmd [list source $filename]
if {[catch {consoleinterp eval $cmd} result]} {
- tkConsoleOutput stderr "$result\n"
+ ConsoleOutput stderr "$result\n"
}
}
}
-# tkConsoleInvoke --
+# ::tk::ConsoleInvoke --
# Processes the command line input. If the command is complete it
# is evaled in the main interpreter. Otherwise, the continuation
# prompt is added and more input may be added.
@@ -132,7 +132,7 @@ proc tkConsoleSource {} {
# Arguments:
# None.
-proc tkConsoleInvoke {args} {
+proc ::tk::ConsoleInvoke {args} {
set ranges [.console tag ranges input]
set cmd ""
if {[llength $ranges]} {
@@ -145,7 +145,7 @@ proc tkConsoleInvoke {args} {
}
}
if {[string equal $cmd ""]} {
- tkConsolePrompt
+ ConsolePrompt
} elseif {[info complete $cmd]} {
.console mark set output end
.console tag delete input
@@ -153,51 +153,51 @@ proc tkConsoleInvoke {args} {
if {[string compare $result ""]} {
puts $result
}
- tkConsoleHistory reset
- tkConsolePrompt
+ ConsoleHistory reset
+ ConsolePrompt
} else {
- tkConsolePrompt partial
+ ConsolePrompt partial
}
.console yview -pickplace insert
}
-# tkConsoleHistory --
+# ::tk::ConsoleHistory --
# This procedure implements command line history for the
# console. In general is evals the history command in the
-# main interpreter to obtain the history. The global variable
-# histNum is used to store the current location in the history.
+# main interpreter to obtain the history. The variable
+# ::tk::HistNum is used to store the current location in the history.
#
# Arguments:
# cmd - Which action to take: prev, next, reset.
-set histNum 1
-proc tkConsoleHistory {cmd} {
- global histNum
+set ::tk::HistNum 1
+proc ::tk::ConsoleHistory {cmd} {
+ variable HistNum
switch $cmd {
prev {
- incr histNum -1
- if {$histNum == 0} {
+ incr HistNum -1
+ if {$HistNum == 0} {
set cmd {history event [expr {[history nextid] -1}]}
} else {
- set cmd "history event $histNum"
+ set cmd "history event $HistNum"
}
if {[catch {consoleinterp eval $cmd} cmd]} {
- incr histNum
+ incr HistNum
return
}
.console delete promptEnd end
.console insert promptEnd $cmd {input stdin}
}
next {
- incr histNum
- if {$histNum == 0} {
+ incr HistNum
+ if {$HistNum == 0} {
set cmd {history event [expr {[history nextid] -1}]}
- } elseif {$histNum > 0} {
+ } elseif {$HistNum > 0} {
set cmd ""
- set histNum 1
+ set HistNum 1
} else {
- set cmd "history event $histNum"
+ set cmd "history event $HistNum"
}
if {[string compare $cmd ""]} {
catch {consoleinterp eval $cmd} cmd
@@ -206,12 +206,12 @@ proc tkConsoleHistory {cmd} {
.console insert promptEnd $cmd {input stdin}
}
reset {
- set histNum 1
+ set HistNum 1
}
}
}
-# tkConsolePrompt --
+# ::tk::ConsolePrompt --
# This procedure draws the prompt. If tcl_prompt1 or tcl_prompt2
# exists in the main interpreter it will be called to generate the
# prompt. Otherwise, a hard coded default prompt is printed.
@@ -219,7 +219,7 @@ proc tkConsoleHistory {cmd} {
# Arguments:
# partial - Flag to specify which prompt to print.
-proc tkConsolePrompt {{partial normal}} {
+proc ::tk::ConsolePrompt {{partial normal}} {
if {[string equal $partial "normal"]} {
set temp [.console index "end - 1 char"]
.console mark set output end
@@ -239,12 +239,12 @@ proc tkConsolePrompt {{partial normal}} {
}
flush stdout
.console mark set output $temp
- tkTextSetCursor .console end
+ ::tk::TextSetCursor .console end
.console mark set promptEnd insert
.console mark gravity promptEnd left
}
-# tkConsoleBind --
+# ::tk::ConsoleBind --
# This procedure first ensures that the default bindings for the Text
# class have been defined. Then certain bindings are overridden for
# the class.
@@ -252,7 +252,7 @@ proc tkConsolePrompt {{partial normal}} {
# Arguments:
# None.
-proc tkConsoleBind {win} {
+proc ::tk::ConsoleBind {win} {
bindtags $win "$win Text . all"
# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
@@ -267,14 +267,14 @@ proc tkConsoleBind {win} {
bind $win <KP_Enter> {# nothing}
bind $win <Tab> {
- tkConsoleInsert %W \t
+ tk::ConsoleInsert %W \t
focus %W
break
}
bind $win <Return> {
%W mark set insert {end - 1c}
- tkConsoleInsert %W "\n"
- tkConsoleInvoke
+ tk::ConsoleInsert %W "\n"
+ tk::ConsoleInvoke
break
}
bind $win <Delete> {
@@ -294,16 +294,16 @@ proc tkConsoleBind {win} {
foreach left {Control-a Home} {
bind $win <$left> {
if {[%W compare insert < promptEnd]} {
- tkTextSetCursor %W {insert linestart}
+ tk::TextSetCursor %W {insert linestart}
} else {
- tkTextSetCursor %W promptEnd
+ tk::TextSetCursor %W promptEnd
}
break
}
}
foreach right {Control-e End} {
bind $win <$right> {
- tkTextSetCursor %W {insert lineend}
+ tk::TextSetCursor %W {insert lineend}
break
}
}
@@ -339,22 +339,22 @@ proc tkConsoleBind {win} {
}
foreach prev {Control-p Up} {
bind $win <$prev> {
- tkConsoleHistory prev
+ tk::ConsoleHistory prev
break
}
}
foreach prev {Control-n Down} {
bind $win <$prev> {
- tkConsoleHistory next
+ tk::ConsoleHistory next
break
}
}
bind $win <Insert> {
- catch {tkConsoleInsert %W [::tk::GetSelection %W PRIMARY]}
+ catch {tk::ConsoleInsert %W [::tk::GetSelection %W PRIMARY]}
break
}
bind $win <KeyPress> {
- tkConsoleInsert %W %A
+ tk::ConsoleInsert %W %A
break
}
foreach left {Control-b Left} {
@@ -362,13 +362,13 @@ proc tkConsoleBind {win} {
if {[%W compare insert == promptEnd]} {
break
}
- tkTextSetCursor %W insert-1c
+ tk::TextSetCursor %W insert-1c
break
}
}
foreach right {Control-f Right} {
bind $win <$right> {
- tkTextSetCursor %W insert+1c
+ tk::TextSetCursor %W insert+1c
break
}
}
@@ -399,19 +399,19 @@ proc tkConsoleBind {win} {
catch {
set clip [::tk::GetSelection %W CLIPBOARD]
set list [split $clip \n\r]
- tkConsoleInsert %W [lindex $list 0]
+ tk::ConsoleInsert %W [lindex $list 0]
foreach x [lrange $list 1 end] {
%W mark set insert {end - 1c}
- tkConsoleInsert %W "\n"
- tkConsoleInvoke
- tkConsoleInsert %W $x
+ tk::ConsoleInsert %W "\n"
+ tk::ConsoleInvoke
+ tk::ConsoleInsert %W $x
}
}
break
}
}
-# tkConsoleInsert --
+# ::tk::ConsoleInsert --
# Insert a string into a text at the point of the insertion cursor.
# If there is a selection in the text, and it covers the point of the
# insertion cursor, then delete the selection before inserting. Insertion
@@ -421,7 +421,7 @@ proc tkConsoleBind {win} {
# w - The text window in which to insert the string
# s - The string to insert (usually just a single character)
-proc tkConsoleInsert {w s} {
+proc ::tk::ConsoleInsert {w s} {
if {[string equal $s ""]} {
return
}
@@ -439,7 +439,7 @@ proc tkConsoleInsert {w s} {
$w see insert
}
-# tkConsoleOutput --
+# ::tk::ConsoleOutput --
#
# This routine is called directly by ConsolePutsCmd to cause a string
# to be displayed in the console.
@@ -448,12 +448,12 @@ proc tkConsoleInsert {w s} {
# dest - The output tag to be used: either "stderr" or "stdout".
# string - The string to be displayed.
-proc tkConsoleOutput {dest string} {
+proc ::tk::ConsoleOutput {dest string} {
.console insert output $string $dest
.console see insert
}
-# tkConsoleExit --
+# ::tk::ConsoleExit --
#
# This routine is called by ConsoleEventProc when the main window of
# the application is destroyed. Don't call exit - that probably already
@@ -462,18 +462,18 @@ proc tkConsoleOutput {dest string} {
# Arguments:
# None.
-proc tkConsoleExit {} {
+proc ::tk::ConsoleExit {} {
destroy .
}
-# tkConsoleAbout --
+# ::tk::ConsoleAbout --
#
# This routine displays an About box to show Tcl/Tk version info.
#
# Arguments:
# None.
-proc tkConsoleAbout {} {
+proc ::tk::ConsoleAbout {} {
global tk_patchLevel
tk_messageBox -type ok -message "[::msgcat::mc {Tcl for Windows}]
Copyright \251 2000 Ajuba Solutions
@@ -484,4 +484,4 @@ Tk $tk_patchLevel"
# now initialize the console
-tkConsoleInit
+::tk::ConsoleInit
diff --git a/library/dialog.tcl b/library/dialog.tcl
index b3c9dbd..534a9ae 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.8 2000/04/18 02:18:33 ericm Exp $
+# RCS: @(#) $Id: dialog.tcl,v 1.9 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1992-1993 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
@@ -13,7 +13,7 @@
#
#
-# tk_dialog:
+# ::tk_dialog:
#
# This procedure displays a dialog box, waits for a button in the dialog
# to be invoked, then returns the index of the selected button. If the
@@ -29,8 +29,9 @@
# args - One or more strings to display in buttons across the
# bottom of the dialog box.
-proc tk_dialog {w title text bitmap default args} {
- global tkPriv tcl_platform
+proc ::tk_dialog {w title text bitmap default args} {
+ global tcl_platform
+ variable ::tk::Priv
# Check that $default was properly given
if {[string is int $default]} {
@@ -103,7 +104,7 @@ proc tk_dialog {w title text bitmap default args} {
set i 0
foreach but $args {
- button $w.button$i -text $but -command [list set tkPriv(button) $i]
+ button $w.button$i -text $but -command [list set Priv(button) $i]
if {$i == $default} {
$w.button$i configure -default active
} else {
@@ -129,7 +130,7 @@ proc tk_dialog {w title text bitmap default args} {
[list $w.button$default] configure -state active -relief sunken
update idletasks
after 100
- set tkPriv(button) $default
+ set Priv(button) $default
"
}
@@ -137,7 +138,7 @@ proc tk_dialog {w title text bitmap default args} {
# button variable to -1; this is needed in case something happens
# that destroys the window, such as its parent window being destroyed.
- bind $w <Destroy> {set tkPriv(button) -1}
+ bind $w <Destroy> {set Priv(button) -1}
# 6. Withdraw the window, then update all the geometry information
# so we know how big it wants to be, then center the window in the
@@ -172,12 +173,12 @@ proc tk_dialog {w title text bitmap default args} {
# may take the focus away so we can't redirect it. Finally,
# restore any grab that was in effect.
- tkwait variable tkPriv(button)
+ vwait ::tk::Priv(button)
catch {focus $oldFocus}
catch {
# It's possible that the window has already been destroyed,
# hence this "catch". Delete the Destroy handler so that
- # tkPriv(button) doesn't get reset by it.
+ # tk::Priv(button) doesn't get reset by it.
bind $w <Destroy> {}
destroy $w
@@ -189,5 +190,5 @@ proc tk_dialog {w title text bitmap default args} {
grab -global $oldGrab
}
}
- return $tkPriv(button)
+ return $Priv(button)
}
diff --git a/library/entry.tcl b/library/entry.tcl
index 5392bcd..57f95fd 100644
--- a/library/entry.tcl
+++ b/library/entry.tcl
@@ -3,7 +3,7 @@
# This file defines the default bindings for Tk entry widgets and provides
# procedures that help in implementing those bindings.
#
-# RCS: @(#) $Id: entry.tcl,v 1.15 2001/07/03 01:03:16 hobbs Exp $
+# RCS: @(#) $Id: entry.tcl,v 1.16 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
@@ -13,7 +13,7 @@
#
#-------------------------------------------------------------------------
-# Elements of tkPriv that are used in this file:
+# Elements of tk::Priv that are used in this file:
#
# afterId - If non-null, it means that auto-scanning is underway
# and it gives the "after" id for the next auto-scan
@@ -33,18 +33,18 @@
# The code below creates the default class bindings for entries.
#-------------------------------------------------------------------------
bind Entry <<Cut>> {
- if {![catch {tkEntryGetSelection %W} tkPriv(data)]} {
+ if {![catch {tk::EntryGetSelection %W} tk::Priv(data)]} {
clipboard clear -displayof %W
- clipboard append -displayof %W $tkPriv(data)
+ clipboard append -displayof %W $tk::Priv(data)
%W delete sel.first sel.last
- unset tkPriv(data)
+ unset tk::Priv(data)
}
}
bind Entry <<Copy>> {
- if {![catch {tkEntryGetSelection %W} tkPriv(data)]} {
+ if {![catch {tk::EntryGetSelection %W} tk::Priv(data)]} {
clipboard clear -displayof %W
- clipboard append -displayof %W $tkPriv(data)
- unset tkPriv(data)
+ clipboard append -displayof %W $tk::Priv(data)
+ unset tk::Priv(data)
}
}
bind Entry <<Paste>> {
@@ -56,105 +56,105 @@ bind Entry <<Paste>> {
}
}
%W insert insert [::tk::GetSelection %W CLIPBOARD]
- tkEntrySeeInsert %W
+ tk::EntrySeeInsert %W
}
}
bind Entry <<Clear>> {
%W delete sel.first sel.last
}
bind Entry <<PasteSelection>> {
- if {!$tkPriv(mouseMoved) || $tk_strictMotif} {
- tkEntryPaste %W %x
+ if {!$tk::Priv(mouseMoved) || $tk_strictMotif} {
+ tk::EntryPaste %W %x
}
}
# Standard Motif bindings:
bind Entry <1> {
- tkEntryButton1 %W %x
+ tk::EntryButton1 %W %x
%W selection clear
}
bind Entry <B1-Motion> {
- set tkPriv(x) %x
- tkEntryMouseSelect %W %x
+ set tk::Priv(x) %x
+ tk::EntryMouseSelect %W %x
}
bind Entry <Double-1> {
- set tkPriv(selectMode) word
- tkEntryMouseSelect %W %x
+ set tk::Priv(selectMode) word
+ tk::EntryMouseSelect %W %x
catch {%W icursor sel.first}
}
bind Entry <Triple-1> {
- set tkPriv(selectMode) line
- tkEntryMouseSelect %W %x
+ set tk::Priv(selectMode) line
+ tk::EntryMouseSelect %W %x
%W icursor 0
}
bind Entry <Shift-1> {
- set tkPriv(selectMode) char
+ set tk::Priv(selectMode) char
%W selection adjust @%x
}
bind Entry <Double-Shift-1> {
- set tkPriv(selectMode) word
- tkEntryMouseSelect %W %x
+ set tk::Priv(selectMode) word
+ tk::EntryMouseSelect %W %x
}
bind Entry <Triple-Shift-1> {
- set tkPriv(selectMode) line
- tkEntryMouseSelect %W %x
+ set tk::Priv(selectMode) line
+ tk::EntryMouseSelect %W %x
}
bind Entry <B1-Leave> {
- set tkPriv(x) %x
- tkEntryAutoScan %W
+ set tk::Priv(x) %x
+ tk::EntryAutoScan %W
}
bind Entry <B1-Enter> {
- tkCancelRepeat
+ tk::CancelRepeat
}
bind Entry <ButtonRelease-1> {
- tkCancelRepeat
+ tk::CancelRepeat
}
bind Entry <Control-1> {
%W icursor @%x
}
bind Entry <Left> {
- tkEntrySetCursor %W [expr {[%W index insert] - 1}]
+ tk::EntrySetCursor %W [expr {[%W index insert] - 1}]
}
bind Entry <Right> {
- tkEntrySetCursor %W [expr {[%W index insert] + 1}]
+ tk::EntrySetCursor %W [expr {[%W index insert] + 1}]
}
bind Entry <Shift-Left> {
- tkEntryKeySelect %W [expr {[%W index insert] - 1}]
- tkEntrySeeInsert %W
+ tk::EntryKeySelect %W [expr {[%W index insert] - 1}]
+ tk::EntrySeeInsert %W
}
bind Entry <Shift-Right> {
- tkEntryKeySelect %W [expr {[%W index insert] + 1}]
- tkEntrySeeInsert %W
+ tk::EntryKeySelect %W [expr {[%W index insert] + 1}]
+ tk::EntrySeeInsert %W
}
bind Entry <Control-Left> {
- tkEntrySetCursor %W [tkEntryPreviousWord %W insert]
+ tk::EntrySetCursor %W [tk::EntryPreviousWord %W insert]
}
bind Entry <Control-Right> {
- tkEntrySetCursor %W [tkEntryNextWord %W insert]
+ tk::EntrySetCursor %W [tk::EntryNextWord %W insert]
}
bind Entry <Shift-Control-Left> {
- tkEntryKeySelect %W [tkEntryPreviousWord %W insert]
- tkEntrySeeInsert %W
+ tk::EntryKeySelect %W [tk::EntryPreviousWord %W insert]
+ tk::EntrySeeInsert %W
}
bind Entry <Shift-Control-Right> {
- tkEntryKeySelect %W [tkEntryNextWord %W insert]
- tkEntrySeeInsert %W
+ tk::EntryKeySelect %W [tk::EntryNextWord %W insert]
+ tk::EntrySeeInsert %W
}
bind Entry <Home> {
- tkEntrySetCursor %W 0
+ tk::EntrySetCursor %W 0
}
bind Entry <Shift-Home> {
- tkEntryKeySelect %W 0
- tkEntrySeeInsert %W
+ tk::EntryKeySelect %W 0
+ tk::EntrySeeInsert %W
}
bind Entry <End> {
- tkEntrySetCursor %W end
+ tk::EntrySetCursor %W end
}
bind Entry <Shift-End> {
- tkEntryKeySelect %W end
- tkEntrySeeInsert %W
+ tk::EntryKeySelect %W end
+ tk::EntrySeeInsert %W
}
bind Entry <Delete> {
@@ -165,7 +165,7 @@ bind Entry <Delete> {
}
}
bind Entry <BackSpace> {
- tkEntryBackspace %W
+ tk::EntryBackspace %W
}
bind Entry <Control-space> {
@@ -187,7 +187,7 @@ bind Entry <Control-backslash> {
%W selection clear
}
bind Entry <KeyPress> {
- tkEntryInsert %W %A
+ tk::EntryInsert %W %A
}
# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
@@ -210,7 +210,7 @@ if {[string equal $tcl_platform(platform) "macintosh"]} {
# generates the <<Paste>> event, so we don't need to do anything here.
if {[string compare $tcl_platform(platform) "windows"]} {
bind Entry <Insert> {
- catch {tkEntryInsert %W [::tk::GetSelection %W PRIMARY]}
+ catch {tk::EntryInsert %W [::tk::GetSelection %W PRIMARY]}
}
}
@@ -218,12 +218,12 @@ if {[string compare $tcl_platform(platform) "windows"]} {
bind Entry <Control-a> {
if {!$tk_strictMotif} {
- tkEntrySetCursor %W 0
+ tk::EntrySetCursor %W 0
}
}
bind Entry <Control-b> {
if {!$tk_strictMotif} {
- tkEntrySetCursor %W [expr {[%W index insert] - 1}]
+ tk::EntrySetCursor %W [expr {[%W index insert] - 1}]
}
}
bind Entry <Control-d> {
@@ -233,17 +233,17 @@ bind Entry <Control-d> {
}
bind Entry <Control-e> {
if {!$tk_strictMotif} {
- tkEntrySetCursor %W end
+ tk::EntrySetCursor %W end
}
}
bind Entry <Control-f> {
if {!$tk_strictMotif} {
- tkEntrySetCursor %W [expr {[%W index insert] + 1}]
+ tk::EntrySetCursor %W [expr {[%W index insert] + 1}]
}
}
bind Entry <Control-h> {
if {!$tk_strictMotif} {
- tkEntryBackspace %W
+ tk::EntryBackspace %W
}
}
bind Entry <Control-k> {
@@ -253,32 +253,32 @@ bind Entry <Control-k> {
}
bind Entry <Control-t> {
if {!$tk_strictMotif} {
- tkEntryTranspose %W
+ tk::EntryTranspose %W
}
}
bind Entry <Meta-b> {
if {!$tk_strictMotif} {
- tkEntrySetCursor %W [tkEntryPreviousWord %W insert]
+ tk::EntrySetCursor %W [tk::EntryPreviousWord %W insert]
}
}
bind Entry <Meta-d> {
if {!$tk_strictMotif} {
- %W delete insert [tkEntryNextWord %W insert]
+ %W delete insert [tk::EntryNextWord %W insert]
}
}
bind Entry <Meta-f> {
if {!$tk_strictMotif} {
- tkEntrySetCursor %W [tkEntryNextWord %W insert]
+ tk::EntrySetCursor %W [tk::EntryNextWord %W insert]
}
}
bind Entry <Meta-BackSpace> {
if {!$tk_strictMotif} {
- %W delete [tkEntryPreviousWord %W insert] insert
+ %W delete [tk::EntryPreviousWord %W insert] insert
}
}
bind Entry <Meta-Delete> {
if {!$tk_strictMotif} {
- %W delete [tkEntryPreviousWord %W insert] insert
+ %W delete [tk::EntryPreviousWord %W insert] insert
}
}
@@ -287,21 +287,21 @@ bind Entry <Meta-Delete> {
bind Entry <2> {
if {!$tk_strictMotif} {
%W scan mark %x
- set tkPriv(x) %x
- set tkPriv(y) %y
- set tkPriv(mouseMoved) 0
+ set tk::Priv(x) %x
+ set tk::Priv(y) %y
+ set tk::Priv(mouseMoved) 0
}
}
bind Entry <B2-Motion> {
if {!$tk_strictMotif} {
- if {abs(%x-$tkPriv(x)) > 2} {
- set tkPriv(mouseMoved) 1
+ if {abs(%x-$tk::Priv(x)) > 2} {
+ set tk::Priv(mouseMoved) 1
}
%W scan dragto %x
}
}
-# tkEntryClosestGap --
+# ::tk::EntryClosestGap --
# Given x and y coordinates, this procedure finds the closest boundary
# between characters to the given coordinates and returns the index
# of the character just after the boundary.
@@ -310,7 +310,7 @@ bind Entry <B2-Motion> {
# w - The entry window.
# x - X-coordinate within the window.
-proc tkEntryClosestGap {w x} {
+proc ::tk::EntryClosestGap {w x} {
set pos [$w index @$x]
set bbox [$w bbox $pos]
if {($x - [lindex $bbox 0]) < ([lindex $bbox 2]/2)} {
@@ -319,7 +319,7 @@ proc tkEntryClosestGap {w x} {
incr pos
}
-# tkEntryButton1 --
+# ::tk::EntryButton1 --
# This procedure is invoked to handle button-1 presses in entry
# widgets. It moves the insertion cursor, sets the selection anchor,
# and claims the input focus.
@@ -328,18 +328,18 @@ proc tkEntryClosestGap {w x} {
# w - The entry window in which the button was pressed.
# x - The x-coordinate of the button press.
-proc tkEntryButton1 {w x} {
- global tkPriv
+proc ::tk::EntryButton1 {w x} {
+ variable ::tk::Priv
- set tkPriv(selectMode) char
- set tkPriv(mouseMoved) 0
- set tkPriv(pressX) $x
- $w icursor [tkEntryClosestGap $w $x]
+ set Priv(selectMode) char
+ set Priv(mouseMoved) 0
+ set Priv(pressX) $x
+ $w icursor [EntryClosestGap $w $x]
$w selection from insert
if {[string compare "disabled" [$w cget -state]]} {focus $w}
}
-# tkEntryMouseSelect --
+# ::tk::EntryMouseSelect --
# This procedure is invoked when dragging out a selection with
# the mouse. Depending on the selection mode (character, word,
# line) it selects in different-sized units. This procedure
@@ -350,17 +350,17 @@ proc tkEntryButton1 {w x} {
# w - The entry window in which the button was pressed.
# x - The x-coordinate of the mouse.
-proc tkEntryMouseSelect {w x} {
- global tkPriv
+proc ::tk::EntryMouseSelect {w x} {
+ variable ::tk::Priv
- set cur [tkEntryClosestGap $w $x]
+ set cur [EntryClosestGap $w $x]
set anchor [$w index anchor]
- if {($cur != $anchor) || (abs($tkPriv(pressX) - $x) >= 3)} {
- set tkPriv(mouseMoved) 1
+ if {($cur != $anchor) || (abs($Priv(pressX) - $x) >= 3)} {
+ set Priv(mouseMoved) 1
}
- switch $tkPriv(selectMode) {
+ switch $Priv(selectMode) {
char {
- if {$tkPriv(mouseMoved)} {
+ if {$Priv(mouseMoved)} {
if {$cur < $anchor} {
$w selection range $cur $anchor
} elseif {$cur > $anchor} {
@@ -390,13 +390,13 @@ proc tkEntryMouseSelect {w x} {
$w selection range 0 end
}
}
- if {$tkPriv(mouseMoved)} {
+ if {$Priv(mouseMoved)} {
$w icursor $cur
}
update idletasks
}
-# tkEntryPaste --
+# ::tk::EntryPaste --
# This procedure sets the insertion cursor to the current mouse position,
# pastes the selection there, and sets the focus to the window.
#
@@ -404,15 +404,13 @@ proc tkEntryMouseSelect {w x} {
# w - The entry window.
# x - X position of the mouse.
-proc tkEntryPaste {w x} {
- global tkPriv
-
- $w icursor [tkEntryClosestGap $w $x]
+proc ::tk::EntryPaste {w x} {
+ $w icursor [EntryClosestGap $w $x]
catch {$w insert insert [::tk::GetSelection $w PRIMARY]}
if {[string compare "disabled" [$w cget -state]]} {focus $w}
}
-# tkEntryAutoScan --
+# ::tk::EntryAutoScan --
# This procedure is invoked when the mouse leaves an entry window
# with button 1 down. It scrolls the window left or right,
# depending on where the mouse is, and reschedules itself as an
@@ -422,21 +420,21 @@ proc tkEntryPaste {w x} {
# Arguments:
# w - The entry window.
-proc tkEntryAutoScan {w} {
- global tkPriv
- set x $tkPriv(x)
+proc ::tk::EntryAutoScan {w} {
+ variable ::tk::Priv
+ set x $Priv(x)
if {![winfo exists $w]} return
if {$x >= [winfo width $w]} {
$w xview scroll 2 units
- tkEntryMouseSelect $w $x
+ EntryMouseSelect $w $x
} elseif {$x < 0} {
$w xview scroll -2 units
- tkEntryMouseSelect $w $x
+ EntryMouseSelect $w $x
}
- set tkPriv(afterId) [after 50 [list tkEntryAutoScan $w]]
+ set Priv(afterId) [after 50 [list tk::EntryAutoScan $w]]
}
-# tkEntryKeySelect --
+# ::tk::EntryKeySelect --
# This procedure is invoked when stroking out selections using the
# keyboard. It moves the cursor to a new position, then extends
# the selection to that position.
@@ -446,7 +444,7 @@ proc tkEntryAutoScan {w} {
# new - A new position for the insertion cursor (the cursor hasn't
# actually been moved to this position yet).
-proc tkEntryKeySelect {w new} {
+proc ::tk::EntryKeySelect {w new} {
if {![$w selection present]} {
$w selection from insert
$w selection to $new
@@ -456,7 +454,7 @@ proc tkEntryKeySelect {w new} {
$w icursor $new
}
-# tkEntryInsert --
+# ::tk::EntryInsert --
# Insert a string into an entry at the point of the insertion cursor.
# If there is a selection in the entry, and it covers the point of the
# insertion cursor, then delete the selection before inserting.
@@ -465,7 +463,7 @@ proc tkEntryKeySelect {w new} {
# w - The entry window in which to insert the string
# s - The string to insert (usually just a single character)
-proc tkEntryInsert {w s} {
+proc ::tk::EntryInsert {w s} {
if {[string equal $s ""]} {
return
}
@@ -477,10 +475,10 @@ proc tkEntryInsert {w s} {
}
}
$w insert insert $s
- tkEntrySeeInsert $w
+ EntrySeeInsert $w
}
-# tkEntryBackspace --
+# ::tk::EntryBackspace --
# Backspace over the character just before the insertion cursor.
# If backspacing would move the cursor off the left edge of the
# window, reposition the cursor at about the middle of the window.
@@ -488,7 +486,7 @@ proc tkEntryInsert {w s} {
# Arguments:
# w - The entry window in which to backspace.
-proc tkEntryBackspace w {
+proc ::tk::EntryBackspace w {
if {[$w selection present]} {
$w delete sel.first sel.last
} else {
@@ -503,21 +501,21 @@ proc tkEntryBackspace w {
}
}
-# tkEntrySeeInsert --
+# ::tk::EntrySeeInsert --
# Make sure that the insertion cursor is visible in the entry window.
# If not, adjust the view so that it is.
#
# Arguments:
# w - The entry window.
-proc tkEntrySeeInsert w {
+proc ::tk::EntrySeeInsert w {
set c [$w index insert]
if {($c < [$w index @0]) || ($c > [$w index @[winfo width $w]])} {
$w xview $c
}
}
-# tkEntrySetCursor -
+# ::tk::EntrySetCursor -
# Move the insertion cursor to a given position in an entry. Also
# clears the selection, if there is one in the entry, and makes sure
# that the insertion cursor is visible.
@@ -526,13 +524,13 @@ proc tkEntrySeeInsert w {
# w - The entry window.
# pos - The desired new position for the cursor in the window.
-proc tkEntrySetCursor {w pos} {
+proc ::tk::EntrySetCursor {w pos} {
$w icursor $pos
$w selection clear
- tkEntrySeeInsert $w
+ EntrySeeInsert $w
}
-# tkEntryTranspose -
+# ::tk::EntryTranspose -
# This procedure implements the "transpose" function for entry widgets.
# It tranposes the characters on either side of the insertion cursor,
# unless the cursor is at the end of the line. In this case it
@@ -542,7 +540,7 @@ proc tkEntrySetCursor {w pos} {
# Arguments:
# w - The entry window.
-proc tkEntryTranspose w {
+proc ::tk::EntryTranspose w {
set i [$w index insert]
if {$i < [$w index end]} {
incr i
@@ -554,10 +552,10 @@ proc tkEntryTranspose w {
set new [string index [$w get] [expr {$i-1}]][string index [$w get] $first]
$w delete $first $i
$w insert insert $new
- tkEntrySeeInsert $w
+ EntrySeeInsert $w
}
-# tkEntryNextWord --
+# ::tk::EntryNextWord --
# Returns the index of the next word position after a given position in the
# entry. The next word is platform dependent and may be either the next
# end-of-word position or the next start-of-word position after the next
@@ -568,7 +566,7 @@ proc tkEntryTranspose w {
# start - Position at which to start search.
if {[string equal $tcl_platform(platform) "windows"]} {
- proc tkEntryNextWord {w start} {
+ proc ::tk::EntryNextWord {w start} {
set pos [tcl_endOfWord [$w get] [$w index $start]]
if {$pos >= 0} {
set pos [tcl_startOfNextWord [$w get] $pos]
@@ -579,7 +577,7 @@ if {[string equal $tcl_platform(platform) "windows"]} {
return $pos
}
} else {
- proc tkEntryNextWord {w start} {
+ proc ::tk::EntryNextWord {w start} {
set pos [tcl_endOfWord [$w get] [$w index $start]]
if {$pos < 0} {
return end
@@ -588,7 +586,7 @@ if {[string equal $tcl_platform(platform) "windows"]} {
}
}
-# tkEntryPreviousWord --
+# ::tk::EntryPreviousWord --
#
# Returns the index of the previous word position before a given
# position in the entry.
@@ -597,21 +595,21 @@ if {[string equal $tcl_platform(platform) "windows"]} {
# w - The entry window in which the cursor is to move.
# start - Position at which to start search.
-proc tkEntryPreviousWord {w start} {
+proc ::tk::EntryPreviousWord {w start} {
set pos [tcl_startOfPreviousWord [$w get] [$w index $start]]
if {$pos < 0} {
return 0
}
return $pos
}
-# tkEntryGetSelection --
+# ::tk::EntryGetSelection --
#
# Returns the selected text of the entry with respect to the -show option.
#
# Arguments:
# w - The entry window from which the text to get
-proc tkEntryGetSelection {w} {
+proc ::tk::EntryGetSelection {w} {
set entryString [string range [$w get] [$w index sel.first] \
[expr {[$w index sel.last] - 1}]]
if {[string compare [$w cget -show] ""]} {
diff --git a/library/focus.tcl b/library/focus.tcl
index 9a03ea1..75bf410 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.8 2000/05/09 17:28:31 hobbs Exp $
+# RCS: @(#) $Id: focus.tcl,v 1.9 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1994-1995 Sun Microsystems, Inc.
#
@@ -11,7 +11,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# tk_focusNext --
+# ::tk_focusNext --
# This procedure returns the name of the next window after "w" in
# "focus order" (the window that should receive the focus next if
# Tab is typed in w). "Next" is defined by a pre-order search
@@ -22,7 +22,7 @@
# Arguments:
# w - Name of a window.
-proc tk_focusNext w {
+proc ::tk_focusNext w {
set cur $w
while {1} {
@@ -57,13 +57,13 @@ proc tk_focusNext w {
set children [winfo children $parent]
set i [lsearch -exact $children $cur]
}
- if {[string equal $w $cur] || [tkFocusOK $cur]} {
+ if {[string equal $w $cur] || [tk::FocusOK $cur]} {
return $cur
}
}
}
-# tk_focusPrev --
+# ::tk_focusPrev --
# This procedure returns the name of the previous window before "w" in
# "focus order" (the window that should receive the focus next if
# Shift-Tab is typed in w). "Next" is defined by a pre-order search
@@ -74,7 +74,7 @@ proc tk_focusNext w {
# Arguments:
# w - Name of a window.
-proc tk_focusPrev w {
+proc ::tk_focusPrev w {
set cur $w
while {1} {
@@ -108,13 +108,13 @@ proc tk_focusPrev w {
set i [llength $children]
}
set cur $parent
- if {[string equal $w $cur] || [tkFocusOK $cur]} {
+ if {[string equal $w $cur] || [tk::FocusOK $cur]} {
return $cur
}
}
}
-# tkFocusOK --
+# ::tk::FocusOK --
#
# This procedure is invoked to decide whether or not to focus on
# a given window. It returns 1 if it's OK to focus on the window,
@@ -128,7 +128,7 @@ proc tk_focusPrev w {
# Arguments:
# w - Name of a window.
-proc tkFocusOK w {
+proc ::tk::FocusOK w {
set code [catch {$w cget -takefocus} value]
if {($code == 0) && ($value != "")} {
if {$value == 0} {
@@ -152,7 +152,7 @@ proc tkFocusOK w {
regexp Key|Focus "[bind $w] [bind [winfo class $w]]"
}
-# tk_focusFollowsMouse --
+# ::tk_focusFollowsMouse --
#
# If this procedure is invoked, Tk will enter "focus-follows-mouse"
# mode, where the focus is always on whatever window contains the
@@ -162,13 +162,13 @@ proc tkFocusOK w {
# Arguments:
# None.
-proc tk_focusFollowsMouse {} {
+proc ::tk_focusFollowsMouse {} {
set old [bind all <Enter>]
set script {
if {[string equal "%d" "NotifyAncestor"] \
|| [string equal "%d" "NotifyNonlinear"] \
|| [string equal "%d" "NotifyInferior"]} {
- if {[tkFocusOK %W]} {
+ if {[tk::FocusOK %W]} {
focus %W
}
}
diff --git a/library/listbox.tcl b/library/listbox.tcl
index 41b3d7a..6a51b66 100644
--- a/library/listbox.tcl
+++ b/library/listbox.tcl
@@ -3,7 +3,7 @@
# This file defines the default bindings for Tk listbox widgets
# and provides procedures that help in implementing those bindings.
#
-# RCS: @(#) $Id: listbox.tcl,v 1.11 2000/03/24 19:38:57 ericm Exp $
+# RCS: @(#) $Id: listbox.tcl,v 1.12 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1994 The Regents of the University of California.
# Copyright (c) 1994-1995 Sun Microsystems, Inc.
@@ -13,7 +13,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#--------------------------------------------------------------------------
-# tkPriv elements used in this file:
+# tk::Priv elements used in this file:
#
# afterId - Token returned by "after" for autoscanning.
# listboxPrev - The last element to be selected or deselected
@@ -35,7 +35,7 @@
bind Listbox <1> {
if {[winfo exists %W]} {
- tkListboxBeginSelect %W [%W index @%x,%y]
+ tk::ListboxBeginSelect %W [%W index @%x,%y]
}
}
@@ -48,40 +48,40 @@ bind Listbox <Double-1> {
}
bind Listbox <B1-Motion> {
- set tkPriv(x) %x
- set tkPriv(y) %y
- tkListboxMotion %W [%W index @%x,%y]
+ set tk::Priv(x) %x
+ set tk::Priv(y) %y
+ tk::ListboxMotion %W [%W index @%x,%y]
}
bind Listbox <ButtonRelease-1> {
- tkCancelRepeat
+ tk::CancelRepeat
%W activate @%x,%y
}
bind Listbox <Shift-1> {
- tkListboxBeginExtend %W [%W index @%x,%y]
+ tk::ListboxBeginExtend %W [%W index @%x,%y]
}
bind Listbox <Control-1> {
- tkListboxBeginToggle %W [%W index @%x,%y]
+ tk::ListboxBeginToggle %W [%W index @%x,%y]
}
bind Listbox <B1-Leave> {
- set tkPriv(x) %x
- set tkPriv(y) %y
- tkListboxAutoScan %W
+ set tk::Priv(x) %x
+ set tk::Priv(y) %y
+ tk::ListboxAutoScan %W
}
bind Listbox <B1-Enter> {
- tkCancelRepeat
+ tk::CancelRepeat
}
bind Listbox <Up> {
- tkListboxUpDown %W -1
+ tk::ListboxUpDown %W -1
}
bind Listbox <Shift-Up> {
- tkListboxExtendUpDown %W -1
+ tk::ListboxExtendUpDown %W -1
}
bind Listbox <Down> {
- tkListboxUpDown %W 1
+ tk::ListboxUpDown %W 1
}
bind Listbox <Shift-Down> {
- tkListboxExtendUpDown %W 1
+ tk::ListboxExtendUpDown %W 1
}
bind Listbox <Left> {
%W xview scroll -1 units
@@ -123,7 +123,7 @@ bind Listbox <Control-Home> {
event generate %W <<ListboxSelect>>
}
bind Listbox <Shift-Control-Home> {
- tkListboxDataExtend %W 0
+ tk::ListboxDataExtend %W 0
}
bind Listbox <Control-End> {
%W activate end
@@ -133,7 +133,7 @@ bind Listbox <Control-End> {
event generate %W <<ListboxSelect>>
}
bind Listbox <Shift-Control-End> {
- tkListboxDataExtend %W [%W index end]
+ tk::ListboxDataExtend %W [%W index end]
}
bind Listbox <<Copy>> {
if {[string equal [selection own -displayof %W] "%W"]} {
@@ -142,22 +142,22 @@ bind Listbox <<Copy>> {
}
}
bind Listbox <space> {
- tkListboxBeginSelect %W [%W index active]
+ tk::ListboxBeginSelect %W [%W index active]
}
bind Listbox <Select> {
- tkListboxBeginSelect %W [%W index active]
+ tk::ListboxBeginSelect %W [%W index active]
}
bind Listbox <Control-Shift-space> {
- tkListboxBeginExtend %W [%W index active]
+ tk::ListboxBeginExtend %W [%W index active]
}
bind Listbox <Shift-Select> {
- tkListboxBeginExtend %W [%W index active]
+ tk::ListboxBeginExtend %W [%W index active]
}
bind Listbox <Escape> {
- tkListboxCancel %W
+ tk::ListboxCancel %W
}
bind Listbox <Control-slash> {
- tkListboxSelectAll %W
+ tk::ListboxSelectAll %W
}
bind Listbox <Control-backslash> {
if {[string compare [%W cget -selectmode] "browse"]} {
@@ -200,7 +200,7 @@ if {[string equal "unix" $tcl_platform(platform)]} {
}
}
-# tkListboxBeginSelect --
+# ::tk::ListboxBeginSelect --
#
# This procedure is typically invoked on button-1 presses. It begins
# the process of making a selection in the listbox. Its exact behavior
@@ -212,8 +212,8 @@ if {[string equal "unix" $tcl_platform(platform)]} {
# el - The element for the selection operation (typically the
# one under the pointer). Must be in numerical form.
-proc tkListboxBeginSelect {w el} {
- global tkPriv
+proc ::tk::ListboxBeginSelect {w el} {
+ variable ::tk::Priv
if {[string equal [$w cget -selectmode] "multiple"]} {
if {[$w selection includes $el]} {
$w selection clear $el
@@ -224,13 +224,13 @@ proc tkListboxBeginSelect {w el} {
$w selection clear 0 end
$w selection set $el
$w selection anchor $el
- set tkPriv(listboxSelection) {}
- set tkPriv(listboxPrev) $el
+ set Priv(listboxSelection) {}
+ set Priv(listboxPrev) $el
}
event generate $w <<ListboxSelect>>
}
-# tkListboxMotion --
+# ::tk::ListboxMotion --
#
# This procedure is called to process mouse motion events while
# button 1 is down. It may move or extend the selection, depending
@@ -240,9 +240,9 @@ proc tkListboxBeginSelect {w el} {
# w - The listbox widget.
# el - The element under the pointer (must be a number).
-proc tkListboxMotion {w el} {
- global tkPriv
- if {$el == $tkPriv(listboxPrev)} {
+proc ::tk::ListboxMotion {w el} {
+ variable ::tk::Priv
+ if {$el == $Priv(listboxPrev)} {
return
}
set anchor [$w index anchor]
@@ -250,11 +250,11 @@ proc tkListboxMotion {w el} {
browse {
$w selection clear 0 end
$w selection set $el
- set tkPriv(listboxPrev) $el
+ set Priv(listboxPrev) $el
event generate $w <<ListboxSelect>>
}
extended {
- set i $tkPriv(listboxPrev)
+ set i $Priv(listboxPrev)
if {[string equal {} $i]} {
set i $el
$w selection set $el
@@ -266,28 +266,28 @@ proc tkListboxMotion {w el} {
$w selection clear $i $el
$w selection clear anchor $el
}
- if {![info exists tkPriv(listboxSelection)]} {
- set tkPriv(listboxSelection) [$w curselection]
+ if {![info exists Priv(listboxSelection)]} {
+ set Priv(listboxSelection) [$w curselection]
}
while {($i < $el) && ($i < $anchor)} {
- if {[lsearch $tkPriv(listboxSelection) $i] >= 0} {
+ if {[lsearch $Priv(listboxSelection) $i] >= 0} {
$w selection set $i
}
incr i
}
while {($i > $el) && ($i > $anchor)} {
- if {[lsearch $tkPriv(listboxSelection) $i] >= 0} {
+ if {[lsearch $Priv(listboxSelection) $i] >= 0} {
$w selection set $i
}
incr i -1
}
- set tkPriv(listboxPrev) $el
+ set Priv(listboxPrev) $el
event generate $w <<ListboxSelect>>
}
}
}
-# tkListboxBeginExtend --
+# ::tk::ListboxBeginExtend --
#
# This procedure is typically invoked on shift-button-1 presses. It
# begins the process of extending a selection in the listbox. Its
@@ -299,18 +299,18 @@ proc tkListboxMotion {w el} {
# el - The element for the selection operation (typically the
# one under the pointer). Must be in numerical form.
-proc tkListboxBeginExtend {w el} {
+proc ::tk::ListboxBeginExtend {w el} {
if {[string equal [$w cget -selectmode] "extended"]} {
if {[$w selection includes anchor]} {
- tkListboxMotion $w $el
+ ListboxMotion $w $el
} else {
# No selection yet; simulate the begin-select operation.
- tkListboxBeginSelect $w $el
+ ListboxBeginSelect $w $el
}
}
}
-# tkListboxBeginToggle --
+# ::tk::ListboxBeginToggle --
#
# This procedure is typically invoked on control-button-1 presses. It
# begins the process of toggling a selection in the listbox. Its
@@ -322,11 +322,11 @@ proc tkListboxBeginExtend {w el} {
# el - The element for the selection operation (typically the
# one under the pointer). Must be in numerical form.
-proc tkListboxBeginToggle {w el} {
- global tkPriv
+proc ::tk::ListboxBeginToggle {w el} {
+ variable ::tk::Priv
if {[string equal [$w cget -selectmode] "extended"]} {
- set tkPriv(listboxSelection) [$w curselection]
- set tkPriv(listboxPrev) $el
+ set Priv(listboxSelection) [$w curselection]
+ set Priv(listboxPrev) $el
$w selection anchor $el
if {[$w selection includes $el]} {
$w selection clear $el
@@ -337,7 +337,7 @@ proc tkListboxBeginToggle {w el} {
}
}
-# tkListboxAutoScan --
+# ::tk::ListboxAutoScan --
# This procedure is invoked when the mouse leaves an entry window
# with button 1 down. It scrolls the window up, down, left, or
# right, depending on where the mouse left the window, and reschedules
@@ -347,11 +347,11 @@ proc tkListboxBeginToggle {w el} {
# Arguments:
# w - The entry window.
-proc tkListboxAutoScan {w} {
- global tkPriv
+proc ::tk::ListboxAutoScan {w} {
+ variable ::tk::Priv
if {![winfo exists $w]} return
- set x $tkPriv(x)
- set y $tkPriv(y)
+ set x $Priv(x)
+ set y $Priv(y)
if {$y >= [winfo height $w]} {
$w yview scroll 1 units
} elseif {$y < 0} {
@@ -363,11 +363,11 @@ proc tkListboxAutoScan {w} {
} else {
return
}
- tkListboxMotion $w [$w index @$x,$y]
- set tkPriv(afterId) [after 50 [list tkListboxAutoScan $w]]
+ ListboxMotion $w [$w index @$x,$y]
+ set Priv(afterId) [after 50 [list tk::ListboxAutoScan $w]]
}
-# tkListboxUpDown --
+# ::tk::ListboxUpDown --
#
# Moves the location cursor (active element) up or down by one element,
# and changes the selection if we're in browse or extended selection
@@ -377,8 +377,8 @@ proc tkListboxAutoScan {w} {
# w - The listbox widget.
# amount - +1 to move down one item, -1 to move back one item.
-proc tkListboxUpDown {w amount} {
- global tkPriv
+proc ::tk::ListboxUpDown {w amount} {
+ variable ::tk::Priv
$w activate [expr {[$w index active] + $amount}]
$w see active
switch [$w cget -selectmode] {
@@ -391,14 +391,14 @@ proc tkListboxUpDown {w amount} {
$w selection clear 0 end
$w selection set active
$w selection anchor active
- set tkPriv(listboxPrev) [$w index active]
- set tkPriv(listboxSelection) {}
+ set Priv(listboxPrev) [$w index active]
+ set Priv(listboxSelection) {}
event generate $w <<ListboxSelect>>
}
}
}
-# tkListboxExtendUpDown --
+# ::tk::ListboxExtendUpDown --
#
# Does nothing unless we're in extended selection mode; in this
# case it moves the location cursor (active element) up or down by
@@ -408,22 +408,22 @@ proc tkListboxUpDown {w amount} {
# w - The listbox widget.
# amount - +1 to move down one item, -1 to move back one item.
-proc tkListboxExtendUpDown {w amount} {
+proc ::tk::ListboxExtendUpDown {w amount} {
+ variable ::tk::Priv
if {[string compare [$w cget -selectmode] "extended"]} {
return
}
set active [$w index active]
- if {![info exists tkPriv(listboxSelection)]} {
- global tkPriv
+ if {![info exists Priv(listboxSelection)]} {
$w selection set $active
- set tkPriv(listboxSelection) [$w curselection]
+ set Priv(listboxSelection) [$w curselection]
}
$w activate [expr {$active + $amount}]
$w see active
- tkListboxMotion $w [$w index active]
+ ListboxMotion $w [$w index active]
}
-# tkListboxDataExtend
+# ::tk::ListboxDataExtend
#
# This procedure is called for key-presses such as Shift-KEndData.
# If the selection mode isn't multiple or extend then it does nothing.
@@ -434,13 +434,13 @@ proc tkListboxExtendUpDown {w amount} {
# w - The listbox widget.
# el - An integer element number.
-proc tkListboxDataExtend {w el} {
+proc ::tk::ListboxDataExtend {w el} {
set mode [$w cget -selectmode]
if {[string equal $mode "extended"]} {
$w activate $el
$w see $el
if {[$w selection includes anchor]} {
- tkListboxMotion $w $el
+ ListboxMotion $w $el
}
} elseif {[string equal $mode "multiple"]} {
$w activate $el
@@ -448,7 +448,7 @@ proc tkListboxDataExtend {w el} {
}
}
-# tkListboxCancel
+# ::tk::ListboxCancel
#
# This procedure is invoked to cancel an extended selection in
# progress. If there is an extended selection in progress, it
@@ -458,13 +458,13 @@ proc tkListboxDataExtend {w el} {
# Arguments:
# w - The listbox widget.
-proc tkListboxCancel w {
- global tkPriv
+proc ::tk::ListboxCancel w {
+ variable ::tk::Priv
if {[string compare [$w cget -selectmode] "extended"]} {
return
}
set first [$w index anchor]
- set last $tkPriv(listboxPrev)
+ set last $Priv(listboxPrev)
if { [string equal $last ""] } {
# Not actually doing any selection right now
return
@@ -476,7 +476,7 @@ proc tkListboxCancel w {
}
$w selection clear $first $last
while {$first <= $last} {
- if {[lsearch $tkPriv(listboxSelection) $first] >= 0} {
+ if {[lsearch $Priv(listboxSelection) $first] >= 0} {
$w selection set $first
}
incr first
@@ -484,7 +484,7 @@ proc tkListboxCancel w {
event generate $w <<ListboxSelect>>
}
-# tkListboxSelectAll
+# ::tk::ListboxSelectAll
#
# This procedure is invoked to handle the "select all" operation.
# For single and browse mode, it just selects the active element.
@@ -493,7 +493,7 @@ proc tkListboxCancel w {
# Arguments:
# w - The listbox widget.
-proc tkListboxSelectAll w {
+proc ::tk::ListboxSelectAll w {
set mode [$w cget -selectmode]
if {[string equal $mode "single"] || [string equal $mode "browse"]} {
$w selection clear 0 end
diff --git a/library/menu.tcl b/library/menu.tcl
index cd1260f..c9d9c8f 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -4,7 +4,7 @@
# It also implements keyboard traversal of menus and implements a few
# other utility procedures related to menus.
#
-# RCS: @(#) $Id: menu.tcl,v 1.12 2000/04/17 19:32:00 ericm Exp $
+# RCS: @(#) $Id: menu.tcl,v 1.13 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
@@ -15,13 +15,13 @@
#
#-------------------------------------------------------------------------
-# Elements of tkPriv that are used in this file:
+# Elements of tk::Priv that are used in this file:
#
# cursor - Saves the -cursor option for the posted menubutton.
# focus - Saves the focus during a menu selection operation.
# Focus gets restored here when the menu is unposted.
-# grabGlobal - Used in conjunction with tkPriv(oldGrab): if
-# tkPriv(oldGrab) is non-empty, then tkPriv(grabGlobal)
+# grabGlobal - Used in conjunction with tk::Priv(oldGrab): if
+# tk::Priv(oldGrab) is non-empty, then tk::Priv(grabGlobal)
# contains either an empty string or "-global" to
# indicate whether the old grab was a local one or
# a global one.
@@ -62,14 +62,14 @@
# can be used:
#
# 1. As a pulldown from a menubutton. In this style, the variable
-# tkPriv(postedMb) identifies the posted menubutton.
+# tk::Priv(postedMb) identifies the posted menubutton.
# 2. As a torn-off menu copied from some other menu. In this style
-# tkPriv(postedMb) is empty, and menu's type is "tearoff".
+# tk::Priv(postedMb) is empty, and menu's type is "tearoff".
# 3. As an option menu, triggered from an option menubutton. In this
-# style tkPriv(postedMb) identifies the posted menubutton.
-# 4. As a popup menu. In this style tkPriv(postedMb) is empty and
+# style tk::Priv(postedMb) identifies the posted menubutton.
+# 4. As a popup menu. In this style tk::Priv(postedMb) is empty and
# the top-level menu's type is "normal".
-# 5. As a pulldown from a menubar. The variable tkPriv(menubar) has
+# 5. As a pulldown from a menubar. The variable tk::Priv(menubar) has
# the owning menubar, and the menu itself is of type "normal".
#
# The various binding procedures use the state described above to
@@ -84,28 +84,28 @@
bind Menubutton <FocusIn> {}
bind Menubutton <Enter> {
- tkMbEnter %W
+ tk::MbEnter %W
}
bind Menubutton <Leave> {
- tkMbLeave %W
+ tk::MbLeave %W
}
bind Menubutton <1> {
- if {[string compare $tkPriv(inMenubutton) ""]} {
- tkMbPost $tkPriv(inMenubutton) %X %Y
+ if {[string compare $tk::Priv(inMenubutton) ""]} {
+ tk::MbPost $tk::Priv(inMenubutton) %X %Y
}
}
bind Menubutton <Motion> {
- tkMbMotion %W up %X %Y
+ tk::MbMotion %W up %X %Y
}
bind Menubutton <B1-Motion> {
- tkMbMotion %W down %X %Y
+ tk::MbMotion %W down %X %Y
}
bind Menubutton <ButtonRelease-1> {
- tkMbButtonUp %W
+ tk::MbButtonUp %W
}
bind Menubutton <space> {
- tkMbPost %W
- tkMenuFirstEntry [%W cget -menu]
+ tk::MbPost %W
+ tk::MenuFirstEntry [%W cget -menu]
}
# Must set focus when mouse enters a menu, in order to allow
@@ -118,7 +118,7 @@ bind Menubutton <space> {
bind Menu <FocusIn> {}
bind Menu <Enter> {
- set tkPriv(window) %W
+ set tk::Priv(window) %W
if {[string equal [%W cget -type] "tearoff"]} {
if {[string compare "%m" "NotifyUngrab"]} {
if {[string equal $tcl_platform(platform) "unix"]} {
@@ -126,44 +126,44 @@ bind Menu <Enter> {
}
}
}
- tkMenuMotion %W %x %y %s
+ tk::MenuMotion %W %x %y %s
}
bind Menu <Leave> {
- tkMenuLeave %W %X %Y %s
+ tk::MenuLeave %W %X %Y %s
}
bind Menu <Motion> {
- tkMenuMotion %W %x %y %s
+ tk::MenuMotion %W %x %y %s
}
bind Menu <ButtonPress> {
- tkMenuButtonDown %W
+ tk::MenuButtonDown %W
}
bind Menu <ButtonRelease> {
- tkMenuInvoke %W 1
+ tk::MenuInvoke %W 1
}
bind Menu <space> {
- tkMenuInvoke %W 0
+ tk::MenuInvoke %W 0
}
bind Menu <Return> {
- tkMenuInvoke %W 0
+ tk::MenuInvoke %W 0
}
bind Menu <Escape> {
- tkMenuEscape %W
+ tk::MenuEscape %W
}
bind Menu <Left> {
- tkMenuLeftArrow %W
+ tk::MenuLeftArrow %W
}
bind Menu <Right> {
- tkMenuRightArrow %W
+ tk::MenuRightArrow %W
}
bind Menu <Up> {
- tkMenuUpArrow %W
+ tk::MenuUpArrow %W
}
bind Menu <Down> {
- tkMenuDownArrow %W
+ tk::MenuDownArrow %W
}
bind Menu <KeyPress> {
- tkTraverseWithinMenu %W %A
+ tk::TraverseWithinMenu %W %A
}
# The following bindings apply to all windows, and are used to
@@ -171,54 +171,54 @@ bind Menu <KeyPress> {
if {[string equal $tcl_platform(platform) "unix"]} {
bind all <Alt-KeyPress> {
- tkTraverseToMenu %W %A
+ tk::TraverseToMenu %W %A
}
bind all <F10> {
- tkFirstMenu %W
+ tk::FirstMenu %W
}
} else {
bind Menubutton <Alt-KeyPress> {
- tkTraverseToMenu %W %A
+ tk::TraverseToMenu %W %A
}
bind Menubutton <F10> {
- tkFirstMenu %W
+ tk::FirstMenu %W
}
}
-# tkMbEnter --
+# ::tk::MbEnter --
# This procedure is invoked when the mouse enters a menubutton
# widget. It activates the widget unless it is disabled. Note:
# this procedure is only invoked when mouse button 1 is *not* down.
-# The procedure tkMbB1Enter is invoked if the button is down.
+# The procedure ::tk::MbB1Enter is invoked if the button is down.
#
# Arguments:
# w - The name of the widget.
-proc tkMbEnter w {
- global tkPriv
+proc ::tk::MbEnter w {
+ variable ::tk::Priv
- if {[string compare $tkPriv(inMenubutton) ""]} {
- tkMbLeave $tkPriv(inMenubutton)
+ if {[string compare $Priv(inMenubutton) ""]} {
+ MbLeave $Priv(inMenubutton)
}
- set tkPriv(inMenubutton) $w
+ set Priv(inMenubutton) $w
if {[string compare [$w cget -state] "disabled"]} {
$w configure -state active
}
}
-# tkMbLeave --
+# ::tk::MbLeave --
# This procedure is invoked when the mouse leaves a menubutton widget.
# It de-activates the widget, if the widget still exists.
#
# Arguments:
# w - The name of the widget.
-proc tkMbLeave w {
- global tkPriv
+proc ::tk::MbLeave w {
+ variable ::tk::Priv
- set tkPriv(inMenubutton) {}
+ set Priv(inMenubutton) {}
if {![winfo exists $w]} {
return
}
@@ -227,7 +227,7 @@ proc tkMbLeave w {
}
}
-# tkMbPost --
+# ::tk::MbPost --
# Given a menubutton, this procedure does all the work of posting
# its associated menu and unposting any other menu that is currently
# posted.
@@ -239,12 +239,13 @@ proc tkMbLeave w {
# option menus. If not specified, then the center
# of the menubutton is used for an option menu.
-proc tkMbPost {w {x {}} {y {}}} {
- global tkPriv errorInfo
+proc ::tk::MbPost {w {x {}} {y {}}} {
+ global errorInfo
+ variable ::tk::Priv
global tcl_platform
if {[string equal [$w cget -state] "disabled"] || \
- [string equal $w $tkPriv(postedMb)]} {
+ [string equal $w $Priv(postedMb)]} {
return
}
set menu [$w cget -menu]
@@ -256,19 +257,19 @@ proc tkMbPost {w {x {}} {y {}}} {
if {[string first $w $menu] != 0} {
error "can't post $menu: it isn't a descendant of $w (this is a new requirement in Tk versions 3.0 and later)"
}
- set cur $tkPriv(postedMb)
+ set cur $Priv(postedMb)
if {[string compare $cur ""]} {
- tkMenuUnpost {}
+ MenuUnpost {}
}
- set tkPriv(cursor) [$w cget -cursor]
- set tkPriv(relief) [$w cget -relief]
+ set Priv(cursor) [$w cget -cursor]
+ set Priv(relief) [$w cget -relief]
$w configure -cursor arrow
$w configure -relief raised
- set tkPriv(postedMb) $w
- set tkPriv(focus) [focus]
+ set Priv(postedMb) $w
+ set Priv(focus) [focus]
$menu activate none
- tkGenerateMenuSelect $menu
+ GenerateMenuSelect $menu
# If this looks like an option menubutton then post the menu so
# that the current entry is on top of the mouse. Otherwise post
@@ -290,7 +291,7 @@ proc tkMbPost {w {x {}} {y {}}} {
left {
set x [expr {[winfo rootx $w] - [winfo reqwidth $menu]}]
set y [expr {(2 * [winfo rooty $w] + [winfo height $w]) / 2}]
- set entry [tkMenuFindName $menu [$w cget -text]]
+ set entry [MenuFindName $menu [$w cget -text]]
if {[$w cget -indicatoron]} {
if {$entry == [$menu index last]} {
incr y [expr {-([$menu yposition $entry] \
@@ -303,13 +304,13 @@ proc tkMbPost {w {x {}} {y {}}} {
$menu post $x $y
if {[string compare $entry {}] && [string compare [$menu entrycget $entry -state] "disabled"]} {
$menu activate $entry
- tkGenerateMenuSelect $menu
+ GenerateMenuSelect $menu
}
}
right {
set x [expr {[winfo rootx $w] + [winfo width $w]}]
set y [expr {(2 * [winfo rooty $w] + [winfo height $w]) / 2}]
- set entry [tkMenuFindName $menu [$w cget -text]]
+ set entry [MenuFindName $menu [$w cget -text]]
if {[$w cget -indicatoron]} {
if {$entry == [$menu index last]} {
incr y [expr {-([$menu yposition $entry] \
@@ -322,7 +323,7 @@ proc tkMbPost {w {x {}} {y {}}} {
$menu post $x $y
if {[string compare $entry {}] && [string compare [$menu entrycget $entry -state] "disabled"]} {
$menu activate $entry
- tkGenerateMenuSelect $menu
+ GenerateMenuSelect $menu
}
}
default {
@@ -331,7 +332,7 @@ proc tkMbPost {w {x {}} {y {}}} {
set x [expr {[winfo rootx $w] + [winfo width $w]/2}]
set y [expr {[winfo rooty $w] + [winfo height $w]/2}]
}
- tkPostOverPoint $menu $x $y [tkMenuFindName $menu [$w cget -text]]
+ PostOverPoint $menu $x $y [MenuFindName $menu [$w cget -text]]
} else {
$menu post [winfo rootx $w] [expr {[winfo rooty $w]+[winfo height $w]}]
}
@@ -342,22 +343,22 @@ proc tkMbPost {w {x {}} {y {}}} {
# reflect the error.
set savedInfo $errorInfo
- tkMenuUnpost {}
+ MenuUnpost {}
error $msg $savedInfo
}
- set tkPriv(tearoff) $tearoff
+ set Priv(tearoff) $tearoff
if {$tearoff != 0} {
focus $menu
if {[winfo viewable $w]} {
- tkSaveGrabInfo $w
+ SaveGrabInfo $w
grab -global $w
}
}
}
-# tkMenuUnpost --
+# ::tk::MenuUnpost --
# This procedure unposts a given menu, plus all of its ancestors up
# to (and including) a menubutton, if any. It also restores various
# values to what they were before the menu was posted, and releases
@@ -373,17 +374,17 @@ proc tkMbPost {w {x {}} {y {}}} {
# menu - Name of a menu to unpost. Ignored if there
# is a posted menubutton.
-proc tkMenuUnpost menu {
+proc ::tk::MenuUnpost menu {
global tcl_platform
- global tkPriv
- set mb $tkPriv(postedMb)
+ variable ::tk::Priv
+ set mb $Priv(postedMb)
# Restore focus right away (otherwise X will take focus away when
# the menu is unmapped and under some window managers (e.g. olvwm)
# we'll lose the focus completely).
- catch {focus $tkPriv(focus)}
- set tkPriv(focus) ""
+ catch {focus $Priv(focus)}
+ set Priv(focus) ""
# Unpost menu(s) and restore some stuff that's dependent on
# what was posted.
@@ -392,12 +393,12 @@ proc tkMenuUnpost menu {
if {[string compare $mb ""]} {
set menu [$mb cget -menu]
$menu unpost
- set tkPriv(postedMb) {}
- $mb configure -cursor $tkPriv(cursor)
- $mb configure -relief $tkPriv(relief)
- } elseif {[string compare $tkPriv(popup) ""]} {
- $tkPriv(popup) unpost
- set tkPriv(popup) {}
+ set Priv(postedMb) {}
+ $mb configure -cursor $Priv(cursor)
+ $mb configure -relief $Priv(relief)
+ } elseif {[string compare $Priv(popup) ""]} {
+ $Priv(popup) unpost
+ set Priv(popup) {}
} elseif {[string compare [$menu cget -type] "menubar"] \
&& [string compare [$menu cget -type] "tearoff"]} {
# We're in a cascaded sub-menu from a torn-off menu or popup.
@@ -413,7 +414,7 @@ proc tkMenuUnpost menu {
}
$parent activate none
$parent postcascade none
- tkGenerateMenuSelect $parent
+ GenerateMenuSelect $parent
set type [$parent cget -type]
if {[string equal $type "menubar"] || \
[string equal $type "tearoff"]} {
@@ -427,7 +428,7 @@ proc tkMenuUnpost menu {
}
}
- if {($tkPriv(tearoff) != 0) || [string compare $tkPriv(menuBar) ""]} {
+ if {($Priv(tearoff) != 0) || [string compare $Priv(menuBar) ""]} {
# Release grab, if any, and restore the previous grab, if there
# was one.
if {[string compare $menu ""]} {
@@ -436,18 +437,18 @@ proc tkMenuUnpost menu {
grab release $grab
}
}
- tkRestoreOldGrab
- if {[string compare $tkPriv(menuBar) ""]} {
- $tkPriv(menuBar) configure -cursor $tkPriv(cursor)
- set tkPriv(menuBar) {}
+ RestoreOldGrab
+ if {[string compare $Priv(menuBar) ""]} {
+ $Priv(menuBar) configure -cursor $Priv(cursor)
+ set Priv(menuBar) {}
}
if {[string compare $tcl_platform(platform) "unix"]} {
- set tkPriv(tearoff) 0
+ set Priv(tearoff) 0
}
}
}
-# tkMbMotion --
+# ::tk::MbMotion --
# This procedure handles mouse motion events inside menubuttons, and
# also outside menubuttons when a menubutton has a grab (e.g. when a
# menu selection operation is in progress).
@@ -458,33 +459,33 @@ proc tkMenuUnpost menu {
# it isn't.
# rootx, rooty - Coordinates of mouse, in (virtual?) root window.
-proc tkMbMotion {w upDown rootx rooty} {
- global tkPriv
+proc ::tk::MbMotion {w upDown rootx rooty} {
+ variable ::tk::Priv
- if {[string equal $tkPriv(inMenubutton) $w]} {
+ if {[string equal $Priv(inMenubutton) $w]} {
return
}
set new [winfo containing $rootx $rooty]
- if {[string compare $new $tkPriv(inMenubutton)] \
+ if {[string compare $new $Priv(inMenubutton)] \
&& ([string equal $new ""] \
|| [string equal [winfo toplevel $new] [winfo toplevel $w]])} {
- if {[string compare $tkPriv(inMenubutton) ""]} {
- tkMbLeave $tkPriv(inMenubutton)
+ if {[string compare $Priv(inMenubutton) ""]} {
+ MbLeave $Priv(inMenubutton)
}
if {[string compare $new ""] \
&& [string equal [winfo class $new] "Menubutton"] \
&& ([$new cget -indicatoron] == 0) \
&& ([$w cget -indicatoron] == 0)} {
if {[string equal $upDown "down"]} {
- tkMbPost $new $rootx $rooty
+ MbPost $new $rootx $rooty
} else {
- tkMbEnter $new
+ MbEnter $new
}
}
}
}
-# tkMbButtonUp --
+# ::tk::MbButtonUp --
# This procedure is invoked to handle button 1 releases for menubuttons.
# If the release happens inside the menubutton then leave its menu
# posted with element 0 activated. Otherwise, unpost the menu.
@@ -492,23 +493,23 @@ proc tkMbMotion {w upDown rootx rooty} {
# Arguments:
# w - The name of the menubutton widget.
-proc tkMbButtonUp w {
- global tkPriv
+proc ::tk::MbButtonUp w {
+ variable ::tk::Priv
global tcl_platform
set menu [$w cget -menu]
set tearoff [expr {[string equal $tcl_platform(platform) "unix"] || \
([string compare $menu {}] && \
[string equal [$menu cget -type] "tearoff"])}]
- if {($tearoff != 0) && [string equal $tkPriv(postedMb) $w] \
- && [string equal $tkPriv(inMenubutton) $w]} {
- tkMenuFirstEntry [$tkPriv(postedMb) cget -menu]
+ if {($tearoff != 0) && [string equal $Priv(postedMb) $w] \
+ && [string equal $Priv(inMenubutton) $w]} {
+ MenuFirstEntry [$Priv(postedMb) cget -menu]
} else {
- tkMenuUnpost {}
+ MenuUnpost {}
}
}
-# tkMenuMotion --
+# ::tk::MenuMotion --
# This procedure is called to handle mouse motion events for menus.
# It does two things. First, it resets the active element in the
# menu, if the mouse is over the menu. Second, if a mouse button
@@ -521,18 +522,18 @@ proc tkMbButtonUp w {
# y - The y position of the mouse.
# state - Modifier state (tells whether buttons are down).
-proc tkMenuMotion {menu x y state} {
- global tkPriv
- if {[string equal $menu $tkPriv(window)]} {
+proc ::tk::MenuMotion {menu x y state} {
+ variable ::tk::Priv
+ if {[string equal $menu $Priv(window)]} {
if {[string equal [$menu cget -type] "menubar"]} {
- if {[info exists tkPriv(focus)] && \
- [string compare $menu $tkPriv(focus)]} {
+ if {[info exists Priv(focus)] && \
+ [string compare $menu $Priv(focus)]} {
$menu activate @$x,$y
- tkGenerateMenuSelect $menu
+ GenerateMenuSelect $menu
}
} else {
$menu activate @$x,$y
- tkGenerateMenuSelect $menu
+ GenerateMenuSelect $menu
}
}
if {($state & 0x1f00) != 0} {
@@ -540,7 +541,7 @@ proc tkMenuMotion {menu x y state} {
}
}
-# tkMenuButtonDown --
+# ::tk::MenuButtonDown --
# Handles button presses in menus. There are a couple of tricky things
# here:
# 1. Change the posted cascade entry (if any) to match the mouse position.
@@ -555,17 +556,17 @@ proc tkMenuMotion {menu x y state} {
# Arguments:
# menu - The menu window.
-proc tkMenuButtonDown menu {
- global tkPriv
+proc ::tk::MenuButtonDown menu {
+ variable ::tk::Priv
global tcl_platform
if {![winfo viewable $menu]} {
return
}
$menu postcascade active
- if {[string compare $tkPriv(postedMb) ""] && \
- [winfo viewable $tkPriv(postedMb)]} {
- grab -global $tkPriv(postedMb)
+ if {[string compare $Priv(postedMb) ""] && \
+ [winfo viewable $Priv(postedMb)]} {
+ grab -global $Priv(postedMb)
} else {
while {[string equal [$menu cget -type] "normal"] \
&& [string equal [winfo class [winfo parent $menu]] "Menu"] \
@@ -573,9 +574,9 @@ proc tkMenuButtonDown menu {
set menu [winfo parent $menu]
}
- if {[string equal $tkPriv(menuBar) {}]} {
- set tkPriv(menuBar) $menu
- set tkPriv(cursor) [$menu cget -cursor]
+ if {[string equal $Priv(menuBar) {}]} {
+ set Priv(menuBar) $menu
+ set Priv(cursor) [$menu cget -cursor]
$menu configure -cursor arrow
}
@@ -585,7 +586,7 @@ proc tkMenuButtonDown menu {
# anymore.
if {[string compare $menu [grab current $menu]]} {
- tkSaveGrabInfo $menu
+ SaveGrabInfo $menu
}
# Must re-grab even if the grab window hasn't changed, in order
@@ -597,7 +598,7 @@ proc tkMenuButtonDown menu {
}
}
-# tkMenuLeave --
+# ::tk::MenuLeave --
# This procedure is invoked to handle Leave events for a menu. It
# deactivates everything unless the active element is a cascade element
# and the mouse is now over the submenu.
@@ -607,9 +608,9 @@ proc tkMenuButtonDown menu {
# rootx, rooty - Root coordinates of mouse.
# state - Modifier state.
-proc tkMenuLeave {menu rootx rooty state} {
- global tkPriv
- set tkPriv(window) {}
+proc ::tk::MenuLeave {menu rootx rooty state} {
+ variable ::tk::Priv
+ set Priv(window) {}
if {[string equal [$menu index active] "none"]} {
return
}
@@ -619,10 +620,10 @@ proc tkMenuLeave {menu rootx rooty state} {
return
}
$menu activate none
- tkGenerateMenuSelect $menu
+ GenerateMenuSelect $menu
}
-# tkMenuInvoke --
+# ::tk::MenuInvoke --
# This procedure is invoked when button 1 is released over a menu.
# It invokes the appropriate menu action and unposts the menu if
# it came from a menubutton.
@@ -632,10 +633,10 @@ proc tkMenuLeave {menu rootx rooty state} {
# buttonRelease - 1 means this procedure is called because of
# a button release; 0 means because of keystroke.
-proc tkMenuInvoke {w buttonRelease} {
- global tkPriv
+proc ::tk::MenuInvoke {w buttonRelease} {
+ variable ::tk::Priv
- if {$buttonRelease && [string equal $tkPriv(window) {}]} {
+ if {$buttonRelease && [string equal $Priv(window) {}]} {
# Mouse was pressed over a menu without a menu button, then
# dragged off the menu (possibly with a cascade posted) and
# released. Unpost everything and quit.
@@ -643,16 +644,16 @@ proc tkMenuInvoke {w buttonRelease} {
$w postcascade none
$w activate none
event generate $w <<MenuSelect>>
- tkMenuUnpost $w
+ MenuUnpost $w
return
}
if {[string equal [$w type active] "cascade"]} {
$w postcascade active
set menu [$w entrycget active -menu]
- tkMenuFirstEntry $menu
+ MenuFirstEntry $menu
} elseif {[string equal [$w type active] "tearoff"]} {
- tkTearOffMenu $w
- tkMenuUnpost $w
+ ::tk::TearOffMenu $w
+ MenuUnpost $w
} elseif {[string equal [$w cget -type] "menubar"]} {
$w postcascade none
set active [$w index active]
@@ -667,7 +668,7 @@ proc tkMenuInvoke {w buttonRelease} {
event generate $w <<MenuSelect>>
}
- tkMenuUnpost $w
+ MenuUnpost $w
# If the active item is not a cascade, invoke it. This enables
# the use of checkbuttons/commands/etc. on menubars (which is legal,
@@ -677,12 +678,12 @@ proc tkMenuInvoke {w buttonRelease} {
uplevel #0 [list $w invoke $active]
}
} else {
- tkMenuUnpost $w
+ MenuUnpost $w
uplevel #0 [list $w invoke active]
}
}
-# tkMenuEscape --
+# ::tk::MenuEscape --
# This procedure is invoked for the Cancel (or Escape) key. It unposts
# the given menu and, if it is the top-level menu for a menu button,
# unposts the menu button as well.
@@ -690,54 +691,54 @@ proc tkMenuInvoke {w buttonRelease} {
# Arguments:
# menu - Name of the menu window.
-proc tkMenuEscape menu {
+proc ::tk::MenuEscape menu {
set parent [winfo parent $menu]
if {[string compare [winfo class $parent] "Menu"]} {
- tkMenuUnpost $menu
+ MenuUnpost $menu
} elseif {[string equal [$parent cget -type] "menubar"]} {
- tkMenuUnpost $menu
- tkRestoreOldGrab
+ MenuUnpost $menu
+ RestoreOldGrab
} else {
- tkMenuNextMenu $menu left
+ MenuNextMenu $menu left
}
}
# The following routines handle arrow keys. Arrow keys behave
# differently depending on whether the menu is a menu bar or not.
-proc tkMenuUpArrow {menu} {
+proc ::tk::MenuUpArrow {menu} {
if {[string equal [$menu cget -type] "menubar"]} {
- tkMenuNextMenu $menu left
+ MenuNextMenu $menu left
} else {
- tkMenuNextEntry $menu -1
+ MenuNextEntry $menu -1
}
}
-proc tkMenuDownArrow {menu} {
+proc ::tk::MenuDownArrow {menu} {
if {[string equal [$menu cget -type] "menubar"]} {
- tkMenuNextMenu $menu right
+ MenuNextMenu $menu right
} else {
- tkMenuNextEntry $menu 1
+ MenuNextEntry $menu 1
}
}
-proc tkMenuLeftArrow {menu} {
+proc ::tk::MenuLeftArrow {menu} {
if {[string equal [$menu cget -type] "menubar"]} {
- tkMenuNextEntry $menu -1
+ MenuNextEntry $menu -1
} else {
- tkMenuNextMenu $menu left
+ MenuNextMenu $menu left
}
}
-proc tkMenuRightArrow {menu} {
+proc ::tk::MenuRightArrow {menu} {
if {[string equal [$menu cget -type] "menubar"]} {
- tkMenuNextEntry $menu 1
+ MenuNextEntry $menu 1
} else {
- tkMenuNextMenu $menu right
+ MenuNextMenu $menu right
}
}
-# tkMenuNextMenu --
+# ::tk::MenuNextMenu --
# This procedure is invoked to handle "left" and "right" traversal
# motions in menus. It traverses to the next menu in a menu bar,
# or into or out of a cascaded menu.
@@ -747,8 +748,8 @@ proc tkMenuRightArrow {menu} {
# event.
# direction - Direction in which to move: "left" or "right"
-proc tkMenuNextMenu {menu direction} {
- global tkPriv
+proc ::tk::MenuNextMenu {menu direction} {
+ variable ::tk::Priv
# First handle traversals into and out of cascaded menus.
@@ -760,7 +761,7 @@ proc tkMenuNextMenu {menu direction} {
$menu postcascade active
set m2 [$menu entrycget active -menu]
if {[string compare $m2 ""]} {
- tkMenuFirstEntry $m2
+ MenuFirstEntry $m2
}
return
} else {
@@ -769,7 +770,7 @@ proc tkMenuNextMenu {menu direction} {
if {[string equal [winfo class $parent] "Menu"] \
&& [string equal [$parent cget -type] "menubar"]} {
tk_menuSetFocus $parent
- tkMenuNextEntry $parent 1
+ MenuNextEntry $parent 1
return
}
set parent [winfo parent $parent]
@@ -781,7 +782,7 @@ proc tkMenuNextMenu {menu direction} {
if {[string equal [winfo class $m2] "Menu"]} {
if {[string compare [$m2 cget -type] "menubar"]} {
$menu activate none
- tkGenerateMenuSelect $menu
+ GenerateMenuSelect $menu
tk_menuSetFocus $m2
# This code unposts any posted submenu in the parent.
@@ -801,12 +802,12 @@ proc tkMenuNextMenu {menu direction} {
if {[string equal [winfo class $m2] "Menu"]} {
if {[string equal [$m2 cget -type] "menubar"]} {
tk_menuSetFocus $m2
- tkMenuNextEntry $m2 -1
+ MenuNextEntry $m2 -1
return
}
}
- set w $tkPriv(postedMb)
+ set w $Priv(postedMb)
if {[string equal $w ""]} {
return
}
@@ -832,11 +833,11 @@ proc tkMenuNextMenu {menu direction} {
}
incr i $count
}
- tkMbPost $mb
- tkMenuFirstEntry [$mb cget -menu]
+ MbPost $mb
+ MenuFirstEntry [$mb cget -menu]
}
-# tkMenuNextEntry --
+# ::tk::MenuNextEntry --
# Activate the next higher or lower entry in the posted menu,
# wrapping around at the ends. Disabled entries are skipped.
#
@@ -845,8 +846,7 @@ proc tkMenuNextMenu {menu direction} {
# count - 1 means go to the next lower entry,
# -1 means go to the next higher entry.
-proc tkMenuNextEntry {menu count} {
- global tkPriv
+proc ::tk::MenuNextEntry {menu count} {
if {[string equal [$menu index last] "none"]} {
return
@@ -884,7 +884,7 @@ proc tkMenuNextEntry {menu count} {
incr quitAfter -1
}
$menu activate $i
- tkGenerateMenuSelect $menu
+ GenerateMenuSelect $menu
if {[string equal [$menu type $i] "cascade"]} {
set cascade [$menu entrycget $i -menu]
if {[string compare $cascade ""]} {
@@ -892,12 +892,12 @@ proc tkMenuNextEntry {menu count} {
# we traverse left/right in the menubar, but undesirable when
# we traverse up/down in a menu.
$menu postcascade $i
- tkMenuFirstEntry $cascade
+ MenuFirstEntry $cascade
}
}
}
-# tkMenuFind --
+# ::tk::MenuFind --
# This procedure searches the entire window hierarchy under w for
# a menubutton that isn't disabled and whose underlined character
# is "char" or an entry in a menubar that isn't disabled and whose
@@ -913,8 +913,7 @@ proc tkMenuNextEntry {menu count} {
# may be either upper or lower case, and
# will match either upper or lower case.
-proc tkMenuFind {w char} {
- global tkPriv
+proc ::tk::MenuFind {w char} {
set char [string tolower $char]
set windowlist [winfo child $w]
@@ -965,7 +964,7 @@ proc tkMenuFind {w char} {
}
default {
- set match [tkMenuFind $child $char]
+ set match [MenuFind $child $char]
if {[string compare $match ""]} {
return $match
}
@@ -975,7 +974,7 @@ proc tkMenuFind {w char} {
return {}
}
-# tkTraverseToMenu --
+# ::tk::TraverseToMenu --
# This procedure implements keyboard traversal of menus. Given an
# ASCII character "char", it looks for a menubutton with that character
# underlined. If one is found, it posts the menubutton's menu
@@ -987,14 +986,14 @@ proc tkMenuFind {w char} {
# is ignored. If an empty string, nothing
# happens.
-proc tkTraverseToMenu {w char} {
- global tkPriv
+proc ::tk::TraverseToMenu {w char} {
+ variable ::tk::Priv
if {[string equal $char ""]} {
return
}
while {[string equal [winfo class $w] "Menu"]} {
if {[string compare [$w cget -type] "menubar"] \
- && [string equal $tkPriv(postedMb) ""]} {
+ && [string equal $Priv(postedMb) ""]} {
return
}
if {[string equal [$w cget -type] "menubar"]} {
@@ -1002,22 +1001,22 @@ proc tkTraverseToMenu {w char} {
}
set w [winfo parent $w]
}
- set w [tkMenuFind [winfo toplevel $w] $char]
+ set w [MenuFind [winfo toplevel $w] $char]
if {[string compare $w ""]} {
if {[string equal [winfo class $w] "Menu"]} {
tk_menuSetFocus $w
- set tkPriv(window) $w
- tkSaveGrabInfo $w
+ set Priv(window) $w
+ SaveGrabInfo $w
grab -global $w
- tkTraverseWithinMenu $w $char
+ TraverseWithinMenu $w $char
} else {
- tkMbPost $w
- tkMenuFirstEntry [$w cget -menu]
+ MbPost $w
+ MenuFirstEntry [$w cget -menu]
}
}
}
-# tkFirstMenu --
+# ::tk::FirstMenu --
# This procedure traverses to the first menubutton in the toplevel
# for a given window, and posts that menubutton's menu.
#
@@ -1025,23 +1024,24 @@ proc tkTraverseToMenu {w char} {
# w - Name of a window. Selects which toplevel
# to search for menubuttons.
-proc tkFirstMenu w {
- set w [tkMenuFind [winfo toplevel $w] ""]
+proc ::tk::FirstMenu w {
+ variable ::tk::Priv
+ set w [MenuFind [winfo toplevel $w] ""]
if {[string compare $w ""]} {
if {[string equal [winfo class $w] "Menu"]} {
tk_menuSetFocus $w
- set tkPriv(window) $w
- tkSaveGrabInfo $w
+ set Priv(window) $w
+ SaveGrabInfo $w
grab -global $w
- tkMenuFirstEntry $w
+ MenuFirstEntry $w
} else {
- tkMbPost $w
- tkMenuFirstEntry [$w cget -menu]
+ MbPost $w
+ MenuFirstEntry [$w cget -menu]
}
}
}
-# tkTraverseWithinMenu
+# ::tk::TraverseWithinMenu
# This procedure implements keyboard traversal within a menu. It
# searches for an entry in the menu that has "char" underlined. If
# such an entry is found, it is invoked and the menu is unposted.
@@ -1052,7 +1052,7 @@ proc tkFirstMenu w {
# ignored. If the string is empty then
# nothing happens.
-proc tkTraverseWithinMenu {w char} {
+proc ::tk::TraverseWithinMenu {w char} {
if {[string equal $char ""]} {
return
}
@@ -1073,10 +1073,10 @@ proc tkTraverseWithinMenu {w char} {
event generate $w <<MenuSelect>>
set m2 [$w entrycget $i -menu]
if {[string compare $m2 ""]} {
- tkMenuFirstEntry $m2
+ MenuFirstEntry $m2
}
} else {
- tkMenuUnpost $w
+ MenuUnpost $w
uplevel #0 [list $w invoke $i]
}
return
@@ -1084,18 +1084,18 @@ proc tkTraverseWithinMenu {w char} {
}
}
-# tkMenuFirstEntry --
+# ::tk::MenuFirstEntry --
# Given a menu, this procedure finds the first entry that isn't
# disabled or a tear-off or separator, and activates that entry.
# However, if there is already an active entry in the menu (e.g.,
-# because of a previous call to tkPostOverPoint) then the active
+# because of a previous call to tk::PostOverPoint) then the active
# entry isn't changed. This procedure also sets the input focus
# to the menu.
#
# Arguments:
# menu - Name of the menu window (possibly empty).
-proc tkMenuFirstEntry menu {
+proc ::tk::MenuFirstEntry menu {
if {[string equal $menu ""]} {
return
}
@@ -1112,7 +1112,7 @@ proc tkMenuFirstEntry menu {
&& [string compare $state "disabled"] \
&& [string compare [$menu type $i] "tearoff"]} {
$menu activate $i
- tkGenerateMenuSelect $menu
+ GenerateMenuSelect $menu
# Only post the cascade if the current menu is a menubar;
# otherwise, if the first entry of the cascade is a cascade,
# we can get an annoying cascading effect resulting in a bunch of
@@ -1122,7 +1122,7 @@ proc tkMenuFirstEntry menu {
set cascade [$menu entrycget $i -menu]
if {[string compare $cascade ""]} {
$menu postcascade $i
- tkMenuFirstEntry $cascade
+ MenuFirstEntry $cascade
}
}
return
@@ -1130,7 +1130,7 @@ proc tkMenuFirstEntry menu {
}
}
-# tkMenuFindName --
+# ::tk::MenuFindName --
# Given a menu and a text string, return the index of the menu entry
# that displays the string as its label. If there is no such entry,
# return an empty string. This procedure is tricky because some names
@@ -1141,7 +1141,7 @@ proc tkMenuFirstEntry menu {
# menu - Name of the menu widget.
# s - String to look for.
-proc tkMenuFindName {menu s} {
+proc ::tk::MenuFindName {menu s} {
set i ""
if {![regexp {^active$|^last$|^none$|^[0-9]|^@} $s]} {
catch {set i [$menu index $s]}
@@ -1161,7 +1161,7 @@ proc tkMenuFindName {menu s} {
return ""
}
-# tkPostOverPoint --
+# ::tk::PostOverPoint --
# This procedure posts a given menu such that a given entry in the
# menu is centered over a given point in the root window. It also
# activates the given entry.
@@ -1173,7 +1173,7 @@ proc tkMenuFindName {menu s} {
# If omitted or specified as {}, then the menu's
# upper-left corner goes at (x,y).
-proc tkPostOverPoint {menu x y {entry {}}} {
+proc ::tk::PostOverPoint {menu x y {entry {}}} {
global tcl_platform
if {[string compare $entry {}]} {
@@ -1190,71 +1190,71 @@ proc tkPostOverPoint {menu x y {entry {}}} {
if {[string compare $entry {}] \
&& [string compare [$menu entrycget $entry -state] "disabled"]} {
$menu activate $entry
- tkGenerateMenuSelect $menu
+ GenerateMenuSelect $menu
}
}
-# tkSaveGrabInfo --
-# Sets the variables tkPriv(oldGrab) and tkPriv(grabStatus) to record
+# ::tk::SaveGrabInfo --
+# Sets the variables tk::Priv(oldGrab) and tk::Priv(grabStatus) to record
# the state of any existing grab on the w's display.
#
# Arguments:
# w - Name of a window; used to select the display
# whose grab information is to be recorded.
-proc tkSaveGrabInfo w {
- global tkPriv
- set tkPriv(oldGrab) [grab current $w]
- if {[string compare $tkPriv(oldGrab) ""]} {
- set tkPriv(grabStatus) [grab status $tkPriv(oldGrab)]
+proc tk::SaveGrabInfo w {
+ variable ::tk::Priv
+ set Priv(oldGrab) [grab current $w]
+ if {[string compare $Priv(oldGrab) ""]} {
+ set Priv(grabStatus) [grab status $Priv(oldGrab)]
}
}
-# tkRestoreOldGrab --
+# ::tk::RestoreOldGrab --
# Restores the grab to what it was before TkSaveGrabInfo was called.
#
-proc tkRestoreOldGrab {} {
- global tkPriv
+proc ::tk::RestoreOldGrab {} {
+ variable ::tk::Priv
- if {[string compare $tkPriv(oldGrab) ""]} {
+ if {[string compare $Priv(oldGrab) ""]} {
# Be careful restoring the old grab, since it's window may not
# be visible anymore.
catch {
- if {[string equal $tkPriv(grabStatus) "global"]} {
- grab set -global $tkPriv(oldGrab)
+ if {[string equal $Priv(grabStatus) "global"]} {
+ grab set -global $Priv(oldGrab)
} else {
- grab set $tkPriv(oldGrab)
+ grab set $Priv(oldGrab)
}
}
- set tkPriv(oldGrab) ""
+ set Priv(oldGrab) ""
}
}
-proc tk_menuSetFocus {menu} {
- global tkPriv
- if {![info exists tkPriv(focus)] || [string equal $tkPriv(focus) {}]} {
- set tkPriv(focus) [focus]
+proc ::tk_menuSetFocus {menu} {
+ variable ::tk::Priv
+ if {![info exists Priv(focus)] || [string equal $Priv(focus) {}]} {
+ set Priv(focus) [focus]
}
focus $menu
}
-proc tkGenerateMenuSelect {menu} {
- global tkPriv
+proc ::tk::GenerateMenuSelect {menu} {
+ variable ::tk::Priv
- if {[string equal $tkPriv(activeMenu) $menu] \
- && [string equal $tkPriv(activeItem) [$menu index active]]} {
+ if {[string equal $Priv(activeMenu) $menu] \
+ && [string equal $Priv(activeItem) [$menu index active]]} {
return
}
- set tkPriv(activeMenu) $menu
- set tkPriv(activeItem) [$menu index active]
+ set Priv(activeMenu) $menu
+ set Priv(activeItem) [$menu index active]
event generate $menu <<MenuSelect>>
}
-# tk_popup --
+# ::tk_popup --
# This procedure pops up a menu and sets things up for traversing
# the menu and its submenus.
#
@@ -1266,19 +1266,19 @@ proc tkGenerateMenuSelect {menu} {
# If omitted or specified as {}, then menu's
# upper-left corner goes at (x,y).
-proc tk_popup {menu x y {entry {}}} {
- global tkPriv
+proc ::tk_popup {menu x y {entry {}}} {
+ variable ::tk::Priv
global tcl_platform
- if {[string compare $tkPriv(popup) ""] \
- || [string compare $tkPriv(postedMb) ""]} {
- tkMenuUnpost {}
+ if {[string compare $Priv(popup) ""] \
+ || [string compare $Priv(postedMb) ""]} {
+ tk::MenuUnpost {}
}
- tkPostOverPoint $menu $x $y $entry
+ tk::PostOverPoint $menu $x $y $entry
if {[string equal $tcl_platform(platform) "unix"] \
&& [winfo viewable $menu]} {
- tkSaveGrabInfo $menu
+ tk::SaveGrabInfo $menu
grab -global $menu
- set tkPriv(popup) $menu
+ set Priv(popup) $menu
tk_menuSetFocus $menu
}
}
diff --git a/library/msgbox.tcl b/library/msgbox.tcl
index 87b3e10..ade57ce 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.13 2001/06/14 10:56:58 dkf Exp $
+# RCS: @(#) $Id: msgbox.tcl,v 1.14 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
#
@@ -114,7 +114,7 @@ static unsigned char w3_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};"
-# tkMessageBox --
+# ::tk::MessageBox --
#
# Pops up a messagebox with an application-supplied message with
# an icon and a list of buttons. This procedure will be called
@@ -130,11 +130,12 @@ static unsigned char w3_bits[] = {
#
# See the user documentation for details on what tk_messageBox does.
#
-proc tkMessageBox {args} {
- global tkPriv tcl_platform tk_strictMotif
+proc ::tk::MessageBox {args} {
+ global tcl_platform tk_strictMotif
+ variable ::tk::Priv
- set w tkPrivMsgBox
- upvar #0 $w data
+ set w ::tk::PrivMsgBox
+ upvar $w data
#
# The default value of the title is space (" ") not the empty string
@@ -364,7 +365,7 @@ proc tkMessageBox {args} {
set opts [list -text $capName]
}
- eval button [list $w.$name] $opts [list -command [list set tkPriv(button) $name]]
+ eval button [list $w.$name] $opts [list -command [list set tk::Priv(button) $name]]
if {[string equal $name $data(-default)]} {
$w.$name configure -default active
@@ -399,7 +400,7 @@ proc tkMessageBox {args} {
bind $w <Return> {
if {[string equal Button [winfo class %W]]} {
- tkButtonInvoke %W
+ tk::ButtonInvoke %W
}
}
@@ -424,9 +425,9 @@ proc tkMessageBox {args} {
# may take the focus away so we can't redirect it. Finally,
# restore any grab that was in effect.
- tkwait variable tkPriv(button)
+ vwait ::tk::Priv(button)
::tk::RestoreFocusGrab $w $focus
- return $tkPriv(button)
+ return $Priv(button)
}
diff --git a/library/optMenu.tcl b/library/optMenu.tcl
index 4f83ce7..05b3a45 100644
--- a/library/optMenu.tcl
+++ b/library/optMenu.tcl
@@ -3,7 +3,7 @@
# This file defines the procedure tk_optionMenu, which creates
# an option button and its associated menu.
#
-# RCS: @(#) $Id: optMenu.tcl,v 1.3 1998/09/14 18:23:24 stanton Exp $
+# RCS: @(#) $Id: optMenu.tcl,v 1.4 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1994 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
@@ -12,7 +12,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# tk_optionMenu --
+# ::tk_optionMenu --
# This procedure creates an option button named $w and an associated
# menu. Together they provide the functionality of Motif option menus:
# they can be used to select one of many values, and the current value
@@ -27,7 +27,7 @@
# firstValue - First of legal values for option (must be >= 1).
# args - Any number of additional values.
-proc tk_optionMenu {w varName firstValue args} {
+proc ::tk_optionMenu {w varName firstValue args} {
upvar #0 $varName var
if {![info exists var]} {
diff --git a/library/palette.tcl b/library/palette.tcl
index de34604..f278268 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.5 1999/09/02 17:02:53 hobbs Exp $
+# RCS: @(#) $Id: palette.tcl,v 1.6 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1995-1997 Sun Microsystems, Inc.
#
@@ -11,7 +11,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# tk_setPalette --
+# ::tk_setPalette --
# Changes the default color scheme for a Tk application by setting
# default colors in the option database and by modifying all of the
# color options for existing widgets that have the default value.
@@ -23,14 +23,12 @@
# option names and values. The name for an option is the one used
# for the option database, such as activeForeground, not -activeforeground.
-proc tk_setPalette {args} {
+proc ::tk_setPalette {args} {
if {[winfo depth .] == 1} {
# Just return on monochrome displays, otherwise errors will occur
return
}
- global tkPalette
-
# Create an array that has the complete new palette. If some colors
# aren't specified, compute them from other colors that are specified.
@@ -108,7 +106,7 @@ proc tk_setPalette {args} {
# Walk the widget hierarchy, recoloring all existing windows.
# The option database must be set according to what we do here,
# but it breaks things if we set things in the database while
- # we are changing colors...so, tkRecolorTree now returns the
+ # we are changing colors...so, ::tk::RecolorTree now returns the
# option database changes that need to be made, and they
# need to be evalled here to take effect.
# We have to walk the whole widget tree instead of just
@@ -117,7 +115,7 @@ proc tk_setPalette {args} {
# of widgets that we don't currently know about, so we'll
# walk the whole hierarchy just in case.
- eval [tkRecolorTree . new]
+ eval [tk::RecolorTree . new]
catch {destroy .___tk_set_palette}
@@ -128,13 +126,13 @@ proc tk_setPalette {args} {
option add *$option $new($option) widgetDefault
}
- # Save the options in the global variable tkPalette, for use the
+ # Save the options in the variable ::tk::Palette, for use the
# next time we change the options.
- array set tkPalette [array get new]
+ array set ::tk::Palette [array get new]
}
-# tkRecolorTree --
+# ::tk::RecolorTree --
# This procedure changes the colors in a window and all of its
# descendants, according to information provided by the colors
# argument. This looks at the defaults provided by the option
@@ -149,8 +147,7 @@ proc tk_setPalette {args} {
# is named after a widget configuration option, and
# each value is the value for that option.
-proc tkRecolorTree {w colors} {
- global tkPalette
+proc ::tk::RecolorTree {w colors} {
upvar $colors c
set result {}
foreach dbOption [array names c] {
@@ -176,12 +173,12 @@ proc tkRecolorTree {w colors} {
}
}
foreach child [winfo children $w] {
- append result ";\n[tkRecolorTree $child c]"
+ append result ";\n[::tk::RecolorTree $child c]"
}
return $result
}
-# tkDarken --
+# ::tk::Darken --
# Given a color name, computes a new color value that darkens (or
# brightens) the given color by a given percent.
#
@@ -191,7 +188,7 @@ proc tkRecolorTree {w colors} {
# percent: 50 means darken by 50%, 110 means brighten
# by 10%.
-proc tkDarken {color percent} {
+proc ::tk::Darken {color percent} {
foreach {red green blue} [winfo rgb . $color] {
set red [expr {($red/256)*$percent/100}]
set green [expr {($green/256)*$percent/100}]
@@ -210,13 +207,13 @@ proc tkDarken {color percent} {
return [format "#%02x%02x%02x" $red $green $blue]
}
-# tk_bisque --
+# ::tk_bisque --
# Reset the Tk color palette to the old "bisque" colors.
#
# Arguments:
# None.
-proc tk_bisque {} {
+proc ::tk_bisque {} {
tk_setPalette activeBackground #e6ceb1 activeForeground black \
background #ffe4c4 disabledForeground #b0b0b0 foreground black \
highlightBackground #ffe4c4 highlightColor black \
diff --git a/library/scale.tcl b/library/scale.tcl
index da24e15..ac891be 100644
--- a/library/scale.tcl
+++ b/library/scale.tcl
@@ -3,7 +3,7 @@
# This file defines the default bindings for Tk scale widgets and provides
# procedures that help in implementing the bindings.
#
-# RCS: @(#) $Id: scale.tcl,v 1.7 2000/04/14 08:33:31 hobbs Exp $
+# RCS: @(#) $Id: scale.tcl,v 1.8 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1994 The Regents of the University of California.
# Copyright (c) 1994-1995 Sun Microsystems, Inc.
@@ -20,74 +20,74 @@
bind Scale <Enter> {
if {$tk_strictMotif} {
- set tkPriv(activeBg) [%W cget -activebackground]
+ set tk::Priv(activeBg) [%W cget -activebackground]
%W config -activebackground [%W cget -background]
}
- tkScaleActivate %W %x %y
+ tk::ScaleActivate %W %x %y
}
bind Scale <Motion> {
- tkScaleActivate %W %x %y
+ tk::ScaleActivate %W %x %y
}
bind Scale <Leave> {
if {$tk_strictMotif} {
- %W config -activebackground $tkPriv(activeBg)
+ %W config -activebackground $tk::Priv(activeBg)
}
if {[string equal [%W cget -state] "active"]} {
%W configure -state normal
}
}
bind Scale <1> {
- tkScaleButtonDown %W %x %y
+ tk::ScaleButtonDown %W %x %y
}
bind Scale <B1-Motion> {
- tkScaleDrag %W %x %y
+ tk::ScaleDrag %W %x %y
}
bind Scale <B1-Leave> { }
bind Scale <B1-Enter> { }
bind Scale <ButtonRelease-1> {
- tkCancelRepeat
- tkScaleEndDrag %W
- tkScaleActivate %W %x %y
+ tk::CancelRepeat
+ tk::ScaleEndDrag %W
+ tk::ScaleActivate %W %x %y
}
bind Scale <2> {
- tkScaleButton2Down %W %x %y
+ tk::ScaleButton2Down %W %x %y
}
bind Scale <B2-Motion> {
- tkScaleDrag %W %x %y
+ tk::ScaleDrag %W %x %y
}
bind Scale <B2-Leave> { }
bind Scale <B2-Enter> { }
bind Scale <ButtonRelease-2> {
- tkCancelRepeat
- tkScaleEndDrag %W
- tkScaleActivate %W %x %y
+ tk::CancelRepeat
+ tk::ScaleEndDrag %W
+ tk::ScaleActivate %W %x %y
}
bind Scale <Control-1> {
- tkScaleControlPress %W %x %y
+ tk::ScaleControlPress %W %x %y
}
bind Scale <Up> {
- tkScaleIncrement %W up little noRepeat
+ tk::ScaleIncrement %W up little noRepeat
}
bind Scale <Down> {
- tkScaleIncrement %W down little noRepeat
+ tk::ScaleIncrement %W down little noRepeat
}
bind Scale <Left> {
- tkScaleIncrement %W up little noRepeat
+ tk::ScaleIncrement %W up little noRepeat
}
bind Scale <Right> {
- tkScaleIncrement %W down little noRepeat
+ tk::ScaleIncrement %W down little noRepeat
}
bind Scale <Control-Up> {
- tkScaleIncrement %W up big noRepeat
+ tk::ScaleIncrement %W up big noRepeat
}
bind Scale <Control-Down> {
- tkScaleIncrement %W down big noRepeat
+ tk::ScaleIncrement %W down big noRepeat
}
bind Scale <Control-Left> {
- tkScaleIncrement %W up big noRepeat
+ tk::ScaleIncrement %W up big noRepeat
}
bind Scale <Control-Right> {
- tkScaleIncrement %W down big noRepeat
+ tk::ScaleIncrement %W down big noRepeat
}
bind Scale <Home> {
%W set [%W cget -from]
@@ -96,7 +96,7 @@ bind Scale <End> {
%W set [%W cget -to]
}
-# tkScaleActivate --
+# ::tk::ScaleActivate --
# This procedure is invoked to check a given x-y position in the
# scale and activate the slider if the x-y position falls within
# the slider.
@@ -105,7 +105,7 @@ bind Scale <End> {
# w - The scale widget.
# x, y - Mouse coordinates.
-proc tkScaleActivate {w x y} {
+proc ::tk::ScaleActivate {w x y} {
if {[string equal [$w cget -state] "disabled"]} {
return
}
@@ -119,7 +119,7 @@ proc tkScaleActivate {w x y} {
}
}
-# tkScaleButtonDown --
+# ::tk::ScaleButtonDown --
# This procedure is invoked when a button is pressed in a scale. It
# takes different actions depending on where the button was pressed.
#
@@ -127,25 +127,25 @@ proc tkScaleActivate {w x y} {
# w - The scale widget.
# x, y - Mouse coordinates of button press.
-proc tkScaleButtonDown {w x y} {
- global tkPriv
- set tkPriv(dragging) 0
+proc ::tk::ScaleButtonDown {w x y} {
+ variable ::tk::Priv
+ set Priv(dragging) 0
set el [$w identify $x $y]
if {[string equal $el "trough1"]} {
- tkScaleIncrement $w up little initial
+ ScaleIncrement $w up little initial
} elseif {[string equal $el "trough2"]} {
- tkScaleIncrement $w down little initial
+ ScaleIncrement $w down little initial
} elseif {[string equal $el "slider"]} {
- set tkPriv(dragging) 1
- set tkPriv(initValue) [$w get]
+ set Priv(dragging) 1
+ set Priv(initValue) [$w get]
set coords [$w coords]
- set tkPriv(deltaX) [expr {$x - [lindex $coords 0]}]
- set tkPriv(deltaY) [expr {$y - [lindex $coords 1]}]
+ set Priv(deltaX) [expr {$x - [lindex $coords 0]}]
+ set Priv(deltaY) [expr {$y - [lindex $coords 1]}]
$w configure -sliderrelief sunken
}
}
-# tkScaleDrag --
+# ::tk::ScaleDrag --
# This procedure is called when the mouse is dragged with
# mouse button 1 down. If the drag started inside the slider
# (i.e. the scale is active) then the scale's value is adjusted
@@ -155,28 +155,28 @@ proc tkScaleButtonDown {w x y} {
# w - The scale widget.
# x, y - Mouse coordinates.
-proc tkScaleDrag {w x y} {
- global tkPriv
- if {!$tkPriv(dragging)} {
+proc ::tk::ScaleDrag {w x y} {
+ variable ::tk::Priv
+ if {!$Priv(dragging)} {
return
}
- $w set [$w get [expr {$x-$tkPriv(deltaX)}] [expr {$y-$tkPriv(deltaY)}]]
+ $w set [$w get [expr {$x-$Priv(deltaX)}] [expr {$y-$Priv(deltaY)}]]
}
-# tkScaleEndDrag --
+# ::tk::ScaleEndDrag --
# This procedure is called to end an interactive drag of the
# slider. It just marks the drag as over.
#
# Arguments:
# w - The scale widget.
-proc tkScaleEndDrag {w} {
- global tkPriv
- set tkPriv(dragging) 0
+proc ::tk::ScaleEndDrag {w} {
+ variable ::tk::Priv
+ set Priv(dragging) 0
$w configure -sliderrelief raised
}
-# tkScaleIncrement --
+# ::tk::ScaleIncrement --
# This procedure is invoked to increment the value of a scale and
# to set up auto-repeating of the action if that is desired. The
# way the value is incremented depends on the "dir" and "big"
@@ -192,8 +192,8 @@ proc tkScaleEndDrag {w} {
# first action in an auto-repeat sequence, and "again"
# means this is the second repetition or later.
-proc tkScaleIncrement {w dir big repeat} {
- global tkPriv
+proc ::tk::ScaleIncrement {w dir big repeat} {
+ variable ::tk::Priv
if {![winfo exists $w]} return
if {[string equal $big "big"]} {
set inc [$w cget -bigincrement]
@@ -212,18 +212,18 @@ proc tkScaleIncrement {w dir big repeat} {
$w set [expr {[$w get] + $inc}]
if {[string equal $repeat "again"]} {
- set tkPriv(afterId) [after [$w cget -repeatinterval] \
- [list tkScaleIncrement $w $dir $big again]]
+ set Priv(afterId) [after [$w cget -repeatinterval] \
+ [list tk::ScaleIncrement $w $dir $big again]]
} elseif {[string equal $repeat "initial"]} {
set delay [$w cget -repeatdelay]
if {$delay > 0} {
- set tkPriv(afterId) [after $delay \
- [list tkScaleIncrement $w $dir $big again]]
+ set Priv(afterId) [after $delay \
+ [list tk::ScaleIncrement $w $dir $big again]]
}
}
}
-# tkScaleControlPress --
+# ::tk::ScaleControlPress --
# This procedure handles button presses that are made with the Control
# key down. Depending on the mouse position, it adjusts the scale
# value to one end of the range or the other.
@@ -232,7 +232,7 @@ proc tkScaleIncrement {w dir big repeat} {
# w - The scale widget.
# x, y - Mouse coordinates where the button was pressed.
-proc tkScaleControlPress {w x y} {
+proc ::tk::ScaleControlPress {w x y} {
set el [$w identify $x $y]
if {[string equal $el "trough1"]} {
$w set [$w cget -from]
@@ -241,7 +241,7 @@ proc tkScaleControlPress {w x y} {
}
}
-# tkScaleButton2Down
+# ::tk::ScaleButton2Down
# This procedure is invoked when button 2 is pressed over a scale.
# It sets the value to correspond to the mouse position and starts
# a slider drag.
@@ -250,17 +250,17 @@ proc tkScaleControlPress {w x y} {
# w - The scrollbar widget.
# x, y - Mouse coordinates within the widget.
-proc tkScaleButton2Down {w x y} {
- global tkPriv
+proc ::tk::ScaleButton2Down {w x y} {
+ variable ::tk::Priv
if {[string equal [$w cget -state] "disabled"]} {
return
}
$w configure -state active
$w set [$w get $x $y]
- set tkPriv(dragging) 1
- set tkPriv(initValue) [$w get]
+ set Priv(dragging) 1
+ set Priv(initValue) [$w get]
set coords "$x $y"
- set tkPriv(deltaX) 0
- set tkPriv(deltaY) 0
+ set Priv(deltaX) 0
+ set Priv(deltaY) 0
}
diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl
index 95cacae..fb4bc0d 100644
--- a/library/scrlbar.tcl
+++ b/library/scrlbar.tcl
@@ -3,7 +3,7 @@
# This file defines the default bindings for Tk scrollbar widgets.
# It also provides procedures that help in implementing the bindings.
#
-# RCS: @(#) $Id: scrlbar.tcl,v 1.8 2000/01/06 02:22:24 hobbs Exp $
+# RCS: @(#) $Id: scrlbar.tcl,v 1.9 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
@@ -22,7 +22,7 @@ if {[string compare $tcl_platform(platform) "windows"] && \
bind Scrollbar <Enter> {
if {$tk_strictMotif} {
- set tkPriv(activeBg) [%W cget -activebackground]
+ set tk::Priv(activeBg) [%W cget -activebackground]
%W config -activebackground [%W cget -background]
}
%W activate [%W identify %x %y]
@@ -37,22 +37,22 @@ bind Scrollbar <Motion> {
# unknown reasons.
bind Scrollbar <Leave> {
- if {$tk_strictMotif && [info exists tkPriv(activeBg)]} {
- %W config -activebackground $tkPriv(activeBg)
+ if {$tk_strictMotif && [info exists tk::Priv(activeBg)]} {
+ %W config -activebackground $tk::Priv(activeBg)
}
%W activate {}
}
bind Scrollbar <1> {
- tkScrollButtonDown %W %x %y
+ tk::ScrollButtonDown %W %x %y
}
bind Scrollbar <B1-Motion> {
- tkScrollDrag %W %x %y
+ tk::ScrollDrag %W %x %y
}
bind Scrollbar <B1-B2-Motion> {
- tkScrollDrag %W %x %y
+ tk::ScrollDrag %W %x %y
}
bind Scrollbar <ButtonRelease-1> {
- tkScrollButtonUp %W %x %y
+ tk::ScrollButtonUp %W %x %y
}
bind Scrollbar <B1-Leave> {
# Prevents <Leave> binding from being invoked.
@@ -61,7 +61,7 @@ bind Scrollbar <B1-Enter> {
# Prevents <Enter> binding from being invoked.
}
bind Scrollbar <2> {
- tkScrollButton2Down %W %x %y
+ tk::ScrollButton2Down %W %x %y
}
bind Scrollbar <B1-2> {
# Do nothing, since button 1 is already down.
@@ -70,10 +70,10 @@ bind Scrollbar <B2-1> {
# Do nothing, since button 2 is already down.
}
bind Scrollbar <B2-Motion> {
- tkScrollDrag %W %x %y
+ tk::ScrollDrag %W %x %y
}
bind Scrollbar <ButtonRelease-2> {
- tkScrollButtonUp %W %x %y
+ tk::ScrollButtonUp %W %x %y
}
bind Scrollbar <B1-ButtonRelease-2> {
# Do nothing: B1 release will handle it.
@@ -88,50 +88,50 @@ bind Scrollbar <B2-Enter> {
# Prevents <Enter> binding from being invoked.
}
bind Scrollbar <Control-1> {
- tkScrollTopBottom %W %x %y
+ tk::ScrollTopBottom %W %x %y
}
bind Scrollbar <Control-2> {
- tkScrollTopBottom %W %x %y
+ tk::ScrollTopBottom %W %x %y
}
bind Scrollbar <Up> {
- tkScrollByUnits %W v -1
+ tk::ScrollByUnits %W v -1
}
bind Scrollbar <Down> {
- tkScrollByUnits %W v 1
+ tk::ScrollByUnits %W v 1
}
bind Scrollbar <Control-Up> {
- tkScrollByPages %W v -1
+ tk::ScrollByPages %W v -1
}
bind Scrollbar <Control-Down> {
- tkScrollByPages %W v 1
+ tk::ScrollByPages %W v 1
}
bind Scrollbar <Left> {
- tkScrollByUnits %W h -1
+ tk::ScrollByUnits %W h -1
}
bind Scrollbar <Right> {
- tkScrollByUnits %W h 1
+ tk::ScrollByUnits %W h 1
}
bind Scrollbar <Control-Left> {
- tkScrollByPages %W h -1
+ tk::ScrollByPages %W h -1
}
bind Scrollbar <Control-Right> {
- tkScrollByPages %W h 1
+ tk::ScrollByPages %W h 1
}
bind Scrollbar <Prior> {
- tkScrollByPages %W hv -1
+ tk::ScrollByPages %W hv -1
}
bind Scrollbar <Next> {
- tkScrollByPages %W hv 1
+ tk::ScrollByPages %W hv 1
}
bind Scrollbar <Home> {
- tkScrollToPos %W 0
+ tk::ScrollToPos %W 0
}
bind Scrollbar <End> {
- tkScrollToPos %W 1
+ tk::ScrollToPos %W 1
}
}
-# tkScrollButtonDown --
+# tk::ScrollButtonDown --
# This procedure is invoked when a button is pressed in a scrollbar.
# It changes the way the scrollbar is displayed and takes actions
# depending on where the mouse is.
@@ -140,19 +140,19 @@ bind Scrollbar <End> {
# w - The scrollbar widget.
# x, y - Mouse coordinates.
-proc tkScrollButtonDown {w x y} {
- global tkPriv
- set tkPriv(relief) [$w cget -activerelief]
+proc tk::ScrollButtonDown {w x y} {
+ variable ::tk::Priv
+ set Priv(relief) [$w cget -activerelief]
$w configure -activerelief sunken
set element [$w identify $x $y]
if {[string equal $element "slider"]} {
- tkScrollStartDrag $w $x $y
+ ScrollStartDrag $w $x $y
} else {
- tkScrollSelect $w $element initial
+ ScrollSelect $w $element initial
}
}
-# tkScrollButtonUp --
+# ::tk::ScrollButtonUp --
# This procedure is invoked when a button is released in a scrollbar.
# It cancels scans and auto-repeats that were in progress, and restores
# the way the active element is displayed.
@@ -161,18 +161,18 @@ proc tkScrollButtonDown {w x y} {
# w - The scrollbar widget.
# x, y - Mouse coordinates.
-proc tkScrollButtonUp {w x y} {
- global tkPriv
- tkCancelRepeat
- if {[info exists tkPriv(relief)]} {
+proc ::tk::ScrollButtonUp {w x y} {
+ variable ::tk::Priv
+ tk::CancelRepeat
+ if {[info exists Priv(relief)]} {
# Avoid error due to spurious release events
- $w configure -activerelief $tkPriv(relief)
- tkScrollEndDrag $w $x $y
+ $w configure -activerelief $Priv(relief)
+ ScrollEndDrag $w $x $y
$w activate [$w identify $x $y]
}
}
-# tkScrollSelect --
+# ::tk::ScrollSelect --
# This procedure is invoked when a button is pressed over the scrollbar.
# It invokes one of several scrolling actions depending on where in
# the scrollbar the button was pressed.
@@ -186,29 +186,29 @@ proc tkScrollButtonUp {w x y} {
# first action in an auto-repeat sequence, and "again"
# means this is the second repetition or later.
-proc tkScrollSelect {w element repeat} {
- global tkPriv
+proc ::tk::ScrollSelect {w element repeat} {
+ variable ::tk::Priv
if {![winfo exists $w]} return
switch -- $element {
- "arrow1" {tkScrollByUnits $w hv -1}
- "trough1" {tkScrollByPages $w hv -1}
- "trough2" {tkScrollByPages $w hv 1}
- "arrow2" {tkScrollByUnits $w hv 1}
+ "arrow1" {ScrollByUnits $w hv -1}
+ "trough1" {ScrollByPages $w hv -1}
+ "trough2" {ScrollByPages $w hv 1}
+ "arrow2" {ScrollByUnits $w hv 1}
default {return}
}
if {[string equal $repeat "again"]} {
- set tkPriv(afterId) [after [$w cget -repeatinterval] \
- [list tkScrollSelect $w $element again]]
+ set Priv(afterId) [after [$w cget -repeatinterval] \
+ [list tk::ScrollSelect $w $element again]]
} elseif {[string equal $repeat "initial"]} {
set delay [$w cget -repeatdelay]
if {$delay > 0} {
- set tkPriv(afterId) [after $delay \
- [list tkScrollSelect $w $element again]]
+ set Priv(afterId) [after $delay \
+ [list tk::ScrollSelect $w $element again]]
}
}
}
-# tkScrollStartDrag --
+# ::tk::ScrollStartDrag --
# This procedure is called to initiate a drag of the slider. It just
# remembers the starting position of the mouse and slider.
#
@@ -216,27 +216,27 @@ proc tkScrollSelect {w element repeat} {
# w - The scrollbar widget.
# x, y - The mouse position at the start of the drag operation.
-proc tkScrollStartDrag {w x y} {
- global tkPriv
+proc ::tk::ScrollStartDrag {w x y} {
+ variable ::tk::Priv
if {[string equal [$w cget -command] ""]} {
return
}
- set tkPriv(pressX) $x
- set tkPriv(pressY) $y
- set tkPriv(initValues) [$w get]
- set iv0 [lindex $tkPriv(initValues) 0]
- if {[llength $tkPriv(initValues)] == 2} {
- set tkPriv(initPos) $iv0
+ set Priv(pressX) $x
+ set Priv(pressY) $y
+ set Priv(initValues) [$w get]
+ set iv0 [lindex $Priv(initValues) 0]
+ if {[llength $Priv(initValues)] == 2} {
+ set Priv(initPos) $iv0
} elseif {$iv0 == 0} {
- set tkPriv(initPos) 0.0
+ set Priv(initPos) 0.0
} else {
- set tkPriv(initPos) [expr {(double([lindex $tkPriv(initValues) 2])) \
- / [lindex $tkPriv(initValues) 0]}]
+ set Priv(initPos) [expr {(double([lindex $Priv(initValues) 2])) \
+ / [lindex $Priv(initValues) 0]}]
}
}
-# tkScrollDrag --
+# ::tk::ScrollDrag --
# This procedure is called for each mouse motion even when the slider
# is being dragged. It notifies the associated widget if we're not
# jump scrolling, and it just updates the scrollbar if we are jump
@@ -246,29 +246,29 @@ proc tkScrollStartDrag {w x y} {
# w - The scrollbar widget.
# x, y - The current mouse position.
-proc tkScrollDrag {w x y} {
- global tkPriv
+proc ::tk::ScrollDrag {w x y} {
+ variable ::tk::Priv
- if {[string equal $tkPriv(initPos) ""]} {
+ if {[string equal $Priv(initPos) ""]} {
return
}
- set delta [$w delta [expr {$x - $tkPriv(pressX)}] [expr {$y - $tkPriv(pressY)}]]
+ set delta [$w delta [expr {$x - $Priv(pressX)}] [expr {$y - $Priv(pressY)}]]
if {[$w cget -jump]} {
- if {[llength $tkPriv(initValues)] == 2} {
- $w set [expr {[lindex $tkPriv(initValues) 0] + $delta}] \
- [expr {[lindex $tkPriv(initValues) 1] + $delta}]
+ if {[llength $Priv(initValues)] == 2} {
+ $w set [expr {[lindex $Priv(initValues) 0] + $delta}] \
+ [expr {[lindex $Priv(initValues) 1] + $delta}]
} else {
- set delta [expr {round($delta * [lindex $tkPriv(initValues) 0])}]
- eval [list $w] set [lreplace $tkPriv(initValues) 2 3 \
- [expr {[lindex $tkPriv(initValues) 2] + $delta}] \
- [expr {[lindex $tkPriv(initValues) 3] + $delta}]]
+ set delta [expr {round($delta * [lindex $Priv(initValues) 0])}]
+ eval [list $w] set [lreplace $Priv(initValues) 2 3 \
+ [expr {[lindex $Priv(initValues) 2] + $delta}] \
+ [expr {[lindex $Priv(initValues) 3] + $delta}]]
}
} else {
- tkScrollToPos $w [expr {$tkPriv(initPos) + $delta}]
+ ScrollToPos $w [expr {$Priv(initPos) + $delta}]
}
}
-# tkScrollEndDrag --
+# ::tk::ScrollEndDrag --
# This procedure is called to end an interactive drag of the slider.
# It scrolls the window if we're in jump mode, otherwise it does nothing.
#
@@ -276,21 +276,21 @@ proc tkScrollDrag {w x y} {
# w - The scrollbar widget.
# x, y - The mouse position at the end of the drag operation.
-proc tkScrollEndDrag {w x y} {
- global tkPriv
+proc ::tk::ScrollEndDrag {w x y} {
+ variable ::tk::Priv
- if {[string equal $tkPriv(initPos) ""]} {
+ if {[string equal $Priv(initPos) ""]} {
return
}
if {[$w cget -jump]} {
- set delta [$w delta [expr {$x - $tkPriv(pressX)}] \
- [expr {$y - $tkPriv(pressY)}]]
- tkScrollToPos $w [expr {$tkPriv(initPos) + $delta}]
+ set delta [$w delta [expr {$x - $Priv(pressX)}] \
+ [expr {$y - $Priv(pressY)}]]
+ ScrollToPos $w [expr {$Priv(initPos) + $delta}]
}
- set tkPriv(initPos) ""
+ set Priv(initPos) ""
}
-# tkScrollByUnits --
+# ::tk::ScrollByUnits --
# This procedure tells the scrollbar's associated widget to scroll up
# or down by a given number of units. It notifies the associated widget
# in different ways for old and new command syntaxes.
@@ -301,7 +301,7 @@ proc tkScrollEndDrag {w x y} {
# horizontal, "v" for vertical, "hv" for both.
# amount - How many units to scroll: typically 1 or -1.
-proc tkScrollByUnits {w orient amount} {
+proc ::tk::ScrollByUnits {w orient amount} {
set cmd [$w cget -command]
if {[string equal $cmd ""] || ([string first \
[string index [$w cget -orient] 0] $orient] < 0)} {
@@ -315,7 +315,7 @@ proc tkScrollByUnits {w orient amount} {
}
}
-# tkScrollByPages --
+# ::tk::ScrollByPages --
# This procedure tells the scrollbar's associated widget to scroll up
# or down by a given number of screenfuls. It notifies the associated
# widget in different ways for old and new command syntaxes.
@@ -326,7 +326,7 @@ proc tkScrollByUnits {w orient amount} {
# horizontal, "v" for vertical, "hv" for both.
# amount - How many screens to scroll: typically 1 or -1.
-proc tkScrollByPages {w orient amount} {
+proc ::tk::ScrollByPages {w orient amount} {
set cmd [$w cget -command]
if {[string equal $cmd ""] || ([string first \
[string index [$w cget -orient] 0] $orient] < 0)} {
@@ -340,7 +340,7 @@ proc tkScrollByPages {w orient amount} {
}
}
-# tkScrollToPos --
+# ::tk::ScrollToPos --
# This procedure tells the scrollbar's associated widget to scroll to
# a particular location, given by a fraction between 0 and 1. It notifies
# the associated widget in different ways for old and new command syntaxes.
@@ -350,7 +350,7 @@ proc tkScrollByPages {w orient amount} {
# pos - A fraction between 0 and 1 indicating a desired position
# in the document.
-proc tkScrollToPos {w pos} {
+proc ::tk::ScrollToPos {w pos} {
set cmd [$w cget -command]
if {[string equal $cmd ""]} {
return
@@ -363,7 +363,7 @@ proc tkScrollToPos {w pos} {
}
}
-# tkScrollTopBottom
+# ::tk::ScrollTopBottom
# Scroll to the top or bottom of the document, depending on the mouse
# position.
#
@@ -371,21 +371,21 @@ proc tkScrollToPos {w pos} {
# w - The scrollbar widget.
# x, y - Mouse coordinates within the widget.
-proc tkScrollTopBottom {w x y} {
- global tkPriv
+proc ::tk::ScrollTopBottom {w x y} {
+ variable ::tk::Priv
set element [$w identify $x $y]
if {[string match *1 $element]} {
- tkScrollToPos $w 0
+ ScrollToPos $w 0
} elseif {[string match *2 $element]} {
- tkScrollToPos $w 1
+ ScrollToPos $w 1
}
- # Set tkPriv(relief), since it's needed by tkScrollButtonUp.
+ # Set Priv(relief), since it's needed by tk::ScrollButtonUp.
- set tkPriv(relief) [$w cget -activerelief]
+ set Priv(relief) [$w cget -activerelief]
}
-# tkScrollButton2Down
+# ::tk::ScrollButton2Down
# This procedure is invoked when button 2 is pressed over a scrollbar.
# If the button is over the trough or slider, it sets the scrollbar to
# the mouse position and starts a slider drag. Otherwise it just
@@ -395,15 +395,15 @@ proc tkScrollTopBottom {w x y} {
# w - The scrollbar widget.
# x, y - Mouse coordinates within the widget.
-proc tkScrollButton2Down {w x y} {
- global tkPriv
+proc ::tk::ScrollButton2Down {w x y} {
+ variable ::tk::Priv
set element [$w identify $x $y]
if {[string match {arrow[12]} $element]} {
- tkScrollButtonDown $w $x $y
+ ScrollButtonDown $w $x $y
return
}
- tkScrollToPos $w [$w fraction $x $y]
- set tkPriv(relief) [$w cget -activerelief]
+ ScrollToPos $w [$w fraction $x $y]
+ set Priv(relief) [$w cget -activerelief]
# Need the "update idletasks" below so that the widget calls us
# back to reset the actual scrollbar position before we start the
@@ -412,5 +412,5 @@ proc tkScrollButton2Down {w x y} {
update idletasks
$w configure -activerelief sunken
$w activate slider
- tkScrollStartDrag $w $x $y
+ ScrollStartDrag $w $x $y
}
diff --git a/library/spinbox.tcl b/library/spinbox.tcl