summaryrefslogtreecommitdiffstats
path: root/library/clrpick.tcl
diff options
context:
space:
mode:
authorhobbs <hobbs>1999-09-02 17:02:52 (GMT)
committerhobbs <hobbs>1999-09-02 17:02:52 (GMT)
commit2abe00f21824a55ee6096189dc4979ca29af2e2e (patch)
treeccf3e977fda229d63d171853a7b5e3c8e3564996 /library/clrpick.tcl
parentb598f1d55d8f6a4aefb4d53d8639f8f04bf94cf2 (diff)
downloadtk-2abe00f21824a55ee6096189dc4979ca29af2e2e.zip
tk-2abe00f21824a55ee6096189dc4979ca29af2e2e.tar.gz
tk-2abe00f21824a55ee6096189dc4979ca29af2e2e.tar.bz2
1999-09-01 Jeff Hobbs <hobbs@scriptics.com>
* library/msgbox.tcl: changed the behavior of tk_messageBox on Unix to be more Windows like in handling of <Return> and the default button * library/button.tcl: * library/clrpick.tcl: * library/comdlg.tcl: * library/console.tcl: * library/dialog.tcl: * library/entry.tcl: * library/focus.tcl: * library/listbox.tcl: * library/menu.tcl: * library/msgbox.tcl: * library/palette.tcl: * library/safetk.tcl: * library/scale.tcl: * library/scrlbar.tcl: * library/tearoff.tcl: * library/text.tcl: * library/tk.tcl: * library/tkfbox.tcl: * library/xmfbox.tcl: updated commands to use [string] ops instead of expr equality operators
Diffstat (limited to 'library/clrpick.tcl')
-rw-r--r--library/clrpick.tcl80
1 files changed, 39 insertions, 41 deletions
diff --git a/library/clrpick.tcl b/library/clrpick.tcl
index 5fdf467..9fa56ff 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.5 1999/08/10 15:27:49 hobbs Exp $
+# RCS: @(#) $Id: clrpick.tcl,v 1.6 1999/09/02 17:02:52 hobbs Exp $
#
# Copyright (c) 1996 Sun Microsystems, Inc.
#
@@ -102,7 +102,7 @@ proc tkColorDialog {args} {
destroy $w
unset data
if {[string compare $oldGrab ""]} {
- if {![string compare $grabStatus "global"]} {
+ if {[string equal $grabStatus "global"]} {
grab -global $oldGrab
} else {
grab $oldGrab
@@ -147,8 +147,7 @@ proc tkColorDialog_InitValues {w} {
#
# canvasWidth is the width of the entire canvas, including the indents
#
- set data(canvasWidth) [expr {$data(BARS_WIDTH) + \
- $data(PLGN_WIDTH)}]
+ set data(canvasWidth) [expr {$data(BARS_WIDTH) + $data(PLGN_WIDTH)}]
# Set the initial color, specified by -initialcolor, or the
# color chosen by the user the last time.
@@ -181,10 +180,10 @@ proc tkColorDialog_Config {w argList} {
#
tclParseConfigSpec $w $specs "" $argList
- if {![string compare $data(-title) ""]} {
+ if {[string equal $data(-title) ""]} {
set data(-title) " "
}
- if {![string compare $data(-initialcolor) ""]} {
+ if {[string equal $data(-initialcolor) ""]} {
if {[info exists tkPriv(selectColor)] && \
[string compare $tkPriv(selectColor) ""]} {
set data(-initialcolor) $tkPriv(selectColor)
@@ -250,18 +249,18 @@ proc tkColorDialog_BuildDialog {w} {
set data($color,sel) $f.sel
bind $data($color,col) <Configure> \
- "tkColorDialog_DrawColorScale $w $color 1"
+ [list tkColorDialog_DrawColorScale $w $color 1]
bind $data($color,col) <Enter> \
- "tkColorDialog_EnterColorBar $w $color"
+ [list tkColorDialog_EnterColorBar $w $color]
bind $data($color,col) <Leave> \
- "tkColorDialog_LeaveColorBar $w $color"
+ [list tkColorDialog_LeaveColorBar $w $color]
bind $data($color,sel) <Enter> \
- "tkColorDialog_EnterColorBar $w $color"
+ [list tkColorDialog_EnterColorBar $w $color]
bind $data($color,sel) <Leave> \
- "tkColorDialog_LeaveColorBar $w $color"
-
- bind $box.entry <Return> "tkColorDialog_HandleRGBEntry $w"
+ [list tkColorDialog_LeaveColorBar $w $color]
+
+ bind $box.entry <Return> [list tkColorDialog_HandleRGBEntry $w]
}
pack $stripsFrame -side left -fill both -padx 4 -pady 10
@@ -280,7 +279,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> "tkColorDialog_HandleSelEntry $w"
+ bind $ent <Return> [list tkColorDialog_HandleSelEntry $w]
pack $selFrame -side left -fill none -anchor nw
pack $topFrame -side top -expand yes -fill both -anchor nw
@@ -289,9 +288,9 @@ proc tkColorDialog_BuildDialog {w} {
#
set botFrame [frame $w.bot -relief raised -bd 1]
button $botFrame.ok -text OK -width 8 -under 0 \
- -command "tkColorDialog_OkCmd $w"
+ -command [list tkColorDialog_OkCmd $w]
button $botFrame.cancel -text Cancel -width 8 -under 0 \
- -command "tkColorDialog_CancelCmd $w"
+ -command [list tkColorDialog_CancelCmd $w]
set data(okBtn) $botFrame.ok
set data(cancelBtn) $botFrame.cancel
@@ -303,15 +302,15 @@ proc tkColorDialog_BuildDialog {w} {
# Accelerator bindings
- bind $w <Alt-r> "focus $data(red,entry)"
- bind $w <Alt-g> "focus $data(green,entry)"
- bind $w <Alt-b> "focus $data(blue,entry)"
- bind $w <Alt-s> "focus $ent"
- bind $w <KeyPress-Escape> "tkButtonInvoke $data(cancelBtn)"
- bind $w <Alt-c> "tkButtonInvoke $data(cancelBtn)"
- bind $w <Alt-o> "tkButtonInvoke $data(okBtn)"
+ bind $w <Alt-r> [list focus $data(red,entry)]
+ 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)]
- wm protocol $w WM_DELETE_WINDOW "tkColorDialog_CancelCmd $w"
+ wm protocol $w WM_DELETE_WINDOW [list tkColorDialog_CancelCmd $w]
}
# tkColorDialog_SetRGBValue --
@@ -386,48 +385,47 @@ proc tkColorDialog_DrawColorScale {w c {create 0}} {
# Draw the selection polygons
tkColorDialog_CreateSelector $w $sel $c
$sel bind $data($c,index) <ButtonPress-1> \
- "tkColorDialog_StartMove $w $sel $c %x $data(selPad) 1"
+ [list tkColorDialog_StartMove $w $sel $c %x $data(selPad) 1]
$sel bind $data($c,index) <B1-Motion> \
- "tkColorDialog_MoveSelector $w $sel $c %x $data(selPad)"
+ [list tkColorDialog_MoveSelector $w $sel $c %x $data(selPad)]
$sel bind $data($c,index) <ButtonRelease-1> \
- "tkColorDialog_ReleaseMouse $w $sel $c %x $data(selPad)"
+ [list tkColorDialog_ReleaseMouse $w $sel $c %x $data(selPad)]
set height [winfo height $col]
# Create an invisible region under the colorstrip to catch mouse clicks
# that aren't on the selector.
set data($c,clickRegion) [$sel create rectangle 0 0 \
- $data(canvasWidth) $height -fill {} -outline {}]
+ $data(canvasWidth) $height -fill {} -outline {}]
bind $col <ButtonPress-1> \
- "tkColorDialog_StartMove $w $sel $c %x $data(colorPad)"
+ [list tkColorDialog_StartMove $w $sel $c %x $data(colorPad)]
bind $col <B1-Motion> \
- "tkColorDialog_MoveSelector $w $sel $c %x $data(colorPad)"
+ [list tkColorDialog_MoveSelector $w $sel $c %x $data(colorPad)]
bind $col <ButtonRelease-1> \
- "tkColorDialog_ReleaseMouse $w $sel $c %x $data(colorPad)"
+ [list tkColorDialog_ReleaseMouse $w $sel $c %x $data(colorPad)]
$sel bind $data($c,clickRegion) <ButtonPress-1> \
- "tkColorDialog_StartMove $w $sel $c %x $data(selPad)"
+ [list tkColorDialog_StartMove $w $sel $c %x $data(selPad)]
$sel bind $data($c,clickRegion) <B1-Motion> \
- "tkColorDialog_MoveSelector $w $sel $c %x $data(selPad)"
+ [list tkColorDialog_MoveSelector $w $sel $c %x $data(selPad)]
$sel bind $data($c,clickRegion) <ButtonRelease-1> \
- "tkColorDialog_ReleaseMouse $w $sel $c %x $data(selPad)"
+ [list tkColorDialog_ReleaseMouse $w $sel $c %x $data(selPad)]
} else {
# l is the canvas index of the first colorbar.
set l $data(lines,$c,start)
}
# Draw the color bars.
- set highlightW [expr \
- {[$col cget -highlightthickness] + [$col cget -bd]}]
+ set highlightW [expr {[$col cget -highlightthickness] + [$col cget -bd]}]
for {set i 0} { $i < $data(NUM_COLORBARS)} { incr i} {
set intensity [expr {$i * $data(intensityIncr)}]
set startx [expr {$i * $data(colorbarWidth) + $highlightW}]
- if { $c == "red" } {
+ if {[string equal $c "red"]} {
set color [format "#%02x%02x%02x" \
$intensity \
$data(green,intensity) \
$data(blue,intensity)]
- } elseif { $c == "green" } {
+ } elseif {[string equal $c "green"]} {
set color [format "#%02x%02x%02x" \
$data(red,intensity) \
$intensity \
@@ -488,9 +486,9 @@ proc tkColorDialog_RedrawFinalColor {w} {
set data(finalColor) $color
set data(selection) $color
set data(finalRGB) [list \
- $data(red,intensity) \
- $data(green,intensity) \
- $data(blue,intensity)]
+ $data(red,intensity) \
+ $data(green,intensity) \
+ $data(blue,intensity)]
}
# tkColorDialog_RedrawColorBars --