@matheusbsbs / matheus-bagliano / commits / 747c0cf93c
Fork 0

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>

Shawn O. Pearce committed Jan 29, 2007 at 06:23 UTC 747c0cf93c75207da095709a92a615aae0553289
1 file changed +61 -63
git-gui.sh
+61 -63
@@ -3153,7 +3153,6 @@ proc show_blame {commit path} {
3153 set texts [list]
3154
3155 toplevel $w
3156 - panedwindow $w.out -orient horizontal
3156
3157 label $w.path -text "$commit:$path" \
3158 -anchor w \
@@ -3161,122 +3160,126 @@ proc show_blame {commit path} {
3160 -borderwidth 1 \
3161 -relief sunken \
3162 -font font_uibold
3164 - pack $w.path -anchor w -side top -fill x
3163 + pack $w.path -side top -fill x
3164
3165 set hbg #e2effa
3167 - frame $w.out.commit -width 10 -height 10
3168 - label $w.out.commit.l -text Commit \
3166 + frame $w.out
3167 + label $w.out.commit_l -text Commit \
3168 + -relief solid \
3169 + -borderwidth 1 \
3170 -background $hbg \
3171 -font font_uibold
3171 - text $w.out.commit.t \
3172 + text $w.out.commit_t \
3173 -background white -borderwidth 0 \
3174 -state disabled \
3175 -wrap none \
3176 -height 40 \
3177 -width 9 \
3178 -font font_diff
3178 - pack $w.out.commit.l -side top -fill x
3179 - pack $w.out.commit.t -fill both
3180 - $w.out add $w.out.commit
3181 - lappend texts $w.out.commit.t
3179 + lappend texts $w.out.commit_t
3180
3183 - frame $w.out.author -width 10 -height 10
3184 - label $w.out.author.l -text Author \
3181 + label $w.out.author_l -text Author \
3182 + -relief solid \
3183 + -borderwidth 1 \
3184 -background $hbg \
3185 -font font_uibold
3187 - text $w.out.author.t \
3186 + text $w.out.author_t \
3187 -background white -borderwidth 0 \
3188 -state disabled \
3189 -wrap none \
3190 -height 40 \
3191 -width 20 \
3192 -font font_diff
3194 - pack $w.out.author.l -side top -fill x
3195 - pack $w.out.author.t -fill both
3196 - $w.out add $w.out.author
3197 - lappend texts $w.out.author.t
3193 + lappend texts $w.out.author_t
3194
3199 - frame $w.out.date -width 10 -height 10
3200 - label $w.out.date.l -text Date \
3195 + label $w.out.date_l -text Date \
3196 + -relief solid \
3197 + -borderwidth 1 \
3198 -background $hbg \
3199 -font font_uibold
3203 - text $w.out.date.t \
3200 + text $w.out.date_t \
3201 -background white -borderwidth 0 \
3202 -state disabled \
3203 -wrap none \
3204 -height 40 \
3205 -width [string length "yyyy-mm-dd hh:mm:ss"] \
3206 -font font_diff
3210 - pack $w.out.date.l -side top -fill x
3211 - pack $w.out.date.t -fill both
3212 - $w.out add $w.out.date
3213 - lappend texts $w.out.date.t
3207 + lappend texts $w.out.date_t
3208
3215 - frame $w.out.filename -width 10 -height 10
3216 - label $w.out.filename.l -text Filename \
3209 + label $w.out.filename_l -text Filename \
3210 + -relief solid \
3211 + -borderwidth 1 \
3212 -background $hbg \
3213 -font font_uibold
3219 - text $w.out.filename.t \
3214 + text $w.out.filename_t \
3215 -background white -borderwidth 0 \
3216 -state disabled \
3217 -wrap none \
3218 -height 40 \
3219 -width 20 \
3220 -font font_diff
3226 - pack $w.out.filename.l -side top -fill x
3227 - pack $w.out.filename.t -fill both
3228 - $w.out add $w.out.filename
3229 - lappend texts $w.out.filename.t
3221 + lappend texts $w.out.filename_t
3222
3231 - frame $w.out.origlinenumber -width 10 -height 10
3232 - label $w.out.origlinenumber.l -text {Orig Line} \
3223 + label $w.out.origlinenumber_l -text {Orig Line} \
3224 + -relief solid \
3225 + -borderwidth 1 \
3226 -background $hbg \
3227 -font font_uibold
3235 - text $w.out.origlinenumber.t \
3228 + text $w.out.origlinenumber_t \
3229 -background white -borderwidth 0 \
3230 -state disabled \
3231 -wrap none \
3232 -height 40 \
3233 -width 5 \
3234 -font font_diff
3242 - $w.out.origlinenumber.t tag conf linenumber -justify right
3243 - pack $w.out.origlinenumber.l -side top -fill x
3244 - pack $w.out.origlinenumber.t -fill both
3245 - $w.out add $w.out.origlinenumber
3246 - lappend texts $w.out.origlinenumber.t
3247 -
3248 - frame $w.out.linenumber -width 10 -height 10
3249 - label $w.out.linenumber.l -text {Curr Line} \
3235 + $w.out.origlinenumber_t tag conf linenumber -justify right
3236 + lappend texts $w.out.origlinenumber_t
3237 +
3238 + label $w.out.linenumber_l -text {Curr Line} \
3239 + -relief solid \
3240 + -borderwidth 1 \
3241 -background $hbg \
3242 -font font_uibold
3252 - text $w.out.linenumber.t \
3243 + text $w.out.linenumber_t \
3244 -background white -borderwidth 0 \
3245 -state disabled \
3246 -wrap none \
3247 -height 40 \
3248 -width 5 \
3249 -font font_diff
3259 - $w.out.linenumber.t tag conf linenumber -justify right
3260 - pack $w.out.linenumber.l -side top -fill x
3261 - pack $w.out.linenumber.t -fill both
3262 - $w.out add $w.out.linenumber
3263 - lappend texts $w.out.linenumber.t
3264 -
3265 - frame $w.out.file -width 10 -height 10
3266 - label $w.out.file.l -text {File Content} \
3250 + $w.out.linenumber_t tag conf linenumber -justify right
3251 + lappend texts $w.out.linenumber_t
3252 +
3253 + label $w.out.file_l -text {File Content} \
3254 + -relief solid \
3255 + -borderwidth 1 \
3256 -background $hbg \
3257 -font font_uibold
3269 - text $w.out.file.t \
3258 + text $w.out.file_t \
3259 -background white -borderwidth 0 \
3260 -state disabled \
3261 -wrap none \
3262 -height 40 \
3263 -width 80 \
3264 + -xscrollcommand [list $w.out.sbx set] \
3265 -font font_diff
3276 - pack $w.out.file.l -side top -fill x
3277 - pack $w.out.file.t -fill both
3278 - $w.out add $w.out.file
3279 - lappend texts $w.out.file.t
3266 + lappend texts $w.out.file_t
3267 +
3268 + scrollbar $w.out.sbx -orient h -command [list $w.out.file_t xview]
3269 + scrollbar $w.out.sby -orient v \
3270 + -command [list scrollbar2many $texts yview]
3271 + set labels [list]
3272 + foreach i $texts {
3273 + regsub {_t$} $i _l l
3274 + lappend labels $l
3275 + }
3276 + set file_col [expr {[llength $texts] - 1}]
3277 + eval grid $labels -sticky we
3278 + eval grid $texts $w.out.sby -sticky nsew
3279 + grid conf $w.out.sbx -column $file_col -sticky we
3280 + grid columnconfigure $w.out $file_col -weight 1
3281 + grid rowconfigure $w.out 1 -weight 1
3282 + pack $w.out -fill both -expand 1
3283
3284 label $w.status -textvariable blame_status($w) \
3285 -anchor w \
@@ -3284,12 +3287,7 @@ proc show_blame {commit path} {
3287 -borderwidth 1 \
3288 -relief sunken \
3289 -font font_ui
3287 - pack $w.status -anchor w -side bottom -fill x
3288 -
3289 - scrollbar $w.sby -orient v \
3290 - -command [list scrollbar2many $texts yview]
3291 - pack $w.sby -side right -fill y
3292 - pack $w.out -side left -fill both -expand 1
3290 + pack $w.status -side bottom -fill x
3291
3292 menu $w.ctxm -tearoff 0
3293 $w.ctxm add command -label "Copy Commit" \
@@ -3301,7 +3299,7 @@ proc show_blame {commit path} {
3299 -background [$i cget -foreground] \
3300 -foreground [$i cget -background]
3301 $i conf -yscrollcommand \
3304 - [list many2scrollbar $texts yview $w.sby]
3302 + [list many2scrollbar $texts yview $w.out.sby]
3303 bind $i <Button-1> "blame_highlight $i @%x,%y $texts;break"
3304 bind_button3 $i "
3305 set cursorX %x
@@ -3324,7 +3322,7 @@ proc show_blame {commit path} {
3322 fconfigure $fd -blocking 0 -translation lf -encoding binary
3323 fileevent $fd readable [list read_blame_catfile \
3324 $fd $w $commit $path \
3327 - $texts $w.out.linenumber.t $w.out.file.t]
3325 + $texts $w.out.linenumber_t $w.out.file_t]
3326 }
3327
3328 proc read_blame_catfile {fd w commit path texts w_lno w_file} {