Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4253
Modified Files: Tag: devel_0_39 desire.tk Log Message: cleanup (completions)
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.266 retrieving revision 1.1.2.267 diff -C2 -d -r1.1.2.266 -r1.1.2.267 *** desire.tk 29 Jun 2006 16:48:41 -0000 1.1.2.266 --- desire.tk 29 Jun 2006 17:42:24 -0000 1.1.2.267 *************** *** 4280,4286 **** }
! def* ClassBrowser fill_box {s listbox} { global class_list ! $listbox delete 0 end foreach class $class_list { if {[string length $s]==0 || [string first $s $class]>=0} { --- 4280,4286 ---- }
! def* ClassBrowser fill_box {s} { global class_list ! $@listbox delete 0 end foreach class $class_list { if {[string length $s]==0 || [string first $s $class]>=0} { *************** *** 4290,4311 **** set t "[$class]" } ! $listbox insert end $t if {[string length $t] > [string length $@width]} {set @width [string length $t]} } } ! $listbox selection set 0 0 puts "matches ::: [$@listbox size] |||| width ::: $@width |||| height ::: $@height" }
! def* Completion fill_box {s listbox} { ! super $s $listbox wm maxsize .$self [winfo reqwidth .$self.comp] [winfo reqheight .$self.comp] }
! def* Browser fill_box {s listbox} { global class_list ! super $s $listbox .$self.title configure -text [format [say how_many_object_classes] \ ! [$listbox size] [llength $class_list]] }
--- 4290,4311 ---- set t "[$class]" } ! $@listbox insert end $t if {[string length $t] > [string length $@width]} {set @width [string length $t]} } } ! $@listbox selection set 0 0 puts "matches ::: [$@listbox size] |||| width ::: $@width |||| height ::: $@height" }
! def* Completion fill_box {s} { ! super $s wm maxsize .$self [winfo reqwidth .$self.comp] [winfo reqheight .$self.comp] }
! def* Browser fill_box {s} { global class_list ! super $s .$self.title configure -text [format [say how_many_object_classes] \ ! [$@listbox size] [llength $class_list]] }
*************** *** 4362,4371 **** pack [button $b.close -text [say close] -command "destroy .$self"] -side right pack $b -side bottom -fill x -expand no ! $self fill_box "" $f.1 #bind $f.1 <Button-1> "after 1 "$self info $f.1 "" ! bind $f.1 <Button-1> "after 1 "$self focus_switch Up $b.2 $f.1 "" ! bind $f.1 <KeyPress> "after 1 "$self focus_switch %K $b.2 $f.1 "" ! #bind $b.2 <KeyPress> {after 1 "$self fill_box [.$self.butt.2 get] $f.1"} ! bind $b.2 <KeyPress> "after 1 "$self focus_switch %K $b.2 $f.1 "" #after 1 "focus $b.2" } --- 4362,4371 ---- 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 focus_switch Up $b.2"" ! bind $f.1 <KeyPress> "after 1 "$self focus_switch %K $b.2"" ! #bind $b.2 <KeyPress> {after 1 "$self fill_box [.$self.butt.2 get]"} ! bind $b.2 <KeyPress> "after 1 "$self focus_switch %K $b.2"" #after 1 "focus $b.2" } *************** *** 4396,4400 **** -bg $look(canvasbgedit) -selectbackground [complement $look(objectfg)] \ -activestyle dotbox -selectforeground $look(objectfg) ! $self fill_box [$@textbox get 1.0 1.end] $f $f configure -width $@width set box_width [winfo reqwidth $f] --- 4396,4400 ---- -bg $look(canvasbgedit) -selectbackground [complement $look(objectfg)] \ -activestyle dotbox -selectforeground $look(objectfg) ! $self fill_box [$@textbox get 1.0 1.end] $f configure -width $@width set box_width [winfo reqwidth $f] *************** *** 4420,4434 **** wm geometry .$self [winfo reqwidth .$self]x[winfo reqheight .$self]+$box_x+$box_y
! bind $f <Button-1> "after 1 "$self focus_switch Up $@textbox $f "" ! bind $f <KeyPress> "$self focus_switch %K $@textbox $f" ! bind $f <Return> "after 1 "$self complete $f "" # shouldn't bind Text here! -- matju ! bind Text <Tab> "$self tab $@textbox $f; continue" ! bind $@textbox <KeyPress> "$self focus_switch %K $@textbox $f" #bind $@textbox <Tab> "after 1 "$self tab %K $@textbox $f "" focus .$self.comp }
! def ClassBrowser complete {listbox} { puts "complete me!!!!" if {[regexp {x([0-9a-z]{6,8})text$} $@textbox obj]} { --- 4420,4434 ---- wm geometry .$self [winfo reqwidth .$self]x[winfo reqheight .$self]+$box_x+$box_y
! bind $f <Button-1> "after 1 "$self focus_switch Up $@textbox"" ! bind $f <KeyPress> "$self focus_switch %K $@textbox" ! bind $f <Return> "after 1 "$self complete"" # shouldn't bind Text here! -- matju ! bind Text <Tab> "$self tab $@textbox; continue" ! bind $@textbox <KeyPress> "$self focus_switch %K $@textbox" #bind $@textbox <Tab> "after 1 "$self tab %K $@textbox $f "" focus .$self.comp }
! def ClassBrowser complete {} { puts "complete me!!!!" if {[regexp {x([0-9a-z]{6,8})text$} $@textbox obj]} { *************** *** 4436,4442 **** set obj [string range $obj 0 [expr $cut -1]] } ! set i [$listbox curselection] ! set class [string range [lindex [$listbox get $i] 0] 1 end-1] ! # set class [lindex [$listbox get $i] 0] $@textbox delete 1.0 1.end $@textbox insert 1.0 $class --- 4436,4442 ---- set obj [string range $obj 0 [expr $cut -1]] } ! set i [$@listbox curselection] ! set class [string range [lindex [$@listbox get $i] 0] 1 end-1] ! # set class [lindex [$@listbox get $i] 0] $@textbox delete 1.0 1.end $@textbox insert 1.0 $class *************** *** 4456,4466 **** }
! def* ClassBrowser tab {textbox listbox} { ! set $@focus $listbox ! $self focus_switch Down $textbox $listbox }
! def* ClassBrowser focus_switch {key focus1 focus2} { ! #focus2 = listbox :: focus1 = whatever if {[regexp {x([0-9a-z]{6,8})text$} $@textbox textself]} { set cut [string first "text" $textself] --- 4456,4466 ---- }
! def* ClassBrowser tab {textbox} { ! set $@focus $@listbox ! $self focus_switch Down $textbox }
! def* ClassBrowser focus_switch {key focus1} { ! #focus1 = whatever if {[regexp {x([0-9a-z]{6,8})text$} $@textbox textself]} { set cut [string first "text" $textself] *************** *** 4469,4485 **** if {$key != "Down" & $key != "Up"} { puts "------> focus_switch received none down/up key => $key" ! if {$@focus == $focus2} { ! puts "------> focus_switch focus = $focus2" if {[regexp {^[a-zA-Z]{1}$} $key]} { switch $self { browser {.$self.butt.2 insert end $key} completion { ! puts "------> focus_switch focus2 receives letter key $key" ! $focus1 insert 1.end $key ! $textself after_key $@textbox ! $self fill_box [$focus1 get 1.0 1.end] $focus2 puts "------> focus_switch focus = $focus1" ! focus $focus1 ! set @focus $focus1 } } --- 4469,4485 ---- if {$key != "Down" & $key != "Up"} { puts "------> focus_switch received none down/up key => $key" ! if {$@focus == $@listbox} { ! puts "------> focus_switch focus = $@listbox" if {[regexp {^[a-zA-Z]{1}$} $key]} { switch $self { browser {.$self.butt.2 insert end $key} completion { ! puts "------> focus_switch $@listbox receives letter key $key" ! $focus1 insert 1.end $key ! $textself after_key $@textbox ! $self fill_box [$focus1 get 1.0 1.end] puts "------> focus_switch focus = $focus1" ! focus $focus1 ! set @focus $focus1 } } *************** *** 4491,4514 **** # continue tabbing will go through the matches if {$key == "Tab"} { ! set next [expr [$focus2 index active] + 1] ! puts "------> focus_switch !!! move to the item $@select!! [$focus2 index active]" ! if {$next >= [expr [$@listbox size] - 1]} { ! $focus2 activate 0 ! } else { ! #puts "------ [$focus2 yview] ------" ! $focus2 activate $next ! $focus2 selection clear 0 [expr [$@listbox size] - 1] ! $focus2 selection set $next $next ! if {$next >= [expr $@height - 1]} {$focus2 yview scroll 1 units} ! } } switch $self { ! browser {$self fill_box [$focus1 get] $focus2} completion { if {$@focus == $focus1 & $key != "Tab"} { puts "------> focus_switch receives $key @ $@focus" #if {[regexp {^[a-zA-Z]{1}$} $key]} {$focus1 insert 1.end $key} ! if {[winfo exists .$self]} {$self fill_box [$focus1 get 1.0 1.end] $focus2} #hum, no idea why i need after 1 for it to work... after 1 $textself after_key $@textbox --- 4491,4514 ---- # continue tabbing will go through the matches if {$key == "Tab"} { ! set next [expr [$@listbox index active] + 1] ! puts "------> focus_switch !!! move to the item $@select!! [$@listbox index active]" ! if {$next >= [expr [$@listbox size] - 1]} { ! $@listbox activate 0 ! } else { ! #puts "------ [$@listbox yview] ------" ! $@listbox activate $next ! $@listbox selection clear 0 [expr [$@listbox size] - 1] ! $@listbox selection set $next $next ! if {$next >= [expr $@height - 1]} {$@listbox yview scroll 1 units} ! } } switch $self { ! browser {$self fill_box [$focus1 get]} completion { if {$@focus == $focus1 & $key != "Tab"} { puts "------> focus_switch receives $key @ $@focus" #if {[regexp {^[a-zA-Z]{1}$} $key]} {$focus1 insert 1.end $key} ! 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 *************** *** 4517,4524 **** } } else { ! focus $focus2 ! set @focus $focus2 set @select 0 ! if {$@name == "browser"} {$self info $focus2} } } --- 4517,4524 ---- } } else { ! focus $@listbox ! set @focus $@listbox set @select 0 ! if {$@name == "browser"} {$self info $@listbox} } }