[PATCH] Provide configurable UI font for gitk
This makes the font used in the UI elements of gitk configurable in the same way the other fonts are. The default fonts used in the Xft build of tk8.5 are particularily horrific, making this change more important there. Signed-off-by: Keith Packard <keithp@neko.keithp.com> Acked-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
Keith Packard committed
Apr 4, 2006 at 00:19 UTC
4840be66b10fd5e5d67e27a8d0c67a96d5b8356a
1 file changed
+17
-6
gitk
+17
-6
@@ -335,7 +335,7 @@ proc error_popup msg {
335
}
336
337
proc makewindow {rargs} {
338
- global canv canv2 canv3 linespc charspc ctext cflist textfont
338
+ global canv canv2 canv3 linespc charspc ctext cflist textfont mainfont uifont
339
global findtype findtypemenu findloc findstring fstring geometry
340
global entries sha1entry sha1string sha1but
341
global maincursor textcursor curtextcursor
@@ -343,17 +343,21 @@ proc makewindow {rargs} {
343
344
menu .bar
345
.bar add cascade -label "File" -menu .bar.file
346
+ .bar configure -font $uifont
347
menu .bar.file
348
.bar.file add command -label "Update" -command [list updatecommits $rargs]
349
.bar.file add command -label "Reread references" -command rereadrefs
350
.bar.file add command -label "Quit" -command doquit
351
+ .bar.file configure -font $uifont
352
menu .bar.edit
353
.bar add cascade -label "Edit" -menu .bar.edit
354
.bar.edit add command -label "Preferences" -command doprefs
355
+ .bar.edit configure -font $uifont
356
menu .bar.help
357
.bar add cascade -label "Help" -menu .bar.help
358
.bar.help add command -label "About gitk" -command about
359
.bar.help add command -label "Key bindings" -command keys
360
+ .bar.help configure -font $uifont
361
. configure -menu .bar
362
363
if {![info exists geometry(canv1)]} {
@@ -400,7 +404,7 @@ proc makewindow {rargs} {
404
set entries $sha1entry
405
set sha1but .ctop.top.bar.sha1label
406
button $sha1but -text "SHA1 ID: " -state disabled -relief flat \
403
- -command gotocommit -width 8
407
+ -command gotocommit -width 8 -font $uifont
408
$sha1but conf -disabledforeground [$sha1but cget -foreground]
409
pack .ctop.top.bar.sha1label -side left
410
entry $sha1entry -width 40 -font $textfont -textvariable sha1string
@@ -430,19 +434,24 @@ proc makewindow {rargs} {
434
-state disabled -width 26
435
pack .ctop.top.bar.rightbut -side left -fill y
436
433
- button .ctop.top.bar.findbut -text "Find" -command dofind
437
+ button .ctop.top.bar.findbut -text "Find" -command dofind -font $uifont
438
pack .ctop.top.bar.findbut -side left
439
set findstring {}
440
set fstring .ctop.top.bar.findstring
441
lappend entries $fstring
438
- entry $fstring -width 30 -font $textfont -textvariable findstring
442
+ entry $fstring -width 30 -font $textfont -textvariable findstring -font $textfont
443
pack $fstring -side left -expand 1 -fill x
444
set findtype Exact
445
set findtypemenu [tk_optionMenu .ctop.top.bar.findtype \
446
findtype Exact IgnCase Regexp]
447
+ .ctop.top.bar.findtype configure -font $uifont
448
+ .ctop.top.bar.findtype.menu configure -font $uifont
449
set findloc "All fields"
450
tk_optionMenu .ctop.top.bar.findloc findloc "All fields" Headline \
451
Comments Author Committer Files Pickaxe
452
+ .ctop.top.bar.findloc configure -font $uifont
453
+ .ctop.top.bar.findloc.menu configure -font $uifont
454
+
455
pack .ctop.top.bar.findloc -side right
456
pack .ctop.top.bar.findtype -side right
457
# for making sure type==Exact whenever loc==Pickaxe
@@ -489,7 +498,7 @@ proc makewindow {rargs} {
498
frame .ctop.cdet.right
499
set cflist .ctop.cdet.right.cfiles
500
listbox $cflist -bg white -selectmode extended -width $geometry(cflistw) \
492
- -yscrollcommand ".ctop.cdet.right.sb set"
501
+ -yscrollcommand ".ctop.cdet.right.sb set" -font $mainfont
502
scrollbar .ctop.cdet.right.sb -command "$cflist yview"
503
pack .ctop.cdet.right.sb -side right -fill y
504
pack $cflist -side left -fill both -expand 1
@@ -610,7 +619,7 @@ proc click {w} {
619
}
620
621
proc savestuff {w} {
613
- global canv canv2 canv3 ctext cflist mainfont textfont
622
+ global canv canv2 canv3 ctext cflist mainfont textfont uifont
623
global stuffsaved findmergefiles maxgraphpct
624
global maxwidth
625
@@ -620,6 +629,7 @@ proc savestuff {w} {
629
set f [open "~/.gitk-new" w]
630
puts $f [list set mainfont $mainfont]
631
puts $f [list set textfont $textfont]
632
+ puts $f [list set uifont $uifont]
633
puts $f [list set findmergefiles $findmergefiles]
634
puts $f [list set maxgraphpct $maxgraphpct]
635
puts $f [list set maxwidth $maxwidth]
@@ -3885,6 +3895,7 @@ if {$tclencoding == {}} {
3895
3896
set mainfont {Helvetica 9}
3897
set textfont {Courier 9}
3898
+set uifont {Helvetica 9 bold}
3899
set findmergefiles 0
3900
set maxgraphpct 50
3901
set maxwidth 16