[Tkabber-dev] r1188 - in trunk/tkabber: . plugins/general plugins/windows

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Thu Aug 16 13:00:47 MSD 2007


Author: sergei
Date: 2007-08-16 13:00:46 +0400 (Thu, 16 Aug 2007)
New Revision: 1188

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/plugins/general/tkcon.tcl
   trunk/tkabber/plugins/windows/console.tcl
Log:
	* plugins/general/tkcon.tcl: Fixed clearing checkmark in main menu on
	  closing TkCon window.

	* plugins/windows/console.tcl: Fixed clearing checkmark in main menu on
	  closing console window.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-08-15 22:42:46 UTC (rev 1187)
+++ trunk/tkabber/ChangeLog	2007-08-16 09:00:46 UTC (rev 1188)
@@ -13,6 +13,12 @@
 	* tkabber.tcl: Reordered files sourcesd at Tkabber start to allow
 	  registering jabber:x:oob as a disco feature in messages.tcl.
 
+	* plugins/general/tkcon.tcl: Fixed clearing checkmark in main menu on
+	  closing TkCon window.
+
+	* plugins/windows/console.tcl: Fixed clearing checkmark in main menu on
+	  closing console window.
+
 2007-08-15  Sergei Golovan  <sgolovan at nes.ru>
 
 	* examples/tools/jsend.tcl, examples/tools/rssbot.tcl: Fixed sending

Modified: trunk/tkabber/plugins/general/tkcon.tcl
===================================================================
--- trunk/tkabber/plugins/general/tkcon.tcl	2007-08-15 22:42:46 UTC (rev 1187)
+++ trunk/tkabber/plugins/general/tkcon.tcl	2007-08-16 09:00:46 UTC (rev 1188)
@@ -20,6 +20,7 @@
 }
 
 namespace eval tkcon {
+    variable onceP 1
     variable showP 0
 }
 
@@ -36,6 +37,7 @@
 }
 
 proc tkcon::show_console {} {
+    variable onceP
     variable showP
 
     if {[llength [info commands ::tkcon::*]] <= 0} {
@@ -44,10 +46,23 @@
 
     if {$showP} {
 	tkcon show
+
+	if {$onceP} {
+	    wm protocol $::tkcon::PRIV(root) WM_DELETE_WINDOW \
+		    [namespace current]::hide_console
+	    set onceP 0
+	}
     } else {
 	tkcon hide
     }
 }
 
+proc tkcon::hide_console {} {
+    variable showP
+
+    tkcon hide
+    set showP 0
+}
+
 hook::add finload_hook [namespace current]::tkcon::add_tkcon_to_tkabber_menu
 

Modified: trunk/tkabber/plugins/windows/console.tcl
===================================================================
--- trunk/tkabber/plugins/windows/console.tcl	2007-08-15 22:42:46 UTC (rev 1187)
+++ trunk/tkabber/plugins/windows/console.tcl	2007-08-16 09:00:46 UTC (rev 1188)
@@ -1,28 +1,38 @@
 # $Id$
 # Add a console menu item under windows
 
-namespace eval Console {
+namespace eval console {
     variable showConsole 0
     hook::add finload_hook [namespace current]::add_console_menu
-    
-    proc add_console_menu {} {
-        catch {
-            set ndx [.menubar index [::msgcat::mc "Help"]]
-            set menu [.menubar entrycget $ndx -menu]
-            $menu add separator
-            $menu add checkbutton -label [::msgcat::mc "Show console"] \
+
+    console eval {
+	bind . <Map> {
+	    consoleinterp eval {set ::plugins::console::showConsole 1}
+	}
+    	bind . <Unmap> {
+	    consoleinterp eval {set ::plugins::console::showConsole 0}
+	}
+    }
+}
+
+proc console::add_console_menu {} {
+    catch {
+        set ndx [.menubar index [::msgcat::mc "Help"]]
+        set menu [.menubar entrycget $ndx -menu]
+        $menu add separator
+        $menu add checkbutton -label [::msgcat::mc "Show console"] \
                 -command [namespace current]::show_console \
                 -variable [namespace current]::showConsole
-            show_console
-        }
+        show_console
     }
+}
     
-    proc show_console {} {
-        variable showConsole
-        if {$showConsole} {
-            console show
-        } else {
-            console hide
-        }
+proc console::show_console {} {
+    variable showConsole
+    if {$showConsole} {
+        console show
+    } else {
+        console hide
     }
 }
+



More information about the Tkabber-dev mailing list