[PD-cvs] pd/src desire.tk,1.1.2.340,1.1.2.341

Mathieu Bouchard matju at users.sourceforge.net
Tue Aug 15 17:50:01 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
Canvas: renamed motion to motion_wrap, motion2 to motion, etc
added type check in selection=,etc
fixed SelRect.


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.340
retrieving revision 1.1.2.341
diff -C2 -d -r1.1.2.340 -r1.1.2.341
*** desire.tk	15 Aug 2006 14:59:57 -0000	1.1.2.340
--- desire.tk	15 Aug 2006 15:49:59 -0000	1.1.2.341
***************
*** 244,247 ****
--- 244,249 ----
  # keep in mind that undo information is kept hierarchically.
  def History add {message} {
+ 	puts "History add:        [info level [info level]]"
+ 	puts "History add caller: [info level [expr [info level]-1]]"
  	lappend @undo_q [list do $message [lrange [info level -3] 1 end]]
  	set @redo_q {}
***************
*** 1328,1346 ****
  
      # mouse buttons
!     $self bind <Button>                   click %x %y %b 0
!     $self bind <Shift-Button>             click %x %y %b 1
!     $self bind <Control-Button>           click %x %y %b 2
!     $self bind <Control-Shift-Button>     click %x %y %b 3
!     $self bind <Alt-Button>               click %x %y %b 4
!     $self bind <Alt-Shift-Button>         click %x %y %b 5
!     $self bind <Alt-Control-Button>       click %x %y %b 6
!     $self bind <Alt-Control-Shift-Button> click %x %y %b 7
      switch $OS {
        osx {
!         $self bind <Button-2>       click %x %y %b 8
!         $self bind <Control-Button> click %x %y %b 8
        }
        default {
!         $self bind <Button-3>       click %x %y %b 8
        }
      }
--- 1330,1348 ----
  
      # mouse buttons
!     $self bind <Button>                   click_wrap %x %y %b 0
!     $self bind <Shift-Button>             click_wrap %x %y %b 1
!     $self bind <Control-Button>           click_wrap %x %y %b 2
!     $self bind <Control-Shift-Button>     click_wrap %x %y %b 3
!     $self bind <Alt-Button>               click_wrap %x %y %b 4
!     $self bind <Alt-Shift-Button>         click_wrap %x %y %b 5
!     $self bind <Alt-Control-Button>       click_wrap %x %y %b 6
!     $self bind <Alt-Control-Shift-Button> click_wrap %x %y %b 7
      switch $OS {
        osx {
!         $self bind <Button-2>       click_wrap %x %y %b 8
!         $self bind <Control-Button> click_wrap %x %y %b 8
        }
        default {
!         $self bind <Button-3>       click_wrap %x %y %b 8
        }
      }
***************
*** 1354,1359 ****
  	$self bind <Shift-MouseWheel> scroll x \[expr -abs(%D)/%D\]
      }}
!     $self bind <ButtonRelease>     	 unclick %x %y %b 0
!     $self bind <Shift-ButtonRelease>     unclick %x %y %b 1
  
      # keyboard
--- 1356,1361 ----
  	$self bind <Shift-MouseWheel> scroll x \[expr -abs(%D)/%D\]
      }}
!     $self bind <ButtonRelease>     	 unclick_wrap %x %y %b 0
!     $self bind <Shift-ButtonRelease>     unclick_wrap %x %y %b 1
  
      # keyboard
***************
*** 1374,1383 ****
        }
      }
!     $self bind <Key>        key    %x %y %K %A 0
!     $self bind <Shift-Key>  key    %x %y %K %A 1
!     $self bind <KeyRelease> keyup  %x %y %K %A 0
!     $self bind <Shift-KeyRelease>  keyup  %x %y %K %A 1
!     $self bind <Motion>     motion %x %y 0
!     $self bind <Alt-Motion> motion %x %y 4
      $self bind <Map>        map
      $self bind <Unmap>      unmap
--- 1376,1385 ----
        }
      }
!     $self bind <Key>               key_wrap   %x %y %K %A 0
!     $self bind <Shift-Key>         key_wrap   %x %y %K %A 1
!     $self bind <KeyRelease>        keyup_wrap %x %y %K %A 0
!     $self bind <Shift-KeyRelease>  keyup_wrap %x %y %K %A 1
!     $self bind <Motion>     motion_wrap %x %y 0
!     $self bind <Alt-Motion> motion_wrap %x %y 4
      $self bind <Map>        map
      $self bind <Unmap>      unmap
