[Tkabber-dev] r1001 - in trunk/tkabber-plugins: . aniemoticons

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Mar 4 13:33:00 MSK 2007


Author: sergei
Date: 2007-03-04 13:32:59 +0300 (Sun, 04 Mar 2007)
New Revision: 1001

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/aniemoticons/aniemoticons.tcl
   trunk/tkabber-plugins/aniemoticons/anigif.tcl
Log:
	* aniemoticons/aniemoticons.tcl, aniemoticons/anigif.tcl: Bugfix.
	  Fixed creating and destroying images.


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2007-03-04 10:12:00 UTC (rev 1000)
+++ trunk/tkabber-plugins/ChangeLog	2007-03-04 10:32:59 UTC (rev 1001)
@@ -1,3 +1,8 @@
+2006-03-04  Sergei Golovan <sgolovan at nes.ru>
+
+	* aniemoticons/aniemoticons.tcl, aniemoticons/anigif.tcl: Bugfix.
+	  Fixed creating and destroying images.
+
 2006-03-03  Sergei Golovan <sgolovan at nes.ru>
 
 	* aniemoticons/*: Added new external plugin (moved from the main

Modified: trunk/tkabber-plugins/aniemoticons/aniemoticons.tcl
===================================================================
--- trunk/tkabber-plugins/aniemoticons/aniemoticons.tcl	2007-03-04 10:12:00 UTC (rev 1000)
+++ trunk/tkabber-plugins/aniemoticons/aniemoticons.tcl	2007-03-04 10:32:59 UTC (rev 1001)
@@ -6,7 +6,12 @@
 
 namespace eval emoticons {
     proc create_image {name file} {
-	return [::anigif::anigif $name $file]
+	if {[catch {::anigif::anigif $name $file} res]} {
+	    image create photo $name -file $file
+	    return $name
+	} else {
+	    return $res
+	}
     }
 
     proc delete_image {name} {

Modified: trunk/tkabber-plugins/aniemoticons/anigif.tcl
===================================================================
--- trunk/tkabber-plugins/aniemoticons/anigif.tcl	2007-03-04 10:12:00 UTC (rev 1000)
+++ trunk/tkabber-plugins/aniemoticons/anigif.tcl	2007-03-04 10:32:59 UTC (rev 1001)
@@ -156,8 +156,8 @@
 	set ::anigif::img(delay,$img) $delay
 	set ::anigif::img(disposal,$img) $disposal
 	set ::anigif::img(curimage,$img) $img
-	[set ::anigif::img(curimage,$img)] blank
-	[set ::anigif::img(curimage,$img)] copy pic0${img} ;# -subsample 2 2
+	$img blank
+	$img copy pic0${img} ;# -subsample 2 2
 	#$img configure -image [set ::anigif::img(curimage,$img)]
 
 	anigif2 $img $images $delay $idx
@@ -191,10 +191,12 @@
 	    ::anigif::stop $w
 	    set wlength [string length $w]
 	    foreach imagename [image names] {
-		if {[string equal [string range $imagename [string first "." $imagename] end] $w]} {
+		if {[regexp {^pic\d+(.*)} $imagename -> tail] && \
+			[string equal $tail $w]} {
 		    image delete $imagename
 		}
 	    }
+	    image delete $w
 	    array unset ::anigif::img *,$w
 	}
     }



More information about the Tkabber-dev mailing list