[PD-cvs] pd/src desire.tk,1.1.2.97,1.1.2.98

Mathieu Bouchard matju at users.sourceforge.net
Wed Nov 2 14:51:31 CET 2005


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
proc item renamed to def view item.
also it loses the $canvas arg.


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.97
retrieving revision 1.1.2.98
diff -C2 -d -r1.1.2.97 -r1.1.2.98
*** desire.tk	2 Nov 2005 13:39:03 -0000	1.1.2.97
--- desire.tk	2 Nov 2005 13:51:29 -0000	1.1.2.98
***************
*** 557,560 ****
--- 557,579 ----
  }
  
+ proc item {self canvas suffix type coords args} {
+ 	eval [concat [list $self item $suffix $type $coords] $args]
+ }
+ 
+ def view item {suffix type coords args} {
+ 	set canvas $@canvas
+ 	set c .x$canvas.c
+ 	set ss $self$suffix
+ 	if {![llength [$c gettags $ss]]} {
+ 		eval  [concat [list $c create $type $coords  -tags "$ss $self"] $args]
+ 		#eval [concat [list $c create $type $coords  -tags $ss] $args]
+ 	} {
+ 		eval [concat [list $c itemconfigure $ss] $args]
+ 		eval [concat [list $c coords        $ss] $coords]
+ 	}
+ }
+ 
+ proc item_delete {self canvas} {.x$canvas.c delete $self}
+ 
  def* view erase {canvas} {item_delete $self $canvas}
  def* view   click     {args} {}
***************
*** 1073,1077 ****
  	$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
--- 1092,1096 ----
  	$t configure -width [expr [string length $@text]+1]
      } {  
! 	$self item TEXT text [l+ {2 2} [list $x1 $y1]] \
  		-font [format -*-courier-medium--normal--%d-* $font(size)] \
  		-text $@text -fill $look(objectfg) -anchor nw
***************
*** 1175,1181 ****
  	set xyb [l+ [list $x2 $y1 $x1 $y1 $x1 $y2] [list -1 +1 +1 +1 +1 -1]]
  	set xyc [l+ [list $x2 $y1 $x2 $y2 $x1 $y2] [list -1 +1 -1 -1 +1 -1]]
! 	item $self $canvas BASE  rectangle $xya -fill $look(objectbg)
! 	item $self $canvas BASE2 line      $xyb -fill $look(objectframe2)
! 	item $self $canvas BASE3 line      $xyc -fill $look(objectframe3)
          io_draw $self $canvas
          if {[$self selected?]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)}
--- 1194,1200 ----
  	set xyb [l+ [list $x2 $y1 $x1 $y1 $x1 $y2] [list -1 +1 +1 +1 +1 -1]]
  	set xyc [l+ [list $x2 $y1 $x2 $y2 $x1 $y2] [list -1 +1 -1 -1 +1 -1]]
! 	$self item BASE  rectangle $xya -fill $look(objectbg)
! 	$self item BASE2 line      $xyb -fill $look(objectframe2)
! 	$self item BASE3 line      $xyc -fill $look(objectframe3)
          io_draw $self $canvas
          if {[$self selected?]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)}
