summaryrefslogtreecommitdiffstats
path: root/lib/option.tcl
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-09-14 01:07:46 +0200
committerShawn O. Pearce <spearce@spearce.org>2007-09-14 01:07:46 +0200
commitafe2098ddd3e21d1d1afc428d3c8d91f37b01692 (patch)
tree577e84a21d9aa6f8264913637d25a08c1c63fcee /lib/option.tcl
parentgit-gui: Make backporting changes from i18n version easier (diff)
downloadgit-afe2098ddd3e21d1d1afc428d3c8d91f37b01692.tar.xz
git-afe2098ddd3e21d1d1afc428d3c8d91f37b01692.zip
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 <spearce@spearce.org> Acked-by: Simon Sasburg <simon.sasburg@gmail.com>
Diffstat (limited to '')
-rw-r--r--lib/option.tcl28
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/option.tcl b/lib/option.tcl
index aa9f783afd..063f5df6f7 100644
--- a/lib/option.tcl
+++ b/lib/option.tcl
@@ -255,17 +255,23 @@ proc do_options {} {
frame $w.global.$name
label $w.global.$name.l -text "$text:"
- pack $w.global.$name.l -side left -anchor w -fill x
- eval tk_optionMenu $w.global.$name.family \
- global_config_new(gui.$font^^family) \
- $all_fonts
- spinbox $w.global.$name.size \
- -textvariable global_config_new(gui.$font^^size) \
- -from 2 -to 80 -increment 1 \
- -width 3
- bind $w.global.$name.size <FocusIn> {%W selection range 0 end}
- pack $w.global.$name.size -side right -anchor e
- pack $w.global.$name.family -side right -anchor e
+ button $w.global.$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 $w.global.$name.f -textvariable global_config_new(gui.$font^^family)
+ label $w.global.$name.s -textvariable global_config_new(gui.$font^^size)
+ label $w.global.$name.pt -text [mc "pt."]
+ pack $w.global.$name.l -side left -anchor w
+ pack $w.global.$name.b -side right -anchor e
+ pack $w.global.$name.pt -side right -anchor w
+ pack $w.global.$name.s -side right -anchor w
+ pack $w.global.$name.f -side right -anchor w
pack $w.global.$name -side top -anchor w -fill x
}