***************
*** 1661,1664 ****
--- 1663,1667 ----
  def Canvas selection {} {return $@selection}
  def Canvas selection= {objs} {
+ 	foreach o $objs {switch $_($o:_class) {Wire {error "selection error"}}}
  	foreach o $@selection {$o selected?= 0}
  	set @selection $objs
***************
*** 1666,1669 ****
--- 1669,1673 ----
  }
  def Canvas selection+= {objs} {
+ 	foreach o $objs {switch $_($o:_class) {Wire {error "selection error"}}}
  	set @selection [concat $@selection [lwithout $objs $@selection]]
  	foreach o $objs {$o selected?= 1}
***************
*** 1676,1679 ****
--- 1680,1684 ----
  def Canvas selection_wire {} {return $@selection_wire}
  def Canvas selection_wire= {wires} {
+ 	foreach o $wires {switch $_($o:_class) {Wire {} default {error "selection error: $_($o:_class)"}}}
  	foreach o $@selection_wire {$o selected?= 0}
  	set @selection_wire $wires
***************
*** 1681,1684 ****
--- 1686,1690 ----
  }
  def Canvas selection_wire+= {wires} {
+ 	foreach o $wires {switch $_($o:_class) {Wire {} default {error "selection error: $_($o:_class)"}}}
  	set @selection_wire [concat $@selection_wire [lwithout $wires $@selection_wire]]
  	foreach o $wires {$o selected?= 1}
***************
*** 1857,1870 ****
  }
  
! # just a transitional filter
! def* Canvas motion {x y f} {
  	set c .$self.c
  	#if {$@crosshair} {$self show_crosshair [expr [$c canvasx $x]/$@scale] [expr [$c canvasy $y]/$@scale]}
  	#if {$@crosshair} {$self show_crosshair $x $y}
! 	$self motion2 [expr [$c canvasx $x]/$@scale] [expr [$c canvasy $y]/$@scale] $f	
  }
  
  #!@#$ this method is too long
! def* Canvas motion2 {x y f} {
      global font canvas tooltip
      set canvas(current) $self
--- 1863,1891 ----
  }
  
! def* Canvas motion_wrap {x y f} {
  	set c .$self.c
  	#if {$@crosshair} {$self show_crosshair [expr [$c canvasx $x]/$@scale] [expr [$c canvasy $y]/$@scale]}
  	#if {$@crosshair} {$self show_crosshair $x $y}
! 	$self motion [expr [$c canvasx $x]/$@scale] [expr [$c canvasy $y]/$@scale] $f	
! }
! def* Canvas click_wrap {x y b f} {
! 	set c .$self.c
! 	$self click [expr [$c canvasx $x]/$@scale] [expr [$c canvasy $y]/$@scale] [expr $b*256+$f]
! }
! def* Canvas unclick_wrap {x y b f} {
! 	set c .$self.c
! 	$self unclick [expr [$c canvasx $x]/$@scale] [expr [$c canvasy $y]/$@scale] [expr $b*256+$f]
! }
! def* Canvas key_wrap {x y key iso shift} {
! 	set c .$self.c
! 	$self key [expr [$c canvasx $x]/$@scale] [expr [$c canvasy $y]/$@scale] $key $iso $shift
! }
! def* Canvas keyup_wrap {x y key iso shift} {
! 	set c .$self.c
! 	$self keyup [expr [$c canvasx $x]/$@scale] [expr [$c canvasy $y]/$@scale] $key $iso $shift
  }
  
  #!@#$ this method is too long
! def* Canvas motion {x y f} {
      global font canvas tooltip
      set canvas(current) $self
***************
*** 1889,1897 ****
          return
        }
-       rect {
-         set coords [$c coords selrect]
- 	mset {x1 y1} $coords; set x2 $x; set y2 $y
- 	$c coords selrect $x1 $y1 $x2 $y1 $x2 $y2 $x1 $y2 $x1 $y1
-       }
        edit {
          if {[distance [list $x $y] $@click_at] > 5} {
--- 1910,1913 ----
***************
*** 2210,2220 ****
  		set wires {}
  		foreach tag $sel {
! 			if {[regexp {^x([a-f0-9]{6,8})} [$c gettags $tag] id]} {lappend objects $id}
! 			if {[regexp {^([0-9a-f]{6,8})}  [$c gettags $tag] id]} {lappend   wires $id}
  		}
  		set objects [lsort -unique $objects]
  		set wires   [lsort -unique $wires]
  		$@canvas selection+= $objects
! 		$@canvas selection+= $wires
  	}
  	set _($@canvas:select_by) "selrect"
--- 2226,2241 ----
  		set wires {}
  		foreach tag $sel {
! 			if {[regexp {^[xz]?[0-9a-f]{6,8}} [$c gettags $tag] id]} {
! 				switch $_($id:_class) {
! 					SelRect {}
! 					Wire    {lappend wires   $id}
! 					default {lappend objects $id}
! 				}
! 			}
  		}
  		set objects [lsort -unique $objects]
  		set wires   [lsort -unique $wires]
  		$@canvas selection+= $objects
! 		$@canvas selection_wire+= $wires
  	}
  	set _($@canvas:select_by) "selrect"
***************
*** 2289,2300 ****
  }
  
