[Tkabber-dev] r932 - in trunk/tkabber: . ifacetk plugins/richtext plugins/windows

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Mon Feb 12 01:06:33 MSK 2007


Author: sergei
Date: 2007-02-12 01:06:29 +0300 (Mon, 12 Feb 2007)
New Revision: 932

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/ifacetk/iface.tcl
   trunk/tkabber/ifacetk/systray.tcl
   trunk/tkabber/plugins/richtext/emoticons.tcl
   trunk/tkabber/plugins/richtext/stylecodes.tcl
   trunk/tkabber/plugins/windows/taskbar.tcl
Log:
	* ifacetk/systray.tcl, plugins/windows/taskbar.tcl: Code cleanup,
	  changed systray icon behaviour in Windows (doubleclick deiconifies
	  Tkabber window).

	* plugins/richtext/stylecodes.tcl: Removed unnecessary variable
	  reference.

	* plugins/richtext/emoticons.tcl, ifacetk/iface.tcl: Added
	  emoticons quick showing and hiding.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-02-11 19:34:35 UTC (rev 931)
+++ trunk/tkabber/ChangeLog	2007-02-11 22:06:29 UTC (rev 932)
@@ -44,6 +44,16 @@
 	* Makefile: Adapted to the current version. Separated installation of
 	  scripts and docs.
 
+	* ifacetk/systray.tcl, plugins/windows/taskbar.tcl: Code cleanup,
+	  changed systray icon behaviour in Windows (doubleclick deiconifies
+	  Tkabber window).
+
+	* plugins/richtext/stylecodes.tcl: Removed unnecessary variable
+	  reference.
+
+	* plugins/richtext/emoticons.tcl, ifacetk/iface.tcl: Added
+	  emoticons quick showing and hiding.
+
 2007-02-10  Sergei Golovan  <sgolovan at nes.ru>
 
 	* pixmaps/default/services/aim*, pixmaps/default/services/gg*,

Modified: trunk/tkabber/ifacetk/iface.tcl
===================================================================
--- trunk/tkabber/ifacetk/iface.tcl	2007-02-11 19:34:35 UTC (rev 931)
+++ trunk/tkabber/ifacetk/iface.tcl	2007-02-11 22:06:29 UTC (rev 932)
@@ -307,6 +307,8 @@
 			 -variable chat::options(stop_scroll)] \
 		    [list checkbutton [::msgcat::mc "Emphasize"] {} {} {} \
 			 -variable plugins::stylecodes::options(emphasize)] \
+		    [list checkbutton [::msgcat::mc "Show emoticons"] {} {} {} \
+			 -variable plugins::emoticons::options(show_emoticons)] \
 		    {separator} \
 		  ]] \
 		  {separator} \

Modified: trunk/tkabber/ifacetk/systray.tcl
===================================================================
--- trunk/tkabber/ifacetk/systray.tcl	2007-02-11 19:34:35 UTC (rev 931)
+++ trunk/tkabber/ifacetk/systray.tcl	2007-02-11 22:06:29 UTC (rev 932)
@@ -127,9 +127,9 @@
     }
     $m add separator
     $m add command -label [::msgcat::mc "Hide Main Window"] \
-		   -command [namespace code toggle_state]
+		   -command [namespace code withdraw]
     $m add command -label [::msgcat::mc "Show Main Window"] \
-		   -command [namespace code toggle_state]
+		   -command [namespace code restore]
     $m add separator
     $m add command -label [::msgcat::mc "Quit"] -command quit
 
@@ -164,6 +164,45 @@
 
 ##########################################################################
 
