Skip to content

Commit

Permalink
[PATCH] gitk: Add horizontal scrollbar to the diff view
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pekka Kaitaniemi authored and Paul Mackerras committed Mar 10, 2008
1 parent 95293b5 commit 8809d69
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions gitk
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ proc makewindow {} {
}
frame .bleft.top
frame .bleft.mid
frame .bleft.bottom

button .bleft.top.search -text [mc "Search"] -command dosearch
pack .bleft.top.search -side left -padx 5
Expand Down Expand Up @@ -864,18 +865,25 @@ proc makewindow {} {
checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \
-command changeignorespace -variable ignorespace
pack .bleft.mid.ignspace -side left -padx 5
set ctext .bleft.ctext
set ctext .bleft.bottom.ctext
text $ctext -background $bgcolor -foreground $fgcolor \
-state disabled -font textfont \
-yscrollcommand scrolltext -wrap none
-yscrollcommand scrolltext -wrap none \
-xscrollcommand ".bleft.bottom.sbhorizontal set"
if {$have_tk85} {
$ctext conf -tabstyle wordprocessor
}
scrollbar .bleft.sb -command "$ctext yview"
scrollbar .bleft.bottom.sb -command "$ctext yview"
scrollbar .bleft.bottom.sbhorizontal -command "$ctext xview" -orient h \
-width 10
pack .bleft.top -side top -fill x
pack .bleft.mid -side top -fill x
pack .bleft.sb -side right -fill y
pack $ctext -side left -fill both -expand 1
grid $ctext .bleft.bottom.sb -sticky nsew
grid .bleft.bottom.sbhorizontal -sticky ew
grid columnconfigure .bleft.bottom 0 -weight 1
grid rowconfigure .bleft.bottom 0 -weight 1
grid rowconfigure .bleft.bottom 1 -weight 0
pack .bleft.bottom -side top -fill both -expand 1
lappend bglist $ctext
lappend fglist $ctext

Expand Down Expand Up @@ -5640,7 +5648,7 @@ proc searchmarkvisible {doall} {
proc scrolltext {f0 f1} {
global searchstring

.bleft.sb set $f0 $f1
.bleft.bottom.sb set $f0 $f1
if {$searchstring ne {}} {
searchmarkvisible 0
}
Expand Down

0 comments on commit 8809d69

Please sign in to comment.