49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
}
# Temporarily ignore changes added by addChange.
proc mapNoChange {top value} {
set ::eskil($top,mapNoChange) $value
}
proc addChange {top n tag line1 n1 line2 n2} {
if {$tag ne "" && $::eskil($top,mapNoChange) == 0} {
lappend ::eskil($top,changes) [list $::eskil($top,mapMax) $n \
$tag $line1 $n1 $line2 $n2]
}
incr ::eskil($top,mapMax) $n
}
proc addMapLines {top n} {
incr ::eskil($top,mapMax) $n
}
# Use the assembled information for the map to draw edit buttons
proc drawEditButtons {top} {
$::widgets($top,wTb) delete 1.0 end
set l 0
foreach change $::eskil($top,changes) {
|
|
|
|
|
|
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
}
# Temporarily ignore changes added by addChange.
proc mapNoChange {top value} {
set ::eskil($top,mapNoChange) $value
}
proc addChange {top nLines tag line1 n1 line2 n2} {
if {$tag ne "" && $::eskil($top,mapNoChange) == 0} {
lappend ::eskil($top,changes) [list $::eskil($top,mapMax) $nLines \
$tag $line1 $n1 $line2 $n2]
}
incr ::eskil($top,mapMax) $nLines
}
proc addMapLines {top nLines} {
incr ::eskil($top,mapMax) $nLines
}
# Use the assembled information for the map to draw edit buttons
proc drawEditButtons {top} {
$::widgets($top,wTb) delete 1.0 end
set l 0
foreach change $::eskil($top,changes) {
|
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
}
proc drawMap {top newh} {
set oldh [map$top cget -height]
if {$oldh == $newh} return
map$top blank
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 $::eskil($top,changes) {
lassign $change start length type
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 / $::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
|
|
|
|
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
}
proc drawMap {top newh} {
set oldh [map$top cget -height]
if {$oldh == $newh} return
map$top blank
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 $::eskil($top,changes) {
lassign $change start length type
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 / $::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
|