aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormescalinum <mescalinum@users.sourceforge.net>2009-09-03 11:26:37 +0000
committermescalinum <mescalinum@users.sourceforge.net>2009-09-03 11:26:37 +0000
commit129cfacb39fba0644bf5f56a67c73cee6999f0b5 (patch)
tree3fd354ee3f99590bfc9ab706a45179dc5285c78b
parentb384a01e30dcaab713dd7d93bd3789890b3ba73a (diff)
fixed a bug that prevented multiple objects to be in the same canvas
svn path=/trunk/externals/tclpd/; revision=12208
-rw-r--r--bitmap-help.pd10
-rw-r--r--bitmap.tcl12
2 files changed, 14 insertions, 8 deletions
diff --git a/bitmap-help.pd b/bitmap-help.pd
index 10d5a17..307df30 100644
--- a/bitmap-help.pd
+++ b/bitmap-help.pd
@@ -1,17 +1,23 @@
-#N canvas 570 333 463 455 10;
+#N canvas 572 379 463 455 10;
#X obj 133 174 bitmap 15 8 8 1 0 0 1 1 0 0 1 0 1 1 0 0 1 0 1 0 1 1
0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 0 1 0 1 1 1 0 0 0 0 1 0 0
0 1 0 1 1 0 0 0 0 0 1;
#X obj 133 311 print out;
#X msg 133 146 getrow \$1;
#X obj 112 175 vradio 15 1 0 8 empty empty empty 0 -8 0 10 -262144
--1 -1 3;
+-1 -1 0;
#X obj 112 341 s \$0r;
#X obj 133 118 r \$0r;
#X text 36 19 [bitmap] - a two dimensional array of bits (toggles)
;
#X text 38 49 creation arguments [cellsize] [width] [height] ?[data
...];
+#X obj 262 174 bitmap 15 8 1 1 0 0 1 1 0 1 0;
+#X obj 277 208 bitmap 8 11 11 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1
+1 0 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
+0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1
+0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+;
#X connect 0 0 1 0;
#X connect 2 0 0 0;
#X connect 3 0 4 0;
diff --git a/bitmap.tcl b/bitmap.tcl
index 7ed451d..cf5800a 100644
--- a/bitmap.tcl
+++ b/bitmap.tcl
@@ -8,13 +8,13 @@ pd::guiproc bitmap_draw_new {self c x y sz w h data} {
[expr {0+$x+$j*$sz}] [expr {0+$y+$i*$sz}] \
[expr {1+$x+($j+1)*$sz}] [expr {1+$y+($i+1)*$sz}] \
-outline black -fill [lindex {white black} [lindex $data $z]] \
- -tags [list $c cell_${j}_${i}_$c]
+ -tags [list $self cell_${j}_${i}_$self]
incr z
}
}
set x2 [expr {$x+$w*$sz+1}]
set y2 [expr {$y+$h*$sz+1}]
- $c create rectangle $x $y $x2 $y2 -outline black -tags [list $c border$c]
+ $c create rectangle $x $y $x2 $y2 -outline black -tags [list $self border$self]
}
pd::guiclass bitmap {
@@ -60,14 +60,14 @@ pd::guiclass bitmap {
if {$dx != 0 || $dy != 0} {
incr @x $dx
incr @y $dy
- sys_gui [list $@c move $@c $dx $dy]\n
+ sys_gui [list $@c move $self $dx $dy]\n
}
return [list $@x $@y]
}
widgetbehavior_select {
set sel [lindex $args 0]
- sys_gui [list $@c itemconfigure $@c -outline [lindex {black blue} $sel]]\n
+ sys_gui [list $@c itemconfigure $self -outline [lindex {black blue} $sel]]\n
}
widgetbehavior_activate {
@@ -81,7 +81,7 @@ pd::guiclass bitmap {
if {$vis} {
sys_gui [list bitmap_draw_new $self $@c $@x $@y $@sz $@w $@h $@data ]\n
} else {
- sys_gui [list $@c delete $@c]\n
+ sys_gui [list $@c delete $self]\n
}
}
@@ -101,7 +101,7 @@ pd::guiclass bitmap {
puts stderr "RELX=$xpix RELY=$ypix IDX=$idx"
set d [expr {[lindex $@data $idx]==0}]
lset @data $idx $d
- sys_gui [list $@c itemconfigure cell_${j}_${i}_$@c -fill [lindex {white black} $d]]\n
+ sys_gui [list $@c itemconfigure cell_${j}_${i}_$self -fill [lindex {white black} $d]]\n
}
}
}