[Tkabber-dev] r412 - in trunk/plugins: . mouse-on-roster mouse-on-roster/msgs

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Oct 1 04:15:03 MSD 2010


Author: Rejjin
Date: 2010-10-01 04:15:03 +0400 (Fri, 01 Oct 2010)
New Revision: 412

Added:
   trunk/plugins/mouse-on-roster/
   trunk/plugins/mouse-on-roster/AUTHORS
   trunk/plugins/mouse-on-roster/README
   trunk/plugins/mouse-on-roster/VERSION
   trunk/plugins/mouse-on-roster/mouse-on-roster.tcl
   trunk/plugins/mouse-on-roster/msgs/
   trunk/plugins/mouse-on-roster/msgs/ru.msg
Log:
Mouse-on-roster plugin showing and hidding a roster window.

Added: trunk/plugins/mouse-on-roster/AUTHORS
===================================================================
--- trunk/plugins/mouse-on-roster/AUTHORS	                        (rev 0)
+++ trunk/plugins/mouse-on-roster/AUTHORS	2010-10-01 00:15:03 UTC (rev 412)
@@ -0,0 +1 @@
+Renji <webrenji at gmail.com>
\ No newline at end of file

Added: trunk/plugins/mouse-on-roster/README
===================================================================
--- trunk/plugins/mouse-on-roster/README	                        (rev 0)
+++ trunk/plugins/mouse-on-roster/README	2010-10-01 00:15:03 UTC (rev 412)
@@ -0,0 +1,9 @@
+Mouse-on-roster tkabber plugin.
+
+Usage.
+	Mouse-on-roster plugin showing and hidding a roster window.
+
+Installing.
+	Just place the plugin's directory to /your/config/dir/plugins
+	directory so that to get a structure like this:
+	/your/config/dir/plugins/mouse-on-roster/mouse-on-roster.tcl
\ No newline at end of file

Added: trunk/plugins/mouse-on-roster/VERSION
===================================================================
--- trunk/plugins/mouse-on-roster/VERSION	                        (rev 0)
+++ trunk/plugins/mouse-on-roster/VERSION	2010-10-01 00:15:03 UTC (rev 412)
@@ -0,0 +1,2 @@
+2010-09-30
+varsion 0.1
\ No newline at end of file

