Patch version 2006/05/06. Changes from original FreeBSD port: 1. Removes small bug in Search window with listbox & scrollbar widgets. 2. New key bindings in `.' toplevel: - open port description window, - open Search window, - go back. 3. In most listbox widgets mouse click == key. 4. In Search window toggles between entry & listbox widgets. 5. Titles & icon names are more informative now. 6. User can override in .Xdefaults ``options add ...''. 7. Help update. 8. Something I forgot already. --- pib.tcl.orig Tue Apr 11 23:07:24 2006 +++ pib.tcl Fri May 19 02:55:40 2006 @@ -1,6 +1,6 @@ #!/bin/sh # Tcl magic \ -exec wish8.2 -f $0 $* +exec wish8.4 -f $0 $* ################################################################################ # # Copyright (C) 1996, 1997 @@ -31,6 +31,17 @@ # # Ports Index Browser # +# Patched by Alexander Gromnizki +# +# patch version +set Status(patch.ver) 2006/05/19 +# +# For full description of changes see +# . +# +# Download last patch version: +# . +# ################################################################################ # # A tool for browsing the FreeBSD ports INDEX file. @@ -118,7 +129,8 @@ # Build the browser window, so the default toplevel isn't # seen, because it looks stupid. - wm title "." "Ports INDEX browser"; + wm title "." "Ports INDEX browser \[$ipath]"; + wm protocol . WM_DELETE_WINDOW { exit } init_options; create_browser ""; @@ -152,7 +164,7 @@ # And things on it menubutton .menuBar.func -text "Function" -menu .menuBar.func.m -underline 0; menu .menuBar.func.m -tearoff 0; - .menuBar.func.m add command -label "Search..." -command "br_search" -underline 0; + .menuBar.func.m add command -label "Search..." -command "br_search" -underline 0 -accelerator "" .menuBar.func.m add command -label "Distfiles..." -command "df_browser" -underline 0; .menuBar.func.m add command -label "Maker..." -command "mk_create" -underline 0; .menuBar.func.m add command -label "Options..." -command "op_set" -underline 0; @@ -188,8 +200,9 @@ set sf $w.cons.sel; listbox $sf.list -width 30 -yscrollcommand "$sf.scroll set"; - scrollbar $sf.scroll -command "$sf.list yview"; + scrollbar $sf.scroll -command "$sf.list yview" -takefocus 0; bind $sf.list "br_forward"; + bind $sf.list "br_forward"; pack $sf.list $sf.scroll -side left -fill y; set Browser(sellist) $sf.list; @@ -259,8 +272,9 @@ set ssf $sf.dep.b.l; listbox $ssf.list -width 15 -height 5 -yscrollcommand "$ssf.scroll set"; - scrollbar $ssf.scroll -command "$ssf.list yview"; + scrollbar $ssf.scroll -command "$ssf.list yview" -takefocus 0; bind $ssf.list "br_xref $ssf.list"; + bind $ssf.list "br_xref $ssf.list"; pack $ssf.list -side left -fill both -expand y; pack $ssf.scroll -side left -fill y; set Browser(bdlist) $ssf.list; @@ -275,11 +289,19 @@ set ssf $sf.dep.r.l; listbox $ssf.list -width 15 -height 5 -yscrollcommand "$ssf.scroll set"; - scrollbar $ssf.scroll -command "$ssf.list yview"; + scrollbar $ssf.scroll -command "$ssf.list yview" -takefocus 0; bind $ssf.list "br_xref $ssf.list"; + bind $ssf.list "br_xref $ssf.list"; pack $ssf.list -side left -fill both -expand y; pack $ssf.scroll -side left -fill y; set Browser(rdlist) $ssf.list; + + # raise Search window + bind . { br_search } + # go back up the xref history + bind . { br_back } + # display the +DESCR file + bind . d { br_desc new } } ################################################################################ @@ -309,11 +331,22 @@ # proc init_options {} { + # listboxes + option add *Listbox.background white startupFile + option add *Listbox.selectForeground white startupFile + option add *Listbox.selectBackground darkblue startupFile + # scrollbars - option add *Scrollbar.width 11; + option add *Scrollbar.width 11 startupFile # textboxes - option add *Text.font fixed; + option add *Text.background white startupFile + option add *Text.selectForeground white startupFile + option add *Text.selectBackground darkblue startupFile + option add *Text.font fixed startupFile + + # entries + option add *Entry.background white startupFile } @@ -321,6 +354,7 @@ # Help texts # proc h_init {} { + global Status # ########################################################################### help_init "browser" \ @@ -330,20 +364,21 @@ "" \ " The INDEX browser provides a quick and powerful means for browsing the" \ " ports INDEX file and performing related functions. Navigate the ports " \ - " heirachy by double-clicking the browse list on the left. The Path field "\ - " always displays your current location." \ + " heirachy by double-clicking the browse list on the left (or hitting " \ + " on selected item). The Path field always displays your current location." \ "" \ " Items in the browse list with a trailing slash are directories, those" \ " without are ports. The '..' entry will return one level up the heirachy." \ "" \ " Selecting a port will show its details on the right. The category and" \ - " title are displayed at the top, and clicking the \[?\] button will open" \ - " a window containing a more verbose description of the port." \ + " title are displayed at the top, and clicking the \[?\] button (or pressing" \ + " key) will open a window containing a more verbose description of the" \ + " port." \ "" \ " Entries in the 'Build requires' and 'Run requires' lists are 'hot'," \ " double-clicking one will jump to that port. Clicking the \[<-\] button" \ - " will unwind through cross-references like this, and then move back up" \ - " the heirachy." \ + " (or pressing ) will unwind through cross-references like this, " \ + " and then move back up the heirachy." \ "" \ " Additional windows (help, description etc.) are persistent; once open" \ " they will update to reflect new ports as they are selected." \ @@ -386,6 +421,14 @@ " SUCH DAMAGE." \ "" \ { $Id: pib.tcl,v 1.14 1997/09/11 09:16:56 msmith Exp $ } \ + "" \ + " Patch version $Status(patch.ver) by Alexander Gromnizki " \ + "" \ + " For full description of changes see" \ + " ." \ + "" \ + " Download last patch version: " \ + " . " \ ]; # ########################################################################### @@ -402,9 +445,11 @@ " \[a-z\] matches any character between 'a' and 'z' inclusive." \ "" \ " Search results are listed in the browser. These results are 'hot', so" \ - " double-clicking on a port name will jump to that port. The search dialog" \ - " stays open until explicitly closed to allow easy browsing of all matches" \ - " to a search." \ + " double-clicking (or pressing ) on a port name will jump to that" \ + " port. The search dialog stays open until explicitly closed to allow easy" \ + " browsing of all matches to a search." \ + "" \ + " Press to toggle focus between entry field and listbox." \ ]; # ########################################################################### @@ -1078,10 +1123,10 @@ # search term entry frame $w.for pack $w.for -side top -fill x; - label $w.for.l -text "Seach for : "; + label $w.for.l -text "Search for : "; entry $w.for.e -textvariable Browser(search:term) -width 30; pack $w.for.l -side left; - pack $w.for.e -side left -fill x; + pack $w.for.e -side left -fill x -expand 1; # fields to search in frame $w.what; @@ -1105,19 +1150,20 @@ # results frame $w.res; - pack $w.res -side top -fill x; + pack $w.res -side top -fill both -expand true set sf $w.res; - listbox $sf.list -width 30 -height 5 -yscrollcommand "$sf.scroll set"; - scrollbar $sf.scroll -command "$sf.list yview"; + listbox $sf.list -width 30 -height 10 -yscrollcommand "$sf.scroll set"; + scrollbar $sf.scroll -command "$sf.list yview" -takefocus 0; bind $sf.list "br_searchsel $sf.list"; - pack $sf.list -side left -fill both -expand y; + bind $sf.list "br_searchsel $sf.list"; + pack $sf.list -side left -fill both -expand true; pack $sf.scroll -side right -fill y; # buttons frame $w.butt; pack $w.butt -side bottom -fill x; - button $w.butt.search -text "Search" -command "br_dosearch $w.res.list" -width 10; + button $w.butt.search -text "Search" -command "br_dosearch $w $w.res.list" -width 10; button $w.butt.hlp -text "Help" -command "help search"; button $w.butt.dis -text "Dismiss" -command "destroy $w" -width 10; pack $w.butt.search -side left; @@ -1125,7 +1171,13 @@ # try to be intuitive focus $w.for.e; - bind $w.for.e "br_dosearch $w.res.list"; + bind $w.for.e "br_dosearch $w $w.res.list"; + bind $w.for.e "focus $sf.list" + foreach i "$w.what $w.butt $sf" { + foreach j [winfo children $i] { + bind $j "focus $w.for.e" + } + } } ################################################################################ @@ -1133,11 +1185,12 @@ # # Search the INDEX for stuff. # -proc br_dosearch {list} { +proc br_dosearch {w_dlg list} { global Browser Paths Ports; $list delete 0 end; # delete list contents + set gmatch 0; # not a match yet foreach path [array names Paths] { # walk list of all ports @@ -1148,6 +1201,7 @@ if {$Browser(search:$what)} { if {[ regexp -nocase ".\*$Browser(search:term).\*" $Ports($name:$what)]} { set match 1; + set gmatch 1 } } } @@ -1155,6 +1209,11 @@ $list insert end $name; } } + + set s {} + if {$gmatch} { set s ": $Browser(search:term)" } + wm title $w_dlg "Search ports INDEX$s" + wm iconname $w_dlg "Search ports INDEX$s" } ################################################################################ @@ -1276,9 +1335,12 @@ pack $w.b -side bottom -fill x; button $w.b.dis -text "Dismiss" -width 10 -command "destroy $w"; pack $w.b.dis -side right; + + focus $w.t.scroll } wm title $w $Browser(cpath); + wm iconname $w $Browser(cpath); # clean it out $w.t.text configure -state normal; $w.t.text delete 1.0 end;