[Tkabber-dev] r1672 - in trunk/tkabber-plugins: . aniemoticons aniemoticons/msgs attline attline/msgs

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Wed Feb 18 21:04:58 MSK 2009


Author: sergei
Date: 2009-02-18 21:04:58 +0300 (Wed, 18 Feb 2009)
New Revision: 1672

Added:
   trunk/tkabber-plugins/aniemoticons/msgs/
   trunk/tkabber-plugins/aniemoticons/msgs/ru.msg
   trunk/tkabber-plugins/aniemoticons/preload.tcl
   trunk/tkabber-plugins/attline/preload.tcl
Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/aniemoticons/aniemoticons.tcl
   trunk/tkabber-plugins/attline/attline.tcl
   trunk/tkabber-plugins/attline/msgs/ru.msg
Log:
	* aniemoticons/aniemoticons.tcl, aniemoticons/preload.tcl,
	  aniemoticons/msgs/ru.msg: Made aniemoticons plugin unloadable.

	* attline/attline.tcl, attline/preload.tcl, attline/msgs/ru.msg: Made
	  attention line plugin unloadable.


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2009-02-18 12:32:48 UTC (rev 1671)
+++ trunk/tkabber-plugins/ChangeLog	2009-02-18 18:04:58 UTC (rev 1672)
@@ -8,6 +8,12 @@
 
 	* debug/msgs/ru.msg: Update Russian translation.
 
+	* aniemoticons/aniemoticons.tcl, aniemoticons/preload.tcl,
+	  aniemoticons/msgs/ru.msg: Made aniemoticons plugin unloadable.
+
+	* attline/attline.tcl, attline/preload.tcl, attline/msgs/ru.msg: Made
+	  attention line plugin unloadable.
+
 2009-02-17  Sergei Golovan <sgolovan at nes.ru>
 
 	* georoster/georoster.tcl: Fixed typo.

Modified: trunk/tkabber-plugins/aniemoticons/aniemoticons.tcl
===================================================================
--- trunk/tkabber-plugins/aniemoticons/aniemoticons.tcl	2009-02-18 12:32:48 UTC (rev 1671)
+++ trunk/tkabber-plugins/aniemoticons/aniemoticons.tcl	2009-02-18 18:04:58 UTC (rev 1672)
@@ -4,8 +4,13 @@
     source [file join [file dirname [info script]] anigif.tcl]
 }
 
