[Tkabber-dev] r893 - in trunk/tkabber: . plugins/search

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Jan 30 23:53:06 MSK 2007


Author: sergei
Date: 2007-01-30 23:53:03 +0300 (Tue, 30 Jan 2007)
New Revision: 893

Added:
   trunk/tkabber/plugins/search/custom.tcl
Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/custom.tcl
Log:
	* plugins/search/custom.tcl, custom.tcl: Added search in customize
	  window.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-01-30 19:25:42 UTC (rev 892)
+++ trunk/tkabber/ChangeLog	2007-01-30 20:53:03 UTC (rev 893)
@@ -10,6 +10,9 @@
 
 	* msgs/uk.msg: Updated (thanks to Artem Bondarenko).
 
+	* plugins/search/custom.tcl, custom.tcl: Added search in customize
+	  window.
+
 2007-01-27  Sergei Golovan  <sgolovan at nes.ru>
 
 	* datagathering.tcl: Made data form windows transient and made

Modified: trunk/tkabber/custom.tcl
===================================================================
--- trunk/tkabber/custom.tcl	2007-01-30 19:25:42 UTC (rev 892)
+++ trunk/tkabber/custom.tcl	2007-01-30 20:53:03 UTC (rev 893)
@@ -223,6 +223,8 @@
 
     variable curgroup $gid
 
+    hook::run open_custom_post_hook $w
+
     update idletasks
     goto $gid
 

Added: trunk/tkabber/plugins/search/custom.tcl
===================================================================
--- trunk/tkabber/plugins/search/custom.tcl	                        (rev 0)
+++ trunk/tkabber/plugins/search/custom.tcl	2007-01-30 20:53:03 UTC (rev 893)
@@ -0,0 +1,59 @@
+# $Id$
+
+namespace eval search {}
+
+namespace eval search::custom {
+    hook::add open_custom_post_hook [namespace current]::setup_panel
+}
+
+proc search::custom::open_panel {sf w} {
+    set sentry $sf.search
+
+    pack $sf -side bottom -anchor w -fill x -before $w.sw
+    focus $sentry
+
+    update idletasks
+    $w.fields see end
+}
+
+proc search::custom::close_panel {sf w} {
+    $w.fields tag remove search_highlight 0.0 end
+    pack forget $sf
+    focus $w.fields
+}
+
+proc search::custom::setup_panel {w} {
+    set fields $w.fields
+
+    $fields mark set sel_start end
+    $fields mark set sel_end 0.0
+
+    set sf [frame $w.search]
+
+    set sentry \
+	[entry $sf.search \
+	       -validate all \
+	       -validatecommand [list [namespace parent]::validate_entry %W %P]]
+    pack $sentry -padx 1m -side left
+
+    set sbox [ButtonBox $sf.sbox -spacing 0]
+    $sbox add -text [::msgcat::mc "Search up"] \
+         -command [list [namespace parent]::do_text_search $fields $sentry 1]
+    $sbox add -text [::msgcat::mc "Search down"] \
+         -command [list [namespace parent]::do_text_search $fields $sentry 0]
+    pack $sbox -side left -padx 1m
+    
+    set cbox [ButtonBox $sf.cbox -spacing 0]
+    $cbox add -text [::msgcat::mc "Close"] \
+         -command [list [namespace current]::close_panel $sf $w]
+    pack $cbox -side right -padx 1m
+
+    bind $sentry <Key-Return> [double% [list $sbox invoke 0]]
+    bind $sentry <Shift-Key-Return> [double% [list $sbox invoke 1]]
+    bind $sentry <Escape> \
+	[double% [list [namespace current]::close_panel $sf $w]]
+
+    bind $fields <<OpenSearchPanel>> \
+	[double% [list [namespace current]::open_panel $sf $w]]
+}
+


Property changes on: trunk/tkabber/plugins/search/custom.tcl
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native



More information about the Tkabber-dev mailing list