[PD-cvs] pd/src desire.tk,1.1.2.304,1.1.2.305

Mathieu Bouchard matju at users.sourceforge.net
Wed Aug 9 09:06:44 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
fixed most gui objects


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.304
retrieving revision 1.1.2.305
diff -C2 -d -r1.1.2.304 -r1.1.2.305
*** desire.tk	8 Aug 2006 23:02:33 -0000	1.1.2.304
--- desire.tk	9 Aug 2006 07:06:42 -0000	1.1.2.305
***************
*** 1473,1477 ****
  	$self item TEXT text [l+ {2 2} [list $x1 $y1]] \
  		-font $font(str) -text $@text -fill [look objectfg] -anchor nw
- 
      }
  }
--- 1473,1476 ----
***************
*** 1563,1570 ****
  def TextBox update_size {} {
  	global font
! 	set @textwidth [expr $font(padx)+$font(width)*([string length $@text]+$@edit)]
! 	set @topwidth    [expr (2* $@ninlets-1) * [look iowidth]]
! 	set @bottomwidth [expr (2*$@noutlets-1) * [look iowidth]]
! 	set @xs [max [look minobjwidth] [max $@bottomwidth [max $@topwidth $@textwidth]]]
  	set @ys [expr $font(pady)+$font(height)]
  }
--- 1562,1569 ----
  def TextBox update_size {} {
  	global font
! 	set textwidth [expr $font(padx)+$font(width)*([string length $@text]+$@edit)]
! 	set topwidth    [expr (2* $@ninlets-1) * [look iowidth]]
! 	set bottomwidth [expr (2*$@noutlets-1) * [look iowidth]]
! 	set @xs [max [look minobjwidth] [max $bottomwidth [max $topwidth $textwidth]]]
  	set @ys [expr $font(pady)+$font(height)]
  }
***************
*** 1803,1815 ****
  }
  
! def View draw_wires {} {
!     foreach wire $@wires {$wire draw}
! }
  
  def* Canvas undomove {objs} {
  	foreach obj $objs {
  		pd .$self object_moveto !$obj $_($obj:orig_x) $_($obj:orig_y)
  	}
- 
  }
  
--- 1802,1812 ----
  }
  
! def View draw_wires {} {foreach wire $@wires {$wire draw}}
  
+ # kill this please
  def* Canvas undomove {objs} {
  	foreach obj $objs {
  		pd .$self object_moveto !$obj $_($obj:orig_x) $_($obj:orig_y)
  	}
  }
  
***************
*** 2729,2732 ****
--- 2726,2731 ----
  }
  
+ def Box update_size {} {}
+ 
  def* Box connect_out {} {}
  def* Box connect_in {} {}
***************
*** 2955,2959 ****
  set fields(msg) {foo bar x1 y1}
  set fields(coords) {foo bar xfrom yfrom xto yto w h gop x1 y1}
! set fields(floatatom) {foo bar x1 y1 w min max pos lab snd rcv}
  
  #             @pdclass {@_class}
--- 2954,2959 ----
  set fields(msg) {foo bar x1 y1}
  set fields(coords) {foo bar xfrom yfrom xto yto w h gop x1 y1}
! set fields(floatatom)  {foo bar x1 y1 w min max pos lab snd rcv}
! set fields(symbolatom) {foo bar x1 y1 w min max pos lab snd rcv}
  
  #             @pdclass {@_class}
***************
*** 2964,2972 ****
  set classinfo(nbx)     NumBox
  set classinfo(hsl)     Slider
! set classinfo(hradio)  Radio
  set classinfo(vu)      Vu
  set classinfo(dropper) Dropper
! set classinfo(vsl)     Slider
! set classinfo(vradio)  Slider
  set classinfo(hdl)     Radio
  set classinfo(vdl)     Radio
--- 2964,2972 ----
  set classinfo(nbx)     NumBox
  set classinfo(hsl)     Slider
! set classinfo(vsl)     Slider
  set classinfo(vu)      Vu
  set classinfo(dropper) Dropper
! set classinfo(hradio)  Radio
! set classinfo(vradio)  Radio
  set classinfo(hdl)     Radio
  set classinfo(vdl)     Radio
***************
*** 3020,3031 ****
  	$self noutlets= $noutlets
  	switch -- $class {
- 	  floatatom  {}
- 	  symbolatom {}
  	  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]]}