- # just a transitional filter
- def* Canvas click {x y b f} {
- 	set c .$self.c
- 	$self click2 [expr [$c canvasx $x]/$@scale] [expr [$c canvasy $y]/$@scale] [expr $b*256+$f]
- }
- 
  # should be renamed to "click" when the other "click" becomes unneeded.
! def* Canvas click2 {x y f} {
      if {[winfo exists .completion]} {
        raise .completion
--- 2310,2315 ----
  }
  
  # should be renamed to "click" when the other "click" becomes unneeded.
! def* Canvas click {x y f} {
      if {[winfo exists .completion]} {
        raise .completion
***************
*** 2338,2348 ****
  }
  
! # just a transitional filter
! def* Canvas unclick {x y b f} {
! 	set c .$self.c
! 	$self unclick2 [expr [$c canvasx $x]/$@scale] [expr [$c canvasy $y]/$@scale] [expr $b*256+$f]
! }
! 
! def* Canvas unclick2 {x y f} {
      if {$@editmode} {
  	$self unclickedit $x $y $f
--- 2353,2357 ----
  }
  
! def* Canvas unclick {x y f} {
      if {$@editmode} {
  	$self unclickedit $x $y $f
***************
*** 2601,2604 ****
--- 2610,2614 ----
  def* Canvas selection_move {dx dy} {
      foreach item $@selection {
+ 	puts "moving: [$item _inspect]"
  	mset {x1 y1 x2 y2} [$item bbox]
  	pd .$self object_moveto !$item [expr $x1+$dx] [expr $y1+$dy]
***************
*** 2609,2614 ****
  def Canvas key {x y key iso shift} {
      set c .$self.c
-     set x [expr [$c canvasx $x]/$@scale]
-     set y [expr [$c canvasy $y]/$@scale]
      $self hide_tooltip
      if {[$self focus] != ""} {
--- 2619,2622 ----
***************
*** 4298,4306 ****
  ############ crosshair
  
! def* Canvas show_crosshair {x y} {
  	set width [expr [winfo width .$self.c] * (1/$@scale)]
  	set height [expr [winfo height .$self.c] * (1/$@scale)]
  	set off [expr 7 * (1/$@scale)]
! 	puts "	off ::: $off"
  	set v1 [list $x 0 $x [expr $y - $off]]
  	set h1 [list 0 $y [expr $x - $off] $y]
--- 4306,4314 ----
  ############ crosshair
  
! def Canvas show_crosshair {x y} {
  	set width [expr [winfo width .$self.c] * (1/$@scale)]
  	set height [expr [winfo height .$self.c] * (1/$@scale)]
  	set off [expr 7 * (1/$@scale)]
! 	#puts "off ::: $off"
  	set v1 [list $x 0 $x [expr $y - $off]]
  	set h1 [list 0 $y [expr $x - $off] $y]
***************
*** 4309,4313 ****
  	set eye [list [expr $x - $off] [expr $y - $off] [expr $x + $off] [expr $y + $off]]
  	#puts "vertical ::: $vertical"
! 	puts "eye ::: $eye"
  	$self item VHAIR1 line $v1 -fill [look objectfg] -width 0.5 -dash {4 4 4 4}
  	$self item HHAIR1 line $h1 -fill [look objectfg] -width 0.5 -dash {4 4 4 4}
--- 4317,4321 ----
  	set eye [list [expr $x - $off] [expr $y - $off] [expr $x + $off] [expr $y + $off]]
  	#puts "vertical ::: $vertical"
! 	#puts "eye ::: $eye"
  	$self item VHAIR1 line $v1 -fill [look objectfg] -width 0.5 -dash {4 4 4 4}
  	$self item HHAIR1 line $h1 -fill [look objectfg] -width 0.5 -dash {4 4 4 4}





More information about the Pd-cvs mailing list