diff options
Diffstat (limited to 'library')
-rw-r--r-- | library/bgerror.tcl | 3 | ||||
-rw-r--r-- | library/demos/cscroll.tcl | 55 | ||||
-rw-r--r-- | library/demos/paned1.tcl | 4 | ||||
-rw-r--r-- | library/dialog.tcl | 5 | ||||
-rw-r--r-- | library/iconlist.tcl | 23 | ||||
-rw-r--r-- | library/listbox.tcl | 20 | ||||
-rw-r--r-- | library/msgbox.tcl | 3 | ||||
-rw-r--r-- | library/scrlbar.tcl | 60 | ||||
-rw-r--r-- | library/text.tcl | 29 | ||||
-rw-r--r-- | library/tk.tcl | 22 | ||||
-rw-r--r-- | library/ttk/aquaTheme.tcl | 6 | ||||
-rw-r--r-- | library/ttk/cursors.tcl | 31 | ||||
-rw-r--r-- | library/ttk/utils.tcl | 59 |
13 files changed, 203 insertions, 117 deletions
diff --git a/library/bgerror.tcl b/library/bgerror.tcl index 574ad8b..fa095f3 100644 --- a/library/bgerror.tcl +++ b/library/bgerror.tcl @@ -21,7 +21,8 @@ namespace eval ::tk::dialog::error { if {[tk windowingsystem] eq "aqua"} { option add *ErrorDialog*background systemAlertBackgroundActive \ widgetDefault - option add *ErrorDialog*info.text.background white widgetDefault + option add *ErrorDialog*info.text.background \ + systemTextBackgroundColor widgetDefault option add *ErrorDialog*Button.highlightBackground \ systemAlertBackgroundActive widgetDefault } diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl index f6e88f4..570a35b 100644 --- a/library/demos/cscroll.tcl +++ b/library/demos/cscroll.tcl @@ -60,19 +60,66 @@ bind $c <2> "$c scan mark %x %y" bind $c <B2-Motion> "$c scan dragto %x %y" if {[tk windowingsystem] eq "aqua"} { bind $c <MouseWheel> { - %W yview scroll [expr {- (%D)}] units + %W yview scroll [expr {-(%D)}] units } bind $c <Option-MouseWheel> { - %W yview scroll [expr {-10 * (%D)}] units + %W yview scroll [expr {-10 * (%D)}] units } bind $c <Shift-MouseWheel> { - %W xview scroll [expr {- (%D)}] units + %W xview scroll [expr {-(%D)}] units } bind $c <Shift-Option-MouseWheel> { - %W xview scroll [expr {-10 * (%D)}] units + %W xview scroll [expr {-10 * (%D)}] units + } +} else { + bind $c <MouseWheel> { + %W yview scroll [expr {-(%D / 30)}] units + } + bind $c <Shift-MouseWheel> { + %W xview scroll [expr {-(%D / 30)}] units + } +} + +if {[tk windowingsystem] eq "x11"} { + # Support for mousewheels on Linux/Unix commonly comes through mapping + # the wheel to the extended buttons. If you have a mousewheel, find + # Linux configuration info at: + # http://linuxreviews.org/howtos/xfree/mouse/ + bind $c <4> { + if {!$tk_strictMotif} { + %W yview scroll -5 units + } + } + bind $c <Shift-4> { + if {!$tk_strictMotif} { + %W xview scroll -5 units + } + } + bind $c <5> { + if {!$tk_strictMotif} { + %W yview scroll 5 units + } + } + bind $c <Shift-5> { + if {!$tk_strictMotif} { + %W xview scroll 5 units + } + } + if {[package vsatisfies [package provide Tk] 8.7]} { + bind $c <6> { + if {!$tk_strictMotif} { + %W xview scroll -5 units + } + } + bind $c <7> { + if {!$tk_strictMotif} { + %W xview scroll 5 units + } + } } } + proc scrollEnter canvas { global oldFill set id [$canvas find withtag current] diff --git a/library/demos/paned1.tcl b/library/demos/paned1.tcl index 783b7f3..6b21d35 100644 --- a/library/demos/paned1.tcl +++ b/library/demos/paned1.tcl @@ -26,7 +26,7 @@ pack $btns -side bottom -fill x panedwindow $w.pane pack $w.pane -side top -expand yes -fill both -pady 2 -padx 2m -label $w.pane.left -text "This is the\nleft side" -bg yellow -label $w.pane.right -text "This is the\nright side" -bg cyan +label $w.pane.left -text "This is the\nleft side" -fg black -bg yellow +label $w.pane.right -text "This is the\nright side" -fg black -bg cyan $w.pane add $w.pane.left $w.pane.right diff --git a/library/dialog.tcl b/library/dialog.tcl index c751621..a099d90 100644 --- a/library/dialog.tcl +++ b/library/dialog.tcl @@ -44,11 +44,6 @@ proc ::tk_dialog {w title text bitmap default args} { } set windowingsystem [tk windowingsystem] - if {$windowingsystem eq "aqua"} { - option add *Dialog*background systemDialogBackgroundActive widgetDefault - option add *Dialog*Button.highlightBackground \ - systemDialogBackgroundActive widgetDefault - } # 1. Create the top-level window and divide it into top # and bottom parts. diff --git a/library/iconlist.tcl b/library/iconlist.tcl index 62b0b2d..30352a1 100644 --- a/library/iconlist.tcl +++ b/library/iconlist.tcl @@ -446,6 +446,19 @@ package require Tk 8.6 bind $canvas <Control-B1-Motion> {;} bind $canvas <Shift-B1-Motion> [namespace code {my ShiftMotion1 %x %y}] + if {[tk windowingsystem] eq "aqua"} { + bind $canvas <Shift-MouseWheel> [namespace code {my MouseWheel [expr {40 * (%W)}]}] + bind $canvas <Option-Shift-MouseWheel> [namespace code {my MouseWheel [expr {400 * (%W)}]}] + } else { + bind $canvas <Shift-MouseWheel> [namespace code {my MouseWheel %W}] + } + if {[tk windowingsystem] eq "x11"} { + bind $canvas <Shift-4> [namespace code {my MouseWheel 120}] + bind $canvas <Shift-5> [namespace code {my MouseWheel -120}] + bind $canvas <6> [namespace code {my MouseWheel 120}] + bind $canvas <7> [namespace code {my MouseWheel -120}] + } + bind $canvas <<PrevLine>> [namespace code {my UpDown -1}] bind $canvas <<NextLine>> [namespace code {my UpDown 1}] bind $canvas <<PrevChar>> [namespace code {my LeftRight -1}] @@ -492,6 +505,16 @@ package require Tk 8.6 # ---------------------------------------------------------------------- # Event handlers + method MouseWheel {amount} { + if {$noScroll || $::tk_strictMotif} { + return + } + if {$amount > 0} { + $canvas xview scroll [expr {(-119-$amount) / 120}] units + } else { + $canvas xview scroll [expr {-($amount / 120)}] units + } + } method Btn1 {x y} { focus $canvas set i [$w index @$x,$y] diff --git a/library/listbox.tcl b/library/listbox.tcl index 16e51bd..dc2296c 100644 --- a/library/listbox.tcl +++ b/library/listbox.tcl @@ -182,27 +182,27 @@ bind Listbox <B2-Motion> { if {[tk windowingsystem] eq "aqua"} { bind Listbox <MouseWheel> { - %W yview scroll [expr {- (%D)}] units + %W yview scroll [expr {-(%D)}] units } bind Listbox <Option-MouseWheel> { %W yview scroll [expr {-10 * (%D)}] units } bind Listbox <Shift-MouseWheel> { - %W xview scroll [expr {- (%D)}] units + %W xview scroll [expr {-(%D)}] units } bind Listbox <Shift-Option-MouseWheel> { %W xview scroll [expr {-10 * (%D)}] units } } else { bind Listbox <MouseWheel> { - %W yview scroll [expr {- (%D / 120) * 4}] units + %W yview scroll [expr {-(%D/30)}] units } bind Listbox <Shift-MouseWheel> { - %W xview scroll [expr {- (%D / 120) * 4}] units + %W xview scroll [expr {-(%D/30)}] units } } -if {"x11" eq [tk windowingsystem]} { +if {[tk windowingsystem] eq "x11"} { # Support for mousewheels on Linux/Unix commonly comes through mapping # the wheel to the extended buttons. If you have a mousewheel, find # Linux configuration info at: @@ -227,6 +227,16 @@ if {"x11" eq [tk windowingsystem]} { %W xview scroll 5 units } } + bind Listbox <6> { + if {!$tk_strictMotif} { + %W xview scroll -5 units + } + } + bind Listbox <7> { + if {!$tk_strictMotif} { + %W xview scroll 5 units + } + } } # ::tk::ListboxBeginSelect -- diff --git a/library/msgbox.tcl b/library/msgbox.tcl index 98603af..646c143 100644 --- a/library/msgbox.tcl +++ b/library/msgbox.tcl @@ -164,9 +164,6 @@ proc ::tk::MessageBox {args} { "warning" {set data(-icon) "caution"} "info" {set data(-icon) "note"} } - option add *Dialog*background systemDialogBackgroundActive widgetDefault - option add *Dialog*Button.highlightBackground \ - systemDialogBackgroundActive widgetDefault } if {![winfo exists $data(-parent)]} { diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl index 6f1caa2..0cbbc66 100644 --- a/library/scrlbar.tcl +++ b/library/scrlbar.tcl @@ -128,42 +128,38 @@ bind Scrollbar <<LineEnd>> { tk::ScrollToPos %W 1 } } -switch [tk windowingsystem] { - "aqua" { - bind Scrollbar <MouseWheel> { - tk::ScrollByUnits %W v [expr {- (%D)}] - } - bind Scrollbar <Option-MouseWheel> { - tk::ScrollByUnits %W v [expr {-10 * (%D)}] - } - bind Scrollbar <Shift-MouseWheel> { - tk::ScrollByUnits %W h [expr {- (%D)}] - } - bind Scrollbar <Shift-Option-MouseWheel> { - tk::ScrollByUnits %W h [expr {-10 * (%D)}] - } + +if {[tk windowingsystem] eq "aqua"} { + bind Scrollbar <MouseWheel> { + tk::ScrollByUnits %W v [expr {-(%D)}] } - "win32" { - 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 <Option-MouseWheel> { + tk::ScrollByUnits %W v [expr {-10 * (%D)}] } - "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} - bind Scrollbar <Shift-5> {tk::ScrollByUnits %W h 5} + bind Scrollbar <Shift-MouseWheel> { + tk::ScrollByUnits %W h [expr {-(%D)}] + } + bind Scrollbar <Shift-Option-MouseWheel> { + tk::ScrollByUnits %W h [expr {-10 * (%D)}] + } +} else { + bind Scrollbar <MouseWheel> { + tk::ScrollByUnits %W v [expr {-(%D / 30)}] + } + bind Scrollbar <Shift-MouseWheel> { + tk::ScrollByUnits %W h [expr {-(%D / 30)}] } } + +if {[tk windowingsystem] eq "x11"} { + 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} + bind Scrollbar <Shift-5> {tk::ScrollByUnits %W h 5} + bind Scrollbar <6> {tk::ScrollByUnits %W h -5} + bind Scrollbar <7> {tk::ScrollByUnits %W h 5} +} + # tk::ScrollButtonDown -- # This procedure is invoked when a button is pressed in a scrollbar. # It changes the way the scrollbar is displayed and takes actions diff --git a/library/text.tcl b/library/text.tcl index 788a6b9..964a5fb 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -468,7 +468,7 @@ if {[tk windowingsystem] eq "aqua"} { } } -if {"x11" eq [tk windowingsystem]} { +if {[tk windowingsystem] eq "x11"} { # Support for mousewheels on Linux/Unix commonly comes through mapping # the wheel to the extended buttons. If you have a mousewheel, find # Linux configuration info at: @@ -493,6 +493,16 @@ if {"x11" eq [tk windowingsystem]} { %W xview scroll 50 pixels } } + bind Text <6> { + if {!$tk_strictMotif} { + %W xview scroll -50 pixels + } + } + bind Text <7> { + if {!$tk_strictMotif} { + %W xview scroll 50 pixels + } + } } # ::tk::TextClosestGap -- @@ -900,11 +910,10 @@ proc ::tk::TextInsert {w s} { # ::tk::TextUpDownLine -- # Returns the index of the character one display line above or below the -# insertion cursor. There are two tricky things here. First, we want to -# maintain the original x position across repeated operations, even though -# some lines that will get passed through don't have enough characters to -# cover the original column. Second, don't try to scroll past the -# beginning or end of the text. +# insertion cursor. There is a tricky thing here: we want to maintain the +# original x position across repeated operations, even though some lines +# that will get passed through don't have enough characters to cover the +# original column. # # Arguments: # w - The text window in which the cursor is to move. @@ -921,11 +930,11 @@ proc ::tk::TextUpDownLine {w n} { set lines [$w count -displaylines $Priv(textPosOrig) $i] set new [$w index \ "$Priv(textPosOrig) + [expr {$lines + $n}] displaylines"] - if {[$w compare $new == end] \ - || [$w compare $new == "insert display linestart"]} { - set new $i - } set Priv(prevPos) $new + if {[$w compare $new == "end display lineend"] \ + || [$w compare $new == "insert display linestart"]} { + set Priv(textPosOrig) $new + } return $new } diff --git a/library/tk.tcl b/library/tk.tcl index 67aedf9..047ea63 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -462,7 +462,8 @@ switch -exact -- [tk windowingsystem] { # Official bindings # See http://support.apple.com/kb/HT1343 event add <<SelectAll>> <Command-Key-a> - event add <<SelectNone>> <Option-Command-Key-a> + #Attach function keys not otherwise assigned to this event so they no-op - workaround for bug 0e6930dfe7 + event add <<SelectNone>> <Option-Command-Key-a> <Key-F5> <Key-F1> <Key-F5> <Key-F6> <Key-F7> <Key-F8> <Key-F9> <Key-F10> <Key-F11> <Key-F12> event add <<Undo>> <Command-Key-z> <Command-Lock-Key-Z> event add <<Redo>> <Shift-Command-Key-z> <Shift-Command-Lock-Key-z> event add <<NextChar>> <Right> <Control-Key-f> <Control-Lock-Key-F> @@ -684,13 +685,24 @@ if {[tk windowingsystem] eq "aqua"} { } } -#register to send data to macOS Services + if {[tk windowingsystem] eq "aqua"} { -proc ::tk::RegisterServiceWidget {w} { - ::tk::mac::registerServiceWidget $w - } + #register to send data to macOS Services + proc ::tk::RegisterServiceWidget {w} { + ::tk::mac::registerServiceWidget $w + } + + #stub procedures to respond to "do script" Apple Events + proc ::tk::mac::DoScriptFile {file} { + source $file + } + proc ::tk::mac::DoScriptText {script} { + eval $script + } } + + # Run the Ttk themed widget set initialization if {$::ttk::library ne ""} { uplevel \#0 [list source $::ttk::library/ttk.tcl] diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl index d1b0bff..15e13ce 100644 --- a/library/ttk/aquaTheme.tcl +++ b/library/ttk/aquaTheme.tcl @@ -26,8 +26,12 @@ namespace eval ttk::theme::aqua { !focus systemSelectedTextColor} # Button - ttk::style configure TButton -anchor center -width -6\ + ttk::style configure TButton -anchor center -width -6 \ -foreground systemControlTextColor + ttk::style map TButton \ + -foreground { + pressed white + {alternate !pressed !background} white} ttk::style configure TMenubutton -anchor center -padding {2 0 0 2} ttk::style configure Toolbutton -anchor center diff --git a/library/ttk/cursors.tcl b/library/ttk/cursors.tcl index 75f7791..852f01c 100644 --- a/library/ttk/cursors.tcl +++ b/library/ttk/cursors.tcl @@ -99,23 +99,20 @@ namespace eval ttk { } "aqua" { - if {[package vsatisfies [package provide Tk] 8.5]} { - # appeared 2007-04-23, Tk 8.5a6 - array set Cursors { - standard arrow - text ibeam - link pointinghand - crosshair crosshair - busy watch - forbidden notallowed - - hresize resizeleftright - vresize resizeupdown - nresize resizeup - sresize resizedown - wresize resizeleft - eresize resizeright - } + array set Cursors { + standard arrow + text ibeam + link pointinghand + crosshair crosshair + busy watch + forbidden notallowed + + hresize resizeleftright + vresize resizeupdown + nresize resizeup + sresize resizedown + wresize resizeleft + eresize resizeright } } } diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl index 7cc1bb7..857f4cd 100644 --- a/library/ttk/utils.tcl +++ b/library/ttk/utils.tcl @@ -300,17 +300,15 @@ proc ttk::copyBindings {from to} { # proc ttk::bindMouseWheel {bindtag callback} { - switch -- [tk windowingsystem] { - x11 { - bind $bindtag <ButtonPress-4> "$callback -1" - bind $bindtag <ButtonPress-5> "$callback +1" - } - win32 { - bind $bindtag <MouseWheel> [append callback { [expr {-(%D/120)}]}] - } - aqua { - bind $bindtag <MouseWheel> [append callback { [expr {-(%D)}]} ] - } + if {[tk windowingsystem] eq "x11"} { + bind $bindtag <ButtonPress-4> "$callback -1" + bind $bindtag <ButtonPress-5> "$callback +1" + } + if {[tk windowingsystem] eq "aqua"} { + bind $bindtag <MouseWheel> [append callback { [expr {-(%D)}]} ] + bind $bindtag <Option-MouseWheel> [append callback { [expr {-10 *(%D)}]} ] + } else { + bind $bindtag <MouseWheel> [append callback { [expr {-(%D / 120)}]}] } } @@ -322,29 +320,26 @@ proc ttk::bindMouseWheel {bindtag callback} { # standard scrollbar protocol. # -switch -- [tk windowingsystem] { - x11 { - bind TtkScrollable <ButtonPress-4> { %W yview scroll -5 units } - bind TtkScrollable <ButtonPress-5> { %W yview scroll 5 units } - bind TtkScrollable <Shift-ButtonPress-4> { %W xview scroll -5 units } - bind TtkScrollable <Shift-ButtonPress-5> { %W xview scroll 5 units } - } - win32 { - bind TtkScrollable <MouseWheel> \ - { %W yview scroll [expr {-(%D/120)}] units } - bind TtkScrollable <Shift-MouseWheel> \ - { %W xview scroll [expr {-(%D/120)}] units } - } - aqua { - bind TtkScrollable <MouseWheel> \ +if {[tk windowingsystem] eq "x11"} { + bind TtkScrollable <ButtonPress-4> { %W yview scroll -5 units } + bind TtkScrollable <ButtonPress-5> { %W yview scroll 5 units } + bind TtkScrollable <Shift-ButtonPress-4> { %W xview scroll -5 units } + bind TtkScrollable <Shift-ButtonPress-5> { %W xview scroll 5 units } +} +if {[tk windowingsystem] eq "aqua"} { + bind TtkScrollable <MouseWheel> \ { %W yview scroll [expr {-(%D)}] units } - bind TtkScrollable <Shift-MouseWheel> \ + bind TtkScrollable <Shift-MouseWheel> \ { %W xview scroll [expr {-(%D)}] units } - bind TtkScrollable <Option-MouseWheel> \ - { %W yview scroll [expr {-10*(%D)}] units } - bind TtkScrollable <Shift-Option-MouseWheel> \ - { %W xview scroll [expr {-10*(%D)}] units } - } + bind TtkScrollable <Option-MouseWheel> \ + { %W yview scroll [expr {-10 * (%D)}] units } + bind TtkScrollable <Shift-Option-MouseWheel> \ + { %W xview scroll [expr {-10 * (%D)}] units } +} else { + bind TtkScrollable <MouseWheel> \ + { %W yview scroll [expr {-(%D / 120)}] units } + bind TtkScrollable <Shift-MouseWheel> \ + { %W xview scroll [expr {-(%D / 120)}] units } } #*EOF* |