[PD-cvs] pd/src desire.c, 1.1.2.19, 1.1.2.20 desire.tk, 1.1.2.67, 1.1.2.68

Mathieu Bouchard matju at users.sourceforge.net
Sun Sep 18 21:43:39 CEST 2005


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

Modified Files:
      Tag: devel_0_39
	desire.c desire.tk 
Log Message:
drawing inlets and outlets works again


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.67
retrieving revision 1.1.2.68
diff -C2 -d -r1.1.2.67 -r1.1.2.68
*** desire.tk	18 Sep 2005 16:35:01 -0000	1.1.2.67
--- desire.tk	18 Sep 2005 19:43:37 -0000	1.1.2.68
***************
*** 89,94 ****
  
  proc super {args} {
! 	upvar 2 methods methods self self
! 	set i [expr 1+[uplevel 2 {list $i}]]
  	puts "!!! super #$i"
  	if {[llength $methods] < $i} {error "no more supermethods"}
--- 89,94 ----
  
  proc super {args} {
! 	upvar 2 methods methods self self i oi
! 	set i [expr 1+$oi]
  	puts "!!! super #$i"
  	if {[llength $methods] < $i} {error "no more supermethods"}
***************
*** 100,103 ****
--- 100,105 ----
  class_new thing
  set _(thing:_super) {}
+ # virtual destructor
+ def* thing ~ {} {}
  
  #-----------------------------------------------------------------------------------#
***************
*** 1175,1180 ****
      for {set i 0} {$i<$n} {incr i} {
          set onset [expr $x1 + ($@xs-$look(iowidth)) * $i / $nplus]
!         set points [list [expr $onset+$fx] $y [expr $onset-$fx+$look(iowidth)] [expr $y]]
!         set points [list [expr $onset+$fx] $y [expr $onset-$fx+$look(iowidth)] [expr $y]]
  	# will update this code when proc item deals with mult.tags
  	if {[llength [$c gettags ${self}$which$i]] != 0} {
--- 1177,1181 ----
      for {set i 0} {$i<$n} {incr i} {
          set onset [expr $x1 + ($@xs-$look(iowidth)) * $i / $nplus]
!         set points [list [expr $onset] $y [expr $onset+$look(iowidth)] [expr $y+1]]
  	# will update this code when proc item deals with mult.tags
  	if {[llength [$c gettags ${self}$which$i]] != 0} {
***************
*** 1191,1196 ****
      set fy $look(iopos)
      foreach {x1 y1} [$self xy $canvas] {}
!     io_draw/2 $self $canvas i  $@inlets [expr $y1-$fy+$look(extrapix)]
!     io_draw/2 $self $canvas o $@outlets [expr $y1+$fy]
  }
  
--- 1192,1197 ----
      set fy $look(iopos)
      foreach {x1 y1} [$self xy $canvas] {}
!     io_draw/2 $self $canvas i  $@inlets [expr $y1-$fy-1]
!     io_draw/2 $self $canvas o $@outlets [expr $y1+$fy+$@ys]
  }
  
***************
*** 1200,1214 ****
  class_new textbox {view}
  
  def textbox draw {canvas} {
      global font look
      foreach {x1 y1} [$self xy $canvas] {}
      puts "x1=$x1 y1=$y1"
!     item $self $canvas TEXT text [list $x1 $y1] \
!         -font [format -*-courier-medium--normal--%d-* $font(size)] \
!         -text $@text -fill $look(objectfg) -anchor nw
  }
  
  def* textbox edit {canvas} {
  	global look font
  	set @edit 1
  	set _($canvas:obj_in_edit_old) $self
--- 1201,1224 ----
  class_new textbox {view}
  
+ def textbox inlets= {v}  {set @inlets  $v}
+ def textbox outlets= {v} {set @outlets $v}
+ 
  def textbox draw {canvas} {
      global font look
      foreach {x1 y1} [$self xy $canvas] {}
      puts "x1=$x1 y1=$y1"
!     if {$@edit} {
! 	set t .x$canvas.c.${self}text
! 	$t configure -width [expr [string length $@text]+1]
!     } {
! 	item $self $canvas TEXT text [l+ {2 2} [list $x1 $y1]] \
! 		-font [format -*-courier-medium--normal--%d-* $font(size)] \
! 		-text $@text -fill $look(objectfg) -anchor nw
!     }
  }
  
  def* textbox edit {canvas} {
  	global look font
+ 	if {$@edit} {return}
  	set @edit 1
  	set _($canvas:obj_in_edit_old) $self
***************
*** 1218,1222 ****
  	set @oldtext $@text
  	$self update_size
- 	$self draw $canvas
  	set t .x$canvas.c.${self}text
  	text $t -height 1 -width [string length $@text] -relief flat \
--- 1228,1231 ----
***************
*** 1230,1233 ****
--- 1239,1243 ----
  	.x$canvas.c create window [expr $@cx+1] [expr $@cy+1] \
  		-window $t -anchor nw -tags "${self}text $self"
+ 	$self draw $canvas
  	$t configure -pady 0
          $t insert 1.0 $@text
***************
*** 1236,1246 ****
  
  def* text key {canvas widget x y key iso shift} {
! 	global font
! 	set @text [$widget get 1.0 1.end]
! 	set n [expr [string length $@text]+1]
! 	puts "@text=$@text n=$n"
! 	$self update_size
! 	$self draw $canvas
! 	$widget configure -width $n
  }
  
--- 1246,1254 ----
  
  def* text key {canvas widget x y key iso shift} {
! #	after 0 "global _
! 		set @text [$widget get 1.0 1.end]
! 		$self update_size
! 		$self draw $canvas
! #	"
  }
  
***************
*** 1272,1276 ****
  }
  
! def* objectbox update_size {} {
  	global font
  	set @xs [expr $font(padx)+$font(width)*([expr [string length $@text]+1]-$@valid)]
--- 1280,1284 ----
  }
  
! def* textbox update_size {} {
  	global font
  	set @xs [expr $font(padx)+$font(width)*([expr [string length $@text]+1]-$@valid)]
***************
*** 2038,2046 ****
  	set i 1
  	set class [lindex $d $i]
! 	switch -- $class { obj {
! 		set i 4
! 		set class [lindex $d 4]
! #		puts "_($x:text)=$_($x:text)"
! 	}}
  	if {![info exists _($x:_class)]} {
  		if {[info exists classinfo($class)]} {
--- 2046,2050 ----
  	set i 1
  	set class [lindex $d $i]
! 	switch -- $class {obj {set i 4; set class [lindex $d 4]}}
  	if {![info exists _($x:_class)]} {
  		if {[info exists classinfo($class)]} {
***************
*** 2050,2060 ****
  		}
  		# hack
! 		set c $_($x:canvas)
  		$x init
  		set _($x:text) [lindex $d $i end]
  		set _($x:valid) 0
  		$x update_size
! 		$x draw $c
! 		if {[string length $@text]==0} {$x edit $canvas}
  	}
  	if {![info exists fields($class)]} {set class obj}
--- 2054,2065 ----
  		}
  		# hack
! 		set canvas $_($x:canvas)
  		$x init
  		set _($x:text) [lindex $d $i end]
  		set _($x:valid) 0
  		$x update_size
! 		$x draw $canvas
! 		puts "_($x:text)='$_($x:text)'"
! 		if {[string length $_($x:text)]==0} {$x edit $canvas}
  	}
  	if {![info exists fields($class)]} {set class obj}
***************
*** 2080,2084 ****
  def* view wb_activate {args} {}
  def* view wb_select   {args} {}
! def* view wb_delete   {args} {} 
  
  proc item {self canvas suffix type coords args} {
--- 2085,2089 ----
  def* view wb_activate {args} {}
  def* view wb_select   {args} {}
! def* view wb_delete   {canvas} {$self erase $canvas; $self ~}
  
  proc item {self canvas suffix type coords args} {

Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.19
retrieving revision 1.1.2.20
diff -C2 -d -r1.1.2.19 -r1.1.2.20
*** desire.c	18 Sep 2005 09:22:18 -0000	1.1.2.19
--- desire.c	18 Sep 2005 19:43:37 -0000	1.1.2.20
***************
*** 6045,6052 ****
  
      sprintf(tag, "graph%lx", (t_int)x);
!     if (vis)
!         glist_drawiofor(parent_glist, &x->gl_obj, 1,
!             tag, x1, y1, x2, y2);
!     else glist_eraseiofor(parent_glist, &x->gl_obj, tag);
          /* if we look like a graph but have been moved to a toplevel,
          just show the bounding rectangle */
--- 6045,6052 ----
  
      sprintf(tag, "graph%lx", (t_int)x);
!     if (vis) {
! 	sys_mgui(x,"ninlets=","d",obj_ninlets(x));
! 	sys_mgui(x,"noutlets=","d",obj_noutlets(x));
!     } else glist_eraseiofor(parent_glist, &x->gl_obj, tag);
          /* if we look like a graph but have been moved to a toplevel,
          just show the bounding rectangle */
***************
*** 12340,12344 ****
  void text_eraseborder(t_text *x, t_glist *glist, char *tag) {}
  
! static void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize) {
      if (x->te_type == T_OBJECT) {
      	t_binbuf *b = binbuf_new();
--- 12340,12344 ----
  void text_eraseborder(t_text *x, t_glist *glist, char *tag) {}
  
! void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize) {
      if (x->te_type == T_OBJECT) {
      	t_binbuf *b = binbuf_new();
***************
*** 12619,12622 ****
--- 12619,12626 ----
  	binbuf_gettext(buf,&s,&n);
  	sys_vgui("update_object %x {%.*s}\n", (unsigned)self,n,s);
+ 	//sys_mgui(self,"inlets=","i", obj_ninlets((t_text *)self));
+ 	//sys_mgui(self,"outlets=","i",obj_noutlets((t_text *)self));
+ 	sys_vgui("%lx inlets= %d\n",  self, obj_ninlets((t_text *)self));
+ 	sys_vgui("%lx outlets= %d\n", self, obj_noutlets((t_text *)self));
  	binbuf_free(buf);
  	free(s);





More information about the Pd-cvs mailing list