aboutsummaryrefslogtreecommitdiff
path: root/pd
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2005-07-02 05:03:06 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2005-07-02 05:03:06 +0000
commit8c3faa20d73622d75573f1458218b36ee5613a7e (patch)
tree76987130124f0b57b25e2a0777dbd2e4d4fe00f8 /pd
parentc59464f01c8151baaa42dcb8641d73c58dc79fda (diff)
new graph-on-parent behavior - no more of the stretching behavior. Existing
patches should behave compatibly, but new ones will work differently (much much better.) svn path=/trunk/; revision=3283
Diffstat (limited to 'pd')
-rw-r--r--pd/doc/3.audio.examples/output~.pd46
-rw-r--r--pd/doc/7.stuff/audio-playpen/1_DSP_INTRO.pd84
-rw-r--r--pd/doc/7.stuff/audio-playpen/2_sampler.pd33
-rw-r--r--pd/doc/7.stuff/audio-playpen/3_filter_and_ring.pd64
-rw-r--r--pd/doc/7.stuff/audio-playpen/4_more_filters.pd55
-rw-r--r--pd/doc/7.stuff/audio-playpen/5_delay.pd55
-rw-r--r--pd/doc/7.stuff/audio-playpen/6_flanger.pd71
-rw-r--r--pd/doc/7.stuff/audio-playpen/README.txt9
-rw-r--r--pd/doc/7.stuff/audio-playpen/qdelay.pd34
-rw-r--r--pd/doc/7.stuff/audio-playpen/qgain.pd14
-rw-r--r--pd/doc/7.stuff/audio-playpen/qring.pd14
-rw-r--r--pd/doc/7.stuff/audio-playpen/qsample.pd114
-rw-r--r--pd/doc/7.stuff/audio-playpen/qslew.pd8
-rw-r--r--pd/doc/7.stuff/audio-playpen/qvd.pd32
-rw-r--r--pd/src/g_canvas.c42
-rw-r--r--pd/src/g_canvas.h4
-rw-r--r--pd/src/g_editor.c127
-rw-r--r--pd/src/g_graph.c122
-rw-r--r--pd/src/g_readwrite.c14
-rw-r--r--pd/src/g_rtext.c17
-rw-r--r--pd/src/g_template.c3
-rw-r--r--pd/src/g_text.c7
-rw-r--r--pd/src/makefile.nt8
-rw-r--r--pd/src/notes.txt19
-rw-r--r--pd/src/u_main.tk326
25 files changed, 428 insertions, 894 deletions
diff --git a/pd/doc/3.audio.examples/output~.pd b/pd/doc/3.audio.examples/output~.pd
index 07fb59f8..81ad3b7f 100644
--- a/pd/doc/3.audio.examples/output~.pd
+++ b/pd/doc/3.audio.examples/output~.pd
@@ -1,41 +1,41 @@
-#N canvas 0 0 757 616 12;
-#X obj 516 522 t b;
-#X obj 516 469 f;
-#X obj 516 547 f;
-#X msg 630 546 0;
-#X obj 516 499 moses 1;
-#X obj 630 518 t b f;
-#X obj 596 479 moses 1;
+#N canvas 0 0 615 578 12;
+#X obj 353 490 t b;
+#X obj 353 437 f;
+#X obj 353 515 f;
+#X msg 467 514 0;
+#X obj 353 467 moses 1;
+#X obj 467 486 t b f;
+#X obj 433 447 moses 1;
#X obj 29 97 dbtorms;
#X obj 85 170 inlet~;
-#X msg 278 300 \; pd dsp 1;
+#X msg 299 310 \; pd dsp 1;
#X obj 29 170 line~;
#X obj 64 242 *~;
#X obj 64 272 dac~;
#X obj 29 127 pack 0 50;
#X text 121 146 audio in;
-#X text 301 496 test if less than 1 -->;
-#X text 267 523 if true convert to bang -->;
+#X text 138 464 test if less than 1 -->;
+#X text 104 491 if true convert to bang -->;
#X text 100 96 <-- convert from dB to linear units;
-#X floatatom 278 221 3 0 100 0 dB - -;
-#X obj 516 449 bng 15 250 50 0 empty empty mute -38 7 0 12 -262144
+#X floatatom 323 219 3 0 100 0 dB - -;
+#X obj 350 240 bng 15 250 50 0 empty empty mute -38 7 0 12 -262144
-1 -1;
#X text 118 126 <-- make a ramp to avoid clicks or zipper noise;
#X obj 148 170 inlet~;
#X obj 154 241 *~;
-#X text 502 399 MUTE logic:;
-#X obj 278 193 r \$0-master-lvl;
-#X obj 516 573 s \$0-master-lvl;
-#X obj 293 247 s \$0-master-out;
+#X text 373 378 MUTE logic:;
+#X obj 323 174 r \$0-master-lvl;
+#X obj 353 541 s \$0-master-lvl;
+#X obj 323 279 s \$0-master-out;
#X obj 29 71 r \$0-master-out;
-#X obj 596 450 r \$0-master-out;
+#X obj 433 418 r \$0-master-out;
#X text 60 10 Level control abstraction \, used in many of the Pd example
patches. The "level" and "mute" controls show up on the parent \, calling
patch.;
-#X text 229 549 previous nonzero master-lvl -->;
-#X text 301 453 recall previous;
-#X text 301 471 value of master-lvl -->;
-#X text 16 310 automatically start DSP -->;
+#X text 66 517 previous nonzero master-lvl -->;
+#X text 138 421 recall previous;
+#X text 138 439 value of master-lvl -->;
+#X text 39 319 automatically start DSP -->;
#X obj 85 192 hip~ 3;
#X obj 147 192 hip~ 3;
#X connect 0 0 2 0;
@@ -63,4 +63,4 @@ patch.;
#X connect 28 0 6 0;
#X connect 34 0 11 1;
#X connect 35 0 22 1;
-#X coords 0 0 1 1 65 55 1;
+#X coords 0 0 1 1 65 55 1 300 200;
diff --git a/pd/doc/7.stuff/audio-playpen/1_DSP_INTRO.pd b/pd/doc/7.stuff/audio-playpen/1_DSP_INTRO.pd
deleted file mode 100644
index 17ee73c6..00000000
--- a/pd/doc/7.stuff/audio-playpen/1_DSP_INTRO.pd
+++ /dev/null
@@ -1,84 +0,0 @@
-#N canvas 10 10 551 484 10;
-#X text 41 3 ABSTRACTIONS IN THIS DIRECTORY;
-#X text 117 22 sampler;
-#X text 117 36 gain control;
-#X text 117 50 ring mod;
-#X text 21 142 OTHER OBJECTS YOU WILL NEED;
-#X obj 21 171 dac~;
-#X text 54 173 output;
-#X text 21 156 audio:;
-#X obj 21 188 adc~;
-#X text 54 187 input;
-#X obj 21 205 +~;
-#X obj 45 205 -~;
-#X obj 21 222 *~;
-#X obj 45 222 /~;
-#X text 71 215 arithmetic;
-#X obj 28 280 bp~;
-#X text 56 278 bandpass filter;
-#X text 58 293 bandpass with "audio";
-#X text 55 301 control for second input;
-#X obj 28 297 vcf~;
-#X obj 261 37 metro;
-#X text 294 40 repeated message;
-#X obj 253 157 float;
-#X text 292 156 store numbers;
-#X obj 252 398 random;
-#X text 298 397 random;
-#X obj 253 174 pack;
-#X text 292 170 combines numbers;
-#X obj 253 191 unpack;
-#X text 297 196 opposite;
-#X obj 253 208 trigger;
-#X text 302 215 control order of execution;
-#X text 261 22 TIME;
-#X obj 261 54 del;
-#X text 294 54 wait then bang;
-#X obj 261 71 timer;
-#X text 294 68 measure time intervals;
-#X text 278 142 GLUE;
-#X obj 253 225 select;
-#X text 302 229 test values;
-#X obj 253 259 moses;
-#X text 302 257 parting the waters;
-#X obj 253 242 route;
-#X text 302 243 heavy select;
-#X obj 252 415 line;
-#X text 291 412 control ramp generator;
-#X obj 23 324 delwrite~;
-#X obj 23 341 delread~;
-#X obj 23 359 vd~;
-#X text 84 323 declare a delay line;
-#X text 83 340 read a delay line;
-#X text 282 303 UNIT CONVERSION;
-#X obj 258 324 mtof;
-#X obj 287 324 ftom;
-#X obj 258 341 dbtorms;
-#X obj 305 341 rmstodb;
-#X obj 258 358 dbtopow;
-#X obj 305 358 powtodb;
-#X text 357 323 frequency to MIDI;
-#X text 355 339 db to amplitude;
-#X text 356 356 db to power;
-#N canvas 0 0 600 400 /SUBPATCH/ 0;
-#X restore 64 405 pd;
-#X text 100 404 subpatch;
-#X obj 64 422 inlet;
-#X obj 100 419 inlet~;
-#X obj 64 439 outlet;
-#X obj 105 436 outlet~;
-#X obj 28 246 hip~;
-#X text 55 245 high pass filter;
-#X obj 28 263 lop~;
-#X text 55 263 low pass filter;
-#X text 257 101 ARITHMETIC;
-#X text 117 64 control-to-signal;
-#X text 116 94 delay loop;
-#X text 116 108 variable delay loop;
-#X obj 41 36 qgain;
-#X obj 41 53 qring;
-#X obj 41 70 qslew;
-#X obj 41 89 qdelay;
-#X obj 41 18 qsample ...;
-#X obj 42 108 qvd ...;
-#X text 50 359 variable time delay read;
diff --git a/pd/doc/7.stuff/audio-playpen/2_sampler.pd b/pd/doc/7.stuff/audio-playpen/2_sampler.pd
deleted file mode 100644
index 327e4116..00000000
--- a/pd/doc/7.stuff/audio-playpen/2_sampler.pd
+++ /dev/null
@@ -1,33 +0,0 @@
-#N canvas 8 0 476 273 10;
-#X floatatom 108 154;
-#X floatatom 282 62;
-#X floatatom 244 62;
-#X obj 81 127 qsample ---------------;
-#X msg 113 60 record;
-#X msg 158 60 play;
-#X text 184 42 transpose;
-#X floatatom 197 60;
-#X text 242 47 start;
-#X text 280 48 length;
-#X obj 81 203 dac~;
-#X obj 81 176 qgain;
-#X text 139 155 loudnesss;
-#X text 225 151 TO USE ME:;
-#X text 243 167 turn DSP on (ctrl + "/");
-#X text 244 192 turn loudness to 80 (say);
-#X text 244 221 hit "play" button.;
-#X obj 81 59 adc~;
-#X msg 227 128 read;
-#X text 242 179 read a sample;
-#X text 244 207 set length to 2000;
-#X connect 0 0 11 1;
-#X connect 1 0 3 5;
-#X connect 2 0 3 4;
-#X connect 3 0 11 0;
-#X connect 4 0 3 1;
-#X connect 5 0 3 2;
-#X connect 7 0 3 3;
-#X connect 11 0 10 0;
-#X connect 11 0 10 1;
-#X connect 17 0 3 0;
-#X connect 18 0 3 6;
diff --git a/pd/doc/7.stuff/audio-playpen/3_filter_and_ring.pd b/pd/doc/7.stuff/audio-playpen/3_filter_and_ring.pd
deleted file mode 100644
index a994cc85..00000000
--- a/pd/doc/7.stuff/audio-playpen/3_filter_and_ring.pd
+++ /dev/null
@@ -1,64 +0,0 @@
-#N canvas 4 21 576 397 10;
-#X floatatom 221 271;
-#X floatatom 209 250;
-#X floatatom 78 269;
-#X floatatom 68 250;
-#X floatatom 104 217;
-#X floatatom 169 68;
-#X floatatom 83 314;
-#X floatatom 298 149;
-#X floatatom 297 83;
-#X obj 61 181 qsample ---------------;
-#X msg 101 114 record;
-#X msg 169 113 play;
-#X text 339 63 transpose;
-#X floatatom 297 62;
-#X text 339 81 start;
-#X text 339 152 length;
-#X obj 58 371 dac~;
-#X obj 58 334 qgain;
-#X text 324 189 read a file;
-#X text 335 241 TO USE ME:;
-#X text 371 272 turn DSP on (ctrl + "/");
-#X text 370 297 read the sample;
-#X text 373 322 turn loudness to 80 (say);
-#X text 373 346 hit "play" button.;
-#X obj 61 113 adc~;
-#X obj 169 90 metro 50;
-#X floatatom 212 67;
-#X obj 63 213 qring;
-#X obj 297 112 loadbang;
-#X msg 298 131 2000;
-#X obj 59 289 vcf~;
-#X obj 200 296 vcf~;
-#X text 118 315 amp 1;
-#X floatatom 224 317;
-#X obj 199 337 qgain;
-#X text 259 318 amp 2;
-#X msg 292 190 read;
-#X connect 0 0 31 2;
-#X connect 1 0 31 1;
-#X connect 2 0 30 2;
-#X connect 3 0 30 1;
-#X connect 4 0 27 1;
-#X connect 5 0 25 0;
-#X connect 6 0 17 1;
-#X connect 7 0 9 5;
-#X connect 8 0 9 4;
-#X connect 9 0 27 0;
-#X connect 10 0 9 1;
-#X connect 11 0 9 2;
-#X connect 13 0 9 3;
-#X connect 17 0 16 0;
-#X connect 24 0 9 0;
-#X connect 25 0 11 0;
-#X connect 26 0 25 1;
-#X connect 27 0 30 0;
-#X connect 27 0 31 0;
-#X connect 28 0 29 0;
-#X connect 29 0 7 0;
-#X connect 30 0 17 0;
-#X connect 31 0 34 0;
-#X connect 33 0 34 1;
-#X connect 34 0 16 1;
-#X connect 36 0 9 6;
diff --git a/pd/doc/7.stuff/audio-playpen/4_more_filters.pd b/pd/doc/7.stuff/audio-playpen/4_more_filters.pd
deleted file mode 100644
index aaa81f34..00000000
--- a/pd/doc/7.stuff/audio-playpen/4_more_filters.pd
+++ /dev/null
@@ -1,55 +0,0 @@
-#N canvas 55 0 373 335 10;
-#X floatatom 163 156;
-#X floatatom 220 175;
-#X floatatom 98 154;
-#X floatatom 118 221;
-#X floatatom 151 33;
-#X floatatom 134 266;
-#X floatatom 234 99;
-#X floatatom 235 75;
-#X obj 81 127 qsample ---------------;
-#X msg 111 93 record;
-#X msg 156 93 play;
-#X text 279 49 transpose;
-#X floatatom 234 51;
-#X text 279 73 start;
-#X text 280 97 length;
-#X obj 92 292 dac~;
-#X obj 94 264 qgain;
-#X text 163 269 loudnesss;
-#X obj 81 93 adc~;
-#X obj 153 60 metro 50;
-#X floatatom 194 29;
-#X obj 93 243 qring;
-#X obj 77 212 vcf~;
-#X obj 282 23 random 2000;
-#X msg 257 135 read;
-#X obj 98 174 qring;
-#X floatatom 130 155;
-#X obj 163 175 sig~;
-#X obj 252 241 env~ 16384;
-#X floatatom 258 270;
-#X connect 0 0 27 0;
-#X connect 1 0 22 2;
-#X connect 2 0 25 0;
-#X connect 3 0 21 1;
-#X connect 4 0 19 0;
-#X connect 5 0 16 1;
-#X connect 6 0 8 5;
-#X connect 7 0 8 4;
-#X connect 8 0 22 0;
-#X connect 9 0 8 1;
-#X connect 10 0 8 2;
-#X connect 12 0 8 3;
-#X connect 16 0 15 0;
-#X connect 16 0 15 1;
-#X connect 18 0 8 0;
-#X connect 19 0 10 0;
-#X connect 20 0 19 1;
-#X connect 21 0 16 0;
-#X connect 22 0 21 0;
-#X connect 24 0 8 6;
-#X connect 25 0 22 1;
-#X connect 26 0 25 1;
-#X connect 27 0 22 1;
-#X connect 28 0 29 0;
diff --git a/pd/doc/7.stuff/audio-playpen/5_delay.pd b/pd/doc/7.stuff/audio-playpen/5_delay.pd
deleted file mode 100644
index 63006b8d..00000000
--- a/pd/doc/7.stuff/audio-playpen/5_delay.pd
+++ /dev/null
@@ -1,55 +0,0 @@
-#N canvas 34 147 523 368 10;
-#X floatatom 58 216;
-#X obj 7 235 qgain;
-#X floatatom 150 176;
-#X floatatom 146 151;
-#X floatatom 151 33;
-#X floatatom 148 220;
-#X floatatom 234 99;
-#X floatatom 235 75;
-#X obj 84 123 qsample ---------------;
-#X msg 111 93 record;
-#X msg 156 93 play;
-#X text 279 49 transpose;
-#X floatatom 234 51;
-#X text 279 73 start;
-#X text 280 97 length;
-#X obj 23 272 dac~;
-#X obj 97 239 qgain;
-#X text 261 220 TO USE ME:;
-#X text 279 236 turn DSP on (ctrl + "/");
-#X text 279 248 read the sample;
-#X text 280 261 turn loudness to 80 (say);
-#X text 280 273 hit "play" button.;
-#X obj 81 93 adc~;
-#X obj 153 60 metro 50;
-#X floatatom 203 29;
-#X obj 96 199 qdelay;
-#X text 47 188 direct;
-#X text 49 201 gain;
-#X text 179 220 delay gain;
-#X text 173 152 delay time;
-#X text 177 176 recirculation (0-100);
-#X text 255 294 the direct signal comes out;
-#X text 255 304 channel 1 and the delays out;
-#X text 255 315 channel 2;
-#X msg 257 135 read;
-#X connect 0 0 1 1;
-#X connect 1 0 15 0;
-#X connect 2 0 25 2;
-#X connect 3 0 25 1;
-#X connect 4 0 23 0;
-#X connect 5 0 16 1;
-#X connect 6 0 8 5;
-#X connect 7 0 8 4;
-#X connect 8 0 1 0;
-#X connect 8 0 25 0;
-#X connect 9 0 8 1;
-#X connect 10 0 8 2;
-#X connect 12 0 8 3;
-#X connect 16 0 15 1;
-#X connect 22 0 8 0;
-#X connect 23 0 10 0;
-#X connect 24 0 23 1;
-#X connect 25 0 16 0;
-#X connect 34 0 8 6;
diff --git a/pd/doc/7.stuff/audio-playpen/6_flanger.pd b/pd/doc/7.stuff/audio-playpen/6_flanger.pd
deleted file mode 100644
index cf927c32..00000000
--- a/pd/doc/7.stuff/audio-playpen/6_flanger.pd
+++ /dev/null
@@ -1,71 +0,0 @@
-#N canvas 42 0 531 395 10;
-#X floatatom 301 189;
-#X floatatom 237 154;
-#X floatatom 59 241;
-#X obj 8 260 qgain;
-#X floatatom 147 223;
-#X floatatom 118 148;
-#X floatatom 151 33;
-#X floatatom 149 244;
-#X floatatom 273 87;
-#X floatatom 330 85;
-#X obj 84 123 qsample ---------------;
-#X msg 111 93 record;
-#X msg 156 93 play;
-#X text 192 72 transpose;
-#X floatatom 193 86;
-#X text 374 83 start;
-#X text 268 73 length;
-#X obj 24 297 dac~;
-#X obj 98 263 qgain;
-#X obj 81 93 adc~;
-#X obj 153 60 metro 50;
-#X floatatom 202 41;
-#X text 48 213 direct;
-#X text 50 225 gain;
-#X text 180 244 delay gain;
-#X text 156 147 delay time;
-#X text 173 223 recirculation (0-100);
-#X obj 97 223 qvd;
-#X obj 116 170 qslew;
-#X obj 237 190 qring;
-#X obj 237 172 sig~;
-#X text 266 154 osc depth;
-#X text 327 188 osc speed;
-#X obj 202 23 r metro-time;
-#X msg 385 191 \; metro-on 0 \; metro-time 100;
-#X obj 152 7 r metro-on;
-#X msg 384 234 \; metro-on 1 \; metro-time 50;
-#X obj 329 37 r start-time;
-#X obj 330 61 line;
-#X msg 374 280 \; start-time 0;
-#X msg 288 317 \; start-time 0 \, 2000 10000;
-#X msg 289 131 read;
-#X connect 0 0 29 1;
-#X connect 1 0 30 0;
-#X connect 2 0 3 1;
-#X connect 3 0 17 0;
-#X connect 4 0 27 2;
-#X connect 5 0 28 0;
-#X connect 6 0 20 0;
-#X connect 7 0 18 1;
-#X connect 8 0 10 5;
-#X connect 9 0 10 4;
-#X connect 10 0 3 0;
-#X connect 10 0 27 0;
-#X connect 11 0 10 1;
-#X connect 12 0 10 2;
-#X connect 14 0 10 3;
-#X connect 18 0 17 0;
-#X connect 19 0 10 0;
-#X connect 20 0 12 0;
-#X connect 21 0 20 1;
-#X connect 27 0 18 0;
-#X connect 28 0 27 1;
-#X connect 29 0 27 1;
-#X connect 30 0 29 0;
-#X connect 33 0 21 0;
-#X connect 35 0 6 0;
-#X connect 37 0 38 0;
-#X connect 38 0 9 0;
-#X connect 41 0 10 6;
diff --git a/pd/doc/7.stuff/audio-playpen/README.txt b/pd/doc/7.stuff/audio-playpen/README.txt
deleted file mode 100644
index e6a94951..00000000
--- a/pd/doc/7.stuff/audio-playpen/README.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-The "audio playpen" is intended as a collection of analog-style modules
-for people who just want to patch stuff together without worrying much
-about how Pd works. A fair amount of work would be needed to make this into
-a more usable package than it is now. At the moment it's unclear what
-should be the relationship between this collection, the "examples," and
-the "tools".
-
-At the very least there should be oscillators and envelope generators here,
-and audio-rate db/rms/dB, mtof, ftom conversion...
diff --git a/pd/doc/7.stuff/audio-playpen/qdelay.pd b/pd/doc/7.stuff/audio-playpen/qdelay.pd
deleted file mode 100644
index c22edc3a..00000000
--- a/pd/doc/7.stuff/audio-playpen/qdelay.pd
+++ /dev/null
@@ -1,34 +0,0 @@
-#N canvas 94 85 429 238 10;
-#X floatatom 252 62;
-#X obj 252 153 line~;
-#X obj 252 134 pack 0 100;
-#X obj 232 180 *~;
-#X obj 252 44 inlet;
-#X obj 106 52 inlet;
-#X obj 26 78 inlet~;
-#X floatatom 106 70;
-#X obj 22 176 outlet~;
-#X text 20 61 audio in;
-#X text 22 193 audio out;
-#X text 220 11 recirculation;
-#X text 92 23 delay time;
-#X obj 106 88 delread~ qdelay1;
-#X obj 120 210 delwrite~ qdelay1 2000;
-#X obj 252 116 * 0.01;
-#X text 228 27 (0-100);
-#X text 100 35 (msec);
-#X obj 252 80 max 0;
-#X obj 252 98 min 100;
-#X connect 0 0 18 0;
-#X connect 1 0 3 1;
-#X connect 2 0 1 0;
-#X connect 3 0 14 0;
-#X connect 4 0 0 0;
-#X connect 5 0 7 0;
-#X connect 6 0 14 0;
-#X connect 7 0 13 0;
-#X connect 13 0 3 0;
-#X connect 13 0 8 0;
-#X connect 15 0 2 0;
-#X connect 18 0 19 0;
-#X connect 19 0 15 0;
diff --git a/pd/doc/7.stuff/audio-playpen/qgain.pd b/pd/doc/7.stuff/audio-playpen/qgain.pd
deleted file mode 100644
index 20f228e8..00000000
--- a/pd/doc/7.stuff/audio-playpen/qgain.pd
+++ /dev/null
@@ -1,14 +0,0 @@
-#N canvas 236 128 179 191 10;
-#X obj 89 112 line~;
-#X obj 89 93 pack 0 100;
-#X obj 89 55 inlet;
-#X obj 89 74 dbtorms;
-#X obj 30 67 inlet~;
-#X obj 30 118 outlet~;
-#X obj 30 86 *~;
-#X connect 0 0 6 1;
-#X connect 1 0 0 0;
-#X connect 2 0 3 0;
-#X connect 3 0 1 0;
-#X connect 4 0 6 0;
-#X connect 6 0 5 0;
diff --git a/pd/doc/7.stuff/audio-playpen/qring.pd b/pd/doc/7.stuff/audio-playpen/qring.pd
deleted file mode 100644
index 25b99c2e..00000000
--- a/pd/doc/7.stuff/audio-playpen/qring.pd
+++ /dev/null
@@ -1,14 +0,0 @@
-#N canvas 163 135 216 211 10;
-#X obj 112 91 inlet;
-#X obj 54 93 inlet~;
-#X obj 55 117 *~;
-#X obj 54 142 outlet~;
-#X text 54 76 audio in;
-#X text 49 173 audio out;
-#X text 117 59 modulation;
-#X text 117 72 frequency;
-#X obj 112 112 osc~;
-#X connect 0 0 8 0;
-#X connect 1 0 2 0;
-#X connect 2 0 3 0;
-#X connect 8 0 2 1;
diff --git a/pd/doc/7.stuff/audio-playpen/qsample.pd b/pd/doc/7.stuff/audio-playpen/qsample.pd
deleted file mode 100644
index bc4ebb2f..00000000
--- a/pd/doc/7.stuff/audio-playpen/qsample.pd
+++ /dev/null
@@ -1,114 +0,0 @@
-#N canvas 0 9 731 358 10;
-#X obj 483 52 inlet;
-#X obj 386 66 inlet;
-#X obj 314 78 inlet;
-#X obj 223 42 inlet;
-#X obj 152 63 inlet;
-#X obj 75 38 inlet;
-#X obj 19 48 inlet~;
-#X text 11 33 audio in;
-#X msg 250 268 0 5;
-#X floatatom 299 217;
-#X floatatom 386 87;
-#X floatatom 223 60;
-#X msg 152 81 bang;
-#X text 152 47 button;
-#X obj 39 354 outlet~;
-#X graph sample1-graph 0 -1 88200 1 404 352 704 202;
-#X array sample1 88200 float;
-#X pop;
-#X obj 19 91 tabwrite~ sample1;
-#X msg 75 56 bang;
-#X text 74 12 record;
-#X text 75 22 button;
-#X text 157 33 play;
-#X obj 39 299 tabread4~ sample1;
-#X obj 39 317 *~;
-#X obj 174 313 line~;
-#X obj 39 335 hip~ 5;
-#X obj 199 235 del 5;
-#X msg 169 266 0 5;
-#X msg 199 266 1 5;
-#X floatatom 316 116;
-#X text 211 22 transpose;
-#X obj 223 78 mtof;
-#X text 386 50 length;
-#X obj 223 96 t b f;
-#X obj 223 114 8.1758;
-#X obj 223 132 /;
-#X obj 299 143 t b f;
-#X obj 250 250 del 2000;
-#X obj 299 179 * 1980;
-#X obj 299 161 f 1;
-#X text 304 52 beginning;
-#X text 314 62 point;
-#X obj 39 281 line~;
-#X obj 73 205 f;
-#X obj 22 243 + 88200;
-#X obj 22 261 pack;
-#X obj 110 261 * 2000;
-#X text 482 26 read;
-#X text 483 38 file;
-#X obj 73 223 t f f b;
-#X floatatom 110 280;
-#X obj 110 243 f 1;
-#X obj 89 182 * 44.1;
-#X obj 483 91 openpanel;
-#X msg 483 73 bang;
-#X obj 386 110 min 1980;
-#X obj 315 96 max 1;
-#X obj 484 133 soundfiler;
-#X msg 485 114 read \$1 sample1;
-#X obj 299 198 max 6;
-#X connect 0 0 53 0;
-#X connect 1 0 10 0;
-#X connect 2 0 55 0;
-#X connect 3 0 11 0;
-#X connect 4 0 12 0;
-#X connect 5 0 17 0;
-#X connect 6 0 16 0;
-#X connect 8 0 23 0;
-#X connect 9 0 36 1;
-#X connect 10 0 54 0;
-#X connect 11 0 30 0;
-#X connect 12 0 26 0;
-#X connect 12 0 25 0;
-#X connect 12 0 36 0;
-#X connect 17 0 16 0;
-#X connect 21 0 22 0;
-#X connect 22 0 24 0;
-#X connect 23 0 22 1;
-#X connect 24 0 14 0;
-#X connect 25 0 27 0;
-#X connect 25 0 42 0;
-#X connect 26 0 23 0;
-#X connect 27 0 23 0;
-#X connect 28 0 51 0;
-#X connect 30 0 32 0;
-#X connect 32 0 33 0;
-#X connect 32 1 34 1;
-#X connect 33 0 34 0;
-#X connect 34 0 38 0;
-#X connect 34 0 50 1;
-#X connect 35 0 38 0;
-#X connect 35 1 37 1;
-#X connect 36 0 8 0;
-#X connect 37 0 58 0;
-#X connect 38 0 37 0;
-#X connect 41 0 21 0;
-#X connect 42 0 48 0;
-#X connect 43 0 44 0;
-#X connect 44 0 41 0;
-#X connect 45 0 44 1;
-#X connect 45 0 49 0;
-#X connect 48 0 43 0;
-#X connect 48 1 41 0;
-#X connect 48 2 50 0;
-#X connect 50 0 45 0;
-#X connect 51 0 42 1;
-#X connect 52 0 57 0;
-#X connect 53 0 52 0;
-#X connect 54 0 35 0;
-#X connect 55 0 28 0;
-#X connect 57 0 56 0;
-#X connect 58 0 9 0;
diff --git a/pd/doc/7.stuff/audio-playpen/qslew.pd b/pd/doc/7.stuff/audio-playpen/qslew.pd
deleted file mode 100644
index d56bb90f..00000000
--- a/pd/doc/7.stuff/audio-playpen/qslew.pd
+++ /dev/null
@@ -1,8 +0,0 @@
-#N canvas 236 128 164 154 10;
-#X obj 47 79 line~;
-#X obj 47 58 pack 0 100;
-#X obj 47 38 inlet;
-#X obj 47 100 outlet~;
-#X connect 0 0 3 0;
-#X connect 1 0 0 0;
-#X connect 2 0 1 0;
diff --git a/pd/doc/7.stuff/audio-playpen/qvd.pd b/pd/doc/7.stuff/audio-playpen/qvd.pd
deleted file mode 100644
index 8a03d9c3..00000000
--- a/pd/doc/7.stuff/audio-playpen/qvd.pd
+++ /dev/null
@@ -1,32 +0,0 @@
-#N canvas 78 104 411 254 10;
-#X obj 246 47 inlet;
-#X floatatom 246 66;
-#X obj 245 162 line~;
-#X obj 245 143 pack 0 100;
-#X obj 232 180 *~;
-#X obj 104 66 inlet~;
-#X obj 22 175 outlet~;
-#X text 19 60 audio in;
-#X text 18 193 audio out;
-#X text 213 7 recirculation;
-#X text 92 25 delay time;
-#X obj 246 125 * 0.01;
-#X text 212 23 (0-100);
-#X text 100 37 (msec);
-#X obj 105 94 vd~ qdel2;
-#X obj 120 210 delwrite~ qdel2 2000;
-#X obj 20 75 inlet~;
-#X obj 246 84 max 0;
-#X obj 246 104 min 100;
-#X connect 0 0 1 0;
-#X connect 1 0 17 0;
-#X connect 2 0 4 1;
-#X connect 3 0 2 0;
-#X connect 4 0 15 0;
-#X connect 5 0 14 0;
-#X connect 11 0 3 0;
-#X connect 14 0 4 0;
-#X connect 14 0 6 0;
-#X connect 16 0 15 0;
-#X connect 17 0 18 0;
-#X connect 18 0 11 0;
diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c
index 2607c1b2..ba72f8bc 100644
--- a/pd/src/g_canvas.c
+++ b/pd/src/g_canvas.c
@@ -14,6 +14,7 @@ to be different but are now unified except for some fossilized names.) */
#include <string.h>
#include "g_all_guis.h"
+ /* LATER consider adding font size to this struct (see glist_getfont()) */
struct _canvasenvironment
{
t_symbol *ce_dir; /* directory patch lives in */
@@ -401,6 +402,7 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv)
if (strcmp(x->gl_name->s_name, "Pd"))
pd_bind(&x->gl_pd, canvas_makebindsym(x->gl_name));
x->gl_loading = 1;
+ x->gl_goprect = 0; /* no GOP rectangle unless it's turned on later */
x->gl_willvis = vis;
x->gl_edit = !strncmp(x->gl_name->s_name, "Untitled", 8);
x->gl_font = sys_nearestfontsize(font);
@@ -408,7 +410,7 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv)
return(x);
}
-void canvas_setgraph(t_glist *x, int flag);
+void canvas_setgraph(t_glist *x, int flag, int nogoprect);
static void canvas_coords(t_glist *x, t_symbol *s, int argc, t_atom *argv)
{
@@ -418,7 +420,14 @@ static void canvas_coords(t_glist *x, t_symbol *s, int argc, t_atom *argv)
x->gl_y2 = atom_getfloatarg(3, argc, argv);
x->gl_pixwidth = atom_getintarg(4, argc, argv);
x->gl_pixheight = atom_getintarg(5, argc, argv);
- canvas_setgraph(x, atom_getintarg(6, argc, argv));
+ if (argc <= 7)
+ canvas_setgraph(x, atom_getintarg(6, argc, argv), 1);
+ else
+ {
+ x->gl_xmargin = atom_getintarg(7, argc, argv);
+ x->gl_ymargin = atom_getintarg(8, argc, argv);
+ canvas_setgraph(x, atom_getintarg(6, argc, argv), 0);
+ }
}
/* make a new glist and add it to this glist. It will appear as
@@ -480,8 +489,8 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym,
if (strcmp(x->gl_name->s_name, "Pd"))
pd_bind(&x->gl_pd, canvas_makebindsym(x->gl_name));
x->gl_owner = g;
- x->gl_stretch = 1;
x->gl_isgraph = 1;
+ x->gl_goprect = 0;
x->gl_obj.te_binbuf = binbuf_new();
binbuf_addv(x->gl_obj.te_binbuf, "s", gensym("graph"));
if (!menu)
@@ -589,6 +598,20 @@ void canvas_dirty(t_canvas *x, t_int n)
}
}
+void canvas_drawredrect(t_canvas *x, int doit)
+{
+ if (doit)
+ sys_vgui(".x%lx.c create line\
+ %d %d %d %d %d %d %d %d %d %d -fill #ff8080 -tags GOP\n",
+ glist_getcanvas(x),
+ x->gl_xmargin, x->gl_ymargin,
+ x->gl_xmargin + x->gl_pixwidth, x->gl_ymargin,
+ x->gl_xmargin + x->gl_pixwidth, x->gl_ymargin + x->gl_pixheight,
+ x->gl_xmargin, x->gl_ymargin + x->gl_pixheight,
+ x->gl_xmargin, x->gl_ymargin);
+ else sys_vgui(".x%lx.c delete GOP\n", glist_getcanvas(x));
+}
+
/* the window becomes "mapped" (visible and not miniaturized) or
"unmapped" (either miniaturized or just plain gone.) This should be
called from the GUI after the fact to "notify" us that we're mapped. */
@@ -612,6 +635,8 @@ void canvas_map(t_canvas *x, t_floatarg f)
gobj_select(sel->sel_what, x, 1);
x->gl_mapped = 1;
canvas_drawlines(x);
+ if (x->gl_isgraph && x->gl_goprect)
+ canvas_drawredrect(x, 1);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x);
}
}
@@ -621,11 +646,13 @@ void canvas_map(t_canvas *x, t_floatarg f)
{
/* just clear out the whole canvas... */
sys_vgui(".x%lx.c delete all\n", x);
+#if 0
/* alternatively, we could have erased them one by one...
for (y = x->gl_list; y; y = y->g_next)
gobj_vis(y, x, 0);
... but we should go through and erase the lines as well
if we do it that way. */
+#endif
x->gl_mapped = 0;
}
}
@@ -816,7 +843,10 @@ int glist_istoplevel(t_glist *x)
int glist_getfont(t_glist *x)
{
- return (glist_getcanvas(x)->gl_font);
+ while (!x->gl_env)
+ if (!(x = x->gl_owner))
+ bug("t_canvasenvironment");
+ return (x->gl_font);
}
void canvas_free(t_canvas *x)
@@ -1413,7 +1443,7 @@ extern void glist_scalar(t_glist *canvas, t_symbol *s, int argc, t_atom *argv);
void g_graph_setup(void);
void g_editor_setup(void);
void g_readwrite_setup(void);
-extern void graph_properties(t_gobj *z, t_glist *owner);
+extern void canvas_properties(t_gobj *z);
void g_canvas_setup(void)
{
@@ -1484,7 +1514,7 @@ void g_canvas_setup(void)
gensym("menu-open"), A_NULL);
class_addmethod(canvas_class, (t_method)canvas_map,
gensym("map"), A_FLOAT, A_NULL);
- class_setpropertiesfn(canvas_class, graph_properties);
+ class_setpropertiesfn(canvas_class, (t_propertiesfn)canvas_properties);
/* ---------------------- list handling ------------------------ */
class_addmethod(canvas_class, (t_method)glist_clear, gensym("clear"),
diff --git a/pd/src/g_canvas.h b/pd/src/g_canvas.h
index 188117bc..a2322822 100644
--- a/pd/src/g_canvas.h
+++ b/pd/src/g_canvas.h
@@ -158,6 +158,8 @@ struct _glist
int gl_screeny1;
int gl_screenx2;
int gl_screeny2;
+ int gl_xmargin; /* origin for GOP rectangle */
+ int gl_ymargin;
t_tick gl_xtick; /* ticks marking X values */
int gl_nxlabels; /* number of X coordinate labels */
t_symbol **gl_xlabel; /* ... an array to hold them */
@@ -178,7 +180,7 @@ struct _glist
unsigned int gl_willvis:1; /* make me visible after loading */
unsigned int gl_edit:1; /* edit mode */
unsigned int gl_isdeleting:1; /* we're inside glist_delete -- hack! */
- unsigned int gl_stretch:1; /* stretch contents on resize */
+ unsigned int gl_goprect:1; /* draw rectangle for graph-on-parent */
unsigned int gl_isgraph:1; /* show as graph on parent */
};
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 82e43acc..fbf0097a 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -64,7 +64,25 @@ void gobj_delete(t_gobj *x, t_glist *glist)
void gobj_vis(t_gobj *x, struct _glist *glist, int flag)
{
if (x->g_pd->c_wb && x->g_pd->c_wb->w_visfn)
+ {
+ if (!glist->gl_havewindow && glist->gl_isgraph && glist->gl_goprect &&
+ glist->gl_owner && (pd_class(&glist->gl_pd) != garray_class))
+ {
+ /* if we're graphing-on-parent and the object falls outside the
+ graph rectangle, don't draw it. */
+ int x1, y1, x2, y2, gx1, gy1, gx2, gy2, m;
+ gobj_getrect(&glist->gl_gobj, glist->gl_owner, &x1, &y1, &x2, &y2);
+ if (x1 > x2)
+ m = x1, x1 = x2, x2 = m;
+ if (y1 > y2)
+ m = y1, y1 = y2, x2 = m;
+ gobj_getrect(x, glist, &gx1, &gy1, &gx2, &gy2);
+ if (gx1 < x1 || gx1 > x2 || gx2 < x1 || gx2 > x2 ||
+ gy1 < y1 || gy1 > y2 || gy2 < y1 || gy2 > y2)
+ return;
+ }
(*x->g_pd->c_wb->w_visfn)(x, glist, flag);
+ }
}
int gobj_click(t_gobj *x, struct _glist *glist,
@@ -787,20 +805,9 @@ static void canvas_rightclick(t_canvas *x, int xpos, int ypos, t_gobj *y)
x, xpos, ypos, canprop, canopen);
}
- /* tell GUI to create a properties dialog on the canvas. We tell
- the user the negative of the "pixel" y scale to make it appear to grow
- naturally upward, whereas pixels grow downward. */
-static void canvas_properties(t_glist *x)
-{
- char graphbuf[200];
- sprintf(graphbuf, "pdtk_canvas_dialog %%s %g %g %g %g \n",
- glist_dpixtodx(x, 1), -glist_dpixtody(x, 1),
- (float)glist_isgraph(x), (float)x->gl_stretch);
- gfxstub_new(&x->gl_pd, x, graphbuf);
-}
-
-
-void canvas_setgraph(t_glist *x, int flag)
+ /* set a canvas up as a graph-on-parent. Set reasonable defaults for
+ any missing paramters and redraw things if necessary. */
+void canvas_setgraph(t_glist *x, int flag, int nogoprect)
{
if (!flag && glist_isgraph(x))
{
@@ -824,8 +831,18 @@ void canvas_setgraph(t_glist *x, int flag)
if (x->gl_owner && !x->gl_loading && glist_isvisible(x->gl_owner))
gobj_vis(&x->gl_gobj, x->gl_owner, 0);
x->gl_isgraph = 1;
- /* if (x->gl_owner && glist_isvisible(x->gl_owner))
- canvas_vis(x, 1); */
+ if (!nogoprect && !x->gl_goprect)
+ {
+ t_gobj *g;
+ for (g = x->gl_list; g; g = g->g_next)
+ if (pd_checkobject(&g->g_pd))
+ {
+ x->gl_goprect = 1;
+ break;
+ }
+ }
+ if (glist_isvisible(x) && x->gl_goprect)
+ glist_redraw(x);
if (x->gl_loading && x->gl_owner && glist_isvisible(x->gl_owner))
canvas_create_editor(x, 1);
if (x->gl_owner && !x->gl_loading && glist_isvisible(x->gl_owner))
@@ -836,20 +853,76 @@ void canvas_setgraph(t_glist *x, int flag)
}
}
+ /* tell GUI to create a properties dialog on the canvas. We tell
+ the user the negative of the "pixel" y scale to make it appear to grow
+ naturally upward, whereas pixels grow downward. */
+void canvas_properties(t_glist *x)
+{
+ char graphbuf[200];
+ if (glist_isgraph(x) != 0)
+ sprintf(graphbuf,
+ "pdtk_canvas_dialog %%s %g %g %d %g %g %g %g %d %d %d %d\n",
+ 0., 0.,
+ 1,
+ x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2,
+ (int)x->gl_pixwidth, (int)x->gl_pixheight,
+ (int)x->gl_xmargin, (int)x->gl_ymargin);
+ else sprintf(graphbuf,
+ "pdtk_canvas_dialog %%s %g %g %d %g %g %g %g %d %d %d %d\n",
+ glist_dpixtodx(x, 1), -glist_dpixtody(x, 1),
+ 0,
+ 0., -1., 1., 1.,
+ (int)x->gl_pixwidth, (int)x->gl_pixheight,
+ (int)x->gl_xmargin, (int)x->gl_ymargin);
+ gfxstub_new(&x->gl_pd, x, graphbuf);
+}
+
/* called from the gui when "OK" is selected on the canvas properties
dialog. Again we negate "y" scale. */
-static void canvas_donecanvasdialog(t_glist *x, t_floatarg xperpix,
- t_floatarg yperpix, t_floatarg fgraphme)
+static void canvas_donecanvasdialog(t_glist *x,
+ t_symbol *s, int argc, t_atom *argv)
{
- int graphme = (fgraphme != 0), redraw = 0;
+
+
+ float xperpix, yperpix, x1, y1, x2, y2, xpix, ypix, xmargin, ymargin;
+ int graphme, redraw = 0;
+
+ xperpix = atom_getfloatarg(0, argc, argv);
+ yperpix = atom_getfloatarg(1, argc, argv);
+ graphme = (atom_getfloatarg(2, argc, argv) != 0);
+ x1 = atom_getfloatarg(3, argc, argv);
+ y1 = atom_getfloatarg(4, argc, argv);
+ x2 = atom_getfloatarg(5, argc, argv);
+ y2 = atom_getfloatarg(6, argc, argv);
+ xpix = atom_getfloatarg(7, argc, argv);
+ ypix = atom_getfloatarg(8, argc, argv);
+ xmargin = atom_getfloatarg(9, argc, argv);
+ ymargin = atom_getfloatarg(10, argc, argv);
+
+ x->gl_pixwidth = xpix;
+ x->gl_pixheight = ypix;
+ x->gl_xmargin = xmargin;
+ x->gl_ymargin = ymargin;
+
yperpix = -yperpix;
if (xperpix == 0)
xperpix = 1;
if (yperpix == 0)
yperpix = 1;
- canvas_setgraph(x, graphme);
- if (!x->gl_isgraph && (xperpix != glist_dpixtodx(x, 1)))
+
+ if (graphme)
{
+ if (x1 != x2)
+ x->gl_x1 = x1, x->gl_x2 = x2;
+ else x->gl_x1 = 0, x->gl_x2 = 1;
+ if (y1 != y2)
+ x->gl_y1 = y1, x->gl_y2 = y2;
+ else x->gl_y1 = 0, x->gl_y2 = 1;
+ }
+ else
+ {
+ if (xperpix != glist_dpixtodx(x, 1) || yperpix != glist_dpixtody(x, 1))
+ redraw = 1;
if (xperpix > 0)
{
x->gl_x1 = 0;
@@ -860,10 +933,6 @@ static void canvas_donecanvasdialog(t_glist *x, t_floatarg xperpix,
x->gl_x1 = -xperpix * (x->gl_screenx2 - x->gl_screenx1);
x->gl_x2 = x->gl_x1 + xperpix;
}
- redraw = 1;
- }
- if (!x->gl_isgraph && (yperpix != glist_dpixtody(x, 1)))
- {
if (yperpix > 0)
{
x->gl_y1 = 0;
@@ -874,10 +943,10 @@ static void canvas_donecanvasdialog(t_glist *x, t_floatarg xperpix,
x->gl_y1 = -yperpix * (x->gl_screeny2 - x->gl_screeny1);
x->gl_y2 = x->gl_y1 + yperpix;
}
- redraw = 1;
}
- if (redraw)
- canvas_redraw(x);
+ /* LATER avoid doing 2 redraws here (possibly one inside setgraph) */
+ canvas_setgraph(x, graphme, 0);
+ canvas_redraw(x);
}
/* called from the gui when a popup menu comes back with "properties,"
@@ -2316,7 +2385,7 @@ void g_editor_setup(void)
class_addmethod(canvas_class, (t_method)canvas_done_popup,
gensym("done-popup"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
class_addmethod(canvas_class, (t_method)canvas_donecanvasdialog,
- gensym("donecanvasdialog"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
+ gensym("donecanvasdialog"), A_GIMME, A_NULL);
class_addmethod(canvas_class, (t_method)glist_arraydialog,
gensym("arraydialog"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c
index 3b26d477..9dae5221 100644
--- a/pd/src/g_graph.c
+++ b/pd/src/g_graph.c
@@ -24,6 +24,8 @@ static void graph_getrect(t_gobj *z, t_glist *glist,
/* -------------------- maintaining the list -------------------- */
+void canvas_drawredrect(t_canvas *x, int doit);
+
void glist_add(t_glist *x, t_gobj *y)
{
t_object *ob;
@@ -37,6 +39,11 @@ void glist_add(t_glist *x, t_gobj *y)
}
if (x->gl_editor && (ob = pd_checkobject(&y->g_pd)))
rtext_new(x, ob);
+ if (x->gl_editor && x->gl_isgraph && !x->gl_goprect)
+ {
+ x->gl_goprect = 1;
+ canvas_drawredrect(x, 1);
+ }
if (glist_isvisible(x))
gobj_vis(y, x, 1);
if (class_isdrawcommand(y->g_pd))
@@ -593,12 +600,16 @@ float glist_dpixtody(t_glist *x, float dypix)
/* get the window location in pixels of a "text" object. The
object's x and y positions are in pixels when the glist they're
- in is toplevel. If it's not, we convert to pixels on the parent
- window. */
+ in is toplevel. Otherwise, if it's a new-style graph-on-parent
+ (so gl_goprect is set) we use the offset into the framing subrectangle
+ as an offset into the parent rectangle. Finally, it might be an old,
+ proportional-style GOP. In this case we do a coordinate transformation. */
int text_xpix(t_text *x, t_glist *glist)
{
if (glist->gl_havewindow || !glist->gl_isgraph)
return (x->te_xpix);
+ else if (glist->gl_goprect)
+ return (glist->gl_obj.te_xpix + x->te_xpix - glist->gl_xmargin);
else return (glist_xtopixels(glist,
glist->gl_x1 + (glist->gl_x2 - glist->gl_x1) *
x->te_xpix / (glist->gl_screenx2 - glist->gl_screenx1)));
@@ -608,6 +619,8 @@ int text_ypix(t_text *x, t_glist *glist)
{
if (glist->gl_havewindow || !glist->gl_isgraph)
return (x->te_ypix);
+ else if (glist->gl_goprect)
+ return (glist->gl_obj.te_ypix + x->te_ypix - glist->gl_ymargin);
else return (glist_ytopixels(glist,
glist->gl_y1 + (glist->gl_y2 - glist->gl_y1) *
x->te_ypix / (glist->gl_screeny2 - glist->gl_screeny1)));
@@ -638,6 +651,12 @@ void glist_redraw(t_glist *x)
sys_vgui(".x%lx.c coords l%lx %d %d %d %d\n",
glist_getcanvas(x), oc,
t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2);
+ canvas_drawredrect(x, 0);
+ if (x->gl_goprect)
+ {
+ post("draw it");
+ canvas_drawredrect(x, 1);
+ }
}
if (x->gl_owner && glist_isvisible(x->gl_owner))
{
@@ -838,26 +857,6 @@ static void graph_graphrect(t_gobj *z, t_glist *glist,
int x1 = text_xpix(&x->gl_obj, glist);
int y1 = text_ypix(&x->gl_obj, glist);
int x2, y2;
-#if 0 /* this used to adjust graph size when it was in another graph;
- now we just preserve the size. */
- /* same logic here as in text_xpix(): */
- if (glist->gl_havewindow)
- {
- x2 = x1 + x->gl_pixwidth;
- y2 = y1 + x->gl_pixheight;
- }
- else
- {
- x2 = glist_xtopixels(glist,
- glist->gl_x1 + (glist->gl_x2 - glist->gl_x1) *
- (x->gl_obj.te_xpix + x->gl_pixwidth) /
- (glist->gl_screenx2 - glist->gl_screenx1));
- y2 = glist_ytopixels(glist,
- glist->gl_y1 + (glist->gl_y2 - glist->gl_y1) *
- (x->gl_obj.te_ypix + x->gl_pixheight) /
- (glist->gl_screeny2 - glist->gl_screeny1));
- }
-#endif
x2 = x1 + x->gl_pixwidth;
y2 = y1 + x->gl_pixheight;
@@ -890,24 +889,29 @@ static void graph_getrect(t_gobj *z, t_glist *glist,
if (y22 > y2)
y2 = y22;
}
- /* lie about whether we have our own window to affect gobj_getrect
- calls below. (LATER add argument to gobj_getrect()?) */
- hadwindow = x->gl_havewindow;
- x->gl_havewindow = 0;
- for (g = x->gl_list; g; g = g->g_next)
- if ((!(ob = pd_checkobject(&g->g_pd))) || text_shouldvis(ob, x))
+ if (!x->gl_goprect)
{
- /* don't do this for arrays, just let them hang outsize the
- box. */
- if (pd_class(&g->g_pd) == garray_class)
- continue;
- gobj_getrect(g, x, &x21, &y21, &x22, &y22);
- if (x22 > x2)
- x2 = x22;
- if (y22 > y2)
- y2 = y22;
+ /* expand the rectangle to fit in text objects; this applies only
+ to the old (0.37) graph-on-parent behavior. */
+ /* lie about whether we have our own window to affect gobj_getrect
+ calls below. */
+ hadwindow = x->gl_havewindow;
+ x->gl_havewindow = 0;
+ for (g = x->gl_list; g; g = g->g_next)
+ if ((!(ob = pd_checkobject(&g->g_pd))) || text_shouldvis(ob, x))
+ {
+ /* don't do this for arrays, just let them hang outside the
+ box. */
+ if (pd_class(&g->g_pd) == garray_class)
+ continue;
+ gobj_getrect(g, x, &x21, &y21, &x22, &y22);
+ if (x22 > x2)
+ x2 = x22;
+ if (y22 > y2)
+ y2 = y22;
+ }
+ x->gl_havewindow = hadwindow;
}
- x->gl_havewindow = hadwindow;
}
else text_widgetbehavior.w_getrectfn(z, glist, &x1, &y1, &x2, &y2);
*xp1 = x1;
@@ -1068,23 +1072,6 @@ t_widgetbehavior graph_widgetbehavior =
graph_click,
};
-void graph_properties(t_gobj *z, t_glist *owner)
-{
- t_glist *x = (t_glist *)z;
- {
- t_gobj *y;
- char graphbuf[200];
- sprintf(graphbuf, "pdtk_graph_dialog %%s %g %g %g %g %d %d\n",
- x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2,
- x->gl_pixwidth, x->gl_pixheight);
- gfxstub_new(&x->gl_pd, x, graphbuf);
-
- for (y = x->gl_list; y; y = y->g_next)
- if (pd_class(&y->g_pd) == garray_class)
- garray_properties((t_garray *)y);
- }
-}
-
/* find the graph most recently added to this glist;
if none exists, return 0. */
@@ -1097,29 +1084,6 @@ t_glist *glist_findgraph(t_glist *x)
return ((t_glist *)y);
}
- /* message back from dialog GUI to set parameters. Args are:
- 1-4: bounds in our coordinates; 5-6: size in parent */
-static void graph_dialog(t_glist *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_float x1 = atom_getfloatarg(0, argc, argv);
- t_float y1 = atom_getfloatarg(1, argc, argv);
- t_float x2 = atom_getfloatarg(2, argc, argv);
- t_float y2 = atom_getfloatarg(3, argc, argv);
- t_float xpix = atom_getfloatarg(4, argc, argv);
- t_float ypix = atom_getfloatarg(5, argc, argv);
- if (x1 != x->gl_x1 || x2 != x->gl_x2 ||
- y1 != x->gl_y1 || y2 != x->gl_y2)
- graph_bounds(x, x1, y1, x2, y2);
- if (xpix != x->gl_pixwidth || ypix != x->gl_pixheight)
- {
- x->gl_pixwidth = xpix;
- x->gl_pixheight = ypix;
- glist_redraw(x);
- if (x->gl_owner)
- canvas_fixlinesfor(x->gl_owner, &x->gl_obj);
- }
-}
-
extern void canvas_menuarray(t_glist *canvas);
void g_graph_setup(void)
@@ -1139,8 +1103,6 @@ void g_graph_setup(void)
A_SYMBOL, A_FLOAT, A_SYMBOL, A_DEFFLOAT, A_NULL);
class_addmethod(canvas_class, (t_method)canvas_menuarray,
gensym("menuarray"), A_NULL);
- class_addmethod(canvas_class, (t_method)graph_dialog, gensym("dialog"),
- A_GIMME, 0);
class_addmethod(canvas_class, (t_method)glist_arraydialog,
gensym("arraydialog"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
class_addmethod(canvas_class, (t_method)glist_sort,
diff --git a/pd/src/g_readwrite.c b/pd/src/g_readwrite.c
index 7a3a161c..d8090b48 100644
--- a/pd/src/g_readwrite.c
+++ b/pd/src/g_readwrite.c
@@ -597,11 +597,23 @@ static void canvas_saveto(t_canvas *x, t_binbuf *b)
print out a "coords" message to set up the coordinate systems */
if (x->gl_isgraph || x->gl_x1 || x->gl_y1 ||
x->gl_x2 != 1 || x->gl_y2 != 1 || x->gl_pixwidth || x->gl_pixheight)
- binbuf_addv(b, "ssfffffff;", gensym("#X"), gensym("coords"),
+ {
+ if (x->gl_isgraph && x->gl_goprect)
+ /* if we have a graph-on-parent rectangle, we're new style.
+ The format is arranged so
+ that old versions of Pd can at least do something with it. */
+ binbuf_addv(b, "ssfffffffff;", gensym("#X"), gensym("coords"),
+ x->gl_x1, x->gl_y1,
+ x->gl_x2, x->gl_y2,
+ (float)x->gl_pixwidth, (float)x->gl_pixheight,
+ 1., (float)x->gl_xmargin, (float)x->gl_ymargin);
+ /* otherwise write in 0.38-compatible form */
+ else binbuf_addv(b, "ssfffffff;", gensym("#X"), gensym("coords"),
x->gl_x1, x->gl_y1,
x->gl_x2, x->gl_y2,
(float)x->gl_pixwidth, (float)x->gl_pixheight,
(float)x->gl_isgraph);
+ }
}
/* call this recursively to collect all the template names for
diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c
index 0de6903e..a07e20a9 100644
--- a/pd/src/g_rtext.c
+++ b/pd/src/g_rtext.c
@@ -153,17 +153,24 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp,
float dispx, dispy;
char smallbuf[200], *tempbuf;
int outchars = 0, nlines = 0, ncolumns = 0,
- pixwide, pixhigh;
- int font = glist_getfont(x->x_glist);
- int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font);
- int findx = (*widthp + (fontwidth/2)) / fontwidth,
- findy = *heightp / fontheight;
+ pixwide, pixhigh, font, fontwidth, fontheight, findx, findy;
int reportedindex = 0;
t_canvas *canvas = glist_getcanvas(x->x_glist);
int widthspec = x->x_text->te_width;
int widthlimit = (widthspec ? widthspec : BOXWIDTH);
int inindex = 0;
int selstart = 0, selend = 0;
+ /* if we're a GOP (the new, "goprect" style) borrow the font size
+ from the inside to preserve the spacing */
+ if (pd_class(&x->x_text->te_pd) == canvas_class &&
+ ((t_glist *)(x->x_text))->gl_isgraph &&
+ ((t_glist *)(x->x_text))->gl_goprect)
+ font = glist_getfont((t_glist *)(x->x_text));
+ else font = glist_getfont(x->x_glist);
+ fontwidth = sys_fontwidth(font);
+ fontheight = sys_fontheight(font);
+ findx = (*widthp + (fontwidth/2)) / fontwidth;
+ findy = *heightp / fontheight;
if (x->x_bufsize >= 100)
tempbuf = (char *)t_getbytes(2 * x->x_bufsize + 1);
else tempbuf = smallbuf;
diff --git a/pd/src/g_template.c b/pd/src/g_template.c
index 28b54395..ede0c11c 100644
--- a/pd/src/g_template.c
+++ b/pd/src/g_template.c
@@ -1323,12 +1323,13 @@ static void *plot_new(t_symbol *classsym, t_int argc, t_atom *argv)
void plot_float(t_plot *x, t_floatarg f)
{
+ int viswas;
if (x->x_vis.fd_type != A_FLOAT || x->x_vis.fd_var)
{
pd_error(x, "global vis/invis for a template with variable visibility");
return;
}
- int viswas = (x->x_vis.fd_un.fd_float != 0);
+ viswas = (x->x_vis.fd_un.fd_float != 0);
if ((f != 0 && viswas) || (f == 0 && !viswas))
return;
diff --git a/pd/src/g_text.c b/pd/src/g_text.c
index 30735918..535d993b 100644
--- a/pd/src/g_text.c
+++ b/pd/src/g_text.c
@@ -950,13 +950,14 @@ static void text_delete(t_gobj *z, t_glist *glist)
canvas_deletelinesfor(glist, x);
}
- /* return true if the text box should be drawn.
- We don't show object boxes inside graphs. */
+ /* return true if the text box should be drawn. We don't show text boxes
+ inside graphs---except comments, if we're doing the new (goprect) style. */
int text_shouldvis(t_text *x, t_glist *glist)
{
return (glist->gl_havewindow ||
(x->te_pd != canvas_class && x->te_pd->c_wb != &text_widgetbehavior) ||
- (x->te_pd == canvas_class && (((t_glist *)x)->gl_isgraph)));
+ (x->te_pd == canvas_class && (((t_glist *)x)->gl_isgraph)) ||
+ (glist->gl_goprect && (x->te_type == T_TEXT)));
}
static void text_vis(t_gobj *z, t_glist *glist, int vis)
diff --git a/pd/src/makefile.nt b/pd/src/makefile.nt
index 9fcdceed..b014931e 100644
--- a/pd/src/makefile.nt
+++ b/pd/src/makefile.nt
@@ -47,9 +47,10 @@ SRCPA = $(PADIR)/pa_common/pa_stream.c \
$(PADIR)/pa_common/pa_dither.c \
$(PADIR)/pa_common/pa_cpuload.c \
$(PADIR)/pa_common/pa_converters.c \
+ $(PADIR)/pa_common/pa_allocation.c \
$(PADIR)/pa_win/pa_win_util.c \
$(PADIR)/pa_win/pa_win_hostapis.c \
- $(PADIR)/pa_common/pa_allocation.c
+ $(PADIR)/pa_win_wmme/pa_win_wmme.c
SRCASIO = $(PADIR)/pa_asio/pa_asio.cpp
@@ -60,7 +61,8 @@ $(LDIR)\odbc32.lib $(LDIR)\odbccp32.lib ..\lib\asio\asiolib.lib
PAOBJ = pa_stream.obj pa_trace.obj pa_skeleton.obj pa_process.obj \
pa_front.obj pa_dither.obj pa_cpuload.obj pa_converters.obj \
- pa_allocation.obj pa_win_util.obj pa_win_hostapis.obj pa_asio.obj
+ pa_allocation.obj pa_win_util.obj pa_win_hostapis.obj pa_asio.obj \
+ pa_win_wmme.obj
OBJC = $(SRC:.c=.obj) $(PAOBJ)
@@ -125,6 +127,8 @@ pa_win_util.obj: $(PADIR)\pa_win\pa_win_util.c
cl /c $(ALLCF) $(PADIR)\pa_win\pa_win_util.c
pa_win_hostapis.obj: $(PADIR)\pa_win\pa_win_hostapis.c
cl /c $(ALLCF) $(PADIR)\pa_win\pa_win_hostapis.c
+pa_win_wmme.obj: $(PADIR)\pa_win_wmme\pa_win_wmme.c
+ cl /c $(ALLCF) $(PADIR)\pa_win_wmme\pa_win_wmme.c
pa_asio.obj: $(PADIR)\pa_asio\pa_asio.cpp
cl /c $(ALLCF) $(PADIR)\pa_asio\pa_asio.cpp
diff --git a/pd/src/notes.txt b/pd/src/notes.txt
index e3848d17..5aca35dc 100644
--- a/pd/src/notes.txt
+++ b/pd/src/notes.txt
@@ -1,23 +1,25 @@
---------------- dolist --------------------
done for 0.39:
-arrays are now first-class data
+At the source level, "regular" arrays and arrays withing data structures
+are now the same thing. The main user-visible effect of this is that now
+"arrays" may be graphed as "bezier curves".
array elements can be clicked on, etc
fixed array onset bug
rfft bug fix
bug fix in d_soundfile.c
bugfix in number2
plot drawing instructions turn on and off
+ranges in drawing instructions
+unify graph properties dialogs
+GOP font depends on abstraction, not parent
+
+
+------------ 0.39 ---------
check:
MIDI I/O for windows
blechman patch for s_inter.c
-At the source level, "regular" arrays and arrays withing data structures
-are now the same thing. The main user-visible effect of this is that now
-"arrays" may be graphed as "bezier curves".
-
------------- 0.39 ---------
-
garray change:
make a gobj_redraw that schedules the redraw
put two radio button banks side by side
@@ -31,6 +33,7 @@ block resampling arguments
document tabwrite~_start
problems:
+modal dialogs confuse watchdog
patcher inlets don't deal with scalars (zbug.pd)
Macintosh .pd extension not added to filenames
need to optimize canvas_motion (get rid of box hit test??)
@@ -52,7 +55,6 @@ check what happens when going back and forth between graph-on-parent
get rid of messages causing renaming; try to prevent patches closing themselves.
dac~/ adc~/ block~ incompatibility
scofo reports error on reading score1.txt
-rfft~ loses nyquist bin -- see "to hell with it" comment in d_fft.c
loading e-mailed patches without removing headers crashes pd
pd $1 bug ($1 is saved as it was evaluated, not as '$1')
check if _vsnprintf with zero argument in windows works any better...
@@ -93,7 +95,6 @@ data:
data copy/paste doesn't check templates aren't changed
figure out why Pd sometimes crashes when you close example after adding fields
arrays of non-existent templates crash
-allow field(1,5,0,100) etc. in drawing commands
vget, vset traversal objects
cursor to show (x, y) location
better hit detection (getrect is too greedy; try tk's "current" tag for canvas)
diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk
index 0a45dfd6..f6534dde 100644
--- a/pd/src/u_main.tk
+++ b/pd/src/u_main.tk
@@ -1746,7 +1746,14 @@ proc pdtk_canvas_dofont {name initsize} {
############ pdtk_gatom_dialog -- run a gatom dialog #########
-# see graph_apply, etc., for comments about handling variable names here...
+# dialogs like this one can come up in many copies; but in TK the easiest
+# way to get data from an "entry", etc., is to set an associated variable
+# name. This is especially true for grouped "radio buttons". So we have
+# to synthesize variable names for each instance of the dialog. The dialog
+# gets a TK pathname $id, from which it strips the leading "." to make a
+# variable suffix $vid. Then you can get the actual value out by asking for
+# [eval concat $$variablename]. There should be an easier way but I don't see
+# it yet.
proc gatom_escape {sym} {
if {[string length $sym] == 0} {
@@ -1970,141 +1977,6 @@ proc pdtk_canvas_popup {name xpix ypix canprop canopen} {
[expr $ypix + [winfo rooty $name.c]] 0
}
-############ pdtk_graph_dialog -- dialog window for graphs #########
-
-# the graph and array dialogs can come up in many copies; but in TK the easiest
-# way to get data from an "entry", etc., is to set an associated variable
-# name. This is especially true for grouped "radio buttons". So we have
-# to synthesize variable names for each instance of the dialog. The dialog
-# gets a TK pathname $id, from which it strips the leading "." to make a
-# variable suffix $vid. Then you can get the actual value out by asking for
-# [eval concat $$variablename]. There should be an easier way but I don't see
-# it yet.
-
-proc graph_apply {id} {
-# strip "." from the TK id to make a variable name suffix
- set vid [string trimleft $id .]
-# for each variable, make a local variable to hold its name...
- set var_graph_x1 [concat graph_x1_$vid]
- global $var_graph_x1
- set var_graph_x2 [concat graph_x2_$vid]
- global $var_graph_x2
- set var_graph_xpix [concat graph_xpix_$vid]
- global $var_graph_xpix
- set var_graph_y1 [concat graph_y1_$vid]
- global $var_graph_y1
- set var_graph_y2 [concat graph_y2_$vid]
- global $var_graph_y2
- set var_graph_ypix [concat graph_ypix_$vid]
- global $var_graph_ypix
-
- pd [concat $id dialog \
- [eval concat $$var_graph_x1] \
- [eval concat $$var_graph_y1] \
- [eval concat $$var_graph_x2] \
- [eval concat $$var_graph_y2] \
- [eval concat $$var_graph_xpix] \
- [eval concat $$var_graph_ypix] \
- \;]
-}
-
-proc graph_cancel {id} {
- set cmd [concat $id cancel \;]
-# puts stderr $cmd
- pd $cmd
-}
-
-proc graph_ok {id} {
- graph_apply $id
- graph_cancel $id
-}
-
-proc pdtk_graph_dialog {id x1 y1 x2 y2 xpix ypix} {
- set vid [string trimleft $id .]
- set var_graph_x1 [concat graph_x1_$vid]
- global $var_graph_x1
- set var_graph_x2 [concat graph_x2_$vid]
- global $var_graph_x2
- set var_graph_xpix [concat graph_xpix_$vid]
- global $var_graph_xpix
- set var_graph_y1 [concat graph_y1_$vid]
- global $var_graph_y1
- set var_graph_y2 [concat graph_y2_$vid]
- global $var_graph_y2
- set var_graph_ypix [concat graph_ypix_$vid]
- global $var_graph_ypix
-
- set $var_graph_x1 $x1
- set $var_graph_x2 $x2
- set $var_graph_xpix $xpix
- set $var_graph_y1 $y1
- set $var_graph_y2 $y2
- set $var_graph_ypix $ypix
-
- toplevel $id
- wm title $id {graph}
- wm protocol $id WM_DELETE_WINDOW [concat graph_cancel $id]
-
- label $id.label -text {GRAPH BOUNDS}
- pack $id.label -side top
-
- frame $id.buttonframe
- pack $id.buttonframe -side bottom -fill x -pady 2m
- button $id.buttonframe.cancel -text {Cancel}\
- -command "graph_cancel $id"
- button $id.buttonframe.apply -text {Apply}\
- -command "graph_apply $id"
- button $id.buttonframe.ok -text {OK}\
- -command "graph_ok $id"
- pack $id.buttonframe.cancel -side left -expand 1
- pack $id.buttonframe.apply -side left -expand 1
- pack $id.buttonframe.ok -side left -expand 1
-
- frame $id.xrangef
- pack $id.xrangef -side top
-
- label $id.xrangef.l1 -text "X from:"
- entry $id.xrangef.x1 -textvariable $var_graph_x1 -width 7
- label $id.xrangef.l2 -text "to:"
- entry $id.xrangef.x2 -textvariable $var_graph_x2 -width 7
- label $id.xrangef.l3 -text "screen width:"
- entry $id.xrangef.xpix -textvariable $var_graph_xpix -width 7
- pack $id.xrangef.l1 $id.xrangef.x1 \
- $id.xrangef.l2 $id.xrangef.x2 \
- $id.xrangef.l3 $id.xrangef.xpix -side left
-
- frame $id.yrangef
- pack $id.yrangef -side top
-
-# dig in the following that the upper bound is labeled y1 but the variable is
-# y2, etc. This is to deal with the inconsistent use of "upper and lower"
-# graph bounds... in the dialog the upper Y bound is the lower valued Y pixel.
- label $id.yrangef.l1 -text "Y from:"
- entry $id.yrangef.y1 -textvariable $var_graph_y2 -width 7
- label $id.yrangef.l2 -text "to:"
- entry $id.yrangef.y2 -textvariable $var_graph_y1 -width 7
- label $id.yrangef.l3 -text "screen height:"
- entry $id.yrangef.ypix -textvariable $var_graph_ypix -width 7
- pack $id.yrangef.l1 $id.yrangef.y1 \
- $id.yrangef.l2 $id.yrangef.y2 \
- $id.yrangef.l3 $id.yrangef.ypix -side left
-
- bind $id.xrangef.x1 <KeyPress-Return> [concat graph_ok $id]
- bind $id.xrangef.x2 <KeyPress-Return> [concat graph_ok $id]
- bind $id.xrangef.xpix <KeyPress-Return> [concat graph_ok $id]
- bind $id.yrangef.y1 <KeyPress-Return> [concat graph_ok $id]
- bind $id.yrangef.y2 <KeyPress-Return> [concat graph_ok $id]
- bind $id.yrangef.ypix <KeyPress-Return> [concat graph_ok $id]
- pdtk_standardkeybindings $id.xrangef.x1
- pdtk_standardkeybindings $id.xrangef.x2
- pdtk_standardkeybindings $id.xrangef.xpix
- pdtk_standardkeybindings $id.yrangef.y1
- pdtk_standardkeybindings $id.yrangef.y2
- pdtk_standardkeybindings $id.yrangef.ypix
- $id.xrangef.x2 select from 0
- $id.xrangef.x2 select adjust end
- focus $id.xrangef.x2
-}
# begin of change "iemlib"
############ pdtk_iemgui_dialog -- dialog window for iem guis #########
@@ -2835,6 +2707,8 @@ proc pdtk_iemgui_dialog {id mainheader \
# end of change "iemlib"
############ pdtk_array_dialog -- dialog window for arrays #########
+# see comments above (pdtk_gatom_dialog) about variable name handling
+
proc array_apply {id} {
# strip "." from the TK id to make a variable name suffix
set vid [string trimleft $id .]
@@ -2979,22 +2853,48 @@ proc pdtk_array_dialog {id name n flags newone} {
}
############ pdtk_canvas_dialog -- dialog window for canvass #########
+# see comments above (pdtk_gatom_dialog) about variable name handling
+
proc canvas_apply {id} {
# strip "." from the TK id to make a variable name suffix
set vid [string trimleft $id .]
# for each variable, make a local variable to hold its name...
+
set var_canvas_xscale [concat canvas_xscale_$vid]
global $var_canvas_xscale
set var_canvas_yscale [concat canvas_yscale_$vid]
global $var_canvas_yscale
set var_canvas_graphme [concat canvas_graphme_$vid]
global $var_canvas_graphme
-# set var_canvas_stretch [concat canvas_stretch_$vid]
-# global $var_canvas_stretch
+ set var_canvas_x1 [concat canvas_x1_$vid]
+ global $var_canvas_x1
+ set var_canvas_x2 [concat canvas_x2_$vid]
+ global $var_canvas_x2
+ set var_canvas_xpix [concat canvas_xpix_$vid]
+ global $var_canvas_xpix
+ set var_canvas_xmargin [concat canvas_xmargin_$vid]
+ global $var_canvas_xmargin
+ set var_canvas_y1 [concat canvas_y1_$vid]
+ global $var_canvas_y1
+ set var_canvas_y2 [concat canvas_y2_$vid]
+ global $var_canvas_y2
+ set var_canvas_ypix [concat canvas_ypix_$vid]
+ global $var_canvas_ypix
+ set var_canvas_ymargin [concat canvas_ymargin_$vid]
+ global $var_canvas_ymargin
+
pd [concat $id donecanvasdialog \
[eval concat $$var_canvas_xscale] \
[eval concat $$var_canvas_yscale] \
[eval concat $$var_canvas_graphme] \
+ [eval concat $$var_canvas_x1] \
+ [eval concat $$var_canvas_y1] \
+ [eval concat $$var_canvas_x2] \
+ [eval concat $$var_canvas_y2] \
+ [eval concat $$var_canvas_xpix] \
+ [eval concat $$var_canvas_ypix] \
+ [eval concat $$var_canvas_xmargin] \
+ [eval concat $$var_canvas_ymargin] \
\;]
}
@@ -3008,8 +2908,9 @@ proc canvas_ok {id} {
canvas_cancel $id
}
-proc pdtk_canvas_dialog {id xscale yscale graphme stretch} {
+proc canvas_checkcommand {id} {
set vid [string trimleft $id .]
+# puts stderr [concat canvas_checkcommand $id $vid]
set var_canvas_xscale [concat canvas_xscale_$vid]
global $var_canvas_xscale
@@ -3017,18 +2918,120 @@ proc pdtk_canvas_dialog {id xscale yscale graphme stretch} {
global $var_canvas_yscale
set var_canvas_graphme [concat canvas_graphme_$vid]
global $var_canvas_graphme
-# set var_canvas_stretch [concat canvas_stretch_$vid]
-# global $var_canvas_stretch
+ set var_canvas_x1 [concat canvas_x1_$vid]
+ global $var_canvas_x1
+ set var_canvas_x2 [concat canvas_x2_$vid]
+ global $var_canvas_x2
+ set var_canvas_xpix [concat canvas_xpix_$vid]
+ global $var_canvas_xpix
+ set var_canvas_xmargin [concat canvas_xmargin_$vid]
+ global $var_canvas_xmargin
+ set var_canvas_y1 [concat canvas_y1_$vid]
+ global $var_canvas_y1
+ set var_canvas_y2 [concat canvas_y2_$vid]
+ global $var_canvas_y2
+ set var_canvas_ypix [concat canvas_ypix_$vid]
+ global $var_canvas_ypix
+ set var_canvas_ymargin [concat canvas_ymargin_$vid]
+ global $var_canvas_ymargin
+
+ if { [eval concat $$var_canvas_graphme] != 0 } {
+ $id.xrange.entry1 configure -state normal
+ $id.xrange.entry2 configure -state normal
+ $id.xrange.entry3 configure -state normal
+ $id.xrange.entry4 configure -state normal
+ $id.yrange.entry1 configure -state normal
+ $id.yrange.entry2 configure -state normal
+ $id.yrange.entry3 configure -state normal
+ $id.yrange.entry4 configure -state normal
+ $id.xscale.entry configure -state disabled
+ $id.yscale.entry configure -state disabled
+ set x1 [eval concat $$var_canvas_x1]
+ set y1 [eval concat $$var_canvas_y1]
+ set x2 [eval concat $$var_canvas_x2]
+ set y2 [eval concat $$var_canvas_y2]
+ if { [eval concat $$var_canvas_x1] == 0 && \
+ [eval concat $$var_canvas_y1] == 0 && \
+ [eval concat $$var_canvas_x2] == 0 && \
+ [eval concat $$var_canvas_y2] == 0 } {
+ set $var_canvas_x2 1
+ set $var_canvas_y2 1
+ }
+ if { [eval concat $$var_canvas_xpix] == 0 } {
+ set $var_canvas_xpix 85
+ set $var_canvas_xmargin 100
+ }
+ if { [eval concat $$var_canvas_ypix] == 0 } {
+ set $var_canvas_ypix 60
+ set $var_canvas_ymargin 100
+ }
+ } else {
+ $id.xrange.entry1 configure -state disabled
+ $id.xrange.entry2 configure -state disabled
+ $id.xrange.entry3 configure -state disabled
+ $id.xrange.entry4 configure -state disabled
+ $id.yrange.entry1 configure -state disabled
+ $id.yrange.entry2 configure -state disabled
+ $id.yrange.entry3 configure -state disabled
+ $id.yrange.entry4 configure -state disabled
+ $id.xscale.entry configure -state normal
+ $id.yscale.entry configure -state normal
+ if { [eval concat $$var_canvas_xscale] == 0 } {
+ set $var_canvas_xscale 1
+ }
+ if { [eval concat $$var_canvas_yscale] == 0 } {
+ set $var_canvas_yscale -1
+ }
+ }
+}
+
+proc pdtk_canvas_dialog {id xscale yscale graphme x1 y1 x2 y2 \
+ xpix ypix xmargin ymargin} {
+ set vid [string trimleft $id .]
+
+ set var_canvas_xscale [concat canvas_xscale_$vid]
+ global $var_canvas_xscale
+ set var_canvas_yscale [concat canvas_yscale_$vid]
+ global $var_canvas_yscale
+ set var_canvas_graphme [concat canvas_graphme_$vid]
+ global $var_canvas_graphme
+ set var_canvas_x1 [concat canvas_x1_$vid]
+ global $var_canvas_x1
+ set var_canvas_x2 [concat canvas_x2_$vid]
+ global $var_canvas_x2
+ set var_canvas_xpix [concat canvas_xpix_$vid]
+ global $var_canvas_xpix
+ set var_canvas_xmargin [concat canvas_xmargin_$vid]
+ global $var_canvas_xmargin
+ set var_canvas_y1 [concat canvas_y1_$vid]
+ global $var_canvas_y1
+ set var_canvas_y2 [concat canvas_y2_$vid]
+ global $var_canvas_y2
+ set var_canvas_ypix [concat canvas_ypix_$vid]
+ global $var_canvas_ypix
+ set var_canvas_ymargin [concat canvas_ymargin_$vid]
+ global $var_canvas_ymargin
+
set $var_canvas_xscale $xscale
set $var_canvas_yscale $yscale
set $var_canvas_graphme $graphme
-# set $var_canvas_stretch $stretch
+ set $var_canvas_x1 $x1
+ set $var_canvas_y1 $y1
+ set $var_canvas_x2 $x2
+ set $var_canvas_y2 $y2
+ set $var_canvas_xpix $xpix
+ set $var_canvas_ypix $ypix
+ set $var_canvas_xmargin $xmargin
+ set $var_canvas_ymargin $ymargin
toplevel $id
wm title $id {canvas}
wm protocol $id WM_DELETE_WINDOW [concat canvas_cancel $id]
+ label $id.toplabel -text "Canvas Properties"
+ pack $id.toplabel -side top
+
frame $id.xscale
pack $id.xscale -side top
label $id.xscale.label -text "X units per pixel"
@@ -3042,13 +3045,41 @@ proc pdtk_canvas_dialog {id xscale yscale graphme stretch} {
pack $id.yscale.label $id.yscale.entry -side left
checkbutton $id.graphme -text {graph on parent} \
- -variable $var_canvas_graphme -anchor w
+ -variable $var_canvas_graphme -anchor w \
+ -command [concat canvas_checkcommand $id]
pack $id.graphme -side top
-# checkbutton $id.stretch -text {stretch on resize} \
-# -variable $var_canvas_stretch -anchor w
-# pack $id.stretch -side top
-
+ frame $id.xrange
+ pack $id.xrange -side top
+ label $id.xrange.label1 -text "X range: from"
+ entry $id.xrange.entry1 -textvariable $var_canvas_x1 -width 6
+ label $id.xrange.label2 -text "to"
+ entry $id.xrange.entry2 -textvariable $var_canvas_x2 -width 6
+ label $id.xrange.label3 -text "size"
+ entry $id.xrange.entry3 -textvariable $var_canvas_xpix -width 4
+ label $id.xrange.label4 -text "margin"
+ entry $id.xrange.entry4 -textvariable $var_canvas_xmargin -width 4
+ pack $id.xrange.label1 $id.xrange.entry1 \
+ $id.xrange.label2 $id.xrange.entry2 \
+ $id.xrange.label3 $id.xrange.entry3 \
+ $id.xrange.label4 $id.xrange.entry4 \
+ -side left
+
+ frame $id.yrange
+ pack $id.yrange -side top
+ label $id.yrange.label1 -text "Y range: from"
+ entry $id.yrange.entry1 -textvariable $var_canvas_y1 -width 6
+ label $id.yrange.label2 -text "to"
+ entry $id.yrange.entry2 -textvariable $var_canvas_y2 -width 6
+ label $id.yrange.label3 -text "size"
+ entry $id.yrange.entry3 -textvariable $var_canvas_ypix -width 4
+ label $id.yrange.label4 -text "margin"
+ entry $id.yrange.entry4 -textvariable $var_canvas_ymargin -width 4
+ pack $id.yrange.label1 $id.yrange.entry1 \
+ $id.yrange.label2 $id.yrange.entry2 \
+ $id.yrange.label3 $id.yrange.entry3 \
+ $id.yrange.label4 $id.yrange.entry4 \
+ -side left
frame $id.buttonframe
pack $id.buttonframe -side bottom -fill x -pady 2m
@@ -3069,6 +3100,7 @@ proc pdtk_canvas_dialog {id xscale yscale graphme stretch} {
$id.xscale.entry select from 0
$id.xscale.entry select adjust end
focus $id.xscale.entry
+ canvas_checkcommand $id
}
############ pdtk_data_dialog -- run a data dialog #########