! 	  default    {$self text= [join [lrange $mess 4 end]]
! 		     set i 0; foreach f $fields($class) {set _($self:$f) [lindex $d $i]; incr i}}
  	}
  	if {$isnew} {update_object_2 $self $mess}
--- 3020,3030 ----
  	$self noutlets= $noutlets
  	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]]}
! 	  default    {
! 		     set i 0; foreach f $fields($class) {
! 			set _($self:$f) [lindex $mess $i]; incr i}}
  	}
  	if {$isnew} {update_object_2 $self $mess}
***************
*** 3178,3181 ****
--- 3177,3181 ----
  	global font
  	mset {x1 y1} [$self xy]
+ 	$self update_size
  	set x2 [expr $x1+$@xs]
  	set y2 [expr $y1+$@ys]
***************
*** 3195,3200 ****
  	set xs [expr 4+10*$@w]
  	set ys $font(height)
- 	set @xt [expr $x1+$ys/2-2]
- 	set @yt [expr $y1+$ys/2+3+$xs/34]
  	if {[$self selected?]} {set fcol red} else {set fcol [look objectfg]}
  	if {[string length $@val] <= $@w} { 
--- 3195,3198 ----
***************
*** 3203,3208 ****
  		set string [string range $@text 0 [expr $@w-1]]
  	}
! 	$self item TEXT text [list $@xt $@yt] -anchor w -text $string \
! 		-font $font(str) -fill $fcol
  }
  
--- 3201,3205 ----
  		set string [string range $@text 0 [expr $@w-1]]
  	}
! 	$self item TEXT text [l+ {2 2} [list $x1 $y1]] -anchor nw -text $string \
  }
  
***************
*** 3630,3640 ****
  	global font
  	#set @textwidth [expr $font(padx)+$font(width)*[string length $@val]]
! 	if {!$@w} [set @w 5]
! 	set @textwidth [expr $font(padx)+$font(width)*$@w]
! 	set @topwidth [expr ($@ninlets + ($@ninlets - 1)) * [look iowidth]]
! 	set @bottomwidth [expr ($@noutlets + ($@noutlets - 1)) * [look iowidth]]
! 	set @xs [max [look minobjwidth] [max $@bottomwidth [max $@topwidth $@textwidth]]]
! 	
! 	set @ys  [expr $font(pady)+$font(height)]
  }
  
--- 3627,3636 ----
  	global font
  	#set @textwidth [expr $font(padx)+$font(width)*[string length $@val]]
! 	if {!$@w} {set @w 5}
! 	set textwidth [expr $font(padx)+$font(width)*$@w]
! 	set topwidth    [expr (2* $@ninlets-1) * [look iowidth]]
! 	set bottomwidth [expr (2*$@noutlets-1) * [look iowidth]]
! 	set @xs [max [look minobjwidth] [max $bottomwidth [max $topwidth $textwidth]]]
! 	set @ys [expr $font(pady)+$font(height)]
  }
  
***************
*** 3668,3672 ****
  	set focused [$self == [$@canvas focus]]
  	if {!$focused} {return}
! 	if {$@clicking} {
  	mset {ox oy} $@mouse
  	set @val [expr $@val-$@rate*($y-$oy)]
--- 3664,3668 ----
  	set focused [$self == [$@canvas focus]]
  	if {!$focused} {return}
! 	if {!$@clicking} {return}
  	mset {ox oy} $@mouse
  	set @val [expr $@val-$@rate*($y-$oy)]
***************
*** 3676,3683 ****
  	pd .$self set $@val
  	pd .$self bang
- 	}
- 	
  	$self changed
- 
  }
  
--- 3672,3676 ----
***************
*** 3696,3703 ****
  def* NumBox update_size {} {
  	global font
! 	set @textwidth [expr $font(padx)+$font(width)*[string length $@buf]]
! 	set @topwidth [expr ($@ninlets + ($@ninlets - 1)) * [look iowidth]]
! 	set @bottomwidth [expr ($@noutlets + ($@noutlets - 1)) * [look iowidth]]
! 	set @xs [max [look minobjwidth] [max $@bottomwidth [max $@topwidth $@textwidth]]]
  	set @ys  [expr $font(pady)+$font(height)]
  }
