[Tkabber-dev] r885 - in trunk/tkabber: . examples/xrdb jabberlib-tclxml plugins/chat plugins/iq

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sat Jan 27 14:05:20 MSK 2007


Author: sergei
Date: 2007-01-27 14:05:13 +0300 (Sat, 27 Jan 2007)
New Revision: 885

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/datagathering.tcl
   trunk/tkabber/examples/xrdb/badlop-dark.xrdb
   trunk/tkabber/examples/xrdb/black.xrdb
   trunk/tkabber/examples/xrdb/dark.xrdb
   trunk/tkabber/examples/xrdb/dark2.xrdb
   trunk/tkabber/examples/xrdb/green.xrdb
   trunk/tkabber/examples/xrdb/ice.xrdb
   trunk/tkabber/examples/xrdb/light.xrdb
   trunk/tkabber/examples/xrdb/lighthouse.xrdb
   trunk/tkabber/examples/xrdb/teopetuk.xrdb
   trunk/tkabber/examples/xrdb/warm.xrdb
   trunk/tkabber/jabberlib-tclxml/jabberlib.tcl
   trunk/tkabber/muc.tcl
   trunk/tkabber/plugins/chat/muc_ignore.tcl
   trunk/tkabber/plugins/iq/ping.tcl
   trunk/tkabber/register.tcl
