Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18555
Modified Files: Tag: devel_0_39 desire.tk Log Message: commited some code for auto completion... its just the beginning
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.198 retrieving revision 1.1.2.199 diff -C2 -d -r1.1.2.198 -r1.1.2.199 *** desire.tk 5 May 2006 16:20:59 -0000 1.1.2.198 --- desire.tk 6 May 2006 23:46:40 -0000 1.1.2.199 *************** *** 1321,1325 **** if {$@edit} {return} set t .$@canvas.c.${self}text ! set propose .$@canvas.c.${self}propose set @edit 1 set @tab_repeats 0 --- 1321,1327 ---- if {$@edit} {return} set t .$@canvas.c.${self}text ! #--------------------------------------- label completion ! #set propose .$@canvas.c.${self}propose ! #--------------------------------------- set @edit 1 set @tab_repeats 0 *************** *** 1330,1337 **** $self update_size $self changed ! # for display tab completion ! text $propose -height 1 -width [expr [string length $@text]+1] -relief flat \ ! -bg ${look(objectbg)} -borderwidth 0 -highlightthickness 0\ ! -font $font(str) -fg red text $t -height 1 -width [expr [string length $@text]+1] -relief flat \ -bg ${look(objectbg)} -borderwidth 0 -highlightthickness 0\ --- 1332,1340 ---- $self update_size $self changed ! #--------------------------------------- label completion ! #text $propose -height 1 -width [expr [string length $@text]+1] -relief flat \ ! # -bg ${look(objectbg)} -borderwidth 0 -highlightthickness 0\ ! # -font $font(str) -fg red ! #--------------------------------------- text $t -height 1 -width [expr [string length $@text]+1] -relief flat \ -bg ${look(objectbg)} -borderwidth 0 -highlightthickness 0\ *************** *** 1342,1349 **** bind $t <Return> "$self unedit" mset {cx cy} [$self xy] ! # for display tab completion ! # need to look into this font(height) for setting the -height..... no idea why ! .$@canvas.c create window [expr $cx+2] [expr $cy+2] \ ! -window $propose -anchor nw -tags "${self}propose $self" -height $font(height) .$@canvas.c create window [expr $cx+2] [expr $cy+2] \ -window $t -anchor nw -tags "${self}text $self" --- 1345,1354 ---- bind $t <Return> "$self unedit" mset {cx cy} [$self xy] ! #--------------------------------------- label completion ! ## for display tab completion ! ## need to look into this font(height) for setting the -height..... no idea why ! #.$@canvas.c create window [expr $cx+2] [expr $cy+2] \ ! # -window $propose -anchor nw -tags "${self}propose $self" -height $font(height) ! #--------------------------------------- .$@canvas.c create window [expr $cx+2] [expr $cy+2] \ -window $t -anchor nw -tags "${self}text $self" *************** *** 1359,1364 **** switch -- $key { Tab {$self propose_completions; $widget configure -state disabled} ! #default {.$@canvas.c coords ${self}propose -100 -100; set @tab_repeats 0} ! default {lower .$@canvas.c.${self}propose $widget; set @tab_repeats 0} } } --- 1364,1370 ---- switch -- $key { Tab {$self propose_completions; $widget configure -state disabled} ! #--------------------------------------- label completion ! #default {lower .$@canvas.c.${self}propose $widget; set @tab_repeats 0} ! #--------------------------------------- } } *************** *** 1437,1441 **** $self erase after 1 "destroy $t" ! after 1 "destroy $propose" set l {} foreach char [split $@text ""] {lappend l [scan $char %c]} --- 1443,1449 ---- $self erase after 1 "destroy $t" ! #--------------------------------------- label completion ! #after 1 "destroy $propose" ! #--------------------------------------- set l {} foreach char [split $@text ""] {lappend l [scan $char %c]} *************** *** 3342,3345 **** --- 3350,3382 ---- ############ completions
+ def* Canvas show_completions {x y text {on_hide ""}} { + global font look + set f .$self.comp + listbox $f -width 5 -height 5 -relief raised -bg red + .$self.c create window [expr $x+2] [expr $y+2] \ + -window $f -anchor nw -tags "${self}completebox $self" + # -window $f -anchor nw -tags "${self}completebox $self" -height [expr $font(height) * 22] -width [expr $font(height) * 22] + # global tooltip + # if {$tooltip(visible) && [string compare $text $tooltip(text)]==0} {return} + # $self hide_tooltip + # set border 4 + # set x [expr $x+$border+4] + # set c .$self.c + # $c create text $x $y -text $text -anchor w -tags tooltip_fg + # mset {x1 y1 x2 y2} [$c bbox tooltip_fg] + # set w 0 + # set h 0 + # $c create rectangle \ + # [expr $x1-$border] [expr $y1-$border] \ + # [expr $x2+$border] [expr $y2+$border] \ + # -fill "#ffffcc" -outline "#000000" -tags tooltip_bg + # $c lower tooltip_bg tooltip_fg + # set tooltip(curpos) $@curpos + # set tooltip(canvas) $self + # set tooltip(visible) 1 + # set tooltip(text) $text + # set tooltip(on_hide) $on_hide + } + def TextBox propose_completions {} { global class_list *************** *** 3371,3384 **** } set r [join $r "\n"] ! set next_obj [lindex $c $@tab_repeats] ! puts "tab....$@tab_repeats ::: $next_obj" ! $propose configure -width [string length $next_obj] ! $propose delete 1.0 1.end ! $propose insert 1.0 $next_obj mset {x1 y1 x2 y2} [$self bbox] ! #.$@canvas.c coords ${self}propose [expr $x1+1] [expr $y1+1] ! raise $propose $widget ! #$@canvas show_tooltip $x2 $y1 $r ! incr @tab_repeats }
--- 3408,3422 ---- } set r [join $r "\n"] ! #--------------------------------------- label completion ! #set next_obj [lindex $c $@tab_repeats] ! #puts "tab....$@tab_repeats ::: $next_obj" ! #$propose configure -width [string length $next_obj] ! #$propose delete 1.0 1.end ! #$propose insert 1.0 $next_obj ! #raise $propose $widget ! #incr @tab_repeats ! #--------------------------------------- mset {x1 y1 x2 y2} [$self bbox] ! $@canvas show_completions $x2 $y1 $r }