[Tkabber-dev] r879 - in trunk/tkabber: . ifacetk plugins/general

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Jan 19 00:37:24 MSK 2007


Author: sergei
Date: 2007-01-19 00:37:19 +0300 (Fri, 19 Jan 2007)
New Revision: 879

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/chats.tcl
   trunk/tkabber/ifacetk/bwidget_workarounds.tcl
   trunk/tkabber/ifacetk/iface.tcl
   trunk/tkabber/muc.tcl
   trunk/tkabber/plugins/general/headlines.tcl
   trunk/tkabber/plugins/general/message_archive.tcl
   trunk/tkabber/plugins/general/rawxml.tcl
Log:
	* muc.tcl: Fixed reporting own presences in MUC rooms.

	* chats.tcl, ifacetk/bwidget_workarounds.tcl, ifacetk/iface.tcl,
	  plugins/general/headlines.tcl, plugins/general/message_archive.tcl,
	  plugins/general/rawxml.tcl: Made a step toward using panedwindow
	  from Tk 8.5 and newer. It is still buggy yet, so this feature is
	  disabled for now. PanedWindow from BWidget is still used.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-01-17 20:54:10 UTC (rev 878)
+++ trunk/tkabber/ChangeLog	2007-01-18 21:37:19 UTC (rev 879)
@@ -1,3 +1,13 @@
+2007-01-18  Sergei Golovan  <sgolovan at nes.ru>
+
+	* muc.tcl: Fixed reporting own presences in MUC rooms.
+
+	* chats.tcl, ifacetk/bwidget_workarounds.tcl, ifacetk/iface.tcl,
+	  plugins/general/headlines.tcl, plugins/general/message_archive.tcl,
+	  plugins/general/rawxml.tcl: Made a step toward using panedwindow
+	  from Tk 8.5 and newer. It is still buggy yet, so this feature is
+	  disabled for now. PanedWindow from BWidget is still used.
+
 2007-01-17  Sergei Golovan  <sgolovan at nes.ru>
 
 	* plugins/unix/icon.tcl: Added plugin, which sets Tkabber titlebar

Modified: trunk/tkabber/chats.tcl
===================================================================
--- trunk/tkabber/chats.tcl	2007-01-17 20:54:10 UTC (rev 878)
+++ trunk/tkabber/chats.tcl	2007-01-18 21:37:19 UTC (rev 879)
@@ -466,8 +466,8 @@
     pack $cw.pw0 -fill both -expand yes
 
 
-    set upw [$cw.pw0 add -weight 1 -minsize 0]
-    set dow [$cw.pw0 add -weight 0 -minsize 0]
+    set upw [PanedWinAdd $cw.pw0 -weight 1 -minsize 0]
+    set dow [PanedWinAdd $cw.pw0 -weight 0 -minsize 0]
 
     set isw [ScrolledWindow $cw.isw -scrollbar vertical]
     pack $cw.isw -fill both -expand yes -side bottom -in $dow
@@ -481,9 +481,9 @@
 	PanedWin $cw.pw -side bottom -pad 2 -width 8
 	pack $cw.pw -fill both -expand yes -in $upw
 
-	set cf [$cw.pw add -weight 1 -minsize 0]
+	set cf [PanedWinAdd $cw.pw -weight 1 -minsize 0]
 
-	set uw [$cw.pw add -weight 0 -minsize 0]
+	set uw [PanedWinAdd $cw.pw -weight 0 -minsize 0]
 	set chats(userswin,$chatid) $uw.users
 
 	set rosterwidth [option get . chatRosterWidth [winfo class .]]

Modified: trunk/tkabber/ifacetk/bwidget_workarounds.tcl
===================================================================
--- trunk/tkabber/ifacetk/bwidget_workarounds.tcl	2007-01-17 20:54:10 UTC (rev 878)
+++ trunk/tkabber/ifacetk/bwidget_workarounds.tcl	2007-01-18 21:37:19 UTC (rev 879)
@@ -112,14 +112,141 @@
     return $path
 }
 