Log:
	* datagathering.tcl: Made data form windows transient and made
	  default window height smaller.

	* examples/xrdb/badlop-dark.xrdb, examples/xrdb/black.xrdb,
	  examples/xrdb/dark.xrdb, examples/xrdb/dark2.xrdb,
	  examples/xrdb/green.xrdb, examples/xrdb/ice.xrdb,
	  examples/xrdb/light.xrdb, examples/xrdb/lighthouse.xrdb,
	  examples/xrdb/teopetuk.xrdb, examples/xrdb/warm.xrdb: Added
	  *readonlyBackground resource definition (it is used in MUC
	  management).

	* jabberlib-tclxml/jabberlib.tcl: Fixed unsetting variable, which
	  stores received IQ's id.

	* muc.tcl: Moved MUC room menu items to a submenu. Also, increased
	  width of input entries in configuration forms.

	* plugins/chat/muc_ignore.tcl, plugins/iq/ping.tcl: Fixed user
	  messages.

	* register.tcl: Made register form scrollable (see
	  http://www.jabber.ru/bugzilla/show_bug.cgi?id=313).


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/ChangeLog	2007-01-27 11:05:13 UTC (rev 885)
@@ -1,3 +1,28 @@
+2007-01-27  Sergei Golovan  <sgolovan at nes.ru>
+
+	* datagathering.tcl: Made data form windows transient and made
+	  default window height smaller.
+
+	* examples/xrdb/badlop-dark.xrdb, examples/xrdb/black.xrdb,
+	  examples/xrdb/dark.xrdb, examples/xrdb/dark2.xrdb,
+	  examples/xrdb/green.xrdb, examples/xrdb/ice.xrdb,
+	  examples/xrdb/light.xrdb, examples/xrdb/lighthouse.xrdb,
+	  examples/xrdb/teopetuk.xrdb, examples/xrdb/warm.xrdb: Added
+	  *readonlyBackground resource definition (it is used in MUC
+	  management).
+
+	* jabberlib-tclxml/jabberlib.tcl: Fixed unsetting variable, which
+	  stores received IQ's id.
+
+	* muc.tcl: Moved MUC room menu items to a submenu. Also, increased
+	  width of input entries in configuration forms.
+
+	* plugins/chat/muc_ignore.tcl, plugins/iq/ping.tcl: Fixed user
+	  messages.
+
+	* register.tcl: Made register form scrollable (see
+	  http://www.jabber.ru/bugzilla/show_bug.cgi?id=313).
+
 2007-01-26  Sergei Golovan  <sgolovan at nes.ru>
 
 	* jabberlib-tclxml/jabberlib.tcl: Added -timeout option to send_iq.

Modified: trunk/tkabber/datagathering.tcl
===================================================================
--- trunk/tkabber/datagathering.tcl	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/datagathering.tcl	2007-01-27 11:05:13 UTC (rev 885)
@@ -556,6 +556,7 @@
     wm group $w .
     wm title $w ""
     wm iconname $w ""
+    wm transient $w .
     wm withdraw $w
     set geometry [option get $w geometry XData]
     if {$geometry != ""} {
@@ -565,6 +566,7 @@
     set sw [ScrolledWindow $w.sw]
     set sf [ScrollableFrame $w.fields -constrainedwidth yes]
     set f [$sf getframe]
+    $sf configure -height 10
     $sw setwidget $sf
     data::fill_fields $f $items
 

Modified: trunk/tkabber/examples/xrdb/badlop-dark.xrdb
===================================================================
--- trunk/tkabber/examples/xrdb/badlop-dark.xrdb	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/examples/xrdb/badlop-dark.xrdb	2007-01-27 11:05:13 UTC (rev 885)
@@ -30,6 +30,7 @@
 *troughColor:			    #424242
 
 *background:			    #5e5e5e
+*readonlyBackground:		    #3f3f3f
 *foreground:			    #ffffff
 
 ! Colors, which are used when mouse is over the item
@@ -198,7 +199,6 @@
 *Chat.inputheight:                  3
 
 ! Colors of tab labels (when in tabbed mode)
-*NoteBook*Entry.readonlyBackground: #3f3f3f
 ! Usual color
 *NoteBook.alertColor0:              #ffffff
 

Modified: trunk/tkabber/examples/xrdb/black.xrdb
===================================================================
--- trunk/tkabber/examples/xrdb/black.xrdb	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/examples/xrdb/black.xrdb	2007-01-27 11:05:13 UTC (rev 885)
@@ -2,6 +2,7 @@
 *foreground:			    grey
 *disabledBackground:		    black
 *disabledForeground:		    grey50
+*readonlyBackground:		    #000000
 *errorForeground:		    coral3
 *activeBackground:		    grey30
 *activeForeground:		    grey100
@@ -82,7 +83,6 @@
 
 *NoteBook*Entry.background:	    #000000
 *NoteBook*Entry.disabledBackground: #000000
-*NoteBook*Entry.readonlyBackground: #000000
 *NoteBook*Entry.foreground:	    grey
 
 *Customize.varforeground:	    cornflowerblue

Modified: trunk/tkabber/examples/xrdb/dark.xrdb
===================================================================
--- trunk/tkabber/examples/xrdb/dark.xrdb	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/examples/xrdb/dark.xrdb	2007-01-27 11:05:13 UTC (rev 885)
@@ -19,6 +19,7 @@
 
 *background:			    #5e5e5e
 *foreground:			    #ffffff
+*readonlyBackground:		    #5e5e5e
 *disabledBackground:		    #5e5e5e
 *disabledForeground:		    #cccccc
 *errorForeground:		    indianred1
@@ -214,7 +215,6 @@
 *Entry.borderWidth:		    1
 
 *NoteBook*Entry.background:	    #424242
-*NoteBook*Entry.readonlyBackground: #5e5e5e
 *NoteBook*Entry.disabledBackground: #5e5e5e
 *NoteBook*Entry.foreground:	    #ffffff
 

Modified: trunk/tkabber/examples/xrdb/dark2.xrdb
===================================================================
--- trunk/tkabber/examples/xrdb/dark2.xrdb	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/examples/xrdb/dark2.xrdb	2007-01-27 11:05:13 UTC (rev 885)
@@ -19,6 +19,7 @@
 
 *background:			    #3f3f3f
 *foreground:			    #bfbfae
+*readonlyBackground:		    #3f3f3f
 *disabledForeground:		    #a9a999
 *errorForeground:		    #f99393
 *disabledBackground:		    #3f3f3f
@@ -226,7 +227,6 @@
 *Entry.borderWidth:		    1
 
 *NoteBook*Entry.background:	    #66685e
-*NoteBook*Entry.readonlyBackground: #3f3f3f
 *NoteBook*Entry.disabledBackground: #3f3f3f
 *NoteBook*Entry.foreground:	    #bfbfae
 

Modified: trunk/tkabber/examples/xrdb/green.xrdb
===================================================================
--- trunk/tkabber/examples/xrdb/green.xrdb	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/examples/xrdb/green.xrdb	2007-01-27 11:05:13 UTC (rev 885)
@@ -16,6 +16,7 @@
 
 *background:		    ForestGreen
 *foreground:		    LawnGreen
+*readonlyBackground:	    ForestGreen
 *disabledBackground:	    ForestGreen
 *disabledForeground:	    PaleGreen3
 *activeBackground:	    PaleGreen3
@@ -130,7 +131,6 @@
 *Entry.borderWidth:	    1
 
 *NoteBook*Entry.background:     ForestGreen
-*NoteBook*Entry.readonlyBackground: ForestGreen
 *NoteBook*Entry.disabledBackground: ForestGreen
 *NoteBook*Entry.foreground:     LawnGreen
 

Modified: trunk/tkabber/examples/xrdb/ice.xrdb
===================================================================
--- trunk/tkabber/examples/xrdb/ice.xrdb	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/examples/xrdb/ice.xrdb	2007-01-27 11:05:13 UTC (rev 885)
@@ -19,6 +19,7 @@
 
 *background:			    #d3d3dd
 *foreground:			    #000000
+*readonlyBackground:		    #d3d3dd
 *disabledBackground:		    #d3d3dd
 *disabledForeground:		    #535373
 *errorForeground:		    firebrick4
@@ -222,7 +223,6 @@
 *Entry.borderWidth:		    1
 
 *NoteBook*Entry.background:	    #e5e5f7
-*NoteBook*Entry.readonlyBackground: #d3d3dd
 *NoteBook*Entry.disabledBackground: #d3d3dd
 *NoteBook*Entry.foreground:	    #000000
 

Modified: trunk/tkabber/examples/xrdb/light.xrdb
===================================================================
--- trunk/tkabber/examples/xrdb/light.xrdb	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/examples/xrdb/light.xrdb	2007-01-27 11:05:13 UTC (rev 885)
@@ -19,6 +19,7 @@
 
 *background:			    #f0f0f0
 *foreground:			    #000000
+*readonlyBackground:		    #f0f0f0
 *disabledBackground:		    #f0f0f0
 *disabledForeground:		    #999999
 *errorForeground:		    firebrick4
@@ -224,7 +225,6 @@
 *Entry.borderWidth:		    1
 
 *NoteBook*Entry.background:	    #f8f8f8
-*NoteBook*Entry.readonlyBackground: #f0f0f0
 *NoteBook*Entry.disabledBackground: #f0f0f0
 *NoteBook*Entry.foreground:	    #000000
 

Modified: trunk/tkabber/examples/xrdb/lighthouse.xrdb
===================================================================
--- trunk/tkabber/examples/xrdb/lighthouse.xrdb	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/examples/xrdb/lighthouse.xrdb	2007-01-27 11:05:13 UTC (rev 885)
@@ -19,6 +19,7 @@
 
 *background:			    #eeeee0
 *foreground:			    #000000
+*readonlyBackground:		    #eeeee0
 *disabledForeground:		    #747474
 *disabledBackground:		    #d6d6d6
 
@@ -210,7 +211,6 @@
 
 *NoteBook*Entry.background:	    #f5f5f5
 *NoteBook*Entry.disabledBackground: #e9e9e9
-*NoteBook*Entry.readonlyBackground: #eeeee0
 *NoteBook*Entry.foreground:	    #000000
 
 *Button.borderWidth:		    1

Modified: trunk/tkabber/examples/xrdb/teopetuk.xrdb
===================================================================
--- trunk/tkabber/examples/xrdb/teopetuk.xrdb	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/examples/xrdb/teopetuk.xrdb	2007-01-27 11:05:13 UTC (rev 885)
@@ -20,6 +20,7 @@
 
 *background:			    #dddddd
 *foreground:			    #000000
+*readonlyBackground:		    #dddddd
 *disabledForeground:		    #888888
 *errorForeground:		    firebrick
 
@@ -221,7 +222,6 @@
 
 *NoteBook*Entry.background:	    #eeeeee
 *NoteBook*Entry.disabledBackground: #dddddd
-*NoteBook*Entry.readonlyBackground: #dddddd
 *NoteBook*Entry.foreground:	    #000000
 
 *Button.borderWidth:		    1

Modified: trunk/tkabber/examples/xrdb/warm.xrdb
===================================================================
--- trunk/tkabber/examples/xrdb/warm.xrdb	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/examples/xrdb/warm.xrdb	2007-01-27 11:05:13 UTC (rev 885)
@@ -25,6 +25,7 @@
 ! Color of disabled items
 *disabledBackground:		    #d0b073
 *disabledForeground:		    #633333
+*readonlyBackground:		    #d0b073
 
 *errorForeground:		    firebrick
 
@@ -243,7 +244,6 @@
 *Entry.borderWidth:		    1
 
 *NoteBook*Entry.background:	    #b38047
-*NoteBook*Entry.readonlyBackground: #d0b073
 *NoteBook*Entry.disabledBackground: #d0b073
 *NoteBook*Entry.foreground:	    #000000
 

Modified: trunk/tkabber/jabberlib-tclxml/jabberlib.tcl
===================================================================
--- trunk/tkabber/jabberlib-tclxml/jabberlib.tcl	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/jabberlib-tclxml/jabberlib.tcl	2007-01-27 11:05:13 UTC (rev 885)
@@ -679,8 +679,9 @@
 
     foreach id [array names iq] {
 	if {$id != "num"} {
-	    uplevel #0 $iq($id) [list DISCONNECT [::msgcat::mc "Disconnected"]]
+	    set cmd $iq($id)
 	    unset iq($id)
+	    uplevel #0 $cmd [list DISCONNECT [::msgcat::mc "Disconnected"]]
 	}
     }
 
@@ -1424,8 +1425,9 @@
 
     ::LOG "(jlib::iq_timeout) id: $id"
     if {[info exists iq($id)]} {
-	uplevel #0 $iq($id) [list TIMEOUT [::msgcat::mc "Timeout"]]
+	set cmd $iq($id)
 	unset iq($id)
+	uplevel #0 $cmd [list TIMEOUT [::msgcat::mc "Timeout"]]
     }
 }
 

Modified: trunk/tkabber/muc.tcl
===================================================================
--- trunk/tkabber/muc.tcl	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/muc.tcl	2007-01-27 11:05:13 UTC (rev 885)
@@ -117,23 +117,27 @@
     trace vdelete ::muc::muc_compatible($group) w \
 	[list muc::add_conference_menu_items $m $chatid $idx]
 
-    $m insert $idx command -label [::msgcat::mc "Destroy room"] \
+    set mm [menu $m.muc -tearoff 0]
+
+    $mm add command -label [::msgcat::mc "Configure room"] \
+	-command [list muc::request_config $chatid]
+    $mm add command -label [::msgcat::mc "Edit voice list"] \
+	-command [list muc::request_list role participant $chatid]
+    $mm add command -label [::msgcat::mc "Edit ban list"] \
+	-command [list muc::request_list affiliation outcast $chatid]
+    $mm add command -label [::msgcat::mc "Edit member list"] \
+	-command [list muc::request_list affiliation member $chatid]
+    $mm add command -label [::msgcat::mc "Edit moderator list"] \
+	-command [list muc::request_list role moderator $chatid]
+    $mm add command -label [::msgcat::mc "Edit admin list"] \
+	-command [list muc::request_list affiliation admin $chatid]
+    $mm add command -label [::msgcat::mc "Edit owner list"] \
+	-command [list muc::request_list affiliation owner $chatid]
+    $mm add separator
+    $mm add command -label [::msgcat::mc "Destroy room"] \
 	-command [list muc::request_destruction_dialog $chatid "" ""]
-    $m insert $idx command -label [::msgcat::mc "Edit owner list"] \
-	-command [list muc::request_list affiliation owner $chatid]
-    $m insert $idx command -label [::msgcat::mc "Edit admin list"] \
-	-command [list muc::request_list affiliation admin $chatid]
-    $m insert $idx command -label [::msgcat::mc "Edit moderator list"] \
-	-command [list muc::request_list role moderator $chatid]
-    $m insert $idx command -label [::msgcat::mc "Edit member list"] \
-	-command [list muc::request_list affiliation member $chatid]
-    $m insert $idx command -label [::msgcat::mc "Edit ban list"] \
-	-command [list muc::request_list affiliation outcast $chatid]
-    $m insert $idx command -label [::msgcat::mc "Edit voice list"] \
-	-command [list muc::request_list role participant $chatid]
-    $m insert $idx command -label [::msgcat::mc "Configure room"] \
-	-command [list muc::request_config $chatid]
-    $m insert $idx separator
+
+    $m insert $idx cascade -label [::msgcat::mc "MUC"] -menu $mm
 }
 
 ###############################################################################
@@ -680,11 +684,17 @@
 
     set row [incr listdata($f,rows)]
 
-    entry $f.nick$row -font $font -textvariable muc::listdata($f,nick,$row)
+    entry $f.nick$row \
+	-font $font \
+	-textvariable muc::listdata($f,nick,$row) \
+	-width 20
     grid $f.nick$row -row $row -column 0 -sticky we -padx 1m
     bindscroll $f.nick$row $sf
     
-    entry $f.jid$row -font $font -textvariable muc::listdata($f,jid,$row)
+    entry $f.jid$row \
+	-font $font \
+	-textvariable muc::listdata($f,jid,$row) \
+	-width 30
     grid $f.jid$row -row $row -column 1 -sticky we -padx 1m
     bindscroll $f.jid$row $sf
 
@@ -709,7 +719,10 @@
 	}
     }
 
