[PD-cvs] extensions/gui/ix mat.wid,1.9,1.10

carmen rocco ix9 at users.sourceforge.net
Mon Jun 20 19:04:36 CEST 2005


Update of /cvsroot/pure-data/extensions/gui/ix
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31177

Modified Files:
	mat.wid 
Log Message:
...


Index: mat.wid
===================================================================
RCS file: /cvsroot/pure-data/extensions/gui/ix/mat.wid,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** mat.wid	19 Jun 2005 08:34:31 -0000	1.9
--- mat.wid	20 Jun 2005 17:04:34 -0000	1.10
***************
*** 2,5 ****
--- 2,6 ----
  namespace eval ::ix {
      proc rc {} {return [format "\#%06x" [expr "int(floor(rand() * 16))"]]}
+ 
      proc mat_note {p t item} {
  	variable _
***************
*** 8,12 ****
  	set vel [$p.m itemcget $item -fillopacity]
  	pd [concat $t.rp _cb note [dict get $_($t) $id y] $vel $len \;]}
!     proc mat_action {p t a x y} {puts gah}
      proc mat_draw {p t a x y} {
  	variable _
--- 9,36 ----
  	set vel [$p.m itemcget $item -fillopacity]
  	pd [concat $t.rp _cb note [dict get $_($t) $id y] $vel $len \;]}
! 
!     proc mat_action {p t a x y} {
!     }
! 
!     proc mat_scroll {p t a x y} {
!     }
! 
!     proc mat_sel {a p t x y} {
! 	variable _
! 	switch $a {
! 	    start {
! 		foreach xy {x y}  {set _($t:c$xy) [set $xy];set _($t:f$xy) [set $xy]}
! 		$p.m create path [::tkpath::coords rect $_($t:cx) $_($t:cy) 0 0 -rx 16 -ry 16] -tags sel -fill cyan -fillopacity 0.2
! 	    }
! 	    motion {
! 		if {$x >= $_($t:cx)} {set xa $_($t:fx);set xb $x} else {set xa $x;set xb $_($t:fx)}
! 		if {$y >= $_($t:cy)} {set ya $_($t:fy);set yb $y} else {set ya $y;set yb $_($t:fy)}
! 		set w [expr abs($xb - $xa)]
! 		set h [expr abs($yb - $ya)]
! 		$p.m coords sel [::tkpath::coords rect $xa $ya $w $h -rx 16 -ry 16]
! 	    }
! 	}
!    }
! 
      proc mat_draw {p t a x y} {
  	variable _
***************
*** 14,18 ****
  	    motion {
  		if {$x >= $_($t:cx)} {set xa $_($t:fx);set xb $x} else {set xa $x;set xb $_($t:fx)}
! 		$p.m coords drawing [::tkpath::coords rect $xa $y [expr $xb - $xa] [mat_tr $p $t y id 1] -rx 3 -ry 3]
  		set yi [mat_tr $p $t y i $y]
  		dict set _($t) $_($t:i) x [mat_tr $p $t x i $xa]
--- 38,44 ----
  	    motion {
  		if {$x >= $_($t:cx)} {set xa $_($t:fx);set xb $x} else {set xa $x;set xb $_($t:fx)}
! 		set w [expr abs($xb - $xa)]
! 		set h [mat_tr $p $t y id 1]
! 		$p.m coords drawing [::tkpath::coords rect $xa $y $w $h -rx 3 -ry 3]
  		set yi [mat_tr $p $t y i $y]
  		dict set _($t) $_($t:i) x [mat_tr $p $t x i $xa]
***************
*** 26,30 ****
  	    release {
  		$p.m itemconfigure drawing -tags [list item $_($t:i)] -matrix {{1.0 0.0} {0.0 1.0} {0.0 0.0}}
! 		incr _($t:i) 2}}}
  
      proc mat_resize_canvas {p t a x y} {
--- 52,56 ----
  	    release {
  		$p.m itemconfigure drawing -tags [list item $_($t:i)] -matrix {{1.0 0.0} {0.0 1.0} {0.0 0.0}}
! 		incr _($t:i)}}}
  
      proc mat_resize_canvas {p t a x y} {
***************
*** 47,50 ****
--- 73,77 ----
  	mat_gridlines $p $t
      }
+ 
      proc mat_object_trans {p t a x y} {
  	variable _
***************
*** 57,60 ****
--- 84,88 ----
  	}
      }
