[PD-cvs] pd/src pd.tk-test.pd, NONE, 1.1.2.1 pd.tk, 1.1.2.5, 1.1.2.6 pd_objects.tk, 1.1.2.5, 1.1.2.6

carmen rocco ix9 at users.sourceforge.net
Fri Aug 19 00:20:20 CEST 2005


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16552

Modified Files:
      Tag: devel_0_39
	pd.tk pd_objects.tk 
Added Files:
      Tag: devel_0_39
	pd.tk-test.pd 
Log Message:
state sync via send/receive


Index: pd.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/pd.tk,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** pd.tk	12 Aug 2005 23:45:45 -0000	1.1.2.5
--- pd.tk	18 Aug 2005 22:20:18 -0000	1.1.2.6
***************
*** 53,63 ****
  	} {set sx 0; set sy 0}
  
! 	item_ua $p $t $id abs [dict create x $x xx [expr $x + $sx] y $y yy [expr $y + $sy] color {128 128 128} v 1] 0
  
  	if {[dict exists $obj $type defaults]} {
! 	    item_ua $p $t $id abs [dict get $obj $type defaults] 0
  	}
  
! 	item_ua $p $t $id abs $d 0
  	item_draw $p $t $id
      }
--- 53,63 ----
  	} {set sx 0; set sy 0}
  
! 	update $p $t $id abs [dict create x $x xx [expr $x + $sx] y $y yy [expr $y + $sy] color {128 128 128} v 1] 0
  
  	if {[dict exists $obj $type defaults]} {
! 	    update $p $t $id abs [dict get $obj $type defaults] 0
  	}
  
! 	update $p $t $id abs $d 0
  	item_draw $p $t $id
      }
***************
*** 88,99 ****
  	    set ($t:sel) {}
  	    item_info $p $t ""
! #	    puts "$p $t delete $item"
  	}
      }
      
      proc item_pos {p t item r x y xx yy} {
! 	item_ua $p $t $item $r [dict create x $x y $y xx $xx yy $yy] 1}
  
!     proc item_ua {p t item r u redraw} {
  	variable ""
  	foreach a [dict keys $u] {
--- 88,99 ----
  	    set ($t:sel) {}
  	    item_info $p $t ""
! 	    send "delete $item"
  	}
      }
      
      proc item_pos {p t item r x y xx yy} {
! 	update $p $t $item $r [dict create x $x y $y xx $xx yy $yy] 1}
  
!     proc update {p t item r u redraw} {
  	variable ""
  	foreach a [dict keys $u] {
***************
*** 102,110 ****
  		rel {dict set ($t) $item $a [expr {[dict get $($t) $item $a] + [dict get $u $a]}]}
  	    }
! 	    #puts [concat update $p $t $item $a [dict get $($t) $item $a]]
  	}
  	if {$redraw == 1} {redraw $p $t $item}
      }
  
      proc pencil {p t a x y} {
  	variable ""
--- 102,114 ----
  		rel {dict set ($t) $item $a [expr {[dict get $($t) $item $a] + [dict get $u $a]}]}
  	    }
! 	    send [concat update $item $a [dict get $($t) $item $a]]
  	}
  	if {$redraw == 1} {redraw $p $t $item}
      }
  
+     proc update_one {p t item r k v redraw} {
+ 	update $p $t $item $r [dict create $k $v] $redraw
+     }
+ 
      proc pencil {p t a x y} {
  	variable ""
***************
*** 162,166 ****
  		foreach local [dict keys [dict get $obj $type defaults]] {
  		    set $local [dict get $obj $type defaults $local]}}
! 	    eval [dict get $obj $type control Button-1]
  	}
      }
--- 166,170 ----
  		foreach local [dict keys [dict get $obj $type defaults]] {
  		    set $local [dict get $obj $type defaults $local]}}
! 	    if {[dict exists $obj $type control Button-1]} {eval [dict get $obj $type control Button-1]}
  	}
      }
***************
*** 282,285 ****
--- 286,295 ----
      }
  
+    proc msg {} {
+ 	if {![winfo exists .msg]} {
+ 	    toplevel .msg
+ 	    grid [entry .msg.text]
+ 	    bind .msg.text <KeyPress-Return> {::pd::send [.msg.text get]}}}
+ 
      proc inspector {p t} {
  	variable ""
***************
*** 378,382 ****
  	    $m add command -label "console" -command {tkcon show}
  	    $m add command -label "inspector" -command "::pd::inspector $p $t"
! 
  	} else {
  	    #	    $p.rmenu entryconfigure 0 -label $x
--- 388,392 ----
  	    $m add command -label "console" -command {tkcon show}
  	    $m add command -label "inspector" -command "::pd::inspector $p $t"
! 	    $m add command -label "msg" -command "::pd::msg"
  	} else {
  	    #	    $p.rmenu entryconfigure 0 -label $x
***************
*** 505,509 ****
      proc item_mua {p t r u redraw} {
  	variable ""
! 	foreach item $($t:sel) {item_ua $p $t $item $r $u $redraw}
      }
  
--- 515,519 ----
      proc item_mua {p t r u redraw} {
  	variable ""
! 	foreach item $($t:sel) {update $p $t $item $r $u $redraw}
      }
  
***************
*** 624,627 ****
--- 634,665 ----
      new .c c {bg gray86 ln white mode edit sc orange samplerate 44100 xa 0 xb 100 ya 0 yb 100 qx 10 qy 10 mx 15 my 15}
  
+     variable pd_send
+     if {[catch {set pd_send [socket localhost 4400]}]} {set pd_send -1} {puts "connected $pd_send"}
+     catch {
+ 	set pd_receive [socket -server ::pd::receive_conn 4401]
+     }
+     proc receive_conn {s addr port} {
+ 	fileevent $s readable [list ::pd::receive $s]
+ 	fconfigure $s -buffering line -blocking 0
+ 	puts "connection from $addr"
+     }
+     proc receive {s} {
+ 	set l [gets $s]
+ 	if {[eof $s]} {
+ 	    close $s
+ 	} else {
+ 	    if {[catch {eval $l}]} {puts "error in: $l"}
+ 	}
+     }
+     proc send {msg} {
+ 	variable pd_send
+ 	if {$pd_send ne -1} {
+ #	    puts "sending: $msg"
+ 	    puts $pd_send [concat $msg \;]
+ 	    flush $pd_send
+ 	}
+     }
+ 
+ 
  }
  

