Skip to content

Commit b70227f

Browse files
committed
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 <[email protected]>
1 parent 82d316c commit b70227f

File tree

1 file changed

+23
-114
lines changed

1 file changed

+23
-114
lines changed

gitk

Lines changed: 23 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,14 +2098,6 @@ proc ttk_toplevel {w args} {
20982098
}
20992099
21002100
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-
21092101
wm transient $window $origin
21102102
21112103
# Windows fails to place transient windows normally, so
@@ -2297,7 +2289,7 @@ proc makewindow {} {
22972289
global headctxmenu progresscanv progressitem progresscoords statusw
22982290
global fprogitem fprogcoord lastprogupdate progupdatepending
22992291
global rprogitem rprogcoord rownumsel numcommits
2300-
global have_tk85 have_tk86 use_ttk NS
2292+
global use_ttk NS
23012293
global worddiff
23022294
23032295
# The "mc" arguments here are purely so that xgettext
@@ -2628,9 +2620,7 @@ proc makewindow {} {
26282620
-state disabled -undo 0 -font textfont \
26292621
-yscrollcommand scrolltext -wrap $wrapdefault \
26302622
-xscrollcommand ".bleft.bottom.sbhorizontal set"
2631-
if {$have_tk85} {
2632-
$ctext conf -tabstyle wordprocessor
2633-
}
2623+
$ctext conf -tabstyle wordprocessor
26342624
${NS}::scrollbar .bleft.bottom.sb -command "$ctext yview"
26352625
${NS}::scrollbar .bleft.bottom.sbhorizontal -command "$ctext xview" -orient h
26362626
pack .bleft.top -side top -fill x
@@ -2792,13 +2782,8 @@ proc makewindow {} {
27922782
bind . <Key-Down> "selnextline 1"
27932783
bind . <Shift-Key-Up> "dofind -1 0"
27942784
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"
28022787
bind . <Key-Prior> "selnextpage -1"
28032788
bind . <Key-Next> "selnextpage 1"
28042789
bind . <$M1B-Home> "allcanvs yview moveto 0.0"
@@ -8646,19 +8631,17 @@ proc clear_ctext {{first 1.0}} {
86468631
}
86478632
86488633
proc settabs {{firstab {}}} {
8649-
global firsttabstop tabstop ctext have_tk85
8634+
global firsttabstop tabstop ctext
86508635
8651-
if {$firstab ne {} && $have_tk85} {
8636+
if {$firstab ne {}} {
86528637
set firsttabstop $firstab
86538638
}
86548639
set w [font measure textfont "0"]
86558640
if {$firsttabstop != 0} {
86568641
$ctext conf -tabs [list [expr {($firsttabstop + $tabstop) * $w}] \
86578642
[expr {($firsttabstop + 2 * $tabstop) * $w}]]
8658-
} elseif {$have_tk85 || $tabstop != 8} {
8659-
$ctext conf -tabs [expr {$tabstop * $w}]
86608643
} else {
8661-
$ctext conf -tabs {}
8644+
$ctext conf -tabs [expr {$tabstop * $w}]
86628645
}
86638646
}
86648647
@@ -11609,74 +11592,6 @@ proc mkfontdisp {font top which} {
1160911592
grid x $top.${font}but $top.$font -sticky w
1161011593
}
1161111594
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-
1168011595
proc centertext {w} {
1168111596
$w coords text [expr {[winfo width $w] / 2}] [expr {[winfo height $w] / 2}]
1168211597
}
@@ -11709,26 +11624,22 @@ proc fontcan {} {
1170911624
}
1171011625
}
1171111626
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
1173211643
}
1173311644
1173411645
proc selfontfam {} {
@@ -12801,8 +12712,6 @@ set nullid "0000000000000000000000000000000000000000"
1280112712
set nullid2 "0000000000000000000000000000000000000001"
1280212713
set nullfile "/dev/null"
1280312714
12804-
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
12805-
set have_tk86 [expr {[package vcompare $tk_version "8.6"] >= 0}]
1280612715
if {![info exists have_ttk]} {
1280712716
set have_ttk [llength [info commands ::ttk::style]]
1280812717
}

0 commit comments

Comments
 (0)