-    entry $f.reason$row -font $font -textvariable muc::listdata($f,reason,$row)
+    entry $f.reason$row \
+	-font $font \
+	-textvariable muc::listdata($f,reason,$row) \
+	-width 40
     grid $f.reason$row -row $row -column 3 -sticky we -padx 1m
     bindscroll $f.reason$row $sf
 

Modified: trunk/tkabber/plugins/chat/muc_ignore.tcl
===================================================================
--- trunk/tkabber/plugins/chat/muc_ignore.tcl	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/plugins/chat/muc_ignore.tcl	2007-01-27 11:05:13 UTC (rev 885)
@@ -40,15 +40,16 @@
     hook::add post_custom_restore [namespace current]::restore_rules
 
     custom::defgroup {MUC Ignoring} \
-	[::msgcat::mc "Ignoring of groupchat and chat messages\
-		       from selected occupants of multi-user chats"] \
+	[::msgcat::mc "Ignoring groupchat and chat messages\
+		       from selected occupants of multi-user conference\
+		       rooms."] \
 	-group Privacy \
 	-group Chat
 
     custom::defvar options(transient_rules) 0 \
-	[::msgcat::mc "When set, all changes to the rules are in force\
-		       only until Tkabber is closed;\
-		       they are not saved and thus aren't restored at\
+	[::msgcat::mc "When set, all changes to the ignore rules are\
+		       applied only until Tkabber is closed;\
+		       they are not saved and thus will be not restored at\
 		       the next run."] \
 	-group {MUC Ignoring} \
 	-type boolean
@@ -557,7 +558,7 @@
     }
 
     add_win $w -title [::msgcat::mc "MUC Ignore Rules"] \
