lists@iem
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
List overview
Download
Pd-cvs
December 2008
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
pd-cvs@lists.iem.at
20 participants
129 discussions
Start a n
N
ew thread
SF.net SVN: pure-data:[10470] trunk/pd/doc/3.audio.examples
by millerpuckette@users.sourceforge.net
30 Dec '08
30 Dec '08
Revision: 10470
http://pure-data.svn.sourceforge.net/pure-data/?rev=10470&view=rev
Author: millerpuckette Date: 2008-12-30 01:53:20 +0000 (Tue, 30 Dec 2008) Log Message: ----------- Oops, add 2 help files Added Paths: ----------- trunk/pd/doc/3.audio.examples/B15.tabread4~-onset.pd trunk/pd/doc/3.audio.examples/B16.long-varispeed.pd Added: trunk/pd/doc/3.audio.examples/B15.tabread4~-onset.pd =================================================================== --- trunk/pd/doc/3.audio.examples/B15.tabread4~-onset.pd (rev 0) +++ trunk/pd/doc/3.audio.examples/B15.tabread4~-onset.pd 2008-12-30 01:53:20 UTC (rev 10470) @@ -0,0 +1,66 @@ +#N canvas 88 58 563 680 12; +#X text 355 655 updated for Pd version 0.42; +#X text 28 36 Pd is usually compiled to work on 32-bit audio samples. +These do not \, in general \, have enough precision for use as indices +into an array of more than about 32K samples. This is because the mantissa +of a 23-bit floating point number has only 24 bits \, out of which +you would be using 16 bits or more to address a sample more than 32K +into the array \, so there would remain 8 or fewer bits to supply the +fraction. In the most extreme situation possible \, the sample could +contain a Nyquist frequency sinusoid and the output would then have +only about 8 bits of accuracy!; +#X text 29 196 You can use the "onset" inlet to tabread4~ to get good +accuracy reading longer arrays. The tabread4~ object adds the index +and the "main" (signal) inlet in 64-bit precision. So if \, for example +\, the onset inlet could specify an integer exactly up to about 8 million +(190 seconds at 44100 Hz) \, and the signal inlet could act as a displacement. +; +#X text 116 13 USING ONSETS INTO TABREAD4~ TO IMPROVE ACCURACY; +#X obj 41 587 output~; +#X obj 395 507 samplerate~; +#X obj 395 531 / 2; +#X obj 384 445 loadbang; +#X obj 384 582 tabwrite~ \$0-tab; +#X obj 40 557 tabread4~ \$0-tab; +#X obj 395 555 osc~; +#X obj 172 557 tabread4~ \$0-tab; +#X obj 173 589 output~; +#X obj 384 486 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X msg 408 468 \; pd dsp 1; +#X obj 41 474 *~ 10000; +#X obj 41 527 +~; +#X floatatom 192 476 6 0 0 0 - - -; +#X msg 247 446 1; +#X obj 383 610 table \$0-tab 200000; +#X obj 42 446 phasor~ 0.02; +#X msg 192 446 150001; +#X text 28 310 At left below an onset (1 or 150000 samples) is added +to the index of a table lookup. If you select the onset of 150001 \, +you should hear the truncation error. (The table contains a Nyquist +signal and the "correct" output should be a 100 Hz. tone.) At right +\, the onset is presented in the separate onset inlet. The worst-case +truncation error drops by about 30 dB.; +#X text 57 647 BAD; +#X text 190 646 GOOD; +#X text 193 425 ONSET INTO TABLE; +#X text 384 426 This loads the table:; +#X connect 5 0 6 0; +#X connect 6 0 10 0; +#X connect 7 0 13 0; +#X connect 7 0 14 0; +#X connect 9 0 4 0; +#X connect 9 0 4 1; +#X connect 10 0 8 0; +#X connect 11 0 12 0; +#X connect 11 0 12 1; +#X connect 13 0 5 0; +#X connect 13 0 8 0; +#X connect 15 0 16 0; +#X connect 15 0 11 0; +#X connect 16 0 9 0; +#X connect 17 0 11 1; +#X connect 17 0 16 1; +#X connect 18 0 17 0; +#X connect 20 0 15 0; +#X connect 21 0 17 0; Added: trunk/pd/doc/3.audio.examples/B16.long-varispeed.pd =================================================================== --- trunk/pd/doc/3.audio.examples/B16.long-varispeed.pd (rev 0) +++ trunk/pd/doc/3.audio.examples/B16.long-varispeed.pd 2008-12-30 01:53:20 UTC (rev 10470) @@ -0,0 +1,158 @@ +#N canvas 31 5 779 858 12; +#X obj 399 526 metro 100; +#X obj 212 472 phasor~; +#X obj 399 556 snapshot~; +#X text 561 824 updated for Pd version 0.42; +#X obj 23 557 output~; +#X obj 23 461 phasor~; +#X floatatom 23 329 5 -100 1000 0 - - -; +#X obj 23 518 tabread4~ \$0-tab; +#X msg 290 329 0.5; +#X msg 326 329 0.01; +#X obj 398 455 loadbang; +#X msg 399 478 1; +#X obj 344 635 +; +#X obj 144 680 tabread4~ \$0-tab; +#X obj 375 634 f; +#X obj 312 612 t f f; +#X obj 145 712 output~; +#X floatatom 455 667 8 0 0 0 - - -; +#X obj 344 670 t f b; +#X obj 377 699 f; +#X obj 344 699 -; +#X floatatom 457 612 8 0 0 0 - - -; +#X obj 326 726 -; +#X obj 399 507 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 +1; +#X obj 212 498 -~ 0.5; +#X obj 290 811 + 0.5; +#X obj 22 490 *~ 1e+06; +#X floatatom 326 753 8 0 0 0 - - -; +#X obj 530 519 samplerate~; +#X obj 484 546 /; +#X obj 484 519 t f b; +#X obj 451 589 +; +#X obj 295 787 / 10000; +#X obj 212 523 *~ 10000; +#X obj 484 570 * 10000; +#X obj 532 155 samplerate~; +#X obj 532 179 / 2; +#X obj 521 93 loadbang; +#X obj 521 230 tabwrite~ \$0-tab; +#X obj 532 203 osc~; +#X obj 521 134 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X msg 545 116 \; pd dsp 1; +#X obj 520 258 table \$0-tab 1e+06; +#X text 488 61 and will take about 20 seconds to fill.; +#X text 488 45 *** The table is now 1 million points \,; +#X obj 23 433 / 1e+06; +#X text 61 328 playback speed \, samples/sec; +#X text 89 460 naive way: just; +#X text 89 475 run a phasor; +#X text 88 491 into tabread4~; +#X text 454 680 new onset is phase plus old onset; +#X obj 341 357 * 1e+06; +#X text 458 626 extrapolated phase of next sample; +#X text 409 700 new onset minus old onset; +#X text 389 726 back up phasor output by amount the onset advanced +; +#X text 387 739 (approximately zero but not exactly because of; +#X text 389 753 truncation error!); +#X obj 341 383 t b f; +#X text 400 357 convert to samples; +#X text 385 384 set both last-onset and previous-onset; +#X text 385 407 ... and also reset phasor.; +#X text 354 791 convert phase back to range 0-1; +#X text 215 548 convert phase to; +#X text 215 562 range +/-5000; +#X obj 212 435 / 10000; +#X text 40 410 cycles/sec; +#X text 30 400 convert to; +#X text 216 412 cycles/sec; +#X text 206 402 convert to; +#X text 469 472 in order to change onset to reflect it; +#X text 469 456 Each 100 msec \, poll phase of phasor~; +#X text 24 29 Here is how to use the tabread~ "onset" input to allow +clean varispeed playback from a long table. At left \, a phasor~ is +naiveley rescaled to the size of the tble. At right \, the phasor~ +gets only a 10000-point range about a moving "onset". Ten times per +second \, we poll tha phasor~ phase \, sum its value into the onset +\, and back up the phase of the phasor~ correspondingly.; +#X text 24 138 The tricky bits are \, first \, that we need to poll +the phasor~ phase one sample into the future (so we add the per-sample +increment into the snapshot~ result). Second \, we can't just reset +the phasor~ to a fixed point - instead \, we measure how much the onset +has actually increased (which has truncation error from summing in +the phase snapshot) \, and subtract that increase from the phase \, +giving a value that differs from zero by the truncation error but reflects +the true phase we should reset to for continuity.; +#X text 26 281 The metronome rate is arbitrary but should be fast enough +that the phasor~ never has time to wrap.; +#X text 518 539 extrapolate snapshot of phase by one; +#X text 517 552 sample to sync with next block; +#X text 41 617 BAD; +#X text 160 770 GOOD; +#X text 195 9 VARIABLE SPEED PLAYBACK FROM LONG TABLES; +#X msg 340 408 0; +#X text 369 328 <- reset phase. 0.5 causes trouble for the "bad" way. +; +#X connect 0 0 2 0; +#X connect 1 0 24 0; +#X connect 2 0 31 0; +#X connect 5 0 26 0; +#X connect 6 0 45 0; +#X connect 6 0 64 0; +#X connect 7 0 4 0; +#X connect 7 0 4 1; +#X connect 8 0 5 1; +#X connect 8 0 51 0; +#X connect 9 0 5 1; +#X connect 9 0 51 0; +#X connect 10 0 11 0; +#X connect 11 0 23 0; +#X connect 12 0 14 0; +#X connect 12 0 18 0; +#X connect 12 0 13 1; +#X connect 12 0 17 0; +#X connect 13 0 16 0; +#X connect 13 0 16 1; +#X connect 14 0 12 1; +#X connect 15 0 22 0; +#X connect 15 1 12 0; +#X connect 18 0 19 1; +#X connect 18 0 20 0; +#X connect 18 1 19 0; +#X connect 19 0 20 1; +#X connect 20 0 22 1; +#X connect 22 0 27 0; +#X connect 22 0 32 0; +#X connect 23 0 0 0; +#X connect 24 0 33 0; +#X connect 25 0 1 1; +#X connect 26 0 7 0; +#X connect 28 0 29 1; +#X connect 29 0 34 0; +#X connect 30 0 29 0; +#X connect 30 1 28 0; +#X connect 31 0 15 0; +#X connect 31 0 21 0; +#X connect 32 0 25 0; +#X connect 33 0 2 0; +#X connect 33 0 13 0; +#X connect 34 0 31 1; +#X connect 35 0 36 0; +#X connect 36 0 39 0; +#X connect 37 0 40 0; +#X connect 37 0 41 0; +#X connect 39 0 38 0; +#X connect 40 0 35 0; +#X connect 40 0 38 0; +#X connect 45 0 5 0; +#X connect 51 0 57 0; +#X connect 57 0 79 0; +#X connect 57 1 19 1; +#X connect 57 1 12 1; +#X connect 64 0 1 0; +#X connect 64 0 30 0; +#X connect 79 0 15 0; This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data:[10469] trunk/pd
by millerpuckette@users.sourceforge.net
30 Dec '08
30 Dec '08
Revision: 10469
http://pure-data.svn.sourceforge.net/pure-data/?rev=10469&view=rev
Author: millerpuckette Date: 2008-12-30 01:51:31 +0000 (Tue, 30 Dec 2008) Log Message: ----------- 0.42-0test08 Modified Paths: -------------- trunk/pd/extra/bonk~/bonk~-help.pd trunk/pd/extra/bonk~/bonk~.c trunk/pd/extra/pd~/pd~.c trunk/pd/src/CHANGELOG.txt trunk/pd/src/g_canvas.c trunk/pd/src/g_canvas.h trunk/pd/src/g_editor.c trunk/pd/src/g_rtext.c trunk/pd/src/g_text.c trunk/pd/src/m_glob.c trunk/pd/src/m_pd.h trunk/pd/src/makefile.in trunk/pd/src/notes.txt trunk/pd/src/s_audio.c trunk/pd/src/s_audio_oss.c trunk/pd/src/s_audio_pa.c trunk/pd/src/s_loader.c trunk/pd/src/s_main.c trunk/pd/src/s_stuff.h Added Paths: ----------- trunk/pd/extra/lrshift~/lrshift~-help.pd Removed Paths: ------------- trunk/pd/extra/lrshift~/rlshift~-help.pd Modified: trunk/pd/extra/bonk~/bonk~-help.pd =================================================================== --- trunk/pd/extra/bonk~/bonk~-help.pd 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/extra/bonk~/bonk~-help.pd 2008-12-30 01:51:31 UTC (rev 10469) @@ -1,13 +1,13 @@ -#N canvas 304 143 967 599 10; -#X obj 370 524 spigot; +#N canvas 304 143 967 599 12; +#X obj 358 544 spigot; #X msg 442 397 bang; -#X obj 429 488 bonk~; +#X obj 428 508 bonk~; #X msg 442 214 learn 1; #X msg 442 274 learn 0; -#X msg 437 456 print; +#X msg 446 451 print; #X obj 390 437 adc~; -#X msg 614 538 \; pd dsp 1; -#X obj 277 524 spigot; +#X msg 613 558 \; pd dsp 1; +#X obj 276 544 spigot; #N canvas 366 126 604 404 synth 0; #X obj 112 24 r bonk-cooked; #X obj 112 49 unpack; @@ -59,14 +59,14 @@ #X connect 21 0 1 0; #X connect 22 0 6 0; #X connect 23 0 9 0; -#X restore 846 555 pd synth; -#X floatatom 846 532 0 0 0 0 - - -; -#X msg 846 502 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 877 502 90; +#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 @@ -75,13 +75,13 @@ 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 602 504 click here; -#X text 603 517 to start DSP; +#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 out the raw or cooked output using the two "spigots" or listen to a synthesizer output by raising its volume.; -#X text 747 501 output volume; -#X text 761 519 (0-100); +#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 @@ -89,7 +89,7 @@ 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 532 140 Describes how energy in each frequency band masks later +#X text 526 136 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 @@ -101,22 +101,22 @@ #X text 595 334 Write templates to a file in text-editable format. ; #X text 596 364 Read templates from a file.; -#X text 538 453 Print out all settings and templates.; +#X text 514 450 Print out all settings and templates.; #X msg 442 120 minvel 10; -#X text 538 392 Poll the current spectrum via "raw" outlet \, You can +#X text 514 392 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 538 426 turn debugging on or off.; -#X obj 326 525 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 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 1; -#X obj 419 525 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +#X obj 407 545 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; -#X obj 370 554 print cooked; -#X obj 277 554 print raw; -#X text 253 490 enable printout:; -#X text 533 121 Minimum "velocity" to output (quieter notes are ignored.) +#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 462 513 s bonk-cooked; +#X obj 461 533 s bonk-cooked; #X text 218 12 BONK~ - an attack detector for small percussion instruments ; #X text 8 174 Bonk's two outputs are the raw spectrum of the attack @@ -127,12 +127,14 @@ 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 532 52 Set low and high thresholds. Signal growth must exceed +#X text 531 47 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 connect 1 0 2 0; #X connect 2 0 8 0; @@ -157,3 +159,4 @@ #X connect 36 0 2 0; #X connect 38 0 8 1; #X connect 39 0 0 1; +#X connect 49 0 2 0; Modified: trunk/pd/extra/bonk~/bonk~.c =================================================================== --- trunk/pd/extra/bonk~/bonk~.c 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/extra/bonk~/bonk~.c 2008-12-30 01:51:31 UTC (rev 10469) @@ -95,6 +95,7 @@ #define DEFHALFTONES 6 #define DEFOVERLAP 1 #define DEFFIRSTBIN 1 +#define DEFMINBANDWIDTH 1.5 #define DEFHITHRESH 5 #define DEFLOTHRESH 2.5 #define DEFMASKTIME 4 @@ -122,6 +123,7 @@ float b_halftones; /* filter bandwidth in halftones */ float b_overlap; /* overlap; default 1 for 1/2-power pts */ float b_firstbin; /* freq of first filter in bins, default 1 */ + float b_minbandwidth; /* minimum bandwidth, default 1.5 */ t_filterkernel *b_vec; /* filter kernels */ int b_refcount; /* number of bonk~ objects using this */ struct _filterbank *b_next; /* next in linked list */ @@ -206,7 +208,7 @@ float x_halftones; /* nominal halftones between filters */ float x_overlap; float x_firstbin; - + float x_minbandwidth; float x_hithresh; /* threshold for total growth to trigger */ float x_lothresh; /* threshold for total growth to re-arm */ float x_minvel; /* minimum velocity we output */ @@ -275,10 +277,11 @@ static void bonk_tick(t_bonk *x); -#define HALFWIDTH 0.75 /* half peak bandwidth at half power point in bins */ +#define HALFWIDTH 0.75 /* half peak bandwidth at half power point in bins */ +#define SLIDE 0.25 /* relative slide between filter subwindows */ static t_filterbank *bonk_newfilterbank(int npoints, int nfilters, - float halftones, float overlap, float firstbin) + float halftones, float overlap, float firstbin, float minbandwidth) { int i, j; float cf, bw, h, relspace; @@ -288,6 +291,7 @@ b->b_halftones = halftones; b->b_overlap = overlap; b->b_firstbin = firstbin; + b->b_minbandwidth = minbandwidth; b->b_refcount = 0; b->b_next = bonk_filterbanklist; bonk_filterbanklist = b; @@ -296,17 +300,21 @@ h = exp((log(2.)/12.)*halftones); /* specced interval between filters */ relspace = (h - 1)/(h + 1); /* nominal spacing-per-f for fbank */ + if (minbandwidth < 2*HALFWIDTH) + minbandwidth = 2*HALFWIDTH; + if (firstbin < minbandwidth/(2*HALFWIDTH)) + firstbin = minbandwidth/(2*HALFWIDTH); cf = firstbin; bw = cf * relspace * overlap; - if (bw < HALFWIDTH) - bw = HALFWIDTH; + if (bw < (0.5*minbandwidth)) + bw = (0.5*minbandwidth); for (i = 0; i < nfilters; i++) { float *fp, newcf, newbw; float normalizer = 0; int filterpoints, skippoints, hoppoints, nhops; - filterpoints = 0.5 + npoints * HALFWIDTH/bw; + filterpoints = npoints * HALFWIDTH/bw; if (cf > npoints/2) { post("bonk~: only using %d filters (ran past Nyquist)", i+1); @@ -320,7 +328,7 @@ else if (filterpoints > npoints) filterpoints = npoints; - hoppoints = 0.5 + 0.5 * npoints * HALFWIDTH/bw; + hoppoints = SLIDE * npoints * HALFWIDTH/bw; nhops = 1. + (npoints-filterpoints)/(float)hoppoints; skippoints = 0.5 * (npoints-filterpoints - (nhops-1) * hoppoints); @@ -343,7 +351,7 @@ fp[1] = window * sin(phase); normalizer += window; } - normalizer = 1/(normalizer * nhops); + normalizer = 1/(normalizer * sqrt(nhops)); for (fp = b->b_vec[i].k_stuff, j = 0; j < filterpoints; j++, fp+= 2) fp[0] *= normalizer, fp[1] *= normalizer; @@ -353,10 +361,10 @@ #endif newcf = (cf + bw/overlap)/(1 - relspace); newbw = newcf * overlap * relspace; - if (newbw < HALFWIDTH) + if (newbw < 0.5*minbandwidth) { - newbw = HALFWIDTH; - newcf = cf + 2 * HALFWIDTH / overlap; + newbw = 0.5*minbandwidth; + newcf = cf + minbandwidth / overlap; } cf = newcf; bw = newbw; @@ -387,7 +395,7 @@ static void bonk_donew(t_bonk *x, int npoints, int period, int nsig, int nfilters, float halftones, float overlap, float firstbin, - float samplerate) + float minbandwidth, float samplerate) { int i, j; t_hist *h; @@ -440,7 +448,8 @@ fb->b_halftones == x->x_halftones && fb->b_firstbin == firstbin && fb->b_overlap == overlap && - fb->b_npoints == x->x_npoints) + fb->b_npoints == x->x_npoints && + fb->b_minbandwidth == minbandwidth) { fb->b_refcount++; x->x_filterbank = fb; @@ -448,7 +457,7 @@ } if (!x->x_filterbank) x->x_filterbank = bonk_newfilterbank(npoints, nfilters, - halftones, overlap, firstbin), + halftones, overlap, firstbin, minbandwidth), x->x_filterbank->b_refcount++; } @@ -1035,7 +1044,7 @@ int nsig = 1, period = DEFPERIOD, npts = DEFNPOINTS, nfilters = DEFNFILTERS, j; float halftones = DEFHALFTONES, overlap = DEFOVERLAP, - firstbin = DEFFIRSTBIN; + firstbin = DEFFIRSTBIN, minbandwidth = DEFMINBANDWIDTH; t_insig *g; if (argc > 0 && argv[0].a_type == A_FLOAT) @@ -1082,6 +1091,11 @@ firstbin = atom_getfloatarg(1, argc, argv); argc -= 2; argv += 2; } + else if (!strcmp(firstarg->s_name, "-minbandwidth") && argc > 1) + { + minbandwidth = atom_getfloatarg(1, argc, argv); + argc -= 2; argv += 2; + } else if (!strcmp(firstarg->s_name, "-spew") && argc > 1) { x->x_spew = (atom_getfloatarg(1, argc, argv) != 0); @@ -1123,7 +1137,7 @@ } x->x_cookedout = outlet_new(&x->x_obj, gensym("list")); bonk_donew(x, npts, period, nsig, nfilters, halftones, overlap, - firstbin, sys_getsr()); + firstbin, minbandwidth, sys_getsr()); return (x); } @@ -1182,6 +1196,9 @@ attr = attr_offset_new("firstbin", sym_float32, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_firstbin)); class_addattr(c, attr); + attr = attr_offset_new("minbandwidth", sym_float32, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_minbandwidth)); + class_addattr(c, attr); + attr = attr_offset_new("minvel", sym_float32, attrflags, (method)0L, (method)bonk_minvel_set, calcoffset(t_bonk, x_minvel)); class_addattr(c, attr); @@ -1250,6 +1267,7 @@ x->x_nfilters = DEFNFILTERS; x->x_halftones = DEFHALFTONES; x->x_firstbin = DEFFIRSTBIN; + x->x_minbandwidth = DEFMINBANDWIDTH; x->x_overlap = DEFOVERLAP; x->x_ninsig = 1; @@ -1305,7 +1323,8 @@ x->x_clock = clock_new(x, (method)bonk_tick); bonk_donew(x, x->x_npoints, x->x_period, x->x_ninsig, x->x_nfilters, - x->x_halftones, x->x_overlap, x->x_firstbin, sys_getsr()); + x->x_halftones, x->x_overlap, x->x_firstbin, x->x_minbandwidth, + sys_getsr()); } return (x); } Added: trunk/pd/extra/lrshift~/lrshift~-help.pd =================================================================== --- trunk/pd/extra/lrshift~/lrshift~-help.pd (rev 0) +++ trunk/pd/extra/lrshift~/lrshift~-help.pd 2008-12-30 01:51:31 UTC (rev 10469) @@ -0,0 +1,29 @@ +#N canvas 143 0 673 325 12; +#X msg 268 277 bang; +#X obj 244 303 print~; +#X msg 185 278 bang; +#X obj 161 304 print~; +#X text 53 117 click here first; +#X msg 72 270 bang; +#X obj 48 296 print~; +#X text 162 222 shift left; +#X text 243 224 shift right; +#X obj 161 252 lrshift~ 1; +#X obj 244 251 lrshift~ -1; +#X text 39 37 Acting at whatever vector size the window is running at \, lrshift~ shifts samples to the left (toward the beginning sample) or to the right. The argument gives the direction and the amount of the shift. The rightmost (or leftmost) samples are set to zero.; +#X graph graph2 0 0 63 1 448 258 648 118; +#X array shiftin 64 float; +#X pop; +#X obj 47 11 rlshift~; +#X text 115 11 -- shift signal vector elements left or right; +#X msg 54 138 \; pd dsp 1 \; shiftin 1 1; +#X obj 48 204 tabreceive~ shiftin; +#X text 525 308 Updated for Pd 0.31.; +#X connect 0 0 1 0; +#X connect 2 0 3 0; +#X connect 5 0 6 0; +#X connect 9 0 3 0; +#X connect 10 0 1 0; +#X connect 16 0 6 0; +#X connect 16 0 9 0; +#X connect 16 0 10 0; Deleted: trunk/pd/extra/lrshift~/rlshift~-help.pd =================================================================== --- trunk/pd/extra/lrshift~/rlshift~-help.pd 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/extra/lrshift~/rlshift~-help.pd 2008-12-30 01:51:31 UTC (rev 10469) @@ -1,29 +0,0 @@ -#N canvas 143 0 673 325 12; -#X msg 268 277 bang; -#X obj 244 303 print~; -#X msg 185 278 bang; -#X obj 161 304 print~; -#X text 53 117 click here first; -#X msg 72 270 bang; -#X obj 48 296 print~; -#X text 162 222 shift left; -#X text 243 224 shift right; -#X obj 161 252 lrshift~ 1; -#X obj 244 251 lrshift~ -1; -#X text 39 37 Acting at whatever vector size the window is running at \, lrshift~ shifts samples to the left (toward the beginning sample) or to the right. The argument gives the direction and the amount of the shift. The rightmost (or leftmost) samples are set to zero.; -#X graph graph2 0 0 63 1 448 258 648 118; -#X array shiftin 64 float; -#X pop; -#X obj 47 11 rlshift~; -#X text 115 11 -- shift signal vector elements left or right; -#X msg 54 138 \; pd dsp 1 \; shiftin 1 1; -#X obj 48 204 tabreceive~ shiftin; -#X text 525 308 Updated for Pd 0.31.; -#X connect 0 0 1 0; -#X connect 2 0 3 0; -#X connect 5 0 6 0; -#X connect 9 0 3 0; -#X connect 10 0 1 0; -#X connect 16 0 6 0; -#X connect 16 0 9 0; -#X connect 16 0 10 0; Modified: trunk/pd/extra/pd~/pd~.c =================================================================== --- trunk/pd/extra/pd~/pd~.c 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/extra/pd~/pd~.c 2008-12-30 01:51:31 UTC (rev 10469) @@ -177,11 +177,15 @@ snprintf(pdexecbuf, MAXPDSTRING, "%s/bin/pd", pddir); if (stat(pdexecbuf, &statbuf) < 0) { - snprintf(pdexecbuf, MAXPDSTRING, "%s/pd", pddir); + snprintf(pdexecbuf, MAXPDSTRING, "%s/../../../bin/pd", pddir); if (stat(pdexecbuf, &statbuf) < 0) { - ERROR "pd~: can't stat %s", pdexecbuf); - goto fail1; + snprintf(pdexecbuf, MAXPDSTRING, "%s/pd", pddir); + if (stat(pdexecbuf, &statbuf) < 0) + { + ERROR "pd~: can't stat %s", pdexecbuf); + goto fail1; + } } } snprintf(schedbuf, MAXPDSTRING, "%s/pdsched%s", schedlibdir, Modified: trunk/pd/src/CHANGELOG.txt =================================================================== --- trunk/pd/src/CHANGELOG.txt 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/CHANGELOG.txt 2008-12-30 01:51:31 UTC (rev 10469) @@ -1,6 +1,6 @@ This file describes implementation and API changes; stuff more visible to the user appears in the "release notes" instead. See the bottom of this file -for original notes on source stype and organization. +for original notes on source style and organization. 0.42.0 Modified: trunk/pd/src/g_canvas.c =================================================================== --- trunk/pd/src/g_canvas.c 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/g_canvas.c 2008-12-30 01:51:31 UTC (rev 10469) @@ -51,7 +51,6 @@ static void canvas_addtolist(t_canvas *x); static void canvas_takeofflist(t_canvas *x); static void canvas_pop(t_canvas *x, t_floatarg fvis); -void canvas_create_editor(t_glist *x, int createit); /* --------- functions to handle the canvas environment ----------- */ @@ -513,8 +512,6 @@ if (!menu) pd_pushsym(&x->gl_pd); glist_add(g, &x->gl_gobj); - if (glist_isvisible(g)) - canvas_create_editor(x, 1); return (x); } @@ -605,7 +602,8 @@ canvas_getdir(x)->s_name); } -void canvas_dirty(t_canvas *x, t_int n) + /* mark a glist dirty or clean */ +void canvas_dirty(t_canvas *x, t_floatarg n) { t_canvas *x2 = canvas_getrootfor(x); if (glist_amreloadingabstractions) @@ -613,7 +611,8 @@ if ((unsigned)n != x2->gl_dirty) { x2->gl_dirty = n; - canvas_reflecttitle(x2); + if (glist_isvisible(x2)) + canvas_reflecttitle(x2); } } @@ -663,15 +662,8 @@ { if (glist_isvisible(x)) { - /* just clear out the whole canvas... */ + /* just clear out the whole canvas */ sys_vgui(".x%lx.c delete all\n", x); -#if 0 - /* alternatively, we could have erased them one by one... - for (y = x->gl_list; y; y = y->g_next) - gobj_vis(y, x, 0); - ... but we should go through and erase the lines as well - if we do it that way. */ -#endif x->gl_mapped = 0; } } @@ -695,14 +687,14 @@ { t_glist *gl2 = x->gl_owner; if (!gl2) - bug("canvas_vis"); /* shouldn't happen but don't get too upset. */ + bug("glist_menu_open"); /* shouldn't happen but not dangerous */ else { /* erase ourself in parent window */ gobj_vis(&x->gl_gobj, gl2, 0); /* get rid of our editor (and subeditors) */ if (x->gl_editor) - canvas_create_editor(x, 0); + canvas_destroy_editor(x); x->gl_havewindow = 1; /* redraw ourself in parent window (blanked out this time) */ gobj_vis(&x->gl_gobj, gl2, 1); @@ -744,7 +736,8 @@ glist_noselect(x); while (y = x->gl_list) glist_delete(x, y); - canvas_vis(x, 0); + if (x == glist_getcanvas(x)) + canvas_vis(x, 0); if (strcmp(x->gl_name->s_name, "Pd")) pd_unbind(&x->gl_pd, canvas_makebindsym(x->gl_name)); @@ -1558,6 +1551,8 @@ gensym("menu-open"), A_NULL); class_addmethod(canvas_class, (t_method)canvas_map, gensym("map"), A_FLOAT, A_NULL); + class_addmethod(canvas_class, (t_method)canvas_dirty, + gensym("dirty"), A_FLOAT, A_NULL); class_setpropertiesfn(canvas_class, (t_propertiesfn)canvas_properties); /* ---------------------- list handling ------------------------ */ Modified: trunk/pd/src/g_canvas.h =================================================================== --- trunk/pd/src/g_canvas.h 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/g_canvas.h 2008-12-30 01:51:31 UTC (rev 10469) @@ -401,7 +401,8 @@ 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); +EXTERN void canvas_create_editor(t_glist *x); +EXTERN void canvas_destroy_editor(t_glist *x); void canvas_deletelinesforio(t_canvas *x, t_text *text, t_inlet *inp, t_outlet *outp); extern int glist_amreloadingabstractions; /* stop GUI changes while reloading */ @@ -466,7 +467,7 @@ EXTERN void canvas_unsetcurrent(t_canvas *x); EXTERN t_symbol *canvas_realizedollar(t_canvas *x, t_symbol *s); EXTERN t_canvas *canvas_getrootfor(t_canvas *x); -EXTERN void canvas_dirty(t_canvas *x, t_int n); +EXTERN void canvas_dirty(t_canvas *x, t_floatarg n); EXTERN int canvas_getfont(t_canvas *x); typedef int (*t_canvasapply)(t_canvas *x, t_int x1, t_int x2, t_int x3); Modified: trunk/pd/src/g_editor.c =================================================================== --- trunk/pd/src/g_editor.c 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/g_editor.c 2008-12-30 01:51:31 UTC (rev 10469) @@ -27,6 +27,7 @@ static t_binbuf *copy_binbuf; static char *canvas_textcopybuf; static int canvas_textcopybufsize; +static t_glist *glist_finddirty(t_glist *x); /* ---------------- generic widget behavior ------------------------- */ @@ -166,12 +167,26 @@ } } + /* recursively deselect everything in a gobj "g", if it happens to be + a glist, in preparation for deselecting g itself in glist_dselect() */ +static void glist_checkanddeselectall(t_glist *gl, t_gobj *g) +{ + t_glist *gl2; + t_gobj *g2; + if (pd_class(&g->g_pd) != canvas_class) + return; + gl2 = (t_glist *)g; + for (g2 = gl2->gl_list; g2; g2 = g2->g_next) + glist_checkanddeselectall(gl2, g2); + glist_noselect(gl2); +} + /* call this for selected objects only */ void glist_deselect(t_glist *x, t_gobj *y) { int fixdsp = 0; static int reenter = 0; - if (reenter) return; + /* if (reenter) return; */ reenter = 1; if (x->gl_editor) { @@ -187,6 +202,7 @@ { z = fuddy; canvas_stowconnections(glist_getcanvas(x)); + glist_checkanddeselectall(x, y); } gobj_activate(y, x, 0); } @@ -862,39 +878,31 @@ /* recursively create or destroy all editors of a glist and its sub-glists, as long as they aren't toplevels. */ -void canvas_create_editor(t_glist *x, int createit) +void canvas_create_editor(t_glist *x) { t_gobj *y; t_object *ob; - if (createit) + if (!x->gl_editor) { - if (x->gl_editor) - bug("canvas_create_editor"); - else - { - x->gl_editor = editor_new(x); - for (y = x->gl_list; y; y = y->g_next) - if (ob = pd_checkobject(&y->g_pd)) - rtext_new(x, ob); - } + x->gl_editor = editor_new(x); + for (y = x->gl_list; y; y = y->g_next) + if (ob = pd_checkobject(&y->g_pd)) + rtext_new(x, ob); } - else +} + +void canvas_destroy_editor(t_glist *x) +{ + t_gobj *y; + t_object *ob; + if (x->gl_editor) { - if (!x->gl_editor) - bug("canvas_create_editor"); - else - { - for (y = x->gl_list; y; y = y->g_next) - if (ob = pd_checkobject(&y->g_pd)) - rtext_free(glist_findrtext(x, ob)); - editor_free(x->gl_editor, x); - x->gl_editor = 0; - } + for (y = x->gl_list; y; y = y->g_next) + if (ob = pd_checkobject(&y->g_pd)) + rtext_free(glist_findrtext(x, ob)); + editor_free(x->gl_editor, x); + x->gl_editor = 0; } - for (y = x->gl_list; y; y = y->g_next) - if (pd_class(&y->g_pd) == canvas_class && - ((t_canvas *)y)->gl_isgraph && !((t_canvas *)y)->gl_havewindow) - canvas_create_editor((t_canvas *)y, createit); } void canvas_reflecttitle(t_canvas *x); @@ -907,6 +915,8 @@ { char buf[30]; int flag = (f != 0); + if (x != glist_getcanvas(x)) + bug("canvas_vis"); if (flag) { /* post("havewindow %d, isgraph %d, isvisible %d editor %d", @@ -926,7 +936,7 @@ } else { - canvas_create_editor(x, 1); + canvas_create_editor(x); sys_vgui("pdtk_canvas_new .x%lx %d %d +%d+%d %d\n", x, (int)(x->gl_screenx2 - x->gl_screenx1), (int)(x->gl_screeny2 - x->gl_screeny1), @@ -949,14 +959,14 @@ subpatches fall here too but don'd need the editor freed, so we check if it exists. */ if (x->gl_editor) - canvas_create_editor(x, 0); + canvas_destroy_editor(x); return; } sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x); glist_noselect(x); if (glist_isvisible(x)) canvas_map(x, 0); - canvas_create_editor(x, 0); + canvas_destroy_editor(x); sys_vgui("destroy .x%lx\n", x); for (i = 1, x2 = x; x2; x2 = x2->gl_next, i++) ; @@ -966,8 +976,6 @@ if (glist_isgraph(x) && x->gl_owner) { t_glist *gl2 = x->gl_owner; - if (!x->gl_owner->gl_isdeleting) - canvas_create_editor(x, 1); if (glist_isvisible(gl2)) gobj_vis(&x->gl_gobj, gl2, 0); x->gl_havewindow = 0; @@ -987,7 +995,7 @@ { int hadeditor = (x->gl_editor != 0); if (hadeditor) - canvas_create_editor(x, 0); + canvas_destroy_editor(x); if (x->gl_owner && !x->gl_loading && glist_isvisible(x->gl_owner)) gobj_vis(&x->gl_gobj, x->gl_owner, 0); x->gl_isgraph = 0; @@ -996,8 +1004,6 @@ gobj_vis(&x->gl_gobj, x->gl_owner, 1); canvas_fixlinesfor(x->gl_owner, &x->gl_obj); } - if (hadeditor) - canvas_create_editor(x, 1); } else if (flag) { @@ -1023,8 +1029,6 @@ } if (glist_isvisible(x) && x->gl_goprect) glist_redraw(x); - if (x->gl_loading && x->gl_owner && glist_isvisible(x->gl_owner)) - canvas_create_editor(x, 1); if (x->gl_owner && !x->gl_loading && glist_isvisible(x->gl_owner)) { gobj_vis(&x->gl_gobj, x->gl_owner, 1); @@ -1549,7 +1553,7 @@ else hiy = x->gl_editor->e_ywas, loy = ypos; canvas_selectinrect(x, lox, loy, hix, hiy); sys_vgui(".x%lx.c delete x\n", x); - x->gl_editor->e_onmotion = 0; + x->gl_editor->e_onmotion = MA_NONE; } else sys_vgui(".x%lx.c coords x %d %d %d %d\n", x, x->gl_editor->e_xwas, @@ -1580,8 +1584,25 @@ /* after motion, if there's only one item selected, activate it */ if (x->gl_editor->e_selection && !(x->gl_editor->e_selection->sel_next)) - gobj_activate(x->gl_editor->e_selection->sel_what, - x, 1); + { + t_gobj *g = x->gl_editor->e_selection->sel_what; + t_glist *gl2; + /* first though, check we aren't an abstraction with a + dirty sub-patch that would be discarded if we edit this. */ + if (pd_class(&g->g_pd) == canvas_class && + canvas_isabstraction((t_glist *)g) && + (gl2 = glist_finddirty((t_glist *)g))) + { + 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); + return; + } + /* OK, activate it */ + gobj_activate(x->gl_editor->e_selection->sel_what, x, 1); + } } if (x->gl_editor->e_onmotion != MA_NONE) sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x); @@ -1609,7 +1630,8 @@ } if (resortin) canvas_resortinlets(x); if (resortout) canvas_resortoutlets(x); - canvas_dirty(x, 1); + if (x->gl_editor->e_selection) + canvas_dirty(x, 1); } /* this routine is called whenever a key is pressed or released. "x" @@ -1686,6 +1708,10 @@ return; if (x && down) { + t_object *ob; + /* cancel any dragging action */ + if (x->gl_editor->e_onmotion == MA_MOVE) + x->gl_editor->e_onmotion = MA_NONE; /* if an object has "grabbed" keys just send them on */ if (x->gl_editor->e_grab && x->gl_editor->e_keyfn && keynum) @@ -1699,15 +1725,34 @@ || !strcmp(gotkeysym->s_name, "Left") || !strcmp(gotkeysym->s_name, "Right"))) { - if (!x->gl_editor->e_textdirty) + /* 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) { - canvas_setundo(x, canvas_undo_cut, - canvas_undo_set_cut(x, UCUT_TEXT), "typing"); + 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); } - rtext_key(x->gl_editor->e_textedfor, - (int)keynum, gotkeysym); - if (x->gl_editor->e_textdirty) - canvas_dirty(x, 1); + 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); + } } /* check for backspace or clear */ else if (keynum == 8 || keynum == 127) @@ -1795,6 +1840,7 @@ } /* ----------------------------- window stuff ----------------------- */ +extern int sys_perf; void canvas_print(t_canvas *x, t_symbol *s) { @@ -1827,11 +1873,11 @@ { canvas_vis(g2, 1); sys_vgui( -"pdtk_check {Discard changes to this window??} {.x%lx menuclose 3;\n} no\n", - g2); +"pdtk_check {Discard changes to '%s'?} {.x%lx menuclose 3;\n} no\n", + canvas_getrootfor(g2)->gl_name->s_name, g2); return; } - if (f == 0) + if (f == 0 && sys_perf) sys_vgui("pdtk_check {really quit?} {pd quit;\n} yes\n"); else glob_quit(0); } @@ -1854,18 +1900,19 @@ g = glist_finddirty(x); if (g) { - canvas_vis(g, 1); + vmess(&g->gl_pd, gensym("menu-open"), ""); sys_vgui( -"pdtk_check {Discard changes to this window??} {.x%lx menuclose 2;\n} no\n", - g); +"pdtk_check {Discard changes to '%s'?} {.x%lx menuclose 2;\n} no\n", + canvas_getrootfor(g)->gl_name->s_name, g); return; } - else + else if (sys_perf) { sys_vgui( -"pdtk_check {Close this window??} {.x%lx menuclose 1;\n} yes\n", - x); +"pdtk_check {Close '%s'?} {.x%lx menuclose 1;\n} yes\n", + canvas_getrootfor(x)->gl_name->s_name, x); } + else pd_free(&x->gl_pd); } else if (force == 1) pd_free(&x->gl_pd); @@ -1877,10 +1924,10 @@ g = glist_finddirty(x); if (g) { - canvas_vis(g, 1); + vmess(&g->gl_pd, gensym("menu-open"), ""); sys_vgui( -"pdtk_check {Discard changes to this window??} {.x%lx menuclose 2;\n} no\n", - g); +"pdtk_check {Discard changes to '%s'?} {.x%lx menuclose 2;\n} no\n", + canvas_getrootfor(x)->gl_name->s_name, g); return; } else pd_free(&x->gl_pd); @@ -2361,10 +2408,10 @@ as needed */ if (pd_class(&src->g_pd) == text_class && objsrc->te_type == T_OBJECT) while (outno >= obj_noutlets(objsrc)) - outlet_new(objsrc, &s_); + outlet_new(objsrc, 0); if (pd_class(&sink->g_pd) == text_class && objsink->te_type == T_OBJECT) while (inno >= obj_ninlets(objsink)) - inlet_new(objsink, &objsink->ob_pd, &s_, &s_); + inlet_new(objsink, &objsink->ob_pd, 0, 0); if (!(oc = obj_connect(objsrc, outno, objsink, inno))) goto bad; if (glist_isvisible(x)) Modified: trunk/pd/src/g_rtext.c =================================================================== --- trunk/pd/src/g_rtext.c 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/g_rtext.c 2008-12-30 01:51:31 UTC (rev 10469) @@ -342,8 +342,11 @@ /* find the rtext that goes with a text item */ t_rtext *glist_findrtext(t_glist *gl, t_text *who) { - t_rtext *x = gl->gl_editor->e_rtext; - while (x && x->x_text != who) x = x->x_next; + t_rtext *x; + if (!gl->gl_editor) + canvas_create_editor(gl); + for (x = gl->gl_editor->e_rtext; x && x->x_text != who; x = x->x_next) + ; if (!x) bug("glist_findrtext"); return (x); } Modified: trunk/pd/src/g_text.c =================================================================== --- trunk/pd/src/g_text.c 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/g_text.c 2008-12-30 01:51:31 UTC (rev 10469) @@ -131,9 +131,36 @@ canvas_unsetcurrent((t_canvas *)gl); } + /* utility routine to figure out where to put a new text box from menu + and whether to connect to it automatically */ +static void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp, + int *indexp, int *totalp) +{ + int xpix, ypix, indx = 0, nobj = 0, x1, x2, y1, y2; + int connectme = (x->gl_editor->e_selection && + !x->gl_editor->e_selection->sel_next); + if (connectme) + { + t_gobj *g; + for (g = x->gl_list, nobj = 0; g; g = g->g_next, nobj++) + if (g == x->gl_editor->e_selection->sel_what) + { + gobj_getrect(g, x, &x1, &y1, &x2, &y2); + indx = nobj; + *xpixp = x1; + *ypixp = y2 + 5; + } + } + else glist_getnextxy(x, xpixp, ypixp); + glist_noselect(x); + *connectp = connectme; + *indexp = indx; + *totalp = nobj; +} + /* object creation routine. These are called without any arguments if - they're invoked from the - gui; when pasting or restoring from a file, we get at least x and y. */ + they're invoked from the gui; when pasting or restoring from a file, we + get at least x and y. */ void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { @@ -145,18 +172,20 @@ canvas_objtext(gl, atom_getintarg(0, argc, argv), atom_getintarg(1, argc, argv), 0, b); } - else if(!glist_isvisible(gl)){ - /* JMZ: not a good idea to go into interactive mode in a closed canvas... */ - post("unable to create stub object in closed canvas!"); - return; - } else { + /* JMZ: don't go into interactive mode in a closed canvas */ + else if (!glist_isvisible(gl)) + post("unable to create stub object in closed canvas!"); + else + { + /* interactively create new obect */ t_binbuf *b = binbuf_new(); - int xpix, ypix; + int connectme, xpix, ypix, indx, nobj; + canvas_howputnew(gl, &connectme, &xpix, &ypix, &indx, &nobj); pd_vmess(&gl->gl_pd, gensym("editmode"), "i", 1); - glist_noselect(gl); - glist_getnextxy(gl, &xpix, &ypix); canvas_objtext(gl, xpix, ypix, 1, b); - canvas_startmotion(glist_getcanvas(gl)); + if (connectme) + canvas_connect(gl, indx, 0, nobj, 0); + else canvas_startmotion(glist_getcanvas(gl)); } } @@ -417,24 +446,23 @@ if (argc > 2) binbuf_restore(x->m_text.te_binbuf, argc-2, argv+2); glist_add(gl, &x->m_text.te_g); } + else if (!glist_isvisible(gl)) + post("unable to create stub message in closed canvas!"); else { - int xpix, ypix; - /* JMZ: not a good idea to go into interactive mode in a closed canvas... */ - if(!glist_isvisible(gl)){ - post("unable to create stub message in closed canvas!"); - return; - } + int connectme, xpix, ypix, indx, nobj; + canvas_howputnew(gl, &connectme, &xpix, &ypix, &indx, &nobj); + pd_vmess(&gl->gl_pd, gensym("editmode"), "i", 1); - glist_noselect(gl); - glist_getnextxy(gl, &xpix, &ypix); - x->m_text.te_xpix = xpix-3; - x->m_text.te_ypix = ypix-3; + x->m_text.te_xpix = xpix; + x->m_text.te_ypix = ypix; 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)); + if (connectme) + canvas_connect(gl, indx, 0, nobj, 0); + else canvas_startmotion(glist_getcanvas(gl)); } } @@ -876,19 +904,20 @@ } else { - int xpix, ypix; + int connectme, xpix, ypix, indx, nobj; + canvas_howputnew(gl, &connectme, &xpix, &ypix, &indx, &nobj); 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); x->a_text.te_xpix = xpix; x->a_text.te_ypix = ypix; glist_add(gl, &x->a_text.te_g); glist_noselect(gl); glist_select(gl, &x->a_text.te_g); - canvas_startmotion(glist_getcanvas(gl)); + if (connectme) + canvas_connect(gl, indx, 0, nobj, 0); + else canvas_startmotion(glist_getcanvas(gl)); } } @@ -1321,10 +1350,18 @@ else binbuf_text(x->te_binbuf, buf, bufsize); } + /* this gets called when amessage gets sent to an object whose creation + failed, presumably because of loading a patch with a missing extern or + abstraction */ +static void text_anything(t_text *x, t_symbol *s, int argc, t_atom *argv) +{ +} + void g_text_setup(void) { text_class = class_new(gensym("text"), 0, 0, sizeof(t_text), CLASS_NOINLET | CLASS_PATCHABLE, 0); + class_addanything(text_class, text_anything); message_class = class_new(gensym("message"), 0, (t_method)message_free, sizeof(t_message), CLASS_PATCHABLE, 0); Modified: trunk/pd/src/m_glob.c =================================================================== --- trunk/pd/src/m_glob.c 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/m_glob.c 2008-12-30 01:51:31 UTC (rev 10469) @@ -8,6 +8,8 @@ t_class *glob_pdobject; static t_class *maxclass; +int sys_perf; /* true if we should query user on close and quit */ + /* These "glob" routines, which implement messages to Pd, are from all over. Some others are prototyped in m_imp.h as well. */ @@ -55,6 +57,11 @@ error("file format newer than this version of Pd (trying anyway...)"); } +static void glob_perf(t_pd *dummy, float f) +{ + sys_perf = (f != 0); +} + void max_default(t_pd *x, t_symbol *s, int argc, t_atom *argv) { int i; @@ -121,6 +128,8 @@ gensym("save-preferences"), 0); class_addmethod(glob_pdobject, (t_method)glob_version, gensym("version"), A_FLOAT, 0); + class_addmethod(glob_pdobject, (t_method)glob_perf, + gensym("perf"), A_FLOAT, 0); #ifdef UNIX class_addmethod(glob_pdobject, (t_method)glob_watchdog, gensym("watchdog"), 0); @@ -128,3 +137,16 @@ class_addanything(glob_pdobject, max_default); pd_bind(&glob_pdobject, gensym("pd")); } + + /* function to return version number at run time. Any of the + calling pointers may be zero in case you don't need all of them. */ +void sys_getversion(int *major, int *minor, int *bugfix) +{ + if (major) + *major = PD_MAJOR_VERSION; + if (minor) + *minor = PD_MINOR_VERSION; + if (bugfix) + *bugfix = PD_BUGFIX_VERSION; +} + Modified: trunk/pd/src/m_pd.h =================================================================== --- trunk/pd/src/m_pd.h 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/m_pd.h 2008-12-30 01:51:31 UTC (rev 10469) @@ -11,7 +11,7 @@ #define PD_MAJOR_VERSION 0 #define PD_MINOR_VERSION 42 #define PD_BUGFIX_VERSION 0 -#define PD_TEST_VERSION "test6" +#define PD_TEST_VERSION "test8" /* 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 */ @@ -642,6 +642,9 @@ #define PD_BIGORSMALL(f) 0 #endif + /* get version number at run time */ +EXTERN void sys_getversion(int *major, int *minor, int *bugfix); + #if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) } #endif Modified: trunk/pd/src/makefile.in =================================================================== --- trunk/pd/src/makefile.in 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/makefile.in 2008-12-30 01:51:31 UTC (rev 10469) @@ -163,32 +163,33 @@ BINARYMODE=@binarymode@ -ABOUT_FILE=$(pddocdir)/1.manual/1.introduction.txt +ABOUT_FILE=$(DESTDIR)$(pddocdir)/1.manual/1.introduction.txt install: all - install -d $(libpdbindir) - install $(BIN_DIR)/$(GUINAME) $(libpdbindir)/$(GUINAME) - install $(BIN_DIR)/pd-watchdog $(libpdbindir)/pd-watchdog - install -m644 $(BIN_DIR)/pd.tk $(libpdbindir)/pd.tk + install -d $(DESTDIR)$(libpdbindir) + install $(BIN_DIR)/$(GUINAME) $(DESTDIR)$(libpdbindir)/$(GUINAME) + install $(BIN_DIR)/pd-watchdog $(DESTDIR)$(libpdbindir)/pd-watchdog + install -m644 $(BIN_DIR)/pd.tk $(DESTDIR)$(libpdbindir)/pd.tk install -d $(DESTDIR)$(bindir) install $(BINARYMODE) $(PDEXEC) $(DESTDIR)$(bindir)/pd install -m755 $(BIN_DIR)/pdsend $(DESTDIR)$(bindir)/pdsend install -m755 $(BIN_DIR)/pdreceive $(DESTDIR)$(bindir)/pdreceive for dir in $(shell ls -1 ../doc | grep -v CVS); do \ echo "installing $$dir"; \ - install -d $(pddocdir)/$$dir ; \ - install -m644 -p ../doc/$$dir/*.* $(pddocdir)/$$dir ; \ + install -d $(DESTDIR)$(pddocdir)/$$dir ; \ + install -m644 -p ../doc/$$dir/*.* $(DESTDIR)$(pddocdir)/$$dir ; \ done for dir in $(shell ls -1 ../doc/7.stuff | grep -v CVS); do \ echo "installing 7.stuff/$$dir"; \ - install -d $(pddocdir)/7.stuff/$$dir ; \ - install -m644 -p ../doc/7.stuff/$$dir/*.* $(pddocdir)/7.stuff/$$dir ; \ + install -d $(DESTDIR)$(pddocdir)/7.stuff/$$dir ; \ + install -m644 -p ../doc/7.stuff/$$dir/*.* \ + $(DESTDIR)$(pddocdir)/7.stuff/$$dir ; \ done mv $(ABOUT_FILE) $(ABOUT_FILE).tmp cat $(ABOUT_FILE).tmp | sed 's|PD_VERSION|Pd version $(PD_VERSION)|' \ > $(ABOUT_FILE) rm $(ABOUT_FILE).tmp - cp -pr ../extra $(libpddir)/ - rm -f $(libpddir)/extra/*/*.o + cp -pr ../extra $(DESTDIR)$(libpddir)/ + rm -f $(DESTDIR)$(libpddir)/extra/*/*.o install -d $(DESTDIR)$(includedir) install -m644 m_pd.h $(DESTDIR)$(includedir)/m_pd.h install -d $(DESTDIR)$(mandir)/man1 @@ -230,7 +231,7 @@ $(CC) $(CPPFLAGS) -M $(SRC) > makefile.dependencies uninstall: - rm -f -r $(libpddir) + rm -f -r $(DESTDIR)$(libpddir) rm -f $(DESTDIR)$(bindir)/pd rm -f $(DESTDIR)$(bindir)/pdsend rm -f $(DESTDIR)$(bindir)/pdreceive Modified: trunk/pd/src/notes.txt =================================================================== --- trunk/pd/src/notes.txt 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/notes.txt 2008-12-30 01:51:31 UTC (rev 10469) @@ -1,5 +1,5 @@ ---------------- dolist -------------------- -done: +close patch with dirty GOP abstraction can't vis the abstraction to query test: compile on various versions of linux @@ -15,6 +15,7 @@ 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 find asdf$1 (e.g.) doesn't work @@ -29,7 +30,6 @@ TK commands to nonexistent windows? (occasionally still happens) still can't detect when a window is moved or resized open_via_path call in d_soundfile.c isn't threadsafe -crashed Pd putting vec and template in wrong order in array element of struct floor, ciel functions in expr misdeclared graph names don't appear until graph moved? (invis/vis on new array/rename) don't filter locked click() through getrect Modified: trunk/pd/src/s_audio.c =================================================================== --- trunk/pd/src/s_audio.c 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/s_audio.c 2008-12-30 01:51:31 UTC (rev 10469) @@ -175,7 +175,7 @@ /* set audio device settings (after cleaning up the specified device and channel vectors). The audio devices are "zero based" (i.e. "0" means the - first one.) We can later re-open audio and/or show the settings on a\ + first one.) We can later re-open audio and/or show the settings on a dialog window. */ void sys_set_audio_settings(int naudioindev, int *audioindev, int nchindev, Modified: trunk/pd/src/s_audio_oss.c =================================================================== --- trunk/pd/src/s_audio_oss.c 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/s_audio_oss.c 2008-12-30 01:51:31 UTC (rev 10469) @@ -70,7 +70,6 @@ /* OSS-specific private variables */ static int oss_blockmode = 1; /* flag to use "blockmode" */ -static int oss_32bit = 0; /* allow 23 bit transfers in OSS */ static char ossdsp[] = "/dev/dsp%d"; /* don't assume we can turn all 31 bits when doing float-to-fix; @@ -109,12 +108,6 @@ countedthem = 1; } -void oss_set32bit( void) -{ - oss_32bit = 1; -} - - typedef struct _multidev { int fd; int channels; @@ -128,15 +121,6 @@ return err; } - /* The AFMT_S32_BLOCKED format is not defined in standard linux kernels - but is proposed by Guenter Geiger to support extending OSS to handle - 32 bit sample. This is user in Geiger's OSS driver for RME Hammerfall. - I'm not clear why this isn't called AFMT_S32_[SLN]E... */ - -#ifndef AFMT_S32_BLOCKED -#define AFMT_S32_BLOCKED 0x0000400 -#endif - void oss_configure(t_oss_dev *dev, int srate, int dac, int skipblocksize) { int orig, param, nblk, fd = dev->d_fd, wantformat; @@ -145,22 +129,12 @@ audio_buf_info ainfo; - /* set resolution - first try 4 byte samples */ - if (oss_32bit && (ioctl(fd,SNDCTL_DSP_GETFMTS,¶m) >= 0) && - (param & AFMT_S32_BLOCKED)) - { - wantformat = AFMT_S32_BLOCKED; - dev->d_bytespersamp = 4; - } - else - { - wantformat = AFMT_S16_NE; - dev->d_bytespersamp = 2; - } + /* we only know how to do 2 byte samples */ + wantformat = AFMT_S16_NE; + dev->d_bytespersamp = 2; + param = wantformat; - if (sys_verbose) - post("bytes per sample = %d", dev->d_bytespersamp); if (ioctl(fd, SNDCTL_DSP_SETFMT, ¶m) == -1) fprintf(stderr,"OSS: Could not set DSP format\n"); else if (wantformat != param) @@ -740,19 +714,8 @@ linux_dacs[dev].d_dropcount--; else { - if (linux_dacs[dev].d_bytespersamp == 4) + if (linux_dacs[dev].d_bytespersamp == 2) { - for (i = DEFDACBLKSIZE * nchannels, fp1 = sys_soundout + - DEFDACBLKSIZE*thischan, - lp = (t_oss_int32 *)buf; i--; fp1++, lp++) - { - float f = *fp1 * 2147483648.; - *lp = (f >= 2147483647. ? 2147483647. : - (f < -2147483648. ? -2147483648. : f)); - } - } - else - { for (i = DEFDACBLKSIZE, fp1 = sys_soundout + DEFDACBLKSIZE*thischan, sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels) @@ -798,17 +761,8 @@ } timeref = timenow; - if (linux_adcs[dev].d_bytespersamp == 4) + if (linux_adcs[dev].d_bytespersamp == 2) { - for (i = DEFDACBLKSIZE*nchannels, - fp1 = sys_soundin + thischan*DEFDACBLKSIZE, - lp = (t_oss_int32 *)buf; i--; fp1++, lp++) - { - *fp1 = ((float)(*lp))*(float)(1./2147483648.); - } - } - else - { for (i = DEFDACBLKSIZE,fp1 = sys_soundin + thischan*DEFDACBLKSIZE, sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels) { Modified: trunk/pd/src/s_audio_pa.c =================================================================== --- trunk/pd/src/s_audio_pa.c 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/s_audio_pa.c 2008-12-30 01:51:31 UTC (rev 10469) @@ -11,7 +11,6 @@ #include "s_stuff.h" #include <stdio.h> #include <stdlib.h> -#include <unistd.h> #include <portaudio.h> #include "s_audio_pablio.h" @@ -30,11 +29,15 @@ int pa_foo; +#ifndef MSW +#include <unistd.h> +#endif static void pa_init(void) { static int initialized; if (!initialized) { +#ifndef MSW /* Initialize PortAudio */ /* for some reason Pa_Initialize(0 closes file descriptor 1. As a workaround, dup it to another number and dup2 it back @@ -46,6 +49,9 @@ dup2(newfd, 1); close(newfd); } +#else + int err = Pa_Initialize(); +#endif if ( err != paNoError ) { fprintf( stderr, Modified: trunk/pd/src/s_loader.c =================================================================== --- trunk/pd/src/s_loader.c 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/s_loader.c 2008-12-30 01:51:31 UTC (rev 10469) @@ -203,8 +203,6 @@ return (1); } -/* callback type definition */ -typedef int (*loader_t)(t_canvas *canvas, char *classname); /* linked list of loaders */ typedef struct loader_queue { Modified: trunk/pd/src/s_main.c =================================================================== --- trunk/pd/src/s_main.c 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/s_main.c 2008-12-30 01:51:31 UTC (rev 10469) @@ -333,7 +333,6 @@ #ifdef USEAPI_OSS "-oss -- use OSS audio API\n", -"-32bit ----- allow 32 bit OSS audio (for RME Hammerfall)\n", #endif #ifdef USEAPI_ALSA @@ -619,12 +618,6 @@ sys_set_audio_api(API_OSS); argc--; argv++; } - else if (!strcmp(*argv, "-32bit")) - { - sys_set_audio_api(API_OSS); - oss_set32bit(); - argc--; argv++; - } #endif #ifdef USEAPI_ALSA else if (!strcmp(*argv, "-alsa")) Modified: trunk/pd/src/s_stuff.h =================================================================== --- trunk/pd/src/s_stuff.h 2008-12-29 14:34:50 UTC (rev 10468) +++ trunk/pd/src/s_stuff.h 2008-12-30 01:51:31 UTC (rev 10469) @@ -49,11 +49,14 @@ extern int sys_defaultfont; extern t_symbol *sys_libdir; /* library directory for auxilliary files */ -extern t_symbol *sys_guidir; /* directory holding pd_gui (also pd, u_pdsend, etc) */ +extern t_symbol *sys_guidir; /* directory holding pd_gui, u_pdsend, etc */ /* s_loader.c */ -int sys_load_lib(t_canvas *canvas, char *filename); +typedef int (*loader_t)(t_canvas *canvas, char *classname); /* callback type */ +EXTERN int sys_load_lib(t_canvas *canvas, char *filename); +EXTERN void sys_register_loader(loader_t loader); + /* s_audio.c */ #define SENDDACS_NO 0 /* return values for sys_send_dacs() */ This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data:[10468] branches/pd-devel/0.41.4/src
by chunlee@users.sourceforge.net
29 Dec '08
29 Dec '08
Revision: 10468
http://pure-data.svn.sourceforge.net/pure-data/?rev=10468&view=rev
Author: chunlee Date: 2008-12-29 14:34:50 +0000 (Mon, 29 Dec 2008) Log Message: ----------- init_locale Modified Paths: -------------- branches/pd-devel/0.41.4/src/pd.tk branches/pd-devel/0.41.4/src/pd_menus.tcl branches/pd-devel/0.41.4/src/pd_say.tcl Modified: branches/pd-devel/0.41.4/src/pd.tk =================================================================== --- branches/pd-devel/0.41.4/src/pd.tk 2008-12-28 08:37:30 UTC (rev 10467) +++ branches/pd-devel/0.41.4/src/pd.tk 2008-12-29 14:34:50 UTC (rev 10468) @@ -30,8 +30,8 @@ } } if {![info exists cmd_ops(lang)]} {set cmd_ops(lang) "en"} +init_locale -puts $cmd_ops(lang) # ------------------------------------------------------------------------------ # init functions Modified: branches/pd-devel/0.41.4/src/pd_menus.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_menus.tcl 2008-12-28 08:37:30 UTC (rev 10467) +++ branches/pd-devel/0.41.4/src/pd_menus.tcl 2008-12-29 14:34:50 UTC (rev 10468) @@ -36,7 +36,7 @@ proc ::pd_menus::create_file_menu_aqua {rootmenu} { variable accelerator - $rootmenu add command -label [say "New"] -accelerator "$accelerator+N" + $rootmenu add command -label [say "new_file"] -accelerator "$accelerator+N" $rootmenu add command -label [say "Open"] -accelerator "$accelerator+O" $rootmenu add cascade -label [say "Open Recent"] $rootmenu add separator @@ -66,7 +66,7 @@ proc ::pd_menus::create_file_menu_x11 {rootmenu} { variable accelerator - $rootmenu add command -label [say "New"] -accelerator "$accelerator+N" + $rootmenu add command -label [say "new_file"] -accelerator "$accelerator+N" $rootmenu add command -label [say "Open"] -accelerator "$accelerator+O" $rootmenu add separator $rootmenu add command -label [say "Save"] -accelerator "$accelerator+S" @@ -96,7 +96,7 @@ proc ::pd_menus::create_file_menu_win32 {rootmenu} { variable accelerator - $rootmenu add command -label [say "New"] -accelerator "$accelerator+N" + $rootmenu add command -label [say "new_file"] -accelerator "$accelerator+N" $rootmenu add command -label [say "Open"] -accelerator "$accelerator+O" $rootmenu add separator $rootmenu add command -label [say "Save"] -accelerator "$accelerator+S" @@ -126,7 +126,7 @@ # menu building functions proc ::pd_menus::create_file_menu {rootmenu name} { [format create_file_menu_%s [tk windowingsystem]] $rootmenu - $rootmenu entryconfigure [say "New"] -command {menu_new} + $rootmenu entryconfigure [say "new_file"] -command {menu_new} $rootmenu entryconfigure [say "Open"] -command {menu_open} $rootmenu entryconfigure [say "Save"] -command {menu_save $name} $rootmenu entryconfigure [say "Save As..."] -command {menu_saveas $name} Modified: branches/pd-devel/0.41.4/src/pd_say.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_say.tcl 2008-12-28 08:37:30 UTC (rev 10467) +++ branches/pd-devel/0.41.4/src/pd_say.tcl 2008-12-29 14:34:50 UTC (rev 10468) @@ -7,6 +7,39 @@ package provide pd_say 0.1 -proc say {name} { - return "$name" +proc init_locale {} { + global cmd_ops + set encoding "" + switch $cmd_ops(lang) { + en {set langfile "english"} + ch {set langfile "chinese"; set encoding utf-8} + defalut {set langfile "english"} + } + #hardcoded the path for now + set langfile locale/${langfile}.tcl + if {$encoding != ""} {source -encoding $encoding $langfile} else {source $langfile} + puts "$cmd_ops(lang) | $langfile" +} + +proc say2 {name args} { + return $name +} + +proc say {name args} { + global text + if {[llength $args]} { + set text($name) [lindex $args 0] + } else { + if {[info exist text($name)]} { + return $text($name) + } else {return $name} + } +} + +proc say_category {text} { + #can't remember what this is for..... +} + +proc say_namespace {text code} { + #later.. } \ No newline at end of file This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data:[10467] branches/pd-devel/0.41.4/src
by chunlee@users.sourceforge.net
28 Dec '08
28 Dec '08
Revision: 10467
http://pure-data.svn.sourceforge.net/pure-data/?rev=10467&view=rev
Author: chunlee Date: 2008-12-28 08:37:30 +0000 (Sun, 28 Dec 2008) Log Message: ----------- pd_say.tcl, locale Modified Paths: -------------- branches/pd-devel/0.41.4/src/pd.tk branches/pd-devel/0.41.4/src/pd_menus.tcl branches/pd-devel/0.41.4/src/pkgIndex.tcl Added Paths: ----------- branches/pd-devel/0.41.4/src/locale/ branches/pd-devel/0.41.4/src/locale/chinese.tcl branches/pd-devel/0.41.4/src/pd_say.tcl Added: branches/pd-devel/0.41.4/src/locale/chinese.tcl =================================================================== --- branches/pd-devel/0.41.4/src/locale/chinese.tcl (rev 0) +++ branches/pd-devel/0.41.4/src/locale/chinese.tcl 2008-12-28 08:37:30 UTC (rev 10467) @@ -0,0 +1,556 @@ +### Menus + +say file "案檔" + say new_file "新案檔" + say open_file "開啟舊檔..." + say server_prefs "伺服器設定..." + say client_prefs "客戶端設定..." + say send_message "傳送旨令..." + say paths "Paths..." + say close "關閉" + say save "存檔" + say save_as "另存新檔..." + say print "印出..." + say quit "結束" + + say canvasnew_file "開啟新檔" + say canvasopen_file "開啟舊檔..." + say canvassave "存檔" + say canvassave_as "另存新檔..." + say clientpdrc_editor "遠端設定" + say clientddrc_editor "終端設定" + say canvasclose "關閉" + say canvasquit "結束" + +say edit "編輯" + say undo "回上一步" + say redo "回下一步" + say cut "剪下" + say copy "拷貝" + say paste "後貼" + say duplicate "復製" + say select_all "全選" + say text_editor "Text Editor..." + say font "字體" + say tidy_up "自動排列" + say edit_mode "編輯模式" + say editmodeswitch "編輯/執行 模式" + + say canvascut "剪下" + say canvascopy "拷貝" + say canvasundo "回上一步" + say canvasredo "回下一步" + say canvaspaste "後貼" + say canvasduplicate "復製" + say canvasselect_all "全選" + say canvaseditmodeswitch "編輯/執行 模式" + +say view "顯示" + say reload "重新下載" + say redraw "重新畫製" + + say canvasreload "重新下載" + say canvasredraw "重新畫製" + +say find "尋找" + say find_again "再次尋找" + say find_last_error "尋找上一錯誤" + say string "Find string" +say canvasfind "尋找" + say canvasfind_again "再次尋找" + +# contents of Put menu is Phase 5C +say put "放置" + say Object "物件" + say Message "信息" + say Number "數字" + say Symbol "符號" + say Comment "註譯" + say Graph "圖" + say Array "陣列" + +say media "Media" + say audio_on "聲頻開啟" + say audio_off "聲頻關閉" + say test_audio_and_midi "測試聲頻及MIDI" + say load_meter "負載錶" + + say canvasaudio_on "聲頻開啟" + say canvasaudio_off "聲頻關閉" + say clienttest_audio_and_midi "測試聲頻及MIDI" + say canvasload_meter "負載錶" + +say window "視窗" + +say help "幫助" + say about "相關..." + say documentation "使用說明..." + say class_browser "物件瀏覽器..." + + say canvasabout "相關..." + +say properties "內容" +say open "開啟" + +### for key binding editor +say general "一般" +say audio_settings "聲頻設定" +say midi_settings "Midi設定" +say latency_meter "時延錶" +say Pdwindow "Pd主視窗" + +say canvaspdwindow "Pd主視窗" +say canvaslatency_meter "時延錶" +say clientaudio_settings "聲頻設定" +say clientmidi_settings "Midi設定" + +### for Properties Dialog (phase 5B) +say_category IEM +say w "寬(像素)" +say h "高(像素)" +say hold "有效顯示時限(毫秒)" +say break "有效空閒時限(毫秒)" +say min "最低數限" +say max "最高數限" +say is_log "模式" +say linear "線性" +say logarithmic "對數" +say isa "起始" +say n "選擇數量" +say steady "穩定性" +say steady_no "點選跳躍式" +say steady_yes "點選持續式" +say snd "傳送符號" +say rcv "接收符號" +say lab "標簽" +say ldx "標簽橫落差" +say ldy "標簽縱落差" +say fstyle "字形" +say fs "字體大小" +say bcol "背景研色" +say fcol "前景研色" +say lcol "標簽研色" +say yes "是" +say no "否" +say courier "courier (typewriter)" +say helvetica "helvetica (sansserif)" +say times "times (serif)" +say coords "頂端顯示" + +say_category GAtomProperties +say width "寬" +say lo "最低數限" +say hi "最高數限" +say label "標簽" +say wherelabel "標簽位置" +say symto "傳送符號" +say symfrom "接收符號" +say pos "標簽位置" +say_category GraphProperties +say x1 "x from" +say x2 "x to" +say xpix "screen width" +say y2 "y from" +say y1 "y to" +say ypix "screen height" + +say_category CanvasProperties +#say xscale "X units/px" +#say yscale "Y units/px" +say gop "頂端顯示" +say xmargin "橫軸邊緣限度" +say ymargin "縱軸邊緣限度" +say height "高" +say_category ArrayProperties +say name "名子" +say n "大小" +say xfrom "橫軸範圍啟" +say xto "橫軸範圍使" +say yfrom "縱軸範圍啟" +say yto "縱軸範圍使" + + +say_category MainWindow +say in "進" +say out "出" +say audio "聲音" +say meters "聲頻錶" +say io_errors "聲頻錯誤" +say console_clear "清空顯示" +say tcl_console "TCL 旨令" +say pd_console "Pd 旨令" +### phase 2 + +say_category Other +say_namespace summary { + say_category IEMGUI + say bng "Bang Box" + say tgl "Toggle Box" + say nbx "Number Box (IEM)" + say hsl "Slider (Horizontal)" + say vsl "Slider (Vertical)" + say hradio "Choice Box (Horizontal)" + say vradio "Choice Box (Vertical)" + say cnv "Canvas (IEM)" + say dropper "Drag-and-Drop Box" + say vu "Vumeter" + + say_category GLUE + say bang "output a bang message" + say float "store and recall a number" + say symbol "store and recall a symbol" + say int "store and recall an integer" + say send "send a message to a named object" + say receive "catch sent messages" + say select "test for matching numbers or symbols" + say route "route messages according to first element" + say pack "make compound messages" + say unpack "get elements of compound messages" + say trigger "sequence and convert messagess" + say spigot "interruptible message connection" + say moses "part a numeric stream" + say until "looping mechanism" + say print "print out messages" + say makefilename "format a symbol with a variable field" + say change "remove repeated numbers from a stream" + say swap "swap two numbers" + say value "shared numeric value" + + say_category TIME + say delay "send a message after a time delay" + say metro "send a message periodically" + say line "send a series of linearly stepped numbers" + say timer "measure time intervals" + say cputime "measure CPU time" + say realtime "measure real time" + say pipe "dynamically growable delay line for numbers" + + say_category MATH + say + "add" + say - "substract" + say * "multiply" + say {/ div} "divide" + say {% mod} "division remainder" + say pow "exponentiate" + say == "equal?" + say != "not equal?" + say > "more than?" + say < "less than?" + say >= "not less than?" + say <= "not more than?" + say & "bitwise conjunction (and)" + say | "bitwise disjunction (or)" + say && "logical conjunction (and)" + say || "logical disjunction (or)" + say mtof "MIDI to Hertz" + say ftom "Hertz to MIDI" + say powtodb "Watts to dB" + say dbtopow "dB to Watts" + say rmstodb "Volts to dB" + say dbtorms "dB to Volts" + say {sin cos tan atan atan2 sqrt} "trigonometry" + say log "Euler logarithm" + say exp "Euler exponential" + say abs "absolute value" + say random "random" + say max "greater of two numbers" + say min "lesser of two numbers" + say clip "force a number into a range" + + say_category MIDI + say {notein ctlin pgmin bendin touchin polytouchin midiin sysexin} "MIDI input" + say {noteout ctlout pgmout bendout touchout polytouchout midiout} "MIDI output" + say makenote "schedule a delayed \"note off\" message corresponding to a note-on" + say stripnote "strip \"note off\" messages" + + say_category TABLES + say tabread "read a number from a table" + say tabread4 "read a number from a table, with 4 point interpolation" + say tabwrite "write a number to a table" + say soundfiler "read and write tables to soundfiles" + + say_category MISC + say loadbang "bang on load" + say serial "serial device control for NT only" + say netsend "send messages over the internet" + say netreceive "receive them" + say qlist "message sequencer" + say textfile "file to message converter" + say openpanel "\"Open\" dialog" + say savepanel "\"Save as\" dialog" + say bag "set of numbers" + say poly "polyphonic voice allocation" + say {key keyup} "numeric key values from keyboard" + say keyname "symbolic key name" + + say_category "AUDIO MATH" + foreach word {+ - * /} {say $word~ "[say $word] (for signals)"} + say max~ "supremum of signals" + say min~ "infimum of signals" + say clip~ "constrict signal to lie between two bounds" + say q8_rsqrt~ "cheap reciprocal square root (beware -- 8 bits!)" + say q8_sqrt~ "cheap square root (beware -- 8 bits!)" + say wrap~ "wraparound (fractional part, sort of)" + say fft~ "complex forward discrete Fourier transform" + say ifft~ "complex inverse discrete Fourier transform" + say rfft~ "real forward discrete Fourier transform" + say rifft~ "real inverse discrete Fourier transform" + say framp~ "output a ramp for each block" + foreach word {mtof ftom rmstodb dbtorms rmstopow powtorms} { + say $word~ "[say $word] (for signals)" + } +} + +### phase 3 + +say_namespace summary { + say_category "AUDIO GLUE" + say dac~ "audio output" + say adc~ "audio input" + say sig~ "convert numbers to audio signals" + say line~ "generate audio ramps" + say vline~ "deluxe line~" + say threshold~ "detect signal thresholds" + say snapshot~ "sample a signal (convert it back to a number)" + say vsnapshot~ "deluxe snapshot~" + say bang~ "send a bang message after each DSP block" + say samplerate~ "get the sample rate" + say send~ "nonlocal signal connection with fanout" + say receive~ "get signal from send~" + say throw~ "add to a summing bus" + say catch~ "define and read a summing bus" + say block~ "specify block size and overlap" + say switch~ "switch DSP computation on and off" + say readsf~ "soundfile playback from disk" + say writesf~ "record sound to disk" + + say_category "AUDIO OSCILLATORS AND TABLES" + say phasor~ "sawtooth oscillator" + say {cos~ osc~} "cosine oscillator" + say tabwrite~ "write to a table" + say tabplay~ "play back from a table (non-transposing)" + say tabread~ "non-interpolating table read" + say tabread4~ "four-point interpolating table read" + say tabosc4~ "wavetable oscillator" + say tabsend~ "write one block continuously to a table" + say tabreceive~ "read one block continuously from a table" + + say_category "AUDIO FILTERS" + say vcf~ "voltage controlled filter" + say noise~ "white noise generator" + say env~ "envelope follower" + say hip~ "high pass filter" + say lop~ "low pass filter" + say bp~ "band pass filter" + say biquad~ "raw filter" + say samphold~ "sample and hold unit" + say print~ "print out one or more \"blocks\"" + say rpole~ "raw real-valued one-pole filter" + say rzero~ "raw real-valued one-zero filter" + say rzero_rev~ "[say rzero~] (time-reversed)" + say cpole~ "[say rpole~] (complex-valued)" + say czero~ "[say rzero~] (complex-valued)" + say czero_rev~ "[say rzero_rev~] (complex-valued)" + + say_category "AUDIO DELAY" + say delwrite~ "write to a delay line" + say delread~ "read from a delay line" + say vd~ "read from a delay line at a variable delay time" + + say_category "SUBWINDOWS" + say pd "define a subwindow" + say table "array of numbers in a subwindow" + say inlet "add an inlet to a pd" + say outlet "add an outlet to a pd" + say inlet~ "[say inlet] (for signal)" + say outlet~ "[say outlet] (for signal)" + + say_category "DATA TEMPLATES" + say struct "define a data structure" + say {drawcurve filledcurve} "draw a curve" + say {drawpolygon filledpolygon} "draw a polygon" + say plot "plot an array field" + say drawnumber "print a numeric value" + + say_category "ACCESSING DATA" + say pointer "point to an object belonging to a template" + say get "get numeric fields" + say set "change numeric fields" + say element "get an array element" + say getsize "get the size of an array" + say setsize "change the size of an array" + say append "add an element to a list" + say sublist "get a pointer into a list which is an element of another scalar" + say scalar "draw a scalar on parent" + + say_category "OBSOLETE" + say scope~ "(use tabwrite~ now)" + say namecanvas "" ;# what was this anyway? + say template "(use struct now)" +} + +# phase 4 (pdrc & ddrc) + +say section_audio "聲頻" + say -r "取樣率" + say -audioindev "輸入裝置" + say -audiooutdev "輸出裝置" + say -inchannels "輸入音軌" + say -outchannels "輸出音軌" + say -audiobuf "聲頻緩衝器大小(毫秒)" + say -blocksize "聲頻輸出/入區塊大小(樣框數目)" + say -sleepgrain "空閒至睡眠時間(毫秒)" + say -nodac "停用聲頻輸出" + say -noadc "停用聲頻輸入" + say audio_api_choice "聲頻介面" + say default "內定值" + say -alsa "使用ALSA" + say -jack "使用JACK" + say -mmio "使用MMIO(Windows內定值)" + say -portaudio "使用ASIO(透過Portaudio)" + say -oss "使用OSS" + say -32bit "允許32位元OSS(for RME Hammerfall)" + say {} "內定值" + +say section_midi "MIDI" + say -nomidiin "停用MIDI輸入" + say -nomidiout "停用MIDI輸出" + say -midiindev "Midi輸入裝置名單" + say -midioutdev "Midi輸出裝置名單" + +say section_externals "外加功能" + say -path "尋找路徑" + say -helppath "說明文件路徑" + say -lib "加載功能組" + +say section_gui "使用者介面" + say -nogui "suppress starting the GUI (caution)" + say -guicmd "substitute another GUI program (e.g., rsh)" + say -console "console scrollback lines (0 = disable console)" + say -look "buttonbar icons" + say -statusbar "enable statusbar" + say -font "specify default font size in points" + +say section_other "其它" + say -open "自動開啟檔案" + say -verbose "詳係回報" + say -d "除錯階級" + say -noloadbang "停用 \[loadbang\]" + say -send "啟動後傳送旨令" + say -listdev "程式開啟時列出聲頻及MIDI裝置名單" + say -realtime "使用即時配給 (須要根權)" + +say section_paths "路徑" + +# phase 4B: ddrc (keyword names not finalized!) + +say section_color "色彩" + say canvas_color "畫布" + say canvasbgedit "畫布背景 (編輯模式)" + say canvasbgrun "畫布背景 (執行模式)" + say object_color "物件" + say viewframe1 "物件外框" + say viewframe2 "物件外框" + say viewframe3 "物件外框" + say viewframe4 "物件反白" + say viewbg "物件背景" + say viewfg "物件前景" + say commentbg "註譯背景" + say commentfg "註譯前景" + say commentframe1 "註譯外框" + say commentframe2 "註譯背景" + say commentframe3 "註譯背景" + say viewselectframe "物件反白外框" + say wire_color "通路" + say wirefg "通路研色" + say wirefg2 "通路反白" + say wiredspfg "聲頻通路" + say futurewiredash "未接通路" + say others_color "其它" + say boxinletfg "輸入點研色" + say boxoutletfg "輸出點研色" + say selrectrect "多選框" +say keys "快速鍵" +say others "其它" +say hairstate "顯示十字器" +say hairsnap "十字器停留物件左上角" +say statusbar "顯示目前狀態" +say buttonbar "顯示按鈕排" +say menubar "顯示清單" +say scrollbar "自動拉霸顯示" +say wirearrow "通路箭頭" +say tooltip "提示" +say insert_object "嵌入物件" +say chain_object "自動連結新物件" +say clear_wires "清除通路" +say auto_wire "移除物件" +say subpatcherize "自動封裝" +say keynav "鍵盤導覽" +say key_nav_up "上移" +say key_nav_up_shift "加入選區" +say key_nav_down "下移" +say key_nav_down_shift "加入選區" +say key_nav_right "右移" +say key_nav_right_shift "加入選區" +say key_nav_left "左移" +say key_nav_left_shift "加入選區" +say key_nav_ioselect "選擇輸出/入點" + +# phase 5A + +say cannot "不能" +say cancel "取消" +say apply "使用" +say ok "好" +say popup_open "打開" +say popup_insert "嵌入物件" +say popup_properties "內容" +say popup_clear_wires "清除通路" +say popup_auto_wire "移除物件" +say popup_help "輔助" +say filter "過濾: " +say how_many_object_classes "%d of %d object classes" +say do_what_i_mean "照我意思做" +say save_changes? "確定存檔?" +say reset "重新設定" +say Courier "Courier (monospaced)" +say Helvetica "Helvetica (sansserif)" +say Times "Times (serif)" +say add "加入" +say up "上移" +say down "下移" +say remove "移除" +say lib_add "add the name you typed to the list" +say lib_up "swap order with previous library" +say lib_down "swap order with next library" +say lib_remove "remove library selected in the list" +say dir_add "add a folder using a file dialog" +say dir_up "swap order with previous folder" +say dir_down "swap order with next folder" +say dir_remove "remove folder selected in the list" +say client_class_tree "客戶端類別樹" +say clipboard_view "閱覽筆記板" +say command_history_view "閱覽旨令歷史記錄" +say event_history_view "閱覽事件歷史記錄" +say keyboard_view "顯示鍵盤" +say abort_server "強迫中止伺服器" +# during/after piksel: + +say auto_apply "自動更新" +say font_preview "預覽:" +say font_preview_2 "ABCDEFGHIJKLMNOPQRSTUVWXYZ\nabcdefghijklmnopqrstuvwxyz\n0123456789" +say font_style "形態:" +say font_bold "粗體" +say font_italic "斜體" +say font_family "字體名:" +say font_size "大小:" +say damn "可惡!" +say preset "預設" +say console "儲存旨令行數" +say language "語言" +say pointer_sense "滑鼠游標敏感度" +say clear_selection "全部反選" +say popup_remove_from_path "移除通路中物件" +say popup_delete_from_path "刪除通路中物件" +say popup_copy_id "考背愛低" + Modified: branches/pd-devel/0.41.4/src/pd.tk =================================================================== --- branches/pd-devel/0.41.4/src/pd.tk 2008-12-26 09:13:30 UTC (rev 10466) +++ branches/pd-devel/0.41.4/src/pd.tk 2008-12-28 08:37:30 UTC (rev 10467) @@ -18,8 +18,20 @@ # ------------------------------------------------------------------------------ # global variables +# command line options +array set cmd_ops {} +for {set i 0} {$i < $argc} {incr i} { + global cmd_ops files_to_open + set o [lindex $argv $i] + switch -regexp -- $o { + ^-lang\$ {incr i; set cmd_ops(lang) [lindex $argv $i]} + default {lappend files_to_open [lindex $argv $i]} + } +} +if {![info exists cmd_ops(lang)]} {set cmd_ops(lang) "en"} +puts $cmd_ops(lang) # ------------------------------------------------------------------------------ # init functions Modified: branches/pd-devel/0.41.4/src/pd_menus.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_menus.tcl 2008-12-26 09:13:30 UTC (rev 10466) +++ branches/pd-devel/0.41.4/src/pd_menus.tcl 2008-12-28 08:37:30 UTC (rev 10467) @@ -9,6 +9,7 @@ #namespace import -force ttk::* package require pd_menucommands +package require pd_say namespace import ::pd_menucommands::* # TODO figure out Undo/Redo/Cut/Copy/Paste/DSP state changes for menus @@ -35,19 +36,19 @@ proc ::pd_menus::create_file_menu_aqua {rootmenu} { variable accelerator - $rootmenu add command -label "New" -accelerator "$accelerator+N" - $rootmenu add command -label "Open" -accelerator "$accelerator+O" - $rootmenu add cascade -label "Open Recent" + $rootmenu add command -label [say "New"] -accelerator "$accelerator+N" + $rootmenu add command -label [say "Open"] -accelerator "$accelerator+O" + $rootmenu add cascade -label [say "Open Recent"] $rootmenu add separator - $rootmenu add command -label "Close" -accelerator "$accelerator+W" - $rootmenu add command -label "Save" -accelerator "$accelerator+S" - $rootmenu add command -label "Save As..." -accelerator "$accelerator+Shift+S" - # $rootmenu add command -label "Save All" - $rootmenu add command -label "Revert to Saved" + $rootmenu add command -label [say "Close"] -accelerator "$accelerator+W" + $rootmenu add command -label [say "Save"] -accelerator "$accelerator+S" + $rootmenu add command -label [say "Save As..."] -accelerator "$accelerator+Shift+S" + # $rootmenu add command -label [say "Save All"] + $rootmenu add command -label [say "Revert to Saved"] $rootmenu add separator - $rootmenu add command -label "Message" + $rootmenu add command -label [say "Message"] $rootmenu add separator - $rootmenu add command -label "Print..." -accelerator "$accelerator+P" + $rootmenu add command -label [say "Print..."] -accelerator "$accelerator+P" } # the "Edit", "Put", and "Find" menus do not have cross-platform differences @@ -59,24 +60,24 @@ } # the "Help" does not have cross-platform differences - + # ------------------------------------------------------------------------------ # menu building functions for UNIX/X11 proc ::pd_menus::create_file_menu_x11 {rootmenu} { variable accelerator - $rootmenu add command -label "New" -accelerator "$accelerator+N" - $rootmenu add command -label "Open" -accelerator "$accelerator+O" + $rootmenu add command -label [say "New"] -accelerator "$accelerator+N" + $rootmenu add command -label [say "Open"] -accelerator "$accelerator+O" $rootmenu add separator - $rootmenu add command -label "Save" -accelerator "$accelerator+S" - $rootmenu add command -label "Save As..." -accelerator "Shift+$accelerator+S" + $rootmenu add command -label [say "Save"] -accelerator "$accelerator+S" + $rootmenu add command -label [say "Save As..."] -accelerator "Shift+$accelerator+S" # $rootmenu add command -label "Revert" $rootmenu add separator - $rootmenu add command -label "Message" -accelerator "$accelerator+M" - $rootmenu add command -label "Print..." -accelerator "$accelerator+P" + $rootmenu add command -label [say "Message"] -accelerator "$accelerator+M" + $rootmenu add command -label [say "Print..."] -accelerator "$accelerator+P" $rootmenu add separator - $rootmenu add command -label "Close" -accelerator "$accelerator+W" - $rootmenu add command -label "Quit" -accelerator "$accelerator+Q" \ + $rootmenu add command -label [say "Close"] -accelerator "$accelerator+W" + $rootmenu add command -label [say "Quit"] -accelerator "$accelerator+Q" \ -command {menu_quit} } @@ -95,18 +96,18 @@ proc ::pd_menus::create_file_menu_win32 {rootmenu} { variable accelerator - $rootmenu add command -label "New" -accelerator "$accelerator+N" - $rootmenu add command -label "Open" -accelerator "$accelerator+O" + $rootmenu add command -label [say "New"] -accelerator "$accelerator+N" + $rootmenu add command -label [say "Open"] -accelerator "$accelerator+O" $rootmenu add separator - $rootmenu add command -label "Save" -accelerator "$accelerator+S" - $rootmenu add command -label "Save As..." -accelerator "Shift+$accelerator+S" + $rootmenu add command -label [say "Save"] -accelerator "$accelerator+S" + $rootmenu add command -label [say "Save As..."] -accelerator "Shift+$accelerator+S" # $rootmenu add command -label "Revert" $rootmenu add separator - $rootmenu add command -label "Message" -accelerator "$accelerator+M" - $rootmenu add command -label "Print..." -accelerator "$accelerator+P" + $rootmenu add command -label [say "Message"] -accelerator "$accelerator+M" + $rootmenu add command -label [say "Print..."] -accelerator "$accelerator+P" $rootmenu add separator - $rootmenu add command -label "Close" -accelerator "$accelerator+W" - $rootmenu add command -label "Quit" -accelerator "$accelerator+Q" \ + $rootmenu add command -label [say "Close"] -accelerator "$accelerator+W" + $rootmenu add command -label [say "Quit"] -accelerator "$accelerator+Q" \ -command {menu_quit} } @@ -125,53 +126,53 @@ # menu building functions proc ::pd_menus::create_file_menu {rootmenu name} { [format create_file_menu_%s [tk windowingsystem]] $rootmenu - $rootmenu entryconfigure "New" -command {menu_new} - $rootmenu entryconfigure "Open" -command {menu_open} - $rootmenu entryconfigure "Save" -command {menu_save $name} - $rootmenu entryconfigure "Save As..." -command {menu_saveas $name} + $rootmenu entryconfigure [say "New"] -command {menu_new} + $rootmenu entryconfigure [say "Open"] -command {menu_open} + $rootmenu entryconfigure [say "Save"] -command {menu_save $name} + $rootmenu entryconfigure [say "Save As..."] -command {menu_saveas $name} # $rootmenu entryconfigure "Revert*" -command {menu_revert $name} - $rootmenu entryconfigure "Close" -command {menu_close $name} - $rootmenu entryconfigure "Message" -command {menu_send} - $rootmenu entryconfigure "Print..." -command {menu_print $name} + $rootmenu entryconfigure [say "Close"] -command {menu_close $name} + $rootmenu entryconfigure [say "Message"] -command {menu_send} + $rootmenu entryconfigure [say "Print..."] -command {menu_print $name} } proc ::pd_menus::create_edit_menu {rootmenu name} { variable accelerator - $rootmenu add command -label "Undo" -accelerator "$accelerator+Z" \ + $rootmenu add command -label [say "Undo"] -accelerator "$accelerator+Z" \ -command {menu_undo $name} - $rootmenu add command -label "Redo" -accelerator "Shift+$accelerator+Z" \ + $rootmenu add command -label [say "Redo"] -accelerator "Shift+$accelerator+Z" \ -command {menu_redo $name} $rootmenu add separator - $rootmenu add command -label "Cut" -accelerator "$accelerator+X" \ + $rootmenu add command -label [say "Cut"] -accelerator "$accelerator+X" \ -command {menu_cut $name} - $rootmenu add command -label "Copy" -accelerator "$accelerator+C" \ + $rootmenu add command -label [say "Copy"] -accelerator "$accelerator+C" \ -command {menu_copy $name} - $rootmenu add command -label "Paste" -accelerator "$accelerator+V" \ + $rootmenu add command -label [say "Paste"] -accelerator "$accelerator+V" \ -command {menu_paste $name} - $rootmenu add command -label "Duplicate" -accelerator "$accelerator+D" \ + $rootmenu add command -label [say "Duplicate"] -accelerator "$accelerator+D" \ -command {menu_duplicate $name} - $rootmenu add command -label "Select All" -accelerator "$accelerator+A" \ + $rootmenu add command -label [say "Select All"] -accelerator "$accelerator+A" \ -command {menu_selectall $name} $rootmenu add separator if {[tk windowingsystem] eq "aqua"} { - $rootmenu add command -label "Text Editor" \ + $rootmenu add command -label [say "Text Editor"] \ -command {menu_texteditor $name} - $rootmenu add command -label "Font" -accelerator "$accelerator+T" \ + $rootmenu add command -label [say "Font"] -accelerator "$accelerator+T" \ -command {menu_font $name} } else { - $rootmenu add command -label "Text Editor" -accelerator "$accelerator+T"\ + $rootmenu add command -label [say "Text Editor"] -accelerator "$accelerator+T"\ -command {menu_texteditor $name} - $rootmenu add command -label "Font" \ + $rootmenu add command -label [say "Font"] \ -command {menu_font $name} } - $rootmenu add command -label "Tidy Up" \ + $rootmenu add command -label [say "Tidy Up"] \ -command {menu_tidyup $name} - $rootmenu add command -label "Toggle Console" -accelerator "Shift+$accelerator+R" \ + $rootmenu add command -label [say "Toggle Console"] -accelerator "Shift+$accelerator+R" \ -command {.controls.switches.console invoke} - $rootmenu add command -label "Clear Console" -accelerator "Shift+$accelerator+L" \ + $rootmenu add command -label [say "Clear Console"] -accelerator "Shift+$accelerator+L" \ -command {menu_clear_console} $rootmenu add separator - $rootmenu add radiobutton -label "Edit Mode" -accelerator "$accelerator+E" \ + $rootmenu add radiobutton -label [say "Edit Mode"] -accelerator "$accelerator+E" \ -indicatoron true -selectcolor grey85 \ -command {menu_editmode $name} \ @@ -182,34 +183,34 @@ proc ::pd_menus::create_put_menu {rootmenu name} { variable accelerator - $rootmenu add command -label "Object" -accelerator "$accelerator+1" \ + $rootmenu add command -label [say "Object"] -accelerator "$accelerator+1" \ -command {menu_object $name 0} - $rootmenu add command -label "Message" -accelerator "$accelerator+2" \ + $rootmenu add command -label [say "Message"] -accelerator "$accelerator+2" \ -command {menu_message $name 0} - $rootmenu add command -label "Number" -accelerator "$accelerator+3" \ + $rootmenu add command -label [say "Number"] -accelerator "$accelerator+3" \ -command {menu_floatatom $name 0} - $rootmenu add command -label "Symbol" -accelerator "$accelerator+4" \ + $rootmenu add command -label [say "Symbol"] -accelerator "$accelerator+4" \ -command {menu_symbolatom $name 0} - $rootmenu add command -label "Comment" -accelerator "$accelerator+5" \ + $rootmenu add command -label [say "Comment"] -accelerator "$accelerator+5" \ -command {menu_comment $name 0} $rootmenu add separator - $rootmenu add command -label "Bang" -accelerator "Shift+$accelerator+B" \ + $rootmenu add command -label [say "Bang"] -accelerator "Shift+$accelerator+B" \ -command {menu_bng $name 0} - $rootmenu add command -label "Toggle" -accelerator "Shift+$accelerator+T" \ + $rootmenu add command -label [say "Toggle"] -accelerator "Shift+$accelerator+T" \ -command {menu_toggle $name 0} - $rootmenu add command -label "Number2" -accelerator "Shift+$accelerator+N" \ + $rootmenu add command -label [say "Number2"] -accelerator "Shift+$accelerator+N" \ -command {menu_numbox $name 0} - $rootmenu add command -label "Vslider" -accelerator "Shift+$accelerator+V" \ + $rootmenu add command -label [say "Vslider"] -accelerator "Shift+$accelerator+V" \ -command {menu_vslider $name 0} - $rootmenu add command -label "Hslider" -accelerator "Shift+$accelerator+H" \ + $rootmenu add command -label [say "Hslider"] -accelerator "Shift+$accelerator+H" \ -command {menu_hslider $name 0} - $rootmenu add command -label "Vradio" -accelerator "Shift+$accelerator+D" \ + $rootmenu add command -label [say "Vradio"] -accelerator "Shift+$accelerator+D" \ -command {menu_vradio $name 0} - $rootmenu add command -label "Hradio" -accelerator "Shift+$accelerator+I" \ + $rootmenu add command -label [say "Hradio"] -accelerator "Shift+$accelerator+I" \ -command {menu_hradio $name 0} - $rootmenu add command -label "VU Meter" -accelerator "Shift+$accelerator+U"\ + $rootmenu add command -label [say "VU Meter"] -accelerator "Shift+$accelerator+U"\ -command {menu_vumeter $name 0} - $rootmenu add command -label "Canvas" -accelerator "Shift+$accelerator+C" \ + $rootmenu add command -label [say "Canvas"] -accelerator "Shift+$accelerator+C" \ -command {menu_mycnv $name 0} $rootmenu add separator $rootmenu add command -label Graph -command {menu_graph $name} @@ -218,37 +219,37 @@ proc ::pd_menus::create_find_menu {rootmenu name} { variable accelerator - $rootmenu add command -label "Find..." -accelerator "$accelerator+F" \ + $rootmenu add command -label [say "Find..."] -accelerator "$accelerator+F" \ -command {menu_findobject $name} - $rootmenu add command -label "Find Again" -accelerator "$accelerator+G" \ + $rootmenu add command -label [say "Find Again"] -accelerator "$accelerator+G" \ -command {menu_findagain $name} - $rootmenu add command -label "Find last error" \ + $rootmenu add command -label [say "Find last error"] \ -command {menu_finderror} } proc ::pd_menus::create_media_menu {rootmenu name} { variable accelerator - $rootmenu add radiobutton -label "Compute Audio On" -accelerator "$accelerator+/" \ + $rootmenu add radiobutton -label [say "Compute Audio On"] -accelerator "$accelerator+/" \ -command {menu_audio 1} - $rootmenu add radiobutton -label "Compute Audio Off" -accelerator "$accelerator+." \ + $rootmenu add radiobutton -label [say "Compute Audio Off"] -accelerator "$accelerator+." \ -command {menu_audio 0} -indicatoron true $rootmenu add separator - $rootmenu add command -label "Test Audio and MIDI" \ + $rootmenu add command -label [say "Test Audio and MIDI"] \ -command {menu_doc_open doc/7.stuff/tools testtone.pd} - $rootmenu add command -label "Load Meter" \ + $rootmenu add command -label [say "Load Meter"] \ -command {menu_doc_open doc/7.stuff/tools load-meter.pd} } proc ::pd_menus::create_window_menu {rootmenu name} { variable accelerator if {[tk windowingsystem] eq "aqua"} { - $rootmenu add command -label "Minimize" -command {menu_minimize .} \ + $rootmenu add command -label [say "Minimize"] -command {menu_minimize .} \ -accelerator "$accelerator+M" - $rootmenu add command -label "Zoom" -command {menu_zoom .} + $rootmenu add command -label [say "Zoom"] -command {menu_zoom .} $rootmenu add separator } - $rootmenu add command -label "Parent Window" -state disabled - $rootmenu add command -label "Pd window" -command {menu_raise_console} \ + $rootmenu add command -label [say "Parent Window"] -state disabled + $rootmenu add command -label [say "Pd window"] -command {menu_raise_console} \ -accelerator "$accelerator+R" -state disabled $rootmenu add separator } @@ -265,17 +266,17 @@ } proc ::pd_menus::create_apple_menu {rootmenu name} { - $rootmenu add command -label "About Pd..." -command \ + $rootmenu add command -label [say "About Pd..."] -command \ {menu_doc_open doc/1.manual 1.introduction.txt} menu $rootmenu.preferences -tearoff 0 $rootmenu add cascade -label "Preferences" -menu $rootmenu.preferences - $rootmenu.preferences add command -label "Path..." \ + $rootmenu.preferences add command -label [say "Path..."] \ -command {pd pd start-path-dialog \;} - $rootmenu.preferences add command -label "Startup..." \ + $rootmenu.preferences add command -label [say "Startup..."] \ -command {pd pd start-startup-dialog \;} - $rootmenu.preferences add command -label "Audio Settings..." \ + $rootmenu.preferences add command -label [say "Audio Settings..."] \ -command {pd pd audio-properties \;} - $rootmenu.preferences add command -label "MIDI settings..." \ + $rootmenu.preferences add command -label [say "MIDI settings..."] \ -command {pd pd midi-properties \;} } Added: branches/pd-devel/0.41.4/src/pd_say.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_say.tcl (rev 0) +++ branches/pd-devel/0.41.4/src/pd_say.tcl 2008-12-28 08:37:30 UTC (rev 10467) @@ -0,0 +1,12 @@ +#!/usr/bin/wish +# For information on usage and redistribution, and for a DISCLAIMER OF ALL +# WARRANTIES, see the file, "LICENSE.txt," in this distribution. +# Copyright (c) 1997-2009 Miller Puckette. + +# say names in localized language + +package provide pd_say 0.1 + +proc say {name} { + return "$name" +} \ No newline at end of file Modified: branches/pd-devel/0.41.4/src/pkgIndex.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pkgIndex.tcl 2008-12-26 09:13:30 UTC (rev 10466) +++ branches/pd-devel/0.41.4/src/pkgIndex.tcl 2008-12-28 08:37:30 UTC (rev 10467) @@ -12,3 +12,4 @@ package ifneeded pd_iemgui 0.1 [list source [file join $dir pd_iemgui.tcl]] package ifneeded pd_menucommands 0.1 [list source [file join $dir pd_menucommands.tcl]] package ifneeded pd_menus 0.1 [list source [file join $dir pd_menus.tcl]] +package ifneeded pd_say 0.1 [list source [file join $dir pd_say.tcl]] This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data:[10466] branches/pd-devel/0.41.4/src
by eighthave@users.sourceforge.net
26 Dec '08
26 Dec '08
Revision: 10466
http://pure-data.svn.sourceforge.net/pure-data/?rev=10466&view=rev
Author: eighthave Date: 2008-12-26 09:13:30 +0000 (Fri, 26 Dec 2008) Log Message: ----------- - created new package for key and event bindings - added new packages to pkgIndex Modified Paths: -------------- branches/pd-devel/0.41.4/src/pd.tk branches/pd-devel/0.41.4/src/pd_menus.tcl branches/pd-devel/0.41.4/src/pkgIndex.tcl Added Paths: ----------- branches/pd-devel/0.41.4/src/pd_bindings.tcl Modified: branches/pd-devel/0.41.4/src/pd.tk =================================================================== --- branches/pd-devel/0.41.4/src/pd.tk 2008-12-26 08:04:34 UTC (rev 10465) +++ branches/pd-devel/0.41.4/src/pd.tk 2008-12-26 09:13:30 UTC (rev 10466) @@ -10,29 +10,31 @@ #namespace import -force ttk::* # set . as first dir in auto_path -set auto_path [linsert $auto_path 0 .] +set auto_path [linsert $auto_path 0 "/Users/hans/code/pure-data/branches/pd-devel/0.41.4/src"] +set auto_path [linsert $auto_path 0 "."] package require pd_menus +package require pd_bindings # ------------------------------------------------------------------------------ # global variables -# for displaying on menus -set accelerator "Ctrl" -# for key bindings -set modifier "Control" - # ------------------------------------------------------------------------------ # init functions proc init {} { switch -- [tk windowingsystem] { "x11" { + # load the dialog once, otherwise setting the vars will not work + catch {tk_getOpenFile -with-invalid-argument} + # add control to show/hide hidden files + namespace eval ::tk::dialog::file { + variable showHiddenBtn 1 + variable showHiddenVar 0 + } } "aqua" { - global modifier - set modifier "Mod1" } "win32" { font create menufont -family Tahoma -size -11 @@ -48,6 +50,7 @@ toplevel $canvas_name -width $width -height $height ::pd_menus::create_menubar $canvas_name.menubar $canvas_name configure -menu $canvas_name.menubar + ::pd_bindings::canvas_bindings $canvas_name } # ------------------------------------------------------------------------------ @@ -56,11 +59,11 @@ init wm title . "Pd-devel" - wm protocol . WM_DELETE_WINDOW menu_quit ::pd_menus::create_menubar .menubar . configure -menu .menubar -width 400 -height 250 ::pd_menus::configure_pdwindow .menubar + ::pd_bindings::window_bindings . } main Added: branches/pd-devel/0.41.4/src/pd_bindings.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_bindings.tcl (rev 0) +++ branches/pd-devel/0.41.4/src/pd_bindings.tcl 2008-12-26 09:13:30 UTC (rev 10466) @@ -0,0 +1,107 @@ +package provide pd_bindings 0.1 + +package require pd_menucommands + +namespace eval ::pd_bindings:: { + # for key bindings + if {[tk windowingsystem] eq "aqua"} { + variable modifier "Mod1" + } else { + variable modifier "Control" + } + + namespace export window_bindings + namespace export panel_bindings + namespace export canvas_bindings +} + +proc ::pd_bindings::window_bindings {name} { + variable modifier + + # File menu + bind $name <$modifier-Key-b> {menu_helpbrowser} + bind $name <$modifier-Key-n> {menu_new} + bind $name <$modifier-Key-o> {menu_open} + bind $name <$modifier-Key-p> {menu_print $name} + bind $name <$modifier-Key-q> {menu_quit} + bind $name <$modifier-Key-r> {menu_raiseconsole} + bind $name <$modifier-Key-w> {menu_close $name} + bind $name <$modifier-Shift-Key-L> {menu_clear_console} + bind $name <$modifier-Shift-Key-R> {menu_toggle_console} + + # DSP control + bind $name <$modifier-Key-slash> {menu_audio 1} + bind $name <$modifier-Key-period> {menu_audio 0} +} + +proc ::pd_bindings::pdwindow_bindings {name} { + variable modifier + + window_bindings $name + + bind . <$modifier-Key-a> {.printout.text tag add sel 1.0 end} + bind . <$modifier-Key-x> {tk_textCut .printout.text} + bind . <$modifier-Key-c> {tk_textCopy .printout.text} + bind . <$modifier-Key-v> {tk_textPaste .printout.text} + bind . <$modifier-Key-w> {pdtk_post "Can't close Pd window, ignored.\n"} + + # event bindings + wm protocol . WM_DELETE_WINDOW menu_quit +} + +proc ::pd_bindings::panel_bindings {name} { + variable modifier + + window_bindings $name + +# bind $name <KeyPress-Escape> [format "%s_cancel %s" $panelname $name] +# bind $name <KeyPress-Return> [format "%s_ok %s" $panelname $name] +# bind $name <$modifier_key-Key-w> [format "%s_cancel %s" $panelname $name] +} + +proc ::pd_bindings::canvas_bindings {name} { + variable modifier + + window_bindings $name + + bind $name <$modifier-Key-1> {menu_object $name 1} + bind $name <$modifier-Key-2> {menu_message $name 1} + bind $name <$modifier-Key-3> {menu_floatatom $name 1} + bind $name <$modifier-Key-4> {menu_symbolatom $name 1} + bind $name <$modifier-Key-5> {menu_comment $name 1} + bind $name <$modifier-Key-a> {menu_selectall $name} + bind $name <$modifier-Key-c> {menu_copy $name} + bind $name <$modifier-Key-d> {menu_duplicate $name} + bind $name <$modifier-Key-e> {menu_editmode $name} + bind $name <$modifier-Key-f> {menu_findobject $name} + bind $name <$modifier-Key-g> {menu_findagain $name} + bind $name <$modifier-Key-s> {menu_save $name} + bind $name <$modifier-Key-v> {menu_paste $name} + bind $name <$modifier-Key-x> {menu_cut $name} + bind $name <$modifier-Key-z> {menu_undo $name} + + # annoying, but Tk's bind needs uppercase letter to get the Shift + bind $name <$modifier-Shift-Key-B> {menu_bang} + bind $name <$modifier-Shift-Key-C> {menu_canvas} + bind $name <$modifier-Shift-Key-D> {menu_vradio} + bind $name <$modifier-Shift-Key-H> {menu_hslider} + bind $name <$modifier-Shift-Key-I> {menu_hradio} + bind $name <$modifier-Shift-Key-N> {menu_number2} + bind $name <$modifier-Shift-Key-S> {menu_saveas $name} + bind $name <$modifier-Shift-Key-T> {menu_toggle} + bind $name <$modifier-Shift-Key-U> {menu_vumeter} + bind $name <$modifier-Shift-Key-V> {menu_vslider} + bind $name <$modifier-Shift-Key-Z> {menu_redo $name} + + if {[tk windowingsystem] eq "aqua"} { + bind $name <Mod1-Key-m> {menu_minimize $name} + bind $name <Mod1-Key-t> {menu_font $name} + } else { + bind $name <Control-Key-m> {menu_send $name} + bind $name <Control-Key-t> {menu_texteditor $name} + } + + # event bindings + wm protocol $name WM_DELETE_WINDOW {menu_close $name} +} + Modified: branches/pd-devel/0.41.4/src/pd_menus.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_menus.tcl 2008-12-26 08:04:34 UTC (rev 10465) +++ branches/pd-devel/0.41.4/src/pd_menus.tcl 2008-12-26 09:13:30 UTC (rev 10466) @@ -21,7 +21,7 @@ namespace eval ::pd_menus:: { if {[tk windowingsystem] eq "aqua"} { - variable accelerator "Mod1" + variable accelerator "Meta" } else { variable accelerator "Ctrl" } @@ -153,10 +153,17 @@ $rootmenu add command -label "Select All" -accelerator "$accelerator+A" \ -command {menu_selectall $name} $rootmenu add separator - $rootmenu add command -label "Text Editor" -accelerator "$accelerator+T" \ - -command {menu_texteditor $name} - $rootmenu add command -label "Font" \ - -command {menu_font $name} + if {[tk windowingsystem] eq "aqua"} { + $rootmenu add command -label "Text Editor" \ + -command {menu_texteditor $name} + $rootmenu add command -label "Font" -accelerator "$accelerator+T" \ + -command {menu_font $name} + } else { + $rootmenu add command -label "Text Editor" -accelerator "$accelerator+T"\ + -command {menu_texteditor $name} + $rootmenu add command -label "Font" \ + -command {menu_font $name} + } $rootmenu add command -label "Tidy Up" \ -command {menu_tidyup $name} $rootmenu add command -label "Toggle Console" -accelerator "Shift+$accelerator+R" \ @@ -200,7 +207,7 @@ -command {menu_vradio $name 0} $rootmenu add command -label "Hradio" -accelerator "Shift+$accelerator+I" \ -command {menu_hradio $name 0} - $rootmenu add command -label "VU" -accelerator "Shift+$accelerator+U" \ + $rootmenu add command -label "VU Meter" -accelerator "Shift+$accelerator+U"\ -command {menu_vumeter $name 0} $rootmenu add command -label "Canvas" -accelerator "Shift+$accelerator+C" \ -command {menu_mycnv $name 0} Modified: branches/pd-devel/0.41.4/src/pkgIndex.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pkgIndex.tcl 2008-12-26 08:04:34 UTC (rev 10465) +++ branches/pd-devel/0.41.4/src/pkgIndex.tcl 2008-12-26 09:13:30 UTC (rev 10466) @@ -8,6 +8,7 @@ # script is sourced, the variable $dir must contain the # full path name of this file's directory. +package ifneeded pd_bindings 0.1 [list source [file join $dir pd_bindings.tcl]] package ifneeded pd_iemgui 0.1 [list source [file join $dir pd_iemgui.tcl]] package ifneeded pd_menucommands 0.1 [list source [file join $dir pd_menucommands.tcl]] package ifneeded pd_menus 0.1 [list source [file join $dir pd_menus.tcl]] This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data:[10465] branches/pd-devel/0.41.4
by chunlee@users.sourceforge.net
26 Dec '08
26 Dec '08
Revision: 10465
http://pure-data.svn.sourceforge.net/pure-data/?rev=10465&view=rev
Author: chunlee Date: 2008-12-26 08:04:34 +0000 (Fri, 26 Dec 2008) Log Message: ----------- first look around Modified Paths: -------------- branches/pd-devel/0.41.4/devel_doc/TODO branches/pd-devel/0.41.4/src/pd.tk branches/pd-devel/0.41.4/src/pd_menucommands.tcl branches/pd-devel/0.41.4/src/pkgIndex.tcl Modified: branches/pd-devel/0.41.4/devel_doc/TODO =================================================================== --- branches/pd-devel/0.41.4/devel_doc/TODO 2008-12-25 09:30:33 UTC (rev 10464) +++ branches/pd-devel/0.41.4/devel_doc/TODO 2008-12-26 08:04:34 UTC (rev 10465) @@ -1 +1,2 @@ -Test commit... +[ ] figure out Undo/Redo/Cut/Copy/Paste state changes for menus +[ ] figure out parent window/window list for Window menu Modified: branches/pd-devel/0.41.4/src/pd.tk =================================================================== --- branches/pd-devel/0.41.4/src/pd.tk 2008-12-25 09:30:33 UTC (rev 10464) +++ branches/pd-devel/0.41.4/src/pd.tk 2008-12-26 08:04:34 UTC (rev 10465) @@ -14,9 +14,6 @@ package require pd_menus -# TODO figure out Undo/Redo/Cut/Copy/Paste state changes for menus -# TODO figure out parent window/window list for Window menu - # ------------------------------------------------------------------------------ # global variables Modified: branches/pd-devel/0.41.4/src/pd_menucommands.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_menucommands.tcl 2008-12-25 09:30:33 UTC (rev 10464) +++ branches/pd-devel/0.41.4/src/pd_menucommands.tcl 2008-12-26 08:04:34 UTC (rev 10465) @@ -25,6 +25,14 @@ pdtk_canvas_new [format .flarg%d [expr round(rand()*1000)]] 30 10 } +proc ::pd_menucommands::menu_open {} { + global pd_opendir + set filename [tk_getOpenFile -defaultextension .pd \ + -filetypes { {{pd files} {.pd}} {{max files} {.pat}}} \ + -initialdir [pwd]] + if {$filename != ""} {open_file $filename} +} + proc ::pd_menucommands::menu_quit {} { # PLACEHOLDER exit Modified: branches/pd-devel/0.41.4/src/pkgIndex.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pkgIndex.tcl 2008-12-25 09:30:33 UTC (rev 10464) +++ branches/pd-devel/0.41.4/src/pkgIndex.tcl 2008-12-26 08:04:34 UTC (rev 10465) @@ -8,5 +8,6 @@ # script is sourced, the variable $dir must contain the # full path name of this file's directory. -package ifneeded pdmenucommands 0.1 [list source [file join $dir pdmenucommands.tcl]] -package ifneeded pdmenus 0.1 [list source [file join $dir pdmenus.tcl]] +package ifneeded pd_iemgui 0.1 [list source [file join $dir pd_iemgui.tcl]] +package ifneeded pd_menucommands 0.1 [list source [file join $dir pd_menucommands.tcl]] +package ifneeded pd_menus 0.1 [list source [file join $dir pd_menus.tcl]] This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data:[10464] branches/pd-devel/0.41.4/src/pd_iemgui.tcl
by eighthave@users.sourceforge.net
25 Dec '08
25 Dec '08
Revision: 10464
http://pure-data.svn.sourceforge.net/pure-data/?rev=10464&view=rev
Author: eighthave Date: 2008-12-25 09:30:33 +0000 (Thu, 25 Dec 2008) Log Message: ----------- first stab at making the iemgui code a package Added Paths: ----------- branches/pd-devel/0.41.4/src/pd_iemgui.tcl Added: branches/pd-devel/0.41.4/src/pd_iemgui.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_iemgui.tcl (rev 0) +++ branches/pd-devel/0.41.4/src/pd_iemgui.tcl 2008-12-25 09:30:33 UTC (rev 10464) @@ -0,0 +1,784 @@ +# For information on usage and redistribution, and for a DISCLAIMER OF ALL +# WARRANTIES, see the file, "LICENSE.txt," in this distribution. +# Copyright (c) 1997-2009 Miller Puckette. + +package provide pd_iemgui 0.1 +namespace eval ::pd_iemgui:: { + variable define_min_flashhold 50 + variable define_min_flashbreak 10 + variable define_min_fontsize 4 + + namespace export pdtk_iemgui_dialog +} + +############ pdtk_iemgui_dialog -- dialog window for iem guis ######### + + +proc ::pd_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 ::pd_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 ::pd_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 + + variable define_min_flashhold + variable 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] < $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] < $define_min_flashbreak} { + set $var_iemgui_min_rng $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 ::pd_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 ::pd_iemgui::clip_fontsize {id} { + set vid [string trimleft $id .] + + set var_iemgui_gn_fs [concat iemgui_gn_fs_$vid] + global $var_iemgui_gn_fs + + variable define_min_fontsize + + if {[eval concat $$var_iemgui_gn_fs] < $define_min_fontsize} { + set $var_iemgui_gn_fs $define_min_fontsize + $id.label.fs_ent configure -textvariable $var_iemgui_gn_fs + } +} + +proc ::pd_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.colors.sections.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.colors.sections.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.colors.sections.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 ::pd_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 } + ::pd_iemgui::set_col_example $id +} + +proc ::pd_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] } + } + ::pd_iemgui::set_col_example $id +} + +proc ::pd_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_::pd_iemgui::lilo0 [concat ::pd_iemgui::lilo0_$vid] + global $var_::pd_iemgui::lilo0 + set var_::pd_iemgui::lilo1 [concat ::pd_iemgui::lilo1_$vid] + global $var_::pd_iemgui::lilo1 + + ::pd_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_::pd_iemgui::lilo1] + ::pd_iemgui::verify_rng $id + ::pd_iemgui::sched_rng $id + } else { + set $var_iemgui_lin0_log1 0 + $id.para.lilo configure -text [eval concat $$var_::pd_iemgui::lilo0] + } +} + +proc ::pd_iemgui::toggle_font {id gn_f} { + set vid [string trimleft $id .] + + set var_iemgui_gn_f [concat iemgui_gn_f_$vid] + global $var_iemgui_gn_f + global fontname fontweight + + set $var_iemgui_gn_f $gn_f + + switch -- $gn_f { + 0 { set current_font $fontname} + 1 { set current_font "Helvetica" } + 2 { set current_font "Times" } + } + set current_font_spec "{$current_font} 12 $fontweight" + + $id.label.fontpopup_label configure -text $current_font \ + -font $current_font_spec + $id.label.name_entry configure -font $current_font_spec + $id.colors.sections.fr_bk configure -font $current_font_spec + $id.colors.sections.lb_bk configure -font $current_font_spec +} + +proc ::pd_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 ::pd_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 ::pd_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_::pd_iemgui::lilo0 [concat ::pd_iemgui::lilo0_$vid] + global $var_::pd_iemgui::lilo0 + set var_::pd_iemgui::lilo1 [concat ::pd_iemgui::lilo1_$vid] + global $var_::pd_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 + + ::pd_iemgui::clip_dim $id + ::pd_iemgui::clip_num $id + ::pd_iemgui::sched_rng $id + ::pd_iemgui::verify_rng $id + ::pd_iemgui::sched_rng $id + ::pd_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 #] } + + set hhhsnd [pdtk_unspace $hhhsnd] + set hhhrcv [pdtk_unspace $hhhrcv] + set hhhgui_nam [pdtk_unspace $hhhgui_nam] + + 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 ::pd_iemgui::cancel {id} {pd [concat $id cancel \;]} + +proc ::pd_iemgui::ok {id} { + ::pd_iemgui::apply $id + ::pd_iemgui::cancel $id +} + +proc ::pd_iemgui::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 .] + + global pd_nt + global fontname fontweight + + 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_::pd_iemgui::lilo0 [concat ::pd_iemgui::lilo0_$vid] + global $var_::pd_iemgui::lilo0 + set var_::pd_iemgui::lilo1 [concat ::pd_iemgui::lilo1_$vid] + global $var_::pd_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_::pd_iemgui::lilo0 $lilo0_label + set $var_::pd_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 resizable $id 0 0 + wm protocol $id WM_DELETE_WINDOW [concat ::pd_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_::pd_iemgui::lilo0] -width 5 -command "::pd_iemgui::lilo $id" } + if {[eval concat $$var_iemgui_lin0_log1] == 1} { + button $id.para.lilo -text [eval concat $$var_::pd_iemgui::lilo1] -width 5 -command "::pd_iemgui::lilo $id" } + if {[eval concat $$var_iemgui_loadbang] == 0} { + button $id.para.lb -text "no init" -width 5 -command "::pd_iemgui::lb $id" } + if {[eval concat $$var_iemgui_loadbang] == 1} { + button $id.para.lb -text "init" -width 5 -command "::pd_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 "::pd_iemgui::stdy_jmp $id" } + if {[eval concat $$var_iemgui_steady] == 1} { + button $id.para.stdy_jmp -text "steady on click" -width 11 -command "::pd_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} + + frame $id.spacer0 -height 4 + pack $id.spacer0 -side top + + labelframe $id.s_r -borderwidth 1 -pady 4 -text "messages" \ + -font highlight_font + pack $id.s_r -side top -fill x -ipadx 5 + frame $id.s_r.send + pack $id.s_r.send -side top + label $id.s_r.send.lab -text " send-symbol:" -width 12 -justify right + entry $id.s_r.send.ent -textvariable $var_iemgui_snd -width 22 + if { $snd != "nosndno" } { + pack $id.s_r.send.lab $id.s_r.send.ent -side left} + + frame $id.s_r.receive + pack $id.s_r.receive -side top + label $id.s_r.receive.lab -text "receive-symbol:" -width 12 -justify right + entry $id.s_r.receive.ent -textvariable $var_iemgui_rcv -width 22 + if { $rcv != "norcvno" } { + pack $id.s_r.receive.lab $id.s_r.receive.ent -side left} + + # get the current font name from the int given from C-space (gn_f) + set current_font $fontname + if {[eval concat $$var_iemgui_gn_f] == 1} \ + { set current_font "Helvetica" } + if {[eval concat $$var_iemgui_gn_f] == 2} \ + { set current_font "Times" } + + frame $id.spacer1 -height 7 + pack $id.spacer1 -side top + + labelframe $id.label -borderwidth 1 -text "label" -pady 4 \ + -font highlight_font + pack $id.label -side top -fill x + entry $id.label.name_entry -textvariable $var_iemgui_gui_nam -width 30 \ + -font [list $current_font 12 $fontweight] + pack $id.label.name_entry -side top -expand yes -fill both -padx 5 + + frame $id.label.xy -padx 27 -pady 1 + pack $id.label.xy -side top + label $id.label.xy.x_lab -text "x offset" -width 6 + entry $id.label.xy.x_entry -textvariable $var_iemgui_gn_dx -width 5 + label $id.label.xy.dummy1 -text " " -width 2 + label $id.label.xy.y_lab -text "y offset" -width 6 + entry $id.label.xy.y_entry -textvariable $var_iemgui_gn_dy -width 5 + pack $id.label.xy.x_lab $id.label.xy.x_entry $id.label.xy.dummy1 \ + $id.label.xy.y_lab $id.label.xy.y_entry -side left -anchor e + + label $id.label.fontpopup_label -text $current_font \ + -relief groove -font [list $current_font 12 $fontweight] -padx 5 + pack $id.label.fontpopup_label -side left -anchor w -expand yes -fill x + label $id.label.fontsize_label -text "size" -width 4 + entry $id.label.fontsize_entry -textvariable $var_iemgui_gn_fs -width 5 + pack $id.label.fontsize_entry $id.label.fontsize_label \ + -side right -anchor e -padx 5 -pady 5 + menu $id.popup + $id.popup add command \ + -label $fontname \ + -font [format {{%s} 12 %s} $fontname $fontweight] \ + -command "::pd_iemgui::toggle_font $id 0" + $id.popup add command \ + -label "Helvetica" \ + -font [format {Helvetica 12 %s} $fontweight] \ + -command "::pd_iemgui::toggle_font $id 1" + $id.popup add command \ + -label "Times" \ + -font [format {Times 12 %s} $fontweight] \ + -command "::pd_iemgui::toggle_font $id 2" + bind $id.label.fontpopup_label <Button> \ + [list tk_popup $id.popup %X %Y] + + frame $id.spacer2 -height 7 + pack $id.spacer2 -side top + + labelframe $id.colors -borderwidth 1 -text "colors" -font highlight_font + pack $id.colors -fill x -ipadx 5 -ipady 4 + + frame $id.colors.select + pack $id.colors.select -side top + radiobutton $id.colors.select.radio0 -value 0 -variable \ + $var_iemgui_l2_f1_b0 -text "background" -width 10 -justify left + radiobutton $id.colors.select.radio1 -value 1 -variable \ + $var_iemgui_l2_f1_b0 -text "front" -width 5 -justify left + radiobutton $id.colors.select.radio2 -value 2 -variable \ + $var_iemgui_l2_f1_b0 -text "label" -width 5 -justify left + if { [eval concat $$var_iemgui_fcol] >= 0 } { + pack $id.colors.select.radio0 $id.colors.select.radio1 \ + $id.colors.select.radio2 -side left + } else { + pack $id.colors.select.radio0 $id.colors.select.radio2 -side left \ + } + + frame $id.colors.sections + pack $id.colors.sections -side top + button $id.colors.sections.but -text "compose color" -width 12 \ + -command "::pd_iemgui::choose_col_bkfrlb $id" + pack $id.colors.sections.but -side left -anchor w -padx 10 -pady 5 \ + -expand yes -fill x + if { [eval concat $$var_iemgui_fcol] >= 0 } { + label $id.colors.sections.fr_bk -text "o=||=o" -width 6 \ + -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]] \ + -font [list $current_font 12 $fontweight] -padx 2 -pady 2 -relief ridge + } else { + label $id.colors.sections.fr_bk -text "o=||=o" -width 6 \ + -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]] \ + -font [list $current_font 12 $fontweight] -padx 2 -pady 2 -relief ridge + } + label $id.colors.sections.lb_bk -text "testlabel" -width 9 \ + -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]] \ + -font [list $current_font 12 $fontweight] -padx 2 -pady 2 -relief ridge + pack $id.colors.sections.lb_bk $id.colors.sections.fr_bk \ + -side right -anchor e -expand yes -fill both -pady 7 + + # color scheme by Mary Ann Benedetto
http://piR2.org
+ frame $id.colors.r1 + pack $id.colors.r1 -side top + foreach i { 0 1 2 3 4 5 6 7 8 9} \ + hexcol { 0xFFFFFF 0xDFDFDF 0xBBBBBB 0xFFC7C6 0xFFE3C6 \ + 0xFEFFC6 0xC6FFC7 0xc6FEFF 0xC7C6FF 0xE3C6FF } \ + { + label $id.colors.r1.c$i -background [format "#%6.6x" $hexcol] \ + -activebackground [format "#%6.6x" $hexcol] -relief ridge \ + -padx 7 -pady 0 + bind $id.colors.r1.c$i <Button> [format "::pd_iemgui::preset_col %s %d" $id $hexcol] + } + pack $id.colors.r1.c0 $id.colors.r1.c1 $id.colors.r1.c2 $id.colors.r1.c3 \ + $id.colors.r1.c4 $id.colors.r1.c5 $id.colors.r1.c6 $id.colors.r1.c7 \ + $id.colors.r1.c8 $id.colors.r1.c9 -side left + + frame $id.colors.r2 + pack $id.colors.r2 -side top + foreach i { 0 1 2 3 4 5 6 7 8 9 } \ + hexcol { 0x9F9F9F 0x7C7C7C 0x606060 0xFF0400 0xFF8300 \ + 0xFAFF00 0x00FF04 0x00FAFF 0x0400FF 0x9C00FF } \ + { + label $id.colors.r2.c$i -background [format "#%6.6x" $hexcol] \ + -activebackground [format "#%6.6x" $hexcol] -relief ridge \ + -padx 7 -pady 0 + bind $id.colors.r2.c$i <Button> \ + [format "::pd_iemgui::preset_col %s %d" $id $hexcol] + } + pack $id.colors.r2.c0 $id.colors.r2.c1 $id.colors.r2.c2 $id.colors.r2.c3 \ + $id.colors.r2.c4 $id.colors.r2.c5 $id.colors.r2.c6 $id.colors.r2.c7 \ + $id.colors.r2.c8 $id.colors.r2.c9 -side left + + frame $id.colors.r3 + pack $id.colors.r3 -side top + foreach i { 0 1 2 3 4 5 6 7 8 9 } \ + hexcol { 0x404040 0x202020 0x000000 0x551312 0x553512 \ + 0x535512 0x0F4710 0x0E4345 0x131255 0x2F004D } \ + { + label $id.colors.r3.c$i -background [format "#%6.6x" $hexcol] \ + -activebackground [format "#%6.6x" $hexcol] -relief ridge \ + -padx 7 -pady 0 + bind $id.colors.r3.c$i <Button> \ + [format "::pd_iemgui::preset_col %s %d" $id $hexcol] + } + pack $id.colors.r3.c0 $id.colors.r3.c1 $id.colors.r3.c2 $id.colors.r3.c3 \ + $id.colors.r3.c4 $id.colors.r3.c5 $id.colors.r3.c6 $id.colors.r3.c7 \ + $id.colors.r3.c8 $id.colors.r3.c9 -side left + + frame $id.cao -pady 10 + pack $id.cao -side top + button $id.cao.cancel -text {Cancel} -width 6 \ + -command "::pd_iemgui::cancel $id" + label $id.cao.dummy1 -text "" -width 3 + button $id.cao.apply -text {Apply} -width 6 -command "::pd_iemgui::apply $id" + label $id.cao.dummy2 -text "" -width 3 + button $id.cao.ok -text {OK} -width 6 \ + -command "::pd_iemgui::ok $id" + + pack $id.cao.cancel $id.cao.dummy1 -side left + pack $id.cao.apply $id.cao.dummy2 -side left + pack $id.cao.ok -side left + + if {[info tclversion] < 8.4} { + bind $id <Key-Tab> {tkTabToWindow [tk_focusNext %W]} + bind $id <<PrevWindow>> {tkTabToWindow [tk_focusPrev %W]} + } else { + bind $id <Key-Tab> {tk::TabToWindow [tk_focusNext %W]} + bind $id <<PrevWindow>> {tk::TabToWindow [tk_focusPrev %W]} + } + + bind $id.dim.w_ent <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.dim.h_ent <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.rng.min_ent <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.rng.max_ent <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.para.num_ent <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.s_r.send.ent <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.s_r.receive.ent <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.label.name_entry <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.label.xy.x_entry <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.label.xy.y_entry <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.label.fontsize_entry <KeyPress-Return> [concat ::pd_iemgui::ok $id] + bind $id.cao.ok <KeyPress-Return> [concat ::pd_iemgui::ok $id] + pdtk_standardkeybindings $id.dim.w_ent + pdtk_standardkeybindings $id.dim.h_ent + pdtk_standardkeybindings $id.rng.min_ent + pdtk_standardkeybindings $id.rng.max_ent + pdtk_standardkeybindings $id.para.num_ent + pdtk_standardkeybindings $id.s_r.send.ent + pdtk_standardkeybindings $id.s_r.receive.ent + pdtk_standardkeybindings $id.label.name_entry + pdtk_standardkeybindings $id.label.xy.x_entry + pdtk_standardkeybindings $id.label.xy.y_entry + pdtk_standardkeybindings $id.label.fontsize_entry + pdtk_standardkeybindings $id.cao.ok + + $id.dim.w_ent select from 0 + $id.dim.w_ent select adjust end + focus $id.dim.w_ent +} + This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data:[10463] branches/pd-devel/0.41.4/src
by eighthave@users.sourceforge.net
25 Dec '08
25 Dec '08
Revision: 10463
http://pure-data.svn.sourceforge.net/pure-data/?rev=10463&view=rev
Author: eighthave Date: 2008-12-25 08:49:55 +0000 (Thu, 25 Dec 2008) Log Message: ----------- First stab at spliting things into proper Tcl packages, it is pretty easy once you know the tricks, and I think it'll be useful. Modified Paths: -------------- branches/pd-devel/0.41.4/src/pd.tk Added Paths: ----------- branches/pd-devel/0.41.4/src/make_pkgIndex.tcl branches/pd-devel/0.41.4/src/pd_menucommands.tcl branches/pd-devel/0.41.4/src/pd_menus.tcl branches/pd-devel/0.41.4/src/pkgIndex.tcl Added: branches/pd-devel/0.41.4/src/make_pkgIndex.tcl =================================================================== --- branches/pd-devel/0.41.4/src/make_pkgIndex.tcl (rev 0) +++ branches/pd-devel/0.41.4/src/make_pkgIndex.tcl 2008-12-25 08:49:55 UTC (rev 10463) @@ -0,0 +1,5 @@ +#!/usr/bin/tclsh + +pkg_mkIndex -verbose [pwd] *.tcl + + Property changes on: branches/pd-devel/0.41.4/src/make_pkgIndex.tcl ___________________________________________________________________ Added: svn:executable + * Modified: branches/pd-devel/0.41.4/src/pd.tk =================================================================== --- branches/pd-devel/0.41.4/src/pd.tk 2008-12-25 07:54:48 UTC (rev 10462) +++ branches/pd-devel/0.41.4/src/pd.tk 2008-12-25 08:49:55 UTC (rev 10463) @@ -2,7 +2,6 @@ # For information on usage and redistribution, and for a DISCLAIMER OF ALL # WARRANTIES, see the file, "LICENSE.txt," in this distribution. # Copyright (c) 1997-2009 Miller Puckette. -#(c) 2008 WordTech Communications LLC. License: standard Tcl license,
http://www.tcl.tk/software/tcltk/license.html
package require Tk #package require tile @@ -10,9 +9,11 @@ ## replace Tk widgets with Ttk widgets on 8.5 #namespace import -force ttk::* +# set . as first dir in auto_path +set auto_path [linsert $auto_path 0 .] -# TODO switch back to creating a menubar for each window -# TODO figure out Edit Mode Checkbox menu item on Aqua +package require pd_menus + # TODO figure out Undo/Redo/Cut/Copy/Paste state changes for menus # TODO figure out parent window/window list for Window menu @@ -24,31 +25,7 @@ # for key bindings set modifier "Control" -# ------------------------------------------------------------------------------ -# PLACEHOLDERS -proc pd {} { -} - -proc menu_doc_open {docdir doc} { -# PLACEHOLDER -} - -proc menu_helpbrowser {dir} { -# PLACEHOLDER -} - -proc menu_new {} { -# PLACEHOLDER - pdtk_canvas_new [format .flarg%d [expr round(rand()*1000)]] 30 10 -} - -proc menu_quit {} { -# PLACEHOLDER - exit -} - - # ------------------------------------------------------------------------------ # init functions @@ -57,8 +34,7 @@ "x11" { } "aqua" { - global accelerator modifier - set accelerator "Meta" + global modifier set modifier "Mod1" } "win32" { @@ -68,323 +44,12 @@ } # ------------------------------------------------------------------------------ -# Mac OS X specific functions - -proc menu_bringalltofront {} { - #use [winfo children .] here to get windows that are minimized - foreach item [winfo children .] { - #get all toplevel windows, exclude menubar windows - if { [string equal [winfo toplevel $item] $item] && [catch {$item cget -tearoff}]} { - wm deiconify $item - } - } - #be sure to deiconify ., since the above command only gets the child toplevels - wm deiconify . -} - - -# ------------------------------------------------------------------------------ -# functions called from menu items - - -proc menu_minimize {} { - set windowlist [wm stackorder .] - if {$windowlist != {}} { - set topwindow [lindex $windowlist end] - wm iconify $topwindow - } -} - -proc menu_maximize {window} { - wm state $window zoomed -} - -# ------------------------------------------------------------------------------ -# menu building functions for Mac OS X/aqua - -proc menu_create_file_aqua {rootmenu} { - global accelerator - $rootmenu add command -label "New" -accelerator "$accelerator+N" - $rootmenu add command -label "Open" -accelerator "$accelerator+O" - $rootmenu add cascade -label "Open Recent" - $rootmenu add separator - $rootmenu add command -label "Close" -accelerator "$accelerator+W" - $rootmenu add command -label "Save" -accelerator "$accelerator+S" - $rootmenu add command -label "Save As..." -accelerator "$accelerator+Shift+S" -# $rootmenu add command -label "Save All" - $rootmenu add command -label "Revert to Saved" - $rootmenu add separator - $rootmenu add command -label "Message" - $rootmenu add separator - $rootmenu add command -label "Print..." -accelerator "$accelerator+P" -} - -# the "Edit", "Put", and "Find" menus do not have cross-platform differences - -proc menu_create_media_aqua {rootmenu} { -} - -proc menu_create_window_aqua {rootmenu} { -} - -# the "Help" does not have cross-platform differences - -# ------------------------------------------------------------------------------ -# menu building functions for UNIX/X11 - -proc menu_create_file_x11 {rootmenu} { - global accelerator - $rootmenu add command -label "New" -accelerator "$accelerator+N" - $rootmenu add command -label "Open" -accelerator "$accelerator+O" - $rootmenu add separator - $rootmenu add command -label "Save" -accelerator "$accelerator+S" - $rootmenu add command -label "Save As..." -accelerator "Shift+$accelerator+S" -# $rootmenu add command -label "Revert" - $rootmenu add separator - $rootmenu add command -label "Message" -accelerator "$accelerator+M" - $rootmenu add command -label "Print..." -accelerator "$accelerator+P" - $rootmenu add separator - $rootmenu add command -label "Close" -accelerator "$accelerator+W" - $rootmenu add command -label "Quit" -accelerator "$accelerator+Q" \ - -command {menu_quit} -} - -# the "Edit", "Put", and "Find" menus do not have cross-platform differences - -proc menu_create_media_x11 {rootmenu} { -} - -proc menu_create_window_x11 {rootmenu} { -} - -# the "Help" does not have cross-platform differences - -# ------------------------------------------------------------------------------ -# menu building functions for Windows/Win32 - -proc menu_create_file_win32 {rootmenu} { - global accelerator - $rootmenu add command -label "New" -accelerator "$accelerator+N" - $rootmenu add command -label "Open" -accelerator "$accelerator+O" - $rootmenu add separator - $rootmenu add command -label "Save" -accelerator "$accelerator+S" - $rootmenu add command -label "Save As..." -accelerator "Shift+$accelerator+S" -# $rootmenu add command -label "Revert" - $rootmenu add separator - $rootmenu add command -label "Message" -accelerator "$accelerator+M" - $rootmenu add command -label "Print..." -accelerator "$accelerator+P" - $rootmenu add separator - $rootmenu add command -label "Close" -accelerator "$accelerator+W" - $rootmenu add command -label "Quit" -accelerator "$accelerator+Q" \ - -command {menu_quit} -} - -# the "Edit", "Put", and "Find" menus do not have cross-platform differences - -proc menu_create_media_win32 {rootmenu} { -} - -proc menu_create_window_win32 {rootmenu} { -} - -# the "Help" does not have cross-platform differences - - -# ------------------------------------------------------------------------------ -# menu building functions -proc menu_create_file {rootmenu name} { - [format menu_create_file_%s [tk windowingsystem]] $rootmenu - $rootmenu entryconfigure "New" -command {menu_new} - $rootmenu entryconfigure "Open" -command {menu_open} - $rootmenu entryconfigure "Save" -command {menu_save $name} - $rootmenu entryconfigure "Save As..." -command {menu_saveas $name} -# $rootmenu entryconfigure "Revert*" -command {menu_revert $name} - $rootmenu entryconfigure "Close" -command {menu_close $name} - $rootmenu entryconfigure "Message" -command {menu_send} - $rootmenu entryconfigure "Print..." -command {menu_print $name} -} - -proc menu_create_edit {rootmenu name} { - global accelerator - $rootmenu add command -label "Undo" -accelerator "$accelerator+Z" \ - -command {menu_undo $name} - $rootmenu add command -label "Redo" -accelerator "Shift+$accelerator+Z" \ - -command {menu_redo $name} - $rootmenu add separator - $rootmenu add command -label "Cut" -accelerator "$accelerator+X" \ - -command {menu_cut $name} - $rootmenu add command -label "Copy" -accelerator "$accelerator+C" \ - -command {menu_copy $name} - $rootmenu add command -label "Paste" -accelerator "$accelerator+V" \ - -command {menu_paste $name} - $rootmenu add command -label "Duplicate" -accelerator "$accelerator+D" \ - -command {menu_duplicate $name} - $rootmenu add command -label "Select All" -accelerator "$accelerator+A" \ - -command {menu_selectall $name} - $rootmenu add separator - $rootmenu add command -label "Text Editor" -accelerator "$accelerator+T" \ - -command {menu_texteditor $name} - $rootmenu add command -label "Font" \ - -command {menu_font $name} - $rootmenu add command -label "Tidy Up" \ - -command {menu_tidyup $name} - $rootmenu add command -label "Toggle Console" -accelerator "Shift+$accelerator+R" \ - -command {.controls.switches.console invoke} - $rootmenu add command -label "Clear Console" -accelerator "Shift+$accelerator+L" \ - -command {menu_clear_console} - $rootmenu add separator - $rootmenu add radiobutton -label "Edit Mode" -accelerator "$accelerator+E" \ - -indicatoron true -selectcolor grey85 \ - -command {menu_editmode $name} \ - -# if { $editable == 0 } { -# $name.m.edit entryconfigure "Edit mode" -indicatoron false -# } -} - - -proc menu_create_put {rootmenu name} { - global accelerator - $rootmenu add command -label "Object" -accelerator "$accelerator+1" \ - -command {menu_object $name 0} - $rootmenu add command -label "Message" -accelerator "$accelerator+2" \ - -command {menu_message $name 0} - $rootmenu add command -label "Number" -accelerator "$accelerator+3" \ - -command {menu_floatatom $name 0} - $rootmenu add command -label "Symbol" -accelerator "$accelerator+4" \ - -command {menu_symbolatom $name 0} - $rootmenu add command -label "Comment" -accelerator "$accelerator+5" \ - -command {menu_comment $name 0} - $rootmenu add separator - $rootmenu add command -label "Bang" -accelerator "Shift+$accelerator+B" \ - -command {menu_bng $name 0} - $rootmenu add command -label "Toggle" -accelerator "Shift+$accelerator+T" \ - -command {menu_toggle $name 0} - $rootmenu add command -label "Number2" -accelerator "Shift+$accelerator+N" \ - -command {menu_numbox $name 0} - $rootmenu add command -label "Vslider" -accelerator "Shift+$accelerator+V" \ - -command {menu_vslider $name 0} - $rootmenu add command -label "Hslider" -accelerator "Shift+$accelerator+H" \ - -command {menu_hslider $name 0} - $rootmenu add command -label "Vradio" -accelerator "Shift+$accelerator+D" \ - -command {menu_vradio $name 0} - $rootmenu add command -label "Hradio" -accelerator "Shift+$accelerator+I" \ - -command {menu_hradio $name 0} - $rootmenu add command -label "VU" -accelerator "Shift+$accelerator+U" \ - -command {menu_vumeter $name 0} - $rootmenu add command -label "Canvas" -accelerator "Shift+$accelerator+C" \ - -command {menu_mycnv $name 0} - $rootmenu add separator - $rootmenu add command -label Graph -command {menu_graph $name} - $rootmenu add command -label Array -command {menu_array $name} -} - -proc menu_create_find {rootmenu name} { - global accelerator - $rootmenu add command -label "Find..." -accelerator "$accelerator+F" \ - -command {menu_findobject $name} - $rootmenu add command -label "Find Again" -accelerator "$accelerator+G" \ - -command {menu_findagain $name} - $rootmenu add command -label "Find last error" \ - -command {menu_finderror} - -} - -proc menu_create_media {rootmenu name} { - global accelerator - $rootmenu add radiobutton -label "Compute Audio On" -accelerator "$accelerator+/" \ - -command {menu_audio 1} - $rootmenu add radiobutton -label "Compute Audio Off" -accelerator "$accelerator+." \ - -command {menu_audio 0} -indicatoron true - $rootmenu add separator - $rootmenu add command -label "Test Audio and MIDI" \ - -command {menu_doc_open doc/7.stuff/tools testtone.pd} - $rootmenu add command -label "Load Meter" \ - -command {menu_doc_open doc/7.stuff/tools load-meter.pd} -} - -proc menu_create_window {rootmenu name} { - global accelerator - if {[tk windowingsystem] eq "aqua"} { - $rootmenu add command -label "Minimize" -command {menu_minimize .} \ - -accelerator "$accelerator+M" - $rootmenu add command -label "Zoom" -command {menu_zoom .} - $rootmenu add separator - } - $rootmenu add command -label "Parent Window" -state disabled - $rootmenu add command -label "Pd window" -command {menu_raise_console} \ - -accelerator "$accelerator+R" -state disabled - $rootmenu add separator -} - -proc menu_create_help {rootmenu name} { - if {[tk windowingsystem] ne "aqua"} { - $rootmenu add command -label {About Pd} \ - -command {menu_doc_open doc/1.manual 1.introduction.txt} - } - $rootmenu add command -label {HTML ...} \ - -command {menu_doc_open doc/1.manual index.htm} - $rootmenu add command -label {Browser ...} \ - -command {menu_helpbrowser $help_top_directory} -} - -proc menu_create_apple {rootmenu name} { - $rootmenu add command -label "About Pd..." -command \ - {menu_doc_open doc/1.manual 1.introduction.txt} - menu $rootmenu.preferences -tearoff 0 - $rootmenu add cascade -label "Preferences" -menu $rootmenu.preferences - $rootmenu.preferences add command -label "Path..." \ - -command {pd pd start-path-dialog \;} - $rootmenu.preferences add command -label "Startup..." \ - -command {pd pd start-startup-dialog \;} - $rootmenu.preferences add command -label "Audio Settings..." \ - -command {pd pd audio-properties \;} - $rootmenu.preferences add command -label "MIDI settings..." \ - -command {pd pd midi-properties \;} -} - -proc menu_create {rootmenu} { - menu $rootmenu - set menulist "file edit put find media window help" - if { [tk windowingsystem] eq "aqua" } { - set menulist "$menulist apple" - } - foreach menuitem $menulist { - menu $rootmenu.$menuitem -tearoff 0 - $rootmenu add cascade -label [string totitle $menuitem] \ - -menu $rootmenu.$menuitem - [format menu_create_%s $menuitem] $rootmenu.$menuitem PLACEHOLDER - if {[tk windowingsystem] eq "win32"} { - # fix menu font size on Windows with tk scaling = 1 - $rootmenu.$menuitem configure -font menufont - } - } -} - -proc menu_configure_pdwindow {menubar} { - # these are meaningless for the Pd window, so disable them - set file_items_to_disable {"Save" "Save As..." "Print..." "Close"} - foreach item $file_items_to_disable { - $menubar.file entryconfigure $item -state disabled - } - set edit_items_to_disable {"Undo" "Redo" "Duplicate" "Tidy Up" "Edit Mode"} - foreach item $edit_items_to_disable { - $menubar.edit entryconfigure $item -state disabled - } - # disable everything on the Put menu - for {set i 0} {$i <= [$menubar.put index end]} {incr i} { - # catch errors by trying to disable separators - catch {$menubar.put entryconfigure $i -state disabled } - } -} - -# ------------------------------------------------------------------------------ # canvas support functions proc pdtk_canvas_new {canvas_name width height} { if {$width < 300} {set width 300} if {$height < 150} {set height 150} toplevel $canvas_name -width $width -height $height - menu_create $canvas_name.menubar + ::pd_menus::create_menubar $canvas_name.menubar $canvas_name configure -menu $canvas_name.menubar } @@ -396,9 +61,9 @@ wm title . "Pd-devel" wm protocol . WM_DELETE_WINDOW menu_quit - menu_create .menubar + ::pd_menus::create_menubar .menubar . configure -menu .menubar -width 400 -height 250 - menu_configure_pdwindow .menubar + ::pd_menus::configure_pdwindow .menubar } main Added: branches/pd-devel/0.41.4/src/pd_menucommands.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_menucommands.tcl (rev 0) +++ branches/pd-devel/0.41.4/src/pd_menucommands.tcl 2008-12-25 08:49:55 UTC (rev 10463) @@ -0,0 +1,64 @@ + +package provide pd_menucommands 0.1 + +# ------------------------------------------------------------------------------ +# PLACEHOLDERS + +namespace eval ::pd_menucommands:: { + namespace export pd + namespace export menu_* +} + +proc ::pd_menucommands::pd {} { +} + +proc ::pd_menucommands::menu_doc_open {docdir doc} { + # PLACEHOLDER +} + +proc ::pd_menucommands::menu_helpbrowser {dir} { + # PLACEHOLDER +} + +proc ::pd_menucommands::menu_new {} { + # PLACEHOLDER + pdtk_canvas_new [format .flarg%d [expr round(rand()*1000)]] 30 10 +} + +proc ::pd_menucommands::menu_quit {} { + # PLACEHOLDER + exit +} + +# ------------------------------------------------------------------------------ +# Mac OS X specific functions + +proc ::pd_menucommands::menu_bringalltofront {} { + #use [winfo children .] here to get windows that are minimized + foreach item [winfo children .] { + #get all toplevel windows, exclude menubar windows + if { [string equal [winfo toplevel $item] $item] && [catch {$item cget -tearoff}]} { + wm deiconify $item + } + } + #be sure to deiconify ., since the above command only gets the child toplevels + wm deiconify . +} + + +# ------------------------------------------------------------------------------ +# functions called from menu items + + +proc ::pd_menucommands::menu_minimize {} { + set windowlist [wm stackorder .] + if {$windowlist != {}} { + set topwindow [lindex $windowlist end] + wm iconify $topwindow + } +} + +proc ::pd_menucommands::menu_maximize {window} { + wm state $window zoomed +} + Added: branches/pd-devel/0.41.4/src/pd_menus.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_menus.tcl (rev 0) +++ branches/pd-devel/0.41.4/src/pd_menus.tcl 2008-12-25 08:49:55 UTC (rev 10463) @@ -0,0 +1,309 @@ +# Copyright (c) 1997-2009 Miller Puckette. +#(c) 2008 WordTech Communications LLC. License: standard Tcl license,
http://www.tcl.tk/software/tcltk/license.html
+ +package provide pd_menus 0.1 + +package require Tk +#package require tile +## replace Tk widgets with Ttk widgets on 8.5 +#namespace import -force ttk::* + +package require pd_menucommands +namespace import ::pd_menucommands::* + +# TODO figure out Undo/Redo/Cut/Copy/Paste/DSP state changes for menus +# TODO figure out parent window/window list for Window menu + +# ------------------------------------------------------------------------------ +# global variables + +# for displaying on menus + +namespace eval ::pd_menus:: { + if {[tk windowingsystem] eq "aqua"} { + variable accelerator "Mod1" + } else { + variable accelerator "Ctrl" + } + + namespace export create_menubar + namespace export configure_pdwindow +} + +# ------------------------------------------------------------------------------ +# menu building functions for Mac OS X/aqua + +proc ::pd_menus::create_file_menu_aqua {rootmenu} { + variable accelerator + $rootmenu add command -label "New" -accelerator "$accelerator+N" + $rootmenu add command -label "Open" -accelerator "$accelerator+O" + $rootmenu add cascade -label "Open Recent" + $rootmenu add separator + $rootmenu add command -label "Close" -accelerator "$accelerator+W" + $rootmenu add command -label "Save" -accelerator "$accelerator+S" + $rootmenu add command -label "Save As..." -accelerator "$accelerator+Shift+S" + # $rootmenu add command -label "Save All" + $rootmenu add command -label "Revert to Saved" + $rootmenu add separator + $rootmenu add command -label "Message" + $rootmenu add separator + $rootmenu add command -label "Print..." -accelerator "$accelerator+P" +} + +# the "Edit", "Put", and "Find" menus do not have cross-platform differences + +proc ::pd_menus::create_media_menu_aqua {rootmenu} { +} + +proc ::pd_menus::create_window_menu_aqua {rootmenu} { +} + +# the "Help" does not have cross-platform differences + +# ------------------------------------------------------------------------------ +# menu building functions for UNIX/X11 + +proc ::pd_menus::create_file_menu_x11 {rootmenu} { + variable accelerator + $rootmenu add command -label "New" -accelerator "$accelerator+N" + $rootmenu add command -label "Open" -accelerator "$accelerator+O" + $rootmenu add separator + $rootmenu add command -label "Save" -accelerator "$accelerator+S" + $rootmenu add command -label "Save As..." -accelerator "Shift+$accelerator+S" + # $rootmenu add command -label "Revert" + $rootmenu add separator + $rootmenu add command -label "Message" -accelerator "$accelerator+M" + $rootmenu add command -label "Print..." -accelerator "$accelerator+P" + $rootmenu add separator + $rootmenu add command -label "Close" -accelerator "$accelerator+W" + $rootmenu add command -label "Quit" -accelerator "$accelerator+Q" \ + -command {menu_quit} +} + +# the "Edit", "Put", and "Find" menus do not have cross-platform differences + +proc ::pd_menus::create_media_menu_x11 {rootmenu} { +} + +proc ::pd_menus::create_window_menu_x11 {rootmenu} { +} + +# the "Help" does not have cross-platform differences + +# ------------------------------------------------------------------------------ +# menu building functions for Windows/Win32 + +proc ::pd_menus::create_file_menu_win32 {rootmenu} { + variable accelerator + $rootmenu add command -label "New" -accelerator "$accelerator+N" + $rootmenu add command -label "Open" -accelerator "$accelerator+O" + $rootmenu add separator + $rootmenu add command -label "Save" -accelerator "$accelerator+S" + $rootmenu add command -label "Save As..." -accelerator "Shift+$accelerator+S" + # $rootmenu add command -label "Revert" + $rootmenu add separator + $rootmenu add command -label "Message" -accelerator "$accelerator+M" + $rootmenu add command -label "Print..." -accelerator "$accelerator+P" + $rootmenu add separator + $rootmenu add command -label "Close" -accelerator "$accelerator+W" + $rootmenu add command -label "Quit" -accelerator "$accelerator+Q" \ + -command {menu_quit} +} + +# the "Edit", "Put", and "Find" menus do not have cross-platform differences + +proc ::pd_menus::create_media_menu_win32 {rootmenu} { +} + +proc ::pd_menus::create_window_menu_win32 {rootmenu} { +} + +# the "Help" does not have cross-platform differences + + +# ------------------------------------------------------------------------------ +# menu building functions +proc ::pd_menus::create_file_menu {rootmenu name} { + [format create_file_menu_%s [tk windowingsystem]] $rootmenu + $rootmenu entryconfigure "New" -command {menu_new} + $rootmenu entryconfigure "Open" -command {menu_open} + $rootmenu entryconfigure "Save" -command {menu_save $name} + $rootmenu entryconfigure "Save As..." -command {menu_saveas $name} + # $rootmenu entryconfigure "Revert*" -command {menu_revert $name} + $rootmenu entryconfigure "Close" -command {menu_close $name} + $rootmenu entryconfigure "Message" -command {menu_send} + $rootmenu entryconfigure "Print..." -command {menu_print $name} +} + +proc ::pd_menus::create_edit_menu {rootmenu name} { + variable accelerator + $rootmenu add command -label "Undo" -accelerator "$accelerator+Z" \ + -command {menu_undo $name} + $rootmenu add command -label "Redo" -accelerator "Shift+$accelerator+Z" \ + -command {menu_redo $name} + $rootmenu add separator + $rootmenu add command -label "Cut" -accelerator "$accelerator+X" \ + -command {menu_cut $name} + $rootmenu add command -label "Copy" -accelerator "$accelerator+C" \ + -command {menu_copy $name} + $rootmenu add command -label "Paste" -accelerator "$accelerator+V" \ + -command {menu_paste $name} + $rootmenu add command -label "Duplicate" -accelerator "$accelerator+D" \ + -command {menu_duplicate $name} + $rootmenu add command -label "Select All" -accelerator "$accelerator+A" \ + -command {menu_selectall $name} + $rootmenu add separator + $rootmenu add command -label "Text Editor" -accelerator "$accelerator+T" \ + -command {menu_texteditor $name} + $rootmenu add command -label "Font" \ + -command {menu_font $name} + $rootmenu add command -label "Tidy Up" \ + -command {menu_tidyup $name} + $rootmenu add command -label "Toggle Console" -accelerator "Shift+$accelerator+R" \ + -command {.controls.switches.console invoke} + $rootmenu add command -label "Clear Console" -accelerator "Shift+$accelerator+L" \ + -command {menu_clear_console} + $rootmenu add separator + $rootmenu add radiobutton -label "Edit Mode" -accelerator "$accelerator+E" \ + -indicatoron true -selectcolor grey85 \ + -command {menu_editmode $name} \ + + # if { $editable == 0 } { + # $name.m.edit entryconfigure "Edit mode" -indicatoron false + # } +} + +proc ::pd_menus::create_put_menu {rootmenu name} { + variable accelerator + $rootmenu add command -label "Object" -accelerator "$accelerator+1" \ + -command {menu_object $name 0} + $rootmenu add command -label "Message" -accelerator "$accelerator+2" \ + -command {menu_message $name 0} + $rootmenu add command -label "Number" -accelerator "$accelerator+3" \ + -command {menu_floatatom $name 0} + $rootmenu add command -label "Symbol" -accelerator "$accelerator+4" \ + -command {menu_symbolatom $name 0} + $rootmenu add command -label "Comment" -accelerator "$accelerator+5" \ + -command {menu_comment $name 0} + $rootmenu add separator + $rootmenu add command -label "Bang" -accelerator "Shift+$accelerator+B" \ + -command {menu_bng $name 0} + $rootmenu add command -label "Toggle" -accelerator "Shift+$accelerator+T" \ + -command {menu_toggle $name 0} + $rootmenu add command -label "Number2" -accelerator "Shift+$accelerator+N" \ + -command {menu_numbox $name 0} + $rootmenu add command -label "Vslider" -accelerator "Shift+$accelerator+V" \ + -command {menu_vslider $name 0} + $rootmenu add command -label "Hslider" -accelerator "Shift+$accelerator+H" \ + -command {menu_hslider $name 0} + $rootmenu add command -label "Vradio" -accelerator "Shift+$accelerator+D" \ + -command {menu_vradio $name 0} + $rootmenu add command -label "Hradio" -accelerator "Shift+$accelerator+I" \ + -command {menu_hradio $name 0} + $rootmenu add command -label "VU" -accelerator "Shift+$accelerator+U" \ + -command {menu_vumeter $name 0} + $rootmenu add command -label "Canvas" -accelerator "Shift+$accelerator+C" \ + -command {menu_mycnv $name 0} + $rootmenu add separator + $rootmenu add command -label Graph -command {menu_graph $name} + $rootmenu add command -label Array -command {menu_array $name} +} + +proc ::pd_menus::create_find_menu {rootmenu name} { + variable accelerator + $rootmenu add command -label "Find..." -accelerator "$accelerator+F" \ + -command {menu_findobject $name} + $rootmenu add command -label "Find Again" -accelerator "$accelerator+G" \ + -command {menu_findagain $name} + $rootmenu add command -label "Find last error" \ + -command {menu_finderror} +} + +proc ::pd_menus::create_media_menu {rootmenu name} { + variable accelerator + $rootmenu add radiobutton -label "Compute Audio On" -accelerator "$accelerator+/" \ + -command {menu_audio 1} + $rootmenu add radiobutton -label "Compute Audio Off" -accelerator "$accelerator+." \ + -command {menu_audio 0} -indicatoron true + $rootmenu add separator + $rootmenu add command -label "Test Audio and MIDI" \ + -command {menu_doc_open doc/7.stuff/tools testtone.pd} + $rootmenu add command -label "Load Meter" \ + -command {menu_doc_open doc/7.stuff/tools load-meter.pd} +} + +proc ::pd_menus::create_window_menu {rootmenu name} { + variable accelerator + if {[tk windowingsystem] eq "aqua"} { + $rootmenu add command -label "Minimize" -command {menu_minimize .} \ + -accelerator "$accelerator+M" + $rootmenu add command -label "Zoom" -command {menu_zoom .} + $rootmenu add separator + } + $rootmenu add command -label "Parent Window" -state disabled + $rootmenu add command -label "Pd window" -command {menu_raise_console} \ + -accelerator "$accelerator+R" -state disabled + $rootmenu add separator +} + +proc ::pd_menus::create_help_menu {rootmenu name} { + if {[tk windowingsystem] ne "aqua"} { + $rootmenu add command -label {About Pd} \ + -command {menu_doc_open doc/1.manual 1.introduction.txt} + } + $rootmenu add command -label {HTML ...} \ + -command {menu_doc_open doc/1.manual index.htm} + $rootmenu add command -label {Browser ...} \ + -command {menu_helpbrowser $help_top_directory} +} + +proc ::pd_menus::create_apple_menu {rootmenu name} { + $rootmenu add command -label "About Pd..." -command \ + {menu_doc_open doc/1.manual 1.introduction.txt} + menu $rootmenu.preferences -tearoff 0 + $rootmenu add cascade -label "Preferences" -menu $rootmenu.preferences + $rootmenu.preferences add command -label "Path..." \ + -command {pd pd start-path-dialog \;} + $rootmenu.preferences add command -label "Startup..." \ + -command {pd pd start-startup-dialog \;} + $rootmenu.preferences add command -label "Audio Settings..." \ + -command {pd pd audio-properties \;} + $rootmenu.preferences add command -label "MIDI settings..." \ + -command {pd pd midi-properties \;} +} + +proc ::pd_menus::create_menubar {rootmenu} { + menu $rootmenu + set menulist "file edit put find media window help" + if { [tk windowingsystem] eq "aqua" } { + set menulist "$menulist apple" + } + foreach menuitem $menulist { + menu $rootmenu.$menuitem -tearoff 0 + $rootmenu add cascade -label [string totitle $menuitem] \ + -menu $rootmenu.$menuitem + [format create_%s_menu $menuitem] $rootmenu.$menuitem PLACEHOLDER + if {[tk windowingsystem] eq "win32"} { + # fix menu font size on Windows with tk scaling = 1 + $rootmenu.$menuitem configure -font menufont + } + } +} + +proc ::pd_menus::configure_pdwindow {menubar} { + # these are meaningless for the Pd window, so disable them + set file_items_to_disable {"Save" "Save As..." "Print..." "Close"} + foreach item $file_items_to_disable { + $menubar.file entryconfigure $item -state disabled + } + set edit_items_to_disable {"Undo" "Redo" "Duplicate" "Tidy Up" "Edit Mode"} + foreach item $edit_items_to_disable { + $menubar.edit entryconfigure $item -state disabled + } + # disable everything on the Put menu + for {set i 0} {$i <= [$menubar.put index end]} {incr i} { + # catch errors by trying to disable separators + catch {$menubar.put entryconfigure $i -state disabled } + } +} + Added: branches/pd-devel/0.41.4/src/pkgIndex.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pkgIndex.tcl (rev 0) +++ branches/pd-devel/0.41.4/src/pkgIndex.tcl 2008-12-25 08:49:55 UTC (rev 10463) @@ -0,0 +1,12 @@ +# Tcl package index file, version 1.1 +# This file is generated by the "pkg_mkIndex" command +# and sourced either when an application starts up or +# by a "package unknown" script. It invokes the +# "package ifneeded" command to set up package-related +# information so that packages will be loaded automatically +# in response to "package require" commands. When this +# script is sourced, the variable $dir must contain the +# full path name of this file's directory. + +package ifneeded pdmenucommands 0.1 [list source [file join $dir pdmenucommands.tcl]] +package ifneeded pdmenus 0.1 [list source [file join $dir pdmenus.tcl]] This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data:[10462] branches/pd-devel/0.41.4/src/pd.tk
by eighthave@users.sourceforge.net
25 Dec '08
25 Dec '08
Revision: 10462
http://pure-data.svn.sourceforge.net/pure-data/?rev=10462&view=rev
Author: eighthave Date: 2008-12-25 07:54:48 +0000 (Thu, 25 Dec 2008) Log Message: ----------- flushed out the menus and created a menu for each window Modified Paths: -------------- branches/pd-devel/0.41.4/src/pd.tk Modified: branches/pd-devel/0.41.4/src/pd.tk =================================================================== --- branches/pd-devel/0.41.4/src/pd.tk 2008-12-25 06:17:02 UTC (rev 10461) +++ branches/pd-devel/0.41.4/src/pd.tk 2008-12-25 07:54:48 UTC (rev 10462) @@ -1,4 +1,8 @@ #!/usr/bin/wish +# For information on usage and redistribution, and for a DISCLAIMER OF ALL +# WARRANTIES, see the file, "LICENSE.txt," in this distribution. +# Copyright (c) 1997-2009 Miller Puckette. +#(c) 2008 WordTech Communications LLC. License: standard Tcl license,
http://www.tcl.tk/software/tcltk/license.html
package require Tk #package require tile @@ -115,19 +119,15 @@ $rootmenu add command -label "Print..." -accelerator "$accelerator+P" } -proc menu_create_edit_aqua {rootmenu} { -} +# the "Edit", "Put", and "Find" menus do not have cross-platform differences -# the "Put" and "Find" menus do not have cross-platform differences - proc menu_create_media_aqua {rootmenu} { } proc menu_create_window_aqua {rootmenu} { } -proc menu_create_help_aqua {rootmenu} { -} +# the "Help" does not have cross-platform differences # ------------------------------------------------------------------------------ # menu building functions for UNIX/X11 @@ -139,7 +139,7 @@ $rootmenu add separator $rootmenu add command -label "Save" -accelerator "$accelerator+S" $rootmenu add command -label "Save As..." -accelerator "Shift+$accelerator+S" - $rootmenu add command -label "Revert" +# $rootmenu add command -label "Revert" $rootmenu add separator $rootmenu add command -label "Message" -accelerator "$accelerator+M" $rootmenu add command -label "Print..." -accelerator "$accelerator+P" @@ -149,19 +149,15 @@ -command {menu_quit} } -proc menu_create_edit_x11 {rootmenu} { -} +# the "Edit", "Put", and "Find" menus do not have cross-platform differences -# the "Put" and "Find" menus do not have cross-platform differences - proc menu_create_media_x11 {rootmenu} { } proc menu_create_window_x11 {rootmenu} { } -proc menu_create_help_x11 {rootmenu} { -} +# the "Help" does not have cross-platform differences # ------------------------------------------------------------------------------ # menu building functions for Windows/Win32 @@ -173,7 +169,7 @@ $rootmenu add separator $rootmenu add command -label "Save" -accelerator "$accelerator+S" $rootmenu add command -label "Save As..." -accelerator "Shift+$accelerator+S" - $rootmenu add command -label "Revert" +# $rootmenu add command -label "Revert" $rootmenu add separator $rootmenu add command -label "Message" -accelerator "$accelerator+M" $rootmenu add command -label "Print..." -accelerator "$accelerator+P" @@ -183,19 +179,15 @@ -command {menu_quit} } -proc menu_create_edit_win32 {rootmenu} { -} +# the "Edit", "Put", and "Find" menus do not have cross-platform differences -# the "Put" and "Find" menus do not have cross-platform differences - proc menu_create_media_win32 {rootmenu} { } proc menu_create_window_win32 {rootmenu} { } -proc menu_create_help_win32 {rootmenu} { -} +# the "Help" does not have cross-platform differences # ------------------------------------------------------------------------------ @@ -206,17 +198,51 @@ $rootmenu entryconfigure "Open" -command {menu_open} $rootmenu entryconfigure "Save" -command {menu_save $name} $rootmenu entryconfigure "Save As..." -command {menu_saveas $name} - $rootmenu entryconfigure "Revert*" -command {menu_revert $name} +# $rootmenu entryconfigure "Revert*" -command {menu_revert $name} $rootmenu entryconfigure "Close" -command {menu_close $name} $rootmenu entryconfigure "Message" -command {menu_send} $rootmenu entryconfigure "Print..." -command {menu_print $name} } proc menu_create_edit {rootmenu name} { -# [format menu_create_edit_%s [tk windowingsystem]] $rootmenu -# $rootmenu entryconfigure "New" -command {menu_new} + global accelerator + $rootmenu add command -label "Undo" -accelerator "$accelerator+Z" \ + -command {menu_undo $name} + $rootmenu add command -label "Redo" -accelerator "Shift+$accelerator+Z" \ + -command {menu_redo $name} + $rootmenu add separator + $rootmenu add command -label "Cut" -accelerator "$accelerator+X" \ + -command {menu_cut $name} + $rootmenu add command -label "Copy" -accelerator "$accelerator+C" \ + -command {menu_copy $name} + $rootmenu add command -label "Paste" -accelerator "$accelerator+V" \ + -command {menu_paste $name} + $rootmenu add command -label "Duplicate" -accelerator "$accelerator+D" \ + -command {menu_duplicate $name} + $rootmenu add command -label "Select All" -accelerator "$accelerator+A" \ + -command {menu_selectall $name} + $rootmenu add separator + $rootmenu add command -label "Text Editor" -accelerator "$accelerator+T" \ + -command {menu_texteditor $name} + $rootmenu add command -label "Font" \ + -command {menu_font $name} + $rootmenu add command -label "Tidy Up" \ + -command {menu_tidyup $name} + $rootmenu add command -label "Toggle Console" -accelerator "Shift+$accelerator+R" \ + -command {.controls.switches.console invoke} + $rootmenu add command -label "Clear Console" -accelerator "Shift+$accelerator+L" \ + -command {menu_clear_console} + $rootmenu add separator + $rootmenu add radiobutton -label "Edit Mode" -accelerator "$accelerator+E" \ + -indicatoron true -selectcolor grey85 \ + -command {menu_editmode $name} \ + +# if { $editable == 0 } { +# $name.m.edit entryconfigure "Edit mode" -indicatoron false +# } } + proc menu_create_put {rootmenu name} { global accelerator $rootmenu add command -label "Object" -accelerator "$accelerator+1" \ @@ -253,10 +279,42 @@ $rootmenu add command -label Array -command {menu_array $name} } +proc menu_create_find {rootmenu name} { + global accelerator + $rootmenu add command -label "Find..." -accelerator "$accelerator+F" \ + -command {menu_findobject $name} + $rootmenu add command -label "Find Again" -accelerator "$accelerator+G" \ + -command {menu_findagain $name} + $rootmenu add command -label "Find last error" \ + -command {menu_finderror} + +} + proc menu_create_media {rootmenu name} { + global accelerator + $rootmenu add radiobutton -label "Compute Audio On" -accelerator "$accelerator+/" \ + -command {menu_audio 1} + $rootmenu add radiobutton -label "Compute Audio Off" -accelerator "$accelerator+." \ + -command {menu_audio 0} -indicatoron true + $rootmenu add separator + $rootmenu add command -label "Test Audio and MIDI" \ + -command {menu_doc_open doc/7.stuff/tools testtone.pd} + $rootmenu add command -label "Load Meter" \ + -command {menu_doc_open doc/7.stuff/tools load-meter.pd} } proc menu_create_window {rootmenu name} { + global accelerator + if {[tk windowingsystem] eq "aqua"} { + $rootmenu add command -label "Minimize" -command {menu_minimize .} \ + -accelerator "$accelerator+M" + $rootmenu add command -label "Zoom" -command {menu_zoom .} + $rootmenu add separator + } + $rootmenu add command -label "Parent Window" -state disabled + $rootmenu add command -label "Pd window" -command {menu_raise_console} \ + -accelerator "$accelerator+R" -state disabled + $rootmenu add separator } proc menu_create_help {rootmenu name} { @@ -286,7 +344,8 @@ } proc menu_create {rootmenu} { - set menulist "file edit put media window help" + menu $rootmenu + set menulist "file edit put find media window help" if { [tk windowingsystem] eq "aqua" } { set menulist "$menulist apple" } @@ -302,34 +361,21 @@ } } -proc menu_entryconfigure {menuname itemname} { - set itemindex [$menuname ] - $menuname entryconfigure -} - -proc menu_configure {menubar window} { - puts "menu_configure $window" - set file_items_to_disable {"Save" "Save As..." "Revert" "Print..." "Close"} - if {$window eq "."} { - # these are meaningless for the Pd window, so disable them - foreach item $file_items_to_disable { - $menubar.file entryconfigure $item -state disabled - } - for {set i 0} {$i <= [$menubar.put index end]} {incr i} { - # catch errors by trying to disable separators - catch {$menubar.put entryconfigure $i -state disabled } - } - } else { - foreach item $file_items_to_disable { - $menubar.file entryconfigure $item -state normal - } - for {set i 0} {$i <= [$menubar.put index end]} {incr i} { - # catch errors by trying to disable separators - catch {$menubar.put entryconfigure $i -state normal } - } - # TODO re-enable menu items - # TODO configure "parent on Window menu +proc menu_configure_pdwindow {menubar} { + # these are meaningless for the Pd window, so disable them + set file_items_to_disable {"Save" "Save As..." "Print..." "Close"} + foreach item $file_items_to_disable { + $menubar.file entryconfigure $item -state disabled } + set edit_items_to_disable {"Undo" "Redo" "Duplicate" "Tidy Up" "Edit Mode"} + foreach item $edit_items_to_disable { + $menubar.edit entryconfigure $item -state disabled + } + # disable everything on the Put menu + for {set i 0} {$i <= [$menubar.put index end]} {incr i} { + # catch errors by trying to disable separators + catch {$menubar.put entryconfigure $i -state disabled } + } } # ------------------------------------------------------------------------------ @@ -337,8 +383,9 @@ proc pdtk_canvas_new {canvas_name width height} { if {$width < 300} {set width 300} if {$height < 150} {set height 150} - toplevel $canvas_name -menu .menubar -width $width -height $height - bind $canvas_name <FocusIn> {menu_configure .menubar %W} + toplevel $canvas_name -width $width -height $height + menu_create $canvas_name.menubar + $canvas_name configure -menu $canvas_name.menubar } # ------------------------------------------------------------------------------ @@ -346,14 +393,12 @@ proc main {} { init - menu .menubar + wm title . "Pd-devel" + wm protocol . WM_DELETE_WINDOW menu_quit + menu_create .menubar - - wm title . "Pd-devel" - #wm protocol . WM_DELETE_WINDOW menu_quit . configure -menu .menubar -width 400 -height 250 - menu_configure .menubar . - bind . <FocusIn> {menu_configure .menubar %W} + menu_configure_pdwindow .menubar } main This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
SF.net SVN: pure-data:[10461] branches/pd-devel/0.41.4/src/pd.tk
by eighthave@users.sourceforge.net
25 Dec '08
25 Dec '08
Revision: 10461
http://pure-data.svn.sourceforge.net/pure-data/?rev=10461&view=rev
Author: eighthave Date: 2008-12-25 06:17:02 +0000 (Thu, 25 Dec 2008) Log Message: ----------- made the formatting nice and neat, yes I am embracing my OCD Modified Paths: -------------- branches/pd-devel/0.41.4/src/pd.tk Modified: branches/pd-devel/0.41.4/src/pd.tk =================================================================== --- branches/pd-devel/0.41.4/src/pd.tk 2008-12-25 00:06:06 UTC (rev 10460) +++ branches/pd-devel/0.41.4/src/pd.tk 2008-12-25 06:17:02 UTC (rev 10461) @@ -100,19 +100,19 @@ proc menu_create_file_aqua {rootmenu} { global accelerator - $rootmenu add command -label "New" -accelerator "$accelerator+N" - $rootmenu add command -label "Open" -accelerator "$accelerator+O" + $rootmenu add command -label "New" -accelerator "$accelerator+N" + $rootmenu add command -label "Open" -accelerator "$accelerator+O" $rootmenu add cascade -label "Open Recent" - $rootmenu add separator - $rootmenu add command -label "Close" -accelerator "$accelerator+W" - $rootmenu add command -label "Save" -accelerator "$accelerator+S" + $rootmenu add separator + $rootmenu add command -label "Close" -accelerator "$accelerator+W" + $rootmenu add command -label "Save" -accelerator "$accelerator+S" $rootmenu add command -label "Save As..." -accelerator "$accelerator+Shift+S" # $rootmenu add command -label "Save All" $rootmenu add command -label "Revert to Saved" - $rootmenu add separator + $rootmenu add separator $rootmenu add command -label "Message" - $rootmenu add separator - $rootmenu add command -label "Print..." -accelerator "$accelerator+P" + $rootmenu add separator + $rootmenu add command -label "Print..." -accelerator "$accelerator+P" } proc menu_create_edit_aqua {rootmenu} { @@ -134,19 +134,19 @@ proc menu_create_file_x11 {rootmenu} { global accelerator - $rootmenu add command -label "New" -accelerator "$accelerator+N" - $rootmenu add command -label "Open" -accelerator "$accelerator+O" + $rootmenu add command -label "New" -accelerator "$accelerator+N" + $rootmenu add command -label "Open" -accelerator "$accelerator+O" $rootmenu add separator - $rootmenu add command -label "Save" -accelerator "$accelerator+S" + $rootmenu add command -label "Save" -accelerator "$accelerator+S" $rootmenu add command -label "Save As..." -accelerator "Shift+$accelerator+S" $rootmenu add command -label "Revert" $rootmenu add separator - $rootmenu add command -label "Message" -accelerator "$accelerator+M" - $rootmenu add command -label "Print..." -accelerator "$accelerator+P" - $rootmenu add separator - $rootmenu add command -label "Close" -accelerator "$accelerator+W" - $rootmenu add command -label "Quit" -command {menu_quit} \ - -accelerator "$accelerator+Q" + $rootmenu add command -label "Message" -accelerator "$accelerator+M" + $rootmenu add command -label "Print..." -accelerator "$accelerator+P" + $rootmenu add separator + $rootmenu add command -label "Close" -accelerator "$accelerator+W" + $rootmenu add command -label "Quit" -accelerator "$accelerator+Q" \ + -command {menu_quit} } proc menu_create_edit_x11 {rootmenu} { @@ -168,19 +168,19 @@ proc menu_create_file_win32 {rootmenu} { global accelerator - $rootmenu add command -label "New" -accelerator "$accelerator+N" - $rootmenu add command -label "Open" -accelerator "$accelerator+O" + $rootmenu add command -label "New" -accelerator "$accelerator+N" + $rootmenu add command -label "Open" -accelerator "$accelerator+O" $rootmenu add separator - $rootmenu add command -label "Save" -accelerator "$accelerator+S" + $rootmenu add command -label "Save" -accelerator "$accelerator+S" $rootmenu add command -label "Save As..." -accelerator "Shift+$accelerator+S" $rootmenu add command -label "Revert" $rootmenu add separator - $rootmenu add command -label "Message" -accelerator "$accelerator+M" - $rootmenu add command -label "Print..." -accelerator "$accelerator+P" - $rootmenu add separator - $rootmenu add command -label "Close" -accelerator "$accelerator+W" - $rootmenu add command -label "Quit" -command {menu_quit} \ - -accelerator "$accelerator+Q" + $rootmenu add command -label "Message" -accelerator "$accelerator+M" + $rootmenu add command -label "Print..." -accelerator "$accelerator+P" + $rootmenu add separator + $rootmenu add command -label "Close" -accelerator "$accelerator+W" + $rootmenu add command -label "Quit" -accelerator "$accelerator+Q" \ + -command {menu_quit} } proc menu_create_edit_win32 {rootmenu} { @@ -202,14 +202,14 @@ # menu building functions proc menu_create_file {rootmenu name} { [format menu_create_file_%s [tk windowingsystem]] $rootmenu - $rootmenu entryconfigure "New" -command {menu_new} - $rootmenu entryconfigure "Open" -command {menu_open} - $rootmenu entryconfigure "Save" -command {menu_save $name} + $rootmenu entryconfigure "New" -command {menu_new} + $rootmenu entryconfigure "Open" -command {menu_open} + $rootmenu entryconfigure "Save" -command {menu_save $name} $rootmenu entryconfigure "Save As..." -command {menu_saveas $name} - $rootmenu entryconfigure "Revert*" -command {menu_revert $name} - $rootmenu entryconfigure "Close" -command {menu_close $name} - $rootmenu entryconfigure "Message" -command {menu_send} - $rootmenu entryconfigure "Print..." -command {menu_print $name} + $rootmenu entryconfigure "Revert*" -command {menu_revert $name} + $rootmenu entryconfigure "Close" -command {menu_close $name} + $rootmenu entryconfigure "Message" -command {menu_send} + $rootmenu entryconfigure "Print..." -command {menu_print $name} } proc menu_create_edit {rootmenu name} { @@ -219,20 +219,20 @@ proc menu_create_put {rootmenu name} { global accelerator - $rootmenu add command -label "Object" -accelerator "$accelerator+1" \ + $rootmenu add command -label "Object" -accelerator "$accelerator+1" \ -command {menu_object $name 0} $rootmenu add command -label "Message" -accelerator "$accelerator+2" \ -command {menu_message $name 0} - $rootmenu add command -label "Number" -accelerator "$accelerator+3" \ + $rootmenu add command -label "Number" -accelerator "$accelerator+3" \ -command {menu_floatatom $name 0} - $rootmenu add command -label "Symbol" -accelerator "$accelerator+4" \ + $rootmenu add command -label "Symbol" -accelerator "$accelerator+4" \ -command {menu_symbolatom $name 0} $rootmenu add command -label "Comment" -accelerator "$accelerator+5" \ -command {menu_comment $name 0} - $rootmenu add separator - $rootmenu add command -label "Bang" -accelerator "Shift+$accelerator+B" \ + $rootmenu add separator + $rootmenu add command -label "Bang" -accelerator "Shift+$accelerator+B" \ -command {menu_bng $name 0} - $rootmenu add command -label "Toggle" -accelerator "Shift+$accelerator+T" \ + $rootmenu add command -label "Toggle" -accelerator "Shift+$accelerator+T" \ -command {menu_toggle $name 0} $rootmenu add command -label "Number2" -accelerator "Shift+$accelerator+N" \ -command {menu_numbox $name 0} @@ -240,17 +240,17 @@ -command {menu_vslider $name 0} $rootmenu add command -label "Hslider" -accelerator "Shift+$accelerator+H" \ -command {menu_hslider $name 0} - $rootmenu add command -label "Vradio" -accelerator "Shift+$accelerator+D" \ + $rootmenu add command -label "Vradio" -accelerator "Shift+$accelerator+D" \ -command {menu_vradio $name 0} - $rootmenu add command -label "Hradio" -accelerator "Shift+$accelerator+I" \ + $rootmenu add command -label "Hradio" -accelerator "Shift+$accelerator+I" \ -command {menu_hradio $name 0} - $rootmenu add command -label "VU" -accelerator "Shift+$accelerator+U" \ + $rootmenu add command -label "VU" -accelerator "Shift+$accelerator+U" \ -command {menu_vumeter $name 0} - $rootmenu add command -label "Canvas" -accelerator "Shift+$accelerator+C"\ + $rootmenu add command -label "Canvas" -accelerator "Shift+$accelerator+C" \ -command {menu_mycnv $name 0} - $rootmenu add separator + $rootmenu add separator $rootmenu add command -label Graph -command {menu_graph $name} - $rootmenu add command -label Array -command {menu_array $name} + $rootmenu add command -label Array -command {menu_array $name} } proc menu_create_media {rootmenu name} { This was sent by the
SourceForge.net
collaborative development platform, the world's largest Open Source development site.
1
0
0
0
← Newer
1
2
3
4
...
13
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
Results per page:
10
25
50
100
200