hgk: display bookmarks as gray labels in the commitline stable
authorDavid Soria Parra <dsp@php.net>
Wed, 23 Feb 2011 00:25:01 +0100
branchstable
changeset 13462 8641cb094c81
parent 13461 81af2040b586
child 13463 22f948c027a9
hgk: display bookmarks as gray labels in the commitline
contrib/hgk
--- a/contrib/hgk	Wed Feb 23 00:24:21 2011 +0100
+++ b/contrib/hgk	Wed Feb 23 00:25:01 2011 +0100
@@ -1156,17 +1156,22 @@
 }
 
 proc drawtags {id x xt y1} {
-    global idtags idheads idotherrefs commitinfo
+    global bookmarkcurrent idtags idbookmarks idheads idotherrefs commitinfo
     global linespc lthickness
     global canv mainfont idline rowtextx
 
     set marks {}
+    set nbookmarks 0
     set ntags 0
     set nheads 0
     if {[info exists idtags($id)]} {
 	set marks $idtags($id)
 	set ntags [llength $marks]
     }
+    if {[info exists idbookmarks($id)]} {
+	set marks [concat $marks $idbookmarks($id)]
+	set nbookmarks [llength $idbookmarks($id)]
+    }
     if {[info exists idheads($id)]} {
 	set headmark [lindex $commitinfo($id) 7]
 	if {$headmark ne "default"} {
@@ -1174,9 +1179,6 @@
 	    set nheads 1
 	}
     }
-    if {[info exists idotherrefs($id)]} {
-	set marks [concat $marks $idotherrefs($id)]
-    }
     if {$marks eq {}} {
 	return $xt
     }
@@ -1205,16 +1207,25 @@
 		       -width 1 -outline black -fill yellow -tags tag.$id]
 	    $canv bind $t <1> [list showtag $tag 1]
 	    set rowtextx($idline($id)) [expr {$xr + $linespc}]
-	} else {
-	    # draw a head or other ref
-	    if {[incr nheads -1] >= 0} {
-		set col green
-	    } else {
-		set col "#ddddff"
-	    }
-	    set xl [expr $xl - $delta/2]
-	    $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \
-		-width 1 -outline black -fill $col -tags tag.$id
+	} elseif {[incr nbookmarks -1] >= 0} {
+            # draw a tag
+            set col gray50
+            if {[string compare $bookmarkcurrent $tag] == 0} {
+                set col gray
+            }
+            set xl [expr $xl - $delta/2]
+            $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \
+                -width 1 -outline black -fill $col -tags tag.$id
+        } else {
+            # draw a head or other ref
+            if {[incr nheads -1] >= 0} {
+                set col green
+            } else {
+                set col "#ddddff"
+            }
+            set xl [expr $xl - $delta/2]
+            $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \
+                -width 1 -outline black -fill $col -tags tag.$id
 	}
 	set t [$canv create text $xl $y1 -anchor w -text $tag \
 		   -font $mainfont -tags tag.$id]