[Tkabber-dev] r462 - in trunk/plugins/winup: . fly msgs resize

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sat Jan 22 06:31:09 MSK 2011


Author: Rejjin
Date: 2011-01-22 06:31:09 +0300 (Sat, 22 Jan 2011)
New Revision: 462

Added:
   trunk/plugins/winup/AUTHORS
   trunk/plugins/winup/README
   trunk/plugins/winup/README_ru
   trunk/plugins/winup/TODO
   trunk/plugins/winup/fly/
   trunk/plugins/winup/fly/fly.tcl
   trunk/plugins/winup/fly/pkgIndex.tcl
   trunk/plugins/winup/resize/
   trunk/plugins/winup/resize/pkgIndex.tcl
   trunk/plugins/winup/resize/resize.tcl
Modified:
   trunk/plugins/winup/msgs/ru.msg
   trunk/plugins/winup/winup.tcl
Log:
Last rewrited version of floating (animated) window, for notify a new incoming messages. 
Please, see README_ru for detals. 

Added: trunk/plugins/winup/AUTHORS
===================================================================
--- trunk/plugins/winup/AUTHORS	                        (rev 0)
+++ trunk/plugins/winup/AUTHORS	2011-01-22 03:31:09 UTC (rev 462)
@@ -0,0 +1,3 @@
+Writted by Rejjin 
+xmpp: 	<rejjin at jabber.ru>
+e-mail:	<webrenji at gmail.com>
\ No newline at end of file

Added: trunk/plugins/winup/README
===================================================================
--- trunk/plugins/winup/README	                        (rev 0)
+++ trunk/plugins/winup/README	2011-01-22 03:31:09 UTC (rev 462)
@@ -0,0 +1 @@
+...
\ No newline at end of file

