[PD-cvs] pd/src desire.tk,1.1.2.57,1.1.2.58

Mathieu Bouchard matju at users.sourceforge.net
Wed Sep 14 19:38:06 CEST 2005


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
more more stuff


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.57
retrieving revision 1.1.2.58
diff -C2 -d -r1.1.2.57 -r1.1.2.58
*** desire.tk	14 Sep 2005 13:28:12 -0000	1.1.2.57
--- desire.tk	14 Sep 2005 17:38:03 -0000	1.1.2.58
***************
*** 864,877 ****
  #-----------------------------------------------------------------------------------#
  # check or uncheck the "edit" menu item
! def canvas editmode {value} {
      global look
!     .x$self.m.edit entryconfigure "Edit mode" -indicatoron $value
!     set mode [if {$value} {list edit} {list run}]
      catch {.x$self.bbar.edit configure -image icon_mode_$mode}
!     .x$self.c configure -background $look(canvasbg$mode)
!     set @mode $mode
  }
  
! proc pdtk_canvas_getscroll {args} {}
  
  #-----------------------------------------------------------------------------------#
--- 864,876 ----
  #-----------------------------------------------------------------------------------#
  # check or uncheck the "edit" menu item
! def* canvas editmode {mode} {
      global look
!     .x$self.m.edit entryconfigure "Edit mode" -indicatoron $mode
!     set @editmode $mode
      catch {.x$self.bbar.edit configure -image icon_mode_$mode}
!     .x$self.c configure -background [if $@editmode {list $look(canvasbgedit)} {list $look(canvasbgrun)}]
  }
  
! def* canvas getscroll {args} {}
  
  #-----------------------------------------------------------------------------------#
***************
*** 926,931 ****
      set @current_x 30
      set @current_y 30
!     set @editable $editable
!     set @mode [if {$editable} {list "edit"} else {list "run"}]
  }
  
--- 925,931 ----
      set @current_x 30
      set @current_y 30
!     set @editmode $editable
!     set @select_by ""
!     set @bbox {0 0 100 100}
  }
  
***************
*** 957,961 ****
        }
      }
!     $self bind <ButtonRelease>     mouseup %x %y %b
      $self bind <Control-Key>       ctrlkey %K 0
      $self bind <Control-Shift-Key> ctrlkey %K 1
--- 957,961 ----
        }
      }
!     $self bind <ButtonRelease>     unclick %x %y %b
      $self bind <Control-Key>       ctrlkey %K 0
      $self bind <Control-Shift-Key> ctrlkey %K 1
***************
*** 979,992 ****
  #   $self bind <Unmap>      unmap
      switch $OS { unix {
! 	$self bind <Button-4>       scroll $c y -1
!     	$self bind <Button-5>       scroll $c y +1
! 	$self bind <Shift-Button-4> scroll $c x -1
!     	$self bind <Shift-Button-5> scroll $c x +1
      } default {
! 	$self bind <MouseWheel>       scroll $c y \[expr -abs(%D)/%D\]
! 	$self bind <Shift-MouseWheel> scroll $c x \[expr -abs(%D)/%D\]
      }}
  }
  
  def canvas new_menubar {editable} {
      set name .x$self
--- 979,996 ----
  #   $self bind <Unmap>      unmap
      switch $OS { unix {
! 	$self bind <Button-4>       scroll y -1
!     	$self bind <Button-5>       scroll y +1
! 	$self bind <Shift-Button-4> scroll x -1
!     	$self bind <Shift-Button-5> scroll x +1
      } default {
! 	$self bind <MouseWheel>       scroll y \[expr -abs(%D)/%D\]
! 	$self bind <Shift-MouseWheel> scroll x \[expr -abs(%D)/%D\]
      }}
  }
  
+ def canvas scroll {axis diff} {
+     .x$self.c [list $axis]view scroll $diff units
+ }
+ 
  def canvas new_menubar {editable} {
      set name .x$self
***************
*** 1157,1164 ****
  	item $self $canvas BASE3 line      $xyc -fill $look(objectframe3)
          io_draw $self $canvas
-         #set @clickeditevent objectbox_clickedit
-         #set @clickevent objectbox_click
          if {[$canvas selected? $self]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)}
