[PD-cvs] extensions/gui/ix mat.wid,1.3,1.4 mat-demo.pd,1.1,1.2
carmen rocco
ix9 at users.sourceforge.net
Mon May 16 20:31:21 CEST 2005
Update of /cvsroot/pure-data/extensions/gui/ix
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3355
Modified Files:
mat.wid mat-demo.pd
Log Message:
piano roll (has some bugs)
Index: mat.wid
===================================================================
RCS file: /cvsroot/pure-data/extensions/gui/ix/mat.wid,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** mat.wid 16 May 2005 16:30:20 -0000 1.3
--- mat.wid 16 May 2005 18:31:18 -0000 1.4
***************
*** 9,13 ****
--- 9,20 ----
proc mat_click {button action p t x y} {
variable _
+ set clicked [$p.m find overlapping $x $y $x $y]
switch $action {
+ first {
+ # if {$clicked ne ""} {
+ set _($t:cl) $clicked
+ # }
+ foreach xy {x y} {set _($t:f$xy) [set $xy]}
+ }
motion {
set mx [expr $x - $_($t:cx)]
***************
*** 29,33 ****
switch $button {
1 {
! foreach item [$p.m find withtag item] {
set m [$p.m itemcget $item -matrix]
set m [list [lindex $m 0] [lindex $m 1] [list [expr [lindex [lindex $m 2] 0] + $mx] [expr [lindex [lindex $m 2] 1] + $my]]]
--- 36,46 ----
switch $button {
1 {
! if {$clicked ne ""} {
! set items $clicked
! } else {
! set items [$p.m find withtag item]
! mat_gridlines $p $t
! }
! foreach item $items {
set m [$p.m itemcget $item -matrix]
set m [list [lindex $m 0] [lindex $m 1] [list [expr [lindex [lindex $m 2] 0] + $mx] [expr [lindex [lindex $m 2] 1] + $my]]]
***************
*** 41,50 ****
set py [mat_tr $p $t y t [lindex $_($t:items:$id) 1]]
set sx [mat_tr $p $t x id [expr [lindex $_($t:items:$id) 2] - [lindex $_($t:items:$id) 0]]]
! set sy [mat_tr $p $t y id [expr [lindex $_($t:items:$id) 3] - [lindex $_($t:items:$id) 1]]]
$p.m coords $item [::tkpath::coords rect $px $py $sx $sy -rx 3 -ry 3]
}
}
! }
! mat_gridlines $p $t
}
}
--- 54,73 ----
set py [mat_tr $p $t y t [lindex $_($t:items:$id) 1]]
set sx [mat_tr $p $t x id [expr [lindex $_($t:items:$id) 2] - [lindex $_($t:items:$id) 0]]]
! # set sy [mat_tr $p $t y id [expr [lindex $_($t:items:$id) 3] - [lindex $_($t:items:$id) 1]]]
! set sy [mat_tr $p $t y id 1]
$p.m coords $item [::tkpath::coords rect $px $py $sx $sy -rx 3 -ry 3]
}
+ mat_gridlines $p $t
}
! 3 {
! set velo [expr ($x - $_($t:fx)) / 100.0]
! foreach item $_($t:cl) {
! set vel [expr $velo + [$p.m itemcget $item -fillopacity]]
! if {$vel > 1} {set vel 1}
! if {$vel < 0} {set vel 0}
! $p.m itemconfigure $item -fillopacity $vel
! }
! }
! }
}
}
***************
*** 56,70 ****
switch $action {
motion {
! $p.m coords drawing [::tkpath::coords rect $_($t:cx) $_($t:cy) [expr $x - $_($t:cx)] [expr $y - $_($t:cy)] -rx 3 -ry 3]
}
first {
foreach xy {x y} {set _($t:c$xy) [set $xy]}
$p.m create path [::tkpath::coords rect $_($t:cx) $_($t:cy) 0 0 -rx 3 -ry 3] -tags drawing -fill green -fillopacity 0.8
- $p.m bind drawing <1>
}
release {
$p.m itemconfigure drawing -tags [list item $_($t:i)] -matrix {{1.0 0.0} {0.0 1.0} {0.0 0.0}}
! set _($t:items:$_($t:i)) [list [mat_tr $p $t x i $_($t:cx)] [mat_tr $p $t y i $_($t:cy)] [mat_tr $p $t x i $x] [mat_tr $p $t y i $y]]
! incr _($t:i)
}
}
--- 79,101 ----
switch $action {
motion {
! if {$x >= $_($t:cx)} {
! set xa $_($t:cx)
! set xb $x
! } else {
! set xa $x
! set xb $_($t:cx)
! }
! $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]
! set _($t:items:$_($t:i)) [list [mat_tr $p $t x i $xa] $yi [mat_tr $p $t x i $xb] $yi 0 0 0]
! pd [concat $t.rp _cb note $yi \;]
}
first {
foreach xy {x y} {set _($t:c$xy) [set $xy]}
$p.m create path [::tkpath::coords rect $_($t:cx) $_($t:cy) 0 0 -rx 3 -ry 3] -tags drawing -fill green -fillopacity 0.8
}
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
}
}
***************
*** 113,116 ****
--- 144,150 ----
bind $path.m <B2-Motion> "::ix::mat_click 2 motion $path $target %x %y"
bind $path.m <ButtonRelease-2> "::ix::mat_click 2 release $path $target %x %y"
+ bind $path.m <3> "::ix::mat_click 3 first $path $target %x %y"
+ bind $path.m <B3-Motion> "::ix::mat_click 3 motion $path $target %x %y"
+ bind $path.m <ButtonRelease-3> "::ix::mat_click 3 release $path $target %x %y"
bind $path.m <Control-1> "::ix::mat_draw first $path $target %x %y"
bind $path.m <Control-B1-Motion> "::ix::mat_draw motion $path $target %x %y"
Index: mat-demo.pd
===================================================================
RCS file: /cvsroot/pure-data/extensions/gui/ix/mat-demo.pd,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** mat-demo.pd 16 May 2005 12:23:49 -0000 1.1
--- mat-demo.pd 16 May 2005 18:31:19 -0000 1.2
***************
*** 1,5 ****
! #N canvas 25 203 920 777 12;
#X obj 30 0 widget mat n1 #w 881 #bg white #divX 8 #divY 5 #h 740 #Yb
! 7;
#X msg 1080 -23 -height 26 -width 26 -bg gray95;
#X msg 32 -22 redefine;
--- 1,5 ----
! #N canvas 75 119 920 1023 12;
#X obj 30 0 widget mat n1 #w 881 #bg white #divX 8 #divY 5 #h 740 #Yb
! 63;
#X msg 1080 -23 -height 26 -width 26 -bg gray95;
#X msg 32 -22 redefine;
***************
*** 9,13 ****
#X floatatom 140 -21 5 0 0 0 - - -;
#X msg 329 -20 #Yb \$1;
! #X floatatom 380 -18 5 0 0 0 - - -;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
--- 9,63 ----
#X floatatom 140 -21 5 0 0 0 - - -;
#X msg 329 -20 #Yb \$1;
! #X msg 378 -20 63;
! #X obj 84 767 widget kbd k1 #octaves 7 -width 483 -height 76;
! #X obj 85 847 unpack 0 0;
! #X obj 129 866 * 127;
! #X obj 86 911 pack 0 0;
! #X obj 197 927 + 3;
! #X obj 248 927 + 5;
! #X obj 264 913 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10
! -262144 -1 -1 0 256;
! #X obj 210 913 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10
! -262144 -1 -1 0 256;
! #X obj 169 893 spigot;
! #X obj 231 889 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
! 1;
! #X obj 97 960 noteout;
! #X obj 309 990 makenote 40 250;
! #X obj 330 899 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
! 1;
! #X obj 370 894 metro 250;
! #X obj 411 887 hsl 128 15 0 1000 0 0 empty empty empty -2 -6 0 8 -262144
! -1 -1 0 1;
! #X obj 307 938 random 128;
! #X obj 359 933 t b b b;
! #X obj 362 946 random 128;
! #X obj 424 965 random 2000;
! #X obj 431 932 hsl 128 15 10 5000 0 0 empty empty empty -2 -6 0 8 -262144
! -1 -1 0 1;
! #X msg 447 679 #w \$1 \, #h \$1;
! #X floatatom 453 662 5 0 0 0 - - -;
! #X msg 403 873 9999;
! #X msg 441 875 444;
! #X obj 85 867 + 36;
! #X msg 174 855 36;
! #X msg 207 854 12;
! #X msg 374 869 128;
! #X msg 351 864 0;
! #X obj 343 970 + 0;
! #X msg 369 966 127;
! #X msg 390 968 0;
! #X obj 307 966 + 0;
! #X floatatom 327 957 5 0 0 0 - - -;
! #X obj 371 914 pl;
! #X obj 428 913 hsl 60 8 0 1 0 0 empty empty empty -2 -6 0 8 -262144
! -1 -1 0 1;
! #X obj 574 858 rp ss s1;
! #X obj 632 787 rr ss;
! #X obj 632 768 rg;
! #X obj 35 931 print yo;
! #X obj 17 767 route note;
! #X obj 24 809 print note;
! #X connect 0 0 49 0;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
***************
*** 17,18 ****
--- 67,116 ----
#X connect 7 0 0 0;
#X connect 8 0 7 0;
+ #X connect 9 0 10 0;
+ #X connect 9 0 45 0;
+ #X connect 10 0 33 0;
+ #X connect 10 1 11 0;
+ #X connect 11 0 12 1;
+ #X connect 12 0 19 0;
+ #X connect 12 0 48 0;
+ #X connect 13 0 12 0;
+ #X connect 14 0 12 0;
+ #X connect 15 0 14 1;
+ #X connect 16 0 13 1;
+ #X connect 17 0 14 0;
+ #X connect 17 0 13 0;
+ #X connect 18 0 17 1;
+ #X connect 20 0 19 0;
+ #X connect 20 1 19 1;
+ #X connect 21 0 22 0;
+ #X connect 22 0 43 0;
+ #X connect 23 0 22 1;
+ #X connect 24 0 41 0;
+ #X connect 25 0 24 0;
+ #X connect 25 1 26 0;
+ #X connect 25 2 27 0;
+ #X connect 26 0 38 0;
+ #X connect 27 0 20 2;
+ #X connect 28 0 27 1;
+ #X connect 30 0 29 0;
+ #X connect 31 0 20 2;
+ #X connect 32 0 20 2;
+ #X connect 33 0 12 0;
+ #X connect 33 0 17 0;
+ #X connect 34 0 33 1;
+ #X connect 35 0 33 1;
+ #X connect 36 0 26 1;
+ #X connect 36 0 24 1;
+ #X connect 37 0 26 1;
+ #X connect 37 0 24 1;
+ #X connect 38 0 20 1;
+ #X connect 39 0 38 1;
+ #X connect 40 0 38 1;
+ #X connect 41 0 20 0;
+ #X connect 42 0 41 1;
+ #X connect 43 0 25 0;
+ #X connect 44 0 43 1;
+ #X connect 45 0 9 0;
+ #X connect 47 0 46 0;
+ #X connect 49 0 20 0;
+ #X connect 49 0 50 0;
More information about the Pd-cvs
mailing list