[Tkabber-dev] r767 - in trunk/tkabber-plugins: . whiteboard

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Oct 22 00:19:37 MSD 2006


Author: sergei
Date: 2006-10-22 00:19:34 +0400 (Sun, 22 Oct 2006)
New Revision: 767

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/whiteboard/svgrender.tcl
Log:
	* whiteboard/svgrender.tcl: Check color existence before rendering
	  whiteboard item using this color.


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2006-10-21 18:47:34 UTC (rev 766)
+++ trunk/tkabber-plugins/ChangeLog	2006-10-21 20:19:34 UTC (rev 767)
@@ -1,3 +1,8 @@
+2006-10-22  Sergei Golovan  <sgolovan at nes.ru>
+
+	* whiteboard/svgrender.tcl: Check color existence before rendering
+	  whiteboard item using this color.
+
 2006-10-08  Sergei Golovan  <sgolovan at nes.ru>
 
 	* checkers/msgs/ru.msg, chess/msgs/ru.msg, reversi/msgs/ru.msg:

Modified: trunk/tkabber-plugins/whiteboard/svgrender.tcl
===================================================================
--- trunk/tkabber-plugins/whiteboard/svgrender.tcl	2006-10-21 18:47:34 UTC (rev 766)
+++ trunk/tkabber-plugins/whiteboard/svgrender.tcl	2006-10-21 20:19:34 UTC (rev 767)
@@ -64,7 +64,6 @@
     set transform [eval lreplace [list $transform] -1 -1 \
 		       [parse_transform [jlib::wrapper:getattr \
 					     $vars transform]]]
-					     $vars transform]]
 
     foreach item $items {
 	jlib::wrapper:splitxml $item tag vars1 isempty chdata children
@@ -258,11 +257,12 @@
 
 proc svg::line_opts {} {
     upvar attrs attrs
+    upvar c c
     set opts {-joinstyle miter}
     foreach {attr val} [array get attrs] {
 	switch -- $attr {
 	    "" {}
-	    stroke {lappend opts -fill $val}
+	    stroke {lappend opts -fill [color $c $val]}
 	    stroke-width {lappend opts -width $val}
 	    id {lappend opts -tags [list id$val]}
 	}
@@ -272,18 +272,19 @@
 
 proc svg::rect_opts {} {
     upvar attrs attrs
+    upvar c c
     set opts {}
     foreach {attr val} [array get attrs] {
 	switch -- $attr {
 	    "" {}
 	    fill {
 		if {$val != "" && $val != "none"} {
-		    lappend opts -fill $val
+		    lappend opts -fill [color $c $val]
 		}
 	    }
 	    stroke {
 		if {$val != "" && $val != "none"} {
-		    lappend opts -outline $val
+		    lappend opts -outline [color $c $val]
 		}
 	    }
 	    stroke-width {lappend opts -width $val}
@@ -295,12 +296,13 @@
 
 proc svg::polygon_opts {} {
     upvar attrs attrs
+    upvar c c
     set opts {-joinstyle miter}
     foreach {attr val} [array get attrs] {
 	switch -- $attr {
 	    "" {}
-	    fill {lappend opts -fill $val}
-	    stroke {lappend opts -outline $val}
+	    fill {lappend opts -fill [color $c $val]}
+	    stroke {lappend opts -outline [color $c $val]}
 	    stroke-width {lappend opts -width $val}
 	    id {lappend opts -tags [list id$val]}
 	}
@@ -310,12 +312,13 @@
 
 proc svg::text_opts {} {
     upvar attrs attrs
+    upvar c c
     set opts {-anchor w}
     set fontopts {}
     foreach {attr val} [array get attrs] {
 	switch -- $attr {
 	    "" {}
-	    fill {lappend opts -fill $val}
+	    fill {lappend opts -fill [color $c $val]}
 	    font-family      {lappend fontopts -family $val}
 	    font-size        {lappend fontopts -size $val}
 	    font-size-adjust { # How to do this in Tk? }
@@ -416,3 +419,12 @@
     return [list $x $y]
 }
 
+proc svg::color {c color} {
+    if {[catch {$c create line 0 0 0 0 -fill $color -width 0} id]} {
+	return black
+    } else {
+	$c delete $id
+	return $color
+    }
+}
+



More information about the Tkabber-dev mailing list