! 	set c .x$self.c
  	$c itemconfigure ${self}BASE -outline $frcol
  	if {$@isnew} {
--- 1161,1166 ----
  	item $self $canvas BASE3 line      $xyc -fill $look(objectframe3)
          io_draw $self $canvas
          if {[$canvas selected? $self]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)}
! 	set c .x$canvas.c
  	$c itemconfigure ${self}BASE -outline $frcol
  	if {$@isnew} {
***************
*** 1224,1228 ****
  
  # change the text
! proc pdtk_text_set {canvas myname text} {text_set $canvas $myname $text}
  proc text_set {canvas myname text} {
      .x$canvas.c itemconfigure $myname -text $text
--- 1226,1230 ----
  
  # change the text
! proc* pdtk_text_set {canvas myname text} {}
  proc text_set {canvas myname text} {
      .x$canvas.c itemconfigure $myname -text $text
***************
*** 1242,1246 ****
  		-font [format -*-courier-medium--normal--%d-* $font_size]
  	set _(focus) $self
! 	bind $t <KeyRelease> "text_key $self .x$canvas.c %W %x %y %K %A 0"
  	set @isnew 1
  	set t .x$canvas.c.${self}text
--- 1244,1248 ----
  		-font [format -*-courier-medium--normal--%d-* $font_size]
  	set _(focus) $self
! 	bind $t <KeyRelease> "text_key $self $canvas %W %x %y %K %A 0"
  	set @isnew 1
  	set t .x$canvas.c.${self}text
***************
*** 1313,1318 ****
  	$self draw $canvas
  	for {set x 0} {$x<$@inlets} {incr x} {
! 		if {[info exists _($self:0:$x)]} {
! 			foreach wire_id $_($self:0:$x) {
  				wire_update $wire_id $_($wire_id) 
  				wire_draw2 $wire_id $canvas
--- 1315,1320 ----
  	$self draw $canvas
  	for {set x 0} {$x<$@inlets} {incr x} {
! 		if {[info exists _($self:i:$x)]} {
! 			foreach wire_id $_($self:i:$x) {
  				wire_update $wire_id $_($wire_id) 
  				wire_draw2 $wire_id $canvas
***************
*** 1323,1328 ****
  	}
  	for {set x 0} {$x<$@outlets} {incr x} {
! 		if {[info exists _($self:1:$x)]} {
! 			foreach wire_id $_($self:1:$x) {
  				wire_update $wire_id $_($wire_id) 
  				wire_draw2 $wire_id $canvas
--- 1325,1330 ----
  	}
  	for {set x 0} {$x<$@outlets} {incr x} {
! 		if {[info exists _($self:o:$x)]} {
! 			foreach wire_id $_($self:o:$x) {
  				wire_update $wire_id $_($wire_id) 
  				wire_draw2 $wire_id $canvas
***************
*** 1362,1367 ****
      set cx [$c canvasx $x]; set @current_x $cx
      set cy [$c canvasy $y]; set @current_y $cy
- 
-     set edit 0; switch $@mode { edit { set edit 1 } }
      if {$tooltip(visible)} {
  	if {[expr pow($tooltip(mx)-$cx,2) + pow($tooltip(my)-$cy,2) > 100]} {
--- 1364,1367 ----
***************
*** 1404,1419 ****
  		#----handles the wire update----
  		for {set x 0} {$x<$_($obj:inlets)} {incr x} {
! 			if {[info exists _($obj:0:$x)]} {
! 				foreach wire $_($obj:0:$x) {
  					wire_update $wire $_($wire)
! 					wire_draw2 $wire $canvas
  				}
  			}
  		}
  		for {set x 0} {$x<$_($obj:outlets)} {incr x} {
! 			if {[info exists _($obj:1:$x)]} {
! 				foreach wire $_($obj:1:$x) {
  					wire_update $wire $_($wire) 
! 					wire_draw2 $wire $canvas
  				}
  			}
--- 1404,1419 ----
  		#----handles the wire update----
  		for {set x 0} {$x<$_($obj:inlets)} {incr x} {
! 			if {[info exists _($obj:i:$x)]} {
! 				foreach wire $_($obj:i:$x) {
  					wire_update $wire $_($wire)
! 					wire_draw2 $wire $self
  				}
  			}
  		}
  		for {set x 0} {$x<$_($obj:outlets)} {incr x} {
! 			if {[info exists _($obj:o:$x)]} {
! 				foreach wire $_($obj:o:$x) {
  					wire_update $wire $_($wire) 
! 					wire_draw2 $wire $self
  				}
  			}
***************
*** 1424,1450 ****
        rect {
          set coords [$c coords selrect]
! 	set x1 [lindex $coords 0]
! 	set y1 [lindex $coords 1]
! 	set x2 $cx
! 	set y2 $cy
  	$c coords selrect $x1 $y1 $x2 $y1 $x2 $y2 $x1 $y2 $x1 $y1
        }
      }
-     set run [expr !$edit]
      if {[string length $@focus]} {
! 	set id $@focus
! 	if {$run} {
! 		event $id motionevent     $canvas $cx $cy $mods} {
! 		event $id motioneditevent $canvas $cx $cy $mods}
  	return
      }
!     foreach {type id} [identify_target $self $cx $cy -1 -1 "move "] {}
      switch $type {
        object {
! 	if {$run} {
! 		event $id motionevent     $canvas $cx $cy $mods} {
! 		event $id motioneditevent $canvas $cx $cy $mods}
! 	if {$edit && [llength [$canvas bbox ${id}BASE]]} {
! 	  foreach {x1 y1 x2 y2} [$canvas bbox ${id}BASE] {}
  	  if {abs($y1+3-$cy)<=3} {
  	    set ports 0
--- 1424,1444 ----
        rect {
          set coords [$c coords selrect]
! 	set x1 [lindex $coords 0]; set x2 $cx
! 	set y1 [lindex $coords 1]; set y2 $cy
  	$c coords selrect $x1 $y1 $x2 $y1 $x2 $y2 $x1 $y2 $x1 $y1
        }
      }
      if {[string length $@focus]} {
! 	if {$@editmode} {set event motionedit} {set event motion}
! 	$@focus $event $self $cx $cy $mods
  	return
      }
!     foreach {type id} [$self identify_target $cx $cy -1 -1 "move "] {}
      switch $type {
        object {
! 	if {$@editmode} {set event motionedit} {set event motion}
! 	$id $event $self $cx $cy $mods
! 	if {$@editmode && [llength [$c bbox ${id}BASE]]} {
! 	  foreach {x1 y1 x2 y2} [$c bbox ${id}BASE] {}
  	  if {abs($y1+3-$cy)<=3} {
  	    set ports 0
***************
*** 1453,1460 ****
  	    set port [expr int(($cx-$x1)*$ports/($x2-$x1))]
  	    if {[llength $wire_from]} {
! 		$canvas create rectangle \
! 			[l+ [$canvas coords ${id}i${port}] {-4 -4 +4 +4}] \
  			-outline $look(outletfg) -width 1 -tags ${id}i${port}b
! 		set dehighlight "$canvas delete ${id}i${port}b; set wire_to {}"
  		set wire_to [list $id $port]
  		return
--- 1447,1454 ----
  	    set port [expr int(($cx-$x1)*$ports/($x2-$x1))]
  	    if {[llength $wire_from]} {
! 		$c create rectangle \
! 			[l+ [$c coords ${id}i${port}] {-4 -4 +4 +4}] \
  			-outline $look(outletfg) -width 1 -tags ${id}i${port}b
! 		set dehighlight "$c delete ${id}i${port}b; set wire_to {}"
  		set wire_to [list $id $port]
  		return
***************
*** 1463,1467 ****
  	    }
  	  } {
! 	    foreach {x1 y1 x2 y2} [$canvas bbox ${id}BASE] {}
  	    if {abs($y2-3-$cy)<=3} {
  	        set ports 0
--- 1457,1461 ----
  	    }
  	  } {
! 	    foreach {x1 y1 x2 y2} [$c bbox ${id}BASE] {}
  	    if {abs($y2-3-$cy)<=3} {
  	        set ports 0
***************
*** 1469,1476 ****
  		if {$ports} {
  			set port [expr int(($cx-$x1)*$ports/($x2-$x1))]
! 			$canvas create rectangle \
! 				[l+ [$canvas coords ${id}o${port}] {-4 -4 +4 +4}] \
  				-outline $look(outletfg) -width 1 -tags ${id}o${port}b
! 			set dehighlight "$canvas delete ${id}o${port}b"
  		}
  	    }
--- 1463,1470 ----
  		if {$ports} {
  			set port [expr int(($cx-$x1)*$ports/($x2-$x1))]
! 			$c create rectangle \
! 				[l+ [$c coords ${id}o${port}] {-4 -4 +4 +4}] \
  				-outline $look(outletfg) -width 1 -tags ${id}o${port}b
! 			set dehighlight "$c delete ${id}o${port}b"
  		}
  	    }
***************
*** 1483,1488 ****
  
  #-----------------------------------------------------------------------------------#
! proc identify_target {canvas cx cy b f label} {
!     set c .x$canvas.c
      set stack [lreverse [$c find overlapping \
  	    [expr $cx-2] [expr $cy-2] [expr $cx+2] [expr $cy+2]]]
--- 1477,1482 ----
  
  #-----------------------------------------------------------------------------------#
! def canvas identify_target {cx cy b f label} {
!     set c .x$self.c
      set stack [lreverse [$c find overlapping \
  	    [expr $cx-2] [expr $cy-2] [expr $cx+2] [expr $cy+2]]]
***************
*** 1533,1537 ****
      set tags [$c gettags [lindex [$c find overlapping \
  	[expr $cx-2] [expr $cy-2] [expr $cx+2] [expr $cy+2]] end]]
!     foreach {type id} [identify_target $self $cx $cy -1 -1 "click"] {}
      switch $type {
        object {
--- 1527,1531 ----
      set tags [$c gettags [lindex [$c find overlapping \
  	[expr $cx-2] [expr $cy-2] [expr $cx+2] [expr $cy+2]] end]]
!     foreach {type id} [$self identify_target $cx $cy -1 -1 "click"] {}
      switch $type {
        object {
***************
*** 1545,1549 ****
  	$bar.what configure -text "focus: $@focus"
      }
!     $bar.mode configure -text $@mode
      $bar.action configure -text $@action
      $bar.sel configure -text [llength $@selection]
--- 1539,1543 ----
  	$bar.what configure -text "focus: $@focus"
      }
!     $bar.mode configure -text [if {$@editmode} {list "Edit"} {list "Run "}]
      $bar.action configure -text $@action
      $bar.sel configure -text [llength $@selection]
***************
*** 1559,1570 ****
      set cx [$c canvasx $x]
      set cy [$c canvasy $y]
-     set edit 0; switch $@mode { edit { set edit 1 } }
      set select_area(x1) $x
      set select_area(y1) $y
      set mouse(b1down) 1
!     foreach {type id} [identify_target $self $cx $cy $b $f "click"] {}
      switch $type {
        object {
!         set run [expr !$edit || ($f&2)]
  	if {[string length $@focus]} {set gid $@focus}
  	if {$f&8} {
--- 1553,1563 ----
      set cx [$c canvasx $x]
      set cy [$c canvasy $y]
      set select_area(x1) $x
      set select_area(y1) $y
      set mouse(b1down) 1
!     foreach {type id} [$self identify_target $cx $cy $b $f "click"] {}
      switch $type {
        object {
!         set run [expr $@editmode || ($f&2)]
  	if {[string length $@focus]} {set gid $@focus}
  	if {$f&8} {
***************
*** 1572,1582 ****
  	} else {
  		if {$run} {
- 			#puts "click click click"
  			if {$_($id:class) == "bang"} {bang_bang $id $c}
! 			event $id clickevent     $c $cx $cy $b $f} {
! 			event $id clickeditevent $c $cx $cy $b $f
  		}
  	}
! 	if {!($f&8) && $edit && [llength [$c bbox ${id}BASE]]} {
  	    foreach {x1 y1 x2 y2} [$c bbox ${id}BASE] {}
  	    if {abs($y2-3-$cy)<=3} {
--- 1565,1575 ----
  	} else {
  		if {$run} {
  			if {$_($id:class) == "bang"} {bang_bang $id $c}
! 			$id click     $self $cx $cy $b $f
! 		} {
! 			$id clickedit $self $cx $cy $b $f
  		}
  	}
! 	if {!($f&8) && $@editmode && [llength [$c bbox ${id}BASE]]} {
  	    foreach {x1 y1 x2 y2} [$c bbox ${id}BASE] {}
  	    if {abs($y2-3-$cy)<=3} {
***************
*** 1597,1601 ****
  	    if {[llength $@selection] == 1} {
  	    	if {[expr $already]} {	
! 	    	 set $@select_by "click"
  	    	}
  	    }
--- 1590,1594 ----
  	    if {[llength $@selection] == 1} {
  	    	if {[expr $already]} {	
! 	    	 set @select_by "click"
  	    	}
  	    }
***************
*** 1605,1612 ****
  		#switch $_($id:class) {
  		    #bang {
- 			#puts "clicked on bang :: editable = $edit"
- 			
  			#bang_bang $id $c
- 			
  		    #}
  		    #objectbox {
--- 1598,1602 ----
***************
*** 1653,1657 ****
        }
        default {
! 	if {$edit} {
  	# my object edit mode code begins --chun
  		if {[info exists @obj_in_edit]} {
--- 1643,1647 ----
        }
        default {
! 	if {$@editmode} {
  	# my object edit mode code begins --chun
  		if {[info exists @obj_in_edit]} {
***************
*** 1683,1695 ****
  }
  
! #-----------------------------------------------------------------------------------#
! set canvas_mouseup(name) 0
! set canvas_mouseup(xmin) 0
! set canvas_mouseup(xmax) 0
! set canvas_mouseup(ymin) 0
! set canvas_mouseup(ymax) 0
! 
! def canvas mouseup {x y b} {
!     global canvas_mouseup wire_from wire_to _ font look offset_wire
      set c .x$self.c
      set cx [$c canvasx $x]
--- 1673,1678 ----
  }
  
! def canvas unclick {x y b} {
!     global wire_from wire_to font look offset_wire
      set c .x$self.c
      set cx [$c canvasx $x]
***************
*** 1713,1730 ****
  		set to [lindex $wire_to 0]
  		set inlet_number [lindex $wire_to 1]
- 		set inlet_flag 0
- 		set outlet_flag 1
  
! 		if {[info exists _($from:$outlet_flag:$outlet_number)]} {
! 			lappend _($from:$outlet_flag:$outlet_number) $wire_id
  		} else {
! 			set _($from:$outlet_flag:$outlet_number) $wire_id
! 			#puts "*** $from:$outlet_flag:$outlet_number ***"
  		}
! 		if {[info exists _($to:$inlet_flag:$inlet_number)]} {
! 			lappend _($to:$inlet_flag:$inlet_number) $wire_id
  		} else {
! 			set _($to:$inlet_flag:$inlet_number) $wire_id
! 			#puts "*** $to:$inlet_flag:$inlet_number ***"
  		}
  		#puts "d = $d"
--- 1696,1709 ----
  		set to [lindex $wire_to 0]
  		set inlet_number [lindex $wire_to 1]
  
! 		if {[info exists _($from:o:$outlet_number)]} {
! 			lappend _($from:o:$outlet_number) $wire_id
  		} else {
! 			set _($from:o:$outlet_number) $wire_id
  		}
! 		if {[info exists _($to:i:$inlet_number)]} {
! 			lappend _($to:i:$inlet_number) $wire_id
  		} else {
! 			set _($to:i:$inlet_number) $wire_id
  		}
  		#puts "d = $d"
***************
*** 1810,1818 ****
  				#if {[info exists]}
  				#puts "check -> $obj"
! 				if {[info exists _($obj:0:$x)]} {
! 					#puts "wires at inlet $x to select --> $_($obj:0:$x)"
  					#wire_update $_()
  					#wire_update:: l80f8ea8 81168ae 1 81168af 0 0
! 					foreach wire_id $_($obj:0:$x) {
  						#wire_update $wire_id $_($wire_id) 
  						#wire_draw2 $wire_id $self
--- 1789,1797 ----
  				#if {[info exists]}
  				#puts "check -> $obj"
! 				if {[info exists _($obj:i:$x)]} {
! 					#puts "wires at inlet $x to select --> $_($obj:i:$x)"
  					#wire_update $_()
  					#wire_update:: l80f8ea8 81168ae 1 81168af 0 0
! 					foreach wire_id $_($obj:i:$x) {
  						#wire_update $wire_id $_($wire_id) 
  						#wire_draw2 $wire_id $self
***************
*** 1823,1829 ****
  			}
  			for {set x 0} {$x<$_($obj:outlets)} {incr x} {
! 				if {[info exists _($obj:1:$x)]} {
! 					#puts "wires at outlet $x to update --> $_($obj:1:$x)"
! 					foreach wire_id $_($obj:1:$x) {
  						#wire_update $wire_id $_($wire_id) 
  						#wire_draw2 $wire_id $self
--- 1802,1808 ----
  			}
  			for {set x 0} {$x<$_($obj:outlets)} {incr x} {
! 				if {[info exists _($obj:o:$x)]} {
! 					#puts "wires at outlet $x to update --> $_($obj:o:$x)"
! 					foreach wire_id $_($obj:o:$x) {
  						#wire_update $wire_id $_($wire_id) 
  						#wire_draw2 $wire_id $self
***************
*** 1837,1853 ****
  		#puts "@selection_wire --> $@selection_wire"
      		foreach obj $@selection) {
!     			$canvas itemconfigure ${obj}BASE -outline $look(objectframe4)
      		}
  		foreach wire $@selection_wire {
! 			$canvas itemconfigure $wire -fill $look(wirefg2)
  		}
      		set @select_by "selrect"
  	} {
        		#foreach obj $@selection {
!       		#$canvas itemconfigure ${obj}BASE -outline $look(objectframe3)
        		#}
        		#set @selection {}
  	}
! 	$canvas delete selrect
      }
      
--- 1816,1832 ----
  		#puts "@selection_wire --> $@selection_wire"
      		foreach obj $@selection) {
!     			$c itemconfigure ${obj}BASE -outline $look(objectframe4)
      		}
  		foreach wire $@selection_wire {
! 			$c itemconfigure $wire -fill $look(wirefg2)
  		}
      		set @select_by "selrect"
  	} {
        		#foreach obj $@selection {
!       		#$c itemconfigure ${obj}BASE -outline $look(objectframe3)
        		#}
        		#set @selection {}
  	}
! 	$c delete selrect
      }
      
***************
*** 1857,1907 ****
  		switch $_($@selection:class) {
  		  objectbox {
! 			if {$@obj_in_edit == 0} {
  				set @obj_in_edit 1
! 				objectbox_edit [lindex $@selection 0] $canvas
  			}
  		  }
  		}
  	}
-     	#objectbox_edit $@edit_object $canvas
      }
-     set edit 0; switch $@mode { edit { set edit 1 } }
-     set run [expr !$edit]
      if {[string length $@focus]} {
  	set id $@focus
!         if {$run} {
!         	#puts "====== drag drag drag ======"
!         	# i think this is for handling the mouse drag for things like
!         	# numbox and slider
!         	# can't test, the slider and numbox drag seems to be broken for me
!         	
! 		event $id unclickevent     $canvas $cx $cy
! 	} {
! 		event $id unclickeditevent $canvas $cx $cy
! 	}
      }
! 
!     set edit 0; switch $@mode { edit { set edit 1 } }
!     foreach {type id} [identify_target $canvas $cx $cy -1 -1 "blah "] {}
! 
      switch $type {
        object {
!         if {$run} {
!       		# executed when pd is in run mode and clicked on a numbox
! 		event $id unclickevent     $canvas $cx $cy
! 	} {
! 		event $id unclickeditevent $canvas $cx $cy
! 	}
        }
      }
!     
!     pd "$self mouseup $cx $cy $b ;"
!     set size [$name bbox all]
!     
      if {$size != ""} {
!         # not entirely sure what this is, but it executes when there are objects
!         # on canvas and there is a mouseup --chun
!         
!     	set xmin 0; set xmax 100
      	set ymin 0; set ymax 100
      	set x1 [lindex $size 0]; set x2 [lindex $size 2]
--- 1836,1864 ----
  		switch $_($@selection:class) {
  		  objectbox {
! 			if {!$@obj_in_edit} {
  				set @obj_in_edit 1
! 				[lindex $@selection 0] edit $self
  			}
  		  }
  		}
  	}
      }
      if {[string length $@focus]} {
  	set id $@focus
!         if {$@editmode} {set event unclickedit} {set event unclick}
! 	$id $event $self $cx $cy
      }
!     foreach {type id} [$self identify_target $cx $cy -1 -1 "blah "] {}
      switch $type {
        object {
!         if {$@editmode} {set event unclickedit} {set event unclick}
! 	$id $event $self $cx $cy
        }
      }
!     set size [$c bbox all]
      if {$size != ""} {
! 	# not entirely sure what this is, but it executes when there are objects
! 	# on canvas and there is an unclick --chun
! 	set xmin 0; set xmax 100
      	set ymin 0; set ymax 100
      	set x1 [lindex $size 0]; set x2 [lindex $size 2]
***************
*** 1909,1926 ****
      	if {$x1 < 0} {set xmin $x1}; if {$x2 > 100} {set xmax $x2}
      	if {$y1 < 0} {set ymin $y1}; if {$y2 > 100} {set ymax $y2}
!     	if {$canvas_mouseup(name) != $name || \
!     	    $canvas_mouseup(xmin) != $xmin || \
!     	    $canvas_mouseup(xmax) != $xmax || \
!     	    $canvas_mouseup(ymin) != $ymin || \
!     	    $canvas_mouseup(ymax) != $ymax } {
! 	    	$name configure -scrollregion [list $xmin $ymin $xmax $ymax]
! 	    	set canvas_mouseup(name) $name
! 	    	set canvas_mouseup(xmin) $xmin
! 	    	set canvas_mouseup(xmax) $xmax
! 	    	set canvas_mouseup(ymin) $ymin
! 	    	set canvas_mouseup(ymax) $ymax
      	}
      }
!     canvas_checkgeometry [canvastosym $name]
      set @action none
  }
--- 1866,1876 ----
      	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
      	}
      }
!     $self checkgeometry
      set @action none
  }
***************
*** 1931,1937 ****
  
  def canvas checkgeometry {} {
!     set topname [canvastosym $self]
!     #puts "canvas_checkgeometry::: $topname"
! 
      set boo [winfo geometry $topname.c]
      set boo2 [wm geometry $topname]
--- 1881,1885 ----
  
  def canvas checkgeometry {} {
!     set topname .x$self
      set boo [winfo geometry $topname.c]
      set boo2 [wm geometry $topname]
***************
*** 1949,1953 ****
      global OS
      set c .x$self.c
!     $c hide_tooltip
      switch $OS {
        osx {
--- 1897,1901 ----
      global OS
      set c .x$self.c
!     $self hide_tooltip
      switch $OS {
        osx {
***************
*** 1960,1964 ****
      if {$key == "KP_Delete"} {set key 127; set keynum 127}
      if {$iso != ""} {scan $iso %c key}
-     set edit 0; switch $@mode { edit { set edit 1 } }
      puts "focus = $@focus"
      if {$key == 8} {
--- 1908,1911 ----
***************
*** 1971,1981 ****
      }
      if {[string length $@focus] > 0} {
! 	set id $@focus
!         set run [expr !$edit]
!         if {$run && [info exists _($id:keyevent)]} { 
! 		eval [linsert [list $_($self:focus) $self $key $shift] 0 $_($id:keyevent)]
!         } elseif {!$run && [info exists _($id:keyeditevent)]} {
! 		eval [linsert [list $_($self:focus) $self $key $shift] 0 $_($id:keyeditevent)]
! 	}
      }
      statusbar_update $self $x $y
--- 1918,1923 ----
      }
      if {[string length $@focus] > 0} {
!         if {$@editmode} {set event keyedit} {set event key}
! 	$@focus $event $self $key $shift
      }
      statusbar_update $self $x $y
***************
*** 1987,2000 ****
      set canvas .x$self.c
      if {$iso != ""} {scan $iso %c key}
!     #pd [canvastosym $canvas] key 0 $key 0 \;
!     set edit 0; switch $_($self:mode) { edit { set edit 1 } }
!     if {[string length $_($self:focus)] > 0} {
! 	set id $_($self:focus)
!         set run [expr !$edit]
!         if {$run && [info exists _($id:keyreleaseevent)]} {
! 		eval [linsert [list $_($self:focus) $canvas $key $shift] 0 $_($id:keyreleaseevent)]
!         } elseif {!$run && [info exists _($id:keyreleaseeditevent)]} {
! 		eval [linsert [list $_($self:focus) $canvas $key $shift] 0 $_($id:keyreleaseeditevent)]
! 	}
      }
      statusbar_update $self $x $y
--- 1929,1935 ----
      set canvas .x$self.c
      if {$iso != ""} {scan $iso %c key}
!     if {[string length $@focus] > 0} {
!         if {$@editmode} {set action keyreleaseedit} {set action keyrelease}
! 	$@focus $event $canvas $key $shift
      }
      statusbar_update $self $x $y
***************
*** 2047,2058 ****
  }
  
! def wire update {d} {
! 	foreach [list @obj1 @port1 @obj2 @port2] \
! 		[lrange $d 0 3] {}
! }
! 
! def wire status {d} {
! 	foreach [list @obj1 @port1 @obj2 @port2] [lrange $d 0 3] {}
! }
  
  #-----------------------------------------------------------------------------------#
--- 1982,1987 ----
  }
  
! def wire update {d} {foreach [list @obj1 @port1 @obj2 @port2] [lrange $d 0 3] {}}
! def wire status {d} {foreach [list @obj1 @port1 @obj2 @port2] [lrange $d 0 3] {}}
  
  #-----------------------------------------------------------------------------------#
***************
*** 2161,2164 ****
--- 2090,2099 ----
  class_new view {thing}
  def view erase {canvas} {item_delete $self $canvas}
+ def view   click     {args} {}
+ def view   clickedit {args} {}
+ def view unclick     {args} {}
+ def view unclickedit {args} {}
+ def view  motion     {args} {}
+ def view  motionedit {args} {}
  
  proc item {self canvas suffix type coords args} {
***************
*** 2174,2180 ****
  }
  
! proc item_delete {self canvas} {
! 	$canvas delete $self 
! }
  
  def shadow draw {canvas coords} {
--- 2109,2113 ----
  }
  
! proc item_delete {self canvas} {.x$canvas.c delete $self}
  
  def shadow draw {canvas coords} {
***************
*** 2258,2266 ****
  	io_draw $self $canvas
  	label_draw $self $canvas
- 	set @clickevent numbox_click
- 	set @keyevent numbox_key
- 	set @unfocusevent numbox_unfocus
- 	set @motionevent numbox_motion
- 	set @unclickevent numbox_unclick
  	if {[$canvas selected? $self]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)}
  	$canvas itemconfigure ${self}BASE -outline $frcol
--- 2191,2194 ----
***************
*** 2404,2408 ****
  	label_draw $self $canvas
  	radio_set $self $canvas $@on
- 	set @clickevent radio_click
  }
  
--- 2332,2335 ----
***************
*** 2452,2460 ****
  		-outline #000000 -fill [darker $color]
  	label_draw $self $canvas
- 	set @clickevent   slider_click
- 	set @motionevent  slider_motion
- 	set @unclickevent slider_unclick
- 	set @unfocusevent slider_unfocus
- 
  	set pos [$canvas coords ${self}BASE]
  	set span [expr $@max-$@min]
--- 2379,2382 ----
***************
*** 2585,2589 ****
  		-fill [bluify $colour] -tags ${self}BUT
  	label_draw $self $canvas
- 	set @clickevent bang_click
  }
  
--- 2507,2510 ----
***************
*** 2625,2629 ****
  	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
- 	set @clickevent toggle_click
  }
  
--- 2546,2549 ----





More information about the Pd-cvs mailing list