***************
*** 1346,1350 ****
  
  def canvas motion {x y mods state} {
!     global old_x old_y mouse font
      global tooltip dehighlight look
      set c .x$self.c
--- 1365,1369 ----
  
  def canvas motion {x y mods state} {
!     global mouse font
      global tooltip dehighlight look
      set c .x$self.c
***************
*** 1527,1531 ****
  			if {[llength $@selection] == 1} {
  				#puts "____complete [lindex $@selection 0] first!____"
! 				set old_obj [lindex $@selection 0]
  				if {$@select_by == "click"} {$old_obj unedit $self}
  				set @obj_in_edit {}
--- 1546,1550 ----
  			if {[llength $@selection] == 1} {
  				#puts "____complete [lindex $@selection 0] first!____"
! 				set @old_obj [lindex $@selection 0]
  				if {$@select_by == "click"} {$old_obj unedit $self}
  				set @obj_in_edit {}
***************
*** 1545,1557 ****
  	    }
  	    set @action move
! 	}canvas click
  }
  
  def* canvas click_on_wire {x y b f id} {
  	set c .x$self.c
! 	if {$f&8} {
! 	    #puts "RIGHTCLICK WIRE"
! 	}
! 	puts "click on wire"
  	#$c create line $xys -tags $self -width $thick \
  	#-arrow $arrow -arrowshape $arrowshape -fill $look(wirefg)
--- 1564,1573 ----
  	    }
  	    set @action move
! 	}
  }
  
  def* canvas click_on_wire {x y b f id} {
  	set c .x$self.c
! 	if {$f&8} {post "rightclick wire"}
  	#$c create line $xys -tags $self -width $thick \
  	#-arrow $arrow -arrowshape $arrowshape -fill $look(wirefg)
***************
*** 1850,1854 ****
  	if {$arrowsize < 5} {set arrow none} {set arrow last}
  	set arrowshape [list $arrowsize [expr $arrowsize*4/5] [expr $arrowsize/3]]
! 	item $self $canvas "" line $xys -width $thick -smooth yes \
  		-arrow $arrow -arrowshape $arrowshape -fill $look(wirefg)
  }
--- 1866,1870 ----
  	if {$arrowsize < 5} {set arrow none} {set arrow last}
  	set arrowshape [list $arrowsize [expr $arrowsize*4/5] [expr $arrowsize/3]]
! 	$self item "" line $xys -width $thick -smooth yes \
  		-arrow $arrow -arrowshape $arrowshape -fill $look(wirefg)
  }
***************
*** 2040,2057 ****
  ############ rendering
  
- proc item {self canvas suffix type coords args} {
- 	set c .x$canvas.c
- 	set ss $self$suffix
- 	if {![llength [$c gettags $ss]]} {
- 		eval  [concat [list $c create $type $coords  -tags "$ss $self"] $args]
- 		#eval [concat [list $c create $type $coords  -tags $ss] $args]
- 	} {
- 		eval [concat [list $c itemconfigure $ss] $args]
- 		eval [concat [list $c coords        $ss] $coords]
- 	}
- }
- 
- proc item_delete {self canvas} {.x$canvas.c delete $self}
- 
  # fix me
  class_new shadow {qwerty}
--- 2056,2059 ----
***************
*** 2060,2065 ****
  	set light [darker ${look(objectbg)}]
  	set dark [darker $light]
! 	item $self $canvas SHAD rectangle $coords \
! 		-fill $dark -outline $light -width 2
  	$canvas move ${self}SHAD 4 4
  }
--- 2062,2066 ----
  	set light [darker ${look(objectbg)}]
  	set dark [darker $light]
! 	$self item SHAD rectangle $coords -fill $dark -outline $light -width 2
  	$canvas move ${self}SHAD 4 4
  }
***************
*** 2073,2077 ****
  	set points [list $x1 $y1 [expr $x2+4] $y1 $x2 [expr $y1+4] $x2 [expr $y2-4] \
  		[expr $x2+4] $y2 $x1 $y2 $x2 $y2 $x1 $y2]
! 	item $self $canvas BASE polygon $points -fill $look(objectbg) -outline $look(objectframe3)
  	io_draw $self $canvas
  	if {[$self selected?]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)}
--- 2074,2078 ----
  	set points [list $x1 $y1 [expr $x2+4] $y1 $x2 [expr $y1+4] $x2 [expr $y2-4] \
  		[expr $x2+4] $y2 $x1 $y2 $x2 $y2 $x1 $y2]
! 	$self item BASE polygon $points -fill $look(objectbg) -outline $look(objectframe3)
  	io_draw $self $canvas
  	if {[$self selected?]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)}
***************
*** 2096,2100 ****
  		return
  	}
! 	item $self $canvas BASE polygon $points -tag -fill $look(objectbg) -outline $look(objectframe3)
  	io_draw $self $canvas
  	if {[$self selected?]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)}
--- 2097,2101 ----
  		return
  	}
