gitk: remove implementations for Tcl/Tk < 8.6

gitk includes code specifically for Tcl 8.4 and 8.5, but the requirement is now for at least 8.6. Remove the now unusable code targeting earlier Tcl. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>

Mark Levedahl committed May 19, 2025 at 12:54 UTC b70227fd8681baa21bacf551c5f5e417052b0c54
1 file changed +23 -114
gitk
+23 -114
@@ -2098,14 +2098,6 @@ proc ttk_toplevel {w args} {
2098 }
2099
2100 proc make_transient {window origin} {
2101 - global have_tk85
2102 -
2103 - # In MacOS Tk 8.4 transient appears to work by setting
2104 - # overrideredirect, which is utterly useless, since the
2105 - # windows get no border, and are not even kept above
2106 - # the parent.
2107 - if {!$have_tk85 && [tk windowingsystem] eq {aqua}} return
2108 -
2101 wm transient $window $origin
2102
2103 # Windows fails to place transient windows normally, so
@@ -2297,7 +2289,7 @@ proc makewindow {} {
2289 global headctxmenu progresscanv progressitem progresscoords statusw
2290 global fprogitem fprogcoord lastprogupdate progupdatepending
2291 global rprogitem rprogcoord rownumsel numcommits
2300 - global have_tk85 have_tk86 use_ttk NS
2292 + global use_ttk NS
2293 global worddiff
2294
2295 # The "mc" arguments here are purely so that xgettext
@@ -2628,9 +2620,7 @@ proc makewindow {} {
2620 -state disabled -undo 0 -font textfont \
2621 -yscrollcommand scrolltext -wrap $wrapdefault \
2622 -xscrollcommand ".bleft.bottom.sbhorizontal set"
2631 - if {$have_tk85} {
2632 - $ctext conf -tabstyle wordprocessor
2633 - }
2623 + $ctext conf -tabstyle wordprocessor
2624 ${NS}::scrollbar .bleft.bottom.sb -command "$ctext yview"
2625 ${NS}::scrollbar .bleft.bottom.sbhorizontal -command "$ctext xview" -orient h
2626 pack .bleft.top -side top -fill x
@@ -2792,13 +2782,8 @@ proc makewindow {} {
2782 bind . <Key-Down> "selnextline 1"
2783 bind . <Shift-Key-Up> "dofind -1 0"
2784 bind . <Shift-Key-Down> "dofind 1 0"
2795 - if {$have_tk86} {
2796 - bindkey <<NextChar>> "goforw"
2797 - bindkey <<PrevChar>> "goback"
2798 - } else {
2799 - bindkey <Key-Right> "goforw"
2800 - bindkey <Key-Left> "goback"
2801 - }
2785 + bindkey <<NextChar>> "goforw"
2786 + bindkey <<PrevChar>> "goback"
2787 bind . <Key-Prior> "selnextpage -1"
2788 bind . <Key-Next> "selnextpage 1"
2789 bind . <$M1B-Home> "allcanvs yview moveto 0.0"
@@ -8646,19 +8631,17 @@ proc clear_ctext {{first 1.0}} {
8631 }
8632
8633 proc settabs {{firstab {}}} {
8649 - global firsttabstop tabstop ctext have_tk85
8634 + global firsttabstop tabstop ctext
8635
8651 - if {$firstab ne {} && $have_tk85} {
8636 + if {$firstab ne {}} {
8637 set firsttabstop $firstab
8638 }
8639 set w [font measure textfont "0"]
8640 if {$firsttabstop != 0} {
8641 $ctext conf -tabs [list [expr {($firsttabstop + $tabstop) * $w}] \
8642 [expr {($firsttabstop + 2 * $tabstop) * $w}]]
8658 - } elseif {$have_tk85 || $tabstop != 8} {
8659 - $ctext conf -tabs [expr {$tabstop * $w}]
8643 } else {
8661 - $ctext conf -tabs {}
8644 + $ctext conf -tabs [expr {$tabstop * $w}]
8645 }
8646 }
8647
@@ -11609,74 +11592,6 @@ proc mkfontdisp {font top which} {
11592 grid x $top.${font}but $top.$font -sticky w
11593 }
11594
11612 -proc choosefont {font which} {
11613 - global fontparam fontlist fonttop fontattr
11614 - global prefstop NS
11615 -
11616 - set fontparam(which) $which
11617 - set fontparam(font) $font
11618 - set fontparam(family) [font actual $font -family]
11619 - set fontparam(size) $fontattr($font,size)
11620 - set fontparam(weight) $fontattr($font,weight)
11621 - set fontparam(slant) $fontattr($font,slant)
11622 - set top .gitkfont
11623 - set fonttop $top
11624 - if {![winfo exists $top]} {
11625 - font create sample
11626 - eval font config sample [font actual $font]
11627 - ttk_toplevel $top
11628 - make_transient $top $prefstop
11629 - wm title $top [mc "Gitk font chooser"]
11630 - ${NS}::label $top.l -textvariable fontparam(which)
11631 - pack $top.l -side top
11632 - set fontlist [lsort [font families]]
11633 - ${NS}::frame $top.f
11634 - listbox $top.f.fam -listvariable fontlist \
11635 - -yscrollcommand [list $top.f.sb set]
11636 - bind $top.f.fam <<ListboxSelect>> selfontfam
11637 - ${NS}::scrollbar $top.f.sb -command [list $top.f.fam yview]
11638 - pack $top.f.sb -side right -fill y
11639 - pack $top.f.fam -side left -fill both -expand 1
11640 - pack $top.f -side top -fill both -expand 1
11641 - ${NS}::frame $top.g
11642 - spinbox $top.g.size -from 4 -to 40 -width 4 \
11643 - -textvariable fontparam(size) \
11644 - -validatecommand {string is integer -strict %s}
11645 - checkbutton $top.g.bold -padx 5 \
11646 - -font {{Times New Roman} 12 bold} -text [mc "B"] -indicatoron 0 \
11647 - -variable fontparam(weight) -onvalue bold -offvalue normal
11648 - checkbutton $top.g.ital -padx 5 \
11649 - -font {{Times New Roman} 12 italic} -text [mc "I"] -indicatoron 0 \
11650 - -variable fontparam(slant) -onvalue italic -offvalue roman
11651 - pack $top.g.size $top.g.bold $top.g.ital -side left
11652 - pack $top.g -side top
11653 - canvas $top.c -width 150 -height 50 -border 2 -relief sunk \
11654 - -background white
11655 - $top.c create text 100 25 -anchor center -text $which -font sample \
11656 - -fill black -tags text
11657 - bind $top.c <Configure> [list centertext $top.c]
11658 - pack $top.c -side top -fill x
11659 - ${NS}::frame $top.buts
11660 - ${NS}::button $top.buts.ok -text [mc "OK"] -command fontok -default active
11661 - ${NS}::button $top.buts.can -text [mc "Cancel"] -command fontcan -default normal
11662 - bind $top <Key-Return> fontok
11663 - bind $top <Key-Escape> fontcan
11664 - grid $top.buts.ok $top.buts.can
11665 - grid columnconfigure $top.buts 0 -weight 1 -uniform a
11666 - grid columnconfigure $top.buts 1 -weight 1 -uniform a
11667 - pack $top.buts -side bottom -fill x
11668 - trace add variable fontparam write chg_fontparam
11669 - } else {
11670 - raise $top
11671 - $top.c itemconf text -text $which
11672 - }
11673 - set i [lsearch -exact $fontlist $fontparam(family)]
11674 - if {$i >= 0} {
11675 - $top.f.fam selection set $i
11676 - $top.f.fam see $i
11677 - }
11678 -}
11679 -
11595 proc centertext {w} {
11596 $w coords text [expr {[winfo width $w] / 2}] [expr {[winfo height $w] / 2}]
11597 }
@@ -11709,26 +11624,22 @@ proc fontcan {} {
11624 }
11625 }
11626
11712 -if {[package vsatisfies [package provide Tk] 8.6]} {
11713 - # In Tk 8.6 we have a native font chooser dialog. Overwrite the above
11714 - # function to make use of it.
11715 - proc choosefont {font which} {
11716 - tk fontchooser configure -title $which -font $font \
11717 - -command [list on_choosefont $font $which]
11718 - tk fontchooser show
11719 - }
11720 - proc on_choosefont {font which newfont} {
11721 - global fontparam
11722 - puts stderr "$font $newfont"
11723 - array set f [font actual $newfont]
11724 - set fontparam(which) $which
11725 - set fontparam(font) $font
11726 - set fontparam(family) $f(-family)
11727 - set fontparam(size) $f(-size)
11728 - set fontparam(weight) $f(-weight)
11729 - set fontparam(slant) $f(-slant)
11730 - fontok
11731 - }
11627 +proc choosefont {font which} {
11628 + tk fontchooser configure -title $which -font $font \
11629 + -command [list on_choosefont $font $which]
11630 + tk fontchooser show
11631 +}
11632 +proc on_choosefont {font which newfont} {
11633 + global fontparam
11634 + puts stderr "$font $newfont"
11635 + array set f [font actual $newfont]
11636 + set fontparam(which) $which
11637 + set fontparam(font) $font
11638 + set fontparam(family) $f(-family)
11639 + set fontparam(size) $f(-size)
11640 + set fontparam(weight) $f(-weight)
11641 + set fontparam(slant) $f(-slant)
11642 + fontok
11643 }
11644
11645 proc selfontfam {} {
@@ -12801,8 +12712,6 @@ set nullid "0000000000000000000000000000000000000000"
12712 set nullid2 "0000000000000000000000000000000000000001"
12713 set nullfile "/dev/null"
12714
12804 -set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
12805 -set have_tk86 [expr {[package vcompare $tk_version "8.6"] >= 0}]
12715 if {![info exists have_ttk]} {
12716 set have_ttk [llength [info commands ::ttk::style]]
12717 }