-	-tabtitle [::msgcat::mc "MUC Ignore Rules"] \
+	-tabtitle [::msgcat::mc "MUC Ignore"] \
 	-class MUCIgnoreRulesetEditor
 	#-raisecmd "focus [list $w.input]"
 

Modified: trunk/tkabber/plugins/iq/ping.tcl
===================================================================
--- trunk/tkabber/plugins/iq/ping.tcl	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/plugins/iq/ping.tcl	2007-01-27 11:05:13 UTC (rev 885)
@@ -11,7 +11,7 @@
 	-command [namespace current]::start_all
 
     custom::defvar options(timeout) 30 \
-	[::msgcat::mc "Reconnect to server if it does not reply (with result)\
+	[::msgcat::mc "Reconnect to server if it does not reply (with result\
 		       or with error) to ping (urn:xmpp:ping) request in\
 		       specified time interval (in seconds)."] \
 	-group IQ \

Modified: trunk/tkabber/register.tcl
===================================================================
--- trunk/tkabber/register.tcl	2007-01-26 18:54:43 UTC (rev 884)
+++ trunk/tkabber/register.tcl	2007-01-27 11:05:13 UTC (rev 885)
@@ -16,66 +16,71 @@
 	return -code error "register::open: -connection required"
     }
 
-    set sw .register$winid
-    toplevel $sw
-    wm group $sw .
+    set w .register$winid
+    toplevel $w
+    wm group $w .
     set title [format [::msgcat::mc "Register in %s"] $jid]