! 	$self item BASE polygon $points -tag -fill $look(objectbg) -outline $look(objectframe3)
  	io_draw $self $canvas
  	if {[$self selected?]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)}
***************
*** 2117,2123 ****
  	set xyc [list [expr $x2-1] [expr $y1+1] [expr $x2-1] [expr $y2-1] [expr $x1+1] [expr $y2-1]]
  	set color [bluify [parse_color $@bcol]]
! 	item $self $canvas BASE  rectangle $xya -fill $color
! 	item $self $canvas BASE2 line      $xyb -fill #ffffff
! 	item $self $canvas BASE3 line      $xyc -fill [darker $color]
  	io_draw $self $canvas
  	if {[$self selected?]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)}
--- 2118,2124 ----
  	set xyc [list [expr $x2-1] [expr $y1+1] [expr $x2-1] [expr $y2-1] [expr $x1+1] [expr $y2-1]]
  	set color [bluify [parse_color $@bcol]]
! 	$self item BASE  rectangle $xya -fill $color
! 	$self item BASE2 line      $xyb -fill #ffffff
! 	$self item BASE3 line      $xyc -fill [darker $color]
  	io_draw $self $canvas
  	if {[$self selected?]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)}
***************
*** 2146,2152 ****
  	set points2 [list $x1 $y1 [expr $x1+$ys/2] [expr $y1+$ys/2] $x1 $y2]
  	if {$isnew} {set @clicking 0}
! 	item $self $canvas BASE   polygon $points  -fill [parse_color $@bcol] -outline $look(objectframe3)
! 	item $self $canvas BASE4  polygon $points2 -fill $color4 -outline $look(objectframe3)
! 	item $self $canvas NUMBER text $xt $yt -anchor w  -text [numbox_ftoa $self] -font [list $font $@fs bold] -fill [parse_color $@fcol]
  	set focused [expr ![string compare $self [canvas_focuser $canvas]]]
  	if {$focused} {set color4 #00ff00} {set color4 $look(objectbg)}
--- 2147,2153 ----
  	set points2 [list $x1 $y1 [expr $x1+$ys/2] [expr $y1+$ys/2] $x1 $y2]
  	if {$isnew} {set @clicking 0}
! 	$self item BASE   polygon $points  -fill [parse_color $@bcol] -outline $look(objectframe3)
! 	$self item BASE4  polygon $points2 -fill $color4 -outline $look(objectframe3)
! 	$self item NUMBER text $xt $yt -anchor w  -text [numbox_ftoa $self] -font [list $font $@fs bold] -fill [parse_color $@fcol]
  	set focused [expr ![string compare $self [canvas_focuser $canvas]]]
  	if {$focused} {set color4 #00ff00} {set color4 $look(objectbg)}
***************
*** 2263,2267 ****
  	for {set i 0} {$i<$n} {incr i} {
  		#fixme: item doesn't support multiple tags yet
! 		item $self $canvas "BUT$i BUT" rectangle \
  			[expr $x1+3] [expr $y1+3] \
  			[expr $x1+$size-3] [expr $y1+$size-3] \
--- 2264,2268 ----
  	for {set i 0} {$i<$n} {incr i} {
  		#fixme: item doesn't support multiple tags yet
! 		$self item "BUT$i BUT" rectangle \
  			[expr $x1+3] [expr $y1+3] \
  			[expr $x1+$size-3] [expr $y1+$size-3] \
***************
*** 2318,2322 ****
  	super $canvas
  	set color [bluify #ffffff]
! 	item $self $canvas KNOB rectangle $x1 $y1 $x1 $y1 \
  		-outline #000000 -fill [darker $color]
  	set pos [$canvas coords ${self}BASE]
--- 2319,2323 ----
  	super $canvas
  	set color [bluify #ffffff]
! 	$self item KNOB rectangle $x1 $y1 $x1 $y1 \
  		-outline #000000 -fill [darker $color]
  	set pos [$canvas coords ${self}BASE]
***************
*** 2399,2403 ****
  		$@fs bold]
  	set lcolor [parse_color $@lcol]
! 	item $self $canvas LABEL text $lx $ly -text $label -anchor w \
  		-font $lfont -fill $lcolor
  }
--- 2400,2404 ----
  		$@fs bold]
  	set lcolor [parse_color $@lcol]
! 	$self item LABEL text $lx $ly -text $label -anchor w \
  		-font $lfont -fill $lcolor
  }
***************
*** 2420,2424 ****
  	set xs $@w; set x2 [expr $x1+$xs]
  	set ys $@w; set y2 [expr $y1+$ys]
! 	item $self $canvas BUT oval \
  		[list [expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2]] \
  		-fill [bluify $colour] -tags ${self}BUT
--- 2421,2425 ----
  	set xs $@w; set x2 [expr $x1+$xs]
  	set ys $@w; set y2 [expr $y1+$ys]
! 	$self item BUT oval \
  		[list [expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2]] \
  		-fill [bluify $colour] -tags ${self}BUT
***************
*** 2458,2463 ****
  		set fill [bluify [parse_color $@bcol]]
  	}
! 	item $self $canvas X1 line $x3 $y3 [expr $x4+1] [expr $y4+1] -width $w -fill $fill
! 	item $self $canvas X2 line $x3 $y4 [expr $x4+1] [expr $y3-1] -width $w -fill $fill
  }
  
