diff options
Diffstat (limited to 'library')
51 files changed, 276 insertions, 272 deletions
diff --git a/library/bgerror.tcl b/library/bgerror.tcl index d1ed60a..b15387e 100644 --- a/library/bgerror.tcl +++ b/library/bgerror.tcl @@ -98,7 +98,7 @@ proc ::tk::dialog::error::ReturnInDetails w { # err - The error message. # proc ::tk::dialog::error::bgerror err { - global errorInfo tcl_platform + global errorInfo variable button set info $errorInfo diff --git a/library/button.tcl b/library/button.tcl index 815b137..b2bafb2 100644 --- a/library/button.tcl +++ b/library/button.tcl @@ -17,6 +17,7 @@ #------------------------------------------------------------------------- if {[tk windowingsystem] eq "aqua"} { + bind Radiobutton <Enter> { tk::ButtonEnter %W } @@ -143,7 +144,7 @@ bind Radiobutton <Leave> { if {"win32" eq [tk windowingsystem]} { ######################### -# Windows implementation +# Windows implementation ######################### # ::tk::ButtonEnter -- diff --git a/library/choosedir.tcl b/library/choosedir.tcl index c0ab326..68dd9b0 100644 --- a/library/choosedir.tcl +++ b/library/choosedir.tcl @@ -122,7 +122,7 @@ proc ::tk::dialog::file::chooseDir:: {args} { # Return value to user # - + return $Priv(selectFilePath) } @@ -164,7 +164,7 @@ proc ::tk::dialog::file::chooseDir::Config {dataName argList} { if {$data(-title) eq ""} { set data(-title) "[mc "Choose Directory"]" } - + # Stub out the -multiple value for the dialog; it doesn't make sense for # choose directory dialogs, but we have to have something there because we # share so much code with the file dialogs. diff --git a/library/clrpick.tcl b/library/clrpick.tcl index 3772a30..600be16 100644 --- a/library/clrpick.tcl +++ b/library/clrpick.tcl @@ -12,7 +12,7 @@ # # (1): Find out how many free colors are left in the colormap and # don't allocate too many colors. -# (2): Implement HSV color selection. +# (2): Implement HSV color selection. # # Make sure namespaces exist @@ -54,11 +54,11 @@ proc ::tk::dialog::color:: {args} { 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 + # polygon. This also results in the definition of the padding on the # left and right sides which is half of PLGN_WIDTH. Make this number even. set data(PLGN_HEIGHT) 10 - # PLGN_HEIGHT is the height of the selection polygon and the height of the + # PLGN_HEIGHT is the height of the selection polygon and the height of the # selection rectangle at the bottom of the color bar. No restrictions. set data(PLGN_WIDTH) 10 @@ -328,7 +328,7 @@ proc ::tk::dialog::color::BuildDialog {w} { # Sets the current selection of the dialog box # proc ::tk::dialog::color::SetRGBValue {w color} { - upvar ::tk::dialog::color::[winfo name $w] data + upvar ::tk::dialog::color::[winfo name $w] data set data(red,intensity) [lindex $color 0] set data(green,intensity) [lindex $color 1] @@ -368,7 +368,7 @@ proc ::tk::dialog::color::RgbToX {w color} { } # ::tk::dialog::color::DrawColorScale -- -# +# # Draw color scale is called whenever the size of one of the color # scale canvases is changed. # @@ -507,7 +507,7 @@ proc ::tk::dialog::color::RedrawColorBars {w colorChanged} { upvar ::tk::dialog::color::[winfo name $w] data switch $colorChanged { - red { + red { DrawColorScale $w green DrawColorScale $w blue } @@ -537,7 +537,7 @@ proc ::tk::dialog::color::RedrawColorBars {w colorChanged} { # Handles a mousedown button event over the selector polygon. # Adds the bindings for moving the mouse while the button is # pressed. Sets the binding for the button-release event. -# +# # Params: sel is the selector canvas window, color is the color of the strip. # proc ::tk::dialog::color::StartMove {w sel color x delta {dontMove 0}} { @@ -549,7 +549,7 @@ proc ::tk::dialog::color::StartMove {w sel color x delta {dontMove 0}} { } # ::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], # the selector is set to the closest endpoint. @@ -583,7 +583,7 @@ proc ::tk::dialog::color::MoveSelector {w sel color x delta} { # x is the x-coord of the mouse. # proc ::tk::dialog::color::ReleaseMouse {w sel color x delta} { - upvar ::tk::dialog::color::[winfo name $w] data + upvar ::tk::dialog::color::[winfo name $w] data set x [MoveSelector $w $sel $color $x $delta] @@ -602,7 +602,7 @@ 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)) || (($data(BARS_WIDTH) % $data(NUM_COLORBARS)) != 0) } then { set data(BARS_WIDTH) $data(NUM_COLORBARS) @@ -660,7 +660,7 @@ proc ::tk::dialog::color::HandleRGBEntry {w} { SetRGBValue $w "$data(red,intensity) \ $data(green,intensity) $data(blue,intensity)" -} +} # mouse cursor enters a color bar # diff --git a/library/comdlg.tcl b/library/comdlg.tcl index f89754c..18df8a6 100644 --- a/library/comdlg.tcl +++ b/library/comdlg.tcl @@ -180,7 +180,7 @@ proc ::tk::FocusGroup_Destroy {t w} { if {$t eq $w} { unset Priv(fg,$t) - unset Priv(focus,$t) + unset Priv(focus,$t) foreach name [array names FocusIn $t,*] { unset FocusIn($name) @@ -277,7 +277,7 @@ proc ::tk::FDGetFileTypes {string} { continue } - # Validate each macType. This is to agree with the + # Validate each macType. This is to agree with the # behaviour of TkGetFileFilters(). This list may be # empty. foreach macType [lindex $t 2] { @@ -286,7 +286,7 @@ proc ::tk::FDGetFileTypes {string} { "bad Macintosh file type \"$macType\"" } } - + set name "$label \(" set sep "" set doAppend 1 diff --git a/library/console.tcl b/library/console.tcl index e93a39d..ba68ccc 100644 --- a/library/console.tcl +++ b/library/console.tcl @@ -41,8 +41,6 @@ interp alias {} EvalAttached {} consoleinterp eval # None. proc ::tk::ConsoleInit {} { - global tcl_platform - if {![consoleinterp eval {set tcl_interactive}]} { wm withdraw . } @@ -78,7 +76,7 @@ proc ::tk::ConsoleInit {} { AmpMenuArgs .menubar.edit add command -label [mc P&aste] -accel "$mod+V"\ -command {event generate .console <<Paste>>} - if {$tcl_platform(platform) ne "windows"} { + if {[tk windowingsystem] ne "win32"} { AmpMenuArgs .menubar.edit add command -label [mc Cl&ear] \ -command {event generate .console <<Clear>>} } else { @@ -114,6 +112,8 @@ proc ::tk::ConsoleInit {} { -accel "$mod++" -command {event generate .console <<Console_FontSizeIncr>>} AmpMenuArgs .menubar.edit add command -label [mc "&Decrease Font Size"] \ -accel "$mod+-" -command {event generate .console <<Console_FontSizeDecr>>} + AmpMenuArgs .menubar.edit add command -label [mc "Fit To Screen Width"] \ + -command {event generate .console <<Console_FitScreenWidth>>} if {[tk windowingsystem] eq "aqua"} { .menubar add cascade -label [mc Window] -menu [menu .menubar.window] @@ -193,7 +193,7 @@ proc ::tk::ConsoleInit {} { $w mark set promptEnd insert $w mark gravity promptEnd left - if {$tcl_platform(platform) eq "windows"} { + if {[tk windowingsystem] ne "aqua"} { # Subtle work-around to erase the '% ' that tclMain.c prints out after idle [subst -nocommand { if {[$con get 1.0 output] eq "% "} { $con delete 1.0 output } @@ -311,7 +311,7 @@ proc ::tk::ConsoleHistory {cmd} { # ::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 +# exists in the main interpreter it will be called to generate the # prompt. Otherwise, a hard coded default prompt is printed. # # Arguments: @@ -378,6 +378,26 @@ proc ::tk::console::Paste {w} { } } +# Fit TkConsoleFont to window width +proc ::tk::console::FitScreenWidth {w} { + set width [winfo screenwidth $w] + set cwidth [$w cget -width] + set s -50 + set fit 0 + array set fi [font configure TkConsoleFont] + while {$s < 0} { + set fi(-size) $s + set f [font create {*}[array get fi]] + set c [font measure $f "eM"] + font delete $f + if {$c * $cwidth < 1.667 * $width} { + font configure TkConsoleFont -size $s + break + } + incr s 2 + } +} + # ::tk::ConsoleBind -- # This procedure first ensures that the default bindings for the Text # class have been defined. Then certain bindings are overridden for @@ -600,6 +620,9 @@ proc ::tk::ConsoleBind {w} { tk fontchooser configure -font TkConsoleFont } } + bind Console <<Console_FitScreenWidth>> { + ::tk::console::FitScreenWidth %W + } ## ## Bindings for doing special things based on certain keys @@ -781,7 +804,7 @@ proc ::tk::console::TagProc w { # c2 - second char of pair # # Calls: ::tk::console::Blink - + proc ::tk::console::MatchPair {w c1 c2 {lim 1.0}} { if {!$::tk::console::magicKeys} { return @@ -836,7 +859,7 @@ proc ::tk::console::MatchPair {w c1 c2 {lim 1.0}} { # w - console text widget # # Calls: ::tk::console::Blink - + proc ::tk::console::MatchQuote {w {lim 1.0}} { if {!$::tk::console::magicKeys} { return @@ -971,7 +994,7 @@ proc ::tk::console::Expand {w {type ""}} { # # Returns: list containing longest unique match followed by all the # possible further matches - + proc ::tk::console::ExpandPathname str { set pwd [EvalAttached pwd] if {[catch {EvalAttached [list cd [file dirname $str]]} err opt]} { @@ -987,8 +1010,7 @@ proc ::tk::console::ExpandPathname str { set match {} } else { if {[llength $m] > 1} { - global tcl_platform - if {[string match windows $tcl_platform(platform)]} { + if { $::tcl_platform(platform) eq "windows" } { ## Windows is screwy because it's case insensitive set tmp [ExpandBestMatch [string tolower $m] \ [string tolower $dir]] diff --git a/library/demos/aniwave.tcl b/library/demos/aniwave.tcl index 6122132..a7539fb 100644 --- a/library/demos/aniwave.tcl +++ b/library/demos/aniwave.tcl @@ -17,7 +17,7 @@ wm title $w "Animated Wave Demonstration" wm iconname $w "aniwave" positionWindow $w -label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration contains a canvas widget with a line item inside it. The animation routines work by adjusting the coordinates list of the line; a trace on a variable is used so updates to the variable result in a change of position of the line." +label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration contains a canvas widget with a line item inside it. The animation routines work by adjusting the coordinates list of the line; a trace on a variable is used so updates to the variable result in a change of position of the line." pack $w.msg -side top ## See Code / Dismiss buttons diff --git a/library/demos/bind.tcl b/library/demos/bind.tcl index d9bc22f..03f6d3b 100644 --- a/library/demos/bind.tcl +++ b/library/demos/bind.tcl @@ -22,7 +22,7 @@ pack $btns -side bottom -fill x text $w.text -yscrollcommand "$w.scroll set" -setgrid true \ -width 60 -height 24 -font $font -wrap word -scrollbar $w.scroll -command "$w.text yview" +ttk::scrollbar $w.scroll -command "$w.text yview" pack $w.scroll -side right -fill y pack $w.text -expand yes -fill both diff --git a/library/demos/entry2.tcl b/library/demos/entry2.tcl index d0ca35a..9e3f4ef 100644 --- a/library/demos/entry2.tcl +++ b/library/demos/entry2.tcl @@ -27,15 +27,15 @@ frame $w.frame -borderwidth 10 pack $w.frame -side top -fill x -expand 1 entry $w.frame.e1 -xscrollcommand "$w.frame.s1 set" -scrollbar $w.frame.s1 -relief sunken -orient horiz -command \ +ttk::scrollbar $w.frame.s1 -orient horiz -command \ "$w.frame.e1 xview" frame $w.frame.spacer1 -width 20 -height 10 entry $w.frame.e2 -xscrollcommand "$w.frame.s2 set" -scrollbar $w.frame.s2 -relief sunken -orient horiz -command \ +ttk::scrollbar $w.frame.s2 -orient horiz -command \ "$w.frame.e2 xview" frame $w.frame.spacer2 -width 20 -height 10 entry $w.frame.e3 -xscrollcommand "$w.frame.s3 set" -scrollbar $w.frame.s3 -relief sunken -orient horiz -command \ +ttk::scrollbar $w.frame.s3 -orient horiz -command \ "$w.frame.e3 xview" pack $w.frame.e1 $w.frame.s1 $w.frame.spacer1 $w.frame.e2 $w.frame.s2 \ $w.frame.spacer2 $w.frame.e3 $w.frame.s3 -side top -fill x diff --git a/library/demos/floor.tcl b/library/demos/floor.tcl index 827600b..c36979b 100644 --- a/library/demos/floor.tcl +++ b/library/demos/floor.tcl @@ -1307,8 +1307,8 @@ pack $btns -side bottom -fill x set f [frame $w.frame] pack $f -side top -fill both -expand yes -set h [scrollbar $f.hscroll -orient horizontal] -set v [scrollbar $f.vscroll -orient vertical] +set h [ttk::scrollbar $f.hscroll -orient horizontal] +set v [ttk::scrollbar $f.vscroll -orient vertical] set f1 [frame $f.f1 -borderwidth 2 -relief sunken] set c [canvas $f1.c -width 900 -height 500 -highlightthickness 0 \ -xscrollcommand [list $h set] \ diff --git a/library/demos/fontchoose.tcl b/library/demos/fontchoose.tcl index def30c3..8b34377 100644 --- a/library/demos/fontchoose.tcl +++ b/library/demos/fontchoose.tcl @@ -57,7 +57,7 @@ grid columnconfigure $f 0 -weight 1 grid rowconfigure $f 0 -weight 1 bind $w <Visibility> { bind %W <Visibility> {} - grid propagate %W.f 0 + grid propagate %W.f 0 } ## See Code / Dismiss buttons diff --git a/library/demos/image2.tcl b/library/demos/image2.tcl index a17da31..2d7ba03 100644 --- a/library/demos/image2.tcl +++ b/library/demos/image2.tcl @@ -92,7 +92,7 @@ pack $w.dir.b -side left -fill y -padx {0 2m} -pady 2m labelframe $w.f -text "File:" -padx 2m -pady 2m listbox $w.f.list -width 20 -height 10 -yscrollcommand "$w.f.scroll set" -scrollbar $w.f.scroll -command "$w.f.list yview" +ttk::scrollbar $w.f.scroll -command "$w.f.list yview" pack $w.f.list $w.f.scroll -side left -fill y -expand 1 $w.f.list insert 0 earth.gif earthris.gif teapot.ppm bind $w.f.list <Double-1> "loadImage $w %x %y" diff --git a/library/demos/items.tcl b/library/demos/items.tcl index 177e9a4..000e4cb 100644 --- a/library/demos/items.tcl +++ b/library/demos/items.tcl @@ -31,8 +31,8 @@ canvas $c -scrollregion {0c 0c 30c 24c} -width 15c -height 10c \ -relief sunken -borderwidth 2 \ -xscrollcommand "$w.frame.hscroll set" \ -yscrollcommand "$w.frame.vscroll set" -scrollbar $w.frame.vscroll -command "$c yview" -scrollbar $w.frame.hscroll -orient horiz -command "$c xview" +ttk::scrollbar $w.frame.vscroll -command "$c yview" +ttk::scrollbar $w.frame.hscroll -orient horiz -command "$c xview" grid $c -in $w.frame \ -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news diff --git a/library/demos/ixset b/library/demos/ixset index 06b644d..ee6e072 100644 --- a/library/demos/ixset +++ b/library/demos/ixset @@ -186,12 +186,12 @@ proc createwindows {} { # frame .buttons - button .buttons.ok -default active -command ok -text "Ok" + button .buttons.ok -default active -command ok -text "Ok" button .buttons.apply -default normal -command apply -text "Apply" \ -state disabled button .buttons.cancel -default normal -command cancel -text "Cancel" \ -state disabled - button .buttons.quit -default normal -command quit -text "Quit" + button .buttons.quit -default normal -command quit -text "Quit" pack .buttons.ok .buttons.apply .buttons.cancel .buttons.quit \ -side left -expand yes -pady 5 diff --git a/library/demos/knightstour.tcl b/library/demos/knightstour.tcl index 73ca3a3..6113db2 100644 --- a/library/demos/knightstour.tcl +++ b/library/demos/knightstour.tcl @@ -221,7 +221,7 @@ proc CreateGUI {} { $c bind knight <ButtonPress-1> [namespace code [list DragStart %W %x %y]] $c bind knight <Motion> [namespace code [list DragMotion %W %x %y]] $c bind knight <ButtonRelease-1> [namespace code [list DragEnd %W %x %y]] - + grid $c $f.txt $f.vs -sticky news grid rowconfigure $f 0 -weight 1 grid columnconfigure $f 1 -weight 1 @@ -244,7 +244,7 @@ proc CreateGUI {} { if {[info exists ::widgetDemo]} { grid [addSeeDismiss $dlg.buttons $dlg] - - - - - -sticky ew } - + grid rowconfigure $dlg 0 -weight 1 grid columnconfigure $dlg 0 -weight 1 diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl index e19df57..e32b54f 100644 --- a/library/demos/menu.tcl +++ b/library/demos/menu.tcl @@ -16,7 +16,7 @@ wm title $w "Menu Demonstration" wm iconname $w "menu" positionWindow $w -label $w.msg -font $font -wraplength 4i -justify left +label $w.msg -font $font -wraplength 4i -justify left if {[tk windowingsystem] eq "aqua"} { catch {set origUseCustomMDEF $::tk::mac::useCustomMDEF; set ::tk::mac::useCustomMDEF 1} $w.msg configure -text "This window has a menubar with cascaded menus. You can invoke entries with an accelerator by typing Command+x, where \"x\" is the character next to the command key symbol. The rightmost menu can be torn off into a palette by selecting the first item in the menu." diff --git a/library/demos/menubu.tcl b/library/demos/menubu.tcl index 86326b5..96e3b15 100644 --- a/library/demos/menubu.tcl +++ b/library/demos/menubu.tcl @@ -21,7 +21,7 @@ pack $w.body -expand 1 -fill both if {[tk windowingsystem] eq "aqua"} {catch {set origUseCustomMDEF $::tk::mac::useCustomMDEF; set ::tk::mac::useCustomMDEF 1}} menubutton $w.body.below -text "Below" -underline 0 -direction below -menu $w.body.below.m -relief raised -menu $w.body.below.m -tearoff 0 +menu $w.body.below.m -tearoff 0 $w.body.below.m add command -label "Below menu: first item" -command "puts \"You have selected the first item from the Below menu.\"" $w.body.below.m add command -label "Below menu: second item" -command "puts \"You have selected the second item from the Below menu.\"" grid $w.body.below -row 0 -column 1 -sticky n diff --git a/library/demos/msgbox.tcl b/library/demos/msgbox.tcl index bd98bf2..2c2cc2d 100644 --- a/library/demos/msgbox.tcl +++ b/library/demos/msgbox.tcl @@ -23,7 +23,7 @@ pack [addSeeDismiss $w.buttons $w {} { }] -side bottom -fill x #pack $w.buttons.dismiss $w.buttons.code $w.buttons.vars -side left -expand 1 -frame $w.left +frame $w.left frame $w.right pack $w.left $w.right -side left -expand yes -fill y -pady .5c -padx .5c @@ -56,7 +56,7 @@ proc showMessageBox {w} { set button [tk_messageBox -icon $msgboxIcon -type $msgboxType \ -title Message -parent $w\ -message "This is a \"$msgboxType\" type messagebox with the \"$msgboxIcon\" icon"] - + tk_messageBox -icon info -message "You have selected \"$button\"" -type ok\ -parent $w } diff --git a/library/demos/paned2.tcl b/library/demos/paned2.tcl index f481d14..c549249 100644 --- a/library/demos/paned2.tcl +++ b/library/demos/paned2.tcl @@ -54,7 +54,7 @@ listbox $f.list -listvariable paneList -yscrollcommand "$f.scr set" # Invert the first item to highlight it $f.list itemconfigure 0 \ -background [$f.list cget -fg] -foreground [$f.list cget -bg] -scrollbar $f.scr -orient vertical -command "$f.list yview" +ttk::scrollbar $f.scr -orient vertical -command "$f.list yview" pack $f.scr -side right -fill y pack $f.list -fill both -expand 1 @@ -62,8 +62,8 @@ pack $f.list -fill both -expand 1 set f [frame $w.pane.bottom] text $f.text -xscrollcommand "$f.xscr set" -yscrollcommand "$f.yscr set" \ -width 30 -height 8 -wrap none -scrollbar $f.xscr -orient horizontal -command "$f.text xview" -scrollbar $f.yscr -orient vertical -command "$f.text yview" +ttk::scrollbar $f.xscr -orient horizontal -command "$f.text xview" +ttk::scrollbar $f.yscr -orient vertical -command "$f.text yview" grid $f.text $f.yscr -sticky nsew grid $f.xscr -sticky nsew grid columnconfigure $f 0 -weight 1 diff --git a/library/demos/puzzle.tcl b/library/demos/puzzle.tcl index fb8ab4c..4f7f955 100644 --- a/library/demos/puzzle.tcl +++ b/library/demos/puzzle.tcl @@ -54,7 +54,7 @@ pack $btns -side bottom -fill x scrollbar $w.s # The button metrics are a bit bigger in Aqua, and since we are -# using place which doesn't autosize, then we need to have a +# using place which doesn't autosize, then we need to have a # slightly larger frame here... if {[tk windowingsystem] eq "aqua"} { diff --git a/library/demos/sayings.tcl b/library/demos/sayings.tcl index 4d26ffe..aa3479c 100644 --- a/library/demos/sayings.tcl +++ b/library/demos/sayings.tcl @@ -28,8 +28,8 @@ frame $w.frame -borderwidth 10 pack $w.frame -side top -expand yes -fill both -padx 1c -scrollbar $w.frame.yscroll -command "$w.frame.list yview" -scrollbar $w.frame.xscroll -orient horizontal \ +ttk::scrollbar $w.frame.yscroll -command "$w.frame.list yview" +ttk::scrollbar $w.frame.xscroll -orient horizontal \ -command "$w.frame.list xview" listbox $w.frame.list -width 20 -height 10 -setgrid 1 \ -yscroll "$w.frame.yscroll set" -xscroll "$w.frame.xscroll set" diff --git a/library/demos/search.tcl b/library/demos/search.tcl index 9f44e16..a1a3d7f 100644 --- a/library/demos/search.tcl +++ b/library/demos/search.tcl @@ -109,7 +109,7 @@ pack $w.string.button -side left -pady 5 -padx 10 bind $w.string.entry <Return> "textSearch $w.text \$searchString search" text $w.text -yscrollcommand "$w.scroll set" -setgrid true -scrollbar $w.scroll -command "$w.text yview" +ttk::scrollbar $w.scroll -command "$w.text yview" pack $w.file $w.string -side top -fill x pack $w.scroll -side right -fill y pack $w.text -expand yes -fill both diff --git a/library/demos/square b/library/demos/square index 08c362b..1d7eb20 100644 --- a/library/demos/square +++ b/library/demos/square @@ -7,7 +7,7 @@ exec wish "$0" ${1+"$@"} # widget. It's only usable in the "tktest" application or if Tk has # been compiled with tkSquare.c. This demo arranges the following # bindings for the widget: -# +# # Button-1 press/drag: moves square to mouse # "a": toggle size animation on/off diff --git a/library/demos/states.tcl b/library/demos/states.tcl index 09d2718..41ce0bf 100644 --- a/library/demos/states.tcl +++ b/library/demos/states.tcl @@ -35,7 +35,7 @@ pack $btns -side bottom -fill x frame $w.frame -borderwidth .5c pack $w.frame -side top -expand yes -fill y -scrollbar $w.frame.scroll -command "$w.frame.list yview" +ttk::scrollbar $w.frame.scroll -command "$w.frame.list yview" listbox $w.frame.list -yscroll "$w.frame.scroll set" -setgrid 1 -height 12 pack $w.frame.scroll -side right -fill y pack $w.frame.list -side left -expand 1 -fill both diff --git a/library/demos/style.tcl b/library/demos/style.tcl index 614ea1f..a529a03 100644 --- a/library/demos/style.tcl +++ b/library/demos/style.tcl @@ -26,7 +26,7 @@ set family Courier text $w.text -yscrollcommand "$w.scroll set" -setgrid true \ -width 70 -height 32 -wrap word -font "$family 12" -scrollbar $w.scroll -command "$w.text yview" +ttk::scrollbar $w.scroll -command "$w.text yview" pack $w.scroll -side right -fill y pack $w.text -expand yes -fill both diff --git a/library/demos/text.tcl b/library/demos/text.tcl index 785e9e6..d1801d1 100644 --- a/library/demos/text.tcl +++ b/library/demos/text.tcl @@ -23,7 +23,7 @@ pack $btns -side bottom -fill x text $w.text -yscrollcommand [list $w.scroll set] -setgrid 1 \ -height 30 -undo 1 -autosep 1 -scrollbar $w.scroll -command [list $w.text yview] +ttk::scrollbar $w.scroll -command [list $w.text yview] pack $w.scroll -side right -fill y pack $w.text -expand yes -fill both diff --git a/library/demos/textpeer.tcl b/library/demos/textpeer.tcl index e94284e..83e8e14 100644 --- a/library/demos/textpeer.tcl +++ b/library/demos/textpeer.tcl @@ -36,7 +36,7 @@ proc makeClone {w parent} { global count set t [$parent peer create $w.text[incr count] -yscroll "$w.sb$count set"\ -height 10 -wrap word] - set sb [scrollbar $w.sb$count -command "$t yview" -orient vertical] + set sb [ttk::scrollbar $w.sb$count -command "$t yview" -orient vertical] set b1 [button $w.clone$count -command "makeClone $w $t" \ -text "Make Peer"] set b2 [button $w.kill$count -command "killClone $w $count" \ diff --git a/library/demos/twind.tcl b/library/demos/twind.tcl index 8f3c12e..bafb57e 100644 --- a/library/demos/twind.tcl +++ b/library/demos/twind.tcl @@ -25,7 +25,7 @@ set t $w.f.text text $t -yscrollcommand "$w.scroll set" -setgrid true -font $font -width 70 \ -height 35 -wrap word -highlightthickness 0 -borderwidth 0 pack $t -expand yes -fill both -scrollbar $w.scroll -command "$t yview" +ttk::scrollbar $w.scroll -command "$t yview" pack $w.scroll -side right -fill y panedwindow $w.pane pack $w.pane -expand yes -fill both @@ -166,7 +166,7 @@ $t image create end -image \ proc textWindBigB w { - $w configure -borderwidth 15 + $w configure -borderwidth 15 } proc textWindBigH w { @@ -193,7 +193,7 @@ proc textWindSmallP w { proc textWindOn w { catch {destroy $w.scroll2} set t $w.f.text - scrollbar $w.scroll2 -orient horizontal -command "$t xview" + ttk::scrollbar $w.scroll2 -orient horizontal -command "$t xview" pack $w.scroll2 -after $w.buttons -side bottom -fill x $t configure -xscrollcommand "$w.scroll2 set" -wrap none } @@ -230,7 +230,7 @@ proc createPlot {t} { $c create line 100 250 400 250 -width 2 $c create line 100 250 100 50 -width 2 $c create text 225 20 -text "A Simple Plot" -font $font -fill brown - + for {set i 0} {$i <= 10} {incr i} { set x [expr {100 + ($i*30)}] $c create line $x 250 $x 245 -width 2 @@ -241,7 +241,7 @@ proc createPlot {t} { $c create line 100 $y 105 $y -width 2 $c create text 96 $y -text [expr {$i*50}].0 -anchor e -font $font } - + foreach point { {12 56} {20 94} {33 98} {32 120} {61 180} {75 160} {98 223} } { @@ -303,7 +303,7 @@ proc textMakePeer {parent} { set t [$parent peer create $w.f.text -yscrollcommand "$w.scroll set" \ -borderwidth 0 -highlightthickness 0] pack $t -expand yes -fill both - scrollbar $w.scroll -command "$t yview" + ttk::scrollbar $w.scroll -command "$t yview" pack $w.scroll -side right -fill y pack $w.f -expand yes -fill both } diff --git a/library/demos/widget b/library/demos/widget index 8b92f9a..7604341 100644 --- a/library/demos/widget +++ b/library/demos/widget @@ -145,7 +145,7 @@ catch { } ttk::frame .textFrame -scrollbar .s -orient vertical -command {.t yview} -takefocus 1 +ttk::scrollbar .s -orient vertical -command {.t yview} -takefocus 1 pack .s -in .textFrame -side right -fill y text .t -yscrollcommand {.s set} -wrap word -width 70 -height $textheight \ -font mainFont -setgrid 1 -highlightthickness 0 \ @@ -565,8 +565,10 @@ proc showCode w { -xscrollcommand [list $t.xscroll set] \ -yscrollcommand [list $t.yscroll set] \ -setgrid 1 -highlightthickness 0 -pady 2 -padx 3] - scrollbar $t.xscroll -command [list $t.text xview] -orient horizontal - scrollbar $t.yscroll -command [list $t.text yview] -orient vertical + ttk::scrollbar $t.xscroll -command [list $t.text xview] \ + -orient horizontal + ttk::scrollbar $t.yscroll -command [list $t.text yview] \ + -orient vertical grid $t.text $t.yscroll -sticky news #grid $t.xscroll diff --git a/library/dialog.tcl b/library/dialog.tcl index 6a9babb..c751621 100644 --- a/library/dialog.tcl +++ b/library/dialog.tcl @@ -28,7 +28,6 @@ # bottom of the dialog box. proc ::tk_dialog {w title text bitmap default args} { - global tcl_platform variable ::tk::Priv # Check that $default was properly given @@ -149,7 +148,7 @@ proc ::tk_dialog {w title text bitmap default args} { # so we know how big it wants to be, then center the window in the # display (Motif style) and de-iconify it. - ::tk::PlaceWindow $w + ::tk::PlaceWindow $w tkwait visibility $w # 7. Set a grab and claim the focus too. diff --git a/library/entry.tcl b/library/entry.tcl index f28547e..6243d26 100644 --- a/library/entry.tcl +++ b/library/entry.tcl @@ -46,7 +46,6 @@ bind Entry <<Copy>> { } } bind Entry <<Paste>> { - global tcl_platform catch { if {[tk windowingsystem] ne "x11"} { catch { @@ -69,8 +68,8 @@ bind Entry <<PasteSelection>> { } bind Entry <<TraverseIn>> { - %W selection range 0 end - %W icursor end + %W selection range 0 end + %W icursor end } # Standard Motif bindings: @@ -358,12 +357,18 @@ proc ::tk::EntryMouseSelect {w x} { } } word { - if {$cur < [$w index anchor]} { + if {$cur < $anchor} { set before [tcl_wordBreakBefore [$w get] $cur] set after [tcl_wordBreakAfter [$w get] [expr {$anchor-1}]] - } else { + } elseif {$cur > $anchor} { set before [tcl_wordBreakBefore [$w get] $anchor] set after [tcl_wordBreakAfter [$w get] [expr {$cur - 1}]] + } else { + if {[$w index @$Priv(pressX)] < $anchor} { + incr anchor -1 + } + set before [tcl_wordBreakBefore [$w get] $anchor] + set after [tcl_wordBreakAfter [$w get] $anchor] } if {$before < 0} { set before 0 diff --git a/library/fontchooser.tcl b/library/fontchooser.tcl index 8b3f87e..8f91ade 100644 --- a/library/fontchooser.tcl +++ b/library/fontchooser.tcl @@ -105,7 +105,7 @@ proc ::tk::fontchooser::Configure {args} { "bad option \"$option\": must be\ -command, -font, -parent, -title or -visible" } - + set cache [dict create -parent $S(-parent) -title $S(-title) \ -font $S(-font) -command $S(-command)] set r [tclParseConfigSpec [namespace which -variable S] $specs "" $args] diff --git a/library/images/lamp.png b/library/images/lamp.png Binary files differdeleted file mode 100644 index 5445746..0000000 --- a/library/images/lamp.png +++ /dev/null diff --git a/library/images/lamp.svg b/library/images/lamp.svg deleted file mode 100644 index aa34765..0000000 --- a/library/images/lamp.svg +++ /dev/null @@ -1,114 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="256" - height="256" - id="svg2" - sodipodi:version="0.32" - inkscape:version="0.46" - version="1.0" - sodipodi:docname="lamp.svg" - inkscape:output_extension="org.inkscape.output.svg.inkscape" - inkscape:export-filename="C:\Users\pat\Documents\SVG\wish\lamp.png" - inkscape:export-xdpi="45" - inkscape:export-ydpi="45"> - <defs - id="defs4"> - <inkscape:perspective - sodipodi:type="inkscape:persp3d" - inkscape:vp_x="0 : 526.18109 : 1" - inkscape:vp_y="0 : 1000 : 0" - inkscape:vp_z="744.09448 : 526.18109 : 1" - inkscape:persp3d-origin="372.04724 : 350.78739 : 1" - id="perspective10" /> - <inkscape:perspective - id="perspective4202" - inkscape:persp3d-origin="372.04724 : 350.78739 : 1" - inkscape:vp_z="744.09448 : 526.18109 : 1" - inkscape:vp_y="0 : 1000 : 0" - inkscape:vp_x="0 : 526.18109 : 1" - sodipodi:type="inkscape:persp3d" /> - </defs> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - gridtolerance="10000" - guidetolerance="10" - objecttolerance="10" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="1.9765625" - inkscape:cx="122.94071" - inkscape:cy="132.27976" - inkscape:document-units="px" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:window-width="1253" - inkscape:window-height="696" - inkscape:window-x="155" - inkscape:window-y="130" /> - <metadata - id="metadata7"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title>Wish</dc:title> - <cc:license - rdf:resource="http://creativecommons.org/licenses/by-nc-sa/3.0/" /> - </cc:Work> - <cc:License - rdf:about="http://creativecommons.org/licenses/by-nc-sa/3.0/"> - <cc:permits - rdf:resource="http://creativecommons.org/ns#Reproduction" /> - <cc:permits - rdf:resource="http://creativecommons.org/ns#Distribution" /> - <cc:requires - rdf:resource="http://creativecommons.org/ns#Notice" /> - <cc:requires - rdf:resource="http://creativecommons.org/ns#Attribution" /> - <cc:prohibits - rdf:resource="http://creativecommons.org/ns#CommercialUse" /> - <cc:permits - rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> - <cc:requires - rdf:resource="http://creativecommons.org/ns#ShareAlike" /> - </cc:License> - </rdf:RDF> - </metadata> - <g - inkscape:label="Layer 1" - inkscape:groupmode="layer" - id="layer1"> - <path - id="path4244" - d="M 415.15644,157.10949 C 415.95395,156.55285 413.63871,156.20026 408.98022,156.16891 C 400.39605,156.11114 394.03714,153.62619 389.90404,148.71428 C 386.80837,145.03529 386.70005,142.56479 389.55139,140.67157 C 392.33793,138.82138 391.59696,137.74624 384.94986,133.99485 C 377.10186,129.56571 367.45876,120.11083 361.01771,110.52982 C 356.2238,103.39891 354.835,102.02199 351.39782,100.99218 C 348.07028,99.995225 347.3807,99.349945 347.3807,97.233135 C 347.3807,95.827615 348.28389,93.409235 349.38778,91.858965 C 350.70625,90.007345 351.00116,88.909055 350.24734,88.657785 C 348.52268,88.082895 349.12369,71.212775 351.01049,67.236642 C 352.72697,63.619426 358.4038,59.341601 362.8807,58.291741 C 368.19851,57.044683 371.3807,54.944074 371.3807,52.68077 C 371.3807,51.505545 370.0325,48.443002 368.38469,45.875118 C 364.6377,40.035936 363.56213,33.352517 365.70314,29.212273 C 368.86873,23.090696 378.69381,16.159436 389.80945,12.206085 C 396.16957,9.9440683 409.19029,7.9006403 416.8807,7.9576143 C 429.56583,8.0515923 430.45121,10.684797 418.52387,12.844573 C 408.41402,14.675243 395.40533,18.738492 389.39058,21.944323 C 382.19817,25.777834 375.3807,32.024842 375.3807,34.781896 C 375.3807,35.961118 376.7307,39.600271 378.3807,42.868903 C 381.7881,49.618923 382.10517,53.281819 379.7158,58.292375 C 377.80005,62.30975 372.62836,64.868903 366.42556,64.868903 C 361.00253,64.868903 357.56106,66.378947 356.20597,69.353051 C 354.65926,72.747705 355.39815,73.177385 359.69504,71.382035 C 364.84442,69.230481 369.94545,69.499889 378.3807,72.368905 C 386.08854,74.990505 393.19753,75.572485 396.42352,73.845985 C 399.16382,72.379425 400.20168,69.980487 401.8714,61.253678 C 402.8156,56.318785 404.11402,52.717225 405.46884,51.27508 C 409.57057,46.908996 417.3263,46.188254 435.8807,48.4489 C 440.51899,49.014024 441.21999,48.798052 445.57071,45.463499 C 448.15021,43.486471 450.93616,41.868903 451.76169,41.868903 C 456.39638,41.868903 453.00898,47.459001 446.28417,50.908252 C 444.30607,51.922844 437.33107,53.551117 430.78417,54.526637 C 415.93531,56.739186 415.13628,57.382184 413.51607,68.422706 C 412.86967,72.827445 411.54206,77.483105 410.53723,78.868905 C 407.37979,83.223475 398.88397,87.099935 391.31007,87.641845 C 382.34323,88.283415 380.33433,87.656565 374.36395,82.354025 C 370.03354,78.508005 368.69669,77.868905 364.98218,77.868905 C 360.03038,77.868905 356.23453,80.317105 353.75648,85.109115 C 352.31064,87.905065 352.31073,88.250245 353.75754,89.059915 C 354.62947,89.547875 358.14729,92.392935 361.57494,95.382295 C 373.67667,105.93659 385.05189,109.87945 387.55431,104.38722 C 389.01862,101.17342 400.23138,93.868905 403.70042,93.868905 C 405.61476,93.868905 406.3807,93.354525 406.3807,92.068905 C 406.3807,89.300765 408.42915,87.865755 412.3307,87.900705 C 416.2925,87.936195 418.45173,89.238425 420.29952,92.706685 C 421.27351,94.534825 422.08643,94.908595 424.02848,94.421175 C 425.97033,93.933795 427.14185,94.472205 429.40044,96.890035 C 430.98913,98.590725 433.7721,100.41478 435.58483,100.94347 C 438.47789,101.78726 439.06063,101.62756 440.35288,99.636815 C 445.10643,92.313915 453.6284,87.868905 462.91432,87.868905 C 471.25226,87.868905 477.3762,94.861065 477.37915,104.38451 C 477.38132,111.40533 474.73351,115.99375 469.63732,117.8004 C 465.8216,119.15312 465.3143,119.09082 460.41928,116.6683 L 455.23918,114.10469 L 455.55994,118.7368 C 455.85694,123.02582 455.69553,123.39336 453.3807,123.69898 C 452.0057,123.88052 449.0807,125.72311 446.8807,127.79362 C 444.6807,129.86413 441.3057,132.60737 439.3807,133.88971 C 437.4557,135.17205 435.71687,136.34329 435.51663,136.49247 C 435.3164,136.64165 436.1039,138.303 437.26663,140.18434 C 440.00489,144.61494 439.95186,145.14881 436.36797,149.23063 C 433.17349,152.86894 427.63954,155.56972 421.9273,156.27821 C 420.02228,156.51449 417.43247,156.99854 416.17217,157.35387 C 414.69967,157.76902 414.33665,157.68168 415.15644,157.10949 z M 461.66289,105.49411 C 466.02111,106.09147 466.3807,105.96302 467.55302,103.39006 C 468.64455,100.9944 468.56244,100.47497 466.9,99.259355 C 463.50165,96.774425 454.03816,98.379955 450.76501,101.99675 C 449.2334,103.68915 449.23826,104.00257 450.83387,106.43778 L 452.55063,109.05789 L 454.78597,106.9579 C 456.6536,105.20335 457.78484,104.96256 461.66289,105.49411 z M 480.08955,157.24443 C 479.03653,156.19141 479.23148,154.86891 480.43972,154.86891 C 481.02218,154.86891 481.22062,155.31891 480.8807,155.86891 C 480.53516,156.42801 481.28072,156.85424 482.57168,156.83564 L 484.8807,156.80237 L 482.82974,155.08564 C 481.26204,153.77341 480.78031,152.19079 480.78523,148.36891 C 480.78878,145.61891 480.4093,142.24744 479.94194,140.87675 C 479.17159,138.6174 479.24977,138.51536 480.77884,139.78437 C 482.10899,140.8883 482.72069,140.92526 483.67308,139.95921 C 484.61817,139.00056 484.50928,138.45979 483.17218,137.47168 C 480.67758,135.62817 479.8077,125.30277 482.07374,124.43321 C 484.50372,123.50074 486.09262,125.4993 484.69743,127.73335 C 484.07418,128.73133 483.86705,130.0378 484.23714,130.63662 C 484.60722,131.23543 484.90343,137.49517 484.89536,144.54714 C 484.88148,156.68738 484.7722,157.38444 482.83955,157.66109 C 481.71692,157.82179 480.47942,157.63429 480.08955,157.24443 z M 482.25305,118.70224 C 481.74301,109.37956 481.9401,107.3904 483.40197,107.10616 C 484.64333,106.86478 484.91924,108.04245 484.9015,113.50646 C 484.88705,117.95665 484.46065,120.34226 483.63023,120.61907 C 482.88848,120.86632 482.32882,120.08736 482.25305,118.70224 z M 379.00441,69.349758 C 376.06529,66.410633 377.10113,63.67485 383.3807,57.791426 C 389.1743,52.363315 389.3807,51.996847 389.3807,47.13811 C 389.3807,42.527633 389.68488,41.874271 393.01325,39.335601 C 396.00346,37.054853 398.10542,36.431883 404.90027,35.812562 C 416.73834,34.733574 419.96577,32.472032 421.51698,24.168809 C 422.76442,17.491595 424.77273,15.934307 435.02949,13.690888 C 444.53714,11.61132 473.5654,10.035808 469.8807,11.799335 C 462.39978,15.379766 448.69837,19.973669 443.16225,20.757679 C 434.68965,21.957548 433.72397,22.530265 426.73194,30.502062 C 423.51376,34.171199 419.46171,37.767608 417.72739,38.494081 C 415.99308,39.220554 410.20812,40.121839 404.87193,40.496935 C 392.82345,41.34386 390.96003,42.710991 391.65408,50.194442 C 392.08855,54.878864 391.98999,55.090456 388.28416,57.429845 C 384.39732,59.883502 381.94201,63.096875 383.08255,64.23742 C 383.42987,64.584736 386.14059,64.868903 389.10639,64.868903 C 395.04346,64.868903 395.33233,66.026622 389.95576,68.273094 C 383.92501,70.792905 380.75884,71.104181 379.00441,69.349758 z M 434.60321,38.312199 C 427.83023,33.568222 439.44607,28.281864 448.8156,31.844152 C 452.78899,33.354831 451.84999,34.868903 446.93972,34.868903 C 442.58714,34.868903 440.3344,36.104222 442.3807,37.368903 C 442.94864,37.719911 443.15443,38.426005 442.838,38.938001 C 441.93507,40.398969 437.05277,40.027939 434.60321,38.312199 z M 399.1307,26.788804 C 398.1682,26.228199 397.3807,24.907716 397.3807,23.854397 C 397.3807,19.888982 404.86882,18.583104 410.97957,21.482844 C 414.6962,23.2465 415.79992,26.473299 412.3807,25.579154 C 411.08084,25.239232 410.3807,25.548472 410.3807,26.462523 C 410.3807,28.151255 401.89255,28.397435 399.1307,26.788804 z" - style="fill:#a19ea5" /> - <path - id="path4242" - d="M 105.76326,194.33186 C 96.199481,191.3282 86.035511,183.95952 84.415432,178.8551 C 83.669624,176.50526 84.619431,173.43151 87.043677,170.34958 C 89.131529,167.6953 90.839771,164.85771 90.839771,164.04381 C 90.839771,163.22992 85.918717,159.94111 79.904096,156.73534 C 65.654177,149.14022 48.534772,133.52161 39.035518,119.44956 C 25.94837,100.06246 20.676575,94.528555 15.260318,94.492261 C 12.544659,94.474078 9.7834525,93.586577 9.1243032,92.52005 C 7.1111542,89.262706 9.8582449,82.714405 14.697759,79.234457 L 19.284506,75.93627 L 32.226689,86.830368 C 45.242318,97.786283 61.932601,107.70092 70.896763,109.80181 C 74.874966,110.73415 76.973245,109.63504 82.823316,103.55448 C 91.577415,94.455454 106.5437,84.581571 109.7288,85.803804 C 112.30619,86.792846 119.14001,82.528975 119.50937,79.701372 C 119.63551,78.735652 119.84193,77.072338 119.96808,76.00515 C 120.1008,74.882421 123.45816,74.302552 127.93568,74.629009 C 134.42967,75.102512 136.37445,76.225828 140.03071,81.615217 C 142.42694,85.147312 144.93094,87.89196 145.59516,87.714438 C 146.25938,87.536916 148.11372,86.880753 149.71593,86.256298 C 151.55372,85.540025 154.60158,87.11622 157.97278,90.526315 C 160.91183,93.499275 166.37382,96.761572 170.11052,97.77588 C 176.63713,99.547487 177.10469,99.356038 181.99078,92.911204 C 189.2319,83.360053 193.30348,80.314122 203.42538,76.876064 C 213.99829,73.284813 227.86298,74.099195 234.92479,78.726276 C 249.97261,88.585994 246.13011,121.71137 229.57839,124.81649 C 217.25776,127.12786 203.68336,119.34028 204.912,110.66549 C 205.47565,106.68593 206.35069,106.38575 217.3878,106.38575 C 228.7903,106.38575 229.33057,106.17926 231.11535,101.13898 C 232.77591,96.449555 232.39214,95.427248 227.50256,91.5151 C 221.01109,86.321288 212.43622,85.84151 203.33017,90.162611 C 193.1595,94.988901 192.26182,99.390772 198.85898,112.08736 C 201.94886,118.03401 204.71121,125.78933 204.99756,129.32143 C 205.44391,134.8274 204.9522,135.7516 201.55033,135.80083 C 199.36802,135.83241 193.58823,139.5894 188.70635,144.14971 C 183.82446,148.71 177.14673,154.02271 173.86693,155.95573 C 170.58712,157.88875 167.90365,160.16082 167.90365,161.00476 C 167.90365,161.8487 169.76144,165.83259 172.03207,169.85786 L 176.16049,177.17652 L 169.56843,183.28424 C 155.87761,195.96917 126.9335,200.98073 105.76326,194.33186 z" - style="fill:#edd400" - sodipodi:nodetypes="cssssssscccsssssssssssssssssssssssssscccc" /> - <path - id="path4238" - d="M 105.76326,195.26015 C 91.2682,190.70773 79.926103,178.96138 85.064191,173.82331 C 86.412111,172.47539 90.329525,173.11166 98.078673,175.93715 C 114.43988,181.90274 127.59098,183.59079 140.28535,181.35472 C 153.94689,178.94829 158.14857,176.20124 155.47497,171.42379 C 153.72375,168.29452 151.50157,168.02067 131.82394,168.50911 C 119.87893,168.8056 106.35554,168.19755 101.77196,167.15787 C 89.698721,164.41931 70.093174,152.93068 56.939947,140.88681 C 44.534571,129.52772 29.195171,107.81695 31.238758,104.51038 C 31.937342,103.38006 30.70876,100.53908 28.508587,98.197089 C 25.268931,94.748645 23.184206,94.116538 17.545112,94.872902 C 13.258048,95.447908 10.071549,94.981011 9.2539007,93.658026 C 7.1231945,90.210482 9.7375867,83.729446 14.697767,80.162746 L 19.284499,76.864559 L 32.226699,87.758658 C 47.530117,100.64033 63.263112,109.42753 74.136789,111.1663 C 82.555064,112.51244 85.287914,115.79329 81.646114,120.18138 C 77.940809,124.646 66.533098,123.44089 54.981809,117.36455 C 49.183358,114.31439 44.065729,112.19224 43.609327,112.64866 C 42.195407,114.06256 58.535133,129.40174 68.983105,136.4687 C 82.893943,145.87792 99.314337,150.64583 118.36258,150.80678 C 145.52872,151.03631 162.76551,145.71413 177.25684,132.62207 C 188.34716,122.60263 188.94814,120.5505 182.73878,113.90333 C 175.81472,106.49109 168.70623,106.44964 158.32432,113.76097 C 147.98605,121.04152 132.76454,123.60855 116.61147,120.79561 C 102.20671,118.28713 93.486961,114.8298 92.037334,111.05211 C 91.442016,109.50075 89.277658,108.23147 87.227649,108.23147 C 85.17764,108.23147 83.500363,107.13687 83.500363,105.79902 C 83.500363,100.44846 105.44657,85.088853 110.38429,86.983634 C 112.97609,87.978198 112.0154,89.694925 104.72512,97.096507 L 95.944216,106.01146 L 108.89174,108.95633 C 125.60393,112.75743 132.19327,112.622 141.75698,108.28088 C 150.27283,104.41539 151.12833,102.11981 146.51015,95.52644 C 143.6484,91.440733 143.6695,91.029744 146.86084,88.696177 C 151.48792,85.312779 152.0368,85.452081 158.05294,91.536605 C 160.9479,94.464463 166.37382,97.689862 170.11052,98.704169 C 176.63713,100.47578 177.10469,100.28433 181.99078,93.839493 C 189.2319,84.288343 193.30348,81.242411 203.42538,77.804353 C 214.46761,74.053691 228.66626,75.111117 235.46998,80.190801 C 246.39872,88.350288 247.47071,106.01058 237.63431,115.84696 C 231.52704,121.95423 223.54183,122.71682 215.49179,117.96155 C 204.60894,111.53288 206.6535,105.81232 219.23735,107.48162 C 226.96374,108.50657 228.35458,108.17571 230.11029,104.8951 C 232.76067,99.942824 232.67127,92.999442 229.92172,90.249895 C 226.72145,87.049615 210.78434,87.553668 203.33017,91.0909 C 193.1595,95.917191 192.26182,100.31906 198.85898,113.01565 C 201.94886,118.9623 204.71121,126.71762 204.99756,130.24972 C 205.44391,135.75569 204.9522,136.67989 201.55033,136.72912 C 199.36802,136.7607 193.58823,140.51769 188.70635,145.078 C 183.82446,149.63829 177.14673,154.951 173.86693,156.88402 C 170.58712,158.81704 167.90365,161.08911 167.90365,161.93305 C 167.90365,162.77699 169.76144,166.76088 172.03207,170.78615 L 176.16049,178.10481 L 169.56843,184.21253 C 155.87761,196.89746 126.9335,201.90902 105.76326,195.26015 z M 124.39689,92.286528 C 123.73252,90.555233 124.16318,88.866818 125.37189,88.463902 C 128.82997,87.311229 127.89606,85.131073 122.98588,82.893835 C 115.70755,79.577611 118.94662,74.88732 128.04458,75.568657 C 133.65369,75.988728 136.35232,77.369401 139.27998,81.316906 L 143.13312,86.512278 L 137.98496,90.949892 C 131.98533,96.12141 126.09095,96.701224 124.39689,92.286528 z" - style="fill:#555753" - sodipodi:nodetypes="cssssssssssscccsssssssssssssscccsssssssssssssssssssscccccssscccc" /> - <path - id="path4234" - d="M 110.50482,194.3016 C 101.29684,192.13337 94.533525,188.48684 89.271383,182.85325 C 82.390918,175.4871 85.936884,174.28107 99.528813,179.36455 C 115.59245,185.37247 143.30992,186.28633 152.7661,181.11982 C 159.03409,177.69523 160.98588,170.45868 156.43581,167.51383 C 155.17435,166.69739 142.9955,165.96174 129.37171,165.87907 C 108.80987,165.75428 102.74285,165.05333 93.663859,161.75352 C 73.025491,154.25244 49.561448,135.01491 39.768427,117.56612 C 35.780389,110.46041 36.411322,110.85564 48.942698,123.31318 C 70.302623,144.54723 92.258893,154.15548 119.15432,154.03838 C 135.83546,153.96576 152.56346,150.85172 163.02604,145.87134 C 172.41161,141.40363 189.9219,125.23231 189.9219,121.03213 C 189.9219,119.19248 187.7843,115.1469 185.17167,112.04198 C 178.58784,104.21754 168.03965,104.18244 155.55484,111.94343 C 150.18536,115.28129 142.95424,117.92581 137.39714,118.58397 C 127.97216,119.70021 104.80591,116.69758 100.01936,113.73933 C 94.450094,110.29735 100.24351,109.86707 113.23644,112.75774 C 127.9361,116.02809 138.20198,114.95313 146.93857,109.22869 C 153.28212,105.07225 154.19121,101.72283 150.50345,96.094621 C 148.24619,92.649609 147.93449,90.769617 149.38072,89.323385 C 150.82695,87.877153 153.0819,88.968084 157.50247,93.252689 C 160.86829,96.51495 166.83523,100.07126 170.76237,101.15561 C 177.28458,102.95648 178.14485,102.76481 180.70126,98.941361 C 190.46478,84.338673 203.44977,77.038962 219.66199,77.038962 C 239.73552,77.038962 249.19265,98.555619 235.51724,113.11244 C 230.28699,118.67977 219.45458,118.99815 214.68225,113.7248 C 210.40882,109.00271 211.87531,107.60004 218.46592,110.10579 C 222.73772,111.72993 224.48175,111.47356 228.23768,108.66934 C 235.27205,103.41743 237.01116,96.063887 232.61714,90.15151 C 228.70991,84.894138 221.3182,83.243302 210.64805,85.245036 C 203.22425,86.637745 191.75676,96.268143 191.75676,101.10994 C 191.75676,103.03903 194.23381,109.00645 197.26132,114.37093 C 203.6019,125.60581 204.5447,133.91945 199.47821,133.91945 C 197.66998,133.91945 192.50945,137.70093 188.01037,142.32275 C 183.51127,146.94454 176.32104,152.80279 172.03207,155.34108 C 163.73389,160.25204 162.48268,163.20921 167.08641,167.02996 C 171.28,170.51035 173.54029,175.47679 172.34649,178.58776 C 170.71762,182.83253 158.4385,190.19925 147.65345,193.40206 C 137.09511,196.53755 121.59442,196.91291 110.50482,194.3016 z M 56.408298,114.61872 C 49.129046,110.97705 38.716927,103.92466 33.270272,98.946719 L 23.367251,89.895915 L 16.969775,92.568949 C 9.3420288,95.756035 8.6495364,95.306148 9.7405408,87.872639 C 10.344685,83.75629 11.031471,82.8609 12.211447,84.651204 C 13.540212,86.667268 14.305567,86.530535 16.306604,83.919666 C 17.660139,82.153618 19.320682,80.708671 19.996697,80.708671 C 20.672694,80.708671 26.554779,85.229385 33.067979,90.7547 C 45.470438,101.27603 59.192323,109.15379 71.573791,112.86101 C 75.610471,114.06964 78.913208,116.20591 78.913208,117.60829 C 78.913208,122.46961 69.63857,121.23756 56.408298,114.61872 z M 87.170053,103.7711 C 87.170053,101.119 98.339717,92.839094 105.19954,90.406132 C 109.67365,88.819295 99.599675,99.261745 92.756946,103.30384 C 87.921829,106.16003 87.170053,106.22289 87.170053,103.7711 z M 129.35231,88.988873 C 132.38564,85.333953 130.37875,80.708671 125.7596,80.708671 C 123.70957,80.708671 122.03229,79.882986 122.03229,78.873816 C 122.03229,76.472212 130.46732,76.514212 134.9969,78.938366 C 141.6449,82.496277 137.51074,91.717796 129.26767,91.717796 C 127.62199,91.717796 127.64274,91.04879 129.35231,88.988873 z" - style="fill:#000000;fill-opacity:1" - sodipodi:nodetypes="cssssssssssssssssssssssssssssssssssssscccccsssssssccssccssssc" /> - </g> -</svg> diff --git a/library/listbox.tcl b/library/listbox.tcl index 3270b5d..17c03c0 100644 --- a/library/listbox.tcl +++ b/library/listbox.tcl @@ -118,7 +118,7 @@ bind Listbox <Control-Home> { %W see 0 %W selection clear 0 end %W selection set 0 - event generate %W <<ListboxSelect>> + tk::FireListboxSelectEvent %W } bind Listbox <Control-Shift-Home> { tk::ListboxDataExtend %W 0 @@ -128,7 +128,7 @@ bind Listbox <Control-End> { %W see end %W selection clear 0 end %W selection set end - event generate %W <<ListboxSelect>> + tk::FireListboxSelectEvent %W } bind Listbox <Control-Shift-End> { tk::ListboxDataExtend %W [%W index end] @@ -163,7 +163,7 @@ bind Listbox <<SelectAll>> { bind Listbox <<SelectNone>> { if {[%W cget -selectmode] ne "browse"} { %W selection clear 0 end - event generate %W <<ListboxSelect>> + tk::FireListboxSelectEvent %W } } @@ -256,7 +256,7 @@ proc ::tk::ListboxBeginSelect {w el {focus 1}} { set Priv(listboxSelection) {} set Priv(listboxPrev) $el } - event generate $w <<ListboxSelect>> + tk::FireListboxSelectEvent $w # check existence as ListboxSelect may destroy us if {$focus && [winfo exists $w] && [$w cget -state] eq "normal"} { focus $w @@ -284,7 +284,7 @@ proc ::tk::ListboxMotion {w el} { $w selection clear 0 end $w selection set $el set Priv(listboxPrev) $el - event generate $w <<ListboxSelect>> + tk::FireListboxSelectEvent $w } extended { set i $Priv(listboxPrev) @@ -315,7 +315,7 @@ proc ::tk::ListboxMotion {w el} { incr i -1 } set Priv(listboxPrev) $el - event generate $w <<ListboxSelect>> + tk::FireListboxSelectEvent $w } } } @@ -366,7 +366,7 @@ proc ::tk::ListboxBeginToggle {w el} { } else { $w selection set $el } - event generate $w <<ListboxSelect>> + tk::FireListboxSelectEvent $w } } @@ -418,7 +418,7 @@ proc ::tk::ListboxUpDown {w amount} { browse { $w selection clear 0 end $w selection set active - event generate $w <<ListboxSelect>> + tk::FireListboxSelectEvent $w } extended { $w selection clear 0 end @@ -426,7 +426,7 @@ proc ::tk::ListboxUpDown {w amount} { $w selection anchor active set Priv(listboxPrev) [$w index active] set Priv(listboxSelection) {} - event generate $w <<ListboxSelect>> + tk::FireListboxSelectEvent $w } } } @@ -514,7 +514,7 @@ proc ::tk::ListboxCancel w { } incr first } - event generate $w <<ListboxSelect>> + tk::FireListboxSelectEvent $w } # ::tk::ListboxSelectAll @@ -534,5 +534,19 @@ proc ::tk::ListboxSelectAll w { } else { $w selection set 0 end } - event generate $w <<ListboxSelect>> + tk::FireListboxSelectEvent $w +} + +# ::tk::FireListboxSelectEvent +# +# Fire the <<ListboxSelect>> event if the listbox is not in disabled +# state. +# +# Arguments: +# w - The listbox widget. + +proc ::tk::FireListboxSelectEvent w { + if {[$w cget -state] eq "normal"} { + event generate $w <<ListboxSelect>> + } } diff --git a/library/menu.tcl b/library/menu.tcl index d05740f..a7aaa3f 100644 --- a/library/menu.tcl +++ b/library/menu.tcl @@ -248,7 +248,6 @@ proc ::tk::MbLeave w { proc ::tk::MbPost {w {x {}} {y {}}} { global errorInfo variable ::tk::Priv - global tcl_platform if {[$w cget -state] eq "disabled" || $w eq $Priv(postedMb)} { return @@ -313,6 +312,9 @@ proc ::tk::MbPost {w {x {}} {y {}}} { set x [expr {[winfo rootx $w] - [winfo reqwidth $menu]}] set y [expr {(2 * [winfo rooty $w] + [winfo height $w]) / 2}] set entry [MenuFindName $menu [$w cget -text]] + if {$entry eq ""} { + set entry 0 + } if {[$w cget -indicatoron]} { if {$entry == [$menu index last]} { incr y [expr {-([$menu yposition $entry] \ @@ -333,6 +335,9 @@ proc ::tk::MbPost {w {x {}} {y {}}} { set x [expr {[winfo rootx $w] + [winfo width $w]}] set y [expr {(2 * [winfo rooty $w] + [winfo height $w]) / 2}] set entry [MenuFindName $menu [$w cget -text]] + if {$entry eq ""} { + set entry 0 + } if {[$w cget -indicatoron]} { if {$entry == [$menu index last]} { incr y [expr {-([$menu yposition $entry] \ @@ -396,7 +401,6 @@ proc ::tk::MbPost {w {x {}} {y {}}} { # is a posted menubutton. proc ::tk::MenuUnpost menu { - global tcl_platform variable ::tk::Priv set mb $Priv(postedMb) @@ -525,7 +529,6 @@ proc ::tk::MbMotion {w upDown rootx rooty} { proc ::tk::MbButtonUp w { variable ::tk::Priv - global tcl_platform set menu [$w cget -menu] set tearoff [expr {[tk windowingsystem] eq "x11" || \ @@ -600,7 +603,6 @@ proc ::tk::MenuMotion {menu x y state} { proc ::tk::MenuButtonDown menu { variable ::tk::Priv - global tcl_platform if {![winfo viewable $menu]} { return @@ -1030,7 +1032,7 @@ proc ::tk::MenuFind {w char} { proc ::tk::TraverseToMenu {w char} { variable ::tk::Priv - if {$char eq ""} { + if {![winfo exists $w] || $char eq ""} { return } while {[winfo class $w] eq "Menu"} { @@ -1212,8 +1214,6 @@ proc ::tk::MenuFindName {menu s} { # upper-left corner goes at (x,y). proc ::tk::PostOverPoint {menu x y {entry {}}} { - global tcl_platform - if {$entry ne ""} { if {$entry == [$menu index last]} { incr y [expr {-([$menu yposition $entry] \ @@ -1228,8 +1228,8 @@ proc ::tk::PostOverPoint {menu x y {entry {}}} { if {[tk windowingsystem] eq "win32"} { # osVersion is not available in safe interps set ver 5 - if {[info exists tcl_platform(osVersion)]} { - scan $tcl_platform(osVersion) %d ver + if {[info exists ::tcl_platform(osVersion)]} { + scan $::tcl_platform(osVersion) %d ver } # We need to fix some problems with menu posting on Windows, @@ -1334,7 +1334,6 @@ proc ::tk::GenerateMenuSelect {menu} { proc ::tk_popup {menu x y {entry {}}} { variable ::tk::Priv - global tcl_platform if {$Priv(popup) ne "" || $Priv(postedMb) ne ""} { tk::MenuUnpost {} } diff --git a/library/mkpsenc.tcl b/library/mkpsenc.tcl index 50224eb..b3fd13d 100644 --- a/library/mkpsenc.tcl +++ b/library/mkpsenc.tcl @@ -1163,11 +1163,11 @@ namespace eval ::tk { 0 exch 0 exch { dup type /stringtype eq - { stringwidth } { + { stringwidth } { currentfont /Encoding get exch 1 exch put (\001) - stringwidth + stringwidth } - ifelse + ifelse exch 3 1 roll add 3 1 roll add exch } forall } diff --git a/library/msgbox.tcl b/library/msgbox.tcl index 10e91f1..6d329c2 100644 --- a/library/msgbox.tcl +++ b/library/msgbox.tcl @@ -129,7 +129,7 @@ static unsigned char w3_bits[] = { # See the user documentation for details on what tk_messageBox does. # proc ::tk::MessageBox {args} { - global tcl_platform tk_strictMotif + global tk_strictMotif variable ::tk::Priv set w ::tk::PrivMsgBox @@ -137,7 +137,7 @@ proc ::tk::MessageBox {args} { # # The default value of the title is space (" ") not the empty string - # because for some window managers, a + # because for some window managers, a # wm title .foo "" # causes the window title to be "foo" instead of the empty string. # @@ -175,7 +175,7 @@ proc ::tk::MessageBox {args} { } switch -- $data(-type) { - abortretryignore { + abortretryignore { set names [list abort retry ignore] set labels [list &Abort &Retry &Ignore] set cancel abort @@ -218,7 +218,7 @@ proc ::tk::MessageBox {args} { lappend buttons [list $name -text [mc $lab]] } - # If no default button was specified, the default default is the + # If no default button was specified, the default default is the # first button (Bug: 2218). if {$data(-default) eq ""} { diff --git a/library/msgs/es.msg b/library/msgs/es.msg index 991711b..578c52c 100644 --- a/library/msgs/es.msg +++ b/library/msgs/es.msg @@ -1,7 +1,7 @@ namespace eval ::tk { ::msgcat::mcset es "&Abort" "&Abortar" ::msgcat::mcset es "&About..." "&Acerca de ..." - ::msgcat::mcset es "All Files" "Todos los archivos" + ::msgcat::mcset es "All Files" "Todos los archivos" ::msgcat::mcset es "Application Error" "Error de la aplicaci\u00f3n" ::msgcat::mcset es "&Blue" "&Azul" ::msgcat::mcset es "Cancel" "Cancelar" @@ -61,7 +61,7 @@ namespace eval ::tk { ::msgcat::mcset es "Tcl Scripts" "Scripts Tcl" ::msgcat::mcset es "Tcl for Windows" "Tcl para Windows" ::msgcat::mcset es "Text Files" "Archivos de texto" - ::msgcat::mcset es "&Yes" "&S\u00ed" + ::msgcat::mcset es "&Yes" "&S\u00ed" ::msgcat::mcset es "abort" "abortar" ::msgcat::mcset es "blue" "azul" ::msgcat::mcset es "cancel" "cancelar" diff --git a/library/msgs/ru.msg b/library/msgs/ru.msg index be2b551..2aac5bb 100644 --- a/library/msgs/ru.msg +++ b/library/msgs/ru.msg @@ -18,7 +18,7 @@ namespace eval ::tk { ::msgcat::mcset ru "Details >>" "\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 >>" ::msgcat::mcset ru "Directory \"%1\$s\" does not exist." "\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \"%1\$s\" \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442." ::msgcat::mcset ru "&Directory:" "&\u041a\u0430\u0442\u0430\u043b\u043e\u0433:" - ::msgcat::mcset ru "Error: %1\$s" "\u041e\u0448\u0438\u0431\u043a\u0430: %1\$s" + ::msgcat::mcset ru "Error: %1\$s" "\u041e\u0448\u0438\u0431\u043a\u0430: %1\$s" ::msgcat::mcset ru "E&xit" "\u0412\u044b\u0445\u043e\u0434" ::msgcat::mcset ru "File \"%1\$s\" already exists.\nDo you want to overwrite it?" \ "\u0424\u0430\u0439\u043b \"%1\$s\" \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.\n\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e?" @@ -34,7 +34,7 @@ namespace eval ::tk { ::msgcat::mcset ru "Hi" "\u041f\u0440\u0438\u0432\u0435\u0442" ::msgcat::mcset ru "&Hide Console" "\u0421\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c" ::msgcat::mcset ru "&Ignore" "&\u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c" - ::msgcat::mcset ru "Invalid file name \"%1\$s\"." "\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \"%1\$s\"." + ::msgcat::mcset ru "Invalid file name \"%1\$s\"." "\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \"%1\$s\"." ::msgcat::mcset ru "Log Files" "\u0424\u0430\u0439\u043b\u044b \u0436\u0443\u0440\u043d\u0430\u043b\u0430" ::msgcat::mcset ru "&No" "&\u041d\u0435\u0442" ::msgcat::mcset ru "&OK" "&\u041e\u041a" diff --git a/library/palette.tcl b/library/palette.tcl index 924dd61..9cecf5b 100644 --- a/library/palette.tcl +++ b/library/palette.tcl @@ -100,7 +100,7 @@ proc ::tk_setPalette {args} { set new(troughColor) $darkerBg } - # let's make one of each of the widgets so we know what the + # let's make one of each of the widgets so we know what the # defaults are currently for this platform. toplevel .___tk_set_palette wm withdraw .___tk_set_palette @@ -113,12 +113,12 @@ 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 + # 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, ::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 + # We have to walk the whole widget tree instead of just # relying on the widgets we've created above to do the work # because different extensions may provide other kinds # of widgets that we don't currently know about, so we'll @@ -144,7 +144,7 @@ proc ::tk_setPalette {args} { # ::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 +# argument. This looks at the defaults provided by the option # database, if it exists, and if not, then it looks at the default # value of the widget itself. # diff --git a/library/scale.tcl b/library/scale.tcl index d9e7d27..fb9b81b 100644 --- a/library/scale.tcl +++ b/library/scale.tcl @@ -223,7 +223,13 @@ proc ::tk::ScaleIncrement {w dir big repeat} { set inc [$w cget -resolution] } if {([$w cget -from] > [$w cget -to]) ^ ($dir eq "up")} { - set inc [expr {-$inc}] + if {$inc > 0} { + set inc [expr {-$inc}] + } + } else { + if {$inc < 0} { + set inc [expr {-$inc}] + } } $w set [expr {[$w get] + $inc}] diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl index 1f8c7d2..b7be014 100644 --- a/library/scrlbar.tcl +++ b/library/scrlbar.tcl @@ -15,7 +15,7 @@ #------------------------------------------------------------------------- # Standard Motif bindings: -if {[tk windowingsystem] eq "x11"} { +if {[tk windowingsystem] eq "x11" || [tk windowingsystem] eq "aqua"} { bind Scrollbar <Enter> { if {$tk_strictMotif} { @@ -152,6 +152,12 @@ switch [tk windowingsystem] { } } "x11" { + bind Scrollbar <MouseWheel> { + tk::ScrollByUnits %W v [expr {- (%D /120 ) * 4}] + } + bind Scrollbar <Shift-MouseWheel> { + tk::ScrollByUnits %W h [expr {- (%D /120 ) * 4}] + } bind Scrollbar <4> {tk::ScrollByUnits %W v -5} bind Scrollbar <5> {tk::ScrollByUnits %W v 5} bind Scrollbar <Shift-4> {tk::ScrollByUnits %W h -5} diff --git a/library/spinbox.tcl b/library/spinbox.tcl index 641584d..6a5f829 100644 --- a/library/spinbox.tcl +++ b/library/spinbox.tcl @@ -52,7 +52,6 @@ bind Spinbox <<Copy>> { } } bind Spinbox <<Paste>> { - global tcl_platform catch { if {[tk windowingsystem] ne "x11"} { catch { @@ -74,8 +73,8 @@ bind Spinbox <<PasteSelection>> { } bind Spinbox <<TraverseIn>> { - %W selection range 0 end - %W icursor end + %W selection range 0 end + %W icursor end } # Standard Motif bindings: diff --git a/library/tearoff.tcl b/library/tearoff.tcl index 6da2a0f..b500023 100644 --- a/library/tearoff.tcl +++ b/library/tearoff.tcl @@ -150,7 +150,7 @@ proc ::tk::MenuDup {src dst type} { set tags [bindtags $src] set srcLen [string length $src] - + # Copy tags to x, replacing each substring of src with dst. while {[set index [string first $src $tags]] != -1} { diff --git a/library/text.tcl b/library/text.tcl index 279e2d9..2bf1b2b 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -85,7 +85,16 @@ bind Text <ButtonRelease-1> { } bind Text <Control-1> { %W mark set insert @%x,%y + # An operation that moves the insert mark without making it + # one end of the selection must insert an autoseparator + if {[%W cget -autoseparators]} { + %W edit separator + } } +# stop an accidental double click triggering <Double-Button-1> +bind Text <Double-Control-1> { # nothing } +# stop an accidental movement triggering <B1-Motion> +bind Text <Control-B1-Motion> { # nothing } bind Text <<PrevChar>> { tk::TextSetCursor %W insert-1displayindices } @@ -245,6 +254,11 @@ bind Text <<SelectAll>> { } bind Text <<SelectNone>> { %W tag remove sel 1.0 end + # An operation that clears the selection must insert an autoseparator, + # because the selection operation may have moved the insert mark + if {[%W cget -autoseparators]} { + %W edit separator + } } bind Text <<Cut>> { tk_textCut %W @@ -256,7 +270,15 @@ bind Text <<Paste>> { tk_textPaste %W } bind Text <<Clear>> { + # Make <<Clear>> an atomic operation on the Undo stack, + # i.e. separate it from other delete operations on either side + if {[%W cget -autoseparators]} { + %W edit separator + } catch {%W delete sel.first sel.last} + if {[%W cget -autoseparators]} { + %W edit separator + } } bind Text <<PasteSelection>> { if {$tk_strictMotif || ![info exists tk::Priv(mouseMoved)] @@ -314,7 +336,16 @@ bind Text <Control-t> { } bind Text <<Undo>> { + # An Undo operation may remove the separator at the top of the Undo stack. + # Then the item at the top of the stack gets merged with the subsequent changes. + # Place separators before and after Undo to prevent this. + if {[%W cget -autoseparators]} { + %W edit separator + } catch { %W edit undo } + if {[%W cget -autoseparators]} { + %W edit separator + } } bind Text <<Redo>> { @@ -543,7 +574,6 @@ proc ::tk::TextAnchor {w} { } proc ::tk::TextSelectTo {w x y {extend 0}} { - global tcl_platform variable ::tk::Priv set anchorname [tk::TextAnchor $w] @@ -1022,9 +1052,18 @@ proc ::tk_textCopy w { proc ::tk_textCut w { if {![catch {set data [$w get sel.first sel.last]}]} { + # make <<Cut>> an atomic operation on the Undo stack, + # i.e. separate it from other delete operations on either side + set oldSeparator [$w cget -autoseparators] + if {$oldSeparator} { + $w edit separator + } clipboard clear -displayof $w clipboard append -displayof $w $data $w delete sel.first sel.last + if {$oldSeparator} { + $w edit separator + } } } @@ -1036,7 +1075,6 @@ proc ::tk_textCut w { # w - Name of a text widget. proc ::tk_textPaste w { - global tcl_platform if {![catch {::tk::GetSelection $w CLIPBOARD} sel]} { set oldSeparator [$w cget -autoseparators] if {$oldSeparator} { diff --git a/library/tk.tcl b/library/tk.tcl index c490797..946ab7e 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -13,7 +13,7 @@ # Insist on running with compatible version of Tcl package require Tcl 8.6 # Verify that we have Tk binary and script components from the same release -package require -exact Tk 8.6.1 +package require -exact Tk 8.6.4 # Create a ::tk namespace namespace eval ::tk { @@ -24,7 +24,7 @@ namespace eval ::tk { # The msgcat package is not available. Supply our own # minimal replacement. proc mc {src args} { - tailcall format $src {*}$args + return [format $src {*}$args] } proc mcmax {args} { set max 0 @@ -253,7 +253,6 @@ proc ::tk::ScreenChanged screen { uplevel #0 [list upvar #0 ::tk::Priv.$disp ::tk::Priv] variable ::tk::Priv - global tcl_platform if {[info exists Priv]} { set Priv(screen) $screen @@ -302,7 +301,7 @@ tk::ScreenChanged [winfo screen .] proc ::tk::EventMotifBindings {n1 dummy dummy} { upvar $n1 name - + if {$name} { set op delete } else { @@ -312,7 +311,6 @@ proc ::tk::EventMotifBindings {n1 dummy dummy} { event $op <<Cut>> <Control-Key-w> <Control-Lock-Key-W> <Shift-Key-Delete> event $op <<Copy>> <Meta-Key-w> <Meta-Lock-Key-W> <Control-Key-Insert> event $op <<Paste>> <Control-Key-y> <Control-Lock-Key-Y> <Shift-Key-Insert> - event $op <<Undo>> <Control-underscore> event $op <<PrevChar>> <Control-Key-b> <Control-Lock-Key-B> event $op <<NextChar>> <Control-Key-f> <Control-Lock-Key-F> event $op <<PrevLine>> <Control-Key-p> <Control-Lock-Key-P> @@ -328,41 +326,41 @@ proc ::tk::EventMotifBindings {n1 dummy dummy} { } #---------------------------------------------------------------------- -# Define common dialogs on platforms where they are not implemented +# Define common dialogs on platforms where they are not implemented # using compiled code. #---------------------------------------------------------------------- if {![llength [info commands tk_chooseColor]]} { proc ::tk_chooseColor {args} { - tailcall ::tk::dialog::color:: {*}$args + return [::tk::dialog::color:: {*}$args] } } if {![llength [info commands tk_getOpenFile]]} { proc ::tk_getOpenFile {args} { if {$::tk_strictMotif} { - tailcall ::tk::MotifFDialog open {*}$args + return [::tk::MotifFDialog open {*}$args] } else { - tailcall ::tk::dialog::file:: open {*}$args + return [::tk::dialog::file:: open {*}$args] } } } if {![llength [info commands tk_getSaveFile]]} { proc ::tk_getSaveFile {args} { if {$::tk_strictMotif} { - tailcall ::tk::MotifFDialog save {*}$args + return [::tk::MotifFDialog save {*}$args] } else { - tailcall ::tk::dialog::file:: save {*}$args + return [::tk::dialog::file:: save {*}$args] } } } if {![llength [info commands tk_messageBox]]} { proc ::tk_messageBox {args} { - tailcall ::tk::MessageBox {*}$args + return [::tk::MessageBox {*}$args] } } if {![llength [info command tk_chooseDirectory]]} { proc ::tk_chooseDirectory {args} { - tailcall ::tk::dialog::file::chooseDir:: {*}$args + return [::tk::dialog::file::chooseDir:: {*}$args] } } @@ -543,7 +541,7 @@ proc ::tk::CancelRepeat {} { # ::tk::TabToWindow -- # This procedure moves the focus to the given widget. -# It sends a <<TraverseOut>> virtual event to the previous focus window, +# It sends a <<TraverseOut>> virtual event to the previous focus window, # if any, before changing the focus, and a <<TraverseIn>> event # to the new focus window afterwards. # @@ -571,7 +569,7 @@ proc ::tk::UnderlineAmpersand {text} { return [list [string map {\ufeff {}} $s] $idx] } -# ::tk::SetAmpText -- +# ::tk::SetAmpText -- # Given widget path and text with "magic ampersands", sets -text and # -underline options for the widget # diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl index 6604575..a52465a 100644 --- a/library/tkfbox.tcl +++ b/library/tkfbox.tcl @@ -1169,6 +1169,10 @@ proc ::tk::dialog::file::GlobFiltered {dir type {overrideFilter 0}} { if {$f eq "." || $f eq ".."} { continue } + # See ticket [1641721], $f might be a link pointing to a dir + if {$type != "d" && [file isdir [file join $dir $f]]} { + continue + } lappend result $f } } @@ -1176,7 +1180,6 @@ proc ::tk::dialog::file::GlobFiltered {dir type {overrideFilter 0}} { } proc ::tk::dialog::file::CompleteEnt {w} { - variable showHiddenVar upvar ::tk::dialog::file::[winfo name $w] data set f [$data(ent) get] if {$data(-multiple)} { diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl index be2299f..b3ebcbd 100644 --- a/library/ttk/entry.tcl +++ b/library/ttk/entry.tcl @@ -14,7 +14,7 @@ namespace eval ttk { variable State set State(x) 0 - set State(selectMode) char + set State(selectMode) none set State(anchor) 0 set State(scanX) 0 set State(scanIndex) 0 @@ -74,9 +74,9 @@ bind TEntry <Double-ButtonPress-1> { ttk::entry::Select %W %x word } bind TEntry <Triple-ButtonPress-1> { ttk::entry::Select %W %x line } bind TEntry <B1-Motion> { ttk::entry::Drag %W %x } -bind TEntry <B1-Leave> { ttk::Repeatedly ttk::entry::AutoScroll %W } -bind TEntry <B1-Enter> { ttk::CancelRepeat } -bind TEntry <ButtonRelease-1> { ttk::CancelRepeat } +bind TEntry <B1-Leave> { ttk::entry::DragOut %W %m } +bind TEntry <B1-Enter> { ttk::entry::DragIn %W } +bind TEntry <ButtonRelease-1> { ttk::entry::Release %W } bind TEntry <<ToggleSelection>> { %W instate {!readonly !disabled} { %W icursor @%x ; focus %W } @@ -400,14 +400,40 @@ proc ttk::entry::DragTo {w x} { char { CharSelect $w $State(anchor) $cur } word { WordSelect $w $State(anchor) $cur } line { LineSelect $w $State(anchor) $cur } + none { # no-op } } } +## <B1-Leave> binding: +# Begin autoscroll. +# +proc ttk::entry::DragOut {w mode} { + variable State + if {$State(selectMode) ne "none" && $mode eq "NotifyNormal"} { + ttk::Repeatedly ttk::entry::AutoScroll $w + } +} + +## <B1-Enter> binding +# Suspend autoscroll. +# +proc ttk::entry::DragIn {w} { + ttk::CancelRepeat +} + +## <ButtonRelease-1> binding +# +proc ttk::entry::Release {w} { + variable State + set State(selectMode) none + ttk::CancelRepeat ;# suspend autoscroll +} + ## AutoScroll # Called repeatedly when the mouse is outside an entry window # with Button 1 down. Scroll the window left or right, -# depending on where the mouse is, and extend the selection -# according to the current selection mode. +# depending on where the mouse left the window, and extend +# the selection according to the current selection mode. # # TODO: AutoScroll should repeat faster (50ms) than normal autorepeat. # TODO: Need a way for Repeat scripts to cancel themselves. diff --git a/library/unsupported.tcl b/library/unsupported.tcl index 2c68e78..b5f404a 100644 --- a/library/unsupported.tcl +++ b/library/unsupported.tcl @@ -16,7 +16,7 @@ namespace eval ::tk::unsupported { # Map from the old global names of Tk private commands to their # new namespace-encapsulated names. - variable PrivateCommands + variable PrivateCommands array set PrivateCommands { tkButtonAutoInvoke ::tk::ButtonAutoInvoke tkButtonDown ::tk::ButtonDown diff --git a/library/xmfbox.tcl b/library/xmfbox.tcl index 0578361..aa66f7f 100644 --- a/library/xmfbox.tcl +++ b/library/xmfbox.tcl @@ -27,7 +27,7 @@ namespace eval ::tk::dialog::file {} # When -multiple is set to 0, this returns the absolute pathname # of the selected file. (NOTE: This is not the same as a single # element list.) -# +# # When -multiple is set to > 0, this returns a Tcl list of absolute # pathnames. The argument for -multiple is ignored, but for consistency # with Windows it defines the maximum amount of memory to allocate for @@ -505,7 +505,7 @@ proc ::tk::MotifFDialog_InterpFilter {w} { if {[file pathtype $text] eq "relative"} { set relative 1 } elseif {$badTilde} { - set relative 1 + set relative 1 } if {$relative} { @@ -552,7 +552,7 @@ proc ::tk::MotifFDialog_Update {w} { $data(sEnt) delete 0 end $data(sEnt) insert 0 [::tk::dialog::file::JoinFile $data(selectPath) \ $data(selectFile)] - + MotifFDialog_LoadFiles $w } @@ -626,7 +626,7 @@ proc ::tk::MotifFDialog_LoadFiles {w} { # w The pathname of the dialog box. # # Results: -# None. +# None. proc ::tk::MotifFDialog_BrowseDList {w} { upvar ::tk::dialog::file::[winfo name $w] data @@ -672,7 +672,7 @@ proc ::tk::MotifFDialog_BrowseDList {w} { # w The pathname of the dialog box. # # Results: -# None. +# None. proc ::tk::MotifFDialog_ActivateDList {w} { upvar ::tk::dialog::file::[winfo name $w] data @@ -720,7 +720,7 @@ proc ::tk::MotifFDialog_ActivateDList {w} { # w The pathname of the dialog box. # # Results: -# None. +# None. proc ::tk::MotifFDialog_BrowseFList {w} { upvar ::tk::dialog::file::[winfo name $w] data @@ -740,9 +740,9 @@ proc ::tk::MotifFDialog_BrowseFList {w} { $data(fEnt) insert 0 [::tk::dialog::file::JoinFile $data(selectPath) \ $data(filter)] $data(fEnt) xview end - - # if it's a multiple selection box, just put in the filenames - # otherwise put in the full path as usual + + # if it's a multiple selection box, just put in the filenames + # otherwise put in the full path as usual $data(sEnt) delete 0 end if {$data(-multiple) != 0} { $data(sEnt) insert 0 $data(selectFile) @@ -762,7 +762,7 @@ proc ::tk::MotifFDialog_BrowseFList {w} { # w The pathname of the dialog box. # # Results: -# None. +# None. proc ::tk::MotifFDialog_ActivateFList {w} { upvar ::tk::dialog::file::[winfo name $w] data @@ -788,7 +788,7 @@ proc ::tk::MotifFDialog_ActivateFList {w} { # w The pathname of the dialog box. # # Results: -# None. +# None. proc ::tk::MotifFDialog_ActivateFEnt {w} { upvar ::tk::dialog::file::[winfo name $w] data @@ -803,7 +803,7 @@ proc ::tk::MotifFDialog_ActivateFEnt {w} { # ::tk::MotifFDialog_ActivateSEnt -- # # This procedure is called when the user presses Return inside -# the "selection" entry. It sets the ::tk::Priv(selectFilePath) +# the "selection" entry. It sets the ::tk::Priv(selectFilePath) # variable so that the vwait loop in tk::MotifFDialog will be # terminated. # @@ -811,7 +811,7 @@ proc ::tk::MotifFDialog_ActivateFEnt {w} { # w The pathname of the dialog box. # # Results: -# None. +# None. proc ::tk::MotifFDialog_ActivateSEnt {w} { variable ::tk::Priv @@ -930,7 +930,7 @@ proc ::tk::ListBoxKeyAccel_Unset {w} { # key The key which the user just pressed. # # Results: -# None. +# None. proc ::tk::ListBoxKeyAccel_Key {w key} { variable ::tk::Priv |