-    wm title $sw $title
-    wm iconname $sw $title
-    wm transient $sw .
+    wm title $w $title
+    wm iconname $w $title
+    wm transient $w .
     if {$::tcl_platform(platform) == "macintosh"} {
-        catch { unsupported1 style $sw floating sideTitlebar }
+        catch { unsupported1 style $w floating sideTitlebar }
     } elseif {$::aquaP} {
-        ::tk::unsupported::MacWindowStyle style $sw dBoxProc
+        ::tk::unsupported::MacWindowStyle style $w dBoxProc
     }
-    wm resizable $sw 0 0
+    wm resizable $w 0 0
 
-    ButtonBox $sw.bbox -spacing 0 -padx 10 -default 0
-    $sw.bbox add -text [::msgcat::mc "Register"] \
-	-command [list register::register $sw $connid $jid] \
-        -state disabled
-    $sw.bbox add -text [::msgcat::mc "Unregister"] \
-	-command [list register::unregister $sw $connid $jid] \
-        -state disabled
-    $sw.bbox add -text [::msgcat::mc "Cancel"] -command [list destroy $sw]
-    bind $sw <Return> "ButtonBox::invoke $sw.bbox default"
-    bind $sw <Escape> "ButtonBox::invoke $sw.bbox 2"
-    pack $sw.bbox -padx 2m -pady 2m -anchor e -side bottom
+    set hf [frame $w.error]
+    set vf [frame $w.vf]
+    set sep [Separator::create $w.sep -orient horizontal]
 
