Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12232
Modified Files: Tag: devel_0_39 desire.tk Log Message: fixed a few things in the completion box code. next: tidy up ClassBrowser key....
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.519 retrieving revision 1.1.2.520 diff -C2 -d -r1.1.2.519 -r1.1.2.520 *** desire.tk 19 Oct 2006 18:01:08 -0000 1.1.2.519 --- desire.tk 19 Oct 2006 23:50:04 -0000 1.1.2.520 *************** *** 5373,5379 **** if {[can_say $class]} {append t " [say $class]"} $@listbox insert end $t ! if {[string length $t] > [string length $@width]} {set @width [string length $t]} } } $@listbox selection set 0 0 } --- 5373,5382 ---- if {[can_say $class]} {append t " [say $class]"} $@listbox insert end $t ! #if {[string length $t] > [string length $@width]} {set @width [string length $t]} ! if {[string length $t] > $@width} {set @width [string length $t]} } } + set none " no matches " + if {![$@listbox size]} {$@listbox insert 0 $none; set @width [string length $none]} $@listbox selection set 0 0 } *************** *** 5467,5473 **** set f .$self.comp set @listbox $f ! set rootx [winfo rootx .$@name.c] ! set rooty [winfo rooty .$@name.c] ! set max [wm maxsize .$self] if {[regexp {x([0-9a-z]{6,8})text$} $@textbox textself]} { set cut [string first "text" $textself] --- 5470,5477 ---- set f .$self.comp set @listbox $f ! set @rootx [winfo rootx .$@name.c] ! set @rooty [winfo rooty .$@name.c] ! set @max [wm maxsize .$self] ! if {[regexp {x([0-9a-z]{6,8})text$} $@textbox textself]} { set cut [string first "text" $textself] *************** *** 5475,5482 **** set @textself [string range $textself 0 [expr $cut -1]] } - #mset {x1 y1 x2 y2} [$textself bbox] - mset {x1 y1 x2 y2} [lmap * [$textself bbox] [$@name zoom]] - set x1 [format %0.f $x1];set y1 [format %0.f $y1] - set x2 [format %0.f $x2];set y2 [format %0.f $y2] puts " --> [$canvas look showcomp] <--" if {[$canvas look showcomp] <= 20} { --- 5479,5482 ---- *************** *** 5486,5490 **** --- 5486,5506 ---- -activestyle dotbox -selectforeground [$canvas look compselectfg] -fg [$canvas look compfg] \ -font $look(View:font) + $self adjust_box + + 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 + } + + def Completion adjust_box {} { + mset {x1 y1 x2 y2} [lmap * [$@textself bbox] [$@name zoom]] + set x1 [format %0.f $x1];set y1 [format %0.f $y1] + set x2 [format %0.f $x2];set y2 [format %0.f $y2] $self fill_box [$@textbox get 1.0 1.end] + set f .$self.comp $f configure -width $@width set box_width [winfo reqwidth $f] *************** *** 5496,5521 **** #test the right edge of the screen, assuming the left edge has enough space ! if {[expr $x1+$rootx+$box_width] < [lindex $max 0]} { ! set box_x [expr $x1+$rootx] } else { ! set box_x [expr $x2 - $box_width + $rootx] } #test the lower edge of the screen, assuming the upper edge has enough space ! if {[expr $y2+$rooty+$box_height] < [lindex $max 1]} { ! set box_y [expr $y2 + 5 + $rooty] } else { ! set box_y [expr $y1 - $box_height - 2 + $rooty] } wm geometry .$self [winfo reqwidth .$self]x[winfo reqheight .$self]+$box_x+$box_y ! ! 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 ! }
def ClassBrowser current_class {} { --- 5512,5530 ---- #test the right edge of the screen, assuming the left edge has enough space ! if {[expr $x1+$@rootx+$box_width] < [lindex $@max 0]} { ! set box_x [expr $x1+$@rootx] } else { ! set box_x [expr $x2 - $box_width + $@rootx] } #test the lower edge of the screen, assuming the upper edge has enough space ! if {[expr $y2+$@rooty+$box_height] < [lindex $@max 1]} { ! set box_y [expr $y2 + 5 + $@rooty] } else { ! set box_y [expr $y1 - $box_height - 2 + $@rooty] } wm geometry .$self [winfo reqwidth .$self]x[winfo reqheight .$self]+$box_x+$box_y ! ! }
def ClassBrowser current_class {} { *************** *** 5570,5574 **** switch $self { browser {$self fill_box [$@textbox get]} ! completion {$self fill_box [$@textbox get 1.0 1.end]} } } --- 5579,5587 ---- switch $self { browser {$self fill_box [$@textbox get]} ! completion { ! $self adjust_box ! #$self fill_box [$@textbox get 1.0 1.end] ! #.$self.comp configure -width $@width ! } } } *************** *** 5584,5588 **** $@textbox insert 1.end $key $textself after_key $@textbox ! $self fill_box [$@textbox get 1.0 1.end] focus $@textbox } --- 5597,5603 ---- $@textbox insert 1.end $key $textself after_key $@textbox ! #$self fill_box [$@textbox get 1.0 1.end] ! #.$self.comp configure -width $@width ! $self adjust_box focus $@textbox } *************** *** 5596,5600 **** 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 --- 5611,5619 ---- completion { if {[focus] == $@textbox & $key != "Tab"} { ! if {[winfo exists .$self]} { ! #$self fill_box [$@textbox get 1.0 1.end] ! #.$self.comp configure -width $@width ! $self adjust_box ! } #hum, no idea why i need after 1 for it to work... after 1 $textself after_key $@textbox