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 <paulus@samba.org>
Paul Mackerras committed
Jan 6, 2008 at 15:54 UTC
b039f0a62d513226352f9bd745374629f8579b0c
1 file changed
+45
-60
gitk
+45
-60
@@ -613,6 +613,19 @@ proc confirm_popup msg {
613
return $confirm_ok
614
}
615
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
+
629
proc makewindow {} {
630
global canv canv2 canv3 linespc charspc ctext cflist
631
global tabstop
@@ -631,19 +644,16 @@ proc makewindow {} {
644
645
menu .bar
646
.bar add cascade -label [mc "File"] -menu .bar.file
634
- .bar configure -font uifont
647
menu .bar.file
648
.bar.file add command -label [mc "Update"] -command updatecommits
649
.bar.file add command -label [mc "Reread references"] -command rereadrefs
650
.bar.file add command -label [mc "List references"] -command showrefs
651
.bar.file add command -label [mc "Quit"] -command doquit
640
- .bar.file configure -font uifont
652
menu .bar.edit
653
.bar add cascade -label [mc "Edit"] -menu .bar.edit
654
.bar.edit add command -label [mc "Preferences"] -command doprefs
644
- .bar.edit configure -font uifont
655
646
- menu .bar.view -font uifont
656
+ menu .bar.view
657
.bar add cascade -label [mc "View"] -menu .bar.view
658
.bar.view add command -label [mc "New view..."] -command {newview 0}
659
.bar.view add command -label [mc "Edit view..."] -command editview \
@@ -657,7 +667,7 @@ proc makewindow {} {
667
.bar add cascade -label [mc "Help"] -menu .bar.help
668
.bar.help add command -label [mc "About gitk"] -command about
669
.bar.help add command -label [mc "Key bindings"] -command keys
660
- .bar.help configure -font uifont
670
+ .bar.help configure
671
. configure -menu .bar
672
673
# the gui has upper and lower half, parts of a paned window.
@@ -714,7 +724,7 @@ proc makewindow {} {
724
set entries $sha1entry
725
set sha1but .tf.bar.sha1label
726
button $sha1but -text [mc "SHA1 ID: "] -state disabled -relief flat \
717
- -command gotocommit -width 8 -font uifont
727
+ -command gotocommit -width 8
728
$sha1but conf -disabledforeground [$sha1but cget -foreground]
729
pack .tf.bar.sha1label -side left
730
entry $sha1entry -width 40 -font textfont -textvariable sha1string
@@ -746,7 +756,7 @@ proc makewindow {} {
756
757
# Status label and progress bar
758
set statusw .tf.bar.status
749
- label $statusw -width 15 -relief sunken -font uifont
759
+ label $statusw -width 15 -relief sunken
760
pack $statusw -side left -padx 5
761
set h [expr {[font metrics uifont -linespace] + 2}]
762
set progresscanv .tf.bar.progress
@@ -763,10 +773,10 @@ proc makewindow {} {
773
set progupdatepending 0
774
775
# 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"] "
780
pack .tf.lbar.flabel .tf.lbar.fnext .tf.lbar.fprev .tf.lbar.flab2 \
781
-side left -fill y
782
set gdttype [mc "containing:"]
@@ -775,8 +785,6 @@ proc makewindow {} {
785
[mc "touching paths:"] \
786
[mc "adding/removing string:"]]
787
trace add variable gdttype write gdttype_change
778
- $gm conf -font uifont
779
- .tf.lbar.gdttype conf -font uifont
788
pack .tf.lbar.gdttype -side left -fill y
789
790
set findstring {}
@@ -788,14 +796,10 @@ proc makewindow {} {
796
set findtypemenu [tk_optionMenu .tf.lbar.findtype \
797
findtype [mc "Exact"] [mc "IgnCase"] [mc "Regexp"]]
798
trace add variable findtype write findcom_change
791
- .tf.lbar.findtype configure -font uifont
792
- .tf.lbar.findtype.menu configure -font uifont
799
set findloc [mc "All fields"]
800
tk_optionMenu .tf.lbar.findloc findloc [mc "All fields"] [mc "Headline"] \
801
[mc "Comments"] [mc "Author"] [mc "Committer"]
802
trace add variable findloc write find_change
797
- .tf.lbar.findloc configure -font uifont
798
- .tf.lbar.findloc.menu configure -font uifont
803
pack .tf.lbar.findloc -side right
804
pack .tf.lbar.findtype -side right
805
pack $fstring -side left -expand 1 -fill x
@@ -822,22 +826,20 @@ proc makewindow {} {
826
frame .bleft.top
827
frame .bleft.mid
828
825
- button .bleft.top.search -text [mc "Search"] -command dosearch \
826
- -font uifont
829
+ button .bleft.top.search -text [mc "Search"] -command dosearch
830
pack .bleft.top.search -side left -padx 5
831
set sstring .bleft.top.sstring
832
entry $sstring -width 20 -font textfont -textvariable searchstring
833
lappend entries $sstring
834
trace add variable searchstring write incrsearch
835
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"] \
837
-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"] \
839
-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"] \
841
-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"]: "
843
pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
844
spinbox .bleft.mid.diffcontext -width 5 -font textfont \
845
-from 1 -increment 1 -to 10000000 \
@@ -897,10 +899,8 @@ proc makewindow {} {
899
frame .bright.mode
900
radiobutton .bright.mode.patch -text [mc "Patch"] \
901
-command reselectline -variable cmitmode -value "patch"
900
- .bright.mode.patch configure -font uifont
902
radiobutton .bright.mode.tree -text [mc "Tree"] \
903
-command reselectline -variable cmitmode -value "tree"
903
- .bright.mode.tree configure -font uifont
904
grid .bright.mode.patch .bright.mode.tree -sticky ew
905
pack .bright.mode -side top -fill x
906
set cflist .bright.cfiles
@@ -1286,17 +1286,14 @@ Copyright © 2005-2006 Paul Mackerras
1286
Use and redistribute under the terms of the GNU General Public License"] \
1287
-justify center -aspect 400 -border 2 -bg white -relief groove
1288
pack $w.m -side top -fill x -padx 2 -pady 2
1289
- $w.m configure -font uifont
1289
button $w.ok -text [mc "Close"] -command "destroy $w" -default active
1290
pack $w.ok -side bottom
1292
- $w.ok configure -font uifont
1291
bind $w <Visibility> "focus $w.ok"
1292
bind $w <Key-Escape> "destroy $w"
1293
bind $w <Key-Return> "destroy $w"
1294
}
1295
1296
proc keys {} {
1299
- global uifont
1297
set w .keys
1298
if {[winfo exists $w]} {
1299
raise $w
@@ -1350,10 +1347,8 @@ f Scroll diff view to next file
1347
"] \
1348
-justify left -bg white -border 2 -relief groove
1349
pack $w.m -side top -fill both -padx 2 -pady 2
1353
- $w.m configure -font uifont
1350
button $w.ok -text [mc "Close"] -command "destroy $w" -default active
1351
pack $w.ok -side bottom
1356
- $w.ok configure -font uifont
1352
bind $w <Visibility> "focus $w.ok"
1353
bind $w <Key-Escape> "destroy $w"
1354
bind $w <Key-Return> "destroy $w"
@@ -1848,7 +1843,7 @@ proc shellsplit {str} {
1843
# Code to implement multiple views
1844
1845
proc newview {ishighlight} {
1851
- global nextviewnum newviewname newviewperm uifont newishighlight
1846
+ global nextviewnum newviewname newviewperm newishighlight
1847
global newviewargs revtreeargs
1848
1849
set newishighlight $ishighlight
@@ -1881,23 +1876,22 @@ proc editview {} {
1876
1877
proc vieweditor {top n title} {
1878
global newviewname newviewperm viewfiles
1884
- global uifont
1879
1880
toplevel $top
1881
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)
1884
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)
1887
grid $top.perm - -pady 5 -sticky w
1894
- message $top.al -aspect 1000 -font uifont \
1888
+ message $top.al -aspect 1000 \
1889
-text [mc "Commits to include (arguments to git rev-list):"]
1890
grid $top.al - -sticky w -pady 5
1891
entry $top.args -width 50 -textvariable newviewargs($n) \
1898
- -background white -font uifont
1892
+ -background white
1893
grid $top.args - -sticky ew -padx 5
1900
- message $top.l -aspect 1000 -font uifont \
1894
+ message $top.l -aspect 1000 \
1895
-text [mc "Enter files and directories to include, one per line:"]
1896
grid $top.l - -sticky w
1897
text $top.t -width 40 -height 10 -background white -font uifont
@@ -1911,10 +1905,8 @@ proc vieweditor {top n title} {
1905
}
1906
grid $top.t - -sticky ew -padx 5
1907
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]
1910
grid $top.buts.ok $top.buts.can
1911
grid columnconfigure $top.buts 0 -weight 1 -uniform a
1912
grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -6522,15 +6514,14 @@ proc showrefs {} {
6514
grid $top.list $top.ysb -sticky nsew
6515
grid $top.xsb x -sticky ew
6516
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
6519
set reflistfilter "*"
6520
trace add variable reflistfilter write reflistfilter_change
6521
pack $top.f.e -side right -fill x -expand 1
6522
pack $top.f.l -side left
6523
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"]
6525
grid $top.close -
6526
grid columnconfigure $top 0 -weight 1
6527
grid rowconfigure $top 0 -weight 1
@@ -7842,7 +7833,7 @@ proc choosefont {font which} {
7833
eval font config sample [font actual $font]
7834
toplevel $top
7835
wm title $top [mc "Gitk font chooser"]
7845
- label $top.l -textvariable fontparam(which) -font uifont
7836
+ label $top.l -textvariable fontparam(which)
7837
pack $top.l -side top
7838
set fontlist [lsort [font families]]
7839
frame $top.f
@@ -7872,10 +7863,8 @@ proc choosefont {font which} {
7863
bind $top.c <Configure> [list centertext $top.c]
7864
pack $top.c -side top -fill x
7865
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
7868
grid $top.buts.ok $top.buts.can
7869
grid columnconfigure $top.buts 0 -weight 1 -uniform a
7870
grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -7943,7 +7932,7 @@ proc doprefs {} {
7932
global maxwidth maxgraphpct
7933
global oldprefs prefstop showneartags showlocalchanges
7934
global bgcolor fgcolor ctext diffcolors selectbgcolor
7946
- global uifont tabstop limitdiffs
7935
+ global tabstop limitdiffs
7936
7937
set top .gitkprefs
7938
set prefstop $top
@@ -7958,7 +7947,6 @@ proc doprefs {} {
7947
toplevel $top
7948
wm title $top [mc "Gitk preferences"]
7949
label $top.ldisp -text [mc "Commit list display options"]
7961
- $top.ldisp configure -font uifont
7950
grid $top.ldisp - -sticky w -pady 10
7951
label $top.spacer -text " "
7952
label $top.maxwidthl -text [mc "Maximum graph width (lines)"] \
@@ -7976,7 +7964,6 @@ proc doprefs {} {
7964
grid x $top.showlocal -sticky w
7965
7966
label $top.ddisp -text [mc "Diff display options"]
7979
- $top.ddisp configure -font uifont
7967
grid $top.ddisp - -sticky w -pady 10
7968
label $top.tabstopl -text [mc "Tab spacing"] -font optionfont
7969
spinbox $top.tabstop -from 1 -to 20 -width 4 -textvariable tabstop
@@ -7993,7 +7980,6 @@ proc doprefs {} {
7980
grid x $top.ldiff -sticky w
7981
7982
label $top.cdisp -text [mc "Colors: press to choose"]
7996
- $top.cdisp configure -font uifont
7983
grid $top.cdisp - -sticky w -pady 10
7984
label $top.bg -padx 40 -relief sunk -background $bgcolor
7985
button $top.bgbut -text [mc "Background"] -font optionfont \
@@ -8025,7 +8011,6 @@ proc doprefs {} {
8011
grid x $top.selbgbut $top.selbgsep -sticky w
8012
8013
label $top.cfont -text [mc "Fonts: press to choose"]
8028
- $top.cfont configure -font uifont
8014
grid $top.cfont - -sticky w -pady 10
8015
mkfontdisp mainfont $top [mc "Main font"]
8016
mkfontdisp textfont $top [mc "Diff display font"]
@@ -8033,9 +8018,7 @@ proc doprefs {} {
8018
8019
frame $top.buts
8020
button $top.buts.ok -text [mc "OK"] -command prefsok -default active
8036
- $top.buts.ok configure -font uifont
8021
button $top.buts.can -text [mc "Cancel"] -command prefscan -default normal
8038
- $top.buts.can configure -font uifont
8022
grid $top.buts.ok $top.buts.can
8023
grid columnconfigure $top.buts 0 -weight 1 -uniform a
8024
grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -8511,6 +8494,8 @@ eval font create textfontbold [fontflags textfont 1]
8494
parsefont uifont $uifont
8495
eval font create uifont [fontflags uifont]
8496
8497
+setoptions
8498
+
8499
# check that we can find a .git directory somewhere...
8500
if {[catch {set gitdir [gitdir]}]} {
8501
show_error {} . [mc "Cannot find a git repository here."]