Skip to content

Commit b039f0a

Browse files
committed
gitk: Restore some widget options whose defaults changed in Tk 8.5
The default options for panedwindows in Tk 8.5 make the sash virtually invisible -- the handle is not shown and the relief is flat. This puts the defaults back to showing the handle and a raised relief on the sash, as in Tk 8.4. This uses the option command to do this, and also uses the option command to set the default font for various UI elements to the UI font ("uifont"). Signed-off-by: Paul Mackerras <[email protected]>
1 parent a495e5a commit b039f0a

File tree

1 file changed

+45
-60
lines changed

1 file changed

+45
-60
lines changed

gitk

Lines changed: 45 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,19 @@ proc confirm_popup msg {
613613
return $confirm_ok
614614
}
615615

616+
proc setoptions {} {
617+
option add *Panedwindow.showHandle 1 startupFile
618+
option add *Panedwindow.sashRelief raised startupFile
619+
option add *Button.font uifont startupFile
620+
option add *Checkbutton.font uifont startupFile
621+
option add *Radiobutton.font uifont startupFile
622+
option add *Menu.font uifont startupFile
623+
option add *Menubutton.font uifont startupFile
624+
option add *Label.font uifont startupFile
625+
option add *Message.font uifont startupFile
626+
option add *Entry.font uifont startupFile
627+
}
628+
616629
proc makewindow {} {
617630
global canv canv2 canv3 linespc charspc ctext cflist
618631
global tabstop
@@ -631,19 +644,16 @@ proc makewindow {} {
631644

632645
menu .bar
633646
.bar add cascade -label [mc "File"] -menu .bar.file
634-
.bar configure -font uifont
635647
menu .bar.file
636648
.bar.file add command -label [mc "Update"] -command updatecommits
637649
.bar.file add command -label [mc "Reread references"] -command rereadrefs
638650
.bar.file add command -label [mc "List references"] -command showrefs
639651
.bar.file add command -label [mc "Quit"] -command doquit
640-
.bar.file configure -font uifont
641652
menu .bar.edit
642653
.bar add cascade -label [mc "Edit"] -menu .bar.edit
643654
.bar.edit add command -label [mc "Preferences"] -command doprefs
644-
.bar.edit configure -font uifont
645655

646-
menu .bar.view -font uifont
656+
menu .bar.view
647657
.bar add cascade -label [mc "View"] -menu .bar.view
648658
.bar.view add command -label [mc "New view..."] -command {newview 0}
649659
.bar.view add command -label [mc "Edit view..."] -command editview \
@@ -657,7 +667,7 @@ proc makewindow {} {
657667
.bar add cascade -label [mc "Help"] -menu .bar.help
658668
.bar.help add command -label [mc "About gitk"] -command about
659669
.bar.help add command -label [mc "Key bindings"] -command keys
660-
.bar.help configure -font uifont
670+
.bar.help configure
661671
. configure -menu .bar
662672

663673
# the gui has upper and lower half, parts of a paned window.
@@ -714,7 +724,7 @@ proc makewindow {} {
714724
set entries $sha1entry
715725
set sha1but .tf.bar.sha1label
716726
button $sha1but -text [mc "SHA1 ID: "] -state disabled -relief flat \
717-
-command gotocommit -width 8 -font uifont
727+
-command gotocommit -width 8
718728
$sha1but conf -disabledforeground [$sha1but cget -foreground]
719729
pack .tf.bar.sha1label -side left
720730
entry $sha1entry -width 40 -font textfont -textvariable sha1string
@@ -746,7 +756,7 @@ proc makewindow {} {
746756

747757
# Status label and progress bar
748758
set statusw .tf.bar.status
749-
label $statusw -width 15 -relief sunken -font uifont
759+
label $statusw -width 15 -relief sunken
750760
pack $statusw -side left -padx 5
751761
set h [expr {[font metrics uifont -linespace] + 2}]
752762
set progresscanv .tf.bar.progress
@@ -763,10 +773,10 @@ proc makewindow {} {
763773
set progupdatepending 0
764774

765775
# build up the bottom bar of upper window
766-
label .tf.lbar.flabel -text "[mc "Find"] " -font uifont
767-
button .tf.lbar.fnext -text [mc "next"] -command {dofind 1 1} -font uifont
768-
button .tf.lbar.fprev -text [mc "prev"] -command {dofind -1 1} -font uifont
769-
label .tf.lbar.flab2 -text " [mc "commit"] " -font uifont
776+
label .tf.lbar.flabel -text "[mc "Find"] "
777+
button .tf.lbar.fnext -text [mc "next"] -command {dofind 1 1}
778+
button .tf.lbar.fprev -text [mc "prev"] -command {dofind -1 1}
779+
label .tf.lbar.flab2 -text " [mc "commit"] "
770780
pack .tf.lbar.flabel .tf.lbar.fnext .tf.lbar.fprev .tf.lbar.flab2 \
771781
-side left -fill y
772782
set gdttype [mc "containing:"]
@@ -775,8 +785,6 @@ proc makewindow {} {
775785
[mc "touching paths:"] \
776786
[mc "adding/removing string:"]]
777787
trace add variable gdttype write gdttype_change
778-
$gm conf -font uifont
779-
.tf.lbar.gdttype conf -font uifont
780788
pack .tf.lbar.gdttype -side left -fill y
781789

782790
set findstring {}
@@ -788,14 +796,10 @@ proc makewindow {} {
788796
set findtypemenu [tk_optionMenu .tf.lbar.findtype \
789797
findtype [mc "Exact"] [mc "IgnCase"] [mc "Regexp"]]
790798
trace add variable findtype write findcom_change
791-
.tf.lbar.findtype configure -font uifont
792-
.tf.lbar.findtype.menu configure -font uifont
793799
set findloc [mc "All fields"]
794800
tk_optionMenu .tf.lbar.findloc findloc [mc "All fields"] [mc "Headline"] \
795801
[mc "Comments"] [mc "Author"] [mc "Committer"]
796802
trace add variable findloc write find_change
797-
.tf.lbar.findloc configure -font uifont
798-
.tf.lbar.findloc.menu configure -font uifont
799803
pack .tf.lbar.findloc -side right
800804
pack .tf.lbar.findtype -side right
801805
pack $fstring -side left -expand 1 -fill x
@@ -822,22 +826,20 @@ proc makewindow {} {
822826
frame .bleft.top
823827
frame .bleft.mid
824828

825-
button .bleft.top.search -text [mc "Search"] -command dosearch \
826-
-font uifont
829+
button .bleft.top.search -text [mc "Search"] -command dosearch
827830
pack .bleft.top.search -side left -padx 5
828831
set sstring .bleft.top.sstring
829832
entry $sstring -width 20 -font textfont -textvariable searchstring
830833
lappend entries $sstring
831834
trace add variable searchstring write incrsearch
832835
pack $sstring -side left -expand 1 -fill x
833-
radiobutton .bleft.mid.diff -text [mc "Diff"] -font uifont \
836+
radiobutton .bleft.mid.diff -text [mc "Diff"] \
834837
-command changediffdisp -variable diffelide -value {0 0}
835-
radiobutton .bleft.mid.old -text [mc "Old version"] -font uifont \
838+
radiobutton .bleft.mid.old -text [mc "Old version"] \
836839
-command changediffdisp -variable diffelide -value {0 1}
837-
radiobutton .bleft.mid.new -text [mc "New version"] -font uifont \
840+
radiobutton .bleft.mid.new -text [mc "New version"] \
838841
-command changediffdisp -variable diffelide -value {1 0}
839-
label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: " \
840-
-font uifont
842+
label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: "
841843
pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
842844
spinbox .bleft.mid.diffcontext -width 5 -font textfont \
843845
-from 1 -increment 1 -to 10000000 \
@@ -897,10 +899,8 @@ proc makewindow {} {
897899
frame .bright.mode
898900
radiobutton .bright.mode.patch -text [mc "Patch"] \
899901
-command reselectline -variable cmitmode -value "patch"
900-
.bright.mode.patch configure -font uifont
901902
radiobutton .bright.mode.tree -text [mc "Tree"] \
902903
-command reselectline -variable cmitmode -value "tree"
903-
.bright.mode.tree configure -font uifont
904904
grid .bright.mode.patch .bright.mode.tree -sticky ew
905905
pack .bright.mode -side top -fill x
906906
set cflist .bright.cfiles
@@ -1286,17 +1286,14 @@ Copyright © 2005-2006 Paul Mackerras
12861286
Use and redistribute under the terms of the GNU General Public License"] \
12871287
-justify center -aspect 400 -border 2 -bg white -relief groove
12881288
pack $w.m -side top -fill x -padx 2 -pady 2
1289-
$w.m configure -font uifont
12901289
button $w.ok -text [mc "Close"] -command "destroy $w" -default active
12911290
pack $w.ok -side bottom
1292-
$w.ok configure -font uifont
12931291
bind $w <Visibility> "focus $w.ok"
12941292
bind $w <Key-Escape> "destroy $w"
12951293
bind $w <Key-Return> "destroy $w"
12961294
}
12971295

12981296
proc keys {} {
1299-
global uifont
13001297
set w .keys
13011298
if {[winfo exists $w]} {
13021299
raise $w
@@ -1350,10 +1347,8 @@ f Scroll diff view to next file
13501347
"] \
13511348
-justify left -bg white -border 2 -relief groove
13521349
pack $w.m -side top -fill both -padx 2 -pady 2
1353-
$w.m configure -font uifont
13541350
button $w.ok -text [mc "Close"] -command "destroy $w" -default active
13551351
pack $w.ok -side bottom
1356-
$w.ok configure -font uifont
13571352
bind $w <Visibility> "focus $w.ok"
13581353
bind $w <Key-Escape> "destroy $w"
13591354
bind $w <Key-Return> "destroy $w"
@@ -1848,7 +1843,7 @@ proc shellsplit {str} {
18481843
# Code to implement multiple views
18491844

18501845
proc newview {ishighlight} {
1851-
global nextviewnum newviewname newviewperm uifont newishighlight
1846+
global nextviewnum newviewname newviewperm newishighlight
18521847
global newviewargs revtreeargs
18531848

18541849
set newishighlight $ishighlight
@@ -1881,23 +1876,22 @@ proc editview {} {
18811876

18821877
proc vieweditor {top n title} {
18831878
global newviewname newviewperm viewfiles
1884-
global uifont
18851879

18861880
toplevel $top
18871881
wm title $top $title
1888-
label $top.nl -text [mc "Name"] -font uifont
1889-
entry $top.name -width 20 -textvariable newviewname($n) -font uifont
1882+
label $top.nl -text [mc "Name"]
1883+
entry $top.name -width 20 -textvariable newviewname($n)
18901884
grid $top.nl $top.name -sticky w -pady 5
1891-
checkbutton $top.perm -text [mc "Remember this view"] -variable newviewperm($n) \
1892-
-font uifont
1885+
checkbutton $top.perm -text [mc "Remember this view"] \
1886+
-variable newviewperm($n)
18931887
grid $top.perm - -pady 5 -sticky w
1894-
message $top.al -aspect 1000 -font uifont \
1888+
message $top.al -aspect 1000 \
18951889
-text [mc "Commits to include (arguments to git rev-list):"]
18961890
grid $top.al - -sticky w -pady 5
18971891
entry $top.args -width 50 -textvariable newviewargs($n) \
1898-
-background white -font uifont
1892+
-background white
18991893
grid $top.args - -sticky ew -padx 5
1900-
message $top.l -aspect 1000 -font uifont \
1894+
message $top.l -aspect 1000 \
19011895
-text [mc "Enter files and directories to include, one per line:"]
19021896
grid $top.l - -sticky w
19031897
text $top.t -width 40 -height 10 -background white -font uifont
@@ -1911,10 +1905,8 @@ proc vieweditor {top n title} {
19111905
}
19121906
grid $top.t - -sticky ew -padx 5
19131907
frame $top.buts
1914-
button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n] \
1915-
-font uifont
1916-
button $top.buts.can -text [mc "Cancel"] -command [list destroy $top] \
1917-
-font uifont
1908+
button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n]
1909+
button $top.buts.can -text [mc "Cancel"] -command [list destroy $top]
19181910
grid $top.buts.ok $top.buts.can
19191911
grid columnconfigure $top.buts 0 -weight 1 -uniform a
19201912
grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -6522,15 +6514,14 @@ proc showrefs {} {
65226514
grid $top.list $top.ysb -sticky nsew
65236515
grid $top.xsb x -sticky ew
65246516
frame $top.f
6525-
label $top.f.l -text "[mc "Filter"]: " -font uifont
6526-
entry $top.f.e -width 20 -textvariable reflistfilter -font uifont
6517+
label $top.f.l -text "[mc "Filter"]: "
6518+
entry $top.f.e -width 20 -textvariable reflistfilter
65276519
set reflistfilter "*"
65286520
trace add variable reflistfilter write reflistfilter_change
65296521
pack $top.f.e -side right -fill x -expand 1
65306522
pack $top.f.l -side left
65316523
grid $top.f - -sticky ew -pady 2
6532-
button $top.close -command [list destroy $top] -text [mc "Close"] \
6533-
-font uifont
6524+
button $top.close -command [list destroy $top] -text [mc "Close"]
65346525
grid $top.close -
65356526
grid columnconfigure $top 0 -weight 1
65366527
grid rowconfigure $top 0 -weight 1
@@ -7842,7 +7833,7 @@ proc choosefont {font which} {
78427833
eval font config sample [font actual $font]
78437834
toplevel $top
78447835
wm title $top [mc "Gitk font chooser"]
7845-
label $top.l -textvariable fontparam(which) -font uifont
7836+
label $top.l -textvariable fontparam(which)
78467837
pack $top.l -side top
78477838
set fontlist [lsort [font families]]
78487839
frame $top.f
@@ -7872,10 +7863,8 @@ proc choosefont {font which} {
78727863
bind $top.c <Configure> [list centertext $top.c]
78737864
pack $top.c -side top -fill x
78747865
frame $top.buts
7875-
button $top.buts.ok -text [mc "OK"] -command fontok -default active \
7876-
-font uifont
7877-
button $top.buts.can -text [mc "Cancel"] -command fontcan -default normal \
7878-
-font uifont
7866+
button $top.buts.ok -text [mc "OK"] -command fontok -default active
7867+
button $top.buts.can -text [mc "Cancel"] -command fontcan -default normal
78797868
grid $top.buts.ok $top.buts.can
78807869
grid columnconfigure $top.buts 0 -weight 1 -uniform a
78817870
grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -7943,7 +7932,7 @@ proc doprefs {} {
79437932
global maxwidth maxgraphpct
79447933
global oldprefs prefstop showneartags showlocalchanges
79457934
global bgcolor fgcolor ctext diffcolors selectbgcolor
7946-
global uifont tabstop limitdiffs
7935+
global tabstop limitdiffs
79477936

79487937
set top .gitkprefs
79497938
set prefstop $top
@@ -7958,7 +7947,6 @@ proc doprefs {} {
79587947
toplevel $top
79597948
wm title $top [mc "Gitk preferences"]
79607949
label $top.ldisp -text [mc "Commit list display options"]
7961-
$top.ldisp configure -font uifont
79627950
grid $top.ldisp - -sticky w -pady 10
79637951
label $top.spacer -text " "
79647952
label $top.maxwidthl -text [mc "Maximum graph width (lines)"] \
@@ -7976,7 +7964,6 @@ proc doprefs {} {
79767964
grid x $top.showlocal -sticky w
79777965

79787966
label $top.ddisp -text [mc "Diff display options"]
7979-
$top.ddisp configure -font uifont
79807967
grid $top.ddisp - -sticky w -pady 10
79817968
label $top.tabstopl -text [mc "Tab spacing"] -font optionfont
79827969
spinbox $top.tabstop -from 1 -to 20 -width 4 -textvariable tabstop
@@ -7993,7 +7980,6 @@ proc doprefs {} {
79937980
grid x $top.ldiff -sticky w
79947981

79957982
label $top.cdisp -text [mc "Colors: press to choose"]
7996-
$top.cdisp configure -font uifont
79977983
grid $top.cdisp - -sticky w -pady 10
79987984
label $top.bg -padx 40 -relief sunk -background $bgcolor
79997985
button $top.bgbut -text [mc "Background"] -font optionfont \
@@ -8025,17 +8011,14 @@ proc doprefs {} {
80258011
grid x $top.selbgbut $top.selbgsep -sticky w
80268012

80278013
label $top.cfont -text [mc "Fonts: press to choose"]
8028-
$top.cfont configure -font uifont
80298014
grid $top.cfont - -sticky w -pady 10
80308015
mkfontdisp mainfont $top [mc "Main font"]
80318016
mkfontdisp textfont $top [mc "Diff display font"]
80328017
mkfontdisp uifont $top [mc "User interface font"]
80338018

80348019
frame $top.buts
80358020
button $top.buts.ok -text [mc "OK"] -command prefsok -default active
8036-
$top.buts.ok configure -font uifont
80378021
button $top.buts.can -text [mc "Cancel"] -command prefscan -default normal
8038-
$top.buts.can configure -font uifont
80398022
grid $top.buts.ok $top.buts.can
80408023
grid columnconfigure $top.buts 0 -weight 1 -uniform a
80418024
grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -8511,6 +8494,8 @@ eval font create textfontbold [fontflags textfont 1]
85118494
parsefont uifont $uifont
85128495
eval font create uifont [fontflags uifont]
85138496

8497+
setoptions
8498+
85148499
# check that we can find a .git directory somewhere...
85158500
if {[catch {set gitdir [gitdir]}]} {
85168501
show_error {} . [mc "Cannot find a git repository here."]

0 commit comments

Comments
 (0)