[Tkabber-dev] r116 - trunk/plugins/snoopstatus

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Wed Aug 13 04:39:44 MSD 2008


Author: kostix
Date: 2008-08-13 04:39:44 +0400 (Wed, 13 Aug 2008)
New Revision: 116

Modified:
   trunk/plugins/snoopstatus/snoopstatus.tcl
Log:
Implemented support for the standard search panel
in the "snoopstatus" plugin.


Modified: trunk/plugins/snoopstatus/snoopstatus.tcl
===================================================================
--- trunk/plugins/snoopstatus/snoopstatus.tcl	2008-08-13 00:03:07 UTC (rev 115)
+++ trunk/plugins/snoopstatus/snoopstatus.tcl	2008-08-13 00:39:44 UTC (rev 116)
@@ -38,6 +38,8 @@
     grid $win.text -sticky news
     grid rowconfigure $win 0 -weight 1
     grid columnconfigure $win 0 -weight 1
+
+    setup_search_panel $win $win.text
 }
 
 proc snoopstatus::process_status text {
@@ -54,4 +56,30 @@
     $t see end
 }
 
+proc snoopstatus::open_search_panel {text sf} {
+    grid $sf - -sticky news
+    update idletasks
+    $text see end
+}
+
+proc snoopstatus::close_search_panel {text sf} {
+    $text tag remove search_highlight 0.0 end
+    grid forget $sf
+    focus $text
+}
+
+proc snoopstatus::setup_search_panel {master text} {
+    $text mark set sel_start end
+    $text mark set sel_end 0.0
+
+    set sf [plugins::search::spanel $master.search \
+	-searchcommand [list [namespace parent]::search::do_text_search $text] \
+	-closecommand  [list [namespace current]::close_search_panel $text]]
+
+    bind $text <<OpenSearchPanel>> \
+	[double% [list [namespace current]::open_search_panel $text $sf]]
+}
+
+####
+
 # vim:ts=8:sw=4:sts=4:noet



More information about the Tkabber-dev mailing list