[PD-cvs] pd/src desire.tk,1.1.2.600.2.334,1.1.2.600.2.335

chunlee chunlee at users.sourceforge.net
Thu Aug 9 21:14:10 CEST 2007


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

Modified Files:
      Tag: desiredata
	desire.tk 
Log Message:
scrollbar stuff


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.600.2.334
retrieving revision 1.1.2.600.2.335
diff -C2 -d -r1.1.2.600.2.334 -r1.1.2.600.2.335
*** desire.tk	9 Aug 2007 08:37:26 -0000	1.1.2.600.2.334
--- desire.tk	9 Aug 2007 19:14:05 -0000	1.1.2.600.2.335
***************
*** 1847,1862 ****
  	set size [$c bbox foo]
  	mset {xs ys} $@canvas_size
- 	if {$size != ""} {
- 		mset {x1 y1 x2 y2} $size
- 		set xregion [max $x2 $xs]
- 		set yregion [max $x2 $ys]
- 	} else {set xregion $xs; set yregion $ys}
  	pack [scrollbar $win.yscroll -command "$c yview"                   ] -side  right -fill y -before $c
  	pack [scrollbar $win.xscroll -command "$c xview" -orient horizontal] -side bottom -fill x -before $c
- 	#$c configure -yscrollcommand "$win.yscroll set" -xscrollcommand "$win.xscroll set" \
- 	#    -scrollregion [list 0 0 $xregion $yregion]
  	set xw $win.xscroll; set yw $win.yscroll
! 	$c configure -yscrollcommand "$self scroll_set $yw" -xscrollcommand "$self scroll_set $xw" \
! 	    -scrollregion [list 0 0 $xregion $yregion]
  }
  
--- 1847,1855 ----
  	set size [$c bbox foo]
  	mset {xs ys} $@canvas_size
  	pack [scrollbar $win.yscroll -command "$c yview"                   ] -side  right -fill y -before $c
  	pack [scrollbar $win.xscroll -command "$c xview" -orient horizontal] -side bottom -fill x -before $c
  	set xw $win.xscroll; set yw $win.yscroll
! 	$c configure -yscrollcommand "$self scroll_set $yw" -xscrollcommand "$self scroll_set $xw"
! 	$self adjust_scrollbars
  }
  
***************
*** 1878,1886 ****
  		mset {xmin ymin xmax ymax} {0 0 100 100}
  		mset {x1 y1 x2 y2} $size
! 		if {$x1 < 0} {set xmin $x1}; if {$x2 > 100} {set xmax $x2}
! 		if {$y1 < 0} {set ymin $y1}; if {$y2 > 100} {set ymax $y2}
  		set bbox [list $xmin $ymin $xmax $ymax]
  		if {$@bbox != $bbox} {
  			$c configure -scrollregion $bbox
  			set @bbox $bbox
  		}
--- 1871,1883 ----
  		mset {xmin ymin xmax ymax} {0 0 100 100}
  		mset {x1 y1 x2 y2} $size
! 		#if {$x1 < 0} {set xmin $x1}
! 		if {$x2 > 100} {set xmax $x2}
! 		#if {$y1 < 0} {set ymin $y1}
! 		if {$y2 > 100} {set ymax $y2}
  		set bbox [list $xmin $ymin $xmax $ymax]
+ 		puts "bbox $bbox size::: $size"
  		if {$@bbox != $bbox} {
  			$c configure -scrollregion $bbox
+ 			#$c configure -scrollregion $size
  			set @bbox $bbox
  		}
***************
*** 1888,1891 ****
--- 1885,1897 ----
  }
  