-    Separator::create $sw.sep -orient horizontal
-    pack $sw.sep -side bottom -fill x -pady 1m
+    set sw [ScrolledWindow $w.sw]
+    set sf [ScrollableFrame $w.fields -constrainedwidth yes]
+    set f [$sf getframe]
+    $sf configure -height 10
+    $sw setwidget $sf
 
-    frame $sw.error
-    pack $sw.error -expand no -fill x -padx 2m -pady 0m
+    bindscroll $f $sf
 
-    frame $sw.fields
-    pack $sw.fields -expand yes -fill both -padx 2m -pady 0m
+    set bbox [ButtonBox $w.bbox -spacing 0 -padx 10 -default 0]
+    $bbox add -text [::msgcat::mc "Register"] \
+	-command [list register::register $w $f $connid $jid] \
+        -state disabled
+    $bbox add -text [::msgcat::mc "Unregister"] \
+	-command [list register::unregister $w $connid $jid] \
+        -state disabled
+    $bbox add -text [::msgcat::mc "Cancel"] -command [list destroy $w]
+    bind $w <Return> "ButtonBox::invoke $bbox default"
+    bind $w <Escape> "ButtonBox::invoke $bbox 2"
+    pack $bbox -padx 2m -pady 2m -anchor e -side bottom
 
-    frame $sw.delim
-    pack $sw.delim -expand no -fill x -padx 2m -pady 1m
+    pack $sep -side bottom -fill x -pady 1m
+    pack $hf -side top
+    pack $vf -side left -pady 2m
+    pack $sw -side top -expand yes -fill both -padx 2m -pady 2m
 
-    bind $sw.fields <Destroy> [list data::cleanup $sw.fields]
+    bind $f <Destroy> [list data::cleanup $f]
 
-    wm withdraw $sw
+    wm withdraw $w
 
     jlib::send_iq get \
 	[jlib::wrapper:createtag query \
 	     -vars [list xmlns $::NS(register)]] \
 	-to $jid \
 	-connection $connid \
-	-command [list register::recv_fields $sw $connid $jid]
+	-command [list register::recv_fields $w $f $connid $jid]
     
     incr winid
 }
 
 
