Eskil

Diff
Login

Differences From Artifact [2647634970]:

To Artifact [c2b1c2a31d]:


40
41
42
43
44
45
46
47
48


49
50
51
52
53
54

55
56
57

58
59
60
61

62
63
64
65
66
67
68
69
70
71
72


73
74
75
76
77
78
79
80
81

82
83

84
85
86
87

88
89
90
91
92
93
94
40
41
42
43
44
45
46


47
48
49
50
51
52
53

54
55
56

57
58
59
60

61
62
63
64
65
66
67
68
69
70


71
72
73
74
75
76
77
78
79
80

81
82

83
84
85
86

87
88
89
90
91
92
93
94







-
-
+
+





-
+


-
+



-
+









-
-
+
+








-
+

-
+



-
+







    bind $w <Configure> [list drawMap $top %h]
    bind $w <Button-2>  [list ThumbMap $top %y]

    return $w
}

proc clearMap {top} {
    set ::diff($top,changes) {}
    set ::diff($top,mapMax) 0
    set ::eskil($top,changes) {}
    set ::eskil($top,mapMax) 0
    drawMap $top -1
}

proc addChange {top n tag line1 n1 line2 n2} {
    if {$tag ne ""} {
        lappend ::diff($top,changes) [list $::diff($top,mapMax) $n \
        lappend ::eskil($top,changes) [list $::eskil($top,mapMax) $n \
                $tag $line1 $n1 $line2 $n2]
    }
    incr ::diff($top,mapMax) $n
    incr ::eskil($top,mapMax) $n
}

proc addMapLines {top n} {
    incr ::diff($top,mapMax) $n
    incr ::eskil($top,mapMax) $n
}

proc drawMap {top newh} {
    global Pref

    set oldh [map$top cget -height]
    if {$oldh == $newh} return

    map$top blank
    if {![info exists ::diff($top,changes)] || \
	    [llength $::diff($top,changes)] == 0} return
    if {![info exists ::eskil($top,changes)] || \
	    [llength $::eskil($top,changes)] == 0} return

    set w [winfo width $top.c_map]
    set h [winfo height $top.c_map]
    set x2 [expr {$w - ($Pref(wideMap) ? 5 : 1)}]
    if {$x2 < 0} { set x2 0 }
    map$top configure -width $w -height $h
    incr h -1
    set y0 0
    foreach change $::diff($top,changes) {
    foreach change $::eskil($top,changes) {
	lassign $change start length type
	set y1 [expr {$start * $h / $::diff($top,mapMax) + 1}]
	set y1 [expr {$start * $h / $::eskil($top,mapMax) + 1}]
	if {!$y0} { set y0 $y1 } ;# Record first occurance
	if {$y1 < 1} {set y1 1}
	if {$y1 > $h} {set y1 $h}
	set y2 [expr {($start + $length) * $h / $::diff($top,mapMax) + 1}]
	set y2 [expr {($start + $length) * $h / $::eskil($top,mapMax) + 1}]
	if {$y2 < 1} {set y2 1}
	if {$y2 <= $y1} {set y2 [expr {$y1 + 1}]}
	if {$y2 > $h} {set y2 $h}
	incr y2
	map$top put $Pref(color$type) -to 1 $y1 $x2 $y2
    }
    if {$Pref(wideMap)} {