Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12359
Modified Files: Tag: desiredata desire.tk Log Message: AtomBox is now subclass of TextBox
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.56 retrieving revision 1.1.2.600.2.57 diff -C2 -d -r1.1.2.600.2.56 -r1.1.2.600.2.57 *** desire.tk 10 Dec 2006 20:39:15 -0000 1.1.2.600.2.56 --- desire.tk 11 Dec 2006 00:23:25 -0000 1.1.2.600.2.57 *************** *** 2066,2070 **** set t $c.${self}text switch -- $key { ! Tab {$self propose_completions; $widget configure -state disabled} 10 {$t configure -height [expr [lindex [$t configure -height] 4] + 1]} } --- 2066,2074 ---- set t $c.${self}text switch -- $key { ! Tab { ! if {[$self class] != "FloatBox"} { ! $self propose_completions; $widget configure -state disabled ! } ! } 10 {$t configure -height [expr [lindex [$t configure -height] 4] + 1]} } *************** *** 4429,4433 **** # it was class_new AtomBox {View Box}, which is wrong because already Box<View # it shouldn't have mattered, but super doesn't support proper pruning yet ! class_new AtomBox {Box} def AtomBox draw_box {} { global font --- 4433,4438 ---- # it was class_new AtomBox {View Box}, which is wrong because already Box<View # it shouldn't have mattered, but super doesn't support proper pruning yet ! #class_new AtomBox {Box} ! class_new AtomBox {TextBox} def AtomBox draw_box {} { global font *************** *** 4440,4450 **** if {[$self selected?]} {set frcol [$self look selectframe]} {set frcol [$self look frame3]} $self item BASE polygon $points -fill [$self look bg] -outline $frcol $self draw_io }
def AtomBox draw {} { ! super ! mset {x1 y1} [$self xy] ! if {[$self selected?]} {set fcol red} else {set fcol [$self look fg]} if {[string length $@val] <= $@w} { set string $@text --- 4445,4454 ---- if {[$self selected?]} {set frcol [$self look selectframe]} {set frcol [$self look frame3]} $self item BASE polygon $points -fill [$self look bg] -outline $frcol + [[$self get_canvas] widget] lower ${self}BASE ${self}TEXT $self draw_io }
def AtomBox draw {} { ! #if {[$self selected?]} {set fcol red} else {set fcol [$self look fg]} if {[string length $@val] <= $@w} { set string $@text *************** *** 4452,4457 **** set string [string range $@text 0 [expr $@w-1]] } ! $self item TEXT text [l+ {2 2} [list $x1 $y1]] \ ! -text $string -fill [$self look fg] -font [$self look font] -anchor nw }
--- 4456,4466 ---- set string [string range $@text 0 [expr $@w-1]] } ! set @text $string ! super ! } ! ! def AtomBox edit {} { ! set @text ""; #so that the existing number is cleared ! super }
*************** *** 4810,4850 **** def SymbolBox apply_value {} {netsend [list .$self symbol $@val]}
- def AtomBox key {key shift} { - set @clicking 0 - switch $key { - Return { - $@canvas focus= "" - $self apply_value - set @text $@val - set @clicking 0 - set @old_val $@val - set @key_input 0 - } - BackSpace { - set @val [string range $@val 0 end-1] - set @text $@val - $self changed - } - default {return 0} - } - return 1 - } - - def FloatBox key {key shift} { - global font - if {[super $key $shift]} {return} - switch $key { - period {if {[string length $@val] < $@w} {append @val ".";set @text $@val; $self changed}} - minus {set @val "-"; set @text $@val; $self changed} - default { - if {[regexp {^[0-9]{1}$} $key] && [string length $@val] < $@w} { - append @val $key - set @text $@val - $self changed - } - } - } - } - def SymbolBox key {key shift} { global font --- 4819,4822 ---- *************** *** 4894,4897 **** --- 4866,4870 ----
def AtomBox click {x y f target} { + set @clickx $x; set @clicky $y set canvas [$self get_canvas] set c [$canvas widget] *************** *** 4906,4918 **** def AtomBox unclick {x y f target} { set @clicking 0 ! if {[lindex $@clickpos 0] == $x && [lindex $@clickpos 1] == $y} { ! $@canvas focus= $self ! set @val "" ! set @clicking 0 ! set @key_input 1 ! } { ! $@canvas focus= "" ! if {$@key_input} {set @val $@old_val; set @key_input 0; set @text $@val} ! } }
--- 4879,4896 ---- def AtomBox unclick {x y f target} { set @clicking 0 ! if {$x == $@clickx && $y == $@clicky} {$self edit} ! } ! ! def AtomBox unedit {{accept 1}} { ! if {!$@edit} {return} ! set @edit 0 ! set c [[$self get_canvas] widget] ! set t $c.${self}text ! set text [$t get 1.0 "end - 1 chars"] ! if {![regexp {[a-zA-Z]} $text]} {set @val $text} else {set @text $@val} ! $self apply_value ! after 1 "destroy $t" ! $self selected?= 0 ! focus $c }
*************** *** 5922,5926 **** set @textself [string range $textself 0 [expr $cut -1]] } - puts " --> [$canvas look showcomp] <--" if {[$canvas look showcomp] <= 20} { set @height [$canvas look showcomp]} else {set @height 20} --- 5900,5903 ----