diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index baa0aa9..e705623 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/droidparty-demos/pure-widgets-demo/droidparty_main.pd b/droidparty-demos/pure-widgets-demo/droidparty_main.pd
new file mode 100644
index 0000000..e20c3b6
--- /dev/null
+++ b/droidparty-demos/pure-widgets-demo/droidparty_main.pd
@@ -0,0 +1,399 @@
+#N canvas 74 144 652 384 10;
+#X obj 260 160 cnv 10 250 150 empty ViewPort empty 20 12 0 14 -128992
+-262144 0;
+#X obj 0 160 cnv 10 250 150 empty empty empty 20 12 0 14 -204800 -262144
+0;
+#X obj 219 1 bng 30 250 50 0 \$0-nextview empty next 4 15 0 10 -262144
+-1 -1;
+#X obj 479 161 bng 30 250 50 0 \$0-nextview empty next 4 15 0 10 -262144
+-1 -1;
+#X obj 219 161 bng 30 250 50 0 \$0-nextview empty next 4 15 0 10 -262144
+-1 -1;
+#X obj 2 1 cnv 20 215 30 empty empty multitouch 20 12 0 14 -233017
+-66577 0;
+#X obj 4 40 vsl 25 100 0 127 0 0 empty empty empty 0 -9 0 10 -262144
+-1 -1 0 1;
+#X obj 41 40 vsl 25 100 0 127 0 0 empty empty empty 0 -9 0 10 -262144
+-1 -1 0 1;
+#X obj 77 40 vsl 25 100 0 127 0 0 empty empty empty 0 -9 0 10 -262144
+-1 -1 0 1;
+#X obj 129 40 hsl 100 25 0 127 0 0 empty empty empty -2 -8 0 10 -262144
+-1 -1 0 1;
+#X obj 129 71 hsl 100 25 0 127 0 0 empty empty empty -2 -8 0 10 -262144
+-1 -1 0 1;
+#X obj 126 108 tgl 30 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X obj 164 108 tgl 30 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X obj 202 108 tgl 30 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X obj 263 1 cnv 20 215 30 empty empty labels 20 12 0 14 -233017 -66577
+0;
+#X obj 276 59 vsl 25 80 0 127 0 0 \$0-l1-snd \$0-l1-rcv value:64.3038
+0 -9 1 14 -262144 -1 -1 0 1;
+#X obj 328 105 hsl 128 25 0 127 0 0 \$0-l2-snd \$0-l2-rcv v:75 75 -6
+0 10 -262144 -1 -1 0 1;
+#X obj 480 0 bng 30 250 50 0 \$0-nextview empty next 4 15 0 10 -262144
+-1 -1;
+#N canvas 658 245 692 435 viewport 0;
+#X obj 347 289 s ViewPort;
+#X msg 347 258 pos \$1 \$2;
+#X obj 347 122 t f f;
+#X obj 347 166 * 260;
+#X obj 385 167 * 160;
+#X obj 347 188 pack f f;
+#X obj 241 25 hradio 15 1 0 8 empty empty empty 0 -8 0 10 -262144 -1
+-1 3;
+#X obj 241 5 r \$0-numview;
+#N canvas 3 81 450 300 line2 0;
+#X obj 145 38 inlet time;
+#X obj 54 39 inlet pair;
+#X obj 54 64 unpack f f;
+#X obj 54 86 pack f 1000;
+#X obj 127 86 pack f 1000;
+#X obj 54 110 line;
+#X obj 127 109 line;
+#X obj 54 131 t b f;
+#X obj 54 174 f;
+#X obj 54 152 del 1;
+#X obj 127 129 t b f;
+#X obj 54 195 pack f f;
+#X obj 54 217 outlet linedpair;
+#X connect 0 0 3 1;
+#X connect 0 0 4 1;
+#X connect 1 0 2 0;
+#X connect 2 0 3 0;
+#X connect 2 1 4 0;
+#X connect 3 0 5 0;
+#X connect 4 0 6 0;
+#X connect 5 0 7 0;
+#X connect 6 0 10 0;
+#X connect 7 0 9 0;
+#X connect 7 1 8 1;
+#X connect 8 0 11 0;
+#X connect 9 0 8 0;
+#X connect 10 0 9 0;
+#X connect 10 1 11 1;
+#X connect 11 0 12 0;
+#X restore 347 215 pd line2;
+#X obj 516 18 r \$0-nextview;
+#X obj 516 102 mod 5;
+#X obj 347 145 mod 2;
+#X obj 385 144 div 2;
+#X obj 516 123 s \$0-numview;
+#X obj 544 53 r \$0-numview;
+#X obj 516 79 +;
+#X msg 516 54 1;
+#X obj 241 67 sel 4;
+#X msg 219 143 250 150;
+#N canvas 3 81 450 300 line2 0;
+#X obj 145 38 inlet time;
+#X obj 54 39 inlet pair;
+#X obj 54 64 unpack f f;
+#X obj 54 86 pack f 1000;
+#X obj 127 86 pack f 1000;
+#X obj 54 110 line;
+#X obj 127 109 line;
+#X obj 54 131 t b f;
+#X obj 54 174 f;
+#X obj 54 152 del 1;
+#X obj 127 129 t b f;
+#X obj 54 195 pack f f;
+#X obj 54 217 outlet linedpair;
+#X connect 0 0 3 1;
+#X connect 0 0 4 1;
+#X connect 1 0 2 0;
+#X connect 2 0 3 0;
+#X connect 2 1 4 0;
+#X connect 3 0 5 0;
+#X connect 4 0 6 0;
+#X connect 5 0 7 0;
+#X connect 6 0 10 0;
+#X connect 7 0 9 0;
+#X connect 7 1 8 1;
+#X connect 8 0 11 0;
+#X connect 9 0 8 0;
+#X connect 10 0 9 0;
+#X connect 10 1 11 1;
+#X connect 11 0 12 0;
+#X restore 219 194 pd line2;
+#X msg 241 89 0;
+#X msg 219 218 vis_size \$1 \$2;
+#X msg 307 143 0;
+#X msg 268 145 1000;
+#X obj 241 46 t f f;
+#X obj 268 124 sel 0 4;
+#X msg 480 141 0;
+#X msg 441 143 1000;
+#X obj 441 122 sel 0 4;
+#X obj 408 8 loadbang;
+#X msg 435 47 0;
+#X obj 408 28 t b b;
+#X msg 393 59 0;
+#X msg 166 144 550 330;
+#X obj 55 31 == 4;
+#X obj 55 69 t b b;
+#X obj 55 170 pack f f;
+#X obj 55 89 random 201;
+#X obj 55 108 - 100;
+#X obj 92 108 random 201;
+#X obj 92 127 - 100;
+#X msg 277 163 2000;
+#X obj 55 50 metro 1400;
+#X obj 55 127 + 550;
+#X obj 92 146 + 360;
+#X connect 1 0 0 0;
+#X connect 2 0 11 0;
+#X connect 2 1 12 0;
+#X connect 3 0 5 0;
+#X connect 4 0 5 1;
+#X connect 5 0 8 0;
+#X connect 6 0 24 0;
+#X connect 7 0 6 0;
+#X connect 8 0 1 0;
+#X connect 9 0 16 0;
+#X connect 10 0 13 0;
+#X connect 11 0 3 0;
+#X connect 12 0 4 0;
+#X connect 14 0 15 1;
+#X connect 15 0 10 0;
+#X connect 16 0 15 0;
+#X connect 17 0 20 0;
+#X connect 17 0 33 0;
+#X connect 17 1 2 0;
+#X connect 17 1 18 0;
+#X connect 18 0 19 0;
+#X connect 19 0 21 0;
+#X connect 20 0 2 0;
+#X connect 21 0 0 0;
+#X connect 22 0 19 1;
+#X connect 23 0 19 1;
+#X connect 24 0 17 0;
+#X connect 24 0 34 0;
+#X connect 24 1 25 0;
+#X connect 24 1 28 0;
+#X connect 25 0 23 0;
+#X connect 25 1 41 0;
+#X connect 25 2 22 0;
+#X connect 26 0 8 1;
+#X connect 27 0 8 1;
+#X connect 28 0 27 0;
+#X connect 28 1 27 0;
+#X connect 28 2 26 0;
+#X connect 29 0 31 0;
+#X connect 30 0 15 1;
+#X connect 30 0 8 1;
+#X connect 30 0 19 1;
+#X connect 31 0 18 0;
+#X connect 31 0 32 0;
+#X connect 31 1 30 0;
+#X connect 32 0 2 0;
+#X connect 33 0 19 0;
+#X connect 34 0 42 0;
+#X connect 35 0 37 0;
+#X connect 35 1 39 0;
+#X connect 36 0 19 0;
+#X connect 37 0 38 0;
+#X connect 38 0 43 0;
+#X connect 39 0 40 0;
+#X connect 40 0 44 0;
+#X connect 41 0 19 1;
+#X connect 42 0 35 0;
+#X connect 43 0 36 0;
+#X connect 44 0 36 1;
+#X restore 546 34 pd viewport;
+#N canvas 751 74 450 341 label 0;
+#X obj 39 23 r \$0-l1-snd;
+#X floatatom 39 46 5 0 0 0 - - -;
+#X obj 39 97 s \$0-l1-rcv;
+#X msg 39 69 label value:\$1;
+#X floatatom 196 45 5 0 0 0 - - -;
+#X obj 196 22 r \$0-l2-snd;
+#X obj 196 116 s \$0-l2-rcv;
+#X msg 196 88 label v:\$1 \, label_pos \$1 -6;
+#X obj 196 66 i;
+#X obj 68 184 r \$0-l3-snd;
+#X obj 124 219 random 20;
+#X obj 124 239 + 4;
+#X obj 63 308 s \$0-l3-rcv;
+#X obj 68 203 t b b;
+#X obj 63 254 pack f f;
+#X obj 63 230 random 3;
+#X msg 64 277 label_font 1 10;
+#X obj 193 250 tgl 30 0 \$0-l3-snd \$0-l3-rcv label_font 32 15 1 10
+-262144 -1 -1 0 1;
+#X text 97 159 crashes pddroidparty ( 2013 feb 25);
+#X connect 0 0 1 0;
+#X connect 1 0 3 0;
+#X connect 3 0 2 0;
+#X connect 4 0 8 0;
+#X connect 5 0 4 0;
+#X connect 7 0 6 0;
+#X connect 8 0 7 0;
+#X connect 9 0 13 0;
+#X connect 10 0 11 0;
+#X connect 11 0 14 1;
+#X connect 13 0 15 0;
+#X connect 13 1 10 0;
+#X connect 14 0 16 0;
+#X connect 15 0 14 0;
+#X connect 16 0 12 0;
+#X restore 545 54 pd label;
+#X obj 2 161 cnv 20 215 30 empty empty colors 20 12 0 14 -261682 -66577
+0;
+#X obj 5 206 vsl 25 100 0 127 0 0 empty empty yellow 0 -9 0 10 -257985
+-1 -1 0 1;
+#X obj 60 206 vsl 25 100 0 127 0 0 empty empty green 0 -9 0 10 -4034
+-1 -1 0 1;
+#X obj 127 210 hsl 100 25 0 1 0 0 \$0-c1-snd \$0-c1-rcv change -2 -8
+0 10 -258049 -1 -1 0 1;
+#X obj 123 247 cnv 15 100 50 empty \$0-cc1-rcv empty 20 12 0 14 -166441
+-1 0;
+#X obj 129 264 tgl 30 0 \$0-ct1-snd \$0-ct1-rcv start/stop 0 -7 0 10
+-128992 -1 -1 0 1;
+#N canvas 775 98 506 291 color 0;
+#X obj 27 9 r \$0-ct1-snd;
+#X obj 27 33 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
+;
+#X obj 59 41 t f f;
+#X obj 97 88 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
+;
+#X obj 59 67 sel 0;
+#X msg 59 88 0;
+#X obj 97 109 sel 0 1;
+#X msg 97 135 color 1 22;
+#X msg 168 134 color 14 22;
+#X obj 97 164 s \$0-cc1-rcv;
+#X obj 27 177 sel 0 1;
+#X obj 27 221 s \$0-ct1-rcv;
+#X msg 27 199 color 11 22 22;
+#X msg 121 200 color 13 22 22;
+#X obj 97 66 metro 200;
+#X obj 292 18 r \$0-c1-snd;
+#N canvas 1 27 450 372 rgb 0;
+#X obj 94 36 inlet;
+#X obj 171 38 inlet;
+#X obj 237 39 inlet;
+#X text 99 11 red;
+#X text 169 13 green;
+#X text 241 13 blue;
+#X obj 237 137 t b f;
+#X obj 171 195 +;
+#X obj 171 220 t b f;
+#X obj 171 251 +;
+#X obj 94 114 * -65536;
+#X obj 171 115 * -256;
+#X obj 237 115 * -1;
+#X obj 171 282 - 1;
+#X obj 237 88 i;
+#X obj 237 64 clip 0 255;
+#X obj 171 87 i;
+#X obj 171 63 clip 0 255;
+#X obj 94 81 i;
+#X obj 94 58 clip 0 255;
+#X obj 171 309 outlet;
+#X connect 0 0 19 0;
+#X connect 1 0 17 0;
+#X connect 2 0 15 0;
+#X connect 6 0 7 0;
+#X connect 6 1 7 1;
+#X connect 7 0 8 0;
+#X connect 8 0 9 0;
+#X connect 8 1 9 1;
+#X connect 9 0 13 0;
+#X connect 10 0 9 0;
+#X connect 11 0 7 0;
+#X connect 12 0 6 0;
+#X connect 13 0 20 0;
+#X connect 14 0 12 0;
+#X connect 15 0 14 0;
+#X connect 16 0 11 0;
+#X connect 17 0 16 0;
+#X connect 18 0 10 0;
+#X connect 19 0 18 0;
+#X restore 303 133 pd rgb;
+#X obj 292 43 t f f f;
+#X msg 303 155 color \$1 22 22;
+#X obj 303 175 s \$0-c1-rcv;
+#X obj 331 91 * 255;
+#X obj 376 94 * 255;
+#X obj 292 91 * -255;
+#X obj 275 119 + 255;
+#X obj 293 67 pow 2;
+#X obj 330 67 pow 0.5;
+#X connect 0 0 1 0;
+#X connect 1 0 2 0;
+#X connect 1 0 10 0;
+#X connect 2 0 4 0;
+#X connect 2 1 14 0;
+#X connect 3 0 6 0;
+#X connect 4 0 5 0;
+#X connect 5 0 3 0;
+#X connect 6 0 7 0;
+#X connect 6 1 8 0;
+#X connect 7 0 9 0;
+#X connect 8 0 9 0;
+#X connect 10 0 12 0;
+#X connect 10 1 13 0;
+#X connect 12 0 11 0;
+#X connect 13 0 11 0;
+#X connect 14 0 3 0;
+#X connect 15 0 17 0;
+#X connect 16 0 18 0;
+#X connect 17 0 24 0;
+#X connect 17 1 25 0;
+#X connect 17 2 21 0;
+#X connect 18 0 19 0;
+#X connect 20 0 16 1;
+#X connect 21 0 16 2;
+#X connect 22 0 23 0;
+#X connect 23 0 16 0;
+#X connect 24 0 22 0;
+#X connect 25 0 20 0;
+#X restore 545 74 pd color;
+#X obj 261 161 cnv 20 215 30 empty empty position 20 12 0 14 -233017
+-66577 0;
+#X obj 456 254 tgl 15 0 empty \$0-p0-rcv empty 17 7 0 10 -262144 -1
+-1 0 1;
+#X obj 400 264 tgl 15 0 empty \$0-p1-rcv empty 17 7 0 10 -262144 -1
+-1 0 1;
+#X obj 283 232 tgl 15 0 empty \$0-p2-rcv empty 17 7 0 10 -262144 -1
+-1 0 1;
+#X obj 367 220 tgl 15 0 empty \$0-p3-rcv empty 17 7 0 10 -262144 -1
+-1 0 1;
+#X obj 422 220 hsl 50 25 0 127 0 0 empty \$0-p4-rcv empty -2 -8 0 10
+-262144 -1 -1 0 1;
+#X obj 266 269 hsl 50 20 0 127 0 0 empty \$0-p5-rcv empty -2 -8 0 10
+-262144 -1 -1 0 1;
+#X obj 338 242 hsl 30 15 0 127 0 0 empty \$0-p6-rcv empty -2 -8 0 10
+-262144 -1 -1 0 1;
+#X obj 361 196 bng 15 250 50 0 empty \$0-p7-rcv empty 17 7 0 10 -262144
+-1 -1;
+#X obj 458 238 bng 15 250 50 0 empty \$0-p8-rcv empty 17 7 0 10 -262144
+-1 -1;
+#X obj 264 228 bng 15 250 50 0 empty \$0-p9-rcv empty 17 7 0 10 -262144
+-1 -1;
+#N canvas 831 214 450 300 position 0;
+#X obj 89 83 loadbang;
+#X msg 288 95 0 \, 1 \, 2 \, 3 \, 4 \, 5 \, 6 \, 7 \, 8 \, 9;
+#X obj 291 124 sel 0;
+#X obj 68 163 move \$0 0;
+#X obj 89 124 s \$0-movebang;
+#X obj 73 85 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
+;
+#X obj 89 104 metro 300;
+#X obj 68 182 move \$0 1;
+#X obj 68 200 move \$0 2;
+#X obj 68 218 move \$0 3;
+#X obj 68 237 move \$0 4;
+#X obj 68 255 move \$0 5;
+#X obj 131 162 move \$0 6;
+#X obj 131 181 move \$0 7;
+#X obj 131 199 move \$0 8;
+#X obj 131 217 move \$0 9;
+#X connect 0 0 6 0;
+#X connect 5 0 6 0;
+#X connect 6 0 4 0;
+#X restore 545 94 pd position;
+#X obj 1 312 cnv 15 510 30 empty empty All_Stuff_! 120 16 0 40 -233017
+-66577 0;
diff --git a/droidparty-demos/pure-widgets-demo/move.pd b/droidparty-demos/pure-widgets-demo/move.pd
new file mode 100644
index 0000000..db01492
--- /dev/null
+++ b/droidparty-demos/pure-widgets-demo/move.pd
@@ -0,0 +1,47 @@
+#N canvas 577 335 332 293 10;
+#X obj 78 235 s \$1-p\$2-rcv;
+#X obj 78 135 line;
+#X obj 123 139 line;
+#X msg 78 210 pos \$1 \$2;
+#X obj 78 188 pack f f;
+#X obj 123 167 + 193;
+#X obj 78 165 + 261;
+#X floatatom 43 147 5 0 0 0 - - -;
+#X text 31 168 232;
+#X obj 161 183 t b f;
+#X floatatom 161 166 5 0 0 0 - - -;
+#X obj 72 83 random 232;
+#X obj 85 18 r \$1-movebang;
+#X floatatom 175 142 5 0 0 0 - - -;
+#X obj 85 39 random 10;
+#X obj 85 61 sel 0;
+#X obj 160 84 random 80;
+#X obj 70 103 pack f 6000;
+#X obj 160 106 pack f 6000;
+#X obj 193 35 random 232;
+#X obj 218 55 random 80;
+#X obj 194 -2 loadbang;
+#X obj 194 16 t b b;
+#X connect 1 0 6 0;
+#X connect 2 0 5 0;
+#X connect 3 0 0 0;
+#X connect 4 0 3 0;
+#X connect 5 0 4 1;
+#X connect 6 0 4 0;
+#X connect 7 0 6 0;
+#X connect 9 0 4 0;
+#X connect 9 1 5 0;
+#X connect 10 0 9 0;
+#X connect 11 0 17 0;
+#X connect 12 0 14 0;
+#X connect 14 0 15 0;
+#X connect 15 0 11 0;
+#X connect 15 0 16 0;
+#X connect 16 0 18 0;
+#X connect 17 0 1 0;
+#X connect 18 0 2 0;
+#X connect 19 0 1 0;
+#X connect 20 0 2 0;
+#X connect 21 0 22 0;
+#X connect 22 0 19 0;
+#X connect 22 1 20 0;
diff --git a/project.properties b/project.properties
index 2190d50..14827be 100644
--- a/project.properties
+++ b/project.properties
@@ -12,4 +12,4 @@
android.library.reference.1=./pd-for-android/PdCore
# Project target.
-target=android-10
+target=android-8
diff --git a/src/cx/mccormick/pddroidparty/Bang.java b/src/cx/mccormick/pddroidparty/Bang.java
index e8e22f1..fbc8bad 100644
--- a/src/cx/mccormick/pddroidparty/Bang.java
+++ b/src/cx/mccormick/pddroidparty/Bang.java
@@ -7,9 +7,11 @@
import java.lang.Math;
import android.graphics.Canvas;
+import android.graphics.Color;
import android.graphics.RectF;
import android.graphics.Paint;
import android.view.MotionEvent;
+import android.os.SystemClock;
import android.util.Log;
import org.puredata.core.PdBase;
@@ -18,33 +20,37 @@ public class Bang extends Widget {
private static final String TAG = "Bang";
boolean bang = false;
-
+ long bangtime ;
+ int interrpt,hold; //interrpt and hold time, in ms.
+
public Bang(PdDroidPatchView app, String[] atomline) {
super(app);
- float x = Float.parseFloat(atomline[2]) / parent.patchwidth
- * screenwidth;
- float y = Float.parseFloat(atomline[3]) / parent.patchheight
- * screenheight;
- float w = Float.parseFloat(atomline[5]) / parent.patchwidth
- * screenwidth;
- float h = Float.parseFloat(atomline[5]) / parent.patchheight
- * screenheight;
+ float x = Float.parseFloat(atomline[2]) ;
+ float y = Float.parseFloat(atomline[3]) ;
+ float w = Float.parseFloat(atomline[5]) ;
+ float h = Float.parseFloat(atomline[5]) ;
+
+ hold = (int)Float.parseFloat(atomline[6]) ;
+ interrpt = (int)Float.parseFloat(atomline[7]) ;
+ init = (int)Float.parseFloat(atomline[8]) ;
sendname = app.app.replaceDollarZero(atomline[9]);
receivename = atomline[10];
label = setLabel(atomline[11]);
- labelpos[0] = Float.parseFloat(atomline[12]) / parent.patchwidth
- * screenwidth;
- labelpos[1] = Float.parseFloat(atomline[13]) / parent.patchheight
- * screenheight;
+ labelpos[0] = Float.parseFloat(atomline[12]) ;
+ labelpos[1] = Float.parseFloat(atomline[13]) ;
+ labelfont = Integer.parseInt(atomline[14]);
+ labelsize = (int)(Float.parseFloat(atomline[15]));
+ bgcolor = getColor(Integer.parseInt(atomline[16]));
+ fgcolor = getColor(Integer.parseInt(atomline[17]));
+ labelcolor = getColor(Integer.parseInt(atomline[18]));
// listen out for floats from Pd
setupreceive();
// graphics setup
- dRect = new RectF(Math.round(x), Math.round(y), Math.round(x + w),
- Math.round(y + h));
+ dRect = new RectF(Math.round(x), Math.round(y), Math.round(x + w), Math.round(y + h));
}
public Bang(PdDroidPatchView app) {
@@ -52,67 +58,74 @@ public Bang(PdDroidPatchView app) {
}
public void draw(Canvas canvas) {
- canvas.drawLine(dRect.left + 1, dRect.top, dRect.right, dRect.top,
- paint);
- canvas.drawLine(dRect.left + 1, dRect.bottom, dRect.right,
- dRect.bottom, paint);
- canvas.drawLine(dRect.left, dRect.top + 1, dRect.left, dRect.bottom,
- paint);
- canvas.drawLine(dRect.right, dRect.top + 1, dRect.right, dRect.bottom,
- paint);
+ paint.setStyle(Paint.Style.FILL);
+ paint.setColor(bgcolor);
+ canvas.drawRect(dRect, paint);
+
+ paint.setColor(Color.BLACK);
+ paint.setStrokeWidth(1);
+ canvas.drawLine(dRect.left /*+ 1*/, dRect.top, dRect.right, dRect.top, paint);
+ canvas.drawLine(dRect.left + 0, dRect.bottom, dRect.right, dRect.bottom, paint);
+ canvas.drawLine(dRect.left, dRect.top + 0, dRect.left, dRect.bottom, paint);
+ canvas.drawLine(dRect.right, dRect.top + 0, dRect.right, dRect.bottom, paint);
if (bang) {
- // TODO: only set this back after the set time
- bang = false;
- paint.setStyle(Paint.Style.FILL);
+ if((SystemClock.uptimeMillis()-bangtime)>hold) bang = false;
+ //paint.setStyle(Paint.Style.FILL);
+
parent.threadSafeInvalidate();
- } else {
+ canvas.drawCircle(dRect.centerX(), dRect.centerY(), Math.min(dRect.width(), dRect.height()) / 2, paint);
+ paint.setColor(fgcolor);
+
+ } /*else {
paint.setStyle(Paint.Style.STROKE);
- }
- canvas.drawCircle(dRect.centerX(), dRect.centerY(),
- Math.min(dRect.width(), dRect.height()) / 2, paint);
+ }*/
+ paint.setColor(Color.BLACK);
+ paint.setStyle(Paint.Style.STROKE);
+ canvas.drawCircle(dRect.centerX(), dRect.centerY(), Math.min(dRect.width(), dRect.height()) / 2, paint);
drawLabel(canvas);
}
private void bang() {
bang = true;
+ bangtime = SystemClock.uptimeMillis();
PdBase.sendBang(sendname);
}
- public void touch(MotionEvent event) {
-
- int action = event.getAction() & MotionEvent.ACTION_MASK;
- int pid, index;
- float ex;
- float ey;
- switch (action) {
- case MotionEvent.ACTION_DOWN:
- ex = event.getX();
- ey = event.getY();
- if (dRect.contains(ex, ey)) {
-
- bang();
- }
- break;
- case MotionEvent.ACTION_POINTER_DOWN:
- pid = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
- index = event.findPointerIndex(pid);
- Log.d("BangBefore", index + "");
- index = (index == -1) ? 1 : index;
- Log.d("BangAfter", index + "");
- ex = event.getX(index);
- ey = event.getY(index);
- if (dRect.contains(ex, ey)) {
-
- bang();
-
- }
- break;
-
+ public boolean touchdown(int pid, float x, float y)
+ {
+ if (dRect.contains(x, y)) {
+ bang();
+ return true;
}
-
+
+ return false;
}
-
- public void receiveAny() {
+
+ /*public void receiveAny() {
+ bang();
+ }*/
+
+ public void receiveList(Object... args) {
+ bang();
+ }
+
+
+ public void receiveSymbol(String symbol) {
bang();
}
+
+ public void receiveFloat(float x) {
+ bang();
+ }
+
+ public void receiveBang() {
+ bang();
+ }
+
+
+ public void receiveMessage(String symbol, Object... args) {
+ if(widgetreceiveSymbol(symbol,args)) return;
+ else bang();
+ }
+
}
diff --git a/src/cx/mccormick/pddroidparty/Canvasrect.java b/src/cx/mccormick/pddroidparty/Canvasrect.java
index 64ef9e0..83ac827 100644
--- a/src/cx/mccormick/pddroidparty/Canvasrect.java
+++ b/src/cx/mccormick/pddroidparty/Canvasrect.java
@@ -12,80 +12,73 @@ public class Canvasrect extends Widget {
SVGRenderer vis = null;
- private static int IEM_GUI_MAX_COLOR = 30;
- private static int iemgui_color_hex[] = {
- 16579836, 10526880, 4210752, 16572640, 16572608,
- 16579784, 14220504, 14220540, 14476540, 16308476,
- 14737632, 8158332, 2105376, 16525352, 16559172,
- 15263784, 1370132, 2684148, 3952892, 16003312,
- 12369084, 6316128, 0, 9177096, 5779456,
- 7874580, 2641940, 17488, 5256, 5767248
- };
-
public Canvasrect(PdDroidPatchView app, String[] atomline) {
super(app);
- float x = Float.parseFloat(atomline[2]) / parent.patchwidth * screenwidth;
- float y = Float.parseFloat(atomline[3]) / parent.patchheight * screenheight;
- float w = Float.parseFloat(atomline[6]) / parent.patchwidth * screenwidth;
- float h = Float.parseFloat(atomline[7]) / parent.patchheight * screenheight;
-
+ float x = Float.parseFloat(atomline[2]) ;
+ float y = Float.parseFloat(atomline[3]) ;
+ float w = Float.parseFloat(atomline[6]) ;
+ float h = Float.parseFloat(atomline[7]) ;
+ sendname = atomline[8];
receivename = atomline[9];
- setupreceive();
+ label = setLabel(atomline[10]);
+ labelpos[0] = Float.parseFloat(atomline[11]);
+ labelpos[1] = Float.parseFloat(atomline[12]);
+ labelfont = Integer.parseInt(atomline[13]);
+ labelsize = (int)(Float.parseFloat(atomline[14]));
+ bgcolor = getColor(Integer.parseInt(atomline[15]));
+ labelcolor = getColor(Integer.parseInt(atomline[16]));
- // TODO: calculate and set fill colour
+ setupreceive();
dRect = new RectF(Math.round(x), Math.round(y), Math.round(x + w), Math.round(y + h));
+ vis = getSVG(TAG, null, receivename);
- int iemcolor = Integer.parseInt(atomline[15]);
- Log.e("ORIGINAL COLOR", "" + iemcolor);
- int color = 0;
-
- if(iemcolor < 0)
- {
- iemcolor = -1 - iemcolor;
- paint.setARGB(0xFF, (iemcolor & 0x3f000) >> 10, (iemcolor & 0xfc0) >> 4, iemcolor & 0x3f << 2);
- }
- else
- {
- iemcolor = iemgui_modulo_color(iemcolor);
- color = iemgui_color_hex[iemcolor] << 8 | 0xFF;
- paint.setColor(color);
+ if(receivename.equals("ViewPort")) {
+ parent.viewX=(int)dRect.left;
+ parent.viewY=(int)dRect.top;
+ parent.viewW=(int)dRect.width();
+ parent.viewH=(int)dRect.height();
}
-
- Log.e("COLOR", "" + color);
- //paint.setColor(Color.BLACK);
- paint.setStyle(Paint.Style.FILL);
- //paint.setStyle(Paint.Style.STROKE);
- //r.sort();
- vis = getSVG(TAG, null, receivename);
}
- private int iemgui_modulo_color(int col) {
- while (col >= IEM_GUI_MAX_COLOR)
- col -= IEM_GUI_MAX_COLOR;
- while (col < 0)
- col += IEM_GUI_MAX_COLOR;
- return col;
- }
public void draw(Canvas canvas) {
+ if(receivename.equals("ViewPort")) return;
if (drawPicture(canvas, vis)) {
+ paint.setStyle(Paint.Style.FILL);
+ paint.setColor(bgcolor);
canvas.drawRect(dRect.left, dRect.top, dRect.right, dRect.bottom, paint);
+ drawLabel(canvas);
}
}
public void receiveMessage(String symbol, Object... args) {
- if (symbol.equals("pos")) {
- if (args.length == 2) {
- float w = dRect.width();
- float h = dRect.height();
- //Log.e("POS", args[0].toString() + ", " + args[1].toString());
- dRect.left = Float.parseFloat(args[0].toString()) / parent.patchwidth * screenwidth;
- dRect.top = Float.parseFloat(args[1].toString()) / parent.patchwidth * screenwidth;
- dRect.right = dRect.left + w;
- dRect.bottom = dRect.top + h;
- //r.sort();
+
+ if (symbol.equals("vis_size") && args.length > 1 && args[0].getClass().equals(Float.class) && args[1].getClass().equals(Float.class)) {
+ float w = Float.parseFloat(args[0].toString());
+ float h = Float.parseFloat(args[1].toString());
+
+ dRect.right = dRect.left + w;
+ dRect.bottom = dRect.top + h;
+
+ } else if( symbol.equals("color")
+ && args.length > 1 && args[0].getClass().equals(Float.class)
+ && args[1].getClass().equals(Float.class)
+ ) {
+ bgcolor = getColor24((int)(float)(Float)args[0]);
+ labelcolor = getColor24((int)(float)(Float)args[1]);
+ //Log.e(TAG, "msg bgcolor = "+(int)(float)(Float)args[0]+", bgcolor = "+bgcolor);
+ }
+ else widgetreceiveSymbol(symbol,args);
+
+ if(receivename.equals("ViewPort")) {
+ if (symbol.equals("vis_size") || symbol.equals("pos") ) {
+ parent.viewX=(int)dRect.left;
+ parent.viewY=(int)dRect.top;
+ parent.viewW=(int)dRect.width();
+ parent.viewH=(int)dRect.height();
}
}
}
+
}
diff --git a/src/cx/mccormick/pddroidparty/Comment.java b/src/cx/mccormick/pddroidparty/Comment.java
index fa78307..da5a68b 100644
--- a/src/cx/mccormick/pddroidparty/Comment.java
+++ b/src/cx/mccormick/pddroidparty/Comment.java
@@ -27,8 +27,8 @@ public Comment(PdDroidPatchView app, String[] atomline) {
}
label = buffer.toString();
- labelpos[0] = Float.parseFloat(atomline[2]) / parent.patchwidth * screenwidth;
- labelpos[1] = Float.parseFloat(atomline[3]) / parent.patchheight * screenheight + fontsize;
+ labelpos[0] = Float.parseFloat(atomline[2]) ;
+ labelpos[1] = Float.parseFloat(atomline[3]) ;
}
public void draw(Canvas canvas) {
diff --git a/src/cx/mccormick/pddroidparty/Numberbox.java b/src/cx/mccormick/pddroidparty/Numberbox.java
index e6251e8..f8767a1 100644
--- a/src/cx/mccormick/pddroidparty/Numberbox.java
+++ b/src/cx/mccormick/pddroidparty/Numberbox.java
@@ -26,12 +26,13 @@ public class Numberbox extends Widget {
Rect tRect = new Rect();
boolean down = false;
+ int pid0 = -1; //pointer id when down
public Numberbox(PdDroidPatchView app, String[] atomline) {
super(app);
- float x = Float.parseFloat(atomline[2]) / parent.patchwidth * screenwidth;
- float y = Float.parseFloat(atomline[3]) / parent.patchheight * screenheight;
+ float x = Float.parseFloat(atomline[2]) ;
+ float y = Float.parseFloat(atomline[3]) ;
// calculate screen bounds for the numbers that can fit
numwidth = Integer.parseInt(atomline[4]);
@@ -72,14 +73,36 @@ public Numberbox(PdDroidPatchView app) {
}
public void draw(Canvas canvas) {
+ paint.setColor(Color.BLACK);
canvas.drawLine(dRect.left + 1, dRect.top, dRect.right - 5, dRect.top, paint);
canvas.drawLine(dRect.left + 1, dRect.bottom, dRect.right, dRect.bottom, paint);
canvas.drawLine(dRect.left, dRect.top + 1, dRect.left, dRect.bottom, paint);
canvas.drawLine(dRect.right, dRect.top + 5, dRect.right, dRect.bottom, paint);
canvas.drawLine(dRect.right - 5, dRect.top, dRect.right, dRect.top + 5, paint);
+ drawLabel(canvas);
}
- public void touch(MotionEvent event) {
+ public boolean touchdown(int pid, float x,float y) {
+ if (dRect.contains(x, y)) {
+ down = true;
+ pid0 = pid;
+ return true;
+ }
+ return false;
+ }
+
+ public boolean touchup(int pid, float x,float y) {
+ if (pid == pid0) {
+ parent.app.launchDialog(this, PdDroidParty.DIALOG_NUMBERBOX);
+ down = false;
+ pid0 = -1;
+ return true;
+ }
+ return false;
+ }
+
+
+ public void touch_(MotionEvent event) {
int action = event.getAction() & MotionEvent.ACTION_MASK;
int pid, index;
@@ -168,5 +191,13 @@ public void receiveFloat(float v) {
}
sendFloat(val);
}
+
+ public void receiveMessage(String symbol, Object... args) {
+ if(widgetreceiveSymbol(symbol,args)) return;
+ if (args.length > 0 && args[0].getClass().equals(Float.class)) {
+ receiveFloat((Float)args[0]);
+ }
+ }
+
}
diff --git a/src/cx/mccormick/pddroidparty/Numberbox2.java b/src/cx/mccormick/pddroidparty/Numberbox2.java
index 1efe79d..bfd3ef4 100644
--- a/src/cx/mccormick/pddroidparty/Numberbox2.java
+++ b/src/cx/mccormick/pddroidparty/Numberbox2.java
@@ -21,8 +21,8 @@ public class Numberbox2 extends Numberbox {
public Numberbox2(PdDroidPatchView app, String[] atomline) {
super(app);
- float x = Float.parseFloat(atomline[2]) / parent.patchwidth * screenwidth;
- float y = Float.parseFloat(atomline[3]) / parent.patchheight * screenheight;
+ float x = Float.parseFloat(atomline[2]) ;
+ float y = Float.parseFloat(atomline[3]) ;
Rect tRect = new Rect();
// calculate screen bounds for the numbers that can fit
@@ -45,7 +45,7 @@ public Numberbox2(PdDroidPatchView app, String[] atomline) {
dRect.left -= 3;
dRect.right += 3;
- float h = Float.parseFloat(atomline[6]) / parent.patchheight * screenheight;
+ float h = Float.parseFloat(atomline[6]) ;
float diff = h - dRect.height();
if (diff > 0) {
dRect.bottom += diff / 2;
@@ -58,8 +58,8 @@ public Numberbox2(PdDroidPatchView app, String[] atomline) {
sendname = app.app.replaceDollarZero(atomline[11]);
receivename = atomline[12];
label = setLabel(atomline[13]);
- labelpos[0] = Float.parseFloat(atomline[14]) / parent.patchwidth * screenwidth;
- labelpos[1] = Float.parseFloat(atomline[15]) / parent.patchheight * screenheight;
+ labelpos[0] = Float.parseFloat(atomline[14]) ;
+ labelpos[1] = Float.parseFloat(atomline[15]) ;
// set the value to the init value if possible
setval(Float.parseFloat(atomline[21]), 0);
diff --git a/src/cx/mccormick/pddroidparty/Numberboxfixed.java b/src/cx/mccormick/pddroidparty/Numberboxfixed.java
index c4b248c..fd28254 100644
--- a/src/cx/mccormick/pddroidparty/Numberboxfixed.java
+++ b/src/cx/mccormick/pddroidparty/Numberboxfixed.java
@@ -21,10 +21,10 @@ public class Numberboxfixed extends Numberbox {
public Numberboxfixed(PdDroidPatchView app, String[] atomline) {
super(app);
- float x = Float.parseFloat(atomline[2]) / parent.patchwidth * screenwidth;
- float y = Float.parseFloat(atomline[3]) / parent.patchheight * screenheight;
- float w = Float.parseFloat(atomline[5]) / parent.patchwidth * screenwidth;
- float h = Float.parseFloat(atomline[6]) / parent.patchheight * screenheight;
+ float x = Float.parseFloat(atomline[2]) ;
+ float y = Float.parseFloat(atomline[3]) ;
+ float w = Float.parseFloat(atomline[5]) ;
+ float h = Float.parseFloat(atomline[6]) ;
fontsize = (int)(h * 0.75);
diff --git a/src/cx/mccormick/pddroidparty/PatchSelector.java b/src/cx/mccormick/pddroidparty/PatchSelector.java
index 35c7d9a..0efa7c0 100644
--- a/src/cx/mccormick/pddroidparty/PatchSelector.java
+++ b/src/cx/mccormick/pddroidparty/PatchSelector.java
@@ -119,7 +119,7 @@ public void run() {
launchDroidParty(bakedpatch);
finish();
} else {
- List list = IoUtils.find(new File("/sdcard"), ".*droidparty_main\\.pd$");
+ List list = IoUtils.find(new File("/sdcard/PdDroidParty"), ".*droidparty_main\\.pd$");
for (File f: list) {
String[] parts = f.getParent().split("/");
// exclude generic patch directories found in apps based on PdDroidParty
diff --git a/src/cx/mccormick/pddroidparty/PdDroidParty.java b/src/cx/mccormick/pddroidparty/PdDroidParty.java
index bc65f44..0a0ef69 100644
--- a/src/cx/mccormick/pddroidparty/PdDroidParty.java
+++ b/src/cx/mccormick/pddroidparty/PdDroidParty.java
@@ -53,7 +53,7 @@ public class PdDroidParty extends Activity {
public static final String PATCH = "PATCH";
private static final String PD_CLIENT = "PdDroidParty";
private static final String TAG = "PdDroidParty";
- private static final int SAMPLE_RATE = 22050;
+ private static final int SAMPLE_RATE = 44100;
public static final int DIALOG_NUMBERBOX = 1;
public static final int DIALOG_SAVE = 2;
public static final int DIALOG_LOAD = 3;
diff --git a/src/cx/mccormick/pddroidparty/PdDroidPatchView.java b/src/cx/mccormick/pddroidparty/PdDroidPatchView.java
index 19d65a4..cc32605 100644
--- a/src/cx/mccormick/pddroidparty/PdDroidPatchView.java
+++ b/src/cx/mccormick/pddroidparty/PdDroidPatchView.java
@@ -21,6 +21,12 @@ public class PdDroidPatchView extends View implements OnTouchListener {
Paint paint = new Paint();
public int patchwidth;
public int patchheight;
+ //view port :
+ public int viewX=0;
+ public int viewY=0;
+ public int viewW=1;
+ public int viewH=1;
+
public int fontsize;
ArrayList widgets = new ArrayList();
public PdDroidParty app;
@@ -32,7 +38,7 @@ public PdDroidPatchView(Context context, PdDroidParty parent) {
super(context);
app = parent;
-
+
setFocusable(true);
setFocusableInTouchMode(true);
@@ -76,22 +82,66 @@ public void onDraw(Canvas canvas) {
}
// draw all widgets
if (widgets != null) {
+ canvas.save();
+ canvas.scale(getWidth()/(float)viewW,getHeight()/(float)viewH);
+ canvas.translate(-viewX ,-viewY );
for (Widget widget: widgets) {
widget.draw(canvas);
}
+ canvas.restore();
}
}
+ public float PointerX(float x){
+ return (x*((float)viewW)/getWidth()+viewX);
+ }
+
+ public float PointerY(float y){
+ return (y*((float)viewH)/getHeight()+viewY);
+ }
+
public boolean onTouch(View view, MotionEvent event) {
- // if(event.getAction() != MotionEvent.ACTION_DOWN)
- // return super.onTouchEvent(event);
+ int index,pid,action;
+ float x,y;
+
if (widgets != null) {
- for (Widget widget: widgets) {
- widget.touch(event);
+ action = event.getActionMasked();
+ switch(action) {
+ case MotionEvent.ACTION_DOWN:
+ case MotionEvent.ACTION_POINTER_DOWN:
+ index = event.getActionIndex();
+ pid = event.getPointerId(index);
+ x = PointerX(event.getX(index));
+ y = PointerY(event.getY(index));
+ for (Widget widget: widgets) {
+ if( widget.touchdown(pid,x,y)) break;
+ }
+ break;
+ case MotionEvent.ACTION_UP:
+ case MotionEvent.ACTION_POINTER_UP:
+ index = event.getActionIndex();
+ pid = event.getPointerId(index);
+ x = PointerX(event.getX(index));
+ y = PointerY(event.getY(index));
+ for (Widget widget: widgets) {
+ if( widget.touchup(pid,x,y)) break;
+ }
+ break;
+ case MotionEvent.ACTION_MOVE:
+ int pointerCount = event.getPointerCount();
+ for (int p = 0; p < pointerCount; p++) {
+ pid = event.getPointerId(p);
+ x = PointerX(event.getX(p));
+ y = PointerY(event.getY(p));
+ for (Widget widget: widgets) {
+ if( widget.touchmove(pid,x,y)) break;
+ }
+ }
+ break;
+ default:
}
}
invalidate();
- //Log.d(TAG, "touch: " + event.getX() + " " + event.getY());
return true;
}
@@ -127,8 +177,8 @@ public void buildUI(PdParser p, ArrayList atomlines) {
}*/
level += 1;
if (level == 1) {
- patchwidth = Integer.parseInt(line[4]);
- patchheight = Integer.parseInt(line[5]);
+ viewW = patchwidth = Integer.parseInt(line[4]);
+ viewH = patchheight = Integer.parseInt(line[5]);
fontsize = Integer.parseInt(line[6]);
}
} else if (line[1].equals("restore")) {
diff --git a/src/cx/mccormick/pddroidparty/Slider.java b/src/cx/mccormick/pddroidparty/Slider.java
index 1ab778c..d22c74c 100644
--- a/src/cx/mccormick/pddroidparty/Slider.java
+++ b/src/cx/mccormick/pddroidparty/Slider.java
@@ -5,10 +5,13 @@
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;
+import android.annotation.TargetApi;
import android.graphics.Canvas;
+import android.graphics.Color;
import android.graphics.RectF;
import android.graphics.Paint;
import android.view.MotionEvent;
+import android.os.Build;
import android.util.Log;
public class Slider extends Widget {
@@ -17,6 +20,9 @@ public class Slider extends Widget {
float min, max;
int log;
+ int pid0=-1; // pointer id,
+ float x0,y0,val0 ; // position of pointer, and value when pointer down.
+
boolean orientation_horizontal = true;
boolean down = false;
@@ -30,10 +36,10 @@ public Slider(PdDroidPatchView app, String[] atomline, boolean horizontal) {
orientation_horizontal = horizontal;
- float x = Float.parseFloat(atomline[2]) / parent.patchwidth * screenwidth;
- float y = Float.parseFloat(atomline[3]) / parent.patchheight * screenheight;
- float w = Float.parseFloat(atomline[5]) / parent.patchwidth * screenwidth;
- float h = Float.parseFloat(atomline[6]) / parent.patchheight * screenheight;
+ float x = Float.parseFloat(atomline[2]) ;
+ float y = Float.parseFloat(atomline[3]) ;
+ float w = Float.parseFloat(atomline[5]) ;
+ float h = Float.parseFloat(atomline[6]) ;
min = Float.parseFloat(atomline[7]);
max = Float.parseFloat(atomline[8]);
@@ -42,9 +48,14 @@ public Slider(PdDroidPatchView app, String[] atomline, boolean horizontal) {
sendname = app.app.replaceDollarZero(atomline[11]);
receivename = atomline[12];
label = setLabel(atomline[13]);
- labelpos[0] = Float.parseFloat(atomline[14]) / parent.patchwidth * screenwidth;
- labelpos[1] = Float.parseFloat(atomline[15]) / parent.patchheight * screenheight;
-
+ labelpos[0] = Float.parseFloat(atomline[14]) ;
+ labelpos[1] = Float.parseFloat(atomline[15]) ;
+ labelfont = Integer.parseInt(atomline[16]);
+ labelsize = (int)(Float.parseFloat(atomline[17]));
+ bgcolor = getColor(Integer.parseInt(atomline[18]));
+ fgcolor = getColor(Integer.parseInt(atomline[19]));
+ labelcolor = getColor(Integer.parseInt(atomline[20]));
+
setval((float)(Float.parseFloat(atomline[21]) * 0.01 * (max - min) / ((horizontal ? Float.parseFloat(atomline[5]) : Float.parseFloat(atomline[6])) - 1) + min), min);
// listen out for floats from Pd
@@ -96,15 +107,24 @@ public Slider(PdDroidPatchView app, String[] atomline, boolean horizontal) {
public void draw(Canvas canvas) {
if (drawPicture(canvas, svg)) {
- canvas.drawLine(dRect.left + 1, dRect.top, dRect.right, dRect.top, paint);
- canvas.drawLine(dRect.left + 1, dRect.bottom, dRect.right, dRect.bottom, paint);
- canvas.drawLine(dRect.left, dRect.top + 1, dRect.left, dRect.bottom, paint);
- canvas.drawLine(dRect.right, dRect.top + 1, dRect.right, dRect.bottom, paint);
+ paint.setColor(bgcolor);
+ paint.setStyle(Paint.Style.FILL);
+ canvas.drawRect(dRect,paint);
+
+ paint.setColor(Color.BLACK);
+ paint.setStrokeWidth(1);
+ canvas.drawLine(dRect.left /*+ 1*/, dRect.top, dRect.right, dRect.top, paint);
+ canvas.drawLine(dRect.left /*+ 1*/, dRect.bottom, dRect.right, dRect.bottom, paint);
+ canvas.drawLine(dRect.left, dRect.top /*+ 1*/, dRect.left, dRect.bottom, paint);
+ canvas.drawLine(dRect.right, dRect.top /*+ 1*/, dRect.right, dRect.bottom, paint);
+ paint.setColor(fgcolor);
+ paint.setStrokeWidth(3);
if (orientation_horizontal) {
- canvas.drawLine(Math.round(dRect.left + ((val - min) / (max - min)) * dRect.width()), Math.round(dRect.top + 2), Math.round(dRect.left + ((val - min) / (max - min)) * dRect.width()), Math.round(dRect.bottom - 2), paint);
+ canvas.drawLine(Math.round(dRect.left + ((val - min) / (max - min)) * dRect.width()), Math.round(dRect.top /*+ 2*/), Math.round(dRect.left + ((val - min) / (max - min)) * dRect.width()), Math.round(dRect.bottom /*- 2*/), paint);
} else {
- canvas.drawLine(Math.round(dRect.left + 2), Math.round(dRect.bottom - ((val - min) / (max - min)) * dRect.height()), Math.round(dRect.right - 2), Math.round(dRect.bottom - ((val - min) / (max - min)) * dRect.height()), paint);
+ canvas.drawLine(Math.round(dRect.left /*+ 2*/), Math.round(dRect.bottom - ((val - min) / (max - min)) * dRect.height()), Math.round(dRect.right /*- 2*/), Math.round(dRect.bottom - ((val - min) / (max - min)) * dRect.height()), paint);
}
+
drawLabel(canvas);
} else if (slider != null) {
if (orientation_horizontal) {
@@ -115,6 +135,7 @@ public void draw(Canvas canvas) {
drawPicture(canvas, slider, sRect);
}
}
+
public void slider_setval(float v) {
val = Math.min(max, Math.max(min, v));
@@ -134,76 +155,46 @@ public float get_vertical_val(float y) {
return (((dRect.height() - (y - dRect.top)) / dRect.height()) * (max - min) + min);
}
+ public boolean touchdown(int pid,float x,float y)
+ {
+ if (dRect.contains(x, y)) {
+ val0=val;
+ x0=x;
+ y0=y;
+ pid0=pid;
+ return true;
+ }
+ return false;
+ }
- public void touch(MotionEvent event) {
-
- int action = event.getAction() & MotionEvent.ACTION_MASK;
- int pid, index;
- float ex;
- float ey;
- switch (action) {
- case MotionEvent.ACTION_DOWN:
- ex = event.getX();
- ey = event.getY();
- if (dRect.contains(ex, ey)) {
-
- if (orientation_horizontal) {
- val = get_horizontal_val(ex);
- } else {
- val = get_vertical_val(ey);
- }
- // clamp the value
- slider_setval(val);
- // send the result to Pd
- send("" + val);
- }
- break;
- case MotionEvent.ACTION_POINTER_DOWN:
- pid = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
- index = event.findPointerIndex(pid);
- Log.d("SliderBefore", index+"");
- index=(index==-1)?1:index;
- Log.d("SliderAfter", index+"");
- ex = event.getX(index);
- ey = event.getY(index);
- if (dRect.contains(ex, ey)) {
-
- if (orientation_horizontal) {
- val = get_horizontal_val(ex);
- } else {
- val = get_vertical_val(ey);
- }
- // clamp the value
- slider_setval(val);
- // send the result to Pd
- send("" + val);
-
- }
- break;
- case MotionEvent.ACTION_MOVE:
- for (int i = 0; i < event.getPointerCount(); i++) {
- ex = event.getX(i);
- ey = event.getY(i);
- if (dRect.contains(ex, ey)) {
-
- if (orientation_horizontal) {
- val = get_horizontal_val(ex);
- } else {
- val = get_vertical_val(ey);
- }
- // clamp the value
- slider_setval(val);
- // send the result to Pd
- send("" + val);
+ public boolean touchup(int pid,float x,float y)
+ {
+ if(pid0 == pid) {
+ pid0 = -1;
+ //return true;
+ }
+ return false;
+ }
- }
+ public boolean touchmove(int pid,float x,float y)
+ {
+ if(pid0 == pid) {
+ if (orientation_horizontal) {
+ val = val0 + get_horizontal_val(x) - get_horizontal_val(x0);
+ } else {
+ val = val0 + get_vertical_val(y) - get_vertical_val(y0);
}
- break;
-
+ // clamp the value
+ slider_setval(val);
+ // send the result to Pd
+ send("" + val);
+ return true;
}
+ return false;
}
public void receiveMessage(String symbol, Object... args) {
+ if(widgetreceiveSymbol(symbol,args)) return;
if (args.length > 0 && args[0].getClass().equals(Float.class)) {
receiveFloat((Float)args[0]);
}
diff --git a/src/cx/mccormick/pddroidparty/Taplist.java b/src/cx/mccormick/pddroidparty/Taplist.java
index 45e17ec..ad66929 100644
--- a/src/cx/mccormick/pddroidparty/Taplist.java
+++ b/src/cx/mccormick/pddroidparty/Taplist.java
@@ -24,18 +24,15 @@ public class Taplist extends Widget {
SVGRenderer off = null;
boolean down = false;
-
+ int pid0 = -1; //pointer id when down
+
public Taplist(PdDroidPatchView app, String[] atomline) {
super(app);
- float x = Float.parseFloat(atomline[2]) / parent.patchwidth
- * screenwidth;
- float y = Float.parseFloat(atomline[3]) / parent.patchheight
- * screenheight;
- float w = Float.parseFloat(atomline[5]) / parent.patchwidth
- * screenwidth;
- float h = Float.parseFloat(atomline[6]) / parent.patchheight
- * screenheight;
+ float x = Float.parseFloat(atomline[2]) ;
+ float y = Float.parseFloat(atomline[3]) ;
+ float w = Float.parseFloat(atomline[5]) ;
+ float h = Float.parseFloat(atomline[6]) ;
fontsize = (int) (h * 0.75);
@@ -93,68 +90,26 @@ private void doSend() {
PdBase.sendFloat(sendname + "/idx", val);
}
- public void touch(MotionEvent event) {
-
- int action = event.getAction() & MotionEvent.ACTION_MASK;
- int pid, index;
- float ex;
- float ey;
- switch (action) {
- case MotionEvent.ACTION_DOWN:
- ex = event.getX();
- ey = event.getY();
- if (dRect.contains(ex, ey)) {
- val = (val + 1) % atoms.size();
- doSend();
- down = true;
-
- }
- break;
- case MotionEvent.ACTION_POINTER_DOWN:
- pid = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
- index = event.findPointerIndex(pid);
- Log.d("dwnTapBefore", index + "");
- index = (index == -1) ? 1 : index;
- Log.d("dwnTapAfter", index + "");
- ex = event.getX(index);
- ey = event.getY(index);
- if (dRect.contains(ex, ey)) {
-
- val = (val + 1) % atoms.size();
- doSend();
- down = true;
- }
- break;
-
- case MotionEvent.ACTION_UP:
- if (down) {
- ex = event.getX();
- ey = event.getY();
- if (dRect.contains(ex, ey)) {
-
- down = false;
- }
- }
- break;
-
- case MotionEvent.ACTION_POINTER_UP:
- if (down) {
- pid = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
- index = event.findPointerIndex(pid);
- Log.d("upTapBefore", index + "");
- index = (index == -1) ? 1 : index;
- Log.d("upTapAfter", index + "");
- ex = event.getX(index);
- ey = event.getY(index);
- if (dRect.contains(ex, ey)) {
-
- down = false;
- }
- }
- break;
+ public boolean touchdown(int pid, float x,float y) {
+ if (dRect.contains(x, y)) {
+ val = (val + 1) % atoms.size();
+ doSend();
+ down = true;
+ pid0 = pid;
+ return true;
}
+ return false;
}
-
+
+ public boolean touchup(int pid, float x,float y) {
+ if (pid == pid0) {
+ down = false;
+ pid0 = -1;
+ return true;
+ }
+ return false;
+ }
+
public void receiveList(Object... args) {
if (args.length > 0 && args[0].getClass().equals(Float.class)) {
receiveFloat((Float) args[0]);
diff --git a/src/cx/mccormick/pddroidparty/Toggle.java b/src/cx/mccormick/pddroidparty/Toggle.java
index 77e87fa..b1dc7be 100644
--- a/src/cx/mccormick/pddroidparty/Toggle.java
+++ b/src/cx/mccormick/pddroidparty/Toggle.java
@@ -6,6 +6,7 @@
import java.nio.ShortBuffer;
import android.graphics.Canvas;
+import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Picture;
import android.graphics.RectF;
@@ -22,14 +23,10 @@ public class Toggle extends Widget {
public Toggle(PdDroidPatchView app, String[] atomline) {
super(app);
- float x = Float.parseFloat(atomline[2]) / parent.patchwidth
- * screenwidth;
- float y = Float.parseFloat(atomline[3]) / parent.patchheight
- * screenheight;
- float w = Float.parseFloat(atomline[5]) / parent.patchwidth
- * screenwidth;
- float h = Float.parseFloat(atomline[5]) / parent.patchheight
- * screenheight;
+ float x = Float.parseFloat(atomline[2]) ;
+ float y = Float.parseFloat(atomline[3]) ;
+ float w = Float.parseFloat(atomline[5]) ;
+ float h = Float.parseFloat(atomline[5]) ;
toggleval = Float.parseFloat(atomline[18]);
@@ -37,10 +34,13 @@ public Toggle(PdDroidPatchView app, String[] atomline) {
sendname = app.app.replaceDollarZero(atomline[7]);
receivename = atomline[8];
label = setLabel(atomline[9]);
- labelpos[0] = Float.parseFloat(atomline[10]) / parent.patchwidth
- * screenwidth;
- labelpos[1] = Float.parseFloat(atomline[11]) / parent.patchheight
- * screenheight;
+ labelpos[0] = Float.parseFloat(atomline[10]) ;
+ labelpos[1] = Float.parseFloat(atomline[11]) ;
+ labelfont = Integer.parseInt(atomline[12]);
+ labelsize = (int)(Float.parseFloat(atomline[13]) );
+ bgcolor = getColor(Integer.parseInt(atomline[14]));
+ fgcolor = getColor(Integer.parseInt(atomline[15]));
+ labelcolor = getColor(Integer.parseInt(atomline[16]));
setval(Float.parseFloat(atomline[17]), 0);
@@ -61,22 +61,24 @@ public Toggle(PdDroidPatchView app, String[] atomline) {
public void draw(Canvas canvas) {
if (drawPicture(canvas, off)) {
- canvas.drawLine(dRect.left + 1, dRect.top, dRect.right, dRect.top,
- paint);
- canvas.drawLine(dRect.left + 1, dRect.bottom, dRect.right,
- dRect.bottom, paint);
- canvas.drawLine(dRect.left, dRect.top + 1, dRect.left,
- dRect.bottom, paint);
- canvas.drawLine(dRect.right, dRect.top + 1, dRect.right,
- dRect.bottom, paint);
+ paint.setColor(bgcolor);
+ paint.setStyle(Paint.Style.FILL);
+ canvas.drawRect(dRect,paint);
+
+ paint.setColor(Color.BLACK);
+ paint.setStrokeWidth(1);
+ canvas.drawLine(dRect.left /*+ 1*/, dRect.top, dRect.right, dRect.top, paint);
+ canvas.drawLine(dRect.left /*+ 1*/, dRect.bottom, dRect.right, dRect.bottom, paint);
+ canvas.drawLine(dRect.left, dRect.top /*+ 1*/, dRect.left, dRect.bottom, paint);
+ canvas.drawLine(dRect.right, dRect.top /*+ 1*/, dRect.right, dRect.bottom, paint);
}
-
+
if (val != 0) {
if (drawPicture(canvas, on)) {
- canvas.drawLine(dRect.left + 2, dRect.top + 2, dRect.right - 2,
- dRect.bottom - 2, paint);
- canvas.drawLine(dRect.left + 2, dRect.bottom - 2,
- dRect.right - 2, dRect.top + 2, paint);
+ paint.setColor(fgcolor);
+ paint.setStrokeWidth(3);
+ canvas.drawLine(dRect.left + 2, dRect.top + 2, dRect.right - 2, dRect.bottom - 2, paint);
+ canvas.drawLine(dRect.left + 2, dRect.bottom - 2, dRect.right - 2, dRect.top + 2, paint);
}
}
drawLabel(canvas);
@@ -96,44 +98,20 @@ public void initval() {
}
}
- public void touch(MotionEvent event) {
-
- int action = event.getAction() & MotionEvent.ACTION_MASK;
- int pid, index;
- float ex;
- float ey;
-
- switch (action) {
- case MotionEvent.ACTION_DOWN:
- ex = event.getX();
- ey = event.getY();
- if (dRect.contains(ex, ey)) {
- toggle();
- sendFloat(val);
- }
- break;
- case MotionEvent.ACTION_POINTER_DOWN:
- pid = event.getAction() >> MotionEvent.ACTION_POINTER_ID_SHIFT;
- index = event.findPointerIndex(pid);
- Log.d("ToggleBefore", index + "");
- index = (index == -1) ? 1 : index;
- Log.d("ToggleAfter", index + "");
- Log.d("Test", index + "");
- if (dRect.contains(event.getX(index), event.getY(index))) {
- Log.d(TAG, "touch:togglee" + event.getX(index));
- toggle();
- sendFloat(val);
- }
-
- break;
-
+ public boolean touchdown(int pid,float x,float y)
+ {
+ if (dRect.contains(x, y)) {
+ toggle();
+ sendFloat(val);
+ return true;
}
-
+ return false;
}
- public void receiveMessage(String dest, Object... args) {
+ public void receiveMessage(String symbol, Object... args) {
// set message sets value without sending
- if (dest.equals("set") && args.length > 0) {
+ if(widgetreceiveSymbol(symbol,args)) return;
+ if (symbol.equals("set") && args.length > 0) {
val = (Float) args[0];
}
}
diff --git a/src/cx/mccormick/pddroidparty/Touch.java b/src/cx/mccormick/pddroidparty/Touch.java
index 3060a83..2ab9cb6 100644
--- a/src/cx/mccormick/pddroidparty/Touch.java
+++ b/src/cx/mccormick/pddroidparty/Touch.java
@@ -19,14 +19,15 @@ public class Touch extends Widget {
SVGRenderer off = null;
boolean down = false;
+ int pid0 = -1; //pointer id when down
public Touch(PdDroidPatchView app, String[] atomline) {
super(app);
- float x = Float.parseFloat(atomline[2]) / parent.patchwidth * screenwidth;
- float y = Float.parseFloat(atomline[3]) / parent.patchheight * screenheight;
- float w = Float.parseFloat(atomline[5]) / parent.patchwidth * screenwidth;
- float h = Float.parseFloat(atomline[6]) / parent.patchheight * screenheight;
+ float x = Float.parseFloat(atomline[2]) ;
+ float y = Float.parseFloat(atomline[3]) ;
+ float w = Float.parseFloat(atomline[5]) ;
+ float h = Float.parseFloat(atomline[6]) ;
// graphics setup
dRect = new RectF(Math.round(x), Math.round(y), Math.round(x + w), Math.round(y + h));
@@ -53,7 +54,40 @@ public void draw(Canvas canvas) {
}
}
- public void touch(MotionEvent event) {
+ public boolean touchdown(int pid, float x, float y)
+ {
+ if (dRect.contains(x, y)) {
+
+ send(((x - dRect.left) / dRect.width()) + " "
+ + ((y - dRect.top) / dRect.height()));
+ down = true;
+ pid0 = pid;
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean touchup(int pid, float x, float y)
+ {
+ if(pid == pid0) {
+ down = false;
+ pid0 = -1;
+ }
+ return false;
+ }
+
+ public boolean touchmove(int pid, float x, float y)
+ {
+ if(pid == pid0) {
+ send(((x - dRect.left) / dRect.width()) + " "
+ + ((y - dRect.top) / dRect.height()));
+ return true;
+ }
+ return false;
+ }
+
+ public void touch_(MotionEvent event) {
int action = event.getAction() & MotionEvent.ACTION_MASK;
int pid, index;
diff --git a/src/cx/mccormick/pddroidparty/Widget.java b/src/cx/mccormick/pddroidparty/Widget.java
index 7d351a1..2635124 100644
--- a/src/cx/mccormick/pddroidparty/Widget.java
+++ b/src/cx/mccormick/pddroidparty/Widget.java
@@ -20,13 +20,13 @@
public class Widget {
private static final String TAG = "Widget";
- int screenwidth=0;
- int screenheight=0;
- int WRAPWIDTH = 360;
+ //int screenwidth=0;
+ //int screenheight=0;
+ //int WRAPWIDTH = 360;
RectF dRect = new RectF();
- Paint paint = new Paint();
+ Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
float val = 0;
int init = 0;
@@ -34,17 +34,33 @@ public class Widget {
String receivename = null;
String label = null;
float[] labelpos = new float[2];
- PdDroidPatchView parent = null;
-
+ int labelfont=0;
+ int labelsize=14;
Typeface font = Typeface.create("Courier", Typeface.BOLD);
int fontsize = 0;
- StaticLayout textLayout = null;
+ //StaticLayout textLayout = null;
+
+ int bgcolor=0xFFFFFFFF, fgcolor=0xFF000000,labelcolor=0xFF000000;
+
+ PdDroidPatchView parent = null;
+
+ private static int IEM_GUI_MAX_COLOR = 30;
+ private static int iemgui_color_hex[] = {
+ 16579836, 10526880, 4210752, 16572640, 16572608,
+ 16579784, 14220504, 14220540, 14476540, 16308476,
+ 14737632, 8158332, 2105376, 16525352, 16559172,
+ 15263784, 1370132, 2684148, 3952892, 16003312,
+ 12369084, 6316128, 0, 9177096, 5779456,
+ 7874580, 2641940, 17488, 5256, 5767248
+ };
+
public Widget(PdDroidPatchView app) {
parent = app;
- screenwidth = parent.getWidth();
- screenheight = parent.getHeight();
- fontsize = (int)((float)parent.fontsize / parent.patchheight * screenheight) - 2;
+ //screenwidth = parent.getWidth();
+ //screenheight = parent.getHeight();
+ //fontsize = (int)((float)parent.fontsize / parent.patchheight * screenheight) - 2;
+ fontsize = (int)((float)parent.fontsize);
File f = null;
@@ -67,6 +83,46 @@ public Widget(PdDroidPatchView app) {
paint.setTextSize(fontsize);
}
+ public static int getColor(int iemcolor) {
+ //Log.e("ORIGINAL COLOR", "" + iemcolor);
+ int color = 0;
+
+ if(iemcolor < 0)
+ {
+ iemcolor = -1 - iemcolor;
+ color = ((iemcolor & 0x3f000) << 6 )
+ + ((iemcolor & 0xfc0) << 4 )
+ + ((iemcolor & 0x3f) << 2 )
+ + 0xFF000000;
+ //(iemcolor & 0xffffff) + 0xFF000000;
+ }
+ else
+ {
+ color = (iemgui_color_hex[iemcolor%IEM_GUI_MAX_COLOR] & 0xFFFFFF) | 0xFF000000;
+ }
+
+ //Log.e("COLOR", "" + color);
+ return color;
+ }
+
+ public static int getColor24(int iemcolor) {
+ //Log.e("ORIGINAL COLOR", "" + iemcolor);
+ int color = 0;
+
+ if(iemcolor < 0)
+ {
+ iemcolor = -1 - iemcolor;
+ color = (iemcolor & 0xffffff) + 0xFF000000;
+ }
+ else
+ {
+ color = (iemgui_color_hex[iemcolor%IEM_GUI_MAX_COLOR] & 0xFFFFFF) | 0xFF000000;
+ }
+
+ //Log.e("COLOR", "" + color);
+ return color;
+ }
+
public void setTextParametersFromSVG(SVGRenderer svg) {
if (svg != null) {
if (svg.getAttribute("textFont") != null) {
@@ -130,7 +186,7 @@ public float getval() {
}
/* Draw the label */
- public void drawLabel(Canvas canvas) {
+ /*public void drawLabel(Canvas canvas) {
if (label != null) {
if (textLayout == null) {
textLayout = new StaticLayout((CharSequence)label, new TextPaint(paint), (int)((float)WRAPWIDTH / parent.patchwidth * screenwidth), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0, false);
@@ -140,8 +196,20 @@ public void drawLabel(Canvas canvas) {
textLayout.draw(canvas);
canvas.restore();
}
+ }*/
+
+ public void drawLabel(Canvas canvas) {
+ if (label != null) {
+ paint.setStrokeWidth(0);
+ paint.setColor(labelcolor);
+ paint.setTextSize(labelsize);
+ canvas.drawText(label, dRect.left + labelpos[0], dRect.top + labelpos[1] + labelsize / 3, paint);
+ paint.setTextSize(fontsize);
+ }
+ paint.setColor(Color.BLACK);
}
+
/* Set the label (checking for special null values) */
public String setLabel(String incoming) {
if (incoming.equals("-") || incoming.equals("empty")) {
@@ -164,6 +232,71 @@ public void draw(Canvas canvas) {
*/
public void touch(MotionEvent event) {
}
+
+ /**
+ * Generic touch methods : pid=pointer id
+ **/
+ public boolean touchdown(int pid, float x, float y) {
+ return false;
+ }
+ public boolean touchmove(int pid, float x, float y) {
+ return false;
+ }
+ public boolean touchup(int pid, float x, float y) {
+ return false;
+ }
+
+
+ public boolean widgetreceiveSymbol(String symbol, Object... args) {
+ if( symbol.equals("label")
+ && args.length > 0 && args[0].getClass().equals(String.class)
+ ) {
+ label = setLabel((String)args[0]);
+ return true;
+ }
+
+ if( symbol.equals("label_pos")
+ && args.length > 1 && args[0].getClass().equals(Float.class)
+ && args[1].getClass().equals(Float.class)
+ ) {
+ labelpos[0]= (Float)args[0] ;
+ labelpos[1]= (Float)args[1] ;
+ return true;
+ }
+
+ if( symbol.equals("pos")
+ && args.length > 1 && args[0].getClass().equals(Float.class)
+ && args[1].getClass().equals(Float.class)
+ ) {
+ dRect.offsetTo((Float)args[0] , (Float)args[1]);
+ return true;
+ }
+
+ if( symbol.equals("color")
+ && args.length > 2 && args[0].getClass().equals(Float.class)
+ && args[1].getClass().equals(Float.class)
+ && args[2].getClass().equals(Float.class)
+ ) {
+ bgcolor = getColor24((int)(float)(Float)args[0]);
+ fgcolor = getColor24((int)(float)(Float)args[1]);
+ labelcolor = getColor24((int)(float)(Float)args[2]);
+ //Log.e(TAG, "msg bgcolor = "+(int)(float)(Float)args[0]+", bgcolor = "+bgcolor);
+ return true;
+ }
+
+ if( symbol.equals("label_font")
+ && args.length > 1 && args[0].getClass().equals(Float.class)
+ && args[1].getClass().equals(Float.class)
+ ) {
+ labelfont = (Integer)args[0];
+ labelsize = (Integer)args[1];
+ return true;
+ }
+
+ return false;
+
+ }
+
public void receiveList(Object... args) {
Log.e(TAG, "dropped list");
diff --git a/src/cx/mccormick/pddroidparty/Wordbutton.java b/src/cx/mccormick/pddroidparty/Wordbutton.java
index 41c2f49..bc89a57 100644
--- a/src/cx/mccormick/pddroidparty/Wordbutton.java
+++ b/src/cx/mccormick/pddroidparty/Wordbutton.java
@@ -24,20 +24,17 @@ public class Wordbutton extends Bang {
SVGRenderer off = null;
boolean down = false;
-
+ int pid0 = -1; //pointer id when down
+
String spacereplace = null;
public Wordbutton(PdDroidPatchView app, String[] atomline) {
super(app);
- float x = Float.parseFloat(atomline[2]) / parent.patchwidth
- * screenwidth;
- float y = Float.parseFloat(atomline[3]) / parent.patchheight
- * screenheight;
- float w = Float.parseFloat(atomline[5]) / parent.patchwidth
- * screenwidth;
- float h = Float.parseFloat(atomline[6]) / parent.patchheight
- * screenheight;
+ float x = Float.parseFloat(atomline[2]) ;
+ float y = Float.parseFloat(atomline[3]) ;
+ float w = Float.parseFloat(atomline[5]) ;
+ float h = Float.parseFloat(atomline[6]) ;
sendname = "wordbutton-" + app.app.replaceDollarZero(atomline[7]);
label = setLabel(atomline[7]);
@@ -80,7 +77,30 @@ public void draw(Canvas canvas) {
(int) (dRect.top + dRect.height() * 0.75), paint);
}
- public void touch(MotionEvent event) {
+ public boolean touchdown(int pid,float x,float y)
+ {
+ if (dRect.contains(x, y)) {
+ down = true;
+ pid0 = pid;
+ return true;
+ }
+ return false;
+ }
+
+ public boolean touchup(int pid,float x,float y)
+ {
+ if (pid == pid0) {
+ if (dRect.contains(x, y)) {
+ PdBase.sendBang(sendname);
+ }
+ down = false;
+ pid0 = -1;
+ //return true;
+ }
+ return false;
+ }
+
+ public void touch_(MotionEvent event) {
int action = event.getAction() & MotionEvent.ACTION_MASK;
int pid, index;