@matheusbsbs / matheus-bagliano / commits / d4d992562e
Fork 0

git-gui: Fix the blame window shape.

On modern high-resolution monitors the blame viewer window is very high, yet too narrow. This patch makes it gravitate to a more sane resolution, which takes the font size into account. It also changes the default text view size to 80% of the window, and slightly modifies the border decorations for better appearance. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Alexander Gavrilov committed Oct 3, 2008 at 11:36 UTC d4d992562e8c6d27ac584ff0907ff840030a98d9
1 file changed +13 -6
lib/blame.tcl
+13 -6
@@ -69,6 +69,8 @@ constructor new {i_commit i_path i_jump} {
69 make_toplevel top w
70 wm title $top [append "[appname] ([reponame]): " [mc "File Viewer"]]
71
72 + set font_w [font measure font_diff "0"]
73 +
74 frame $w.header -background gold
75 label $w.header.commit_l \
76 -text [mc "Commit:"] \
@@ -114,9 +116,9 @@ constructor new {i_commit i_path i_jump} {
116 pack $w_path -fill x -side right
117 pack $w.header.path_l -side right
118
117 - panedwindow $w.file_pane -orient vertical
118 - frame $w.file_pane.out
119 - frame $w.file_pane.cm
119 + panedwindow $w.file_pane -orient vertical -borderwidth 0 -sashwidth 3
120 + frame $w.file_pane.out -relief flat -borderwidth 1
121 + frame $w.file_pane.cm -relief sunken -borderwidth 1
122 $w.file_pane add $w.file_pane.out \
123 -sticky nsew \
124 -minsize 100 \
@@ -328,9 +330,14 @@ constructor new {i_commit i_path i_jump} {
330
331 set req_w [winfo reqwidth $top]
332 set req_h [winfo reqheight $top]
331 - set scr_h [expr {[winfo screenheight $top] - 100}]
332 - if {$req_w < 600} {set req_w 600}
333 + set scr_w [expr {[winfo screenwidth $top] - 40}]
334 + set scr_h [expr {[winfo screenheight $top] - 120}]
335 + set opt_w [expr {$font_w * (80 + 5*3 + 3)}]
336 + if {$req_w < $opt_w} {set req_w $opt_w}
337 + if {$req_w > $scr_w} {set req_w $scr_w}
338 + set opt_h [expr {$req_w*4/3}]
339 if {$req_h < $scr_h} {set req_h $scr_h}
340 + if {$req_h > $opt_h} {set req_h $opt_h}
341 set g "${req_w}x${req_h}"
342 wm geometry $top $g
343 update
@@ -338,7 +345,7 @@ constructor new {i_commit i_path i_jump} {
345 set old_height [winfo height $w.file_pane]
346 $w.file_pane sash place 0 \
347 [lindex [$w.file_pane sash coord 0] 0] \
341 - [expr {int($old_height * 0.70)}]
348 + [expr {int($old_height * 0.80)}]
349 bind $w.file_pane <Configure> \
350 "if {{$w.file_pane} eq {%W}} {[cb _resize %h]}"
351