[PATCH] gitk: Add horizontal scrollbar to the diff view
Adding horizontal scroll bar makes the scrolling feature more discoverable to the users. The horizontal scrollbar is a bit narrower than vertical ones so we don't make too big impact on available screen real estate. The text and scrollbar widget layout is done using grid geometry manager. An interesting side effect of Tk scrollbars is that the "elevator" size changes depending on the visible content. So the horizontal scrollbar "elevator" changes as the user scrolls the view up and down. Signed-off-by: Pekka Kaitaniemi <kaitanie@cc.helsinki.fi> Signed-off-by: Paul Mackerras <paulus@samba.org>
Pekka Kaitaniemi committed
Mar 8, 2008 at 14:27 UTC
8809d691ec03f6cb60cb01c8bf00441600d6e757
1 file changed
+14
-6
gitk
+14
-6
@@ -837,6 +837,7 @@ proc makewindow {} {
837
}
838
frame .bleft.top
839
frame .bleft.mid
840
+ frame .bleft.bottom
841
842
button .bleft.top.search -text [mc "Search"] -command dosearch
843
pack .bleft.top.search -side left -padx 5
@@ -864,18 +865,25 @@ proc makewindow {} {
865
checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \
866
-command changeignorespace -variable ignorespace
867
pack .bleft.mid.ignspace -side left -padx 5
867
- set ctext .bleft.ctext
868
+ set ctext .bleft.bottom.ctext
869
text $ctext -background $bgcolor -foreground $fgcolor \
870
-state disabled -font textfont \
870
- -yscrollcommand scrolltext -wrap none
871
+ -yscrollcommand scrolltext -wrap none \
872
+ -xscrollcommand ".bleft.bottom.sbhorizontal set"
873
if {$have_tk85} {
874
$ctext conf -tabstyle wordprocessor
875
}
874
- scrollbar .bleft.sb -command "$ctext yview"
876
+ scrollbar .bleft.bottom.sb -command "$ctext yview"
877
+ scrollbar .bleft.bottom.sbhorizontal -command "$ctext xview" -orient h \
878
+ -width 10
879
pack .bleft.top -side top -fill x
880
pack .bleft.mid -side top -fill x
877
- pack .bleft.sb -side right -fill y
878
- pack $ctext -side left -fill both -expand 1
881
+ grid $ctext .bleft.bottom.sb -sticky nsew
882
+ grid .bleft.bottom.sbhorizontal -sticky ew
883
+ grid columnconfigure .bleft.bottom 0 -weight 1
884
+ grid rowconfigure .bleft.bottom 0 -weight 1
885
+ grid rowconfigure .bleft.bottom 1 -weight 0
886
+ pack .bleft.bottom -side top -fill both -expand 1
887
lappend bglist $ctext
888
lappend fglist $ctext
889
@@ -5640,7 +5648,7 @@ proc searchmarkvisible {doall} {
5648
proc scrolltext {f0 f1} {
5649
global searchstring
5650
5643
- .bleft.sb set $f0 $f1
5651
+ .bleft.bottom.sb set $f0 $f1
5652
if {$searchstring ne {}} {
5653
searchmarkvisible 0
5654
}