+# Withdraws the main Tkabber window from the screen:
+proc systray::withdraw {} {
+    if {[cequal [wm state .] withdrawn]} return
+
+    set saved_state [wm state .]
+    set saved_geometry [wm geometry .]
+    wm withdraw .
+}
+
+# Iconifies the main Tkabber window:
+proc systray::iconify {} {
+    if {[cequal [wm state .] iconic]} return
+
+    wm iconify .
+}
+
+# De-withdraws the main Tkabber window:
+proc systray::reshow {} {
+    if {![cequal [wm state .] withdrawn]} return
+
+    if {[info exists saved_geometry]} {
+	wm geometry . $saved_geometry
+    }
+    wm state . normal
+    wm deiconify .
+}
+
+# Restores the main Tkabber window from iconic or withdrawn states:
+proc systray::restore {} {
+    switch -- [wm state .] {
+	iconic {
+	    wm deiconify .
+	}
+	withdrawn {
+	    reshow
+	}
+    }
+}
+
 proc systray::toggle_state {} {
     variable saved_state
     variable saved_geometry
@@ -171,18 +210,12 @@
     switch -- [wm state .] {
 	zoomed -
         normal {
-            set saved_state [wm state .]
-            set saved_geometry [wm geometry .]
-            wm withdraw .
+	    withdraw
         }
 
-	iconic {
-            wm state . withdrawn
-	    if {[info exists saved_geometry]} {
-		wm geometry . $saved_geometry
-	    }
-	    wm state . normal
-            wm deiconify .
+	iconic -
+	withdrawn {
+	    restore
 	}
 
 	default {
@@ -359,11 +392,15 @@
 proc systray::balloon_text {} {
     global userstatusdesc textstatus
 
-    if {![cequal $textstatus ""]} {
-	return $textstatus
+    if {![string equal $textstatus ""]} {
+        set status $textstatus
+    } else {
+        set status $userstatusdesc
     }
-    return $userstatusdesc
+
+    return "Tkabber: $status"
 }
 
 ##########################################################################
 
+# vim:ts=8:sw=4:sts=4:noet

Modified: trunk/tkabber/plugins/richtext/emoticons.tcl
===================================================================
--- trunk/tkabber/plugins/richtext/emoticons.tcl	2007-02-11 19:34:35 UTC (rev 931)
+++ trunk/tkabber/plugins/richtext/emoticons.tcl	2007-02-11 22:06:29 UTC (rev 932)
@@ -22,6 +22,11 @@
 	-group {Rich Text} \
 	-group Chat
 
+    ::custom::defvar options(show_emoticons) 1 \
+	[::msgcat::mc "Show images for emoticons."] \
+	-type boolean -group Emoticons \
+	-command [namespace current]::toggle_emoticons
+
     set options(no_theme) [::msgcat::mc "None"]
     set options(active_theme) $options(no_theme)
 	
@@ -92,6 +97,7 @@
 
     if {[info exists emoticons($word)]} {
 	$txt image create end -image $emoticons($word)
+	$txt tag add emoticon_image "end-2char"
     }
 }
 
@@ -487,9 +493,23 @@
 }
 
 proc emoticons::configure_richtext_widget {w} {
-    $w tag configure emoticon -elide 1
+    variable options
+
+    if {$options(show_emoticons)} {
+	$w tag configure emoticon -elide 1
+	$w tag configure emoticon_image -elide 0
+    } else {
+	$w tag configure emoticon -elide 0
+	$w tag configure emoticon_image -elide 1
+    }
 }
 
+proc emoticons::toggle_emoticons {args} {
+    foreach w [::richtext::textlist] {
+	configure_richtext_widget $w
+    }
+}
+
 proc emoticons::enumerate_available_themes {} {
     set dirs [concat \
 		  [glob -nocomplain -directory [fullpath emoticons] *] \

Modified: trunk/tkabber/plugins/richtext/stylecodes.tcl
===================================================================
--- trunk/tkabber/plugins/richtext/stylecodes.tcl	2007-02-11 19:34:35 UTC (rev 931)
+++ trunk/tkabber/plugins/richtext/stylecodes.tcl	2007-02-11 22:06:29 UTC (rev 932)
@@ -206,8 +206,6 @@
 }
 
 proc stylecodes::toggle_codes {args} {
-    variable options
-
     foreach w [::richtext::textlist] {
 	configure_richtext_widget $w
     }

Modified: trunk/tkabber/plugins/windows/taskbar.tcl
===================================================================
--- trunk/tkabber/plugins/windows/taskbar.tcl	2007-02-11 19:34:35 UTC (rev 931)
+++ trunk/tkabber/plugins/windows/taskbar.tcl	2007-02-11 22:06:29 UTC (rev 932)
@@ -112,13 +112,18 @@
 
 proc taskbar::callback {m event x y} {
     switch -- $event {
-	WM_LBUTTONUP {
-	    ifacetk::systray::toggle_state
+	WM_LBUTTONDBLCLK {
+	    ifacetk::systray::restore
 	}
 
 	WM_RBUTTONUP {
 	    $m post $x $y
 	}
+
+	WM_LBUTTONUP {
+	    # Do nothing: work around a bug (?) in Winico which
+	    # does somehow interpret single clicks by itself
+	}
     }
 }
 
@@ -183,3 +188,4 @@
 
 ##########################################################################
 
+# vim:ts=8:sw=4:sts=4:noet



More information about the Tkabber-dev mailing list