diff options
Diffstat (limited to 'library')
-rw-r--r-- | library/demos/en.msg | 2 | ||||
-rw-r--r-- | library/demos/nl.msg | 4 | ||||
-rw-r--r-- | library/menu.tcl | 4 | ||||
-rw-r--r-- | library/tclIndex | 1 | ||||
-rw-r--r-- | library/text.tcl | 96 | ||||
-rw-r--r-- | library/tkfbox.tcl | 5 | ||||
-rw-r--r-- | library/ttk/altTheme.tcl | 12 | ||||
-rw-r--r-- | library/ttk/clamTheme.tcl | 34 | ||||
-rw-r--r-- | library/ttk/classicTheme.tcl | 13 | ||||
-rw-r--r-- | library/ttk/combobox.tcl | 3 | ||||
-rw-r--r-- | library/ttk/defaults.tcl | 42 | ||||
-rw-r--r-- | library/ttk/vistaTheme.tcl | 2 | ||||
-rw-r--r-- | library/xmfbox.tcl | 16 |
13 files changed, 183 insertions, 51 deletions
diff --git a/library/demos/en.msg b/library/demos/en.msg index e364c81..05d4a64 100644 --- a/library/demos/en.msg +++ b/library/demos/en.msg @@ -18,7 +18,7 @@ ::msgcat::mcset en "Demo code: %s" ::msgcat::mcset en "About Widget Demo" ::msgcat::mcset en "Tk widget demonstration application" -::msgcat::mcset en "Copyright \u00a9 %s" +::msgcat::mcset en "Copyright © %s" ::msgcat::mcset en " @@title Tk Widget Demonstrations diff --git a/library/demos/nl.msg b/library/demos/nl.msg index 61832d8..cd52630 100644 --- a/library/demos/nl.msg +++ b/library/demos/nl.msg @@ -18,9 +18,9 @@ ::msgcat::mcset nl "Demo code: %s" "Code van Demo %s" ::msgcat::mcset nl "About Widget Demo" "Over deze demonstratie" ::msgcat::mcset nl "Tk widget demonstration" "Demonstratie van Tk widgets" -::msgcat::mcset nl "Copyright \u00a9 %s" +::msgcat::mcset nl "Copyright © %s" -::msgcat::mcset nl "Tk Widget Demonstrations" "Demostratie van Tk widgets" +::msgcat::mcset nl "Tk Widget Demonstrations" "Demonstratie van Tk widgets" ::msgcat::mcset nl "This application provides a front end for several short scripts" \ "Dit programma is een schil rond enkele korte scripts waarmee" ::msgcat::mcset nl "that demonstrate what you can do with Tk widgets. Each of the" \ diff --git a/library/menu.tcl b/library/menu.tcl index a7aaa3f..b5dd88e 100644 --- a/library/menu.tcl +++ b/library/menu.tcl @@ -607,6 +607,10 @@ proc ::tk::MenuButtonDown menu { if {![winfo viewable $menu]} { return } + if {[$menu index active] eq "none"} { + set Priv(window) {} + return + } $menu postcascade active if {$Priv(postedMb) ne "" && [winfo viewable $Priv(postedMb)]} { grab -global $Priv(postedMb) diff --git a/library/tclIndex b/library/tclIndex index b3f37fa..919fa8a 100644 --- a/library/tclIndex +++ b/library/tclIndex @@ -247,7 +247,6 @@ set auto_index(::tk::ListBoxKeyAccel_Unset) [list source [file join $dir xmfbox. set auto_index(::tk::ListBoxKeyAccel_Key) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Goto) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Reset) [list source [file join $dir xmfbox.tcl]] -set auto_index(tk_getFileType) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::unsupported::ExposePrivateCommand) [list source [file join $dir unsupported.tcl]] set auto_index(::tk::unsupported::ExposePrivateVariable) [list source [file join $dir unsupported.tcl]] set auto_index(::tk::fontchooser) [list source [file join $dir fontchooser.tcl]] diff --git a/library/text.tcl b/library/text.tcl index 2bf1b2b..59e395c 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -1202,3 +1202,99 @@ proc ::tk::TextScanDrag {w x y} { $w scan dragto $x $y } } + +# ::tk::TextUndoRedoProcessMarks -- +# +# This proc is executed after an undo or redo action. +# It processes the list of undo/redo marks temporarily set in the +# text widget to positions delimiting where changes happened, and +# returns a flat list of ranges. The temporary marks are removed +# from the text widget. +# +# Arguments: +# w - The text widget + +proc ::tk::TextUndoRedoProcessMarks {w} { + set indices {} + set undoMarks {} + + # only consider the temporary marks set by an undo/redo action + foreach mark [$w mark names] { + if {[string range $mark 0 11] eq "tk::undoMark"} { + lappend undoMarks $mark + } + } + + # transform marks into indices + # the number of undo/redo marks is always even, each right mark + # completes a left mark to give a range + # this is true because: + # - undo/redo only deals with insertions and deletions of text + # - insertions may move marks but not delete them + # - when deleting text, marks located inside the deleted range + # are not erased but moved to the start of the deletion range + # . this is done in TkBTreeDeleteIndexRange ("This segment + # refuses to die...") + # . because MarkDeleteProc does nothing else than returning + # a value indicating that marks are not deleted by this + # deleteProc + # . mark deletion rather happen through [.text mark unset xxx] + # which was not used _up to this point of the code_ (it + # is a bit later just before exiting the present proc) + set nUndoMarks [llength $undoMarks] + set n [expr {$nUndoMarks / 2}] + set undoMarks [lsort -dictionary $undoMarks] + set Lmarks [lrange $undoMarks 0 [expr {$n - 1}]] + set Rmarks [lrange $undoMarks $n [llength $undoMarks]] + foreach Lmark $Lmarks Rmark $Rmarks { + lappend indices [$w index $Lmark] [$w index $Rmark] + $w mark unset $Lmark $Rmark + } + + # process ranges to: + # - remove those already fully included in another range + # - merge overlapping ranges + set ind [lsort -dictionary -stride 2 $indices] + set indices {} + + for {set i 0} {$i < $nUndoMarks} {incr i 2} { + set il1 [lindex $ind $i] + set ir1 [lindex $ind [expr {$i + 1}]] + lappend indices $il1 $ir1 + + for {set j [expr {$i + 2}]} {$j < $nUndoMarks} {incr j 2} { + set il2 [lindex $ind $j] + set ir2 [lindex $ind [expr {$j + 1}]] + + if {[$w compare $il2 > $ir1]} { + # second range starts after the end of first range + # -> further second ranges do not need to be considered + # because ranges were sorted by increasing first index + set j $nUndoMarks + + } else { + if {[$w compare $ir2 > $ir1]} { + # second range overlaps first range + # -> merge them into a single range + set indices [lreplace $indices end-1 end] + lappend indices $il1 $ir2 + + } else { + # second range is fully included in first range + # -> ignore it + + } + # in both cases above, the second range shall be + # trimmed out from the list of ranges + set ind [lreplace $ind $j [expr {$j + 1}]] + incr j -2 + incr nUndoMarks -2 + + } + + } + + } + + return $indices +} diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl index a52465a..f73fdc5 100644 --- a/library/tkfbox.tcl +++ b/library/tkfbox.tcl @@ -310,6 +310,7 @@ proc ::tk::dialog::file::Config {dataName type argList} { # 5. Parse the -filetypes option # + set data(origfiletypes) $data(-filetypes) set data(-filetypes) [::tk::FDGetFileTypes $data(-filetypes)] if {![winfo exists $data(-parent)]} { @@ -1119,7 +1120,9 @@ proc ::tk::dialog::file::Done {w {selectFilePath ""}} { && [info exists data(filterType)] && $data(filterType) ne "" } then { upvar #0 $data(-typevariable) typeVariable - set typeVariable [lindex $data(filterType) 0] + set typeVariable [lindex $data(origfiletypes) \ + [lsearch -exact $data(-filetypes) $data(filterType)] 0] + } } bind $data(okBtn) <Destroy> {} diff --git a/library/ttk/altTheme.tcl b/library/ttk/altTheme.tcl index d57227c..5630e6c 100644 --- a/library/ttk/altTheme.tcl +++ b/library/ttk/altTheme.tcl @@ -14,6 +14,7 @@ namespace eval ttk::theme::alt { -disabledfg "#a3a3a3" -selectbg "#4a6984" -selectfg "#ffffff" + -altindicator "#aaaaaa" } ttk::style theme settings alt { @@ -46,9 +47,13 @@ namespace eval ttk::theme::alt { ttk::style configure TCheckbutton -indicatorcolor "#ffffff" -padding 2 ttk::style configure TRadiobutton -indicatorcolor "#ffffff" -padding 2 ttk::style map TCheckbutton -indicatorcolor \ - [list disabled $colors(-frame) pressed $colors(-frame)] + [list pressed $colors(-frame) \ + alternate $colors(-altindicator) \ + disabled $colors(-frame)] ttk::style map TRadiobutton -indicatorcolor \ - [list disabled $colors(-frame) pressed $colors(-frame)] + [list pressed $colors(-frame) \ + alternate $colors(-altindicator) \ + disabled $colors(-frame)] ttk::style configure TMenubutton \ -width -11 -padding "3 3" -relief raised @@ -58,7 +63,8 @@ namespace eval ttk::theme::alt { [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure TCombobox -padding 1 ttk::style map TCombobox -fieldbackground \ - [list readonly $colors(-frame) disabled $colors(-frame)] + [list readonly $colors(-frame) disabled $colors(-frame)] \ + -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure ComboboxPopdownFrame \ -relief solid -borderwidth 1 diff --git a/library/ttk/clamTheme.tcl b/library/ttk/clamTheme.tcl index 1789b8a..98f0036 100644 --- a/library/ttk/clamTheme.tcl +++ b/library/ttk/clamTheme.tcl @@ -7,16 +7,18 @@ namespace eval ttk::theme::clam { variable colors array set colors { - -disabledfg "#999999" - -frame "#dcdad5" - -window "#ffffff" - -dark "#cfcdc8" - -darker "#bab5ab" - -darkest "#9e9a91" - -lighter "#eeebe7" - -lightest "#ffffff" - -selectbg "#4a6984" - -selectfg "#ffffff" + -disabledfg "#999999" + -frame "#dcdad5" + -window "#ffffff" + -dark "#cfcdc8" + -darker "#bab5ab" + -darkest "#9e9a91" + -lighter "#eeebe7" + -lightest "#ffffff" + -selectbg "#4a6984" + -selectfg "#ffffff" + -altindicator "#5895bc" + -disabledaltindicator "#a0a0a0" } ttk::style theme settings clam { @@ -80,9 +82,15 @@ namespace eval ttk::theme::clam { -indicatormargin {1 1 4 1} \ -padding 2 ; ttk::style map TCheckbutton -indicatorbackground \ - [list disabled $colors(-frame) pressed $colors(-frame)] + [list pressed $colors(-frame) \ + {!disabled alternate} $colors(-altindicator) \ + {disabled alternate} $colors(-disabledaltindicator) \ + disabled $colors(-frame)] ttk::style map TRadiobutton -indicatorbackground \ - [list disabled $colors(-frame) pressed $colors(-frame)] + [list pressed $colors(-frame) \ + {!disabled alternate} $colors(-altindicator) \ + {disabled alternate} $colors(-disabledaltindicator) \ + disabled $colors(-frame)] ttk::style configure TMenubutton \ -width -11 -padding 5 -relief raised @@ -102,7 +110,7 @@ namespace eval ttk::theme::clam { -fieldbackground [list {readonly focus} $colors(-selectbg) \ readonly $colors(-frame)] \ -foreground [list {readonly focus} $colors(-selectfg)] \ - ; + -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure ComboboxPopdownFrame \ -relief solid -borderwidth 1 diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl index 7e3eff5..3cb2b18 100644 --- a/library/ttk/classicTheme.tcl +++ b/library/ttk/classicTheme.tcl @@ -15,6 +15,7 @@ namespace eval ttk::theme::classic { -selectfg "#000000" -disabledfg "#a3a3a3" -indicator "#b03060" + -altindicator "#b05e5e" } ttk::style theme settings classic { @@ -49,15 +50,19 @@ namespace eval ttk::theme::classic { ttk::style configure TCheckbutton -indicatorrelief raised ttk::style map TCheckbutton \ -indicatorcolor [list \ - pressed $colors(-frame) selected $colors(-indicator)] \ - -indicatorrelief {selected sunken pressed sunken} \ + pressed $colors(-frame) \ + alternate $colors(-altindicator) \ + selected $colors(-indicator)] \ + -indicatorrelief {alternate raised selected sunken pressed sunken} \ ; ttk::style configure TRadiobutton -indicatorrelief raised ttk::style map TRadiobutton \ -indicatorcolor [list \ - pressed $colors(-frame) selected $colors(-indicator)] \ - -indicatorrelief {selected sunken pressed sunken} \ + pressed $colors(-frame) \ + alternate $colors(-altindicator) \ + selected $colors(-indicator)] \ + -indicatorrelief {alternate raised selected sunken pressed sunken} \ ; ttk::style configure TMenubutton -relief raised -padding "3m 1m" diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl index 03821a2..6ceccef 100644 --- a/library/ttk/combobox.tcl +++ b/library/ttk/combobox.tcl @@ -368,7 +368,8 @@ proc ttk::combobox::PlacePopdown {cb popdown} { set y [winfo rooty $cb] set w [winfo width $cb] set h [winfo height $cb] - set postoffset [ttk::style lookup TCombobox -postoffset {} {0 0 0 0}] + set style [$cb cget -style] + set postoffset [ttk::style lookup $style -postoffset {} {0 0 0 0}] foreach var {x y w h} delta $postoffset { incr $var $delta } diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl index 4551966..9cc5880 100644 --- a/library/ttk/defaults.tcl +++ b/library/ttk/defaults.tcl @@ -5,16 +5,19 @@ namespace eval ttk::theme::default { variable colors array set colors { - -frame "#d9d9d9" - -foreground "#000000" - -window "#ffffff" - -text "#000000" - -activebg "#ececec" - -selectbg "#4a6984" - -selectfg "#ffffff" - -darker "#c3c3c3" - -disabledfg "#a3a3a3" - -indicator "#4a6984" + -frame "#d9d9d9" + -foreground "#000000" + -window "#ffffff" + -text "#000000" + -activebg "#ececec" + -selectbg "#4a6984" + -selectfg "#ffffff" + -darker "#c3c3c3" + -disabledfg "#a3a3a3" + -indicator "#4a6984" + -disabledindicator "#a3a3a3" + -altindicator "#9fbdd8" + -disabledaltindicator "#c0c0c0" } ttk::style theme settings default { @@ -45,12 +48,24 @@ namespace eval ttk::theme::default { ttk::style configure TCheckbutton \ -indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1 ttk::style map TCheckbutton -indicatorcolor \ - [list pressed $colors(-activebg) selected $colors(-indicator)] + [list pressed $colors(-activebg) \ + {!disabled alternate} $colors(-altindicator) \ + {disabled alternate} $colors(-disabledaltindicator) \ + {!disabled selected} $colors(-indicator) \ + {disabled selected} $colors(-disabledindicator)] + ttk::style map TCheckbutton -indicatorrelief \ + [list alternate raised] ttk::style configure TRadiobutton \ -indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1 ttk::style map TRadiobutton -indicatorcolor \ - [list pressed $colors(-activebg) selected $colors(-indicator)] + [list pressed $colors(-activebg) \ + {!disabled alternate} $colors(-altindicator) \ + {disabled alternate} $colors(-disabledaltindicator) \ + {!disabled selected} $colors(-indicator) \ + {disabled selected} $colors(-disabledindicator)] + ttk::style map TRadiobutton -indicatorrelief \ + [list alternate raised] ttk::style configure TMenubutton \ -relief raised -padding "10 3" @@ -62,7 +77,8 @@ namespace eval ttk::theme::default { ttk::style configure TCombobox -arrowsize 12 -padding 1 ttk::style map TCombobox -fieldbackground \ - [list readonly $colors(-frame) disabled $colors(-frame)] + [list readonly $colors(-frame) disabled $colors(-frame)] \ + -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0} ttk::style map TSpinbox -fieldbackground \ diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl index c284a52..c6c380d 100644 --- a/library/ttk/vistaTheme.tcl +++ b/library/ttk/vistaTheme.tcl @@ -133,7 +133,7 @@ namespace eval ttk::theme::vista { Spinbox.background -sticky news -children { Spinbox.padding -sticky news -children { Spinbox.innerbg -sticky news -children { - Spinbox.textarea -expand 1 -sticky {} + Spinbox.textarea -expand 1 } } Spinbox.uparrow -side top -sticky ens diff --git a/library/xmfbox.tcl b/library/xmfbox.tcl index aa66f7f..f1daea0 100644 --- a/library/xmfbox.tcl +++ b/library/xmfbox.tcl @@ -156,7 +156,7 @@ proc ::tk::MotifFDialog_FileTypes {w} { # The filetypes radiobuttons # set data(fileType) $data(-defaulttype) # Default type to first entry - set initialTypeName [lindex $data(-filetypes) 0 0] + set initialTypeName [lindex $data(origfiletypes) 0 0] if {$data(-typevariable) ne ""} { upvar #0 $data(-typevariable) typeVariable if {[info exists typeVariable]} { @@ -165,7 +165,7 @@ proc ::tk::MotifFDialog_FileTypes {w} { } set ix 0 set data(fileType) 0 - foreach fltr $data(-filetypes) { + foreach fltr $data(origfiletypes) { set fname [lindex $fltr 0] if {[string first $initialTypeName $fname] == 0} { set data(fileType) $ix @@ -185,7 +185,7 @@ proc ::tk::MotifFDialog_FileTypes {w} { set cnt 0 if {$data(-filetypes) ne {}} { foreach type $data(-filetypes) { - set title [lindex [lindex $type 0] 0] + set title [lindex $type 0] set filter [lindex $type 1] radiobutton $f.b$cnt \ -text $title \ @@ -210,7 +210,6 @@ proc ::tk::MotifFDialog_SetFilter {w type} { variable ::tk::Priv set data(filter) [lindex $type 1] - set Priv(selectFileType) [lindex [lindex $type 0] 0] MotifFDialog_Update $w } @@ -299,6 +298,7 @@ proc ::tk::MotifFDialog_Config {dataName type argList} { # file dialog, but we check for validity of the value to make sure # the application code also runs fine with the TK file dialog. # + set data(origfiletypes) $data(-filetypes) set data(-filetypes) [::tk::FDGetFileTypes $data(-filetypes)] if {![info exists data(filter)]} { @@ -870,7 +870,7 @@ proc ::tk::MotifFDialog_ActivateSEnt {w} { if {[info exists data(-typevariable)] && $data(-typevariable) ne "" && [info exists data(-filetypes)] && $data(-filetypes) ne ""} { upvar #0 $data(-typevariable) typeVariable - set typeVariable [lindex $data(-filetypes) $data(fileType) 0] + set typeVariable [lindex $data(origfiletypes) $data(fileType) 0] } if {$data(-multiple) != 0} { @@ -980,9 +980,3 @@ proc ::tk::ListBoxKeyAccel_Reset {w} { unset -nocomplain Priv(lbAccel,$w) } -proc ::tk_getFileType {} { - variable ::tk::Priv - - return $Priv(selectFileType) -} - |