aboutsummaryrefslogtreecommitdiff
path: root/pd
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2009-01-02 19:40:36 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2009-01-02 19:40:36 +0000
commit781d1bc4ab8fc9fa55485d3c35bb1ba7fd6774c3 (patch)
tree0ed8e60689e7afae65cf668b63face8807226fc3 /pd
parenta7f56f2c7b0c44912f7fb772c64f547a8c0e0ae3 (diff)
release 0.42-0
svn path=/trunk/; revision=10471
Diffstat (limited to 'pd')
-rw-r--r--pd/doc/1.manual/x5.htm46
-rw-r--r--pd/extra/bonk~/bonk~-help.pd221
-rw-r--r--pd/extra/bonk~/bonk~.c47
-rw-r--r--pd/src/g_editor.c104
-rw-r--r--pd/src/m_pd.h2
-rw-r--r--pd/src/notes.txt9
-rw-r--r--pd/src/u_main.tk28
-rw-r--r--pd/src/x_gui.c2
8 files changed, 298 insertions, 161 deletions
diff --git a/pd/doc/1.manual/x5.htm b/pd/doc/1.manual/x5.htm
index 9590be4a..45dd43c9 100644
--- a/pd/doc/1.manual/x5.htm
+++ b/pd/doc/1.manual/x5.htm
@@ -22,7 +22,50 @@
<P> ------------------ 0.42 ---------------------------
-<P> print takes "-n" flag to supperss "print:" in output
+<P> The 'struct' object can now be used to catch a small but growing variety of
+events (mouse clicks on data, selection/deselection).
+
+<P> The 'tabread4~' object was fixed to allow message-time onset into the table.
+This makes it possible (at last) to use tabread4~ effectively with large (> 1
+second) samples. New help files 3.audio.examples/B15 and B16 show how to
+use it. It's not pretty but it's at least possible.
+
+<P> Took patches from Iohannes Zmoelnig to make Pd work when compiled to use
+64-bit floating-point audio. I didn't test this; doubtless there will still be
+some problems. (This isn't the same thing as running in '64 bit mode' which
+already works fine and is the default when compiled on a 64-bit linux machine.)
+
+<P> New objects in extra, 'pd~', and 'stdout', allow running a separate Pd
+instance in a sub-process. Theoretically this should make it possible to use
+multiprocessors efficiently in {d. It's still somewhat experimental; it might
+not work well to pass large numbers of messages and/or signals back and forth.
+
+<P> A -batch flag allows Pd to be run efficiently from scripts. You should
+probably also specify -nosound. With these flags Pd runs as quickly as it
+can without waiting for real time. It's up to the patch to arrange to exit
+at the appropriate time via a 'pd quit' message.
+
+<P> Large and sweeping improvements have been made to bonk~ and sigmund~. The
+new bonk~ features are documented in its help window; sigmund~ works better but
+has the same old features.
+
+<P> Closing and quiting Pd now act more politely, querying the user only if
+there are edited windows. There's also a query if the user types into a box
+holding an edited abstraction to prevent the changes from getting lost
+accidentally. A new 'pd perf' message re-enables the old "really close this
+window" behavior, which is appropriate for performances where you don't want the
+wrong keyclick to stop Pd brusquely.
+
+<P> The process of reloading multiple copies of a modified abstraction was
+sped up.
+
+<P> The 'find' dialog permits searching for substrings. This is useful for
+strings containing "$" arguments, where it's unclear what 'find' does or should
+do.
+
+<P> New pow~, log~, exp~, abs~, and 'wrap' objects.
+
+<P> The 'print' object takes "-n" flag to supperss "print:" in output
<P> "clear" button in Pd output window
@@ -34,6 +77,7 @@ delay time when asked to.
<P> Binbufs fixed to handle arbitrary length messages. (This fixed a problem
reloading data structures with huge arrays).
+<P> various fixes to
<P> ------------------ 0.41-3,4 ---------------------------
<P> 2 fixes for PC: no bonk~, and the audio device selection
diff --git a/pd/extra/bonk~/bonk~-help.pd b/pd/extra/bonk~/bonk~-help.pd
index e4bbb827..b1b93f62 100644
--- a/pd/extra/bonk~/bonk~-help.pd
+++ b/pd/extra/bonk~/bonk~-help.pd
@@ -1,13 +1,11 @@
-#N canvas 304 143 967 599 12;
-#X obj 358 544 spigot;
-#X msg 442 397 bang;
-#X obj 428 508 bonk~;
-#X msg 442 214 learn 1;
-#X msg 442 274 learn 0;
-#X msg 446 451 print;
-#X obj 390 437 adc~;
-#X msg 613 558 \; pd dsp 1;
-#X obj 276 544 spigot;
+#N canvas 33 37 964 579 12;
+#X obj 382 492 spigot;
+#X msg 452 292 bang;
+#X obj 452 456 bonk~;
+#X msg 452 359 print;
+#X obj 396 429 adc~;
+#X msg 637 506 \; pd dsp 1;
+#X obj 300 492 spigot;
#N canvas 366 126 604 404 synth 0;
#X obj 112 24 r bonk-cooked;
#X obj 112 49 unpack;
@@ -59,67 +57,36 @@
#X connect 21 0 1 0;
#X connect 22 0 6 0;
#X connect 23 0 9 0;
-#X restore 845 575 pd synth;
-#X floatatom 845 552 0 0 0 0 - - -;
-#X msg 845 522 0;
-#X msg 442 244 learn 10;
-#X msg 442 304 forget;
-#X msg 442 334 write templates.txt;
-#X msg 442 364 read templates.txt;
-#X msg 876 522 90;
-#X msg 442 81 thresh 6 50;
-#X text 8 56 The Bonk object takes an audio signal input and looks
-for "attacks" defined as sharp changes in the spectral envelope of
-the incoming sound. Optionally \, and less reliably \, you can have
-Bonk check the attack against a collection of stored templates to try
-to guess which of two or more instruments was hit. Bonk is described
-theoretically in the 1998 ICMC proceedings \, reprinted on http://man104nfs.ucsd.edu/~mpuckett.
-;
-#X text 601 524 click here;
-#X text 602 537 to start DSP;
-#X text 8 377 In this patch \, after starting DSP \, you can print
+#X restore 869 523 pd synth;
+#X floatatom 869 500 0 0 0 0 - - -;
+#X msg 869 470 0;
+#X msg 900 470 90;
+#X text 625 472 click here;
+#X text 626 485 to start DSP;
+#X text 5 284 In this patch \, after starting DSP \, you can print
out the raw or cooked output using the two "spigots" or listen to a
synthesizer output by raising its volume.;
-#X text 746 521 output volume;
-#X text 760 539 (0-100);
-#X msg 442 150 mask 4 0.7;
-#X msg 442 184 debounce 0;
-#X text 8 309 Bonk's analysis is carried out on a 256-point window
-(6 msec at 44.1 kHz) and by default the analysis period is 128 samples.
-The analysis period can be specified as Bonk's creation argument but
-must be a multiple of 64;
-#X text 532 185 Minimum time (msec) between attacks;
-#X text 526 136 Describes how energy in each frequency band masks later
+#X text 770 469 output volume;
+#X text 784 487 (0-100);
+#X msg 452 140 mask 4 0.7;
+#X text 547 122 Describes how energy in each frequency band masks later
energy in the band. Here the masking is total for 4 analysis periods
and then drops by 0.7 each period.;
-#X text 530 214 Forget all templates and start learning new ones. The
-argument gives the number of times you will hit each instrument (10
-recommended.) Turn on the output volume above for audible feedback
-as you train Bonk. "Learn 0" exits learn mode.;
-#X text 530 298 Forget the last template. In Learn mode \, use "forget"
-to erase and record over a template.;
-#X text 595 334 Write templates to a file in text-editable format.
-;
-#X text 596 364 Read templates from a file.;
-#X text 514 450 Print out all settings and templates.;
-#X msg 442 120 minvel 10;
-#X text 514 392 Poll the current spectrum via "raw" outlet \, You can
+#X text 497 288 Poll the current spectrum via "raw" outlet \, You can
set a very high threshold if you don't want attacks mixed in.;
-#X msg 437 426 debug 0;
-#X text 514 426 turn debugging on or off.;
-#X obj 325 545 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+#X msg 452 333 debug 0;
+#X text 530 333 turn debugging on or off.;
+#X obj 349 493 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
-#X obj 407 545 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+#X obj 431 493 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
-#X obj 358 574 print cooked;
-#X obj 276 574 print raw;
-#X text 158 545 enable printout:;
-#X text 530 121 Minimum "velocity" to output (quieter notes are ignored.)
-;
-#X obj 461 533 s bonk-cooked;
-#X text 218 12 BONK~ - an attack detector for small percussion instruments
+#X obj 382 522 print cooked;
+#X obj 300 522 print raw;
+#X text 182 493 enable printout:;
+#X text 529 204 Minimum "velocity" to output (quieter notes are ignored.)
;
-#X text 8 174 Bonk's two outputs are the raw spectrum of the attack
+#X obj 485 481 s bonk-cooked;
+#X text 8 144 Bonk's two outputs are the raw spectrum of the attack
(provided as a list of 11 numbers giving the signal "loudness" in the
11 frequency bands used) \, and the "cooked" output which gives only
an instrument number (counting up from zero) and a "velocity". This
@@ -127,36 +94,116 @@ an instrument number (counting up from zero) and a "velocity". This
bands \, normalized so that 100 is an attack of amplitude of about
1 The instrument number is significant only if Bonk has a "template
set" in memory.;
-#X text 531 47 Set low and high thresholds. Signal growth must exceed
+#X text 549 37 Set low and high thresholds. Signal growth must exceed
the high one and then fall to the low one to make an attack. The unit
is the sum of the proportional growth in the 11 filter bands. Proportional
growth is essentially the logarithmic time derivative.;
-#X text 238 27 (NOTE: this documentation does not yet describe new
-features for Pd 0.42).;
-#X msg 446 479 print 1;
-#X text 514 481 print out filterbank settings;
-#X connect 0 0 40 0;
+#X msg 452 386 print 1;
+#X text 520 388 print out filterbank settings;
+#X text 9 32 The Bonk object takes an audio signal input and looks
+for "attacks" defined as sharp changes in the spectral envelope of
+the incoming sound. Optionally \, and less reliably \, you can have
+Bonk check the attack against a collection of stored templates to try
+to guess which of two or more instruments was hit. Bonk is described
+theoretically in the 1998 ICMC proceedings \, reprinted on crca.ucsd.edu/~msp
+.;
+#N canvas 422 63 701 719 creation-arguments 0;
+#X text 228 14 creation arguments for bonk~;
+#X text 70 272 -npts 256;
+#X text 44 244 default value:;
+#X text 70 308 -hop 128;
+#X text 70 342 -nfilters 11;
+#X text 68 380 -halftones 6;
+#X text 76 514 -overlap 1;
+#X text 79 567 -firstbin 1;
+#X text 71 454 -minbandwidth 1.5;
+#X text 122 147 All frequency parameters are specified in 'bins'. One
+bin is the sample rate divided by the window size. The minimum possible
+bandwidth is 1.5 bins. Higher bandwidths give numerically more robust
+outputs.;
+#X text 43 229 Arguments and;
+#X text 212 270 window size in points;
+#X text 210 306 analysis period ("hop size") in points;
+#X text 212 340 number of filters to use;
+#X text 212 379 desired bandwidth of filters in halftones \, effective
+in the exponentially spaced region. (At lower center frequencies the
+bandwidth is supported by the "minbandwidth" parameter below).;
+#X text 212 511 overlap factor between filters. If 1 \, the filters
+are spaced to line up at their half-power points. Other values specify
+more or fewer filters proportionally.;
+#X text 121 49 bonk~ uses a filterbank whose center frequencies are
+spaced equally at low frequencies and proportionally at high ones -
+i.e. \, they increase linearly \, then exponentially. They are determined
+by the filters' bandwidths and overlap. The bandwidths are specified
+proportionally to frequency but bounded below by a specified minimum.
+;
+#X text 210 455 minimum bandwidth in bins. If the bandwidth specified
+by "halftones" is smaller than this \, this value is used. This must
+be at least 1.5.;
+#X text 212 567 center frequency \, in bins \, of the lowest filter.
+The others are computed from this.;
+#X restore 147 414 pd creation-arguments;
+#N canvas 660 173 579 589 templates 0;
+#X msg 76 197 learn 0;
+#X msg 76 227 forget;
+#X msg 76 257 write templates.txt;
+#X msg 76 287 read templates.txt;
+#X msg 76 107 debounce 0;
+#X msg 76 137 learn 10;
+#X obj 62 431 outlet;
+#X text 155 133 Forget all templates and start learning new ones. The
+argument gives the number of times you will hit each instrument (10
+recommended.) Turn on the output volume above for audible feedback
+as you train Bonk. "Learn 0" exits learn mode.;
+#X text 155 217 Forget the last template. In Learn mode \, use "forget"
+to erase and record over a template.;
+#X text 220 253 Write templates to a file in text-editable format.
+;
+#X text 221 283 Read templates from a file.;
+#X text 157 104 Minimum time (msec) between attacks in learn mode;
+#X connect 0 0 6 0;
+#X connect 1 0 6 0;
+#X connect 2 0 6 0;
+#X connect 3 0 6 0;
+#X connect 4 0 6 0;
+#X connect 5 0 6 0;
+#X restore 469 423 pd templates;
+#X msg 452 70 thresh 2.5 5;
+#X msg 452 175 attack-frames 1;
+#X text 574 176 number of frames over which to measure growth;
+#X text 564 423 more messages for managing templates;
+#X msg 452 203 minvel 7;
+#X msg 452 230 spew 0;
+#X text 519 232 Turn spew mode on/off;
+#X msg 452 257 useloudness 0;
+#X text 558 265 experimental: use alternative loudness units;
+#X text 212 9 BONK~ - attack detection and spectral envelope measurement
+;
+#X text 734 552 Updated for Pd version 0.42;
+#X text 5 343 By default bonk's analysis is carried out on a 256-point
+window (6 msec at 44.1 kHz) and the analysis period is 128 samples.
+These and other parameters may be overridden using creation arguments
+as shown in the subpatch below:;
+#X text 521 358 Print out settings and templates.;
+#X connect 0 0 23 0;
#X connect 1 0 2 0;
-#X connect 2 0 8 0;
+#X connect 2 0 6 0;
#X connect 2 1 0 0;
-#X connect 2 1 44 0;
+#X connect 2 1 27 0;
#X connect 3 0 2 0;
#X connect 4 0 2 0;
-#X connect 5 0 2 0;
-#X connect 6 0 2 0;
-#X connect 8 0 41 0;
-#X connect 10 0 9 0;
-#X connect 11 0 10 0;
-#X connect 12 0 2 0;
-#X connect 13 0 2 0;
-#X connect 14 0 2 0;
-#X connect 15 0 2 0;
-#X connect 16 0 10 0;
-#X connect 17 0 2 0;
-#X connect 24 0 2 0;
-#X connect 25 0 2 0;
+#X connect 6 0 24 0;
+#X connect 8 0 7 0;
+#X connect 9 0 8 0;
+#X connect 10 0 8 0;
+#X connect 16 0 2 0;
+#X connect 19 0 2 0;
+#X connect 21 0 6 1;
+#X connect 22 0 0 1;
+#X connect 30 0 2 0;
#X connect 34 0 2 0;
+#X connect 35 0 2 0;
#X connect 36 0 2 0;
-#X connect 38 0 8 1;
-#X connect 39 0 0 1;
-#X connect 49 0 2 0;
+#X connect 39 0 2 0;
+#X connect 40 0 2 0;
+#X connect 42 0 2 0;
diff --git a/pd/extra/bonk~/bonk~.c b/pd/extra/bonk~/bonk~.c
index 369d9e38..6776b2e2 100644
--- a/pd/extra/bonk~/bonk~.c
+++ b/pd/extra/bonk~/bonk~.c
@@ -876,7 +876,7 @@ static void bonk_print(t_bonk *x, t_floatarg f)
int i;
post("thresh %f %f", x->x_lothresh, x->x_hithresh);
post("mask %d %f", x->x_masktime, x->x_maskdecay);
- post("attack-bins %d", x->x_attackbins);
+ post("attack-frames %d", x->x_attackbins);
post("debounce %f", x->x_debouncedecay);
post("minvel %f", x->x_minvel);
post("spew %d", x->x_spew);
@@ -1143,23 +1143,38 @@ static void *bonk_new(t_symbol *s, int argc, t_atom *argv)
void bonk_tilde_setup(void)
{
- bonk_class = class_new(gensym("bonk~"), (t_newmethod)bonk_new, (t_method)bonk_free, sizeof(t_bonk), 0, A_GIMME, 0);
+ bonk_class = class_new(gensym("bonk~"), (t_newmethod)bonk_new,
+ (t_method)bonk_free, sizeof(t_bonk), 0, A_GIMME, 0);
class_addmethod(bonk_class, nullfn, gensym("signal"), 0);
class_addmethod(bonk_class, (t_method)bonk_dsp, gensym("dsp"), 0);
class_addbang(bonk_class, bonk_bang);
- class_addmethod(bonk_class, (t_method)bonk_learn, gensym("learn"), A_FLOAT, 0);
+ class_addmethod(bonk_class, (t_method)bonk_learn,
+ gensym("learn"), A_FLOAT, 0);
class_addmethod(bonk_class, (t_method)bonk_forget, gensym("forget"), 0);
- class_addmethod(bonk_class, (t_method)bonk_thresh, gensym("thresh"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_mask, gensym("mask"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_debounce, gensym("debounce"), A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_minvel, gensym("minvel"), A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_print, gensym("print"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_debug, gensym("debug"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_spew, gensym("spew"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_useloudness, gensym("useloudness"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_attackbins, gensym("attack-bins"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_read, gensym("read"), A_SYMBOL, 0);
- class_addmethod(bonk_class, (t_method)bonk_write, gensym("write"), A_SYMBOL, 0);
+ class_addmethod(bonk_class, (t_method)bonk_thresh,
+ gensym("thresh"), A_FLOAT, A_FLOAT, 0);
+ class_addmethod(bonk_class, (t_method)bonk_mask,
+ gensym("mask"), A_FLOAT, A_FLOAT, 0);
+ class_addmethod(bonk_class, (t_method)bonk_debounce,
+ gensym("debounce"), A_FLOAT, 0);
+ class_addmethod(bonk_class, (t_method)bonk_minvel,
+ gensym("minvel"), A_FLOAT, 0);
+ class_addmethod(bonk_class, (t_method)bonk_print,
+ gensym("print"), A_DEFFLOAT, 0);
+ class_addmethod(bonk_class, (t_method)bonk_debug,
+ gensym("debug"), A_DEFFLOAT, 0);
+ class_addmethod(bonk_class, (t_method)bonk_spew,
+ gensym("spew"), A_DEFFLOAT, 0);
+ class_addmethod(bonk_class, (t_method)bonk_useloudness,
+ gensym("useloudness"), A_DEFFLOAT, 0);
+ class_addmethod(bonk_class, (t_method)bonk_attackbins,
+ gensym("attack-bins"), A_DEFFLOAT, 0);
+ class_addmethod(bonk_class, (t_method)bonk_attackbins,
+ gensym("attack-frames"), A_DEFFLOAT, 0);
+ class_addmethod(bonk_class, (t_method)bonk_read,
+ gensym("read"), A_SYMBOL, 0);
+ class_addmethod(bonk_class, (t_method)bonk_write,
+ gensym("write"), A_SYMBOL, 0);
post("bonk version 1.3");
}
#endif
@@ -1225,8 +1240,8 @@ int main()
attr = attr_offset_new("useloudness", sym_long, attrflags, (method)0L, (method)bonk_useloudness_set, calcoffset(t_bonk, x_useloudness));
class_addattr(c, attr);
-
- attr = attr_offset_new("attackbins", sym_long, attrflags, (method)0L, (method)bonk_attackbins_set, calcoffset(t_bonk, x_attackbins));
+
+ attr = attr_offset_new("attackframes", sym_long, attrflags, (method)0L, (method)bonk_attackbins_set, calcoffset(t_bonk, x_attackbins));
class_addattr(c, attr);
attr = attr_offset_new("learn", sym_long, attrflags, (method)0L, (method)bonk_learn_set, calcoffset(t_bonk, x_learn));
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index ef096a4c..a63d4a5c 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -756,11 +756,13 @@ int glist_amreloadingabstractions = 0;
void canvas_reload(t_symbol *name, t_symbol *dir, t_gobj *except)
{
t_canvas *x;
+ int dspwas = canvas_suspend_dsp();
glist_amreloadingabstractions = 1;
/* find all root canvases */
for (x = canvas_list; x; x = x->gl_next)
glist_doreload(x, name, dir, except);
glist_amreloadingabstractions = 0;
+ canvas_resume_dsp(dspwas);
}
/* ------------------------ event handling ------------------------ */
@@ -1190,8 +1192,9 @@ static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float
strcpy(namebuf, class_gethelpname(pd_class(&y->g_pd)));
dir = class_gethelpdir(pd_class(&y->g_pd));
}
- if (strcmp(namebuf + strlen(namebuf) - 3, ".pd"))
- strcat(namebuf, ".pd");
+ if (strlen(namebuf) < 4 ||
+ strcmp(namebuf + strlen(namebuf) - 3, ".pd"))
+ strcat(namebuf, ".pd");
open_via_helppath(namebuf, dir);
return;
}
@@ -1596,8 +1599,9 @@ void canvas_mouseup(t_canvas *x,
vmess(&gl2->gl_pd, gensym("menu-open"), "");
x->gl_editor->e_onmotion = MA_NONE;
sys_vgui(
-"pdtk_check {Discard changes to '%s'?} {.x%lx dirty 0;\n} no\n",
- canvas_getrootfor(gl2)->gl_name->s_name, gl2);
+"pdtk_check .x%lx.c {Discard changes to '%s'?} {.x%lx dirty 0;\n} no\n",
+ canvas_getrootfor(gl2),
+ canvas_getrootfor(gl2)->gl_name->s_name, gl2);
return;
}
/* OK, activate it */
@@ -1725,34 +1729,16 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
|| !strcmp(gotkeysym->s_name, "Left")
|| !strcmp(gotkeysym->s_name, "Right")))
{
- /* special case - carriage return to object "makes" it */
- if (keynum == '\n' && (ob =
- pd_checkobject(&x->gl_editor->e_selection->sel_what->g_pd)) &&
- ob->te_type == T_OBJECT)
+ /* send the key to the box's editor */
+ if (!x->gl_editor->e_textdirty)
{
- t_gobj *g;
- int nobj, indx =
- canvas_getindex(x, x->gl_editor->e_selection->sel_what);
- glist_noselect(x);
- /* "ob" may have disappeared; just search to the last
- object and select it */
- for (g = x->gl_list, nobj = 0; g; g = g->g_next, nobj++)
- if (nobj == indx)
- glist_select(x, g);
- }
- else
- {
- /* otherwise send the key to the box's editor */
- 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, gotkeysym);
- if (x->gl_editor->e_textdirty)
- canvas_dirty(x, 1);
+ canvas_setundo(x, canvas_undo_cut,
+ canvas_undo_set_cut(x, UCUT_TEXT), "typing");
}
+ rtext_key(x->gl_editor->e_textedfor,
+ (int)keynum, gotkeysym);
+ if (x->gl_editor->e_textdirty)
+ canvas_dirty(x, 1);
}
/* check for backspace or clear */
else if (keynum == 8 || keynum == 127)
@@ -1873,12 +1859,13 @@ void glob_verifyquit(void *dummy, t_floatarg f)
{
canvas_vis(g2, 1);
sys_vgui(
-"pdtk_check {Discard changes to '%s'?} {.x%lx menuclose 3;\n} no\n",
- canvas_getrootfor(g2)->gl_name->s_name, g2);
+"pdtk_check .x%lx.c {Discard changes to '%s'?} {.x%lx menuclose 3;\n} no\n",
+ canvas_getrootfor(g2), canvas_getrootfor(g2)->gl_name->s_name, g2);
return;
}
if (f == 0 && sys_perf)
- sys_vgui("pdtk_check {really quit?} {pd quit;\n} yes\n");
+ sys_vgui("pdtk_check .x%lx.c {really quit?} {pd quit;\n} yes\n",
+ canvas_getrootfor(g2));
else glob_quit(0);
}
@@ -1902,15 +1889,15 @@ void canvas_menuclose(t_canvas *x, t_floatarg fforce)
{
vmess(&g->gl_pd, gensym("menu-open"), "");
sys_vgui(
-"pdtk_check {Discard changes to '%s'?} {.x%lx menuclose 2;\n} no\n",
- canvas_getrootfor(g)->gl_name->s_name, g);
+"pdtk_check .x%lx.c {Discard changes to '%s'?} {.x%lx menuclose 2;\n} no\n",
+ canvas_getrootfor(g), canvas_getrootfor(g)->gl_name->s_name, g);
return;
}
else if (sys_perf)
{
sys_vgui(
-"pdtk_check {Close '%s'?} {.x%lx menuclose 1;\n} yes\n",
- canvas_getrootfor(x)->gl_name->s_name, x);
+"pdtk_check .x%lx.c {Close '%s'?} {.x%lx menuclose 1;\n} yes\n",
+ canvas_getrootfor(x), canvas_getrootfor(x)->gl_name->s_name, x);
}
else pd_free(&x->gl_pd);
}
@@ -1926,8 +1913,8 @@ void canvas_menuclose(t_canvas *x, t_floatarg fforce)
{
vmess(&g->gl_pd, gensym("menu-open"), "");
sys_vgui(
-"pdtk_check {Discard changes to '%s'?} {.x%lx menuclose 2;\n} no\n",
- canvas_getrootfor(x)->gl_name->s_name, g);
+"pdtk_check .x%lx.c {Discard changes to '%s'?} {.x%lx menuclose 2;\n} no\n",
+ canvas_getrootfor(x), canvas_getrootfor(x)->gl_name->s_name, g);
return;
}
else pd_free(&x->gl_pd);
@@ -2357,7 +2344,7 @@ static void canvas_paste(t_canvas *x)
static void canvas_duplicate(t_canvas *x)
{
- if (x->gl_editor->e_onmotion == MA_NONE)
+ if (x->gl_editor->e_onmotion == MA_NONE && x->gl_editor->e_selection)
{
t_selection *y;
canvas_copy(x);
@@ -2383,6 +2370,41 @@ static void canvas_selectall(t_canvas *x)
}
}
+static void canvas_reselect(t_canvas *x)
+{
+ t_gobj *g, *gwas;
+ t_selection *sel;
+ t_object *ob;
+ /* if someone is text editing, and if only one object is
+ selected, deselect everyone and reselect. */
+ if (x->gl_editor->e_textedfor)
+ {
+ /* only do this if exactly one item is selected. */
+ if ((gwas = x->gl_editor->e_selection->sel_what) &&
+ !x->gl_editor->e_selection->sel_next)
+ {
+ int nobjwas = glist_getindex(x, 0),
+ indx = canvas_getindex(x, x->gl_editor->e_selection->sel_what);
+ glist_noselect(x);
+ for (g = x->gl_list; g; g = g->g_next)
+ if (g == gwas)
+ {
+ glist_select(x, g);
+ return;
+ }
+ /* "gwas" must have disappeared; just search to the last
+ object and select it */
+ for (g = x->gl_list; g; g = g->g_next)
+ if (!g->g_next)
+ glist_select(x, g);
+ }
+ }
+ else if (x->gl_editor->e_selection &&
+ !x->gl_editor->e_selection->sel_next)
+ /* otherwise activate first item in selection */
+ gobj_activate(x->gl_editor->e_selection->sel_what, x, 1);
+}
+
extern t_class *text_class;
void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno,
@@ -2663,6 +2685,8 @@ 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_reselect,
+ gensym("reselect"), A_NULL);
class_addmethod(canvas_class, (t_method)canvas_undo,
gensym("undo"), A_NULL);
class_addmethod(canvas_class, (t_method)canvas_redo,
diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h
index 888ed936..ba9cecc5 100644
--- a/pd/src/m_pd.h
+++ b/pd/src/m_pd.h
@@ -11,7 +11,7 @@ extern "C" {
#define PD_MAJOR_VERSION 0
#define PD_MINOR_VERSION 42
#define PD_BUGFIX_VERSION 0
-#define PD_TEST_VERSION "test8"
+#define PD_TEST_VERSION ""
/* old name for "MSW" flag -- we have to take it for the sake of many old
"nmakefiles" for externs, which will define NT and not MSW */
diff --git a/pd/src/notes.txt b/pd/src/notes.txt
index fabdc332..1a17eace 100644
--- a/pd/src/notes.txt
+++ b/pd/src/notes.txt
@@ -1,5 +1,4 @@
---------------- dolist --------------------
-close patch with dirty GOP abstraction can't vis the abstraction to query
test:
compile on various versions of linux
@@ -15,9 +14,8 @@ mac:
Gnome: why don't windows pop up when clicked on?
problems:
-saving as "x.pd" on mac writes to "x.pd.pd"
-if .pdsettings asks for an alsa device out of range, dialog
- comes up with empty list
+get rid of remaining -export-dynamic in makefiles
+saving as "x.pd" on mac writes to "x.pd.pd" (can't reproduce this.)
find asdf$1 (e.g.) doesn't work
check real-time gaps in writesf~
fix declare to update current patch when changed
@@ -92,7 +90,6 @@ flags to defeat pre-loading specified classes
editing:
pasting should look at current mouse location
clickless connection (hit 'c' key? see Bouchard paper)
- "enter" into object box to create new one (also, change border? forking?)
tab to jump to a connected object (first one?) (shift-tab to back up?)
arrow keys to shift connections left and right
menu item to connect selected objects
@@ -104,7 +101,7 @@ editing:
data:
add -x [-n?] flag to drawnumbers
flag to disable edits for arrays
-make a 2-pass proecss for finding hot spot closes to any given click
+make a 2-pass proecss for finding hot spot closest to any given click
replace list element with binbuf??
hooks for table mousing, other changes (scalars?)
data to save as succession of "list" messages that textfile can store, etc.
diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk
index ee971e50..394ae087 100644
--- a/pd/src/u_main.tk
+++ b/pd/src/u_main.tk
@@ -282,9 +282,9 @@ proc pdtk_ping {} {
}
##### routine to ask user if OK and, if so, send a message on to Pd ######
-proc pdtk_check {x message default} {
- set answer [tk_messageBox \-message $x \-type yesno -default $default \
- -icon question]
+proc pdtk_check {canvas x message default} {
+ set answer [tk_messageBox -message $x -type yesno -default $default \
+ -parent $canvas -icon question]
if {! [string compare $answer yes]} {pd $message}
}
@@ -333,9 +333,9 @@ proc menu_new {} {
################## the "Open" menu command #########################
-proc menu_open {} {
+proc menu_open {parent} {
global pd_opendir
- set filename [tk_getOpenFile -defaultextension .pd \
+ set filename [tk_getOpenFile -defaultextension .pd -parent $parent\
-filetypes { {{pd files} {.pd}} {{max files} {.pat}}} \
-initialdir $pd_opendir]
if {$filename != ""} {open_file $filename}
@@ -383,6 +383,9 @@ proc menu_pop_pd {} {raise .}
######### the "audio" menu command ###############
proc menu_audio {flag} {pd [concat pd dsp $flag \;]}
+######### the "reselect" menu command ################
+proc menu_reselect {name} {pd [concat $name reselect \;]}
+
######### the "documentation" menu command ###############
set doc_number 1
@@ -592,7 +595,7 @@ proc menu_addstd {mbar} {
.mbar.file add command -label New -command {menu_new} \
-accelerator [accel_munge "Ctrl+n"]
-.mbar.file add command -label Open -command {menu_open} \
+.mbar.file add command -label Open -command {menu_open .} \
-accelerator [accel_munge "Ctrl+o"]
.mbar.file add separator
.mbar.file add command -label Message -command {menu_send} \
@@ -947,7 +950,7 @@ proc pdtk_canvas_new {name width height geometry editable} {
$name.m.file add command -label New -command {menu_new} \
-accelerator [accel_munge "Ctrl+n"]
- $name.m.file add command -label Open -command {menu_open} \
+ $name.m.file add command -label Open -command [concat menu_open $name] \
-accelerator [accel_munge "Ctrl+o"]
$name.m.file add separator
@@ -1014,6 +1017,10 @@ proc pdtk_canvas_new {name width height geometry editable} {
-command [concat menu_selectall $name] \
-accelerator [accel_munge "Ctrl+a"]
+ $name.m.edit add command -label {Reselect} \
+ -command [concat menu_reselect $name] \
+ -accelerator "Ctrl+Enter"
+
$name.m.edit add separator
$name.m.edit add command -label {Text Editor} \
@@ -1652,6 +1659,7 @@ proc pdtk_canvas_ctrlkey {name key shift} {
if {$key == "5"} {menu_comment $topname 1}
if {$key == "slash"} {menu_audio 1}
if {$key == "period"} {menu_audio 0}
+ if {$key == "Return"} {menu_reselect $topname}
if {$shift == 1} {
if {$key == "q" || $key == "Q"} {menu_really_quit}
if {$key == "w" || $key == "W"} {menu_really_close $topname}
@@ -1672,7 +1680,7 @@ proc pdtk_canvas_ctrlkey {name key shift} {
if {$key == "s" || $key == "S"} {menu_save $topname}
if {$key == "z" || $key == "Z"} {menu_undo $topname}
if {$key == "n" || $key == "N"} {menu_new}
- if {$key == "o" || $key == "O"} {menu_open}
+ if {$key == "o" || $key == "O"} {menu_open $topname}
if {$key == "m" || $key == "M"} {menu_send}
if {$key == "w" || $key == "W"} {menu_close $topname}
if {$key == "p" || $key == "P"} {menu_print $topname}
@@ -1726,7 +1734,7 @@ set saveas_dir nowhere
proc pdtk_canvas_saveas {name initfile initdir} {
global pd_nt
set filename [tk_getSaveFile -initialfile $initfile \
- -initialdir $initdir -defaultextension .pd \
+ -initialdir $initdir -defaultextension .pd -parent $name.c \
-filetypes { {{pd files} {.pd}} {{max files} {.pat}} }]
if {$filename != ""} {
@@ -3363,7 +3371,7 @@ 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 == "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}
diff --git a/pd/src/x_gui.c b/pd/src/x_gui.c
index bcc6ec8b..7cc23d26 100644
--- a/pd/src/x_gui.c
+++ b/pd/src/x_gui.c
@@ -233,6 +233,7 @@ static t_class *savepanel_class;
typedef struct _savepanel
{
t_object x_obj;
+ t_canvas *x_canvas;
t_symbol *x_s;
} t_savepanel;
@@ -242,6 +243,7 @@ static void *savepanel_new( void)
t_savepanel *x = (t_savepanel *)pd_new(savepanel_class);
sprintf(buf, "d%lx", (t_int)x);
x->x_s = gensym(buf);
+ x->x_canvas = canvas_getcurrent();
pd_bind(&x->x_obj.ob_pd, x->x_s);
outlet_new(&x->x_obj, &s_symbol);
return (x);