+ 
      proc mat_move_canvas {p t a x y} {
  	variable _
***************
*** 83,102 ****
      }
  
      proc mat_click {m button action p t x y} {
  	variable _
  	set clicked [$p.m find overlapping $x $y $x $y]
  	set a [$p.m itemcget mode -text]
  	switch $action {
- 	    hover {
- 		foreach item $clicked {
- 		    if {[lindex [$p.m itemcget $item -tags] 0] eq "item"} {
- 			mat_note $p $t $item
- 		    }
- 		}
- 
- 		set junk ""
- 		foreach cfg [$p.m itemconfigure $clicked] {set junk "$junk\n$cfg"}
- 		mat_info $p $t $junk
- 	    }
  	    first {
  		set _($t:cl) $clicked
--- 111,144 ----
      }
  
+     proc mat_hover {p t x y} {
+ 	variable _
+ 	if {[$p.m find withtag sel] ne ""} {
+ 	    set clicked [$p.m find overlapping $x $y $_($t:fx) $_($t:fy)] 
+ 	    puts sel
+ 	    mat_sel motion $p $t $x $y
+ 	} else {
+ 	    set clicked [$p.m find overlapping $x $y $x $y]
+ 	}
+ 	set n 0
+ 	$p.m delete hover
+ 	foreach item $clicked {
+ 	    if {[lindex [$p.m itemcget $item -tags] 0] eq "item"} {
+ 		set id [lindex [$p.m itemcget $item -tags] 1]
+ 		mat_note $p $t $item
+ 		$p.m create text "[expr [winfo width $p.m] - 8.0 ] [expr [winfo height $p.m] - 8.0 - 16 * $n.0]" -fill "#ff0022" -justify right -anchor se -font {{bitstream vera sans} 12} -tags hover -text [dict get $_($t) $id] 
+ 		incr n
+ 	    }
+ 	}
+ #	set junk $clicked
+ #	foreach cfg [$p.m itemconfigure $clicked] {set junk "$junk\n$cfg"}
+ #	mat_info $p $t $junk
+     }
+ 
      proc mat_click {m button action p t x y} {
  	variable _
+ #	puts "$m $button $action"
  	set clicked [$p.m find overlapping $x $y $x $y]
  	set a [$p.m itemcget mode -text]
  	switch $action {
  	    first {
  		set _($t:cl) $clicked
***************
*** 104,109 ****
  		switch $button {
  		    1 {
! #			mat_mode $p $t move_canvas
! 			if {$a eq "draw"} {mat_draw $p $t $action $x $y} else {
  			    if {$clicked ne "" && [lindex [$p.m itemcget [lindex $clicked 0] -tags] 0] eq "item"} {
  				mat_mode $p $t move_object
--- 146,152 ----
  		switch $button {
  		    1 {
! 			if {$a eq "draw"} {mat_draw $p $t $action $x $y} elseif {$m eq "double"} {
! 			    mat_sel start $p $t $x $y
! 									     } else {
  			    if {$clicked ne "" && [lindex [$p.m itemcget [lindex $clicked 0] -tags] 0] eq "item"} {
  				mat_mode $p $t move_object
***************
*** 115,118 ****
--- 158,163 ----
  		    2 {mat_mode $p $t resize_canvas}
  		    3 {mat_mode $p $t object_trans}
+ 		    4 {mat_mode $p $t scroll}
+ 		    5 {mat_mode $p $t scroll}
  		}
  	    }
***************
*** 178,184 ****
  	    bind $path.m <Key> "::ix::mat_key $path $target %k 1"
  	    bind $path.m <KeyRelease> "::ix::mat_key $path $target %k 0"
! 	    bind $path.m <Motion> "::ix::mat_click {} 0 hover $path $target %x %y"
! 	    foreach m {"Control-" "" "Shift-"} {
! 		foreach bn {1 2 3} {
  		    set b [list [concat $bn first] [concat B${bn}-Motion motion] [concat ButtonRelease-$bn release]]
  		    foreach ba {0 1 2} {
--- 223,229 ----
  	    bind $path.m <Key> "::ix::mat_key $path $target %k 1"
  	    bind $path.m <KeyRelease> "::ix::mat_key $path $target %k 0"
! 	    bind $path.m <Motion> "::ix::mat_hover $path $target %x %y"
! 	    foreach m {"Control-" "" "Shift-" "Double-"} {
! 		foreach bn {1 2 3 4 5} {
  		    set b [list [concat $bn first] [concat B${bn}-Motion motion] [concat ButtonRelease-$bn release]]
  		    foreach ba {0 1 2} {
***************
*** 187,190 ****
--- 232,236 ----
              $path configure -bg gray -width [expr [winfo width $path.m] + $bd] -height [expr [winfo height $path.m] + $bd]
  	    $path.m create text {20 20} -fill blue -justify left -anchor w -font {{bitstream vera sans} 18} -tags mode -text action
+ 	    $path.m create text "10 $h" -fill red -justify left -anchor sw -font {{bitstream vera sans} 12 bold} -fill red -tags snap -text "snap (off)"
  	    $path.m create text {20 32} -fill gray49 -justify left -anchor nw -font {{bitstream vera sans} 12} -tags info
  	    mat_gridlines $path $target}}





More information about the Pd-cvs mailing list