comparison contrib/hgk @ 13462:8641cb094c81 stable

hgk: display bookmarks as gray labels in the commitline
author David Soria Parra <dsp@php.net>
date Wed, 23 Feb 2011 00:25:01 +0100
parents 81af2040b586
children 22f948c027a9
comparison
equal deleted inserted replaced
13461:81af2040b586 13462:8641cb094c81
1154 set olddisplist $displist 1154 set olddisplist $displist
1155 set oldnlines [llength $displist] 1155 set oldnlines [llength $displist]
1156 } 1156 }
1157 1157
1158 proc drawtags {id x xt y1} { 1158 proc drawtags {id x xt y1} {
1159 global idtags idheads idotherrefs commitinfo 1159 global bookmarkcurrent idtags idbookmarks idheads idotherrefs commitinfo
1160 global linespc lthickness 1160 global linespc lthickness
1161 global canv mainfont idline rowtextx 1161 global canv mainfont idline rowtextx
1162 1162
1163 set marks {} 1163 set marks {}
1164 set nbookmarks 0
1164 set ntags 0 1165 set ntags 0
1165 set nheads 0 1166 set nheads 0
1166 if {[info exists idtags($id)]} { 1167 if {[info exists idtags($id)]} {
1167 set marks $idtags($id) 1168 set marks $idtags($id)
1168 set ntags [llength $marks] 1169 set ntags [llength $marks]
1169 } 1170 }
1171 if {[info exists idbookmarks($id)]} {
1172 set marks [concat $marks $idbookmarks($id)]
1173 set nbookmarks [llength $idbookmarks($id)]
1174 }
1170 if {[info exists idheads($id)]} { 1175 if {[info exists idheads($id)]} {
1171 set headmark [lindex $commitinfo($id) 7] 1176 set headmark [lindex $commitinfo($id) 7]
1172 if {$headmark ne "default"} { 1177 if {$headmark ne "default"} {
1173 lappend marks $headmark 1178 lappend marks $headmark
1174 set nheads 1 1179 set nheads 1
1175 } 1180 }
1176 }
1177 if {[info exists idotherrefs($id)]} {
1178 set marks [concat $marks $idotherrefs($id)]
1179 } 1181 }
1180 if {$marks eq {}} { 1182 if {$marks eq {}} {
1181 return $xt 1183 return $xt
1182 } 1184 }
1183 1185
1203 set t [$canv create polygon $x [expr $yt + $delta] $xl $yt \ 1205 set t [$canv create polygon $x [expr $yt + $delta] $xl $yt \
1204 $xr $yt $xr $yb $xl $yb $x [expr $yb - $delta] \ 1206 $xr $yt $xr $yb $xl $yb $x [expr $yb - $delta] \
1205 -width 1 -outline black -fill yellow -tags tag.$id] 1207 -width 1 -outline black -fill yellow -tags tag.$id]
1206 $canv bind $t <1> [list showtag $tag 1] 1208 $canv bind $t <1> [list showtag $tag 1]
1207 set rowtextx($idline($id)) [expr {$xr + $linespc}] 1209 set rowtextx($idline($id)) [expr {$xr + $linespc}]
1208 } else { 1210 } elseif {[incr nbookmarks -1] >= 0} {
1209 # draw a head or other ref 1211 # draw a tag
1210 if {[incr nheads -1] >= 0} { 1212 set col gray50
1211 set col green 1213 if {[string compare $bookmarkcurrent $tag] == 0} {
1212 } else { 1214 set col gray
1213 set col "#ddddff" 1215 }
1214 } 1216 set xl [expr $xl - $delta/2]
1215 set xl [expr $xl - $delta/2] 1217 $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \
1216 $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \ 1218 -width 1 -outline black -fill $col -tags tag.$id
1217 -width 1 -outline black -fill $col -tags tag.$id 1219 } else {
1220 # draw a head or other ref
1221 if {[incr nheads -1] >= 0} {
1222 set col green
1223 } else {
1224 set col "#ddddff"
1225 }
1226 set xl [expr $xl - $delta/2]
1227 $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \
1228 -width 1 -outline black -fill $col -tags tag.$id
1218 } 1229 }
1219 set t [$canv create text $xl $y1 -anchor w -text $tag \ 1230 set t [$canv create text $xl $y1 -anchor w -text $tag \
1220 -font $mainfont -tags tag.$id] 1231 -font $mainfont -tags tag.$id]
1221 if {$ntags >= 0} { 1232 if {$ntags >= 0} {
1222 $canv bind $t <1> [list showtag $tag 1] 1233 $canv bind $t <1> [list showtag $tag 1]