-proc PanedWin {path args} {
-    if {[catch {
-	     eval [list PanedWindow $path] $args -activator button
-	 } res]} {
-	return [eval [list PanedWindow $path] $args]
-    } else {
-	return $res
+##########################################################################
+if {0 && [info tclversion] >= 8.5} {
+
+    proc PanedWin {path args} {
+	set newargs [list -showhandle 0]
+	set pad 0
+	foreach {key val} $args {
+	    switch -- $key {
+		-side {
+		    switch -- $val {
+			left -
+			right {
+			    lappend newargs -orient vertical
+			}
+			top -
+			bottom {
+			    lappend newargs -orient horizontal
+			}
+		    }
+		}
+		-pad {
+		    set pad [expr {$pad + $val}]
+		}
+		-width {
+		    set pad [expr {$pad + ($val >> 2)}]
+		}
+	    }
+	}
+
+	if {$pad > 0} {
+	    lappend newargs -sashpad $pad
+	}
+
+	return [eval [list panedwindow $path] $newargs]
     }
+
+    proc PanedWinAdd {path args} {
+	set newargs {}
+	foreach {key val} $args {
+	    switch -- $key {
+		-minsize {
+		    lappend newargs -minsize $val
+		}
+		-weight {
+		    if {$val == 0} {
+			lappend newargs -stretch never
+		    } else {
+			lappend newargs -stretch always
+		    }
+		}
+	    }
+	}
+	set idx [llength [$path panes]]
+	set f [frame $path.frame$idx]
+	eval [list $path add $f] $newargs
+	return $f
+    }
+
+    proc PanedWinConf {path index args} {
+	lassign $args key val
+	set f [lindex [$path panes] $index]
+	switch -- [llength $args] {
+	    1 {
+		switch -- $key {
+		    -width {
+			return [$path panecget $f -width]
+		    }
+		    default {
+			return -code error "PanedWinConf: Unknown option $key"
+		    }
+		}
+	    }
+	    2 {
+		switch -- $key {
+		    -width {
+			puts "$index $f $val"
+			$path paneconfigure $f -width $val
+		    }
+		    default {
+			return -code error "PanedWinConf: Unknown option $key"
+		    }
+		}
+	    }
+	    default {
+		return -code error "PanedWinConf: Illegal number of arguments"
+	    }
+	}
+    }
+
+} else {
+
+    proc PanedWin {path args} {
+	if {[catch {
+		 eval [list PanedWindow $path] $args -activator button
+	     } res]} {
+	    return [eval [list PanedWindow $path] $args]
+	} else {
+	    return $res
+	}
+    }
+
+    proc PanedWinAdd {path args} {
+	return [eval [list $path add] $args]
+    }
+
+    proc PanedWinConf {path index args} {
+	lassign $args key val
+	set f [winfo parent [$path getframe $index]]
+	switch -- [llength $args] {
+	    1 {
+		switch -- $key {
+		    -width {
+			return [$f cget -width]
+		    }
+		    default {
+			return -code error "PanedWinConf: Unknown option $key"
+		    }
+		}
+	    }
+	    2 {
+		switch -- $key {
+		    -width {
+			$f configure -width $val
+		    }
+		    default {
+			return -code error "PanedWinConf: Unknown option $key"
+		    }
+		}
+	    }
+	    default {
+		return -code error "PanedWinConf: Illegal number of arguments"
+	    }
+	}
+    }
+
 }
 
 ##########################################################################

Modified: trunk/tkabber/ifacetk/iface.tcl
===================================================================
--- trunk/tkabber/ifacetk/iface.tcl	2007-01-17 20:54:10 UTC (rev 878)
+++ trunk/tkabber/ifacetk/iface.tcl	2007-01-18 21:37:19 UTC (rev 879)
@@ -620,8 +620,6 @@
     global descmenu
     variable mf
     variable rosterwidth
-    variable rw
-    variable nw
     variable ssl_ind
     variable main_window_title
     variable options
@@ -724,8 +722,8 @@
     if {$usetabbar} {
 	set pw [PanedWin [$mf getframe].pw -side bottom -pad 2 -width 8]
 	pack $pw -fill both -expand yes
-	set rw [$pw add -minsize 0 -weight 0]
-	set nw [$pw add -minsize 32 -weight 1]
+	set rw [PanedWinAdd $pw -minsize 0 -weight 0]
+	set nw [PanedWinAdd $pw -minsize 32 -weight 1]
 
 	roster::create .roster -width $rosterwidth -height 300 \
 	    -popup [namespace current]::roster::popup_menu \
@@ -744,7 +742,7 @@
 
 	NoteBook .nb -width 400 -side $side
 	pack .nb -side right -in $nw -fill both -expand yes
-	[winfo parent $rw] configure -width $rosterwidth
+	PanedWinConf $pw 0 -width $rosterwidth
 
 	event add <<CollapseRoster>> <Control-Key-r>
 	bind . <<CollapseRoster>>      [list [namespace current]::collapse_roster]
@@ -1338,19 +1336,20 @@
 ###############################################################################
 
 proc ifacetk::collapse_roster {} {
-    variable rw
-    variable nw
+    variable mf
     variable rosterwidth
 
-    set r [[winfo parent $rw] cget -width]
-    set n [[winfo parent $nw] cget -width]
+    set pw [$mf getframe].pw
+    set r [PanedWinConf $pw 0 -width]
+    set n [PanedWinConf $pw 1 -width]
+
     if {$r > 0} {
 	set rosterwidth $r
-	[winfo parent $rw] configure -width 0
-	[winfo parent $nw] configure -width [expr {$r + $n}]
+	PanedWinConf $pw 0 -width 0
+	PanedWinConf $pw 1 -width [expr {$r + $n}]
     } else {
-	[winfo parent $rw] configure -width $rosterwidth
-	[winfo parent $nw] configure -width [expr {$r + $n - $rosterwidth}]
+	PanedWinConf $pw 0 -width $rosterwidth
+	PanedWinConf $pw 1 -width [expr {$r + $n - $rosterwidth}]
     }
 }
 

Modified: trunk/tkabber/muc.tcl
===================================================================
--- trunk/tkabber/muc.tcl	2007-01-17 20:54:10 UTC (rev 878)
+++ trunk/tkabber/muc.tcl	2007-01-18 21:37:19 UTC (rev 879)
@@ -1097,8 +1097,6 @@
 
     set jid $group/$nick
 
-    if {[::chat::is_our_jid $chatid $jid]} return
-
     set msg ""
 
     set report_entered [expr {$entered && $::muc::options(gen_enter_exit_msgs) \

Modified: trunk/tkabber/plugins/general/headlines.tcl
===================================================================
--- trunk/tkabber/plugins/general/headlines.tcl	2007-01-17 20:54:10 UTC (rev 878)
+++ trunk/tkabber/plugins/general/headlines.tcl	2007-01-18 21:37:19 UTC (rev 879)
@@ -120,8 +120,8 @@
     PanedWin $hw.pw -side right -pad 0 -width 8
     pack $hw.pw -fill both -expand yes
 
-    set uw [$hw.pw add -weight 1]
-    set dw [$hw.pw add -weight 1]
+    set uw [PanedWinAdd $hw.pw -weight 1]
+    set dw [PanedWinAdd $hw.pw -weight 1]
 
     frame $dw.date
     label $dw.date.label -anchor w -text [::msgcat::mc "Date:"]

Modified: trunk/tkabber/plugins/general/message_archive.tcl
===================================================================
--- trunk/tkabber/plugins/general/message_archive.tcl	2007-01-17 20:54:10 UTC (rev 878)
+++ trunk/tkabber/plugins/general/message_archive.tcl	2007-01-18 21:37:19 UTC (rev 879)
@@ -68,8 +68,8 @@
     PanedWin $w.pw -side right -pad 0 -width 8
     pack $w.pw -fill both -expand yes
 
-    set uw [$w.pw add -weight 0 -minsize 100]
-    set dw [$w.pw add -weight 1 -minsize 100]
+    set uw [PanedWinAdd $w.pw -weight 0 -minsize 100]
+    set dw [PanedWinAdd $w.pw -weight 1 -minsize 100]
 
     frame $dw.title
     label $dw.title.label -font $font -text $label(from)

Modified: trunk/tkabber/plugins/general/rawxml.tcl
===================================================================
--- trunk/tkabber/plugins/general/rawxml.tcl	2007-01-17 20:54:10 UTC (rev 878)
+++ trunk/tkabber/plugins/general/rawxml.tcl	2007-01-18 21:37:19 UTC (rev 879)
@@ -197,8 +197,8 @@
     PanedWin $w.pw -side right -pad 0 -width 8
     pack $w.pw -fill both -expand yes
 
-    set uw [$w.pw add -weight 1 -minsize 100]
-    set dw [$w.pw add -weight 0 -minsize 32]
+    set uw [PanedWinAdd $w.pw -weight 1 -minsize 100]
+    set dw [PanedWinAdd $w.pw -weight 0 -minsize 32]
 
 
     set isw [ScrolledWindow $w.isw -scrollbar vertical]



More information about the Tkabber-dev mailing list