diff options
Diffstat (limited to 'tk/library/clrpick.tcl')
-rw-r--r-- | tk/library/clrpick.tcl | 326 |
1 files changed, 175 insertions, 151 deletions
diff --git a/tk/library/clrpick.tcl b/tk/library/clrpick.tcl index cf7dc04ef73..da174863be9 100644 --- a/tk/library/clrpick.tcl +++ b/tk/library/clrpick.tcl @@ -17,16 +17,24 @@ # (2): Implement HSV color selection. # -# tkColorDialog -- +# Make sure namespaces exist +namespace eval ::tk {} +namespace eval ::tk::dialog {} +namespace eval ::tk::dialog::color { + namespace import ::tk::msgcat::* +} + +# ::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. @@ -41,11 +49,11 @@ proc tkColorDialog {args} { # Note that the bars may be of any width. # However, NUM_COLORBARS must be a number that evenly divides 256. # Such as 256, 128, 64, etc. - set data(NUM_COLORBARS) 8 + set data(NUM_COLORBARS) 16 # BARS_WIDTH is the number of pixels wide the color bar portion of the # canvas is. This number must be a multiple of NUM_COLORBARS - set data(BARS_WIDTH) 128 + set data(BARS_WIDTH) 160 # PLGN_WIDTH is the number of pixels wide of the triangular selection # polygon. This also results in the definition of the padding on the @@ -56,8 +64,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,11 +73,20 @@ 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) + # Dialog boxes should be transient with respect to their parent, + # so that they will always stay on top of their parent window. However, + # some window managers will create the window as withdrawn if the parent + # window is withdrawn or iconified. Combined with the grab we put on the + # window, this can hang the entire application. Therefore we only make + # the dialog transient if the parent is viewable. + + if {[winfo viewable [winfo toplevel $data(-parent)]] } { + wm transient $w $data(-parent) + } # 5. Withdraw the window, then update all the geometry information # so we know how big it wants to be, then center the window in the @@ -88,19 +105,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 +161,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] } @@ -164,12 +181,12 @@ proc tkColorDialog_Config {w argList} { set specs [list \ [list -initialcolor "" "" $defaultColor] \ [list -parent "" "" "."] \ - [list -title "" "" "Color"] \ + [list -title "" "" [mc "Color"]] \ ] # 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 +200,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 # @@ -197,18 +214,26 @@ proc tkColorDialog_BuildDialog {w} { # StripsFrame contains the colorstrips and the individual RGB entries set stripsFrame [frame $topFrame.colorStrip] - foreach c { Red Green Blue } { - set color [string tolower $c] - + set maxWidth [::tk::mcmaxamp &Red &Green &Blue] + set maxWidth [expr {$maxWidth<6?6:$maxWidth}] + set colorList [list \ + red [mc "&Red"] \ + green [mc "&Green"] \ + blue [mc "&Blue"] \ + ] + foreach {color l} $colorList { # each f frame contains an [R|G|B] entry and the equiv. color strip. set f [frame $stripsFrame.$color] # The box frame contains the label and entry widget for an [R|G|B] set box [frame $f.box] - label $box.label -text $c: -width 6 -under 0 -anchor ne - entry $box.entry -textvariable [format %s $w]($color,intensity) \ - -width 4 + bind [::tk::AmpWidget label $box.label -text $l: -width $maxWidth \ + -anchor ne] <<AltUnderlined>> [list focus $box.entry] + + 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 @@ -231,18 +256,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 @@ -251,8 +276,10 @@ proc tkColorDialog_BuildDialog {w} { # selected color # set selFrame [frame $topFrame.sel] - set lab [label $selFrame.lab -text "Selection:" -under 0 -anchor sw] - set ent [entry $selFrame.ent -textvariable [format %s $w](selection) \ + set lab [::tk::AmpWidget label $selFrame.lab -text [mc "&Selection:"] \ + -anchor sw] + 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] @@ -261,7 +288,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 @@ -269,10 +296,14 @@ proc tkColorDialog_BuildDialog {w} { # the botFrame frame contains the buttons # set botFrame [frame $w.bot -relief raised -bd 1] - button $botFrame.ok -text OK -width 8 -under 0 \ - -command [list tkColorDialog_OkCmd $w] - button $botFrame.cancel -text Cancel -width 8 -under 0 \ - -command [list tkColorDialog_CancelCmd $w] + set maxWidth [::tk::mcmaxamp &OK &Cancel] + set maxWidth [expr {$maxWidth<8?8:$maxWidth}] + ::tk::AmpWidget button $botFrame.ok -text [mc "&OK"] \ + -width $maxWidth \ + -command [list tk::dialog::color::OkCmd $w] + ::tk::AmpWidget button $botFrame.cancel -text [mc "&Cancel"] \ + -width $maxWidth \ + -command [list tk::dialog::color::CancelCmd $w] set data(okBtn) $botFrame.ok set data(cancelBtn) $botFrame.cancel @@ -283,67 +314,63 @@ proc tkColorDialog_BuildDialog {w} { # Accelerator bindings + bind $lab <<AltUnderlined>> [list focus $ent] + bind $w <KeyPress-Escape> [list tk::ButtonInvoke $data(cancelBtn)] + bind $w <Alt-Key> [list tk::AltKeyInDialog $w %A] - 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 [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 { red green blue } { - set x [tkColorDialog_RgbToX $w $data($color,intensity)] - tkColorDialog_MoveSelector $w $data($color,sel) $color $x 0 + foreach color [list red green blue ] { + 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)}] + set x [expr {($x * $data(intensityIncr))/ $data(colorbarWidth)}] + if {$x > 255} { set x 255 } + return $x } -# 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 @@ -365,13 +392,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 @@ -380,18 +407,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) @@ -436,30 +463,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)] @@ -473,42 +500,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 @@ -516,15 +543,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], @@ -533,15 +560,15 @@ 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 if { $x < 0 } { set x 0 - } elseif { $x >= $data(BARS_WIDTH)} { - set x [expr {$data(BARS_WIDTH) - 1}] + } elseif { $x > $data(BARS_WIDTH)} { + set x $data(BARS_WIDTH) } set diff [expr {$x - $data($color,x)}] $sel move $data($color,index) $diff 0 @@ -551,49 +578,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 - foreach color { red green blue } { + 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 @@ -606,18 +633,18 @@ 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 {red green blue} { + foreach c [list red green blue] { if {[catch { set data($c,intensity) [expr {int($data($c,intensity))}] }]} { @@ -632,42 +659,39 @@ proc tkColorDialog_HandleRGBEntry {w} { } } - tkColorDialog_SetRGBValue $w "$data(red,intensity) $data(green,intensity) \ - $data(blue,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) "" } - - |