--- 3689,3696 ----
  def* NumBox update_size {} {
  	global font
! 	set textwidth [expr $font(padx)+$font(width)*[string length $@buf]]
! 	set topwidth    [expr (2* $@ninlets-1) * [look iowidth]]
! 	set bottomwidth [expr (2*$@noutlets-1) * [look iowidth]]
! 	set @xs [max [look minobjwidth] [max $bottomwidth [max $topwidth $textwidth]]]
  	set @ys  [expr $font(pady)+$font(height)]
  }
***************
*** 3732,3736 ****
  	}
  	io_draw $self
- 	Labeled_draw $self
  	if {[$self selected?]} {set frcol [look objectframe4]} {set frcol [look objectframe3]}
  	$c itemconfigure ${self}BASE -outline $frcol
--- 3725,3728 ----
***************
*** 3793,3800 ****
  	
  	if {[lindex $@clickpos 0] == $x && [lindex $@clickpos 1] == $y} {
! 	$@canvas focus= $self
! 	set @clicking 0
! 	set @val ""
! 	set @key_input 1
  	} { 
  		$@canvas focus= ""
--- 3785,3792 ----
  	
  	if {[lindex $@clickpos 0] == $x && [lindex $@clickpos 1] == $y} {
! 		$@canvas focus= $self
! 		set @clicking 0
! 		set @val ""
! 		set @key_input 1
  	} { 
  		$@canvas focus= ""
***************
*** 3918,3921 ****
--- 3910,3914 ----
  
  def Slider bbox {} {
+ 	puts [$self _inspect]
  	mset {x1 y1} [$self xy]
  	list $x1 $y1 [expr $x1+$@w] [expr $y1+$@h]
***************
*** 4115,4119 ****
  }
  
! class_new Vu {View}
  
  set vu_col {
--- 4108,4112 ----
  }
  
! class_new Vu {Box}
  
  set vu_col {
***************
*** 4122,4125 ****
--- 4115,4123 ----
  }
  
+ def Vu bbox {} {
+ 	mset {x1 y1} [$self xy]
+ 	list $x1 $y1 [expr $x1+$@w] [expr $y1+$@w]
+ }
+ 
  def Vu led_size {} {
  	set n [expr $@h/40]
***************
*** 4139,4154 ****
  	set colour [parse_color $@bcol]
  	super
! 	set led_size [vu_led_size $self]
  	set x3 [expr $x1+$xs/4]
  	set x4 [expr $x1+$xs-$xs/4]
! 	$@canvas delete ${self}RMS
  	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
  	set lfont [list \
  		[lindex	{courier helvetica times} $@fstyle] \
--- 4137,4153 ----
  	set colour [parse_color $@bcol]
  	super
! 	set led_size [$self led_size]
  	set x3 [expr $x1+$xs/4]
  	set x4 [expr $x1+$xs-$xs/4]
! 	set c .$@canvas.c
! 	$c delete ${self}RMS
  	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 [list $x3 $y $x4 [expr $y+$led_size]] \
  			-fill [parse_color [lindex $vu_col $i]] -width 0
  	}
! 	$self item MASK rectangle [list $x3 $y1 $x4 $y1] -width 0 -fill [bluify $colour]
  	if {!$@scale} {return}
! 	$c delete ${self}SCALE
  	set lfont [list \
  		[lindex	{courier helvetica times} $@fstyle] \
***************
*** 4162,4166 ****
  		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
--- 4161,4165 ----
  		set k4 [expr $y1-$k3]
  		set yyy [expr $k4 + $k1*($k2-4*$i)]
! 		$self item SCALE text [list [expr $x2+4] [expr $yyy+$k3-3]] -text $level -anchor w \
  		     -font $lfont -fill $lcolor
  		incr i
***************
*** 4175,4179 ****
  	set xs $@w
  	set ys $@h
! 	set led_size [vu_led_size $self]
  	set y [expr $y1 + ($led_size+1)*(41-$i) - ($led_size+1)/2]
  	set x3 [expr $x1+$xs/4]
--- 4174,4178 ----
  	set xs $@w
  	set ys $@h
! 	set led_size [$self led_size]
  	set y [expr $y1 + ($led_size+1)*(41-$i) - ($led_size+1)/2]
  	set x3 [expr $x1+$xs/4]





More information about the Pd-cvs mailing list