--- NEW FILE: pd.tk-test.pd ---
#N canvas 324 0 610 165 10;
#X obj 147 64 netreceive 4400;
#X obj 147 90 print r;
#X obj 238 90 netsend;
#X msg 238 62 connect localhost 4401;
#X obj 332 123 print sending;
#X floatatom 370 54 0 0 0 0 - - -;
#X obj 303 92 t a a;
#X msg 265 38 disconnect;
#X msg 371 81 send update_one .c c 0 abs x \$1 1;
#X connect 0 0 1 0;
#X connect 3 0 2 0;
#X connect 5 0 8 0;
#X connect 6 0 2 0;
#X connect 6 1 4 0;
#X connect 7 0 2 0;
#X connect 8 0 6 0;

Index: pd_objects.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/pd_objects.tk,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** pd_objects.tk	12 Aug 2005 23:45:45 -0000	1.1.2.5
--- pd_objects.tk	18 Aug 2005 22:20:18 -0000	1.1.2.6
***************
*** 4,8 ****
      rect {
  	tags {
! 	    box
  	}
  	defaults {
--- 4,8 ----
      rect {
  	tags {
! 	    box img
  	}
  	defaults {
***************
*** 13,19 ****
--- 13,25 ----
  	    zs_x 0.5
  	    zs_y 0.5
+ 	    img ""
  	}
  	draw {
  	    $p create rect 0 0 0 0 -tags [concat $tags box]
+ 	    if {$img ne ""} {
+ 		package require Img
+ 		image create photo photo$id
+ 		$p create image 0 0 -tags [concat $tags img]
+ 	    }
  	}
  	redraw {
***************
*** 21,25 ****
  	    if {[expr $zero_y == 1]} {set zs_y [tr $p $t y id $zs_y]; set yy [expr $y + $zs_y]; set y [expr $y - $zs_y]}
  	    $p coords $box $x $y $xx $yy
! 
  	    $p itemconfigure $box -fill $gcolor -outline $color -width [expr $selected + 1]
  	}
--- 27,36 ----
  	    if {[expr $zero_y == 1]} {set zs_y [tr $p $t y id $zs_y]; set yy [expr $y + $zs_y]; set y [expr $y - $zs_y]}
  	    $p coords $box $x $y $xx $yy
! 	    $p coords $img $x $y
! 	    if {$img ne ""} {
! 		photo$id configure -file $img
! 		set photo photo$id
! 	    } {set photo ""}
! 	    $p itemconfigure $img -image $photo
  	    $p itemconfigure $box -fill $gcolor -outline $color -width [expr $selected + 1]
  	}
***************
*** 146,150 ****
  	control {
  	    Button-1 {
! 	        item_ua $p $t $id rel [dict create v [expr {($x - $($t:cx)) / 100.0 * ($max - $min + 0.)}]] 1
  	    }
  	}
--- 157,161 ----
  	control {
  	    Button-1 {
! 	        update $p $t $id rel [dict create v [expr {($x - $($t:cx)) / 100.0 * ($max - $min + 0.)}]] 1
  	    }
  	}
***************
*** 166,170 ****
  	    $p create waveform 0 0 -tags [concat $tags w] -sound s$id -fill white
  	    set length [expr [s$id length] / ($($t:samplerate) + 0.0) * 1000]
! 	    mat_item_ua $p $t $id abs [dict create xx [expr [dict get $($t) $id x] + $length]] 0
  	    $p create text 0 0 -tags [concat $tags tl] -font {{bitstream vera sans} 8} -fill HotPink -anchor nw -justify left -text "[string range $length 0 10] s"
  	    $p create rectangle 0 0 0 0 -tags [concat $tags tlr] -fill LightGreen -width 0
--- 177,181 ----
  	    $p create waveform 0 0 -tags [concat $tags w] -sound s$id -fill white
  	    set length [expr [s$id length] / ($($t:samplerate) + 0.0) * 1000]
! 	    update $p $t $id abs [dict create xx [expr [dict get $($t) $id x] + $length]] 0
  	    $p create text 0 0 -tags [concat $tags tl] -font {{bitstream vera sans} 8} -fill HotPink -anchor nw -justify left -text "[string range $length 0 10] s"
  	    $p create rectangle 0 0 0 0 -tags [concat $tags tlr] -fill LightGreen -width 0





More information about the Pd-cvs mailing list