Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6762
Modified Files: Tag: devel_0_39 desire.tk Log Message: yet another rewrite of update_object
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.379 retrieving revision 1.1.2.380 diff -C2 -d -r1.1.2.379 -r1.1.2.380 *** desire.tk 20 Aug 2006 01:38:53 -0000 1.1.2.379 --- desire.tk 20 Aug 2006 02:39:34 -0000 1.1.2.380 *************** *** 1251,1268 ****
#!@#$ this method is too long. ! def Canvas init {x1 y1 xs ys args} { global pd_opendir pd_tearoff OS cmdline canvas history manager window_list lappend window_list $self ! super ! # those four are not to be confused with other @variables of the same name. ! set @canvasx1 $x1 ! set @canvasy1 $y1 ! set @canvasxs $xs ! set @canvasys $ys ! switch [llength $args] { ! 1 {set @subpatch 0; mset {@fontsize} $args; set @name ""; set @mapped 1} ! 2 {set @subpatch 1; mset {@name @mapped} $args; set @fontsize "what?"} ! default {error "wrong number of arguments (expecting 5 or 6)"} ! } set @scale 1.5 ;# must be a float, not int set @action none --- 1251,1259 ----
#!@#$ this method is too long. ! def* Canvas init {mess} { global pd_opendir pd_tearoff OS cmdline canvas history manager window_list lappend window_list $self ! super {#X obj 666 666 pd} ;# bogus ! $self reinit $mess set @scale 1.5 ;# must be a float, not int set @action none *************** *** 1286,1290 **** if {[info exists canvas(file)]} {set @file $canvas(file);set canvas(file) ""} else {set @file ""} if {[info exists canvas(directory)]} {set @directory $canvas(directory); set canvas(directory) ""} else {set @directory ""} - post %s "canvas init: subscribing to $manager" $self subscribe $manager $self changed --- 1277,1280 ---- *************** *** 1294,1312 **** set @coords 0 set @jump 0 ! # the io select count ! set @keynav_iocount 0 ! # which in/outlet is select ! set @keynav_port 0 ! # the list of objects that has io selected ! set @keynav 0 set @keynav_iosel {} set @keynav_current 0 set @keynav_last 0 - #set @shift_wires {} set @keynav_tab_sel "wire" }
! def Canvas reinit {x1 y1 xs ys args} { ! #ignore for now }
--- 1284,1317 ---- set @coords 0 set @jump 0 ! set @keynav_iocount 0 ;# the io select count ! set @keynav_port 0 ;# which in/outlet is select ! set @keynav 0 ;# the list of objects that has io selected set @keynav_iosel {} set @keynav_current 0 set @keynav_last 0 set @keynav_tab_sel "wire" }
! def* Canvas reinit {mess} { ! switch -- [lindex $mess 0] { ! "#N" { ! # those four are not to be confused with other @variables of the same name. ! set @canvasx1 [lindex $mess 2] ! set @canvasy1 [lindex $mess 3] ! set @canvasxs [lindex $mess 4] ! set @canvasys [lindex $mess 5] ! set args [lrange $mess 6 end] ! switch [llength $args] { ! 1 {set @subpatch 0; mset {@fontsize} $args; set @name ""; set @mapped 1} ! 2 {set @subpatch 1; mset {@name @mapped} $args; set @fontsize "what?"} ! default {error "wrong number of arguments (expecting 5 or 6, got [expr 4+[llength $args]])"} ! } ! } ! "#X" { # this is restore ! set @x1 [lindex $mess 2] ! set @y1 [lindex $mess 3] ! $self text= [lrange $mess 4 end] ! } ! } }
*************** *** 1592,1598 **** class_new TextBox {Box}
! def TextBox init {} { super set @edit 0 }
--- 1597,1606 ---- class_new TextBox {Box}
! def TextBox init {mess} { super set @edit 0 + set @x1 [lindex $mess 2] + set @y1 [lindex $mess 3] + set @text [lrange $mess 5 end] }
*************** *** 1679,1684 **** class_new ObjectBox {TextBox}
! def ObjectBox init {args} { ! super set @valid 0 ;# only ObjectBox needs a @valid. (removed all others) set @ninlets 0 --- 1687,1692 ---- class_new ObjectBox {TextBox}
! def ObjectBox init {mess} { ! super $mess set @valid 0 ;# only ObjectBox needs a @valid. (removed all others) set @ninlets 0 *************** *** 2793,2804 **** class_new Box {View}
! def Box init {args} { super set @wires {} }
def Box update_size {} {}
! # will be so that @wires are updated correctly without break encapsulation def* Box connect_out {} {} def* Box connect_in {} {} --- 2801,2821 ---- class_new Box {View}
! def Box init {{mess {}}} { ! global classinfo fields super set @wires {} + set pdclass [lindex $mess 1] + if {[llength $mess]} { + if {$pdclass == "obj"} {set pdclass [lindex $mess 4]} + if {[info exists fields($pdclass)]} { + set i 0 + foreach f $fields($pdclass) {set _($self:$f) [lindex $mess $i]; incr i} + } + } }
def Box update_size {} {}
! # will be so that @wires are updated correctly without breaking encapsulation def* Box connect_out {} {} def* Box connect_in {} {} *************** *** 3072,3080 **** "#N" { set class canvas ! if {$isnew} { ! eval [concat [list Canvas new_as $self] [lrange $mess 2 end]] ! } else { ! eval [concat [list $self reinit] [lrange $mess 2 end]] ! } set canvas(current) $self set isnew 0 --- 3089,3093 ---- "#N" { set class canvas ! if {$isnew} {Canvas new_as $self $mess} else {$self reinit $mess} set canvas(current) $self set isnew 0 *************** *** 3093,3097 **** set _($self:isnew) [expr [llength $mess] == 4] } ! if {$isnew} {$_class new_as $self} switch -- $class { array {} --- 3106,3121 ---- set _($self:isnew) [expr [llength $mess] == 4] } ! #if {$isnew} {$_class new_as $self} ! #puts "CLASS IS $class" ! if {$isnew} {$_class new_as $self $mess} else {$self reinit $mess} ! #switch -- $class { ! # obj {$self text= [join [lrange $mess 4 end]]} ! # msg {$self text= [join [lrange $mess 4 end]]} ! # text {$self text= [join [lrange $mess 4 end]]} ! # restore {$self text= [join [lrange $mess 4 end]]} ! # array {puts "\033[0;1;32mGOT ARRAY!"} ! # default { ! # set i 0; foreach f $fields($class) {set _($self:$f) [lindex $mess $i]; incr i}} ! #} switch -- $class { array {} *************** *** 3102,3116 **** $self ninlets= $ninlets ;# bogus in case of array $self noutlets= $noutlets - #puts "CLASS IS $class" - switch -- $class { - obj {$self text= [join [lrange $mess 4 end]]} - msg {$self text= [join [lrange $mess 4 end]]} - text {$self text= [join [lrange $mess 4 end]]} - restore {$self text= [join [lrange $mess 4 end]]} - array {puts "\033[0;1;32mGOT ARRAY!"} - default { - set i 0; foreach f $fields($class) { - set _($self:$f) [lindex $mess $i]; incr i}} - } #!@#$ goes with the request tracking feature to be impl in the server if {[info exists canvas(msg_isnew)]} { --- 3126,3129 ---- *************** *** 3136,3145 **** class_new MessageBox {TextBox}
! def MessageBox init {args} { ! super ! set @w 15 set @xs $@w set @ys $@w ;# this is a bug - set @text "" }
--- 3149,3157 ---- class_new MessageBox {TextBox}
! def MessageBox init {mess} { ! super $mess ! set @w 15 ;# this is useless? set @xs $@w set @ys $@w ;# this is a bug }
*************** *** 3472,3478 **** class_new SymbolAtom {AtomBox}
! def* AtomBox init {args} { global font ! super set @clicking 0 ;#!@#$ get rid of this set @val 0 --- 3484,3490 ---- class_new SymbolAtom {AtomBox}
! def* AtomBox init {mess} { global font ! super $mess set @clicking 0 ;#!@#$ get rid of this set @val 0 *************** *** 3482,3487 **** }
! def* FloatAtom init {args} {eval [concat [list super] $args]; set @text 0} ! def SymbolAtom init {args} {eval [concat [list super] $args]; set @text "symbol"} def* AtomBox canonize {x} {return x} def* FloatAtom canonize {x} {return [expr $x]} --- 3494,3499 ---- }
! def* FloatAtom init {mess} {super $mess; set @text 0} ! def SymbolAtom init {mess} {super $mess; set @text "symbol"} def* AtomBox canonize {x} {return x} def* FloatAtom canonize {x} {return [expr $x]} *************** *** 3603,3609 ****
class_new NumBox {Labeled Box} ! def NumBox init {args} { ! super ! eval [concat [list super] $args] set @clicking 0 set @old_val 0 --- 3615,3620 ----
class_new NumBox {Labeled Box} ! def NumBox init {mess} { ! super $mess set @clicking 0 set @old_val 0 *************** *** 3821,3826 **** }
! def Slider init {args} { ! super set @clicking 0 set @value 0 --- 3832,3837 ---- }
! def Slider init {mess} { ! super $mess set @clicking 0 set @value 0 *************** *** 3934,3939 **** #-----------------------------------------------------------------------------------# class_new Bang {BlueBox} ! def Bang init {args} { ! super set @w 15 set @flash 0 --- 3945,3950 ---- #-----------------------------------------------------------------------------------# class_new Bang {BlueBox} ! def Bang init {mess} { ! super $mess set @w 15 set @flash 0 *************** *** 3977,3982 **** class_new Toggle {BlueBox}
! def Toggle init {args} { ! super set @on 0 set @w 15 --- 3988,3993 ---- class_new Toggle {BlueBox}
! def Toggle init {mess} { ! super $mess set @on 0 set @w 15 *************** *** 4135,4139 **** def Dropper erase {} {destroy $@canvas.${self}DROP; super}
! class_new Cnv {Labeled View} def Cnv draw {} { mset {x1 y1} [$self xy] --- 4146,4151 ---- def Dropper erase {} {destroy $@canvas.${self}DROP; super}
! class_new Cnv {Labeled Box} ! def Cnv draw {} { mset {x1 y1} [$self xy] *************** *** 4147,4157 **** class_new Array {Box}
- def Array init {} { - - } - def Array draw {} { global font mset {x1 y1} {0 0} $self item TEXT text [list $x1 $y1] \ -font $font(str) -text "an array named '$@name' should appear in this patch" \ --- 4159,4166 ---- class_new Array {Box}
def Array draw {} { global font mset {x1 y1} {0 0} + set @name (unknown) $self item TEXT text [list $x1 $y1] \ -font $font(str) -text "an array named '$@name' should appear in this patch" \ *************** *** 5501,5513 **** foreach {type names} $ddrc_options { ! set label "" ! if {[llength $names] > 1} { ! foreach name $names { ! append label " [say $name]" ! } ! } else { set label [say $names] ! } ! if {[string length $label] > $@max_label} {set @max_label [expr [string length $label] + 20]} } --- 5510,5520 ---- foreach {type names} $ddrc_options { ! set label "" ! if {[llength $names] > 1} { ! foreach name $names {append label " [say $name]"} ! } else { set label [say $names] ! } ! if {[string length $label] > $@max_label} {set @max_label [expr [string length $label]+20]} } *************** *** 5517,5521 **** switch $type { section { ! $self add_section [incr section] [say $name] set which_section $f.main.$section set which_self $self --- 5524,5528 ---- switch $type { section { ! $self add_section [incr section] [say $name] set which_section $f.main.$section set which_self $self *************** *** 5545,5550 **** set @$var $which_section.[string tolower [lindex $name 0]].[string tolower $item] } ! puts " name::: $name" ! $self add $which_section [list $name $type] } crosshair { --- 5552,5556 ---- set @$var $which_section.[string tolower [lindex $name 0]].[string tolower $item] } ! $self add $which_section [list $name $type] } crosshair {