Added: trunk/plugins/winup/README_ru
===================================================================
--- trunk/plugins/winup/README_ru	                        (rev 0)
+++ trunk/plugins/winup/README_ru	2011-01-22 03:31:09 UTC (rev 462)
@@ -0,0 +1,234 @@
+Winup - плагин для Tkabber.
+
+[Введение]
+   Winup позволяет своевременно просматривать текст сообщений. 
+   Это реализовано в виде всплывающего окна, которое содержит 
+   описание сообщения (было послано из комнаты или от контакта),
+   статус собеседника и текст его сообщения. При нажатии 
+   левой кнопки мыши на окне уведомления автоматически открывается 
+   вкладка Tkabber'а с контактом, который был указан в окне 
+   уведомления. На системной панеле есть кнопка для быстрого изминения 
+   состояния плагина. Если на неё нажать - состояние плагина 
+   станет неактивным, и всплывающее окно не будет отображаться. 
+   Повторное нажатие производит обратное действие. Плагин можно 
+   гибко настроить под свой вкус. Например вы можете настроить 
+   так, чтобы окно уведомление плавно и медленно вылетало из 
+   левого верхнего угла окна, по прошествии 5 секнд быстро исчезало.
+
+[Установка]
+   Установка плагина производится в соответствии с документацией.
+   Структура содержимого winup должна оставаться преждней.   
+   
+[Настройки]
+   Плагин обладает довольно большим количиством настроек.
+   Они находятся в 'Tkabber' -> 'Customize' -> 
+   'Plugins' -> 'Winup'.
+   
+   <___Таблица___>
+   
+   Имя опции конфигурации			Стандартное значение
+   config(add_toolbar_button)		Да
+   config(-anchor)					Справа-снизу
+   config(-animate)					Сверху
+   config(-offsetx)					0
+   config(-offsety)					0
+   config(-keyframes)				1000 5000 500
+   config(max_string_length)		250
+   config(show_avatars)				Да
+   config(save_avatars)				Да
+   config(photo_width)				50
+   config(photo_height)				50
+   config(alpha)					90
+   config(ignore_status)			DND
+   config(unique_jids)			   	""
+   config(ignore_jids)				""
+   config(bgcolor)					#555555
+   config(fgcolor)					#cccccc
+   config(nick_font)				Tahoma 8
+   config(status_font)				Tahoma 7
+   config(message_font)				Tahoma 8
+   config(window_minimal_size)		285 120
+   config(auto_hide)				Да
+   
+   <___Описание___>
+   
+   
+---config(add_toolbar_button)--------------:
+											Добавляет иконку на
+   системную панель, для быстрого доступу к активации\деактивации 
+   состояния плагина. От неё зависит, будет ли всплывать окно
+   нотификации при входящем сообщении.
+   
+   
+---config(-anchor)-------------------------:
+											Позиция окна уведомления 
+   относительно экрана. Может принимать любое значение из {Сверху 
+   Сверху-Справа Справа Справа-Снизу Снизу Снизу-Слева Слева 
+   Слева-Сверху Центр}
+   
+   
+---config(-animate)------------------------:
+											Конечная/начальная точка 
+   анимации окна. Например, если установить значение Справа, а 
+   config(-anchor) - Справа-Снизу, то окно "вылетит" из правой-нижней 
+   части экрана влево
+   
+   
+---config(-offsetx)------------------------:
+											Сдвиг окна по оси X. 
+   Необходим для того, чтобы вы могу вывести окно уведомления, 
+   например, над панелью задач. Так же можно установить значение, 
+   равное ширине экрана, тогда окно "пролетит" весь экран, и 
+   остановится у дальнего края.
+   
+   
+---config(-offsety)------------------------:
+											Аналогично предыдущему, 
+   но по оси Y.
+   
+---config(-keyframes)----------------------:
+											Ключи окна. С помощью 
+   них можно установить задержку окна после появления, скорость 
+   появления, скорость скрытия. 
+   -- Первое значение - скорость первого "полёта" окна. Чем выше 
+   значение - тем медленнее.
+   -- Второе значение - время задержки перед скрытием. Чем ниже 
+   значение, тем быстрее окно скроется.
+   -- Третье значение - скорость последнего "полёта" окна. Чем 
+   выше значение - тем медленнее.
+   
+   
+---config(max_string_length)---------------:
+											Максимальная длинна 
+   сообщения, которое будет видно в окне уведомления. Значение 
+   указывается в количествах символов текста.
+   
+   
+---config(show_avatars)--------------------:
+											Показывать фото собеседника. 
+   Изображение будет показано лишь в том случае, если ранее была 
+   просмотрена личная информация собеседника.
+   
+   
+---config(save_avatars)--------------------:
+											Определяет, сохранять 
+   ли уменьшенные фото собеседников локально, и при последующем 
+   запуске Tkabber - загружать.
+   
+   
+---config(photo_width)---------------------:
+											Ширина фото собеседника 
+   после уменьшения.
+   
+   
+---config(photo_height)--------------------:
+											Высота фото собеседника 
+   после уменьшения. 
+   
+   
+---config(alpha)---------------------------:
+											Прозрачность окна 
+   уведомления (если ваша реализация Tk не поддерживает, то 
+   опция игнорируется).
+   
+   
+---config(ignore_status)-------------------:
+											Деактивировать плагин 
+   если ваш статус соответствует указанному.
+   
+   
+---config(unique_jids)---------------------:
+											Список уникальных JID'ов, 
+   которые нельзя игнорировать, если деактивирован плагин, или ваш статус,
+   включивший нективность плагина, соответствует config(ignore_status).
+   Адрес должен содержать и ресурс собеседника, для простоты его можно 
+   заменить на '/*'. Можно использовать glob-выражения (regexp). Пример:
+   rejjin at jabber.* *@jabber.myserver.net/* vasya at jabber.ru/QIP
+   
+   
+---config(ignore_jids)---------------------:
+											Список JID'ов, которые будут
+   игнорироваться в любом случае. Адрес должен содержать и ресурс собеседника,
+   для простоты его можно заменить на '/*'. Можно использовать glob-выражения 
+   (regexp). Пример:
+   rejjin at jabber.* *@jabber.myserver.net/* vasya at jabber.ru/QIP
+   
+   
+---config(bgcolor)-------------------------:
+---config(fgcolor)-------------------------:
+											Цвета для окна уведомления.
+					
+					
+---config(bgcolor)-------------------------:
+											Цвет фона. 
+											
+											
+---config(fgcolor)-------------------------:
+											Цвет текста.
+   
+   
+---config(nick_font)-----------------------: 
+---config(status_font)---------------------:
+---config(message_font)--------------------:
+											Шрифты для соответствующих зон.
+   
+   
+---config(window_minimal_size)-------------:
+											Минимальный размер окна уведомления.
+
+											
+---config(auto_hide)-----------------------:
+											Автоматически скрывать окно 
+   нотификации. Если опция будет равна логическому значению 'ДА', 
+   то окно будет ожидать команды закрытия (правая клавиша мыши).
+   
+   
+[Использование]
+   После загрузки плагина на системной панеле появляется иконка
+   статуса плагина. Если изображение полноцветное, то это состояние
+   плагина 'активно', если чёрно-белое - то неактивно. Состояние плагина
+   означает, будет ли появляться окно уведомления при поступлении нового 
+   сообщения. Если плагин активен, и вам пришло сообщение, то, при стандарных 
+   настройках, из нижней части вверх "вылетит" окно, в котором будут перечислены:
+   имя отправителя, статус, текст сообщения|тема конференции. При нажатии на окно 
+   запускается обработчик, которые определяет какая клавиша мыши была нажата.
+   Если вы нажали на левую кнопку, то открывается разговор с указанным
+   контактом в Tkabber. Если вы нажали на правую кнопку, то окно
+   нотификации исчезает. При этом общее состояние плагина остаётся
+   преждним.
+   
+[Примеры]
+   1) Окно вылетает из левой-верхней части экрана вниз. Ждёт 3 секунды и быстро 
+   исчезает: 
+   config(-anchor) 'Слева-Сверху'
+   config(-animate) 'Вниз'
+   config(-keyframes) 1000 3000 200
+   
+   2) Окно не использует механизм движения:
+   config(-keyframes) 0 3000 200
+   
+   3) "Скоростное окно"
+   config(-keyframes) 200 1000 200
+   
+   4) Окно по-центру. Ожидает 10 секунд.
+   config(-anchor) 'Центр'
+   config(-keyframes) 0 10000 200
+
+[BUGS]
+   Из-за платформо-зависимого фактора реализации Tk на некоторых ОС замечены 
+   ошибки, связанные с механизмом движения окна. Если окно во время "полёта"
+   остаётся чёрным, и не содержит ни каких эоементов, то поэксперементируйте 
+   с настройками. В крайнем случае, в соответствии с секцией [Примеры], можно 
+   убрать механизм движения, тогда окно будет статично появлятся в указанной
+   точке экрана.
+   
+[TODO]
+   1) Исправить глюки механизма движения.
+   2) Добавить меню быстрого ответа в окно.
+   3) Пометить сообщения как "прочитанные".
+   4) Переписать механизм уменьшения фото на C (с целью увеличения скорости).
+   
+[Автор]
+   Rejjin 
+   xmpp: 	<rejjin at jabber.ru>
+   e-mail:	<webrenji at gmail.com>
\ No newline at end of file

Added: trunk/plugins/winup/TODO
===================================================================
Added: trunk/plugins/winup/fly/fly.tcl
===================================================================
--- trunk/plugins/winup/fly/fly.tcl	                        (rev 0)
+++ trunk/plugins/winup/fly/fly.tcl	2011-01-22 03:31:09 UTC (rev 462)
@@ -0,0 +1,321 @@
+# fly.tcl - Animated toplevel.
+# Writted by Rejjin 
+# xmpp: 	<rejjin at jabber.ru>
+# e-mail:	<webrenji at gmail.com>
+
+namespace eval ::fly {
+variable fly_options 
+
+	array set fly_options {
+		-anchor se
+		-animate up
+		-offsetx 0
+		-offsety 0
+		-keyframes {1000 3000 500}
+		-animation 5
+		-withdraw 1
+		-manual 0
+	}
+
+	package provide fly 0.1
+	
+	namespace export hide show state animate init
+}
+
+proc ::fly::init {top args} {
+variable fly_options
+
+	if {![winfo exist $top]} {
+	return -code error "bad window path name \"$top\""
+	}
+	
+	foreach option [array names fly_options -*] {
+	set t_options($option) $fly_options($option)
+	}
+	
+	foreach {option value} $args {
+		switch -- $option {
+		-anchor {set t_options(-anchor) $value}
+		-animate {set t_options(-animate) $value}
+		-offsetx {set t_options(-offsetx) $value}
+		-offsety {set t_options(-offsety) $value}
+		-keyframes {set t_options(-keyframes) $value}
+		-animation {set t_options(-animation) $value}
+		-withdraw {set t_options(-withdraw) $value}
+		-manual {set t_options(-manual) $value}
+		default {return -code error "bad option name $option"}
+		}
+	}
+	
+	set varname [namespace current]::fly_$top
+	namespace upvar [namespace current] $varname _fly
+
+	set _fly(top) $top
+	set _fly(state) 0
+	set _fly(timer) {}
+	
+	foreach option [array names t_options] {
+	set _fly($option) $t_options($option)
+	}
+	
+	if {[string is true $_fly(-withdraw)]} {
+	wm withdraw $top
+	}
+	
+	return $top
+}
+
+proc ::fly::hide {top {atonce 0}} {
+	set varname [namespace current]::fly_$top
+	namespace upvar [namespace current] $varname _fly
+	
+	if {![string equal $_fly(timer) {}]} {
+	    after cancel $_fly(timer)
+	    set _fly(timer) {}
+	}
+	
+	if {[string is true $atonce]} {
+		set _fly(state) 0
+	    if {[string is true $_fly(-withdraw)]} {
+		wm withdraw $_fly(top)
+	    } else {init_position $top}
+	} elseif {$_fly(state) != 0} {
+		set _fly(state) 1
+	    set _fly(startanim) [clock clicks -milliseconds]
+	    animate $top 0 
+	}
+}
+
+proc ::fly::show {top} {
+	set varname [namespace current]::fly_$top
+	namespace upvar [namespace current] $varname _fly
+	
+	if {$_fly(state) != 0} {hide $top 1}
+	
+	if {[string is true $_fly(-manual)]} {
+	animate $top 1
+	} else {animate $top}
+}
+
+proc ::fly::validate {top} {
+	set varname [namespace current]::fly_$top
+	namespace upvar [namespace current] $varname _fly
+	
+	set anchor [string tolower $_fly(-anchor)]
+	
+	foreach {an pos} {n down e left s up w right} {
+		if {[string first $an $anchor]} {
+		lappend valid $pos
+		}
+	}
+	
+	set animate [string tolower $_fly(-animate)]
+	
+	if {[lsearch $animate $valid] >= 0} {
+	return 1
+	}
+	
+	return 0
+}
+
+proc ::fly::state {top} {
+	set varname [namespace current]::fly_$top
+	namespace upvar [namespace current] $varname _fly
+	
+	return $_fly(state)
+}
+
+
+proc ::fly::init_position {top} {
+	set varname [namespace current]::fly_$top
+	namespace upvar [namespace current] $varname _fly
+	
+	if {[validate $top]} {
+	    set _fly(timer) {}
+		return -code error "$_fly(-anchor) and \
+			$_fly(-animate) are incompatible"
+	}
+	
+	set sw [winfo screenwidth $top]
+	set sh [winfo screenheight $top]
+	
+	set csx [expr {$sw / 2}] 
+	set csy [expr {$sh / 2}]
+	
+	set w [winfo width $top]
+	set h [winfo height $top]
+	
+	set cx [expr {$w / 2}]
+	set cy [expr {$h / 2}]
+	
+	switch [string tolower $_fly(-anchor)] {
+	    n {
+			set _fly(startx) [expr $csx - $cx + $_fly(-offsetx)]
+			set _fly(starty) [expr -$h + $_fly(-offsety)]
+			set _fly(endx) $_fly(startx)
+			set _fly(endy) $_fly(-offsety)
+	    }
+	    ne {
+			if {[string equal [string tolower $_fly(-animate)] down]} {
+				set _fly(startx) [expr $sw - $w + $_fly(-offsetx)]
+				set _fly(starty) [expr -$h + $_fly(-offsety)]
+				set _fly(endx) $_fly(startx)
+				set _fly(endy) $_fly(-offsety)
+			} else {
+				set _fly(startx) [expr $sw + $_fly(-offsetx)]
+				set _fly(starty) [expr $_fly(-offsety)]
+				set _fly(endx) [expr $sw - $w + $_fly(-offsetx)]
+				set _fly(endy) $_fly(starty)
+			}
+	    }
+	    e {
+			set _fly(startx) [expr $sw + $_fly(-offsetx)]
+			set _fly(starty) [expr $csy - $cy + $_fly(-offsety)]
+			set _fly(endx) [expr $sw - $w + $_fly(-offsetx)]
+			set _fly(endy) $_fly(starty)
+	    }
+	    se {
+			if {[string equal [string tolower $_fly(-animate)] left]} {
+				set _fly(startx) [expr $sw + $_fly(-offsetx)]
+				set _fly(starty) [expr $sh - $h + $_fly(-offsety)]
+				set _fly(endx) [expr $sw - $w + $_fly(-offsetx)]
+				set _fly(endy) $_fly(starty)
+			} else {
+				set _fly(startx) [expr $sw - $w + $_fly(-offsetx)]
+				set _fly(starty) [expr $sh + $_fly(-offsety)]
+				set _fly(endx) $_fly(startx)
+				set _fly(endy) [expr $sh - $h + $_fly(-offsety)]
+			}
+	    }
+	    s {
+			set _fly(startx) [expr $csx - $cx + $_fly(-offsetx)]
+			set _fly(starty) [expr $sh + $_fly(-offsety)]
+			set _fly(endx) $_fly(startx)
+			set _fly(endy) [expr $sh - $h + $_fly(-offsety)]
+	    }
+	    sw {
+			if {[string equal [string tolower $_fly(-animate)] up]} {
+				set _fly(startx) [expr $_fly(-offsetx)]
+				set _fly(starty) [expr $sh + $_fly(-offsety)]
+				set _fly(endx) $_fly(startx)
+				set _fly(endy) [expr $sh - $h + $_fly(-offsety)]
+			} else {
+				set _fly(startx) [expr -$w + $_fly(-offsetx)]
+				set _fly(starty) [expr $sh - $cy + $_fly(-offsety)]
+				set _fly(endx) $_fly(-offsetx)
+				set _fly(endy) $_fly(starty)
+			}
+	    }
+	    w {
+			set _fly(startx) [expr -$w + $_fly(-offsetx)]
+			set _fly(starty) [expr $csy - $cy + $_fly(-offsety)]
+			set _fly(endx) $_fly(-offsetx)
+			set _fly(endy) $_fly(starty)
+	    }
+	    nw {
+			if {[string equal [string tolower $_fly(-animate)] right]} {
+				set _fly(startx) [expr -$w + $_fly(-offsetx)]
+				set _fly(starty) [expr $_fly(-offsety)]
+				set _fly(endx) $_fly(-offsetx)
+				set _fly(endy) $_fly(starty)
+			} else {
+				set _fly(startx) [expr $_fly(-offsetx)]
+				set _fly(starty) [expr -$h + $_fly(-offsety)]
+				set _fly(endx) $_fly(startx)
+				set _fly(endy) $_fly(-offsety)
+			}
+	    }
+	}
+	
+	wm deiconify $_fly(top)
+	wm geometry $_fly(top) +$_fly(startx)+$_fly(starty)
+
+	update idletasks
+}
+
+proc ::fly::animate {top {stopat ""}} {
+	set varname [namespace current]::fly_$top
+	namespace upvar [namespace current] $varname _fly
+	
+	if {[validate $top]} {
+	    set _fly(timer) {}
+		return -code error "$_fly(-anchor) and \
+			$_fly(-animate) are incompatible"
+	}
+	
+	switch $_fly(state) {
+	    0 {
+			wm deiconify $top
+			update idletasks
+			init_position $top
+			set _fly(startanim) [clock clicks -milliseconds]
+			set _fly(state) 2
+	    }
+	    2 {
+			set now [clock clicks -milliseconds]
+			set elapsed [expr {$now - $_fly(startanim)}]
+			set sp [lindex $_fly(-keyframes) 0]
+			
+			if { $elapsed >= $sp } {
+				set x $_fly(endx)
+				set y $_fly(endy)
+				set _fly(startanim) $now
+				set _fly(state) 1
+			} else {
+				set x [expr {int($elapsed * (double($_fly(endx) - $_fly(startx))/$sp)) + $_fly(startx)}]
+				set y [expr {int($elapsed * (double($_fly(endy) - $_fly(starty))/$sp)) + $_fly(starty)}]
+			}
+			
+			wm deiconify $_fly(top)
+			wm geometry $_fly(top) +$x+$y
+	    }
+	    1 {
+			set now [clock clicks -milliseconds]
+			set elapsed [expr {$now - $_fly(startanim)}]
+			set sp [lindex $_fly(-keyframes) 1]
+			if {[string equal $sp ""]} { 
+				set sp [lindex $_fly(-keyframes) 0] 
+			}
+			if { $elapsed >= $sp } {
+				set _fly(startanim) $now
+				set _fly(state) 3
+			}
+			set x $_fly(endx)
+			set y $_fly(endy)
+			wm deiconify $_fly(top)
+			wm geometry $_fly(top) +$x+$y
+	    }
+	    3 {
+			set now [clock clicks -milliseconds]
+			set elapsed [expr {$now - $_fly(startanim)}]
+			set sp [lindex $_fly(-keyframes) 2]
+			if {[string equal $sp ""]} { 
+				set sp [lindex $_fly(-keyframes) 1] 
+			}
+			if {[string equal $sp ""]} {
+				set sp [lindex $_fly(-keyframes) 0] 
+			}
+			if { $elapsed >= $sp } {
+				if { [string is true $_fly(-withdraw)] } {
+					wm withdraw $_fly(top)
+				}
+				set _fly(state) 0
+			} else {
+				set x [expr {int($elapsed * (double($_fly(startx) - $_fly(endx))/$sp)) + $_fly(endx)}]
+				set y [expr {int($elapsed * (double($_fly(starty) - $_fly(endy))/$sp)) + $_fly(endy)}]
+				wm deiconify $_fly(top)
+				wm geometry $_fly(top) +$x+$y
+			}
+	    }
+	}
+
+	if { $_fly(state) == 0 } {
+	set _fly(timer) {}
+	} else {
+	    if {$_fly(state) == $stopat} {
+			set _fly(timer) {}
+	    } else {
+			set _fly(timer) [after $_fly(-animation) [namespace current]::animate $top $stopat]
+	    }
+	}
+}
\ No newline at end of file

Added: trunk/plugins/winup/fly/pkgIndex.tcl
===================================================================
--- trunk/plugins/winup/fly/pkgIndex.tcl	                        (rev 0)
+++ trunk/plugins/winup/fly/pkgIndex.tcl	2011-01-22 03:31:09 UTC (rev 462)
@@ -0,0 +1,2 @@
+if ![package vsatisfies [package provide Tcl] 8.4] return
+package ifneeded fly 0.1 [list source [file join $dir fly.tcl]]
\ No newline at end of file

Modified: trunk/plugins/winup/msgs/ru.msg
===================================================================
--- trunk/plugins/winup/msgs/ru.msg	2011-01-21 16:01:44 UTC (rev 461)
+++ trunk/plugins/winup/msgs/ru.msg	2011-01-22 03:31:09 UTC (rev 462)
@@ -1,29 +1,42 @@
-::msgcat::mcset ru "Winup options" "Winup настройки"
-::msgcat::mcset ru "Add to main toolbar button, for fast change state" "Добавляет кнопку на тулбар, для быстрой смены состояния плагина"
-::msgcat::mcset ru "Sleep of notify" "Задержка окна напоминания"
-::msgcat::mcset ru "Length of string for show in notify" "Максимальное количество символов для окна уведомления"
-::msgcat::mcset ru "Winup status options" "Winup настройки статуса"
-::msgcat::mcset ru "Use notifycation, if your status %s" "Включить плагин, если статус %s"
-::msgcat::mcset ru "Window themes" "Темы окна уведомления"
-::msgcat::mcset ru "Whether the Winup plugin is loaded" "Загружает/выгружает плагин Winup"
-::msgcat::mcset ru "Message from %s" "Сообщение от %s"
-::msgcat::mcset ru "Disable Winup" "отключить Winup"
-::msgcat::mcset ru "Enable Winup" "Включить Winup"
-::msgcat::mcset ru "Standart window theme" "Standart window тема"
-::msgcat::mcset ru "Using alpha for window" "Использовать прозрачность для окна уведомления"
-::msgcat::mcset ru "Alpha scale" "Уровень прозрачности"
-::msgcat::mcset ru "Background color (top part of window)" "Цвет заднего плана (верхняя часть окна)"
-::msgcat::mcset ru "Foreground color (top part of window)" "Цвет переднего плана (верхняя часть окна)"
-::msgcat::mcset ru "Background color (bottom part of window)" "Цвет заднего плана (нижняя часть окна)"
-::msgcat::mcset ru "Foreground color (bottom part of window)" "Цвет переднего плана (нижняя часть окна)"
-::msgcat::mcset ru "Font of header" "Шрифт заголовка"
-::msgcat::mcset ru "Font of message" "Шрифт сообщения"
-::msgcat::mcset ru "Mouse-window theme" "Mouse-window тема"
-::msgcat::mcset ru "Move window with mouse" "Передвигать окно вместе с курсором мыши"
-::msgcat::mcset ru "Floatinglog theme" "Floatinglog тема"
-::msgcat::mcset ru "Window position" "Позиция окна"
-::msgcat::mcset ru "Status font" "Шрифт статуса"
-::msgcat::mcset ru "Window type" "Тип окна"
-::msgcat::mcset ru "Header of window" "Заголовок окна"
-::msgcat::mcset ru "Message" "Сообщение"
-::msgcat::mcset ru "Status" "Статус"
\ No newline at end of file
+::msgcat::mcset ru "Winup custom options." "Настройки для плагина Winup."
+::msgcat::mcset ru "Add toolbar button, for fast change state." "Добавить иконку на панель, для быстрого доступа к изминению состояния плагина."
+::msgcat::mcset ru "Position of window." "Позиция окна."
+::msgcat::mcset ru "Up" "Сверху"
+::msgcat::mcset ru "Up-right" "Сверху-справа"
+::msgcat::mcset ru "Right" "Справа"
+::msgcat::mcset ru "Right-down" "Справа-снизу"
+::msgcat::mcset ru "Down" "Снизу"
+::msgcat::mcset ru "Down-left" "Снизу-слева"
+::msgcat::mcset ru "Left" "Слева"
+::msgcat::mcset ru "Left-Up" "Слева-сверху"
+::msgcat::mcset ru "Center" "Центр"
+::msgcat::mcset ru "Animation of window." "Анимация окна."
+::msgcat::mcset ru "Shift of window (horisontal)." "Сдниг окна (вертикальный)."
+::msgcat::mcset ru "Shift of window (vertical)." "Сдвиг окна (горизонтальный)."
+::msgcat::mcset ru "Keys for window." "Ключи окна."
+::msgcat::mcset ru "Maximum number of characters in incoming message." "Минимальное количество символов входящего сообщения."
+::msgcat::mcset ru "Show avatars on notifycation window." "Показывать фото собеседника (если оно получено ранее)."
+::msgcat::mcset ru "Width of avatars in notify window." "Ширина фото собеседника."
+::msgcat::mcset ru "Height of avatars in notify window." "Высота фото собеседника."
+::msgcat::mcset ru "Window opacity (in percent)." "Прозрачность окна (в процентах)."
+::msgcat::mcset ru "Ignore message if your status..." "Игнорировать сообщения если ваш статус..."
+::msgcat::mcset ru "Available" "Доступен"
+::msgcat::mcset ru "Chat" "Свободен для разговора"
+::msgcat::mcset ru "Away" "Отошёл"
+::msgcat::mcset ru "Xa" "Отошёл давно"
+::msgcat::mcset ru "Dnd" "Не беспокоить"
+::msgcat::mcset ru "Background color." "Цвет заднего плана."
+::msgcat::mcset ru "Foreground color." "Цвет переднего плана."
+::msgcat::mcset ru "Nick font." "Шрифт имени собеседника."
+::msgcat::mcset ru "Status font." "Шрифт статуса собеседника."
+::msgcat::mcset ru "Message font." "Шрифт сообщения."
+::msgcat::mcset ru "Minimal size of notifycation window." "Минимальный размер окна."
+::msgcat::mcset ru "Whether the Winup plugin is loaded." "Определяет, загружен ли плагин Winup."
+::msgcat::mcset ru "Deactivate notifycation." "Деактивировать уведомления Winup."
+::msgcat::mcset ru "Activate notifycation." "Активировать уведомления Winup."
+::msgcat::mcset ru "Tkabber: message from groupchat" "Tkabber: сообщение из комнаты"
+::msgcat::mcset ru "Tkabber: message from chat" "Tkabber: сообщение от контакта"
+::msgcat::mcset ru "Auto hide notify window." "Автоматически скрывать уведомляющее окно."
+::msgcat::mcset ru "JIDs for always notyfy (with regexp)." "Список адресов, для которых не действуют игнорирования плагина (в списке можно использовать регулярные выражения)."
+::msgcat::mcset ru "Save and load avatars." "Хранить фото локально."
+::msgcat::mcset ru "You'r black list of jids (with regexp)." "Ваш чёрный список JID'ов (в списке можно использовать регулярные выражения)."
\ No newline at end of file


Property changes on: trunk/plugins/winup/msgs/ru.msg
___________________________________________________________________
Added: svn:eol-style
   + native

Added: trunk/plugins/winup/resize/pkgIndex.tcl
===================================================================
--- trunk/plugins/winup/resize/pkgIndex.tcl	                        (rev 0)
+++ trunk/plugins/winup/resize/pkgIndex.tcl	2011-01-22 03:31:09 UTC (rev 462)
@@ -0,0 +1,2 @@
+if ![package vsatisfies [package provide Tcl] 8.4] return
+package ifneeded resize 0.1 [list source [file join $dir resize.tcl]]
\ No newline at end of file

Added: trunk/plugins/winup/resize/resize.tcl
===================================================================
--- trunk/plugins/winup/resize/resize.tcl	                        (rev 0)
+++ trunk/plugins/winup/resize/resize.tcl	2011-01-22 03:31:09 UTC (rev 462)
@@ -0,0 +1,117 @@
+# resize.tcl - Resize images.
+# Writted by Rejjin 
+# xmpp: 	<rejjin at jabber.ru>
+# e-mail:	<webrenji at gmail.com>
+
+namespace eval ::resize {
+	package provide resize 0.1	
+	namespace export resize
+	
+	proc resize {src newx newy} {
+		 set mx [image width $src]
+		 set my [image height $src]
+		 
+		set dest [image create photo]
+	   
+		 $dest configure -width $newx -height $newy
+
+		 if { $newx % $mx == 0 && $newy % $my == 0} {
+			 set ix [expr {$newx / $mx}]
+			 set iy [expr {$newy / $my}]
+			 $dest copy $src -zoom $ix $iy
+			 return $dest
+		 }
+
+		 set ny 0; set ytot $my
+		 for {set y 0} {$y < $my} {incr y} {
+			 foreach {pr pg pb} [$src get 0 $y] {break}
+			 
+			 set row {}; set thisrow {}
+			 set nx 0; set xtot $mx
+			 
+			 for {set x 1} {$x < $mx} {incr x} {
+				 while { $xtot <= $newx } {
+					 lappend row [format "#%02x%02x%02x" $pr $pg $pb]
+					 lappend thisrow $pr $pg $pb
+					 incr xtot $mx; incr nx
+					 update idletasks
+				 }
+
+				 foreach {r g b} [$src get $x $y] {break}
+
+				 set xtot [expr {$xtot - $newx}]; set rn $xtot; set rp [expr {$mx - $xtot}]
+				 set xr 0; set xg 0; set xb 0
+
+				 while { $xtot > $newx } {
+					 incr xr $r; incr xg $g; incr xb $b
+					 set xtot [expr {$xtot - $newx}]; incr x
+					 foreach {r g b} [$src get $x $y] {break}
+					 update idletasks
+				 }
+
+				 set tr [expr {int( ($rn*$r + $xr + $rp*$pr) / $mx)}]
+				 set tg [expr {int( ($rn*$g + $xg + $rp*$pg) / $mx)}]
+				 set tb [expr {int( ($rn*$b + $xb + $rp*$pb) / $mx)}]
+
+				 if {$tr > 255} {set tr 255}
+				 if {$tg > 255} {set tg 255}
+				 if {$tb > 255} {set tb 255}
+
+				 lappend row [format "#%02x%02x%02x" $tr $tg $tb]
+				 lappend thisrow $tr $tg $tb
+				 incr xtot $mx; incr nx
+				 set pr $r; set pg $g; set pb $b
+				 update idletasks
+			 }
+
+			 while { $nx < $newx } {
+				 lappend row [format "#%02x%02x%02x" $r $g $b]
+				 lappend thisrow $r $g $b
+				 incr nx
+			 }
+
+			 if {[info exists prevrow]} {
+				 set nrow {}
+				 
+				 while { $ytot <= $newy } {
+					 $dest put -to 0 $ny [list $prow]
+					 incr ytot $my; incr ny
+					 update idletasks
+				 }
+
+				 set ytot [expr {$ytot - $newy}]
+				 set rn $ytot; set rp [expr {$my - $rn}]
+
+				 while { $ytot > $newy } {
+					 set ytot [expr {$ytot - $newy}]
+					 incr y
+					 continue
+				 }
+
+
+				 foreach {pr pg pb} $prevrow {r g b} $thisrow {
+					 set tr [expr {int( ($rn*$r + $rp*$pr) / $my)}]
+					 set tg [expr {int( ($rn*$g + $rp*$pg) / $my)}]
+					 set tb [expr {int( ($rn*$b + $rp*$pb) / $my)}]
+					 lappend nrow [format "#%02x%02x%02x" $tr $tg $tb]
+				 }
+
+				 $dest put -to 0 $ny [list $nrow]
+				 incr ytot $my; incr ny
+			 }
+
+			 set prevrow $thisrow
+			 set prow $row
+			 update idletasks
+		 }
+
+		 while { $ny < $newy } {
+			 $dest put -to 0 $ny [list $row]
+			 incr ny
+		 }
+
+		 return $dest
+	}
+}
+
+# (c) wiki.tcl.tk
\ No newline at end of file

Modified: trunk/plugins/winup/winup.tcl
===================================================================
--- trunk/plugins/winup/winup.tcl	2011-01-21 16:01:44 UTC (rev 461)
+++ trunk/plugins/winup/winup.tcl	2011-01-22 03:31:09 UTC (rev 462)
@@ -1,734 +1,568 @@
-#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#
-#	Winup - small notify for incomming messages
-#	Author - < Renji >
-#	e-mail - < webrenji at gmail.com >
-#	xmpp - < rejjin at jabber.dk >
-#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#
-#	Please see readme
-#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#
-# 7:11 09.09.2010
-#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#
-
-
-namespace eval winup {
-	variable options
-	variable state_winup_button
-	variable button_index
-	
-	set options(cd) [file dirname [info script]]
-	
-	::msgcat::mcload [file join $options(cd) msgs]
-	
-	custom::defgroup Plugins [::msgcat::mc "Plugins options."] \
-	-group Tkabber	
-	
-    custom::defgroup Winup [::msgcat::mc "Winup options"] \
-	-group Plugins	
-	
-	custom::defvar options(use_toolbar) 1 \
-	[::msgcat::mc "Add to main toolbar button, for fast change state"] \
-	-group Winup -type boolean
-	
-	custom::defvar options(sleep) 3 \
-	[::msgcat::mc "Sleep of notify"] \
-	-type integer -group Winup
-	
-	custom::defvar options(string_length) 100 \
-	[::msgcat::mc "Length of string for show in notify"] \
-	-type integer -group Winup
-	
-	custom::defgroup {Status options} \
-	[::msgcat::mc "Winup status options"] \
-	-group Winup
-
-	foreach status_type { available chat away xa dnd invisible } {
-		custom::defvar options(status-$status_type) 1 \
-		[::msgcat::mc "Use notifycation, if your status %s" $status_type] \
-		-group {Status options} -type boolean
-	}
-	
-	custom::defvar state_winup_button 1 {} \
-	-type boolean -group Hidden
-	
-	custom::defvar button_index 0 {} \
-	-type boolean -group Hidden
-	
-	custom::defgroup {Window themes} \
-	[::msgcat::mc "Window themes"] \
-	-group Winup
-	
-	if { [info commands ::plugins::is_registered] ne {} } {
-		if {![::plugins::is_registered winup]} {
-			::plugins::register winup \
-					-namespace [namespace current] \
-					-source [info script] \
-					-description [::msgcat::mc "Whether the Winup plugin is loaded"] \
-					-loadcommand [namespace code load] \
-					-unloadcommand [namespace code unload]
-			return
-		}
-	}
-}
-
-proc winup::load {} {
-	set ns [namespace current]
-	hook::add process_message_hook ${ns}::process_message 70
-	hook::add finload_hook ${ns}::toolbar_button_handle
-	${ns}::toolbar_button_handle
-}
-
-proc winup::unload {} {
-	set ns [namespace current]
-	hook::remove process_message_hook ${ns}::process_message 70
-	hook::remove finload_hook ${ns}::toolbar_button_handle
-	${ns}::delete_toolbar_button
-}
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-
-proc winup::process_message  { xlib from - type - subject body - - - x } {
-	variable options
-	
-	if { [get_button_state] == 0 } {
-		return
-	}
-
-	if { $body eq {} } {
-		return
-	}
-	
-	switch -- $type {
-		groupchat {
-			set chatid [chat::chatid $xlib [::xmpp::jid::stripResource $from]]
-		}
-		chat {
-			set chatid [chat::chatid $xlib $from]
-		}
-	}
-	
-	
-	if { [chat::is_opened $chatid] && [ifacetk::chat_window_is_active $chatid] } {
-		return
-	}
-	
-	if { $type eq "groupchat" && [::xmpp::delay::exists $x] } {
-		return 
-	}
-	
-	if { [info commands ::plugins::mucignore::is_ignored]  ne {} } {
-			if { [::plugins::mucignore::is_ignored $xlib $from $type] ne {}} {
-				return
-			}
-	}
-		
-	foreach st { available chat away xa dnd invisible } {
-		if { $::curuserstatus eq $st && $options(status-${st}) == 0 } {
-			return
-		}
-	}
-		
-	create_message $xlib $from $type $body
-}
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-
-proc winup::create_message	{ xlib from type body } {
-	variable options
-	
-	if { $type eq "chat" } {
-		set options(head) [::msgcat::mc "Message from %s" <[get_sender_from_chat $xlib $from]>]
-		set options(image) [get_status_icon [get_jid_status $xlib $from]]
-	} else {
-		set options(head) [::msgcat::mc "Message from %s" "[::xmpp::jid::stripResource $from] <[::xmpp::jid::resource $from]>"]
-		set options(image) {roster/conference/available}
-	}
-
-	
-	set options(chatid) [chat::chatid $xlib $from]
-	set options(body) [string range $body 0 $options(string_length) ]
-	set options(status) [get_user_status_desc $xlib $from]
-	set options(status_type) [get_jid_status $xlib $from]
-	
-	if { [string length [get_user_status_desc $xlib $from]] > 50 } {
-		set options(status) "[string range [get_user_status_desc $xlib $from] 0 50] ..."
-	}
-	
-	create_window
-}
-		
-proc winup::get_sender_from_chat { xlib from } {
-	set part [::xmpp::jid::stripResource $from]
-	set chatid [chat::chatid $xlib $part]
-	if { [chat::is_groupchat $chatid] } {
-		return [::xmpp::jid::resource $from]
-	}
-	return $part
-}
-	
-proc winup::get_status_icon { status } {
-	foreach part { available away chat dnd error \
-		invisible unavailable unsubscribed xa } {
-			if { $part eq $status } {
-				return "roster/user/$part"
-			}
-	}
-	return "roster/user/available"
-}
- 
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
- 
-proc winup::create_window { } {
-	variable options
-	
-	hook::run winup_window_types $options(chatid) \
-		$options(head) $options(image) $options(body) \
-		$options(status)
-}
-	
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-proc winup::toolbar_button_handle { } {
-	variable options 
-	variable button_index
-	
-	if { $options(use_toolbar) == 0 } {
-		return
-	}
-	
-    if {[catch {set bbox [.mainframe gettoolbar 0].bbox}] || \
-	    ![winfo exists $bbox]} {
-			return
-    }
-	
-	if { [winfo exist $bbox.b$button_index] } {
-		return
-	}
-	
-	image create photo {toolbar/winup-enabled} \
-	-file [file join $options(cd) pixmaps toolbar-enabled.gif]
-	
-	image create photo {toolbar/winup-disabled} \
-	-file [file join $options(cd) pixmaps toolbar-disabled.gif]	
-	
-	set ns [namespace current]
-	
-	set button_index [ifacetk::add_toolbar_button \
-		[get_button_icon] \
-			${ns}::change_button_state \
-				[get_button_text] ]
-}
-
-proc winup::delete_toolbar_button { } {
-	variable button_index
-	
-    if {[catch {set bbox [.mainframe gettoolbar 0].bbox}] || \
-	    ![winfo exists $bbox]} {
-			return 0
-    }
-	
-	if { [winfo exist $bbox.b$button_index] } {
-		ButtonBox::delete $bbox $button_index
-		ButtonBox::_redraw $bbox
-	}
-}
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-proc winup::get_button_state { } {
-	variable state_winup_button
-	return $state_winup_button
-}
-
-proc winup::change_button_state { } {
-	variable state_winup_button
-	set state_winup_button [expr {$state_winup_button == 0}]
-	change_button_icon
-	change_button_text
-}
-
-proc winup::change_button_text { } {
-	variable button_index
-	set bbox [.mainframe gettoolbar 0].bbox
-	$bbox.b$button_index configure -helptext [get_button_text]
-}
-
-proc winup::get_button_icon { } {
-	variable state_winup_button
-	if { $state_winup_button } {
-		return {toolbar/winup-enabled}
-	} else {
-		return {toolbar/winup-disabled}
-	}
-}
-
-proc winup::get_button_text { } {
-	variable state_winup_button
-	if { $state_winup_button } {
-		return [::msgcat::mc "Disable Winup"]
-	} else {
-		return [::msgcat::mc "Enable Winup"]
-	}
-}
-
-proc winup::change_button_icon { } {
-	variable button_index
-	ifacetk::set_toolbar_icon $button_index \
-	[namespace current]::get_button_icon
-}
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-
-
-	
-proc winup::time_sleep { time } {
-	set sleep -
-	after $time {set sleep +}
-	vwait sleep
-	catch {unset sleep}
-}
-
-proc winup::change_alpha { w x } {
-	time_sleep 20
-	update idletasks
-	if { [winfo exist $w] == 0 } { return }
-	wm attributes $w -alpha $x
-}
-
-proc winup::change_geometry { w x } {
-	time_sleep 2
-	update idletasks
-	if { [winfo exist $w] == 0 } { return }
-	wm geometry $w $x
-	update idletasks
-}
-
-proc winup::option_exist option {
-	return [expr {[lsearch -exact [wm attributes .] -$option] >= 0}]
-}
-
-###################################################################
-###################################################################
-###################################################################
-###################################################################
-###################################################################
-
-namespace eval winup {
-	variable options
-	
-	set group {Standart window theme}
-	
-	custom::defgroup $group [::msgcat::mc $group] -group {Window themes}
-	
-	custom::defvar options(standart_window,use_alpha) 1 \
-	[::msgcat::mc "Using alpha for window"] \
-	-group $group -type boolean
-	
-	custom::defvar options(standart_window,alpha_scale) 70 \
-	[::msgcat::mc "Alpha scale"] \
-	-group $group -type integer
-	
-	custom::defvar options(standart_window,background_color_top) {#555555} \
-	[::msgcat::mc "Background color (top part of window)"] \
-	-type string -group $group
-	
-	custom::defvar options(standart_window,foreground_color_top) {white} \
-	[::msgcat::mc "Foreground color (top part of window)"] \
-	-type string -group $group
-	
-	custom::defvar options(standart_window,background_color_bottom) {white} \
-	[::msgcat::mc "Background color (bottom part of window)"] \
-	-type string -group $group
-	
-	custom::defvar options(standart_window,foreground_color_bottom) {#555555} \
-	[::msgcat::mc "Foreground color (bottom part of window)"] \
-	-type string -group $group
-	
-	custom::defvar options(standart_window,head_font) {Tahoma 8 bold} \
-	[::msgcat::mc "Font of header"] \
-	-type font -group $group
-	
-	custom::defvar options(standart_window,body_font) {Tahoma 7} \
-	[::msgcat::mc "Font of message"] \
-	-type font -group $group	
-}
-
-proc winup::standart_window { chatid head image body status } {
-	variable options
-	variable theme
-	
-	if { $theme ne "standart_window" } {
-		return
-	}
-	
-	set w ._winup
-	
-	if { [winfo exist $w] } {
-		pop_down $w 8
-	}
-	
-	toplevel $w
-	
-	if { [option_exist topmost] } {
-		wm attributes $w -topmost 1
-	}
-	
-	if { [option_exist alpha] && $options(standart_window,use_alpha) } {
-		wm attributes $w -alpha 0.$options(standart_window,alpha_scale)
-	}
-	
-	catch { wm resizable $w 0 0 }
-	catch { wm overrideredirect $w 1 }
-	
-	set options(mw) [winfo screenwidth .]
-	set options(mh) [winfo screenheight .]
-	
-	set options(w) [expr {round($options(mw) / 4 + 20)}]
-	set options(h) [expr {round($options(mh) / 6 + 20)}]
-
-	set options(xp) [expr {round($options(mw) - $options(w))}] 
-	set options(yp) $options(mh)
-
-	wm geometry $w ${options(w)}x${options(h)}+${options(xp)}+${options(yp)}
-	
-	frame $w.frame -relief flat -background $options(standart_window,background_color_top)
-	frame $w.center -relief flat -background $options(standart_window,background_color_bottom)
-	pack $w.frame  $w.center -fill both -expand 1
-	
-	label $w.frame.icon -image $image -background $options(standart_window,background_color_top)
-	label $w.frame.header -text $head -font $options(standart_window,head_font) \
-		-foreground $options(standart_window,foreground_color_top) \
-		-background $options(standart_window,background_color_top)  -justify left
-	pack $w.frame.icon $w.frame.header -side left 
-
-	message  $w.center.text -text $body -font $options(standart_window,body_font) \
-		-foreground $options(standart_window,foreground_color_bottom) \
-		-background $options(standart_window,background_color_bottom)  -justify left -aspect 500
-	pack $w.center.text -side top -anchor nw -fill both -expand 1
-	
-	bind $w <1> [list [namespace current]::standart_window_to_chat $chatid $w]
-	bind $w <3> [list [namespace current]::pop_down $w 8]
-	
-	pop_up $w
-}
-
-proc winup::standart_window_to_chat { chatid w } {
-	catch { chat::activate $chatid }
-	pop_down $w 14
-}
-
-proc winup::pop_up w {
-	variable options 
-	
-	set options(yp) [expr {round($options(mh) - $options(h))}]
-
-	time_sleep 100
-	
-	for {set X $options(mh)} {$X >= $options(yp)} {incr X -4} {
-		change_geometry $w ${options(w)}x${options(h)}+${options(xp)}+${X}
-	}
-		
-	time_sleep 200
-	
-	if { [option_exist alpha] && $options(standart_window,use_alpha) } {
-		for {set X 80} {$X <= 90} {incr X 2} {
-			change_alpha $w [expr {$X / 100.0}]
-		}
-	}
-	
-	time_sleep [expr {$options(sleep)*1000}]
-	pop_down $w
-}
-
-proc winup::pop_down { w {speed 4} } {
-	variable options 
-	
-	if { [option_exist alpha] && $options(standart_window,use_alpha) } {
-		for {set X 90} {$X > 80} {incr X -[expr {$speed / 2}]} {
-			change_alpha $w [expr {$X / 100.0}]
-		}
-	}
-			
-	time_sleep 200
-	for {set X $options(yp)} {$X < $options(mh)} {incr X $speed} {
-		change_geometry $w ${options(w)}x${options(h)}+${options(xp)}+${X}
-	}
-		
-	destroy $w
-}
-
-hook::add winup_window_types [namespace current]::winup::standart_window		
-
-
-
-###################################################################
-
-namespace eval winup {
-	variable options
-	
-	set group {Mouse-window theme}
-	
-	custom::defgroup $group [::msgcat::mc $group] -group {Window themes}
-
-	custom::defvar options(mouse-window,use_alpha) 1 \
-	[::msgcat::mc "Using alpha for window"] \
-	-group $group -type boolean
-	
-	custom::defvar options(mouse-window,alpha_scale) 70 \
-	[::msgcat::mc "Alpha scale"] \
-	-group $group -type integer
-	
-	custom::defvar options(mouse-window,draw_with_mouse) 1 \
-	[::msgcat::mc "Move window with mouse"] \
-	-group $group -type boolean
-	
-	custom::defvar options(mouse-window,background_color_top) {#555555} \
-	[::msgcat::mc "Background color (top part of window)"] \
-	-type string -group $group
-	
-	custom::defvar options(mouse-window,foreground_color_top) {white} \
-	[::msgcat::mc "Foreground color (top part of window)"] \
-	-type string -group $group
-	
-	custom::defvar options(mouse-window,background_color_bottom) {white} \
-	[::msgcat::mc "Background color (bottom part of window)"] \
-	-type string -group $group
-	
-	custom::defvar options(mouse-window,foreground_color_bottom) {#555555} \
-	[::msgcat::mc "Foreground color (bottom part of window)"] \
-	-type string -group $group
-	
-	custom::defvar options(mouse-window,head_font) {Tahoma 8 bold} \
-	[::msgcat::mc "Font of header"] \
-	-type font -group $group
-	
-	custom::defvar options(mouse-window,body_font) {Tahoma 7} \
-	[::msgcat::mc "Font of message"] \
-	-type font -group $group	
-	
-}
-
-
-proc winup::mouse_window { chatid head image body status } {
-	variable options
-	variable theme
-	
-	if { $theme ne "mouse_window" } {
-		return
-	}
-	
-	set w ._winup
-	
-	if { [winfo exist $w] } {
-		destroy $w
-	}
-	
-	toplevel $w
-	
-	if { [option_exist topmost] } {
-		wm attributes $w -topmost 1
-	}
-	
-	if { [option_exist alpha] && $options(mouse-window,use_alpha) } {
-		wm attributes $w -alpha 0.$options(mouse-window,alpha_scale)
-	}
-
-	catch { wm resizable $w 0 0 }
-	catch { wm overrideredirect $w 1 }
-	
-	set options(mw) [winfo screenwidth .]
-	set options(mh) [winfo screenheight .]
-	
-	set options(w) [expr {round([winfo screenwidth .] / 4 + 20)}]
-	set options(h) [expr {round([winfo screenheight .] / 6 + 20)}]
-
-	set options(xp) [expr {[winfo pointerx .] - $options(w) / 2}]
-	set options(yp) [expr {[winfo pointery .] - $options(h) / 2}]
-	
-	wm geometry $w ${options(w)}x${options(h)}+${options(xp)}+${options(yp)}
-	
-	frame $w.frame -relief flat -background $options(mouse-window,background_color_top)
-	frame $w.center -relief flat -background $options(mouse-window,background_color_bottom)
-	pack $w.frame  $w.center -fill both -expand 1
-	
-	label $w.frame.icon -image $image -background $options(mouse-window,background_color_top)
-	label $w.frame.header -text $head -font $options(mouse-window,head_font) \
-		-foreground $options(mouse-window,foreground_color_top) \
-		-background $options(mouse-window,background_color_top)  -justify left
-	pack $w.frame.icon $w.frame.header -side left 
-
-	message  $w.center.text -text $body -font $options(mouse-window,body_font) \
-		-foreground $options(mouse-window,foreground_color_bottom) \
-		-background $options(mouse-window,background_color_bottom)  -justify left -aspect 500
-	pack $w.center.text -side top -anchor nw -fill both -expand 1
-	
-	bind $w <1> [list [namespace current]::mouse-window_to_chat $chatid $w]
-	bind $w <3> [list destroy $w]
-	
-	if {$options(mouse-window,draw_with_mouse)} {
-		bind $w <Any-Motion> [list [namespace current]::mouse-window_draw_window $w]
-	} else {
-		after [expr {$options(sleep) * 1000}] [list destroy $w] 
-	}
-}
-
-proc winup::mouse-window_draw_window { w } {
-	variable options
-	
-	set options(xp) [expr {[winfo pointerx .] - $options(w) / 2}]
-	set options(yp) [expr {[winfo pointery .] - $options(h) / 2}]
-	
-	wm geometry $w ${options(w)}x${options(h)}+${options(xp)}+${options(yp)}
-}
-
-proc winup::mouse-window_to_chat { chatid w } {
-	catch { chat::activate $chatid }
-	destroy $w
-}
-
-hook::add winup_window_types [namespace current]::winup::mouse_window	
-
-
-###################################################################
-
-namespace eval winup {
-	variable options
-	
-	set group {Floatinglog theme}
-
-	custom::defgroup $group [::msgcat::mc $group] -group {Window themes}
-	
-	custom::defvar options(floatinglog,use_alpha) 1 \
-	[::msgcat::mc "Using alpha for window"] \
-	-group $group -type boolean
-	
-	custom::defvar options(floatinglog,alpha_scale) 70 \
-	[::msgcat::mc "Alpha scale"] \
-	-group $group -type integer
-	
-	custom::defvar options(floatinglog,position) {-0-30} \
-	[::msgcat::mc "Window position"] \
-	-type string -group $group	
-	
-	custom::defvar options(floatinglog,head_font) {Tahoma 8 bold} \
-	[::msgcat::mc "Font of header"] \
-	-type font -group $group
-	
-	custom::defvar options(floatinglog,body_font) {Tahoma 7 bold} \
-	[::msgcat::mc "Font of message"] \
-	-type font -group $group	
-	
-	custom::defvar options(floatinglog,status_font) {Tahoma 7 bold} \
-	[::msgcat::mc "Status font"] \
-	-type font -group $group	
-}
-	
-proc winup::floatinglog { chatid head image body status } {
-	variable options
-	variable theme
-	
-	if { $theme ne "floatinglog" } {
-		return
-	}
-	
-	set w ._winup
-	
-	if { [winfo exist $w] } {
-		destroy $w
-	}
-	
-	toplevel $w -background #555555
-	
-	if { [option_exist topmost] } {
-		wm attributes $w -topmost 1
-	}
-	
-	if { [option_exist alpha] && $options(floatinglog,use_alpha) } {
-		wm attributes $w -alpha 0.$options(floatinglog,alpha_scale)
-	}
-	
-	catch { wm resizable $w 0 0 }
-	catch { wm overrideredirect $w 1 }
-	
-	wm geometry $w $options(floatinglog,position)
-	wm minsize $w 285 10
-	
-	set w [frame $w.frame -relief flat  -background #555555]
-	pack $w -expand 1 -fill both -anchor center
-
-	set ftop $w.top
-	frame $ftop -relief flat  -background #555555
-	pack $ftop -expand 0 -fill x -anchor n -side top
-
-	label $ftop.icon -image $image -background #555555
-	
-	label $ftop.title -text $head -font $options(floatinglog,head_font) \
-		-background #555555 -fg #cccccc
-		
-	pack $ftop.icon $ftop.title -anchor nw -side left
-
-	grid $ftop.icon -row 0 -column 0
-	grid $ftop.title -row 0 -column 1
-
-	set fcenter $w.center
-	frame $fcenter -relief flat
-	pack $fcenter -expand 1 -fill both -anchor center -padx 5
-	
-	label $fcenter.status -text $status -justify left -font $options(floatinglog,status_font)
-	pack $fcenter.status -anchor nw
-	
-	message $fcenter.message -text $body -justify left \
-	-relief solid -bd 0 -width 350 -font $options(floatinglog,body_font)
-	pack $fcenter.message -anchor nw -side bottom -fill x
-
-	grid $fcenter.status -row 1 -column 1 -sticky w
-	grid $fcenter.message -row 2 -column 1 -sticky w
-
-
-	set fbottom $w.bottom
-	frame $fbottom -relief flat -background #555555
-	pack $fbottom -expand 0 -fill x -anchor center -pady 2 -side bottom
-
-	bind $w <1> [list [namespace current]::floatinglog_to_chat $chatid]
-	bind $w <3> [list destroy %W]
-	
-	after [expr {$options(sleep)*1000}] [list destroy ._winup]
-}
-
-proc winup::floatinglog_to_chat { chatid } {
-	catch { chat::activate $chatid }
-	destroy ._winup
-}
-
-hook::add winup_window_types [namespace current]::winup::floatinglog	
-
-###################################################################
-###################################################################
-###################################################################
-###################################################################
-###################################################################
-
-proc winup::create_custom_options { } {
-	variable options
-	variable theme
-	
-	foreach name $::hook::winup_window_types {
-		set hook_part [lindex $name 0]
-		set extension_name [namespace tail $hook_part]
-		lappend windows $extension_name $extension_name
-	}
-	    
-	custom::defvar theme [lindex $windows 0] \
-		[::msgcat::mc "Window type"] \
-		-type options -values $windows \
-		-group {Window themes} \
-		-command [namespace current]::demo
-}
-
-hook::add finload_hook [namespace current]::winup::create_custom_options 100
-
-proc winup::demo { who work val } {
-	upvar 1 $who window
-	
-	eval { [namespace current]::$window - \
-		[::msgcat::mc "Header of window"] \
-		{roster/user/available} \
-		[::msgcat::mc "Message"] \
-		[::msgcat::mc "Status"] }
-}
-#########################################################
+# Winup - animated notify window.
+# Writted by Rejjin 
+# 
+# $Id$
+
+namespace eval winup {
+variable config
+variable toolbar_button
+variable photos
+
+	set config(script_dir) [file dirname [info script]]
+	
+	::msgcat::mcload [file join $config(script_dir) msgs]
+	
+	lappend ::auto_path $config(script_dir)
+	
+	package require fly
+	package require resize
+	package require base64
+	
+	custom::defgroup Plugins [::msgcat::mc "Plugins options."] -group Tkabber	
+    custom::defgroup Winup [::msgcat::mc "Winup custom options."] -group Plugins
+	
+	custom::defvar config(add_toolbar_button) 1 \
+	[::msgcat::mc "Add toolbar button, for fast change state."] \
+	-command [namespace current]::add_or_delete_toolbar_button \
+	-group Winup -type boolean
+	
+	custom::defvar config(-anchor) se \
+	[::msgcat::mc "Position of window."] \
+	-type options -group Winup -values [list \
+		n [::msgcat::mc "Up"] \
+		ne [::msgcat::mc "Up-right"] \
+		e [::msgcat::mc "Right"] \
+		se [::msgcat::mc "Right-down"] \
+		s [::msgcat::mc "Down"] \
+		sw [::msgcat::mc "Down-left"] \
+		w [::msgcat::mc "Left"] \
+		nw [::msgcat::mc "Left-Up"] \
+		center [::msgcat::mc "Center"] \
+	]
+	
+	custom::defvar config(-animate) up \
+	[::msgcat::mc "Animation of window."] \
+	-type options -group Winup -values [list \
+		left [::msgcat::mc "Left"] \
+		right [::msgcat::mc "Right"] \
+		up [::msgcat::mc "Up"] \
+		down [::msgcat::mc "Down"] \
+	]
+	
+	custom::defvar config(-offsetx) 0 \
+	[::msgcat::mc "Shift of window (horisontal)."] \
+	-group Winup -type integer
+		
+	custom::defvar config(-offsety) 0 \
+	[::msgcat::mc "Shift of window (vertical)."] \
+	-group Winup -type integer
+		
+	custom::defvar config(-keyframes) [list 1000 5000 500] \
+	[::msgcat::mc "Keys for window."] \
+	-group Winup -type string
+	
+	custom::defvar config(max_string_length) 250 \
+	[::msgcat::mc "Maximum number of characters in incoming message."] \
+	-group Winup -type integer
+	
+	custom::defvar config(auto_hide) 1 \
+	[::msgcat::mc "Auto hide notify window."] \
+	-group Winup -type boolean
+	
+	custom::defvar config(show_avatars) 1 \
+	[::msgcat::mc "Show avatars on notifycation window."] \
+	-group Winup -type boolean
+	
+	custom::defvar config(save_avatars) 1 \
+	[::msgcat::mc "Save and load avatars."] \
+	-group Winup -type boolean
+	
+	custom::defvar config(photo_width) 50 \
+	[::msgcat::mc "Width of avatars in notify window."] \
+	-group Winup -type integer
+		
+	custom::defvar config(photo_height) 50 \
+	[::msgcat::mc "Height of avatars in notify window."] \
+	-group Winup -type integer
+		
+	custom::defvar config(alpha) 90 \
+	[::msgcat::mc "Window opacity (in percent)."] \
+	-type integer -group Winup
+	
+	custom::defvar config(ignore_status) dnd \
+	[::msgcat::mc "Ignore message if your status..."] \
+	-type options -group Winup -values [list \
+		available [::msgcat::mc "Available"] \
+		chat [::msgcat::mc "Chat"] \
+		away [::msgcat::mc "Away"] \
+		xa [::msgcat::mc "Xa"] \
+		dnd [::msgcat::mc "Dnd"] \
+	]
+	
+	custom::defvar config(unique_jids) {} \
+	[::msgcat::mc "JIDs for always notyfy (with regexp)."] \
+	-type string -group Winup
+	
+	custom::defvar config(ignore_jids) {} \
+	[::msgcat::mc "You'r black list of jids (with regexp)."] \
+	-type string -group Winup
+	
+	custom::defvar config(bgcolor) #555555 \
+	[::msgcat::mc "Background color."] \
+	-type string -group Winup
+		
+	custom::defvar config(fgcolor) #cccccc \
+	[::msgcat::mc "Foreground color."] \
+	-type string -group Winup
+		
+	custom::defvar config(nick_font) {Tahoma 8} \
+	[::msgcat::mc "Nick font."] \
+	-type font -group Winup
+		
+	custom::defvar config(status_font) {Tahoma 7} \
+	[::msgcat::mc "Status font."] \
+	-type font -group Winup
+		
+	custom::defvar config(message_font) {Tahoma 8} \
+	[::msgcat::mc "Message font."] \
+	-type font -group Winup
+		
+	custom::defvar config(window_minimal_size) {285 120} \
+	[::msgcat::mc "Minimal size of notifycation window."] \
+	-type string -group Winup
+		
+	# Hidden Group
+	custom::defvar toolbar_button(index) {-1} \
+	[::msgcat::mc "Last button index"] \
+	-type string -group Hidden
+	custom::defvar toolbar_button(state) {1} \
+	[::msgcat::mc "Button (and plugin) state"] \
+	-type string -group Hidden
+	
+	image create photo {toolbar/winup-enabled} \
+	-file [file join $config(script_dir) pixmaps toolbar-enabled.gif]
+	image create photo {toolbar/winup-disabled} \
+	-file [file join $config(script_dir) pixmaps toolbar-disabled.gif]	
+	
+	if {![::plugins::is_registered winup]} {
+		::plugins::register winup \
+			-namespace [namespace current] \
+			-source [info script] \
+			-description [::msgcat::mc "Whether the Winup plugin is loaded."] \
+			-loadcommand [namespace code load_plugin] \
+			-unloadcommand [namespace code unload_plugin]
+		return
+	}
+	
+	proc load_plugin {} {
+		hook::add finload_hook \
+		[namespace current]::add_toolbar_button
+		hook::add process_message_hook \
+		[namespace current]::parse_message 100
+		add_toolbar_button
+		load_photos
+	}
+	
+	proc unload_plugin {} {
+		hook::remove finload_hook \
+		[namespace current]::add_toolbar_button
+		hook::remove process_message_hook \
+		[namespace current]::parse_message 100
+		delete_toolbar_button
+		save_photos
+	}
+}
+
+proc winup::parse_message {xlib from id type is_subject \
+			subject body err thread priority x} {
+variable config
+variable photos
+	
+	set mjid 0
+	foreach majid $config(unique_jids) {
+		if {[string match $majid $from]} {
+		set mjid 1
+		}
+	}
+		
+	foreach ignored $config(ignore_jids) {
+	if {[string match $ignored $from]} return
+	}
+	
+	# Deactive state
+	if {!$mjid && ![toolbar_button_state]} return
+	
+	# For empty messages
+	if {[string length $body] == 0} {
+	return
+	}
+	
+	# If unsupported type - break
+	if {![string equal $type "chat"] && \
+		![string equal $type "groupchat"]} {
+			return
+	}
+	
+	# Get chatid
+	if {[string equal $type "groupchat"]} {
+	set vjid [::xmpp::jid::stripResource $from]
+	} else {set vjid $from}
+	if {[catch {set chatid [chat::chatid $xlib $vjid]}]} {
+	return
+	}
+	
+	# If window opened and see - break
+	set input_win {}
+	catch {set input_win [chat::input_win $chatid]}
+	if {[string equal $input_win [focus]] || \
+		[string equal [chat::chat_win $chatid] [focus]]} {
+			return
+	}
+	
+	if {[string equal $type "groupchat"]} {
+		# If message from history - break
+		if {[::xmpp::delay::exists $x]} {return}
+		
+		# For supported ignore plugin. Break is from ignored
+		if {![catch {::plugins::mucignore::is_ignored $xlib $from $type} ignore] && \
+			[string length $ignore] > 0} {
+				return
+		}
+
+		set my_jid [chat::our_jid $chatid]
+		set my_nick [chat::get_nick $xlib $my_jid $type]
+		
+		if {![check_message $my_nick $body]} {return}
+	}
+	
+	set nick [::chat::get_nick $xlib $from $type]
+
+	# Get resized photo
+	set photo ""
+	if {$config(show_avatars)} {
+		if {![info exist photos($from)]} {
+			if {[lsearch -exact [image names] photo_$from] >= 0} {
+			set photos($from) [resize::resize photo_$from \
+				$config(photo_width) $config(photo_height)]
+			}
+		}
+		catch {set photo $photos($from)}
+	}
+		
+	# If user status not ignored then show window
+	if {![string equal $::curuserstatus $config(ignore_status)]} {
+		create_window $xlib $from $type [get_user_status_desc $xlib $from] \
+		$subject $photo $body $nick
+	} else {
+		foreach majid $config(unique_jids) {
+			if {[string match $majid $from]} {
+				create_window $xlib $from $type [get_user_status_desc $xlib $from] \
+				$subject $photo $body $nick
+				return
+			}
+		}
+	}
+}
+
+proc winup::create_window {xlib from type status subject photo text nick} {
+variable config
+
+	if {[string equal $type "groupchat"]} {
+		set titletext [::msgcat::mc "Tkabber: message from groupchat"]
+		set chatid [chat::chatid $xlib [::xmpp::jid::stripResource $from]]
+	} else {
+		set titletext [::msgcat::mc "Tkabber: message from chat"]
+		set chatid [chat::chatid $xlib $from]
+	}
+	
+	if {[info exist config(topwin)] && [winfo exist $config(topwin)]} { 
+	if {[fly::state $config(topwin)] != 0} return
+	set top $config(topwin)
+	} else {
+	set config(topwin) [new_path_id]
+	toplevel $config(topwin)
+	set top $config(topwin)
+	}
+	
+	set config(id,$top) $chatid	
+	
+	catch {wm overrideredirect $top 1}
+	
+	foreach {option value} [wm attributes $top] {
+		if {[string equal $option -topmost]} {
+			wm attributes $top -topmost 1
+		}
+	}
+	
+	$top configure -background $config(bgcolor)
+	
+	set alpha [expr $config(alpha) / 100.0]
+	if {$alpha <= 1.0} {
+		foreach {option value} [wm attributes $top] {
+			if {[string equal $option -alpha]} {
+				wm attributes $top -alpha $alpha
+			}
+		}
+	}
+
+	lassign $config(window_minimal_size) minx miny
+	if {[string is integer -strict $minx] && \
+		[string is integer -strict $miny]} {
+			wm minsize $top $minx $miny
+	} else {wm minsize $top 285 150}
+	
+	children_configure $top $xlib $from $status \
+		$subject $text $titletext $photo $nick
+	
+	::fly::init $top -anchor $config(-anchor) \
+		-animate $config(-animate) \
+		-offsetx $config(-offsetx) \
+		-offsety $config(-offsety) \
+		-keyframes $config(-keyframes) \
+		-withdraw 0
+	
+	if {$config(auto_hide)} {
+		fly::animate $top
+		fly::animate $top 1
+	} else {
+	fly::animate $top 1
+	}
+}
+
+proc winup::new_path_id { } {
+	variable winid
+	
+	return .winup[incr winid]
+}
+
+proc winup::range_text {text mlength} {
+	regsub -all "\n" $text [string repeat " " 20] tmp
+	
+	if {[string length $tmp] > $mlength} {
+	set text "[string range $tmp 0 $mlength]..."
+	}
+	
+	regsub -all [string repeat " " 20] $text \n text
+	return $text
+}
+
+proc winup::on_click {key top} {
+variable config
+	
+	set chatid $config(id,$top)
+	
+	set type [expr {[chat::is_groupchat $chatid] ? \
+		"groupchat" : "chat"}]
+	
+	switch -- $key {
+		Button-1 {
+			::ifacetk::systray::restore
+			::chat::activate $chatid
+		}
+		Button-3 {
+			fly::hide $top 1
+		} 
+	}
+}
+
+proc winup::children_configure {top xlib from status subject text titletext photo nick} {
+variable config
+
+	if {![winfo exist $top]} {
+	return -code error "bad window path name \"$top\""
+	}
+
+	catch {eval destroy [winfo children $top]}
+	
+	set status [range_text $status 100]
+	set subject [range_text $subject 100]
+	set text [range_text $text $config(max_string_length)]
+	
+	set wnd [frame $top.frame -relief flat -background $config(bgcolor) -class Winup]
+	pack $wnd -expand 1 -fill both -anchor center -side top
+	
+	set ftop $wnd.top
+	frame $ftop -relief flat -background $config(bgcolor)
+	pack $ftop -expand 0 -fill x -anchor n -side top
+	
+	label $ftop.icon -background $config(bgcolor) \
+		-image [::ifacetk::roster::get_jid_icon $xlib $from] 
+	pack $ftop.icon -anchor nw	
+
+	label $ftop.title -text $titletext -font {tahoma 8 bold} \
+		-background $config(bgcolor) -foreground $config(fgcolor)
+	pack $ftop.title -anchor nw
+
+	grid $ftop.icon -row 0 -column 0
+	grid $ftop.title -row 0 -column 1
+
+	set fcenter $wnd.center
+	frame $fcenter -relief flat
+	pack $fcenter -expand 1 -fill both -anchor center -padx 5
+	
+	label $fcenter.icon -image $photo
+	pack $fcenter.icon -anchor nw
+
+	label $fcenter.user -text "$nick <$from>" -justify left -font $config(nick_font)
+	pack $fcenter.user -anchor nw -side left
+	
+	label $fcenter.status -text $status -justify left -font $config(status_font)
+	pack $fcenter.status -anchor nw
+	
+	if {[string length $subject] != 0} {
+		label $fcenter.subject -text $subject -justify left \
+			-font {tahoma 8 bold} -foreground red
+		pack $fcenter.subject -anchor nw
+	}
+	
+	message $fcenter.message -text $text -justify left \
+	-relief solid -bd 0 -width 350 -font $config(message_font)
+	pack $fcenter.message -anchor nw -side bottom -fill x
+
+	grid $fcenter.icon -row 0 -column 0 -rowspan 4
+	grid $fcenter.user -row 0 -column 1 -sticky w
+	grid $fcenter.status -row 1 -column 1 -sticky w
+	
+	if {[string length $subject] == 0} {
+		grid $fcenter.message -row 2 -column 1 -sticky w
+	} else {
+		grid $fcenter.subject -row 2 -column 1 -sticky w
+		grid $fcenter.message -row 3 -column 1 -sticky w
+	}
+		
+	frame $wnd.bottom -relief flat -background $config(bgcolor)
+	pack $wnd.bottom -expand 0 -fill x -anchor center -pady 1 -side bottom	
+	
+	bind $top <Button-1> [list [namespace current]::on_click Button-1 $top]
+	bind $top <Button-3> [list [namespace current]::on_click Button-3 $top]
+	
+	return $top
+}
+
+proc winup::new_path_id { } {
+variable winid
+	
+	return .winup[incr winid]
+}
+
+# TOOLBAR BUTTON FUNCTIONS
+proc winup::add_toolbar_button {} {
+variable config
+variable toolbar_button
+	
+	if {$config(add_toolbar_button)} {
+		catch {.mainframe gettoolbar 0} toolbar
+		set bbox $toolbar.bbox
+		
+		if {[winfo exist $toolbar.bbox] && \
+			![ButtonBox::exist $toolbar.bbox $toolbar_button(index)]} {
+				set toolbar_button(index) [ifacetk::add_toolbar_button \
+					[state_toolbar_icon] \
+						[namespace current]::change_button_state \
+							[text_toolbar_button]]
+		}
+	}
+}
+
+proc winup::delete_toolbar_button {} {
+variable toolbar_button
+	
+	catch {.mainframe gettoolbar 0} toolbar
+	set bbox $toolbar.bbox
+	
+	if {[winfo exist $toolbar.bbox] && \
+		[ButtonBox::exist $toolbar.bbox $toolbar_button(index)]} {
+			ButtonBox::delete $toolbar.bbox $toolbar_button(index)
+			set toolbar_button(index) -1
+	}
+}
+
+proc winup::add_or_delete_toolbar_button {args} {
+variable config 
+	
+	switch -- $config(add_toolbar_button) {
+		1 add_toolbar_button 
+		0 delete_toolbar_button
+	}
+}
+
+proc winup::change_button_state { } {
+variable toolbar_button
+	
+	set toolbar_button(state) [expr {$toolbar_button(state) ? {0} : {1}}]
+	
+	set bbox [.mainframe gettoolbar 0].bbox
+	ButtonBox::itemconfigure $bbox $toolbar_button(index) \
+		-helptext [text_toolbar_button] \
+		-image [state_toolbar_icon]
+}
+
+proc winup::text_toolbar_button {} {
+variable toolbar_button
+	
+	return [expr {$toolbar_button(state) ? \
+		[::msgcat::mc "Deactivate notifycation."] : \
+			[::msgcat::mc "Activate notifycation."]}]
+}
+
+proc winup::state_toolbar_icon {} {
+variable toolbar_button
+	
+	return [expr {$toolbar_button(state) ? \
+		"toolbar/winup-enabled" : \
+			"toolbar/winup-disabled"}]
+}
+
+proc winup::toolbar_button_state {} {
+variable toolbar_button
+	return $toolbar_button(state)
+}
+
+proc winup::save_photos {} {
+variable photos
+variable config
+
+	if {!$config(save_avatars)} return
+	
+	set av_dir [file join $::configdir winup-avatars]
+	catch {file mkdir $av_dir}
+	
+	foreach photo [array names photos] {
+		set file [::base64::encode $photo]
+		$photos($photo) write [file join $av_dir $file]
+	}
+}
+
+proc winup::load_photos {} {
+variable photos
+variable config
+
+	if {!$config(save_avatars)} return
+	
+	set av_dir [file join $::configdir winup-avatars]
+	catch {file mkdir $av_dir}
+	
+	foreach file_id [glob -nocomplain -dir $av_dir *] {
+		set image_id [image create photo -file $file_id]
+		set from [::base64::decode [file tail $file_id]]
+		set photos($from) $image_id
+	}
+}
+
+# ButtonBox patch for 
+# adding and deleting toolbar button
+proc ::ButtonBox::exist {path index} {
+    variable $path
+    upvar 0 $path data
+	
+	return [expr {[lsearch -exact $data(buttons) $index] > 0}]	
+}
+
+proc ::ButtonBox::delete { path idx } {
+    variable $path
+    upvar 0  $path data
+
+    set i [lsearch -exact $data(buttons) $idx]
+    set data(buttons) [lreplace $data(buttons) $i $i]
+    destroy $path.b$idx
+}


Property changes on: trunk/plugins/winup/winup.tcl
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native



More information about the Tkabber-dev mailing list