@matheusbsbs / matheus-bagliano / commits / 3fc4279a14
Fork 0

gitk: Add some more comments to the optimize_rows procedure

Signed-off-by: Paul Mackerras <paulus@samba.org>

Paul Mackerras committed Sep 15, 2006 at 09:45 UTC 3fc4279a144d0c477749fbe5318e570739f569e2
1 file changed +12
gitk
+12
@@ -2739,7 +2739,13 @@ proc optimize_rows {row col endrow} {
2739 set isarrow 1
2740 }
2741 }
2742 + # Looking at lines from this row to the previous row,
2743 + # make them go straight up if they end in an arrow on
2744 + # the previous row; otherwise make them go straight up
2745 + # or at 45 degrees.
2746 if {$z < -1 || ($z < 0 && $isarrow)} {
2747 + # Line currently goes left too much;
2748 + # insert pads in the previous row, then optimize it
2749 set npad [expr {-1 - $z + $isarrow}]
2750 set offs [incrange $offs $col $npad]
2751 insert_pad $y0 $x0 $npad
@@ -2750,6 +2756,8 @@ proc optimize_rows {row col endrow} {
2756 set x0 [expr {$col + $z}]
2757 set z0 [lindex $rowoffsets $y0 $x0]
2758 } elseif {$z > 1 || ($z > 0 && $isarrow)} {
2759 + # Line currently goes right too much;
2760 + # insert pads in this line and adjust the next's rowoffsets
2761 set npad [expr {$z - 1 + $isarrow}]
2762 set y1 [expr {$row + 1}]
2763 set offs2 [lindex $rowoffsets $y1]
@@ -2780,6 +2788,7 @@ proc optimize_rows {row col endrow} {
2788 set z0 [expr {$xc - $x0}]
2789 }
2790 }
2791 + # avoid lines jigging left then immediately right
2792 if {$z0 ne {} && $z < 0 && $z0 > 0} {
2793 insert_pad $y0 $x0 1
2794 set offs [incrange $offs $col 1]
@@ -2788,6 +2797,7 @@ proc optimize_rows {row col endrow} {
2797 }
2798 if {!$haspad} {
2799 set o {}
2800 + # Find the first column that doesn't have a line going right
2801 for {set col [llength $idlist]} {[incr col -1] >= 0} {} {
2802 set o [lindex $offs $col]
2803 if {$o eq {}} {
@@ -2806,6 +2816,8 @@ proc optimize_rows {row col endrow} {
2816 }
2817 if {$o eq {} || $o <= 0} break
2818 }
2819 + # Insert a pad at that column as long as it has a line and
2820 + # isn't the last column, and adjust the next row' offsets
2821 if {$o ne {} && [incr col] < [llength $idlist]} {
2822 set y1 [expr {$row + 1}]
2823 set offs2 [lindex $rowoffsets $y1]