Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9822
Modified Files: Tag: desiredata desire.tk Log Message: fix.
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.305 retrieving revision 1.1.2.600.2.306 diff -C2 -d -r1.1.2.600.2.305 -r1.1.2.600.2.306 *** desire.tk 7 Aug 2007 07:45:52 -0000 1.1.2.600.2.305 --- desire.tk 7 Aug 2007 08:04:55 -0000 1.1.2.600.2.306 *************** *** 295,298 **** --- 295,299 ---- def Hash reinit {args} {$self clear; foreach {k v} $args {$self set $k $v}} def Hash set {k v} {set ::hash($self:$k) $v} + def Hash exists {k} {info exists ::hash($self:$k)} def Hash get {k} {set ::hash($self:$k)} def Hash size {} {llength [$self keys]} *************** *** 313,316 **** --- 314,322 ---- def Hash delete {} {$self clear; super}
+ def Hash search {v} { + foreach k [$self keys] {if {[$self get $k] == $v} {return $k}} + return -1 ;# this is not correct as -1 could be a Hash key, though not in its current context of use... + } + if 0 { set h [Hash new foo bar 1 2 3 4] *************** *** 319,327 **** puts values=[$h values] puts list=[$h list] }
class_new Selection {Hash} def Selection set {k v} {super $k $v; $v selected?= 1} ! def Selection unset {k} {super $k; [$self get $k] selected?= 0}
#-----------------------------------------------------------------------------------# --- 325,334 ---- puts values=[$h values] puts list=[$h list] + foreach i {1 2 3 4} {puts "exists $i : [$h exists $i]"} }
class_new Selection {Hash} def Selection set {k v} {super $k $v; $v selected?= 1} ! def Selection unset {k} {super $k; if {[$self exists $k]} {[$self get $k] selected?= 0}}
#-----------------------------------------------------------------------------------# *************** *** 2114,2120 **** $self disconnect [$wire connects] set @keynav 0; $@active hide; set @keynav_tab_sel "object" ! set from_idx [$self children_idx $from] ! set to_idx [$self children_idx $to] ! set obj3_idx [$self children_idx $obj] $self connect [list $from_idx $outlet $obj3_idx 0] [list $self keynav_current=] $self connect [list $obj3_idx 0 $to_idx $inlet] --- 2121,2127 ---- $self disconnect [$wire connects] set @keynav 0; $@active hide; set @keynav_tab_sel "object" ! set from_idx [$@objects search $from] ! set to_idx [$@objects search $to] ! set obj3_idx [$@objects search $obj] $self connect [list $from_idx $outlet $obj3_idx 0] [list $self keynav_current=] $self connect [list $obj3_idx 0 $to_idx $inlet] *************** *** 2132,2138 **** def Canvas new_object_chain_wire {obj} { obj_hist prepend [$obj text] ! set from_idx [$self children_idx [lindex [$self selection] 0]] $self deselect_all ! set to_idx [$self children_idx $obj] $self connect [list $from_idx 0 $to_idx 0] $self action= none --- 2139,2145 ---- def Canvas new_object_chain_wire {obj} { obj_hist prepend [$obj text] ! set from_idx [$@objects search [lindex [$self selection] 0]] $self deselect_all ! set to_idx [$@objects search $obj] $self connect [list $from_idx 0 $to_idx 0] $self action= none *************** *** 2140,2143 **** --- 2147,2152 ---- }
+ def Canvas objects {} {return $@objects} + #def Canvas wires {} {return $@wires} def Canvas selection {} {$@objectsel values} def Canvas selection= {objs} {$@objectsel clear; $self selection+= $objs} *************** *** 2977,2984 **** mset {from outlet to inlet} [$id report] $self disconnect [$id connects] ! set from_idx [$self children_idx $from] ! set to_idx [$self children_idx $to] foreach obj $in_objs { ! set obj3_idx [$self children_idx $obj] if {![llength [$obj ioselect]]} {set port 0} else {set port [lindex [$obj ioselect] 0]} set w1 [list $from_idx $outlet $obj3_idx $port] --- 2986,2993 ---- mset {from outlet to inlet} [$id report] $self disconnect [$id connects] ! set from_idx [$@objects search $from] ! set to_idx [$@objects search $to] foreach obj $in_objs { ! set obj3_idx [$@objects search $obj] if {![llength [$obj ioselect]]} {set port 0} else {set port [lindex [$obj ioselect] 0]} set w1 [list $from_idx $outlet $obj3_idx $port] *************** *** 2986,2990 **** } foreach obj $out_objs { ! set obj3_idx [$self children_idx $obj] if {![llength [$obj ioselect]]} {set port 0} else {set port [lindex [$obj ioselect] 0]} set w2 [list $obj3_idx $port $to_idx $inlet] --- 2995,2999 ---- } foreach obj $out_objs { ! set obj3_idx [$@objects search $obj] if {![llength [$obj ioselect]]} {set port 0} else {set port [lindex [$obj ioselect] 0]} set w2 [list $obj3_idx $port $to_idx $inlet] *************** *** 3739,3745 **** def Canvas reconnect {} { foreach from $@auto_wire_from { ! set idx1 [$self children_idx $from] foreach to $@auto_wire_to { ! set idx2 [$self children_idx $to] set wire [list $idx1 0 $idx2 0] if {[$self wire_idx $wire] < 0} {$self connect $wire} --- 3748,3754 ---- def Canvas reconnect {} { foreach from $@auto_wire_from { ! set idx1 [$@objects search $from] foreach to $@auto_wire_to { ! set idx2 [$@objects search $to] set wire [list $idx1 0 $idx2 0] if {[$self wire_idx $wire] < 0} {$self connect $wire} *************** *** 3978,3983 **** default {} } ! set from_idx [$@canvas children_idx $@from] ! set to_idx [$@canvas children_idx $@to] if {$from_idx >= 0 && $to_idx >= 0 && $@from != $@to} { $@canvas connect [list $from_idx $@outlet $to_idx $@inlet] --- 3987,3992 ---- default {} } ! set from_idx [[$@canvas objects] search $@from] ! set to_idx [[$@canvas objects] search $@to] if {$from_idx >= 0 && $to_idx >= 0 && $@from != $@to} { $@canvas connect [list $from_idx $@outlet $to_idx $@inlet] *************** *** 4623,4630 **** } else { foreach out_obj $@keynav_iosel_o { ! set from [$self children_idx $out_obj] set outlet [lindex $_($out_obj:ioselect) 0] foreach in_obj $@keynav_iosel_i { ! set to [$self children_idx $in_obj] set inlet [lindex $_($in_obj:ioselect) 0] $self connect [list $from $outlet $to $inlet] --- 4632,4639 ---- } else { foreach out_obj $@keynav_iosel_o { ! set from [$@objects search $out_obj] set outlet [lindex $_($out_obj:ioselect) 0] foreach in_obj $@keynav_iosel_i { ! set to [$@objects search $in_obj] set inlet [lindex $_($in_obj:ioselect) 0] $self connect [list $from $outlet $to $inlet] *************** *** 4941,4946 **** mset {from outlet to inlet} $@connects set children [$c objects] ! set @from [lindex $children $from] ! set @to [lindex $children $to] # associate wires to its connected objects lappend _($@from:wires2) $self --- 4950,4955 ---- mset {from outlet to inlet} $@connects set children [$c objects] ! set @from [$children get $from] ! set @to [$children get $to] # associate wires to its connected objects lappend _($@from:wires2) $self *************** *** 8351,8356 **** if {$selcanvas == ""} { list #X connect \ ! [$@canvas children_idx $@from] $@outlet \ ! [$@canvas children_idx $@to] $@inlet } { list #X connect \ --- 8360,8365 ---- if {$selcanvas == ""} { list #X connect \ ! [[$@canvas objects] search $@from] $@outlet \ ! [[$@canvas objects] search $@to] $@inlet } { list #X connect \