diff options
author | Guenter Geiger <ggeiger@users.sourceforge.net> | 2002-11-25 10:47:53 +0000 |
---|---|---|
committer | Guenter Geiger <ggeiger@users.sourceforge.net> | 2002-11-25 10:47:53 +0000 |
commit | 5aef03b3a165b309622f6d051bd4d53c42b4532d (patch) | |
tree | 808a2924e736f3327c968f0868fd1efdbc3a1aec | |
parent | b09bea965d034a8e092b35d369f2ef6591ef0e65 (diff) |
This commit was generated by cvs2svn to compensate for changes in r232,
which included commits to RCS files with non-trunk default branches.
svn path=/trunk/; revision=233
67 files changed, 7864 insertions, 2372 deletions
diff --git a/pd/LICENSE.txt b/pd/LICENSE.txt index 34ee8399..a56a51eb 100644 --- a/pd/LICENSE.txt +++ b/pd/LICENSE.txt @@ -1,31 +1,30 @@ This software is copyrighted by Miller Puckette and others. The following -terms apply to all files associated with the software unless explicitly -disclaimed in individual files. +terms (the "Standard Improved BSD License") apply to all files associated with +the software unless explicitly disclaimed in individual files: -The authors hereby grant permission to use, copy, modify, distribute, -and license this software and its documentation for any purpose, provided -that existing copyright notices are retained in all copies and that this -notice is included verbatim in any distributions. No written agreement, -license, or royalty fee is required for any of the authorized uses. -Modifications to this software may be copyrighted by their authors -and need not follow the licensing terms described here, provided that -the new terms are clearly indicated on the first page of each file where -they apply. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: -IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY -FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES -ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY -DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. +3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior + written permission. -THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE -IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE -NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR -MODIFICATIONS. - -RESTRICTED RIGHTS: Use, duplication or disclosure by the government -is subject to the restrictions as set forth in subparagraph (c) (1) (ii) -of the Rights in Technical Data and Computer Software Clause as DFARS -252.227-7013 and FAR 52.227-19. +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. diff --git a/pd/doc/1.manual/index.htm b/pd/doc/1.manual/index.htm index ddaa292d..2d8bb4dd 100644 --- a/pd/doc/1.manual/index.htm +++ b/pd/doc/1.manual/index.htm @@ -30,7 +30,7 @@ can be found at: <OL> <LI> <A href="x2.htm#s1.1"> main window, canvases, and printout </A> <LI> <A href="x2.htm#s1.2"> object boxes </A> - <LI> <A href="x2.htm#s1.3"> message, number, and symbol boxes </A> + <LI> <A href="x2.htm#s1.3"> message and GUI boxes </A> <LI> <A href="x2.htm#s1.4"> patches and files </A> </OL> <LI> <A href="x2.htm#s2"> how to edit patches </A> @@ -81,9 +81,10 @@ can be found at: <LI> <A href="x2.htm#s8"> numeric arrays </A> <LI> <A href="x2.htm#s9"> data structures </A> <OL> - <LI> <A href="x2.htm#s9.1"> abstractions </A> - <LI> <A href="x2.htm#s9.2"> graph-on-parent subpatches </A> - <LI> <A href="x2.htm#s9.3"> limitations </A> + <LI> <A href="x2.htm#s9.1"> traversal </A> + <LI> <A href="x2.htm#s9.2"> accessing and changing data </A> + <LI> <A href="x2.htm#s9.3"> editing </A> + <LI> <A href="x2.htm#s9.4"> limitations </A> </OL> </OL> diff --git a/pd/doc/1.manual/x2.htm b/pd/doc/1.manual/x2.htm index cc382e67..334e6ae2 100644 --- a/pd/doc/1.manual/x2.htm +++ b/pd/doc/1.manual/x2.htm @@ -69,7 +69,7 @@ whether you can see them or not. Here is a simple Pd patch: <IMG src="fig1.2.jpg"> </CENTER><P> -There are four <I> text items </I> in this patch: a number box (showing zero), +There are four <I> text boxes </I> in this patch: a number box (showing zero), an object box showing "print," and two comments. The number box and the object box are connected, the number box's output to the print box's input. Boxes may have zero or more inputs and/or outputs, with the inputs on top and the outputs @@ -651,7 +651,7 @@ carried out in the order they were scheduled. <H4> <A name=s6> 2.6. semantics </A> </H4> This section describes how objects in Pd are created, how they store data and -how object and other boxes they pass messages among themselves. +how object and other boxes pass messages among themselves. <H4> <A name=s6.1> 2.6.1. creation of objects </A> </H4> @@ -759,6 +759,13 @@ is the mechanism for making local variables. In particular, $0 in an abstractio is a counter which is guaranteed to be unique to that abstraction, so sends and receives with names like "$0-bear" can be used as local send/receive pairs. +<P> Note that the expansion of variables such as $0 and $1 only works at the +beginning of the symbol; so, for instance, "rats-$1" will not be expanded. +Occasionally you may want to have double or triple substitutions; this can +be done one stage at a time by nesting abstractions (with each subpatch +adding its own $-variable to the beginning of a symbol and passing that on +as argument to a further anstraction.) + <H4> <A name=s7> 2.7. subpatches </A> </H4> Pd offers two mechanisms for making subpatches, called "one-off subpatches" @@ -946,7 +953,7 @@ width and height, in screen pixels. <P> Many other operations are defined for arrays; see the related patches in the tutorial (starting at 2.control/15.array.pd) for more possibliities. -<H4> <A name=s8> 2.9. Data structures </A> </H4> +<H4> <A name=s9> 2.9. Data structures </A> </H4> (Note: this section is adapted from an article submitted to ICMC 2002.) <P> The original idea in developing Pd was to make a real-time computer music diff --git a/pd/doc/3.audio.examples/01.PART1.sinewave.pd b/pd/doc/3.audio.examples/01.PART1.sinewave.pd index 091d7f6b..42b8aed0 100644 --- a/pd/doc/3.audio.examples/01.PART1.sinewave.pd +++ b/pd/doc/3.audio.examples/01.PART1.sinewave.pd @@ -1,20 +1,32 @@ -#N canvas 6 2 628 515 12; +#N canvas 6 2 588 513 12; #X obj 108 109 osc~ 440; #X obj 108 168 dac~; -#X text 176 110 <-- 440 Hz. sine wave at full blast; -#X text 175 138 <-- reduce volume; +#X text 187 111 <-- 440 Hz. sine wave at full blast; #X obj 108 138 *~ 0.05; -#X text 174 168 <-- send to the audio output device; #X text 202 3 MAKING A SINE WAVE; -#X text 32 195 Audio computation can be turned on and off by sending messages to the global "pd" object as follows:; +#X text 32 195 Audio computation can be turned on and off by sending +messages to the global "pd" object as follows:; #X msg 98 239 \; pd dsp 1; #X msg 202 239 \; pd dsp 0; #X text 113 276 ON; #X text 222 276 OFF; -#X text 29 297 You should see the Pd window change to reflect whether audio is on or off. You can also turn audio on and off using the "audio" menu \, but the buttons are provided as a shortcut.; -#X text 30 368 When DSP is on \, you should hear a tone whose pitch is A 440 and whose amplitude is 0.05. If instead you are greeted with silence \, you might want to read the HTML documentation on setting up audio.; -#X text 28 434 In general when you start a work session with Pd \, you will want to choose "test audio and MIDI" from the help window \, which opens a more comprehensive test patch than this one.; -#X text 32 23 Audio computation in Pd is done using "tilde objects" such as the three below. THey use continuous audio streams to intercommunicate. They can be controlled by sending them messages. A few analysis modules take audio streams in and put control messages back out.; -#X text 378 491 updated for Pd version 0.33; -#X connect 0 0 4 0; -#X connect 4 0 1 0; +#X text 29 297 You should see the Pd window change to reflect whether +audio is on or off. You can also turn audio on and off using the "audio" +menu \, but the buttons are provided as a shortcut.; +#X text 30 368 When DSP is on \, you should hear a tone whose pitch +is A 440 and whose amplitude is 0.05. If instead you are greeted with +silence \, you might want to read the HTML documentation on setting +up audio.; +#X text 28 434 In general when you start a work session with Pd \, +you will want to choose "test audio and MIDI" from the help window +\, which opens a more comprehensive test patch than this one.; +#X text 296 247 <-- click these; +#X text 187 139 <-- reduce amplitude to 0.05; +#X text 160 168 <----- send to the audio output device; +#X text 32 23 Audio computation in Pd is done using "tilde objects" +such as the three below. They use continuous audio streams to intercommunicate +\, as well as communicating with other ("control") Pd objects using +messages.; +#X text 342 490 updated for Pd version 0.36; +#X connect 0 0 3 0; +#X connect 3 0 1 0; diff --git a/pd/doc/3.audio.examples/02.amplitude.pd b/pd/doc/3.audio.examples/02.amplitude.pd index 814d7d7c..d24be18d 100644 --- a/pd/doc/3.audio.examples/02.amplitude.pd +++ b/pd/doc/3.audio.examples/02.amplitude.pd @@ -12,12 +12,11 @@ range \, but when you output a signal via the dac~ object \, the samples should range between -1 and +1. Values out of that range will be "clipped." ; #X obj 64 202 *~ 0; -#X floatatom 103 163 0 0 0; -#X obj 91 130 dbtorms; -#X floatatom 91 98 0 0 80; -#X text 137 98 <-- set amplitude here in dB; +#X floatatom 107 165 0 0 0 0 - - -; +#X obj 95 132 dbtorms; +#X floatatom 95 100 0 0 80 0 - - -; +#X text 141 100 <-- set amplitude here in dB; #X text 211 133 <-- this converts dB to linear units; -#X text 114 282 <-- and out. We'resending to both channels now.; #X text 210 164 <-- this shows the linear gain; #X text 116 204 <-- multiply the sine wave by the gain \, reducing its amplitude. You can also use the "*~" object to multiply two signals. @@ -29,6 +28,7 @@ to one \, and zero dB artificially outputs a true 0; #X text 34 452 Pd assumes you have a two channel audio system unless you tell it otherwise.; #X text 440 486 updated for Pd version 0.33; +#X text 114 282 <-- and out. We're sending to both channels now.; #X connect 0 0 9 0; #X connect 9 0 1 0; #X connect 9 0 1 1; diff --git a/pd/doc/3.audio.examples/03.line.pd b/pd/doc/3.audio.examples/03.line.pd index 535152f2..392df533 100644 --- a/pd/doc/3.audio.examples/03.line.pd +++ b/pd/doc/3.audio.examples/03.line.pd @@ -1,4 +1,4 @@ -#N canvas 30 68 683 481 12; +#N canvas 369 106 647 598 12; #X obj 56 79 osc~ 440; #X obj 56 309 dac~; #X msg 446 79 \; pd dsp 1; @@ -6,38 +6,43 @@ #X text 467 112 ON; #X text 555 112 OFF; #X obj 56 269 *~; -#X obj 72 235 line~; -#X text 129 235 <--- ramp generator; -#X text 124 78 <-- sine wave; +#X obj 72 243 line~; +#X text 129 243 <--- ramp generator; +#X text 132 78 <-- sine wave; #X msg 72 103 0.1 2000; -#X msg 72 169 0 2000; +#X msg 72 177 0 2000; #X msg 72 125 0.1 50; -#X msg 72 191 0 50; +#X msg 72 199 0 50; #X msg 72 147 0.1; -#X msg 72 213 0; +#X msg 72 221 0; #X text 274 124 ON; #X text 154 105 <-- slow; #X text 144 126 <-- fast; #X text 111 146 <-- instantly; -#X text 271 189 OFF; -#X text 136 170 <-- slow; -#X text 129 191 <-- fast; -#X text 109 211 <-- instantly; -#X text 135 159 ----------------------; -#X text 93 268 <-- multiply the sine wave by the ramp. There's no longer -a "0" argument; +#X text 271 197 OFF; +#X text 136 178 <-- slow; +#X text 129 199 <-- fast; +#X text 109 219 <-- instantly; +#X text 112 161 ----------------------; #X text 97 308 <-- out; #X text 103 7 CONTROLLING AMPLITUDE USING LINE~; #X text 38 342 Line~'s left inlet is a target value \; it reaches that target in the time specified (in milliseconds) to its right inlet. ; -#X text 39 396 The line~ object (and its control brother \, line) treat +#X text 34 495 The line~ object (and its control brother \, line) treat their right inlet specially. The inlets don't retain values the way other inlets do but revert to zero whenever a target is received.; #X text 14 27 In this patch \, the multiplier is configured to multiply two signals. The amplitude is now a signal computed by the line~ object. ; -#X text 415 457 updated for Pd version 0.33; +#X text 37 395 (In this example \, message boxes with two numbers each +are connected to line~'s left inlet. Except in some special cases \, +Pd objects with more than one inlet will automatically distribute lists +of numbers across their inlets. In this case \, "0 50" becomes \, "50 +at right and 0 at left."); +#X text 386 557 updated for Pd version 0.36; +#X text 93 268 <-- multiply the sine wave by the ramp. There's no longer +a "0" argument-- this tells Pd to expect a signal here.; #X connect 0 0 6 0; #X connect 6 0 1 0; #X connect 6 0 1 1; diff --git a/pd/doc/3.audio.examples/05.output.subpatch.pd b/pd/doc/3.audio.examples/05.output.subpatch.pd index ab0dc724..d24fdba2 100644 --- a/pd/doc/3.audio.examples/05.output.subpatch.pd +++ b/pd/doc/3.audio.examples/05.output.subpatch.pd @@ -1,97 +1,30 @@ -#N canvas 68 39 635 486 12; -#X floatatom 70 181 0 0 100; -#N canvas 331 136 786 621 output 0; -#X obj 455 510 t b; -#X obj 455 450 f; -#X obj 455 390 inlet; -#X obj 455 540 f; -#X msg 566 532 0; -#X msg 455 420 bang; -#X obj 455 480 moses 1; -#X obj 566 502 t b f; -#X obj 535 460 moses 1; -#X obj 107 121 dbtorms; -#X obj 535 430 r master-lvl; -#X obj 107 28 r master-lvl; -#X obj 455 570 s master-lvl; -#X obj 36 228 inlet~; -#X obj 250 258 inlet; -#X obj 268 283 s master-lvl; -#X msg 119 57 set \$1; -#X obj 119 87 outlet; -#X msg 250 309 \; pd dsp 1; -#X obj 107 181 line~; -#X obj 36 258 *~; -#X obj 36 288 dac~; -#X obj 107 151 pack 0 50; -#X text 23 205 audio in; -#X text 2 313 out both channels; -#X text 273 182 Level input. Send to master-lvl and start DSP (we infer -that if you're changing the level you want to hear the network.) If -you start DSP when it's already running there's no effect.; -#X text 59 542 here is the previous nonzero master-lvl -->; -#X text 98 451 recall previous value of master-lvl -->; -#X text 239 482 test if less than 1 -->; -#X text 203 510 if true convert to bang -->; -#X text 218 351 Mute control. If the master level is zero \, restore -to the last nonzero one \, otherwise zero it.; -#X text 182 86 <-- update the number box to show new level; -#X text 178 120 <-- convert from dB to linear units; -#X text 196 150 <-- make a smooth ramp to avoid clicks or zipper noise -; -#X text 333 318 <-- automatically start DSP; -#X connect 0 0 3 0; -#X connect 1 0 6 0; -#X connect 2 0 5 0; -#X connect 3 0 12 0; -#X connect 4 0 12 0; -#X connect 5 0 1 0; -#X connect 6 0 0 0; -#X connect 6 1 7 0; -#X connect 7 0 4 0; -#X connect 8 1 3 1; -#X connect 9 0 22 0; -#X connect 10 0 1 1; -#X connect 10 0 8 0; -#X connect 11 0 9 0; -#X connect 11 0 16 0; -#X connect 13 0 20 0; -#X connect 14 0 15 0; -#X connect 14 0 18 0; -#X connect 16 0 17 0; -#X connect 19 0 20 1; -#X connect 20 0 21 0; -#X connect 20 0 21 1; -#X connect 22 0 19 0; -#X restore 32 214 pd output; -#X msg 108 182 MUTE; +#N canvas 300 159 635 486 12; +#X text 261 20 CONTROLLING OUTPUT AMPLITUDE; #X obj 32 27 osc~ 440; #X obj 54 55 osc~ 550; #X obj 54 116 osc~ 660; #X obj 32 88 +~; #X obj 32 142 +~; -#X text 122 216 <-- this is a subwindow--click on it to see inside. +#X text 108 177 <-- this is a subwindow--right click on it; +#X text 149 197 and select "open" to see inside.; +#X text 30 401 The output control automatically starts DSP whenever +you touch the level control. Hitting "mute" toggles between the current +level and zero.; +#X obj 32 173 output~; +#X text 383 463 updated for Pd version 0.36; +#X text 143 115 <-- Here we make an A major triad as a test signal. ; -#X text 158 182 <-- output amplitude and mute control; -#X text 383 463 updated for Pd version 0.34; -#X text 24 408 The output control automatically starts DSP whenever -you touch the level control. "MUTE" toggles between the current level -and zero.; -#X text 157 115 <-- Here we make a simple triad as a test signal.; -#X text 261 20 CONTROLLING OUTPUT AMPLITUDE; -#X text 25 263 In this and subsequent patches \, we'll use a subwindow +#X text 31 250 In this and subsequent patches \, we'll use a subwindow \, "output" \, to control overall amplitude. The amplitudes are in decibels \, with 100 being full blast. In this example \, you can't actually push the output amplitude past 90 or so without clipping. You'll know you're clipping if \, instead of an A major chord \, you hear a single \, distorted tone two octaves down. The clipping happens -at Pd's last stage of audio output. All audio signals internal to Pd -have essentially no level limit.; -#X connect 0 0 1 1; -#X connect 1 0 0 0; -#X connect 2 0 1 2; -#X connect 3 0 6 0; -#X connect 4 0 6 1; -#X connect 5 0 7 1; -#X connect 6 0 7 0; -#X connect 7 0 1 0; +at Pd's last stage of audio output. Audio signals internal to Pd have +essentially no level limit.; +#X connect 1 0 4 0; +#X connect 2 0 4 1; +#X connect 3 0 5 1; +#X connect 4 0 5 0; +#X connect 5 0 9 0; +#X connect 5 0 9 1; diff --git a/pd/doc/3.audio.examples/06.frequency.pd b/pd/doc/3.audio.examples/06.frequency.pd index 5bc94801..50cff7c0 100644 --- a/pd/doc/3.audio.examples/06.frequency.pd +++ b/pd/doc/3.audio.examples/06.frequency.pd @@ -1,77 +1,15 @@ #N canvas 8 17 693 642 12; -#X graph graph1 0 -1.02 4410 1.02 473 297 673 167; +#N canvas 0 0 450 300 graph1 0; #X array osc-output 4410 float 0; -#X pop; -#X obj 128 259 tabwrite~ osc-output; -#X floatatom 53 294 0 0 100; -#N canvas 331 136 786 621 output 0; -#X obj 455 510 t b; -#X obj 455 450 f; -#X obj 455 390 inlet; -#X obj 455 540 f; -#X msg 566 532 0; -#X msg 455 420 bang; -#X obj 455 480 moses 1; -#X obj 566 502 t b f; -#X obj 521 458 moses 1; -#X obj 107 174 dbtorms; -#X obj 521 428 r master-lvl; -#X obj 107 56 r master-lvl; -#X obj 455 570 s master-lvl; -#X obj 36 228 inlet~; -#X obj 251 229 inlet; -#X obj 269 257 s master-lvl; -#X msg 119 85 set \$1; -#X obj 119 115 outlet; -#X msg 251 283 \; pd dsp 1; -#X obj 107 236 line~; -#X obj 36 258 *~; -#X obj 36 290 dac~; -#X obj 107 204 pack 0 50; -#X text 23 205 audio in; -#X text 2 313 out both channels; -#X text 246 157 Level input. Send to master-lvl and start DSP (we infer -that if you're changing the level you want to hear the network.) If -you start DSP when it's already running there's no effect.; -#X text 59 542 here is the previous nonzero master-lvl -->; -#X text 98 451 recall previous value of master-lvl -->; -#X text 239 482 test if less than 1 -->; -#X text 203 510 if true convert to bang -->; -#X text 218 351 Mute control. If the master level is zero \, restore -to the last nonzero one \, otherwise zero it.; -#X text 182 114 <-- update the number box to show new level; -#X connect 0 0 3 0; -#X connect 1 0 6 0; -#X connect 2 0 5 0; -#X connect 3 0 12 0; -#X connect 4 0 12 0; -#X connect 5 0 1 0; -#X connect 6 0 0 0; -#X connect 6 1 7 0; -#X connect 7 0 4 0; -#X connect 8 1 3 1; -#X connect 9 0 22 0; -#X connect 10 0 1 1; -#X connect 10 0 8 0; -#X connect 11 0 9 0; -#X connect 11 0 16 0; -#X connect 13 0 20 0; -#X connect 14 0 15 0; -#X connect 14 0 18 0; -#X connect 16 0 17 0; -#X connect 19 0 20 1; -#X connect 20 0 21 0; -#X connect 20 0 21 1; -#X connect 22 0 19 0; -#X restore 15 327 pd output; -#X msg 91 295 MUTE; -#X msg 128 230 bang; -#X floatatom 280 66 0 0 0; -#X text 177 229 <-- click to graph; +#X coords 0 1.02 4410 -1.02 200 130 1; +#X restore 473 167 graph; +#X obj 98 261 tabwrite~ osc-output; +#X msg 98 232 bang; +#X floatatom 280 66 0 0 0 0 - - -; +#X text 147 231 <-- click to graph; #X obj 15 206 r frequency; -#X obj 15 232 osc~ 0; #X msg 280 37 set \$1; -#X floatatom 6 66 0 0 0; +#X floatatom 6 66 0 0 0 0 - - -; #X obj 6 8 r frequency; #X msg 6 37 set \$1; #X obj 19 90 s frequency; @@ -99,25 +37,24 @@ its frequency is controlled by connecting an audio signal to its input. #X text 15 553 Note also the "set" messages going to the number boxes so that they can each update the other without bringing on an infinite loop. (get help on number boxes for details.); -#X text 437 619 updated for Pd version 0.34; -#X text 141 295 <-- output level; +#X text 87 291 <-- output level; #X text 51 116 <-- convert frequency; #X text 106 134 to "MIDI" pitch; #X text 327 117 <-- convert "MIDI" pitch to frequency; -#X connect 2 0 3 1; -#X connect 3 0 2 0; -#X connect 4 0 3 2; -#X connect 5 0 1 0; -#X connect 6 0 16 0; -#X connect 6 0 17 0; +#X obj 15 273 output~; +#X text 437 619 updated for Pd version 0.36; +#X obj 15 232 osc~; +#X connect 2 0 1 0; +#X connect 3 0 12 0; +#X connect 3 0 13 0; +#X connect 5 0 31 0; +#X connect 6 0 3 0; +#X connect 7 0 10 0; +#X connect 7 0 16 0; #X connect 8 0 9 0; -#X connect 9 0 1 0; -#X connect 9 0 3 0; -#X connect 10 0 6 0; -#X connect 11 0 14 0; -#X connect 11 0 20 0; -#X connect 12 0 13 0; -#X connect 13 0 11 0; -#X connect 15 0 10 0; -#X connect 17 0 18 0; -#X connect 20 0 19 0; +#X connect 9 0 7 0; +#X connect 11 0 6 0; +#X connect 13 0 14 0; +#X connect 16 0 15 0; +#X connect 31 0 1 0; +#X connect 31 0 29 0; diff --git a/pd/doc/3.audio.examples/output~.pd b/pd/doc/3.audio.examples/output~.pd new file mode 100644 index 00000000..13ae9252 --- /dev/null +++ b/pd/doc/3.audio.examples/output~.pd @@ -0,0 +1,62 @@ +#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; +#X obj 30 117 dbtorms; +#X obj 83 208 inlet~; +#X msg 341 285 \; pd dsp 1; +#X obj 27 208 line~; +#X obj 61 242 *~; +#X obj 61 272 dac~; +#X obj 30 147 pack 0 50; +#X text 110 184 audio in; +#X text 301 496 test if less than 1 -->; +#X text 267 523 if true convert to bang -->; +#X text 101 116 <-- convert from dB to linear units; +#X floatatom 341 221 3 0 100 0 dB - -; +#X obj 516 449 bng 15 250 50 0 empty empty mute -38 7 0 12 -262144 +-1 -1; +#X text 119 146 <-- make a ramp to avoid clicks or zipper noise; +#X obj 172 209 inlet~; +#X obj 151 241 *~; +#X text 502 399 MUTE logic:; +#X obj 341 193 r \$0-master-lvl; +#X obj 516 573 s \$0-master-lvl; +#X obj 356 248 s \$0-master-out; +#X obj 30 91 r \$0-master-out; +#X obj 596 450 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 79 295 automatically start DSP -->; +#X connect 0 0 2 0; +#X connect 1 0 4 0; +#X connect 2 0 25 0; +#X connect 3 0 25 0; +#X connect 4 0 0 0; +#X connect 4 1 5 0; +#X connect 5 0 3 0; +#X connect 6 1 2 1; +#X connect 7 0 13 0; +#X connect 8 0 11 1; +#X connect 10 0 11 1; +#X connect 10 0 22 0; +#X connect 11 0 12 0; +#X connect 13 0 10 0; +#X connect 18 0 9 0; +#X connect 18 0 26 0; +#X connect 19 0 1 0; +#X connect 21 0 22 1; +#X connect 22 0 12 1; +#X connect 24 0 18 0; +#X connect 27 0 7 0; +#X connect 28 0 1 1; +#X connect 28 0 6 0; +#X coords 0 0 1 1 65 55 1; diff --git a/pd/doc/3.audio.examples/x.ps b/pd/doc/3.audio.examples/x.ps new file mode 100644 index 00000000..372dc540 --- /dev/null +++ b/pd/doc/3.audio.examples/x.ps @@ -0,0 +1,844 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: Tk Canvas Widget +%%For: msp +%%Title: Window .x80edcf8.c +%%CreationDate: Thu Aug 8 13:49:09 2002 +%%BoundingBox: 115 319 497 473 +%%Pages: 1 +%%DocumentData: Clean7Bit +%%Orientation: Portrait +%%DocumentNeededResources: font Courier-Bold +%%EndComments + +%%BeginProlog +50 dict begin + +% This is a standard prolog for Postscript generated by Tk's canvas +% widget. +% RCS: @(#) $Id: x.ps,v 1.1.1.1 2002-11-25 10:47:48 ggeiger Exp $ + +% The definitions below just define all of the variables used in +% any of the procedures here. This is needed for obscure reasons +% explained on p. 716 of the Postscript manual (Section H.2.7, +% "Initializing Variables," in the section on Encapsulated Postscript). + +/baseline 0 def +/stipimage 0 def +/height 0 def +/justify 0 def +/lineLength 0 def +/spacing 0 def +/stipple 0 def +/strings 0 def +/xoffset 0 def +/yoffset 0 def +/tmpstip null def + +% Define the array ISOLatin1Encoding (which specifies how characters are +% encoded for ISO-8859-1 fonts), if it isn't already present (Postscript +% level 2 is supposed to define it, but level 1 doesn't). + +systemdict /ISOLatin1Encoding known not { + /ISOLatin1Encoding [ + /space /space /space /space /space /space /space /space + /space /space /space /space /space /space /space /space + /space /space /space /space /space /space /space /space + /space /space /space /space /space /space /space /space + /space /exclam /quotedbl /numbersign /dollar /percent /ampersand + /quoteright + /parenleft /parenright /asterisk /plus /comma /minus /period /slash + /zero /one /two /three /four /five /six /seven + /eight /nine /colon /semicolon /less /equal /greater /question + /at /A /B /C /D /E /F /G + /H /I /J /K /L /M /N /O + /P /Q /R /S /T /U /V /W + /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore + /quoteleft /a /b /c /d /e /f /g + /h /i /j /k /l /m /n /o + /p /q /r /s /t /u /v /w + /x /y /z /braceleft /bar /braceright /asciitilde /space + /space /space /space /space /space /space /space /space + /space /space /space /space /space /space /space /space + /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent + /dieresis /space /ring /cedilla /space /hungarumlaut /ogonek /caron + /space /exclamdown /cent /sterling /currency /yen /brokenbar /section + /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen + /registered /macron + /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph + /periodcentered + /cedillar /onesuperior /ordmasculine /guillemotright /onequarter + /onehalf /threequarters /questiondown + /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla + /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex + /Idieresis + /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply + /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn + /germandbls + /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla + /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex + /idieresis + /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide + /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn + /ydieresis + ] def +} if + +% font ISOEncode font +% This procedure changes the encoding of a font from the default +% Postscript encoding to ISOLatin1. It's typically invoked just +% before invoking "setfont". The body of this procedure comes from +% Section 5.6.1 of the Postscript book. + +/ISOEncode { + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding ISOLatin1Encoding def + currentdict + end + + % I'm not sure why it's necessary to use "definefont" on this new + % font, but it seems to be important; just use the name "Temporary" + % for the font. + + /Temporary exch definefont +} bind def + +% StrokeClip +% +% This procedure converts the current path into a clip area under +% the assumption of stroking. It's a bit tricky because some Postscript +% interpreters get errors during strokepath for dashed lines. If +% this happens then turn off dashes and try again. + +/StrokeClip { + {strokepath} stopped { + (This Postscript printer gets limitcheck overflows when) = + (stippling dashed lines; lines will be printed solid instead.) = + [] 0 setdash strokepath} if + clip +} bind def + +% desiredSize EvenPixels closestSize +% +% The procedure below is used for stippling. Given the optimal size +% of a dot in a stipple pattern in the current user coordinate system, +% compute the closest size that is an exact multiple of the device's +% pixel size. This allows stipple patterns to be displayed without +% aliasing effects. + +/EvenPixels { + % Compute exact number of device pixels per stipple dot. + dup 0 matrix currentmatrix dtransform + dup mul exch dup mul add sqrt + + % Round to an integer, make sure the number is at least 1, and compute + % user coord distance corresponding to this. + dup round dup 1 lt {pop 1} if + exch div mul +} bind def + +% width height string StippleFill -- +% +% Given a path already set up and a clipping region generated from +% it, this procedure will fill the clipping region with a stipple +% pattern. "String" contains a proper image description of the +% stipple pattern and "width" and "height" give its dimensions. Each +% stipple dot is assumed to be about one unit across in the current +% user coordinate system. This procedure trashes the graphics state. + +/StippleFill { + % The following code is needed to work around a NeWSprint bug. + + /tmpstip 1 index def + + % Change the scaling so that one user unit in user coordinates + % corresponds to the size of one stipple dot. + 1 EvenPixels dup scale + + % Compute the bounding box occupied by the path (which is now + % the clipping region), and round the lower coordinates down + % to the nearest starting point for the stipple pattern. Be + % careful about negative numbers, since the rounding works + % differently on them. + + pathbbox + 4 2 roll + 5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll + 6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll + + % Stack now: width height string y1 y2 x1 x2 + % Below is a doubly-nested for loop to iterate across this area + % in units of the stipple pattern size, going up columns then + % across rows, blasting out a stipple-pattern-sized rectangle at + % each position + + 6 index exch { + 2 index 5 index 3 index { + % Stack now: width height string y1 y2 x y + + gsave + 1 index exch translate + 5 index 5 index true matrix tmpstip imagemask + grestore + } for + pop + } for + pop pop pop pop pop +} bind def + +% -- AdjustColor -- +% Given a color value already set for output by the caller, adjusts +% that value to a grayscale or mono value if requested by the CL +% variable. + +/AdjustColor { + CL 2 lt { + currentgray + CL 0 eq { + .5 lt {0} {1} ifelse + } if + setgray + } if +} bind def + +% x y strings spacing xoffset yoffset justify stipple DrawText -- +% This procedure does all of the real work of drawing text. The +% color and font must already have been set by the caller, and the +% following arguments must be on the stack: +% +% x, y - Coordinates at which to draw text. +% strings - An array of strings, one for each line of the text item, +% in order from top to bottom. +% spacing - Spacing between lines. +% xoffset - Horizontal offset for text bbox relative to x and y: 0 for +% nw/w/sw anchor, -0.5 for n/center/s, and -1.0 for ne/e/se. +% yoffset - Vertical offset for text bbox relative to x and y: 0 for +% nw/n/ne anchor, +0.5 for w/center/e, and +1.0 for sw/s/se. +% justify - 0 for left justification, 0.5 for center, 1 for right justify. +% stipple - Boolean value indicating whether or not text is to be +% drawn in stippled fashion. If text is stippled, +% procedure StippleText must have been defined to call +% StippleFill in the right way. +% +% Also, when this procedure is invoked, the color and font must already +% have been set for the text. + +/DrawText { + /stipple exch def + /justify exch def + /yoffset exch def + /xoffset exch def + /spacing exch def + /strings exch def + + % First scan through all of the text to find the widest line. + + /lineLength 0 def + strings { + stringwidth pop + dup lineLength gt {/lineLength exch def} {pop} ifelse + newpath + } forall + + % Compute the baseline offset and the actual font height. + + 0 0 moveto (TXygqPZ) false charpath + pathbbox dup /baseline exch def + exch pop exch sub /height exch def pop + newpath + + % Translate coordinates first so that the origin is at the upper-left + % corner of the text's bounding box. Remember that x and y for + % positioning are still on the stack. + + translate + lineLength xoffset mul + strings length 1 sub spacing mul height add yoffset mul translate + + % Now use the baseline and justification information to translate so + % that the origin is at the baseline and positioning point for the + % first line of text. + + justify lineLength mul baseline neg translate + + % Iterate over each of the lines to output it. For each line, + % compute its width again so it can be properly justified, then + % display it. + + strings { + dup stringwidth pop + justify neg mul 0 moveto + stipple { + + % The text is stippled, so turn it into a path and print + % by calling StippledText, which in turn calls StippleFill. + % Unfortunately, many Postscript interpreters will get + % overflow errors if we try to do the whole string at + % once, so do it a character at a time. + + gsave + /char (X) def + { + char 0 3 -1 roll put + currentpoint + gsave + char true charpath clip StippleText + grestore + char stringwidth translate + moveto + } forall + grestore + } {show} ifelse + 0 spacing neg translate + } forall +} bind def + +%%EndProlog +%%BeginSetup +/CL 2 def +%%IncludeResource: font Courier-Bold +%%EndSetup + +%%Page: 1 1 +save +306.0 396.0 translate +0.846 0.846 scale +-224 -91 translate +-1 182 moveto 449 182 lineto 449 0 lineto -1 0 lineto closepath clip newpath +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +231 103 [ +(50.3695) +] 13 -0 0 0 false DrawText +grestore +gsave +230 105 moveto +281 105 lineto +285 101 lineto +285 88 lineto +230 88 lineto +230 105 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +230 89 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +230 105 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +231 125 [ +(set $1) +] 13 -0 0 0 false DrawText +grestore +gsave +230 127 moveto +278 127 lineto +274 123 lineto +274 114 lineto +278 110 lineto +230 110 lineto +230 127 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +230 111 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +230 127 moveto 7 0 rlineto 0 -0.999999999999993 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +16 103 [ +(150) +] 13 -0 0 0 false DrawText +grestore +gsave +15 105 moveto +38 105 lineto +42 101 lineto +42 88 lineto +15 88 lineto +15 105 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +15 89 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +15 105 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +16 148 [ +(r frequency) +] 13 -0 0 0 false DrawText +grestore +gsave +15 150 moveto +94 150 lineto +94 133 lineto +15 133 lineto +15 150 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +15 134 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +16 125 [ +(set $1) +] 13 -0 0 0 false DrawText +grestore +gsave +15 127 moveto +63 127 lineto +59 123 lineto +59 114 lineto +63 110 lineto +15 110 lineto +15 127 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +15 111 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +15 127 moveto 7 0 rlineto 0 -0.999999999999993 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +29 79 [ +(s frequency) +] 13 -0 0 0 false DrawText +grestore +gsave +28 81 moveto +107 81 lineto +107 64 lineto +28 64 lineto +28 81 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +28 81 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +231 148 [ +(r pitch) +] 13 -0 0 0 false DrawText +grestore +gsave +230 150 moveto +281 150 lineto +281 133 lineto +230 133 lineto +230 150 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +230 134 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +240 79 [ +(s pitch) +] 13 -0 0 0 false DrawText +grestore +gsave +239 81 moveto +290 81 lineto +290 64 lineto +239 64 lineto +239 81 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +239 81 moveto 7.00000000000006 0 rlineto 0 -1 rlineto -7.00000000000006 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +231 57 [ +(mtof) +] 13 -0 0 0 false DrawText +grestore +gsave +230 59 moveto +260 59 lineto +260 42 lineto +230 42 lineto +230 59 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +230 43 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +230 59 moveto 7 0 rlineto 0 -1.00000000000003 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +231 33 [ +(s frequency) +] 13 -0 0 0 false DrawText +grestore +gsave +230 35 moveto +309 35 lineto +309 18 lineto +230 18 lineto +230 35 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +230 35 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +16 33 [ +(s pitch) +] 13 -0 0 0 false DrawText +grestore +gsave +15 35 moveto +66 35 lineto +66 18 lineto +15 18 lineto +15 35 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +15 35 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +16 57 [ +(ftom) +] 13 -0 0 0 false DrawText +grestore +gsave +15 59 moveto +45 59 lineto +45 42 lineto +15 42 lineto +15 59 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +15 43 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +15 59 moveto 7 0 rlineto 0 -1.00000000000003 rlineto -7 0 rlineto closepath +0 setlinejoin 2 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +77 103 [ +(<-- set frequency) +] 13 -0 0 0 false DrawText +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +291 102 [ +(<-- set MIDI pitch) +] 13 -0 0 0 false DrawText +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +51 56 [ +(<-- convert frequency) +] 13 -0 0 0 false DrawText +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +92 41 [ +(to "MIDI" pitch) +] 13 -0 0 0 false DrawText +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +269 56 [ +(<-- convert "MIDI" pitch) +] 13 -0 0 0 false DrawText +grestore +gsave +233 88 moveto +242 81 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +233 88 moveto +233 59 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +233 110 moveto +233 105 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +18 88 moveto +31 81 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +18 88 moveto +18 59 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +18 133 moveto +18 127 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +18 110 moveto +18 105 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +233 133 moveto +233 127 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +233 42 moveto +233 35 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +18 42 moveto +18 35 lineto +0 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +/Courier-Bold findfont 10 scalefont ISOEncode setfont +0.000 0.000 0.000 setrgbcolor AdjustColor +351 43 [ +(to frequency) +] 13 -0 0 0 false DrawText +grestore +restore showpage + +%%Trailer +end +%%EOF diff --git a/pd/doc/4.fft.examples/13.partialtracer.pd b/pd/doc/4.fft.examples/13.partialtracer.pd index 5458f900..7d806b64 100644 --- a/pd/doc/4.fft.examples/13.partialtracer.pd +++ b/pd/doc/4.fft.examples/13.partialtracer.pd @@ -1,52 +1,58 @@ -#N canvas 234 52 720 591 12; -#X floatatom 598 72; +#N struct peak-template float x float y float amp float ampreal float +ampimag float used; +#N struct trace-template float x float y float voiceno array bazoo +point-template; +#N struct point-template float y float amp; +#N canvas 234 52 951 590 12; +#X floatatom 777 72 0 0 0 0 - - -; #N canvas 516 98 663 557 boo 0; -#X obj 79 108 outlet; -#X msg 78 80 set \$1; -#X obj 79 57 r osc-amp; +#X obj 103 108 outlet; +#X msg 101 80 set \$1; +#X obj 103 57 r osc-amp; #X connect 1 0 0 0; #X connect 2 0 1 0; -#X restore 598 52 pd; -#X obj 598 93 s osc-amp; -#X obj 93 513 pack 0 100; -#X obj 94 533 line~; -#X obj 93 493 dbtorms; -#X obj 94 573 *~; -#X floatatom 624 225; -#X msg 514 269 0; -#X floatatom 567 225; -#X floatatom 645 290; -#X floatatom 498 71; +#X restore 777 52 pd; +#X obj 781 99 s osc-amp; +#X obj 121 513 pack 0 100; +#X obj 122 533 line~; +#X obj 121 493 dbtorms; +#X obj 122 573 *~; +#X floatatom 811 225 0 0 0 0 - - -; +#X msg 668 269 0; +#X floatatom 737 225 0 0 0 0 - - -; +#X floatatom 838 290 0 0 0 0 - - -; +#X floatatom 647 71 0 0 0 0 - - -; #N canvas 516 98 663 555 boo 0; -#X obj 79 108 outlet; -#X msg 78 80 set \$1; -#X obj 79 57 r grain-amp; +#X obj 103 108 outlet; +#X msg 101 80 set \$1; +#X obj 103 57 r grain-amp; #X connect 1 0 0 0; #X connect 2 0 1 0; -#X restore 498 51 pd; +#X restore 647 51 pd; #N canvas 201 90 556 354 analysis 0; -#X obj 220 45 r snapshot; -#X obj 62 283 print; -#X obj 106 154 t b b b; -#X obj 20 189 s done-analysis; -#X obj 209 149 s start-analysis; -#X obj 161 261 s found-peak; -#X obj 107 263 r loud; -#X obj 63 262 spigot; -#X msg 138 101 1; -#X obj 31 99 r fft-done; -#X obj 31 129 spigot; -#X msg 110 101 0; -#X obj 222 84 del 0.01; -#X msg 221 66 bang; -#X text 183 103 Wait for the next FFT to come by before doing the peak search.; -#X obj 341 176 r errthresh; -#X msg 343 219 errthresh \$1; -#X floatatom 341 199; -#X obj 212 173 r window-size; -#X obj 169 190 f; -#X msg 162 211 \$1 fft-real fft-imag 10; -#X obj 162 231 pique; +#X obj 286 45 r snapshot; +#X obj 81 283 print; +#X obj 138 154 t b b b; +#X obj 26 189 s done-analysis; +#X obj 272 149 s start-analysis; +#X obj 209 261 s found-peak; +#X obj 139 263 r loud; +#X obj 82 262 spigot; +#X msg 179 101 1; +#X obj 40 99 r fft-done; +#X obj 40 129 spigot; +#X msg 143 101 0; +#X obj 289 84 del 0.01; +#X msg 287 66 bang; +#X text 238 103 Wait for the next FFT to come by before doing the peak +search.; +#X obj 443 176 r errthresh; +#X msg 446 219 errthresh \$1; +#X floatatom 443 199 0 0 0 0 - - -; +#X obj 276 173 r window-size; +#X obj 220 190 f; +#X msg 211 211 \$1 fft-real fft-imag 10; +#X obj 211 231 pique; #X connect 0 0 13 0; #X connect 2 0 3 0; #X connect 2 1 19 0; @@ -68,56 +74,417 @@ #X connect 20 0 21 0; #X connect 21 0 5 0; #X connect 21 0 7 0; -#X restore 270 411 pd analysis; +#X restore 351 411 pd analysis; #N canvas 168 244 411 214 peak-template 0; -#X obj 62 52 filledpolygon 3 3 3 0 0 0 amp 0 0; -#X obj 57 10 template float x float y float amp float ampreal float ampimag float used; -#X restore 270 516 pd peak-template; +#X obj 81 52 filledpolygon 3 3 3 0 0 0 amp 0 0; +#X obj 74 10 template float x float y float amp float ampreal float +ampimag float used; +#X restore 351 516 pd peak-template; #N canvas 0 0 600 386 peak-list 0; -#X restore 270 454 pd peak-list; +#X scalar peak-template 13.1452 330 -266.143 -0.00356225 0.272701 1 +\;; +#X scalar peak-template 26.2411 330 -188.677 -0.0124586 0.00627935 +1 \;; +#X scalar peak-template 38.792 330 -192.702 0.0107086 -0.0122645 0 +\;; +#X scalar peak-template 50.5319 330 -171.943 0.00265002 0.00684531 +1 \;; +#X scalar peak-template 58.3058 330 -161.228 -0.000605629 0.00482765 +1 \;; +#X scalar peak-template 71.0373 330 -243.962 0.0471989 0.106425 1 \; +; +#X scalar peak-template 88.9919 330 -164.582 0.00547503 0.000805021 +0 \;; +#X scalar peak-template 107.947 330 -209.931 -0.0168408 0.0266666 1 +\;; +#X scalar peak-template 119.917 330 -160.305 0.00362793 -0.0029822 +1 \;; +#X scalar peak-template 129.045 330 -153.946 0.0019865 0.00309702 1 +\;; +#X restore 351 454 pd peak-list; #N canvas 20 23 472 426 trace-list 1; -#X restore 270 494 pd trace-list; +#X scalar trace-template 5 -17 10 \; -199.613 82.4286 \; -193.527 82.3195 +\; -188.888 79.2392 \; -190.335 80.935 \; -193.692 85.069 \; -193.568 +85.3128 \; -189.446 82.4412 \; -189.463 82.6427 \; -193.472 85.715 +\; -193.644 85.7878 \; -190.286 82.9838 \; -190.22 83.2074 \; -193.608 +86.4234 \; -193.752 86.8166 \; -190.752 84.226 \; -189.701 83.7983 +\; -193.462 86.6934 \; -193.946 87.5821 \; -191.452 85.4317 \; -188.947 +84.731 \; -192.67 87.311 \; -193.589 88.3214 \; -191.457 86.3421 \; +-189.539 85.4724 \; -192.837 87.7069 \; -193.597 88.6789 \; -191.638 +86.7933 \; -189.202 85.5926 \; -192.314 87.3853 \; -193.414 88.3447 +\; -191.768 86.6039 \; -189.511 85.4104 \; -192.226 87.0602 \; -193.354 +88.0144 \; -200.124 86.4402 \; -213.124 85.0898 \; -230.124 86.4172 +\; -241.124 87.5061 \; -257.124 86.4658 \; -271.124 85.3372 \; -277.124 +86.3322 \; -294.124 87.3605 \; -300.124 86.5994 \; -306.124 85.6122 +\; -315.124 86.2608 \; -230.124 86.9223 \; -216.124 86.1642 \; -202.124 +85.7039 \; -188.124 86.9326 \; -178.124 87.7093 \; -170.124 86.9776 +\; -162.124 86.3876 \; -150.124 87.2425 \; -146.124 87.8862 \; -141.124 +87.2632 \; -142.124 86.7912 \; -144.124 87.6082 \; -150.124 88.2056 +\; -156.124 87.6071 \; -164.124 87.0852 \; -172.124 87.6486 \; -276.124 +88.1112 \; -236.124 87.6803 \; -191.429 87.3594 \; -191.999 87.8509 +\; -192.288 88.1035 \; -191.762 87.6553 \; -191.442 87.48 \; -191.991 +87.8655 \; -192.282 87.9377 \; -191.819 87.4774 \; -191.528 87.3144 +\; -192.095 87.7807 \; -192.312 87.9379 \; -191.627 87.3867 \; -191.304 +87.1667 \; -192.098 87.7212 \; -192.4 87.9508 \; -191.793 87.4684 \; +-191.394 87.3245 \; -191.972 87.9335 \; -192.214 88.197 \; -191.675 +87.769 \; -191.461 87.7549 \; -192.195 88.46 \; -192.467 88.6739 \; +-191.769 88.1294 \; -191.444 87.9849 \; -192.159 88.5705 \; -192.338 +88.7136 \; \;; +#X scalar trace-template 0 0 9 \; -242.604 72.4257 \; -239.483 72.5931 +\; -237.938 74.2024 \; -237.967 75.1307 \; -238.432 75.6971 \; -239.134 +76.8606 \; -239.368 77.6083 \; -239.526 77.5637 \; -239.815 77.4497 +\; -239.784 77.4643 \; -239.294 77.7178 \; -239.373 78.1029 \; -239.89 +78.2493 \; -240.14 78.3881 \; -240.024 78.508 \; -239.931 78.4701 \; +-239.901 78.2419 \; -240.135 78.046 \; -240.12 77.78 \; -239.985 77.2291 +\; -240.026 76.61 \; -240.314 76.3586 \; -245.427 76.4585 \; -245.427 +76.929 \; -247.427 77.7947 \; -247.427 78.7843 \; -247.427 79.2856 +\; -244.427 79.0044 \; -242.427 78.3629 \; -237.427 77.7585 \; -241.427 +77.4592 \; -236.427 77.7988 \; -236.427 78.2412 \; -242.427 77.9007 +\; -241.427 77.1143 \; -243.427 76.5427 \; -239.765 76.038 \; -239.745 +75.6009 \; -239.682 75.518 \; -239.741 75.4267 \; -239.708 75.1939 +\; -239.603 74.8523 \; -239.549 74.3391 \; -239.669 73.7522 \; -240.199 +73.2379 \; -240.163 72.0729 \; -238.873 69.5928 \; -237.836 67.9847 +\; -238.994 68.8343 \; -238.65 69.2716 \; -238.479 68.1999 \; -239.098 +66.65 \; -239.075 64.5108 \; -239.716 59.5511 \; -243.426 59.3727 \; +-239.55 61.3263 \; -237.997 64.5714 \; -238.441 65.5136 \; -239.946 +65.642 \; -239.519 64.5486 \; -238.355 62.6434 \; -238.261 58.2019 +\; -231.029 54.6574 \; -231.388 53.416 \; -237.379 54.176 \; -235.315 +55.687 \; \;; +#X scalar trace-template 0 0 8 \; -267.035 74.7826 \; -267.036 74.0101 +\; -268.754 71.1861 \; -267.988 70.9211 \; -267.686 72.0078 \; -267.473 +72.4722 \; -263.142 73.1691 \; -260.694 72.459 \; -260.215 70.7694 +\; -260.032 70.3037 \; -260.078 69.6541 \; -259.805 69.8861 \; -259.903 +70.912 \; -262.604 70.5604 \; -260.805 68.8099 \; -260.154 65.6486 +\; \;; +#X scalar trace-template 0 0 7 \; -297.412 68.2501 \; -298.035 66.8597 +\; -298.676 63.7056 \; -298.326 60.8013 \; \;; +#X scalar trace-template 0 32 6 \; -308.895 73.4936 \; -308.721 73.7641 +\; -308.751 74.0691 \; -308.983 74.6651 \; -308.906 74.8441 \; -308.799 +75.0179 \; -308.882 75.4667 \; -308.933 75.714 \; -309.1 76.062 \; +-309.109 76.1234 \; -308.966 75.6084 \; -308.983 75.4375 \; -309.053 +75.8479 \; -309.072 76.319 \; -309.046 76.7579 \; -308.996 77.0079 +\; -309.043 77.0111 \; -309.094 76.8073 \; -309.091 76.2513 \; -309.091 +75.331 \; -309.087 74.1997 \; -309.236 73.3714 \; -309.35 73.0891 \; +-309.27 72.9043 \; -309.262 73.3638 \; -309.298 74.6891 \; -309.186 +75.9138 \; -309.033 76.8267 \; -308.947 77.3623 \; -308.9 77.4239 \; +-308.872 77.2091 \; -308.848 76.6783 \; -308.866 75.8629 \; -308.841 +75.056 \; -308.717 74.3867 \; -308.642 74.0261 \; -308.634 74.0402 +\; -308.742 74.3319 \; -308.865 74.6704 \; -308.916 75.1175 \; -309.009 +76.0264 \; -309.076 77.0253 \; -309.109 77.6815 \; -309.143 77.9342 +\; -309.223 77.7047 \; -309.308 77.1028 \; -309.289 76.4484 \; -309.144 +75.9489 \; -309.084 75.8889 \; -309.169 76.2907 \; -309.236 76.6955 +\; -309.285 76.8623 \; -309.341 76.9675 \; -309.346 77.1854 \; -309.318 +77.5775 \; -309.273 78.0292 \; -309.214 78.3809 \; -309.171 78.6055 +\; -309.118 78.7596 \; -309.07 78.9356 \; -309.082 79.2439 \; -309.131 +79.6026 \; -309.185 79.7686 \; -309.229 79.7092 \; -309.248 79.5094 +\; -309.24 79.1851 \; -309.209 78.6341 \; -309.186 77.9228 \; -309.233 +77.4246 \; -309.327 77.2158 \; -309.348 77.173 \; -309.268 77.4504 +\; -309.201 77.9582 \; -309.169 78.341 \; -309.148 78.2643 \; -309.083 +77.5223 \; -308.942 76.4386 \; -308.813 75.6409 \; -308.79 75.5743 +\; -308.91 76.3292 \; -309.038 77.4946 \; -309.142 78.6545 \; -309.241 +79.6217 \; -309.303 80.3403 \; -309.322 80.869 \; -309.304 81.1926 +\; -309.251 81.3606 \; -309.193 81.4641 \; -309.173 81.4543 \; -309.172 +81.3199 \; \;; +#X scalar trace-template 0 0 5 \; -319.788 57.3809 \; -320.181 57.5371 +\; -320.607 57.2243 \; -320.485 55.1315 \; \;; +#X scalar trace-template 0 0 4 \; -328.845 56.8844 \; -329.27 57.6407 +\; -330.201 55.7891 \; \;; +#X scalar trace-template 3 -31 3 \; -338.831 65.3604 \; -338.343 65.0927 +\; -337.997 67.416 \; -338.031 68.2797 \; -338.057 68.8033 \; -338.001 +69.8547 \; -337.984 70.6113 \; -338.085 70.2393 \; -338.158 69.7346 +\; -338.067 70.22 \; -338.039 70.7867 \; -338.082 70.6751 \; -338.083 +70.2366 \; -338.051 69.8163 \; -338.064 69.421 \; -338.153 69.0985 +\; -338.179 69.151 \; -338.081 69.4616 \; -338.04 69.2603 \; -338.052 +68.4481 \; -337.998 67.2775 \; -338.04 65.3766 \; -338.285 63.6914 +\; -338.182 64.1078 \; -338.085 64.8679 \; -338.257 64.3851 \; -338.23 +64.0425 \; -338.018 64.4475 \; -338.09 64.3731 \; -338.237 64.1981 +\; -338.155 64.9584 \; -338.141 65.5785 \; -338.284 65.2811 \; -338.2 +65.0292 \; -338.029 65.0808 \; -338.147 64.4456 \; -338.275 64.0782 +\; -338.184 64.021 \; -338.415 63.0838 \; -338.568 62.899 \; -338.185 +63.7816 \; -338.225 64.0316 \; -338.349 64.1353 \; -338.077 64.9335 +\; -338.024 64.9803 \; -338.229 64.0616 \; -338.165 64.0179 \; -338.02 +63.9428 \; -338.154 61.9517 \; -338.287 60.0008 \; -337.903 60.4489 +\; -337.827 60.7339 \; -338.12 59.8507 \; -338.161 61.4826 \; -337.965 +64.5731 \; -338.021 65.6403 \; -338.258 65.4583 \; -338.193 66.1111 +\; -338.036 67.1355 \; -338.092 66.8186 \; -338.278 66.0467 \; -338.251 +66.4051 \; -338.251 66.9293 \; -338.438 67.028 \; -338.314 67.3133 +\; -338.147 67.6987 \; -338.196 67.2544 \; -338.261 67.1296 \; -338.22 +68.1024 \; -338.3 69.1793 \; -338.342 70.0634 \; -338.226 70.5581 \; +-338.227 70.0046 \; -338.369 68.6939 \; -338.266 68.0117 \; -338.129 +68.0847 \; -338.25 67.8763 \; -338.352 68.2743 \; -338.217 69.2533 +\; -338.214 69.6464 \; -338.272 69.5557 \; -338.179 69.9526 \; -338.18 +70.3756 \; -338.345 70.4707 \; -338.342 70.9321 \; -338.22 71.3226 +\; -338.249 70.8791 \; -338.274 70.2455 \; -338.152 70.1605 \; -338.148 +69.9763 \; \;; +#X scalar trace-template 0 0 2 \; -344.435 50.3571 \; -344.676 53.6972 +\; -344.907 57.9862 \; -345.468 59.5927 \; -345.435 57.88 \; -345.08 +53.4871 \; \;; +#X scalar trace-template 0 0 1 \; -351.66 55.5817 \; -350.919 57.0657 +\; \;; +#X scalar trace-template 15 0 1 \; -290.497 62.3455 \; -289.917 64.5081 +\; \;; +#X scalar trace-template 20 0 4 \; -325.69 57.3878 \; \;; +#X scalar trace-template 25 0 7 \; -296.788 63.9304 \; -295.926 62.8437 +\; \;; +#X scalar trace-template 25 0 5 \; -320.285 57.6772 \; -320.508 58.8425 +\; -320.151 58.5278 \; -320.768 60.3968 \; -320.593 60.8226 \; -320.268 +59.7789 \; -320.88 59.737 \; -320.688 59.0786 \; -320.101 59.472 \; +-320.414 60.688 \; -320.308 60.3209 \; -320.371 60.0803 \; -320.671 +60.6628 \; -320.171 59.6875 \; -320.008 59.1602 \; -320.366 58.5441 +\; -320.092 57.0253 \; -320.465 55.492 \; -320.279 54.4491 \; -320.299 +55.7007 \; -320.472 56.8359 \; -319.766 55.3358 \; -319.842 53.2032 +\; -320.037 52.6049 \; -320.513 53.2324 \; -320.556 53.7244 \; -320.127 +53.3023 \; -320.255 53.3985 \; -320.563 54.1999 \; -320.37 55.1689 +\; -320.402 55.0377 \; -320.088 52.8426 \; -320.169 52.1079 \; -320.421 +54.144 \; -320.199 55.1952 \; -320.288 54.8076 \; -319.875 53.4492 +\; -320.134 52.8401 \; -320.478 53.3816 \; -320.345 53.0761 \; -320.747 +54.154 \; -320.409 55.1588 \; -320.473 56.9858 \; -320.638 58.102 \; +-320.376 56.8824 \; -320.121 56.0043 \; -320.426 55.1951 \; \;; +#X scalar trace-template 30 0 4 \; -349.771 59.2302 \; -350.03 58.4881 +\; -350.375 58.8169 \; -350.455 58.2635 \; -350.341 54.9928 \; -349.617 +52.0436 \; \;; +#X scalar trace-template 30 0 1 \; -356.515 53.1229 \; -356.534 52.6592 +\; \;; +#X scalar trace-template 35 0 2 \; -290.388 61.5761 \; -291.357 59.1929 +\; \;; +#X scalar trace-template 40 0 7 \; -300.055 55.9626 \; -297.103 61.9754 +\; -296.124 66.1486 \; -295.446 68.1804 \; -295.431 68.0979 \; -295.612 +67.3051 \; -296.886 64.2983 \; -297.339 62.3423 \; -295.548 62.883 +\; -294.729 65.835 \; -294.983 67.6909 \; -295.394 68.3517 \; -295.061 +66.0636 \; -294.226 62.315 \; -294.766 59.5051 \; -292.748 59.6254 +\; \;; +#X scalar trace-template 45 0 1 \; -327.111 55.6783 \; -326.051 56.3284 +\; \;; +#X scalar trace-template 50 0 2 \; -345.333 60.4566 \; -345.37 61.9942 +\; -345.467 62.5947 \; -345.562 62.2511 \; -345.662 60.6462 \; -345.838 +59.658 \; -345.786 60.9526 \; -345.614 62.0047 \; -345.433 61.2858 +\; -345.405 59.4638 \; -345.705 57.4746 \; -345.9 55.9761 \; -345.987 +53.2427 \; \;; +#X scalar trace-template 60 0 1 \; -330.141 52.7649 \; -329.759 52.496 +\; -330.381 52.6431 \; \;; +#X scalar trace-template 65 0 4 \; -350.539 53.0849 \; \;; +#X scalar trace-template 75 0 4 \; -290.68 58.0518 \; \;; +#X scalar trace-template 113 -115 1 \; -268.376 67.4411 \; -267.51 +69.6547 \; -267.7 69.6601 \; -268.383 68.4795 \; -267.659 68.0134 \; +-268.196 67.5265 \; -267.355 67.8782 \; -267.116 67.7008 \; -268.436 +67.5944 \; -267.414 69.6193 \; -267.548 70.3795 \; -267.645 70.6548 +\; -267.445 71.2117 \; -267.699 70.9501 \; -267.912 70.2365 \; -267.908 +69.646 \; -268.106 69.1182 \; -267.847 69.1953 \; -267.93 68.9679 \; +-267.671 69.0811 \; -267.671 68.8746 \; -268.031 68.337 \; -267.933 +68.1967 \; -268.396 67.8426 \; -268.164 68.2264 \; -267.932 69.2783 +\; -267.808 69.922 \; -267.813 69.7453 \; -267.6 69.27 \; -267.335 +68.7903 \; -267.872 67.5196 \; -268.28 66.5335 \; \;; +#X scalar trace-template 85 0 8 \; -356.473 47.2852 \; \;; +#X scalar trace-template 85 0 4 \; -363.412 52.7933 \; \;; +#X scalar trace-template 95 0 8 \; -349.799 56.9516 \; -349.682 58.114 +\; -349.687 59.1929 \; \;; +#X scalar trace-template 95 0 4 \; -356.884 51.5826 \; \;; +#X scalar trace-template 105 0 4 \; -330.389 53.9029 \; -329.883 52.3388 +\; \;; +#X scalar trace-template 115 0 8 \; -284.263 54.2523 \; -286.764 57.4093 +\; -284.302 57.8219 \; \;; +#X scalar trace-template 120 0 4 \; -325.749 50.8459 \; \;; +#X scalar trace-template 120 0 2 \; -349.708 58.1553 \; \;; +#X scalar trace-template 125 0 7 \; -295.493 57.8245 \; -292.472 58.7783 +\; -290.459 59.449 \; -290.142 56.291 \; \;; +#X scalar trace-template 130 0 4 \; -330.477 45.5384 \; -330.271 47.7032 +\; \;; +#X scalar trace-template 130 0 2 \; -345.678 51.4742 \; \;; +#X scalar trace-template 135 0 8 \; -282.598 55.6295 \; \;; +#X scalar trace-template 140 0 2 \; -325.999 50.8365 \; -325.802 49.8431 +\; \;; +#X scalar trace-template 145 0 8 \; -284.439 55.5084 \; \;; +#X scalar trace-template 145 0 4 \; -300.827 56.2008 \; \;; +#X scalar trace-template 150 0 7 \; -292.842 58.4013 \; -295.507 63.9292 +\; -295.819 63.2863 \; -296.521 58.7481 \; -296.552 54.9325 \; \;; +#X scalar trace-template 155 0 8 \; -281.831 54.4155 \; -283.278 54.6575 +\; -283.95 55.4649 \; -284.509 57.7758 \; -284.535 55.9143 \; \;; +#X scalar trace-template 155 0 4 \; -329.412 47.5286 \; \;; +#X scalar trace-template 155 0 2 \; -345.383 57.572 \; -345.507 60.2884 +\; -345.523 60.771 \; -345.468 60.1862 \; -345.455 60.2852 \; -345.509 +61.2055 \; -345.531 62.0587 \; -345.533 62.1396 \; -345.49 61.5193 +\; -345.517 60.4321 \; -345.667 58.9602 \; -345.813 57.1448 \; -345.754 +55.766 \; -345.54 56.4602 \; -345.628 58.9323 \; -345.746 60.646 \; +-345.77 60.0663 \; -345.676 58.1189 \; -345.639 57.3838 \; -345.742 +58.2583 \; -345.838 58.7581 \; -345.81 57.6209 \; -345.65 54.6219 \; +-345.623 51.4752 \; -345.785 51.3769 \; -345.762 53.1201 \; -345.679 +54.497 \; -345.589 55.0109 \; -345.378 54.429 \; -345.454 53.1154 \; +-345.782 50.7676 \; -346.038 46.6522 \; \;; +#X scalar trace-template 165 0 4 \; -325.894 48.8069 \; \;; +#X scalar trace-template 175 0 4 \; -356.334 50.4569 \; -356.247 48.779 +\; \;; +#X scalar trace-template 180 0 7 \; -301.117 55.838 \; \;; +#X scalar trace-template 185 0 8 \; -293.464 57.0721 \; -293.753 57.0661 +\; -294.981 57.0223 \; -297.216 56.2156 \; \;; +#X scalar trace-template 190 0 7 \; -284.577 56.1343 \; -285.086 55.975 +\; -286.97 53.0988 \; -287.551 52.728 \; -286.578 55.3239 \; -284.885 +56.8688 \; \;; +#X scalar trace-template 190 0 4 \; -329.396 44.9186 \; \;; +#X scalar trace-template 200 0 4 \; -356.528 50.0702 \; -356.496 50.6276 +\; \;; +#X scalar trace-template 210 0 8 \; -295.441 55.6799 \; -294.951 58.3704 +\; -295.644 61.4334 \; -297.353 62.7345 \; -296.066 61.0116 \; -295.537 +60.5778 \; -295.446 60.8182 \; -295.239 58.1317 \; \;; +#X scalar trace-template 215 0 4 \; -330.67 41.5127 \; \;; +#X scalar trace-template 225 0 7 \; -356.732 50.5829 \; \;; +#X scalar trace-template 225 0 4 \; -360.188 48.7845 \; \;; +#X scalar trace-template 235 0 7 \; -284.799 58.4955 \; -287.641 56.0973 +\; \;; +#X scalar trace-template 235 0 4 \; -329.661 51.9938 \; -330.138 53.1038 +\; -329.39 54.2691 \; -329.734 53.1496 \; \;; +#X scalar trace-template 245 0 1 \; -260.175 66.9136 \; \;; +#X scalar trace-template 250 0 7 \; -267.795 67.3388 \; -268.428 67.3402 +\; -267.07 68.3468 \; -267.837 66.8513 \; \;; +#X scalar trace-template 255 0 8 \; -284.316 57.3983 \; -283.738 54.7765 +\; \;; +#X scalar trace-template 255 0 1 \; -325.406 52.7829 \; -324.615 54.9147 +\; -324.294 57.288 \; -324.203 57.6853 \; -324.273 56.0984 \; -324.209 +53.9155 \; -325.029 52.9128 \; -325.562 55.9452 \; -324.674 57.6779 +\; -324.482 58.8515 \; -324.643 57.2996 \; -324.523 53.9698 \; \;; +#X scalar trace-template 260 0 4 \; -295.676 57.6808 \; -295.75 61.0421 +\; -297.136 60.2708 \; -296.992 56.8811 \; \;; +#X scalar trace-template 265 0 5 \; -330.003 52.1627 \; -329.553 53.0198 +\; -330.136 52.8048 \; -330.274 50.2378 \; \;; +#X scalar trace-template 270 0 8 \; -260.362 66.6159 \; -259.998 68.775 +\; -260.288 70.3227 \; -259.894 69.741 \; -259.523 69.4534 \; -259.486 +69.6885 \; -259.472 69.4197 \; -259.617 67.6515 \; -262.87 64.1605 +\; -267.153 62.3537 \; -268.824 61.8898 \; -267.318 64.0126 \; \;; +#X scalar trace-template 275 0 7 \; -284.716 57.0074 \; -284.733 55.4572 +\; -281.928 50.336 \; \;; +#X scalar trace-template 285 0 4 \; -295.401 56.6608 \; -295.098 61.4652 +\; -294.829 63.4592 \; -294.418 63.3665 \; -294.913 61.2281 \; -290.185 +54.9899 \; \;; +#X scalar trace-template 290 0 5 \; -349.939 56.9469 \; -349.947 58.3829 +\; -349.905 58.8964 \; -349.904 58.0441 \; \;; +#X scalar trace-template 295 0 7 \; -284.524 52.6894 \; -284.753 54.1151 +\; \;; +#X scalar trace-template 310 0 7 \; -296.863 57.1286 \; \;; +#X scalar trace-template 315 0 5 \; -284.816 53.9214 \; -284.596 54.9496 +\; \;; +#X scalar trace-template 320 0 7 \; -320.171 51.9045 \; -320.347 51.3616 +\; -322.505 53.1322 \; -324.186 54.2687 \; -324.502 54.4695 \; \;; +#X scalar trace-template 320 0 4 \; -329.516 50.9914 \; -329.725 49.6337 +\; -329.542 49.0654 \; \;; +#X scalar trace-template 320 0 2 \; -350.616 44.3007 \; -349.136 39.8323 +\; -349.706 44.8691 \; -349.938 50.5439 \; -350.159 53.5943 \; -350.112 +55.4278 \; \;; +#X scalar trace-template 320 0 1 \; -363.542 53.8649 \; \;; +#X scalar trace-template 330 0 5 \; -259.247 64.5953 \; -259.259 67.1753 +\; -259.361 68.9221 \; -259.778 70.1734 \; -259.63 70.295 \; -259.791 +69.9517 \; -258.949 67.496 \; \;; +#X scalar trace-template 330 0 1 \; -294.874 59.6277 \; -294.569 60.6568 +\; -293.491 60.5702 \; -295.325 59.6616 \; -295.557 58.3896 \; -294.992 +56.3442 \; -294.978 55.5158 \; -292.896 56.9972 \; -292.411 58.1426 +\; -289.819 58.4956 \; -291.533 55.9555 \; -291.911 56.1568 \; -289.755 +56.6256 \; -290.9 54.5125 \; -291.945 57.3661 \; -290.122 58.9368 \; +-286.596 55.7548 \; \;; +#X scalar trace-template 335 0 9 \; -237.005 59.1482 \; -238.073 61.6695 +\; -238.836 63.0239 \; -239.009 62.1566 \; -238.742 60.0554 \; -239.431 +59.83 \; -239.46 61.1191 \; -239.544 61.8287 \; -240.597 62.3122 \; +-240.803 62.7475 \; -240.157 62.7397 \; -240.643 62.9889 \; -240.646 +63.5014 \; -239.535 62.9037 \; -238.322 61.0068 \; -239.465 60.0128 +\; -240.84 59.9064 \; \;; +#X scalar trace-template 335 0 8 \; -345.352 53.4543 \; -345.419 54.423 +\; -345.578 54.6303 \; -345.653 53.7819 \; -345.435 50.5486 \; -344.958 +47.408 \; -344.949 45.1376 \; \;; +#X scalar trace-template 340 0 4 \; -359.773 42.1258 \; \;; +#X scalar trace-template 350 0 7 \; -281.74 47.8143 \; \;; +#X scalar trace-template 350 0 4 \; -319.707 53.5851 \; \;; +#X scalar trace-template 355 0 2 \; -324.763 55.4632 \; -324.598 58.0268 +\; -324.417 58.4832 \; -324.31 57.1883 \; -324.716 53.63 \; -324.911 +52.6199 \; \;; +#X scalar trace-template 360 0 7 \; -286.767 55.6536 \; -285.371 56.8644 +\; \;; +#X scalar trace-template 360 0 4 \; -350.076 58.1741 \; \;; +#X scalar trace-template 370 0 5 \; -267.823 66.7676 \; -267.617 66.2574 +\; -268.521 64.7118 \; -267.715 64.1857 \; -268.197 63.5378 \; \;; +#X scalar trace-template 370 0 4 \; -300.553 54.778 \; -298.021 52.3256 +\; -298.507 54.8007 \; -300.353 55.6097 \; \;; +#X scalar trace-template 375 0 8 \; -329.626 44.5155 \; -330.072 42.9968 +\; -330.81 42.5293 \; -330.889 42.7742 \; -330.559 42.9291 \; -331.103 +41.2239 \; \;; +#X scalar trace-template 375 0 7 \; -350.292 55.4035 \; \;; +#X scalar trace-template 385 0 7 \; -320.39 52.7026 \; \;; +#X scalar trace-template 390 0 2 \; -324.542 55.3817 \; -324.707 57.0009 +\; -324.544 57.5226 \; -324.899 55.5216 \; \;; +#X scalar trace-template 395 0 7 \; -259.027 64.4146 \; -259.007 66.9203 +\; -259.441 69.1434 \; -259.5 70.1276 \; -259.89 70.7056 \; -259.916 +69.7508 \; -260.128 68.3644 \; -260.331 65.6348 \; -267.385 63.6946 +\; \;; +#X scalar trace-template 395 0 4 \; -350.225 56.0847 \; -350.217 58.4649 +\; -350.1 59.1759 \; \;; +#X scalar trace-template 400 0 5 \; -345.488 51.8104 \; -345.665 52.719 +\; -345.633 50.7978 \; -345.605 48.4163 \; -345.948 47.7253 \; -346.224 +49.8565 \; -345.932 52.1893 \; -345.638 53.757 \; -345.479 53.9585 +\; -345.43 53.4346 \; \;; +#X scalar trace-template 410 0 8 \; -300.379 54.217 \; -297.547 58.6683 +\; -295.217 59.6517 \; -292.936 55.7664 \; -295.09 54.4867 \; \;; +#X scalar trace-template 415 0 4 \; -320.477 53.3217 \; \;; +#X scalar trace-template 415 0 2 \; -330.91 44.7758 \; -330.491 46.8739 +\; -330.23 48.1383 \; -330.09 48.4249 \; \;; +#X scalar trace-template 420 0 1 \; -324.662 52.6471 \; -324.826 53.9825 +\; -324.672 55.4613 \; \;; +#X scalar trace-template 425 0 9 \; -299.778 57.1575 \; \;; +#X scalar trace-template 425 0 4 \; -350.297 55.9899 \; \;; +#X scalar trace-template 435 0 9 \; -238.899 61.5224 \; -239.72 62.7197 +\; -240.208 62.8918 \; \;; +#X scalar trace-template 435 0 4 \; -290.04 57.5717 \; -289.683 58.866 +\; -285.585 57.3138 \; \;; +#X scalar trace-template 440 0 8 \; -299.946 52.3215 \; -295.495 53.742 +\; \;; +#X scalar trace-template 440 0 2 \; -320.287 54.1989 \; \;; +#X scalar trace-template 440 0 1 \; -350.833 47.8947 \; -350.51 51.3149 +\; \;; +#X scalar trace-template 445 0 7 \; -267.276 64.2333 \; \;; +#X restore 351 494 pd trace-list; #N canvas 56 84 527 179 trace-template 0; -#X obj 93 72 plot bazoo 0 1 0 500 5; -#X obj 96 36 template float x float y float voiceno array bazoo point-template; -#X text 93 93 This template describes a pitch/amplitude trace. The array "bazoo" holds the actual points. In this template \, y is always 0 and x is the starting location in pixels. There are 5 pixels per point.; -#X restore 270 537 pd trace-template; +#X obj 121 72 plot bazoo 0 1 0 500 5; +#X obj 125 36 template float x float y float voiceno array bazoo point-template +; +#X text 121 93 This template describes a pitch/amplitude trace. The +array "bazoo" holds the actual points. In this template \, y is always +0 and x is the starting location in pixels. There are 5 pixels per +point.; +#X restore 351 537 pd trace-template; #N canvas 96 258 494 158 point-template 0; -#X text 98 56 This template describes a single point on a pitch trace (cf. trace-template w describes the trace itself.); -#X obj 163 14 template float y float amp; -#X text 98 89 "y" is the field that is shown on the graph \; it's - 4 * pitch. You also get an "amp" field in dB \, which you can't see as a plot (yet).; -#X restore 270 557 pd point-template; -#X msg 574 506 bang; -#X obj 6 425 pack 0 100; -#X obj 6 449 line~; -#X obj 6 405 dbtorms; -#X floatatom 419 70; +#X text 127 56 This template describes a single point on a pitch trace +(cf. trace-template w describes the trace itself.); +#X obj 212 14 template float y float amp; +#X text 127 89 "y" is the field that is shown on the graph \; it's +- 4 * pitch. You also get an "amp" field in dB \, which you can't see +as a plot (yet).; +#X restore 351 557 pd point-template; +#X msg 746 506 bang; +#X obj 8 425 pack 0 100; +#X obj 8 449 line~; +#X obj 8 405 dbtorms; +#X floatatom 545 70 0 0 0 0 - - -; #N canvas 194 37 730 722 output 0; -#X obj 227 76 t b f; -#X obj 220 100 +; -#X obj 396 207 f; -#X obj 409 165 f; -#X obj 276 210 f; -#X obj 64 179 t b; -#X obj 63 127 f; -#X obj 55 58 inlet; -#X text 60 37 mute; -#X obj 64 201 f; -#X msg 181 153 0; -#X msg 57 84 bang; -#X obj 64 155 moses 1; -#X obj 178 69 t b f; -#X obj 171 93 +; -#X obj 139 27 r loop-amp; -#X obj 304 26 r osc-amp; -#X obj 64 236 s loop-amp; -#X obj 276 235 s osc-amp; -#X obj 455 125 print; -#X obj 143 148 f; -#X obj 288 168 f; -#X obj 173 120 t b b; -#X obj 425 23 r grain-amp; -#X obj 397 232 s grain-amp; +#X obj 295 76 t b f; +#X obj 286 100 +; +#X obj 515 207 f; +#X obj 532 165 f; +#X obj 359 210 f; +#X obj 83 179 t b; +#X obj 82 127 f; +#X obj 71 58 inlet; +#X text 78 37 mute; +#X obj 83 201 f; +#X msg 235 153 0; +#X msg 74 84 bang; +#X obj 83 155 moses 1; +#X obj 231 69 t b f; +#X obj 222 93 +; +#X obj 181 27 r loop-amp; +#X obj 395 26 r osc-amp; +#X obj 83 236 s loop-amp; +#X obj 359 235 s osc-amp; +#X obj 591 125 print; +#X obj 186 148 f; +#X obj 374 168 f; +#X obj 225 120 t b b; +#X obj 552 23 r grain-amp; +#X obj 516 232 s grain-amp; #X connect 0 0 1 0; #X connect 0 1 1 1; #X connect 1 0 6 1; @@ -151,46 +518,46 @@ #X connect 22 1 3 0; #X connect 23 0 3 1; #X connect 23 0 0 0; -#X restore 631 69 pd output; +#X restore 820 69 pd output; #N canvas 516 98 663 559 /SUBPATCH/ 0; -#X obj 79 108 outlet; -#X msg 78 80 set \$1; -#X obj 79 57 r loop-amp; +#X obj 103 108 outlet; +#X msg 101 80 set \$1; +#X obj 103 57 r loop-amp; #X connect 1 0 0 0; #X connect 2 0 1 0; -#X restore 419 50 pd; +#X restore 545 50 pd; #N canvas 209 96 518 375 fft 0; -#X floatatom 235 194; -#X obj 349 160 r sample-rate; -#X obj 349 180 t b f; -#X obj 234 169 r window-size; -#X obj 203 38 r sample-rate; -#X obj 183 16 r window-size; -#X obj 203 58 t b f; -#X obj 183 83 /; -#X obj 131 103 bang~; -#X obj 130 175 line~; -#X obj 183 104 * 1000; -#X text 229 104 window size (msec); -#X obj 129 281 rfft~; -#X obj 131 337 tabsend~ fft-real; -#X obj 159 307 tabsend~ fft-imag; -#X obj 330 140 r location; -#X obj 330 205 *; -#X obj 330 228 * 0.001; -#X text 383 228 location (samples); -#X obj 130 129 f; -#X msg 130 152 0 \, 1 \$1; -#X obj 87 201 *~; -#X obj 87 224 -~; -#X obj 62 301 *~; -#X obj 62 324 outlet~; -#X floatatom 330 252; -#X obj 41 127 s fft-done; -#X obj 51 31 block~ 2048 1; -#X obj 129 255 tabread4~ sample; -#X obj 130 211 *~ 0; -#X obj 129 232 +~ 0; +#X floatatom 305 194 0 0 0 0 - - -; +#X obj 454 160 r sample-rate; +#X obj 454 180 t b f; +#X obj 304 169 r window-size; +#X obj 264 38 r sample-rate; +#X obj 238 16 r window-size; +#X obj 264 58 t b f; +#X obj 238 83 /; +#X obj 170 103 bang~; +#X obj 169 175 line~; +#X obj 238 104 * 1000; +#X text 298 104 window size (msec); +#X obj 168 281 rfft~; +#X obj 170 337 tabsend~ fft-real; +#X obj 207 307 tabsend~ fft-imag; +#X obj 429 140 r location; +#X obj 429 205 *; +#X obj 429 228 * 0.001; +#X text 498 228 location (samples); +#X obj 169 129 f; +#X msg 169 152 0 \, 1 \$1; +#X obj 113 201 *~; +#X obj 113 224 -~; +#X obj 81 301 *~; +#X obj 81 324 outlet~; +#X floatatom 429 252 0 0 0 0 - - -; +#X obj 53 127 s fft-done; +#X obj 66 31 block~ 2048 1; +#X obj 168 255 tabread4~ sample; +#X obj 169 211 *~ 0; +#X obj 168 232 +~ 0; #X connect 1 0 2 0; #X connect 2 0 16 0; #X connect 2 1 16 1; @@ -223,121 +590,121 @@ #X connect 28 0 23 1; #X connect 29 0 30 0; #X connect 30 0 28 0; -#X restore 17 470 pd fft; -#X obj 6 493 *~; -#X obj 7 544 hip~ 5; -#X obj 7 571 dac~; -#X obj 580 529 adc~; -#X obj 419 91 s loop-amp; -#X msg 631 48 mute; -#X text 13 127 click here first; -#X text 570 489 live sample; -#X text 521 25 AMPLITUDES; +#X restore 22 470 pd fft; +#X obj 8 493 *~; +#X obj 9 544 hip~ 5; +#X obj 9 571 dac~; +#X obj 754 529 adc~; +#X obj 545 91 s loop-amp; +#X msg 820 48 mute; +#X text 18 97 click here first; +#X text 741 489 live sample; +#X text 677 25 AMPLITUDES; #N canvas 5 1 864 622 make-trace 0; -#X obj 143 220 * -0.33333; -#X obj 70 216 * 10; -#X obj 91 136 pointer; -#X msg 91 115 next; -#X obj 91 97 until; -#X obj 298 134 pointer; -#X msg 299 108 next; -#X obj 154 330 unpack; -#X obj 196 332 s amp; -#X obj 218 378 s frequency; -#X obj 231 361 s pitch; -#X obj 193 375 f 0; -#X obj 154 348 t b b b b f; -#X obj 601 133 pointer; -#X obj 572 602 setsize trace-template bazoo; -#X obj 572 514 random 200; -#X obj 572 532 + 100; -#X obj 659 526 pointer; -#X obj 168 532 pointer; -#X floatatom 274 524; -#X floatatom 228 550; -#X msg 158 509 bang; -#X floatatom 83 461; -#X floatatom 31 509; -#X floatatom 118 590; -#X floatatom 397 556; -#X floatatom 274 489; -#X floatatom 513 511; -#X obj 370 464 pointer; -#X msg 391 447 next; -#X floatatom 409 512; -#X obj 397 539 getsize trace-template bazoo; -#X obj 98 563 get point-template y; -#X obj 31 533 set point-template y; -#X obj 78 486 element trace-template bazoo; -#X obj 228 580 setsize trace-template bazoo; -#X obj 274 507 set trace-template x; -#X obj 274 542 set trace-template y; -#X msg 572 497 bang; -#X obj 572 549 append trace-template x; -#X obj 399 489 get trace-template x y; -#X obj 572 567 t b p; -#X msg 572 584 5; -#X obj 628 93 s clear-traces; -#X obj 602 155 s last-in-list; -#X msg 600 43 bang; -#X obj 600 60 t b b; -#X obj 573 156 f 0; -#X obj 572 176 s nframe; -#X obj 342 337 r nframe; -#X obj 330 356 f; -#X obj 330 373 + 1; -#X obj 330 391 s nframe; -#X obj 330 296 r done-frame; -#X obj 336 315 s done-adding-traces; -#X obj 15 309 r component; -#X obj 15 326 unpack; -#X obj 56 331 s amp; -#X obj 80 370 s frequency; -#X obj 92 354 s pitch; -#X obj 54 388 s added-to-trace; -#X obj 54 370 f 0; -#X obj 48 408 s add-to-trace; -#X obj 15 344 t b b b b f; -#X obj 600 25 r clear-all; -#X obj 154 311 r component2; -#X obj 193 393 s started-new-trace; -#X obj 185 414 s start-new-trace; -#X obj 273 41 r done-analysis; -#X obj 273 62 t b b b b; -#X obj 225 176 r added-to-trace; -#X obj 299 89 until; -#X obj 351 172 get peak-template x amp; -#X obj 425 195 * -0.33333; -#X obj 351 190 * 10; -#X obj 351 210 pack; -#X obj 351 226 s component; -#X obj 92 337 ftom; -#X obj 298 155 t b p p; -#X obj 197 196 set peak-template used; -#X obj 199 176 f; -#X obj 232 344 ftom; -#X msg 135 31 \; done-frame bang; -#X obj 16 178 get peak-template used x amp; -#X obj 27 236 pack 0 0 0; -#X obj 27 255 route 0; -#X obj 27 272 s component2; -#X obj 422 260 print x1; -#X obj 174 276 print x2; -#X obj 559 255 add-trace 1; -#X obj 560 274 add-trace 2; -#X obj 560 291 add-trace 3; -#X obj 559 309 add-trace 4; -#X obj 560 328 add-trace 5; -#X obj 560 345 add-trace 6; -#X obj 560 363 add-trace 7; -#X obj 561 381 add-trace 8; -#X obj 561 399 add-trace 9; -#X obj 561 417 add-trace 10; -#X msg 372 111 traverse pd-peak-list; -#X msg 601 115 traverse pd-trace-list \, bang; -#X msg 641 59 \; pd-trace-list clear; -#X msg 370 430 traverse pd-trace-list \, next; -#X msg 659 509 traverse pd-trace-list \, bang; +#X obj 186 220 * -0.33333; +#X obj 91 216 * 10; +#X obj 118 136 pointer; +#X msg 118 115 next; +#X obj 118 97 until; +#X obj 387 134 pointer; +#X msg 389 108 next; +#X obj 200 330 unpack; +#X obj 255 332 s amp; +#X obj 283 378 s frequency; +#X obj 300 361 s pitch; +#X obj 251 375 f 0; +#X obj 200 348 t b b b b f; +#X obj 781 133 pointer; +#X obj 744 602 setsize trace-template bazoo; +#X obj 744 514 random 200; +#X obj 744 532 + 100; +#X obj 857 526 pointer; +#X obj 218 532 pointer; +#X floatatom 356 524 0 0 0 0 - - -; +#X floatatom 296 550 0 0 0 0 - - -; +#X msg 205 509 bang; +#X floatatom 108 461 0 0 0 0 - - -; +#X floatatom 40 509 0 0 0 0 - - -; +#X floatatom 153 590 0 0 0 0 - - -; +#X floatatom 516 556 0 0 0 0 - - -; +#X floatatom 356 489 0 0 0 0 - - -; +#X floatatom 667 511 0 0 0 0 - - -; +#X obj 481 464 pointer; +#X msg 508 447 next; +#X floatatom 532 512 0 0 0 0 - - -; +#X obj 516 539 getsize trace-template bazoo; +#X obj 127 563 get point-template y; +#X obj 40 533 set point-template y; +#X obj 101 486 element trace-template bazoo; +#X obj 296 580 setsize trace-template bazoo; +#X obj 356 507 set trace-template x; +#X obj 356 542 set trace-template y; +#X msg 744 497 bang; +#X obj 744 549 append trace-template x; +#X obj 519 489 get trace-template x y; +#X obj 744 567 t b p; +#X msg 744 584 5; +#X obj 816 93 s clear-traces; +#X obj 783 155 s last-in-list; +#X msg 780 43 bang; +#X obj 780 60 t b b; +#X obj 745 156 f 0; +#X obj 744 176 s nframe; +#X obj 445 337 r nframe; +#X obj 429 356 f; +#X obj 429 373 + 1; +#X obj 429 391 s nframe; +#X obj 429 296 r done-frame; +#X obj 437 315 s done-adding-traces; +#X obj 19 309 r component; +#X obj 19 326 unpack; +#X obj 73 331 s amp; +#X obj 104 370 s frequency; +#X obj 120 354 s pitch; +#X obj 70 388 s added-to-trace; +#X obj 70 370 f 0; +#X obj 62 408 s add-to-trace; +#X obj 19 344 t b b b b f; +#X obj 780 25 r clear-all; +#X obj 200 311 r component2; +#X obj 251 393 s started-new-trace; +#X obj 240 414 s start-new-trace; +#X obj 355 41 r done-analysis; +#X obj 355 62 t b b b b; +#X obj 292 176 r added-to-trace; +#X obj 389 89 until; +#X obj 456 172 get peak-template x amp; +#X obj 552 195 * -0.33333; +#X obj 456 190 * 10; +#X obj 456 210 pack; +#X obj 456 226 s component; +#X obj 120 337 ftom; +#X obj 387 155 t b p p; +#X obj 256 196 set peak-template used; +#X obj 259 176 f; +#X obj 302 344 ftom; +#X msg 175 31 \; done-frame bang; +#X obj 21 178 get peak-template used x amp; +#X obj 35 236 pack 0 0 0; +#X obj 35 255 route 0; +#X obj 35 272 s component2; +#X obj 549 260 print x1; +#X obj 226 276 print x2; +#X obj 727 255 add-trace 1; +#X obj 728 274 add-trace 2; +#X obj 728 291 add-trace 3; +#X obj 727 309 add-trace 4; +#X obj 728 328 add-trace 5; +#X obj 728 345 add-trace 6; +#X obj 728 363 add-trace 7; +#X obj 729 381 add-trace 8; +#X obj 729 399 add-trace 9; +#X obj 729 417 add-trace 10; +#X msg 484 111 traverse pd-peak-list; +#X msg 781 115 traverse pd-trace-list \, bang; +#X msg 833 59 \; pd-trace-list clear; +#X msg 481 430 traverse pd-trace-list \, next; +#X msg 857 509 traverse pd-trace-list \, bang; #X connect 0 0 84 2; #X connect 1 0 84 1; #X connect 2 0 83 0; @@ -432,97 +799,99 @@ #X connect 100 0 13 0; #X connect 102 0 28 0; #X connect 103 0 17 0; -#X restore 270 474 pd make-trace; -#X floatatom 4 289; +#X restore 351 474 pd make-trace; +#X floatatom 5 289 0 0 0 0 - - -; #N canvas 0 0 955 721 arrays 0; -#X msg 30 202 \; fft-real resize 4096 \; fft-imag resize 4096; -#X graph graph1 0 -1 4096 1 332 341 732 41; -#X array fft-real 4096 float; -#X pop; -#X graph graph2 0 -1 4096 1 322 565 722 265; -#X array fft-imag 4096 float; -#X pop; -#X restore 439 515 pd arrays; -#X obj 4 309 s location; -#X obj 95 412 r loop-amp; -#X obj 567 288 f; -#X obj 4 248 r location; -#X msg 4 268 set \$1; -#X obj 598 288 +; -#X obj 567 309 moses 900; -#X msg 535 329 0; -#X msg 534 247 1; -#X msg 566 335 \; location \$1 \; snapshot bang; -#X msg 504 177 bang \; location 0 \; clear-all bang; -#X floatatom 504 305; -#X obj 504 225 t b b; -#X obj 645 270 r incr; -#X obj 6 385 r grain-amp; -#X obj 93 473 r osc-amp; -#X obj 110 553 catch~ osc-sum; +#X msg 39 202 \; fft-real resize 4096 \; fft-imag resize 4096; +#N canvas 0 0 450 300 graph1 0; +#X array fft-real 4096 float 0; +#X coords 0 1 4096 -1 400 300 1; +#X restore 432 41 graph; +#N canvas 0 0 450 300 graph2 0; +#X array fft-imag 4096 float 0; +#X coords 0 1 4096 -1 400 300 1; +#X restore 419 265 graph; +#X restore 571 515 pd arrays; +#X obj 5 309 s location; +#X obj 123 412 r loop-amp; +#X obj 737 288 f; +#X obj 5 248 r location; +#X msg 5 268 set \$1; +#X obj 777 288 +; +#X obj 737 309 moses 900; +#X msg 695 329 0; +#X msg 694 247 1; +#X msg 736 335 \; location \$1 \; snapshot bang; +#X msg 655 170 bang \; location 0 \; clear-all bang; +#X floatatom 655 305 0 0 0 0 - - -; +#X obj 655 225 t b b; +#X obj 838 270 r incr; +#X obj 8 385 r grain-amp; +#X obj 121 473 r osc-amp; +#X obj 143 553 catch~ osc-sum; #N canvas 102 67 751 619 osc-bank 0; -#X obj 239 433 osc-voice; -#X obj 223 451 osc-voice; -#X obj 207 471 osc-voice; -#X obj 191 490 osc-voice; -#X obj 175 510 osc-voice; -#X obj 159 528 osc-voice; -#X obj 143 547 osc-voice; -#X obj 127 566 osc-voice; -#X obj 111 586 osc-voice; -#X obj 95 410 route 1 2 3 4 5 6 7 8 9 10; -#X msg 290 269 0; -#X obj 560 489 pointer; -#X floatatom 652 417; -#X obj 479 351 pointer; -#X msg 422 491 next; -#X floatatom 479 419; -#X obj 178 111 pointer; -#X floatatom 283 104; -#X floatatom 238 129; -#X msg 168 88 bang; -#X floatatom 92 40; -#X floatatom 41 88; -#X floatatom 127 169; -#X floatatom 420 137; -#X floatatom 283 69; -#X floatatom 523 90; -#X obj 425 43 pointer; -#X msg 447 27 next; -#X floatatom 419 92; -#X obj 420 120 getsize trace-template bazoo; -#X obj 108 142 get point-template y; -#X obj 41 113 set point-template y; -#X obj 87 66 element trace-template bazoo; -#X obj 238 159 setsize trace-template bazoo; -#X obj 283 86 set trace-template x; -#X obj 283 121 set trace-template y; -#X obj 409 68 get trace-template x y; -#X floatatom 403 312; -#X msg 403 288 1; -#X msg 434 288 0; -#X obj 479 451 <; -#X obj 479 398 get trace-template x voiceno; -#X obj 479 374 t p p; -#X obj 302 337 until; -#X obj 477 233 r start-resynth; -#X obj 481 255 t b b; -#X obj 388 353 f; -#X obj 388 372 sel 0 1; -#X obj 514 436 r synth-index; -#X obj 478 555 pack f p; -#X obj 479 470 sel 0 1; -#X obj 235 230 r step-resynth; -#X obj 291 288 f; -#X obj 291 308 s synth-index; -#X obj 489 523 f; -#X obj 322 289 + 5; -#X obj 478 490 t b b b; -#X obj 235 252 t b b b; -#X obj 216 301 s osc-tick; -#X obj 95 604 osc-voice; -#X msg 425 10 traverse pd-trace-list \, next; -#X msg 478 288 traverse pd-trace-list \, next; +#X obj 311 433 osc-voice; +#X obj 290 451 osc-voice; +#X obj 269 471 osc-voice; +#X obj 248 490 osc-voice; +#X obj 227 510 osc-voice; +#X obj 207 528 osc-voice; +#X obj 186 547 osc-voice; +#X obj 165 566 osc-voice; +#X obj 144 586 osc-voice; +#X obj 123 410 route 1 2 3 4 5 6 7 8 9 10; +#X msg 377 269 0; +#X obj 728 489 pointer; +#X floatatom 848 417 0 0 0 0 - - -; +#X obj 623 351 pointer; +#X msg 549 491 next; +#X floatatom 623 419 0 0 0 0 - - -; +#X obj 231 111 pointer; +#X floatatom 368 104 0 0 0 0 - - -; +#X floatatom 309 129 0 0 0 0 - - -; +#X msg 218 88 bang; +#X floatatom 120 40 0 0 0 0 - - -; +#X floatatom 53 88 0 0 0 0 - - -; +#X floatatom 165 169 0 0 0 0 - - -; +#X floatatom 546 137 0 0 0 0 - - -; +#X floatatom 368 69 0 0 0 0 - - -; +#X floatatom 680 90 0 0 0 0 - - -; +#X obj 552 43 pointer; +#X msg 581 27 next; +#X floatatom 545 92 0 0 0 0 - - -; +#X obj 546 120 getsize trace-template bazoo; +#X obj 140 142 get point-template y; +#X obj 53 113 set point-template y; +#X obj 113 66 element trace-template bazoo; +#X obj 309 159 setsize trace-template bazoo; +#X obj 368 86 set trace-template x; +#X obj 368 121 set trace-template y; +#X obj 532 68 get trace-template x y; +#X floatatom 524 312 0 0 0 0 - - -; +#X msg 524 288 1; +#X msg 564 288 0; +#X obj 623 451 <; +#X obj 623 398 get trace-template x voiceno; +#X obj 623 374 t p p; +#X obj 393 337 until; +#X obj 620 233 r start-resynth; +#X obj 625 255 t b b; +#X obj 504 353 f; +#X obj 504 372 sel 0 1; +#X obj 668 436 r synth-index; +#X obj 621 555 pack f p; +#X obj 623 470 sel 0 1; +#X obj 305 230 r step-resynth; +#X obj 378 288 f; +#X obj 378 308 s synth-index; +#X obj 636 523 f; +#X obj 419 289 + 5; +#X obj 621 490 t b b b; +#X obj 305 252 t b b b; +#X obj 281 301 s osc-tick; +#X obj 123 604 osc-voice; +#X msg 552 10 traverse pd-trace-list \, next; +#X msg 621 288 traverse pd-trace-list \, next; #X connect 9 0 59 0; #X connect 9 1 8 0; #X connect 9 2 7 0; @@ -593,31 +962,31 @@ #X connect 57 2 52 0; #X connect 60 0 26 0; #X connect 61 0 13 0; -#X restore 439 494 pd osc-bank; -#X obj 498 92 s grain-amp; +#X restore 571 494 pd osc-bank; +#X obj 646 95 s grain-amp; #N canvas 31 70 662 326 save-list 0; -#X floatatom 584 255; -#X floatatom 521 254; -#X floatatom 461 251; -#X floatatom 398 250; -#X obj 335 206 pointer; -#X obj 236 121 pointer; -#X msg 252 47 bang; -#X obj 117 200 rmstodb; -#X obj 8 201 * 0.1; -#X obj 116 220 * -3; -#X floatatom 342 247; -#X obj 234 27 r start-analysis; -#X obj 235 71 t b b; -#X msg 351 185 next; -#X obj 331 227 get peak-template x y amp ampreal ampimag; -#X obj 7 241 append peak-template x y amp ampreal ampimag; -#X obj 96 138 r found-peak; -#X obj 97 161 unpack 0 0 0 0 0; -#X msg 62 201 330; -#X msg 274 69 \; pd-peak-list clear; -#X msg 235 100 traverse pd-peak-list \, bang; -#X msg 336 166 traverse pd-peak-list \, next; +#X floatatom 759 255 0 0 0 0 - - -; +#X floatatom 677 254 0 0 0 0 - - -; +#X floatatom 599 251 0 0 0 0 - - -; +#X floatatom 517 250 0 0 0 0 - - -; +#X obj 435 206 pointer; +#X obj 307 121 pointer; +#X msg 328 47 bang; +#X obj 152 200 rmstodb; +#X obj 10 201 * 0.1; +#X obj 151 220 * -3; +#X floatatom 445 247 0 0 0 0 - - -; +#X obj 304 27 r start-analysis; +#X obj 305 71 t b b; +#X msg 456 185 next; +#X obj 430 227 get peak-template x y amp ampreal ampimag; +#X obj 9 241 append peak-template x y amp ampreal ampimag; +#X obj 125 138 r found-peak; +#X obj 126 161 unpack 0 0 0 0 0; +#X msg 81 201 330; +#X msg 356 69 \; pd-peak-list clear; +#X msg 305 100 traverse pd-peak-list \, bang; +#X msg 437 166 traverse pd-peak-list \, next; #X connect 4 0 14 0; #X connect 5 0 15 5; #X connect 6 0 12 0; @@ -642,51 +1011,52 @@ #X connect 18 0 15 1; #X connect 20 0 5 0; #X connect 21 0 4 0; -#X restore 270 431 pd save-list; -#X msg 6 144 \; pd dsp 1 \; window-size 2048 \; sample-rate 44100 \; f-threshold 40 \; incr 10 \; clear-all bang; -#X obj 567 245 metro 150; -#X floatatom 242 309; -#X floatatom 290 309; -#X msg 107 349 \; start-resynth bang; -#X msg 242 350 \; step-resynth bang; -#X obj 242 329 metro 100; -#X msg 368 350 \; osc-stop bang; -#X text 605 107 resynth; -#X text 491 106 analyzed grains; -#X text 423 106 original; -#X text 502 158 ... and here third to analyze; +#X restore 351 431 pd save-list; +#X msg 9 114 \; pd dsp 1 \; window-size 2048 \; sample-rate 44100 \; +f-threshold 40 \; incr 10 \; clear-all bang; +#X obj 737 245 metro 150; +#X floatatom 315 309 0 0 0 0 - - -; +#X floatatom 377 309 0 0 0 0 - - -; +#X msg 139 349 \; start-resynth bang; +#X msg 315 350 \; step-resynth bang; +#X obj 315 329 metro 100; +#X msg 478 350 \; osc-stop bang; +#X text 790 113 resynth; +#X text 642 112 analyzed grains; +#X text 554 112 original; +#X text 653 151 ... and here third to analyze; #N canvas 0 0 276 216 test 0; -#X floatatom 43 120; -#X obj 43 141 s loud; -#X msg 38 84 \; clear-all bang; -#X msg 39 52 \; snapshot bang; +#X floatatom 56 120 0 0 0 0 - - -; +#X obj 56 141 s loud; +#X msg 49 84 \; clear-all bang; +#X msg 51 52 \; snapshot bang; #X connect 0 0 1 0; -#X restore 438 538 pd test; -#X text 244 140 read a sample; -#X msg 165 163 \; read-sample ../sound/bell.aiff 44100; -#X msg 164 200 \; read-sample ../sound/voice.wav 32000; +#X restore 569 538 pd test; +#X text 317 140 read a sample; +#X msg 214 163 \; read-sample ../sound/bell.aiff 44100; +#X msg 213 200 \; read-sample ../sound/voice.wav 32000; #N canvas 190 43 405 461 test-signal 0; -#X obj 134 293 tabread4~ sample; -#X obj 134 268 line~; -#X obj 95 146 f; -#X obj 254 46 r insamprate; -#X obj 136 350 *~; -#X obj 164 351 dbtorms; -#X obj 164 328 inlet; -#X obj 135 415 outlet~; -#X obj 146 33 r insamplength; -#X msg 134 247 0 \, \$1 \$2; -#X obj 134 221 pack 0 0; -#X obj 209 190 /; -#X obj 299 99 * 0.001; -#X obj 135 388 hip~ 5; -#X obj 33 5 loadbang; -#X text 242 13 sample playback; -#X msg 33 25 1; -#X obj 33 69 metro 1000; -#X floatatom 33 48; -#X obj 255 75 t b b f; -#X obj 161 84 t b f; +#X obj 174 293 tabread4~ sample; +#X obj 174 268 line~; +#X obj 123 146 f; +#X obj 330 46 r insamprate; +#X obj 177 350 *~; +#X obj 213 351 dbtorms; +#X obj 213 328 inlet; +#X obj 175 415 outlet~; +#X obj 190 33 r insamplength; +#X msg 174 247 0 \, \$1 \$2; +#X obj 174 221 pack 0 0; +#X obj 272 190 /; +#X obj 389 99 * 0.001; +#X obj 175 388 hip~ 5; +#X obj 43 5 loadbang; +#X text 315 13 sample playback; +#X msg 43 25 1; +#X obj 43 69 metro 1000; +#X floatatom 43 48 0 0 0 0 - - -; +#X obj 331 75 t b b f; +#X obj 209 84 t b f; #X connect 0 0 4 0; #X connect 1 0 0 0; #X connect 2 0 10 0; @@ -711,28 +1081,34 @@ #X connect 20 0 16 0; #X connect 20 1 11 0; #X connect 20 1 2 1; -#X restore 96 436 pd test-signal; +#X restore 125 436 pd test-signal; #N canvas 132 255 634 331 insample 0; -#X graph graph1 0 -1 55408 1 199 168 599 18; -#X array sample 55409 float; -#X pop; -#X obj 19 70 r read-sample; -#X obj 19 95 unpack s f; -#X obj 53 121 s insamprate; -#X obj 19 171 soundfiler; -#X msg 19 147 read -resize \$1 sample; -#X obj 19 201 s insamplength; -#X msg 357 197 \; sample resize 220500 \; insamplength 220500; +#N canvas 0 0 450 300 graph1 0; +#X array sample 155948 float 0; +#X coords 0 1 155947 -1 400 150 1; +#X restore 259 18 graph; +#X obj 25 70 r read-sample; +#X obj 25 95 unpack s f; +#X obj 69 121 s insamprate; +#X obj 25 171 soundfiler; +#X msg 25 147 read -resize \$1 sample; +#X obj 25 201 s insamplength; +#X msg 464 197 \; sample resize 220500 \; insamplength 220500; #X connect 1 0 2 0; #X connect 2 0 5 0; #X connect 2 1 3 0; #X connect 4 0 6 0; #X connect 5 0 4 0; -#X restore 438 559 pd insample; -#X obj 572 553 tabwrite~ sample; -#X text 117 0 SINUSOID TRACKING; -#X text 99 259 to resynthesize \, "start" once and "step" ad lib. To stop \, stop stepping and hit osc-stop. Note resynth ampliture control above.; -#X text 3 17 This patch tries to reconstruct sinusoidal "tracks" from a sampled sound using pique~ and the data structure facilities. It turns out to be quite hard \, not least because pique~ 0.1 puts out all sorts of spurious peaks.; +#X restore 569 559 pd insample; +#X obj 744 553 tabwrite~ sample; +#X text 152 0 SINUSOID TRACKING; +#X text 129 259 to resynthesize \, "start" once and "step" ad lib. +To stop \, stop stepping and hit osc-stop. Note resynth ampliture control +above.; +#X text 4 17 This patch tries to reconstruct sinusoidal "tracks" from +a sampled sound using pique~ and the data structure facilities. It +turns out to be quite hard \, not least because pique~ 0.1 puts out +all sorts of spurious peaks.; #X connect 0 0 2 0; #X connect 1 0 0 0; #X connect 3 0 4 0; diff --git a/pd/doc/5.reference/0.INTRO.txt b/pd/doc/5.reference/0.INTRO.txt index 37380162..d7594ecb 100644 --- a/pd/doc/5.reference/0.INTRO.txt +++ b/pd/doc/5.reference/0.INTRO.txt @@ -40,6 +40,7 @@ mtof ftom powtodb rmstodb dbtopow dbtorms convert acoustical units mod div sin cos tan atan atan2 sqrt log exp abs higher math random lower math max min greater or lesser of 2 numbers +clip force a number into a range ------------------------------ MIDI ---------------------------------- notein ctlin pgmin bendin touchin polytouchin midiin sysexin - MIDI input noteout ctlout pgmout bendout touchout polytouchout midiout - MIDI output @@ -91,8 +92,8 @@ throw~ - add to a summing bus catch~ - define and read a summing bus block~ - specify block size and overlap switch~ - switch DSP computation on and off -readsf~ - soundfile playback from disk (UNIX only.) -writesf~ - record sound to disk (UNIX only.) +readsf~ - soundfile playback from disk +writesf~ - record sound to disk -------------------- AUDIO OSCILLATORS AND TABLES ------------------------ phasor~ - sawtooth oscillator cos~ - cosine diff --git a/pd/doc/5.reference/append.pd b/pd/doc/5.reference/append.pd index 3b5076b8..7cacefe4 100644 --- a/pd/doc/5.reference/append.pd +++ b/pd/doc/5.reference/append.pd @@ -1,4 +1,3 @@ -#N struct help-append-template1 float x float y float z; #N canvas 330 8 595 450 12; #X text 15 344 see also:; #N canvas 164 72 425 146 help-append-template1 0; @@ -14,590 +13,6 @@ #X obj 15 394 sublist; #X obj 83 393 scalar; #N canvas 0 0 276 163 help-append-data 1; -#X scalar help-append-template1 129 129 129 \;; -#X scalar help-append-template1 130 130 130 \;; -#X scalar help-append-template1 132 132 132 \;; -#X scalar help-append-template1 133 133 133 \;; -#X scalar help-append-template1 135 135 135 \;; -#X scalar help-append-template1 136 136 136 \;; -#X scalar help-append-template1 137 137 137 \;; -#X scalar help-append-template1 138 138 138 \;; -#X scalar help-append-template1 139 139 139 \;; -#X scalar help-append-template1 140 140 140 \;; -#X scalar help-append-template1 141 141 141 \;; -#X scalar help-append-template1 142 142 142 \;; -#X scalar help-append-template1 141 141 141 \;; -#X scalar help-append-template1 139 139 139 \;; -#X scalar help-append-template1 136 136 136 \;; -#X scalar help-append-template1 128 128 128 \;; -#X scalar help-append-template1 125 125 125 \;; -#X scalar help-append-template1 122 122 122 \;; -#X scalar help-append-template1 119 119 119 \;; -#X scalar help-append-template1 117 117 117 \;; -#X scalar help-append-template1 114 114 114 \;; -#X scalar help-append-template1 112 112 112 \;; -#X scalar help-append-template1 110 110 110 \;; -#X scalar help-append-template1 108 108 108 \;; -#X scalar help-append-template1 107 107 107 \;; -#X scalar help-append-template1 105 105 105 \;; -#X scalar help-append-template1 104 104 104 \;; -#X scalar help-append-template1 102 102 102 \;; -#X scalar help-append-template1 101 101 101 \;; -#X scalar help-append-template1 100 100 100 \;; -#X scalar help-append-template1 99 99 99 \;; -#X scalar help-append-template1 98 98 98 \;; -#X scalar help-append-template1 97 97 97 \;; -#X scalar help-append-template1 96 96 96 \;; -#X scalar help-append-template1 95 95 95 \;; -#X scalar help-append-template1 94 94 94 \;; -#X scalar help-append-template1 93 93 93 \;; -#X scalar help-append-template1 92 92 92 \;; -#X scalar help-append-template1 89 89 89 \;; -#X scalar help-append-template1 87 87 87 \;; -#X scalar help-append-template1 85 85 85 \;; -#X scalar help-append-template1 84 84 84 \;; -#X scalar help-append-template1 83 83 83 \;; -#X scalar help-append-template1 82 82 82 \;; -#X scalar help-append-template1 81 81 81 \;; -#X scalar help-append-template1 79 79 79 \;; -#X scalar help-append-template1 77 77 77 \;; -#X scalar help-append-template1 74 74 74 \;; -#X scalar help-append-template1 72 72 72 \;; -#X scalar help-append-template1 70 70 70 \;; -#X scalar help-append-template1 68 68 68 \;; -#X scalar help-append-template1 67 67 67 \;; -#X scalar help-append-template1 66 66 66 \;; -#X scalar help-append-template1 64 64 64 \;; -#X scalar help-append-template1 62 62 62 \;; -#X scalar help-append-template1 61 61 61 \;; -#X scalar help-append-template1 59 59 59 \;; -#X scalar help-append-template1 58 58 58 \;; -#X scalar help-append-template1 57 57 57 \;; -#X scalar help-append-template1 56 56 56 \;; -#X scalar help-append-template1 55 55 55 \;; -#X scalar help-append-template1 54 54 54 \;; -#X scalar help-append-template1 53 53 53 \;; -#X scalar help-append-template1 52 52 52 \;; -#X scalar help-append-template1 50 50 50 \;; -#X scalar help-append-template1 49 49 49 \;; -#X scalar help-append-template1 47 47 47 \;; -#X scalar help-append-template1 46 46 46 \;; -#X scalar help-append-template1 45 45 45 \;; -#X scalar help-append-template1 44 44 44 \;; -#X scalar help-append-template1 43 43 43 \;; -#X scalar help-append-template1 44 44 44 \;; -#X scalar help-append-template1 45 45 45 \;; -#X scalar help-append-template1 47 47 47 \;; -#X scalar help-append-template1 48 48 48 \;; -#X scalar help-append-template1 49 49 49 \;; -#X scalar help-append-template1 51 51 51 \;; -#X scalar help-append-template1 52 52 52 \;; -#X scalar help-append-template1 54 54 54 \;; -#X scalar help-append-template1 56 56 56 \;; -#X scalar help-append-template1 58 58 58 \;; -#X scalar help-append-template1 60 60 60 \;; -#X scalar help-append-template1 62 62 62 \;; -#X scalar help-append-template1 68 68 68 \;; -#X scalar help-append-template1 70 70 70 \;; -#X scalar help-append-template1 76 76 76 \;; -#X scalar help-append-template1 79 79 79 \;; -#X scalar help-append-template1 85 85 85 \;; -#X scalar help-append-template1 88 88 88 \;; -#X scalar help-append-template1 91 91 91 \;; -#X scalar help-append-template1 99 99 99 \;; -#X scalar help-append-template1 101 101 101 \;; -#X scalar help-append-template1 103 103 103 \;; -#X scalar help-append-template1 105 105 105 \;; -#X scalar help-append-template1 107 107 107 \;; -#X scalar help-append-template1 109 109 109 \;; -#X scalar help-append-template1 111 111 111 \;; -#X scalar help-append-template1 113 113 113 \;; -#X scalar help-append-template1 115 115 115 \;; -#X scalar help-append-template1 117 117 117 \;; -#X scalar help-append-template1 119 119 119 \;; -#X scalar help-append-template1 121 121 121 \;; -#X scalar help-append-template1 123 123 123 \;; -#X scalar help-append-template1 129 129 129 \;; -#X scalar help-append-template1 132 132 132 \;; -#X scalar help-append-template1 134 134 134 \;; -#X scalar help-append-template1 136 136 136 \;; -#X scalar help-append-template1 137 137 137 \;; -#X scalar help-append-template1 139 139 139 \;; -#X scalar help-append-template1 140 140 140 \;; -#X scalar help-append-template1 142 142 142 \;; -#X scalar help-append-template1 143 143 143 \;; -#X scalar help-append-template1 144 144 144 \;; -#X scalar help-append-template1 146 146 146 \;; -#X scalar help-append-template1 147 147 147 \;; -#X scalar help-append-template1 149 149 149 \;; -#X scalar help-append-template1 150 150 150 \;; -#X scalar help-append-template1 152 152 152 \;; -#X scalar help-append-template1 153 153 153 \;; -#X scalar help-append-template1 154 154 154 \;; -#X scalar help-append-template1 155 155 155 \;; -#X scalar help-append-template1 156 156 156 \;; -#X scalar help-append-template1 157 157 157 \;; -#X scalar help-append-template1 158 158 158 \;; -#X scalar help-append-template1 160 160 160 \;; -#X scalar help-append-template1 161 161 161 \;; -#X scalar help-append-template1 162 162 162 \;; -#X scalar help-append-template1 163 163 163 \;; -#X scalar help-append-template1 164 164 164 \;; -#X scalar help-append-template1 165 165 165 \;; -#X scalar help-append-template1 166 166 166 \;; -#X scalar help-append-template1 168 168 168 \;; -#X scalar help-append-template1 169 169 169 \;; -#X scalar help-append-template1 170 170 170 \;; -#X scalar help-append-template1 172 172 172 \;; -#X scalar help-append-template1 173 173 173 \;; -#X scalar help-append-template1 175 175 175 \;; -#X scalar help-append-template1 177 177 177 \;; -#X scalar help-append-template1 179 179 179 \;; -#X scalar help-append-template1 180 180 180 \;; -#X scalar help-append-template1 181 181 181 \;; -#X scalar help-append-template1 182 182 182 \;; -#X scalar help-append-template1 181 181 181 \;; -#X scalar help-append-template1 178 178 178 \;; -#X scalar help-append-template1 170 170 170 \;; -#X scalar help-append-template1 160 160 160 \;; -#X scalar help-append-template1 150 150 150 \;; -#X scalar help-append-template1 140 140 140 \;; -#X scalar help-append-template1 137 137 137 \;; -#X scalar help-append-template1 134 134 134 \;; -#X scalar help-append-template1 131 131 131 \;; -#X scalar help-append-template1 130 130 130 \;; -#X scalar help-append-template1 128 128 128 \;; -#X scalar help-append-template1 127 127 127 \;; -#X scalar help-append-template1 125 125 125 \;; -#X scalar help-append-template1 123 123 123 \;; -#X scalar help-append-template1 120 120 120 \;; -#X scalar help-append-template1 118 118 118 \;; -#X scalar help-append-template1 115 115 115 \;; -#X scalar help-append-template1 112 112 112 \;; -#X scalar help-append-template1 110 110 110 \;; -#X scalar help-append-template1 104 104 104 \;; -#X scalar help-append-template1 102 102 102 \;; -#X scalar help-append-template1 100 100 100 \;; -#X scalar help-append-template1 99 99 99 \;; -#X scalar help-append-template1 98 98 98 \;; -#X scalar help-append-template1 97 97 97 \;; -#X scalar help-append-template1 96 96 96 \;; -#X scalar help-append-template1 95 95 95 \;; -#X scalar help-append-template1 94 94 94 \;; -#X scalar help-append-template1 92 92 92 \;; -#X scalar help-append-template1 91 91 91 \;; -#X scalar help-append-template1 90 90 90 \;; -#X scalar help-append-template1 88 88 88 \;; -#X scalar help-append-template1 86 86 86 \;; -#X scalar help-append-template1 84 84 84 \;; -#X scalar help-append-template1 82 82 82 \;; -#X scalar help-append-template1 80 80 80 \;; -#X scalar help-append-template1 79 79 79 \;; -#X scalar help-append-template1 78 78 78 \;; -#X scalar help-append-template1 77 77 77 \;; -#X scalar help-append-template1 76 76 76 \;; -#X scalar help-append-template1 75 75 75 \;; -#X scalar help-append-template1 74 74 74 \;; -#X scalar help-append-template1 75 75 75 \;; -#X scalar help-append-template1 77 77 77 \;; -#X scalar help-append-template1 80 80 80 \;; -#X scalar help-append-template1 83 83 83 \;; -#X scalar help-append-template1 85 85 85 \;; -#X scalar help-append-template1 91 91 91 \;; -#X scalar help-append-template1 99 99 99 \;; -#X scalar help-append-template1 105 105 105 \;; -#X scalar help-append-template1 111 111 111 \;; -#X scalar help-append-template1 117 117 117 \;; -#X scalar help-append-template1 119 119 119 \;; -#X scalar help-append-template1 121 121 121 \;; -#X scalar help-append-template1 123 123 123 \;; -#X scalar help-append-template1 125 125 125 \;; -#X scalar help-append-template1 127 127 127 \;; -#X scalar help-append-template1 129 129 129 \;; -#X scalar help-append-template1 131 131 131 \;; -#X scalar help-append-template1 133 133 133 \;; -#X scalar help-append-template1 135 135 135 \;; -#X scalar help-append-template1 136 136 136 \;; -#X scalar help-append-template1 138 138 138 \;; -#X scalar help-append-template1 139 139 139 \;; -#X scalar help-append-template1 140 140 140 \;; -#X scalar help-append-template1 142 142 142 \;; -#X scalar help-append-template1 144 144 144 \;; -#X scalar help-append-template1 145 145 145 \;; -#X scalar help-append-template1 147 147 147 \;; -#X scalar help-append-template1 149 149 149 \;; -#X scalar help-append-template1 150 150 150 \;; -#X scalar help-append-template1 152 152 152 \;; -#X scalar help-append-template1 153 153 153 \;; -#X scalar help-append-template1 154 154 154 \;; -#X scalar help-append-template1 155 155 155 \;; -#X scalar help-append-template1 156 156 156 \;; -#X scalar help-append-template1 157 157 157 \;; -#X scalar help-append-template1 159 159 159 \;; -#X scalar help-append-template1 160 160 160 \;; -#X scalar help-append-template1 161 161 161 \;; -#X scalar help-append-template1 163 163 163 \;; -#X scalar help-append-template1 165 165 165 \;; -#X scalar help-append-template1 166 166 166 \;; -#X scalar help-append-template1 167 167 167 \;; -#X scalar help-append-template1 168 168 168 \;; -#X scalar help-append-template1 167 167 167 \;; -#X scalar help-append-template1 164 164 164 \;; -#X scalar help-append-template1 161 161 161 \;; -#X scalar help-append-template1 153 153 153 \;; -#X scalar help-append-template1 145 145 145 \;; -#X scalar help-append-template1 142 142 142 \;; -#X scalar help-append-template1 139 139 139 \;; -#X scalar help-append-template1 137 137 137 \;; -#X scalar help-append-template1 135 135 135 \;; -#X scalar help-append-template1 133 133 133 \;; -#X scalar help-append-template1 131 131 131 \;; -#X scalar help-append-template1 130 130 130 \;; -#X scalar help-append-template1 128 128 128 \;; -#X scalar help-append-template1 126 126 126 \;; -#X scalar help-append-template1 124 124 124 \;; -#X scalar help-append-template1 121 121 121 \;; -#X scalar help-append-template1 118 118 118 \;; -#X scalar help-append-template1 116 116 116 \;; -#X scalar help-append-template1 113 113 113 \;; -#X scalar help-append-template1 111 111 111 \;; -#X scalar help-append-template1 109 109 109 \;; -#X scalar help-append-template1 106 106 106 \;; -#X scalar help-append-template1 104 104 104 \;; -#X scalar help-append-template1 102 102 102 \;; -#X scalar help-append-template1 100 100 100 \;; -#X scalar help-append-template1 98 98 98 \;; -#X scalar help-append-template1 96 96 96 \;; -#X scalar help-append-template1 94 94 94 \;; -#X scalar help-append-template1 92 92 92 \;; -#X scalar help-append-template1 90 90 90 \;; -#X scalar help-append-template1 88 88 88 \;; -#X scalar help-append-template1 87 87 87 \;; -#X scalar help-append-template1 85 85 85 \;; -#X scalar help-append-template1 84 84 84 \;; -#X scalar help-append-template1 86 86 86 \;; -#X scalar help-append-template1 92 92 92 \;; -#X scalar help-append-template1 100 100 100 \;; -#X scalar help-append-template1 108 108 108 \;; -#X scalar help-append-template1 118 118 118 \;; -#X scalar help-append-template1 128 128 128 \;; -#X scalar help-append-template1 138 138 138 \;; -#X scalar help-append-template1 150 150 150 \;; -#X scalar help-append-template1 160 160 160 \;; -#X scalar help-append-template1 170 170 170 \;; -#X scalar help-append-template1 180 180 180 \;; -#X scalar help-append-template1 188 188 188 \;; -#X scalar help-append-template1 191 191 191 \;; -#X scalar help-append-template1 194 194 194 \;; -#X scalar help-append-template1 196 196 196 \;; -#X scalar help-append-template1 197 197 197 \;; -#X scalar help-append-template1 195 195 195 \;; -#X scalar help-append-template1 185 185 185 \;; -#X scalar help-append-template1 171 171 171 \;; -#X scalar help-append-template1 157 157 157 \;; -#X scalar help-append-template1 143 143 143 \;; -#X scalar help-append-template1 133 133 133 \;; -#X scalar help-append-template1 125 125 125 \;; -#X scalar help-append-template1 123 123 123 \;; -#X scalar help-append-template1 122 122 122 \;; -#X scalar help-append-template1 123 123 123 \;; -#X scalar help-append-template1 125 125 125 \;; -#X scalar help-append-template1 135 135 135 \;; -#X scalar help-append-template1 147 147 147 \;; -#X scalar help-append-template1 161 161 161 \;; -#X scalar help-append-template1 177 177 177 \;; -#X scalar help-append-template1 191 191 191 \;; -#X scalar help-append-template1 203 203 203 \;; -#X scalar help-append-template1 211 211 211 \;; -#X scalar help-append-template1 212 212 212 \;; -#X scalar help-append-template1 213 213 213 \;; -#X scalar help-append-template1 212 212 212 \;; -#X scalar help-append-template1 211 211 211 \;; -#X scalar help-append-template1 201 201 201 \;; -#X scalar help-append-template1 187 187 187 \;; -#X scalar help-append-template1 171 171 171 \;; -#X scalar help-append-template1 155 155 155 \;; -#X scalar help-append-template1 143 143 143 \;; -#X scalar help-append-template1 140 140 140 \;; -#X scalar help-append-template1 138 138 138 \;; -#X scalar help-append-template1 139 139 139 \;; -#X scalar help-append-template1 141 141 141 \;; -#X scalar help-append-template1 153 153 153 \;; -#X scalar help-append-template1 163 163 163 \;; -#X scalar help-append-template1 173 173 173 \;; -#X scalar help-append-template1 176 176 176 \;; -#X scalar help-append-template1 178 178 178 \;; -#X scalar help-append-template1 179 179 179 \;; -#X scalar help-append-template1 177 177 177 \;; -#X scalar help-append-template1 167 167 167 \;; -#X scalar help-append-template1 149 149 149 \;; -#X scalar help-append-template1 129 129 129 \;; -#X scalar help-append-template1 111 111 111 \;; -#X scalar help-append-template1 97 97 97 \;; -#X scalar help-append-template1 87 87 87 \;; -#X scalar help-append-template1 84 84 84 \;; -#X scalar help-append-template1 85 85 85 \;; -#X scalar help-append-template1 91 91 91 \;; -#X scalar help-append-template1 99 99 99 \;; -#X scalar help-append-template1 111 111 111 \;; -#X scalar help-append-template1 123 123 123 \;; -#X scalar help-append-template1 135 135 135 \;; -#X scalar help-append-template1 147 147 147 \;; -#X scalar help-append-template1 155 155 155 \;; -#X scalar help-append-template1 156 156 156 \;; -#X scalar help-append-template1 154 154 154 \;; -#X scalar help-append-template1 144 144 144 \;; -#X scalar help-append-template1 130 130 130 \;; -#X scalar help-append-template1 114 114 114 \;; -#X scalar help-append-template1 100 100 100 \;; -#X scalar help-append-template1 90 90 90 \;; -#X scalar help-append-template1 88 88 88 \;; -#X scalar help-append-template1 89 89 89 \;; -#X scalar help-append-template1 91 91 91 \;; -#X scalar help-append-template1 99 99 99 \;; -#X scalar help-append-template1 111 111 111 \;; -#X scalar help-append-template1 127 127 127 \;; -#X scalar help-append-template1 141 141 141 \;; -#X scalar help-append-template1 149 149 149 \;; -#X scalar help-append-template1 147 147 147 \;; -#X scalar help-append-template1 135 135 135 \;; -#X scalar help-append-template1 123 123 123 \;; -#X scalar help-append-template1 107 107 107 \;; -#X scalar help-append-template1 91 91 91 \;; -#X scalar help-append-template1 79 79 79 \;; -#X scalar help-append-template1 71 71 71 \;; -#X scalar help-append-template1 70 70 70 \;; -#X scalar help-append-template1 71 71 71 \;; -#X scalar help-append-template1 72 72 72 \;; -#X scalar help-append-template1 82 82 82 \;; -#X scalar help-append-template1 92 92 92 \;; -#X scalar help-append-template1 102 102 102 \;; -#X scalar help-append-template1 104 104 104 \;; -#X scalar help-append-template1 103 103 103 \;; -#X scalar help-append-template1 102 102 102 \;; -#X scalar help-append-template1 92 92 92 \;; -#X scalar help-append-template1 80 80 80 \;; -#X scalar help-append-template1 68 68 68 \;; -#X scalar help-append-template1 56 56 56 \;; -#X scalar help-append-template1 53 53 53 \;; -#X scalar help-append-template1 51 51 51 \;; -#X scalar help-append-template1 52 52 52 \;; -#X scalar help-append-template1 53 53 53 \;; -#X scalar help-append-template1 59 59 59 \;; -#X scalar help-append-template1 65 65 65 \;; -#X scalar help-append-template1 73 73 73 \;; -#X scalar help-append-template1 76 76 76 \;; -#X scalar help-append-template1 78 78 78 \;; -#X scalar help-append-template1 81 81 81 \;; -#X scalar help-append-template1 83 83 83 \;; -#X scalar help-append-template1 85 85 85 \;; -#X scalar help-append-template1 86 86 86 \;; -#X scalar help-append-template1 87 87 87 \;; -#X scalar help-append-template1 88 88 88 \;; -#X scalar help-append-template1 90 90 90 \;; -#X scalar help-append-template1 92 92 92 \;; -#X scalar help-append-template1 94 94 94 \;; -#X scalar help-append-template1 102 102 102 \;; -#X scalar help-append-template1 110 110 110 \;; -#X scalar help-append-template1 118 118 118 \;; -#X scalar help-append-template1 121 121 121 \;; -#X scalar help-append-template1 124 124 124 \;; -#X scalar help-append-template1 127 127 127 \;; -#X scalar help-append-template1 129 129 129 \;; -#X scalar help-append-template1 132 132 132 \;; -#X scalar help-append-template1 134 134 134 \;; -#X scalar help-append-template1 136 136 136 \;; -#X scalar help-append-template1 138 138 138 \;; -#X scalar help-append-template1 140 140 140 \;; -#X scalar help-append-template1 141 141 141 \;; -#X scalar help-append-template1 143 143 143 \;; -#X scalar help-append-template1 145 145 145 \;; -#X scalar help-append-template1 146 146 146 \;; -#X scalar help-append-template1 148 148 148 \;; -#X scalar help-append-template1 149 149 149 \;; -#X scalar help-append-template1 150 150 150 \;; -#X scalar help-append-template1 151 151 151 \;; -#X scalar help-append-template1 153 153 153 \;; -#X scalar help-append-template1 155 155 155 \;; -#X scalar help-append-template1 156 156 156 \;; -#X scalar help-append-template1 158 158 158 \;; -#X scalar help-append-template1 160 160 160 \;; -#X scalar help-append-template1 161 161 161 \;; -#X scalar help-append-template1 163 163 163 \;; -#X scalar help-append-template1 164 164 164 \;; -#X scalar help-append-template1 165 165 165 \;; -#X scalar help-append-template1 166 166 166 \;; -#X scalar help-append-template1 168 168 168 \;; -#X scalar help-append-template1 170 170 170 \;; -#X scalar help-append-template1 172 172 172 \;; -#X scalar help-append-template1 174 174 174 \;; -#X scalar help-append-template1 176 176 176 \;; -#X scalar help-append-template1 178 178 178 \;; -#X scalar help-append-template1 179 179 179 \;; -#X scalar help-append-template1 180 180 180 \;; -#X scalar help-append-template1 182 182 182 \;; -#X scalar help-append-template1 183 183 183 \;; -#X scalar help-append-template1 185 185 185 \;; -#X scalar help-append-template1 187 187 187 \;; -#X scalar help-append-template1 189 189 189 \;; -#X scalar help-append-template1 190 190 190 \;; -#X scalar help-append-template1 192 192 192 \;; -#X scalar help-append-template1 194 194 194 \;; -#X scalar help-append-template1 196 196 196 \;; -#X scalar help-append-template1 198 198 198 \;; -#X scalar help-append-template1 199 199 199 \;; -#X scalar help-append-template1 200 200 200 \;; -#X scalar help-append-template1 201 201 201 \;; -#X scalar help-append-template1 203 203 203 \;; -#X scalar help-append-template1 204 204 204 \;; -#X scalar help-append-template1 206 206 206 \;; -#X scalar help-append-template1 207 207 207 \;; -#X scalar help-append-template1 209 209 209 \;; -#X scalar help-append-template1 210 210 210 \;; -#X scalar help-append-template1 211 211 211 \;; -#X scalar help-append-template1 212 212 212 \;; -#X scalar help-append-template1 213 213 213 \;; -#X scalar help-append-template1 223 223 223 \;; -#X scalar help-append-template1 226 226 226 \;; -#X scalar help-append-template1 228 228 228 \;; -#X scalar help-append-template1 229 229 229 \;; -#X scalar help-append-template1 230 230 230 \;; -#X scalar help-append-template1 231 231 231 \;; -#X scalar help-append-template1 232 232 232 \;; -#X scalar help-append-template1 233 233 233 \;; -#X scalar help-append-template1 234 234 234 \;; -#X scalar help-append-template1 233 233 233 \;; -#X scalar help-append-template1 225 225 225 \;; -#X scalar help-append-template1 217 217 217 \;; -#X scalar help-append-template1 205 205 205 \;; -#X scalar help-append-template1 195 195 195 \;; -#X scalar help-append-template1 183 183 183 \;; -#X scalar help-append-template1 173 173 173 \;; -#X scalar help-append-template1 163 163 163 \;; -#X scalar help-append-template1 155 155 155 \;; -#X scalar help-append-template1 152 152 152 \;; -#X scalar help-append-template1 150 150 150 \;; -#X scalar help-append-template1 148 148 148 \;; -#X scalar help-append-template1 147 147 147 \;; -#X scalar help-append-template1 145 145 145 \;; -#X scalar help-append-template1 143 143 143 \;; -#X scalar help-append-template1 141 141 141 \;; -#X scalar help-append-template1 139 139 139 \;; -#X scalar help-append-template1 136 136 136 \;; -#X scalar help-append-template1 133 133 133 \;; -#X scalar help-append-template1 130 130 130 \;; -#X scalar help-append-template1 122 122 122 \;; -#X scalar help-append-template1 116 116 116 \;; -#X scalar help-append-template1 113 113 113 \;; -#X scalar help-append-template1 110 110 110 \;; -#X scalar help-append-template1 108 108 108 \;; -#X scalar help-append-template1 106 106 106 \;; -#X scalar help-append-template1 104 104 104 \;; -#X scalar help-append-template1 102 102 102 \;; -#X scalar help-append-template1 100 100 100 \;; -#X scalar help-append-template1 99 99 99 \;; -#X scalar help-append-template1 98 98 98 \;; -#X scalar help-append-template1 96 96 96 \;; -#X scalar help-append-template1 95 95 95 \;; -#X scalar help-append-template1 93 93 93 \;; -#X scalar help-append-template1 92 92 92 \;; -#X scalar help-append-template1 90 90 90 \;; -#X scalar help-append-template1 88 88 88 \;; -#X scalar help-append-template1 85 85 85 \;; -#X scalar help-append-template1 82 82 82 \;; -#X scalar help-append-template1 76 76 76 \;; -#X scalar help-append-template1 74 74 74 \;; -#X scalar help-append-template1 71 71 71 \;; -#X scalar help-append-template1 69 69 69 \;; -#X scalar help-append-template1 67 67 67 \;; -#X scalar help-append-template1 65 65 65 \;; -#X scalar help-append-template1 63 63 63 \;; -#X scalar help-append-template1 62 62 62 \;; -#X scalar help-append-template1 60 60 60 \;; -#X scalar help-append-template1 58 58 58 \;; -#X scalar help-append-template1 56 56 56 \;; -#X scalar help-append-template1 54 54 54 \;; -#X scalar help-append-template1 51 51 51 \;; -#X scalar help-append-template1 49 49 49 \;; -#X scalar help-append-template1 47 47 47 \;; -#X scalar help-append-template1 45 45 45 \;; -#X scalar help-append-template1 44 44 44 \;; -#X scalar help-append-template1 42 42 42 \;; -#X scalar help-append-template1 40 40 40 \;; -#X scalar help-append-template1 38 38 38 \;; -#X scalar help-append-template1 36 36 36 \;; -#X scalar help-append-template1 34 34 34 \;; -#X scalar help-append-template1 33 33 33 \;; -#X scalar help-append-template1 32 32 32 \;; -#X scalar help-append-template1 31 31 31 \;; -#X scalar help-append-template1 30 30 30 \;; -#X scalar help-append-template1 28 28 28 \;; -#X scalar help-append-template1 27 27 27 \;; -#X scalar help-append-template1 25 25 25 \;; -#X scalar help-append-template1 24 24 24 \;; -#X scalar help-append-template1 23 23 23 \;; -#X scalar help-append-template1 22 22 22 \;; -#X scalar help-append-template1 21 21 21 \;; -#X scalar help-append-template1 20 20 20 \;; -#X scalar help-append-template1 19 19 19 \;; -#X scalar help-append-template1 18 18 18 \;; -#X scalar help-append-template1 16 16 16 \;; -#X scalar help-append-template1 15 15 15 \;; -#X scalar help-append-template1 14 14 14 \;; -#X scalar help-append-template1 13 13 13 \;; -#X scalar help-append-template1 12 12 12 \;; -#X scalar help-append-template1 11 11 11 \;; -#X scalar help-append-template1 10 10 10 \;; -#X scalar help-append-template1 9 9 9 \;; -#X scalar help-append-template1 8 8 8 \;; -#X scalar help-append-template1 7 7 7 \;; -#X scalar help-append-template1 6 6 6 \;; -#X scalar help-append-template1 5 5 5 \;; -#X scalar help-append-template1 4 4 4 \;; -#X scalar help-append-template1 3 3 3 \;; -#X scalar help-append-template1 2 2 2 \;; -#X scalar help-append-template1 3 3 3 \;; -#X scalar help-append-template1 73 73 73 \;; -#X scalar help-append-template1 75 75 75 \;; -#X scalar help-append-template1 77 77 77 \;; -#X scalar help-append-template1 79 79 79 \;; -#X scalar help-append-template1 81 81 81 \;; -#X scalar help-append-template1 82 82 82 \;; -#X scalar help-append-template1 84 84 84 \;; -#X scalar help-append-template1 85 85 85 \;; -#X scalar help-append-template1 86 86 86 \;; -#X scalar help-append-template1 87 87 87 \;; -#X scalar help-append-template1 93 93 93 \;; -#X scalar help-append-template1 96 96 96 \;; -#X scalar help-append-template1 98 98 98 \;; -#X scalar help-append-template1 100 100 100 \;; -#X scalar help-append-template1 101 101 101 \;; -#X scalar help-append-template1 102 102 102 \;; -#X scalar help-append-template1 103 103 103 \;; -#X scalar help-append-template1 104 104 104 \;; -#X scalar help-append-template1 105 105 105 \;; -#X scalar help-append-template1 106 106 106 \;; -#X scalar help-append-template1 107 107 107 \;; -#X scalar help-append-template1 108 108 108 \;; -#X scalar help-append-template1 110 110 110 \;; -#X scalar help-append-template1 111 111 111 \;; -#X scalar help-append-template1 112 112 112 \;; -#X scalar help-append-template1 113 113 113 \;; -#X scalar help-append-template1 114 114 114 \;; -#X scalar help-append-template1 115 115 115 \;; -#X scalar help-append-template1 116 116 116 \;; -#X scalar help-append-template1 117 117 117 \;; -#X scalar help-append-template1 118 118 118 \;; -#X scalar help-append-template1 119 119 119 \;; -#X scalar help-append-template1 120 120 120 \;; -#X scalar help-append-template1 121 121 121 \;; -#X scalar help-append-template1 122 122 122 \;; -#X scalar help-append-template1 123 123 123 \;; -#X scalar help-append-template1 124 124 124 \;; -#X scalar help-append-template1 125 125 125 \;; -#X scalar help-append-template1 126 126 126 \;; -#X scalar help-append-template1 127 127 127 \;; -#X scalar help-append-template1 128 128 128 \;; #X restore 357 351 pd help-append-data; #X obj 212 255 pointer; #X obj 21 10 append; diff --git a/pd/doc/5.reference/drawpolygon.pd b/pd/doc/5.reference/drawpolygon.pd index 714c404b..fc422af4 100644 --- a/pd/doc/5.reference/drawpolygon.pd +++ b/pd/doc/5.reference/drawpolygon.pd @@ -25,14 +25,13 @@ Here the interior color is red (900) \, the outline color is controlled by the "dog" field \, and the three points describe a triangle of altitude "cat". The fields x and y automatically govern the placement of the object as a whole.; -#X text 24 357 This object defines the fields for this template. Their -values are initialized in the "works" subwindow. You can see them by -right-clicking on the object in the "data" window and selecting "properties." -; #X text 45 62 - RGB color (0=black \, 999=white \, 900=red \, 90=green \, 9=blue \, 555=grey \, etc.); #X text 46 95 - line width; #X text 46 116 - two or more (x \, y) pairs giving coordinates.; +#X text 24 357 This object defines the fields for this template. You +can see teh fields' values by right-clicking on the object in the "data" +window and selecting "properties."; #X restore 274 93 pd help-drawpolygon-template; #X obj 34 149 template; #N canvas 10 18 384 178 help-drawpolygon-data 1; diff --git a/pd/doc/5.reference/key.pd b/pd/doc/5.reference/key.pd index ceab4440..1ab0337c 100644 --- a/pd/doc/5.reference/key.pd +++ b/pd/doc/5.reference/key.pd @@ -1,18 +1,23 @@ -#N canvas 243 41 464 286 12; +#N canvas 146 45 546 288 12; #X obj 21 10 key; -#X obj 48 10 keyup; -#X obj 89 9 keyname; -#X text 157 8 -- grab keyboard; +#X obj 54 9 keyup; +#X obj 105 9 keyname; +#X text 173 8 -- grab keyboard; #X obj 38 67 key; -#X floatatom 38 95 3 0 0; -#X floatatom 75 95 3 0 0; -#X obj 75 69 keyup; -#X floatatom 122 97 3 0 0; -#X obj 122 71 keyname; -#X symbolatom 166 98 10 0 0; -#X text 254 256 updated for Pd version 0.32.; -#X text 32 143 Key and keyup report the (system dependent) numbers of "printing" keys of the keyboard. Keyname gives the symbolic name of the key \, with a 1 or 0 if it's up or down \, and works with non-printing keys like shift or "F1".; -#X text 33 203 Caveat -- this only works if Pd actually gets the key events which can depend on the stacking order of windows and/or the pointer location \, depending on the system.; +#X floatatom 38 95 3 0 0 0 - - -; +#X floatatom 77 93 3 0 0 0 - - -; +#X obj 77 67 keyup; +#X floatatom 128 93 3 0 0 0 - - -; +#X obj 128 67 keyname; +#X symbolatom 172 94 10 0 0 0 - - -; +#X text 280 262 updated for Pd version 0.32.; +#X text 26 133 Key and keyup report the (system dependent) numbers +of "printing" keys of the keyboard. Keyname gives the symbolic name +of the key \, with a 1 or 0 if it's up or down \, and works with non-printing +keys like shift or "F1".; +#X text 18 200 Caveat -- this only works if Pd actually gets the key +events which can depend on the stacking order of windows and/or the +pointer location \, depending on the system.; #X connect 4 0 5 0; #X connect 7 0 6 0; #X connect 9 0 8 0; diff --git a/pd/doc/5.reference/plot.pd b/pd/doc/5.reference/plot.pd index d25eaa15..2070ed69 100644 --- a/pd/doc/5.reference/plot.pd +++ b/pd/doc/5.reference/plot.pd @@ -5,13 +5,10 @@ array array2 help-plot-array2-template array array3 help-plot-array3-template #N struct help-plot-array2-template float x float y; #N struct help-plot-array3-template float y float w; #N canvas 398 0 516 229 12; -#N canvas 89 309 626 539 help-plot-template 1; +#N canvas 173 285 626 539 help-plot-template 1; #X text 29 34 creation arguments:; #X text 48 71 - RGB color (0=black \, 999=white \, 900=red \, 90=green \, 9=blue \, 555=grey \, etc.); -#X obj 24 387 template float x float y array array1 help-plot-array1-template -array array2 help-plot-array2-template array array3 help-plot-array3-template -; #X text 47 52 - OPTIONAL word "curve" to specify bezier; #X text 46 98 - line width; #X text 46 114 - relative x and y location; @@ -28,10 +25,13 @@ cariable \, play ignores x spacing requests and takes x from the data itself.; #X text 50 328 If a "w" variable is present in the template as for array3 \, it is added to the line width.; -#X text 33 366 here's the template for all this:; #X obj 27 501 filledpolygon 509 509 0 -10 -10 10 -10 10 10 -10 10; #X text 27 454 To see the data itself \, select "properties" for the scalar by right clicking on the purple square.; +#X obj 24 387 struct help-plot-template float x float y array array1 +help-plot-array1-template array array2 help-plot-array2-template array +array3 help-plot-array3-template; +#X text 33 366 here's the "struct" for all this:; #X restore 243 78 pd help-plot-template; #N canvas 196 292 273 120 help-plot-array1-template 0; #X obj 30 71 filledpolygon 0 0 0 -5 0 0 5 5 0 0 -5; diff --git a/pd/doc/6.externs/dspobj~.c b/pd/doc/6.externs/dspobj~.c index a8841f21..5c3fa86b 100644 --- a/pd/doc/6.externs/dspobj~.c +++ b/pd/doc/6.externs/dspobj~.c @@ -12,9 +12,16 @@ static t_class *dspobj_class; typedef struct _dspobj { - t_object x_obj; + t_object x_obj; /* obligatory header */ + t_float x_f; /* place to hold inlet's value if it's set by message */ } t_dspobj; + /* this is the actual performance routine which acts on the samples. + It's called with a single pointer "w" which is our location in the + DSP call list. We return a new "w" which will point to the next item + after us. Meanwhile, w[0] is just a pointer to dsp-perform itself + (no use to us), w[1] and w[2] are the input and output vector locations, + and w[3] is the number of points to calculate. */ static t_int *dspobj_perform(t_int *w) { t_float *in = (t_float *)(w[1]); @@ -28,6 +35,9 @@ static t_int *dspobj_perform(t_int *w) return (w+4); } + /* called to start DSP. Here we call Pd back to add our perform + routine to a linear callback list which Pd in turn calls to grind + out the samples. */ static void dspobj_dsp(t_dspobj *x, t_signal **sp) { dsp_add(dspobj_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); @@ -37,13 +47,21 @@ static void *dspobj_new(void) { t_dspobj *x = (t_dspobj *)pd_new(dspobj_class); outlet_new(&x->x_obj, gensym("signal")); + x->x_f = 0; return (x); } + /* this routine, which must have exactly this name (with the "~" replaced + by "_tilde) is called when the code is first loaded, and tells Pd how + to build the "class". */ void dspobj_tilde_setup(void) { dspobj_class = class_new(gensym("dspobj~"), (t_newmethod)dspobj_new, 0, sizeof(t_dspobj), 0, A_DEFFLOAT, 0); - class_addmethod(dspobj_class, nullfn, gensym("signal"), 0); + /* this is magic to declare that the leftmost, "main" inlet + takes signals; other signal inlets are done differently... */ + CLASS_MAINSIGNALIN(dspobj_class, t_dspobj, x_f); + /* here we tell Pd about the "dsp" method, which is called back + when DSP is turned on. */ class_addmethod(dspobj_class, (t_method)dspobj_dsp, gensym("dsp"), 0); } diff --git a/pd/doc/7.stuff/data-structures/8.beat-patterns.pd b/pd/doc/7.stuff/data-structures/8.beat-patterns.pd new file mode 100644 index 00000000..11487c74 --- /dev/null +++ b/pd/doc/7.stuff/data-structures/8.beat-patterns.pd @@ -0,0 +1,452 @@ +#N struct rect float x float y float w float h; +#N canvas 637 175 299 256 10; +#N canvas 457 224 643 316 rect 0; +#X obj 134 219 pointer; +#X msg 134 188 traverse pd-test \, bang; +#X obj 69 99 filledpolygon 0 0 0 0 0 0 h w h w 0 0 0; +#X obj 46 252 append rect x y w h; +#X obj 68 76 struct rect float x float y float w float h; +#X msg 46 219 50 50 50 2; +#X obj 432 201 r this-ptr; +#X obj 347 257 s this-ptr; +#X obj 344 202 r add-rect; +#X obj 346 232 append rect x y w h; +#X connect 0 0 3 4; +#X connect 1 0 0 0; +#X connect 5 0 3 0; +#X connect 6 0 9 4; +#X connect 8 0 9 0; +#X connect 9 0 7 0; +#X restore 26 67 pd rect; +#N canvas 34 58 616 659 output 1; +#X scalar rect 57 179 2 10 \;; +#X scalar rect 82 179 1 10 \;; +#X scalar rect 107 179 1 10 \;; +#X scalar rect 132 179 1 10 \;; +#X scalar rect 157 179 1 10 \;; +#X scalar rect 182 179 2 10 \;; +#X scalar rect 207 179 1 10 \;; +#X scalar rect 232 179 1 10 \;; +#X scalar rect 257 179 1 10 \;; +#X scalar rect 282 179 1 10 \;; +#X scalar rect 307 179 2 10 \;; +#X scalar rect 332 179 1 10 \;; +#X scalar rect 357 179 1 10 \;; +#X scalar rect 382 179 1 10 \;; +#X scalar rect 407 179 1 10 \;; +#X scalar rect 432 179 2 10 \;; +#X scalar rect 457 179 1 10 \;; +#X scalar rect 482 179 1 10 \;; +#X scalar rect 507 179 1 10 \;; +#X scalar rect 532 179 1 10 \;; +#X scalar rect 557 179 2 10 \;; +#X scalar rect 57 149 2 10 \;; +#X scalar rect 73.6667 149 1 10 \;; +#X scalar rect 90.3333 149 1 10 \;; +#X scalar rect 107 149 1 10 \;; +#X scalar rect 123.667 149 1 10 \;; +#X scalar rect 140.333 149 2 10 \;; +#X scalar rect 157 149 1 10 \;; +#X scalar rect 173.667 149 1 10 \;; +#X scalar rect 190.333 149 1 10 \;; +#X scalar rect 207 149 1 10 \;; +#X scalar rect 223.667 149 2 10 \;; +#X scalar rect 240.333 149 1 10 \;; +#X scalar rect 257 149 1 10 \;; +#X scalar rect 273.667 149 1 10 \;; +#X scalar rect 290.333 149 1 10 \;; +#X scalar rect 307 149 2 10 \;; +#X scalar rect 323.667 149 1 10 \;; +#X scalar rect 340.333 149 1 10 \;; +#X scalar rect 357 149 1 10 \;; +#X scalar rect 373.667 149 1 10 \;; +#X scalar rect 390.333 149 2 10 \;; +#X scalar rect 407 149 1 10 \;; +#X scalar rect 423.667 149 1 10 \;; +#X scalar rect 440.333 149 1 10 \;; +#X scalar rect 457 149 1 10 \;; +#X scalar rect 473.667 149 2 10 \;; +#X scalar rect 490.333 149 1 10 \;; +#X scalar rect 507 149 1 10 \;; +#X scalar rect 523.667 149 1 10 \;; +#X scalar rect 540.333 149 1 10 \;; +#X scalar rect 557 149 2 10 \;; +#X scalar rect 57 119 2 10 \;; +#X scalar rect 71.2857 119 1 10 \;; +#X scalar rect 85.5714 119 1 10 \;; +#X scalar rect 99.8571 119 1 10 \;; +#X scalar rect 114.143 119 1 10 \;; +#X scalar rect 128.429 119 2 10 \;; +#X scalar rect 142.714 119 1 10 \;; +#X scalar rect 157 119 1 10 \;; +#X scalar rect 171.286 119 1 10 \;; +#X scalar rect 185.571 119 1 10 \;; +#X scalar rect 199.857 119 2 10 \;; +#X scalar rect 214.143 119 1 10 \;; +#X scalar rect 228.429 119 1 10 \;; +#X scalar rect 242.714 119 1 10 \;; +#X scalar rect 257 119 1 10 \;; +#X scalar rect 271.286 119 2 10 \;; +#X scalar rect 285.571 119 1 10 \;; +#X scalar rect 299.857 119 1 10 \;; +#X scalar rect 314.143 119 1 10 \;; +#X scalar rect 328.429 119 1 10 \;; +#X scalar rect 342.714 119 2 10 \;; +#X scalar rect 357 119 1 10 \;; +#X scalar rect 371.286 119 1 10 \;; +#X scalar rect 385.571 119 1 10 \;; +#X scalar rect 399.857 119 1 10 \;; +#X scalar rect 414.143 119 2 10 \;; +#X scalar rect 428.429 119 1 10 \;; +#X scalar rect 442.714 119 1 10 \;; +#X scalar rect 457 119 1 10 \;; +#X scalar rect 471.286 119 1 10 \;; +#X scalar rect 485.571 119 2 10 \;; +#X scalar rect 499.857 119 1 10 \;; +#X scalar rect 514.143 119 1 10 \;; +#X scalar rect 528.429 119 1 10 \;; +#X scalar rect 542.714 119 1 10 \;; +#X scalar rect 557 119 2 10 \;; +#X scalar rect 57 89 2 10 \;; +#X scalar rect 69.5 89 1 10 \;; +#X scalar rect 82 89 1 10 \;; +#X scalar rect 94.5 89 1 10 \;; +#X scalar rect 107 89 1 10 \;; +#X scalar rect 119.5 89 2 10 \;; +#X scalar rect 132 89 1 10 \;; +#X scalar rect 144.5 89 1 10 \;; +#X scalar rect 157 89 1 10 \;; +#X scalar rect 169.5 89 1 10 \;; +#X scalar rect 182 89 2 10 \;; +#X scalar rect 194.5 89 1 10 \;; +#X scalar rect 207 89 1 10 \;; +#X scalar rect 219.5 89 1 10 \;; +#X scalar rect 232 89 1 10 \;; +#X scalar rect 244.5 89 2 10 \;; +#X scalar rect 257 89 1 10 \;; +#X scalar rect 269.5 89 1 10 \;; +#X scalar rect 282 89 1 10 \;; +#X scalar rect 294.5 89 1 10 \;; +#X scalar rect 307 89 2 10 \;; +#X scalar rect 319.5 89 1 10 \;; +#X scalar rect 332 89 1 10 \;; +#X scalar rect 344.5 89 1 10 \;; +#X scalar rect 357 89 1 10 \;; +#X scalar rect 369.5 89 2 10 \;; +#X scalar rect 382 89 1 10 \;; +#X scalar rect 394.5 89 1 10 \;; +#X scalar rect 407 89 1 10 \;; +#X scalar rect 419.5 89 1 10 \;; +#X scalar rect 432 89 2 10 \;; +#X scalar rect 444.5 89 1 10 \;; +#X scalar rect 457 89 1 10 \;; +#X scalar rect 469.5 89 1 10 \;; +#X scalar rect 482 89 1 10 \;; +#X scalar rect 494.5 89 2 10 \;; +#X scalar rect 507 89 1 10 \;; +#X scalar rect 519.5 89 1 10 \;; +#X scalar rect 532 89 1 10 \;; +#X scalar rect 544.5 89 1 10 \;; +#X scalar rect 557 89 2 10 \;; +#X scalar rect 57 299 2 10 \;; +#X scalar rect 90.3333 299 1 10 \;; +#X scalar rect 123.667 299 1 10 \;; +#X scalar rect 157 299 1 10 \;; +#X scalar rect 190.333 299 2 10 \;; +#X scalar rect 223.667 299 1 10 \;; +#X scalar rect 257 299 1 10 \;; +#X scalar rect 290.333 299 1 10 \;; +#X scalar rect 323.667 299 2 10 \;; +#X scalar rect 357 299 1 10 \;; +#X scalar rect 390.333 299 1 10 \;; +#X scalar rect 423.667 299 1 10 \;; +#X scalar rect 457 299 2 10 \;; +#X scalar rect 57 269 2 10 \;; +#X scalar rect 77 269 1 10 \;; +#X scalar rect 97 269 1 10 \;; +#X scalar rect 117 269 1 10 \;; +#X scalar rect 137 269 2 10 \;; +#X scalar rect 157 269 1 10 \;; +#X scalar rect 177 269 1 10 \;; +#X scalar rect 197 269 1 10 \;; +#X scalar rect 217 269 2 10 \;; +#X scalar rect 237 269 1 10 \;; +#X scalar rect 257 269 1 10 \;; +#X scalar rect 277 269 1 10 \;; +#X scalar rect 297 269 2 10 \;; +#X scalar rect 317 269 1 10 \;; +#X scalar rect 337 269 1 10 \;; +#X scalar rect 357 269 1 10 \;; +#X scalar rect 377 269 2 10 \;; +#X scalar rect 397 269 1 10 \;; +#X scalar rect 417 269 1 10 \;; +#X scalar rect 437 269 1 10 \;; +#X scalar rect 457 269 2 10 \;; +#X scalar rect 57 239 2 10 \;; +#X scalar rect 71.2857 239 1 10 \;; +#X scalar rect 85.5714 239 1 10 \;; +#X scalar rect 99.8571 239 1 10 \;; +#X scalar rect 114.143 239 2 10 \;; +#X scalar rect 128.429 239 1 10 \;; +#X scalar rect 142.714 239 1 10 \;; +#X scalar rect 157 239 1 10 \;; +#X scalar rect 171.286 239 2 10 \;; +#X scalar rect 185.571 239 1 10 \;; +#X scalar rect 199.857 239 1 10 \;; +#X scalar rect 214.143 239 1 10 \;; +#X scalar rect 228.429 239 2 10 \;; +#X scalar rect 242.714 239 1 10 \;; +#X scalar rect 257 239 1 10 \;; +#X scalar rect 271.286 239 1 10 \;; +#X scalar rect 285.571 239 2 10 \;; +#X scalar rect 299.857 239 1 10 \;; +#X scalar rect 314.143 239 1 10 \;; +#X scalar rect 328.429 239 1 10 \;; +#X scalar rect 342.714 239 2 10 \;; +#X scalar rect 357 239 1 10 \;; +#X scalar rect 371.286 239 1 10 \;; +#X scalar rect 385.571 239 1 10 \;; +#X scalar rect 399.857 239 2 10 \;; +#X scalar rect 414.143 239 1 10 \;; +#X scalar rect 428.429 239 1 10 \;; +#X scalar rect 442.714 239 1 10 \;; +#X scalar rect 457 239 2 10 \;; +#X scalar rect 57 479 2 10 \;; +#X scalar rect 107 479 1 10 \;; +#X scalar rect 157 479 1 10 \;; +#X scalar rect 207 479 2 10 \;; +#X scalar rect 257 479 1 10 \;; +#X scalar rect 307 479 1 10 \;; +#X scalar rect 357 479 2 10 \;; +#X scalar rect 57 449 2 10 \;; +#X scalar rect 82 449 1 10 \;; +#X scalar rect 107 449 1 10 \;; +#X scalar rect 132 449 2 10 \;; +#X scalar rect 157 449 1 10 \;; +#X scalar rect 182 449 1 10 \;; +#X scalar rect 207 449 2 10 \;; +#X scalar rect 232 449 1 10 \;; +#X scalar rect 257 449 1 10 \;; +#X scalar rect 282 449 2 10 \;; +#X scalar rect 307 449 1 10 \;; +#X scalar rect 332 449 1 10 \;; +#X scalar rect 357 449 2 10 \;; +#X scalar rect 57 419 2 10 \;; +#X scalar rect 77 419 1 10 \;; +#X scalar rect 97 419 1 10 \;; +#X scalar rect 117 419 2 10 \;; +#X scalar rect 137 419 1 10 \;; +#X scalar rect 157 419 1 10 \;; +#X scalar rect 177 419 2 10 \;; +#X scalar rect 197 419 1 10 \;; +#X scalar rect 217 419 1 10 \;; +#X scalar rect 237 419 2 10 \;; +#X scalar rect 257 419 1 10 \;; +#X scalar rect 277 419 1 10 \;; +#X scalar rect 297 419 2 10 \;; +#X scalar rect 317 419 1 10 \;; +#X scalar rect 337 419 1 10 \;; +#X scalar rect 357 419 2 10 \;; +#X scalar rect 57 389 2 10 \;; +#X scalar rect 71.2857 389 1 10 \;; +#X scalar rect 85.5714 389 1 10 \;; +#X scalar rect 99.8571 389 2 10 \;; +#X scalar rect 114.143 389 1 10 \;; +#X scalar rect 128.429 389 1 10 \;; +#X scalar rect 142.714 389 2 10 \;; +#X scalar rect 157 389 1 10 \;; +#X scalar rect 171.286 389 1 10 \;; +#X scalar rect 185.571 389 2 10 \;; +#X scalar rect 199.857 389 1 10 \;; +#X scalar rect 214.143 389 1 10 \;; +#X scalar rect 228.429 389 2 10 \;; +#X scalar rect 242.714 389 1 10 \;; +#X scalar rect 257 389 1 10 \;; +#X scalar rect 271.286 389 2 10 \;; +#X scalar rect 285.571 389 1 10 \;; +#X scalar rect 299.857 389 1 10 \;; +#X scalar rect 314.143 389 2 10 \;; +#X scalar rect 328.429 389 1 10 \;; +#X scalar rect 342.714 389 1 10 \;; +#X scalar rect 357 389 2 10 \;; +#X scalar rect 57 359 2 10 \;; +#X scalar rect 69.5 359 1 10 \;; +#X scalar rect 82 359 1 10 \;; +#X scalar rect 94.5 359 2 10 \;; +#X scalar rect 107 359 1 10 \;; +#X scalar rect 119.5 359 1 10 \;; +#X scalar rect 132 359 2 10 \;; +#X scalar rect 144.5 359 1 10 \;; +#X scalar rect 157 359 1 10 \;; +#X scalar rect 169.5 359 2 10 \;; +#X scalar rect 182 359 1 10 \;; +#X scalar rect 194.5 359 1 10 \;; +#X scalar rect 207 359 2 10 \;; +#X scalar rect 219.5 359 1 10 \;; +#X scalar rect 232 359 1 10 \;; +#X scalar rect 244.5 359 2 10 \;; +#X scalar rect 257 359 1 10 \;; +#X scalar rect 269.5 359 1 10 \;; +#X scalar rect 282 359 2 10 \;; +#X scalar rect 294.5 359 1 10 \;; +#X scalar rect 307 359 1 10 \;; +#X scalar rect 319.5 359 2 10 \;; +#X scalar rect 332 359 1 10 \;; +#X scalar rect 344.5 359 1 10 \;; +#X scalar rect 357 359 2 10 \;; +#X scalar rect 57 599 2 10 \;; +#X scalar rect 90.3333 599 1 10 \;; +#X scalar rect 123.667 599 2 10 \;; +#X scalar rect 157 599 1 10 \;; +#X scalar rect 190.333 599 2 10 \;; +#X scalar rect 223.667 599 1 10 \;; +#X scalar rect 257 599 2 10 \;; +#X scalar rect 57 569 2 10 \;; +#X scalar rect 77 569 1 10 \;; +#X scalar rect 97 569 2 10 \;; +#X scalar rect 117 569 1 10 \;; +#X scalar rect 137 569 2 10 \;; +#X scalar rect 157 569 1 10 \;; +#X scalar rect 177 569 2 10 \;; +#X scalar rect 197 569 1 10 \;; +#X scalar rect 217 569 2 10 \;; +#X scalar rect 237 569 1 10 \;; +#X scalar rect 257 569 2 10 \;; +#X scalar rect 57 539 2 10 \;; +#X scalar rect 71.2857 539 1 10 \;; +#X scalar rect 85.5714 539 2 10 \;; +#X scalar rect 99.8571 539 1 10 \;; +#X scalar rect 114.143 539 2 10 \;; +#X scalar rect 128.429 539 1 10 \;; +#X scalar rect 142.714 539 2 10 \;; +#X scalar rect 157 539 1 10 \;; +#X scalar rect 171.286 539 2 10 \;; +#X scalar rect 185.571 539 1 10 \;; +#X scalar rect 199.857 539 2 10 \;; +#X scalar rect 214.143 539 1 10 \;; +#X scalar rect 228.429 539 2 10 \;; +#X scalar rect 242.714 539 1 10 \;; +#X scalar rect 257 539 2 10 \;; +#X scalar rect 57 29 2 580 \;; +#X scalar rect 157 29 2 580 \;; +#X scalar rect 257 29 2 580 \;; +#X scalar rect 357 29 2 450 \;; +#X scalar rect 457 29 2 280 \;; +#X scalar rect 557 29 2 150 \;; +#X text 21 50 3:2; +#X text 21 78 5:2; +#X text 21 107 7:2; +#X text 18 170 2:3; +#X text 19 200 4:3; +#X text 20 231 5:3; +#X text 19 260 7:3; +#X text 20 287 8:3; +#X text 20 349 3:4; +#X text 21 378 5:4; +#X text 21 408 7:4; +#X text 19 467 4:5; +#X text 19 499 6:5; +#X text 21 528 7:5; +#X text 21 558 8:5; +#X text 303 93 Inspired by Ed Harkins's rhythm seminar.; +#X text 307 32 Dual rhythmic patterns: the dark marks are; +#X text 305 53 the beats and the lighter ones help; +#X text 304 73 show the proportions.; +#X coords 0 659 1 658 0 0 0; +#X restore 24 98 pd output; +#N canvas 386 64 781 519 generator 0; +#X obj 646 4 r start; +#X obj 645 71 pointer; +#X obj 646 27 symbol; +#X obj 645 92 s this-ptr; +#X msg 645 49 traverse \$1 \, bang; +#X msg 69 16 \; pd-output clear; +#X msg 187 18 \; start pd-output; +#X obj 57 170 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 208 170 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 362 171 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 57 138 r add-pts1; +#X obj 52 258 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 187 259 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 322 260 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 53 230 r add-pts1; +#X obj 57 190 beat-maker 3 2 600; +#X obj 208 189 beat-maker 5 2 570; +#X obj 362 190 beat-maker 7 2 540; +#X obj 454 259 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 593 257 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 56 343 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 191 344 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 326 345 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 57 315 r add-pts1; +#X obj 52 445 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 187 446 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 322 447 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 53 417 r add-pts1; +#X obj 460 448 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 53 278 beat-maker 2 3 480; +#X obj 323 278 beat-maker 5 3 420; +#X obj 455 278 beat-maker 7 3 390; +#X obj 594 276 beat-maker 8 3 360; +#X obj 55 363 beat-maker 3 4 300; +#X obj 189 364 beat-maker 5 4 270; +#X obj 328 364 beat-maker 7 4 240; +#X obj 52 465 beat-maker 4 5 180; +#X obj 186 466 beat-maker 6 5 150; +#X obj 324 466 beat-maker 7 5 120; +#X obj 462 467 beat-maker 8 5 90; +#X obj 187 279 beat-maker 4 3 450; +#X msg 450 14 \; add-rect 40 30 2 580 \; add-rect 140 30 2 580 \; add-rect +240 30 2 580 \; add-rect 340 30 2 450 \; add-rect 440 30 2 280 \; add-rect +540 30 2 150 \;; +#X msg 305 19 \; add-pts1 bang \;; +#X connect 0 0 2 0; +#X connect 1 0 3 0; +#X connect 2 0 4 0; +#X connect 4 0 1 0; +#X connect 7 0 15 0; +#X connect 8 0 16 0; +#X connect 9 0 17 0; +#X connect 10 0 7 0; +#X connect 10 0 8 0; +#X connect 10 0 9 0; +#X connect 11 0 29 0; +#X connect 12 0 40 0; +#X connect 13 0 30 0; +#X connect 14 0 11 0; +#X connect 14 0 12 0; +#X connect 14 0 13 0; +#X connect 14 0 18 0; +#X connect 14 0 19 0; +#X connect 18 0 31 0; +#X connect 19 0 32 0; +#X connect 20 0 33 0; +#X connect 21 0 34 0; +#X connect 22 0 35 0; +#X connect 23 0 20 0; +#X connect 23 0 21 0; +#X connect 23 0 22 0; +#X connect 24 0 36 0; +#X connect 25 0 37 0; +#X connect 26 0 38 0; +#X connect 27 0 24 0; +#X connect 27 0 25 0; +#X connect 27 0 26 0; +#X connect 27 0 28 0; +#X connect 28 0 39 0; +#X restore 26 38 pd generator; diff --git a/pd/doc/7.stuff/data-structures/9.sliderule.pd b/pd/doc/7.stuff/data-structures/9.sliderule.pd new file mode 100644 index 00000000..e26941ef --- /dev/null +++ b/pd/doc/7.stuff/data-structures/9.sliderule.pd @@ -0,0 +1,196 @@ +#N struct label float x float y float n; +#N struct line float x float y float w; +#N canvas 564 9 276 218 10; +#N canvas 15 0 504 847 data 1; +#X scalar label 55 190.999 43 \;; +#X scalar label 175 196.826 44 \;; +#X scalar label 175 203 45 \;; +#X scalar label 175 209.541 46 \;; +#X scalar label 55 216.471 47 \;; +#X scalar label 175 223.813 48 \;; +#X scalar label 175 231.591 49 \;; +#X scalar label 55 239.832 50 \;; +#X scalar label 175 248.563 51 \;; +#X scalar label 175 257.814 52 \;; +#X scalar label 55 267.614 53 \;; +#X scalar label 175 277.997 54 \;; +#X scalar label 175 288.998 55 \;; +#X scalar label 175 300.652 56 \;; +#X scalar label 55 313 57 \;; +#X scalar label 175 326.082 58 \;; +#X scalar label 175 339.942 59 \;; +#X scalar label 155 354.626 60 \;; +#X scalar label 175 370.183 61 \;; +#X scalar label 175 386.665 62 \;; +#X scalar label 175 404.127 63 \;; +#X scalar label 55 422.628 64 \;; +#X scalar label 175 442.228 65 \;; +#X scalar label 175 462.994 66 \;; +#X scalar label 55 484.995 67 \;; +#X scalar label 175 508.305 68 \;; +#X scalar label 175 533 69 \;; +#X scalar label 175 559.164 70 \;; +#X scalar label 55 586.883 71 \;; +#X scalar label 175 616.251 72 \;; +#X scalar label 175 647.365 73 \;; +#X scalar label 55 680.33 74 \;; +#X scalar label 175 715.254 75 \;; +#X scalar label 175 752.255 76 \;; +#X scalar label 55 791.456 77 \;; +#X scalar line 175 87 100 \;; +#X scalar line 195 135.999 60 \;; +#X scalar line 195 138.913 60 \;; +#X scalar line 195 142 60 \;; +#X scalar line 195 145.271 60 \;; +#X scalar line 195 148.735 60 \;; +#X scalar line 175 152.406 100 \;; +#X scalar line 195 156.296 60 \;; +#X scalar line 195 160.416 60 \;; +#X scalar line 195 164.782 60 \;; +#X scalar line 195 169.407 60 \;; +#X scalar line 195 174.307 60 \;; +#X scalar line 195 179.499 60 \;; +#X scalar line 75 184.999 300 \;; +#X scalar line 195 190.826 60 \;; +#X scalar line 195 197 60 \;; +#X scalar line 195 203.541 60 \;; +#X scalar line 75 210.471 300 \;; +#X scalar line 195 217.813 60 \;; +#X scalar line 195 225.591 60 \;; +#X scalar line 75 233.832 300 \;; +#X scalar line 195 242.563 60 \;; +#X scalar line 195 251.814 60 \;; +#X scalar line 75 261.614 300 \;; +#X scalar line 195 271.997 60 \;; +#X scalar line 195 282.998 60 \;; +#X scalar line 195 294.652 60 \;; +#X scalar line 75 307 300 \;; +#X scalar line 195 320.082 60 \;; +#X scalar line 195 333.942 60 \;; +#X scalar line 175 348.626 100 \;; +#X scalar line 195 364.183 60 \;; +#X scalar line 195 380.665 60 \;; +#X scalar line 195 398.127 60 \;; +#X scalar line 75 416.628 300 \;; +#X scalar line 195 436.228 60 \;; +#X scalar line 195 456.994 60 \;; +#X scalar line 75 478.995 300 \;; +#X scalar line 195 502.305 60 \;; +#X scalar line 195 527 60 \;; +#X scalar line 195 553.164 60 \;; +#X scalar line 75 580.883 300 \;; +#X scalar line 195 610.251 60 \;; +#X scalar line 195 641.365 60 \;; +#X scalar line 75 674.33 300 \;; +#X scalar line 195 709.254 60 \;; +#X scalar line 195 746.255 60 \;; +#X scalar line 75 785.456 300 \;; +#X text 50 -32 Linear frequency chart -- cut this down the middle and +use as a slide rule to compute frequency shifts. The longer lines are +staves with the bass and treble clef. The numbers are the MIDI pitches. +; +#X text 148 686 36; +#X text 109 751 zero Hz.; +#X coords 0 847 1 846 0 0 0; +#X restore 46 51 pd data; +#N canvas 308 63 600 392 line 0; +#X obj 140 114 drawpolygon 0 1 0 0 w 0; +#X obj 145 63 struct line float x float y float w; +#X restore 46 76 pd line; +#N canvas 567 89 600 392 label 0; +#X obj 140 114 drawnumber n 0 0 0; +#X obj 145 63 struct label float x float y float n; +#X restore 48 100 pd label; +#N canvas 468 99 775 518 generator 0; +#X obj 353 173 sel 36 60; +#X obj 457 171 pointer; +#X msg 457 149 traverse pd-data \, bang; +#X msg 28 11 \; pd-data clear; +#X obj 146 52 until; +#X obj 146 76 float; +#X obj 193 77 + 1; +#X obj 146 100 moses 77; +#X obj 245 76 t b; +#X obj 146 31 t b b; +#X msg 146 10 bang; +#X obj 83 116 t f f f; +#X obj 137 196 t b b; +#X obj 135 150 sel 43 47 50 53 57 64 67 71 74 77; +#X msg 219 46 30; +#X obj 49 89 sel 30; +#X obj 52 149 mtof; +#X obj 11 191 t b b; +#X obj 12 231 0; +#X msg 248 221 100; +#X msg 322 222 60; +#X msg 216 222 150; +#X msg 293 222 170; +#X obj 195 377 append line y x w; +#X obj 52 257 + 20; +#X msg 132 220 50; +#X msg 161 219 300; +#X obj 144 409 - 20; +#X obj 105 437 append label y x n; +#X obj 58 375 + 6; +#X obj 52 170 * 1; +#X obj 59 407 moses 120; +#X connect 0 0 21 0; +#X connect 0 0 19 0; +#X connect 0 1 19 0; +#X connect 0 1 21 0; +#X connect 0 2 22 0; +#X connect 0 2 20 0; +#X connect 1 0 23 3; +#X connect 1 0 28 3; +#X connect 2 0 1 0; +#X connect 4 0 5 0; +#X connect 5 0 6 0; +#X connect 5 0 7 0; +#X connect 5 0 15 0; +#X connect 6 0 5 1; +#X connect 7 1 8 0; +#X connect 8 0 4 1; +#X connect 9 0 4 0; +#X connect 9 1 14 0; +#X connect 9 1 2 0; +#X connect 10 0 9 0; +#X connect 11 0 16 0; +#X connect 11 1 28 2; +#X connect 11 2 13 0; +#X connect 12 0 25 0; +#X connect 12 1 26 0; +#X connect 13 0 12 0; +#X connect 13 1 12 0; +#X connect 13 2 12 0; +#X connect 13 3 12 0; +#X connect 13 4 12 0; +#X connect 13 5 12 0; +#X connect 13 6 12 0; +#X connect 13 7 12 0; +#X connect 13 8 12 0; +#X connect 13 9 12 0; +#X connect 13 10 0 0; +#X connect 14 0 5 1; +#X connect 15 0 17 0; +#X connect 15 1 11 0; +#X connect 16 0 30 0; +#X connect 17 0 18 0; +#X connect 17 1 21 0; +#X connect 17 1 19 0; +#X connect 18 0 24 0; +#X connect 19 0 23 2; +#X connect 20 0 23 2; +#X connect 21 0 23 1; +#X connect 21 0 27 0; +#X connect 22 0 23 1; +#X connect 22 0 27 0; +#X connect 24 0 23 0; +#X connect 24 0 29 0; +#X connect 25 0 23 1; +#X connect 25 0 27 0; +#X connect 26 0 23 2; +#X connect 27 0 28 1; +#X connect 29 0 31 0; +#X connect 30 0 24 0; +#X connect 31 1 28 0; +#X restore 54 131 pd generator; diff --git a/pd/doc/7.stuff/data-structures/beat-maker.pd b/pd/doc/7.stuff/data-structures/beat-maker.pd new file mode 100644 index 00000000..014ae0ac --- /dev/null +++ b/pd/doc/7.stuff/data-structures/beat-maker.pd @@ -0,0 +1,44 @@ +#N canvas 432 246 737 444 10; +#X obj 114 109 until; +#X obj 116 84 t b b; +#X obj 116 147 f; +#X msg 160 85 0; +#X obj 179 137 + 1; +#X obj 115 63 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 118 180 t f f; +#X obj 115 38 inlet; +#X obj 232 214 pack 0 \$2; +#X obj 191 289 expr 1 + (($f1 % $f2) == 0); +#X obj 115 314 pack 0 \$3 0; +#X msg 115 337 \; add-rect \$1 \$2 \$3 10; +#X obj 117 216 pack 0 \$1 \$2; +#X obj 294 43 loadbang; +#X obj 295 67 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 179 164 sel; +#X floatatom 295 117 5 0 0 0 - - -; +#X obj 296 89 expr \$1 * \$2 + 1; +#X obj 117 259 expr 40 + 100 * $f1/$f2; +#X connect 0 0 2 0; +#X connect 1 0 0 0; +#X connect 1 1 3 0; +#X connect 2 0 4 0; +#X connect 2 0 6 0; +#X connect 3 0 2 1; +#X connect 4 0 2 1; +#X connect 4 0 15 0; +#X connect 5 0 1 0; +#X connect 6 0 12 0; +#X connect 6 1 8 0; +#X connect 7 0 5 0; +#X connect 8 0 9 0; +#X connect 9 0 10 2; +#X connect 10 0 11 0; +#X connect 12 0 18 0; +#X connect 13 0 14 0; +#X connect 14 0 17 0; +#X connect 15 0 0 1; +#X connect 17 0 15 1; +#X connect 17 0 16 0; +#X connect 18 0 10 0; diff --git a/pd/extra/choice/makefile b/pd/extra/choice/makefile index 61866ffc..a66e82bd 100644 --- a/pd/extra/choice/makefile +++ b/pd/extra/choice/makefile @@ -12,13 +12,13 @@ pd_nt: $(NAME).dll PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo VC="C:\Program Files\Microsoft Visual Studio\Vc98" -PDNTINCLUDE = /I. /I\tcl\include /I\ftp\pd\src /I$(VC)\include +PDNTINCLUDE = /I. /I..\..\src /I$(VC)\include PDNTLDIR = $(VC)\lib PDNTLIB = $(PDNTLDIR)\libc.lib \ $(PDNTLDIR)\oldnames.lib \ $(PDNTLDIR)\kernel32.lib \ - \ftp\pd\bin\pd.lib + ..\..\bin\pd.lib .c.dll: cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c diff --git a/pd/extra/pique/makefile b/pd/extra/pique/makefile index 2a565566..47a7463e 100644 --- a/pd/extra/pique/makefile +++ b/pd/extra/pique/makefile @@ -12,13 +12,13 @@ pd_nt: $(NAME).dll PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo VC="C:\Program Files\Microsoft Visual Studio\Vc98" -PDNTINCLUDE = /I. /I\tcl\include /I\ftp\pd\src /I$(VC)\include +PDNTINCLUDE = /I. /I..\..\src /I$(VC)\include PDNTLDIR = $(VC)\lib PDNTLIB = $(PDNTLDIR)\libc.lib \ $(PDNTLDIR)\oldnames.lib \ $(PDNTLDIR)\kernel32.lib \ - \ftp\pd\bin\pd.lib + ..\..\bin\pd.lib .c.dll: cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c diff --git a/pd/src/configure b/pd/src/configure index 88e26a18..9205ddb3 100755 --- a/pd/src/configure +++ b/pd/src/configure @@ -2194,19 +2194,20 @@ echo "no X11 found" || exit 1 fi + ac_safe=`echo "tcl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tcl.h""... $ac_c" 1>&6 -echo "configure:2200: checking for tcl.h" >&5 +echo "configure:2201: checking for tcl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2205 "configure" +#line 2206 "configure" #include "confdefs.h" #include <tcl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2210: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2227,17 +2228,17 @@ else echo "$ac_t""no" 1>&6 ac_safe=`echo "tcl8.1/tcl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tcl8.1/tcl.h""... $ac_c" 1>&6 -echo "configure:2231: checking for tcl8.1/tcl.h" >&5 +echo "configure:2232: checking for tcl8.1/tcl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2236 "configure" +#line 2237 "configure" #include "confdefs.h" #include <tcl8.1/tcl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2241: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2258,17 +2259,17 @@ else echo "$ac_t""no" 1>&6 ac_safe=`echo "tcl8.2/tcl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tcl8.2/tcl.h""... $ac_c" 1>&6 -echo "configure:2262: checking for tcl8.2/tcl.h" >&5 +echo "configure:2263: checking for tcl8.2/tcl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2267 "configure" +#line 2268 "configure" #include "confdefs.h" #include <tcl8.2/tcl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2272: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2273: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2289,17 +2290,17 @@ else echo "$ac_t""no" 1>&6 ac_safe=`echo "tcl8.3/tcl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tcl8.3/tcl.h""... $ac_c" 1>&6 -echo "configure:2293: checking for tcl8.3/tcl.h" >&5 +echo "configure:2294: checking for tcl8.3/tcl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2298 "configure" +#line 2299 "configure" #include "confdefs.h" #include <tcl8.3/tcl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2303: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2320,17 +2321,17 @@ else echo "$ac_t""no" 1>&6 ac_safe=`echo "tcl8.4/tcl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tcl8.4/tcl.h""... $ac_c" 1>&6 -echo "configure:2324: checking for tcl8.4/tcl.h" >&5 +echo "configure:2325: checking for tcl8.4/tcl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2329 "configure" +#line 2330 "configure" #include "confdefs.h" #include <tcl8.4/tcl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2334: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2351,17 +2352,79 @@ else echo "$ac_t""no" 1>&6 ac_safe=`echo "tcl8.5/tcl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tcl8.5/tcl.h""... $ac_c" 1>&6 -echo "configure:2355: checking for tcl8.5/tcl.h" >&5 +echo "configure:2356: checking for tcl8.5/tcl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2360 "configure" +#line 2361 "configure" #include "confdefs.h" #include <tcl8.5/tcl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2365: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2366: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.5" +else + echo "$ac_t""no" 1>&6 +ac_safe=`echo "tcl8.6/tcl.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for tcl8.6/tcl.h""... $ac_c" 1>&6 +echo "configure:2387: checking for tcl8.6/tcl.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2392 "configure" +#include "confdefs.h" +#include <tcl8.6/tcl.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2397: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.5" +else + echo "$ac_t""no" 1>&6 +ac_safe=`echo "tcl8.7/tcl.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for tcl8.7/tcl.h""... $ac_c" 1>&6 +echo "configure:2418: checking for tcl8.7/tcl.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2423 "configure" +#include "confdefs.h" +#include <tcl8.7/tcl.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2428: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2393,9 +2456,177 @@ fi fi +fi + +fi + + +echo $ac_n "checking for main in -ltcl8.7""... $ac_c" 1>&6 +echo "configure:2466: checking for main in -ltcl8.7" >&5 +ac_lib_var=`echo tcl8.7'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ltcl8.7 $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2474 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:2481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo tcl8.7 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-ltcl8.7 $LIBS" + +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for main in -ltcl8.6""... $ac_c" 1>&6 +echo "configure:2507: checking for main in -ltcl8.6" >&5 +ac_lib_var=`echo tcl8.6'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ltcl8.6 $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2515 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:2522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo tcl8.6 | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-ltcl8.6 $LIBS" + +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for main in -ltcl8.5""... $ac_c" 1>&6 +echo "configure:2548: checking for main in -ltcl8.5" >&5 +ac_lib_var=`echo tcl8.5'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ltcl8.5 $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2556 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:2563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo tcl8.5 | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-ltcl8.5 $LIBS" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for main in -ltcl8.4""... $ac_c" 1>&6 +echo "configure:2589: checking for main in -ltcl8.4" >&5 +ac_lib_var=`echo tcl8.4'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ltcl8.4 $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2597 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:2604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo tcl8.4 | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-ltcl8.4 $LIBS" + +else + echo "$ac_t""no" 1>&6 echo $ac_n "checking for main in -ltcl8.3""... $ac_c" 1>&6 -echo "configure:2399: checking for main in -ltcl8.3" >&5 +echo "configure:2630: checking for main in -ltcl8.3" >&5 ac_lib_var=`echo tcl8.3'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2403,14 +2634,14 @@ else ac_save_LIBS="$LIBS" LIBS="-ltcl8.3 $LIBS" cat > conftest.$ac_ext <<EOF -#line 2407 "configure" +#line 2638 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:2414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2425,7 +2656,7 @@ LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tcl8.3 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + ac_tr_lib=HAVE_LIB`echo tcl8.3 | sed -e 's/^a-zA-Z0-9_/_/g' \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` cat >> confdefs.h <<EOF #define $ac_tr_lib 1 @@ -2436,7 +2667,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for main in -ltcl8.2""... $ac_c" 1>&6 -echo "configure:2440: checking for main in -ltcl8.2" >&5 +echo "configure:2671: checking for main in -ltcl8.2" >&5 ac_lib_var=`echo tcl8.2'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2444,14 +2675,14 @@ else ac_save_LIBS="$LIBS" LIBS="-ltcl8.2 $LIBS" cat > conftest.$ac_ext <<EOF -#line 2448 "configure" +#line 2679 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:2455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2477,7 +2708,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for main in -ltcl8.0""... $ac_c" 1>&6 -echo "configure:2481: checking for main in -ltcl8.0" >&5 +echo "configure:2712: checking for main in -ltcl8.0" >&5 ac_lib_var=`echo tcl8.0'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2485,14 +2716,14 @@ else ac_save_LIBS="$LIBS" LIBS="-ltcl8.0 $LIBS" cat > conftest.$ac_ext <<EOF -#line 2489 "configure" +#line 2720 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:2496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2523,9 +2754,181 @@ fi fi +fi + +fi + +fi + +fi + + +echo $ac_n "checking for main in -ltk8.7""... $ac_c" 1>&6 +echo "configure:2768: checking for main in -ltk8.7" >&5 +ac_lib_var=`echo tk8.7'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ltk8.7 $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2776 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:2783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo tk8.7 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-ltk8.7 $LIBS" + +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for main in -ltk8.6""... $ac_c" 1>&6 +echo "configure:2809: checking for main in -ltk8.6" >&5 +ac_lib_var=`echo tk8.6'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ltk8.6 $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2817 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:2824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo tk8.6 | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-ltk8.6 $LIBS" + +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for main in -ltk8.5""... $ac_c" 1>&6 +echo "configure:2850: checking for main in -ltk8.5" >&5 +ac_lib_var=`echo tk8.5'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ltk8.5 $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2858 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:2865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo tk8.5 | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-ltk8.5 $LIBS" + +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for main in -ltk8.4""... $ac_c" 1>&6 +echo "configure:2891: checking for main in -ltk8.4" >&5 +ac_lib_var=`echo tk8.4'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ltk8.4 $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2899 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:2906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo tk8.4 | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-ltk8.4 $LIBS" + +else + echo "$ac_t""no" 1>&6 echo $ac_n "checking for main in -ltk8.3""... $ac_c" 1>&6 -echo "configure:2529: checking for main in -ltk8.3" >&5 +echo "configure:2932: checking for main in -ltk8.3" >&5 ac_lib_var=`echo tk8.3'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2533,14 +2936,14 @@ else ac_save_LIBS="$LIBS" LIBS="-ltk8.3 $LIBS" cat > conftest.$ac_ext <<EOF -#line 2537 "configure" +#line 2940 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:2544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2555,7 +2958,7 @@ LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tk8.3 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + ac_tr_lib=HAVE_LIB`echo tk8.3 | sed -e 's/^a-zA-Z0-9_/_/g' \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` cat >> confdefs.h <<EOF #define $ac_tr_lib 1 @@ -2566,7 +2969,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for main in -ltk8.2""... $ac_c" 1>&6 -echo "configure:2570: checking for main in -ltk8.2" >&5 +echo "configure:2973: checking for main in -ltk8.2" >&5 ac_lib_var=`echo tk8.2'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2574,14 +2977,14 @@ else ac_save_LIBS="$LIBS" LIBS="-ltk8.2 $LIBS" cat > conftest.$ac_ext <<EOF -#line 2578 "configure" +#line 2981 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:2585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2607,7 +3010,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for main in -ltk8.0""... $ac_c" 1>&6 -echo "configure:2611: checking for main in -ltk8.0" >&5 +echo "configure:3014: checking for main in -ltk8.0" >&5 ac_lib_var=`echo tk8.0'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2615,14 +3018,14 @@ else ac_save_LIBS="$LIBS" LIBS="-ltk8.0 $LIBS" cat > conftest.$ac_ext <<EOF -#line 2619 "configure" +#line 3022 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:2626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2653,6 +3056,14 @@ fi fi +fi + +fi + +fi + +fi + diff --git a/pd/src/configure.in b/pd/src/configure.in index ad1eba66..edc2250c 100644 --- a/pd/src/configure.in +++ b/pd/src/configure.in @@ -82,21 +82,33 @@ dnl Checking for `XCreateWindow' function in -lX11: AC_CHECK_LIB(X11, XCreateWindow, LIBS="$LIBS -lX11 -L$x_libraries", echo "no X11 found" || exit 1, -L$x_libraries) +dnl look for tcl 8.x... do I really have to go through all this!? + AC_CHECK_HEADER(tcl.h,, AC_CHECK_HEADER(tcl8.1/tcl.h,GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.1", AC_CHECK_HEADER(tcl8.2/tcl.h,GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.2", AC_CHECK_HEADER(tcl8.3/tcl.h,GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.3", AC_CHECK_HEADER(tcl8.4/tcl.h,GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.4", AC_CHECK_HEADER(tcl8.5/tcl.h,GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.5", - echo "no tcl/tk header found" || exit 1)))))) - -AC_CHECK_LIB(tcl8.3, main,, - AC_CHECK_LIB(tcl8.2, main,, - AC_CHECK_LIB(tcl8.0, main))) - -AC_CHECK_LIB(tk8.3, main,, - AC_CHECK_LIB(tk8.2, main,, - AC_CHECK_LIB(tk8.0, main))) + AC_CHECK_HEADER(tcl8.6/tcl.h,GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.5", + AC_CHECK_HEADER(tcl8.7/tcl.h,GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.5", + echo "no tcl/tk header found" || exit 1)))))))) + +AC_CHECK_LIB(tcl8.7, main,, + AC_CHECK_LIB(tcl8.6, main,, + AC_CHECK_LIB(tcl8.5, main,, + AC_CHECK_LIB(tcl8.4, main,, + AC_CHECK_LIB(tcl8.3, main,, + AC_CHECK_LIB(tcl8.2, main,, + AC_CHECK_LIB(tcl8.0, main))))))) + +AC_CHECK_LIB(tk8.7, main,, + AC_CHECK_LIB(tk8.6, main,, + AC_CHECK_LIB(tk8.5, main,, + AC_CHECK_LIB(tk8.4, main,, + AC_CHECK_LIB(tk8.3, main,, + AC_CHECK_LIB(tk8.2, main,, + AC_CHECK_LIB(tk8.0, main))))))) dnl Checking for tk.h or tkstep.h - not used at the moment dnl AC_CHECK_HEADER(tk.h,DEFINES="$DEFINES -DTKINC=\\\"tk.h\\\"") diff --git a/pd/src/core.5452 b/pd/src/core.5452 Binary files differnew file mode 100644 index 00000000..56382f9f --- /dev/null +++ b/pd/src/core.5452 diff --git a/pd/src/core.5470 b/pd/src/core.5470 Binary files differnew file mode 100644 index 00000000..d07e2d4a --- /dev/null +++ b/pd/src/core.5470 diff --git a/pd/src/core.5487 b/pd/src/core.5487 Binary files differnew file mode 100644 index 00000000..3b2acc4a --- /dev/null +++ b/pd/src/core.5487 diff --git a/pd/src/d_array.c b/pd/src/d_array.c index 3491ad35..e870b522 100644 --- a/pd/src/d_array.c +++ b/pd/src/d_array.c @@ -52,8 +52,7 @@ static t_int *tabwrite_tilde_perform(t_int *w) while (nxfer--) { float f = *in++; - /* bash NANs and underflow/overflow hazards to zero */ - if (!((f > 1.0e-20f && f < 1.0e20f) || (f < -1e-20f && f > -1e20))) + if (PD_BADFLOAT(f)) f = 0; *fp++ = f; } @@ -735,8 +734,7 @@ static t_int *tabsend_perform(t_int *w) while (n--) { float f = *in++; - /* bash NANs and underflow/overflow hazards to zero */ - if (!((f > 1.0e-20f && f < 1.0e20f) || (f < -1e-20f && f > -1e20))) + if (PD_BADFLOAT(f)) f = 0; *dest++ = f; } diff --git a/pd/src/d_ctl.c b/pd/src/d_ctl.c index e143a067..461703d2 100644 --- a/pd/src/d_ctl.c +++ b/pd/src/d_ctl.c @@ -105,9 +105,9 @@ static t_int *line_perform(t_int *w) t_float *out = (t_float *)(w[2]); int n = (int)(w[3]); float f = x->x_value; - /* bash NANs and underflow/overflow hazards to zero */ - if (!((f > 1.0e-20f && f < 1.0e20f) || (f < -1e-20f && f > -1e20))) - x->x_value = f = 0; + + if (PD_BADFLOAT(f)) + x->x_value = f = 0; if (x->x_retarget) { int nticks = x->x_inletwas * x->x_msectodsptick; diff --git a/pd/src/d_delay.c b/pd/src/d_delay.c index f14bb112..edcf1235 100644 --- a/pd/src/d_delay.c +++ b/pd/src/d_delay.c @@ -78,8 +78,7 @@ static t_int *sigdelwrite_perform(t_int *w) while (n--) { float f = *in++; - /* bash NANs and underflow/overflow hazards to zero */ - if (!((f > 1.0e-20f && f < 1.0e20f) || (f < -1e-20f && f > -1e20))) + if (PD_BADFLOAT(f)) f = 0; *bp++ = f; if (bp == ep) diff --git a/pd/src/d_filter.c b/pd/src/d_filter.c index 1693cd85..88318900 100644 --- a/pd/src/d_filter.c +++ b/pd/src/d_filter.c @@ -4,7 +4,6 @@ /* "filters", both linear and nonlinear. */ - #include "m_pd.h" #include <math.h> @@ -65,9 +64,8 @@ static t_int *sighip_perform(t_int *w) *out++ = new - last; last = new; } - /* NAN protect */ - if (!((last <= 0) || (last >= 0))) - last = 0; + if (PD_BADFLOAT(last)) + last = 0; c->c_x = last; return (w+5); } @@ -158,8 +156,7 @@ static t_int *siglop_perform(t_int *w) float feedback = 1 - coef; for (i = 0; i < n; i++) last = *out++ = coef * *in++ + feedback * last; - /* NAN protect */ - if (!((last <= 0) || (last >= 0))) + if (PD_BADFLOAT(last)) last = 0; c->c_x = last; return (w+5); @@ -290,10 +287,9 @@ static t_int *sigbp_perform(t_int *w) prev = last; last = output; } - /* NAN protect */ - if (!((last <= 0) || (last >= 0))) + if (PD_BADFLOAT(last)) last = 0; - if (!((prev <= 0) || (prev >= 0))) + if (PD_BADFLOAT(prev)) prev = 0; c->c_x1 = last; c->c_x2 = prev; @@ -376,6 +372,8 @@ static t_int *sigbiquad_perform(t_int *w) for (i = 0; i < n; i++) { float output = *in++ + fb1 * last + fb2 * prev; + if (PD_BADFLOAT(output)) + output = 0; *out++ = ff1 * output + ff2 * last + ff3 * prev; prev = last; last = output; diff --git a/pd/src/d_global.c b/pd/src/d_global.c index 633eba1c..a84a1ae0 100644 --- a/pd/src/d_global.c +++ b/pd/src/d_global.c @@ -41,9 +41,9 @@ static t_int *sigsend_perform(t_int *w) while (n--) { float f = *in++; - /* bash NANs and underflow/overflow hazards to zero */ - if (!((f > 1.0e-20f && f < 1.0e20f) || (f < -1e-20f && f > -1e20))) + if (PD_BADFLOAT(f)) f = 0; + *out++ = f; } return (w+4); @@ -245,9 +245,8 @@ static t_int *sigthrow_perform(t_int *w) while (n--) { float f = *in++; - /* bash NANs and underflow/overflow hazards to zero */ - if (!((f > 1.0e-20f && f < 1.0e20f) || (f < -1e-20f && f > -1e20))) - f = 0; + if (PD_BADFLOAT(f)) + f = 0; *out++ += f; } } diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c index 5bbf2f4a..db562404 100644 --- a/pd/src/g_all_guis.c +++ b/pd/src/g_all_guis.c @@ -26,8 +26,6 @@ /*------------------ global varaibles -------------------------*/ -t_symbol *iemgui_key_sym=0; - int iemgui_color_hex[]= { 16579836, 10526880, 4210752, 16572640, 16572608, @@ -741,56 +739,6 @@ void iemgui_color(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_CONFIG); } -int iemgui_list(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) -{ - if(iemgui->x_fsf.x_selected) - { - if((ac == 2)&&IS_A_FLOAT(av,0)&&IS_A_SYMBOL(av,1)) - { - t_symbol *key = atom_getsymbolarg(1, ac, av); - int keydown = atom_getintarg(0, ac, av); - - if(keydown) - { - int refresh = 1,i,d=1; - static char buf[20]; - - buf[0] = 0; - if(!strcmp(key->s_name, "Shift_L")||!strcmp(key->s_name, "Shift_R")) - iemgui->x_fsf.x_shiftdown = 1; - else - { - if(iemgui->x_fsf.x_shiftdown) - d = 10; - if(!strcmp(key->s_name, "Up")) - iemgui->x_obj.te_ypix -= d; - else if(!strcmp(key->s_name, "Down")) - iemgui->x_obj.te_ypix += d; - else if(!strcmp(key->s_name, "Left")) - iemgui->x_obj.te_xpix -= d; - else if(!strcmp(key->s_name, "Right")) - iemgui->x_obj.te_xpix += d; - else - refresh = 0; - if(refresh) - return(1); - } - return(0); - } - else - { - if(!strcmp(key->s_name, "Shift_L")||!strcmp(key->s_name, "Shift_R")) - iemgui->x_fsf.x_shiftdown = 0; - return(0); - } - } - else - return(-1); - } - else - return(-1); -} - void iemgui_displace(t_gobj *z, t_glist *glist, int dx, int dy) { t_iemguidummy *x = (t_iemguidummy *)z; diff --git a/pd/src/g_all_guis.h b/pd/src/g_all_guis.h index 54f9cef4..ec9d4e69 100644 --- a/pd/src/g_all_guis.h +++ b/pd/src/g_all_guis.h @@ -265,8 +265,10 @@ typedef struct _vdial t_atom x_at[2]; } t_vdial; +#define t_vradio t_vdial +#define t_hradio t_hdial + extern int sys_noloadbang; -extern t_symbol *iemgui_key_sym; extern int iemgui_color_hex[]; extern int iemgui_vu_db2i[]; extern int iemgui_vu_col[]; diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c index cb92c685..399f45f4 100644 --- a/pd/src/g_bang.c +++ b/pd/src/g_bang.c @@ -151,14 +151,12 @@ void bng_draw_select(t_bng* x, t_glist* glist) if(x->x_gui.x_fsf.x_selected) { - pd_bind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); sys_vgui(".x%x.c itemconfigure %xBUT -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); } else { - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); sys_vgui(".x%x.c itemconfigure %xBUT -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); @@ -359,17 +357,7 @@ static void bng_pointer(t_bng *x, t_gpointer *gp) static void bng_list(t_bng *x, t_symbol *s, int ac, t_atom *av) { - int l=iemgui_list((void *)x, &x->x_gui, s, ac, av); - - if(l < 0) - { - bng_bang2(x); - } - else if(l > 0) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); - } + bng_bang2(x); } static void bng_anything(t_bng *x, t_symbol *s, int argc, t_atom *argv) @@ -548,8 +536,6 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv) static void bng_ff(t_bng *x) { - if(x->x_gui.x_fsf.x_selected) - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); clock_free(x->x_clock_lck); @@ -584,8 +570,6 @@ void g_bang_setup(void) class_addmethod(bng_class, (t_method)bng_label_pos, gensym("label_pos"), A_GIMME, 0); class_addmethod(bng_class, (t_method)bng_label_font, gensym("label_font"), A_GIMME, 0); class_addmethod(bng_class, (t_method)bng_init, gensym("init"), A_FLOAT, 0); - if(!iemgui_key_sym) - iemgui_key_sym = gensym("#keyname"); bng_widgetbehavior.w_getrectfn = bng_getrect; bng_widgetbehavior.w_displacefn = iemgui_displace; bng_widgetbehavior.w_selectfn = iemgui_select; diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c index c63b2c0b..8bad09a9 100644 --- a/pd/src/g_canvas.c +++ b/pd/src/g_canvas.c @@ -254,6 +254,15 @@ void canvas_rename(t_canvas *x, t_symbol *s, t_symbol *dir) /* --------------- traversing the set of lines in a canvas ----------- */ +int canvas_getindex(t_canvas *x, t_gobj *y) +{ + t_gobj *y2; + int indexno; + for (indexno = 0, y2 = x->gl_list; y2 && y2 != y; y2 = y2->g_next) + indexno++; + return (indexno); +} + void linetraverser_start(t_linetraverser *t, t_canvas *x) { t->tr_ob = 0; @@ -516,10 +525,13 @@ int glist_isgraph(t_glist *x) moved or resized. */ static void canvas_setbounds(t_canvas *x, int x1, int y1, int x2, int y2) { + int heightwas = y2 - y1; + int heightchange = y2 - y1 - (x->gl_screeny2 - x->gl_screeny1); x->gl_screenx1 = x1; x->gl_screeny1 = y1; x->gl_screenx2 = x2; x->gl_screeny2 = y2; + /* post("set bounds %d %d %d %d", x1, y1, x2, y2); */ if (!glist_isgraph(x) && (x->gl_y2 < x->gl_y1)) { /* if it's flipped so that y grows upward, @@ -527,8 +539,14 @@ static void canvas_setbounds(t_canvas *x, int x1, int y1, int x2, int y2) only appropriate if we're a regular "text" object on the parent. */ float diff = x->gl_y1 - x->gl_y2; - x->gl_y1 = x->gl_screeny2 * diff; + t_gobj *y; + x->gl_y1 = heightwas * diff; x->gl_y2 = x->gl_y1 - diff; + /* and move text objects accordingly; they should stick + to the bottom, not the top. */ + for (y = x->gl_list; y; y = y->g_next) + if (pd_checkobject(&y->g_pd)) + gobj_displace(y, x, 0, heightchange); canvas_redraw(x); } } @@ -607,6 +625,9 @@ void canvas_map(t_canvas *x, t_floatarg f) canvas_selectme = 0; } canvas_drawlines(x); + /* simulate a mouse up so u_main will calculate scrollbars... + ugly! */ + sys_vgui("pdtk_canvas_mouseup .x%x.c 0 0 0\n", x); } } else @@ -700,15 +721,12 @@ void canvas_vis(t_canvas *x, t_floatarg f) else { canvas_create_editor(x, 1); - sys_vgui("pdtk_canvas_new .x%x %d %d +%d+%d\n", x, + sys_vgui("pdtk_canvas_new .x%x %d %d +%d+%d %d\n", x, (int)(x->gl_screenx2 - x->gl_screenx1), (int)(x->gl_screeny2 - x->gl_screeny1), - (int)(x->gl_screenx1), (int)(x->gl_screeny1) - ); + (int)(x->gl_screenx1), (int)(x->gl_screeny1), + x->gl_edit); canvas_reflecttitle(x); - /* simulate a mouse up so u_main will calculate scrollbars... - ugly! */ - sys_vgui("pdtk_canvas_mouseup .x%x.c 0 0 0\n", x); x->gl_havewindow = 1; canvas_updatewindowlist(); } @@ -799,6 +817,7 @@ void canvas_free(t_canvas *x) t_gobj *y; int dspstate = canvas_suspend_dsp(); + canvas_noundo(x); if (canvas_editing == x) canvas_editing = 0; if (canvas_whichfind == x) @@ -831,9 +850,11 @@ static void canvas_drawlines(t_canvas *x) { linetraverser_start(&t, x); while (oc = linetraverser_next(&t)) - sys_vgui(".x%x.c create line %d %d %d %d -tags l%x\n", + sys_vgui(".x%x.c create line %d %d %d %d -width %d -tags l%x\n", glist_getcanvas(x), - t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2, oc); + t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2, + (outlet_getsymbol(t.tr_outlet) == &s_signal ? 2:1), + oc); } } @@ -1376,7 +1397,12 @@ extern void canvas_toggle(t_glist *gl, t_symbol *s, int argc, t_atom *argv); extern void canvas_vslider(t_glist *gl, t_symbol *s, int argc, t_atom *argv); extern void canvas_hslider(t_glist *gl, t_symbol *s, int argc, t_atom *argv); extern void canvas_vdial(t_glist *gl, t_symbol *s, int argc, t_atom *argv); + /* old version... */ extern void canvas_hdial(t_glist *gl, t_symbol *s, int argc, t_atom *argv); +extern void canvas_hdial(t_glist *gl, t_symbol *s, int argc, t_atom *argv); + /* new version: */ +extern void canvas_hradio(t_glist *gl, t_symbol *s, int argc, t_atom *argv); +extern void canvas_vradio(t_glist *gl, t_symbol *s, int argc, t_atom *argv); extern void canvas_vumeter(t_glist *gl, t_symbol *s, int argc, t_atom *argv); extern void canvas_mycnv(t_glist *gl, t_symbol *s, int argc, t_atom *argv); extern void canvas_numbox(t_glist *gl, t_symbol *s, int argc, t_atom *argv); @@ -1434,6 +1460,10 @@ void g_canvas_setup(void) A_GIMME, A_NULL); class_addmethod(canvas_class, (t_method)canvas_vdial, gensym("vdial"), A_GIMME, A_NULL); + class_addmethod(canvas_class, (t_method)canvas_hradio, gensym("hradio"), + A_GIMME, A_NULL); + class_addmethod(canvas_class, (t_method)canvas_vradio, gensym("vradio"), + A_GIMME, A_NULL); class_addmethod(canvas_class, (t_method)canvas_vumeter, gensym("vumeter"), A_GIMME, A_NULL); class_addmethod(canvas_class, (t_method)canvas_mycnv, gensym("mycnv"), diff --git a/pd/src/g_canvas.h b/pd/src/g_canvas.h index fb567ea5..5348f25f 100644 --- a/pd/src/g_canvas.h +++ b/pd/src/g_canvas.h @@ -66,9 +66,6 @@ EXTERN_STRUCT _tscalar; EXTERN_STRUCT _canvasenvironment; #define t_canvasenvironment struct _canvasenvironment -EXTERN_STRUCT _linetraverser; -#define t_linetraverser struct _linetraverser - typedef struct _selection { t_gobj *sel_what; @@ -92,9 +89,15 @@ typedef struct _editor struct _glist *e_glist; /* glist which owns this */ int e_xwas; /* xpos on last mousedown or motion event */ int e_ywas; /* ypos, similarly */ + int e_selectline_index1; /* indices for the selected line if any */ + int e_selectline_outno; /* (only valid if e_selectedline is set) */ + int e_selectline_index2; + int e_selectline_inno; + t_outconnect *e_selectline_tag; unsigned int e_onmotion: 3; /* action to take on motion */ unsigned int e_lastmoved: 1; /* one if mouse has moved since click */ unsigned int e_textdirty: 1; /* one if e_textedfor has changed */ + unsigned int e_selectedline: 1; /* one if a line is selected */ } t_editor; #define MA_NONE 0 /* e_onmotion: do nothing on mouse motion */ @@ -166,7 +169,6 @@ struct _glist unsigned int gl_edit:1; /* edit mode */ unsigned int gl_imatemplate:1; /* someone needs me as template */ unsigned int gl_isdeleting:1; /* we're inside glist_delete -- hack! */ - unsigned int gl_protect:1; /* don't delete connections on click */ unsigned int gl_stretch:1; /* stretch contents on resize */ unsigned int gl_isgraph:1; /* show as graph on parent */ }; @@ -209,7 +211,7 @@ struct _array }; /* structure for traversing all the connections in a glist */ -struct _linetraverser +typedef struct _linetraverser { t_canvas *tr_x; t_object *tr_ob; @@ -225,7 +227,7 @@ struct _linetraverser int tr_lx1, tr_ly1, tr_lx2, tr_ly2; t_outconnect *tr_nextoc; int tr_nextoutno; -}; +} t_linetraverser; /* function types used to define graphical behavior for gobjs, a bit like X widgets. We don't use Pd methods because Pd's typechecking can't specify the @@ -388,6 +390,9 @@ EXTERN void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, char *tag, int x1, int y1, int x2, int y2); EXTERN void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag); EXTERN void canvas_create_editor(t_glist *x, int createit); +void canvas_deletelinesforio(t_canvas *x, t_text *text, + t_inlet *inp, t_outlet *outp); + /* -------------------- functions on texts ------------------------- */ EXTERN void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize); @@ -470,6 +475,16 @@ EXTERN int canvas_hitbox(t_canvas *x, t_gobj *y, int xpos, int ypos, int *x1p, int *y1p, int *x2p, int *y2p); EXTERN int canvas_setdeleting(t_canvas *x, int flag); +typedef void (*t_undofn)(t_canvas *canvas, void *buf, + int action); /* a function that does UNDO/REDO */ +#define UNDO_FREE 0 /* free current undo/redo buffer */ +#define UNDO_UNDO 1 /* undo */ +#define UNDO_REDO 2 /* redo */ +EXTERN void canvas_setundo(t_canvas *x, t_undofn undofn, void *buf, + const char *name); +EXTERN void canvas_noundo(t_canvas *x); +EXTERN int canvas_getindex(t_canvas *x, t_gobj *y); + /* ---- functions on canvasses as objects --------------------- */ EXTERN void canvas_fattenforscalars(t_canvas *x, diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index 4e6783ff..101c655a 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -11,10 +11,15 @@ void glist_readfrombinbuf(t_glist *x, t_binbuf *b, char *filename, int selectem); -/* ------------------ forward function declarations --------------- */ +/* ------------------ forward declarations --------------- */ static void canvas_doclear(t_canvas *x); static void glist_setlastxy(t_glist *gl, int xval, int yval); static void glist_donewloadbangs(t_glist *x); +static t_binbuf *canvas_docopy(t_canvas *x); +static void canvas_dopaste(t_canvas *x, t_binbuf *b); +static void canvas_paste(t_canvas *x); +static void canvas_clearline(t_canvas *x); +static t_binbuf *copy_binbuf; /* ---------------- generic widget behavior ------------------------- */ @@ -78,6 +83,33 @@ void gobj_properties(t_gobj *x, struct _glist *glist) /* ------------------------ managing the selection ----------------- */ +void glist_selectline(t_glist *x, t_outconnect *oc, int index1, + int outno, int index2, int inno) +{ + if (x->gl_editor) + { + glist_noselect(x); + x->gl_editor->e_selectedline = 1; + x->gl_editor->e_selectline_index1 = index1; + x->gl_editor->e_selectline_outno = outno; + x->gl_editor->e_selectline_index2 = index2; + x->gl_editor->e_selectline_inno = inno; + x->gl_editor->e_selectline_tag = oc; + sys_vgui(".x%x.c itemconfigure l%x -fill blue\n", + x, x->gl_editor->e_selectline_tag); + } +} + +void glist_deselectline(t_glist *x) +{ + if (x->gl_editor) + { + x->gl_editor->e_selectedline = 0; + sys_vgui(".x%x.c itemconfigure l%x -fill black\n", + x, x->gl_editor->e_selectline_tag); + } +} + int glist_isselected(t_glist *x, t_gobj *y) { if (x->gl_editor) @@ -95,6 +127,8 @@ void glist_select(t_glist *x, t_gobj *y) if (x->gl_editor) { t_selection *sel = (t_selection *)getbytes(sizeof(*sel)); + if (x->gl_editor->e_selectedline) + glist_deselectline(x); /* LATER #ifdef out the following check */ if (glist_isselected(x, y)) bug("glist_select"); sel->sel_next = x->gl_editor->e_selection; @@ -169,8 +203,13 @@ void glist_deselect(t_glist *x, t_gobj *y) void glist_noselect(t_glist *x) { - if (x->gl_editor) while (x->gl_editor->e_selection) - glist_deselect(x, x->gl_editor->e_selection->sel_what); + if (x->gl_editor) + { + while (x->gl_editor->e_selection) + glist_deselect(x, x->gl_editor->e_selection->sel_what); + if (x->gl_editor->e_selectedline) + glist_deselectline(x); + } } void glist_selectall(t_glist *x) @@ -198,6 +237,428 @@ void glist_selectall(t_glist *x) } } + /* get the index of a gobj in a glist. If y is zero, return the + total number of objects. */ +int glist_getindex(t_glist *x, t_gobj *y) +{ + t_gobj *y2; + int indx; + + for (y2 = x->gl_list, indx = 0; y2 && y2 != y; y2 = y2->g_next) + indx++; + return (indx); +} + + /* get the index of the object, among selected items, if "selected" + is set; otherwise, among unselected ones. If y is zero, just + counts the selected or unselected objects. */ +int glist_selectionindex(t_glist *x, t_gobj *y, int selected) +{ + t_gobj *y2; + int indx; + + for (y2 = x->gl_list, indx = 0; y2 && y2 != y; y2 = y2->g_next) + if (selected == glist_isselected(x, y2)) + indx++; + return (indx); +} + +static t_gobj *glist_nth(t_glist *x, int n) +{ + t_gobj *y; + int indx; + for (y = x->gl_list, indx = 0; y; y = y->g_next, indx++) + if (indx == n) + return (y); + return (0); +} + +/* ------------------- support for undo/redo -------------------------- */ + +static t_undofn canvas_undo_fn; /* current undo function if any */ +static int canvas_undo_whatnext; /* whether we can now UNDO or REDO */ +static void *canvas_undo_buf; /* data private to the undo function */ +static t_canvas *canvas_undo_canvas; /* which canvas we can undo on */ +static const char *canvas_undo_name; + +void canvas_setundo(t_canvas *x, t_undofn undofn, void *buf, + const char *name) +{ + int hadone = 0; + /* blow away the old undo information. In one special case the + old undo info is re-used; if so we shouldn't free it here. */ + if (canvas_undo_fn && canvas_undo_buf && (buf != canvas_undo_buf)) + { + (*canvas_undo_fn)(canvas_undo_canvas, canvas_undo_buf, UNDO_FREE); + hadone = 1; + } + canvas_undo_canvas = x; + canvas_undo_fn = undofn; + canvas_undo_buf = buf; + canvas_undo_whatnext = UNDO_UNDO; + canvas_undo_name = name; + if (x) + /* enable undo in menu */ + sys_vgui("pdtk_undomenu .x%x %s no\n", x, name); + else if (hadone) sys_vgui("pdtk_undomenu .x%x no no\n", x, name); +} + + /* clear undo if it happens to be for the canvas x. + (but if x is 0, clear it regardless of who owns it.) */ +void canvas_noundo(t_canvas *x) +{ + if (!x || (x == canvas_undo_canvas)) + canvas_setundo(0, 0, 0, "foo"); +} + +static void canvas_undo(t_canvas *x) +{ + if (x != canvas_undo_canvas) + bug("canvas_undo 1"); + else if (canvas_undo_whatnext != UNDO_UNDO) + bug("canvas_undo 2"); + else + { + /* post("undo"); */ + (*canvas_undo_fn)(canvas_undo_canvas, canvas_undo_buf, UNDO_UNDO); + /* enable redo in menu */ + sys_vgui("pdtk_undomenu .x%x no %s\n", x, canvas_undo_name); + canvas_undo_whatnext = UNDO_REDO; + } +} + +static void canvas_redo(t_canvas *x) +{ + if (x != canvas_undo_canvas) + bug("canvas_undo 1"); + else if (canvas_undo_whatnext != UNDO_REDO) + bug("canvas_undo 2"); + else + { + /* post("redo"); */ + (*canvas_undo_fn)(canvas_undo_canvas, canvas_undo_buf, UNDO_REDO); + /* enable undo in menu */ + sys_vgui("pdtk_undomenu .x%x %s no\n", x, canvas_undo_name); + canvas_undo_whatnext = UNDO_UNDO; + } +} + +/* ------- specific undo methods: 1. connect and disconnect -------- */ + +typedef struct _undo_connect +{ + int u_index1; + int u_outletno; + int u_index2; + int u_inletno; +} t_undo_connect; + +static void *canvas_undo_set_disconnect(t_canvas *x, + int index1, int outno, int index2, int inno) +{ + t_undo_connect *buf = (t_undo_connect *)getbytes(sizeof(*buf)); + buf->u_index1 = index1; + buf->u_outletno = outno; + buf->u_index2 = index2; + buf->u_inletno = inno; + return (buf); +} + +static void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno, + t_floatarg fwhoin, t_floatarg finno); + +static void canvas_disconnect(t_canvas *x, + int index1, int outno, int index2, int inno) +{ + t_linetraverser t; + t_outconnect *oc; + linetraverser_start(&t, x); + while (oc = linetraverser_next(&t)) + { + int srcno = canvas_getindex(x, &t.tr_ob->ob_g); + int sinkno = canvas_getindex(x, &t.tr_ob2->ob_g); + if (srcno == index1 && t.tr_outno == outno && + sinkno == index2 && t.tr_inno == inno) + { + sys_vgui(".x%x.c delete l%x\n", x, oc); + obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno); + break; + } + } +} + +static void canvas_undo_disconnect(t_canvas *x, void *z, int action) +{ + t_undo_connect *buf = z; + if (action == UNDO_UNDO) + { + canvas_connect(x, buf->u_index1, buf->u_outletno, + buf->u_index2, buf->u_inletno); + } + else if (action == UNDO_REDO) + { + canvas_disconnect(x, buf->u_index1, buf->u_outletno, + buf->u_index2, buf->u_inletno); + } + else if (action == UNDO_FREE) + t_freebytes(buf, sizeof(*buf)); +} + + /* connect just calls disconnect actions backward... */ +static void *canvas_undo_set_connect(t_canvas *x, + int index1, int outno, int index2, int inno) +{ + return (canvas_undo_set_disconnect(x, index1, outno, index2, inno)); +} + +static void canvas_undo_connect(t_canvas *x, void *z, int action) +{ + int myaction; + if (action == UNDO_UNDO) + myaction = UNDO_REDO; + else if (action == UNDO_REDO) + myaction = UNDO_UNDO; + else myaction = action; + canvas_undo_disconnect(x, z, myaction); +} + +/* ---------- ... 2. cut, clear, and typing into objects: -------- */ + +#define UCUT_CUT 1 /* operation was a cut */ +#define UCUT_CLEAR 2 /* .. a clear */ +#define UCUT_TEXT 3 /* text typed into a box */ + +typedef struct _undo_cut +{ + t_binbuf *u_objectbuf; /* the object cleared or typed into */ + t_binbuf *u_reconnectbuf; /* connections into and out of object */ + t_binbuf *u_redotextbuf; /* buffer to paste back for redo if TEXT */ + int u_mode; /* from flags above */ +} t_undo_cut; + +static void *canvas_undo_set_cut(t_canvas *x, int mode) +{ + t_undo_cut *buf; + t_gobj *y; + t_linetraverser t; + t_outconnect *oc; + int nnotsel= glist_selectionindex(x, 0, 0); + buf = (t_undo_cut *)getbytes(sizeof(*buf)); + buf->u_mode = mode; + buf->u_redotextbuf = 0; + + /* store connections into/out of the selection */ + buf->u_reconnectbuf = binbuf_new(); + linetraverser_start(&t, x); + while (oc = linetraverser_next(&t)) + { + int issel1 = glist_isselected(x, &t.tr_ob->ob_g); + int issel2 = glist_isselected(x, &t.tr_ob2->ob_g); + if (issel1 != issel2) + { + binbuf_addv(buf->u_reconnectbuf, "ssiiii;", + gensym("#X"), gensym("connect"), + (issel1 ? nnotsel : 0) + + glist_selectionindex(x, &t.tr_ob->ob_g, issel1), + t.tr_outno, + (issel2 ? nnotsel : 0) + + glist_selectionindex(x, &t.tr_ob2->ob_g, issel2), + t.tr_inno); + } + } + if (mode == UCUT_TEXT) + { + buf->u_objectbuf = canvas_docopy(x); + } + else if (mode == UCUT_CUT) + { + buf->u_objectbuf = 0; + } + else if (mode == UCUT_CLEAR) + { + buf->u_objectbuf = canvas_docopy(x); + } + return (buf); +} + +static void canvas_undo_cut(t_canvas *x, void *z, int action) +{ + t_undo_cut *buf = z; + int mode = buf->u_mode; + if (action == UNDO_UNDO) + { + if (mode == UCUT_CUT) + canvas_dopaste(x, copy_binbuf); + else if (mode == UCUT_CLEAR) + canvas_dopaste(x, buf->u_objectbuf); + else if (mode == UCUT_TEXT) + { + t_gobj *y1, *y2; + for (y1 = x->gl_list; y2 = y1->g_next; y1 = y2) + ; + if (y1) + { + if (!buf->u_redotextbuf) + { + glist_noselect(x); + glist_select(x, y1); + buf->u_redotextbuf = canvas_docopy(x); + glist_noselect(x); + } + glist_delete(x, y1); + } + canvas_dopaste(x, buf->u_objectbuf); + } + pd_bind(&x->gl_pd, gensym("#X")); + binbuf_eval(buf->u_reconnectbuf, 0, 0, 0); + pd_unbind(&x->gl_pd, gensym("#X")); + } + else if (action == UNDO_REDO) + { + if (mode == UCUT_CUT || mode == UCUT_CLEAR) + canvas_doclear(x); + else if (mode == UCUT_TEXT) + { + t_gobj *y1, *y2; + for (y1 = x->gl_list; y2 = y1->g_next; y1 = y2) + ; + if (y1) + glist_delete(x, y1); + canvas_dopaste(x, buf->u_redotextbuf); + pd_bind(&x->gl_pd, gensym("#X")); + binbuf_eval(buf->u_reconnectbuf, 0, 0, 0); + pd_unbind(&x->gl_pd, gensym("#X")); + } + } + else if (action == UNDO_FREE) + { + if (buf->u_objectbuf) + binbuf_free(buf->u_objectbuf); + if (buf->u_reconnectbuf) + binbuf_free(buf->u_reconnectbuf); + if (buf->u_redotextbuf) + binbuf_free(buf->u_redotextbuf); + t_freebytes(buf, sizeof(*buf)); + } +} + +/* --------- 3. motion, including "tidy up" and stretching ----------- */ + +typedef struct _undo_move_elem +{ + int e_index; + int e_xpix; + int e_ypix; +} t_undo_move_elem; + +typedef struct _undo_move +{ + t_undo_move_elem *u_vec; + int u_n; +} t_undo_move; + +static int canvas_undo_already_set_move; + +static void *canvas_undo_set_move(t_canvas *x, int selected) +{ + int x1, y1, x2, y2, i, indx; + t_gobj *y; + t_undo_move *buf = (t_undo_move *)getbytes(sizeof(*buf)); + buf->u_n = selected ? glist_selectionindex(x, 0, 1) : glist_getindex(x, 0); + buf->u_vec = (t_undo_move_elem *)getbytes(sizeof(*buf->u_vec) * + (selected ? glist_selectionindex(x, 0, 1) : glist_getindex(x, 0))); + if (selected) + { + for (y = x->gl_list, i = indx = 0; y; y = y->g_next, indx++) + if (glist_isselected(x, y)) + { + gobj_getrect(y, x, &x1, &y1, &x2, &y2); + buf->u_vec[i].e_index = indx; + buf->u_vec[i].e_xpix = x1; + buf->u_vec[i].e_ypix = y1; + i++; + } + } + else + { + for (y = x->gl_list, indx = 0; y; y = y->g_next, indx++) + { + gobj_getrect(y, x, &x1, &y1, &x2, &y2); + buf->u_vec[indx].e_index = indx; + buf->u_vec[indx].e_xpix = x1; + buf->u_vec[indx].e_ypix = y1; + } + } + canvas_undo_already_set_move = 1; + return (buf); +} + +static void canvas_undo_move(t_canvas *x, void *z, int action) +{ + t_undo_move *buf = z; + if (action == UNDO_UNDO || action == UNDO_REDO) + { + int i; + for (i = 0; i < buf->u_n; i++) + { + int x1, y1, x2, y2, newx, newy; + t_gobj *y; + newx = buf->u_vec[i].e_xpix; + newy = buf->u_vec[i].e_ypix; + y = glist_nth(x, buf->u_vec[i].e_index); + if (y) + { + gobj_getrect(y, x, &x1, &y1, &x2, &y2); + gobj_displace(y, x, newx-x1, newy - y1); + buf->u_vec[i].e_xpix = x1; + buf->u_vec[i].e_ypix = y1; + } + } + } + else if (action == UNDO_FREE) + { + t_freebytes(buf->u_vec, buf->u_n * sizeof(*buf->u_vec)); + t_freebytes(buf, sizeof(*buf)); + } +} + +/* --------- 4. paste (also duplicate) ----------- */ + +typedef struct _undo_paste +{ + int u_index; /* index of first object pasted */ +} t_undo_paste; + +static void *canvas_undo_set_paste(t_canvas *x) +{ + t_undo_paste *buf = (t_undo_paste *)getbytes(sizeof(*buf)); + buf->u_index = glist_getindex(x, 0); + return (buf); +} + +static void canvas_undo_paste(t_canvas *x, void *z, int action) +{ + t_undo_paste *buf = z; + if (action == UNDO_UNDO) + { + t_gobj *y; + glist_noselect(x); + for (y = glist_nth(x, buf->u_index); y; y = y->g_next) + glist_select(x, y); + canvas_doclear(x); + } + else if (action == UNDO_REDO) + { + t_selection *sel; + canvas_dopaste(x, copy_binbuf); + /* if it was "duplicate" have to re-enact the displacement. */ + if (canvas_undo_name && canvas_undo_name[0] == 'd') + for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next) + gobj_displace(sel->sel_what, x, 10, 10); + } +else if (action == UNDO_FREE) + t_freebytes(buf, sizeof(*buf)); +} /* ------------------------ event handling ------------------------ */ @@ -443,12 +904,21 @@ static int canvas_upx, canvas_upy; #define DCLICKINTERVAL 0.25 #endif + /* figure out of the outlet is a "signal" outlet. "nout" is the + index of the outlet, counting from zero. */ +int obj_sigoutletindex(t_object *x, int m); +static int canvas_issigoutlet(t_object *ob, int nout) +{ + int ret = obj_sigoutletindex(ob, nout); + return (obj_sigoutletindex(ob, nout) >= 0); +} + /* mouse click */ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, int mod, int doit) { t_gobj *y; - int shiftmod, runmode, altmod, rightclick, protectmod; + int shiftmod, runmode, altmod, rightclick; int x1, y1, x2, y2, clickreturned = 0; if (!x->gl_editor) @@ -461,7 +931,15 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, runmode = ((mod & CTRLMOD) || (!x->gl_edit)); altmod = (mod & ALTMOD); rightclick = (mod & RIGHTCLICK); - protectmod = x->gl_protect; + + canvas_undo_already_set_move = 0; + + /* if keyboard was grabbed, notify grabber and cancel the grab */ + if (doit && x->gl_editor->e_grab && x->gl_editor->e_keyfn) + { + (* x->gl_editor->e_keyfn) (x->gl_editor->e_grab, 0); + glist_grab(x, 0, 0, 0, 0, 0); + } #ifdef SIMULATERIGHTCLICK if (doit && !runmode && xpos == canvas_upx && ypos == canvas_upy && @@ -546,12 +1024,14 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, { if (doit) { + int issignal = canvas_issigoutlet(ob, closest); x->gl_editor->e_onmotion = MA_CONNECT; x->gl_editor->e_xwas = xpos; x->gl_editor->e_ywas = ypos; sys_vgui( - ".x%x.c create line %d %d %d %d -tags x\n", - x, xpos, ypos, xpos, ypos); + ".x%x.c create line %d %d %d %d -width %d -tags x\n", + x, xpos, ypos, xpos, ypos, + (issignal ? 2 : 1)); } else canvas_setcursor(x, CURSOR_EDITMODE_CONNECT); } @@ -600,12 +1080,13 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, return; } /* having failed to find a box, we try lines now. */ - if (!runmode && !altmod && !shiftmod && !protectmod) + if (!runmode && !altmod && !shiftmod) { t_linetraverser t; t_outconnect *oc; float fx = xpos, fy = ypos; - linetraverser_start(&t, glist_getcanvas(x)); + t_glist *glist2 = glist_getcanvas(x); + linetraverser_start(&t, glist2); while (oc = linetraverser_next(&t)) { float lx1 = t.tr_lx1, ly1 = t.tr_ly1, @@ -618,11 +1099,11 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, if ((lx2-lx1) * (lx2-fx) + (ly2-ly1) * (ly2-fy) < 0) continue; if (doit) { - sys_vgui(".x%x.c delete l%x\n", - glist_getcanvas(x), oc); - obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno); + glist_selectline(glist2, oc, + canvas_getindex(glist2, &t.tr_ob->ob_g), t.tr_outno, + canvas_getindex(glist2, &t.tr_ob2->ob_g), t.tr_inno); } - else canvas_setcursor(x, CURSOR_EDITMODE_DISCONNECT); + canvas_setcursor(x, CURSOR_EDITMODE_DISCONNECT); return; } } @@ -720,10 +1201,16 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit) ((x22-x21-IOWIDTH) * closest2)/(ninlet2-1) : 0) + IOMIDDLE; ly2 = y21; - sys_vgui(".x%x.c create line %d %d %d %d -tags l%x\n", + sys_vgui(".x%x.c create line %d %d %d %d -width %d -tags l%x\n", glist_getcanvas(x), - lx1, ly1, lx2, ly2, oc); - } + lx1, ly1, lx2, ly2, + (canvas_issigoutlet(ob1, closest1) ? 2 : 1), oc); + canvas_setundo(x, canvas_undo_connect, + canvas_undo_set_connect(x, + canvas_getindex(x, &ob1->ob_g), closest1, + canvas_getindex(x, &ob2->ob_g), closest2), + "connect"); + } else canvas_setcursor(x, CURSOR_EDITMODE_CONNECT); return; } @@ -792,6 +1279,29 @@ void canvas_mouseup(t_canvas *x, x->gl_editor->e_onmotion = MA_NONE; } + /* displace the selection by (dx, dy) pixels */ +static void canvas_displaceselection(t_canvas *x, int dx, int dy) +{ + t_selection *y; + int resortin = 0, resortout = 0; + if (!canvas_undo_already_set_move) + { + canvas_setundo(x, canvas_undo_move, canvas_undo_set_move(x, 1), + "motion"); + canvas_undo_already_set_move = 1; + } + for (y = x->gl_editor->e_selection; y; y = y->sel_next) + { + t_class *cl = pd_class(&y->sel_what->g_pd); + gobj_displace(y->sel_what, x, dx, dy); + if (cl == vinlet_class) resortin = 1; + else if (cl == voutlet_class) resortout = 1; + } + if (resortin) canvas_resortinlets(x); + if (resortout) canvas_resortoutlets(x); + canvas_dirty(x, 1); +} + /* this routine is called whenever a key is pressed or released. "x" may be zero if there's no current canvas. The first argument is true or fals for down/up; the second one is either a symbolic key name (e.g., @@ -800,8 +1310,30 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) { static t_symbol *keynumsym, *keyupsym, *keynamesym; float keynum, fflag; - if (ac < 2) + t_symbol *gotkeysym; + + int down, shift; + + if (ac < 3) + return; + if (!x->gl_editor) + { + bug("editor"); return; + } + canvas_undo_already_set_move = 0; + + down = (atom_getfloat(av) != 0); /* nonzero if it's a key down */ + shift = (atom_getfloat(av+2) != 0); /* nonzero if shift-ed */ + if (av[1].a_type == A_SYMBOL) + gotkeysym = av[1].a_w.w_symbol; + else if (av[1].a_type == A_FLOAT) + { + char buf[3]; + sprintf(buf, "%c", (int)(av[1].a_w.w_float)); + gotkeysym = gensym(buf); + } + else gotkeysym = gensym("?"); fflag = (av[0].a_type == A_FLOAT ? av[0].a_w.w_float : 0); keynum = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float : 0); if (keynum == '\\' || keynum == '{' || keynum == '}') @@ -820,48 +1352,60 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) keyupsym = gensym("#keyup"); keynamesym = gensym("#keyname"); } - if (keynumsym->s_thing && (fflag != 0)) + if (keynumsym->s_thing && down) pd_float(keynumsym->s_thing, keynum); - if (keyupsym->s_thing && (fflag == 0)) + if (keyupsym->s_thing && down) pd_float(keyupsym->s_thing, keynum); if (keynamesym->s_thing) { t_atom at[2]; at[0] = av[0]; - if (av[1].a_type == A_SYMBOL) - at[1] = av[1]; - else - { - char buf[3]; - sprintf(buf, "%c", (int)(av[1].a_w.w_float)); - SETSYMBOL(at+1, gensym(buf)); - } + SETFLOAT(at, down); + SETSYMBOL(at+1, gotkeysym); pd_list(keynamesym->s_thing, 0, 2, at); } - if (x && (fflag != 0)) + if (x && down) { - if (!x->gl_editor) - { - bug("editor"); - return; - } /* if an object has "grabbed" keys just send them on */ - if (x->gl_editor->e_grab && (keynum != 0) - && x->gl_editor->e_keyfn) + if (x->gl_editor->e_grab + && x->gl_editor->e_keyfn && keynum) (* x->gl_editor->e_keyfn) (x->gl_editor->e_grab, keynum); /* if a text editor is open send it on */ else if (x->gl_editor->e_textedfor) { + if (!x->gl_editor->e_textdirty) + { + canvas_setundo(x, canvas_undo_cut, + canvas_undo_set_cut(x, UCUT_TEXT), "typing"); + } rtext_key(x->gl_editor->e_textedfor, (int)keynum, (av[1].a_type == A_SYMBOL ? av[1].a_w.w_symbol : &s_)); if (x->gl_editor->e_textdirty) canvas_dirty(x, 1); } - /* otherwise check for backspace or clear and do so */ + /* check for backspace or clear */ else if (keynum == 8 || keynum == 127) - canvas_doclear(x); + { + if (x->gl_editor->e_selectedline) + canvas_clearline(x); + else if (x->gl_editor->e_selection) + { + canvas_setundo(x, canvas_undo_cut, + canvas_undo_set_cut(x, UCUT_CLEAR), "clear"); + canvas_doclear(x); + } + } + /* check for arrow keys */ + else if (!strcmp(gotkeysym->s_name, "Up")) + canvas_displaceselection(x, 0, shift ? -10 : -1); + else if (!strcmp(gotkeysym->s_name, "Down")) + canvas_displaceselection(x, 0, shift ? 10 : 1); + else if (!strcmp(gotkeysym->s_name, "Left")) + canvas_displaceselection(x, shift ? -10 : -1, 0); + else if (!strcmp(gotkeysym->s_name, "Right")) + canvas_displaceselection(x, shift ? 10 : 1, 0); } } @@ -878,22 +1422,10 @@ void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos, glist_setlastxy(x, xpos, ypos); if (x->gl_editor->e_onmotion == MA_MOVE) { - t_selection *y; - int resortin = 0, resortout = 0; - for (y = x->gl_editor->e_selection; y; y = y->sel_next) - { - t_class *cl = pd_class(&y->sel_what->g_pd); - gobj_displace(y->sel_what, x, - xpos - x->gl_editor->e_xwas, - ypos - x->gl_editor->e_ywas); - if (cl == vinlet_class) resortin = 1; - else if (cl == voutlet_class) resortout = 1; - } + canvas_displaceselection(x, + xpos - x->gl_editor->e_xwas, ypos - x->gl_editor->e_ywas); x->gl_editor->e_xwas = xpos; - x->gl_editor->e_ywas = ypos; - if (resortin) canvas_resortinlets(x); - if (resortout) canvas_resortoutlets(x); - canvas_dirty(x, 1); + x->gl_editor->e_ywas = ypos; } else if (x->gl_editor->e_onmotion == MA_REGION) canvas_doregion(x, xpos, ypos, 0); @@ -901,6 +1433,8 @@ void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos, canvas_doconnect(x, xpos, ypos, 0, 0); else if (x->gl_editor->e_onmotion == MA_PASSOUT) { + if (!x->gl_editor->e_motionfn) + bug("e_motionfn"); (*x->gl_editor->e_motionfn)(&x->gl_editor->e_grab->g_pd, xpos - x->gl_editor->e_xwas, ypos - x->gl_editor->e_ywas); @@ -1031,9 +1565,19 @@ static int canvas_dofind(t_canvas *x, int *myindex1p) glist_noselect(x); if (glist_isvisible(x)) { +#ifdef NT + /* For windows canvas_vis() does something + special so here we explicitly invis + the window and proceed as in the "invis" + case below. */ + canvas_vis(x, 0); + canvas_selectme = y; + canvas_vis(x, 1); +#else canvas_vis(x, 1); canvas_editmode(x, 1.); glist_select(x, y); +#endif } else { @@ -1194,19 +1738,13 @@ void canvas_stowconnections(t_canvas *x) linetraverser_start(&t, x); while (oc = linetraverser_next(&t)) { - int srcno = 0, sinkno = 0; int s1 = glist_isselected(x, &t.tr_ob->ob_g); int s2 = glist_isselected(x, &t.tr_ob2->ob_g); if (s1 != s2) - { - for (y = x->gl_list; y && y != &t.tr_ob->ob_g; y = y->g_next) - srcno++; - for (y = x->gl_list; y && y != &t.tr_ob2->ob_g; y = y->g_next) - sinkno++; binbuf_addv(x->gl_editor->e_connectbuf, "ssiiii;", gensym("#X"), gensym("connect"), - srcno, t.tr_outno, sinkno, t.tr_inno); - } + glist_getindex(x, &t.tr_ob->ob_g), t.tr_outno, + glist_getindex(x, &t.tr_ob2->ob_g), t.tr_inno); } } @@ -1217,37 +1755,55 @@ void canvas_restoreconnections(t_canvas *x) pd_unbind(&x->gl_pd, gensym("#X")); } - -static t_binbuf *copy_binbuf; - -static void canvas_copy(t_canvas *x) +static t_binbuf *canvas_docopy(t_canvas *x) { t_gobj *y; t_linetraverser t; t_outconnect *oc; - if (!x->gl_editor || !x->gl_editor->e_selection) - return; - binbuf_clear(copy_binbuf); + t_binbuf *b = binbuf_new(); for (y = x->gl_list; y; y = y->g_next) { if (glist_isselected(x, y)) - gobj_save(y, copy_binbuf); + gobj_save(y, b); } linetraverser_start(&t, x); while (oc = linetraverser_next(&t)) { - int srcno = 0, sinkno = 0; if (glist_isselected(x, &t.tr_ob->ob_g) && glist_isselected(x, &t.tr_ob2->ob_g)) { - for (y = x->gl_list; y && y != &t.tr_ob->ob_g; y = y->g_next) - if (glist_isselected(x, y)) srcno++; - for (y = x->gl_list; y && y != &t.tr_ob2->ob_g; y = y->g_next) - if (glist_isselected(x, y)) sinkno++; - binbuf_addv(copy_binbuf, "ssiiii;", gensym("#X"), - gensym("connect"), srcno, t.tr_outno, sinkno, t.tr_inno); + binbuf_addv(b, "ssiiii;", gensym("#X"), gensym("connect"), + glist_selectionindex(x, &t.tr_ob->ob_g, 1), t.tr_outno, + glist_selectionindex(x, &t.tr_ob2->ob_g, 1), t.tr_inno); } } + return (b); +} + +static void canvas_copy(t_canvas *x) +{ + if (!x->gl_editor || !x->gl_editor->e_selection) + return; + binbuf_free(copy_binbuf); + copy_binbuf = canvas_docopy(x); +} + +static void canvas_clearline(t_canvas *x) +{ + if (x->gl_editor->e_selectedline) + { + canvas_disconnect(x, x->gl_editor->e_selectline_index1, + x->gl_editor->e_selectline_outno, + x->gl_editor->e_selectline_index2, + x->gl_editor->e_selectline_inno); + canvas_setundo(x, canvas_undo_disconnect, + canvas_undo_set_disconnect(x, + x->gl_editor->e_selectline_index1, + x->gl_editor->e_selectline_outno, + x->gl_editor->e_selectline_index2, + x->gl_editor->e_selectline_inno), + "disconnect"); + } } extern t_pd *newest; @@ -1257,6 +1813,20 @@ static void canvas_doclear(t_canvas *x) int dspstate; dspstate = canvas_suspend_dsp(); + if (x->gl_editor->e_selectedline) + { + canvas_disconnect(x, x->gl_editor->e_selectline_index1, + x->gl_editor->e_selectline_outno, + x->gl_editor->e_selectline_index2, + x->gl_editor->e_selectline_inno); + canvas_setundo(x, canvas_undo_disconnect, + canvas_undo_set_disconnect(x, + x->gl_editor->e_selectline_index1, + x->gl_editor->e_selectline_outno, + x->gl_editor->e_selectline_index2, + x->gl_editor->e_selectline_inno), + "disconnect"); + } /* if text is selected, deselecting it might remake the object. So we deselect it and hunt for a "new" object on the glist to reselect. */ @@ -1295,8 +1865,15 @@ restore: static void canvas_cut(t_canvas *x) { - canvas_copy(x); - canvas_doclear(x); + if (x->gl_editor && x->gl_editor->e_selectedline) + canvas_clearline(x); + else if (x->gl_editor && x->gl_editor->e_selection) + { + canvas_setundo(x, canvas_undo_cut, + canvas_undo_set_cut(x, UCUT_CUT), "cut"); + canvas_copy(x); + canvas_doclear(x); + } } static int paste_onset; @@ -1313,7 +1890,7 @@ static void glist_donewloadbangs(t_glist *x) } } -static void canvas_paste(t_canvas *x) +static void canvas_dopaste(t_canvas *x, t_binbuf *b) { t_gobj *newgobj, *last, *g2; int dspstate = canvas_suspend_dsp(), nbox, count; @@ -1326,7 +1903,7 @@ static void canvas_paste(t_canvas *x) paste_canvas = x; pd_bind(&x->gl_pd, gensym("#X")); - binbuf_eval(copy_binbuf, 0, 0, 0); + binbuf_eval(b, 0, 0, 0); pd_unbind(&x->gl_pd, gensym("#X")); for (g2 = x->gl_list, count = 0; g2; g2 = g2->g_next, count++) if (count >= nbox) @@ -1337,13 +1914,21 @@ static void canvas_paste(t_canvas *x) glist_donewloadbangs(x); } +static void canvas_paste(t_canvas *x) +{ + canvas_setundo(x, canvas_undo_paste, canvas_undo_set_paste(x), "paste"); + canvas_dopaste(x, copy_binbuf); +} + static void canvas_duplicate(t_canvas *x) { if (x->gl_editor->e_onmotion == MA_NONE) { t_selection *y; canvas_copy(x); - canvas_paste(x); + canvas_setundo(x, canvas_undo_paste, canvas_undo_set_paste(x), + "duplicate"); + canvas_dopaste(x, copy_binbuf); for (y = x->gl_editor->e_selection; y; y = y->sel_next) gobj_displace(y->sel_what, x, 10, 10); @@ -1405,12 +1990,21 @@ static void canvas_tidy(t_canvas *x) t_gobj *y, *y2, *y3; int ax1, ay1, ax2, ay2, bx1, by1, bx2, by2; int histogram[NHIST], *ip, i, besthist, bestdist; + /* if nobody is selected, this means do it to all boxes; + othewise just the selection */ + int all = (x->gl_editor ? (x->gl_editor->e_selection == 0) : 1); + + canvas_setundo(x, canvas_undo_move, canvas_undo_set_move(x, !all), + "motion"); + /* tidy horizontally */ for (y = x->gl_list; y; y = y->g_next) + if (all || glist_isselected(x, y)) { gobj_getrect(y, x, &ax1, &ay1, &ax2, &ay2); for (y2 = x->gl_list; y2; y2 = y2->g_next) + if (all || glist_isselected(x, y2)) { gobj_getrect(y2, x, &bx1, &by1, &bx2, &by2); if (by1 <= ay1 + YTOLERANCE && by1 >= ay1 - YTOLERANCE && @@ -1419,6 +2013,7 @@ static void canvas_tidy(t_canvas *x) } for (y2 = x->gl_list; y2; y2 = y2->g_next) + if (all || glist_isselected(x, y2)) { gobj_getrect(y2, x, &bx1, &by1, &bx2, &by2); if (by1 <= ay1 + YTOLERANCE && by1 >= ay1 - YTOLERANCE @@ -1430,9 +2025,11 @@ static void canvas_tidy(t_canvas *x) /* tidy vertically. First guess the user's favorite vertical spacing */ for (i = NHIST, ip = histogram; i--; ip++) *ip = 0; for (y = x->gl_list; y; y = y->g_next) + if (all || glist_isselected(x, y)) { gobj_getrect(y, x, &ax1, &ay1, &ax2, &ay2); for (y2 = x->gl_list; y2; y2 = y2->g_next) + if (all || glist_isselected(x, y2)) { gobj_getrect(y2, x, &bx1, &by1, &bx2, &by2); if (bx1 <= ax1 + XTOLERANCE && bx1 >= ax1 - XTOLERANCE) @@ -1455,10 +2052,12 @@ static void canvas_tidy(t_canvas *x) } post("best vertical distance %d", bestdist); for (y = x->gl_list; y; y = y->g_next) + if (all || glist_isselected(x, y)) { int keep = 1; gobj_getrect(y, x, &ax1, &ay1, &ax2, &ay2); for (y2 = x->gl_list; y2; y2 = y2->g_next) + if (all || glist_isselected(x, y2)) { gobj_getrect(y2, x, &bx1, &by1, &bx2, &by2); if (bx1 <= ax1 + XTOLERANCE && bx1 >= ax1 - XTOLERANCE && @@ -1469,6 +2068,7 @@ static void canvas_tidy(t_canvas *x) { keep = 0; for (y2 = x->gl_list; y2; y2 = y2->g_next) + if (all || glist_isselected(x, y2)) { gobj_getrect(y2, x, &bx1, &by1, &bx2, &by2); if (bx1 <= ax1 + XTOLERANCE && bx1 >= ax1 - XTOLERANCE && @@ -1524,17 +2124,6 @@ void canvas_editmode(t_canvas *x, t_floatarg fyesplease) if (yesplease) canvas_dirty(x, 1); } -static void canvas_protectmode(t_canvas *x, t_floatarg fyesplease) -{ - int yesplease = fyesplease; - - if (yesplease && x->gl_protect) - return; - x->gl_protect = !x->gl_protect; - sys_vgui("pdtk_canvas_protectval .x%x %d\n", - glist_getcanvas(x), x->gl_protect); -} - /* called by canvas_font below */ static void canvas_dofont(t_canvas *x, t_floatarg font, t_floatarg xresize, t_floatarg yresize) @@ -1543,6 +2132,8 @@ static void canvas_dofont(t_canvas *x, t_floatarg font, t_floatarg xresize, x->gl_font = font; if (xresize != 1 || yresize != 1) { + canvas_setundo(x, canvas_undo_move, canvas_undo_set_move(x, 0), + "motion"); for (y = x->gl_list; y; y = y->g_next) { int x1, x2, y1, y2, nx1, ny1; @@ -1622,14 +2213,16 @@ void g_editor_setup(void) gensym("duplicate"), A_NULL); class_addmethod(canvas_class, (t_method)canvas_selectall, gensym("selectall"), A_NULL); + class_addmethod(canvas_class, (t_method)canvas_undo, + gensym("undo"), A_NULL); + class_addmethod(canvas_class, (t_method)canvas_redo, + gensym("redo"), A_NULL); class_addmethod(canvas_class, (t_method)canvas_tidy, gensym("tidy"), A_NULL); class_addmethod(canvas_class, (t_method)canvas_texteditor, gensym("texteditor"), A_NULL); class_addmethod(canvas_class, (t_method)canvas_editmode, gensym("editmode"), A_DEFFLOAT, A_NULL); - class_addmethod(canvas_class, (t_method)canvas_protectmode, - gensym("protectmode"), A_DEFFLOAT, A_NULL); class_addmethod(canvas_class, (t_method)canvas_print, gensym("print"), A_SYMBOL, A_NULL); class_addmethod(canvas_class, (t_method)canvas_menufont, diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c index 65a5d056..b893d42d 100644 --- a/pd/src/g_graph.c +++ b/pd/src/g_graph.c @@ -129,7 +129,9 @@ void glist_grab(t_glist *x, t_gobj *y, t_glistmotionfn motionfn, t_glistkeyfn keyfn, int xpos, int ypos) { t_glist *x2 = glist_getcanvas(x); - x2->gl_editor->e_onmotion = MA_PASSOUT; + if (motionfn) + x2->gl_editor->e_onmotion = MA_PASSOUT; + else x2->gl_editor->e_onmotion = 0; x2->gl_editor->e_grab = y; x2->gl_editor->e_motionfn = motionfn; x2->gl_editor->e_keyfn = keyfn; @@ -263,9 +265,6 @@ t_inlet *canvas_addinlet(t_canvas *x, t_pd *who, t_symbol *s) return (ip); } -void canvas_deletelinesforio(t_canvas *x, t_text *text, - t_inlet *inp, t_outlet *outp); - void canvas_rminlet(t_canvas *x, t_inlet *ip) { t_canvas *owner = x->gl_owner; diff --git a/pd/src/g_hdial.c b/pd/src/g_hdial.c index 6e9f08a7..caca3a22 100644 --- a/pd/src/g_hdial.c +++ b/pd/src/g_hdial.c @@ -5,6 +5,8 @@ /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ +/* name change to hradio by MSP and changed to +put out a "float" as in sliders, toggles, etc. */ #include <stdlib.h> #include <string.h> @@ -24,12 +26,12 @@ /* ------------- hdl gui-horicontal dial ---------------------- */ -t_widgetbehavior hdial_widgetbehavior; -static t_class *hdial_class; +t_widgetbehavior hradio_widgetbehavior; +static t_class *hradio_class, *hradio_old_class; /* widget helper functions */ -void hdial_draw_update(t_hdial *x, t_glist *glist) +void hradio_draw_update(t_hradio *x, t_glist *glist) { if(glist_isvisible(glist)) { @@ -44,7 +46,7 @@ void hdial_draw_update(t_hdial *x, t_glist *glist) } } -void hdial_draw_new(t_hdial *x, t_glist *glist) +void hradio_draw_new(t_hradio *x, t_glist *glist) { t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i, dx=x->x_gui.x_w, s4=dx/4; @@ -82,7 +84,7 @@ void hdial_draw_new(t_hdial *x, t_glist *glist) } -void hdial_draw_move(t_hdial *x, t_glist *glist) +void hradio_draw_move(t_hradio *x, t_glist *glist) { t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i, dx=x->x_gui.x_w, s4=dx/4; @@ -114,7 +116,7 @@ void hdial_draw_move(t_hdial *x, t_glist *glist) canvas, x, 0, xx11b, yy11, xx11b + IOWIDTH, yy11+1); } -void hdial_draw_erase(t_hdial* x, t_glist* glist) +void hradio_draw_erase(t_hradio* x, t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i; @@ -131,7 +133,7 @@ void hdial_draw_erase(t_hdial* x, t_glist* glist) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); } -void hdial_draw_config(t_hdial* x, t_glist* glist) +void hradio_draw_config(t_hradio* x, t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i; @@ -150,7 +152,7 @@ void hdial_draw_config(t_hdial* x, t_glist* glist) } } -void hdial_draw_io(t_hdial* x, t_glist* glist, int old_snd_rcv_flags) +void hradio_draw_io(t_hradio* x, t_glist* glist, int old_snd_rcv_flags) { t_canvas *canvas=glist_getcanvas(glist); int xpos=text_xpix(&x->x_gui.x_obj, glist); @@ -173,14 +175,13 @@ void hdial_draw_io(t_hdial* x, t_glist* glist, int old_snd_rcv_flags) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); } -void hdial_draw_select(t_hdial* x, t_glist* glist) +void hradio_draw_select(t_hradio* x, t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i; if(x->x_gui.x_fsf.x_selected) { - pd_bind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); for(i=0; i<n; i++) { sys_vgui(".x%x.c itemconfigure %xBASE%d -outline #%6.6x\n", canvas, x, i, @@ -190,7 +191,6 @@ void hdial_draw_select(t_hdial* x, t_glist* glist) } else { - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); for(i=0; i<n; i++) { sys_vgui(".x%x.c itemconfigure %xBASE%d -outline #%6.6x\n", canvas, x, i, @@ -201,29 +201,29 @@ void hdial_draw_select(t_hdial* x, t_glist* glist) } } -void hdial_draw(t_hdial *x, t_glist *glist, int mode) +void hradio_draw(t_hradio *x, t_glist *glist, int mode) { if(mode == IEM_GUI_DRAW_MODE_UPDATE) - hdial_draw_update(x, glist); + hradio_draw_update(x, glist); else if(mode == IEM_GUI_DRAW_MODE_MOVE) - hdial_draw_move(x, glist); + hradio_draw_move(x, glist); else if(mode == IEM_GUI_DRAW_MODE_NEW) - hdial_draw_new(x, glist); + hradio_draw_new(x, glist); else if(mode == IEM_GUI_DRAW_MODE_SELECT) - hdial_draw_select(x, glist); + hradio_draw_select(x, glist); else if(mode == IEM_GUI_DRAW_MODE_ERASE) - hdial_draw_erase(x, glist); + hradio_draw_erase(x, glist); else if(mode == IEM_GUI_DRAW_MODE_CONFIG) - hdial_draw_config(x, glist); + hradio_draw_config(x, glist); else if(mode >= IEM_GUI_DRAW_MODE_IO) - hdial_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO); + hradio_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO); } /* ------------------------ hdl widgetbehaviour----------------------------- */ -static void hdial_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) +static void hradio_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) { - t_hdial *x = (t_hdial *)z; + t_hradio *x = (t_hradio *)z; *xp1 = text_xpix(&x->x_gui.x_obj, glist); *yp1 = text_ypix(&x->x_gui.x_obj, glist); @@ -231,9 +231,9 @@ static void hdial_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp *yp2 = *yp1 + x->x_gui.x_h; } -static void hdial_save(t_gobj *z, t_binbuf *b) +static void hradio_save(t_gobj *z, t_binbuf *b) { - t_hdial *x = (t_hdial *)z; + t_hradio *x = (t_hradio *)z; int bflcol[3], *ip1, *ip2; t_symbol *srl[3]; @@ -241,8 +241,11 @@ static void hdial_save(t_gobj *z, t_binbuf *b) ip1 = (int *)(&x->x_gui.x_isa); ip2 = (int *)(&x->x_gui.x_fsf); binbuf_addv(b, "ssiisiiiisssiiiiiiii", gensym("#X"),gensym("obj"), - (t_int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist), (t_int)text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist), - gensym("hdl"), x->x_gui.x_w, + (t_int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist), + (t_int)text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist), + (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class ? + gensym("vdl") : gensym("vradio")), + x->x_gui.x_w, x->x_change, (*ip1)&IEM_INIT_ARGS_ALL, x->x_number, srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, @@ -251,14 +254,14 @@ static void hdial_save(t_gobj *z, t_binbuf *b) binbuf_addv(b, ";"); } -static void hdial_properties(t_gobj *z, t_glist *owner) +static void hradio_properties(t_gobj *z, t_glist *owner) { - t_hdial *x = (t_hdial *)z; + t_hradio *x = (t_hradio *)z; char buf[800]; t_symbol *srl[3]; iemgui_properties(&x->x_gui, srl); - sprintf(buf, "pdtk_iemgui_dialog %%s HDIAL \ + sprintf(buf, "pdtk_iemgui_dialog %%s hradio \ ----------dimensions(pix):----------- %d %d size: 0 0 empty \ empty 0.0 empty 0.0 empty %d \ %d new-only new&old %d %d number: %d \ @@ -276,7 +279,7 @@ static void hdial_properties(t_gobj *z, t_glist *owner) gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); } -static void hdial_dialog(t_hdial *x, t_symbol *s, int argc, t_atom *argv) +static void hradio_dialog(t_hradio *x, t_symbol *s, int argc, t_atom *argv) { t_symbol *srl[3]; int a = (int)atom_getintarg(0, argc, argv); @@ -310,7 +313,7 @@ static void hdial_dialog(t_hdial *x, t_symbol *s, int argc, t_atom *argv) } -static void hdial_set(t_hdial *x, t_floatarg f) +static void hradio_set(t_hradio *x, t_floatarg f) { int i=(int)f; int old=x->x_on_old; @@ -334,25 +337,30 @@ static void hdial_set(t_hdial *x, t_floatarg f) } } -static void hdial_bang(t_hdial *x) +static void hradio_bang(t_hradio *x) { - if((x->x_change)&&(x->x_on != x->x_on_old)) + /* compatibility with earlier "hdial" behavior */ + if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class) { - SETFLOAT(x->x_at, (float)x->x_on_old); - SETFLOAT(x->x_at+1, 0.0); + if((x->x_change)&&(x->x_on != x->x_on_old)) + { + SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at+1, 0.0); + outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); + if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) + pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); + } + x->x_on_old = x->x_on; + SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } - x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (float)x->x_on); - SETFLOAT(x->x_at+1, 1.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); + else outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); } -static void hdial_fout(t_hdial *x, t_floatarg f) +static void hradio_fout(t_hradio *x, t_floatarg f) { int i=(int)f; @@ -361,27 +369,36 @@ static void hdial_fout(t_hdial *x, t_floatarg f) if(i >= x->x_number) i = x->x_number-1; - if((x->x_change)&&(i != x->x_on_old)) + if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class) { - SETFLOAT(x->x_at, (float)x->x_on_old); - SETFLOAT(x->x_at+1, 0.0); + if((x->x_change)&&(i != x->x_on_old)) + { + SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at+1, 0.0); + outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); + if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) + pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); + } + if(x->x_on != x->x_on_old) + x->x_on_old = x->x_on; + x->x_on = i; + (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); + x->x_on_old = x->x_on; + SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } - if(x->x_on != x->x_on_old) + else + { + outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on = i); + (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); x->x_on_old = x->x_on; - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (float)x->x_on); - SETFLOAT(x->x_at+1, 1.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); + } } -static void hdial_float(t_hdial *x, t_floatarg f) +static void hradio_float(t_hradio *x, t_floatarg f) { int i=(int)f; @@ -390,53 +407,69 @@ static void hdial_float(t_hdial *x, t_floatarg f) if(i >= x->x_number) i = x->x_number-1; - if((x->x_change)&&(i != x->x_on_old)) + if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class) { + /* compatibility with earlier "vdial" behavior */ + if((x->x_change)&&(i != x->x_on_old)) + { + if(x->x_gui.x_fsf.x_put_in2out) + { + SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at+1, 0.0); + outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); + if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) + pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); + } + } + if(x->x_on != x->x_on_old) + x->x_on_old = x->x_on; + x->x_on = i; + (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); + x->x_on_old = x->x_on; if(x->x_gui.x_fsf.x_put_in2out) { - SETFLOAT(x->x_at, (float)x->x_on_old); - SETFLOAT(x->x_at+1, 0.0); + SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } } - if(x->x_on != x->x_on_old) - x->x_on_old = x->x_on; - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - x->x_on_old = x->x_on; - if(x->x_gui.x_fsf.x_put_in2out) + else { - SETFLOAT(x->x_at, (float)x->x_on); - SETFLOAT(x->x_at+1, 1.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); + x->x_on = i; + if (x->x_gui.x_fsf.x_put_in2out) + { + outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); + if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) + pd_float(x->x_gui.x_snd->s_thing, x->x_on); + } + (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); + x->x_on_old = x->x_on; } } -static void hdial_click(t_hdial *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +static void hradio_click(t_hradio *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { int xx = (int)xpos - (int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist); - hdial_fout(x, (float)(xx / x->x_gui.x_w)); + hradio_fout(x, (float)(xx / x->x_gui.x_w)); } -static int hdial_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) +static int hradio_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { if(doit) - hdial_click((t_hdial *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); + hradio_click((t_hradio *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); return (1); } -static void hdial_loadbang(t_hdial *x) +static void hradio_loadbang(t_hradio *x) { if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) - hdial_bang(x); + hradio_bang(x); } -static void hdial_number(t_hdial *x, t_floatarg num) +static void hradio_number(t_hradio *x, t_floatarg num) { int n=(int)num; @@ -455,67 +488,51 @@ static void hdial_number(t_hdial *x, t_floatarg num) } } -static void hdial_size(t_hdial *x, t_symbol *s, int ac, t_atom *av) +static void hradio_size(t_hradio *x, t_symbol *s, int ac, t_atom *av) { x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); x->x_gui.x_h = x->x_gui.x_w; iemgui_size((void *)x, &x->x_gui); } -static void hdial_delta(t_hdial *x, t_symbol *s, int ac, t_atom *av) +static void hradio_delta(t_hradio *x, t_symbol *s, int ac, t_atom *av) {iemgui_delta((void *)x, &x->x_gui, s, ac, av);} -static void hdial_pos(t_hdial *x, t_symbol *s, int ac, t_atom *av) +static void hradio_pos(t_hradio *x, t_symbol *s, int ac, t_atom *av) {iemgui_pos((void *)x, &x->x_gui, s, ac, av);} -static void hdial_color(t_hdial *x, t_symbol *s, int ac, t_atom *av) +static void hradio_color(t_hradio *x, t_symbol *s, int ac, t_atom *av) {iemgui_color((void *)x, &x->x_gui, s, ac, av);} -static void hdial_send(t_hdial *x, t_symbol *s) +static void hradio_send(t_hradio *x, t_symbol *s) {iemgui_send(x, &x->x_gui, s);} -static void hdial_receive(t_hdial *x, t_symbol *s) +static void hradio_receive(t_hradio *x, t_symbol *s) {iemgui_receive(x, &x->x_gui, s);} -static void hdial_label(t_hdial *x, t_symbol *s) +static void hradio_label(t_hradio *x, t_symbol *s) {iemgui_label((void *)x, &x->x_gui, s);} -static void hdial_label_pos(t_hdial *x, t_symbol *s, int ac, t_atom *av) +static void hradio_label_pos(t_hradio *x, t_symbol *s, int ac, t_atom *av) {iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);} -static void hdial_label_font(t_hdial *x, t_symbol *s, int ac, t_atom *av) +static void hradio_label_font(t_hradio *x, t_symbol *s, int ac, t_atom *av) {iemgui_label_font((void *)x, &x->x_gui, s, ac, av);} -static void hdial_init(t_hdial *x, t_floatarg f) +static void hradio_init(t_hradio *x, t_floatarg f) { x->x_gui.x_isa.x_loadinit = (f==0.0)?0:1; } -static void hdial_double_change(t_hdial *x) +static void hradio_double_change(t_hradio *x) {x->x_change = 1;} -static void hdial_single_change(t_hdial *x) +static void hradio_single_change(t_hradio *x) {x->x_change = 0;} -static void hdial_list(t_hdial *x, t_symbol *s, int ac, t_atom *av) +static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old) { - int l=iemgui_list((void *)x, &x->x_gui, s, ac, av); - - if(l < 0) - { - if(IS_A_FLOAT(av,0)) - hdial_float(x, atom_getfloatarg(0, ac, av)); - } - else if(l > 0) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); - } -} - -static void *hdial_new(t_symbol *s, int argc, t_atom *argv) -{ - t_hdial *x = (t_hdial *)pd_new(hdial_class); + t_hradio *x = (t_hradio *)pd_new(old? hradio_old_class : hradio_class); int bflcol[]={-262144, -1, -1}; t_symbol *srl[3]; int a=IEM_GUI_DEFAULTSIZE, on=0, f=0; @@ -573,7 +590,7 @@ static void *hdial_new(t_symbol *s, int argc, t_atom *argv) bflcol[2] = (int)atom_getintarg(13, argc, argv); on = (int)atom_getintarg(14, argc, argv); } - x->x_gui.x_draw = (t_iemfunptr)hdial_draw; + x->x_gui.x_draw = (t_iemfunptr)hradio_draw; iinit &= IEM_INIT_ARGS_ALL; ifstyle &= IEM_FSTYLE_FLAGS_ALL; fstyle->x_snd_able = 1; @@ -621,55 +638,119 @@ static void *hdial_new(t_symbol *s, int argc, t_atom *argv) return (x); } -static void hdial_ff(t_hdial *x) +static void *hradio_new(t_symbol *s, int argc, t_atom *argv) +{ + return (hradio_donew(s, argc, argv, 0)); +} + +static void *hdial_new(t_symbol *s, int argc, t_atom *argv) +{ + return (hradio_donew(s, argc, argv, 1)); +} + +static void hradio_ff(t_hradio *x) { - if(x->x_gui.x_fsf.x_selected) - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); gfxstub_deleteforkey(x); } -void g_hdial_setup(void) +void g_hradio_setup(void) { - hdial_class = class_new(gensym("hdl"), (t_newmethod)hdial_new, - (t_method)hdial_ff, sizeof(t_hdial), 0, A_GIMME, 0); - class_addcreator((t_newmethod)hdial_new, gensym("rdb"), A_GIMME, 0); - class_addcreator((t_newmethod)hdial_new, gensym("radiobut"), A_GIMME, 0); - class_addcreator((t_newmethod)hdial_new, gensym("radiobutton"), A_GIMME, 0); - class_addbang(hdial_class, hdial_bang); - class_addfloat(hdial_class, hdial_float); - class_addlist(hdial_class, hdial_list); - class_addmethod(hdial_class, (t_method)hdial_click, gensym("click"), + hradio_class = class_new(gensym("hdl"), (t_newmethod)hradio_new, + (t_method)hradio_ff, sizeof(t_hradio), 0, A_GIMME, 0); + class_addbang(hradio_class, hradio_bang); + class_addfloat(hradio_class, hradio_float); + class_addmethod(hradio_class, (t_method)hradio_click, gensym("click"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_addmethod(hradio_class, (t_method)hradio_dialog, gensym("dialog"), + A_GIMME, 0); + class_addmethod(hradio_class, (t_method)hradio_loadbang, + gensym("loadbang"), 0); + class_addmethod(hradio_class, (t_method)hradio_set, + gensym("set"), A_FLOAT, 0); + class_addmethod(hradio_class, (t_method)hradio_size, + gensym("size"), A_GIMME, 0); + class_addmethod(hradio_class, (t_method)hradio_delta, + gensym("delta"), A_GIMME, 0); + class_addmethod(hradio_class, (t_method)hradio_pos, + gensym("pos"), A_GIMME, 0); + class_addmethod(hradio_class, (t_method)hradio_color, + gensym("color"), A_GIMME, 0); + class_addmethod(hradio_class, (t_method)hradio_send, + gensym("send"), A_DEFSYM, 0); + class_addmethod(hradio_class, (t_method)hradio_receive, + gensym("receive"), A_DEFSYM, 0); + class_addmethod(hradio_class, (t_method)hradio_label, + gensym("label"), A_DEFSYM, 0); + class_addmethod(hradio_class, (t_method)hradio_label_pos, + gensym("label_pos"), A_GIMME, 0); + class_addmethod(hradio_class, (t_method)hradio_label_font, + gensym("label_font"), A_GIMME, 0); + class_addmethod(hradio_class, (t_method)hradio_init, + gensym("init"), A_FLOAT, 0); + class_addmethod(hradio_class, (t_method)hradio_number, + gensym("number"), A_FLOAT, 0); + class_addmethod(hradio_class, (t_method)hradio_single_change, + gensym("single_change"), 0); + class_addmethod(hradio_class, (t_method)hradio_double_change, + gensym("double_change"), 0); + hradio_widgetbehavior.w_getrectfn = hradio_getrect; + hradio_widgetbehavior.w_displacefn = iemgui_displace; + hradio_widgetbehavior.w_selectfn = iemgui_select; + hradio_widgetbehavior.w_activatefn = NULL; + hradio_widgetbehavior.w_deletefn = iemgui_delete; + hradio_widgetbehavior.w_visfn = iemgui_vis; + hradio_widgetbehavior.w_clickfn = hradio_newclick; + hradio_widgetbehavior.w_propertiesfn = hradio_properties; + hradio_widgetbehavior.w_savefn = hradio_save; + class_setwidget(hradio_class, &hradio_widgetbehavior); + class_sethelpsymbol(hradio_class, gensym("hradio")); + + /*obsolete version (0.34-0.35) */ + hradio_old_class = class_new(gensym("hdl"), (t_newmethod)hdial_new, + (t_method)hradio_ff, sizeof(t_hradio), 0, A_GIMME, 0); + class_addcreator((t_newmethod)hradio_new, gensym("rdb"), A_GIMME, 0); + class_addcreator((t_newmethod)hradio_new, gensym("radiobut"), A_GIMME, 0); + class_addcreator((t_newmethod)hradio_new, gensym("radiobutton"), + A_GIMME, 0); + class_addbang(hradio_class, hradio_bang); + class_addfloat(hradio_class, hradio_float); + class_addmethod(hradio_class, (t_method)hradio_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(hdial_class, (t_method)hdial_dialog, gensym("dialog"), + class_addmethod(hradio_class, (t_method)hradio_dialog, gensym("dialog"), A_GIMME, 0); - class_addmethod(hdial_class, (t_method)hdial_loadbang, gensym("loadbang"), 0); - class_addmethod(hdial_class, (t_method)hdial_set, gensym("set"), A_FLOAT, 0); - class_addmethod(hdial_class, (t_method)hdial_size, gensym("size"), A_GIMME, 0); - class_addmethod(hdial_class, (t_method)hdial_delta, gensym("delta"), A_GIMME, 0); - class_addmethod(hdial_class, (t_method)hdial_pos, gensym("pos"), A_GIMME, 0); - class_addmethod(hdial_class, (t_method)hdial_color, gensym("color"), A_GIMME, 0); - class_addmethod(hdial_class, (t_method)hdial_send, gensym("send"), A_DEFSYM, 0); - class_addmethod(hdial_class, (t_method)hdial_receive, gensym("receive"), A_DEFSYM, 0); - class_addmethod(hdial_class, (t_method)hdial_label, gensym("label"), A_DEFSYM, 0); - class_addmethod(hdial_class, (t_method)hdial_label_pos, gensym("label_pos"), A_GIMME, 0); - class_addmethod(hdial_class, (t_method)hdial_label_font, gensym("label_font"), A_GIMME, 0); - class_addmethod(hdial_class, (t_method)hdial_init, gensym("init"), A_FLOAT, 0); - class_addmethod(hdial_class, (t_method)hdial_number, gensym("number"), A_FLOAT, 0); - class_addmethod(hdial_class, (t_method)hdial_single_change, gensym("single_change"), 0); - class_addmethod(hdial_class, (t_method)hdial_double_change, gensym("double_change"), 0); - if(!iemgui_key_sym) - iemgui_key_sym = gensym("#keyname"); - hdial_widgetbehavior.w_getrectfn = hdial_getrect; - hdial_widgetbehavior.w_displacefn = iemgui_displace; - hdial_widgetbehavior.w_selectfn = iemgui_select; - hdial_widgetbehavior.w_activatefn = NULL; - hdial_widgetbehavior.w_deletefn = iemgui_delete; - hdial_widgetbehavior.w_visfn = iemgui_vis; - hdial_widgetbehavior.w_clickfn = hdial_newclick; - hdial_widgetbehavior.w_propertiesfn = hdial_properties; - hdial_widgetbehavior.w_savefn = hdial_save; - class_setwidget(hdial_class, &hdial_widgetbehavior); - class_sethelpsymbol(hdial_class, gensym("hdial")); + class_addmethod(hradio_class, (t_method)hradio_loadbang, + gensym("loadbang"), 0); + class_addmethod(hradio_class, (t_method)hradio_set, + gensym("set"), A_FLOAT, 0); + class_addmethod(hradio_class, (t_method)hradio_size, + gensym("size"), A_GIMME, 0); + class_addmethod(hradio_class, (t_method)hradio_delta, + gensym("delta"), A_GIMME, 0); + class_addmethod(hradio_class, (t_method)hradio_pos, + gensym("pos"), A_GIMME, 0); + class_addmethod(hradio_class, (t_method)hradio_color, + gensym("color"), A_GIMME, 0); + class_addmethod(hradio_class, (t_method)hradio_send, + gensym("send"), A_DEFSYM, 0); + class_addmethod(hradio_class, (t_method)hradio_receive, + gensym("receive"), A_DEFSYM, 0); + class_addmethod(hradio_class, (t_method)hradio_label, + gensym("label"), A_DEFSYM, 0); + class_addmethod(hradio_class, (t_method)hradio_label_pos, + gensym("label_pos"), A_GIMME, 0); + class_addmethod(hradio_class, (t_method)hradio_label_font, + gensym("label_font"), A_GIMME, 0); + class_addmethod(hradio_class, (t_method)hradio_init, + gensym("init"), A_FLOAT, 0); + class_addmethod(hradio_class, (t_method)hradio_number, + gensym("number"), A_FLOAT, 0); + class_addmethod(hradio_class, (t_method)hradio_single_change, + gensym("single_change"), 0); + class_addmethod(hradio_class, (t_method)hradio_double_change, + gensym("double_change"), 0); + class_setwidget(hradio_class, &hradio_widgetbehavior); + class_sethelpsymbol(hradio_class, gensym("hradio")); + } diff --git a/pd/src/g_hslider.c b/pd/src/g_hslider.c index 0e5415a9..5b08a9bb 100644 --- a/pd/src/g_hslider.c +++ b/pd/src/g_hslider.c @@ -169,13 +169,11 @@ static void hslider_draw_select(t_hslider* x,t_glist* glist) if(x->x_gui.x_fsf.x_selected) { - pd_bind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); } else { - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); } @@ -524,22 +522,6 @@ static void hslider_loadbang(t_hslider *x) } } -static void hslider_list(t_hslider *x, t_symbol *s, int ac, t_atom *av) -{ - int l=iemgui_list((void *)x, &x->x_gui, s, ac, av); - - if(l < 0) - { - if(IS_A_FLOAT(av,0)) - hslider_float(x, atom_getfloatarg(0, ac, av)); - } - else if(l > 0) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); - } -} - static void *hslider_new(t_symbol *s, int argc, t_atom *argv) { t_hslider *x = (t_hslider *)pd_new(hslider_class); @@ -654,8 +636,6 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv) static void hslider_free(t_hslider *x) { - if(x->x_gui.x_fsf.x_selected) - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); gfxstub_deleteforkey(x); @@ -670,7 +650,6 @@ void g_hslider_setup(void) #endif class_addbang(hslider_class,hslider_bang); class_addfloat(hslider_class,hslider_float); - class_addlist(hslider_class, hslider_list); class_addmethod(hslider_class, (t_method)hslider_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); class_addmethod(hslider_class, (t_method)hslider_motion, gensym("motion"), @@ -692,8 +671,6 @@ void g_hslider_setup(void) class_addmethod(hslider_class, (t_method)hslider_lin, gensym("lin"), 0); class_addmethod(hslider_class, (t_method)hslider_init, gensym("init"), A_FLOAT, 0); class_addmethod(hslider_class, (t_method)hslider_steady, gensym("steady"), A_FLOAT, 0); - if(!iemgui_key_sym) - iemgui_key_sym = gensym("#keyname"); hslider_widgetbehavior.w_getrectfn = hslider_getrect; hslider_widgetbehavior.w_displacefn = iemgui_displace; hslider_widgetbehavior.w_selectfn = iemgui_select; diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c index edddb568..726b6770 100644 --- a/pd/src/g_mycanvas.c +++ b/pd/src/g_mycanvas.c @@ -95,12 +95,10 @@ void my_canvas_draw_select(t_my_canvas* x, t_glist* glist) if(x->x_gui.x_fsf.x_selected) { - pd_bind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); } else { - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, x->x_gui.x_bcol); } } @@ -261,21 +259,6 @@ static void my_canvas_label_pos(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) static void my_canvas_label_font(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) {iemgui_label_font((void *)x, &x->x_gui, s, ac, av);} -static void my_canvas_list(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) -{ - int l=iemgui_list((void *)x, &x->x_gui, s, ac, av); - - /*if(l < 0) - { - post("error: my_canvas: no method for 'list'"); - } - else */if(l > 0) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); - } -} - static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv) { t_my_canvas *x = (t_my_canvas *)pd_new(my_canvas_class); @@ -397,8 +380,6 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv) static void my_canvas_ff(t_my_canvas *x) { - if(x->x_gui.x_fsf.x_selected) - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); gfxstub_deleteforkey(x); @@ -409,7 +390,6 @@ void g_mycanvas_setup(void) my_canvas_class = class_new(gensym("cnv"), (t_newmethod)my_canvas_new, (t_method)my_canvas_ff, sizeof(t_my_canvas), CLASS_NOINLET, A_GIMME, 0); class_addcreator((t_newmethod)my_canvas_new, gensym("my_canvas"), A_GIMME, 0); - class_addlist(my_canvas_class, my_canvas_list); class_addmethod(my_canvas_class, (t_method)my_canvas_dialog, gensym("dialog"), A_GIMME, 0); class_addmethod(my_canvas_class, (t_method)my_canvas_size, gensym("size"), A_GIMME, 0); class_addmethod(my_canvas_class, (t_method)my_canvas_delta, gensym("delta"), A_GIMME, 0); @@ -423,8 +403,6 @@ void g_mycanvas_setup(void) class_addmethod(my_canvas_class, (t_method)my_canvas_label_font, gensym("label_font"), A_GIMME, 0); class_addmethod(my_canvas_class, (t_method)my_canvas_get_pos, gensym("get_pos"), 0); - if(!iemgui_key_sym) - iemgui_key_sym = gensym("#keyname"); my_canvas_widgetbehavior.w_getrectfn = my_canvas_getrect; my_canvas_widgetbehavior.w_displacefn = iemgui_displace; my_canvas_widgetbehavior.w_selectfn = iemgui_select; diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c index e0967b5b..092c2718 100644 --- a/pd/src/g_numbox.c +++ b/pd/src/g_numbox.c @@ -25,6 +25,7 @@ /*------------------ global functions -------------------------*/ +static void my_numbox_key(void *z, t_floatarg fkey); /* ------------ nmx gui-my number box ----------------------- */ @@ -38,7 +39,7 @@ static void my_numbox_tick_reset(t_my_numbox *x) if(x->x_gui.x_fsf.x_change) { x->x_gui.x_fsf.x_change = 0; - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); + glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); } } @@ -142,25 +143,29 @@ static void my_numbox_draw_update(t_my_numbox *x, t_glist *glist) x->x_buf[sl+1] = 0; if(sl >= x->x_gui.x_w) cp += sl - x->x_gui.x_w + 1; - sys_vgui(".x%x.c itemconfigure %xNUMBER -fill #%6.6x -text {%s} \n", + sys_vgui( + ".x%x.c itemconfigure %xNUMBER -fill #%6.6x -text {%s} \n", glist_getcanvas(glist), x, IEM_GUI_COLOR_EDITED, cp); x->x_buf[sl] = 0; } else { my_numbox_ftoa(x); - sys_vgui(".x%x.c itemconfigure %xNUMBER -fill #%6.6x -text {%s} \n", - glist_getcanvas(glist), x, IEM_GUI_COLOR_EDITED, x->x_buf); + sys_vgui( + ".x%x.c itemconfigure %xNUMBER -fill #%6.6x -text {%s} \n", + glist_getcanvas(glist), x, IEM_GUI_COLOR_EDITED, x->x_buf); x->x_buf[0] = 0; } } else { my_numbox_ftoa(x); - sys_vgui(".x%x.c itemconfigure %xNUMBER -fill #%6.6x -text {%s} \n", - glist_getcanvas(glist), x, - x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_fcol, - x->x_buf); + sys_vgui( + ".x%x.c itemconfigure %xNUMBER -fill #%6.6x -text {%s} \n", + glist_getcanvas(glist), x, + x->x_gui.x_fsf.x_selected? + IEM_GUI_COLOR_SELECTED:x->x_gui.x_fcol, + x->x_buf); x->x_buf[0] = 0; } } @@ -173,28 +178,31 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist) int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); - sys_vgui(".x%x.c create polygon %d %d %d %d %d %d %d %d %d %d -outline #%6.6x -fill #%6.6x -tags %xBASE1\n", + sys_vgui( +".x%x.c create polygon %d %d %d %d %d %d %d %d %d %d -outline #%6.6x \ +-fill #%6.6x -tags %xBASE1\n", canvas, xpos, ypos, xpos + x->x_numwidth-4, ypos, xpos + x->x_numwidth, ypos+4, xpos + x->x_numwidth, ypos + x->x_gui.x_h, xpos, ypos + x->x_gui.x_h, IEM_GUI_COLOR_NORMAL, x->x_gui.x_bcol, x); - sys_vgui(".x%x.c create line %d %d %d %d %d %d -fill #%6.6x -tags %xBASE2\n", - canvas, xpos, ypos, - xpos + half, ypos + half, - xpos, ypos + x->x_gui.x_h, - x->x_gui.x_fcol, x); + sys_vgui( + ".x%x.c create line %d %d %d %d %d %d -fill #%6.6x -tags %xBASE2\n", + canvas, xpos, ypos, + xpos + half, ypos + half, + xpos, ypos + x->x_gui.x_h, + x->x_gui.x_fcol, x); sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %xLABEL\n", - canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", - x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol, x); + -font {%s %d bold} -fill #%6.6x -tags %xLABEL\n", + canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy, + strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", + x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol, x); my_numbox_ftoa(x); sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \ - -font {%s %d bold} -fill #%6.6x -tags %xNUMBER\n", - canvas, xpos+half+2, ypos+half+d, - x->x_buf, x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_fcol, x); + -font {%s %d bold} -fill #%6.6x -tags %xNUMBER\n", + canvas, xpos+half+2, ypos+half+d, + x->x_buf, x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_fcol, x); if(!x->x_gui.x_fsf.x_snd_able) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xOUT%d\n", canvas, @@ -305,25 +313,33 @@ static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist) { if(x->x_gui.x_fsf.x_change) { - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); x->x_gui.x_fsf.x_change = 0; clock_unset(x->x_clock_reset); x->x_buf[0] = 0; (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); } - pd_bind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); - sys_vgui(".x%x.c itemconfigure %xBASE1 -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - sys_vgui(".x%x.c itemconfigure %xBASE2 -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - sys_vgui(".x%x.c itemconfigure %xNUMBER -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); + glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.ob_g, + 0, my_numbox_key, 0, 0); + sys_vgui(".x%x.c itemconfigure %xBASE1 -outline #%6.6x\n", + canvas, x, IEM_GUI_COLOR_SELECTED); + sys_vgui(".x%x.c itemconfigure %xBASE2 -fill #%6.6x\n", + canvas, x, IEM_GUI_COLOR_SELECTED); + sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", + canvas, x, IEM_GUI_COLOR_SELECTED); + sys_vgui(".x%x.c itemconfigure %xNUMBER -fill #%6.6x\n", + canvas, x, IEM_GUI_COLOR_SELECTED); } else { - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); - sys_vgui(".x%x.c itemconfigure %xBASE1 -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); - sys_vgui(".x%x.c itemconfigure %xBASE2 -fill #%6.6x\n", canvas, x, x->x_gui.x_fcol); - sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); - sys_vgui(".x%x.c itemconfigure %xNUMBER -fill #%6.6x\n", canvas, x, x->x_gui.x_fcol); + glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0); + sys_vgui(".x%x.c itemconfigure %xBASE1 -outline #%6.6x\n", + canvas, x, IEM_GUI_COLOR_NORMAL); + sys_vgui(".x%x.c itemconfigure %xBASE2 -fill #%6.6x\n", + canvas, x, x->x_gui.x_fcol); + sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", + canvas, x, x->x_gui.x_lcol); + sys_vgui(".x%x.c itemconfigure %xNUMBER -fill #%6.6x\n", + canvas, x, x->x_gui.x_fcol); } } @@ -370,7 +386,7 @@ static void my_numbox_save(t_gobj *z, t_binbuf *b) { x->x_gui.x_fsf.x_change = 0; clock_unset(x->x_clock_reset); - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); + glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); } @@ -438,7 +454,7 @@ static void my_numbox_properties(t_gobj *z, t_glist *owner) { x->x_gui.x_fsf.x_change = 0; clock_unset(x->x_clock_reset); - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); + glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); } @@ -452,11 +468,13 @@ static void my_numbox_properties(t_gobj *z, t_glist *owner) %d %d %d\n", x->x_gui.x_w, 1, x->x_gui.x_h, 8, x->x_min, x->x_max, 0,/*no_schedule*/ - x->x_lin0_log1, x->x_gui.x_isa.x_loadinit, -1, x->x_log_height,/*no multi, but iem-characteristic*/ + x->x_lin0_log1, x->x_gui.x_isa.x_loadinit, -1, + x->x_log_height, /*no multi, but iem-characteristic*/ srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, - 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); + 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, + 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); } @@ -467,7 +485,8 @@ static void my_numbox_bang(t_my_numbox *x) pd_float(x->x_gui.x_snd->s_thing, x->x_val); } -static void my_numbox_dialog(t_my_numbox *x, t_symbol *s, int argc, t_atom *argv) +static void my_numbox_dialog(t_my_numbox *x, t_symbol *s, int argc, + t_atom *argv) { t_symbol *srl[3]; int w = (int)atom_getintarg(0, argc, argv); @@ -512,13 +531,6 @@ static void my_numbox_motion(t_my_numbox *x, t_floatarg dx, t_floatarg dy) else x->x_val -= k2*dy; my_numbox_clip(x); - if(x->x_gui.x_fsf.x_change) - { - x->x_gui.x_fsf.x_change = 0; - clock_unset(x->x_clock_reset); - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); - - } (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); my_numbox_bang(x); } @@ -526,19 +538,19 @@ static void my_numbox_motion(t_my_numbox *x, t_floatarg dx, t_floatarg dy) static void my_numbox_click(t_my_numbox *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { - glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, (t_glistmotionfn)my_numbox_motion, - 0, xpos, ypos); + glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, + (t_glistmotionfn)my_numbox_motion, my_numbox_key, xpos, ypos); } static int my_numbox_newclick(t_gobj *z, struct _glist *glist, - int xpix, int ypix, int shift, int alt, int dbl, int doit) + int xpix, int ypix, int shift, int alt, int dbl, int doit) { t_my_numbox* x = (t_my_numbox *)z; if(doit) { - my_numbox_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, - 0, (t_floatarg)alt); + my_numbox_click( x, (t_floatarg)xpix, (t_floatarg)ypix, + (t_floatarg)shift, 0, (t_floatarg)alt); if(shift) x->x_gui.x_fsf.x_finemoved = 1; else @@ -548,14 +560,16 @@ static int my_numbox_newclick(t_gobj *z, struct _glist *glist, clock_delay(x->x_clock_wait, 50); x->x_gui.x_fsf.x_change = 1; clock_delay(x->x_clock_reset, 3000); - pd_bind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); + /* glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.ob_g, + 0, my_numbox_key, 0, 0); */ + x->x_buf[0] = 0; } else { x->x_gui.x_fsf.x_change = 0; clock_unset(x->x_clock_reset); - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); + glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0); x->x_buf[0] = 0; (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); } @@ -639,7 +653,8 @@ static void my_numbox_label(t_my_numbox *x, t_symbol *s) static void my_numbox_label_pos(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) {iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);} -static void my_numbox_label_font(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) +static void my_numbox_label_font(t_my_numbox *x, + t_symbol *s, int ac, t_atom *av) { int f = (int)atom_getintarg(1, ac, av); @@ -683,118 +698,58 @@ static void my_numbox_loadbang(t_my_numbox *x) } } -static void my_numbox_list(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) +static void my_numbox_key(void *z, t_floatarg fkey) { - int l=-1; + t_my_numbox *x = z; + char c=fkey; + char buf[3]; + buf[1] = 0; - if(x->x_gui.x_fsf.x_selected) + if (c == 0) { - if((ac == 2)&&IS_A_FLOAT(av,0)&&IS_A_SYMBOL(av,1)) - { - t_symbol *key = atom_getsymbolarg(1, ac, av); - int keydown = atom_getintarg(0, ac, av); - - if(keydown) - { - int refresh = 1,i,d=1; - static char buf[20]; - - buf[0] = 0; - if(!strcmp(key->s_name, "Shift_L")||!strcmp(key->s_name, "Shift_R")) - x->x_gui.x_fsf.x_shiftdown = 1; - else - { - if(x->x_gui.x_fsf.x_shiftdown) - d = 10; - if(!strcmp(key->s_name, "Up")) - x->x_gui.x_obj.te_ypix -= d; - else if(!strcmp(key->s_name, "Down")) - x->x_gui.x_obj.te_ypix += d; - else if(!strcmp(key->s_name, "Left")) - x->x_gui.x_obj.te_xpix -= d; - else if(!strcmp(key->s_name, "Right")) - x->x_gui.x_obj.te_xpix += d; - else - refresh = 0; - if(refresh) - l = 1; - } - l = 0; - } - else - { - if(!strcmp(key->s_name, "Shift_L")||!strcmp(key->s_name, "Shift_R")) - x->x_gui.x_fsf.x_shiftdown = 0; - l = 0; - } - } + x->x_gui.x_fsf.x_change = 0; + clock_unset(x->x_clock_reset); + (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); + return; } - else + if(((c>='0')&&(c<='9'))||(c=='.')||(c=='-')|| + (c=='e')||(c=='+')||(c=='E')) { - if(x->x_gui.x_fsf.x_change) + if(strlen(x->x_buf) < (IEMGUI_MAX_NUM_LEN-2)) { - if((ac == 2)&&IS_A_FLOAT(av,0)&&IS_A_SYMBOL(av,1)) - { - t_symbol *key = atom_getsymbolarg(1, ac, av); - int keydown = atom_getintarg(0, ac, av); - char buf[3]; - - buf[1] = 0; - if(keydown) - { - char *c=key->s_name; - - l = 0; - if(((*c>='0')&&(*c<='9'))||(*c=='.')||(*c=='-')||(*c=='e')||(*c=='+')||(*c=='E')) - { - if(strlen(x->x_buf) < (IEMGUI_MAX_NUM_LEN-2)) - { - buf[0] = *c; - strcat(x->x_buf, buf); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - } - } - else if((*c=='\b')||(*c==127)) - { - int sl=strlen(x->x_buf)-1; - - if(sl < 0) - sl = 0; - x->x_buf[sl] = 0; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - } - else if((*c=='\n')||(*c==13)) - { - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); - x->x_val = atof(x->x_buf); - x->x_buf[0] = 0; - x->x_gui.x_fsf.x_change = 0; - clock_unset(x->x_clock_reset); - my_numbox_clip(x); - my_numbox_bang(x); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - } - clock_delay(x->x_clock_reset, 3000); - } - else - { - l = 0; - } - } + buf[0] = c; + strcat(x->x_buf, buf); + (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); } } - if(l < 0) + else if((c=='\b')||(c==127)) { - if(IS_A_FLOAT(av,0)) - { - my_numbox_set(x, atom_getfloatarg(0, ac, av)); - my_numbox_bang(x); - } + int sl=strlen(x->x_buf)-1; + + if(sl < 0) + sl = 0; + x->x_buf[sl] = 0; + (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); } - else if(l > 0) + else if((c=='\n')||(c==13)) { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); + x->x_val = atof(x->x_buf); + x->x_buf[0] = 0; + x->x_gui.x_fsf.x_change = 0; + clock_unset(x->x_clock_reset); + my_numbox_clip(x); + my_numbox_bang(x); + (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); + } + clock_delay(x->x_clock_reset, 3000); +} + +static void my_numbox_list(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) +{ + if (IS_A_FLOAT(av,0)) + { + my_numbox_set(x, atom_getfloatarg(0, ac, av)); + my_numbox_bang(x); } } @@ -924,8 +879,6 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv) static void my_numbox_free(t_my_numbox *x) { - if(x->x_gui.x_fsf.x_selected) - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); clock_free(x->x_clock_reset); @@ -936,35 +889,50 @@ static void my_numbox_free(t_my_numbox *x) void g_numbox_setup(void) { my_numbox_class = class_new(gensym("nbx"), (t_newmethod)my_numbox_new, - (t_method)my_numbox_free, sizeof(t_my_numbox), 0, A_GIMME, 0); - class_addcreator((t_newmethod)my_numbox_new, gensym("my_numbox"), A_GIMME, 0); + (t_method)my_numbox_free, sizeof(t_my_numbox), 0, A_GIMME, 0); + class_addcreator((t_newmethod)my_numbox_new, gensym("my_numbox"), + A_GIMME, 0); class_addbang(my_numbox_class,my_numbox_bang); class_addfloat(my_numbox_class,my_numbox_float); class_addlist(my_numbox_class, my_numbox_list); - class_addmethod(my_numbox_class, (t_method)my_numbox_click, gensym("click"), - A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_motion, gensym("motion"), - A_FLOAT, A_FLOAT, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_dialog, gensym("dialog"), - A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_loadbang, gensym("loadbang"), 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_set, gensym("set"), A_FLOAT, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_size, gensym("size"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_delta, gensym("delta"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_pos, gensym("pos"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_range, gensym("range"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_color, gensym("color"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_send, gensym("send"), A_DEFSYM, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_receive, gensym("receive"), A_DEFSYM, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_label, gensym("label"), A_DEFSYM, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_label_pos, gensym("label_pos"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_label_font, gensym("label_font"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_log, gensym("log"), 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_lin, gensym("lin"), 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_init, gensym("init"), A_FLOAT, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_log_height, gensym("log_height"), A_FLOAT, 0); - if(!iemgui_key_sym) - iemgui_key_sym = gensym("#keyname"); + class_addmethod(my_numbox_class, (t_method)my_numbox_click, + gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_motion, + gensym("motion"), A_FLOAT, A_FLOAT, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_dialog, + gensym("dialog"), A_GIMME, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_loadbang, + gensym("loadbang"), 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_set, + gensym("set"), A_FLOAT, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_size, + gensym("size"), A_GIMME, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_delta, + gensym("delta"), A_GIMME, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_pos, + gensym("pos"), A_GIMME, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_range, + gensym("range"), A_GIMME, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_color, + gensym("color"), A_GIMME, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_send, + gensym("send"), A_DEFSYM, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_receive, + gensym("receive"), A_DEFSYM, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_label, + gensym("label"), A_DEFSYM, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_label_pos, + gensym("label_pos"), A_GIMME, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_label_font, + gensym("label_font"), A_GIMME, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_log, + gensym("log"), 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_lin, + gensym("lin"), 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_init, + gensym("init"), A_FLOAT, 0); + class_addmethod(my_numbox_class, (t_method)my_numbox_log_height, + gensym("log_height"), A_FLOAT, 0); my_numbox_widgetbehavior.w_getrectfn = my_numbox_getrect; my_numbox_widgetbehavior.w_displacefn = iemgui_displace; my_numbox_widgetbehavior.w_selectfn = iemgui_select; diff --git a/pd/src/g_readwrite.c b/pd/src/g_readwrite.c index ab380971..40755bb0 100644 --- a/pd/src/g_readwrite.c +++ b/pd/src/g_readwrite.c @@ -587,20 +587,20 @@ static void canvas_saveto(t_canvas *x, t_binbuf *b) linetraverser_start(&t, x); while (oc = linetraverser_next(&t)) { - int srcno, sinkno; - for (srcno = 0, y = x->gl_list; y && y != &t.tr_ob->ob_g; y = y->g_next) - srcno++; - for (sinkno = 0, y = x->gl_list; y && y != &t.tr_ob2->ob_g; y = y->g_next) - sinkno++; + int srcno = canvas_getindex(x, &t.tr_ob->ob_g); + int sinkno = canvas_getindex(x, &t.tr_ob2->ob_g); binbuf_addv(b, "ssiiii;", gensym("#X"), gensym("connect"), srcno, t.tr_outno, sinkno, t.tr_inno); } - if (x->gl_isgraph) - 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); + /* unless everything is the default (as in ordinary subpatches) + 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"), + 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_template.c b/pd/src/g_template.c index 5e11cc5a..8dc897a3 100644 --- a/pd/src/g_template.c +++ b/pd/src/g_template.c @@ -279,7 +279,8 @@ static t_scalar *template_conformscalar(t_template *tfrom, t_template *tto, t_scalar *x; t_gpointer gp; int nto = tto->t_n, nfrom = tfrom->t_n, i; - post("conform scalar"); + t_template *scalartemplate; + /* post("conform scalar"); */ /* possibly replace the scalar */ if (scfrom->sc_template == tfrom->t_sym) { @@ -321,15 +322,17 @@ static t_scalar *template_conformscalar(t_template *tfrom, t_template *tto, pd_free(&scfrom->sc_gobj.g_pd); } else x = scfrom; + scalartemplate = template_findbyname(x->sc_template); /* convert all array elements and sublists */ - for (i = 0; i < nto; i++) + for (i = 0; i < scalartemplate->t_n; i++) { - if (tto->t_vec[i].ds_type == DT_LIST) + t_dataslot *ds = scalartemplate->t_vec + i; + if (ds->ds_type == DT_LIST) { t_glist *gl2 = x->sc_vec[i].w_list; template_conformglist(tfrom, tto, gl2, conformaction); } - else if (tto->t_vec[i].ds_type == DT_ARRAY) + else if (ds->ds_type == DT_ARRAY) { template_conformarray(tfrom, tto, conformaction, x->sc_vec[i].w_array); @@ -373,7 +376,7 @@ static void template_conformglist(t_template *tfrom, t_template *tto, t_glist *glist, int *conformaction) { t_gobj *g; - post("conform glist %s", glist->gl_name->s_name); + /* post("conform glist %s", glist->gl_name->s_name); */ for (g = glist->gl_list; g; g = g->g_next) { if (pd_class(&g->g_pd) == scalar_class) diff --git a/pd/src/g_text.c b/pd/src/g_text.c index 226ddc7a..d59afb3a 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -17,12 +17,17 @@ static t_class *text_class; static t_class *message_class; static t_class *gatom_class; +static void text_vis(t_gobj *z, t_glist *glist, int vis); +static void text_displace(t_gobj *z, t_glist *glist, + int dx, int dy); +static void text_getrect(t_gobj *z, t_glist *glist, + int *xp1, int *yp1, int *xp2, int *yp2); + void canvas_startmotion(t_canvas *x); t_widgetbehavior text_widgetbehavior; /* ----------------- the "text" object. ------------------ */ - /* add a "text" object (comment) to a glist. While this one goes for any glist, the other 3 below are for canvases only. (why?) This is called without args if invoked from the GUI; otherwise at least x and y @@ -60,6 +65,7 @@ void glist_text(t_glist *gl, t_symbol *s, int argc, t_atom *argv) glist_add(gl, &x->te_g); glist_noselect(gl); glist_select(gl, &x->te_g); + gobj_activate(&x->te_g, gl, 1); canvas_startmotion(glist_getcanvas(gl)); } } @@ -193,6 +199,16 @@ void canvas_vdial(t_glist *gl, t_symbol *s, int argc, t_atom *argv) canvas_iemguis(gl, gensym("vdl")); } +void canvas_hradio(t_glist *gl, t_symbol *s, int argc, t_atom *argv) +{ + canvas_iemguis(gl, gensym("hradio")); +} + +void canvas_vradio(t_glist *gl, t_symbol *s, int argc, t_atom *argv) +{ + canvas_iemguis(gl, gensym("vradio")); +} + void canvas_vumeter(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { canvas_iemguis(gl, gensym("vu")); @@ -367,6 +383,7 @@ void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv) glist_add(gl, &x->m_text.te_g); glist_noselect(gl); glist_select(gl, &x->m_text.te_g); + gobj_activate(&x->m_text.te_g, gl, 1); canvas_startmotion(glist_getcanvas(gl)); } } @@ -374,19 +391,49 @@ void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv) /* ---------------------- the "atom" text item ------------------------ */ #define ATOMBUFSIZE 40 +#define ATOM_LABELLEFT 0 +#define ATOM_LABELRIGHT 1 +#define ATOM_LABELUP 2 +#define ATOM_LABELDOWN 3 typedef struct _gatom { t_text a_text; - t_atom a_atom; /* this holds the value and the type */ - t_glist *a_glist; /* owning glist */ - t_float a_toggle; /* value to toggle to */ - t_float a_draghi; /* high end of drag range */ - t_float a_draglo; /* low end of drag range */ - char a_buf[ATOMBUFSIZE]; - char a_shift; + t_atom a_atom; /* this holds the value and the type */ + t_glist *a_glist; /* owning glist */ + t_float a_toggle; /* value to toggle to */ + t_float a_draghi; /* high end of drag range */ + t_float a_draglo; /* low end of drag range */ + t_symbol *a_label; /* symbol to show as label next to box */ + t_symbol *a_symfrom; /* "receive" name -- bind ourselvs to this */ + t_symbol *a_symto; /* "send" name -- send to this on output */ + char a_buf[ATOMBUFSIZE];/* string buffer for typing */ + char a_shift; /* was shift key down when dragging started? */ + char a_wherelabel; /* 0-3 for left, right, above, below */ } t_gatom; +static t_symbol *gatom_escapit(t_symbol *s) +{ + if (!*s->s_name) + return (gensym("-")); + else if (*s->s_name == '-') + { + char shmo[100]; + shmo[0] = '-'; + strncpy(shmo+1, s->s_name, 99); + shmo[99] = 0; + return (gensym(shmo)); + } + else return (s); +} + +static t_symbol *gatom_unescapit(t_symbol *s) +{ + if (*s->s_name == '-') + return (gensym(s->s_name+1)); + else return (s); +} + static void gatom_set(t_gatom *x, t_symbol *s, int argc, t_atom *argv) { if (!argc) return; @@ -403,9 +450,31 @@ static void gatom_set(t_gatom *x, t_symbol *s, int argc, t_atom *argv) static void gatom_bang(t_gatom *x) { if (x->a_atom.a_type == A_FLOAT) - outlet_float(x->a_text.te_outlet, x->a_atom.a_w.w_float); + { + if (x->a_text.te_outlet) + outlet_float(x->a_text.te_outlet, x->a_atom.a_w.w_float); + if (*x->a_symto->s_name && x->a_symto->s_thing) + { + if (x->a_symto == x->a_symfrom) + pd_error(x, + "%s: atom with same send/receive name (infinite loop)", + x->a_symto->s_name); + else pd_float(x->a_symto->s_thing, x->a_atom.a_w.w_float); + } + } else if (x->a_atom.a_type == A_SYMBOL) - outlet_symbol(x->a_text.te_outlet, x->a_atom.a_w.w_symbol); + { + if (x->a_text.te_outlet) + outlet_symbol(x->a_text.te_outlet, x->a_atom.a_w.w_symbol); + if (*x->a_symto->s_name && x->a_symto->s_thing) + { + if (x->a_symto == x->a_symfrom) + pd_error(x, + "%s: atom with same send/receive name (infinite loop)", + x->a_symto->s_name); + else pd_symbol(x->a_symto->s_thing, x->a_atom.a_w.w_symbol); + } + } } static void gatom_float(t_gatom *x, t_float f) @@ -465,17 +534,26 @@ static void gatom_key(void *z, t_floatarg f) { t_gatom *x = (t_gatom *)z; int c = f; - int l = strlen(x->a_buf); + int len = strlen(x->a_buf); t_atom at; char sbuf[ATOMBUFSIZE + 4]; - if (c == ' ') return; - else if (c == '\b') + if (c == 0) { - if (l > 0) - { - x->a_buf[l-1] = 0; - goto redraw; + /* we're being notified that no more keys will come for this grab */ + if (x->a_buf[0]) + { + binbuf_clear(x->a_text.te_binbuf); + binbuf_add(x->a_text.te_binbuf, 1, &x->a_atom); + glist_retext(x->a_glist, &x->a_text); } + return; + } + else if (c == ' ') return; + else if (c == '\b') + { + if (len > 0) + x->a_buf[len-1] = 0; + goto redraw; } else if (c == '\n') { @@ -485,10 +563,10 @@ static void gatom_key(void *z, t_floatarg f) gatom_symbol(x, gensym(x->a_buf)); else bug("gatom_key"); } - else if (l < (ATOMBUFSIZE-1)) + else if (len < (ATOMBUFSIZE-1)) { - x->a_buf[l] = c; - x->a_buf[l+1] = 0; + x->a_buf[len] = c; + x->a_buf[len+1] = 0; goto redraw; } return; @@ -530,9 +608,34 @@ static void gatom_click(t_gatom *x, } } -static void gatom_param(t_gatom *x, t_floatarg width, t_floatarg draglo, - t_floatarg draghi) -{ + /* message back from dialog window */ +static void gatom_param(t_gatom *x, t_symbol *sel, int argc, t_atom *argv) +{ + t_float width = atom_getfloatarg(0, argc, argv); + t_float draglo = atom_getfloatarg(1, argc, argv); + t_float draghi = atom_getfloatarg(2, argc, argv); + t_symbol *label = gatom_unescapit(atom_getsymbolarg(3, argc, argv)); + t_float wherelabel = atom_getfloatarg(4, argc, argv); + t_symbol *symfrom = gatom_unescapit(atom_getsymbolarg(5, argc, argv)); + t_symbol *symto = gatom_unescapit(atom_getsymbolarg(6, argc, argv)); + + gobj_vis(&x->a_text.te_g, x->a_glist, 0); + if (!*symfrom->s_name && *x->a_symfrom->s_name) + inlet_new(&x->a_text, &x->a_text.te_pd, 0, 0); + else if (*symfrom->s_name && !*x->a_symfrom->s_name && x->a_text.te_inlet) + { + canvas_deletelinesforio(x->a_glist, &x->a_text, + x->a_text.te_inlet, 0); + inlet_free(x->a_text.te_inlet); + } + if (!*symto->s_name && *x->a_symto->s_name) + outlet_new(&x->a_text, 0); + else if (*symto->s_name && !*x->a_symto->s_name && x->a_text.te_outlet) + { + canvas_deletelinesforio(x->a_glist, &x->a_text, + 0, x->a_text.te_outlet); + outlet_free(x->a_text.te_outlet); + } if (draglo >= draghi) draglo = draghi = 0; x->a_draglo = draglo; @@ -542,7 +645,76 @@ static void gatom_param(t_gatom *x, t_floatarg width, t_floatarg draglo, else if (width > 80) width = 80; x->a_text.te_width = width; - glist_retext(x->a_glist, &x->a_text); + x->a_wherelabel = ((int)wherelabel & 3); + x->a_label = label; + if (*x->a_symfrom->s_name) + pd_unbind(&x->a_text.te_pd, x->a_symfrom); + x->a_symfrom = symfrom; + if (*x->a_symfrom->s_name) + pd_bind(&x->a_text.te_pd, x->a_symfrom); + x->a_symto = symto; + gobj_vis(&x->a_text.te_g, x->a_glist, 1); + + /* glist_retext(x->a_glist, &x->a_text); */ +} + + /* ---------------- gatom-specific widget functions --------------- */ +static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp) +{ + int x1, y1, x2, y2, width, height; + text_getrect(&x->a_text.te_g, glist, &x1, &y1, &x2, &y2); + width = x2 - x1; + height = y2 - y1; + if (x->a_wherelabel == ATOM_LABELLEFT) + { + *xp = x1 - 3 - strlen(x->a_label->s_name) * + sys_fontwidth(glist_getfont(glist)); + *yp = y1 + 2; + } + else if (x->a_wherelabel == ATOM_LABELRIGHT) + { + *xp = x2 + 2; + *yp = y1 + 2; + } + else if (x->a_wherelabel == ATOM_LABELUP) + { + *xp = x1 - 1; + *yp = y1 - 1 - sys_fontheight(glist_getfont(glist));; + } + else + { + *xp = x1 - 1; + *yp = y2 + 3; + } +} + +static void gatom_displace(t_gobj *z, t_glist *glist, + int dx, int dy) +{ + t_gatom *x = (t_gatom*)z; + text_displace(z, glist, dx, dy); + sys_vgui(".x%x.c move %x.l %d %d\n", glist_getcanvas(glist), + x, dx, dy); +} + +static void gatom_vis(t_gobj *z, t_glist *glist, int vis) +{ + t_gatom *x = (t_gatom*)z; + text_vis(z, glist, vis); + if (*x->a_label->s_name) + { + if (vis) + { + int x1, y1; + gatom_getwherelabel(x, glist, &x1, &y1); + sys_vgui("pdtk_text_new .x%x.c %x.l %f %f {%s} %d %s\n", + glist_getcanvas(glist), x, + (double)x1, (double)y1, + x->a_label->s_name, sys_hostfontsize(glist_getfont(glist)), + "black"); + } + else sys_vgui(".x%x.c delete %x.l\n", glist_getcanvas(glist), x); + } } void canvas_atom(t_glist *gl, t_atomtype type, @@ -558,22 +730,26 @@ void canvas_atom(t_glist *gl, t_atomtype type, x->a_toggle = 1; x->a_draglo = 0; x->a_draghi = 0; + x->a_wherelabel = 0; + x->a_label = &s_; + x->a_symfrom = &s_; + x->a_symto = &s_; if (type == A_FLOAT) { x->a_atom.a_w.w_float = 0; x->a_text.te_width = 5; - outlet_new(&x->a_text, &s_float); SETFLOAT(&at, 0); } else { x->a_atom.a_w.w_symbol = &s_symbol; x->a_text.te_width = 10; - outlet_new(&x->a_text, &s_symbol); SETSYMBOL(&at, &s_symbol); } binbuf_add(x->a_text.te_binbuf, 1, &at); if (argc > 1) + /* create from file. x, y, width, low-range, high-range, flags, + label, receive-name, send-name */ { x->a_text.te_xpix = atom_getfloatarg(0, argc, argv); x->a_text.te_ypix = atom_getfloatarg(1, argc, argv); @@ -584,11 +760,26 @@ void canvas_atom(t_glist *gl, t_atomtype type, x->a_text.te_width = 4; x->a_draglo = atom_getfloatarg(3, argc, argv); x->a_draghi = atom_getfloatarg(4, argc, argv); + x->a_wherelabel = (((int)atom_getfloatarg(5, argc, argv)) & 3); + x->a_label = gatom_unescapit(atom_getsymbolarg(6, argc, argv)); + x->a_symfrom = gatom_unescapit(atom_getsymbolarg(7, argc, argv)); + if (*x->a_symfrom->s_name) + pd_bind(&x->a_text.te_pd, x->a_symfrom); + + x->a_symto = gatom_unescapit(atom_getsymbolarg(8, argc, argv)); + if (x->a_symto == &s_) + outlet_new(&x->a_text, + x->a_atom.a_type == A_FLOAT ? &s_float: &s_symbol); + if (x->a_symfrom == &s_) + inlet_new(&x->a_text, &x->a_text.te_pd, 0, 0); glist_add(gl, &x->a_text.te_g); } else { int xpix, ypix; + outlet_new(&x->a_text, + x->a_atom.a_type == A_FLOAT ? &s_float: &s_symbol); + inlet_new(&x->a_text, &x->a_text.te_pd, 0, 0); pd_vmess(&gl->gl_pd, gensym("editmode"), "i", 1); glist_noselect(gl); glist_getnextxy(gl, &xpix, &ypix); @@ -613,6 +804,8 @@ void canvas_symbolatom(t_glist *gl, t_symbol *s, int argc, t_atom *argv) static void gatom_free(t_gatom *x) { + if (*x->a_symfrom->s_name) + pd_bind(&x->a_text.te_pd, x->a_symfrom); gfxstub_deleteforkey(x); } @@ -620,8 +813,11 @@ static void gatom_properties(t_gobj *z, t_glist *owner) { t_gatom *x = (t_gatom *)z; char buf[200]; - sprintf(buf, "pdtk_gatom_dialog %%s %d %g %g\n", - x->a_text.te_width, x->a_draglo, x->a_draghi); + sprintf(buf, "pdtk_gatom_dialog %%s %d %g %g %d %s %s %s\n", + x->a_text.te_width, x->a_draglo, x->a_draghi, + x->a_wherelabel, gatom_escapit(x->a_label)->s_name, + gatom_escapit(x->a_symfrom)->s_name, + gatom_escapit(x->a_symto)->s_name); gfxstub_new(&x->a_text.te_pd, x, buf); } @@ -812,9 +1008,15 @@ static void text_save(t_gobj *z, t_binbuf *b) t_atomtype t = ((t_gatom *)x)->a_atom.a_type; t_symbol *sel = (t == A_SYMBOL ? gensym("symbolatom") : (t == A_FLOAT ? gensym("floatatom") : gensym("intatom"))); - binbuf_addv(b, "ssiiiff", gensym("#X"), sel, + t_symbol *label = gatom_escapit(((t_gatom *)x)->a_label); + t_symbol *symfrom = gatom_escapit(((t_gatom *)x)->a_symfrom); + t_symbol *symto = gatom_escapit(((t_gatom *)x)->a_symto); + binbuf_addv(b, "ssiiifffsss", gensym("#X"), sel, (t_int)x->te_xpix, (t_int)x->te_ypix, (t_int)x->te_width, - (double)((t_gatom *)x)->a_draglo, (double)((t_gatom *)x)->a_draghi); + (double)((t_gatom *)x)->a_draglo, + (double)((t_gatom *)x)->a_draghi, + (double)((t_gatom *)x)->a_wherelabel, + label, symfrom, symto); binbuf_addv(b, ";"); } else @@ -843,11 +1045,11 @@ t_widgetbehavior text_widgetbehavior = static t_widgetbehavior gatom_widgetbehavior = { text_getrect, - text_displace, + gatom_displace, text_select, text_activate, text_delete, - text_vis, + gatom_vis, text_click, text_save, gatom_properties, @@ -950,7 +1152,7 @@ void text_drawborder(t_text *x, t_glist *glist, sys_vgui(".x%x.c coords %sR\ %d %d %d %d %d %d %d %d %d %d %d %d\n", glist_getcanvas(glist), tag, - x1, y1, x2, y1, x2+4, y1+4, x2+4, y2, x1, y2, x1, y1); + x1, y1, x2-4, y1, x2, y1+4, x2, y2, x1, y2, x1, y1); } /* draw inlets/outlets */ @@ -1054,7 +1256,7 @@ void g_text_setup(void) class_addanything(messresponder_class, messresponder_anything); gatom_class = class_new(gensym("gatom"), 0, (t_method)gatom_free, - sizeof(t_gatom), CLASS_PATCHABLE, 0); + sizeof(t_gatom), CLASS_NOINLET | CLASS_PATCHABLE, 0); class_addbang(gatom_class, gatom_bang); class_addfloat(gatom_class, gatom_float); class_addsymbol(gatom_class, gatom_symbol); @@ -1063,7 +1265,7 @@ void g_text_setup(void) class_addmethod(gatom_class, (t_method)gatom_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); class_addmethod(gatom_class, (t_method)gatom_param, gensym("param"), - A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); + A_GIMME, 0); class_setwidget(gatom_class, &gatom_widgetbehavior); } diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c index 6eba64d2..a119e242 100644 --- a/pd/src/g_toggle.c +++ b/pd/src/g_toggle.c @@ -159,13 +159,11 @@ void toggle_draw_select(t_toggle* x, t_glist* glist) if(x->x_gui.x_fsf.x_selected) { - pd_bind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); } else { - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); } @@ -362,22 +360,6 @@ static void toggle_nonzero(t_toggle *x, t_floatarg f) x->x_nonzero = f; } -static void toggle_list(t_toggle *x, t_symbol *s, int ac, t_atom *av) -{ - int l=iemgui_list((void *)x, &x->x_gui, s, ac, av); - - if(l < 0) - { - if(IS_A_FLOAT(av,0)) - toggle_float(x, atom_getfloatarg(0, ac, av)); - } - else if(l > 0) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); - } -} - static void *toggle_new(t_symbol *s, int argc, t_atom *argv) { t_toggle *x = (t_toggle *)pd_new(toggle_class); @@ -480,8 +462,6 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv) static void toggle_ff(t_toggle *x) { - if(x->x_gui.x_fsf.x_selected) - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); gfxstub_deleteforkey(x); @@ -494,7 +474,6 @@ void g_toggle_setup(void) class_addcreator((t_newmethod)toggle_new, gensym("toggle"), A_GIMME, 0); class_addbang(toggle_class, toggle_bang); class_addfloat(toggle_class, toggle_float); - class_addlist(toggle_class, toggle_list); class_addmethod(toggle_class, (t_method)toggle_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); class_addmethod(toggle_class, (t_method)toggle_dialog, gensym("dialog"), @@ -512,8 +491,6 @@ void g_toggle_setup(void) class_addmethod(toggle_class, (t_method)toggle_label_font, gensym("label_font"), A_GIMME, 0); class_addmethod(toggle_class, (t_method)toggle_init, gensym("init"), A_FLOAT, 0); class_addmethod(toggle_class, (t_method)toggle_nonzero, gensym("nonzero"), A_FLOAT, 0); - if(!iemgui_key_sym) - iemgui_key_sym = gensym("#keyname"); toggle_widgetbehavior.w_getrectfn = toggle_getrect; toggle_widgetbehavior.w_displacefn = iemgui_displace; toggle_widgetbehavior.w_selectfn = iemgui_select; diff --git a/pd/src/g_vdial.c b/pd/src/g_vdial.c index 49c8d0d4..e1cd2a5d 100644 --- a/pd/src/g_vdial.c +++ b/pd/src/g_vdial.c @@ -2,7 +2,10 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ -/* vdial.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ +/* vradio.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ + +/* name change to vradio by MSP (it's a radio button really) and changed to +put out a "float" as in sliders, toggles, etc. */ #include <stdlib.h> #include <string.h> @@ -14,7 +17,7 @@ #include "g_all_guis.h" #include <math.h> -/*------------------ global varaibles -------------------------*/ +/*------------------ global variables -------------------------*/ /*------------------ global functions -------------------------*/ @@ -22,14 +25,14 @@ -/* ------------- vdl gui-vertical dial ---------------------- */ +/* ------------- vdl gui-vertical radio button ---------------------- */ -t_widgetbehavior vdial_widgetbehavior; -static t_class *vdial_class; +t_widgetbehavior vradio_widgetbehavior; +static t_class *vradio_class, *vradio_old_class; /* widget helper functions */ -void vdial_draw_update(t_vdial *x, t_glist *glist) +void vradio_draw_update(t_vradio *x, t_glist *glist) { if(glist_isvisible(glist)) { @@ -44,7 +47,7 @@ void vdial_draw_update(t_vdial *x, t_glist *glist) } } -void vdial_draw_new(t_vdial *x, t_glist *glist) +void vradio_draw_new(t_vradio *x, t_glist *glist) { t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i, dy=x->x_gui.x_h, s4=dy/4; @@ -82,7 +85,7 @@ void vdial_draw_new(t_vdial *x, t_glist *glist) canvas, xx11, yy11b, xx11 + IOWIDTH, yy11b+1, x, 0); } -void vdial_draw_move(t_vdial *x, t_glist *glist) +void vradio_draw_move(t_vradio *x, t_glist *glist) { t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i, dy=x->x_gui.x_h, s4=dy/4; @@ -113,7 +116,7 @@ void vdial_draw_move(t_vdial *x, t_glist *glist) canvas, x, 0, xx11, yy11b, xx11 + IOWIDTH, yy11b+1); } -void vdial_draw_erase(t_vdial* x, t_glist* glist) +void vradio_draw_erase(t_vradio* x, t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i; @@ -130,7 +133,7 @@ void vdial_draw_erase(t_vdial* x, t_glist* glist) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); } -void vdial_draw_config(t_vdial* x, t_glist* glist) +void vradio_draw_config(t_vradio* x, t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i; @@ -149,7 +152,7 @@ void vdial_draw_config(t_vdial* x, t_glist* glist) } } -void vdial_draw_io(t_vdial* x, t_glist* glist, int old_snd_rcv_flags) +void vradio_draw_io(t_vradio* x, t_glist* glist, int old_snd_rcv_flags) { t_canvas *canvas=glist_getcanvas(glist); int xpos=text_xpix(&x->x_gui.x_obj, glist); @@ -172,14 +175,13 @@ void vdial_draw_io(t_vdial* x, t_glist* glist, int old_snd_rcv_flags) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); } -void vdial_draw_select(t_vdial* x, t_glist* glist) +void vradio_draw_select(t_vradio* x, t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i; if(x->x_gui.x_fsf.x_selected) { - pd_bind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); for(i=0; i<n; i++) { sys_vgui(".x%x.c itemconfigure %xBASE%d -outline #%6.6x\n", canvas, x, i, @@ -189,7 +191,6 @@ void vdial_draw_select(t_vdial* x, t_glist* glist) } else { - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); for(i=0; i<n; i++) { sys_vgui(".x%x.c itemconfigure %xBASE%d -outline #%6.6x\n", canvas, x, i, @@ -200,29 +201,29 @@ void vdial_draw_select(t_vdial* x, t_glist* glist) } } -void vdial_draw(t_vdial *x, t_glist *glist, int mode) +void vradio_draw(t_vradio *x, t_glist *glist, int mode) { if(mode == IEM_GUI_DRAW_MODE_UPDATE) - vdial_draw_update(x, glist); + vradio_draw_update(x, glist); else if(mode == IEM_GUI_DRAW_MODE_MOVE) - vdial_draw_move(x, glist); + vradio_draw_move(x, glist); else if(mode == IEM_GUI_DRAW_MODE_NEW) - vdial_draw_new(x, glist); + vradio_draw_new(x, glist); else if(mode == IEM_GUI_DRAW_MODE_SELECT) - vdial_draw_select(x, glist); + vradio_draw_select(x, glist); else if(mode == IEM_GUI_DRAW_MODE_ERASE) - vdial_draw_erase(x, glist); + vradio_draw_erase(x, glist); else if(mode == IEM_GUI_DRAW_MODE_CONFIG) - vdial_draw_config(x, glist); + vradio_draw_config(x, glist); else if(mode >= IEM_GUI_DRAW_MODE_IO) - vdial_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO); + vradio_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO); } /* ------------------------ vdl widgetbehaviour----------------------------- */ -static void vdial_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) +static void vradio_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) { - t_vdial *x = (t_vdial *)z; + t_vradio *x = (t_vradio *)z; *xp1 = text_xpix(&x->x_gui.x_obj, glist); *yp1 = text_ypix(&x->x_gui.x_obj, glist); @@ -230,9 +231,9 @@ static void vdial_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp *yp2 = *yp1 + x->x_gui.x_h*x->x_number; } -static void vdial_save(t_gobj *z, t_binbuf *b) +static void vradio_save(t_gobj *z, t_binbuf *b) { - t_vdial *x = (t_vdial *)z; + t_vradio *x = (t_vradio *)z; int bflcol[3], *ip1, *ip2; t_symbol *srl[3]; @@ -242,7 +243,9 @@ static void vdial_save(t_gobj *z, t_binbuf *b) binbuf_addv(b, "ssiisiiiisssiiiiiiii", gensym("#X"),gensym("obj"), (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix, - gensym("vdl"), x->x_gui.x_w, + (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class ? + gensym("vdl") : gensym("vradio")), + x->x_gui.x_w, x->x_change, (*ip1)&IEM_INIT_ARGS_ALL, x->x_number, srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, @@ -251,14 +254,14 @@ static void vdial_save(t_gobj *z, t_binbuf *b) binbuf_addv(b, ";"); } -static void vdial_properties(t_gobj *z, t_glist *owner) +static void vradio_properties(t_gobj *z, t_glist *owner) { - t_vdial *x = (t_vdial *)z; + t_vradio *x = (t_vradio *)z; char buf[800]; t_symbol *srl[3]; iemgui_properties(&x->x_gui, srl); - sprintf(buf, "pdtk_iemgui_dialog %%s VDIAL \ + sprintf(buf, "pdtk_iemgui_dialog %%s vradio \ ----------dimensions(pix):----------- %d %d size: 0 0 empty \ empty 0.0 empty 0.0 empty %d \ %d new-only new&old %d %d number: %d \ @@ -276,7 +279,7 @@ static void vdial_properties(t_gobj *z, t_glist *owner) gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); } -static void vdial_dialog(t_vdial *x, t_symbol *s, int argc, t_atom *argv) +static void vradio_dialog(t_vradio *x, t_symbol *s, int argc, t_atom *argv) { t_symbol *srl[3]; int a = (int)atom_getintarg(0, argc, argv); @@ -309,7 +312,7 @@ static void vdial_dialog(t_vdial *x, t_symbol *s, int argc, t_atom *argv) } } -static void vdial_set(t_vdial *x, t_floatarg f) +static void vradio_set(t_vradio *x, t_floatarg f) { int i=(int)f; int old; @@ -333,25 +336,30 @@ static void vdial_set(t_vdial *x, t_floatarg f) } } -static void vdial_bang(t_vdial *x) +static void vradio_bang(t_vradio *x) { - if((x->x_change)&&(x->x_on != x->x_on_old)) + /* compatibility with earlier "vdial" behavior */ + if (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class) { - SETFLOAT(x->x_at, (float)x->x_on_old); - SETFLOAT(x->x_at+1, 0.0); + if((x->x_change)&&(x->x_on != x->x_on_old)) + { + SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at+1, 0.0); + outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); + if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) + pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); + } + x->x_on_old = x->x_on; + SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } - x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (float)x->x_on); - SETFLOAT(x->x_at+1, 1.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); + else outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); } -static void vdial_fout(t_vdial *x, t_floatarg f) +static void vradio_fout(t_vradio *x, t_floatarg f) { int i=(int)f; @@ -360,27 +368,37 @@ static void vdial_fout(t_vdial *x, t_floatarg f) if(i >= x->x_number) i = x->x_number-1; - if((x->x_change)&&(i != x->x_on_old)) + if (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class) { - SETFLOAT(x->x_at, (float)x->x_on_old); - SETFLOAT(x->x_at+1, 0.0); + /* compatibility with earlier "vdial" behavior */ + if((x->x_change)&&(i != x->x_on_old)) + { + SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at+1, 0.0); + outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); + if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) + pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); + } + if(x->x_on != x->x_on_old) + x->x_on_old = x->x_on; + x->x_on = i; + (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); + x->x_on_old = x->x_on; + SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } - if(x->x_on != x->x_on_old) + else + { + outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on = i); + (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); x->x_on_old = x->x_on; - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (float)x->x_on); - SETFLOAT(x->x_at+1, 1.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); + } } -static void vdial_float(t_vdial *x, t_floatarg f) +static void vradio_float(t_vradio *x, t_floatarg f) { int i=(int)f; @@ -389,54 +407,72 @@ static void vdial_float(t_vdial *x, t_floatarg f) if(i >= x->x_number) i = x->x_number-1; - if((x->x_change)&&(i != x->x_on_old)) + if (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class) { + /* compatibility with earlier "vdial" behavior */ + if((x->x_change)&&(i != x->x_on_old)) + { + if(x->x_gui.x_fsf.x_put_in2out) + { + SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at+1, 0.0); + outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); + if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) + pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); + } + } + if(x->x_on != x->x_on_old) + x->x_on_old = x->x_on; + x->x_on = i; + (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); + x->x_on_old = x->x_on; if(x->x_gui.x_fsf.x_put_in2out) { - SETFLOAT(x->x_at, (float)x->x_on_old); - SETFLOAT(x->x_at+1, 0.0); + SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } } - if(x->x_on != x->x_on_old) - x->x_on_old = x->x_on; - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - x->x_on_old = x->x_on; - if(x->x_gui.x_fsf.x_put_in2out) + else { - SETFLOAT(x->x_at, (float)x->x_on); - SETFLOAT(x->x_at+1, 1.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); + x->x_on = i; + if (x->x_gui.x_fsf.x_put_in2out) + { + outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); + if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) + pd_float(x->x_gui.x_snd->s_thing, x->x_on); + } + (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); + x->x_on_old = x->x_on; } } -static void vdial_click(t_vdial *x, t_floatarg xpos, t_floatarg ypos, +static void vradio_click(t_vradio *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { int yy = (int)ypos - text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist); - vdial_fout(x, (float)(yy / x->x_gui.x_h)); + vradio_fout(x, (float)(yy / x->x_gui.x_h)); } -static int vdial_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) +static int vradio_newclick(t_gobj *z, struct _glist *glist, + int xpix, int ypix, int shift, int alt, int dbl, int doit) { if(doit) - vdial_click((t_vdial *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); + vradio_click((t_vradio *)z, (t_floatarg)xpix, (t_floatarg)ypix, + (t_floatarg)shift, 0, (t_floatarg)alt); return (1); } -static void vdial_loadbang(t_vdial *x) +static void vradio_loadbang(t_vradio *x) { if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) - vdial_bang(x); + vradio_bang(x); } -static void vdial_number(t_vdial *x, t_floatarg num) +static void vradio_number(t_vradio *x, t_floatarg num) { int n=(int)num; @@ -455,67 +491,51 @@ static void vdial_number(t_vdial *x, t_floatarg num) } } -static void vdial_size(t_vdial *x, t_symbol *s, int ac, t_atom *av) +static void vradio_size(t_vradio *x, t_symbol *s, int ac, t_atom *av) { x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); x->x_gui.x_h = x->x_gui.x_w; iemgui_size((void *)x, &x->x_gui); } -static void vdial_delta(t_vdial *x, t_symbol *s, int ac, t_atom *av) +static void vradio_delta(t_vradio *x, t_symbol *s, int ac, t_atom *av) {iemgui_delta((void *)x, &x->x_gui, s, ac, av);} -static void vdial_pos(t_vdial *x, t_symbol *s, int ac, t_atom *av) +static void vradio_pos(t_vradio *x, t_symbol *s, int ac, t_atom *av) {iemgui_pos((void *)x, &x->x_gui, s, ac, av);} -static void vdial_color(t_vdial *x, t_symbol *s, int ac, t_atom *av) +static void vradio_color(t_vradio *x, t_symbol *s, int ac, t_atom *av) {iemgui_color((void *)x, &x->x_gui, s, ac, av);} -static void vdial_send(t_vdial *x, t_symbol *s) +static void vradio_send(t_vradio *x, t_symbol *s) {iemgui_send(x, &x->x_gui, s);} -static void vdial_receive(t_vdial *x, t_symbol *s) +static void vradio_receive(t_vradio *x, t_symbol *s) {iemgui_receive(x, &x->x_gui, s);} -static void vdial_label(t_vdial *x, t_symbol *s) +static void vradio_label(t_vradio *x, t_symbol *s) {iemgui_label((void *)x, &x->x_gui, s);} -static void vdial_label_pos(t_vdial *x, t_symbol *s, int ac, t_atom *av) +static void vradio_label_pos(t_vradio *x, t_symbol *s, int ac, t_atom *av) {iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);} -static void vdial_label_font(t_vdial *x, t_symbol *s, int ac, t_atom *av) +static void vradio_label_font(t_vradio *x, t_symbol *s, int ac, t_atom *av) {iemgui_label_font((void *)x, &x->x_gui, s, ac, av);} -static void vdial_init(t_vdial *x, t_floatarg f) +static void vradio_init(t_vradio *x, t_floatarg f) { x->x_gui.x_isa.x_loadinit = (f==0.0)?0:1; } -static void vdial_double_change(t_vdial *x) +static void vradio_double_change(t_vradio *x) {x->x_change = 1;} -static void vdial_single_change(t_vdial *x) +static void vradio_single_change(t_vradio *x) {x->x_change = 0;} -static void vdial_list(t_vdial *x, t_symbol *s, int ac, t_atom *av) +static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old) { - int l=iemgui_list((void *)x, &x->x_gui, s, ac, av); - - if(l < 0) - { - if(IS_A_FLOAT(av,0)) - vdial_float(x, atom_getfloatarg(0, ac, av)); - } - else if(l > 0) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); - } -} - -static void *vdial_new(t_symbol *s, int argc, t_atom *argv) -{ - t_vdial *x = (t_vdial *)pd_new(vdial_class); + t_vradio *x = (t_vradio *)pd_new(old? vradio_old_class : vradio_class); int bflcol[]={-262144, -1, -1}; t_symbol *srl[3]; int a=IEM_GUI_DEFAULTSIZE, on=0, f=0; @@ -526,6 +546,7 @@ static void *vdial_new(t_symbol *s, int argc, t_atom *argv) t_iem_fstyle_flags *fstyle=(t_iem_fstyle_flags *)(&ifstyle); char str[144]; + /* post("new %s %d", s->s_name, old); */ srl[0] = gensym("empty"); srl[1] = gensym("empty"); srl[2] = gensym("empty"); @@ -573,7 +594,7 @@ static void *vdial_new(t_symbol *s, int argc, t_atom *argv) bflcol[2] = (int)atom_getintarg(13, argc, argv); on = (int)atom_getintarg(14, argc, argv); } - x->x_gui.x_draw = (t_iemfunptr)vdial_draw; + x->x_gui.x_draw = (t_iemfunptr)vradio_draw; iinit &= IEM_INIT_ARGS_ALL; ifstyle &= IEM_FSTYLE_FLAGS_ALL; fstyle->x_snd_able = 1; @@ -621,52 +642,99 @@ static void *vdial_new(t_symbol *s, int argc, t_atom *argv) return (x); } -static void vdial_ff(t_vdial *x) +static void *vradio_new(t_symbol *s, int argc, t_atom *argv) +{ + return (vradio_donew(s, argc, argv, 0)); +} + +static void *vdial_new(t_symbol *s, int argc, t_atom *argv) +{ + return (vradio_donew(s, argc, argv, 1)); +} + +static void vradio_ff(t_vradio *x) { - if(x->x_gui.x_fsf.x_selected) - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); gfxstub_deleteforkey(x); } -void g_vdial_setup(void) +void g_vradio_setup(void) { - vdial_class = class_new(gensym("vdl"), (t_newmethod)vdial_new, - (t_method)vdial_ff, sizeof(t_vdial), 0, A_GIMME, 0); - class_addbang(vdial_class, vdial_bang); - class_addfloat(vdial_class, vdial_float); - class_addlist(vdial_class, vdial_list); - class_addmethod(vdial_class, (t_method)vdial_click, gensym("click"), + vradio_class = class_new(gensym("vradio"), (t_newmethod)vradio_new, + (t_method)vradio_ff, sizeof(t_vradio), 0, A_GIMME, 0); + class_addbang(vradio_class, vradio_bang); + class_addfloat(vradio_class, vradio_float); + class_addmethod(vradio_class, (t_method)vradio_click, gensym("click"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_addmethod(vradio_class, (t_method)vradio_dialog, gensym("dialog"), + A_GIMME, 0); + class_addmethod(vradio_class, (t_method)vradio_loadbang, + gensym("loadbang"), 0); + class_addmethod(vradio_class, (t_method)vradio_set, + gensym("set"), A_FLOAT, 0); + class_addmethod(vradio_class, (t_method)vradio_size, + gensym("size"), A_GIMME, 0); + class_addmethod(vradio_class, (t_method)vradio_delta, + gensym("delta"), A_GIMME, 0); + class_addmethod(vradio_class, (t_method)vradio_pos, + gensym("pos"), A_GIMME, 0); + class_addmethod(vradio_class, (t_method)vradio_color, + gensym("color"), A_GIMME, 0); + class_addmethod(vradio_class, (t_method)vradio_send, + gensym("send"), A_DEFSYM, 0); + class_addmethod(vradio_class, (t_method)vradio_receive, + gensym("receive"), A_DEFSYM, 0); + class_addmethod(vradio_class, (t_method)vradio_label, + gensym("label"), A_DEFSYM, 0); + class_addmethod(vradio_class, (t_method)vradio_label_pos, + gensym("label_pos"), A_GIMME, 0); + class_addmethod(vradio_class, (t_method)vradio_label_font, + gensym("label_font"), A_GIMME, 0); + class_addmethod(vradio_class, (t_method)vradio_init, + gensym("init"), A_FLOAT, 0); + class_addmethod(vradio_class, (t_method)vradio_number, + gensym("number"), A_FLOAT, 0); + class_addmethod(vradio_class, (t_method)vradio_single_change, + gensym("single_change"), 0); + class_addmethod(vradio_class, (t_method)vradio_double_change, + gensym("double_change"), 0); + vradio_widgetbehavior.w_getrectfn = vradio_getrect; + vradio_widgetbehavior.w_displacefn = iemgui_displace; + vradio_widgetbehavior.w_selectfn = iemgui_select; + vradio_widgetbehavior.w_activatefn = NULL; + vradio_widgetbehavior.w_deletefn = iemgui_delete; + vradio_widgetbehavior.w_visfn = iemgui_vis; + vradio_widgetbehavior.w_clickfn = vradio_newclick; + vradio_widgetbehavior.w_propertiesfn = vradio_properties; + vradio_widgetbehavior.w_savefn = vradio_save; + class_setwidget(vradio_class, &vradio_widgetbehavior); + class_sethelpsymbol(vradio_class, gensym("vradio")); + + /* obsolete version (0.34-0.35) */ + vradio_old_class = class_new(gensym("vdl"), (t_newmethod)vdial_new, + (t_method)vradio_ff, sizeof(t_vradio), 0, A_GIMME, 0); + class_addbang(vradio_old_class, vradio_bang); + class_addfloat(vradio_old_class, vradio_float); + class_addmethod(vradio_old_class, (t_method)vradio_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(vdial_class, (t_method)vdial_dialog, gensym("dialog"), + class_addmethod(vradio_old_class, (t_method)vradio_dialog, gensym("dialog"), A_GIMME, 0); - class_addmethod(vdial_class, (t_method)vdial_loadbang, gensym("loadbang"), 0); - class_addmethod(vdial_class, (t_method)vdial_set, gensym("set"), A_FLOAT, 0); - class_addmethod(vdial_class, (t_method)vdial_size, gensym("size"), A_GIMME, 0); - class_addmethod(vdial_class, (t_method)vdial_delta, gensym("delta"), A_GIMME, 0); - class_addmethod(vdial_class, (t_method)vdial_pos, gensym("pos"), A_GIMME, 0); - class_addmethod(vdial_class, (t_method)vdial_color, gensym("color"), A_GIMME, 0); - class_addmethod(vdial_class, (t_method)vdial_send, gensym("send"), A_DEFSYM, 0); - class_addmethod(vdial_class, (t_method)vdial_receive, gensym("receive"), A_DEFSYM, 0); - class_addmethod(vdial_class, (t_method)vdial_label, gensym("label"), A_DEFSYM, 0); - class_addmethod(vdial_class, (t_method)vdial_label_pos, gensym("label_pos"), A_GIMME, 0); - class_addmethod(vdial_class, (t_method)vdial_label_font, gensym("label_font"), A_GIMME, 0); - class_addmethod(vdial_class, (t_method)vdial_init, gensym("init"), A_FLOAT, 0); - class_addmethod(vdial_class, (t_method)vdial_number, gensym("number"), A_FLOAT, 0); - class_addmethod(vdial_class, (t_method)vdial_single_change, gensym("single_change"), 0); - class_addmethod(vdial_class, (t_method)vdial_double_change, gensym("double_change"), 0); - if(!iemgui_key_sym) - iemgui_key_sym = gensym("#keyname"); - vdial_widgetbehavior.w_getrectfn = vdial_getrect; - vdial_widgetbehavior.w_displacefn = iemgui_displace; - vdial_widgetbehavior.w_selectfn = iemgui_select; - vdial_widgetbehavior.w_activatefn = NULL; - vdial_widgetbehavior.w_deletefn = iemgui_delete; - vdial_widgetbehavior.w_visfn = iemgui_vis; - vdial_widgetbehavior.w_clickfn = vdial_newclick; - vdial_widgetbehavior.w_propertiesfn = vdial_properties; - vdial_widgetbehavior.w_savefn = vdial_save; - class_setwidget(vdial_class, &vdial_widgetbehavior); - class_sethelpsymbol(vdial_class, gensym("vdial")); + class_addmethod(vradio_old_class, (t_method)vradio_loadbang, gensym("loadbang"), 0); + class_addmethod(vradio_old_class, (t_method)vradio_set, gensym("set"), A_FLOAT, 0); + class_addmethod(vradio_old_class, (t_method)vradio_size, gensym("size"), A_GIMME, 0); + class_addmethod(vradio_old_class, (t_method)vradio_delta, gensym("delta"), A_GIMME, 0); + class_addmethod(vradio_old_class, (t_method)vradio_pos, gensym("pos"), A_GIMME, 0); + class_addmethod(vradio_old_class, (t_method)vradio_color, gensym("color"), A_GIMME, 0); + class_addmethod(vradio_old_class, (t_method)vradio_send, gensym("send"), A_DEFSYM, 0); + class_addmethod(vradio_old_class, (t_method)vradio_receive, gensym("receive"), A_DEFSYM, 0); + class_addmethod(vradio_old_class, (t_method)vradio_label, gensym("label"), A_DEFSYM, 0); + class_addmethod(vradio_old_class, (t_method)vradio_label_pos, gensym("label_pos"), A_GIMME, 0); + class_addmethod(vradio_old_class, (t_method)vradio_label_font, gensym("label_font"), A_GIMME, 0); + class_addmethod(vradio_old_class, (t_method)vradio_init, gensym("init"), A_FLOAT, 0); + class_addmethod(vradio_old_class, (t_method)vradio_number, gensym("number"), A_FLOAT, 0); + class_addmethod(vradio_old_class, (t_method)vradio_single_change, gensym("single_change"), 0); + class_addmethod(vradio_old_class, (t_method)vradio_double_change, gensym("double_change"), 0); + class_setwidget(vradio_old_class, &vradio_widgetbehavior); + class_sethelpsymbol(vradio_old_class, gensym("vradio")); } diff --git a/pd/src/g_vslider.c b/pd/src/g_vslider.c index 12cc4213..81960d48 100644 --- a/pd/src/g_vslider.c +++ b/pd/src/g_vslider.c @@ -161,13 +161,11 @@ static void vslider_draw_select(t_vslider *x, t_glist *glist) if(x->x_gui.x_fsf.x_selected) { - pd_bind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); } else { - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); } @@ -381,8 +379,8 @@ static void vslider_click(t_vslider *x, t_floatarg xpos, t_floatarg ypos, x->x_pos = x->x_val; (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); vslider_bang(x); - glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, (t_glistmotionfn)vslider_motion, - 0, xpos, ypos); + glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, + (t_glistmotionfn)vslider_motion, 0, xpos, ypos); } static int vslider_newclick(t_gobj *z, struct _glist *glist, @@ -505,22 +503,6 @@ static void vslider_loadbang(t_vslider *x) } } -static void vslider_list(t_vslider *x, t_symbol *s, int ac, t_atom *av) -{ - int l=iemgui_list((void *)x, &x->x_gui, s, ac, av); - - if(l < 0) - { - if(IS_A_FLOAT(av,0)) - vslider_float(x, atom_getfloatarg(0, ac, av)); - } - else if(l > 0) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); - } -} - static void *vslider_new(t_symbol *s, int argc, t_atom *argv) { t_vslider *x = (t_vslider *)pd_new(vslider_class); @@ -635,8 +617,6 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv) static void vslider_free(t_vslider *x) { - if(x->x_gui.x_fsf.x_selected) - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); gfxstub_deleteforkey(x); @@ -649,7 +629,6 @@ void g_vslider_setup(void) class_addcreator((t_newmethod)vslider_new, gensym("vslider"), A_GIMME, 0); class_addbang(vslider_class,vslider_bang); class_addfloat(vslider_class,vslider_float); - class_addlist(vslider_class, vslider_list); class_addmethod(vslider_class, (t_method)vslider_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); class_addmethod(vslider_class, (t_method)vslider_motion, gensym("motion"), @@ -672,8 +651,6 @@ void g_vslider_setup(void) class_addmethod(vslider_class, (t_method)vslider_lin, gensym("lin"), 0); class_addmethod(vslider_class, (t_method)vslider_init, gensym("init"), A_FLOAT, 0); class_addmethod(vslider_class, (t_method)vslider_steady, gensym("steady"), A_FLOAT, 0); - if(!iemgui_key_sym) - iemgui_key_sym = gensym("#keyname"); vslider_widgetbehavior.w_getrectfn = vslider_getrect; vslider_widgetbehavior.w_displacefn = iemgui_displace; vslider_widgetbehavior.w_selectfn = iemgui_select; diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c index b257c588..95b976dd 100644 --- a/pd/src/g_vumeter.c +++ b/pd/src/g_vumeter.c @@ -330,7 +330,6 @@ static void vu_draw_select(t_vu* x,t_glist* glist) if(x->x_gui.x_fsf.x_selected) { - pd_bind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); for(i=1; i<=IEM_VU_STEPS; i++) { @@ -348,7 +347,6 @@ static void vu_draw_select(t_vu* x,t_glist* glist) } else { - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); for(i=1; i<=IEM_VU_STEPS; i++) { @@ -598,25 +596,6 @@ static void vu_ft1(t_vu *x, t_floatarg peak) vu_update_peak(x, x->x_gui.x_glist); } -static void vu_list(t_vu *x, t_symbol *s, int ac, t_atom *av) -{ - int l=iemgui_list((void *)x, &x->x_gui, s, ac, av); - - if(l < 0) - { - if((IS_A_FLOAT(av,0))&&(IS_A_FLOAT(av,1))) - { - vu_ft1(x, atom_getfloatarg(1, ac, av)); - vu_float(x, atom_getfloatarg(0, ac, av)); - } - } - else if(l > 0) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); - } -} - static void vu_bang(t_vu *x) { outlet_float(x->x_out_peak, x->x_fp); @@ -720,8 +699,6 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv) static void vu_free(t_vu *x) { - if(x->x_gui.x_fsf.x_selected) - pd_unbind(&x->x_gui.x_obj.ob_pd, iemgui_key_sym); if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); gfxstub_deleteforkey(x); @@ -734,7 +711,6 @@ void g_vumeter_setup(void) class_addbang(vu_class,vu_bang); class_addfloat(vu_class,vu_float); class_addmethod(vu_class, (t_method)vu_ft1, gensym("ft1"), A_FLOAT, 0); - class_addlist(vu_class, vu_list); class_addmethod(vu_class, (t_method)vu_dialog, gensym("dialog"), A_GIMME, 0); class_addmethod(vu_class, (t_method)vu_size, gensym("size"), A_GIMME, 0); @@ -746,8 +722,6 @@ void g_vumeter_setup(void) class_addmethod(vu_class, (t_method)vu_label, gensym("label"), A_DEFSYM, 0); class_addmethod(vu_class, (t_method)vu_label_pos, gensym("label_pos"), A_GIMME, 0); class_addmethod(vu_class, (t_method)vu_label_font, gensym("label_font"), A_GIMME, 0); - if(!iemgui_key_sym) - iemgui_key_sym = gensym("#keyname"); vu_widgetbehavior.w_getrectfn = vu_getrect; vu_widgetbehavior.w_displacefn = iemgui_displace; vu_widgetbehavior.w_selectfn = iemgui_select; diff --git a/pd/src/m_binbuf.c b/pd/src/m_binbuf.c index 6ff79e93..1398ad84 100644 --- a/pd/src/m_binbuf.c +++ b/pd/src/m_binbuf.c @@ -43,6 +43,15 @@ void binbuf_free(t_binbuf *x) t_freebytes(x, sizeof(*x)); } +t_binbuf *binbuf_duplicate(t_binbuf *y) +{ + t_binbuf *x = (t_binbuf *)t_getbytes(sizeof(*x)); + x->b_n = y->b_n; + x->b_vec = t_getbytes(x->b_n * sizeof(*x->b_vec)); + memcpy(x->b_vec, y->b_vec, x->b_n * sizeof(*x->b_vec)); + return (x); +} + void binbuf_clear(t_binbuf *x) { x->b_vec = t_resizebytes(x->b_vec, x->b_n * sizeof(*x->b_vec), 0); @@ -729,7 +738,7 @@ int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag) bp += length; ncolumn += length; } - if (ap->a_type == A_SEMI || ncolumn > 65) + if (ap->a_type == A_SEMI || (!crflag && ncolumn > 65)) { *bp++ = '\n'; ncolumn = 0; diff --git a/pd/src/m_conf.c b/pd/src/m_conf.c index 04cddeda..e2ba1689 100644 --- a/pd/src/m_conf.c +++ b/pd/src/m_conf.c @@ -12,12 +12,12 @@ void g_canvas_setup(void); void g_guiconnect_setup(void); /* iemlib */ void g_bang_setup(void); -void g_hdial_setup(void); +void g_hradio_setup(void); void g_hslider_setup(void); void g_mycanvas_setup(void); void g_numbox_setup(void); void g_toggle_setup(void); -void g_vdial_setup(void); +void g_vradio_setup(void); void g_vslider_setup(void); void g_vumeter_setup(void); /* iemlib */ @@ -58,12 +58,12 @@ void conf_init(void) g_guiconnect_setup(); /* iemlib */ g_bang_setup(); - g_hdial_setup(); + g_hradio_setup(); g_hslider_setup(); g_mycanvas_setup(); g_numbox_setup(); g_toggle_setup(); - g_vdial_setup(); + g_vradio_setup(); g_vslider_setup(); g_vumeter_setup(); /* iemlib */ diff --git a/pd/src/m_obj.c b/pd/src/m_obj.c index 6b9ea932..6e3e1c19 100644 --- a/pd/src/m_obj.c +++ b/pd/src/m_obj.c @@ -384,6 +384,12 @@ void outlet_anything(t_outlet *x, t_symbol *s, int argc, t_atom *argv) typedmess(oc->oc_to, s, argc, argv); } + /* get the outlet's declared symbol */ +t_symbol *outlet_getsymbol(t_outlet *x) +{ + return (x->o_sym); +} + void outlet_free(t_outlet *x) { t_object *y = x->o_owner; diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h index 172bf49d..c6ddb0c9 100644 --- a/pd/src/m_pd.h +++ b/pd/src/m_pd.h @@ -26,7 +26,7 @@ extern "C" { /* and depending on the compiler, hidden data structures are declared differently: */ -#ifdef __GNUC__ +#if defined( __GNUC__) || defined( __BORLANDC__ ) #define EXTERN_STRUCT struct #else #define EXTERN_STRUCT extern struct @@ -262,6 +262,7 @@ EXTERN void atom_string(t_atom *a, char *buf, unsigned int bufsize); EXTERN t_binbuf *binbuf_new(void); EXTERN void binbuf_free(t_binbuf *x); +EXTERN t_binbuf *binbuf_duplicate(t_binbuf *y); EXTERN void binbuf_text(t_binbuf *x, char *text, size_t size); EXTERN void binbuf_gettext(t_binbuf *x, char **bufp, int *lengthp); @@ -339,6 +340,7 @@ EXTERN void outlet_float(t_outlet *x, t_float f); EXTERN void outlet_symbol(t_outlet *x, t_symbol *s); EXTERN void outlet_list(t_outlet *x, t_symbol *s, int argc, t_atom *argv); EXTERN void outlet_anything(t_outlet *x, t_symbol *s, int argc, t_atom *argv); +EXTERN t_symbol *outlet_getsymbol(t_outlet *x); EXTERN void outlet_free(t_outlet *x); EXTERN t_object *pd_checkobject(t_pd *x); @@ -580,15 +582,17 @@ EXTERN void c_addmess(t_method fn, t_symbol *sel, t_atomtype arg1, ...); #define typedmess pd_typedmess #define vmess pd_vmess -#ifdef MACOSX -#define cabs() smerdyakov(void) -#endif - /* A definition to help gui objects straddle 0.34-0.35 changes. If this is defined, there is a "te_xpix" field in objects, not a "te_xpos" as before: */ #define PD_USE_TE_XPIX +/* a test for NANs and denormals. Shouldn't be necessary on Mac but can't +test this just now. */ + +#define PD_BADFLOAT(f) ((((*(unsigned int*)&(f))&0x7f800000)==0) || \ + (((*(unsigned int*)&(f))&0x7f800000)==0x7f800000)) + #if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) } #endif diff --git a/pd/src/makefile.in b/pd/src/makefile.in index b7eb1104..f9204e78 100644 --- a/pd/src/makefile.in +++ b/pd/src/makefile.in @@ -12,6 +12,10 @@ GUINAME= @GUINAME@ INSTALL_PREFIX = @prefix@ GFLAGS = -DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\" +# there should be a better way to do this... +prefix = @prefix@ +MANDIR = @mandir@ + # ALSA compilation SOUND_ALSA = @alsa@ @@ -105,7 +109,7 @@ GOBJ = $(GSRC:.c=.o) # ------------------ targets ------------------------------------ # -.PHONY: pd gui externs +.PHONY: pd gui externs all all: $(PDEXEC) $(BIN_DIR)/pd-watchdog $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \ $(BIN_DIR)/pdreceive $(BIN_DIR)/pd.tk externs @@ -164,7 +168,9 @@ externs: cd ../extra/pique;make @EXTERNTARGET@ INSTDIR = $(DESTDIR)/$(INSTALL_PREFIX) -install: +MANINSTDIR = $(DESTDIR)/$(MANDIR) + +install: all install -d $(INSTDIR)/lib/pd/bin install $(BIN_DIR)/$(GUINAME) $(INSTDIR)/lib/pd/bin/$(GUINAME) install $(BIN_DIR)/pd-watchdog $(INSTDIR)/lib/pd/bin/pd-watchdog @@ -179,12 +185,13 @@ install: cp -r ../doc $(INSTDIR)/lib/pd/ install -d $(INSTDIR)/include install -m644 m_pd.h $(INSTDIR)/include/m_pd.h - gzip < ../man/pd.1 > $(INSTDIR)/man/man1/pd.1.gz - chmod 644 $(INSTDIR)/man/man1/pd.1.gz - gzip < ../man/pdsend.1 > $(INSTDIR)/man/man1/pdsend.1.gz - chmod 644 $(INSTDIR)/man/man1/pdsend.1.gz - gzip < ../man/pdreceive.1 > $(INSTDIR)/man/man1/pdreceive.1.gz - chmod 644 $(INSTDIR)/man/man1/pdreceive.1.gz + install -d $(MANINSTDIR)/man1 + gzip < ../man/pd.1 > $(MANINSTDIR)/man1/pd.1.gz + chmod 644 $(MANINSTDIR)/man1/pd.1.gz + gzip < ../man/pdsend.1 > $(MANINSTDIR)/man1/pdsend.1.gz + chmod 644 $(MANINSTDIR)/man1/pdsend.1.gz + gzip < ../man/pdreceive.1 > $(MANINSTDIR)/man1/pdreceive.1.gz + chmod 644 $(MANINSTDIR)/man1/pdreceive.1.gz local-clean: -rm -f ../obj/* $(BIN_DIR)/pd $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \ @@ -219,9 +226,9 @@ uninstall: -rm $(INSTDIR)/bin/pdsend -rm $(INSTDIR)/bin/pdreceive -rm $(INSTDIR)/include/m_pd.h - -rm $(INSTDIR)/man/man1/pd.1.gz - -rm $(INSTDIR)/man/man1/pdsend.1.gz - -rm $(INSTDIR)/man/man1/pdreceive.1.gz + -rm $(MANINSTDIR)/man/man1/pd.1.gz + -rm $(MANINSTDIR)/man/man1/pdsend.1.gz + -rm $(MANINSTDIR)/man/man1/pdreceive.1.gz include makefile.dependencies diff --git a/pd/src/makefile.nt.bad b/pd/src/makefile.nt.bad new file mode 100644 index 00000000..d45b72e0 --- /dev/null +++ b/pd/src/makefile.nt.bad @@ -0,0 +1,92 @@ +# Makefile for portaudio ASIO driver version of PD + +all: pd gui ..\bin\pd.tk + +VC = "C:\Program Files\Microsoft Visual Studio\VC98" +#VC="\Program Files\DevStudio\Vc" +INCLUDE = -I.\ -I..\Tcl\include -I$(VC)\include + +LDIR = $(VC)\lib + +LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel \ + /NODEFAULTLIB:uuid \ + $(LDIR)\libc.lib $(LDIR)\oldnames.lib $(LDIR)\kernel32.lib \ + $(LDIR)\wsock32.lib $(LDIR)\winmm.lib ..\bin\pthreadVC.lib + +GLIB = $(LIB) ..\lib\tcl83.lib ..\lib\tk83.lib +CFLAGS = /nologo /W3 /DNT /DPD /DPD_INTERNAL /DWIN32 /DWINDOWS /Ox +LFLAGS = /nologo + +SYSSRC = s_nt.c s_portaudio.c + +SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \ + g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \ + g_all_guis.c g_bang.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c \ + g_toggle.c g_vdial.c g_vslider.c g_vumeter.c \ + m_pd.c m_class.c m_obj.c m_atom.c m_memory.c m_binbuf.c \ + m_conf.c m_glob.c m_sched.c \ + s_main.c s_inter.c s_unix.c s_file.c s_print.c \ + s_loader.c s_path.c s_entry.c \ + d_ugen.c d_ctl.c d_arithmetic.c d_osc.c d_filter.c d_dac.c d_misc.c \ + d_math.c d_fft.c d_mayer_fft.c d_fftroutine.c d_array.c d_global.c \ + d_delay.c d_resample.c \ + x_arithmetic.c x_connective.c x_interface.c x_midi.c x_misc.c \ + x_time.c x_acoustics.c x_net.c x_qlist.c x_gui.c d_soundfile.c \ + $(SYSSRC) + +SRCPA = pa_lib.c pa_trace.c pablio_pd.c ringbuffer_pd.c +SRCASIO = pa_asio.cpp + +ASIOLIB = $(LDIR)\user32.lib $(LDIR)\gdi32.lib $(LDIR)\winspool.lib $(LDIR)\comdlg32.lib \ +$(LDIR)\advapi32.lib $(LDIR)\shell32.lib $(LDIR)\ole32.lib $(LDIR)\oleaut32.lib $(LDIR)\uuid.lib \ +$(LDIR)\odbc32.lib $(LDIR)\odbccp32.lib ..\lib\asio\asiolib.lib + + +PAOBJ = pa_lib.obj pa_trace.obj pablio_pd.obj ringbuffer_pd.obj pa_asio.obj +OBJC = $(SRC:.c=.obj) $(PAOBJ) + +GSRC = t_main.c t_tkcmd.c + +GOBJ = $(GSRC:.c=.obj) +.PHONY: pd gui + +ALLCF = $(CFLAGS) $(INCLUDE) $(INCASIO) $(INCPA) /D_WINDOWS + +.c.obj: + cl /c $(ALLCF) /Tc$*.c + +pd: ..\bin\pd.exe + +gui: ..\bin\pdtcl.dll + +..\bin\pd.exe: s_entry.obj ..\bin\pd.lib + link $(LFLAGS) /out:..\bin\pd.exe /INCREMENTAL:NO s_entry.obj \ + ..\bin\pd.lib $(LIB) $(ASIOLIB) + +..\bin\pd.dll ..\bin\pd.lib: $(OBJC) $(OBJASIO) + link $(LFLAGS) /dll /export:sys_main /out:..\bin\pd.dll $(OBJC) \ + $(OBJASIO) $(LIB) $(ASIOLIB) + +..\bin\pdtcl.dll: t_tkcmd.obj + link $(LFLAGS) /dll /export:Pdtcl_Init /out:..\bin\pdtcl.dll \ + t_tkcmd.obj $(GLIB) + +..\bin\pd.tk: u_main.tk; copy u_main.tk ..\bin\pd.tk + +# explicit rules to compile portaudio sources: +pa_lib.obj: pa_lib.c + cl /c $(ALLCF) pa_lib.c +pa_trace.obj: pa_trace.c + cl /c $(ALLCF) pa_trace.c +pablio_pd.obj: pablio_pd.c + cl /c $(ALLCF) pablio_pd.c +ringbuffer_pd.obj: ringbuffer_pd.c + cl /c $(ALLCF) ringbuffer_pd.c +pa_asio.obj: pa_asio.cpp + cl /c $(ALLCF) pa_asio.cpp + +# the following should also clean up "bin" but it doesn't because "bin" holds +# precious stuff from elsewhere. +clean: + del *.obj + diff --git a/pd/src/notes.txt b/pd/src/notes.txt index 6a01dd0b..03a8728f 100644 --- a/pd/src/notes.txt +++ b/pd/src/notes.txt @@ -1,18 +1,34 @@ ----------------- dolist -------------------- -++portno wierdness in gcc 3 worked around (Burton) -non-power-of-2 channel counts in ASIO (Olaf Matthes) -Bug, David McCallum, Jul. 13 -- find last error crashes +done for 0.35: +bug fix: flipping canvases +bug fix: canvas coordinates saved correctly +signal lines fatter than control ones +number box labels, send&receive +rework [vh]dial +'make install' depending on Pd, etc +undo +fix symbol binding GUI problem +new expr object +test on p4s +undo paste and duplicate +fix flipped window resizing to move comments +---------------- dolist -------------------- +pddp doc -last-minute bug fixes: -add flag to select MIDI open to use select()? -check top-of-window problem in OSX -denormal protection +scheduler to do DSP computations even if no audio +hook to scheduler to let others get called for DSP I/O +figure out how to avoid "dac freeze" if nosound -doc: -fix readme file and recopy to web page (add to README in dist instructions) +try again to fix the font scene +look at zeros to IIR filters +compile pdsend, pdreceive for windows and document somehow +addcomma message to message +pasting should look at current mouse location problems: +number boxes should ignore non-numeric characters +messages & comments don't come up with text activated? +arrays of non-existent templates crash don't draw in/outlets on gui objects in graphs Alsa degradation after several hours running on soundblaster font size should depend on subpatch/abstraction @@ -22,9 +38,6 @@ missed Thomas's multi-dialog trick??? fix iemguis not to bash symbol names check what happens when going back and forth between graph-on-parent deal with spaces in iemgui labels and send/receive names -David McCallum, table crashes in 98? -font hack (pix@test.at, 30 Nov 2001 - perl -pi -e 's/-[*%a-z0-9-]*\*[*%a-z0-9-]*/fixed/' u_main.tk get rid of messages causing renaming; try to prevent patches closing themselves. Krzysztof's qlist_next reentrancy bug dac~/ adc~/ block~ incompatibility @@ -35,6 +48,7 @@ rfft~ loses nyquist bin -- see "to hell with it" comment in d_fft.c soundfile writing gets wrong sample rate; see /* lie */ in d_soundfile.c data: +doesn't redraw when changing draw commands? vget, vset traversal objects cursor to show (x, y) location better hit detection (getrect is too greedy) @@ -48,6 +62,7 @@ scalar hook to catch the mouse protect against "plots" going away while you drag on them features: +signal inlets with initialized values... Pd to open html help on windows/mac flag to hide array names ??? have a way to disambiguate externs from different libs??? @@ -56,7 +71,6 @@ if there's just one array, don't do stringent hit check. netsend separate thread netreceive (and netsend?) message to set port number delete-in-rectangle message to Pds -pasting should look at current mouse location "regular" numbers/symbols to do send/receive thing ala IEMGUI make selecting text grab keyboard focus think about x and y scale preservation when changing between graph and object @@ -112,6 +126,8 @@ pique~ and fiddle~ unification (notice pique filtering is different!) new message box look figure out what to do when "pd sym" conflicts with window title as in Pluton? +MAX compatibilty: +trigger 1 (on Pd, outputs 0; on Max?) LATER Hammerfall adapt to ALSA diff --git a/pd/src/s_linux.c b/pd/src/s_linux.c index 5c394674..54cdb978 100644 --- a/pd/src/s_linux.c +++ b/pd/src/s_linux.c @@ -2685,7 +2685,7 @@ void alsa_resync( void) } memset(alsa_buf, 0, sizeof(char) * alsa_samplewidth * DACBLKSIZE * linux_outchannels); - for (i = 0; i < 100; i++) + for (i = 0; i < 1000000; i++) { result = snd_pcm_writei(alsa_device.outhandle, alsa_buf, DACBLKSIZE); diff --git a/pd/src/s_mac.c b/pd/src/s_mac.c index a36f192a..9d3c1543 100644 --- a/pd/src/s_mac.c +++ b/pd/src/s_mac.c @@ -303,16 +303,37 @@ void sys_poll_midi(void) } } +#if defined(_POSIX_PRIORITY_SCHEDULING) || defined(_POSIX_MEMLOCK) +#include <sched.h> +#endif + void sys_set_priority(int higher) { +#ifdef _POSIX_PRIORITY_SCHEDULING + struct sched_param par; + int p1 ,p2, p3; + p1 = sched_get_priority_min(SCHED_FIFO); + p2 = sched_get_priority_max(SCHED_FIFO); + p3 = (higher ? p2 - 1 : p2 - 3); + par.sched_priority = p3; + if (sched_setscheduler(0,SCHED_FIFO,&par) != -1) + fprintf(stderr, "priority %d scheduling enabled.\n", p3); +#else /* no priority scheduling, so renice and wish for something better */ int retval; errno = 0; retval = setpriority(PRIO_PROCESS, 0, (higher? -20 : -19)); if (retval == -1 & errno != 0) { perror("setpriority"); - fprintf(stderr, "priority bost faled.\n"); + fprintf(stderr, "priority boost faled.\n"); } +#endif + +#ifdef _POSIX_MEMLOCK + if (mlockall(MCL_FUTURE) != -1) + fprintf(stderr, "memory locking enabled.\n"); +#endif + } void sys_listdevs(void ) diff --git a/pd/src/s_main.c b/pd/src/s_main.c index 3c0f4164..cb08960a 100644 --- a/pd/src/s_main.c +++ b/pd/src/s_main.c @@ -7,7 +7,7 @@ * 1311:forum::für::umläute:2001 */ -char pd_version[] = "Pd version 0.35\n"; +char pd_version[] = "Pd version 0.36 PRELIMINARY TEST 5\n"; char pd_compiletime[] = __TIME__; char pd_compiledate[] = __DATE__; diff --git a/pd/src/s_unix.c b/pd/src/s_unix.c index ee0ce160..85282f3b 100644 --- a/pd/src/s_unix.c +++ b/pd/src/s_unix.c @@ -412,15 +412,24 @@ void sys_pollmidiinqueue( void) comes in, as a result of our calling sys_poll_midi. We stick it on a timetag queue and dispatch it at the appropriate logical time. */ + void sys_midibytein(int portno, int byte) { + static int warned = 0; t_midiqelem *midiqelem; int newhead = midi_inhead +1; if (newhead == MIDIQSIZE) newhead = 0; /* if FIFO is full flush an element to make room */ if (newhead == midi_intail) - post("flush"), sys_dispatchnextmidiin(); + { + if (!warned) + { + post("warning: MIDI timing FIFO overflowed"); + warned = 1; + } + sys_dispatchnextmidiin(); + } midi_inqueue[midi_inhead].q_portno = portno; midi_inqueue[midi_inhead].q_onebyte = 1; midi_inqueue[midi_inhead].q_byte1 = byte; diff --git a/pd/src/t_tkcmd.c b/pd/src/t_tkcmd.c index c2abd846..3415691b 100644 --- a/pd/src/t_tkcmd.c +++ b/pd/src/t_tkcmd.c @@ -349,7 +349,7 @@ void pdgui_setname(char *s) int Pdtcl_Init(Tcl_Interp *interp) { - char *myvalue = Tcl_GetVar(interp, "argv", 0); + const char *myvalue = Tcl_GetVar(interp, "argv", 0); int myportno; if (myvalue && (myportno = atoi(myvalue)) > 1) pdgui_setsock(myportno); diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk index a19b0951..da17b720 100644 --- a/pd/src/u_main.tk +++ b/pd/src/u_main.tk @@ -12,10 +12,6 @@ set pd_nt 0 # a new dialogbox was inserted, named: # "pdtk_iemgui_dialog -- dialog window for iem guis" # -# there are 2 new features: 1.) line-delete-protection in edit-menue -# -# 2.) there are all iem-guis in a seperated put-gui-menue -# # all this changes are labeled with #######iemlib########## if {$pd_nt == 1} { @@ -108,10 +104,9 @@ set untitled_number 1 set untitled_directory [pwd] set saveas_client doggy set pd_opendir $untitled_directory -############iemlib################## -# need it to know, if new or open file -set iem_new_open_flag "open" -############iemlib################## +set pd_undoaction no +set pd_redoaction no +set pd_undocanvas no ################ utility functions ######################### @@ -152,11 +147,6 @@ proc pdtk_fixwindowmenu {} { proc menu_new {} { global untitled_number global untitled_directory -############iemlib################## - global iem_new_open_flag - - set iem_new_open_flag "new" -############iemlib################## pd [concat pd filename Untitled-$untitled_number $untitled_directory \;] pd { #N canvas; @@ -170,11 +160,6 @@ proc menu_new {} { proc menu_open {} { global pd_opendir global pd_nt -############iemlib################## - global iem_new_open_flag - - set iem_new_open_flag "open" -############iemlib################## # workaround -- initialdir doesn't work on MACOSX yet --- if {$pd_nt == 2} { @@ -258,11 +243,6 @@ set help_directory $pd_guidir/doc proc menu_documentation {} { global help_directory global pd_nt -############iemlib################## - global iem_new_open_flag - - set iem_new_open_flag "open" -############iemlib################## if {$pd_nt == 2} { cd $help_directory @@ -301,11 +281,6 @@ proc menu_documentation {} { proc menu_doc_open {subdir basename} { global pd_guidir -############iemlib################## - global iem_new_open_flag - - set iem_new_open_flag "open" -############iemlib################## set dirname $pd_guidir/$subdir @@ -367,6 +342,24 @@ proc menu_close {name} { pd [concat $name menuclose \;] } +proc menu_undo {name} { + global pd_undoaction + global pd_redoaction + global pd_undocanvas + if {$name == $pd_undocanvas && $pd_undoaction != "no"} { + pd [concat $name undo \;] + } +} + +proc menu_redo {name} { + global pd_undoaction + global pd_redoaction + global pd_undocanvas + if {$name == $pd_undocanvas && $pd_redoaction != "no"} { + pd [concat $name redo \;] + } +} + proc menu_cut {name} { pd [concat $name cut \;] } @@ -452,12 +445,12 @@ proc menu_hslider {name accel} { pd [concat $name hslider $accel \;] } -proc menu_hdial {name accel} { - pd [concat $name hdial $accel \;] +proc menu_hradio {name accel} { + pd [concat $name hradio $accel \;] } -proc menu_vdial {name accel} { - pd [concat $name vdial $accel \;] +proc menu_vradio {name accel} { + pd [concat $name vradio $accel \;] } proc menu_vumeter {name accel} { @@ -468,11 +461,38 @@ proc menu_mycnv {name accel} { pd [concat $name mycnv $accel \;] } -proc menu_protectmode {name} { - pd [concat $name protectmode 0 \;] +############iemlib################## + +# correct edit menu, enabling or disabling undo/redo +# LATER also cut/copy/paste +proc menu_fixeditmenu {name} { + global pd_undoaction + global pd_redoaction + global pd_undocanvas +# puts stderr [concat menu_fixeditmenu $name $pd_undocanvas $pd_undoaction] + if {$name == $pd_undocanvas && $pd_undoaction != "no"} { + $name.m.edit.m entryconfigure "Undo*" -state normal \ + -label [concat "Undo " $pd_undoaction] + } else { + $name.m.edit.m entryconfigure "Undo*" -state disabled -label "Undo" + } + if {$name == $pd_undocanvas && $pd_redoaction != "no"} { + $name.m.edit.m entryconfigure "Redo" -state normal + } else { + $name.m.edit.m entryconfigure "Redo" -state disabled + } } -############iemlib################## +# message from Pd to update the currently available undo/redo action +proc pdtk_undomenu {name undoaction redoaction} { + global pd_undoaction + global pd_redoaction + global pd_undocanvas +# puts stderr [concat pdtk_undomenu $name $undoaction $redoaction] + set pd_undocanvas $name + set pd_undoaction $undoaction + set pd_redoaction $redoaction +} proc menu_windowparent {name} { pd [concat $name findparent \;] @@ -557,9 +577,8 @@ proc menu_findobject {canvas} { ############# pdtk_canvas_new -- create a new canvas ############### -proc pdtk_canvas_new {name width height geometry} { +proc pdtk_canvas_new {name width height geometry editable} { global pd_opendir - global iem_new_open_flag toplevel $name frame $name.m -relief raised -bd 2 @@ -580,7 +599,6 @@ proc pdtk_canvas_new {name width height geometry} { pack $name.c -side left -expand 1 -fill both wm minsize $name 1 1 wm geometry $name $geometry - # the file menu menubutton $name.m.file -text File -menu $name.m.file.m @@ -619,8 +637,15 @@ proc pdtk_canvas_new {name width height geometry} { # the edit menu menubutton $name.m.edit -text Edit -menu $name.m.edit.m pack $name.m.edit -side left - menu $name.m.edit.m + menu $name.m.edit.m -postcommand [concat menu_fixeditmenu $name] + $name.m.edit.m add command -label Undo -command [concat menu_undo $name] \ + -accelerator "Ctrl+z" + + $name.m.edit.m add command -label Redo -command [concat menu_redo $name] \ + -accelerator "Ctrl+Z" + + $name.m.edit.m add separator $name.m.edit.m add command -label Cut -command [concat menu_cut $name] \ -accelerator "Ctrl+x" @@ -661,16 +686,8 @@ proc pdtk_canvas_new {name width height geometry} { -command [concat menu_editmode $name] \ -accelerator "Ctrl+e" - - - $name.m.edit.m add checkbutton -label "Protect" \ - -indicatoron true -selectcolor grey85 \ - -command [concat menu_protectmode $name] \ - -accelerator "Ctrl+r" - - if { $iem_new_open_flag == "open" } { + if { $editable == 0 } { $name.m.edit.m entryconfigure "Edit mode" -indicatoron false } - $name.m.edit.m entryconfigure "Protect" -indicatoron false ############iemlib################## @@ -721,12 +738,12 @@ proc pdtk_canvas_new {name width height geometry} { -command [concat menu_hslider $name 0] \ -accelerator "Alt+h" - $name.m.put.m add command -label Vdial \ - -command [concat menu_vdial $name 0] \ + $name.m.put.m add command -label Vradio \ + -command [concat menu_vradio $name 0] \ -accelerator "Alt+d" - $name.m.put.m add command -label Hdial \ - -command [concat menu_hdial $name 0] \ + $name.m.put.m add command -label Hradio \ + -command [concat menu_hradio $name 0] \ -accelerator "Alt+i" $name.m.put.m add command -label VU \ @@ -824,7 +841,8 @@ proc pdtk_canvas_new {name width height geometry} { bind $name.c <Control-Shift-Key> {pdtk_canvas_ctrlkey %W %K 1} bind $name.c <Alt-Key> {pdtk_canvas_altkey %W %K %A} # bind $name.c <Mod1-Key> {puts stderr [concat mod1 %W %K %A]} - bind $name.c <Key> {pdtk_canvas_key %W %K %A} + bind $name.c <Key> {pdtk_canvas_key %W %K %A 0} + bind $name.c <Shift-Key> {pdtk_canvas_key %W %K %A 1} bind $name.c <KeyRelease> {pdtk_canvas_keyup %W %K %A} bind $name.c <Motion> {pdtk_canvas_motion %W %x %y 0} bind $name.c <Alt-Motion> {pdtk_canvas_motion %W %x %y 4} @@ -937,7 +955,7 @@ proc pdtk_canvas_mouseup {name x y b} { pdtk_canvas_checkgeometry [canvastosym $name] } -proc pdtk_canvas_key {name key iso} { +proc pdtk_canvas_key {name key iso shift} { # puts stderr [concat down key= $key iso= $iso] # .controls.switches.meterbutton configure -text $key # HACK for MAC OSX -- backspace seems different; I don't understand why. @@ -955,9 +973,9 @@ proc pdtk_canvas_key {name key iso} { } if {$iso != ""} { scan $iso %c keynum - pd [canvastosym $name] key 1 $keynum \; + pd [canvastosym $name] key 1 $keynum $shift\; } else { - pd [canvastosym $name] key 1 $key \; + pd [canvastosym $name] key 1 $key $shift\; } } @@ -980,8 +998,8 @@ proc pdtk_canvas_altkey {name key iso} { if {$key == "n" || $key == "N"} {menu_numbox $topname 1} if {$key == "v" || $key == "V"} {menu_vslider $topname 1} if {$key == "h" || $key == "H"} {menu_hslider $topname 1} - if {$key == "i" || $key == "I"} {menu_hdial $topname 1} - if {$key == "d" || $key == "D"} {menu_vdial $topname 1} + if {$key == "i" || $key == "I"} {menu_hradio $topname 1} + if {$key == "d" || $key == "D"} {menu_vradio $topname 1} if {$key == "u" || $key == "U"} {menu_vumeter $topname 1} if {$key == "c" || $key == "C"} {menu_mycnv $topname 1} ############iemlib################## @@ -1001,6 +1019,9 @@ proc pdtk_canvas_ctrlkey {name key shift} { if {$key == "s" || $key == "S"} { if {$shift == 1} {menu_saveas $topname} else {menu_save $topname} } + if {$key == "z" || $key == "Z"} { + if {$shift == 1} {menu_redo $topname} else {menu_undo $topname} + } if {$key == "w" || $key == "W"} {menu_close $topname} if {$key == "p" || $key == "P"} {menu_print $topname} if {$key == "x" || $key == "X"} {menu_cut $topname} @@ -1019,9 +1040,6 @@ proc pdtk_canvas_ctrlkey {name key shift} { if {$key == "slash"} {menu_audio 1} if {$key == "period"} {menu_audio 0} if {$key == "e" || $key == "E"} {menu_editmode $topname} -############iemlib################## - if {$key == "r" || $key == "R"} {menu_protectmode $topname} -############iemlib################## } proc pdtk_canvas_motion {name x y mods} { @@ -1155,13 +1173,65 @@ proc pdtk_canvas_dofont {name initsize} { ############ pdtk_gatom_dialog -- run a gatom dialog ######### -set gatomwidth 0 -set gatomlo 0 -set gatomhi 0 +# see graph_apply, etc., for comments about handling variable names here... + +proc gatom_escape {sym} { + if {[string length $sym] == 0} { + set ret "-" +# puts stderr [concat escape1 $sym $ret] + } else { + if {[string equal -length 1 $sym "-"]} { + set ret [string replace $sym 0 0 "--"] +# puts stderr [concat escape $sym $ret] + } else { + set ret $sym +# puts stderr [concat escape $sym "no change"] + } + } + concat $ret +} + +proc gatom_unescape {sym} { + if {[string equal -length 1 $sym "-"]} { + set ret [string replace $sym 0 0 ""] +# puts stderr [concat unescape $sym $ret] + } else { + set ret $sym +# puts stderr [concat unescape $sym "no change"] + } + concat $ret +} + +proc dogatom_apply {id} { + set vid [string trimleft $id .] + + set var_gatomwidth [concat gatomwidth_$vid] + global $var_gatomwidth + set var_gatomlo [concat gatomlo_$vid] + global $var_gatomlo + set var_gatomhi [concat gatomhi_$vid] + global $var_gatomhi + set var_gatomwherelabel [concat gatomwherelabel_$vid] + global $var_gatomwherelabel + set var_gatomlabel [concat gatomlabel_$vid] + global $var_gatomlabel + set var_gatomsymfrom [concat gatomsymfrom_$vid] + global $var_gatomsymfrom + set var_gatomsymto [concat gatomsymto_$vid] + global $var_gatomsymto + +# set cmd [concat $id param $gatomwidth $gatomlo $gatomhi \;] + + set cmd [concat $id param \ + [eval concat $$var_gatomwidth] \ + [eval concat $$var_gatomlo] \ + [eval concat $$var_gatomhi] \ + [eval gatom_escape $$var_gatomlabel] \ + [eval concat $$var_gatomwherelabel] \ + [eval gatom_escape $$var_gatomsymfrom] \ + [eval gatom_escape $$var_gatomsymto] \ + \;] -proc dogatom_apply {name} { - global gatomwidth gatomlo gatomhi - set cmd [concat $name param $gatomwidth $gatomlo $gatomhi \;] # puts stderr $cmd pd $cmd } @@ -1177,50 +1247,117 @@ proc dogatom_ok {name} { dogatom_cancel $name } -proc pdtk_gatom_dialog {name initwidth initlo inithi} { - - global gatomwidth gatomlo gatomhi - set gatomwidth $initwidth - set gatomlo $initlo - set gatomhi $inithi - - toplevel $name - wm title $name {Atom} - wm protocol $name WM_DELETE_WINDOW [concat dogatom_cancel $name] +proc pdtk_gatom_dialog {id initwidth initlo inithi \ + wherelabel label symfrom symto} { - frame $name.buttonframe - pack $name.buttonframe -side bottom -fill x -pady 2m - button $name.buttonframe.cancel -text {Cancel}\ - -command "dogatom_cancel $name" - button $name.buttonframe.ok -text {Apply}\ - -command "dogatom_apply $name" - pack $name.buttonframe.cancel -side left -expand 1 - pack $name.buttonframe.ok -side left -expand 1 - - frame $name.paramhi - pack $name.paramhi -side bottom - label $name.paramhi.entryname -text "upper limit" - entry $name.paramhi.entry -textvariable gatomhi -width 8 - pack $name.paramhi.entryname $name.paramhi.entry -side left + set vid [string trimleft $id .] + + set var_gatomwidth [concat gatomwidth_$vid] + global $var_gatomwidth + set var_gatomlo [concat gatomlo_$vid] + global $var_gatomlo + set var_gatomhi [concat gatomhi_$vid] + global $var_gatomhi + set var_gatomwherelabel [concat gatomwherelabel_$vid] + global $var_gatomwherelabel + set var_gatomlabel [concat gatomlabel_$vid] + global $var_gatomlabel + set var_gatomsymfrom [concat gatomsymfrom_$vid] + global $var_gatomsymfrom + set var_gatomsymto [concat gatomsymto_$vid] + global $var_gatomsymto + + set $var_gatomwidth $initwidth + set $var_gatomlo $initlo + set $var_gatomhi $inithi + set $var_gatomwherelabel $wherelabel + set $var_gatomlabel [gatom_unescape $label] + set $var_gatomsymfrom [gatom_unescape $symfrom] + set $var_gatomsymto [gatom_unescape $symto] + + toplevel $id + wm title $id {Atom} + wm protocol $id WM_DELETE_WINDOW [concat dogatom_cancel $id] + + frame $id.buttonframe + pack $id.buttonframe -side bottom -fill x -pady 2m + button $id.buttonframe.cancel -text {Cancel}\ + -command "dogatom_cancel $id" + button $id.buttonframe.apply -text {Apply}\ + -command "dogatom_apply $id" + button $id.buttonframe.ok -text {OK}\ + -command "dogatom_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.paramsymto + pack $id.paramsymto -side bottom + label $id.paramsymto.entryname -text {send symbol} + entry $id.paramsymto.entry -textvariable $var_gatomsymto -width 20 + pack $id.paramsymto.entryname $id.paramsymto.entry -side left + + frame $id.paramsymfrom + pack $id.paramsymfrom -side bottom + label $id.paramsymfrom.entryname -text {receive symbol} + entry $id.paramsymfrom.entry -textvariable $var_gatomsymfrom -width 20 + pack $id.paramsymfrom.entryname $id.paramsymfrom.entry -side left + + frame $id.radio + pack $id.radio -side bottom + label $id.radio.label -text {show label on:} + frame $id.radio.l + frame $id.radio.r + pack $id.radio.label -side top + pack $id.radio.l $id.radio.r -side left + radiobutton $id.radio.l.radio0 -value 0 \ + -variable $var_gatomwherelabel \ + -text "left" + radiobutton $id.radio.l.radio1 -value 1 \ + -variable $var_gatomwherelabel \ + -text "right" + radiobutton $id.radio.r.radio2 -value 2 \ + -variable $var_gatomwherelabel \ + -text "top" + radiobutton $id.radio.r.radio3 -value 3 \ + -variable $var_gatomwherelabel \ + -text "bottom" + pack $id.radio.l.radio0 $id.radio.l.radio1 -side top -anchor w + pack $id.radio.r.radio2 $id.radio.r.radio3 -side top -anchor w + + + frame $id.paramlabel + pack $id.paramlabel -side bottom + label $id.paramlabel.entryname -text label + entry $id.paramlabel.entry -textvariable $var_gatomlabel -width 20 + pack $id.paramlabel.entryname $id.paramlabel.entry -side left + + frame $id.paramhi + pack $id.paramhi -side bottom + label $id.paramhi.entryname -text "upper limit" + entry $id.paramhi.entry -textvariable $var_gatomhi -width 8 + pack $id.paramhi.entryname $id.paramhi.entry -side left + + frame $id.paramlo + pack $id.paramlo -side bottom + label $id.paramlo.entryname -text "lower limit" + entry $id.paramlo.entry -textvariable $var_gatomlo -width 8 + pack $id.paramlo.entryname $id.paramlo.entry -side left + + frame $id.params + pack $id.params -side bottom + label $id.params.entryname -text width + entry $id.params.entry -textvariable $var_gatomwidth -width 4 + pack $id.params.entryname $id.params.entry -side left - frame $name.paramlo - pack $name.paramlo -side bottom - label $name.paramlo.entryname -text "lower limit" - entry $name.paramlo.entry -textvariable gatomlo -width 8 - pack $name.paramlo.entryname $name.paramlo.entry -side left - frame $name.params - pack $name.params -side bottom - label $name.params.entryname -text width - entry $name.params.entry -textvariable gatomwidth -width 4 - pack $name.params.entryname $name.params.entry -side left - bind $name.paramhi.entry <KeyPress-Return> [concat dogatom_ok $name] - bind $name.paramlo.entry <KeyPress-Return> [concat dogatom_ok $name] - bind $name.params.entry <KeyPress-Return> [concat dogatom_ok $name] - $name.params.entry select from 0 - $name.params.entry select adjust end - focus $name.params.entry + bind $id.paramhi.entry <KeyPress-Return> [concat dogatom_ok $id] + bind $id.paramlo.entry <KeyPress-Return> [concat dogatom_ok $id] + bind $id.params.entry <KeyPress-Return> [concat dogatom_ok $id] + $id.params.entry select from 0 + $id.params.entry select adjust end + focus $id.params.entry } ############ pdtk_canvas_popup -- popup menu for canvas ######### @@ -2340,14 +2477,6 @@ proc pdtk_canvas_editval {name value} { $name.m.edit.m entryconfigure "Edit mode" -indicatoron false } } - -proc pdtk_canvas_protectval {name value} { - if { $value } { - $name.m.edit.m entryconfigure "Protect" -indicatoron true - } else { - $name.m.edit.m entryconfigure "Protect" -indicatoron false - } -} #####################iemlib####################### ############ pdtk_text_new -- create a new text object #2########### diff --git a/pd/src/u_main.tk.test b/pd/src/u_main.tk.test new file mode 100644 index 00000000..fc32a321 --- /dev/null +++ b/pd/src/u_main.tk.test @@ -0,0 +1,2686 @@ +set pd_nt 0 +# (The above is 0 for unix, 1 for microsoft, and 2 for Mac OSX. The first +# line is automatically munged by the relevant makefiles.) + +# Copyright (c) 1997-1999 Miller Puckette. +# For information on usage and redistribution, and for a DISCLAIMER OF ALL +# WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +# changed by Thomas Musil 09.2001 +# between "pdtk_graph_dialog -- dialog window for graphs" +# and "pdtk_array_dialog -- dialog window for arrays" +# a new dialogbox was inserted, named: +# "pdtk_iemgui_dialog -- dialog window for iem guis" +# +# there are 2 new features: 1.) line-delete-protection in edit-menue +# +# 2.) there are all iem-guis in a seperated put-gui-menue +# +# all this changes are labeled with #######iemlib########## + +if {$pd_nt == 1} { + global pd_guidir + set pd_gui2 [string range $argv0 0 [expr [string last \\ $argv0 ] - 1]] + regsub -all \\\\ $pd_gui2 / pd_gui3 + set pd_guidir $pd_gui3/.. + load $pd_guidir/bin/pdtcl +} + +if {$pd_nt == 2} { + global pd_guidir + set pd_gui2 [string range $argv0 0 [expr [string last / $argv0 ] - 1]] + set pd_guidir $pd_gui2/.. + load $pd_guidir/bin/pdtcl +} + +# it's unfortunate but we seem to have to turn off global bindings +# for Text objects to get control-s and control-t to do what we want for +# "text" dialogs below. Also we have to get rid of tab's changing the focus. + +bind all <Key-Tab> "" +bind all <Shift-Key-Tab> "" +bind Text <Control-t> {} +bind Text <Control-s> {} +# puts stderr [bind all] + +################## set up main window ######################### +frame .mbar -relief raised -bd 2 +canvas .dummy -height 1c -width 1c +frame .controls +pack .mbar .controls .dummy -side top -fill x +menubutton .mbar.file -text File -menu .mbar.file.menu +menubutton .mbar.find -text Find -menu .mbar.find.menu +menubutton .mbar.windows -text Windows -menu .mbar.windows.menu +menubutton .mbar.audio -text Audio -menu .mbar.audio.menu +menubutton .mbar.help -text Help -menu .mbar.help.menu +pack .mbar.file .mbar.find .mbar.windows .mbar.audio -side left +pack .mbar.help -side right +menu .mbar.file.menu +menu .mbar.find.menu +menu .mbar.windows.menu -postcommand [concat pdtk_fixwindowmenu] +menu .mbar.audio.menu +menu .mbar.help.menu + +set ctrls_audio_on 0 +set ctrls_meter_on 0 +set ctrls_inlevel 0 +set ctrls_outlevel 0 + +frame .controls.switches +checkbutton .controls.switches.audiobutton -text {compute audio} \ + -variable ctrls_audio_on \ + -anchor w \ + -command {pd [concat pd dsp $ctrls_audio_on \;]} + +checkbutton .controls.switches.meterbutton -text {peak meters} \ + -variable ctrls_meter_on \ + -anchor w \ + -command {pd [concat pd meters $ctrls_meter_on \;]} + +pack .controls.switches.meterbutton .controls.switches.audiobutton -side left + +frame .controls.in +label .controls.in.label -text IN +entry .controls.in.level -textvariable ctrls_inlevel -width 3 +button .controls.in.clip -text {CLIP} -state disabled +pack .controls.in.label .controls.in.level .controls.in.clip -side top + +frame .controls.out +label .controls.out.label -text OUT +entry .controls.out.level -textvariable ctrls_outlevel -width 3 +button .controls.out.clip -text {CLIP} -state disabled +pack .controls.out.label .controls.out.level .controls.out.clip -side top + +button .controls.dio -text "DIO\nerrors" \ + -command {pd [concat pd audiostatus \;]} + +pack .controls.switches -side bottom +pack .controls.in .controls.out -side left +pack .controls.dio -side right + +bind . <Control-Key> {pdtk_pd_ctrlkey %W %K 0} +bind . <Control-Shift-Key> {pdtk_pd_ctrlkey %W %K 1} + + +############### set up global variables ################################ + +set untitled_number 1 +set untitled_directory [pwd] +set saveas_client doggy +set pd_opendir $untitled_directory +############iemlib################## +# need it to know, if new or open file +set iem_new_open_flag "open" +############iemlib################## + +################ utility functions ######################### + +proc pdtk_enquote {x} { + set foo [string map {"," "" ";" "" \" ""} $x] + set foo2 [string map {" " "\\ "} $foo] + concat $foo2 +} + +proc pdtk_debug {x} { + tk_messageBox -message $x -type ok +} + +proc pdtk_watchdog {} { + pd [concat pd ping \;] + after 2000 {pdtk_watchdog} +} + +proc pdtk_check {x message} { + set answer [tk_messageBox \-message $x \-type yesno \-icon question] + switch $answer { + yes {pd $message} } +# no {tk_messageBox \-message "cancelled" \-type ok} +} + +set menu_windowlist {} + +proc pdtk_fixwindowmenu {} { + global menu_windowlist + .mbar.windows.menu delete 0 end + foreach i $menu_windowlist { + .mbar.windows.menu add command -label [lindex $i 0] \ + -command [concat menu_domenuwindow [lindex $i 1]] + } +} + +############### the "New" menu command ######################## +proc menu_new {} { + global untitled_number + global untitled_directory +############iemlib################## + global iem_new_open_flag + + set iem_new_open_flag "new" +############iemlib################## + pd [concat pd filename Untitled-$untitled_number $untitled_directory \;] + pd { + #N canvas; + #X pop 1; + } + set untitled_number [expr $untitled_number + 1] +} + +################## the "Open" menu command ######################### + +proc menu_open {} { + global pd_opendir + global pd_nt +############iemlib################## + global iem_new_open_flag + + set iem_new_open_flag "open" +############iemlib################## + +# workaround -- initialdir doesn't work on MACOSX yet --- + if {$pd_nt == 2} { + cd $pd_opendir + set filename [tk_getOpenFile -defaultextension .pd \ + -filetypes { {{pd files} {.pd}} {{max files} {.pat}}} ] + } else { + set filename [tk_getOpenFile -defaultextension .pd \ + -filetypes { {{pd files} {.pd}} {{max files} {.pat}}} \ + -initialdir $pd_opendir] + } +# puts stderr $filename + if {$filename != ""} { + set directory [string range $filename 0 \ + [expr [string last / $filename ] - 1]] + set pd_opendir $directory + set basename [string range $filename \ + [expr [string last / $filename ] + 1] end] + +# pd_debug [concat file $filename base $basename dir $directory] + + pd [concat pd open [pdtk_enquote $basename] \ + [pdtk_enquote $directory]\;] + } +} + +################## the "Message" menu command ######################### +proc menu_send {} { + toplevel .sendpanel + entry .sendpanel.entry -textvariable send_textvariable + pack .sendpanel.entry -side bottom -fill both -ipadx 100 + .sendpanel.entry select from 0 + .sendpanel.entry select adjust end + bind .sendpanel.entry <KeyPress-Return> { + pd [concat $send_textvariable \;] + after 50 {destroy .sendpanel} + } + focus .sendpanel.entry +} + +################## the "Quit" menu command ######################### +proc menu_really_quit {} {pd {pd quit;}} + +proc menu_quit {} {pdtk_check {Really quit?} {pd quit;}} + +######### the "Pd" menu command, which puts the Pd window on top ######## +proc menu_pop_pd {} {raise .} + +######### the "audio" menu command ############### +proc menu_audio {flag} {pd [concat pd dsp $flag \;]} + +######### the "documentation" menu command ############### + +set doc_number 1 + +proc menu_opentext {filename} { + global doc_number + global pd_guidir + global pd_myversion + set name [format ".help%d" $doc_number] + toplevel $name + text $name.text -relief raised -bd 2 -font fixed \ + -yscrollcommand "$name.scroll set" -background white + scrollbar $name.scroll -command "$name.text yview" + pack $name.scroll -side right -fill y + pack $name.text -side left -fill both -expand 1 + + set f [open $filename] + while {![eof $f]} { + set bigstring [read $f 1000] + regsub -all PD_BASEDIR $bigstring $pd_guidir bigstring2 + regsub -all PD_VERSION $bigstring2 $pd_myversion bigstring3 + $name.text insert end $bigstring3 + } + close $f + set doc_number [expr $doc_number + 1] +} + +set help_directory $pd_guidir/doc + +proc menu_documentation {} { + global help_directory + global pd_nt +############iemlib################## + global iem_new_open_flag + + set iem_new_open_flag "open" +############iemlib################## + + if {$pd_nt == 2} { + cd $help_directory + set filename [tk_getOpenFile -defaultextension .pd \ + -filetypes { {{documentation} {.pd .txt .htm}} } ] + } else { + set filename [tk_getOpenFile -defaultextension .pd \ + -filetypes { {{documentation} {.pd .txt .htm}} } \ + -initialdir $help_directory] + } + + if {$filename != ""} { + if {[string first .txt $filename] >= 0} { + menu_opentext $filename + } elseif {[string first .htm $filename] >= 0} { + if {$pd_nt == 0} { +#I wish I could get this to run in the background; the "&" doesn't do it: + exec sh -c \ + [format "mozilla file:%s || netscape file:%s &\n" \ + $filename $filename] + } else { + tk_messageBox -message \ + {sorry -- can't open htm files yet; open this manually} \ + -type ok + } + } else { + set help_directory [string range $filename 0 \ + [expr [string last / $filename ] - 1]] + set basename [string range $filename \ + [expr [string last / $filename ] + 1] end] + pd [concat pd open [pdtk_enquote $basename] \ + [pdtk_enquote $help_directory] \;] + } + } +} + +proc menu_doc_open {subdir basename} { + global pd_guidir +############iemlib################## + global iem_new_open_flag + + set iem_new_open_flag "open" +############iemlib################## + + set dirname $pd_guidir/$subdir + + if {[string first .txt $basename] >= 0} { + menu_opentext $dirname/$basename + } else { + pd [concat pd open [pdtk_enquote $basename] \ + [pdtk_enquote $dirname] \;] + } +} + +#################### the "File" menu for the Pd window ############## +.mbar.file.menu add command -label New -command {menu_new} \ + -accelerator "Ctrl+n" +.mbar.file.menu add command -label Open -command {menu_open} \ + -accelerator "Ctrl+o" +.mbar.file.menu add command -label Message -command {menu_send} \ + -accelerator "Ctrl+m" +.mbar.file.menu add separator +.mbar.file.menu add command -label Quit -command {menu_quit} \ + -accelerator "Ctrl+q" + +#################### the "Find" menu for the Pd window ############## +.mbar.find.menu add command -label {last error?} -command {menu_finderror} + +#################### the "Audio" menu for the Pd window ############## +.mbar.audio.menu add command -label On -accelerator "Ctrl+/" \ + -command {menu_audio 1} +.mbar.audio.menu add command -label Off -accelerator "Ctrl+." \ + -command {menu_audio 0} + +#################### the "Help" menu for the Pd window ############## +.mbar.help.menu add command -label {About Pd} \ + -command {menu_doc_open doc/1.manual 1.introduction.txt} +.mbar.help.menu add command -label {Test Audio and MIDI} \ + -command {menu_doc_open doc/7.stuff/tools testtone.pd} +.mbar.help.menu add command -label {Load Meter} \ + -command {menu_doc_open doc/7.stuff/tools load-meter.pd} +.mbar.help.menu add command -label {Pure Documentation...} \ + -command {menu_documentation} + +########### functions for menu functions on document windows ######## + +proc menu_save {name} { + pdtk_canvas_checkgeometry $name + pd [concat $name menusave \;] +} + +proc menu_saveas {name} { + pdtk_canvas_checkgeometry $name + pd [concat $name menusaveas \;] +} + +proc menu_print {name} { + $name.c postscript -file x.ps +} + +proc menu_close {name} { + pd [concat $name menuclose \;] +} + +proc menu_cut {name} { + pd [concat $name cut \;] +} + +proc menu_copy {name} { + pd [concat $name copy \;] +} + +proc menu_paste {name} { + pd [concat $name paste \;] +} + +proc menu_duplicate {name} { + pd [concat $name duplicate \;] +} + +proc menu_selectall {name} { + pd [concat $name selectall \;] +} + +proc menu_texteditor {name} { + pd [concat $name texteditor \;] +} + +proc menu_font {name} { + pd [concat $name menufont \;] +} + +proc menu_tidyup {name} { + pd [concat $name tidy \;] +} + +proc menu_editmode {name} { + pd [concat $name editmode 0 \;] +} + +proc menu_object {name accel} { + pd [concat $name obj $accel \;] +} + +proc menu_message {name accel} { + pd [concat $name msg $accel \;] +} + +proc menu_floatatom {name accel} { + pd [concat $name floatatom $accel \;] +} + +proc menu_symbolatom {name accel} { + pd [concat $name symbolatom $accel \;] +} + +proc menu_comment {name accel} { + pd [concat $name text $accel \;] +} + +proc menu_graph {name} { + pd [concat $name graph \;] +} + +proc menu_array {name} { + pd [concat $name menuarray \;] +} + +############iemlib################## +proc menu_bng {name accel} { + pd [concat $name bng $accel \;] +} + +proc menu_toggle {name accel} { + pd [concat $name toggle $accel \;] +} + +proc menu_numbox {name accel} { + pd [concat $name numbox $accel \;] +} + +proc menu_vslider {name accel} { + pd [concat $name vslider $accel \;] +} + +proc menu_hslider {name accel} { + pd [concat $name hslider $accel \;] +} + +proc menu_hdial {name accel} { + pd [concat $name hdial $accel \;] +} + +proc menu_vdial {name accel} { + pd [concat $name vdial $accel \;] +} + +proc menu_vumeter {name accel} { + pd [concat $name vumeter $accel \;] +} + +proc menu_mycnv {name accel} { + pd [concat $name mycnv $accel \;] +} + +proc menu_protectmode {name} { + pd [concat $name protectmode 0 \;] +} + +############iemlib################## + +proc menu_windowparent {name} { + pd [concat $name findparent \;] +} + +proc menu_findagain {name} { + pd [concat $name findagain \;] +} + +proc menu_finderror {} { + pd [concat pd finderror \;] +} + +proc menu_domenuwindow {i} { + raise $i +} + +proc menu_fixwindowmenu {name} { + global menu_windowlist + $name.m.windows.m add command + $name.m.windows.m delete 4 end + foreach i $menu_windowlist { + $name.m.windows.m add command -label [lindex $i 0] \ + -command [concat menu_domenuwindow [lindex $i 1]] + } +} + +################## the "find" menu item ################### + +set find_canvas nobody +set find_string "" +set find_count 1 + +proc find_apply {name} { + global find_string + global find_canvas + regsub -all \; $find_string " _semi_ " find_string2 + regsub -all \, $find_string2 " _comma_ " find_string3 +# puts stderr [concat $find_canvas find $find_string3 \ +# \;] + pd [concat $find_canvas find $find_string3 \ + \;] + after 50 destroy $name +} + +proc find_cancel {name} { + after 50 destroy $name +} + +proc menu_findobject {canvas} { + global find_string + global find_canvas + global find_count + + set name [format ".find%d" $find_count] + set find_count [expr $find_count + 1] + + set find_canvas $canvas + + toplevel $name + + label $name.label -text {find...} + pack $name.label -side top + + entry $name.entry -textvariable find_string + pack $name.entry -side top + + frame $name.buttonframe + pack $name.buttonframe -side bottom -fill x -pady 2m + button $name.buttonframe.cancel -text {Cancel}\ + -command "find_cancel $name" + button $name.buttonframe.ok -text {OK}\ + -command "find_apply $name" + pack $name.buttonframe.cancel -side left -expand 1 + pack $name.buttonframe.ok -side left -expand 1 + + $name.entry select from 0 + $name.entry select adjust end + bind $name.entry <KeyPress-Return> [ concat find_apply $name] + focus $name.entry +} + + +############# pdtk_canvas_new -- create a new canvas ############### +proc pdtk_canvas_new {name width height geometry} { + global pd_opendir + global iem_new_open_flag + + toplevel $name + frame $name.m -relief raised -bd 2 +# puts stderr [concat geometry: $geometry] + wm geometry $name $geometry + canvas $name.c -width $width -height $height -background white \ + -yscrollcommand "$name.scrollvert set" \ + -xscrollcommand "$name.scrollhort set" \ + -scrollregion [concat 0 0 $width $height] + + scrollbar $name.scrollvert -command "$name.c yview" + scrollbar $name.scrollhort -command "$name.c xview" \ + -orient horizontal + + pack $name.m -side top -fill x + pack $name.scrollhort -side bottom -fill x + pack $name.scrollvert -side right -fill y + pack $name.c -side left -expand 1 -fill both + wm minsize $name 1 1 + wm geometry $name $geometry + +# the file menu + + menubutton $name.m.file -text File -menu $name.m.file.m + pack $name.m.file -side left + menu $name.m.file.m + + $name.m.file.m add command -label New -command {menu_new} \ + -accelerator "Ctrl+n" + + $name.m.file.m add command -label Open -command {menu_open} \ + -accelerator "Ctrl+o" + + $name.m.file.m add command -label Message -command {menu_send} \ + -accelerator "Ctrl+m" + + $name.m.file.m add separator + $name.m.file.m add command -label Save -command [concat menu_save $name] \ + -accelerator "Ctrl+s" + + $name.m.file.m add command -label Close \ + -command [concat menu_close $name] \ + -accelerator "Ctrl+w" + + $name.m.file.m add command -label "Save as..." \ + -command [concat menu_saveas $name] \ + -accelerator "Ctrl+S" + + $name.m.file.m add command -label Print -command [concat menu_print $name] \ + -accelerator "Ctrl+p" + + $name.m.file.m add separator + + $name.m.file.m add command -label Quit -command {menu_quit} \ + -accelerator "Ctrl+q" + +# the edit menu + menubutton $name.m.edit -text Edit -menu $name.m.edit.m + pack $name.m.edit -side left + menu $name.m.edit.m + + + $name.m.edit.m add command -label Cut -command [concat menu_cut $name] \ + -accelerator "Ctrl+x" + + $name.m.edit.m add command -label Copy -command [concat menu_copy $name] \ + -accelerator "Ctrl+c" + + $name.m.edit.m add command -label Paste \ + -command [concat menu_paste $name] \ + -accelerator "Ctrl+v" + + $name.m.edit.m add command -label Duplicate \ + -command [concat menu_duplicate $name] \ + -accelerator "Ctrl+d" + + $name.m.edit.m add command -label {Select all} \ + -command [concat menu_selectall $name] \ + -accelerator "Ctrl+a" + + $name.m.edit.m add command -label {Text Editor} \ + -command [concat menu_texteditor $name] \ + -accelerator "Ctrl+t" + + $name.m.edit.m add command -label Font \ + -command [concat menu_font $name] + + $name.m.edit.m add command -label {Tidy Up} \ + -command [concat menu_tidyup $name] + + $name.m.edit.m add separator + +############iemlib################## +# instead of "red = #BC3C60" we take "grey85", so there is no difference, +# if widget is selected or not. + + $name.m.edit.m add checkbutton -label "Edit mode" \ + -indicatoron true -selectcolor grey85 \ + -command [concat menu_editmode $name] \ + -accelerator "Ctrl+e" + + + + $name.m.edit.m add checkbutton -label "Protect" \ + -indicatoron true -selectcolor grey85 \ + -command [concat menu_protectmode $name] \ + -accelerator "Ctrl+r" + + if { $iem_new_open_flag == "open" } { + $name.m.edit.m entryconfigure "Edit mode" -indicatoron false } + $name.m.edit.m entryconfigure "Protect" -indicatoron false + +############iemlib################## + +# the put menu + menubutton $name.m.put -text Put -menu $name.m.put.m + pack $name.m.put -side left + menu $name.m.put.m + + $name.m.put.m add command -label Object \ + -command [concat menu_object $name 0] \ + -accelerator "Ctrl+1" + + $name.m.put.m add command -label Message \ + -command [concat menu_message $name 0] \ + -accelerator "Ctrl+2" + + $name.m.put.m add command -label Number \ + -command [concat menu_floatatom $name 0] \ + -accelerator "Ctrl+3" + + $name.m.put.m add command -label Symbol \ + -command [concat menu_symbolatom $name 0] \ + -accelerator "Ctrl+4" + + $name.m.put.m add command -label Comment \ + -command [concat menu_comment $name 0] \ + -accelerator "Ctrl+5" + +############iemlib################## + + $name.m.put.m add command -label Bang \ + -command [concat menu_bng $name 0] \ + -accelerator "Alt+b" + + $name.m.put.m add command -label Toggle \ + -command [concat menu_toggle $name 0] \ + -accelerator "Alt+t" + + $name.m.put.m add command -label Number2 \ + -command [concat menu_numbox $name 0] \ + -accelerator "Alt+n" + + $name.m.put.m add command -label Vslider \ + -command [concat menu_vslider $name 0] \ + -accelerator "Alt+v" + + $name.m.put.m add command -label Hslider \ + -command [concat menu_hslider $name 0] \ + -accelerator "Alt+h" + + $name.m.put.m add command -label Vdial \ + -command [concat menu_vdial $name 0] \ + -accelerator "Alt+d" + + $name.m.put.m add command -label Hdial \ + -command [concat menu_hdial $name 0] \ + -accelerator "Alt+i" + + $name.m.put.m add command -label VU \ + -command [concat menu_vumeter $name 0] \ + -accelerator "Alt+u" + + $name.m.put.m add command -label Canvas \ + -command [concat menu_mycnv $name 0] \ + -accelerator "Alt+c" + +############iemlib################## + + $name.m.put.m add command -label Graph \ + -command [concat menu_graph $name] + + $name.m.put.m add command -label Array \ + -command [concat menu_array $name] + + + +# the find menu + menubutton $name.m.find -text Find -menu $name.m.find.m + pack $name.m.find -side left + menu $name.m.find.m + $name.m.find.m add command -label {Find...} -accelerator "Ctrl+f" \ + -command [concat menu_findobject $name] + $name.m.find.m add command -label {Find Again} -accelerator "Ctrl+g" \ + -command [concat menu_findagain $name] + $name.m.find.m add command -label {Find last error} \ + -command [concat menu_finderror] + +# the window menu + menubutton $name.m.windows -text Windows -menu $name.m.windows.m + pack $name.m.windows -side left + menu $name.m.windows.m -postcommand [concat menu_fixwindowmenu $name] + $name.m.windows.m add command -label {parent window}\ + -command [concat menu_windowparent $name] + $name.m.windows.m add command -label {Pd window} -command menu_pop_pd + $name.m.windows.m add separator + +# the audio menu + menubutton $name.m.audio -text Audio -menu $name.m.audio.m + pack $name.m.audio -side left + menu $name.m.audio.m + $name.m.audio.m add command -label On -accelerator "Ctrl+/" \ + -command {menu_audio 1} + $name.m.audio.m add command -label Off -accelerator "Ctrl+." \ + -command {menu_audio 0} + +# the help menu + menubutton $name.m.help -text Help -menu $name.m.help.m + pack $name.m.help -side right + menu $name.m.help.m + $name.m.help.m add command -label {Getting Started} \ + -command {menu_doc_open doc/1.manual 1.introduction.txt} + $name.m.help.m add command -label {Test Audio and MIDI} \ + -command {menu_doc_open doc/7.stuff/tools testtone.pd} + $name.m.help.m add command -label {Load Meter} \ + -command {menu_doc_open doc/7.stuff/tools load-meter.pd} + $name.m.help.m add command -label {Pure Documentation} \ + -command {menu_documentation} + +# the popup menu + menu $name.popup -tearoff false + $name.popup add command -label {Properties} \ + -command [concat popup_action $name 0] + $name.popup add command -label {Open} \ + -command [concat popup_action $name 1] + $name.popup add command -label {Help} \ + -command [concat popup_action $name 2] + +# WM protocol + wm protocol $name WM_DELETE_WINDOW [concat menu_close $name] + +# bindings. +# this is idiotic -- how do you just sense what mod keys are down and +# pass them on? I can't find it anywhere. +# Here we encode shift as 1, control 2, alt 4, in agreement +# with definitions in g_canvas.c. The third button gets "8" but we don't +# bother with modifiers there. +# We don't handle multiple clicks yet. + + bind $name.c <Button> {pdtk_canvas_click %W %x %y %b 0} + bind $name.c <Shift-Button> {pdtk_canvas_click %W %x %y %b 1} + bind $name.c <Control-Button> {pdtk_canvas_click %W %x %y %b 2} + bind $name.c <Control-Shift-Button> {pdtk_canvas_click %W %x %y %b 3} + bind $name.c <Alt-Button> {pdtk_canvas_click %W %x %y %b 4} + bind $name.c <Alt-Shift-Button> {pdtk_canvas_click %W %x %y %b 5} + bind $name.c <Alt-Control-Button> {pdtk_canvas_click %W %x %y %b 6} + bind $name.c <Alt-Control-Shift-Button> {pdtk_canvas_click %W %x %y %b 7} + bind $name.c <Button-3> {pdtk_canvas_click %W %x %y %b 8} + + bind $name.c <ButtonRelease> {pdtk_canvas_mouseup %W %x %y %b} + bind $name.c <Control-Key> {pdtk_canvas_ctrlkey %W %K 0} + bind $name.c <Control-Shift-Key> {pdtk_canvas_ctrlkey %W %K 1} + bind $name.c <Alt-Key> {pdtk_canvas_altkey %W %K %A} +# bind $name.c <Mod1-Key> {puts stderr [concat mod1 %W %K %A]} + bind $name.c <Key> {pdtk_canvas_key %W %K %A} + bind $name.c <KeyRelease> {pdtk_canvas_keyup %W %K %A} + bind $name.c <Motion> {pdtk_canvas_motion %W %x %y 0} + bind $name.c <Alt-Motion> {pdtk_canvas_motion %W %x %y 4} + bind $name.c <Map> {pdtk_canvas_map %W %s} +# bind $name.c <Unmap> {puts stderr map} + focus $name.c +# puts stderr "all done" +# after 1 [concat raise $name] +} + +#################### event binding procedures ################ + +#get the name of the toplevel window for a canvas; this is also +#the name of the canvas object in Pd. + +proc canvastosym {name} { + string range $name 0 [expr [string length $name] - 3] +} + +set pdtk_lastcanvasconfigured "" +set pdtk_lastcanvasconfiguration "" + +proc pdtk_canvas_checkgeometry {topname} { + set boo [winfo geometry $topname.c] + set boo2 [wm geometry $topname] + global pdtk_lastcanvasconfigured + global pdtk_lastcanvasconfiguration + if {$topname != $pdtk_lastcanvasconfigured || \ + $boo != $pdtk_lastcanvasconfiguration} { + set pdtk_lastcanvasconfigured $topname + set pdtk_lastcanvasconfiguration $boo + pd $topname relocate $boo $boo2 \; + } +} + +proc pdtk_canvas_click {name x y b f} { +# puts stderr [concat got $f] + pd [canvastosym $name] mouse [$name canvasx $x] [$name canvasy $y] $b $f \; +} + +proc pdtk_canvas_shiftclick {name x y b} { + pd [canvastosym $name] mouse [$name canvasx $x] [$name canvasy $y] $b 1 \; +} + +proc pdtk_canvas_ctrlclick {name x y b} { + pd [canvastosym $name] mouse [$name canvasx $x] [$name canvasy $y] $b 2 \; +} + +proc pdtk_canvas_altclick {name x y b} { + pd [canvastosym $name] mouse [$name canvasx $x] [$name canvasy $y] $b 3 \; +} + +proc pdtk_canvas_dblclick {name x y b} { + pd [canvastosym $name] mouse [$name canvasx $x] [$name canvasy $y] $b 4 \; +} + +set pdtk_canvas_mouseup_name 0 +set pdtk_canvas_mouseup_xminval 0 +set pdtk_canvas_mouseup_xmaxval 0 +set pdtk_canvas_mouseup_yminval 0 +set pdtk_canvas_mouseup_ymaxval 0 + +proc pdtk_canvas_mouseup {name x y b} { + pd [concat [canvastosym $name] mouseup [$name canvasx $x] \ + [$name canvasy $y] $b \;] + +# we use the mouseup event to update scrollbar ranges and recheck the +# geometry of the window since I haven't taken the time to figure out +# how to do it right. + + global pdtk_canvas_mouseup_name + global pdtk_canvas_mouseup_xminval + global pdtk_canvas_mouseup_xmaxval + global pdtk_canvas_mouseup_yminval + global pdtk_canvas_mouseup_ymaxval + + set size [$name bbox all] + if {$size != ""} { + set xminval 0 + set yminval 0 + set xmaxval 100 + set ymaxval 100 + set x1 [lindex $size 0] + set x2 [lindex $size 2] + set y1 [lindex $size 1] + set y2 [lindex $size 3] + + if {$x1 < 0} {set xminval $x1} + if {$y1 < 0} {set yminval $y1} + + if {$x2 > 100} {set xmaxval $x2} + if {$y2 > 100} {set ymaxval $y2} + + if {$pdtk_canvas_mouseup_name != $name || \ + $pdtk_canvas_mouseup_xminval != $xminval || \ + $pdtk_canvas_mouseup_xmaxval != $xmaxval || \ + $pdtk_canvas_mouseup_yminval != $yminval || \ + $pdtk_canvas_mouseup_ymaxval != $ymaxval } { + + set newsize "$xminval $yminval $xmaxval $ymaxval" + $name configure -scrollregion $newsize + set pdtk_canvas_mouseup_name $name + set pdtk_canvas_mouseup_xminval $xminval + set pdtk_canvas_mouseup_xmaxval $xmaxval + set pdtk_canvas_mouseup_yminval $yminval + set pdtk_canvas_mouseup_ymaxval $ymaxval + } + + } + pdtk_canvas_checkgeometry [canvastosym $name] +} + +proc pdtk_canvas_key {name key iso} { +# puts stderr [concat down key= $key iso= $iso] +# .controls.switches.meterbutton configure -text $key +# HACK for MAC OSX -- backspace seems different; I don't understand why. +# invesigate this LATER... + global pd_nt + if {$pd_nt == 2} { + if {$key == "BackSpace"} { + set key 8 + set keynum 8 + } + if {$key == "Delete"} { + set key 8 + set keynum 8 + } + } + if {$iso != ""} { + scan $iso %c keynum + pd [canvastosym $name] key 1 $keynum \; + } else { + pd [canvastosym $name] key 1 $key \; + } +} + +proc pdtk_canvas_keyup {name key iso} { +# puts stderr [concat up key= $key iso= $iso] + if {$iso != ""} { + scan $iso %c keynum + pd [canvastosym $name] key 0 $keynum \; + } else { + pd [canvastosym $name] key 0 $key \; + } +} + +proc pdtk_canvas_altkey {name key iso} { +# puts stderr [concat alt-key $iso] +############iemlib################## + set topname [string trimright $name .c] + if {$key == "b" || $key == "B"} {menu_bng $topname 1} + if {$key == "t" || $key == "T"} {menu_toggle $topname 1} + if {$key == "n" || $key == "N"} {menu_numbox $topname 1} + if {$key == "v" || $key == "V"} {menu_vslider $topname 1} + if {$key == "h" || $key == "H"} {menu_hslider $topname 1} + if {$key == "i" || $key == "I"} {menu_hdial $topname 1} + if {$key == "d" || $key == "D"} {menu_vdial $topname 1} + if {$key == "u" || $key == "U"} {menu_vumeter $topname 1} + if {$key == "c" || $key == "C"} {menu_mycnv $topname 1} +############iemlib################## +} + +proc pdtk_canvas_ctrlkey {name key shift} { +# first get rid of ".c" suffix; we'll refer to the toplevel instead + set topname [string trimright $name .c] +# puts stderr [concat ctrl-key $key $topname] + + if {$key == "n" || $key == "N"} {menu_new} + if {$key == "o" || $key == "O"} {menu_open} + if {$key == "m" || $key == "M"} {menu_send} + if {$key == "q" || $key == "Q"} { + if {$shift == 1} {menu_really_quit} else {menu_quit} + } + if {$key == "s" || $key == "S"} { + if {$shift == 1} {menu_saveas $topname} else {menu_save $topname} + } + if {$key == "w" || $key == "W"} {menu_close $topname} + if {$key == "p" || $key == "P"} {menu_print $topname} + if {$key == "x" || $key == "X"} {menu_cut $topname} + if {$key == "c" || $key == "C"} {menu_copy $topname} + if {$key == "v" || $key == "V"} {menu_paste $topname} + if {$key == "d" || $key == "D"} {menu_duplicate $topname} + if {$key == "a" || $key == "A"} {menu_selectall $topname} + if {$key == "t" || $key == "T"} {menu_texteditor $topname} + if {$key == "f" || $key == "F"} {menu_findobject $topname} + if {$key == "g" || $key == "G"} {menu_findagain $topname} + if {$key == "1"} {menu_object $topname 1} + if {$key == "2"} {menu_message $topname 1} + if {$key == "3"} {menu_floatatom $topname 1} + if {$key == "4"} {menu_symbolatom $topname 1} + if {$key == "5"} {menu_comment $topname 1} + if {$key == "slash"} {menu_audio 1} + if {$key == "period"} {menu_audio 0} + if {$key == "e" || $key == "E"} {menu_editmode $topname} +############iemlib################## + if {$key == "r" || $key == "R"} {menu_protectmode $topname} +############iemlib################## +} + +proc pdtk_canvas_motion {name x y mods} { +# puts stderr [concat [canvastosym $name] $name $x $y] + pd [canvastosym $name] motion [$name canvasx $x] [$name canvasy $y] $mods \; +} + +# "map" event tells us when the canvas becomes visible (arg is "0") or +# invisible (arg is ""). Invisibility means the Window Manager has minimized +# us. We don't get a final "unmap" event when we destroy the window. +proc pdtk_canvas_map {name arg} { + if {$arg == "0"} { + pd [canvastosym $name] map 1 \; + } else { + pd [canvastosym $name] map 0 \; + } +} + +set saveas_dir nowhere + +############ pdtk_canvas_saveas -- run a saveas dialog ############## + +proc pdtk_canvas_saveas {name initfile initdir} { + global pd_nt + if {$pd_nt == 2} { + cd $initdir + set filename [tk_getSaveFile -initialfile $initfile \ + -defaultextension .pd \ + -filetypes { {{pd files} {.pd}} {{max files} {.pat}} }] + } else { + set filename [tk_getSaveFile -initialfile $initfile \ + -initialdir $initdir -defaultextension .pd \ + -filetypes { {{pd files} {.pd}} {{max files} {.pat}} }] + } + if {$filename != ""} { + set directory [string range $filename 0 \ + [expr [string last / $filename ] - 1]] + set basename [string range $filename \ + [expr [string last / $filename ] + 1] end] + pd [concat $name savetofile [pdtk_enquote $basename] \ + [pdtk_enquote $directory] \;] +# pd [concat $name savetofile $basename $directory \;] + } +} + +############ pdtk_canvas_dofont -- run a font and resize dialog ######### + +set fontsize 0 +set stretchval 0 +set whichstretch 0 + +proc dofont_apply {name} { + global fontsize + global stretchval + global whichstretch + set cmd [concat $name font $fontsize $stretchval $whichstretch \;] +# puts stderr $cmd + pd $cmd +} + +proc dofont_cancel {name} { + set cmd [concat $name cancel \;] +# puts stderr $cmd + pd $cmd +} + +proc pdtk_canvas_dofont {name initsize} { + + global fontsize + set fontsize $initsize + + global stretchval + set stretchval 100 + + global whichstretch + set whichstretch 1 + + toplevel $name + wm title $name {FONT BOMB} + wm protocol $name WM_DELETE_WINDOW [concat dofont_cancel $name] + + frame $name.buttonframe + pack $name.buttonframe -side bottom -fill x -pady 2m + button $name.buttonframe.cancel -text {Cancel}\ + -command "dofont_cancel $name" + button $name.buttonframe.ok -text {Do it}\ + -command "dofont_apply $name" + pack $name.buttonframe.cancel -side left -expand 1 + pack $name.buttonframe.ok -side left -expand 1 + + frame $name.radiof + pack $name.radiof -side left + + label $name.radiof.label -text {Font Size:} + pack $name.radiof.label -side top + + radiobutton $name.radiof.radio8 -value 8 -variable fontsize -text "8" + radiobutton $name.radiof.radio10 -value 10 -variable fontsize -text "10" + radiobutton $name.radiof.radio12 -value 12 -variable fontsize -text "12" + radiobutton $name.radiof.radio16 -value 16 -variable fontsize -text "16" + radiobutton $name.radiof.radio24 -value 24 -variable fontsize -text "24" + radiobutton $name.radiof.radio36 -value 36 -variable fontsize -text "36" + pack $name.radiof.radio8 -side top -anchor w + pack $name.radiof.radio10 -side top -anchor w + pack $name.radiof.radio12 -side top -anchor w + pack $name.radiof.radio16 -side top -anchor w + pack $name.radiof.radio24 -side top -anchor w + pack $name.radiof.radio36 -side top -anchor w + + frame $name.stretchf + pack $name.stretchf -side left + + label $name.stretchf.label -text {Stretch:} + pack $name.stretchf.label -side top + + entry $name.stretchf.entry -textvariable stretchval -width 5 + pack $name.stretchf.entry -side left + + radiobutton $name.stretchf.radio1 \ + -value 1 -variable whichstretch -text "X and Y" + radiobutton $name.stretchf.radio2 \ + -value 2 -variable whichstretch -text "X only" + radiobutton $name.stretchf.radio3 \ + -value 3 -variable whichstretch -text "Y only" + + pack $name.stretchf.radio1 -side top -anchor w + pack $name.stretchf.radio2 -side top -anchor w + pack $name.stretchf.radio3 -side top -anchor w + +} + +############ pdtk_gatom_dialog -- run a gatom dialog ######### + +# see graph_apply, etc., for comments about handling variable names here... + +proc gatom_escape {sym} { + if {[string length $sym] == 0} { + set ret "-" +# puts stderr [concat escape1 $sym $ret] + } else { + if {[string equal -length 1 $sym "-"]} { + set ret [string replace $sym 0 0 "--"] +# puts stderr [concat escape $sym $ret] + } else { + set ret $sym +# puts stderr [concat escape $sym "no change"] + } + } + concat $ret +} + +proc gatom_unescape {sym} { + if {[string equal -length 1 $sym "-"]} { + set ret [string replace $sym 0 0 ""] +# puts stderr [concat unescape $sym $ret] + } else { + set ret $sym +# puts stderr [concat unescape $sym "no change"] + } + concat $ret +} + +proc dogatom_apply {id} { + set vid [string trimleft $id .] + + set var_gatomwidth [concat gatomwidth_$vid] + global $var_gatomwidth + set var_gatomlo [concat gatomlo_$vid] + global $var_gatomlo + set var_gatomhi [concat gatomhi_$vid] + global $var_gatomhi + set var_gatomwherelabel [concat gatomwherelabel_$vid] + global $var_gatomwherelabel + set var_gatomlabel [concat gatomlabel_$vid] + global $var_gatomlabel + set var_gatomsymfrom [concat gatomsymfrom_$vid] + global $var_gatomsymfrom + set var_gatomsymto [concat gatomsymto_$vid] + global $var_gatomsymto + +# set cmd [concat $id param $gatomwidth $gatomlo $gatomhi \;] + + set cmd [concat $id param \ + [eval concat $$var_gatomwidth] \ + [eval concat $$var_gatomlo] \ + [eval concat $$var_gatomhi] \ + [eval gatom_escape $$var_gatomlabel] \ + [eval concat $$var_gatomwherelabel] \ + [eval gatom_escape $$var_gatomsymfrom] \ + [eval gatom_escape $$var_gatomsymto] \ + \;] + +# puts stderr $cmd + pd $cmd +} + +proc dogatom_cancel {name} { + set cmd [concat $name cancel \;] +# puts stderr $cmd + pd $cmd +} + +proc dogatom_ok {name} { + dogatom_apply $name + dogatom_cancel $name +} + +proc pdtk_gatom_dialog {id initwidth initlo inithi \ + wherelabel label symfrom symto} { + + set vid [string trimleft $id .] + + set var_gatomwidth [concat gatomwidth_$vid] + global $var_gatomwidth + set var_gatomlo [concat gatomlo_$vid] + global $var_gatomlo + set var_gatomhi [concat gatomhi_$vid] + global $var_gatomhi + set var_gatomwherelabel [concat gatomwherelabel_$vid] + global $var_gatomwherelabel + set var_gatomlabel [concat gatomlabel_$vid] + global $var_gatomlabel + set var_gatomsymfrom [concat gatomsymfrom_$vid] + global $var_gatomsymfrom + set var_gatomsymto [concat gatomsymto_$vid] + global $var_gatomsymto + + set $var_gatomwidth $initwidth + set $var_gatomlo $initlo + set $var_gatomhi $inithi + set $var_gatomwherelabel $wherelabel + set $var_gatomlabel [gatom_unescape $label] + set $var_gatomsymfrom [gatom_unescape $symfrom] + set $var_gatomsymto [gatom_unescape $symto] + + toplevel $id + wm title $id {Atom} + wm protocol $id WM_DELETE_WINDOW [concat dogatom_cancel $id] + + frame $id.buttonframe + pack $id.buttonframe -side bottom -fill x -pady 2m + button $id.buttonframe.cancel -text {Cancel}\ + -command "dogatom_cancel $id" + button $id.buttonframe.ok -text {Apply}\ + -command "dogatom_apply $id" + pack $id.buttonframe.cancel -side left -expand 1 + pack $id.buttonframe.ok -side left -expand 1 + + frame $id.paramsymto + pack $id.paramsymto -side bottom + label $id.paramsymto.entryname -text {send symbol} + entry $id.paramsymto.entry -textvariable $var_gatomsymto -width 20 + pack $id.paramsymto.entryname $id.paramsymto.entry -side left + + frame $id.paramsymfrom + pack $id.paramsymfrom -side bottom + label $id.paramsymfrom.entryname -text {receive symbol} + entry $id.paramsymfrom.entry -textvariable $var_gatomsymfrom -width 20 + pack $id.paramsymfrom.entryname $id.paramsymfrom.entry -side left + + frame $id.radio + pack $id.radio -side bottom + label $id.radio.label -text {show label on:} + frame $id.radio.l + frame $id.radio.r + pack $id.radio.label -side top + pack $id.radio.l $id.radio.r -side left + radiobutton $id.radio.l.radio0 -value 0 \ + -variable $var_gatomwherelabel \ + -text "left" + radiobutton $id.radio.l.radio1 -value 1 \ + -variable $var_gatomwherelabel \ + -text "right" + radiobutton $id.radio.r.radio2 -value 2 \ + -variable $var_gatomwherelabel \ + -text "top" + radiobutton $id.radio.r.radio3 -value 3 \ + -variable $var_gatomwherelabel \ + -text "bottom" + pack $id.radio.l.radio0 $id.radio.l.radio1 -side top -anchor w + pack $id.radio.r.radio2 $id.radio.r.radio3 -side top -anchor w + + + frame $id.paramlabel + pack $id.paramlabel -side bottom + label $id.paramlabel.entryname -text label + entry $id.paramlabel.entry -textvariable $var_gatomlabel -width 20 + pack $id.paramlabel.entryname $id.paramlabel.entry -side left + + frame $id.paramhi + pack $id.paramhi -side bottom + label $id.paramhi.entryname -text "upper limit" + entry $id.paramhi.entry -textvariable $var_gatomhi -width 8 + pack $id.paramhi.entryname $id.paramhi.entry -side left + + frame $id.paramlo + pack $id.paramlo -side bottom + label $id.paramlo.entryname -text "lower limit" + entry $id.paramlo.entry -textvariable $var_gatomlo -width 8 + pack $id.paramlo.entryname $id.paramlo.entry -side left + + frame $id.params + pack $id.params -side bottom + label $id.params.entryname -text width + entry $id.params.entry -textvariable $var_gatomwidth -width 4 + pack $id.params.entryname $id.params.entry -side left + + + + bind $id.paramhi.entry <KeyPress-Return> [concat dogatom_ok $id] + bind $id.paramlo.entry <KeyPress-Return> [concat dogatom_ok $id] + bind $id.params.entry <KeyPress-Return> [concat dogatom_ok $id] + $id.params.entry select from 0 + $id.params.entry select adjust end + focus $id.params.entry +} + +############ pdtk_canvas_popup -- popup menu for canvas ######### + +set popup_xpix 0 +set popup_ypix 0 + +proc popup_action {name action} { + global popup_xpix popup_ypix + set cmd [concat $name done-popup $action $popup_xpix $popup_ypix \;] +# puts stderr $cmd + pd $cmd +} + +proc pdtk_canvas_popup {name xpix ypix canprop canopen} { + global popup_xpix popup_ypix + set popup_xpix $xpix + set popup_ypix $ypix + if {$canprop == 0} {$name.popup entryconfigure 0 -state disabled} + if {$canprop == 1} {$name.popup entryconfigure 0 -state active} + if {$canopen == 0} {$name.popup entryconfigure 1 -state disabled} + if {$canopen == 1} {$name.popup entryconfigure 1 -state active} + tk_popup $name.popup [expr $xpix + [winfo rootx $name.c]] \ + [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] + $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 ######### + +set iemgui_define_min_flashhold 50 +set iemgui_define_min_flashbreak 10 +set iemgui_define_min_fontsize 4 + +proc iemgui_clip_dim {id} { + set vid [string trimleft $id .] + + set var_iemgui_wdt [concat iemgui_wdt_$vid] + global $var_iemgui_wdt + set var_iemgui_min_wdt [concat iemgui_min_wdt_$vid] + global $var_iemgui_min_wdt + set var_iemgui_hgt [concat iemgui_hgt_$vid] + global $var_iemgui_hgt + set var_iemgui_min_hgt [concat iemgui_min_hgt_$vid] + global $var_iemgui_min_hgt + + if {[eval concat $$var_iemgui_wdt] < [eval concat $$var_iemgui_min_wdt]} { + set $var_iemgui_wdt [eval concat $$var_iemgui_min_wdt] + $id.dim.w_ent configure -textvariable $var_iemgui_wdt + } + if {[eval concat $$var_iemgui_hgt] < [eval concat $$var_iemgui_min_hgt]} { + set $var_iemgui_hgt [eval concat $$var_iemgui_min_hgt] + $id.dim.h_ent configure -textvariable $var_iemgui_hgt + } +} + +proc iemgui_clip_num {id} { + set vid [string trimleft $id .] + + set var_iemgui_num [concat iemgui_num_$vid] + global $var_iemgui_num + + if {[eval concat $$var_iemgui_num] > 2000} { + set $var_iemgui_num 2000 + $id.para.num_ent configure -textvariable $var_iemgui_num + } + if {[eval concat $$var_iemgui_num] < 1} { + set $var_iemgui_num 1 + $id.para.num_ent configure -textvariable $var_iemgui_num + } +} + +proc iemgui_sched_rng {id} { + set vid [string trimleft $id .] + + set var_iemgui_min_rng [concat iemgui_min_rng_$vid] + global $var_iemgui_min_rng + set var_iemgui_max_rng [concat iemgui_max_rng_$vid] + global $var_iemgui_max_rng + set var_iemgui_rng_sch [concat iemgui_rng_sch_$vid] + global $var_iemgui_rng_sch + + global iemgui_define_min_flashhold + global iemgui_define_min_flashbreak + + if {[eval concat $$var_iemgui_rng_sch] == 2} { + if {[eval concat $$var_iemgui_max_rng] < [eval concat $$var_iemgui_min_rng]} { + set hhh [eval concat $$var_iemgui_min_rng] + set $var_iemgui_min_rng [eval concat $$var_iemgui_max_rng] + set $var_iemgui_max_rng $hhh + $id.rng.max_ent configure -textvariable $var_iemgui_max_rng + $id.rng.min_ent configure -textvariable $var_iemgui_min_rng } + if {[eval concat $$var_iemgui_max_rng] < $iemgui_define_min_flashhold} { + set $var_iemgui_max_rng $iemgui_define_min_flashhold + $id.rng.max_ent configure -textvariable $var_iemgui_max_rng + } + if {[eval concat $$var_iemgui_min_rng] < $iemgui_define_min_flashbreak} { + set $var_iemgui_min_rng $iemgui_define_min_flashbreak + $id.rng.min_ent configure -textvariable $var_iemgui_min_rng + } + } + if {[eval concat $$var_iemgui_rng_sch] == 1} { + if {[eval concat $$var_iemgui_min_rng] == 0.0} { + set $var_iemgui_min_rng 1.0 + $id.rng.min_ent configure -textvariable $var_iemgui_min_rng + } + } +} + +proc iemgui_verify_rng {id} { + set vid [string trimleft $id .] + + set var_iemgui_min_rng [concat iemgui_min_rng_$vid] + global $var_iemgui_min_rng + set var_iemgui_max_rng [concat iemgui_max_rng_$vid] + global $var_iemgui_max_rng + set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid] + global $var_iemgui_lin0_log1 + + if {[eval concat $$var_iemgui_lin0_log1] == 1} { + if {[eval concat $$var_iemgui_max_rng] == 0.0 && [eval concat $$var_iemgui_min_rng] == 0.0} { + set $var_iemgui_max_rng 1.0 + $id.rng.max_ent configure -textvariable $var_iemgui_max_rng + } + if {[eval concat $$var_iemgui_max_rng] > 0} { + if {[eval concat $$var_iemgui_min_rng] <= 0} { + set $var_iemgui_min_rng [expr [eval concat $$var_iemgui_max_rng] * 0.01] + $id.rng.min_ent configure -textvariable $var_iemgui_min_rng + } + } else { + if {[eval concat $$var_iemgui_min_rng] > 0} { + set $var_iemgui_max_rng [expr [eval concat $$var_iemgui_min_rng] * 0.01] + $id.rng.max_ent configure -textvariable $var_iemgui_max_rng + } + } + } +} + +proc iemgui_clip_fontsize {id} { + set vid [string trimleft $id .] + + set var_iemgui_gn_fs [concat iemgui_gn_fs_$vid] + global $var_iemgui_gn_fs + + global iemgui_define_min_fontsize + + if {[eval concat $$var_iemgui_gn_fs] < $iemgui_define_min_fontsize} { + set $var_iemgui_gn_fs $iemgui_define_min_fontsize + $id.gnfs.fs_ent configure -textvariable $var_iemgui_gn_fs + } +} + +proc iemgui_set_col_example {id} { + set vid [string trimleft $id .] + + set var_iemgui_bcol [concat iemgui_bcol_$vid] + global $var_iemgui_bcol + set var_iemgui_fcol [concat iemgui_fcol_$vid] + global $var_iemgui_fcol + set var_iemgui_lcol [concat iemgui_lcol_$vid] + global $var_iemgui_lcol + + $id.col_example_choose.lb_bk configure \ + -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -foreground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] \ + -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] + + if { [eval concat $$var_iemgui_fcol] >= 0 } { + $id.col_example_choose.fr_bk configure \ + -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -foreground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] \ + -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] + } else { + $id.col_example_choose.fr_bk configure \ + -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -foreground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_bcol]]} +} + +proc iemgui_preset_col {id presetcol} { + set vid [string trimleft $id .] + + set var_iemgui_l2_f1_b0 [concat iemgui_l2_f1_b0_$vid] + global $var_iemgui_l2_f1_b0 + set var_iemgui_bcol [concat iemgui_bcol_$vid] + global $var_iemgui_bcol + set var_iemgui_fcol [concat iemgui_fcol_$vid] + global $var_iemgui_fcol + set var_iemgui_lcol [concat iemgui_lcol_$vid] + global $var_iemgui_lcol + + if { [eval concat $$var_iemgui_l2_f1_b0] == 0 } { set $var_iemgui_bcol $presetcol } + if { [eval concat $$var_iemgui_l2_f1_b0] == 1 } { set $var_iemgui_fcol $presetcol } + if { [eval concat $$var_iemgui_l2_f1_b0] == 2 } { set $var_iemgui_lcol $presetcol } + iemgui_set_col_example $id +} + +proc iemgui_choose_col_bkfrlb {id} { + set vid [string trimleft $id .] + + set var_iemgui_l2_f1_b0 [concat iemgui_l2_f1_b0_$vid] + global $var_iemgui_l2_f1_b0 + set var_iemgui_bcol [concat iemgui_bcol_$vid] + global $var_iemgui_bcol + set var_iemgui_fcol [concat iemgui_fcol_$vid] + global $var_iemgui_fcol + set var_iemgui_lcol [concat iemgui_lcol_$vid] + global $var_iemgui_lcol + + if {[eval concat $$var_iemgui_l2_f1_b0] == 0} { + set $var_iemgui_bcol [expr [eval concat $$var_iemgui_bcol] & 0xFCFCFC] + set helpstring [tk_chooseColor -title "Background-Color" -initialcolor [format "#%6.6x" [eval concat $$var_iemgui_bcol]]] + if { $helpstring != "" } { + set $var_iemgui_bcol [string replace $helpstring 0 0 "0x"] + set $var_iemgui_bcol [expr [eval concat $$var_iemgui_bcol] & 0xFCFCFC] } + } + if {[eval concat $$var_iemgui_l2_f1_b0] == 1} { + set $var_iemgui_fcol [expr [eval concat $$var_iemgui_fcol] & 0xFCFCFC] + set helpstring [tk_chooseColor -title "Front-Color" -initialcolor [format "#%6.6x" [eval concat $$var_iemgui_fcol]]] + if { $helpstring != "" } { + set $var_iemgui_fcol [string replace $helpstring 0 0 "0x"] + set $var_iemgui_fcol [expr [eval concat $$var_iemgui_fcol] & 0xFCFCFC] } + } + if {[eval concat $$var_iemgui_l2_f1_b0] == 2} { + set $var_iemgui_lcol [expr [eval concat $$var_iemgui_lcol] & 0xFCFCFC] + set helpstring [tk_chooseColor -title "Label-Color" -initialcolor [format "#%6.6x" [eval concat $$var_iemgui_lcol]]] + if { $helpstring != "" } { + set $var_iemgui_lcol [string replace $helpstring 0 0 "0x"] + set $var_iemgui_lcol [expr [eval concat $$var_iemgui_lcol] & 0xFCFCFC] } + } + iemgui_set_col_example $id +} + +proc iemgui_lilo {id} { + set vid [string trimleft $id .] + + set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid] + global $var_iemgui_lin0_log1 + set var_iemgui_lilo0 [concat iemgui_lilo0_$vid] + global $var_iemgui_lilo0 + set var_iemgui_lilo1 [concat iemgui_lilo1_$vid] + global $var_iemgui_lilo1 + + iemgui_sched_rng $id + + if {[eval concat $$var_iemgui_lin0_log1] == 0} { + set $var_iemgui_lin0_log1 1 + $id.para.lilo configure -text [eval concat $$var_iemgui_lilo1] + iemgui_verify_rng $id + iemgui_sched_rng $id + } else { + set $var_iemgui_lin0_log1 0 + $id.para.lilo configure -text [eval concat $$var_iemgui_lilo0] + } +} + +proc iemgui_toggle_font {id} { + set vid [string trimleft $id .] + + set var_iemgui_gn_f [concat iemgui_gn_f_$vid] + global $var_iemgui_gn_f + + set $var_iemgui_gn_f [expr [eval concat $$var_iemgui_gn_f] + 1] + if {[eval concat $$var_iemgui_gn_f] > 2} {set $var_iemgui_gn_f 0} + if {[eval concat $$var_iemgui_gn_f] == 0} {$id.gnfs.fb configure -text "courier" -font {courier 10 bold}} + if {[eval concat $$var_iemgui_gn_f] == 1} {$id.gnfs.fb configure -text "helvetica" -font {helvetica 10 bold}} + if {[eval concat $$var_iemgui_gn_f] == 2} {$id.gnfs.fb configure -text "times" -font {times 10 bold}} +} + +proc iemgui_lb {id} { + set vid [string trimleft $id .] + + set var_iemgui_loadbang [concat iemgui_loadbang_$vid] + global $var_iemgui_loadbang + + if {[eval concat $$var_iemgui_loadbang] == 0} { + set $var_iemgui_loadbang 1 + $id.para.lb configure -text "init" + } else { + set $var_iemgui_loadbang 0 + $id.para.lb configure -text "no init" + } +} + +proc iemgui_stdy_jmp {id} { + set vid [string trimleft $id .] + + set var_iemgui_steady [concat iemgui_steady_$vid] + global $var_iemgui_steady + + if {[eval concat $$var_iemgui_steady]} { + set $var_iemgui_steady 0 + $id.para.stdy_jmp configure -text "jump on click" + } else { + set $var_iemgui_steady 1 + $id.para.stdy_jmp configure -text "steady on click" + } +} + +proc iemgui_apply {id} { + set vid [string trimleft $id .] + + set var_iemgui_wdt [concat iemgui_wdt_$vid] + global $var_iemgui_wdt + set var_iemgui_min_wdt [concat iemgui_min_wdt_$vid] + global $var_iemgui_min_wdt + set var_iemgui_hgt [concat iemgui_hgt_$vid] + global $var_iemgui_hgt + set var_iemgui_min_hgt [concat iemgui_min_hgt_$vid] + global $var_iemgui_min_hgt + set var_iemgui_min_rng [concat iemgui_min_rng_$vid] + global $var_iemgui_min_rng + set var_iemgui_max_rng [concat iemgui_max_rng_$vid] + global $var_iemgui_max_rng + set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid] + global $var_iemgui_lin0_log1 + set var_iemgui_lilo0 [concat iemgui_lilo0_$vid] + global $var_iemgui_lilo0 + set var_iemgui_lilo1 [concat iemgui_lilo1_$vid] + global $var_iemgui_lilo1 + set var_iemgui_loadbang [concat iemgui_loadbang_$vid] + global $var_iemgui_loadbang + set var_iemgui_num [concat iemgui_num_$vid] + global $var_iemgui_num + set var_iemgui_steady [concat iemgui_steady_$vid] + global $var_iemgui_steady + set var_iemgui_snd [concat iemgui_snd_$vid] + global $var_iemgui_snd + set var_iemgui_rcv [concat iemgui_rcv_$vid] + global $var_iemgui_rcv + set var_iemgui_gui_nam [concat iemgui_gui_nam_$vid] + global $var_iemgui_gui_nam + set var_iemgui_gn_dx [concat iemgui_gn_dx_$vid] + global $var_iemgui_gn_dx + set var_iemgui_gn_dy [concat iemgui_gn_dy_$vid] + global $var_iemgui_gn_dy + set var_iemgui_gn_f [concat iemgui_gn_f_$vid] + global $var_iemgui_gn_f + set var_iemgui_gn_fs [concat iemgui_gn_fs_$vid] + global $var_iemgui_gn_fs + set var_iemgui_bcol [concat iemgui_bcol_$vid] + global $var_iemgui_bcol + set var_iemgui_fcol [concat iemgui_fcol_$vid] + global $var_iemgui_fcol + set var_iemgui_lcol [concat iemgui_lcol_$vid] + global $var_iemgui_lcol + + iemgui_clip_dim $id + iemgui_clip_num $id + iemgui_sched_rng $id + iemgui_verify_rng $id + iemgui_sched_rng $id + iemgui_clip_fontsize $id + + if {[eval concat $$var_iemgui_snd] == ""} {set hhhsnd "empty"} else {set hhhsnd [eval concat $$var_iemgui_snd]} + if {[eval concat $$var_iemgui_rcv] == ""} {set hhhrcv "empty"} else {set hhhrcv [eval concat $$var_iemgui_rcv]} + if {[eval concat $$var_iemgui_gui_nam] == ""} {set hhhgui_nam "empty" + } else { + set hhhgui_nam [eval concat $$var_iemgui_gui_nam]} + + if {[string index $hhhsnd 0] == "$"} { + set hhhsnd [string replace $hhhsnd 0 0 #] } + if {[string index $hhhrcv 0] == "$"} { + set hhhrcv [string replace $hhhrcv 0 0 #] } + if {[string index $hhhgui_nam 0] == "$"} { + set hhhgui_nam [string replace $hhhgui_nam 0 0 #] } + + pd [concat $id dialog \ + [eval concat $$var_iemgui_wdt] \ + [eval concat $$var_iemgui_hgt] \ + [eval concat $$var_iemgui_min_rng] \ + [eval concat $$var_iemgui_max_rng] \ + [eval concat $$var_iemgui_lin0_log1] \ + [eval concat $$var_iemgui_loadbang] \ + [eval concat $$var_iemgui_num] \ + $hhhsnd \ + $hhhrcv \ + $hhhgui_nam \ + [eval concat $$var_iemgui_gn_dx] \ + [eval concat $$var_iemgui_gn_dy] \ + [eval concat $$var_iemgui_gn_f] \ + [eval concat $$var_iemgui_gn_fs] \ + [eval concat $$var_iemgui_bcol] \ + [eval concat $$var_iemgui_fcol] \ + [eval concat $$var_iemgui_lcol] \ + [eval concat $$var_iemgui_steady] \ + \;] +} + +proc iemgui_cancel {id} {pd [concat $id cancel \;]} + +proc iemgui_ok {id} { + iemgui_apply $id + iemgui_cancel $id +} + +proc pdtk_iemgui_dialog {id mainheader \ + dim_header wdt min_wdt wdt_label hgt min_hgt hgt_label \ + rng_header min_rng min_rng_label max_rng max_rng_label rng_sched \ + lin0_log1 lilo0_label lilo1_label loadbang steady num_label num \ + snd rcv \ + gui_name \ + gn_dx gn_dy \ + gn_f gn_fs \ + bcol fcol lcol} { + + set vid [string trimleft $id .] + + set var_iemgui_wdt [concat iemgui_wdt_$vid] + global $var_iemgui_wdt + set var_iemgui_min_wdt [concat iemgui_min_wdt_$vid] + global $var_iemgui_min_wdt + set var_iemgui_hgt [concat iemgui_hgt_$vid] + global $var_iemgui_hgt + set var_iemgui_min_hgt [concat iemgui_min_hgt_$vid] + global $var_iemgui_min_hgt + set var_iemgui_min_rng [concat iemgui_min_rng_$vid] + global $var_iemgui_min_rng + set var_iemgui_max_rng [concat iemgui_max_rng_$vid] + global $var_iemgui_max_rng + set var_iemgui_rng_sch [concat iemgui_rng_sch_$vid] + global $var_iemgui_rng_sch + set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid] + global $var_iemgui_lin0_log1 + set var_iemgui_lilo0 [concat iemgui_lilo0_$vid] + global $var_iemgui_lilo0 + set var_iemgui_lilo1 [concat iemgui_lilo1_$vid] + global $var_iemgui_lilo1 + set var_iemgui_loadbang [concat iemgui_loadbang_$vid] + global $var_iemgui_loadbang + set var_iemgui_num [concat iemgui_num_$vid] + global $var_iemgui_num + set var_iemgui_steady [concat iemgui_steady_$vid] + global $var_iemgui_steady + set var_iemgui_snd [concat iemgui_snd_$vid] + global $var_iemgui_snd + set var_iemgui_rcv [concat iemgui_rcv_$vid] + global $var_iemgui_rcv + set var_iemgui_gui_nam [concat iemgui_gui_nam_$vid] + global $var_iemgui_gui_nam + set var_iemgui_gn_dx [concat iemgui_gn_dx_$vid] + global $var_iemgui_gn_dx + set var_iemgui_gn_dy [concat iemgui_gn_dy_$vid] + global $var_iemgui_gn_dy + set var_iemgui_gn_f [concat iemgui_gn_f_$vid] + global $var_iemgui_gn_f + set var_iemgui_gn_fs [concat iemgui_gn_fs_$vid] + global $var_iemgui_gn_fs + set var_iemgui_l2_f1_b0 [concat iemgui_l2_f1_b0_$vid] + global $var_iemgui_l2_f1_b0 + set var_iemgui_bcol [concat iemgui_bcol_$vid] + global $var_iemgui_bcol + set var_iemgui_fcol [concat iemgui_fcol_$vid] + global $var_iemgui_fcol + set var_iemgui_lcol [concat iemgui_lcol_$vid] + global $var_iemgui_lcol + + set $var_iemgui_wdt $wdt + set $var_iemgui_min_wdt $min_wdt + set $var_iemgui_hgt $hgt + set $var_iemgui_min_hgt $min_hgt + set $var_iemgui_min_rng $min_rng + set $var_iemgui_max_rng $max_rng + set $var_iemgui_rng_sch $rng_sched + set $var_iemgui_lin0_log1 $lin0_log1 + set $var_iemgui_lilo0 $lilo0_label + set $var_iemgui_lilo1 $lilo1_label + set $var_iemgui_loadbang $loadbang + set $var_iemgui_num $num + set $var_iemgui_steady $steady + if {$snd == "empty"} {set $var_iemgui_snd [format ""] + } else {set $var_iemgui_snd [format "%s" $snd]} + if {$rcv == "empty"} {set $var_iemgui_rcv [format ""] + } else {set $var_iemgui_rcv [format "%s" $rcv]} + if {$gui_name == "empty"} {set $var_iemgui_gui_nam [format ""] + } else {set $var_iemgui_gui_nam [format "%s" $gui_name]} + + if {[string index [eval concat $$var_iemgui_snd] 0] == "#"} { + set $var_iemgui_snd [string replace [eval concat $$var_iemgui_snd] 0 0 $] } + if {[string index [eval concat $$var_iemgui_rcv] 0] == "#"} { + set $var_iemgui_rcv [string replace [eval concat $$var_iemgui_rcv] 0 0 $] } + if {[string index [eval concat $$var_iemgui_gui_nam] 0] == "#"} { + set $var_iemgui_gui_nam [string replace [eval concat $$var_iemgui_gui_nam] 0 0 $] } + set $var_iemgui_gn_dx $gn_dx + set $var_iemgui_gn_dy $gn_dy + set $var_iemgui_gn_f $gn_f + set $var_iemgui_gn_fs $gn_fs + + set $var_iemgui_bcol $bcol + set $var_iemgui_fcol $fcol + set $var_iemgui_lcol $lcol + + set $var_iemgui_l2_f1_b0 0 + + toplevel $id + wm title $id [format "%s-PROPERTIES" $mainheader] + wm protocol $id WM_DELETE_WINDOW [concat iemgui_cancel $id] + + frame $id.dim + pack $id.dim -side top + label $id.dim.head -text $dim_header + label $id.dim.w_lab -text $wdt_label -width 6 + entry $id.dim.w_ent -textvariable $var_iemgui_wdt -width 5 + label $id.dim.dummy1 -text " " -width 10 + label $id.dim.h_lab -text $hgt_label -width 6 + entry $id.dim.h_ent -textvariable $var_iemgui_hgt -width 5 + pack $id.dim.head -side top + pack $id.dim.w_lab $id.dim.w_ent $id.dim.dummy1 -side left + if { $hgt_label != "empty" } { + pack $id.dim.h_lab $id.dim.h_ent -side left} + + frame $id.rng + pack $id.rng -side top + label $id.rng.head -text $rng_header + label $id.rng.min_lab -text $min_rng_label -width 6 + entry $id.rng.min_ent -textvariable $var_iemgui_min_rng -width 9 + label $id.rng.dummy1 -text " " -width 1 + label $id.rng.max_lab -text $max_rng_label -width 8 + entry $id.rng.max_ent -textvariable $var_iemgui_max_rng -width 9 + if { $rng_header != "empty" } { + pack $id.rng.head -side top + if { $min_rng_label != "empty" } { + pack $id.rng.min_lab $id.rng.min_ent -side left} + if { $max_rng_label != "empty" } { + pack $id.rng.dummy1 \ + $id.rng.max_lab $id.rng.max_ent -side left} } + + if { [eval concat $$var_iemgui_lin0_log1] >= 0 || [eval concat $$var_iemgui_loadbang] >= 0 || [eval concat $$var_iemgui_num] > 0 || [eval concat $$var_iemgui_steady] >= 0 } { + label $id.space1 -text "---------------------------------" + pack $id.space1 -side top } + + frame $id.para + pack $id.para -side top + label $id.para.dummy2 -text "" -width 1 + label $id.para.dummy3 -text "" -width 1 + if {[eval concat $$var_iemgui_lin0_log1] == 0} { + button $id.para.lilo -text [eval concat $$var_iemgui_lilo0] -width 5 -command "iemgui_lilo $id" } + if {[eval concat $$var_iemgui_lin0_log1] == 1} { + button $id.para.lilo -text [eval concat $$var_iemgui_lilo1] -width 5 -command "iemgui_lilo $id" } + if {[eval concat $$var_iemgui_loadbang] == 0} { + button $id.para.lb -text "no init" -width 5 -command "iemgui_lb $id" } + if {[eval concat $$var_iemgui_loadbang] == 1} { + button $id.para.lb -text "init" -width 5 -command "iemgui_lb $id" } + label $id.para.num_lab -text $num_label -width 9 + entry $id.para.num_ent -textvariable $var_iemgui_num -width 4 + if {[eval concat $$var_iemgui_steady] == 0} { + button $id.para.stdy_jmp -text "jump on click" -width 11 -command "iemgui_stdy_jmp $id" } + if {[eval concat $$var_iemgui_steady] == 1} { + button $id.para.stdy_jmp -text "steady on click" -width 11 -command "iemgui_stdy_jmp $id" } + if {[eval concat $$var_iemgui_lin0_log1] >= 0} { + pack $id.para.lilo -side left -expand 1} + if {[eval concat $$var_iemgui_loadbang] >= 0} { + pack $id.para.dummy2 $id.para.lb -side left -expand 1} + if {[eval concat $$var_iemgui_num] > 0} { + pack $id.para.dummy3 $id.para.num_lab $id.para.num_ent -side left -expand 1} + if {[eval concat $$var_iemgui_steady] >= 0} { + pack $id.para.dummy3 $id.para.stdy_jmp -side left -expand 1} + if { $snd != "nosndno" || $rcv != "norcvno" } { + label $id.space2 -text "---------------------------------" + pack $id.space2 -side top } + + frame $id.snd + pack $id.snd -side top + label $id.snd.dummy1 -text "" -width 2 + label $id.snd.lab -text "send-symbol:" -width 12 + entry $id.snd.ent -textvariable $var_iemgui_snd -width 20 + if { $snd != "nosndno" } { + pack $id.snd.dummy1 $id.snd.lab $id.snd.ent -side left} + + frame $id.rcv + pack $id.rcv -side top + label $id.rcv.lab -text "receive-symbol:" -width 15 + entry $id.rcv.ent -textvariable $var_iemgui_rcv -width 20 + if { $rcv != "norcvno" } { + pack $id.rcv.lab $id.rcv.ent -side left} + + frame $id.gnam + pack $id.gnam -side top + label $id.gnam.head -text "--------------label:---------------" + label $id.gnam.dummy1 -text "" -width 1 + label $id.gnam.lab -text "name:" -width 6 + entry $id.gnam.ent -textvariable $var_iemgui_gui_nam -width 29 + label $id.gnam.dummy2 -text "" -width 1 + pack $id.gnam.head -side top + pack $id.gnam.dummy1 $id.gnam.lab $id.gnam.ent $id.gnam.dummy2 -side left + + frame $id.gnxy + pack $id.gnxy -side top + label $id.gnxy.x_lab -text "x_off:" -width 6 + entry $id.gnxy.x_ent -textvariable $var_iemgui_gn_dx -width 5 + label $id.gnxy.dummy1 -text " " -width 10 + label $id.gnxy.y_lab -text "y_off:" -width 6 + entry $id.gnxy.y_ent -textvariable $var_iemgui_gn_dy -width 5 + pack $id.gnxy.x_lab $id.gnxy.x_ent $id.gnxy.dummy1 \ + $id.gnxy.y_lab $id.gnxy.y_ent -side left + + frame $id.gnfs + pack $id.gnfs -side top + label $id.gnfs.f_lab -text "font:" -width 6 + if {[eval concat $$var_iemgui_gn_f] == 0} { + button $id.gnfs.fb -text "courier" -font {courier 10 bold} -width 7 -command "iemgui_toggle_font $id" } + if {[eval concat $$var_iemgui_gn_f] == 1} { + button $id.gnfs.fb -text "helvetica" -font {helvetica 10 bold} -width 7 -command "iemgui_toggle_font $id" } + if {[eval concat $$var_iemgui_gn_f] == 2} { + button $id.gnfs.fb -text "times" -font {times 10 bold} -width 7 -command "iemgui_toggle_font $id" } + label $id.gnfs.dummy1 -text "" -width 1 + label $id.gnfs.fs_lab -text "fontsize:" -width 8 + entry $id.gnfs.fs_ent -textvariable $var_iemgui_gn_fs -width 5 + pack $id.gnfs.f_lab $id.gnfs.fb $id.gnfs.dummy1 \ + $id.gnfs.fs_lab $id.gnfs.fs_ent -side left + + label $id.col_head -text "--------------colors:--------------" + pack $id.col_head -side top + + frame $id.col_select + pack $id.col_select -side top + radiobutton $id.col_select.radio0 -value 0 -variable $var_iemgui_l2_f1_b0 \ + -text "backgd" -width 5 + radiobutton $id.col_select.radio1 -value 1 -variable $var_iemgui_l2_f1_b0 \ + -text "front" -width 5 + radiobutton $id.col_select.radio2 -value 2 -variable $var_iemgui_l2_f1_b0 \ + -text "label" -width 5 + if { [eval concat $$var_iemgui_fcol] >= 0 } { + pack $id.col_select.radio0 $id.col_select.radio1 $id.col_select.radio2 -side left + } else {pack $id.col_select.radio0 $id.col_select.radio2 -side left} + + frame $id.col_example_choose + pack $id.col_example_choose -side top + button $id.col_example_choose.but -text "compose color" -width 10 \ + -command "iemgui_choose_col_bkfrlb $id" + label $id.col_example_choose.dummy1 -text "" -width 1 + if { [eval concat $$var_iemgui_fcol] >= 0 } { + button $id.col_example_choose.fr_bk -text "o=||=o" -width 5 \ + -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -foreground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] \ + -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] -pady 2 + } else { + button $id.col_example_choose.fr_bk -text "o=||=o" -width 5 \ + -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -foreground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] -pady 2} + button $id.col_example_choose.lb_bk -text "testlabel" -width 7 \ + -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ + -foreground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] \ + -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] -pady 2 + + pack $id.col_example_choose.but $id.col_example_choose.dummy1 \ + $id.col_example_choose.fr_bk $id.col_example_choose.lb_bk -side left + + label $id.space3 -text "------or click color preset:-------" + pack $id.space3 -side top + + frame $id.bcol + pack $id.bcol -side top + foreach i { 0 1 2 3 4 5 6 7 8 9 } hexcol { 16579836 14737632 12369084 \ + 16572640 16572608 16579784 14220504 14220540 14476540 16308476 } { + button $id.bcol.c$i -background [format "#%6.6x" $hexcol] \ + -activebackground [format "#%6.6x" $hexcol] \ + -font {courier 2 normal} -padx 7 -pady 6 \ + -command [format "iemgui_preset_col %s %d" $id $hexcol] } + pack $id.bcol.c0 $id.bcol.c1 $id.bcol.c2 $id.bcol.c3 $id.bcol.c4 \ + $id.bcol.c5 $id.bcol.c6 $id.bcol.c7 $id.bcol.c8 $id.bcol.c9 -side left + + frame $id.fcol + pack $id.fcol -side top + foreach i { 0 1 2 3 4 5 6 7 8 9 } hexcol { 10526880 8158332 6316128 \ + 16525352 16559172 15263784 1370132 2684148 3952892 16003312 } { + button $id.fcol.c$i -background [format "#%6.6x" $hexcol] \ + -activebackground [format "#%6.6x" $hexcol] \ + -font {courier 2 normal} -padx 7 -pady 6 \ + -command [format "iemgui_preset_col %s %d" $id $hexcol] } + pack $id.fcol.c0 $id.fcol.c1 $id.fcol.c2 $id.fcol.c3 $id.fcol.c4 \ + $id.fcol.c5 $id.fcol.c6 $id.fcol.c7 $id.fcol.c8 $id.fcol.c9 -side left + + frame $id.lcol + pack $id.lcol -side top + foreach i { 0 1 2 3 4 5 6 7 8 9 } hexcol { 4210752 2105376 0 \ + 9177096 5779456 7874580 2641940 17488 5256 5767248 } { + button $id.lcol.c$i -background [format "#%6.6x" $hexcol] \ + -activebackground [format "#%6.6x" $hexcol] \ + -font {courier 2 normal} -padx 7 -pady 6 \ + -command [format "iemgui_preset_col %s %d" $id $hexcol] } + pack $id.lcol.c0 $id.lcol.c1 $id.lcol.c2 $id.lcol.c3 $id.lcol.c4 \ + $id.lcol.c5 $id.lcol.c6 $id.lcol.c7 $id.lcol.c8 $id.lcol.c9 -side left + + + label $id.space4 -text "---------------------------------" + pack $id.space4 -side top + + frame $id.cao + pack $id.cao -side top + button $id.cao.cancel -text {Cancel} -width 6 \ + -command "iemgui_cancel $id" + label $id.cao.dummy1 -text "" -width 3 + button $id.cao.apply -text {Apply} -width 6 \ + -command "iemgui_apply $id" + label $id.cao.dummy2 -text "" -width 3 + button $id.cao.ok -text {OK} -width 6 \ + -command "iemgui_ok $id" + pack $id.cao.cancel $id.cao.dummy1 \ + $id.cao.apply $id.cao.dummy2 \ + $id.cao.ok -side left + + label $id.space5 -text "" + pack $id.space5 -side top + + bind $id.dim.w_ent <KeyPress-Return> [concat iemgui_ok $id] + bind $id.dim.h_ent <KeyPress-Return> [concat iemgui_ok $id] + bind $id.rng.min_ent <KeyPress-Return> [concat iemgui_ok $id] + bind $id.rng.max_ent <KeyPress-Return> [concat iemgui_ok $id] + bind $id.para.num_ent <KeyPress-Return> [concat iemgui_ok $id] + bind $id.snd.ent <KeyPress-Return> [concat iemgui_ok $id] + bind $id.rcv.ent <KeyPress-Return> [concat iemgui_ok $id] + bind $id.gnam.ent <KeyPress-Return> [concat iemgui_ok $id] + bind $id.gnxy.x_ent <KeyPress-Return> [concat iemgui_ok $id] + bind $id.gnxy.y_ent <KeyPress-Return> [concat iemgui_ok $id] + bind $id.gnfs.fs_ent <KeyPress-Return> [concat iemgui_ok $id] + bind $id.cao.ok <KeyPress-Return> [concat iemgui_ok $id] + + $id.dim.w_ent select from 0 + $id.dim.w_ent select adjust end + focus $id.dim.w_ent +} +# end of change "iemlib" + +############ pdtk_array_dialog -- dialog window for arrays ######### +proc array_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_array_name [concat array_name_$vid] + global $var_array_name + set var_array_n [concat array_n_$vid] + global $var_array_n + set var_array_saveit [concat array_saveit_$vid] + global $var_array_saveit + set var_array_otherflag [concat array_otherflag_$vid] + global $var_array_otherflag + set mofo [eval concat $$var_array_name] + if {[string index $mofo 0] == "$"} { + set mofo [string replace $mofo 0 0 #] } + + pd [concat $id arraydialog $mofo \ + [eval concat $$var_array_n] \ + [eval concat $$var_array_saveit] \ + [eval concat $$var_array_otherflag] \ + \;] +} + +proc array_cancel {id} { + set cmd [concat $id cancel \;] + pd $cmd +} + +proc array_ok {id} { + array_apply $id + array_cancel $id +} + +proc pdtk_array_dialog {id name n saveit newone} { + set vid [string trimleft $id .] + + set var_array_name [concat array_name_$vid] + global $var_array_name + set var_array_n [concat array_n_$vid] + global $var_array_n + set var_array_saveit [concat array_saveit_$vid] + global $var_array_saveit + set var_array_otherflag [concat array_otherflag_$vid] + global $var_array_otherflag + + set $var_array_name $name + set $var_array_n $n + set $var_array_saveit $saveit + set $var_array_otherflag 0 + + toplevel $id + wm title $id {array} + wm protocol $id WM_DELETE_WINDOW [concat array_cancel $id] + + frame $id.name + pack $id.name -side top + label $id.name.label -text "name" + entry $id.name.entry -textvariable $var_array_name + pack $id.name.label $id.name.entry -side left + + frame $id.n + pack $id.n -side top + label $id.n.label -text "size" + entry $id.n.entry -textvariable $var_array_n + pack $id.n.label $id.n.entry -side left + + checkbutton $id.saveme -text {save contents} -variable $var_array_saveit \ + -anchor w + pack $id.saveme -side top + + if {$newone != 0} { + frame $id.radio + pack $id.radio -side top + radiobutton $id.radio.radio0 -value 0 \ + -variable $var_array_otherflag \ + -text "in new graph" + radiobutton $id.radio.radio1 -value 1 \ + -variable $var_array_otherflag \ + -text "in last graph" + pack $id.radio.radio0 -side top -anchor w + pack $id.radio.radio1 -side top -anchor w + } else { + checkbutton $id.deleteme -text {delete me} \ + -variable $var_array_otherflag -anchor w + pack $id.deleteme -side top + } + frame $id.buttonframe + pack $id.buttonframe -side bottom -fill x -pady 2m + button $id.buttonframe.cancel -text {Cancel}\ + -command "array_cancel $id" + if {$newone == 0} {button $id.buttonframe.apply -text {Apply}\ + -command "array_apply $id"} + button $id.buttonframe.ok -text {OK}\ + -command "array_ok $id" + pack $id.buttonframe.cancel -side left -expand 1 + if {$newone == 0} {pack $id.buttonframe.apply -side left -expand 1} + pack $id.buttonframe.ok -side left -expand 1 + + bind $id.name.entry <KeyPress-Return> [concat array_ok $id] + bind $id.n.entry <KeyPress-Return> [concat array_ok $id] + $id.name.entry select from 0 + $id.name.entry select adjust end + focus $id.name.entry +} + +############ pdtk_canvas_dialog -- dialog window for canvass ######### +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 + pd [concat $id donecanvasdialog \ + [eval concat $$var_canvas_xscale] \ + [eval concat $$var_canvas_yscale] \ + [eval concat $$var_canvas_graphme] \ + \;] +} + +proc canvas_cancel {id} { + set cmd [concat $id cancel \;] + pd $cmd +} + +proc canvas_ok {id} { + canvas_apply $id + canvas_cancel $id +} + +proc pdtk_canvas_dialog {id xscale yscale graphme stretch} { + 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_stretch [concat canvas_stretch_$vid] +# global $var_canvas_stretch + + set $var_canvas_xscale $xscale + set $var_canvas_yscale $yscale + set $var_canvas_graphme $graphme +# set $var_canvas_stretch $stretch + + toplevel $id + wm title $id {canvas} + wm protocol $id WM_DELETE_WINDOW [concat canvas_cancel $id] + + frame $id.xscale + pack $id.xscale -side top + label $id.xscale.label -text "X units per pixel" + entry $id.xscale.entry -textvariable $var_canvas_xscale -width 10 + pack $id.xscale.label $id.xscale.entry -side left + + frame $id.yscale + pack $id.yscale -side top + label $id.yscale.label -text "Y units per pixel" + entry $id.yscale.entry -textvariable $var_canvas_yscale -width 10 + pack $id.yscale.label $id.yscale.entry -side left + + checkbutton $id.graphme -text {graph on parent} \ + -variable $var_canvas_graphme -anchor w + 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.buttonframe + pack $id.buttonframe -side bottom -fill x -pady 2m + button $id.buttonframe.cancel -text {Cancel}\ + -command "canvas_cancel $id" + button $id.buttonframe.apply -text {Apply}\ + -command "canvas_apply $id" + button $id.buttonframe.ok -text {OK}\ + -command "canvas_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 + + bind $id.xscale.entry <KeyPress-Return> [concat canvas_ok $id] + bind $id.yscale.entry <KeyPress-Return> [concat canvas_ok $id] + $id.xscale.entry select from 0 + $id.xscale.entry select adjust end + focus $id.xscale.entry +} + +############ pdtk_data_dialog -- run a data dialog ######### +proc dodata_send {name} { +# puts stderr [$name.text get 0.0 end] + + for {set i 1} {[$name.text compare [concat $i.0 + 3 chars] < end]} \ + {incr i 1} { +# puts stderr [concat it's [$name.text get $i.0 [expr $i + 1].0]] + set cmd [concat $name data [$name.text get $i.0 [expr $i + 1].0] \;] +# puts stderr $cmd + pd $cmd + } + set cmd [concat $name end \;] +# puts stderr $cmd + pd $cmd +} + +proc dodata_cancel {name} { + set cmd [concat $name cancel \;] +# puts stderr $cmd + pd $cmd +} + +proc dodata_ok {name} { + dodata_send $name + dodata_cancel $name +} + +proc pdtk_data_dialog {name stuff} { + + toplevel $name + wm title $name {Atom} + wm protocol $name WM_DELETE_WINDOW [concat dodata_cancel $name] + + frame $name.buttonframe + pack $name.buttonframe -side bottom -fill x -pady 2m + button $name.buttonframe.send -text {Send (Ctrl s)}\ + -command [concat dodata_send $name] + button $name.buttonframe.ok -text {OK (Ctrl t)}\ + -command [concat dodata_ok $name] + pack $name.buttonframe.send -side left -expand 1 + pack $name.buttonframe.ok -side left -expand 1 + + text $name.text -relief raised -bd 2 -height 40 -width 60 \ + -yscrollcommand "$name.scroll set" -font fixed + scrollbar $name.scroll -command "$name.text yview" + pack $name.scroll -side right -fill y + pack $name.text -side left -fill both -expand 1 + $name.text insert end $stuff + focus $name.text + bind $name.text <Control-t> [concat dodata_ok $name] + bind $name.text <Control-s> [concat dodata_send $name] +} + +############ check or uncheck the "edit" menu item ############## +#####################iemlib####################### +proc pdtk_canvas_editval {name value} { + if { $value } { + $name.m.edit.m entryconfigure "Edit mode" -indicatoron true + } else { + $name.m.edit.m entryconfigure "Edit mode" -indicatoron false + } +} + +proc pdtk_canvas_protectval {name value} { + if { $value } { + $name.m.edit.m entryconfigure "Protect" -indicatoron true + } else { + $name.m.edit.m entryconfigure "Protect" -indicatoron false + } +} +#####################iemlib####################### + +############ pdtk_text_new -- create a new text object #2########### +proc pdtk_text_new {canvasname myname x y text font color} { +# if {$font < 13} {set fontname [format fixed $font]} +# if {$font >= 13} {set fontname [format fixed $font]} + $canvasname create text $x $y \ + -font [format fixed $font] \ + -tags $myname -text $text -fill $color -anchor nw +# pd [concat $myname size [$canvasname bbox $myname] \;] +} + +################ pdtk_text_set -- change the text ################## +proc pdtk_text_set {canvasname myname text} { + $canvasname itemconfig $myname -text $text +# pd [concat $myname size [$canvasname bbox $myname] \;] +} + +############### event binding procedures for Pd window ################ + +proc pdtk_pd_ctrlkey {name key shift} { +# puts stderr [concat key $key shift $shift] +# .dummy itemconfig goo -text [concat ---> control-key event $key]; + if {$key == "n" || $key == "N"} {menu_new} + if {$key == "o" || $key == "O"} {menu_open} + if {$key == "m" || $key == "M"} {menu_send} + if {$key == "q" || $key == "Q"} { + if {$shift == 1} {menu_really_quit} else {menu_quit} + } + if {$key == "slash"} {menu_audio 1} + if {$key == "period"} {menu_audio 0} +} + +######### startup function. ############## +# Tell pd the current directory; this is used in case the command line +# asked pd to open something. Also, get character width and height for +# font sizes 8, 10, 12, 14, 16, and 24. + +proc pdtk_pd_startup {version} { + global pd_myversion + set pd_myversion $version + + set width1 [font measure fixed x] + set height1 [lindex [font metrics fixed] 5] + + set width2 [font measure fixed x] + set height2 [lindex [font metrics fixed] 5] + + set width3 [font measure fixed x] + set height3 [lindex [font metrics fixed] 5] + + set width4 [font measure fixed x] + set height4 [lindex [font metrics fixed] 5] + + set width5 [font measure fixed x] + set height5 [lindex [font metrics fixed] 5] + + set width6 [font measure fixed x] + set height6 [lindex [font metrics fixed] 5] + + set width7 [font measure fixed x] + set height7 [lindex [font metrics fixed] 5] + + pd [concat pd init [pdtk_enquote [pwd]] \ + 8 $width1 $height1 \ + 10 $width2 $height2 \ + 12 $width3 $height3 \ + 14 $width4 $height4 \ + 16 $width5 $height5 \ + 24 $width6 $height6 \ + 36 $width7 $height7 \ + \;]; +} + +##################### DSP ON/OFF, METERS, DIO ERROR ################### +proc pdtk_pd_dsp {value} { + global ctrls_audio_on + if {$value == "ON"} {set ctrls_audio_on 1} else {set ctrls_audio_on 0} +# puts stderr [concat its $ctrls_audio_on] +} + +proc pdtk_pd_meters {indb outdb inclip outclip} { +# puts stderr [concat meters $indb $outdb $inclip $outclip] + global ctrls_inlevel ctrls_outlevel + set ctrls_inlevel $indb + if {$inclip == 1} { + .controls.in.clip configure -background red + } else { + .controls.in.clip configure -background grey + } + set ctrls_outlevel $outdb + if {$outclip == 1} { + .controls.out.clip configure -background red + } else { + .controls.out.clip configure -background grey + } + +} + +proc pdtk_pd_dio {red} { +# puts stderr [concat dio $red] + if {$red == 1} { + .controls.dio configure -background red -activebackground red + } else { + .controls.dio configure -background grey -activebackground lightgrey + } + +} + +############# text editing from the "edit" menu ################### +set edit_number 1 + +proc texteditor_send {name} { + set topname [string trimright $name .text] + for {set i 0} \ + {[$name compare [concat 0.0 + [expr $i + 1] chars] < end]} \ + {incr i 1} { + set cha [$name get [concat 0.0 + $i chars]] + scan $cha %c keynum + pd [concat pd key 1 $keynum \;] + } +} + +proc texteditor_ok {name} { + set topname [string trimright $name .text] + texteditor_send $name + destroy $topname +} + + +proc pdtk_pd_texteditor {stuff} { + global edit_number + set name [format ".text%d" $edit_number] + set edit_number [expr $edit_number + 1] + + toplevel $name + wm title $name {TEXT} + + frame $name.buttons + pack $name.buttons -side bottom -fill x -pady 2m + button $name.buttons.send -text {Send (Ctrl s)}\ + -command "texteditor_send $name.text" + button $name.buttons.ok -text {OK (Ctrl t)}\ + -command "texteditor_ok $name.text" + pack $name.buttons.send -side left -expand 1 + pack $name.buttons.ok -side left -expand 1 + + text $name.text -relief raised -bd 2 -height 12 -width 60 \ + -yscrollcommand "$name.scroll set" -font fixed + scrollbar $name.scroll -command "$name.text yview" + pack $name.scroll -side right -fill y + pack $name.text -side left -fill both -expand 1 + $name.text insert end $stuff + focus $name.text + bind $name.text <Control-t> {texteditor_ok %W} + bind $name.text <Control-s> {texteditor_send %W} +} + +############# open and save dialogs for objects in Pd ########## + +proc pdtk_openpanel {target} { + global pd_opendir + global pd_nt + if {$pd_nt == 2} { + cd $pd_opendir + set filename [tk_getOpenFile ] + } else { + set filename [tk_getOpenFile \ + -initialdir $pd_opendir] + } + if {$filename != ""} { + set directory [string range $filename 0 \ + [expr [string last / $filename ] - 1]] + set pd_opendir $directory + + pd [concat $target symbol [pdtk_enquote $filename] \;] + } +} + +proc pdtk_savepanel {target} { + set filename [tk_getSaveFile] + if {$filename != ""} { + pd [concat $target symbol [pdtk_enquote $filename] \;] + } +} + +########################### comport hack ######################## + +set com1 0 +set com2 0 +set com3 0 +set com4 0 + +proc com1_open {} { + global com1 + set com1 [open com1 w] + .dummy itemconfig goo -text $com1 + fconfigure $com1 -buffering none + fconfigure $com1 -mode 19200,e,8,2 +} + +proc com1_send {str} { + global com1 + puts -nonewline $com1 $str +} + + +############# start a polling process to watch the socket ############## +# this is needed for nt, and presumably for Mac as well. +# in UNIX this is handled by a tcl callback (set up in t_tkcmd.c) + +if {$pd_nt == 1} { + proc polleofloop {} { + pd_pollsocket + after 20 polleofloop + } + + polleofloop +} + diff --git a/pd/src/z.pd b/pd/src/z.pd index 09812537..a415176c 100644 --- a/pd/src/z.pd +++ b/pd/src/z.pd @@ -1,41 +1,31 @@ -#N canvas 471 67 626 431 10; -#X obj 30 45 vsl 15 128 0 127 0 0 empty empty empty 20 8 0 8 -262144 --1 -1 2200 1; -#X obj 83 132 vsl 15 128 0 127 0 0 empty empty empty 20 8 0 8 -262144 --1 -1 2200 1; -#X obj 527 56 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1 -; -#X obj 421 222 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 -1; -#X obj 405 241 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 -1; -#X obj 358 219 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 -1; -#N canvas 0 0 450 300 graph1 0; -#X array array1 100 float 1; -#A 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 -0.0142856 -0.0428569 -0.0714282 -0.128571 -0.185713 -0.233332 --0.280951 -0.32857 -0.366665 -0.40476 -0.442855 -0.482415 -0.521975 --0.561535 -0.601096 -0.640656 -0.680216 -0.719776 -0.759336 -0.798897 --0.838457 -0.878017 -0.917577 -0.957137 -0.985709 -1.02857 -0.285713 --0.0857139 -0.0285714 0.0285711 0.157142 0.299998 0.357141 0.442854 -0.490473 0.538092 0.628568 0.628568 0.642853 0.657139 0.657139 0.657139 -0.642853 0.599996 0.566663 0.53333 0.499997 0.471426 0.442854 0.414283 -0.364283 0.314284 0.271427 0.235713 0.199999 0.157142 0.12857 0.109523 -0.0904755 0.071428 0.0428567 0.0142854 -2.0396e-07 -2.0396e-07 0 0 -; -#X coords 0 -1 99 1 200 140 1; -#X restore 115 241 graph; -#X msg 424 249 \; array1 ylabel -10 -1 1; -#X floatatom 94 47 5 0 0; -#X floatatom 202 29 5 0 0; -#N canvas 468 345 450 300 foo3 0; -#X obj 100 117 spigot; -#X obj 265 75 r foo1; -#X obj 259 114 +; -#X connect 1 0 2 0; -#X restore 356 29 pd foo3; -#X obj 230 59 z2 \$0-doo; -#X msg 503 105 \; foo1 sdf; -#X connect 0 0 11 0; -#X connect 11 0 1 0; +#N canvas 176 287 548 368 12; +#X obj 51 82 vradio 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1 +-1 0; +#X obj 110 93 vdl 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1 -1 +0; +#X obj 78 240 vradio 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1 +-1 0; +#X floatatom 149 52 5 0 0 0 - - -; +#X floatatom 240 177 5 0 0 0 - - -; +#X obj 361 97 vradio 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1 +-1 0; +#X floatatom 374 257 5 0 0 0 - - -; +#X obj 252 280 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 +-262144 -1 -1 0 256; +#X floatatom 478 73 5 0 0 0 receive asd -; +#X floatatom 241 241 5 0 0 0 - - -; +#X floatatom 477 102 5 0 0 0 send - fgdfh; +#X floatatom 474 141 5 0 0 0 both wer rty; +#X obj 242 120; +#X floatatom 287 111 5 0 0 0 - - -; +#X obj 186 116 + 5; +#X obj 172 311 expr~ $v1 + 4; +#X connect 3 0 1 0; +#X connect 3 0 0 0; +#X connect 3 0 5 0; +#X connect 3 0 14 0; +#X connect 4 0 2 0; +#X connect 5 0 6 0; +#X connect 9 0 7 0; +#X connect 14 0 4 0; +#X coords 0 0 1 1 300 200 1; diff --git a/pd/src/z2.pd b/pd/src/z2.pd index 1f36fbf3..cd1e0745 100644 --- a/pd/src/z2.pd +++ b/pd/src/z2.pd @@ -1,12 +1,25 @@ -#N canvas 682 208 558 499 10; -#X obj 225 80 inlet; -#X obj 119 198 outlet; -#X obj 109 160 hsl 128 15 0 127 0 0 empty empty empty 20 8 0 8 -262144 --1 -1 0 1; -#X floatatom 495 43 5 0 0; -#N canvas 0 0 450 300 foo3 0; -#X restore 82 78 pd foo3; -#X obj 54 151 print; -#X connect 0 0 2 0; -#X connect 2 0 1 0; -#X coords 0 0 1 1 200 140 1; +#N canvas 176 287 548 368 12; +#X obj 51 82 vradio 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1 +-1 0; +#X obj 150 82 vdl 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1 -1 +0; +#X obj 78 240 vradio 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1 +-1 0; +#X floatatom 149 52 5 0 0 0 - - -; +#X floatatom 244 182 5 0 0 0 - - -; +#X obj 361 97 vradio 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1 +-1 0; +#X floatatom 374 257 5 0 0 0 - - -; +#X obj 256 285 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 +-262144 -1 -1 0 256; +#X floatatom 478 73 5 0 0 0 receive asd -; +#X floatatom 245 246 5 0 0 0 - - -; +#X floatatom 475 156 5 0 0 0 send weghg -; +#X floatatom 466 220 5 0 0 0 both - rty; +#X connect 3 0 1 0; +#X connect 3 0 0 0; +#X connect 3 0 5 0; +#X connect 4 0 2 0; +#X connect 5 0 6 0; +#X connect 9 0 7 0; +#X coords 0 0 1 1 300 200 1; diff --git a/pd/src/z3.pd b/pd/src/z3.pd index ee8dc6f6..76e698de 100644 --- a/pd/src/z3.pd +++ b/pd/src/z3.pd @@ -1,3 +1,14 @@ -#N canvas 408 176 626 431 12; -#X obj 104 154 z4 foo; -#X obj 102 200 z4 baz; +#N canvas 409 180 735 452 12; +#X floatatom 267 57 0 0 0 1 input-dB - -; +#X obj 267 82 r tuning; +#X obj 267 129 r rest; +#X obj 267 35 r in-DB; +#X floatatom 267 104 0 0 0 1 tuning - -; +#X obj 267 10 tgl 20 0 meters set-meters meters 24 8 192 12 -262144 +-1 -1 0 1; +#X obj 267 152 tgl 20 0 empty empty rest 24 8 0 12 -262144 -1 -1 0 +1; +#X connect 1 0 4 0; +#X connect 2 0 6 0; +#X connect 3 0 0 0; +#X coords 0 0 1 1 300 200 1; |