+ def Canvas get_foo {} {
+ 	set c [$self widget]
+ 	set foo {}
+ 	foreach item [$c find withtag foo] {
+ 		lappend foo [$c gettags $item]
+ 	}
+ 	puts "foo::: $foo"
+ }
+ 
  def Canvas auto_scrollbars {} {
  	set win .$self
***************
*** 2033,2037 ****
  
  # this allows the grid to update when scroll
! def Canvas scroll_set {w v1 v2} {if {[$self look gridstate]} {$@grid draw}; $w set $v1 $v2}
  
  def Canvas reload {} {
--- 2039,2043 ----
  
  # this allows the grid to update when scroll
! def Canvas scroll_set {w v1 v2} {if {[$self look gridstate] && $@editmode} {$@grid draw}; $w set $v1 $v2}
  
  def Canvas reload {} {
***************
*** 4626,4629 ****
--- 4632,4636 ----
  	#$self propagate_zoom $@zoom
  	$self redraw
+ 	if {[$self look gridstate]} {if {$@editmode} {$@grid erase}}
  	foreach child [$@objects values] {if {[$child class] == "Canvas" && [$child gop]} {$child all_changed}}
  }
***************
*** 6529,6533 ****
  class_new Crosshair {View}
  
! #def Crosshair classtags {} {return {}}
  
  def Crosshair init {canvas} {
--- 6536,6540 ----
  class_new Crosshair {View}
  
! def Crosshair classtags {} {return {}}
  
  def Crosshair init {canvas} {
***************
*** 6555,6560 ****
  	set width [winfo width $c]; set height [winfo height $c]
  	set x1 [$c canvasx 0]; set y1 [$c canvasy 0]
! 	set h1 [list $x1 $y [expr $x1+$width] $y]
! 	set v1 [list $x $y1 $x [expr $y1+$height]]
  	$self item VHAIR1 line $v1 -fill [$@canvas look crosshair] -width 0.5 -dash {4 4 4 4}
  	$self item HHAIR1 line $h1 -fill [$@canvas look crosshair] -width 0.5 -dash {4 4 4 4}
--- 6562,6567 ----
  	set width [winfo width $c]; set height [winfo height $c]
  	set x1 [$c canvasx 0]; set y1 [$c canvasy 0]
! 	set h1 [list -1000 $y [expr ($x1+$width)*(1/$z)] $y]
! 	set v1 [list $x -1000 $x [expr ($y1+$height)*(1/$z)]]
  	$self item VHAIR1 line $v1 -fill [$@canvas look crosshair] -width 0.5 -dash {4 4 4 4}
  	$self item HHAIR1 line $h1 -fill [$@canvas look crosshair] -width 0.5 -dash {4 4 4 4}
***************
*** 6612,6627 ****
  	set x1 [$c canvasx 0]; set y1 [$c canvasy 0]
  	set x2 [expr $x1+$@width]; set y2 [expr $y1+$@height]
! 	for {set i [expr int($x1)]} {$i < $x2} {incr i} {
  		if {![expr $i % $@size]} {
! 			set line [list $i $y1 $i $y2]
  			$self item HL$i line $line -fill $@col -width 0.1 -dash {2 2 2 2}
  		}
  	}
! 	for {set i [expr int($y1)]} {$i < $y2} {incr i} {
! 		if {![expr $i % $@size]} {
! 			set line [list $x1 $i $x2 $i]
  			$self item VL$i line $line -fill $@col -width 0.1 -dash {2 2 2 2}
  		}
  	}
  	$c lower $self $lowest
  }
--- 6619,6637 ----
  	set x1 [$c canvasx 0]; set y1 [$c canvasy 0]
  	set x2 [expr $x1+$@width]; set y2 [expr $y1+$@height]
! 	set zoom [$@canvas zoom]
! 	set z [expr 1/$zoom]
! 	for {set i [expr int($x1*$z)]} {$i < $x2*$z} {incr i} {
  		if {![expr $i % $@size]} {
! 			set line [list $i -1000 $i [expr $y2*$z]]
  			$self item HL$i line $line -fill $@col -width 0.1 -dash {2 2 2 2}
  		}
  	}
! 	for {set i [expr int($y1*$z)]} {$i < $y2*$z} {incr i} {
! 		if {![expr $i % int($@size)]} {
! 			set line [list -1000 $i [expr $x2*$z] $i]
  			$self item VL$i line $line -fill $@col -width 0.1 -dash {2 2 2 2}
  		}
  	}
+ 
  	$c lower $self $lowest
  }





More information about the Pd-cvs mailing list