[PD-cvs] pd/src desire.tk,1.1.2.600.2.114,1.1.2.600.2.115

Mathieu Bouchard matju at users.sourceforge.net
Tue Dec 19 18:53:17 CET 2006


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

Modified Files:
      Tag: desiredata
	desire.tk 
Log Message:
simplified Slider code


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.600.2.114
retrieving revision 1.1.2.600.2.115
diff -C2 -d -r1.1.2.600.2.114 -r1.1.2.600.2.115
*** desire.tk	19 Dec 2006 17:15:20 -0000	1.1.2.600.2.114
--- desire.tk	19 Dec 2006 17:53:13 -0000	1.1.2.600.2.115
***************
*** 4937,4942 ****
  	set y2 [expr $y1+$ys]
  	set c [[$self get_canvas] widget]
- 	set ins  [expr [string compare $@rcv empty]==0]
- 	set outs [expr [string compare $@snd empty]==0]
  	set points [list $x1 $y1 [expr $x2-4] $y1 $x2 [expr $y1+4] $x2 $y2 $x1 $y2]
  	set xt [expr $x1+$ys/2+2]
--- 4937,4940 ----
***************
*** 4992,4997 ****
  def Radio draw {} {
  	mset {x1 y1 x2 y2} [$self bbox]
- 	set ins  [expr [string compare $@rcv empty]==0]
- 	set outs [expr [string compare $@snd empty]==0]
  	super
  	for {set i 0} {$i<$@n} {incr i} {
--- 4990,4993 ----
***************
*** 5011,5015 ****
  
  def Radio click {x y f target} {
- 	$@canvas focus= $self
  	mset {x1 y1} [$self xy]
  	set i [expr {($@orient ?$y-$y1:$x-$x1)/$@w}]
--- 5007,5010 ----
***************
*** 5017,5021 ****
  }
  
! def Radio unclick {x y f target} {$@canvas focus= ""}
  
  class_new Slider {BlueBox}
--- 5012,5016 ----
  }
  
! #def Radio unclick {x y f target} {$@canvas focus= ""}
  
  class_new Slider {BlueBox}
***************
*** 5044,5071 ****
  	set span [expr $@max-$@min]
  	set color [$self look bg]
  	if {$@orient} {
! 		set size $@w
! 		set y1 [expr $y1+$@h-$@value*($l-1)/$span-2]
! 		set y2 [expr $y1-2]
! 		set coords [list [expr $x1+2] $y1 [expr $x1+$size-2] $y2]
! 	} {
! 		set size $@h
! 		set x1 [expr $x1+$@value*($l-1)/$span]
! 		set x2 [expr $x1+2]
! 		set y2 [expr $y1+$size]
! 		set coords [list $x1 [expr $y1+2] $x2 [expr $y1+$size-2]]
  	}
! 	$self item KNOB rectangle $coords \
! 	    -outline red -fill [darker $color]
  }
  
  def Slider draw {} {
  	mset {x1 y1 x2 y2} [$self bbox]
! 	set xs $@w
! 	set ys $@h
! 	if {$@orient} {set y1 [expr $y1-2]} {set x1 [expr $x1-2]}
! 	if {$@orient} {set ys [expr $ys+5]} {set xs [expr $xs+5]}
! 	set ins  [expr [string compare $@rcv empty]==0]
! 	set outs [expr [string compare $@snd empty]==0]
  	super
  	$self draw_knob
--- 5039,5057 ----
  	set span [expr $@max-$@min]
  	set color [$self look bg]
+ 	set scaled [expr {$@value*($l-1)/$span}]
  	if {$@orient} {
! 		set y [expr $y1+$@h-$scaled-2]
! 		set coords [list [expr $x1+2] $y [expr $x1+$@w-2] [expr $y-2]]
! 	} else {
! 		set x [expr $x1+$scaled]
! 		set coords [list $x [expr $y1+2] [expr $x+2] [expr $y1+$@h-2]]
  	}
! 	$self item KNOB rectangle $coords -outline red -fill [darker $color]
  }
  
  def Slider draw {} {
  	mset {x1 y1 x2 y2} [$self bbox]
! 	#if {$@orient} {set y1 [expr $y1-2]} {set x1 [expr $x1-2]}
! 	#if {$@orient} {set ys [expr $@h+5]} {set xs [expr $@w+5]}
  	super
  	$self draw_knob
***************
*** 5088,5091 ****
--- 5074,5078 ----
  		set coords [list $x1 $y3 [expr $x1+$xs] $y3]
  	}
+ 	# there were supposed to be 7 notches... i don't remember what happened here.
  	$@canvas item NOTCH $coords -dash [list 1 $eighth 1 $eighth] -width $thick -fill [darker [$self look bg]]
  }





More information about the Pd-cvs mailing list