[Tkabber-dev] r887 - in trunk/tkabber-plugins: . debug

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Jan 28 00:14:23 MSK 2007


Author: sergei
Date: 2007-01-28 00:14:21 +0300 (Sun, 28 Jan 2007)
New Revision: 887

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/debug/debug.tcl
Log:
	* debug/debug.tcl: Added search in debug window.


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2007-01-27 21:05:31 UTC (rev 886)
+++ trunk/tkabber-plugins/ChangeLog	2007-01-27 21:14:21 UTC (rev 887)
@@ -2,6 +2,8 @@
 
 	* spy/spy.tcl: Added search in spy presence window.
 
+	* debug/debug.tcl: Added search in debug window.
+
 2006-01-26  Sergei Golovan <sgolovan at nes.ru>
 
 	* checkers/checkers.tcl, chess/chess.tcl, debug/debug.tcl,

Modified: trunk/tkabber-plugins/debug/debug.tcl
===================================================================
--- trunk/tkabber-plugins/debug/debug.tcl	2007-01-27 21:05:31 UTC (rev 886)
+++ trunk/tkabber-plugins/debug/debug.tcl	2007-01-27 21:14:21 UTC (rev 887)
@@ -133,11 +133,12 @@
         add_win $dw -title [::msgcat::mc Debug] \
 		    -tabtitle [::msgcat::mc Debug] \
 		    -class Chat \
-		    -raisecmd [list focus list $dw.body]
+		    -raisecmd [list focus $dw.body]
 
         [ScrolledWindow $dw.sw] setwidget \
             [text $dw.body -yscrollcommand [list $dw.scroll set] \
-		 -state disabled -highlightthickness 0]
+		 -state disabled -takefocus 1]
+	bind $dw.body <1> [list focus $dw.body]
 
         pack $dw.sw -side bottom -fill both -expand yes
 
@@ -147,6 +148,8 @@
             -foreground [option get $dw meforeground Chat]
         $dw.body tag configure error  \
             -foreground [option get $dw errforeground Chat]
+	
+	search::setup_panel $dw
     }
 
     $dw.body configure -state normal
@@ -185,4 +188,57 @@
     $dw.body configure -state disabled
 }
 
+namespace eval debug::search {}
+
+proc debug::search::open_panel {sf w} {
+    set sentry $sf.search
+
+    pack $sf -side bottom -anchor w -fill x -before $w.sw
+    focus $sentry
+
+    update idletasks
+    $w.body see end
+}
+
+proc debug::search::close_panel {sf w} {
+    $w.body tag remove search_highlight 0.0 end
+    pack forget $sf
+    focus $w.body
+}
+
+proc debug::search::setup_panel {w} {
+    set body $w.body
+
+    $body mark set sel_start end
+    $body mark set sel_end 0.0
+
+    set sf [frame [winfo parent $body].search]
+
+    set sentry \
+	[entry $sf.search \
+	       -validate all \
+	       -validatecommand [list plugins::search::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 plugins::search::do_text_search $body $sentry 1]
+    $sbox add -text [::msgcat::mc "Search down"] \
+         -command [list plugins::search::do_text_search $body $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 $w.body <<OpenSearchPanel>> \
+	[double% [list [namespace current]::open_panel $sf $w]]
+}
+
 # vim:ts=8:sw=4:sts=4:noet



More information about the Tkabber-dev mailing list