{"thread":{"id":"12573","subject":"[PATCH] gitk: Add horizontal scrollbar to the diff view","startedAt":"2008-03-08T12:27:23Z","lastAt":"2008-03-08T12:27:23Z","messageCount":1,"participants":["Pekka Kaitaniemi"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"71416","messageId":"20080308122723.GA11867@localdomain","threadId":"12573","inReplyTo":null,"subject":"[PATCH] gitk: Add horizontal scrollbar to the diff view","fromName":"Pekka Kaitaniemi","fromEmail":"kaitanie@cc.helsinki.fi","sentAt":"2008-03-08T12:27:23Z","receivedAt":"2008-03-08T12:27:23Z","isPatch":true,"sender":{"key":"kaitanie@cc.helsinki.fi","avatar":null},"body":"Adding horizontal scroll bar makes the scrolling feature more\ndiscoverable to the users. The horizontal scrollbar is a bit narrower\nthan vertical ones so we don't make too big impact on available screen\nreal estate. The text and scrollbar widget layout is done using grid\ngeometry manager.\n\nAn interesting side effect of Tk scrollbars is that the \"elevator\"\nsize changes depending on the visible content. So the horizontal\nscrollbar \"elevator\" changes as the user scrolls the view up and down.\n\nSigned-off-by: Pekka Kaitaniemi <kaitanie@cc.helsinki.fi>\n---\nA modified version of the earlier patch that adds horizontal\nscrollbar. This version uses grid layout for text and scrollbar\nwidgets. I have tested this patch with Tk 8.4 and 8.5 on Linux.\n\nThe width of the horizontal scrollbar (-width 10) seems to be OK with\nTk 8.5 on Linux (the default seems to be about 10 as well). I don't\nknow what it looks like on Windows and Mac, however.\n\n gitk |   20 ++++++++++++++------\n 1 files changed, 14 insertions(+), 6 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex f1f21e9..429b091 100755\n--- a/gitk\n+++ b/gitk\n@@ -827,6 +827,7 @@ proc makewindow {} {\n     }\n     frame .bleft.top\n     frame .bleft.mid\n+    frame .bleft.bottom\n \n     button .bleft.top.search -text [mc \"Search\"] -command dosearch\n     pack .bleft.top.search -side left -padx 5\n@@ -854,18 +855,25 @@ proc makewindow {} {\n     checkbutton .bleft.mid.ignspace -text [mc \"Ignore space change\"] \\\n \t-command changeignorespace -variable ignorespace\n     pack .bleft.mid.ignspace -side left -padx 5\n-    set ctext .bleft.ctext\n+    set ctext .bleft.bottom.ctext\n     text $ctext -background $bgcolor -foreground $fgcolor \\\n \t-state disabled -font textfont \\\n-\t-yscrollcommand scrolltext -wrap none\n+\t-yscrollcommand scrolltext -wrap none \\\n+\t-xscrollcommand \".bleft.bottom.sbhorizontal set\"\n     if {$have_tk85} {\n \t$ctext conf -tabstyle wordprocessor\n     }\n-    scrollbar .bleft.sb -command \"$ctext yview\"\n+    scrollbar .bleft.bottom.sb -command \"$ctext yview\"\n+    scrollbar .bleft.bottom.sbhorizontal -command \"$ctext xview\" -orient h \\\n+\t-width 10\n     pack .bleft.top -side top -fill x\n     pack .bleft.mid -side top -fill x\n-    pack .bleft.sb -side right -fill y\n-    pack $ctext -side left -fill both -expand 1\n+    grid $ctext .bleft.bottom.sb -sticky nsew\n+    grid .bleft.bottom.sbhorizontal -sticky ew\n+    grid columnconfigure .bleft.bottom 0 -weight 1\n+    grid rowconfigure .bleft.bottom 0 -weight 1\n+    grid rowconfigure .bleft.bottom 1 -weight 0\n+    pack .bleft.bottom -side top -fill both -expand 1\n     lappend bglist $ctext\n     lappend fglist $ctext\n \n@@ -5604,7 +5612,7 @@ proc searchmarkvisible {doall} {\n proc scrolltext {f0 f1} {\n     global searchstring\n \n-    .bleft.sb set $f0 $f1\n+    .bleft.bottom.sb set $f0 $f1\n     if {$searchstring ne {}} {\n \tsearchmarkvisible 0\n     }\n-- \n1.5.4.3\n\n"}]}