Browse Source

git-gui: Use a grid layout for the blame viewer.

Using a panedwindow to display the blame viewer's individual columns
just doesn't make sense.  Most of the important data fits within the
columns we have allocated, and those that don't the leading part fits
and that's good enough.  There are just too many columns within this
viewer to let the user sanely control individual column widths.  This
change shouldn't really be an issue for most git-gui users as their
displays should be large enough to accept this massive dump of data.

We now also have a properly working horizontal scrollbar for the
current file data area.  This makes it easier to get away with a
narrow window when screen space is limited, as you can still scroll
around within the file content.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
maint
Shawn O. Pearce 18 years ago
parent
commit
747c0cf93c
  1. 124
      git-gui.sh

124
git-gui.sh

@ -3153,7 +3153,6 @@ proc show_blame {commit path} {
set texts [list] set texts [list]


toplevel $w toplevel $w
panedwindow $w.out -orient horizontal


label $w.path -text "$commit:$path" \ label $w.path -text "$commit:$path" \
-anchor w \ -anchor w \
@ -3161,122 +3160,126 @@ proc show_blame {commit path} {
-borderwidth 1 \ -borderwidth 1 \
-relief sunken \ -relief sunken \
-font font_uibold -font font_uibold
pack $w.path -anchor w -side top -fill x pack $w.path -side top -fill x


set hbg #e2effa set hbg #e2effa
frame $w.out.commit -width 10 -height 10 frame $w.out
label $w.out.commit.l -text Commit \ label $w.out.commit_l -text Commit \
-relief solid \
-borderwidth 1 \
-background $hbg \ -background $hbg \
-font font_uibold -font font_uibold
text $w.out.commit.t \ text $w.out.commit_t \
-background white -borderwidth 0 \ -background white -borderwidth 0 \
-state disabled \ -state disabled \
-wrap none \ -wrap none \
-height 40 \ -height 40 \
-width 9 \ -width 9 \
-font font_diff -font font_diff
pack $w.out.commit.l -side top -fill x lappend texts $w.out.commit_t
pack $w.out.commit.t -fill both
$w.out add $w.out.commit
lappend texts $w.out.commit.t


frame $w.out.author -width 10 -height 10 label $w.out.author_l -text Author \
label $w.out.author.l -text Author \ -relief solid \
-borderwidth 1 \
-background $hbg \ -background $hbg \
-font font_uibold -font font_uibold
text $w.out.author.t \ text $w.out.author_t \
-background white -borderwidth 0 \ -background white -borderwidth 0 \
-state disabled \ -state disabled \
-wrap none \ -wrap none \
-height 40 \ -height 40 \
-width 20 \ -width 20 \
-font font_diff -font font_diff
pack $w.out.author.l -side top -fill x lappend texts $w.out.author_t
pack $w.out.author.t -fill both
$w.out add $w.out.author
lappend texts $w.out.author.t


frame $w.out.date -width 10 -height 10 label $w.out.date_l -text Date \
label $w.out.date.l -text Date \ -relief solid \
-borderwidth 1 \
-background $hbg \ -background $hbg \
-font font_uibold -font font_uibold
text $w.out.date.t \ text $w.out.date_t \
-background white -borderwidth 0 \ -background white -borderwidth 0 \
-state disabled \ -state disabled \
-wrap none \ -wrap none \
-height 40 \ -height 40 \
-width [string length "yyyy-mm-dd hh:mm:ss"] \ -width [string length "yyyy-mm-dd hh:mm:ss"] \
-font font_diff -font font_diff
pack $w.out.date.l -side top -fill x lappend texts $w.out.date_t
pack $w.out.date.t -fill both
$w.out add $w.out.date
lappend texts $w.out.date.t


frame $w.out.filename -width 10 -height 10 label $w.out.filename_l -text Filename \
label $w.out.filename.l -text Filename \ -relief solid \
-borderwidth 1 \
-background $hbg \ -background $hbg \
-font font_uibold -font font_uibold
text $w.out.filename.t \ text $w.out.filename_t \
-background white -borderwidth 0 \ -background white -borderwidth 0 \
-state disabled \ -state disabled \
-wrap none \ -wrap none \
-height 40 \ -height 40 \
-width 20 \ -width 20 \
-font font_diff -font font_diff
pack $w.out.filename.l -side top -fill x lappend texts $w.out.filename_t
pack $w.out.filename.t -fill both
$w.out add $w.out.filename
lappend texts $w.out.filename.t


frame $w.out.origlinenumber -width 10 -height 10 label $w.out.origlinenumber_l -text {Orig Line} \
label $w.out.origlinenumber.l -text {Orig Line} \ -relief solid \
-borderwidth 1 \
-background $hbg \ -background $hbg \
-font font_uibold -font font_uibold
text $w.out.origlinenumber.t \ text $w.out.origlinenumber_t \
-background white -borderwidth 0 \ -background white -borderwidth 0 \
-state disabled \ -state disabled \
-wrap none \ -wrap none \
-height 40 \ -height 40 \
-width 5 \ -width 5 \
-font font_diff -font font_diff
$w.out.origlinenumber.t tag conf linenumber -justify right $w.out.origlinenumber_t tag conf linenumber -justify right
pack $w.out.origlinenumber.l -side top -fill x lappend texts $w.out.origlinenumber_t
pack $w.out.origlinenumber.t -fill both
$w.out add $w.out.origlinenumber label $w.out.linenumber_l -text {Curr Line} \
lappend texts $w.out.origlinenumber.t -relief solid \

-borderwidth 1 \
frame $w.out.linenumber -width 10 -height 10
label $w.out.linenumber.l -text {Curr Line} \
-background $hbg \ -background $hbg \
-font font_uibold -font font_uibold
text $w.out.linenumber.t \ text $w.out.linenumber_t \
-background white -borderwidth 0 \ -background white -borderwidth 0 \
-state disabled \ -state disabled \
-wrap none \ -wrap none \
-height 40 \ -height 40 \
-width 5 \ -width 5 \
-font font_diff -font font_diff
$w.out.linenumber.t tag conf linenumber -justify right $w.out.linenumber_t tag conf linenumber -justify right
pack $w.out.linenumber.l -side top -fill x lappend texts $w.out.linenumber_t
pack $w.out.linenumber.t -fill both
$w.out add $w.out.linenumber label $w.out.file_l -text {File Content} \
lappend texts $w.out.linenumber.t -relief solid \

-borderwidth 1 \
frame $w.out.file -width 10 -height 10
label $w.out.file.l -text {File Content} \
-background $hbg \ -background $hbg \
-font font_uibold -font font_uibold
text $w.out.file.t \ text $w.out.file_t \
-background white -borderwidth 0 \ -background white -borderwidth 0 \
-state disabled \ -state disabled \
-wrap none \ -wrap none \
-height 40 \ -height 40 \
-width 80 \ -width 80 \
-xscrollcommand [list $w.out.sbx set] \
-font font_diff -font font_diff
pack $w.out.file.l -side top -fill x lappend texts $w.out.file_t
pack $w.out.file.t -fill both
$w.out add $w.out.file scrollbar $w.out.sbx -orient h -command [list $w.out.file_t xview]
lappend texts $w.out.file.t scrollbar $w.out.sby -orient v \
-command [list scrollbar2many $texts yview]
set labels [list]
foreach i $texts {
regsub {_t$} $i _l l
lappend labels $l
}
set file_col [expr {[llength $texts] - 1}]
eval grid $labels -sticky we
eval grid $texts $w.out.sby -sticky nsew
grid conf $w.out.sbx -column $file_col -sticky we
grid columnconfigure $w.out $file_col -weight 1
grid rowconfigure $w.out 1 -weight 1
pack $w.out -fill both -expand 1


label $w.status -textvariable blame_status($w) \ label $w.status -textvariable blame_status($w) \
-anchor w \ -anchor w \
@ -3284,12 +3287,7 @@ proc show_blame {commit path} {
-borderwidth 1 \ -borderwidth 1 \
-relief sunken \ -relief sunken \
-font font_ui -font font_ui
pack $w.status -anchor w -side bottom -fill x pack $w.status -side bottom -fill x

scrollbar $w.sby -orient v \
-command [list scrollbar2many $texts yview]
pack $w.sby -side right -fill y
pack $w.out -side left -fill both -expand 1


menu $w.ctxm -tearoff 0 menu $w.ctxm -tearoff 0
$w.ctxm add command -label "Copy Commit" \ $w.ctxm add command -label "Copy Commit" \
@ -3301,7 +3299,7 @@ proc show_blame {commit path} {
-background [$i cget -foreground] \ -background [$i cget -foreground] \
-foreground [$i cget -background] -foreground [$i cget -background]
$i conf -yscrollcommand \ $i conf -yscrollcommand \
[list many2scrollbar $texts yview $w.sby] [list many2scrollbar $texts yview $w.out.sby]
bind $i <Button-1> "blame_highlight $i @%x,%y $texts;break" bind $i <Button-1> "blame_highlight $i @%x,%y $texts;break"
bind_button3 $i " bind_button3 $i "
set cursorX %x set cursorX %x
@ -3324,7 +3322,7 @@ proc show_blame {commit path} {
fconfigure $fd -blocking 0 -translation lf -encoding binary fconfigure $fd -blocking 0 -translation lf -encoding binary
fileevent $fd readable [list read_blame_catfile \ fileevent $fd readable [list read_blame_catfile \
$fd $w $commit $path \ $fd $w $commit $path \
$texts $w.out.linenumber.t $w.out.file.t] $texts $w.out.linenumber_t $w.out.file_t]
} }


proc read_blame_catfile {fd w commit path texts w_lno w_file} { proc read_blame_catfile {fd w commit path texts w_lno w_file} {

Loading…
Cancel
Save