Added: trunk/plugins/mouse-on-roster/mouse-on-roster.tcl
===================================================================
--- trunk/plugins/mouse-on-roster/mouse-on-roster.tcl	                        (rev 0)
+++ trunk/plugins/mouse-on-roster/mouse-on-roster.tcl	2010-10-01 00:15:03 UTC (rev 412)
@@ -0,0 +1,144 @@
+# Mouse-on-roster tkabber plugin.
+# Renji <xmpp:rejjin at jabber.dk>
+
+namespace eval mouse-on-roster {
+	
+	package require msgcat
+	::msgcat::mcload [file join [file dirname [info script]] msgs]
+	
+	variable options
+	custom::defgroup Plugins [::msgcat::mc "Plugins options."] -group Tkabber	
+	custom::defgroup Mouse-on-roster [::msgcat::mc "Mouse-on-roster plugin options"] -group Plugins	
+	custom::defvar options(enabled) 1 [::msgcat::mc "Enable roster auto hide."] -group Mouse-on-roster -type boolean
+	custom::defvar options(width_showed) 150 [::msgcat::mc "Width of showed roster."] -group Mouse-on-roster -type integer
+	custom::defvar options(width_hided) 5 [::msgcat::mc "Width of hided roster."] -group Mouse-on-roster -type integer
+	custom::defvar options(sleep) 1000 [::msgcat::mc "Sleep of roster hider."] -group Mouse-on-roster -type integer
+	
+	set options(mouse_on_roster) 0
+	set options(showed) 1
+	
+	trace add variable options(enabled) write \
+	[namespace current]::change_state
+	
+	trace add variable options(width_hided) write \
+	[namespace current]::change_width_hided
+
+	trace add variable options(width_showed) write \
+	[namespace current]::change_width_showed
+	
+	if {![::plugins::is_registered mouse-on-roster]} {
+		::plugins::register mouse-on-roster \
+				-namespace [namespace current] \
+				-source [info script] \
+				-description [::msgcat::mc "Whether the Mouse-on-roster plugin is loaded"] \
+				-loadcommand [namespace code load] \
+				-unloadcommand [namespace code unload]
+		return
+	}
+	
+	hook::add finload_hook [namespace current]::handle
+}
+
+proc mouse-on-roster::load {} {
+	variable options
+	
+	bind .roster <Any-Enter> [namespace current]::show_roster
+	bind .roster <Any-Leave> [namespace current]::hide_roster	
+	
+	if {$options(enabled) == 1} {
+		change_width $options(width_hided)
+	}
+}
+
+proc mouse-on-roster::unload {} {
+	variable options
+	
+	bind .roster <Any-Enter> {}
+	bind .roster <Any-Leave> {}
+	
+	change_width $options(width_showed)
+}
+
+
+proc mouse-on-roster::handle { } {
+	variable options
+	
+	bind .roster <Any-Enter> [namespace current]::show_roster
+	bind .roster <Any-Leave> [namespace current]::hide_roster	
+	
+	if {$options(enabled) == 1} {
+		hide_roster
+	}
+}
+
+proc mouse-on-roster::change_width_hided { who work value } {
+	variable options
+	if {$options(showed) == 0} {
+		change_width $options(width_hided)
+	}
+}
+
+proc mouse-on-roster::change_width_showed { who work value } {
+	variable options
+	if {$options(showed) == 1} {
+		change_width $options(width_showed)
+	}
+}
+
+proc mouse-on-roster::change_state { who work value } { 
+	variable options
+	
+	if {$options(enabled) == 0} {
+		change_width $options(width_showed)
+	} else {
+		change_width $options(width_hided)
+	}
+}
+
+proc mouse-on-roster::show_roster { } {
+	variable options
+	
+	if {$options(enabled) == 0} {
+		return
+	}
+	
+	set options(mouse_on_roster) 1
+	set options(showed) 1
+	
+	after idle [list [namespace current]::change_width $options(width_showed)]
+}
+
+proc mouse-on-roster::hide_roster { } {
+	variable options
+
+	if {$options(enabled) == 0} {
+		return
+	}
+	
+	set options(mouse_on_roster) 0
+	
+	after $options(sleep) [namespace current]::_hide
+}
+
+proc mouse-on-roster::_hide { } {
+	variable options 
+	
+	if {$options(mouse_on_roster) == 1} {
+		return
+	}
+	
+	change_width $options(width_hided)
+	set options(showed) 0
+}
+
+
+proc mouse-on-roster::change_width { x } {
+	.mainframe.frame.pw.f0 configure -width $x
+}
+
+
+
+
+
+
+

Added: trunk/plugins/mouse-on-roster/msgs/ru.msg
===================================================================
--- trunk/plugins/mouse-on-roster/msgs/ru.msg	                        (rev 0)
+++ trunk/plugins/mouse-on-roster/msgs/ru.msg	2010-10-01 00:15:03 UTC (rev 412)
@@ -0,0 +1,6 @@
+::msgcat::mcset ru "Mouse-on-roster plugin options" "Настройки плагина Mouse-on-roster"
+::msgcat::mcset ru "Enable roster auto hide." "Активировать автоскрытие ростера."
+::msgcat::mcset ru "Width of showed roster." "Ширина открытого ростера."
+::msgcat::mcset ru "Width of hided roster." "Ширина скрытого ростера."
+::msgcat::mcset ru "Sleep of roster hider." "Задержка перед скрытием ростера."
+::msgcat::mcset ru "Whether the Mouse-on-roster plugin is loaded" "Загружает и выгружает плагин Mouse-on-roster"
\ No newline at end of file



More information about the Tkabber-dev mailing list