path: root/lib/option.tcl
diff options
authorShawn O. Pearce <>2007-09-13 23:07:46 (GMT)
committerShawn O. Pearce <>2007-09-13 23:07:46 (GMT)
commitafe2098ddd3e21d1d1afc428d3c8d91f37b01692 (patch)
tree577e84a21d9aa6f8264913637d25a08c1c63fcee /lib/option.tcl
parente7034d66ecd9c16ae8bd8d331fc41efc48e925f1 (diff)
git-gui: Font chooser to handle a large number of font families
Simon Sasburg noticed that on X11 if there are more fonts than can fit in the height of the screen Tk's native tk_optionMenu does not offer scroll arrows to the user and it is not possible to review all choices or to select those that are off-screen. On Mac OS X the tk_optionMenu works properly but is awkward to navigate if the list is long. This is a rewrite of our font selection by providing a new modal dialog that the user can launch from the git-gui Options panel. The dialog offers the user a scrolling list of fonts in a pane. An example text shows the user what the font looks like at the size they have selected. But I have to admit the example pane is less than ideal. For example in the case of our diff font we really should show the user an example diff complete with our native diff syntax coloring. Signed-off-by: Shawn O. Pearce <> Acked-by: Simon Sasburg <>
Diffstat (limited to 'lib/option.tcl')
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/option.tcl b/lib/option.tcl
index aa9f783..063f5df 100644
--- a/lib/option.tcl
+++ b/lib/option.tcl
@@ -255,17 +255,23 @@ proc do_options {} {
frame $$name
label $$name.l -text "$text:"
- pack $$name.l -side left -anchor w -fill x
- eval tk_optionMenu $$ \
- global_config_new(gui.$font^^family) \
- $all_fonts
- spinbox $$name.size \
- -textvariable global_config_new(gui.$font^^size) \
- -from 2 -to 80 -increment 1 \
- -width 3
- bind $$name.size <FocusIn> {%W selection range 0 end}
- pack $$name.size -side right -anchor e
- pack $$ -side right -anchor e
+ button $$name.b \
+ -text [mc "Change Font"] \
+ -command [list \
+ choose_font::pick \
+ $w \
+ [mc "Choose %s" $text] \
+ global_config_new(gui.$font^^family) \
+ global_config_new(gui.$font^^size) \
+ ]
+ label $$name.f -textvariable global_config_new(gui.$font^^family)
+ label $$name.s -textvariable global_config_new(gui.$font^^size)
+ label $$ -text [mc "pt."]
+ pack $$name.l -side left -anchor w
+ pack $$name.b -side right -anchor e
+ pack $$ -side right -anchor w
+ pack $$name.s -side right -anchor w
+ pack $$name.f -side right -anchor w
pack $$name -side top -anchor w -fill x