[PD-cvs] pd/src desire.tk,1.1.2.197,1.1.2.198
chunlee
chunlee at users.sourceforge.net
Fri May 5 18:21:03 CEST 2006
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4120
Modified Files:
Tag: devel_0_39
desire.tk
Log Message:
commit some code for the object name tab completion, will continue on
this a bit later....
Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.197
retrieving revision 1.1.2.198
diff -C2 -d -r1.1.2.197 -r1.1.2.198
*** desire.tk 3 May 2006 14:01:15 -0000 1.1.2.197
--- desire.tk 5 May 2006 16:20:59 -0000 1.1.2.198
***************
*** 1295,1299 ****
class_new TextBox {Box}
! def TextBox draw {} {
# TEXT = the text label
# text = the input text field
--- 1295,1299 ----
class_new TextBox {Box}
! def* TextBox draw {} {
# TEXT = the text label
# text = the input text field
***************
*** 1320,1346 ****
global look font
if {$@edit} {return}
set @edit 1
$@canvas obj_in_edit= $self
set @selected? 1
.$@canvas.c delete ${self}TEXT
#set @oldtext $@text
- set t .$@canvas.c.${self}text
$self update_size
$self changed
text $t -height 1 -width [expr [string length $@text]+1] -relief flat \
-bg ${look(objectbg)} -borderwidth 0 -highlightthickness 0\
-font $font(str) -fg $look(objectfg)
! #text $t -height 1 -width $@textchars -relief flat \
! # -bg ${look(objectbg)} -borderwidth 0 -highlightthickness 0\
! # -font [format -*-courier-medium--normal--%d-* $font(size)]
bind $t <Key> "$self key %W %x %y %K %A 0"
bind $t <Control-Return> "$self key %W %x %y 10 %A 0"
bind $t <Return> "$self unedit"
mset {cx cy} [$self xy]
.$@canvas.c create window [expr $cx+2] [expr $cy+2] \
! -window $t -anchor nw -tags "${self}text $self"
#$self draw
$t configure -pady 0 -padx 1
! $t insert 1.0 $@text
focus $t
}
--- 1320,1355 ----
global look font
if {$@edit} {return}
+ set t .$@canvas.c.${self}text
+ set propose .$@canvas.c.${self}propose
set @edit 1
+ set @tab_repeats 0
$@canvas obj_in_edit= $self
set @selected? 1
.$@canvas.c delete ${self}TEXT
#set @oldtext $@text
$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\
-font $font(str) -fg $look(objectfg)
! #${look(objectbg)}
bind $t <Key> "$self key %W %x %y %K %A 0"
bind $t <Control-Return> "$self key %W %x %y 10 %A 0"
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"
#$self draw
$t configure -pady 0 -padx 1
! $t insert 1.0 $@text
! #set @entered [$t get 1.0 1.end]
focus $t
}
***************
*** 1350,1353 ****
--- 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}
}
}
***************
*** 1391,1395 ****
}
! def ObjectBox draw {} {
$self update_size
set xs $@xs
--- 1402,1406 ----
}
! def* ObjectBox draw {} {
$self update_size
set xs $@xs
***************
*** 1422,1428 ****
--- 1433,1441 ----
set c .$@canvas.c
set t $c.${self}text
+ set propose $c.${self}propose
set @text [$t get 1.0 1.end]
$self erase
after 1 "destroy $t"
+ after 1 "destroy $propose"
set l {}
foreach char [split $@text ""] {lappend l [scan $char %c]}
***************
*** 3331,3334 ****
--- 3344,3351 ----
def TextBox propose_completions {} {
global class_list
+ # .x8241f48.c.x8242130text
+ set widget .$@canvas.c.${self}text
+ set propose .$@canvas.c.${self}propose
+ #$propose configure -state normal
if {![info exists class_list]} {
pd pd update-class-list $self propose_completions
***************
*** 3337,3340 ****
--- 3354,3358 ----
}
set r {}
+ set c {}
set n 0
set prev ""
***************
*** 3343,3348 ****
--- 3361,3368 ----
if {[string compare [say $class] "{{$class}}"]} {
lappend r "$class : [say $class]"
+ lappend c $class
} {
lappend r $class
+ lappend c $class
}
incr n
***************
*** 3350,3357 ****
if {$n > 16} {lappend r ...; break}
}
- #post_to_gui "$r\n"
set r [join $r "\n"]
mset {x1 y1 x2 y2} [$self bbox]
! $@canvas show_tooltip $x2 $y1 $r
}
--- 3370,3384 ----
if {$n > 16} {lappend r ...; break}
}
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
}
More information about the Pd-cvs
mailing list