diff options
-rwxr-xr-x | extensions/gui/ix/mat-demo.pd | 104 | ||||
-rwxr-xr-x | extensions/gui/ix/mat.wid | 50 |
2 files changed, 143 insertions, 11 deletions
diff --git a/extensions/gui/ix/mat-demo.pd b/extensions/gui/ix/mat-demo.pd index 405028e3..612f4bb8 100755 --- a/extensions/gui/ix/mat-demo.pd +++ b/extensions/gui/ix/mat-demo.pd @@ -1,6 +1,6 @@ -#N canvas 25 203 920 777 12; +#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 -7; +63; #X msg 1080 -23 -height 26 -width 26 -bg gray95; #X msg 32 -22 redefine; #X msg 242 -21 #w \$1; @@ -8,7 +8,57 @@ #X floatatom 172 -23 5 0 0 0 - - -; #X floatatom 140 -21 5 0 0 0 - - -; #X msg 329 -20 #Yb \$1; -#X floatatom 380 -18 5 0 0 0 - - -; +#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; #X connect 4 0 0 0; @@ -16,3 +66,51 @@ #X connect 6 0 4 0; #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; diff --git a/extensions/gui/ix/mat.wid b/extensions/gui/ix/mat.wid index 7ac5804e..b1b551e7 100755 --- a/extensions/gui/ix/mat.wid +++ b/extensions/gui/ix/mat.wid @@ -8,7 +8,14 @@ namespace eval ::ix { 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)]
set my [expr $y - $_($t:cy)]
@@ -28,7 +35,13 @@ namespace eval ::ix { }
switch $button {
1 {
- foreach item [$p.m find withtag item] {
+ 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]]]
$p.m itemconfigure $item -matrix $m
@@ -40,12 +53,22 @@ namespace eval ::ix { set px [mat_tr $p $t x t [lindex $_($t:items:$id) 0]]
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 [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
}
- }
- 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
+ }
+ }
+ }
}
}
foreach xy {x y} {set _($t:c$xy) [set $xy]}
@@ -55,17 +78,25 @@ namespace eval ::ix { variable _
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]
+ 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
- $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)
+ incr _($t:i) 2
}
}
@@ -112,6 +143,9 @@ namespace eval ::ix { bind $path.m <Double-2> "::ix::mat_zoomReset $path $target"
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"
bind $path.m <Control-ButtonRelease-1> "::ix::mat_draw release $path $target %x %y"
|