[Tkabber-dev] r1305 - trunk/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Nov 9 20:31:32 MSK 2007


Author: sergei
Date: 2007-11-09 20:31:31 +0300 (Fri, 09 Nov 2007)
New Revision: 1305

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/chats.tcl
   trunk/tkabber/utils.tcl
Log:
	* chats.tcl, utils.tcl: Fixed chatlog window scrolling if a tabbar
	  row is added/removed when a tab is opened/closed.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-11-08 18:45:35 UTC (rev 1304)
+++ trunk/tkabber/ChangeLog	2007-11-09 17:31:31 UTC (rev 1305)
@@ -1,3 +1,8 @@
+2007-11-09  Sergei Golovan  <sgolovan at nes.ru>
+
+	* chats.tcl, utils.tcl: Fixed chatlog window scrolling if a tabbar
+	  row is added/removed when a tab is opened/closed.
+
 2007-11-08  Sergei Golovan  <sgolovan at nes.ru>
 
 	* msgs/pl.msg: Updated Polish translation (thanks to Irek Chmielowiec).

Modified: trunk/tkabber/chats.tcl
===================================================================
--- trunk/tkabber/chats.tcl	2007-11-08 18:45:35 UTC (rev 1304)
+++ trunk/tkabber/chats.tcl	2007-11-09 17:31:31 UTC (rev 1305)
@@ -520,6 +520,8 @@
 
     $csw setwidget $cf.chat
 
+    reverse_scroll $cf.chat
+
     focus $cw.input
 
     bind $cw.input <Shift-Key-Return> { }

Modified: trunk/tkabber/utils.tcl
===================================================================
--- trunk/tkabber/utils.tcl	2007-11-08 18:45:35 UTC (rev 1304)
+++ trunk/tkabber/utils.tcl	2007-11-09 17:31:31 UTC (rev 1305)
@@ -534,4 +534,32 @@
     }
 }
 
+##################################################################
+
+proc reverse_scroll {w} {
+    set command [$w cget -yscrollcommand]
+    $w configure -yscrollcommand [list store_scroll $w $command]
+    bind $w <Configure> {move_scroll %W}
+    bind $w <Destroy> {+clean_scroll %W}
+}
+
+proc store_scroll {w command lo hi} {
+    set ::lo($w) $lo
+    set ::hi($w) $hi
+    eval $command {$lo $hi}
+}
+
+proc move_scroll {w} {
+    if {![info exists ::lo($w)] || ![info exists ::hi($w)]} return
+    foreach {lo hi} [$w yview] break
+    if {$hi < 1.0} {
+	$w yview moveto [expr {$lo + ($::hi($w) - $::lo($w)) - ($hi - $lo)}]
+    }
+}
+
+proc clean_scroll {w} {
+    catch {unset ::lo($w)}
+    catch {unset ::hi($w)}
+}
+
 # vim:ts=8:sw=4:sts=4:noet



More information about the Tkabber-dev mailing list