-proc register::recv_fields {sw connid jid res child} {
+proc register::recv_fields {w f connid jid res child} {
     debugmsg register "$res $child"
 
     switch -- $res {
 	ERR {
-	    destroy $sw
-	    MessageDlg ${sw}_err -aspect 50000 -icon error \
+	    destroy $w
+	    MessageDlg ${w}_err -aspect 50000 -icon error \
 		-message [format [::msgcat::mc "Registration: %s"] \
 				 [error_to_string $child]] \
 		-type user -buttons ok -default 0 -cancel 0
@@ -84,16 +89,26 @@
 	    jlib::wrapper:splitxml $child tag vars isempty chdata children
 
 	    if {[jlib::wrapper:getattr $vars xmlns] == $::NS(register)} {
-		data::fill_fields $sw.fields $children
+		data::fill_fields $f $children
 	    }
 
-	    $sw.bbox itemconfigure 0 -state normal
+	    $w.bbox itemconfigure 0 -state normal
 	    if {$jid != [jlib::connection_server $connid]} {
-		$sw.bbox itemconfigure 1 -state normal
+		$w.bbox itemconfigure 1 -state normal
 	    }
-	    wm deiconify $sw
 
-	    foreach child [winfo children $sw.fields] {
+	    update idletasks
+	    $w.error configure -width [expr {[winfo reqwidth $f] + [winfo pixels $f 1c]}]
+
+	    set h [winfo reqheight $f]
+	    set sh [winfo screenheight $w]
+	    if {$h > $sh - 200} {
+		set h [expr {$sh - 200}]
+	    }
+	    $w.vf configure -height $h
+	    wm deiconify $w
+
+	    foreach child [winfo children $w.fields] {
 		if {[cequal [winfo class $child] Entry] && \
 			[cequal [$child cget -state] normal]} {
 		    focus $child
@@ -102,59 +117,59 @@
 	    }
 	}
 	default {
-	    destroy $sw
+	    destroy $w
 	}
     }
 }
 
 
-proc register::register {sw connid jid} {
+proc register::register {w f connid jid} {
     variable data
 
-    destroy $sw.error.msg
-    $sw.bbox itemconfigure 0 -state disabled
-    $sw.bbox itemconfigure 1 -state disabled
+    destroy $w.error.msg
+    $w.bbox itemconfigure 0 -state disabled
+    $w.bbox itemconfigure 1 -state disabled
 
-    set restags [data::get_tags $sw.fields]
+    set restags [data::get_tags $f]
 
     jlib::send_iq set [jlib::wrapper:createtag query \
 			   -vars [list xmlns $::NS(register)] \
 			   -subtags $restags] \
 	-to $jid \
 	-connection $connid \
-	-command [list register::recv_result $sw $connid $jid]
+	-command [list register::recv_result $w $connid $jid]
 }
 
 
-proc register::unregister {sw connid jid} {
+proc register::unregister {w connid jid} {
     variable data
 
-    destroy $sw.error.msg
-    $sw.bbox itemconfigure 0 -state disabled
-    $sw.bbox itemconfigure 1 -state disabled
+    destroy $w.error.msg
+    $w.bbox itemconfigure 0 -state disabled
+    $w.bbox itemconfigure 1 -state disabled
 
     jlib::send_iq set [jlib::wrapper:createtag query \
 			   -vars [list xmlns $::NS(register)] \
 			   -subtags [list [jlib::wrapper:createtag remove]]] \
 	-to $jid \
 	-connection $connid \
-	-command [list register::recv_result $sw $connid $jid]
+	-command [list register::recv_result $w $connid $jid]
 }
 
 
-proc register::recv_result {sw connid jid res child} {
+proc register::recv_result {w connid jid res child} {
     global font
     variable data
 
     debugmsg register "$res $child"
     
     if {![cequal $res OK]} {
-	$sw.bbox itemconfigure 0 -state normal
+	$w.bbox itemconfigure 0 -state normal
 	if {$jid != [jlib::connection_server $connid]} {
-	    $sw.bbox itemconfigure 1 -state normal
+	    $w.bbox itemconfigure 1 -state normal
 	}
 
-	set m [message $sw.error.msg \
+	set m [message $w.error.msg \
 		       -aspect 50000 \
 		       -text [error_to_string $child] \
 		       -font $font \
@@ -166,17 +181,17 @@
     }
 
     set result [::msgcat::mc "Registration is successful!"]
-    label $sw.result -text $result
-    pack $sw.result -expand yes -fill both -after $sw.fields -anchor nw \
+    label $w.result -text $result
+    pack $w.result -expand yes -fill both -after $w.sw -anchor nw \
 	-padx 1c -pady 1c
-    pack forget $sw.fields
+    pack forget $w.sw
 
-    pack forget $sw.bbox
-    ButtonBox $sw.bbox1 -spacing 0 -padx 10 -default 0
-    $sw.bbox1 add -text [::msgcat::mc "Close"] -command [list destroy $sw]
-    bind $sw <Return> "ButtonBox::invoke $sw.bbox1 default"
-    bind $sw <Escape> "ButtonBox::invoke $sw.bbox1 0"
-    pack $sw.bbox1 -padx 2m -pady 2m -anchor e -side bottom -before $sw.sep
+    pack forget $w.bbox
+    set bbox [ButtonBox $w.bbox1 -spacing 0 -padx 10 -default 0]
+    $bbox add -text [::msgcat::mc "Close"] -command [list destroy $w]
+    bind $w <Return> "ButtonBox::invoke $w.bbox1 default"
+    bind $w <Escape> "ButtonBox::invoke $w.bbox1 0"
+    pack $bbox -padx 2m -pady 2m -anchor e -side bottom -before $w.sep
 }
 
 



More information about the Tkabber-dev mailing list