--- 2459,2464 ----
  		set fill [bluify [parse_color $@bcol]]
  	}
! 	$self item X1 line $x3 $y3 [expr $x4+1] [expr $y4+1] -width $w -fill $fill
! 	$self item X2 line $x3 $y4 [expr $x4+1] [expr $y3-1] -width $w -fill $fill
  }
  
***************
*** 2502,2509 ****
  	for {set i 1} {$i<=40} {incr i} {
  		set y [expr $y1 + ($led_size+1)*(41-$i) - ($led_size+1)/2]
! 		item $self $canvas RMS rectangle $x3 $y $x4 [expr $y+$led_size] \
  			-fill [parse_color [lindex $vu_col $i]] -width 0
  	}
! 	item $self $canvas MASK rectangle $x3 $y1 $x4 $y1 -width 0 -fill [bluify $colour]
  	if {!$@scale} {return}
  	$canvas delete ${self}SCALE
--- 2503,2510 ----
  	for {set i 1} {$i<=40} {incr i} {
  		set y [expr $y1 + ($led_size+1)*(41-$i) - ($led_size+1)/2]
! 		$self item RMS rectangle $x3 $y $x4 [expr $y+$led_size] \
  			-fill [parse_color [lindex $vu_col $i]] -width 0
  	}
! 	$self item MASK rectangle $x3 $y1 $x4 $y1 -width 0 -fill [bluify $colour]
  	if {!$@scale} {return}
  	$canvas delete ${self}SCALE
***************
*** 2519,2523 ****
  		set k4 [expr $y1-$k3]
  		set yyy [expr $k4 + $k1*($k2-4*$i)]
! 		item $self $canvas SCALE text [expr $x2+4] [expr $yyy+$k3-3] -text $level -anchor w \
  		     -font $lfont -fill $lcolor
  		incr i
--- 2520,2524 ----
  		set k4 [expr $y1-$k3]
  		set yyy [expr $k4 + $k1*($k2-4*$i)]
! 		$self item SCALE text [expr $x2+4] [expr $yyy+$k3-3] -text $level -anchor w \
  		     -font $lfont -fill $lcolor
  		incr i
***************
*** 2581,2585 ****
  	set xs $@w
  	set ys $@h
! 	item $self $canvas BASE rectangle $x1 $y1 [expr $x1+$xs] [expr $y1+$ys] \
  		-fill [parse_color $@bcol]
  	super $canvas
--- 2582,2586 ----
  	set xs $@w
  	set ys $@h
! 	$self item BASE rectangle $x1 $y1 [expr $x1+$xs] [expr $y1+$ys] \
  		-fill [parse_color $@bcol]
  	super $canvas





More information about the Pd-cvs mailing list