-namespace eval emoticons {
-    proc create_image {name file} {
+namespace eval aniemoticons {}
+
+proc aniemoticons::load {} {
+    rename ::plugins::emoticons::create_image ::plugins::emoticons::create_image:anigif
+    rename ::plugins::emoticons::delete_image ::plugins::emoticons::delete_image:anigif
+
+    proc ::plugins::emoticons::create_image {name file} {
 	if {[catch {::anigif::anigif $name $file} res]} {
 	    image create photo $name -file $file
 	    return $name
@@ -14,8 +19,26 @@
 	}
     }
 
-    proc delete_image {name} {
+    proc ::plugins::emoticons::delete_image {name} {
 	::anigif::destroy $name
     }
 }
 
+proc aniemoticons::unload {} {
+    if {[llength [info procs ::plugins::emoticons::create_image:anigif]] == 0 || \
+	    [llength [info procs ::plugins::emoticons::delete_image:anigif]] == 0} {
+	return
+    }
+
+    rename ::plugins::emoticons::create_image ""
+    rename ::plugins::emoticons::delete_image ""
+    rename ::plugins::emoticons::create_image:anigif ::plugins::emoticons::create_image
+    rename ::plugins::emoticons::delete_image:anigif ::plugins::emoticons::delete_image
+
+    foreach name [image names] {
+	::anigif::stop $name
+    }
+
+    namespace delete ::anigif
+}
+

Added: trunk/tkabber-plugins/aniemoticons/msgs/ru.msg
===================================================================
--- trunk/tkabber-plugins/aniemoticons/msgs/ru.msg	                        (rev 0)
+++ trunk/tkabber-plugins/aniemoticons/msgs/ru.msg	2009-02-18 18:04:58 UTC (rev 1672)
@@ -0,0 +1,4 @@
+::msgcat::mcset ru "Whether the animated GIFs support plugin is loaded." \
+    "Загружено ли расширение обеспечивающее поддержку анимационных GIFов."
+
+# vim:ft=tcl:ts=8:sw=4:sts=4:noet


Property changes on: trunk/tkabber-plugins/aniemoticons/msgs/ru.msg
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Added: trunk/tkabber-plugins/aniemoticons/preload.tcl
===================================================================
--- trunk/tkabber-plugins/aniemoticons/preload.tcl	                        (rev 0)
+++ trunk/tkabber-plugins/aniemoticons/preload.tcl	2009-02-18 18:04:58 UTC (rev 1672)
@@ -0,0 +1,16 @@
+# $Id$
+
+package require msgcat
+
+namespace eval aniemoticons {
+    ::msgcat::mcload [file join [file dirname [info script]] msgs]
+
+    ::plugins::register debug \
+			-namespace [namespace current] \
+			-source [file join [file dirname [info script]] aniemoticons.tcl] \
+			-description [::msgcat::mc "Whether the animated GIFs support plugin is loaded."] \
+			-loadcommand [namespace code load] \
+			-unloadcommand [namespace code unload]
+}
+
+# vim:ts=8:sw=4:sts=4:noet


Property changes on: trunk/tkabber-plugins/aniemoticons/preload.tcl
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Modified: trunk/tkabber-plugins/attline/attline.tcl
===================================================================
--- trunk/tkabber-plugins/attline/attline.tcl	2009-02-18 12:32:48 UTC (rev 1671)
+++ trunk/tkabber-plugins/attline/attline.tcl	2009-02-18 18:04:58 UTC (rev 1672)
@@ -4,8 +4,6 @@
 # Written by Konstantin Khomoutov <flatworm at users.sourceforge.net>
 # See license.terms for the terms of distribution.
 
-package require msgcat
-
 option add *Chat.attentionLineHeight        1     widgetDefault
 option add *Chat.attentionLineColor         black widgetDefault
 option add *Chat.attentionLinePadX          5     widgetDefault
@@ -22,8 +20,6 @@
 	lset args 0 [uplevel 1 namespace current]::[lindex $args 0]
     }
 
-    ::msgcat::mcload [file join [file dirname [info script]] msgs]
-
     custom::defgroup Plugins [::msgcat::mc "Plugins options."] -group Tkabber
 
     custom::defgroup {Attention Line} \
@@ -45,20 +41,45 @@
 		       from its chat window."] \
 	-group {Attention Line} \
 	-type boolean
+}
 
+proc attline::load {} {
     hook::add open_chat_post_hook [mycmd setup_chat_win]
     # must perform after the hook from 'log on open' plugin:
     hook::add open_chat_post_hook [mycmd draw_chat_history_separator] 101
-
     hook::add close_chat_post_hook [mycmd cleanup]
-
     # must perform earlier than drawing of timestamp:
     hook::add draw_message_hook [mycmd on_draw_message] 5.5
-
     hook::add got_focus_hook  [mycmd on_focused]
     hook::add lost_focus_hook [mycmd on_lost_focus]
+
+    foreach chatid [chat::opened] {
+	setup_chat_win $chatid ""
+    }
 }
 
+proc attline::unload {} {
+    variable state
+
+    hook::remove open_chat_post_hook [mycmd setup_chat_win]
+    hook::remove open_chat_post_hook [mycmd draw_chat_history_separator] 101
+    hook::remove close_chat_post_hook [mycmd cleanup]
+    hook::remove draw_message_hook [mycmd on_draw_message] 5.5
+    hook::remove got_focus_hook  [mycmd on_focused]
+    hook::remove lost_focus_hook [mycmd on_lost_focus]
+
+    foreach chatid [chat::opened] {
+	set cw [chat::chat_win $chatid]
+	set iw [chat::input_win $chatid]
+	bind $iw <<ChatSeeAttentionLine>> {}
+	# TODO: Unbind configure event?
+	delete_attline $cw
+	cleanup $chatid
+    }
+
+    catch {unset state}
+}
+
 proc attline::attline {cw} {
     return $cw.attention_line
 }
@@ -96,7 +117,7 @@
     unread $cw false
     atbottom $cw false
 
-    bind $iw <<ChatSeeAttentionLine>> +[mycmd see_attention_line $cw]
+    bind $iw <<ChatSeeAttentionLine>> [mycmd see_attention_line $cw]
 
     return
 }

Modified: trunk/tkabber-plugins/attline/msgs/ru.msg
===================================================================
--- trunk/tkabber-plugins/attline/msgs/ru.msg	2009-02-18 12:32:48 UTC (rev 1671)
+++ trunk/tkabber-plugins/attline/msgs/ru.msg	2009-02-18 18:04:58 UTC (rev 1672)
@@ -11,3 +11,7 @@
      active chat window are considered read and the attention line is considered expired." \
     "Время (в миллисекундах) по истечении которого сообщения в активном окне разговора\
      считаются прочитанными, и разделительная линия считается недействующей."
+::msgcat::mcset ru "Whether the Attention Line plugin is loaded." \
+    "Загружено ли расширение Attention Line."
+
+# vim:ft=tcl:ts=8:sw=4:sts=4:noet

Added: trunk/tkabber-plugins/attline/preload.tcl
===================================================================
--- trunk/tkabber-plugins/attline/preload.tcl	                        (rev 0)
+++ trunk/tkabber-plugins/attline/preload.tcl	2009-02-18 18:04:58 UTC (rev 1672)
@@ -0,0 +1,16 @@
+# $Id$
+
+package require msgcat
+
+namespace eval attline {
+    ::msgcat::mcload [file join [file dirname [info script]] msgs]
+
+    ::plugins::register attline \
+			-namespace [namespace current] \
+			-source [file join [file dirname [info script]] attline.tcl] \
+			-description [::msgcat::mc "Whether the Attention Line plugin is loaded."] \
+			-loadcommand [namespace code load] \
+			-unloadcommand [namespace code unload]
+}
+
+# vim:ts=8:sw=4:sts=4:noet


Property changes on: trunk/tkabber-plugins/attline/preload.tcl
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native



More information about the Tkabber-dev mailing list