Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9375
Modified Files: Tag: devel_0_39 desire.tk Log Message: fix several bugs on the classbrowser and the completion box
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.444 retrieving revision 1.1.2.445 diff -C2 -d -r1.1.2.444 -r1.1.2.445 *** desire.tk 1 Sep 2006 02:30:58 -0000 1.1.2.444 --- desire.tk 1 Sep 2006 14:39:53 -0000 1.1.2.445 *************** *** 1800,1804 **** $self setto [$t get 1.0 1.end] after 1 "destroy $t" ! #after 1 "destroy $propose" focus $c } --- 1800,1804 ---- $self setto [$t get 1.0 1.end] after 1 "destroy $t" ! if {[winfo exists .completion]} {$@action cancel} focus $c } *************** *** 4631,4641 **** def Completion init {name x y textbox} {super $name $x $y $textbox}
! def ClassBrowser cancel {} {$self delete} def ClassBrowser delete {} {set @exist 0; super}
def ClassBrowser init {name x y textbox} { - #super set @name $name - set @focus ".completion.comp" set @width 0 set @height 0 --- 4631,4645 ---- def Completion init {name x y textbox} {super $name $x $y $textbox}
! def Completion cancel {} { ! bind $@textbox <Key> "$@textself key %W %x %y %K %A 0" ! bind $@textbox <Control-Return> "$@textself key %W %x %y 10 %A 0" ! bind $@textbox <Return> "$@textself unedit" ! bind $@textbox <Tab> "$@textself key %W %x %y %K %A 0" ! focus $@textbox; $self delete ! } def ClassBrowser delete {} {set @exist 0; super}
def ClassBrowser init {name x y textbox} { set @name $name set @width 0 set @height 0 *************** *** 4723,4737 **** pack [button $b.close -text [say close] -command "destroy .$self"] -side right pack $b -side bottom -fill x -expand no $self fill_box "" #bind $f.1 <Button-1> "after 1 "$self info $f.1 "" bind $f.1 <Button-1> "after 1 "$self key Up $b.2"" foreach w [list $f.1 $b.2] { ! bind $w <KeyPress> "after 1 "$self key %K $w 0"" ! bind $w <Shift-KeyPress> "after 1 "$self key %K $w 1"" } }
def Completion list_callback {} { ! global class_list $self search_for_externs set class_list [luniq [lsort $class_list]] --- 4727,4742 ---- pack [button $b.close -text [say close] -command "destroy .$self"] -side right pack $b -side bottom -fill x -expand no + set @textbox $b.2 $self fill_box "" #bind $f.1 <Button-1> "after 1 "$self info $f.1 "" bind $f.1 <Button-1> "after 1 "$self key Up $b.2"" foreach w [list $f.1 $b.2] { ! bind $w <KeyPress> "after 1 "$self key %K 0"" ! bind $w <Shift-KeyPress> "after 1 "$self key %K 1"" } }
def Completion list_callback {} { ! global class_list look $self search_for_externs set class_list [luniq [lsort $class_list]] *************** *** 4749,4752 **** --- 4754,4758 ---- set cut [string first "text" $textself] set textself [string range $textself 0 [expr $cut -1]] + set @textself [string range $textself 0 [expr $cut -1]] } #mset {x1 y1 x2 y2} [$textself bbox] *************** *** 4759,4763 **** listbox $f -width $@width -height $@height -relief flat \ -bg [$canvas look compbg] -selectbackground [$canvas look compselectbg] \ ! -activestyle dotbox -selectforeground [$canvas look compselectfg] -fg [$canvas look compfg] $self fill_box [$@textbox get 1.0 1.end] $f configure -width $@width --- 4765,4770 ---- listbox $f -width $@width -height $@height -relief flat \ -bg [$canvas look compbg] -selectbackground [$canvas look compselectbg] \ ! -activestyle dotbox -selectforeground [$canvas look compselectfg] -fg [$canvas look compfg] \ ! -font $look(View:fontstring) $self fill_box [$@textbox get 1.0 1.end] $f configure -width $@width *************** *** 4786,4793 **** bind $f <Button-1> "after 1 "$self complete"" bind $f <Return> "after 1 "$self complete"" ! bind $f <KeyPress> "$self key %K $@textbox 0" ! bind $f <Shift-KeyPress> "$self key %K $@textbox 1" ! bind $@textbox <Tab> "$self key %K $@textbox; break" ! bind $@textbox <KeyPress> "$self key %K $@textbox" focus .$self.comp } --- 4793,4800 ---- bind $f <Button-1> "after 1 "$self complete"" bind $f <Return> "after 1 "$self complete"" ! bind $f <KeyPress> "$self key %K 0" ! bind $f <Shift-KeyPress> "$self key %K 1" ! bind $@textbox <Tab> "$self key %K ; break" ! bind $@textbox <KeyPress> "$self key %K " focus .$self.comp } *************** *** 4806,4811 **** }
! def ClassBrowser key {key focus1 {shift 0}} { ! #focus1 = whatever if {[regexp {x([0-9a-z]{6,8})text$} $@textbox textself]} { set cut [string first "text" $textself] --- 4813,4817 ---- }
! def ClassBrowser key {key {shift 0}} { if {[regexp {x([0-9a-z]{6,8})text$} $@textbox textself]} { set cut [string first "text" $textself] *************** *** 4815,4824 **** Up|Down { focus $@listbox - set @focus $@listbox set @select 0 ! if {$@name == "browser"} {$self info $@listbox} } Escape {after 1 "$self cancel"} ;# doesn't really work Tab { set next [$@listbox index active] incr next --- 4821,4830 ---- Up|Down { focus $@listbox set @select 0 ! if {$self == "browser"} {$self info $@listbox} } Escape {after 1 "$self cancel"} ;# doesn't really work Tab { + focus $@listbox set next [$@listbox index active] incr next *************** *** 4827,4844 **** $@listbox selection clear 0 [expr [$@listbox size] - 1] $@listbox selection set $next $next ! if {$next >= [expr $@height - 1]} {$@listbox yview scroll 1 units} } - Backspace {focus $focus1; set @focus $focus1} default { ! if {$@focus == $@listbox} { if {[regexp {^[a-zA-Z0-9~/._]{1}$} $key]} { switch $self { browser {.$self.butt.2 insert end $key} completion { ! $focus1 insert 1.end $key $textself after_key $@textbox ! $self fill_box [$focus1 get 1.0 1.end] ! focus $focus1 ! set @focus $focus1 } } --- 4833,4858 ---- $@listbox selection clear 0 [expr [$@listbox size] - 1] $@listbox selection set $next $next ! #if {$next >= [expr $@height - 1]} {$@listbox yview scroll 1 units} ! $@listbox see $next ! if {$self == "browser"} {$self info $@listbox} ! } ! BackSpace { ! if {[focus] == $@listbox} {focus $@textbox} ! #classbrowser uses entry as input widget, where as completion is text widget... ! switch $self { ! browser {$self fill_box [$@textbox get]} ! completion {$self fill_box [$@textbox get 1.0 1.end]} ! } } default { ! if {[focus] == $@listbox} { if {[regexp {^[a-zA-Z0-9~/._]{1}$} $key]} { switch $self { browser {.$self.butt.2 insert end $key} completion { ! $@textbox insert 1.end $key $textself after_key $@textbox ! $self fill_box [$@textbox get 1.0 1.end] ! focus $@textbox } } *************** *** 4846,4853 **** } switch $self { ! browser {$self fill_box [$focus1 get]} completion { ! if {$@focus == $focus1 & $key != "Tab"} { ! if {[winfo exists .$self]} {$self fill_box [$focus1 get 1.0 1.end]} #hum, no idea why i need after 1 for it to work... after 1 $textself after_key $@textbox --- 4860,4869 ---- } switch $self { ! browser { ! if {[focus] == $@listbox} {return} else {$self fill_box [$@textbox get]} ! } completion { ! if {[focus] == $@textbox & $key != "Tab"} { ! if {[winfo exists .$self]} {$self fill_box [$@textbox get 1.0 1.end]} #hum, no idea why i need after 1 for it to work... after 1 $textself after_key $@textbox *************** *** 4897,4901 **** set r [join $r "\n"] mset {x1 y1 x2 y2} [$self bbox] ! Completion new_as completion $@canvas $x1 $y1 $widget }
--- 4913,4917 ---- set r [join $r "\n"] mset {x1 y1 x2 y2} [$self bbox] ! set @action [Completion new_as completion $@canvas $x1 $y1 $widget] }