]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-gui/lib/search.tcl
Merge branch 'jk/grep-double-dash'
[git.git] / git-gui / lib / search.tcl
index d292f20f66a6319c34c3b38e28ebc120e7dd8400..7fdbf87bcdcf3e6d5a928dd4ac8a323509ea7953 100644 (file)
@@ -14,16 +14,17 @@ field smarktop
 field smarkbot
 
 constructor new {i_w i_text args} {
+       global use_ttk NS
        set w      $i_w
        set ctext  $i_text
 
-       frame  $w
-       label  $w.l       -text [mc Find:]
-       button $w.bn      -text [mc Next] -command [cb find_next]
-       button $w.bp      -text [mc Prev] -command [cb find_prev]
-       checkbutton $w.cs -text [mc Case-Sensitive] \
-               -variable ${__this}::casesensitive -command [cb _incrsearch]
+       ${NS}::frame  $w
+       ${NS}::label  $w.l       -text [mc Find:]
        entry  $w.ent -textvariable ${__this}::searchstring -background lightgreen
+       ${NS}::button $w.bn      -text [mc Next] -command [cb find_next]
+       ${NS}::button $w.bp      -text [mc Prev] -command [cb find_prev]
+       ${NS}::checkbutton $w.cs -text [mc Case-Sensitive] \
+               -variable ${__this}::casesensitive -command [cb _incrsearch]
        pack   $w.l   -side left
        pack   $w.cs  -side right
        pack   $w.bp  -side right
@@ -35,24 +36,32 @@ constructor new {i_w i_text args} {
 
        trace add variable searchstring write [cb _incrsearch_cb]
        
-       bind $w <Destroy> [cb delete_this]
+       bind $w <Destroy> [list delete_this $this]
        return $this
 }
 
 method show {} {
-       if {![winfo ismapped $w]} {
+       if {![visible $this]} {
                grid $w
        }
        focus -force $w.ent
 }
 
 method hide {} {
-       if {[winfo ismapped $w]} {
+       if {[visible $this]} {
                focus $ctext
                grid remove $w
        }
 }
 
+method visible {} {
+       return [winfo ismapped $w]
+}
+
+method editor {} {
+       return $w.ent
+}
+
 method _get_new_anchor {} {
        # use start of selection if it is visible,
        # or the bounds of the visible area